@techsio/ui-kit 0.57.0 → 0.59.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 (346) hide show
  1. package/README.md +128 -133
  2. package/dist/atoms/action-icon.js +9 -8
  3. package/dist/atoms/button.js +114 -18
  4. package/dist/atoms/checkbox.js +77 -17
  5. package/dist/atoms/hotkeys.js +26 -7
  6. package/dist/atoms/icon.js +5 -5
  7. package/dist/atoms/image.js +118 -3
  8. package/dist/atoms/input.js +57 -9
  9. package/dist/atoms/label.js +13 -4
  10. package/dist/atoms/link-button.js +15 -12
  11. package/dist/atoms/link.js +18 -4
  12. package/dist/atoms/numeric-input.js +362 -84
  13. package/dist/atoms/rating.js +306 -73
  14. package/dist/atoms/skeleton.js +18 -14
  15. package/dist/atoms/status-text.js +31 -18
  16. package/dist/atoms/textarea.js +59 -12
  17. package/dist/atoms/tooltip.js +64 -43
  18. package/dist/hotkeys.js +1 -0
  19. package/dist/internal/choice-control.js +173 -0
  20. package/dist/internal/combobox-query-sync.js +11 -0
  21. package/dist/internal/date-picker-coordinator.js +56 -40
  22. package/dist/internal/date-picker-dom.js +44 -0
  23. package/dist/internal/date-picker-input.js +30 -0
  24. package/dist/internal/described-by.js +23 -18
  25. package/dist/internal/form-control-lifecycle.js +122 -0
  26. package/dist/internal/molecules/command.context.js +1 -0
  27. package/dist/internal/molecules/drawer.context.js +1 -0
  28. package/dist/internal/molecules/vertical-navigation.context.js +1 -0
  29. package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
  30. package/dist/internal/numeric-input-editing.js +87 -0
  31. package/dist/internal/organisms/sidebar.context.js +1 -0
  32. package/dist/internal/organisms/sidebar.focus.js +1 -0
  33. package/dist/internal/overlay-portal.js +72 -0
  34. package/dist/internal/reduced-motion.js +1 -0
  35. package/dist/internal/use-effective-disabled.js +8 -0
  36. package/dist/molecules/accordion.js +44 -30
  37. package/dist/molecules/availability-status.js +1 -0
  38. package/dist/molecules/breadcrumb.js +11 -11
  39. package/dist/molecules/carousel.js +279 -97
  40. package/dist/molecules/cascade-select.js +327 -81
  41. package/dist/molecules/chart.js +427 -78
  42. package/dist/molecules/color-select.js +181 -62
  43. package/dist/molecules/combobox.js +537 -182
  44. package/dist/molecules/command.js +2 -1
  45. package/dist/molecules/date-picker.js +629 -119
  46. package/dist/molecules/dialog.js +89 -48
  47. package/dist/molecules/drawer.js +63 -6
  48. package/dist/molecules/file-upload.js +373 -37
  49. package/dist/molecules/form-checkbox.js +65 -22
  50. package/dist/molecules/form-error-summary.js +29 -5
  51. package/dist/molecules/form-input.js +26 -30
  52. package/dist/molecules/form-numeric-input.js +11 -9
  53. package/dist/molecules/form-textarea.js +26 -23
  54. package/dist/molecules/menu.js +170 -47
  55. package/dist/molecules/pagination.js +100 -28
  56. package/dist/molecules/phone-input.js +172 -37
  57. package/dist/molecules/popover.js +53 -26
  58. package/dist/molecules/price-block.js +1 -0
  59. package/dist/molecules/product-card.js +85 -23
  60. package/dist/molecules/quantity-field.js +4 -2
  61. package/dist/molecules/radio-card.js +102 -30
  62. package/dist/molecules/radio-group.js +108 -31
  63. package/dist/molecules/search-form.js +116 -13
  64. package/dist/molecules/select.js +226 -81
  65. package/dist/molecules/slider.js +141 -30
  66. package/dist/molecules/steps.js +181 -50
  67. package/dist/molecules/switch.js +86 -20
  68. package/dist/molecules/tabs.js +227 -31
  69. package/dist/molecules/toast.js +155 -53
  70. package/dist/molecules/totals-summary.js +2 -1
  71. package/dist/molecules/tour.js +9 -5
  72. package/dist/molecules/tree-view.js +255 -109
  73. package/dist/molecules/vertical-navigation.js +8 -4
  74. package/dist/organisms/data-table.fields.js +26 -5
  75. package/dist/organisms/data-table.helpers.js +6 -2
  76. package/dist/organisms/data-table.js +587 -154
  77. package/dist/organisms/footer.js +18 -11
  78. package/dist/organisms/gallery.js +61 -24
  79. package/dist/organisms/header.js +106 -32
  80. package/dist/organisms/line-item.js +1 -0
  81. package/dist/organisms/sidebar.js +1 -0
  82. package/dist/organisms/table.js +22 -7
  83. package/dist/src/atoms/action-icon.d.ts +10 -10
  84. package/dist/src/atoms/action-icon.d.ts.map +1 -1
  85. package/dist/src/atoms/badge.d.ts +3 -3
  86. package/dist/src/atoms/badge.d.ts.map +1 -1
  87. package/dist/src/atoms/button.d.ts +47 -24
  88. package/dist/src/atoms/button.d.ts.map +1 -1
  89. package/dist/src/atoms/checkbox.d.ts +6 -5
  90. package/dist/src/atoms/checkbox.d.ts.map +1 -1
  91. package/dist/src/atoms/hotkeys.d.ts +3 -2
  92. package/dist/src/atoms/hotkeys.d.ts.map +1 -1
  93. package/dist/src/atoms/icon.d.ts +18 -17
  94. package/dist/src/atoms/icon.d.ts.map +1 -1
  95. package/dist/src/atoms/image.d.ts +38 -7
  96. package/dist/src/atoms/image.d.ts.map +1 -1
  97. package/dist/src/atoms/input.d.ts +23 -14
  98. package/dist/src/atoms/input.d.ts.map +1 -1
  99. package/dist/src/atoms/label.d.ts +4 -4
  100. package/dist/src/atoms/label.d.ts.map +1 -1
  101. package/dist/src/atoms/link-button.d.ts +78 -31
  102. package/dist/src/atoms/link-button.d.ts.map +1 -1
  103. package/dist/src/atoms/link.d.ts +30 -9
  104. package/dist/src/atoms/link.d.ts.map +1 -1
  105. package/dist/src/atoms/numeric-input.d.ts +24 -19
  106. package/dist/src/atoms/numeric-input.d.ts.map +1 -1
  107. package/dist/src/atoms/rating.d.ts +54 -26
  108. package/dist/src/atoms/rating.d.ts.map +1 -1
  109. package/dist/src/atoms/skeleton.d.ts +9 -9
  110. package/dist/src/atoms/skeleton.d.ts.map +1 -1
  111. package/dist/src/atoms/status-text.d.ts +21 -13
  112. package/dist/src/atoms/status-text.d.ts.map +1 -1
  113. package/dist/src/atoms/textarea.d.ts +22 -20
  114. package/dist/src/atoms/textarea.d.ts.map +1 -1
  115. package/dist/src/atoms/tooltip.d.ts +5 -5
  116. package/dist/src/atoms/tooltip.d.ts.map +1 -1
  117. package/dist/src/hotkeys.d.ts +1 -1
  118. package/dist/src/hotkeys.d.ts.map +1 -1
  119. package/dist/src/internal/choice-control.d.ts +18 -0
  120. package/dist/src/internal/choice-control.d.ts.map +1 -0
  121. package/dist/src/internal/combobox-query-sync.d.ts +4 -0
  122. package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
  123. package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
  124. package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
  125. package/dist/src/internal/date-picker-dom.d.ts +10 -0
  126. package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
  127. package/dist/src/internal/date-picker-input.d.ts +7 -0
  128. package/dist/src/internal/date-picker-input.d.ts.map +1 -0
  129. package/dist/src/internal/described-by.d.ts +7 -1
  130. package/dist/src/internal/described-by.d.ts.map +1 -1
  131. package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
  132. package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
  133. package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
  134. package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
  135. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
  136. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
  137. package/dist/src/internal/numeric-input-editing.d.ts +13 -0
  138. package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
  139. package/dist/src/internal/overlay-portal.d.ts +18 -0
  140. package/dist/src/internal/overlay-portal.d.ts.map +1 -0
  141. package/dist/src/internal/use-effective-disabled.d.ts +4 -0
  142. package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
  143. package/dist/src/molecules/accordion.d.ts +25 -19
  144. package/dist/src/molecules/accordion.d.ts.map +1 -1
  145. package/dist/src/molecules/availability-status.d.ts +4 -1
  146. package/dist/src/molecules/availability-status.d.ts.map +1 -1
  147. package/dist/src/molecules/breadcrumb.d.ts +2 -2
  148. package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
  149. package/dist/src/molecules/carousel.d.ts +51 -52
  150. package/dist/src/molecules/carousel.d.ts.map +1 -1
  151. package/dist/src/molecules/cascade-select.d.ts +23 -8
  152. package/dist/src/molecules/cascade-select.d.ts.map +1 -1
  153. package/dist/src/molecules/chart.d.ts +18 -1
  154. package/dist/src/molecules/chart.d.ts.map +1 -1
  155. package/dist/src/molecules/color-select.d.ts +19 -3
  156. package/dist/src/molecules/color-select.d.ts.map +1 -1
  157. package/dist/src/molecules/combobox.d.ts +27 -5
  158. package/dist/src/molecules/combobox.d.ts.map +1 -1
  159. package/dist/src/molecules/command.d.ts +1 -1
  160. package/dist/src/molecules/date-picker.d.ts +30 -4
  161. package/dist/src/molecules/date-picker.d.ts.map +1 -1
  162. package/dist/src/molecules/dialog.d.ts +17 -4
  163. package/dist/src/molecules/dialog.d.ts.map +1 -1
  164. package/dist/src/molecules/drawer.d.ts +4 -4
  165. package/dist/src/molecules/drawer.d.ts.map +1 -1
  166. package/dist/src/molecules/file-upload.d.ts +11 -6
  167. package/dist/src/molecules/file-upload.d.ts.map +1 -1
  168. package/dist/src/molecules/form-checkbox.d.ts +7 -2
  169. package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
  170. package/dist/src/molecules/form-error-summary.d.ts +4 -3
  171. package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
  172. package/dist/src/molecules/form-input.d.ts +5 -6
  173. package/dist/src/molecules/form-input.d.ts.map +1 -1
  174. package/dist/src/molecules/form-numeric-input.d.ts +5 -5
  175. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
  176. package/dist/src/molecules/form-textarea.d.ts +5 -6
  177. package/dist/src/molecules/form-textarea.d.ts.map +1 -1
  178. package/dist/src/molecules/menu.d.ts +17 -3
  179. package/dist/src/molecules/menu.d.ts.map +1 -1
  180. package/dist/src/molecules/pagination.d.ts +1 -1
  181. package/dist/src/molecules/pagination.d.ts.map +1 -1
  182. package/dist/src/molecules/phone-input.d.ts +4 -1
  183. package/dist/src/molecules/phone-input.d.ts.map +1 -1
  184. package/dist/src/molecules/popover.d.ts +7 -1
  185. package/dist/src/molecules/popover.d.ts.map +1 -1
  186. package/dist/src/molecules/price-block.d.ts +1 -1
  187. package/dist/src/molecules/price-block.d.ts.map +1 -1
  188. package/dist/src/molecules/product-card.d.ts +127 -27
  189. package/dist/src/molecules/product-card.d.ts.map +1 -1
  190. package/dist/src/molecules/quantity-field.d.ts +1 -1
  191. package/dist/src/molecules/quantity-field.d.ts.map +1 -1
  192. package/dist/src/molecules/radio-card.d.ts +10 -3
  193. package/dist/src/molecules/radio-card.d.ts.map +1 -1
  194. package/dist/src/molecules/radio-group.d.ts +15 -6
  195. package/dist/src/molecules/radio-group.d.ts.map +1 -1
  196. package/dist/src/molecules/search-form.d.ts +37 -12
  197. package/dist/src/molecules/search-form.d.ts.map +1 -1
  198. package/dist/src/molecules/select.d.ts +34 -29
  199. package/dist/src/molecules/select.d.ts.map +1 -1
  200. package/dist/src/molecules/slider.d.ts +23 -2
  201. package/dist/src/molecules/slider.d.ts.map +1 -1
  202. package/dist/src/molecules/steps.d.ts +30 -10
  203. package/dist/src/molecules/steps.d.ts.map +1 -1
  204. package/dist/src/molecules/switch.d.ts +54 -33
  205. package/dist/src/molecules/switch.d.ts.map +1 -1
  206. package/dist/src/molecules/tabs.d.ts +11 -11
  207. package/dist/src/molecules/tabs.d.ts.map +1 -1
  208. package/dist/src/molecules/toast.d.ts +38 -14
  209. package/dist/src/molecules/toast.d.ts.map +1 -1
  210. package/dist/src/molecules/totals-summary.d.ts +1 -1
  211. package/dist/src/molecules/totals-summary.d.ts.map +1 -1
  212. package/dist/src/molecules/tour.d.ts +1 -1
  213. package/dist/src/molecules/tour.d.ts.map +1 -1
  214. package/dist/src/molecules/tree-view.d.ts +16 -20
  215. package/dist/src/molecules/tree-view.d.ts.map +1 -1
  216. package/dist/src/molecules/vertical-navigation.d.ts +2 -2
  217. package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
  218. package/dist/src/organisms/data-table.d.ts +28 -3
  219. package/dist/src/organisms/data-table.d.ts.map +1 -1
  220. package/dist/src/organisms/data-table.fields.d.ts +4 -1
  221. package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
  222. package/dist/src/organisms/data-table.helpers.d.ts +5 -12
  223. package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
  224. package/dist/src/organisms/footer.d.ts +5 -5
  225. package/dist/src/organisms/footer.d.ts.map +1 -1
  226. package/dist/src/organisms/gallery.d.ts +11 -9
  227. package/dist/src/organisms/gallery.d.ts.map +1 -1
  228. package/dist/src/organisms/header.d.ts +24 -22
  229. package/dist/src/organisms/header.d.ts.map +1 -1
  230. package/dist/src/organisms/table.d.ts +14 -14
  231. package/dist/src/organisms/table.d.ts.map +1 -1
  232. package/dist/src/templates/accordion.d.ts +8 -6
  233. package/dist/src/templates/accordion.d.ts.map +1 -1
  234. package/dist/src/templates/breadcrumb.d.ts +1 -1
  235. package/dist/src/templates/breadcrumb.d.ts.map +1 -1
  236. package/dist/src/templates/carousel.d.ts +3 -3
  237. package/dist/src/templates/carousel.d.ts.map +1 -1
  238. package/dist/src/templates/facet-filter-panel.d.ts +9 -3
  239. package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
  240. package/dist/src/templates/gallery.d.ts +2 -2
  241. package/dist/src/templates/gallery.d.ts.map +1 -1
  242. package/dist/src/templates/numeric-input.d.ts +1 -1
  243. package/dist/src/templates/numeric-input.d.ts.map +1 -1
  244. package/dist/src/templates/popover.d.ts +4 -2
  245. package/dist/src/templates/popover.d.ts.map +1 -1
  246. package/dist/src/templates/product-card.d.ts +12 -4
  247. package/dist/src/templates/product-card.d.ts.map +1 -1
  248. package/dist/src/templates/search-suggestions.d.ts +1 -1
  249. package/dist/src/templates/select.d.ts +7 -2
  250. package/dist/src/templates/select.d.ts.map +1 -1
  251. package/dist/src/templates/tabs.d.ts +8 -7
  252. package/dist/src/templates/tabs.d.ts.map +1 -1
  253. package/dist/src/theme/theme-config.d.ts +9 -16
  254. package/dist/src/theme/theme-config.d.ts.map +1 -1
  255. package/dist/src/theme/theme-provider.d.ts +16 -21
  256. package/dist/src/theme/theme-provider.d.ts.map +1 -1
  257. package/dist/src/theme/theme-toggle.d.ts.map +1 -1
  258. package/dist/src/utils.d.ts.map +1 -1
  259. package/dist/templates/accordion.js +3 -1
  260. package/dist/templates/breadcrumb.js +11 -4
  261. package/dist/templates/carousel.js +3 -6
  262. package/dist/templates/facet-filter-panel.js +121 -52
  263. package/dist/templates/gallery.js +6 -2
  264. package/dist/templates/numeric-input.js +6 -1
  265. package/dist/templates/popover.js +6 -1
  266. package/dist/templates/product-card.js +52 -26
  267. package/dist/templates/select.js +6 -1
  268. package/dist/templates/tabs.js +4 -2
  269. package/dist/theme/theme-config.js +8 -16
  270. package/dist/theme/theme-provider.js +89 -63
  271. package/dist/theme/theme-toggle.js +17 -9
  272. package/dist/utils.js +11 -1
  273. package/package.json +9 -5
  274. package/src/tokens/_base.css +4 -3
  275. package/src/tokens/_business-atoms.css +96 -0
  276. package/src/tokens/_foundation-overrides.css +251 -0
  277. package/src/tokens/_reset.css +10 -10
  278. package/src/tokens/_scheme-scopes.css +4194 -0
  279. package/src/tokens/_semantic.css +1 -23
  280. package/src/tokens/_tokens-base.css +36 -32
  281. package/src/tokens/_typography.css +2 -1
  282. package/src/tokens/components/_form-control.css +149 -6
  283. package/src/tokens/components/_popup-surface.css +15 -29
  284. package/src/tokens/components/atoms/_action-icon.css +49 -0
  285. package/src/tokens/components/atoms/_button.css +77 -0
  286. package/src/tokens/components/atoms/_checkbox.css +47 -4
  287. package/src/tokens/components/atoms/_hotkeys.css +2 -0
  288. package/src/tokens/components/atoms/_icon.css +60 -7
  289. package/src/tokens/components/atoms/_image.css +18 -0
  290. package/src/tokens/components/atoms/_input.css +20 -0
  291. package/src/tokens/components/atoms/_label.css +3 -7
  292. package/src/tokens/components/atoms/_link.css +47 -5
  293. package/src/tokens/components/atoms/_numeric-input.css +121 -2
  294. package/src/tokens/components/atoms/_rating.css +55 -6
  295. package/src/tokens/components/atoms/_skeleton.css +12 -2
  296. package/src/tokens/components/atoms/_status-text.css +35 -5
  297. package/src/tokens/components/atoms/_textarea.css +32 -3
  298. package/src/tokens/components/atoms/_tooltip.css +25 -0
  299. package/src/tokens/components/molecules/_accordion.css +46 -5
  300. package/src/tokens/components/molecules/_breadcrumb.css +15 -4
  301. package/src/tokens/components/molecules/_carousel.css +67 -0
  302. package/src/tokens/components/molecules/_cascade-select.css +104 -0
  303. package/src/tokens/components/molecules/_chart.css +32 -16
  304. package/src/tokens/components/molecules/_color-select.css +21 -0
  305. package/src/tokens/components/molecules/_combobox.css +81 -0
  306. package/src/tokens/components/molecules/_command.css +1 -0
  307. package/src/tokens/components/molecules/_date-picker.css +66 -10
  308. package/src/tokens/components/molecules/_dialog.css +36 -4
  309. package/src/tokens/components/molecules/_drawer.css +39 -3
  310. package/src/tokens/components/molecules/_file-upload.css +16 -1
  311. package/src/tokens/components/molecules/_menu.css +17 -0
  312. package/src/tokens/components/molecules/_pagination.css +19 -0
  313. package/src/tokens/components/molecules/_phone-input.css +20 -5
  314. package/src/tokens/components/molecules/_popover.css +34 -0
  315. package/src/tokens/components/molecules/_product-card.css +70 -0
  316. package/src/tokens/components/molecules/_radio-card.css +35 -0
  317. package/src/tokens/components/molecules/_radio-group.css +8 -0
  318. package/src/tokens/components/molecules/_select.css +33 -0
  319. package/src/tokens/components/molecules/_slider.css +5 -0
  320. package/src/tokens/components/molecules/_steps.css +52 -0
  321. package/src/tokens/components/molecules/_switch.css +59 -10
  322. package/src/tokens/components/molecules/_tabs.css +61 -3
  323. package/src/tokens/components/molecules/_toast.css +60 -0
  324. package/src/tokens/components/molecules/_totals-summary.css +22 -22
  325. package/src/tokens/components/molecules/_tour.css +16 -1
  326. package/src/tokens/components/molecules/_tree-view.css +27 -3
  327. package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
  328. package/src/tokens/components/organisms/_data-table.css +97 -0
  329. package/src/tokens/components/organisms/_footer.css +9 -0
  330. package/src/tokens/components/organisms/_gallery.css +11 -0
  331. package/src/tokens/components/organisms/_header.css +22 -0
  332. package/src/tokens/components/organisms/_sidebar.css +1 -1
  333. package/src/tokens/components/organisms/_table.css +31 -0
  334. package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
  335. package/src/tokens/figma/akros/variables.css +15 -6
  336. package/src/tokens/figma/brand-overrides.css +171 -57
  337. package/src/tokens/figma/business/variables.css +15 -6
  338. package/src/tokens/figma/cyber/variables.css +115 -38
  339. package/src/tokens/figma/cyber-dark/variables.css +115 -38
  340. package/src/tokens/figma/dark/variables.css +13 -4
  341. package/src/tokens/figma/light/variables.css +62 -49
  342. package/src/tokens/figma/{neo → n1}/variables.css +123 -114
  343. package/src/tokens/figma/variables.css +658 -249
  344. package/src/tokens/theme.css +24 -4
  345. package/src/tokens/_colors.css +0 -5
  346. package/src/tokens/figma/neo-dark/variables.css +0 -457
