@soroush.tech/design-system 2.0.0-rc.2 → 2.0.0-rc.3

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 (267) hide show
  1. package/README.md +14 -10
  2. package/dist/AppBar.d.cts +1 -1
  3. package/dist/AppBar.d.mts +1 -1
  4. package/dist/Avatar.d.cts +1 -1
  5. package/dist/Avatar.d.mts +1 -1
  6. package/dist/Backdrop.d.cts +1 -1
  7. package/dist/Backdrop.d.mts +1 -1
  8. package/dist/Breadcrumbs.cjs +1 -1
  9. package/dist/Breadcrumbs.d.cts +3 -3
  10. package/dist/Breadcrumbs.d.mts +3 -3
  11. package/dist/Breadcrumbs.mjs +1 -1
  12. package/dist/Button.d.cts +1 -1
  13. package/dist/Button.d.mts +1 -1
  14. package/dist/ButtonGroup.d.cts +1 -1
  15. package/dist/ButtonGroup.d.mts +1 -1
  16. package/dist/Card.cjs +1 -1
  17. package/dist/Card.d.cts +4 -4
  18. package/dist/Card.d.mts +4 -4
  19. package/dist/Card.mjs +1 -1
  20. package/dist/Checkbox.d.cts +1 -1
  21. package/dist/Checkbox.d.mts +1 -1
  22. package/dist/CircularProgress.d.cts +2 -2
  23. package/dist/CircularProgress.d.mts +2 -2
  24. package/dist/Drawer.d.cts +3 -3
  25. package/dist/Drawer.d.mts +3 -3
  26. package/dist/Flex.d.cts +1 -1
  27. package/dist/Flex.d.mts +1 -1
  28. package/dist/Form.d.cts +1 -1
  29. package/dist/Form.d.mts +1 -1
  30. package/dist/FormControl.cjs +9 -1
  31. package/dist/FormControl.d.cts +9 -1
  32. package/dist/FormControl.d.mts +9 -1
  33. package/dist/FormControl.mjs +9 -1
  34. package/dist/FormHelperText.d.cts +1 -1
  35. package/dist/FormHelperText.d.mts +1 -1
  36. package/dist/FormLabel.cjs +9 -1
  37. package/dist/FormLabel.d.cts +2 -2
  38. package/dist/FormLabel.d.mts +2 -2
  39. package/dist/FormLabel.mjs +10 -2
  40. package/dist/Grid.d.cts +1 -1
  41. package/dist/Grid.d.mts +1 -1
  42. package/dist/{Icon-DlheCTJb.mjs → Icon-BihOAP4u.mjs} +40 -0
  43. package/dist/{Icon-Cvuhp9ek.cjs → Icon-D-EWsBVg.cjs} +40 -0
  44. package/dist/Icon.cjs +1 -1
  45. package/dist/Icon.d.cts +1 -1
  46. package/dist/Icon.d.mts +1 -1
  47. package/dist/Icon.mjs +1 -1
  48. package/dist/Image.d.cts +1 -1
  49. package/dist/Image.d.mts +1 -1
  50. package/dist/InputRange.cjs +675 -0
  51. package/dist/InputRange.d.cts +79 -0
  52. package/dist/InputRange.d.mts +79 -0
  53. package/dist/InputRange.mjs +673 -0
  54. package/dist/LinearProgress.d.cts +2 -2
  55. package/dist/LinearProgress.d.mts +2 -2
  56. package/dist/Link.d.cts +1 -1
  57. package/dist/Link.d.mts +1 -1
  58. package/dist/Menu/ContextMenu.cjs +1 -1
  59. package/dist/Menu/ContextMenu.d.cts +5 -5
  60. package/dist/Menu/ContextMenu.d.mts +5 -5
  61. package/dist/Menu/ContextMenu.mjs +1 -1
  62. package/dist/Menu/Menu.cjs +1 -1
  63. package/dist/Menu/Menu.d.cts +1 -1
  64. package/dist/Menu/Menu.d.mts +1 -1
  65. package/dist/Menu/Menu.mjs +1 -1
  66. package/dist/Menu/MenuItems.cjs +1 -1
  67. package/dist/Menu/MenuItems.d.cts +1 -1
  68. package/dist/Menu/MenuItems.d.mts +1 -1
  69. package/dist/Menu/MenuItems.mjs +1 -1
  70. package/dist/Menu/MenuList.d.cts +2 -2
  71. package/dist/Menu/MenuList.d.mts +2 -2
  72. package/dist/{Menu-BkKPTOfh.cjs → Menu-Cgg-sX4W.cjs} +3 -2
  73. package/dist/{Menu-tECbAEFj.mjs → Menu-CrzHc_cn.mjs} +2 -1
  74. package/dist/Menu.cjs +1 -1
  75. package/dist/Menu.d.cts +3 -3
  76. package/dist/Menu.d.mts +3 -3
  77. package/dist/Menu.mjs +1 -1
  78. package/dist/{MenuItem-CfdN4axw.cjs → MenuItem-BTP7Ijwi.cjs} +6 -17
  79. package/dist/{MenuItem-BR7ingQx.mjs → MenuItem-DUn4IZKK.mjs} +3 -8
  80. package/dist/MenuItem.cjs +1 -1
  81. package/dist/MenuItem.d.cts +1 -1
  82. package/dist/MenuItem.d.mts +1 -1
  83. package/dist/MenuItem.mjs +1 -1
  84. package/dist/{MenuListContext-Dml16k0X.d.mts → MenuListContext-DKUOhNyw.d.cts} +2 -2
  85. package/dist/{MenuListContext-vujGcRk9.d.cts → MenuListContext-x-7lH4CH.d.mts} +2 -2
  86. package/dist/Modal.d.cts +1 -1
  87. package/dist/Modal.d.mts +1 -1
  88. package/dist/NativeSelect.cjs +8 -7
  89. package/dist/NativeSelect.d.cts +3 -3
  90. package/dist/NativeSelect.d.mts +3 -3
  91. package/dist/NativeSelect.mjs +8 -7
  92. package/dist/NumberField.cjs +476 -0
  93. package/dist/NumberField.d.cts +74 -0
  94. package/dist/NumberField.d.mts +74 -0
  95. package/dist/NumberField.mjs +474 -0
  96. package/dist/Pagination/PaginationItem.cjs +1 -1
  97. package/dist/Pagination/PaginationItem.d.cts +1 -1
  98. package/dist/Pagination/PaginationItem.d.mts +1 -1
  99. package/dist/Pagination/PaginationItem.mjs +1 -1
  100. package/dist/Pagination.d.cts +2 -2
  101. package/dist/Pagination.d.mts +2 -2
  102. package/dist/Paper.d.cts +2 -2
  103. package/dist/Paper.d.mts +2 -2
  104. package/dist/Popover.d.cts +3 -3
  105. package/dist/Popover.d.mts +3 -3
  106. package/dist/Pressable.d.cts +1 -1
  107. package/dist/Pressable.d.mts +1 -1
  108. package/dist/Quote.d.cts +2 -2
  109. package/dist/Quote.d.mts +2 -2
  110. package/dist/Radio.d.cts +1 -1
  111. package/dist/Radio.d.mts +1 -1
  112. package/dist/Rating.cjs +373 -0
  113. package/dist/Rating.d.cts +57 -0
  114. package/dist/Rating.d.mts +57 -0
  115. package/dist/Rating.mjs +371 -0
  116. package/dist/Select.cjs +3 -2
  117. package/dist/Select.d.cts +3 -3
  118. package/dist/Select.d.mts +3 -3
  119. package/dist/Select.mjs +5 -4
  120. package/dist/Sidebar/Sidebar.d.cts +1 -1
  121. package/dist/Sidebar/Sidebar.d.mts +1 -1
  122. package/dist/Sidebar/SidebarItem.cjs +1 -1
  123. package/dist/Sidebar/SidebarItem.d.cts +3 -3
  124. package/dist/Sidebar/SidebarItem.d.mts +3 -3
  125. package/dist/Sidebar/SidebarItem.mjs +3 -3
  126. package/dist/Skeleton.d.cts +1 -1
  127. package/dist/Skeleton.d.mts +1 -1
  128. package/dist/Switch.cjs +22 -15
  129. package/dist/Switch.d.cts +2 -2
  130. package/dist/Switch.d.mts +2 -2
  131. package/dist/Switch.mjs +24 -17
  132. package/dist/Table/Table.d.cts +2 -2
  133. package/dist/Table/Table.d.mts +2 -2
  134. package/dist/Table/TableBody.d.cts +1 -1
  135. package/dist/Table/TableBody.d.mts +1 -1
  136. package/dist/Table/TableCell.d.cts +1 -1
  137. package/dist/Table/TableCell.d.mts +1 -1
  138. package/dist/Table/TableContainer.d.cts +1 -1
  139. package/dist/Table/TableContainer.d.mts +1 -1
  140. package/dist/Table/TableControl.d.cts +1 -1
  141. package/dist/Table/TableControl.d.mts +1 -1
  142. package/dist/Table/TableControl.mjs +2 -2
  143. package/dist/Table/TableFooter.d.cts +1 -1
  144. package/dist/Table/TableFooter.d.mts +1 -1
  145. package/dist/Table/TableHead.d.cts +1 -1
  146. package/dist/Table/TableHead.d.mts +1 -1
  147. package/dist/Table/TablePagination.d.cts +2 -2
  148. package/dist/Table/TablePagination.d.mts +2 -2
  149. package/dist/Table/TablePaginationActions.d.cts +1 -1
  150. package/dist/Table/TablePaginationActions.d.mts +1 -1
  151. package/dist/Table/TableRow.d.cts +1 -1
  152. package/dist/Table/TableRow.d.mts +1 -1
  153. package/dist/Table/TableSortLabel.cjs +1 -1
  154. package/dist/Table/TableSortLabel.d.cts +1 -1
  155. package/dist/Table/TableSortLabel.d.mts +1 -1
  156. package/dist/Table/TableSortLabel.mjs +1 -1
  157. package/dist/Table/hooks.d.cts +1 -1
  158. package/dist/Table/hooks.d.mts +1 -1
  159. package/dist/Table.d.cts +5 -5
  160. package/dist/Table.d.mts +5 -5
  161. package/dist/{TableContext-6PgGpUzM.d.mts → TableContext-DhuRf6Wy.d.mts} +1 -1
  162. package/dist/{TableContext-CBGk-Lh8.d.cts → TableContext-Duj1nVG7.d.cts} +1 -1
  163. package/dist/Tabs/Tab.cjs +1 -1
  164. package/dist/Tabs/Tab.d.cts +2 -2
  165. package/dist/Tabs/Tab.d.mts +2 -2
  166. package/dist/Tabs/Tab.mjs +1 -1
  167. package/dist/Tabs/TabContext.d.cts +1 -1
  168. package/dist/Tabs/TabContext.d.mts +1 -1
  169. package/dist/Tabs/TabList.cjs +1 -1
  170. package/dist/Tabs/TabList.d.cts +1 -1
  171. package/dist/Tabs/TabList.d.mts +1 -1
  172. package/dist/Tabs/TabList.mjs +1 -1
  173. package/dist/Tabs/TabPanel.d.cts +2 -2
  174. package/dist/Tabs/TabPanel.d.mts +2 -2
  175. package/dist/Tabs/TabScrollButton.cjs +1 -1
  176. package/dist/Tabs/TabScrollButton.d.cts +1 -1
  177. package/dist/Tabs/TabScrollButton.d.mts +1 -1
  178. package/dist/Tabs/TabScrollButton.mjs +1 -1
  179. package/dist/Tabs/Tabs.cjs +1 -1
  180. package/dist/Tabs/Tabs.d.cts +2 -2
  181. package/dist/Tabs/Tabs.d.mts +2 -2
  182. package/dist/Tabs/Tabs.mjs +1 -1
  183. package/dist/{Tabs-YfCUbkQV.mjs → Tabs-BTNOJx5v.mjs} +4 -3
  184. package/dist/{Tabs-D_wkX-Jb.cjs → Tabs-D4tWCq78.cjs} +7 -6
  185. package/dist/Tabs.cjs +1 -1
  186. package/dist/Tabs.d.cts +3 -3
  187. package/dist/Tabs.d.mts +3 -3
  188. package/dist/Tabs.mjs +1 -1
  189. package/dist/{TabsContext-C2agsLBN.d.cts → TabsContext-B_XHbjcS.d.cts} +1 -1
  190. package/dist/{TabsContext-DqyxdmGW.d.mts → TabsContext-Dn2kqUwr.d.mts} +1 -1
  191. package/dist/TextInput.cjs +3 -3
  192. package/dist/TextInput.d.cts +2 -2
  193. package/dist/TextInput.d.mts +2 -2
  194. package/dist/TextInput.mjs +3 -3
  195. package/dist/ToggleButton/ToggleButton.d.cts +1 -1
  196. package/dist/ToggleButton/ToggleButton.d.mts +1 -1
  197. package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
  198. package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
  199. package/dist/TransferList.cjs +356 -0
  200. package/dist/TransferList.d.cts +67 -0
  201. package/dist/TransferList.d.mts +67 -0
  202. package/dist/TransferList.mjs +354 -0
  203. package/dist/Typography.d.cts +2 -2
  204. package/dist/Typography.d.mts +2 -2
  205. package/dist/View.d.cts +1 -1
  206. package/dist/View.d.mts +1 -1
  207. package/dist/catalog.cjs +476 -18
  208. package/dist/catalog.d.cts +1 -1
  209. package/dist/catalog.d.mts +1 -1
  210. package/dist/catalog.mjs +476 -18
  211. package/dist/engine.d.cts +1 -1
  212. package/dist/engine.d.mts +1 -1
  213. package/dist/{index-DCmH5f9I.d.cts → index-B1RFybA_.d.mts} +2 -2
  214. package/dist/{index-Cj5Rhh_9.d.mts → index-B4TeaB7b.d.cts} +2 -2
  215. package/dist/{index-DIC7HKpP.d.mts → index-BGbTuHP9.d.mts} +1 -1
  216. package/dist/{index-BiVvxOvj.d.cts → index-BHKgEOZJ.d.cts} +2 -2
  217. package/dist/{index-BbgFYfX_.d.mts → index-BQWjh4rK.d.mts} +2 -2
  218. package/dist/{index-DJCpnTH3.d.mts → index-BelFIizY.d.cts} +3 -3
  219. package/dist/{index-C3KrFPCj.d.mts → index-BkzZxHVj.d.mts} +2 -2
  220. package/dist/{index-B8DNxyEw.d.mts → index-BrgwkY6z.d.mts} +2 -2
  221. package/dist/{index-DqjXDutI.d.mts → index-Bx0-6yeX.d.mts} +1 -1
  222. package/dist/index-BxVTIMnB.d.cts +1 -0
  223. package/dist/{index-Bhdn4KTy.d.cts → index-ByYxVl9O.d.mts} +3 -3
  224. package/dist/{index-gnh-Oe0n.d.cts → index-CE5JG1us.d.mts} +1 -1
  225. package/dist/{index-XxydXX8l.d.cts → index-CG_1uPrD.d.mts} +2 -2
  226. package/dist/{index-CVNJEUwJ.d.mts → index-CJhK7JND.d.mts} +49 -1
  227. package/dist/{index-BjfPEP_5.d.cts → index-CQfJZADG.d.cts} +2 -2
  228. package/dist/{index-DrVYWt-X.d.mts → index-CUz2h5xY.d.mts} +1 -1
  229. package/dist/{index-CrIxI8Na.d.mts → index-CbFaWtjK.d.mts} +2 -2
  230. package/dist/{index-BFruxTHv.d.cts → index-ChXeKJCk.d.cts} +1 -1
  231. package/dist/{index-DQcnJ5H4.d.cts → index-CknoXDLQ.d.cts} +2 -2
  232. package/dist/{index-IdMqR82e.d.cts → index-ClZyaZrR.d.mts} +2 -2
  233. package/dist/{index-Bxd9NOWb.d.mts → index-DAwcmIjN.d.cts} +2 -2
  234. package/dist/{index-CWnbCxgw.d.cts → index-DGnXJwLj.d.mts} +4 -4
  235. package/dist/{index-DmJ7yWWi.d.cts → index-DJ0f69wh.d.cts} +49 -1
  236. package/dist/{index-DckSub2J.d.mts → index-DWjz5ZzG.d.cts} +4 -4
  237. package/dist/{index-DXhMkjQ6.d.cts → index-DYF8sRE-.d.cts} +2 -2
  238. package/dist/index-DaIIo5QU.d.mts +1 -0
  239. package/dist/{index-BVPrG1L0.d.mts → index-DchHf5cF.d.cts} +1 -1
  240. package/dist/{index-BlLH6rlE.d.cts → index-DtYjdBvO.d.cts} +2 -2
  241. package/dist/{index-BqpS_Huq.d.mts → index-Dv_fk1_F.d.cts} +19 -3
  242. package/dist/{index-BSA6SKao.d.mts → index-K5exjvnX.d.cts} +2 -2
  243. package/dist/{index-BjPX49XA.d.mts → index-KnXhlKMr.d.cts} +1 -1
  244. package/dist/{index-B3LIhqHR.d.cts → index-WHFhjfgy.d.cts} +4 -4
  245. package/dist/{index-BCnKYNlZ.d.cts → index-YKrfFC_I.d.cts} +1 -1
  246. package/dist/{index-CoEqjFYn.d.mts → index-bpnLB_4K.d.mts} +4 -4
  247. package/dist/{index-DDJuUfL5.d.cts → index-h4dYtVrp.d.mts} +1 -1
  248. package/dist/{index-qlfNErNd.d.cts → index-ha1WjSZ5.d.mts} +19 -3
  249. package/dist/{index-DuVNRXP4.d.cts → index-nqUA_6J_.d.cts} +1 -1
  250. package/dist/{index-DeDxYlSQ.d.mts → index-pTNq3iQn.d.mts} +2 -2
  251. package/dist/index.d.cts +1 -1
  252. package/dist/index.d.mts +1 -1
  253. package/dist/isRtl-BJDtm86G.mjs +7 -0
  254. package/dist/isRtl-DTkYHRPo.cjs +12 -0
  255. package/dist/precision-B1lhxnnO.mjs +25 -0
  256. package/dist/precision-B58cTPB2.cjs +48 -0
  257. package/dist/style.d.cts +2 -2
  258. package/dist/style.d.mts +2 -2
  259. package/dist/theme.d.cts +3 -3
  260. package/dist/theme.d.mts +3 -3
  261. package/dist/useControlled-C666KpQ0.cjs +18 -0
  262. package/dist/useControlled-CBRLsO-H.mjs +13 -0
  263. package/dist/{useTablePagination-C5VKtqDp.d.cts → useTablePagination-C-u3ru4N.d.cts} +1 -1
  264. package/dist/{useTablePagination-C6LSlt3w.d.mts → useTablePagination-D-39ZmQh.d.mts} +1 -1
  265. package/package.json +42 -2
  266. package/dist/index-DBteSahY.d.cts +0 -1
  267. package/dist/index-_G1osn09.d.mts +0 -1
