From 192cf3920f445ad6483cc4cb40ba4b830235afd2 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:45:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20refactor:=20Export=20th?= =?UTF-8?q?e=20Dialog=20Parts=20Under=20Canonical=20Dialog=20Names=20(#174?= =?UTF-8?q?59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dialog, DialogContent, DialogTitle and the other parts, and DialogTemplate, are now exported beside their OG names as the same components, so new code and the docs can use the plain names while the existing call sites keep working unchanged. --- .../client/src/components/OriginalDialog.tsx | 11 ++++++++ .../components/__tests__/dialogNames.spec.ts | 25 +++++++++++++++++++ packages/client/src/components/index.ts | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/components/__tests__/dialogNames.spec.ts diff --git a/packages/client/src/components/OriginalDialog.tsx b/packages/client/src/components/OriginalDialog.tsx index c9bdf13956..d00f4f2e0e 100644 --- a/packages/client/src/components/OriginalDialog.tsx +++ b/packages/client/src/components/OriginalDialog.tsx @@ -450,7 +450,18 @@ const DialogDescription: React.ForwardRefExoticComponent< )); DialogDescription.displayName = DialogPrimitive.Description.displayName; +/** `Dialog*` are the canonical names. The `OG*` names are the same components under the names the + * app has always imported, kept so existing call sites need no change. */ export { + Dialog, + DialogPortal, + DialogClose, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, Dialog as OGDialog, DialogPortal as OGDialogPortal, DialogOverlay as OGDialogOverlay, diff --git a/packages/client/src/components/__tests__/dialogNames.spec.ts b/packages/client/src/components/__tests__/dialogNames.spec.ts new file mode 100644 index 0000000000..786c41b598 --- /dev/null +++ b/packages/client/src/components/__tests__/dialogNames.spec.ts @@ -0,0 +1,25 @@ +import * as components from '../index'; + +/** The canonical `Dialog*` names and the `OG*` names the app imports are one component each, so a + * call site can move to the canonical name without any change in behaviour. */ +const PARTS = [ + 'Dialog', + 'DialogPortal', + 'DialogOverlay', + 'DialogClose', + 'DialogTrigger', + 'DialogContent', + 'DialogHeader', + 'DialogFooter', + 'DialogTitle', + 'DialogDescription', + 'DialogTemplate', +] as const; + +describe('dialog export names', () => { + it.each(PARTS)('exports %s as the same component as its OG name', (name) => { + const exports = components as Record; + expect(exports[name]).toBeDefined(); + expect(exports[name]).toBe(exports[`OG${name}`]); + }); +}); diff --git a/packages/client/src/components/index.ts b/packages/client/src/components/index.ts index 312145a2ec..1ec8bab41e 100644 --- a/packages/client/src/components/index.ts +++ b/packages/client/src/components/index.ts @@ -72,7 +72,7 @@ export type { MinutePickerProps, TimeColumnProps, } from './TimePicker'; -export { default as OGDialogTemplate } from './OGDialogTemplate'; +export { default as OGDialogTemplate, default as DialogTemplate } from './OGDialogTemplate'; export { default as AnimatedSearchInput } from './AnimatedSearchInput'; export { default as VirtualizedDataTable } from './DataTable/DataTable'; export type {