@proyecto-viviana/solidaria 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (566) hide show
  1. package/dist/_chunk/actiongroup.js +207 -0
  2. package/dist/_chunk/actiongroup.js.map +1 -0
  3. package/dist/_chunk/actiongroup.jsx +207 -0
  4. package/dist/_chunk/actiongroup.jsx.map +1 -0
  5. package/dist/_chunk/ariaHideOutside.js +122 -0
  6. package/dist/_chunk/ariaHideOutside.js.map +1 -0
  7. package/dist/_chunk/ariaHideOutside.jsx +122 -0
  8. package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
  9. package/dist/_chunk/autocomplete.js +196 -0
  10. package/dist/_chunk/autocomplete.js.map +1 -0
  11. package/dist/_chunk/autocomplete.jsx +196 -0
  12. package/dist/_chunk/autocomplete.jsx.map +1 -0
  13. package/dist/_chunk/breadcrumbs.js +119 -0
  14. package/dist/_chunk/breadcrumbs.js.map +1 -0
  15. package/dist/_chunk/breadcrumbs.jsx +119 -0
  16. package/dist/_chunk/breadcrumbs.jsx.map +1 -0
  17. package/dist/_chunk/button.js +276 -0
  18. package/dist/_chunk/button.js.map +1 -0
  19. package/dist/_chunk/button.jsx +276 -0
  20. package/dist/_chunk/button.jsx.map +1 -0
  21. package/dist/_chunk/calendar.js +1036 -0
  22. package/dist/_chunk/calendar.js.map +1 -0
  23. package/dist/_chunk/calendar.jsx +1036 -0
  24. package/dist/_chunk/calendar.jsx.map +1 -0
  25. package/dist/_chunk/checkbox.js +234 -0
  26. package/dist/_chunk/checkbox.js.map +1 -0
  27. package/dist/_chunk/checkbox.jsx +234 -0
  28. package/dist/_chunk/checkbox.jsx.map +1 -0
  29. package/dist/_chunk/color.js +1174 -0
  30. package/dist/_chunk/color.js.map +1 -0
  31. package/dist/_chunk/color.jsx +1174 -0
  32. package/dist/_chunk/color.jsx.map +1 -0
  33. package/dist/_chunk/combobox.js +436 -0
  34. package/dist/_chunk/combobox.js.map +1 -0
  35. package/dist/_chunk/combobox.jsx +436 -0
  36. package/dist/_chunk/combobox.jsx.map +1 -0
  37. package/dist/_chunk/createCollator.js +229 -0
  38. package/dist/_chunk/createCollator.js.map +1 -0
  39. package/dist/_chunk/createCollator.jsx +223 -0
  40. package/dist/_chunk/createCollator.jsx.map +1 -0
  41. package/dist/_chunk/createCollectionRowInteraction.js +133 -0
  42. package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
  43. package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
  44. package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
  45. package/dist/_chunk/createField.js +54 -0
  46. package/dist/_chunk/createField.js.map +1 -0
  47. package/dist/_chunk/createField.jsx +54 -0
  48. package/dist/_chunk/createField.jsx.map +1 -0
  49. package/dist/_chunk/createFocus.js +101 -0
  50. package/dist/_chunk/createFocus.js.map +1 -0
  51. package/dist/_chunk/createFocus.jsx +101 -0
  52. package/dist/_chunk/createFocus.jsx.map +1 -0
  53. package/dist/_chunk/createFocusRing.js +54 -0
  54. package/dist/_chunk/createFocusRing.js.map +1 -0
  55. package/dist/_chunk/createFocusRing.jsx +54 -0
  56. package/dist/_chunk/createFocusRing.jsx.map +1 -0
  57. package/dist/_chunk/createFocusWithin.js +121 -0
  58. package/dist/_chunk/createFocusWithin.js.map +1 -0
  59. package/dist/_chunk/createFocusWithin.jsx +121 -0
  60. package/dist/_chunk/createFocusWithin.jsx.map +1 -0
  61. package/dist/_chunk/createFocusable.js +131 -0
  62. package/dist/_chunk/createFocusable.js.map +1 -0
  63. package/dist/_chunk/createFocusable.jsx +131 -0
  64. package/dist/_chunk/createFocusable.jsx.map +1 -0
  65. package/dist/_chunk/createFormValidation.js +135 -0
  66. package/dist/_chunk/createFormValidation.js.map +1 -0
  67. package/dist/_chunk/createFormValidation.jsx +135 -0
  68. package/dist/_chunk/createFormValidation.jsx.map +1 -0
  69. package/dist/_chunk/createHover.js +130 -0
  70. package/dist/_chunk/createHover.js.map +1 -0
  71. package/dist/_chunk/createHover.jsx +130 -0
  72. package/dist/_chunk/createHover.jsx.map +1 -0
  73. package/dist/_chunk/createInteractionModality.js +269 -0
  74. package/dist/_chunk/createInteractionModality.js.map +1 -0
  75. package/dist/_chunk/createInteractionModality.jsx +269 -0
  76. package/dist/_chunk/createInteractionModality.jsx.map +1 -0
  77. package/dist/_chunk/createLabel.js +46 -0
  78. package/dist/_chunk/createLabel.js.map +1 -0
  79. package/dist/_chunk/createLabel.jsx +46 -0
  80. package/dist/_chunk/createLabel.jsx.map +1 -0
  81. package/dist/_chunk/createLabels.js +31 -0
  82. package/dist/_chunk/createLabels.js.map +1 -0
  83. package/dist/_chunk/createLabels.jsx +31 -0
  84. package/dist/_chunk/createLabels.jsx.map +1 -0
  85. package/dist/_chunk/createLandmark.js +198 -0
  86. package/dist/_chunk/createLandmark.js.map +1 -0
  87. package/dist/_chunk/createLandmark.jsx +198 -0
  88. package/dist/_chunk/createLandmark.jsx.map +1 -0
  89. package/dist/_chunk/createLongPress.js +91 -0
  90. package/dist/_chunk/createLongPress.js.map +1 -0
  91. package/dist/_chunk/createLongPress.jsx +91 -0
  92. package/dist/_chunk/createLongPress.jsx.map +1 -0
  93. package/dist/_chunk/createOverlay.js +327 -0
  94. package/dist/_chunk/createOverlay.js.map +1 -0
  95. package/dist/_chunk/createOverlay.jsx +327 -0
  96. package/dist/_chunk/createOverlay.jsx.map +1 -0
  97. package/dist/_chunk/createPress.js +526 -0
  98. package/dist/_chunk/createPress.js.map +1 -0
  99. package/dist/_chunk/createPress.jsx +526 -0
  100. package/dist/_chunk/createPress.jsx.map +1 -0
  101. package/dist/_chunk/createProgressBar.js +81 -0
  102. package/dist/_chunk/createProgressBar.js.map +1 -0
  103. package/dist/_chunk/createProgressBar.jsx +81 -0
  104. package/dist/_chunk/createProgressBar.jsx.map +1 -0
  105. package/dist/_chunk/createSelectableItem.js +298 -0
  106. package/dist/_chunk/createSelectableItem.js.map +1 -0
  107. package/dist/_chunk/createSelectableItem.jsx +298 -0
  108. package/dist/_chunk/createSelectableItem.jsx.map +1 -0
  109. package/dist/_chunk/createToggle.js +158 -0
  110. package/dist/_chunk/createToggle.js.map +1 -0
  111. package/dist/_chunk/createToggle.jsx +158 -0
  112. package/dist/_chunk/createToggle.jsx.map +1 -0
  113. package/dist/_chunk/createTypeSelect.js +125 -0
  114. package/dist/_chunk/createTypeSelect.js.map +1 -0
  115. package/dist/_chunk/createTypeSelect.jsx +125 -0
  116. package/dist/_chunk/createTypeSelect.jsx.map +1 -0
  117. package/dist/_chunk/datepicker.js +1393 -0
  118. package/dist/_chunk/datepicker.js.map +1 -0
  119. package/dist/_chunk/datepicker.jsx +1393 -0
  120. package/dist/_chunk/datepicker.jsx.map +1 -0
  121. package/dist/_chunk/dialog.js +62 -0
  122. package/dist/_chunk/dialog.js.map +1 -0
  123. package/dist/_chunk/dialog.jsx +62 -0
  124. package/dist/_chunk/dialog.jsx.map +1 -0
  125. package/dist/_chunk/disclosure.js +185 -0
  126. package/dist/_chunk/disclosure.js.map +1 -0
  127. package/dist/_chunk/disclosure.jsx +185 -0
  128. package/dist/_chunk/disclosure.jsx.map +1 -0
  129. package/dist/_chunk/dnd.js +1304 -0
  130. package/dist/_chunk/dnd.js.map +1 -0
  131. package/dist/_chunk/dnd.jsx +1304 -0
  132. package/dist/_chunk/dnd.jsx.map +1 -0
  133. package/dist/_chunk/env.js +105 -0
  134. package/dist/_chunk/env.js.map +1 -0
  135. package/dist/_chunk/env.jsx +105 -0
  136. package/dist/_chunk/env.jsx.map +1 -0
  137. package/dist/_chunk/filterDOMProps.js +82 -0
  138. package/dist/_chunk/filterDOMProps.js.map +1 -0
  139. package/dist/_chunk/filterDOMProps.jsx +82 -0
  140. package/dist/_chunk/filterDOMProps.jsx.map +1 -0
  141. package/dist/_chunk/focus.js +399 -0
  142. package/dist/_chunk/focus.js.map +1 -0
  143. package/dist/_chunk/focus.jsx +399 -0
  144. package/dist/_chunk/focus.jsx.map +1 -0
  145. package/dist/_chunk/focus2.js +895 -0
  146. package/dist/_chunk/focus2.js.map +1 -0
  147. package/dist/_chunk/focus2.jsx +870 -0
  148. package/dist/_chunk/focus2.jsx.map +1 -0
  149. package/dist/_chunk/form.js +39 -0
  150. package/dist/_chunk/form.js.map +1 -0
  151. package/dist/_chunk/form.jsx +39 -0
  152. package/dist/_chunk/form.jsx.map +1 -0
  153. package/dist/_chunk/grid.js +623 -0
  154. package/dist/_chunk/grid.js.map +1 -0
  155. package/dist/_chunk/grid.jsx +623 -0
  156. package/dist/_chunk/grid.jsx.map +1 -0
  157. package/dist/_chunk/gridlist.js +364 -0
  158. package/dist/_chunk/gridlist.js.map +1 -0
  159. package/dist/_chunk/gridlist.jsx +364 -0
  160. package/dist/_chunk/gridlist.jsx.map +1 -0
  161. package/dist/_chunk/i18n.js +254 -0
  162. package/dist/_chunk/i18n.js.map +1 -0
  163. package/dist/_chunk/i18n.jsx +254 -0
  164. package/dist/_chunk/i18n.jsx.map +1 -0
  165. package/dist/_chunk/interactions.js +241 -0
  166. package/dist/_chunk/interactions.js.map +1 -0
  167. package/dist/_chunk/interactions.jsx +237 -0
  168. package/dist/_chunk/interactions.jsx.map +1 -0
  169. package/dist/_chunk/link.js +96 -0
  170. package/dist/_chunk/link.js.map +1 -0
  171. package/dist/_chunk/link.jsx +96 -0
  172. package/dist/_chunk/link.jsx.map +1 -0
  173. package/dist/_chunk/listbox.js +324 -0
  174. package/dist/_chunk/listbox.js.map +1 -0
  175. package/dist/_chunk/listbox.jsx +324 -0
  176. package/dist/_chunk/listbox.jsx.map +1 -0
  177. package/dist/_chunk/live-announcer.js +207 -0
  178. package/dist/_chunk/live-announcer.js.map +1 -0
  179. package/dist/_chunk/live-announcer.jsx +207 -0
  180. package/dist/_chunk/live-announcer.jsx.map +1 -0
  181. package/dist/_chunk/menu.js +518 -0
  182. package/dist/_chunk/menu.js.map +1 -0
  183. package/dist/_chunk/menu.jsx +518 -0
  184. package/dist/_chunk/menu.jsx.map +1 -0
  185. package/dist/_chunk/meter.js +33 -0
  186. package/dist/_chunk/meter.js.map +1 -0
  187. package/dist/_chunk/meter.jsx +33 -0
  188. package/dist/_chunk/meter.jsx.map +1 -0
  189. package/dist/_chunk/numberfield.js +258 -0
  190. package/dist/_chunk/numberfield.js.map +1 -0
  191. package/dist/_chunk/numberfield.jsx +258 -0
  192. package/dist/_chunk/numberfield.jsx.map +1 -0
  193. package/dist/_chunk/overlays.js +186 -0
  194. package/dist/_chunk/overlays.js.map +1 -0
  195. package/dist/_chunk/overlays.jsx +162 -0
  196. package/dist/_chunk/overlays.jsx.map +1 -0
  197. package/dist/_chunk/popover.js +574 -0
  198. package/dist/_chunk/popover.js.map +1 -0
  199. package/dist/_chunk/popover.jsx +574 -0
  200. package/dist/_chunk/popover.jsx.map +1 -0
  201. package/dist/_chunk/radio.js +319 -0
  202. package/dist/_chunk/radio.js.map +1 -0
  203. package/dist/_chunk/radio.jsx +319 -0
  204. package/dist/_chunk/radio.jsx.map +1 -0
  205. package/dist/_chunk/searchfield.js +209 -0
  206. package/dist/_chunk/searchfield.js.map +1 -0
  207. package/dist/_chunk/searchfield.jsx +209 -0
  208. package/dist/_chunk/searchfield.jsx.map +1 -0
  209. package/dist/_chunk/select.js +403 -0
  210. package/dist/_chunk/select.js.map +1 -0
  211. package/dist/_chunk/select.jsx +394 -0
  212. package/dist/_chunk/select.jsx.map +1 -0
  213. package/dist/_chunk/selection.js +679 -0
  214. package/dist/_chunk/selection.js.map +1 -0
  215. package/dist/_chunk/selection.jsx +679 -0
  216. package/dist/_chunk/selection.jsx.map +1 -0
  217. package/dist/_chunk/separator.js +29 -0
  218. package/dist/_chunk/separator.js.map +1 -0
  219. package/dist/_chunk/separator.jsx +29 -0
  220. package/dist/_chunk/separator.jsx.map +1 -0
  221. package/dist/_chunk/slider.js +255 -0
  222. package/dist/_chunk/slider.js.map +1 -0
  223. package/dist/_chunk/slider.jsx +255 -0
  224. package/dist/_chunk/slider.jsx.map +1 -0
  225. package/dist/_chunk/steplist.js +66 -0
  226. package/dist/_chunk/steplist.js.map +1 -0
  227. package/dist/_chunk/steplist.jsx +66 -0
  228. package/dist/_chunk/steplist.jsx.map +1 -0
  229. package/dist/_chunk/switch.js +34 -0
  230. package/dist/_chunk/switch.js.map +1 -0
  231. package/dist/_chunk/switch.jsx +34 -0
  232. package/dist/_chunk/switch.jsx.map +1 -0
  233. package/dist/_chunk/table.js +1051 -0
  234. package/dist/_chunk/table.js.map +1 -0
  235. package/dist/_chunk/table.jsx +1051 -0
  236. package/dist/_chunk/table.jsx.map +1 -0
  237. package/dist/_chunk/tabs.js +260 -0
  238. package/dist/_chunk/tabs.js.map +1 -0
  239. package/dist/_chunk/tabs.jsx +260 -0
  240. package/dist/_chunk/tabs.jsx.map +1 -0
  241. package/dist/_chunk/tag.js +286 -0
  242. package/dist/_chunk/tag.js.map +1 -0
  243. package/dist/_chunk/tag.jsx +286 -0
  244. package/dist/_chunk/tag.jsx.map +1 -0
  245. package/dist/_chunk/textfield.js +109 -0
  246. package/dist/_chunk/textfield.js.map +1 -0
  247. package/dist/_chunk/textfield.jsx +109 -0
  248. package/dist/_chunk/textfield.jsx.map +1 -0
  249. package/dist/_chunk/toast.js +250 -0
  250. package/dist/_chunk/toast.js.map +1 -0
  251. package/dist/_chunk/toast.jsx +250 -0
  252. package/dist/_chunk/toast.jsx.map +1 -0
  253. package/dist/_chunk/toolbar.js +258 -0
  254. package/dist/_chunk/toolbar.js.map +1 -0
  255. package/dist/_chunk/toolbar.jsx +258 -0
  256. package/dist/_chunk/toolbar.jsx.map +1 -0
  257. package/dist/_chunk/tooltip.js +185 -0
  258. package/dist/_chunk/tooltip.js.map +1 -0
  259. package/dist/_chunk/tooltip.jsx +185 -0
  260. package/dist/_chunk/tooltip.jsx.map +1 -0
  261. package/dist/_chunk/tree.js +424 -0
  262. package/dist/_chunk/tree.js.map +1 -0
  263. package/dist/_chunk/tree.jsx +424 -0
  264. package/dist/_chunk/tree.jsx.map +1 -0
  265. package/dist/_chunk/utils.js +665 -0
  266. package/dist/_chunk/utils.js.map +1 -0
  267. package/dist/_chunk/utils.jsx +665 -0
  268. package/dist/_chunk/utils.jsx.map +1 -0
  269. package/dist/_chunk/visually-hidden.js +92 -0
  270. package/dist/_chunk/visually-hidden.js.map +1 -0
  271. package/dist/_chunk/visually-hidden.jsx +92 -0
  272. package/dist/_chunk/visually-hidden.jsx.map +1 -0
  273. package/dist/actiongroup/index.js +2 -0
  274. package/dist/actiongroup/index.jsx +2 -0
  275. package/dist/autocomplete/createAutocomplete.d.ts +2 -0
  276. package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
  277. package/dist/autocomplete/index.js +2 -0
  278. package/dist/autocomplete/index.jsx +2 -0
  279. package/dist/breadcrumbs/index.js +2 -0
  280. package/dist/breadcrumbs/index.jsx +2 -0
  281. package/dist/button/index.js +2 -0
  282. package/dist/button/index.jsx +2 -0
  283. package/dist/calendar/createCalendar.d.ts.map +1 -1
  284. package/dist/calendar/createCalendarCell.d.ts.map +1 -1
  285. package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
  286. package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
  287. package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
  288. package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
  289. package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
  290. package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
  291. package/dist/calendar/index.d.ts +2 -0
  292. package/dist/calendar/index.d.ts.map +1 -1
  293. package/dist/calendar/index.js +2 -0
  294. package/dist/calendar/index.jsx +2 -0
  295. package/dist/calendar/utils.d.ts +4 -0
  296. package/dist/calendar/utils.d.ts.map +1 -1
  297. package/dist/checkbox/createCheckbox.d.ts +4 -0
  298. package/dist/checkbox/createCheckbox.d.ts.map +1 -1
  299. package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
  300. package/dist/checkbox/index.js +2 -0
  301. package/dist/checkbox/index.jsx +2 -0
  302. package/dist/collections/index.js +160 -0
  303. package/dist/collections/index.js.map +1 -0
  304. package/dist/collections/index.jsx +160 -0
  305. package/dist/collections/index.jsx.map +1 -0
  306. package/dist/color/index.js +2 -0
  307. package/dist/color/index.jsx +2 -0
  308. package/dist/combobox/index.js +2 -0
  309. package/dist/combobox/index.jsx +2 -0
  310. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  311. package/dist/datepicker/index.js +2 -0
  312. package/dist/datepicker/index.jsx +2 -0
  313. package/dist/dialog/index.js +2 -0
  314. package/dist/dialog/index.jsx +2 -0
  315. package/dist/disclosure/index.js +2 -0
  316. package/dist/disclosure/index.jsx +2 -0
  317. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  318. package/dist/dnd/index.js +2 -0
  319. package/dist/dnd/index.jsx +2 -0
  320. package/dist/dnd/utils.d.ts +2 -2
  321. package/dist/dnd/utils.d.ts.map +1 -1
  322. package/dist/focus/FocusScope.d.ts.map +1 -1
  323. package/dist/focus/index.js +2 -0
  324. package/dist/focus/index.jsx +2 -0
  325. package/dist/form/createFormValidation.d.ts.map +1 -1
  326. package/dist/form/index.js +3 -0
  327. package/dist/form/index.jsx +3 -0
  328. package/dist/grid/index.js +2 -0
  329. package/dist/grid/index.jsx +2 -0
  330. package/dist/gridlist/createGridList.d.ts +7 -1
  331. package/dist/gridlist/createGridList.d.ts.map +1 -1
  332. package/dist/gridlist/createGridListItem.d.ts +1 -1
  333. package/dist/gridlist/createGridListItem.d.ts.map +1 -1
  334. package/dist/gridlist/createGridListSection.d.ts +15 -0
  335. package/dist/gridlist/createGridListSection.d.ts.map +1 -0
  336. package/dist/gridlist/index.d.ts +2 -1
  337. package/dist/gridlist/index.d.ts.map +1 -1
  338. package/dist/gridlist/index.js +2 -0
  339. package/dist/gridlist/index.jsx +2 -0
  340. package/dist/gridlist/types.d.ts +50 -0
  341. package/dist/gridlist/types.d.ts.map +1 -1
  342. package/dist/i18n/index.js +3 -0
  343. package/dist/i18n/index.jsx +3 -0
  344. package/dist/index.d.ts +7 -3
  345. package/dist/index.d.ts.map +1 -1
  346. package/dist/index.js +71 -18311
  347. package/dist/index.jsx +71 -18242
  348. package/dist/interactions/PressEvent.d.ts +11 -0
  349. package/dist/interactions/PressEvent.d.ts.map +1 -1
  350. package/dist/interactions/createInteractionModality.d.ts +0 -1
  351. package/dist/interactions/createInteractionModality.d.ts.map +1 -1
  352. package/dist/interactions/createKeyboard.d.ts.map +1 -1
  353. package/dist/interactions/createPress.d.ts.map +1 -1
  354. package/dist/interactions/index.js +10 -0
  355. package/dist/interactions/index.jsx +10 -0
  356. package/dist/label/index.js +4 -0
  357. package/dist/label/index.jsx +4 -0
  358. package/dist/landmark/index.js +2 -0
  359. package/dist/landmark/index.jsx +2 -0
  360. package/dist/link/index.js +2 -0
  361. package/dist/link/index.jsx +2 -0
  362. package/dist/listbox/createListBox.d.ts +37 -0
  363. package/dist/listbox/createListBox.d.ts.map +1 -1
  364. package/dist/listbox/createOption.d.ts +6 -0
  365. package/dist/listbox/createOption.d.ts.map +1 -1
  366. package/dist/listbox/index.js +2 -0
  367. package/dist/listbox/index.jsx +2 -0
  368. package/dist/live-announcer/index.js +2 -0
  369. package/dist/live-announcer/index.jsx +2 -0
  370. package/dist/menu/createMenu.d.ts +7 -4
  371. package/dist/menu/createMenu.d.ts.map +1 -1
  372. package/dist/menu/createMenuItem.d.ts +9 -1
  373. package/dist/menu/createMenuItem.d.ts.map +1 -1
  374. package/dist/menu/index.js +2 -0
  375. package/dist/menu/index.jsx +2 -0
  376. package/dist/meter/index.js +2 -0
  377. package/dist/meter/index.jsx +2 -0
  378. package/dist/numberfield/createNumberField.d.ts.map +1 -1
  379. package/dist/numberfield/index.js +2 -0
  380. package/dist/numberfield/index.jsx +2 -0
  381. package/dist/overlays/index.js +4 -0
  382. package/dist/overlays/index.jsx +4 -0
  383. package/dist/popover/calculatePosition.d.ts +2 -0
  384. package/dist/popover/calculatePosition.d.ts.map +1 -1
  385. package/dist/popover/createOverlayPosition.d.ts +8 -0
  386. package/dist/popover/createOverlayPosition.d.ts.map +1 -1
  387. package/dist/popover/index.js +2 -0
  388. package/dist/popover/index.jsx +2 -0
  389. package/dist/progress/index.js +2 -0
  390. package/dist/progress/index.jsx +2 -0
  391. package/dist/radio/createRadio.d.ts +2 -0
  392. package/dist/radio/createRadio.d.ts.map +1 -1
  393. package/dist/radio/index.js +2 -0
  394. package/dist/radio/index.jsx +2 -0
  395. package/dist/searchfield/index.js +2 -0
  396. package/dist/searchfield/index.jsx +2 -0
  397. package/dist/select/createSelect.d.ts.map +1 -1
  398. package/dist/select/index.js +2 -0
  399. package/dist/select/index.jsx +2 -0
  400. package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
  401. package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
  402. package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
  403. package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
  404. package/dist/selection/constants.d.ts +15 -0
  405. package/dist/selection/constants.d.ts.map +1 -0
  406. package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
  407. package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
  408. package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
  409. package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
  410. package/dist/selection/createSelectableCollection.d.ts +69 -0
  411. package/dist/selection/createSelectableCollection.d.ts.map +1 -0
  412. package/dist/selection/createSelectableItem.d.ts +154 -0
  413. package/dist/selection/createSelectableItem.d.ts.map +1 -0
  414. package/dist/selection/createSelectableList.d.ts +43 -0
  415. package/dist/selection/createSelectableList.d.ts.map +1 -0
  416. package/dist/selection/createTypeSelect.d.ts.map +1 -1
  417. package/dist/selection/index.d.ts +9 -0
  418. package/dist/selection/index.d.ts.map +1 -1
  419. package/dist/selection/index.js +4 -0
  420. package/dist/selection/index.jsx +4 -0
  421. package/dist/selection/selectItem.d.ts +29 -0
  422. package/dist/selection/selectItem.d.ts.map +1 -0
  423. package/dist/selection/utils.d.ts +40 -0
  424. package/dist/selection/utils.d.ts.map +1 -0
  425. package/dist/separator/index.js +2 -0
  426. package/dist/separator/index.jsx +2 -0
  427. package/dist/slider/createSlider.d.ts.map +1 -1
  428. package/dist/slider/index.js +2 -0
  429. package/dist/slider/index.jsx +2 -0
  430. package/dist/ssr/index.d.ts +17 -0
  431. package/dist/ssr/index.d.ts.map +1 -1
  432. package/dist/ssr/index.js +299 -0
  433. package/dist/ssr/index.js.map +1 -0
  434. package/dist/ssr/index.jsx +292 -0
  435. package/dist/ssr/index.jsx.map +1 -0
  436. package/dist/steplist/index.js +2 -0
  437. package/dist/steplist/index.jsx +2 -0
  438. package/dist/switch/createSwitch.d.ts +4 -0
  439. package/dist/switch/createSwitch.d.ts.map +1 -1
  440. package/dist/switch/index.js +2 -0
  441. package/dist/switch/index.jsx +2 -0
  442. package/dist/table/createTable.d.ts.map +1 -1
  443. package/dist/table/createTableRow.d.ts +1 -1
  444. package/dist/table/createTableRow.d.ts.map +1 -1
  445. package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
  446. package/dist/table/index.js +2 -0
  447. package/dist/table/index.jsx +2 -0
  448. package/dist/table/types.d.ts +27 -1
  449. package/dist/table/types.d.ts.map +1 -1
  450. package/dist/tabs/createTabs.d.ts +4 -3
  451. package/dist/tabs/createTabs.d.ts.map +1 -1
  452. package/dist/tabs/index.js +2 -0
  453. package/dist/tabs/index.jsx +2 -0
  454. package/dist/tag/createTag.d.ts +2 -0
  455. package/dist/tag/createTag.d.ts.map +1 -1
  456. package/dist/tag/index.js +2 -0
  457. package/dist/tag/index.jsx +2 -0
  458. package/dist/textfield/index.js +2 -0
  459. package/dist/textfield/index.jsx +2 -0
  460. package/dist/toast/createToast.d.ts.map +1 -1
  461. package/dist/toast/index.js +2 -0
  462. package/dist/toast/index.jsx +2 -0
  463. package/dist/toggle/createToggle.d.ts +4 -0
  464. package/dist/toggle/createToggle.d.ts.map +1 -1
  465. package/dist/toggle/index.js +3 -0
  466. package/dist/toggle/index.jsx +3 -0
  467. package/dist/toolbar/createToolbar.d.ts +1 -1
  468. package/dist/toolbar/createToolbar.d.ts.map +1 -1
  469. package/dist/toolbar/index.js +2 -0
  470. package/dist/toolbar/index.jsx +2 -0
  471. package/dist/tooltip/index.js +2 -0
  472. package/dist/tooltip/index.jsx +2 -0
  473. package/dist/tree/createTree.d.ts +5 -1
  474. package/dist/tree/createTree.d.ts.map +1 -1
  475. package/dist/tree/createTreeItem.d.ts +1 -1
  476. package/dist/tree/createTreeItem.d.ts.map +1 -1
  477. package/dist/tree/index.js +2 -0
  478. package/dist/tree/index.jsx +2 -0
  479. package/dist/tree/types.d.ts +10 -0
  480. package/dist/tree/types.d.ts.map +1 -1
  481. package/dist/utils/animation.d.ts +60 -0
  482. package/dist/utils/animation.d.ts.map +1 -0
  483. package/dist/utils/dom.d.ts +48 -2
  484. package/dist/utils/dom.d.ts.map +1 -1
  485. package/dist/utils/index.d.ts +4 -1
  486. package/dist/utils/index.d.ts.map +1 -1
  487. package/dist/utils/index.js +5 -0
  488. package/dist/utils/index.jsx +5 -0
  489. package/dist/utils/keyboard.d.ts +17 -0
  490. package/dist/utils/keyboard.d.ts.map +1 -0
  491. package/dist/utils/mergeProps.d.ts.map +1 -1
  492. package/dist/utils/scrollIntoView.d.ts +30 -0
  493. package/dist/utils/scrollIntoView.d.ts.map +1 -0
  494. package/dist/visually-hidden/index.js +2 -0
  495. package/dist/visually-hidden/index.jsx +2 -0
  496. package/package.json +304 -3
  497. package/src/autocomplete/createAutocomplete.ts +67 -21
  498. package/src/calendar/createCalendar.ts +2 -0
  499. package/src/calendar/createCalendarCell.ts +19 -2
  500. package/src/calendar/createCalendarGrid.ts +43 -9
  501. package/src/calendar/createCalendarMonthPicker.ts +105 -0
  502. package/src/calendar/createCalendarYearPicker.ts +144 -0
  503. package/src/calendar/createRangeCalendar.ts +2 -0
  504. package/src/calendar/index.ts +17 -0
  505. package/src/calendar/utils.ts +4 -0
  506. package/src/checkbox/createCheckbox.ts +10 -0
  507. package/src/checkbox/createCheckboxGroupItem.ts +12 -16
  508. package/src/datepicker/createDateSegment.ts +6 -1
  509. package/src/dnd/createDroppableCollection.ts +4 -1
  510. package/src/dnd/utils.ts +27 -3
  511. package/src/focus/FocusScope.tsx +152 -18
  512. package/src/form/createFormValidation.ts +8 -1
  513. package/src/gridlist/createGridList.ts +145 -42
  514. package/src/gridlist/createGridListItem.ts +87 -155
  515. package/src/gridlist/createGridListSection.ts +54 -0
  516. package/src/gridlist/index.ts +3 -0
  517. package/src/gridlist/types.ts +47 -0
  518. package/src/index.ts +40 -0
  519. package/src/interactions/PressEvent.ts +14 -0
  520. package/src/interactions/createInteractionModality.ts +21 -12
  521. package/src/interactions/createKeyboard.ts +10 -0
  522. package/src/interactions/createPress.ts +29 -6
  523. package/src/listbox/createListBox.ts +129 -8
  524. package/src/listbox/createOption.ts +68 -73
  525. package/src/menu/createMenu.ts +93 -16
  526. package/src/menu/createMenuItem.ts +253 -41
  527. package/src/numberfield/createNumberField.ts +82 -14
  528. package/src/popover/calculatePosition.ts +19 -7
  529. package/src/popover/createOverlayPosition.ts +9 -0
  530. package/src/radio/createRadio.ts +19 -2
  531. package/src/select/createSelect.ts +18 -2
  532. package/src/selection/DOMLayoutDelegate.ts +102 -0
  533. package/src/selection/ListKeyboardDelegate.ts +398 -0
  534. package/src/selection/constants.ts +16 -0
  535. package/src/selection/createCollectionRowInteraction.ts +209 -0
  536. package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
  537. package/src/selection/createSelectableCollection.ts +645 -0
  538. package/src/selection/createSelectableItem.ts +498 -0
  539. package/src/selection/createSelectableList.ts +93 -0
  540. package/src/selection/createTypeSelect.ts +112 -51
  541. package/src/selection/index.ts +31 -0
  542. package/src/selection/selectItem.ts +80 -0
  543. package/src/selection/utils.ts +82 -0
  544. package/src/slider/createSlider.ts +48 -1
  545. package/src/ssr/index.tsx +31 -0
  546. package/src/switch/createSwitch.ts +10 -0
  547. package/src/table/createTable.ts +56 -26
  548. package/src/table/createTableRow.ts +198 -203
  549. package/src/table/createTableSelectAllCheckbox.ts +3 -4
  550. package/src/table/types.ts +29 -1
  551. package/src/tabs/createTabs.ts +50 -20
  552. package/src/tag/createTag.ts +9 -4
  553. package/src/toast/createToast.ts +1 -0
  554. package/src/toggle/createToggle.ts +20 -0
  555. package/src/toolbar/createToolbar.ts +43 -42
  556. package/src/tree/createTree.ts +100 -42
  557. package/src/tree/createTreeItem.ts +105 -120
  558. package/src/tree/types.ts +10 -0
  559. package/src/utils/animation.ts +151 -0
  560. package/src/utils/dom.ts +215 -25
  561. package/src/utils/index.ts +8 -0
  562. package/src/utils/keyboard.ts +25 -0
  563. package/src/utils/mergeProps.ts +8 -1
  564. package/src/utils/scrollIntoView.ts +181 -0
  565. package/dist/index.js.map +0 -1
  566. package/dist/index.jsx.map +0 -1
