@central-ui/react 0.0.0-stage → 0.1.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 (292) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -2
  3. package/dist/components/accordion/index.d.ts +73 -0
  4. package/dist/components/accordion/index.d.ts.map +1 -0
  5. package/dist/components/accordion/index.js +92 -0
  6. package/dist/components/accordion/index.js.map +1 -0
  7. package/dist/components/autocomplete/index.d.ts +365 -0
  8. package/dist/components/autocomplete/index.d.ts.map +1 -0
  9. package/dist/components/autocomplete/index.js +369 -0
  10. package/dist/components/autocomplete/index.js.map +1 -0
  11. package/dist/components/avatar/index.d.ts +48 -0
  12. package/dist/components/avatar/index.d.ts.map +1 -0
  13. package/dist/components/avatar/index.js +60 -0
  14. package/dist/components/avatar/index.js.map +1 -0
  15. package/dist/components/badge/index.d.ts +29 -0
  16. package/dist/components/badge/index.d.ts.map +1 -0
  17. package/dist/components/badge/index.js +36 -0
  18. package/dist/components/badge/index.js.map +1 -0
  19. package/dist/components/banner/index.d.ts +71 -0
  20. package/dist/components/banner/index.d.ts.map +1 -0
  21. package/dist/components/banner/index.js +119 -0
  22. package/dist/components/banner/index.js.map +1 -0
  23. package/dist/components/breadcrumb/index.d.ts +31 -0
  24. package/dist/components/breadcrumb/index.d.ts.map +1 -0
  25. package/dist/components/breadcrumb/index.js +42 -0
  26. package/dist/components/breadcrumb/index.js.map +1 -0
  27. package/dist/components/button/index.d.ts +48 -0
  28. package/dist/components/button/index.d.ts.map +1 -0
  29. package/dist/components/button/index.js +60 -0
  30. package/dist/components/button/index.js.map +1 -0
  31. package/dist/components/card/index.d.ts +34 -0
  32. package/dist/components/card/index.d.ts.map +1 -0
  33. package/dist/components/card/index.js +45 -0
  34. package/dist/components/card/index.js.map +1 -0
  35. package/dist/components/checkbox/index.d.ts +66 -0
  36. package/dist/components/checkbox/index.d.ts.map +1 -0
  37. package/dist/components/checkbox/index.js +146 -0
  38. package/dist/components/checkbox/index.js.map +1 -0
  39. package/dist/components/chip/index.d.ts +26 -0
  40. package/dist/components/chip/index.d.ts.map +1 -0
  41. package/dist/components/chip/index.js +40 -0
  42. package/dist/components/chip/index.js.map +1 -0
  43. package/dist/components/combobox/index.d.ts +427 -0
  44. package/dist/components/combobox/index.d.ts.map +1 -0
  45. package/dist/components/combobox/index.js +416 -0
  46. package/dist/components/combobox/index.js.map +1 -0
  47. package/dist/components/datepicker/index.d.ts +297 -0
  48. package/dist/components/datepicker/index.d.ts.map +1 -0
  49. package/dist/components/datepicker/index.js +507 -0
  50. package/dist/components/datepicker/index.js.map +1 -0
  51. package/dist/components/dialog/index.d.ts +88 -0
  52. package/dist/components/dialog/index.d.ts.map +1 -0
  53. package/dist/components/dialog/index.js +102 -0
  54. package/dist/components/dialog/index.js.map +1 -0
  55. package/dist/components/divider/index.d.ts +21 -0
  56. package/dist/components/divider/index.d.ts.map +1 -0
  57. package/dist/components/divider/index.js +24 -0
  58. package/dist/components/divider/index.js.map +1 -0
  59. package/dist/components/drawer/index.d.ts +99 -0
  60. package/dist/components/drawer/index.d.ts.map +1 -0
  61. package/dist/components/drawer/index.js +137 -0
  62. package/dist/components/drawer/index.js.map +1 -0
  63. package/dist/components/empty/index.d.ts +40 -0
  64. package/dist/components/empty/index.d.ts.map +1 -0
  65. package/dist/components/empty/index.js +61 -0
  66. package/dist/components/empty/index.js.map +1 -0
  67. package/dist/components/fileupload/index.d.ts +107 -0
  68. package/dist/components/fileupload/index.d.ts.map +1 -0
  69. package/dist/components/fileupload/index.js +185 -0
  70. package/dist/components/fileupload/index.js.map +1 -0
  71. package/dist/components/form/index.d.ts +34 -0
  72. package/dist/components/form/index.d.ts.map +1 -0
  73. package/dist/components/form/index.js +35 -0
  74. package/dist/components/form/index.js.map +1 -0
  75. package/dist/components/input/index.d.ts +85 -0
  76. package/dist/components/input/index.d.ts.map +1 -0
  77. package/dist/components/input/index.js +249 -0
  78. package/dist/components/input/index.js.map +1 -0
  79. package/dist/components/menu/index.d.ts +115 -0
  80. package/dist/components/menu/index.d.ts.map +1 -0
  81. package/dist/components/menu/index.js +188 -0
  82. package/dist/components/menu/index.js.map +1 -0
  83. package/dist/components/metric/index.d.ts +24 -0
  84. package/dist/components/metric/index.d.ts.map +1 -0
  85. package/dist/components/metric/index.js +26 -0
  86. package/dist/components/metric/index.js.map +1 -0
  87. package/dist/components/numberinput/index.d.ts +105 -0
  88. package/dist/components/numberinput/index.d.ts.map +1 -0
  89. package/dist/components/numberinput/index.js +240 -0
  90. package/dist/components/numberinput/index.js.map +1 -0
  91. package/dist/components/otpinput/index.d.ts +63 -0
  92. package/dist/components/otpinput/index.d.ts.map +1 -0
  93. package/dist/components/otpinput/index.js +133 -0
  94. package/dist/components/otpinput/index.js.map +1 -0
  95. package/dist/components/page/index.d.ts +54 -0
  96. package/dist/components/page/index.d.ts.map +1 -0
  97. package/dist/components/page/index.js +100 -0
  98. package/dist/components/page/index.js.map +1 -0
  99. package/dist/components/passwordinput/index.d.ts +88 -0
  100. package/dist/components/passwordinput/index.d.ts.map +1 -0
  101. package/dist/components/passwordinput/index.js +251 -0
  102. package/dist/components/passwordinput/index.js.map +1 -0
  103. package/dist/components/popover/index.d.ts +67 -0
  104. package/dist/components/popover/index.d.ts.map +1 -0
  105. package/dist/components/popover/index.js +76 -0
  106. package/dist/components/popover/index.js.map +1 -0
  107. package/dist/components/radio/index.d.ts +90 -0
  108. package/dist/components/radio/index.d.ts.map +1 -0
  109. package/dist/components/radio/index.js +232 -0
  110. package/dist/components/radio/index.js.map +1 -0
  111. package/dist/components/ratinginput/index.d.ts +59 -0
  112. package/dist/components/ratinginput/index.d.ts.map +1 -0
  113. package/dist/components/ratinginput/index.js +88 -0
  114. package/dist/components/ratinginput/index.js.map +1 -0
  115. package/dist/components/select/index.d.ts +205 -0
  116. package/dist/components/select/index.d.ts.map +1 -0
  117. package/dist/components/select/index.js +234 -0
  118. package/dist/components/select/index.js.map +1 -0
  119. package/dist/components/skeleton/index.d.ts +19 -0
  120. package/dist/components/skeleton/index.d.ts.map +1 -0
  121. package/dist/components/skeleton/index.js +20 -0
  122. package/dist/components/skeleton/index.js.map +1 -0
  123. package/dist/components/slider/index.d.ts +72 -0
  124. package/dist/components/slider/index.d.ts.map +1 -0
  125. package/dist/components/slider/index.js +159 -0
  126. package/dist/components/slider/index.js.map +1 -0
  127. package/dist/components/spinner/index.d.ts +14 -0
  128. package/dist/components/spinner/index.d.ts.map +1 -0
  129. package/dist/components/spinner/index.js +15 -0
  130. package/dist/components/spinner/index.js.map +1 -0
  131. package/dist/components/splitter/index.d.ts +49 -0
  132. package/dist/components/splitter/index.d.ts.map +1 -0
  133. package/dist/components/splitter/index.js +67 -0
  134. package/dist/components/splitter/index.js.map +1 -0
  135. package/dist/components/stepper/index.d.ts +82 -0
  136. package/dist/components/stepper/index.d.ts.map +1 -0
  137. package/dist/components/stepper/index.js +100 -0
  138. package/dist/components/stepper/index.js.map +1 -0
  139. package/dist/components/switch/index.d.ts +57 -0
  140. package/dist/components/switch/index.d.ts.map +1 -0
  141. package/dist/components/switch/index.js +101 -0
  142. package/dist/components/switch/index.js.map +1 -0
  143. package/dist/components/table/index.d.ts +110 -0
  144. package/dist/components/table/index.d.ts.map +1 -0
  145. package/dist/components/table/index.js +211 -0
  146. package/dist/components/table/index.js.map +1 -0
  147. package/dist/components/tabs/index.d.ts +67 -0
  148. package/dist/components/tabs/index.d.ts.map +1 -0
  149. package/dist/components/tabs/index.js +78 -0
  150. package/dist/components/tabs/index.js.map +1 -0
  151. package/dist/components/textarea/index.d.ts +72 -0
  152. package/dist/components/textarea/index.d.ts.map +1 -0
  153. package/dist/components/textarea/index.js +205 -0
  154. package/dist/components/textarea/index.js.map +1 -0
  155. package/dist/components/textlink/index.d.ts +39 -0
  156. package/dist/components/textlink/index.d.ts.map +1 -0
  157. package/dist/components/textlink/index.js +42 -0
  158. package/dist/components/textlink/index.js.map +1 -0
  159. package/dist/components/toast/index.d.ts +111 -0
  160. package/dist/components/toast/index.d.ts.map +1 -0
  161. package/dist/components/toast/index.js +205 -0
  162. package/dist/components/toast/index.js.map +1 -0
  163. package/dist/components/toggle/index.d.ts +41 -0
  164. package/dist/components/toggle/index.d.ts.map +1 -0
  165. package/dist/components/toggle/index.js +78 -0
  166. package/dist/components/toggle/index.js.map +1 -0
  167. package/dist/components/tooltip/index.d.ts +44 -0
  168. package/dist/components/tooltip/index.d.ts.map +1 -0
  169. package/dist/components/tooltip/index.js +51 -0
  170. package/dist/components/tooltip/index.js.map +1 -0
  171. package/dist/index.d.ts +50 -0
  172. package/dist/index.d.ts.map +1 -0
  173. package/dist/index.js +46 -0
  174. package/dist/index.js.map +1 -0
  175. package/dist/types/Style.d.ts +14 -0
  176. package/dist/types/Style.d.ts.map +1 -0
  177. package/dist/types/Style.js +2 -0
  178. package/dist/types/Style.js.map +1 -0
  179. package/dist/types/Tone.d.ts +4 -0
  180. package/dist/types/Tone.d.ts.map +1 -0
  181. package/dist/types/Tone.js +2 -0
  182. package/dist/types/Tone.js.map +1 -0
  183. package/dist/utils/ArkStateToDataAttributes.d.ts +4 -0
  184. package/dist/utils/ArkStateToDataAttributes.d.ts.map +1 -0
  185. package/dist/utils/ArkStateToDataAttributes.js +9 -0
  186. package/dist/utils/ArkStateToDataAttributes.js.map +1 -0
  187. package/dist/utils/Tone.d.ts +3 -0
  188. package/dist/utils/Tone.d.ts.map +1 -0
  189. package/dist/utils/Tone.js +7 -0
  190. package/dist/utils/Tone.js.map +1 -0
  191. package/dist/utils/useForwardClickToInput.d.ts +4 -0
  192. package/dist/utils/useForwardClickToInput.d.ts.map +1 -0
  193. package/dist/utils/useForwardClickToInput.js +27 -0
  194. package/dist/utils/useForwardClickToInput.js.map +1 -0
  195. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +198 -0
  196. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +1 -0
  197. package/dist/utils/virtualization/useVirtualizedAutocomplete.js +180 -0
  198. package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +1 -0
  199. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +200 -0
  200. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +1 -0
  201. package/dist/utils/virtualization/useVirtualizedCombobox.js +174 -0
  202. package/dist/utils/virtualization/useVirtualizedCombobox.js.map +1 -0
  203. package/dist/utils/virtualization/useVirtualizedTable.d.ts +169 -0
  204. package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +1 -0
  205. package/dist/utils/virtualization/useVirtualizedTable.js +127 -0
  206. package/dist/utils/virtualization/useVirtualizedTable.js.map +1 -0
  207. package/package.json +64 -4
  208. package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -0
  209. package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +155 -0
  210. package/src/presets/shopify-polaris/shopify-polaris-avatar.css +47 -0
  211. package/src/presets/shopify-polaris/shopify-polaris-badge.css +27 -0
  212. package/src/presets/shopify-polaris/shopify-polaris-banner.css +111 -0
  213. package/src/presets/shopify-polaris/shopify-polaris-breadcrumb.css +16 -0
  214. package/src/presets/shopify-polaris/shopify-polaris-button.css +79 -0
  215. package/src/presets/shopify-polaris/shopify-polaris-card.css +28 -0
  216. package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +52 -0
  217. package/src/presets/shopify-polaris/shopify-polaris-chip.css +16 -0
  218. package/src/presets/shopify-polaris/shopify-polaris-combobox.css +179 -0
  219. package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +183 -0
  220. package/src/presets/shopify-polaris/shopify-polaris-dialog.css +40 -0
  221. package/src/presets/shopify-polaris/shopify-polaris-divider.css +12 -0
  222. package/src/presets/shopify-polaris/shopify-polaris-drawer.css +40 -0
  223. package/src/presets/shopify-polaris/shopify-polaris-empty.css +32 -0
  224. package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +78 -0
  225. package/src/presets/shopify-polaris/shopify-polaris-form.css +8 -0
  226. package/src/presets/shopify-polaris/shopify-polaris-input.css +72 -0
  227. package/src/presets/shopify-polaris/shopify-polaris-menu.css +112 -0
  228. package/src/presets/shopify-polaris/shopify-polaris-metric.css +16 -0
  229. package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +88 -0
  230. package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +42 -0
  231. package/src/presets/shopify-polaris/shopify-polaris-page.css +69 -0
  232. package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +76 -0
  233. package/src/presets/shopify-polaris/shopify-polaris-popover.css +47 -0
  234. package/src/presets/shopify-polaris/shopify-polaris-radio.css +54 -0
  235. package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +42 -0
  236. package/src/presets/shopify-polaris/shopify-polaris-select.css +119 -0
  237. package/src/presets/shopify-polaris/shopify-polaris-skeleton.css +8 -0
  238. package/src/presets/shopify-polaris/shopify-polaris-slider.css +86 -0
  239. package/src/presets/shopify-polaris/shopify-polaris-spinner.css +16 -0
  240. package/src/presets/shopify-polaris/shopify-polaris-splitter.css +34 -0
  241. package/src/presets/shopify-polaris/shopify-polaris-stepper.css +55 -0
  242. package/src/presets/shopify-polaris/shopify-polaris-switch.css +38 -0
  243. package/src/presets/shopify-polaris/shopify-polaris-table.css +72 -0
  244. package/src/presets/shopify-polaris/shopify-polaris-tabs.css +33 -0
  245. package/src/presets/shopify-polaris/shopify-polaris-textarea.css +61 -0
  246. package/src/presets/shopify-polaris/shopify-polaris-textlink.css +8 -0
  247. package/src/presets/shopify-polaris/shopify-polaris-toggle.css +52 -0
  248. package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +31 -0
  249. package/src/presets/shopify-polaris/shopify-polaris.css +380 -0
  250. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -0
  251. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +155 -0
  252. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-avatar.css +47 -0
  253. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-badge.css +27 -0
  254. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-banner.css +96 -0
  255. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-breadcrumb.css +16 -0
  256. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-button.css +68 -0
  257. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-card.css +28 -0
  258. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +52 -0
  259. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-chip.css +16 -0
  260. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +184 -0
  261. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +187 -0
  262. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +40 -0
  263. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-divider.css +12 -0
  264. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +40 -0
  265. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-empty.css +32 -0
  266. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +72 -0
  267. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-form.css +8 -0
  268. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +72 -0
  269. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +112 -0
  270. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-metric.css +16 -0
  271. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +88 -0
  272. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +42 -0
  273. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-page.css +69 -0
  274. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +76 -0
  275. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +47 -0
  276. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +54 -0
  277. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +42 -0
  278. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-select.css +118 -0
  279. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-skeleton.css +8 -0
  280. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +86 -0
  281. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-spinner.css +16 -0
  282. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-splitter.css +34 -0
  283. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +55 -0
  284. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +38 -0
  285. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-table.css +72 -0
  286. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tabs.css +33 -0
  287. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +61 -0
  288. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textlink.css +8 -0
  289. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-toast.css +43 -0
  290. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-toggle.css +52 -0
  291. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +31 -0
  292. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +381 -0
