@proyecto-viviana/solidaria-components 0.3.2 → 0.4.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 (398) hide show
  1. package/dist/ActionBar.js +184 -0
  2. package/dist/ActionBar.js.map +1 -0
  3. package/dist/ActionBar.jsx +128 -0
  4. package/dist/ActionBar.jsx.map +1 -0
  5. package/dist/ActionGroup.js +179 -0
  6. package/dist/ActionGroup.js.map +1 -0
  7. package/dist/ActionGroup.jsx +129 -0
  8. package/dist/ActionGroup.jsx.map +1 -0
  9. package/dist/Alert.js +111 -0
  10. package/dist/Alert.js.map +1 -0
  11. package/dist/Alert.jsx +82 -0
  12. package/dist/Alert.jsx.map +1 -0
  13. package/dist/Autocomplete.js +130 -0
  14. package/dist/Autocomplete.js.map +1 -0
  15. package/dist/Autocomplete.jsx +116 -0
  16. package/dist/Autocomplete.jsx.map +1 -0
  17. package/dist/Breadcrumbs.d.ts.map +1 -1
  18. package/dist/Breadcrumbs.js +334 -0
  19. package/dist/Breadcrumbs.js.map +1 -0
  20. package/dist/Breadcrumbs.jsx +266 -0
  21. package/dist/Breadcrumbs.jsx.map +1 -0
  22. package/dist/Button.d.ts.map +1 -1
  23. package/dist/Button.js +348 -0
  24. package/dist/Button.js.map +1 -0
  25. package/dist/Button.jsx +314 -0
  26. package/dist/Button.jsx.map +1 -0
  27. package/dist/Calendar.d.ts +4 -4
  28. package/dist/Calendar.d.ts.map +1 -1
  29. package/dist/Calendar.js +538 -0
  30. package/dist/Calendar.js.map +1 -0
  31. package/dist/Calendar.jsx +333 -0
  32. package/dist/Calendar.jsx.map +1 -0
  33. package/dist/CalendarPicker.d.ts +33 -0
  34. package/dist/CalendarPicker.d.ts.map +1 -0
  35. package/dist/CalendarPicker.js +44 -0
  36. package/dist/CalendarPicker.js.map +1 -0
  37. package/dist/CalendarPicker.jsx +44 -0
  38. package/dist/CalendarPicker.jsx.map +1 -0
  39. package/dist/Checkbox.d.ts +83 -4
  40. package/dist/Checkbox.d.ts.map +1 -1
  41. package/dist/Checkbox.js +923 -0
  42. package/dist/Checkbox.js.map +1 -0
  43. package/dist/Checkbox.jsx +707 -0
  44. package/dist/Checkbox.jsx.map +1 -0
  45. package/dist/Collection.d.ts.map +1 -1
  46. package/dist/Collection.js +202 -0
  47. package/dist/Collection.js.map +1 -0
  48. package/dist/Collection.jsx +152 -0
  49. package/dist/Collection.jsx.map +1 -0
  50. package/dist/Color.d.ts.map +1 -1
  51. package/dist/Color.js +1720 -0
  52. package/dist/Color.js.map +1 -0
  53. package/dist/Color.jsx +1344 -0
  54. package/dist/Color.jsx.map +1 -0
  55. package/dist/ColorEditor.js +208 -0
  56. package/dist/ColorEditor.js.map +1 -0
  57. package/dist/ColorEditor.jsx +120 -0
  58. package/dist/ColorEditor.jsx.map +1 -0
  59. package/dist/ComboBox.d.ts +4 -4
  60. package/dist/ComboBox.d.ts.map +1 -1
  61. package/dist/ComboBox.js +992 -0
  62. package/dist/ComboBox.js.map +1 -0
  63. package/dist/ComboBox.jsx +714 -0
  64. package/dist/ComboBox.jsx.map +1 -0
  65. package/dist/ContextualHelpTrigger.js +146 -0
  66. package/dist/ContextualHelpTrigger.js.map +1 -0
  67. package/dist/ContextualHelpTrigger.jsx +109 -0
  68. package/dist/ContextualHelpTrigger.jsx.map +1 -0
  69. package/dist/DateField.d.ts +3 -3
  70. package/dist/DateField.d.ts.map +1 -1
  71. package/dist/DateField.js +4 -0
  72. package/dist/DateField.jsx +4 -0
  73. package/dist/DateField2.js +499 -0
  74. package/dist/DateField2.js.map +1 -0
  75. package/dist/DateField2.jsx +317 -0
  76. package/dist/DateField2.jsx.map +1 -0
  77. package/dist/DatePicker.d.ts +4 -4
  78. package/dist/DatePicker.d.ts.map +1 -1
  79. package/dist/DatePicker.js +991 -0
  80. package/dist/DatePicker.js.map +1 -0
  81. package/dist/DatePicker.jsx +682 -0
  82. package/dist/DatePicker.jsx.map +1 -0
  83. package/dist/Dialog.d.ts.map +1 -1
  84. package/dist/Dialog.js +337 -0
  85. package/dist/Dialog.js.map +1 -0
  86. package/dist/Dialog.jsx +192 -0
  87. package/dist/Dialog.jsx.map +1 -0
  88. package/dist/Disclosure.d.ts.map +1 -1
  89. package/dist/Disclosure.js +328 -0
  90. package/dist/Disclosure.js.map +1 -0
  91. package/dist/Disclosure.jsx +230 -0
  92. package/dist/Disclosure.jsx.map +1 -0
  93. package/dist/DragAndDrop.d.ts.map +1 -1
  94. package/dist/DragAndDrop.js +176 -0
  95. package/dist/DragAndDrop.js.map +1 -0
  96. package/dist/DragAndDrop.jsx +160 -0
  97. package/dist/DragAndDrop.jsx.map +1 -0
  98. package/dist/DropZone.d.ts.map +1 -1
  99. package/dist/DropZone.js +189 -0
  100. package/dist/DropZone.js.map +1 -0
  101. package/dist/DropZone.jsx +144 -0
  102. package/dist/DropZone.jsx.map +1 -0
  103. package/dist/FieldError.js +66 -0
  104. package/dist/FieldError.js.map +1 -0
  105. package/dist/FieldError.jsx +47 -0
  106. package/dist/FieldError.jsx.map +1 -0
  107. package/dist/FileTrigger.js +79 -0
  108. package/dist/FileTrigger.js.map +1 -0
  109. package/dist/FileTrigger.jsx +49 -0
  110. package/dist/FileTrigger.jsx.map +1 -0
  111. package/dist/Focusable.js +70 -0
  112. package/dist/Focusable.js.map +1 -0
  113. package/dist/Focusable.jsx +69 -0
  114. package/dist/Focusable.jsx.map +1 -0
  115. package/dist/Form.js +99 -0
  116. package/dist/Form.js.map +1 -0
  117. package/dist/Form.jsx +73 -0
  118. package/dist/Form.jsx.map +1 -0
  119. package/dist/GridList.d.ts +34 -2
  120. package/dist/GridList.d.ts.map +1 -1
  121. package/dist/GridList.js +723 -0
  122. package/dist/GridList.js.map +1 -0
  123. package/dist/GridList.jsx +552 -0
  124. package/dist/GridList.jsx.map +1 -0
  125. package/dist/HiddenTimeInput.js +104 -0
  126. package/dist/HiddenTimeInput.js.map +1 -0
  127. package/dist/HiddenTimeInput.jsx +69 -0
  128. package/dist/HiddenTimeInput.jsx.map +1 -0
  129. package/dist/Icon.d.ts.map +1 -1
  130. package/dist/Icon.js +127 -0
  131. package/dist/Icon.js.map +1 -0
  132. package/dist/Icon.jsx +72 -0
  133. package/dist/Icon.jsx.map +1 -0
  134. package/dist/Keyboard.js +30 -0
  135. package/dist/Keyboard.js.map +1 -0
  136. package/dist/Keyboard.jsx +24 -0
  137. package/dist/Keyboard.jsx.map +1 -0
  138. package/dist/Landmark.js +134 -0
  139. package/dist/Landmark.js.map +1 -0
  140. package/dist/Landmark.jsx +118 -0
  141. package/dist/Landmark.jsx.map +1 -0
  142. package/dist/Link.d.ts.map +1 -1
  143. package/dist/Link.js +219 -0
  144. package/dist/Link.js.map +1 -0
  145. package/dist/Link.jsx +189 -0
  146. package/dist/Link.jsx.map +1 -0
  147. package/dist/ListBox.d.ts.map +1 -1
  148. package/dist/ListBox.js +670 -0
  149. package/dist/ListBox.js.map +1 -0
  150. package/dist/ListBox.jsx +508 -0
  151. package/dist/ListBox.jsx.map +1 -0
  152. package/dist/Menu.d.ts +27 -9
  153. package/dist/Menu.d.ts.map +1 -1
  154. package/dist/Menu.js +1254 -0
  155. package/dist/Menu.js.map +1 -0
  156. package/dist/Menu.jsx +1042 -0
  157. package/dist/Menu.jsx.map +1 -0
  158. package/dist/Meter.d.ts.map +1 -1
  159. package/dist/Meter.js +123 -0
  160. package/dist/Meter.js.map +1 -0
  161. package/dist/Meter.jsx +107 -0
  162. package/dist/Meter.jsx.map +1 -0
  163. package/dist/Modal.d.ts.map +1 -1
  164. package/dist/Modal.js +380 -0
  165. package/dist/Modal.js.map +1 -0
  166. package/dist/Modal.jsx +314 -0
  167. package/dist/Modal.jsx.map +1 -0
  168. package/dist/NumberField.d.ts +3 -3
  169. package/dist/NumberField.d.ts.map +1 -1
  170. package/dist/NumberField.js +573 -0
  171. package/dist/NumberField.js.map +1 -0
  172. package/dist/NumberField.jsx +443 -0
  173. package/dist/NumberField.jsx.map +1 -0
  174. package/dist/Popover.d.ts +10 -2
  175. package/dist/Popover.d.ts.map +1 -1
  176. package/dist/Popover.js +464 -0
  177. package/dist/Popover.js.map +1 -0
  178. package/dist/Popover.jsx +333 -0
  179. package/dist/Popover.jsx.map +1 -0
  180. package/dist/Pressable.js +69 -0
  181. package/dist/Pressable.js.map +1 -0
  182. package/dist/Pressable.jsx +68 -0
  183. package/dist/Pressable.jsx.map +1 -0
  184. package/dist/ProgressBar.d.ts.map +1 -1
  185. package/dist/ProgressBar.js +130 -0
  186. package/dist/ProgressBar.js.map +1 -0
  187. package/dist/ProgressBar.jsx +114 -0
  188. package/dist/ProgressBar.jsx.map +1 -0
  189. package/dist/RadioGroup.d.ts +82 -4
  190. package/dist/RadioGroup.d.ts.map +1 -1
  191. package/dist/RadioGroup.js +931 -0
  192. package/dist/RadioGroup.js.map +1 -0
  193. package/dist/RadioGroup.jsx +681 -0
  194. package/dist/RadioGroup.jsx.map +1 -0
  195. package/dist/RangeCalendar.d.ts.map +1 -1
  196. package/dist/RangeCalendar.js +410 -0
  197. package/dist/RangeCalendar.js.map +1 -0
  198. package/dist/RangeCalendar.jsx +253 -0
  199. package/dist/RangeCalendar.jsx.map +1 -0
  200. package/dist/RouterProvider.js +118 -0
  201. package/dist/RouterProvider.js.map +1 -0
  202. package/dist/RouterProvider.jsx +112 -0
  203. package/dist/RouterProvider.jsx.map +1 -0
  204. package/dist/SearchField.d.ts +2 -2
  205. package/dist/SearchField.d.ts.map +1 -1
  206. package/dist/SearchField.js +643 -0
  207. package/dist/SearchField.js.map +1 -0
  208. package/dist/SearchField.jsx +526 -0
  209. package/dist/SearchField.jsx.map +1 -0
  210. package/dist/Select.d.ts.map +1 -1
  211. package/dist/Select.js +1031 -0
  212. package/dist/Select.js.map +1 -0
  213. package/dist/Select.jsx +744 -0
  214. package/dist/Select.jsx.map +1 -0
  215. package/dist/SelectionIndicator.d.ts.map +1 -1
  216. package/dist/SelectionIndicator.js +86 -0
  217. package/dist/SelectionIndicator.js.map +1 -0
  218. package/dist/SelectionIndicator.jsx +50 -0
  219. package/dist/SelectionIndicator.jsx.map +1 -0
  220. package/dist/Separator.js +97 -0
  221. package/dist/Separator.js.map +1 -0
  222. package/dist/Separator.jsx +85 -0
  223. package/dist/Separator.jsx.map +1 -0
  224. package/dist/SharedElementTransition.d.ts.map +1 -1
  225. package/dist/SharedElementTransition.js +165 -0
  226. package/dist/SharedElementTransition.js.map +1 -0
  227. package/dist/SharedElementTransition.jsx +138 -0
  228. package/dist/SharedElementTransition.jsx.map +1 -0
  229. package/dist/Slider.d.ts +33 -1
  230. package/dist/Slider.d.ts.map +1 -1
  231. package/dist/Slider.js +515 -0
  232. package/dist/Slider.js.map +1 -0
  233. package/dist/Slider.jsx +403 -0
  234. package/dist/Slider.jsx.map +1 -0
  235. package/dist/StepList.js +198 -0
  236. package/dist/StepList.js.map +1 -0
  237. package/dist/StepList.jsx +141 -0
  238. package/dist/StepList.jsx.map +1 -0
  239. package/dist/Switch.d.ts +65 -2
  240. package/dist/Switch.d.ts.map +1 -1
  241. package/dist/Switch.js +534 -0
  242. package/dist/Switch.js.map +1 -0
  243. package/dist/Switch.jsx +393 -0
  244. package/dist/Switch.jsx.map +1 -0
  245. package/dist/Table.d.ts +48 -0
  246. package/dist/Table.d.ts.map +1 -1
  247. package/dist/Table.js +1759 -0
  248. package/dist/Table.js.map +1 -0
  249. package/dist/Table.jsx +1348 -0
  250. package/dist/Table.jsx.map +1 -0
  251. package/dist/Tabs.d.ts +0 -4
  252. package/dist/Tabs.d.ts.map +1 -1
  253. package/dist/Tabs.js +595 -0
  254. package/dist/Tabs.js.map +1 -0
  255. package/dist/Tabs.jsx +367 -0
  256. package/dist/Tabs.jsx.map +1 -0
  257. package/dist/TagGroup.d.ts.map +1 -1
  258. package/dist/TagGroup.js +378 -0
  259. package/dist/TagGroup.js.map +1 -0
  260. package/dist/TagGroup.jsx +270 -0
  261. package/dist/TagGroup.jsx.map +1 -0
  262. package/dist/Text.d.ts +18 -6
  263. package/dist/Text.d.ts.map +1 -1
  264. package/dist/Text.js +42 -0
  265. package/dist/Text.js.map +1 -0
  266. package/dist/Text.jsx +35 -0
  267. package/dist/Text.jsx.map +1 -0
  268. package/dist/TextField.d.ts +6 -6
  269. package/dist/TextField.d.ts.map +1 -1
  270. package/dist/TextField.js +436 -0
  271. package/dist/TextField.js.map +1 -0
  272. package/dist/TextField.jsx +403 -0
  273. package/dist/TextField.jsx.map +1 -0
  274. package/dist/TimeField.d.ts +3 -3
  275. package/dist/TimeField.d.ts.map +1 -1
  276. package/dist/TimeField.js +372 -0
  277. package/dist/TimeField.js.map +1 -0
  278. package/dist/TimeField.jsx +224 -0
  279. package/dist/TimeField.jsx.map +1 -0
  280. package/dist/Toast.d.ts +14 -0
  281. package/dist/Toast.d.ts.map +1 -1
  282. package/dist/Toast.js +551 -0
  283. package/dist/Toast.js.map +1 -0
  284. package/dist/Toast.jsx +361 -0
  285. package/dist/Toast.jsx.map +1 -0
  286. package/dist/ToggleButton.d.ts.map +1 -1
  287. package/dist/ToggleButton.js +123 -0
  288. package/dist/ToggleButton.js.map +1 -0
  289. package/dist/ToggleButton.jsx +88 -0
  290. package/dist/ToggleButton.jsx.map +1 -0
  291. package/dist/ToggleButtonGroup.d.ts.map +1 -1
  292. package/dist/ToggleButtonGroup.js +114 -0
  293. package/dist/ToggleButtonGroup.js.map +1 -0
  294. package/dist/ToggleButtonGroup.jsx +85 -0
  295. package/dist/ToggleButtonGroup.jsx.map +1 -0
  296. package/dist/Toolbar.js +112 -0
  297. package/dist/Toolbar.js.map +1 -0
  298. package/dist/Toolbar.jsx +92 -0
  299. package/dist/Toolbar.jsx.map +1 -0
  300. package/dist/Tooltip.d.ts.map +1 -1
  301. package/dist/Tooltip.js +539 -0
  302. package/dist/Tooltip.js.map +1 -0
  303. package/dist/Tooltip.jsx +465 -0
  304. package/dist/Tooltip.jsx.map +1 -0
  305. package/dist/Tree.d.ts +14 -2
  306. package/dist/Tree.d.ts.map +1 -1
  307. package/dist/Tree.js +1424 -0
  308. package/dist/Tree.js.map +1 -0
  309. package/dist/Tree.jsx +1172 -0
  310. package/dist/Tree.jsx.map +1 -0
  311. package/dist/Virtualizer.d.ts +16 -2
  312. package/dist/Virtualizer.d.ts.map +1 -1
  313. package/dist/Virtualizer.js +2 -0
  314. package/dist/Virtualizer.jsx +2 -0
  315. package/dist/Virtualizer2.js +751 -0
  316. package/dist/Virtualizer2.js.map +1 -0
  317. package/dist/Virtualizer2.jsx +730 -0
  318. package/dist/Virtualizer2.jsx.map +1 -0
  319. package/dist/VirtualizerLayouts.d.ts +18 -0
  320. package/dist/VirtualizerLayouts.d.ts.map +1 -1
  321. package/dist/VisuallyHidden.js +42 -0
  322. package/dist/VisuallyHidden.js.map +1 -0
  323. package/dist/VisuallyHidden.jsx +35 -0
  324. package/dist/VisuallyHidden.jsx.map +1 -0
  325. package/dist/contexts.js +33 -0
  326. package/dist/contexts.js.map +1 -0
  327. package/dist/contexts.jsx +33 -0
  328. package/dist/contexts.jsx.map +1 -0
  329. package/dist/index.d.ts +7 -6
  330. package/dist/index.d.ts.map +1 -1
  331. package/dist/index.js +70 -23932
  332. package/dist/index.jsx +70 -18337
  333. package/dist/useDragAndDrop.js +2 -0
  334. package/dist/useDragAndDrop.jsx +2 -0
  335. package/dist/useDragAndDrop2.js +395 -0
  336. package/dist/useDragAndDrop2.js.map +1 -0
  337. package/dist/useDragAndDrop2.jsx +395 -0
  338. package/dist/useDragAndDrop2.jsx.map +1 -0
  339. package/dist/utils.d.ts +83 -11
  340. package/dist/utils.d.ts.map +1 -1
  341. package/dist/utils.js +285 -0
  342. package/dist/utils.js.map +1 -0
  343. package/dist/utils.jsx +277 -0
  344. package/dist/utils.jsx.map +1 -0
  345. package/dist/virtualizer/Layout.js +144 -0
  346. package/dist/virtualizer/Layout.js.map +1 -0
  347. package/dist/virtualizer/Layout.jsx +144 -0
  348. package/dist/virtualizer/Layout.jsx.map +1 -0
  349. package/package.json +401 -4
  350. package/src/Breadcrumbs.tsx +3 -1
  351. package/src/Button.tsx +22 -2
  352. package/src/Calendar.tsx +27 -10
  353. package/src/CalendarPicker.tsx +73 -0
  354. package/src/Checkbox.tsx +539 -3
  355. package/src/Collection.tsx +9 -3
  356. package/src/Color.tsx +42 -14
  357. package/src/ComboBox.tsx +50 -6
  358. package/src/DateField.tsx +20 -2
  359. package/src/DatePicker.tsx +57 -5
  360. package/src/Dialog.tsx +13 -5
  361. package/src/Disclosure.tsx +3 -1
  362. package/src/DragAndDrop.tsx +3 -1
  363. package/src/DropZone.tsx +3 -1
  364. package/src/GridList.tsx +125 -24
  365. package/src/Icon.tsx +3 -1
  366. package/src/Link.tsx +3 -1
  367. package/src/ListBox.tsx +31 -4
  368. package/src/Menu.tsx +252 -128
  369. package/src/Meter.tsx +3 -1
  370. package/src/Modal.tsx +100 -52
  371. package/src/NumberField.tsx +51 -8
  372. package/src/Popover.tsx +40 -10
  373. package/src/ProgressBar.tsx +3 -1
  374. package/src/RadioGroup.tsx +468 -4
  375. package/src/RangeCalendar.tsx +3 -1
  376. package/src/SearchField.tsx +27 -3
  377. package/src/Select.tsx +22 -7
  378. package/src/SelectionIndicator.tsx +3 -1
  379. package/src/SharedElementTransition.tsx +3 -1
  380. package/src/Slider.tsx +159 -13
  381. package/src/Switch.tsx +395 -2
  382. package/src/Table.tsx +409 -95
  383. package/src/Tabs.tsx +16 -45
  384. package/src/TagGroup.tsx +3 -1
  385. package/src/Text.tsx +31 -10
  386. package/src/TextField.tsx +43 -5
  387. package/src/TimeField.tsx +20 -2
  388. package/src/Toast.tsx +79 -14
  389. package/src/ToggleButton.tsx +3 -1
  390. package/src/ToggleButtonGroup.tsx +3 -1
  391. package/src/Tooltip.tsx +3 -1
  392. package/src/Tree.tsx +77 -9
  393. package/src/Virtualizer.tsx +180 -31
  394. package/src/VirtualizerLayouts.ts +45 -10
  395. package/src/index.ts +50 -0
  396. package/src/utils.tsx +243 -27
  397. package/dist/index.js.map +0 -1
  398. package/dist/index.jsx.map +0 -1