@@ -0,0 +1,250 @@
1
+ import { n as focusWithoutScrolling } from "./focus.js";
2
+ import { o as getInteractionModality } from "./createInteractionModality.js";
3
+ import { t as createHover } from "./createHover.js";
4
+ import { createId } from "../ssr/index.js";
5
+ import { t as createLandmark } from "./createLandmark.js";
6
+ import { createEffect, createMemo, onCleanup } from "solid-js";
7
+ //#region src/toast/createToast.ts
8
+ /**
9
+ * createToast hook for Solidaria
10
+ *
11
+ * Provides the accessibility implementation for a Toast component.
12
+ *
13
+ * Port of @react-aria/toast useToast.
14
+ */
15
+ /**
16
+ * Provides the accessibility implementation for a Toast component.
17
+ *
18
+ * The toast uses role="alertdialog" to announce content to screen readers.
19
+ * The content area uses role="alert" for the actual message.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * import { createToast } from 'solidaria';
24
+ *
25
+ * function Toast(props) {
26
+ * const {
27
+ * toastProps,
28
+ * contentProps,
29
+ * titleProps,
30
+ * closeButtonProps
31
+ * } = createToast({ toast: props.toast, state: props.state });
32
+ *
33
+ * return (
34
+ * <div {...toastProps}>
35
+ * <div {...contentProps}>
36
+ * <div {...titleProps}>{props.toast.content.title}</div>
37
+ * </div>
38
+ * <button {...closeButtonProps}>×</button>
39
+ * </div>
40
+ * );
41
+ * }
42
+ * ```
43
+ */
44
+ function createToast(props) {
45
+ const titleId = createId();
46
+ const descriptionId = createId();
47
+ const hasTitle = props.hasTitle ?? true;
48
+ const hasDescription = props.hasDescription ?? true;
49
+ const close = () => {
50
+ props.state.close(props.toast.key);
51
+ };
52
+ const toastProps = createMemo(() => ({
53
+ role: "alertdialog",
54
+ "aria-modal": "false",
55
+ "aria-labelledby": hasTitle ? titleId : void 0,
56
+ "aria-describedby": hasDescription ? descriptionId : void 0,
57
+ tabIndex: 0,
58
+ "data-animation": props.toast.animation,
59
+ "data-key": props.toast.key
60
+ }));
61
+ const contentProps = createMemo(() => ({
62
+ role: "alert",
63
+ "aria-atomic": "true",
64
+ "aria-live": "assertive"
65
+ }));
66
+ const titleProps = createMemo(() => ({ id: titleId }));
67
+ const descriptionProps = createMemo(() => ({ id: descriptionId }));
68
+ const closeButtonProps = createMemo(() => ({
69
+ "aria-label": "Close",
70
+ onClick: close
71
+ }));
72
+ return {
73
+ get toastProps() {
74
+ return toastProps();
75
+ },
76
+ get contentProps() {
77
+ return contentProps();
78
+ },
79
+ get titleProps() {
80
+ return titleProps();
81
+ },
82
+ get descriptionProps() {
83
+ return descriptionProps();
84
+ },
85
+ get closeButtonProps() {
86
+ return closeButtonProps();
87
+ }
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/toast/createToastRegion.ts
92
+ /**
93
+ * createToastRegion hook for Solidaria
94
+ *
95
+ * Provides the accessibility implementation for a ToastRegion component.
96
+ * The region is a landmark that contains all visible toasts.
97
+ *
98
+ * Port of @react-aria/toast useToastRegion.
99
+ */
100
+ /**
101
+ * Provides the accessibility implementation for a ToastRegion component.
102
+ *
103
+ * The region is a landmark (role="region") that contains all visible toasts.
104
+ * It pauses toast timers on hover or focus to give users time to read/interact.
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * import { createToastRegion } from 'solidaria';
109
+ * import { For, Show } from 'solid-js';
110
+ *
111
+ * function ToastRegion(props) {
112
+ * let ref;
113
+ * const { regionProps } = createToastRegion({ state: props.state });
114
+ *
115
+ * return (
116
+ * <Show when={props.state.visibleToasts().length > 0}>
117
+ * <div {...regionProps} ref={ref}>
118
+ * <For each={props.state.visibleToasts()}>
119
+ * {(toast) => <Toast toast={toast} state={props.state} />}
120
+ * </For>
121
+ * </div>
122
+ * </Show>
123
+ * );
124
+ * }
125
+ * ```
126
+ */
127
+ function createToastRegion(props) {
128
+ const visibleToasts = () => typeof props.state.visibleToasts === "function" ? props.state.visibleToasts() : [];
129
+ const regionRef = () => props.ref?.();
130
+ const activeRegionRef = () => visibleToasts().length > 0 ? regionRef() : void 0;
131
+ const { landmarkProps } = createLandmark(() => ({
132
+ role: "region",
133
+ "aria-label": props["aria-label"] ?? "Notifications"
134
+ }), activeRegionRef);
135
+ let isHovered = false;
136
+ let isFocused = false;
137
+ let toastElements = [];
138
+ let previousVisibleToasts = visibleToasts();
139
+ let focusedToastIndex = -1;
140
+ let lastFocused = null;
141
+ const updateTimers = () => {
142
+ if (isHovered || isFocused) props.state.pauseAll();
143
+ else props.state.resumeAll();
144
+ };
145
+ const { hoverProps } = createHover({
146
+ onHoverStart: () => {
147
+ isHovered = true;
148
+ updateTimers();
149
+ },
150
+ onHoverEnd: () => {
151
+ isHovered = false;
152
+ updateTimers();
153
+ }
154
+ });
155
+ const getToastElements = () => {
156
+ const element = regionRef();
157
+ return element ? [...element.querySelectorAll("[role=\"alertdialog\"]")] : [];
158
+ };
159
+ const restoreLastFocused = () => {
160
+ if (!lastFocused?.isConnected) {
161
+ lastFocused = null;
162
+ return;
163
+ }
164
+ if (getInteractionModality() === "pointer") focusWithoutScrolling(lastFocused);
165
+ else lastFocused.focus();
166
+ lastFocused = null;
167
+ };
168
+ const handleFocusIn = (e) => {
169
+ const currentTarget = e.currentTarget;
170
+ const relatedTarget = e.relatedTarget;
171
+ if (!isFocused) {
172
+ isFocused = true;
173
+ if (relatedTarget && !currentTarget.contains(relatedTarget)) lastFocused = relatedTarget;
174
+ updateTimers();
175
+ }
176
+ toastElements = getToastElements();
177
+ const target = e.target instanceof Element ? e.target.closest("[role=\"alertdialog\"]") : null;
178
+ focusedToastIndex = target ? toastElements.findIndex((toast) => toast === target) : -1;
179
+ };
180
+ const handleFocusOut = (e) => {
181
+ const target = e.relatedTarget;
182
+ const currentTarget = e.currentTarget;
183
+ if (!target || !currentTarget.contains(target)) {
184
+ isFocused = false;
185
+ focusedToastIndex = -1;
186
+ updateTimers();
187
+ }
188
+ };
189
+ createEffect(() => {
190
+ const currentVisibleToasts = visibleToasts();
191
+ const element = regionRef();
192
+ if (focusedToastIndex === -1 || currentVisibleToasts.length === 0 || !element) {
193
+ toastElements = [];
194
+ previousVisibleToasts = currentVisibleToasts;
195
+ return;
196
+ }
197
+ toastElements = getToastElements();
198
+ if (previousVisibleToasts.length === currentVisibleToasts.length && currentVisibleToasts.every((toast, index) => toast.key === previousVisibleToasts[index]?.key)) {
199
+ previousVisibleToasts = currentVisibleToasts;
200
+ return;
201
+ }
202
+ const allToasts = previousVisibleToasts.map((toast, index) => ({
203
+ index,
204
+ isRemoved: !currentVisibleToasts.some((currentToast) => currentToast.key === toast.key)
205
+ }));
206
+ const removedFocusedToastIndex = allToasts.findIndex((toast) => toast.index === focusedToastIndex && toast.isRemoved);
207
+ if (removedFocusedToastIndex > -1) if (getInteractionModality() === "pointer" && lastFocused?.isConnected) focusWithoutScrolling(lastFocused);
208
+ else {
209
+ let index = 0;
210
+ let nextToast;
211
+ let previousToast;
212
+ while (index <= removedFocusedToastIndex) {
213
+ if (!allToasts[index]?.isRemoved) previousToast = Math.max(0, index - 1);
214
+ index++;
215
+ }
216
+ while (index < allToasts.length) {
217
+ if (!allToasts[index]?.isRemoved) {
218
+ nextToast = index - 1;
219
+ break;
220
+ }
221
+ index++;
222
+ }
223
+ if (previousToast === void 0 && nextToast === void 0) previousToast = 0;
224
+ if (previousToast !== void 0 && previousToast >= 0 && previousToast < toastElements.length) focusWithoutScrolling(toastElements[previousToast]);
225
+ else if (nextToast !== void 0 && nextToast >= 0 && nextToast < toastElements.length) focusWithoutScrolling(toastElements[nextToast]);
226
+ }
227
+ previousVisibleToasts = currentVisibleToasts;
228
+ });
229
+ createEffect(() => {
230
+ if (visibleToasts().length === 0) restoreLastFocused();
231
+ });
232
+ onCleanup(() => {
233
+ restoreLastFocused();
234
+ });
235
+ const regionProps = createMemo(() => ({
236
+ ...landmarkProps,
237
+ ...hoverProps,
238
+ tabIndex: -1,
239
+ "data-solidaria-top-layer": "true",
240
+ onFocusIn: handleFocusIn,
241
+ onFocusOut: handleFocusOut
242
+ }));
243
+ return { get regionProps() {
244
+ return regionProps();
245
+ } };
246
+ }
247
+ //#endregion
248
+ export { createToast as n, createToastRegion as t };
249
+
250
+ //# sourceMappingURL=toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.js","names":[],"sources":["../../src/toast/createToast.ts","../../src/toast/createToastRegion.ts"],"sourcesContent":["/**\n * createToast hook for Solidaria\n *\n * Provides the accessibility implementation for a Toast component.\n *\n * Port of @react-aria/toast useToast.\n */\n\nimport { type JSX, createMemo } from \"solid-js\";\nimport { type QueuedToast, type ToastState } from \"@proyecto-viviana/solid-stately\";\nimport { createId } from \"../ssr\";\n\nexport interface AriaToastProps<T> {\n /** The toast to display. */\n toast: QueuedToast<T>;\n /** The toast state from createToastState. */\n state: ToastState<T>;\n /** Whether the rendered toast includes a title element. */\n hasTitle?: boolean;\n /** Whether the rendered toast includes a description element. */\n hasDescription?: boolean;\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast content element (contains the message). */\n contentProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast title element. */\n titleProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast description element. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the close button. */\n closeButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * Provides the accessibility implementation for a Toast component.\n *\n * The toast uses role=\"alertdialog\" to announce content to screen readers.\n * The content area uses role=\"alert\" for the actual message.\n *\n * @example\n * ```tsx\n * import { createToast } from 'solidaria';\n *\n * function Toast(props) {\n * const {\n * toastProps,\n * contentProps,\n * titleProps,\n * closeButtonProps\n * } = createToast({ toast: props.toast, state: props.state });\n *\n * return (\n * <div {...toastProps}>\n * <div {...contentProps}>\n * <div {...titleProps}>{props.toast.content.title}</div>\n * </div>\n * <button {...closeButtonProps}>×</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function createToast<T>(props: AriaToastProps<T>): ToastAria {\n const titleId = createId();\n const descriptionId = createId();\n const hasTitle = props.hasTitle ?? true;\n const hasDescription = props.hasDescription ?? true;\n\n const close = () => {\n props.state.close(props.toast.key);\n };\n\n // Toast container - role=\"alertdialog\" for screen readers\n const toastProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: \"alertdialog\",\n \"aria-modal\": \"false\",\n \"aria-labelledby\": hasTitle ? titleId : undefined,\n \"aria-describedby\": hasDescription ? descriptionId : undefined,\n tabIndex: 0,\n \"data-animation\": props.toast.animation,\n \"data-key\": props.toast.key,\n }));\n\n // Content area with role=\"alert\" for immediate announcement\n const contentProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: \"alert\",\n \"aria-atomic\": \"true\",\n \"aria-live\": \"assertive\",\n }));\n\n // Title props\n const titleProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: titleId,\n }));\n\n // Description props\n const descriptionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: descriptionId,\n }));\n\n // Close button\n const closeButtonProps = createMemo<JSX.ButtonHTMLAttributes<HTMLButtonElement>>(() => ({\n \"aria-label\": \"Close\",\n onClick: close,\n }));\n\n return {\n get toastProps() {\n return toastProps();\n },\n get contentProps() {\n return contentProps();\n },\n get titleProps() {\n return titleProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get closeButtonProps() {\n return closeButtonProps();\n },\n };\n}\n","/**\n * createToastRegion hook for Solidaria\n *\n * Provides the accessibility implementation for a ToastRegion component.\n * The region is a landmark that contains all visible toasts.\n *\n * Port of @react-aria/toast useToastRegion.\n */\n\nimport { type Accessor, type JSX, createEffect, createMemo, onCleanup } from \"solid-js\";\nimport { type ToastState } from \"@proyecto-viviana/solid-stately\";\nimport { createHover } from \"../interactions/createHover\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\nimport { createLandmark } from \"../landmark/createLandmark\";\nimport { focusWithoutScrolling } from \"../utils/focus\";\n\nexport interface AriaToastRegionProps<T> {\n /** The toast state from createToastState. */\n state: ToastState<T>;\n /** The toast region element. Required for landmark navigation and focus recovery. */\n ref?: Accessor<HTMLElement | undefined>;\n /** An accessible label for the region. */\n \"aria-label\"?: string;\n}\n\nexport interface ToastRegionAria {\n /** Props for the toast region container element. */\n regionProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for a ToastRegion component.\n *\n * The region is a landmark (role=\"region\") that contains all visible toasts.\n * It pauses toast timers on hover or focus to give users time to read/interact.\n *\n * @example\n * ```tsx\n * import { createToastRegion } from 'solidaria';\n * import { For, Show } from 'solid-js';\n *\n * function ToastRegion(props) {\n * let ref;\n * const { regionProps } = createToastRegion({ state: props.state });\n *\n * return (\n * <Show when={props.state.visibleToasts().length > 0}>\n * <div {...regionProps} ref={ref}>\n * <For each={props.state.visibleToasts()}>\n * {(toast) => <Toast toast={toast} state={props.state} />}\n * </For>\n * </div>\n * </Show>\n * );\n * }\n * ```\n */\nexport function createToastRegion<T>(props: AriaToastRegionProps<T>): ToastRegionAria {\n const visibleToasts = () =>\n typeof props.state.visibleToasts === \"function\" ? props.state.visibleToasts() : [];\n const regionRef = () => props.ref?.();\n const activeRegionRef = () => (visibleToasts().length > 0 ? regionRef() : undefined);\n\n const { landmarkProps } = createLandmark(\n () => ({\n role: \"region\",\n \"aria-label\": props[\"aria-label\"] ?? \"Notifications\",\n }),\n activeRegionRef,\n );\n\n let isHovered = false;\n let isFocused = false;\n let toastElements: HTMLElement[] = [];\n let previousVisibleToasts = visibleToasts();\n let focusedToastIndex = -1;\n let lastFocused: HTMLElement | null = null;\n\n const updateTimers = () => {\n if (isHovered || isFocused) {\n props.state.pauseAll();\n } else {\n props.state.resumeAll();\n }\n };\n\n const { hoverProps } = createHover({\n onHoverStart: () => {\n isHovered = true;\n updateTimers();\n },\n onHoverEnd: () => {\n isHovered = false;\n updateTimers();\n },\n });\n\n const getToastElements = () => {\n const element = regionRef();\n return element ? [...element.querySelectorAll<HTMLElement>('[role=\"alertdialog\"]')] : [];\n };\n\n const restoreLastFocused = () => {\n if (!lastFocused?.isConnected) {\n lastFocused = null;\n return;\n }\n\n if (getInteractionModality() === \"pointer\") {\n focusWithoutScrolling(lastFocused);\n } else {\n lastFocused.focus();\n }\n\n lastFocused = null;\n };\n\n const handleFocusIn = (e: FocusEvent) => {\n const currentTarget = e.currentTarget as HTMLElement;\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n\n if (!isFocused) {\n isFocused = true;\n if (relatedTarget && !currentTarget.contains(relatedTarget)) {\n lastFocused = relatedTarget;\n }\n updateTimers();\n }\n\n toastElements = getToastElements();\n const target =\n e.target instanceof Element ? e.target.closest<HTMLElement>('[role=\"alertdialog\"]') : null;\n focusedToastIndex = target ? toastElements.findIndex((toast) => toast === target) : -1;\n };\n\n const handleFocusOut = (e: FocusEvent) => {\n const target = e.relatedTarget as HTMLElement | null;\n const currentTarget = e.currentTarget as HTMLElement;\n if (!target || !currentTarget.contains(target)) {\n isFocused = false;\n focusedToastIndex = -1;\n updateTimers();\n }\n };\n\n createEffect(() => {\n const currentVisibleToasts = visibleToasts();\n const element = regionRef();\n\n if (focusedToastIndex === -1 || currentVisibleToasts.length === 0 || !element) {\n toastElements = [];\n previousVisibleToasts = currentVisibleToasts;\n return;\n }\n\n toastElements = getToastElements();\n\n const unchanged =\n previousVisibleToasts.length === currentVisibleToasts.length &&\n currentVisibleToasts.every((toast, index) => toast.key === previousVisibleToasts[index]?.key);\n\n if (unchanged) {\n previousVisibleToasts = currentVisibleToasts;\n return;\n }\n\n const allToasts = previousVisibleToasts.map((toast, index) => ({\n index,\n isRemoved: !currentVisibleToasts.some((currentToast) => currentToast.key === toast.key),\n }));\n const removedFocusedToastIndex = allToasts.findIndex(\n (toast) => toast.index === focusedToastIndex && toast.isRemoved,\n );\n\n if (removedFocusedToastIndex > -1) {\n if (getInteractionModality() === \"pointer\" && lastFocused?.isConnected) {\n focusWithoutScrolling(lastFocused);\n } else {\n let index = 0;\n let nextToast: number | undefined;\n let previousToast: number | undefined;\n\n while (index <= removedFocusedToastIndex) {\n if (!allToasts[index]?.isRemoved) {\n previousToast = Math.max(0, index - 1);\n }\n index++;\n }\n\n while (index < allToasts.length) {\n if (!allToasts[index]?.isRemoved) {\n nextToast = index - 1;\n break;\n }\n index++;\n }\n\n if (previousToast === undefined && nextToast === undefined) {\n previousToast = 0;\n }\n\n if (\n previousToast !== undefined &&\n previousToast >= 0 &&\n previousToast < toastElements.length\n ) {\n focusWithoutScrolling(toastElements[previousToast]);\n } else if (nextToast !== undefined && nextToast >= 0 && nextToast < toastElements.length) {\n focusWithoutScrolling(toastElements[nextToast]);\n }\n }\n }\n\n previousVisibleToasts = currentVisibleToasts;\n });\n\n createEffect(() => {\n if (visibleToasts().length === 0) {\n restoreLastFocused();\n }\n });\n\n onCleanup(() => {\n restoreLastFocused();\n });\n\n // Region props\n const regionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n ...landmarkProps,\n ...hoverProps,\n tabIndex: -1,\n \"data-solidaria-top-layer\": \"true\",\n onFocusIn: handleFocusIn,\n onFocusOut: handleFocusOut,\n }));\n\n return {\n get regionProps() {\n return regionProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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cAAc,kBAAmD;EACrE,GAAG;EACH,GAAG;EACH,UAAU;EACV,4BAA4B;EAC5B,WAAW;EACX,YAAY;CACd,EAAE;CAEF,OAAO,EACL,IAAI,cAAc;EAChB,OAAO,YAAY;CACrB,EACF;AACF"}
@@ -0,0 +1,250 @@
1
+ import { n as focusWithoutScrolling } from "./focus.jsx";
2
+ import { o as getInteractionModality } from "./createInteractionModality.jsx";
3
+ import { t as createHover } from "./createHover.jsx";
4
+ import { createId } from "../ssr/index.jsx";
5
+ import { t as createLandmark } from "./createLandmark.jsx";
6
+ import { createEffect, createMemo, onCleanup } from "solid-js";
7
+ //#region src/toast/createToast.ts
8
+ /**
9
+ * createToast hook for Solidaria
10
+ *
11
+ * Provides the accessibility implementation for a Toast component.
12
+ *
13
+ * Port of @react-aria/toast useToast.
14
+ */
15
+ /**
16
+ * Provides the accessibility implementation for a Toast component.
17
+ *
18
+ * The toast uses role="alertdialog" to announce content to screen readers.
19
+ * The content area uses role="alert" for the actual message.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * import { createToast } from 'solidaria';
24
+ *
25
+ * function Toast(props) {
26
+ * const {
27
+ * toastProps,
28
+ * contentProps,
29
+ * titleProps,
30
+ * closeButtonProps
31
+ * } = createToast({ toast: props.toast, state: props.state });
32
+ *
33
+ * return (
34
+ * <div {...toastProps}>
35
+ * <div {...contentProps}>
36
+ * <div {...titleProps}>{props.toast.content.title}</div>
37
+ * </div>
38
+ * <button {...closeButtonProps}>×</button>
39
+ * </div>
40
+ * );
41
+ * }
42
+ * ```
43
+ */
44
+ function createToast(props) {
45
+ const titleId = createId();
46
+ const descriptionId = createId();
47
+ const hasTitle = props.hasTitle ?? true;
48
+ const hasDescription = props.hasDescription ?? true;
49
+ const close = () => {
50
+ props.state.close(props.toast.key);
51
+ };
52
+ const toastProps = createMemo(() => ({
53
+ role: "alertdialog",
54
+ "aria-modal": "false",
55
+ "aria-labelledby": hasTitle ? titleId : void 0,
56
+ "aria-describedby": hasDescription ? descriptionId : void 0,
57
+ tabIndex: 0,
58
+ "data-animation": props.toast.animation,
59
+ "data-key": props.toast.key
60
+ }));
61
+ const contentProps = createMemo(() => ({
62
+ role: "alert",
63
+ "aria-atomic": "true",
64
+ "aria-live": "assertive"
65
+ }));
66
+ const titleProps = createMemo(() => ({ id: titleId }));
67
+ const descriptionProps = createMemo(() => ({ id: descriptionId }));
68
+ const closeButtonProps = createMemo(() => ({
69
+ "aria-label": "Close",
70
+ onClick: close
71
+ }));
72
+ return {
73
+ get toastProps() {
74
+ return toastProps();
75
+ },
76
+ get contentProps() {
77
+ return contentProps();
78
+ },
79
+ get titleProps() {
80
+ return titleProps();
81
+ },
82
+ get descriptionProps() {
83
+ return descriptionProps();
84
+ },
85
+ get closeButtonProps() {
86
+ return closeButtonProps();
87
+ }
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/toast/createToastRegion.ts
92
+ /**
93
+ * createToastRegion hook for Solidaria
94
+ *
95
+ * Provides the accessibility implementation for a ToastRegion component.
96
+ * The region is a landmark that contains all visible toasts.
97
+ *
98
+ * Port of @react-aria/toast useToastRegion.
99
+ */
100
+ /**
101
+ * Provides the accessibility implementation for a ToastRegion component.
102
+ *
103
+ * The region is a landmark (role="region") that contains all visible toasts.
104
+ * It pauses toast timers on hover or focus to give users time to read/interact.
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * import { createToastRegion } from 'solidaria';
109
+ * import { For, Show } from 'solid-js';
110
+ *
111
+ * function ToastRegion(props) {
112
+ * let ref;
113
+ * const { regionProps } = createToastRegion({ state: props.state });
114
+ *
115
+ * return (
116
+ * <Show when={props.state.visibleToasts().length > 0}>
117
+ * <div {...regionProps} ref={ref}>
118
+ * <For each={props.state.visibleToasts()}>
119
+ * {(toast) => <Toast toast={toast} state={props.state} />}
120
+ * </For>
121
+ * </div>
122
+ * </Show>
123
+ * );
124
+ * }
125
+ * ```
126
+ */
127
+ function createToastRegion(props) {
128
+ const visibleToasts = () => typeof props.state.visibleToasts === "function" ? props.state.visibleToasts() : [];
129
+ const regionRef = () => props.ref?.();
130
+ const activeRegionRef = () => visibleToasts().length > 0 ? regionRef() : void 0;
131
+ const { landmarkProps } = createLandmark(() => ({
132
+ role: "region",
133
+ "aria-label": props["aria-label"] ?? "Notifications"
134
+ }), activeRegionRef);
135
+ let isHovered = false;
136
+ let isFocused = false;
137
+ let toastElements = [];
138
+ let previousVisibleToasts = visibleToasts();
139
+ let focusedToastIndex = -1;
140
+ let lastFocused = null;
141
+ const updateTimers = () => {
142
+ if (isHovered || isFocused) props.state.pauseAll();
143
+ else props.state.resumeAll();
144
+ };
145
+ const { hoverProps } = createHover({
146
+ onHoverStart: () => {
147
+ isHovered = true;
148
+ updateTimers();
149
+ },
150
+ onHoverEnd: () => {
151
+ isHovered = false;
152
+ updateTimers();
153
+ }
154
+ });
155
+ const getToastElements = () => {
156
+ const element = regionRef();
157
+ return element ? [...element.querySelectorAll("[role=\"alertdialog\"]")] : [];
158
+ };
159
+ const restoreLastFocused = () => {
160
+ if (!lastFocused?.isConnected) {
161
+ lastFocused = null;
162
+ return;
163
+ }
164
+ if (getInteractionModality() === "pointer") focusWithoutScrolling(lastFocused);
165
+ else lastFocused.focus();
166
+ lastFocused = null;
167
+ };
168
+ const handleFocusIn = (e) => {
169
+ const currentTarget = e.currentTarget;
170
+ const relatedTarget = e.relatedTarget;
171
+ if (!isFocused) {
172
+ isFocused = true;
173
+ if (relatedTarget && !currentTarget.contains(relatedTarget)) lastFocused = relatedTarget;
174
+ updateTimers();
175
+ }
176
+ toastElements = getToastElements();
177
+ const target = e.target instanceof Element ? e.target.closest("[role=\"alertdialog\"]") : null;
178
+ focusedToastIndex = target ? toastElements.findIndex((toast) => toast === target) : -1;
179
+ };
180
+ const handleFocusOut = (e) => {
181
+ const target = e.relatedTarget;
182
+ const currentTarget = e.currentTarget;
183
+ if (!target || !currentTarget.contains(target)) {
184
+ isFocused = false;
185
+ focusedToastIndex = -1;
186
+ updateTimers();
187
+ }
188
+ };
189
+ createEffect(() => {
190
+ const currentVisibleToasts = visibleToasts();
191
+ const element = regionRef();
192
+ if (focusedToastIndex === -1 || currentVisibleToasts.length === 0 || !element) {
193
+ toastElements = [];
194
+ previousVisibleToasts = currentVisibleToasts;
195
+ return;
196
+ }
197
+ toastElements = getToastElements();
198
+ if (previousVisibleToasts.length === currentVisibleToasts.length && currentVisibleToasts.every((toast, index) => toast.key === previousVisibleToasts[index]?.key)) {
199
+ previousVisibleToasts = currentVisibleToasts;
200
+ return;
201
+ }
202
+ const allToasts = previousVisibleToasts.map((toast, index) => ({
203
+ index,
204
+ isRemoved: !currentVisibleToasts.some((currentToast) => currentToast.key === toast.key)
205
+ }));
206
+ const removedFocusedToastIndex = allToasts.findIndex((toast) => toast.index === focusedToastIndex && toast.isRemoved);
207
+ if (removedFocusedToastIndex > -1) if (getInteractionModality() === "pointer" && lastFocused?.isConnected) focusWithoutScrolling(lastFocused);
208
+ else {
209
+ let index = 0;
210
+ let nextToast;
211
+ let previousToast;
212
+ while (index <= removedFocusedToastIndex) {
213
+ if (!allToasts[index]?.isRemoved) previousToast = Math.max(0, index - 1);
214
+ index++;
215
+ }
216
+ while (index < allToasts.length) {
217
+ if (!allToasts[index]?.isRemoved) {
218
+ nextToast = index - 1;
219
+ break;
220
+ }
221
+ index++;
222
+ }
223
+ if (previousToast === void 0 && nextToast === void 0) previousToast = 0;
224
+ if (previousToast !== void 0 && previousToast >= 0 && previousToast < toastElements.length) focusWithoutScrolling(toastElements[previousToast]);
225
+ else if (nextToast !== void 0 && nextToast >= 0 && nextToast < toastElements.length) focusWithoutScrolling(toastElements[nextToast]);
226
+ }
227
+ previousVisibleToasts = currentVisibleToasts;
228
+ });
229
+ createEffect(() => {
230
+ if (visibleToasts().length === 0) restoreLastFocused();
231
+ });
232
+ onCleanup(() => {
233
+ restoreLastFocused();
234
+ });
235
+ const regionProps = createMemo(() => ({
236
+ ...landmarkProps,
237
+ ...hoverProps,
238
+ tabIndex: -1,
239
+ "data-solidaria-top-layer": "true",
240
+ onFocusIn: handleFocusIn,
241
+ onFocusOut: handleFocusOut
242
+ }));
243
+ return { get regionProps() {
244
+ return regionProps();
245
+ } };
246
+ }
247
+ //#endregion
248
+ export { createToast as n, createToastRegion as t };
249
+
250
+ //# sourceMappingURL=toast.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.jsx","names":[],"sources":["../../src/toast/createToast.ts","../../src/toast/createToastRegion.ts"],"sourcesContent":["/**\n * createToast hook for Solidaria\n *\n * Provides the accessibility implementation for a Toast component.\n *\n * Port of @react-aria/toast useToast.\n */\n\nimport { type JSX, createMemo } from \"solid-js\";\nimport { type QueuedToast, type ToastState } from \"@proyecto-viviana/solid-stately\";\nimport { createId } from \"../ssr\";\n\nexport interface AriaToastProps<T> {\n /** The toast to display. */\n toast: QueuedToast<T>;\n /** The toast state from createToastState. */\n state: ToastState<T>;\n /** Whether the rendered toast includes a title element. */\n hasTitle?: boolean;\n /** Whether the rendered toast includes a description element. */\n hasDescription?: boolean;\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast content element (contains the message). */\n contentProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast title element. */\n titleProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast description element. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the close button. */\n closeButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * Provides the accessibility implementation for a Toast component.\n *\n * The toast uses role=\"alertdialog\" to announce content to screen readers.\n * The content area uses role=\"alert\" for the actual message.\n *\n * @example\n * ```tsx\n * import { createToast } from 'solidaria';\n *\n * function Toast(props) {\n * const {\n * toastProps,\n * contentProps,\n * titleProps,\n * closeButtonProps\n * } = createToast({ toast: props.toast, state: props.state });\n *\n * return (\n * <div {...toastProps}>\n * <div {...contentProps}>\n * <div {...titleProps}>{props.toast.content.title}</div>\n * </div>\n * <button {...closeButtonProps}>×</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function createToast<T>(props: AriaToastProps<T>): ToastAria {\n const titleId = createId();\n const descriptionId = createId();\n const hasTitle = props.hasTitle ?? true;\n const hasDescription = props.hasDescription ?? true;\n\n const close = () => {\n props.state.close(props.toast.key);\n };\n\n // Toast container - role=\"alertdialog\" for screen readers\n const toastProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: \"alertdialog\",\n \"aria-modal\": \"false\",\n \"aria-labelledby\": hasTitle ? titleId : undefined,\n \"aria-describedby\": hasDescription ? descriptionId : undefined,\n tabIndex: 0,\n \"data-animation\": props.toast.animation,\n \"data-key\": props.toast.key,\n }));\n\n // Content area with role=\"alert\" for immediate announcement\n const contentProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: \"alert\",\n \"aria-atomic\": \"true\",\n \"aria-live\": \"assertive\",\n }));\n\n // Title props\n const titleProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: titleId,\n }));\n\n // Description props\n const descriptionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: descriptionId,\n }));\n\n // Close button\n const closeButtonProps = createMemo<JSX.ButtonHTMLAttributes<HTMLButtonElement>>(() => ({\n \"aria-label\": \"Close\",\n onClick: close,\n }));\n\n return {\n get toastProps() {\n return toastProps();\n },\n get contentProps() {\n return contentProps();\n },\n get titleProps() {\n return titleProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get closeButtonProps() {\n return closeButtonProps();\n },\n };\n}\n","/**\n * createToastRegion hook for Solidaria\n *\n * Provides the accessibility implementation for a ToastRegion component.\n * The region is a landmark that contains all visible toasts.\n *\n * Port of @react-aria/toast useToastRegion.\n */\n\nimport { type Accessor, type JSX, createEffect, createMemo, onCleanup } from \"solid-js\";\nimport { type ToastState } from \"@proyecto-viviana/solid-stately\";\nimport { createHover } from \"../interactions/createHover\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\nimport { createLandmark } from \"../landmark/createLandmark\";\nimport { focusWithoutScrolling } from \"../utils/focus\";\n\nexport interface AriaToastRegionProps<T> {\n /** The toast state from createToastState. */\n state: ToastState<T>;\n /** The toast region element. Required for landmark navigation and focus recovery. */\n ref?: Accessor<HTMLElement | undefined>;\n /** An accessible label for the region. */\n \"aria-label\"?: string;\n}\n\nexport interface ToastRegionAria {\n /** Props for the toast region container element. */\n regionProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for a ToastRegion component.\n *\n * The region is a landmark (role=\"region\") that contains all visible toasts.\n * It pauses toast timers on hover or focus to give users time to read/interact.\n *\n * @example\n * ```tsx\n * import { createToastRegion } from 'solidaria';\n * import { For, Show } from 'solid-js';\n *\n * function ToastRegion(props) {\n * let ref;\n * const { regionProps } = createToastRegion({ state: props.state });\n *\n * return (\n * <Show when={props.state.visibleToasts().length > 0}>\n * <div {...regionProps} ref={ref}>\n * <For each={props.state.visibleToasts()}>\n * {(toast) => <Toast toast={toast} state={props.state} />}\n * </For>\n * </div>\n * </Show>\n * );\n * }\n * ```\n */\nexport function createToastRegion<T>(props: AriaToastRegionProps<T>): ToastRegionAria {\n const visibleToasts = () =>\n typeof props.state.visibleToasts === \"function\" ? props.state.visibleToasts() : [];\n const regionRef = () => props.ref?.();\n const activeRegionRef = () => (visibleToasts().length > 0 ? regionRef() : undefined);\n\n const { landmarkProps } = createLandmark(\n () => ({\n role: \"region\",\n \"aria-label\": props[\"aria-label\"] ?? \"Notifications\",\n }),\n activeRegionRef,\n );\n\n let isHovered = false;\n let isFocused = false;\n let toastElements: HTMLElement[] = [];\n let previousVisibleToasts = visibleToasts();\n let focusedToastIndex = -1;\n let lastFocused: HTMLElement | null = null;\n\n const updateTimers = () => {\n if (isHovered || isFocused) {\n props.state.pauseAll();\n } else {\n props.state.resumeAll();\n }\n };\n\n const { hoverProps } = createHover({\n onHoverStart: () => {\n isHovered = true;\n updateTimers();\n },\n onHoverEnd: () => {\n isHovered = false;\n updateTimers();\n },\n });\n\n const getToastElements = () => {\n const element = regionRef();\n return element ? [...element.querySelectorAll<HTMLElement>('[role=\"alertdialog\"]')] : [];\n };\n\n const restoreLastFocused = () => {\n if (!lastFocused?.isConnected) {\n lastFocused = null;\n return;\n }\n\n if (getInteractionModality() === \"pointer\") {\n focusWithoutScrolling(lastFocused);\n } else {\n lastFocused.focus();\n }\n\n lastFocused = null;\n };\n\n const handleFocusIn = (e: FocusEvent) => {\n const currentTarget = e.currentTarget as HTMLElement;\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n\n if (!isFocused) {\n isFocused = true;\n if (relatedTarget && !currentTarget.contains(relatedTarget)) {\n lastFocused = relatedTarget;\n }\n updateTimers();\n }\n\n toastElements = getToastElements();\n const target =\n e.target instanceof Element ? e.target.closest<HTMLElement>('[role=\"alertdialog\"]') : null;\n focusedToastIndex = target ? toastElements.findIndex((toast) => toast === target) : -1;\n };\n\n const handleFocusOut = (e: FocusEvent) => {\n const target = e.relatedTarget as HTMLElement | null;\n const currentTarget = e.currentTarget as HTMLElement;\n if (!target || !currentTarget.contains(target)) {\n isFocused = false;\n focusedToastIndex = -1;\n updateTimers();\n }\n };\n\n createEffect(() => {\n const currentVisibleToasts = visibleToasts();\n const element = regionRef();\n\n if (focusedToastIndex === -1 || currentVisibleToasts.length === 0 || !element) {\n toastElements = [];\n previousVisibleToasts = currentVisibleToasts;\n return;\n }\n\n toastElements = getToastElements();\n\n const unchanged =\n previousVisibleToasts.length === currentVisibleToasts.length &&\n currentVisibleToasts.every((toast, index) => toast.key === previousVisibleToasts[index]?.key);\n\n if (unchanged) {\n previousVisibleToasts = currentVisibleToasts;\n return;\n }\n\n const allToasts = previousVisibleToasts.map((toast, index) => ({\n index,\n isRemoved: !currentVisibleToasts.some((currentToast) => currentToast.key === toast.key),\n }));\n const removedFocusedToastIndex = allToasts.findIndex(\n (toast) => toast.index === focusedToastIndex && toast.isRemoved,\n );\n\n if (removedFocusedToastIndex > -1) {\n if (getInteractionModality() === \"pointer\" && lastFocused?.isConnected) {\n focusWithoutScrolling(lastFocused);\n } else {\n let index = 0;\n let nextToast: number | undefined;\n let previousToast: number | undefined;\n\n while (index <= removedFocusedToastIndex) {\n if (!allToasts[index]?.isRemoved) {\n previousToast = Math.max(0, index - 1);\n }\n index++;\n }\n\n while (index < allToasts.length) {\n if (!allToasts[index]?.isRemoved) {\n nextToast = index - 1;\n break;\n }\n index++;\n }\n\n if (previousToast === undefined && nextToast === undefined) {\n previousToast = 0;\n }\n\n if (\n previousToast !== undefined &&\n previousToast >= 0 &&\n previousToast < toastElements.length\n ) {\n focusWithoutScrolling(toastElements[previousToast]);\n } else if (nextToast !== undefined && nextToast >= 0 && nextToast < toastElements.length) {\n focusWithoutScrolling(toastElements[nextToast]);\n }\n }\n }\n\n previousVisibleToasts = currentVisibleToasts;\n });\n\n createEffect(() => {\n if (visibleToasts().length === 0) {\n restoreLastFocused();\n }\n });\n\n onCleanup(() => {\n restoreLastFocused();\n });\n\n // Region props\n const regionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n ...landmarkProps,\n ...hoverProps,\n tabIndex: -1,\n \"data-solidaria-top-layer\": \"true\",\n onFocusIn: handleFocusIn,\n onFocusOut: handleFocusOut,\n }));\n\n return {\n get regionProps() {\n return regionProps();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,SAAgB,YAAe,OAAqC;CAClE,MAAM,UAAU,SAAS;CACzB,MAAM,gBAAgB,SAAS;CAC/B,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,iBAAiB,MAAM,kBAAkB;CAE/C,MAAM,cAAc;EAClB,MAAM,MAAM,MAAM,MAAM,MAAM,GAAG;CACnC;CAGA,MAAM,aAAa,kBAAmD;EACpE,MAAM;EACN,cAAc;EACd,mBAAmB,WAAW,UAAU,KAAA;EACxC,oBAAoB,iBAAiB,gBAAgB,KAAA;EACrD,UAAU;EAC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