@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,211 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cloneElement, createContext, forwardRef, useContext, useEffect, useRef, useState, } from 'react';
3
+ import { twMerge } from 'tailwind-merge';
4
+ const PinningContext = createContext(null);
5
+ function usePinning() {
6
+ return useContext(PinningContext)?.pinning ?? null;
7
+ }
8
+ /**
9
+ * Use Root → Surface → ScrollArea → Table for the scrolling table composition. Render your own data rows. Empty is manually controlled; the table does not inspect data to show it. Set pinning on Root when an edge column should remain visible while scrolling.
10
+ *
11
+ * To virtualize, import useVirtualizedTable from '@central-ui/react'.
12
+ * See the hook's types and documentation for configuration and integration examples.
13
+ *
14
+ * @example Complete composition
15
+ * import { Table } from '@central-ui/react'
16
+ *
17
+ * const orders = [
18
+ * {
19
+ * customer: 'Alex Morgan',
20
+ * number: '#1048',
21
+ * status: 'Paid',
22
+ * channel: 'Online',
23
+ * region: 'North',
24
+ * date: 'Sep 28',
25
+ * total: '$248.00',
26
+ * },
27
+ * {
28
+ * customer: 'Sam Lee',
29
+ * number: '#1049',
30
+ * status: 'Pending',
31
+ * channel: 'Retail',
32
+ * region: 'West',
33
+ * date: 'Sep 29',
34
+ * total: '$86.00',
35
+ * },
36
+ * {
37
+ * customer: 'Taylor Reed',
38
+ * number: '#1050',
39
+ * status: 'Paid',
40
+ * channel: 'Online',
41
+ * region: 'East',
42
+ * date: 'Sep 30',
43
+ * total: '$139.00',
44
+ * },
45
+ * ]
46
+ * function Example() {
47
+ * return (
48
+ * <Table.Root>
49
+ * <Table.Surface>
50
+ * <Table.ScrollArea>
51
+ * <Table.Table>
52
+ * <Table.Head>
53
+ * <Table.Row>
54
+ * <Table.HeadCell>Customer</Table.HeadCell>
55
+ * <Table.HeadCell>Status</Table.HeadCell>
56
+ * <Table.HeadCell>Total</Table.HeadCell>
57
+ * </Table.Row>
58
+ * </Table.Head>
59
+ * <Table.Body>
60
+ * {orders.map((order) => (
61
+ * <Table.Row key={order.number}>
62
+ * <Table.Cell>{order.customer}</Table.Cell>
63
+ * <Table.Cell>{order.status}</Table.Cell>
64
+ * <Table.Cell>{order.total}</Table.Cell>
65
+ * </Table.Row>
66
+ * ))}
67
+ * </Table.Body>
68
+ * </Table.Table>
69
+ * </Table.ScrollArea>
70
+ * </Table.Surface>
71
+ * </Table.Root>
72
+ * )
73
+ * }
74
+ *
75
+ * @example Keep the first column visible during scrolling
76
+ * // Keep the same Surface/ScrollArea/Table composition; no sticky classes needed on cells.
77
+ * ;<Table.Root pinning="first">
78
+ * <Table.Surface>
79
+ * {
80
+ * // Rest of components here
81
+ * }
82
+ * </Table.Surface>
83
+ * </Table.Root>
84
+ */
85
+ export function Root({ pinning, children, }) {
86
+ const { scrollRef, edges, update } = useScrollEdges();
87
+ const activePinning = (() => {
88
+ if (pinning === 'first' && edges.passedFirst)
89
+ return 'first';
90
+ if (pinning === 'last' && edges.hiddenLast)
91
+ return 'last';
92
+ return null;
93
+ })();
94
+ return (_jsx(PinningContext.Provider, { value: { pinning: activePinning, scrollRef, update }, children: children }));
95
+ }
96
+ function useScrollEdges() {
97
+ const scrollRef = useRef(null);
98
+ const [edges, setEdges] = useState({ passedFirst: false, hiddenLast: false });
99
+ const update = (scrollArea) => {
100
+ const next = {
101
+ passedFirst: scrollArea.scrollLeft > 1,
102
+ hiddenLast: scrollArea.scrollWidth -
103
+ scrollArea.clientWidth -
104
+ scrollArea.scrollLeft >
105
+ 1,
106
+ };
107
+ setEdges((current) => current.passedFirst === next.passedFirst &&
108
+ current.hiddenLast === next.hiddenLast
109
+ ? current
110
+ : next);
111
+ };
112
+ useEffect(() => {
113
+ const scrollArea = scrollRef.current;
114
+ if (!scrollArea)
115
+ return;
116
+ const table = scrollArea.querySelector('table');
117
+ const observer = new ResizeObserver(() => update(scrollArea));
118
+ observer.observe(scrollArea);
119
+ if (table)
120
+ observer.observe(table);
121
+ update(scrollArea);
122
+ return () => observer.disconnect();
123
+ }, []);
124
+ return { scrollRef, edges, update };
125
+ }
126
+ export function Surface({ disableStyle, className, ...props }) {
127
+ return (_jsx("div", { ...props, "data-component": "table-surface", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
128
+ }
129
+ export function SurfaceHeader({ disableStyle, className, ...props }) {
130
+ return (_jsx("div", { ...props, "data-component": "table-surfaceheader", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
131
+ }
132
+ export function SurfaceFooter({ disableStyle, className, ...props }) {
133
+ return (_jsx("div", { ...props, "data-component": "table-surfacefooter", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
134
+ }
135
+ export function ScrollArea({ disableStyle, className, onScroll, style, ...props }) {
136
+ const { scrollRef, update } = useContext(PinningContext);
137
+ return (_jsx("div", { ...props, ref: scrollRef, style: { ...style, overflowX: 'auto' }, onScroll: (event) => {
138
+ update(event.currentTarget);
139
+ onScroll?.(event);
140
+ }, "data-component": "table-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
141
+ }
142
+ const pinningStyles = `
143
+ table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="first"]:first-child {
144
+ position: sticky;
145
+ left: 0;
146
+ z-index: 10;
147
+ }
148
+ table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="last"]:last-child {
149
+ position: sticky;
150
+ right: 0;
151
+ z-index: 10;
152
+ }
153
+ `;
154
+ export function Table({ disableStyle, className, ...props }) {
155
+ return (_jsxs(_Fragment, { children: [_jsx("style", { children: pinningStyles }), _jsx("table", { ...props, "data-slot": "table", "data-component": "table-table", "data-style-disabled": disableStyle ? '' : undefined, className: className })] }));
156
+ }
157
+ export function ColGroup({ disableStyle, className, ...props }) {
158
+ return (_jsx("colgroup", { ...props, "data-component": "table-colgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
159
+ }
160
+ export function Col({ disableStyle, className, ...props }) {
161
+ return (_jsx("col", { ...props, "data-component": "table-col", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
162
+ }
163
+ export function Head({ disableStyle, className, ...props }) {
164
+ return (_jsx("thead", { ...props, "data-slot": "table-header", "data-component": "table-head", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
165
+ }
166
+ export const Body = forwardRef(function Body({ disableStyle, className, ...props }, ref) {
167
+ return (_jsx("tbody", { ...props, ref: ref, "data-component": "table-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
168
+ });
169
+ export const Row = forwardRef(({ disableStyle, className, ...props }, ref) => {
170
+ return (_jsx("tr", { ...props, ref: ref, "data-component": "table-row", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
171
+ });
172
+ export function HeadCell({ disableStyle, className, ...props }) {
173
+ const pinning = usePinning();
174
+ return (_jsx("th", { ...props, "data-pinning": pinning, "data-component": "table-headcell", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
175
+ }
176
+ export function Cell({ disableStyle, className, ...props }) {
177
+ const pinning = usePinning();
178
+ return (_jsx("td", { ...props, "data-pinning": pinning, "data-component": "table-cell", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
179
+ }
180
+ export function Empty({ disableStyle, className, children, ...props }) {
181
+ return (_jsx("div", { "data-component": "table-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props, children: children }));
182
+ }
183
+ export function EmptyBody({ disableStyle, className, ...props }) {
184
+ return (_jsx("div", { ...props, "data-component": "table-emptybody", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
185
+ }
186
+ export function EmptyTitle({ disableStyle, className, ...props }) {
187
+ return (_jsx("p", { "data-component": "table-emptytitle", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
188
+ }
189
+ export function EmptyDescription({ disableStyle, className, ...props }) {
190
+ return (_jsx("p", { "data-component": "table-emptydescription", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
191
+ }
192
+ export function EmptyImage({ disableStyle, className, ...props }) {
193
+ return (_jsx("img", { alt: "Empty", "data-component": "table-emptyimage", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
194
+ }
195
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
196
+ export function EmptyIcon({ disableStyle, children, className, ...props }) {
197
+ return cloneElement(children, {
198
+ ...children.props,
199
+ ...props,
200
+ ...{
201
+ 'data-component': 'table-emptyicon',
202
+ 'data-style-disabled': disableStyle ? '' : undefined,
203
+ },
204
+ className: twMerge(children.props.className, className),
205
+ strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 1.5,
206
+ });
207
+ }
208
+ export function EmptyActionsList({ disableStyle, className, children, ...props }) {
209
+ return (_jsx("div", { "data-component": "table-emptyactionslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props, children: children }));
210
+ }
211
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AAUd,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAIxC,MAAM,cAAc,GAAG,aAAa,CAI1B,IAAI,CAAC,CAAA;AAEf,SAAS,UAAU;IACjB,OAAO,UAAU,CAAC,cAAc,CAAC,EAAE,OAAO,IAAI,IAAI,CAAA;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,MAAM,UAAU,IAAI,CAAC,EACnB,OAAO,EACP,QAAQ,GAKT;IACC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAA;IACrD,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,OAAO,KAAK,OAAO,IAAI,KAAK,CAAC,WAAW;YAAE,OAAO,OAAO,CAAA;QAC5D,IAAI,OAAO,KAAK,MAAM,IAAI,KAAK,CAAC,UAAU;YAAE,OAAO,MAAM,CAAA;QACzD,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IACtB,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,YAEnD,QAAQ,GACe,CAC3B,CAAA;AACH,CAAC;AACD,SAAS,cAAc;IACrB,MAAM,SAAS,GAAG,MAAM,CAAiB,IAA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Y,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;SACrD;QACD,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;QACvD,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,IAAI,GAAG;KACpE,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EAC2B;IACnC,OAAO,CACL,gCACiB,wBAAwB,yBAClB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,YAER,QAAQ,GACL,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,67 @@
1
+ import type { StyleProps } from '../../types/Style.ts';
2
+ import { Tabs as BaseTabs } from '@base-ui/react/tabs';
3
+ import type { ReactElement } from 'react';
4
+ import type { LucideProps } from 'lucide-react';
5
+ /**
6
+ * Match each Tab value to a Content value in the same Root. Let Tabs handle the active panel and keyboard navigation; do not add separate visibility conditions. Indicator is optional decoration.
7
+ *
8
+ * @example Complete composition
9
+ * import { Tabs } from '@central-ui/react'
10
+ * import { Home, Settings } from 'lucide-react'
11
+ *
12
+ * function Example() {
13
+ * return (
14
+ * <div className="flex w-full gap-4 flex-col">
15
+ * <Tabs.Root defaultValue="overview">
16
+ * <Tabs.List>
17
+ * <Tabs.Tab value="overview">
18
+ * <Tabs.Icon>
19
+ * <Home />
20
+ * </Tabs.Icon>
21
+ * Overview
22
+ * </Tabs.Tab>
23
+ * <Tabs.Tab value="settings">
24
+ * <Tabs.Icon>
25
+ * <Settings />
26
+ * </Tabs.Icon>
27
+ * Settings
28
+ * </Tabs.Tab>
29
+ * <Tabs.Tab value="unavailable" disabled>
30
+ * Disabled
31
+ * </Tabs.Tab>
32
+ * <Tabs.Indicator />
33
+ * </Tabs.List>
34
+ * <Tabs.Content value="overview">Your account overview.</Tabs.Content>
35
+ * <Tabs.Content value="settings">Choose your preferences.</Tabs.Content>
36
+ * </Tabs.Root>
37
+ * </div>
38
+ * )
39
+ * }
40
+ *
41
+ * @example Activate a tab as keyboard focus moves
42
+ * // Configure List, keeping the same Tab/Content value pairs.
43
+ * ;<Tabs.List activateOnFocus>
44
+ * {
45
+ * // Rest of components here
46
+ * }
47
+ * </Tabs.List>
48
+ */
49
+ export declare function Root({ children, ...props }: Omit<BaseTabs.Root.Props, 'render' | 'className'>): import("react").JSX.Element;
50
+ export declare const List: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsListProps, "className"> & {
51
+ className?: string;
52
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
53
+ export declare const Tab: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsTabProps, "className"> & {
54
+ className?: string;
55
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
56
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
57
+ export declare const Icon: import("react").ForwardRefExoticComponent<Omit<LucideProps & {
58
+ /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
59
+ children: ReactElement<LucideProps>;
60
+ } & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
61
+ export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsIndicatorProps, "className"> & {
62
+ className?: string;
63
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
64
+ export declare const Content: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsPanelProps, "className"> & {
65
+ className?: string;
66
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
67
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,CAAC,+BAOnD;AACD,eAAO,MAAM,IAAI;gBAEyC,MAAM;uEAW9D,CAAA;AAEF,eAAO,MAAM,GAAG;gBAEyC,MAAM;0EAW7D,CAAA;AAEF,wHAAwH;AACxH,eAAO,MAAM,IAAI;IAGb,qGAAqG;cAC3F,YAAY,CAAC,WAAW,CAAC;sEAcrC,CAAA;AAEF,eAAO,MAAM,SAAS;gBAEyC,MAAM;wEAYnE,CAAA;AACF,eAAO,MAAM,OAAO;gBAEuC,MAAM;uEAY/D,CAAA"}
@@ -0,0 +1,78 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tabs as BaseTabs } from '@base-ui/react/tabs';
3
+ import { cloneElement, forwardRef } from 'react';
4
+ import { twMerge } from 'tailwind-merge';
5
+ /**
6
+ * Match each Tab value to a Content value in the same Root. Let Tabs handle the active panel and keyboard navigation; do not add separate visibility conditions. Indicator is optional decoration.
7
+ *
8
+ * @example Complete composition
9
+ * import { Tabs } from '@central-ui/react'
10
+ * import { Home, Settings } from 'lucide-react'
11
+ *
12
+ * function Example() {
13
+ * return (
14
+ * <div className="flex w-full gap-4 flex-col">
15
+ * <Tabs.Root defaultValue="overview">
16
+ * <Tabs.List>
17
+ * <Tabs.Tab value="overview">
18
+ * <Tabs.Icon>
19
+ * <Home />
20
+ * </Tabs.Icon>
21
+ * Overview
22
+ * </Tabs.Tab>
23
+ * <Tabs.Tab value="settings">
24
+ * <Tabs.Icon>
25
+ * <Settings />
26
+ * </Tabs.Icon>
27
+ * Settings
28
+ * </Tabs.Tab>
29
+ * <Tabs.Tab value="unavailable" disabled>
30
+ * Disabled
31
+ * </Tabs.Tab>
32
+ * <Tabs.Indicator />
33
+ * </Tabs.List>
34
+ * <Tabs.Content value="overview">Your account overview.</Tabs.Content>
35
+ * <Tabs.Content value="settings">Choose your preferences.</Tabs.Content>
36
+ * </Tabs.Root>
37
+ * </div>
38
+ * )
39
+ * }
40
+ *
41
+ * @example Activate a tab as keyboard focus moves
42
+ * // Configure List, keeping the same Tab/Content value pairs.
43
+ * ;<Tabs.List activateOnFocus>
44
+ * {
45
+ * // Rest of components here
46
+ * }
47
+ * </Tabs.List>
48
+ */
49
+ export function Root({ children, ...props }) {
50
+ // Native Root renders a div; the fragment preserves our wrapper-free Root contract.
51
+ return (_jsx(BaseTabs.Root, { ...props, render: (rootProps) => _jsx(_Fragment, { children: rootProps.children }), children: children }));
52
+ }
53
+ export const List = forwardRef(function List({ disableStyle, className, ...props }, ref) {
54
+ return (_jsx(BaseTabs.List, { ...props, ref: ref, "data-component": "tabs-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
55
+ });
56
+ export const Tab = forwardRef(function Tab({ disableStyle, className, ...props }, ref) {
57
+ return (_jsx(BaseTabs.Tab, { ...props, ref: ref, "data-component": "tabs-tab", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
58
+ });
59
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
60
+ export const Icon = forwardRef(function Icon({ disableStyle, children, className, ...props }, ref) {
61
+ return cloneElement(children, {
62
+ ...props,
63
+ ref,
64
+ 'aria-hidden': true,
65
+ ...{
66
+ 'data-component': 'tabs-icon',
67
+ 'data-style-disabled': disableStyle ? '' : undefined,
68
+ },
69
+ className: twMerge(children?.props.className, className),
70
+ });
71
+ });
72
+ export const Indicator = forwardRef(function Indicator({ disableStyle, className, ...props }, ref) {
73
+ return (_jsx(BaseTabs.Indicator, { ...props, ref: ref, "data-component": "tabs-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
74
+ });
75
+ export const Content = forwardRef(function Content({ disableStyle, className, ...props }, ref) {
76
+ return (_jsx(BaseTabs.Panel, { ...props, ref: ref, "data-component": "tabs-content", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
77
+ });
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tabs/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,IAAI,CAAC,EACnB,QAAQ,EACR,GAAG,KAAK,EAC0C;IAClD,oFAAoF;IACpF,OAAO,CACL,KAAC,QAAQ,CAAC,IAAI,OAAK,KAAK,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,4BAAG,SAAS,CAAC,QAAQ,GAAI,YACvE,QAAQ,GACK,CACjB,CAAA;AACH,CAAC;AACD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAG5B,SAAS,IAAI,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACxD,OAAO,CACL,KAAC,QAAQ,CAAC,IAAI,OACR,KAAK,EACT,GAAG,EAAE,GAAG,oBACO,WAAW,yBACL,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,S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AM,CAAC,MAAM,OAAO,GAAG,UAAU,CAI/B,SAAS,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAC3D,OAAO,CACL,KAAC,QAAQ,CAAC,KAAK,OACT,KAAK,EACT,GAAG,EAAE,GAAG,oBACO,cAAc,yBACR,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,GACpB,CACH,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,72 @@
1
+ import type { StyleProps } from '../../types/Style.ts';
2
+ import { Input as BaseInput } from '@base-ui/react/input';
3
+ import type { LucideProps } from 'lucide-react';
4
+ import type { ComponentProps, ReactElement, ReactNode } from 'react';
5
+ export type RootProps = Pick<ComponentProps<'textarea'>, 'id' | 'name' | 'form' | 'value' | 'defaultValue' | 'disabled' | 'readOnly' | 'required'> & Pick<BaseInput.Props, 'onValueChange'> & {
6
+ children?: ReactNode;
7
+ /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
8
+ tone?: 'neutral' | 'valid' | 'invalid';
9
+ };
10
+ /**
11
+ * Keep value, name, and validation configuration on Root. Textarea is the editable control inside TextareaGroup. Optional Addon parts hold your supporting text or actions; they do not implement submission.
12
+ *
13
+ * @example Complete composition
14
+ * import { Textarea } from '@central-ui/react'
15
+ *
16
+ * function Example() {
17
+ * return (
18
+ * <Textarea.Root defaultValue="Hello" name="message">
19
+ * <Textarea.Container>
20
+ * <Textarea.Label>Message</Textarea.Label>
21
+ * <Textarea.TextareaGroup>
22
+ * <Textarea.Textarea rows={4} placeholder="Write your message" />
23
+ * </Textarea.TextareaGroup>
24
+ * <Textarea.Description>Enter your message.</Textarea.Description>
25
+ * </Textarea.Container>
26
+ * </Textarea.Root>
27
+ * )
28
+ * }
29
+ *
30
+ * @example Control the message from application state
31
+ * import { useState } from 'react'
32
+ * function ControlledExample() {
33
+ * const [value, setValue] = useState('')
34
+ * return (
35
+ * <Textarea.Root value={value} onValueChange={setValue}>
36
+ * {
37
+ * // Rest of components here
38
+ * }
39
+ * </Textarea.Root>
40
+ * )
41
+ * }
42
+ */
43
+ export declare function Root({ children, id, tone, value, defaultValue, onValueChange, disabled, readOnly, required, ...coreProps }: RootProps): import("react").JSX.Element;
44
+ export type TextareaProps = Omit<ComponentProps<'textarea'>, keyof Pick<RootProps, 'id' | 'name' | 'form' | 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'readOnly' | 'required'>> & {
45
+ className?: string;
46
+ } & StyleProps;
47
+ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "form" | "defaultValue" | "id" | "name" | "disabled" | "value" | "onValueChange" | "required" | "readOnly"> & {
48
+ className?: string;
49
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
50
+ export declare const TextareaGroup: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
51
+ export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
52
+ /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
53
+ export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
54
+ export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
55
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
56
+ export declare const Error: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
57
+ /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
58
+ export declare const Success: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
59
+ export declare const Addon: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
60
+ /** Choose the preset appearance; this does not add action behavior. */
61
+ variant?: "normal" | "emphasized";
62
+ } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
63
+ export declare const AddonText: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
64
+ /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
65
+ export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
66
+ /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
67
+ children: ReactElement<ComponentProps<'svg'>>;
68
+ }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
69
+ export declare const AddonButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
70
+ /** Built-in icon; no children needed. Use it inside its matching control. */
71
+ export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<LucideProps, "children"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAY/C,OAAO,KAAK,EACV,cAAc,EAEd,YAAY,EACZ,SAAS,EAGV,MAAM,OAAO,CAAA;AAGd,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,cAAc,CAAC,UAAU,CAAC,EACxB,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,cAAc,GACd,UAAU,GACV,UAAU,GACV,UAAU,CACb,GACC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACvC,CAAA;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,EAAE,EACF,IAAgB,EAChB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,GAAG,SAAS,EACb,EAAE,SAAS,+BA4BX;AACD,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,CAAC,UAAU,CAAC,EAC1B,MAAM,IAAI,CACR,SAAS,EACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,cAAc,GACd,eAAe,GACf,UAAU,GACV,UAAU,GACV,UAAU,CACb,CACF,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAA;AACvC,eA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