@mortenbrudvik/waveui 0.10.0 → 0.11.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 +357 -72
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +25 -30
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.navigation.cjs +2 -0
- package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
- package/dist/components/button/Toolbar.navigation.mjs +17 -0
- package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.cjs +2 -0
- package/dist/components/data-display/Avatar.context.cjs.map +1 -0
- package/dist/components/data-display/Avatar.context.mjs +9 -0
- package/dist/components/data-display/Avatar.context.mjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +66 -61
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/InteractionTag.cjs +2 -0
- package/dist/components/data-display/InteractionTag.cjs.map +1 -0
- package/dist/components/data-display/InteractionTag.mjs +234 -0
- package/dist/components/data-display/InteractionTag.mjs.map +1 -0
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +222 -90
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/data-display/TagGroup.cjs +2 -0
- package/dist/components/data-display/TagGroup.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.cjs +2 -0
- package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.mjs +113 -0
- package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
- package/dist/components/data-display/TagGroup.mjs +149 -0
- package/dist/components/data-display/TagGroup.mjs.map +1 -0
- package/dist/components/data-display/tagStyles.cjs +2 -0
- package/dist/components/data-display/tagStyles.cjs.map +1 -0
- package/dist/components/data-display/tagStyles.mjs +108 -0
- package/dist/components/data-display/tagStyles.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +213 -181
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +7 -7
- package/dist/components/input/Combobox.expand.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.mjs +16 -11
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.context.cjs +2 -0
- package/dist/components/input/TagPicker.context.cjs.map +1 -0
- package/dist/components/input/TagPicker.context.mjs +20 -0
- package/dist/components/input/TagPicker.context.mjs.map +1 -0
- package/dist/components/input/TagPicker.create.cjs +2 -0
- package/dist/components/input/TagPicker.create.cjs.map +1 -0
- package/dist/components/input/TagPicker.create.mjs +24 -0
- package/dist/components/input/TagPicker.create.mjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +13 -279
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.option.cjs +2 -0
- package/dist/components/input/TagPicker.option.cjs.map +1 -0
- package/dist/components/input/TagPicker.option.mjs +45 -0
- package/dist/components/input/TagPicker.option.mjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.cjs +2 -0
- package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.mjs +153 -0
- package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
- package/dist/components/input/TagPicker.parts.cjs +2 -0
- package/dist/components/input/TagPicker.parts.cjs.map +1 -0
- package/dist/components/input/TagPicker.parts.mjs +425 -0
- package/dist/components/input/TagPicker.parts.mjs.map +1 -0
- package/dist/components/input/TagPicker.root.cjs +2 -0
- package/dist/components/input/TagPicker.root.cjs.map +1 -0
- package/dist/components/input/TagPicker.root.mjs +416 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/navigation/Hamburger.cjs +2 -0
- package/dist/components/navigation/Hamburger.cjs.map +1 -0
- package/dist/components/navigation/Hamburger.mjs +54 -0
- package/dist/components/navigation/Hamburger.mjs.map +1 -0
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.context.cjs +2 -0
- package/dist/components/navigation/Nav.context.cjs.map +1 -0
- package/dist/components/navigation/Nav.context.mjs +137 -0
- package/dist/components/navigation/Nav.context.mjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +151 -258
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Nav.parts.cjs +2 -0
- package/dist/components/navigation/Nav.parts.cjs.map +1 -0
- package/dist/components/navigation/Nav.parts.mjs +77 -0
- package/dist/components/navigation/Nav.parts.mjs.map +1 -0
- package/dist/components/navigation/Nav.root.cjs +2 -0
- package/dist/components/navigation/Nav.root.cjs.map +1 -0
- package/dist/components/navigation/Nav.root.mjs +78 -0
- package/dist/components/navigation/Nav.root.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.cjs +2 -0
- package/dist/components/navigation/NavDrawer.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.cjs +2 -0
- package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.mjs +11 -0
- package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.mjs +179 -0
- package/dist/components/navigation/NavDrawer.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +190 -125
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.cjs +1 -1
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.mjs +157 -81
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +2 -0
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
- package/dist/components/overlays/Dialog.slots.mjs +129 -0
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.context.cjs +2 -0
- package/dist/components/overlays/Drawer.context.cjs.map +1 -0
- package/dist/components/overlays/Drawer.context.mjs +29 -0
- package/dist/components/overlays/Drawer.context.mjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +12 -187
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +2 -0
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
- package/dist/components/overlays/Drawer.panel.mjs +159 -0
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.cjs +2 -0
- package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.mjs +152 -0
- package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
- package/dist/components/overlays/Drawer.root.cjs +2 -0
- package/dist/components/overlays/Drawer.root.cjs.map +1 -0
- package/dist/components/overlays/Drawer.root.mjs +207 -0
- package/dist/components/overlays/Drawer.root.mjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.cjs +2 -0
- package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.mjs +42 -0
- package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs +115 -98
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +35 -22
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- package/dist/hooks/useRestoreFocus.cjs +1 -1
- package/dist/hooks/useRestoreFocus.cjs.map +1 -1
- package/dist/hooks/useRestoreFocus.mjs +91 -78
- package/dist/hooks/useRestoreFocus.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +102 -78
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2226 -221
- package/dist/index.d.ts +2226 -221
- package/dist/index.mjs +115 -107
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +137 -77
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +13 -6
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +53 -47
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavDrawer.cjs","names":["React","NavDrawerLayoutContext","useModalOpenState","useDrawerOpen","useNavRootState","useId","useScrollState","isDev","hasWarned","DrawerPanel","inertModalTrigger","cn","drawerClassNames","navDrawerClassNames","NavContext","NavDrawerContext","navDrawerHeaderClassNames","scrollSeparatorClasses","useRovingTabIndex","TOOLBAR_ITEM_SELECTOR","useMergedRefs","composeEventHandlers","navDrawerBodyClassNames","NavRovingContext","navDrawerFooterClassNames","require_runtime","require_cn","require_dev","require_composeEventHandlers","require_classNames","require_useId","require_useRovingTabIndex","require_useMergedRefs","require_Toolbar_navigation","require_Nav_context","require_Nav_root","require_Dialog_shared","require_Drawer_panel","require_Drawer_scroll","require_NavDrawer_context","react","react_jsx_runtime","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","LOOSE_ITEMS_WARNING_KEY","LOOSE_ITEMS_WARNING","hasLooseListItem","item","nav","parent","INERT_LAYOUT","useNavDrawerLayout","componentName","NavDrawerRoot","openProp","modalTypeProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","rest","openState","requestOpen","defaultOpen","onOpenChange","open","type","navState","defaultValue","onItemSelect","modalType","generatedId","panelId","id","body","setBody","registerBody","previous","element","scrollState","layout","drawer","unreachable","navRef","nameProps","panelNameProps","panel","NavDrawerHeader","className","NavDrawerBody","arrow","focusMode","currentCategory","setCurrentCategory","reportCurrentCategory","holdsCurrent","category","roving","selected","activeValue","attachBody","mergedRef","ref","containerProps","listRef","onKeyDown","onFocus","NavDrawerFooter","NavDrawer"],"sources":["../../../src/components/navigation/NavDrawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport {\n drawerClassNames,\n navDrawerBodyClassNames,\n navDrawerClassNames,\n navDrawerFooterClassNames,\n navDrawerHeaderClassNames,\n} from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { hasWarned, isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport type { Slot, SlotObject } from '../../lib/slot';\nimport type { BackdropAppearance, FocusMode, ModalType } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { TOOLBAR_ITEM_SELECTOR } from '../button/Toolbar.navigation';\nimport {\n inertModalTrigger,\n useModalOpenState,\n useModalTriggerSession,\n} from '../overlays/Dialog.shared';\nimport type {\n DrawerOpenChangeDetails,\n DrawerPosition,\n DrawerSize,\n DrawerType,\n} from '../overlays/Drawer.context';\nimport { DrawerPanel, useDrawerOpen } from '../overlays/Drawer.panel';\nimport { scrollSeparatorClasses, useScrollState } from '../overlays/Drawer.scroll';\nimport {\n NavContext,\n NavRovingContext,\n useNavListChildCheck,\n type NavRovingContextValue,\n} from './Nav.context';\nimport { useNavRootState, type NavProps } from './Nav.root';\nimport {\n NavDrawerContext,\n NavDrawerLayoutContext,\n type NavDrawerContextValue,\n type NavDrawerLayoutContextValue,\n} from './NavDrawer.context';\n\n/*\n * NavDrawer: Nav's state (`useNavRootState`) and a navigation landmark in the drawer panel shell\n * (`DrawerPanel`), with its Header, Body and Footer parts. Imports the Nav root and context modules\n * (never `Nav.tsx`) and the shell's modules (never Drawer's root or compound); Nav never imports\n * it, and `Hamburger.tsx` reads only `NavDrawer.context.ts`.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Properties for the NavDrawer component. */\nexport interface NavDrawerProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'>,\n Pick<\n NavProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'openCategories'\n | 'defaultOpenCategories'\n | 'onOpenCategoriesChange'\n | 'currentCategory'\n > {\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 (in the browser only: an\n * open overlay is closed in the server HTML and opens once hydrated). Modal by default: focus\n * moves in and stays there, the rest of the page is `inert` and does not scroll, and Escape\n * and a backdrop press close it. It is a dialog with the navigation's name.\n * - `inline`: a panel in the page layout, rendered where the NavDrawer is (also in the server\n * HTML). The page stays usable around it; Escape and presses outside do nothing; opening it\n * moves no focus, and closing it while focus is inside returns focus to `finalFocusRef`, else\n * to the element that opened it.\n *\n * Changing `type` remounts the panel; the selection and the open categories are kept. Rendered\n * as `data-type`.\n * @default 'overlay'\n */\n type?: DrawerType;\n /** Controlled open state. */\n open?: boolean;\n /**\n * Open state for uncontrolled usage. Keep the drawer controlled instead: a closed uncontrolled\n * NavDrawer cannot be opened again (a Hamburger inside it is not shown while it is closed).\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes, with `details.reason`: `trigger` (a Hamburger\n * inside the drawer), `escape` and `outside-press` (the backdrop; overlay only). `details` is\n * typed optional until 1.0. A controlled drawer stays as it is until you update `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * Called with an item's value every time an item is activated, also when the current page is\n * activated again (a disabled item, a link opened in another tab or window, and a button item\n * whose `onClick` calls `preventDefault()` are not activations). Close an overlay drawer here:\n * `onValueChange` fires only when the value changes. Fluent's `onNavItemSelect`.\n */\n onItemSelect?: (value: string) => void;\n /**\n * The edge the panel is attached to: an overlay's screen edge; an inline panel's inner edge is\n * the opposite one. `start`/`end` follow the text direction; `left`/`right` are physical sides;\n * `bottom` runs along the bottom edge. Unlike Drawer's (`'end'`), the default is the start edge,\n * where navigation sits (Fluent's). Rendered as `data-position`.\n * @default 'start'\n */\n position?: DrawerPosition;\n /**\n * The panel's width at a side (its height at the bottom), on Drawer's scale: `small` 320px,\n * `medium` 592px, `large` 940px, `full` the viewport (inline: the container). A width class in\n * `className` replaces it (Fluent's navigation pane is 260px wide: the width class of 65\n * spacing steps). Rendered as `data-size`. Drawer's default too.\n * @default 'small'\n */\n size?: DrawerSize;\n /**\n * Inline drawers: draws a line on the panel's inner edge (`data-separator`), as Nav does\n * (Drawer's `separator` defaults to `false`). An overlay always draws that edge; forced colours\n * always draw it.\n * @default true\n */\n separator?: boolean;\n /**\n * Overlay drawers: `modal` (backdrop, focus trapped, page inert and not scrolling) or\n * `non-modal` (no backdrop, no trap, nothing inert; Escape closes it while focus is inside, and\n * its Tab place follows the element that opened it). A non-modal overlay covers the page under\n * it while the page keeps its Tab order: keep the page's controls clear of it (reserve its width,\n * or its height at the bottom, in your layout while it is open) or use `type=\"inline\"`; with\n * `size=\"full\"` it hides the whole page and warns. Ignored by inline drawers. Rendered as\n * `data-modal-type` on an overlay's panel. Fluent's `modalType` (without `alert`: a navigation\n * pane is never an alert, so an `'alert'` is treated as `'modal'`). Drawer's default too.\n * @default 'modal'\n */\n modalType?: Extract<ModalType, 'modal' | 'non-modal'>;\n /**\n * Removes the panel when the drawer closes. `false` keeps it mounted while closed, out of view\n * and `inert`, so the state of what is inside survives, and a Hamburger outside can point\n * `aria-controls` at it at all times: always for an inline drawer, and once the page has\n * hydrated for an overlay (whose panel is not in the server HTML). Fluent's `unmountOnClose`.\n * Drawer's default too.\n * @default true\n */\n unmountOnClose?: boolean;\n /**\n * Where focus goes when the drawer closes with focus inside it (a modal overlay: whenever it\n * closes). Pass your page's Hamburger, so a Hamburger inside the drawer that closes it hands\n * focus to the one that opens it again.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * The backdrop of a modal overlay (Drawer's `backdrop` slot: `null` renders none, a slot\n * object's `appearance` picks the fill). Ignored, with a development warning, by a non-modal or\n * inline drawer.\n */\n backdrop?: Slot<'div'> | (SlotObject<'div'> & { appearance?: BackdropAppearance });\n /**\n * Name of the navigation landmark (and of an overlay's dialog). Localize it; rename it when the\n * page has another navigation landmark (two with one name are ambiguous). An `aria-labelledby`\n * replaces the default.\n * @default 'Navigation'\n */\n 'aria-label'?: string;\n /** `NavDrawer.Header`, `NavDrawer.Body` and `NavDrawer.Footer`, rendered in the order written. */\n children?: React.ReactNode;\n /** Ref to the panel: the `role=\"dialog\"` element of an overlay drawer, the panel element of an inline one. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerHeader sub-component. */\nexport interface NavDrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** A Hamburger, the app's name, …: any content (Nav items go in the body or the footer). */\n children?: React.ReactNode;\n /** Ref to the header element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerBody sub-component. */\nexport interface NavDrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * How the keyboard reaches the items. `'tab'`: every item is a Tab stop and the arrow keys do\n * nothing (Nav's model). `'arrow'`: the body is one Tab stop, the last focused element (at first\n * the current page, or the closed category that holds it, else the first item); Down and Right\n * move to the next element and Up and Left to the previous one (Left and Right swap in a\n * right-to-left layout), wrapping, and Home and End go to the ends. Every focusable element in\n * the body joins the order, item actions included. Screen readers do not announce arrow keys in\n * a navigation landmark: prefer `'tab'` unless your users expect an app pane. Rendered as\n * `data-focus-mode`. Fluent's NavDrawer uses arrow keys by default (its `tabbable` adds Tab\n * stops).\n * @default 'tab'\n */\n focusMode?: FocusMode;\n /** Nav parts: `Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, … (each renders its own list item). */\n children?: React.ReactNode;\n /** Ref to the scrolling body element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerFooter sub-component. */\nexport interface NavDrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Nav parts pinned below the body (Settings, Help); wrap other content in an `<li>`. */\n children?: React.ReactNode;\n /** Ref to the footer element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Development checks\n// ---------------------------------------------------------------------------\n\nconst UNREACHABLE_WARNING_KEY = 'NavDrawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'NavDrawer is closed and nothing can open it: it is uncontrolled (no `open` prop), and a Hamburger inside it cannot be reached while it is closed. Control it with `open` and `onOpenChange`, and open it from a Hamburger (or any button) outside it.';\n\nconst LOOSE_ITEMS_WARNING_KEY = 'NavDrawer:loose-items';\nconst LOOSE_ITEMS_WARNING =\n 'NavDrawer: a list item sits outside NavDrawer.Body and NavDrawer.Footer, the parts that render a list. Move Nav.Item, Nav.Category and the other Nav parts into NavDrawer.Body or NavDrawer.Footer.';\n\n/** Whether `nav` holds an `<li>` whose parent is not a `<ul>` or `<ol>`. */\nfunction hasLooseListItem(nav: HTMLElement): boolean {\n for (const item of Array.from(nav.querySelectorAll('li'))) {\n const parent = item.parentElement?.localName;\n if (parent !== 'ul' && parent !== 'ol') return true;\n }\n return false;\n}\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\n/** The scroll state and body registry the parts read outside a NavDrawer in production. */\nconst INERT_LAYOUT: NavDrawerLayoutContextValue = {\n scrollState: 'none',\n registerBody: () => () => {},\n};\n\n/** C-CONTEXT: the enclosing NavDrawer's layout for the part `componentName`. */\nfunction useNavDrawerLayout(componentName: string): NavDrawerLayoutContextValue {\n const context = React.useContext(NavDrawerLayoutContext);\n if (context) return context;\n reportMissingContext(componentName, 'NavDrawer');\n return INERT_LAYOUT;\n}\n\n// The root of `NavDrawer` (documented on the export below).\nconst NavDrawerRoot = ({\n type = 'overlay',\n open: openProp,\n defaultOpen,\n onOpenChange,\n onItemSelect,\n position = 'start',\n size = 'small',\n separator = true,\n modalType: modalTypeProp = 'modal',\n unmountOnClose = true,\n finalFocusRef,\n backdrop,\n value,\n defaultValue,\n onValueChange,\n openCategories,\n defaultOpenCategories,\n onOpenCategoriesChange,\n currentCategory,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n id,\n children,\n ref,\n ...rest\n}: NavDrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // An overlay reports itself closed until the page has hydrated (its portal renders only in the\n // browser), so a Hamburger's aria-controls never names a panel that is not there.\n const open = useDrawerOpen(type, openState);\n const navState = useNavRootState({\n componentName: 'NavDrawer',\n value,\n defaultValue: defaultValue ?? '',\n onValueChange,\n onActivate: onItemSelect,\n openCategories,\n defaultOpenCategories,\n onOpenCategoriesChange,\n currentCategory,\n children,\n });\n // A navigation pane is never an alert: an 'alert' passed at run time is a modal one.\n const modalType: ModalType = modalTypeProp === 'non-modal' ? 'non-modal' : 'modal';\n const generatedId = useId('wave-nav-drawer');\n const panelId = id ?? generatedId;\n\n // The first mounted body, measured for the scroll-state separators of the parts.\n const [body, setBody] = React.useState<HTMLElement | null>(null);\n const registerBody = React.useCallback((element: HTMLElement) => {\n setBody((previous) => previous ?? element);\n return () => setBody((previous) => (previous === element ? null : previous));\n }, []);\n const scrollState = useScrollState(body);\n const layout = React.useMemo<NavDrawerLayoutContextValue>(\n () => ({ scrollState, registerBody }),\n [scrollState, registerBody],\n );\n const drawer = React.useMemo<NavDrawerContextValue>(\n () => ({ open, requestOpen, panelId, type }),\n [open, requestOpen, panelId, type],\n );\n\n // An uncontrolled drawer that is closed has no way back: its Hamburgers are inside it.\n const unreachable = openProp === undefined && !openState;\n React.useEffect(() => {\n if (unreachable) warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }, [unreachable]);\n\n // Development only: after every commit, a list item outside the Body's and Footer's lists.\n const navRef = React.useRef<HTMLElement>(null);\n React.useEffect(() => {\n if (!isDev || hasWarned(LOOSE_ITEMS_WARNING_KEY)) return;\n const nav = navRef.current;\n if (nav && hasLooseListItem(nav)) warnOnce(LOOSE_ITEMS_WARNING_KEY, LOOSE_ITEMS_WARNING);\n });\n\n // The name goes to the <nav> in both types and, in an overlay, also to its dialog panel. An\n // aria-labelledby without aria-label drops the default.\n const nameProps = {\n 'aria-label': ariaLabel ?? (ariaLabelledBy === undefined ? 'Navigation' : undefined),\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n };\n const panelNameProps = type === 'overlay' ? nameProps : undefined;\n\n const panel = (\n <DrawerPanel\n componentName=\"NavDrawer\"\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=\"div\"\n trigger={inertModalTrigger}\n finalFocusRef={finalFocusRef}\n rootClassName={cn(drawerClassNames.root, navDrawerClassNames.root)}\n backdropClassName={cn(drawerClassNames.backdrop, navDrawerClassNames.backdrop)}\n backdrop={backdrop}\n id={panelId}\n {...panelNameProps}\n {...rest}\n ref={ref as React.Ref<HTMLElement> | undefined}\n >\n <nav\n ref={navRef}\n {...nameProps}\n className={cn(navDrawerClassNames.nav, 'flex min-h-0 flex-1 flex-col')}\n >\n {children}\n </nav>\n </DrawerPanel>\n );\n // After the shell's effects (focus restore), as the shell's contract asks.\n useModalTriggerSession(inertModalTrigger, open);\n\n return (\n <NavContext.Provider value={navState}>\n <NavDrawerContext.Provider value={drawer}>\n <NavDrawerLayoutContext.Provider value={layout}>{panel}</NavDrawerLayoutContext.Provider>\n </NavDrawerContext.Provider>\n </NavContext.Provider>\n );\n};\nNavDrawerRoot.displayName = 'NavDrawer';\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\n/**\n * The header row of a NavDrawer: a Hamburger, the app's name, … (no list: Nav items go in the\n * body or the footer). Its line underneath shows while the body is scrolled away from its top.\n */\nexport const NavDrawerHeader = ({ className, children, ref, ...rest }: NavDrawerHeaderProps) => {\n const { scrollState } = useNavDrawerLayout('NavDrawer.Header');\n return (\n <div\n data-scroll-state={scrollState}\n {...rest}\n ref={ref}\n className={cn(\n navDrawerHeaderClassNames.root,\n 'flex shrink-0 items-center gap-2 ps-2.5 pe-2 py-2',\n scrollSeparatorClasses.header,\n className,\n )}\n >\n {children}\n </div>\n );\n};\nNavDrawerHeader.displayName = 'NavDrawerHeader';\n\n/**\n * The scrolling list of a NavDrawer: the Nav parts (`Nav.Item`, `Nav.Category`, …) as the items of\n * its list. With `focusMode=\"arrow\"` it is one Tab stop and the arrow keys move through it.\n */\nexport const NavDrawerBody = ({\n focusMode = 'tab',\n className,\n onKeyDown,\n onFocus,\n children,\n ref,\n ...rest\n}: NavDrawerBodyProps) => {\n const { scrollState, registerBody } = useNavDrawerLayout('NavDrawer.Body');\n const nav = React.useContext(NavContext);\n const arrow = focusMode === 'arrow';\n\n // The closed category that holds the current page, reported by the categories of an arrow body\n // from their layout effects: it holds the first Tab stop while the current page is hidden.\n const [currentCategory, setCurrentCategory] = React.useState<string | null>(null);\n const reportCurrentCategory = React.useCallback((category: string, holdsCurrent: boolean) => {\n setCurrentCategory((previous) =>\n holdsCurrent ? category : previous === category ? null : previous,\n );\n }, []);\n const roving = React.useMemo<NavRovingContextValue>(\n () => ({ reportCurrentCategory }),\n [reportCurrentCategory],\n );\n const selected = nav?.value ?? '';\n const activeValue =\n currentCategory !== null ? `wave-nav-category:${currentCategory}` : selected || null;\n // Always called (C-HOOKS); the container attaches only in the arrow mode, and detaching it hands\n // every element its own tabindex back.\n const { containerProps } = useRovingTabIndex({\n itemSelector: TOOLBAR_ITEM_SELECTOR,\n manageTabIndex: true,\n tabStop: 'last-focused',\n orientation: 'both',\n loop: true,\n homeEndKeys: true,\n typeahead: false,\n activeValue,\n });\n\n const attachBody = React.useCallback(\n (element: HTMLDivElement | null) => (element ? registerBody(element) : undefined),\n [registerBody],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(\n ref,\n attachBody,\n arrow ? containerProps.ref : null,\n );\n // Development only: every child of the list is an <li> (`NavDrawer.Body:list-child`).\n const listRef = React.useRef<HTMLUListElement>(null);\n useNavListChildCheck(listRef, 'NavDrawer.Body', 'items');\n\n return (\n <div\n data-focus-mode={focusMode}\n data-scroll-state={scrollState}\n {...rest}\n ref={mergedRef}\n data-roving-container={arrow ? '' : undefined}\n onKeyDown={composeEventHandlers(onKeyDown, arrow ? containerProps.onKeyDown : undefined)}\n onFocus={composeEventHandlers(onFocus, arrow ? containerProps.onFocus : undefined, {\n checkDefaultPrevented: false,\n })}\n className={cn(navDrawerBodyClassNames.root, 'min-h-0 flex-1 overflow-y-auto py-2', className)}\n >\n <NavRovingContext.Provider value={arrow ? roving : null}>\n <ul ref={listRef} className={cn(navDrawerBodyClassNames.list, 'm-0 list-none p-0')}>\n {children}\n </ul>\n </NavRovingContext.Provider>\n </div>\n );\n};\nNavDrawerBody.displayName = 'NavDrawerBody';\n\n/**\n * The list pinned below a NavDrawer's body (Settings, Help): Nav parts as the items of its list,\n * each a Tab stop. Its line above shows while more of the body is below.\n */\nexport const NavDrawerFooter = ({ className, children, ref, ...rest }: NavDrawerFooterProps) => {\n const { scrollState } = useNavDrawerLayout('NavDrawer.Footer');\n // Development only: every child of the list is an <li> (`NavDrawer.Footer:list-child`).\n const listRef = React.useRef<HTMLUListElement>(null);\n useNavListChildCheck(listRef, 'NavDrawer.Footer', 'items');\n return (\n <div\n data-scroll-state={scrollState}\n {...rest}\n ref={ref}\n className={cn(\n navDrawerFooterClassNames.root,\n 'shrink-0 py-2',\n scrollSeparatorClasses.footer,\n className,\n )}\n >\n <ul ref={listRef} className={cn(navDrawerFooterClassNames.list, 'm-0 list-none p-0')}>\n {children}\n </ul>\n </div>\n );\n};\nNavDrawerFooter.displayName = 'NavDrawerFooter';\n\n// ---------------------------------------------------------------------------\n// Compound\n// ---------------------------------------------------------------------------\n\n/**\n * A navigation pane in a drawer: Nav's items, categories and selection in a `<nav>` landmark that\n * sits over the page (`type=\"overlay\"`) or in the page layout (`type=\"inline\"`). Fluent's\n * `NavDrawer`.\n *\n * - **Composition:** `NavDrawer.Header` (a row: a `Hamburger`, the app's name), `NavDrawer.Body`\n * (the scrolling list) and `NavDrawer.Footer` (a list pinned below it), rendered in the order\n * written. Nav parts (`Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, `Nav.Divider`,\n * `Nav.AppItem`, …) go in the Body and the Footer, which render the lists; wrap anything else\n * there in an `<li>`.\n * - **Types:** `overlay` (default) is a panel over the page, in a portal, opened in the browser\n * only; `inline` is a panel in the page layout, also in the server HTML. Changing `type`\n * remounts the panel; the selection and the open categories are kept.\n * - **Opening and closing:** keep it controlled (`open`, `onOpenChange`): an uncontrolled drawer\n * that is closed cannot open again. A `Hamburger` inside it toggles it (reason `trigger`);\n * Escape and a backdrop press close an overlay (`escape`, `outside-press`). Closing an overlay\n * when an item is chosen is yours, in `onItemSelect`, which also fires when the current page is\n * activated again. A non-modal overlay (`modalType=\"non-modal\"`) covers the page, which keeps\n * its Tab order: keep the page's controls clear of it, or use `type=\"inline\"`.\n * - **Focus:** pass your page's Hamburger as `finalFocusRef`, so focus returns to it when a\n * Hamburger inside the drawer closes it. An overlay moves focus in when it opens; an inline\n * drawer does not.\n * - **Keyboard:** every item is a Tab stop; `NavDrawer.Body focusMode=\"arrow\"` makes the body one\n * Tab stop with arrow keys, Home and End.\n * - **Landmark:** one `<nav>`, named \"Navigation\" by default (`aria-label`, `aria-labelledby`);\n * an overlay is also a dialog with that name. Rename it when the page has another navigation\n * landmark.\n * - **Selection:** Nav's `value`/`onValueChange` (only on a change), `openCategories` and\n * `currentCategory`, and `onItemSelect` on every activation (Fluent's `selectedValue` and\n * `onNavItemSelect`).\n * - **Server Components:** the parts are also exported as `NavDrawerHeader`, `NavDrawerBody` and\n * `NavDrawerFooter`.\n *\n * @example\n * const [open, setOpen] = useState(false);\n * const hamburgerRef = useRef<HTMLButtonElement>(null);\n * <Hamburger\n * ref={hamburgerRef}\n * aria-expanded={open}\n * aria-controls={open ? 'main-nav' : undefined}\n * aria-haspopup=\"dialog\"\n * onClick={() => setOpen(!open)}\n * />\n * <NavDrawer\n * id=\"main-nav\"\n * open={open}\n * onOpenChange={setOpen}\n * onItemSelect={() => setOpen(false)}\n * finalFocusRef={hamburgerRef}\n * defaultValue=\"home\"\n * >\n * <NavDrawer.Header>\n * <Hamburger />\n * Contoso HR\n * </NavDrawer.Header>\n * <NavDrawer.Body>\n * <Nav.Item value=\"home\" href=\"/\">Home</Nav.Item>\n * </NavDrawer.Body>\n * </NavDrawer>\n */\nexport const NavDrawer = /* @__PURE__ */ Object.assign(NavDrawerRoot, {\n Header: NavDrawerHeader,\n Body: NavDrawerBody,\n Footer: NavDrawerFooter,\n});\n"],"mappings":"8qBAwNA,IAAM0C,EAA0B,wBAC1BC,EACJ,wPAEIC,EAA0B,wBAC1BC,EACJ,sMAGF,SAASC,EAAiB,EAA2B,CACnD,IAAK,IAAMC,KAAQ,MAAM,KAAKC,EAAI,iBAAiB,IAAI,CAAC,EAAG,CACzD,IAAMC,EAASF,EAAK,eAAe,UACnC,GAAIE,IAAW,MAAQA,IAAW,KAAM,MAAO,EACjD,CACA,MAAO,EACT,CAOA,IAAMC,EAA4C,CAChD,YAAa,OACb,qBAA0B,CAAC,CAC7B,EAGA,SAASC,EAAmB,EAAoD,CAI9E,OAHgBnD,EAAM,WAAWC,EAAAA,sBAC7B,IACJ0B,EAAA,qBAAqByB,EAAe,WAAW,EACxCF,EACT,CAGA,IAAMG,GAAiB,CACrB,OAAO,UACP,KAAMC,EACN,cACA,eACA,eACA,WAAW,QACX,OAAO,QACP,YAAY,GACZ,UAAWC,EAAgB,QAC3B,iBAAiB,GACjB,gBACA,WACA,QACA,eACA,gBACA,iBACA,wBACA,yBACA,kBACA,aAAcC,EACd,kBAAmBC,EACnB,mBAAoBC,EACpB,KACA,WACA,MACA,GAAGC,KACiB,CACpB,GAAM,CAACC,EAAWC,GAAe3D,EAAAA,kBAAkBoD,EAAUQ,EAAaC,CAAY,EAGhFC,EAAO7D,EAAAA,cAAc8D,EAAML,CAAS,EACpCM,EAAW9D,EAAAA,gBAAgB,CAC/B,cAAe,YACf,QACA,aAAc+D,GAAgB,GAC9B,gBACA,WAAYC,EACZ,iBACA,wBACA,yBACA,kBACA,UACF,CAAC,EAEKC,GAAuBd,IAAkB,YAAc,YAAc,QACrEe,GAAcjE,EAAAA,MAAM,iBAAiB,EACrCkE,EAAUC,GAAMF,GAGhB,CAACG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AAiC,CAC9F,GAAM,CAAE,eAAgBR,EAAmB,kBAAkB,EAEvDoD,EAAUvG,EAAM,OAAyB,IAAI,EAEnD,OADAkC,EAAA,qBAAqBqE,EAAS,mBAAoB,OAAO,GAEvD,EAAA9D,EAAA,IAAA,CAAC,MAAD,CACE,oBAAmBqC,EACnB,GAAInB,EACC,MACL,UAAWhD,EAAAA,GACTa,EAAAA,0BAA0B,KAC1B,gBACAP,EAAAA,uBAAuB,OACvBsE,CACF,EAEA,UAAA,EAAA9C,EAAA,IAAA,CAAC,KAAD,CAAI,IAAK8D,EAAS,UAAW5F,EAAAA,GAAGa,EAAAA,0BAA0B,KAAM,mBAAmB,EAChF,UACC,CAAA,CACD,CAAA,CAET,EACA,EAAgB,YAAc,kBAkE9B,IAAamF,EAA4B,OAAO,OAAOtD,EAAe,CACpE,OAAQiC,EACR,KAAME,EACN,OAAQkB,CACV,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);var n=t.createContext(null);n.displayName=`NavDrawerContext`;var r=t.createContext(null);r.displayName=`NavDrawerLayoutContext`,exports.NavDrawerContext=n,exports.NavDrawerLayoutContext=r;
|
|
2
|
+
//# sourceMappingURL=NavDrawer.context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavDrawer.context.cjs","names":["React","require_runtime","react","NavDrawerContext","NavDrawerLayoutContext"],"sources":["../../../src/components/navigation/NavDrawer.context.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ModalRequestOpen } from '../overlays/Dialog.shared';\nimport type { DrawerType } from '../overlays/Drawer.context';\nimport type { DrawerScrollState } from '../overlays/Drawer.scroll';\n\n/*\n * The contexts of a NavDrawer: its open state for the Hamburgers inside it, and the scroll state of\n * its body for its parts. Internal; imports no runtime module but React (types only), so an import\n * of only `Hamburger` pulls in no drawer machinery.\n */\n\n/** What a NavDrawer gives a Hamburger inside it (its header, or anywhere in its tree). */\nexport interface NavDrawerContextValue {\n /** The reported open state (an overlay's `false` until the page has hydrated). */\n open: boolean;\n /** Asks the NavDrawer to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The panel's id (the Hamburger's `aria-controls`). */\n panelId: string;\n /** How the drawer sits on the page. */\n type: DrawerType;\n}\n\n/**\n * The NavDrawer around a Hamburger (`null` outside one: the Hamburger is then a plain button the\n * app wires, so there is no missing-context error).\n */\nexport const NavDrawerContext = React.createContext<NavDrawerContextValue | null>(null);\nNavDrawerContext.displayName = 'NavDrawerContext';\n\n/** What a NavDrawer gives its Header, Body and Footer. */\nexport interface NavDrawerLayoutContextValue {\n /** The scroll state of the first mounted body (`'none'` on the server and without a body). */\n scrollState: DrawerScrollState;\n /**\n * Registers a body element (from its callback ref); the first one mounted is measured. Returns\n * the cleanup that forgets it.\n */\n registerBody: (element: HTMLElement) => () => void;\n}\n\n/**\n * The layout of the NavDrawer around a part (`null` outside one). Separate from the Nav state, so\n * a change of the scroll state re-renders the three parts and not the Nav items.\n */\nexport const NavDrawerLayoutContext = React.createContext<NavDrawerLayoutContextValue | null>(null);\nNavDrawerLayoutContext.displayName = 'NavDrawerLayoutContext';\n"],"mappings":"6GA2BA,IAAaG,EAAmBH,EAAM,cAA4C,IAAI,EACtF,EAAiB,YAAc,mBAiB/B,IAAaI,EAAyBJ,EAAM,cAAkD,IAAI,EAClG,EAAuB,YAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
//#region src/components/navigation/NavDrawer.context.ts
|
|
4
|
+
var t = e.createContext(null);
|
|
5
|
+
t.displayName = "NavDrawerContext";
|
|
6
|
+
var n = e.createContext(null);
|
|
7
|
+
n.displayName = "NavDrawerLayoutContext";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as NavDrawerContext, n as NavDrawerLayoutContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=NavDrawer.context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavDrawer.context.mjs","names":["React","NavDrawerContext","NavDrawerLayoutContext"],"sources":["../../../src/components/navigation/NavDrawer.context.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ModalRequestOpen } from '../overlays/Dialog.shared';\nimport type { DrawerType } from '../overlays/Drawer.context';\nimport type { DrawerScrollState } from '../overlays/Drawer.scroll';\n\n/*\n * The contexts of a NavDrawer: its open state for the Hamburgers inside it, and the scroll state of\n * its body for its parts. Internal; imports no runtime module but React (types only), so an import\n * of only `Hamburger` pulls in no drawer machinery.\n */\n\n/** What a NavDrawer gives a Hamburger inside it (its header, or anywhere in its tree). */\nexport interface NavDrawerContextValue {\n /** The reported open state (an overlay's `false` until the page has hydrated). */\n open: boolean;\n /** Asks the NavDrawer to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The panel's id (the Hamburger's `aria-controls`). */\n panelId: string;\n /** How the drawer sits on the page. */\n type: DrawerType;\n}\n\n/**\n * The NavDrawer around a Hamburger (`null` outside one: the Hamburger is then a plain button the\n * app wires, so there is no missing-context error).\n */\nexport const NavDrawerContext = React.createContext<NavDrawerContextValue | null>(null);\nNavDrawerContext.displayName = 'NavDrawerContext';\n\n/** What a NavDrawer gives its Header, Body and Footer. */\nexport interface NavDrawerLayoutContextValue {\n /** The scroll state of the first mounted body (`'none'` on the server and without a body). */\n scrollState: DrawerScrollState;\n /**\n * Registers a body element (from its callback ref); the first one mounted is measured. Returns\n * the cleanup that forgets it.\n */\n registerBody: (element: HTMLElement) => () => void;\n}\n\n/**\n * The layout of the NavDrawer around a part (`null` outside one). Separate from the Nav state, so\n * a change of the scroll state re-renders the three parts and not the Nav items.\n */\nexport const NavDrawerLayoutContext = React.createContext<NavDrawerLayoutContextValue | null>(null);\nNavDrawerLayoutContext.displayName = 'NavDrawerLayoutContext';\n"],"mappings":";;;AA2BA,IAAaC,IAAmBD,EAAM,cAA4C,IAAI;AACtF,EAAiB,cAAc;AAiB/B,IAAaE,IAAyBF,EAAM,cAAkD,IAAI;AAClG,EAAuB,cAAc"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/cn.mjs";
|
|
3
|
+
import { hasWarned as t, isDev as n, reportMissingContext as r, warnOnce as i } from "../../lib/dev.mjs";
|
|
4
|
+
import { composeEventHandlers as a } from "../../lib/composeEventHandlers.mjs";
|
|
5
|
+
import { drawerClassNames as o, navDrawerBodyClassNames as s, navDrawerClassNames as c, navDrawerFooterClassNames as l, navDrawerHeaderClassNames as u } from "../../lib/classNames.mjs";
|
|
6
|
+
import { useId as d } from "../../hooks/useId.mjs";
|
|
7
|
+
import { useRovingTabIndex as f } from "../../hooks/useRovingTabIndex.mjs";
|
|
8
|
+
import { useMergedRefs as p } from "../../hooks/useMergedRefs.mjs";
|
|
9
|
+
import { TOOLBAR_ITEM_SELECTOR as m } from "../button/Toolbar.navigation.mjs";
|
|
10
|
+
import { NavContext as h, NavRovingContext as g, useNavListChildCheck as _ } from "./Nav.context.mjs";
|
|
11
|
+
import { useNavRootState as v } from "./Nav.root.mjs";
|
|
12
|
+
import { inertModalTrigger as y, useModalOpenState as b, useModalTriggerSession as x } from "../overlays/Dialog.shared.mjs";
|
|
13
|
+
import { DrawerPanel as S, useDrawerOpen as C } from "../overlays/Drawer.panel.mjs";
|
|
14
|
+
import { scrollSeparatorClasses as w, useScrollState as T } from "../overlays/Drawer.scroll.mjs";
|
|
15
|
+
import { NavDrawerContext as E, NavDrawerLayoutContext as D } from "./NavDrawer.context.mjs";
|
|
16
|
+
import * as O from "react";
|
|
17
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
18
|
+
//#region src/components/navigation/NavDrawer.tsx
|
|
19
|
+
var A = "NavDrawer:unreachable", j = "NavDrawer is closed and nothing can open it: it is uncontrolled (no `open` prop), and a Hamburger inside it cannot be reached while it is closed. Control it with `open` and `onOpenChange`, and open it from a Hamburger (or any button) outside it.", M = "NavDrawer:loose-items", ee = "NavDrawer: a list item sits outside NavDrawer.Body and NavDrawer.Footer, the parts that render a list. Move Nav.Item, Nav.Category and the other Nav parts into NavDrawer.Body or NavDrawer.Footer.";
|
|
20
|
+
function N(e) {
|
|
21
|
+
for (let t of Array.from(e.querySelectorAll("li"))) {
|
|
22
|
+
let e = t.parentElement?.localName;
|
|
23
|
+
if (e !== "ul" && e !== "ol") return !0;
|
|
24
|
+
}
|
|
25
|
+
return !1;
|
|
26
|
+
}
|
|
27
|
+
var P = {
|
|
28
|
+
scrollState: "none",
|
|
29
|
+
registerBody: () => () => {}
|
|
30
|
+
};
|
|
31
|
+
function F(e) {
|
|
32
|
+
return O.useContext(D) || (r(e, "NavDrawer"), P);
|
|
33
|
+
}
|
|
34
|
+
var I = ({ type: r = "overlay", open: a, defaultOpen: s, onOpenChange: l, onItemSelect: u, position: f = "start", size: p = "small", separator: m = !0, modalType: g = "modal", unmountOnClose: _ = !0, finalFocusRef: w, backdrop: P, value: F, defaultValue: I, onValueChange: L, openCategories: R, defaultOpenCategories: z, onOpenCategoriesChange: B, currentCategory: te, "aria-label": ne, "aria-labelledby": V, "aria-describedby": re, id: ie, children: H, ref: ae, ...oe }) => {
|
|
35
|
+
let [U, W] = b(a, s, l), G = C(r, U), K = v({
|
|
36
|
+
componentName: "NavDrawer",
|
|
37
|
+
value: F,
|
|
38
|
+
defaultValue: I ?? "",
|
|
39
|
+
onValueChange: L,
|
|
40
|
+
onActivate: u,
|
|
41
|
+
openCategories: R,
|
|
42
|
+
defaultOpenCategories: z,
|
|
43
|
+
onOpenCategoriesChange: B,
|
|
44
|
+
currentCategory: te,
|
|
45
|
+
children: H
|
|
46
|
+
}), se = g === "non-modal" ? "non-modal" : "modal", ce = d("wave-nav-drawer"), q = ie ?? ce, [le, J] = O.useState(null), Y = O.useCallback((e) => (J((t) => t ?? e), () => J((t) => t === e ? null : t)), []), X = T(le), ue = O.useMemo(() => ({
|
|
47
|
+
scrollState: X,
|
|
48
|
+
registerBody: Y
|
|
49
|
+
}), [X, Y]), de = O.useMemo(() => ({
|
|
50
|
+
open: G,
|
|
51
|
+
requestOpen: W,
|
|
52
|
+
panelId: q,
|
|
53
|
+
type: r
|
|
54
|
+
}), [
|
|
55
|
+
G,
|
|
56
|
+
W,
|
|
57
|
+
q,
|
|
58
|
+
r
|
|
59
|
+
]), Z = a === void 0 && !U;
|
|
60
|
+
O.useEffect(() => {
|
|
61
|
+
Z && i(A, j);
|
|
62
|
+
}, [Z]);
|
|
63
|
+
let Q = O.useRef(null);
|
|
64
|
+
O.useEffect(() => {
|
|
65
|
+
if (!n || t(M)) return;
|
|
66
|
+
let e = Q.current;
|
|
67
|
+
e && N(e) && i(M, ee);
|
|
68
|
+
});
|
|
69
|
+
let $ = {
|
|
70
|
+
"aria-label": ne ?? (V === void 0 ? "Navigation" : void 0),
|
|
71
|
+
"aria-labelledby": V,
|
|
72
|
+
"aria-describedby": re
|
|
73
|
+
}, fe = r === "overlay" ? $ : void 0, pe = /* @__PURE__ */ k(S, {
|
|
74
|
+
componentName: "NavDrawer",
|
|
75
|
+
type: r,
|
|
76
|
+
open: G,
|
|
77
|
+
requestOpen: W,
|
|
78
|
+
position: f,
|
|
79
|
+
size: p,
|
|
80
|
+
separator: m,
|
|
81
|
+
modalType: se,
|
|
82
|
+
unmountOnClose: _,
|
|
83
|
+
inlineAs: "div",
|
|
84
|
+
trigger: y,
|
|
85
|
+
finalFocusRef: w,
|
|
86
|
+
rootClassName: e(o.root, c.root),
|
|
87
|
+
backdropClassName: e(o.backdrop, c.backdrop),
|
|
88
|
+
backdrop: P,
|
|
89
|
+
id: q,
|
|
90
|
+
...fe,
|
|
91
|
+
...oe,
|
|
92
|
+
ref: ae,
|
|
93
|
+
children: /* @__PURE__ */ k("nav", {
|
|
94
|
+
ref: Q,
|
|
95
|
+
...$,
|
|
96
|
+
className: e(c.nav, "flex min-h-0 flex-1 flex-col"),
|
|
97
|
+
children: H
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
return x(y, G), /* @__PURE__ */ k(h.Provider, {
|
|
101
|
+
value: K,
|
|
102
|
+
children: /* @__PURE__ */ k(E.Provider, {
|
|
103
|
+
value: de,
|
|
104
|
+
children: /* @__PURE__ */ k(D.Provider, {
|
|
105
|
+
value: ue,
|
|
106
|
+
children: pe
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
I.displayName = "NavDrawer";
|
|
112
|
+
var L = ({ className: t, children: n, ref: r, ...i }) => {
|
|
113
|
+
let { scrollState: a } = F("NavDrawer.Header");
|
|
114
|
+
return /* @__PURE__ */ k("div", {
|
|
115
|
+
"data-scroll-state": a,
|
|
116
|
+
...i,
|
|
117
|
+
ref: r,
|
|
118
|
+
className: e(u.root, "flex shrink-0 items-center gap-2 ps-2.5 pe-2 py-2", w.header, t),
|
|
119
|
+
children: n
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
L.displayName = "NavDrawerHeader";
|
|
123
|
+
var R = ({ focusMode: t = "tab", className: n, onKeyDown: r, onFocus: i, children: o, ref: c, ...l }) => {
|
|
124
|
+
let { scrollState: u, registerBody: d } = F("NavDrawer.Body"), v = O.useContext(h), y = t === "arrow", [b, x] = O.useState(null), S = O.useCallback((e, t) => {
|
|
125
|
+
x((n) => t ? e : n === e ? null : n);
|
|
126
|
+
}, []), C = O.useMemo(() => ({ reportCurrentCategory: S }), [S]), w = v?.value ?? "", T = b === null ? w || null : `wave-nav-category:${b}`, { containerProps: E } = f({
|
|
127
|
+
itemSelector: m,
|
|
128
|
+
manageTabIndex: !0,
|
|
129
|
+
tabStop: "last-focused",
|
|
130
|
+
orientation: "both",
|
|
131
|
+
loop: !0,
|
|
132
|
+
homeEndKeys: !0,
|
|
133
|
+
typeahead: !1,
|
|
134
|
+
activeValue: T
|
|
135
|
+
}), D = O.useCallback((e) => e ? d(e) : void 0, [d]), A = p(c, D, y ? E.ref : null), j = O.useRef(null);
|
|
136
|
+
return _(j, "NavDrawer.Body", "items"), /* @__PURE__ */ k("div", {
|
|
137
|
+
"data-focus-mode": t,
|
|
138
|
+
"data-scroll-state": u,
|
|
139
|
+
...l,
|
|
140
|
+
ref: A,
|
|
141
|
+
"data-roving-container": y ? "" : void 0,
|
|
142
|
+
onKeyDown: a(r, y ? E.onKeyDown : void 0),
|
|
143
|
+
onFocus: a(i, y ? E.onFocus : void 0, { checkDefaultPrevented: !1 }),
|
|
144
|
+
className: e(s.root, "min-h-0 flex-1 overflow-y-auto py-2", n),
|
|
145
|
+
children: /* @__PURE__ */ k(g.Provider, {
|
|
146
|
+
value: y ? C : null,
|
|
147
|
+
children: /* @__PURE__ */ k("ul", {
|
|
148
|
+
ref: j,
|
|
149
|
+
className: e(s.list, "m-0 list-none p-0"),
|
|
150
|
+
children: o
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
R.displayName = "NavDrawerBody";
|
|
156
|
+
var z = ({ className: t, children: n, ref: r, ...i }) => {
|
|
157
|
+
let { scrollState: a } = F("NavDrawer.Footer"), o = O.useRef(null);
|
|
158
|
+
return _(o, "NavDrawer.Footer", "items"), /* @__PURE__ */ k("div", {
|
|
159
|
+
"data-scroll-state": a,
|
|
160
|
+
...i,
|
|
161
|
+
ref: r,
|
|
162
|
+
className: e(l.root, "shrink-0 py-2", w.footer, t),
|
|
163
|
+
children: /* @__PURE__ */ k("ul", {
|
|
164
|
+
ref: o,
|
|
165
|
+
className: e(l.list, "m-0 list-none p-0"),
|
|
166
|
+
children: n
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
z.displayName = "NavDrawerFooter";
|
|
171
|
+
var B = /* @__PURE__ */ Object.assign(I, {
|
|
172
|
+
Header: L,
|
|
173
|
+
Body: R,
|
|
174
|
+
Footer: z
|
|
175
|
+
});
|
|
176
|
+
//#endregion
|
|
177
|
+
export { B as NavDrawer, R as NavDrawerBody, z as NavDrawerFooter, L as NavDrawerHeader };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=NavDrawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavDrawer.mjs","names":["useId","useId$1","React","UNREACHABLE_WARNING_KEY","UNREACHABLE_WARNING","LOOSE_ITEMS_WARNING_KEY","LOOSE_ITEMS_WARNING","hasLooseListItem","item","nav","parent","INERT_LAYOUT","useNavDrawerLayout","NavDrawerLayoutContext","reportMissingContext","componentName","NavDrawerRoot","openProp","modalTypeProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","rest","openState","requestOpen","useModalOpenState","defaultOpen","onOpenChange","open","useDrawerOpen","type","navState","useNavRootState","defaultValue","onItemSelect","modalType","generatedId","panelId","id","body","setBody","registerBody","previous","element","scrollState","useScrollState","layout","drawer","unreachable","warnOnce","navRef","isDev","hasWarned","nameProps","panelNameProps","panel","DrawerPanel","inertModalTrigger","cn","drawerClassNames","navDrawerClassNames","useModalTriggerSession","NavContext","NavDrawerContext","NavDrawerHeader","navDrawerHeaderClassNames","scrollSeparatorClasses","className","NavDrawerBody","arrow","focusMode","currentCategory","setCurrentCategory","reportCurrentCategory","holdsCurrent","category","roving","selected","activeValue","useRovingTabIndex","TOOLBAR_ITEM_SELECTOR","attachBody","mergedRef","useMergedRefs","ref","containerProps","listRef","useNavListChildCheck","composeEventHandlers","onKeyDown","onFocus","navDrawerBodyClassNames","NavRovingContext","NavDrawerFooter","navDrawerFooterClassNames","NavDrawer"],"sources":["../../../src/components/navigation/NavDrawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport {\n drawerClassNames,\n navDrawerBodyClassNames,\n navDrawerClassNames,\n navDrawerFooterClassNames,\n navDrawerHeaderClassNames,\n} from '../../lib/classNames';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { hasWarned, isDev, reportMissingContext, warnOnce } from '../../lib/dev';\nimport type { Slot, SlotObject } from '../../lib/slot';\nimport type { BackdropAppearance, FocusMode, ModalType } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { TOOLBAR_ITEM_SELECTOR } from '../button/Toolbar.navigation';\nimport {\n inertModalTrigger,\n useModalOpenState,\n useModalTriggerSession,\n} from '../overlays/Dialog.shared';\nimport type {\n DrawerOpenChangeDetails,\n DrawerPosition,\n DrawerSize,\n DrawerType,\n} from '../overlays/Drawer.context';\nimport { DrawerPanel, useDrawerOpen } from '../overlays/Drawer.panel';\nimport { scrollSeparatorClasses, useScrollState } from '../overlays/Drawer.scroll';\nimport {\n NavContext,\n NavRovingContext,\n useNavListChildCheck,\n type NavRovingContextValue,\n} from './Nav.context';\nimport { useNavRootState, type NavProps } from './Nav.root';\nimport {\n NavDrawerContext,\n NavDrawerLayoutContext,\n type NavDrawerContextValue,\n type NavDrawerLayoutContextValue,\n} from './NavDrawer.context';\n\n/*\n * NavDrawer: Nav's state (`useNavRootState`) and a navigation landmark in the drawer panel shell\n * (`DrawerPanel`), with its Header, Body and Footer parts. Imports the Nav root and context modules\n * (never `Nav.tsx`) and the shell's modules (never Drawer's root or compound); Nav never imports\n * it, and `Hamburger.tsx` reads only `NavDrawer.context.ts`.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Properties for the NavDrawer component. */\nexport interface NavDrawerProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'>,\n Pick<\n NavProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'openCategories'\n | 'defaultOpenCategories'\n | 'onOpenCategoriesChange'\n | 'currentCategory'\n > {\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 (in the browser only: an\n * open overlay is closed in the server HTML and opens once hydrated). Modal by default: focus\n * moves in and stays there, the rest of the page is `inert` and does not scroll, and Escape\n * and a backdrop press close it. It is a dialog with the navigation's name.\n * - `inline`: a panel in the page layout, rendered where the NavDrawer is (also in the server\n * HTML). The page stays usable around it; Escape and presses outside do nothing; opening it\n * moves no focus, and closing it while focus is inside returns focus to `finalFocusRef`, else\n * to the element that opened it.\n *\n * Changing `type` remounts the panel; the selection and the open categories are kept. Rendered\n * as `data-type`.\n * @default 'overlay'\n */\n type?: DrawerType;\n /** Controlled open state. */\n open?: boolean;\n /**\n * Open state for uncontrolled usage. Keep the drawer controlled instead: a closed uncontrolled\n * NavDrawer cannot be opened again (a Hamburger inside it is not shown while it is closed).\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes, with `details.reason`: `trigger` (a Hamburger\n * inside the drawer), `escape` and `outside-press` (the backdrop; overlay only). `details` is\n * typed optional until 1.0. A controlled drawer stays as it is until you update `open`.\n */\n onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;\n /**\n * Called with an item's value every time an item is activated, also when the current page is\n * activated again (a disabled item, a link opened in another tab or window, and a button item\n * whose `onClick` calls `preventDefault()` are not activations). Close an overlay drawer here:\n * `onValueChange` fires only when the value changes. Fluent's `onNavItemSelect`.\n */\n onItemSelect?: (value: string) => void;\n /**\n * The edge the panel is attached to: an overlay's screen edge; an inline panel's inner edge is\n * the opposite one. `start`/`end` follow the text direction; `left`/`right` are physical sides;\n * `bottom` runs along the bottom edge. Unlike Drawer's (`'end'`), the default is the start edge,\n * where navigation sits (Fluent's). Rendered as `data-position`.\n * @default 'start'\n */\n position?: DrawerPosition;\n /**\n * The panel's width at a side (its height at the bottom), on Drawer's scale: `small` 320px,\n * `medium` 592px, `large` 940px, `full` the viewport (inline: the container). A width class in\n * `className` replaces it (Fluent's navigation pane is 260px wide: the width class of 65\n * spacing steps). Rendered as `data-size`. Drawer's default too.\n * @default 'small'\n */\n size?: DrawerSize;\n /**\n * Inline drawers: draws a line on the panel's inner edge (`data-separator`), as Nav does\n * (Drawer's `separator` defaults to `false`). An overlay always draws that edge; forced colours\n * always draw it.\n * @default true\n */\n separator?: boolean;\n /**\n * Overlay drawers: `modal` (backdrop, focus trapped, page inert and not scrolling) or\n * `non-modal` (no backdrop, no trap, nothing inert; Escape closes it while focus is inside, and\n * its Tab place follows the element that opened it). A non-modal overlay covers the page under\n * it while the page keeps its Tab order: keep the page's controls clear of it (reserve its width,\n * or its height at the bottom, in your layout while it is open) or use `type=\"inline\"`; with\n * `size=\"full\"` it hides the whole page and warns. Ignored by inline drawers. Rendered as\n * `data-modal-type` on an overlay's panel. Fluent's `modalType` (without `alert`: a navigation\n * pane is never an alert, so an `'alert'` is treated as `'modal'`). Drawer's default too.\n * @default 'modal'\n */\n modalType?: Extract<ModalType, 'modal' | 'non-modal'>;\n /**\n * Removes the panel when the drawer closes. `false` keeps it mounted while closed, out of view\n * and `inert`, so the state of what is inside survives, and a Hamburger outside can point\n * `aria-controls` at it at all times: always for an inline drawer, and once the page has\n * hydrated for an overlay (whose panel is not in the server HTML). Fluent's `unmountOnClose`.\n * Drawer's default too.\n * @default true\n */\n unmountOnClose?: boolean;\n /**\n * Where focus goes when the drawer closes with focus inside it (a modal overlay: whenever it\n * closes). Pass your page's Hamburger, so a Hamburger inside the drawer that closes it hands\n * focus to the one that opens it again.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /**\n * The backdrop of a modal overlay (Drawer's `backdrop` slot: `null` renders none, a slot\n * object's `appearance` picks the fill). Ignored, with a development warning, by a non-modal or\n * inline drawer.\n */\n backdrop?: Slot<'div'> | (SlotObject<'div'> & { appearance?: BackdropAppearance });\n /**\n * Name of the navigation landmark (and of an overlay's dialog). Localize it; rename it when the\n * page has another navigation landmark (two with one name are ambiguous). An `aria-labelledby`\n * replaces the default.\n * @default 'Navigation'\n */\n 'aria-label'?: string;\n /** `NavDrawer.Header`, `NavDrawer.Body` and `NavDrawer.Footer`, rendered in the order written. */\n children?: React.ReactNode;\n /** Ref to the panel: the `role=\"dialog\"` element of an overlay drawer, the panel element of an inline one. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerHeader sub-component. */\nexport interface NavDrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** A Hamburger, the app's name, …: any content (Nav items go in the body or the footer). */\n children?: React.ReactNode;\n /** Ref to the header element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerBody sub-component. */\nexport interface NavDrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * How the keyboard reaches the items. `'tab'`: every item is a Tab stop and the arrow keys do\n * nothing (Nav's model). `'arrow'`: the body is one Tab stop, the last focused element (at first\n * the current page, or the closed category that holds it, else the first item); Down and Right\n * move to the next element and Up and Left to the previous one (Left and Right swap in a\n * right-to-left layout), wrapping, and Home and End go to the ends. Every focusable element in\n * the body joins the order, item actions included. Screen readers do not announce arrow keys in\n * a navigation landmark: prefer `'tab'` unless your users expect an app pane. Rendered as\n * `data-focus-mode`. Fluent's NavDrawer uses arrow keys by default (its `tabbable` adds Tab\n * stops).\n * @default 'tab'\n */\n focusMode?: FocusMode;\n /** Nav parts: `Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, … (each renders its own list item). */\n children?: React.ReactNode;\n /** Ref to the scrolling body element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the NavDrawerFooter sub-component. */\nexport interface NavDrawerFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Nav parts pinned below the body (Settings, Help); wrap other content in an `<li>`. */\n children?: React.ReactNode;\n /** Ref to the footer element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Development checks\n// ---------------------------------------------------------------------------\n\nconst UNREACHABLE_WARNING_KEY = 'NavDrawer:unreachable';\nconst UNREACHABLE_WARNING =\n 'NavDrawer is closed and nothing can open it: it is uncontrolled (no `open` prop), and a Hamburger inside it cannot be reached while it is closed. Control it with `open` and `onOpenChange`, and open it from a Hamburger (or any button) outside it.';\n\nconst LOOSE_ITEMS_WARNING_KEY = 'NavDrawer:loose-items';\nconst LOOSE_ITEMS_WARNING =\n 'NavDrawer: a list item sits outside NavDrawer.Body and NavDrawer.Footer, the parts that render a list. Move Nav.Item, Nav.Category and the other Nav parts into NavDrawer.Body or NavDrawer.Footer.';\n\n/** Whether `nav` holds an `<li>` whose parent is not a `<ul>` or `<ol>`. */\nfunction hasLooseListItem(nav: HTMLElement): boolean {\n for (const item of Array.from(nav.querySelectorAll('li'))) {\n const parent = item.parentElement?.localName;\n if (parent !== 'ul' && parent !== 'ol') return true;\n }\n return false;\n}\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\n/** The scroll state and body registry the parts read outside a NavDrawer in production. */\nconst INERT_LAYOUT: NavDrawerLayoutContextValue = {\n scrollState: 'none',\n registerBody: () => () => {},\n};\n\n/** C-CONTEXT: the enclosing NavDrawer's layout for the part `componentName`. */\nfunction useNavDrawerLayout(componentName: string): NavDrawerLayoutContextValue {\n const context = React.useContext(NavDrawerLayoutContext);\n if (context) return context;\n reportMissingContext(componentName, 'NavDrawer');\n return INERT_LAYOUT;\n}\n\n// The root of `NavDrawer` (documented on the export below).\nconst NavDrawerRoot = ({\n type = 'overlay',\n open: openProp,\n defaultOpen,\n onOpenChange,\n onItemSelect,\n position = 'start',\n size = 'small',\n separator = true,\n modalType: modalTypeProp = 'modal',\n unmountOnClose = true,\n finalFocusRef,\n backdrop,\n value,\n defaultValue,\n onValueChange,\n openCategories,\n defaultOpenCategories,\n onOpenCategoriesChange,\n currentCategory,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n id,\n children,\n ref,\n ...rest\n}: NavDrawerProps) => {\n const [openState, requestOpen] = useModalOpenState(openProp, defaultOpen, onOpenChange);\n // An overlay reports itself closed until the page has hydrated (its portal renders only in the\n // browser), so a Hamburger's aria-controls never names a panel that is not there.\n const open = useDrawerOpen(type, openState);\n const navState = useNavRootState({\n componentName: 'NavDrawer',\n value,\n defaultValue: defaultValue ?? '',\n onValueChange,\n onActivate: onItemSelect,\n openCategories,\n defaultOpenCategories,\n onOpenCategoriesChange,\n currentCategory,\n children,\n });\n // A navigation pane is never an alert: an 'alert' passed at run time is a modal one.\n const modalType: ModalType = modalTypeProp === 'non-modal' ? 'non-modal' : 'modal';\n const generatedId = useId('wave-nav-drawer');\n const panelId = id ?? generatedId;\n\n // The first mounted body, measured for the scroll-state separators of the parts.\n const [body, setBody] = React.useState<HTMLElement | null>(null);\n const registerBody = React.useCallback((element: HTMLElement) => {\n setBody((previous) => previous ?? element);\n return () => setBody((previous) => (previous === element ? null : previous));\n }, []);\n const scrollState = useScrollState(body);\n const layout = React.useMemo<NavDrawerLayoutContextValue>(\n () => ({ scrollState, registerBody }),\n [scrollState, registerBody],\n );\n const drawer = React.useMemo<NavDrawerContextValue>(\n () => ({ open, requestOpen, panelId, type }),\n [open, requestOpen, panelId, type],\n );\n\n // An uncontrolled drawer that is closed has no way back: its Hamburgers are inside it.\n const unreachable = openProp === undefined && !openState;\n React.useEffect(() => {\n if (unreachable) warnOnce(UNREACHABLE_WARNING_KEY, UNREACHABLE_WARNING);\n }, [unreachable]);\n\n // Development only: after every commit, a list item outside the Body's and Footer's lists.\n const navRef = React.useRef<HTMLElement>(null);\n React.useEffect(() => {\n if (!isDev || hasWarned(LOOSE_ITEMS_WARNING_KEY)) return;\n const nav = navRef.current;\n if (nav && hasLooseListItem(nav)) warnOnce(LOOSE_ITEMS_WARNING_KEY, LOOSE_ITEMS_WARNING);\n });\n\n // The name goes to the <nav> in both types and, in an overlay, also to its dialog panel. An\n // aria-labelledby without aria-label drops the default.\n const nameProps = {\n 'aria-label': ariaLabel ?? (ariaLabelledBy === undefined ? 'Navigation' : undefined),\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n };\n const panelNameProps = type === 'overlay' ? nameProps : undefined;\n\n const panel = (\n <DrawerPanel\n componentName=\"NavDrawer\"\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=\"div\"\n trigger={inertModalTrigger}\n finalFocusRef={finalFocusRef}\n rootClassName={cn(drawerClassNames.root, navDrawerClassNames.root)}\n backdropClassName={cn(drawerClassNames.backdrop, navDrawerClassNames.backdrop)}\n backdrop={backdrop}\n id={panelId}\n {...panelNameProps}\n {...rest}\n ref={ref as React.Ref<HTMLElement> | undefined}\n >\n <nav\n ref={navRef}\n {...nameProps}\n className={cn(navDrawerClassNames.nav, 'flex min-h-0 flex-1 flex-col')}\n >\n {children}\n </nav>\n </DrawerPanel>\n );\n // After the shell's effects (focus restore), as the shell's contract asks.\n useModalTriggerSession(inertModalTrigger, open);\n\n return (\n <NavContext.Provider value={navState}>\n <NavDrawerContext.Provider value={drawer}>\n <NavDrawerLayoutContext.Provider value={layout}>{panel}</NavDrawerLayoutContext.Provider>\n </NavDrawerContext.Provider>\n </NavContext.Provider>\n );\n};\nNavDrawerRoot.displayName = 'NavDrawer';\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\n/**\n * The header row of a NavDrawer: a Hamburger, the app's name, … (no list: Nav items go in the\n * body or the footer). Its line underneath shows while the body is scrolled away from its top.\n */\nexport const NavDrawerHeader = ({ className, children, ref, ...rest }: NavDrawerHeaderProps) => {\n const { scrollState } = useNavDrawerLayout('NavDrawer.Header');\n return (\n <div\n data-scroll-state={scrollState}\n {...rest}\n ref={ref}\n className={cn(\n navDrawerHeaderClassNames.root,\n 'flex shrink-0 items-center gap-2 ps-2.5 pe-2 py-2',\n scrollSeparatorClasses.header,\n className,\n )}\n >\n {children}\n </div>\n );\n};\nNavDrawerHeader.displayName = 'NavDrawerHeader';\n\n/**\n * The scrolling list of a NavDrawer: the Nav parts (`Nav.Item`, `Nav.Category`, …) as the items of\n * its list. With `focusMode=\"arrow\"` it is one Tab stop and the arrow keys move through it.\n */\nexport const NavDrawerBody = ({\n focusMode = 'tab',\n className,\n onKeyDown,\n onFocus,\n children,\n ref,\n ...rest\n}: NavDrawerBodyProps) => {\n const { scrollState, registerBody } = useNavDrawerLayout('NavDrawer.Body');\n const nav = React.useContext(NavContext);\n const arrow = focusMode === 'arrow';\n\n // The closed category that holds the current page, reported by the categories of an arrow body\n // from their layout effects: it holds the first Tab stop while the current page is hidden.\n const [currentCategory, setCurrentCategory] = React.useState<string | null>(null);\n const reportCurrentCategory = React.useCallback((category: string, holdsCurrent: boolean) => {\n setCurrentCategory((previous) =>\n holdsCurrent ? category : previous === category ? null : previous,\n );\n }, []);\n const roving = React.useMemo<NavRovingContextValue>(\n () => ({ reportCurrentCategory }),\n [reportCurrentCategory],\n );\n const selected = nav?.value ?? '';\n const activeValue =\n currentCategory !== null ? `wave-nav-category:${currentCategory}` : selected || null;\n // Always called (C-HOOKS); the container attaches only in the arrow mode, and detaching it hands\n // every element its own tabindex back.\n const { containerProps } = useRovingTabIndex({\n itemSelector: TOOLBAR_ITEM_SELECTOR,\n manageTabIndex: true,\n tabStop: 'last-focused',\n orientation: 'both',\n loop: true,\n homeEndKeys: true,\n typeahead: false,\n activeValue,\n });\n\n const attachBody = React.useCallback(\n (element: HTMLDivElement | null) => (element ? registerBody(element) : undefined),\n [registerBody],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(\n ref,\n attachBody,\n arrow ? containerProps.ref : null,\n );\n // Development only: every child of the list is an <li> (`NavDrawer.Body:list-child`).\n const listRef = React.useRef<HTMLUListElement>(null);\n useNavListChildCheck(listRef, 'NavDrawer.Body', 'items');\n\n return (\n <div\n data-focus-mode={focusMode}\n data-scroll-state={scrollState}\n {...rest}\n ref={mergedRef}\n data-roving-container={arrow ? '' : undefined}\n onKeyDown={composeEventHandlers(onKeyDown, arrow ? containerProps.onKeyDown : undefined)}\n onFocus={composeEventHandlers(onFocus, arrow ? containerProps.onFocus : undefined, {\n checkDefaultPrevented: false,\n })}\n className={cn(navDrawerBodyClassNames.root, 'min-h-0 flex-1 overflow-y-auto py-2', className)}\n >\n <NavRovingContext.Provider value={arrow ? roving : null}>\n <ul ref={listRef} className={cn(navDrawerBodyClassNames.list, 'm-0 list-none p-0')}>\n {children}\n </ul>\n </NavRovingContext.Provider>\n </div>\n );\n};\nNavDrawerBody.displayName = 'NavDrawerBody';\n\n/**\n * The list pinned below a NavDrawer's body (Settings, Help): Nav parts as the items of its list,\n * each a Tab stop. Its line above shows while more of the body is below.\n */\nexport const NavDrawerFooter = ({ className, children, ref, ...rest }: NavDrawerFooterProps) => {\n const { scrollState } = useNavDrawerLayout('NavDrawer.Footer');\n // Development only: every child of the list is an <li> (`NavDrawer.Footer:list-child`).\n const listRef = React.useRef<HTMLUListElement>(null);\n useNavListChildCheck(listRef, 'NavDrawer.Footer', 'items');\n return (\n <div\n data-scroll-state={scrollState}\n {...rest}\n ref={ref}\n className={cn(\n navDrawerFooterClassNames.root,\n 'shrink-0 py-2',\n scrollSeparatorClasses.footer,\n className,\n )}\n >\n <ul ref={listRef} className={cn(navDrawerFooterClassNames.list, 'm-0 list-none p-0')}>\n {children}\n </ul>\n </div>\n );\n};\nNavDrawerFooter.displayName = 'NavDrawerFooter';\n\n// ---------------------------------------------------------------------------\n// Compound\n// ---------------------------------------------------------------------------\n\n/**\n * A navigation pane in a drawer: Nav's items, categories and selection in a `<nav>` landmark that\n * sits over the page (`type=\"overlay\"`) or in the page layout (`type=\"inline\"`). Fluent's\n * `NavDrawer`.\n *\n * - **Composition:** `NavDrawer.Header` (a row: a `Hamburger`, the app's name), `NavDrawer.Body`\n * (the scrolling list) and `NavDrawer.Footer` (a list pinned below it), rendered in the order\n * written. Nav parts (`Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, `Nav.Divider`,\n * `Nav.AppItem`, …) go in the Body and the Footer, which render the lists; wrap anything else\n * there in an `<li>`.\n * - **Types:** `overlay` (default) is a panel over the page, in a portal, opened in the browser\n * only; `inline` is a panel in the page layout, also in the server HTML. Changing `type`\n * remounts the panel; the selection and the open categories are kept.\n * - **Opening and closing:** keep it controlled (`open`, `onOpenChange`): an uncontrolled drawer\n * that is closed cannot open again. A `Hamburger` inside it toggles it (reason `trigger`);\n * Escape and a backdrop press close an overlay (`escape`, `outside-press`). Closing an overlay\n * when an item is chosen is yours, in `onItemSelect`, which also fires when the current page is\n * activated again. A non-modal overlay (`modalType=\"non-modal\"`) covers the page, which keeps\n * its Tab order: keep the page's controls clear of it, or use `type=\"inline\"`.\n * - **Focus:** pass your page's Hamburger as `finalFocusRef`, so focus returns to it when a\n * Hamburger inside the drawer closes it. An overlay moves focus in when it opens; an inline\n * drawer does not.\n * - **Keyboard:** every item is a Tab stop; `NavDrawer.Body focusMode=\"arrow\"` makes the body one\n * Tab stop with arrow keys, Home and End.\n * - **Landmark:** one `<nav>`, named \"Navigation\" by default (`aria-label`, `aria-labelledby`);\n * an overlay is also a dialog with that name. Rename it when the page has another navigation\n * landmark.\n * - **Selection:** Nav's `value`/`onValueChange` (only on a change), `openCategories` and\n * `currentCategory`, and `onItemSelect` on every activation (Fluent's `selectedValue` and\n * `onNavItemSelect`).\n * - **Server Components:** the parts are also exported as `NavDrawerHeader`, `NavDrawerBody` and\n * `NavDrawerFooter`.\n *\n * @example\n * const [open, setOpen] = useState(false);\n * const hamburgerRef = useRef<HTMLButtonElement>(null);\n * <Hamburger\n * ref={hamburgerRef}\n * aria-expanded={open}\n * aria-controls={open ? 'main-nav' : undefined}\n * aria-haspopup=\"dialog\"\n * onClick={() => setOpen(!open)}\n * />\n * <NavDrawer\n * id=\"main-nav\"\n * open={open}\n * onOpenChange={setOpen}\n * onItemSelect={() => setOpen(false)}\n * finalFocusRef={hamburgerRef}\n * defaultValue=\"home\"\n * >\n * <NavDrawer.Header>\n * <Hamburger />\n * Contoso HR\n * </NavDrawer.Header>\n * <NavDrawer.Body>\n * <Nav.Item value=\"home\" href=\"/\">Home</Nav.Item>\n * </NavDrawer.Body>\n * </NavDrawer>\n */\nexport const NavDrawer = /* @__PURE__ */ Object.assign(NavDrawerRoot, {\n Header: NavDrawerHeader,\n Body: NavDrawerBody,\n Footer: NavDrawerFooter,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwNA,IAAMG,IAA0B,yBAC1BC,IACJ,yPAEIC,IAA0B,yBAC1BC,KACJ;AAGF,SAASC,EAAiB,GAA2B;CACnD,KAAK,IAAMC,KAAQ,MAAM,KAAKC,EAAI,iBAAiB,IAAI,CAAC,GAAG;EACzD,IAAMC,IAASF,EAAK,eAAe;EACnC,IAAIE,MAAW,QAAQA,MAAW,MAAM,OAAO;CACjD;CACA,OAAO;AACT;AAOA,IAAMC,IAA4C;CAChD,aAAa;CACb,0BAA0B,CAAC;AAC7B;AAGA,SAASC,EAAmB,GAAoD;CAI9E,OAHgBV,EAAM,WAAWW,CAC7B,MACJC,EAAqBC,GAAe,WAAW,GACxCJ;AACT;AAGA,IAAMK,KAAiB,EACrB,UAAO,WACP,MAAMC,GACN,gBACA,iBACA,iBACA,cAAW,SACX,UAAO,SACP,eAAY,IACZ,WAAWC,IAAgB,SAC3B,oBAAiB,IACjB,kBACA,aACA,UACA,iBACA,kBACA,mBACA,0BACA,2BACA,qBACA,cAAcC,IACd,mBAAmBC,GACnB,oBAAoBC,IACpB,QACA,aACA,SACA,GAAGC,SACiB;CACpB,IAAM,CAACC,GAAWC,KAAeC,EAAkBR,GAAUS,GAAaC,CAAY,GAGhFC,IAAOC,EAAcC,GAAMP,CAAS,GACpCQ,IAAWC,EAAgB;EAC/B,eAAe;EACf;EACA,cAAcC,KAAgB;EAC9B;EACA,YAAYC;EACZ;EACA;EACA;EACA;EACA;CACF,CAAC,GAEKC,KAAuBjB,MAAkB,cAAc,cAAc,SACrEkB,KAAcpC,EAAM,iBAAiB,GACrCqC,IAAUC,MAAMF,IAGhB,CAACG,IAAMC,KAAWtC,EAAM,SAA6B,IAAI,GACzDuC,IAAevC,EAAM,aAAa,OACtCsC,G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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/
|
|
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/useId.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../hooks/useIsClient.cjs"),l=require("../../hooks/usePresence.cjs"),u=require("../portal/Portal.cjs"),d=require("./Popover.shared.cjs"),f=require("./Dialog.shared.cjs"),p=require("../../hooks/useModalLayer.cjs"),m=require("./Dialog.slots.cjs");let h=require("react");h=e.__toESM(h,1);let g=require("react/jsx-runtime"),_=require("react-dom");var v=h.createContext(null);v.displayName=`DialogContext`;var y={open:!1,requestOpen:()=>{},modalType:`modal`,trigger:f.inertModalTrigger,finalFocusRef:void 0,unmountOnClose:!0,contentId:void 0,registerContentId:()=>()=>{}};function b(e){return f.useRequiredContext(v,e,`Dialog`,()=>y)}var x=({open:e,defaultOpen:t,onOpenChange:n,modalType:r=`modal`,finalFocusRef:i,unmountOnClose:a=!0,children:o})=>{let[s,l]=f.useModalOpenState(e,t,n),u=c.useIsClient(),d=s&&u,p=f.useModalTrigger();f.useModalTriggerSession(p,d);let[m,_]=h.useState(void 0),y=h.useCallback(e=>(_(e),()=>_(t=>t===e?void 0:t)),[]),b=h.useMemo(()=>({open:d,requestOpen:l,modalType:r,trigger:p,finalFocusRef:i,unmountOnClose:a,contentId:m,registerContentId:y}),[d,l,r,p,i,a,m,y]);return(0,g.jsx)(v.Provider,{value:b,children:o})};x.displayName=`Dialog`;var S=e=>{let{open:t,requestOpen:n,trigger:r,contentId:i}=b(`Dialog.Trigger`);return f.useModalTriggerPart({open:t,requestOpen:n,trigger:r,controlsId:i},e,`Dialog.Trigger`)};S.displayName=`DialogTrigger`;var C=e=>{let{requestOpen:t}=b(`Dialog.Close`);return f.useModalClosePart(t,e,`Dialog.Close`)};C.displayName=`DialogClose`;var ee={small:`max-w-[400px]`,medium:`max-w-[600px]`,large:`max-w-[940px]`,full:`m-0 h-dvh max-h-none max-w-none rounded-none border-0 pt-[max(1.5rem,env(safe-area-inset-top))] pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))] pr-[max(1.5rem,env(safe-area-inset-right))]`},te=`top-[max(1rem,env(safe-area-inset-top))] end-[max(1rem,env(safe-area-inset-right))] wave-rtl:end-[max(1rem,env(safe-area-inset-left))]`,ne=8,re=`Dialog.Content:backdrop-ignored`,w='Dialog.Content: `backdrop` is ignored with `modalType="non-modal"`: a non-modal dialog has no backdrop, so the page behind it stays usable.',ie=`Dialog.Content:non-modal-full`,ae='Dialog.Content: `size="full"` with `modalType="non-modal"` covers the whole page while leaving it usable, so Tab reaches controls hidden behind the dialog. Use `modalType="modal"`, or a smaller size with the page\'s controls kept clear of it.';function oe(e){let[t,n]=h.useState(null);return h.useLayoutEffect(()=>{if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(t=>{let r=t[t.length-1];r&&n(r.borderBoxSize?.[0]?.inlineSize??e.offsetWidth)});return t.observe(e,{box:`border-box`}),()=>{t.disconnect(),n(null)}},[e]),t}var T=({title:e,size:c=`medium`,backdrop:_,closeButton:v,titleAction:y,closeLabel:x=`Close`,children:S,className:C,style:T,id:E,onKeyDown:D,ref:O,...k})=>{let{open:A,requestOpen:j,modalType:M,trigger:N,finalFocusRef:se,unmountOnClose:P,registerContentId:F}=b(`Dialog.Content`),{isMounted:ce,ref:le,presenceProps:I}=l.usePresence(A,{unmountOnExit:P}),L=!P,ue=o.useId(`wave-dialog`),R=E??ue,z=o.useId(`wave-dialog-title`),B=f.useTitleRegistry(),[V,de]=h.useState(null),H=h.useRef(null),fe=h.useCallback(e=>{H.current=e,de(e)},[]),pe=h.useCallback(e=>e?F(R):void 0,[F,R]),me=s.useMergedRefs(O,fe,pe,le),U=h.useRef(null);f.useRaiseOnOpen(A,L,U);let W=f.useBackdropPress(H,M!==`alert`),he=f.useModalDismiss(j,`Dialog`,W.afterOutsidePress),G=p.useModalLayer({open:A,modalType:M,onDismiss:he,refs:[H],container:V,triggerRef:N.focusRef,finalFocusRef:se}),K=M===`non-modal`,ge=f.useModalOpener(A,N,V),_e=d.usePopoverTabOrder({enabled:A&&K,surface:V,anchorRef:ge,getPreviousStop:d.getTabbableThrough});f.useUnnamedModalWarning(A?V:null,B.hasTitle,`Dialog.Content`,`Dialog.Title`),f.useOpenInsideWarning(A,L,G.layerId,`Dialog`);let q=K&&_!=null&&typeof _!=`boolean`;h.useEffect(()=>{q&&n.warnOnce(re,w)},[q]);let J=A&&K&&c===`full`;h.useEffect(()=>{J&&n.warnOnce(ie,ae)},[J]);let[ve,ye]=h.useState(null),[Y,be]=h.useState(null),X=oe(A?ve:null),[Z,xe]=h.useState(null),Se=h.useMemo(()=>({...B.context,setFooterHeight:xe,titleActionsOutlet:Y}),[B.context,Y]);if(!ce)return null;let Q=r.slotRendersContent(e),$=X===null?void 0:X>0?`${X+ne}px`:`0px`,Ce=$===void 0?T:{"--wave-dialog-title-end-padding":$,...T};return(0,g.jsxs)(u.Portal,{ref:U,layerId:G.layerId,children:[!K&&(0,g.jsx)(m.ModalBackdrop,{backdrop:_,className:a.dialogContentClassNames.backdrop,layerId:G.layerId,open:A,onMouseDown:W.onMouseDown,presenceProps:I}),(0,g.jsx)(`div`,{...I,className:t.cn(a.dialogContentClassNames.positioner,`pointer-events-none fixed inset-0 flex items-center justify-center`),children:(0,g.jsx)(`div`,{ref:me,role:M===`alert`?`alertdialog`:`dialog`,id:R,"aria-labelledby":Q?z:B.titleId,tabIndex:-1,"data-modal-type":M,"data-size":c,...k,"data-presence":I[`data-presence`],style:Ce,onKeyDown:i.composeEventHandlers(D,_e),className:t.cn(a.dialogContentClassNames.root,`pointer-events-auto relative m-4 flex min-w-0 max-h-[calc(100dvh-2rem)] w-full flex-col rounded-lg border border-border bg-background p-6 text-foreground shadow-64`,ee[c],C),children:(0,g.jsxs)(f.ModalSurfaceContext.Provider,{value:Se,children:[Q&&(0,g.jsx)(`h2`,{id:z,className:t.cn(a.dialogTitleClassNames.root,`pe-[var(--wave-dialog-title-end-padding,2rem)] text-subtitle-1 font-semibold`),children:e}),(0,g.jsxs)(`div`,{ref:ye,className:t.cn(a.dialogContentClassNames.titleActions,`absolute end-4 top-4 flex items-start gap-1`,c===`full`&&te),children:[r.slotRendersContent(y)?r.renderSlot(y,`span`,t.cn(a.dialogContentClassNames.titleAction,`inline-flex items-center gap-1`)):null,(0,g.jsx)(`span`,{ref:be,className:`contents`}),(0,g.jsx)(m.ModalCloseButton,{componentName:`Dialog.Content`,closeButton:v,closeLabel:x,onClose:e=>j(!1,{reason:`close-button`,event:e}),className:t.cn(a.dialogContentClassNames.closeButton,`text-muted-foreground`)})]}),(0,g.jsx)(`div`,{className:t.cn(a.dialogContentClassNames.body,`-mx-1 mt-1 min-h-0 flex-1 overflow-y-auto scroll-pb-(--wave-dialog-footer-height) p-1 text-body-1`),style:Z===null?void 0:{"--wave-dialog-footer-height":`${Z}px`},children:S})]})})})]})};T.displayName=`DialogContent`;var E=({id:e,action:n,className:i,children:o,ref:s,...c})=>{let{id:l,ref:u}=f.useModalTitle(`Dialog.Title`,`Dialog.Content`,e,s),d=h.useContext(f.ModalSurfaceContext)?.titleActionsOutlet,p=(0,g.jsx)(`h2`,{...c,id:l,ref:u,className:t.cn(a.dialogTitleClassNames.root,`pe-[var(--wave-dialog-title-end-padding,2rem)] text-subtitle-1 font-semibold text-foreground`,i),children:o});if(!r.slotRendersContent(n))return p;let m=r.renderSlot(n,`span`,t.cn(a.dialogTitleClassNames.action,`inline-flex items-center gap-1`));return(0,g.jsxs)(g.Fragment,{children:[p,d===void 0?m:d&&(0,_.createPortal)(m,d)]})};E.displayName=`DialogTitle`;var D=`sticky -bottom-1 z-10 -mx-1 -mb-1 mt-6 flex justify-end gap-2 bg-background px-1 pb-2 pt-3`,O=`mt-6 flex justify-end gap-2`,k=({children:e,className:r,ref:i,...o})=>{let c=h.useContext(f.ModalSurfaceContext),l=c===null,u=c?.setFooterHeight,[d,p]=h.useState(null),m=s.useMergedRefs(i,p);return h.useEffect(()=>{l&&n.warnOnce(`Dialog.Footer:outside-content`,`Dialog.Footer must be rendered inside Dialog.Content. Outside it, the footer stays on the page while the dialog is closed.`)},[l]),h.useLayoutEffect(()=>{if(!d||!u||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(e=>{let t=e[e.length-1];t&&u(t.borderBoxSize?.[0]?.blockSize??d.offsetHeight)});return e.observe(d,{box:`border-box`}),()=>{e.disconnect(),u(null)}},[d,u]),(0,g.jsx)(`div`,{ref:m,...o,className:t.cn(a.dialogFooterClassNames.root,u?D:O,r),children:e})};k.displayName=`DialogFooter`;var A=Object.assign(x,{Trigger:S,Content:T,Footer:k,Title:E,Close:C});exports.Dialog=A,exports.DialogClose=C,exports.DialogContent=T,exports.DialogFooter=k,exports.DialogTitle=E,exports.DialogTrigger=S;
|
|
2
2
|
//# sourceMappingURL=Dialog.cjs.map
|