@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.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 (561) hide show
  1. package/LICENSE-APACHE-2.0 +201 -0
  2. package/NOTICE +91 -0
  3. package/README.md +4 -7
  4. package/dist/ActionBar.d.ts +2 -10
  5. package/dist/ActionBar.d.ts.map +1 -1
  6. package/dist/ActionBar.js +95 -59
  7. package/dist/ActionBar.js.map +1 -1
  8. package/dist/ActionBar.jsx +42 -15
  9. package/dist/ActionBar.jsx.map +1 -1
  10. package/dist/ActionGroup.d.ts +1 -12
  11. package/dist/ActionGroup.d.ts.map +1 -1
  12. package/dist/ActionGroup.js +66 -44
  13. package/dist/ActionGroup.js.map +1 -1
  14. package/dist/ActionGroup.jsx +25 -10
  15. package/dist/ActionGroup.jsx.map +1 -1
  16. package/dist/Alert.d.ts +4 -1
  17. package/dist/Alert.d.ts.map +1 -1
  18. package/dist/Alert.js +25 -17
  19. package/dist/Alert.js.map +1 -1
  20. package/dist/Alert.jsx +9 -5
  21. package/dist/Alert.jsx.map +1 -1
  22. package/dist/Autocomplete.d.ts +2 -9
  23. package/dist/Autocomplete.d.ts.map +1 -1
  24. package/dist/Autocomplete.js +18 -5
  25. package/dist/Autocomplete.js.map +1 -1
  26. package/dist/Autocomplete.jsx +20 -7
  27. package/dist/Autocomplete.jsx.map +1 -1
  28. package/dist/Breadcrumbs.d.ts +2 -7
  29. package/dist/Breadcrumbs.d.ts.map +1 -1
  30. package/dist/Breadcrumbs.js +71 -51
  31. package/dist/Breadcrumbs.js.map +1 -1
  32. package/dist/Breadcrumbs.jsx +25 -12
  33. package/dist/Breadcrumbs.jsx.map +1 -1
  34. package/dist/Button.d.ts +1 -7
  35. package/dist/Button.d.ts.map +1 -1
  36. package/dist/Button.js +125 -72
  37. package/dist/Button.js.map +1 -1
  38. package/dist/Button.jsx +105 -43
  39. package/dist/Button.jsx.map +1 -1
  40. package/dist/Calendar.d.ts +1 -7
  41. package/dist/Calendar.d.ts.map +1 -1
  42. package/dist/Calendar.js +297 -221
  43. package/dist/Calendar.js.map +1 -1
  44. package/dist/Calendar.jsx +52 -32
  45. package/dist/Calendar.jsx.map +1 -1
  46. package/dist/CalendarPicker.d.ts +1 -10
  47. package/dist/CalendarPicker.d.ts.map +1 -1
  48. package/dist/CalendarPicker.js +12 -0
  49. package/dist/CalendarPicker.js.map +1 -1
  50. package/dist/CalendarPicker.jsx +12 -0
  51. package/dist/CalendarPicker.jsx.map +1 -1
  52. package/dist/Checkbox.d.ts +2 -7
  53. package/dist/Checkbox.d.ts.map +1 -1
  54. package/dist/Checkbox.js +332 -270
  55. package/dist/Checkbox.js.map +1 -1
  56. package/dist/Checkbox.jsx +70 -77
  57. package/dist/Checkbox.jsx.map +1 -1
  58. package/dist/Collection.d.ts +33 -7
  59. package/dist/Collection.d.ts.map +1 -1
  60. package/dist/Collection.js +128 -74
  61. package/dist/Collection.js.map +1 -1
  62. package/dist/Collection.jsx +46 -7
  63. package/dist/Collection.jsx.map +1 -1
  64. package/dist/Color.d.ts +15 -20
  65. package/dist/Color.d.ts.map +1 -1
  66. package/dist/Color.js +572 -334
  67. package/dist/Color.js.map +1 -1
  68. package/dist/Color.jsx +205 -85
  69. package/dist/Color.jsx.map +1 -1
  70. package/dist/ColorEditor.d.ts +3 -1
  71. package/dist/ColorEditor.d.ts.map +1 -1
  72. package/dist/ColorEditor.js +147 -124
  73. package/dist/ColorEditor.js.map +1 -1
  74. package/dist/ColorEditor.jsx +4 -1
  75. package/dist/ColorEditor.jsx.map +1 -1
  76. package/dist/ComboBox.d.ts +31 -10
  77. package/dist/ComboBox.d.ts.map +1 -1
  78. package/dist/ComboBox.js +539 -274
  79. package/dist/ComboBox.js.map +1 -1
  80. package/dist/ComboBox.jsx +213 -70
  81. package/dist/ComboBox.jsx.map +1 -1
  82. package/dist/ContextualHelpTrigger.d.ts +1 -7
  83. package/dist/ContextualHelpTrigger.d.ts.map +1 -1
  84. package/dist/ContextualHelpTrigger.js +102 -72
  85. package/dist/ContextualHelpTrigger.js.map +1 -1
  86. package/dist/ContextualHelpTrigger.jsx +36 -16
  87. package/dist/ContextualHelpTrigger.jsx.map +1 -1
  88. package/dist/DateField.d.ts +2 -7
  89. package/dist/DateField.d.ts.map +1 -1
  90. package/dist/DateField.js +0 -2
  91. package/dist/DateField.jsx +0 -2
  92. package/dist/DateField2.js +194 -179
  93. package/dist/DateField2.js.map +1 -1
  94. package/dist/DateField2.jsx +58 -55
  95. package/dist/DateField2.jsx.map +1 -1
  96. package/dist/DatePicker.d.ts +7 -7
  97. package/dist/DatePicker.d.ts.map +1 -1
  98. package/dist/DatePicker.js +2 -2
  99. package/dist/DatePicker.jsx +2 -2
  100. package/dist/DatePicker2.js +357 -435
  101. package/dist/DatePicker2.js.map +1 -1
  102. package/dist/DatePicker2.jsx +109 -178
  103. package/dist/DatePicker2.jsx.map +1 -1
  104. package/dist/DateRangePickerContext.d.ts +7 -0
  105. package/dist/DateRangePickerContext.d.ts.map +1 -1
  106. package/dist/Dialog.d.ts +4 -9
  107. package/dist/Dialog.d.ts.map +1 -1
  108. package/dist/Dialog.js +168 -101
  109. package/dist/Dialog.js.map +1 -1
  110. package/dist/Dialog.jsx +75 -27
  111. package/dist/Dialog.jsx.map +1 -1
  112. package/dist/Disclosure.d.ts +1 -9
  113. package/dist/Disclosure.d.ts.map +1 -1
  114. package/dist/Disclosure.js +121 -79
  115. package/dist/Disclosure.js.map +1 -1
  116. package/dist/Disclosure.jsx +32 -19
  117. package/dist/Disclosure.jsx.map +1 -1
  118. package/dist/DragAndDrop.d.ts +9 -6
  119. package/dist/DragAndDrop.d.ts.map +1 -1
  120. package/dist/DragAndDrop.js +37 -22
  121. package/dist/DragAndDrop.js.map +1 -1
  122. package/dist/DragAndDrop.jsx +20 -4
  123. package/dist/DragAndDrop.jsx.map +1 -1
  124. package/dist/DragPreview.d.ts +1 -1
  125. package/dist/DragPreview.d.ts.map +1 -1
  126. package/dist/DropZone.d.ts +1 -7
  127. package/dist/DropZone.d.ts.map +1 -1
  128. package/dist/DropZone.js +74 -40
  129. package/dist/DropZone.js.map +1 -1
  130. package/dist/DropZone.jsx +24 -8
  131. package/dist/DropZone.jsx.map +1 -1
  132. package/dist/ElementTag.d.ts +9 -20
  133. package/dist/ElementTag.d.ts.map +1 -1
  134. package/dist/ElementTag.js +8 -210
  135. package/dist/ElementTag.js.map +1 -1
  136. package/dist/ElementTag.jsx +8 -57
  137. package/dist/ElementTag.jsx.map +1 -1
  138. package/dist/FieldError.d.ts +8 -7
  139. package/dist/FieldError.d.ts.map +1 -1
  140. package/dist/FieldError.js +33 -13
  141. package/dist/FieldError.js.map +1 -1
  142. package/dist/FieldError.jsx +20 -5
  143. package/dist/FieldError.jsx.map +1 -1
  144. package/dist/FileTrigger.d.ts +1 -7
  145. package/dist/FileTrigger.d.ts.map +1 -1
  146. package/dist/FileTrigger.js +30 -12
  147. package/dist/FileTrigger.js.map +1 -1
  148. package/dist/FileTrigger.jsx +15 -2
  149. package/dist/FileTrigger.jsx.map +1 -1
  150. package/dist/Focusable.d.ts +2 -8
  151. package/dist/Focusable.d.ts.map +1 -1
  152. package/dist/Focusable.js +23 -6
  153. package/dist/Focusable.js.map +1 -1
  154. package/dist/Focusable.jsx +22 -5
  155. package/dist/Focusable.jsx.map +1 -1
  156. package/dist/Form.d.ts +9 -8
  157. package/dist/Form.d.ts.map +1 -1
  158. package/dist/Form.js +66 -43
  159. package/dist/Form.js.map +1 -1
  160. package/dist/Form.jsx +36 -16
  161. package/dist/Form.jsx.map +1 -1
  162. package/dist/GridList.d.ts +5 -10
  163. package/dist/GridList.d.ts.map +1 -1
  164. package/dist/GridList.js +372 -243
  165. package/dist/GridList.js.map +1 -1
  166. package/dist/GridList.jsx +177 -99
  167. package/dist/GridList.jsx.map +1 -1
  168. package/dist/HiddenDateInput.d.ts +1 -7
  169. package/dist/HiddenDateInput.d.ts.map +1 -1
  170. package/dist/Icon.d.ts +4 -1
  171. package/dist/Icon.d.ts.map +1 -1
  172. package/dist/Icon.js +41 -37
  173. package/dist/Icon.js.map +1 -1
  174. package/dist/Icon.jsx +7 -3
  175. package/dist/Icon.jsx.map +1 -1
  176. package/dist/Keyboard.d.ts +1 -7
  177. package/dist/Keyboard.d.ts.map +1 -1
  178. package/dist/Keyboard.js +24 -11
  179. package/dist/Keyboard.js.map +1 -1
  180. package/dist/Keyboard.jsx +15 -2
  181. package/dist/Keyboard.jsx.map +1 -1
  182. package/dist/Label.d.ts +20 -0
  183. package/dist/Label.d.ts.map +1 -0
  184. package/dist/Label.js +60 -0
  185. package/dist/Label.js.map +1 -0
  186. package/dist/Label.jsx +47 -0
  187. package/dist/Label.jsx.map +1 -0
  188. package/dist/Landmark.d.ts +4 -1
  189. package/dist/Landmark.d.ts.map +1 -1
  190. package/dist/Landmark.js +10 -4
  191. package/dist/Landmark.js.map +1 -1
  192. package/dist/Landmark.jsx +5 -1
  193. package/dist/Landmark.jsx.map +1 -1
  194. package/dist/Link.d.ts +2 -7
  195. package/dist/Link.d.ts.map +1 -1
  196. package/dist/Link.js +56 -36
  197. package/dist/Link.js.map +1 -1
  198. package/dist/Link.jsx +52 -10
  199. package/dist/Link.jsx.map +1 -1
  200. package/dist/ListBox.d.ts +17 -13
  201. package/dist/ListBox.d.ts.map +1 -1
  202. package/dist/ListBox.js +647 -348
  203. package/dist/ListBox.js.map +1 -1
  204. package/dist/ListBox.jsx +339 -236
  205. package/dist/ListBox.jsx.map +1 -1
  206. package/dist/ListDropTargetDelegate.d.ts +3 -0
  207. package/dist/ListDropTargetDelegate.d.ts.map +1 -1
  208. package/dist/Menu.d.ts +39 -30
  209. package/dist/Menu.d.ts.map +1 -1
  210. package/dist/Menu.js +547 -368
  211. package/dist/Menu.js.map +1 -1
  212. package/dist/Menu.jsx +328 -230
  213. package/dist/Menu.jsx.map +1 -1
  214. package/dist/Meter.d.ts +6 -13
  215. package/dist/Meter.d.ts.map +1 -1
  216. package/dist/Meter.js +55 -18
  217. package/dist/Meter.js.map +1 -1
  218. package/dist/Meter.jsx +33 -8
  219. package/dist/Meter.jsx.map +1 -1
  220. package/dist/Modal.d.ts +1 -7
  221. package/dist/Modal.d.ts.map +1 -1
  222. package/dist/Modal.js +104 -56
  223. package/dist/Modal.js.map +1 -1
  224. package/dist/Modal.jsx +68 -38
  225. package/dist/Modal.jsx.map +1 -1
  226. package/dist/NumberField.d.ts +4 -7
  227. package/dist/NumberField.d.ts.map +1 -1
  228. package/dist/NumberField.js +243 -124
  229. package/dist/NumberField.js.map +1 -1
  230. package/dist/NumberField.jsx +115 -26
  231. package/dist/NumberField.jsx.map +1 -1
  232. package/dist/Popover.d.ts +15 -7
  233. package/dist/Popover.d.ts.map +1 -1
  234. package/dist/Popover.js +370 -181
  235. package/dist/Popover.js.map +1 -1
  236. package/dist/Popover.jsx +215 -82
  237. package/dist/Popover.jsx.map +1 -1
  238. package/dist/Pressable.d.ts +2 -8
  239. package/dist/Pressable.d.ts.map +1 -1
  240. package/dist/Pressable.js +23 -6
  241. package/dist/Pressable.js.map +1 -1
  242. package/dist/Pressable.jsx +22 -5
  243. package/dist/Pressable.jsx.map +1 -1
  244. package/dist/PreviewTrigger.d.ts +24 -0
  245. package/dist/PreviewTrigger.d.ts.map +1 -0
  246. package/dist/PreviewTrigger.js +128 -0
  247. package/dist/PreviewTrigger.js.map +1 -0
  248. package/dist/PreviewTrigger.jsx +117 -0
  249. package/dist/PreviewTrigger.jsx.map +1 -0
  250. package/dist/ProgressBar.d.ts +1 -7
  251. package/dist/ProgressBar.d.ts.map +1 -1
  252. package/dist/ProgressBar.js +34 -14
  253. package/dist/ProgressBar.js.map +1 -1
  254. package/dist/ProgressBar.jsx +17 -3
  255. package/dist/ProgressBar.jsx.map +1 -1
  256. package/dist/RadioGroup.d.ts +2 -7
  257. package/dist/RadioGroup.d.ts.map +1 -1
  258. package/dist/RadioGroup.js +388 -269
  259. package/dist/RadioGroup.js.map +1 -1
  260. package/dist/RadioGroup.jsx +110 -99
  261. package/dist/RadioGroup.jsx.map +1 -1
  262. package/dist/RangeCalendar.d.ts +3 -7
  263. package/dist/RangeCalendar.d.ts.map +1 -1
  264. package/dist/RangeCalendar.js +271 -202
  265. package/dist/RangeCalendar.js.map +1 -1
  266. package/dist/RangeCalendar.jsx +56 -37
  267. package/dist/RangeCalendar.jsx.map +1 -1
  268. package/dist/RouterProvider.d.ts +3 -9
  269. package/dist/RouterProvider.d.ts.map +1 -1
  270. package/dist/RouterProvider.js +15 -14
  271. package/dist/RouterProvider.js.map +1 -1
  272. package/dist/RouterProvider.jsx +14 -13
  273. package/dist/RouterProvider.jsx.map +1 -1
  274. package/dist/SearchField.d.ts +4 -7
  275. package/dist/SearchField.d.ts.map +1 -1
  276. package/dist/SearchField.js +191 -164
  277. package/dist/SearchField.js.map +1 -1
  278. package/dist/SearchField.jsx +69 -62
  279. package/dist/SearchField.jsx.map +1 -1
  280. package/dist/Select.d.ts +5 -10
  281. package/dist/Select.d.ts.map +1 -1
  282. package/dist/Select.js +565 -359
  283. package/dist/Select.js.map +1 -1
  284. package/dist/Select.jsx +281 -161
  285. package/dist/Select.jsx.map +1 -1
  286. package/dist/SelectionIndicator.d.ts +1 -4
  287. package/dist/SelectionIndicator.d.ts.map +1 -1
  288. package/dist/SelectionIndicator.js +29 -13
  289. package/dist/SelectionIndicator.js.map +1 -1
  290. package/dist/SelectionIndicator.jsx +18 -4
  291. package/dist/SelectionIndicator.jsx.map +1 -1
  292. package/dist/Separator.d.ts +1 -7
  293. package/dist/Separator.d.ts.map +1 -1
  294. package/dist/Separator.js +22 -6
  295. package/dist/Separator.js.map +1 -1
  296. package/dist/Separator.jsx +16 -3
  297. package/dist/Separator.jsx.map +1 -1
  298. package/dist/SharedElementTransition.d.ts +1 -10
  299. package/dist/SharedElementTransition.d.ts.map +1 -1
  300. package/dist/SharedElementTransition.js +68 -40
  301. package/dist/SharedElementTransition.js.map +1 -1
  302. package/dist/SharedElementTransition.jsx +49 -25
  303. package/dist/SharedElementTransition.jsx.map +1 -1
  304. package/dist/Slider.d.ts +2 -8
  305. package/dist/Slider.d.ts.map +1 -1
  306. package/dist/Slider.js +155 -97
  307. package/dist/Slider.js.map +1 -1
  308. package/dist/Slider.jsx +25 -12
  309. package/dist/Slider.jsx.map +1 -1
  310. package/dist/StepList.d.ts +1 -7
  311. package/dist/StepList.d.ts.map +1 -1
  312. package/dist/StepList.js +112 -68
  313. package/dist/StepList.js.map +1 -1
  314. package/dist/StepList.jsx +58 -20
  315. package/dist/StepList.jsx.map +1 -1
  316. package/dist/Switch.d.ts +2 -9
  317. package/dist/Switch.d.ts.map +1 -1
  318. package/dist/Switch.js +164 -114
  319. package/dist/Switch.js.map +1 -1
  320. package/dist/Switch.jsx +26 -13
  321. package/dist/Switch.jsx.map +1 -1
  322. package/dist/Table.d.ts +2 -1
  323. package/dist/Table.d.ts.map +1 -1
  324. package/dist/Table.js +689 -592
  325. package/dist/Table.js.map +1 -1
  326. package/dist/Table.jsx +317 -237
  327. package/dist/Table.jsx.map +1 -1
  328. package/dist/Tabs.d.ts +2 -7
  329. package/dist/Tabs.d.ts.map +1 -1
  330. package/dist/Tabs.js +278 -293
  331. package/dist/Tabs.js.map +1 -1
  332. package/dist/Tabs.jsx +68 -66
  333. package/dist/Tabs.jsx.map +1 -1
  334. package/dist/TagGroup.d.ts +4 -11
  335. package/dist/TagGroup.d.ts.map +1 -1
  336. package/dist/TagGroup.js +153 -115
  337. package/dist/TagGroup.js.map +1 -1
  338. package/dist/TagGroup.jsx +37 -24
  339. package/dist/TagGroup.jsx.map +1 -1
  340. package/dist/Text.d.ts +3 -3
  341. package/dist/Text.d.ts.map +1 -1
  342. package/dist/Text.js +24 -7
  343. package/dist/Text.js.map +1 -1
  344. package/dist/Text.jsx +17 -5
  345. package/dist/Text.jsx.map +1 -1
  346. package/dist/TextField.d.ts +3 -16
  347. package/dist/TextField.d.ts.map +1 -1
  348. package/dist/TextField.js +104 -129
  349. package/dist/TextField.js.map +1 -1
  350. package/dist/TextField.jsx +76 -102
  351. package/dist/TextField.jsx.map +1 -1
  352. package/dist/TimeField.d.ts +2 -15
  353. package/dist/TimeField.d.ts.map +1 -1
  354. package/dist/TimeField.js +86 -102
  355. package/dist/TimeField.js.map +1 -1
  356. package/dist/TimeField.jsx +32 -49
  357. package/dist/TimeField.jsx.map +1 -1
  358. package/dist/Toast.d.ts +10 -13
  359. package/dist/Toast.d.ts.map +1 -1
  360. package/dist/Toast.js +209 -108
  361. package/dist/Toast.js.map +1 -1
  362. package/dist/Toast.jsx +127 -22
  363. package/dist/Toast.jsx.map +1 -1
  364. package/dist/ToggleButton.d.ts +1 -7
  365. package/dist/ToggleButton.d.ts.map +1 -1
  366. package/dist/ToggleButton.js +57 -35
  367. package/dist/ToggleButton.js.map +1 -1
  368. package/dist/ToggleButton.jsx +26 -12
  369. package/dist/ToggleButton.jsx.map +1 -1
  370. package/dist/ToggleButtonGroup.d.ts +1 -7
  371. package/dist/ToggleButtonGroup.d.ts.map +1 -1
  372. package/dist/ToggleButtonGroup.js +59 -44
  373. package/dist/ToggleButtonGroup.js.map +1 -1
  374. package/dist/ToggleButtonGroup.jsx +25 -12
  375. package/dist/ToggleButtonGroup.jsx.map +1 -1
  376. package/dist/TokenField.d.ts +52 -0
  377. package/dist/TokenField.d.ts.map +1 -0
  378. package/dist/TokenField.js +301 -0
  379. package/dist/TokenField.js.map +1 -0
  380. package/dist/TokenField.jsx +197 -0
  381. package/dist/TokenField.jsx.map +1 -0
  382. package/dist/Toolbar.d.ts +2 -7
  383. package/dist/Toolbar.d.ts.map +1 -1
  384. package/dist/Toolbar.js +35 -16
  385. package/dist/Toolbar.js.map +1 -1
  386. package/dist/Toolbar.jsx +15 -2
  387. package/dist/Toolbar.jsx.map +1 -1
  388. package/dist/Tooltip.d.ts +2 -7
  389. package/dist/Tooltip.d.ts.map +1 -1
  390. package/dist/Tooltip.js +105 -68
  391. package/dist/Tooltip.js.map +1 -1
  392. package/dist/Tooltip.jsx +60 -36
  393. package/dist/Tooltip.jsx.map +1 -1
  394. package/dist/Tree.d.ts +8 -11
  395. package/dist/Tree.d.ts.map +1 -1
  396. package/dist/Tree.js +486 -339
  397. package/dist/Tree.js.map +1 -1
  398. package/dist/Tree.jsx +155 -107
  399. package/dist/Tree.jsx.map +1 -1
  400. package/dist/Virtualizer.d.ts +39 -9
  401. package/dist/Virtualizer.d.ts.map +1 -1
  402. package/dist/Virtualizer.js +2 -2
  403. package/dist/Virtualizer.jsx +2 -2
  404. package/dist/Virtualizer2.js +491 -136
  405. package/dist/Virtualizer2.js.map +1 -1
  406. package/dist/Virtualizer2.jsx +455 -122
  407. package/dist/Virtualizer2.jsx.map +1 -1
  408. package/dist/VirtualizerLayouts.d.ts +55 -2
  409. package/dist/VirtualizerLayouts.d.ts.map +1 -1
  410. package/dist/VisuallyHidden.d.ts +4 -3
  411. package/dist/VisuallyHidden.d.ts.map +1 -1
  412. package/dist/VisuallyHidden.js +18 -11
  413. package/dist/VisuallyHidden.js.map +1 -1
  414. package/dist/VisuallyHidden.jsx +15 -9
  415. package/dist/VisuallyHidden.jsx.map +1 -1
  416. package/dist/contexts.d.ts +25 -0
  417. package/dist/contexts.d.ts.map +1 -1
  418. package/dist/contexts.js +3 -0
  419. package/dist/contexts.js.map +1 -1
  420. package/dist/contexts.jsx +3 -0
  421. package/dist/contexts.jsx.map +1 -1
  422. package/dist/index.d.ts +11 -9
  423. package/dist/index.d.ts.map +1 -1
  424. package/dist/index.js +14 -11
  425. package/dist/index.jsx +14 -11
  426. package/dist/intl/index.d.ts +16 -0
  427. package/dist/intl/index.d.ts.map +1 -0
  428. package/dist/intl.js +212 -0
  429. package/dist/intl.js.map +1 -0
  430. package/dist/intl.jsx +212 -0
  431. package/dist/intl.jsx.map +1 -0
  432. package/dist/useDragAndDrop.d.ts +4 -2
  433. package/dist/useDragAndDrop.d.ts.map +1 -1
  434. package/dist/useDragAndDrop2.js +39 -21
  435. package/dist/useDragAndDrop2.js.map +1 -1
  436. package/dist/useDragAndDrop2.jsx +39 -21
  437. package/dist/useDragAndDrop2.jsx.map +1 -1
  438. package/dist/utils.d.ts +28 -9
  439. package/dist/utils.d.ts.map +1 -1
  440. package/dist/utils.js +96 -24
  441. package/dist/utils.js.map +1 -1
  442. package/dist/utils.jsx +81 -24
  443. package/dist/utils.jsx.map +1 -1
  444. package/dist/virtualizer/Layout.d.ts +9 -0
  445. package/dist/virtualizer/Layout.d.ts.map +1 -1
  446. package/dist/virtualizer/Layout.js +23 -2
  447. package/dist/virtualizer/Layout.js.map +1 -1
  448. package/dist/virtualizer/Layout.jsx +23 -2
  449. package/dist/virtualizer/Layout.jsx.map +1 -1
  450. package/package.json +29 -10
  451. package/src/ActionBar.tsx +50 -24
  452. package/src/ActionGroup.tsx +31 -19
  453. package/src/Alert.tsx +10 -4
  454. package/src/Autocomplete.tsx +24 -15
  455. package/src/Breadcrumbs.tsx +32 -16
  456. package/src/Button.tsx +182 -67
  457. package/src/Calendar.tsx +65 -47
  458. package/src/CalendarPicker.tsx +16 -1
  459. package/src/Checkbox.tsx +84 -116
  460. package/src/Collection.tsx +84 -3
  461. package/src/Color.tsx +282 -104
  462. package/src/ColorEditor.tsx +5 -1
  463. package/src/ComboBox.tsx +384 -109
  464. package/src/ContextualHelpTrigger.tsx +47 -41
  465. package/src/DateField.tsx +74 -106
  466. package/src/DatePicker.tsx +156 -352
  467. package/src/DateRangePickerContext.tsx +8 -0
  468. package/src/Dialog.tsx +105 -38
  469. package/src/Disclosure.tsx +29 -19
  470. package/src/DragAndDrop.tsx +43 -8
  471. package/src/DragPreview.tsx +20 -1
  472. package/src/DropZone.tsx +32 -18
  473. package/src/ElementTag.tsx +14 -104
  474. package/src/FieldError.tsx +39 -7
  475. package/src/FileTrigger.tsx +18 -3
  476. package/src/Focusable.tsx +27 -6
  477. package/src/Form.tsx +57 -11
  478. package/src/GridList.tsx +233 -141
  479. package/src/HiddenDateInput.tsx +19 -3
  480. package/src/Icon.tsx +8 -2
  481. package/src/Keyboard.tsx +18 -2
  482. package/src/Label.tsx +77 -0
  483. package/src/Landmark.tsx +6 -1
  484. package/src/Link.tsx +65 -19
  485. package/src/ListBox.tsx +645 -468
  486. package/src/ListDropTargetDelegate.ts +4 -0
  487. package/src/Menu.tsx +512 -349
  488. package/src/Meter.tsx +42 -8
  489. package/src/Modal.tsx +85 -42
  490. package/src/NumberField.tsx +161 -48
  491. package/src/Popover.tsx +424 -148
  492. package/src/Pressable.tsx +27 -6
  493. package/src/PreviewTrigger.tsx +171 -0
  494. package/src/ProgressBar.tsx +25 -3
  495. package/src/RadioGroup.tsx +230 -161
  496. package/src/RangeCalendar.tsx +75 -63
  497. package/src/RouterProvider.tsx +24 -14
  498. package/src/SearchField.tsx +118 -121
  499. package/src/Select.tsx +454 -274
  500. package/src/SelectionIndicator.tsx +21 -3
  501. package/src/Separator.tsx +17 -1
  502. package/src/SharedElementTransition.tsx +115 -97
  503. package/src/Slider.tsx +35 -17
  504. package/src/StepList.tsx +71 -32
  505. package/src/Switch.tsx +45 -29
  506. package/src/Table.tsx +446 -380
  507. package/src/Tabs.tsx +132 -155
  508. package/src/TagGroup.tsx +53 -40
  509. package/src/Text.tsx +23 -6
  510. package/src/TextField.tsx +118 -159
  511. package/src/TimeField.tsx +34 -95
  512. package/src/Toast.tsx +141 -67
  513. package/src/ToggleButton.tsx +33 -15
  514. package/src/ToggleButtonGroup.tsx +27 -9
  515. package/src/TokenField.tsx +379 -0
  516. package/src/Toolbar.tsx +19 -9
  517. package/src/Tooltip.tsx +126 -84
  518. package/src/Tree.tsx +233 -173
  519. package/src/Virtualizer.tsx +400 -138
  520. package/src/VirtualizerLayouts.ts +211 -26
  521. package/src/VisuallyHidden.tsx +22 -8
  522. package/src/contexts.ts +13 -0
  523. package/src/index.ts +32 -11
  524. package/src/intl/ar-AE.json +6 -0
  525. package/src/intl/bg-BG.json +6 -0
  526. package/src/intl/cs-CZ.json +6 -0
  527. package/src/intl/da-DK.json +6 -0
  528. package/src/intl/de-DE.json +6 -0
  529. package/src/intl/el-GR.json +6 -0
  530. package/src/intl/en-US.json +6 -0
  531. package/src/intl/es-ES.json +6 -0
  532. package/src/intl/et-EE.json +6 -0
  533. package/src/intl/fi-FI.json +6 -0
  534. package/src/intl/fr-FR.json +6 -0
  535. package/src/intl/he-IL.json +6 -0
  536. package/src/intl/hr-HR.json +6 -0
  537. package/src/intl/hu-HU.json +6 -0
  538. package/src/intl/index.ts +125 -0
  539. package/src/intl/it-IT.json +6 -0
  540. package/src/intl/ja-JP.json +6 -0
  541. package/src/intl/ko-KR.json +6 -0
  542. package/src/intl/lt-LT.json +6 -0
  543. package/src/intl/lv-LV.json +6 -0
  544. package/src/intl/nb-NO.json +6 -0
  545. package/src/intl/nl-NL.json +6 -0
  546. package/src/intl/pl-PL.json +6 -0
  547. package/src/intl/pt-BR.json +6 -0
  548. package/src/intl/pt-PT.json +6 -0
  549. package/src/intl/ro-RO.json +6 -0
  550. package/src/intl/ru-RU.json +6 -0
  551. package/src/intl/sk-SK.json +6 -0
  552. package/src/intl/sl-SI.json +6 -0
  553. package/src/intl/sr-SP.json +6 -0
  554. package/src/intl/sv-SE.json +6 -0
  555. package/src/intl/tr-TR.json +6 -0
  556. package/src/intl/uk-UA.json +6 -0
  557. package/src/intl/zh-CN.json +6 -0
  558. package/src/intl/zh-TW.json +6 -0
  559. package/src/useDragAndDrop.ts +30 -32
  560. package/src/utils.tsx +124 -68
  561. package/src/virtualizer/Layout.ts +29 -0
