@nswds/ui 9.4.0 → 9.6.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.
Files changed (40) hide show
  1. package/dist/components/alert-dialog.js +2 -2
  2. package/dist/components/alert-dialog.js.map +1 -1
  3. package/dist/components/button-group.d.ts +2 -2
  4. package/dist/components/button-group.js.map +1 -1
  5. package/dist/components/combobox.js +2 -2
  6. package/dist/components/combobox.js.map +1 -1
  7. package/dist/components/component-preview.d.ts +153 -0
  8. package/dist/components/component-preview.js +690 -0
  9. package/dist/components/component-preview.js.map +1 -0
  10. package/dist/components/dialog.js +2 -2
  11. package/dist/components/dialog.js.map +1 -1
  12. package/dist/components/drawer.js +2 -2
  13. package/dist/components/drawer.js.map +1 -1
  14. package/dist/components/dropdown-menu.js +2 -2
  15. package/dist/components/dropdown-menu.js.map +1 -1
  16. package/dist/components/hover-card.js +2 -2
  17. package/dist/components/hover-card.js.map +1 -1
  18. package/dist/components/navigation-menu.js +2 -1
  19. package/dist/components/navigation-menu.js.map +1 -1
  20. package/dist/components/popover.js +2 -2
  21. package/dist/components/popover.js.map +1 -1
  22. package/dist/components/select.js +2 -2
  23. package/dist/components/select.js.map +1 -1
  24. package/dist/components/sheet.js +2 -2
  25. package/dist/components/sheet.js.map +1 -1
  26. package/dist/components/site-search.js +2 -2
  27. package/dist/components/site-search.js.map +1 -1
  28. package/dist/components/tooltip.js +2 -2
  29. package/dist/components/tooltip.js.map +1 -1
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +2 -0
  32. package/dist/lib/portal-boundary.d.ts +47 -0
  33. package/dist/lib/portal-boundary.js +24 -0
  34. package/dist/lib/portal-boundary.js.map +1 -0
  35. package/dist/lib/preview-theme.d.ts +167 -0
  36. package/dist/lib/preview-theme.js +176 -0
  37. package/dist/lib/preview-theme.js.map +1 -0
  38. package/dist/styles.css +1 -1
  39. package/package.json +1 -1
  40. package/src/styles/theme.css +12 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/navigation-menu.tsx"],"names":["NavigationMenuPrimitive"],"mappings":";;;;;;;;AAkCA,MAAM,iBAAA,GAAoB;AAAA,EACxB,8EAAA;AAAA,EACA,2EAAA;AAAA,EACA;AACF,CAAA;AAgBA,MAAM,gCAAgC,GAAA,CAAI;AAAA,EACxC,GAAG,iBAAA;AAAA;AAAA;AAAA,EAGH,0JAAA;AAAA,EACA,gCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA;AAAA,EAIA,0FAAA;AAAA;AAAA,EAEA,sCAAA;AAAA,EACA,kIAAA;AAAA,EACA;AACF,CAAC;AAyDD,SAAS,cAAA,CAAe;AAAA,EACtB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,GAAa,CAAA;AAAA,EACb,KAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,gBAAA,GAAmB,EAAA;AAAA;AAAA,EAEnB,kBAAA,GAAqB,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EACpC,cAAA;AAAA,EACA,UAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwB;AACtB,EAAA,uBACE,IAAA;AAAA,IAACA,gBAAA,CAAwB,IAAA;AAAA,IAAxB;AAAA,MACC,WAAA,EAAU,iBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAACA,gBAAA,CAAwB,MAAA,EAAxB,EAEC,8BAAC,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,UAACA,gBAAA,CAAwB,UAAA;AAAA,UAAxB;AAAA,YACC,WAAA,EAAU,4BAAA;AAAA,YACV,IAAA;AAAA,YACA,UAAA;AAAA,YACA,KAAA;AAAA,YACA,WAAA;AAAA,YACA,gBAAA;AAAA,YACA,kBAAA;AAAA,YACA,SAA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sBAAA;AAAA,MACV,YAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,iBAAA;AAAA,QACA,4DAAA;AAAA,QACA,+BAAA;AAAA,QACA,0FAAA;AAAA;AAAA,QAEA,kCAAA;AAAA,QACA,kIAAA;AAAA;AAAA;AAAA,QAGA,0FAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,MAAA,kBAAQ,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAW,IAAA,EAAY,CAAA;AAAA,MAC5C,GAAG;AAAA;AAAA,GACN;AAEJ","file":"navigation-menu.js","sourcesContent":["'use client'\n\nimport { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu'\nimport { cva } from 'class-variance-authority'\nimport type * as React from 'react'\n\nimport { IconKeyboardArrowDown } from '../icons/keyboard-arrow-down.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Link, type LinkProps } from '../components/link.js'\n\n// ─── Shared motion + ink tokens ───────────────────────────────────────────────\n\n// One easing curve — ease-[cubic-bezier(0.22,1,0.36,1)] — is written literally\n// on every animated part (positioner glide, popup resize, content cross-fade,\n// chevron flip) so the menu reads as a single surface in motion, not four\n// independent animations. It is Base UI's documented nav-menu curve: a strong\n// ease-out that settles without overshoot. Written out per-use rather than\n// composed from a shared const so every class stays a literal for Tailwind's\n// source-text scanner.\n\n// Every interactive tint in the menu derives from a single --nav-menu-ink\n// token via color-mix, mirroring the --footer-ink / --link-color pattern\n// (see footer.tsx, link.tsx): a restyle only has to swap the one ink value and\n// the resting/active halos follow. The derivations are written literally\n// (not template-built) because Tailwind scans source text for class names —\n// a computed string would never be emitted.\n//\n// Ink values use the RAW masterbrand tokens (--primary-800 / --primary-200)\n// rather than Tailwind's --color-* bridge aliases: Tailwind v4 tree-shakes\n// unreferenced @theme keys, and a reference from inside an arbitrary property\n// is not a usage signal. The raw tokens are plain :root declarations from\n// @nswds/tokens and always resolve.\nconst navigationMenuInk = [\n '[--nav-menu-ink:var(--primary-800)] dark:[--nav-menu-ink:var(--primary-200)]',\n '[--nav-menu-halo:color-mix(in_oklch,var(--nav-menu-ink)_10%,transparent)]',\n '[--nav-menu-halo-active:color-mix(in_oklch,var(--nav-menu-ink)_18%,transparent)]',\n]\n\n// ─── Trigger styling (exported for reuse) ─────────────────────────────────────\n\n/**\n * Trigger chrome, exported as a cva so siblings (e.g. a main-nav pattern) and\n * plain links that should sit visually beside triggers can reuse or extend it —\n * the app source's `Contact` item renders an `<a>` with exactly these classes.\n *\n * The 10% ink halo marks hover/open and the 18% mix marks pressed; both are\n * backgrounds behind unchanged text, so text contrast is untouched. The\n * keyboard focus indicator is a 2px outline in the ink colour itself\n * (primary-800 on light surfaces, primary-200 in dark mode) — well above the\n * 3:1 non-text contrast minimum of WCAG 2.2 SC 1.4.11 against the white/dark\n * popover surfaces, and offset so it is never obscured (SC 2.4.7, 2.4.11).\n */\nconst navigationMenuTriggerVariants = cva([\n ...navigationMenuInk,\n // Layout — h-9 keeps the row compact; the halo box is the pointer target.\n // mb-2 pairs with the list's bottom hairline, matching the app source.\n 'group mb-2 inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1 rounded-sm px-4 py-2 text-sm font-medium whitespace-nowrap select-none',\n 'bg-transparent text-foreground',\n 'motion-safe:transition-colors',\n // Resting halo on hover/focus/open. `focus:` (not focus-visible) is\n // deliberate for the tint — like Button, triggers give click feedback —\n // while the *outline* below stays keyboard-only.\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Base UI marks the trigger whose popup is open with data-popup-open.\n 'data-popup-open:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n 'disabled:pointer-events-none disabled:opacity-50',\n])\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuProps = Omit<NavigationMenuPrimitive.Root.Props, 'className'> &\n Pick<\n NavigationMenuPrimitive.Positioner.Props,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionPadding' | 'collisionAvoidance'\n > & {\n className?: string\n /** Extra classes for the shared popup surface (sizing, width caps, …). */\n popupClassName?: string\n /**\n * Inline styles for the shared popup surface. The popup normally sizes\n * itself from Base UI's `--popup-width`/`--popup-height`, which are\n * measured ONCE when a section activates — geometry that must track\n * something that can change while the menu is open (MainNav's\n * container-width panels, say) goes stale there. An inline style wins\n * over the measured vars and stays reactive to re-renders.\n */\n popupStyle?: React.CSSProperties\n }\n\n/**\n * Top-level navigation menu — a menubar of triggers whose panels open into one\n * shared, animated popup.\n *\n * INTERNAL to MainNav — not exported from the package barrel, not a registry\n * item, no stories. It began as a public generic wrapper but was pulled from\n * the public API: bare primitive wrappers are not the nswds-ui style (the\n * design system publishes NSW-branded components, not shadcn-alikes), and\n * MainNav is the supported way to get this behaviour. The file ships inside\n * the main-nav registry item, and the module remains reachable through the\n * package's undocumented `components/navigation-menu` export subpath purely\n * as a build artefact — treat that as private API with no stability promise.\n * (The package name is deliberately not written out here: this comment ships\n * in registry content, and the alias-leak guard rejects any occurrence of the\n * package-prefixed import form.)\n *\n * Consumers only write `List > Item > (Trigger + Content)` pairs; the popup\n * plumbing Base UI requires (Portal → Positioner → Popup → Viewport, rendered\n * once at root level, into which every `Content` teleports) is composed here so\n * it cannot be assembled wrong. Positioning knobs (`side`, `sideOffset`,\n * `align`, `collisionPadding`, `collisionAvoidance`) pass through to the\n * internal Positioner.\n *\n * Accessibility is inherited from Base UI: the root renders a `<nav>` landmark\n * (pass `aria-label` when a page has more than one), triggers are real buttons\n * wired with `aria-expanded`/`aria-controls`, ArrowDown/Enter open from the\n * keyboard, arrow keys move along the list, and Escape or focus-out closes\n * (WAI-ARIA disclosure navigation pattern). Do not add ARIA by hand.\n *\n * Departure from the nswds-app source: that wrapper was Radix-based with an\n * optional inline viewport (`viewport` prop); Base UI's model has exactly one\n * viewport, so the prop is gone. Radix's `delayDuration`/`skipDelayDuration`\n * map to Base UI's `delay`/`closeDelay` (both default 50ms).\n */\nfunction NavigationMenu({\n className,\n children,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n // Keep a gutter between the popup and the viewport edge on small screens.\n collisionPadding = 20,\n // Nav panels should never flip beside their menubar — cap size instead.\n collisionAvoidance = { side: 'none' },\n popupClassName,\n popupStyle,\n ...props\n}: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot='navigation-menu'\n className={cn(\n 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',\n className,\n )}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <NavigationMenuPrimitive.Positioner\n data-slot='navigation-menu-positioner'\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className={cn(\n // Base UI reports its measured geometry through these vars; sizing\n // the box from them lets top/left glide between triggers.\n 'isolate z-50 box-border h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)]',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[top,left,right,bottom]',\n // data-instant: Base UI disables the glide (e.g. keyboard re-anchor).\n 'data-instant:transition-none',\n )}\n >\n <NavigationMenuPrimitive.Popup\n data-slot='navigation-menu-popup'\n className={cn(\n // House popup surface (see popover.tsx / sheet.tsx).\n 'relative rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10',\n // Width/height track the active Content's size (Base UI measures\n // it into --popup-*), so switching sections morphs the surface\n // instead of jump-cutting.\n 'h-[var(--popup-height)] w-[var(--popup-width)] max-w-[var(--available-width)] origin-(--transform-origin)',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,transform,width,height,scale,translate]',\n // Open/close via Base UI transition attributes.\n 'data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:scale-95 data-ending-style:opacity-0',\n popupClassName,\n )}\n style={popupStyle}\n >\n <NavigationMenuPrimitive.Viewport\n data-slot='navigation-menu-viewport'\n // Clips the outgoing/incoming Content pair during a section\n // switch; rounded to match the popup so corners don't leak.\n className='relative size-full overflow-hidden rounded-md'\n />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </ButtonGroupBoundary>\n </NavigationMenuPrimitive.Portal>\n </NavigationMenuPrimitive.Root>\n )\n}\n\n// ─── List / Item ──────────────────────────────────────────────────────────────\n\ntype NavigationMenuListProps = Omit<NavigationMenuPrimitive.List.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The menubar row of triggers. Base UI renders a `<ul>` and manages roving\n * arrow-key focus between the items.\n *\n * Carries the app source's bottom hairline (tokenised from raw grey utilities\n * to the semantic `border-border`, which already flips for dark mode) and its\n * hidden-scrollbar overflow so a long menu can pan on narrow screens.\n *\n * `overflow-x-auto` is what makes that panning real. The scrollbar-HIDING\n * declarations beside it (`[scrollbar-width:none]`, the `::-webkit-scrollbar`\n * rule) are inert on their own: an `overflow: visible` box has no scrollbar to\n * hide, so without this the row simply overflowed its container and pushed a\n * horizontal scrollbar onto the page. `whitespace-nowrap` plus the `shrink-0`\n * items MainNav renders means a bar with more entries than fit is the normal\n * case on a phone, not an edge case.\n *\n * Two consequences of becoming a scroll container, both handled at the call\n * site rather than here:\n *\n * - Per CSS overflow, a non-visible `overflow-x` forces `overflow-y` to\n * compute to `auto`, so anything drawn OUTSIDE a row item's border box is\n * clipped. Items inside the list therefore use inset focus rings\n * (`-outline-offset-*`) — see `mainNavTriggerClassName` /\n * `mainNavTopLinkClassName`. Links inside a `NavigationMenuContent` panel\n * are portalled out of this box and keep the house outward-offset ring.\n * - `justify-center` (the default below) makes the leading overflow\n * unreachable in a scroll container — the well-known centred-flex overflow\n * trap. MainNav overrides it with `justify-start`; any future consumer that\n * keeps the centred default must not also rely on scrolling.\n */\nfunction NavigationMenuList({ className, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot='navigation-menu-list'\n className={cn(\n 'group flex flex-1 list-none items-center justify-center gap-1',\n '[scrollbar-width:none] overflow-x-auto border-b border-border whitespace-nowrap [&::-webkit-scrollbar]:hidden',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype NavigationMenuItemProps = Omit<NavigationMenuPrimitive.Item.Props, 'className'> & {\n className?: string\n}\n\n/**\n * One menubar entry (`<li>`), pairing a `NavigationMenuTrigger` with its\n * `NavigationMenuContent` — or holding a bare `NavigationMenuLink` for items\n * with no panel. Pass `value` when controlling the open item programmatically.\n */\nfunction NavigationMenuItem({ className, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot='navigation-menu-item'\n className={cn('relative', className)}\n {...props}\n />\n )\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuTriggerProps = Omit<NavigationMenuPrimitive.Trigger.Props, 'className'> & {\n className?: string\n}\n\n/**\n * Opens the item's panel. Renders a real `<button>` (never an anchor — the\n * trigger discloses content, it doesn't navigate), which Base UI wires with\n * `aria-expanded`/`aria-controls` and hover/click/keyboard open behaviour.\n *\n * The trailing chevron rides Base UI's Icon part, which mirrors the trigger's\n * `data-popup-open` attribute — the 180° flip is pure CSS off that attribute\n * (no JS state), and is suppressed for reduced-motion users (WCAG 2.3.3).\n * The chevron is decorative, so the Icon part is `aria-hidden`: it never\n * enters the button's accessible name, and the open state it hints at is\n * already conveyed programmatically via `aria-expanded` (SC 4.1.2).\n */\nfunction NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot='navigation-menu-trigger'\n className={cn(navigationMenuTriggerVariants(), className)}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Icon\n data-slot='navigation-menu-icon'\n aria-hidden='true'\n className='flex duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-safe:transition-transform'\n >\n <IconKeyboardArrowDown className='size-5' />\n </NavigationMenuPrimitive.Icon>\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuContentProps = Omit<NavigationMenuPrimitive.Content.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The panel for one item. Authored inline next to its Trigger, but rendered\n * (teleported by Base UI) into the shared root-level Viewport while active —\n * so panel-to-panel switches cross-fade inside one popup surface.\n *\n * The directional slide keys off `data-activation-direction` (which adjacent\n * trigger the user came from), matching the app source's from-start/from-end\n * motion. Set `keepMounted` to keep the panel in the DOM for SSR crawlers.\n */\nfunction NavigationMenuContent({ className, children, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot='navigation-menu-content'\n className={cn(\n 'h-full w-max max-w-[var(--available-width)] p-2',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,translate]',\n 'data-ending-style:opacity-0 data-starting-style:opacity-0',\n // Slide with the direction of travel between adjacent triggers.\n 'data-starting-style:data-[activation-direction=left]:-translate-x-1/2',\n 'data-starting-style:data-[activation-direction=right]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=left]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=right]:-translate-x-1/2',\n className,\n )}\n {...props}\n >\n {/* Reset the button group HERE, not only at the portal in the root.\n This element is declared by the consumer inside NavigationMenuItem,\n so React context reaches it from whatever encloses the menu — while\n Base UI hosts its DOM in the portalled viewport, where the group's\n own CSS cannot follow. Opened from inside a ButtonGroup, a control\n in this panel would otherwise get the JS half of the segment\n treatment and not the CSS half: squared corners and a ghost variant\n on the panel's own surface, and on a solid band a label re-inked to\n the band's colour. Verified in the browser: the link measured\n `data-segment=\"default\"`, `data-band=\"outline\"` and a 0px radius\n while sitting outside the group in the DOM.\n `check:portal-boundary` cannot see this one — it checks the portal,\n and this content is declared outside it — so the `In Overlays` play\n is what pins it. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </NavigationMenuPrimitive.Content>\n )\n}\n\n// ─── Link ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuLinkProps = Omit<\n NavigationMenuPrimitive.Link.Props,\n 'className' | 'render' | 'href'\n> & {\n className?: string\n /**\n * Link target. Accepts the same string-or-UrlObject union as `Link`, since\n * the rendered element may be a framework link injected via `LinkProvider`.\n */\n href: LinkProps['href']\n}\n\n/**\n * A navigation link inside (or beside) the menu. Composes the design system's\n * `Link` through Base UI's `render` prop: Base UI keeps the behaviour —\n * roving focus, focus-out closing, `aria-current='page'` when `active`, close\n * on click — while `Link` supplies the element, so a `LinkProvider` framework\n * component (e.g. next/link) is injected automatically. `Link` renders with\n * `variant='unstyled'`; this component owns the visual treatment (same ink\n * halo/outline contract as the trigger — see `navigationMenuTriggerVariants`).\n *\n * Departure from Base UI's default: `closeOnClick` defaults to **true** here.\n * In an SPA a client-side navigation doesn't reload the document, so a menu\n * that stays open after choosing a destination reads as broken; pass\n * `closeOnClick={false}` for in-page links that should keep the panel open.\n *\n * Set `active` for the current page (the app source's `usePathname` check is\n * a framework API this package must not import — compare in the consumer and\n * pass the result down): it sets `aria-current='page'` (WCAG 2.4.8 support)\n * and the persistent halo via `data-active`.\n */\nfunction NavigationMenuLink({\n className,\n href,\n closeOnClick = true,\n ...props\n}: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot='navigation-menu-link'\n closeOnClick={closeOnClick}\n className={cn(\n navigationMenuInk,\n 'flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground',\n 'motion-safe:transition-colors',\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Persistent tint for the current page (`active` prop → data-active).\n 'data-active:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n // Unsized inline icons default to text scale and muted ink; explicit\n // size-*/text-* classes on the icon win.\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n render={<Link variant='unstyled' href={href} />}\n {...props}\n />\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerVariants,\n}\nexport type {\n NavigationMenuContentProps,\n NavigationMenuItemProps,\n NavigationMenuLinkProps,\n NavigationMenuListProps,\n NavigationMenuProps,\n NavigationMenuTriggerProps,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/navigation-menu.tsx"],"names":["NavigationMenuPrimitive"],"mappings":";;;;;;;;;AAmCA,MAAM,iBAAA,GAAoB;AAAA,EACxB,8EAAA;AAAA,EACA,2EAAA;AAAA,EACA;AACF,CAAA;AAgBA,MAAM,gCAAgC,GAAA,CAAI;AAAA,EACxC,GAAG,iBAAA;AAAA;AAAA;AAAA,EAGH,0JAAA;AAAA,EACA,gCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA;AAAA,EAIA,0FAAA;AAAA;AAAA,EAEA,sCAAA;AAAA,EACA,kIAAA;AAAA,EACA;AACF,CAAC;AAyDD,SAAS,cAAA,CAAe;AAAA,EACtB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,GAAa,CAAA;AAAA,EACb,KAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,gBAAA,GAAmB,EAAA;AAAA;AAAA,EAEnB,kBAAA,GAAqB,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EACpC,cAAA;AAAA,EACA,UAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwB;AACtB,EAAA,uBACE,IAAA;AAAA,IAACA,gBAAA,CAAwB,IAAA;AAAA,IAAxB;AAAA,MACC,WAAA,E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A,2DAAA;AAAA;AAAA,QAEA,uEAAA;AAAA,QACA,uEAAA;AAAA,QACA,oEAAA;AAAA,QACA,sEAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAgBJ,QAAA,kBAAA,GAAA,CAAC,uBAAqB,QAAA,EAAS;AAAA;AAAA,GACjC;AAEJ;AAmCA,SAAS,kBAAA,CAAmB;AAAA,EAC1B,SAAA;AAAA,EACA,IAAA;AAAA,EACA,YAAA,GAAe,IAAA;AAAA,EACf,GAAG;AACL,CAAA,EAA4B;AAC1B,EAAA,uBACE,GAAA;AAAA,IAACA,gBAAA,CAAwB,IAAA;AAAA,IAAxB;AAAA,MACC,WAAA,EAAU,sBAAA;AAAA,MACV,YAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,iBAAA;AAAA,QACA,4DAAA;AAAA,QACA,+BAAA;AAAA,QACA,0FAAA;AAAA;AAAA,QAEA,kCAAA;AAAA,QACA,kIAAA;AAAA;AAAA;AAAA,QAGA,0FAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,MAAA,kBAAQ,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAW,IAAA,EAAY,CAAA;AAAA,MAC5C,GAAG;AAAA;AAAA,GACN;AAEJ","file":"navigation-menu.js","sourcesContent":["'use client'\n\nimport { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu'\nimport { cva } from 'class-variance-authority'\nimport type * as React from 'react'\n\nimport { IconKeyboardArrowDown } from '../icons/keyboard-arrow-down.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Link, type LinkProps } from '../components/link.js'\n\n// ─── Shared motion + ink tokens ───────────────────────────────────────────────\n\n// One easing curve — ease-[cubic-bezier(0.22,1,0.36,1)] — is written literally\n// on every animated part (positioner glide, popup resize, content cross-fade,\n// chevron flip) so the menu reads as a single surface in motion, not four\n// independent animations. It is Base UI's documented nav-menu curve: a strong\n// ease-out that settles without overshoot. Written out per-use rather than\n// composed from a shared const so every class stays a literal for Tailwind's\n// source-text scanner.\n\n// Every interactive tint in the menu derives from a single --nav-menu-ink\n// token via color-mix, mirroring the --footer-ink / --link-color pattern\n// (see footer.tsx, link.tsx): a restyle only has to swap the one ink value and\n// the resting/active halos follow. The derivations are written literally\n// (not template-built) because Tailwind scans source text for class names —\n// a computed string would never be emitted.\n//\n// Ink values use the RAW masterbrand tokens (--primary-800 / --primary-200)\n// rather than Tailwind's --color-* bridge aliases: Tailwind v4 tree-shakes\n// unreferenced @theme keys, and a reference from inside an arbitrary property\n// is not a usage signal. The raw tokens are plain :root declarations from\n// @nswds/tokens and always resolve.\nconst navigationMenuInk = [\n '[--nav-menu-ink:var(--primary-800)] dark:[--nav-menu-ink:var(--primary-200)]',\n '[--nav-menu-halo:color-mix(in_oklch,var(--nav-menu-ink)_10%,transparent)]',\n '[--nav-menu-halo-active:color-mix(in_oklch,var(--nav-menu-ink)_18%,transparent)]',\n]\n\n// ─── Trigger styling (exported for reuse) ─────────────────────────────────────\n\n/**\n * Trigger chrome, exported as a cva so siblings (e.g. a main-nav pattern) and\n * plain links that should sit visually beside triggers can reuse or extend it —\n * the app source's `Contact` item renders an `<a>` with exactly these classes.\n *\n * The 10% ink halo marks hover/open and the 18% mix marks pressed; both are\n * backgrounds behind unchanged text, so text contrast is untouched. The\n * keyboard focus indicator is a 2px outline in the ink colour itself\n * (primary-800 on light surfaces, primary-200 in dark mode) — well above the\n * 3:1 non-text contrast minimum of WCAG 2.2 SC 1.4.11 against the white/dark\n * popover surfaces, and offset so it is never obscured (SC 2.4.7, 2.4.11).\n */\nconst navigationMenuTriggerVariants = cva([\n ...navigationMenuInk,\n // Layout — h-9 keeps the row compact; the halo box is the pointer target.\n // mb-2 pairs with the list's bottom hairline, matching the app source.\n 'group mb-2 inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1 rounded-sm px-4 py-2 text-sm font-medium whitespace-nowrap select-none',\n 'bg-transparent text-foreground',\n 'motion-safe:transition-colors',\n // Resting halo on hover/focus/open. `focus:` (not focus-visible) is\n // deliberate for the tint — like Button, triggers give click feedback —\n // while the *outline* below stays keyboard-only.\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Base UI marks the trigger whose popup is open with data-popup-open.\n 'data-popup-open:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n 'disabled:pointer-events-none disabled:opacity-50',\n])\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuProps = Omit<NavigationMenuPrimitive.Root.Props, 'className'> &\n Pick<\n NavigationMenuPrimitive.Positioner.Props,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionPadding' | 'collisionAvoidance'\n > & {\n className?: string\n /** Extra classes for the shared popup surface (sizing, width caps, …). */\n popupClassName?: string\n /**\n * Inline styles for the shared popup surface. The popup normally sizes\n * itself from Base UI's `--popup-width`/`--popup-height`, which are\n * measured ONCE when a section activates — geometry that must track\n * something that can change while the menu is open (MainNav's\n * container-width panels, say) goes stale there. An inline style wins\n * over the measured vars and stays reactive to re-renders.\n */\n popupStyle?: React.CSSProperties\n }\n\n/**\n * Top-level navigation menu — a menubar of triggers whose panels open into one\n * shared, animated popup.\n *\n * INTERNAL to MainNav — not exported from the package barrel, not a registry\n * item, no stories. It began as a public generic wrapper but was pulled from\n * the public API: bare primitive wrappers are not the nswds-ui style (the\n * design system publishes NSW-branded components, not shadcn-alikes), and\n * MainNav is the supported way to get this behaviour. The file ships inside\n * the main-nav registry item, and the module remains reachable through the\n * package's undocumented `components/navigation-menu` export subpath purely\n * as a build artefact — treat that as private API with no stability promise.\n * (The package name is deliberately not written out here: this comment ships\n * in registry content, and the alias-leak guard rejects any occurrence of the\n * package-prefixed import form.)\n *\n * Consumers only write `List > Item > (Trigger + Content)` pairs; the popup\n * plumbing Base UI requires (Portal → Positioner → Popup → Viewport, rendered\n * once at root level, into which every `Content` teleports) is composed here so\n * it cannot be assembled wrong. Positioning knobs (`side`, `sideOffset`,\n * `align`, `collisionPadding`, `collisionAvoidance`) pass through to the\n * internal Positioner.\n *\n * Accessibility is inherited from Base UI: the root renders a `<nav>` landmark\n * (pass `aria-label` when a page has more than one), triggers are real buttons\n * wired with `aria-expanded`/`aria-controls`, ArrowDown/Enter open from the\n * keyboard, arrow keys move along the list, and Escape or focus-out closes\n * (WAI-ARIA disclosure navigation pattern). Do not add ARIA by hand.\n *\n * Departure from the nswds-app source: that wrapper was Radix-based with an\n * optional inline viewport (`viewport` prop); Base UI's model has exactly one\n * viewport, so the prop is gone. Radix's `delayDuration`/`skipDelayDuration`\n * map to Base UI's `delay`/`closeDelay` (both default 50ms).\n */\nfunction NavigationMenu({\n className,\n children,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n // Keep a gutter between the popup and the viewport edge on small screens.\n collisionPadding = 20,\n // Nav panels should never flip beside their menubar — cap size instead.\n collisionAvoidance = { side: 'none' },\n popupClassName,\n popupStyle,\n ...props\n}: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot='navigation-menu'\n className={cn(\n 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',\n className,\n )}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Portal>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>\n <NavigationMenuPrimitive.Positioner\n data-slot='navigation-menu-positioner'\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className={cn(\n // Base UI reports its measured geometry through these vars; sizing\n // the box from them lets top/left glide between triggers.\n 'isolate z-50 box-border h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)]',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[top,left,right,bottom]',\n // data-instant: Base UI disables the glide (e.g. keyboard re-anchor).\n 'data-instant:transition-none',\n )}\n >\n <NavigationMenuPrimitive.Popup\n data-slot='navigation-menu-popup'\n className={cn(\n // House popup surface (see popover.tsx / sheet.tsx).\n 'relative rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10',\n // Width/height track the active Content's size (Base UI measures\n // it into --popup-*), so switching sections morphs the surface\n // instead of jump-cutting.\n 'h-[var(--popup-height)] w-[var(--popup-width)] max-w-[var(--available-width)] origin-(--transform-origin)',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,transform,width,height,scale,translate]',\n // Open/close via Base UI transition attributes.\n 'data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:scale-95 data-ending-style:opacity-0',\n popupClassName,\n )}\n style={popupStyle}\n >\n <NavigationMenuPrimitive.Viewport\n data-slot='navigation-menu-viewport'\n // Clips the outgoing/incoming Content pair during a section\n // switch; rounded to match the popup so corners don't leak.\n className='relative size-full overflow-hidden rounded-md'\n />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </PortalBoundary>\n </NavigationMenuPrimitive.Portal>\n </NavigationMenuPrimitive.Root>\n )\n}\n\n// ─── List / Item ──────────────────────────────────────────────────────────────\n\ntype NavigationMenuListProps = Omit<NavigationMenuPrimitive.List.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The menubar row of triggers. Base UI renders a `<ul>` and manages roving\n * arrow-key focus between the items.\n *\n * Carries the app source's bottom hairline (tokenised from raw grey utilities\n * to the semantic `border-border`, which already flips for dark mode) and its\n * hidden-scrollbar overflow so a long menu can pan on narrow screens.\n *\n * `overflow-x-auto` is what makes that panning real. The scrollbar-HIDING\n * declarations beside it (`[scrollbar-width:none]`, the `::-webkit-scrollbar`\n * rule) are inert on their own: an `overflow: visible` box has no scrollbar to\n * hide, so without this the row simply overflowed its container and pushed a\n * horizontal scrollbar onto the page. `whitespace-nowrap` plus the `shrink-0`\n * items MainNav renders means a bar with more entries than fit is the normal\n * case on a phone, not an edge case.\n *\n * Two consequences of becoming a scroll container, both handled at the call\n * site rather than here:\n *\n * - Per CSS overflow, a non-visible `overflow-x` forces `overflow-y` to\n * compute to `auto`, so anything drawn OUTSIDE a row item's border box is\n * clipped. Items inside the list therefore use inset focus rings\n * (`-outline-offset-*`) — see `mainNavTriggerClassName` /\n * `mainNavTopLinkClassName`. Links inside a `NavigationMenuContent` panel\n * are portalled out of this box and keep the house outward-offset ring.\n * - `justify-center` (the default below) makes the leading overflow\n * unreachable in a scroll container — the well-known centred-flex overflow\n * trap. MainNav overrides it with `justify-start`; any future consumer that\n * keeps the centred default must not also rely on scrolling.\n */\nfunction NavigationMenuList({ className, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot='navigation-menu-list'\n className={cn(\n 'group flex flex-1 list-none items-center justify-center gap-1',\n '[scrollbar-width:none] overflow-x-auto border-b border-border whitespace-nowrap [&::-webkit-scrollbar]:hidden',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype NavigationMenuItemProps = Omit<NavigationMenuPrimitive.Item.Props, 'className'> & {\n className?: string\n}\n\n/**\n * One menubar entry (`<li>`), pairing a `NavigationMenuTrigger` with its\n * `NavigationMenuContent` — or holding a bare `NavigationMenuLink` for items\n * with no panel. Pass `value` when controlling the open item programmatically.\n */\nfunction NavigationMenuItem({ className, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot='navigation-menu-item'\n className={cn('relative', className)}\n {...props}\n />\n )\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuTriggerProps = Omit<NavigationMenuPrimitive.Trigger.Props, 'className'> & {\n className?: string\n}\n\n/**\n * Opens the item's panel. Renders a real `<button>` (never an anchor — the\n * trigger discloses content, it doesn't navigate), which Base UI wires with\n * `aria-expanded`/`aria-controls` and hover/click/keyboard open behaviour.\n *\n * The trailing chevron rides Base UI's Icon part, which mirrors the trigger's\n * `data-popup-open` attribute — the 180° flip is pure CSS off that attribute\n * (no JS state), and is suppressed for reduced-motion users (WCAG 2.3.3).\n * The chevron is decorative, so the Icon part is `aria-hidden`: it never\n * enters the button's accessible name, and the open state it hints at is\n * already conveyed programmatically via `aria-expanded` (SC 4.1.2).\n */\nfunction NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot='navigation-menu-trigger'\n className={cn(navigationMenuTriggerVariants(), className)}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Icon\n data-slot='navigation-menu-icon'\n aria-hidden='true'\n className='flex duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-safe:transition-transform'\n >\n <IconKeyboardArrowDown className='size-5' />\n </NavigationMenuPrimitive.Icon>\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuContentProps = Omit<NavigationMenuPrimitive.Content.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The panel for one item. Authored inline next to its Trigger, but rendered\n * (teleported by Base UI) into the shared root-level Viewport while active —\n * so panel-to-panel switches cross-fade inside one popup surface.\n *\n * The directional slide keys off `data-activation-direction` (which adjacent\n * trigger the user came from), matching the app source's from-start/from-end\n * motion. Set `keepMounted` to keep the panel in the DOM for SSR crawlers.\n */\nfunction NavigationMenuContent({ className, children, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot='navigation-menu-content'\n className={cn(\n 'h-full w-max max-w-[var(--available-width)] p-2',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,translate]',\n 'data-ending-style:opacity-0 data-starting-style:opacity-0',\n // Slide with the direction of travel between adjacent triggers.\n 'data-starting-style:data-[activation-direction=left]:-translate-x-1/2',\n 'data-starting-style:data-[activation-direction=right]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=left]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=right]:-translate-x-1/2',\n className,\n )}\n {...props}\n >\n {/* Reset the button group HERE, not only at the portal in the root.\n This element is declared by the consumer inside NavigationMenuItem,\n so React context reaches it from whatever encloses the menu — while\n Base UI hosts its DOM in the portalled viewport, where the group's\n own CSS cannot follow. Opened from inside a ButtonGroup, a control\n in this panel would otherwise get the JS half of the segment\n treatment and not the CSS half: squared corners and a ghost variant\n on the panel's own surface, and on a solid band a label re-inked to\n the band's colour. Verified in the browser: the link measured\n `data-segment=\"default\"`, `data-band=\"outline\"` and a 0px radius\n while sitting outside the group in the DOM.\n `check:portal-boundary` cannot see this one — it checks the portal,\n and this content is declared outside it — so the `In Overlays` play\n is what pins it. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </NavigationMenuPrimitive.Content>\n )\n}\n\n// ─── Link ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuLinkProps = Omit<\n NavigationMenuPrimitive.Link.Props,\n 'className' | 'render' | 'href'\n> & {\n className?: string\n /**\n * Link target. Accepts the same string-or-UrlObject union as `Link`, since\n * the rendered element may be a framework link injected via `LinkProvider`.\n */\n href: LinkProps['href']\n}\n\n/**\n * A navigation link inside (or beside) the menu. Composes the design system's\n * `Link` through Base UI's `render` prop: Base UI keeps the behaviour —\n * roving focus, focus-out closing, `aria-current='page'` when `active`, close\n * on click — while `Link` supplies the element, so a `LinkProvider` framework\n * component (e.g. next/link) is injected automatically. `Link` renders with\n * `variant='unstyled'`; this component owns the visual treatment (same ink\n * halo/outline contract as the trigger — see `navigationMenuTriggerVariants`).\n *\n * Departure from Base UI's default: `closeOnClick` defaults to **true** here.\n * In an SPA a client-side navigation doesn't reload the document, so a menu\n * that stays open after choosing a destination reads as broken; pass\n * `closeOnClick={false}` for in-page links that should keep the panel open.\n *\n * Set `active` for the current page (the app source's `usePathname` check is\n * a framework API this package must not import — compare in the consumer and\n * pass the result down): it sets `aria-current='page'` (WCAG 2.4.8 support)\n * and the persistent halo via `data-active`.\n */\nfunction NavigationMenuLink({\n className,\n href,\n closeOnClick = true,\n ...props\n}: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot='navigation-menu-link'\n closeOnClick={closeOnClick}\n className={cn(\n navigationMenuInk,\n 'flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground',\n 'motion-safe:transition-colors',\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Persistent tint for the current page (`active` prop → data-active).\n 'data-active:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n // Unsized inline icons default to text scale and muted ink; explicit\n // size-*/text-* classes on the icon win.\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n render={<Link variant='unstyled' href={href} />}\n {...props}\n />\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerVariants,\n}\nexport type {\n NavigationMenuContentProps,\n NavigationMenuItemProps,\n NavigationMenuLinkProps,\n NavigationMenuListProps,\n NavigationMenuProps,\n NavigationMenuTriggerProps,\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Popover as Popover$1 } from '@base-ui/react/popover';
