Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪟 refactor: Remove Legacy Dialog and DialogTemplate from Client Package (#17430)
Marco Beretta6050cee9de61
diff --git a/client/src/components/SidePanel/Builder/ContextButton.tsx b/client/src/components/SidePanel/Builder/ContextButton.tsxindex 3379284a1f..0d8eb9d9d1 100644--- a/client/src/components/SidePanel/Builder/ContextButton.tsx+++ b/client/src/components/SidePanel/Builder/ContextButton.tsx@@ -1,16 +1,16 @@import {- Dialog,- DialogTrigger,Label,- DialogTemplate,- useToastContext,+ Button,+ OGDialog,TrashIcon,+ OGDialogTrigger,+ useToastContext,+ OGDialogTemplate,} from '@librechat/client';import type { Assistant, AssistantCreateParams, AssistantsEndpoint } from 'librechat-data-provider';import type { UseMutationResult } from '@tanstack/react-query';import { useDeleteAssistantMutation } from '~/data-provider';import { useLocalize, useSetIndexOptions } from '~/hooks';-import { cn, removeFocusOutlines } from '~/utils';import { useChatContext } from '~/Providers';export default function ContextButton({@@ -85,21 +85,21 @@ export default function ContextButton({}return (- <Dialog>- <DialogTrigger asChild>- <button- className={cn(- 'btn btn-neutral border-border-light relative h-9 rounded-lg font-medium',- removeFocusOutlines,- )}+ <OGDialog>+ <OGDialogTrigger asChild>+ <Button+ size="sm"+ variant="outline"+ aria-label={localize('com_ui_delete_assistant')}+ title={localize('com_ui_delete_assistant')}type="button"><div className="text-text-destructive flex w-full items-center justify-center gap-2"><TrashIcon /></div>- </button>- </DialogTrigger>- <DialogTemplate+ </Button>+ </OGDialogTrigger>+ <OGDialogTemplatetitle={localize('com_ui_delete_assistant')}className="max-w-[28.125rem]"main={@@ -121,6 +121,6 @@ export default function ContextButton({selectText: localize('com_ui_delete'),}}/>- </Dialog>+ </OGDialog>);}diff --git a/e2e/specs/mock/scenarios/assistant-delete-dialog.spec.ts b/e2e/specs/mock/scenarios/assistant-delete-dialog.spec.tsnew file mode 100644index 0000000000..26e4001515--- /dev/null+++ b/e2e/specs/mock/scenarios/assistant-delete-dialog.spec.ts@@ -0,0 +1,164 @@+import { expect, test } from '@playwright/test';+import type { Locator, Page } from '@playwright/test';+import { getAccessToken, requestJson } from '../helpers';+import { openSidebar } from './sidebar';++/**+ * The Assistant Builder's delete control confirms through the shared `OGDialog` template.+ * The trigger is a named button, the dialog carries its title and warning, Cancel and Escape+ * leave the assistant in place, Delete removes it, and a failed delete keeps it listed while+ * telling the user.+ */++type CreatedAssistant = { id: string };+type AssistantList = { data: { id: string }[] };++const ASSISTANT_NAME = 'E2E delete dialog assistant';+const ENDPOINT_QUERY = 'endpoint=assistants&model=gpt-4o-mini';++async function createAssistant(page: Page): Promise<CreatedAssistant> {+ await page.goto('/c/new', { timeout: 10000 });+ const token = await getAccessToken(page);+ return requestJson<CreatedAssistant>(page, {+ path: '/api/assistants/v2',+ token,+ method: 'POST',+ body: { endpoint: 'assistants', model: 'gpt-4o-mini', name: ASSISTANT_NAME },+ });+}++async function assistantExists(page: Page, assistantId: string): Promise<boolean> {+ const token = await getAccessToken(page);+ const list = await requestJson<AssistantList>(page, {+ path: `/api/assistants/v2?${ENDPOINT_QUERY}`,+ token,+ });+ return list.data.some((assistant) => assistant.id === assistantId);+}++async function deleteAssistant(page: Page, assistantId: string) {+ if (!(await assistantExists(page, assistantId))) {+ return;+ }+ const token = await getAccessToken(page);+ await requestJson(page, {+ path: `/api/assistants/v2/${encodeURIComponent(assistantId)}?${ENDPOINT_QUERY}`,+ token,+ method: 'DELETE',+ body: { endpoint: 'assistants' },+ });+}++async function openDeleteTrigger(page: Page): Promise<Locator> {+ await page.goto(`/c/new?${ENDPOINT_QUERY}`, { timeout: 10000 });+ await openSidebar(page);+ /** The mobile drawer opens on chat history; its panels are items of the Control Panel menu. */+ const controlPanel = page.getByRole('button', { name: 'Control Panel' });+ if (await controlPanel.isVisible()) {+ await controlPanel.click();+ await page.getByRole('menuitemcheckbox', { name: 'Assistant Builder' }).click();+ } else {+ await page.getByRole('button', { name: 'Assistant Builder' }).first().click();+ }+ await expect(+ page.getByTestId('select-dropdown-button').first().getByText(ASSISTANT_NAME, { exact: true }),+ ).toBeVisible();+ const trigger = page.getByRole('button', { name: 'Delete Assistant', exact: true });+ await expect(trigger).toBeVisible();+ return trigger;+}++async function expectConfirmDialog(page: Page): Promise<Locator> {+ const dialog = page.getByRole('dialog', { name: 'Delete Assistant' });+ await expect(dialog).toBeVisible();+ await expect(+ dialog.getByText('Are you sure you want to delete this Assistant? This cannot be undone.'),+ ).toBeVisible();+ return dialog;+}++test.describe('assistant delete confirmation', () => {+ test('confirming the dialog deletes the assistant @scenario:assistant-delete-dialog-confirm', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const assistant = await createAssistant(page);++ try {+ const trigger = await openDeleteTrigger(page);+ await trigger.click();+ const dialog = await expectConfirmDialog(page);++ await dialog.getByRole('button', { name: 'Delete', exact: true }).click();+ await expect(dialog).toBeHidden();+ await expect(page.getByText('Successfully deleted assistant', { exact: true })).toBeVisible();+ await expect.poll(() => assistantExists(page, assistant.id)).toBe(false);+ } finally {+ await deleteAssistant(page, assistant.id);+ }+ });++ test('Cancel and Escape keep the assistant and return focus @scenario:assistant-delete-dialog-dismiss', async ({+ page,+ isMobile,+ }) => {+ test.setTimeout(60000);+ const assistant = await createAssistant(page);++ try {+ const trigger = await openDeleteTrigger(page);++ await trigger.focus();+ await page.keyboard.press('Enter');+ let dialog = await expectConfirmDialog(page);+ await dialog.getByRole('button', { name: 'Cancel', exact: true }).click();+ await expect(dialog).toBeHidden();+ await expect(trigger).toBeFocused();++ await page.keyboard.press('Enter');+ dialog = await expectConfirmDialog(page);+ await page.keyboard.press('Escape');+ await expect(dialog).toBeHidden();+ /** The mobile drawer also collapses on that Escape, for every dialog opened from it+ * (berry-13/LibreChat#428), which takes the trigger with it. */+ if (!isMobile) {+ await expect(trigger).toBeFocused();+ }++ expect(await assistantExists(page, assistant.id)).toBe(true);+ } finally {+ await deleteAssistant(page, assistant.id);+ }+ });++ test('a failed delete keeps the assistant and reports the error @scenario:assistant-delete-dialog-error', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const assistant = await createAssistant(page);+ const deleteUrl = (url: URL) =>+ url.pathname.startsWith('/api/assistants/') && url.pathname.endsWith(assistant.id);++ try {+ const trigger = await openDeleteTrigger(page);+ await page.route(deleteUrl, (route) =>+ route.request().method() === 'DELETE'+ ? route.fulfill({ status: 500, json: { message: 'delete failed' } })+ : route.fallback(),+ );++ await trigger.click();+ const dialog = await expectConfirmDialog(page);+ await dialog.getByRole('button', { name: 'Delete', exact: true }).click();+ await expect(+ page.getByText('There was an error deleting the assistant', { exact: true }),+ ).toBeVisible();++ await page.unroute(deleteUrl);+ expect(await assistantExists(page, assistant.id)).toBe(true);+ } finally {+ await page.unroute(deleteUrl);+ await deleteAssistant(page, assistant.id);+ }+ });+});diff --git a/e2e/specs/mock/scenarios/scrim-opacity.spec.ts b/e2e/specs/mock/scenarios/scrim-opacity.spec.tsindex 1ca20667b5..42b09de6d6 100644--- a/e2e/specs/mock/scenarios/scrim-opacity.spec.ts+++ b/e2e/specs/mock/scenarios/scrim-opacity.spec.ts@@ -4,15 +4,15 @@ import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/climport { NEW_CHAT_PATH } from '../helpers';/**- * The dialog scrims' opacity roles. OGDialog, AlertDialog and Dialog lay `surface-overlay` over the- * page at `scrimOpacity`, `alertScrimOpacity` and `modalScrimOpacity`, which default to the 80%,- * 90% and 65% the families always drew. ClickHouse takes Click UI's 0.75 for all three, and a- * reference theme proves each family follows its own role. The probes carry the scrim classes- * the three overlays compose, so only the roles style them.+ * The dialog scrims' opacity roles. OGDialog and AlertDialog lay `surface-overlay` over the page at+ * `scrimOpacity` and `alertScrimOpacity`, which default to the 80% and 90% the families always+ * drew. ClickHouse takes Click UI's 0.75 for both, and a reference theme proves each family+ * follows its own role. The probes carry the scrim classes the overlays compose, so only the+ * roles style them.*/type Mode = 'light' | 'dark';-type Scrims = { dialog: string; alert: string; modal: string };+type Scrims = { dialog: string; alert: string };const REFERENCE_THEME = {version: 1,@@ -20,11 +20,11 @@ const REFERENCE_THEME = {modes: {light: {colors: { 'rgb-surface-overlay': '10 20 30' },- appearance: { scrimOpacity: '0.5', alertScrimOpacity: '0.6', modalScrimOpacity: '0.7' },+ appearance: { scrimOpacity: '0.5', alertScrimOpacity: '0.6' },},dark: {colors: { 'rgb-surface-overlay': '10 20 30' },- appearance: { scrimOpacity: '0.5', alertScrimOpacity: '0.6', modalScrimOpacity: '0.7' },+ appearance: { scrimOpacity: '0.5', alertScrimOpacity: '0.6' },},},} as const;@@ -71,7 +71,6 @@ function scrims(page: Page): Promise<Scrims> {return {dialog: fill('bg-scrim'),alert: fill('bg-scrim-alert'),- modal: fill('bg-scrim-modal'),};});}@@ -86,7 +85,6 @@ const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; eexpected: {dialog: 'rgba(89, 89, 89, 0.8)',alert: 'rgba(89, 89, 89, 0.9)',- modal: 'rgba(89, 89, 89, 0.65)',},},{@@ -96,7 +94,6 @@ const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; eexpected: {dialog: 'rgba(0, 0, 0, 0.8)',alert: 'rgba(0, 0, 0, 0.9)',- modal: 'rgba(0, 0, 0, 0.65)',},},{@@ -107,7 +104,6 @@ const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; eexpected: {dialog: 'rgba(21, 21, 21, 0.75)',alert: 'rgba(21, 21, 21, 0.75)',- modal: 'rgba(21, 21, 21, 0.75)',},},{@@ -118,7 +114,6 @@ const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; eexpected: {dialog: 'rgba(96, 96, 96, 0.75)',alert: 'rgba(96, 96, 96, 0.75)',- modal: 'rgba(96, 96, 96, 0.75)',},},{@@ -129,7 +124,6 @@ const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; eexpected: {dialog: 'rgba(10, 20, 30, 0.5)',alert: 'rgba(10, 20, 30, 0.6)',- modal: 'rgba(10, 20, 30, 0.7)',},},];diff --git a/e2e/specs/mock/scenarios/target-floor.spec.ts b/e2e/specs/mock/scenarios/target-floor.spec.tsindex 75ba9d5261..d5661755a3 100644--- a/e2e/specs/mock/scenarios/target-floor.spec.ts+++ b/e2e/specs/mock/scenarios/target-floor.spec.ts@@ -1,19 +1,15 @@import { expect, test } from '@playwright/test';import type { Page } from '@playwright/test';-import { NEW_CHAT_PATH, getAccessToken, requestJson } from '../helpers';+import { NEW_CHAT_PATH } from '../helpers';import { probeStyle } from './style.helpers';-import { openSidebar } from './sidebar';/**- * WCAG 2.5.8's 24px target minimum reaches the Button's default and `sm` heights and the exported- * Dialog's close button. The default theme keeps every size it drew; a stored theme naming a+ * WCAG 2.5.8's 24px target minimum reaches the Button's default and `sm` heights and the OGDialog+ * close button. The default theme keeps every size it drew; a stored theme naming a* smaller Button height still loads, and draws its Buttons at the floor.*/type Mode = 'light' | 'dark';-type CreatedAssistant = { id: string };--const ASSISTANT_NAME = 'E2E dialog close target assistant';/** Button heights under the floor, which the theme validator has always accepted. */const SMALL_BUTTON_THEME = {@@ -88,85 +84,47 @@ test.describe('target floor', () => {}});- test('the exported Dialog close button is a 24px target with its glyph in place @scenario:dialog-close-target', async ({+ test('the OGDialog close button is a 24px target with its glyph inside it @scenario:ogdialog-close-target', async ({page,}) => {- test.setTimeout(90000);- await page.goto('/c/new', { timeout: 10000 });- const token = await getAccessToken(page);- const assistant = await requestJson<CreatedAssistant>(page, {- path: '/api/assistants/v2',- token,- method: 'POST',- body: { endpoint: 'assistants', model: 'gpt-4o-mini', name: ASSISTANT_NAME },- });-- try {- for (const mode of ['light', 'dark'] as const) {- await page.addInitScript((selected) => {- localStorage.setItem('color-theme', selected);- localStorage.setItem('navVisible', 'true');- }, mode);- await page.goto('/c/new?endpoint=assistants&model=gpt-4o-mini', { timeout: 10000 });- await expect(page.locator('html')).toHaveClass(mode === 'dark' ? /\bdark\b/ : /\blight\b/);- await openSidebar(page);- const controlPanel = page.getByRole('button', { name: 'Control Panel' });- if (await controlPanel.isVisible()) {- await controlPanel.click();- await page.getByRole('menuitemcheckbox', { name: 'Assistant Builder' }).click();- } else {- /** The panel choice persists, so the second mode finds the builder already open and a- * click would close it. */- const builder = page.getByRole('button', { name: 'Assistant Builder' }).first();- if ((await builder.getAttribute('aria-pressed')) !== 'true') {- await builder.click();- }- }- const picker = page.getByTestId('select-dropdown-button').first();- await expect(picker.getByText(ASSISTANT_NAME, { exact: true })).toBeVisible();-- /** The delete control is the builder's only neutral button holding a destructive icon. */- await page- .locator('button.btn-neutral')- .filter({ has: page.locator('.text-text-destructive') })- .click();- const dialog = page.getByRole('dialog', { name: 'Delete Assistant' });- await expect(dialog).toBeVisible();- /** The dialog slides in, so its frame and glyph are only comparable once it settles. */- await dialog.evaluate((element) =>- Promise.all(- element.getAnimations({ subtree: true }).map((animation) => animation.finished),- ),- );-- const close = dialog.getByRole('button', { name: 'Close' });- const [box, glyph, frame] = await Promise.all([- close.boundingBox(),- close.locator('svg').boundingBox(),- dialog.boundingBox(),- ]);- expect(box && glyph && frame).toBeTruthy();- if (!box || !glyph || !frame) {- return;- }- expect(box.width).toBeGreaterThanOrEqual(24);- expect(box.height).toBeGreaterThanOrEqual(24);- /** The 20px glyph stays where it drew before the floor: 1.6rem down, 1.5rem in. */- expect(glyph.width).toBeCloseTo(20, 0);- expect(glyph.y - frame.y).toBeCloseTo(25.6, 0);- expect(frame.x + frame.width - (glyph.x + glyph.width)).toBeCloseTo(24, 0);+ for (const mode of ['light', 'dark'] as const) {+ const modePage = mode === 'light' ? page : await page.context().newPage();+ await modePage.addInitScript((selected) => {+ localStorage.setItem('color-theme', selected);+ }, mode);+ await modePage.goto('/agents/all', { timeout: 15000 });+ await expect(modePage.locator('html')).toHaveClass(+ mode === 'dark' ? /\bdark\b/ : /\blight\b/,+ );+ await modePage.getByRole('button', { name: 'Admin Settings' }).click();+ const dialog = modePage.getByRole('dialog');+ await expect(dialog).toBeVisible({ timeout: 15000 });+ /** The dialog animates in, so its close control is only measurable once it settles. */+ await dialog.evaluate((element) =>+ Promise.all(+ element.getAnimations({ subtree: true }).map((animation) => animation.finished),+ ),+ );- await close.focus();- await page.keyboard.press('Enter');- await expect(dialog).toBeHidden();+ const close = dialog.getByRole('button', { name: 'Close' });+ const [box, glyph] = await Promise.all([+ close.boundingBox(),+ close.locator('svg').boundingBox(),+ ]);+ expect(box && glyph).toBeTruthy();+ if (!box || !glyph) {+ return;}- } finally {- await requestJson(page, {- path: `/api/assistants/v2/${encodeURIComponent(assistant.id)}?endpoint=assistants&model=gpt-4o-mini`,- token,- method: 'DELETE',- body: { endpoint: 'assistants' },- });+ expect(box.width).toBeGreaterThanOrEqual(24);+ expect(box.height).toBeGreaterThanOrEqual(24);+ expect(glyph.x).toBeGreaterThanOrEqual(box.x - 0.5);+ expect(glyph.y).toBeGreaterThanOrEqual(box.y - 0.5);+ expect(glyph.x + glyph.width).toBeLessThanOrEqual(box.x + box.width + 0.5);+ expect(glyph.y + glyph.height).toBeLessThanOrEqual(box.y + box.height + 0.5);++ await close.focus();+ await modePage.keyboard.press('Enter');+ await expect(dialog).toBeHidden();}});});diff --git a/packages/client/src/components/Dialog.tsx b/packages/client/src/components/Dialog.tsxdeleted file mode 100644index c33aa819c1..0000000000--- a/packages/client/src/components/Dialog.tsx+++ /dev/null@@ -1,190 +0,0 @@-import * as React from 'react';-import { X } from 'lucide-react';-import { JSX } from 'react/jsx-runtime';-import * as DialogPrimitive from '@radix-ui/react-dialog';-import { cn, disabledFillClasses } from '~/utils';-import { Button, ButtonProps } from './Button';-import { useMediaQuery } from '~/hooks';--const Dialog: React.FC<DialogPrimitive.DialogProps> = DialogPrimitive.Root;--const DialogTrigger: React.ForwardRefExoticComponent<- DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>-> = DialogPrimitive.Trigger;--type DialogPortalProps = DialogPrimitive.DialogPortalProps & { className?: string };--const DialogPortal = ({ className = '', children, ...props }: DialogPortalProps) => (- <DialogPrimitive.Portal className={cn(className)} {...(props as DialogPortalProps)}>- <div className="fixed inset-0 z-[999] flex items-start justify-center sm:items-center">- {children}- </div>- </DialogPrimitive.Portal>-);-DialogPortal.displayName = DialogPrimitive.Portal.displayName;--const DialogOverlay = React.forwardRef<- React.ElementRef<typeof DialogPrimitive.Overlay>,- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>->(({ className, ...props }, ref) => (- <DialogPrimitive.Overlay- className={cn(- 'bg-scrim-modal data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in fixed inset-0 z-[999] transition-all duration-100',- className ?? '',- )}- {...props}- ref={ref}- />-));-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;--type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {- showCloseButton?: boolean;- disableScroll?: boolean;-};--const DialogContent: React.ForwardRefExoticComponent<- Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, 'ref'> & {- showCloseButton?: boolean;- disableScroll?: boolean;- } & React.RefAttributes<HTMLDivElement>-> = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Content>, DialogContentProps>(- (- { className, children = true, showCloseButton = true, disableScroll = false, ...props },- ref,- ) => {- const isSmallScreen = useMediaQuery('(max-width: 768px)');- return (- <DialogPortal>- <DialogOverlay />- <DialogPrimitive.Content- ref={ref}- className={cn(- /** The dialog surface is otherwise borderless: in high contrast it sits- * on a canvas of its own colour, so it needs a drawn edge. */- 'bg-surface-dialog animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 high-contrast:border high-contrast:border-solid high-contrast:border-border-medium fixed z-[999] grid w-full gap-4 rounded-b-lg pb-6 sm:rounded-lg',- isSmallScreen- ? 'bg-surface-dialog fixed top-1/2 left-1/2 z-[999] m-auto grid w-11/12 -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl pb-6'- : '',- disableScroll ? 'overflow-hidden' : '',- className ?? '',- )}- {...props}- >- {children}- {showCloseButton && (- <DialogPrimitive.Close className="focus:ring-focus-control data-[state=open]:bg-surface-hover min-h-theme-target min-w-theme-target absolute inset-e-6 top-[1.6rem] -me-0.5 -mt-0.5 inline-flex items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">- <X className="text-text-primary size-theme-icon-md" aria-hidden="true" />- <span className="sr-only">Close</span>- </DialogPrimitive.Close>- )}- </DialogPrimitive.Content>- </DialogPortal>- );- },-);-DialogContent.displayName = DialogPrimitive.Content.displayName;--const DialogHeader: {- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;- displayName: string;-} = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element => (- <div className={cn('flex flex-col space-y-2 p-6 pb-4 text-start', className ?? '')} {...props} />-);-DialogHeader.displayName = 'DialogHeader';--const DialogFooter: {- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;- displayName: string;-} = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element => (- <div- className={cn('flex flex-row justify-between space-x-2 px-6 py-4', className ?? '')}- {...props}- />-);-DialogFooter.displayName = 'DialogFooter';--const DialogTitle: React.ForwardRefExoticComponent<- Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, 'ref'> &- React.RefAttributes<HTMLHeadingElement>-> = React.forwardRef<- React.ElementRef<typeof DialogPrimitive.Title>,- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>->(({ className, ...props }, ref) => (- <DialogPrimitive.Title- ref={ref}- className={cn('text-text-primary font-display text-lg font-semibold', className ?? '')}- {...props}- />-));-DialogTitle.displayName = DialogPrimitive.Title.displayName;--const DialogDescription: React.ForwardRefExoticComponent<- Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, 'ref'> &- React.RefAttributes<HTMLParagraphElement>-> = React.forwardRef<- React.ElementRef<typeof DialogPrimitive.Description>,- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>->(({ className, ...props }, ref) => (- <DialogPrimitive.Description- ref={ref}- className={cn('text-text-secondary text-sm', className ?? '')}- {...props}- />-));-DialogDescription.displayName = DialogPrimitive.Description.displayName;--const DialogClose: React.ForwardRefExoticComponent<- Omit<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, 'ref'> &- React.RefAttributes<HTMLButtonElement>-> = React.forwardRef<- React.ElementRef<typeof DialogPrimitive.Close>,- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>->(({ className, ...props }, ref) => (- <DialogPrimitive.Close- ref={ref}- className={cn(- 'border-border-light text-text-primary hover:bg-surface-hover h-theme-button mt-2 inline-flex items-center justify-center rounded-lg border bg-transparent px-4 py-2 text-sm font-semibold transition-colors focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0',- disabledFillClasses,- className ?? '',- /* Important: for accessibility */- 'focus:ring-focus-control focus:ring-2 focus:ring-offset-2',- )}- {...props}- />-));-DialogClose.displayName = DialogPrimitive.Title.displayName;--const DialogButton: React.ForwardRefExoticComponent<- Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, 'ref'> &- React.RefAttributes<HTMLButtonElement>-> = React.forwardRef<- React.ElementRef<typeof Button>,- React.ComponentPropsWithoutRef<typeof Button>->(({ className, ...props }, ref) => (- <Button- ref={ref}- variant="outline"- className={cn(- 'border-border-light text-text-primary hover:bg-surface-hover focus:ring-focus-control h-theme-button mt-2 inline-flex items-center justify-center rounded-lg border bg-transparent px-4 py-2 text-sm font-semibold transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0',- disabledFillClasses,- className ?? '',- /* Important: for accessibility */- 'focus:ring-focus-control focus:ring-2 focus:ring-offset-2',- )}- {...props}- />-));-DialogButton.displayName = DialogPrimitive.Title.displayName;--export {- Dialog,- DialogTrigger,- DialogContent,- DialogHeader,- DialogFooter,- DialogTitle,- DialogDescription,- DialogClose,- DialogButton,-};diff --git a/packages/client/src/components/DialogTemplate.spec.tsx b/packages/client/src/components/DialogTemplate.spec.tsxdeleted file mode 100644index 41ae3bfc90..0000000000--- a/packages/client/src/components/DialogTemplate.spec.tsx+++ /dev/null@@ -1,88 +0,0 @@-import { render, fireEvent } from '@testing-library/react';-import '@testing-library/jest-dom';-import { Provider } from 'jotai';-import { Dialog } from '@radix-ui/react-dialog';-import DialogTemplate from './DialogTemplate';--describe('DialogTemplate', () => {- let mockSelectHandler: jest.Mock;-- beforeEach(() => {- mockSelectHandler = jest.fn();- });-- it('renders correctly with all props', () => {- const { getByText } = render(- <Provider>- <Dialog- open- data-testid="test-dialog"- onOpenChange={() => {- return;- }}- >- <DialogTemplate- title="Test Dialog"- description="Test Description"- main={<div>Main Content</div>}- buttons={<button>Button</button>}- leftButtons={<button>Left Button</button>}- selection={{ selectHandler: mockSelectHandler, selectText: 'Select' }}- />- </Dialog>- </Provider>,- );-- expect(getByText('Test Dialog')).toBeInTheDocument();- expect(getByText('Test Description')).toBeInTheDocument();- expect(getByText('Main Content')).toBeInTheDocument();- expect(getByText('Button')).toBeInTheDocument();- expect(getByText('Left Button')).toBeInTheDocument();- // Cancel text is hardcoded in DialogTemplate as 'cancel'- expect(getByText('cancel')).toBeInTheDocument();- expect(getByText('Select')).toBeInTheDocument();- });-- it('renders correctly without optional props', () => {- const { queryByText } = render(- <Provider>- <Dialog- open- onOpenChange={() => {- return;- }}- ></Dialog>- </Provider>,- );-- expect(queryByText('Test Dialog')).toBeNull();- expect(queryByText('Test Description')).not.toBeInTheDocument();- expect(queryByText('Main Content')).not.toBeInTheDocument();- expect(queryByText('Button')).not.toBeInTheDocument();- expect(queryByText('Left Button')).not.toBeInTheDocument();- expect(queryByText('cancel')).not.toBeInTheDocument();- expect(queryByText('Select')).not.toBeInTheDocument();- });-- it('calls selectHandler when the select button is clicked', () => {- const { getByText } = render(- <Provider>- <Dialog- open- onOpenChange={() => {- return;- }}- >- <DialogTemplate- title="Test Dialog"- selection={{ selectHandler: mockSelectHandler, selectText: 'Select' }}- />- </Dialog>- </Provider>,- );-- fireEvent.click(getByText('Select'));-- expect(mockSelectHandler).toHaveBeenCalled();- });-});diff --git a/packages/client/src/components/DialogTemplate.tsx b/packages/client/src/components/DialogTemplate.tsxdeleted file mode 100644index 5623067745..0000000000--- a/packages/client/src/components/DialogTemplate.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { forwardRef, ForwardRefExoticComponent, ReactNode, Ref, RefAttributes } from 'react';-import {- DialogClose,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from './Dialog';-import { cn, disabledFillClasses } from '~/utils';--type SelectionProps = {- selectHandler?: () => void;- selectClasses?: string;- selectText?: string;-};--type DialogTemplateProps = {- title: string;- description?: string;- main?: ReactNode;- buttons?: ReactNode;- leftButtons?: ReactNode;- selection?: SelectionProps;- className?: string;- headerClassName?: string;- footerClassName?: string;- showCloseButton?: boolean;- showCancelButton?: boolean;-};--const DialogTemplate: ForwardRefExoticComponent<- DialogTemplateProps & RefAttributes<HTMLDivElement>-> = forwardRef((props: DialogTemplateProps, ref: Ref<HTMLDivElement>) => {- const {- title,- description,- main,- buttons,- leftButtons,- selection,- className,- headerClassName,- footerClassName,- showCloseButton,- showCancelButton = true,- } = props;- const { selectHandler, selectClasses, selectText } = selection || {};- const Cancel = 'cancel';-- const defaultSelect = cn(- 'bg-surface-inverted text-text-inverted transition-colors hover:bg-surface-inverted-hover disabled:cursor-not-allowed disabled:opacity-50',- disabledFillClasses,- );- return (- <DialogContent- showCloseButton={showCloseButton}- ref={ref}- className={cn(- 'bg-surface-dialog high-contrast:border high-contrast:border-solid high-contrast:border-border-medium high-contrast:shadow-none shadow-2xl',- className || '',- )}- onClick={(e) => e.stopPropagation()}- >- <DialogHeader className={cn(headerClassName ?? '')}>- <DialogTitle className="text-text-primary text-lg leading-6 font-medium">- {title}- </DialogTitle>- {description && (- <DialogDescription className="text-text-secondary">{description}</DialogDescription>- )}- </DialogHeader>- <div className="px-6">{main ? main : null}</div>- <DialogFooter className={footerClassName}>- <div>{leftButtons ? leftButtons : null}</div>- <div className="flex h-auto gap-3">- {showCancelButton && (- <DialogClose className="border-border-light hover:bg-surface-hover">- {Cancel}- </DialogClose>- )}- {buttons ? buttons : null}- {selection ? (- <DialogClose- onClick={selectHandler}- className={`${- selectClasses || defaultSelect- } inline-flex h-10 items-center justify-center rounded-lg border-none px-4 py-2 text-sm`}- >- {selectText}- </DialogClose>- ) : null}- </div>- </DialogFooter>- </DialogContent>- );-});--export default DialogTemplate;diff --git a/packages/client/src/components/index.ts b/packages/client/src/components/index.tsindex b488f61c43..0d4d17c5da 100644--- a/packages/client/src/components/index.ts+++ b/packages/client/src/components/index.ts@@ -8,7 +8,6 @@ export * from './Chip';export * from './SeriesLabel';export * from './Checkbox';export * from './DisclosureChevron';-export * from './Dialog';export * from './DropdownMenu';export * from './HoverCard';export * from './Field';@@ -66,7 +65,6 @@ export { default as DelayedRender } from './DelayedRender';export { default as ThemeSelector } from './ThemeSelector';export { default as InfoHoverCard } from './InfoHoverCard';export { default as CheckboxButton } from './CheckboxButton';-export { default as DialogTemplate } from './DialogTemplate';export { default as SelectDropDown } from './SelectDropDown';export { default as ControlCombobox } from './ControlCombobox';export { default as EmptyState } from './EmptyState';diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.mdindex d6b0d40567..6f8f5f5881 100644--- a/packages/client/src/theme/README.md+++ b/packages/client/src/theme/README.md@@ -395,8 +395,8 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and aits trigger, and `listMaxHeight`, 8 to 40rem or `none`) bound a field `Dropdown`'s list, which nevergrows past the room the popper leaves between its trigger and the viewport's edge, so `none`drops the fixed cap and keeps only that one. Every default is the size the primitive drew before. The icon and checkbox roles- are bounded to the room their layouts leave: `iconSize` 0.75 to 1.25rem, `iconSizeMd` (the- exported Dialog's close glyph) 1.25 to 1.5rem, `iconSizeLg` 1 to 2rem, `checkboxSize` 1 to+ are bounded to the room their layouts leave: `iconSize` 0.75 to 1.25rem, `iconSizeMd` (read by+ `size-theme-icon-md`; no shared primitive uses it today) 1.25 to 1.5rem, `iconSizeLg` 1 to 2rem, `checkboxSize` 1 to1.5rem. The target floor (`h-theme-target`, `min-h-theme-target`, `min-w-theme-target`) isa fixed 24px, WCAG 2.5.8's minimum, not a role, so a theme cannot lower it. The Button's`xs`, `lg`, `compact` and `icon-sm` heights and `fieldHeightLg` reject a value under 24px;@@ -469,10 +469,12 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and a- `text-xs` to `text-3xl` - Sizes and line heights read `textXs`..`text3xl` and`leadingXs`..`leading3xl`, in the app and in a consumer alike; the defaults areTailwind's own values.-- `bg-scrim` / `bg-scrim-alert` / `bg-scrim-modal` - The OGDialog, AlertDialog- and Dialog scrims: `surface-overlay` at the `scrimOpacity`,- `alertScrimOpacity` and `modalScrimOpacity` appearance roles (80%, 90% and- 65% by default). A bundled scrim dims the page and never lifts it.+- `bg-scrim` / `bg-scrim-alert` / `bg-scrim-modal` - The OGDialog and+ AlertDialog scrims, plus a third for a consumer's own modal: `surface-overlay`+ at the `scrimOpacity`, `alertScrimOpacity` and `modalScrimOpacity` appearance+ roles (80%, 90% and 65% by default). No bundled dialog draws `bg-scrim-modal`+ since the legacy `Dialog` was removed; the role stays so released themes keep+ loading. A bundled scrim dims the page and never lifts it.- `theme-destructive-soft:` - A variant for a `destructive-soft` Button's tint (the inline delete or revoke; a dialog's confirming `destructive` button stays solid): thebutton paints a 10% tint of the destructive surface under the destructive inkwhen the theme's `destructiveStyle` is `soft`. The default `fill` keeps thediff --git a/packages/client/src/theme/primitives.spec.ts b/packages/client/src/theme/primitives.spec.tsindex 96f7021ba2..76d669c520 100644--- a/packages/client/src/theme/primitives.spec.ts+++ b/packages/client/src/theme/primitives.spec.ts@@ -18,7 +18,7 @@ const primitives: Record<string, string[]> = {Button: ['Button.tsx'],Input: ['Input.tsx', 'Field.ts'],Select: ['Dropdown.tsx', 'Dropdown.css'],- Dialog: ['OriginalDialog.tsx', 'OGDialogTemplate.tsx', 'Dialog.tsx'],+ Dialog: ['OriginalDialog.tsx', 'OGDialogTemplate.tsx'],Menu: ['DropdownPopup.tsx', 'Dropdown.css'],Tabs: ['Tabs.tsx'],Switch: ['Switch.tsx'],diff --git a/packages/client/src/theme/semanticTokens.spec.ts b/packages/client/src/theme/semanticTokens.spec.tsindex e80a85e8c5..a5e653a13b 100644--- a/packages/client/src/theme/semanticTokens.spec.ts+++ b/packages/client/src/theme/semanticTokens.spec.ts@@ -17,8 +17,6 @@ const sharedComponents = ['Button.tsx','Chip.tsx','SegmentedMeter.tsx',- 'Dialog.tsx',- 'DialogTemplate.tsx','IconButton.tsx','OGDialogTemplate.tsx','OriginalDialog.tsx',@@ -26,13 +24,7 @@ const sharedComponents = ['Toast.tsx',];-const sharedDialogComponents = [- 'AlertDialog.tsx',- 'Dialog.tsx',- 'DialogTemplate.tsx',- 'OGDialogTemplate.tsx',- 'OriginalDialog.tsx',-];+const sharedDialogComponents = ['AlertDialog.tsx', 'OGDialogTemplate.tsx', 'OriginalDialog.tsx'];describe('shared component color guardrail', () => {it('keeps shared primitives free of direct palette utilities and raw colors', () => {