@koide-labs/ui 0.0.0 → 0.0.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 (383) hide show
  1. package/README.md +53 -3
  2. package/{src/-types.ts → dist/-types.d.ts} +1 -6
  3. package/dist/-types.js +1 -0
  4. package/dist/-utils.d.ts +19 -0
  5. package/dist/-utils.js +33 -0
  6. package/dist/Button-DrPFFzo7.js +31 -0
  7. package/dist/CompositeRoot-CVk5a-pR.js +233 -0
  8. package/dist/DirectionContext-C2o_MF_i.js +9 -0
  9. package/dist/FieldItemContext-DAvk99to.js +11 -0
  10. package/dist/FloatingPortal-tWyuKRSN.js +435 -0
  11. package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
  12. package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
  13. package/dist/LabelableContext-BMvjVwor.js +169 -0
  14. package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
  15. package/dist/clamp-D0KDAQIz.js +6 -0
  16. package/dist/clsx-OuTLNxxd.js +16 -0
  17. package/dist/components/accordion/index.d.ts +12 -0
  18. package/dist/components/accordion/index.js +699 -0
  19. package/dist/components/alert-dialog/index.d.ts +26 -0
  20. package/dist/components/alert-dialog/index.js +136 -0
  21. package/dist/components/anchor/index.d.ts +8 -0
  22. package/dist/components/anchor/index.js +38 -0
  23. package/dist/components/avatar/index.d.ts +21 -0
  24. package/dist/components/avatar/index.js +161 -0
  25. package/dist/components/badge/index.d.ts +16 -0
  26. package/dist/components/badge/index.js +40 -0
  27. package/dist/components/button/index.d.ts +24 -0
  28. package/dist/components/button/index.js +47 -0
  29. package/dist/components/checkbox/index.d.ts +9 -0
  30. package/dist/components/checkbox/index.js +269 -0
  31. package/dist/components/code/index.d.ts +9 -0
  32. package/dist/components/code/index.js +10 -0
  33. package/dist/components/collapse/index.d.ts +11 -0
  34. package/dist/components/collapse/index.js +41 -0
  35. package/dist/components/command/index.d.ts +14 -0
  36. package/dist/components/command/index.js +1695 -0
  37. package/dist/components/context-menu/index.d.ts +42 -0
  38. package/dist/components/context-menu/index.js +1444 -0
  39. package/dist/components/dialog/index.d.ts +48 -0
  40. package/dist/components/dialog/index.js +138 -0
  41. package/dist/components/heading/index.d.ts +44 -0
  42. package/dist/components/heading/index.js +56 -0
  43. package/dist/components/icon/icon-names.d.ts +1 -0
  44. package/dist/components/icon/icon-names.js +1 -0
  45. package/dist/components/icon/index.d.ts +23 -0
  46. package/dist/components/icon/index.js +43 -0
  47. package/dist/components/icon-button/index.d.ts +12 -0
  48. package/dist/components/icon-button/index.js +45 -0
  49. package/dist/components/inline-code/index.d.ts +6 -0
  50. package/dist/components/inline-code/index.js +22 -0
  51. package/dist/components/input/index.d.ts +3 -0
  52. package/dist/components/input/index.js +119 -0
  53. package/dist/components/meter/index.d.ts +18 -0
  54. package/dist/components/meter/index.js +165 -0
  55. package/dist/components/multiline-input/index.d.ts +6 -0
  56. package/dist/components/multiline-input/index.js +100 -0
  57. package/dist/components/number-input/index.d.ts +10 -0
  58. package/dist/components/number-input/index.js +1169 -0
  59. package/dist/components/password-input/index.d.ts +2 -0
  60. package/dist/components/password-input/index.js +29 -0
  61. package/dist/components/pill/index.d.ts +13 -0
  62. package/dist/components/pill/index.js +38 -0
  63. package/dist/components/popover/index.d.ts +21 -0
  64. package/dist/components/popover/index.js +636 -0
  65. package/dist/components/preview-card/index.d.ts +17 -0
  66. package/dist/components/preview-card/index.js +402 -0
  67. package/dist/components/radio/index.d.ts +13 -0
  68. package/dist/components/radio/index.js +404 -0
  69. package/dist/components/search-bar/index.d.ts +12 -0
  70. package/dist/components/search-bar/index.js +48 -0
  71. package/dist/components/select/index.d.ts +16 -0
  72. package/dist/components/select/index.js +1263 -0
  73. package/dist/components/separator/index.d.ts +7 -0
  74. package/dist/components/separator/index.js +6 -0
  75. package/dist/components/slider/index.d.ts +5 -0
  76. package/dist/components/slider/index.js +902 -0
  77. package/dist/components/spinner/index.d.ts +2 -0
  78. package/dist/components/spinner/index.js +13 -0
  79. package/dist/components/stacked-avatars/index.d.ts +14 -0
  80. package/dist/components/stacked-avatars/index.js +92 -0
  81. package/dist/components/status-banner/index.d.ts +17 -0
  82. package/dist/components/status-banner/index.js +69 -0
  83. package/dist/components/surface/index.d.ts +27 -0
  84. package/dist/components/surface/index.js +41 -0
  85. package/dist/components/switch/index.d.ts +5 -0
  86. package/dist/components/switch/index.js +196 -0
  87. package/dist/components/tabs/index.d.ts +18 -0
  88. package/dist/components/tabs/index.js +509 -0
  89. package/dist/components/text/index.d.ts +26 -0
  90. package/dist/components/text/index.js +51 -0
  91. package/dist/components/theme-provider/index.d.ts +2 -0
  92. package/dist/components/theme-provider/index.js +6 -0
  93. package/dist/components/theme-provider/theme-context.d.ts +9 -0
  94. package/dist/components/theme-provider/theme-context.js +13 -0
  95. package/dist/components/theme-provider/theme-provider.d.ts +17 -0
  96. package/dist/components/theme-provider/theme-provider.js +30 -0
  97. package/dist/components/timestamp/index.d.ts +23 -0
  98. package/dist/components/timestamp/index.js +1392 -0
  99. package/dist/components/toast/index.d.ts +2 -0
  100. package/dist/components/toast/index.js +7 -0
  101. package/dist/components/toast/toast.d.ts +2 -0
  102. package/dist/components/toast/toast.js +878 -0
  103. package/dist/components/toast/use-toast-manager.d.ts +27 -0
  104. package/dist/components/toast/use-toast-manager.js +4 -0
  105. package/dist/components/tooltip/index.d.ts +14 -0
  106. package/dist/components/tooltip/index.js +712 -0
  107. package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
  108. package/dist/components/tooltip/tooltip-arrow.js +6 -0
  109. package/dist/components/view/index.d.ts +30 -0
  110. package/dist/components/view/index.js +84 -0
  111. package/dist/components/visually-hidden/index.d.ts +1 -0
  112. package/dist/components/visually-hidden/index.js +4 -0
  113. package/dist/composite-Bx7Szd_T.js +208 -0
  114. package/dist/composite-C9L5QmZL.js +66 -0
  115. package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
  116. package/dist/detectBrowser-I-s3yzIE.js +43 -0
  117. package/dist/dialog.css +1 -0
  118. package/dist/dialog.module-BeF-6XAo.js +415 -0
  119. package/dist/element-CZEOj04G.js +80 -0
  120. package/dist/event-CKoGyQEJ.js +30 -0
  121. package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
  122. package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
  123. package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
  124. package/dist/formatNumber-1UNwjeqf.js +25 -0
  125. package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
  126. package/dist/index-BX1XbbRk.js +1206 -0
  127. package/dist/index-CeuccO-T.js +109 -0
  128. package/dist/index-DN9Bn1qm.js +29 -0
  129. package/dist/index-FMoPxlJ2.js +52 -0
  130. package/dist/index.css +1 -0
  131. package/dist/index.d.ts +42 -0
  132. package/dist/index.js +108 -0
  133. package/dist/index10.css +1 -0
  134. package/dist/index11.css +1 -0
  135. package/dist/index12.css +1 -0
  136. package/dist/index13.css +1 -0
  137. package/dist/index14.css +1 -0
  138. package/dist/index15.css +1 -0
  139. package/dist/index16.css +1 -0
  140. package/dist/index17.css +1 -0
  141. package/dist/index18.css +1 -0
  142. package/dist/index19.css +1 -0
  143. package/dist/index2.css +1 -0
  144. package/dist/index20.css +1 -0
  145. package/dist/index21.css +1 -0
  146. package/dist/index22.css +1 -0
  147. package/dist/index23.css +1 -0
  148. package/dist/index24.css +1 -0
  149. package/dist/index25.css +1 -0
  150. package/dist/index26.css +1 -0
  151. package/dist/index27.css +1 -0
  152. package/dist/index28.css +1 -0
  153. package/dist/index29.css +1 -0
  154. package/dist/index3.css +1 -0
  155. package/dist/index30.css +1 -0
  156. package/dist/index31.css +1 -0
  157. package/dist/index32.css +1 -0
  158. package/dist/index33.css +1 -0
  159. package/dist/index34.css +1 -0
  160. package/dist/index35.css +1 -0
  161. package/dist/index36.css +1 -0
  162. package/dist/index37.css +1 -0
  163. package/dist/index4.css +1 -0
  164. package/dist/index5.css +1 -0
  165. package/dist/index6.css +1 -0
  166. package/dist/index7.css +1 -0
  167. package/dist/index8.css +1 -0
  168. package/dist/index9.css +1 -0
  169. package/dist/inertValue-BCYGsdmf.js +7 -0
  170. package/dist/input.css +1 -0
  171. package/dist/input.module-DDQY_Ij6.js +7 -0
  172. package/dist/integrations/react-markdown/index.d.ts +5 -0
  173. package/dist/integrations/react-markdown/index.js +6895 -0
  174. package/dist/integrations/remix/index.d.ts +9 -0
  175. package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
  176. package/dist/integrations/tailwind.css +1 -0
  177. package/dist/integrations/twemoij/index.d.ts +3 -0
  178. package/dist/integrations/twemoij/index.js +18 -0
  179. package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
  180. package/dist/owner-rKN292Q9.js +6 -0
  181. package/dist/safePolygon-DWy1dGKJ.js +308 -0
  182. package/dist/styles/core.css +1 -0
  183. package/dist/styles/tokens.d.ts +400 -0
  184. package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
  185. package/dist/toast.css +1 -0
  186. package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
  187. package/dist/tooltip-arrow.css +1 -0
  188. package/dist/transitions.css +1 -0
  189. package/dist/transitions.module-CWX8e5cx.js +1343 -0
  190. package/dist/use-toast-manager-Dq-44AuW.js +37 -0
  191. package/dist/useAnimationFrame-451ugS_6.js +68 -0
  192. package/dist/useBaseUiId-B7WyxtIE.js +7 -0
  193. package/dist/useButton-DfIwsdb8.js +127 -0
  194. package/dist/useCompositeListItem-OkcAim_1.js +148 -0
  195. package/dist/useControlled-Du4sJyMj.js +31 -0
  196. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
  197. package/dist/useId-C5kyn6tA.js +22 -0
  198. package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
  199. package/dist/useLabelableId-Ci_jDvmv.js +29 -0
  200. package/dist/useOnMount-VRW6CK2u.js +8 -0
  201. package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
  202. package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
  203. package/dist/useRender-CLx7dR_1.js +7 -0
  204. package/dist/useRenderElement-DwToLA61.js +244 -0
  205. package/dist/useRole-oDBdbuwQ.js +77 -0
  206. package/dist/useStableCallback-CkTrVkNX.js +29 -0
  207. package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
  208. package/dist/useTimeout-CflX-kz3.js +32 -0
  209. package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
  210. package/dist/useTypeahead-D85V2IUx.js +333 -0
  211. package/dist/useValueAsRef-HURLzret.js +19 -0
  212. package/dist/useValueChanged-DL757-yD.js +14 -0
  213. package/dist/valueToPercent-DaP9qN4u.js +6 -0
  214. package/dist/view.css +1 -0
  215. package/dist/view.module-DfDLgJE0.js +6 -0
  216. package/dist/visuallyHidden-CpJ-mhai.js +16 -0
  217. package/dist/warn-CKtX8MLJ.js +11 -0
  218. package/package.json +18 -2
  219. package/.husky/pre-commit +0 -1
  220. package/.storybook/main.ts +0 -25
  221. package/.storybook/preview-head.html +0 -6
  222. package/.storybook/preview.tsx +0 -48
  223. package/.storybook/vitest.setup.ts +0 -8
  224. package/eslint.config.mjs +0 -29
  225. package/lint-staged.config.js +0 -15
  226. package/pnpm-workspace.yaml +0 -2
  227. package/postcss.config.mjs +0 -7
  228. package/prettier.config.mjs +0 -24
  229. package/scripts/build-icon-types.ts +0 -38
  230. package/src/-utils.tsx +0 -64
  231. package/src/components/accordion/accordion.module.css +0 -44
  232. package/src/components/accordion/accordion.stories.tsx +0 -36
  233. package/src/components/accordion/index.tsx +0 -67
  234. package/src/components/alert-dialog/alert-dialog.module.css +0 -5
  235. package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
  236. package/src/components/alert-dialog/index.tsx +0 -138
  237. package/src/components/anchor/anchor.module.css +0 -18
  238. package/src/components/anchor/anchor.stories.tsx +0 -28
  239. package/src/components/anchor/index.tsx +0 -45
  240. package/src/components/avatar/avatar.module.css +0 -56
  241. package/src/components/avatar/avatar.stories.tsx +0 -61
  242. package/src/components/avatar/index.tsx +0 -82
  243. package/src/components/badge/badge.module.css +0 -35
  244. package/src/components/badge/badge.stories.tsx +0 -60
  245. package/src/components/badge/index.tsx +0 -71
  246. package/src/components/button/button.module.css +0 -42
  247. package/src/components/button/button.stories.tsx +0 -108
  248. package/src/components/button/index.tsx +0 -63
  249. package/src/components/checkbox/checkbox.module.css +0 -36
  250. package/src/components/checkbox/checkbox.stories.tsx +0 -21
  251. package/src/components/checkbox/index.tsx +0 -41
  252. package/src/components/code/code.module.css +0 -20
  253. package/src/components/code/code.stories.tsx +0 -42
  254. package/src/components/code/index.tsx +0 -73
  255. package/src/components/collapse/collapse.module.css +0 -27
  256. package/src/components/collapse/collapse.stories.tsx +0 -27
  257. package/src/components/collapse/index.tsx +0 -59
  258. package/src/components/command/command.module.css +0 -95
  259. package/src/components/command/command.stories.tsx +0 -38
  260. package/src/components/command/index.tsx +0 -108
  261. package/src/components/context-menu/context-menu.module.css +0 -36
  262. package/src/components/context-menu/context-menu.stories.tsx +0 -99
  263. package/src/components/context-menu/index.tsx +0 -242
  264. package/src/components/dialog/dialog.module.css +0 -71
  265. package/src/components/dialog/dialog.stories.tsx +0 -29
  266. package/src/components/dialog/index.tsx +0 -148
  267. package/src/components/heading/heading.module.css +0 -3
  268. package/src/components/heading/heading.stories.tsx +0 -52
  269. package/src/components/heading/index.tsx +0 -112
  270. package/src/components/icon/icon-names.ts +0 -3189
  271. package/src/components/icon/icon.module.css +0 -36
  272. package/src/components/icon/icon.stories.tsx +0 -40
  273. package/src/components/icon/index.tsx +0 -60
  274. package/src/components/icon-button/icon-button.module.css +0 -33
  275. package/src/components/icon-button/icon-button.stories.tsx +0 -59
  276. package/src/components/icon-button/index.tsx +0 -48
  277. package/src/components/inline-code/index.tsx +0 -29
  278. package/src/components/inline-code/inline-code.module.css +0 -13
  279. package/src/components/inline-code/inline-code.stories.tsx +0 -31
  280. package/src/components/input/index.tsx +0 -22
  281. package/src/components/input/input.module.css +0 -23
  282. package/src/components/input/input.stories.tsx +0 -52
  283. package/src/components/meter/index.tsx +0 -55
  284. package/src/components/meter/meter.module.css +0 -23
  285. package/src/components/meter/meter.stories.tsx +0 -31
  286. package/src/components/multiline-input/index.tsx +0 -58
  287. package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
  288. package/src/components/number-input/index.tsx +0 -74
  289. package/src/components/number-input/number-input.module.css +0 -41
  290. package/src/components/number-input/number-input.stories.tsx +0 -24
  291. package/src/components/password-input/index.tsx +0 -24
  292. package/src/components/password-input/password-input.module.css +0 -10
  293. package/src/components/password-input/password-input.stories.tsx +0 -24
  294. package/src/components/pill/index.tsx +0 -45
  295. package/src/components/pill/pill.module.css +0 -22
  296. package/src/components/pill/pill.stories.tsx +0 -83
  297. package/src/components/popover/index.tsx +0 -94
  298. package/src/components/popover/popover.module.css +0 -8
  299. package/src/components/popover/popover.stories.tsx +0 -53
  300. package/src/components/preview-card/index.tsx +0 -68
  301. package/src/components/preview-card/preview-card.module.css +0 -5
  302. package/src/components/preview-card/preview-card.stories.tsx +0 -58
  303. package/src/components/radio/index.tsx +0 -67
  304. package/src/components/radio/radio-group.module.css +0 -5
  305. package/src/components/radio/radio.module.css +0 -36
  306. package/src/components/radio/radio.stories.tsx +0 -27
  307. package/src/components/search-bar/index.tsx +0 -60
  308. package/src/components/search-bar/search-bar.module.css +0 -29
  309. package/src/components/search-bar/search-bar.stories.tsx +0 -37
  310. package/src/components/select/index.tsx +0 -132
  311. package/src/components/select/select.module.css +0 -63
  312. package/src/components/select/select.stories.tsx +0 -49
  313. package/src/components/separator/index.tsx +0 -28
  314. package/src/components/separator/separator.module.css +0 -24
  315. package/src/components/separator/separator.stories.tsx +0 -40
  316. package/src/components/slider/index.tsx +0 -28
  317. package/src/components/slider/slider.module.css +0 -52
  318. package/src/components/slider/slider.stories.tsx +0 -53
  319. package/src/components/spinner/index.tsx +0 -14
  320. package/src/components/spinner/spinner.module.css +0 -13
  321. package/src/components/spinner/spinner.stories.tsx +0 -17
  322. package/src/components/stacked-avatars/index.tsx +0 -88
  323. package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
  324. package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
  325. package/src/components/status-banner/index.tsx +0 -96
  326. package/src/components/status-banner/status-banner.module.css +0 -52
  327. package/src/components/status-banner/status-banner.stories.tsx +0 -44
  328. package/src/components/surface/index.tsx +0 -83
  329. package/src/components/surface/surface.module.css +0 -35
  330. package/src/components/surface/surface.stories.tsx +0 -84
  331. package/src/components/switch/index.tsx +0 -23
  332. package/src/components/switch/switch.module.css +0 -45
  333. package/src/components/switch/switch.stories.tsx +0 -48
  334. package/src/components/tabs/index.tsx +0 -126
  335. package/src/components/tabs/tabs.module.css +0 -134
  336. package/src/components/tabs/tabs.stories.tsx +0 -88
  337. package/src/components/text/index.tsx +0 -69
  338. package/src/components/text/text.module.css +0 -76
  339. package/src/components/text/text.stories.tsx +0 -107
  340. package/src/components/theme-provider/index.ts +0 -2
  341. package/src/components/theme-provider/theme-context.tsx +0 -18
  342. package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
  343. package/src/components/theme-provider/theme-provider.tsx +0 -77
  344. package/src/components/timestamp/index.tsx +0 -131
  345. package/src/components/timestamp/timestamp.module.css +0 -8
  346. package/src/components/timestamp/timestamp.stories.tsx +0 -37
  347. package/src/components/toast/index.ts +0 -2
  348. package/src/components/toast/toast.module.css +0 -163
  349. package/src/components/toast/toast.stories.tsx +0 -53
  350. package/src/components/toast/toast.tsx +0 -104
  351. package/src/components/toast/use-toast-manager.ts +0 -63
  352. package/src/components/tooltip/index.tsx +0 -61
  353. package/src/components/tooltip/tooltip-arrow.tsx +0 -17
  354. package/src/components/tooltip/tooltip.module.css +0 -44
  355. package/src/components/tooltip/tooltip.stories.tsx +0 -76
  356. package/src/components/view/index.tsx +0 -137
  357. package/src/components/view/view.module.css +0 -11
  358. package/src/components/view/view.stories.tsx +0 -131
  359. package/src/components/view/view_colorway.module.css +0 -280
  360. package/src/components/view/view_interactive.module.css +0 -127
  361. package/src/components/view/view_loading.module.css +0 -58
  362. package/src/components/visually-hidden/index.ts +0 -1
  363. package/src/index.ts +0 -49
  364. package/src/integrations/react-markdown/index.tsx +0 -134
  365. package/src/integrations/react-markdown/react-markdown.module.css +0 -62
  366. package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
  367. package/src/integrations/tailwind.css +0 -173
  368. package/src/integrations/twemoij/index.tsx +0 -13
  369. package/src/integrations/twemoij/twemoji.module.css +0 -7
  370. package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
  371. package/src/stories/components/all-variants.tsx +0 -40
  372. package/src/stories/data.ts +0 -72
  373. package/src/stories/utils.ts +0 -20
  374. package/src/styles/core.css +0 -153
  375. package/src/styles/themes/dark.css +0 -86
  376. package/src/styles/themes/light.css +0 -86
  377. package/src/styles/transitions.module.css +0 -31
  378. package/stylelint.config.mjs +0 -29
  379. package/tsconfig.app.json +0 -35
  380. package/tsconfig.json +0 -7
  381. package/tsconfig.node.json +0 -26
  382. package/vite.config.ts +0 -103
  383. package/vitest.shims.d.ts +0 -1
