@42-central/ui-react 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
- package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
- package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
- package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
- package/dist/{chunk-QZ4N5LYG.js → chunk-5H5YOPCF.js} +3 -3
- package/dist/{chunk-QZ4N5LYG.js.map → chunk-5H5YOPCF.js.map} +1 -1
- package/dist/{chunk-6II2DVYR.js → chunk-7KFUFAVP.js} +4 -4
- package/dist/{chunk-6II2DVYR.js.map → chunk-7KFUFAVP.js.map} +1 -1
- package/dist/{chunk-XUFCI262.js → chunk-7OGZT7U2.js} +12 -4
- package/dist/chunk-7OGZT7U2.js.map +1 -0
- package/dist/{chunk-PI7X5YFJ.js → chunk-BGDVUC3B.js} +5 -5
- package/dist/{chunk-PI7X5YFJ.js.map → chunk-BGDVUC3B.js.map} +1 -1
- package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
- package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
- package/dist/{chunk-FZSLSUSX.js → chunk-HCHGERDB.js} +3 -3
- package/dist/{chunk-FZSLSUSX.js.map → chunk-HCHGERDB.js.map} +1 -1
- package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
- package/dist/chunk-HWBFRDX7.js.map +1 -0
- package/dist/{chunk-HQPU73WV.js → chunk-I4IJOLNA.js} +4 -4
- package/dist/{chunk-HQPU73WV.js.map → chunk-I4IJOLNA.js.map} +1 -1
- package/dist/{chunk-UDCCOUWR.js → chunk-IA6DCC3N.js} +6 -6
- package/dist/{chunk-UDCCOUWR.js.map → chunk-IA6DCC3N.js.map} +1 -1
- package/dist/{chunk-36NWC4GV.js → chunk-ISX3AM32.js} +3 -3
- package/dist/{chunk-36NWC4GV.js.map → chunk-ISX3AM32.js.map} +1 -1
- package/dist/{chunk-LMCUGYHT.js → chunk-L24N5EON.js} +6 -6
- package/dist/chunk-L24N5EON.js.map +1 -0
- package/dist/{chunk-HRNWWL3Y.js → chunk-L5GH7LLD.js} +61 -29
- package/dist/chunk-L5GH7LLD.js.map +1 -0
- package/dist/chunk-LJVIZNPE.js +9 -0
- package/dist/chunk-LJVIZNPE.js.map +1 -0
- package/dist/{chunk-AHKMN3YQ.js → chunk-MCRTAUSZ.js} +6 -6
- package/dist/chunk-MCRTAUSZ.js.map +1 -0
- package/dist/{chunk-LHUWOA2U.js → chunk-MNYY7UU2.js} +6 -6
- package/dist/{chunk-LHUWOA2U.js.map → chunk-MNYY7UU2.js.map} +1 -1
- package/dist/{chunk-7HZBD4YZ.js → chunk-NF2PBGD3.js} +36 -23
- package/dist/chunk-NF2PBGD3.js.map +1 -0
- package/dist/{chunk-54W6VAI3.js → chunk-NNPSBC7O.js} +5 -5
- package/dist/{chunk-54W6VAI3.js.map → chunk-NNPSBC7O.js.map} +1 -1
- package/dist/{chunk-MW42XVPD.js → chunk-PBSVX5DB.js} +15 -5
- package/dist/chunk-PBSVX5DB.js.map +1 -0
- package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
- package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
- package/dist/{chunk-6UIQJJNJ.js → chunk-QRNQQIQM.js} +5 -5
- package/dist/{chunk-6UIQJJNJ.js.map → chunk-QRNQQIQM.js.map} +1 -1
- package/dist/{chunk-N66NC6QK.js → chunk-RKCUXOU2.js} +4 -4
- package/dist/{chunk-N66NC6QK.js.map → chunk-RKCUXOU2.js.map} +1 -1
- package/dist/{chunk-N5M4PDBK.js → chunk-SBZJGFZ6.js} +3 -3
- package/dist/{chunk-N5M4PDBK.js.map → chunk-SBZJGFZ6.js.map} +1 -1
- package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
- package/dist/chunk-SLUOF7XW.js.map +1 -0
- package/dist/{chunk-SAXWCGWR.js → chunk-SOUDKESO.js} +14 -7
- package/dist/chunk-SOUDKESO.js.map +1 -0
- package/dist/{chunk-T44RW5DW.js → chunk-ULF5LOBS.js} +4 -4
- package/dist/{chunk-T44RW5DW.js.map → chunk-ULF5LOBS.js.map} +1 -1
- package/dist/components/ambient-background/index.js +9 -23
- package/dist/components/ambient-background/index.js.map +1 -1
- package/dist/components/ambient-background/starfield.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +55 -10
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.d.ts +1 -1
- package/dist/components/app-shell/index.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +299 -38
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +4 -4
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/index.js +10 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/button-group/button-group.d.ts +10 -2
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/button-multi-select/index.js +2 -2
- package/dist/components/button-select/button-select-control.d.ts +4 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +4 -1
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +2 -2
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +6 -6
- package/dist/components/code-block/chrome.js +5 -5
- package/dist/components/code-block/index.js +6 -6
- package/dist/components/combobox/index.js +4 -4
- package/dist/components/combobox-list/index.js +6 -6
- package/dist/components/data-table/data-table-features.d.ts +8 -0
- package/dist/components/data-table/data-table-features.d.ts.map +1 -1
- package/dist/components/data-table/data-table-group.d.ts +128 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -0
- package/dist/components/data-table/data-table-grouping.d.ts +72 -0
- package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
- package/dist/components/data-table/data-table-icons.d.ts +4 -2
- package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
- package/dist/components/data-table/data-table-meta.d.ts +9 -0
- package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
- package/dist/components/data-table/data-table-pagination.d.ts +4 -1
- package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
- package/dist/components/data-table/data-table-schema.d.ts +4 -0
- package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts +16 -3
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
- package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
- package/dist/components/data-table/data-table-translations.d.ts +35 -0
- package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +55 -3
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.d.ts +3 -1
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +878 -230
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +8 -8
- package/dist/components/drawer/index.js +4 -4
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/geodesic/badge-frame.d.ts +13 -1
- package/dist/components/geodesic/badge-frame.d.ts.map +1 -1
- package/dist/components/geodesic/exam-badge.d.ts +4 -1
- package/dist/components/geodesic/exam-badge.d.ts.map +1 -1
- package/dist/components/geodesic/geometry.d.ts +14 -9
- package/dist/components/geodesic/geometry.d.ts.map +1 -1
- package/dist/components/geodesic/index.js +62 -23
- package/dist/components/geodesic/index.js.map +1 -1
- package/dist/components/geodesic/status.d.ts +8 -6
- package/dist/components/geodesic/status.d.ts.map +1 -1
- package/dist/components/geodesic/styles.css +15 -2
- package/dist/components/hover-card/index.js +3 -3
- package/dist/components/indicator/index.js +23 -8
- package/dist/components/indicator/index.js.map +1 -1
- package/dist/components/indicator/indicator.d.ts +15 -6
- package/dist/components/indicator/indicator.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +4 -4
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +4 -4
- package/dist/components/multi-combobox-list/index.js +6 -6
- package/dist/components/multi-select/index.js +4 -4
- package/dist/components/nav-link/index.js +5 -1
- package/dist/components/nav-link/nav-link.d.ts.map +1 -1
- package/dist/components/nav-link/tanstack.js +5 -1
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +15 -3
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/types.d.ts +5 -0
- package/dist/components/notification/types.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +5 -5
- package/dist/components/photo-capture/index.js +6 -6
- package/dist/components/popover/index.js +3 -3
- package/dist/components/schedule/index.js +4 -4
- package/dist/components/segment-group/index.js +1 -1
- package/dist/components/segment-group/segment-group.d.ts +6 -1
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +5 -5
- package/dist/components/spotlight/index.js +8 -8
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/tabs-data.d.ts +4 -1
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +4 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +3 -3
- package/dist/components/time-input/index.js +6 -6
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tree-multi-select/index.js +4 -4
- package/dist/components/tree-select/index.js +4 -4
- package/dist/index.js +2 -2
- package/dist/lib/overlay-container.d.ts.map +1 -1
- package/dist/lib/overlay-layer.d.ts +10 -3
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/sidebar-rail.d.ts +21 -0
- package/dist/lib/sidebar-rail.d.ts.map +1 -0
- package/dist/theme.css +21 -18
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +6 -0
- package/src/components/ambient-background/starfield.tsx +14 -41
- package/src/components/app-shell/app-shell.test.tsx +430 -5
- package/src/components/app-shell/app-shell.tsx +484 -24
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/avatar/avatar.test.tsx +12 -0
- package/src/components/avatar/avatar.tsx +9 -0
- package/src/components/button-group/button-group.test.tsx +24 -0
- package/src/components/button-group/button-group.tsx +21 -4
- package/src/components/button-multi-select/button-multi-select.test.tsx +15 -0
- package/src/components/button-select/button-select-control.tsx +5 -0
- package/src/components/button-select/button-select.test.tsx +25 -0
- package/src/components/button-select/button-select.tsx +13 -2
- package/src/components/data-table/data-table-features.ts +11 -0
- package/src/components/data-table/data-table-group.test.tsx +1007 -0
- package/src/components/data-table/data-table-group.tsx +474 -0
- package/src/components/data-table/data-table-grouping.ts +160 -0
- package/src/components/data-table/data-table-icons.tsx +8 -1
- package/src/components/data-table/data-table-meta.ts +9 -0
- package/src/components/data-table/data-table-pagination.tsx +5 -1
- package/src/components/data-table/data-table-stack.tsx +165 -43
- package/src/components/data-table/data-table-toolbar.tsx +110 -2
- package/src/components/data-table/data-table-translations.ts +44 -0
- package/src/components/data-table/data-table.tsx +420 -150
- package/src/components/data-table/index.ts +4 -0
- package/src/components/drawer/drawer.tsx +1 -1
- package/src/components/geodesic/badge-frame.tsx +67 -13
- package/src/components/geodesic/exam-badge.tsx +8 -4
- package/src/components/geodesic/geometry.ts +8 -6
- package/src/components/geodesic/status.test.ts +11 -2
- package/src/components/geodesic/status.ts +11 -7
- package/src/components/geodesic/styles.css +15 -2
- package/src/components/indicator/indicator.test.tsx +45 -0
- package/src/components/indicator/indicator.tsx +40 -13
- package/src/components/modal/modal.tsx +1 -1
- package/src/components/nav-link/nav-link.test.tsx +121 -1
- package/src/components/nav-link/nav-link.tsx +78 -29
- package/src/components/notification/create-notifier.tsx +18 -2
- package/src/components/notification/notify-in-modal.test.tsx +128 -0
- package/src/components/notification/types.ts +5 -0
- package/src/components/segment-group/segment-group.test.tsx +22 -0
- package/src/components/segment-group/segment-group.tsx +35 -19
- package/src/components/tabs/tabs-data.tsx +5 -1
- package/src/components/tabs/tabs.test.tsx +28 -0
- package/src/components/tabs/tabs.tsx +14 -4
- package/src/lib/overlay-container.tsx +2 -1
- package/src/lib/overlay-layer.test.tsx +63 -1
- package/src/lib/overlay-layer.tsx +29 -6
- package/src/lib/sidebar-rail.ts +24 -0
- package/src/theme.css +21 -18
- package/src/theme.test.ts +14 -11
- package/dist/chunk-7HZBD4YZ.js.map +0 -1
- package/dist/chunk-7P32XCEU.js.map +0 -1
- package/dist/chunk-AHKMN3YQ.js.map +0 -1
- package/dist/chunk-H7WOMZXO.js.map +0 -1
- package/dist/chunk-HRNWWL3Y.js.map +0 -1
- package/dist/chunk-LMCUGYHT.js.map +0 -1
- package/dist/chunk-MW42XVPD.js.map +0 -1
- package/dist/chunk-SAXWCGWR.js.map +0 -1
- package/dist/chunk-XUFCI262.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/slide-on-switch.ts","../src/components/popover/popover.tsx"],"names":["useState","useRef","ArkPopover","api","props"],"mappings":";;;;;;;;;;;;;;AAiCO,IAAM,UAAA,GAAa;AAAA,EACxB,kBAAA,EAAoB,WAAA;AAAA,EACpB,kBAAA,EAAoB,OAAA;AAAA,EACpB,wBAAA,EAA0B;AAC5B;AAiBO,IAAM,sBAAsB,MAAM;AACvC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAG5C,EAAA,MAAM,IAAA,GAAO,OAAO,KAAK,CAAA;AACzB,EAA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,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-N66NC6QK.js","sourcesContent":["import {\n Children,\n cloneElement,\n type ElementType,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from \"react\"\nimport type { Positioning } from \"./placement\"\n\n/**\n * Shared by `HoverCard.Group` and `Popover.Group`: several named triggers on\n * one Ark machine, one panel that slides from the active trigger to the next.\n */\n\n/** Slide transition for a group's shared positioner. Ark sets the\n * positioner's `transform: translate3d(var(--x), var(--y), 0)` inline\n * (`@zag-js/popper`); animating `transform` itself makes the browser\n * interpolate that translate between two trigger anchors when the group's\n * active trigger changes. Passed as `style` (not a class) so it merges with,\n * rather than replaces, Ark's own inline `transform`/`position` (Ark's\n * `mergeProps` shallow-merges style objects); the same override-the-real-style\n * technique `Tabs.Indicator` / `SegmentGroup` use for their sliding pill.\n *\n * Only applied once `useSlideAfterPlaced` reports `sliding`, never on an\n * open's first placement: before it, the positioner sits at its unplaced\n * origin (far off the trigger), and animating *that* jump reads as the panel\n * flying in across the page instead of just appearing. A standalone `Root`\n * never gets this at all: it also repositions on scroll/resize\n * (`autoUpdate`), where an animated `transform` would look laggy rather than\n * responsive. */\nexport const slideStyle = {\n transitionProperty: \"transform\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n} as const\n\ntype UpdatePosition = NonNullable<Positioning[\"updatePosition\"]>\n\n/**\n * `sliding` turns true once an open's first placement has been applied, and\n * false on every close. Waiting for the placement itself, not a frame count:\n * the first one after an open can take several frames (the panel mounts,\n * zag defers to the next frame, floating-ui computes asynchronously), and a\n * transition switched on before it lands slides the panel in from its\n * unplaced origin.\n *\n * Feed every open change to `onOpenChange`, and pass `updatePosition(...)`\n * as the machine's `positioning.updatePosition` — zag calls it for every\n * placement, with its own `updatePosition` to run. A consumer's own\n * `updatePosition`, if any, is wrapped rather than replaced.\n */\nexport const useSlideAfterPlaced = () => {\n const [sliding, setSliding] = useState(false)\n // Read by placements zag finishes asynchronously, after a close may have\n // landed — one of those must not re-arm the slide for the next open.\n const open = useRef(false)\n const onOpenChange = (next: boolean) => {\n open.current = next\n if (!next) setSliding(false)\n }\n const updatePosition =\n (custom?: UpdatePosition): UpdatePosition =>\n async (data) => {\n await (custom ? custom(data) : data.updatePosition())\n if (open.current) setSliding(true)\n }\n return { sliding, onOpenChange, updatePosition }\n}\n\n/** Split a group's children into its `Content` parts (matched by `type`)\n * and everything else (the triggers), one level deep. */\nexport const splitGroupChildren = <P extends { value?: string }>(\n children: ReactNode,\n content: ElementType<P>,\n) => {\n const items = Children.toArray(children)\n const isContent = (node: ReactNode): node is ReactElement<P> =>\n isValidElement(node) && node.type === content\n return { contents: items.filter(isContent), triggers: items.filter((item) => !isContent(item)) }\n}\n\n/** The `Content` whose `value` matches the active trigger, under one forced,\n * stable `key` — overriding whatever each was authored with (e.g.\n * `key={person.handle}` in a `.map()`). The slot only ever renders one at a\n * time, but a *different* key switching in reads to React as a different\n * component, unmounting the real Positioner/Content DOM tree and mounting a\n * fresh one instead of updating it in place. That fresh mount breaks the\n * \"one shared, sliding panel\" contract: its position starts unset again, so\n * every switch would look like the panel jumping in from the top. */\nexport const activeGroupContent = (\n contents: ReactElement<{ value?: string }>[],\n triggerValue: string | null,\n) => {\n const active = contents.find((content) => content.props.value === triggerValue)\n return active ? cloneElement(active, { key: \"group-content\" }) : null\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport {\n type LogicalPosition,\n type Placement,\n type PlacementProps,\n toPositioning,\n} from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport {\n activeGroupContent,\n slideStyle,\n splitGroupChildren,\n useSlideAfterPlaced,\n} from \"../../lib/slide-on-switch\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type PopoverPosition = LogicalPosition<Placement>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. `value` is the entered\n * trigger's, inside `Popover.Group`; the panel passes none. */\n onPointerEnter: (event: PointerEvent, value?: string) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so whatever Ark answers it with (a close, or a switch to another\n * trigger) becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n /** `Popover.Group`'s shared panel, past its open's first placement —\n * gates the slide between triggers (see `useSlideAfterPlaced`). */\n sliding: boolean\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n sliding: false,\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = Omit<ArkPopover.RootProps, \"positioning\"> &\n PopoverModeProps &\n PlacementProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\n/** Ark's live Popover API, for the hover path to send zag events through. */\ntype PopoverApi = ReturnType<typeof usePopoverContext>\n\n/** `Popover.Group`'s link into the Ark root, rendered inside it: keeps `api`\n * pointing at the machine's current API for the hover hook (which runs\n * above the root), and re-anchors the panel whenever the active trigger\n * changes. zag's trigger switch does reposition, but in the same action,\n * against the render it was sent from — still the old trigger — so on its\n * own the panel would swap content in place. (HoverCard's machine gets\n * away with it because its switch re-enters the open state.) */\nconst GroupBridge = ({ api }: { api: RefObject<PopoverApi | null> }) => {\n const live = usePopoverContext()\n useEffect(() => {\n api.current = live\n })\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the active trigger only; `live` is a new object every render.\n useEffect(() => {\n if (live.open) live.reposition()\n }, [live.triggerValue])\n return null\n}\n\ntype UsePopoverHoverOptions = {\n /** The machine's API (see `GroupBridge`); set once the Ark root mounts. */\n api: RefObject<PopoverApi | null>\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n *\n * Inside `Popover.Group`, hovering a trigger also makes it the active one,\n * through zag's own `setTriggerValue` — the one path that re-anchors the\n * panel too (zag repositions in the same action, reading the value it just\n * set; a controlled `triggerValue` prop would still hold the old one there).\n * So zag owns the value, and the hook never mirrors it. Over an open preview\n * that switch is immediate (the panel slides, no delay replays); a pinned\n * panel ignores hover and stays on its trigger. A click on an open preview\n * pins it whichever answer zag gives: a close for the active trigger, a\n * switch for another one. Which comes is zag's call, so the hook never\n * predicts it — by the time a click lands, a hover may have moved the\n * trigger already.\n */\nconst usePopoverHover = ({\n api,\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close or switch Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event, value) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (value !== undefined && api.current && api.current.triggerValue !== value)\n api.current.setTriggerValue(value)\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return {\n open: isOpen,\n press: source === \"press\",\n hover,\n onArkOpenChange,\n /** zag switched triggers — pins it if a click on a preview caused it. */\n onArkTriggerValueChange: () => {\n const trigger = upgrading.current\n upgrading.current = null\n if (!trigger) return\n clear()\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n },\n }\n}\n\n/** `Root` and `Group` — one machine; `group` swaps plain children for\n * `Trigger`s plus the active trigger's `Content`. */\nconst Machine = ({\n group,\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n triggerValue,\n defaultTriggerValue,\n onTriggerValueChange,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps & { group: boolean }) => {\n const { dir } = useLocaleContext()\n const guard = useLayerGuard(onPointerDownOutside)\n const slide = useSlideAfterPlaced()\n const api = useRef<PopoverApi | null>(null)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (group) slide.onOpenChange(details.open)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n api,\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n const parts = group ? splitGroupChildren(children, Content) : undefined\n return (\n <PopoverContext.Provider\n value={{\n width,\n withinPortal,\n container,\n layers: guard.layers,\n hover,\n sliding: group && slide.sliding,\n }}\n >\n <ArkPopover.Root\n // A group's panel mounts on each open, like HoverCard's, so its first\n // frame never inherits a stale position to slide from.\n lazyMount={group}\n unmountOnExit={group}\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={toPositioning(\n {\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning: group\n ? {\n ...positioning,\n updatePosition: slide.updatePosition(positioning?.updatePosition),\n }\n : positioning,\n },\n dir,\n width,\n )}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n triggerValue={triggerValue}\n defaultTriggerValue={defaultTriggerValue}\n onTriggerValueChange={(details) => {\n onTriggerValueChange?.(details)\n hovering.onArkTriggerValueChange()\n }}\n {...state}\n {...rest}\n >\n {parts ? (\n <>\n <GroupBridge api={api} />\n {parts.triggers}\n <ArkPopover.Context>\n {(api) => activeGroupContent(parts.contents, api.triggerValue)}\n </ArkPopover.Context>\n </>\n ) : (\n children\n )}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nconst Root = (props: PopoverProps) => <Machine group={false} {...props} />\n\nexport type PopoverGroupProps = PopoverProps\n\n/**\n * One shared panel across several triggers (e.g. a row of avatars) — the\n * same `Popover.Trigger` / `Popover.Content` parts `Popover.Root` uses, just\n * several of each, matched by a shared `value`. The Popover counterpart of\n * `HoverCard.Group`, with the same contract, for cards people act on:\n *\n * <Popover.Group mode=\"hover\" width=\"auto\">\n * <Popover.Trigger value=\"ada\"><Avatar name=\"Ada Lovelace\" /></Popover.Trigger>\n * <Popover.Trigger value=\"grace\"><Avatar name=\"Grace Hopper\" /></Popover.Trigger>\n *\n * <Popover.Content value=\"ada\">Ada's card</Popover.Content>\n * <Popover.Content value=\"grace\">Grace's card</Popover.Content>\n * </Popover.Group>\n *\n * zag's Popover supports several named triggers on one machine: clicking\n * another trigger while the panel is open moves it there instead of closing\n * it, and only the active trigger gets `aria-expanded`. In `mode=\"hover\"`,\n * hovering another trigger while the preview is open moves it too, with no\n * delay replay; a click, tap or Enter on any trigger, or a press or focus in\n * the panel, pins it exactly like a single `mode=\"hover\"` Popover. Either\n * way the panel slides between triggers (`slideStyle`), never on the first\n * open.\n *\n * `triggerValue` / `defaultTriggerValue` / `onTriggerValueChange` read and\n * drive the active trigger. `Trigger`/`Content` must be `Group`'s own direct\n * children (it scans one level, like `HoverCard.Group`); `Group` renders no\n * DOM node, so wrap it from the outside for row layout (`Avatar.Group`).\n */\nconst Group = (props: PopoverGroupProps) => <Machine group {...props} />\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event, rest.value)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> &\n WithTestId & {\n /** Which `Popover.Group` trigger this content belongs to — only\n * meaningful inside `Popover.Group`, where `Group` renders the one whose\n * `value` matches the active trigger. Never forwarded to the DOM. */\n value?: string\n }\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n value: _value,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover, sliding } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner style={sliding ? slideStyle : undefined}>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Group,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/slide-on-switch.ts","../src/components/popover/popover.tsx"],"names":["useState","useRef","ArkPopover","api","props"],"mappings":";;;;;;;;;;;;;;AAiCO,IAAM,UAAA,GAAa;AAAA,EACxB,kBAAA,EAAoB,WAAA;AAAA,EACpB,kBAAA,EAAoB,OAAA;AAAA,EACpB,wBAAA,EAA0B;AAC5B;AAiBO,IAAM,sBAAsB,MAAM;AACvC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAG5C,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KA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-RKCUXOU2.js","sourcesContent":["import {\n Children,\n cloneElement,\n type ElementType,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from \"react\"\nimport type { Positioning } from \"./placement\"\n\n/**\n * Shared by `HoverCard.Group` and `Popover.Group`: several named triggers on\n * one Ark machine, one panel that slides from the active trigger to the next.\n */\n\n/** Slide transition for a group's shared positioner. Ark sets the\n * positioner's `transform: translate3d(var(--x), var(--y), 0)` inline\n * (`@zag-js/popper`); animating `transform` itself makes the browser\n * interpolate that translate between two trigger anchors when the group's\n * active trigger changes. Passed as `style` (not a class) so it merges with,\n * rather than replaces, Ark's own inline `transform`/`position` (Ark's\n * `mergeProps` shallow-merges style objects); the same override-the-real-style\n * technique `Tabs.Indicator` / `SegmentGroup` use for their sliding pill.\n *\n * Only applied once `useSlideAfterPlaced` reports `sliding`, never on an\n * open's first placement: before it, the positioner sits at its unplaced\n * origin (far off the trigger), and animating *that* jump reads as the panel\n * flying in across the page instead of just appearing. A standalone `Root`\n * never gets this at all: it also repositions on scroll/resize\n * (`autoUpdate`), where an animated `transform` would look laggy rather than\n * responsive. */\nexport const slideStyle = {\n transitionProperty: \"transform\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n} as const\n\ntype UpdatePosition = NonNullable<Positioning[\"updatePosition\"]>\n\n/**\n * `sliding` turns true once an open's first placement has been applied, and\n * false on every close. Waiting for the placement itself, not a frame count:\n * the first one after an open can take several frames (the panel mounts,\n * zag defers to the next frame, floating-ui computes asynchronously), and a\n * transition switched on before it lands slides the panel in from its\n * unplaced origin.\n *\n * Feed every open change to `onOpenChange`, and pass `updatePosition(...)`\n * as the machine's `positioning.updatePosition` — zag calls it for every\n * placement, with its own `updatePosition` to run. A consumer's own\n * `updatePosition`, if any, is wrapped rather than replaced.\n */\nexport const useSlideAfterPlaced = () => {\n const [sliding, setSliding] = useState(false)\n // Read by placements zag finishes asynchronously, after a close may have\n // landed — one of those must not re-arm the slide for the next open.\n const open = useRef(false)\n const onOpenChange = (next: boolean) => {\n open.current = next\n if (!next) setSliding(false)\n }\n const updatePosition =\n (custom?: UpdatePosition): UpdatePosition =>\n async (data) => {\n await (custom ? custom(data) : data.updatePosition())\n if (open.current) setSliding(true)\n }\n return { sliding, onOpenChange, updatePosition }\n}\n\n/** Split a group's children into its `Content` parts (matched by `type`)\n * and everything else (the triggers), one level deep. */\nexport const splitGroupChildren = <P extends { value?: string }>(\n children: ReactNode,\n content: ElementType<P>,\n) => {\n const items = Children.toArray(children)\n const isContent = (node: ReactNode): node is ReactElement<P> =>\n isValidElement(node) && node.type === content\n return { contents: items.filter(isContent), triggers: items.filter((item) => !isContent(item)) }\n}\n\n/** The `Content` whose `value` matches the active trigger, under one forced,\n * stable `key` — overriding whatever each was authored with (e.g.\n * `key={person.handle}` in a `.map()`). The slot only ever renders one at a\n * time, but a *different* key switching in reads to React as a different\n * component, unmounting the real Positioner/Content DOM tree and mounting a\n * fresh one instead of updating it in place. That fresh mount breaks the\n * \"one shared, sliding panel\" contract: its position starts unset again, so\n * every switch would look like the panel jumping in from the top. */\nexport const activeGroupContent = (\n contents: ReactElement<{ value?: string }>[],\n triggerValue: string | null,\n) => {\n const active = contents.find((content) => content.props.value === triggerValue)\n return active ? cloneElement(active, { key: \"group-content\" }) : null\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport {\n type LogicalPosition,\n type Placement,\n type PlacementProps,\n toPositioning,\n} from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport {\n activeGroupContent,\n slideStyle,\n splitGroupChildren,\n useSlideAfterPlaced,\n} from \"../../lib/slide-on-switch\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type PopoverPosition = LogicalPosition<Placement>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. `value` is the entered\n * trigger's, inside `Popover.Group`; the panel passes none. */\n onPointerEnter: (event: PointerEvent, value?: string) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so whatever Ark answers it with (a close, or a switch to another\n * trigger) becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n /** `Popover.Group`'s shared panel, past its open's first placement —\n * gates the slide between triggers (see `useSlideAfterPlaced`). */\n sliding: boolean\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n sliding: false,\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = Omit<ArkPopover.RootProps, \"positioning\"> &\n PopoverModeProps &\n PlacementProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Render the panel in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\n/** Ark's live Popover API, for the hover path to send zag events through. */\ntype PopoverApi = ReturnType<typeof usePopoverContext>\n\n/** `Popover.Group`'s link into the Ark root, rendered inside it: keeps `api`\n * pointing at the machine's current API for the hover hook (which runs\n * above the root), and re-anchors the panel whenever the active trigger\n * changes. zag's trigger switch does reposition, but in the same action,\n * against the render it was sent from — still the old trigger — so on its\n * own the panel would swap content in place. (HoverCard's machine gets\n * away with it because its switch re-enters the open state.) */\nconst GroupBridge = ({ api }: { api: RefObject<PopoverApi | null> }) => {\n const live = usePopoverContext()\n useEffect(() => {\n api.current = live\n })\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the active trigger only; `live` is a new object every render.\n useEffect(() => {\n if (live.open) live.reposition()\n }, [live.triggerValue])\n return null\n}\n\ntype UsePopoverHoverOptions = {\n /** The machine's API (see `GroupBridge`); set once the Ark root mounts. */\n api: RefObject<PopoverApi | null>\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n *\n * Inside `Popover.Group`, hovering a trigger also makes it the active one,\n * through zag's own `setTriggerValue` — the one path that re-anchors the\n * panel too (zag repositions in the same action, reading the value it just\n * set; a controlled `triggerValue` prop would still hold the old one there).\n * So zag owns the value, and the hook never mirrors it. Over an open preview\n * that switch is immediate (the panel slides, no delay replays); a pinned\n * panel ignores hover and stays on its trigger. A click on an open preview\n * pins it whichever answer zag gives: a close for the active trigger, a\n * switch for another one. Which comes is zag's call, so the hook never\n * predicts it — by the time a click lands, a hover may have moved the\n * trigger already.\n */\nconst usePopoverHover = ({\n api,\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close or switch Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event, value) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (value !== undefined && api.current && api.current.triggerValue !== value)\n api.current.setTriggerValue(value)\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return {\n open: isOpen,\n press: source === \"press\",\n hover,\n onArkOpenChange,\n /** zag switched triggers — pins it if a click on a preview caused it. */\n onArkTriggerValueChange: () => {\n const trigger = upgrading.current\n upgrading.current = null\n if (!trigger) return\n clear()\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n },\n }\n}\n\n/** `Root` and `Group` — one machine; `group` swaps plain children for\n * `Trigger`s plus the active trigger's `Content`. */\nconst Machine = ({\n group,\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n triggerValue,\n defaultTriggerValue,\n onTriggerValueChange,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps & { group: boolean }) => {\n const { dir } = useLocaleContext()\n const guard = useLayerGuard(onPointerDownOutside)\n const slide = useSlideAfterPlaced()\n const api = useRef<PopoverApi | null>(null)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (group) slide.onOpenChange(details.open)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n api,\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n const parts = group ? splitGroupChildren(children, Content) : undefined\n return (\n <PopoverContext.Provider\n value={{\n width,\n withinPortal,\n container,\n layers: guard.layers,\n hover,\n sliding: group && slide.sliding,\n }}\n >\n <ArkPopover.Root\n // A group's panel mounts on each open, like HoverCard's, so its first\n // frame never inherits a stale position to slide from.\n lazyMount={group}\n unmountOnExit={group}\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={toPositioning(\n {\n position,\n gutter,\n offset,\n hideWhenDetached,\n positioning: group\n ? {\n ...positioning,\n updatePosition: slide.updatePosition(positioning?.updatePosition),\n }\n : positioning,\n },\n dir,\n width,\n )}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n triggerValue={triggerValue}\n defaultTriggerValue={defaultTriggerValue}\n onTriggerValueChange={(details) => {\n onTriggerValueChange?.(details)\n hovering.onArkTriggerValueChange()\n }}\n {...state}\n {...rest}\n >\n {parts ? (\n <>\n <GroupBridge api={api} />\n {parts.triggers}\n <ArkPopover.Context>\n {(api) => activeGroupContent(parts.contents, api.triggerValue)}\n </ArkPopover.Context>\n </>\n ) : (\n children\n )}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nconst Root = (props: PopoverProps) => <Machine group={false} {...props} />\n\nexport type PopoverGroupProps = PopoverProps\n\n/**\n * One shared panel across several triggers (e.g. a row of avatars) — the\n * same `Popover.Trigger` / `Popover.Content` parts `Popover.Root` uses, just\n * several of each, matched by a shared `value`. The Popover counterpart of\n * `HoverCard.Group`, with the same contract, for cards people act on:\n *\n * <Popover.Group mode=\"hover\" width=\"auto\">\n * <Popover.Trigger value=\"ada\"><Avatar name=\"Ada Lovelace\" /></Popover.Trigger>\n * <Popover.Trigger value=\"grace\"><Avatar name=\"Grace Hopper\" /></Popover.Trigger>\n *\n * <Popover.Content value=\"ada\">Ada's card</Popover.Content>\n * <Popover.Content value=\"grace\">Grace's card</Popover.Content>\n * </Popover.Group>\n *\n * zag's Popover supports several named triggers on one machine: clicking\n * another trigger while the panel is open moves it there instead of closing\n * it, and only the active trigger gets `aria-expanded`. In `mode=\"hover\"`,\n * hovering another trigger while the preview is open moves it too, with no\n * delay replay; a click, tap or Enter on any trigger, or a press or focus in\n * the panel, pins it exactly like a single `mode=\"hover\"` Popover. Either\n * way the panel slides between triggers (`slideStyle`), never on the first\n * open.\n *\n * `triggerValue` / `defaultTriggerValue` / `onTriggerValueChange` read and\n * drive the active trigger. `Trigger`/`Content` must be `Group`'s own direct\n * children (it scans one level, like `HoverCard.Group`); `Group` renders no\n * DOM node, so wrap it from the outside for row layout (`Avatar.Group`).\n */\nconst Group = (props: PopoverGroupProps) => <Machine group {...props} />\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event, rest.value)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> &\n WithTestId & {\n /** Which `Popover.Group` trigger this content belongs to — only\n * meaningful inside `Popover.Group`, where `Group` renders the one whose\n * `value` matches the active trigger. Never forwarded to the DOM. */\n value?: string\n }\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n value: _value,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover, sliding } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner style={sliding ? slideStyle : undefined}>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Group,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputBase, inputControlClasses, inputSlot } from './chunk-I4B3N3UX.js';
|
|
2
2
|
import { FieldShell, fieldA11yProps } from './chunk-X6DESK37.js';
|
|
3
3
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
4
|
-
import { popoverClearTrigger } from './chunk-
|
|
4
|
+
import { popoverClearTrigger } from './chunk-RKCUXOU2.js';
|
|
5
5
|
import { CloseIcon } from './chunk-6YNLRQ25.js';
|
|
6
6
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
7
7
|
import { props } from './chunk-WYCMIIRR.js';
|
|
@@ -230,5 +230,5 @@ var NumberInput = ({
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
export { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput };
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
234
|
-
//# sourceMappingURL=chunk-
|
|
233
|
+
//# sourceMappingURL=chunk-SBZJGFZ6.js.map
|
|
234
|
+
//# sourceMappingURL=chunk-SBZJGFZ6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;AAuCO,IAAM,iCAAA,GAAoC;AAAA,EAC/C,cAAA,EAAgB,WAAA;AAAA,EAChB,cAAA,EAAgB,WAAA;AAAA,EAChB,iBAAA,EAAmB;AACrB;AAMO,IAAM,aAAA,GAAwD;AAAA,EACnE,SAAA,kBAAW,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC7C,SAAA,kBAAW,GAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC/C,KAAA,sBAAQ,SAAA,EAAA,EAAU;AACpB,CAAA;AAkHA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,yGAAA;AAAA,EACA,8FAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,UAAA,GAAa,CAAC,KAAA,KAClB,KAAA,KAAU,MAAA,GAAY,SAAY,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,MAAA,CAAO,KAAK,CAAA;AAGtE,IAAM,SAAA,GAAY,CAAC,GAAA,EAAa,GAAA,EAAa,GAAA,KAAwB;AACnE,EAAA,MAAM,IAAA,GAAO,MAAM,GAAA,GAAM,CAAA;AACzB,EAAA,OAAA,CA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,EAAW,aAAa,CAAA,EACrD,QAAA,EAAA,MAAA,EACH;AAAA,mBAAA,EAEJ,CAAA;AAAA,kBACC,QAAA,oBACC,GAAA;AAAA,oBAAC,QAAA;AAAA,oBAAA;AAAA,sBACC,IAAA,EAAK,QAAA;AAAA,sBACL,cAAY,oBAAA,CAAqB,iBAAA;AAAA,sBACjC,eAAa,CAAC,SAAA;AAAA,sBACd,QAAA,EAAU,YAAY,CAAA,GAAI,EAAA;AAAA,sBAC1B,aAAA,EAAe,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,sBAC/C,OAAA,EAAS,MAAM,GAAA,CAAI,UAAA,EAAW;AAAA,sBAC9B,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,sBAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,mBACT;AAAA,kBAED,CAAC,YAAA,oBACA,IAAA,CAACA,aAAA,CAAI,OAAA,EAAJ,EAAY,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,UAAA,EAAY,OAAO,CAAA,EAGnE,QAAA,EAAA;AAAA,oCAAA,GAAA,CAACA,cAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT,CAAA;AAAA,wCACCA,aAAA,CAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT;AAAA,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-N5M4PDBK.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden` end-slot span. Render them as\n // direct children instead, and flag the shell's end padding\n // manually so the layout matches an `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;AAuCO,IAAM,iCAAA,GAAoC;AAAA,EAC/C,cAAA,EAAgB,WAAA;AAAA,EAChB,cAAA,EAAgB,WAAA;AAAA,EAChB,iBAAA,EAAmB;AACrB;AAMO,IAAM,aAAA,GAAwD;AAA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AG,qBAAA,EAAuB,UAAA,EAAY,OAAO,CAAA,EAGnE,QAAA,EAAA;AAAA,oCAAA,GAAA,CAACA,cAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT,CAAA;AAAA,wCACCA,aAAA,CAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT;AAAA,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-SBZJGFZ6.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden` end-slot span. Render them as\n // direct children instead, and flag the shell's end padding\n // manually so the layout matches an `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -11,5 +11,5 @@ var useOverlayContainer = (override) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { OverlayContainerProvider, useOverlayContainer };
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-SLUOF7XW.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-SLUOF7XW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/overlay-container.tsx"],"names":[],"mappings":";;;;AAuCA,IAAM,uBAAA,GAA0B,cAAoD,IAAI,CAAA;AAUjF,IAAM,wBAAA,GAA2B,CAAC,EAAE,KAAA,EAAO,QAAA,EAAS,qBACzD,GAAA,CAAC,uBAAA,CAAwB,QAAA,EAAxB,EAAiC,KAAA,EAAe,QAAA,EAAS;AAMrD,IAAM,mBAAA,GAAsB,CACjC,QAAA,KAC8C;AAC9C,EAAA,MAAM,SAAA,GAAY,WAAW,uBAAuB,CAAA;AAGpD,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,MAAO,QAAA,GAAW,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,IAAA,EAAO,CAAC,QAAQ,CAAC,CAAA;AAC/E,EAAA,OAAO,OAAO,SAAA,IAAa,MAAA;AAC7B","file":"chunk-SLUOF7XW.js","sourcesContent":["\"use client\"\n\nimport { createContext, type ReactNode, type RefObject, useContext, useMemo } from \"react\"\n\n/**\n * Shared \"where do nested overlays portal to\" context.\n *\n * Every floating surface in this kit portals to `document.body` by default so\n * it escapes clipping ancestors. That's right at page level, but it breaks down\n * inside a Modal/Drawer: the panel becomes a *sibling* of the dialog rather\n * than a descendant, so the only thing keeping it visible is a z-index tall\n * enough to clear `--modal-z` — and any number picked for that is wrong the\n * moment dialogs and overlays nest the other way around.\n *\n * So `Modal`/`Drawer` publish their own positioner here (see their\n * `Positioner` parts), and every overlay opened inside one portals *into* it.\n * Being a descendant of a surface that already outranks the page, the panel\n * stays above it structurally, whatever its own z-index band says — which is\n * also what frees `--toast-z` to sit between the overlay and modal bands\n * instead of above both. A toast created while a modal is open moves up to\n * `--toast-raised-z` instead (see `theme.css`).\n *\n * `Schedule` publishes its scroller the same way, for a different reason: its\n * popovers should scroll and clip with the grid, not float over the page.\n *\n * Modal and Drawer deliberately don't *consume* this: dialog-on-dialog order\n * is already handled by `--modal-z` plus zag's `--layer-index`, and nesting one\n * fixed, scroll-locking container inside another buys nothing.\n */\n/**\n * A ref, not the element. The element only exists after its first commit, so\n * publishing it as state costs every provider a second render of its whole\n * subtree just to hand the node down — and each portal a third, to move there.\n * Ark's `Portal` reads `container.current` itself when it first renders, so a\n * ref is enough: an overlay that mounts once the container is attached (a\n * lazily mounted panel, opened later) lands in the right place on its first\n * render, and one mounted in the same commit as the container is moved there\n * by `Portal`'s own mount effect, by which time the ref is set.\n */\nconst OverlayContainerContext = createContext<RefObject<HTMLElement | null> | null>(null)\n\nexport type OverlayContainerProviderProps = {\n /** A ref to the element nested overlays should portal into — a\n * Modal/Drawer positioner, a Schedule scroller. Still `null` (not yet\n * attached) reads as \"no container\", i.e. `document.body`. */\n value: RefObject<HTMLElement | null>\n children?: ReactNode\n}\n\nexport const OverlayContainerProvider = ({ value, children }: OverlayContainerProviderProps) => (\n <OverlayContainerContext.Provider value={value}>{children}</OverlayContainerContext.Provider>\n)\n\n/** Resolves an overlay's portal target, shaped for Ark's `<Portal container>`:\n * `override` (a per-instance `container` prop) wins; else the enclosing\n * provider's ref; else `undefined` — Ark falls back to `document.body`. */\nexport const useOverlayContainer = (\n override?: HTMLElement | null,\n): RefObject<HTMLElement | null> | undefined => {\n const inherited = useContext(OverlayContainerContext)\n // Ark's `Portal` keys its container effect on this object's identity, so\n // keep it stable while the element is.\n const own = useMemo(() => (override ? { current: override } : null), [override])\n return own ?? inherited ?? undefined\n}\n"]}
|
|
@@ -85,6 +85,10 @@ var tabsTrigger = cva(
|
|
|
85
85
|
true: "data-selected:text-(--c-text)",
|
|
86
86
|
false: "data-selected:text-brand-950 dark:data-selected:text-white"
|
|
87
87
|
},
|
|
88
|
+
// An even share of the list per trigger, like a tab bar. Read from
|
|
89
|
+
// `TabsStyleContext` (set by `List`'s `grow`), not a child selector on
|
|
90
|
+
// the list, so a custom element in the list never grows by accident.
|
|
91
|
+
grow: { true: "flex-1" },
|
|
88
92
|
size: {
|
|
89
93
|
xs: "px-2 py-0.5 text-xs",
|
|
90
94
|
sm: "px-2.5 py-1 text-sm",
|
|
@@ -169,6 +173,7 @@ var tabsContent = cn(
|
|
|
169
173
|
var TabsStyleContext = createContext({
|
|
170
174
|
variant: "underline",
|
|
171
175
|
size: "md",
|
|
176
|
+
grow: false,
|
|
172
177
|
color: void 0,
|
|
173
178
|
colors: {},
|
|
174
179
|
setTriggerColor: () => {
|
|
@@ -199,6 +204,7 @@ var Root = ({ orientation = "horizontal", className, testId, ...rest }) => {
|
|
|
199
204
|
var List = ({
|
|
200
205
|
variant = "underline",
|
|
201
206
|
size = "md",
|
|
207
|
+
grow = false,
|
|
202
208
|
color,
|
|
203
209
|
className,
|
|
204
210
|
testId,
|
|
@@ -213,8 +219,8 @@ var List = ({
|
|
|
213
219
|
});
|
|
214
220
|
}, []);
|
|
215
221
|
const style = useMemo(
|
|
216
|
-
() => ({ variant, size, color, colors, setTriggerColor }),
|
|
217
|
-
[variant, size, color, colors, setTriggerColor]
|
|
222
|
+
() => ({ variant, size, grow, color, colors, setTriggerColor }),
|
|
223
|
+
[variant, size, grow, color, colors, setTriggerColor]
|
|
218
224
|
);
|
|
219
225
|
return /* @__PURE__ */ jsx(TabsStyleContext.Provider, { value: style, children: /* @__PURE__ */ jsx(
|
|
220
226
|
Tabs$1.List,
|
|
@@ -227,7 +233,7 @@ var List = ({
|
|
|
227
233
|
) });
|
|
228
234
|
};
|
|
229
235
|
var Trigger = ({ color, className, testId, ...rest }) => {
|
|
230
|
-
const { variant, size, color: listColor, setTriggerColor } = useContext(TabsStyleContext);
|
|
236
|
+
const { variant, size, grow, color: listColor, setTriggerColor } = useContext(TabsStyleContext);
|
|
231
237
|
const { value } = rest;
|
|
232
238
|
useEffect(() => {
|
|
233
239
|
setTriggerColor(value, color);
|
|
@@ -237,7 +243,7 @@ var Trigger = ({ color, className, testId, ...rest }) => {
|
|
|
237
243
|
Tabs$1.Trigger,
|
|
238
244
|
{
|
|
239
245
|
className: cn(
|
|
240
|
-
tabsTrigger({ variant, size, colored: (color ?? listColor) !== void 0 }),
|
|
246
|
+
tabsTrigger({ variant, size, grow, colored: (color ?? listColor) !== void 0 }),
|
|
241
247
|
className
|
|
242
248
|
),
|
|
243
249
|
"data-color": color,
|
|
@@ -284,6 +290,7 @@ var TabsComponent = ({
|
|
|
284
290
|
variant,
|
|
285
291
|
size,
|
|
286
292
|
color,
|
|
293
|
+
grow,
|
|
287
294
|
value,
|
|
288
295
|
defaultValue,
|
|
289
296
|
onChange,
|
|
@@ -297,7 +304,7 @@ var TabsComponent = ({
|
|
|
297
304
|
onValueChange: onChange ? (d) => onChange(d.value) : void 0,
|
|
298
305
|
...root,
|
|
299
306
|
children: [
|
|
300
|
-
/* @__PURE__ */ jsxs(List, { variant, size, color, children: [
|
|
307
|
+
/* @__PURE__ */ jsxs(List, { variant, size, color, grow, children: [
|
|
301
308
|
/* @__PURE__ */ jsx(Indicator, {}),
|
|
302
309
|
data.map((item) => /* @__PURE__ */ jsx(
|
|
303
310
|
Trigger,
|
|
@@ -333,5 +340,5 @@ var Tabs = Object.assign(TabsComponent, {
|
|
|
333
340
|
});
|
|
334
341
|
|
|
335
342
|
export { Tabs };
|
|
336
|
-
//# sourceMappingURL=chunk-
|
|
337
|
-
//# sourceMappingURL=chunk-
|
|
343
|
+
//# sourceMappingURL=chunk-SOUDKESO.js.map
|
|
344
|
+
//# sourceMappingURL=chunk-SOUDKESO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/tabs/tabs.tsx","../src/components/tabs/tabs-data.tsx"],"names":["Ark","jsx"],"mappings":";;;;;;;;;;AAuEA,IAAM,QAAA,GAAW,GAAA;AAAA,EACf;AAAA,IACE,eAAA;AAAA,IACA,wCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,SAAA,EAAW,0CAAA;AAAA,QACX,QAAA,EAAU;AAAA,UACR,oBAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,OAAA;AAAA,QACJ,EAAA,EAAI,SAAA;AAAA,QACJ,EAAA,EAAI,OAAA;AAAA,QACJ,EAAA,EAAI,OAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,WAAA,EAAa,MAAM,IAAA;AAAK;AAExD,CAAA;AA0BA,IAAM,WAAA,GAAc,GAAA;AAAA,EAClB;AAAA,IACE,mFAAA;AAAA,IACA,wCAAA;AAAA,IACA,kBAAA,CAAmB,SAAA;AAAA,IACnB,gFAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,QAIP,SAAA,EAAW;AAAA,UACT,WAAA,EAAY;AAAA,UACZ,YAAA;AAAA;AA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,QAAQ,CAAA,EAAG,IAAA,CAAK,UAAU,CAAA,IAAA,EAAO,IAAA,CAAK,KAAK,CAAA,CAAE,CAAA,MAAA,CAAA;AAAA,UAE5C,QAAA,EAAA,IAAA,CAAK;AAAA,SAAA;AAAA,QAJD,IAAA,CAAK;AAAA,OAMb;AAAA;AAAA;AACH,CAAA;AAQK,IAAM,IAAA,GAAO,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA,EAC/C,IAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAC","file":"chunk-SOUDKESO.js","sourcesContent":["\"use client\"\n\nimport { Tabs as Ark, useTabsContext } from \"@ark-ui/react/tabs\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useDirectionCheck } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Tabs — a navigation control on Ark UI's Tabs machine: a row (or column) of\n * triggers, each revealing its own content panel, over a hairline baseline\n * that spans the whole list. An indicator slides to the active trigger. Two\n * classic looks:\n *\n * - `underline` (default) — a 2px bar on the baseline under the active label.\n * - `enclosed` — the active tab is a hairline box (top + sides) that opens the\n * baseline beneath it, so the tab reads as attached to its panel.\n *\n * For a segmented pill tray, use `SegmentGroup` instead: Tabs is navigation\n * between content panels, not a single-choice value, and has no `Field`\n * integration (no label/description/error/name).\n *\n * Two ways to use it:\n *\n * // 1. Data-driven — the common case\n * <Tabs\n * color=\"brand\"\n * defaultValue=\"overview\"\n * data={[\n * { value: \"overview\", label: \"Overview\", content: <Overview /> },\n * { value: \"activity\", label: \"Activity\", content: <Activity /> },\n * ]}\n * />\n *\n * // 2. Compound — for anything the data array can't express\n * <Tabs.Root defaultValue=\"overview\">\n * <Tabs.List variant=\"enclosed\" color=\"brand\">\n * <Tabs.Indicator />\n * <Tabs.Trigger value=\"overview\">Overview</Tabs.Trigger>\n * <Tabs.Trigger value=\"activity\">Activity</Tabs.Trigger>\n * </Tabs.List>\n * <Tabs.Content value=\"overview\"><Overview /></Tabs.Content>\n * <Tabs.Content value=\"activity\"><Activity /></Tabs.Content>\n * </Tabs.Root>\n *\n * `variant`, `size` and `color` all live on `List` and apply to the baseline,\n * every trigger, and the indicator — set them once on `List` rather than\n * repeating them on each `Trigger`. `color` is a `data-color` attribute, so it\n * is scoped to the strip: it deliberately does *not* sit on `Root`, which also\n * wraps every `Content` panel and would leak the palette into whatever those\n * panels render — an uncoloured `Button` inside a panel would silently adopt\n * the tab's palette (#140).\n */\n\n/** The list: a full-width row (or column) with a hairline baseline on the\n * block-end edge when horizontal and the inline-end edge when vertical\n * (logical, so it flips under RTL). No tray fill, no inset, no separators.\n *\n * `underline` paints the baseline as the list's own border, in the kit's\n * hairline recipe (`border-brand-900/20 dark:border-white/15`). `enclosed`\n * keeps the same 1px border *transparent* — the geometry is identical, but\n * the line itself is drawn by the indicator (see `tabsIndicator`), which\n * needs the list to clip it at its two ends along the main axis. `clip`\n * rather than `hidden`: it creates no scroll container, and leaves the cross\n * axis visible. */\nconst tabsList = cva(\n [\n \"relative flex\",\n \"data-[orientation=horizontal]:border-b\",\n \"data-[orientation=vertical]:flex-col data-[orientation=vertical]:border-e\",\n ],\n {\n variants: {\n variant: {\n underline: \"border-brand-900/20 dark:border-white/15\",\n enclosed: [\n \"border-transparent\",\n \"data-[orientation=horizontal]:overflow-x-clip data-[orientation=vertical]:overflow-y-clip\",\n ],\n },\n size: {\n xs: \"gap-1\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-3\",\n xl: \"gap-4\",\n },\n },\n defaultVariants: { variant: \"underline\", size: \"md\" },\n },\n)\n\n/**\n * Each trigger. Every label sits on the page surface, never on a colored fill,\n * so there is no `--c-on-solid` branch. An unselected label is Figma's\n * `Text/text-secondary` (`TEXT_COLOR_CLASSES.secondary`), and the selected one\n * is `Text/text-primary`, or `--c-text` when the trigger or its list has a\n * `color`.\n *\n * The hover lift is scoped to unselected triggers: the selected label already\n * has its final color, and an unscoped `hover:` would tie on specificity and\n * win on source order alone, overriding `--c-text` with the neutral text.\n * Mirrors `Button`'s own `not-data-loading:hover:` scoping.\n *\n * Before the indicator is measured: Ark renders the indicator `hidden` with\n * no rect on the server, and shows it only once it has measured the selected\n * trigger on the client. Until then (`tabs-unmeasured:`, theme.css) the\n * selected trigger draws a static copy of the indicator from its own\n * pseudo-elements: the bar for `underline`; the box and the baseline around\n * it for `enclosed`, whose baseline would otherwise not exist at all. The\n * geometry is always there and only the paint is gated, and Ark unhides the\n * indicator in the same render it sets the rect, so the copy and the real\n * thing swap within one frame, in the same place and color. The indicator\n * doesn't slide in from 0,0 either: it comes out of `display: none`, which\n * starts no transition.\n */\nconst tabsTrigger = cva(\n [\n \"relative z-1 cursor-pointer text-center font-medium whitespace-nowrap select-none\",\n \"data-[orientation=vertical]:text-start\",\n TEXT_COLOR_CLASSES.secondary,\n \"not-data-selected:hover:text-brand-950 dark:not-data-selected:hover:text-white\",\n \"transition-colors\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n ],\n {\n variants: {\n variant: {\n // The trigger paints nothing of its own (the bar is the indicator's\n // border), so its radius only shapes the focus ring: the same `xs`\n // the enclosed ring follows.\n underline: [\n focusStyles(),\n \"rounded-xs\",\n // Static bar (see \"Before the indicator is measured\" above): the\n // indicator's 2px border, one pixel past the trigger's edge.\n \"after:pointer-events-none after:absolute\",\n \"data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:-bottom-px data-[orientation=horizontal]:after:h-0.5\",\n \"data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:-end-px data-[orientation=vertical]:after:w-0.5\",\n ],\n // The enclosed list clips along its main axis, which would cut an\n // outset ring off the first and last triggers, so the ring goes\n // inside, rounded like the indicator box it matches.\n enclosed: [\n focusStyles({ inset: true, offset: false }),\n \"data-[orientation=horizontal]:rounded-t-xs data-[orientation=vertical]:rounded-s-xs\",\n // Static box (`::after`): the indicator's rect, shifted one pixel\n // toward the baseline, open on that side.\n \"after:pointer-events-none after:absolute after:border after:border-transparent\",\n \"data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:top-px data-[orientation=horizontal]:after:-bottom-px data-[orientation=horizontal]:after:border-b-0 data-[orientation=horizontal]:after:rounded-t-xs\",\n \"data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:start-px data-[orientation=vertical]:after:-end-px data-[orientation=vertical]:after:border-e-0 data-[orientation=vertical]:after:rounded-s-xs\",\n \"tabs-unmeasured:data-selected:after:border-(color:--default-border-color)\",\n // Static baseline (`::before`): a strip reaching 100vmax past both\n // ends of the trigger, painted by two backgrounds that each stop at\n // the trigger's edge, so it is open exactly under the box — the\n // indicator's two segments, in one pseudo-element. The list clips\n // it, as it clips the indicator's.\n \"before:pointer-events-none before:absolute before:bg-no-repeat\",\n \"data-[orientation=horizontal]:before:-inset-x-[100vmax] data-[orientation=horizontal]:before:-bottom-px data-[orientation=horizontal]:before:h-px data-[orientation=horizontal]:before:bg-[length:100vmax_1px] data-[orientation=horizontal]:before:bg-[position:left_bottom,right_bottom]\",\n \"data-[orientation=vertical]:before:-inset-y-[100vmax] data-[orientation=vertical]:before:-end-px data-[orientation=vertical]:before:w-px data-[orientation=vertical]:before:bg-[length:1px_100vmax] data-[orientation=vertical]:before:bg-[position:top,bottom]\",\n \"tabs-unmeasured:data-selected:before:bg-[image:linear-gradient(var(--default-border-color),var(--default-border-color)),linear-gradient(var(--default-border-color),var(--default-border-color))]\",\n ],\n },\n colored: {\n true: \"data-selected:text-(--c-text)\",\n false: \"data-selected:text-brand-950 dark:data-selected:text-white\",\n },\n // An even share of the list per trigger, like a tab bar. Read from\n // `TabsStyleContext` (set by `List`'s `grow`), not a child selector on\n // the list, so a custom element in the list never grows by accident.\n grow: { true: \"flex-1\" },\n size: {\n xs: \"px-2 py-0.5 text-xs\",\n sm: \"px-2.5 py-1 text-sm\",\n md: \"px-3 py-1.5 text-md\",\n lg: \"px-4 py-2 text-lg\",\n xl: \"px-5 py-2.5 text-xl\",\n },\n },\n // The static bar's color, chosen once per case like the indicator's.\n // Uncolored, `currentColor` is the selected label's `Text/text-primary`,\n // the same pair the indicator's `Border/border-full` bar paints.\n compoundVariants: [\n {\n variant: \"underline\",\n colored: false,\n className: \"tabs-unmeasured:data-selected:after:bg-current\",\n },\n {\n variant: \"underline\",\n colored: true,\n className: \"tabs-unmeasured:data-selected:after:bg-(--c-solid)\",\n },\n ],\n defaultVariants: { variant: \"underline\", colored: false, size: \"md\" },\n },\n)\n\n/**\n * The sliding indicator. It always covers the active trigger's rect, shifted\n * one pixel outward so its edge lands *on* the baseline row rather than beside\n * it (down when horizontal; toward the inline end when vertical, which is the\n * left edge under RTL, hence the `ltr:`/`rtl:` pair — `translate` has no\n * logical form).\n *\n * - `underline`: the 2px bar is the box's own block-end (or inline-end)\n * border, so one rect drives both axes and logical borders handle RTL. It\n * paints `--c-solid` with a `color`, and Figma's `Border/border-full`\n * (the selected label's `Text/text-primary` pair) without one.\n * - `enclosed`: a hairline box open on the baseline side. The baseline is\n * drawn by the box itself, as two 1px segments (`::before` / `::after`)\n * running from its corners out past both ends of the list, which clips them\n * (`tabsList`). So the line is open exactly under the active tab and the gap\n * slides with it, without painting over anything: an opaque patch over a\n * list-drawn baseline would have to guess the surface color, and showed as\n * a dark hole on a translucent `Card` or a colored one. Each segment starts\n * one pixel past the box's side border so the two never overlap (the\n * hairline is translucent, and an overlap would darken the corner pixel).\n * `100vmax` is \"longer than any list\": the clip trims it.\n */\nconst tabsIndicator = cva(\n [\n \"z-0 box-border\",\n // The slide's duration, read by the inline `transition-duration` (see\n // `Indicator`); reduced motion zeroes it, so the bar jumps instead.\n \"[--indicator-duration:var(--duration-normal)] motion-reduce:[--indicator-duration:0s]\",\n // Ark measures with offsetLeft/offsetWidth, which round to whole pixels.\n // On the cross axis every trigger fills the list, so pin it to the list's\n // exact box instead: a vertical list is often a fractional width, and the\n // rounded rect pushed the baseline half a pixel off the list's edge (and\n // off the static copy the SSR HTML draws).\n \"data-[orientation=horizontal]:[--tabs-top:0px] data-[orientation=horizontal]:[--tabs-height:100%]\",\n \"data-[orientation=vertical]:[--tabs-left:0px] data-[orientation=vertical]:[--tabs-width:100%]\",\n \"data-[orientation=horizontal]:translate-y-px\",\n \"data-[orientation=vertical]:ltr:translate-x-px data-[orientation=vertical]:rtl:-translate-x-px\",\n ],\n {\n variants: {\n variant: {\n underline:\n \"data-[orientation=horizontal]:border-b-2 data-[orientation=vertical]:border-e-2\",\n enclosed: [\n \"border border-brand-900/20 dark:border-white/15\",\n \"before:absolute before:bg-brand-900/20 dark:before:bg-white/15\",\n \"after:absolute after:bg-brand-900/20 dark:after:bg-white/15\",\n \"data-[orientation=horizontal]:rounded-t-xs data-[orientation=horizontal]:border-b-0\",\n \"data-[orientation=horizontal]:before:bottom-0 data-[orientation=horizontal]:before:right-[calc(100%+1px)] data-[orientation=horizontal]:before:h-px data-[orientation=horizontal]:before:w-[100vmax]\",\n \"data-[orientation=horizontal]:after:bottom-0 data-[orientation=horizontal]:after:left-[calc(100%+1px)] data-[orientation=horizontal]:after:h-px data-[orientation=horizontal]:after:w-[100vmax]\",\n \"data-[orientation=vertical]:rounded-s-xs data-[orientation=vertical]:border-e-0\",\n \"data-[orientation=vertical]:before:end-0 data-[orientation=vertical]:before:bottom-[calc(100%+1px)] data-[orientation=vertical]:before:w-px data-[orientation=vertical]:before:h-[100vmax]\",\n \"data-[orientation=vertical]:after:end-0 data-[orientation=vertical]:after:top-[calc(100%+1px)] data-[orientation=vertical]:after:w-px data-[orientation=vertical]:after:h-[100vmax]\",\n ],\n },\n colored: { true: \"\", false: \"\" },\n },\n // The bar's color is chosen in exactly one place per case: with both a\n // neutral border color and `border-(--c-solid)` in the list,\n // tailwind-merge can't tell that a bare `border-(--var)` is a color (it\n // could be a width), keeps both, and the stylesheet's order picks one.\n compoundVariants: [\n {\n variant: \"underline\",\n colored: false,\n className: \"border-brand-950 dark:border-white\",\n },\n { variant: \"underline\", colored: true, className: \"border-(--c-solid)\" },\n ],\n defaultVariants: { variant: \"underline\", colored: false },\n },\n)\n\n/** The root. Vertical tabs put the list *beside* the panels, so the baseline\n * on the list's inline-end edge runs between the two; horizontal stays a\n * plain block, list over panel. */\nconst tabsRoot = \"data-[orientation=vertical]:flex\"\n\n/** The content panel, spaced off the baseline: below it when horizontal,\n * after it (and filling the rest of the row) when vertical. Ark makes the\n * active panel focusable (roving from its trigger), so it gets its own focus\n * ring, matching the kit-wide convention. */\nconst tabsContent = cn(\n \"rounded-xs data-[orientation=horizontal]:mt-3\",\n \"data-[orientation=vertical]:ms-4 data-[orientation=vertical]:min-w-0 data-[orientation=vertical]:flex-1\",\n focusStyles(),\n)\n\nexport type TabsVariant = NonNullable<VariantProps<typeof tabsList>[\"variant\"]>\n\n/** Shared strip configuration, set once on `List` and read by `Trigger` and\n * `Indicator` so callers don't repeat `variant` / `size` on every trigger.\n *\n * `color` is *this* list's own palette, never an ancestor's: an ancestor's\n * `data-color` (a colored `Card` around the tabs) must not turn the selected\n * label and the bar into that palette, so \"is it colored\" can't be a\n * `[data-color]` selector — it is whether a `color` was passed here or on\n * the trigger.\n *\n * `colors` maps each trigger's value to its own `color`, for the triggers\n * that set one. `Indicator` reads it to paint itself in the selected tab's\n * palette. Triggers write it through `setTriggerColor` from an effect, so\n * the map is empty during SSR and the first client render; that is\n * harmless, because Ark keeps the indicator `hidden` until it has measured\n * the selected trigger, which also happens in an effect, after the\n * triggers' own (children's effects run first). */\ntype TabsStyle = {\n variant: TabsVariant\n size: Size\n grow: boolean\n color: Color | undefined\n colors: Readonly<Record<string, Color>>\n setTriggerColor: (value: string, color: Color | undefined) => void\n}\n\nconst TabsStyleContext = createContext<TabsStyle>({\n variant: \"underline\",\n size: \"md\",\n grow: false,\n color: undefined,\n colors: {},\n setTriggerColor: () => {},\n})\n\n/** `color` is deliberately omitted, not merely absent: React's `HTMLAttributes`\n * carries a legacy `color?: string`, so without the `Omit` a stale\n * `<Tabs.Root color=\"brand\">` would still compile and fall through `...rest`\n * onto the div as the deprecated HTML attribute — silently losing the palette.\n * Omitting it turns every such call site into a compile error pointing at the\n * line to change. Same convention as `Button` / `ActionIcon` (code-style.md). */\nexport type TabsRootProps = Omit<Ark.RootProps, \"color\"> & WithTestId\n\nconst Root = ({ orientation = \"horizontal\", className, testId, ...rest }: TabsRootProps) => {\n const checkDirection = useDirectionCheck()\n return (\n // `key={orientation}` remounts on an axis flip so Ark re-measures the\n // indicator rect for the new layout (it only measures on mount + value\n // change, mirroring the same limitation `SegmentGroup` works around) — at\n // the cost of resetting an *uncontrolled* value on that flip. Pass a\n // controlled `value` if the orientation can change at runtime and the\n // selection must survive it.\n <Ark.Root\n key={orientation}\n orientation={orientation}\n ref={checkDirection}\n className={cn(tabsRoot, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type TabsListProps = Omit<Ark.ListProps, \"color\"> &\n WithTestId & {\n variant?: TabsVariant\n size?: Size\n /** Palette for the underline bar + active-trigger text. Sets `data-color`\n * on the list, so the `--c-*` slots reach the triggers and the indicator\n * without reaching the `Content` panels. */\n color?: Color\n /** Give every trigger an even share of the list's width (its height when\n * vertical), like a tab bar. Without it the triggers hug their labels. */\n grow?: boolean\n }\n\nconst List = ({\n variant = \"underline\",\n size = \"md\",\n grow = false,\n color,\n className,\n testId,\n ...rest\n}: TabsListProps) => {\n const [colors, setColors] = useState<Readonly<Record<string, Color>>>({})\n const setTriggerColor = useCallback((value: string, triggerColor: Color | undefined) => {\n setColors((prev) => {\n if (prev[value] === triggerColor) return prev\n const { [value]: _dropped, ...others } = prev\n return triggerColor === undefined ? others : { ...others, [value]: triggerColor }\n })\n }, [])\n const style = useMemo(\n () => ({ variant, size, grow, color, colors, setTriggerColor }),\n [variant, size, grow, color, colors, setTriggerColor],\n )\n return (\n <TabsStyleContext.Provider value={style}>\n <Ark.List\n className={cn(tabsList({ variant, size }), className)}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </TabsStyleContext.Provider>\n )\n}\n\n/** `color` is omitted from Ark's props for the same reason as on `Root`\n * (React's legacy HTML `color?: string`) and re-added as the kit's palette. */\nexport type TabsTriggerProps = Omit<Ark.TriggerProps, \"color\"> &\n WithTestId & {\n /** This tab's own palette for its selected label and, while it is\n * selected, the indicator. Beats `List`'s `color`. Sets `data-color` on\n * the trigger only, so it never reaches the panels. */\n color?: Color\n }\n\nconst Trigger = ({ color, className, testId, ...rest }: TabsTriggerProps) => {\n const { variant, size, grow, color: listColor, setTriggerColor } = useContext(TabsStyleContext)\n const { value } = rest\n useEffect(() => {\n setTriggerColor(value, color)\n return () => setTriggerColor(value, undefined)\n }, [value, color, setTriggerColor])\n return (\n <Ark.Trigger\n className={cn(\n tabsTrigger({ variant, size, grow, colored: (color ?? listColor) !== undefined }),\n className,\n )}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = Ark.ContentProps & WithTestId\n\nconst Content = ({ className, testId, ...rest }: TabsContentProps) => (\n <Ark.Content\n className={cn(tabsContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TabsIndicatorProps = Ark.IndicatorProps & WithTestId\n\n/** The sliding indicator. Ark sets `position: absolute` + `--left`/`--top`/\n * `--width`/`--height` (the selected trigger's rect) inline, so it sits\n * behind the labels (`z-0`). Ark only places the main axis (`left` when\n * horizontal, `top` when vertical) and leaves the other at its static\n * position; we pin both, because the box must line up with the trigger's\n * edge on the baseline side, not wherever the flow happens to put it.\n *\n * We drive the slide transition ourselves rather than via Ark's gated\n * `animateIndicator` flag — the same fix `SegmentGroup` uses: Ark sets\n * `transition-property: none` whenever that flag is false, including the\n * instant it receives the `transitionend` of ANY animated property. With\n * several properties of differing end-times (a `left` redirected by an\n * interrupting click vs. a color/width that already settled), that early end\n * would null the transition and snap the indicator mid-slide. Overriding the real\n * `transition-*` props (our `style` wins via Ark's `mergeProps`) keeps the\n * transition always on, so interruptions re-target smoothly.\n *\n * The duration is read from `--indicator-duration` rather than written inline,\n * so the `motion-reduce:` class on `tabsIndicator` can zero it: an inline value\n * would beat any class, and the slide would play under reduced motion. */\nconst Indicator = ({ className, style, testId, ...rest }: TabsIndicatorProps) => {\n const { variant, color: listColor, colors } = useContext(TabsStyleContext)\n const { value } = useTabsContext()\n // The selected tab's own color, else the list's. Set as the indicator's own\n // `data-color` so its `--c-*` slots switch with the selection, and the\n // `border-color` transition below cross-fades the bar as it slides.\n const color = (value ? colors[value] : undefined) ?? listColor\n return (\n <Ark.Indicator\n data-color={color}\n style={{\n left: \"var(--tabs-left, var(--left))\",\n top: \"var(--tabs-top, var(--top))\",\n width: \"var(--tabs-width, var(--width))\",\n height: \"var(--tabs-height, var(--height))\",\n transitionProperty: \"left, top, width, height, background-color, border-color\",\n transitionDuration: \"var(--indicator-duration)\",\n transitionTimingFunction: \"var(--ease-emphasized)\",\n ...style,\n }}\n className={cn(tabsIndicator({ variant, colored: color !== undefined }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport { Content, Indicator, List, Root, Trigger }\nexport const Context = Ark.Context\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport type { Color } from \"../../lib/colors\"\nimport type { Size } from \"../../lib/sizes\"\nimport {\n Content,\n Context,\n Indicator,\n List,\n Root,\n type TabsRootProps,\n type TabsVariant,\n Trigger,\n} from \"./tabs\"\n\n/**\n * Data-driven Tabs — the convenience wrapper over the composable parts, for\n * the common case of a flat list of label + panel pairs:\n *\n * <Tabs\n * data={[\n * { value: \"overview\", label: \"Overview\", content: <Overview /> },\n * { value: \"activity\", label: \"Activity\", content: <Activity /> },\n * ]}\n * />\n *\n * Generic over `const data`, so an item's `value` narrows `onChange`. The\n * first item is selected by default when neither `value` nor `defaultValue`\n * is given — the low-level `Root` part has no `data` to default from, so this\n * only happens here. Drop to `Tabs.Root` / `Tabs.List` / `Tabs.Trigger` /\n * `Tabs.Content` for anything the flat array can't express (custom trigger\n * content, interleaved non-tab elements, …).\n */\n\n/** One tab: a trigger label and its panel content. */\nexport type TabsItem = {\n value: string\n label: ReactNode\n content: ReactNode\n disabled?: boolean\n /** This tab's own palette: its selected label, and the underline bar while\n * it is selected. Beats the `color` prop. */\n color?: Color\n /** `data-testid` on the trigger; the matching content panel gets\n * `` `${testId}-panel` ``. Defaults to `` `tab-${value}` `` / `` `tab-${value}-panel` ``\n * when omitted. Ark's own `data-value={value}` is also always present on the\n * trigger as a complementary, zero-config selector. */\n testId?: string\n}\n\n/** The `data` array `Tabs` is generic over. */\nexport type TabsData = ReadonlyArray<TabsItem>\n\n/** Extract the value-string union from a `TabsData` shape, for a typed `onChange`. */\nexport type TabsValue<Data extends TabsData> = Data[number][\"value\"]\n\nexport type TabsProps<Data extends TabsData = TabsData> = Omit<\n TabsRootProps,\n \"children\" | \"onValueChange\" | \"onChange\" | \"asChild\"\n> &\n ForbidAsChild & {\n /** Tabs, in order. Each needs its own `content`. */\n data: Data\n /** `underline` (default): a bar under the active tab. `enclosed`: the\n * active tab is a box attached to its panel. */\n variant?: TabsVariant\n /** Trigger size. */\n size?: Size\n /** Palette for the underline bar + active-trigger text. Scoped to the\n * strip (it lands on the `List`), so it never tints the panel content. */\n color?: Color\n /** Give every tab an even share of the strip, like a tab bar. Lands on the\n * `List`. */\n grow?: boolean\n /** Fires with the selected value (narrowed to the data value union). */\n onChange?: (value: TabsValue<Data>) => void\n }\n\nconst TabsComponent = <const Data extends TabsData>({\n data,\n variant,\n size,\n color,\n grow,\n value,\n defaultValue,\n onChange,\n asChild: _asChild,\n ...root\n}: TabsProps<Data>) => (\n <Root\n value={value}\n defaultValue={defaultValue ?? data[0]?.value}\n onValueChange={onChange ? (d) => onChange(d.value as TabsValue<Data>) : undefined}\n {...root}\n >\n <List variant={variant} size={size} color={color} grow={grow}>\n <Indicator />\n {data.map((item) => (\n <Trigger\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n color={item.color}\n testId={item.testId ?? `tab-${item.value}`}\n >\n {item.label}\n </Trigger>\n ))}\n </List>\n {data.map((item) => (\n <Content\n key={item.value}\n value={item.value}\n testId={`${item.testId ?? `tab-${item.value}`}-panel`}\n >\n {item.content}\n </Content>\n ))}\n </Root>\n)\n\n/**\n * The public `Tabs` export — callable for the data-driven form, with the\n * composable parts attached (like `Menu`). `<Tabs data={…}>` and\n * `<Tabs.Root>…</Tabs.Root>` both work from one import.\n */\nexport const Tabs = Object.assign(TabsComponent, {\n Root,\n List,\n Trigger,\n Content,\n Indicator,\n Context,\n})\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SegmentGroup } from './chunk-
|
|
2
|
-
import { NumberInput } from './chunk-
|
|
1
|
+
import { SegmentGroup } from './chunk-NF2PBGD3.js';
|
|
2
|
+
import { NumberInput } from './chunk-SBZJGFZ6.js';
|
|
3
3
|
import { cn } from './chunk-4ASNIDV7.js';
|
|
4
4
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -246,5 +246,5 @@ var TimeRow = ({
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
export { TimeRow, dayPeriodLabels, fromDisplayHour, is12Hour, resolveHourCycle, timeRowMinWidth, toDisplayHour };
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-ULF5LOBS.js.map
|
|
250
|
+
//# sourceMappingURL=chunk-ULF5LOBS.js.map
|