@42-central/ui-react 0.20.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/{chunk-45QRQKRC.js → chunk-3L5GLI67.js} +12 -8
  2. package/dist/chunk-3L5GLI67.js.map +1 -0
  3. package/dist/{chunk-BNWQ7IAZ.js → chunk-4FEOMQYR.js} +5 -5
  4. package/dist/{chunk-BNWQ7IAZ.js.map → chunk-4FEOMQYR.js.map} +1 -1
  5. package/dist/{chunk-POKLPMSB.js → chunk-D3JYDAUZ.js} +3 -3
  6. package/dist/{chunk-POKLPMSB.js.map → chunk-D3JYDAUZ.js.map} +1 -1
  7. package/dist/{chunk-KMZENCEP.js → chunk-DHJB4UJD.js} +4 -4
  8. package/dist/{chunk-KMZENCEP.js.map → chunk-DHJB4UJD.js.map} +1 -1
  9. package/dist/{chunk-IOYZC7SA.js → chunk-DJAXXLN6.js} +3 -3
  10. package/dist/{chunk-IOYZC7SA.js.map → chunk-DJAXXLN6.js.map} +1 -1
  11. package/dist/{chunk-3BXKTWWD.js → chunk-FB2G4LNH.js} +5 -5
  12. package/dist/{chunk-3BXKTWWD.js.map → chunk-FB2G4LNH.js.map} +1 -1
  13. package/dist/{chunk-E63VD25L.js → chunk-HQPU73WV.js} +4 -4
  14. package/dist/{chunk-E63VD25L.js.map → chunk-HQPU73WV.js.map} +1 -1
  15. package/dist/{chunk-RCF7HTG5.js → chunk-IRNF274I.js} +5 -5
  16. package/dist/chunk-IRNF274I.js.map +1 -0
  17. package/dist/{chunk-O5W3QWJ6.js → chunk-J44FJ7PH.js} +3 -3
  18. package/dist/{chunk-O5W3QWJ6.js.map → chunk-J44FJ7PH.js.map} +1 -1
  19. package/dist/{chunk-TWLJQE75.js → chunk-MRAJ45IM.js} +4 -4
  20. package/dist/{chunk-TWLJQE75.js.map → chunk-MRAJ45IM.js.map} +1 -1
  21. package/dist/{chunk-5HUEBSIS.js → chunk-N66NC6QK.js} +120 -24
  22. package/dist/chunk-N66NC6QK.js.map +1 -0
  23. package/dist/{chunk-SXNAUSEB.js → chunk-OZMSXYBX.js} +4 -4
  24. package/dist/{chunk-SXNAUSEB.js.map → chunk-OZMSXYBX.js.map} +1 -1
  25. package/dist/{chunk-LBAE6FP6.js → chunk-SZEOTXRZ.js} +4 -4
  26. package/dist/{chunk-LBAE6FP6.js.map → chunk-SZEOTXRZ.js.map} +1 -1
  27. package/dist/chunk-V6PY7C6S.js +18 -0
  28. package/dist/chunk-V6PY7C6S.js.map +1 -0
  29. package/dist/{chunk-MKKQE3TM.js → chunk-YPFSRZ3T.js} +4 -4
  30. package/dist/{chunk-MKKQE3TM.js.map → chunk-YPFSRZ3T.js.map} +1 -1
  31. package/dist/{chunk-NJPHZBLI.js → chunk-YWTOW7PZ.js} +5 -5
  32. package/dist/{chunk-NJPHZBLI.js.map → chunk-YWTOW7PZ.js.map} +1 -1
  33. package/dist/{chunk-VTDBWU6H.js → chunk-YZJUPYPO.js} +3 -3
  34. package/dist/{chunk-VTDBWU6H.js.map → chunk-YZJUPYPO.js.map} +1 -1
  35. package/dist/components/autocomplete/index.js +4 -3
  36. package/dist/components/autocomplete/index.js.map +1 -1
  37. package/dist/components/calendar-heatmap/calendar-heatmap-grid.d.ts +94 -0
  38. package/dist/components/calendar-heatmap/calendar-heatmap-grid.d.ts.map +1 -0
  39. package/dist/components/calendar-heatmap/calendar-heatmap.d.ts +76 -0
  40. package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -0
  41. package/dist/components/calendar-heatmap/index.d.ts +2 -0
  42. package/dist/components/calendar-heatmap/index.d.ts.map +1 -0
  43. package/dist/components/calendar-heatmap/index.js +311 -0
  44. package/dist/components/calendar-heatmap/index.js.map +1 -0
  45. package/dist/components/camera/index.js +6 -5
  46. package/dist/components/clipboard/index.js +1 -1
  47. package/dist/components/code-block/chrome.js +4 -4
  48. package/dist/components/code-block/index.js +5 -5
  49. package/dist/components/combobox/index.js +4 -3
  50. package/dist/components/combobox-list/index.js +6 -5
  51. package/dist/components/data-table/index.js +16 -16
  52. package/dist/components/date-picker/index.js +7 -6
  53. package/dist/components/date-picker/index.js.map +1 -1
  54. package/dist/components/hover-card/hover-card.d.ts +44 -26
  55. package/dist/components/hover-card/hover-card.d.ts.map +1 -1
  56. package/dist/components/hover-card/index.js +35 -53
  57. package/dist/components/hover-card/index.js.map +1 -1
  58. package/dist/components/input/index.js +1 -1
  59. package/dist/components/input/input.d.ts.map +1 -1
  60. package/dist/components/menu/index.js +3 -3
  61. package/dist/components/menu/menu.d.ts +7 -5
  62. package/dist/components/menu/menu.d.ts.map +1 -1
  63. package/dist/components/multi-combobox-list/index.js +6 -5
  64. package/dist/components/multi-select/index.js +5 -4
  65. package/dist/components/multi-select/index.js.map +1 -1
  66. package/dist/components/navigation-progress/index.d.ts +2 -0
  67. package/dist/components/navigation-progress/index.d.ts.map +1 -0
  68. package/dist/components/navigation-progress/index.js +133 -0
  69. package/dist/components/navigation-progress/index.js.map +1 -0
  70. package/dist/components/navigation-progress/navigation-progress.d.ts +46 -0
  71. package/dist/components/navigation-progress/navigation-progress.d.ts.map +1 -0
  72. package/dist/components/number-input/index.js +4 -3
  73. package/dist/components/number-input/number-input.d.ts.map +1 -1
  74. package/dist/components/password-input/index.js +1 -1
  75. package/dist/components/photo-capture/index.js +6 -5
  76. package/dist/components/photo-capture/index.js.map +1 -1
  77. package/dist/components/pills-input/index.js +2 -2
  78. package/dist/components/pin-input/index.js +1 -1
  79. package/dist/components/popover/index.d.ts +1 -1
  80. package/dist/components/popover/index.d.ts.map +1 -1
  81. package/dist/components/popover/index.js +2 -1
  82. package/dist/components/popover/popover.d.ts +44 -29
  83. package/dist/components/popover/popover.d.ts.map +1 -1
  84. package/dist/components/schedule/index.js +2 -2
  85. package/dist/components/select/index.js +5 -4
  86. package/dist/components/spotlight/index.js +5 -4
  87. package/dist/components/spotlight/index.js.map +1 -1
  88. package/dist/components/tags-input/index.js +4 -3
  89. package/dist/components/tags-input/index.js.map +1 -1
  90. package/dist/components/text-input/index.js +1 -1
  91. package/dist/components/textarea/index.js +1 -1
  92. package/dist/components/time-input/index.js +5 -4
  93. package/dist/components/time-input/index.js.map +1 -1
  94. package/dist/components/tooltip/index.js +2 -2
  95. package/dist/components/tree-multi-select/index.js +5 -4
  96. package/dist/components/tree-multi-select/index.js.map +1 -1
  97. package/dist/components/tree-select/index.js +4 -3
  98. package/dist/components/tree-select/index.js.map +1 -1
  99. package/dist/index.js +2 -2
  100. package/dist/lib/placement.d.ts +42 -1
  101. package/dist/lib/placement.d.ts.map +1 -1
  102. package/dist/lib/slide-on-switch.d.ts +69 -0
  103. package/dist/lib/slide-on-switch.d.ts.map +1 -0
  104. package/package.json +1 -1
  105. package/src/as-child.contract.test.tsx +4 -0
  106. package/src/components/calendar-heatmap/calendar-heatmap-grid.test.ts +186 -0
  107. package/src/components/calendar-heatmap/calendar-heatmap-grid.ts +192 -0
  108. package/src/components/calendar-heatmap/calendar-heatmap.test.tsx +180 -0
  109. package/src/components/calendar-heatmap/calendar-heatmap.tsx +385 -0
  110. package/src/components/calendar-heatmap/index.ts +11 -0
  111. package/src/components/hover-card/hover-card.tsx +89 -167
  112. package/src/components/input/input.test.tsx +23 -0
  113. package/src/components/input/input.tsx +10 -6
  114. package/src/components/menu/menu.tsx +16 -9
  115. package/src/components/navigation-progress/index.ts +14 -0
  116. package/src/components/navigation-progress/navigation-progress.test.tsx +184 -0
  117. package/src/components/navigation-progress/navigation-progress.tsx +228 -0
  118. package/src/components/number-input/number-input.tsx +3 -4
  119. package/src/components/popover/index.ts +2 -0
  120. package/src/components/popover/popover.test.tsx +131 -0
  121. package/src/components/popover/popover.tsx +191 -53
  122. package/src/lib/placement.test.ts +37 -0
  123. package/src/lib/placement.ts +60 -1
  124. package/src/lib/slide-on-switch.ts +99 -0
  125. package/dist/chunk-45QRQKRC.js.map +0 -1
  126. package/dist/chunk-5HUEBSIS.js.map +0 -1
  127. package/dist/chunk-G52U24GR.js +0 -10
  128. package/dist/chunk-G52U24GR.js.map +0 -1
  129. package/dist/chunk-RCF7HTG5.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/tree-data.ts","../src/components/tree-select/tree-popover.tsx"],"names":["Fragment"],"mappings":";;;;;;;;;;;;;AAyGO,IAAM,MAAA,GAAS,CAAC,IAAA,KAAgC,CAAC,KAAK,QAAA,IAAY,IAAA,CAAK,SAAS,MAAA,KAAW;AAG3F,IAAM,SAAA,GAAY,CAAI,KAAA,KAA0C;AACrE,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAoB;AACzC,EAAA,MAAM,OAAA,uBAAc,GAAA,EAA6B;AACjD,EAAA,MAAM,IAAA,GAAO,CAAC,EAAA,KAAuC;AACnD,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,QAAA,CAAS,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,KAAK,CAAA;AAC7B,MAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAC,CAAA;AACtB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,IAAA,CAAK,CAAA,CAAE,QAAQ,CAAA;AAAA,IACjC;AAAA,EACF,CAAA;AACA,EAAA,IAAA,CAAK,KAAK,CAAA;AACV,EAAA,OAAO,EAAE,UAAU,OAAA,EAAQ;AAC7B;AAGO,IAAM,cAAc,CACzB,KAAA,EACA,iBAAA,EACA,GAAA,GAA8C,EAAC,KACJ;AAC3C,EAAA,KAAA,MAAW,KAAK,KAAA,EAAO;AACrB,IAAA,MAAM,YAAA,GAAe,iBAAA,IAAqB,CAAC,CAAC,CAAA,CAAE,QAAA;AAC9C,IAAA,GAAA,CAAI,KAAK,EAAE,KAAA,EAAO,EAAE,KAAA,EAAO,QAAA,EAAU,cAAc,CAAA;AACnD,IAAA,IAAI,EAAE,QAAA,EAAU,WAAA,CAAY,CAAA,CAAE,QAAA,EAAU,cAAc,GA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e;AACrB,UAAA,WAAA,CAAY,MAAM,GAAG,CAAA;AAAA,QACvB;AAAA;AACJ,EACF,CAAA;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAC,KAAA,KAA2C;AAClE,IAAA,IAAI,KAAA,CAAM,QAAQ,WAAA,EAAa;AAC7B,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,IACpB;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,MAAmB;AAAA,IACnC,GAAA,EAAK,CAAC,EAAA,KAA2B;AAC/B,MAAA,IAAI,EAAA,EAAI,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,WAChC,OAAA,CAAQ,OAAA,CAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,KAAA,KAAU,aAAa;AAAA,GACnD,CAAA;AAEA,EAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,SAAA,EAAW,QAAA,EAAU,eAAe,eAAA,EAAgB;AAC5F","file":"chunk-TWLJQE75.js","sourcesContent":["/**\n * Shared tree model + pure helpers for the hierarchical pickers (TreeSelect,\n * TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;\n * a node with `children` is a *branch*, one without is a *leaf*. These helpers\n * are selection-agnostic — the single / multi cascade logic lives in each\n * component (mirrors `lib/select-data.ts` for the flat pickers).\n *\n * A node may carry an arbitrary, optional `payload`. Selection ignores it\n * (value / label / disabled drive everything) but it flows through to a tree\n * picker's `renderItem` as `node.payload`.\n */\n\nimport type { ReactNode } from \"react\"\nimport type { LabelSearch } from \"./select-data\"\n\nexport type TreeNodeData<P = unknown> = {\n value: string\n label: string\n disabled?: boolean\n children?: TreeNodeData<P>[]\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered row. Defaults to `` `item-${value}` `` —\n * set it explicitly when `value` isn't a safe/stable test selector on its\n * own. Unlike the Ark-machine-backed pickers, this tree is hand-rolled, so\n * there's no free `data-part` / `data-value` here — `testId` is the row's\n * only stable selector. */\n testId?: string\n}\n\n/**\n * A tree picker's `data` shape. Not generic over the node payload here (a\n * component generic over both `Data` and `P` independently defeats payload\n * inference — see `TreePayload` below); `TreeNodeData`'s own `P` still drives\n * autocomplete, extracted structurally from `Data` when needed.\n */\nexport type TreeSelectData = ReadonlyArray<TreeNodeData>\n\n/**\n * Extract the literal value union from a tree of `TreeNodeData` — the tree\n * analogue of `lib/select-data.ts`'s `SelectValue`, walking every node's\n * `value` plus its `children` (recursively) so a `const`-typed `data` prop\n * narrows `value` / `onChange` to the tree's actual node values instead of\n * plain `string`.\n */\nexport type TreeValue<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodeValue<Nodes[number]>\n\ntype TreeNodeValue<N> = N extends TreeNodeData\n ?\n | N[\"value\"]\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreeValue<N[\"children\"]> : never)\n : never\n\n/**\n * Extract the `payload` type carried by a tree — read structurally off every\n * node's own `payload` property (robust against generic-instantiation\n * inference, same approach as `lib/select-data.ts`'s `SelectPayload`),\n * recursing into `children`. Payload-less nodes contribute `never`; a\n * homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type TreePayload<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodePayload<Nodes[number]>\n\ntype TreeNodePayload<N> = N extends TreeNodeData\n ?\n | (N extends { payload: infer P } ? P : never)\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreePayload<N[\"children\"]> : never)\n : never\n\n/**\n * Live node state passed alongside the node to a tree picker's `renderItem`.\n * `depth` is 0-based (the row renders `aria-level={depth + 1}`); `leaf`\n * distinguishes selectable leaves from organizational branches.\n */\nexport type TreeSelectItemState = {\n selected: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/** Tri-state variant for `TreeMultiSelect` — branches cascade to `indeterminate`. */\nexport type TreeMultiSelectItemState = {\n checked: boolean\n indeterminate: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/**\n * Render a node's content yourself. The component keeps owning the row\n * (treeitem role, indent rails, roving focus, click); the callback fills the\n * content after the rails and receives the node (including its typed `payload`).\n * In an RSC tree the function must live in a `\"use client\"` module so the\n * boundary serializes it as a client reference.\n */\nexport type RenderTreeSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeSelectItemState,\n) => ReactNode\nexport type RenderTreeMultiSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeMultiSelectItemState,\n) => ReactNode\n\nexport const isLeaf = (node: TreeNodeData): boolean => !node.children || node.children.length === 0\n\n/** value → label (trigger display) and value → node (toggling from keyboard / filtered rows). */\nexport const buildMaps = <P>(nodes: ReadonlyArray<TreeNodeData<P>>) => {\n const labelMap = new Map<string, string>()\n const nodeMap = new Map<string, TreeNodeData<P>>()\n const walk = (ns: ReadonlyArray<TreeNodeData<P>>) => {\n for (const n of ns) {\n labelMap.set(n.value, n.label)\n nodeMap.set(n.value, n)\n if (n.children) walk(n.children)\n }\n }\n walk(nodes)\n return { labelMap, nodeMap }\n}\n\n/** Pre-order list of node values + inherited-disabled flag — drives roving focus. */\nexport const flattenTree = (\n nodes: ReadonlyArray<TreeNodeData>,\n inheritedDisabled: boolean,\n acc: { value: string; disabled: boolean }[] = [],\n): { value: string; disabled: boolean }[] => {\n for (const n of nodes) {\n const nodeDisabled = inheritedDisabled || !!n.disabled\n acc.push({ value: n.value, disabled: nodeDisabled })\n if (n.children) flattenTree(n.children, nodeDisabled, acc)\n }\n return acc\n}\n\n/**\n * Keep nodes whose label (or a descendant's) matches `query`; preserves ancestors.\n * `matches` is the pickers' shared locale-aware search (`useLabelSearch().matches`), passed in\n * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.\n */\nexport const filterTree = <P>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n query: string,\n matches: LabelSearch[\"matches\"],\n): TreeNodeData<P>[] => {\n if (!query.trim()) return nodes as TreeNodeData<P>[]\n const recurse = (ns: ReadonlyArray<TreeNodeData<P>>): TreeNodeData<P>[] => {\n const out: TreeNodeData<P>[] = []\n for (const n of ns) {\n const selfMatch = matches(n.label, query)\n if (isLeaf(n)) {\n if (selfMatch) out.push(n)\n } else if (selfMatch) {\n out.push(n) // branch matches → keep its full subtree\n } else if (n.children) {\n const kids = recurse(n.children)\n if (kids.length > 0) out.push({ ...n, children: kids })\n }\n }\n return out\n }\n return recurse(nodes)\n}\n","\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentProps,\n Fragment,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { ClearSectionMode } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { TreeNodeData } from \"../../lib/tree-data\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\nimport { inputControlClasses, inputSlot } from \"../input/input\"\nimport { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from \"../popover/popover\"\n\n/**\n * The internals `TreeSelect` and `TreeMultiSelect` share: the row styles, the\n * indent rails, the combobox trigger, the search header, the tree body and the\n * roving focus (arrows, Home / End, type-ahead). Each picker keeps only what\n * differs: what a row shows, and what activating one does.\n */\n\n/** Indent guide / connector colour, shared by rails and the elbow. */\nconst treeLine = \"bg-brand-900/20 dark:bg-white/15\"\n\n/**\n * One tree row. `interactive` rows (every TreeMultiSelect row, TreeSelect's\n * leaves) take roving focus and hover/active surfaces: neutral and\n * transparent, a low-opacity black/white wash rather than an opaque gray,\n * matching the popover surface's own background-dependent tint (no Figma\n * reference for this state yet). The others are TreeSelect's branches:\n * organizational, present for structure and levels, never focused.\n */\nexport const treeRow = cva(\n [\"group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none\"],\n {\n variants: {\n size: {\n xs: \"min-h-7 pe-1.5 text-xs\",\n sm: \"min-h-8 pe-2 text-sm\",\n md: \"min-h-9 pe-2 text-md\",\n lg: \"min-h-10 pe-2.5 text-lg\",\n xl: \"min-h-11 pe-3 text-xl\",\n },\n interactive: {\n true: [\n \"cursor-pointer\",\n TEXT_COLOR_CLASSES.primary,\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n \"data-active:bg-black/5 dark:data-active:bg-white/8\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n // Palette, not brand: the focused row is also the active one, and brand-500\n // measured 2.73:1 against that light fill. `--c-text` (the popover's\n // `data-color`, neutral by default) clears it in both themes.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n ],\n false: [\"cursor-default font-medium\", TEXT_COLOR_CLASSES.secondary],\n },\n },\n defaultVariants: { size: \"md\", interactive: true },\n },\n)\n\n/** Where a node sits in the rendered tree: what its rails and set position need. */\nexport type TreePosition = {\n /** 0-based; the row renders `aria-level={depth + 1}`. */\n depth: number\n /** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */\n ancestorHasNextSibling: boolean[]\n /** Last among its siblings: the connector stops at the elbow. */\n isLast: boolean\n /** 1-based index among its siblings. */\n posinset: number\n /** Number of siblings, itself included. */\n setsize: number\n}\n\n/**\n * Walk `nodes` depth-first, rendering each through `row` with its position,\n * its subtree flattened right after it: the tree is one flat list of rows,\n * its hierarchy carried by `aria-level` and the rails.\n */\nexport const renderTree = <P,>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,\n depth = 0,\n ancestorHasNextSibling: boolean[] = [],\n): ReactNode =>\n nodes.map((node, i) => {\n const position = {\n depth,\n ancestorHasNextSibling,\n isLast: i === nodes.length - 1,\n posinset: i + 1,\n setsize: nodes.length,\n }\n return (\n <Fragment key={node.value}>\n {row(node, position)}\n {node.children &&\n renderTree(\n node.children,\n row,\n depth + 1,\n depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast],\n )}\n </Fragment>\n )\n })\n\n/** A row's level and set position. The tree renders flat, so the browser can't derive them. */\nexport const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({\n \"aria-level\": depth + 1,\n \"aria-setsize\": setsize,\n \"aria-posinset\": posinset,\n})\n\n/** The indent guides before a row's content. Top-level rows sit flush. */\nexport const TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>\n depth > 0 && (\n <>\n {/* ancestor rails: a vertical guide where that ancestor has a sibling below */}\n {ancestorHasNextSibling.map((hasNext, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.\n <span key={i} aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n {hasNext && <span className={cn(\"absolute inset-y-0 inset-s-1/2 w-px\", treeLine)} />}\n </span>\n ))}\n\n {/* connector: vertical (├ continues / └ stops) + horizontal elbow */}\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={cn(\"absolute inset-s-1/2 top-0 w-px\", treeLine, isLast ? \"h-1/2\" : \"bottom-0\")}\n />\n <span className={cn(\"absolute inset-s-1/2 top-1/2 h-px w-1/2\", treeLine)} />\n </span>\n </>\n )\n\n/** A row's default label, after the rails. */\nexport const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (\n <span className={cn(\"ms-1.5 min-w-0 flex-1 truncate text-start\", className)}>{children}</span>\n)\n\ntype TreeTriggerProps = Omit<ComponentProps<\"div\">, \"role\" | \"tabIndex\" | \"color\"> &\n WithTestId & {\n open: boolean\n disabled?: boolean\n readOnly?: boolean\n invalid: boolean\n color?: Color\n startSlot?: ReactNode\n endSlot?: ReactNode\n /** Clears the value. Omit it to hide the clear button. */\n onClear?: () => void\n clearLabel: string\n clearSectionMode: ClearSectionMode\n icons: { clear: ReactNode; chevron: ReactNode }\n /** Enter, Space or ↓ on the closed trigger. */\n onOpen: () => void\n }\n\n/**\n * The real, focusable `<div role=\"combobox\">`, with its start slot, value\n * (`children`), end slot, clear button and chevron. A component of its own so\n * it reads the `Field` context from *inside* the picker's `FieldShell`: the\n * picker renders that shell, so `useFieldContext()` at its top level would\n * run too early. `Popover.Trigger` stamps its own id on the element, so the\n * `<label for>` never reaches it: the name comes from `aria-labelledby`.\n */\nexport const TreeTrigger = ({\n open,\n disabled,\n readOnly,\n invalid,\n color,\n startSlot,\n endSlot,\n onClear,\n clearLabel,\n clearSectionMode,\n icons,\n onOpen,\n testId,\n children,\n ...rest\n}: TreeTriggerProps) => {\n const field = useFieldContext()\n return (\n <Popover.Trigger asChild>\n <div\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n tabIndex={disabled ? -1 : 0}\n {...fieldA11yProps(field)}\n data-color={color}\n {...props({\n \"aria-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-invalid\": invalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron (and optional clear).\n \"data-with-end-slot\": true,\n // The shell IS the tabbable/focusable element here (no separate\n // inner control to route to), so `testId` lands directly on it.\n \"data-testid\": testId,\n })}\n onKeyDown={(event) => {\n if (disabled || readOnly) return\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault()\n onOpen()\n }\n }}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {onClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onPointerDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={(event) => {\n event.stopPropagation()\n onClear()\n }}\n className={popoverClearTrigger}\n >\n {icons.clear}\n </button>\n )}\n {(clearSectionMode === \"both\" || !onClear) && (\n <span aria-hidden data-chevron className={cn(popoverChevron, open && \"rotate-180\")}>\n {icons.chevron}\n </span>\n )}\n </div>\n </Popover.Trigger>\n )\n}\n\n/** The popover's search field, in its fixed header. */\nexport const TreeSearch = ({\n ref,\n value,\n onChange,\n onKeyDown,\n placeholder,\n label,\n className,\n}: {\n ref: Ref<HTMLInputElement>\n value: string\n onChange: (value: string) => void\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void\n placeholder: string\n label: string\n className?: string\n}) => (\n <Popover.Header>\n <input\n ref={ref}\n type=\"text\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n className={cn(inputControlClasses, \"text-sm\", className)}\n />\n </Popover.Header>\n)\n\n/** The scrolling body: the `role=\"tree\"` list, or `empty` when the search matched nothing. */\nexport const TreeBody = ({\n id,\n isEmpty,\n empty,\n multiselectable,\n onKeyDown,\n children,\n}: {\n id: string\n isEmpty: boolean\n empty: ReactNode\n multiselectable?: boolean\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void\n children: ReactNode\n}) => (\n <Popover.Body>\n {isEmpty ? (\n <div className={popoverEmpty}>{empty}</div>\n ) : (\n <div\n id={id}\n role=\"tree\"\n {...props({ \"aria-multiselectable\": multiselectable && \"true\" })}\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n className=\"flex flex-col\"\n >\n {children}\n </div>\n )}\n </Popover.Body>\n)\n\ntype UseTreeRovingFocusOptions = {\n /** The rows that take focus (enabled, and selectable), in visual order. */\n values: readonly string[]\n /** A row's label, matched by type-ahead. */\n labelOf: (value: string) => string\n open: boolean\n searchable: boolean\n /** Space / Enter on the focused row. */\n onActivate: (value: string) => void\n}\n\n/**\n * Roving focus over a flat-rendered tree. One row is active (`tabIndex=0`,\n * `data-active`); `↑` / `↓` step through `values`, `Home` / `End` jump to\n * either end, `Space` / `Enter` activate, and printable keys type-ahead to the\n * next row whose label starts with what was typed. On open, focus lands in\n * the search field when there is one, on the active row otherwise.\n */\nexport const useTreeRovingFocus = ({\n values,\n labelOf,\n open,\n searchable,\n onActivate,\n}: UseTreeRovingFocusOptions) => {\n const [activeValueState, setActiveValue] = useState<string | null>(null)\n // A row filtered out (or disabled) since it was active falls back to the first.\n const activeValue =\n activeValueState != null && values.includes(activeValueState)\n ? activeValueState\n : (values[0] ?? null)\n\n const searchRef = useRef<HTMLInputElement>(null)\n const rowRefs = useRef(new Map<string, HTMLElement>())\n const focusRow = (next: string | null | undefined) => {\n if (next == null) return\n setActiveValue(next)\n rowRefs.current.get(next)?.focus()\n }\n\n // Type-ahead: typed characters buffer briefly and jump to the next row whose\n // label starts with the buffer. Only fires while the tree itself has focus —\n // when `searchable`, keys land in the search field instead.\n const typeahead = useRef<{ query: string; timer: ReturnType<typeof setTimeout> | null }>({\n query: \"\",\n timer: null,\n })\n useEffect(\n () => () => {\n if (typeahead.current.timer) clearTimeout(typeahead.current.timer)\n },\n [],\n )\n const typeToFocus = (char: string) => {\n const state = typeahead.current\n if (state.timer) clearTimeout(state.timer)\n state.query += char\n state.timer = setTimeout(() => {\n state.query = \"\"\n }, 500)\n\n const n = values.length\n if (n === 0) return\n const q = state.query.toLowerCase()\n // A run of the same key (\"ss\") cycles through same-initial matches.\n const repeated = q.length > 1 && [...q].every((c) => c === q.charAt(0))\n const needle = repeated ? q.charAt(0) : q\n const start = activeValue ? values.indexOf(activeValue) : -1\n const base = start === -1 ? 0 : start\n // Advance past the current row for a fresh/repeated key; keep it for a\n // growing multi-char query so the current match can still satisfy it.\n const advance = start !== -1 && (q.length === 1 || repeated) ? 1 : 0\n const match = Array.from({ length: n }, (_, i) => values[(base + advance + i) % n]).find(\n (value) => value != null && labelOf(value).toLowerCase().startsWith(needle),\n )\n focusRow(match)\n }\n\n // On open, focus the search field (or the active row). Initial focus only.\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-running on activeValue would steal focus while navigating the tree.\n useEffect(() => {\n if (!open) return\n const id = requestAnimationFrame(() => {\n // preventScroll: the content is portaled, so focusing it before the\n // positioner places it would otherwise warp the page to the top.\n if (searchable) searchRef.current?.focus({ preventScroll: true })\n else if (activeValue) rowRefs.current.get(activeValue)?.focus({ preventScroll: true })\n })\n return () => cancelAnimationFrame(id)\n }, [open, searchable])\n\n const moveActive = (dir: 1 | -1) => {\n if (values.length === 0) return\n const idx = activeValue ? values.indexOf(activeValue) : -1\n const next =\n idx === -1\n ? dir === 1\n ? 0\n : values.length - 1\n : Math.min(Math.max(idx + dir, 0), values.length - 1)\n focusRow(values[next])\n }\n\n const onTreeKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveActive(1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveActive(-1)\n break\n case \"Home\":\n event.preventDefault()\n focusRow(values[0])\n break\n case \"End\":\n event.preventDefault()\n focusRow(values[values.length - 1])\n break\n case \" \":\n case \"Enter\":\n event.preventDefault()\n if (activeValue != null) onActivate(activeValue)\n break\n default:\n // Single printable key (no modifier) drives type-ahead. Space never\n // reaches here — it's handled above as \"activate\".\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n event.preventDefault()\n typeToFocus(event.key)\n }\n }\n }\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault()\n focusRow(values[0])\n }\n }\n\n /** Spread on each focusable row: its ref and `data-active`. The row sets its own roving\n * `tabIndex={value === activeValue ? 0 : -1}`, where the a11y lint can see it. */\n const rowProps = (value: string) => ({\n ref: (el: HTMLElement | null) => {\n if (el) rowRefs.current.set(value, el)\n else rowRefs.current.delete(value)\n },\n ...props({ \"data-active\": value === activeValue }),\n })\n\n return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/tree-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AAClE,IAAA,IAAI,KAAA,CAAM,QAAQ,WAAA,EAAa;AAC7B,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,IACpB;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,MAAmB;AAAA,IACnC,GAAA,EAAK,CAAC,EAAA,KAA2B;AAC/B,MAAA,IAAI,EAAA,EAAI,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,WAChC,OAAA,CAAQ,OAAA,CAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,KAAA,KAAU,aAAa;AAAA,GACnD,CAAA;AAEA,EAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,SAAA,EAAW,QAAA,EAAU,eAAe,eAAA,EAAgB;AAC5F","file":"chunk-MRAJ45IM.js","sourcesContent":["/**\n * Shared tree model + pure helpers for the hierarchical pickers (TreeSelect,\n * TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;\n * a node with `children` is a *branch*, one without is a *leaf*. These helpers\n * are selection-agnostic — the single / multi cascade logic lives in each\n * component (mirrors `lib/select-data.ts` for the flat pickers).\n *\n * A node may carry an arbitrary, optional `payload`. Selection ignores it\n * (value / label / disabled drive everything) but it flows through to a tree\n * picker's `renderItem` as `node.payload`.\n */\n\nimport type { ReactNode } from \"react\"\nimport type { LabelSearch } from \"./select-data\"\n\nexport type TreeNodeData<P = unknown> = {\n value: string\n label: string\n disabled?: boolean\n children?: TreeNodeData<P>[]\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered row. Defaults to `` `item-${value}` `` —\n * set it explicitly when `value` isn't a safe/stable test selector on its\n * own. Unlike the Ark-machine-backed pickers, this tree is hand-rolled, so\n * there's no free `data-part` / `data-value` here — `testId` is the row's\n * only stable selector. */\n testId?: string\n}\n\n/**\n * A tree picker's `data` shape. Not generic over the node payload here (a\n * component generic over both `Data` and `P` independently defeats payload\n * inference — see `TreePayload` below); `TreeNodeData`'s own `P` still drives\n * autocomplete, extracted structurally from `Data` when needed.\n */\nexport type TreeSelectData = ReadonlyArray<TreeNodeData>\n\n/**\n * Extract the literal value union from a tree of `TreeNodeData` — the tree\n * analogue of `lib/select-data.ts`'s `SelectValue`, walking every node's\n * `value` plus its `children` (recursively) so a `const`-typed `data` prop\n * narrows `value` / `onChange` to the tree's actual node values instead of\n * plain `string`.\n */\nexport type TreeValue<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodeValue<Nodes[number]>\n\ntype TreeNodeValue<N> = N extends TreeNodeData\n ?\n | N[\"value\"]\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreeValue<N[\"children\"]> : never)\n : never\n\n/**\n * Extract the `payload` type carried by a tree — read structurally off every\n * node's own `payload` property (robust against generic-instantiation\n * inference, same approach as `lib/select-data.ts`'s `SelectPayload`),\n * recursing into `children`. Payload-less nodes contribute `never`; a\n * homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type TreePayload<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodePayload<Nodes[number]>\n\ntype TreeNodePayload<N> = N extends TreeNodeData\n ?\n | (N extends { payload: infer P } ? P : never)\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreePayload<N[\"children\"]> : never)\n : never\n\n/**\n * Live node state passed alongside the node to a tree picker's `renderItem`.\n * `depth` is 0-based (the row renders `aria-level={depth + 1}`); `leaf`\n * distinguishes selectable leaves from organizational branches.\n */\nexport type TreeSelectItemState = {\n selected: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/** Tri-state variant for `TreeMultiSelect` — branches cascade to `indeterminate`. */\nexport type TreeMultiSelectItemState = {\n checked: boolean\n indeterminate: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/**\n * Render a node's content yourself. The component keeps owning the row\n * (treeitem role, indent rails, roving focus, click); the callback fills the\n * content after the rails and receives the node (including its typed `payload`).\n * In an RSC tree the function must live in a `\"use client\"` module so the\n * boundary serializes it as a client reference.\n */\nexport type RenderTreeSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeSelectItemState,\n) => ReactNode\nexport type RenderTreeMultiSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeMultiSelectItemState,\n) => ReactNode\n\nexport const isLeaf = (node: TreeNodeData): boolean => !node.children || node.children.length === 0\n\n/** value → label (trigger display) and value → node (toggling from keyboard / filtered rows). */\nexport const buildMaps = <P>(nodes: ReadonlyArray<TreeNodeData<P>>) => {\n const labelMap = new Map<string, string>()\n const nodeMap = new Map<string, TreeNodeData<P>>()\n const walk = (ns: ReadonlyArray<TreeNodeData<P>>) => {\n for (const n of ns) {\n labelMap.set(n.value, n.label)\n nodeMap.set(n.value, n)\n if (n.children) walk(n.children)\n }\n }\n walk(nodes)\n return { labelMap, nodeMap }\n}\n\n/** Pre-order list of node values + inherited-disabled flag — drives roving focus. */\nexport const flattenTree = (\n nodes: ReadonlyArray<TreeNodeData>,\n inheritedDisabled: boolean,\n acc: { value: string; disabled: boolean }[] = [],\n): { value: string; disabled: boolean }[] => {\n for (const n of nodes) {\n const nodeDisabled = inheritedDisabled || !!n.disabled\n acc.push({ value: n.value, disabled: nodeDisabled })\n if (n.children) flattenTree(n.children, nodeDisabled, acc)\n }\n return acc\n}\n\n/**\n * Keep nodes whose label (or a descendant's) matches `query`; preserves ancestors.\n * `matches` is the pickers' shared locale-aware search (`useLabelSearch().matches`), passed in\n * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.\n */\nexport const filterTree = <P>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n query: string,\n matches: LabelSearch[\"matches\"],\n): TreeNodeData<P>[] => {\n if (!query.trim()) return nodes as TreeNodeData<P>[]\n const recurse = (ns: ReadonlyArray<TreeNodeData<P>>): TreeNodeData<P>[] => {\n const out: TreeNodeData<P>[] = []\n for (const n of ns) {\n const selfMatch = matches(n.label, query)\n if (isLeaf(n)) {\n if (selfMatch) out.push(n)\n } else if (selfMatch) {\n out.push(n) // branch matches → keep its full subtree\n } else if (n.children) {\n const kids = recurse(n.children)\n if (kids.length > 0) out.push({ ...n, children: kids })\n }\n }\n return out\n }\n return recurse(nodes)\n}\n","\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentProps,\n Fragment,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { ClearSectionMode } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { TreeNodeData } from \"../../lib/tree-data\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps } from \"../field/field\"\nimport { inputControlClasses, inputSlot } from \"../input/input\"\nimport { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from \"../popover/popover\"\n\n/**\n * The internals `TreeSelect` and `TreeMultiSelect` share: the row styles, the\n * indent rails, the combobox trigger, the search header, the tree body and the\n * roving focus (arrows, Home / End, type-ahead). Each picker keeps only what\n * differs: what a row shows, and what activating one does.\n */\n\n/** Indent guide / connector colour, shared by rails and the elbow. */\nconst treeLine = \"bg-brand-900/20 dark:bg-white/15\"\n\n/**\n * One tree row. `interactive` rows (every TreeMultiSelect row, TreeSelect's\n * leaves) take roving focus and hover/active surfaces: neutral and\n * transparent, a low-opacity black/white wash rather than an opaque gray,\n * matching the popover surface's own background-dependent tint (no Figma\n * reference for this state yet). The others are TreeSelect's branches:\n * organizational, present for structure and levels, never focused.\n */\nexport const treeRow = cva(\n [\"group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none\"],\n {\n variants: {\n size: {\n xs: \"min-h-7 pe-1.5 text-xs\",\n sm: \"min-h-8 pe-2 text-sm\",\n md: \"min-h-9 pe-2 text-md\",\n lg: \"min-h-10 pe-2.5 text-lg\",\n xl: \"min-h-11 pe-3 text-xl\",\n },\n interactive: {\n true: [\n \"cursor-pointer\",\n TEXT_COLOR_CLASSES.primary,\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n \"data-active:bg-black/5 dark:data-active:bg-white/8\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n // Palette, not brand: the focused row is also the active one, and brand-500\n // measured 2.73:1 against that light fill. `--c-text` (the popover's\n // `data-color`, neutral by default) clears it in both themes.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n ],\n false: [\"cursor-default font-medium\", TEXT_COLOR_CLASSES.secondary],\n },\n },\n defaultVariants: { size: \"md\", interactive: true },\n },\n)\n\n/** Where a node sits in the rendered tree: what its rails and set position need. */\nexport type TreePosition = {\n /** 0-based; the row renders `aria-level={depth + 1}`. */\n depth: number\n /** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */\n ancestorHasNextSibling: boolean[]\n /** Last among its siblings: the connector stops at the elbow. */\n isLast: boolean\n /** 1-based index among its siblings. */\n posinset: number\n /** Number of siblings, itself included. */\n setsize: number\n}\n\n/**\n * Walk `nodes` depth-first, rendering each through `row` with its position,\n * its subtree flattened right after it: the tree is one flat list of rows,\n * its hierarchy carried by `aria-level` and the rails.\n */\nexport const renderTree = <P,>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,\n depth = 0,\n ancestorHasNextSibling: boolean[] = [],\n): ReactNode =>\n nodes.map((node, i) => {\n const position = {\n depth,\n ancestorHasNextSibling,\n isLast: i === nodes.length - 1,\n posinset: i + 1,\n setsize: nodes.length,\n }\n return (\n <Fragment key={node.value}>\n {row(node, position)}\n {node.children &&\n renderTree(\n node.children,\n row,\n depth + 1,\n depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast],\n )}\n </Fragment>\n )\n })\n\n/** A row's level and set position. The tree renders flat, so the browser can't derive them. */\nexport const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({\n \"aria-level\": depth + 1,\n \"aria-setsize\": setsize,\n \"aria-posinset\": posinset,\n})\n\n/** The indent guides before a row's content. Top-level rows sit flush. */\nexport const TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>\n depth > 0 && (\n <>\n {/* ancestor rails: a vertical guide where that ancestor has a sibling below */}\n {ancestorHasNextSibling.map((hasNext, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.\n <span key={i} aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n {hasNext && <span className={cn(\"absolute inset-y-0 inset-s-1/2 w-px\", treeLine)} />}\n </span>\n ))}\n\n {/* connector: vertical (├ continues / └ stops) + horizontal elbow */}\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={cn(\"absolute inset-s-1/2 top-0 w-px\", treeLine, isLast ? \"h-1/2\" : \"bottom-0\")}\n />\n <span className={cn(\"absolute inset-s-1/2 top-1/2 h-px w-1/2\", treeLine)} />\n </span>\n </>\n )\n\n/** A row's default label, after the rails. */\nexport const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (\n <span className={cn(\"ms-1.5 min-w-0 flex-1 truncate text-start\", className)}>{children}</span>\n)\n\ntype TreeTriggerProps = Omit<ComponentProps<\"div\">, \"role\" | \"tabIndex\" | \"color\"> &\n WithTestId & {\n open: boolean\n disabled?: boolean\n readOnly?: boolean\n invalid: boolean\n color?: Color\n startSlot?: ReactNode\n endSlot?: ReactNode\n /** Clears the value. Omit it to hide the clear button. */\n onClear?: () => void\n clearLabel: string\n clearSectionMode: ClearSectionMode\n icons: { clear: ReactNode; chevron: ReactNode }\n /** Enter, Space or ↓ on the closed trigger. */\n onOpen: () => void\n }\n\n/**\n * The real, focusable `<div role=\"combobox\">`, with its start slot, value\n * (`children`), end slot, clear button and chevron. A component of its own so\n * it reads the `Field` context from *inside* the picker's `FieldShell`: the\n * picker renders that shell, so `useFieldContext()` at its top level would\n * run too early. `Popover.Trigger` stamps its own id on the element, so the\n * `<label for>` never reaches it: the name comes from `aria-labelledby`.\n */\nexport const TreeTrigger = ({\n open,\n disabled,\n readOnly,\n invalid,\n color,\n startSlot,\n endSlot,\n onClear,\n clearLabel,\n clearSectionMode,\n icons,\n onOpen,\n testId,\n children,\n ...rest\n}: TreeTriggerProps) => {\n const field = useFieldContext()\n return (\n <Popover.Trigger asChild>\n <div\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n tabIndex={disabled ? -1 : 0}\n {...fieldA11yProps(field)}\n data-color={color}\n {...props({\n \"aria-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-invalid\": invalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron (and optional clear).\n \"data-with-end-slot\": true,\n // The shell IS the tabbable/focusable element here (no separate\n // inner control to route to), so `testId` lands directly on it.\n \"data-testid\": testId,\n })}\n onKeyDown={(event) => {\n if (disabled || readOnly) return\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault()\n onOpen()\n }\n }}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {onClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onPointerDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={(event) => {\n event.stopPropagation()\n onClear()\n }}\n className={popoverClearTrigger}\n >\n {icons.clear}\n </button>\n )}\n {(clearSectionMode === \"both\" || !onClear) && (\n <span aria-hidden data-chevron className={cn(popoverChevron, open && \"rotate-180\")}>\n {icons.chevron}\n </span>\n )}\n </div>\n </Popover.Trigger>\n )\n}\n\n/** The popover's search field, in its fixed header. */\nexport const TreeSearch = ({\n ref,\n value,\n onChange,\n onKeyDown,\n placeholder,\n label,\n className,\n}: {\n ref: Ref<HTMLInputElement>\n value: string\n onChange: (value: string) => void\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void\n placeholder: string\n label: string\n className?: string\n}) => (\n <Popover.Header>\n <input\n ref={ref}\n type=\"text\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n className={cn(inputControlClasses, \"text-sm\", className)}\n />\n </Popover.Header>\n)\n\n/** The scrolling body: the `role=\"tree\"` list, or `empty` when the search matched nothing. */\nexport const TreeBody = ({\n id,\n isEmpty,\n empty,\n multiselectable,\n onKeyDown,\n children,\n}: {\n id: string\n isEmpty: boolean\n empty: ReactNode\n multiselectable?: boolean\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void\n children: ReactNode\n}) => (\n <Popover.Body>\n {isEmpty ? (\n <div className={popoverEmpty}>{empty}</div>\n ) : (\n <div\n id={id}\n role=\"tree\"\n {...props({ \"aria-multiselectable\": multiselectable && \"true\" })}\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n className=\"flex flex-col\"\n >\n {children}\n </div>\n )}\n </Popover.Body>\n)\n\ntype UseTreeRovingFocusOptions = {\n /** The rows that take focus (enabled, and selectable), in visual order. */\n values: readonly string[]\n /** A row's label, matched by type-ahead. */\n labelOf: (value: string) => string\n open: boolean\n searchable: boolean\n /** Space / Enter on the focused row. */\n onActivate: (value: string) => void\n}\n\n/**\n * Roving focus over a flat-rendered tree. One row is active (`tabIndex=0`,\n * `data-active`); `↑` / `↓` step through `values`, `Home` / `End` jump to\n * either end, `Space` / `Enter` activate, and printable keys type-ahead to the\n * next row whose label starts with what was typed. On open, focus lands in\n * the search field when there is one, on the active row otherwise.\n */\nexport const useTreeRovingFocus = ({\n values,\n labelOf,\n open,\n searchable,\n onActivate,\n}: UseTreeRovingFocusOptions) => {\n const [activeValueState, setActiveValue] = useState<string | null>(null)\n // A row filtered out (or disabled) since it was active falls back to the first.\n const activeValue =\n activeValueState != null && values.includes(activeValueState)\n ? activeValueState\n : (values[0] ?? null)\n\n const searchRef = useRef<HTMLInputElement>(null)\n const rowRefs = useRef(new Map<string, HTMLElement>())\n const focusRow = (next: string | null | undefined) => {\n if (next == null) return\n setActiveValue(next)\n rowRefs.current.get(next)?.focus()\n }\n\n // Type-ahead: typed characters buffer briefly and jump to the next row whose\n // label starts with the buffer. Only fires while the tree itself has focus —\n // when `searchable`, keys land in the search field instead.\n const typeahead = useRef<{ query: string; timer: ReturnType<typeof setTimeout> | null }>({\n query: \"\",\n timer: null,\n })\n useEffect(\n () => () => {\n if (typeahead.current.timer) clearTimeout(typeahead.current.timer)\n },\n [],\n )\n const typeToFocus = (char: string) => {\n const state = typeahead.current\n if (state.timer) clearTimeout(state.timer)\n state.query += char\n state.timer = setTimeout(() => {\n state.query = \"\"\n }, 500)\n\n const n = values.length\n if (n === 0) return\n const q = state.query.toLowerCase()\n // A run of the same key (\"ss\") cycles through same-initial matches.\n const repeated = q.length > 1 && [...q].every((c) => c === q.charAt(0))\n const needle = repeated ? q.charAt(0) : q\n const start = activeValue ? values.indexOf(activeValue) : -1\n const base = start === -1 ? 0 : start\n // Advance past the current row for a fresh/repeated key; keep it for a\n // growing multi-char query so the current match can still satisfy it.\n const advance = start !== -1 && (q.length === 1 || repeated) ? 1 : 0\n const match = Array.from({ length: n }, (_, i) => values[(base + advance + i) % n]).find(\n (value) => value != null && labelOf(value).toLowerCase().startsWith(needle),\n )\n focusRow(match)\n }\n\n // On open, focus the search field (or the active row). Initial focus only.\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-running on activeValue would steal focus while navigating the tree.\n useEffect(() => {\n if (!open) return\n const id = requestAnimationFrame(() => {\n // preventScroll: the content is portaled, so focusing it before the\n // positioner places it would otherwise warp the page to the top.\n if (searchable) searchRef.current?.focus({ preventScroll: true })\n else if (activeValue) rowRefs.current.get(activeValue)?.focus({ preventScroll: true })\n })\n return () => cancelAnimationFrame(id)\n }, [open, searchable])\n\n const moveActive = (dir: 1 | -1) => {\n if (values.length === 0) return\n const idx = activeValue ? values.indexOf(activeValue) : -1\n const next =\n idx === -1\n ? dir === 1\n ? 0\n : values.length - 1\n : Math.min(Math.max(idx + dir, 0), values.length - 1)\n focusRow(values[next])\n }\n\n const onTreeKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveActive(1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveActive(-1)\n break\n case \"Home\":\n event.preventDefault()\n focusRow(values[0])\n break\n case \"End\":\n event.preventDefault()\n focusRow(values[values.length - 1])\n break\n case \" \":\n case \"Enter\":\n event.preventDefault()\n if (activeValue != null) onActivate(activeValue)\n break\n default:\n // Single printable key (no modifier) drives type-ahead. Space never\n // reaches here — it's handled above as \"activate\".\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n event.preventDefault()\n typeToFocus(event.key)\n }\n }\n }\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault()\n focusRow(values[0])\n }\n }\n\n /** Spread on each focusable row: its ref and `data-active`. The row sets its own roving\n * `tabIndex={value === activeValue ? 0 : -1}`, where the a11y lint can see it. */\n const rowProps = (value: string) => ({\n ref: (el: HTMLElement | null) => {\n if (el) rowRefs.current.set(value, el)\n else rowRefs.current.delete(value)\n },\n ...props({ \"data-active\": value === activeValue }),\n })\n\n return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown }\n}\n"]}
