@42-central/ui-react 0.23.0 → 0.25.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 (215) hide show
  1. package/dist/{chunk-FUNTJZX7.js → chunk-2CL3FKEY.js} +3 -3
  2. package/dist/{chunk-FUNTJZX7.js.map → chunk-2CL3FKEY.js.map} +1 -1
  3. package/dist/{chunk-OZMSXYBX.js → chunk-36NWC4GV.js} +3 -3
  4. package/dist/{chunk-OZMSXYBX.js.map → chunk-36NWC4GV.js.map} +1 -1
  5. package/dist/{chunk-4FEOMQYR.js → chunk-54W6VAI3.js} +5 -5
  6. package/dist/{chunk-4FEOMQYR.js.map → chunk-54W6VAI3.js.map} +1 -1
  7. package/dist/{chunk-SZEOTXRZ.js → chunk-6II2DVYR.js} +5 -5
  8. package/dist/{chunk-SZEOTXRZ.js.map → chunk-6II2DVYR.js.map} +1 -1
  9. package/dist/{chunk-DJLNGWMM.js → chunk-6IRMKF5T.js} +3 -3
  10. package/dist/{chunk-DJLNGWMM.js.map → chunk-6IRMKF5T.js.map} +1 -1
  11. package/dist/{chunk-YPFSRZ3T.js → chunk-6UIQJJNJ.js} +3 -3
  12. package/dist/{chunk-YPFSRZ3T.js.map → chunk-6UIQJJNJ.js.map} +1 -1
  13. package/dist/{chunk-DT6LKNZF.js → chunk-7247WBTV.js} +5 -4
  14. package/dist/chunk-7247WBTV.js.map +1 -0
  15. package/dist/{chunk-6VYGK3Q3.js → chunk-7E7JNWOC.js} +16 -21
  16. package/dist/chunk-7E7JNWOC.js.map +1 -0
  17. package/dist/{chunk-C4NFRSOR.js → chunk-7HZBD4YZ.js} +4 -4
  18. package/dist/{chunk-C4NFRSOR.js.map → chunk-7HZBD4YZ.js.map} +1 -1
  19. package/dist/{chunk-JVG5ISPT.js → chunk-AHKMN3YQ.js} +3 -3
  20. package/dist/{chunk-JVG5ISPT.js.map → chunk-AHKMN3YQ.js.map} +1 -1
  21. package/dist/{chunk-UAYENYS2.js → chunk-AKXALCUN.js} +3 -3
  22. package/dist/{chunk-UAYENYS2.js.map → chunk-AKXALCUN.js.map} +1 -1
  23. package/dist/{chunk-BE2LWUHY.js → chunk-BMEJBY6H.js} +5 -3
  24. package/dist/chunk-BMEJBY6H.js.map +1 -0
  25. package/dist/{chunk-MXAACRWE.js → chunk-E52Z2FKU.js} +5 -5
  26. package/dist/{chunk-MXAACRWE.js.map → chunk-E52Z2FKU.js.map} +1 -1
  27. package/dist/chunk-F374BNL4.js +129 -0
  28. package/dist/chunk-F374BNL4.js.map +1 -0
  29. package/dist/{chunk-MRAJ45IM.js → chunk-FZSLSUSX.js} +4 -4
  30. package/dist/{chunk-MRAJ45IM.js.map → chunk-FZSLSUSX.js.map} +1 -1
  31. package/dist/{chunk-3L5GLI67.js → chunk-I4B3N3UX.js} +3 -3
  32. package/dist/{chunk-3L5GLI67.js.map → chunk-I4B3N3UX.js.map} +1 -1
  33. package/dist/{chunk-IPYHTCFL.js → chunk-IUK7OJXZ.js} +3 -3
  34. package/dist/{chunk-IPYHTCFL.js.map → chunk-IUK7OJXZ.js.map} +1 -1
  35. package/dist/{chunk-2MXWEIMD.js → chunk-KKLCHLCZ.js} +12 -11
  36. package/dist/chunk-KKLCHLCZ.js.map +1 -0
  37. package/dist/{chunk-YWTOW7PZ.js → chunk-LHUWOA2U.js} +8 -8
  38. package/dist/{chunk-YWTOW7PZ.js.map → chunk-LHUWOA2U.js.map} +1 -1
  39. package/dist/{chunk-6N6J2DOE.js → chunk-LIZWCWED.js} +3 -3
  40. package/dist/{chunk-6N6J2DOE.js.map → chunk-LIZWCWED.js.map} +1 -1
  41. package/dist/{chunk-O7LS6OZR.js → chunk-LMCUGYHT.js} +3 -3
  42. package/dist/{chunk-O7LS6OZR.js.map → chunk-LMCUGYHT.js.map} +1 -1
  43. package/dist/{chunk-DHJB4UJD.js → chunk-N5M4PDBK.js} +4 -4
  44. package/dist/{chunk-DHJB4UJD.js.map → chunk-N5M4PDBK.js.map} +1 -1
  45. package/dist/{chunk-DA4QII2N.js → chunk-NLSJ6T7V.js} +4 -4
  46. package/dist/{chunk-DA4QII2N.js.map → chunk-NLSJ6T7V.js.map} +1 -1
  47. package/dist/{chunk-UT3TOV2Q.js → chunk-OVT2KZHY.js} +3 -3
  48. package/dist/{chunk-UT3TOV2Q.js.map → chunk-OVT2KZHY.js.map} +1 -1
  49. package/dist/{chunk-SVKN5ZHX.js → chunk-PEHFWGTT.js} +16 -13
  50. package/dist/chunk-PEHFWGTT.js.map +1 -0
  51. package/dist/{chunk-J44FJ7PH.js → chunk-PFZMB3US.js} +4 -4
  52. package/dist/{chunk-J44FJ7PH.js.map → chunk-PFZMB3US.js.map} +1 -1
  53. package/dist/{chunk-IRNF274I.js → chunk-PI7X5YFJ.js} +3 -3
  54. package/dist/{chunk-IRNF274I.js.map → chunk-PI7X5YFJ.js.map} +1 -1
  55. package/dist/{chunk-F2FSHVO5.js → chunk-QZ4N5LYG.js} +7 -7
  56. package/dist/{chunk-F2FSHVO5.js.map → chunk-QZ4N5LYG.js.map} +1 -1
  57. package/dist/{chunk-E5H3YWZV.js → chunk-SAXWCGWR.js} +3 -3
  58. package/dist/{chunk-E5H3YWZV.js.map → chunk-SAXWCGWR.js.map} +1 -1
  59. package/dist/{chunk-SWVUXEBT.js → chunk-SCXXJDKQ.js} +3 -3
  60. package/dist/{chunk-SWVUXEBT.js.map → chunk-SCXXJDKQ.js.map} +1 -1
  61. package/dist/{chunk-D3JYDAUZ.js → chunk-T44RW5DW.js} +4 -4
  62. package/dist/{chunk-D3JYDAUZ.js.map → chunk-T44RW5DW.js.map} +1 -1
  63. package/dist/{chunk-FB2G4LNH.js → chunk-UDCCOUWR.js} +5 -5
  64. package/dist/{chunk-FB2G4LNH.js.map → chunk-UDCCOUWR.js.map} +1 -1
  65. package/dist/{chunk-TCFB23JT.js → chunk-WERJ44ZN.js} +3 -3
  66. package/dist/{chunk-TCFB23JT.js.map → chunk-WERJ44ZN.js.map} +1 -1
  67. package/dist/{chunk-QNKD2SQM.js → chunk-X3YIHN2U.js} +5 -5
  68. package/dist/{chunk-QNKD2SQM.js.map → chunk-X3YIHN2U.js.map} +1 -1
  69. package/dist/{chunk-VD6PB3VA.js → chunk-X6DESK37.js} +12 -3
  70. package/dist/chunk-X6DESK37.js.map +1 -0
  71. package/dist/{chunk-7AQ4MN4M.js → chunk-XUFCI262.js} +4 -4
  72. package/dist/{chunk-7AQ4MN4M.js.map → chunk-XUFCI262.js.map} +1 -1
  73. package/dist/{chunk-47LEAR6G.js → chunk-Y2G47ARQ.js} +6 -6
  74. package/dist/{chunk-47LEAR6G.js.map → chunk-Y2G47ARQ.js.map} +1 -1
  75. package/dist/{chunk-F342ZT7O.js → chunk-ZVECQBGG.js} +13 -7
  76. package/dist/chunk-ZVECQBGG.js.map +1 -0
  77. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  78. package/dist/components/action-icon/index.js +1 -1
  79. package/dist/components/alert/index.js +1 -1
  80. package/dist/components/ambient-background/ambient-background.d.ts +14 -3
  81. package/dist/components/ambient-background/ambient-background.d.ts.map +1 -1
  82. package/dist/components/ambient-background/index.js +225 -2
  83. package/dist/components/ambient-background/index.js.map +1 -1
  84. package/dist/components/ambient-background/starfield.d.ts +13 -0
  85. package/dist/components/ambient-background/starfield.d.ts.map +1 -0
  86. package/dist/components/app-shell/index.js +4 -4
  87. package/dist/components/autocomplete/index.js +3 -3
  88. package/dist/components/avatar/index.js +2 -2
  89. package/dist/components/badge/badge.d.ts.map +1 -1
  90. package/dist/components/badge/index.js +1 -1
  91. package/dist/components/button/index.js +1 -1
  92. package/dist/components/button-multi-select/index.js +3 -3
  93. package/dist/components/button-select/index.js +3 -3
  94. package/dist/components/calendar/index.js +4 -4
  95. package/dist/components/calendar-heatmap/index.js +2 -2
  96. package/dist/components/camera/index.js +10 -10
  97. package/dist/components/card/card.d.ts.map +1 -1
  98. package/dist/components/card/index.js +1 -1
  99. package/dist/components/carousel/index.js +2 -2
  100. package/dist/components/checkbox/checkbox.d.ts +3 -2
  101. package/dist/components/checkbox/checkbox.d.ts.map +1 -1
  102. package/dist/components/checkbox/index.js +2 -2
  103. package/dist/components/choice-card-group/index.js +2 -2
  104. package/dist/components/choice-card-group/index.js.map +1 -1
  105. package/dist/components/clipboard/index.js +3 -3
  106. package/dist/components/code-block/code-block.d.ts +6 -3
  107. package/dist/components/code-block/code-block.d.ts.map +1 -1
  108. package/dist/components/code-block/highlighter.d.ts +16 -15
  109. package/dist/components/code-block/highlighter.d.ts.map +1 -1
  110. package/dist/components/code-block/index.d.ts +2 -1
  111. package/dist/components/code-block/index.d.ts.map +1 -1
  112. package/dist/components/code-block/index.js +81 -10
  113. package/dist/components/code-block/index.js.map +1 -1
  114. package/dist/components/code-block/languages.d.ts +61 -0
  115. package/dist/components/code-block/languages.d.ts.map +1 -0
  116. package/dist/components/code-block/static.d.ts +2 -1
  117. package/dist/components/code-block/static.d.ts.map +1 -1
  118. package/dist/components/code-block/static.js +99 -10
  119. package/dist/components/code-block/static.js.map +1 -1
  120. package/dist/components/combobox/index.js +3 -3
  121. package/dist/components/combobox-list/index.js +5 -5
  122. package/dist/components/compare/index.js +2 -2
  123. package/dist/components/data-table/index.js +30 -30
  124. package/dist/components/data-table/index.js.map +1 -1
  125. package/dist/components/date-picker/index.js +12 -12
  126. package/dist/components/download-button/index.js +2 -2
  127. package/dist/components/drawer/index.js +4 -4
  128. package/dist/components/field/field.d.ts +3 -0
  129. package/dist/components/field/field.d.ts.map +1 -1
  130. package/dist/components/field/index.js +1 -1
  131. package/dist/components/file-item/index.js +5 -5
  132. package/dist/components/file-preview/index.js +5 -5
  133. package/dist/components/file-trigger/index.js +2 -2
  134. package/dist/components/file-upload/index.js +6 -6
  135. package/dist/components/gallery/index.js +2 -2
  136. package/dist/components/geodesic/a11y.d.ts +3 -3
  137. package/dist/components/geodesic/a11y.d.ts.map +1 -1
  138. package/dist/components/image-cropper/index.js +7 -7
  139. package/dist/components/indicator/index.js +1 -1
  140. package/dist/components/input/index.js +2 -2
  141. package/dist/components/kbd/index.js +3 -3
  142. package/dist/components/kbd/kbd.d.ts.map +1 -1
  143. package/dist/components/lightbox/index.js +7 -7
  144. package/dist/components/menu/index.js +2 -2
  145. package/dist/components/modal/index.js +4 -4
  146. package/dist/components/multi-combobox-list/index.js +5 -5
  147. package/dist/components/multi-select/index.js +6 -6
  148. package/dist/components/number-input/index.js +3 -3
  149. package/dist/components/overlays/index.js +6 -6
  150. package/dist/components/password-input/index.js +3 -3
  151. package/dist/components/photo-capture/index.js +14 -14
  152. package/dist/components/pills-input/index.js +5 -5
  153. package/dist/components/pin-input/index.js +2 -2
  154. package/dist/components/radio-group/index.js +1 -1
  155. package/dist/components/rating/index.js +1 -1
  156. package/dist/components/schedule/index.js +5 -5
  157. package/dist/components/segment-group/index.js +4 -4
  158. package/dist/components/select/index.js +4 -4
  159. package/dist/components/slider/index.js +2 -2
  160. package/dist/components/spotlight/index.js +9 -9
  161. package/dist/components/switch/index.js +14 -19
  162. package/dist/components/switch/index.js.map +1 -1
  163. package/dist/components/switch/switch.d.ts +1 -0
  164. package/dist/components/switch/switch.d.ts.map +1 -1
  165. package/dist/components/table/index.js +1 -1
  166. package/dist/components/table/table.d.ts.map +1 -1
  167. package/dist/components/tabs/index.js +3 -3
  168. package/dist/components/tags-input/index.js +5 -5
  169. package/dist/components/text-input/index.js +2 -2
  170. package/dist/components/textarea/index.js +2 -2
  171. package/dist/components/theme-icon/index.js +1 -1
  172. package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
  173. package/dist/components/time-input/index.js +7 -7
  174. package/dist/components/tree-multi-select/index.js +6 -6
  175. package/dist/components/tree-select/index.js +3 -3
  176. package/dist/index.js +4 -4
  177. package/dist/theme.css +103 -23
  178. package/package.json +1 -1
  179. package/src/components/action-icon/action-icon.tsx +3 -1
  180. package/src/components/ambient-background/ambient-background.test.tsx +59 -0
  181. package/src/components/ambient-background/ambient-background.tsx +15 -2
  182. package/src/components/ambient-background/starfield.tsx +333 -0
  183. package/src/components/badge/badge.tsx +11 -6
  184. package/src/components/button/button.tsx +1 -1
  185. package/src/components/card/card.tsx +10 -9
  186. package/src/components/checkbox/checkbox.test.tsx +17 -9
  187. package/src/components/checkbox/checkbox.tsx +26 -27
  188. package/src/components/choice-card-group/choice-card-group.tsx +3 -3
  189. package/src/components/code-block/code-block.tsx +7 -4
  190. package/src/components/code-block/highlighter.test.ts +79 -1
  191. package/src/components/code-block/highlighter.ts +76 -30
  192. package/src/components/code-block/index.ts +2 -0
  193. package/src/components/code-block/languages.ts +63 -0
  194. package/src/components/code-block/static.tsx +2 -1
  195. package/src/components/data-table/data-table-pagination.tsx +5 -5
  196. package/src/components/data-table/data-table-stack.tsx +2 -2
  197. package/src/components/field/field.tsx +14 -0
  198. package/src/components/kbd/kbd.tsx +2 -1
  199. package/src/components/switch/switch.test.tsx +15 -0
  200. package/src/components/switch/switch.tsx +27 -27
  201. package/src/components/table/table.test.tsx +1 -1
  202. package/src/components/table/table.tsx +14 -11
  203. package/src/components/theme-icon/theme-icon.tsx +46 -12
  204. package/src/icon-stroke.test.tsx +2 -0
  205. package/src/theme.css +103 -23
  206. package/src/theme.test.ts +10 -2
  207. package/dist/chunk-2MXWEIMD.js.map +0 -1
  208. package/dist/chunk-6VYGK3Q3.js.map +0 -1
  209. package/dist/chunk-7CNDZZZ6.js +0 -95
  210. package/dist/chunk-7CNDZZZ6.js.map +0 -1
  211. package/dist/chunk-BE2LWUHY.js.map +0 -1
  212. package/dist/chunk-DT6LKNZF.js.map +0 -1
  213. package/dist/chunk-F342ZT7O.js.map +0 -1
  214. package/dist/chunk-SVKN5ZHX.js.map +0 -1
  215. package/dist/chunk-VD6PB3VA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;AAuCO,IAAM,iCAAA,GAAoC;AAAA,EAC/C,cAAA,EAAgB,WAAA;AAAA,EAChB,cAAA,EAAgB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BACA,IAAA,CAACA,aAAA,CAAI,OAAA,EAAJ,EAAY,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,UAAA,EAAY,OAAO,CAAA,EAGnE,QAAA,EAAA;AAAA,oCAAA,GAAA,CAACA,cAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT,CAAA;AAAA,wCACCA,aAAA,CAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT;AAAA,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-DHJB4UJD.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden` end-slot span. Render them as\n // direct children instead, and flag the shell's end padding\n // manually so the layout matches an `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;AAuCO,IAAM,iCAAA,GAAoC;AAAA,EAC/C,cAAA,EAAgB,WAAA;AAAA,EAChB,cAAA,EAAgB,WAAA;AAAA,EAChB,iBAAA,EAAmB;AACrB;AAMO,IAAM,aAAA,GAAwD;AAAA,EACnE,SAAA,kBAAW,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC7C,SAAA,kBAAW,GAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAW,UAAA,EAAY,CAAA;AAAA,EAC/C,KAAA,sBAAQ,SAAA,EAAA,EAAU;AACpB,CAAA;AAkHA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,yGAAA;AAAA,EACA,8FAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,UAAA,GAAa,CAAC,KAAA,KAClB,KAAA,KAAU,MAAA,GAAY,SAAY,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,MAAA,CAAO,KAAK,CAAA;AAGtE,IAAM,SAAA,GAAY,CAAC,GAAA,EAAa,GAAA,EAAa,GAAA,KAAwB;AACnE,EAAA,MAAM,IAAA,GAAO,MAAM,GAAA,GAAM,CAAA;AACzB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AAA,CAAG,SAAA,EAAW,aAAa,CAAA,EACrD,QAAA,EAAA,MAAA,EACH;AAAA,mBAAA,EAEJ,CAAA;AAAA,kBACC,QAAA,oBACC,GAAA;AAAA,oBAAC,QAAA;AAAA,oBAAA;AAAA,sBACC,IAAA,EAAK,QAAA;AAAA,sBACL,cAAY,oBAAA,CAAqB,iBAAA;AAAA,sBACjC,eAAa,CAAC,SAAA;AAAA,sBACd,QAAA,EAAU,YAAY,CAAA,GAAI,EAAA;AAAA,sBAC1B,aAAA,EAAe,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,sBAC/C,OAAA,EAAS,MAAM,GAAA,CAAI,UAAA,EAAW;AAAA,sBAC9B,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,CAAC,aAAa,WAAW,CAAA;AAAA,sBAE3D,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,mBACT;AAAA,kBAED,CAAC,YAAA,oBACA,IAAA,CAACA,aAAA,CAAI,OAAA,EAAJ,EAAY,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,UAAA,EAAY,OAAO,CAAA,EAGnE,QAAA,EAAA;AAAA,oCAAA,GAAA,CAACA,cAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT,CAAA;AAAA,wCACCA,aAAA,CAAI,gBAAA,EAAJ,EAAqB,SAAA,EAAW,cAAA,EAC9B,gBAAM,SAAA,EACT;AAAA,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-N5M4PDBK.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\nexport type NumberInputIconSlot = \"increment\" | \"decrement\" | \"clear\"\nexport type NumberInputIcons = IconMap<NumberInputIconSlot>\n\n/** The default icons: the steppers' chevrons and the clear button's ×. */\nexport const DEFAULT_ICONS: Record<NumberInputIconSlot, ReactNode> = {\n increment: <ChevronUp className={iconStroke} />,\n decrement: <ChevronDown className={iconStroke} />,\n clear: <CloseIcon />,\n}\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n /** Replaces the default icons: `increment`, `decrement`, `clear`. A missing key keeps its\n * default. */\n icons?: NumberInputIcons\n }\n\n/** The increment / decrement steppers — one class list for both, so they share one disabled\n * treatment. */\nconst stepperTrigger = cn(\n \"inline-flex h-1/2 w-6 shrink-0 cursor-pointer items-center justify-center rounded-xxs transition-colors\",\n \"[&:hover:not([data-disabled])]:bg-brand-900/6 dark:[&:hover:not([data-disabled])]:bg-white/8\",\n \"data-disabled:cursor-not-allowed data-disabled:text-brand-900/40 dark:data-disabled:text-white/35\",\n)\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n icons: iconsProp,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n const fieldRef = useMergedRefs(inputRef, ref)\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden` end-slot span. Render them as\n // direct children instead, and flag the shell's end padding\n // manually so the layout matches an `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={fieldRef}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n {icons.clear}\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n {/* Ark disables each stepper at its own bound (it only sees `min`/`max`\n * outside `wrap`, so wrapping fields keep both enabled) — controlled or not. */}\n <Ark.IncrementTrigger className={stepperTrigger}>\n {icons.increment}\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger className={stepperTrigger}>\n {icons.decrement}\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { OverlayLayerProvider } from './chunk-H7WOMZXO.js';