@@ -0,0 +1,681 @@
1
+ import { Provider, filterDOMProps, useRenderProps } from "./utils.jsx";
2
+ import { VisuallyHidden } from "./VisuallyHidden.jsx";
3
+ import { FieldErrorContext } from "./FieldError.jsx";
4
+ import { TextContext } from "./Text.jsx";
5
+ import { SelectionIndicatorContext } from "./SelectionIndicator.jsx";
6
+ import { Show, createContext, createMemo, createSignal, createUniqueId, splitProps, useContext } from "solid-js";
7
+ import { createFocusRing, createHover, createRadio, createRadioGroup, mergeProps as mergeProps$1 } from "@proyecto-viviana/solidaria";
8
+ import { VALID_VALIDITY_STATE, createRadioGroupState } from "@proyecto-viviana/solid-stately";
9
+ //#region src/RadioGroup.tsx
10
+ /**
11
+ * RadioGroup and Radio components for solidaria-components
12
+ *
13
+ * Pre-wired headless radio components that combine state + aria hooks.
14
+ * Port of react-aria-components/src/RadioGroup.tsx
15
+ */
16
+ function assignRef(ref, el) {
17
+ if (!ref) return;
18
+ if (typeof ref === "function") ref(el);
19
+ else ref.current = el;
20
+ }
21
+ const validValidation = {
22
+ isInvalid: false,
23
+ validationDetails: VALID_VALIDITY_STATE,
24
+ validationErrors: []
25
+ };
26
+ function getNativeValidation(input) {
27
+ return {
28
+ isInvalid: !input.validity.valid,
29
+ validationDetails: {
30
+ badInput: input.validity.badInput,
31
+ customError: input.validity.customError,
32
+ patternMismatch: input.validity.patternMismatch,
33
+ rangeOverflow: input.validity.rangeOverflow,
34
+ rangeUnderflow: input.validity.rangeUnderflow,
35
+ stepMismatch: input.validity.stepMismatch,
36
+ tooLong: input.validity.tooLong,
37
+ tooShort: input.validity.tooShort,
38
+ typeMismatch: input.validity.typeMismatch,
39
+ valueMissing: input.validity.valueMissing,
40
+ valid: input.validity.valid
41
+ },
42
+ validationErrors: input.validationMessage ? [input.validationMessage] : []
43
+ };
44
+ }
45
+ const RadioGroupContext = createContext(null);
46
+ const RadioGroupStateContext = createContext(null);
47
+ const RadioContext = createContext(null);
48
+ /**
49
+ * A radio group allows a user to select a single item from a list of mutually exclusive options.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * <RadioGroup>
54
+ * <Radio value="one">Option 1</Radio>
55
+ * <Radio value="two">Option 2</Radio>
56
+ * </RadioGroup>
57
+ * ```
58
+ */
59
+ function RadioGroup(props) {
60
+ const contextProps = useContext(RadioGroupContext);
61
+ const contextSlotProps = contextProps?.slots?.[props.slot ?? "default"];
62
+ const contextBaseProps = createMemo(() => {
63
+ if (!contextProps) return {};
64
+ const { slots: _slots, ...rest } = contextProps;
65
+ return rest;
66
+ });
67
+ const mergedProps = contextProps ? mergeProps$1(contextBaseProps(), contextSlotProps ?? {}, props) : props;
68
+ const [local, ariaProps] = splitProps(mergedProps, [
69
+ "class",
70
+ "style",
71
+ "render",
72
+ "ref",
73
+ "slot",
74
+ "renderHelpText"
75
+ ]);
76
+ const state = createRadioGroupState(() => ({
77
+ value: mergedProps.value,
78
+ defaultValue: mergedProps.defaultValue,
79
+ onChange: mergedProps.onChange,
80
+ isDisabled: mergedProps.isDisabled,
81
+ isReadOnly: mergedProps.isReadOnly,
82
+ isRequired: mergedProps.isRequired,
83
+ isInvalid: mergedProps.isInvalid,
84
+ validationState: mergedProps.validationState,
85
+ validate: mergedProps.validate,
86
+ validationBehavior: mergedProps.validationBehavior,
87
+ name: mergedProps.name,
88
+ form: mergedProps.form
89
+ }));
90
+ const groupAria = createRadioGroup(() => ({
91
+ ...ariaProps,
92
+ description: mergedProps.description,
93
+ errorMessage: mergedProps.errorMessage
94
+ }), state);
95
+ const isInvalid = createMemo(() => state.isInvalid);
96
+ const validation = createMemo(() => state.displayValidation());
97
+ const fallbackErrorMessageId = createUniqueId();
98
+ const errorMessageId = () => groupAria.errorMessageProps.id ?? fallbackErrorMessageId;
99
+ const renderValues = createMemo(() => ({
100
+ orientation: ariaProps.orientation ?? "vertical",
101
+ isDisabled: state.isDisabled,
102
+ isReadOnly: state.isReadOnly,
103
+ isRequired: state.isRequired,
104
+ isInvalid: isInvalid(),
105
+ state
106
+ }));
107
+ const renderProps = useRenderProps({
108
+ get children() {
109
+ return props.children;
110
+ },
111
+ class: local.class,
112
+ style: local.style,
113
+ defaultClassName: "solidaria-RadioGroup"
114
+ }, renderValues);
115
+ const domProps = createMemo(() => filterDOMProps(ariaProps, { global: true }));
116
+ const cleanGroupProps = () => {
117
+ const { ref: _ref, ...rest } = groupAria.radioGroupProps;
118
+ return rest;
119
+ };
120
+ const handleGroupFocusIn = (event) => {
121
+ groupAria.radioGroupProps.onFocus?.(event);
122
+ };
123
+ const handleGroupFocusOut = (event) => {
124
+ groupAria.radioGroupProps.onBlur?.(event);
125
+ };
126
+ const handleGroupInvalidCapture = (event) => {
127
+ const target = event.target;
128
+ if (!(target instanceof HTMLInputElement) || target.type !== "radio") return;
129
+ state.updateValidation(getNativeValidation(target));
130
+ state.commitValidation();
131
+ target.focus();
132
+ event.preventDefault();
133
+ };
134
+ const handleGroupChangeCapture = (event) => {
135
+ const target = event.target;
136
+ if (!(target instanceof HTMLInputElement) || target.type !== "radio") return;
137
+ state.updateValidation(target.validity.valid ? validValidation : getNativeValidation(target));
138
+ state.commitValidation();
139
+ };
140
+ const setGroupRef = (el) => {
141
+ assignRef(local.ref, el);
142
+ };
143
+ const groupDescribedBy = () => {
144
+ const ids = [
145
+ cleanGroupProps()["aria-describedby"],
146
+ mergedProps.description ? groupAria.descriptionProps.id : void 0,
147
+ isInvalid() && (mergedProps.errorMessage || validation().validationErrors.length > 0) ? errorMessageId() : void 0
148
+ ].filter(Boolean).join(" ").split(" ").filter(Boolean);
149
+ return ids.length ? Array.from(new Set(ids)).join(" ") : void 0;
150
+ };
151
+ const fieldErrorContext = {
152
+ get validation() {
153
+ return validation();
154
+ },
155
+ get errorMessageProps() {
156
+ return {
157
+ ...groupAria.errorMessageProps,
158
+ id: errorMessageId()
159
+ };
160
+ }
161
+ };
162
+ const GroupChildren = () => {
163
+ const childRenderValues = {
164
+ get orientation() {
165
+ return ariaProps.orientation ?? "vertical";
166
+ },
167
+ get isDisabled() {
168
+ return state.isDisabled;
169
+ },
170
+ get isReadOnly() {
171
+ return state.isReadOnly;
172
+ },
173
+ get isRequired() {
174
+ return state.isRequired;
175
+ },
176
+ get isInvalid() {
177
+ return isInvalid();
178
+ },
179
+ get state() {
180
+ return state;
181
+ }
182
+ };
183
+ const renderedChildren = createMemo(() => {
184
+ const children = props.children;
185
+ if (typeof children === "function") return children.length > 0 ? children(childRenderValues) : children();
186
+ return children;
187
+ });
188
+ return <>
189
+ {renderedChildren()}
190
+ <Show when={(local.renderHelpText ?? true) && mergedProps.description}>
191
+ <div {...groupAria.descriptionProps}>
192
+ {mergedProps.description}
193
+ </div>
194
+ </Show>
195
+ <Show when={(local.renderHelpText ?? true) && isInvalid() && mergedProps.errorMessage}>
196
+ <div {...groupAria.errorMessageProps}>
197
+ {mergedProps.errorMessage}
198
+ </div>
199
+ </Show>
200
+ </>;
201
+ };
202
+ const groupEventProps = {
203
+ onInvalidCapture: handleGroupInvalidCapture,
204
+ onChangeCapture: handleGroupChangeCapture
205
+ };
206
+ const customRootProps = () => ({
207
+ ...domProps(),
208
+ ...cleanGroupProps(),
209
+ ...groupEventProps,
210
+ ref: setGroupRef,
211
+ onFocusIn: handleGroupFocusIn,
212
+ onFocusOut: handleGroupFocusOut,
213
+ "aria-describedby": groupDescribedBy(),
214
+ class: renderProps.class(),
215
+ style: renderProps.style(),
216
+ slot: local.slot,
217
+ "data-orientation": ariaProps.orientation ?? "vertical",
218
+ "data-disabled": state.isDisabled || void 0,
219
+ "data-readonly": state.isReadOnly || void 0,
220
+ "data-required": state.isRequired || void 0,
221
+ "data-invalid": isInvalid() || void 0,
222
+ children: <GroupChildren />
223
+ });
224
+ return <RadioGroupStateContext.Provider value={state}>
225
+ <FieldErrorContext.Provider value={fieldErrorContext}>
226
+ {local.render ? local.render(customRootProps(), renderValues()) : <div {...domProps()} {...cleanGroupProps()} {...groupEventProps} ref={setGroupRef} onFocusIn={handleGroupFocusIn} onFocusOut={handleGroupFocusOut} aria-describedby={groupDescribedBy()} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-orientation={ariaProps.orientation ?? "vertical"} data-disabled={state.isDisabled || void 0} data-readonly={state.isReadOnly || void 0} data-required={state.isRequired || void 0} data-invalid={isInvalid() || void 0}>
227
+ <GroupChildren />
228
+ </div>}
229
+ </FieldErrorContext.Provider>
230
+ </RadioGroupStateContext.Provider>;
231
+ }
232
+ /**
233
+ * Internal Radio implementation that has access to RadioGroupStateContext.
234
+ * This is rendered inside the RadioGroup's context provider.
235
+ */
236
+ function RadioImpl(props) {
237
+ const [inputElement, setInputElement] = createSignal(null);
238
+ const { state } = props;
239
+ const contextProps = useContext(RadioContext);
240
+ const contextSlotProps = contextProps?.slots?.[props.radioProps.slot ?? "default"];
241
+ const contextBaseProps = createMemo(() => {
242
+ if (!contextProps) return {};
243
+ const { slots: _slots, ...rest } = contextProps;
244
+ return rest;
245
+ });
246
+ const radioProps = contextProps ? mergeProps$1(contextBaseProps(), contextSlotProps ?? {}, props.radioProps) : props.radioProps;
247
+ const inputRefs = createMemo(() => [
248
+ contextBaseProps().inputRef,
249
+ contextSlotProps?.inputRef,
250
+ props.radioProps.inputRef
251
+ ].filter(Boolean));
252
+ const [local, ariaProps] = splitProps(radioProps, [
253
+ "class",
254
+ "style",
255
+ "render",
256
+ "ref",
257
+ "inputRef",
258
+ "slot",
259
+ "description",
260
+ "errorMessage",
261
+ "onHoverStart",
262
+ "onHoverEnd",
263
+ "onHoverChange"
264
+ ]);
265
+ const descriptionId = createUniqueId();
266
+ const errorMessageId = createUniqueId();
267
+ const describedBy = () => {
268
+ const ids = [
269
+ ariaProps["aria-describedby"],
270
+ local.description ? descriptionId : void 0,
271
+ state.isInvalid && local.errorMessage ? errorMessageId : void 0
272
+ ].filter(Boolean);
273
+ return ids.length ? ids.join(" ") : void 0;
274
+ };
275
+ const inputAriaProps = createMemo(() => {
276
+ const clean = {};
277
+ for (const key in ariaProps) if (!key.startsWith("data-")) clean[key] = ariaProps[key];
278
+ return clean;
279
+ });
280
+ const radioAria = createRadio(() => ({
281
+ ...inputAriaProps(),
282
+ "aria-describedby": describedBy(),
283
+ children: typeof radioProps.children === "function" ? true : radioProps.children
284
+ }), state, inputElement);
285
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
286
+ const { isHovered, hoverProps } = createHover({
287
+ get isDisabled() {
288
+ return radioAria.isDisabled || state.isReadOnly;
289
+ },
290
+ onHoverStart: local.onHoverStart,
291
+ onHoverEnd: local.onHoverEnd,
292
+ onHoverChange: local.onHoverChange
293
+ });
294
+ const renderValues = createMemo(() => ({
295
+ isSelected: radioAria.isSelected(),
296
+ isHovered: isHovered(),
297
+ isPressed: radioAria.isPressed(),
298
+ isFocused: isFocused(),
299
+ isFocusVisible: isFocusVisible(),
300
+ isDisabled: radioAria.isDisabled,
301
+ isReadOnly: state.isReadOnly,
302
+ isInvalid: state.isInvalid,
303
+ isRequired: state.isRequired
304
+ }));
305
+ const renderProps = useRenderProps({
306
+ children: radioProps.children,
307
+ class: local.class,
308
+ style: local.style,
309
+ defaultClassName: "solidaria-Radio"
310
+ }, renderValues);
311
+ const selectionIndicatorContext = createMemo(() => ({ isSelected: radioAria.isSelected }));
312
+ const domProps = createMemo(() => {
313
+ const filtered = filterDOMProps(ariaProps, { global: true });
314
+ delete filtered.id;
315
+ delete filtered.onClick;
316
+ return filtered;
317
+ });
318
+ const cleanLabelProps = () => {
319
+ const { ref: _ref1, ...rest } = radioAria.labelProps;
320
+ return rest;
321
+ };
322
+ const cleanHoverProps = () => {
323
+ const { ref: _ref2, ...rest } = hoverProps;
324
+ return rest;
325
+ };
326
+ const cleanInputProps = () => {
327
+ const { ref: _ref3, onFocus: _onFocus, onBlur: _onBlur, ...rest } = radioAria.inputProps;
328
+ return rest;
329
+ };
330
+ const cleanFocusProps = () => {
331
+ const { ref: _ref4, onFocus: _onFocus, onBlur: _onBlur, ...rest } = focusProps;
332
+ return rest;
333
+ };
334
+ const handleInputFocus = (event) => {
335
+ radioAria.inputProps.onFocus?.(event);
336
+ focusProps.onFocus?.(event);
337
+ };
338
+ const handleInputBlur = (event) => {
339
+ radioAria.inputProps.onBlur?.(event);
340
+ focusProps.onBlur?.(event);
341
+ };
342
+ const handleLabelClick = (event) => {
343
+ ariaProps.onClickCapture?.(event);
344
+ radioAria.labelProps.onClick?.(event);
345
+ };
346
+ const handleLabelClickCapture = (event) => {
347
+ ariaProps.onClickCapture?.(event);
348
+ };
349
+ const handleInputClick = (event) => {
350
+ radioAria.inputProps.onClick?.(event);
351
+ };
352
+ const handleInputInvalid = (event) => {
353
+ state.updateValidation(getNativeValidation(event.currentTarget));
354
+ state.commitValidation();
355
+ event.currentTarget.focus();
356
+ event.preventDefault();
357
+ };
358
+ const handleInputChange = (event) => {
359
+ radioAria.inputProps.onChange?.(event);
360
+ state.updateValidation(event.currentTarget.validity.valid ? validValidation : getNativeValidation(event.currentTarget));
361
+ state.commitValidation();
362
+ };
363
+ const setLabelRef = (el) => {
364
+ assignRef(local.ref, el);
365
+ };
366
+ const setInputRef = (el) => {
367
+ setInputElement(el);
368
+ el.addEventListener("invalid", (event) => {
369
+ state.updateValidation(getNativeValidation(el));
370
+ state.commitValidation();
371
+ el.focus();
372
+ event.preventDefault();
373
+ });
374
+ el.addEventListener("change", () => {
375
+ state.updateValidation(el.validity.valid ? validValidation : getNativeValidation(el));
376
+ state.commitValidation();
377
+ });
378
+ for (const ref of inputRefs()) assignRef(ref, el);
379
+ };
380
+ const hiddenInput = <VisuallyHidden>
381
+ <input ref={setInputRef} {...cleanInputProps()} {...cleanFocusProps()} onFocus={handleInputFocus} onBlur={handleInputBlur} onInvalid={handleInputInvalid} onChange={handleInputChange} onClick={handleInputClick} />
382
+ </VisuallyHidden>;
383
+ const labelChildren = () => <>
384
+ {hiddenInput}
385
+ {renderProps.renderChildren()}
386
+ <Show when={local.description}>
387
+ <span id={descriptionId} slot="description">
388
+ {local.description}
389
+ </span>
390
+ </Show>
391
+ <Show when={state.isInvalid && local.errorMessage}>
392
+ <span id={errorMessageId} slot="errorMessage">
393
+ {local.errorMessage}
394
+ </span>
395
+ </Show>
396
+ </>;
397
+ const customLabelProps = () => ({
398
+ ...domProps(),
399
+ ...cleanLabelProps(),
400
+ ...cleanHoverProps(),
401
+ ref: setLabelRef,
402
+ class: renderProps.class(),
403
+ style: renderProps.style(),
404
+ slot: local.slot,
405
+ onClick: handleLabelClick,
406
+ onClickCapture: handleLabelClickCapture,
407
+ "data-selected": radioAria.isSelected() || void 0,
408
+ "data-pressed": radioAria.isPressed() || void 0,
409
+ "data-hovered": isHovered() || void 0,
410
+ "data-focused": isFocused() || void 0,
411
+ "data-focus-visible": isFocusVisible() || void 0,
412
+ "data-disabled": radioAria.isDisabled || void 0,
413
+ "data-readonly": state.isReadOnly || void 0,
414
+ "data-invalid": state.isInvalid || void 0,
415
+ "data-required": state.isRequired || void 0,
416
+ children: labelChildren()
417
+ });
418
+ const labelCaptureProps = { onClickCapture: handleLabelClickCapture };
419
+ return <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>
420
+ {local.render ? local.render(customLabelProps(), renderValues()) : <label {...domProps()} {...cleanLabelProps()} {...cleanHoverProps()} ref={setLabelRef} class={renderProps.class()} style={renderProps.style()} slot={local.slot} onClick={handleLabelClick} {...labelCaptureProps} data-selected={radioAria.isSelected() || void 0} data-pressed={radioAria.isPressed() || void 0} data-hovered={isHovered() || void 0} data-focused={isFocused() || void 0} data-focus-visible={isFocusVisible() || void 0} data-disabled={radioAria.isDisabled || void 0} data-readonly={state.isReadOnly || void 0} data-invalid={state.isInvalid || void 0} data-required={state.isRequired || void 0}>
421
+ {labelChildren()}
422
+ </label>}
423
+ </SelectionIndicatorContext.Provider>;
424
+ }
425
+ /**
426
+ * A radio represents an individual option within a radio group.
427
+ *
428
+ * @example
429
+ * ```tsx
430
+ * <Radio value="option1">
431
+ * {({ isSelected }) => (
432
+ * <>
433
+ * <span class={`radio ${isSelected ? 'selected' : ''}`}>
434
+ * {isSelected && '●'}
435
+ * </span>
436
+ * <span>Option 1</span>
437
+ * </>
438
+ * )}
439
+ * </Radio>
440
+ * ```
441
+ */
442
+ function Radio(props) {
443
+ const getState = createMemo(() => useContext(RadioGroupStateContext));
444
+ return <Show when={getState()} fallback={null} keyed>
445
+ {(state) => <RadioImpl radioProps={props} state={state} />}
446
+ </Show>;
447
+ }
448
+ const RadioFieldContext = createContext(null);
449
+ const InternalRadioContext = createContext(null);
450
+ /**
451
+ * A RadioField represents an individual option within a radio group, containing a
452
+ * `RadioButton` and optional description. Must be rendered inside a `RadioGroup`.
453
+ * Per-option help text is wired through a TextContext description slot — render it
454
+ * with `<Text slot="description">`. (Radios have no per-option error slot; errors
455
+ * are reported at the group level.)
456
+ *
457
+ * @example
458
+ * ```tsx
459
+ * <RadioGroup>
460
+ * <RadioField value="a">
461
+ * <RadioButton>Option A</RadioButton>
462
+ * <Text slot="description">The first option</Text>
463
+ * </RadioField>
464
+ * </RadioGroup>
465
+ * ```
466
+ */
467
+ function RadioField(props) {
468
+ const getState = createMemo(() => useContext(RadioGroupStateContext));
469
+ return <Show when={getState()} fallback={null} keyed>
470
+ {(state) => <RadioFieldImpl fieldProps={props} state={state} />}
471
+ </Show>;
472
+ }
473
+ function RadioFieldImpl(props) {
474
+ const [inputElement, setInputElement] = createSignal(null);
475
+ const { state } = props;
476
+ const contextProps = useContext(RadioFieldContext);
477
+ const contextSlotProps = contextProps?.slots?.[props.fieldProps.slot ?? "default"];
478
+ const contextBaseProps = createMemo(() => {
479
+ if (!contextProps) return {};
480
+ const { slots: _slots, ...rest } = contextProps;
481
+ return rest;
482
+ });
483
+ const fieldProps = contextProps ? mergeProps$1(contextBaseProps(), contextSlotProps ?? {}, props.fieldProps) : props.fieldProps;
484
+ const inputRefs = createMemo(() => [
485
+ contextBaseProps().inputRef,
486
+ contextSlotProps?.inputRef,
487
+ props.fieldProps.inputRef
488
+ ].filter(Boolean));
489
+ const [local, ariaProps] = splitProps(fieldProps, [
490
+ "class",
491
+ "style",
492
+ "ref",
493
+ "inputRef",
494
+ "slot",
495
+ "children"
496
+ ]);
497
+ const inputAriaProps = createMemo(() => {
498
+ const clean = {};
499
+ for (const key in ariaProps) if (!key.startsWith("data-")) clean[key] = ariaProps[key];
500
+ return clean;
501
+ });
502
+ const radioAria = createRadio(() => ({
503
+ ...inputAriaProps(),
504
+ children: true
505
+ }), state, inputElement);
506
+ const textSlots = { slots: { get description() {
507
+ return radioAria.descriptionProps;
508
+ } } };
509
+ const setInputRef = (el) => {
510
+ setInputElement(el);
511
+ el.addEventListener("invalid", (event) => {
512
+ state.updateValidation(getNativeValidation(el));
513
+ state.commitValidation();
514
+ el.focus();
515
+ event.preventDefault();
516
+ });
517
+ el.addEventListener("change", () => {
518
+ state.updateValidation(el.validity.valid ? validValidation : getNativeValidation(el));
519
+ state.commitValidation();
520
+ });
521
+ for (const ref of inputRefs()) assignRef(ref, el);
522
+ };
523
+ const setFieldRef = (el) => {
524
+ assignRef(local.ref, el);
525
+ };
526
+ const internalContext = {
527
+ isSelected: () => radioAria.isSelected(),
528
+ isPressed: () => radioAria.isPressed(),
529
+ isDisabled: () => radioAria.isDisabled,
530
+ labelProps: () => radioAria.labelProps,
531
+ inputProps: () => radioAria.inputProps,
532
+ setInputRef,
533
+ defaultClassName: "solidaria-RadioButton"
534
+ };
535
+ const selectionIndicatorContext = createMemo(() => ({ isSelected: radioAria.isSelected }));
536
+ const renderValues = createMemo(() => ({
537
+ isSelected: radioAria.isSelected(),
538
+ isDisabled: radioAria.isDisabled,
539
+ isReadOnly: state.isReadOnly,
540
+ isInvalid: state.isInvalid,
541
+ isRequired: state.isRequired
542
+ }));
543
+ const renderProps = useRenderProps({
544
+ children: fieldProps.children,
545
+ class: local.class,
546
+ style: local.style,
547
+ defaultClassName: "solidaria-RadioField"
548
+ }, renderValues);
549
+ const domProps = createMemo(() => {
550
+ const filtered = filterDOMProps(ariaProps, { global: true });
551
+ delete filtered.id;
552
+ delete filtered.onClick;
553
+ return filtered;
554
+ });
555
+ const FieldChildren = () => {
556
+ const childRenderValues = {
557
+ get isSelected() {
558
+ return radioAria.isSelected();
559
+ },
560
+ get isDisabled() {
561
+ return radioAria.isDisabled;
562
+ },
563
+ get isReadOnly() {
564
+ return state.isReadOnly;
565
+ },
566
+ get isInvalid() {
567
+ return state.isInvalid;
568
+ },
569
+ get isRequired() {
570
+ return state.isRequired;
571
+ }
572
+ };
573
+ const renderedChildren = createMemo(() => {
574
+ const children = fieldProps.children;
575
+ return typeof children === "function" ? children(childRenderValues) : children;
576
+ });
577
+ return <>{renderedChildren()}</>;
578
+ };
579
+ return <div {...domProps()} ref={setFieldRef} class={renderProps.class()} style={renderProps.style()} slot={local.slot} data-selected={radioAria.isSelected() || void 0} data-disabled={radioAria.isDisabled || void 0} data-readonly={state.isReadOnly || void 0} data-invalid={state.isInvalid || void 0} data-required={state.isRequired || void 0}>
580
+ <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>
581
+ <InternalRadioContext.Provider value={internalContext}>
582
+ <Provider values={[[TextContext, textSlots]]}>
583
+ <FieldChildren />
584
+ </Provider>
585
+ </InternalRadioContext.Provider>
586
+ </SelectionIndicatorContext.Provider>
587
+ </div>;
588
+ }
589
+ /**
590
+ * A RadioButton is the clickable area of a radio, including the indicator and label.
591
+ * Must be rendered inside a `RadioField` (or the legacy `Radio`).
592
+ */
593
+ function RadioButton(props) {
594
+ const getCtx = createMemo(() => useContext(InternalRadioContext));
595
+ const getState = createMemo(() => useContext(RadioGroupStateContext));
596
+ return <Show when={getCtx()} fallback={null} keyed>
597
+ {(ctx) => <Show when={getState()} fallback={null} keyed>
598
+ {(state) => <RadioButtonImpl buttonProps={props} ctx={ctx} state={state} />}
599
+ </Show>}
600
+ </Show>;
601
+ }
602
+ function RadioButtonImpl(props) {
603
+ const { ctx, state } = props;
604
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
605
+ const { isHovered, hoverProps } = createHover({
606
+ get isDisabled() {
607
+ return ctx.isDisabled() || state.isReadOnly;
608
+ },
609
+ onHoverStart: props.buttonProps.onHoverStart,
610
+ onHoverEnd: props.buttonProps.onHoverEnd,
611
+ onHoverChange: props.buttonProps.onHoverChange
612
+ });
613
+ const renderValues = createMemo(() => ({
614
+ isSelected: ctx.isSelected(),
615
+ isHovered: isHovered(),
616
+ isPressed: ctx.isPressed(),
617
+ isFocused: isFocused(),
618
+ isFocusVisible: isFocusVisible(),
619
+ isDisabled: ctx.isDisabled(),
620
+ isReadOnly: state.isReadOnly,
621
+ isInvalid: state.isInvalid,
622
+ isRequired: state.isRequired
623
+ }));
624
+ const renderProps = useRenderProps({
625
+ children: props.buttonProps.children,
626
+ class: props.buttonProps.class,
627
+ style: props.buttonProps.style,
628
+ defaultClassName: ctx.defaultClassName
629
+ }, renderValues);
630
+ const cleanLabelProps = () => {
631
+ const { ref: _ref1, ...rest } = ctx.labelProps();
632
+ return rest;
633
+ };
634
+ const cleanHoverProps = () => {
635
+ const { ref: _ref2, ...rest } = hoverProps;
636
+ return rest;
637
+ };
638
+ const cleanInputProps = () => {
639
+ const { ref: _ref3, onFocus: _onFocus, onBlur: _onBlur, ...rest } = ctx.inputProps();
640
+ return rest;
641
+ };
642
+ const cleanFocusProps = () => {
643
+ const { ref: _ref4, onFocus: _onFocus, onBlur: _onBlur, ...rest } = focusProps;
644
+ return rest;
645
+ };
646
+ const handleInputFocus = (event) => {
647
+ ctx.inputProps().onFocus?.(event);
648
+ focusProps.onFocus?.(event);
649
+ };
650
+ const handleInputBlur = (event) => {
651
+ ctx.inputProps().onBlur?.(event);
652
+ focusProps.onBlur?.(event);
653
+ };
654
+ const handleInputClick = (event) => {
655
+ ctx.inputProps().onClick?.(event);
656
+ };
657
+ const handleInputInvalid = (event) => {
658
+ state.updateValidation(getNativeValidation(event.currentTarget));
659
+ state.commitValidation();
660
+ event.currentTarget.focus();
661
+ event.preventDefault();
662
+ };
663
+ const handleInputChange = (event) => {
664
+ ctx.inputProps().onChange?.(event);
665
+ state.updateValidation(event.currentTarget.validity.valid ? validValidation : getNativeValidation(event.currentTarget));
666
+ state.commitValidation();
667
+ };
668
+ const setButtonRef = (el) => {
669
+ assignRef(props.buttonProps.ref, el);
670
+ };
671
+ return <label {...cleanLabelProps()} {...cleanHoverProps()} ref={setButtonRef} class={renderProps.class()} style={renderProps.style()} slot={props.buttonProps.slot} data-selected={ctx.isSelected() || void 0} data-pressed={ctx.isPressed() || void 0} data-hovered={isHovered() || void 0} data-focused={isFocused() || void 0} data-focus-visible={isFocusVisible() || void 0} data-disabled={ctx.isDisabled() || void 0} data-readonly={state.isReadOnly || void 0} data-invalid={state.isInvalid || void 0} data-required={state.isRequired || void 0}>
672
+ <VisuallyHidden>
673
+ <input ref={ctx.setInputRef} {...cleanInputProps()} {...cleanFocusProps()} onFocus={handleInputFocus} onBlur={handleInputBlur} onInvalid={handleInputInvalid} onChange={handleInputChange} onClick={handleInputClick} />
674
+ </VisuallyHidden>
675
+ {renderProps.renderChildren()}
676
+ </label>;
677
+ }
678
+ //#endregion
679
+ export { Radio, RadioButton, RadioContext, RadioField, RadioFieldContext, RadioGroup, RadioGroupContext, RadioGroupStateContext };
680
+
681
+ //# sourceMappingURL=RadioGroup.jsx.map