@@ -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 { IconButton as tt } from "../icon-button/index.js";
6
+ import { Input as kt } from "../input/index.js";
7
+ import { S as Wt } from "../../index-FMoPxlJ2.js";
8
+ import { Text as Ht } from "../text/index.js";
9
+ import { View as Gt } from "../view/index.js";
10
+ import { u as Bt } from "../../useControlled-Du4sJyMj.js";
11
+ import { u as de } from "../../useStableCallback-CkTrVkNX.js";
12
+ import { T as $t, u as Ke } from "../../useTimeout-CflX-kz3.js";
13
+ import { a as Kt, c as Yt, u as xe } from "../../useRenderElement-DwToLA61.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-HURLzret.js";
17
+ import { v as zt } from "../../visuallyHidden-CpJ-mhai.js";
18
+ import { o as Ye } from "../../owner-rKN292Q9.js";
19
+ import { c as qt, f as Xt, d as Zt } from "../../detectBrowser-I-s3yzIE.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-BMvjVwor.js";
22
+ import { u as rn } from "../../useLabelableId-Ci_jDvmv.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, h as _e, n as on, j as un, k as Ae, m as Be, p as rt, q as st, s as ot } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
26
+ import { d as We } from "../../floating-ui.utils.dom-C7FS5id0.js";
27
+ import * as it from "react-dom";
28
+ import { u as an } from "../../useValueChanged-DL757-yD.js";
29
+ import { s as cn } from "../../event-CKoGyQEJ.js";
30
+ import { u as mt } from "../../useButton-DfIwsdb8.js";
31
+ import '../../index31.css';function ln() {
32
+ const [, n] = o.useState({});
33
+ return o.useCallback(() => {
34
+ n({});
35
+ }, []);
36
+ }
37
+ const ut = 0;
38
+ class qe extends $t {
39
+ static create() {
40
+ return new qe();
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(qe.create).current;
56
+ return jt(n.disposeEffect), n;
57
+ }
58
+ const Xe = /* @__PURE__ */ o.createContext(void 0);
59
+ process.env.NODE_ENV !== "production" && (Xe.displayName = "NumberFieldRootContext");
60
+ function De() {
61
+ const n = o.useContext(Xe);
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 X = (a ? "-" : "") + w;
174
+ let V = parseFloat(X);
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: X = !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, q = 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 (!qt)
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 || !X || !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
+ }, [X, 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: q,
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, q, _, 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(Xe.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: q,
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: X,
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, X(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 q = a(i) ?? Pe, M = k.current;
532
+ S(q, {
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, q = t || (b ? v : z);
542
+ i.defaultPrevented || O || !I || q || (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: q,
559
+ y: M
560
+ } = W.current, N = q - 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: X,
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: X,
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
+ }), q = o.useMemo(() => ({
637
+ ...x,
638
+ disabled: U
639
+ }), [x, U]);
640
+ return xe("button", r, {
641
+ ref: [t, I],
642
+ state: q,
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: X,
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: X,
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
+ }), q = o.useMemo(() => ({
710
+ ...W,
711
+ disabled: U
712
+ }), [W, U]);
713
+ return xe("button", r, {
714
+ ref: [t, I],
715
+ state: q,
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: X,
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: q,
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: X,
772
+ getValue: () => x ?? null
773
+ }), an(x, (e) => {
774
+ const u = q();
775
+ if (Q(X), 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: X,
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(X.current ?? V.current, _e(ot, e));
1016
+ }
1017
+ }
1018
+ Xt ? 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, X, 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 q = 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: q
1094
+ });
1095
+ });
1096
+ process.env.NODE_ENV !== "production" && (Ft.displayName = "NumberFieldScrubArea");
1097
+ const Ne = {
1098
+ "number-input__root": "_number-input__root_12e9i_1",
1099
+ "number-input": "_number-input_12e9i_1",
1100
+ "number-input__scrub-area": "_number-input__scrub-area_12e9i_19",
1101
+ "number-input__group": "_number-input__group_12e9i_24",
1102
+ "number-input__controls": "_number-input__controls_12e9i_28",
1103
+ "number-input__separator": "_number-input__separator_12e9i_39"
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
+ id: f,
1118
+ className: Ne["number-input__root"],
1119
+ ...s,
1120
+ children: [
1121
+ n ? /* @__PURE__ */ se(Ft, { className: Ne["number-input__scrub-area"], children: /* @__PURE__ */ se("label", { htmlFor: f, children: /* @__PURE__ */ se(Ht, { color: "dimmer", children: n }) }) }) : null,
1122
+ /* @__PURE__ */ Ue(At, { className: Ne["number-input__group"], children: [
1123
+ /* @__PURE__ */ se(
1124
+ kt,
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(Gt, { 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
+ Wt,
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
+ };