mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 13:33:45 +00:00
🏷️ refactor: Export the Dialog Parts Under Canonical Dialog Names (#17459)
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.
This commit is contained in:
parent
8d3da9bbb2
commit
192cf3920f
3 changed files with 37 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
25
packages/client/src/components/__tests__/dialogNames.spec.ts
Normal file
25
packages/client/src/components/__tests__/dialogNames.spec.ts
Normal file
|
|
@ -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<string, unknown>;
|
||||
expect(exports[name]).toBeDefined();
|
||||
expect(exports[name]).toBe(exports[`OG${name}`]);
|
||||
});
|
||||
});
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue