@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
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
3
- import { Check, ChevronsUpDown, LoaderCircle, X } from 'lucide-react';
4
- import { cloneElement, createContext, forwardRef, useContext, useId, useState, } from 'react';
3
+ import { Check, ChevronsUpDown, LoaderCircle, X } from "../../utils/icons.js";
4
+ import { cloneElement, createContext, forwardRef, useContext, useEffect, useId, useState } from 'react';
5
5
  import { twMerge } from 'tailwind-merge';
6
- import { ToneProvider, useToneContext } from "../../utils/Tone.js";
6
+ import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
7
7
  /**
8
8
  * Searchable selection using Base UI's built-in filtering and keyboard handling.
9
9
  * Does not render an element. Keep all parts inside Root.
@@ -157,37 +157,44 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
157
157
  * <Combobox.AddonOpenButtonIcon />
158
158
  * </Combobox.AddonOpenButton>
159
159
  */
160
- export function Root({ children, id, tone = 'neutral', open, defaultOpen = false, onOpenChange, onItemHighlighted, ...props }) {
160
+ export function Root({ children, id, validation, defaultOpen = false, onOpenChange, ...props }) {
161
+ //1. Tracking the open state even when uncontrolled, so parts can carry data-open
162
+ const [openInternalState, setOpenInternalState] = useState(defaultOpen);
163
+ //2. Holding the ids of Description, Error and Success, so Input announces them to screen readers through aria-describedby
164
+ const [describedByIds, setDescribedByIds] = useState([]);
165
+ //3. Sharing everything with the parts
161
166
  const generatedId = useId();
162
167
  const inputId = id ?? generatedId;
163
- const [openInternalState, setOpenInternalState] = useState(defaultOpen);
164
- return (_jsx(BaseCombobox.Root, { ...props, id: inputId, open: open, defaultOpen: defaultOpen, onItemHighlighted: onItemHighlighted, isItemEqualToValue: (item, selected) => item.value === selected.value, onOpenChange: (nextOpen, details) => {
168
+ return (_jsx(BaseCombobox.Root, { ...props, id: inputId, defaultOpen: defaultOpen, isItemEqualToValue: (item, selected) => item.value === selected.value, onOpenChange: (nextOpen, details) => {
165
169
  onOpenChange?.(nextOpen, details);
166
170
  if (!details.isCanceled)
167
171
  setOpenInternalState(nextOpen);
168
172
  }, children: _jsx(ComboboxContext.Provider, { value: {
169
173
  inputId,
170
- open: open ?? openInternalState,
174
+ open: props.open ?? openInternalState,
171
175
  disabled: props.disabled ?? false,
172
176
  readOnly: props.readOnly ?? false,
173
177
  required: props.required ?? false,
174
- }, children: _jsx(ToneProvider, { value: tone, children: children }) }) }));
178
+ validation: readValidation(validation),
179
+ describedByIds,
180
+ setDescribedByIds,
181
+ }, children: children }) }));
175
182
  }
176
183
  /** Use for the standard stacked layout, or omit when supplying your own layout. */