@@ -1,27 +1,76 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { normalizeProps, useMachine } from "@zag-js/react";
3
- import { createContext, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef } from "react";
4
+ import { createContext, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import { flushSync } from "react-dom";
6
+ import { isSilentChoiceReset, mergeChoiceInputProps, runSilentChoiceReset, trackChoiceFormControl } from "../internal/choice-control.js";
7
+ import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
8
+ import { createNumericInputEditing, syncNumericInputValue } from "../internal/numeric-input-editing.js";
4
9
  import { tv } from "../utils.js";
5
10
  import { Button } from "./button.js";
6
11
  import { Input } from "./input.js";
12
+ import { StatusText } from "./status-text.js";
7
13
  import * as __rspack_external__zag_js_number_input_f1a1f439 from "@zag-js/number-input";
14
+ const valueActions = __rspack_external__zag_js_number_input_f1a1f439.machine.implementations?.actions ?? {};
15
+ const guardValueAction = (action)=>(params)=>{
16
+ if (params.prop("readOnly") || params.computed("isDisabled")) return;
17
+ action?.(params);
18
+ };
19
+ const defaultComputed = __rspack_external__zag_js_number_input_f1a1f439.machine.computed;
20
+ const readOnlySafeMachine = {
21
+ ...__rspack_external__zag_js_number_input_f1a1f439.machine,
22
+ computed: defaultComputed && {
23
+ ...defaultComputed,
24
+ formattedValue (params) {
25
+ const value = params.computed("valueAsNumber");
26
+ if (Number.isFinite(value) && !Number.isInteger(value) && params.prop("formatOptions")?.maximumFractionDigits === 0) return params.context.get("value");
27
+ return defaultComputed.formattedValue(params);
28
+ }
29
+ },
30
+ implementations: {
31
+ ...__rspack_external__zag_js_number_input_f1a1f439.machine.implementations,
32
+ actions: {
33
+ ...valueActions,
34
+ increment: guardValueAction(valueActions.increment),
35
+ decrement: guardValueAction(valueActions.decrement),
36
+ incrementToMax: guardValueAction(valueActions.incrementToMax),
37
+ decrementToMin: guardValueAction(valueActions.decrementToMin),
38
+ setValue () {},
39
+ setRawValue: guardValueAction(valueActions.setRawValue),
40
+ clearValue: guardValueAction(valueActions.clearValue),
41
+ setClampedValue: guardValueAction(valueActions.setClampedValue),
42
+ setFormattedValue: guardValueAction(valueActions.setFormattedValue),
43
+ invokeOnValueCommit ({ computed, prop, event }) {
44
+ let valueAsNumber = computed("valueAsNumber");
45
+ let value = computed("formattedValue");
46
+ if ("INPUT.BLUR" === event.type && prop("clampValueOnBlur") && !prop("readOnly") && !computed("isDisabled") && Number.isFinite(valueAsNumber)) {
47
+ const clamped = Math.min(prop("max"), Math.max(prop("min"), valueAsNumber));
48
+ if (clamped !== valueAsNumber) {
49
+ valueAsNumber = clamped;
50
+ value = prop("formatOptions") ? computed("formatter").format(clamped) : String(clamped);
51
+ }
52
+ }
53
+ prop("onValueCommit")?.({
54
+ value,
55
+ valueAsNumber
56
+ });
57
+ }
58
+ }
59
+ }
60
+ };
8
61
  const numericInputVariants = tv({
9
62
  slots: {
10
63
  root: [
11
- "relative flex"
64
+ "relative flex min-w-0 flex-col"
12
65
  ],
13
66
  container: [
14
- "group form-control-base relative flex",
15
- "border-numeric-input-border",
67
+ "group numeric-input-focus-owner form-control-base numeric-input-validation numeric-input-readonly relative flex",
16
68
  "min-w-0 items-center overflow-clip",
17
69
  "hover:border-numeric-input-border-hover",
18
70
  "focus-within:border-numeric-input-border-focus",
19
71
  "data-disabled:bg-numeric-input-bg-disabled",
20
72
  "data-disabled:border-numeric-input-border-disabled",
21
73
  "data-disabled:text-numeric-input-fg-disabled",
22
- "data-invalid:bg-numeric-input-bg-invalid",
23
- "data-invalid:border-(length:--border-width-validation)",
24
- "data-invalid:border-numeric-input-border-invalid",
25
74
  "text-numeric-input-fg",
26
75
  "has-[input:not(:disabled):hover]:bg-numeric-input-input-bg-hover",
27
76
  "has-[input:focus]:bg-numeric-input-input-bg-focus",
@@ -31,81 +80,199 @@ const numericInputVariants = tv({
31
80
  "transition-colors duration-200 motion-reduce:transition-none"
32
81
  ],
33
82
  input: [
34
- "h-full rounded-none border-none",
83
+ "h-full min-w-0 flex-1 rounded-none border-none",
35
84
  "bg-numeric-input-input-bg",
36
- "focus:bg-numeric-input-input-bg-focus",
37
- "hover:bg-numeric-input-input-bg-hover",
85
+ "focus:bg-numeric-input-input-bg",
86
+ "hover:bg-numeric-input-input-bg",
38
87
  "disabled:hover:bg-numeric-input-input-bg",
39
88
  "disabled:cursor-not-allowed",
40
89
  "focus-visible:outline-hidden",
41
90
  "duration-0 data-invalid:focus:border-input-border-danger-focus"
42
91
  ],
43
92
  triggerContainer: [
44
- "flex flex-col gap-px self-stretch",
45
- "border-numeric-input-border border-s"
93
+ "flex shrink-0 flex-row self-stretch",
94
+ "border-numeric-input-border border-s group-data-disabled:border-numeric-input-border-disabled"
46
95
  ],
47
96
  trigger: [
48
- "flex flex-1 place-items-center",
49
- "px-numeric-input-trigger-x py-numeric-input-trigger-y",
50
- "bg-transparent hover:bg-icon-control-bg-hover active:bg-icon-control-bg-active",
51
- "text-icon-control-fg",
97
+ "flex min-h-numeric-input-trigger-min min-w-numeric-input-trigger-min flex-1 place-items-center",
98
+ "pointer-coarse:min-w-numeric-input-trigger-touch-min",
99
+ "py-numeric-input-trigger-y",
100
+ "bg-transparent hover:bg-numeric-input-trigger-bg-hover active:bg-numeric-input-trigger-bg-active",
101
+ "text-numeric-input-trigger-fg",
52
102
  "cursor-pointer",
53
103
  "transition-colors duration-200 motion-reduce:transition-none",
54
- "disabled:cursor-not-allowed disabled:text-icon-control-fg-disabled"
104
+ "disabled:cursor-not-allowed disabled:text-numeric-input-trigger-fg-disabled"
55
105
  ],
106
+ triggerIcon: "",
56
107
  scrubber: "absolute inset-0 cursor-ew-resize"
57
108
  },
58
109
  variants: {
110
+ density: {
111
+ default: {
112
+ container: "border-numeric-input-border",
113
+ trigger: "px-numeric-input-trigger-x"
114
+ },
115
+ compact: {
116
+ container: "border-numeric-input-compact-border",
117
+ trigger: "px-numeric-input-compact-trigger"
118
+ }
119
+ },
59
120
  size: {
60
121
  sm: {
61
122
  root: "gap-numeric-input-sm text-numeric-input-sm",
62
- container: "h-form-control-sm rounded-numeric-input-sm",
123
+ container: "rounded-numeric-input-sm",
63
124
  trigger: "text-numeric-input-sm",
64
- input: "ps-numeric-input-input-sm text-numeric-input-sm"
125
+ triggerIcon: "numeric-input-trigger-icon-sm",
126
+ input: "text-numeric-input-sm"
65
127
  },
66
128
  md: {
67
129
  root: "gap-numeric-input-md text-numeric-input-md",
68
- container: "h-form-control-md rounded-numeric-input-md",
130
+ container: "rounded-numeric-input-md",
69
131
  trigger: "text-numeric-input-md",
70
- input: "ps-numeric-input-input-md text-numeric-input-md"
132
+ triggerIcon: "numeric-input-trigger-icon-md",
133
+ input: "text-numeric-input-md"
71
134
  },
72
135
  lg: {
73
136
  root: "gap-numeric-input-lg text-numeric-input-lg",
74
- container: "h-form-control-lg rounded-numeric-input-lg",
137
+ container: "rounded-numeric-input-lg",
75
138
  trigger: "text-numeric-input-lg",
76
- input: "ps-numeric-input-input-lg text-numeric-input-lg"
139
+ triggerIcon: "numeric-input-trigger-icon-lg",
140
+ input: "text-numeric-input-lg"
77
141
  }
78
142
  }
79
143
  },
144
+ compoundVariants: [
145
+ {
146
+ density: "default",
147
+ size: "sm",
148
+ className: {
149
+ container: "h-form-control-sm",
150
+ input: "ps-numeric-input-input-sm"
151
+ }
152
+ },
153
+ {
154
+ density: "default",
155
+ size: "md",
156
+ className: {
157
+ container: "h-form-control-md",
158
+ input: "ps-numeric-input-input-md"
159
+ }
160
+ },
161
+ {
162
+ density: "default",
163
+ size: "lg",
164
+ className: {
165
+ container: "h-form-control-lg",
166
+ input: "ps-numeric-input-input-lg"
167
+ }
168
+ },
169
+ {
170
+ density: "compact",
171
+ size: "sm",
172
+ className: {
173
+ container: "h-numeric-input-compact-sm",
174
+ input: "ps-numeric-input-compact-sm"
175
+ }
176
+ },
177
+ {
178
+ density: "compact",
179
+ size: "md",
180
+ className: {
181
+ container: "h-numeric-input-compact-md",
182
+ input: "ps-numeric-input-compact-md"
183
+ }
184
+ },
185
+ {
186
+ density: "compact",
187
+ size: "lg",
188
+ className: {
189
+ container: "h-numeric-input-compact-lg",
190
+ input: "ps-numeric-input-compact-lg"
191
+ }
192
+ }
193
+ ],
80
194
  defaultVariants: {
195
+ density: "default",
81
196
  size: "md"
82
197
  }
83
198
  });
84
- const triggerIconSizes = {
85
- sm: "xs",
86
- md: "sm",
87
- lg: "md"
88
- };
199
+ const numericDraftPattern = /^[+-]?\d*(?:\.\d*)?$/;
89
200
  const NumericInputContext = /*#__PURE__*/ createContext(null);
90
201
  function useNumericInputContext() {
91
202
  const context = useContext(NumericInputContext);
92
203
  if (!context) throw new Error("NumericInput components must be used within NumericInput.Root");
93
204
  return context;
94
205
  }
95
- function NumericInput({ id, size, value, defaultValue, onChange, dir = "ltr", describedBy, precision, children, ref, className, locale = "cs-CZ", ...props }) {
206
+ function NumericInput({ density, id, size, value, defaultValue, onChange, validateStatus = "default", dir = "ltr", describedBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, precision, children, ref, className, locale = "cs-CZ", ...props }) {
96
207
  const generatedId = useId();
208
+ const [inputId, setInputId] = useState();
209
+ const description = useDescribedBy();
210
+ const errors = useDescribedBy();
97
211
  const [machineProps, elementProps] = __rspack_external__zag_js_number_input_f1a1f439.splitProps(props);
98
- const { formatOptions, invalid, disabled = false, required = false, step = 1, allowMouseWheel = true, clampValueOnBlur = true, spinOnPress = true, focusInputOnChange = true } = machineProps;
99
- const resolvedFormatOptions = precision ? {
212
+ const { formatOptions, invalid: machineInvalid, disabled = false, required = false, step = 1, allowMouseWheel = true, clampValueOnBlur = true, spinOnPress = true, focusInputOnChange = true } = machineProps;
213
+ const invalid = "error" === validateStatus || machineInvalid || void 0 !== ariaInvalid && false !== ariaInvalid && "false" !== ariaInvalid;
214
+ const resolvedFormatOptions = void 0 === precision ? formatOptions : {
100
215
  ...formatOptions ?? {},
216
+ minimumFractionDigits: Math.min(formatOptions?.minimumFractionDigits ?? 0, precision),
101
217
  maximumFractionDigits: precision
102
- } : formatOptions;
218
+ };
103
219
  const formatValue = (inputValue)=>{
220
+ if ("number" == typeof inputValue && !Number.isFinite(inputValue)) return "";
104
221
  if ("string" == typeof inputValue || !resolvedFormatOptions) return String(inputValue);
105
222
  return new Intl.NumberFormat(locale, resolvedFormatOptions).format(inputValue);
106
223
  };
107
- const service = useMachine(__rspack_external__zag_js_number_input_f1a1f439.machine, {
224
+ const parseDraft = useRef(Number.parseFloat);
225
+ const [editing] = useState(()=>createNumericInputEditing((draft)=>parseDraft.current(draft)));
226
+ const [, refreshNativeValue] = useState(0);
227
+ const controlledValue = void 0 === value ? void 0 : formatValue(value);
228
+ const resolvedValue = editing.resolve(controlledValue, value);
229
+ const coordinatedMachine = useMemo(()=>{
230
+ const actions = readOnlySafeMachine.implementations?.actions ?? {};
231
+ const authoritativeAction = (action)=>(params)=>{
232
+ if (!(params.prop("readOnly") || params.computed("isDisabled"))) editing.reset();
233
+ action?.(params);
234
+ };
235
+ return {
236
+ ...readOnlySafeMachine,
237
+ implementations: {
238
+ ...readOnlySafeMachine.implementations,
239
+ effects: {
240
+ ...readOnlySafeMachine.implementations?.effects,
241
+ trackFormControl ({ scope, context, prop, action }) {
242
+ const root = scope.getById(scope.ids?.root ?? `number-input:${scope.id}`);
243
+ return trackChoiceFormControl(root, ()=>{
244
+ editing.reset();
245
+ flushSync(()=>refreshNativeValue((current)=>current + 1));
246
+ if (void 0 === prop("value")) runSilentChoiceReset(context, ()=>context.set("value", context.initial("value")));
247
+ action([
248
+ "syncInputElement"
249
+ ]);
250
+ }, (fieldsetDisabled)=>context.set("fieldsetDisabled", fieldsetDisabled));
251
+ }
252
+ },
253
+ actions: {
254
+ ...actions,
255
+ syncInputElement ({ scope, context, computed, event }) {
256
+ if (editing.nativeOwnsValue) return;
257
+ const input = scope.getById(scope.ids?.input ?? `number-input:${scope.id}:input`);
258
+ const nextValue = event.type.endsWith("CHANGE") ? context.get("value") : computed("formattedValue");
259
+ if (input) editing.schedule(input, ()=>syncNumericInputValue(input, nextValue));
260
+ },
261
+ increment: authoritativeAction(actions.increment),
262
+ decrement: authoritativeAction(actions.decrement),
263
+ incrementToMax: authoritativeAction(actions.incrementToMax),
264
+ decrementToMin: authoritativeAction(actions.decrementToMin),
265
+ setRawValue: authoritativeAction(actions.setRawValue),
266
+ clearValue: authoritativeAction(actions.clearValue)
267
+ }
268
+ }
269
+ };
270
+ }, [
271
+ editing
272
+ ]);
273
+ const service = useMachine(coordinatedMachine, {
108
274
  ...machineProps,
275
+ invalid,
109
276
  disabled,
110
277
  required,
111
278
  step,
@@ -114,24 +281,74 @@ function NumericInput({ id, size, value, defaultValue, onChange, dir = "ltr", de
114
281
  spinOnPress,
115
282
  focusInputOnChange,
116
283
  id: id || generatedId,
117
- ids: id ? {
284
+ ids: inputId || id ? {
118
285
  ...machineProps.ids,
119
- input: machineProps.ids?.input ?? id
286
+ input: inputId ?? machineProps.ids?.input ?? id
120
287
  } : machineProps.ids,
121
288
  dir,
122
289
  locale,
123
- value: void 0 !== value ? formatValue(value) : void 0,
124
- defaultValue: void 0 !== defaultValue ? formatValue(defaultValue) : void 0,
290
+ value: resolvedValue,
291
+ defaultValue: void 0 === defaultValue ? void 0 : formatValue(defaultValue),
125
292
  formatOptions: resolvedFormatOptions,
126
293
  onValueChange: (details)=>{
294
+ if (isSilentChoiceReset(service.context)) return;
295
+ editing.propose(details.value);
127
296
  onChange?.(details.valueAsNumber);
128
297
  machineProps.onValueChange?.(details);
129
298
  }
130
299
  });
300
+ parseDraft.current = (draft)=>resolvedFormatOptions ? service.computed("parser").parse(draft) : Number.parseFloat(draft);
301
+ useLayoutEffect(()=>{
302
+ if (!editing.reconcile(controlledValue, value)) return;
303
+ const input = service.scope.getById(service.scope.ids?.input ?? `number-input:${service.scope.id}:input`);
304
+ if (input && void 0 !== controlledValue) syncNumericInputValue(input, controlledValue);
305
+ });
306
+ const onNativeCommit = ()=>{
307
+ editing.commit();
308
+ flushSync(()=>refreshNativeValue((current)=>current + 1));
309
+ };
310
+ const onNativeInput = (input)=>{
311
+ if (machineProps.readOnly || service.computed("isDisabled")) return;
312
+ const draft = input.value;
313
+ editing.edit(draft);
314
+ service.send({
315
+ type: "INPUT.CHANGE",
316
+ value: draft,
317
+ hint: "set"
318
+ });
319
+ flushSync(()=>{
320
+ service.context.set("value", draft);
321
+ refreshNativeValue((current)=>current + 1);
322
+ });
323
+ };
324
+ let isValidInputDraft;
325
+ if (resolvedFormatOptions) {
326
+ if (0 === resolvedFormatOptions.maximumFractionDigits && (!resolvedFormatOptions.style || "decimal" === resolvedFormatOptions.style)) {
327
+ const separator = new Intl.NumberFormat(locale).formatToParts(1.1).find((part)=>"decimal" === part.type)?.value;
328
+ if (separator) isValidInputDraft = (draft)=>{
329
+ const integerDraft = draft.replace(separator, "");
330
+ return !integerDraft.includes(separator) && service.computed("parser").isValidPartialNumber(integerDraft);
331
+ };
332
+ }
333
+ } else isValidInputDraft = (draft)=>numericDraftPattern.test(draft);
131
334
  const api = __rspack_external__zag_js_number_input_f1a1f439.connect(service, normalizeProps);
132
335
  useEffect(()=>{
133
- const inputId = api.getInputProps().id;
134
- const input = inputId ? service.scope.getById(inputId) : null;
336
+ if (machineProps.readOnly || disabled) {
337
+ service.send({
338
+ type: "TRIGGER.PRESS_UP"
339
+ });
340
+ service.send({
341
+ type: "SCRUBBER.POINTER_UP"
342
+ });
343
+ }
344
+ }, [
345
+ machineProps.readOnly,
346
+ disabled,
347
+ service
348
+ ]);
349
+ useEffect(()=>{
350
+ const machineInputId = api.getInputProps().id;
351
+ const input = machineInputId ? service.scope.getById(machineInputId) : null;
135
352
  if (input && input === service.scope.getActiveElement() && !api.focused) service.send({
136
353
  type: "INPUT.FOCUS"
137
354
  });
@@ -140,6 +357,7 @@ function NumericInput({ id, size, value, defaultValue, onChange, dir = "ltr", de
140
357
  service
141
358
  ]);
142
359
  const styles = numericInputVariants({
360
+ density,
143
361
  size
144
362
  });
145
363
  const inputDisabled = api.getInputProps().disabled;
@@ -148,9 +366,20 @@ function NumericInput({ id, size, value, defaultValue, onChange, dir = "ltr", de
148
366
  api,
149
367
  size,
150
368
  styles,
151
- invalid,
152
- describedBy,
153
- controlledValue: "string" == typeof value ? value : void 0
369
+ invalid: invalid || Boolean(errors.describedById),
370
+ validateStatus: invalid || errors.describedById ? "error" : validateStatus,
371
+ describedBy: joinDescribedBy(describedBy, ariaDescribedBy),
372
+ description,
373
+ errors,
374
+ errorMessageId: ariaErrorMessage,
375
+ readOnly: machineProps.readOnly,
376
+ disabled: inputDisabled,
377
+ controlledValue: resolvedValue,
378
+ editing,
379
+ onNativeInput,
380
+ onNativeCommit,
381
+ setInputId,
382
+ isValidInputDraft
154
383
  },
155
384
  children: /*#__PURE__*/ jsx("div", {
156
385
  className: styles.root({
@@ -168,7 +397,7 @@ function NumericInput({ id, size, value, defaultValue, onChange, dir = "ltr", de
168
397
  });
169
398
  }
170
399
  NumericInput.Control = function({ children, ref, className, ...props }) {
171
- const { api, styles, invalid } = useNumericInputContext();
400
+ const { api, styles, invalid, readOnly, disabled, validateStatus } = useNumericInputContext();
172
401
  return /*#__PURE__*/ jsx("div", {
173
402
  className: styles.container({
174
403
  className
@@ -176,12 +405,22 @@ NumericInput.Control = function({ children, ref, className, ...props }) {
176
405
  ref: ref,
177
406
  ...api.getControlProps(),
178
407
  ...props,
408
+ "data-disabled": disabled ? "" : void 0,
179
409
  "data-invalid": invalid || void 0,
410
+ "data-readonly": readOnly ? "" : void 0,
411
+ "data-validation": "default" === validateStatus ? void 0 : validateStatus,
180
412
  children: children
181
413
  });
182
414
  };
183
- NumericInput.Input = function({ ref, className, ...props }) {
184
- const { api, styles, describedBy, controlledValue } = useNumericInputContext();
415
+ NumericInput.Input = function({ ref, id, className, ...props }) {
416
+ const { api, styles, size, describedBy, controlledValue, editing, onNativeInput, onNativeCommit, setInputId, isValidInputDraft, description, errors, errorMessageId, invalid, readOnly, disabled } = useNumericInputContext();
417
+ useLayoutEffect(()=>{
418
+ setInputId(id);
419
+ return ()=>setInputId(void 0);
420
+ }, [
421
+ id,
422
+ setInputId
423
+ ]);
185
424
  const inputRef = useRef(null);
186
425
  const mergedRef = useMemo(()=>(node)=>{
187
426
  inputRef.current = node;
@@ -197,56 +436,71 @@ NumericInput.Input = function({ ref, className, ...props }) {
197
436
  ref
198
437
  ]);
199
438
  useLayoutEffect(()=>{
200
- if (void 0 === controlledValue) return;
201
- const view = inputRef.current?.ownerDocument.defaultView;
202
- if (!view) return;
203
- let cancelled = false;
204
- let frame;
205
- queueMicrotask(()=>{
206
- if (cancelled) return;
207
- frame = view.requestAnimationFrame(()=>{
208
- const input = inputRef.current;
209
- if (!input || input.value === controlledValue) return;
210
- const start = input.selectionStart;
211
- const end = input.selectionEnd;
212
- const direction = input.selectionDirection;
213
- input.value = controlledValue;
214
- if (input.ownerDocument.activeElement === input && null !== start && null !== end) input.setSelectionRange(Math.min(start, controlledValue.length), Math.min(end, controlledValue.length), direction ?? void 0);
215
- });
216
- });
217
- return ()=>{
218
- cancelled = true;
219
- if (void 0 !== frame) view.cancelAnimationFrame(frame);
220
- };
439
+ const input = inputRef.current;
440
+ const cancel = input && void 0 !== controlledValue ? editing.schedule(input, ()=>{
441
+ if (input.value !== controlledValue) syncNumericInputValue(input, controlledValue);
442
+ }) : void 0;
443
+ return ()=>cancel?.();
221
444
  }, [
222
445
  api,
223
- controlledValue
446
+ controlledValue,
447
+ editing
224
448
  ]);
225
- const ariaDescribedBy = [
226
- props["aria-describedby"],
227
- describedBy
228
- ].filter(Boolean).join(" ") || void 0;
449
+ const ariaDescribedBy = joinDescribedBy(props["aria-describedby"], describedBy, description.describedById);
450
+ const errorId = joinDescribedBy(props["aria-errormessage"], errorMessageId, errors.describedById);
451
+ const isInvalid = invalid || Boolean(errors.describedById) || props["aria-invalid"];
452
+ const machineInputProps = api.getInputProps();
453
+ const inputProps = mergeChoiceInputProps(props, {
454
+ ...machineInputProps,
455
+ onChange (event) {
456
+ onNativeInput(event.currentTarget);
457
+ },
458
+ onBlur (event) {
459
+ onNativeCommit();
460
+ machineInputProps.onBlur?.(event);
461
+ },
462
+ onKeyDown (event) {
463
+ if ("Enter" === event.key) onNativeCommit();
464
+ machineInputProps.onKeyDown?.(event);
465
+ },
466
+ onBeforeInput (event) {
467
+ if (!isValidInputDraft) return void machineInputProps.onBeforeInput?.(event);
468
+ const nativeEvent = event.nativeEvent;
469
+ if (nativeEvent.isComposing || nativeEvent.inputType?.startsWith("delete")) return;
470
+ const input = event.currentTarget;
471
+ const nextValue = input.value.slice(0, input.selectionStart ?? 0) + (nativeEvent.data ?? event.data ?? "") + input.value.slice(input.selectionEnd ?? 0);
472
+ if (!isValidInputDraft(nextValue)) event.preventDefault();
473
+ }
474
+ });
229
475
  return /*#__PURE__*/ jsx(Input, {
230
476
  ref: void 0 === controlledValue ? ref : mergedRef,
231
- ...api.getInputProps(),
232
- ...props,
477
+ ...inputProps,
233
478
  "aria-describedby": ariaDescribedBy,
479
+ "aria-errormessage": errorId,
480
+ "aria-invalid": isInvalid || void 0,
234
481
  className: styles.input({
235
482
  className
236
- })
483
+ }),
484
+ disabled: disabled || props.disabled,
485
+ id: id ?? machineInputProps.id,
486
+ readOnly: readOnly || props.readOnly,
487
+ size: size
237
488
  });
238
489
  };
239
490
  NumericInput.IncrementTrigger = function({ variant = "primary", theme = "borderless", icon = "token-icon-numeric-input-increment", iconPosition = "left", iconSize, uppercase, block, isLoading, loadingText, ref, className, children, ...props }) {
240
- const { api, styles, size } = useNumericInputContext();
241
- const resolvedIconSize = iconSize ?? triggerIconSizes[size ?? "md"];
491
+ const { api, styles, readOnly, disabled } = useNumericInputContext();
492
+ if (readOnly) return null;
242
493
  return /*#__PURE__*/ jsx(Button, {
243
494
  block: block,
244
495
  className: styles.trigger({
245
- className
496
+ className: [
497
+ void 0 === iconSize && styles.triggerIcon(),
498
+ className
499
+ ]
246
500
  }),
247
501
  icon: icon,
248
502
  iconPosition: iconPosition,
249
- iconSize: resolvedIconSize,
503
+ iconSize: iconSize ?? "current",
250
504
  isLoading: isLoading,
251
505
  loadingText: loadingText,
252
506
  ref: ref,
@@ -256,20 +510,25 @@ NumericInput.IncrementTrigger = function({ variant = "primary", theme = "borderl
256
510
  variant: variant,
257
511
  ...api.getIncrementTriggerProps(),
258
512
  ...props,
513
+ "data-readonly-affordance": "",
514
+ disabled: api.getIncrementTriggerProps().disabled || disabled || props.disabled,
259
515
  children: children
260
516
  });
261
517
  };
262
518
  NumericInput.DecrementTrigger = function({ variant = "primary", theme = "borderless", icon = "token-icon-numeric-input-decrement", iconPosition = "left", iconSize, uppercase, block, isLoading, loadingText, ref, className, children, ...props }) {
263
- const { api, styles, size } = useNumericInputContext();
264
- const resolvedIconSize = iconSize ?? triggerIconSizes[size ?? "md"];
519
+ const { api, styles, readOnly, disabled } = useNumericInputContext();
520
+ if (readOnly) return null;
265
521
  return /*#__PURE__*/ jsx(Button, {
266
522
  block: block,
267
523
  className: styles.trigger({
268
- className
524
+ className: [
525
+ void 0 === iconSize && styles.triggerIcon(),
526
+ className
527
+ ]
269
528
  }),
270
529
  icon: icon,
271
530
  iconPosition: iconPosition,
272
- iconSize: resolvedIconSize,
531
+ iconSize: iconSize ?? "current",
273
532
  isLoading: isLoading,
274
533
  loadingText: loadingText,
275
534
  ref: ref,
@@ -279,11 +538,14 @@ NumericInput.DecrementTrigger = function({ variant = "primary", theme = "borderl
279
538
  variant: variant,
280
539
  ...api.getDecrementTriggerProps(),
281
540
  ...props,
541
+ "data-readonly-affordance": "",
542
+ disabled: api.getDecrementTriggerProps().disabled || disabled || props.disabled,
282
543
  children: children
283
544
  });
284
545
  };
285
546
  NumericInput.Scrubber = function({ ref, className, ...props }) {
286
- const { api, styles } = useNumericInputContext();
547
+ const { api, styles, readOnly, disabled } = useNumericInputContext();
548
+ if (readOnly || disabled) return null;
287
549
  return /*#__PURE__*/ jsx("div", {
288
550
  className: styles.scrubber({
289
551
  className
@@ -294,7 +556,8 @@ NumericInput.Scrubber = function({ ref, className, ...props }) {
294
556
  });
295
557
  };
296
558
  NumericInput.TriggerContainer = function({ children, ref, className, ...props }) {
297
- const { styles } = useNumericInputContext();
559
+ const { styles, readOnly } = useNumericInputContext();
560
+ if (readOnly) return null;
298
561
  return /*#__PURE__*/ jsx("div", {
299
562
  className: styles.triggerContainer({
300
563
  className
@@ -304,5 +567,20 @@ NumericInput.TriggerContainer = function({ children, ref, className, ...props })
304
567
  children: children
305
568
  });
306
569
  };
570
+ const ignoreDescription = ()=>()=>{};
571
+ NumericInput.StatusText = function({ id, status = "default", size, showIcon, ...props }) {
572
+ const generatedId = useId();
573
+ const messageId = id || generatedId;
574
+ const { size: fieldSize, description, errors } = useNumericInputContext();
575
+ useRegisterDescription(messageId, description.registerDescription);
576
+ useRegisterDescription(messageId, "error" === status ? errors.registerDescription : ignoreDescription);
577
+ return /*#__PURE__*/ jsx(StatusText, {
578
+ ...props,
579
+ id: messageId,
580
+ showIcon: "default" !== status || showIcon,
581
+ size: size ?? fieldSize,
582
+ status: status
583
+ });
584
+ };
307
585
  NumericInput.displayName = "NumericInput";
308
586
  export { NumericInput };