@seekalfred/primitives 0.6.0 → 0.7.1

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 (322) hide show
  1. package/README.md +19 -11
  2. package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
  3. package/dist/activity-heatmap/activity-heatmap.js +699 -0
  4. package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
  5. package/dist/activity-heatmap/index.d.ts +2 -0
  6. package/dist/activity-heatmap/index.js +2 -0
  7. package/dist/alert/alert.d.ts +5 -1
  8. package/dist/alert/alert.js +68 -7
  9. package/dist/alert/alert.js.map +1 -1
  10. package/dist/alert-dialog/alert-dialog.d.ts +45 -18
  11. package/dist/alert-dialog/alert-dialog.js +128 -9
  12. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  13. package/dist/alert-dialog/index.d.ts +2 -2
  14. package/dist/alert-dialog/index.js +2 -2
  15. package/dist/animated-counter/animated-counter.d.ts +38 -0
  16. package/dist/animated-counter/animated-counter.js +230 -0
  17. package/dist/animated-counter/animated-counter.js.map +1 -0
  18. package/dist/animated-counter/index.d.ts +2 -0
  19. package/dist/animated-counter/index.js +2 -0
  20. package/dist/announcement-bar/announcement-bar.d.ts +67 -0
  21. package/dist/announcement-bar/announcement-bar.js +364 -0
  22. package/dist/announcement-bar/announcement-bar.js.map +1 -0
  23. package/dist/announcement-bar/index.d.ts +2 -0
  24. package/dist/announcement-bar/index.js +2 -0
  25. package/dist/badge/badge.d.ts +1 -1
  26. package/dist/bar-chart/bar-chart.d.ts +51 -0
  27. package/dist/bar-chart/bar-chart.js +565 -0
  28. package/dist/bar-chart/bar-chart.js.map +1 -0
  29. package/dist/bar-chart/index.d.ts +2 -0
  30. package/dist/bar-chart/index.js +2 -0
  31. package/dist/breadcrumb/breadcrumb.d.ts +2 -2
  32. package/dist/breadcrumb/breadcrumb.js +12 -3
  33. package/dist/breadcrumb/breadcrumb.js.map +1 -1
  34. package/dist/brush-chart/brush-chart.d.ts +64 -0
  35. package/dist/brush-chart/brush-chart.js +1056 -0
  36. package/dist/brush-chart/brush-chart.js.map +1 -0
  37. package/dist/brush-chart/index.d.ts +2 -0
  38. package/dist/brush-chart/index.js +2 -0
  39. package/dist/button/button.d.ts +2 -2
  40. package/dist/button/button.js +31 -21
  41. package/dist/button/button.js.map +1 -1
  42. package/dist/button-group/button-group.js +3 -4
  43. package/dist/button-group/button-group.js.map +1 -1
  44. package/dist/card/card.js +1 -1
  45. package/dist/card/card.js.map +1 -1
  46. package/dist/card-stack/card-stack.d.ts +54 -0
  47. package/dist/card-stack/card-stack.js +492 -0
  48. package/dist/card-stack/card-stack.js.map +1 -0
  49. package/dist/card-stack/index.d.ts +2 -0
  50. package/dist/card-stack/index.js +2 -0
  51. package/dist/carousel/carousel.d.ts +56 -0
  52. package/dist/carousel/carousel.js +389 -0
  53. package/dist/carousel/carousel.js.map +1 -0
  54. package/dist/carousel/index.d.ts +2 -0
  55. package/dist/carousel/index.js +2 -0
  56. package/dist/checkbox/checkbox.js +4 -4
  57. package/dist/checkbox/checkbox.js.map +1 -1
  58. package/dist/chip-group/chip-group.d.ts +37 -0
  59. package/dist/chip-group/chip-group.js +148 -0
  60. package/dist/chip-group/chip-group.js.map +1 -0
  61. package/dist/chip-group/index.d.ts +2 -0
  62. package/dist/chip-group/index.js +2 -0
  63. package/dist/countdown/countdown.d.ts +45 -0
  64. package/dist/countdown/countdown.js +298 -0
  65. package/dist/countdown/countdown.js.map +1 -0
  66. package/dist/countdown/index.d.ts +2 -0
  67. package/dist/countdown/index.js +2 -0
  68. package/dist/date-picker/picker-parts.js +1 -1
  69. package/dist/date-picker/picker-parts.js.map +1 -1
  70. package/dist/dialog/dialog.js +1 -1
  71. package/dist/dialog/dialog.js.map +1 -1
  72. package/dist/donut-chart/donut-chart.d.ts +64 -0
  73. package/dist/donut-chart/donut-chart.js +576 -0
  74. package/dist/donut-chart/donut-chart.js.map +1 -0
  75. package/dist/donut-chart/index.d.ts +2 -0
  76. package/dist/donut-chart/index.js +2 -0
  77. package/dist/empty-state/empty-state.d.ts +21 -10
  78. package/dist/empty-state/empty-state.js +32 -26
  79. package/dist/empty-state/empty-state.js.map +1 -1
  80. package/dist/empty-state/index.d.ts +2 -2
  81. package/dist/empty-state/index.js +2 -2
  82. package/dist/file-drop-zone/file-drop-zone.js +1 -1
  83. package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
  84. package/dist/filter-bar/filter-bar.d.ts +47 -26
  85. package/dist/filter-bar/filter-bar.js +272 -156
  86. package/dist/filter-bar/filter-bar.js.map +1 -1
  87. package/dist/gauge/gauge.d.ts +45 -0
  88. package/dist/gauge/gauge.js +219 -0
  89. package/dist/gauge/gauge.js.map +1 -0
  90. package/dist/gauge/index.d.ts +2 -0
  91. package/dist/gauge/index.js +2 -0
  92. package/dist/in-view-title/in-view-title.d.ts +33 -0
  93. package/dist/in-view-title/in-view-title.js +119 -0
  94. package/dist/in-view-title/in-view-title.js.map +1 -0
  95. package/dist/in-view-title/index.d.ts +2 -0
  96. package/dist/in-view-title/index.js +2 -0
  97. package/dist/index.d.ts +49 -6
  98. package/dist/index.js +48 -8
  99. package/dist/lib/cn.js +11 -1
  100. package/dist/lib/cn.js.map +1 -1
  101. package/dist/lib/field-message.js +28 -10
  102. package/dist/lib/field-message.js.map +1 -1
  103. package/dist/lib/field-surface.js +9 -8
  104. package/dist/lib/field-surface.js.map +1 -1
  105. package/dist/lib/flag-emoji.js +50 -0
  106. package/dist/lib/flag-emoji.js.map +1 -0
  107. package/dist/lib/flip.js +11 -3
  108. package/dist/lib/flip.js.map +1 -1
  109. package/dist/lib/menu-highlight.js +64 -0
  110. package/dist/lib/menu-highlight.js.map +1 -0
  111. package/dist/lib/motion.js +9 -2
  112. package/dist/lib/motion.js.map +1 -1
  113. package/dist/lib/rolling-value.js +1 -1
  114. package/dist/lib/rolling-value.js.map +1 -1
  115. package/dist/lib/spring-tween.js +500 -0
  116. package/dist/lib/spring-tween.js.map +1 -0
  117. package/dist/lib/swap-text.js +3 -1
  118. package/dist/lib/swap-text.js.map +1 -1
  119. package/dist/line-chart/index.d.ts +2 -0
  120. package/dist/line-chart/index.js +2 -0
  121. package/dist/line-chart/line-chart.d.ts +76 -0
  122. package/dist/line-chart/line-chart.js +611 -0
  123. package/dist/line-chart/line-chart.js.map +1 -0
  124. package/dist/mention-input/index.d.ts +2 -0
  125. package/dist/mention-input/index.js +2 -0
  126. package/dist/mention-input/mention-input.d.ts +98 -0
  127. package/dist/mention-input/mention-input.js +576 -0
  128. package/dist/mention-input/mention-input.js.map +1 -0
  129. package/dist/menu/menu.d.ts +2 -0
  130. package/dist/menu/menu.js +23 -12
  131. package/dist/menu/menu.js.map +1 -1
  132. package/dist/money-input/index.d.ts +2 -0
  133. package/dist/money-input/index.js +2 -0
  134. package/dist/money-input/money-input.d.ts +65 -0
  135. package/dist/money-input/money-input.js +607 -0
  136. package/dist/money-input/money-input.js.map +1 -0
  137. package/dist/morph-select/index.d.ts +2 -0
  138. package/dist/morph-select/index.js +2 -0
  139. package/dist/morph-select/morph-select.d.ts +71 -0
  140. package/dist/morph-select/morph-select.js +693 -0
  141. package/dist/morph-select/morph-select.js.map +1 -0
  142. package/dist/multi-select/index.d.ts +2 -0
  143. package/dist/multi-select/index.js +2 -0
  144. package/dist/multi-select/multi-select.d.ts +36 -0
  145. package/dist/multi-select/multi-select.js +152 -0
  146. package/dist/multi-select/multi-select.js.map +1 -0
  147. package/dist/number-field/index.d.ts +2 -0
  148. package/dist/number-field/index.js +2 -0
  149. package/dist/number-field/number-field.d.ts +42 -0
  150. package/dist/number-field/number-field.js +199 -0
  151. package/dist/number-field/number-field.js.map +1 -0
  152. package/dist/onboarding-checklist/index.d.ts +2 -0
  153. package/dist/onboarding-checklist/index.js +2 -0
  154. package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
  155. package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
  156. package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
  157. package/dist/password-field/password-field.js +2 -2
  158. package/dist/password-field/password-field.js.map +1 -1
  159. package/dist/phone-input/index.d.ts +3 -0
  160. package/dist/phone-input/index.js +3 -0
  161. package/dist/phone-input/phone-countries.d.ts +29 -0
  162. package/dist/phone-input/phone-countries.js +170 -0
  163. package/dist/phone-input/phone-countries.js.map +1 -0
  164. package/dist/phone-input/phone-input.d.ts +66 -0
  165. package/dist/phone-input/phone-input.js +440 -0
  166. package/dist/phone-input/phone-input.js.map +1 -0
  167. package/dist/popover/popover.d.ts +12 -0
  168. package/dist/popover/popover.js +31 -7
  169. package/dist/popover/popover.js.map +1 -1
  170. package/dist/progress/progress.js +1 -1
  171. package/dist/radio-group/radio-group.js +1 -1
  172. package/dist/radio-group/radio-group.js.map +1 -1
  173. package/dist/reactions/index.d.ts +2 -0
  174. package/dist/reactions/index.js +2 -0
  175. package/dist/reactions/reactions.d.ts +50 -0
  176. package/dist/reactions/reactions.js +315 -0
  177. package/dist/reactions/reactions.js.map +1 -0
  178. package/dist/rich-text-editor/index.d.ts +3 -0
  179. package/dist/rich-text-editor/index.js +2 -0
  180. package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
  181. package/dist/rich-text-editor/rich-text-editor.js +909 -0
  182. package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
  183. package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
  184. package/dist/rich-text-editor/rich-text-engine.js +366 -0
  185. package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
  186. package/dist/rich-text-editor/rich-text-html.js +174 -0
  187. package/dist/rich-text-editor/rich-text-html.js.map +1 -0
  188. package/dist/rich-text-editor/rich-text-icons.js +43 -0
  189. package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
  190. package/dist/ridgeline/index.d.ts +2 -0
  191. package/dist/ridgeline/index.js +2 -0
  192. package/dist/ridgeline/ridgeline.d.ts +55 -0
  193. package/dist/ridgeline/ridgeline.js +701 -0
  194. package/dist/ridgeline/ridgeline.js.map +1 -0
  195. package/dist/scroll-area/index.d.ts +2 -2
  196. package/dist/scroll-area/index.js +2 -2
  197. package/dist/scroll-area/scroll-area.d.ts +68 -31
  198. package/dist/scroll-area/scroll-area.js +208 -59
  199. package/dist/scroll-area/scroll-area.js.map +1 -1
  200. package/dist/scrub-input/evaluate.d.ts +14 -0
  201. package/dist/scrub-input/evaluate.js +72 -0
  202. package/dist/scrub-input/evaluate.js.map +1 -0
  203. package/dist/scrub-input/index.d.ts +3 -0
  204. package/dist/scrub-input/index.js +3 -0
  205. package/dist/scrub-input/scrub-input.d.ts +74 -0
  206. package/dist/scrub-input/scrub-input.js +486 -0
  207. package/dist/scrub-input/scrub-input.js.map +1 -0
  208. package/dist/search-field/search-field.d.ts +2 -1
  209. package/dist/search-field/search-field.js +4 -4
  210. package/dist/search-field/search-field.js.map +1 -1
  211. package/dist/select/select.d.ts +3 -1
  212. package/dist/select/select.js +20 -8
  213. package/dist/select/select.js.map +1 -1
  214. package/dist/separator/separator.d.ts +1 -1
  215. package/dist/sheet/sheet.js +2 -1
  216. package/dist/sheet/sheet.js.map +1 -1
  217. package/dist/shortcut-recorder/index.d.ts +3 -0
  218. package/dist/shortcut-recorder/index.js +3 -0
  219. package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
  220. package/dist/shortcut-recorder/shortcut-model.js +206 -0
  221. package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
  222. package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
  223. package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
  224. package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
  225. package/dist/slider/index.d.ts +2 -2
  226. package/dist/slider/slider.d.ts +46 -14
  227. package/dist/slider/slider.js +151 -67
  228. package/dist/slider/slider.js.map +1 -1
  229. package/dist/slope-chart/index.d.ts +2 -0
  230. package/dist/slope-chart/index.js +2 -0
  231. package/dist/slope-chart/slope-chart.d.ts +54 -0
  232. package/dist/slope-chart/slope-chart.js +568 -0
  233. package/dist/slope-chart/slope-chart.js.map +1 -0
  234. package/dist/sparkline/index.d.ts +2 -0
  235. package/dist/sparkline/index.js +2 -0
  236. package/dist/sparkline/sparkline.d.ts +46 -0
  237. package/dist/sparkline/sparkline.js +390 -0
  238. package/dist/sparkline/sparkline.js.map +1 -0
  239. package/dist/split-bar/index.d.ts +2 -0
  240. package/dist/split-bar/index.js +2 -0
  241. package/dist/split-bar/split-bar.d.ts +62 -0
  242. package/dist/split-bar/split-bar.js +513 -0
  243. package/dist/split-bar/split-bar.js.map +1 -0
  244. package/dist/split-button/split-button.d.ts +1 -1
  245. package/dist/split-button/split-button.js +12 -11
  246. package/dist/split-button/split-button.js.map +1 -1
  247. package/dist/stat-card/index.d.ts +2 -2
  248. package/dist/stat-card/index.js +2 -2
  249. package/dist/stat-card/stat-card.d.ts +24 -4
  250. package/dist/stat-card/stat-card.js +114 -17
  251. package/dist/stat-card/stat-card.js.map +1 -1
  252. package/dist/stepper/index.d.ts +2 -0
  253. package/dist/stepper/index.js +2 -0
  254. package/dist/stepper/stepper.d.ts +51 -0
  255. package/dist/stepper/stepper.js +215 -0
  256. package/dist/stepper/stepper.js.map +1 -0
  257. package/dist/streamgraph/index.d.ts +2 -0
  258. package/dist/streamgraph/index.js +2 -0
  259. package/dist/streamgraph/streamgraph.d.ts +70 -0
  260. package/dist/streamgraph/streamgraph.js +613 -0
  261. package/dist/streamgraph/streamgraph.js.map +1 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/swipe-actions/index.d.ts +2 -0
  264. package/dist/swipe-actions/index.js +2 -0
  265. package/dist/swipe-actions/swipe-actions.d.ts +67 -0
  266. package/dist/swipe-actions/swipe-actions.js +552 -0
  267. package/dist/swipe-actions/swipe-actions.js.map +1 -0
  268. package/dist/switch/switch.js +2 -2
  269. package/dist/switch/switch.js.map +1 -1
  270. package/dist/table/index.d.ts +2 -2
  271. package/dist/table/index.js +2 -2
  272. package/dist/table/table.d.ts +56 -4
  273. package/dist/table/table.js +340 -165
  274. package/dist/table/table.js.map +1 -1
  275. package/dist/tabs/tabs.js +2 -2
  276. package/dist/tabs/tabs.js.map +1 -1
  277. package/dist/tag-input/index.d.ts +2 -0
  278. package/dist/tag-input/index.js +2 -0
  279. package/dist/tag-input/tag-input.d.ts +40 -0
  280. package/dist/tag-input/tag-input.js +269 -0
  281. package/dist/tag-input/tag-input.js.map +1 -0
  282. package/dist/text-morph/index.d.ts +2 -0
  283. package/dist/text-morph/index.js +2 -0
  284. package/dist/text-morph/text-morph.d.ts +23 -0
  285. package/dist/text-morph/text-morph.js +21 -0
  286. package/dist/text-morph/text-morph.js.map +1 -0
  287. package/dist/text-reveal/index.d.ts +2 -0
  288. package/dist/text-reveal/index.js +2 -0
  289. package/dist/text-reveal/text-reveal.d.ts +27 -0
  290. package/dist/text-reveal/text-reveal.js +51 -0
  291. package/dist/text-reveal/text-reveal.js.map +1 -0
  292. package/dist/text-shimmer/index.d.ts +2 -0
  293. package/dist/text-shimmer/index.js +2 -0
  294. package/dist/text-shimmer/text-shimmer.d.ts +29 -0
  295. package/dist/text-shimmer/text-shimmer.js +29 -0
  296. package/dist/text-shimmer/text-shimmer.js.map +1 -0
  297. package/dist/time-picker/time-picker.js +2 -2
  298. package/dist/time-picker/time-picker.js.map +1 -1
  299. package/dist/toast/index.d.ts +2 -2
  300. package/dist/toast/index.js +2 -2
  301. package/dist/toast/toast.d.ts +6 -0
  302. package/dist/toast/toast.js +82 -40
  303. package/dist/toast/toast.js.map +1 -1
  304. package/dist/tooltip/tooltip.d.ts +9 -2
  305. package/dist/tooltip/tooltip.js +7 -7
  306. package/dist/tooltip/tooltip.js.map +1 -1
  307. package/dist/treemap/index.d.ts +2 -0
  308. package/dist/treemap/index.js +2 -0
  309. package/dist/treemap/treemap.d.ts +53 -0
  310. package/dist/treemap/treemap.js +699 -0
  311. package/dist/treemap/treemap.js.map +1 -0
  312. package/dist/usage-meter/index.d.ts +2 -0
  313. package/dist/usage-meter/index.js +2 -0
  314. package/dist/usage-meter/usage-meter.d.ts +50 -0
  315. package/dist/usage-meter/usage-meter.js +440 -0
  316. package/dist/usage-meter/usage-meter.js.map +1 -0
  317. package/dist/waffle-chart/index.d.ts +2 -0
  318. package/dist/waffle-chart/index.js +2 -0
  319. package/dist/waffle-chart/waffle-chart.d.ts +57 -0
  320. package/dist/waffle-chart/waffle-chart.js +426 -0
  321. package/dist/waffle-chart/waffle-chart.js.map +1 -0
  322. package/package.json +165 -3