@@ -1,15 +1,44 @@
1
+ import { toPositioning } from './chunk-V6PY7C6S.js';
1
2
  import { useOverlayContainer } from './chunk-7P32XCEU.js';
2
- import { useLayerGuard, useNestedLayer, OverlayLayerProvider } from './chunk-H7WOMZXO.js';
3
+ import { useNestedLayer, OverlayLayerProvider, useLayerGuard } from './chunk-H7WOMZXO.js';
3
4
  import { useUncontrolled } from './chunk-PMUCGFY5.js';
4
5
  import { props } from './chunk-WYCMIIRR.js';
5
6
  import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
6
7
  import { cn } from './chunk-4ASNIDV7.js';
8
+ import { useLocaleContext } from '@ark-ui/react/locale';
7
9
  import { Popover as Popover$1, usePopoverContext } from '@ark-ui/react/popover';
8
10
  import { Portal } from '@ark-ui/react/portal';
9
11
  import { cva } from 'class-variance-authority';
10
- import { createContext, useContext, useState, useRef, useEffect } from 'react';
11
- import { jsx } from 'react/jsx-runtime';
12
+ import { createContext, useState, useRef, Children, cloneElement, useContext, isValidElement, useEffect } from 'react';
13
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
14
 
15
+ var slideStyle = {
16
+ transitionProperty: "transform",
17
+ transitionDuration: "200ms",
18
+ transitionTimingFunction: "cubic-bezier(0.32, 0.72, 0, 1)"
19
+ };
20
+ var useSlideAfterPlaced = () => {
21
+ const [sliding, setSliding] = useState(false);
22
+ const open = useRef(false);
23
+ const onOpenChange = (next) => {
24
+ open.current = next;
25
+ if (!next) setSliding(false);
26
+ };
27
+ const updatePosition = (custom) => async (data) => {
28
+ await (custom ? custom(data) : data.updatePosition());
29
+ if (open.current) setSliding(true);
30
+ };
31
+ return { sliding, onOpenChange, updatePosition };
32
+ };
33
+ var splitGroupChildren = (children, content) => {
34
+ const items = Children.toArray(children);
35
+ const isContent = (node) => isValidElement(node) && node.type === content;
36
+ return { contents: items.filter(isContent), triggers: items.filter((item) => !isContent(item)) };
37
+ };
38
+ var activeGroupContent = (contents, triggerValue) => {
39
+ const active = contents.find((content) => content.props.value === triggerValue);
40
+ return active ? cloneElement(active, { key: "group-content" }) : null;
41
+ };
13
42
  var popoverChrome = cn(
14
43
  "rounded-input border border-brand-900/20 dark:border-white/15",
15
44
  "bg-brand-50/90 dark:bg-brand-950/85",
@@ -86,7 +115,8 @@ var tabbableSelector = [
86
115
  var PopoverContext = createContext({
87
116
  width: "target",
88
117
  withinPortal: true,
89
- layers: /* @__PURE__ */ new Set()
118
+ layers: /* @__PURE__ */ new Set(),
119
+ sliding: false
90
120
  });
91
121
  var delay = (value, fallback) => typeof value === "number" ? value : fallback;
92
122
  var focusInto = (trigger, initialFocusEl) => requestAnimationFrame(() => {
@@ -96,7 +126,18 @@ var focusInto = (trigger, initialFocusEl) => requestAnimationFrame(() => {
96
126
  const target = initialFocusEl?.() ?? panel.querySelector(tabbableSelector) ?? panel;
97
127
  target.focus({ preventScroll: true });
98
128
  });
129
+ var GroupBridge = ({ api }) => {
130
+ const live = usePopoverContext();
131
+ useEffect(() => {
132
+ api.current = live;
133
+ });
134
+ useEffect(() => {
135
+ if (live.open) live.reposition();
136
+ }, [live.triggerValue]);
137
+ return null;
138
+ };
99
139
  var usePopoverHover = ({
140
+ api,
100
141
  open,
101
142
  defaultOpen,
102
143
  openDelay,
@@ -129,8 +170,10 @@ var usePopoverHover = ({
129
170
  const pinned = isOpen && source === "press";
130
171
  const hover = {
131
172
  pinned,
132
- onPointerEnter: (event) => {
173
+ onPointerEnter: (event, value) => {
133
174
  if (event.pointerType === "touch" || pinned) return;
175
+ if (value !== void 0 && api.current && api.current.triggerValue !== value)
176
+ api.current.setTriggerValue(value);
134
177
  if (isOpen) return clear();
135
178
  setSource("hover");
136
179
  later(true, openDelay);
@@ -160,9 +203,24 @@ var usePopoverHover = ({
160
203
  if (next) setSource("press");
161
204
  setOpen(next);
162
205
  };
163
- return { open: isOpen, press: source === "press", hover, onArkOpenChange };
206
+ return {
207
+ open: isOpen,
208
+ press: source === "press",
209
+ hover,
210
+ onArkOpenChange,
211
+ /** zag switched triggers — pins it if a click on a preview caused it. */
212
+ onArkTriggerValueChange: () => {
213
+ const trigger = upgrading.current;
214
+ upgrading.current = null;
215
+ if (!trigger) return;
216
+ clear();
217
+ setSource("press");
218
+ if (autoFocus) focusInto(trigger, initialFocusEl);
219
+ }
220
+ };
164
221
  };
165
- var Root = ({
222
+ var Machine = ({
223
+ group,
166
224
  mode = "click",
167
225
  openDelay,
168
226
  closeDelay,
@@ -170,13 +228,16 @@ var Root = ({
170
228
  position,
171
229
  gutter,
172
230
  offset,
173
- hideWhenDetached = true,
231
+ hideWhenDetached,
174
232
  positioning,
175
233
  withinPortal = true,
176
234
  container,
177
235
  children,
178
236
  open,
179
237
  defaultOpen,
238
+ triggerValue,
239
+ defaultTriggerValue,
240
+ onTriggerValueChange,
180
241
  autoFocus = true,
181
242
  restoreFocus = true,
182
243
  modal = false,
@@ -185,12 +246,17 @@ var Root = ({
185
246
  onPointerDownOutside,
186
247
  ...rest
187
248
  }) => {
249
+ const { dir } = useLocaleContext();
188
250
  const guard = useLayerGuard(onPointerDownOutside);
251
+ const slide = useSlideAfterPlaced();
252
+ const api = useRef(null);
189
253
  const notify = (details) => {
190
254
  onOpenChange?.(details);
255
+ if (group) slide.onOpenChange(details.open);
191
256
  if (!details.open) onClose?.();
192
257
  };
193
258
  const hovering = usePopoverHover({
259
+ api,
194
260
  open,
195
261
  defaultOpen,
196
262
  openDelay: delay(openDelay, 600),
@@ -202,33 +268,61 @@ var Root = ({
202
268
  const hover = mode === "hover" ? hovering.hover : void 0;
203
269
  const press = !hover || hovering.press;
204
270
  const state = hover ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange } : { open, defaultOpen, onOpenChange: notify };
271
+ const parts = group ? splitGroupChildren(children, Content) : void 0;
205
272
  return /* @__PURE__ */ jsx(
206
273
  PopoverContext.Provider,
207
274
  {
208
- value: { width, withinPortal, container, layers: guard.layers, hover },
275
+ value: {
276
+ width,
277
+ withinPortal,
278
+ container,
279
+ layers: guard.layers,
280
+ hover,
281
+ sliding: group && slide.sliding
282
+ },
209
283
  children: /* @__PURE__ */ jsx(
210
284
  Popover$1.Root,
211
285
  {
286
+ lazyMount: group,
287
+ unmountOnExit: group,
212
288
  onPointerDownOutside: guard.onPointerDownOutside,
213
- positioning: {
214
- sameWidth: width === "target",
215
- placement: position,
216
- gutter,
217
- offset,
218
- hideWhenDetached,
219
- ...positioning
220
- },
289
+ positioning: toPositioning(
290
+ {
291
+ position,
292
+ gutter,
293
+ offset,
294
+ hideWhenDetached,
295
+ positioning: group ? {
296
+ ...positioning,
297
+ updatePosition: slide.updatePosition(positioning?.updatePosition)
298
+ } : positioning
299
+ },
300
+ dir,
301
+ width
302
+ ),
221
303
  autoFocus: press && autoFocus,
222
304
  restoreFocus: press && restoreFocus,
223
305
  modal: press && modal,
306
+ triggerValue,
307
+ defaultTriggerValue,
308
+ onTriggerValueChange: (details) => {
309
+ onTriggerValueChange?.(details);
310
+ hovering.onArkTriggerValueChange();
311
+ },
224
312
  ...state,
225
313
  ...rest,
226
- children
314
+ children: parts ? /* @__PURE__ */ jsxs(Fragment, { children: [
315
+ /* @__PURE__ */ jsx(GroupBridge, { api }),
316
+ parts.triggers,
317
+ /* @__PURE__ */ jsx(Popover$1.Context, { children: (api2) => activeGroupContent(parts.contents, api2.triggerValue) })
318
+ ] }) : children
227
319
  }
228
320
  )
229
321
  }
230
322
  );
231
323
  };
324
+ var Root = (props2) => /* @__PURE__ */ jsx(Machine, { group: false, ...props2 });
325
+ var Group = (props2) => /* @__PURE__ */ jsx(Machine, { group: true, ...props2 });
232
326
  var Trigger = ({
233
327
  onPointerEnter,
234
328
  onPointerLeave,
@@ -242,7 +336,7 @@ var Trigger = ({
242
336
  {
243
337
  onPointerEnter: (event) => {
244
338
  onPointerEnter?.(event);
245
- hover?.onPointerEnter(event);
339
+ hover?.onPointerEnter(event, rest.value);
246
340
  },
247
341
  onPointerLeave: (event) => {
248
342
  onPointerLeave?.(event);
@@ -266,12 +360,13 @@ var Content = ({
266
360
  onPointerDown,
267
361
  onFocus,
268
362
  asChild: _asChild,
363
+ value: _value,
269
364
  ...rest
270
365
  }) => {
271
- const { width, withinPortal, container, layers, hover } = useContext(PopoverContext);
366
+ const { width, withinPortal, container, layers, hover, sliding } = useContext(PopoverContext);
272
367
  const portalContainer = useOverlayContainer(container);
273
368
  useNestedLayer(usePopoverContext().open);
274
- const panel = /* @__PURE__ */ jsx(Popover$1.Positioner, { children: /* @__PURE__ */ jsx(
369
+ const panel = /* @__PURE__ */ jsx(Popover$1.Positioner, { style: sliding ? slideStyle : void 0, children: /* @__PURE__ */ jsx(
275
370
  Popover$1.Content,
276
371
  {
277
372
  tabIndex: -1,
@@ -320,6 +415,7 @@ var Body = ({ className, testId, ...rest }) => /* @__PURE__ */ jsx(
320
415
  );
321
416
  var Popover = {
322
417
  Root,
418
+ Group,
323
419
  Trigger,
324
420
  /** Positions the panel without attaching any click/keyboard trigger
325
421
  * semantics — for a host that already owns its own click resolution
@@ -332,6 +428,6 @@ var Popover = {
332
428
  Footer
333
429
  };
334
430
 
335
- export { Popover, popoverChevron, popoverChrome, popoverClearTrigger, popoverContent, popoverEmpty, popoverGroupLabel, popoverIndicator, popoverList, popoverOption, popoverPanel, scrollHighlightedIntoView };
336
- //# sourceMappingURL=chunk-5HUEBSIS.js.map
337
- //# sourceMappingURL=chunk-5HUEBSIS.js.map
431
+ export { Popover, activeGroupContent, popoverChevron, popoverChrome, popoverClearTrigger, popoverContent, popoverEmpty, popoverGroupLabel, popoverIndicator, popoverList, popoverOption, popoverPanel, scrollHighlightedIntoView, slideStyle, splitGroupChildren, useSlideAfterPlaced };
432
+ //# sourceMappingURL=chunk-N66NC6QK.js.map
433
+ //# sourceMappingURL=chunk-N66NC6QK.js.map
@@ -0,0 +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,EAA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A,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,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,5 +1,5 @@
1
- import { inputSlot, inputControlClasses, inputShell } from './chunk-45QRQKRC.js';
2
- import { popoverClearTrigger } from './chunk-5HUEBSIS.js';
1
+ import { inputSlot, inputControlClasses, inputShell } from './chunk-3L5GLI67.js';
2
+ import { popoverClearTrigger } from './chunk-N66NC6QK.js';
3
3
  import { props } from './chunk-WYCMIIRR.js';
4
4
  import { cn } from './chunk-4ASNIDV7.js';
5
5
  import { Combobox } from '@ark-ui/react/combobox';
@@ -58,5 +58,5 @@ var ComboboxSearchRow = ({
58
58
  );
59
59
 
60
60
  export { ComboboxSearchRow };
61
- //# sourceMappingURL=chunk-SXNAUSEB.js.map
62
- //# sourceMappingURL=chunk-SXNAUSEB.js.map
61
+ //# sourceMappingURL=chunk-OZMSXYBX.js.map
62
+ //# sourceMappingURL=chunk-OZMSXYBX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/combobox-list/combobox-search-row.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;AAqCO,IAAM,oBAAoB,CAAC;AAAA,EAChC,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,qBACE,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACE,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,oBAAA,EAAsB,UAAU,CAAA;AAAA,IACrE,SAAA,EAAW,EAAA;AAAA,MACT,UAAA,CAAW,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAC5B,iGAAA;AAAA,MACA,UAAA,EAAY;AAAA,KACd;AAAA,IAEC,QAAA,EAAA;AAAA,MAAA,KAAA,CAAM,MAAA,IAAU,wBACf,GAAA,CAAC,MAAA,EAAA,EAAK,WAAW,SAAA,EAAW,aAAA,EAAW,IAAA,EACpC,QAAA,EAAA,KAAA,CAAM,MAAA,EACT,CAAA;AAAA,sBAOF,GAAA;AAAA,QAACA,QAAA,CAAY,KAAA;AAAA,QAAZ;AAAA,UACC,WAAA;AAAA,UACA,MAAA;AAAA,UACA,GAAA;AAAA,UACC,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,aAAA,EAAe,QAAQ,CAAA;AAAA,UAC5D,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK;AAAA;AAAA,OACtD;AAAA,MACC,QAAA,oBACC,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,YAAA,EAAY,UAAA;AAAA,UACZ,eAAa,CAAC,SAAA;AAAA,UACd,QAAA,EAAU,YAAY,CAAA,GAAI,EAAA;AAAA,UAC1B,aAAA,EAAe,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,UAC/C,OAAA,EAAS,OAAA;AAAA,UACT,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,UAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA;AACT;AAAA;AAEJ","file":"chunk-SXNAUSEB.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\nexport type ComboboxSearchRowProps = {\n size: InputSize\n variant: InputVariant\n invalid: boolean\n placeholder?: string\n /** Reserves the clear button's box, so its showing never shifts the input's width. */\n canClear: boolean\n /** Shows the reserved clear button and makes it reachable. */\n showClear: boolean\n clearLabel: string\n onClear: () => void\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n ref?: Ref<HTMLInputElement>\n testId?: string\n icons: { search: ReactNode; clear: ReactNode }\n classNames?: { search?: string; input?: string }\n}\n\n/**\n * The always-open lists' search row — `ComboboxList` and `MultiComboboxList` — inside their\n * `Combobox.Root`: the magnifier, the search `<input>`, and the clear button.\n */\nexport const ComboboxSearchRow = ({\n size,\n variant,\n invalid,\n placeholder,\n canClear,\n showClear,\n clearLabel,\n onClear,\n onBlur,\n ref,\n testId,\n icons,\n classNames,\n}: ComboboxSearchRowProps) => (\n <div\n {...props({ \"data-invalid\": invalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n {icons.search != null && (\n <span className={inputSlot} aria-hidden>\n {icons.search}\n </span>\n )}\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (the lists render hidden inputs). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={onClear}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n </div>\n)\n"]}
1
+ {"version":3,"sources":["../src/components/combobox-list/combobox-search-row.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;AAqCO,IAAM,oBAAoB,CAAC;AAAA,EAChC,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,qBACE,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACE,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,oBAAA,EAAsB,UAAU,CAAA;AAAA,IACrE,SAAA,EAAW,EAAA;AAAA,MACT,UAAA,CAAW,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAC5B,iGAAA;AAAA,MACA,UAAA,EAAY;AAAA,KACd;AAAA,IAEC,QAAA,EAAA;AAAA,MAAA,KAAA,CAAM,MAAA,IAAU,wBACf,GAAA,CAAC,MAAA,EAAA,EAAK,WAAW,SAAA,EAAW,aAAA,EAAW,IAAA,EACpC,QAAA,EAAA,KAAA,CAAM,MAAA,EACT,CAAA;AAAA,sBAOF,GAAA;AAAA,QAACA,QAAA,CAAY,KAAA;AAAA,QAAZ;AAAA,UACC,WAAA;AAAA,UACA,MAAA;AAAA,UACA,GAAA;AAAA,UACC,GAAG,KAAA,CAAM,EAAE,gBAAgB,OAAA,EAAS,aAAA,EAAe,QAAQ,CAAA;AAAA,UAC5D,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK;AAAA;AAAA,OACtD;AAAA,MACC,QAAA,oBACC,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,YAAA,EAAY,UAAA;AAAA,UACZ,eAAa,CAAC,SAAA;AAAA,UACd,QAAA,EAAU,YAAY,CAAA,GAAI,EAAA;AAAA,UAC1B,aAAA,EAAe,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,UAC/C,OAAA,EAAS,OAAA;AAAA,UACT,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,UAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA;AACT;AAAA;AAEJ","file":"chunk-OZMSXYBX.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\nexport type ComboboxSearchRowProps = {\n size: InputSize\n variant: InputVariant\n invalid: boolean\n placeholder?: string\n /** Reserves the clear button's box, so its showing never shifts the input's width. */\n canClear: boolean\n /** Shows the reserved clear button and makes it reachable. */\n showClear: boolean\n clearLabel: string\n onClear: () => void\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n ref?: Ref<HTMLInputElement>\n testId?: string\n icons: { search: ReactNode; clear: ReactNode }\n classNames?: { search?: string; input?: string }\n}\n\n/**\n * The always-open lists' search row — `ComboboxList` and `MultiComboboxList` — inside their\n * `Combobox.Root`: the magnifier, the search `<input>`, and the clear button.\n */\nexport const ComboboxSearchRow = ({\n size,\n variant,\n invalid,\n placeholder,\n canClear,\n showClear,\n clearLabel,\n onClear,\n onBlur,\n ref,\n testId,\n icons,\n classNames,\n}: ComboboxSearchRowProps) => (\n <div\n {...props({ \"data-invalid\": invalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n {icons.search != null && (\n <span className={inputSlot} aria-hidden>\n {icons.search}\n </span>\n )}\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (the lists render hidden inputs). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={onClear}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n </div>\n)\n"]}
@@ -1,7 +1,7 @@
1
- import { ComboboxSearchRow } from './chunk-SXNAUSEB.js';
1
+ import { ComboboxSearchRow } from './chunk-OZMSXYBX.js';
2
2
  import { controlIndicator } from './chunk-NLOBBJAA.js';
3
3
  import { normalizeSelectData, useLabelSearch, filterSelectData } from './chunk-7TDHT3QD.js';
4
- import { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox } from './chunk-MKKQE3TM.js';
4
+ import { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox } from './chunk-YPFSRZ3T.js';
5
5
  import { FieldShell } from './chunk-VD6PB3VA.js';
6
6
  import { useUncontrolled } from './chunk-PMUCGFY5.js';
7
7
  import { CheckIcon, CloseIcon } from './chunk-6YNLRQ25.js';
@@ -160,5 +160,5 @@ var MultiComboboxList = ({
160
160
  };
161
161
 
162
162
  export { MultiComboboxList };
163
- //# sourceMappingURL=chunk-LBAE6FP6.js.map
164
- //# sourceMappingURL=chunk-LBAE6FP6.js.map
163
+ //# sourceMappingURL=chunk-SZEOTXRZ.js.map
164
+ //# sourceMappingURL=chunk-SZEOTXRZ.js.map