@central-ui/react 0.1.1 → 0.2.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 (281) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion/index.d.ts +7 -6
  4. package/dist/components/accordion/index.js +13 -10
  5. package/dist/components/autocomplete/index.d.ts +22 -33
  6. package/dist/components/autocomplete/index.js +90 -73
  7. package/dist/components/avatar/index.d.ts +1 -2
  8. package/dist/components/avatar/index.js +6 -6
  9. package/dist/components/badge/index.d.ts +0 -1
  10. package/dist/components/badge/index.js +2 -2
  11. package/dist/components/banner/index.d.ts +1 -1
  12. package/dist/components/banner/index.js +24 -26
  13. package/dist/components/barchart/index.d.ts +106 -0
  14. package/dist/components/barchart/index.js +122 -0
  15. package/dist/components/breadcrumb/index.d.ts +0 -1
  16. package/dist/components/breadcrumb/index.js +6 -7
  17. package/dist/components/button/index.d.ts +3 -4
  18. package/dist/components/button/index.js +11 -12
  19. package/dist/components/card/index.d.ts +0 -1
  20. package/dist/components/card/index.js +0 -1
  21. package/dist/components/checkbox/index.d.ts +13 -11
  22. package/dist/components/checkbox/index.js +59 -39
  23. package/dist/components/chip/index.d.ts +1 -1
  24. package/dist/components/chip/index.js +2 -3
  25. package/dist/components/combobox/index.d.ts +32 -44
  26. package/dist/components/combobox/index.js +112 -88
  27. package/dist/components/datepicker/index.d.ts +54 -55
  28. package/dist/components/datepicker/index.js +105 -100
  29. package/dist/components/dialog/index.d.ts +17 -30
  30. package/dist/components/dialog/index.js +25 -26
  31. package/dist/components/divider/index.d.ts +0 -1
  32. package/dist/components/divider/index.js +0 -1
  33. package/dist/components/donutchart/index.d.ts +100 -0
  34. package/dist/components/donutchart/index.js +178 -0
  35. package/dist/components/drawer/index.d.ts +15 -24
  36. package/dist/components/drawer/index.js +45 -47
  37. package/dist/components/empty/index.d.ts +1 -2
  38. package/dist/components/empty/index.js +2 -4
  39. package/dist/components/fileupload/index.d.ts +4 -9
  40. package/dist/components/fileupload/index.js +27 -39
  41. package/dist/components/form/index.d.ts +0 -1
  42. package/dist/components/form/index.js +0 -1
  43. package/dist/components/horizontalbarchart/index.d.ts +120 -0
  44. package/dist/components/horizontalbarchart/index.js +193 -0
  45. package/dist/components/input/index.d.ts +23 -23
  46. package/dist/components/input/index.js +86 -115
  47. package/dist/components/linechart/index.d.ts +114 -0
  48. package/dist/components/linechart/index.js +139 -0
  49. package/dist/components/menu/index.d.ts +14 -16
  50. package/dist/components/menu/index.js +56 -53
  51. package/dist/components/metric/index.d.ts +0 -1
  52. package/dist/components/metric/index.js +0 -1
  53. package/dist/components/numberinput/index.d.ts +16 -23
  54. package/dist/components/numberinput/index.js +55 -68
  55. package/dist/components/otpinput/index.d.ts +14 -9
  56. package/dist/components/otpinput/index.js +32 -25
  57. package/dist/components/page/index.d.ts +0 -1
  58. package/dist/components/page/index.js +2 -4
  59. package/dist/components/passwordinput/index.d.ts +16 -13
  60. package/dist/components/passwordinput/index.js +47 -56
  61. package/dist/components/popover/index.d.ts +21 -19
  62. package/dist/components/popover/index.js +40 -21
  63. package/dist/components/radio/index.d.ts +13 -9
  64. package/dist/components/radio/index.js +80 -71
  65. package/dist/components/ratinginput/index.d.ts +15 -10
  66. package/dist/components/ratinginput/index.js +38 -18
  67. package/dist/components/select/index.d.ts +29 -32
  68. package/dist/components/select/index.js +79 -50
  69. package/dist/components/skeleton/index.d.ts +0 -1
  70. package/dist/components/skeleton/index.js +0 -1
  71. package/dist/components/slider/index.d.ts +14 -9
  72. package/dist/components/slider/index.js +75 -74
  73. package/dist/components/spinner/index.d.ts +2 -3
  74. package/dist/components/spinner/index.js +2 -3
  75. package/dist/components/splitter/index.d.ts +1 -2
  76. package/dist/components/splitter/index.js +6 -7
  77. package/dist/components/stepper/index.d.ts +8 -20
  78. package/dist/components/stepper/index.js +15 -16
  79. package/dist/components/switch/index.d.ts +12 -10
  80. package/dist/components/switch/index.js +52 -36
  81. package/dist/components/table/index.d.ts +3 -3
  82. package/dist/components/table/index.js +17 -16
  83. package/dist/components/tabs/index.d.ts +3 -4
  84. package/dist/components/tabs/index.js +6 -7
  85. package/dist/components/textarea/index.d.ts +16 -13
  86. package/dist/components/textarea/index.js +46 -55
  87. package/dist/components/textlink/index.d.ts +3 -1
  88. package/dist/components/textlink/index.js +4 -1
  89. package/dist/components/toast/index.d.ts +8 -14
  90. package/dist/components/toast/index.js +54 -54
  91. package/dist/components/toggle/index.d.ts +5 -6
  92. package/dist/components/toggle/index.js +19 -26
  93. package/dist/components/tooltip/index.d.ts +11 -13
  94. package/dist/components/tooltip/index.js +14 -11
  95. package/dist/components/tour/index.d.ts +154 -0
  96. package/dist/components/tour/index.js +280 -0
  97. package/dist/index.d.ts +5 -2
  98. package/dist/index.js +5 -1
  99. package/dist/types/Icon.d.ts +10 -0
  100. package/dist/types/Icon.js +1 -0
  101. package/dist/types/Style.d.ts +0 -1
  102. package/dist/types/Style.js +0 -1
  103. package/dist/types/Tone.d.ts +0 -1
  104. package/dist/types/Tone.js +0 -1
  105. package/dist/types/Validation.d.ts +12 -0
  106. package/dist/types/Validation.js +1 -0
  107. package/dist/utils/ArkStateToDataAttributes.d.ts +0 -1
  108. package/dist/utils/ArkStateToDataAttributes.js +3 -2
  109. package/dist/utils/Tone.d.ts +0 -1
  110. package/dist/utils/Tone.js +1 -2
  111. package/dist/utils/Validation.d.ts +14 -0
  112. package/dist/utils/Validation.js +23 -0
  113. package/dist/utils/asChild.d.ts +41 -0
  114. package/dist/utils/asChild.js +15 -0
  115. package/dist/utils/icons.d.ts +24 -0
  116. package/dist/utils/icons.js +160 -0
  117. package/dist/utils/useForwardClickToInput.d.ts +0 -1
  118. package/dist/utils/useForwardClickToInput.js +4 -3
  119. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +0 -1
  120. package/dist/utils/virtualization/useVirtualizedAutocomplete.js +0 -1
  121. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +0 -1
  122. package/dist/utils/virtualization/useVirtualizedCombobox.js +0 -1
  123. package/dist/utils/virtualization/useVirtualizedTable.d.ts +0 -1
  124. package/dist/utils/virtualization/useVirtualizedTable.js +0 -1
  125. package/package.json +12 -11
  126. package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +15 -6
  127. package/src/presets/shopify-polaris/shopify-polaris-badge.css +1 -1
  128. package/src/presets/shopify-polaris/shopify-polaris-barchart.css +64 -0
  129. package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +2 -2
  130. package/src/presets/shopify-polaris/shopify-polaris-chip.css +3 -3
  131. package/src/presets/shopify-polaris/shopify-polaris-combobox.css +19 -10
  132. package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +20 -11
  133. package/src/presets/shopify-polaris/shopify-polaris-dialog.css +16 -0
  134. package/src/presets/shopify-polaris/shopify-polaris-donutchart.css +172 -0
  135. package/src/presets/shopify-polaris/shopify-polaris-drawer.css +16 -0
  136. package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +1 -1
  137. package/src/presets/shopify-polaris/shopify-polaris-horizontalbarchart.css +60 -0
  138. package/src/presets/shopify-polaris/shopify-polaris-input.css +14 -5
  139. package/src/presets/shopify-polaris/shopify-polaris-linechart.css +68 -0
  140. package/src/presets/shopify-polaris/shopify-polaris-menu.css +47 -6
  141. package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +16 -7
  142. package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +3 -3
  143. package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +14 -5
  144. package/src/presets/shopify-polaris/shopify-polaris-popover.css +29 -0
  145. package/src/presets/shopify-polaris/shopify-polaris-radio.css +2 -2
  146. package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +2 -2
  147. package/src/presets/shopify-polaris/shopify-polaris-select.css +15 -6
  148. package/src/presets/shopify-polaris/shopify-polaris-slider.css +2 -2
  149. package/src/presets/shopify-polaris/shopify-polaris-stepper.css +16 -0
  150. package/src/presets/shopify-polaris/shopify-polaris-switch.css +2 -2
  151. package/src/presets/shopify-polaris/shopify-polaris-textarea.css +13 -4
  152. package/src/presets/shopify-polaris/shopify-polaris-toast.css +43 -0
  153. package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +16 -0
  154. package/src/presets/shopify-polaris/shopify-polaris.css +5 -0
  155. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +2 -2
  156. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-barchart.css +64 -0
  157. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +2 -2
  158. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +2 -2
  159. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +2 -2
  160. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +9 -0
  161. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-donutchart.css +172 -0
  162. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +9 -0
  163. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +1 -1
  164. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-horizontalbarchart.css +60 -0
  165. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +2 -2
  166. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-linechart.css +68 -0
  167. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +9 -0
  168. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +2 -2
  169. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +2 -2
  170. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +2 -2
  171. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +22 -0
  172. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +2 -2
  173. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +2 -2
  174. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +2 -2
  175. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +9 -0
  176. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +2 -2
  177. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +2 -2
  178. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +9 -0
  179. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +4 -0
  180. package/dist/components/accordion/index.d.ts.map +0 -1
  181. package/dist/components/accordion/index.js.map +0 -1
  182. package/dist/components/autocomplete/index.d.ts.map +0 -1
  183. package/dist/components/autocomplete/index.js.map +0 -1
  184. package/dist/components/avatar/index.d.ts.map +0 -1
  185. package/dist/components/avatar/index.js.map +0 -1
  186. package/dist/components/badge/index.d.ts.map +0 -1
  187. package/dist/components/badge/index.js.map +0 -1
  188. package/dist/components/banner/index.d.ts.map +0 -1
  189. package/dist/components/banner/index.js.map +0 -1
  190. package/dist/components/breadcrumb/index.d.ts.map +0 -1
  191. package/dist/components/breadcrumb/index.js.map +0 -1
  192. package/dist/components/button/index.d.ts.map +0 -1
  193. package/dist/components/button/index.js.map +0 -1
  194. package/dist/components/card/index.d.ts.map +0 -1
  195. package/dist/components/card/index.js.map +0 -1
  196. package/dist/components/checkbox/index.d.ts.map +0 -1
  197. package/dist/components/checkbox/index.js.map +0 -1
  198. package/dist/components/chip/index.d.ts.map +0 -1
  199. package/dist/components/chip/index.js.map +0 -1
  200. package/dist/components/combobox/index.d.ts.map +0 -1
  201. package/dist/components/combobox/index.js.map +0 -1
  202. package/dist/components/datepicker/index.d.ts.map +0 -1
  203. package/dist/components/datepicker/index.js.map +0 -1
  204. package/dist/components/dialog/index.d.ts.map +0 -1
  205. package/dist/components/dialog/index.js.map +0 -1
  206. package/dist/components/divider/index.d.ts.map +0 -1
  207. package/dist/components/divider/index.js.map +0 -1
  208. package/dist/components/drawer/index.d.ts.map +0 -1
  209. package/dist/components/drawer/index.js.map +0 -1
  210. package/dist/components/empty/index.d.ts.map +0 -1
  211. package/dist/components/empty/index.js.map +0 -1
  212. package/dist/components/fileupload/index.d.ts.map +0 -1
  213. package/dist/components/fileupload/index.js.map +0 -1
  214. package/dist/components/form/index.d.ts.map +0 -1
  215. package/dist/components/form/index.js.map +0 -1
  216. package/dist/components/input/index.d.ts.map +0 -1
  217. package/dist/components/input/index.js.map +0 -1
  218. package/dist/components/menu/index.d.ts.map +0 -1
  219. package/dist/components/menu/index.js.map +0 -1
  220. package/dist/components/metric/index.d.ts.map +0 -1
  221. package/dist/components/metric/index.js.map +0 -1
  222. package/dist/components/numberinput/index.d.ts.map +0 -1
  223. package/dist/components/numberinput/index.js.map +0 -1
  224. package/dist/components/otpinput/index.d.ts.map +0 -1
  225. package/dist/components/otpinput/index.js.map +0 -1
  226. package/dist/components/page/index.d.ts.map +0 -1
  227. package/dist/components/page/index.js.map +0 -1
  228. package/dist/components/passwordinput/index.d.ts.map +0 -1
  229. package/dist/components/passwordinput/index.js.map +0 -1
  230. package/dist/components/popover/index.d.ts.map +0 -1
  231. package/dist/components/popover/index.js.map +0 -1
  232. package/dist/components/radio/index.d.ts.map +0 -1
  233. package/dist/components/radio/index.js.map +0 -1
  234. package/dist/components/ratinginput/index.d.ts.map +0 -1
  235. package/dist/components/ratinginput/index.js.map +0 -1
  236. package/dist/components/select/index.d.ts.map +0 -1
  237. package/dist/components/select/index.js.map +0 -1
  238. package/dist/components/skeleton/index.d.ts.map +0 -1
  239. package/dist/components/skeleton/index.js.map +0 -1
  240. package/dist/components/slider/index.d.ts.map +0 -1
  241. package/dist/components/slider/index.js.map +0 -1
  242. package/dist/components/spinner/index.d.ts.map +0 -1
  243. package/dist/components/spinner/index.js.map +0 -1
  244. package/dist/components/splitter/index.d.ts.map +0 -1
  245. package/dist/components/splitter/index.js.map +0 -1
  246. package/dist/components/stepper/index.d.ts.map +0 -1
  247. package/dist/components/stepper/index.js.map +0 -1
  248. package/dist/components/switch/index.d.ts.map +0 -1
  249. package/dist/components/switch/index.js.map +0 -1
  250. package/dist/components/table/index.d.ts.map +0 -1
  251. package/dist/components/table/index.js.map +0 -1
  252. package/dist/components/tabs/index.d.ts.map +0 -1
  253. package/dist/components/tabs/index.js.map +0 -1
  254. package/dist/components/textarea/index.d.ts.map +0 -1
  255. package/dist/components/textarea/index.js.map +0 -1
  256. package/dist/components/textlink/index.d.ts.map +0 -1
  257. package/dist/components/textlink/index.js.map +0 -1
  258. package/dist/components/toast/index.d.ts.map +0 -1
  259. package/dist/components/toast/index.js.map +0 -1
  260. package/dist/components/toggle/index.d.ts.map +0 -1
  261. package/dist/components/toggle/index.js.map +0 -1
  262. package/dist/components/tooltip/index.d.ts.map +0 -1
  263. package/dist/components/tooltip/index.js.map +0 -1
  264. package/dist/index.d.ts.map +0 -1
  265. package/dist/index.js.map +0 -1
  266. package/dist/types/Style.d.ts.map +0 -1
  267. package/dist/types/Style.js.map +0 -1
  268. package/dist/types/Tone.d.ts.map +0 -1
  269. package/dist/types/Tone.js.map +0 -1
  270. package/dist/utils/ArkStateToDataAttributes.d.ts.map +0 -1
  271. package/dist/utils/ArkStateToDataAttributes.js.map +0 -1
  272. package/dist/utils/Tone.d.ts.map +0 -1
  273. package/dist/utils/Tone.js.map +0 -1
  274. package/dist/utils/useForwardClickToInput.d.ts.map +0 -1
  275. package/dist/utils/useForwardClickToInput.js.map +0 -1
  276. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +0 -1
  277. package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +0 -1
  278. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +0 -1
  279. package/dist/utils/virtualization/useVirtualizedCombobox.js.map +0 -1
  280. package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +0 -1
  281. package/dist/utils/virtualization/useVirtualizedTable.js.map +0 -1
