@gild-ui/react 0.0.0 → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +399 -1
  3. package/dist/Accordion.cjs +338 -0
  4. package/dist/Accordion.d.cts +110 -0
  5. package/dist/Accordion.d.mts +110 -0
  6. package/dist/Accordion.mjs +334 -0
  7. package/dist/Accordion.types-D06ViRMj.d.mts +1114 -0
  8. package/dist/Alert.cjs +187 -0
  9. package/dist/Alert.d.cts +51 -0
  10. package/dist/Alert.d.mts +51 -0
  11. package/dist/Alert.mjs +186 -0
  12. package/dist/AppBar.cjs +76 -0
  13. package/dist/AppBar.d.cts +22 -0
  14. package/dist/AppBar.d.mts +22 -0
  15. package/dist/AppBar.mjs +76 -0
  16. package/dist/Autocomplete.cjs +685 -0
  17. package/dist/Autocomplete.d.cts +97 -0
  18. package/dist/Autocomplete.d.mts +97 -0
  19. package/dist/Autocomplete.mjs +685 -0
  20. package/dist/Avatar.cjs +113 -0
  21. package/dist/Avatar.d.cts +27 -0
  22. package/dist/Avatar.d.mts +27 -0
  23. package/dist/Avatar.mjs +113 -0
  24. package/dist/Backdrop.cjs +30 -0
  25. package/dist/Backdrop.d.cts +11 -0
  26. package/dist/Backdrop.d.mts +11 -0
  27. package/dist/Backdrop.mjs +29 -0
  28. package/dist/Badge.cjs +136 -0
  29. package/dist/Badge.d.cts +47 -0
  30. package/dist/Badge.d.mts +47 -0
  31. package/dist/Badge.mjs +136 -0
  32. package/dist/Breadcrumbs.cjs +150 -0
  33. package/dist/Breadcrumbs.d.cts +33 -0
  34. package/dist/Breadcrumbs.d.mts +33 -0
  35. package/dist/Breadcrumbs.mjs +149 -0
  36. package/dist/Button.cjs +194 -0
  37. package/dist/Button.d.cts +51 -0
  38. package/dist/Button.d.mts +3 -0
  39. package/dist/Button.mjs +194 -0
  40. package/dist/ButtonGroup.cjs +116 -0
  41. package/dist/ButtonGroup.d.cts +43 -0
  42. package/dist/ButtonGroup.d.mts +3 -0
  43. package/dist/ButtonGroup.mjs +115 -0
  44. package/dist/ButtonGroupContext-D5Fg5Slq.mjs +5 -0
  45. package/dist/ButtonGroupContext-W4VkHwoR.cjs +9 -0
  46. package/dist/CacheProvider.cjs +9 -0
  47. package/dist/CacheProvider.d.cts +4 -0
  48. package/dist/CacheProvider.d.mts +4 -0
  49. package/dist/CacheProvider.mjs +9 -0
  50. package/dist/Card.cjs +105 -0
  51. package/dist/Card.d.cts +19 -0
  52. package/dist/Card.d.mts +19 -0
  53. package/dist/Card.mjs +105 -0
  54. package/dist/Checkbox.cjs +210 -0
  55. package/dist/Checkbox.d.cts +48 -0
  56. package/dist/Checkbox.d.mts +48 -0
  57. package/dist/Checkbox.mjs +210 -0
  58. package/dist/Chip.cjs +210 -0
  59. package/dist/Chip.d.cts +51 -0
  60. package/dist/Chip.d.mts +51 -0
  61. package/dist/Chip.mjs +210 -0
  62. package/dist/CircularProgress.cjs +151 -0
  63. package/dist/CircularProgress.d.cts +37 -0
  64. package/dist/CircularProgress.d.mts +37 -0
  65. package/dist/CircularProgress.mjs +151 -0
  66. package/dist/Collapse.cjs +133 -0
  67. package/dist/Collapse.d.cts +38 -0
  68. package/dist/Collapse.d.mts +3 -0
  69. package/dist/Collapse.mjs +133 -0
  70. package/dist/Drawer.cjs +168 -0
  71. package/dist/Drawer.d.cts +60 -0
  72. package/dist/Drawer.d.mts +60 -0
  73. package/dist/Drawer.mjs +166 -0
  74. package/dist/Fab.cjs +123 -0
  75. package/dist/Fab.d.cts +33 -0
  76. package/dist/Fab.d.mts +3 -0
  77. package/dist/Fab.mjs +122 -0
  78. package/dist/FabMenu.cjs +312 -0
  79. package/dist/FabMenu.d.cts +70 -0
  80. package/dist/FabMenu.d.mts +70 -0
  81. package/dist/FabMenu.mjs +311 -0
  82. package/dist/Fade.cjs +17 -0
  83. package/dist/Fade.d.cts +8 -0
  84. package/dist/Fade.d.mts +8 -0
  85. package/dist/Fade.mjs +16 -0
  86. package/dist/Flex.cjs +18 -0
  87. package/dist/Flex.d.cts +2 -0
  88. package/dist/Flex.d.mts +2 -0
  89. package/dist/Flex.mjs +18 -0
  90. package/dist/FocusTrap.cjs +87 -0
  91. package/dist/FocusTrap.d.cts +28 -0
  92. package/dist/FocusTrap.d.mts +28 -0
  93. package/dist/FocusTrap.mjs +86 -0
  94. package/dist/Form.cjs +47 -0
  95. package/dist/Form.d.cts +41 -0
  96. package/dist/Form.d.mts +41 -0
  97. package/dist/Form.mjs +46 -0
  98. package/dist/FormContext-DfpxiqRO.cjs +9 -0
  99. package/dist/FormContext-fZHQHKUU.mjs +6 -0
  100. package/dist/FormControl.cjs +98 -0
  101. package/dist/FormControl.d.cts +81 -0
  102. package/dist/FormControl.d.mts +81 -0
  103. package/dist/FormControl.mjs +96 -0
  104. package/dist/FormControlContext-Btvm04Sj.cjs +9 -0
  105. package/dist/FormControlContext-CaQLS_sK.mjs +6 -0
  106. package/dist/FormHelperText.cjs +40 -0
  107. package/dist/FormHelperText.d.cts +15 -0
  108. package/dist/FormHelperText.d.mts +15 -0
  109. package/dist/FormHelperText.mjs +39 -0
  110. package/dist/FormLabel.cjs +45 -0
  111. package/dist/FormLabel.d.cts +17 -0
  112. package/dist/FormLabel.d.mts +17 -0
  113. package/dist/FormLabel.mjs +44 -0
  114. package/dist/Global.cjs +8 -0
  115. package/dist/Global.d.cts +2 -0
  116. package/dist/Global.d.mts +2 -0
  117. package/dist/Global.mjs +1 -0
  118. package/dist/Grid.cjs +20 -0
  119. package/dist/Grid.d.cts +25 -0
  120. package/dist/Grid.d.mts +25 -0
  121. package/dist/Grid.mjs +20 -0
  122. package/dist/Grow.cjs +21 -0
  123. package/dist/Grow.d.cts +8 -0
  124. package/dist/Grow.d.mts +8 -0
  125. package/dist/Grow.mjs +20 -0
  126. package/dist/Icon-CpmLCuWc.mjs +916 -0
  127. package/dist/Icon-D8CNaUwd.cjs +927 -0
  128. package/dist/Icon.cjs +4 -0
  129. package/dist/Icon.d.cts +3 -0
  130. package/dist/Icon.d.mts +3 -0
  131. package/dist/Icon.mjs +1 -0
  132. package/dist/Image.cjs +89 -0
  133. package/dist/Image.d.cts +19 -0
  134. package/dist/Image.d.mts +19 -0
  135. package/dist/Image.mjs +89 -0
  136. package/dist/LayoutProvider-DFwC1-h0.d.cts +19 -0
  137. package/dist/LayoutProvider-DFwC1-h0.d.mts +19 -0
  138. package/dist/LayoutProvider-Eb5Vp2BZ.mjs +36 -0
  139. package/dist/LayoutProvider-nB0hiaCR.cjs +41 -0
  140. package/dist/LayoutProvider.cjs +3 -0
  141. package/dist/LayoutProvider.d.cts +2 -0
  142. package/dist/LayoutProvider.d.mts +2 -0
  143. package/dist/LayoutProvider.mjs +1 -0
  144. package/dist/LinearProgress.cjs +232 -0
  145. package/dist/LinearProgress.d.cts +39 -0
  146. package/dist/LinearProgress.d.mts +39 -0
  147. package/dist/LinearProgress.mjs +232 -0
  148. package/dist/Link.cjs +59 -0
  149. package/dist/Link.d.cts +9 -0
  150. package/dist/Link.d.mts +9 -0
  151. package/dist/Link.mjs +59 -0
  152. package/dist/Menu-CEr2M5u0.mjs +229 -0
  153. package/dist/Menu-DA9QNBfE.cjs +245 -0
  154. package/dist/Menu.cjs +174 -0
  155. package/dist/Menu.d.cts +209 -0
  156. package/dist/Menu.d.mts +209 -0
  157. package/dist/Menu.mjs +168 -0
  158. package/dist/MenuItem-D3lzWmIO.cjs +859 -0
  159. package/dist/MenuItem-DzHB9Es6.mjs +807 -0
  160. package/dist/MenuItem.cjs +4 -0
  161. package/dist/MenuItem.d.cts +3 -0
  162. package/dist/MenuItem.d.mts +3 -0
  163. package/dist/MenuItem.mjs +2 -0
  164. package/dist/Modal-BphaFrcw.mjs +300 -0
  165. package/dist/Modal-C5OWwkvp.cjs +328 -0
  166. package/dist/Modal.cjs +8 -0
  167. package/dist/Modal.d.cts +96 -0
  168. package/dist/Modal.d.mts +3 -0
  169. package/dist/Modal.mjs +2 -0
  170. package/dist/NativeSelect.cjs +197 -0
  171. package/dist/NativeSelect.d.cts +65 -0
  172. package/dist/NativeSelect.d.mts +65 -0
  173. package/dist/NativeSelect.mjs +197 -0
  174. package/dist/NavTree.cjs +225 -0
  175. package/dist/NavTree.d.cts +65 -0
  176. package/dist/NavTree.d.mts +65 -0
  177. package/dist/NavTree.mjs +223 -0
  178. package/dist/NumberInput.cjs +513 -0
  179. package/dist/NumberInput.d.cts +96 -0
  180. package/dist/NumberInput.d.mts +96 -0
  181. package/dist/NumberInput.mjs +512 -0
  182. package/dist/Pagination.cjs +258 -0
  183. package/dist/Pagination.d.cts +90 -0
  184. package/dist/Pagination.d.mts +3 -0
  185. package/dist/Pagination.mjs +256 -0
  186. package/dist/Paper.cjs +54 -0
  187. package/dist/Paper.d.cts +2 -0
  188. package/dist/Paper.d.mts +3 -0
  189. package/dist/Paper.mjs +54 -0
  190. package/dist/Popover-DY0ooIAM.cjs +143 -0
  191. package/dist/Popover-DsPTeEPx.mjs +139 -0
  192. package/dist/Popover.cjs +4 -0
  193. package/dist/Popover.d.cts +67 -0
  194. package/dist/Popover.d.mts +67 -0
  195. package/dist/Popover.mjs +2 -0
  196. package/dist/Portal.cjs +22 -0
  197. package/dist/Portal.d.cts +15 -0
  198. package/dist/Portal.d.mts +2 -0
  199. package/dist/Portal.mjs +21 -0
  200. package/dist/Pressable.cjs +134 -0
  201. package/dist/Pressable.d.cts +52 -0
  202. package/dist/Pressable.d.mts +3 -0
  203. package/dist/Pressable.mjs +134 -0
  204. package/dist/Quote.cjs +11 -0
  205. package/dist/Quote.d.cts +15 -0
  206. package/dist/Quote.d.mts +15 -0
  207. package/dist/Quote.mjs +10 -0
  208. package/dist/Radio.cjs +161 -0
  209. package/dist/Radio.d.cts +43 -0
  210. package/dist/Radio.d.mts +43 -0
  211. package/dist/Radio.mjs +161 -0
  212. package/dist/RangeInput.cjs +705 -0
  213. package/dist/RangeInput.d.cts +77 -0
  214. package/dist/RangeInput.d.mts +77 -0
  215. package/dist/RangeInput.mjs +705 -0
  216. package/dist/Rating.cjs +390 -0
  217. package/dist/Rating.d.cts +59 -0
  218. package/dist/Rating.d.mts +59 -0
  219. package/dist/Rating.mjs +390 -0
  220. package/dist/ScrollArea.cjs +282 -0
  221. package/dist/ScrollArea.d.cts +40 -0
  222. package/dist/ScrollArea.d.mts +40 -0
  223. package/dist/ScrollArea.mjs +281 -0
  224. package/dist/Select.cjs +528 -0
  225. package/dist/Select.d.cts +69 -0
  226. package/dist/Select.d.mts +69 -0
  227. package/dist/Select.mjs +528 -0
  228. package/dist/Sidebar.cjs +332 -0
  229. package/dist/Sidebar.d.cts +156 -0
  230. package/dist/Sidebar.d.mts +156 -0
  231. package/dist/Sidebar.mjs +330 -0
  232. package/dist/Skeleton.cjs +90 -0
  233. package/dist/Skeleton.d.cts +24 -0
  234. package/dist/Skeleton.d.mts +24 -0
  235. package/dist/Skeleton.mjs +90 -0
  236. package/dist/Slide.cjs +51 -0
  237. package/dist/Slide.d.cts +14 -0
  238. package/dist/Slide.d.mts +14 -0
  239. package/dist/Slide.mjs +50 -0
  240. package/dist/Snackbar.cjs +216 -0
  241. package/dist/Snackbar.d.cts +81 -0
  242. package/dist/Snackbar.d.mts +81 -0
  243. package/dist/Snackbar.mjs +215 -0
  244. package/dist/StyleSheet.cjs +8 -0
  245. package/dist/StyleSheet.d.cts +2 -0
  246. package/dist/StyleSheet.d.mts +2 -0
  247. package/dist/StyleSheet.mjs +1 -0
  248. package/dist/Switch.cjs +355 -0
  249. package/dist/Switch.d.cts +45 -0
  250. package/dist/Switch.d.mts +45 -0
  251. package/dist/Switch.mjs +355 -0
  252. package/dist/Table.cjs +722 -0
  253. package/dist/Table.d.cts +404 -0
  254. package/dist/Table.d.mts +404 -0
  255. package/dist/Table.mjs +707 -0
  256. package/dist/Tabs.cjs +1227 -0
  257. package/dist/Tabs.d.cts +245 -0
  258. package/dist/Tabs.d.mts +245 -0
  259. package/dist/Tabs.mjs +1222 -0
  260. package/dist/TextInput.cjs +236 -0
  261. package/dist/TextInput.d.cts +82 -0
  262. package/dist/TextInput.d.mts +82 -0
  263. package/dist/TextInput.mjs +236 -0
  264. package/dist/ThemeProvider-DS6pBgE-.cjs +68 -0
  265. package/dist/ThemeProvider-DuhfCo2F.mjs +63 -0
  266. package/dist/ThemeProvider.cjs +4 -0
  267. package/dist/ThemeProvider.d.cts +2 -0
  268. package/dist/ThemeProvider.d.mts +2 -0
  269. package/dist/ThemeProvider.mjs +2 -0
  270. package/dist/ToggleButton.cjs +115 -0
  271. package/dist/ToggleButton.d.cts +51 -0
  272. package/dist/ToggleButton.d.mts +51 -0
  273. package/dist/ToggleButton.mjs +113 -0
  274. package/dist/Tooltip-DQo2zZH0.mjs +485 -0
  275. package/dist/Tooltip-DaB6bJKM.cjs +495 -0
  276. package/dist/Tooltip.cjs +5 -0
  277. package/dist/Tooltip.d.cts +122 -0
  278. package/dist/Tooltip.d.mts +122 -0
  279. package/dist/Tooltip.mjs +2 -0
  280. package/dist/TransferList.cjs +394 -0
  281. package/dist/TransferList.d.cts +69 -0
  282. package/dist/TransferList.d.mts +69 -0
  283. package/dist/TransferList.mjs +394 -0
  284. package/dist/Typography.cjs +69 -0
  285. package/dist/Typography.d.cts +30 -0
  286. package/dist/Typography.d.mts +3 -0
  287. package/dist/Typography.mjs +69 -0
  288. package/dist/View-BmuIFO7p.mjs +75 -0
  289. package/dist/View-DkfIBlcy.cjs +85 -0
  290. package/dist/View.cjs +3 -0
  291. package/dist/View.d.cts +2 -0
  292. package/dist/View.d.mts +2 -0
  293. package/dist/View.mjs +1 -0
  294. package/dist/Zoom.cjs +16 -0
  295. package/dist/Zoom.d.cts +7 -0
  296. package/dist/Zoom.d.mts +7 -0
  297. package/dist/Zoom.mjs +15 -0
  298. package/dist/catalog.cjs +22 -0
  299. package/dist/catalog.d.cts +28 -0
  300. package/dist/catalog.d.mts +28 -0
  301. package/dist/catalog.mjs +21 -0
  302. package/dist/computePopoverPosition-C6qSQ1QD.cjs +126 -0
  303. package/dist/computePopoverPosition-DHV1wQgJ.mjs +121 -0
  304. package/dist/computePopoverPosition-JgOwCM7k.d.cts +12 -0
  305. package/dist/computePopoverPosition-JgOwCM7k.d.mts +12 -0
  306. package/dist/css.cjs +20 -0
  307. package/dist/css.d.cts +2 -0
  308. package/dist/css.d.mts +2 -0
  309. package/dist/css.mjs +1 -0
  310. package/dist/derivedTheme-B0cxTzAq.cjs +29 -0
  311. package/dist/derivedTheme-BB9VVZ08.mjs +24 -0
  312. package/dist/engine.cjs +146 -0
  313. package/dist/engine.d.cts +59 -0
  314. package/dist/engine.d.mts +59 -0
  315. package/dist/engine.mjs +101 -0
  316. package/dist/getElementRef-4m6-x2FS.cjs +18 -0
  317. package/dist/getElementRef-SBx9_7pp.mjs +13 -0
  318. package/dist/index-B7LR7Up3.d.mts +175 -0
  319. package/dist/index-Bgd6kxq_.d.mts +43 -0
  320. package/dist/index-Blc3XujV.d.mts +52 -0
  321. package/dist/index-C21GrYkd.d.mts +96 -0
  322. package/dist/index-CA5HTpT9.d.mts +90 -0
  323. package/dist/index-CD0xu_P6.d.mts +92 -0
  324. package/dist/index-CEtnJkY4.d.cts +92 -0
  325. package/dist/index-CKHGDpGJ.d.mts +33 -0
  326. package/dist/index-CT311xS9.d.cts +175 -0
  327. package/dist/index-CWOcMPWz.d.mts +51 -0
  328. package/dist/index-CmG1wW5D.d.mts +38 -0
  329. package/dist/index-DZFF1vMV.d.cts +1114 -0
  330. package/dist/index-MfIvwyA4.d.mts +1 -0
  331. package/dist/index-Tg9lQlVl.d.mts +30 -0
  332. package/dist/index-UloRwym_.d.mts +16 -0
  333. package/dist/index.cjs +93 -0
  334. package/dist/index.d.cts +3 -0
  335. package/dist/index.d.mts +3 -0
  336. package/dist/index.mjs +17 -0
  337. package/dist/inputVariantStyles-B-4lHxUZ.mjs +41 -0
  338. package/dist/inputVariantStyles-CqCQatKb.cjs +58 -0
  339. package/dist/isRtl-DN-EdUlg.mjs +6 -0
  340. package/dist/isRtl-Dl6QQWib.cjs +11 -0
  341. package/dist/keyframes.cjs +8 -0
  342. package/dist/keyframes.d.cts +2 -0
  343. package/dist/keyframes.d.mts +2 -0
  344. package/dist/keyframes.mjs +1 -0
  345. package/dist/next.cjs +8 -0
  346. package/dist/next.d.cts +2 -0
  347. package/dist/next.d.mts +2 -0
  348. package/dist/next.mjs +1 -0
  349. package/dist/overrides-DeXScOFK.cjs +21 -0
  350. package/dist/overrides-Ds6QZL5Q.mjs +16 -0
  351. package/dist/server.cjs +19 -0
  352. package/dist/server.d.cts +10 -0
  353. package/dist/server.d.mts +10 -0
  354. package/dist/server.mjs +18 -0
  355. package/dist/styleEngine-CLid4cmR.mjs +1 -0
  356. package/dist/styled-DnzWP4pc.cjs +34 -0
  357. package/dist/styled-nr_qC_Yx.mjs +29 -0
  358. package/dist/styled.cjs +3 -0
  359. package/dist/styled.d.cts +2 -0
  360. package/dist/styled.d.mts +2 -0
  361. package/dist/styled.mjs +1 -0
  362. package/dist/testing.cjs +60 -0
  363. package/dist/testing.d.cts +6 -0
  364. package/dist/testing.d.mts +6 -0
  365. package/dist/testing.mjs +59 -0
  366. package/dist/themes-BtfQPcbo.mjs +8 -0
  367. package/dist/themes-k-PEE5O9.cjs +12 -0
  368. package/dist/useAnchoredPlacement-CSotv28V.cjs +116 -0
  369. package/dist/useAnchoredPlacement-VwHtXnAx.mjs +111 -0
  370. package/dist/useDefaultProps-BTQGhvfY.mjs +13 -0
  371. package/dist/useDefaultProps-DratGGIL.cjs +18 -0
  372. package/dist/useDefaultProps.cjs +3 -0
  373. package/dist/useDefaultProps.d.cts +2 -0
  374. package/dist/useDefaultProps.d.mts +2 -0
  375. package/dist/useDefaultProps.mjs +1 -0
  376. package/dist/useLiveValue-CN2SUG2B.cjs +20 -0
  377. package/dist/useLiveValue-CqiwCr56.mjs +15 -0
  378. package/dist/useMediaQuery-acJak9M3.mjs +2 -0
  379. package/dist/useMediaQuery.cjs +9 -0
  380. package/dist/useMediaQuery.d.cts +2 -0
  381. package/dist/useMediaQuery.d.mts +2 -0
  382. package/dist/useMediaQuery.mjs +2 -0
  383. package/dist/useStyle.cjs +14 -0
  384. package/dist/useStyle.d.cts +2 -0
  385. package/dist/useStyle.d.mts +2 -0
  386. package/dist/useStyle.mjs +1 -0
  387. package/dist/useTheme.cjs +8 -0
  388. package/dist/useTheme.d.cts +2 -0
  389. package/dist/useTheme.d.mts +2 -0
  390. package/dist/useTheme.mjs +1 -0
  391. package/dist/useTransition-B4KGUO9m.d.cts +40 -0
  392. package/dist/useTransition-BKBtk0Mb.mjs +78 -0
  393. package/dist/useTransition-BwpSHKSf.d.mts +40 -0
  394. package/dist/useTransition-gHFCJwqF.cjs +83 -0
  395. package/dist/useTransitionChild-C18w474Q.mjs +52 -0
  396. package/dist/useTransitionChild-DD3f44AQ.cjs +57 -0
  397. package/dist/utils-ChXrUitU.mjs +1 -0
  398. package/dist/withStyle.cjs +8 -0
  399. package/dist/withStyle.d.cts +2 -0
  400. package/dist/withStyle.d.mts +2 -0
  401. package/dist/withStyle.mjs +1 -0
  402. package/dist/withTheme.cjs +8 -0
  403. package/dist/withTheme.d.cts +2 -0
  404. package/dist/withTheme.d.mts +2 -0
  405. package/dist/withTheme.mjs +1 -0
  406. package/package.json +908 -3