4
- import { ButtonGroupBoundary } from '../lib/button-group-context.js';
4
+ import { PortalBoundary } from '../lib/portal-boundary.js';
5
5
  import { cn } from '../lib/utils.js';
6
6
 
7
7
  function Popover({ ...props }) {
@@ -18,7 +18,7 @@ function PopoverContent({
18
18
  sideOffset = 4,
19
19
  ...props
20
20
  }) {
21
- return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children: /* @__PURE__ */ jsx(
21
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(PortalBoundary, { children: /* @__PURE__ */ jsx(
22
22
  Popover$1.Positioner,
23
23
  {
24
24
  align,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/popover.tsx"],"names":["PopoverPrimitive"],"mappings":";;;;;AAQA,SAAS,OAAA,CAAQ,EAAE,GAAG,KAAA,EAAM,EAAgC;AAC1D,EAAA,2BAAQA,SAAA,CAAiB,IAAA,EAAjB,EAAsB,WAAA,EAAU,SAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAC/D;AAEA,SAAS,cAAA,CAAe,EAAE,GAAG,KAAA,EAAM,EAAmC;AACpE,EAAA,2BAAQA,SAAA,CAAiB,OAAA,EAAjB,EAAyB,WAAA,EAAU,iBAAA,EAAmB,GAAG,KAAA,EAAO,CAAA;AAC1E;AAEA,SAAS,cAAA,CAAe;AAAA,EACtB,SAAA;AAAA,EACA,KAAA,GAAQ,QAAA;AAAA,EACR,WAAA,GAAc,CAAA;AAAA,EACd,IAAA,GAAO,QAAA;AAAA,EACP,UAAA,GAAa,CAAA;AAAA,EACb,GAAG;AACL,CAAA,EAC4F;AAC1F,EAAA,uBACE,GAAA,CAACA,SAAA,CAAiB,MAAA,EAAjB,EAEC,8BAAC,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAACA,SAAA,CAAiB,UAAA;AAAA,IAAjB;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA,EAAU,cAAA;AAAA,MAEV,QAAA,kBAAA,GAAA;AAAA,QAACA,SAAA,CAAiB,KAAA;AAAA,QAAjB;AAAA,UACC,WAAA,EAAU,iBAAA;AAAA,UACV,SAAA,EAAW,EAAA;AAAA,YACT,wiBAAA;AAAA,YACA;AAAA,WACF;AAAA,UACC,GAAG;AAAA;AAAA;AACN;AAAA,KAEJ,CAAA,EACF,CAAA;AAEJ;AAEA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,gBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,6BAAA,EAA+B,SAAS,CAAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAiC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA,CAAiB,KAAA;AAAA,IAAjB;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,SAAS,CAAA;AAAA,MAC7C,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAuC;AACvF,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA,CAAiB,WAAA;AAAA,IAAjB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uBAAA,EAAyB,SAAS,CAAA;AAAA,MAC/C,GAAG;AAAA;AAAA,GACN;AAEJ","file":"popover.js","sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport * as React from 'react'\n\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Popover({ ...props }: PopoverPrimitive.Root.Props) {\n return <PopoverPrimitive.Root data-slot='popover' {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {\n return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: PopoverPrimitive.Popup.Props &\n Pick<PopoverPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {\n return (\n <PopoverPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <PopoverPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className='isolate z-50'\n >\n <PopoverPrimitive.Popup\n data-slot='popover-content'\n className={cn(\n 'z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-2.5 text-xs text-popover-foreground ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </ButtonGroupBoundary>\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='popover-header'\n className={cn('flex flex-col gap-1 text-xs', className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {\n return (\n <PopoverPrimitive.Title\n data-slot='popover-title'\n className={cn('text-sm font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {\n return (\n <PopoverPrimitive.Description\n data-slot='popover-description'\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger }\n"]}
1
+ {"version":3,"sources":["../../src/components/popover.tsx"],"names":["PopoverPrimitive"],"mappings":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AAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAiC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA,CAAiB,KAAA;AAAA,IAAjB;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,SAAS,CAAA;AAAA,MAC7C,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAuC;AACvF,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA,CAAiB,WAAA;AAAA,IAAjB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uBAAA,EAAyB,SAAS,CAAA;AAAA,MAC/C,GAAG;AAAA;AAAA,GACN;AAEJ","file":"popover.js","sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport * as React from 'react'\n\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Popover({ ...props }: PopoverPrimitive.Root.Props) {\n return <PopoverPrimitive.Root data-slot='popover' {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {\n return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: PopoverPrimitive.Popup.Props &\n Pick<PopoverPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {\n return (\n <PopoverPrimitive.Portal>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>\n <PopoverPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className='isolate z-50'\n >\n <PopoverPrimitive.Popup\n data-slot='popover-content'\n className={cn(\n 'z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-2.5 text-xs text-popover-foreground ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PortalBoundary>\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='popover-header'\n className={cn('flex flex-col gap-1 text-xs', className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {\n return (\n <PopoverPrimitive.Title\n data-slot='popover-title'\n className={cn('text-sm font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {\n return (\n <PopoverPrimitive.Description\n data-slot='popover-description'\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger }\n"]}
@@ -5,7 +5,7 @@ import { cva } from 'class-variance-authority';
5
5
  import { IconCheck } from '../icons/check.js';
6
6
  import { IconExpandLess } from '../icons/expand-less.js';
7
7
  import { IconExpandMore } from '../icons/expand-more.js';
8
- import { ButtonGroupBoundary } from '../lib/button-group-context.js';
8
+ import { PortalBoundary } from '../lib/portal-boundary.js';
9
9
  import { resolveVariant } from '../lib/resolve-variant.js';
10
10
  import { cn } from '../lib/utils.js';
11
11
 
@@ -101,7 +101,7 @@ function SelectContent({
101
101
  alignItemWithTrigger = true,
102
102
  ...props
103
103
  }) {
104
- return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children: /* @__PURE__ */ jsx(
104
+ return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(PortalBoundary, { children: /* @__PURE__ */ jsx(
105
105
  Select$1.Positioner,
106
106
  {
107
107
  side,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;;;AAaA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,MACzC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,wBAAA,EAA0B,SAAS,CAAA;AAAA,MAChD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,qBAAA,GAAwB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe5B,uuBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA,QAEP,OAAA,EACE,sFAAA;AAAA;AAAA,QAEF,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,gBAAA;AAAA,QACT,EAAA,EAAI;AAAA;A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e;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the focus\n // outline below. Dark mode and brand themes restyle via tokens, so there are\n // no dark: variants.\n //\n // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and\n // for the same reason (see button.tsx). This trigger is a <button>, and a\n // button focused by MOUSE does not match :focus-visible, so on a pointer click\n // the ring never painted. A native <select> DOES match :focus-visible on click\n // (the browser's form-control heuristic), which is why NativeSelect keeps\n // focus-visible; this custom trigger cannot, so `focus:` rings on click too and\n // the control reads as focused like the rest of the field family. Do not\n // \"unify\" it back to focus-visible.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n // Resolved once (see `resolveVariant`), so cva and the data attributes\n // agree for `null` and `''` as well as the default spelling.\n const variantway = resolveVariant(variant, 'default')\n const sizeway = resolveVariant(size, 'default')\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attribute from the classes both derive from the resolved value.\n data-size={sizeway}\n data-variant={variantway}\n className={cn(selectTriggerVariants({ variant: variantway, size: sizeway, className }))}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </ButtonGroupBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;;;AAaA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WA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GAAG,OAAM,EAAoC;AACjF,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,SAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,kDAAA,EAAoD,SAAS,CAAA;AAAA,MAC1E,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,oBAAA,CAAqB;AAAA,EAC5B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA+D;AAC7D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,aAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,yBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,0HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ;AAEA,SAAS,sBAAA,CAAuB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,eAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,2BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the focus\n // outline below. Dark mode and brand themes restyle via tokens, so there are\n // no dark: variants.\n //\n // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and\n // for the same reason (see button.tsx). This trigger is a <button>, and a\n // button focused by MOUSE does not match :focus-visible, so on a pointer click\n // the ring never painted. A native <select> DOES match :focus-visible on click\n // (the browser's form-control heuristic), which is why NativeSelect keeps\n // focus-visible; this custom trigger cannot, so `focus:` rings on click too and\n // the control reads as focused like the rest of the field family. Do not\n // \"unify\" it back to focus-visible.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n // Resolved once (see `resolveVariant`), so cva and the data attributes\n // agree for `null` and `''` as well as the default spelling.\n const variantway = resolveVariant(variant, 'default')\n const sizeway = resolveVariant(size, 'default')\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attribute from the classes both derive from the resolved value.\n data-size={sizeway}\n data-variant={variantway}\n className={cn(selectTriggerVariants({ variant: variantway, size: sizeway, className }))}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </PortalBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
@@ -4,8 +4,8 @@ import { Dialog } from '@base-ui/react/dialog';
4
4
  import * as React from 'react';
5
5
  import { Button } from '../components/button.js';
6
6
  import { IconClose } from '../icons/close.js';
7
- import { ButtonGroupBoundary } from '../lib/button-group-context.js';
8
7
  import { overlayScrim } from '../lib/overlay.js';
8
+ import { PortalBoundary } from '../lib/portal-boundary.js';
9
9
  import { cn } from '../lib/utils.js';
10
10
 
11
11
  function Sheet({ ...props }) {
@@ -18,7 +18,7 @@ function SheetClose({ ...props }) {
18
18
  return /* @__PURE__ */ jsx(Dialog.Close, { "data-slot": "sheet-close", ...props });
19
19
  }
20
20
  function SheetPortal({ children, ...props }) {
21
- return /* @__PURE__ */ jsx(Dialog.Portal, { "data-slot": "sheet-portal", ...props, children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children }) });
21
+ return /* @__PURE__ */ jsx(Dialog.Portal, { "data-slot": "sheet-portal", ...props, children: /* @__PURE__ */ jsx(PortalBoundary, { children }) });
22
22
  }
23
23
  function SheetOverlay({ className, ...props }) {
24
24
  return /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;;;;AAWA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACtD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC3D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AAChE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AACtE;AAEA,SAAS,UAAA,CAAW,EAAE,GAAG,KAAA,EAAM,EAA+B;AAC5D,EAAA,2BAAQA,MAAA,CAAe,KAAA,EAAf,EAAqB,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAClE;AAEA,SAAS,WAAA,CAAY,EAAE,QAAA,EAAU,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA,CAACA,MAAA,CAAe,MAAA,EAAf,EAAsB,WAAA,EAAU,cAAA,EAAgB,GAAG,KAAA,EAElD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC,CAAA;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC5E,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,QAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,8GAAA;AAAA,QACA,YAAA;AAAA,QACA;AAAA,O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C,SAAS,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACnF,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,WAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,GAAG;AAAA;AAAA,GACN;AAEJ","file":"sheet.js","sourcesContent":["'use client'\n\nimport { Dialog as SheetPrimitive } from '@base-ui/react/dialog'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { overlayScrim } from '../lib/overlay.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n return <SheetPrimitive.Root data-slot='sheet' {...props} />\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n return <SheetPrimitive.Close data-slot='sheet-close' {...props} />\n}\n\nfunction SheetPortal({ children, ...props }: SheetPrimitive.Portal.Props) {\n return (\n <SheetPrimitive.Portal data-slot='sheet-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </SheetPrimitive.Portal>\n )\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n return (\n <SheetPrimitive.Backdrop\n data-slot='sheet-overlay'\n className={cn(\n 'fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0',\n overlayScrim,\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * On open, keyboard and mouse users land on the close button, which is first\n * in the DOM, rather than on the first control in the content. With\n * `showCloseButton={false}` the sheet itself takes focus, so a long sheet\n * never opens scrolled to a footer action. Pass `initialFocus` to choose a\n * different target, such as a search field the sheet exists to fill in.\n *\n * With the close button shown, content in the button's corner reserves room\n * at the end edge so text cannot run under it: the SheetHeader, and also the\n * first visible child when that is not (and does not contain) the header —\n * with no header at all, or an intro placed before the header. Add\n * `data-sheet-bleed` to a padded element — a SheetHeader included — to opt\n * out, e.g. for a full-bleed banner or a wrapper whose rows should reach the\n * edge. \"Visible\" means not `sr-only` or `[hidden]`: a child hidden only\n * at some breakpoints (`hidden sm:block`, `sr-only sm:not-sr-only`) cannot be\n * told apart in CSS, so give that content its own end padding.\n */\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n closeLabel = 'Close',\n initialFocus,\n ref,\n ...props\n}: SheetPrimitive.Popup.Props & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n const popupRef = React.useRef<HTMLDivElement | null>(null)\n // Returns its own cleanup, so React 19 never calls this with null. That\n // cleanup must run the consumer's in turn: React keeps a callback ref's\n // return value as its teardown, and dropping it would skip that teardown.\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n popupRef.current = node\n if (typeof ref === 'function') {\n const cleanup = ref(node)\n return () => {\n popupRef.current = null\n if (typeof cleanup === 'function') cleanup()\n else ref(null)\n }\n }\n if (ref) ref.current = node\n return () => {\n popupRef.current = null\n if (ref) ref.current = null\n }\n },\n [ref],\n )\n\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Popup\n ref={mergedRef}\n // Without a close button there is no known-safe first control, and the\n // first tabbable may be a footer action below the fold. The popup\n // itself is the one target Base UI focuses with preventScroll.\n initialFocus={initialFocus ?? (showCloseButton ? undefined : popupRef)}\n data-slot='sheet-content'\n data-side={side}\n className={cn(\n 'fixed z-50 flex max-h-dvh flex-col overflow-y-auto bg-popover bg-clip-padding text-base/relaxed text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]',\n // These rules anchor on `data-sheet-corner-close`, the built-in button\n // only: a consumer's own SheetClose shares its `data-slot` but is not\n // in the corner, and must not switch the reserved room on.\n //\n // Keep a long title clear of the absolutely placed close button: it\n // spans 1rem-3.5rem from the end edge, so pe-16 clears it. The header\n // matches at any depth (a form often wraps it), as Dialog's does.\n '[&:has(>[data-sheet-corner-close])_[data-slot=sheet-header]:not([data-sheet-bleed])]:pe-16',\n // Whatever sits beside the close button reserves the same room, so its\n // text cannot run under it: the first VISIBLE child (an sr-only title\n // or a [hidden] element is skipped), checked on that element only,\n // not the whole sheet — an intro placed before a header is the\n // content in the button's corner. A child that is or wraps the header\n // (at any depth) is left to the rule above, so a header is never\n // padded twice. If that child wraps the whole sheet with no header,\n // all of it is padded; `data-sheet-bleed` on it opts out, as it does\n // for full-bleed media meant to run under the button.\n '[&:has(>[data-sheet-corner-close])>:nth-child(1_of_:not([data-sheet-corner-close],.sr-only,[hidden])):not(:has([data-slot=sheet-header])):not([data-sheet-bleed])]:pe-16',\n // One level into a first child that wraps the header (the usual\n // <form>): its own first visible child is the content in the corner,\n // e.g. an intro above the header, so it gets the same room.\n '[&:has(>[data-sheet-corner-close])>:nth-child(1_of_:not([data-sheet-corner-close],.sr-only,[hidden])):has([data-slot=sheet-header])>:nth-child(1_of_:not(.sr-only,[hidden])):not(:has([data-slot=sheet-header])):not([data-sheet-bleed])]:pe-16',\n className,\n )}\n {...props}\n >\n {/* The close button comes FIRST in the DOM (it is absolutely placed, so\n the visual order is unchanged). On a keyboard or mouse open, Base UI\n focuses the first tabbable element (on a touch open it focuses the\n popup, and DOM order does not matter); after the content, that is a\n footer button, and a long sheet opens scrolled to the bottom with\n the reader past everything above it. Being first also means it\n would paint UNDER any later positioned child in the corner (a\n Button is `relative`), so it carries z-20: above children up to\n and including the conventional sticky-header z-10. */}\n {showCloseButton && (\n <SheetPrimitive.Close\n data-slot='sheet-close'\n data-sheet-corner-close=''\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className='absolute end-4 top-4 z-20'\n />\n }\n >\n <IconClose />\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetPrimitive.Popup>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-header'\n className={cn('flex flex-col gap-1.5 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-footer'\n className={cn('mt-auto flex flex-col gap-2 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n return (\n <SheetPrimitive.Title\n data-slot='sheet-title'\n className={cn('text-lg font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {\n return (\n <SheetPrimitive.Description\n data-slot='sheet-description'\n className={cn('text-base/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;;;;AAWA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACtD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC3D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AAChE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AACtE;AAEA,SAAS,UAAA,CAAW,EAAE,GAAG,KAAA,EAAM,EAA+B;AAC5D,EAAA,2BAAQA,MAAA,CAAe,KAAA,EAAf,EAAqB,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAClE;AAEA,SAAS,WAAA,CAAY,EAAE,QAAA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,CAAA;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,2BAAA,EAA6B,SAAS,CAAA;AAAA,MACnD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iCAAA,EAAmC,SAAS,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACnF,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,WAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,GAAG;AAAA;AAAA,GACN;AAEJ","file":"sheet.js","sourcesContent":["'use client'\n\nimport { Dialog as SheetPrimitive } from '@base-ui/react/dialog'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { overlayScrim } from '../lib/overlay.js'\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n return <SheetPrimitive.Root data-slot='sheet' {...props} />\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n return <SheetPrimitive.Close data-slot='sheet-close' {...props} />\n}\n\nfunction SheetPortal({ children, ...props }: SheetPrimitive.Portal.Props) {\n return (\n <SheetPrimitive.Portal data-slot='sheet-portal' {...props}>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>{children}</PortalBoundary>\n </SheetPrimitive.Portal>\n )\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n return (\n <SheetPrimitive.Backdrop\n data-slot='sheet-overlay'\n className={cn(\n 'fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0',\n overlayScrim,\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * On open, keyboard and mouse users land on the close button, which is first\n * in the DOM, rather than on the first control in the content. With\n * `showCloseButton={false}` the sheet itself takes focus, so a long sheet\n * never opens scrolled to a footer action. Pass `initialFocus` to choose a\n * different target, such as a search field the sheet exists to fill in.\n *\n * With the close button shown, content in the button's corner reserves room\n * at the end edge so text cannot run under it: the SheetHeader, and also the\n * first visible child when that is not (and does not contain) the header —\n * with no header at all, or an intro placed before the header. Add\n * `data-sheet-bleed` to a padded element — a SheetHeader included — to opt\n * out, e.g. for a full-bleed banner or a wrapper whose rows should reach the\n * edge. \"Visible\" means not `sr-only` or `[hidden]`: a child hidden only\n * at some breakpoints (`hidden sm:block`, `sr-only sm:not-sr-only`) cannot be\n * told apart in CSS, so give that content its own end padding.\n */\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n closeLabel = 'Close',\n initialFocus,\n ref,\n ...props\n}: SheetPrimitive.Popup.Props & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n const popupRef = React.useRef<HTMLDivElement | null>(null)\n // Returns its own cleanup, so React 19 never calls this with null. That\n // cleanup must run the consumer's in turn: React keeps a callback ref's\n // return value as its teardown, and dropping it would skip that teardown.\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n popupRef.current = node\n if (typeof ref === 'function') {\n const cleanup = ref(node)\n return () => {\n popupRef.current = null\n if (typeof cleanup === 'function') cleanup()\n else ref(null)\n }\n }\n if (ref) ref.current = node\n return () => {\n popupRef.current = null\n if (ref) ref.current = null\n }\n },\n [ref],\n )\n\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Popup\n ref={mergedRef}\n // Without a close button there is no known-safe first control, and the\n // first tabbable may be a footer action below the fold. The popup\n // itself is the one target Base UI focuses with preventScroll.\n initialFocus={initialFocus ?? (showCloseButton ? undefined : popupRef)}\n data-slot='sheet-content'\n data-side={side}\n className={cn(\n 'fixed z-50 flex max-h-dvh flex-col overflow-y-auto bg-popover bg-clip-padding text-base/relaxed text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]',\n // These rules anchor on `data-sheet-corner-close`, the built-in button\n // only: a consumer's own SheetClose shares its `data-slot` but is not\n // in the corner, and must not switch the reserved room on.\n //\n // Keep a long title clear of the absolutely placed close button: it\n // spans 1rem-3.5rem from the end edge, so pe-16 clears it. The header\n // matches at any depth (a form often wraps it), as Dialog's does.\n '[&:has(>[data-sheet-corner-close])_[data-slot=sheet-header]:not([data-sheet-bleed])]:pe-16',\n // Whatever sits beside the close button reserves the same room, so its\n // text cannot run under it: the first VISIBLE child (an sr-only title\n // or a [hidden] element is skipped), checked on that element only,\n // not the whole sheet — an intro placed before a header is the\n // content in the button's corner. A child that is or wraps the header\n // (at any depth) is left to the rule above, so a header is never\n // padded twice. If that child wraps the whole sheet with no header,\n // all of it is padded; `data-sheet-bleed` on it opts out, as it does\n // for full-bleed media meant to run under the button.\n '[&:has(>[data-sheet-corner-close])>:nth-child(1_of_:not([data-sheet-corner-close],.sr-only,[hidden])):not(:has([data-slot=sheet-header])):not([data-sheet-bleed])]:pe-16',\n // One level into a first child that wraps the header (the usual\n // <form>): its own first visible child is the content in the corner,\n // e.g. an intro above the header, so it gets the same room.\n '[&:has(>[data-sheet-corner-close])>:nth-child(1_of_:not([data-sheet-corner-close],.sr-only,[hidden])):has([data-slot=sheet-header])>:nth-child(1_of_:not(.sr-only,[hidden])):not(:has([data-slot=sheet-header])):not([data-sheet-bleed])]:pe-16',\n className,\n )}\n {...props}\n >\n {/* The close button comes FIRST in the DOM (it is absolutely placed, so\n the visual order is unchanged). On a keyboard or mouse open, Base UI\n focuses the first tabbable element (on a touch open it focuses the\n popup, and DOM order does not matter); after the content, that is a\n footer button, and a long sheet opens scrolled to the bottom with\n the reader past everything above it. Being first also means it\n would paint UNDER any later positioned child in the corner (a\n Button is `relative`), so it carries z-20: above children up to\n and including the conventional sticky-header z-10. */}\n {showCloseButton && (\n <SheetPrimitive.Close\n data-slot='sheet-close'\n data-sheet-corner-close=''\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className='absolute end-4 top-4 z-20'\n />\n }\n >\n <IconClose />\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetPrimitive.Popup>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-header'\n className={cn('flex flex-col gap-1.5 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-footer'\n className={cn('mt-auto flex flex-col gap-2 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n return (\n <SheetPrimitive.Title\n data-slot='sheet-title'\n className={cn('text-lg font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {\n return (\n <SheetPrimitive.Description\n data-slot='sheet-description'\n className={cn('text-base/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"]}
@@ -4,7 +4,7 @@ import { Autocomplete } from '@base-ui/react/autocomplete';
4
4
  import { Dialog } from '@base-ui/react/dialog';
5
5
  import React from 'react';
6
6
  import { IconSearch } from '../icons/search.js';
7
- import { ButtonGroupBoundary } from '../lib/button-group-context.js';
7
+ import { PortalBoundary } from '../lib/portal-boundary.js';
8
8
  import { cn } from '../lib/utils.js';
9
9
  import { Button } from '../components/button.js';
10
10
 
@@ -87,7 +87,7 @@ function SiteSearch({
87
87
  );
88
88
  return /* @__PURE__ */ jsxs(Dialog.Root, { open, onOpenChange: (next) => requestOpenChange(next), children: [
89
89
  trigger === null ? null : /* @__PURE__ */ jsx(Dialog.Trigger, { "data-slot": "site-search-trigger", render: trigger ?? defaultTrigger }),
90
- /* @__PURE__ */ jsx(Dialog.Portal, { children: /* @__PURE__ */ jsxs(ButtonGroupBoundary, { children: [
90
+ /* @__PURE__ */ jsx(Dialog.Portal, { children: /* @__PURE__ */ jsxs(PortalBoundary, { children: [
91
91
  /* @__PURE__ */ jsx(
92
92
  Dialog.Backdrop,
93
93
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/site-search.tsx"],"names":[],"mappings":";;;;;;;;;AA6HA,SAAS,UAAA,CAAW;AAAA,EAClB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA,EAAM,QAAA;AAAA,EACN,YAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,QAAA,GAAW,IAAA;AAAA,EACX,KAAA,GAAQ,aAAA;AAAA,EACR,WAAA,GAAc,mCAAA;AAAA,EACd,YAAA,GAAe,mBAAA;AAAA,EACf,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAoB;AAClB,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAA,CAAM,SAAS,WAAW,CAAA;AAC1E,EAAA,MAAM,eAAe,QAAA,KAAa,MAAA;AAClC,EAAA,MAAM,IAAA,GAAO,eAAe,QAAA,GAAW,gBAAA;AAEvC,EAAA,MAAM,QAAA,GAAW,KAAA,CAAM,MAAA,CAAyB,IAAI,CAAA;AAOpD,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,MAAA,CAAO,IAAI,CAAA;AACjC,EAAA,M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SAAA,EAAU,4OAAA;AAAA,gCAET,QAAA,EAAA,IAAA,CAAK;AAAA,+BAAA;AAAA,8BARD,IAAA,CAAK;AAAA,6BASZ,EAEJ;AAAA;AAAA,yBAAA;AAAA,wBAxBK,KAAA,CAAM;AAAA;AAyBb;AAAA;AAEJ;AAAA;AAAA,aACF;AAAA,YAEC,YAAY,IAAA,mBACX,GAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,WAAA,EAAU,oBAAA;AAAA,gBACV,SAAA,EAAU,uEAAA;AAAA,gBAET;AAAA;AAAA,aACH,GACE;AAAA;AAAA;AAAA;AACN,KAAA,EACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"site-search.js","sourcesContent":["'use client'\n\nimport { Autocomplete } from '@base-ui/react/autocomplete'\nimport { Dialog } from '@base-ui/react/dialog'\nimport React from 'react'\n\nimport { IconSearch } from '../icons/search.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Button } from '../components/button.js'\n\n/** A single searchable destination. `keywords` extend matching beyond the title. */\ntype SiteSearchItem = {\n title: string\n href: string\n keywords?: string[]\n}\n\n/** A titled section of results, rendered with a muted group heading. */\ntype SiteSearchGroup = {\n title: string\n items: SiteSearchItem[]\n}\n\ntype SiteSearchProps = {\n /** The searchable site map, as titled groups of items. */\n groups: SiteSearchGroup[]\n /**\n * Called with the chosen item on click or Enter, after the palette closes.\n * Navigation is the APP's job — call your router here (e.g. next/navigation's\n * `router.push(item.href)`). The design system ships no framework code, so it\n * never navigates itself; this mirrors the DS-wide framework-free rule\n * (see `Link` / `LinkProvider`).\n */\n onSelect: (item: SiteSearchItem) => void\n /** Whether the palette is open. Use when controlled. */\n open?: boolean\n /** Called whenever the palette asks to open or close. */\n onOpenChange?: (open: boolean) => void\n /** Whether the palette is initially open (uncontrolled). */\n defaultOpen?: boolean\n /**\n * Wire the global Cmd/Ctrl-K toggle on `document`, with cleanup on unmount.\n * Defaults to true. Only one shortcut-enabled SiteSearch should be mounted\n * per page, or each press toggles all of them.\n */\n shortcut?: boolean\n /**\n * Accessible name for the palette, applied as `aria-label` to the dialog\n * panel, the search input and the default trigger. Defaults to\n * `'Search site'`. Mirrors ExpandableSearch's `label` prop — localise it\n * rather than hardcoding English into consumers' pages.\n */\n label?: string\n /** Placeholder for the search input. */\n placeholder?: string\n /** Message shown when no items match the query. */\n emptyMessage?: string\n /**\n * The element that opens the palette. Defaults to a ghost icon `Button`\n * named by `label`. Pass an element to replace it — it is composed via Base\n * UI's `render` prop, so it inherits the trigger behaviour and ARIA — or\n * `null` to render no trigger at all (open via `open` or the shortcut).\n * A custom trigger owns its own accessible name — `label` is applied as\n * `aria-label` to the default icon button only, since overriding a visible\n * label that way fails WCAG 2.2, 2.5.3 Label in Name.\n *\n * Conditional triggers must resolve to `null`, not `false`: write\n * `cond ? <Button/> : null`, since `cond && <Button/>` yields `false`, which\n * Base UI's `render` prop rejects with an invalid-element error. TypeScript\n * catches it (`false` is not assignable here); plain-JS consumers see the\n * error at render.\n */\n trigger?: React.ReactElement | null\n /**\n * Extra content rendered at the foot of the panel, below the results —\n * e.g. shortcut hints or a \"browse all\" link.\n */\n children?: React.ReactNode\n /** Extra classes for the centred panel. */\n className?: string\n}\n\n/**\n * Cmd/Ctrl-K command-palette site search: a centred modal panel with a\n * filter-as-you-type input over a grouped list of destinations.\n *\n * Ported from nswds-app's `MobileSearch`, rebuilt framework-free: the app\n * version composed cmdk's `Command*` widgets with next/navigation's router;\n * this version composes Base UI's Autocomplete (the combobox/listbox pattern)\n * inside Base UI's Dialog, and hands the chosen item to `onSelect` instead of\n * navigating. The Autocomplete renders in `inline` mode — its input and list\n * sit statically inside the dialog panel with no popup of their own — which is\n * Base UI's documented composition for palettes (it avoids any portal /\n * focus-trap interplay between the two primitives; the always-`open` inline\n * root unmounts with the dialog, so the query and highlight reset on close).\n *\n * Accessibility contract (inherited, not hand-rolled):\n * - Dialog provides the modal behaviour: focus trap, scroll lock, Escape and\n * backdrop-press dismissal, and focus restoration to the trigger on close.\n * The panel is named via `aria-label` (WCAG 2.2, 4.1.2).\n * - Autocomplete provides the combobox pattern: the input is announced as a\n * combobox controlling a listbox, arrow keys move `aria-activedescendant`\n * highlight while DOM focus stays in the input, Enter activates the\n * highlighted item, and the empty state is announced politely.\n * - The trigger (default or custom) renders through `Dialog.Trigger`, so it\n * carries `aria-haspopup=\"dialog\"` / `aria-expanded` automatically.\n * - Result rows are at least 44px tall (2.5.8 Target Size, AAA-sized).\n * - Panel and backdrop transitions honour `prefers-reduced-motion` (2.3.3).\n *\n * Departures from the nswds-app source, beyond the rebuild above:\n * - `groups`/`onSelect` replace the app's `NavigationItem[]` + router: the\n * data shape is explicit (`title`/`href`/`keywords`) instead of the app's\n * nav config, and untitled/unlinked entries can't exist by construction\n * (the source filtered them at render time).\n * - Filtering matches `title` AND `keywords`, case-insensitively, via the\n * Autocomplete `filter` prop. Base UI's `useFilter` helper only matches one\n * string per item, so a custom predicate is the documented escape hatch for\n * multi-field matching; groups with no matching items are dropped by the\n * primitive, headings included.\n * - The Cmd/Ctrl-K listener can be disabled (`shortcut={false}`) — required\n * for pages that mount more than one instance. It still toggles, per the\n * source.\n */\nfunction SiteSearch({\n groups,\n onSelect,\n open: openProp,\n onOpenChange,\n defaultOpen = false,\n shortcut = true,\n label = 'Search site',\n placeholder = 'Type to search across the site...',\n emptyMessage = 'No results found.',\n trigger,\n children,\n className,\n}: SiteSearchProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const isControlled = openProp !== undefined\n const open = isControlled ? openProp : uncontrolledOpen\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n // Latest-value refs so the document-level shortcut listener (bound once per\n // `shortcut` value) never acts on a stale open state or stale callbacks.\n // They are written in a passive effect (not during render, per\n // react-hooks/refs) — safe because they are only read from event listeners,\n // which always fire after the commit that synced them.\n const openRef = React.useRef(open)\n const requestOpenChangeRef = React.useRef<(next: boolean) => void>(() => {})\n\n const requestOpenChange = (next: boolean) => {\n if (isControlled) {\n // Dedupe against the render-authoritative prop only — never write\n // openRef optimistically here. An optimistic write would let a parent\n // that vetoes a request (ignores it, so no re-render runs the resync\n // effect) permanently swallow every later identical request. Accepted\n // trade-off: a same-tick duplicate close (Escape reaching both the\n // Autocomplete and the Dialog) may reach `onOpenChange` twice with the\n // same value — idempotent for a setState parent, and correctness in\n // the veto case beats dedupe cosmetics.\n if (open === next) {\n return\n }\n onOpenChange?.(next)\n return\n }\n // Uncontrolled, the component owns the state, so the optimistic write is\n // safe (the commit below confirms it) and dedupes the double-report case\n // (both primitives announcing the same close) down to one callback.\n if (openRef.current === next) {\n return\n }\n openRef.current = next\n setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n React.useEffect(() => {\n // `open` (not `next` from an event) is authoritative here: in controlled\n // mode this effect is the ref's ONLY writer, so the shortcut listener\n // always toggles from the last value the parent actually rendered.\n openRef.current = open\n requestOpenChangeRef.current = requestOpenChange\n })\n\n React.useEffect(() => {\n if (!shortcut) {\n return undefined\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === 'k' &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !event.defaultPrevented\n ) {\n event.preventDefault()\n // Toggle, per the nswds-app source: the same chord opens and closes.\n requestOpenChangeRef.current(!openRef.current)\n }\n }\n document.addEventListener('keydown', handleKeyDown)\n return () => document.removeEventListener('keydown', handleKeyDown)\n }, [shortcut])\n\n const handleSelect = (item: SiteSearchItem) => {\n // Close first, then hand over — mirrors the source's `runCommand`, so the\n // app's navigation starts from a closed palette.\n requestOpenChange(false)\n onSelect(item)\n }\n\n const filter = React.useCallback((item: SiteSearchItem, query: string) => {\n const q = query.trim().toLowerCase()\n if (q === '') {\n return true\n }\n if (item.title.toLowerCase().includes(q)) {\n return true\n }\n return (item.keywords ?? []).some((keyword) => keyword.toLowerCase().includes(q))\n }, [])\n\n const defaultTrigger = (\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={label}\n leadingVisual={IconSearch}\n />\n )\n\n return (\n <Dialog.Root open={open} onOpenChange={(next) => requestOpenChange(next)}>\n {trigger === null ? null : (\n <Dialog.Trigger data-slot='site-search-trigger' render={trigger ?? defaultTrigger} />\n )}\n\n <Dialog.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <Dialog.Backdrop\n data-slot='site-search-overlay'\n className='fixed inset-0 z-50 bg-black/80 duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-safe:transition-opacity'\n />\n <Dialog.Popup\n data-slot='site-search-panel'\n aria-label={label}\n // The default focus target on touch is the panel itself (to keep the\n // virtual keyboard closed) — wrong for a search palette, whose whole\n // purpose is typing. Always focus the input.\n initialFocus={inputRef}\n className={cn(\n // Centred panel on the house popup surface (popover.tsx / sheet.tsx).\n 'fixed top-[max(--spacing(4),15vh)] left-1/2 z-50 w-[calc(100vw-2rem)] max-w-2xl -translate-x-1/2',\n 'rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden',\n 'duration-150 ease-out motion-safe:transition',\n 'data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0',\n className,\n )}\n >\n <Autocomplete.Root\n items={groups}\n filter={filter}\n itemToStringValue={(item: SiteSearchItem) => item.title}\n autoHighlight\n // Inline mode: the list renders statically inside the dialog panel\n // (no Autocomplete portal/positioner), with `open` pinned per the\n // Base UI docs. Opening/closing belongs to the Dialog; the whole\n // Autocomplete unmounts with it, resetting query and highlight.\n inline\n open\n onOpenChange={(nextOpen, eventDetails) => {\n // The pinned-open inline Autocomplete still *requests* closes;\n // forward the ones that should dismiss the palette. Other\n // reasons (input-clear, focus-out) must not close the dialog —\n // clearing the query or tabbing within the trap isn't dismissal.\n if (\n !nextOpen &&\n (eventDetails.reason === 'escape-key' || eventDetails.reason === 'item-press')\n ) {\n requestOpenChange(false)\n }\n }}\n >\n <div\n data-slot='site-search-input-row'\n className='flex items-center gap-3 border-b border-foreground/10 px-4'\n >\n <IconSearch aria-hidden='true' className='size-5 shrink-0 text-muted-foreground' />\n <Autocomplete.Input\n data-slot='site-search-input'\n aria-label={label}\n placeholder={placeholder}\n className='h-12 w-full bg-transparent text-base text-foreground outline-hidden placeholder:text-muted-foreground'\n ref={inputRef}\n />\n </div>\n\n {/* Base UI renders Empty's children only while the list is empty;\n the padding lives on the inner div so the (always-mounted, for\n polite announcements) outer element paints nothing otherwise. */}\n <Autocomplete.Empty data-slot='site-search-empty'>\n <div className='px-4 py-6 text-center text-sm text-muted-foreground'>\n {emptyMessage}\n </div>\n </Autocomplete.Empty>\n\n <Autocomplete.List\n data-slot='site-search-list'\n className='max-h-[min(--spacing(96),60vh)] overflow-y-auto overscroll-contain p-2 empty:hidden'\n >\n {(group: SiteSearchGroup) => (\n <Autocomplete.Group\n key={group.title}\n items={group.items}\n data-slot='site-search-group'\n >\n <Autocomplete.GroupLabel\n data-slot='site-search-group-label'\n className='px-3 pt-3 pb-1 text-xs font-semibold text-muted-foreground'\n >\n {group.title}\n </Autocomplete.GroupLabel>\n <Autocomplete.Collection>\n {(item: SiteSearchItem) => (\n <Autocomplete.Item\n key={item.href}\n value={item}\n data-slot='site-search-item'\n onClick={() => handleSelect(item)}\n // Highlight treatment mirrors menubar.tsx: keyboard and\n // hover unify as data-highlighted, painted as 10% ink.\n className='flex min-h-11 cursor-default items-center gap-2 rounded-sm px-3 py-2 text-sm text-foreground outline-hidden select-none data-highlighted:bg-primary-800/10 data-highlighted:text-accent-foreground dark:data-highlighted:bg-primary-200/10'\n >\n {item.title}\n </Autocomplete.Item>\n )}\n </Autocomplete.Collection>\n </Autocomplete.Group>\n )}\n </Autocomplete.List>\n </Autocomplete.Root>\n\n {children != null ? (\n <div\n data-slot='site-search-footer'\n className='border-t border-foreground/10 px-4 py-2 text-xs text-muted-foreground'\n >\n {children}\n </div>\n ) : null}\n </Dialog.Popup>\n </ButtonGroupBoundary>\n </Dialog.Portal>\n </Dialog.Root>\n )\n}\n\nexport { SiteSearch }\nexport type { SiteSearchGroup, SiteSearchItem, SiteSearchProps }\n"]}
1
+ {"version":3,"sources":["../../src/components/site-search.tsx"],"names":[],"mappings":";;;;;;;;;AA6HA,SAAS,UAAA,CAAW;AAAA,EAClB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA,EAAM,QAAA;AAAA,EACN,YAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,QAAA,GAAW,IAAA;AAAA,EACX,KAAA,GAAQ,aAAA;AAAA,EACR,WAAA,GAAc,mCAAA;AAAA,EACd,YAAA,GAAe,mBAAA;AAAA,EACf,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAoB;AAClB,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAA,CAAM,SAAS,WAAW,CAAA;AAC1E,EAAA,MAAM,eAAe,QAAA,KAAa,MAAA;AAClC,EAAA,MAAM,IAAA,GAAO,eAAe,QAAA,GAAW,gBAAA;AAEvC,EAAA,MAAM,QAAA,GAAW,KAAA,CAAM,MAAA,CAAyB,IAAI,CAAA;AAOpD,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,MAAA,CAAO,IAAI,CAAA;AACjC,EAAA,MAAM,oBAAA,GAAuB,KAAA,CAAM,MAAA,CAAgC,MAAM;AAAA,EAAC,CAAC,CAAA;AAE3E,EAAA,MAAM,iBAAA,GAAoB,CAAC,IAAA,KAAkB;AAC3C,IAAA,IAAI,YAAA,EAAc;AAShB,MAAA,IAAI,SAAS,IAAA,EAAM;AACjB,QAAA;AAAA,MACF;AACA,MAAA,YAAA,GAAe,IAAI,CAAA;AACnB,MAAA;AAAA,IACF;AAIA,IAAA,IAAI,OAAA,CAAQ,YAAY,IAAA,EAAM;AAC5B,MAAA;AAAA,IACF;AACA,IAAA,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ACE;AAAA;AAAA;AAAA;AACN,KAAA,EACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"site-search.js","sourcesContent":["'use client'\n\nimport { Autocomplete } from '@base-ui/react/autocomplete'\nimport { Dialog } from '@base-ui/react/dialog'\nimport React from 'react'\n\nimport { IconSearch } from '../icons/search.js'\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Button } from '../components/button.js'\n\n/** A single searchable destination. `keywords` extend matching beyond the title. */\ntype SiteSearchItem = {\n title: string\n href: string\n keywords?: string[]\n}\n\n/** A titled section of results, rendered with a muted group heading. */\ntype SiteSearchGroup = {\n title: string\n items: SiteSearchItem[]\n}\n\ntype SiteSearchProps = {\n /** The searchable site map, as titled groups of items. */\n groups: SiteSearchGroup[]\n /**\n * Called with the chosen item on click or Enter, after the palette closes.\n * Navigation is the APP's job — call your router here (e.g. next/navigation's\n * `router.push(item.href)`). The design system ships no framework code, so it\n * never navigates itself; this mirrors the DS-wide framework-free rule\n * (see `Link` / `LinkProvider`).\n */\n onSelect: (item: SiteSearchItem) => void\n /** Whether the palette is open. Use when controlled. */\n open?: boolean\n /** Called whenever the palette asks to open or close. */\n onOpenChange?: (open: boolean) => void\n /** Whether the palette is initially open (uncontrolled). */\n defaultOpen?: boolean\n /**\n * Wire the global Cmd/Ctrl-K toggle on `document`, with cleanup on unmount.\n * Defaults to true. Only one shortcut-enabled SiteSearch should be mounted\n * per page, or each press toggles all of them.\n */\n shortcut?: boolean\n /**\n * Accessible name for the palette, applied as `aria-label` to the dialog\n * panel, the search input and the default trigger. Defaults to\n * `'Search site'`. Mirrors ExpandableSearch's `label` prop — localise it\n * rather than hardcoding English into consumers' pages.\n */\n label?: string\n /** Placeholder for the search input. */\n placeholder?: string\n /** Message shown when no items match the query. */\n emptyMessage?: string\n /**\n * The element that opens the palette. Defaults to a ghost icon `Button`\n * named by `label`. Pass an element to replace it — it is composed via Base\n * UI's `render` prop, so it inherits the trigger behaviour and ARIA — or\n * `null` to render no trigger at all (open via `open` or the shortcut).\n * A custom trigger owns its own accessible name — `label` is applied as\n * `aria-label` to the default icon button only, since overriding a visible\n * label that way fails WCAG 2.2, 2.5.3 Label in Name.\n *\n * Conditional triggers must resolve to `null`, not `false`: write\n * `cond ? <Button/> : null`, since `cond && <Button/>` yields `false`, which\n * Base UI's `render` prop rejects with an invalid-element error. TypeScript\n * catches it (`false` is not assignable here); plain-JS consumers see the\n * error at render.\n */\n trigger?: React.ReactElement | null\n /**\n * Extra content rendered at the foot of the panel, below the results —\n * e.g. shortcut hints or a \"browse all\" link.\n */\n children?: React.ReactNode\n /** Extra classes for the centred panel. */\n className?: string\n}\n\n/**\n * Cmd/Ctrl-K command-palette site search: a centred modal panel with a\n * filter-as-you-type input over a grouped list of destinations.\n *\n * Ported from nswds-app's `MobileSearch`, rebuilt framework-free: the app\n * version composed cmdk's `Command*` widgets with next/navigation's router;\n * this version composes Base UI's Autocomplete (the combobox/listbox pattern)\n * inside Base UI's Dialog, and hands the chosen item to `onSelect` instead of\n * navigating. The Autocomplete renders in `inline` mode — its input and list\n * sit statically inside the dialog panel with no popup of their own — which is\n * Base UI's documented composition for palettes (it avoids any portal /\n * focus-trap interplay between the two primitives; the always-`open` inline\n * root unmounts with the dialog, so the query and highlight reset on close).\n *\n * Accessibility contract (inherited, not hand-rolled):\n * - Dialog provides the modal behaviour: focus trap, scroll lock, Escape and\n * backdrop-press dismissal, and focus restoration to the trigger on close.\n * The panel is named via `aria-label` (WCAG 2.2, 4.1.2).\n * - Autocomplete provides the combobox pattern: the input is announced as a\n * combobox controlling a listbox, arrow keys move `aria-activedescendant`\n * highlight while DOM focus stays in the input, Enter activates the\n * highlighted item, and the empty state is announced politely.\n * - The trigger (default or custom) renders through `Dialog.Trigger`, so it\n * carries `aria-haspopup=\"dialog\"` / `aria-expanded` automatically.\n * - Result rows are at least 44px tall (2.5.8 Target Size, AAA-sized).\n * - Panel and backdrop transitions honour `prefers-reduced-motion` (2.3.3).\n *\n * Departures from the nswds-app source, beyond the rebuild above:\n * - `groups`/`onSelect` replace the app's `NavigationItem[]` + router: the\n * data shape is explicit (`title`/`href`/`keywords`) instead of the app's\n * nav config, and untitled/unlinked entries can't exist by construction\n * (the source filtered them at render time).\n * - Filtering matches `title` AND `keywords`, case-insensitively, via the\n * Autocomplete `filter` prop. Base UI's `useFilter` helper only matches one\n * string per item, so a custom predicate is the documented escape hatch for\n * multi-field matching; groups with no matching items are dropped by the\n * primitive, headings included.\n * - The Cmd/Ctrl-K listener can be disabled (`shortcut={false}`) — required\n * for pages that mount more than one instance. It still toggles, per the\n * source.\n */\nfunction SiteSearch({\n groups,\n onSelect,\n open: openProp,\n onOpenChange,\n defaultOpen = false,\n shortcut = true,\n label = 'Search site',\n placeholder = 'Type to search across the site...',\n emptyMessage = 'No results found.',\n trigger,\n children,\n className,\n}: SiteSearchProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const isControlled = openProp !== undefined\n const open = isControlled ? openProp : uncontrolledOpen\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n // Latest-value refs so the document-level shortcut listener (bound once per\n // `shortcut` value) never acts on a stale open state or stale callbacks.\n // They are written in a passive effect (not during render, per\n // react-hooks/refs) — safe because they are only read from event listeners,\n // which always fire after the commit that synced them.\n const openRef = React.useRef(open)\n const requestOpenChangeRef = React.useRef<(next: boolean) => void>(() => {})\n\n const requestOpenChange = (next: boolean) => {\n if (isControlled) {\n // Dedupe against the render-authoritative prop only — never write\n // openRef optimistically here. An optimistic write would let a parent\n // that vetoes a request (ignores it, so no re-render runs the resync\n // effect) permanently swallow every later identical request. Accepted\n // trade-off: a same-tick duplicate close (Escape reaching both the\n // Autocomplete and the Dialog) may reach `onOpenChange` twice with the\n // same value — idempotent for a setState parent, and correctness in\n // the veto case beats dedupe cosmetics.\n if (open === next) {\n return\n }\n onOpenChange?.(next)\n return\n }\n // Uncontrolled, the component owns the state, so the optimistic write is\n // safe (the commit below confirms it) and dedupes the double-report case\n // (both primitives announcing the same close) down to one callback.\n if (openRef.current === next) {\n return\n }\n openRef.current = next\n setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n React.useEffect(() => {\n // `open` (not `next` from an event) is authoritative here: in controlled\n // mode this effect is the ref's ONLY writer, so the shortcut listener\n // always toggles from the last value the parent actually rendered.\n openRef.current = open\n requestOpenChangeRef.current = requestOpenChange\n })\n\n React.useEffect(() => {\n if (!shortcut) {\n return undefined\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === 'k' &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !event.defaultPrevented\n ) {\n event.preventDefault()\n // Toggle, per the nswds-app source: the same chord opens and closes.\n requestOpenChangeRef.current(!openRef.current)\n }\n }\n document.addEventListener('keydown', handleKeyDown)\n return () => document.removeEventListener('keydown', handleKeyDown)\n }, [shortcut])\n\n const handleSelect = (item: SiteSearchItem) => {\n // Close first, then hand over — mirrors the source's `runCommand`, so the\n // app's navigation starts from a closed palette.\n requestOpenChange(false)\n onSelect(item)\n }\n\n const filter = React.useCallback((item: SiteSearchItem, query: string) => {\n const q = query.trim().toLowerCase()\n if (q === '') {\n return true\n }\n if (item.title.toLowerCase().includes(q)) {\n return true\n }\n return (item.keywords ?? []).some((keyword) => keyword.toLowerCase().includes(q))\n }, [])\n\n const defaultTrigger = (\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={label}\n leadingVisual={IconSearch}\n />\n )\n\n return (\n <Dialog.Root open={open} onOpenChange={(next) => requestOpenChange(next)}>\n {trigger === null ? null : (\n <Dialog.Trigger data-slot='site-search-trigger' render={trigger ?? defaultTrigger} />\n )}\n\n <Dialog.Portal>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>\n <Dialog.Backdrop\n data-slot='site-search-overlay'\n className='fixed inset-0 z-50 bg-black/80 duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-safe:transition-opacity'\n />\n <Dialog.Popup\n data-slot='site-search-panel'\n aria-label={label}\n // The default focus target on touch is the panel itself (to keep the\n // virtual keyboard closed) — wrong for a search palette, whose whole\n // purpose is typing. Always focus the input.\n initialFocus={inputRef}\n className={cn(\n // Centred panel on the house popup surface (popover.tsx / sheet.tsx).\n 'fixed top-[max(--spacing(4),15vh)] left-1/2 z-50 w-[calc(100vw-2rem)] max-w-2xl -translate-x-1/2',\n 'rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden',\n 'duration-150 ease-out motion-safe:transition',\n 'data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0',\n className,\n )}\n >\n <Autocomplete.Root\n items={groups}\n filter={filter}\n itemToStringValue={(item: SiteSearchItem) => item.title}\n autoHighlight\n // Inline mode: the list renders statically inside the dialog panel\n // (no Autocomplete portal/positioner), with `open` pinned per the\n // Base UI docs. Opening/closing belongs to the Dialog; the whole\n // Autocomplete unmounts with it, resetting query and highlight.\n inline\n open\n onOpenChange={(nextOpen, eventDetails) => {\n // The pinned-open inline Autocomplete still *requests* closes;\n // forward the ones that should dismiss the palette. Other\n // reasons (input-clear, focus-out) must not close the dialog —\n // clearing the query or tabbing within the trap isn't dismissal.\n if (\n !nextOpen &&\n (eventDetails.reason === 'escape-key' || eventDetails.reason === 'item-press')\n ) {\n requestOpenChange(false)\n }\n }}\n >\n <div\n data-slot='site-search-input-row'\n className='flex items-center gap-3 border-b border-foreground/10 px-4'\n >\n <IconSearch aria-hidden='true' className='size-5 shrink-0 text-muted-foreground' />\n <Autocomplete.Input\n data-slot='site-search-input'\n aria-label={label}\n placeholder={placeholder}\n className='h-12 w-full bg-transparent text-base text-foreground outline-hidden placeholder:text-muted-foreground'\n ref={inputRef}\n />\n </div>\n\n {/* Base UI renders Empty's children only while the list is empty;\n the padding lives on the inner div so the (always-mounted, for\n polite announcements) outer element paints nothing otherwise. */}\n <Autocomplete.Empty data-slot='site-search-empty'>\n <div className='px-4 py-6 text-center text-sm text-muted-foreground'>\n {emptyMessage}\n </div>\n </Autocomplete.Empty>\n\n <Autocomplete.List\n data-slot='site-search-list'\n className='max-h-[min(--spacing(96),60vh)] overflow-y-auto overscroll-contain p-2 empty:hidden'\n >\n {(group: SiteSearchGroup) => (\n <Autocomplete.Group\n key={group.title}\n items={group.items}\n data-slot='site-search-group'\n >\n <Autocomplete.GroupLabel\n data-slot='site-search-group-label'\n className='px-3 pt-3 pb-1 text-xs font-semibold text-muted-foreground'\n >\n {group.title}\n </Autocomplete.GroupLabel>\n <Autocomplete.Collection>\n {(item: SiteSearchItem) => (\n <Autocomplete.Item\n key={item.href}\n value={item}\n data-slot='site-search-item'\n onClick={() => handleSelect(item)}\n // Highlight treatment mirrors menubar.tsx: keyboard and\n // hover unify as data-highlighted, painted as 10% ink.\n className='flex min-h-11 cursor-default items-center gap-2 rounded-sm px-3 py-2 text-sm text-foreground outline-hidden select-none data-highlighted:bg-primary-800/10 data-highlighted:text-accent-foreground dark:data-highlighted:bg-primary-200/10'\n >\n {item.title}\n </Autocomplete.Item>\n )}\n </Autocomplete.Collection>\n </Autocomplete.Group>\n )}\n </Autocomplete.List>\n </Autocomplete.Root>\n\n {children != null ? (\n <div\n data-slot='site-search-footer'\n className='border-t border-foreground/10 px-4 py-2 text-xs text-muted-foreground'\n >\n {children}\n </div>\n ) : null}\n </Dialog.Popup>\n </PortalBoundary>\n </Dialog.Portal>\n </Dialog.Root>\n )\n}\n\nexport { SiteSearch }\nexport type { SiteSearchGroup, SiteSearchItem, SiteSearchProps }\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
4
- import { ButtonGroupBoundary } from '../lib/button-group-context.js';
4
+ import { PortalBoundary } from '../lib/portal-boundary.js';
5
5
  import { cn } from '../lib/utils.js';
6
6
 
7
7
  function TooltipProvider({ delay = 0, ...props }) {
@@ -22,7 +22,7 @@ function TooltipContent({
22
22
  children,
23
23
  ...props
24
24
  }) {
25
- return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children: /* @__PURE__ */ jsx(
25
+ return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(PortalBoundary, { children: /* @__PURE__ */ jsx(
26
26
  Tooltip$1.Positioner,
27
27
  {
28
28
  align,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/tooltip.tsx"],"names":["TooltipPrimitive"],"mappings":";;;;;AAOA,SAAS,gBAAgB,EAAE,KAAA,GAAQ,CAAA,EAAG,GAAG,OAAM,EAAoC;AACjF,EAAA,uBAAO,GAAA,CAACA,UAAiB,QAAA,EAAjB,EAA0B,aAAU,kBAAA,EAAmB,KAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAC1F;AAEA,SAAS,OAAA,CAAQ,EAAE,GAAG,KAAA,EAAM,EAAgC;AAC1D,EAAA,2BAAQA,SAAA,CAAiB,IAAA,EAAjB,EAAsB,WAAA,EAAU,SAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAC/D;AAEA,SAAS,cAAA,CAAe,EAAE,GAAG,KAAA,EAAM,EAAmC;AACpE,EAAA,2BAAQA,SAAA,CAAiB,OAAA,EAAjB,EAAyB,WAAA,EAAU,iBAAA,EAAmB,GAAG,KAAA,EAAO,CAAA;AAC1E;AAEA,SAAS,cAAA,CAAe;AAAA,EACtB,SAAA;AAAA,EACA,IAAA,GAAO,KAAA;AAAA,EACP,UAAA,GAAa,CAAA;AAAA,EACb,KAAA,GAAQ,QAAA;AAAA,EACR,WAAA,GAAc,CAAA;AAAA,EACd,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAC4F;AAC1F,EAAA,uBACE,GAAA,CAACA,SAAA,CAAiB,MAAA,EAAjB,EAEC,8BAAC,mBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,IAACA,SAAA,CAAiB,UAAA;AAAA,IAAjB;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA,EAAU,cAAA;AAAA,MAEV,QAAA,kBAAA,IAAA;AAAA,QAACA,SAAA,CAAiB,KAAA;AAAA,QAAjB;AAAA,UACC,WAAA,EAAU,iBAAA;AAAA,UACV,SAAA,EAAW,EAAA;AAAA,YACT,gwBAAA;AAAA,YACA;AAAA,WACF;AAAA,UACC,GAAG,KAAA;AAAA,UAEH,QAAA,EAAA;AAAA,YAAA,QAAA;AAAA,4BACD,GAAA,CAACA,SAAA,CAAiB,KAAA,EAAjB,EAAuB,WAAU,yhBAAA,EAA0hB;AAAA;AAAA;AAAA;AAC9jB;AAAA,KAEJ,CAAA,EACF,CAAA;AAEJ","file":"tooltip.js","sourcesContent":["'use client'\n\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip'\n\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nfunction TooltipProvider({ delay = 0, ...props }: TooltipPrimitive.Provider.Props) {\n return <TooltipPrimitive.Provider data-slot='tooltip-provider' delay={delay} {...props} />\n}\n\nfunction Tooltip({ ...props }: TooltipPrimitive.Root.Props) {\n return <TooltipPrimitive.Root data-slot='tooltip' {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot='tooltip-trigger' {...props} />\n}\n\nfunction TooltipContent({\n className,\n side = 'top',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {\n return (\n <TooltipPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className='isolate z-50'\n >\n <TooltipPrimitive.Popup\n data-slot='tooltip-content'\n className={cn(\n 'z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-sm bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className='z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:-start-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:-end-1 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5' />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </ButtonGroupBoundary>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"]}
1
+ {"version":3,"sources":["../../src/components/tooltip.tsx"],"names":["TooltipPrimitive"],"mappings":";;;;;AAOA,SAAS,gBAA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A,SAAA,CAAiB,KAAA,EAAjB,EAAuB,WAAU,yhBAAA,EAA0hB;AAAA;AAAA;AAAA;AAC9jB;AAAA,KAEJ,CAAA,EACF,CAAA;AAEJ","file":"tooltip.js","sourcesContent":["'use client'\n\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip'\n\nimport { PortalBoundary } from '../lib/portal-boundary.js'\nimport { cn } from '../lib/utils.js'\n\nfunction TooltipProvider({ delay = 0, ...props }: TooltipPrimitive.Provider.Props) {\n return <TooltipPrimitive.Provider data-slot='tooltip-provider' delay={delay} {...props} />\n}\n\nfunction Tooltip({ ...props }: TooltipPrimitive.Root.Props) {\n return <TooltipPrimitive.Root data-slot='tooltip' {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot='tooltip-trigger' {...props} />\n}\n\nfunction TooltipContent({\n className,\n side = 'top',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {\n return (\n <TooltipPrimitive.Portal>\n {/* Resets a ButtonGroup's context and applies any portal scope — see PortalBoundary. */}\n <PortalBoundary>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className='isolate z-50'\n >\n <TooltipPrimitive.Popup\n data-slot='tooltip-content'\n className={cn(\n 'z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-sm bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className='z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:-start-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:-end-1 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5' />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </PortalBoundary>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"]}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export { Checkbox } from './components/checkbox.js';
13
13
  export { CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockContentProps, CodeBlockCopyButton, CodeBlockCopyButtonProps, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockLineProps, CodeBlockProps, CodeBlockTitle, codeBlockLineVariants, codeBlockVariants } from './components/code-block.js';
14
14
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './components/collapsible.js';
15
15
  export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor } from './components/combobox.js';
16
+ export { ComponentPreview, ComponentPreviewCode, ComponentPreviewCodeProps, ComponentPreviewColorPicker, ComponentPreviewColorPickerProps, ComponentPreviewColorSet, ComponentPreviewControls, ComponentPreviewDirection, ComponentPreviewDirectionToggle, ComponentPreviewDirectionToggleProps, ComponentPreviewFile, ComponentPreviewHeader, ComponentPreviewProps, ComponentPreviewStage, ComponentPreviewStageProps, ComponentPreviewTheme, ComponentPreviewThemeToggle, ComponentPreviewThemeToggleProps, ComponentPreviewTitle, ComponentPreviewWidthToggle, ComponentPreviewWidthToggleProps } from './components/component-preview.js';
16
17
  export { Container, ContainerProps, containerVariants } from './components/container.js';
17
18
  export { DescriptionDetails, DescriptionDetailsProps, DescriptionList, DescriptionListProps, DescriptionTerm, DescriptionTermProps, descriptionListVariants } from './components/description-list.js';
18
19
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogVariant, dialogContentVariants } from './components/dialog.js';
@@ -70,8 +71,10 @@ export { ToggleGroup, ToggleGroupItem } from './components/toggle-group.js';
70
71
  export { Toggle, toggleVariants } from './components/toggle.js';
71
72
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './components/tooltip.js';
72
73
  export { UseChromeHeightOptions, UseChromeHeightResult, useChromeHeight } from './hooks/use-chrome-height.js';
74
+ export { PortalBoundary, PortalScope, PortalScopeContext } from './lib/portal-boundary.js';
73
75
  export { cn } from './lib/utils.js';
74
76
  export { ButtonGroupBoundary } from './lib/button-group-context.js';
77
+ export { PreviewPalette as ComponentPreviewPalette } from './lib/preview-theme.js';
75
78
  import 'react';
76
79
  import '@base-ui/react/accordion';
77
80
  import 'class-variance-authority/types';
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './components/checkbox.js';
13
13
  export * from './components/code-block.js';
14
14
  export * from './components/collapsible.js';
15
15
  export * from './components/combobox.js';
16
+ export * from './components/component-preview.js';
16
17
  export * from './components/container.js';
17
18
  export * from './components/description-list.js';
18
19
  export * from './components/dialog.js';
@@ -70,6 +71,7 @@ export * from './components/toggle-group.js';
70
71
  export * from './components/toggle.js';
71
72
  export * from './components/tooltip.js';
72
73
  export * from './hooks/use-chrome-height.js';
74
+ export * from './lib/portal-boundary.js';
73
75
  export * from './lib/utils.js';
74
76
  //# sourceMappingURL=index.js.map
75
77
  //# sourceMappingURL=index.js.map