2
- import { ActionIcon } from './chunk-BE2LWUHY.js';
3
- import { devWarn } from './chunk-6N6J2DOE.js';
2
+ import { ActionIcon } from './chunk-BMEJBY6H.js';
3
+ import { devWarn } from './chunk-LIZWCWED.js';
4
4
  import { iconStroke, mergeIcons } from './chunk-XXOR34T4.js';
5
5
  import { props } from './chunk-WYCMIIRR.js';
6
6
  import { cn } from './chunk-4ASNIDV7.js';
@@ -100,5 +100,5 @@ var useDialogNameCheck = (component) => {
100
100
  };
101
101
 
102
102
  export { DIALOG_PADDING, DialogRootProviders, createDialogParts, useDialogNameCheck };
103
- //# sourceMappingURL=chunk-DA4QII2N.js.map
104
- //# sourceMappingURL=chunk-DA4QII2N.js.map
103
+ //# sourceMappingURL=chunk-NLSJ6T7V.js.map
104
+ //# sourceMappingURL=chunk-NLSJ6T7V.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/overlays/dialog-parts.tsx"],"names":[],"mappings":";;;;;;;;;;AAqCO,IAAM,cAAA,GAAuC;AAAA,EAClD,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,QAAA;AAAA,EACJ,EAAA,EAAI;AACN;AAEA,IAAM,OAAA,GAAU;AAAA,EACd,KAAA,EAAO;AAAA,IACL,MAAA,EACE,sGAAA;AAAA,IACF,IAAA,EAAM,qDAAA;AAAA,IACN,MAAA,EACE,0FAAA;AAAA,IACF,SAAA,EAAW;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EACE,+FAAA;AAAA,IACF,IAAA,EAAM,sDAAA;AAAA,IACN,MAAA,EACE,4FAAA;AAAA,IACF,SAAA,EAAW;AAAA;AAEf,CAAA;AAKA,IAAM,aAAA,GAAmD;AAAA,EACvD,KAAA,kBAAO,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY;AACvC,CAAA;AAGA,IAAM,YAAA,GAAe,cAAc,aAAa,CAAA;AAKzC,IAAM,sBAAsB,CAAC;AAAA,EAClC,KAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,qBAKE,GAAA,CAAC,YAAA,EAAA,EAAa,KAAA,EAAO,UAAA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AAC,IAAA,IAAQ,MAAA,CAAO,OAAA,EAAS;AAG7B,MAAA,qBAAA,CAAsB,MAAM;AAC1B,QAAA,IAAI,OAAO,OAAA,IAAW,CAAC,KAAK,WAAA,IAAe,iBAAA,CAAkB,IAAI,CAAA,EAAG;AACpE,QAAA,MAAA,CAAO,OAAA,GAAU,IAAA;AACjB,QAAA,OAAA;AAAA,UACE,CAAA,CAAA,EAAI,SAAS,CAAA,mHAAA,EACwC,SAAS,CAAA,wEAAA;AAAA,SAEhE;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAAA,IACA,CAAC,SAAS;AAAA,GACZ;AACF","file":"chunk-DA4QII2N.js","sourcesContent":["\"use client\"\n\nimport type { HTMLArkProps } from \"@ark-ui/react/factory\"\nimport { XIcon } from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type JSXElementConstructor,\n type ReactNode,\n useCallback,\n useContext,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { devWarn } from \"../../lib/dev-warn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { OverlayLayerProvider, type OverlayLayers } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\n\n/**\n * Internal parts shared by `Modal` and `Drawer`, which are the same dialog\n * chrome over two Ark machines. Not re-exported from the overlays barrel: the\n * public parts stay `Modal.*` / `Drawer.*`.\n *\n * The two surfaces differ only by their padding variable (`--modal-px` vs\n * `--drawer-px`), the close button's size, and Modal's header floor. Tailwind\n * only generates classes it finds written out in full, so each surface keeps\n * its literal class strings in one lookup instead of interpolating the var.\n */\n\nexport type DialogSurface = \"modal\" | \"drawer\"\n\n/** The `padding` token → the CSS length both surfaces set as their padding\n * variable (`--modal-px` / `--drawer-px`); the vertical rhythm derives from it. */\nexport const DIALOG_PADDING: Record<Size, string> = {\n xs: \"0.75rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n}\n\nconst SURFACE = {\n modal: {\n header:\n \"flex items-start min-h-15 justify-between gap-4 px-(--modal-px,1.25rem) pt-(--modal-px,1.25rem) pb-3\",\n body: \"flex-1 overflow-y-auto px-(--modal-px,1.25rem) py-1\",\n footer:\n \"flex items-center justify-end gap-2 px-(--modal-px,1.25rem) pb-(--modal-px,1.25rem) pt-4\",\n closeSize: \"xs\",\n },\n drawer: {\n header:\n \"flex items-start justify-between gap-4 px-(--drawer-px,1.25rem) pt-(--drawer-px,1.25rem) pb-3\",\n body: \"flex-1 overflow-y-auto px-(--drawer-px,1.25rem) py-1\",\n footer:\n \"flex items-center justify-end gap-2 px-(--drawer-px,1.25rem) pb-(--drawer-px,1.25rem) pt-4\",\n closeSize: \"sm\",\n },\n} as const\n\nexport type DialogIconSlot = \"close\"\nexport type DialogIcons = IconMap<DialogIconSlot>\n\nconst DEFAULT_ICONS: Record<DialogIconSlot, ReactNode> = {\n close: <XIcon className={iconStroke} />,\n}\n\n/** The root's resolved icons, for the close trigger. */\nconst IconsContext = createContext(DEFAULT_ICONS)\n\n/** What both roots wrap their children in: the resolved `icons` and the\n * nested-layer set from `useLayerGuard`, so a picker opened inside the dialog\n * closes on its own outside click without closing the dialog under it. */\nexport const DialogRootProviders = ({\n icons,\n layers,\n children,\n}: {\n icons?: DialogIcons\n layers: OverlayLayers\n children?: ReactNode\n}) => (\n <IconsContext value={mergeIcons(DEFAULT_ICONS, icons)}>\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </IconsContext>\n)\n\nexport type DialogCloseTriggerProps = HTMLArkProps<\"button\"> &\n WithTestId & {\n \"aria-label\"?: string\n }\n\nexport type DialogSectionProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Builds a surface's close trigger, header, body and footer. `ArkCloseTrigger`\n * is that machine's own `CloseTrigger` (Dialog's or Drawer's), since each\n * reads its own Ark context.\n */\nexport const createDialogParts = (\n surface: DialogSurface,\n ArkCloseTrigger: JSXElementConstructor<HTMLArkProps<\"button\">>,\n) => {\n const styles = SURFACE[surface]\n\n const CloseTrigger = ({\n children,\n className,\n \"aria-label\": ariaLabel,\n testId,\n asChild,\n ...rest\n }: DialogCloseTriggerProps) => {\n const icons = useContext(IconsContext)\n return asChild ? (\n // The consumer's element (a \"Cancel\" button, say) replaces the kit's icon\n // button outright, rather than nesting inside it.\n <ArkCloseTrigger\n asChild\n aria-label={ariaLabel}\n className={className}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkCloseTrigger>\n ) : (\n <ArkCloseTrigger asChild {...rest}>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size={styles.closeSize}\n aria-label={ariaLabel ?? \"Close\"}\n className={className}\n testId={testId}\n >\n {children ?? icons.close}\n </ActionIcon>\n </ArkCloseTrigger>\n )\n }\n\n const Header = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.header, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n const Body = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.body, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n const Footer = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.footer, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n return { CloseTrigger, Header, Body, Footer }\n}\n\n/** True when `node` has an `aria-label`, or an `aria-labelledby` naming an\n * element that is actually in the document. */\nconst hasAccessibleName = (node: HTMLElement) =>\n !!node.getAttribute(\"aria-label\")?.trim() ||\n (node.getAttribute(\"aria-labelledby\") ?? \"\")\n .split(/\\s+/)\n .some((id) => id !== \"\" && node.ownerDocument.getElementById(id) !== null)\n\n/**\n * A ref for a dialog's content that warns, in development, when the open\n * dialog has no accessible name: no `title`, no composed `Title` part, no\n * `aria-label` or `aria-labelledby`.\n *\n * It reads the DOM rather than the props because a composed `Modal.Title` /\n * `Drawer.Title` names the dialog without any prop saying so. Ark points the\n * content's `aria-labelledby` at the title's id before it knows whether a\n * title exists, then drops it a frame after opening once it finds none; so\n * the check waits that same frame and asks whether the id resolves, which\n * covers every way of naming the dialog. Warns once per instance.\n */\nexport const useDialogNameCheck = (component: \"Modal\" | \"Drawer\") => {\n const warned = useRef(false)\n return useCallback(\n (node: HTMLElement | null) => {\n if (!node || warned.current) return\n // Ark composes this ref without forwarding a cleanup, so a frame that\n // lands after the content unmounts is caught by `isConnected` instead.\n requestAnimationFrame(() => {\n if (warned.current || !node.isConnected || hasAccessibleName(node)) return\n warned.current = true\n devWarn(\n `[${component}] This dialog has no accessible name, so a screen reader announces ` +\n `it as just \"dialog\". Pass \\`title\\`, render a \\`${component}.Title\\` inside it, ` +\n \"or give it an `aria-label` or `aria-labelledby`.\",\n )\n })\n },\n [component],\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/overlays/dialog-parts.tsx"],"names":[],"mappings":";;;;;;;;;;AAqCO,IAAM,cAAA,GAAuC;AAAA,EAClD,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,QAAA;AAAA,EACJ,EAAA,EAAI;AACN;AAEA,IAAM,OAAA,GAAU;AAAA,EACd,KAAA,EAAO;AAAA,IACL,MAAA,EACE,sGAAA;AAAA,IACF,IAAA,EAAM,qDAAA;AAAA,IACN,MAAA,EACE,0FAAA;AAAA,IACF,SAAA,EAAW;AAAA,GACb;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,MAAA,EACE,+FAAA;AAAA,IACF,IAAA,EAAM,sDAAA;AAAA,IACN,MAAA,EACE,4FAAA;AAAA,IACF,SAAA,EAAW;AAAA;AAEf,CAAA;AAKA,IAAM,aAAA,GAAmD;AAAA,EACvD,KAAA,kBAAO,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY;A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AAE,MAAM,IAAI,CAAA;AActE,IAAM,kBAAA,GAAqB,CAAC,SAAA,KAAkC;AACnE,EAAA,MAAM,MAAA,GAAS,OAAO,KAAK,CAAA;AAC3B,EAAA,OAAO,WAAA;AAAA,IACL,CAAC,IAAA,KAA6B;AAC5B,MAAA,IAAI,CAAC,IAAA,IAAQ,MAAA,CAAO,OAAA,EAAS;AAG7B,MAAA,qBAAA,CAAsB,MAAM;AAC1B,QAAA,IAAI,OAAO,OAAA,IAAW,CAAC,KAAK,WAAA,IAAe,iBAAA,CAAkB,IAAI,CAAA,EAAG;AACpE,QAAA,MAAA,CAAO,OAAA,GAAU,IAAA;AACjB,QAAA,OAAA;AAAA,UACE,CAAA,CAAA,EAAI,SAAS,CAAA,mHAAA,EACwC,SAAS,CAAA,wEAAA;AAAA,SAEhE;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAAA,IACA,CAAC,SAAS;AAAA,GACZ;AACF","file":"chunk-NLSJ6T7V.js","sourcesContent":["\"use client\"\n\nimport type { HTMLArkProps } from \"@ark-ui/react/factory\"\nimport { XIcon } from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type JSXElementConstructor,\n type ReactNode,\n useCallback,\n useContext,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { devWarn } from \"../../lib/dev-warn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { OverlayLayerProvider, type OverlayLayers } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\n\n/**\n * Internal parts shared by `Modal` and `Drawer`, which are the same dialog\n * chrome over two Ark machines. Not re-exported from the overlays barrel: the\n * public parts stay `Modal.*` / `Drawer.*`.\n *\n * The two surfaces differ only by their padding variable (`--modal-px` vs\n * `--drawer-px`), the close button's size, and Modal's header floor. Tailwind\n * only generates classes it finds written out in full, so each surface keeps\n * its literal class strings in one lookup instead of interpolating the var.\n */\n\nexport type DialogSurface = \"modal\" | \"drawer\"\n\n/** The `padding` token → the CSS length both surfaces set as their padding\n * variable (`--modal-px` / `--drawer-px`); the vertical rhythm derives from it. */\nexport const DIALOG_PADDING: Record<Size, string> = {\n xs: \"0.75rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n}\n\nconst SURFACE = {\n modal: {\n header:\n \"flex items-start min-h-15 justify-between gap-4 px-(--modal-px,1.25rem) pt-(--modal-px,1.25rem) pb-3\",\n body: \"flex-1 overflow-y-auto px-(--modal-px,1.25rem) py-1\",\n footer:\n \"flex items-center justify-end gap-2 px-(--modal-px,1.25rem) pb-(--modal-px,1.25rem) pt-4\",\n closeSize: \"xs\",\n },\n drawer: {\n header:\n \"flex items-start justify-between gap-4 px-(--drawer-px,1.25rem) pt-(--drawer-px,1.25rem) pb-3\",\n body: \"flex-1 overflow-y-auto px-(--drawer-px,1.25rem) py-1\",\n footer:\n \"flex items-center justify-end gap-2 px-(--drawer-px,1.25rem) pb-(--drawer-px,1.25rem) pt-4\",\n closeSize: \"sm\",\n },\n} as const\n\nexport type DialogIconSlot = \"close\"\nexport type DialogIcons = IconMap<DialogIconSlot>\n\nconst DEFAULT_ICONS: Record<DialogIconSlot, ReactNode> = {\n close: <XIcon className={iconStroke} />,\n}\n\n/** The root's resolved icons, for the close trigger. */\nconst IconsContext = createContext(DEFAULT_ICONS)\n\n/** What both roots wrap their children in: the resolved `icons` and the\n * nested-layer set from `useLayerGuard`, so a picker opened inside the dialog\n * closes on its own outside click without closing the dialog under it. */\nexport const DialogRootProviders = ({\n icons,\n layers,\n children,\n}: {\n icons?: DialogIcons\n layers: OverlayLayers\n children?: ReactNode\n}) => (\n <IconsContext value={mergeIcons(DEFAULT_ICONS, icons)}>\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </IconsContext>\n)\n\nexport type DialogCloseTriggerProps = HTMLArkProps<\"button\"> &\n WithTestId & {\n \"aria-label\"?: string\n }\n\nexport type DialogSectionProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Builds a surface's close trigger, header, body and footer. `ArkCloseTrigger`\n * is that machine's own `CloseTrigger` (Dialog's or Drawer's), since each\n * reads its own Ark context.\n */\nexport const createDialogParts = (\n surface: DialogSurface,\n ArkCloseTrigger: JSXElementConstructor<HTMLArkProps<\"button\">>,\n) => {\n const styles = SURFACE[surface]\n\n const CloseTrigger = ({\n children,\n className,\n \"aria-label\": ariaLabel,\n testId,\n asChild,\n ...rest\n }: DialogCloseTriggerProps) => {\n const icons = useContext(IconsContext)\n return asChild ? (\n // The consumer's element (a \"Cancel\" button, say) replaces the kit's icon\n // button outright, rather than nesting inside it.\n <ArkCloseTrigger\n asChild\n aria-label={ariaLabel}\n className={className}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkCloseTrigger>\n ) : (\n <ArkCloseTrigger asChild {...rest}>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size={styles.closeSize}\n aria-label={ariaLabel ?? \"Close\"}\n className={className}\n testId={testId}\n >\n {children ?? icons.close}\n </ActionIcon>\n </ArkCloseTrigger>\n )\n }\n\n const Header = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.header, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n const Body = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.body, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n const Footer = ({ className, testId, ...rest }: DialogSectionProps) => (\n <div className={cn(styles.footer, className)} {...props({ \"data-testid\": testId })} {...rest} />\n )\n\n return { CloseTrigger, Header, Body, Footer }\n}\n\n/** True when `node` has an `aria-label`, or an `aria-labelledby` naming an\n * element that is actually in the document. */\nconst hasAccessibleName = (node: HTMLElement) =>\n !!node.getAttribute(\"aria-label\")?.trim() ||\n (node.getAttribute(\"aria-labelledby\") ?? \"\")\n .split(/\\s+/)\n .some((id) => id !== \"\" && node.ownerDocument.getElementById(id) !== null)\n\n/**\n * A ref for a dialog's content that warns, in development, when the open\n * dialog has no accessible name: no `title`, no composed `Title` part, no\n * `aria-label` or `aria-labelledby`.\n *\n * It reads the DOM rather than the props because a composed `Modal.Title` /\n * `Drawer.Title` names the dialog without any prop saying so. Ark points the\n * content's `aria-labelledby` at the title's id before it knows whether a\n * title exists, then drops it a frame after opening once it finds none; so\n * the check waits that same frame and asks whether the id resolves, which\n * covers every way of naming the dialog. Warns once per instance.\n */\nexport const useDialogNameCheck = (component: \"Modal\" | \"Drawer\") => {\n const warned = useRef(false)\n return useCallback(\n (node: HTMLElement | null) => {\n if (!node || warned.current) return\n // Ark composes this ref without forwarding a cleanup, so a frame that\n // lands after the content unmounts is caught by `isConnected` instead.\n requestAnimationFrame(() => {\n if (warned.current || !node.isConnected || hasAccessibleName(node)) return\n warned.current = true\n devWarn(\n `[${component}] This dialog has no accessible name, so a screen reader announces ` +\n `it as just \"dialog\". Pass \\`title\\`, render a \\`${component}.Title\\` inside it, ` +\n \"or give it an `aria-label` or `aria-labelledby`.\",\n )\n })\n },\n [component],\n )\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Button } from './chunk-SWVUXEBT.js';
1
+ import { Button } from './chunk-SCXXJDKQ.js';
2
2
  import { props } from './chunk-WYCMIIRR.js';