@@ -0,0 +1,607 @@
1
+ "use client";
2
+ import { cn, cnAll } from "../lib/cn.js";
3
+ import { useIsomorphicLayoutEffect, useMorphWidth } from "../lib/motion.js";
4
+ import { Button as Button$1 } from "../button/button.js";
5
+ import { SwapText } from "../lib/swap-text.js";
6
+ import { fieldSurfaceVariants } from "../lib/field-surface.js";
7
+ import { RollingNumber } from "../lib/field-message.js";
8
+ import { FieldShell, useFieldWiring } from "../lib/field-shell.js";
9
+ import { SelectItem, selectPopoverVariants } from "../select/select.js";
10
+ import { forwardRef, useCallback, useId, useImperativeHandle, useMemo, useReducer, useRef, useState } from "react";
11
+ import { Button, Group, Input, ListBox, Popover, Select, SelectValue } from "react-aria-components";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
+ //#region src/money-input/money-input.tsx
14
+ const MAX_INTEGER_DIGITS = 12;
15
+ /** How far, in px, the amount is pushed toward a limit it just met. */
16
+ const STRAIN_PX = 6;
17
+ const infoCache = /* @__PURE__ */ new Map();
18
+ function currencyInfo(code, locale) {
19
+ const cacheKey = `${locale}:${code}`;
20
+ const cached = infoCache.get(cacheKey);
21
+ if (cached) return cached;
22
+ const full = new Intl.NumberFormat(locale, {
23
+ style: "currency",
24
+ currency: code,
25
+ currencyDisplay: "narrowSymbol",
26
+ numberingSystem: "latn"
27
+ });
28
+ const parts = full.formatToParts(1);
29
+ const symbolAt = parts.findIndex((part) => part.type === "currency");
30
+ const numberAt = parts.findIndex((part) => part.type === "integer");
31
+ const digits = full.resolvedOptions().maximumFractionDigits ?? 2;
32
+ let name = code;
33
+ try {
34
+ name = new Intl.DisplayNames([locale], { type: "currency" }).of(code) ?? code;
35
+ } catch {}
36
+ const info = {
37
+ code,
38
+ symbol: parts[symbolAt]?.value ?? code,
39
+ position: symbolAt < numberAt ? "prefix" : "suffix",
40
+ digits,
41
+ name: name.charAt(0).toUpperCase() + name.slice(1),
42
+ full,
43
+ whole: new Intl.NumberFormat(locale, {
44
+ style: "currency",
45
+ currency: code,
46
+ currencyDisplay: "narrowSymbol",
47
+ maximumFractionDigits: 0,
48
+ numberingSystem: "latn"
49
+ })
50
+ };
51
+ infoCache.set(cacheKey, info);
52
+ return info;
53
+ }
54
+ function localeSymbols(locale) {
55
+ const parts = new Intl.NumberFormat(locale, { numberingSystem: "latn" }).formatToParts(12345.6);
56
+ return {
57
+ group: parts.find((part) => part.type === "group")?.value ?? ",",
58
+ decimal: parts.find((part) => part.type === "decimal")?.value ?? "."
59
+ };
60
+ }
61
+ const pow10 = (digits) => 10 ** digits;
62
+ function toMinor(draft, digits) {
63
+ if (!draft) return null;
64
+ const [whole, fraction = ""] = draft.split(".");
65
+ return Number(whole || "0") * pow10(digits) + Number(fraction.padEnd(digits, "0").slice(0, digits) || "0");
66
+ }
67
+ function fromMinor(minor, digits) {
68
+ if (minor === null || minor === void 0 || !Number.isFinite(minor)) return "";
69
+ const text = String(Math.round(Math.abs(minor))).padStart(digits + 1, "0");
70
+ return digits ? `${text.slice(0, text.length - digits)}.${text.slice(text.length - digits)}` : text;
71
+ }
72
+ /** Settles a draft the way it will be read back: fraction padded to the currency, leading zeros gone. */
73
+ function settle(draft, digits) {
74
+ return draft ? fromMinor(toMinor(draft, digits), digits) : "";
75
+ }
76
+ /** Carries an amount across currencies with different minor units, keeping the major amount. */
77
+ function convertDraft(draft, digits) {
78
+ if (!draft) return "";
79
+ const [whole = "", fraction] = draft.split(".");
80
+ if (!digits) return whole || "0";
81
+ return fraction === void 0 ? whole : `${whole}.${fraction.slice(0, digits)}`;
82
+ }
83
+ const groupInteger = (whole, group) => whole.replace(/\B(?=(\d{3})+(?!\d))/g, group);
84
+ function displayOf(draft, symbols) {
85
+ if (!draft) return "";
86
+ const [whole = "", fraction] = draft.split(".");
87
+ return groupInteger(whole, symbols.group) + (fraction !== void 0 ? symbols.decimal + fraction : "");
88
+ }
89
+ const isSignificant = (char, decimal) => /\d/.test(char) || char === decimal;
90
+ function positionAfter(text, count, decimal) {
91
+ if (count <= 0) return 0;
92
+ let seen = 0;
93
+ for (let index = 0; index < text.length; index++) if (isSignificant(text[index], decimal) && ++seen === count) return index + 1;
94
+ return text.length;
95
+ }
96
+ /** The currency symbol swaps with a short rise while its slot springs to the new width. */
97
+ function SymbolSlot({ symbol, side }) {
98
+ const content = useRef(null);
99
+ useMorphWidth(content, symbol);
100
+ return /* @__PURE__ */ jsx("span", {
101
+ "aria-hidden": "true",
102
+ "data-slot": "money-input-symbol",
103
+ className: cnAll("button-slot text-text-secondary", side === "prefix" ? "me-1" : "ms-1.5"),
104
+ children: /* @__PURE__ */ jsx("span", {
105
+ ref: content,
106
+ className: "inline-flex flex-none items-center whitespace-pre",
107
+ children: /* @__PURE__ */ jsx(SwapText, {
108
+ swapKey: symbol,
109
+ motion: "rise",
110
+ className: "inline-block",
111
+ children: symbol
112
+ })
113
+ })
114
+ });
115
+ }
116
+ /** The amount the eye sees: whole part, separator and the cents, with the missing ones as muted ghosts. */
117
+ function Amount({ draft, digits, symbols, direction, still }) {
118
+ const [whole = "", fraction] = draft ? draft.split(".") : [];
119
+ const typed = fraction ?? "";
120
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
121
+ "data-ghost": !whole || void 0,
122
+ className: "inline-flex data-[ghost]:text-muted-foreground",
123
+ children: /* @__PURE__ */ jsx(RollingNumber, {
124
+ word: groupInteger(whole || "0", symbols.group),
125
+ direction,
126
+ still
127
+ })
128
+ }), digits > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
129
+ /* @__PURE__ */ jsx("span", {
130
+ "data-ghost": fraction === void 0 || void 0,
131
+ className: "data-[ghost]:text-muted-foreground",
132
+ children: symbols.decimal
133
+ }),
134
+ typed ? /* @__PURE__ */ jsx("span", {
135
+ className: "inline-flex",
136
+ children: /* @__PURE__ */ jsx(RollingNumber, {
137
+ word: typed,
138
+ direction,
139
+ still
140
+ })
141
+ }) : null,
142
+ typed.length < digits ? /* @__PURE__ */ jsx("span", {
143
+ className: "text-muted-foreground",
144
+ children: "0".repeat(digits - typed.length)
145
+ }) : null
146
+ ] }) : null] });
147
+ }
148
+ const triggerClass = "inline-flex h-9 flex-none cursor-pointer items-center gap-1 rounded-pill border-0 bg-transparent ps-3 pe-2 font-sans text-sm font-medium tabular-nums text-foreground outline-none motion-safe:transition-[background-color] motion-safe:duration-(--duration-quick) motion-safe:ease-settle data-[hovered]:bg-muted data-[pressed]:bg-muted data-[disabled]:cursor-not-allowed data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width) data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)";
149
+ const shellClass = cnAll(fieldSurfaceVariants(), "flex h-19 items-center gap-2 rounded-panel ps-4.5 pe-2", "has-[input:focus]:not-data-[invalid]:border-foreground", "forced-colors:has-[input:focus]:outline-solid forced-colors:has-[input:focus]:outline-(length:--focus-ring-width) forced-colors:has-[input:focus]:outline-offset-(--focus-ring-offset)");
150
+ const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false, value, defaultValue = null, onValueChange, currency: currencyProp, defaultCurrency = "USD", onCurrencyChange, currencies = [
151
+ "USD",
152
+ "EUR",
153
+ "GBP",
154
+ "JPY",
155
+ "CAD",
156
+ "AUD",
157
+ "CHF",
158
+ "INR"
159
+ ], min, max, quickAdd = [
160
+ 10,
161
+ 50,
162
+ 100
163
+ ], step: stepProp, locale = "en-US", description, error, disabled = false, name, id, className, onBlur }, forwardedRef) {
164
+ const generated = useId();
165
+ const inputId = id ?? `${generated}-amount`;
166
+ const rangeId = `${inputId}-range`;
167
+ const [innerCurrency, setInnerCurrency] = useState(defaultCurrency);
168
+ const code = currencyProp ?? innerCurrency;
169
+ const info = useMemo(() => currencyInfo(code, locale), [code, locale]);
170
+ const symbols = useMemo(() => localeSymbols(locale), [locale]);
171
+ const step = stepProp && stepProp > 0 ? stepProp : pow10(info.digits);
172
+ const [draft, setDraft] = useState(() => fromMinor(value !== void 0 ? value : defaultValue, info.digits));
173
+ const minor = toMinor(draft, info.digits);
174
+ const [seenValue, setSeenValue] = useState(value);
175
+ const [source, setSource] = useState("external");
176
+ const [direction, setDirection] = useState(1);
177
+ if (value !== seenValue) {
178
+ setSeenValue(value);
179
+ if (value !== void 0 && value !== minor) {
180
+ setDraft(fromMinor(value, info.digits));
181
+ setSource("external");
182
+ setDirection((value ?? 0) >= (minor ?? 0) ? 1 : -1);
183
+ }
184
+ }
185
+ const [focused, setFocused] = useState(false);
186
+ const [touched, setTouched] = useState(false);
187
+ const [flash, setFlash] = useState(false);
188
+ const [announcement, setAnnouncement] = useState("");
189
+ const [, rerender] = useReducer((count) => count + 1, 0);
190
+ const inputRef = useRef(null);
191
+ useImperativeHandle(forwardedRef, () => inputRef.current);
192
+ const pendingCaret = useRef(null);
193
+ const latest = useRef({
194
+ minor,
195
+ draft
196
+ });
197
+ useIsomorphicLayoutEffect(() => {
198
+ latest.current = {
199
+ minor,
200
+ draft
201
+ };
202
+ });
203
+ const money = useCallback((amount) => amount === null ? "" : info.full.format(amount / pow10(info.digits)), [info]);
204
+ const groupRef = useRef(null);
205
+ const flashTimer = useRef(void 0);
206
+ function refuse(toward, limit) {
207
+ const node = groupRef.current;
208
+ if (node) {
209
+ node.style.setProperty("--strain-x", `${toward * STRAIN_PX}px`);
210
+ node.removeAttribute("data-strain");
211
+ node.offsetWidth;
212
+ node.setAttribute("data-strain", "");
213
+ }
214
+ setFlash(true);
215
+ window.clearTimeout(flashTimer.current);
216
+ flashTimer.current = window.setTimeout(() => setFlash(false), 1400);
217
+ setAnnouncement(`${toward > 0 ? "Maximum" : "Minimum"} is ${money(limit)}`);
218
+ }
219
+ function emit(nextMinor, nextInfo = info) {
220
+ onValueChange?.(nextMinor, {
221
+ currency: nextInfo.code,
222
+ major: nextMinor === null ? null : nextMinor / pow10(nextInfo.digits),
223
+ formatted: nextMinor === null ? "" : nextInfo.full.format(nextMinor / pow10(nextInfo.digits))
224
+ });
225
+ }
226
+ function setAmount(nextDraft, nextSource) {
227
+ const nextMinor = toMinor(nextDraft, info.digits);
228
+ setDirection((nextMinor ?? 0) >= (latest.current.minor ?? 0) ? 1 : -1);
229
+ setSource(nextSource);
230
+ setDraft(nextDraft);
231
+ latest.current = {
232
+ minor: nextMinor,
233
+ draft: nextDraft
234
+ };
235
+ if (nextMinor !== minor) emit(nextMinor);
236
+ if (nextSource !== "type") setAnnouncement(money(nextMinor));
237
+ }
238
+ /** Reads what the input holds into a draft and counts the digits and decimal before the caret, so the caret can return to the same spot. */
239
+ function sanitize(raw, caret) {
240
+ let out = "";
241
+ let before = 0;
242
+ let dot = false;
243
+ for (let index = 0; index < raw.length; index++) {
244
+ const char = raw[index];
245
+ let kept = "";
246
+ if (/\d/.test(char)) kept = char;
247
+ else if ((char === symbols.decimal || char === "." && symbols.group !== ".") && info.digits > 0 && !dot) {
248
+ kept = ".";
249
+ dot = true;
250
+ }
251
+ if (!kept) continue;
252
+ out += kept;
253
+ if (index < caret) before++;
254
+ }
255
+ const pieces = out.split(".");
256
+ let whole = pieces[0];
257
+ const fraction = pieces[1];
258
+ const stripped = whole.length - whole.replace(/^0+/, "").length;
259
+ whole = whole.replace(/^0+/, "");
260
+ let shift = -Math.min(stripped, before);
261
+ if (fraction !== void 0 && !whole) {
262
+ whole = "0";
263
+ shift += 1;
264
+ }
265
+ if (fraction === void 0 && !whole && stripped) {
266
+ whole = "0";
267
+ shift += 1;
268
+ }
269
+ if (fraction !== void 0 && fraction.length > info.digits) return null;
270
+ if (whole.length > MAX_INTEGER_DIGITS) return null;
271
+ return {
272
+ draft: fraction !== void 0 ? `${whole}.${fraction}` : whole,
273
+ before: Math.max(0, before + shift)
274
+ };
275
+ }
276
+ function applyRaw(raw, caret) {
277
+ const result = sanitize(raw, caret);
278
+ if (!result) {
279
+ pendingCaret.current = Math.max(0, [...raw.slice(0, caret)].filter((char) => isSignificant(char, symbols.decimal) || char === ".").length - 1);
280
+ rerender();
281
+ return;
282
+ }
283
+ const nextMinor = toMinor(result.draft, info.digits);
284
+ if (max !== void 0 && nextMinor !== null && nextMinor > max) {
285
+ pendingCaret.current = Math.max(0, result.before - 1);
286
+ refuse(1, max);
287
+ rerender();
288
+ return;
289
+ }
290
+ pendingCaret.current = result.before;
291
+ setAmount(result.draft, "type");
292
+ }
293
+ useIsomorphicLayoutEffect(() => {
294
+ const input = inputRef.current;
295
+ const count = pendingCaret.current;
296
+ pendingCaret.current = null;
297
+ if (!input || count === null || document.activeElement !== input) return;
298
+ const position = positionAfter(input.value, count, symbols.decimal);
299
+ input.setSelectionRange(position, position);
300
+ });
301
+ function nudge(amount, nextSource) {
302
+ const from = latest.current.minor ?? 0;
303
+ const floor = min ?? 0;
304
+ const ceiling = max ?? Number.MAX_SAFE_INTEGER;
305
+ let next = from + amount;
306
+ if (next > ceiling) {
307
+ if (from >= ceiling) {
308
+ refuse(1, ceiling);
309
+ return;
310
+ }
311
+ next = ceiling;
312
+ refuse(1, ceiling);
313
+ }
314
+ if (next < floor) {
315
+ if (from <= floor && latest.current.minor !== null) {
316
+ refuse(-1, floor);
317
+ return;
318
+ }
319
+ next = floor;
320
+ }
321
+ pendingCaret.current = Number.MAX_SAFE_INTEGER;
322
+ setAmount(fromMinor(next, info.digits), nextSource);
323
+ }
324
+ function onKeyDown(event) {
325
+ const input = event.currentTarget;
326
+ const moves = {
327
+ ArrowUp: 1,
328
+ ArrowDown: -1,
329
+ PageUp: 10,
330
+ PageDown: -10
331
+ };
332
+ if (event.key in moves) {
333
+ event.preventDefault();
334
+ const unit = moves[event.key];
335
+ nudge(unit * step * (event.shiftKey && Math.abs(unit) === 1 ? 10 : 1), "key");
336
+ return;
337
+ }
338
+ if (event.key === "Enter") {
339
+ setDraft(settle(draft, info.digits));
340
+ pendingCaret.current = Number.MAX_SAFE_INTEGER;
341
+ return;
342
+ }
343
+ const start = input.selectionStart ?? 0;
344
+ if (start !== (input.selectionEnd ?? 0) || event.metaKey || event.ctrlKey || event.altKey) return;
345
+ if (event.key === "Backspace" && start > 1 && input.value[start - 1] === symbols.group) {
346
+ event.preventDefault();
347
+ applyRaw(input.value.slice(0, start - 2) + input.value.slice(start - 1), start - 2);
348
+ }
349
+ if (event.key === "Delete" && input.value[start] === symbols.group) {
350
+ event.preventDefault();
351
+ applyRaw(input.value.slice(0, start + 1) + input.value.slice(start + 2), start);
352
+ }
353
+ }
354
+ function onPaste(event) {
355
+ const text = event.clipboardData.getData("text").trim();
356
+ if (!text) return;
357
+ event.preventDefault();
358
+ const match = /[.,](\d{1,2})\s*\D*$/.exec(text);
359
+ const whole = (match ? text.slice(0, match.index) : text).replace(/\D/g, "");
360
+ const pasted = match && info.digits ? `${whole}.${match[1]}` : whole;
361
+ if (!/\d/.test(pasted)) return;
362
+ const input = event.currentTarget;
363
+ const start = input.selectionStart ?? 0;
364
+ const end = input.selectionEnd ?? 0;
365
+ const inserted = pasted.replace(".", symbols.decimal);
366
+ const replaceAll = start === 0 && end === input.value.length || !input.value;
367
+ const raw = replaceAll ? inserted : input.value.slice(0, start) + inserted + input.value.slice(end);
368
+ applyRaw(raw, replaceAll ? raw.length : start + inserted.length);
369
+ }
370
+ const wrapRef = useRef(null);
371
+ useIsomorphicLayoutEffect(() => {
372
+ const wrap = wrapRef.current;
373
+ const group = groupRef.current;
374
+ if (!wrap || !group || typeof ResizeObserver === "undefined") return;
375
+ const fit = () => {
376
+ const natural = group.offsetWidth;
377
+ const room = wrap.clientWidth;
378
+ group.style.scale = String(natural > 0 && room > 0 ? Math.min(1, room / natural) : 1);
379
+ if (!group.hasAttribute("data-ready")) {
380
+ group.offsetWidth;
381
+ group.setAttribute("data-ready", "");
382
+ }
383
+ };
384
+ fit();
385
+ const observer = new ResizeObserver(fit);
386
+ observer.observe(wrap);
387
+ observer.observe(group);
388
+ return () => observer.disconnect();
389
+ }, []);
390
+ const options = useMemo(() => currencies.map((entry) => currencyInfo(entry, locale)), [currencies, locale]);
391
+ function chooseCurrency(next) {
392
+ if (next.code === code) return;
393
+ const nextDraft = focused ? convertDraft(draft, next.digits) : settle(convertDraft(draft, next.digits), next.digits);
394
+ const nextMinor = toMinor(nextDraft, next.digits);
395
+ if (currencyProp === void 0) setInnerCurrency(next.code);
396
+ onCurrencyChange?.(next.code);
397
+ setSource("external");
398
+ setDraft(nextDraft);
399
+ latest.current = {
400
+ minor: nextMinor,
401
+ draft: nextDraft
402
+ };
403
+ emit(nextMinor, next);
404
+ setAnnouncement(`${next.name}${nextMinor === null ? "" : `, ${next.full.format(nextMinor / pow10(next.digits))}`}`);
405
+ }
406
+ const range = min !== void 0 && max !== void 0 ? `${money(min)} to ${money(max)}` : max !== void 0 ? `Up to ${money(max)}` : min !== void 0 ? `At least ${money(min)}` : "";
407
+ const belowMin = minor !== null && min !== void 0 && minor < min;
408
+ const builtIn = touched && !focused && (belowMin || minor !== null && max !== void 0 && minor > max) ? belowMin ? `The minimum is ${money(min ?? 0)}` : `The maximum is ${money(max ?? 0)}` : void 0;
409
+ const message = error ?? builtIn;
410
+ const chips = quickAdd.filter((amount) => amount > 0);
411
+ const field = useFieldWiring({
412
+ enabled: true,
413
+ id: inputId,
414
+ describedBy: range ? rangeId : void 0,
415
+ invalid: void 0,
416
+ description,
417
+ error: message
418
+ });
419
+ const typing = source === "type";
420
+ const display = displayOf(draft, symbols);
421
+ const canSwitch = options.length > 1;
422
+ const control = /* @__PURE__ */ jsxs(Fragment$1, { children: [
423
+ /* @__PURE__ */ jsxs(Group, {
424
+ role: "presentation",
425
+ isDisabled: disabled,
426
+ isInvalid: Boolean(message),
427
+ "data-slot": "money-input-shell",
428
+ className: shellClass,
429
+ children: [/* @__PURE__ */ jsx("div", {
430
+ ref: wrapRef,
431
+ className: "relative flex h-full min-w-0 flex-1 cursor-text items-center overflow-hidden",
432
+ onMouseDown: (event) => {
433
+ if (event.target !== inputRef.current) event.preventDefault();
434
+ },
435
+ onClick: (event) => {
436
+ if (disabled || event.target === inputRef.current) return;
437
+ const input = inputRef.current;
438
+ input?.focus();
439
+ input?.setSelectionRange(input.value.length, input.value.length);
440
+ },
441
+ children: /* @__PURE__ */ jsxs("div", {
442
+ ref: groupRef,
443
+ "data-slot": "money-input-amount",
444
+ className: "inline-flex flex-none origin-left items-baseline whitespace-nowrap font-display text-h2 font-medium tabular-nums text-foreground data-[ready]:motion-safe:transition-[scale] data-[ready]:motion-safe:duration-(--duration-smooth) data-[ready]:motion-safe:ease-smooth data-[strain]:motion-safe:animate-field-strain",
445
+ children: [
446
+ info.position === "prefix" ? /* @__PURE__ */ jsx(SymbolSlot, {
447
+ symbol: info.symbol,
448
+ side: "prefix"
449
+ }) : null,
450
+ /* @__PURE__ */ jsxs("span", {
451
+ className: "relative inline-flex",
452
+ children: [/* @__PURE__ */ jsx("span", {
453
+ "aria-hidden": "true",
454
+ "data-slot": "money-input-display",
455
+ className: "inline-flex",
456
+ children: /* @__PURE__ */ jsx(Amount, {
457
+ draft,
458
+ digits: info.digits,
459
+ symbols,
460
+ direction,
461
+ still: typing
462
+ })
463
+ }), /* @__PURE__ */ jsx(Input, {
464
+ ref: inputRef,
465
+ ...field.controlProps,
466
+ "data-slot": "money-input-input",
467
+ type: "text",
468
+ role: "spinbutton",
469
+ inputMode: info.digits ? "decimal" : "numeric",
470
+ autoComplete: "off",
471
+ spellCheck: false,
472
+ value: display,
473
+ disabled,
474
+ "aria-label": labelHidden ? label : void 0,
475
+ "aria-valuenow": minor === null ? void 0 : minor / pow10(info.digits),
476
+ "aria-valuetext": minor === null ? "Empty" : money(minor),
477
+ "aria-valuemin": min === void 0 ? void 0 : min / pow10(info.digits),
478
+ "aria-valuemax": max === void 0 ? void 0 : max / pow10(info.digits),
479
+ onChange: (event) => applyRaw(event.currentTarget.value, event.currentTarget.selectionStart ?? event.currentTarget.value.length),
480
+ onKeyDown,
481
+ onPaste,
482
+ onFocus: () => setFocused(true),
483
+ onBlur: (event) => {
484
+ setFocused(false);
485
+ setTouched(true);
486
+ if (draft) setDraft(settle(draft, info.digits));
487
+ onBlur?.(event);
488
+ },
489
+ className: "absolute top-0 left-0 z-10 m-0 h-full w-[calc(100%+0.5em)] border-0 bg-transparent p-0 [font:inherit] text-transparent caret-foreground outline-none selection:bg-primary/20 selection:text-transparent data-[disabled]:cursor-not-allowed"
490
+ })]
491
+ }),
492
+ info.position === "suffix" ? /* @__PURE__ */ jsx(SymbolSlot, {
493
+ symbol: info.symbol,
494
+ side: "suffix"
495
+ }) : null
496
+ ]
497
+ })
498
+ }), canSwitch ? /* @__PURE__ */ jsxs(Select, {
499
+ "aria-label": "Currency",
500
+ selectedKey: code,
501
+ isDisabled: disabled,
502
+ onSelectionChange: (key) => {
503
+ const next = options.find((option) => option.code === key);
504
+ if (next) chooseCurrency(next);
505
+ },
506
+ "data-slot": "money-input-currency",
507
+ className: "flex-none",
508
+ children: [/* @__PURE__ */ jsxs(Button, {
509
+ className: cnAll(triggerClass, "group/trigger"),
510
+ children: [/* @__PURE__ */ jsx(SelectValue, { children: () => code }), /* @__PURE__ */ jsx("svg", {
511
+ "aria-hidden": "true",
512
+ viewBox: "0 0 16 16",
513
+ fill: "none",
514
+ stroke: "currentColor",
515
+ strokeWidth: "1.75",
516
+ strokeLinecap: "round",
517
+ strokeLinejoin: "round",
518
+ className: "size-4 text-muted-foreground motion-safe:transition-[rotate] motion-safe:duration-(--duration-gentle) motion-safe:ease-gentle group-aria-expanded/trigger:rotate-180",
519
+ children: /* @__PURE__ */ jsx("path", { d: "m4 6 4 4 4-4" })
520
+ })]
521
+ }), /* @__PURE__ */ jsx(Popover, {
522
+ placement: "bottom end",
523
+ offset: 12,
524
+ "data-slot": "money-input-currency-popover",
525
+ className: cnAll(selectPopoverVariants(), "w-64"),
526
+ children: /* @__PURE__ */ jsx(ListBox, {
527
+ "aria-label": "Currency",
528
+ className: "outline-none",
529
+ children: options.map((option) => /* @__PURE__ */ jsxs(SelectItem, {
530
+ id: option.code,
531
+ textValue: option.code,
532
+ children: [
533
+ /* @__PURE__ */ jsx("span", {
534
+ "aria-hidden": "true",
535
+ className: "w-6 flex-none text-center text-muted-foreground",
536
+ children: option.symbol
537
+ }),
538
+ /* @__PURE__ */ jsx("span", {
539
+ className: "flex-none font-medium tabular-nums",
540
+ children: option.code
541
+ }),
542
+ /* @__PURE__ */ jsx("span", {
543
+ className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
544
+ children: option.name
545
+ })
546
+ ]
547
+ }, option.code))
548
+ })
549
+ })]
550
+ }) : /* @__PURE__ */ jsx("span", {
551
+ "data-slot": "money-input-currency",
552
+ className: "flex-none px-2.5 text-sm font-medium text-text-secondary",
553
+ children: code
554
+ })]
555
+ }),
556
+ chips.length > 0 || range ? /* @__PURE__ */ jsxs("div", {
557
+ className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 pt-3",
558
+ children: [chips.length > 0 ? /* @__PURE__ */ jsx("div", {
559
+ role: "group",
560
+ "aria-label": "Quick add",
561
+ className: "flex flex-wrap gap-1.5",
562
+ children: chips.map((amount) => /* @__PURE__ */ jsxs(Button$1, {
563
+ variant: "outlineNeutral",
564
+ size: "sm",
565
+ isDisabled: disabled || max !== void 0 && (minor ?? 0) >= max,
566
+ "aria-controls": inputId,
567
+ "aria-label": `Add ${info.whole.format(amount)}`,
568
+ onPress: () => nudge(amount * pow10(info.digits), "chip"),
569
+ children: ["+", info.whole.format(amount)]
570
+ }, amount))
571
+ }) : null, range ? /* @__PURE__ */ jsx("span", {
572
+ id: rangeId,
573
+ "data-flash": flash || void 0,
574
+ className: "text-xs tabular-nums text-muted-foreground motion-safe:transition-colors motion-safe:duration-(--duration-standard) data-[flash]:text-destructive-strong motion-safe:data-[flash]:duration-(--duration-instant)",
575
+ children: range
576
+ }) : null]
577
+ }) : null,
578
+ name ? /* @__PURE__ */ jsx("input", {
579
+ type: "hidden",
580
+ name,
581
+ value: minor ?? ""
582
+ }) : null,
583
+ /* @__PURE__ */ jsx("span", {
584
+ className: "sr-only",
585
+ role: "status",
586
+ "aria-live": "polite",
587
+ children: announcement
588
+ })
589
+ ] });
590
+ return /* @__PURE__ */ jsx("div", {
591
+ className: cn("w-full min-w-0 font-sans", className),
592
+ "data-slot": "money-input",
593
+ children: /* @__PURE__ */ jsx(FieldShell, {
594
+ label: labelHidden ? null : label,
595
+ controlId: field.controlId,
596
+ description,
597
+ hintId: field.hintId,
598
+ error: message,
599
+ errorId: field.errorId,
600
+ children: control
601
+ })
602
+ });
603
+ });
604
+ //#endregion
605
+ export { MoneyInput };
606
+
607
+ //# sourceMappingURL=money-input.js.map