@mortenbrudvik/waveui 0.14.1 → 0.16.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 +413 -53
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +90 -82
- package/dist/components/data-display/InfoButton.mjs.map +1 -1
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +19 -18
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +405 -219
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs +12 -6
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/feedback/MessageBarGroup.cjs +2 -0
- package/dist/components/feedback/MessageBarGroup.cjs.map +1 -0
- package/dist/components/feedback/MessageBarGroup.mjs +63 -0
- package/dist/components/feedback/MessageBarGroup.mjs.map +1 -0
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +41 -39
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +222 -216
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +163 -148
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +132 -117
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +1 -1
- package/dist/components/input/Listbox.cjs.map +1 -1
- package/dist/components/input/Listbox.mjs +90 -78
- package/dist/components/input/Listbox.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.data.cjs +2 -0
- package/dist/components/input/Option.data.cjs.map +1 -0
- package/dist/components/input/Option.data.mjs +114 -0
- package/dist/components/input/Option.data.mjs.map +1 -0
- package/dist/components/input/Option.mjs +21 -17
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +124 -109
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +207 -193
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/FlatTree.cjs +2 -0
- package/dist/components/layout/FlatTree.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.cjs +2 -0
- package/dist/components/layout/FlatTree.context.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.mjs +20 -0
- package/dist/components/layout/FlatTree.context.mjs.map +1 -0
- package/dist/components/layout/FlatTree.item.cjs +2 -0
- package/dist/components/layout/FlatTree.item.cjs.map +1 -0
- package/dist/components/layout/FlatTree.item.mjs +90 -0
- package/dist/components/layout/FlatTree.item.mjs.map +1 -0
- package/dist/components/layout/FlatTree.mjs +276 -0
- package/dist/components/layout/FlatTree.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +149 -108
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- package/dist/components/layout/Tree.context.cjs +1 -1
- package/dist/components/layout/Tree.context.cjs.map +1 -1
- package/dist/components/layout/Tree.context.mjs +2 -1
- package/dist/components/layout/Tree.context.mjs.map +1 -1
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +162 -148
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +1 -1
- package/dist/components/layout/Tree.selection.cjs.map +1 -1
- package/dist/components/layout/Tree.selection.mjs +11 -57
- package/dist/components/layout/Tree.selection.mjs.map +1 -1
- package/dist/components/layout/useFlatTree.cjs +2 -0
- package/dist/components/layout/useFlatTree.cjs.map +1 -0
- package/dist/components/layout/useFlatTree.mjs +83 -0
- package/dist/components/layout/useFlatTree.mjs.map +1 -0
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +154 -168
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +156 -136
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/NavDrawer.cjs +1 -1
- package/dist/components/navigation/NavDrawer.cjs.map +1 -1
- package/dist/components/navigation/NavDrawer.mjs +48 -45
- package/dist/components/navigation/NavDrawer.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +128 -122
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +1 -1
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.mjs +12 -12
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +97 -81
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Drawer.root.cjs +1 -1
- package/dist/components/overlays/Drawer.root.cjs.map +1 -1
- package/dist/components/overlays/Drawer.root.mjs +34 -31
- package/dist/components/overlays/Drawer.root.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +231 -216
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.mjs +199 -177
- package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.mjs +93 -92
- package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +66 -61
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +26 -23
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.context.cjs +2 -0
- package/dist/components/table/DataGrid.context.cjs.map +1 -0
- package/dist/components/table/DataGrid.context.mjs +74 -0
- package/dist/components/table/DataGrid.context.mjs.map +1 -0
- package/dist/components/table/DataGrid.header.cjs +2 -0
- package/dist/components/table/DataGrid.header.cjs.map +1 -0
- package/dist/components/table/DataGrid.header.mjs +168 -0
- package/dist/components/table/DataGrid.header.mjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +488 -591
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/DataGrid.sizing.cjs +2 -0
- package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
- package/dist/components/table/DataGrid.sizing.mjs +187 -0
- package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
- package/dist/components/table/DataGrid.store.cjs +2 -0
- package/dist/components/table/DataGrid.store.cjs.map +1 -0
- package/dist/components/table/DataGrid.store.mjs +108 -0
- package/dist/components/table/DataGrid.store.mjs.map +1 -0
- package/dist/components/table/DataGrid.window.cjs +2 -0
- package/dist/components/table/DataGrid.window.cjs.map +1 -0
- package/dist/components/table/DataGrid.window.mjs +165 -0
- package/dist/components/table/DataGrid.window.mjs.map +1 -0
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +74 -72
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.resize.cjs +2 -0
- package/dist/components/table/Table.resize.cjs.map +1 -0
- package/dist/components/table/Table.resize.mjs +98 -0
- package/dist/components/table/Table.resize.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +343 -140
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/components/table/useTableColumnSizing.cjs +2 -0
- package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
- package/dist/components/table/useTableColumnSizing.mjs +76 -0
- package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
- package/dist/components/table/useTableFeatures.cjs +2 -0
- package/dist/components/table/useTableFeatures.cjs.map +1 -0
- package/dist/components/table/useTableFeatures.mjs +110 -0
- package/dist/components/table/useTableFeatures.mjs.map +1 -0
- package/dist/components/table/useTableSelection.cjs +2 -0
- package/dist/components/table/useTableSelection.cjs.map +1 -0
- package/dist/components/table/useTableSelection.mjs +39 -0
- package/dist/components/table/useTableSelection.mjs.map +1 -0
- package/dist/components/table/useTableSort.cjs +2 -0
- package/dist/components/table/useTableSort.cjs.map +1 -0
- package/dist/components/table/useTableSort.mjs +58 -0
- package/dist/components/table/useTableSort.mjs.map +1 -0
- package/dist/hooks/useActiveDescendant.cjs +1 -1
- package/dist/hooks/useActiveDescendant.cjs.map +1 -1
- package/dist/hooks/useActiveDescendant.mjs +33 -25
- package/dist/hooks/useActiveDescendant.mjs.map +1 -1
- package/dist/hooks/useCollapsePresence.cjs +2 -0
- package/dist/hooks/useCollapsePresence.cjs.map +1 -0
- package/dist/hooks/useCollapsePresence.mjs +21 -0
- package/dist/hooks/useCollapsePresence.mjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.cjs +2 -0
- package/dist/hooks/useFocusBeforeClose.cjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.mjs +33 -0
- package/dist/hooks/useFocusBeforeClose.mjs.map +1 -0
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +140 -130
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useMotion.cjs +2 -0
- package/dist/hooks/useMotion.cjs.map +1 -0
- package/dist/hooks/useMotion.mjs +14 -0
- package/dist/hooks/useMotion.mjs.map +1 -0
- package/dist/hooks/usePresenceGroup.cjs +2 -0
- package/dist/hooks/usePresenceGroup.cjs.map +1 -0
- package/dist/hooks/usePresenceGroup.mjs +68 -0
- package/dist/hooks/usePresenceGroup.mjs.map +1 -0
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +1 -1
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/hooks/useSelection.cjs +2 -0
- package/dist/hooks/useSelection.cjs.map +1 -0
- package/dist/hooks/useSelection.mjs +57 -0
- package/dist/hooks/useSelection.mjs.map +1 -0
- package/dist/hooks/useVirtualWindow.cjs +2 -0
- package/dist/hooks/useVirtualWindow.cjs.map +1 -0
- package/dist/hooks/useVirtualWindow.mjs +102 -0
- package/dist/hooks/useVirtualWindow.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2249 -179
- package/dist/index.d.ts +2249 -179
- package/dist/index.mjs +147 -135
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +125 -95
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/columnSizing.cjs +2 -0
- package/dist/lib/columnSizing.cjs.map +1 -0
- package/dist/lib/columnSizing.mjs +27 -0
- package/dist/lib/columnSizing.mjs.map +1 -0
- package/dist/lib/flatTree.cjs +2 -0
- package/dist/lib/flatTree.cjs.map +1 -0
- package/dist/lib/flatTree.mjs +118 -0
- package/dist/lib/flatTree.mjs.map +1 -0
- package/dist/lib/motion.cjs +2 -0
- package/dist/lib/motion.cjs.map +1 -0
- package/dist/lib/motion.mjs +43 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/lib/selection.cjs +2 -0
- package/dist/lib/selection.cjs.map +1 -0
- package/dist/lib/selection.mjs +28 -0
- package/dist/lib/selection.mjs.map +1 -0
- package/dist/lib/treeCascade.cjs +2 -0
- package/dist/lib/treeCascade.cjs.map +1 -0
- package/dist/lib/treeCascade.mjs +52 -0
- package/dist/lib/treeCascade.mjs.map +1 -0
- package/dist/lib/virtual.cjs +2 -0
- package/dist/lib/virtual.cjs.map +1 -0
- package/dist/lib/virtual.mjs +54 -0
- package/dist/lib/virtual.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.root.mjs","names":["useId","useId$1","React","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","REACHABILITY_CHECK_DELAY","NESTED_TRIGGER_MAX_DEPTH","hasNestedTrigger","visit","level","node","item","depth","type","getElementType","DrawerTrigger","isFragment","nested","children","TITLE_IGNORED_WARNING_KEY","TITLE_IGNORED_WARNING","BODY_DUPLICATE_WARNING_KEY","BODY_DUPLICATE_WARNING","splitChildren","partition","flattenChildren","isElementOfType","DrawerBody","key","keyed","DrawerHeader","DrawerFooter","DrawerBuiltInHeader","scrollState","DrawerScrollStateContext","hasTitleAction","slotRendersContent","titleAction","hasTitle","closeButton","cn","drawerClassNames","scrollSeparatorClasses","titleId","drawerTitleClassNames","title","renderSlot","DrawerCloseButton","closeLabel","DrawerLayout","body","setBody","useScrollState","_children","bodyRest","bodyProps","bodyRef","useMergedRefs","ref","DrawerHeaderContext","DrawerPartContext","header","drawerBodyClassNames","focusRingInset","className","content","footers","DrawerRoot","openProp","rest","openState","requestOpen","useModalOpenState","defaultOpen","onOpenChange","open","useDrawerOpen","trigger","useModalTrigger","generatedId","panelId","id","propTitleId","titles","useTitleRegistry","panel","setPanel","panelRef","hasHeader","headers","titleRendersContent","titleIgnored","warnOnce","duplicateBody","bodyCount","nestedWarnedRef","isDev","NESTED_TRIGGER_WARNING_KEY","NESTED_TRIGGER_WARNING","unreachable","triggers","latestRef","timer","latest","context","panelContext","layout","DrawerContext","ModalSurfaceContext","labelledBy","panelElement","DrawerPanel","useModalTriggerSession"],"sources":["../../../src/components/overlays/Drawer.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport {\n drawerBodyClassNames,\n drawerClassNames,\n drawerTitleClassNames,\n} from '../../lib/classNames';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { renderSlot, slotRendersContent, type Slot, type SlotObject } from '../../lib/slot';\nimport { focusRingInset } from '../../lib/styles';\nimport type { BackdropAppearance } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport {\n ModalSurfaceContext,\n useModalOpenState,\n useModalTrigger,\n useModalTriggerSession,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n} from './Dialog.shared';\nimport {\n DrawerContext,\n DrawerHeaderContext,\n DrawerPartContext,\n DrawerScrollStateContext,\n type DrawerContextValue,\n type DrawerModalType,\n type DrawerOpenChangeDetails,\n type DrawerPosition,\n type DrawerSize,\n type DrawerType,\n} from './Drawer.context';\nimport { DrawerPanel, useDrawerOpen } from './Drawer.panel';\nimport {\n DrawerBody,\n DrawerCloseButton,\n DrawerFooter,\n DrawerHeader,\n DrawerTrigger,\n NESTED_TRIGGER_WARNING,\n NESTED_TRIGGER_WARNING_KEY,\n type DrawerBodyProps,\n} from './Drawer.parts';\nimport { scrollSeparatorClasses, useScrollState } from './Drawer.scroll';\n\n/*\n * The Drawer root: its props, the child scan, the layout and the development checks, on the drawer\n * panel shell (`DrawerPanel`), which renders the panel element and its machinery. Imports the\n * parts, panel, scroll and context modules (never `Drawer.tsx`, which holds the compound).\n */\n\n/** Properties for the Drawer component. */\nexport interface DrawerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /**\n * Controlled open state of the drawer. An overlay drawer's panel renders only in the browser:\n * open, it is closed in the server HTML and opens once it has hydrated. An inline drawer renders\n * in the server HTML: open, or hidden when kept mounted (`unmountOnClose={false}`).\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. An overlay drawer open by default is closed in the\n * server HTML and opens once it has hydrated; an inline one is open in the server HTML.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling. An inline drawer asks only with\n * `trigger` (its `Drawer.Trigger` toggles it), `close` and `close-button`: Escape and presses\n * outside it never close it.\n *\n * Fires only when the value changes; a controlled drawer stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * How the drawer sits on the page (Fluent's `type`).\n * - `overlay`: a panel over the page, rendered in a portal while open: modal by default (focus\n * moves in and stays there, toasts included; the rest of the page is `inert` and does not\n * scroll; Escape and a backdrop press close it), or `modalType=\"non-modal\"`.\n * - `inline`: a panel in the page layout, rendered where the Drawer is (after its direct\n * `Drawer.Trigger`s) as an `<aside>`, a complementary landmark named by its title. The page\n * stays usable around it: no backdrop, no focus trap, no portal, no scroll lock; Escape and\n * presses outside do not close it. Opening it leaves focus where it is; closing it while focus\n * is inside returns focus to `finalFocusRef`, else the element that opened it, else the\n * trigger. `position` and `size` pick its inner edge and its width (its height at the bottom);\n * where it sits is up to your layout (a flex row of panel and content, for example).\n * `modalType` and `backdrop` do not apply to it, and toasts do not move out of its way: it is\n * page content.\n *\n * Changing `type` remounts the panel and its content (what was typed in it is lost); focus\n * inside an overlay that becomes inline returns to the trigger, and focus inside an inline panel\n * that becomes an overlay moves into the overlay. Rendered as `data-type`.\n * @default 'overlay'\n */\n type?: DrawerType;\n /**\n * Inline drawers: draws a line on the panel's inner edge, the edge facing the page content\n * (`data-separator`). An overlay drawer always draws that edge and ignores this prop. In forced\n * colours an inline drawer's inner edge is always drawn. Fluent's `separator`.\n * @default false\n */\n separator?: boolean;\n /**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction;\n * `left`/`right` are physical sides; `bottom` runs along the bottom edge (`size` sets its\n * height). An inline drawer takes its place from your layout: `position` picks its inner edge\n * (the one facing the page content: the end edge of a `start` panel, the top edge of a `bottom`\n * one) and the axis `size` sets. Rendered as `data-position`.\n * @default 'end'\n */\n position?: DrawerPosition;\n /**\n * The panel's width at a side — `small` 320px, `medium` 592px, `large` 940px, `full` the\n * viewport's width — or its height at the bottom (the same values; `full` the viewport's height).\n * It never exceeds the viewport. An inline panel takes the same sizes, where `full` is its\n * container's width (height), and never grows past its container. A width class in `className`\n * (a height class for `bottom`) replaces it. Rendered as `data-size`. Fluent's `size`.\n * @default 'small'\n */\n size?: DrawerSize;\n /**\n * `modal`, `alert` or `non-modal`, as Dialog's `modalType`. `modal`: the page behind is `inert`\n * and does not scroll; a backdrop press, Escape, the Close button and `Drawer.Close` close it.\n * `alert`: `role=\"alertdialog\"` (a `role` you pass wins), and a backdrop press does not close it\n * (Escape still does). `non-modal`: no backdrop, and the page stays usable — no focus trap,\n * nothing inert, the page scrolls; Tab and Shift+Tab leave the drawer in the page's order right\n * after the element that opened it, Escape closes it while focus is inside it, presses on the\n * page never close it, and focus returns to the opener only when it was inside the drawer. A\n * non-modal drawer covers the page under it while Tab still reaches that page: reserve its width\n * (its height at the bottom) in your layout while it is open, or use `modal`, or, for a panel\n * beside the content, an inline drawer (`type=\"inline\"`) (with `size=\"full\"` it covers\n * everything, and a development warning says so). Every type moves focus to the first focusable\n * element on open. Rendered as `data-modal-type`. Ignored by an inline drawer, which is never\n * modal and renders no `data-modal-type`. Fluent's `modalType`.\n * @default 'modal'\n */\n modalType?: DrawerModalType;\n /**\n * The backdrop of a modal or alert drawer, as `Dialog.Content`'s `backdrop`: a `div` behind the\n * panel, `aria-hidden`. Shorthand content renders inside it; a slot object's `className` (merged\n * last), `style`, data attributes, `ref` and handlers go to it, and its `appearance`\n * (`'dimmed'` or `'transparent'`) overrides the automatic one: while another modal Dialog or\n * Drawer is open below this one the backdrop is transparent, so the page is dimmed once. `null`\n * renders no backdrop (the page stays inert, and a press outside still closes a modal drawer); a\n * boolean is no slot. Ignored with `modalType=\"non-modal\"` and by an inline drawer (a\n * development warning says so). Fluent's `backdrop`.\n */\n backdrop?: Slot<'div'> | (SlotObject<'div'> & { appearance?: BackdropAppearance });\n /**\n * Content of the built-in Close button, in the built-in header and in every\n * `Drawer.HeaderTitle`, as `Dialog.Content`'s `closeButton`: decorative content inside the button\n * (the dismiss glyph by default), so the button keeps the name `closeLabel`; a slot object's\n * `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the\n * close (`preventDefault()` keeps the drawer open). `null` hides them all (`Drawer.Close`, and\n * Escape on an overlay, still close); a boolean is no slot; content that renders nothing keeps the\n * default glyph. A `<button>` or Wave `Button` passed here is merged into the built-in button,\n * never nested (a development warning says so), and its text label names the button. Fluent's\n * `DrawerHeaderTitle` `action` holds Fluent's close button; WaveUI renders its own.\n */\n closeButton?: Slot<'span'>;\n /**\n * Header buttons for the `title` prop form, between the heading and the built-in Close button in\n * DOM and Tab order. Ignored, with a development warning, next to a `Drawer.Header` (use the\n * `action` of `Drawer.HeaderTitle`). Interactive: name icon-only buttons. Renders nothing when\n * empty. Fluent's `DrawerHeaderTitle` `action`, for the `title` prop form.\n */\n titleAction?: Slot<'span'>;\n /**\n * Title displayed in the built-in header; it names the drawer (`aria-labelledby`). Without it,\n * render a `Drawer.HeaderTitle` (in a `Drawer.Header`) or a `Drawer.Title`, or pass\n * `aria-label`/`aria-labelledby`. A title that renders nothing (`''`, `[]`, `true`) counts as\n * none. Ignored, with a development warning, when the children hold a `Drawer.Header`, which\n * replaces the built-in header. The heading is an `<h2>`; for another level use\n * `Drawer.HeaderTitle` with `headingLevel`. In the server HTML of an inline drawer only `title`\n * (or `aria-label`/`aria-labelledby`) names the panel: a `Drawer.HeaderTitle` or `Drawer.Title`\n * names it once the page has hydrated.\n */\n title?: React.ReactNode;\n /**\n * Accessible name of the built-in Close button (an icon-only button), in the built-in header and\n * in every `Drawer.HeaderTitle`. Localize it with the page's language. A text label of a button\n * merged into `closeButton` names it instead.\n * @default 'Close'\n */\n closeLabel?: string;\n /**\n * Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the drawer opened, then to the trigger, then to an element next to\n * where that opener was. An inline or non-modal drawer moves focus on close only when focus was\n * inside it.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * Removes the panel and its content when the drawer closes. `false` keeps them mounted while\n * closed, `hidden` and `inert` (out of the layout, the Tab order and the accessibility tree), so\n * what was typed and the state of the components inside survive closing and opening again; the\n * content then mounts with the Drawer, closed, and an `autoFocus` inside it never applies (an\n * overlay focuses its first focusable element on each open). An overlay panel still renders only\n * in the browser; a kept inline panel is in the server HTML, hidden. Kept content still belongs\n * to its form: a `required` empty field in a closed inline drawer inside a page `<form>` blocks\n * its submission without a visible message. A popup opened inside that is still open when the\n * drawer closes stays open over the page (a development warning says so): close it first. A\n * `key` on the Drawer resets the kept content. Fluent's `unmountOnClose`.\n * @default true\n */\n unmountOnClose?: boolean;\n /**\n * The drawer's content, placed by the Drawer, also from a Fragment (`{isMobile && <>…</>}`) and\n * when written in a Server Component: `Drawer.Trigger` children render in place (outside the\n * panel); a `Drawer.Header` replaces the built-in header (the `title` and Close button row); a\n * `Drawer.Body` gives the scrolling body its props; `Drawer.Footer` renders below the scrolling\n * body, outside it, wherever it is written among the children; everything else renders in the\n * scrolling body. A part nested in another element (a `<form>`) or rendered by a component of\n * yours renders where it is, in the body (a development warning says so). A `Drawer.Trigger`\n * nested in another element, or rendered by a component, is panel content, so it is not rendered\n * (or, kept mounted, is hidden) while the drawer is closed (development warnings say so, also\n * when an uncontrolled drawer still has no direct trigger a second after it mounts and therefore\n * cannot open; a controlled drawer whose trigger a component such as a Tooltip wraps warns only\n * once it renders in the panel).\n * Put wrappers inside the trigger instead: see `Drawer.Trigger`.\n */\n children: React.ReactNode;\n /**\n * Ref to the panel: the `role=\"dialog\"` element of an overlay drawer (`alertdialog` with\n * `modalType=\"alert\"`), the `<aside>` of an inline one. A ref to a `div` still type-checks.\n */\n ref?: React.Ref<HTMLElement>;\n}\n\nconst UNREACHABLE_WARNING_KEY = 'Drawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which is not rendered or is hidden while the drawer is closed. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.';\n\n/**\n * How long after mount (ms) the development check for a drawer without a trigger waits: long\n * enough for a trigger that a conditional Fragment renders once the page knows its layout.\n */\nconst REACHABILITY_CHECK_DELAY = 1000;\n\n/** Deepest element level the development check for nested triggers looks at. */\nconst NESTED_TRIGGER_MAX_DEPTH = 32;\n\n/**\n * Development check: whether the Drawer's children hold a `Drawer.Trigger` inside a host element\n * (at any depth, also through Fragments), which would become panel content; a trigger inside\n * Fragments only is direct (see `splitChildren`). Walks the element tree the consumer wrote, not\n * rendered output, so it descends only into host elements (`<div>`, `<span>`, …) and Fragments,\n * which render their `children` as written. A component's\n * output is unknown here — a wrapper that renders its own Drawer around its children, for one —\n * so components are not walked; a trigger rendered by a component is caught when it renders in the\n * open panel, or, while the drawer cannot open, by the unreachable-drawer check.\n */\nfunction hasNestedTrigger(children: React.ReactNode): boolean {\n // `depth` counts host elements only: a Fragment adds no level, as `splitChildren` flattens it.\n const visit = (node: unknown, depth: number, level: number): boolean => {\n if (level > NESTED_TRIGGER_MAX_DEPTH || typeof node !== 'object' || node === null) return false;\n if (Array.isArray(node)) return node.some((item) => visit(item, depth, level));\n if (!React.isValidElement(node)) return false;\n // A part written in a Server Component has a lazy type. The walk runs in effects, outside\n // render: a lazy part that is still loading must not throw its thenable there, so it counts\n // as no trigger (`suspend: false` returns the lazy itself, which matches nothing).\n const type = getElementType(node, { suspend: false });\n if (type === DrawerTrigger) return depth > 0;\n const isFragment = type === React.Fragment;\n if (typeof type !== 'string' && !isFragment) return false;\n const { children: nested } = node.props as { children?: unknown };\n return visit(nested, isFragment ? depth : depth + 1, level + 1);\n };\n return visit(children, 0, 0);\n}\n\nconst TITLE_IGNORED_WARNING_KEY = 'Drawer:title-ignored';\nconst TITLE_IGNORED_WARNING =\n 'Drawer: `title` and `titleAction` are ignored because a Drawer.Header is among the children. Put a Drawer.HeaderTitle (with its `action`) in the header instead.';\n\nconst BODY_DUPLICATE_WARNING_KEY = 'Drawer.Body:duplicate';\nconst BODY_DUPLICATE_WARNING =\n 'Drawer has more than one Drawer.Body: the props of the first one apply to the scrolling body, and the children of every one render in their place. Render one Drawer.Body.';\n\n/** How the Drawer sorts its direct children ({@link splitChildren}). */\ninterface DrawerPartition {\n /** The direct `Drawer.Trigger` elements, rendered in place. */\n triggers: React.ReactNode[];\n /** The direct `Drawer.Header` elements, rendered in the header area in written order. */\n headers: React.ReactNode[];\n /** The props of the first direct `Drawer.Body` (its `children` render in `content`). */\n bodyProps: DrawerBodyProps | undefined;\n /** How many direct `Drawer.Body` elements there are. */\n bodyCount: number;\n /** The body content in written order; a `Drawer.Body` is replaced by its children. */\n content: React.ReactNode[];\n /** The direct `Drawer.Footer` elements, rendered after the body in written order. */\n footers: React.ReactNode[];\n}\n\n/**\n * Sorts the Drawer's children: its direct `Drawer.Trigger`, `Drawer.Header`, `Drawer.Body` and\n * `Drawer.Footer` elements and the body content. Fragments are flattened (recursively), so a part\n * in a Fragment — `{isMobile && <><Drawer.Trigger>…</Drawer.Trigger><Filters /></>}` — counts as a\n * direct child. Every element keeps the key `flattenChildren` gives it: unique across Fragments and\n * stable when a sibling Fragment toggles, so body content keeps its state when a part appears. A\n * part is recognised also when it was written in a Server Component (a lazy type). Runs during\n * render, so the placement is the same on the server.\n */\nfunction splitChildren(children: React.ReactNode): DrawerPartition {\n const partition: DrawerPartition = {\n triggers: [],\n headers: [],\n bodyProps: undefined,\n bodyCount: 0,\n content: [],\n footers: [],\n };\n for (const { key, node } of flattenChildren(children)) {\n if (isElementOfType<DrawerBodyProps>(node, DrawerBody)) {\n // The first Body's props go on the scrolling body; every Body's children render in place.\n partition.bodyCount += 1;\n if (partition.bodyCount === 1) partition.bodyProps = node.props;\n partition.content.push(<React.Fragment key={key}>{node.props.children}</React.Fragment>);\n continue;\n }\n const keyed = React.isValidElement(node) ? React.cloneElement(node, { key }) : node;\n if (isElementOfType(node, DrawerTrigger)) partition.triggers.push(keyed);\n else if (isElementOfType(node, DrawerHeader)) partition.headers.push(keyed);\n else if (isElementOfType(node, DrawerFooter)) partition.footers.push(keyed);\n else partition.content.push(keyed);\n }\n return partition;\n}\n\n/** Properties of the built-in header ({@link DrawerBuiltInHeader}). */\ninterface DrawerBuiltInHeaderProps {\n /** The `title` prop, when it renders content. */\n title: React.ReactNode;\n /** Whether `title` renders content (else no heading renders). */\n hasTitle: boolean;\n /** The heading's id (the panel's `aria-labelledby`). */\n titleId: string;\n /** The `titleAction` slot. */\n titleAction: Slot<'span'> | undefined;\n requestOpen: ModalRequestOpen;\n closeLabel: string;\n /** The `closeButton` slot (`null`: no Close button). */\n closeButton: Slot<'span'> | undefined;\n}\n\n/**\n * The 0.10 header row of the `title` form (no `Drawer.Header` among the children): the `title`\n * heading, the `titleAction` content and the Close button as its direct children. The title action\n * takes the free room (`ms-auto`), so the Close button follows it through the row's gap; without\n * one the Close button does. It reads the body's scroll state for its separator. A row with\n * nothing in it (no title, no title action, `closeButton={null}`) renders no element.\n */\nfunction DrawerBuiltInHeader({\n title,\n hasTitle,\n titleId,\n titleAction,\n requestOpen,\n closeLabel,\n closeButton,\n}: DrawerBuiltInHeaderProps) {\n const scrollState = React.useContext(DrawerScrollStateContext) ?? 'none';\n const hasTitleAction = slotRendersContent(titleAction);\n if (!hasTitle && !hasTitleAction && closeButton === null) return null;\n return (\n <div\n data-scroll-state={scrollState}\n className={cn(\n drawerClassNames.header,\n 'flex shrink-0 items-center justify-between gap-2 p-4',\n scrollSeparatorClasses.header,\n )}\n >\n {hasTitle && (\n <h2\n id={titleId}\n className={cn(drawerTitleClassNames.root, 'text-subtitle-1 font-semibold')}\n >\n {title}\n </h2>\n )}\n {hasTitleAction\n ? renderSlot(\n titleAction,\n 'span',\n cn(drawerClassNames.titleAction, 'ms-auto flex shrink-0 items-center gap-1'),\n )\n : null}\n <DrawerCloseButton\n requestOpen={requestOpen}\n label={closeLabel}\n closeButton={closeButton}\n className={cn(!hasTitleAction && 'ms-auto', 'text-muted-foreground')}\n />\n </div>\n );\n}\nDrawerBuiltInHeader.displayName = 'DrawerBuiltInHeader';\n\n/** Properties of {@link DrawerLayout}. */\ninterface DrawerLayoutProps {\n /** The header area: the built-in header, or the placed `Drawer.Header` elements. */\n header: React.ReactNode;\n /** The props of the placed `Drawer.Body`, put on the scrolling body. */\n bodyProps: DrawerBodyProps | undefined;\n /** The body content. */\n content: React.ReactNode;\n /** The placed `Drawer.Footer` elements. */\n footers: React.ReactNode;\n}\n\n/**\n * The panel's layout (internal): the header area, the scrolling body and the footers. It owns the\n * body's scroll state (`useScrollState`), so a change of the state re-renders this component, the\n * body element and the parts that read the state (the header area and the footers), never the\n * consumer's content: the elements it receives as props are the same objects, so React skips them.\n */\nfunction DrawerLayout({ header, bodyProps, content, footers }: DrawerLayoutProps) {\n const [body, setBody] = React.useState<HTMLDivElement | null>(null);\n const scrollState = useScrollState(body);\n const { children: _children, className, ref, ...bodyRest } = bodyProps ?? {};\n const bodyRef = useMergedRefs<HTMLDivElement>(setBody, ref);\n return (\n <DrawerScrollStateContext.Provider value={scrollState}>\n <DrawerHeaderContext.Provider value={false}>\n <DrawerPartContext.Provider value=\"placed\">{header}</DrawerPartContext.Provider>\n <div\n data-scroll-state={scrollState}\n {...bodyRest}\n ref={bodyRef}\n className={cn(\n drawerClassNames.body,\n bodyProps && drawerBodyClassNames.root,\n 'min-h-0 flex-1 overflow-y-auto p-4',\n focusRingInset,\n className,\n )}\n >\n <DrawerPartContext.Provider value=\"content\">{content}</DrawerPartContext.Provider>\n </div>\n <DrawerPartContext.Provider value=\"placed\">{footers}</DrawerPartContext.Provider>\n </DrawerHeaderContext.Provider>\n </DrawerScrollStateContext.Provider>\n );\n}\nDrawerLayout.displayName = 'DrawerLayout';\n\n// The root of `Drawer` (documented on the export in Drawer.tsx).\nexport const DrawerRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n type = 'overlay',\n separator = false,\n position = 'end',\n size = 'small',\n modalType = 'modal',\n backdrop,\n closeButton,\n titleAction,\n title,\n closeLabel = 'Close',\n finalFocusRef,\n unmountOnClose = true,\n children,\n id,\n ref,\n ...rest\n}: DrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // An overlay's panel lives in a portal, which renders only in the browser: until then (the\n // server HTML, hydration) it reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe a panel that is not there. An inline panel renders in place, also\n // on the server (D107).\n const open = useDrawerOpen(type, openState);\n const trigger = useModalTrigger();\n const generatedId = useId('wave-drawer');\n const panelId = id ?? generatedId;\n const propTitleId = useId('wave-drawer-title');\n const titles = useTitleRegistry();\n // The mounted panel (the shell's element of either type), for the unnamed-drawer check.\n const [panel, setPanel] = React.useState<HTMLElement | null>(null);\n const panelRef = useMergedRefs<HTMLElement>(ref, setPanel);\n useUnnamedModalWarning(\n open ? panel : null,\n titles.hasTitle,\n 'Drawer',\n 'Drawer.HeaderTitle or a Drawer.Title',\n );\n\n const { triggers, headers, bodyProps, bodyCount, content, footers } = splitChildren(children);\n const hasHeader = headers.length > 0;\n // A Drawer.Header replaces the built-in header, whose `title` it cannot show.\n const titleRendersContent = slotRendersContent(title);\n const hasTitle = titleRendersContent && !hasHeader;\n const titleIgnored = (titleRendersContent || slotRendersContent(titleAction)) && hasHeader;\n React.useEffect(() => {\n if (titleIgnored) warnOnce(TITLE_IGNORED_WARNING_KEY, TITLE_IGNORED_WARNING);\n }, [titleIgnored]);\n const duplicateBody = bodyCount > 1;\n React.useEffect(() => {\n if (duplicateBody) warnOnce(BODY_DUPLICATE_WARNING_KEY, BODY_DUPLICATE_WARNING);\n }, [duplicateBody]);\n\n // A trigger nested in the children is panel content: not rendered (or, kept mounted, hidden) while\n // the drawer is closed.\n // The children change on every parent render; once this drawer has warned, it stops walking.\n const nestedWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (!isDev || nestedWarnedRef.current || !hasNestedTrigger(children)) return;\n nestedWarnedRef.current = true;\n warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [children]);\n\n // An uncontrolled closed drawer without a direct trigger cannot open (e.g.\n // `<Drawer><FilterTrigger /></Drawer>`, whose trigger is panel content). Checked once, a moment\n // after mount, against the latest render: a trigger that a conditional Fragment adds right after\n // mount (`{isMobile && <>…</>}` with an SSR-safe media query) counts. A trigger nested in an\n // element already has the more specific warning above.\n const unreachable = openProp === undefined && !defaultOpen && triggers.length === 0;\n const latestRef = React.useRef({ unreachable, children });\n React.useLayoutEffect(() => {\n latestRef.current = { unreachable, children };\n });\n React.useEffect(() => {\n if (!isDev || !latestRef.current.unreachable) return;\n const timer = setTimeout(() => {\n const latest = latestRef.current;\n if (latest.unreachable && !hasNestedTrigger(latest.children)) {\n warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }\n }, REACHABILITY_CHECK_DELAY);\n return () => clearTimeout(timer);\n }, []);\n\n const context = React.useMemo<DrawerContextValue>(\n () => ({ open, requestOpen, trigger, panelId, type, inPanel: false, closeLabel, closeButton }),\n [open, requestOpen, trigger, panelId, type, closeLabel, closeButton],\n );\n const panelContext = React.useMemo<DrawerContextValue>(\n () => ({ ...context, inPanel: true }),\n [context],\n );\n\n // The panel's content: the header area, the scrolling body and the footers, for both types.\n const layout = (\n <DrawerContext.Provider value={panelContext}>\n <ModalSurfaceContext.Provider value={titles.context}>\n <DrawerLayout\n header={\n hasHeader ? (\n headers\n ) : (\n <DrawerBuiltInHeader\n title={title}\n hasTitle={hasTitle}\n titleId={propTitleId}\n titleAction={titleAction}\n requestOpen={requestOpen}\n closeLabel={closeLabel}\n closeButton={closeButton}\n />\n )\n }\n bodyProps={bodyProps}\n content={content}\n footers={footers}\n />\n </ModalSurfaceContext.Provider>\n </DrawerContext.Provider>\n );\n const labelledBy = hasTitle ? propTitleId : titles.titleId;\n\n // The panel and its machinery (portal, backdrop, presence, layer, trap, restore, Tab order) come\n // from the shell (D108); the root names it and fills it with its layout.\n const panelElement = (\n <DrawerPanel\n componentName=\"Drawer\"\n type={type}\n open={open}\n requestOpen={requestOpen}\n position={position}\n size={size}\n separator={separator}\n modalType={modalType}\n unmountOnClose={unmountOnClose}\n inlineAs=\"aside\"\n trigger={trigger}\n finalFocusRef={finalFocusRef}\n rootClassName={drawerClassNames.root}\n backdropClassName={drawerClassNames.backdrop}\n backdrop={backdrop}\n id={panelId}\n aria-labelledby={labelledBy}\n {...rest}\n ref={panelRef}\n >\n {layout}\n </DrawerPanel>\n );\n // After the shell's focus restores (its effects run before the root's), start the trigger\n // session, or end it and forget the trigger that opened it.\n useModalTriggerSession(trigger, open);\n\n return (\n <DrawerContext.Provider value={context}>\n {triggers}\n {panelElement}\n </DrawerContext.Provider>\n );\n};\nDrawerRoot.displayName = 'Drawer';\n"],"mappings":";;;;;;;;;;;;;;;;;AA6OA,IAAMG,KAA0B,sBAC1BC,KACJ,8ZAMIC,KAA2B,KAG3BC,IAA2B;AAYjC,SAASC,EAAiB,GAAoC;CAE5D,IAAMC,KAAS,GAAe,GAAe,MAA2B;EACtE,IAAIC,IAAQH,KAA4B,OAAOI,KAAS,aAAYA,GAAe,OAAO;EAC1F,IAAI,MAAM,QAAQA,CAAI,GAAG,OAAOA,EAAK,MAAM,MAASF,EAAMG,GAAMC,GAAOH,CAAK,CAAC;EAC7E,IAAI,CAACP,EAAM,eAAeQ,CAAI,GAAG,OAAO;EAIxC,IAAMG,IAAOC,EAAeJ,GAAM,EAAE,SAAS,GAAM,CAAC;EACpD,IAAIG,MAASE,GAAe,OAAOH,IAAQ;EAC3C,IAAMI,IAAaH,MAASX,EAAM;EAClC,IAAI,OAAOW,KAAS,YAAY,CAACG,GAAY,OAAO;EAC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;AAE5B;AACA,EAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"Drawer.root.mjs","names":["useId","useId$1","React","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","REACHABILITY_CHECK_DELAY","NESTED_TRIGGER_MAX_DEPTH","hasNestedTrigger","visit","level","node","item","depth","type","getElementType","DrawerTrigger","isFragment","nested","children","TITLE_IGNORED_WARNING_KEY","TITLE_IGNORED_WARNING","BODY_DUPLICATE_WARNING_KEY","BODY_DUPLICATE_WARNING","splitChildren","partition","flattenChildren","isElementOfType","DrawerBody","key","keyed","DrawerHeader","DrawerFooter","DrawerBuiltInHeader","scrollState","DrawerScrollStateContext","hasTitleAction","slotRendersContent","titleAction","hasTitle","closeButton","cn","drawerClassNames","scrollSeparatorClasses","titleId","drawerTitleClassNames","title","renderSlot","DrawerCloseButton","closeLabel","DrawerLayout","body","setBody","useScrollState","_children","bodyRest","bodyProps","bodyRef","useMergedRefs","ref","DrawerHeaderContext","DrawerPartContext","header","drawerBodyClassNames","focusRingInset","className","content","footers","DrawerRoot","openProp","rest","openState","requestOpen","useModalOpenState","defaultOpen","onOpenChange","open","useDrawerOpen","trigger","useModalTrigger","generatedId","panelId","id","propTitleId","titles","useTitleRegistry","panel","setPanel","panelRef","hasHeader","headers","titleRendersContent","titleIgnored","warnOnce","duplicateBody","bodyCount","nestedWarnedRef","isDev","NESTED_TRIGGER_WARNING_KEY","NESTED_TRIGGER_WARNING","unreachable","triggers","latestRef","timer","latest","context","panelContext","layout","DrawerContext","ModalSurfaceContext","labelledBy","panelElement","DrawerPanel","useModalTriggerSession"],"sources":["../../../src/components/overlays/Drawer.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport {\n drawerBodyClassNames,\n drawerClassNames,\n drawerTitleClassNames,\n} from '../../lib/classNames';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { renderSlot, slotRendersContent, type Slot, type SlotObject } from '../../lib/slot';\nimport { focusRingInset } from '../../lib/styles';\nimport type { BackdropAppearance, MotionSlot } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport {\n ModalSurfaceContext,\n useModalOpenState,\n useModalTrigger,\n useModalTriggerSession,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n} from './Dialog.shared';\nimport {\n DrawerContext,\n DrawerHeaderContext,\n DrawerPartContext,\n DrawerScrollStateContext,\n type DrawerContextValue,\n type DrawerModalType,\n type DrawerOpenChangeDetails,\n type DrawerPosition,\n type DrawerSize,\n type DrawerType,\n} from './Drawer.context';\nimport { DrawerPanel, useDrawerOpen } from './Drawer.panel';\nimport {\n DrawerBody,\n DrawerCloseButton,\n DrawerFooter,\n DrawerHeader,\n DrawerTrigger,\n NESTED_TRIGGER_WARNING,\n NESTED_TRIGGER_WARNING_KEY,\n type DrawerBodyProps,\n} from './Drawer.parts';\nimport { scrollSeparatorClasses, useScrollState } from './Drawer.scroll';\n\n/*\n * The Drawer root: its props, the child scan, the layout and the development checks, on the drawer\n * panel shell (`DrawerPanel`), which renders the panel element and its machinery. Imports the\n * parts, panel, scroll and context modules (never `Drawer.tsx`, which holds the compound).\n */\n\n/** Properties for the Drawer component. */\nexport interface DrawerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /**\n * Controlled open state of the drawer. An overlay drawer's panel renders only in the browser:\n * open, it is closed in the server HTML and opens once it has hydrated. An inline drawer renders\n * in the server HTML: open, or hidden when kept mounted (`unmountOnClose={false}`).\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. An overlay drawer open by default is closed in the\n * server HTML and opens once it has hydrated; an inline one is open in the server HTML.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling. An inline drawer asks only with\n * `trigger` (its `Drawer.Trigger` toggles it), `close` and `close-button`: Escape and presses\n * outside it never close it.\n *\n * Fires only when the value changes; a controlled drawer stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * How the drawer sits on the page (Fluent's `type`).\n * - `overlay`: a panel over the page, rendered in a portal while open: modal by default (focus\n * moves in and stays there, toasts included; the rest of the page is `inert` and does not\n * scroll; Escape and a backdrop press close it), or `modalType=\"non-modal\"`.\n * - `inline`: a panel in the page layout, rendered where the Drawer is (after its direct\n * `Drawer.Trigger`s) as an `<aside>`, a complementary landmark named by its title. The page\n * stays usable around it: no backdrop, no focus trap, no portal, no scroll lock; Escape and\n * presses outside do not close it. Opening it leaves focus where it is; closing it while focus\n * is inside returns focus to `finalFocusRef`, else the element that opened it, else the\n * trigger. `position` and `size` pick its inner edge and its width (its height at the bottom);\n * where it sits is up to your layout (a flex row of panel and content, for example).\n * `modalType` and `backdrop` do not apply to it, and toasts do not move out of its way: it is\n * page content.\n *\n * Changing `type` remounts the panel and its content (what was typed in it is lost); focus\n * inside an overlay that becomes inline returns to the trigger, and focus inside an inline panel\n * that becomes an overlay moves into the overlay. Rendered as `data-type`.\n * @default 'overlay'\n */\n type?: DrawerType;\n /**\n * Inline drawers: draws a line on the panel's inner edge, the edge facing the page content\n * (`data-separator`). An overlay drawer always draws that edge and ignores this prop. In forced\n * colours an inline drawer's inner edge is always drawn. Fluent's `separator`.\n * @default false\n */\n separator?: boolean;\n /**\n * Side of the screen the drawer is attached to. `start`/`end` follow the text direction;\n * `left`/`right` are physical sides; `bottom` runs along the bottom edge (`size` sets its\n * height). An inline drawer takes its place from your layout: `position` picks its inner edge\n * (the one facing the page content: the end edge of a `start` panel, the top edge of a `bottom`\n * one) and the axis `size` sets. Rendered as `data-position`.\n * @default 'end'\n */\n position?: DrawerPosition;\n /**\n * The panel's width at a side — `small` 320px, `medium` 592px, `large` 940px, `full` the\n * viewport's width — or its height at the bottom (the same values; `full` the viewport's height).\n * It never exceeds the viewport. An inline panel takes the same sizes, where `full` is its\n * container's width (height), and never grows past its container. A width class in `className`\n * (a height class for `bottom`) replaces it. It also times the motion, an overlay's slide and an\n * inline drawer's collapse alike: 250 ms small, 300 ms medium, 400 ms large, 500 ms full (an\n * inline drawer at `full` has no motion; see `motion`). Rendered as `data-size`. Fluent's\n * `size`.\n * @default 'small'\n */\n size?: DrawerSize;\n /**\n * `modal`, `alert` or `non-modal`, as Dialog's `modalType`. `modal`: the page behind is `inert`\n * and does not scroll; a backdrop press, Escape, the Close button and `Drawer.Close` close it.\n * `alert`: `role=\"alertdialog\"` (a `role` you pass wins), and a backdrop press does not close it\n * (Escape still does). `non-modal`: no backdrop, and the page stays usable — no focus trap,\n * nothing inert, the page scrolls; Tab and Shift+Tab leave the drawer in the page's order right\n * after the element that opened it, Escape closes it while focus is inside it, presses on the\n * page never close it, and focus returns to the opener only when it was inside the drawer. A\n * non-modal drawer covers the page under it while Tab still reaches that page: reserve its width\n * (its height at the bottom) in your layout while it is open, or use `modal`, or, for a panel\n * beside the content, an inline drawer (`type=\"inline\"`) (with `size=\"full\"` it covers\n * everything, and a development warning says so). Every type moves focus to the first focusable\n * element on open. Rendered as `data-modal-type`. Ignored by an inline drawer, which is never\n * modal and renders no `data-modal-type`. Fluent's `modalType`.\n * @default 'modal'\n */\n modalType?: DrawerModalType;\n /**\n * The backdrop of a modal or alert drawer, as `Dialog.Content`'s `backdrop`: a `div` behind the\n * panel, `aria-hidden`. Shorthand content renders inside it; a slot object's `className` (merged\n * last), `style`, data attributes, `ref` and handlers go to it, and its `appearance`\n * (`'dimmed'` or `'transparent'`) overrides the automatic one: while another modal Dialog or\n * Drawer is open below this one the backdrop is transparent, so the page is dimmed once. `null`\n * renders no backdrop (the page stays inert, and a press outside still closes a modal drawer); a\n * boolean is no slot. Ignored with `modalType=\"non-modal\"` and by an inline drawer (a\n * development warning says so). Fluent's `backdrop`.\n */\n backdrop?: Slot<'div'> | (SlotObject<'div'> & { appearance?: BackdropAppearance });\n /**\n * The drawer's motion. By default an overlay panel slides in from beyond its edge and fades in\n * with a decelerating curve, and slides back out and fades out with an accelerating curve; the\n * `start` and `end` edges follow the text direction, `left` and `right` do not mirror, and a\n * `bottom` panel rises from below. An inline drawer by default opens the space it takes in your\n * layout from nothing (its width at a side, its height at the bottom) while its panel fades in,\n * held at its size against its inner edge, so it reads as sliding out from that edge, with a\n * decelerating curve; closing runs the same backwards with an accelerating curve. Both take a\n * duration that follows `size` both ways: 250 ms small, 300 ms medium, 400 ms large, 500 ms\n * full. An inline drawer at `full` has no motion, as its size is its container's (a value here\n * does not apply to it either), and an inline drawer whose width (height at the bottom) in\n * `className` is a percentage resizes oddly during the motion, correctly once open: give it a\n * length, or pass `null`. Under reduced motion the drawer appears and disappears at once.\n * `null` turns the motion off (the drawer still renders its `data-presence` phases, which then\n * end at once); a class string or `{ className }` replaces the default classes with yours (see\n * `MotionSlot`), also under a `WaveProvider` with `motion=\"none\"`, which otherwise turns the\n * default off. They go on the overlay panel, or on the element around an inline drawer's\n * `<aside>` (`wave-drawer__collapse`), whose phases the drawer waits for. A `className` that\n * holds `data-[presence=…]` classes while `motion` is unset keeps 0.14's behaviour: no default\n * motion, your classes animate the panel, and the drawer waits for the panel's motion (an\n * inline one's `<aside>`, not the element around it). Fluent's `OverlayDrawer` and\n * `InlineDrawer` `surfaceMotion`.\n * @default the slide (overlay) or the collapse (inline) above\n */\n motion?: MotionSlot | null;\n /**\n * The backdrop's motion (a modal or alert overlay). By default it fades in and out with a\n * linear curve over the panel's duration (250 to 500 ms, by `size`), so it ends with the panel;\n * under reduced motion it appears and disappears at once. `null` turns the motion off; a class\n * string or `{ className }` replaces the default classes with yours (see `MotionSlot`), also\n * under a `WaveProvider` with `motion=\"none\"`, which otherwise turns the default off. The\n * panel's motion decides when the drawer unmounts or hides: a replacement longer than the\n * panel's exit is cut off there. Ignored with `modalType=\"non-modal\"` and by an inline drawer\n * (a development warning says so). Fluent's `OverlayDrawer` `backdropMotion`.\n * @default the fade above\n */\n backdropMotion?: MotionSlot | null;\n /**\n * Content of the built-in Close button, in the built-in header and in every\n * `Drawer.HeaderTitle`, as `Dialog.Content`'s `closeButton`: decorative content inside the button\n * (the dismiss glyph by default), so the button keeps the name `closeLabel`; a slot object's\n * `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the\n * close (`preventDefault()` keeps the drawer open). `null` hides them all (`Drawer.Close`, and\n * Escape on an overlay, still close); a boolean is no slot; content that renders nothing keeps the\n * default glyph. A `<button>` or Wave `Button` passed here is merged into the built-in button,\n * never nested (a development warning says so), and its text label names the button. Fluent's\n * `DrawerHeaderTitle` `action` holds Fluent's close button; WaveUI renders its own.\n */\n closeButton?: Slot<'span'>;\n /**\n * Header buttons for the `title` prop form, between the heading and the built-in Close button in\n * DOM and Tab order. Ignored, with a development warning, next to a `Drawer.Header` (use the\n * `action` of `Drawer.HeaderTitle`). Interactive: name icon-only buttons. Renders nothing when\n * empty. Fluent's `DrawerHeaderTitle` `action`, for the `title` prop form.\n */\n titleAction?: Slot<'span'>;\n /**\n * Title displayed in the built-in header; it names the drawer (`aria-labelledby`). Without it,\n * render a `Drawer.HeaderTitle` (in a `Drawer.Header`) or a `Drawer.Title`, or pass\n * `aria-label`/`aria-labelledby`. A title that renders nothing (`''`, `[]`, `true`) counts as\n * none. Ignored, with a development warning, when the children hold a `Drawer.Header`, which\n * replaces the built-in header. The heading is an `<h2>`; for another level use\n * `Drawer.HeaderTitle` with `headingLevel`. In the server HTML of an inline drawer only `title`\n * (or `aria-label`/`aria-labelledby`) names the panel: a `Drawer.HeaderTitle` or `Drawer.Title`\n * names it once the page has hydrated.\n */\n title?: React.ReactNode;\n /**\n * Accessible name of the built-in Close button (an icon-only button), in the built-in header and\n * in every `Drawer.HeaderTitle`. Localize it with the page's language. A text label of a button\n * merged into `closeButton` names it instead.\n * @default 'Close'\n */\n closeLabel?: string;\n /**\n * Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the drawer opened, then to the trigger, then to an element next to\n * where that opener was. An inline or non-modal drawer moves focus on close only when focus was\n * inside it.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * Removes the panel and its content when the drawer closes, once the panel's exit motion has\n * ended. `false` keeps them mounted while closed, `hidden` and `inert` (out of the layout, the\n * Tab order and the accessibility tree), so what was typed and the state of the components\n * inside survive closing and opening again; the content then mounts with the Drawer, closed, and\n * an `autoFocus` inside it never applies (an overlay focuses its first focusable element on each\n * open). An overlay panel still renders only in the browser; a kept inline panel is in the\n * server HTML, hidden. Kept content still belongs to its form: a `required` empty field in a\n * closed inline drawer inside a page `<form>` blocks its submission without a visible message. A\n * popup opened inside that is still open when the drawer closes stays open over the page (a\n * development warning says so): close it first. A `key` on the Drawer resets the kept content.\n * Fluent's `unmountOnClose`.\n * @default true\n */\n unmountOnClose?: boolean;\n /**\n * The drawer's content, placed by the Drawer, also from a Fragment (`{isMobile && <>…</>}`) and\n * when written in a Server Component: `Drawer.Trigger` children render in place (outside the\n * panel); a `Drawer.Header` replaces the built-in header (the `title` and Close button row); a\n * `Drawer.Body` gives the scrolling body its props; `Drawer.Footer` renders below the scrolling\n * body, outside it, wherever it is written among the children; everything else renders in the\n * scrolling body. A part nested in another element (a `<form>`) or rendered by a component of\n * yours renders where it is, in the body (a development warning says so). A `Drawer.Trigger`\n * nested in another element, or rendered by a component, is panel content, so it is not rendered\n * (or, kept mounted, is hidden) while the drawer is closed (development warnings say so, also\n * when an uncontrolled drawer still has no direct trigger a second after it mounts and therefore\n * cannot open; a controlled drawer whose trigger a component such as a Tooltip wraps warns only\n * once it renders in the panel).\n * Put wrappers inside the trigger instead: see `Drawer.Trigger`.\n */\n children: React.ReactNode;\n /**\n * Ref to the panel: the `role=\"dialog\"` element of an overlay drawer (`alertdialog` with\n * `modalType=\"alert\"`), the `<aside>` of an inline one. A ref to a `div` still type-checks.\n */\n ref?: React.Ref<HTMLElement>;\n}\n\nconst UNREACHABLE_WARNING_KEY = 'Drawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'Drawer has no way to open: a second after mounting it is still uncontrolled (no `open` prop), closed, and has no Drawer.Trigger as a direct child (or in a Fragment there). A Drawer.Trigger rendered by a component or nested in an element is panel content, which is not rendered or is hidden while the drawer is closed. Make the trigger a direct child of Drawer, or control the Drawer with `open`/`onOpenChange`.';\n\n/**\n * How long after mount (ms) the development check for a drawer without a trigger waits: long\n * enough for a trigger that a conditional Fragment renders once the page knows its layout.\n */\nconst REACHABILITY_CHECK_DELAY = 1000;\n\n/** Deepest element level the development check for nested triggers looks at. */\nconst NESTED_TRIGGER_MAX_DEPTH = 32;\n\n/**\n * Development check: whether the Drawer's children hold a `Drawer.Trigger` inside a host element\n * (at any depth, also through Fragments), which would become panel content; a trigger inside\n * Fragments only is direct (see `splitChildren`). Walks the element tree the consumer wrote, not\n * rendered output, so it descends only into host elements (`<div>`, `<span>`, …) and Fragments,\n * which render their `children` as written. A component's\n * output is unknown here — a wrapper that renders its own Drawer around its children, for one —\n * so components are not walked; a trigger rendered by a component is caught when it renders in the\n * open panel, or, while the drawer cannot open, by the unreachable-drawer check.\n */\nfunction hasNestedTrigger(children: React.ReactNode): boolean {\n // `depth` counts host elements only: a Fragment adds no level, as `splitChildren` flattens it.\n const visit = (node: unknown, depth: number, level: number): boolean => {\n if (level > NESTED_TRIGGER_MAX_DEPTH || typeof node !== 'object' || node === null) return false;\n if (Array.isArray(node)) return node.some((item) => visit(item, depth, level));\n if (!React.isValidElement(node)) return false;\n // A part written in a Server Component has a lazy type. The walk runs in effects, outside\n // render: a lazy part that is still loading must not throw its thenable there, so it counts\n // as no trigger (`suspend: false` returns the lazy itself, which matches nothing).\n const type = getElementType(node, { suspend: false });\n if (type === DrawerTrigger) return depth > 0;\n const isFragment = type === React.Fragment;\n if (typeof type !== 'string' && !isFragment) return false;\n const { children: nested } = node.props as { children?: unknown };\n return visit(nested, isFragment ? depth : depth + 1, level + 1);\n };\n return visit(children, 0, 0);\n}\n\nconst TITLE_IGNORED_WARNING_KEY = 'Drawer:title-ignored';\nconst TITLE_IGNORED_WARNING =\n 'Drawer: `title` and `titleAction` are ignored because a Drawer.Header is among the children. Put a Drawer.HeaderTitle (with its `action`) in the header instead.';\n\nconst BODY_DUPLICATE_WARNING_KEY = 'Drawer.Body:duplicate';\nconst BODY_DUPLICATE_WARNING =\n 'Drawer has more than one Drawer.Body: the props of the first one apply to the scrolling body, and the children of every one render in their place. Render one Drawer.Body.';\n\n/** How the Drawer sorts its direct children ({@link splitChildren}). */\ninterface DrawerPartition {\n /** The direct `Drawer.Trigger` elements, rendered in place. */\n triggers: React.ReactNode[];\n /** The direct `Drawer.Header` elements, rendered in the header area in written order. */\n headers: React.ReactNode[];\n /** The props of the first direct `Drawer.Body` (its `children` render in `content`). */\n bodyProps: DrawerBodyProps | undefined;\n /** How many direct `Drawer.Body` elements there are. */\n bodyCount: number;\n /** The body content in written order; a `Drawer.Body` is replaced by its children. */\n content: React.ReactNode[];\n /** The direct `Drawer.Footer` elements, rendered after the body in written order. */\n footers: React.ReactNode[];\n}\n\n/**\n * Sorts the Drawer's children: its direct `Drawer.Trigger`, `Drawer.Header`, `Drawer.Body` and\n * `Drawer.Footer` elements and the body content. Fragments are flattened (recursively), so a part\n * in a Fragment — `{isMobile && <><Drawer.Trigger>…</Drawer.Trigger><Filters /></>}` — counts as a\n * direct child. Every element keeps the key `flattenChildren` gives it: unique across Fragments and\n * stable when a sibling Fragment toggles, so body content keeps its state when a part appears. A\n * part is recognised also when it was written in a Server Component (a lazy type). Runs during\n * render, so the placement is the same on the server.\n */\nfunction splitChildren(children: React.ReactNode): DrawerPartition {\n const partition: DrawerPartition = {\n triggers: [],\n headers: [],\n bodyProps: undefined,\n bodyCount: 0,\n content: [],\n footers: [],\n };\n for (const { key, node } of flattenChildren(children)) {\n if (isElementOfType<DrawerBodyProps>(node, DrawerBody)) {\n // The first Body's props go on the scrolling body; every Body's children render in place.\n partition.bodyCount += 1;\n if (partition.bodyCount === 1) partition.bodyProps = node.props;\n partition.content.push(<React.Fragment key={key}>{node.props.children}</React.Fragment>);\n continue;\n }\n const keyed = React.isValidElement(node) ? React.cloneElement(node, { key }) : node;\n if (isElementOfType(node, DrawerTrigger)) partition.triggers.push(keyed);\n else if (isElementOfType(node, DrawerHeader)) partition.headers.push(keyed);\n else if (isElementOfType(node, DrawerFooter)) partition.footers.push(keyed);\n else partition.content.push(keyed);\n }\n return partition;\n}\n\n/** Properties of the built-in header ({@link DrawerBuiltInHeader}). */\ninterface DrawerBuiltInHeaderProps {\n /** The `title` prop, when it renders content. */\n title: React.ReactNode;\n /** Whether `title` renders content (else no heading renders). */\n hasTitle: boolean;\n /** The heading's id (the panel's `aria-labelledby`). */\n titleId: string;\n /** The `titleAction` slot. */\n titleAction: Slot<'span'> | undefined;\n requestOpen: ModalRequestOpen;\n closeLabel: string;\n /** The `closeButton` slot (`null`: no Close button). */\n closeButton: Slot<'span'> | undefined;\n}\n\n/**\n * The 0.10 header row of the `title` form (no `Drawer.Header` among the children): the `title`\n * heading, the `titleAction` content and the Close button as its direct children. The title action\n * takes the free room (`ms-auto`), so the Close button follows it through the row's gap; without\n * one the Close button does. It reads the body's scroll state for its separator. A row with\n * nothing in it (no title, no title action, `closeButton={null}`) renders no element.\n */\nfunction DrawerBuiltInHeader({\n title,\n hasTitle,\n titleId,\n titleAction,\n requestOpen,\n closeLabel,\n closeButton,\n}: DrawerBuiltInHeaderProps) {\n const scrollState = React.useContext(DrawerScrollStateContext) ?? 'none';\n const hasTitleAction = slotRendersContent(titleAction);\n if (!hasTitle && !hasTitleAction && closeButton === null) return null;\n return (\n <div\n data-scroll-state={scrollState}\n className={cn(\n drawerClassNames.header,\n 'flex shrink-0 items-center justify-between gap-2 p-4',\n scrollSeparatorClasses.header,\n )}\n >\n {hasTitle && (\n <h2\n id={titleId}\n className={cn(drawerTitleClassNames.root, 'text-subtitle-1 font-semibold')}\n >\n {title}\n </h2>\n )}\n {hasTitleAction\n ? renderSlot(\n titleAction,\n 'span',\n cn(drawerClassNames.titleAction, 'ms-auto flex shrink-0 items-center gap-1'),\n )\n : null}\n <DrawerCloseButton\n requestOpen={requestOpen}\n label={closeLabel}\n closeButton={closeButton}\n className={cn(!hasTitleAction && 'ms-auto', 'text-muted-foreground')}\n />\n </div>\n );\n}\nDrawerBuiltInHeader.displayName = 'DrawerBuiltInHeader';\n\n/** Properties of {@link DrawerLayout}. */\ninterface DrawerLayoutProps {\n /** The header area: the built-in header, or the placed `Drawer.Header` elements. */\n header: React.ReactNode;\n /** The props of the placed `Drawer.Body`, put on the scrolling body. */\n bodyProps: DrawerBodyProps | undefined;\n /** The body content. */\n content: React.ReactNode;\n /** The placed `Drawer.Footer` elements. */\n footers: React.ReactNode;\n}\n\n/**\n * The panel's layout (internal): the header area, the scrolling body and the footers. It owns the\n * body's scroll state (`useScrollState`), so a change of the state re-renders this component, the\n * body element and the parts that read the state (the header area and the footers), never the\n * consumer's content: the elements it receives as props are the same objects, so React skips them.\n */\nfunction DrawerLayout({ header, bodyProps, content, footers }: DrawerLayoutProps) {\n const [body, setBody] = React.useState<HTMLDivElement | null>(null);\n const scrollState = useScrollState(body);\n const { children: _children, className, ref, ...bodyRest } = bodyProps ?? {};\n const bodyRef = useMergedRefs<HTMLDivElement>(setBody, ref);\n return (\n <DrawerScrollStateContext.Provider value={scrollState}>\n <DrawerHeaderContext.Provider value={false}>\n <DrawerPartContext.Provider value=\"placed\">{header}</DrawerPartContext.Provider>\n <div\n data-scroll-state={scrollState}\n {...bodyRest}\n ref={bodyRef}\n className={cn(\n drawerClassNames.body,\n bodyProps && drawerBodyClassNames.root,\n 'min-h-0 flex-1 overflow-y-auto p-4',\n focusRingInset,\n className,\n )}\n >\n <DrawerPartContext.Provider value=\"content\">{content}</DrawerPartContext.Provider>\n </div>\n <DrawerPartContext.Provider value=\"placed\">{footers}</DrawerPartContext.Provider>\n </DrawerHeaderContext.Provider>\n </DrawerScrollStateContext.Provider>\n );\n}\nDrawerLayout.displayName = 'DrawerLayout';\n\n// The root of `Drawer` (documented on the export in Drawer.tsx).\nexport const DrawerRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n type = 'overlay',\n separator = false,\n position = 'end',\n size = 'small',\n modalType = 'modal',\n backdrop,\n motion,\n backdropMotion,\n closeButton,\n titleAction,\n title,\n closeLabel = 'Close',\n finalFocusRef,\n unmountOnClose = true,\n children,\n id,\n ref,\n ...rest\n}: DrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // An overlay's panel lives in a portal, which renders only in the browser: until then (the\n // server HTML, hydration) it reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe a panel that is not there. An inline panel renders in place, also\n // on the server (D107).\n const open = useDrawerOpen(type, openState);\n const trigger = useModalTrigger();\n const generatedId = useId('wave-drawer');\n const panelId = id ?? generatedId;\n const propTitleId = useId('wave-drawer-title');\n const titles = useTitleRegistry();\n // The mounted panel (the shell's element of either type), for the unnamed-drawer check.\n const [panel, setPanel] = React.useState<HTMLElement | null>(null);\n const panelRef = useMergedRefs<HTMLElement>(ref, setPanel);\n useUnnamedModalWarning(\n open ? panel : null,\n titles.hasTitle,\n 'Drawer',\n 'Drawer.HeaderTitle or a Drawer.Title',\n );\n\n const { triggers, headers, bodyProps, bodyCount, content, footers } = splitChildren(children);\n const hasHeader = headers.length > 0;\n // A Drawer.Header replaces the built-in header, whose `title` it cannot show.\n const titleRendersContent = slotRendersContent(title);\n const hasTitle = titleRendersContent && !hasHeader;\n const titleIgnored = (titleRendersContent || slotRendersContent(titleAction)) && hasHeader;\n React.useEffect(() => {\n if (titleIgnored) warnOnce(TITLE_IGNORED_WARNING_KEY, TITLE_IGNORED_WARNING);\n }, [titleIgnored]);\n const duplicateBody = bodyCount > 1;\n React.useEffect(() => {\n if (duplicateBody) warnOnce(BODY_DUPLICATE_WARNING_KEY, BODY_DUPLICATE_WARNING);\n }, [duplicateBody]);\n\n // A trigger nested in the children is panel content: not rendered (or, kept mounted, hidden) while\n // the drawer is closed.\n // The children change on every parent render; once this drawer has warned, it stops walking.\n const nestedWarnedRef = React.useRef(false);\n React.useEffect(() => {\n if (!isDev || nestedWarnedRef.current || !hasNestedTrigger(children)) return;\n nestedWarnedRef.current = true;\n warnOnce(NESTED_TRIGGER_WARNING_KEY, NESTED_TRIGGER_WARNING);\n }, [children]);\n\n // An uncontrolled closed drawer without a direct trigger cannot open (e.g.\n // `<Drawer><FilterTrigger /></Drawer>`, whose trigger is panel content). Checked once, a moment\n // after mount, against the latest render: a trigger that a conditional Fragment adds right after\n // mount (`{isMobile && <>…</>}` with an SSR-safe media query) counts. A trigger nested in an\n // element already has the more specific warning above.\n const unreachable = openProp === undefined && !defaultOpen && triggers.length === 0;\n const latestRef = React.useRef({ unreachable, children });\n React.useLayoutEffect(() => {\n latestRef.current = { unreachable, children };\n });\n React.useEffect(() => {\n if (!isDev || !latestRef.current.unreachable) return;\n const timer = setTimeout(() => {\n const latest = latestRef.current;\n if (latest.unreachable && !hasNestedTrigger(latest.children)) {\n warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }\n }, REACHABILITY_CHECK_DELAY);\n return () => clearTimeout(timer);\n }, []);\n\n const context = React.useMemo<DrawerContextValue>(\n () => ({ open, requestOpen, trigger, panelId, type, inPanel: false, closeLabel, closeButton }),\n [open, requestOpen, trigger, panelId, type, closeLabel, closeButton],\n );\n const panelContext = React.useMemo<DrawerContextValue>(\n () => ({ ...context, inPanel: true }),\n [context],\n );\n\n // The panel's content: the header area, the scrolling body and the footers, for both types.\n const layout = (\n <DrawerContext.Provider value={panelContext}>\n <ModalSurfaceContext.Provider value={titles.context}>\n <DrawerLayout\n header={\n hasHeader ? (\n headers\n ) : (\n <DrawerBuiltInHeader\n title={title}\n hasTitle={hasTitle}\n titleId={propTitleId}\n titleAction={titleAction}\n requestOpen={requestOpen}\n closeLabel={closeLabel}\n closeButton={closeButton}\n />\n )\n }\n bodyProps={bodyProps}\n content={content}\n footers={footers}\n />\n </ModalSurfaceContext.Provider>\n </DrawerContext.Provider>\n );\n const labelledBy = hasTitle ? propTitleId : titles.titleId;\n\n // The panel and its machinery (portal, backdrop, presence, layer, trap, restore, Tab order) come\n // from the shell (D108); the root names it and fills it with its layout.\n const panelElement = (\n <DrawerPanel\n componentName=\"Drawer\"\n type={type}\n open={open}\n requestOpen={requestOpen}\n position={position}\n size={size}\n separator={separator}\n modalType={modalType}\n unmountOnClose={unmountOnClose}\n inlineAs=\"aside\"\n trigger={trigger}\n finalFocusRef={finalFocusRef}\n rootClassName={drawerClassNames.root}\n backdropClassName={drawerClassNames.backdrop}\n collapseClassName={drawerClassNames.collapse}\n backdrop={backdrop}\n motion={motion}\n backdropMotion={backdropMotion}\n id={panelId}\n aria-labelledby={labelledBy}\n {...rest}\n ref={panelRef}\n >\n {layout}\n </DrawerPanel>\n );\n // After the shell's focus restores (its effects run before the root's), start the trigger\n // session, or end it and forget the trigger that opened it.\n useModalTriggerSession(trigger, open);\n\n return (\n <DrawerContext.Provider value={context}>\n {triggers}\n {panelElement}\n </DrawerContext.Provider>\n );\n};\nDrawerRoot.displayName = 'Drawer';\n"],"mappings":";;;;;;;;;;;;;;;;;AAsRA,IAAMG,KAA0B,sBAC1BC,KACJ,8ZAMIC,KAA2B,KAG3BC,IAA2B;AAYjC,SAASC,EAAiB,GAAoC;CAE5D,IAAMC,KAAS,GAAe,GAAe,MAA2B;EACtE,IAAIC,IAAQH,KAA4B,OAAOI,KAAS,aAAYA,GAAe,OAAO;EAC1F,IAAI,MAAM,QAAQA,CAAI,GAAG,OAAOA,EAAK,MAAM,MAASF,EAAMG,GAAMC,GAAOH,CAAK,CAAC;EAC7E,IAAI,CAACP,EAAM,eAAeQ,CAAI,GAAG,OAAO;EAIx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mBA,EAAiB;EAC1B;EACF;EACQ;EAChB,IAAIuC;EACJ,mBAAiB6B;EACjB,GAAIxC;EACJ,KAAKkB;EAEJ,UAAAmB;CACU,CAAA;CAMf,OAFAM,EAAuBnC,GAASF,CAAI,GAGlC,kBAACgC,EAAc,UAAf;EAAwB,OAAOH;EAA/B,UAAA,CACGJ,GACAU,EACqB;;AAE5B;AACA,EAAW,cAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useEventCallback.cjs"),s=require("../../hooks/useControllable.cjs"),c=require("../../hooks/useId.cjs"),l=require("../../lib/focus.cjs"),u=require("../../hooks/useMergedRefs.cjs"),ee=require("../../hooks/useIsClient.cjs"),d=require("../../hooks/usePopupPosition.cjs"),f=require("../../hooks/useDismiss.cjs"),te=require("../../hooks/useRestoreFocus.cjs"),p=require("../portal/Portal.cjs"),ne=require("../../hooks/useHoverIntent.cjs"),m=require("./Popover.shared.cjs"),h=require("../../hooks/useTriggerElement.cjs"),g=require("../../hooks/useResolvedTarget.cjs"),_=require("../../hooks/useContextMenuAnchor.cjs");let v=require("react");v=e.__toESM(v,1);let y=require("react/jsx-runtime");var b=v.createContext(null);b.displayName=`PopoverContext`;var x=null;function S(){return x??={open:!1,setOpen:()=>{},contentId:`wave-popover-inert-content`,setCustomContentId:()=>{},triggerId:`wave-popover-inert-trigger`,resolvedTriggerId:void 0,setResolvedTriggerId:()=>{},triggerRef:{current:null},triggerElement:null,triggerElementRef:()=>{},surfaceElementRef:()=>{},arrowRef:{current:null},onTriggerClick:()=>{},onTriggerKeyDown:()=>{},hoverTriggerHandlers:null,hoverSurfaceHandlers:null,contextMode:!1,contextTriggerHandlers:null,onContentContextMenu:()=>{},keyboardContext:!1,onContentKeyDown:()=>{},layerId:`wave-popover-inert-layer`,floatingProps:{"data-side":`bottom`,"data-align":`start`,style:{}},arrowStyles:{},placedSide:`bottom`,fitViewport:!1},x}function C(e){return v.useContext(b)||(n.reportMissingContext(e,`Popover`),S())}function w(e,t){let n=(t??``).split(/\s+/).filter(t=>t&&e.getElementById(t));return n.length>0?n.join(` `):void 0}function T(e,t){if(!e)return t;let n=e.ownerDocument,r=(t?n.getElementById(t):null)??h.getTriggerFocusTarget(e)??e;return w(n,r.getAttribute(`aria-labelledby`))??(r.id||e.id||void 0)}function E(e,t){return t.split(/\s+/).some(t=>{let n=t?e.getElementById(t):null;return n?n.getAttribute(`aria-label`)?.trim()||n.textContent?.trim()?!0:!!n.querySelector(`[aria-label]:not([aria-label=""]), [alt]:not([alt=""]), [title]:not([title=""])`):!1})}var re=()=>()=>{};function D(e){return!!e&&typeof e.nodeType==`number`}function O(e){return{get current(){return e()}}}function k(e,t,n){return h.getTriggerFocusTarget(e)??m.getTabbableThrough(e,t,n)}var A=({open:e,defaultOpen:t,onOpenChange:r,side:i=`bottom`,align:a=`start`,ignoreOutsideRefs:p,openOnHover:x=!1,openDelay:S=250,closeDelay:C=500,openOnContext:w=!1,target:T,positioning:E,children:re})=>{let{target:A,pending:j}=g.usePopupTarget(`Popover`,T,E),[M,N]=s.useControllable(e,t??!1,r),P=v.useRef(!1),F=o.useEventCallback(e=>{P.current=!1,N(e)}),ie=v.useCallback(()=>P.current,[]),ae=ee.useIsClient(),I=M&&ae,[L,oe]=v.useState(`other`),[se,R]=v.useState(!1),[ce,z]=v.useState(I),B=L;I!==ce&&(z(I),I&&(B=se?`hover`:`other`)),B!==L&&oe(B),se&&R(!1);let V=c.useId(`popover-content`),[le,ue]=v.useState(void 0),de=le??V,H=c.useId(`popover-trigger`),[U,fe]=v.useState(void 0),[W,pe]=v.useState(null),[G,me]=v.useState(null),K=v.useRef(null),q=v.useRef(null),he=v.useRef(null),ge=D(A)?A:null,J=v.useRef(null);v.useInsertionEffect(()=>{J.current=ge},[ge]);let{setReference:_e,setFloating:ve,floatingProps:Y,arrowStyles:ye,side:be}=d.usePopupPosition({open:I,side:i,align:a,arrowRef:he,...d.resolvePositioning(E,{offset:8})}),xe=v.useMemo(()=>j?{...Y,style:{...Y.style,visibility:`hidden`}}:Y,[j,Y]),Se=v.useRef(null),Ce=o.useEventCallback(()=>{let e=w?Se.current?.current:null;if(e&&l.isConnectedAndFocusable(e))return e;let t=K.current,n=t?h.getTriggerFocusTarget(t):null;if(n)return n;let r=J.current;return r&&l.isConnectedAndFocusable(r)?r:t}),we=v.useMemo(()=>O(Ce),[Ce]),Te=o.useEventCallback(e=>!(e.ctrlKey&&K.current?.contains(e.target))),{layerId:X}=f.useDismiss({open:I,onDismiss:()=>F(!1),refs:w?[q,J,...p??[]]:[q,K,J,...p??[]],anchorRef:we,kind:`popover`,outsidePress:!w||Te}),Z=v.useRef(!1),{anchor:Ee,fromContext:De,origin:Oe,opener:Q,triggerHandlers:ke,surfaceHandlers:Ae}=_.useContextMenuAnchor({enabled:w,open:I,trigger:G,layerId:X,onOpen:e=>{Z.current=e===`keyboard`,F(!0)},onClose:()=>F(!1)});v.useInsertionEffect(()=>{Se.current=Q},[Q]);let je=h.useTriggerFocusRef(K);te.useRestoreFocus({enabled:I,container:W,triggerRef:w?void 0:je,finalFocusRef:w?Q:void 0,fallback:Ce,onlyIfFocusInside:!0,isHoverClose:ie}),v.useLayoutEffect(()=>{I&&(P.current=!1)},[I]);let Me=u.useMergedRefs(K,me),Ne=u.useMergedRefs(q,pe,ve);v.useLayoutEffect(()=>{_e(De?Ee??(G&&(h.getTriggerFocusTarget(G)??G)):A??G)},[Ee,De,A,G,_e]),v.useLayoutEffect(()=>{if(Z.current){if(!I){Z.current=!1;return}W&&(Z.current=!1,l.focusElement(l.getFirstTabbable(W)??W,{preventScroll:!0}))}}),v.useEffect(()=>{x&&w&&n.warnOnce(`Popover:hover-and-context`,"Popover: `openOnHover` is ignored with `openOnContext`: a context popover opens on a right click, Shift+F10 or the ContextMenu key, not on hover.")},[x,w]);let $=x&&!w,Pe=o.useEventCallback(()=>B===`hover`&&!m.isFocusInSurfaceTree(q.current,X)),{triggerHandlers:Fe,surfaceHandlers:Ie,cancel:Le}=ne.useHoverIntent({enabled:$,open:I,openDelay:S,closeDelay:C,trigger:G,surface:W,onOpen:()=>{R(!0),F(!0)},onClose:()=>{P.current=!0,N(!1)},canClose:Pe}),Re=o.useEventCallback(()=>{Le(),I&&B===`hover`?oe(`other`):F(e=>!e)}),ze=o.useEventCallback(()=>{let e=K.current,t=w?Q.current:null;return t&&e?.contains(t)?t:e??J.current}),Be=v.useMemo(()=>O(ze),[ze]),Ve=o.useEventCallback(e=>{if(e.key!==`Tab`||e.shiftKey||!I)return;if(w){let t=ze();if(!t||e.target!==(h.getTriggerFocusTarget(t)??t))return}let t=q.current,n=t?l.getFirstTabbable(t):null;n&&(e.preventDefault(),n.focus())}),He=m.usePopoverTabOrder({enabled:I,surface:W,anchorRef:Be,getPreviousStop:k}),Ue=De&&Oe===`keyboard`,We=v.useMemo(()=>({open:I,setOpen:F,contentId:de,setCustomContentId:ue,triggerId:H,resolvedTriggerId:U,setResolvedTriggerId:fe,triggerRef:K,triggerElement:G,triggerElementRef:Me,surfaceElementRef:Ne,arrowRef:he,onTriggerClick:Re,onTriggerKeyDown:Ve,hoverTriggerHandlers:$?Fe:null,hoverSurfaceHandlers:$?Ie:null,contextMode:w,contextTriggerHandlers:w?ke:null,onContentContextMenu:Ae.onContextMenu,keyboardContext:Ue,onContentKeyDown:He,layerId:X,floatingProps:xe,arrowStyles:ye,placedSide:be,fitViewport:E?.fitViewport===!0}),[I,F,de,H,U,G,Me,Ne,Re,Ve,$,Fe,Ie,w,ke,Ae,Ue,He,X,xe,ye,be,E?.fitViewport]);return(0,y.jsx)(b.Provider,{value:We,children:re})};A.displayName=`Popover`;var j=({children:e,asChild:t,id:n,onClick:r,onKeyDown:a,onContextMenu:o,onPointerEnter:s,onPointerMove:c,onPointerLeave:l,ref:ee,...d})=>{let{open:f,contentId:te,triggerId:p,triggerElementRef:ne,setResolvedTriggerId:m,onTriggerClick:g,onTriggerKeyDown:_,hoverTriggerHandlers:v,contextMode:y,contextTriggerHandlers:b}=C(`Popover.Trigger`),x=u.useMergedRefs(ee,ne),S={...d,id:n??p,"aria-haspopup":`dialog`,"aria-expanded":!y&&f,"aria-controls":f&&!y?te:void 0,onClick:i.composeEventHandlers(r,y?void 0:g),onKeyDown:i.composeEventHandlers(a,b?i.composeEventHandlers(b.onKeyDown,_):_),onContextMenu:b?i.composeEventHandlers(o,b.onContextMenu):o,onPointerEnter:v?i.composeEventHandlers(s,v.onPointerEnter):s,onPointerMove:v?i.composeEventHandlers(c,v.onPointerMove):c,onPointerLeave:v?i.composeEventHandlers(l,v.onPointerLeave):l,ref:x};return h.useTriggerElement(e,S,{componentName:`Popover.Trigger`,asChild:t,onResolvedId:m,omitStateAria:y})};j.displayName=`PopoverTrigger`;var M=({children:e,title:o,id:s,className:l,style:ee,"aria-label":d,"aria-labelledby":f,onKeyDown:te,onContextMenu:ne,onPointerEnter:h,onPointerLeave:g,ref:_,...b})=>{let{open:x,contentId:S,setCustomContentId:w,resolvedTriggerId:D,triggerRef:O,triggerElement:k,surfaceElementRef:A,arrowRef:j,layerId:M,floatingProps:N,arrowStyles:P,placedSide:F,fitViewport:ie,onContentKeyDown:ae,hoverSurfaceHandlers:I,contextMode:L,onContentContextMenu:oe,keyboardContext:se}=C(`Popover.Content`),R=c.useId(`popover-title`),ce=u.useMergedRefs(_,A),z=r.slotRendersContent(o),B=f===void 0&&!d&&!z,V=x&&B&&!L,le=v.useCallback(e=>{if(!V||!k||typeof MutationObserver>`u`)return re();let t=new MutationObserver(e);return t.observe(k,{attributes:!0,attributeFilter:[`id`,`aria-labelledby`],childList:!0,subtree:!0}),()=>t.disconnect()},[V,k]),ue=v.useSyncExternalStore(le,()=>V?T(k,D):void 0,()=>V?D:void 0),de=f??(d?void 0:z?R:ue),H=s||void 0;if(v.useEffect(()=>(w(H),()=>w(void 0)),[H,w]),v.useEffect(()=>{x&&B&&L&&n.isDev&&n.warnOnce(`Popover.Content:name`,"Popover.Content: the popover has no accessible name. A context popover (openOnContext) is not named by its region: pass `title`, `aria-label` or `aria-labelledby`.")},[x,B,L]),v.useEffect(()=>{if(!V||!n.isDev)return;let e=O.current;if(!e){n.warnOnce(`Popover.Content:name`,"Popover.Content: the popover has no accessible name. Pass `title`, `aria-label` or `aria-labelledby`, or open it from a Popover.Trigger.");return}let t=T(e,D);t?E(e.ownerDocument,t)||n.warnOnce(`Popover.Content:trigger-name`,"Popover.Content: the popover is named by its trigger, but the trigger has no text to name it (an icon-only trigger needs `aria-label`, or `aria-labelledby` pointing at text), so the popover has no accessible name. Name the trigger, or pass `title`, `aria-label` or `aria-labelledby`."):n.warnOnce(`Popover.Content:trigger-id`,"Popover.Content: the popover is named by its trigger, but the trigger element has no `id` (a render-prop child of Popover.Trigger must spread the `id` it receives), so the popover has no accessible name. Spread every trigger prop onto the element, or pass `title`, `aria-label` or `aria-labelledby`.")},[V,D,O,ue]),!x)return null;let U=(0,y.jsxs)(y.Fragment,{children:[z&&(0,y.jsx)(`h2`,{id:R,className:t.cn(a.popoverContentClassNames.title,`mb-2 text-subtitle-2 font-semibold`),children:o}),e]});return(0,y.jsx)(p.Portal,{layerId:M,children:(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":d,"aria-labelledby":de,tabIndex:se?-1:void 0,...b,ref:ce,id:H??S,"data-side":N[`data-side`],"data-align":N[`data-align`],style:{...ee,...N.style},onKeyDown:i.composeEventHandlers(te,ae),onContextMenu:i.composeEventHandlers(ne,oe),onPointerEnter:I?i.composeEventHandlers(h,I.onPointerEnter):h,onPointerLeave:I?i.composeEventHandlers(g,I.onPointerLeave):g,className:t.cn(a.popoverContentClassNames.root,`w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4`,l),children:[(0,y.jsx)(m.PopoverBeak,{ref:j,side:F,style:P,"data-wave-popover-arrow":``,className:a.popoverContentClassNames.beak}),ie?(0,y.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(var(--wave-popup-available-height)-2rem-2px)]`,children:U}):U]})})};M.displayName=`PopoverContent`;var N=Object.assign(A,{Trigger:j,Content:M});exports.Popover=N,exports.PopoverContent=M,exports.PopoverTrigger=j;
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../lib/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useEventCallback.cjs"),s=require("../../hooks/useControllable.cjs"),c=require("../../hooks/useId.cjs"),l=require("../../lib/focus.cjs"),u=require("../../hooks/useMergedRefs.cjs"),ee=require("../../hooks/useIsClient.cjs"),d=require("../../hooks/usePresence.cjs"),f=require("../../hooks/usePopupPosition.cjs"),p=require("../../hooks/useDismiss.cjs"),te=require("../../hooks/useRestoreFocus.cjs"),m=require("../portal/Portal.cjs"),ne=require("../../lib/motion.cjs"),re=require("../../hooks/useFocusBeforeClose.cjs"),h=require("../../hooks/useHoverIntent.cjs"),g=require("../../hooks/useMotion.cjs"),_=require("./Popover.shared.cjs"),v=require("../../hooks/useTriggerElement.cjs"),y=require("../../hooks/useResolvedTarget.cjs"),ie=require("../../hooks/useContextMenuAnchor.cjs");let b=require("react");b=e.__toESM(b,1);let x=require("react/jsx-runtime");var S=b.createContext(null);S.displayName=`PopoverContext`;var C=null;function w(){return C??={open:!1,setOpen:()=>{},contentId:`wave-popover-inert-content`,setCustomContentId:()=>{},triggerId:`wave-popover-inert-trigger`,resolvedTriggerId:void 0,setResolvedTriggerId:()=>{},triggerRef:{current:null},triggerElement:null,triggerElementRef:()=>{},surfaceElementRef:()=>{},arrowRef:{current:null},onTriggerClick:()=>{},onTriggerKeyDown:()=>{},hoverTriggerHandlers:null,hoverSurfaceHandlers:null,contextMode:!1,contextTriggerHandlers:null,onContentContextMenu:()=>{},keyboardContext:!1,onContentKeyDown:()=>{},layerId:`wave-popover-inert-layer`,floatingProps:{"data-side":`bottom`,"data-align":`start`,style:{}},arrowStyles:{},placedSide:`bottom`,fitViewport:!1},C}function T(e){return b.useContext(S)||(n.reportMissingContext(e,`Popover`),w())}function E(e,t){let n=(t??``).split(/\s+/).filter(t=>t&&e.getElementById(t));return n.length>0?n.join(` `):void 0}function D(e,t){if(!e)return t;let n=e.ownerDocument,r=(t?n.getElementById(t):null)??v.getTriggerFocusTarget(e)??e;return E(n,r.getAttribute(`aria-labelledby`))??(r.id||e.id||void 0)}function ae(e,t){return t.split(/\s+/).some(t=>{let n=t?e.getElementById(t):null;return n?n.getAttribute(`aria-label`)?.trim()||n.textContent?.trim()?!0:!!n.querySelector(`[aria-label]:not([aria-label=""]), [alt]:not([alt=""]), [title]:not([title=""])`):!1})}var oe=()=>()=>{};function O(e){return!!e&&typeof e.nodeType==`number`}function k(e){return{get current(){return e()}}}function A(e,t,n){return v.getTriggerFocusTarget(e)??_.getTabbableThrough(e,t,n)}var j=({open:e,defaultOpen:t,onOpenChange:r,side:i=`bottom`,align:a=`start`,ignoreOutsideRefs:d,openOnHover:m=!1,openDelay:ne=250,closeDelay:g=500,openOnContext:C=!1,target:w,positioning:T,children:E})=>{let{target:D,pending:ae}=y.usePopupTarget(`Popover`,w,T),[oe,j]=s.useControllable(e,t??!1,r),M=b.useRef(!1),N=o.useEventCallback(e=>{M.current=!1,j(e)}),P=b.useCallback(()=>M.current,[]),se=ee.useIsClient(),F=oe&&se,[I,L]=b.useState(`other`),[R,z]=b.useState(!1),[ce,le]=b.useState(F),B=I;F!==ce&&(le(F),F&&(B=R?`hover`:`other`)),B!==I&&L(B),R&&z(!1);let ue=c.useId(`popover-content`),[de,fe]=b.useState(void 0),pe=de??ue,me=c.useId(`popover-trigger`),[V,H]=b.useState(void 0),[U,he]=b.useState(null),[W,ge]=b.useState(null),G=b.useRef(null),K=b.useRef(null),_e=b.useRef(null),ve=O(D)?D:null,q=b.useRef(null);b.useInsertionEffect(()=>{q.current=ve},[ve]);let{setReference:ye,setFloating:be,floatingProps:J,arrowStyles:xe,side:Se}=f.usePopupPosition({open:F,side:i,align:a,arrowRef:_e,...f.resolvePositioning(T,{offset:8})}),Ce=b.useMemo(()=>ae?{...J,style:{...J.style,visibility:`hidden`}}:J,[ae,J]),we=b.useRef(null),Y=o.useEventCallback(()=>{let e=C?we.current?.current:null;if(e&&l.isConnectedAndFocusable(e))return e;let t=G.current,n=t?v.getTriggerFocusTarget(t):null;if(n)return n;let r=q.current;return r&&l.isConnectedAndFocusable(r)?r:t}),Te=b.useMemo(()=>k(Y),[Y]),Ee=o.useEventCallback(e=>!(e.ctrlKey&&G.current?.contains(e.target))),{layerId:X}=p.useDismiss({open:F,onDismiss:()=>N(!1),refs:C?[K,q,...d??[]]:[K,G,q,...d??[]],anchorRef:Te,kind:`popover`,outsidePress:!C||Ee}),Z=b.useRef(!1),{anchor:De,fromContext:Oe,origin:ke,opener:Q,triggerHandlers:Ae,surfaceHandlers:je}=ie.useContextMenuAnchor({enabled:C,open:F,trigger:W,layerId:X,onOpen:e=>{Z.current=e===`keyboard`,N(!0)},onClose:()=>N(!1)});b.useInsertionEffect(()=>{we.current=Q},[Q]);let Me=v.useTriggerFocusRef(G);te.useRestoreFocus({enabled:F,container:U,triggerRef:C?void 0:Me,finalFocusRef:C?Q:void 0,fallback:Y,onlyIfFocusInside:!0,isHoverClose:P}),re.useFocusBeforeClose({open:F,surfaceRef:K,captureOpener:()=>C?null:Me.current,candidates:e=>[C?Q.current:null,e,Y()]}),b.useLayoutEffect(()=>{F&&(M.current=!1)},[F]);let Ne=u.useMergedRefs(G,ge),Pe=u.useMergedRefs(K,he,be);b.useLayoutEffect(()=>{ye(Oe?De??(W&&(v.getTriggerFocusTarget(W)??W)):D??W)},[De,Oe,D,W,ye]),b.useLayoutEffect(()=>{if(Z.current){if(!F){Z.current=!1;return}U&&(Z.current=!1,l.focusElement(l.getFirstTabbable(U)??U,{preventScroll:!0}))}}),b.useEffect(()=>{m&&C&&n.warnOnce(`Popover:hover-and-context`,"Popover: `openOnHover` is ignored with `openOnContext`: a context popover opens on a right click, Shift+F10 or the ContextMenu key, not on hover.")},[m,C]);let $=m&&!C,Fe=o.useEventCallback(()=>B===`hover`&&!_.isFocusInSurfaceTree(K.current,X)),{triggerHandlers:Ie,surfaceHandlers:Le,cancel:Re}=h.useHoverIntent({enabled:$,open:F,openDelay:ne,closeDelay:g,trigger:W,surface:U,onOpen:()=>{z(!0),N(!0)},onClose:()=>{M.current=!0,j(!1)},canClose:Fe}),ze=o.useEventCallback(()=>{Re(),F&&B===`hover`?L(`other`):N(e=>!e)}),Be=o.useEventCallback(()=>{let e=G.current,t=C?Q.current:null;return t&&e?.contains(t)?t:e??q.current}),Ve=b.useMemo(()=>k(Be),[Be]),He=o.useEventCallback(e=>{if(e.key!==`Tab`||e.shiftKey||!F)return;if(C){let t=Be();if(!t||e.target!==(v.getTriggerFocusTarget(t)??t))return}let t=K.current,n=t?l.getFirstTabbable(t):null;n&&(e.preventDefault(),n.focus())}),Ue=_.usePopoverTabOrder({enabled:F,surface:U,anchorRef:Ve,getPreviousStop:A}),We=Oe&&ke===`keyboard`,Ge=b.useMemo(()=>({open:F,setOpen:N,contentId:pe,setCustomContentId:fe,triggerId:me,resolvedTriggerId:V,setResolvedTriggerId:H,triggerRef:G,triggerElement:W,triggerElementRef:Ne,surfaceElementRef:Pe,arrowRef:_e,onTriggerClick:ze,onTriggerKeyDown:He,hoverTriggerHandlers:$?Ie:null,hoverSurfaceHandlers:$?Le:null,contextMode:C,contextTriggerHandlers:C?Ae:null,onContentContextMenu:je.onContextMenu,keyboardContext:We,onContentKeyDown:Ue,layerId:X,floatingProps:Ce,arrowStyles:xe,placedSide:Se,fitViewport:T?.fitViewport===!0}),[F,N,pe,me,V,W,Ne,Pe,ze,He,$,Ie,Le,C,Ae,je,We,Ue,X,Ce,xe,Se,T?.fitViewport]);return(0,x.jsx)(S.Provider,{value:Ge,children:E})};j.displayName=`Popover`;var M=({children:e,asChild:t,id:n,onClick:r,onKeyDown:a,onContextMenu:o,onPointerEnter:s,onPointerMove:c,onPointerLeave:l,ref:ee,...d})=>{let{open:f,contentId:p,triggerId:te,triggerElementRef:m,setResolvedTriggerId:ne,onTriggerClick:re,onTriggerKeyDown:h,hoverTriggerHandlers:g,contextMode:_,contextTriggerHandlers:y}=T(`Popover.Trigger`),ie=u.useMergedRefs(ee,m),b={...d,id:n??te,"aria-haspopup":`dialog`,"aria-expanded":!_&&f,"aria-controls":f&&!_?p:void 0,onClick:i.composeEventHandlers(r,_?void 0:re),onKeyDown:i.composeEventHandlers(a,y?i.composeEventHandlers(y.onKeyDown,h):h),onContextMenu:y?i.composeEventHandlers(o,y.onContextMenu):o,onPointerEnter:g?i.composeEventHandlers(s,g.onPointerEnter):s,onPointerMove:g?i.composeEventHandlers(c,g.onPointerMove):c,onPointerLeave:g?i.composeEventHandlers(l,g.onPointerLeave):l,ref:ie};return v.useTriggerElement(e,b,{componentName:`Popover.Trigger`,asChild:t,onResolvedId:ne,omitStateAria:_})};M.displayName=`PopoverTrigger`;var N=({children:e,title:o,id:s,className:l,style:ee,"aria-label":f,"aria-labelledby":p,onKeyDown:te,onContextMenu:re,onPointerEnter:h,onPointerLeave:v,motion:y,ref:ie,...S})=>{let{open:C,contentId:w,setCustomContentId:E,resolvedTriggerId:O,triggerRef:k,triggerElement:A,surfaceElementRef:j,arrowRef:M,layerId:N,floatingProps:P,arrowStyles:se,placedSide:F,fitViewport:I,onContentKeyDown:L,hoverSurfaceHandlers:R,contextMode:z,onContentContextMenu:ce,keyboardContext:le}=T(`Popover.Content`),B=c.useId(`popover-title`),{isMounted:ue,ref:de,presenceProps:fe}=d.usePresence(C,{appear:!0}),pe=g.useMotionClasses(y,ne.popupMotion),me=u.useMergedRefs(ie,j,de),V=r.slotRendersContent(o),H=p===void 0&&!f&&!V,U=C&&H&&!z,he=b.useCallback(e=>{if(!U||!A||typeof MutationObserver>`u`)return oe();let t=new MutationObserver(e);return t.observe(A,{attributes:!0,attributeFilter:[`id`,`aria-labelledby`],childList:!0,subtree:!0}),()=>t.disconnect()},[U,A]),W=b.useSyncExternalStore(he,()=>U?D(A,O):void 0,()=>U?O:void 0),ge=p??(f?void 0:V?B:W),G=s||void 0;if(b.useEffect(()=>(E(G),()=>E(void 0)),[G,E]),b.useEffect(()=>{C&&H&&z&&n.isDev&&n.warnOnce(`Popover.Content:name`,"Popover.Content: the popover has no accessible name. A context popover (openOnContext) is not named by its region: pass `title`, `aria-label` or `aria-labelledby`.")},[C,H,z]),b.useEffect(()=>{if(!U||!n.isDev)return;let e=k.current;if(!e){n.warnOnce(`Popover.Content:name`,"Popover.Content: the popover has no accessible name. Pass `title`, `aria-label` or `aria-labelledby`, or open it from a Popover.Trigger.");return}let t=D(e,O);t?ae(e.ownerDocument,t)||n.warnOnce(`Popover.Content:trigger-name`,"Popover.Content: the popover is named by its trigger, but the trigger has no text to name it (an icon-only trigger needs `aria-label`, or `aria-labelledby` pointing at text), so the popover has no accessible name. Name the trigger, or pass `title`, `aria-label` or `aria-labelledby`."):n.warnOnce(`Popover.Content:trigger-id`,"Popover.Content: the popover is named by its trigger, but the trigger element has no `id` (a render-prop child of Popover.Trigger must spread the `id` it receives), so the popover has no accessible name. Spread every trigger prop onto the element, or pass `title`, `aria-label` or `aria-labelledby`.")},[U,O,k,W]),!ue)return null;let K=(0,x.jsxs)(x.Fragment,{children:[V&&(0,x.jsx)(`h2`,{id:B,className:t.cn(a.popoverContentClassNames.title,`mb-2 text-subtitle-2 font-semibold`),children:o}),e]});return(0,x.jsx)(m.Portal,{layerId:N,children:(0,x.jsxs)(`div`,{role:`dialog`,"aria-label":f,"aria-labelledby":ge,tabIndex:le?-1:void 0,...S,...fe,ref:me,id:G??w,"data-state":C?`open`:`closed`,"data-side":P[`data-side`],"data-align":P[`data-align`],style:{...ee,...P.style},onKeyDown:i.composeEventHandlers(te,L),onContextMenu:i.composeEventHandlers(re,ce),onPointerEnter:R?i.composeEventHandlers(h,R.onPointerEnter):h,onPointerLeave:R?i.composeEventHandlers(v,R.onPointerLeave):v,className:t.cn(a.popoverContentClassNames.root,`w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4`,pe,l),children:[(0,x.jsx)(_.PopoverBeak,{ref:M,side:F,style:se,"data-wave-popover-arrow":``,className:a.popoverContentClassNames.beak}),I?(0,x.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(var(--wave-popup-available-height)-2rem-2px)]`,children:K}):K]})})};N.displayName=`PopoverContent`;var P=Object.assign(j,{Trigger:M,Content:N});exports.Popover=P,exports.PopoverContent=N,exports.PopoverTrigger=M;
|
|
2
2
|
//# sourceMappingURL=Popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.cjs","names":["React","getTriggerFocusTarget","getTabbableThrough","usePopupTarget","useControllable","useEventCallback","useIsClient","useId","usePopupPosition","resolvePositioning","isConnectedAndFocusable","useDismiss","useContextMenuAnchor","useTriggerFocusRef","useMergedRefs","getFirstTabbable","isFocusInSurfaceTree","useHoverIntent","usePopoverTabOrder","composeEventHandlers","useTriggerElement","slotRendersContent","isDev","_Fragment","cn","popoverContentClassNames","Portal","PopoverBeak","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_focus","require_useMergedRefs","require_useIsClient","require_usePopupPosition","require_useDismiss","require_useRestoreFocus","require_Portal","require_useHoverIntent","require_Popover_shared","require_useTriggerElement","require_useResolvedTarget","require_useContextMenuAnchor","react","react_jsx_runtime","PopoverContext","inertContext","getInertContext","usePopoverContext","componentName","presentIds","present","ids","id","doc","findTriggerLabelId","trigger","resolvedId","named","referencesText","el","subscribeNothing","isElementTarget","target","createResolvedRef","resolve","getPopoverPreviousStop","anchor","surface","order","PopoverRoot","openProp","targetProp","targetPending","positioning","openState","setOpen","defaultOpen","onOpenChange","hoverCloseRef","requestOpen","next","isHoverClose","isClient","open","openReason","setOpenReason","hoverRequested","setHoverRequested","previousOpen","setPreviousOpen","reason","generatedContentId","customContentId","setCustomContentId","contentId","triggerId","resolvedTriggerId","setResolvedTriggerId","setSurface","triggerElement","setTriggerElement","triggerRef","surfaceRef","arrowRef","targetElement","targetRef","positionedProps","placedSide","floatingProps","contextOpenerRef","resolveFocusTarget","gestureOpener","openOnContext","triggerTarget","targetEl","focusTargetRef","isOutsidePress","event","ignoreOutsideRefs","focusContentRef","contextAnchor","contextOrigin","contextOpener","contextTriggerHandlers","contextSurfaceHandlers","origin","triggerFocusRef","triggerElementRef","surfaceElementRef","setFloating","setReference","fromContext","openOnHover","hoverEnabled","canHoverClose","layerId","hoverTriggerHandlers","hoverSurfaceHandlers","cancelHover","onTriggerClick","current","resolveTabAnchor","tabAnchorRef","onTriggerKeyDown","surfaceElement","first","onContentKeyDown","keyboardContext","context","arrowStyles","PopoverTrigger","idProp","rest","hover","gesture","elementRef","ref","triggerProps","contextMode","onClick","onKeyDown","onContextMenu","onPointerEnter","onPointerMove","onPointerLeave","children","PopoverContent","ariaLabel","ariaLabelledBy","titleId","hasTitle","title","unnamed","checkTrigger","subscribeTrigger","observer","onChange","triggerLabelId","labelledBy","customId","labelIds","titleAndChildren","style","onContentContextMenu","className","fitViewport","Popover"],"sources":["../../../src/components/overlays/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { popoverContentClassNames } from '../../lib/classNames';\nimport { isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport { slotRendersContent } from '../../lib/slot';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { focusElement, getFirstTabbable, isConnectedAndFocusable } from '../../lib/focus';\nimport type {\n PopupAlign,\n PopupPositioning,\n PopupSide,\n PopupTarget,\n PopupTargetInput,\n} from '../../lib/types';\nimport { usePopupTarget } from '../../hooks/useResolvedTarget';\nimport { useId } from '../../hooks/useId';\nimport { useControllable, type SetValue } from '../../hooks/useControllable';\nimport { useContextMenuAnchor, type ContextMenuAnchor } from '../../hooks/useContextMenuAnchor';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport { useHoverIntent, type HoverIntent } from '../../hooks/useHoverIntent';\nimport { useRestoreFocus } from '../../hooks/useRestoreFocus';\nimport { resolvePositioning, usePopupPosition } from '../../hooks/usePopupPosition';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport {\n getTriggerFocusTarget,\n useTriggerElement,\n useTriggerFocusRef,\n} from '../../hooks/useTriggerElement';\nimport { Portal } from '../portal/Portal';\nimport {\n getTabbableThrough,\n isFocusInSurfaceTree,\n PopoverBeak,\n usePopoverTabOrder,\n type PopoverPhysicalSide,\n} from './Popover.shared';\n\n/** Properties for the Popover component. */\nexport interface PopoverProps {\n /**\n * Controlled open state of the popover. The content renders only in the browser: an open\n * popover is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The content renders only in the browser: a\n * popover open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the requested open state when it differs from the current one: a trigger click,\n * Escape and an outside press; the hover opening and closing of `openOnHover`; and, with\n * `openOnContext`, a context gesture (a right click, a macOS Ctrl+click, Shift+F10 or the\n * ContextMenu key), a right click outside, and a scroll that moves the row it opened at.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Side of the trigger the content opens on. `start`/`end` follow the writing direction. The\n * content flips to the opposite side when there is not enough room.\n * @default 'bottom'\n */\n side?: PopupSide;\n /** Alignment of the content along the trigger's edge.\n * @default 'start'\n */\n align?: PopupAlign;\n /**\n * Elements outside the popover whose presses must not dismiss it, e.g. an external toggle\n * button that opens and closes the popover itself.\n */\n ignoreOutsideRefs?: ReadonlyArray<React.RefObject<HTMLElement | null>>;\n /**\n * Open the popover when a mouse pointer rests on its trigger (a hover card), and close it once\n * the pointer has been off the trigger and the content for `closeDelay` while focus is not\n * inside the content. A popover opened by hover does not take focus, and its hover close leaves\n * focus where it is; a click on its trigger keeps it open and keeps focus where it is (a second\n * click closes it, as without hover). After Escape or an outside press it does not reopen until\n * the pointer has left the trigger. Touch and pen never open it by hover, and an `aria-disabled`\n * trigger never opens. A triangle between the trigger and the content keeps it open while the\n * pointer moves diagonally into it. Ignored with `openOnContext` (development warning).\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Milliseconds a hovering mouse pointer rests on the trigger before the popover opens (mouse\n * hover only).\n * @default 250\n */\n openDelay?: number;\n /**\n * Milliseconds before a hover-opened popover closes once the mouse pointer has left it and its\n * trigger (Fluent's `mouseLeaveDelay`; mouse hover only).\n * @default 500\n */\n closeDelay?: number;\n /**\n * Make `Popover.Trigger` a context-menu region (a list, a row, a canvas): a right click (a\n * Ctrl+click on macOS, a long press where the browser reports one) opens the popover at the\n * pointer and leaves focus where it is (Tab from that element enters the content), and\n * Shift+F10 or the ContextMenu key opens it at the focused element inside the region and moves\n * focus into the content, instead of a click. Focus returns to the element that had it. The\n * browser's context menu is suppressed there and inside the content, except in text fields\n * inside the region, which keep it. A press elsewhere, a right click outside or a scroll that\n * moves the row it opened at (the one under the pointer, or the focused one), as a scroll of\n * the region's own content does, closes it. The trigger gets no `aria-haspopup`/`aria-expanded`\n * (it is not a popover button; with a render-prop child, do not spread them): name the content\n * with `title`, `aria-label` or `aria-labelledby`, and consider `aria-keyshortcuts=\"Shift+F10\"`\n * on the region. iOS Safari reports no long press. `openOnHover` is ignored with it.\n * @default false\n */\n openOnContext?: boolean;\n /**\n * Where to place the content instead of next to `Popover.Trigger`: an element or a\n * `VirtualElement` (a rectangle, such as a point; an inline object is fine). With a controlled\n * `open`, a popover with a `target` needs no trigger; name it with `title`, `aria-label` or\n * `aria-labelledby`, and give a toggle button you use as the target `aria-haspopup=\"dialog\"`,\n * `aria-expanded` and `aria-controls` yourself. A press on a target element does not close the\n * popover, and Tab from it enters the content when there is no trigger. Hold the element in\n * state, or pass a ref object (read after each render of the popover, so an element that attaches without it rendering is noticed on its next render). A popover\n * opened by `openOnContext` is placed at the gesture instead.\n */\n target?: PopupTargetInput;\n /**\n * Advanced positioning (Fluent's `positioning`): `offset` (px from the anchor), `fitViewport`\n * (limit the content to the space the viewport leaves; Fluent's `autoSize`), `matchReferenceWidth`,\n * `fallbackPlacements` (tried in order when the requested side has no room) and `target` (used\n * when the `target` prop is not set). `side` and `align` stay separate props.\n * @default `{ offset: 8 }`\n */\n positioning?: PopupPositioning;\n /** `Popover.Trigger` and `Popover.Content`. */\n children: React.ReactNode;\n}\n\n/**\n * Props the trigger puts on its element; a render-prop child of `Popover.Trigger` receives them\n * (spread them onto the element that opens the popover). With `openOnContext` the element is a\n * context-menu region, not a popover button: do not spread `aria-haspopup`, `aria-expanded` and\n * `aria-controls` onto it (`aria-expanded` is then always `false`, `aria-controls` is absent and\n * `onClick` does nothing); spread ones are removed after each commit, with a development warning.\n */\nexport type PopoverTriggerChildProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & {\n id: string;\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The content's id, only while the popover is open (never with `openOnContext`). */\n 'aria-controls': string | undefined;\n onClick: React.MouseEventHandler<HTMLElement>;\n /**\n * Moves Tab from the open trigger into the portaled content (which lives at the end of the\n * document), so the keyboard order follows the trigger.\n */\n onKeyDown: React.KeyboardEventHandler<HTMLElement>;\n ref: React.RefCallback<HTMLElement>;\n};\n\n/** Properties for the PopoverTrigger sub-component. */\nexport interface PopoverTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that toggles the popover (its props are merged onto it), or a render function\n * that receives the trigger props.\n */\n children: React.ReactNode | ((props: PopoverTriggerChildProps) => React.ReactNode);\n /**\n * `false` renders the 0.4 wrapper `<span>` carrying the trigger props around the children\n * instead of merging them onto the child. `aria-haspopup`, `aria-expanded` and `aria-controls`,\n * which a generic element cannot carry, go to the first element in the tab order inside the\n * span. A render-prop child ignores `asChild` and receives every prop.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Properties for the PopoverContent sub-component. */\nexport interface PopoverContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Content to render inside the popover. */\n children: React.ReactNode;\n /**\n * Visible heading rendered at the top of the popover; it names the dialog. Without `title`,\n * `aria-label` or `aria-labelledby`, the popover is labelled by its trigger, except with\n * `openOnContext` (a region's text is no name), where it needs one of them.\n */\n title?: React.ReactNode;\n /** Id of the surface; the trigger's `aria-controls` follows it. Defaults to a generated id. */\n id?: string;\n /** Ref to the popover surface. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: SetValue<boolean>;\n /** The content's id: the consumer's `Popover.Content` id when given, else a generated one. */\n contentId: string;\n /** `Popover.Content` reports the consumer's `id` so the trigger's `aria-controls` follows it. */\n setCustomContentId: (id: string | undefined) => void;\n triggerId: string;\n /** The id the trigger element ended up with (the child's own id wins). */\n resolvedTriggerId: string | undefined;\n setResolvedTriggerId: (id: string) => void;\n triggerRef: React.RefObject<HTMLElement | null>;\n /** The trigger element as state (read during render, e.g. to check the labelling id). */\n triggerElement: HTMLElement | null;\n /** Ref callback for the trigger element: focus-restore target and positioning anchor. */\n triggerElementRef: React.RefCallback<HTMLElement>;\n /** Ref callback for the surface: dismissal, focus restore and positioning. */\n surfaceElementRef: React.RefCallback<HTMLElement>;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n /** The trigger's click: toggles the popover, or pins one that hover opened (keeps it open). */\n onTriggerClick: () => void;\n /** Tab from the open trigger enters the portaled content. */\n onTriggerKeyDown: React.KeyboardEventHandler<HTMLElement>;\n /** Hover opening (`openOnHover`): composed onto the trigger; `null` without it. */\n hoverTriggerHandlers: HoverIntent['triggerHandlers'] | null;\n /** Hover opening (`openOnHover`): composed onto the content; `null` without it. */\n hoverSurfaceHandlers: HoverIntent['surfaceHandlers'] | null;\n /** `openOnContext`: the trigger is a context-menu region, not a popover button. */\n contextMode: boolean;\n /** Context gestures (`openOnContext`): composed onto the trigger; `null` without it. */\n contextTriggerHandlers: ContextMenuAnchor['triggerHandlers'] | null;\n /** Composed onto the content: suppresses the browser's context menu there in context mode. */\n onContentContextMenu: React.MouseEventHandler<HTMLElement>;\n /** Opened by a keyboard context gesture: the content takes focus (itself when nothing can). */\n keyboardContext: boolean;\n /** Tab past the content's edges continues around the trigger in the page order. */\n onContentKeyDown: React.KeyboardEventHandler<HTMLElement>;\n layerId: string;\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n arrowStyles: React.CSSProperties;\n placedSide: PopoverPhysicalSide;\n /** `positioning.fitViewport`: the content scrolls inside the border when it is limited. */\n fitViewport: boolean;\n}\n\nconst PopoverContext = React.createContext<PopoverContextValue | null>(null);\nPopoverContext.displayName = 'PopoverContext';\n\nlet inertContext: PopoverContextValue | null = null;\n\n/** Production fallback for a misplaced sub-component: a closed popover that does nothing. */\nfunction getInertContext(): PopoverContextValue {\n inertContext ??= {\n open: false,\n setOpen: () => {},\n contentId: 'wave-popover-inert-content',\n setCustomContentId: () => {},\n triggerId: 'wave-popover-inert-trigger',\n resolvedTriggerId: undefined,\n setResolvedTriggerId: () => {},\n triggerRef: { current: null },\n triggerElement: null,\n triggerElementRef: () => {},\n surfaceElementRef: () => {},\n arrowRef: { current: null },\n onTriggerClick: () => {},\n onTriggerKeyDown: () => {},\n hoverTriggerHandlers: null,\n hoverSurfaceHandlers: null,\n contextMode: false,\n contextTriggerHandlers: null,\n onContentContextMenu: () => {},\n keyboardContext: false,\n onContentKeyDown: () => {},\n layerId: 'wave-popover-inert-layer',\n floatingProps: { 'data-side': 'bottom', 'data-align': 'start', style: {} },\n arrowStyles: {},\n placedSide: 'bottom',\n fitViewport: false,\n };\n return inertContext;\n}\n\nfunction usePopoverContext(componentName: string): PopoverContextValue {\n const context = React.useContext(PopoverContext);\n if (context) return context;\n reportMissingContext(componentName, 'Popover');\n return getInertContext();\n}\n\n/** The ids of an id list that exist in `doc`, joined; `undefined` when none does. */\nfunction presentIds(doc: Document, ids: string | null): string | undefined {\n const present = (ids ?? '').split(/\\s+/).filter((id) => id && doc.getElementById(id));\n return present.length > 0 ? present.join(' ') : undefined;\n}\n\n/**\n * The ids `Popover.Content`'s default `aria-labelledby` points at, so the popover gets its\n * trigger's name. The named element is the one with the resolved id when the document has it,\n * otherwise the trigger's focus target (for example the Button inside a Tooltip that sits between\n * `Popover.Trigger` and the Button, whose own id wins), else the trigger element. When that\n * element is itself named through `aria-labelledby` (an icon-only Button inside\n * `Tooltip relationship=\"label\"`, or a button labelled by a visible label), its label ids are\n * returned: a name computation does not follow a second `aria-labelledby` hop, so pointing at the\n * button would leave the popover unnamed. Otherwise the element's id, else the trigger's own.\n * `undefined` when none of them has an id (a render-prop child that does not spread `id`), so the\n * reference never dangles; only ids present in the document are returned. Before the trigger\n * element is known, the resolved id.\n */\nfunction findTriggerLabelId(\n trigger: HTMLElement | null,\n resolvedId: string | undefined,\n): string | undefined {\n if (!trigger) return resolvedId;\n const doc = trigger.ownerDocument;\n const named =\n (resolvedId ? doc.getElementById(resolvedId) : null) ??\n getTriggerFocusTarget(trigger) ??\n trigger;\n return (\n presentIds(doc, named.getAttribute('aria-labelledby')) ?? (named.id || trigger.id || undefined)\n );\n}\n\n/**\n * Whether one of the elements an id list references has text for a name: its own `aria-label`\n * or text, or a descendant's `aria-label`, `alt` or `title`. Deliberately lenient (it only drives\n * a development warning): content that assistive technology ignores still counts as text.\n */\nfunction referencesText(doc: Document, ids: string): boolean {\n return ids.split(/\\s+/).some((id) => {\n const el = id ? doc.getElementById(id) : null;\n if (!el) return false;\n if (el.getAttribute('aria-label')?.trim() || el.textContent?.trim()) return true;\n return !!el.querySelector(\n '[aria-label]:not([aria-label=\"\"]), [alt]:not([alt=\"\"]), [title]:not([title=\"\"])',\n );\n });\n}\n\nconst subscribeNothing = (): (() => void) => () => {};\n\n/** Why an open popover opened: hover (it closes by hover), or anything else (it is pinned). */\ntype OpenReason = 'hover' | 'other';\n\n/** Whether a `target` is an element rather than a VirtualElement (duck typed, any realm). */\nfunction isElementTarget(target: PopupTarget | undefined): target is HTMLElement {\n return !!target && typeof (target as Partial<Node>).nodeType === 'number';\n}\n\n/** A read-only ref whose `current` is `resolve()` at the time it is read (event time). */\nfunction createResolvedRef(resolve: () => HTMLElement | null): React.RefObject<HTMLElement | null> {\n return {\n get current() {\n return resolve();\n },\n };\n}\n\n/**\n * The content's previous stop: the focus target of the element it follows (the trigger, the row of\n * a context gesture, a `target` element), else the tab stop before that element.\n */\nfunction getPopoverPreviousStop(\n anchor: HTMLElement,\n surface: HTMLElement,\n order?: readonly HTMLElement[],\n): HTMLElement | null {\n return getTriggerFocusTarget(anchor) ?? getTabbableThrough(anchor, surface, order);\n}\n\n// A const arrow (like DialogRoot and DrawerRoot): its type can be named in consumers' declaration\n// files, e.g. a story's `satisfies Meta<typeof Popover>` (a function declaration's `typeof` cannot,\n// TS4023).\nconst PopoverRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n side = 'bottom',\n align = 'start',\n ignoreOutsideRefs,\n openOnHover = false,\n openDelay = 250,\n closeDelay = 500,\n openOnContext = false,\n target: targetProp,\n positioning,\n children,\n}: PopoverProps) => {\n const { target, pending: targetPending } = usePopupTarget('Popover', targetProp, positioning);\n const [openState, setOpen] = useControllable(openProp, defaultOpen ?? false, onOpenChange);\n // A hover close in flight (written in handlers, read when the popover closes): set when the hover\n // intent asks to close, so that close moves no focus even when a controlled parent applies it in\n // a later render (a transition). Every other request to open or close forgets it, and so does\n // the next opening.\n const hoverCloseRef = React.useRef(false);\n const requestOpen = useEventCallback<SetValue<boolean>>((next) => {\n hoverCloseRef.current = false;\n setOpen(next);\n });\n const isHoverClose = React.useCallback(() => hoverCloseRef.current, []);\n // The content lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the popover reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe content that is not there.\n const isClient = useIsClient();\n const open = openState && isClient;\n\n // Why the popover opened, decided when it opens (C-HOOKS: a previous-value state): `hover` when\n // hover asked for that open (a request consumed by the next render, so an open that a\n // controlled parent refused does not linger), else `other` (click, keys, a context gesture, a\n // controlled open).\n const [openReason, setOpenReason] = React.useState<OpenReason>('other');\n const [hoverRequested, setHoverRequested] = React.useState(false);\n const [previousOpen, setPreviousOpen] = React.useState(open);\n let reason = openReason;\n if (open !== previousOpen) {\n setPreviousOpen(open);\n if (open) reason = hoverRequested ? 'hover' : 'other';\n }\n if (reason !== openReason) setOpenReason(reason);\n if (hoverRequested) setHoverRequested(false);\n\n const generatedContentId = useId('popover-content');\n const [customContentId, setCustomContentId] = React.useState<string | undefined>(undefined);\n const contentId = customContentId ?? generatedContentId;\n const triggerId = useId('popover-trigger');\n const [resolvedTriggerId, setResolvedTriggerId] = React.useState<string | undefined>(undefined);\n const [surface, setSurface] = React.useState<HTMLElement | null>(null);\n const [triggerElement, setTriggerElement] = React.useState<HTMLElement | null>(null);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const surfaceRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLDivElement | null>(null);\n // A `target` element (not a VirtualElement) belongs to the dismiss layer, anchors the keyboard\n // order without a trigger and can take focus back.\n const targetElement = isElementTarget(target) ? target : null;\n const targetRef = React.useRef<HTMLElement | null>(null);\n React.useInsertionEffect(() => {\n targetRef.current = targetElement;\n }, [targetElement]);\n\n // Destructured: react-hooks/refs treats an object whose member is passed to `ref` as a ref.\n const {\n setReference,\n setFloating,\n floatingProps: positionedProps,\n arrowStyles,\n side: placedSide,\n } = usePopupPosition({\n open,\n side,\n align,\n arrowRef,\n ...resolvePositioning(positioning, { offset: 8 }),\n });\n // A ref target that holds no element yet keeps the popup hidden (as TeachingPopover's is).\n const floatingProps = React.useMemo(\n () =>\n targetPending\n ? { ...positionedProps, style: { ...positionedProps.style, visibility: 'hidden' as const } }\n : positionedProps,\n [targetPending, positionedProps],\n );\n\n // The one focus resolver: the focus-return fallback and the layer's anchor (where a surface\n // opened from the content restores focus once its opener is gone). In context mode the element\n // focused at the gesture (the row) first; then the trigger's focus target (for a wrapper span,\n // the element inside it that carries the state ARIA), a focusable `target` element, and the\n // trigger itself. The context hook's opener ref is stable; it is filled in once the hook runs.\n const contextOpenerRef = React.useRef<React.RefObject<HTMLElement | null> | null>(null);\n const resolveFocusTarget = useEventCallback((): HTMLElement | null => {\n const gestureOpener = openOnContext ? contextOpenerRef.current?.current : null;\n if (gestureOpener && isConnectedAndFocusable(gestureOpener)) return gestureOpener;\n const trigger = triggerRef.current;\n const triggerTarget = trigger ? getTriggerFocusTarget(trigger) : null;\n if (triggerTarget) return triggerTarget;\n const targetEl = targetRef.current;\n if (targetEl && isConnectedAndFocusable(targetEl)) return targetEl;\n return trigger;\n });\n const focusTargetRef = React.useMemo(\n () => createResolvedRef(resolveFocusTarget),\n [resolveFocusTarget],\n );\n\n // In context mode the region is no part of the layer: a primary press elsewhere in it closes the\n // popover like any outside press. A Ctrl+press inside it is a macOS context click, whose\n // `contextmenu` moves the popover instead.\n const isOutsidePress = useEventCallback(\n (event: PointerEvent | MouseEvent) =>\n !(event.ctrlKey && triggerRef.current?.contains(event.target as Node)),\n );\n const { layerId } = useDismiss({\n open,\n onDismiss: () => requestOpen(false),\n refs: openOnContext\n ? [surfaceRef, targetRef, ...(ignoreOutsideRefs ?? [])]\n : [surfaceRef, triggerRef, targetRef, ...(ignoreOutsideRefs ?? [])],\n anchorRef: focusTargetRef,\n kind: 'popover',\n outsidePress: openOnContext ? isOutsidePress : true,\n });\n\n // A keyboard context gesture moves focus into the content, once it is there (see below).\n const focusContentRef = React.useRef(false);\n const {\n anchor: contextAnchor,\n fromContext,\n origin: contextOrigin,\n opener: contextOpener,\n triggerHandlers: contextTriggerHandlers,\n surfaceHandlers: contextSurfaceHandlers,\n } = useContextMenuAnchor({\n enabled: openOnContext,\n open,\n trigger: triggerElement,\n layerId,\n onOpen: (origin) => {\n focusContentRef.current = origin === 'keyboard';\n requestOpen(true);\n },\n onClose: () => requestOpen(false),\n });\n React.useInsertionEffect(() => {\n contextOpenerRef.current = contextOpener;\n }, [contextOpener]);\n\n // Focus returns to the element that takes focus for the trigger, as Shift+Tab from the content\n // does, when the popover closes while focus is inside it or on `<body>`; a hover close restores\n // only focus inside, so it never moves focus. In context mode it returns to the element focused\n // at the gesture (the row): the region is no restore target of its own (as `triggerRef` it\n // would be taken for the opener).\n const triggerFocusRef = useTriggerFocusRef(triggerRef);\n useRestoreFocus({\n enabled: open,\n container: surface,\n triggerRef: openOnContext ? undefined : triggerFocusRef,\n finalFocusRef: openOnContext ? contextOpener : undefined,\n fallback: resolveFocusTarget,\n onlyIfFocusInside: true,\n isHoverClose,\n });\n React.useLayoutEffect(() => {\n if (open) hoverCloseRef.current = false;\n }, [open]);\n\n const triggerElementRef = useMergedRefs<HTMLElement>(triggerRef, setTriggerElement);\n const surfaceElementRef = useMergedRefs<HTMLElement>(surfaceRef, setSurface, setFloating);\n\n // The positioning anchor: the context gesture (the pointer, or the focused row, else the\n // trigger's focus target, else the trigger) while the popover was opened by one, else `target`,\n // else the trigger. A new VirtualElement on every render repositions without a render loop.\n React.useLayoutEffect(() => {\n if (fromContext) {\n setReference(\n contextAnchor ??\n (triggerElement && (getTriggerFocusTarget(triggerElement) ?? triggerElement)),\n );\n } else {\n setReference(target ?? triggerElement);\n }\n }, [contextAnchor, fromContext, target, triggerElement, setReference]);\n\n // After the commit that has the surface (and after a gesture while open): focus its first\n // tabbable element, else the surface itself (it then has `tabIndex={-1}`). A gesture whose open\n // was refused leaves nothing pending. No deps: every commit, since a gesture always renders.\n React.useLayoutEffect(() => {\n if (!focusContentRef.current) return;\n if (!open) {\n focusContentRef.current = false;\n return;\n }\n if (!surface) return;\n focusContentRef.current = false;\n focusElement(getFirstTabbable(surface) ?? surface, { preventScroll: true });\n });\n\n React.useEffect(() => {\n if (!openOnHover || !openOnContext) return;\n warnOnce(\n 'Popover:hover-and-context',\n 'Popover: `openOnHover` is ignored with `openOnContext`: a context popover opens on a right click, Shift+F10 or the ContextMenu key, not on hover.',\n );\n }, [openOnHover, openOnContext]);\n\n // Hover opening: a popover that hover opened closes by hover until a click on the trigger pins\n // it; focus inside the content (or a layer opened from it) keeps it open, focus on the trigger\n // does not.\n const hoverEnabled = openOnHover && !openOnContext;\n const canHoverClose = useEventCallback(\n () => reason === 'hover' && !isFocusInSurfaceTree(surfaceRef.current, layerId),\n );\n const {\n triggerHandlers: hoverTriggerHandlers,\n surfaceHandlers: hoverSurfaceHandlers,\n cancel: cancelHover,\n } = useHoverIntent({\n enabled: hoverEnabled,\n open,\n openDelay,\n closeDelay,\n trigger: triggerElement,\n surface,\n onOpen: () => {\n setHoverRequested(true);\n requestOpen(true);\n },\n onClose: () => {\n // Before the request: a parent may apply it synchronously (flushSync).\n hoverCloseRef.current = true;\n setOpen(false);\n },\n canClose: canHoverClose,\n });\n\n const onTriggerClick = useEventCallback(() => {\n cancelHover();\n if (open && reason === 'hover') setOpenReason('other');\n else requestOpen((current) => !current);\n });\n\n // The element the content follows in the keyboard order: in context mode the element focused\n // at the gesture when it lies inside the region, else the trigger, else a `target` element.\n // With neither (a VirtualElement target and no trigger) the content keeps the portal's place.\n const resolveTabAnchor = useEventCallback((): HTMLElement | null => {\n const trigger = triggerRef.current;\n const gestureOpener = openOnContext ? contextOpener.current : null;\n if (gestureOpener && trigger?.contains(gestureOpener)) return gestureOpener;\n return trigger ?? targetRef.current;\n });\n const tabAnchorRef = React.useMemo(() => createResolvedRef(resolveTabAnchor), [resolveTabAnchor]);\n\n // Keyboard order of the portaled content (it lives at the end of the document), as if it\n // followed the trigger like 0.4's inline content: Tab from the open trigger enters it (here, in\n // the trigger's own `onKeyDown`, which runs before a dialog's focus trap), Tab past its last\n // element continues after the trigger, Shift+Tab from its first element returns to the trigger\n // (the element inside a wrapper span), and Shift+Tab from the element after the trigger enters\n // it at its last element. The end of the page does not visit it a second time where its portal\n // is, and no Tab cycle forms (see usePopoverTabOrder). In a context region only Tab from the\n // element the content follows enters it; Tab on the region's other rows moves on as usual.\n const onTriggerKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Tab' || event.shiftKey || !open) return;\n if (openOnContext) {\n const anchor = resolveTabAnchor();\n if (!anchor || event.target !== (getTriggerFocusTarget(anchor) ?? anchor)) return;\n }\n const surfaceElement = surfaceRef.current;\n const first = surfaceElement ? getFirstTabbable(surfaceElement) : null;\n if (!first) return;\n event.preventDefault();\n first.focus();\n });\n\n const onContentKeyDown = usePopoverTabOrder({\n enabled: open,\n surface,\n anchorRef: tabAnchorRef,\n // Shift+Tab from the content's first element returns to the trigger (the element in a span),\n // or, when nothing in the trigger can take focus, to the tab stop before it.\n getPreviousStop: getPopoverPreviousStop,\n });\n\n const keyboardContext = fromContext && contextOrigin === 'keyboard';\n const context = React.useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen: requestOpen,\n contentId,\n setCustomContentId,\n triggerId,\n resolvedTriggerId,\n setResolvedTriggerId,\n triggerRef,\n triggerElement,\n triggerElementRef,\n surfaceElementRef,\n arrowRef,\n onTriggerClick,\n onTriggerKeyDown,\n hoverTriggerHandlers: hoverEnabled ? hoverTriggerHandlers : null,\n hoverSurfaceHandlers: hoverEnabled ? hoverSurfaceHandlers : null,\n contextMode: openOnContext,\n contextTriggerHandlers: openOnContext ? contextTriggerHandlers : null,\n onContentContextMenu: contextSurfaceHandlers.onContextMenu,\n keyboardContext,\n onContentKeyDown,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n fitViewport: positioning?.fitViewport === true,\n }),\n [\n open,\n requestOpen,\n contentId,\n triggerId,\n resolvedTriggerId,\n triggerElement,\n triggerElementRef,\n surfaceElementRef,\n onTriggerClick,\n onTriggerKeyDown,\n hoverEnabled,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n openOnContext,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n keyboardContext,\n onContentKeyDown,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n positioning?.fitViewport,\n ],\n );\n\n return <PopoverContext.Provider value={context}>{children}</PopoverContext.Provider>;\n};\n\nPopoverRoot.displayName = 'Popover';\n\n/**\n * The element that toggles the popover. Its props are merged onto the single child (no wrapper\n * element): `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), an `id` that\n * labels the content, a composed `onClick` and the ref used as positioning anchor and focus-return\n * target. The child's own `id`, handlers and classes are kept; the live state ARIA always wins.\n * A render function receives the props instead (spread all of them, `id` included: the content is\n * named by it); `asChild={false}` renders the 0.4 wrapper span, and a custom child that neither\n * forwards `ref` nor spreads its props falls back to that span automatically (with a development\n * warning). On the span, the state ARIA goes to the first element in the tab order inside it, and\n * focus returns to that element (to the span when you made it the trigger with a `role` such as\n * `button` and `tabIndex={0}`, or when nothing inside it can take focus).\n *\n * With `openOnHover` a mouse pointer resting on it opens the popover, and a click pins a\n * hover-opened popover instead of closing it. With `openOnContext` it is a context-menu region (a\n * list, a row, a canvas) instead of a button: it receives its `id` and the context-menu and key\n * handlers, but no state ARIA and no click toggle (a render function still receives every prop:\n * do not spread the state ARIA then).\n *\n * A Tooltip goes between the trigger and the button: it passes the trigger's `id` and ARIA on to\n * the button, which the Tooltip also describes.\n *\n * @example\n * <Popover.Trigger>\n * <Tooltip content=\"Narrow the list\">\n * <Button>Filters</Button>\n * </Tooltip>\n * </Popover.Trigger>\n *\n * Also exported as `PopoverTrigger` for React Server Components, which cannot use the dotted\n * `Popover.Trigger` (that needs a client file).\n */\nexport const PopoverTrigger = ({\n children,\n asChild,\n id: idProp,\n onClick,\n onKeyDown,\n onContextMenu,\n onPointerEnter,\n onPointerMove,\n onPointerLeave,\n ref,\n ...rest\n}: PopoverTriggerProps) => {\n const {\n open,\n contentId,\n triggerId,\n triggerElementRef,\n setResolvedTriggerId,\n onTriggerClick,\n onTriggerKeyDown,\n hoverTriggerHandlers: hover,\n contextMode,\n contextTriggerHandlers: gesture,\n } = usePopoverContext('Popover.Trigger');\n const elementRef = useMergedRefs<HTMLElement>(ref, triggerElementRef);\n\n // On a wrapper span (`asChild={false}`, the automatic fallback) useTriggerElement moves the\n // state ARIA onto the first element in the tab order inside it. The hover handlers are there\n // only with `openOnHover`, the context handlers only with `openOnContext`. A context region is\n // no popover button: it gets no state ARIA and no click toggle (useTriggerElement\n // `omitStateAria`), and a render-prop child reads a constant closed state.\n const triggerProps = {\n ...rest,\n id: idProp ?? triggerId,\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': contextMode ? false : open,\n 'aria-controls': open && !contextMode ? contentId : undefined,\n onClick: composeEventHandlers(onClick, contextMode ? undefined : onTriggerClick),\n onKeyDown: composeEventHandlers(\n onKeyDown,\n gesture ? composeEventHandlers(gesture.onKeyDown, onTriggerKeyDown) : onTriggerKeyDown,\n ),\n onContextMenu: gesture\n ? composeEventHandlers(onContextMenu, gesture.onContextMenu)\n : onContextMenu,\n onPointerEnter: hover\n ? composeEventHandlers(onPointerEnter, hover.onPointerEnter)\n : onPointerEnter,\n onPointerMove: hover ? composeEventHandlers(onPointerMove, hover.onPointerMove) : onPointerMove,\n onPointerLeave: hover\n ? composeEventHandlers(onPointerLeave, hover.onPointerLeave)\n : onPointerLeave,\n ref: elementRef,\n } as PopoverTriggerChildProps;\n\n return useTriggerElement(children, triggerProps, {\n componentName: 'Popover.Trigger',\n asChild,\n onResolvedId: setResolvedTriggerId,\n omitStateAria: contextMode,\n });\n};\nPopoverTrigger.displayName = 'PopoverTrigger';\n\n/**\n * The popover surface: a non-modal `role=\"dialog\"` rendered in a portal (so overflow containers\n * never clip it) and positioned next to the trigger with a beak, flipping and shifting to stay in\n * the viewport. It closes on Escape and on a press outside (presses inside nested overlays opened\n * from it count as inside), and focus returns to the trigger when it closes while focus was inside.\n * In the keyboard order it follows the trigger, like inline content: Tab from the open trigger\n * enters it, Tab past its last element continues after the trigger, and Shift+Tab from the element\n * after the trigger enters it at its last element. Tab from the last element of the page moves\n * past it, and Shift+Tab from outside the page reaches the page's last element first, so a lap\n * visits it once. For a trigger outside the tab order (nothing in it can take focus, or\n * `tabIndex={-1}`), Tab from the tab stop before the trigger enters it, and Shift+Tab from its\n * first element returns to the trigger, or to that tab stop when nothing in the trigger can take\n * focus. With no tab stop before the trigger, the content is reached at the end of the page.\n * Named by `title`, `aria-label`/`aria-labelledby`, or else by its trigger: `aria-labelledby`\n * points at the id the trigger element carries in the document, or at the trigger's own label\n * elements when the trigger is named through `aria-labelledby` (an icon-only Button inside\n * `Tooltip relationship=\"label\"`); never at a missing id. A development warning names the problem\n * when the trigger has no id or no text. With `openOnContext` it is never named by the trigger (a\n * region's text is no name): pass `title`, `aria-label` or `aria-labelledby` (a development\n * warning otherwise). A consumer `id` is kept, and the trigger's `aria-controls` follows it. The\n * beak inherits the surface's background and border colors, so a `className` that changes them\n * restyles the beak too.\n *\n * With `openOnContext` it opens at the pointer of a right click, or at the focused row for\n * Shift+F10 and the ContextMenu key, and it follows that row in the keyboard order; with a\n * `target` it is placed at the target and, without a trigger, follows a target element in the\n * keyboard order.\n *\n * Also exported as `PopoverContent` for React Server Components, which cannot use the dotted\n * `Popover.Content` (that needs a client file).\n */\nexport const PopoverContent = ({\n children,\n title,\n id: idProp,\n className,\n style,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n onKeyDown,\n onContextMenu,\n onPointerEnter,\n onPointerLeave,\n ref,\n ...rest\n}: PopoverContentProps) => {\n const {\n open,\n contentId,\n setCustomContentId,\n resolvedTriggerId,\n triggerRef,\n triggerElement,\n surfaceElementRef,\n arrowRef,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n fitViewport,\n onContentKeyDown,\n hoverSurfaceHandlers: hover,\n contextMode,\n onContentContextMenu,\n keyboardContext,\n } = usePopoverContext('Popover.Content');\n const titleId = useId('popover-title');\n const elementRef = useMergedRefs<HTMLDivElement>(ref, surfaceElementRef);\n const hasTitle = slotRendersContent(title);\n const unnamed = ariaLabelledBy === undefined && !ariaLabel && !hasTitle;\n // A context region is no popover button, and its whole text is no name: in context mode the\n // content is never labelled by the trigger.\n const checkTrigger = open && unnamed && !contextMode;\n\n // The trigger's label ids in the document, re-read when the trigger's ids or labels change: a\n // Tooltip between Popover.Trigger and the Button leaves the Button's own id in place (and with\n // `relationship=\"label\"` names it through `aria-labelledby`), and a render-prop child may not\n // spread `id` at all — never point aria-labelledby at an id that is not there.\n const subscribeTrigger = React.useCallback(\n (onChange: () => void) => {\n if (!checkTrigger || !triggerElement || typeof MutationObserver === 'undefined') {\n return subscribeNothing();\n }\n const observer = new MutationObserver(onChange);\n observer.observe(triggerElement, {\n attributes: true,\n attributeFilter: ['id', 'aria-labelledby'],\n childList: true,\n subtree: true,\n });\n return () => observer.disconnect();\n },\n [checkTrigger, triggerElement],\n );\n const triggerLabelId = React.useSyncExternalStore(\n subscribeTrigger,\n () => (checkTrigger ? findTriggerLabelId(triggerElement, resolvedTriggerId) : undefined),\n () => (checkTrigger ? resolvedTriggerId : undefined),\n );\n\n const labelledBy =\n ariaLabelledBy ?? (ariaLabel ? undefined : hasTitle ? titleId : triggerLabelId);\n const customId = idProp || undefined;\n\n // Report the consumer's id to the root so the trigger's `aria-controls` points at it.\n React.useEffect(() => {\n setCustomContentId(customId);\n return () => setCustomContentId(undefined);\n }, [customId, setCustomContentId]);\n\n React.useEffect(() => {\n if (!open || !unnamed || !contextMode || !isDev) return;\n warnOnce(\n 'Popover.Content:name',\n 'Popover.Content: the popover has no accessible name. A context popover (openOnContext) is not named by its region: pass `title`, `aria-label` or `aria-labelledby`.',\n );\n }, [open, unnamed, contextMode]);\n\n React.useEffect(() => {\n if (!checkTrigger || !isDev) return;\n // Read after commit: a trigger's ref is attached by now even before it reported its id.\n const trigger = triggerRef.current;\n if (!trigger) {\n warnOnce(\n 'Popover.Content:name',\n 'Popover.Content: the popover has no accessible name. Pass `title`, `aria-label` or `aria-labelledby`, or open it from a Popover.Trigger.',\n );\n return;\n }\n const labelIds = findTriggerLabelId(trigger, resolvedTriggerId);\n if (!labelIds) {\n warnOnce(\n 'Popover.Content:trigger-id',\n 'Popover.Content: the popover is named by its trigger, but the trigger element has no `id` (a render-prop child of Popover.Trigger must spread the `id` it receives), so the popover has no accessible name. Spread every trigger prop onto the element, or pass `title`, `aria-label` or `aria-labelledby`.',\n );\n } else if (!referencesText(trigger.ownerDocument, labelIds)) {\n warnOnce(\n 'Popover.Content:trigger-name',\n 'Popover.Content: the popover is named by its trigger, but the trigger has no text to name it (an icon-only trigger needs `aria-label`, or `aria-labelledby` pointing at text), so the popover has no accessible name. Name the trigger, or pass `title`, `aria-label` or `aria-labelledby`.',\n );\n }\n }, [checkTrigger, resolvedTriggerId, triggerRef, triggerLabelId]);\n\n if (!open) return null;\n\n const titleAndChildren = (\n <>\n {hasTitle && (\n <h2\n id={titleId}\n className={cn(popoverContentClassNames.title, 'mb-2 text-subtitle-2 font-semibold')}\n >\n {title}\n </h2>\n )}\n {children}\n </>\n );\n\n return (\n <Portal layerId={layerId}>\n <div\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n tabIndex={keyboardContext ? -1 : undefined}\n {...rest}\n ref={elementRef}\n id={customId ?? contentId}\n data-side={floatingProps['data-side']}\n data-align={floatingProps['data-align']}\n style={{ ...style, ...floatingProps.style }}\n onKeyDown={composeEventHandlers(onKeyDown, onContentKeyDown)}\n onContextMenu={composeEventHandlers(onContextMenu, onContentContextMenu)}\n onPointerEnter={\n hover ? composeEventHandlers(onPointerEnter, hover.onPointerEnter) : onPointerEnter\n }\n onPointerLeave={\n hover ? composeEventHandlers(onPointerLeave, hover.onPointerLeave) : onPointerLeave\n }\n className={cn(\n popoverContentClassNames.root,\n 'w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4',\n className,\n )}\n >\n <PopoverBeak\n ref={arrowRef}\n side={placedSide}\n style={arrowStyles}\n data-wave-popover-arrow=\"\"\n className={popoverContentClassNames.beak}\n />\n {fitViewport ? (\n // The beak sits half outside the border, so the scroller is inside it: the viewport\n // limit minus the content's padding (2 x 1rem) and border (2 x 1px).\n <div className=\"overflow-y-auto max-h-[calc(var(--wave-popup-available-height)-2rem-2px)]\">\n {titleAndChildren}\n </div>\n ) : (\n titleAndChildren\n )}\n </div>\n </Portal>\n );\n};\nPopoverContent.displayName = 'PopoverContent';\n\n/**\n * A non-modal popup anchored to a trigger: `Popover.Trigger` (merges its props onto the child\n * button) and `Popover.Content` (portaled, positioned `role=\"dialog\"` surface). Use it for custom\n * popups such as filters or details; for a menu button use `Menu.Trigger` and `Menu.Popover`,\n * which add menu semantics and keyboard support.\n *\n * Controlled (`open`/`onOpenChange`) or uncontrolled (`defaultOpen`); `side`/`align` place the\n * content, and `ignoreOutsideRefs` lists external elements (such as a toggle button) whose presses\n * do not dismiss it.\n *\n * - **Hover cards:** `openOnHover` opens it when a mouse pointer rests on the trigger\n * (`openDelay`) and closes it once the pointer has left the trigger and the content\n * (`closeDelay`), unless focus is inside; a click on the trigger pins it.\n * - **Context popovers:** `openOnContext` makes the trigger a context-menu region: a right click\n * opens it at the pointer, Shift+F10 or the ContextMenu key at the focused row (with focus\n * moving into the content). Name the content with `title` or `aria-label`.\n * - **Custom anchors:** `target` places it at another element or at a `VirtualElement` (a point, a\n * text selection); with a controlled `open` it needs no trigger.\n *\n * @example\n * <Popover>\n * <Popover.Trigger><Button>Details</Button></Popover.Trigger>\n * <Popover.Content title=\"Details\">…</Popover.Content>\n * </Popover>\n */\nexport const Popover = /* @__PURE__ */ Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n});\n"],"mappings":"47BA+OA,IAAMmD,EAAiBnD,EAAM,cAA0C,IAAI,EAC3E,EAAe,YAAc,iBAE7B,IAAIoD,EAA2C,KAG/C,SAASC,GAAuC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,EACN,MAAO0C,EACP,0BAAwB,GACxB,UAAWnI,EAAAA,yBAAyB,IACrC,CAAA,EACAuK,IAGC,EAAA9I,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,4EACZ,SAAA0I,CACE,CAAA,EAELA,CAEC,GACC,CAAA,CAEZ,EACA,EAAe,YAAc,iBA2B7B,IAAaK,EAA0B,OAAO,OAAOrH,EAAa,CAChE,QAASiF,EACT,QAASgB,CACX,CAAC"}
|
|
1
|
+
{"version":3,"file":"Popover.cjs","names":["React","getTriggerFocusTarget","getTabbableThrough","usePopupTarget","useControllable","useEventCallback","useIsClient","useId","usePopupPosition","resolvePositioning","isConnectedAndFocusable","useDismiss","useContextMenuAnchor","useTriggerFocusRef","useMergedRefs","getFirstTabbable","isFocusInSurfaceTree","useHoverIntent","usePopoverTabOrder","composeEventHandlers","useTriggerElement","usePresence","useMotionClasses","popupMotion","slotRendersContent","isDev","_Fragment","cn","popoverContentClassNames","Portal","PopoverBeak","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_focus","require_useMergedRefs","require_useIsClient","require_usePresence","require_usePopupPosition","require_useDismiss","require_useRestoreFocus","require_Portal","require_motion","require_useFocusBeforeClose","require_useHoverIntent","require_useMotion","require_Popover_shared","require_useTriggerElement","require_useResolvedTarget","require_useContextMenuAnchor","react","react_jsx_runtime","PopoverContext","inertContext","getInertContext","usePopoverContext","componentName","presentIds","present","ids","id","doc","findTriggerLabelId","trigger","resolvedId","named","referencesText","el","subscribeNothing","isElementTarget","target","createResolvedRef","resolve","getPopoverPreviousStop","anchor","surface","order","PopoverRoot","openProp","targetProp","targetPending","positioning","openState","setOpen","defaultOpen","onOpenChange","hoverCloseRef","requestOpen","next","isHoverClose","isClient","open","openReason","setOpenReason","hoverRequested","setHoverRequested","previousOpen","setPreviousOpen","reason","generatedContentId","customContentId","setCustomContentId","contentId","triggerId","resolvedTriggerId","setResolvedTriggerId","setSurface","triggerElement","setTriggerElement","triggerRef","surfaceRef","arrowRef","targetElement","targetRef","positionedProps","placedSide","floatingProps","contextOpenerRef","resolveFocusTarget","gestureOpener","openOnContext","triggerTarget","targetEl","focusTargetRef","isOutsidePress","event","ignoreOutsideRefs","focusContentRef","contextAnchor","contextOrigin","contextOpener","contextTriggerHandlers","contextSurfaceHandlers","origin","triggerFocusRef","opener","triggerElementRef","surfaceElementRef","setFloating","setReference","fromContext","openOnHover","hoverEnabled","canHoverClose","layerId","hoverTriggerHandlers","hoverSurfaceHandlers","cancelHover","onTriggerClick","current","resolveTabAnchor","tabAnchorRef","onTriggerKeyDown","surfaceElement","first","onContentKeyDown","keyboardContext","context","arrowStyles","PopoverTrigger","idProp","rest","hover","gesture","elementRef","ref","triggerProps","contextMode","onClick","onKeyDown","onContextMenu","onPointerEnter","onPointerMove","onPointerLeave","children","PopoverContent","ariaLabel","ariaLabelledBy","titleId","presenceRef","motionClassName","motion","hasTitle","title","unnamed","checkTrigger","subscribeTrigger","observer","onChange","triggerLabelId","labelledBy","customId","labelIds","isMounted","titleAndChildren","presenceProps","style","onContentContextMenu","className","fitViewport","Popover"],"sources":["../../../src/components/overlays/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { popoverContentClassNames } from '../../lib/classNames';\nimport { isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport { popupMotion } from '../../lib/motion';\nimport { slotRendersContent } from '../../lib/slot';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { focusElement, getFirstTabbable, isConnectedAndFocusable } from '../../lib/focus';\nimport type {\n MotionSlot,\n PopupAlign,\n PopupPositioning,\n PopupSide,\n PopupTarget,\n PopupTargetInput,\n} from '../../lib/types';\nimport { usePopupTarget } from '../../hooks/useResolvedTarget';\nimport { useId } from '../../hooks/useId';\nimport { useControllable, type SetValue } from '../../hooks/useControllable';\nimport { useContextMenuAnchor, type ContextMenuAnchor } from '../../hooks/useContextMenuAnchor';\nimport { useDismiss } from '../../hooks/useDismiss';\nimport { useFocusBeforeClose } from '../../hooks/useFocusBeforeClose';\nimport { useHoverIntent, type HoverIntent } from '../../hooks/useHoverIntent';\nimport { useMotionClasses } from '../../hooks/useMotion';\nimport { usePresence } from '../../hooks/usePresence';\nimport { useRestoreFocus } from '../../hooks/useRestoreFocus';\nimport { resolvePositioning, usePopupPosition } from '../../hooks/usePopupPosition';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport {\n getTriggerFocusTarget,\n useTriggerElement,\n useTriggerFocusRef,\n} from '../../hooks/useTriggerElement';\nimport { Portal } from '../portal/Portal';\nimport {\n getTabbableThrough,\n isFocusInSurfaceTree,\n PopoverBeak,\n usePopoverTabOrder,\n type PopoverPhysicalSide,\n} from './Popover.shared';\n\n/** Properties for the Popover component. */\nexport interface PopoverProps {\n /**\n * Controlled open state of the popover. The content renders only in the browser: an open\n * popover is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The content renders only in the browser: a\n * popover open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the requested open state when it differs from the current one: a trigger click,\n * Escape and an outside press; the hover opening and closing of `openOnHover`; and, with\n * `openOnContext`, a context gesture (a right click, a macOS Ctrl+click, Shift+F10 or the\n * ContextMenu key), a right click outside, and a scroll that moves the row it opened at.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Side of the trigger the content opens on. `start`/`end` follow the writing direction. The\n * content flips to the opposite side when there is not enough room.\n * @default 'bottom'\n */\n side?: PopupSide;\n /** Alignment of the content along the trigger's edge.\n * @default 'start'\n */\n align?: PopupAlign;\n /**\n * Elements outside the popover whose presses must not dismiss it, e.g. an external toggle\n * button that opens and closes the popover itself.\n */\n ignoreOutsideRefs?: ReadonlyArray<React.RefObject<HTMLElement | null>>;\n /**\n * Open the popover when a mouse pointer rests on its trigger (a hover card), and close it once\n * the pointer has been off the trigger and the content for `closeDelay` while focus is not\n * inside the content. A popover opened by hover does not take focus, and its hover close leaves\n * focus where it is; a click on its trigger keeps it open and keeps focus where it is (a second\n * click closes it, as without hover). After Escape or an outside press it does not reopen until\n * the pointer has left the trigger. Touch and pen never open it by hover, and an `aria-disabled`\n * trigger never opens. A triangle between the trigger and the content keeps it open while the\n * pointer moves diagonally into it. Ignored with `openOnContext` (development warning).\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Milliseconds a hovering mouse pointer rests on the trigger before the popover opens (mouse\n * hover only).\n * @default 250\n */\n openDelay?: number;\n /**\n * Milliseconds before a hover-opened popover closes once the mouse pointer has left it and its\n * trigger (Fluent's `mouseLeaveDelay`; mouse hover only).\n * @default 500\n */\n closeDelay?: number;\n /**\n * Make `Popover.Trigger` a context-menu region (a list, a row, a canvas): a right click (a\n * Ctrl+click on macOS, a long press where the browser reports one) opens the popover at the\n * pointer and leaves focus where it is (Tab from that element enters the content), and\n * Shift+F10 or the ContextMenu key opens it at the focused element inside the region and moves\n * focus into the content, instead of a click. Focus returns to the element that had it. The\n * browser's context menu is suppressed there and inside the content, except in text fields\n * inside the region, which keep it. A press elsewhere, a right click outside or a scroll that\n * moves the row it opened at (the one under the pointer, or the focused one), as a scroll of\n * the region's own content does, closes it. The trigger gets no `aria-haspopup`/`aria-expanded`\n * (it is not a popover button; with a render-prop child, do not spread them): name the content\n * with `title`, `aria-label` or `aria-labelledby`, and consider `aria-keyshortcuts=\"Shift+F10\"`\n * on the region. iOS Safari reports no long press. `openOnHover` is ignored with it.\n * @default false\n */\n openOnContext?: boolean;\n /**\n * Where to place the content instead of next to `Popover.Trigger`: an element or a\n * `VirtualElement` (a rectangle, such as a point; an inline object is fine). With a controlled\n * `open`, a popover with a `target` needs no trigger; name it with `title`, `aria-label` or\n * `aria-labelledby`, and give a toggle button you use as the target `aria-haspopup=\"dialog\"`,\n * `aria-expanded` and `aria-controls` yourself. A press on a target element does not close the\n * popover, and Tab from it enters the content when there is no trigger. Hold the element in\n * state, or pass a ref object (read after each render of the popover, so an element that attaches without it rendering is noticed on its next render). A popover\n * opened by `openOnContext` is placed at the gesture instead.\n */\n target?: PopupTargetInput;\n /**\n * Advanced positioning (Fluent's `positioning`): `offset` (px from the anchor), `fitViewport`\n * (limit the content to the space the viewport leaves; Fluent's `autoSize`), `matchReferenceWidth`,\n * `fallbackPlacements` (tried in order when the requested side has no room) and `target` (used\n * when the `target` prop is not set). `side` and `align` stay separate props.\n * @default `{ offset: 8 }`\n */\n positioning?: PopupPositioning;\n /** `Popover.Trigger` and `Popover.Content`. */\n children: React.ReactNode;\n}\n\n/**\n * Props the trigger puts on its element; a render-prop child of `Popover.Trigger` receives them\n * (spread them onto the element that opens the popover). With `openOnContext` the element is a\n * context-menu region, not a popover button: do not spread `aria-haspopup`, `aria-expanded` and\n * `aria-controls` onto it (`aria-expanded` is then always `false`, `aria-controls` is absent and\n * `onClick` does nothing); spread ones are removed after each commit, with a development warning.\n */\nexport type PopoverTriggerChildProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & {\n id: string;\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The content's id, only while the popover is open (never with `openOnContext`). */\n 'aria-controls': string | undefined;\n onClick: React.MouseEventHandler<HTMLElement>;\n /**\n * Moves Tab from the open trigger into the portaled content (which lives at the end of the\n * document), so the keyboard order follows the trigger.\n */\n onKeyDown: React.KeyboardEventHandler<HTMLElement>;\n ref: React.RefCallback<HTMLElement>;\n};\n\n/** Properties for the PopoverTrigger sub-component. */\nexport interface PopoverTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that toggles the popover (its props are merged onto it), or a render function\n * that receives the trigger props.\n */\n children: React.ReactNode | ((props: PopoverTriggerChildProps) => React.ReactNode);\n /**\n * `false` renders the 0.4 wrapper `<span>` carrying the trigger props around the children\n * instead of merging them onto the child. `aria-haspopup`, `aria-expanded` and `aria-controls`,\n * which a generic element cannot carry, go to the first element in the tab order inside the\n * span. A render-prop child ignores `asChild` and receives every prop.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Properties for the PopoverContent sub-component. */\nexport interface PopoverContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Content to render inside the popover. */\n children: React.ReactNode;\n /**\n * Visible heading rendered at the top of the popover; it names the dialog. Without `title`,\n * `aria-label` or `aria-labelledby`, the popover is labelled by its trigger, except with\n * `openOnContext` (a region's text is no name), where it needs one of them.\n */\n title?: React.ReactNode;\n /** Id of the surface; the trigger's `aria-controls` follows it. Defaults to a generated id. */\n id?: string;\n /**\n * The popover's motion. By default it fades in and slides 4px away from its trigger, on the\n * side it opened on, over 200 ms with a decelerating curve, and fades out and slides back over\n * 100 ms with an accelerating curve; under reduced motion it appears and disappears at once.\n * `null` turns the motion off (the surface still renders its `data-presence` phases, which then\n * end at once); a class string or `{ className }` replaces the default classes with yours (see\n * `MotionSlot`), also under a `WaveProvider` with `motion=\"none\"`, which otherwise turns the\n * default off. Fluent's `Popover` `surfaceMotion`.\n * @default the fade and slide above\n */\n motion?: MotionSlot | null;\n /** Ref to the popover surface. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: SetValue<boolean>;\n /** The content's id: the consumer's `Popover.Content` id when given, else a generated one. */\n contentId: string;\n /** `Popover.Content` reports the consumer's `id` so the trigger's `aria-controls` follows it. */\n setCustomContentId: (id: string | undefined) => void;\n triggerId: string;\n /** The id the trigger element ended up with (the child's own id wins). */\n resolvedTriggerId: string | undefined;\n setResolvedTriggerId: (id: string) => void;\n triggerRef: React.RefObject<HTMLElement | null>;\n /** The trigger element as state (read during render, e.g. to check the labelling id). */\n triggerElement: HTMLElement | null;\n /** Ref callback for the trigger element: focus-restore target and positioning anchor. */\n triggerElementRef: React.RefCallback<HTMLElement>;\n /** Ref callback for the surface: dismissal, focus restore and positioning. */\n surfaceElementRef: React.RefCallback<HTMLElement>;\n arrowRef: React.RefObject<HTMLDivElement | null>;\n /** The trigger's click: toggles the popover, or pins one that hover opened (keeps it open). */\n onTriggerClick: () => void;\n /** Tab from the open trigger enters the portaled content. */\n onTriggerKeyDown: React.KeyboardEventHandler<HTMLElement>;\n /** Hover opening (`openOnHover`): composed onto the trigger; `null` without it. */\n hoverTriggerHandlers: HoverIntent['triggerHandlers'] | null;\n /** Hover opening (`openOnHover`): composed onto the content; `null` without it. */\n hoverSurfaceHandlers: HoverIntent['surfaceHandlers'] | null;\n /** `openOnContext`: the trigger is a context-menu region, not a popover button. */\n contextMode: boolean;\n /** Context gestures (`openOnContext`): composed onto the trigger; `null` without it. */\n contextTriggerHandlers: ContextMenuAnchor['triggerHandlers'] | null;\n /** Composed onto the content: suppresses the browser's context menu there in context mode. */\n onContentContextMenu: React.MouseEventHandler<HTMLElement>;\n /** Opened by a keyboard context gesture: the content takes focus (itself when nothing can). */\n keyboardContext: boolean;\n /** Tab past the content's edges continues around the trigger in the page order. */\n onContentKeyDown: React.KeyboardEventHandler<HTMLElement>;\n layerId: string;\n floatingProps: { 'data-side': string; 'data-align': string; style: React.CSSProperties };\n arrowStyles: React.CSSProperties;\n placedSide: PopoverPhysicalSide;\n /** `positioning.fitViewport`: the content scrolls inside the border when it is limited. */\n fitViewport: boolean;\n}\n\nconst PopoverContext = React.createContext<PopoverContextValue | null>(null);\nPopoverContext.displayName = 'PopoverContext';\n\nlet inertContext: PopoverContextValue | null = null;\n\n/** Production fallback for a misplaced sub-component: a closed popover that does nothing. */\nfunction getInertContext(): PopoverContextValue {\n inertContext ??= {\n open: false,\n setOpen: () => {},\n contentId: 'wave-popover-inert-content',\n setCustomContentId: () => {},\n triggerId: 'wave-popover-inert-trigger',\n resolvedTriggerId: undefined,\n setResolvedTriggerId: () => {},\n triggerRef: { current: null },\n triggerElement: null,\n triggerElementRef: () => {},\n surfaceElementRef: () => {},\n arrowRef: { current: null },\n onTriggerClick: () => {},\n onTriggerKeyDown: () => {},\n hoverTriggerHandlers: null,\n hoverSurfaceHandlers: null,\n contextMode: false,\n contextTriggerHandlers: null,\n onContentContextMenu: () => {},\n keyboardContext: false,\n onContentKeyDown: () => {},\n layerId: 'wave-popover-inert-layer',\n floatingProps: { 'data-side': 'bottom', 'data-align': 'start', style: {} },\n arrowStyles: {},\n placedSide: 'bottom',\n fitViewport: false,\n };\n return inertContext;\n}\n\nfunction usePopoverContext(componentName: string): PopoverContextValue {\n const context = React.useContext(PopoverContext);\n if (context) return context;\n reportMissingContext(componentName, 'Popover');\n return getInertContext();\n}\n\n/** The ids of an id list that exist in `doc`, joined; `undefined` when none does. */\nfunction presentIds(doc: Document, ids: string | null): string | undefined {\n const present = (ids ?? '').split(/\\s+/).filter((id) => id && doc.getElementById(id));\n return present.length > 0 ? present.join(' ') : undefined;\n}\n\n/**\n * The ids `Popover.Content`'s default `aria-labelledby` points at, so the popover gets its\n * trigger's name. The named element is the one with the resolved id when the document has it,\n * otherwise the trigger's focus target (for example the Button inside a Tooltip that sits between\n * `Popover.Trigger` and the Button, whose own id wins), else the trigger element. When that\n * element is itself named through `aria-labelledby` (an icon-only Button inside\n * `Tooltip relationship=\"label\"`, or a button labelled by a visible label), its label ids are\n * returned: a name computation does not follow a second `aria-labelledby` hop, so pointing at the\n * button would leave the popover unnamed. Otherwise the element's id, else the trigger's own.\n * `undefined` when none of them has an id (a render-prop child that does not spread `id`), so the\n * reference never dangles; only ids present in the document are returned. Before the trigger\n * element is known, the resolved id.\n */\nfunction findTriggerLabelId(\n trigger: HTMLElement | null,\n resolvedId: string | undefined,\n): string | undefined {\n if (!trigger) return resolvedId;\n const doc = trigger.ownerDocument;\n const named =\n (resolvedId ? doc.getElementById(resolvedId) : null) ??\n getTriggerFocusTarget(trigger) ??\n trigger;\n return (\n presentIds(doc, named.getAttribute('aria-labelledby')) ?? (named.id || trigger.id || undefined)\n );\n}\n\n/**\n * Whether one of the elements an id list references has text for a name: its own `aria-label`\n * or text, or a descendant's `aria-label`, `alt` or `title`. Deliberately lenient (it only drives\n * a development warning): content that assistive technology ignores still counts as text.\n */\nfunction referencesText(doc: Document, ids: string): boolean {\n return ids.split(/\\s+/).some((id) => {\n const el = id ? doc.getElementById(id) : null;\n if (!el) return false;\n if (el.getAttribute('aria-label')?.trim() || el.textContent?.trim()) return true;\n return !!el.querySelector(\n '[aria-label]:not([aria-label=\"\"]), [alt]:not([alt=\"\"]), [title]:not([title=\"\"])',\n );\n });\n}\n\nconst subscribeNothing = (): (() => void) => () => {};\n\n/** Why an open popover opened: hover (it closes by hover), or anything else (it is pinned). */\ntype OpenReason = 'hover' | 'other';\n\n/** Whether a `target` is an element rather than a VirtualElement (duck typed, any realm). */\nfunction isElementTarget(target: PopupTarget | undefined): target is HTMLElement {\n return !!target && typeof (target as Partial<Node>).nodeType === 'number';\n}\n\n/** A read-only ref whose `current` is `resolve()` at the time it is read (event time). */\nfunction createResolvedRef(resolve: () => HTMLElement | null): React.RefObject<HTMLElement | null> {\n return {\n get current() {\n return resolve();\n },\n };\n}\n\n/**\n * The content's previous stop: the focus target of the element it follows (the trigger, the row of\n * a context gesture, a `target` element), else the tab stop before that element.\n */\nfunction getPopoverPreviousStop(\n anchor: HTMLElement,\n surface: HTMLElement,\n order?: readonly HTMLElement[],\n): HTMLElement | null {\n return getTriggerFocusTarget(anchor) ?? getTabbableThrough(anchor, surface, order);\n}\n\n// A const arrow (like DialogRoot and DrawerRoot): its type can be named in consumers' declaration\n// files, e.g. a story's `satisfies Meta<typeof Popover>` (a function declaration's `typeof` cannot,\n// TS4023).\nconst PopoverRoot = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n side = 'bottom',\n align = 'start',\n ignoreOutsideRefs,\n openOnHover = false,\n openDelay = 250,\n closeDelay = 500,\n openOnContext = false,\n target: targetProp,\n positioning,\n children,\n}: PopoverProps) => {\n const { target, pending: targetPending } = usePopupTarget('Popover', targetProp, positioning);\n const [openState, setOpen] = useControllable(openProp, defaultOpen ?? false, onOpenChange);\n // A hover close in flight (written in handlers, read when the popover closes): set when the hover\n // intent asks to close, so that close moves no focus even when a controlled parent applies it in\n // a later render (a transition). Every other request to open or close forgets it, and so does\n // the next opening.\n const hoverCloseRef = React.useRef(false);\n const requestOpen = useEventCallback<SetValue<boolean>>((next) => {\n hoverCloseRef.current = false;\n setOpen(next);\n });\n const isHoverClose = React.useCallback(() => hoverCloseRef.current, []);\n // The content lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the popover reports itself closed, so the trigger's aria-expanded and\n // aria-controls never describe content that is not there.\n const isClient = useIsClient();\n const open = openState && isClient;\n\n // Why the popover opened, decided when it opens (C-HOOKS: a previous-value state): `hover` when\n // hover asked for that open (a request consumed by the next render, so an open that a\n // controlled parent refused does not linger), else `other` (click, keys, a context gesture, a\n // controlled open).\n const [openReason, setOpenReason] = React.useState<OpenReason>('other');\n const [hoverRequested, setHoverRequested] = React.useState(false);\n const [previousOpen, setPreviousOpen] = React.useState(open);\n let reason = openReason;\n if (open !== previousOpen) {\n setPreviousOpen(open);\n if (open) reason = hoverRequested ? 'hover' : 'other';\n }\n if (reason !== openReason) setOpenReason(reason);\n if (hoverRequested) setHoverRequested(false);\n\n const generatedContentId = useId('popover-content');\n const [customContentId, setCustomContentId] = React.useState<string | undefined>(undefined);\n const contentId = customContentId ?? generatedContentId;\n const triggerId = useId('popover-trigger');\n const [resolvedTriggerId, setResolvedTriggerId] = React.useState<string | undefined>(undefined);\n const [surface, setSurface] = React.useState<HTMLElement | null>(null);\n const [triggerElement, setTriggerElement] = React.useState<HTMLElement | null>(null);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const surfaceRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLDivElement | null>(null);\n // A `target` element (not a VirtualElement) belongs to the dismiss layer, anchors the keyboard\n // order without a trigger and can take focus back.\n const targetElement = isElementTarget(target) ? target : null;\n const targetRef = React.useRef<HTMLElement | null>(null);\n React.useInsertionEffect(() => {\n targetRef.current = targetElement;\n }, [targetElement]);\n\n // Destructured: react-hooks/refs treats an object whose member is passed to `ref` as a ref.\n const {\n setReference,\n setFloating,\n floatingProps: positionedProps,\n arrowStyles,\n side: placedSide,\n } = usePopupPosition({\n open,\n side,\n align,\n arrowRef,\n ...resolvePositioning(positioning, { offset: 8 }),\n });\n // A ref target that holds no element yet keeps the popup hidden (as TeachingPopover's is).\n const floatingProps = React.useMemo(\n () =>\n targetPending\n ? { ...positionedProps, style: { ...positionedProps.style, visibility: 'hidden' as const } }\n : positionedProps,\n [targetPending, positionedProps],\n );\n\n // The one focus resolver: the focus-return fallback and the layer's anchor (where a surface\n // opened from the content restores focus once its opener is gone). In context mode the element\n // focused at the gesture (the row) first; then the trigger's focus target (for a wrapper span,\n // the element inside it that carries the state ARIA), a focusable `target` element, and the\n // trigger itself. The context hook's opener ref is stable; it is filled in once the hook runs.\n const contextOpenerRef = React.useRef<React.RefObject<HTMLElement | null> | null>(null);\n const resolveFocusTarget = useEventCallback((): HTMLElement | null => {\n const gestureOpener = openOnContext ? contextOpenerRef.current?.current : null;\n if (gestureOpener && isConnectedAndFocusable(gestureOpener)) return gestureOpener;\n const trigger = triggerRef.current;\n const triggerTarget = trigger ? getTriggerFocusTarget(trigger) : null;\n if (triggerTarget) return triggerTarget;\n const targetEl = targetRef.current;\n if (targetEl && isConnectedAndFocusable(targetEl)) return targetEl;\n return trigger;\n });\n const focusTargetRef = React.useMemo(\n () => createResolvedRef(resolveFocusTarget),\n [resolveFocusTarget],\n );\n\n // In context mode the region is no part of the layer: a primary press elsewhere in it closes the\n // popover like any outside press. A Ctrl+press inside it is a macOS context click, whose\n // `contextmenu` moves the popover instead.\n const isOutsidePress = useEventCallback(\n (event: PointerEvent | MouseEvent) =>\n !(event.ctrlKey && triggerRef.current?.contains(event.target as Node)),\n );\n const { layerId } = useDismiss({\n open,\n onDismiss: () => requestOpen(false),\n refs: openOnContext\n ? [surfaceRef, targetRef, ...(ignoreOutsideRefs ?? [])]\n : [surfaceRef, triggerRef, targetRef, ...(ignoreOutsideRefs ?? [])],\n anchorRef: focusTargetRef,\n kind: 'popover',\n outsidePress: openOnContext ? isOutsidePress : true,\n });\n\n // A keyboard context gesture moves focus into the content, once it is there (see below).\n const focusContentRef = React.useRef(false);\n const {\n anchor: contextAnchor,\n fromContext,\n origin: contextOrigin,\n opener: contextOpener,\n triggerHandlers: contextTriggerHandlers,\n surfaceHandlers: contextSurfaceHandlers,\n } = useContextMenuAnchor({\n enabled: openOnContext,\n open,\n trigger: triggerElement,\n layerId,\n onOpen: (origin) => {\n focusContentRef.current = origin === 'keyboard';\n requestOpen(true);\n },\n onClose: () => requestOpen(false),\n });\n React.useInsertionEffect(() => {\n contextOpenerRef.current = contextOpener;\n }, [contextOpener]);\n\n // Focus returns to the element that takes focus for the trigger, as Shift+Tab from the content\n // does, when the popover closes while focus is inside it or on `<body>`; a hover close restores\n // only focus inside, so it never moves focus. In context mode it returns to the element focused\n // at the gesture (the row): the region is no restore target of its own (as `triggerRef` it\n // would be taken for the opener).\n const triggerFocusRef = useTriggerFocusRef(triggerRef);\n useRestoreFocus({\n enabled: open,\n container: surface,\n triggerRef: openOnContext ? undefined : triggerFocusRef,\n finalFocusRef: openOnContext ? contextOpener : undefined,\n fallback: resolveFocusTarget,\n onlyIfFocusInside: true,\n isHoverClose,\n });\n // Focus before close, on every close: the content stays mounted while it exits, so when the\n // popover closes with focus inside it, focus moves in the closing commit to where\n // useRestoreFocus would put it, in its order: the element focused at the gesture (context mode),\n // the element focused when the popover opened (the trigger's focus target first, but not in\n // context mode, whose region is no opener), then the focus resolver. A Dialog opened by a button\n // of the content as it closes then records that element as its opener, not the button, which\n // the exiting surface still holds. A hover close finds no focus inside (focus there blocks it),\n // and unmounting is left to useRestoreFocus.\n useFocusBeforeClose({\n open,\n surfaceRef,\n captureOpener: () => (openOnContext ? null : triggerFocusRef.current),\n candidates: (opener) => [\n openOnContext ? contextOpener.current : null,\n opener,\n resolveFocusTarget(),\n ],\n });\n React.useLayoutEffect(() => {\n if (open) hoverCloseRef.current = false;\n }, [open]);\n\n const triggerElementRef = useMergedRefs<HTMLElement>(triggerRef, setTriggerElement);\n const surfaceElementRef = useMergedRefs<HTMLElement>(surfaceRef, setSurface, setFloating);\n\n // The positioning anchor: the context gesture (the pointer, or the focused row, else the\n // trigger's focus target, else the trigger) while the popover was opened by one, else `target`,\n // else the trigger. A new VirtualElement on every render repositions without a render loop.\n React.useLayoutEffect(() => {\n if (fromContext) {\n setReference(\n contextAnchor ??\n (triggerElement && (getTriggerFocusTarget(triggerElement) ?? triggerElement)),\n );\n } else {\n setReference(target ?? triggerElement);\n }\n }, [contextAnchor, fromContext, target, triggerElement, setReference]);\n\n // After the commit that has the surface (and after a gesture while open): focus its first\n // tabbable element, else the surface itself (it then has `tabIndex={-1}`). A gesture whose open\n // was refused leaves nothing pending. No deps: every commit, since a gesture always renders.\n React.useLayoutEffect(() => {\n if (!focusContentRef.current) return;\n if (!open) {\n focusContentRef.current = false;\n return;\n }\n if (!surface) return;\n focusContentRef.current = false;\n focusElement(getFirstTabbable(surface) ?? surface, { preventScroll: true });\n });\n\n React.useEffect(() => {\n if (!openOnHover || !openOnContext) return;\n warnOnce(\n 'Popover:hover-and-context',\n 'Popover: `openOnHover` is ignored with `openOnContext`: a context popover opens on a right click, Shift+F10 or the ContextMenu key, not on hover.',\n );\n }, [openOnHover, openOnContext]);\n\n // Hover opening: a popover that hover opened closes by hover until a click on the trigger pins\n // it; focus inside the content (or a layer opened from it) keeps it open, focus on the trigger\n // does not.\n const hoverEnabled = openOnHover && !openOnContext;\n const canHoverClose = useEventCallback(\n () => reason === 'hover' && !isFocusInSurfaceTree(surfaceRef.current, layerId),\n );\n const {\n triggerHandlers: hoverTriggerHandlers,\n surfaceHandlers: hoverSurfaceHandlers,\n cancel: cancelHover,\n } = useHoverIntent({\n enabled: hoverEnabled,\n open,\n openDelay,\n closeDelay,\n trigger: triggerElement,\n surface,\n onOpen: () => {\n setHoverRequested(true);\n requestOpen(true);\n },\n onClose: () => {\n // Before the request: a parent may apply it synchronously (flushSync).\n hoverCloseRef.current = true;\n setOpen(false);\n },\n canClose: canHoverClose,\n });\n\n const onTriggerClick = useEventCallback(() => {\n cancelHover();\n if (open && reason === 'hover') setOpenReason('other');\n else requestOpen((current) => !current);\n });\n\n // The element the content follows in the keyboard order: in context mode the element focused\n // at the gesture when it lies inside the region, else the trigger, else a `target` element.\n // With neither (a VirtualElement target and no trigger) the content keeps the portal's place.\n const resolveTabAnchor = useEventCallback((): HTMLElement | null => {\n const trigger = triggerRef.current;\n const gestureOpener = openOnContext ? contextOpener.current : null;\n if (gestureOpener && trigger?.contains(gestureOpener)) return gestureOpener;\n return trigger ?? targetRef.current;\n });\n const tabAnchorRef = React.useMemo(() => createResolvedRef(resolveTabAnchor), [resolveTabAnchor]);\n\n // Keyboard order of the portaled content (it lives at the end of the document), as if it\n // followed the trigger like 0.4's inline content: Tab from the open trigger enters it (here, in\n // the trigger's own `onKeyDown`, which runs before a dialog's focus trap), Tab past its last\n // element continues after the trigger, Shift+Tab from its first element returns to the trigger\n // (the element inside a wrapper span), and Shift+Tab from the element after the trigger enters\n // it at its last element. The end of the page does not visit it a second time where its portal\n // is, and no Tab cycle forms (see usePopoverTabOrder). In a context region only Tab from the\n // element the content follows enters it; Tab on the region's other rows moves on as usual.\n const onTriggerKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Tab' || event.shiftKey || !open) return;\n if (openOnContext) {\n const anchor = resolveTabAnchor();\n if (!anchor || event.target !== (getTriggerFocusTarget(anchor) ?? anchor)) return;\n }\n const surfaceElement = surfaceRef.current;\n const first = surfaceElement ? getFirstTabbable(surfaceElement) : null;\n if (!first) return;\n event.preventDefault();\n first.focus();\n });\n\n const onContentKeyDown = usePopoverTabOrder({\n enabled: open,\n surface,\n anchorRef: tabAnchorRef,\n // Shift+Tab from the content's first element returns to the trigger (the element in a span),\n // or, when nothing in the trigger can take focus, to the tab stop before it.\n getPreviousStop: getPopoverPreviousStop,\n });\n\n const keyboardContext = fromContext && contextOrigin === 'keyboard';\n const context = React.useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen: requestOpen,\n contentId,\n setCustomContentId,\n triggerId,\n resolvedTriggerId,\n setResolvedTriggerId,\n triggerRef,\n triggerElement,\n triggerElementRef,\n surfaceElementRef,\n arrowRef,\n onTriggerClick,\n onTriggerKeyDown,\n hoverTriggerHandlers: hoverEnabled ? hoverTriggerHandlers : null,\n hoverSurfaceHandlers: hoverEnabled ? hoverSurfaceHandlers : null,\n contextMode: openOnContext,\n contextTriggerHandlers: openOnContext ? contextTriggerHandlers : null,\n onContentContextMenu: contextSurfaceHandlers.onContextMenu,\n keyboardContext,\n onContentKeyDown,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n fitViewport: positioning?.fitViewport === true,\n }),\n [\n open,\n requestOpen,\n contentId,\n triggerId,\n resolvedTriggerId,\n triggerElement,\n triggerElementRef,\n surfaceElementRef,\n onTriggerClick,\n onTriggerKeyDown,\n hoverEnabled,\n hoverTriggerHandlers,\n hoverSurfaceHandlers,\n openOnContext,\n contextTriggerHandlers,\n contextSurfaceHandlers,\n keyboardContext,\n onContentKeyDown,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n positioning?.fitViewport,\n ],\n );\n\n return <PopoverContext.Provider value={context}>{children}</PopoverContext.Provider>;\n};\n\nPopoverRoot.displayName = 'Popover';\n\n/**\n * The element that toggles the popover. Its props are merged onto the single child (no wrapper\n * element): `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), an `id` that\n * labels the content, a composed `onClick` and the ref used as positioning anchor and focus-return\n * target. The child's own `id`, handlers and classes are kept; the live state ARIA always wins.\n * A render function receives the props instead (spread all of them, `id` included: the content is\n * named by it); `asChild={false}` renders the 0.4 wrapper span, and a custom child that neither\n * forwards `ref` nor spreads its props falls back to that span automatically (with a development\n * warning). On the span, the state ARIA goes to the first element in the tab order inside it, and\n * focus returns to that element (to the span when you made it the trigger with a `role` such as\n * `button` and `tabIndex={0}`, or when nothing inside it can take focus).\n *\n * With `openOnHover` a mouse pointer resting on it opens the popover, and a click pins a\n * hover-opened popover instead of closing it. With `openOnContext` it is a context-menu region (a\n * list, a row, a canvas) instead of a button: it receives its `id` and the context-menu and key\n * handlers, but no state ARIA and no click toggle (a render function still receives every prop:\n * do not spread the state ARIA then).\n *\n * A Tooltip goes between the trigger and the button: it passes the trigger's `id` and ARIA on to\n * the button, which the Tooltip also describes.\n *\n * @example\n * <Popover.Trigger>\n * <Tooltip content=\"Narrow the list\">\n * <Button>Filters</Button>\n * </Tooltip>\n * </Popover.Trigger>\n *\n * Also exported as `PopoverTrigger` for React Server Components, which cannot use the dotted\n * `Popover.Trigger` (that needs a client file).\n */\nexport const PopoverTrigger = ({\n children,\n asChild,\n id: idProp,\n onClick,\n onKeyDown,\n onContextMenu,\n onPointerEnter,\n onPointerMove,\n onPointerLeave,\n ref,\n ...rest\n}: PopoverTriggerProps) => {\n const {\n open,\n contentId,\n triggerId,\n triggerElementRef,\n setResolvedTriggerId,\n onTriggerClick,\n onTriggerKeyDown,\n hoverTriggerHandlers: hover,\n contextMode,\n contextTriggerHandlers: gesture,\n } = usePopoverContext('Popover.Trigger');\n const elementRef = useMergedRefs<HTMLElement>(ref, triggerElementRef);\n\n // On a wrapper span (`asChild={false}`, the automatic fallback) useTriggerElement moves the\n // state ARIA onto the first element in the tab order inside it. The hover handlers are there\n // only with `openOnHover`, the context handlers only with `openOnContext`. A context region is\n // no popover button: it gets no state ARIA and no click toggle (useTriggerElement\n // `omitStateAria`), and a render-prop child reads a constant closed state.\n const triggerProps = {\n ...rest,\n id: idProp ?? triggerId,\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': contextMode ? false : open,\n 'aria-controls': open && !contextMode ? contentId : undefined,\n onClick: composeEventHandlers(onClick, contextMode ? undefined : onTriggerClick),\n onKeyDown: composeEventHandlers(\n onKeyDown,\n gesture ? composeEventHandlers(gesture.onKeyDown, onTriggerKeyDown) : onTriggerKeyDown,\n ),\n onContextMenu: gesture\n ? composeEventHandlers(onContextMenu, gesture.onContextMenu)\n : onContextMenu,\n onPointerEnter: hover\n ? composeEventHandlers(onPointerEnter, hover.onPointerEnter)\n : onPointerEnter,\n onPointerMove: hover ? composeEventHandlers(onPointerMove, hover.onPointerMove) : onPointerMove,\n onPointerLeave: hover\n ? composeEventHandlers(onPointerLeave, hover.onPointerLeave)\n : onPointerLeave,\n ref: elementRef,\n } as PopoverTriggerChildProps;\n\n return useTriggerElement(children, triggerProps, {\n componentName: 'Popover.Trigger',\n asChild,\n onResolvedId: setResolvedTriggerId,\n omitStateAria: contextMode,\n });\n};\nPopoverTrigger.displayName = 'PopoverTrigger';\n\n/**\n * The popover surface: a non-modal `role=\"dialog\"` rendered in a portal (so overflow containers\n * never clip it) and positioned next to the trigger with a beak, flipping and shifting to stay in\n * the viewport. It closes on Escape and on a press outside (presses inside nested overlays opened\n * from it count as inside), and focus returns to the trigger when it closes while focus was inside.\n * In the keyboard order it follows the trigger, like inline content: Tab from the open trigger\n * enters it, Tab past its last element continues after the trigger, and Shift+Tab from the element\n * after the trigger enters it at its last element. Tab from the last element of the page moves\n * past it, and Shift+Tab from outside the page reaches the page's last element first, so a lap\n * visits it once. For a trigger outside the tab order (nothing in it can take focus, or\n * `tabIndex={-1}`), Tab from the tab stop before the trigger enters it, and Shift+Tab from its\n * first element returns to the trigger, or to that tab stop when nothing in the trigger can take\n * focus. With no tab stop before the trigger, the content is reached at the end of the page.\n * Named by `title`, `aria-label`/`aria-labelledby`, or else by its trigger: `aria-labelledby`\n * points at the id the trigger element carries in the document, or at the trigger's own label\n * elements when the trigger is named through `aria-labelledby` (an icon-only Button inside\n * `Tooltip relationship=\"label\"`); never at a missing id. A development warning names the problem\n * when the trigger has no id or no text. With `openOnContext` it is never named by the trigger (a\n * region's text is no name): pass `title`, `aria-label` or `aria-labelledby` (a development\n * warning otherwise). A consumer `id` is kept, and the trigger's `aria-controls` follows it. The\n * beak inherits the surface's background and border colors, so a `className` that changes them\n * restyles the beak too.\n *\n * With `openOnContext` it opens at the pointer of a right click, or at the focused row for\n * Shift+F10 and the ContextMenu key, and it follows that row in the keyboard order; with a\n * `target` it is placed at the target and, without a trigger, follows a target element in the\n * keyboard order.\n *\n * It moves in and out: the surface fades in and slides 4px away from its trigger over 200 ms, and\n * fades out and slides back over 100 ms, on the side it opened on (`data-side`); a popover open by\n * default animates in when it mounts in the browser. Under reduced motion it appears and\n * disappears at once. `motion` turns the motion off (`null`) or replaces its classes, and a\n * `WaveProvider` with `motion=\"none\"` turns the default off. The surface mounts through the\n * presence core (`usePresence`): it carries `data-presence=\"entering\" | \"entered\" | \"exiting\"` and\n * `data-state=\"open\"`, and while it closes `data-state=\"closed\"` and `inert`, so it stays on\n * screen, where it was, until its exit motion ends. Focus, the dismiss layer, the trigger's\n * `aria-expanded` and `aria-controls`, and positioning follow the open state, not the exit: focus\n * inside a closing popover moves, in the commit that closes it, to where the popover returns\n * focus (so a Dialog opened by a button of the popover as it closes returns focus there too, not\n * to that button), and a hover close moves no focus. Without motion it unmounts as soon as it\n * closes.\n *\n * Also exported as `PopoverContent` for React Server Components, which cannot use the dotted\n * `Popover.Content` (that needs a client file).\n */\nexport const PopoverContent = ({\n children,\n title,\n id: idProp,\n className,\n style,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n onKeyDown,\n onContextMenu,\n onPointerEnter,\n onPointerLeave,\n motion,\n ref,\n ...rest\n}: PopoverContentProps) => {\n const {\n open,\n contentId,\n setCustomContentId,\n resolvedTriggerId,\n triggerRef,\n triggerElement,\n surfaceElementRef,\n arrowRef,\n layerId,\n floatingProps,\n arrowStyles,\n placedSide,\n fitViewport,\n onContentKeyDown,\n hoverSurfaceHandlers: hover,\n contextMode,\n onContentContextMenu,\n keyboardContext,\n } = usePopoverContext('Popover.Content');\n const titleId = useId('popover-title');\n // The surface mounts and unmounts through the presence core, and enters also when it mounts open\n // (a popover open by default animates in on a client render as after hydration); the root keys\n // everything else on `open`, so focus moves out and the layer goes on close, not after the exit.\n const { isMounted, ref: presenceRef, presenceProps } = usePresence(open, { appear: true });\n const motionClassName = useMotionClasses(motion, popupMotion);\n const elementRef = useMergedRefs<HTMLDivElement>(ref, surfaceElementRef, presenceRef);\n const hasTitle = slotRendersContent(title);\n const unnamed = ariaLabelledBy === undefined && !ariaLabel && !hasTitle;\n // A context region is no popover button, and its whole text is no name: in context mode the\n // content is never labelled by the trigger.\n const checkTrigger = open && unnamed && !contextMode;\n\n // The trigger's label ids in the document, re-read when the trigger's ids or labels change: a\n // Tooltip between Popover.Trigger and the Button leaves the Button's own id in place (and with\n // `relationship=\"label\"` names it through `aria-labelledby`), and a render-prop child may not\n // spread `id` at all — never point aria-labelledby at an id that is not there.\n const subscribeTrigger = React.useCallback(\n (onChange: () => void) => {\n if (!checkTrigger || !triggerElement || typeof MutationObserver === 'undefined') {\n return subscribeNothing();\n }\n const observer = new MutationObserver(onChange);\n observer.observe(triggerElement, {\n attributes: true,\n attributeFilter: ['id', 'aria-labelledby'],\n childList: true,\n subtree: true,\n });\n return () => observer.disconnect();\n },\n [checkTrigger, triggerElement],\n );\n const triggerLabelId = React.useSyncExternalStore(\n subscribeTrigger,\n () => (checkTrigger ? findTriggerLabelId(triggerElement, resolvedTriggerId) : undefined),\n () => (checkTrigger ? resolvedTriggerId : undefined),\n );\n\n const labelledBy =\n ariaLabelledBy ?? (ariaLabel ? undefined : hasTitle ? titleId : triggerLabelId);\n const customId = idProp || undefined;\n\n // Report the consumer's id to the root so the trigger's `aria-controls` points at it.\n React.useEffect(() => {\n setCustomContentId(customId);\n return () => setCustomContentId(undefined);\n }, [customId, setCustomContentId]);\n\n React.useEffect(() => {\n if (!open || !unnamed || !contextMode || !isDev) return;\n warnOnce(\n 'Popover.Content:name',\n 'Popover.Content: the popover has no accessible name. A context popover (openOnContext) is not named by its region: pass `title`, `aria-label` or `aria-labelledby`.',\n );\n }, [open, unnamed, contextMode]);\n\n React.useEffect(() => {\n if (!checkTrigger || !isDev) return;\n // Read after commit: a trigger's ref is attached by now even before it reported its id.\n const trigger = triggerRef.current;\n if (!trigger) {\n warnOnce(\n 'Popover.Content:name',\n 'Popover.Content: the popover has no accessible name. Pass `title`, `aria-label` or `aria-labelledby`, or open it from a Popover.Trigger.',\n );\n return;\n }\n const labelIds = findTriggerLabelId(trigger, resolvedTriggerId);\n if (!labelIds) {\n warnOnce(\n 'Popover.Content:trigger-id',\n 'Popover.Content: the popover is named by its trigger, but the trigger element has no `id` (a render-prop child of Popover.Trigger must spread the `id` it receives), so the popover has no accessible name. Spread every trigger prop onto the element, or pass `title`, `aria-label` or `aria-labelledby`.',\n );\n } else if (!referencesText(trigger.ownerDocument, labelIds)) {\n warnOnce(\n 'Popover.Content:trigger-name',\n 'Popover.Content: the popover is named by its trigger, but the trigger has no text to name it (an icon-only trigger needs `aria-label`, or `aria-labelledby` pointing at text), so the popover has no accessible name. Name the trigger, or pass `title`, `aria-label` or `aria-labelledby`.',\n );\n }\n }, [checkTrigger, resolvedTriggerId, triggerRef, triggerLabelId]);\n\n if (!isMounted) return null;\n\n const titleAndChildren = (\n <>\n {hasTitle && (\n <h2\n id={titleId}\n className={cn(popoverContentClassNames.title, 'mb-2 text-subtitle-2 font-semibold')}\n >\n {title}\n </h2>\n )}\n {children}\n </>\n );\n\n return (\n <Portal layerId={layerId}>\n <div\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n tabIndex={keyboardContext ? -1 : undefined}\n {...rest}\n {...presenceProps}\n ref={elementRef}\n id={customId ?? contentId}\n data-state={open ? 'open' : 'closed'}\n data-side={floatingProps['data-side']}\n data-align={floatingProps['data-align']}\n style={{ ...style, ...floatingProps.style }}\n onKeyDown={composeEventHandlers(onKeyDown, onContentKeyDown)}\n onContextMenu={composeEventHandlers(onContextMenu, onContentContextMenu)}\n onPointerEnter={\n hover ? composeEventHandlers(onPointerEnter, hover.onPointerEnter) : onPointerEnter\n }\n onPointerLeave={\n hover ? composeEventHandlers(onPointerLeave, hover.onPointerLeave) : onPointerLeave\n }\n className={cn(\n popoverContentClassNames.root,\n 'w-64 rounded-md border border-border bg-background p-4 text-body-1 font-normal text-foreground normal-case tracking-normal text-start shadow-4',\n motionClassName,\n className,\n )}\n >\n <PopoverBeak\n ref={arrowRef}\n side={placedSide}\n style={arrowStyles}\n data-wave-popover-arrow=\"\"\n className={popoverContentClassNames.beak}\n />\n {fitViewport ? (\n // The beak sits half outside the border, so the scroller is inside it: the viewport\n // limit minus the content's padding (2 x 1rem) and border (2 x 1px).\n <div className=\"overflow-y-auto max-h-[calc(var(--wave-popup-available-height)-2rem-2px)]\">\n {titleAndChildren}\n </div>\n ) : (\n titleAndChildren\n )}\n </div>\n </Portal>\n );\n};\nPopoverContent.displayName = 'PopoverContent';\n\n/**\n * A non-modal popup anchored to a trigger: `Popover.Trigger` (merges its props onto the child\n * button) and `Popover.Content` (portaled, positioned `role=\"dialog\"` surface). Use it for custom\n * popups such as filters or details; for a menu button use `Menu.Trigger` and `Menu.Popover`,\n * which add menu semantics and keyboard support.\n *\n * Controlled (`open`/`onOpenChange`) or uncontrolled (`defaultOpen`); `side`/`align` place the\n * content, and `ignoreOutsideRefs` lists external elements (such as a toggle button) whose presses\n * do not dismiss it.\n *\n * - **Hover cards:** `openOnHover` opens it when a mouse pointer rests on the trigger\n * (`openDelay`) and closes it once the pointer has left the trigger and the content\n * (`closeDelay`), unless focus is inside; a click on the trigger pins it.\n * - **Context popovers:** `openOnContext` makes the trigger a context-menu region: a right click\n * opens it at the pointer, Shift+F10 or the ContextMenu key at the focused row (with focus\n * moving into the content). Name the content with `title` or `aria-label`.\n * - **Custom anchors:** `target` places it at another element or at a `VirtualElement` (a point, a\n * text selection); with a controlled `open` it needs no trigger.\n * - **Motion:** the content fades and slides in from its trigger and back out as it closes;\n * `Popover.Content`'s `motion` turns it off or replaces it.\n *\n * @example\n * <Popover>\n * <Popover.Trigger><Button>Details</Button></Popover.Trigger>\n * <Popover.Content title=\"Details\">…</Popover.Content>\n * </Popover>\n */\nexport const Popover = /* @__PURE__ */ Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n});\n"],"mappings":"imCA+PA,IAAM0D,EAAiB1D,EAAM,cAA0C,IAAI,EAC3E,EAAe,YAAc,iBAE7B,IAAI2D,EAA2C,KAG/C,SAASC,GAAuC,CA6B9C,MA5BA,KAAiB,CACf,KAAM,GACN,YAAe,CAAC,EAChB,UAAW,6BACX,uBAA0B,CAAC,EAC3B,UAAW,6BACX,kBAAmB,IAAA,GACnB,yBAA4B,CAAC,EAC7B,WAAY,CAAE,QAAS,IAAK,EAC5B,eAAgB,KAChB,sBAAyB,CAAC,EAC1B,sBAAyB,CAAC,EAC1B,SAAU,CAAE,QAAS,IAAK,EAC1B,mBAAsB,CAAC,EACvB,qBAAwB,CAAC,EACzB,qBAAsB,KACtB,qBAAsB,KACtB,YAAa,GACb,uBAAwB,KACxB,yBAA4B,CAAC,EAC7B,gBAAiB,GACjB,qBAAwB,CAAC,EACzB,QAAS,2BACT,cAAe,CAAE,YAAa,SAAU,aAAc,QAAS,MAAO,CAAC,CAAE,EACzE,YAAa,CAAC,EACd,WAAY,SACZ,YAAa,EACf,EACOD,CACT,CAEA,SAASE,EAAkB,EAA4C,CAIrE,OAHgB7D,EAAM,WAAW0D,CAC7B,IACJzB,EAAA,qBAAqB6B,EAAe,SAAS,EACtCF,EAAgB,EACzB,CAGA,SAASG,EAAW,EAAe,EAAwC,CACzE,IAAMC,GAAWC,GAAO,GAAA,CAAI,MAAM,KAAK,CAAC,CAAC,OAAQ,GAAOC,GAAMC,EAAI,eAAeD,CAAE,CAAC,EACpF,OAAOF,EAAQ,OAAS,EAAIA,EAAQ,KAAK,GAAG,EAAI,IAAA,EAClD,CAeA,SAASI,EACP,EACA,EACoB,CACpB,GAAI,CAACC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