@@ -0,0 +1,24 @@
1
+ import type { StyleProps } from '../../types/Style.ts';
2
+ import type { HTMLAttributes } from 'react';
3
+ /**
4
+ * Compose Number and Unit inside Group to show a metric and its meaning. Number formats the supplied amount automatically; do not preformat it into text.
5
+ *
6
+ * @example Complete composition
7
+ * import { Metric } from '@central-ui/react'
8
+ *
9
+ * function Example() {
10
+ * return (
11
+ * <Metric.Group>
12
+ * <Metric.Number>{128}</Metric.Number>
13
+ * <Metric.Unit>orders this month</Metric.Unit>
14
+ * </Metric.Group>
15
+ * )
16
+ * }
17
+ */
18
+ export declare function Group({ disableStyle, className, ...props }: HTMLAttributes<HTMLDivElement> & StyleProps): import("react").JSX.Element;
19
+ export declare function Number({ disableStyle, children, className, ...props }: (Omit<HTMLAttributes<HTMLParagraphElement>, 'children'> & {
20
+ /** Pass the amount; locale number formatting is applied automatically. */
21
+ children: number;
22
+ }) & StyleProps): import("react").JSX.Element;
23
+ export declare function Unit({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/metric/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,EACpB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,UAAU,+BAS7C;AAED,wBAAgB,MAAM,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,EAAE,UAAU,CAAC,GAAG;IAC3D,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC,GACA,UAAU,+BAWX;AAED,wBAAgB,IAAI,CAAC,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,UAAU,+BASnD"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Compose Number and Unit inside Group to show a metric and its meaning. Number formats the supplied amount automatically; do not preformat it into text.
4
+ *
5
+ * @example Complete composition
6
+ * import { Metric } from '@central-ui/react'
7
+ *
8
+ * function Example() {
9
+ * return (
10
+ * <Metric.Group>
11
+ * <Metric.Number>{128}</Metric.Number>
12
+ * <Metric.Unit>orders this month</Metric.Unit>
13
+ * </Metric.Group>
14
+ * )
15
+ * }
16
+ */
17
+ export function Group({ disableStyle, className, ...props }) {
18
+ return (_jsx("div", { "data-component": "metric-group", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
19
+ }
20
+ export function Number({ disableStyle, children, className, ...props }) {
21
+ return (_jsx("p", { "data-component": "metric-number", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props, children: children.toLocaleString() }));
22
+ }
23
+ export function Unit({ disableStyle, className, ...props }) {
24
+ return (_jsx("p", { "data-component": "metric-unit", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/metric/index.tsx"],"names":[],"mappings":";AAIA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACoC;IAC5C,OAAO,CACL,gCACiB,cAAc,yBACR,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EAKE;IACV,OAAO,CACL,8BACiB,eAAe,yBACT,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,YAER,QAAQ,CAAC,cAAc,EAAE,GACxB,CACL,CAAA;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EAC0C;IAClD,OAAO,CACL,8BACiB,aAAa,yBACP,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,105 @@
1
+ import type { StyleProps } from '../../types/Style.ts';
2
+ import { NumberField as BaseNumber } from '@base-ui/react/number-field';
3
+ import type { LucideProps } from 'lucide-react';
4
+ import type { ComponentProps, ReactElement } from 'react';
5
+ export type RootProps = Omit<BaseNumber.Root.Props, 'className' | 'render'> & {
6
+ className?: string;
7
+ /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
8
+ tone?: 'neutral' | 'valid' | 'invalid';
9
+ };
10
+ /**
11
+ * Configure value, bounds, and step on Root. IncrementButton and DecrementButton update the number automatically; no custom arithmetic handlers needed. Use ButtonsList to organize them beside Input, or behavior-only handlers for custom buttons.
12
+ *
13
+ * @example Complete composition
14
+ * import { NumberInput } from '@central-ui/react'
15
+ *
16
+ * function Example() {
17
+ * return (
18
+ * <NumberInput.Root defaultValue={2} min={0} max={20} step={1} name="quantity">
19
+ * <NumberInput.Container>
20
+ * <NumberInput.Label>Quantity</NumberInput.Label>
21
+ * <NumberInput.InputGroup>
22
+ * <NumberInput.Input />
23
+ * <NumberInput.ButtonsList>
24
+ * <NumberInput.IncrementButton aria-label="Increase quantity">
25
+ * <NumberInput.IncrementButtonIcon />
26
+ * </NumberInput.IncrementButton>
27
+ * <NumberInput.DecrementButton aria-label="Decrease quantity">
28
+ * <NumberInput.DecrementButtonIcon />
29
+ * </NumberInput.DecrementButton>
30
+ * </NumberInput.ButtonsList>
31
+ * </NumberInput.InputGroup>
32
+ * <NumberInput.Description>Choose a quantity.</NumberInput.Description>
33
+ * </NumberInput.Container>
34
+ * </NumberInput.Root>
35
+ * )
36
+ * }
37
+ *
38
+ * @example Accept decimal increments
39
+ * // Bounds and step belong to Root, not custom increment/decrement click handlers.
40
+ * ;<NumberInput.Root min={0} max={10} step={0.25} defaultValue={1.5}>
41
+ * {
42
+ * // Rest of components here
43
+ * }
44
+ * </NumberInput.Root>
45
+ */
46
+ export declare const Root: import("react").ForwardRefExoticComponent<Omit<RootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
47
+ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldInputProps, "form" | "className" | "defaultValue" | "id" | "name" | "disabled" | "value" | "render" | "required" | "readOnly"> & {
48
+ className?: string;
49
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
50
+ export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
51
+ /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
52
+ export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
53
+ export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
54
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
55
+ export declare const Error: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
56
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
57
+ export declare const Success: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
58
+ export declare const Addon: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
59
+ /** Choose the preset appearance; this does not add action behavior. */
60
+ variant?: "normal" | "emphasized";
61
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
62
+ export declare const AddonText: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
63
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
64
+ export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
65
+ /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
66
+ children: ReactElement<ComponentProps<'svg'>>;
67
+ }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
68
+ export declare const AddonButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
69
+ /** Built-in icon; no children needed. Use it inside its matching control. */
70
+ export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<LucideProps, "children"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
71
+ export declare const InputGroup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldGroupProps, "className"> & {
72
+ className?: string;
73
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
74
+ export declare const ButtonsList: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
75
+ /** Formats the current number automatically. Omit children for the default display; customize only when the usual number formatting is insufficient. */
76
+ export declare const ValueText: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "children"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
77
+ export declare const IncrementButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldIncrementProps, "className"> & {
78
+ className?: string;
79
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
80
+ /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
81
+ export declare const IncrementHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldIncrementProps, "children" | "className" | "render"> & {
82
+ className?: string;
83
+ /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
84
+ children: ReactElement;
85
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
86
+ /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
87
+ export declare function IncrementButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
88
+ /** Omit for the supplied default icon; pass a child only to replace it. */
89
+ children?: ReactElement<ComponentProps<'svg'>>;
90
+ }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
91
+ export declare const DecrementButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldDecrementProps, "className"> & {
92
+ className?: string;
93
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
94
+ /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
95
+ export declare const DecrementHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldDecrementProps, "children" | "className" | "render"> & {
96
+ className?: string;
97
+ /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
98
+ children: ReactElement;
99
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
100
+ /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
101
+ export declare function DecrementButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
102
+ /** Omit for the supplied default icon; pass a child only to replace it. */
103
+ children?: ReactElement<ComponentProps<'svg'>>;
104
+ }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
105
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/numberinput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAW/C,OAAO,KAAK,EACV,cAAc,EAEd,YAAY,EAIb,MAAM,OAAO,CAAA;AAGd,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,GAAG;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACvC,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,IAAI,mHAkCf,CAAA;AACF,eAAO,MAAM,KAAK;gBAcE,MAAM;yEAwBxB,CAAA;AAEF,eAAO,MAAM,SAAS,uNAepB,CAAA;AACF,oHAAoH;AACpH,eAAO,MAAM,KAAK,oPA2BhB,CAAA;AAEF,eAAO,MAAM,WAAW,uNAiBtB,CAAA;AAEF,iHAAiH;AACjH,eAAO,MAAM,KAAK,uNAmBhB,CAAA;AAEF,iHAAiH;AACjH,eAAO,MAAM,OAAO,uNAmBlB,CAAA;AACF,eAAO,MAAM,KAAK;IAGd,uEAAuE;cAC7D,QAAQ,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,EACZ,QAA0B,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC5C,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;CAC/C,CAAC,GACA,UAAU,8GAqBX"}
@@ -0,0 +1,240 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { NumberField as BaseNumber } from '@base-ui/react/number-field';
3
+ import { ChevronUp, ChevronDown, LoaderCircle } from 'lucide-react';
4
+ import { useForwardClickToInput } from "../../utils/useForwardClickToInput.js";
5
+ import { cloneElement, createContext, forwardRef, useContext, useEffect, useId, useState, } from 'react';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
8
+ /**
9
+ * Configure value, bounds, and step on Root. IncrementButton and DecrementButton update the number automatically; no custom arithmetic handlers needed. Use ButtonsList to organize them beside Input, or behavior-only handlers for custom buttons.
10
+ *
11
+ * @example Complete composition
12
+ * import { NumberInput } from '@central-ui/react'
13
+ *
14
+ * function Example() {
15
+ * return (
16
+ * <NumberInput.Root defaultValue={2} min={0} max={20} step={1} name="quantity">
17
+ * <NumberInput.Container>
18
+ * <NumberInput.Label>Quantity</NumberInput.Label>
19
+ * <NumberInput.InputGroup>
20
+ * <NumberInput.Input />
21
+ * <NumberInput.ButtonsList>
22
+ * <NumberInput.IncrementButton aria-label="Increase quantity">
23
+ * <NumberInput.IncrementButtonIcon />
24
+ * </NumberInput.IncrementButton>
25
+ * <NumberInput.DecrementButton aria-label="Decrease quantity">
26
+ * <NumberInput.DecrementButtonIcon />
27
+ * </NumberInput.DecrementButton>
28
+ * </NumberInput.ButtonsList>
29
+ * </NumberInput.InputGroup>
30
+ * <NumberInput.Description>Choose a quantity.</NumberInput.Description>
31
+ * </NumberInput.Container>
32
+ * </NumberInput.Root>
33
+ * )
34
+ * }
35
+ *
36
+ * @example Accept decimal increments
37
+ * // Bounds and step belong to Root, not custom increment/decrement click handlers.
38
+ * ;<NumberInput.Root min={0} max={10} step={0.25} defaultValue={1.5}>
39
+ * {
40
+ * // Rest of components here
41
+ * }
42
+ * </NumberInput.Root>
43
+ */
44
+ export const Root = forwardRef(function Root({ id, tone = 'neutral', children, ...props }, ref) {
45
+ const generatedId = useId();
46
+ const inputId = id ?? generatedId;
47
+ const [connections, setConnections] = useState({
48
+ descriptionIds: [],
49
+ });
50
+ return (_jsx(ToneProvider, { value: tone, children: _jsx(BaseNumber.Root, { ...props, id: inputId, ref: ref, render: (rootProps, state) => (_jsx(InputContext.Provider, { value: {
51
+ ...state,
52
+ inputId,
53
+ connections,
54
+ setConnections,
55
+ min: props.min,
56
+ max: props.max,
57
+ }, children: _jsx("div", { ...rootProps }) })), children: children }) }));
58
+ });
59
+ export const Input = forwardRef(function Input({ disableStyle, className, 'aria-describedby': describedBy, ...props }, ref) {
60
+ const context = useInputContext();
61
+ const tone = useToneContext();
62
+ return (_jsx(BaseNumber.Input, { ...props, ref: ref, "data-tone": tone, "aria-invalid": tone === 'invalid' || props['aria-invalid'] || undefined, "aria-describedby": [describedBy, ...context.connections.descriptionIds]
63
+ .filter(Boolean)
64
+ .join(' ') || undefined, "data-component": "numberinput-input", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
65
+ });
66
+ export const Container = forwardRef(function Container({ disableStyle, className, ...props }, ref) {
67
+ const attributes = usePartAttributes();
68
+ return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "numberinput-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
69
+ });
70
+ /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
71
+ export const Label = forwardRef(function Label({ disableStyle, className, id, ...props }, ref) {
72
+ const context = useInputContext();
73
+ const labelId = id ?? context.inputId + '-label';
74
+ const attributes = usePartAttributes();
75
+ useEffect(() => {
76
+ context.setConnections((current) => ({ ...current, labelId }));
77
+ return () => context.setConnections((current) => ({
78
+ ...current,
79
+ labelId: current.labelId === labelId ? undefined : current.labelId,
80
+ }));
81
+ }, [labelId, context.setConnections]);
82
+ return (_jsx("label", { ...attributes, ...props, id: labelId, ref: ref, htmlFor: context.inputId, "data-component": "numberinput-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
83
+ });
84
+ export const Description = forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
85
+ const messageId = useMessageId(id);
86
+ const attributes = usePartAttributes();
87
+ return (_jsx("div", { ...attributes, ...props, id: messageId, ref: ref, "data-component": "numberinput-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
88
+ });
89
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
90
+ export const Error = forwardRef(function Error({ disableStyle, className, id, ...props }, ref) {
91
+ const messageId = useMessageId(id);
92
+ const attributes = usePartAttributes();
93
+ return (_jsx("div", { role: "alert", "aria-atomic": "true", ...attributes, ...props, id: messageId, ref: ref, "data-component": "numberinput-error", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
94
+ });
95
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
96
+ export const Success = forwardRef(function Success({ disableStyle, className, id, ...props }, ref) {
97
+ const messageId = useMessageId(id);
98
+ const attributes = usePartAttributes();
99
+ return (_jsx("div", { role: "status", "aria-atomic": "true", ...attributes, ...props, id: messageId, ref: ref, "data-component": "numberinput-success", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
100
+ });
101
+ export const Addon = forwardRef(function Addon({ disableStyle, className, variant = 'normal', ...props }, ref) {
102
+ const attributes = usePartAttributes();
103
+ return (_jsx("div", { ...attributes, ...props, ref: ref, "data-variant": variant, "data-component": "numberinput-addon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
104
+ });
105
+ export const AddonText = forwardRef(function AddonText({ disableStyle, className, ...props }, ref) {
106
+ const attributes = usePartAttributes();
107
+ return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "numberinput-addontext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
108
+ });
109
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
110
+ export function AddonIcon({ disableStyle, children, className, ...props }) {
111
+ const attributes = usePartAttributes();
112
+ return cloneElement(children, {
113
+ ...attributes,
114
+ ...props,
115
+ 'aria-hidden': true,
116
+ strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 1.5,
117
+ ...{
118
+ 'data-component': 'numberinput-addonicon',
119
+ 'data-style-disabled': disableStyle ? '' : undefined,
120
+ },
121
+ className: twMerge(children.props.className, className),
122
+ });
123
+ }
124
+ export const AddonButton = forwardRef(function AddonButton({ disableStyle, className, disabled, type = 'button', ...props }, ref) {
125
+ const context = useInputContext();
126
+ const attributes = usePartAttributes();
127
+ return (_jsx("button", { ...attributes, ...props, ref: ref, type: type, disabled: disabled || context.disabled || context.readOnly, "data-component": "numberinput-addonbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
128
+ });
129
+ /** Built-in icon; no children needed. Use it inside its matching control. */
130
+ export const AddonLoadingIcon = forwardRef(function AddonLoadingIcon({ disableStyle, className, strokeWidth = 1.5, ...props }, ref) {
131
+ const attributes = usePartAttributes();
132
+ return (_jsx(LoaderCircle, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "numberinput-addonloadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
133
+ });
134
+ export const InputGroup = forwardRef(function InputGroup({ disableStyle, className, onClick, ...props }, ref) {
135
+ const attributes = usePartAttributes();
136
+ const forwardClick = useForwardClickToInput('input:not([type="hidden"])', onClick);
137
+ return (_jsx(BaseNumber.Group, { ...attributes, ...props, ref: ref, onClick: forwardClick, "data-component": "numberinput-inputgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
138
+ });
139
+ export const ButtonsList = forwardRef(function ButtonsList({ disableStyle, className, ...props }, ref) {
140
+ const attributes = usePartAttributes();
141
+ return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "numberinput-buttonslist", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
142
+ });
143
+ /** Formats the current number automatically. Omit children for the default display; customize only when the usual number formatting is insufficient. */
144
+ export const ValueText = forwardRef(function ValueText({ disableStyle, className, ...props }, ref) {
145
+ const context = useInputContext();
146
+ const attributes = usePartAttributes();
147
+ return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "numberinput-valuetext", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: context.inputValue }));
148
+ });
149
+ export const IncrementButton = forwardRef(function IncrementButton({ disableStyle, className, ...props }, ref) {
150
+ return (_jsx(BaseNumber.Increment, { ...props, ref: ref, "data-component": "numberinput-incrementbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
151
+ });
152
+ /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
153
+ export const IncrementHandler = forwardRef(function IncrementHandler({ children, ...props }, ref) {
154
+ return _jsx(BaseNumber.Increment, { ...props, ref: ref, render: children });
155
+ });
156
+ /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
157
+ export function IncrementButtonIcon({ disableStyle, children = _jsx(ChevronUp, {}), className, ...props }) {
158
+ const context = useInputContext();
159
+ const attributes = usePartAttributes();
160
+ const disabled = context.disabled ||
161
+ context.readOnly ||
162
+ (context.value !== null &&
163
+ context.max !== undefined &&
164
+ context.value >= context.max);
165
+ return cloneElement(children, {
166
+ ...attributes,
167
+ ...props,
168
+ ...{ ...{ 'data-disabled': disabled ? '' : undefined } },
169
+ 'aria-hidden': true,
170
+ strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 2,
171
+ ...{
172
+ 'data-component': 'numberinput-incrementbuttonicon',
173
+ 'data-style-disabled': disableStyle ? '' : undefined,
174
+ },
175
+ className: twMerge(children.props.className, className),
176
+ });
177
+ }
178
+ export const DecrementButton = forwardRef(function DecrementButton({ disableStyle, className, ...props }, ref) {
179
+ return (_jsx(BaseNumber.Decrement, { ...props, ref: ref, "data-component": "numberinput-decrementbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
180
+ });
181
+ /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
182
+ export const DecrementHandler = forwardRef(function DecrementHandler({ children, ...props }, ref) {
183
+ return _jsx(BaseNumber.Decrement, { ...props, ref: ref, render: children });
184
+ });
185
+ /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
186
+ export function DecrementButtonIcon({ disableStyle, children = _jsx(ChevronDown, {}), className, ...props }) {
187
+ const context = useInputContext();
188
+ const attributes = usePartAttributes();
189
+ const disabled = context.disabled ||
190
+ context.readOnly ||
191
+ (context.value !== null &&
192
+ context.min !== undefined &&
193
+ context.value <= context.min);
194
+ return cloneElement(children, {
195
+ ...attributes,
196
+ ...props,
197
+ ...{ 'data-disabled': disabled ? '' : undefined },
198
+ 'aria-hidden': true,
199
+ strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 2,
200
+ ...{
201
+ 'data-component': 'numberinput-decrementbuttonicon',
202
+ 'data-style-disabled': disableStyle ? '' : undefined,
203
+ },
204
+ className: twMerge(children.props.className, className),
205
+ });
206
+ }
207
+ const InputContext = createContext(null);
208
+ function useInputContext() {
209
+ const context = useContext(InputContext);
210
+ if (!context)
211
+ throw new globalThis.Error('Parts must be inside Root');
212
+ return context;
213
+ }
214
+ function usePartAttributes() {
215
+ const context = useInputContext();
216
+ const tone = useToneContext();
217
+ return {
218
+ 'data-disabled': context.disabled ? '' : undefined,
219
+ 'data-readonly': context.readOnly ? '' : undefined,
220
+ 'data-required': context.required ? '' : undefined,
221
+ 'data-tone': tone,
222
+ };
223
+ }
224
+ function useMessageId(id) {
225
+ const generatedId = useId();
226
+ const messageId = id ?? generatedId;
227
+ const context = useInputContext();
228
+ useEffect(() => {
229
+ context.setConnections((current) => ({
230
+ ...current,
231
+ descriptionIds: [...current.descriptionIds, messageId],
232
+ }));
233
+ return () => context.setConnections((current) => ({
234
+ ...current,
235
+ descriptionIds: current.descriptionIds.filter((id) => id !== messageId),
236
+ }));
237
+ }, [messageId, context.setConnections]);
238
+ return messageId;
239
+ }
240
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/numberinput/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,GACT,MAAM,OAAO,CAAA;AASd,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AAMnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAA4B,SAAS,IAAI,CACrE,EAAE,EAAE,EAAE,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAC5C,GAAG;IAEH,MAAM,WAAW,GAAG,KAAK,EAAE,CAAA;IAC3B,MAAM,OAAO,GAAG,EAAE,IAAI,WAAW,CAAA;IACjC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAc;QAC1D,cAAc,EAAE,EAAE;KACnB,CAAC,CAAA;IACF,OAAO,CACL,KAAC,YAAY,IAAC,KAAK,EAAE,IAAI,YACvB,KAAC,UAAU,CAAC,IAAI,OACV,KAAK,EACT,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EA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,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAClD,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAClD,WAAW,EAAE,IAAI;KAClB,CAAA;AACH,CAAC;AACD,SAAS,YAAY,CAAC,EAAW;IAC/B,MAAM,WAAW,GAAG,KAAK,EAAE,CAAA;IAC3B,MAAM,SAAS,GAAG,EAAE,IAAI,WAAW,CAAA;IACnC,MAAM,OAAO,GAAG,eAAe,EAAE,CAAA;IACjC,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnC,GAAG,OAAO;YACV,cAAc,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC;SACvD,CAAC,CAAC,CAAA;QACH,OAAO,GAAG,EAAE,CACV,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnC,GAAG,OAAO;YACV,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC;SACxE,CAAC,CAAC,CAAA;IACP,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;IACvC,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { StyleProps } from '../../types/Style.ts';
2
+ import { OTPField as BaseOtp } from '@base-ui/react/otp-field';
3
+ import type { ReactNode } from 'react';
4
+ export type RootProps = Omit<BaseOtp.Root.Props, 'className' | 'render'> & {
5
+ className?: string;
6
+ /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
7
+ tone?: 'neutral' | 'valid' | 'invalid';
8
+ };
9
+ /**
10
+ * Configure length and value on Root. Render an Input for each callback invocation from List; slot order is managed automatically. Keyboard navigation and paste distribution are built in; do not split or synchronize the code yourself.
11
+ *
12
+ * @example Complete composition
13
+ * import { OtpInput } from '@central-ui/react'
14
+ * import { Fragment } from 'react'
15
+ *
16
+ * function Example() {
17
+ * return (
18
+ * <OtpInput.Root length={6} name="code" defaultValue="123">
19
+ * <OtpInput.Container>
20
+ * <OtpInput.Label>Verification code</OtpInput.Label>
21
+ * <OtpInput.List>
22
+ * {(index) => (
23
+ * <Fragment key={index}>
24
+ * <OtpInput.Input />
25
+ * {index === 2 && <OtpInput.Separator />}
26
+ * </Fragment>
27
+ * )}
28
+ * </OtpInput.List>
29
+ * <OtpInput.Description>Enter the six-digit code.</OtpInput.Description>
30
+ * </OtpInput.Container>
31
+ * </OtpInput.Root>
32
+ * )
33
+ * }
34
+ *
35
+ * @example Hide the code while it is entered
36
+ * // Keep the same List; do not replace its Inputs with password inputs yourself.
37
+ * ;<OtpInput.Root length={6} mask>
38
+ * {
39
+ * // Rest of components here
40
+ * }
41
+ * </OtpInput.Root>
42
+ */
43
+ export declare const Root: import("react").ForwardRefExoticComponent<Omit<RootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
44
+ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").OTPFieldInputProps, "form" | "className" | "defaultValue" | "id" | "name" | "disabled" | "value" | "render" | "required" | "readOnly"> & {
45
+ className?: string;
46
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
47
+ export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
48
+ /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
49
+ export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
50
+ export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
51
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
52
+ export declare const Error: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
53
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
54
+ export declare const Success: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
55
+ /** Calls children for each code slot. Render Input inside each callback; the component handles slot ordering and keyboard/paste behavior. */
56
+ export declare const List: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children"> & {
57
+ /** Render an Input for each slot. Use the index for keys or separator placement; input ordering is automatic. */
58
+ children: (index: number) => ReactNode;
59
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
60
+ export declare const Separator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SeparatorProps, "className"> & {
61
+ className?: string;
62
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/otpinput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAU9D,OAAO,KAAK,EAAkB,SAAS,EAA4B,MAAM,OAAO,CAAA;AAGhF,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,GAAG;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACvC,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,IAAI,mHAiCf,CAAA;AACF,eAAO,MAAM,KAAK;gBAcE,MAAM;yEAyBxB,CAAA;AAEF,eAAO,MAAM,SAAS,uNAepB,CAAA;AACF,oHAAoH;AACpH,eAAO,MAAM,KAAK,oPA2BhB,CAAA;AAEF,eAAO,MAAM,WAAW,uNAiBtB,CAAA;AAEF,iHAAiH;AACjH,eAAO,MAAM,KAAK,uNAmBhB,CAAA;AAEF,iHAAiH;AACjH,eAAO,MAAM,OAAO,uNAmBlB,CAAA;AACF,6IAA6I;AAC7I,eAAO,MAAM,IAAI;IAGb,iHAAiH;cACvG,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS;uEAoBxC,CAAA;AACF,eAAO,MAAM,SAAS;gBAEwC,MAAM;uEAYlE,CAAA"}