@central-ui/react 0.1.2 → 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 (279) hide show
  1. package/LICENSE +49 -0
  2. package/dist/components/accordion/index.d.ts +4 -3
  3. package/dist/components/accordion/index.js +7 -4
  4. package/dist/components/autocomplete/index.d.ts +14 -25
  5. package/dist/components/autocomplete/index.js +70 -54
  6. package/dist/components/avatar/index.d.ts +1 -2
  7. package/dist/components/avatar/index.js +0 -1
  8. package/dist/components/badge/index.d.ts +0 -1
  9. package/dist/components/badge/index.js +2 -2
  10. package/dist/components/banner/index.d.ts +1 -1
  11. package/dist/components/banner/index.js +23 -25
  12. package/dist/components/barchart/index.d.ts +106 -0
  13. package/dist/components/barchart/index.js +122 -0
  14. package/dist/components/breadcrumb/index.d.ts +0 -1
  15. package/dist/components/breadcrumb/index.js +6 -7
  16. package/dist/components/button/index.d.ts +2 -3
  17. package/dist/components/button/index.js +11 -12
  18. package/dist/components/card/index.d.ts +0 -1
  19. package/dist/components/card/index.js +0 -1
  20. package/dist/components/checkbox/index.d.ts +13 -11
  21. package/dist/components/checkbox/index.js +51 -31
  22. package/dist/components/chip/index.d.ts +1 -1
  23. package/dist/components/chip/index.js +2 -3
  24. package/dist/components/combobox/index.d.ts +18 -30
  25. package/dist/components/combobox/index.js +90 -67
  26. package/dist/components/datepicker/index.d.ts +18 -31
  27. package/dist/components/datepicker/index.js +81 -99
  28. package/dist/components/dialog/index.d.ts +14 -27
  29. package/dist/components/dialog/index.js +17 -18
  30. package/dist/components/divider/index.d.ts +0 -1
  31. package/dist/components/divider/index.js +0 -1
  32. package/dist/components/donutchart/index.d.ts +100 -0
  33. package/dist/components/donutchart/index.js +178 -0
  34. package/dist/components/drawer/index.d.ts +12 -21
  35. package/dist/components/drawer/index.js +34 -36
  36. package/dist/components/empty/index.d.ts +1 -2
  37. package/dist/components/empty/index.js +2 -4
  38. package/dist/components/fileupload/index.d.ts +4 -9
  39. package/dist/components/fileupload/index.js +26 -38
  40. package/dist/components/form/index.d.ts +0 -1
  41. package/dist/components/form/index.js +0 -1
  42. package/dist/components/horizontalbarchart/index.d.ts +120 -0
  43. package/dist/components/horizontalbarchart/index.js +193 -0
  44. package/dist/components/input/index.d.ts +22 -22
  45. package/dist/components/input/index.js +76 -105
  46. package/dist/components/linechart/index.d.ts +114 -0
  47. package/dist/components/linechart/index.js +139 -0
  48. package/dist/components/menu/index.d.ts +9 -11
  49. package/dist/components/menu/index.js +42 -39
  50. package/dist/components/metric/index.d.ts +0 -1
  51. package/dist/components/metric/index.js +0 -1
  52. package/dist/components/numberinput/index.d.ts +14 -21
  53. package/dist/components/numberinput/index.js +40 -53
  54. package/dist/components/otpinput/index.d.ts +14 -9
  55. package/dist/components/otpinput/index.js +25 -18
  56. package/dist/components/page/index.d.ts +0 -1
  57. package/dist/components/page/index.js +1 -3
  58. package/dist/components/passwordinput/index.d.ts +14 -11
  59. package/dist/components/passwordinput/index.js +36 -45
  60. package/dist/components/popover/index.d.ts +21 -19
  61. package/dist/components/popover/index.js +34 -15
  62. package/dist/components/radio/index.d.ts +13 -9
  63. package/dist/components/radio/index.js +69 -60
  64. package/dist/components/ratinginput/index.d.ts +13 -8
  65. package/dist/components/ratinginput/index.js +37 -17
  66. package/dist/components/select/index.d.ts +25 -28
  67. package/dist/components/select/index.js +67 -38
  68. package/dist/components/skeleton/index.d.ts +0 -1
  69. package/dist/components/skeleton/index.js +0 -1
  70. package/dist/components/slider/index.d.ts +14 -9
  71. package/dist/components/slider/index.js +64 -63
  72. package/dist/components/spinner/index.d.ts +1 -2
  73. package/dist/components/spinner/index.js +2 -3
  74. package/dist/components/splitter/index.d.ts +1 -2
  75. package/dist/components/splitter/index.js +5 -6
  76. package/dist/components/stepper/index.d.ts +8 -20
  77. package/dist/components/stepper/index.js +15 -16
  78. package/dist/components/switch/index.d.ts +12 -10
  79. package/dist/components/switch/index.js +46 -30
  80. package/dist/components/table/index.d.ts +3 -3
  81. package/dist/components/table/index.js +14 -13
  82. package/dist/components/tabs/index.d.ts +0 -1
  83. package/dist/components/tabs/index.js +1 -2
  84. package/dist/components/textarea/index.d.ts +14 -11
  85. package/dist/components/textarea/index.js +37 -46
  86. package/dist/components/textlink/index.d.ts +3 -1
  87. package/dist/components/textlink/index.js +4 -1
  88. package/dist/components/toast/index.d.ts +8 -14
  89. package/dist/components/toast/index.js +48 -48
  90. package/dist/components/toggle/index.d.ts +0 -1
  91. package/dist/components/toggle/index.js +17 -24
  92. package/dist/components/tooltip/index.d.ts +11 -13
  93. package/dist/components/tooltip/index.js +12 -9
  94. package/dist/components/tour/index.d.ts +154 -0
  95. package/dist/components/tour/index.js +280 -0
  96. package/dist/index.d.ts +5 -2
  97. package/dist/index.js +5 -1
  98. package/dist/types/Icon.d.ts +0 -1
  99. package/dist/types/Icon.js +0 -1
  100. package/dist/types/Style.d.ts +0 -1
  101. package/dist/types/Style.js +0 -1
  102. package/dist/types/Tone.d.ts +0 -1
  103. package/dist/types/Tone.js +0 -1
  104. package/dist/types/Validation.d.ts +12 -0
  105. package/dist/types/Validation.js +1 -0
  106. package/dist/utils/ArkStateToDataAttributes.d.ts +0 -1
  107. package/dist/utils/ArkStateToDataAttributes.js +0 -1
  108. package/dist/utils/Tone.d.ts +0 -1
  109. package/dist/utils/Tone.js +0 -1
  110. package/dist/utils/Validation.d.ts +14 -0
  111. package/dist/utils/Validation.js +23 -0
  112. package/dist/utils/asChild.d.ts +41 -0
  113. package/dist/utils/asChild.js +15 -0
  114. package/dist/utils/icons.d.ts +24 -0
  115. package/dist/utils/icons.js +160 -0
  116. package/dist/utils/useForwardClickToInput.d.ts +0 -1
  117. package/dist/utils/useForwardClickToInput.js +0 -1
  118. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +0 -1
  119. package/dist/utils/virtualization/useVirtualizedAutocomplete.js +0 -1
  120. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +0 -1
  121. package/dist/utils/virtualization/useVirtualizedCombobox.js +0 -1
  122. package/dist/utils/virtualization/useVirtualizedTable.d.ts +0 -1
  123. package/dist/utils/virtualization/useVirtualizedTable.js +0 -1
  124. package/package.json +12 -11
  125. package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +2 -2
  126. package/src/presets/shopify-polaris/shopify-polaris-barchart.css +64 -0
  127. package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +2 -2
  128. package/src/presets/shopify-polaris/shopify-polaris-combobox.css +2 -2
  129. package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +4 -4
  130. package/src/presets/shopify-polaris/shopify-polaris-dialog.css +16 -0
  131. package/src/presets/shopify-polaris/shopify-polaris-donutchart.css +172 -0
  132. package/src/presets/shopify-polaris/shopify-polaris-drawer.css +16 -0
  133. package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +1 -1
  134. package/src/presets/shopify-polaris/shopify-polaris-horizontalbarchart.css +60 -0
  135. package/src/presets/shopify-polaris/shopify-polaris-input.css +2 -2
  136. package/src/presets/shopify-polaris/shopify-polaris-linechart.css +68 -0
  137. package/src/presets/shopify-polaris/shopify-polaris-menu.css +16 -0
  138. package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +2 -2
  139. package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +2 -2
  140. package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +2 -2
  141. package/src/presets/shopify-polaris/shopify-polaris-popover.css +29 -0
  142. package/src/presets/shopify-polaris/shopify-polaris-radio.css +2 -2
  143. package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +2 -2
  144. package/src/presets/shopify-polaris/shopify-polaris-select.css +2 -2
  145. package/src/presets/shopify-polaris/shopify-polaris-slider.css +2 -2
  146. package/src/presets/shopify-polaris/shopify-polaris-stepper.css +16 -0
  147. package/src/presets/shopify-polaris/shopify-polaris-switch.css +2 -2
  148. package/src/presets/shopify-polaris/shopify-polaris-textarea.css +2 -2
  149. package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +16 -0
  150. package/src/presets/shopify-polaris/shopify-polaris.css +4 -0
  151. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +2 -2
  152. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-barchart.css +64 -0
  153. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +2 -2
  154. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +2 -2
  155. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +2 -2
  156. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +9 -0
  157. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-donutchart.css +172 -0
  158. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +9 -0
  159. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +1 -1
  160. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-horizontalbarchart.css +60 -0
  161. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +2 -2
  162. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-linechart.css +68 -0
  163. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +9 -0
  164. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +2 -2
  165. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +2 -2
  166. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +2 -2
  167. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +22 -0
  168. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +2 -2
  169. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +2 -2
  170. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +2 -2
  171. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +9 -0
  172. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +2 -2
  173. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +2 -2
  174. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +9 -0
  175. package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +4 -0
  176. package/dist/components/accordion/index.d.ts.map +0 -1
  177. package/dist/components/accordion/index.js.map +0 -1
  178. package/dist/components/autocomplete/index.d.ts.map +0 -1
  179. package/dist/components/autocomplete/index.js.map +0 -1
  180. package/dist/components/avatar/index.d.ts.map +0 -1
  181. package/dist/components/avatar/index.js.map +0 -1
  182. package/dist/components/badge/index.d.ts.map +0 -1
  183. package/dist/components/badge/index.js.map +0 -1
  184. package/dist/components/banner/index.d.ts.map +0 -1
  185. package/dist/components/banner/index.js.map +0 -1
  186. package/dist/components/breadcrumb/index.d.ts.map +0 -1
  187. package/dist/components/breadcrumb/index.js.map +0 -1
  188. package/dist/components/button/index.d.ts.map +0 -1
  189. package/dist/components/button/index.js.map +0 -1
  190. package/dist/components/card/index.d.ts.map +0 -1
  191. package/dist/components/card/index.js.map +0 -1
  192. package/dist/components/checkbox/index.d.ts.map +0 -1
  193. package/dist/components/checkbox/index.js.map +0 -1
  194. package/dist/components/chip/index.d.ts.map +0 -1
  195. package/dist/components/chip/index.js.map +0 -1
  196. package/dist/components/combobox/index.d.ts.map +0 -1
  197. package/dist/components/combobox/index.js.map +0 -1
  198. package/dist/components/datepicker/index.d.ts.map +0 -1
  199. package/dist/components/datepicker/index.js.map +0 -1
  200. package/dist/components/dialog/index.d.ts.map +0 -1
  201. package/dist/components/dialog/index.js.map +0 -1
  202. package/dist/components/divider/index.d.ts.map +0 -1
  203. package/dist/components/divider/index.js.map +0 -1
  204. package/dist/components/drawer/index.d.ts.map +0 -1
  205. package/dist/components/drawer/index.js.map +0 -1
  206. package/dist/components/empty/index.d.ts.map +0 -1
  207. package/dist/components/empty/index.js.map +0 -1
  208. package/dist/components/fileupload/index.d.ts.map +0 -1
  209. package/dist/components/fileupload/index.js.map +0 -1
  210. package/dist/components/form/index.d.ts.map +0 -1
  211. package/dist/components/form/index.js.map +0 -1
  212. package/dist/components/input/index.d.ts.map +0 -1
  213. package/dist/components/input/index.js.map +0 -1
  214. package/dist/components/menu/index.d.ts.map +0 -1
  215. package/dist/components/menu/index.js.map +0 -1
  216. package/dist/components/metric/index.d.ts.map +0 -1
  217. package/dist/components/metric/index.js.map +0 -1
  218. package/dist/components/numberinput/index.d.ts.map +0 -1
  219. package/dist/components/numberinput/index.js.map +0 -1
  220. package/dist/components/otpinput/index.d.ts.map +0 -1
  221. package/dist/components/otpinput/index.js.map +0 -1
  222. package/dist/components/page/index.d.ts.map +0 -1
  223. package/dist/components/page/index.js.map +0 -1
  224. package/dist/components/passwordinput/index.d.ts.map +0 -1
  225. package/dist/components/passwordinput/index.js.map +0 -1
  226. package/dist/components/popover/index.d.ts.map +0 -1
  227. package/dist/components/popover/index.js.map +0 -1
  228. package/dist/components/radio/index.d.ts.map +0 -1
  229. package/dist/components/radio/index.js.map +0 -1
  230. package/dist/components/ratinginput/index.d.ts.map +0 -1
  231. package/dist/components/ratinginput/index.js.map +0 -1
  232. package/dist/components/select/index.d.ts.map +0 -1
  233. package/dist/components/select/index.js.map +0 -1
  234. package/dist/components/skeleton/index.d.ts.map +0 -1
  235. package/dist/components/skeleton/index.js.map +0 -1
  236. package/dist/components/slider/index.d.ts.map +0 -1
  237. package/dist/components/slider/index.js.map +0 -1
  238. package/dist/components/spinner/index.d.ts.map +0 -1
  239. package/dist/components/spinner/index.js.map +0 -1
  240. package/dist/components/splitter/index.d.ts.map +0 -1
  241. package/dist/components/splitter/index.js.map +0 -1
  242. package/dist/components/stepper/index.d.ts.map +0 -1
  243. package/dist/components/stepper/index.js.map +0 -1
  244. package/dist/components/switch/index.d.ts.map +0 -1
  245. package/dist/components/switch/index.js.map +0 -1
  246. package/dist/components/table/index.d.ts.map +0 -1
  247. package/dist/components/table/index.js.map +0 -1
  248. package/dist/components/tabs/index.d.ts.map +0 -1
  249. package/dist/components/tabs/index.js.map +0 -1
  250. package/dist/components/textarea/index.d.ts.map +0 -1
  251. package/dist/components/textarea/index.js.map +0 -1
  252. package/dist/components/textlink/index.d.ts.map +0 -1
  253. package/dist/components/textlink/index.js.map +0 -1
  254. package/dist/components/toast/index.d.ts.map +0 -1
  255. package/dist/components/toast/index.js.map +0 -1
  256. package/dist/components/toggle/index.d.ts.map +0 -1
  257. package/dist/components/toggle/index.js.map +0 -1
  258. package/dist/components/tooltip/index.d.ts.map +0 -1
  259. package/dist/components/tooltip/index.js.map +0 -1
  260. package/dist/index.d.ts.map +0 -1
  261. package/dist/index.js.map +0 -1
  262. package/dist/types/Icon.d.ts.map +0 -1
  263. package/dist/types/Icon.js.map +0 -1
  264. package/dist/types/Style.d.ts.map +0 -1
  265. package/dist/types/Style.js.map +0 -1
  266. package/dist/types/Tone.d.ts.map +0 -1
  267. package/dist/types/Tone.js.map +0 -1
  268. package/dist/utils/ArkStateToDataAttributes.d.ts.map +0 -1
  269. package/dist/utils/ArkStateToDataAttributes.js.map +0 -1
  270. package/dist/utils/Tone.d.ts.map +0 -1
  271. package/dist/utils/Tone.js.map +0 -1
  272. package/dist/utils/useForwardClickToInput.d.ts.map +0 -1
  273. package/dist/utils/useForwardClickToInput.js.map +0 -1
  274. package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +0 -1
  275. package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +0 -1
  276. package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +0 -1
  277. package/dist/utils/virtualization/useVirtualizedCombobox.js.map +0 -1
  278. package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +0 -1
  279. package/dist/utils/virtualization/useVirtualizedTable.js.map +0 -1
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
3
3
  import { Radio as BaseRadio } from '@base-ui/react/radio';