@@ -0,0 +1,96 @@
1
+ import { Sa as SlotProps, cn as NumberInputSlot, ln as NumberInputThemeConfig, s as Theme, sn as NumberInputOwnerState, wa as StyleOverride } from "./Accordion.types-D06ViRMj.mjs";
2
+ import { ReactNode } from "react";
3
+ import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
4
+ export type NumberInputVariant = 'default' | 'outlined' | 'text' | 'underline';
5
+ export type NumberInputSpinButtons = 'stacked' | 'sides' | 'none';
6
+ export interface NumberInputProps extends SpaceProps, Pick<LayoutProps, 'width' | 'minWidth' | 'maxWidth'> {
7
+ /** The number - `null` for none. Controlled with `onChange`. */
8
+ value?: number | null;
9
+ /** The number at first, when uncontrolled. */
10
+ defaultValue?: number | null;
11
+ /** Fired as the number changes - as it is typed, stepped or cleared. */
12
+ onChange?: (value: number | null) => void;
13
+ /** Fired when the number is settled: on blur, Enter, a step or Home/End. */
14
+ onChangeCommitted?: (value: number | null) => void;
15
+ /** The least number - what is typed or stepped is clamped to it. */
16
+ min?: number;
17
+ /** The greatest number. */
18
+ max?: number;
19
+ /** What the arrow keys and the buttons step by. Default: `1`. */
20
+ step?: number;
21
+ /** The step with Alt held. Default: `0.1`. */
22
+ smallStep?: number;
23
+ /** The step with Shift held. Default: `10`. */
24
+ largeStep?: number;
25
+ /** How the number is shown - `Intl.NumberFormat` options. Default: every digit, ungrouped. */
26
+ format?: Intl.NumberFormatOptions;
27
+ /** How the number is written and read. Default: the document's. */
28
+ locale?: string;
29
+ /** A step lands on the grid of `step`, counted from `min` (or 0). Default: `false`. */
30
+ shouldSnapOnStep?: boolean;
31
+ /** The mouse wheel steps the number while the field is focused. Default: `false`. */
32
+ shouldScrubOnWheel?: boolean;
33
+ /** Where the step buttons are: stacked at the end, either side of the field, or none. Default: `'stacked'`. */
34
+ spinButtons?: NumberInputSpinButtons;
35
+ /** Names the increase button - no built-in text; a theme gives it through `defaultProps`. */
36
+ incrementLabel?: string;
37
+ /** Names the decrease button. */
38
+ decrementLabel?: string;
39
+ /** Content inside the frame before the number - an icon, a label. */
40
+ startContent?: ReactNode;
41
+ /** Content inside the frame after the number, before the step buttons - a unit such as `px` or `%`, a button. */
42
+ endContent?: ReactNode;
43
+ /** The frame: a box, an outline, an underline or none. Default: `theme.defaults.inputVariant`. */
44
+ variant?: NumberInputVariant;
45
+ /** Resolves against `theme.sizes`. Default: its `FormControl`'s, else `'md'`. */
46
+ size?: keyof Theme['sizes'];
47
+ /** The focus border color - resolves to `theme.palette`. Default: `'primary'`. */
48
+ color?: keyof Theme['palette'];
49
+ /** The number's color - resolves against `theme.text`. Default: `'primary'`. */
50
+ textColor?: keyof Theme['text'];
51
+ error?: boolean;
52
+ disabled?: boolean;
53
+ readOnly?: boolean;
54
+ required?: boolean;
55
+ fullWidth?: boolean;
56
+ /** What a form submits the number as. */
57
+ name?: string;
58
+ /** On the field, which a `FormLabel` targets. Default: its `FormControl`'s. */
59
+ id?: string;
60
+ placeholder?: string;
61
+ autoFocus?: boolean;
62
+ className?: string;
63
+ /** Overrides the CSS of the root: an entry of `StyleSheet.create`, or a list of them. It wins over `slotProps.root.style`. */
64
+ style?: StyleOverride;
65
+ /** Overrides for the slots a theme can style: `style`, `className`, `data-*` and `aria-*`. */
66
+ slotProps?: SlotProps<NumberInputSlot>;
67
+ 'aria-label'?: string;
68
+ 'aria-labelledby'?: string;
69
+ 'aria-describedby'?: string;
70
+ 'data-testid'?: string;
71
+ }
72
+ /**
73
+ * @description A field for a number: a text input - so what is typed is the user's until it is
74
+ * settled - that reads and writes the number in its locale, clamps it to `min`/`max`, and steps
75
+ * by the arrow keys, Home/End, the wheel and buttons that repeat while held. A
76
+ * `role="spinbutton"`, so the number and its range are announced; a hidden input carries the raw
77
+ * number to a form. In a `FormControl` it takes the field's size, color, error, disabled and
78
+ * required state, and its `FormLabel` targets the field.
79
+ */
80
+ export declare function NumberInput({ value, defaultValue, onChange, onChangeCommitted, min, max, step: stepProp, smallStep: smallStepProp, largeStep: largeStepProp, format, locale, shouldSnapOnStep: shouldSnapProp, shouldScrubOnWheel: shouldScrubProp, spinButtons: spinButtonsProp, incrementLabel: incrementLabelProp, decrementLabel: decrementLabelProp, variant: variantProp, size: sizeProp, color: colorProp, textColor: textColorProp, error: errorProp, disabled: disabledProp, readOnly, required: requiredProp, fullWidth: fullWidthProp, name, id: idProp, placeholder, autoFocus, startContent, endContent, className, style, slotProps, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...rest }: Readonly<NumberInputProps>): import("react").JSX.Element;
81
+ export interface UseHoldRepeatOptions {
82
+ /** How long a press is held before it starts to repeat, in milliseconds. Default: `400`. */
83
+ delay?: number;
84
+ /** The time between repeats once it has started, in milliseconds. Default: `60`. */
85
+ interval?: number;
86
+ }
87
+ /**
88
+ * Runs `action` at once on a press, then again and again while it is held - after a pause, so a
89
+ * tap is one step. `start` begins it, `stop` ends it, and it ends by itself when the component
90
+ * goes.
91
+ */
92
+ export declare function useHoldRepeat(action: () => void, { delay, interval }?: UseHoldRepeatOptions): {
93
+ start: () => void;
94
+ stop: () => void;
95
+ };
96
+ export { NumberInputOwnerState, NumberInputSlot, NumberInputThemeConfig };
@@ -0,0 +1,512 @@
1
+ "use client";
2
+ import { t as styled } from "./styled-nr_qC_Yx.mjs";
3
+ import "./themes-BtfQPcbo.mjs";
4
+ import { t as useDefaultProps } from "./useDefaultProps-BTQGhvfY.mjs";
5
+ import { _ as useTheme, i as alpha } from "./styleEngine-CLid4cmR.mjs";
6
+ import { useFormControl } from "./FormControl.mjs";
7
+ import { t as FormControlContext } from "./FormControlContext-CaQLS_sK.mjs";
8
+ import { t as Icon } from "./Icon-CpmLCuWc.mjs";
9
+ import { t as mergeOverrides } from "./overrides-Ds6QZL5Q.mjs";
10
+ import { n as getFocusRing, r as getInputMinWidth, t as inputVariantStyles } from "./inputVariantStyles-B-4lHxUZ.mjs";
11
+ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
12
+ import { themeDefault } from "@gild-ui/core/theme";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { addExact, clamp, getDecimalPrecision, snapToStep } from "@gild-ui/core/utils";
15
+ import { createShouldForwardProp, props } from "@soroush.tech/styled-system/should-forward-prop";
16
+ import { get, space, system } from "@soroush.tech/styled-system";
17
+ import { useControlled } from "@gild-ui/hooks/useControlled";
18
+ // src/NumberInput/hooks/useHoldRepeat.ts
19
+ /**
20
+ * Runs `action` at once on a press, then again and again while it is held - after a pause, so a
21
+ * tap is one step. `start` begins it, `stop` ends it, and it ends by itself when the component
22
+ * goes.
23
+ */
24
+ function useHoldRepeat(action, { delay = 400, interval = 60 } = {}) {
25
+ const actionRef = useRef(action);
26
+ useEffect(() => {
27
+ actionRef.current = action;
28
+ });
29
+ const timers = useRef({});
30
+ const stop = useCallback(() => {
31
+ window.clearTimeout(timers.current.pause);
32
+ window.clearInterval(timers.current.repeat);
33
+ timers.current = {};
34
+ }, []);
35
+ const start = useCallback(() => {
36
+ stop();
37
+ actionRef.current();
38
+ timers.current.pause = window.setTimeout(() => {
39
+ timers.current.repeat = window.setInterval(() => actionRef.current(), interval);
40
+ }, delay);
41
+ }, [
42
+ stop,
43
+ delay,
44
+ interval
45
+ ]);
46
+ useEffect(() => stop, [stop]);
47
+ return {
48
+ start,
49
+ stop
50
+ };
51
+ }
52
+ // src/NumberInput/utils/number.ts
53
+ /** What a number is shown as unless told otherwise: all its digits, ungrouped, so typing round-trips. */
54
+ const DEFAULT_FORMAT = {
55
+ useGrouping: false,
56
+ maximumFractionDigits: 20
57
+ };
58
+ /** The syntax a locale and format write a number in. */
59
+ function getNumberSyntax(locale, format) {
60
+ const probe = new Intl.NumberFormat(locale, {
61
+ useGrouping: false,
62
+ minimumFractionDigits: 1,
63
+ maximumFractionDigits: 1
64
+ });
65
+ const digitFormat = new Intl.NumberFormat(locale, { useGrouping: false });
66
+ return {
67
+ decimal: probe.formatToParts(1.1).find((part) => part.type === "decimal").value,
68
+ digits: Array.from({ length: 10 }, (_, digit) => digitFormat.format(digit)),
69
+ isPercent: format?.style === "percent"
70
+ };
71
+ }
72
+ /** The number as its locale and format write it. */
73
+ function formatNumber(value, locale, format) {
74
+ return new Intl.NumberFormat(locale, {
75
+ ...DEFAULT_FORMAT,
76
+ ...format
77
+ }).format(value);
78
+ }
79
+ const MINUS = new RegExp(`[${[
80
+ 8722,
81
+ 8210,
82
+ 8211,
83
+ 8212
84
+ ].map((code) => String.fromCodePoint(code)).join("")}]`, "g");
85
+ /**
86
+ * The number a text stands for - `null` when it stands for none: its locale's digits and decimal
87
+ * mark, a leading minus, a percent's `%` (so `50%` is `0.5`). Group marks, spaces and symbols
88
+ * round it are ignored.
89
+ */
90
+ function parseNumber(text, syntax) {
91
+ let normalized = text.replace(MINUS, "-");
92
+ syntax.digits.forEach((digit, index) => {
93
+ normalized = normalized.split(digit).join(String(index));
94
+ });
95
+ const isNegative = normalized.includes("-");
96
+ const [whole = "", ...fraction] = normalized.split(syntax.decimal);
97
+ const digits = (text) => text.replaceAll(/\D/g, "");
98
+ const wholeDigits = digits(whole);
99
+ const fractionDigits = fraction.map(digits).join("");
100
+ if (wholeDigits === "" && fractionDigits === "") return null;
101
+ const parsed = Number(`${wholeDigits || "0"}.${fractionDigits || "0"}`);
102
+ const signed = isNegative ? -parsed : parsed;
103
+ return syntax.isPercent ? Number((signed / 100).toFixed(getDecimalPrecision(parsed) + 2)) : signed;
104
+ }
105
+ // src/NumberInput/hooks/useNumberInput.ts
106
+ const clampTo = (value, min, max) => clamp(value, min ?? Number.NEGATIVE_INFINITY, max ?? Number.POSITIVE_INFINITY);
107
+ /**
108
+ * A number field's state: the number (controlled or not), the text the user is typing - which
109
+ * is theirs until it is committed on blur or Enter - and the steps by key and by button. A
110
+ * number typed is told at once; one outside the range is clamped when it is committed.
111
+ */
112
+ function useNumberInput({ value: valueProp, defaultValue, onChange, onChangeCommitted, min, max, step, smallStep, largeStep, format, locale, shouldSnapOnStep, isFrozen }) {
113
+ const [value, setValue] = useControlled({
114
+ controlled: valueProp,
115
+ default: defaultValue ?? null
116
+ });
117
+ const [draft, setDraft] = useState(null);
118
+ const syntax = useMemo(() => getNumberSyntax(locale, format), [locale, format]);
119
+ const text = draft ?? (value === null ? "" : formatNumber(value, locale, format));
120
+ const update = (next) => {
121
+ if (next === value) return;
122
+ setValue(next);
123
+ onChange?.(next);
124
+ };
125
+ const handleChange = (event) => {
126
+ const typed = event.currentTarget.value;
127
+ setDraft(typed);
128
+ if (typed.trim() === "") return update(null);
129
+ const parsed = parseNumber(typed, syntax);
130
+ if (parsed !== null) update(parsed);
131
+ };
132
+ const settle = () => {
133
+ if (draft === null) return value;
134
+ if (draft.trim() === "") return null;
135
+ const parsed = parseNumber(draft, syntax);
136
+ return parsed === null ? value : clampTo(parsed, min, max);
137
+ };
138
+ const commit = (next) => {
139
+ setDraft(null);
140
+ update(next);
141
+ onChangeCommitted?.(next);
142
+ };
143
+ const handleBlur = () => {
144
+ if (draft !== null) commit(settle());
145
+ };
146
+ const stepBy = (direction, size = step) => {
147
+ if (isFrozen) return;
148
+ const base = settle() ?? 0;
149
+ let next = addExact(base, direction * size);
150
+ if (shouldSnapOnStep) next = snapToStep(next, step, min ?? 0);
151
+ commit(clampTo(next, min, max));
152
+ };
153
+ const handleKeyDown = (event) => {
154
+ if (isFrozen) return;
155
+ const { key, altKey, shiftKey } = event;
156
+ if (key === "Enter") return commit(settle());
157
+ if (key === "ArrowUp" || key === "ArrowDown") {
158
+ event.preventDefault();
159
+ let size = step;
160
+ if (altKey) size = smallStep;
161
+ if (shiftKey) size = largeStep;
162
+ return stepBy(key === "ArrowUp" ? 1 : -1, size);
163
+ }
164
+ const edge = key === "Home" ? min : max;
165
+ if ((key === "Home" || key === "End") && edge !== void 0) {
166
+ event.preventDefault();
167
+ commit(edge);
168
+ }
169
+ };
170
+ return {
171
+ text,
172
+ value,
173
+ canIncrement: !isFrozen && (max === void 0 || (value ?? Number.NEGATIVE_INFINITY) < max),
174
+ canDecrement: !isFrozen && (min === void 0 || (value ?? Number.POSITIVE_INFINITY) > min),
175
+ handleChange,
176
+ handleBlur,
177
+ handleKeyDown,
178
+ stepBy
179
+ };
180
+ }
181
+ // src/NumberInput/hooks/useWheelStep.ts
182
+ /**
183
+ * Steps a focused field by the mouse wheel - up for a wheel up. A native listener, since the
184
+ * page must not scroll as it turns, and a React one can't prevent that.
185
+ */
186
+ function useWheelStep(ref, isEnabled, onStep) {
187
+ const stepRef = useRef(onStep);
188
+ useEffect(() => {
189
+ stepRef.current = onStep;
190
+ });
191
+ useEffect(() => {
192
+ const element = ref.current;
193
+ if (!isEnabled || !element) return void 0;
194
+ const handleWheel = (event) => {
195
+ if (element.ownerDocument.activeElement !== element) return;
196
+ event.preventDefault();
197
+ stepRef.current(event.deltaY < 0 ? 1 : -1);
198
+ };
199
+ element.addEventListener("wheel", handleWheel, { passive: false });
200
+ return () => element.removeEventListener("wheel", handleWheel);
201
+ }, [ref, isEnabled]);
202
+ }
203
+ // src/NumberInput/NumberInput.tsx
204
+ const widthStyles = system({
205
+ width: true,
206
+ minWidth: true,
207
+ maxWidth: true
208
+ });
209
+ const frameStyle = ({ theme, color, textColor, isError, isDisabled, isFullWidth, isInField }) => {
210
+ const main = get(theme, `palette.${color}.main`);
211
+ const border = isError ? get(theme, "palette.error.main") : get(theme, `palette.${color}.light`);
212
+ const focusBorder = isError ? get(theme, "palette.error.main") : main;
213
+ return {
214
+ display: isFullWidth || isInField ? "flex" : "inline-flex",
215
+ ...isFullWidth && { width: "100%" },
216
+ ...isInField && !isFullWidth && { width: "fit-content" },
217
+ minWidth: getInputMinWidth(theme),
218
+ alignItems: "stretch",
219
+ transition: "border-color 0.15s ease",
220
+ backgroundColor: get(theme, `background.${themeDefault(theme, "inputBg", "terminal")}`),
221
+ color: textColor ? get(theme, `text.${textColor}`) : get(theme, `palette.${color}.main`),
222
+ fontFamily: get(theme, "fonts.body"),
223
+ lineHeight: get(theme, "lineHeights.base"),
224
+ borderColor: border,
225
+ "&:focus-within": { borderColor: focusBorder },
226
+ "&:has(:focus-visible)": getFocusRing(theme, color, isError),
227
+ ...isDisabled && {
228
+ opacity: .5,
229
+ cursor: "not-allowed",
230
+ pointerEvents: "none"
231
+ }
232
+ };
233
+ };
234
+ const NumberInputRoot = styled("div", {
235
+ name: "NumberInput",
236
+ label: "NumberInput",
237
+ shouldForwardProp: createShouldForwardProp([
238
+ ...props,
239
+ "color",
240
+ "textColor",
241
+ "variant",
242
+ "isError",
243
+ "isDisabled",
244
+ "isFullWidth",
245
+ "isInField"
246
+ ]),
247
+ systemProps: [space, widthStyles]
248
+ })(inputVariantStyles, frameStyle);
249
+ const NumberInputInput = styled("input", {
250
+ name: "NumberInput",
251
+ slot: "input",
252
+ label: "NumberInputInput",
253
+ shouldForwardProp: createShouldForwardProp(["sizeToken", "isCentered"])
254
+ })(({ theme, sizeToken, isCentered }) => {
255
+ const s = theme.sizes[sizeToken];
256
+ return {
257
+ flex: "1 1 0",
258
+ minWidth: 0,
259
+ width: 0,
260
+ border: "none",
261
+ outline: "none",
262
+ background: "transparent",
263
+ color: "inherit",
264
+ fontFamily: "inherit",
265
+ lineHeight: "inherit",
266
+ textAlign: isCentered ? "center" : "start",
267
+ paddingTop: theme.space[s.paddingTop],
268
+ paddingBottom: theme.space[s.paddingBottom],
269
+ paddingLeft: theme.space[s.paddingLeft],
270
+ paddingRight: theme.space[s.paddingRight],
271
+ fontSize: theme.fontSizes[s.fontSize],
272
+ "&::placeholder": {
273
+ color: "inherit",
274
+ opacity: .5
275
+ },
276
+ "&:disabled": { cursor: "not-allowed" }
277
+ };
278
+ });
279
+ const NumberInputContent = styled("span", {
280
+ name: "NumberInput",
281
+ slot: "content",
282
+ label: "NumberInputContent",
283
+ shouldForwardProp: createShouldForwardProp(["edge", "sizeToken"])
284
+ })(({ theme, edge, sizeToken }) => {
285
+ const s = theme.sizes[sizeToken];
286
+ return {
287
+ display: "inline-flex",
288
+ alignItems: "center",
289
+ flexShrink: 0,
290
+ gap: theme.space[.5],
291
+ color: "inherit",
292
+ ...edge === "start" ? { paddingInlineStart: theme.space[s.paddingLeft] } : { paddingInlineEnd: theme.space[s.paddingRight] }
293
+ };
294
+ });
295
+ const NumberInputSpinButtons = styled("span", {
296
+ name: "NumberInput",
297
+ slot: "spinButtons",
298
+ label: "NumberInputSpinButtons"
299
+ })(({ theme }) => ({
300
+ display: "flex",
301
+ flexDirection: "column",
302
+ borderInlineStart: `${theme.borderWidths.thin} solid`,
303
+ borderColor: "inherit"
304
+ }));
305
+ const spinStyle = ({ theme, color, isSide }) => {
306
+ const main = get(theme, `palette.${color}.main`);
307
+ return {
308
+ appearance: "none",
309
+ display: "grid",
310
+ placeItems: "center",
311
+ flex: isSide ? "0 0 auto" : "1 1 0px",
312
+ ...!isSide && { minHeight: 0 },
313
+ minWidth: isSide ? theme.space[5] : theme.icon.lg,
314
+ padding: 0,
315
+ border: "none",
316
+ background: "transparent",
317
+ color: "inherit",
318
+ cursor: "pointer",
319
+ "&:hover:not(:disabled)": { backgroundColor: alpha(main, .12) },
320
+ "&:disabled": {
321
+ opacity: .4,
322
+ cursor: "default"
323
+ }
324
+ };
325
+ };
326
+ const spinProps = createShouldForwardProp(["color", "isSide"]);
327
+ const sideDivider = (edge) => {
328
+ return ({ theme, isSide }) => isSide ? {
329
+ [edge]: `${theme.borderWidths.thin} solid`,
330
+ borderColor: "inherit"
331
+ } : {};
332
+ };
333
+ const NumberInputIncrement = styled("button", {
334
+ name: "NumberInput",
335
+ slot: "increment",
336
+ label: "NumberInputIncrement",
337
+ shouldForwardProp: spinProps
338
+ })(spinStyle, sideDivider("borderInlineStart"));
339
+ const NumberInputDecrement = styled("button", {
340
+ name: "NumberInput",
341
+ slot: "decrement",
342
+ label: "NumberInputDecrement",
343
+ shouldForwardProp: spinProps
344
+ })(spinStyle, sideDivider("borderInlineEnd"));
345
+ const getSpinIcon = (direction, isSide) => {
346
+ if (isSide) return direction === 1 ? "add" : "remove";
347
+ return direction === 1 ? "expand_less" : "expand_more";
348
+ };
349
+ function SpinButton({ direction, label, isSide, isDisabled, color, size, onStep, slot }) {
350
+ const hold = useHoldRepeat(() => onStep(direction));
351
+ const { stop } = hold;
352
+ useEffect(() => {
353
+ if (isDisabled) stop();
354
+ }, [isDisabled, stop]);
355
+ return /* @__PURE__ */ jsx(direction === 1 ? NumberInputIncrement : NumberInputDecrement, {
356
+ ...slot,
357
+ type: "button",
358
+ tabIndex: -1,
359
+ "aria-label": label,
360
+ disabled: isDisabled,
361
+ color,
362
+ isSide,
363
+ onMouseDown: (event) => event.preventDefault(),
364
+ onPointerDown: (event) => event.button === 0 && hold.start(),
365
+ onPointerUp: hold.stop,
366
+ onPointerLeave: hold.stop,
367
+ onPointerCancel: hold.stop,
368
+ onClick: (event) => event.detail === 0 && onStep(direction),
369
+ children: /* @__PURE__ */ jsx(Icon, {
370
+ name: getSpinIcon(direction, isSide),
371
+ size,
372
+ color: "inherit"
373
+ })
374
+ });
375
+ }
376
+ /**
377
+ * @description A field for a number: a text input - so what is typed is the user's until it is
378
+ * settled - that reads and writes the number in its locale, clamps it to `min`/`max`, and steps
379
+ * by the arrow keys, Home/End, the wheel and buttons that repeat while held. A
380
+ * `role="spinbutton"`, so the number and its range are announced; a hidden input carries the raw
381
+ * number to a form. In a `FormControl` it takes the field's size, color, error, disabled and
382
+ * required state, and its `FormLabel` targets the field.
383
+ */
384
+ function NumberInput({ value, defaultValue, onChange, onChangeCommitted, min, max, step: stepProp, smallStep: smallStepProp, largeStep: largeStepProp, format, locale, shouldSnapOnStep: shouldSnapProp, shouldScrubOnWheel: shouldScrubProp, spinButtons: spinButtonsProp, incrementLabel: incrementLabelProp, decrementLabel: decrementLabelProp, variant: variantProp, size: sizeProp, color: colorProp, textColor: textColorProp, error: errorProp, disabled: disabledProp, readOnly = false, required: requiredProp, fullWidth: fullWidthProp, name, id: idProp, placeholder, autoFocus, startContent, endContent, className, style, slotProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...rest }) {
385
+ const theme = useTheme();
386
+ const dp = useDefaultProps("NumberInput");
387
+ const isInField = useContext(FormControlContext) !== null;
388
+ const fc = useFormControl({
389
+ id: idProp,
390
+ error: errorProp,
391
+ disabled: disabledProp,
392
+ required: requiredProp,
393
+ size: sizeProp ?? dp.size,
394
+ fullWidth: fullWidthProp,
395
+ color: colorProp ?? dp.color,
396
+ textColor: textColorProp
397
+ });
398
+ const color = fc.color ?? themeDefault(theme, "color", "primary");
399
+ const textColor = fc.textColor;
400
+ const variant = variantProp ?? dp.variant ?? themeDefault(theme, "inputVariant", "default");
401
+ const spinButtons = spinButtonsProp ?? dp.spinButtons ?? "stacked";
402
+ const step = stepProp ?? dp.step ?? 1;
403
+ const isFrozen = fc.disabled || readOnly;
404
+ const field = useNumberInput({
405
+ value,
406
+ defaultValue,
407
+ onChange,
408
+ onChangeCommitted,
409
+ min,
410
+ max,
411
+ step,
412
+ smallStep: smallStepProp ?? dp.smallStep ?? .1,
413
+ largeStep: largeStepProp ?? dp.largeStep ?? 10,
414
+ format,
415
+ locale,
416
+ shouldSnapOnStep: shouldSnapProp ?? dp.shouldSnapOnStep ?? false,
417
+ isFrozen
418
+ });
419
+ const inputRef = useRef(null);
420
+ useWheelStep(inputRef, shouldScrubProp ?? dp.shouldScrubOnWheel ?? false, field.stepBy);
421
+ const isSide = spinButtons === "sides";
422
+ const buttonProps = {
423
+ isSide,
424
+ color,
425
+ size: fc.size,
426
+ onStep: field.stepBy
427
+ };
428
+ const decrement = /* @__PURE__ */ jsx(SpinButton, {
429
+ direction: -1,
430
+ label: decrementLabelProp ?? dp.decrementLabel,
431
+ slot: slotProps?.decrement,
432
+ isDisabled: !field.canDecrement,
433
+ ...buttonProps
434
+ });
435
+ const increment = /* @__PURE__ */ jsx(SpinButton, {
436
+ direction: 1,
437
+ label: incrementLabelProp ?? dp.incrementLabel,
438
+ slot: slotProps?.increment,
439
+ isDisabled: !field.canIncrement,
440
+ ...buttonProps
441
+ });
442
+ const inputMode = (min ?? -1) >= 0 && Number.isInteger(step) ? "numeric" : "decimal";
443
+ return /* @__PURE__ */ jsxs(NumberInputRoot, {
444
+ color,
445
+ textColor,
446
+ variant,
447
+ isError: fc.error,
448
+ isDisabled: fc.disabled,
449
+ isFullWidth: fc.fullWidth,
450
+ isInField,
451
+ ...mergeOverrides(slotProps?.root, {
452
+ style,
453
+ className
454
+ }),
455
+ "data-testid": dataTestid,
456
+ ...rest,
457
+ children: [
458
+ isSide && decrement,
459
+ startContent != null && /* @__PURE__ */ jsx(NumberInputContent, {
460
+ ...slotProps?.content,
461
+ edge: "start",
462
+ sizeToken: fc.size,
463
+ children: startContent
464
+ }),
465
+ /* @__PURE__ */ jsx(NumberInputInput, {
466
+ ...slotProps?.input,
467
+ ref: inputRef,
468
+ type: "text",
469
+ role: "spinbutton",
470
+ inputMode,
471
+ autoComplete: "off",
472
+ id: fc.id,
473
+ value: field.text,
474
+ placeholder,
475
+ autoFocus,
476
+ disabled: fc.disabled,
477
+ readOnly,
478
+ required: fc.required,
479
+ sizeToken: fc.size,
480
+ isCentered: isSide,
481
+ "aria-valuenow": field.value ?? void 0,
482
+ "aria-valuemin": min,
483
+ "aria-valuemax": max,
484
+ "aria-label": ariaLabel,
485
+ "aria-labelledby": ariaLabelledby,
486
+ "aria-describedby": ariaDescribedby ?? fc["aria-describedby"],
487
+ "aria-invalid": fc.error || void 0,
488
+ onChange: field.handleChange,
489
+ onBlur: field.handleBlur,
490
+ onKeyDown: field.handleKeyDown
491
+ }),
492
+ name !== void 0 && /* @__PURE__ */ jsx("input", {
493
+ type: "hidden",
494
+ name,
495
+ value: field.value ?? "",
496
+ disabled: fc.disabled
497
+ }),
498
+ endContent != null && /* @__PURE__ */ jsx(NumberInputContent, {
499
+ ...slotProps?.content,
500
+ edge: "end",
501
+ sizeToken: fc.size,
502
+ children: endContent
503
+ }),
504
+ spinButtons === "stacked" && /* @__PURE__ */ jsxs(NumberInputSpinButtons, {
505
+ ...slotProps?.spinButtons,
506
+ children: [increment, decrement]
507
+ }),
508
+ isSide && increment
509
+ ]
510
+ });
511
+ }
512
+ export { NumberInput, useHoldRepeat };