@@ -1 +1 @@
1
- {"version":3,"file":"utils.jsx","names":["mergeProps"],"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; events?: boolean } = {},\n): R {\n const { global = false, events = true } = 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 (events && 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":";;;;;;;;AA0DA,MAAa,eAAe;;;;;;;;;;AAiD5B,SAAgB,eACd,OACA,QACsB;CAGtB,MAAM,EAAE,OAAO,WAAW,OAAO,mBAAmB,OAAO;CAiB3D,OAAO;EACL,OAfoB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,cAAc,aACxB,UAAU,aAAa,IACtB,aAAa;EACpB,CAUqB;EACnB,OAToB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,UAAU,aAAa,MAAM,aAAa,IAAI;EAC9D,CAMqB;EACnB,sBAAsB;GACpB,MAAM,WAAW,MAAM;GAgBvB,OAAO,OAAO,aAAa,cAAc,SAAS,SAAS,IACvD,SAAS,OAAO,CAAC,IAChB;EACP;EACA,4BAA4B;GAC1B,MAAM,WAAW,MAAM;GACvB,IAAI,OAAO,aAAa,cAAc,SAAS,WAAW,GACxD,OAAO;GAcT,OAAO,cAAc;IACnB,MAAM,WAAW,OAAO;IACxB,MAAM,OAAO,CAAC;IACd,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,OAAO,eAAe,MAAM,KAAK;KAC/B,YAAY;KACZ,cAAc;KACd,WAAW,OAAO,CAAC,CAAC;IACtB,CAAC;IAEH,OAAQ,SAA6C,IAAI;GAC3D,CAAC;EACH;EACA,IAAI,WAAW;GACb,OAAO,MAAM;EACf;EACA;CACF;AACF;AAEA,SAAgB,mBACd,MACA,UACoB;CACpB,IAAI,CAAC,MAAM,OAAO,YAAY,CAAC;CAC/B,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO;EACL,UAA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H,MAAM,EAAE,SAAS,OAAO,SAAS,SAAS;CAC1C,MAAM,SAAkC,CAAC;CAEzC,MAAM,cAAc,IAAI,IAAI;EAC1B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,YAAY;CAClB,MAAM,YAAY;CAClB,MAAM,gBAAgB;CAEtB,KAAK,MAAM,OAAO,OAChB,IACE,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,MAC7C,UAAU,YAAY,IAAI,GAAG,KAC7B,UAAU,KAAK,GAAG,KAClB,UAAU,KAAK,GAAG,KACjB,UAAU,cAAc,KAAK,GAAG,IAEnC,OAAO,OAAQ,MAAkC;CAIrD,OAAO;AACT;;;;;;;;;;;;;;;;;;AA0BA,MAAa,cAA8C,UAAU;CAEnE,IAAI,UACF,OAAO,GAAG,MAAM,SAAS;CAI3B,IAAI,CAAC,aAAa,SAChB,OAAO,GAAG,MAAM,SAAS;CAI3B,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CAGtD,cAAc;EACZ,cAAc,IAAI;CACpB,CAAC;CAED,OACE,CAAC,KAAK,MAAM,WAAW,GAAG,UAAU,MAAM,UAAU;OACjD,MAAM,SAAS;IAClB,EAAE;AAEN;;;;;;;;;;;;;;;AAgBA,SAAgB,gBAAmC;CAEjD,IAAI,UACF,aAAa;CAYf,IAAI,CAAC,aAAa,SAChB,aAAa;CAKf,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CAOtD,cAAc;EACZ,cAAc,IAAI;CACpB,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"utils.jsx","names":[],"sources":["../src/utils.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/utils.tsx\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/utils/useSlot.ts\n\n/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n createComponent,\n createContext,\n createEffect,\n useContext,\n createMemo,\n createSignal,\n onSettled,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport type { Accessor, Context, FlowComponent } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { isServer } from \"@solidjs/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. HTML `slot` may be `false` to omit. */\n slot?: string | JSX.RemoveAttribute;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/** HTML `slot` may be `false`; RAC slots are string names. */\nexport function resolveSlot(slot: SlotProps[\"slot\"]): string {\n return typeof slot === \"string\" && slot.length > 0 ? slot : DEFAULT_SLOT;\n}\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/class/style — those are often getters on the\n // caller’s splitProps view. Reading them in this helper’s body is an\n // untracked read in the calling component.\n const defaultClassName = () => props.defaultClassName ?? \"\";\n\n const computedClass = createMemo(() => {\n const currentValues = values();\n const className = props.class;\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName());\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n const style = props.style;\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 // Like renderChildren, let insertion own zero-argument accessors/thunks.\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\nexport interface OptionContentProps {\n /** `renderChildren` of the option's {@link useRenderProps} result. */\n render: () => JSX.Element;\n /** `labelProps` from `createOption`; spread onto the span that wraps a primitive label. */\n labelProps: JSX.HTMLAttributes<HTMLSpanElement>;\n}\n\n/**\n * Memoizes `props.render()` so classification and insertion share its result,\n * wrapping a primitive (string/number) label in `<span {...labelProps}>` so the\n * option's `aria-labelledby` has a target. Internal to the option components\n * (ListBox, ComboBox, Select); mount it *inside* the option's `TextContext`\n * provider so `<Text>` children resolve their slots.\n *\n * The tracked memo preserves updates while avoiding separate render calls for\n * the primitive check and insertion. Re-evaluation can construct children, so\n * keep this sharing and provider ownership; it is not a universal restriction\n * on getter reads or a promise that the callback runs only once forever.\n */\nexport function OptionContent(props: OptionContentProps): JSX.Element {\n const content = createMemo(() => props.render());\n const isPrimitive = () => {\n const value = content();\n return typeof value === \"string\" || typeof value === \"number\";\n };\n return <>{isPrimitive() ? <span {...props.labelProps}>{content()}</span> : content()}</>;\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 | JSX.RemoveAttribute,\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 onSettled(() => {\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, {\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): \"true\" | undefined {\n return value ? \"true\" : undefined;\n}\n\nexport {\n ariaTrueFalse,\n attrTrue,\n attrString,\n isAriaTrue,\n coerceDomBoolean,\n coerceDomRecord,\n} from \"@proyecto-viviana/solidaria/utils\";\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 ? \"true\" : 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; events?: boolean } = {},\n): R {\n const { global = false, events = true } = 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 (events && eventHandlers.test(key)))\n ) {\n const descriptor = Object.getOwnPropertyDescriptor(props, key);\n if (descriptor && (descriptor.get || descriptor.set)) {\n // React props are plain values, so upstream copies them; Solid keeps the getter.\n const defined: PropertyDescriptor = {\n enumerable: true,\n configurable: true,\n };\n if (descriptor.get) {\n defined.get = () => descriptor.get!.call(props);\n }\n if (descriptor.set) {\n defined.set = (value: unknown) => {\n descriptor.set!.call(props, value);\n };\n }\n Object.defineProperty(result, key, defined);\n } else {\n result[key] = (props as Record<string, unknown>)[key];\n }\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 const isHydrated = useIsHydrated();\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 // CSR and post-hydration remounts are ready immediately. Starting them false\n // would unnecessarily rebuild gated children and can loop through providers.\n const [isHydrated, setIsHydrated] = createSignal(!isServer && !sharedConfig.hydrating);\n\n // Register on both server and client to preserve owner/ID allocation. Solid 2\n // can flush ordinary effects before hydrate returns; a client-source effect\n // waits until its hydration snapshot is released before revealing children.\n createEffect(\n () => true,\n () => {\n setIsHydrated(true);\n },\n { ssrSource: \"client\" },\n );\n\n return isHydrated;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,eAAe;;AAG5B,SAAgB,YAAY,MAAiC;CAC3D,OAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO;AAC9D;;;;;;;;;;AAiDA,SAAgB,eACd,OACA,QACsB;CAItB,MAAM,yBAAyB,MAAM,oBAAoB;CAkBzD,OAAO;EACL,OAjBoB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,MAAM,YAAY,MAAM;GACxB,OAAO,OAAO,cAAc,aACxB,UAAU,aAAa,IACtB,aAAa,iBAAiB;EACrC,CAWqB;EACnB,OAVoB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,MAAM,QAAQ,MAAM;GACpB,OAAO,OAAO,UAAU,aAAa,MAAM,aAAa,IAAI;EAC9D,CAMqB;EACnB,sBAAsB;GACpB,MAAM,WAAW,MAAM;GAgBvB,OAAO,OAAO,aAAa,cAAc,SAAS,SAAS,IACvD,SAAS,OAAO,CAAC,IAChB;EACP;EACA,4BAA4B;GAC1B,MAAM,WAAW,MAAM;GAEvB,IAAI,OAAO,aAAa,cAAc,SAAS,WAAW,GACxD,OAAO;GAcT,OAAO,cAAc;IACnB,MAAM,WAAW,OAAO;IACxB,MAAM,OAAO,CAAC;IACd,KA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AK,KAAK;GAEhD,IAAI,WAAW,KACb,QAAQ,OAAO,UAAmB;IAChC,WAAW,IAAK,KAAK,OAAO,KAAK;GACnC;GAEF,OAAO,eAAe,QAAQ,KAAK,OAAO;EAC5C,OACE,OAAO,OAAQ,MAAkC;CAErD;CAGF,OAAO;AACT;;;;;;;;;;;;;;;;;;AA0BA,MAAa,cAA8C,UAAU;CACnE,MAAM,aAAa,cAAc;CACjC,OACE,CAAC,KAAK,MAAM,WAAW,GAAG,UAAU,MAAM,UAAU;OACjD,MAAM,SAAS;IAClB,EAAE;AAEN;;;;;;;;;;;;;;;AAgBA,SAAgB,gBAAmC;CAGjD,MAAM,CAAC,YAAY,iBAAiB,aAAa,CAAC,YAAY,CAAC,aAAa,SAAS;CAKrF,mBACQ,YACA;EACJ,cAAc,IAAI;CACpB,GACA,EAAE,WAAW,SAAS,CACxB;CAEA,OAAO;AACT"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Virtualizer geometry and layout contracts. Based on:
3
+ * - packages/react-stately/src/virtualizer/Point.ts
4
+ * - packages/react-stately/src/virtualizer/Size.ts
5
+ * - packages/react-stately/src/virtualizer/Rect.ts
6
+ * - packages/react-stately/src/virtualizer/LayoutInfo.ts
7
+ * - packages/react-stately/src/virtualizer/Layout.ts
8
+ * - packages/react-stately/src/virtualizer/types.ts
9
+ */
1
10
  import type { Key } from "@proyecto-viviana/solid-stately";
2
11
  export interface InvalidationContext<O = unknown> {
3
12
  contentChanged?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/virtualizer/Layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,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AAE,UAAU,EAAE,CAAC,GAAG,OAAO;IAIpE,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI;IAE9C,cAAc,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;IAChD,uBAAuB,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI;IAE7D,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IAI5C,cAAc,IAAI,IAAI;CAGvB"}
@@ -1,3 +1,20 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Layout.ts
13
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/LayoutInfo.ts
14
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Point.ts
15
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Rect.ts
16
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Size.ts
17
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/types.ts
1
18
  //#region src/virtualizer/Layout.ts
2
19
  var Point = class Point {
3
20
  x;
@@ -77,13 +94,17 @@ var Rect = class Rect {
77
94
  union(other) {
78
95
  const x = Math.min(this.x, other.x);
79
96
  const y = Math.min(this.y, other.y);
80
- return new Rect(x, y, Math.max(this.maxX, other.maxX) - x, Math.max(this.maxY, other.maxY) - y);
97
+ const width = Math.max(this.maxX, other.maxX) - x;
98
+ const height = Math.max(this.maxY, other.maxY) - y;
99
+ return new Rect(x, y, width, height);
81
100
  }
82
101
  intersection(other) {
83
102
  if (!this.intersects(other)) return new Rect(0, 0, 0, 0);
84
103
  const x = Math.max(this.x, other.x);
85
104
  const y = Math.max(this.y, other.y);
86
- return new Rect(x, y, Math.min(this.maxX, other.maxX) - x, Math.min(this.maxY, other.maxY) - y);
105
+ const width = Math.min(this.maxX, other.maxX) - x;
106
+ const height = Math.min(this.maxY, other.maxY) - y;
107
+ return new Rect(x, y, width, height);
87
108
  }
88
109
  copy() {
89
110
  return new Rect(this.x, this.y, this.width, this.height);
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.js","names":[],"sources":["../../src/virtualizer/Layout.ts"],"sourcesContent":["import type { Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface InvalidationContext<O = unknown> {\n contentChanged?: boolean;\n offsetChanged?: boolean;\n sizeChanged?: boolean;\n itemSizeChanged?: boolean;\n layoutOptionsChanged?: boolean;\n layoutOptions?: O;\n}\n\nexport class Point {\n constructor(\n public x = 0,\n public y = 0,\n ) {}\n copy(): Point {\n return new Point(this.x, this.y);\n }\n equals(point: Point): boolean {\n return this.x === point.x && this.y === point.y;\n }\n isOrigin(): boolean {\n return this.x === 0 && this.y === 0;\n }\n}\n\nexport class Size {\n width: number;\n height: number;\n\n constructor(width = 0, height = 0) {\n this.width = Math.max(0, width);\n this.height = Math.max(0, height);\n }\n\n copy(): Size {\n return new Size(this.width, this.height);\n }\n\n equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n}\n\nexport class Rect {\n constructor(\n public x = 0,\n public y = 0,\n public width = 0,\n public height = 0,\n ) {}\n\n get maxX(): number {\n return this.x + this.width;\n }\n\n get maxY(): number {\n return this.y + this.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n intersects(rect: Rect): boolean {\n return this.x <= rect.maxX && rect.x <= this.maxX && this.y <= rect.maxY && rect.y <= this.maxY;\n }\n\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;\n }\n\n containsPoint(point: Point): boolean {\n return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;\n }\n\n union(other: Rect): Rect {\n const x = Math.min(this.x, other.x);\n const y = Math.min(this.y, other.y);\n const width = Math.max(this.maxX, other.maxX) - x;\n const height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n const x = Math.max(this.x, other.x);\n const y = Math.max(this.y, other.y);\n const width = Math.min(this.maxX, other.maxX) - x;\n const height = Math.min(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n\n equals(rect: Rect): boolean {\n return (\n this.x === rect.x &&\n this.y === rect.y &&\n this.width === rect.width &&\n this.height === rect.height\n );\n }\n}\n\nexport class LayoutInfo {\n parentKey: Key | null = null;\n content: unknown = null;\n estimatedSize = false;\n isSticky = false;\n opacity = 1;\n transform: string | null = null;\n zIndex = 0;\n allowOverflow = false;\n\n constructor(\n public type: string,\n public key: Key,\n public rect: Rect,\n ) {}\n\n copy(): LayoutInfo {\n const copy = new LayoutInfo(this.type, this.key, this.rect.copy());\n copy.parentKey = this.parentKey;\n copy.content = this.content;\n copy.estimatedSize = this.estimatedSize;\n copy.isSticky = this.isSticky;\n copy.opacity = this.opacity;\n copy.transform = this.transform;\n copy.zIndex = this.zIndex;\n copy.allowOverflow = this.allowOverflow;\n return copy;\n }\n}\n\ninterface VirtualizerLike {\n visibleRect: Rect;\n}\n\nexport abstract class Layout<T extends object = object, O = unknown> {\n virtualizer: VirtualizerLike | null = null;\n\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n abstract getLayoutInfo(key: Key): LayoutInfo | null;\n abstract getContentSize(): Size;\n\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n return newRect.width !== oldRect.width || newRect.height !== oldRect.height;\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions !== oldOptions;\n }\n\n update(_context: InvalidationContext<O>): void {}\n\n updateItemSize?(_key: Key, _size: Size): boolean;\n getDropTargetLayoutInfo?(_target: unknown): LayoutInfo | null;\n\n protected getItemRect(key: Key): Rect | null {\n return this.getLayoutInfo(key)?.rect ?? null;\n }\n\n getVisibleRect(): Rect {\n return this.virtualizer?.visibleRect ?? new Rect();\n }\n}\n"],"mappings":";AAWA,IAAa,QAAb,MAAa,MAAM;CAER;CACA;CAFT,YACE,IAAW,GACX,IAAW,GACX;EAFO,KAAA,IAAA;EACA,KAAA,IAAA;CACN;CACH,OAAc;EACZ,OAAO,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC;CACjC;CACA,OAAO,OAAuB;EAC5B,OAAO,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM;CAChD;CACA,WAAoB;EAClB,OAAO,KAAK,MAAM,KAAK,KAAK,MAAM;CACpC;AACF;AAEA,IAAa,OAAb,MAAa,KAAK;CAChB;CACA;CAEA,YAAY,QAAQ,GAAG,SAAS,GAAG;EACjC,KAAK,QAAQ,KAAK,IAAI,GAAG,KAAK;EAC9B,KAAK,SAAS,KAAK,IAAI,GAAG,MAAM;CAClC;CAEA,OAAa;EACX,OAAO,IAAI,KAAK,KAAK,OAAO,KAAK,MAAM;CACzC;CAEA,OAAO,OAAsB;EAC3B,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EACtB,KAAK,SAAS,KAAK;EACnB,KAAK,gBAAgB,KAAK;EAC1B,OAAO;CACT;AACF;AAMA,IAAsB,SAAtB,MAAqE;CACnE,cAAsC;CAMtC,iBAAiB,SAAe,SAAwB;EACtD,OAAO,QAAQ,UAAU,QAAQ,SAAS,QAAQ,WAAW,QAAQ;CACvE;CAEA,8BAA8B,YAAe,YAAwB;EACnE,OAAO,eAAe;CACxB;CAEA,OAAO,UAAwC,CAAC;CAKhD,YAAsB,KAAuB;EAC3C,OAAO,KAAK,cAAc,GAAG,CAAC,EAAE,QAAQ;CAC1C;CAEA,iBAAuB;EACrB,OAAO,KAAK,aAAa,eAAe,IAAI,KAAK;CACnD;AACF"}
1
+ {"version":3,"file":"Layout.js","names":[],"sources":["../../src/virtualizer/Layout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Layout.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/LayoutInfo.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Point.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Rect.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Size.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/types.ts\n\n/**\n * Virtualizer geometry and layout contracts. Based on:\n * - packages/react-stately/src/virtualizer/Point.ts\n * - packages/react-stately/src/virtualizer/Size.ts\n * - packages/react-stately/src/virtualizer/Rect.ts\n * - packages/react-stately/src/virtualizer/LayoutInfo.ts\n * - packages/react-stately/src/virtualizer/Layout.ts\n * - packages/react-stately/src/virtualizer/types.ts\n */\n\nimport type { Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface InvalidationContext<O = unknown> {\n contentChanged?: boolean;\n offsetChanged?: boolean;\n sizeChanged?: boolean;\n itemSizeChanged?: boolean;\n layoutOptionsChanged?: boolean;\n layoutOptions?: O;\n}\n\nexport class Point {\n constructor(\n public x = 0,\n public y = 0,\n ) {}\n copy(): Point {\n return new Point(this.x, this.y);\n }\n equals(point: Point): boolean {\n return this.x === point.x && this.y === point.y;\n }\n isOrigin(): boolean {\n return this.x === 0 && this.y === 0;\n }\n}\n\nexport class Size {\n width: number;\n height: number;\n\n constructor(width = 0, height = 0) {\n this.width = Math.max(0, width);\n this.height = Math.max(0, height);\n }\n\n copy(): Size {\n return new Size(this.width, this.height);\n }\n\n equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n}\n\nexport class Rect {\n constructor(\n public x = 0,\n public y = 0,\n public width = 0,\n public height = 0,\n ) {}\n\n get maxX(): number {\n return this.x + this.width;\n }\n\n get maxY(): number {\n return this.y + this.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n intersects(rect: Rect): boolean {\n return this.x <= rect.maxX && rect.x <= this.maxX && this.y <= rect.maxY && rect.y <= this.maxY;\n }\n\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;\n }\n\n containsPoint(point: Point): boolean {\n return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;\n }\n\n union(other: Rect): Rect {\n const x = Math.min(this.x, other.x);\n const y = Math.min(this.y, other.y);\n const width = Math.max(this.maxX, other.maxX) - x;\n const height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n const x = Math.max(this.x, other.x);\n const y = Math.max(this.y, other.y);\n const width = Math.min(this.maxX, other.maxX) - x;\n const height = Math.min(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n\n equals(rect: Rect): boolean {\n return (\n this.x === rect.x &&\n this.y === rect.y &&\n this.width === rect.width &&\n this.height === rect.height\n );\n }\n}\n\nexport class LayoutInfo {\n parentKey: Key | null = null;\n content: unknown = null;\n estimatedSize = false;\n isSticky = false;\n opacity = 1;\n transform: string | null = null;\n zIndex = 0;\n allowOverflow = false;\n\n constructor(\n public type: string,\n public key: Key,\n public rect: Rect,\n ) {}\n\n copy(): LayoutInfo {\n const copy = new LayoutInfo(this.type, this.key, this.rect.copy());\n copy.parentKey = this.parentKey;\n copy.content = this.content;\n copy.estimatedSize = this.estimatedSize;\n copy.isSticky = this.isSticky;\n copy.opacity = this.opacity;\n copy.transform = this.transform;\n copy.zIndex = this.zIndex;\n copy.allowOverflow = this.allowOverflow;\n return copy;\n }\n}\n\ninterface VirtualizerLike {\n visibleRect: Rect;\n}\n\nexport abstract class Layout<T extends object = object, O = unknown> {\n virtualizer: VirtualizerLike | null = null;\n\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n abstract getLayoutInfo(key: Key): LayoutInfo | null;\n abstract getContentSize(): Size;\n\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n return newRect.width !== oldRect.width || newRect.height !== oldRect.height;\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions !== oldOptions;\n }\n\n update(_context: InvalidationContext<O>): void {}\n\n updateItemSize?(_key: Key, _size: Size): boolean;\n getDropTargetLayoutInfo?(_target: unknown): LayoutInfo | null;\n\n protected getItemRect(key: Key): Rect | null {\n return this.getLayoutInfo(key)?.rect ?? null;\n }\n\n getVisibleRect(): Rect {\n return this.virtualizer?.visibleRect ?? new Rect();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,IAAa,QAAb,MAAa,MAAM;CAER;CACA;CAFT,YACE,IAAW,GACX,IAAW,GACX;EAFO,KAAA,IAAA;EACA,KAAA,IAAA;CACN;CACH,OAAc;EACZ,OAAO,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC;CACjC;CACA,OAAO,OAAuB;EAC5B,OAAO,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM;CAChD;CACA,WAAoB;EAClB,OAAO,KAAK,MAAM,KAAK,KAAK,MAAM;CACpC;AACF;AAEA,IAAa,OAAb,MAAa,KAAK;CAChB;CACA;CAEA,YAAY,QAAQ,GAAG,SAAS,GAAG;EACjC,KAAK,QAAQ,KAAK,IAAI,GAAG,KAAK;EAC9B,KAAK,SAAS,KAAK,IAAI,GAAG,MAAM;CAClC;CAEA,OAAa;EACX,OAAO,IAAI,KAAK,KAAK,OAAO,KAAK,MAAM;CACzC;CAEA,OAAO,OAAsB;EAC3B,OAAO,KAAK,UAAU,MAAM,SAAS,KAAK,WAAW,MAAM;CAC7D;CAEA,IAAI,OAAe;EACjB,OAAO,KAAK,QAAQ,KAAK;CAC3B;AACF;AAEA,IAAa,OAAb,MAAa,KAAK;CAEP;CACA;CACA;CACA;CAJT,YACE,IAAW,GACX,IAAW,GACX,QAAe,GACf,SAAgB,GAChB;EAJO,KAAA,IAAA;EACA,KAAA,IAAA;EACA,KAAA,QAAA;EACA,KAAA,SAAA;CACN;CAEH,IAAI,OAAe;EACjB,OAAO,KAAK,IAAI,KAAK;CACvB;CAEA,IAAI,OAAe;EACjB,OAAO,KAAK,IAAI,KAAK;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,cAAc,GAAG,CAAC,EAAE,QAAQ;CAC1C;CAEA,iBAAuB;EACrB,OAAO,KAAK,aAAa,eAAe,IAAI,KAAK;CACnD;AACF"}
@@ -1,3 +1,20 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Layout.ts
13
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/LayoutInfo.ts
14
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Point.ts
15
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Rect.ts
16
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Size.ts
17
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/types.ts
1
18
  //#region src/virtualizer/Layout.ts
2
19
  var Point = class Point {
3
20
  x;
@@ -77,13 +94,17 @@ var Rect = class Rect {
77
94
  union(other) {
78
95
  const x = Math.min(this.x, other.x);
79
96
  const y = Math.min(this.y, other.y);
80
- return new Rect(x, y, Math.max(this.maxX, other.maxX) - x, Math.max(this.maxY, other.maxY) - y);
97
+ const width = Math.max(this.maxX, other.maxX) - x;
98
+ const height = Math.max(this.maxY, other.maxY) - y;
99
+ return new Rect(x, y, width, height);
81
100
  }
82
101
  intersection(other) {
83
102
  if (!this.intersects(other)) return new Rect(0, 0, 0, 0);
84
103
  const x = Math.max(this.x, other.x);
85
104
  const y = Math.max(this.y, other.y);
86
- return new Rect(x, y, Math.min(this.maxX, other.maxX) - x, Math.min(this.maxY, other.maxY) - y);
105
+ const width = Math.min(this.maxX, other.maxX) - x;
106
+ const height = Math.min(this.maxY, other.maxY) - y;
107
+ return new Rect(x, y, width, height);
87
108
  }
88
109
  copy() {
89
110
  return new Rect(this.x, this.y, this.width, this.height);
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.jsx","names":[],"sources":["../../src/virtualizer/Layout.ts"],"sourcesContent":["import type { Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface InvalidationContext<O = unknown> {\n contentChanged?: boolean;\n offsetChanged?: boolean;\n sizeChanged?: boolean;\n itemSizeChanged?: boolean;\n layoutOptionsChanged?: boolean;\n layoutOptions?: O;\n}\n\nexport class Point {\n constructor(\n public x = 0,\n public y = 0,\n ) {}\n copy(): Point {\n return new Point(this.x, this.y);\n }\n equals(point: Point): boolean {\n return this.x === point.x && this.y === point.y;\n }\n isOrigin(): boolean {\n return this.x === 0 && this.y === 0;\n }\n}\n\nexport class Size {\n width: number;\n height: number;\n\n constructor(width = 0, height = 0) {\n this.width = Math.max(0, width);\n this.height = Math.max(0, height);\n }\n\n copy(): Size {\n return new Size(this.width, this.height);\n }\n\n equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n}\n\nexport class Rect {\n constructor(\n public x = 0,\n public y = 0,\n public width = 0,\n public height = 0,\n ) {}\n\n get maxX(): number {\n return this.x + this.width;\n }\n\n get maxY(): number {\n return this.y + this.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n intersects(rect: Rect): boolean {\n return this.x <= rect.maxX && rect.x <= this.maxX && this.y <= rect.maxY && rect.y <= this.maxY;\n }\n\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;\n }\n\n containsPoint(point: Point): boolean {\n return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;\n }\n\n union(other: Rect): Rect {\n const x = Math.min(this.x, other.x);\n const y = Math.min(this.y, other.y);\n const width = Math.max(this.maxX, other.maxX) - x;\n const height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n const x = Math.max(this.x, other.x);\n const y = Math.max(this.y, other.y);\n const width = Math.min(this.maxX, other.maxX) - x;\n const height = Math.min(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n\n equals(rect: Rect): boolean {\n return (\n this.x === rect.x &&\n this.y === rect.y &&\n this.width === rect.width &&\n this.height === rect.height\n );\n }\n}\n\nexport class LayoutInfo {\n parentKey: Key | null = null;\n content: unknown = null;\n estimatedSize = false;\n isSticky = false;\n opacity = 1;\n transform: string | null = null;\n zIndex = 0;\n allowOverflow = false;\n\n constructor(\n public type: string,\n public key: Key,\n public rect: Rect,\n ) {}\n\n copy(): LayoutInfo {\n const copy = new LayoutInfo(this.type, this.key, this.rect.copy());\n copy.parentKey = this.parentKey;\n copy.content = this.content;\n copy.estimatedSize = this.estimatedSize;\n copy.isSticky = this.isSticky;\n copy.opacity = this.opacity;\n copy.transform = this.transform;\n copy.zIndex = this.zIndex;\n copy.allowOverflow = this.allowOverflow;\n return copy;\n }\n}\n\ninterface VirtualizerLike {\n visibleRect: Rect;\n}\n\nexport abstract class Layout<T extends object = object, O = unknown> {\n virtualizer: VirtualizerLike | null = null;\n\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n abstract getLayoutInfo(key: Key): LayoutInfo | null;\n abstract getContentSize(): Size;\n\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n return newRect.width !== oldRect.width || newRect.height !== oldRect.height;\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions !== oldOptions;\n }\n\n update(_context: InvalidationContext<O>): void {}\n\n updateItemSize?(_key: Key, _size: Size): boolean;\n getDropTargetLayoutInfo?(_target: unknown): LayoutInfo | null;\n\n protected getItemRect(key: Key): Rect | null {\n return this.getLayoutInfo(key)?.rect ?? null;\n }\n\n getVisibleRect(): Rect {\n return this.virtualizer?.visibleRect ?? new Rect();\n }\n}\n"],"mappings":";AAWA,IAAa,QAAb,MAAa,MAAM;CAER;CACA;CAFT,YACE,IAAW,GACX,IAAW,GACX;EAFO,KAAA,IAAA;EACA,KAAA,IAAA;CACN;CACH,OAAc;EACZ,OAAO,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC;CACjC;CACA,OAAO,OAAuB;EAC5B,OAAO,KAAK,MAAM,MAAM,KAAK,KAAK,MAAM,MAAM;CAChD;CACA,WAAoB;EAClB,OAAO,KAAK,MAAM,KAAK,KAAK,MAAM;CACpC;AACF;AAEA,IAAa,OAAb,MAAa,KAAK;CAChB;CACA;CAEA,YAAY,QAAQ,GAAG,SAAS,GAAG;EACjC,KAAK,QAAQ,KAAK,IAAI,GAAG,KAAK;EAC9B,KAAK,SAAS,KAAK,IAAI,GAAG,MAAM;CAClC;CAEA,OAAa;EACX,OAAO,IAAI,KAAK,KAAK,OAAO,KAAK,MAAM;CACzC;CAEA,OAAO,OAAsB;EAC3B,OAAO,KAAK,UAAU,MAAM,SAAS,KAAK,WAAW,MAAM;CAC7D;CAEA,IAAI,OAAe;EACjB,OAAO,KAAK,QAAQ,KAAK;CAC3B;AACF;AAEA,IAAa,OAAb,MAAa,KAAK;CAEP;CACA;CACA;CACA;CAJT,YACE,IAAW,GACX,IAAW,GACX,QAAe,GACf,SAAgB,GAChB;EAJO,KAAA,IAAA;EACA,KAA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Ae;CACxB;CAEA,OAAO,UAAwC,CAAC;CAKhD,YAAsB,KAAuB;EAC3C,OAAO,KAAK,cAAc,GAAG,CAAC,EAAE,QAAQ;CAC1C;CAEA,iBAAuB;EACrB,OAAO,KAAK,aAAa,eAAe,IAAI,KAAK;CACnD;AACF"}
1
+ {"version":3,"file":"Layout.jsx","names":[],"sources":["../../src/virtualizer/Layout.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Layout.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/LayoutInfo.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Point.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Rect.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/Size.ts\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/virtualizer/types.ts\n\n/**\n * Virtualizer geometry and layout contracts. Based on:\n * - packages/react-stately/src/virtualizer/Point.ts\n * - packages/react-stately/src/virtualizer/Size.ts\n * - packages/react-stately/src/virtualizer/Rect.ts\n * - packages/react-stately/src/virtualizer/LayoutInfo.ts\n * - packages/react-stately/src/virtualizer/Layout.ts\n * - packages/react-stately/src/virtualizer/types.ts\n */\n\nimport type { Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface InvalidationContext<O = unknown> {\n contentChanged?: boolean;\n offsetChanged?: boolean;\n sizeChanged?: boolean;\n itemSizeChanged?: boolean;\n layoutOptionsChanged?: boolean;\n layoutOptions?: O;\n}\n\nexport class Point {\n constructor(\n public x = 0,\n public y = 0,\n ) {}\n copy(): Point {\n return new Point(this.x, this.y);\n }\n equals(point: Point): boolean {\n return this.x === point.x && this.y === point.y;\n }\n isOrigin(): boolean {\n return this.x === 0 && this.y === 0;\n }\n}\n\nexport class Size {\n width: number;\n height: number;\n\n constructor(width = 0, height = 0) {\n this.width = Math.max(0, width);\n this.height = Math.max(0, height);\n }\n\n copy(): Size {\n return new Size(this.width, this.height);\n }\n\n equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n}\n\nexport class Rect {\n constructor(\n public x = 0,\n public y = 0,\n public width = 0,\n public height = 0,\n ) {}\n\n get maxX(): number {\n return this.x + this.width;\n }\n\n get maxY(): number {\n return this.y + this.height;\n }\n\n get area(): number {\n return this.width * this.height;\n }\n\n get topLeft(): Point {\n return new Point(this.x, this.y);\n }\n\n get topRight(): Point {\n return new Point(this.maxX, this.y);\n }\n\n get bottomLeft(): Point {\n return new Point(this.x, this.maxY);\n }\n\n get bottomRight(): Point {\n return new Point(this.maxX, this.maxY);\n }\n\n intersects(rect: Rect): boolean {\n return this.x <= rect.maxX && rect.x <= this.maxX && this.y <= rect.maxY && rect.y <= this.maxY;\n }\n\n containsRect(rect: Rect): boolean {\n return this.x <= rect.x && this.y <= rect.y && this.maxX >= rect.maxX && this.maxY >= rect.maxY;\n }\n\n containsPoint(point: Point): boolean {\n return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;\n }\n\n union(other: Rect): Rect {\n const x = Math.min(this.x, other.x);\n const y = Math.min(this.y, other.y);\n const width = Math.max(this.maxX, other.maxX) - x;\n const height = Math.max(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n intersection(other: Rect): Rect {\n if (!this.intersects(other)) {\n return new Rect(0, 0, 0, 0);\n }\n const x = Math.max(this.x, other.x);\n const y = Math.max(this.y, other.y);\n const width = Math.min(this.maxX, other.maxX) - x;\n const height = Math.min(this.maxY, other.maxY) - y;\n return new Rect(x, y, width, height);\n }\n\n copy(): Rect {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n\n equals(rect: Rect): boolean {\n return (\n this.x === rect.x &&\n this.y === rect.y &&\n this.width === rect.width &&\n this.height === rect.height\n );\n }\n}\n\nexport class LayoutInfo {\n parentKey: Key | null = null;\n content: unknown = null;\n estimatedSize = false;\n isSticky = false;\n opacity = 1;\n transform: string | null = null;\n zIndex = 0;\n allowOverflow = false;\n\n constructor(\n public type: string,\n public key: Key,\n public rect: Rect,\n ) {}\n\n copy(): LayoutInfo {\n const copy = new LayoutInfo(this.type, this.key, this.rect.copy());\n copy.parentKey = this.parentKey;\n copy.content = this.content;\n copy.estimatedSize = this.estimatedSize;\n copy.isSticky = this.isSticky;\n copy.opacity = this.opacity;\n copy.transform = this.transform;\n copy.zIndex = this.zIndex;\n copy.allowOverflow = this.allowOverflow;\n return copy;\n }\n}\n\ninterface VirtualizerLike {\n visibleRect: Rect;\n}\n\nexport abstract class Layout<T extends object = object, O = unknown> {\n virtualizer: VirtualizerLike | null = null;\n\n abstract getVisibleLayoutInfos(rect: Rect): LayoutInfo[];\n abstract getLayoutInfo(key: Key): LayoutInfo | null;\n abstract getContentSize(): Size;\n\n shouldInvalidate(newRect: Rect, oldRect: Rect): boolean {\n return newRect.width !== oldRect.width || newRect.height !== oldRect.height;\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions !== oldOptions;\n }\n\n update(_context: InvalidationContext<O>): void {}\n\n updateItemSize?(_key: Key, _size: Size): boolean;\n getDropTargetLayoutInfo?(_target: unknown): LayoutInfo | null;\n\n protected getItemRect(key: Key): Rect | null {\n return this.getLayoutInfo(key)?.rect ?? null;\n }\n\n getVisibleRect(): Rect {\n return this.virtualizer?.visibleRect ?? new Rect();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;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,KAAK,GAAG,KAAK,GAAG,KAAK,OAAO,KAAK,MAAM;CACzD;CAEA,OAAO,MAAqB;EAC1B,OACE,KAAK,MAAM,KAAK,KAChB,KAAK,MAAM,KAAK,KAChB,KAAK,UAAU,KAAK,SACpB,KAAK,WAAW,KAAK;CAEzB;AACF;AAEA,IAAa,aAAb,MAAa,WAAW;CAWb;CACA;CACA;CAZT,YAAwB;CACxB,UAAmB;CACnB,gBAAgB;CAChB,WAAW;CACX,UAAU;CACV,YAA2B;CAC3B,SAAS;CACT,gBAAgB;CAEhB,YACE,MACA,KACA,MACA;EAHO,KAAA,OAAA;EACA,KAAA,MAAA;EACA,KAAA,OAAA;CACN;CAEH,OAAmB;EACjB,MAAM,OAAO,IAAI,WAAW,KAAK,MAAM,KAAK,KAAK,KAAK,KAAK,KAAK,CAAC;EACjE,KAAK,YAAY,KAAK;EACtB,KAAK,UAAU,KAAK;EACpB,KAAK,gBAAgB,KAAK;EAC1B,KAAK,WAAW,KAAK;EACrB,KAAK,UAAU,KAAK;EACpB,KAAK,YAAY,KAAK;EACtB,KAAK,SAAS,KAAK;EACnB,KAAK,gBAAgB,KAAK;EAC1B,OAAO;CACT;AACF;AAMA,IAAsB,SAAtB,MAAqE;CACnE,cAAsC;CAMtC,iBAAiB,SAAe,SAAwB;EACtD,OAAO,QAAQ,UAAU,QAAQ,SAAS,QAAQ,WAAW,QAAQ;CACvE;CAEA,8BAA8B,YAAe,YAAwB;EACnE,OAAO,eAAe;CACxB;CAEA,OAAO,UAAwC,CAAC;CAKhD,YAAsB,KAAuB;EAC3C,OAAO,KAAK,cAAc,GAAG,CAAC,EAAE,QAAQ;CAC1C;CAEA,iBAAuB;EACrB,OAAO,KAAK,aAAa,eAAe,IAAI,KAAK;CACnD;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proyecto-viviana/solidaria-components",
3
- "version": "0.5.0",
3
+ "version": "0.7.0-rc.0",
4
4
  "description": "Pre-wired headless components for SolidJS - port of react-aria-components",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -10,7 +10,9 @@
10
10
  "solid",
11
11
  "solidjs"
12
12
  ],
13
- "license": "MIT",
13
+ "homepage": "https://ui.proyectoviviana.org/solid-spectrum/ecosystem",
14
+ "bugs": "https://github.com/proyecto-viviana/ui/issues",
15
+ "license": "MIT AND Apache-2.0",
14
16
  "repository": {
15
17
  "type": "git",
16
18
  "url": "git+https://github.com/proyecto-viviana/ui.git",
@@ -18,7 +20,10 @@
18
20
  },
19
21
  "files": [
20
22
  "dist",
21
- "src"
23
+ "src",
24
+ "LICENSE",
25
+ "LICENSE-APACHE-2.0",
26
+ "NOTICE"
22
27
  ],
23
28
  "type": "module",
24
29
  "sideEffects": false,
@@ -242,6 +247,12 @@
242
247
  "import": "./dist/Popover.js",
243
248
  "default": "./dist/Popover.js"
244
249
  },
250
+ "./PreviewTrigger": {
251
+ "types": "./dist/PreviewTrigger.d.ts",
252
+ "solid": "./dist/PreviewTrigger.jsx",
253
+ "import": "./dist/PreviewTrigger.js",
254
+ "default": "./dist/PreviewTrigger.js"
255
+ },
245
256
  "./Pressable": {
246
257
  "types": "./dist/Pressable.d.ts",
247
258
  "solid": "./dist/Pressable.jsx",
@@ -374,6 +385,12 @@
374
385
  "import": "./dist/ToggleButtonGroup.js",
375
386
  "default": "./dist/ToggleButtonGroup.js"
376
387
  },
388
+ "./TokenField": {
389
+ "types": "./dist/TokenField.d.ts",
390
+ "solid": "./dist/TokenField.jsx",
391
+ "import": "./dist/TokenField.js",
392
+ "default": "./dist/TokenField.js"
393
+ },
377
394
  "./Toolbar": {
378
395
  "types": "./dist/Toolbar.d.ts",
379
396
  "solid": "./dist/Toolbar.jsx",
@@ -428,18 +445,20 @@
428
445
  "access": "public"
429
446
  },
430
447
  "dependencies": {
431
- "@internationalized/date": "^3.8.0",
432
- "@proyecto-viviana/solid-stately": "0.5.0",
433
- "@proyecto-viviana/solidaria": "0.4.2"
448
+ "@internationalized/date": "^3.12.3",
449
+ "@proyecto-viviana/solid-stately": "0.6.0-rc.0",
450
+ "@proyecto-viviana/solidaria": "0.6.0-rc.0"
434
451
  },
435
452
  "devDependencies": {
436
- "solid-js": "^1.9.11"
453
+ "@solidjs/web": "2.0.0-rc.9",
454
+ "solid-js": "2.0.0-rc.9"
437
455
  },
438
456
  "peerDependencies": {
439
- "solid-js": "^1.9.0"
457
+ "@solidjs/web": ">=2.0.0-rc.9 <3",
458
+ "solid-js": ">=2.0.0-rc.9 <3"
440
459
  },
441
460
  "scripts": {
442
- "build": "rm -rf dist && tsdown && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
443
- "dev": "tsup --watch"
461
+ "build": "rm -rf dist && vp pack && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && node ../../scripts/write-package-declaration-attribution.mjs .",
462
+ "dev": "vp pack --watch"
444
463
  }
445
464
  }
package/src/ActionBar.tsx CHANGED
@@ -1,31 +1,56 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ /*
14
+ * Copyright 2024 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */
24
+
25
+ // Ported to SolidJS for Proyecto Viviana; based on packages/@adobe/react-spectrum/src/actionbar/ActionBarContainer.tsx
26
+ // Ported to SolidJS for Proyecto Viviana; based on packages/@react-spectrum/s2/src/ActionBar.tsx
27
+
1
28
  /**
2
29
  * ActionBar component for solidaria-components
3
30
  *
4
31
  * Headless action bar that appears when items are selected in a collection.
5
32
  * Shows a selection count, clear button, and action buttons.
6
33
  *
7
- * No RAC headless equivalent — this is a thin component layer that ties
8
- * selection state to visibility and keyboard behavior.
34
+ * Based on packages/@react-spectrum/s2/src/ActionBar.tsx and
35
+ * https://github.com/adobe/react-spectrum/blob/5ecb3333001313e83898cd07644227897e3bae1f/packages/@adobe/react-spectrum/src/actionbar/ActionBarContainer.tsx.
36
+ * The Solid port keeps the S2 action-bar structure and the Spectrum
37
+ * ActionBarContainer ownership model. It exposes the selection count and clear
38
+ * action as separate headless primitives.
9
39
  */
10
40
 
11
- import {
12
- type JSX,
13
- type ParentProps,
14
- Show,
15
- createContext,
16
- createMemo,
17
- createEffect,
18
- splitProps,
19
- useContext,
20
- } from "solid-js";
41
+ import { Show, createContext, createMemo, createEffect, useContext } from "solid-js";
42
+ import type { ParentProps } from "solid-js";
43
+ import type { JSX } from "@solidjs/web";
21
44
  import { announce } from "@proyecto-viviana/solidaria";
22
45
  import type { Key } from "@proyecto-viviana/solid-stately";
46
+ import { splitProps } from "@proyecto-viviana/solidaria/utils";
23
47
  import {
24
48
  type ClassNameOrFunction,
25
49
  type StyleOrFunction,
26
50
  type SlotProps,
27
51
  useRenderProps,
28
52
  filterDOMProps,
53
+ dataAttr,
29
54
  } from "./utils";
30
55
 
31
56
  type RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;
@@ -102,7 +127,9 @@ export function ActionBar(props: ActionBarProps): JSX.Element {
102
127
  "ref",
103
128
  ]);
104
129
 
105
- const selectedItemCount = () => local.selectedItemCount ?? 0;
130
+ // Hoist the JSX getter: `selectedItemCount={count()}` compiles as a memo
131
+ // created on first read, and createTrackedEffect forbids primitives.
132
+ const selectedItemCount = createMemo(() => local.selectedItemCount ?? 0);
106
133
  const isOpen = () => selectedItemCount() !== 0;
107
134
 
108
135
  // Faithful to S2 `ActionBar` (ActionBar.tsx:192): the ROOT is a PLAIN
@@ -115,16 +142,15 @@ export function ActionBar(props: ActionBarProps): JSX.Element {
115
142
  // toolbar props — `aria-label`/`aria-labelledby` are consumed by the inner
116
143
  // ActionButtonGroup at the styled layer.
117
144
  let wasOpen = false;
118
- createEffect(() => {
119
- const open = isOpen();
120
- if (open && !wasOpen) {
121
- const message = local.actionsAvailableMessage ?? "Actions available.";
122
- if (message) {
145
+ createEffect(
146
+ () => ({ open: isOpen(), message: local.actionsAvailableMessage }),
147
+ ({ open, message }) => {
148
+ if (open && !wasOpen && message) {
123
149
  announce(message);
124
150
  }
125
- }
126
- wasOpen = open;
127
- });
151
+ wasOpen = open;
152
+ },
153
+ );
128
154
 
129
155
  const handleKeyDown: JSX.EventHandlerUnion<HTMLDivElement, KeyboardEvent> = (e) => {
130
156
  const onKeyDown = local.onKeyDown as
@@ -167,19 +193,19 @@ export function ActionBar(props: ActionBarProps): JSX.Element {
167
193
 
168
194
  return (
169
195
  <Show when={isOpen()}>
170
- <ActionBarContext.Provider value={contextValue()}>
196
+ <ActionBarContext value={contextValue()}>
171
197
  <div
172
198
  {...filteredDOMProps()}
173
199
  class={renderProps.class()}
174
200
  style={renderProps.style()}
175
201
  slot={local.slot}
176
- data-open={isOpen() || undefined}
202
+ data-open={dataAttr(isOpen())}
177
203
  onKeyDown={handleKeyDown}
178
204
  ref={(el) => assignRef(local.ref, el)}
179
205
  >
180
206
  {local.children}
181
207
  </div>
182
- </ActionBarContext.Provider>
208
+ </ActionBarContext>
183
209
  </Show>
184
210
  );
185
211
  }