@namroodinc/liquid-editorial 0.13.5 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/UPGRADING.md +94 -0
- package/dist/chunks/{Avatar-BY0dAItT.cjs → Avatar-BZGFSE6C.cjs} +2 -2
- package/dist/chunks/{Avatar-BY0dAItT.cjs.map → Avatar-BZGFSE6C.cjs.map} +1 -1
- package/dist/chunks/{Avatar-UjhjcHh5.js → Avatar-C4W-g8nU.js} +2 -2
- package/dist/chunks/{Avatar-UjhjcHh5.js.map → Avatar-C4W-g8nU.js.map} +1 -1
- package/dist/chunks/{Board-DUX76d2R.js → Board-Cbi5FMW-.js} +2 -2
- package/dist/chunks/{Board-DUX76d2R.js.map → Board-Cbi5FMW-.js.map} +1 -1
- package/dist/chunks/{Board-CQ1GTuRB.cjs → Board-_agEjTy8.cjs} +2 -2
- package/dist/chunks/{Board-CQ1GTuRB.cjs.map → Board-_agEjTy8.cjs.map} +1 -1
- package/dist/chunks/{CollectionView-CIJdNwcq.cjs → CollectionView-BfX2Lxre.cjs} +2 -2
- package/dist/chunks/{CollectionView-CIJdNwcq.cjs.map → CollectionView-BfX2Lxre.cjs.map} +1 -1
- package/dist/chunks/{CollectionView-JRNdXHti.js → CollectionView-DPJGtSP5.js} +2 -2
- package/dist/chunks/{CollectionView-JRNdXHti.js.map → CollectionView-DPJGtSP5.js.map} +1 -1
- package/dist/chunks/{ColourField-DFvRASVe.cjs → ColourField-BVGnW8Wh.cjs} +2 -2
- package/dist/chunks/{ColourField-DFvRASVe.cjs.map → ColourField-BVGnW8Wh.cjs.map} +1 -1
- package/dist/chunks/{ColourField-BG5oGj9f.js → ColourField-BcuARZY4.js} +6 -6
- package/dist/chunks/{ColourField-BG5oGj9f.js.map → ColourField-BcuARZY4.js.map} +1 -1
- package/dist/chunks/{DatePicker-LqaePc57.js → DatePicker-VQUsbYdo.js} +3 -3
- package/dist/chunks/{DatePicker-LqaePc57.js.map → DatePicker-VQUsbYdo.js.map} +1 -1
- package/dist/chunks/{DatePicker-ClOqS6oH.cjs → DatePicker-zA0bWVBp.cjs} +2 -2
- package/dist/chunks/{DatePicker-ClOqS6oH.cjs.map → DatePicker-zA0bWVBp.cjs.map} +1 -1
- package/dist/chunks/{Drawer-Ck5XKT_V.js → Drawer-2cf0SaG4.js} +3 -3
- package/dist/chunks/{Drawer-Ck5XKT_V.js.map → Drawer-2cf0SaG4.js.map} +1 -1
- package/dist/chunks/{Drawer-DdIH9jpe.cjs → Drawer-BzvSfkCL.cjs} +2 -2
- package/dist/chunks/{Drawer-DdIH9jpe.cjs.map → Drawer-BzvSfkCL.cjs.map} +1 -1
- package/dist/chunks/EntryPicker-BGWxiLJ_.js +877 -0
- package/dist/chunks/EntryPicker-BGWxiLJ_.js.map +1 -0
- package/dist/chunks/EntryPicker-wVjzdlAO.cjs +2 -0
- package/dist/chunks/EntryPicker-wVjzdlAO.cjs.map +1 -0
- package/dist/chunks/FormEditor-BHVJG23r.js +30 -0
- package/dist/chunks/FormEditor-BHVJG23r.js.map +1 -0
- package/dist/chunks/FormEditor-DjUz7qQo.cjs +2 -0
- package/dist/chunks/FormEditor-DjUz7qQo.cjs.map +1 -0
- package/dist/chunks/Icon-QLZH31JA.cjs +2 -0
- package/dist/chunks/Icon-QLZH31JA.cjs.map +1 -0
- package/dist/chunks/Icon-kLLQC54Z.js +107 -0
- package/dist/chunks/Icon-kLLQC54Z.js.map +1 -0
- package/dist/chunks/{Message-d6lqiMQ6.js → Message-DM6pTq7N.js} +2 -2
- package/dist/chunks/{Message-d6lqiMQ6.js.map → Message-DM6pTq7N.js.map} +1 -1
- package/dist/chunks/{Message-yhdaBpaz.cjs → Message-yZJDVzb8.cjs} +2 -2
- package/dist/chunks/{Message-yhdaBpaz.cjs.map → Message-yZJDVzb8.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor-BgfeOrEe.cjs +2 -0
- package/dist/chunks/RichTextEditor-BgfeOrEe.cjs.map +1 -0
- package/dist/chunks/RichTextEditor-CS2ED0HP.js +2702 -0
- package/dist/chunks/RichTextEditor-CS2ED0HP.js.map +1 -0
- package/dist/chunks/dialogLabel-Dx-WEEzI.cjs +2 -0
- package/dist/chunks/dialogLabel-Dx-WEEzI.cjs.map +1 -0
- package/dist/chunks/dialogLabel-nB1gwKz0.js +157 -0
- package/dist/chunks/dialogLabel-nB1gwKz0.js.map +1 -0
- package/dist/chunks/overlayLayer-CPd3zj_u.cjs +2 -0
- package/dist/chunks/overlayLayer-CPd3zj_u.cjs.map +1 -0
- package/dist/chunks/overlayLayer-Dv1vmfaI.js +199 -0
- package/dist/chunks/overlayLayer-Dv1vmfaI.js.map +1 -0
- package/dist/chunks/{useTooltip-DnJEFBLg.js → useTooltip-COyAcujL.js} +2 -2
- package/dist/chunks/{useTooltip-DnJEFBLg.js.map → useTooltip-COyAcujL.js.map} +1 -1
- package/dist/chunks/{useTooltip-C7ON4nkV.cjs → useTooltip-nEDN0ObI.cjs} +2 -2
- package/dist/chunks/{useTooltip-C7ON4nkV.cjs.map → useTooltip-nEDN0ObI.cjs.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +5 -5
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.js +6 -7
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EntryPicker/dialog.d.cts +11 -1
- package/dist/components/EntryPicker/dialog.d.cts.map +1 -1
- package/dist/components/EntryPicker/dialog.d.ts +11 -1
- package/dist/components/EntryPicker/dialog.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/style.css +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.cts +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.ts +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.ts.map +1 -1
- package/dist/components/EntryPicker/use-picker-session.d.cts +4 -1
- package/dist/components/EntryPicker/use-picker-session.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-picker-session.d.ts +4 -1
- package/dist/components/EntryPicker/use-picker-session.d.ts.map +1 -1
- package/dist/components/EntryPicker/use-selected-items.d.cts +2 -0
- package/dist/components/EntryPicker/use-selected-items.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-selected-items.d.ts +2 -0
- package/dist/components/EntryPicker/use-selected-items.d.ts.map +1 -1
- package/dist/components/FormEditor/README.md +197 -28
- package/dist/components/FormEditor/control.d.cts +11 -2
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +11 -2
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/form.d.cts +33 -0
- package/dist/components/FormEditor/form.d.cts.map +1 -0
- package/dist/components/FormEditor/form.d.ts +33 -0
- package/dist/components/FormEditor/form.d.ts.map +1 -0
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +3 -27
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +3 -27
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +3 -3
- package/dist/components/FormEditor/model.d.cts +2 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +2 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.cts +4 -0
- package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -0
- package/dist/components/FormEditor/rich-text-control.d.ts +4 -0
- package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -0
- package/dist/components/Icon/icons.d.cts +16 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +16 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts +3 -2
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts +3 -2
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +65 -52
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +67 -64
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/RichTextEditor/content-block-frame.d.cts +32 -0
- package/dist/components/RichTextEditor/content-block-frame.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block-frame.d.ts +32 -0
- package/dist/components/RichTextEditor/content-block-frame.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block-view.d.cts +3 -0
- package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block-view.d.ts +3 -0
- package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block.d.cts +24 -0
- package/dist/components/RichTextEditor/content-block.d.cts.map +1 -0
- package/dist/components/RichTextEditor/content-block.d.ts +24 -0
- package/dist/components/RichTextEditor/content-block.d.ts.map +1 -0
- package/dist/components/RichTextEditor/document.d.cts +15 -8
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts +15 -8
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/embed-context.d.cts +5 -0
- package/dist/components/RichTextEditor/embed-context.d.cts.map +1 -1
- package/dist/components/RichTextEditor/embed-context.d.ts +5 -0
- package/dist/components/RichTextEditor/embed-context.d.ts.map +1 -1
- package/dist/components/RichTextEditor/embed-types.d.cts +6 -4
- package/dist/components/RichTextEditor/embed-types.d.cts.map +1 -1
- package/dist/components/RichTextEditor/embed-types.d.ts +6 -4
- package/dist/components/RichTextEditor/embed-types.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +9 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +9 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -2
- package/dist/components/RichTextEditor/style.css +161 -86
- package/dist/components/RichTextEditor/table-actions.d.cts +11 -0
- package/dist/components/RichTextEditor/table-actions.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-actions.d.ts +11 -0
- package/dist/components/RichTextEditor/table-actions.d.ts.map +1 -0
- package/dist/components/RichTextEditor/table-bands.d.cts +19 -0
- package/dist/components/RichTextEditor/table-bands.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-bands.d.ts +19 -0
- package/dist/components/RichTextEditor/table-bands.d.ts.map +1 -0
- package/dist/components/RichTextEditor/table-view.d.cts +4 -0
- package/dist/components/RichTextEditor/table-view.d.cts.map +1 -0
- package/dist/components/RichTextEditor/table-view.d.ts +4 -0
- package/dist/components/RichTextEditor/table-view.d.ts.map +1 -0
- package/dist/components/RichTextEditor/tables.d.cts +7 -0
- package/dist/components/RichTextEditor/tables.d.cts.map +1 -0
- package/dist/components/RichTextEditor/tables.d.ts +7 -0
- package/dist/components/RichTextEditor/tables.d.ts.map +1 -0
- package/dist/components/RichTextEditor/use-embeds.d.cts.map +1 -1
- package/dist/components/RichTextEditor/use-embeds.d.ts.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +2 -2
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.js +4 -4
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Switch/style.css +2 -6
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -28
- package/dist/internal/dialogFocus.d.cts +6 -1
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +6 -1
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/package.json +8 -6
- package/dist/chunks/EntryPicker-B4dAsObz.cjs +0 -2
- package/dist/chunks/EntryPicker-B4dAsObz.cjs.map +0 -1
- package/dist/chunks/EntryPicker-DDXHytMN.js +0 -160
- package/dist/chunks/EntryPicker-DDXHytMN.js.map +0 -1
- package/dist/chunks/FormEditor-BGzE-rqk.cjs +0 -2
- package/dist/chunks/FormEditor-BGzE-rqk.cjs.map +0 -1
- package/dist/chunks/FormEditor-ChH4e5sB.js +0 -693
- package/dist/chunks/FormEditor-ChH4e5sB.js.map +0 -1
- package/dist/chunks/Icon-3ucBRgrd.cjs +0 -2
- package/dist/chunks/Icon-3ucBRgrd.cjs.map +0 -1
- package/dist/chunks/Icon-dPXyBYe5.js +0 -91
- package/dist/chunks/Icon-dPXyBYe5.js.map +0 -1
- package/dist/chunks/RichTextEditor-BFblqw8m.js +0 -1144
- package/dist/chunks/RichTextEditor-BFblqw8m.js.map +0 -1
- package/dist/chunks/RichTextEditor-DU9CVeRD.cjs +0 -2
- package/dist/chunks/RichTextEditor-DU9CVeRD.cjs.map +0 -1
- package/dist/chunks/dialogLabel-DT7rCr3_.js +0 -176
- package/dist/chunks/dialogLabel-DT7rCr3_.js.map +0 -1
- package/dist/chunks/dialogLabel-_-MTckE_.cjs +0 -2
- package/dist/chunks/dialogLabel-_-MTckE_.cjs.map +0 -1
- package/dist/chunks/overlayLayer-iGhuAByk.cjs +0 -2
- package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +0 -1
- package/dist/chunks/overlayLayer-lU4iWSjO.js +0 -162
- package/dist/chunks/overlayLayer-lU4iWSjO.js.map +0 -1
- package/dist/chunks/use-picker-session-BSpOwnQ-.js +0 -712
- package/dist/chunks/use-picker-session-BSpOwnQ-.js.map +0 -1
- package/dist/chunks/use-picker-session-ouqHBmVA.cjs +0 -2
- package/dist/chunks/use-picker-session-ouqHBmVA.cjs.map +0 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts +0 -3
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +0 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts +0 -3
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +0 -1
- package/dist/components/RichTextEditor/storyblock.d.cts +0 -19
- package/dist/components/RichTextEditor/storyblock.d.cts.map +0 -1
- package/dist/components/RichTextEditor/storyblock.d.ts +0 -19
- package/dist/components/RichTextEditor/storyblock.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer-Ck5XKT_V.js","names":["_Fragment","mergeRefs","useInheritedPortalScope","useDialogPresence","DialogContent","useModalDialog","useDialogPortal","dialogAttributes","Fragment$1","DrawerHead","hasHeader","titleId","title","description","descriptionId","Button","closeRef","variant","closeLabel","onClose","drawerInteraction","active","isActive","isVisible","isInert","isOpen","canPress","onInactivePress","ariaHidden","DrawerContent","head","node","footer","inactivePressLabel","event","useDrawerExit","previousOpen","setPreviousOpen","useState","exiting","setExiting","useEffect","duration","transitionDurationMs","scrimRef","timeout","Drawer","forwardRef","rest","isHidden","overlayLayer","panelRef","useRef","useId","onTransitionEnd","portalContainer","portal","order","createPortal","frameInert","hasScrim","isResumed","layer","side","onScrimMouseDown","ref","panelAttributes","size","className"],"sources":["../../src/components/Drawer/head.tsx","../../src/components/Drawer/content.tsx","../../src/components/Drawer/index.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { Button } from \"../Button\";\nimport type { DrawerProps } from \".\";\ntype HeadProps = Pick<\n DrawerProps,\n \"title\" | \"description\" | \"onClose\" | \"hasHeader\" | \"variant\" | \"closeLabel\"\n> & { titleId: string; descriptionId: string; closeRef: RefObject<HTMLButtonElement | null> };\nexport function DrawerHead({\n title,\n description,\n onClose,\n hasHeader,\n variant,\n closeLabel,\n titleId,\n descriptionId,\n closeRef,\n}: HeadProps) {\n return (\n <header\n className=\"ds-drawer__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { Button } from \"../Button\";\nimport { DrawerHead } from \"./head\";\nimport type { DrawerProps } from \".\";\n\ntype ContentProps = ComponentProps<typeof DrawerHead> &\n Pick<DrawerProps, \"children\" | \"footer\" | \"onInactivePress\" | \"inactivePressLabel\"> & {\n isInert: boolean;\n };\n\n/** Distinguish modal participation from an application's inactive-panel action. */\nexport function drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden,\n}: {\n isOpen: boolean;\n isVisible: boolean;\n isActive: boolean;\n onInactivePress?: () => void;\n ariaHidden?: DrawerProps[\"aria-hidden\"];\n}) {\n const active = isActive && isVisible;\n const isInert = !isOpen || !active;\n const canPress = isOpen && isVisible && !isActive && Boolean(onInactivePress);\n return {\n active,\n isInert,\n canPress,\n frameInert: isInert && !canPress,\n panelAttributes: {\n \"aria-hidden\": canPress ? ariaHidden : isInert || ariaHidden,\n tabIndex: canPress ? undefined : -1,\n },\n };\n}\n\n/** Keep editors mounted inside an inert boundary, with activation outside it. */\nexport function DrawerContent({\n isInert,\n children,\n footer,\n onInactivePress,\n inactivePressLabel,\n ...head\n}: ContentProps) {\n return (\n <>\n <div\n className=\"ds-drawer__content\"\n ref={(node) => {\n if (node) {\n node.inert = isInert;\n node.toggleAttribute(\"inert\", isInert);\n }\n }}\n aria-hidden={isInert || undefined}\n >\n <DrawerHead {...head} />\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer ds-field-surface\">{footer}</footer>}\n </div>\n {onInactivePress && (\n <Button\n variant=\"simple\"\n className=\"ds-drawer__inactive-press\"\n aria-label={\n inactivePressLabel ??\n (typeof head.title === \"string\" ? `Return to ${head.title}` : \"Activate drawer\")\n }\n tabIndex={-1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.stopPropagation();\n onInactivePress();\n }}\n />\n )}\n </>\n );\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n type TransitionEvent,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DrawerContent, drawerInteraction } from \"./content\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useDialogPortal } from \"../../internal/useDialogPortal\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { dialogAttributes } from \"../../internal/dialogLabel\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport { DialogContent, useDialogPresence } from \"../../internal/overlayLayer\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /**\n * Visually suspend an open dialog while retaining its mounted children. It\n * stays laid out but invisible and inert, so scroll positions are kept.\n */\n isHidden?: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Without it the title still names the dialog; give people another way to close it. */\n hasHeader?: boolean;\n /**\n * Only the active panel traps focus and handles Escape. An inactive open\n * panel stays visible and mounted as an inert background panel.\n */\n isActive?: boolean;\n /** Activate an exposed inactive panel. Its editor stays inert; the app decides whether to activate it. */\n onInactivePress?: () => void;\n /** Accessible name for the inactive-panel action; defaults to Return to {title} for string titles. */\n inactivePressLabel?: string;\n /** Without a scrim, presses outside the panel reach the page beneath. */\n hasScrim?: boolean;\n /**\n * z-index for this panel and the dialogs and popovers opened from it.\n * Defaults to an enclosing `OverlayLayer`, then the stylesheet. Keep it below\n * the toast layer (80).\n */\n overlayLayer?: number;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n const onTransitionEnd = (event: TransitionEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n };\n return [exiting, onTransitionEnd] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n isHidden = false,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n hasHeader = true,\n isActive = true,\n onInactivePress,\n inactivePressLabel,\n hasScrim = true,\n overlayLayer,\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const { layer, isVisible, isResumed } = useDialogPresence(isOpen, isHidden, overlayLayer);\n const { active, isInert, canPress, frameInert, panelAttributes } = drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden: rest[\"aria-hidden\"],\n });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, onTransitionEnd] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown, order } = useModalDialog({\n isOpen,\n isActive: active,\n layer,\n panelRef,\n onClose,\n // A hidden header's close button can't take focus.\n initialFocus: variant === \"navigation\" && hasHeader ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n const portal = useDialogPortal(order, isOpen || exiting, portalContainer);\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || !portal) {\n return null;\n }\n\n return createPortal(\n <DialogContent\n layer={layer}\n isSuspended={isInert}\n >\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = frameInert;\n }\n }}\n className=\"ds-drawer-scrim\"\n hidden={!isVisible}\n data-scrim={hasScrim ? undefined : \"none\"}\n data-inactive-press={canPress || undefined}\n data-resumed={isResumed || undefined}\n style={{ zIndex: layer }}\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={frameInert || undefined}\n onTransitionEnd={onTransitionEnd}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n {...dialogAttributes(rest, titleId, descriptionId, Boolean(description), active)}\n {...panelAttributes}\n data-side={side}\n data-size={size}\n data-header={hasHeader ? undefined : \"none\"}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <DrawerContent\n isInert={isInert}\n title={title}\n description={description}\n onClose={onClose}\n hasHeader={hasHeader}\n variant={variant}\n closeLabel={closeLabel}\n titleId={titleId}\n descriptionId={descriptionId}\n closeRef={closeRef}\n footer={footer}\n onInactivePress={canPress ? onInactivePress : undefined}\n inactivePressLabel={inactivePressLabel}\n >\n {children}\n </DrawerContent>\n </div>\n </div>\n </DialogContent>,\n portal,\n );\n});\n"],"mappings":";;;;;;;;;AAOA,SAAgBS,EAAW,EACzB,UACA,gBACA,YACA,cACA,YACA,eACA,YACA,kBACA,eACY;CACZ,OACE,kBAAC,UAAD;EACE,WAAU;EACV,QAAQ,CAACC;EAFX,UAAA,CAIE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,MAAD;IACE,IAAIC;IACJ,WAAU;IAET,UAAAC;GACC,CAAA,GACHC,KACC,kBAAC,KAAD;IACE,IAAIC;IACJ,WAAU;IAET,UAAAD;GACA,CAAA,CAEF;EACL,CAAA,GAAA,kBAACE,GAAD;GACE,KAAKC;GACL,SAAQ;GACR,MAAMC,MAAY,eAAe,OAAO;GACxC,YAAA;GACA,WAAU;GACV,WAAWA,MAAY,eAAe,qBAAqB,KAAA;GAC3D,cAAYC;GACZ,SAASC;EACV,CAAA,CACK;;AAEZ;;;ACxCA,SAAgBC,EAAkB,EAChC,WACA,cACA,aACA,oBACA,iBAO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AAA,kBAAC,OAAD;GACE,MAAM,MAAS;IAEb,AADA,EAAS,UAAUO,GACfA,MACF,EAAK,QAAQ4B;GAEjB;GACA,WAAU;GACV,QAAQ,CAACpC;GACT,cAAYqC,IAAW,KAAA,IAAY;GACnC,uBAAqBlC,KAAY,KAAA;GACjC,gBAAcmC,KAAa,KAAA;GAC3B,OAAO,EAAE,QAAQC,EAAM;GACvB,KAAKd,EAAK;GACV,aAAWe;GACX,gBAAc9C;GACd,kBAAgBsC,IAAkB,KAAK,KAAA;GACvC,cAAY9B,IAAS,SAAS;GAC9B,eAAakC,KAAc,KAAA;GACV;GACjB,aAAaK;GAEb,UAAA,kBAAC,OAAD;IACE,GAAIhB;IACJ,KAAK/C,EAAUkD,GAAUc,CAAG;IAC5B,GAAI1D,EAAiByC,GAAMrC,GAASG,GAAe,EAAQD,GAAcQ,CAAM;IAC/E,GAAI6C;IACJ,aAAWH;IACX,aAAWI;IACX,eAAazD,IAAY,KAAA,IAAY;IACrC,gBAAcO;IACd,WAAW;KAAC;KAAa;KAAoBmD;IAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;IAEhF,UAAA,kBAACvC,GAAD;KACW;KACF;KACM;KACJ;KACE;KACF;KACG;KACH;KACM;KACL;KACF;KACR,iBAAiBH,IAAWC,IAAkB,KAAA;KAC1B;KAEnB;IACY,CAAA;GACZ,CAAA;EACF,CAAA;CACQ,CAAA,GACf6B,CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drawer-2cf0SaG4.js","names":["_Fragment","mergeRefs","useInheritedPortalScope","useDialogPresence","DialogContent","useModalDialog","useDialogPortal","dialogAttributes","Fragment$1","DrawerHead","hasHeader","titleId","title","description","descriptionId","Button","closeRef","variant","closeLabel","onClose","drawerInteraction","active","isActive","isVisible","isInert","isOpen","canPress","onInactivePress","ariaHidden","DrawerContent","head","node","footer","inactivePressLabel","event","useDrawerExit","previousOpen","setPreviousOpen","useState","exiting","setExiting","useEffect","duration","transitionDurationMs","scrimRef","timeout","Drawer","forwardRef","rest","isHidden","overlayLayer","panelRef","useRef","useId","onTransitionEnd","portalContainer","portal","order","createPortal","frameInert","hasScrim","isResumed","layer","side","onScrimMouseDown","ref","panelAttributes","size","className"],"sources":["../../src/components/Drawer/head.tsx","../../src/components/Drawer/content.tsx","../../src/components/Drawer/index.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { Button } from \"../Button\";\nimport type { DrawerProps } from \".\";\ntype HeadProps = Pick<\n DrawerProps,\n \"title\" | \"description\" | \"onClose\" | \"hasHeader\" | \"variant\" | \"closeLabel\"\n> & { titleId: string; descriptionId: string; closeRef: RefObject<HTMLButtonElement | null> };\nexport function DrawerHead({\n title,\n description,\n onClose,\n hasHeader,\n variant,\n closeLabel,\n titleId,\n descriptionId,\n closeRef,\n}: HeadProps) {\n return (\n <header\n className=\"ds-drawer__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { Button } from \"../Button\";\nimport { DrawerHead } from \"./head\";\nimport type { DrawerProps } from \".\";\n\ntype ContentProps = ComponentProps<typeof DrawerHead> &\n Pick<DrawerProps, \"children\" | \"footer\" | \"onInactivePress\" | \"inactivePressLabel\"> & {\n isInert: boolean;\n };\n\n/** Distinguish modal participation from an application's inactive-panel action. */\nexport function drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden,\n}: {\n isOpen: boolean;\n isVisible: boolean;\n isActive: boolean;\n onInactivePress?: () => void;\n ariaHidden?: DrawerProps[\"aria-hidden\"];\n}) {\n const active = isActive && isVisible;\n const isInert = !isOpen || !active;\n const canPress = isOpen && isVisible && !isActive && Boolean(onInactivePress);\n return {\n active,\n isInert,\n canPress,\n frameInert: isInert && !canPress,\n panelAttributes: {\n \"aria-hidden\": canPress ? ariaHidden : isInert || ariaHidden,\n tabIndex: canPress ? undefined : -1,\n },\n };\n}\n\n/** Keep editors mounted inside an inert boundary, with activation outside it. */\nexport function DrawerContent({\n isInert,\n children,\n footer,\n onInactivePress,\n inactivePressLabel,\n ...head\n}: ContentProps) {\n return (\n <>\n <div\n className=\"ds-drawer__content\"\n ref={(node) => {\n if (node) {\n node.inert = isInert;\n node.toggleAttribute(\"inert\", isInert);\n }\n }}\n aria-hidden={isInert || undefined}\n >\n <DrawerHead {...head} />\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer ds-field-surface\">{footer}</footer>}\n </div>\n {onInactivePress && (\n <Button\n variant=\"simple\"\n className=\"ds-drawer__inactive-press\"\n aria-label={\n inactivePressLabel ??\n (typeof head.title === \"string\" ? `Return to ${head.title}` : \"Activate drawer\")\n }\n tabIndex={-1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.stopPropagation();\n onInactivePress();\n }}\n />\n )}\n </>\n );\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n type TransitionEvent,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DrawerContent, drawerInteraction } from \"./content\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useDialogPortal } from \"../../internal/useDialogPortal\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { dialogAttributes } from \"../../internal/dialogLabel\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport { DialogContent, useDialogPresence } from \"../../internal/overlayLayer\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /**\n * Visually suspend an open dialog while retaining its mounted children. It\n * stays laid out but invisible and inert, so scroll positions are kept.\n */\n isHidden?: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Without it the title still names the dialog; give people another way to close it. */\n hasHeader?: boolean;\n /**\n * Only the active panel traps focus and handles Escape. An inactive open\n * panel stays visible and mounted as an inert background panel.\n */\n isActive?: boolean;\n /** Activate an exposed inactive panel. Its editor stays inert; the app decides whether to activate it. */\n onInactivePress?: () => void;\n /** Accessible name for the inactive-panel action; defaults to Return to {title} for string titles. */\n inactivePressLabel?: string;\n /** Without a scrim, presses outside the panel reach the page beneath. */\n hasScrim?: boolean;\n /**\n * z-index for this panel and the dialogs and popovers opened from it.\n * Defaults to an enclosing `OverlayLayer`, then the stylesheet. Keep it below\n * the toast layer (80).\n */\n overlayLayer?: number;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n const onTransitionEnd = (event: TransitionEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n };\n return [exiting, onTransitionEnd] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n isHidden = false,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n hasHeader = true,\n isActive = true,\n onInactivePress,\n inactivePressLabel,\n hasScrim = true,\n overlayLayer,\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const { layer, isVisible, isResumed } = useDialogPresence(isOpen, isHidden, overlayLayer);\n const { active, isInert, canPress, frameInert, panelAttributes } = drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden: rest[\"aria-hidden\"],\n });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, onTransitionEnd] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown, order } = useModalDialog({\n isOpen,\n isActive: active,\n layer,\n panelRef,\n onClose,\n // A hidden header's close button can't take focus.\n initialFocus: variant === \"navigation\" && hasHeader ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n const portal = useDialogPortal(order, isOpen || exiting, portalContainer);\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || !portal) {\n return null;\n }\n\n return createPortal(\n <DialogContent\n layer={layer}\n isSuspended={isInert}\n >\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = frameInert;\n }\n }}\n className=\"ds-drawer-scrim\"\n hidden={!isVisible}\n data-scrim={hasScrim ? undefined : \"none\"}\n data-inactive-press={canPress || undefined}\n data-resumed={isResumed || undefined}\n style={{ zIndex: layer }}\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={frameInert || undefined}\n onTransitionEnd={onTransitionEnd}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n {...dialogAttributes(rest, titleId, descriptionId, Boolean(description), active)}\n {...panelAttributes}\n data-side={side}\n data-size={size}\n data-header={hasHeader ? undefined : \"none\"}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <DrawerContent\n isInert={isInert}\n title={title}\n description={description}\n onClose={onClose}\n hasHeader={hasHeader}\n variant={variant}\n closeLabel={closeLabel}\n titleId={titleId}\n descriptionId={descriptionId}\n closeRef={closeRef}\n footer={footer}\n onInactivePress={canPress ? onInactivePress : undefined}\n inactivePressLabel={inactivePressLabel}\n >\n {children}\n </DrawerContent>\n </div>\n </div>\n </DialogContent>,\n portal,\n );\n});\n"],"mappings":";;;;;;;;;AAOA,SAAgBS,EAAW,EACzB,UACA,gBACA,YACA,cACA,YACA,eACA,YACA,kBACA,eACY;CACZ,OACE,kBAAC,UAAD;EACE,WAAU;EACV,QAAQ,CAACC;EAFX,UAAA,CAIE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,MAAD;IACE,IAAIC;IACJ,WAAU;IAET,UAAAC;GACC,CAAA,GACHC,KACC,kBAAC,KAAD;IACE,IAAIC;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|
1
|
-
const e=require("../components/Button/index.cjs"),t=require("./transitionDuration-B4UnScFc.cjs"),n=require("./mergeRefs-CZ-SArlE.cjs"),r=require("./overlayLayer-
|
|
2
|
-
//# sourceMappingURL=Drawer-
|
|
1
|
+
const e=require("../components/Button/index.cjs"),t=require("./transitionDuration-B4UnScFc.cjs"),n=require("./mergeRefs-CZ-SArlE.cjs"),r=require("./overlayLayer-CPd3zj_u.cjs"),i=require("./dialogLabel-Dx-WEEzI.cjs");let a=require("react"),o=require("react-dom"),s=require("react/jsx-runtime");function c({title:t,description:n,onClose:r,hasHeader:i,variant:a,closeLabel:o,titleId:c,descriptionId:l,closeRef:u}){return(0,s.jsxs)(`header`,{className:`ds-drawer__head`,hidden:!i,children:[(0,s.jsxs)(`div`,{className:`ds-drawer__titles`,children:[(0,s.jsx)(`h2`,{id:c,className:`ds-drawer__title`,children:t}),n&&(0,s.jsx)(`p`,{id:l,className:`ds-drawer__description`,children:n})]}),(0,s.jsx)(e.Button,{ref:u,variant:`simple`,size:a===`navigation`?`lg`:`sm`,isIconOnly:!0,iconStart:`x`,className:a===`navigation`?`ds-drawer__close`:void 0,"aria-label":o,onClick:r})]})}function l({isOpen:e,isVisible:t,isActive:n,onInactivePress:r,ariaHidden:i}){let a=n&&t,o=!e||!a,s=e&&t&&!n&&!!r;return{active:a,isInert:o,canPress:s,frameInert:o&&!s,panelAttributes:{"aria-hidden":s?i:o||i,tabIndex:s?void 0:-1}}}function u({isInert:t,children:n,footer:r,onInactivePress:i,inactivePressLabel:a,...o}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`div`,{className:`ds-drawer__content`,ref:e=>{e&&(e.inert=t,e.toggleAttribute(`inert`,t))},"aria-hidden":t||void 0,children:[(0,s.jsx)(c,{...o}),(0,s.jsx)(`div`,{className:`ds-drawer__body`,children:n}),r&&(0,s.jsx)(`footer`,{className:`ds-drawer__footer ds-field-surface`,children:r})]}),i&&(0,s.jsx)(e.Button,{variant:`simple`,className:`ds-drawer__inactive-press`,"aria-label":a??(typeof o.title==`string`?`Return to ${o.title}`:`Activate drawer`),tabIndex:-1,onPointerDown:e=>e.preventDefault(),onClick:e=>{e.stopPropagation(),i()}})]})}function d(e,n){let[r,i]=(0,a.useState)(e),[o,s]=(0,a.useState)(!1);return r!==e&&(i(e),s(!e)),(0,a.useEffect)(()=>{if(!o||e)return;let r=t.t(n.current),i=window.setTimeout(()=>s(!1),r);return()=>window.clearTimeout(i)},[o,e,n]),[o,t=>{t.target===t.currentTarget&&t.propertyName===`opacity`&&!e&&s(!1)}]}var f=(0,a.forwardRef)(function({isOpen:e,isHidden:t=!1,onClose:c,title:f,description:p,side:m=`end`,size:h=`md`,hasHeader:g=!0,isActive:_=!0,onInactivePress:v,inactivePressLabel:y,hasScrim:b=!0,overlayLayer:x,variant:S=`default`,closeLabel:C=`Close`,portalContainer:w,footer:T,className:E,children:D,...O},k){let{layer:A,isVisible:j,isResumed:M}=r.r(e,t,x),{active:N,isInert:P,canPress:F,frameInert:I,panelAttributes:L}=l({isOpen:e,isVisible:j,isActive:_,onInactivePress:v,ariaHidden:O[`aria-hidden`]}),R=(0,a.useRef)(null),z=(0,a.useRef)(null),B=(0,a.useRef)(null),V=(0,a.useId)(),H=(0,a.useId)(),[U,W]=d(e,z),{onScrimMouseDown:G,order:K}=i.n({isOpen:e,isActive:N,layer:A,panelRef:R,onClose:c,initialFocus:S===`navigation`&&g?()=>B.current:void 0,preventScroll:!0,container:w}),q=i.r(K,e||U,w);return r.c(z,e,{keepDir:O.dir!==void 0}),!e&&!U||!q?null:(0,o.createPortal)((0,s.jsx)(r.t,{layer:A,isSuspended:P,children:(0,s.jsx)(`div`,{ref:e=>{z.current=e,e&&(e.inert=I)},className:`ds-drawer-scrim`,hidden:!j,"data-scrim":b?void 0:`none`,"data-inactive-press":F||void 0,"data-resumed":M||void 0,style:{zIndex:A},dir:O.dir,"data-side":m,"data-variant":S,"data-contained":w?``:void 0,"data-state":e?`open`:`closed`,"aria-hidden":I||void 0,onTransitionEnd:W,onMouseDown:G,children:(0,s.jsx)(`div`,{...O,ref:n.t(R,k),...i.t(O,V,H,!!p,N),...L,"data-side":m,"data-size":h,"data-header":g?void 0:`none`,"data-variant":S,className:[`ds-drawer`,`ds-field-surface`,E].filter(Boolean).join(` `),children:(0,s.jsx)(u,{isInert:P,title:f,description:p,onClose:c,hasHeader:g,variant:S,closeLabel:C,titleId:V,descriptionId:H,closeRef:B,footer:T,onInactivePress:F?v:void 0,inactivePressLabel:y,children:D})})})}),q)});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
2
|
+
//# sourceMappingURL=Drawer-BzvSfkCL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer-DdIH9jpe.cjs","names":["Button","_Fragment","Button","useState","transitionDurationMs","forwardRef","useDialogPresence","useRef","useId","useModalDialog","useDialogPortal","createPortal","DialogContent","mergeRefs","dialogAttributes","require_components_Button_index","require_transitionDuration","require_mergeRefs","require_overlayLayer","require_dialogLabel","react","react_dom","react_jsx_runtime","DrawerHead","hasHeader","titleId","title","description","descriptionId","closeRef","variant","closeLabel","onClose","drawerInteraction","active","isActive","isVisible","isInert","isOpen","canPress","onInactivePress","ariaHidden","DrawerContent","head","node","footer","inactivePressLabel","event","useDrawerExit","previousOpen","setPreviousOpen","exiting","setExiting","duration","scrimRef","timeout","Drawer","rest","isHidden","overlayLayer","panelRef","onTransitionEnd","portalContainer","portal","order","frameInert","hasScrim","isResumed","layer","side","onScrimMouseDown","ref","panelAttributes","size","className"],"sources":["../../src/components/Drawer/head.tsx","../../src/components/Drawer/content.tsx","../../src/components/Drawer/index.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { Button } from \"../Button\";\nimport type { DrawerProps } from \".\";\ntype HeadProps = Pick<\n DrawerProps,\n \"title\" | \"description\" | \"onClose\" | \"hasHeader\" | \"variant\" | \"closeLabel\"\n> & { titleId: string; descriptionId: string; closeRef: RefObject<HTMLButtonElement | null> };\nexport function DrawerHead({\n title,\n description,\n onClose,\n hasHeader,\n variant,\n closeLabel,\n titleId,\n descriptionId,\n closeRef,\n}: HeadProps) {\n return (\n <header\n className=\"ds-drawer__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { Button } from \"../Button\";\nimport { DrawerHead } from \"./head\";\nimport type { DrawerProps } from \".\";\n\ntype ContentProps = ComponentProps<typeof DrawerHead> &\n Pick<DrawerProps, \"children\" | \"footer\" | \"onInactivePress\" | \"inactivePressLabel\"> & {\n isInert: boolean;\n };\n\n/** Distinguish modal participation from an application's inactive-panel action. */\nexport function drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden,\n}: {\n isOpen: boolean;\n isVisible: boolean;\n isActive: boolean;\n onInactivePress?: () => void;\n ariaHidden?: DrawerProps[\"aria-hidden\"];\n}) {\n const active = isActive && isVisible;\n const isInert = !isOpen || !active;\n const canPress = isOpen && isVisible && !isActive && Boolean(onInactivePress);\n return {\n active,\n isInert,\n canPress,\n frameInert: isInert && !canPress,\n panelAttributes: {\n \"aria-hidden\": canPress ? ariaHidden : isInert || ariaHidden,\n tabIndex: canPress ? undefined : -1,\n },\n };\n}\n\n/** Keep editors mounted inside an inert boundary, with activation outside it. */\nexport function DrawerContent({\n isInert,\n children,\n footer,\n onInactivePress,\n inactivePressLabel,\n ...head\n}: ContentProps) {\n return (\n <>\n <div\n className=\"ds-drawer__content\"\n ref={(node) => {\n if (node) {\n node.inert = isInert;\n node.toggleAttribute(\"inert\", isInert);\n }\n }}\n aria-hidden={isInert || undefined}\n >\n <DrawerHead {...head} />\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer ds-field-surface\">{footer}</footer>}\n </div>\n {onInactivePress && (\n <Button\n variant=\"simple\"\n className=\"ds-drawer__inactive-press\"\n aria-label={\n inactivePressLabel ??\n (typeof head.title === \"string\" ? `Return to ${head.title}` : \"Activate drawer\")\n }\n tabIndex={-1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.stopPropagation();\n onInactivePress();\n }}\n />\n )}\n </>\n );\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n type TransitionEvent,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DrawerContent, drawerInteraction } from \"./content\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useDialogPortal } from \"../../internal/useDialogPortal\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { dialogAttributes } from \"../../internal/dialogLabel\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport { DialogContent, useDialogPresence } from \"../../internal/overlayLayer\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /**\n * Visually suspend an open dialog while retaining its mounted children. It\n * stays laid out but invisible and inert, so scroll positions are kept.\n */\n isHidden?: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Without it the title still names the dialog; give people another way to close it. */\n hasHeader?: boolean;\n /**\n * Only the active panel traps focus and handles Escape. An inactive open\n * panel stays visible and mounted as an inert background panel.\n */\n isActive?: boolean;\n /** Activate an exposed inactive panel. Its editor stays inert; the app decides whether to activate it. */\n onInactivePress?: () => void;\n /** Accessible name for the inactive-panel action; defaults to Return to {title} for string titles. */\n inactivePressLabel?: string;\n /** Without a scrim, presses outside the panel reach the page beneath. */\n hasScrim?: boolean;\n /**\n * z-index for this panel and the dialogs and popovers opened from it.\n * Defaults to an enclosing `OverlayLayer`, then the stylesheet. Keep it below\n * the toast layer (80).\n */\n overlayLayer?: number;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n const onTransitionEnd = (event: TransitionEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n };\n return [exiting, onTransitionEnd] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n isHidden = false,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n hasHeader = true,\n isActive = true,\n onInactivePress,\n inactivePressLabel,\n hasScrim = true,\n overlayLayer,\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const { layer, isVisible, isResumed } = useDialogPresence(isOpen, isHidden, overlayLayer);\n const { active, isInert, canPress, frameInert, panelAttributes } = drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden: rest[\"aria-hidden\"],\n });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, onTransitionEnd] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown, order } = useModalDialog({\n isOpen,\n isActive: active,\n layer,\n panelRef,\n onClose,\n // A hidden header's close button can't take focus.\n initialFocus: variant === \"navigation\" && hasHeader ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n const portal = useDialogPortal(order, isOpen || exiting, portalContainer);\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || !portal) {\n return null;\n }\n\n return createPortal(\n <DialogContent\n layer={layer}\n isSuspended={isInert}\n >\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = frameInert;\n }\n }}\n className=\"ds-drawer-scrim\"\n hidden={!isVisible}\n data-scrim={hasScrim ? undefined : \"none\"}\n data-inactive-press={canPress || undefined}\n data-resumed={isResumed || undefined}\n style={{ zIndex: layer }}\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={frameInert || undefined}\n onTransitionEnd={onTransitionEnd}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n {...dialogAttributes(rest, titleId, descriptionId, Boolean(description), active)}\n {...panelAttributes}\n data-side={side}\n data-size={size}\n data-header={hasHeader ? undefined : \"none\"}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <DrawerContent\n isInert={isInert}\n title={title}\n description={description}\n onClose={onClose}\n hasHeader={hasHeader}\n variant={variant}\n closeLabel={closeLabel}\n titleId={titleId}\n descriptionId={descriptionId}\n closeRef={closeRef}\n footer={footer}\n onInactivePress={canPress ? onInactivePress : undefined}\n inactivePressLabel={inactivePressLabel}\n >\n {children}\n </DrawerContent>\n </div>\n </div>\n </DialogContent>,\n portal,\n );\n});\n"],"mappings":"A,qSAOA,SAAgBuB,EAAW,CACzB,QACA,cACA,UACA,YACA,UACA,aACA,UACA,gBACA,YACY,CACZ,OACE,EAAAD,EAAA,KAAA,CAAC,SAAD,CACE,UAAU,kBACV,OAAQ,CAACE,EAFX,SAAA,EAIE,EAAAF,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,oBAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,KAAD,CACE,GAAIG,EACJ,UAAU,mBAET,SAAAC,CACC,CAAA,EACHC,IACC,EAAAL,EAAA,IAAA,CAAC,IAAD,CACE,GAAIM,EACJ,UAAU,yBAET,SAAAD,CACA,CAAA,CAEF,CACL,CAAA,GAAA,EAAAL,EAAA,IAAA,CAACtB,EAAAA,OAAD,CACE,IAAK6B,EACL,QAAQ,SACR,KAAMC,IAAY,aAAe,KAAO,KACxC,WAAA,GACA,UAAU,IACV,UAAWA,IAAY,aAAe,mBAAqB,IAAA,GAC3D,aAAYC,EACZ,QAASC,CACV,CAAA,CACK,C,EAEZ,CCxCA,SAAgBC,EAAkB,CAChC,SACA,YACA,WACA,kBACA,cAOC,CACD,IAAMC,EAASC,GAAYC,EACr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kB,IAAA,GAC1B,qBAEnB,UACY,CAAA,CACZ,CAAA,CACF,CAAA,CACQ,CAAA,EACfuB,CACF,CACF,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"Drawer-BzvSfkCL.cjs","names":["Button","_Fragment","Button","useState","transitionDurationMs","forwardRef","useDialogPresence","useRef","useId","useModalDialog","useDialogPortal","createPortal","DialogContent","mergeRefs","dialogAttributes","require_components_Button_index","require_transitionDuration","require_mergeRefs","require_overlayLayer","require_dialogLabel","react","react_dom","react_jsx_runtime","DrawerHead","hasHeader","titleId","title","description","descriptionId","closeRef","variant","closeLabel","onClose","drawerInteraction","active","isActive","isVisible","isInert","isOpen","canPress","onInactivePress","ariaHidden","DrawerContent","head","node","footer","inactivePressLabel","event","useDrawerExit","previousOpen","setPreviousOpen","exiting","setExiting","duration","scrimRef","timeout","Drawer","rest","isHidden","overlayLayer","panelRef","onTransitionEnd","portalContainer","portal","order","frameInert","hasScrim","isResumed","layer","side","onScrimMouseDown","ref","panelAttributes","size","className"],"sources":["../../src/components/Drawer/head.tsx","../../src/components/Drawer/content.tsx","../../src/components/Drawer/index.tsx"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { Button } from \"../Button\";\nimport type { DrawerProps } from \".\";\ntype HeadProps = Pick<\n DrawerProps,\n \"title\" | \"description\" | \"onClose\" | \"hasHeader\" | \"variant\" | \"closeLabel\"\n> & { titleId: string; descriptionId: string; closeRef: RefObject<HTMLButtonElement | null> };\nexport function DrawerHead({\n title,\n description,\n onClose,\n hasHeader,\n variant,\n closeLabel,\n titleId,\n descriptionId,\n closeRef,\n}: HeadProps) {\n return (\n <header\n className=\"ds-drawer__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport { Button } from \"../Button\";\nimport { DrawerHead } from \"./head\";\nimport type { DrawerProps } from \".\";\n\ntype ContentProps = ComponentProps<typeof DrawerHead> &\n Pick<DrawerProps, \"children\" | \"footer\" | \"onInactivePress\" | \"inactivePressLabel\"> & {\n isInert: boolean;\n };\n\n/** Distinguish modal participation from an application's inactive-panel action. */\nexport function drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden,\n}: {\n isOpen: boolean;\n isVisible: boolean;\n isActive: boolean;\n onInactivePress?: () => void;\n ariaHidden?: DrawerProps[\"aria-hidden\"];\n}) {\n const active = isActive && isVisible;\n const isInert = !isOpen || !active;\n const canPress = isOpen && isVisible && !isActive && Boolean(onInactivePress);\n return {\n active,\n isInert,\n canPress,\n frameInert: isInert && !canPress,\n panelAttributes: {\n \"aria-hidden\": canPress ? ariaHidden : isInert || ariaHidden,\n tabIndex: canPress ? undefined : -1,\n },\n };\n}\n\n/** Keep editors mounted inside an inert boundary, with activation outside it. */\nexport function DrawerContent({\n isInert,\n children,\n footer,\n onInactivePress,\n inactivePressLabel,\n ...head\n}: ContentProps) {\n return (\n <>\n <div\n className=\"ds-drawer__content\"\n ref={(node) => {\n if (node) {\n node.inert = isInert;\n node.toggleAttribute(\"inert\", isInert);\n }\n }}\n aria-hidden={isInert || undefined}\n >\n <DrawerHead {...head} />\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer ds-field-surface\">{footer}</footer>}\n </div>\n {onInactivePress && (\n <Button\n variant=\"simple\"\n className=\"ds-drawer__inactive-press\"\n aria-label={\n inactivePressLabel ??\n (typeof head.title === \"string\" ? `Return to ${head.title}` : \"Activate drawer\")\n }\n tabIndex={-1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.stopPropagation();\n onInactivePress();\n }}\n />\n )}\n </>\n );\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n type TransitionEvent,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { DrawerContent, drawerInteraction } from \"./content\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useDialogPortal } from \"../../internal/useDialogPortal\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { dialogAttributes } from \"../../internal/dialogLabel\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport { DialogContent, useDialogPresence } from \"../../internal/overlayLayer\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /**\n * Visually suspend an open dialog while retaining its mounted children. It\n * stays laid out but invisible and inert, so scroll positions are kept.\n */\n isHidden?: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Without it the title still names the dialog; give people another way to close it. */\n hasHeader?: boolean;\n /**\n * Only the active panel traps focus and handles Escape. An inactive open\n * panel stays visible and mounted as an inert background panel.\n */\n isActive?: boolean;\n /** Activate an exposed inactive panel. Its editor stays inert; the app decides whether to activate it. */\n onInactivePress?: () => void;\n /** Accessible name for the inactive-panel action; defaults to Return to {title} for string titles. */\n inactivePressLabel?: string;\n /** Without a scrim, presses outside the panel reach the page beneath. */\n hasScrim?: boolean;\n /**\n * z-index for this panel and the dialogs and popovers opened from it.\n * Defaults to an enclosing `OverlayLayer`, then the stylesheet. Keep it below\n * the toast layer (80).\n */\n overlayLayer?: number;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n const onTransitionEnd = (event: TransitionEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n };\n return [exiting, onTransitionEnd] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n isHidden = false,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n hasHeader = true,\n isActive = true,\n onInactivePress,\n inactivePressLabel,\n hasScrim = true,\n overlayLayer,\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const { layer, isVisible, isResumed } = useDialogPresence(isOpen, isHidden, overlayLayer);\n const { active, isInert, canPress, frameInert, panelAttributes } = drawerInteraction({\n isOpen,\n isVisible,\n isActive,\n onInactivePress,\n ariaHidden: rest[\"aria-hidden\"],\n });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, onTransitionEnd] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown, order } = useModalDialog({\n isOpen,\n isActive: active,\n layer,\n panelRef,\n onClose,\n // A hidden header's close button can't take focus.\n initialFocus: variant === \"navigation\" && hasHeader ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n const portal = useDialogPortal(order, isOpen || exiting, portalContainer);\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || !portal) {\n return null;\n }\n\n return createPortal(\n <DialogContent\n layer={layer}\n isSuspended={isInert}\n >\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = frameInert;\n }\n }}\n className=\"ds-drawer-scrim\"\n hidden={!isVisible}\n data-scrim={hasScrim ? undefined : \"none\"}\n data-inactive-press={canPress || undefined}\n data-resumed={isResumed || undefined}\n style={{ zIndex: layer }}\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={frameInert || undefined}\n onTransitionEnd={onTransitionEnd}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n {...dialogAttributes(rest, titleId, descriptionId, Boolean(description), active)}\n {...panelAttributes}\n data-side={side}\n data-size={size}\n data-header={hasHeader ? undefined : \"none\"}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <DrawerContent\n isInert={isInert}\n title={title}\n description={description}\n onClose={onClose}\n hasHeader={hasHeader}\n variant={variant}\n closeLabel={closeLabel}\n titleId={titleId}\n descriptionId={descriptionId}\n closeRef={closeRef}\n footer={footer}\n onInactivePress={canPress ? onInactivePress : undefined}\n inactivePressLabel={inactivePressLabel}\n >\n {children}\n </DrawerContent>\n </div>\n </div>\n </DialogContent>,\n portal,\n );\n});\n"],"mappings":"A,qSAOA,SAAgBuB,EAAW,CACzB,QACA,cACA,UACA,YACA,UACA,aACA,UACA,gBACA,YACY,CACZ,OACE,EAAAD,EAAA,KAAA,CAAC,SAAD,CACE,UAAU,kBACV,OAAQ,CAACE,EAFX,SAAA,EAIE,EAAAF,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,oBAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,KAAD,CACE,GAAIG,EACJ,UAAU,mBAET,SAAAC,CACC,CAAA,EACHC,IACC,EAAAL,EAAA,IAAA,CAAC,IAAD,CACE,GAAIM,EACJ,UAAU,yBAET,SAAAD,CACA,CAAA,CAEF,CACL,CAAA,GAAA,EAAAL,EAAA,IAAA,CAACtB,EAAAA,OAAD,CACE,IAAK6B,EACL,QAAQ,SACR,KAAMC,IAAY,aAAe,KAAO,KACxC,WAAA,GACA,UAAU,IACV,UAAWA,IAAY,aAAe,mBAAqB,IAAA,GAC3D,aAAYC,EACZ,QAASC,CACV,CAAA,CACK,C,EAEZ,CCxCA,SAAgBC,EAAkB,CAChC,SACA,YACA,WACA,kBACA,cAOC,CACD,IAAMC,EAASC,GAAYC,EACrBC,EAAU,CAACC,GAAU,CAACJ,EACtBK,EAAWD,GAAUF,GAAa,CAACD,GAAY,EAAQK,EAC7D,MAAO,CACL,SACA,UACA,WACA,WAAYH,GAAW,CAACE,EACxB,gBAAiB,CACf,cAAeA,EAAWE,EAAaJ,GAAWI,EAClD,SAAUF,EAAW,IAAA,GAAY,EACnC,CACF,CACF,CAGA,SAAgBG,EAAc,CAC5B,UACA,WACA,SACA,kBACA,qBACA,GAAGC,GACY,CACf,OACE,EAAArB,EAAA,KAAA,CAAArB,EAAAA,SAA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