@proyecto-viviana/solidaria-components 0.3.1 → 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 +8 -5
  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 +7 -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 -23711
  332. package/dist/index.jsx +70 -18116
  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 +90 -23
  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 +126 -14
  358. package/src/DateField.tsx +20 -2
  359. package/src/DatePicker.tsx +117 -10
  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 +298 -131
  369. package/src/Meter.tsx +3 -1
  370. package/src/Modal.tsx +100 -52
  371. package/src/NumberField.tsx +73 -10
  372. package/src/Popover.tsx +49 -11
  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 +4 -1
  385. package/src/Text.tsx +31 -10
  386. package/src/TextField.tsx +73 -10
  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 +55 -8
  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
package/dist/utils.js ADDED
@@ -0,0 +1,285 @@
1
+ import { createComponent, isServer, memo } from "solid-js/web";
2
+ import { Show, createComponent as createComponent$1, createContext, createMemo, createSignal, onMount, sharedConfig, untrack, useContext } from "solid-js";
3
+ import { mergeProps as mergeProps$2 } from "@proyecto-viviana/solidaria";
4
+ //#region src/utils.tsx
5
+ /**
6
+ * Utility functions for solidaria-components
7
+ * Port of react-aria-components/src/utils.tsx
8
+ */
9
+ const DEFAULT_SLOT = "default";
10
+ /**
11
+ * Resolves render props (children, class, style) based on component state.
12
+ *
13
+ * For SSR compatibility, children are NOT evaluated eagerly. Instead:
14
+ * - Use `renderChildren()` to render children with current values
15
+ * - Or access `children` directly if you need the raw prop
16
+ *
17
+ * This avoids the getter pattern that causes SSR hydration mismatches.
18
+ */
19
+ function useRenderProps(props, values) {
20
+ const { class: className, style, defaultClassName = "" } = props;
21
+ return {
22
+ class: createMemo(() => {
23
+ const currentValues = values();
24
+ return typeof className === "function" ? className(currentValues) : className ?? defaultClassName;
25
+ }),
26
+ style: createMemo(() => {
27
+ const currentValues = values();
28
+ return typeof style === "function" ? style(currentValues) : style;
29
+ }),
30
+ renderChildren: () => {
31
+ const children = props.children;
32
+ return typeof children === "function" && children.length > 0 ? children(values()) : children;
33
+ },
34
+ renderChildrenStable: () => {
35
+ const children = props.children;
36
+ if (typeof children !== "function" || children.length === 0) return children;
37
+ return untrack(() => {
38
+ const snapshot = values();
39
+ const view = {};
40
+ for (const key of Object.keys(snapshot)) Object.defineProperty(view, key, {
41
+ enumerable: true,
42
+ configurable: true,
43
+ get: () => values()[key]
44
+ });
45
+ return children(view);
46
+ });
47
+ },
48
+ get children() {
49
+ return props.children;
50
+ },
51
+ values
52
+ };
53
+ }
54
+ function composeRenderProps(base, override) {
55
+ if (!base) return override ?? {};
56
+ if (!override) return base;
57
+ return {
58
+ children: override.children ?? base.children,
59
+ class: override.class ?? base.class,
60
+ style: override.style ?? base.style
61
+ };
62
+ }
63
+ /**
64
+ * Creates a context that can carry either a bare value or a `slots` record.
65
+ */
66
+ function createSlottedContext() {
67
+ return createContext(null);
68
+ }
69
+ /** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */
70
+ function assignRef(ref, el) {
71
+ if (!ref) return;
72
+ if (typeof ref === "function") ref(el);
73
+ else if (typeof ref === "object" && "current" in ref) ref.current = el;
74
+ }
75
+ /** Merges multiple Solid refs into one callback that forwards to each, once. */
76
+ function mergeRefs(...refs) {
77
+ return (el) => {
78
+ const seen = /* @__PURE__ */ new Set();
79
+ for (const ref of refs) {
80
+ if (!ref || seen.has(ref)) continue;
81
+ seen.add(ref);
82
+ assignRef(ref, el);
83
+ }
84
+ };
85
+ }
86
+ /**
87
+ * Resolves a (possibly slotted) context value for the given slot name. Port of
88
+ * react-aria-components' `useSlottedContext`:
89
+ * - `slot === null` opts out of the context entirely (returns `null`);
90
+ * - if the context carries a `slots` record, the entry for `slot` (or
91
+ * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;
92
+ * - otherwise the bare context value is returned.
93
+ */
94
+ function useSlottedContext(context, slot) {
95
+ const ctx = useContext(context);
96
+ if (slot === null) return null;
97
+ if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
98
+ const slots = ctx.slots;
99
+ const slotValue = slots[slot || "default"];
100
+ if (!slotValue) {
101
+ const validSlots = Object.keys(slots).map((name) => `"${name}"`).join(", ");
102
+ throw new Error(slot ? `Invalid slot "${slot}". Valid slot names are ${validSlots}.` : `A slot prop is required. Valid slot names are ${validSlots}.`);
103
+ }
104
+ return slotValue;
105
+ }
106
+ return ctx;
107
+ }
108
+ /**
109
+ * Merges context-provided props and a context ref into a component's own props
110
+ * and ref. Port of react-aria-components' `useContextProps`:
111
+ * - the context is resolved for `props.slot` via {@link useSlottedContext};
112
+ * - props win over context props (handler props are chained by `mergeProps`);
113
+ * - the component's own ref and the context's ref merge into one callback.
114
+ *
115
+ * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop
116
+ * changes keep flowing; the context value is read once at setup, matching a single
117
+ * upstream render.
118
+ */
119
+ function useContextProps(props, ref, context) {
120
+ const { ref: contextRef, ...contextProps } = useSlottedContext(context, props.slot) ?? {};
121
+ const mergedRef = mergeRefs(ref, contextRef);
122
+ return [mergeProps$2(contextProps, props), mergedRef];
123
+ }
124
+ /**
125
+ * Detects whether slotted content was rendered into a placeholder, for the
126
+ * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a
127
+ * ref callback to attach to the placeholder and an accessor that is `true` while
128
+ * an element is mounted there. The accessor flips to `false` after mount if the
129
+ * ref never ran (no slotted content was provided).
130
+ */
131
+ function useSlot(initialState = true) {
132
+ const [hasSlot, setHasSlot] = createSignal(initialState);
133
+ let hasRun = false;
134
+ const ref = (el) => {
135
+ hasRun = true;
136
+ setHasSlot(!!el);
137
+ };
138
+ onMount(() => {
139
+ if (!hasRun) setHasSlot(false);
140
+ });
141
+ return [ref, hasSlot];
142
+ }
143
+ /**
144
+ * Nests a set of context providers around `children`. Port of
145
+ * react-aria-components' `Provider`: each `[Context, value]` pair wraps the
146
+ * previous result, so the LAST pair is the outermost provider — matching upstream's
147
+ * wrap-in-iteration-order.
148
+ *
149
+ * `children` is read through a lazy getter inside the innermost provider so child
150
+ * components are *created* within every provider's owner; Solid binds `useContext`
151
+ * at component-execution time, so eager children would miss these providers.
152
+ */
153
+ function Provider(props) {
154
+ const build = (index) => {
155
+ if (index < 0) return props.children;
156
+ const [context, value] = props.values[index];
157
+ return createComponent$1(context.Provider, {
158
+ value,
159
+ get children() {
160
+ return build(index - 1);
161
+ }
162
+ });
163
+ };
164
+ return build(props.values.length - 1);
165
+ }
166
+ /**
167
+ * Converts boolean state values to data attributes
168
+ */
169
+ function dataAttr(value) {
170
+ return value ? "" : void 0;
171
+ }
172
+ /**
173
+ * Creates data attributes from render props
174
+ */
175
+ function createDataAttributes(values) {
176
+ const result = {};
177
+ for (const [key, value] of Object.entries(values)) if (typeof value === "boolean") result[`data-${camelToKebab(key)}`] = value ? "" : void 0;
178
+ else if (value !== void 0) result[`data-${camelToKebab(key)}`] = value;
179
+ return result;
180
+ }
181
+ function camelToKebab(str) {
182
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
183
+ }
184
+ /**
185
+ * Remove data attributes from props (for internal use)
186
+ */
187
+ function removeDataAttributes(props) {
188
+ const result = {};
189
+ for (const [key, value] of Object.entries(props)) if (!key.startsWith("data-")) result[key] = value;
190
+ return result;
191
+ }
192
+ /**
193
+ * Filter DOM props - keep only valid DOM attributes.
194
+ *
195
+ * @param props - Component props to filter
196
+ * @param options - Options for filtering (global: include global attrs)
197
+ * @returns Object containing only valid DOM props. Use type parameter R to specify return type.
198
+ */
199
+ function filterDOMProps(props, options = {}) {
200
+ const { global = false } = options;
201
+ const result = {};
202
+ const globalAttrs = new Set([
203
+ "id",
204
+ "class",
205
+ "style",
206
+ "tabIndex",
207
+ "role",
208
+ "title",
209
+ "lang",
210
+ "dir",
211
+ "hidden",
212
+ "draggable",
213
+ "accessKey",
214
+ "contentEditable",
215
+ "spellcheck"
216
+ ]);
217
+ const ariaAttrs = /^aria-/;
218
+ const dataAttrs = /^data-/;
219
+ const eventHandlers = /^on[A-Z]/;
220
+ for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || eventHandlers.test(key))) result[key] = props[key];
221
+ return result;
222
+ }
223
+ /**
224
+ * ClientOnly component - renders children only on the client side.
225
+ *
226
+ * During SSR, renders the fallback (or nothing).
227
+ * During hydration, renders the same fallback to match SSR.
228
+ * After hydration completes, switches to render children.
229
+ *
230
+ * This is useful for components that rely on browser APIs or
231
+ * have different server/client output.
232
+ *
233
+ * @example
234
+ * ```tsx
235
+ * <ClientOnly fallback={<div>Loading...</div>}>
236
+ * <Calendar />
237
+ * </ClientOnly>
238
+ * ```
239
+ */
240
+ const ClientOnly = (props) => {
241
+ if (isServer) return memo(() => props.fallback);
242
+ if (!sharedConfig.context) return memo(() => props.children);
243
+ const [isHydrated, setIsHydrated] = createSignal(false);
244
+ onMount(() => {
245
+ setIsHydrated(true);
246
+ });
247
+ return createComponent(Show, {
248
+ get when() {
249
+ return isHydrated();
250
+ },
251
+ get fallback() {
252
+ return props.fallback;
253
+ },
254
+ get children() {
255
+ return props.children;
256
+ }
257
+ });
258
+ };
259
+ /**
260
+ * Returns true only on the client after hydration is complete.
261
+ * Can be used to conditionally render client-only content.
262
+ *
263
+ * @example
264
+ * ```tsx
265
+ * const hydrated = useIsHydrated();
266
+ * return (
267
+ * <Show when={hydrated()} fallback={<Placeholder />}>
268
+ * <ClientOnlyComponent />
269
+ * </Show>
270
+ * );
271
+ * ```
272
+ */
273
+ function useIsHydrated() {
274
+ if (isServer) return () => false;
275
+ if (!sharedConfig.context) return () => true;
276
+ const [isHydrated, setIsHydrated] = createSignal(false);
277
+ onMount(() => {
278
+ setIsHydrated(true);
279
+ });
280
+ return isHydrated;
281
+ }
282
+ //#endregion
283
+ export { ClientOnly, DEFAULT_SLOT, Provider, assignRef, composeRenderProps, createDataAttributes, createSlottedContext, dataAttr, filterDOMProps, mergeRefs, removeDataAttributes, useContextProps, useIsHydrated, useRenderProps, useSlot, useSlottedContext };
284
+
285
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["JSX","Accessor","Context","FlowComponent","createComponent","createContext","useContext","createMemo","createSignal","onMount","sharedConfig","untrack","Show","isServer","mergeProps","RenderChildren","Element","renderProps","T","ClassNameOrFunction","StyleOrFunction","CSSProperties","RenderPropsBase","children","class","style","SlotProps","slot","DEFAULT_SLOT","RenderPropsResult","renderChildren","renderChildrenStable","values","useRenderProps","props","defaultClassName","className","computedClass","currentValues","computedStyle","length","snapshot","view","key","Object","keys","Array","defineProperty","enumerable","configurable","get","composeRenderProps","base","override","RefLike","el","current","WithRef","ref","E","SlottedValue","slots","Record","SlottedContextValue","ContextValue","HTMLElement","createSlottedContext","assignRef","mergeRefs","refs","seen","Set","has","add","useSlottedContext","context","ctx","slotName","slotValue","validSlots","map","name","join","Error","useContextProps","TProps","TRef","Partial","contextRef","contextProps","mergedRef","mergedProps","useSlot","initialState","hasSlot","setHasSlot","hasRun","Provider","build","index","value","dataAttr","undefined","createDataAttributes","result","entries","camelToKebab","str","replace","toLowerCase","removeDataAttributes","startsWith","filterDOMProps","options","global","R","globalAttrs","ariaAttrs","dataAttrs","eventHandlers","prototype","hasOwnProperty","call","test","ClientOnlyProps","fallback","ClientOnly","_$memo","isHydrated","setIsHydrated","_$createComponent","when","useIsHydrated"],"sources":["../src/utils.tsx"],"sourcesContent":["/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n type Context,\n type FlowComponent,\n createComponent,\n createContext,\n useContext,\n createMemo,\n createSignal,\n onMount,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { mergeProps } from \"@proyecto-viviana/solidaria\";\n\n/**\n * Render props pattern - children can be a function that receives state\n */\nexport type RenderChildren<T> = JSX.Element | ((renderProps: T) => JSX.Element);\n\n/**\n * Class name can be a string or a function that computes based on state\n */\nexport type ClassNameOrFunction<T> = string | ((renderProps: T) => string);\n\n/**\n * Style can be an object or a function that computes based on state\n */\nexport type StyleOrFunction<T> = JSX.CSSProperties | ((renderProps: T) => JSX.CSSProperties);\n\n/**\n * Common render props interface\n */\nexport interface RenderPropsBase<T> {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<T>;\n /** The CSS className for the element. A function may be provided to compute the class based on state. */\n class?: ClassNameOrFunction<T>;\n /** The inline style for the element. A function may be provided to compute the style based on state. */\n style?: StyleOrFunction<T>;\n}\n\n/**\n * Slot props for named slots\n */\nexport interface SlotProps {\n /** A slot name for the component. */\n slot?: string;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/**\n * Return type for useRenderProps\n */\nexport interface RenderPropsResult<T> {\n /** Accessor for class - safe to call anytime */\n class: Accessor<string>;\n /** Accessor for style - safe to call anytime */\n style: Accessor<JSX.CSSProperties | undefined>;\n /**\n * Render the children. This is a function that returns JSX, NOT a getter.\n * For SSR compatibility, this should be called within the JSX tree.\n *\n * Usage in components:\n * {renderProps.renderChildren()}\n *\n * Or if you need the raw children/function:\n * {renderProps.renderChildren()}\n */\n renderChildren: () => JSX.Element;\n /**\n * Render a render-prop child ONCE over a reactive view of the values,\n * mirroring how React reconciles a render prop's returned tree in place.\n *\n * Prefer this over `renderChildren()` for interactive leaf components (a\n * Tab, a toggle segment) whose child wraps the pressable element: re-invoking\n * the render function on every values() change recreates that DOM subtree,\n * which detaches the pointer/press target mid-gesture and makes the browser\n * suppress the native `click` (createPress then has to synthesize an\n * untrusted fallback click — a visible parity break vs React). Static (non\n * function) children are returned untouched, exactly like `renderChildren`.\n */\n renderChildrenStable: () => JSX.Element;\n /** The raw children prop (function or JSX) - use renderChildren() in most cases */\n children: RenderChildren<T> | undefined;\n /** The render props values accessor */\n values: Accessor<T>;\n}\n\n/**\n * Resolves render props (children, class, style) based on component state.\n *\n * For SSR compatibility, children are NOT evaluated eagerly. Instead:\n * - Use `renderChildren()` to render children with current values\n * - Or access `children` directly if you need the raw prop\n *\n * This avoids the getter pattern that causes SSR hydration mismatches.\n */\nexport function useRenderProps<T extends object>(\n props: RenderPropsBase<T> & { defaultClassName?: string },\n values: Accessor<T>,\n): RenderPropsResult<T> {\n // Don't destructure children — access lazily to avoid eager evaluation\n // that would trigger child component creation before context providers mount.\n const { class: className, style, defaultClassName = \"\" } = props;\n\n // Compute class and style eagerly (they don't depend on context)\n const computedClass = createMemo(() => {\n const currentValues = values();\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName);\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n return typeof style === \"function\" ? style(currentValues) : style;\n });\n\n // Return object with explicit function for rendering children\n // Children are accessed lazily during render (inside context providers)\n return {\n class: computedClass,\n style: computedStyle,\n renderChildren: () => {\n const children = props.children;\n // Only read values() for render-prop children. Static JSX children must\n // not track the render-state memo: re-running the insertion effect\n // recreates real DOM nodes on every hover/press/focus flip (React keeps\n // them stable via vdom diffing), which detaches the pressed node\n // mid-press and suppresses the browser's native click.\n //\n // A render prop takes the values argument, so classify by arity — the\n // same convention `solid-js/h` uses for dynamic props. A zero-arg\n // function child is an accessor (a compiled `{expression}` child, a\n // solid-refresh dev wrapper, a one-shot `solid-js/h` element thunk):\n // return it untouched so the insert machinery unwraps it in its own\n // nested effect. Calling it here would track its reads in the shared\n // insertion effect, and every re-run disposes the child computations\n // that effect owns — a one-shot h thunk then hands back the same\n // disposed node, leaving connected DOM whose reactivity is dead.\n return typeof children === \"function\" && children.length > 0\n ? children(values())\n : (children as JSX.Element);\n },\n renderChildrenStable: () => {\n const children = props.children;\n if (typeof children !== \"function\" || children.length === 0) {\n return children as JSX.Element;\n }\n // Invoke the render function exactly once, over a getter view of the\n // values, so the returned DOM is created a single time and only the\n // reactive reads inside it (JSX bindings, component props) re-run on a\n // values() change — React's reconciliation, not Solid's recreation.\n //\n // `untrack` keeps the enclosing insert from tracking values() (so it\n // never re-runs and never recreates), but does NOT change the owner:\n // this still executes inside the caller's insert scope, so any slotted\n // context the render prop reads binds against the surrounding provider.\n //\n // The value keys are read once here (untracked). Render-state memos in\n // this codebase return a fixed-shape object, so the key set is stable.\n return untrack(() => {\n const snapshot = values();\n const view = {} as T;\n for (const key of Object.keys(snapshot) as Array<keyof T & string>) {\n Object.defineProperty(view, key, {\n enumerable: true,\n configurable: true,\n get: () => values()[key],\n });\n }\n return (children as (renderProps: T) => JSX.Element)(view);\n });\n },\n get children() {\n return props.children;\n },\n values,\n };\n}\n\nexport function composeRenderProps<T extends object>(\n base: RenderPropsBase<T> | undefined,\n override: RenderPropsBase<T> | undefined,\n): RenderPropsBase<T> {\n if (!base) return override ?? {};\n if (!override) return base;\n return {\n children: override.children ?? base.children,\n class: override.class ?? base.class,\n style: override.style ?? base.style,\n };\n}\n\n/** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */\nexport type RefLike<T> = T | ((el: T) => void) | { current?: T | null } | undefined;\n\n/** A value paired with an optional ref to merge onto the consuming element. */\nexport type WithRef<T, E> = T & { ref?: RefLike<E> };\n\n/**\n * A context value carrying named slots (mirrors react-aria-components'\n * `SlottedValue`). Each entry under `slots` is the props object delivered to the\n * component rendered with the matching `slot` name.\n */\nexport interface SlottedValue<T> {\n slots?: Record<string, T>;\n}\n\n/** A slotted context value: a slots record, a bare value, or null/undefined. */\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\n\n/**\n * The value type for a context consumed via {@link useContextProps}. Mirrors\n * upstream `ContextValue<T, E>`: it may carry `slots` and an optional `ref` to\n * merge onto the consuming element.\n */\nexport type ContextValue<T, E = HTMLElement> = SlottedContextValue<WithRef<T, E>>;\n\n/**\n * Creates a context that can carry either a bare value or a `slots` record.\n */\nexport function createSlottedContext<T>() {\n return createContext<SlottedContextValue<T>>(null);\n}\n\n/** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */\nexport function assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n (ref as (el: T) => void)(el);\n } else if (typeof ref === \"object\" && \"current\" in ref) {\n (ref as { current?: T | null }).current = el;\n }\n}\n\n/** Merges multiple Solid refs into one callback that forwards to each, once. */\nexport function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => void {\n return (el: T) => {\n const seen = new Set<RefLike<T>>();\n for (const ref of refs) {\n if (!ref || seen.has(ref)) {\n continue;\n }\n\n seen.add(ref);\n assignRef(ref, el);\n }\n };\n}\n\n/**\n * Resolves a (possibly slotted) context value for the given slot name. Port of\n * react-aria-components' `useSlottedContext`:\n * - `slot === null` opts out of the context entirely (returns `null`);\n * - if the context carries a `slots` record, the entry for `slot` (or\n * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;\n * - otherwise the bare context value is returned.\n */\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null,\n): T | null | undefined {\n const ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means: ignore this context.\n return null;\n }\n\n if (ctx && typeof ctx === \"object\" && \"slots\" in ctx && ctx.slots) {\n const slots = ctx.slots as Record<string, T>;\n const slotName = slot || DEFAULT_SLOT;\n const slotValue = slots[slotName];\n if (!slotValue) {\n const validSlots = Object.keys(slots)\n .map((name) => `\"${name}\"`)\n .join(\", \");\n throw new Error(\n slot\n ? `Invalid slot \"${slot}\". Valid slot names are ${validSlots}.`\n : `A slot prop is required. Valid slot names are ${validSlots}.`,\n );\n }\n return slotValue;\n }\n\n return ctx as T | null | undefined;\n}\n\n/**\n * Merges context-provided props and a context ref into a component's own props\n * and ref. Port of react-aria-components' `useContextProps`:\n * - the context is resolved for `props.slot` via {@link useSlottedContext};\n * - props win over context props (handler props are chained by `mergeProps`);\n * - the component's own ref and the context's ref merge into one callback.\n *\n * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop\n * changes keep flowing; the context value is read once at setup, matching a single\n * upstream render.\n */\nexport function useContextProps<TProps extends SlotProps, TRef>(\n props: TProps,\n ref: RefLike<TRef>,\n context: Context<ContextValue<TProps, TRef>>,\n): [TProps, (el: TRef) => void] {\n const ctx = (useSlottedContext(context, props.slot) ?? {}) as WithRef<Partial<TProps>, TRef>;\n const { ref: contextRef, ...contextProps } = ctx;\n const mergedRef = mergeRefs(ref, contextRef);\n const mergedProps = mergeProps(contextProps as object, props as object) as unknown as TProps;\n return [mergedProps, mergedRef];\n}\n\n/**\n * Detects whether slotted content was rendered into a placeholder, for the\n * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a\n * ref callback to attach to the placeholder and an accessor that is `true` while\n * an element is mounted there. The accessor flips to `false` after mount if the\n * ref never ran (no slotted content was provided).\n */\nexport function useSlot(initialState = true): [(el: Element | null) => void, Accessor<boolean>] {\n const [hasSlot, setHasSlot] = createSignal(initialState);\n let hasRun = false;\n const ref = (el: Element | null) => {\n hasRun = true;\n setHasSlot(!!el);\n };\n onMount(() => {\n if (!hasRun) {\n setHasSlot(false);\n }\n });\n return [ref, hasSlot];\n}\n\n/**\n * Nests a set of context providers around `children`. Port of\n * react-aria-components' `Provider`: each `[Context, value]` pair wraps the\n * previous result, so the LAST pair is the outermost provider — matching upstream's\n * wrap-in-iteration-order.\n *\n * `children` is read through a lazy getter inside the innermost provider so child\n * components are *created* within every provider's owner; Solid binds `useContext`\n * at component-execution time, so eager children would miss these providers.\n */\nexport function Provider(props: {\n values: Array<[Context<unknown>, unknown]>;\n children: JSX.Element;\n}): JSX.Element {\n const build = (index: number): JSX.Element => {\n if (index < 0) {\n return props.children;\n }\n const [context, value] = props.values[index];\n return createComponent(context.Provider, {\n value,\n get children() {\n return build(index - 1);\n },\n });\n };\n return build(props.values.length - 1);\n}\n\n/**\n * Converts boolean state values to data attributes\n */\nexport function dataAttr(value: boolean | undefined): \"\" | undefined {\n return value ? \"\" : undefined;\n}\n\n/**\n * Creates data attributes from render props\n */\nexport function createDataAttributes<T extends Record<string, boolean | string | undefined>>(\n values: T,\n): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (typeof value === \"boolean\") {\n result[`data-${camelToKebab(key)}`] = value ? \"\" : undefined;\n } else if (value !== undefined) {\n result[`data-${camelToKebab(key)}`] = value;\n }\n }\n\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Remove data attributes from props (for internal use)\n */\nexport function removeDataAttributes<T extends Record<string, unknown>>(props: T): T {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (!key.startsWith(\"data-\")) {\n result[key] = value;\n }\n }\n\n return result as T;\n}\n\n/**\n * Filter DOM props - keep only valid DOM attributes.\n *\n * @param props - Component props to filter\n * @param options - Options for filtering (global: include global attrs)\n * @returns Object containing only valid DOM props. Use type parameter R to specify return type.\n */\nexport function filterDOMProps<R extends object = Record<string, unknown>>(\n props: object,\n options: { global?: boolean } = {},\n): R {\n const { global = false } = options;\n const result: Record<string, unknown> = {};\n\n const globalAttrs = new Set([\n \"id\",\n \"class\",\n \"style\",\n \"tabIndex\",\n \"role\",\n \"title\",\n \"lang\",\n \"dir\",\n \"hidden\",\n \"draggable\",\n \"accessKey\",\n \"contentEditable\",\n \"spellcheck\",\n ]);\n\n const ariaAttrs = /^aria-/;\n const dataAttrs = /^data-/;\n const eventHandlers = /^on[A-Z]/;\n\n for (const key in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, key) &&\n ((global && globalAttrs.has(key)) ||\n ariaAttrs.test(key) ||\n dataAttrs.test(key) ||\n eventHandlers.test(key))\n ) {\n result[key] = (props as Record<string, unknown>)[key];\n }\n }\n\n return result as R;\n}\n\nexport interface ClientOnlyProps {\n /** The children to render only on the client */\n children: JSX.Element;\n /** Optional fallback to render during SSR and initial hydration */\n fallback?: JSX.Element;\n}\n\n/**\n * ClientOnly component - renders children only on the client side.\n *\n * During SSR, renders the fallback (or nothing).\n * During hydration, renders the same fallback to match SSR.\n * After hydration completes, switches to render children.\n *\n * This is useful for components that rely on browser APIs or\n * have different server/client output.\n *\n * @example\n * ```tsx\n * <ClientOnly fallback={<div>Loading...</div>}>\n * <Calendar />\n * </ClientOnly>\n * ```\n */\nexport const ClientOnly: FlowComponent<ClientOnlyProps> = (props) => {\n // On server, always render fallback\n if (isServer) {\n return <>{props.fallback}</>;\n }\n\n // Outside a hydration walk there is nothing to defer (see useIsHydrated).\n if (!sharedConfig.context) {\n return <>{props.children}</>;\n }\n\n // Hydrating: render the fallback until the walk completes.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs after hydration is complete\n onMount(() => {\n setIsHydrated(true);\n });\n\n return (\n <Show when={isHydrated()} fallback={props.fallback}>\n {props.children}\n </Show>\n );\n};\n\n/**\n * Returns true only on the client after hydration is complete.\n * Can be used to conditionally render client-only content.\n *\n * @example\n * ```tsx\n * const hydrated = useIsHydrated();\n * return (\n * <Show when={hydrated()} fallback={<Placeholder />}>\n * <ClientOnlyComponent />\n * </Show>\n * );\n * ```\n */\nexport function useIsHydrated(): Accessor<boolean> {\n // On server, always return false\n if (isServer) {\n return () => false;\n }\n\n // Outside a hydration walk (pure CSR, or a remount created after hydration\n // finished) the caller is already \"hydrated\" — report true immediately.\n // Solid sets `sharedConfig.context` only while synchronously walking\n // server-rendered DOM, so this is exactly the window the false→true flip\n // exists for. A fresh per-instance false→true flip on every remount is not\n // just wasted work: ancestor `children()`/`Context.Provider` resolution\n // unwraps and tracks the <Show> accessor this hook gates, so the post-mount\n // flip re-resolves those children, recreates the subtree (with another fresh\n // signal), and loops forever — a stack overflow with no overlay rendered.\n if (!sharedConfig.context) {\n return () => true;\n }\n\n // Hydrating: start false (so the first render matches the server, which\n // emitted nothing for hydrated-gated content) and flip to true after mount.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs in the effect phase — *after* the synchronous hydration pass\n // has finished walking the server DOM — so flipping here renders the gated\n // content as a fresh client-side update (Portal: no getNextElement walk, no\n // mismatch). This mirrors the component gate above and is strictly earlier\n // than a rAF tick.\n onMount(() => {\n setIsHydrated(true);\n });\n\n return isHydrated;\n}\n"],"mappings":"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"}
package/dist/utils.jsx ADDED
@@ -0,0 +1,277 @@
1
+ import { Show, createComponent, createContext, createMemo, createSignal, onMount, sharedConfig, untrack, useContext } from "solid-js";
2
+ import { isServer } from "solid-js/web";
3
+ import { mergeProps as mergeProps$1 } from "@proyecto-viviana/solidaria";
4
+ //#region src/utils.tsx
5
+ /**
6
+ * Utility functions for solidaria-components
7
+ * Port of react-aria-components/src/utils.tsx
8
+ */
9
+ const DEFAULT_SLOT = "default";
10
+ /**
11
+ * Resolves render props (children, class, style) based on component state.
12
+ *
13
+ * For SSR compatibility, children are NOT evaluated eagerly. Instead:
14
+ * - Use `renderChildren()` to render children with current values
15
+ * - Or access `children` directly if you need the raw prop
16
+ *
17
+ * This avoids the getter pattern that causes SSR hydration mismatches.
18
+ */
19
+ function useRenderProps(props, values) {
20
+ const { class: className, style, defaultClassName = "" } = props;
21
+ return {
22
+ class: createMemo(() => {
23
+ const currentValues = values();
24
+ return typeof className === "function" ? className(currentValues) : className ?? defaultClassName;
25
+ }),
26
+ style: createMemo(() => {
27
+ const currentValues = values();
28
+ return typeof style === "function" ? style(currentValues) : style;
29
+ }),
30
+ renderChildren: () => {
31
+ const children = props.children;
32
+ return typeof children === "function" && children.length > 0 ? children(values()) : children;
33
+ },
34
+ renderChildrenStable: () => {
35
+ const children = props.children;
36
+ if (typeof children !== "function" || children.length === 0) return children;
37
+ return untrack(() => {
38
+ const snapshot = values();
39
+ const view = {};
40
+ for (const key of Object.keys(snapshot)) Object.defineProperty(view, key, {
41
+ enumerable: true,
42
+ configurable: true,
43
+ get: () => values()[key]
44
+ });
45
+ return children(view);
46
+ });
47
+ },
48
+ get children() {
49
+ return props.children;
50
+ },
51
+ values
52
+ };
53
+ }
54
+ function composeRenderProps(base, override) {
55
+ if (!base) return override ?? {};
56
+ if (!override) return base;
57
+ return {
58
+ children: override.children ?? base.children,
59
+ class: override.class ?? base.class,
60
+ style: override.style ?? base.style
61
+ };
62
+ }
63
+ /**
64
+ * Creates a context that can carry either a bare value or a `slots` record.
65
+ */
66
+ function createSlottedContext() {
67
+ return createContext(null);
68
+ }
69
+ /** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */
70
+ function assignRef(ref, el) {
71
+ if (!ref) return;
72
+ if (typeof ref === "function") ref(el);
73
+ else if (typeof ref === "object" && "current" in ref) ref.current = el;
74
+ }
75
+ /** Merges multiple Solid refs into one callback that forwards to each, once. */
76
+ function mergeRefs(...refs) {
77
+ return (el) => {
78
+ const seen = /* @__PURE__ */ new Set();
79
+ for (const ref of refs) {
80
+ if (!ref || seen.has(ref)) continue;
81
+ seen.add(ref);
82
+ assignRef(ref, el);
83
+ }
84
+ };
85
+ }
86
+ /**
87
+ * Resolves a (possibly slotted) context value for the given slot name. Port of
88
+ * react-aria-components' `useSlottedContext`:
89
+ * - `slot === null` opts out of the context entirely (returns `null`);
90
+ * - if the context carries a `slots` record, the entry for `slot` (or
91
+ * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;
92
+ * - otherwise the bare context value is returned.
93
+ */
94
+ function useSlottedContext(context, slot) {
95
+ const ctx = useContext(context);
96
+ if (slot === null) return null;
97
+ if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
98
+ const slots = ctx.slots;
99
+ const slotValue = slots[slot || "default"];
100
+ if (!slotValue) {
101
+ const validSlots = Object.keys(slots).map((name) => `"${name}"`).join(", ");
102
+ throw new Error(slot ? `Invalid slot "${slot}". Valid slot names are ${validSlots}.` : `A slot prop is required. Valid slot names are ${validSlots}.`);
103
+ }
104
+ return slotValue;
105
+ }
106
+ return ctx;
107
+ }
108
+ /**
109
+ * Merges context-provided props and a context ref into a component's own props
110
+ * and ref. Port of react-aria-components' `useContextProps`:
111
+ * - the context is resolved for `props.slot` via {@link useSlottedContext};
112
+ * - props win over context props (handler props are chained by `mergeProps`);
113
+ * - the component's own ref and the context's ref merge into one callback.
114
+ *
115
+ * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop
116
+ * changes keep flowing; the context value is read once at setup, matching a single
117
+ * upstream render.
118
+ */
119
+ function useContextProps(props, ref, context) {
120
+ const { ref: contextRef, ...contextProps } = useSlottedContext(context, props.slot) ?? {};
121
+ const mergedRef = mergeRefs(ref, contextRef);
122
+ return [mergeProps$1(contextProps, props), mergedRef];
123
+ }
124
+ /**
125
+ * Detects whether slotted content was rendered into a placeholder, for the
126
+ * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a
127
+ * ref callback to attach to the placeholder and an accessor that is `true` while
128
+ * an element is mounted there. The accessor flips to `false` after mount if the
129
+ * ref never ran (no slotted content was provided).
130
+ */
131
+ function useSlot(initialState = true) {
132
+ const [hasSlot, setHasSlot] = createSignal(initialState);
133
+ let hasRun = false;
134
+ const ref = (el) => {
135
+ hasRun = true;
136
+ setHasSlot(!!el);
137
+ };
138
+ onMount(() => {
139
+ if (!hasRun) setHasSlot(false);
140
+ });
141
+ return [ref, hasSlot];
142
+ }
143
+ /**
144
+ * Nests a set of context providers around `children`. Port of
145
+ * react-aria-components' `Provider`: each `[Context, value]` pair wraps the
146
+ * previous result, so the LAST pair is the outermost provider — matching upstream's
147
+ * wrap-in-iteration-order.
148
+ *
149
+ * `children` is read through a lazy getter inside the innermost provider so child
150
+ * components are *created* within every provider's owner; Solid binds `useContext`
151
+ * at component-execution time, so eager children would miss these providers.
152
+ */
153
+ function Provider(props) {
154
+ const build = (index) => {
155
+ if (index < 0) return props.children;
156
+ const [context, value] = props.values[index];
157
+ return createComponent(context.Provider, {
158
+ value,
159
+ get children() {
160
+ return build(index - 1);
161
+ }
162
+ });
163
+ };
164
+ return build(props.values.length - 1);
165
+ }
166
+ /**
167
+ * Converts boolean state values to data attributes
168
+ */
169
+ function dataAttr(value) {
170
+ return value ? "" : void 0;
171
+ }
172
+ /**
173
+ * Creates data attributes from render props
174
+ */
175
+ function createDataAttributes(values) {
176
+ const result = {};
177
+ for (const [key, value] of Object.entries(values)) if (typeof value === "boolean") result[`data-${camelToKebab(key)}`] = value ? "" : void 0;
178
+ else if (value !== void 0) result[`data-${camelToKebab(key)}`] = value;
179
+ return result;
180
+ }
181
+ function camelToKebab(str) {
182
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
183
+ }
184
+ /**
185
+ * Remove data attributes from props (for internal use)
186
+ */
187
+ function removeDataAttributes(props) {
188
+ const result = {};
189
+ for (const [key, value] of Object.entries(props)) if (!key.startsWith("data-")) result[key] = value;
190
+ return result;
191
+ }
192
+ /**
193
+ * Filter DOM props - keep only valid DOM attributes.
194
+ *
195
+ * @param props - Component props to filter
196
+ * @param options - Options for filtering (global: include global attrs)
197
+ * @returns Object containing only valid DOM props. Use type parameter R to specify return type.
198
+ */
199
+ function filterDOMProps(props, options = {}) {
200
+ const { global = false } = options;
201
+ const result = {};
202
+ const globalAttrs = new Set([
203
+ "id",
204
+ "class",
205
+ "style",
206
+ "tabIndex",
207
+ "role",
208
+ "title",
209
+ "lang",
210
+ "dir",
211
+ "hidden",
212
+ "draggable",
213
+ "accessKey",
214
+ "contentEditable",
215
+ "spellcheck"
216
+ ]);
217
+ const ariaAttrs = /^aria-/;
218
+ const dataAttrs = /^data-/;
219
+ const eventHandlers = /^on[A-Z]/;
220
+ for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || eventHandlers.test(key))) result[key] = props[key];
221
+ return result;
222
+ }
223
+ /**
224
+ * ClientOnly component - renders children only on the client side.
225
+ *
226
+ * During SSR, renders the fallback (or nothing).
227
+ * During hydration, renders the same fallback to match SSR.
228
+ * After hydration completes, switches to render children.
229
+ *
230
+ * This is useful for components that rely on browser APIs or
231
+ * have different server/client output.
232
+ *
233
+ * @example
234
+ * ```tsx
235
+ * <ClientOnly fallback={<div>Loading...</div>}>
236
+ * <Calendar />
237
+ * </ClientOnly>
238
+ * ```
239
+ */
240
+ const ClientOnly = (props) => {
241
+ if (isServer) return <>{props.fallback}</>;
242
+ if (!sharedConfig.context) return <>{props.children}</>;
243
+ const [isHydrated, setIsHydrated] = createSignal(false);
244
+ onMount(() => {
245
+ setIsHydrated(true);
246
+ });
247
+ return <Show when={isHydrated()} fallback={props.fallback}>
248
+ {props.children}
249
+ </Show>;
250
+ };
251
+ /**
252
+ * Returns true only on the client after hydration is complete.
253
+ * Can be used to conditionally render client-only content.
254
+ *
255
+ * @example
256
+ * ```tsx
257
+ * const hydrated = useIsHydrated();
258
+ * return (
259
+ * <Show when={hydrated()} fallback={<Placeholder />}>
260
+ * <ClientOnlyComponent />
261
+ * </Show>
262
+ * );
263
+ * ```
264
+ */
265
+ function useIsHydrated() {
266
+ if (isServer) return () => false;
267
+ if (!sharedConfig.context) return () => true;
268
+ const [isHydrated, setIsHydrated] = createSignal(false);
269
+ onMount(() => {
270
+ setIsHydrated(true);
271
+ });
272
+ return isHydrated;
273
+ }
274
+ //#endregion
275
+ export { ClientOnly, DEFAULT_SLOT, Provider, assignRef, composeRenderProps, createDataAttributes, createSlottedContext, dataAttr, filterDOMProps, mergeRefs, removeDataAttributes, useContextProps, useIsHydrated, useRenderProps, useSlot, useSlottedContext };
276
+
277
+ //# sourceMappingURL=utils.jsx.map