177
- export const Container = forwardRef(function Container({ disableStyle, className, ...props }, ref) {
184
+ export const Container = /* @__PURE__ */ forwardRef(function Container({ disableStyle, className, ...props }, ref) {
178
185
  return (_jsx("div", { ...props, ref: ref, "data-component": "combobox-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
179
186
  });
180
187
  /** Labels the input automatically using Root's id. Supply the visible label as children; no htmlFor needed. */
181
- export const Label = forwardRef(function Label({ disableStyle, className, ...props }, ref) {
182
- const { inputId } = useComboboxContext();
188
+ export const Label = /* @__PURE__ */ forwardRef(function Label({ disableStyle, className, ...props }, ref) {
189
+ const context = useComboboxContext();
183
190
  const attributes = usePartAttributes();
184
- return (_jsx("label", { ...attributes, ...props, ref: ref, htmlFor: inputId, "data-component": "combobox-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
191
+ return (_jsx("label", { ...attributes, ...props, ref: ref, htmlFor: context.inputId, "data-component": "combobox-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
185
192
  });
186
193
  /** Search input with built-in filtering and selected-label display. Its id is managed by Root. Inside ChipsList, the preset automatically uses the compact chip-input sizing. */
187
- export const Input = forwardRef(function Input({ disableStyle, className, ...props }, ref) {
188
- const { inputId } = useComboboxContext();
194
+ export const Input = /* @__PURE__ */ forwardRef(function Input({ disableStyle, className, 'aria-describedby': describedBy, ...props }, ref) {
195
+ const context = useComboboxContext();
189
196
  const inChips = useContext(ChipsContext);
190
- return (_jsx(BaseCombobox.Input, { ...props, ref: ref, id: inputId, "data-component": "combobox-input", "data-style-disabled": disableStyle ? '' : undefined, "data-in-chips": inChips ? '' : undefined, className: className }));
197
+ return (_jsx(BaseCombobox.Input, { "aria-invalid": context.validation.state === 'error' || undefined, "aria-describedby": [describedBy, ...context.describedByIds].filter(Boolean).join(' ') || undefined, ...props, ref: ref, id: context.inputId, "data-component": "combobox-input", "data-style-disabled": disableStyle ? '' : undefined, "data-in-chips": inChips ? '' : undefined, className: className }));
191
198
  });
192
199
  function ChipsListInner({ disableStyle, children, className, ...props }, ref) {
193
200
  return (_jsx(BaseCombobox.Value, { children: (selected) => (_jsx(ChipsContext.Provider, { value: true, children: _jsx(BaseCombobox.Chips, { ...props, ref: ref, "data-slot": "chips-list", "data-component": "combobox-chipslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? children(selected) : children }) })) }));
@@ -218,28 +225,28 @@ function ChipsListInner({ disableStyle, children, className, ...props }, ref) {
218
225
  * </Combobox.ChipsList>
219
226
  * </Combobox.InputGroup>
220
227
  */
221
- export const ChipsList = forwardRef(ChipsListInner);
228
+ export const ChipsList = /* @__PURE__ */ forwardRef(ChipsListInner);
222
229
  /** Reads Base UI selection without rendering its own element. Use its children callback only when you need a custom selection display; Input already displays the selected label automatically. */
223
230
  export const Value = BaseCombobox.Value;
224
231
  /** Required listbox and scroll viewport inside Popup. Place GroupsList inside it. Owns keyboard/listbox semantics; do not nest another listbox primitive. */
225
- export const ScrollArea = forwardRef(function ScrollArea({ disableStyle, className, style, ...props }, ref) {
226
- return (_jsx(BaseCombobox.List, { ...props, ref: ref, style: style, "data-component": "combobox-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
232
+ export const ScrollArea = /* @__PURE__ */ forwardRef(function ScrollArea({ disableStyle, className, ...props }, ref) {
233
+ return (_jsx(BaseCombobox.List, { ...props, ref: ref, "data-component": "combobox-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
227
234
  });
228
235
  /** Required groups container inside ScrollArea. A children callback receives each automatically filtered group; do not filter or map the original groups again. Manually annotate group with Combobox.GroupType<typeof rootItems>, using the exact items variable passed to Root. */
229
- export function GroupsList({ disableStyle, children, className, style, ...props }) {
230
- return (_jsx("div", { ...props, style: style, "data-component": "combobox-groupslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
236
+ export function GroupsList({ disableStyle, children, className, ...props }) {
237
+ return (_jsx("div", { ...props, "data-component": "combobox-groupslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
231
238
  }
232
239
  /** Required items container inside Group. A children callback receives the filtered items belonging to that Group; do not repeat filtering yourself. Manually annotate item with Combobox.ItemType<typeof rootItems>, using the exact items variable passed to Root. */
233
- export function ItemsList({ disableStyle, children, className, style, ...props }) {
234
- return (_jsx("div", { ...props, style: style, "data-component": "combobox-itemslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
240
+ export function ItemsList({ disableStyle, children, className, ...props }) {
241
+ return (_jsx("div", { ...props, "data-component": "combobox-itemslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
235
242
  }
236
243
  /** Required wrapper around ItemsList, even for a visually flat list. Pass group.items. A GroupLabel is optional; omit it when the group has an empty label. */
237
- export function Group({ disableStyle, className, style, ...props }) {
238
- return (_jsx(BaseCombobox.Group, { ...props, style: style, "data-component": "combobox-group", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
244
+ export function Group({ disableStyle, className, ...props }) {
245
+ return (_jsx(BaseCombobox.Group, { ...props, "data-component": "combobox-group", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
239
246
  }
240
247
  /** Required selectable row inside ItemsList. Pass the complete item object as value, with ItemText and ItemIndicator inside. Selection, highlighting, and keyboard behavior are built in. */
241
- export function Item({ disableStyle, className, style, ...props }) {
242
- return (_jsx(BaseCombobox.Item, { ...props, style: style, "data-component": "combobox-item", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
248
+ export function Item({ disableStyle, className, ...props }) {
249
+ return (_jsx(BaseCombobox.Item, { ...props, "data-component": "combobox-item", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
243
250
  }
244
251
  /** Popup containing Empty, an optional Loading message, and ScrollArea, in that order. Already includes the portal and positioner: do not add either yourself. Defaults to bottom/start with a 5px gap. Core available-space and anchor-width inline styles stay active when preset styling is disabled. */
245
252
  export function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side = 'bottom', sideOffset = 5, align = 'start', alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }) {
@@ -252,23 +259,15 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
252
259
  : { ...baseStyle, ...style } }) }) }));
253
260
  }
254
261
  /** Optional decorative popup arrow. Place inside Popup; the SVG and direction handling are supplied. No children needed. */
255
- export const Arrow = forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
262
+ export const Arrow = /* @__PURE__ */ forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
256
263
  return (_jsxs(BaseCombobox.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "combobox-arrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [_jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", "data-component": "combobox-arrow-1" }), _jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", "data-component": "combobox-arrow-2" }), _jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", "data-component": "combobox-arrow-3" })] }));
257
264
  });
258
- /** Behavior only: turns its single child element into the popup trigger. Adds no preset styling and has no disableStyle prop. Use an accessible button child; pass className to the child for its appearance. */
259
- export const PopupOpenHandler = forwardRef(function PopupOpenHandler({ children, ...props }, ref) {
260
- return _jsx(BaseCombobox.Trigger, { ...props, ref: ref, render: children });
261
- });
262
- /** Behavior only: turns its single child element into a removal control for the surrounding Chip. Adds no preset styling and has no disableStyle prop. Use an accessible button child. */
263
- export const ChipRemoveHandler = forwardRef(function ChipRemoveHandler({ children, ...props }, ref) {
264
- return _jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, render: children });
265
- });
266
265
  /** Optional input adornment container inside InputGroup. Wraps icons, text, or buttons without adding trigger behavior. */
267
- export const Addon = forwardRef(function Addon({ disableStyle, variant = 'normal', className, ...props }, ref) {
266
+ export const Addon = /* @__PURE__ */ forwardRef(function Addon({ disableStyle, variant = 'normal', className, ...props }, ref) {
268
267
  return (_jsx("div", { ...props, ref: ref, "data-variant": variant, "data-component": "combobox-addon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
269
268
  });
270
269
  /** Clones one supplied icon element, forwarding its ref and preserving its classes. Decorative only; does not open the popup or perform an action. */
271
- export const AddonIcon = forwardRef(function AddonIcon({ disableStyle, children, className, strokeWidth = 1.5, ...props }, ref) {
270
+ export const AddonIcon = /* @__PURE__ */ forwardRef(function AddonIcon({ disableStyle, children, className, strokeWidth = 1.5, ...props }, ref) {
272
271
  const attributes = usePartAttributes();
273
272
  return cloneElement(children, {
274
273
  ...attributes,
@@ -282,96 +281,110 @@ export const AddonIcon = forwardRef(function AddonIcon({ disableStyle, children,
282
281
  });
283
282
  });
284
283
  /** Optional general-purpose button inside Addon. Supply its action yourself. Automatically disabled when Root is disabled or readOnly; defaults to type="button". */
285
- export const AddonButton = forwardRef(function AddonButton({ disableStyle, className, disabled, type = 'button', ...props }, ref) {
284
+ export const AddonButton = /* @__PURE__ */ forwardRef(function AddonButton({ disableStyle, className, disabled, type = 'button', ...props }, ref) {
286
285
  const context = useComboboxContext();
287
286
  const attributes = usePartAttributes();
288
287
  return (_jsx("button", { ...attributes, ...props, ref: ref, type: type, disabled: disabled || context.disabled || context.readOnly, "data-component": "combobox-addonbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
289
288
  });
290
- /** Input control wrapper. Place Input (or ChipsList containing Input) and optional Addon controls inside. Root tone controls its preset validation border. */
291
- export const InputGroup = forwardRef(function InputGroup({ disableStyle, className, ...props }, ref) {
292
- const tone = useToneContext();
293
- return (_jsx(BaseCombobox.InputGroup, { "data-tone": tone, ...props, ref: ref, "data-component": "combobox-inputgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
289
+ /** Input control wrapper. Place Input (or ChipsList containing Input) and optional Addon controls inside. Root validation controls its preset validation border. */
290
+ export const InputGroup = /* @__PURE__ */ forwardRef(function InputGroup({ disableStyle, className, ...props }, ref) {
291
+ const attributes = usePartAttributes();
292
+ return (_jsx(BaseCombobox.InputGroup, { "data-validation": attributes['data-validation'], ...props, ref: ref, "data-component": "combobox-inputgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
294
293
  });
295
294
  /** Displays one selected item inside ChipsList. Keep chips in selected-item order so Base UI can remove the matching item. Supply the item label and an optional removal control. */
296
- export const Chip = forwardRef(function Chip({ disableStyle, className, ...props }, ref) {
295
+ export const Chip = /* @__PURE__ */ forwardRef(function Chip({ disableStyle, className, ...props }, ref) {
297
296
  return (_jsx(BaseCombobox.Chip, { ...props, ref: ref, "data-component": "combobox-chip", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
298
297
  });
299
298
  /** Removes the surrounding Chip from selection automatically; no onClick handler needed. Supply its content, normally ChipRemoveButtonIcon, and an accessible label. */
300
- export const ChipRemoveButton = forwardRef(function ChipRemoveButton({ disableStyle, className, ...props }, ref) {
299
+ export const ChipRemoveButton = /* @__PURE__ */ forwardRef(function ChipRemoveButton({ disableStyle, className, ...props }, ref) {
301
300
  return (_jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, "data-component": "combobox-chipremovebutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
302
301
  });
303
302
  /** Opens and closes the popup automatically; no click handler needed. Supply its content, normally AddonOpenButtonIcon, and an accessible label. */
304
- export const AddonOpenButton = forwardRef(function AddonOpenButton({ disableStyle, className, ...props }, ref) {
303
+ export const AddonOpenButton = /* @__PURE__ */ forwardRef(function AddonOpenButton({ disableStyle, className, ...props }, ref) {
305
304
  return (_jsx(BaseCombobox.Trigger, { ...props, ref: ref, "data-component": "combobox-addonopenbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
306
305
  });
307
306
  /** Clears the selection automatically; no click handler needed. Supply its content, normally AddonClearButtonIcon, and an accessible label. */
308
- export const AddonClearButton = forwardRef(function AddonClearButton({ disableStyle, className, ...props }, ref) {
307
+ export const AddonClearButton = /* @__PURE__ */ forwardRef(function AddonClearButton({ disableStyle, className, ...props }, ref) {
309
308
  return (_jsx(BaseCombobox.Clear, { ...props, ref: ref, "data-component": "combobox-addonclearbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
310
309
  });
311
310
  /** Optional heading inside Group. Supply group.label as children. Omit this part for an empty label; always keep Group and ItemsList. */
312
- export const GroupLabel = forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
311
+ export const GroupLabel = /* @__PURE__ */ forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
313
312
  return (_jsx(BaseCombobox.GroupLabel, { ...props, ref: ref, "data-component": "combobox-grouplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
314
313
  });
315
314
  /** Required empty-results message inside Popup, before optional Loading and ScrollArea. Keep mounted statically: Base UI renders its children only when no items match. Do not manually toggle, hide, or conditionally mount it. */
316
- export const Empty = forwardRef(function Empty({ disableStyle, className, ...props }, ref) {
315
+ export const Empty = /* @__PURE__ */ forwardRef(function Empty({ disableStyle, className, ...props }, ref) {
317
316
  return (_jsx(BaseCombobox.Empty, { ...props, ref: ref, "data-component": "combobox-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
318
317
  });
319
318
  /** Optional visual separator inside the popup. Does not replace Group or any required list containers. */
320
- export const Separator = forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
319
+ export const Separator = /* @__PURE__ */ forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
321
320
  return (_jsx(BaseCombobox.Separator, { ...props, ref: ref, "data-component": "combobox-separator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
322
321
  });
323
322
  /** Required label content inside Item. Supply item.label as children; does not derive text from the item automatically. */
324
- export const ItemText = forwardRef(function ItemText({ disableStyle, className, ...props }, ref) {
323
+ export const ItemText = /* @__PURE__ */ forwardRef(function ItemText({ disableStyle, className, ...props }, ref) {
325
324
  const attributes = usePartAttributes();
326
325
  return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "combobox-itemtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
327
326
  });
328
327
  /** Optional decorative text inside Addon. Supply the text as children. */
329
- export const AddonText = forwardRef(function AddonText({ disableStyle, className, ...props }, ref) {
328
+ export const AddonText = /* @__PURE__ */ forwardRef(function AddonText({ disableStyle, className, ...props }, ref) {
330
329
  const attributes = usePartAttributes();
331
330
  return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "combobox-addontext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
332
331
  });
333
332
  /** Text content inside Empty. Supply your empty-result message; Empty handles its visibility automatically. */
334
- export const EmptyText = forwardRef(function EmptyText({ disableStyle, className, ...props }, ref) {
333
+ export const EmptyText = /* @__PURE__ */ forwardRef(function EmptyText({ disableStyle, className, ...props }, ref) {
335
334
  const attributes = usePartAttributes();
336
335
  return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "combobox-emptytext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
337
336
  });
338
- /** Optional supporting text. Supply its content; it does not connect itself to the input with aria-describedby. Use matching id and Input aria-describedby when needed. */
339
- export const Description = forwardRef(function Description({ disableStyle, className, ...props }, ref) {
337
+ /** Optional supporting text. Supply its content; it describes the input to screen readers automatically. */
338
+ export const Description = /* @__PURE__ */ forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
339
+ const describedById = useDescribedById(id);
340
340
  const attributes = usePartAttributes();
341
- return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "combobox-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
341
+ return (_jsx("div", { ...attributes, ...props, id: describedById, ref: ref, "data-component": "combobox-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
342
342
  });
343
- /** Optional alert message. You control when it is rendered and its contents; tone does not validate or show this message automatically. */
344
- export const Error = forwardRef(function Error({ disableStyle, className, ...props }, ref) {
345
- const attributes = usePartAttributes();
346
- return (_jsx("div", { role: "alert", "aria-atomic": "true", ...attributes, ...props, ref: ref, "data-component": "combobox-error", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
343
+ /** 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. */
344
+ export const Error = /* @__PURE__ */ forwardRef(function Error({ children, ...props }, ref) {
345
+ const context = useComboboxContext();
346
+ const content = validationMessageContent(context.validation, 'error', children);
347
+ if (content === undefined)
348
+ return null;
349
+ return _jsx(Message, { ...props, ref: ref, role: "alert", component: "combobox-error", children: content });
347
350
  });
348
- /** Optional success status. You control when it is rendered and its contents; tone does not show this message automatically. */
349
- export const Success = forwardRef(function Success({ disableStyle, className, ...props }, ref) {
351
+ /** 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. */
352
+ export const Success = /* @__PURE__ */ forwardRef(function Success({ children, ...props }, ref) {
353
+ const context = useComboboxContext();
354
+ const content = validationMessageContent(context.validation, 'success', children);
355
+ if (content === undefined)
356
+ return null;
357
+ return _jsx(Message, { ...props, ref: ref, role: "status", component: "combobox-success", children: content });
358
+ });
359
+ // The shared body of Error and Success, mounted only while they show, so only visible messages describe the input
360
+ const Message = /* @__PURE__ */ forwardRef(function Message({ disableStyle, className, id, component, ...props }, ref) {
361
+ const describedById = useDescribedById(id);
350
362
  const attributes = usePartAttributes();
351
- return (_jsx("div", { role: "status", "aria-atomic": "true", ...attributes, ...props, ref: ref, "data-component": "combobox-success", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
363
+ return _jsx("div", { "aria-atomic": "true", ...attributes, ...props, id: describedById, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
352
364
  });
353
365
  /** Built-in decorative open-button icon. Place inside AddonOpenButton; no children needed. Defaults to strokeWidth 1.5. */
354
- export const AddonOpenButtonIcon = forwardRef(function AddonOpenButtonIcon({ disableStyle, className, strokeWidth = 1.5, ...props }, ref) {
355
- const attributes = usePartAttributes();
356
- return (_jsx(ChevronsUpDown, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-addonopenbuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
366
+ export const AddonOpenButtonIcon = /* @__PURE__ */ forwardRef(function AddonOpenButtonIcon(props, ref) {
367
+ return _jsx(BuiltInIcon, { ...props, ref: ref, icon: ChevronsUpDown, component: "combobox-addonopenbuttonicon" });
357
368
  });
358
369
  /** Built-in decorative clear icon. Place inside AddonClearButton; no children needed. Defaults to strokeWidth 1.5. */
359
- export const AddonClearButtonIcon = forwardRef(function AddonClearButtonIcon({ disableStyle, className, strokeWidth = 1.5, ...props }, ref) {
360
- const attributes = usePartAttributes();
361
- return (_jsx(X, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-addonclearbuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
370
+ export const AddonClearButtonIcon = /* @__PURE__ */ forwardRef(function AddonClearButtonIcon(props, ref) {
371
+ return _jsx(BuiltInIcon, { ...props, ref: ref, icon: X, component: "combobox-addonclearbuttonicon" });
362
372
  });
363
373
  /** Built-in decorative removal icon. Place inside ChipRemoveButton; no children needed. Defaults to strokeWidth 1.5. */
364
- export const ChipRemoveButtonIcon = forwardRef(function ChipRemoveButtonIcon({ disableStyle, className, strokeWidth = 1.5, ...props }, ref) {
365
- const attributes = usePartAttributes();
366
- return (_jsx(X, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-chipremovebuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
374
+ export const ChipRemoveButtonIcon = /* @__PURE__ */ forwardRef(function ChipRemoveButtonIcon(props, ref) {
375
+ return _jsx(BuiltInIcon, { ...props, ref: ref, icon: X, component: "combobox-chipremovebuttonicon" });
367
376
  });
368
377
  /** Optional spinner inside Addon. Does not detect requests: you decide when to render it. Defaults to strokeWidth 1.5. */
369
- export const AddonLoadingIcon = forwardRef(function AddonLoadingIcon({ disableStyle, className, strokeWidth = 1.5, ...props }, ref) {
378
+ export const AddonLoadingIcon = /* @__PURE__ */ forwardRef(function AddonLoadingIcon(props, ref) {
379
+ return _jsx(BuiltInIcon, { ...props, ref: ref, icon: LoaderCircle, component: "combobox-addonloadingicon" });
380
+ });
381
+ // The shared body of the built-in decorative icons above, which only differ by their icon and component name
382
+ const BuiltInIcon = /* @__PURE__ */ forwardRef(function BuiltInIcon({ disableStyle, className, strokeWidth = 1.5, icon: Icon, component, ...props }, ref) {
370
383
  const attributes = usePartAttributes();
371
- return (_jsx(LoaderCircle, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-addonloadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
384
+ return _jsx(Icon, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
372
385
  });
373
386
  /** Required selection indicator inside Item. Visibility is automatic and a checkmark is supplied: no children or selection condition needed. Pass children only to replace the built-in checkmark. */
374
- export const ItemIndicator = forwardRef(function ItemIndicator({ disableStyle, children, keepMounted, ...props }, ref) {
387
+ export const ItemIndicator = /* @__PURE__ */ forwardRef(function ItemIndicator({ disableStyle, children, keepMounted, ...props }, ref) {
375
388
  const iconProps = {
376
389
  'aria-hidden': true,
377
390
  strokeWidth: 2,
@@ -383,34 +396,45 @@ export const ItemIndicator = forwardRef(function ItemIndicator({ disableStyle, c
383
396
  return (_jsx(BaseCombobox.ItemIndicator, { keepMounted: keepMounted, children: null, render: cloneElement(children ?? _jsx(Check, {}), iconProps) }));
384
397
  });
385
398
  /** Optional async status inside Popup, below Empty and above ScrollArea. Omit entirely for synchronous items. For async items, keep Loading mounted and conditionally render only LoadingIcon and LoadingText from your request state. Does not detect requests or manage visibility. */
386
- export const Loading = forwardRef(function Loading({ disableStyle, className, ...props }, ref) {
399
+ export const Loading = /* @__PURE__ */ forwardRef(function Loading({ disableStyle, className, ...props }, ref) {
387
400
  return (_jsx(BaseCombobox.Status, { ...props, ref: ref, "data-component": "combobox-loading", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
388
401
  });
389
402
  /** Text inside Loading. Supply the message only while your request is loading; this part does not detect request state. */
390
- export const LoadingText = forwardRef(function LoadingText({ disableStyle, className, ...props }, ref) {
403
+ export const LoadingText = /* @__PURE__ */ forwardRef(function LoadingText({ disableStyle, className, ...props }, ref) {
391
404
  return (_jsx("div", { ...props, ref: ref, "data-component": "combobox-loadingtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
392
405
  });
393
406
  /** Built-in decorative spinner for Loading. No children needed; you control when it is rendered. */
394
- export const LoadingIcon = forwardRef(function LoadingIcon({ disableStyle, className, ...props }, ref) {
395
- return (_jsx(LoaderCircle, { "aria-hidden": true, strokeWidth: undefined, ...props, ref: ref, "data-component": "combobox-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
407
+ export const LoadingIcon = /* @__PURE__ */ forwardRef(function LoadingIcon({ disableStyle, className, strokeWidth = 2, ...props }, ref) {
408
+ return (_jsx(LoaderCircle, { "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
396
409
  });
397
- const ComboboxContext = createContext(null);
398
- const ChipsContext = createContext(false);
410
+ const ComboboxContext = /* @__PURE__ */ createContext(null);
411
+ // Telling Input it sits inside ChipsList, so the preset uses the compact chip-input sizing
412
+ const ChipsContext = /* @__PURE__ */ createContext(false);
399
413
  function useComboboxContext() {
400
414
  const context = useContext(ComboboxContext);
401
415
  if (!context)
402
416
  throw new globalThis.Error('Combobox parts must be inside Combobox.Root');
403
417
  return context;
404
418
  }
419
+ // The state attributes every part carries, so presets can style any part from Root's state
405
420
  function usePartAttributes() {
406
- const { open, disabled, readOnly, required } = useComboboxContext();
407
- const tone = useToneContext();
421
+ const context = useComboboxContext();
408
422
  return {
409
- 'data-open': open ? '' : undefined,
410
- 'data-disabled': disabled ? '' : undefined,
411
- 'data-readonly': readOnly ? '' : undefined,
412
- 'data-required': required ? '' : undefined,
413
- 'data-tone': tone,
423
+ 'data-open': context.open ? '' : undefined,
424
+ 'data-disabled': context.disabled ? '' : undefined,
425
+ 'data-readonly': context.readOnly ? '' : undefined,
426
+ 'data-required': context.required ? '' : undefined,
427
+ ...validationAttributes(context.validation),
414
428
  };
415
429
  }
416
- //# sourceMappingURL=index.js.map
430
+ // Registering a part's id in Input's aria-describedby while the part is mounted
431
+ function useDescribedById(id) {
432
+ const context = useComboboxContext();
433
+ const generatedId = useId();
434
+ const describedById = id ?? generatedId;
435
+ useEffect(() => {
436
+ context.setDescribedByIds((current) => [...current, describedById]);
437
+ return () => context.setDescribedByIds((current) => current.filter((currentId) => currentId !== describedById));
438
+ }, [describedById, context.setDescribedByIds]);
439
+ return describedById;
440
+ }
@@ -1,9 +1,24 @@
1
1
  import type { StyleProps } from '../../types/Style.ts';
2
- import { Label as AriaLabel, Group as AriaGroup, DateInput as AriaDateInput, Heading, CalendarGrid, Text, FieldError } from 'react-aria-components';
3
- import type { DatePickerProps, DateRangePickerProps, CalendarProps, DateSegmentProps, ButtonProps, PopoverProps, ListBoxProps, ListBoxItemProps } from 'react-aria-components';
2
+ import type { AsChildProps } from '../../utils/asChild.ts';
3
+ import type { DatePickerProps } from 'react-aria-components/DatePicker';
4
+ import type { DateRangePickerProps } from 'react-aria-components/DateRangePicker';
5
+ import { Label as AriaLabel } from 'react-aria-components/Label';
6
+ import { Group as AriaGroup } from 'react-aria-components/Group';
7
+ import { DateInput as AriaDateInput } from 'react-aria-components/DateField';
8
+ import type { DateSegmentProps } from 'react-aria-components/DateField';
9
+ import type { ButtonProps } from 'react-aria-components/Button';
10
+ import type { PopoverProps } from 'react-aria-components/Popover';
11
+ import { CalendarGrid } from 'react-aria-components/Calendar';
12
+ import type { CalendarProps } from 'react-aria-components/Calendar';
13
+ import { Heading } from 'react-aria-components/Heading';
14
+ import type { ListBoxProps, ListBoxItemProps } from 'react-aria-components/ListBox';
15
+ import { Text } from 'react-aria-components/Text';
16
+ import { FieldError } from 'react-aria-components/FieldError';
4
17
  import type { CalendarDate } from '@internationalized/date';
5
18
  import type { ComponentProps, ReactElement, ReactNode } from 'react';
6
- import type { LucideProps } from 'lucide-react';
19
+ import type { SVGIconProps } from '../../types/Icon.ts';
20
+ import type { Validation } from '../../types/Validation.ts';
21
+ import type { ValidationMessageChildren } from '../../utils/Validation.ts';
7
22
  type DateRange = {
8
23
  start: string;
9
24
  end: string;
@@ -23,8 +38,6 @@ type SharedRootProps = {
23
38
  readOnly?: DatePickerProps<CalendarDate>['isReadOnly'];
24
39
  /** Require a date when validating a surrounding form. */
25
40
  required?: DatePickerProps<CalendarDate>['isRequired'];
26
- /** Mark the picker invalid for accessibility and validation; use tone for a separate visual tone. */
27
- invalid?: DatePickerProps<CalendarDate>['isInvalid'];
28
41
  /** Control the popup from application state. Omit to let trigger interactions manage it. */
29
42
  open?: DatePickerProps<CalendarDate>['isOpen'];
30
43
  /** Prevent selection before this ISO calendar date (YYYY-MM-DD). Omit for no lower limit. */
@@ -35,8 +48,11 @@ type SharedRootProps = {
35
48
  placeholderValue?: string | null;
36
49
  /** Choose date formatting and language. Omit to use the inherited application locale. */
37
50
  locale?: string;
38
- /** Choose the visual tone. This does not validate data or show/hide feedback messages. */
39
- tone?: 'neutral' | 'valid' | 'invalid';
51
+ /**
52
+ * The picker's validation state, with an optional message: `'error'` marks it invalid, `['error', 'Pick a later date']` also shows that message in Error. Same for `'success'` and Success.
53
+ * Omit it to keep only the picker's own validation, like a required or out-of-range date.
54
+ */
55
+ validation?: Validation;
40
56
  };
41
57
  type SingleRootProps = Pick<DatePickerProps<CalendarDate>, CoreKeys | 'name' | 'autoComplete'> & SharedRootProps & {
42
58
  /** Use range for a start/end selection; single is the default. Choose the corresponding field composition. */
@@ -155,15 +171,15 @@ export declare function Addon({ disableStyle, className, variant, ...props }: (C
155
171
  }) & StyleProps): import("react").JSX.Element;
156
172
  export declare function AddonText({ disableStyle, className, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
157
173
  /** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
158
- export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
174
+ export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
159
175
  /** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
160
- children: ReactElement<LucideProps>;
161
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
176
+ children: ReactElement<SVGIconProps>;
177
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
162
178
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
163
- export declare function AddonLoadingIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
179
+ export declare function AddonLoadingIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
164
180
  /** Omit for the supplied default icon; pass a child only to replace it. */
165
- children?: ReactElement<LucideProps>;
166
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
181
+ children?: ReactElement<SVGIconProps>;
182
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
167
183
  export declare function AddonButton({ disableStyle, className, disabled, type, ...props }: ComponentProps<'button'> & StyleProps): import("react").JSX.Element;
168
184
  export declare function InputsList({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
169
185
  export declare function InputsListSeparator({ disableStyle, children, className, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
@@ -184,37 +200,28 @@ type StyledButtonProps = Omit<ButtonProps, 'className' | 'style' | 'slot' | 'ren
184
200
  };
185
201
  export declare function AddonOpenButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
186
202
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
187
- export declare function AddonOpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
203
+ export declare function AddonOpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
188
204
  /** Omit for the supplied default icon; pass a child only to replace it. */
189
- children?: ReactElement<LucideProps>;
190
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
191
- /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
192
- export declare function AddonOpenHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
193
- /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
194
- children: ReactElement<ComponentProps<'button'>>;
195
- }): import("react").JSX.Element;
196
- export declare function OpenButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
197
- /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
198
- export declare function OpenHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
199
- /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
200
- children: ReactElement<ComponentProps<'button'>>;
201
- }): import("react").JSX.Element;
205
+ children?: ReactElement<SVGIconProps>;
206
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
207
+ /** Opens the calendar popup. Pass asChild to give this behavior to your own button, like a "Choose appointment" Button; it keeps the state data attributes but none of this part's styling. */
208
+ export declare function OpenButton({ asChild, disableStyle, isDisabled, children, ...props }: StyledButtonProps & AsChildProps & StyleProps): import("react").JSX.Element;
202
209
  /** Formats the selected date or range automatically. Omit children for the usual display; supply children only to replace it. Placeholder appears before selection. */
203
210
  export declare function OpenButtonValue({ disableStyle, children, placeholder, className, ...props }: (ComponentProps<'span'> & {
204
211
  /** Shown before a date is selected. Omit children to keep the automatic formatted date display. */
205
212
  placeholder?: string;
206
213
  }) & StyleProps): import("react").JSX.Element;
207
214
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
208
- export declare function OpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
215
+ export declare function OpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
209
216
  /** Omit for the supplied default icon; pass a child only to replace it. */
210
- children?: ReactElement<LucideProps>;
211
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
217
+ children?: ReactElement<SVGIconProps>;
218
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
212
219
  export type PopupProps = Omit<PopoverProps, 'className' | 'style' | 'render' | 'slot' | 'trigger' | 'isOpen' | 'defaultOpen' | 'onOpenChange'> & {
213
220
  className?: string;
214
221
  style?: ComponentProps<'div'>['style'];
215
222
  } & StyleProps;
216
223
  /** Use the same calendar composition for both trigger choices. Opening and focus management are handled by the picker; do not add your own popup visibility condition. */
217
- export declare const Popup: import("react").ForwardRefExoticComponent<Omit<PopoverProps, "slot" | "style" | "className" | "render" | "onOpenChange" | "defaultOpen" | "isOpen" | "trigger"> & {
224
+ export declare const Popup: import("react").ForwardRefExoticComponent<Omit<PopoverProps, "className" | "slot" | "style" | "render" | "onOpenChange" | "defaultOpen" | "isOpen" | "trigger"> & {
218
225
  className?: string;
219
226
  style?: ComponentProps<"div">["style"];
220
227
  } & StyleProps & import("react").RefAttributes<HTMLElement>>;
@@ -246,36 +253,26 @@ export declare function Item({ disableStyle, value, className, textValue, ...pro
246
253
  className?: string;
247
254
  style?: ComponentProps<'div'>['style'];
248
255
  }) & StyleProps): import("react").JSX.Element;
249
- export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Omit<import("react-aria-components").TextProps & import("react").RefAttributes<HTMLElement>, "slot" | "render"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
256
+ export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Omit<import("react-aria-components/DatePicker").TextProps & import("react").RefAttributes<HTMLElement>, "slot" | "render"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
250
257
  /** 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. */
251
- export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<LucideProps, "children"> & {
258
+ export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<SVGIconProps, "children"> & {
252
259
  /** Optional replacement SVG icon. It receives this indicator's props and ref. */
253
- children?: ReactElement<LucideProps>;
260
+ children?: ReactElement<SVGIconProps>;
254
261
  } & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
255
262
  export declare function Actions({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
256
263
  export declare function ViewDateValue({ disableStyle, className, level, ...props }: (Omit<ComponentProps<'h2'>, 'children'> & Pick<ComponentProps<typeof Heading>, 'level'>) & StyleProps): import("react").JSX.Element;
257
264
  export declare function PreviousButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
258
265
  export declare function NextButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
259
- /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
260
- export declare function PreviousHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
261
- /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
262
- children: ReactElement<ComponentProps<'button'>>;
263
- }): import("react").JSX.Element;
264
- /** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
265
- export declare function NextHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
266
- /** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
267
- children: ReactElement<ComponentProps<'button'>>;
268
- }): import("react").JSX.Element;
269
266
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
270
- export declare function PreviousButtonIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
267
+ export declare function PreviousButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
271
268
  /** Omit for the supplied default icon; pass a child only to replace it. */
272
- children?: ReactElement<LucideProps>;
273
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
269
+ children?: ReactElement<SVGIconProps>;
270
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
274
271
  /** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
275
- export declare function NextButtonIcon({ disableStyle, children, className, ...props }: (Omit<LucideProps, 'children'> & {
272
+ export declare function NextButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
276
273
  /** Omit for the supplied default icon; pass a child only to replace it. */
277
- children?: ReactElement<LucideProps>;
278
- }) & StyleProps): ReactElement<LucideProps, string | import("react").JSXElementConstructor<any>>;
274
+ children?: ReactElement<SVGIconProps>;
275
+ }) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
279
276
  /** Calls children for each visible month. Pass its index to Table rather than manually calculating month offsets. */
280
277
  export declare function TablesList({ disableStyle, className, children, ...props }: (Omit<ComponentProps<'div'>, 'children'> & {
281
278
  /** Return Table with the supplied index; do not manually calculate month offsets. */
@@ -287,11 +284,13 @@ export declare function Table({ disableStyle, index, className, ...props }: (Omi
287
284
  index?: number;
288
285
  }) & StyleProps): import("react").JSX.Element;
289
286
  export declare function Description({ disableStyle, className, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render'> & StyleProps): import("react").JSX.Element;
290
- /** Keep mounted to let the picker render its validation error automatically. Omit children for the native error text; override only for a custom message. */
291
- export declare function Error({ disableStyle, className, ...props }: (Omit<ComponentProps<typeof FieldError>, 'className' | 'render'> & {
287
+ /** Keep mounted: it shows while the picker is invalid. With no children it shows Root's message from `['error', message]`, or else the picker's own validation text, like a required or out-of-range date. A function children formats Root's message, and other children replace it. */
288
+ export declare function Error({ disableStyle, className, children, ...props }: (Omit<ComponentProps<typeof FieldError>, 'className' | 'render' | 'children'> & {
292
289
  className?: string;
290
+ children?: ValidationMessageChildren;
293
291
  }) & StyleProps): import("react").JSX.Element;
294
- /** You decide when to show this feedback. Changing tone does not validate data or render the message for you. */
295
- export declare function Success({ disableStyle, className, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render'> & StyleProps): import("react").JSX.Element;
292
+ /** 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. */
293
+ export declare function Success({ disableStyle, className, children, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render' | 'children'> & {
294
+ children?: ValidationMessageChildren;
295
+ } & StyleProps): import("react").JSX.Element | null;
296
296
  export {};
297
- //# sourceMappingURL=index.d.ts.map