@@ -0,0 +1,476 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_src = require("./src-DU81aGy9.cjs");
3
+ const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
4
+ const require_utils = require("./utils.cjs");
5
+ const require_theme = require("./theme-BxXuXRgQ.cjs");
6
+ const require_Icon = require("./Icon-D-EWsBVg.cjs");
7
+ const require_FormControlContext = require("./FormControlContext-74gvPGFk.cjs");
8
+ const require_FormControl = require("./FormControl.cjs");
9
+ const require_useControlled = require("./useControlled-C666KpQ0.cjs");
10
+ const require_precision = require("./precision-B58cTPB2.cjs");
11
+ const require_inputVariantStyles = require("./inputVariantStyles-BBkkYQtE.cjs");
12
+ let react = require("react");
13
+ let react_jsx_runtime = require("react/jsx-runtime");
14
+ let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
15
+ //#region src/NumberField/hooks/useHoldRepeat.ts
16
+ /**
17
+ * Runs `action` at once on a press, then again and again while it is held - after a pause, so a
18
+ * tap is one step. `start` begins it, `stop` ends it, and it ends by itself when the component
19
+ * goes.
20
+ */
21
+ function useHoldRepeat(action, { delay = 400, interval = 60 } = {}) {
22
+ const actionRef = (0, react.useRef)(action);
23
+ (0, react.useEffect)(() => {
24
+ actionRef.current = action;
25
+ });
26
+ const timers = (0, react.useRef)({});
27
+ const stop = (0, react.useCallback)(() => {
28
+ window.clearTimeout(timers.current.pause);
29
+ window.clearInterval(timers.current.repeat);
30
+ timers.current = {};
31
+ }, []);
32
+ const start = (0, react.useCallback)(() => {
33
+ stop();
34
+ actionRef.current();
35
+ timers.current.pause = window.setTimeout(() => {
36
+ timers.current.repeat = window.setInterval(() => actionRef.current(), interval);
37
+ }, delay);
38
+ }, [
39
+ stop,
40
+ delay,
41
+ interval
42
+ ]);
43
+ (0, react.useEffect)(() => stop, [stop]);
44
+ return {
45
+ start,
46
+ stop
47
+ };
48
+ }
49
+ //#endregion
50
+ //#region src/NumberField/utils/number.ts
51
+ /** What a number is shown as unless told otherwise: all its digits, ungrouped, so typing round-trips. */
52
+ const DEFAULT_FORMAT = {
53
+ useGrouping: false,
54
+ maximumFractionDigits: 20
55
+ };
56
+ /** The syntax a locale and format write a number in. */
57
+ function getNumberSyntax(locale, format) {
58
+ const probe = new Intl.NumberFormat(locale, {
59
+ useGrouping: false,
60
+ minimumFractionDigits: 1,
61
+ maximumFractionDigits: 1
62
+ });
63
+ const digitFormat = new Intl.NumberFormat(locale, { useGrouping: false });
64
+ return {
65
+ decimal: probe.formatToParts(1.1).find((part) => part.type === "decimal").value,
66
+ digits: Array.from({ length: 10 }, (_, digit) => digitFormat.format(digit)),
67
+ isPercent: format?.style === "percent"
68
+ };
69
+ }
70
+ /** The number as its locale and format write it. */
71
+ function formatNumber(value, locale, format) {
72
+ return new Intl.NumberFormat(locale, {
73
+ ...DEFAULT_FORMAT,
74
+ ...format
75
+ }).format(value);
76
+ }
77
+ const MINUS = new RegExp(`[${[
78
+ 8722,
79
+ 8210,
80
+ 8211,
81
+ 8212
82
+ ].map((code) => String.fromCodePoint(code)).join("")}]`, "g");
83
+ /**
84
+ * The number a text stands for - `null` when it stands for none: its locale's digits and decimal
85
+ * mark, a leading minus, a percent's `%` (so `50%` is `0.5`). Group marks, spaces and symbols
86
+ * round it are ignored.
87
+ */
88
+ function parseNumber(text, syntax) {
89
+ let normalized = text.replace(MINUS, "-");
90
+ syntax.digits.forEach((digit, index) => {
91
+ normalized = normalized.split(digit).join(String(index));
92
+ });
93
+ const isNegative = normalized.includes("-");
94
+ const [whole = "", ...fraction] = normalized.split(syntax.decimal);
95
+ const digits = (text) => text.replaceAll(/\D/g, "");
96
+ const wholeDigits = digits(whole);
97
+ const fractionDigits = fraction.map(digits).join("");
98
+ if (wholeDigits === "" && fractionDigits === "") return null;
99
+ const parsed = Number(`${wholeDigits || "0"}.${fractionDigits || "0"}`);
100
+ const signed = isNegative ? -parsed : parsed;
101
+ return syntax.isPercent ? Number((signed / 100).toFixed(require_precision.getDecimalPrecision(parsed) + 2)) : signed;
102
+ }
103
+ //#endregion
104
+ //#region src/NumberField/hooks/useNumberField.ts
105
+ const clampTo = (value, min, max) => require_utils.clamp(value, min ?? Number.NEGATIVE_INFINITY, max ?? Number.POSITIVE_INFINITY);
106
+ /**
107
+ * A number field's state: the number (controlled or not), the text the user is typing - which
108
+ * is theirs until it is committed on blur or Enter - and the steps by key and by button. A
109
+ * number typed is told at once; one outside the range is clamped when it is committed.
110
+ */
111
+ function useNumberField({ value: valueProp, defaultValue, onChange, onChangeCommitted, min, max, step, smallStep, largeStep, format, locale, shouldSnapOnStep, isFrozen }) {
112
+ const [value, setValue] = require_useControlled.useControlled({
113
+ controlled: valueProp,
114
+ default: defaultValue ?? null
115
+ });
116
+ const [draft, setDraft] = (0, react.useState)(null);
117
+ const syntax = (0, react.useMemo)(() => getNumberSyntax(locale, format), [locale, format]);
118
+ const text = draft ?? (value === null ? "" : formatNumber(value, locale, format));
119
+ const update = (next) => {
120
+ if (next === value) return;
121
+ setValue(next);
122
+ onChange?.(next);
123
+ };
124
+ const handleChange = (event) => {
125
+ const typed = event.currentTarget.value;
126
+ setDraft(typed);
127
+ if (typed.trim() === "") return update(null);
128
+ const parsed = parseNumber(typed, syntax);
129
+ if (parsed !== null) update(parsed);
130
+ };
131
+ const settle = () => {
132
+ if (draft === null) return value;
133
+ if (draft.trim() === "") return null;
134
+ const parsed = parseNumber(draft, syntax);
135
+ return parsed === null ? value : clampTo(parsed, min, max);
136
+ };
137
+ const commit = (next) => {
138
+ setDraft(null);
139
+ update(next);
140
+ onChangeCommitted?.(next);
141
+ };
142
+ const handleBlur = () => {
143
+ if (draft !== null) commit(settle());
144
+ };
145
+ const stepBy = (direction, size = step) => {
146
+ if (isFrozen) return;
147
+ const base = settle() ?? 0;
148
+ let next = require_precision.addExact(base, direction * size);
149
+ if (shouldSnapOnStep) next = require_precision.snapToStep(next, step, min ?? 0);
150
+ commit(clampTo(next, min, max));
151
+ };
152
+ const handleKeyDown = (event) => {
153
+ if (isFrozen) return;
154
+ const { key, altKey, shiftKey } = event;
155
+ if (key === "Enter") return commit(settle());
156
+ if (key === "ArrowUp" || key === "ArrowDown") {
157
+ event.preventDefault();
158
+ let size = step;
159
+ if (altKey) size = smallStep;
160
+ if (shiftKey) size = largeStep;
161
+ return stepBy(key === "ArrowUp" ? 1 : -1, size);
162
+ }
163
+ const edge = key === "Home" ? min : max;
164
+ if ((key === "Home" || key === "End") && edge !== void 0) {
165
+ event.preventDefault();
166
+ commit(edge);
167
+ }
168
+ };
169
+ return {
170
+ text,
171
+ value,
172
+ canIncrement: !isFrozen && (max === void 0 || (value ?? Number.NEGATIVE_INFINITY) < max),
173
+ canDecrement: !isFrozen && (min === void 0 || (value ?? Number.POSITIVE_INFINITY) > min),
174
+ handleChange,
175
+ handleBlur,
176
+ handleKeyDown,
177
+ stepBy
178
+ };
179
+ }
180
+ //#endregion
181
+ //#region src/NumberField/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 = (0, react.useRef)(onStep);
188
+ (0, react.useEffect)(() => {
189
+ stepRef.current = onStep;
190
+ });
191
+ (0, react.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
+ //#endregion
204
+ //#region src/NumberField/NumberField.tsx
205
+ const widthStyles = (0, require_src.src_exports.system)({
206
+ width: true,
207
+ minWidth: true,
208
+ maxWidth: true
209
+ });
210
+ const frameStyle = ({ theme, color, textColor, isError, isDisabled, isFullWidth, isInField }) => {
211
+ const main = (0, require_src.src_exports.get)(theme, `palette.${color}.main`);
212
+ const border = isError ? (0, require_src.src_exports.get)(theme, "palette.error.main") : (0, require_src.src_exports.get)(theme, `palette.${color}.light`);
213
+ const focusBorder = isError ? (0, require_src.src_exports.get)(theme, "palette.error.main") : main;
214
+ return {
215
+ display: isFullWidth || isInField ? "flex" : "inline-flex",
216
+ ...isFullWidth && { width: "100%" },
217
+ ...isInField && !isFullWidth && { width: "fit-content" },
218
+ alignItems: "stretch",
219
+ transition: "border-color 0.15s ease",
220
+ backgroundColor: (0, require_src.src_exports.get)(theme, `background.${require_themeDefault.themeDefault(theme, "inputBg", "terminal")}`),
221
+ color: textColor ? (0, require_src.src_exports.get)(theme, `text.${textColor}`) : (0, require_src.src_exports.get)(theme, `palette.${color}.main`),
222
+ fontFamily: (0, require_src.src_exports.get)(theme, "fonts.body"),
223
+ lineHeight: (0, require_src.src_exports.get)(theme, "lineHeights.base"),
224
+ borderColor: border,
225
+ "&:focus-within": { borderColor: focusBorder },
226
+ "&:has(input:focus-visible)": {
227
+ outline: `2px solid ${main}`,
228
+ outlineOffset: "2px"
229
+ },
230
+ ...isDisabled && {
231
+ opacity: .5,
232
+ cursor: "not-allowed",
233
+ pointerEvents: "none"
234
+ }
235
+ };
236
+ };
237
+ const NumberFieldRoot = require_src.styled("div", {
238
+ name: "NumberField",
239
+ label: "NumberField",
240
+ shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
241
+ ..._soroush_tech_styled_system_should_forward_prop.props,
242
+ "color",
243
+ "textColor",
244
+ "variant",
245
+ "isError",
246
+ "isDisabled",
247
+ "isFullWidth",
248
+ "isInField"
249
+ ]),
250
+ systemProps: [require_src.src_exports.space, widthStyles]
251
+ })(require_inputVariantStyles.inputVariantStyles, frameStyle);
252
+ const NumberFieldInput = require_src.styled("input", {
253
+ name: "NumberField",
254
+ slot: "input",
255
+ label: "NumberFieldInput",
256
+ shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["sizeToken", "isCentered"])
257
+ })(({ theme, sizeToken, isCentered }) => {
258
+ const s = theme.sizes[sizeToken];
259
+ return {
260
+ flex: 1,
261
+ minWidth: 0,
262
+ width: "100%",
263
+ border: "none",
264
+ outline: "none",
265
+ background: "transparent",
266
+ color: "inherit",
267
+ fontFamily: "inherit",
268
+ lineHeight: "inherit",
269
+ textAlign: isCentered ? "center" : "start",
270
+ paddingTop: theme.space[s.paddingTop],
271
+ paddingBottom: theme.space[s.paddingBottom],
272
+ paddingLeft: theme.space[s.paddingLeft],
273
+ paddingRight: theme.space[s.paddingRight],
274
+ fontSize: theme.fontSizes[s.fontSize],
275
+ "&::placeholder": {
276
+ color: "inherit",
277
+ opacity: .5
278
+ },
279
+ "&:disabled": { cursor: "not-allowed" }
280
+ };
281
+ });
282
+ const NumberFieldSpinButtons = require_src.styled("span", {
283
+ name: "NumberField",
284
+ slot: "spinButtons",
285
+ label: "NumberFieldSpinButtons"
286
+ })(({ theme }) => ({
287
+ display: "flex",
288
+ flexDirection: "column",
289
+ borderInlineStart: `${theme.borderWidths.thin} solid`,
290
+ borderColor: "inherit"
291
+ }));
292
+ const spinStyle = ({ theme, color, isSide }) => {
293
+ const main = (0, require_src.src_exports.get)(theme, `palette.${color}.main`);
294
+ return {
295
+ appearance: "none",
296
+ display: "grid",
297
+ placeItems: "center",
298
+ flex: isSide ? "0 0 auto" : 1,
299
+ minWidth: isSide ? theme.space[5] : theme.icon.lg,
300
+ padding: 0,
301
+ border: "none",
302
+ background: "transparent",
303
+ color: "inherit",
304
+ cursor: "pointer",
305
+ "&:hover:not(:disabled)": { backgroundColor: `${main}1F` },
306
+ "&:disabled": {
307
+ opacity: .4,
308
+ cursor: "default"
309
+ }
310
+ };
311
+ };
312
+ const spinProps = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["color", "isSide"]);
313
+ const sideDivider = (edge) => {
314
+ return ({ theme, isSide }) => isSide ? {
315
+ [edge]: `${theme.borderWidths.thin} solid`,
316
+ borderColor: "inherit"
317
+ } : {};
318
+ };
319
+ const NumberFieldIncrement = require_src.styled("button", {
320
+ name: "NumberField",
321
+ slot: "increment",
322
+ label: "NumberFieldIncrement",
323
+ shouldForwardProp: spinProps
324
+ })(spinStyle, sideDivider("borderInlineStart"));
325
+ const NumberFieldDecrement = require_src.styled("button", {
326
+ name: "NumberField",
327
+ slot: "decrement",
328
+ label: "NumberFieldDecrement",
329
+ shouldForwardProp: spinProps
330
+ })(spinStyle, sideDivider("borderInlineEnd"));
331
+ const getSpinIcon = (direction, isSide) => {
332
+ if (isSide) return direction === 1 ? "add" : "remove";
333
+ return direction === 1 ? "expand_less" : "expand_more";
334
+ };
335
+ function SpinButton({ direction, label, isSide, isDisabled, color, onStep }) {
336
+ const hold = useHoldRepeat(() => onStep(direction));
337
+ const { stop } = hold;
338
+ (0, react.useEffect)(() => {
339
+ if (isDisabled) stop();
340
+ }, [isDisabled, stop]);
341
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(direction === 1 ? NumberFieldIncrement : NumberFieldDecrement, {
342
+ type: "button",
343
+ tabIndex: -1,
344
+ "aria-label": label,
345
+ disabled: isDisabled,
346
+ color,
347
+ isSide,
348
+ onMouseDown: (event) => event.preventDefault(),
349
+ onPointerDown: (event) => event.button === 0 && hold.start(),
350
+ onPointerUp: hold.stop,
351
+ onPointerLeave: hold.stop,
352
+ onPointerCancel: hold.stop,
353
+ onClick: (event) => event.detail === 0 && onStep(direction),
354
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
355
+ name: getSpinIcon(direction, isSide),
356
+ size: "sm",
357
+ color: "inherit"
358
+ })
359
+ });
360
+ }
361
+ /**
362
+ * @description A field for a number: a text input - so what is typed is the user's until it is
363
+ * settled - that reads and writes the number in its locale, clamps it to `min`/`max`, and steps
364
+ * by the arrow keys, Home/End, the wheel and buttons that repeat while held. A
365
+ * `role="spinbutton"`, so the number and its range are announced; a hidden input carries the raw
366
+ * number to a form. In a `FormControl` it takes the field's size, color, error, disabled and
367
+ * required state, and its `FormLabel` targets the field.
368
+ */
369
+ function NumberField({ 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, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...rest }) {
370
+ const theme = require_theme.useTheme();
371
+ const dp = require_theme.useDefaultProps("NumberField");
372
+ const isInField = (0, react.useContext)(require_FormControlContext.FormControlContext) !== null;
373
+ const fc = require_FormControl.useFormControl({
374
+ id: idProp,
375
+ error: errorProp,
376
+ disabled: disabledProp,
377
+ required: requiredProp,
378
+ size: sizeProp ?? dp.size,
379
+ fullWidth: fullWidthProp,
380
+ color: colorProp ?? dp.color,
381
+ textColor: textColorProp
382
+ });
383
+ const color = fc.color ?? require_themeDefault.themeDefault(theme, "color", "primary");
384
+ const textColor = fc.textColor;
385
+ const variant = variantProp ?? dp.variant ?? require_themeDefault.themeDefault(theme, "inputVariant", "default");
386
+ const spinButtons = spinButtonsProp ?? dp.spinButtons ?? "stacked";
387
+ const step = stepProp ?? dp.step ?? 1;
388
+ const isFrozen = fc.disabled || readOnly;
389
+ const field = useNumberField({
390
+ value,
391
+ defaultValue,
392
+ onChange,
393
+ onChangeCommitted,
394
+ min,
395
+ max,
396
+ step,
397
+ smallStep: smallStepProp ?? dp.smallStep ?? .1,
398
+ largeStep: largeStepProp ?? dp.largeStep ?? 10,
399
+ format,
400
+ locale,
401
+ shouldSnapOnStep: shouldSnapProp ?? dp.shouldSnapOnStep ?? false,
402
+ isFrozen
403
+ });
404
+ const inputRef = (0, react.useRef)(null);
405
+ useWheelStep(inputRef, shouldScrubProp ?? dp.shouldScrubOnWheel ?? false, field.stepBy);
406
+ const isSide = spinButtons === "sides";
407
+ const buttonProps = {
408
+ isSide,
409
+ color,
410
+ onStep: field.stepBy
411
+ };
412
+ const decrement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpinButton, {
413
+ direction: -1,
414
+ label: decrementLabelProp ?? dp.decrementLabel,
415
+ isDisabled: !field.canDecrement,
416
+ ...buttonProps
417
+ });
418
+ const increment = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpinButton, {
419
+ direction: 1,
420
+ label: incrementLabelProp ?? dp.incrementLabel,
421
+ isDisabled: !field.canIncrement,
422
+ ...buttonProps
423
+ });
424
+ const inputMode = (min ?? -1) >= 0 && Number.isInteger(step) ? "numeric" : "decimal";
425
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NumberFieldRoot, {
426
+ color,
427
+ textColor,
428
+ variant,
429
+ isError: fc.error,
430
+ isDisabled: fc.disabled,
431
+ isFullWidth: fc.fullWidth,
432
+ isInField,
433
+ className,
434
+ "data-testid": dataTestid,
435
+ ...rest,
436
+ children: [
437
+ isSide && decrement,
438
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberFieldInput, {
439
+ ref: inputRef,
440
+ type: "text",
441
+ role: "spinbutton",
442
+ inputMode,
443
+ autoComplete: "off",
444
+ id: fc.id,
445
+ value: field.text,
446
+ placeholder,
447
+ autoFocus,
448
+ disabled: fc.disabled,
449
+ readOnly,
450
+ required: fc.required,
451
+ sizeToken: fc.size,
452
+ isCentered: isSide,
453
+ "aria-valuenow": field.value ?? void 0,
454
+ "aria-valuemin": min,
455
+ "aria-valuemax": max,
456
+ "aria-label": ariaLabel,
457
+ "aria-labelledby": ariaLabelledby,
458
+ "aria-describedby": ariaDescribedby ?? fc["aria-describedby"],
459
+ "aria-invalid": fc.error || void 0,
460
+ onChange: field.handleChange,
461
+ onBlur: field.handleBlur,
462
+ onKeyDown: field.handleKeyDown
463
+ }),
464
+ name !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
465
+ type: "hidden",
466
+ name,
467
+ value: field.value ?? "",
468
+ disabled: fc.disabled
469
+ }),
470
+ spinButtons === "stacked" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NumberFieldSpinButtons, { children: [increment, decrement] }),
471
+ isSide && increment
472
+ ]
473
+ });
474
+ }
475
+ //#endregion
476
+ exports.NumberField = NumberField;
@@ -0,0 +1,74 @@
1
+ import { W as Theme } from "./index-DJ0f69wh.cjs";
2
+ import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
3
+ //#region src/NumberField/NumberField.d.ts
4
+ type NumberFieldVariant = 'default' | 'outlined' | 'text' | 'underline';
5
+ type NumberFieldSpinButtons = 'stacked' | 'sides' | 'none';
6
+ interface NumberFieldProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, '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?: NumberFieldSpinButtons;
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
+ /** The frame: a box, an outline, an underline or none. Default: `theme.defaults.inputVariant`. */
40
+ variant?: NumberFieldVariant;
41
+ /** Resolves against `theme.sizes`. Default: its `FormControl`'s, else `'md'`. */
42
+ size?: keyof Theme['sizes'];
43
+ /** The focus border color - resolves to `theme.palette`. Default: `'primary'`. */
44
+ color?: keyof Theme['palette'];
45
+ /** The number's color - resolves against `theme.text`. Default: `'primary'`. */
46
+ textColor?: keyof Theme['text'];
47
+ error?: boolean;
48
+ disabled?: boolean;
49
+ readOnly?: boolean;
50
+ required?: boolean;
51
+ fullWidth?: boolean;
52
+ /** What a form submits the number as. */
53
+ name?: string;
54
+ /** On the field, which a `FormLabel` targets. Default: its `FormControl`'s. */
55
+ id?: string;
56
+ placeholder?: string;
57
+ autoFocus?: boolean;
58
+ className?: string;
59
+ 'aria-label'?: string;
60
+ 'aria-labelledby'?: string;
61
+ 'aria-describedby'?: string;
62
+ 'data-testid'?: string;
63
+ }
64
+ /**
65
+ * @description A field for a number: a text input - so what is typed is the user's until it is
66
+ * settled - that reads and writes the number in its locale, clamps it to `min`/`max`, and steps
67
+ * by the arrow keys, Home/End, the wheel and buttons that repeat while held. A
68
+ * `role="spinbutton"`, so the number and its range are announced; a hidden input carries the raw
69
+ * number to a form. In a `FormControl` it takes the field's size, color, error, disabled and
70
+ * required state, and its `FormLabel` targets the field.
71
+ */
72
+ declare function NumberField({ 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, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...rest }: Readonly<NumberFieldProps>): import("react").JSX.Element;
73
+ //#endregion
74
+ export { NumberField, NumberFieldProps, NumberFieldSpinButtons, NumberFieldVariant };
@@ -0,0 +1,74 @@
1
+ import { W as Theme } from "./index-CJhK7JND.mjs";
2
+ import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
3
+ //#region src/NumberField/NumberField.d.ts
4
+ type NumberFieldVariant = 'default' | 'outlined' | 'text' | 'underline';
5
+ type NumberFieldSpinButtons = 'stacked' | 'sides' | 'none';
6
+ interface NumberFieldProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, '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?: NumberFieldSpinButtons;
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
+ /** The frame: a box, an outline, an underline or none. Default: `theme.defaults.inputVariant`. */
40
+ variant?: NumberFieldVariant;
41
+ /** Resolves against `theme.sizes`. Default: its `FormControl`'s, else `'md'`. */
42
+ size?: keyof Theme['sizes'];
43
+ /** The focus border color - resolves to `theme.palette`. Default: `'primary'`. */
44
+ color?: keyof Theme['palette'];
45
+ /** The number's color - resolves against `theme.text`. Default: `'primary'`. */
46
+ textColor?: keyof Theme['text'];
47
+ error?: boolean;
48
+ disabled?: boolean;
49
+ readOnly?: boolean;
50
+ required?: boolean;
51
+ fullWidth?: boolean;
52
+ /** What a form submits the number as. */
53
+ name?: string;
54
+ /** On the field, which a `FormLabel` targets. Default: its `FormControl`'s. */
55
+ id?: string;
56
+ placeholder?: string;
57
+ autoFocus?: boolean;
58
+ className?: string;
59
+ 'aria-label'?: string;
60
+ 'aria-labelledby'?: string;
61
+ 'aria-describedby'?: string;
62
+ 'data-testid'?: string;
63
+ }
64
+ /**
65
+ * @description A field for a number: a text input - so what is typed is the user's until it is
66
+ * settled - that reads and writes the number in its locale, clamps it to `min`/`max`, and steps
67
+ * by the arrow keys, Home/End, the wheel and buttons that repeat while held. A
68
+ * `role="spinbutton"`, so the number and its range are announced; a hidden input carries the raw
69
+ * number to a form. In a `FormControl` it takes the field's size, color, error, disabled and
70
+ * required state, and its `FormLabel` targets the field.
71
+ */
72
+ declare function NumberField({ 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, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...rest }: Readonly<NumberFieldProps>): import("react").JSX.Element;
73
+ //#endregion
74
+ export { NumberField, NumberFieldProps, NumberFieldSpinButtons, NumberFieldVariant };