@koide-labs/ui 0.0.15 → 0.1.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 (310) hide show
  1. package/dist/-utils.d.ts +2 -2
  2. package/dist/-utils.js +1 -1
  3. package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
  4. package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
  5. package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
  6. package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
  7. package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
  8. package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
  9. package/dist/accordion.css +1 -0
  10. package/dist/alert-dialog.css +1 -0
  11. package/dist/anchor.css +1 -0
  12. package/dist/avatar.css +1 -0
  13. package/dist/badge.css +1 -0
  14. package/dist/button.css +1 -0
  15. package/dist/checkbox.css +1 -0
  16. package/dist/code.css +1 -0
  17. package/dist/collapse.css +1 -0
  18. package/dist/command.css +1 -0
  19. package/dist/components/accordion/accordion.d.ts +19 -0
  20. package/dist/components/accordion/accordion.js +701 -0
  21. package/dist/components/accordion/index.d.ts +1 -12
  22. package/dist/components/accordion/index.js +2 -697
  23. package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
  24. package/dist/components/alert-dialog/alert-dialog.js +138 -0
  25. package/dist/components/alert-dialog/index.d.ts +1 -26
  26. package/dist/components/alert-dialog/index.js +2 -134
  27. package/dist/components/anchor/anchor.d.ts +12 -0
  28. package/dist/components/anchor/anchor.js +21 -0
  29. package/dist/components/anchor/index.d.ts +1 -8
  30. package/dist/components/anchor/index.js +2 -19
  31. package/dist/components/avatar/avatar.d.ts +25 -0
  32. package/dist/components/avatar/avatar.js +161 -0
  33. package/dist/components/avatar/index.d.ts +1 -21
  34. package/dist/components/avatar/index.js +2 -159
  35. package/dist/components/badge/badge.d.ts +20 -0
  36. package/dist/components/badge/badge.js +42 -0
  37. package/dist/components/badge/index.d.ts +1 -16
  38. package/dist/components/badge/index.js +2 -40
  39. package/dist/components/button/button.d.ts +27 -0
  40. package/dist/components/button/button.js +47 -0
  41. package/dist/components/button/index.d.ts +1 -24
  42. package/dist/components/button/index.js +2 -45
  43. package/dist/components/checkbox/checkbox.d.ts +13 -0
  44. package/dist/components/checkbox/checkbox.js +269 -0
  45. package/dist/components/checkbox/index.d.ts +1 -9
  46. package/dist/components/checkbox/index.js +2 -267
  47. package/dist/components/code/code.d.ts +13 -0
  48. package/dist/components/code/code.js +1206 -0
  49. package/dist/components/code/index.d.ts +1 -9
  50. package/dist/components/code/index.js +2 -1204
  51. package/dist/components/collapse/collapse.d.ts +14 -0
  52. package/dist/components/collapse/collapse.js +35 -0
  53. package/dist/components/collapse/index.d.ts +1 -11
  54. package/dist/components/collapse/index.js +2 -33
  55. package/dist/components/command/command.d.ts +36 -0
  56. package/dist/components/command/command.js +1695 -0
  57. package/dist/components/command/index.d.ts +1 -15
  58. package/dist/components/command/index.js +2 -1693
  59. package/dist/components/context-menu/context-menu.d.ts +82 -0
  60. package/dist/components/context-menu/context-menu.js +1445 -0
  61. package/dist/components/context-menu/index.d.ts +1 -42
  62. package/dist/components/context-menu/index.js +2 -1442
  63. package/dist/components/dialog/dialog.d.ts +22 -0
  64. package/dist/components/dialog/dialog.js +140 -0
  65. package/dist/components/dialog/dialog.types.d.ts +38 -0
  66. package/dist/components/dialog/index.d.ts +1 -48
  67. package/dist/components/dialog/index.js +2 -136
  68. package/dist/components/heading/heading.d.ts +25 -0
  69. package/dist/components/heading/heading.js +36 -0
  70. package/dist/components/heading/index.d.ts +1 -44
  71. package/dist/components/heading/index.js +2 -49
  72. package/dist/components/icon/icon.d.ts +28 -0
  73. package/dist/components/icon/icon.js +43 -0
  74. package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
  75. package/dist/components/icon/icon.types.js +1 -0
  76. package/dist/components/icon/index.d.ts +2 -24
  77. package/dist/components/icon/index.js +2 -41
  78. package/dist/components/icon-button/icon-button.d.ts +16 -0
  79. package/dist/components/icon-button/icon-button.js +46 -0
  80. package/dist/components/icon-button/index.d.ts +1 -12
  81. package/dist/components/icon-button/index.js +2 -44
  82. package/dist/components/inline-code/index.d.ts +1 -6
  83. package/dist/components/inline-code/index.js +2 -20
  84. package/dist/components/inline-code/inline-code.d.ts +10 -0
  85. package/dist/components/inline-code/inline-code.js +25 -0
  86. package/dist/components/input/index.d.ts +1 -3
  87. package/dist/components/input/index.js +2 -117
  88. package/dist/components/input/input.d.ts +9 -0
  89. package/dist/components/input/input.js +126 -0
  90. package/dist/components/meter/index.d.ts +1 -18
  91. package/dist/components/meter/index.js +2 -163
  92. package/dist/components/meter/meter.d.ts +22 -0
  93. package/dist/components/meter/meter.js +165 -0
  94. package/dist/components/multiline-input/index.d.ts +1 -6
  95. package/dist/components/multiline-input/index.js +2 -98
  96. package/dist/components/multiline-input/multiline-input.d.ts +10 -0
  97. package/dist/components/multiline-input/multiline-input.js +100 -0
  98. package/dist/components/number-input/index.d.ts +1 -10
  99. package/dist/components/number-input/index.js +2 -1167
  100. package/dist/components/number-input/number-input.d.ts +14 -0
  101. package/dist/components/number-input/number-input.js +1169 -0
  102. package/dist/components/password-input/index.d.ts +1 -2
  103. package/dist/components/password-input/index.js +2 -27
  104. package/dist/components/password-input/password-input.d.ts +7 -0
  105. package/dist/components/password-input/password-input.js +29 -0
  106. package/dist/components/pill/index.d.ts +1 -13
  107. package/dist/components/pill/index.js +2 -36
  108. package/dist/components/pill/pill.d.ts +17 -0
  109. package/dist/components/pill/pill.js +38 -0
  110. package/dist/components/popover/index.d.ts +1 -21
  111. package/dist/components/popover/index.js +2 -634
  112. package/dist/components/popover/popover.d.ts +22 -0
  113. package/dist/components/popover/popover.js +634 -0
  114. package/dist/components/preview-card/index.d.ts +1 -17
  115. package/dist/components/preview-card/index.js +2 -400
  116. package/dist/components/preview-card/preview-card.d.ts +21 -0
  117. package/dist/components/preview-card/preview-card.js +402 -0
  118. package/dist/components/radio-group/index.d.ts +1 -0
  119. package/dist/components/radio-group/index.js +5 -0
  120. package/dist/components/radio-group/radio-group.d.ts +25 -0
  121. package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
  122. package/dist/components/search-bar/index.d.ts +1 -12
  123. package/dist/components/search-bar/index.js +2 -46
  124. package/dist/components/search-bar/search-bar.d.ts +16 -0
  125. package/dist/components/search-bar/search-bar.js +43 -0
  126. package/dist/components/select/index.d.ts +1 -16
  127. package/dist/components/select/index.js +2 -1261
  128. package/dist/components/select/select.d.ts +22 -0
  129. package/dist/components/select/select.js +1263 -0
  130. package/dist/components/separator/index.d.ts +1 -7
  131. package/dist/components/separator/index.js +2 -4
  132. package/dist/components/separator/separator.d.ts +10 -0
  133. package/dist/components/separator/separator.js +6 -0
  134. package/dist/components/slider/index.d.ts +1 -5
  135. package/dist/components/slider/index.js +2 -900
  136. package/dist/components/slider/slider.d.ts +10 -0
  137. package/dist/components/slider/slider.js +899 -0
  138. package/dist/components/spinner/index.d.ts +1 -2
  139. package/dist/components/spinner/index.js +2 -11
  140. package/dist/components/spinner/spinner.d.ts +7 -0
  141. package/dist/components/spinner/spinner.js +13 -0
  142. package/dist/components/stacked-avatars/index.d.ts +1 -14
  143. package/dist/components/stacked-avatars/index.js +2 -90
  144. package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
  145. package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
  146. package/dist/components/status-banner/index.d.ts +1 -17
  147. package/dist/components/status-banner/index.js +2 -69
  148. package/dist/components/status-banner/status-banner.d.ts +22 -0
  149. package/dist/components/status-banner/status-banner.js +71 -0
  150. package/dist/components/surface/index.d.ts +2 -27
  151. package/dist/components/surface/index.js +2 -39
  152. package/dist/components/surface/surface.d.ts +26 -0
  153. package/dist/components/surface/surface.js +36 -0
  154. package/dist/components/surface/surface.types.d.ts +1 -0
  155. package/dist/components/surface/surface.types.js +1 -0
  156. package/dist/components/switch/index.d.ts +1 -5
  157. package/dist/components/switch/index.js +2 -194
  158. package/dist/components/switch/switch.d.ts +10 -0
  159. package/dist/components/switch/switch.js +193 -0
  160. package/dist/components/tabs/index.d.ts +1 -18
  161. package/dist/components/tabs/index.js +2 -507
  162. package/dist/components/tabs/tabs.d.ts +28 -0
  163. package/dist/components/tabs/tabs.js +511 -0
  164. package/dist/components/text/index.d.ts +1 -26
  165. package/dist/components/text/index.js +2 -46
  166. package/dist/components/text/text.d.ts +29 -0
  167. package/dist/components/text/text.js +48 -0
  168. package/dist/components/theme-provider/index.d.ts +1 -1
  169. package/dist/components/theme-provider/theme-provider.d.ts +8 -4
  170. package/dist/components/theme-provider/theme-provider.js +3 -3
  171. package/dist/components/timestamp/index.d.ts +1 -23
  172. package/dist/components/timestamp/index.js +2 -1390
  173. package/dist/components/timestamp/timestamp.d.ts +26 -0
  174. package/dist/components/timestamp/timestamp.js +1391 -0
  175. package/dist/components/toaster/index.d.ts +2 -0
  176. package/dist/components/toaster/index.js +7 -0
  177. package/dist/components/toaster/toaster.d.ts +7 -0
  178. package/dist/components/toaster/toaster.js +923 -0
  179. package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
  180. package/dist/components/tooltip/index.d.ts +1 -14
  181. package/dist/components/tooltip/index.js +2 -710
  182. package/dist/components/tooltip/tooltip.d.ts +24 -0
  183. package/dist/components/tooltip/tooltip.js +9 -0
  184. package/dist/components/view/index.d.ts +2 -30
  185. package/dist/components/view/index.js +2 -79
  186. package/dist/components/view/view.d.ts +31 -0
  187. package/dist/components/view/view.js +83 -0
  188. package/dist/components/view/view.types.d.ts +5 -0
  189. package/dist/components/view/view.types.js +1 -0
  190. package/dist/components/visually-hidden/index.d.ts +5 -1
  191. package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
  192. package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
  193. package/dist/context-menu.css +1 -0
  194. package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
  195. package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
  196. package/dist/dialog.css +1 -1
  197. package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
  198. package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
  199. package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
  200. package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
  201. package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
  202. package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
  203. package/dist/heading.css +1 -0
  204. package/dist/icon-button.css +1 -0
  205. package/dist/icon.css +1 -0
  206. package/dist/index.d.ts +10 -10
  207. package/dist/index.js +86 -104
  208. package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
  209. package/dist/inline-code.css +1 -0
  210. package/dist/input.css +1 -1
  211. package/dist/input.module-CtE19OH8.js +8 -0
  212. package/dist/integrations/react-markdown/index.js +12 -12
  213. package/dist/meter.css +1 -0
  214. package/dist/number-input.css +1 -0
  215. package/dist/password-input.css +1 -0
  216. package/dist/pill.css +1 -0
  217. package/dist/popover.css +1 -0
  218. package/dist/preview-card.css +1 -0
  219. package/dist/radio-group.css +1 -0
  220. package/dist/safePolygon-DnkzOIur.js +558 -0
  221. package/dist/search-bar.css +1 -0
  222. package/dist/select.css +1 -0
  223. package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
  224. package/dist/separator.css +1 -0
  225. package/dist/slider.css +1 -0
  226. package/dist/spinner.css +1 -0
  227. package/dist/stacked-avatars.css +1 -0
  228. package/dist/status-banner.css +1 -0
  229. package/dist/styles/core.css +1 -1
  230. package/dist/surface.css +1 -0
  231. package/dist/switch.css +1 -0
  232. package/dist/tabs.css +1 -0
  233. package/dist/text.css +1 -0
  234. package/dist/timestamp.css +1 -0
  235. package/dist/toaster.css +1 -0
  236. package/dist/tooltip-oCp-elli.js +765 -0
  237. package/dist/tooltip.css +1 -0
  238. package/dist/transitions.css +1 -1
  239. package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
  240. package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
  241. package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
  242. package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
  243. package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
  244. package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
  245. package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
  246. package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
  247. package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
  248. package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
  249. package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
  250. package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
  251. package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
  252. package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
  253. package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
  254. package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
  255. package/dist/view.css +1 -1
  256. package/dist/view.module-Dj7wj0kk.js +6 -0
  257. package/dist/view2.css +1 -0
  258. package/package.json +1 -1
  259. package/dist/components/radio/index.d.ts +0 -13
  260. package/dist/components/toast/index.d.ts +0 -2
  261. package/dist/components/toast/index.js +0 -8
  262. package/dist/components/toast/toast.d.ts +0 -2
  263. package/dist/components/toast/toast.js +0 -921
  264. package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
  265. package/dist/components/tooltip/tooltip-arrow.js +0 -6
  266. package/dist/index10.css +0 -1
  267. package/dist/index11.css +0 -1
  268. package/dist/index12.css +0 -1
  269. package/dist/index13.css +0 -1
  270. package/dist/index14.css +0 -1
  271. package/dist/index15.css +0 -1
  272. package/dist/index16.css +0 -1
  273. package/dist/index17.css +0 -1
  274. package/dist/index18.css +0 -1
  275. package/dist/index19.css +0 -1
  276. package/dist/index20.css +0 -1
  277. package/dist/index21.css +0 -1
  278. package/dist/index22.css +0 -1
  279. package/dist/index23.css +0 -1
  280. package/dist/index24.css +0 -1
  281. package/dist/index25.css +0 -1
  282. package/dist/index26.css +0 -1
  283. package/dist/index27.css +0 -1
  284. package/dist/index28.css +0 -1
  285. package/dist/index29.css +0 -1
  286. package/dist/index3.css +0 -1
  287. package/dist/index30.css +0 -1
  288. package/dist/index31.css +0 -1
  289. package/dist/index32.css +0 -1
  290. package/dist/index33.css +0 -1
  291. package/dist/index34.css +0 -1
  292. package/dist/index35.css +0 -1
  293. package/dist/index36.css +0 -1
  294. package/dist/index37.css +0 -1
  295. package/dist/index4.css +0 -1
  296. package/dist/index5.css +0 -1
  297. package/dist/index6.css +0 -1
  298. package/dist/index7.css +0 -1
  299. package/dist/index8.css +0 -1
  300. package/dist/index9.css +0 -1
  301. package/dist/input.module-DDQY_Ij6.js +0 -7
  302. package/dist/safePolygon-DWy1dGKJ.js +0 -308
  303. package/dist/toast.css +0 -1
  304. package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
  305. package/dist/tooltip-arrow.css +0 -1
  306. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
  307. package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
  308. package/dist/view.module-DfDLgJE0.js +0 -6
  309. /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
  310. /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