@@ -33,14 +33,14 @@ export function Root({ children, size = 'medium', ...props }) {
33
33
  // Native Root renders a span; the fragment preserves our wrapper-free Root contract.
34
34
  return (_jsx(SizeContext.Provider, { value: size, children: _jsx(BaseAvatar.Root, { ...props, render: (rootProps) => _jsx(_Fragment, { children: rootProps.children }), children: children }) }));
35
35
  }
36
- export const List = forwardRef(function List({ disableStyle, className, ...props }, ref) {
36
+ export const List = /* @__PURE__ */ forwardRef(function List({ disableStyle, className, ...props }, ref) {
37
37
  return (_jsx("div", { ...props, ref: ref, "data-component": "avatar-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
38
38
  });
39
- export const Image = forwardRef(function Image({ disableStyle, className, ...props }, ref) {
39
+ export const Image = /* @__PURE__ */ forwardRef(function Image({ disableStyle, className, ...props }, ref) {
40
40
  const size = useContext(SizeContext);
41
41
  return (_jsx(BaseAvatar.Image, { ...props, ref: ref, "data-size": size, "data-component": "avatar-image", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
42
42
  });
43
- export const FallbackNameInitials = forwardRef(function FallbackNameInitials({ disableStyle, color, children, className, style, ...props }, ref) {
43
+ export const FallbackNameInitials = /* @__PURE__ */ forwardRef(function FallbackNameInitials({ disableStyle, color, children, className, style, ...props }, ref) {
44
44
  const size = useContext(SizeContext);
45
45
  return (_jsx(BaseAvatar.Fallback, { ...props, ref: ref, "data-size": size, role: "img", "aria-label": children, style: typeof style === 'function'
46
46
  ? (state) => ({ backgroundColor: color, ...style(state) })
@@ -52,9 +52,9 @@ export const FallbackNameInitials = forwardRef(function FallbackNameInitials({ d
52
52
  .join('')
53
53
  .slice(0, 2) }));
54
54
  });
55
- export const FallbackImage = forwardRef(function FallbackImage({ disableStyle, className, delay, ...props }, ref) {
55
+ export const FallbackImage = /* @__PURE__ */ forwardRef(function FallbackImage({ disableStyle, className, delay, ...props }, ref) {
56
56
  const size = useContext(SizeContext);
57
57
  return (_jsx(BaseAvatar.Fallback, { delay: delay, render: _jsx("img", { ...props, ref: ref }), "data-size": size, "data-component": "avatar-fallbackimage", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
58
58
  });
59
- const SizeContext = createContext('medium');
60
- //# sourceMappingURL=index.js.map
59
+ const SizeContext =
60
+ /* @__PURE__ */ createContext('medium');
@@ -26,4 +26,3 @@ export declare function Icon({ disableStyle, children, className, ...props }: (O
26
26
  /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
27
27
  children: ReactElement<ComponentProps<'svg'>>;
28
28
  }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
29
- //# sourceMappingURL=index.d.ts.map
@@ -23,9 +23,10 @@ export default function Badge({ disableStyle, className, tone, ...props }) {
23
23
  }
24
24
  /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
25
25
  export function Icon({ disableStyle, children, className, ...props }) {
26
+ // cloneElement keeps the icon's own props, so only the added ones are passed
26
27
  return cloneElement(children, {
27
- ...children.props,
28
28
  ...props,
29
+ // Spread from an object so the data-* keys pass the element props' excess property check
29
30
  ...{
30
31
  'data-component': 'badge-icon',
31
32
  'data-style-disabled': disableStyle ? '' : undefined,
@@ -33,4 +34,3 @@ export function Icon({ disableStyle, children, className, ...props }) {
33
34
  className: twMerge(children.props.className, className),
34
35
  });
35
36
  }
36
- //# sourceMappingURL=index.js.map
@@ -57,6 +57,7 @@ export declare function Icon({ disableStyle, children, className, ...props }: (O
57
57
  'data-tone'?: BannerTone;
58
58
  }, string | import("react").JSXElementConstructor<any>>;
59
59
  export declare function Title({ disableStyle, className, ...props }: ComponentProps<'h2'> & StyleProps): import("react").JSX.Element;
60
+ /** Icon-only: put just a CloseButtonIcon inside, never text like "Close". Name it for screen readers with aria-label instead, e.g. aria-label="Dismiss". */
60
61
  export declare function CloseButton({ disableStyle, type, className, onClick, ...props }: ComponentProps<'button'> & StyleProps): import("react").JSX.Element;
61
62
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
62
63
  export declare function CloseButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
@@ -68,4 +69,3 @@ export declare function CloseButtonIcon({ disableStyle, children, className, ...
68
69
  export declare function Body({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
69
70
  export declare function Description({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
70
71
  export {};
71
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CircleAlert, CircleCheck, Info, Text, TriangleAlert, X, } from 'lucide-react';
2
+ import { CircleAlert, CircleCheck, Info, Text, TriangleAlert, X, } from "../../utils/icons.js";
3
3
  import { cloneElement, createContext, useContext } from 'react';
4
4
  import { twMerge } from 'tailwind-merge';
5
- const BannerContext = createContext({
5
+ const BannerContext = /* @__PURE__ */ createContext({
6
6
  tone: 'neutral',
7
7
  });
8
8
  /**
@@ -48,32 +48,31 @@ export function Root({ tone = 'neutral', onClose, children, }) {
48
48
  return (_jsx(BannerContext.Provider, { value: { tone, onClose }, children: children }));
49
49
  }
50
50
  export function Surface({ disableStyle, className, ...props }) {
51
- const { tone } = useContext(BannerContext);
52
- return (_jsx("div", { ...props, "data-tone": tone, "data-component": "banner-surface", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
51
+ const context = useContext(BannerContext);
52
+ return (_jsx("div", { ...props, "data-tone": context.tone, "data-component": "banner-surface", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
53
53
  }
54
54
  export function Header({ disableStyle, className, ...props }) {
55
- const { tone } = useContext(BannerContext);
56
- return (_jsx("div", { ...props, "data-tone": tone, "data-component": "banner-header", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
55
+ const context = useContext(BannerContext);
56
+ return (_jsx("div", { ...props, "data-tone": context.tone, "data-component": "banner-header", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
57
57
  }
58
58
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
59
59
  export function Icon({ disableStyle, children, className, ...props }) {
60
- const { tone } = useContext(BannerContext);
60
+ const context = useContext(BannerContext);
61
61
  const icon = children ??
62
62
  (() => {
63
- if (tone === 'danger')
63
+ if (context.tone === 'danger')
64
64
  return _jsx(CircleAlert, {});
65
- if (tone === 'informative')
65
+ if (context.tone === 'informative')
66
66
  return _jsx(Info, {});
67
- if (tone === 'success')
67
+ if (context.tone === 'success')
68
68
  return _jsx(CircleCheck, {});
69
- if (tone === 'caution')
69
+ if (context.tone === 'caution')
70
70
  return _jsx(TriangleAlert, {});
71
71
  return _jsx(Text, {});
72
72
  })();
73
73
  return cloneElement(icon, {
74
- ...icon.props,
75
74
  ...props,
76
- 'data-tone': tone,
75
+ 'data-tone': context.tone,
77
76
  ...{
78
77
  'data-component': 'banner-icon',
79
78
  'data-style-disabled': disableStyle ? '' : undefined,
@@ -82,24 +81,24 @@ export function Icon({ disableStyle, children, className, ...props }) {
82
81
  });
83
82
  }
84
83
  export function Title({ disableStyle, className, ...props }) {
85
- const { tone } = useContext(BannerContext);
86
- return (_jsx("h2", { ...props, "data-tone": tone, "data-component": "banner-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
84
+ const context = useContext(BannerContext);
85
+ return (_jsx("h2", { ...props, "data-tone": context.tone, "data-component": "banner-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
87
86
  }
87
+ /** Icon-only: put just a CloseButtonIcon inside, never text like "Close". Name it for screen readers with aria-label instead, e.g. aria-label="Dismiss". */
88
88
  export function CloseButton({ disableStyle, type = 'button', className, onClick, ...props }) {
89
- const { tone, onClose } = useContext(BannerContext);
90
- return (_jsx("button", { ...props, type: type, "data-tone": tone, onClick: (event) => {
89
+ const context = useContext(BannerContext);
90
+ return (_jsx("button", { ...props, type: type, "data-tone": context.tone, onClick: (event) => {
91
91
  onClick?.(event);
92
92
  if (!event.defaultPrevented)
93
- onClose?.();
93
+ context.onClose?.();
94
94
  }, "data-component": "banner-closebutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
95
95
  }
96
96
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
97
97
  export function CloseButtonIcon({ disableStyle, children = _jsx(X, {}), className, ...props }) {
98
- const { tone } = useContext(BannerContext);
98
+ const context = useContext(BannerContext);
99
99
  return cloneElement(children, {
100
- ...children.props,
101
100
  ...props,
102
- 'data-tone': tone,
101
+ 'data-tone': context.tone,
103
102
  ...{
104
103
  'data-component': 'banner-closebuttonicon',
105
104
  'data-style-disabled': disableStyle ? '' : undefined,
@@ -109,11 +108,10 @@ export function CloseButtonIcon({ disableStyle, children = _jsx(X, {}), classNam
109
108
  });
110
109
  }
111
110
  export function Body({ disableStyle, className, ...props }) {
112
- const { tone } = useContext(BannerContext);
113
- return (_jsx("div", { ...props, "data-tone": tone, "data-component": "banner-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
111
+ const context = useContext(BannerContext);
112
+ return (_jsx("div", { ...props, "data-tone": context.tone, "data-component": "banner-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
114
113
  }
115
114
  export function Description({ disableStyle, className, ...props }) {
116
- const { tone } = useContext(BannerContext);
117
- return (_jsx("div", { ...props, "data-tone": tone, "data-component": "banner-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
115
+ const context = useContext(BannerContext);
116
+ return (_jsx("div", { ...props, "data-tone": context.tone, "data-component": "banner-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
118
117
  }
119
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,106 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import { BarChart as RechartsBarChart } from 'recharts';
3
+ import type { BarProps as RechartsBarProps, TooltipProps as RechartsTooltipProps, XAxisProps as RechartsXAxisProps, YAxisProps as RechartsYAxisProps } from 'recharts';
4
+ import type { StyleProps } from '../../types/Style.ts';
5
+ /** Every record needs a unique `label` (the category) and a numeric `value` (the bar height). Extra fields are kept for the tooltip. */
6
+ type Datum = {
7
+ label: string;
8
+ value: number;
9
+ };
10
+ export type RootProps<Data extends Datum = Datum> = Pick<ComponentProps<typeof RechartsBarChart>, 'accessibilityLayer' | 'desc'> & {
11
+ /** Unique labels are equally spaced categories, including when they contain dates. */
12
+ data: readonly Data[];
13
+ 'aria-label': string;
14
+ children: ReactNode;
15
+ /**
16
+ * Converts a record's `label` into display text.
17
+ * Used by the X axis ticks and the tooltip label, so both always read the same.
18
+ * Use it for dates (e.g. `'2026-10-12'` → `'October 12, 2026'`) or to shorten long categories.
19
+ * @default (label) => label
20
+ */
21
+ labelToString?: (label: string) => string;
22
+ /**
23
+ * Converts a record's `value` into display text.
24
+ * Used by the Y axis ticks and the tooltip value, so both always read the same.
25
+ * Use it for currency, percentages, or units (e.g. `1240` → `'$1,240'`).
26
+ * @default (value) => value.toLocaleString()
27
+ */
28
+ valueToString?: (value: number) => string;
29
+ /**
30
+ * Whether the Y axis may place ticks at fractional values.
31
+ * Keep it `false` for counts (orders, visitors) so the axis never shows `0.5 orders`.
32
+ * Set it to `true` for continuous measures where fractions are meaningful, such as small currency amounts or ratings.
33
+ * @default false
34
+ */
35
+ allowDecimals?: boolean;
36
+ };
37
+ /** Provides the chart data, formatting, and accessibility settings to its parts. Renders no element. */
38
+ export declare function Root<Data extends Datum>({ children, labelToString, valueToString, allowDecimals, ...chart }: RootProps<Data>): import("react").JSX.Element;
39
+ export type ContainerProps = Pick<ComponentProps<typeof RechartsBarChart>, 'children' | 'height' | 'className' | 'style' | 'id' | 'margin' | 'ref' | 'tabIndex'> & {
40
+ /**
41
+ * The vertical line that follows the pointer across the chart.
42
+ * Shown by default, with or without a Tooltip, so readers can line a point up with its axis label.
43
+ * Pass `false` for static charts where hover feedback adds noise. Style it through `data-component="barchart-hoverguide"`.
44
+ * @default true
45
+ */
46
+ hoverGuide?: LineSwitch;
47
+ };
48
+ /** Recharts supplies its own responsive container, so no extra wrapper is needed. */
49
+ export declare function Container({ height, className, style, children, hoverGuide, ...props }: ContainerProps): import("react").JSX.Element;
50
+ /** On/off only: style it through its data-component in a preset, so each export keeps one className. */
51
+ type LineSwitch = boolean;
52
+ export type XAxisProps = Pick<RechartsXAxisProps, 'hide' | 'tickSize'> & {
53
+ /** Classes for the tick labels, e.g. `fill-neutral-500`. Keep the font size at 12px: Recharts measures labels at that size to skip overlapping ones. */
54
+ className?: string;
55
+ /** Space between the labels and the plot area, in pixels. */
56
+ labelGap?: number;
57
+ /** The line along the axis. Hidden by default. */
58
+ axisLine?: LineSwitch;
59
+ /** The small marks at each tick. Hidden by default. */
60
+ tickLine?: LineSwitch;
61
+ };
62
+ export declare function XAxis({ className, labelGap, axisLine, tickLine, ...props }: XAxisProps): import("react").JSX.Element;
63
+ export type YAxisProps = Pick<RechartsYAxisProps, 'hide' | 'tickSize' | 'width'> & {
64
+ /** Classes for the tick labels, e.g. `fill-neutral-500`. Keep the font size at 12px: Recharts measures labels at that size to skip overlapping ones. */
65
+ className?: string;
66
+ /** Space between the labels and the plot area, in pixels. */
67
+ labelGap?: number;
68
+ /** The line along the axis. Hidden by default. */
69
+ axisLine?: LineSwitch;
70
+ /** The small marks at each tick. Hidden by default. */
71
+ tickLine?: LineSwitch;
72
+ };
73
+ export declare function YAxis({ className, labelGap, axisLine, tickLine, ...props }: YAxisProps): import("react").JSX.Element;
74
+ export type GridProps = {
75
+ /** Classes for every grid line, e.g. `stroke-neutral-200 [stroke-dasharray:4_4]`. */
76
+ className?: string;
77
+ };
78
+ /** Horizontal lines only, one per Y value tick. */
79
+ export declare function Grid({ className }: GridProps): import("react").JSX.Element;
80
+ export type BarsProps = Pick<RechartsBarProps, 'radius' | 'hide' | 'name'> & {
81
+ /**
82
+ * Classes for every bar. Colors come only from here or from a preset; there is no built-in color.
83
+ * Target hover with `data-active:` (e.g. `fill-sky-500 data-active:opacity-80`).
84
+ */
85
+ className?: string;
86
+ /**
87
+ * Whether the bar under the pointer gets `data-active`. Pass false to turn the hover state off.
88
+ * @default true
89
+ */
90
+ activeBar?: boolean;
91
+ };
92
+ export declare function Bars({ className, activeBar, ...props }: BarsProps): import("react").JSX.Element;
93
+ export type TooltipProps<Data extends Datum = Datum> = Pick<RechartsTooltipProps<number, string>, 'offset' | 'allowEscapeViewBox' | 'portal'> & {
94
+ /** Receives the hovered record and returns the popup. */
95
+ children: (datum: Data) => ReactNode;
96
+ };
97
+ /** Renders no element: hands its popup to the Container. For extra fields, specify the record type: Tooltip<(typeof data)[number]>. */
98
+ export declare function Tooltip<Data extends Datum = Datum>({ children, offset, allowEscapeViewBox, portal, }: TooltipProps<Data>): null;
99
+ export declare function TooltipPopup({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
100
+ export declare function TooltipTitle({ disableStyle, className, ...props }: ComponentProps<'p'> & StyleProps): import("react").JSX.Element;
101
+ /** Shows the hovered record's label, formatted by `labelToString` on Root. */
102
+ export declare function TooltipLabel({ disableStyle, className, ...props }: Omit<ComponentProps<'p'>, 'children'> & StyleProps): import("react").JSX.Element;
103
+ /** Shows the hovered record's value, formatted by `valueToString` on Root. */
104
+ export declare function TooltipValue({ disableStyle, className, ...props }: Omit<ComponentProps<'p'>, 'children'> & StyleProps): import("react").JSX.Element;
105
+ export declare function TooltipColorIndicator({ disableStyle, className, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
106
+ export {};
@@ -0,0 +1,122 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useLayoutEffect, useState } from 'react';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { Bar as RechartsBar, BarChart as RechartsBarChart, CartesianGrid as RechartsGrid, Rectangle as RechartsRectangle, Tooltip as RechartsTooltip, XAxis as RechartsXAxis, YAxis as RechartsYAxis, } from 'recharts';
5
+ const ChartContext = /* @__PURE__ */ createContext(null);
6
+ /** Provides the chart data, formatting, and accessibility settings to its parts. Renders no element. */
7
+ export function Root({ children, labelToString = (label) => label, valueToString = (value) => value.toLocaleString(), allowDecimals = false, ...chart }) {
8
+ return (_jsx(ChartContext.Provider, { value: { ...chart, labelToString, valueToString, allowDecimals }, children: children }));
9
+ }
10
+ function useChart(part) {
11
+ const chart = useContext(ChartContext);
12
+ if (!chart)
13
+ throw new Error(`BarChart.${part} must be inside BarChart.Root`);
14
+ return chart;
15
+ }
16
+ /** Lets a Tooltip part hand its content to the Container, which owns the single Recharts tooltip. */
17
+ const TooltipSlotContext = /* @__PURE__ */ createContext(null);
18
+ /** Recharts supplies its own responsive container, so no extra wrapper is needed. */
19
+ export function Container({ height = 300, className, style, children, hoverGuide = true, ...props }) {
20
+ const chart = useChart('Container');
21
+ const [tooltip, setTooltip] = useState(null);
22
+ return (_jsxs(RechartsBarChart, { margin: { top: 12, right: 12, bottom: 0, left: 0 }, ...props, data: chart.data, accessibilityLayer: chart.accessibilityLayer, desc: chart.desc, title: chart['aria-label'], className: twMerge('min-w-0 w-full', className), style: { ...style, background: 'transparent' }, height: height, width: "100%", responsive: true, layout: "horizontal",
23
+ // Bars nearly touch: each fills 90% of its slot.
24
+ barCategoryGap: "15%", children: [_jsx(TooltipSlotContext.Provider, { value: setTooltip, children: children }), _jsx(RechartsTooltip, { offset: 12, ...tooltip?.props,
25
+ // Native popup slide, timed to match the hover guide's transition.
26
+ animationDuration: 200, animationEasing: "ease-out", shared: true, cursor: hoverGuide && _jsx(HoverGuide, {}), content: (state) => {
27
+ if (!tooltip || !state.active || !state.payload.length)
28
+ return null;
29
+ // Recharts types the payload as unknown; payload[0] is always the hovered record.
30
+ const datum = state.payload[0].payload;
31
+ return (_jsx(TooltipContext.Provider, { value: datum, children: tooltip.render(datum) }));
32
+ } })] }));
33
+ }
34
+ const lineProps = (line, part) =>
35
+ // Recharts forwards data attributes at runtime; its types omit them.
36
+ (line && { 'data-component': part });
37
+ export function XAxis({ className, labelGap = 8, axisLine = false, tickLine = false, ...props }) {
38
+ const chart = useChart('XAxis');
39
+ return (_jsx(RechartsXAxis, { height: "auto", ...props, axisLine: lineProps(axisLine, 'barchart-xaxis-line'), tickLine: lineProps(tickLine, 'barchart-xaxis-tickline'), tick: {
40
+ className,
41
+ 'data-component': 'barchart-xaxis-ticklabel',
42
+ }, tickMargin: labelGap, tickFormatter: chart.labelToString,
43
+ // Recharts measures labels at this size when it hides overlapping ones.
44
+ fontSize: 12, dataKey: "label", type: "category", label: false, angle: 0,
45
+ // Drops labels at a steady step when they would overlap, so the remaining ones stay evenly spaced.
46
+ interval: "equidistantPreserveStart", minTickGap: 8 }));
47
+ }
48
+ export function YAxis({ className, labelGap = 8, axisLine = false, tickLine = false, ...props }) {
49
+ const chart = useChart('YAxis');
50
+ return (_jsx(RechartsYAxis, { width: "auto", ...props, axisLine: lineProps(axisLine, 'barchart-yaxis-line'), tickLine: lineProps(tickLine, 'barchart-yaxis-tickline'), tick: {
51
+ className,
52
+ 'data-component': 'barchart-yaxis-ticklabel',
53
+ }, tickMargin: labelGap, tickFormatter: chart.valueToString, allowDecimals: chart.allowDecimals, fontSize: 12, type: "number", label: false, angle: 0,
54
+ // Always include zero so bars have a baseline, and never collapse the range when every value is 0.
55
+ domain: ([minimum, maximum]) => [
56
+ Math.min(0, minimum),
57
+ Math.max(Math.min(0, minimum) + 1, maximum, 0),
58
+ ], interval: "preserveStartEnd", minTickGap: 8 }));
59
+ }
60
+ /** Horizontal lines only, one per Y value tick. */
61
+ export function Grid({ className }) {
62
+ return (_jsx(RechartsGrid
63
+ // Recharts' native line slot: each line gets the class and a data-component hook.
64
+ , {
65
+ // Recharts' native line slot: each line gets the class and a data-component hook.
66
+ horizontal: { className, 'data-component': 'barchart-gridline' }, vertical: false, fill: "none" }));
67
+ }
68
+ export function Bars({ className, activeBar = true, ...props }) {
69
+ return (_jsx(RechartsBar, { ...props, activeBar: activeBar,
70
+ // Recharts' native shape slot renders each bar ourselves, so className and data attributes land on the drawn element.
71
+ shape: (bar) => (_jsx(RechartsRectangle, { ...bar, className: className, "data-component": "barchart-bar", "data-index": bar.index, "data-active": bar.isActive ? '' : undefined })), dataKey: "value",
72
+ // Zero days still get a thin, hoverable sliver on the baseline.
73
+ minPointSize: 2, isAnimationActive: false }));
74
+ }
75
+ const TooltipContext = /* @__PURE__ */ createContext(null);
76
+ /** Renders no element: hands its popup to the Container. For extra fields, specify the record type: Tooltip<(typeof data)[number]>. */
77
+ export function Tooltip({ children, offset, allowEscapeViewBox, portal, }) {
78
+ const setTooltip = useContext(TooltipSlotContext);
79
+ if (!setTooltip)
80
+ throw new Error('BarChart.Tooltip must be inside BarChart.Container');
81
+ useLayoutEffect(() => {
82
+ setTooltip({
83
+ render: children,
84
+ props: { offset, allowEscapeViewBox, portal },
85
+ });
86
+ return () => setTooltip(null);
87
+ }, [setTooltip, children, offset, allowEscapeViewBox, portal]);
88
+ return null;
89
+ }
90
+ /** Recharts gives the cursor the bar's whole rectangle; only its center line is drawn. */
91
+ function HoverGuide({ x = 0, y = 0, width = 0, height = 0, }) {
92
+ return (_jsx("line", { "data-component": "barchart-hoverguide",
93
+ // Draw at x=0 and move with a transform, so CSS can slide it between points (Recharts' cursor has no animation of its own).
94
+ x1: 0, x2: 0, y1: y, y2: y + height,
95
+ // The slide between points is built in.
96
+ className: "transition-transform duration-200 ease-out motion-reduce:transition-none", style: { transform: `translateX(${x + width / 2}px)` }, pointerEvents: "none" }));
97
+ }
98
+ export function TooltipPopup({ disableStyle, className, ...props }) {
99
+ return (_jsx("div", { ...props, "data-component": "barchart-tooltip", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
100
+ }
101
+ export function TooltipTitle({ disableStyle, className, ...props }) {
102
+ return (_jsx("p", { ...props, "data-component": "barchart-tooltiptitle", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
103
+ }
104
+ /** Shows the hovered record's label, formatted by `labelToString` on Root. */
105
+ export function TooltipLabel({ disableStyle, className, ...props }) {
106
+ const chart = useChart('TooltipLabel');
107
+ const datum = useContext(TooltipContext);
108
+ if (!datum)
109
+ throw new Error('BarChart.TooltipLabel must be inside BarChart.Tooltip');
110
+ return (_jsx("p", { ...props, "data-component": "barchart-tooltiplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: chart.labelToString(datum.label) }));
111
+ }
112
+ /** Shows the hovered record's value, formatted by `valueToString` on Root. */
113
+ export function TooltipValue({ disableStyle, className, ...props }) {
114
+ const chart = useChart('TooltipValue');
115
+ const datum = useContext(TooltipContext);
116
+ if (!datum)
117
+ throw new Error('BarChart.TooltipValue must be inside BarChart.Tooltip');
118
+ return (_jsx("p", { ...props, "data-component": "barchart-tooltipvalue", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: chart.valueToString(datum.value) }));
119
+ }
120
+ export function TooltipColorIndicator({ disableStyle, className, ...props }) {
121
+ return (_jsx("span", { "aria-hidden": "true", ...props, "data-component": "barchart-tooltipcolorindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
122
+ }
@@ -28,4 +28,3 @@ export declare function Item({ disableStyle, value, type, className, ...props }:
28
28
  export declare function Separator({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
29
29
  children?: ReactElement<ComponentProps<'svg'>>;
30
30
  }) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
31
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ChevronRight } from 'lucide-react';
2
+ import { ChevronRight } from "../../utils/icons.js";
3
3
  import { cloneElement, createContext, useContext } from 'react';
4
4
  import { twMerge } from 'tailwind-merge';
5
- const context = createContext('');
5
+ // Sharing the current location's value, so each Item knows whether it's the active one
6
+ const ActiveValueContext = /* @__PURE__ */ createContext('');
6
7
  /**
7
8
  * Set active_value on the default export to match the current Item value. Use Item for each location and Separator between locations; supply actual navigation behavior where needed.
8
9
  *
@@ -20,16 +21,15 @@ const context = createContext('');
20
21
  * }
21
22
  */
22
23
  export default function BreadCrumb({ disableStyle, active_value, className, children, ...props }) {
23
- return (_jsx("div", { ...props, "data-component": "breadcrumb-breadcrumb", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(context.Provider, { value: active_value, children: children }) }));
24
+ return (_jsx("div", { ...props, "data-component": "breadcrumb-breadcrumb", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(ActiveValueContext.Provider, { value: active_value, children: children }) }));
24
25
  }
25
26
  export function Item({ disableStyle, value, type = 'button', className, ...props }) {
26
- const active_value = useContext(context);
27
- return (_jsx("button", { ...props, type: type, "data-active": active_value === value || undefined, "data-component": "breadcrumb-item", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
27
+ const activeValue = useContext(ActiveValueContext);
28
+ return (_jsx("button", { ...props, type: type, "data-active": activeValue === value || undefined, "data-component": "breadcrumb-item", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
28
29
  }
29
30
  /** Omit children to use the supplied separator icon. Override only when another separator is needed. */
30
31
  export function Separator({ disableStyle, children = _jsx(ChevronRight, {}), className, ...props }) {
31
32
  return cloneElement(children, {
32
- ...children.props,
33
33
  ...props,
34
34
  ...{
35
35
  'data-component': 'breadcrumb-separator',
@@ -39,4 +39,3 @@ export function Separator({ disableStyle, children = _jsx(ChevronRight, {}), cla
39
39
  strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 2.5,
40
40
  });
41
41
  }
42
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { StyleProps } from '../../types/Style.ts';
2
- import type { LucideProps } from 'lucide-react';
2
+ import type { SVGIconProps } from '../../types/Icon.ts';
3
3
  import type { ButtonHTMLAttributes, ComponentProps, ReactElement } from 'react';
4
4
  export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'variant'> & {
5
5
  /** Choose the preset appearance; this does not add action behavior. */
@@ -32,7 +32,7 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'variant
32
32
  * Saving
33
33
  * </Button.default>
34
34
  */
35
- export default function Button({ disableStyle, variant, tone, size, className, children, ...props }: ButtonProps & StyleProps): import("react").JSX.Element;
35
+ export default function Button({ disableStyle, variant, tone, size, className, children, ...props }: ButtonProps): import("react").JSX.Element;
36
36
  /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
37
37
  export declare function Icon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
38
38
  /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
@@ -43,6 +43,5 @@ export declare function Icon({ disableStyle, children, className, ...props }: (O
43
43
  'data-tone'?: string;
44
44
  }, string | import("react").JSXElementConstructor<any>>;
45
45
  /** Built-in icon; no children needed. Use it inside its matching control. */
46
- export declare function LoadingIcon({ disableStyle, className, ...props }: LucideProps & StyleProps): import("react").JSX.Element;
46
+ export declare function LoadingIcon({ disableStyle, className, strokeWidth, ...props }: SVGIconProps & StyleProps): import("react").JSX.Element;
47
47
  export declare function List({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
48
- //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { LoaderCircle } from 'lucide-react';
2
+ import { LoaderCircle } from "../../utils/icons.js";
3
3
  import { cloneElement, createContext, useContext } from 'react';
4
4
  import { twMerge } from 'tailwind-merge';
5
- const context = createContext({
5
+ // Sharing the button's look with its icons, so they match its size, variant and tone
6
+ const ButtonContext = /* @__PURE__ */ createContext({
6
7
  size: 'medium',
7
8
  variant: 'primary',
8
9
  tone: 'neutral',
@@ -31,17 +32,16 @@ const context = createContext({
31
32
  * </Button.default>
32
33
  */
33
34
  export default function Button({ disableStyle, variant, tone = 'neutral', size = 'medium', className, children, ...props }) {
34
- return (_jsx("button", { ...props, "data-variant": variant, "data-tone": tone, "data-size": size, "data-component": "button-button", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(context.Provider, { value: { size, variant, tone }, children: children }) }));
35
+ return (_jsx("button", { ...props, "data-variant": variant, "data-tone": tone, "data-size": size, "data-component": "button-button", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(ButtonContext.Provider, { value: { size, variant, tone }, children: children }) }));
35
36
  }
36
37
  /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
37
38
  export function Icon({ disableStyle, children, className, ...props }) {
38
- const { size, variant, tone } = useContext(context);
39
+ const context = useContext(ButtonContext);
39
40
  return cloneElement(children, {
40
- ...children.props,
41
41
  ...props,
42
- 'data-size': size,
43
- 'data-variant': variant,
44
- 'data-tone': tone,
42
+ 'data-size': context.size,
43
+ 'data-variant': context.variant,
44
+ 'data-tone': context.tone,
45
45
  ...{
46
46
  'data-component': 'button-icon',
47
47
  'data-style-disabled': disableStyle ? '' : undefined,
@@ -50,11 +50,10 @@ export function Icon({ disableStyle, children, className, ...props }) {
50
50
  });
51
51
  }
52
52
  /** Built-in icon; no children needed. Use it inside its matching control. */
53
- export function LoadingIcon({ disableStyle, className, ...props }) {
54
- const { size, variant, tone } = useContext(context);
55
- return (_jsx(LoaderCircle, { "data-component": "button-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className, strokeWidth: undefined, ...props, "data-size": size, "data-variant": variant, "data-tone": tone }));
53
+ export function LoadingIcon({ disableStyle, className, strokeWidth = 2, ...props }) {
54
+ const context = useContext(ButtonContext);
55
+ return (_jsx(LoaderCircle, { "data-component": "button-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className, strokeWidth: strokeWidth, ...props, "data-size": context.size, "data-variant": context.variant, "data-tone": context.tone }));
56
56
  }
57
57
  export function List({ disableStyle, className, ...props }) {
58
58
  return (_jsx("div", { ...props, "data-component": "button-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
59
59
  }
60
- //# sourceMappingURL=index.js.map
@@ -31,4 +31,3 @@ export declare function Title({ disableStyle, className, ...props }: HTMLAttribu
31
31
  export declare function Description({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
32
32
  export declare function Body({ disableStyle, className, ...props }: HTMLAttributes<HTMLDivElement> & StyleProps): import("react").JSX.Element;
33
33
  export declare function Footer({ disableStyle, className, ...props }: HTMLAttributes<HTMLDivElement> & StyleProps): import("react").JSX.Element;
34
- //# sourceMappingURL=index.d.ts.map
@@ -42,4 +42,3 @@ export function Body({ disableStyle, className, ...props }) {
42
42
  export function Footer({ disableStyle, className, ...props }) {
43
43
  return (_jsx("div", { "data-component": "card-footer", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
44
44
  }
45
- //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
1
  import type { StyleProps } from '../../types/Style.ts';
2
2
  import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
3
- import type { ReactNode } from 'react';
3
+ import type { ComponentProps, ReactNode } from 'react';
4
+ import type { ValidationProps } from '../../types/Validation.ts';
5
+ import type { ValidationMessageChildren } from '../../utils/Validation.ts';
4
6
  type CoreKeys = 'checked' | 'defaultChecked' | 'onCheckedChange' | 'indeterminate' | 'disabled' | 'readOnly' | 'required' | 'name' | 'form' | 'value' | 'uncheckedValue' | 'id' | 'inputRef' | 'parent';
5
- export type RootProps = Pick<BaseCheckbox.Root.Props, CoreKeys> & {
7
+ export type RootProps = Pick<BaseCheckbox.Root.Props, CoreKeys> & ValidationProps & {
6
8
  children: ReactNode;
7
- /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
8
- tone?: 'neutral' | 'valid' | 'invalid';
9
9
  };
10
10
  /**
11
11
  * Keep Button and Indicator inside the same Root as Label. Indicator tracks checked and indeterminate state automatically; no conditional checkmark needed. Use CheckboxGroup only when coordinating several checkbox roots.
@@ -42,7 +42,7 @@ export type RootProps = Pick<BaseCheckbox.Root.Props, CoreKeys> & {
42
42
  * )
43
43
  * }
44
44
  */
45
- export declare function Root({ children, id, tone, ...coreProps }: RootProps): import("react").JSX.Element;
45
+ export declare function Root({ children, id, validation, ...coreProps }: RootProps): import("react").JSX.Element;
46
46
  /** Optional: controls multiple checkboxes as a native array of checked values. Put individual Roots inside and give each child a value. For a select-all checkbox, use parent on its Root and provide allValues on this controlled group; Base UI derives checked and indeterminate automatically. */
47
47
  export declare const CheckboxGroup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").CheckboxGroupProps, "className"> & {
48
48
  className?: string;
@@ -52,15 +52,17 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<Omit
52
52
  className?: string;
53
53
  } & StyleProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
54
54
  /** Tracks the surrounding item state automatically. Keep it mounted; do not add your own visibility condition. Use the supplied default visual unless customization is needed. */
55
- export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").CheckboxIndicatorProps, "children" | "className" | "render"> & {
55
+ export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").CheckboxIndicatorProps, "className" | "children" | "render"> & {
56
56
  className?: string;
57
57
  } & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
58
58
  /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
59
59
  export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
60
60
  export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
61
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
62
- export declare const Error: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
63
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
64
- export declare const Success: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
61
+ type MessageProps = Omit<ComponentProps<'span'>, 'children'> & StyleProps & {
62
+ children?: ValidationMessageChildren;
63
+ };
64
+ /** Shows itself only while Root's validation is `'error'`: with no children it shows the message from `['error', message]`, a function children formats that message, and other children replace it. */
65
+ export declare const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
66
+ /** Shows itself only while Root's validation is `'success'`: with no children it shows the message from `['success', message]`, a function children formats that message, and other children replace it. */
67
+ export declare const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
65
68
  export {};
66
- //# sourceMappingURL=index.d.ts.map