3
3
  import { ark } from '@ark-ui/react';
4
4
  import { useRef } from 'react';
@@ -89,5 +89,5 @@ var FileTrigger = ({
89
89
  };
90
90
 
91
91
  export { FileTrigger };
92
- //# sourceMappingURL=chunk-UT3TOV2Q.js.map
93
- //# sourceMappingURL=chunk-UT3TOV2Q.js.map
92
+ //# sourceMappingURL=chunk-OVT2KZHY.js.map
93
+ //# sourceMappingURL=chunk-OVT2KZHY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/file-trigger/file-trigger.tsx"],"names":[],"mappings":";;;;;;AA8CO,IAAM,cA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AAA;AAAA,UACC,GAAG,KAAA,CAAM,EAAE,eAAA,EAAiB,UAAU,CAAA;AAAA,UACtC,GAAG,OAAA;AAAA,UAEH;AAAA;AAAA;AACH,wBAEA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA;AAAA,QACA,IAAA;AAAA,QACA,KAAA;AAAA,QACA,OAAA;AAAA,QACA,SAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACC,GAAG,OAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,oBAEF,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,KAAA;AAAA,QACL,IAAA,EAAK,MAAA;AAAA,QACL,MAAA,EAAM,IAAA;AAAA,QACN,QAAA,EAAU,EAAA;AAAA,QACV,aAAA,EAAW,IAAA;AAAA,QACX,MAAA,EAAQ,MAAM,OAAA,CAAQ,MAAM,IAAI,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,QACnD,OAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,MAAA;AAAA,QACV,YAAA,EAAW,cAAA;AAAA,QACX,WAAA,EAAU;AAAA;AAAA;AACZ,GAAA,EACF,CAAA;AAEJ","file":"chunk-UT3TOV2Q.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react\"\nimport { type ChangeEvent, type MouseEvent, useRef } from \"react\"\nimport { props } from \"../../lib/props\"\nimport { Button, type ButtonProps } from \"../button/button\"\n\n/**\n * FileTrigger — a button that opens the OS file picker (or, on a phone, the\n * native camera), backed by a hidden `<input type=\"file\">`. It has no\n * dropzone and no file list: it hands the picked `File[]` to `onSelect` and\n * leaves the rest to you. Reach for `FileUpload` when you want the full\n * field.\n *\n * - Renders a kit `Button` by default, and takes every Button prop. With\n * `asChild`, any element becomes the trigger: an `ActionIcon`, a link\n * styled as a button, a `Menu.Item`. Style the child then; Button's own\n * style props (`variant`, `size`, …) only apply to the default render.\n * - `capture` asks a phone for its camera instead of the library. Desktop\n * browsers ignore it and open the file picker.\n * - The input is cleared after each pick, so choosing the same file twice\n * fires `onSelect` twice. Pass `name` and the input keeps its files\n * instead, so a native `<form>` submits them.\n * - The trigger is the only element a keyboard or a screen reader reaches;\n * the input is `hidden`, out of the tab order and out of the a11y tree.\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onSelect={([file]) => setAvatar(file)}>\n * Choose a photo\n * </FileTrigger>\n * ```\n */\n\nexport type FileTriggerProps = Omit<ButtonProps, \"onSelect\" | \"name\" | \"type\"> & {\n /** Accepted types: MIME types, globs or extensions (`\"image/*\"`, `[\".pdf\", \".docx\"]`). */\n accept?: string | string[]\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the library. */\n capture?: \"user\" | \"environment\"\n /** Allows picking several files at once. */\n multiple?: boolean\n /** Fires with the picked files. */\n onSelect?: (files: File[]) => void\n /** Wires the hidden input into native form submission; the input then keeps its files. */\n name?: string\n}\n\nexport const FileTrigger = ({\n accept,\n capture,\n multiple,\n onSelect,\n name,\n disabled,\n asChild,\n children,\n testId,\n onClick,\n variant,\n size,\n color,\n loading,\n startSlot,\n endSlot,\n ...rest\n}: FileTriggerProps) => {\n const input = useRef<HTMLInputElement>(null)\n\n // `onClick` runs first, so a caller can `preventDefault()` to keep the\n // picker shut (a confirm step, a quota check).\n const open = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && !disabled) input.current?.click()\n }\n\n const select = (event: ChangeEvent<HTMLInputElement>) => {\n onSelect?.(Array.from(event.currentTarget.files ?? []))\n // A file input only fires `change` when its value changes, so picking the\n // same file again would be silent. A named input is form state, so it\n // keeps what was picked.\n if (name == null) event.currentTarget.value = \"\"\n }\n\n const trigger = {\n \"data-scope\": \"file-trigger\",\n \"data-part\": \"trigger\",\n onClick: open,\n ...props({ \"data-testid\": testId, \"data-disabled\": disabled }),\n ...rest,\n }\n\n return (\n <>\n {asChild ? (\n // Only behaviour is merged onto the child: Button's styling would\n // fight an ActionIcon's or a link's own.\n <ark.button\n asChild\n disabled={disabled}\n {...props({ \"aria-disabled\": disabled })}\n {...trigger}\n >\n {children}\n </ark.button>\n ) : (\n <Button\n variant={variant}\n size={size}\n color={color}\n loading={loading}\n startSlot={startSlot}\n endSlot={endSlot}\n disabled={disabled}\n {...trigger}\n >\n {children}\n </Button>\n )}\n <input\n ref={input}\n type=\"file\"\n hidden\n tabIndex={-1}\n aria-hidden\n accept={Array.isArray(accept) ? accept.join(\",\") : accept}\n capture={capture}\n multiple={multiple}\n name={name}\n disabled={disabled}\n onChange={select}\n data-scope=\"file-trigger\"\n data-part=\"input\"\n />\n </>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/components/file-trigger/file-trigger.tsx"],"names":[],"mappings":";;;;;;AA8CO,IAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAwB;AACtB,EAAA,MAAM,KAAA,GAAQ,OAAyB,IAAI,CAAA;AAI3C,EAAA,MAAM,IAAA,GAAO,CAAC,KAAA,KAAyC;AACrD,IAAA,OAAA,GAAU,KAAK,CAAA;AACf,IAAA,IAAI,CAAC,KAAA,CAAM,gBAAA,IAAoB,CAAC,QAAA,EAAU,KAAA,CAAM,SAAS,KAAA,EAAM;AAAA,EACjE,CAAA;AAEA,EAAA,MAAM,MAAA,GAAS,CAAC,KAAA,KAAyC;AACvD,IAAA,QAAA,GAAW,MAAM,IAAA,CAAK,KAAA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AA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,MAAA;AAAA,QACV,YAAA,EAAW,cAAA;AAAA,QACX,WAAA,EAAU;AAAA;AAAA;AACZ,GAAA,EACF,CAAA;AAEJ","file":"chunk-OVT2KZHY.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react\"\nimport { type ChangeEvent, type MouseEvent, useRef } from \"react\"\nimport { props } from \"../../lib/props\"\nimport { Button, type ButtonProps } from \"../button/button\"\n\n/**\n * FileTrigger — a button that opens the OS file picker (or, on a phone, the\n * native camera), backed by a hidden `<input type=\"file\">`. It has no\n * dropzone and no file list: it hands the picked `File[]` to `onSelect` and\n * leaves the rest to you. Reach for `FileUpload` when you want the full\n * field.\n *\n * - Renders a kit `Button` by default, and takes every Button prop. With\n * `asChild`, any element becomes the trigger: an `ActionIcon`, a link\n * styled as a button, a `Menu.Item`. Style the child then; Button's own\n * style props (`variant`, `size`, …) only apply to the default render.\n * - `capture` asks a phone for its camera instead of the library. Desktop\n * browsers ignore it and open the file picker.\n * - The input is cleared after each pick, so choosing the same file twice\n * fires `onSelect` twice. Pass `name` and the input keeps its files\n * instead, so a native `<form>` submits them.\n * - The trigger is the only element a keyboard or a screen reader reaches;\n * the input is `hidden`, out of the tab order and out of the a11y tree.\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onSelect={([file]) => setAvatar(file)}>\n * Choose a photo\n * </FileTrigger>\n * ```\n */\n\nexport type FileTriggerProps = Omit<ButtonProps, \"onSelect\" | \"name\" | \"type\"> & {\n /** Accepted types: MIME types, globs or extensions (`\"image/*\"`, `[\".pdf\", \".docx\"]`). */\n accept?: string | string[]\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the library. */\n capture?: \"user\" | \"environment\"\n /** Allows picking several files at once. */\n multiple?: boolean\n /** Fires with the picked files. */\n onSelect?: (files: File[]) => void\n /** Wires the hidden input into native form submission; the input then keeps its files. */\n name?: string\n}\n\nexport const FileTrigger = ({\n accept,\n capture,\n multiple,\n onSelect,\n name,\n disabled,\n asChild,\n children,\n testId,\n onClick,\n variant,\n size,\n color,\n loading,\n startSlot,\n endSlot,\n ...rest\n}: FileTriggerProps) => {\n const input = useRef<HTMLInputElement>(null)\n\n // `onClick` runs first, so a caller can `preventDefault()` to keep the\n // picker shut (a confirm step, a quota check).\n const open = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && !disabled) input.current?.click()\n }\n\n const select = (event: ChangeEvent<HTMLInputElement>) => {\n onSelect?.(Array.from(event.currentTarget.files ?? []))\n // A file input only fires `change` when its value changes, so picking the\n // same file again would be silent. A named input is form state, so it\n // keeps what was picked.\n if (name == null) event.currentTarget.value = \"\"\n }\n\n const trigger = {\n \"data-scope\": \"file-trigger\",\n \"data-part\": \"trigger\",\n onClick: open,\n ...props({ \"data-testid\": testId, \"data-disabled\": disabled }),\n ...rest,\n }\n\n return (\n <>\n {asChild ? (\n // Only behaviour is merged onto the child: Button's styling would\n // fight an ActionIcon's or a link's own.\n <ark.button\n asChild\n disabled={disabled}\n {...props({ \"aria-disabled\": disabled })}\n {...trigger}\n >\n {children}\n </ark.button>\n ) : (\n <Button\n variant={variant}\n size={size}\n color={color}\n loading={loading}\n startSlot={startSlot}\n endSlot={endSlot}\n disabled={disabled}\n {...trigger}\n >\n {children}\n </Button>\n )}\n <input\n ref={input}\n type=\"file\"\n hidden\n tabIndex={-1}\n aria-hidden\n accept={Array.isArray(accept) ? accept.join(\",\") : accept}\n capture={capture}\n multiple={multiple}\n name={name}\n disabled={disabled}\n onChange={select}\n data-scope=\"file-trigger\"\n data-part=\"input\"\n />\n </>\n )\n}\n"]}
@@ -8,27 +8,30 @@ import { jsx, jsxs } from 'react/jsx-runtime';
8
8
 
9
9
  var tableContainer = cn(
10
10
  "flex w-full flex-col overflow-hidden contain-layout",
11
- // Brand-derived border, matching InputBase/Popover/Modal/Drawer's shell
12
- // (border-brand-900/20 dark:border-white/15) rather than a neutral gray.
13
- "rounded-sm border border-brand-900/20 dark:border-white/15"
11
+ // The table is a card: the same surface as Card's default — white 4%,
12
+ // edged white 8% (Figma's `bg-primary` / `border-primary`) — at the radius
13
+ // Figma draws for a table (12, node 22286-101476). One surface, laid once
14
+ // on the frame: the header, the rows and the pagination band are clear, so
15
+ // the pagination reads as part of the table, not as a darker strip.
16
+ "rounded-xl border border-brand-900/20 dark:border-white/8 dark:bg-white/4"
14
17
  );
15
18
  var tableVariants = cva(
16
19
  [
17
20
  // Row separators — on cells, since separate-mode ignores <tr> borders.
18
21
  "[&_tbody_tr:not(:last-child)_td]:border-b",
19
- "[&_tbody_td]:border-brand-900/20 dark:[&_tbody_td]:border-white/15",
22
+ "[&_tbody_td]:border-brand-900/20 dark:[&_tbody_td]:border-white/8",
20
23
  // Cells
21
24
  "[&_td]:align-middle",
22
25
  "[&_th]:text-start [&_th]:align-middle [&_th]:font-medium [&_th]:text-brand-950 dark:[&_th]:text-white",
23
26
  // Header — subtle fill + a bottom separator that survives sticky. Same
24
27
  // brand-tinted fill Popover/Modal/Drawer use for their own surface, at
25
28
  // the same /90 light /85 dark opacity recipe.
26
- "[&_thead]:bg-brand-50/90 dark:[&_thead]:bg-brand-950/85",
27
- "[&_thead_th]:border-b [&_thead_th]:border-brand-900/20 dark:[&_thead_th]:border-white/15",
29
+ "[&_thead]:bg-brand-50/90 dark:[&_thead]:bg-transparent",
30
+ "[&_thead_th]:border-b [&_thead_th]:border-brand-900/20 dark:[&_thead_th]:border-white/8",
28
31
  // Footer — subtle fill + a top separator that survives sticky.
29
- "[&_tfoot]:bg-brand-50/90 dark:[&_tfoot]:bg-brand-950/85 [&_tfoot]:font-medium",
32
+ "[&_tfoot]:bg-brand-50/90 dark:[&_tfoot]:bg-transparent [&_tfoot]:font-medium",
30
33
  "[&_tfoot_th]:border-t [&_tfoot_td]:border-t",
31
- "[&_tfoot_th]:border-brand-900/20 [&_tfoot_td]:border-brand-900/20 dark:[&_tfoot_th]:border-white/15 dark:[&_tfoot_td]:border-white/15",
34
+ "[&_tfoot_th]:border-brand-900/20 [&_tfoot_td]:border-brand-900/20 dark:[&_tfoot_th]:border-white/8 dark:[&_tfoot_td]:border-white/8",
32
35
  // Excludes a `data-placeholder` row (an empty/error/loading state, e.g.
33
36
  // `DataTable`'s) — it has no row to hover, so it shouldn't tint like one.
34
37
  // Black/white wash, same convention as Popover/Menu/TreeSelect's own row
@@ -53,8 +56,8 @@ var tableVariants = cva(
53
56
  defaultVariants: { size: "md", striped: false }
54
57
  }
55
58
  );
56
- var stickyHeaderClasses = "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:backdrop-blur-lg";
57
- var stickyFooterClasses = "[&_tfoot]:sticky [&_tfoot]:bottom-0 [&_tfoot]:z-10 [&_tfoot]:backdrop-blur-lg";
59
+ var stickyHeaderClasses = "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:backdrop-blur-lg dark:[&_thead]:bg-brand-950/85";
60
+ var stickyFooterClasses = "[&_tfoot]:sticky [&_tfoot]:bottom-0 [&_tfoot]:z-10 [&_tfoot]:backdrop-blur-lg dark:[&_tfoot]:bg-brand-950/85";
58
61
  var TableRoot = ({
59
62
  className,
60
63
  size,
@@ -83,7 +86,7 @@ var TableToolbar = ({ className, testId, ...rest }) => /* @__PURE__ */ jsx(
83
86
  ...props({ "data-testid": testId }),
84
87
  ...rest,
85
88
  className: cn(
86
- "flex shrink-0 items-center justify-between gap-2 border-b border-brand-900/20 px-3 ps-5 py-3 dark:border-white/15",
89
+ "flex shrink-0 items-center justify-between gap-2 border-b border-brand-900/20 px-3 ps-5 py-3 dark:border-white/8",
87
90
  className
88
91
  )
89
92
  }
@@ -204,5 +207,5 @@ var Table = Object.assign(TableRoot, {
204
207
  });
205
208
 
206
209
  export { Table };
207
- //# sourceMappingURL=chunk-SVKN5ZHX.js.map
208
- //# sourceMappingURL=chunk-SVKN5ZHX.js.map
210
+ //# sourceMappingURL=chunk-P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QAAQ,CAAA;AAAA,IAClC,GAAG,IAAA;AAAA,IACJ,SAAA,EAAW,SAAA,GAAY,EAAA,CAAG,SAAS,CAAA,GAAI;AAAA;AACzC,CAAA;AAGK,IAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,SAAA,EAAW;AAAA,EAC5C,OAAA,EAAS,YAAA;AAAA,EACT,KAAA,EAAO,UAAA;AAAA,EACP,OAAA,EAAS,YAAA;AAAA,EACT,IAAA,EAAM,SAAA;AAAA,EACN,IAAA,EAAM,SAAA;AAAA,EACN,IAAA,EAAM,SAAA;AAAA,EACN,GAAA,EAAK,QAAA;AAAA,EACL,UAAA,EAAY,eAAA;AAAA,EACZ,IAAA,EAAM;AACR,CAAC","file":"chunk-PEHFWGTT.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * The outermost element: a bordered, rounded surface that `overflow-hidden`\n * clips. Clipping is what keeps the rounded corners intact once the inner\n * scroll region shows a scrollbar (a scrollbar on the *rounded* element would\n * otherwise square off its corners). `flex flex-col` lets an optional\n * `Table.Toolbar` stack above the scroll region.\n *\n * `contain-layout` stops a bug that only shows up when this sits inside an\n * ancestor chain with no *definite* height (e.g. a CSS Grid track sized off\n * `min-height`, not `height` — common when a page fills the viewport via a\n * grid). Without it, a browser can size that indefinite ancestor off this\n * box's unclipped descendants' natural size — the *actual* content behind\n * an internal `overflow-auto`/`max-h-*` scroll region, not its rendered,\n * already-clipped size — inflating the whole page's scroll height in\n * proportion to row count despite this box's own height staying correct.\n * `contain: layout` declares this subtree's size as fully self-contained, so\n * an indefinite ancestor sizes off its real (bounded) box instead. Doesn't\n * affect `stickyHeader`/`stickyFooter` (governed by the nearest *scrolling*\n * ancestor, not containing-block/layout-containment rules) or the absolute-\n * positioned `.table-fade-*` overlays (already resolve against\n * `.table-scroll-frame`'s own `position: relative` in theme.css).\n */\nconst tableContainer = cn(\n \"flex w-full flex-col overflow-hidden contain-layout\",\n // The table is a card: the same surface as Card's default — white 4%,\n // edged white 8% (Figma's `bg-primary` / `border-primary`) — at the radius\n // Figma draws for a table (12, node 22286-101476). One surface, laid once\n // on the frame: the header, the rows and the pagination band are clear, so\n // the pagination reads as part of the table, not as a darker strip.\n \"rounded-xl border border-brand-900/20 dark:border-white/8 dark:bg-white/4\",\n)\n\n/**\n * All table styling rides on the container as descendant-selector classes, so\n * the part components stay dumb and `size` / `striped` / sticky can live on\n * `<Table>` (the root) without React context — keeping the whole thing a pure\n * Server Component. Every variant value is a static class string so Tailwind\n * v4's scanner keeps it.\n *\n * The `<table>` uses `border-collapse: separate` (see `TableContent`): collapsed\n * borders detach from sticky `<thead>` / `<tfoot>` while scrolling, so the\n * header/footer separators are cell borders (`thead th` bottom, `tfoot td/th`\n * top) that stay put when pinned.\n */\nconst tableVariants = cva(\n [\n // Row separators — on cells, since separate-mode ignores <tr> borders.\n \"[&_tbody_tr:not(:last-child)_td]:border-b\",\n \"[&_tbody_td]:border-brand-900/20 dark:[&_tbody_td]:border-white/8\",\n // Cells\n \"[&_td]:align-middle\",\n \"[&_th]:text-start [&_th]:align-middle [&_th]:font-medium [&_th]:text-brand-950 dark:[&_th]:text-white\",\n // Header — subtle fill + a bottom separator that survives sticky. Same\n // brand-tinted fill Popover/Modal/Drawer use for their own surface, at\n // the same /90 light /85 dark opacity recipe.\n \"[&_thead]:bg-brand-50/90 dark:[&_thead]:bg-transparent\",\n \"[&_thead_th]:border-b [&_thead_th]:border-brand-900/20 dark:[&_thead_th]:border-white/8\",\n // Footer — subtle fill + a top separator that survives sticky.\n \"[&_tfoot]:bg-brand-50/90 dark:[&_tfoot]:bg-transparent [&_tfoot]:font-medium\",\n \"[&_tfoot_th]:border-t [&_tfoot_td]:border-t\",\n \"[&_tfoot_th]:border-brand-900/20 [&_tfoot_td]:border-brand-900/20 dark:[&_tfoot_th]:border-white/8 dark:[&_tfoot_td]:border-white/8\",\n // Excludes a `data-placeholder` row (an empty/error/loading state, e.g.\n // `DataTable`'s) — it has no row to hover, so it shouldn't tint like one.\n // Black/white wash, same convention as Popover/Menu/TreeSelect's own row\n // highlight — background-dependent instead of a fixed per-theme gray.\n \"[&_tbody_tr:not([data-placeholder]):hover]:bg-black/5! dark:[&_tbody_tr:not([data-placeholder]):hover]:bg-white/8! [&_tbody_tr]:transition-colors\",\n ],\n {\n variants: {\n // Cell padding + text scale, keyed to the kit's canonical `Size` scale.\n size: {\n xs: \"text-xs [&_th]:px-2 [&_td]:px-2 [&_th]:py-1 [&_td]:py-1\",\n sm: \"text-sm [&_th]:px-2.5 [&_td]:px-2.5 [&_th]:py-1.5 [&_td]:py-1.5\",\n md: \"text-sm [&_th]:px-3 [&_td]:px-3 [&_th]:py-2.5 [&_td]:py-2.5\",\n lg: \"text-base [&_th]:px-4 [&_td]:px-4 [&_th]:py-3 [&_td]:py-3\",\n xl: \"text-base [&_th]:px-4 [&_td]:px-4 [&_th]:py-4 [&_td]:py-4\",\n },\n striped: {\n true: \"[&_tbody_tr:nth-child(even)]:bg-black/3 dark:[&_tbody_tr:nth-child(even)]:bg-white/4\",\n false: \"\",\n },\n },\n defaultVariants: { size: \"md\", striped: false },\n },\n)\n\n/** Pin the whole `<thead>` to the top of the scroll region; `backdrop-blur`\n * keeps scrolled body rows legible behind the translucent header fill. */\nconst stickyHeaderClasses =\n \"[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:backdrop-blur-lg dark:[&_thead]:bg-brand-950/85\"\n\n/** Pin the whole `<tfoot>` (e.g. a totals row) to the bottom of the scroll region. */\nconst stickyFooterClasses =\n \"[&_tfoot]:sticky [&_tfoot]:bottom-0 [&_tfoot]:z-10 [&_tfoot]:backdrop-blur-lg dark:[&_tfoot]:bg-brand-950/85\"\n\n/** `Table`'s density scale — the kit's canonical `Size` (xs–xl). */\nexport type TableSize = Size\n\nexport type TableProps = HTMLArkProps<\"div\"> &\n VariantProps<typeof tableVariants> &\n WithTestId & {\n /** Pins the header row during vertical scroll. Needs a bounded height —\n * set `max-h-*` on `Table` or `Table.Content`. */\n stickyHeader?: boolean\n /** Pins a `Table.Foot` row (e.g. totals) to the bottom during vertical\n * scroll. Same bounded-height requirement as `stickyHeader`. */\n stickyFooter?: boolean\n }\n\n/**\n * Table — a dumb, styled semantic `<table>` inside a bordered, rounded surface.\n * Pure React Server Component (no `\"use client\"`): static markup, no state, so\n * it's safe in an RSC tree and usable for static / MDX tables. Composed from\n * namespaced parts: an optional non-table header (`Table.Toolbar` +\n * `Table.Title` for a title and actions), a `Table.Content` scroll region that\n * holds the `<table>`, and the semantic parts `Table.Head` / `Table.Body` /\n * `Table.Foot` / `Table.Row` / `Table.HeaderCell` / `Table.Cell`.\n *\n * Density (`size`), `striped`, and `stickyHeader` / `stickyFooter` ride on\n * `<Table>` and style the table via descendant selectors. To pin a header or\n * footer, give the scroll region a bounded height (`max-h-*` on `Table` or\n * `Table.Content`). The rounded border is `overflow-hidden`, so the corners\n * stay intact even once a scrollbar appears. There is no `variant`×`color`\n * axis — a table retints from `:root` slot vars via CSS.\n *\n * <Table striped size=\"sm\" stickyHeader className=\"max-h-80\">\n * <Table.Toolbar>\n * <Table.Title>Users</Table.Title>\n * <Button size=\"sm\">Add</Button>\n * </Table.Toolbar>\n * <Table.Content>\n * <Table.Head>\n * <Table.Row>\n * <Table.HeaderCell>Name</Table.HeaderCell>\n * <Table.HeaderCell className=\"text-right\">Age</Table.HeaderCell>\n * </Table.Row>\n * </Table.Head>\n * <Table.Body>\n * <Table.Row>\n * <Table.Cell>Ada</Table.Cell>\n * <Table.Cell className=\"text-right\">36</Table.Cell>\n * </Table.Row>\n * </Table.Body>\n * </Table.Content>\n * </Table>\n */\nconst TableRoot = ({\n className,\n size,\n striped,\n stickyHeader,\n stickyFooter,\n testId,\n ...rest\n}: TableProps) => (\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n tableContainer,\n tableVariants({ size, striped }),\n stickyHeader && stickyHeaderClasses,\n stickyFooter && stickyFooterClasses,\n className,\n )}\n />\n)\n\nexport type TableToolbarProps = HTMLArkProps<\"div\"> & WithTestId\n\n/** Non-`<table>` header bar: a title + actions row above the scroll region,\n * separated by a bottom border. `shrink-0` so it never collapses when the\n * content scrolls. */\nconst TableToolbar = ({ className, testId, ...rest }: TableToolbarProps) => (\n <ark.div\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"flex shrink-0 items-center justify-between gap-2 border-b border-brand-900/20 px-3 ps-5 py-3 dark:border-white/8\",\n className,\n )}\n />\n)\n\nexport type TableTitleProps = HTMLArkProps<\"h3\"> & WithTestId\n\nconst TableTitle = ({ className, testId, ...rest }: TableTitleProps) => (\n <ark.h3\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\"font-semibold tracking-normal\", className)}\n />\n)\n\nexport type TableContentProps = HTMLArkProps<\"table\"> &\n WithTestId & {\n /** Style the inner `<table>` element; `className` targets the scroll region. */\n classNames?: { table?: string }\n }\n\n/** The scroll region + the `<table>`, framed so horizontal scroll affordances\n * (soft edge shadows on each side with more to scroll) can overlay it. `className`\n * bounds the scroll surface (`max-h-*` here bounds a sticky header/footer);\n * `classNames.table` styles the `<table>`. `border-separate` keeps sticky\n * header/footer borders. The `table-scroll-*` / `table-fade-*` classes are the\n * scroll-driven-animation affordance defined in theme.css. */\nconst TableContent = ({ className, classNames, testId, ...rest }: TableContentProps) => (\n <div className={cn(\"table-scroll-frame flex min-h-0 flex-1 flex-col\", className)}>\n <section\n // A scroller must be reachable by keyboard, or arrow keys can't scroll it\n // (axe `scrollable-region-focusable`). Always, not only once it overflows:\n // knowing that would take a layout read, and this part is a Server Component.\n // biome-ignore lint/a11y/noNoninteractiveTabindex: a scroll region must be reachable by keyboard\n tabIndex={0}\n // A `<section>` is a region landmark only once it has a name, and it takes the\n // table's own: name the table (`aria-labelledby` a `Table.Title`'s id) and the\n // region says the same thing. Unnamed, it stays a plain focusable scroller.\n {...props({ \"aria-labelledby\": rest[\"aria-labelledby\"], \"aria-label\": rest[\"aria-label\"] })}\n className=\"peer table-scroll-x min-h-0 w-full flex-1 overflow-auto focus-visible:outline-none\"\n >\n <ark.table\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(\n \"w-full border-separate border-spacing-0 text-start\",\n TEXT_COLOR_CLASSES.primary,\n classNames?.table,\n )}\n />\n </section>\n {/* Horizontal scroll affordance — a soft shadow on each side that still has\n content to scroll to (pure CSS, hidden where unsupported). Pinned to the\n inline edges; a gradient has no logical direction, so `rtl:-scale-x-100`\n mirrors each shadow to fade inward from its own edge. The scroll-driven\n reveal needs no flip: its timeline's progress runs from the inline start\n in either direction. */}\n <div\n aria-hidden=\"true\"\n className=\"table-fade-start pointer-events-none absolute inset-y-0 start-0 w-6 rtl:-scale-x-100\"\n />\n <div\n aria-hidden=\"true\"\n className=\"table-fade-end pointer-events-none absolute inset-y-0 end-0 w-6 rtl:-scale-x-100\"\n />\n {/* The scroller's focus ring, on an overlay that doesn't scroll: a ring on the\n scroller itself is a box-shadow under its own content, hidden by the header\n and footer fills (and by the pinned rows, which are positioned). */}\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 z-20\",\n focusStyles({ source: \"peer-focus-visible\", inset: true, offset: false }),\n )}\n />\n </div>\n)\n\nexport type TableHeadProps = HTMLArkProps<\"thead\"> & WithTestId\n\n// Parts are dumb: all styling is driven by the root's descendant selectors, so\n// they just forward a caller className (through `cn` when present).\nconst TableHead = ({ className, testId, ...rest }: TableHeadProps) => (\n <ark.thead\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport type TableBodyProps = HTMLArkProps<\"tbody\"> & WithTestId\n\nconst TableBody = ({ className, testId, ...rest }: TableBodyProps) => (\n <ark.tbody\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport type TableFootProps = HTMLArkProps<\"tfoot\"> & WithTestId\n\nconst TableFoot = ({ className, testId, ...rest }: TableFootProps) => (\n <ark.tfoot\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport type TableRowProps = HTMLArkProps<\"tr\"> & WithTestId\n\nconst TableRow = ({ className, testId, ...rest }: TableRowProps) => (\n <ark.tr\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport type TableHeaderCellProps = HTMLArkProps<\"th\"> & WithTestId\n\nconst TableHeaderCell = ({ className, scope = \"col\", testId, ...rest }: TableHeaderCellProps) => (\n <ark.th\n scope={scope}\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport type TableCellProps = HTMLArkProps<\"td\"> & WithTestId\n\nconst TableCell = ({ className, testId, ...rest }: TableCellProps) => (\n <ark.td\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={className ? cn(className) : undefined}\n />\n)\n\nexport const Table = Object.assign(TableRoot, {\n Toolbar: TableToolbar,\n Title: TableTitle,\n Content: TableContent,\n Head: TableHead,\n Body: TableBody,\n Foot: TableFoot,\n Row: TableRow,\n HeaderCell: TableHeaderCell,\n Cell: TableCell,\n})\n"]}
@@ -1,7 +1,7 @@
1
1
  import { PillGroupContext, pill } from './chunk-6M6YZ3PQ.js';
2
- import { inputSlot, inputShell, inputControlClasses } from './chunk-3L5GLI67.js';
2
+ import { inputSlot, inputShell, inputControlClasses } from './chunk-I4B3N3UX.js';
3
3
  import { useElementSize } from './chunk-2LI3VPDP.js';
4
- import { useLocale } from './chunk-IPYHTCFL.js';
4
+ import { useLocale } from './chunk-IUK7OJXZ.js';
5
5
  import { props } from './chunk-WYCMIIRR.js';
6
6
  import { cn } from './chunk-4ASNIDV7.js';
7
7
  import { ark } from '@ark-ui/react';
@@ -230,5 +230,5 @@ var PillsInput = Object.assign(PillsInputBase, {
230
230
  });
231
231
 
232
232
  export { PillOverflowCounter, PillsInput, pillsContent, pillsShell, usePillOverflow };
233
- //# sourceMappingURL=chunk-J44FJ7PH.js.map
234
- //# sourceMappingURL=chunk-J44FJ7PH.js.map
233
+ //# sourceMappingURL=chunk-PFZMB3US.js.map
234
+ //# sourceMappingURL=chunk-PFZMB3US.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/pills-input/pills-input.tsx"],"names":[],"mappings":";;;;;;;;;;;AAsDO,IAAM,UAAA,GAAa,GAAG,aAAa;AAMnC,IAAM,YAAA,GAAe,IAAI,2DAAA,EAA6D;AAAA,EAC3F,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI,OAAA;AAAA,MACJ,EAAA,EAAI,SAAA;AAAA,MACJ,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,IAAA,EAAM,IAAA;AAC3B,CAAC;AAKD,IAAM,kBAAA,GAAqB,OAAO,QAAA,KAAa,WAAA,GAAc,eAAA,GAAkB,SAAA;AAWxE,SAAS,gBAAA,CAAiB,YAAsB,QAAA,EAA0B;AAC/E,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,IAAI,UAAU,MAAA,CAAO,iBAAA;AACrB,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,UAAA,CAAW,QAAQ,CAAA,EAAA,EAAK;AAC1C,IAAA,MAAM,GAAA,GAAM,UAAA,CAAW,CAAC,CAAA,IAAK,OAAA;AAC7B,IAAA,IAAI,GAAA,GAAM,UAAU,CAAA,EAAG;AACrB,MAAA,IAAA,IAAQ,CAAA;AACR,MAAA,OAAA,GAAU,GAAA;A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AAA,UAED;AAAA,SAAA,EACH,CAAA;AAAA,QACC,OAAA,IAAW,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,GAAG,SAAA,EAAW,UAAA,EAAY,OAAO,CAAA,EAAI,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,GACpF,EACF,CAAA;AAEJ,CAAA;AAQA,IAAM,kBAAkB,CAAC;AAAA,EACvB,SAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA;AAAA,EAAC,OAAA;AAAA,EAAA;AAAA,IAEC,qBAAA,EAAmB,IAAA;AAAA,IAGnB,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,iBAAA,EAAmB,SAAS,CAAA;AAAA,IAC/D,SAAA,EAAW,CAAC,KAAA,KAAU;AACpB,MAAA,IAAI,gBAAgB,KAAA,CAAM,GAAA,KAAQ,eAAe,KAAA,CAAM,aAAA,CAAc,UAAU,EAAA,EAAI;AACjF,QAAA,YAAA,EAAa;AAAA,MACf;AACA,MAAA,SAAA,GAAY,KAAK,CAAA;AAAA,IACnB,CAAA;AAAA,IACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB;AAAA,EACtD,KAAA,EAAO;AACT,CAAC","file":"chunk-J44FJ7PH.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n Children,\n type ComponentPropsWithoutRef,\n cloneElement,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useLocale } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useElementSize } from \"../../lib/use-element-size\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { PillGroupContext, type PillSize, pill } from \"../pill/pill\"\n\n/**\n * PillsInput — a multi-line input shell that lays out `Pill`s alongside a search\n * field. Same chrome as `Input` (border, focus ring, invalid / disabled states)\n * but it wraps as values accumulate. It's the visual `MultiSelect` and\n * `TagsInput` mount as their target.\n *\n * - It reuses `Input`'s slot layout: a `startSlot` / `endSlot` flank a\n * `pillsContent` region that holds the `Pill`s + the field and is the only\n * thing that wraps, so a trailing control (chevron, clear) pins to the edge\n * instead of wrapping inline with the pills.\n * - Host `Pill`s + a single `PillsInputField` inside it (pills first, field\n * last). The shell sets the pill `size` / `disabled` through context, so the\n * pills match with no prop drilling.\n * - `maxLines` caps the pills at N rows and collapses the rest into a static\n * \"+N\" counter (measured, since pills have variable widths).\n *\n * Presentational by design: the value state lives with the consumer.\n */\n\n/** The pills *row*: same single-line flex shell as `inputShell`, just text-cursor\n * for the click-to-focus affordance. Layout/wrap live on `pillsContent`. */\nexport const pillsShell = cn(\"cursor-text\")\n\n/** The wrapping region inside a pills shell — holds the pills + field, grows to\n * fill the row (`flex-1`), and is the only element that wraps, so the shell's\n * start/end slots stay pinned as `shrink-0` siblings. Gap tracks `inputShell`'s\n * per-size gap so pill spacing is unchanged from the flat layout. */\nexport const pillsContent = cva(\"flex min-w-0 flex-1 flex-wrap items-center py-1 gap-y-0.5\", {\n variants: {\n size: {\n xs: \"gap-1.5\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n },\n },\n defaultVariants: { size: \"md\" },\n})\n\n// `useLayoutEffect` measures before paint (no flash); fall back to `useEffect`\n// on the server so SSR doesn't warn. Measurement is client-only anyway — the\n// server render shows every pill, which is the correct no-cap fallback.\nconst useIsoLayoutEffect = typeof document !== \"undefined\" ? useLayoutEffect : useEffect\n\n/**\n * Pure row-grouping math behind `usePillOverflow` (exported for testing).\n *\n * Given each measured pill's `offsetTop` (in document order), count how many\n * fit within `maxLines` wrapped rows. A jump in `offsetTop` (beyond a sub-pixel\n * epsilon) marks a new row. When the pills overflow, reserve one slot on the\n * last visible row for the \"+N\" counter (it's narrower than a typical pill, so\n * dropping one always makes room).\n */\nexport function visiblePillCount(offsetTops: number[], maxLines: number): number {\n let rows = 0\n let lastTop = Number.NEGATIVE_INFINITY\n for (let i = 0; i < offsetTops.length; i++) {\n const top = offsetTops[i] ?? lastTop\n if (top - lastTop > 1) {\n rows += 1\n lastTop = top\n if (rows > maxLines) {\n // `i` begins the row past the cap — keep the rows before it, minus one\n // for the counter.\n return Math.max(0, i - 1)\n }\n }\n }\n return offsetTops.length\n}\n\n/**\n * Like `visiblePillCount`, but also keeps the trailing input field on the last\n * visible row (exported for testing).\n *\n * `visiblePillCount` only reasons about pills, so when the last visible row is\n * packed, the field — which is `min-w-16` and the last flex child — can't claim\n * its minimum width and wraps onto a new line. A flex item wraps exactly when\n * the space left on its row drops below its `min-width`, so we drop pills until\n * the last visible pill leaves room on its row for `gap + fieldMinWidth` (plus\n * the `+N` counter, once anything is hidden). Pills are passed as `{ top, end }`,\n * where `end` is how far the pill's inline-end edge sits from the row's\n * inline-start edge, and `rowEnd` is the row's inline length — logical, so the\n * same math holds in RTL, where the free space is on the pill's left. Removing a\n * trailing pill never reflows the ones before it, so each drop is checked\n * against real geometry.\n */\nexport function pillCountWithField(\n pills: { top: number; end: number }[],\n maxLines: number,\n rowEnd: number,\n trailing: { fieldMinWidth: number; counterWidth: number; gap: number },\n): number {\n const total = pills.length\n const { fieldMinWidth, counterWidth, gap } = trailing\n // Start from the pill-only cap (already reserves one slot for the counter on\n // overflow), then back off until the field's minimum fits on the last row.\n let visible = visiblePillCount(\n pills.map((p) => p.top),\n maxLines,\n )\n while (visible > 0) {\n const last = pills[visible - 1]\n if (last == null) break\n // Hiding any pill surfaces the \"+N\" counter, which shares the last row.\n const needsCounter = visible < total\n const trailingWidth = gap + fieldMinWidth + (needsCounter ? counterWidth + gap : 0)\n if (last.end + trailingWidth <= rowEnd) break\n visible--\n }\n return visible\n}\n\n/**\n * Measure how many pills fit within `maxLines` rows and how many overflow.\n *\n * Line caps are width-dependent (pills vary in width), so this measures the DOM.\n * Pills to be measured must carry `data-overflow-item`; the trailing field and\n * the counter must NOT (they would corrupt row detection) — instead the field\n * carries `data-overflow-field` and the counter `data-overflow-counter` so the\n * hook can locate and measure them without mistaking them for pills. The hook\n * renders the full set during a pre-paint \"measuring\" pass, groups pills into\n * rows, then settles on a `visibleCount` — reserving the last row for the \"+N\"\n * chip and, when a field is present, its `min-width` too, so the field never\n * wraps onto a new line (see `pillCountWithField`). Re-measures on width change\n * only (ignoring the height change our own slicing causes, which would loop).\n *\n * `measuring` is exposed so consumers can render the counter during the\n * measuring pass (it is otherwise hidden when nothing overflows), letting the\n * hook measure its real width for the last-row reservation.\n */\nexport function usePillOverflow({\n maxLines,\n count,\n}: {\n /** Cap the rendered pills at this many rows. Omit to render every pill. */\n maxLines?: number\n /** Total number of pills — drives re-measurement on add / remove. */\n count: number\n}): {\n containerRef: RefObject<HTMLDivElement | null>\n visibleCount: number\n hiddenCount: number\n measuring: boolean\n} {\n const containerRef = useRef<HTMLDivElement>(null)\n const [visibleCount, setVisibleCount] = useState(count)\n // While true, every pill is rendered so the DOM reflects the full set; flipped\n // off (pre-paint) once the cutoff is computed.\n const [measuring, setMeasuring] = useState(true)\n const lastWidth = useRef(0)\n\n // Any change to the inputs re-enters a full-render measuring pass.\n useIsoLayoutEffect(() => {\n setMeasuring(true)\n }, [count, maxLines])\n\n useIsoLayoutEffect(() => {\n if (!measuring) return\n const container = containerRef.current\n if (maxLines == null || container == null) {\n setVisibleCount(count)\n setMeasuring(false)\n return\n }\n const items = Array.from(container.querySelectorAll<HTMLElement>(\"[data-overflow-item]\"))\n lastWidth.current = container.clientWidth\n\n const fieldEl = container.querySelector<HTMLElement>(\"[data-overflow-field]\")\n if (fieldEl == null) {\n // No trailing field (e.g. TreeMultiSelect's read-only trigger) — pills +\n // counter only, the original behavior.\n setVisibleCount(\n visiblePillCount(\n items.map((el) => el.offsetTop),\n maxLines,\n ),\n )\n setMeasuring(false)\n return\n }\n\n // Field-aware: reserve the field's min width (and the counter slot) on the\n // last visible row. Measure in viewport coords via `getBoundingClientRect`\n // so pill edges and the row's edges share one coordinate space regardless\n // of `offsetParent` (the positioned shell, not this container), then turn\n // them into inline offsets from the row's start: under RTL the row fills\n // from the right, and a physical `right` would read every pill as already\n // touching the row's end.\n const style = getComputedStyle(container)\n const gap = Number.parseFloat(style.columnGap || style.gap) || 0\n const row = container.getBoundingClientRect()\n const rtl = style.direction === \"rtl\"\n const inlineEnd = (rect: DOMRect) => (rtl ? row.right - rect.left : rect.right - row.left)\n const fieldMinWidth = Number.parseFloat(getComputedStyle(fieldEl).minWidth) || 0\n const counterEl = container.querySelector<HTMLElement>(\"[data-overflow-counter]\")\n const counterWidth = counterEl?.getBoundingClientRect().width ?? 0\n const pills = items.map((el) => {\n const rect = el.getBoundingClientRect()\n return { top: rect.top, end: inlineEnd(rect) }\n })\n setVisibleCount(\n pillCountWithField(pills, maxLines, row.width, { fieldMinWidth, counterWidth, gap }),\n )\n setMeasuring(false)\n }, [measuring, count, maxLines])\n\n // Re-measure when the field's width changes (a wider field reveals more\n // pills again). Ignore height-only changes — our own slicing shrinks the\n // height and would otherwise feed back into an infinite measure loop.\n const width = useElementSize(containerRef, { enabled: maxLines != null })?.width\n useIsoLayoutEffect(() => {\n if (width === undefined || Math.abs(width - lastWidth.current) < 1) return\n lastWidth.current = width\n setMeasuring(true)\n }, [width])\n\n const resolved = maxLines == null || measuring ? count : Math.min(visibleCount, count)\n return {\n containerRef,\n visibleCount: resolved,\n hiddenCount: Math.max(0, count - resolved),\n measuring,\n }\n}\n\n/** The wording of the pill controls' \"+N\" counter — shared by `PillsInput`, `MultiSelect`,\n * `TagsInput` and `TreeMultiSelect`, each taking it on its own `translations`. */\nexport type PillsInputTranslations = {\n /** What a screen reader hears for the \"+N\" counter, instead of \"plus 3\". Gets the hidden\n * count (for plural rules) and that count formatted for the locale.\n * Default `(count, n) => \\`${n} more items\\`` (\"item\" for one). */\n overflowCount?: (count: number, formatted: string) => string\n}\n\nconst englishPlural = new Intl.PluralRules(\"en-US\")\n\nexport const PILLS_INPUT_DEFAULT_TRANSLATIONS = {\n overflowCount: (count, formatted) =>\n `${formatted} more ${englishPlural.select(count) === \"one\" ? \"item\" : \"items\"}`,\n} as const satisfies Required<PillsInputTranslations>\n\nexport type PillOverflowCounterProps = {\n /** How many pills are hidden. */\n count: number\n size?: PillSize\n className?: string\n /** The owning control's `translations`; only `overflowCount` is read. */\n translations?: PillsInputTranslations\n}\n\n/** Static \"+N\" chip the pill controls render at the end of the visible rows.\n * Non-interactive: the \"+N\" is drawn in the locale's digits and sign (`+٣` in\n * `ar-EG`) and hidden from screen readers, which read `overflowCount` instead.\n * The full set stays reachable via the dropdown (where one exists) or the\n * consumer's own state. */\nexport const PillOverflowCounter = ({\n count,\n size = \"md\",\n className,\n translations,\n}: PillOverflowCounterProps) => {\n const locale = useLocale()\n // The one key it reads; an owner forwarding `{ overflowCount: undefined }` keeps the default.\n const overflowCount =\n translations?.overflowCount ?? PILLS_INPUT_DEFAULT_TRANSLATIONS.overflowCount\n return (\n // `relative`: contains the absolutely positioned `sr-only` text.\n <span data-overflow-counter className={cn(pill({ size }), \"relative tabular-nums\", className)}>\n <span aria-hidden>\n {new Intl.NumberFormat(locale, { signDisplay: \"always\" }).format(count)}\n </span>\n <span className=\"sr-only\">\n {overflowCount(count, new Intl.NumberFormat(locale).format(count))}\n </span>\n </span>\n )\n}\n\ntype PillsInputClassNames = {\n root?: string\n content?: string\n startSlot?: string\n endSlot?: string\n}\n\nexport type PillsInputProps = NoAsChild<Omit<HTMLArkProps<\"div\">, \"color\">> &\n WithTestId & {\n size?: InputSize\n variant?: InputVariant\n color?: Color\n invalid?: boolean\n disabled?: boolean\n pointer?: boolean\n /** Cap the pills at N rows; the rest collapse into a static \"+N\" counter. */\n maxLines?: number\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before any trailing control. */\n endSlot?: ReactNode\n classNames?: PillsInputClassNames\n /** The \"+N\" counter's screen-reader wording — see `PillsInputTranslations`. */\n translations?: PillsInputTranslations\n }\n\n/**\n * PillsInput — the wrapping input shell for multi-value fields. Host `Pill`s\n * and a single `PillsInput.Field` inside; the shell sizes and disables them\n * through context. Presentational by design: it holds no value state.\n *\n * `testId` here lands on the shell `<div>` itself — useful when `PillsInput`\n * is used bare. `PillsInput.Field` has its own `testId`, landing on the real\n * focusable `<input>`; prefer that one when targeting the field.\n */\nconst PillsInputBase = ({\n size = \"md\",\n variant = \"default\",\n color,\n invalid,\n disabled,\n pointer,\n maxLines,\n startSlot,\n endSlot,\n className,\n classNames,\n children,\n testId,\n translations,\n asChild: _asChild,\n ...rest\n}: PillsInputProps) => {\n // Convention: pills first, the field last. Only the pills feed the line cap;\n // the field always stays visible (it is never sliced away).\n const items = Children.toArray(children)\n const field = items.length > 0 ? items[items.length - 1] : null\n const pills = items.length > 0 ? items.slice(0, -1) : []\n\n const { containerRef, visibleCount, hiddenCount, measuring } = usePillOverflow({\n maxLines,\n count: pills.length,\n })\n\n const renderedPills = (maxLines == null ? pills : pills.slice(0, visibleCount)).map((child, i) =>\n isValidElement(child)\n ? cloneElement(child as ReactElement<Record<string, unknown>>, {\n key: child.key ?? i,\n \"data-overflow-item\": true,\n })\n : child,\n )\n\n return (\n <PillGroupContext.Provider value={{ size, disabled }}>\n <ark.div\n data-color={color}\n {...props({\n \"data-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-pointer\": pointer,\n // Slot-aware padding in `inputShell` — see InputBase for the rationale.\n \"data-with-start-slot\": startSlot != null,\n \"data-with-end-slot\": endSlot != null,\n \"data-testid\": testId,\n })}\n className={cn(inputShell({ size, variant }), pillsShell, className, classNames?.root)}\n {...rest}\n >\n {startSlot != null && (\n <span className={cn(inputSlot, classNames?.startSlot)} aria-hidden>\n {startSlot}\n </span>\n )}\n <div ref={containerRef} className={cn(pillsContent({ size }), classNames?.content)}>\n {renderedPills}\n {/* Mounted during the measuring pass so the hook can size the last-row\n reservation off the real counter, but kept `invisible` then (still\n measurable) so it never paints on the SSR HTML before the first\n measure. Only mounts while measuring when a cap is configured. */}\n {(hiddenCount > 0 || (measuring && maxLines != null)) && (\n <PillOverflowCounter\n count={measuring ? pills.length : hiddenCount}\n size={size}\n className={measuring ? \"invisible\" : undefined}\n translations={translations}\n />\n )}\n {field}\n </div>\n {endSlot != null && <span className={cn(inputSlot, classNames?.endSlot)}>{endSlot}</span>}\n </ark.div>\n </PillGroupContext.Provider>\n )\n}\n\nexport type PillsInputFieldProps = ComponentPropsWithoutRef<\"input\"> &\n WithTestId & {\n /** Fired on Backspace when the field is empty — pop the last value. */\n onRemoveLast?: () => void\n }\n\nconst PillsInputField = ({\n className,\n onRemoveLast,\n onKeyDown,\n testId,\n ...rest\n}: PillsInputFieldProps) => (\n <input\n // The trailing field the overflow hook keeps on the last visible row.\n data-overflow-field\n // Grow to fill the line, but keep a clickable minimum when empty. Overrides\n // `inputControlClasses`' `w-full min-w-0` so pills can share the row.\n className={cn(inputControlClasses, \"w-auto min-w-16\", className)}\n onKeyDown={(event) => {\n if (onRemoveLast && event.key === \"Backspace\" && event.currentTarget.value === \"\") {\n onRemoveLast()\n }\n onKeyDown?.(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const PillsInput = Object.assign(PillsInputBase, {\n Field: PillsInputField,\n})\n"]}
1
+ {"version":3,"sources":["../src/components/pills-input/pills-input.tsx"],"names":[],"mappings":";;;;;;;;;;;AAsDO,IAAM,UAAA,GAAa,GAAG,aAAa;AAMnC,IAAM,YAAA,GAAe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CAAG,mBAAA,EAAqB,iBAAA,EAAmB,SAAS,CAAA;AAAA,IAC/D,SAAA,EAAW,CAAC,KAAA,KAAU;AACpB,MAAA,IAAI,gBAAgB,KAAA,CAAM,GAAA,KAAQ,eAAe,KAAA,CAAM,aAAA,CAAc,UAAU,EAAA,EAAI;AACjF,QAAA,YAAA,EAAa;AAAA,MACf;AACA,MAAA,SAAA,GAAY,KAAK,CAAA;AAAA,IACnB,CAAA;AAAA,IACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB;AAAA,EACtD,KAAA,EAAO;AACT,CAAC","file":"chunk-PFZMB3US.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n Children,\n type ComponentPropsWithoutRef,\n cloneElement,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useLocale } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useElementSize } from \"../../lib/use-element-size\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { PillGroupContext, type PillSize, pill } from \"../pill/pill\"\n\n/**\n * PillsInput — a multi-line input shell that lays out `Pill`s alongside a search\n * field. Same chrome as `Input` (border, focus ring, invalid / disabled states)\n * but it wraps as values accumulate. It's the visual `MultiSelect` and\n * `TagsInput` mount as their target.\n *\n * - It reuses `Input`'s slot layout: a `startSlot` / `endSlot` flank a\n * `pillsContent` region that holds the `Pill`s + the field and is the only\n * thing that wraps, so a trailing control (chevron, clear) pins to the edge\n * instead of wrapping inline with the pills.\n * - Host `Pill`s + a single `PillsInputField` inside it (pills first, field\n * last). The shell sets the pill `size` / `disabled` through context, so the\n * pills match with no prop drilling.\n * - `maxLines` caps the pills at N rows and collapses the rest into a static\n * \"+N\" counter (measured, since pills have variable widths).\n *\n * Presentational by design: the value state lives with the consumer.\n */\n\n/** The pills *row*: same single-line flex shell as `inputShell`, just text-cursor\n * for the click-to-focus affordance. Layout/wrap live on `pillsContent`. */\nexport const pillsShell = cn(\"cursor-text\")\n\n/** The wrapping region inside a pills shell — holds the pills + field, grows to\n * fill the row (`flex-1`), and is the only element that wraps, so the shell's\n * start/end slots stay pinned as `shrink-0` siblings. Gap tracks `inputShell`'s\n * per-size gap so pill spacing is unchanged from the flat layout. */\nexport const pillsContent = cva(\"flex min-w-0 flex-1 flex-wrap items-center py-1 gap-y-0.5\", {\n variants: {\n size: {\n xs: \"gap-1.5\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n },\n },\n defaultVariants: { size: \"md\" },\n})\n\n// `useLayoutEffect` measures before paint (no flash); fall back to `useEffect`\n// on the server so SSR doesn't warn. Measurement is client-only anyway — the\n// server render shows every pill, which is the correct no-cap fallback.\nconst useIsoLayoutEffect = typeof document !== \"undefined\" ? useLayoutEffect : useEffect\n\n/**\n * Pure row-grouping math behind `usePillOverflow` (exported for testing).\n *\n * Given each measured pill's `offsetTop` (in document order), count how many\n * fit within `maxLines` wrapped rows. A jump in `offsetTop` (beyond a sub-pixel\n * epsilon) marks a new row. When the pills overflow, reserve one slot on the\n * last visible row for the \"+N\" counter (it's narrower than a typical pill, so\n * dropping one always makes room).\n */\nexport function visiblePillCount(offsetTops: number[], maxLines: number): number {\n let rows = 0\n let lastTop = Number.NEGATIVE_INFINITY\n for (let i = 0; i < offsetTops.length; i++) {\n const top = offsetTops[i] ?? lastTop\n if (top - lastTop > 1) {\n rows += 1\n lastTop = top\n if (rows > maxLines) {\n // `i` begins the row past the cap — keep the rows before it, minus one\n // for the counter.\n return Math.max(0, i - 1)\n }\n }\n }\n return offsetTops.length\n}\n\n/**\n * Like `visiblePillCount`, but also keeps the trailing input field on the last\n * visible row (exported for testing).\n *\n * `visiblePillCount` only reasons about pills, so when the last visible row is\n * packed, the field — which is `min-w-16` and the last flex child — can't claim\n * its minimum width and wraps onto a new line. A flex item wraps exactly when\n * the space left on its row drops below its `min-width`, so we drop pills until\n * the last visible pill leaves room on its row for `gap + fieldMinWidth` (plus\n * the `+N` counter, once anything is hidden). Pills are passed as `{ top, end }`,\n * where `end` is how far the pill's inline-end edge sits from the row's\n * inline-start edge, and `rowEnd` is the row's inline length — logical, so the\n * same math holds in RTL, where the free space is on the pill's left. Removing a\n * trailing pill never reflows the ones before it, so each drop is checked\n * against real geometry.\n */\nexport function pillCountWithField(\n pills: { top: number; end: number }[],\n maxLines: number,\n rowEnd: number,\n trailing: { fieldMinWidth: number; counterWidth: number; gap: number },\n): number {\n const total = pills.length\n const { fieldMinWidth, counterWidth, gap } = trailing\n // Start from the pill-only cap (already reserves one slot for the counter on\n // overflow), then back off until the field's minimum fits on the last row.\n let visible = visiblePillCount(\n pills.map((p) => p.top),\n maxLines,\n )\n while (visible > 0) {\n const last = pills[visible - 1]\n if (last == null) break\n // Hiding any pill surfaces the \"+N\" counter, which shares the last row.\n const needsCounter = visible < total\n const trailingWidth = gap + fieldMinWidth + (needsCounter ? counterWidth + gap : 0)\n if (last.end + trailingWidth <= rowEnd) break\n visible--\n }\n return visible\n}\n\n/**\n * Measure how many pills fit within `maxLines` rows and how many overflow.\n *\n * Line caps are width-dependent (pills vary in width), so this measures the DOM.\n * Pills to be measured must carry `data-overflow-item`; the trailing field and\n * the counter must NOT (they would corrupt row detection) — instead the field\n * carries `data-overflow-field` and the counter `data-overflow-counter` so the\n * hook can locate and measure them without mistaking them for pills. The hook\n * renders the full set during a pre-paint \"measuring\" pass, groups pills into\n * rows, then settles on a `visibleCount` — reserving the last row for the \"+N\"\n * chip and, when a field is present, its `min-width` too, so the field never\n * wraps onto a new line (see `pillCountWithField`). Re-measures on width change\n * only (ignoring the height change our own slicing causes, which would loop).\n *\n * `measuring` is exposed so consumers can render the counter during the\n * measuring pass (it is otherwise hidden when nothing overflows), letting the\n * hook measure its real width for the last-row reservation.\n */\nexport function usePillOverflow({\n maxLines,\n count,\n}: {\n /** Cap the rendered pills at this many rows. Omit to render every pill. */\n maxLines?: number\n /** Total number of pills — drives re-measurement on add / remove. */\n count: number\n}): {\n containerRef: RefObject<HTMLDivElement | null>\n visibleCount: number\n hiddenCount: number\n measuring: boolean\n} {\n const containerRef = useRef<HTMLDivElement>(null)\n const [visibleCount, setVisibleCount] = useState(count)\n // While true, every pill is rendered so the DOM reflects the full set; flipped\n // off (pre-paint) once the cutoff is computed.\n const [measuring, setMeasuring] = useState(true)\n const lastWidth = useRef(0)\n\n // Any change to the inputs re-enters a full-render measuring pass.\n useIsoLayoutEffect(() => {\n setMeasuring(true)\n }, [count, maxLines])\n\n useIsoLayoutEffect(() => {\n if (!measuring) return\n const container = containerRef.current\n if (maxLines == null || container == null) {\n setVisibleCount(count)\n setMeasuring(false)\n return\n }\n const items = Array.from(container.querySelectorAll<HTMLElement>(\"[data-overflow-item]\"))\n lastWidth.current = container.clientWidth\n\n const fieldEl = container.querySelector<HTMLElement>(\"[data-overflow-field]\")\n if (fieldEl == null) {\n // No trailing field (e.g. TreeMultiSelect's read-only trigger) — pills +\n // counter only, the original behavior.\n setVisibleCount(\n visiblePillCount(\n items.map((el) => el.offsetTop),\n maxLines,\n ),\n )\n setMeasuring(false)\n return\n }\n\n // Field-aware: reserve the field's min width (and the counter slot) on the\n // last visible row. Measure in viewport coords via `getBoundingClientRect`\n // so pill edges and the row's edges share one coordinate space regardless\n // of `offsetParent` (the positioned shell, not this container), then turn\n // them into inline offsets from the row's start: under RTL the row fills\n // from the right, and a physical `right` would read every pill as already\n // touching the row's end.\n const style = getComputedStyle(container)\n const gap = Number.parseFloat(style.columnGap || style.gap) || 0\n const row = container.getBoundingClientRect()\n const rtl = style.direction === \"rtl\"\n const inlineEnd = (rect: DOMRect) => (rtl ? row.right - rect.left : rect.right - row.left)\n const fieldMinWidth = Number.parseFloat(getComputedStyle(fieldEl).minWidth) || 0\n const counterEl = container.querySelector<HTMLElement>(\"[data-overflow-counter]\")\n const counterWidth = counterEl?.getBoundingClientRect().width ?? 0\n const pills = items.map((el) => {\n const rect = el.getBoundingClientRect()\n return { top: rect.top, end: inlineEnd(rect) }\n })\n setVisibleCount(\n pillCountWithField(pills, maxLines, row.width, { fieldMinWidth, counterWidth, gap }),\n )\n setMeasuring(false)\n }, [measuring, count, maxLines])\n\n // Re-measure when the field's width changes (a wider field reveals more\n // pills again). Ignore height-only changes — our own slicing shrinks the\n // height and would otherwise feed back into an infinite measure loop.\n const width = useElementSize(containerRef, { enabled: maxLines != null })?.width\n useIsoLayoutEffect(() => {\n if (width === undefined || Math.abs(width - lastWidth.current) < 1) return\n lastWidth.current = width\n setMeasuring(true)\n }, [width])\n\n const resolved = maxLines == null || measuring ? count : Math.min(visibleCount, count)\n return {\n containerRef,\n visibleCount: resolved,\n hiddenCount: Math.max(0, count - resolved),\n measuring,\n }\n}\n\n/** The wording of the pill controls' \"+N\" counter — shared by `PillsInput`, `MultiSelect`,\n * `TagsInput` and `TreeMultiSelect`, each taking it on its own `translations`. */\nexport type PillsInputTranslations = {\n /** What a screen reader hears for the \"+N\" counter, instead of \"plus 3\". Gets the hidden\n * count (for plural rules) and that count formatted for the locale.\n * Default `(count, n) => \\`${n} more items\\`` (\"item\" for one). */\n overflowCount?: (count: number, formatted: string) => string\n}\n\nconst englishPlural = new Intl.PluralRules(\"en-US\")\n\nexport const PILLS_INPUT_DEFAULT_TRANSLATIONS = {\n overflowCount: (count, formatted) =>\n `${formatted} more ${englishPlural.select(count) === \"one\" ? \"item\" : \"items\"}`,\n} as const satisfies Required<PillsInputTranslations>\n\nexport type PillOverflowCounterProps = {\n /** How many pills are hidden. */\n count: number\n size?: PillSize\n className?: string\n /** The owning control's `translations`; only `overflowCount` is read. */\n translations?: PillsInputTranslations\n}\n\n/** Static \"+N\" chip the pill controls render at the end of the visible rows.\n * Non-interactive: the \"+N\" is drawn in the locale's digits and sign (`+٣` in\n * `ar-EG`) and hidden from screen readers, which read `overflowCount` instead.\n * The full set stays reachable via the dropdown (where one exists) or the\n * consumer's own state. */\nexport const PillOverflowCounter = ({\n count,\n size = \"md\",\n className,\n translations,\n}: PillOverflowCounterProps) => {\n const locale = useLocale()\n // The one key it reads; an owner forwarding `{ overflowCount: undefined }` keeps the default.\n const overflowCount =\n translations?.overflowCount ?? PILLS_INPUT_DEFAULT_TRANSLATIONS.overflowCount\n return (\n // `relative`: contains the absolutely positioned `sr-only` text.\n <span data-overflow-counter className={cn(pill({ size }), \"relative tabular-nums\", className)}>\n <span aria-hidden>\n {new Intl.NumberFormat(locale, { signDisplay: \"always\" }).format(count)}\n </span>\n <span className=\"sr-only\">\n {overflowCount(count, new Intl.NumberFormat(locale).format(count))}\n </span>\n </span>\n )\n}\n\ntype PillsInputClassNames = {\n root?: string\n content?: string\n startSlot?: string\n endSlot?: string\n}\n\nexport type PillsInputProps = NoAsChild<Omit<HTMLArkProps<\"div\">, \"color\">> &\n WithTestId & {\n size?: InputSize\n variant?: InputVariant\n color?: Color\n invalid?: boolean\n disabled?: boolean\n pointer?: boolean\n /** Cap the pills at N rows; the rest collapse into a static \"+N\" counter. */\n maxLines?: number\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before any trailing control. */\n endSlot?: ReactNode\n classNames?: PillsInputClassNames\n /** The \"+N\" counter's screen-reader wording — see `PillsInputTranslations`. */\n translations?: PillsInputTranslations\n }\n\n/**\n * PillsInput — the wrapping input shell for multi-value fields. Host `Pill`s\n * and a single `PillsInput.Field` inside; the shell sizes and disables them\n * through context. Presentational by design: it holds no value state.\n *\n * `testId` here lands on the shell `<div>` itself — useful when `PillsInput`\n * is used bare. `PillsInput.Field` has its own `testId`, landing on the real\n * focusable `<input>`; prefer that one when targeting the field.\n */\nconst PillsInputBase = ({\n size = \"md\",\n variant = \"default\",\n color,\n invalid,\n disabled,\n pointer,\n maxLines,\n startSlot,\n endSlot,\n className,\n classNames,\n children,\n testId,\n translations,\n asChild: _asChild,\n ...rest\n}: PillsInputProps) => {\n // Convention: pills first, the field last. Only the pills feed the line cap;\n // the field always stays visible (it is never sliced away).\n const items = Children.toArray(children)\n const field = items.length > 0 ? items[items.length - 1] : null\n const pills = items.length > 0 ? items.slice(0, -1) : []\n\n const { containerRef, visibleCount, hiddenCount, measuring } = usePillOverflow({\n maxLines,\n count: pills.length,\n })\n\n const renderedPills = (maxLines == null ? pills : pills.slice(0, visibleCount)).map((child, i) =>\n isValidElement(child)\n ? cloneElement(child as ReactElement<Record<string, unknown>>, {\n key: child.key ?? i,\n \"data-overflow-item\": true,\n })\n : child,\n )\n\n return (\n <PillGroupContext.Provider value={{ size, disabled }}>\n <ark.div\n data-color={color}\n {...props({\n \"data-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-pointer\": pointer,\n // Slot-aware padding in `inputShell` — see InputBase for the rationale.\n \"data-with-start-slot\": startSlot != null,\n \"data-with-end-slot\": endSlot != null,\n \"data-testid\": testId,\n })}\n className={cn(inputShell({ size, variant }), pillsShell, className, classNames?.root)}\n {...rest}\n >\n {startSlot != null && (\n <span className={cn(inputSlot, classNames?.startSlot)} aria-hidden>\n {startSlot}\n </span>\n )}\n <div ref={containerRef} className={cn(pillsContent({ size }), classNames?.content)}>\n {renderedPills}\n {/* Mounted during the measuring pass so the hook can size the last-row\n reservation off the real counter, but kept `invisible` then (still\n measurable) so it never paints on the SSR HTML before the first\n measure. Only mounts while measuring when a cap is configured. */}\n {(hiddenCount > 0 || (measuring && maxLines != null)) && (\n <PillOverflowCounter\n count={measuring ? pills.length : hiddenCount}\n size={size}\n className={measuring ? \"invisible\" : undefined}\n translations={translations}\n />\n )}\n {field}\n </div>\n {endSlot != null && <span className={cn(inputSlot, classNames?.endSlot)}>{endSlot}</span>}\n </ark.div>\n </PillGroupContext.Provider>\n )\n}\n\nexport type PillsInputFieldProps = ComponentPropsWithoutRef<\"input\"> &\n WithTestId & {\n /** Fired on Backspace when the field is empty — pop the last value. */\n onRemoveLast?: () => void\n }\n\nconst PillsInputField = ({\n className,\n onRemoveLast,\n onKeyDown,\n testId,\n ...rest\n}: PillsInputFieldProps) => (\n <input\n // The trailing field the overflow hook keeps on the last visible row.\n data-overflow-field\n // Grow to fill the line, but keep a clickable minimum when empty. Overrides\n // `inputControlClasses`' `w-full min-w-0` so pills can share the row.\n className={cn(inputControlClasses, \"w-auto min-w-16\", className)}\n onKeyDown={(event) => {\n if (onRemoveLast && event.key === \"Backspace\" && event.currentTarget.value === \"\") {\n onRemoveLast()\n }\n onKeyDown?.(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const PillsInput = Object.assign(PillsInputBase, {\n Field: PillsInputField,\n})\n"]}
@@ -2,7 +2,7 @@ import { popoverChrome, popoverGroupLabel, popoverIndicator, popoverChevron } fr
2
2
  import { resolveLogicalPlacement } from './chunk-V6PY7C6S.js';
3
3
  import { useOverlayContainer } from './chunk-7P32XCEU.js';
4
4
  import { useNestedLayer } from './chunk-H7WOMZXO.js';
5
- import { warnRenamedProp } from './chunk-6N6J2DOE.js';
5
+ import { warnRenamedProp } from './chunk-LIZWCWED.js';
6
6
  import { ChevronRightIcon, CheckIcon } from './chunk-6YNLRQ25.js';
7
7
  import { mergeIcons } from './chunk-XXOR34T4.js';
8
8
  import { composeChildren } from './chunk-R5LYFTHA.js';
@@ -314,5 +314,5 @@ var Separator = Divider;
314
314
  var SubContent = Content;
315
315
 
316
316
  export { CheckboxItem, Content, Context, ContextTrigger, Divider, Item, ItemGroup, ItemGroupLabel, Label, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger };
317
- //# sourceMappingURL=chunk-IRNF274I.js.map
318
- //# sourceMappingURL=chunk-IRNF274I.js.map
317
+ //# sourceMappingURL=chunk-PI7X5YFJ.js.map
318
+ //# sourceMappingURL=chunk-PI7X5YFJ.js.map