@@ -0,0 +1,1169 @@
1
+ import { jsxs as Ue, jsx as se } from "react/jsx-runtime";
2
+ import { c as Ot } from "../../clsx-OuTLNxxd.js";
3
+ import * as o from "react";
4
+ import { useId as Ut } from "react";
5
+ import { Text as kt } from "../text/text.js";
6
+ import { Input as Wt } from "../input/input.js";
7
+ import { View as Ht } from "../view/view.js";
8
+ import { IconButton as tt } from "../icon-button/icon-button.js";
9
+ import { S as Gt } from "../../separator-fh_wDZNf.js";
10
+ import { u as Bt } from "../../useControlled-Du4sJyMj.js";
11
+ import { u as de } from "../../useStableCallback-DKZHlUAT.js";
12
+ import { T as $t, u as Ke } from "../../useTimeout-BNni6aw5.js";
13
+ import { a as Kt, d as Yt, u as xe } from "../../useRenderElement-DngNDu_P.js";
14
+ import { u as jt } from "../../useOnMount-VRW6CK2u.js";
15
+ import { u as Ge } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
16
+ import { u as nt } from "../../useValueAsRef-B4EriRsI.js";
17
+ import { v as zt } from "../../visuallyHidden-CpJ-mhai.js";
18
+ import { o as Ye } from "../../owner-rKN292Q9.js";
19
+ import { c as Xt, e as qt, d as Zt } from "../../detectBrowser-Bl8Ki_1I.js";
20
+ import { f as Jt } from "../../formatErrorMessage-BqPuTBN-.js";
21
+ import { a as ft, c as Qt, u as en, b as tn, f as nn } from "../../LabelableContext-Be1u-eFg.js";
22
+ import { u as rn } from "../../useLabelableId-CX4tcfzK.js";
23
+ import { g as ke, f as Te, a as dt } from "../../formatNumber-1UNwjeqf.js";
24
+ import { c as sn } from "../../clamp-D0KDAQIz.js";
25
+ import { c as ce, g as _e, n as on, h as un, k as Ae, j as Be, m as rt, p as st, s as ot } from "../../createBaseUIEventDetails-CCSfZ2vM.js";
26
+ import { g as We } from "../../floating-ui.utils.dom-cbi420Pg.js";
27
+ import * as it from "react-dom";
28
+ import { u as an } from "../../useValueChanged-MJRmEWz1.js";
29
+ import { s as cn } from "../../event-B89-Ng5h.js";
30
+ import { u as mt } from "../../useButton-d3_JgBNr.js";
31
+ import '../../number-input.css';function ln() {
32
+ const [, n] = o.useState({});
33
+ return o.useCallback(() => {
34
+ n({});
35
+ }, []);
36
+ }
37
+ const ut = 0;
38
+ class Xe extends $t {
39
+ static create() {
40
+ return new Xe();
41
+ }
42
+ /**
43
+ * Executes `fn` at `delay` interval, clearing any previously scheduled call.
44
+ */
45
+ start(r, t) {
46
+ this.clear(), this.currentId = setInterval(() => {
47
+ t();
48
+ }, r);
49
+ }
50
+ clear = () => {
51
+ this.currentId !== ut && (clearInterval(this.currentId), this.currentId = ut);
52
+ };
53
+ }
54
+ function fn() {
55
+ const n = Kt(Xe.create).current;
56
+ return jt(n.disposeEffect), n;
57
+ }
58
+ const qe = /* @__PURE__ */ o.createContext(void 0);
59
+ process.env.NODE_ENV !== "production" && (qe.displayName = "NumberFieldRootContext");
60
+ function De() {
61
+ const n = o.useContext(qe);
62
+ if (n === void 0)
63
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: NumberFieldRootContext is missing. NumberField parts must be placed within <NumberField.Root>." : Jt(43));
64
+ return n;
65
+ }
66
+ const ye = {
67
+ inputValue: () => null,
68
+ value: () => null
69
+ }, dn = ["零", "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"], mn = {
70
+ 零: "0",
71
+ "〇": "0",
72
+ 一: "1",
73
+ 二: "2",
74
+ 三: "3",
75
+ 四: "4",
76
+ 五: "5",
77
+ 六: "6",
78
+ 七: "7",
79
+ 八: "8",
80
+ 九: "9"
81
+ }, pt = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"], gt = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], Ze = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ht = ["%", "٪", "%", "﹪"], Et = ["‰", "؉"], bt = ["−", "-", "‒", "–", "—", "﹣"], Rt = ["+", "﹢"], pn = ".", gn = ",", hn = new RegExp(`[${pt.join("")}]`, "g"), En = new RegExp(`[${gt.join("")}]`, "g"), bn = new RegExp(`[${Ze.join("")}]`, "g"), Rn = new RegExp(`[${dn.join("")}]`, "g"), Nn = new RegExp(`[${ht.join("")}]`), Sn = new RegExp(`[${Et.join("")}]`), je = /[٠١٢٣٤٥٦٧٨٩]/, Nt = /[۰۱۲۳۴۵۶۷۸۹]/, ze = /[零〇一二三四五六七八九]/, at = new RegExp(`[${Ze.join("")}]`), _n = [".", ",", pn, gn, "٫", "٬"], ct = new RegExp("\\p{Zs}", "u"), xn = ["+", ...Rt], yn = ["-", ...bt], Le = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Cn = (n) => n.replace(/[-\\\]^]/g, (r) => `\\${r}`), St = (n) => `[${n.map(Cn).join("")}]`, _t = St(["-"].concat(bt)), xt = St(["+"].concat(Rt)), yt = new RegExp(_t, "gu"), Ct = new RegExp(xt, "gu"), ve = new RegExp(_t), Oe = new RegExp(xt);
82
+ function Je(n, r) {
83
+ const t = ke(n, r).formatToParts(11111.1), s = {};
84
+ return t.forEach((a) => {
85
+ s[a.type] = a.value;
86
+ }), ke(n).formatToParts(0.1).forEach((a) => {
87
+ a.type === "decimal" && (s[a.type] = a.value);
88
+ }), s;
89
+ }
90
+ function Se(n, r, t) {
91
+ if (n == null)
92
+ return null;
93
+ let s = String(n).replace(new RegExp("\\p{Cf}", "gu"), "").trim();
94
+ s = s.replace(yt, "-").replace(Ct, "+");
95
+ let a = !1;
96
+ const f = s.match(/([+-])\s*$/);
97
+ f && (f[1] === "-" && (a = !0), s = s.replace(/([+-])\s*$/, ""));
98
+ const S = s.match(/^\s*([+-])/);
99
+ S && (S[1] === "-" && (a = !0), s = s.replace(/^\s*[+-]/, ""));
100
+ let p = r;
101
+ p === void 0 && (je.test(s) || Nt.test(s) ? p = "ar" : ze.test(s) && (p = "zh"));
102
+ const {
103
+ group: m,
104
+ decimal: _,
105
+ currency: b
106
+ } = Je(p, t), R = ke(p, t).formatToParts(1).filter((c) => c.type === "unit").map((c) => Le(c.value)), K = R.length ? new RegExp(R.join("|"), "g") : null;
107
+ let G = null;
108
+ m && (new RegExp("\\p{Zs}", "u").test(m) ? G = new RegExp("\\p{Zs}", "gu") : m === "'" || m === "’" ? G = /['’]/g : G = new RegExp(Le(m), "g"));
109
+ let w = [
110
+ {
111
+ regex: m ? G : null,
112
+ replacement: ""
113
+ },
114
+ {
115
+ regex: _ ? new RegExp(Le(_), "g") : null,
116
+ replacement: "."
117
+ },
118
+ // Fullwidth punctuation
119
+ {
120
+ regex: /./g,
121
+ replacement: "."
122
+ },
123
+ // FULLWIDTH_DECIMAL
124
+ {
125
+ regex: /,/g,
126
+ replacement: ""
127
+ },
128
+ // FULLWIDTH_GROUP
129
+ // Arabic punctuation
130
+ {
131
+ regex: /٫/g,
132
+ replacement: "."
133
+ },
134
+ // ARABIC DECIMAL SEPARATOR (U+066B)
135
+ {
136
+ regex: /٬/g,
137
+ replacement: ""
138
+ },
139
+ // ARABIC THOUSANDS SEPARATOR (U+066C)
140
+ // Currency & unit labels
141
+ {
142
+ regex: b ? new RegExp(Le(b), "g") : null,
143
+ replacement: ""
144
+ },
145
+ {
146
+ regex: K,
147
+ replacement: ""
148
+ },
149
+ // Numeral systems to ASCII digits
150
+ {
151
+ regex: hn,
152
+ replacement: (c) => String(pt.indexOf(c))
153
+ },
154
+ {
155
+ regex: En,
156
+ replacement: (c) => String(gt.indexOf(c))
157
+ },
158
+ {
159
+ regex: bn,
160
+ replacement: (c) => String(Ze.indexOf(c))
161
+ },
162
+ {
163
+ regex: Rn,
164
+ replacement: (c) => mn[c]
165
+ }
166
+ ].reduce((c, {
167
+ regex: W,
168
+ replacement: x
169
+ }) => W ? c.replace(W, x) : c, s);
170
+ const O = w.lastIndexOf(".");
171
+ if (O !== -1 && (w = `${w.slice(0, O).replace(/\./g, "")}.${w.slice(O + 1).replace(/\./g, "")}`), /^[-+]?Infinity$/i.test(s) || /[∞]/.test(s))
172
+ return null;
173
+ const q = (a ? "-" : "") + w;
174
+ let V = parseFloat(q);
175
+ const g = t?.style, d = g === "unit" && t?.unit === "percent", k = Nn.test(n) || g === "percent";
176
+ return Sn.test(n) ? V /= 1e3 : !d && k && (V /= 100), Number.isNaN(V) ? null : V;
177
+ }
178
+ const In = 60, An = 400, vn = 50, Tn = 3, Pn = 8, Pe = 1, Dn = 1e-10;
179
+ function Vn(n) {
180
+ const r = ke("en-US").resolvedOptions(), t = n?.minimumFractionDigits ?? r.minimumFractionDigits ?? 0;
181
+ return {
182
+ maximumFractionDigits: Math.max(n?.maximumFractionDigits ?? r.maximumFractionDigits ?? 20, t),
183
+ minimumFractionDigits: t
184
+ };
185
+ }
186
+ function Fn(n, r) {
187
+ if (!Number.isFinite(n))
188
+ return n;
189
+ const t = Math.min(Math.max(r, 0), 20);
190
+ return Number(n.toFixed(t));
191
+ }
192
+ function $e(n, r) {
193
+ const {
194
+ maximumFractionDigits: t
195
+ } = Vn(r);
196
+ return Fn(n, t);
197
+ }
198
+ function wn(n, r, t, s = "directional") {
199
+ if (t === 0)
200
+ return n;
201
+ const a = Math.abs(t), f = Math.sign(t), S = a * Dn * f, p = s === "nearest" ? t : a, m = (n - r + S) / p;
202
+ let _;
203
+ return s === "nearest" ? _ = Math.round(m) : f > 0 ? _ = Math.floor(m) : _ = Math.ceil(m), r + _ * (s === "nearest" ? t : a);
204
+ }
205
+ function Mn(n, {
206
+ step: r,
207
+ minWithDefault: t,
208
+ maxWithDefault: s,
209
+ minWithZeroDefault: a,
210
+ format: f,
211
+ snapOnStep: S,
212
+ small: p
213
+ }) {
214
+ if (n === null)
215
+ return n;
216
+ const m = sn(n, t, s);
217
+ if (r != null && S) {
218
+ if (r === 0)
219
+ return $e(m, f);
220
+ let _ = a;
221
+ !p && t !== Number.MIN_SAFE_INTEGER && (_ = t);
222
+ const b = wn(m, _, r, p ? "nearest" : "directional");
223
+ return $e(b, f);
224
+ }
225
+ return $e(m, f);
226
+ }
227
+ const It = /* @__PURE__ */ o.forwardRef(function(r, t) {
228
+ const {
229
+ id: s,
230
+ min: a,
231
+ max: f,
232
+ smallStep: S = 0.1,
233
+ step: p = 1,
234
+ largeStep: m = 10,
235
+ required: _ = !1,
236
+ disabled: b = !1,
237
+ readOnly: R = !1,
238
+ name: K,
239
+ defaultValue: G,
240
+ value: h,
241
+ onValueChange: w,
242
+ onValueCommitted: O,
243
+ allowWheelScrub: q = !1,
244
+ snapOnStep: V = !1,
245
+ format: g,
246
+ locale: d,
247
+ render: k,
248
+ className: Y,
249
+ inputRef: c,
250
+ ...W
251
+ } = r, {
252
+ setDirty: x,
253
+ validityData: H,
254
+ disabled: j,
255
+ setFilled: z,
256
+ invalid: v,
257
+ name: Q,
258
+ state: U,
259
+ validation: ee,
260
+ shouldValidateOnChange: i
261
+ } = ft(), I = j || b, X = Q ?? K, [M, N] = o.useState(!1), y = a ?? Number.MIN_SAFE_INTEGER, L = f ?? Number.MAX_SAFE_INTEGER, Z = a ?? 0, A = g?.style, e = o.useRef(null), u = Yt(c, ee.inputRef), T = rn({
262
+ id: s
263
+ }), [P, J] = Bt({
264
+ controlled: h,
265
+ default: G,
266
+ name: "NumberField",
267
+ state: "value"
268
+ }), l = P ?? null, oe = nt(l);
269
+ Ge(() => {
270
+ z(l !== null);
271
+ }, [z, l]);
272
+ const te = ln(), ie = nt(g), re = o.useRef(!1), ue = de((F, E) => {
273
+ re.current = !1, O?.(F, E);
274
+ }), fe = Ke(), ge = fn(), he = Ke(), Ve = o.useRef(!1), Fe = o.useRef(0), me = o.useRef(!0), Ee = o.useRef(null), pe = o.useRef(() => {
275
+ }), [D, le] = o.useState(() => h !== void 0 ? lt(l, d, g) : Te(l, d, g)), [we, wt] = o.useState("numeric"), Qe = de(() => {
276
+ const {
277
+ decimal: F,
278
+ group: E,
279
+ currency: B,
280
+ literal: $
281
+ } = Je(d, g), C = /* @__PURE__ */ new Set();
282
+ _n.forEach((ne) => C.add(ne)), F && C.add(F), E && (C.add(E), ct.test(E) && C.add(" "));
283
+ const ae = A === "percent" || A === "unit" && g?.unit === "percent", Ie = A === "percent" || A === "unit" && g?.unit === "permille";
284
+ return ae && ht.forEach((ne) => C.add(ne)), Ie && Et.forEach((ne) => C.add(ne)), A === "currency" && B && C.add(B), $ && (Array.from($).forEach((ne) => C.add(ne)), ct.test($) && C.add(" ")), xn.forEach((ne) => C.add(ne)), y < 0 && yn.forEach((ne) => C.add(ne)), C;
285
+ }), be = de((F) => F?.altKey ? S : F?.shiftKey ? m : p), Me = de((F, E) => {
286
+ const B = E.event, $ = E.direction, C = Mn(F, {
287
+ step: $ ? be(B) * $ : void 0,
288
+ format: ie.current,
289
+ minWithDefault: y,
290
+ maxWithDefault: L,
291
+ minWithZeroDefault: Z,
292
+ snapOnStep: V,
293
+ small: B?.altKey ?? !1
294
+ });
295
+ if (C !== l || F !== l || me.current === !1) {
296
+ if (Ee.current = C, w?.(C, E), E.isCanceled)
297
+ return;
298
+ J(C), x(C !== H.initialValue), re.current = !0;
299
+ }
300
+ me.current && le(Te(C, d, g)), te();
301
+ }), Ce = de((F, {
302
+ direction: E,
303
+ currentValue: B,
304
+ event: $,
305
+ reason: C
306
+ }) => {
307
+ const ae = B ?? oe.current, Ie = typeof ae == "number" ? ae + F * E : Math.max(0, a ?? 0);
308
+ Me(Ie, ce(C, $, void 0, {
309
+ direction: E
310
+ }));
311
+ }), Re = de(() => {
312
+ he.clear(), fe.clear(), ge.clear(), pe.current(), Fe.current = 0;
313
+ }), et = de((F, E) => {
314
+ if (Re(), !e.current)
315
+ return;
316
+ const B = We(e.current);
317
+ function $(ae) {
318
+ ae.preventDefault();
319
+ }
320
+ B.addEventListener("contextmenu", $), pe.current = () => {
321
+ B.removeEventListener("contextmenu", $);
322
+ }, B.addEventListener("pointerup", (ae) => {
323
+ Ve.current = !1, Re();
324
+ const Ie = Ee.current ?? oe.current;
325
+ ue(Ie, _e(F ? "increment" : "decrement", ae));
326
+ }, {
327
+ once: !0
328
+ });
329
+ function C() {
330
+ const ae = be(E) ?? Pe;
331
+ Ce(ae, {
332
+ direction: F ? 1 : -1,
333
+ event: E,
334
+ reason: F ? "increment-press" : "decrement-press"
335
+ });
336
+ }
337
+ C(), fe.start(An, () => {
338
+ ge.start(In, C);
339
+ });
340
+ });
341
+ Ge(function() {
342
+ if (!me.current)
343
+ return;
344
+ const E = h !== void 0 ? lt(l, d, g) : Te(l, d, g);
345
+ E !== D && le(E);
346
+ }), Ge(function() {
347
+ if (!Xt)
348
+ return;
349
+ let E = "text";
350
+ y >= 0 && (E = "decimal"), wt(E);
351
+ }, [y, A]), o.useEffect(() => () => Re(), [Re]), o.useEffect(function() {
352
+ const E = e.current;
353
+ if (I || R || !q || !E)
354
+ return;
355
+ function B($) {
356
+ if (
357
+ // Allow pinch-zooming.
358
+ $.ctrlKey || Ye(e.current).activeElement !== e.current
359
+ )
360
+ return;
361
+ $.preventDefault();
362
+ const C = be($) ?? Pe;
363
+ Ce(C, {
364
+ direction: $.deltaY > 0 ? -1 : 1,
365
+ event: $,
366
+ reason: "wheel"
367
+ });
368
+ }
369
+ return E.addEventListener("wheel", B), () => {
370
+ E.removeEventListener("wheel", B);
371
+ };
372
+ }, [q, Ce, I, R, m, p, be]);
373
+ const He = o.useMemo(() => ({
374
+ ...U,
375
+ disabled: I,
376
+ readOnly: R,
377
+ required: _,
378
+ value: l,
379
+ inputValue: D,
380
+ scrubbing: M
381
+ }), [U, I, R, _, l, D, M]), Mt = o.useMemo(() => ({
382
+ inputRef: e,
383
+ inputValue: D,
384
+ value: l,
385
+ startAutoChange: et,
386
+ stopAutoChange: Re,
387
+ minWithDefault: y,
388
+ maxWithDefault: L,
389
+ disabled: I,
390
+ readOnly: R,
391
+ id: T,
392
+ setValue: Me,
393
+ incrementValue: Ce,
394
+ getStepAmount: be,
395
+ allowInputSyncRef: me,
396
+ formatOptionsRef: ie,
397
+ valueRef: oe,
398
+ lastChangedValueRef: Ee,
399
+ hasPendingCommitRef: re,
400
+ isPressedRef: Ve,
401
+ intentionalTouchCheckTimeout: he,
402
+ movesAfterTouchRef: Fe,
403
+ name: X,
404
+ required: _,
405
+ invalid: v,
406
+ inputMode: we,
407
+ getAllowedNonNumericKeys: Qe,
408
+ min: a,
409
+ max: f,
410
+ setInputValue: le,
411
+ locale: d,
412
+ isScrubbing: M,
413
+ setIsScrubbing: N,
414
+ state: He,
415
+ onValueCommitted: ue
416
+ }), [e, D, l, et, Re, y, L, I, R, T, Me, Ce, be, ie, oe, he, X, _, v, we, Qe, a, f, le, d, M, He, ue]), Lt = xe("div", r, {
417
+ ref: t,
418
+ state: He,
419
+ props: W,
420
+ stateAttributesMapping: ye
421
+ });
422
+ return /* @__PURE__ */ Ue(qe.Provider, {
423
+ value: Mt,
424
+ children: [Lt, /* @__PURE__ */ se("input", {
425
+ ...ee.getInputValidationProps({
426
+ onChange(F) {
427
+ if (F.nativeEvent.defaultPrevented)
428
+ return;
429
+ const E = F.currentTarget.valueAsNumber, B = Number.isNaN(E) ? null : E, $ = ce(on, F.nativeEvent);
430
+ x(B !== H.initialValue), Me(B, $), i() && ee.commit(B);
431
+ }
432
+ }),
433
+ ref: u,
434
+ type: "number",
435
+ name: X,
436
+ value: l ?? "",
437
+ min: a,
438
+ max: f,
439
+ step: p,
440
+ disabled: I,
441
+ required: _,
442
+ "aria-hidden": !0,
443
+ tabIndex: -1,
444
+ style: zt
445
+ })]
446
+ });
447
+ });
448
+ process.env.NODE_ENV !== "production" && (It.displayName = "NumberFieldRoot");
449
+ function lt(n, r, t) {
450
+ return t?.maximumFractionDigits != null || t?.minimumFractionDigits != null ? Te(n, r, t) : dt(n, r, t);
451
+ }
452
+ const At = /* @__PURE__ */ o.forwardRef(function(r, t) {
453
+ const {
454
+ render: s,
455
+ className: a,
456
+ ...f
457
+ } = r, {
458
+ state: S
459
+ } = De();
460
+ return xe("div", r, {
461
+ ref: t,
462
+ state: S,
463
+ props: [{
464
+ role: "group"
465
+ }, f],
466
+ stateAttributesMapping: ye
467
+ });
468
+ });
469
+ process.env.NODE_ENV !== "production" && (At.displayName = "NumberFieldGroup");
470
+ function vt(n) {
471
+ const {
472
+ allowInputSyncRef: r,
473
+ disabled: t,
474
+ formatOptionsRef: s,
475
+ getStepAmount: a,
476
+ id: f,
477
+ incrementValue: S,
478
+ inputRef: p,
479
+ inputValue: m,
480
+ intentionalTouchCheckTimeout: _,
481
+ isIncrement: b,
482
+ isPressedRef: R,
483
+ locale: K,
484
+ maxWithDefault: G,
485
+ minWithDefault: h,
486
+ movesAfterTouchRef: w,
487
+ readOnly: O,
488
+ setValue: q,
489
+ startAutoChange: V,
490
+ stopAutoChange: g,
491
+ value: d,
492
+ valueRef: k,
493
+ lastChangedValueRef: Y,
494
+ onValueCommitted: c
495
+ } = n, W = o.useRef({
496
+ x: 0,
497
+ y: 0
498
+ }), x = o.useRef(!1), H = o.useRef(!1), j = o.useRef(""), z = d != null && d <= h, v = d != null && d >= G, Q = b ? "increment-press" : "decrement-press";
499
+ function U(i) {
500
+ r.current = !0;
501
+ const I = Se(m, K, s.current);
502
+ I !== null && (k.current = I, q(I, ce(Q, i, void 0, {
503
+ direction: b ? 1 : -1
504
+ })));
505
+ }
506
+ return {
507
+ disabled: t || (b ? v : z),
508
+ "aria-readonly": O || void 0,
509
+ "aria-label": b ? "Increase" : "Decrease",
510
+ "aria-controls": f,
511
+ // Keyboard users shouldn't have access to the buttons, since they can use the input element
512
+ // to change the value. On the other hand, `aria-hidden` is not applied because touch screen
513
+ // readers should be able to use the buttons.
514
+ tabIndex: -1,
515
+ style: {
516
+ WebkitUserSelect: "none",
517
+ userSelect: "none"
518
+ },
519
+ onTouchStart() {
520
+ x.current = !0;
521
+ },
522
+ onTouchEnd() {
523
+ x.current = !1;
524
+ },
525
+ onClick(i) {
526
+ const I = t || O || (b ? v : z);
527
+ if (i.defaultPrevented || I || // If it's not a keyboard/virtual click, ignore.
528
+ (j.current === "touch" ? H.current : i.detail !== 0))
529
+ return;
530
+ U(i.nativeEvent);
531
+ const X = a(i) ?? Pe, M = k.current;
532
+ S(X, {
533
+ direction: b ? 1 : -1,
534
+ event: i.nativeEvent,
535
+ reason: Q
536
+ });
537
+ const N = Y.current ?? k.current;
538
+ N !== M && c(N, _e(Q, i.nativeEvent));
539
+ },
540
+ onPointerDown(i) {
541
+ const I = !i.button || i.button === 0, X = t || (b ? v : z);
542
+ i.defaultPrevented || O || !I || X || (j.current = i.pointerType, H.current = !1, R.current = !0, W.current = {
543
+ x: i.clientX,
544
+ y: i.clientY
545
+ }, U(i.nativeEvent), i.pointerType !== "touch" ? (i.preventDefault(), p.current?.focus(), V(b, i)) : _.start(vn, () => {
546
+ const M = w.current;
547
+ w.current = 0, R.current && M != null && M < Tn ? (V(b, i), H.current = !0) : (H.current = !1, g());
548
+ }));
549
+ },
550
+ onPointerUp(i) {
551
+ i.pointerType === "touch" && (R.current = !1);
552
+ },
553
+ onPointerMove(i) {
554
+ if (t || O || (b ? v : z) || i.pointerType !== "touch" || !R.current)
555
+ return;
556
+ w.current != null && (w.current += 1);
557
+ const {
558
+ x: X,
559
+ y: M
560
+ } = W.current, N = X - i.clientX, y = M - i.clientY;
561
+ N ** 2 + y ** 2 > Pn ** 2 && g();
562
+ },
563
+ onMouseEnter(i) {
564
+ const I = t || O || (b ? v : z);
565
+ i.defaultPrevented || I || !R.current || x.current || j.current === "touch" || V(b, i);
566
+ },
567
+ onMouseLeave() {
568
+ x.current || g();
569
+ },
570
+ onMouseUp() {
571
+ x.current || g();
572
+ }
573
+ };
574
+ }
575
+ const Tt = /* @__PURE__ */ o.forwardRef(function(r, t) {
576
+ const {
577
+ render: s,
578
+ className: a,
579
+ disabled: f = !1,
580
+ nativeButton: S = !0,
581
+ ...p
582
+ } = r, {
583
+ allowInputSyncRef: m,
584
+ disabled: _,
585
+ formatOptionsRef: b,
586
+ getStepAmount: R,
587
+ id: K,
588
+ incrementValue: G,
589
+ inputRef: h,
590
+ inputValue: w,
591
+ intentionalTouchCheckTimeout: O,
592
+ isPressedRef: q,
593
+ locale: V,
594
+ maxWithDefault: g,
595
+ minWithDefault: d,
596
+ movesAfterTouchRef: k,
597
+ readOnly: Y,
598
+ setValue: c,
599
+ startAutoChange: W,
600
+ state: x,
601
+ stopAutoChange: H,
602
+ value: j,
603
+ valueRef: z,
604
+ lastChangedValueRef: v,
605
+ onValueCommitted: Q
606
+ } = De(), U = f || _, ee = vt({
607
+ isIncrement: !0,
608
+ inputRef: h,
609
+ startAutoChange: W,
610
+ stopAutoChange: H,
611
+ minWithDefault: d,
612
+ maxWithDefault: g,
613
+ value: j,
614
+ inputValue: w,
615
+ disabled: U,
616
+ readOnly: Y,
617
+ id: K,
618
+ setValue: c,
619
+ getStepAmount: R,
620
+ incrementValue: G,
621
+ allowInputSyncRef: m,
622
+ formatOptionsRef: b,
623
+ valueRef: z,
624
+ isPressedRef: q,
625
+ intentionalTouchCheckTimeout: O,
626
+ movesAfterTouchRef: k,
627
+ locale: V,
628
+ lastChangedValueRef: v,
629
+ onValueCommitted: Q
630
+ }), {
631
+ getButtonProps: i,
632
+ buttonRef: I
633
+ } = mt({
634
+ disabled: U,
635
+ native: S
636
+ }), X = o.useMemo(() => ({
637
+ ...x,
638
+ disabled: U
639
+ }), [x, U]);
640
+ return xe("button", r, {
641
+ ref: [t, I],
642
+ state: X,
643
+ props: [ee, p, i],
644
+ stateAttributesMapping: ye
645
+ });
646
+ });
647
+ process.env.NODE_ENV !== "production" && (Tt.displayName = "NumberFieldIncrement");
648
+ const Pt = /* @__PURE__ */ o.forwardRef(function(r, t) {
649
+ const {
650
+ render: s,
651
+ className: a,
652
+ disabled: f = !1,
653
+ nativeButton: S = !0,
654
+ ...p
655
+ } = r, {
656
+ allowInputSyncRef: m,
657
+ disabled: _,
658
+ formatOptionsRef: b,
659
+ getStepAmount: R,
660
+ id: K,
661
+ incrementValue: G,
662
+ inputRef: h,
663
+ inputValue: w,
664
+ intentionalTouchCheckTimeout: O,
665
+ isPressedRef: q,
666
+ maxWithDefault: V,
667
+ minWithDefault: g,
668
+ movesAfterTouchRef: d,
669
+ readOnly: k,
670
+ setValue: Y,
671
+ startAutoChange: c,
672
+ state: W,
673
+ stopAutoChange: x,
674
+ value: H,
675
+ valueRef: j,
676
+ locale: z,
677
+ lastChangedValueRef: v,
678
+ onValueCommitted: Q
679
+ } = De(), U = f || _, ee = vt({
680
+ isIncrement: !1,
681
+ inputRef: h,
682
+ startAutoChange: c,
683
+ stopAutoChange: x,
684
+ minWithDefault: g,
685
+ maxWithDefault: V,
686
+ value: H,
687
+ inputValue: w,
688
+ disabled: U,
689
+ readOnly: k,
690
+ id: K,
691
+ setValue: Y,
692
+ getStepAmount: R,
693
+ incrementValue: G,
694
+ allowInputSyncRef: m,
695
+ formatOptionsRef: b,
696
+ valueRef: j,
697
+ isPressedRef: q,
698
+ intentionalTouchCheckTimeout: O,
699
+ movesAfterTouchRef: d,
700
+ locale: z,
701
+ lastChangedValueRef: v,
702
+ onValueCommitted: Q
703
+ }), {
704
+ getButtonProps: i,
705
+ buttonRef: I
706
+ } = mt({
707
+ disabled: U,
708
+ native: S
709
+ }), X = o.useMemo(() => ({
710
+ ...W,
711
+ disabled: U
712
+ }), [W, U]);
713
+ return xe("button", r, {
714
+ ref: [t, I],
715
+ state: X,
716
+ props: [ee, p, i],
717
+ stateAttributesMapping: ye
718
+ });
719
+ });
720
+ process.env.NODE_ENV !== "production" && (Pt.displayName = "NumberFieldDecrement");
721
+ const Ln = {
722
+ ...nn,
723
+ ...ye
724
+ }, On = /* @__PURE__ */ new Set(["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab", "Enter", "Escape"]), Dt = /* @__PURE__ */ o.forwardRef(function(r, t) {
725
+ const {
726
+ render: s,
727
+ className: a,
728
+ ...f
729
+ } = r, {
730
+ allowInputSyncRef: S,
731
+ disabled: p,
732
+ formatOptionsRef: m,
733
+ getAllowedNonNumericKeys: _,
734
+ getStepAmount: b,
735
+ id: R,
736
+ incrementValue: K,
737
+ inputMode: G,
738
+ inputValue: h,
739
+ max: w,
740
+ min: O,
741
+ name: q,
742
+ readOnly: V,
743
+ required: g,
744
+ setValue: d,
745
+ state: k,
746
+ setInputValue: Y,
747
+ locale: c,
748
+ inputRef: W,
749
+ value: x,
750
+ onValueCommitted: H,
751
+ lastChangedValueRef: j,
752
+ hasPendingCommitRef: z,
753
+ valueRef: v
754
+ } = De(), {
755
+ clearErrors: Q
756
+ } = Qt(), {
757
+ validationMode: U,
758
+ setTouched: ee,
759
+ setFocused: i,
760
+ invalid: I,
761
+ shouldValidateOnChange: X,
762
+ validation: M
763
+ } = ft(), {
764
+ labelId: N
765
+ } = en(), y = o.useRef(!1), L = o.useRef(!1);
766
+ return tn({
767
+ id: R,
768
+ commit: M.commit,
769
+ value: x,
770
+ controlRef: W,
771
+ name: q,
772
+ getValue: () => x ?? null
773
+ }), an(x, (e) => {
774
+ const u = X();
775
+ if (Q(q), u && M.commit(x), !(e === x || u)) {
776
+ if (L.current) {
777
+ L.current = !1;
778
+ return;
779
+ }
780
+ M.commit(x, !0);
781
+ }
782
+ }), xe("input", r, {
783
+ ref: [t, W],
784
+ state: k,
785
+ props: [{
786
+ id: R,
787
+ required: g,
788
+ disabled: p,
789
+ readOnly: V,
790
+ inputMode: G,
791
+ value: h,
792
+ type: "text",
793
+ autoComplete: "off",
794
+ autoCorrect: "off",
795
+ spellCheck: "false",
796
+ "aria-roledescription": "Number field",
797
+ "aria-invalid": I || void 0,
798
+ "aria-labelledby": N,
799
+ // If the server's locale does not match the client's locale, the formatting may not match,
800
+ // causing a hydration mismatch.
801
+ suppressHydrationWarning: !0,
802
+ onFocus(e) {
803
+ if (e.defaultPrevented || V || p || y.current)
804
+ return;
805
+ y.current = !0, i(!0);
806
+ const u = e.currentTarget, T = u.value.length;
807
+ u.setSelectionRange(T, T);
808
+ },
809
+ onBlur(e) {
810
+ if (e.defaultPrevented || V || p)
811
+ return;
812
+ ee(!0), i(!1);
813
+ const u = !S.current, T = z.current;
814
+ if (S.current = !0, h.trim() === "") {
815
+ d(null, ce(Be, e.nativeEvent)), U === "onBlur" && M.commit(null), H(null, _e(Be, e.nativeEvent));
816
+ return;
817
+ }
818
+ const P = m.current, J = Se(h, c, P);
819
+ if (J === null)
820
+ return;
821
+ const l = P?.maximumFractionDigits != null || P?.minimumFractionDigits != null, oe = P?.maximumFractionDigits, te = l && typeof oe == "number" ? Number(J.toFixed(oe)) : J, ie = _e(st, e.nativeEvent), re = x !== te, ue = u || re || T;
822
+ U === "onBlur" && M.commit(te), re && (L.current = !0, d(te, ce(st, e.nativeEvent))), ue && H(te, ie);
823
+ const fe = Te(te, c, P), ge = dt(J, c, P);
824
+ !(!l && J === x && h === ge) && h !== fe && Y(fe);
825
+ },
826
+ onChange(e) {
827
+ if (e.nativeEvent.defaultPrevented)
828
+ return;
829
+ S.current = !1;
830
+ const u = e.target.value;
831
+ if (u.trim() === "") {
832
+ Y(u), d(null, ce(Be, e.nativeEvent));
833
+ return;
834
+ }
835
+ const T = _();
836
+ if (!Array.from(u).every((l) => {
837
+ const oe = l >= "0" && l <= "9", te = je.test(l), ie = ze.test(l), re = Nt.test(l), ue = at.test(l), fe = ve.test(l);
838
+ return oe || te || ie || re || ue || fe || T.has(l);
839
+ }))
840
+ return;
841
+ if (e.isTrusted) {
842
+ Y(u);
843
+ const l = Se(u, c, m.current);
844
+ l !== null && d(l, ce(rt, e.nativeEvent));
845
+ return;
846
+ }
847
+ const J = Se(u, c, m.current);
848
+ J !== null && (Y(u), d(J, ce(rt, e.nativeEvent)));
849
+ },
850
+ onKeyDown(e) {
851
+ if (e.defaultPrevented || V || p)
852
+ return;
853
+ const u = e.nativeEvent;
854
+ S.current = !0;
855
+ const T = _();
856
+ let P = T.has(e.key);
857
+ const {
858
+ decimal: J,
859
+ currency: l,
860
+ percentSign: oe
861
+ } = Je(c, m.current), te = e.currentTarget.selectionStart, ie = e.currentTarget.selectionEnd, re = te === 0 && ie === h.length, ue = (D) => te != null && ie != null && D >= te && D < ie;
862
+ if (ve.test(e.key) && Array.from(T).some((D) => ve.test(D || ""))) {
863
+ const D = h.search(yt), le = D != null && D !== -1 && ue(D);
864
+ P = !(ve.test(h) || Oe.test(h)) || re || le;
865
+ }
866
+ if (Oe.test(e.key) && Array.from(T).some((D) => Oe.test(D || ""))) {
867
+ const D = h.search(Ct), le = D != null && D !== -1 && ue(D);
868
+ P = !(ve.test(h) || Oe.test(h)) || re || le;
869
+ }
870
+ [J, l, oe].forEach((D) => {
871
+ if (e.key === D) {
872
+ const le = h.indexOf(D), we = ue(le);
873
+ P = !h.includes(D) || re || we;
874
+ }
875
+ });
876
+ const fe = e.key >= "0" && e.key <= "9", ge = je.test(e.key), he = ze.test(e.key), Ve = at.test(e.key), Fe = On.has(e.key);
877
+ if (
878
+ // Allow composition events (e.g., pinyin)
879
+ // event.nativeEvent.isComposing does not work in Safari:
880
+ // https://bugs.webkit.org/show_bug.cgi?id=165004
881
+ e.which === 229 || e.altKey || e.ctrlKey || e.metaKey || P || fe || ge || Ve || he || Fe
882
+ )
883
+ return;
884
+ const me = Se(h, c, m.current), Ee = b(e) ?? Pe;
885
+ cn(e);
886
+ const pe = _e(Ae, u);
887
+ e.key === "ArrowUp" ? (K(Ee, {
888
+ direction: 1,
889
+ currentValue: me,
890
+ event: u,
891
+ reason: Ae
892
+ }), H(j.current ?? v.current, pe)) : e.key === "ArrowDown" ? (K(Ee, {
893
+ direction: -1,
894
+ currentValue: me,
895
+ event: u,
896
+ reason: Ae
897
+ }), H(j.current ?? v.current, pe)) : e.key === "Home" && O != null ? (d(O, ce(Ae, u)), H(j.current ?? v.current, pe)) : e.key === "End" && w != null && (d(w, ce(Ae, u)), H(j.current ?? v.current, pe));
898
+ },
899
+ onPaste(e) {
900
+ if (e.defaultPrevented || V || p)
901
+ return;
902
+ e.preventDefault();
903
+ const T = (e.clipboardData || window.Clipboard).getData("text/plain"), P = Se(T, c, m.current);
904
+ P !== null && (S.current = !1, d(P, ce(un, e.nativeEvent)), Y(T));
905
+ }
906
+ }, M.getValidationProps(), f],
907
+ stateAttributesMapping: Ln
908
+ });
909
+ });
910
+ process.env.NODE_ENV !== "production" && (Dt.displayName = "NumberFieldInput");
911
+ const Vt = /* @__PURE__ */ o.createContext(void 0);
912
+ process.env.NODE_ENV !== "production" && (Vt.displayName = "NumberFieldScrubAreaContext");
913
+ function Un(n, r) {
914
+ const t = We(r), s = r.getBoundingClientRect();
915
+ if (s && n != null)
916
+ return {
917
+ x: s.left - n / 2,
918
+ y: s.top - n / 2,
919
+ width: s.right + n / 2,
920
+ height: s.bottom + n / 2
921
+ };
922
+ const a = t.visualViewport;
923
+ return a ? {
924
+ x: a.offsetLeft,
925
+ y: a.offsetTop,
926
+ width: a.offsetLeft + a.width,
927
+ height: a.offsetTop + a.height
928
+ } : {
929
+ x: 0,
930
+ y: 0,
931
+ width: t.document.documentElement.clientWidth,
932
+ height: t.document.documentElement.clientHeight
933
+ };
934
+ }
935
+ function kn(n, r) {
936
+ const t = We(n).visualViewport;
937
+ if (!t)
938
+ return () => {
939
+ };
940
+ function s() {
941
+ t && (r.current = t.scale);
942
+ }
943
+ return s(), t.addEventListener("resize", s), () => {
944
+ t.removeEventListener("resize", s);
945
+ };
946
+ }
947
+ const Ft = /* @__PURE__ */ o.forwardRef(function(r, t) {
948
+ const {
949
+ render: s,
950
+ className: a,
951
+ direction: f = "horizontal",
952
+ pixelSensitivity: S = 2,
953
+ teleportDistance: p,
954
+ ...m
955
+ } = r, {
956
+ state: _,
957
+ setIsScrubbing: b,
958
+ disabled: R,
959
+ readOnly: K,
960
+ inputRef: G,
961
+ incrementValue: h,
962
+ getStepAmount: w,
963
+ onValueCommitted: O,
964
+ lastChangedValueRef: q,
965
+ valueRef: V
966
+ } = De(), g = o.useRef(null), d = o.useRef(!1), k = o.useRef(null), Y = o.useRef({
967
+ x: 0,
968
+ y: 0
969
+ }), c = o.useRef(1), W = Ke(), [x, H] = o.useState(!1), [j, z] = o.useState(!1), [v, Q] = o.useState(!1);
970
+ o.useEffect(() => {
971
+ if (!(!v || !k.current))
972
+ return kn(k.current, c);
973
+ }, [v]);
974
+ function U(N, y) {
975
+ k.current && (k.current.style.transform = `translate3d(${N}px,${y}px,0) scale(${1 / c.current})`);
976
+ }
977
+ const ee = de(({
978
+ movementX: N,
979
+ movementY: y
980
+ }) => {
981
+ const L = k.current, Z = g.current;
982
+ if (!L || !Z)
983
+ return;
984
+ const A = Un(p, Z), e = Y.current, u = {
985
+ x: Math.round(e.x + N),
986
+ y: Math.round(e.y + y)
987
+ }, T = L.offsetWidth, P = L.offsetHeight;
988
+ u.x + T / 2 < A.x ? u.x = A.width - T / 2 : u.x + T / 2 > A.width && (u.x = A.x - T / 2), u.y + P / 2 < A.y ? u.y = A.height - P / 2 : u.y + P / 2 > A.height && (u.y = A.y - P / 2), Y.current = u, U(u.x, u.y);
989
+ }), i = de((N, {
990
+ clientX: y,
991
+ clientY: L
992
+ }) => {
993
+ it.flushSync(() => {
994
+ Q(N), b(N);
995
+ });
996
+ const Z = k.current;
997
+ if (!Z || !N)
998
+ return;
999
+ const A = {
1000
+ x: y - Z.offsetWidth / 2,
1001
+ y: L - Z.offsetHeight / 2
1002
+ };
1003
+ Y.current = A, U(A.x, A.y);
1004
+ });
1005
+ o.useEffect(function() {
1006
+ if (!G.current || R || K || !v)
1007
+ return;
1008
+ let y = 0;
1009
+ function L(e) {
1010
+ function u() {
1011
+ try {
1012
+ Ye(g.current).exitPointerLock();
1013
+ } catch {
1014
+ } finally {
1015
+ d.current = !1, i(!1, e), O(q.current ?? V.current, _e(ot, e));
1016
+ }
1017
+ }
1018
+ qt ? W.start(20, u) : u();
1019
+ }
1020
+ function Z(e) {
1021
+ if (!d.current)
1022
+ return;
1023
+ e.preventDefault(), ee(e);
1024
+ const {
1025
+ movementX: u,
1026
+ movementY: T
1027
+ } = e;
1028
+ if (y += f === "vertical" ? T : u, Math.abs(y) >= S) {
1029
+ y = 0;
1030
+ const P = f === "vertical" ? -T : u, J = w(e) ?? Pe, l = P * J;
1031
+ l !== 0 && h(Math.abs(l), {
1032
+ direction: l >= 0 ? 1 : -1,
1033
+ event: e,
1034
+ reason: ot
1035
+ });
1036
+ }
1037
+ }
1038
+ const A = We(G.current);
1039
+ return A.addEventListener("pointerup", L, !0), A.addEventListener("pointermove", Z, !0), () => {
1040
+ W.clear(), A.removeEventListener("pointerup", L, !0), A.removeEventListener("pointermove", Z, !0);
1041
+ };
1042
+ }, [R, K, h, v, w, G, i, ee, f, S, q, O, V, W]), o.useEffect(function() {
1043
+ const y = g.current;
1044
+ if (!y || R || K)
1045
+ return;
1046
+ function L(Z) {
1047
+ Z.touches.length === 1 && Z.preventDefault();
1048
+ }
1049
+ return y.addEventListener("touchstart", L), () => {
1050
+ y.removeEventListener("touchstart", L);
1051
+ };
1052
+ }, [R, K]);
1053
+ const X = xe("span", r, {
1054
+ ref: [t, g],
1055
+ state: _,
1056
+ props: [{
1057
+ role: "presentation",
1058
+ style: {
1059
+ touchAction: "none",
1060
+ WebkitUserSelect: "none",
1061
+ userSelect: "none"
1062
+ },
1063
+ async onPointerDown(N) {
1064
+ const y = !N.button || N.button === 0;
1065
+ if (N.defaultPrevented || K || !y || R)
1066
+ return;
1067
+ const L = N.pointerType === "touch";
1068
+ if (H(L), N.pointerType === "mouse" && (N.preventDefault(), G.current?.focus()), d.current = !0, i(!0, N.nativeEvent), !L && !Zt)
1069
+ try {
1070
+ await Ye(g.current).body.requestPointerLock(), z(!1);
1071
+ } catch {
1072
+ z(!0);
1073
+ } finally {
1074
+ d.current && it.flushSync(() => {
1075
+ i(!0, N.nativeEvent);
1076
+ });
1077
+ }
1078
+ }
1079
+ }, m],
1080
+ stateAttributesMapping: ye
1081
+ }), M = o.useMemo(() => ({
1082
+ isScrubbing: v,
1083
+ isTouchInput: x,
1084
+ isPointerLockDenied: j,
1085
+ scrubAreaCursorRef: k,
1086
+ scrubAreaRef: g,
1087
+ direction: f,
1088
+ pixelSensitivity: S,
1089
+ teleportDistance: p
1090
+ }), [v, x, j, f, S, p]);
1091
+ return /* @__PURE__ */ se(Vt.Provider, {
1092
+ value: M,
1093
+ children: X
1094
+ });
1095
+ });
1096
+ process.env.NODE_ENV !== "production" && (Ft.displayName = "NumberFieldScrubArea");
1097
+ const Ne = {
1098
+ "number-input__root": "_number-input__root_l4882_2",
1099
+ "number-input": "_number-input_l4882_2",
1100
+ "number-input__scrub-area": "_number-input__scrub-area_l4882_20",
1101
+ "number-input__group": "_number-input__group_l4882_25",
1102
+ "number-input__controls": "_number-input__controls_l4882_29",
1103
+ "number-input__separator": "_number-input__separator_l4882_40"
1104
+ };
1105
+ function pr({
1106
+ label: n,
1107
+ /** Apply className to NumberField.Input */
1108
+ className: r,
1109
+ /** Apply style to NumberField.Input */
1110
+ style: t,
1111
+ ...s
1112
+ }) {
1113
+ const a = Ut(), f = s.id || a;
1114
+ return /* @__PURE__ */ Ue(
1115
+ It,
1116
+ {
1117
+ ...s,
1118
+ id: f,
1119
+ className: Ne["number-input__root"],
1120
+ children: [
1121
+ n ? /* @__PURE__ */ se(Ft, { className: Ne["number-input__scrub-area"], children: /* @__PURE__ */ se("label", { htmlFor: f, children: /* @__PURE__ */ se(kt, { color: "dimmer", children: n }) }) }) : null,
1122
+ /* @__PURE__ */ Ue(At, { className: Ne["number-input__group"], children: [
1123
+ /* @__PURE__ */ se(
1124
+ Wt,
1125
+ {
1126
+ render: /* @__PURE__ */ se(
1127
+ Dt,
1128
+ {
1129
+ className: Ot(Ne["number-input"], r),
1130
+ style: t
1131
+ }
1132
+ )
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ Ue(Ht, { className: Ne["number-input__controls"], children: [
1136
+ /* @__PURE__ */ se(
1137
+ tt,
1138
+ {
1139
+ size: "sm",
1140
+ alt: "Decrement",
1141
+ icon: "subtract-line",
1142
+ render: /* @__PURE__ */ se(Pt, {})
1143
+ }
1144
+ ),
1145
+ /* @__PURE__ */ se(
1146
+ Gt,
1147
+ {
1148
+ orientation: "vertical",
1149
+ className: Ne["number-input__separator"]
1150
+ }
1151
+ ),
1152
+ /* @__PURE__ */ se(
1153
+ tt,
1154
+ {
1155
+ size: "sm",
1156
+ alt: "Increment",
1157
+ icon: "add-line",
1158
+ render: /* @__PURE__ */ se(Tt, {})
1159
+ }
1160
+ )
1161
+ ] })
1162
+ ] })
1163
+ ]
1164
+ }
1165
+ );
1166
+ }
1167
+ export {
1168
+ pr as NumberInput
1169
+ };