4
4
  import { createContext, useCallback, forwardRef, useContext, useEffect, useId, useState, } from 'react';
5
- import { ToneProvider, useToneContext } from "../../utils/Tone.js";
5
+ import { readValidation, validationAttributes, validationMessageContent, } from "../../utils/Validation.js";
6
6
  /**
7
7
  * Root owns the chosen value. For each choice keep Item, ItemButton, ItemIndicator, and ItemLabel together. The indicator follows selection automatically; do not manage a separate checked state for each item.
8
8
  *
@@ -59,29 +59,32 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
59
59
  * }
60
60
  * </Radio.Root>
61
61
  */
62
- export function Root({ children, tone = 'neutral', ...props }) {
62
+ export function Root({ children, validation, ...props }) {
63
+ // Holding the ids of the group's labels and messages, so the group announces them to screen readers
63
64
  const [labelIds, setLabelIds] = useState([]);
64
65
  const [messageIds, setMessageIds] = useState([]);
65
- return (_jsx(ToneProvider, { value: tone, children: _jsx(BaseRadioGroup, { ...props, "aria-labelledby": [props['aria-labelledby'], ...labelIds].filter(Boolean).join(' ') ||
66
- undefined, "aria-describedby": [props['aria-describedby'], ...messageIds]
67
- .filter(Boolean)
68
- .join(' ') || undefined, "aria-invalid": tone === 'invalid' || props['aria-invalid'] || undefined, render: (groupProps, state) => {
69
- const { children, ...elementProps } = groupProps;
70
- return (_jsx(RadioContext.Provider, { value: {
71
- elementProps,
72
- state,
73
- messageIds,
74
- setMessageIds,
75
- setLabelIds,
76
- }, children: _jsx(_Fragment, { children: children }) }));
77
- }, children: children }) }));
66
+ const chosenValidation = readValidation(validation);
67
+ return (_jsx(BaseRadioGroup, { ...props, "aria-labelledby": [props['aria-labelledby'], ...labelIds].filter(Boolean).join(' ') ||
68
+ undefined, "aria-describedby": [props['aria-describedby'], ...messageIds].filter(Boolean).join(' ') ||
69
+ undefined, "aria-invalid": chosenValidation.state === 'error' || props['aria-invalid'] || undefined, render: (groupProps, state) => {
70
+ // Base UI's group props go to Container, which renders the group element; only its children render here
71
+ const { children, ...elementProps } = groupProps;
72
+ return (_jsx(RadioContext.Provider, { value: {
73
+ elementProps,
74
+ state,
75
+ messageIds,
76
+ setMessageIds,
77
+ setLabelIds,
78
+ validation: chosenValidation,
79
+ }, children: _jsx(_Fragment, { children: children }) }));
80
+ }, children: children }));
78
81
  }
79
82
  export const Container = /* @__PURE__ */ forwardRef(function Container({ disableStyle, className, ...props }, ref) {
80
83
  return (_jsx("div", { ...props, ref: ref, "data-component": "radio-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
81
84
  });
82
85
  export const List = /* @__PURE__ */ forwardRef(function List({ disableStyle, ...props }, ref) {
83
- const { elementProps } = useRadioContext();
84
- const { ref: nativeRef, ...nativeProps } = elementProps;
86
+ const context = useRadioContext();
87
+ const { ref: nativeRef, ...nativeProps } = context.elementProps;
85
88
  return (_jsx("div", { ...nativeProps, ...props, ref: useRootRef(nativeRef, ref), "data-component": "radio-list", "data-style-disabled": disableStyle ? '' : undefined, className: props.className }));
86
89
  });
87
90
  /** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
@@ -123,10 +126,9 @@ export function Item({ disableStyle, children, value, disabled, readOnly, requir
123
126
  export const ItemButton = /* @__PURE__ */ forwardRef(function ItemButton({ disableStyle, className, ...props }, ref) {
124
127
  const item = useItemContext();
125
128
  const group = useRadioContext();
126
- const tone = useToneContext();
127
129
  return (_jsx(BaseRadio.Root, { ...props, ...item.coreProps, ref: ref, "aria-describedby": [props['aria-describedby'], ...group.messageIds, ...item.messageIds]
128
130
  .filter(Boolean)
129
- .join(' ') || undefined, "aria-invalid": tone === 'invalid' || props['aria-invalid'] || undefined, "data-tone": tone, "data-component": "radio-itembutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(RadioButtonSurface, { ...buttonProps, state: state })) }));
131
+ .join(' ') || undefined, "aria-invalid": group.validation.state === 'error' || props['aria-invalid'] || undefined, ...validationAttributes(group.validation), "data-component": "radio-itembutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(RadioButtonSurface, { ...buttonProps, state: state })) }));
130
132
  });
131
133
  /** 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. */
132
134
  export const ItemIndicator = /* @__PURE__ */ forwardRef(function ItemIndicator({ disableStyle, children, className, ...props }, ref) {
@@ -151,17 +153,27 @@ export const Description = /* @__PURE__ */ forwardRef(function Description({ dis
151
153
  const context = useRadioContext();
152
154
  return (_jsx("div", { ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "radio-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
153
155
  });
154
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
155
- export const Error = /* @__PURE__ */ forwardRef(function Error({ disableStyle, className, id, ...props }, ref) {
156
- const messageId = useMessageId(id);
156
+ /** 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. */
157
+ export const Error = /* @__PURE__ */ forwardRef(function Error({ children, ...props }, ref) {
158
+ const context = useRadioContext();
159
+ const content = validationMessageContent(context.validation, 'error', children);
160
+ if (content === undefined)
161
+ return null;
162
+ return (_jsx(Message, { ...props, ref: ref, role: "alert", component: "radio-error", children: content }));
163
+ });
164
+ /** 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. */
165
+ export const Success = /* @__PURE__ */ forwardRef(function Success({ children, ...props }, ref) {
157
166
  const context = useRadioContext();
158
- return (_jsx("div", { role: "alert", "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "radio-error", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
167
+ const content = validationMessageContent(context.validation, 'success', children);
168
+ if (content === undefined)
169
+ return null;
170
+ return (_jsx(Message, { ...props, ref: ref, role: "status", component: "radio-success", children: content }));
159
171
  });
160
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
161
- export const Success = /* @__PURE__ */ forwardRef(function Success({ disableStyle, className, id, ...props }, ref) {
172
+ // The shared body of Error and Success, mounted only while they show, so only visible messages describe the group
173
+ const Message = /* @__PURE__ */ forwardRef(function Message({ disableStyle, className, id, component, ...props }, ref) {
162
174
  const messageId = useMessageId(id);
163
175
  const context = useRadioContext();
164
- return (_jsx("div", { role: "status", "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "radio-success", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
176
+ return (_jsx("div", { "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-disabled": context.state.disabled ? '' : undefined, ...validationAttributes(context.validation), "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className }));
165
177
  });
166
178
  const RadioContext = /* @__PURE__ */ createContext(null);
167
179
  function useRadioContext() {
@@ -177,56 +189,53 @@ function useItemContext() {
177
189
  throw new globalThis.Error('Radio item parts must be inside Radio.Item');
178
190
  return context;
179
191
  }
192
+ // Rendered by Base UI as the radio element, it reports Base UI's live state back to the item's mirror
180
193
  const RadioButtonSurface = /* @__PURE__ */ forwardRef(function RadioButtonSurface({ state, ...props }, ref) {
181
- const { setState } = useItemContext();
194
+ const context = useItemContext();
182
195
  useEffect(() => {
183
- setState({
196
+ context.setState({
184
197
  checked: state.checked,
185
198
  disabled: state.disabled,
186
199
  readOnly: state.readOnly,
187
200
  required: state.required,
188
201
  });
189
- }, [state.checked, state.disabled, state.readOnly, state.required, setState]);
202
+ }, [state.checked, state.disabled, state.readOnly, state.required, context.setState]);
190
203
  return _jsx("span", { ...props, ref: ref });
191
204
  });
205
+ // Registering a message part's id in the group's and buttons' aria-describedby while the part is mounted
192
206
  function useMessageId(id) {
193
207
  const generatedId = useId();
194
208
  const messageId = id ?? generatedId;
195
- const { setMessageIds } = useRadioContext();
209
+ const context = useRadioContext();
196
210
  useEffect(() => {
197
- setMessageIds((current) => [...current, messageId]);
198
- return () => setMessageIds((current) => current.filter((value) => value !== messageId));
199
- }, [messageId, setMessageIds]);
211
+ context.setMessageIds((current) => [...current, messageId]);
212
+ return () => context.setMessageIds((current) => current.filter((value) => value !== messageId));
213
+ }, [messageId, context.setMessageIds]);
200
214
  return messageId;
201
215
  }
216
+ // Merging Base UI's ref with the consumer's one onto the same element
202
217
  function useRootRef(nativeRef, forwardedRef) {
203
218
  return useCallback((element) => {
204
- const nativeCleanup = typeof nativeRef === 'function'
205
- ? nativeRef(element)
206
- : nativeRef
207
- ? ((nativeRef.current = element), undefined)
208
- : undefined;
209
- const forwardedCleanup = typeof forwardedRef === 'function'
210
- ? forwardedRef(element)
211
- : forwardedRef
212
- ? ((forwardedRef.current = element), undefined)
213
- : undefined;
214
- if (typeof nativeCleanup === 'function' ||
215
- typeof forwardedCleanup === 'function')
216
- return () => {
217
- if (typeof nativeCleanup === 'function')
218
- nativeCleanup();
219
- else if (typeof nativeRef === 'function')
220
- nativeRef(null);
221
- else if (nativeRef)
222
- nativeRef.current = null;
223
- if (typeof forwardedCleanup === 'function')
224
- forwardedCleanup();
225
- else if (typeof forwardedRef === 'function')
226
- forwardedRef(null);
227
- else if (forwardedRef)
228
- forwardedRef.current = null;
229
- };
219
+ const refs = [nativeRef, forwardedRef];
220
+ //1. Setting both refs, keeping the cleanups that callback refs may return
221
+ const cleanups = refs.map((ref) => {
222
+ if (typeof ref === 'function')
223
+ return ref(element);
224
+ if (ref)
225
+ ref.current = element;
226
+ return undefined;
227
+ });
228
+ //2. Returning a cleanup only when a ref asked for one, since React then stops calling refs with null itself
229
+ if (!cleanups.some((cleanup) => typeof cleanup === 'function'))
230
+ return;
231
+ return () => refs.forEach((ref, index) => {
232
+ const cleanup = cleanups[index];
233
+ if (typeof cleanup === 'function')
234
+ return cleanup();
235
+ if (typeof ref === 'function')
236
+ return ref(null);
237
+ if (ref)
238
+ ref.current = null;
239
+ });
230
240
  }, [nativeRef, forwardedRef]);
231
241
  }
232
- //# sourceMappingURL=index.js.map
@@ -2,6 +2,8 @@ import type { StyleProps } from '../../types/Style.ts';
2
2
  import { type RatingGroupControlProps, type RatingGroupItemProps, type RatingGroupLabelProps, type RatingGroupRootProps } from '@ark-ui/react/rating-group';
3
3
  import type { SVGIconProps } from '../../types/Icon.ts';
4
4
  import type { ComponentProps, ReactElement, ReactNode } from 'react';
5
+ import type { Validation } from '../../types/Validation.ts';
6
+ import type { ValidationMessageChildren } from '../../utils/Validation.ts';
5
7
  /**
6
8
  * Root configures the scale and selection. StarsList supplies indices; use StarButton with StarIcon for each rating. Highlight, checked, and half-star appearance are built in; do not recreate hover state.
7
9
  *
@@ -34,9 +36,9 @@ import type { ComponentProps, ReactElement, ReactNode } from 'react';
34
36
  * }
35
37
  * </RatingInput.Root>
36
38
  */
37
- export declare function Root({ children, tone, ...props }: Omit<RatingGroupRootProps, 'asChild'> & {
38
- /** Visual feedback only; defaults to neutral. */
39
- tone?: 'neutral' | 'valid' | 'invalid';
39
+ export declare function Root({ children, validation, ...props }: Omit<RatingGroupRootProps, 'asChild'> & {
40
+ /** The rating's validation state, with an optional message: `'error'` styles it as invalid, `['error', 'Rate your delivery']` also shows that message in Error. Same for `'success'` and Success. Omit it for a neutral rating. */
41
+ validation?: Validation;
40
42
  }): import("react").JSX.Element;
41
43
  export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
42
44
  export declare function Label({ disableStyle, className, ...props }: Omit<RatingGroupLabelProps, 'asChild'> & StyleProps): import("react").JSX.Element;
@@ -52,8 +54,11 @@ export declare function StarButton({ disableStyle, children, className, ...props
52
54
  /** Built-in icon; no children needed. Use it inside its matching control. */
53
55
  export declare function StarIcon({ disableStyle, className, strokeWidth, style, ...props }: Omit<SVGIconProps, 'children'> & StyleProps): import("react").JSX.Element;
54
56
  export declare function Description({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
55
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
56
- export declare function Error({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
57
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
58
- export declare function Success({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
59
- //# sourceMappingURL=index.d.ts.map
57
+ type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
58
+ children?: ValidationMessageChildren;
59
+ };
60
+ /** 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. */
61
+ export declare function Error({ children, ...props }: MessageProps): import("react").JSX.Element | null;
62
+ /** 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. */
63
+ export declare function Success({ children, ...props }: MessageProps): import("react").JSX.Element | null;
64
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { RatingGroup, useRatingGroup, useRatingGroupContext, } from '@ark-ui/react/rating-group';
3
- import { Star as DefaultStarIcon } from 'lucide-react';
4
- import { cloneElement, forwardRef, useId, Fragment } from 'react';
5
- import { ToneProvider, useToneContext } from "../../utils/Tone.js";
3
+ import { Star as DefaultStarIcon } from "../../utils/icons.js";
4
+ import { cloneElement, createContext, forwardRef, useContext, useId, Fragment } from 'react';
5
+ import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
6
6
  /**
7
7
  * Root configures the scale and selection. StarsList supplies indices; use StarButton with StarIcon for each rating. Highlight, checked, and half-star appearance are built in; do not recreate hover state.
8
8
  *
@@ -35,13 +35,13 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
35
35
  * }
36
36
  * </RatingInput.Root>
37
37
  */
38
- export function Root({ children, tone = 'neutral', ...props }) {
38
+ export function Root({ children, validation, ...props }) {
39
39
  const rating = useRatingGroup(props);
40
- return (_jsx(ToneProvider, { value: tone, children: _jsx(RatingGroup.RootProvider, { value: rating, asChild: true, children: _jsx(_Fragment, { children: children }) }) }));
40
+ return (_jsx(RootPropsContext.Provider, { value: { validation: readValidation(validation) }, children: _jsx(RatingGroup.RootProvider, { value: rating, asChild: true, children: _jsx(_Fragment, { children: children }) }) }));
41
41
  }
42
42
  export const Container = /* @__PURE__ */ forwardRef(({ disableStyle, children, className, ...props }, ref) => {
43
- const tone = useToneContext();
44
- return (_jsxs("div", { ...props, ref: ref, "data-tone": tone, "data-component": "ratinginput-container", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [children, _jsx(RatingGroup.HiddenInput, { style: { display: 'none' } })] }));
43
+ const root = useRootPropsContext();
44
+ return (_jsxs("div", { ...props, ref: ref, ...validationAttributes(root.validation), "data-component": "ratinginput-container", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [children, _jsx(RatingGroup.HiddenInput, { style: { display: 'none' } })] }));
45
45
  });
46
46
  export function Label({ disableStyle, className, ...props }) {
47
47
  return (_jsx(RatingGroup.Label, { ...props, "data-component": "ratinginput-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
@@ -52,16 +52,16 @@ export function StarsList({ disableStyle, className, children, ...props }) {
52
52
  return (_jsx(RatingGroup.Control, { ...props, "data-component": "ratinginput-starslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: context.items.map((index) => (_jsx(Fragment, { children: children(index) }, index))) }));
53
53
  }
54
54
  export function StarButton({ disableStyle, children, className, ...props }) {
55
- const tone = useToneContext();
55
+ const root = useRootPropsContext();
56
56
  const rating = useRatingGroupContext();
57
57
  const input = rating.getHiddenInputProps();
58
- return (_jsx(RatingGroup.Item, { ...props, "data-tone": tone, "data-component": "ratinginput-starbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(RatingGroup.ItemContext, { children: ({ highlighted, half, checked }) => cloneElement(children, {
58
+ return (_jsx(RatingGroup.Item, { ...props, "aria-invalid": root.validation.state === 'error' || props['aria-invalid'] || undefined, ...validationAttributes(root.validation), "data-component": "ratinginput-starbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(RatingGroup.ItemContext, { children: ({ highlighted, half, checked }) => cloneElement(children, {
59
59
  'data-highlighted': highlighted ? '' : undefined,
60
60
  'data-half': half ? '' : undefined,
61
61
  'data-checked': checked ? '' : undefined,
62
62
  'data-disabled': input.disabled ? '' : undefined,
63
63
  'data-readonly': input.readOnly ? '' : undefined,
64
- 'data-tone': tone,
64
+ ...validationAttributes(root.validation),
65
65
  'aria-hidden': true,
66
66
  }) }) }));
67
67
  }
@@ -77,12 +77,32 @@ export function StarIcon({ disableStyle, className, strokeWidth, style, ...props
77
77
  export function Description({ disableStyle, className, ...props }) {
78
78
  return (_jsx("div", { ...props, "data-component": "ratinginput-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
79
79
  }
80
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
81
- export function Error({ disableStyle, className, ...props }) {
82
- return (_jsx("div", { ...props, "data-component": "ratinginput-error", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
80
+ /** 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. */
81
+ export function Error({ children, ...props }) {
82
+ const root = useRootPropsContext();
83
+ const content = validationMessageContent(root.validation, 'error', children);
84
+ if (content === undefined)
85
+ return null;
86
+ return _jsx(Message, { ...props, role: "alert", component: "ratinginput-error", children: content });
83
87
  }
84
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
85
- export function Success({ disableStyle, className, ...props }) {
86
- return (_jsx("div", { ...props, "data-component": "ratinginput-success", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
88
+ /** 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. */
89
+ export function Success({ children, ...props }) {
90
+ const root = useRootPropsContext();
91
+ const content = validationMessageContent(root.validation, 'success', children);
92
+ if (content === undefined)
93
+ return null;
94
+ return _jsx(Message, { ...props, role: "status", component: "ratinginput-success", children: content });
95
+ }
96
+ // The shared body of Error and Success, mounted only while they show
97
+ function Message({ disableStyle, className, component, ...props }) {
98
+ const root = useRootPropsContext();
99
+ return _jsx("div", { "aria-atomic": "true", ...props, ...validationAttributes(root.validation), "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
100
+ }
101
+ // Root's own props shared with the parts, since Ark's rating context only carries the rating state
102
+ const RootPropsContext = /* @__PURE__ */ createContext(null);
103
+ function useRootPropsContext() {
104
+ const context = useContext(RootPropsContext);
105
+ if (!context)
106
+ throw new globalThis.Error('RatingInput parts must be inside RatingInput.Root');
107
+ return context;
87
108
  }
88
- //# sourceMappingURL=index.js.map
@@ -1,7 +1,10 @@
1
1
  import type { StyleProps } from '../../types/Style.ts';
2
+ import type { AsChildProps } from '../../utils/asChild.ts';
2
3
  import { Select as BaseSelect } from '@base-ui/react/select';
3
4
  import type { SVGIconProps } from '../../types/Icon.ts';
4
- import type { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
5
+ import type { ComponentProps, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
6
+ import type { Validation } from '../../types/Validation.ts';
7
+ import type { ValidationMessageChildren } from '../../utils/Validation.ts';
5
8
  export type ItemShape = {
6
9
  /** Used automatically for the displayed selection. No label accessor needed. */
7
10
  label: string;
@@ -23,8 +26,8 @@ export type ItemType<T extends readonly GroupShape[]> = GroupType<T>['items'][nu
23
26
  export type RootProps<T extends readonly GroupShape[], Multiple extends boolean | undefined = false> = Omit<BaseSelect.Root.Props<ItemType<T>, Multiple>, 'items' | 'itemToStringLabel' | 'itemToStringValue' | 'isItemEqualToValue'> & {
24
27
  /** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
25
28
  items: T;
26
- /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
27
- tone?: 'neutral' | 'valid' | 'invalid';
29
+ /** The field's validation state, with an optional message: `'error'` styles it as invalid, `['error', 'Pick a size']` also shows that message in Error. Same for `'success'` and Success. Omit it for a neutral field. */
30
+ validation?: Validation;
28
31
  };
29
32
  /**
30
33
  * Prepare groups in items. A flat-looking list is one group with an empty label and no GroupLabel; keep Group around ItemsList. OpenButtonValue already formats the selection: omit children unless a custom display is needed. Keep ScrollArea → GroupsList → Group → ItemsList → Item in Popup.
@@ -111,7 +114,7 @@ export type RootProps<T extends readonly GroupShape[], Multiple extends boolean
111
114
  * }
112
115
  * </Select.Root>
113
116
  */
114
- export declare function Root<T extends readonly GroupShape[], Multiple extends boolean | undefined = false>({ children, items, id, tone, open, defaultOpen, onOpenChange, ...props }: RootProps<T, Multiple>): import("react").JSX.Element;
117
+ export declare function Root<T extends readonly GroupShape[], Multiple extends boolean | undefined = false>({ children, items, id, validation, defaultOpen, onOpenChange, ...props }: RootProps<T, Multiple>): import("react").JSX.Element;
115
118
  export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
116
119
  export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectLabelProps, "className"> & {
117
120
  className?: string;
@@ -123,57 +126,48 @@ export type OpenButtonValueProps<Value extends ItemShape | ItemShape[] | null =
123
126
  children?: ReactNode | ((value: Value) => ReactNode);
124
127
  } & StyleProps;
125
128
  /** Omit children to keep the built-in formatted value. Supply children only for a special display; do not format the selection yourself for the usual case. */
126
- export declare function OpenButtonValue<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null>({ disableStyle, className, ...props }: OpenButtonValueProps<Value> & StyleProps): import("react").JSX.Element;
129
+ export declare function OpenButtonValue<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null>({ disableStyle, className, ...props }: OpenButtonValueProps<Value>): import("react").JSX.Element;
127
130
  export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseSelect.List>, 'children' | 'className'> & {
128
131
  className?: string;
129
132
  children?: ReactNode;
130
133
  } & StyleProps;
131
- export declare const ScrollArea: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react").SelectListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "children" | "className"> & {
132
- className?: string;
133
- children?: ReactNode;
134
- } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
134
+ export declare const ScrollArea: import("react").ForwardRefExoticComponent<Omit<ScrollAreaProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
135
135
  export type GroupsListProps<Group extends GroupShape = GroupShape> = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
136
136
  /** Return Group with ItemsList. Manually annotate group with Select.GroupType<typeof rootItems>, using the exact items variable passed to Root. */
137
137
  children: ReactNode | ((group: Group, index: number) => ReactNode);
138
138
  } & StyleProps;
139
139
  /** Let this list render the groups. Manually annotate its children callback with Select.GroupType<typeof rootItems>, using the SAME items variable passed to Root. */
140
- export declare function GroupsList<Group extends GroupShape = GroupShape>({ disableStyle, children, className, style, ...props }: GroupsListProps<Group> & StyleProps): import("react").JSX.Element;
140
+ export declare function GroupsList<Group extends GroupShape = GroupShape>({ disableStyle, children, className, ...props }: GroupsListProps<Group>): import("react").JSX.Element;
141
141
  export type ItemsListProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<'div'>, 'children' | 'className'> & {
142
142
  className?: string;
143
143
  /** Return Item with ItemText and ItemIndicator. Manually annotate item with Select.ItemType<typeof rootItems>, using the exact items variable passed to Root. */
144
144
  children: (item: Item, index: number) => ReactNode;
145
145
  } & StyleProps;
146
146
  /** Let this list render the surrounding group. Manually annotate its callback with Select.ItemType<typeof rootItems>, using the SAME items variable passed to Root. */
147
- export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item> & StyleProps): import("react").JSX.Element;
147
+ export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item>): import("react").JSX.Element;
148
148
  export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Group>, 'className'> & {
149
149
  className?: string;
150
150
  /** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
151
- /** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
152
151
  items: readonly Item[];
153
152
  } & StyleProps;
154
- export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, items, children, className, ...props }: GroupProps<Item> & StyleProps): import("react").JSX.Element;
153
+ export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, items, children, className, ...props }: GroupProps<Item>): import("react").JSX.Element;
155
154
  export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Item>, 'value' | 'className'> & {
156
155
  className?: string;
157
156
  /** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
158
157
  /** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
159
158
  value: Item;
160
159
  } & StyleProps;
161
- export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item> & StyleProps): import("react").JSX.Element;
160
+ export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item>): import("react").JSX.Element;
162
161
  export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseSelect.Popup>, 'className'> & {
163
162
  className?: string;
164
163
  } & Pick<BaseSelect.Portal.Props, 'container'> & Pick<BaseSelect.Positioner.Props, 'anchor' | 'positionMethod' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance' | 'alignItemWithTrigger'> & StyleProps;
165
164
  /** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
166
- export declare function Popup({ disableStyle, container, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, alignItemWithTrigger, className, style, ...props }: PopupProps & StyleProps): import("react").JSX.Element;
165
+ export declare function Popup({ disableStyle, container, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, alignItemWithTrigger, className, style, ...props }: PopupProps): import("react").JSX.Element;
167
166
  export declare const Arrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "children" | "dangerouslySetInnerHTML"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
168
- /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
169
- export declare const PopupOpenHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "children" | "className" | "render"> & {
170
- className?: string;
171
- /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
172
- children: ReactElement;
173
- }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
174
- export declare const OpenButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "className"> & {
167
+ /** Opens the select. Pass asChild to make your own button the trigger instead, like a "Sort" Button. */
168
+ export declare const OpenButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "className" | "render"> & {
175
169
  className?: string;
176
- } & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
170
+ } & AsChildProps & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
177
171
  /** Omit for an unlabeled/flat-looking group; keep the Group wrapper. Supply the heading only when grouping should be visible. */
178
172
  export declare const GroupLabel: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectGroupLabelProps, "className"> & {
179
173
  className?: string;
@@ -185,10 +179,13 @@ export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Om
185
179
  className?: string;
186
180
  } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
187
181
  export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
188
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
189
- export declare const Error: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
190
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
191
- export declare const Success: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
182
+ type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
183
+ children?: ValidationMessageChildren;
184
+ };
185
+ /** 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. */
186
+ export declare const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
187
+ /** 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. */
188
+ export declare const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
192
189
  /** Built-in icon; no children needed. Use it inside its matching control. */
193
190
  export declare const OpenButtonIcon: import("react").ForwardRefExoticComponent<Omit<SVGIconProps & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
194
191
  /** 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. */
@@ -202,4 +199,4 @@ export declare const ScrollUpArrow: import("react").ForwardRefExoticComponent<Om
202
199
  export declare const ScrollDownArrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectScrollDownArrowProps, "className"> & {
203
200
  className?: string;
204
201
  } & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
205
- //# sourceMappingURL=index.d.ts.map
202
+ export {};