@proyecto-viviana/solidaria 0.3.0 → 0.4.1

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 (743) hide show
  1. package/dist/_chunk/DragManager.js +627 -0
  2. package/dist/_chunk/DragManager.js.map +1 -0
  3. package/dist/_chunk/DragManager.jsx +627 -0
  4. package/dist/_chunk/DragManager.jsx.map +1 -0
  5. package/dist/_chunk/FocusScope.js +400 -0
  6. package/dist/_chunk/FocusScope.js.map +1 -0
  7. package/dist/_chunk/FocusScope.jsx +375 -0
  8. package/dist/_chunk/FocusScope.jsx.map +1 -0
  9. package/dist/_chunk/actiongroup.js +141 -0
  10. package/dist/_chunk/actiongroup.js.map +1 -0
  11. package/dist/_chunk/actiongroup.jsx +141 -0
  12. package/dist/_chunk/actiongroup.jsx.map +1 -0
  13. package/dist/_chunk/announce.js +207 -0
  14. package/dist/_chunk/announce.js.map +1 -0
  15. package/dist/_chunk/announce.jsx +207 -0
  16. package/dist/_chunk/announce.jsx.map +1 -0
  17. package/dist/_chunk/ariaHideOutside.js +122 -0
  18. package/dist/_chunk/ariaHideOutside.js.map +1 -0
  19. package/dist/_chunk/ariaHideOutside.jsx +122 -0
  20. package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
  21. package/dist/_chunk/autocomplete.js +244 -0
  22. package/dist/_chunk/autocomplete.js.map +1 -0
  23. package/dist/_chunk/autocomplete.jsx +244 -0
  24. package/dist/_chunk/autocomplete.jsx.map +1 -0
  25. package/dist/_chunk/breadcrumbs.js +121 -0
  26. package/dist/_chunk/breadcrumbs.js.map +1 -0
  27. package/dist/_chunk/breadcrumbs.jsx +121 -0
  28. package/dist/_chunk/breadcrumbs.jsx.map +1 -0
  29. package/dist/_chunk/button.js +275 -0
  30. package/dist/_chunk/button.js.map +1 -0
  31. package/dist/_chunk/button.jsx +275 -0
  32. package/dist/_chunk/button.jsx.map +1 -0
  33. package/dist/_chunk/calendar.js +1037 -0
  34. package/dist/_chunk/calendar.js.map +1 -0
  35. package/dist/_chunk/calendar.jsx +1037 -0
  36. package/dist/_chunk/calendar.jsx.map +1 -0
  37. package/dist/_chunk/checkbox.js +235 -0
  38. package/dist/_chunk/checkbox.js.map +1 -0
  39. package/dist/_chunk/checkbox.jsx +235 -0
  40. package/dist/_chunk/checkbox.jsx.map +1 -0
  41. package/dist/_chunk/color.js +1458 -0
  42. package/dist/_chunk/color.js.map +1 -0
  43. package/dist/_chunk/color.jsx +1458 -0
  44. package/dist/_chunk/color.jsx.map +1 -0
  45. package/dist/_chunk/combobox.js +1062 -0
  46. package/dist/_chunk/combobox.js.map +1 -0
  47. package/dist/_chunk/combobox.jsx +1062 -0
  48. package/dist/_chunk/combobox.jsx.map +1 -0
  49. package/dist/_chunk/constants.js +19 -0
  50. package/dist/_chunk/constants.js.map +1 -0
  51. package/dist/_chunk/constants.jsx +19 -0
  52. package/dist/_chunk/constants.jsx.map +1 -0
  53. package/dist/_chunk/createCollator.js +61 -0
  54. package/dist/_chunk/createCollator.js.map +1 -0
  55. package/dist/_chunk/createCollator.jsx +61 -0
  56. package/dist/_chunk/createCollator.jsx.map +1 -0
  57. package/dist/_chunk/createCollectionRowInteraction.js +133 -0
  58. package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
  59. package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
  60. package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
  61. package/dist/_chunk/createField.js +55 -0
  62. package/dist/_chunk/createField.js.map +1 -0
  63. package/dist/_chunk/createField.jsx +55 -0
  64. package/dist/_chunk/createField.jsx.map +1 -0
  65. package/dist/_chunk/createFocus.js +105 -0
  66. package/dist/_chunk/createFocus.js.map +1 -0
  67. package/dist/_chunk/createFocus.jsx +105 -0
  68. package/dist/_chunk/createFocus.jsx.map +1 -0
  69. package/dist/_chunk/createFocusRing.js +54 -0
  70. package/dist/_chunk/createFocusRing.js.map +1 -0
  71. package/dist/_chunk/createFocusRing.jsx +54 -0
  72. package/dist/_chunk/createFocusRing.jsx.map +1 -0
  73. package/dist/_chunk/createFocusWithin.js +120 -0
  74. package/dist/_chunk/createFocusWithin.js.map +1 -0
  75. package/dist/_chunk/createFocusWithin.jsx +120 -0
  76. package/dist/_chunk/createFocusWithin.jsx.map +1 -0
  77. package/dist/_chunk/createFocusable.js +131 -0
  78. package/dist/_chunk/createFocusable.js.map +1 -0
  79. package/dist/_chunk/createFocusable.jsx +131 -0
  80. package/dist/_chunk/createFocusable.jsx.map +1 -0
  81. package/dist/_chunk/createFormReset.js +39 -0
  82. package/dist/_chunk/createFormReset.js.map +1 -0
  83. package/dist/_chunk/createFormReset.jsx +39 -0
  84. package/dist/_chunk/createFormReset.jsx.map +1 -0
  85. package/dist/_chunk/createFormValidation.js +135 -0
  86. package/dist/_chunk/createFormValidation.js.map +1 -0
  87. package/dist/_chunk/createFormValidation.jsx +135 -0
  88. package/dist/_chunk/createFormValidation.jsx.map +1 -0
  89. package/dist/_chunk/createHover.js +131 -0
  90. package/dist/_chunk/createHover.js.map +1 -0
  91. package/dist/_chunk/createHover.jsx +131 -0
  92. package/dist/_chunk/createHover.jsx.map +1 -0
  93. package/dist/_chunk/createInteractionModality.js +268 -0
  94. package/dist/_chunk/createInteractionModality.js.map +1 -0
  95. package/dist/_chunk/createInteractionModality.jsx +268 -0
  96. package/dist/_chunk/createInteractionModality.jsx.map +1 -0
  97. package/dist/_chunk/createLabel.js +47 -0
  98. package/dist/_chunk/createLabel.js.map +1 -0
  99. package/dist/_chunk/createLabel.jsx +47 -0
  100. package/dist/_chunk/createLabel.jsx.map +1 -0
  101. package/dist/_chunk/createLabels.js +32 -0
  102. package/dist/_chunk/createLabels.js.map +1 -0
  103. package/dist/_chunk/createLabels.jsx +32 -0
  104. package/dist/_chunk/createLabels.jsx.map +1 -0
  105. package/dist/_chunk/createLandmark.js +198 -0
  106. package/dist/_chunk/createLandmark.js.map +1 -0
  107. package/dist/_chunk/createLandmark.jsx +198 -0
  108. package/dist/_chunk/createLandmark.jsx.map +1 -0
  109. package/dist/_chunk/createOverlay.js +327 -0
  110. package/dist/_chunk/createOverlay.js.map +1 -0
  111. package/dist/_chunk/createOverlay.jsx +327 -0
  112. package/dist/_chunk/createOverlay.jsx.map +1 -0
  113. package/dist/_chunk/createPress.js +526 -0
  114. package/dist/_chunk/createPress.js.map +1 -0
  115. package/dist/_chunk/createPress.jsx +526 -0
  116. package/dist/_chunk/createPress.jsx.map +1 -0
  117. package/dist/_chunk/createProgressBar.js +82 -0
  118. package/dist/_chunk/createProgressBar.js.map +1 -0
  119. package/dist/_chunk/createProgressBar.jsx +82 -0
  120. package/dist/_chunk/createProgressBar.jsx.map +1 -0
  121. package/dist/_chunk/createSelectableItem.js +302 -0
  122. package/dist/_chunk/createSelectableItem.js.map +1 -0
  123. package/dist/_chunk/createSelectableItem.jsx +302 -0
  124. package/dist/_chunk/createSelectableItem.jsx.map +1 -0
  125. package/dist/_chunk/createStringFormatter.js +61 -0
  126. package/dist/_chunk/createStringFormatter.js.map +1 -0
  127. package/dist/_chunk/createStringFormatter.jsx +61 -0
  128. package/dist/_chunk/createStringFormatter.jsx.map +1 -0
  129. package/dist/_chunk/createToggle.js +159 -0
  130. package/dist/_chunk/createToggle.js.map +1 -0
  131. package/dist/_chunk/createToggle.jsx +159 -0
  132. package/dist/_chunk/createToggle.jsx.map +1 -0
  133. package/dist/_chunk/createTypeSelect.js +125 -0
  134. package/dist/_chunk/createTypeSelect.js.map +1 -0
  135. package/dist/_chunk/createTypeSelect.jsx +125 -0
  136. package/dist/_chunk/createTypeSelect.jsx.map +1 -0
  137. package/dist/_chunk/datepicker.js +1706 -0
  138. package/dist/_chunk/datepicker.js.map +1 -0
  139. package/dist/_chunk/datepicker.jsx +1706 -0
  140. package/dist/_chunk/datepicker.jsx.map +1 -0
  141. package/dist/_chunk/dialog.js +62 -0
  142. package/dist/_chunk/dialog.js.map +1 -0
  143. package/dist/_chunk/dialog.jsx +62 -0
  144. package/dist/_chunk/dialog.jsx.map +1 -0
  145. package/dist/_chunk/disclosure.js +185 -0
  146. package/dist/_chunk/disclosure.js.map +1 -0
  147. package/dist/_chunk/disclosure.jsx +185 -0
  148. package/dist/_chunk/disclosure.jsx.map +1 -0
  149. package/dist/_chunk/dnd.js +2395 -0
  150. package/dist/_chunk/dnd.js.map +1 -0
  151. package/dist/_chunk/dnd.jsx +2395 -0
  152. package/dist/_chunk/dnd.jsx.map +1 -0
  153. package/dist/_chunk/env.js +87 -0
  154. package/dist/_chunk/env.js.map +1 -0
  155. package/dist/_chunk/env.jsx +87 -0
  156. package/dist/_chunk/env.jsx.map +1 -0
  157. package/dist/_chunk/filterDOMProps.js +82 -0
  158. package/dist/_chunk/filterDOMProps.js.map +1 -0
  159. package/dist/_chunk/filterDOMProps.jsx +82 -0
  160. package/dist/_chunk/filterDOMProps.jsx.map +1 -0
  161. package/dist/_chunk/focus.js +399 -0
  162. package/dist/_chunk/focus.js.map +1 -0
  163. package/dist/_chunk/focus.jsx +399 -0
  164. package/dist/_chunk/focus.jsx.map +1 -0
  165. package/dist/_chunk/focus2.js +631 -0
  166. package/dist/_chunk/focus2.js.map +1 -0
  167. package/dist/_chunk/focus2.jsx +631 -0
  168. package/dist/_chunk/focus2.jsx.map +1 -0
  169. package/dist/_chunk/grid.js +623 -0
  170. package/dist/_chunk/grid.js.map +1 -0
  171. package/dist/_chunk/grid.jsx +623 -0
  172. package/dist/_chunk/grid.jsx.map +1 -0
  173. package/dist/_chunk/gridlist.js +369 -0
  174. package/dist/_chunk/gridlist.js.map +1 -0
  175. package/dist/_chunk/gridlist.jsx +369 -0
  176. package/dist/_chunk/gridlist.jsx.map +1 -0
  177. package/dist/_chunk/i18n.js +199 -0
  178. package/dist/_chunk/i18n.js.map +1 -0
  179. package/dist/_chunk/i18n.jsx +199 -0
  180. package/dist/_chunk/i18n.jsx.map +1 -0
  181. package/dist/_chunk/interactions.js +331 -0
  182. package/dist/_chunk/interactions.js.map +1 -0
  183. package/dist/_chunk/interactions.jsx +325 -0
  184. package/dist/_chunk/interactions.jsx.map +1 -0
  185. package/dist/_chunk/link.js +97 -0
  186. package/dist/_chunk/link.js.map +1 -0
  187. package/dist/_chunk/link.jsx +97 -0
  188. package/dist/_chunk/link.jsx.map +1 -0
  189. package/dist/_chunk/listbox.js +356 -0
  190. package/dist/_chunk/listbox.js.map +1 -0
  191. package/dist/_chunk/listbox.jsx +356 -0
  192. package/dist/_chunk/listbox.jsx.map +1 -0
  193. package/dist/_chunk/locale.js +173 -0
  194. package/dist/_chunk/locale.js.map +1 -0
  195. package/dist/_chunk/locale.jsx +167 -0
  196. package/dist/_chunk/locale.jsx.map +1 -0
  197. package/dist/_chunk/menu.js +519 -0
  198. package/dist/_chunk/menu.js.map +1 -0
  199. package/dist/_chunk/menu.jsx +519 -0
  200. package/dist/_chunk/menu.jsx.map +1 -0
  201. package/dist/_chunk/meter.js +33 -0
  202. package/dist/_chunk/meter.js.map +1 -0
  203. package/dist/_chunk/meter.jsx +33 -0
  204. package/dist/_chunk/meter.jsx.map +1 -0
  205. package/dist/_chunk/numberfield.js +259 -0
  206. package/dist/_chunk/numberfield.js.map +1 -0
  207. package/dist/_chunk/numberfield.jsx +259 -0
  208. package/dist/_chunk/numberfield.jsx.map +1 -0
  209. package/dist/_chunk/overlays.js +186 -0
  210. package/dist/_chunk/overlays.js.map +1 -0
  211. package/dist/_chunk/overlays.jsx +162 -0
  212. package/dist/_chunk/overlays.jsx.map +1 -0
  213. package/dist/_chunk/popover.js +574 -0
  214. package/dist/_chunk/popover.js.map +1 -0
  215. package/dist/_chunk/popover.jsx +574 -0
  216. package/dist/_chunk/popover.jsx.map +1 -0
  217. package/dist/_chunk/radio.js +320 -0
  218. package/dist/_chunk/radio.js.map +1 -0
  219. package/dist/_chunk/radio.jsx +320 -0
  220. package/dist/_chunk/radio.jsx.map +1 -0
  221. package/dist/_chunk/reactivity.js +21 -0
  222. package/dist/_chunk/reactivity.js.map +1 -0
  223. package/dist/_chunk/reactivity.jsx +21 -0
  224. package/dist/_chunk/reactivity.jsx.map +1 -0
  225. package/dist/_chunk/searchfield.js +210 -0
  226. package/dist/_chunk/searchfield.js.map +1 -0
  227. package/dist/_chunk/searchfield.jsx +210 -0
  228. package/dist/_chunk/searchfield.jsx.map +1 -0
  229. package/dist/_chunk/select.js +406 -0
  230. package/dist/_chunk/select.js.map +1 -0
  231. package/dist/_chunk/select.jsx +397 -0
  232. package/dist/_chunk/select.jsx.map +1 -0
  233. package/dist/_chunk/selection.js +666 -0
  234. package/dist/_chunk/selection.js.map +1 -0
  235. package/dist/_chunk/selection.jsx +666 -0
  236. package/dist/_chunk/selection.jsx.map +1 -0
  237. package/dist/_chunk/separator.js +29 -0
  238. package/dist/_chunk/separator.js.map +1 -0
  239. package/dist/_chunk/separator.jsx +29 -0
  240. package/dist/_chunk/separator.jsx.map +1 -0
  241. package/dist/_chunk/slider.js +256 -0
  242. package/dist/_chunk/slider.js.map +1 -0
  243. package/dist/_chunk/slider.jsx +256 -0
  244. package/dist/_chunk/slider.jsx.map +1 -0
  245. package/dist/_chunk/spinbutton.js +153 -0
  246. package/dist/_chunk/spinbutton.js.map +1 -0
  247. package/dist/_chunk/spinbutton.jsx +153 -0
  248. package/dist/_chunk/spinbutton.jsx.map +1 -0
  249. package/dist/_chunk/steplist.js +66 -0
  250. package/dist/_chunk/steplist.js.map +1 -0
  251. package/dist/_chunk/steplist.jsx +66 -0
  252. package/dist/_chunk/steplist.jsx.map +1 -0
  253. package/dist/_chunk/switch.js +34 -0
  254. package/dist/_chunk/switch.js.map +1 -0
  255. package/dist/_chunk/switch.jsx +34 -0
  256. package/dist/_chunk/switch.jsx.map +1 -0
  257. package/dist/_chunk/table.js +1088 -0
  258. package/dist/_chunk/table.js.map +1 -0
  259. package/dist/_chunk/table.jsx +1088 -0
  260. package/dist/_chunk/table.jsx.map +1 -0
  261. package/dist/_chunk/tabs.js +263 -0
  262. package/dist/_chunk/tabs.js.map +1 -0
  263. package/dist/_chunk/tabs.jsx +263 -0
  264. package/dist/_chunk/tabs.jsx.map +1 -0
  265. package/dist/_chunk/tag.js +322 -0
  266. package/dist/_chunk/tag.js.map +1 -0
  267. package/dist/_chunk/tag.jsx +322 -0
  268. package/dist/_chunk/tag.jsx.map +1 -0
  269. package/dist/_chunk/textfield.js +110 -0
  270. package/dist/_chunk/textfield.js.map +1 -0
  271. package/dist/_chunk/textfield.jsx +110 -0
  272. package/dist/_chunk/textfield.jsx.map +1 -0
  273. package/dist/_chunk/toast.js +250 -0
  274. package/dist/_chunk/toast.js.map +1 -0
  275. package/dist/_chunk/toast.jsx +250 -0
  276. package/dist/_chunk/toast.jsx.map +1 -0
  277. package/dist/_chunk/toolbar.js +226 -0
  278. package/dist/_chunk/toolbar.js.map +1 -0
  279. package/dist/_chunk/toolbar.jsx +226 -0
  280. package/dist/_chunk/toolbar.jsx.map +1 -0
  281. package/dist/_chunk/tooltip.js +185 -0
  282. package/dist/_chunk/tooltip.js.map +1 -0
  283. package/dist/_chunk/tooltip.jsx +185 -0
  284. package/dist/_chunk/tooltip.jsx.map +1 -0
  285. package/dist/_chunk/tree.js +452 -0
  286. package/dist/_chunk/tree.js.map +1 -0
  287. package/dist/_chunk/tree.jsx +452 -0
  288. package/dist/_chunk/tree.jsx.map +1 -0
  289. package/dist/_chunk/utils.js +705 -0
  290. package/dist/_chunk/utils.js.map +1 -0
  291. package/dist/_chunk/utils.jsx +705 -0
  292. package/dist/_chunk/utils.jsx.map +1 -0
  293. package/dist/_chunk/visually-hidden.js +93 -0
  294. package/dist/_chunk/visually-hidden.js.map +1 -0
  295. package/dist/_chunk/visually-hidden.jsx +93 -0
  296. package/dist/_chunk/visually-hidden.jsx.map +1 -0
  297. package/dist/actiongroup/createActionGroup.d.ts.map +1 -1
  298. package/dist/actiongroup/index.js +2 -0
  299. package/dist/actiongroup/index.jsx +2 -0
  300. package/dist/autocomplete/createAutocomplete.d.ts +12 -7
  301. package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
  302. package/dist/autocomplete/index.js +2 -0
  303. package/dist/autocomplete/index.jsx +2 -0
  304. package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
  305. package/dist/breadcrumbs/index.js +2 -0
  306. package/dist/breadcrumbs/index.jsx +2 -0
  307. package/dist/button/createToggleButtonGroup.d.ts.map +1 -1
  308. package/dist/button/index.js +2 -0
  309. package/dist/button/index.jsx +2 -0
  310. package/dist/calendar/createCalendar.d.ts.map +1 -1
  311. package/dist/calendar/createCalendarCell.d.ts.map +1 -1
  312. package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
  313. package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
  314. package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
  315. package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
  316. package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
  317. package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
  318. package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
  319. package/dist/calendar/index.d.ts +2 -0
  320. package/dist/calendar/index.d.ts.map +1 -1
  321. package/dist/calendar/index.js +2 -0
  322. package/dist/calendar/index.jsx +2 -0
  323. package/dist/calendar/intl/index.d.ts +1 -1
  324. package/dist/calendar/intl/index.d.ts.map +1 -1
  325. package/dist/calendar/utils.d.ts +4 -0
  326. package/dist/calendar/utils.d.ts.map +1 -1
  327. package/dist/checkbox/createCheckbox.d.ts +4 -0
  328. package/dist/checkbox/createCheckbox.d.ts.map +1 -1
  329. package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
  330. package/dist/checkbox/index.js +2 -0
  331. package/dist/checkbox/index.jsx +2 -0
  332. package/dist/collections/index.js +160 -0
  333. package/dist/collections/index.js.map +1 -0
  334. package/dist/collections/index.jsx +160 -0
  335. package/dist/collections/index.jsx.map +1 -0
  336. package/dist/color/createColorArea.d.ts.map +1 -1
  337. package/dist/color/createColorField.d.ts.map +1 -1
  338. package/dist/color/createColorSlider.d.ts.map +1 -1
  339. package/dist/color/createColorSwatch.d.ts.map +1 -1
  340. package/dist/color/createColorWheel.d.ts.map +1 -1
  341. package/dist/color/index.js +2 -0
  342. package/dist/color/index.jsx +2 -0
  343. package/dist/color/intl/index.d.ts +30 -0
  344. package/dist/color/intl/index.d.ts.map +1 -0
  345. package/dist/combobox/createComboBox.d.ts.map +1 -1
  346. package/dist/combobox/index.js +2 -0
  347. package/dist/combobox/index.jsx +2 -0
  348. package/dist/combobox/intl/generated-locales.d.ts +16 -0
  349. package/dist/combobox/intl/generated-locales.d.ts.map +1 -0
  350. package/dist/combobox/intl/index.d.ts +2 -2
  351. package/dist/combobox/intl/index.d.ts.map +1 -1
  352. package/dist/datepicker/createDateField.d.ts +45 -23
  353. package/dist/datepicker/createDateField.d.ts.map +1 -1
  354. package/dist/datepicker/createDatePicker.d.ts +34 -6
  355. package/dist/datepicker/createDatePicker.d.ts.map +1 -1
  356. package/dist/datepicker/createDatePickerGroup.d.ts +13 -13
  357. package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -1
  358. package/dist/datepicker/createDateRangePicker.d.ts +55 -7
  359. package/dist/datepicker/createDateRangePicker.d.ts.map +1 -1
  360. package/dist/datepicker/createDateSegment.d.ts +6 -15
  361. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  362. package/dist/datepicker/createDisplayNames.d.ts +17 -0
  363. package/dist/datepicker/createDisplayNames.d.ts.map +1 -0
  364. package/dist/datepicker/createTimeField.d.ts +12 -49
  365. package/dist/datepicker/createTimeField.d.ts.map +1 -1
  366. package/dist/datepicker/index.d.ts +3 -3
  367. package/dist/datepicker/index.d.ts.map +1 -1
  368. package/dist/datepicker/index.js +2 -0
  369. package/dist/datepicker/index.jsx +2 -0
  370. package/dist/datepicker/intl.d.ts +12 -0
  371. package/dist/datepicker/intl.d.ts.map +1 -0
  372. package/dist/dialog/index.js +2 -0
  373. package/dist/dialog/index.jsx +2 -0
  374. package/dist/disclosure/index.js +2 -0
  375. package/dist/disclosure/index.jsx +2 -0
  376. package/dist/dnd/DragManager.d.ts +86 -0
  377. package/dist/dnd/DragManager.d.ts.map +1 -0
  378. package/dist/dnd/DropTargetKeyboardNavigation.d.ts +42 -0
  379. package/dist/dnd/DropTargetKeyboardNavigation.d.ts.map +1 -0
  380. package/dist/dnd/createDrag.d.ts.map +1 -1
  381. package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
  382. package/dist/dnd/createDraggableItem.d.ts +12 -7
  383. package/dist/dnd/createDraggableItem.d.ts.map +1 -1
  384. package/dist/dnd/createDroppableCollection.d.ts +7 -15
  385. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  386. package/dist/dnd/index.d.ts +5 -1
  387. package/dist/dnd/index.d.ts.map +1 -1
  388. package/dist/dnd/index.js +3 -0
  389. package/dist/dnd/index.jsx +3 -0
  390. package/dist/dnd/intl/index.d.ts +39 -0
  391. package/dist/dnd/intl/index.d.ts.map +1 -0
  392. package/dist/dnd/utils.d.ts +7 -2
  393. package/dist/dnd/utils.d.ts.map +1 -1
  394. package/dist/focus/FocusScope.d.ts +7 -0
  395. package/dist/focus/FocusScope.d.ts.map +1 -1
  396. package/dist/focus/index.d.ts +2 -1
  397. package/dist/focus/index.d.ts.map +1 -1
  398. package/dist/focus/index.js +3 -0
  399. package/dist/focus/index.jsx +3 -0
  400. package/dist/focus/virtualFocus.d.ts +26 -0
  401. package/dist/focus/virtualFocus.d.ts.map +1 -0
  402. package/dist/form/createFormValidation.d.ts.map +1 -1
  403. package/dist/form/index.js +3 -0
  404. package/dist/form/index.jsx +3 -0
  405. package/dist/grid/index.js +2 -0
  406. package/dist/grid/index.jsx +2 -0
  407. package/dist/gridlist/createGridList.d.ts +7 -1
  408. package/dist/gridlist/createGridList.d.ts.map +1 -1
  409. package/dist/gridlist/createGridListItem.d.ts +1 -1
  410. package/dist/gridlist/createGridListItem.d.ts.map +1 -1
  411. package/dist/gridlist/createGridListSection.d.ts +15 -0
  412. package/dist/gridlist/createGridListSection.d.ts.map +1 -0
  413. package/dist/gridlist/index.d.ts +2 -1
  414. package/dist/gridlist/index.d.ts.map +1 -1
  415. package/dist/gridlist/index.js +2 -0
  416. package/dist/gridlist/index.jsx +2 -0
  417. package/dist/gridlist/types.d.ts +50 -0
  418. package/dist/gridlist/types.d.ts.map +1 -1
  419. package/dist/i18n/index.js +5 -0
  420. package/dist/i18n/index.jsx +5 -0
  421. package/dist/index.d.ts +10 -6
  422. package/dist/index.d.ts.map +1 -1
  423. package/dist/index.js +77 -18311
  424. package/dist/index.jsx +77 -18242
  425. package/dist/interactions/FocusableProvider.d.ts.map +1 -1
  426. package/dist/interactions/PressEvent.d.ts +11 -0
  427. package/dist/interactions/PressEvent.d.ts.map +1 -1
  428. package/dist/interactions/createFocus.d.ts.map +1 -1
  429. package/dist/interactions/createFocusWithin.d.ts.map +1 -1
  430. package/dist/interactions/createInteractionModality.d.ts +0 -1
  431. package/dist/interactions/createInteractionModality.d.ts.map +1 -1
  432. package/dist/interactions/createKeyboard.d.ts.map +1 -1
  433. package/dist/interactions/createPress.d.ts.map +1 -1
  434. package/dist/interactions/index.js +9 -0
  435. package/dist/interactions/index.jsx +9 -0
  436. package/dist/label/createLabels.d.ts.map +1 -1
  437. package/dist/label/index.js +4 -0
  438. package/dist/label/index.jsx +4 -0
  439. package/dist/landmark/index.js +2 -0
  440. package/dist/landmark/index.jsx +2 -0
  441. package/dist/link/index.js +2 -0
  442. package/dist/link/index.jsx +2 -0
  443. package/dist/listbox/createListBox.d.ts +37 -0
  444. package/dist/listbox/createListBox.d.ts.map +1 -1
  445. package/dist/listbox/createOption.d.ts +7 -1
  446. package/dist/listbox/createOption.d.ts.map +1 -1
  447. package/dist/listbox/index.js +2 -0
  448. package/dist/listbox/index.jsx +2 -0
  449. package/dist/live-announcer/index.js +2 -0
  450. package/dist/live-announcer/index.jsx +2 -0
  451. package/dist/menu/createMenu.d.ts +7 -4
  452. package/dist/menu/createMenu.d.ts.map +1 -1
  453. package/dist/menu/createMenuItem.d.ts +9 -1
  454. package/dist/menu/createMenuItem.d.ts.map +1 -1
  455. package/dist/menu/index.js +2 -0
  456. package/dist/menu/index.jsx +2 -0
  457. package/dist/meter/index.js +2 -0
  458. package/dist/meter/index.jsx +2 -0
  459. package/dist/numberfield/createNumberField.d.ts.map +1 -1
  460. package/dist/numberfield/index.js +2 -0
  461. package/dist/numberfield/index.jsx +2 -0
  462. package/dist/overlays/index.js +4 -0
  463. package/dist/overlays/index.jsx +4 -0
  464. package/dist/popover/calculatePosition.d.ts +2 -0
  465. package/dist/popover/calculatePosition.d.ts.map +1 -1
  466. package/dist/popover/createOverlayPosition.d.ts +8 -0
  467. package/dist/popover/createOverlayPosition.d.ts.map +1 -1
  468. package/dist/popover/index.js +2 -0
  469. package/dist/popover/index.jsx +2 -0
  470. package/dist/progress/index.js +2 -0
  471. package/dist/progress/index.jsx +2 -0
  472. package/dist/radio/createRadio.d.ts +2 -0
  473. package/dist/radio/createRadio.d.ts.map +1 -1
  474. package/dist/radio/index.js +2 -0
  475. package/dist/radio/index.jsx +2 -0
  476. package/dist/searchfield/index.js +2 -0
  477. package/dist/searchfield/index.jsx +2 -0
  478. package/dist/select/createSelect.d.ts +2 -0
  479. package/dist/select/createSelect.d.ts.map +1 -1
  480. package/dist/select/index.js +2 -0
  481. package/dist/select/index.jsx +2 -0
  482. package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
  483. package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
  484. package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
  485. package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
  486. package/dist/selection/constants.d.ts +15 -0
  487. package/dist/selection/constants.d.ts.map +1 -0
  488. package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
  489. package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
  490. package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
  491. package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
  492. package/dist/selection/createSelectableCollection.d.ts +69 -0
  493. package/dist/selection/createSelectableCollection.d.ts.map +1 -0
  494. package/dist/selection/createSelectableItem.d.ts +154 -0
  495. package/dist/selection/createSelectableItem.d.ts.map +1 -0
  496. package/dist/selection/createSelectableList.d.ts +43 -0
  497. package/dist/selection/createSelectableList.d.ts.map +1 -0
  498. package/dist/selection/createTypeSelect.d.ts.map +1 -1
  499. package/dist/selection/index.d.ts +9 -0
  500. package/dist/selection/index.d.ts.map +1 -1
  501. package/dist/selection/index.js +5 -0
  502. package/dist/selection/index.jsx +5 -0
  503. package/dist/selection/selectItem.d.ts +29 -0
  504. package/dist/selection/selectItem.d.ts.map +1 -0
  505. package/dist/selection/utils.d.ts +40 -0
  506. package/dist/selection/utils.d.ts.map +1 -0
  507. package/dist/separator/index.js +2 -0
  508. package/dist/separator/index.jsx +2 -0
  509. package/dist/slider/createSlider.d.ts.map +1 -1
  510. package/dist/slider/index.js +2 -0
  511. package/dist/slider/index.jsx +2 -0
  512. package/dist/spinbutton/createSpinButton.d.ts +41 -0
  513. package/dist/spinbutton/createSpinButton.d.ts.map +1 -0
  514. package/dist/spinbutton/index.d.ts +3 -0
  515. package/dist/spinbutton/index.d.ts.map +1 -0
  516. package/dist/spinbutton/index.js +2 -0
  517. package/dist/spinbutton/index.jsx +2 -0
  518. package/dist/spinbutton/intl.d.ts +5 -0
  519. package/dist/spinbutton/intl.d.ts.map +1 -0
  520. package/dist/ssr/index.d.ts +17 -0
  521. package/dist/ssr/index.d.ts.map +1 -1
  522. package/dist/ssr/index.js +299 -0
  523. package/dist/ssr/index.js.map +1 -0
  524. package/dist/ssr/index.jsx +292 -0
  525. package/dist/ssr/index.jsx.map +1 -0
  526. package/dist/steplist/index.js +2 -0
  527. package/dist/steplist/index.jsx +2 -0
  528. package/dist/switch/createSwitch.d.ts +4 -0
  529. package/dist/switch/createSwitch.d.ts.map +1 -1
  530. package/dist/switch/index.js +2 -0
  531. package/dist/switch/index.jsx +2 -0
  532. package/dist/table/createTable.d.ts.map +1 -1
  533. package/dist/table/createTableColumnHeader.d.ts.map +1 -1
  534. package/dist/table/createTableRow.d.ts +1 -1
  535. package/dist/table/createTableRow.d.ts.map +1 -1
  536. package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
  537. package/dist/table/createTableSelectionCheckbox.d.ts.map +1 -1
  538. package/dist/table/index.js +2 -0
  539. package/dist/table/index.jsx +2 -0
  540. package/dist/table/types.d.ts +35 -1
  541. package/dist/table/types.d.ts.map +1 -1
  542. package/dist/table/utils.d.ts +15 -0
  543. package/dist/table/utils.d.ts.map +1 -0
  544. package/dist/tabs/createTabs.d.ts +5 -3
  545. package/dist/tabs/createTabs.d.ts.map +1 -1
  546. package/dist/tabs/index.js +2 -0
  547. package/dist/tabs/index.jsx +2 -0
  548. package/dist/tag/createTag.d.ts +2 -0
  549. package/dist/tag/createTag.d.ts.map +1 -1
  550. package/dist/tag/createTagGroup.d.ts +7 -0
  551. package/dist/tag/createTagGroup.d.ts.map +1 -1
  552. package/dist/tag/index.js +2 -0
  553. package/dist/tag/index.jsx +2 -0
  554. package/dist/textfield/index.js +2 -0
  555. package/dist/textfield/index.jsx +2 -0
  556. package/dist/toast/createToast.d.ts.map +1 -1
  557. package/dist/toast/index.js +2 -0
  558. package/dist/toast/index.jsx +2 -0
  559. package/dist/toggle/createToggle.d.ts +4 -0
  560. package/dist/toggle/createToggle.d.ts.map +1 -1
  561. package/dist/toggle/index.js +3 -0
  562. package/dist/toggle/index.jsx +3 -0
  563. package/dist/toolbar/createToolbar.d.ts +1 -1
  564. package/dist/toolbar/createToolbar.d.ts.map +1 -1
  565. package/dist/toolbar/index.js +2 -0
  566. package/dist/toolbar/index.jsx +2 -0
  567. package/dist/tooltip/index.js +2 -0
  568. package/dist/tooltip/index.jsx +2 -0
  569. package/dist/tree/createTree.d.ts +5 -1
  570. package/dist/tree/createTree.d.ts.map +1 -1
  571. package/dist/tree/createTreeItem.d.ts +1 -1
  572. package/dist/tree/createTreeItem.d.ts.map +1 -1
  573. package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
  574. package/dist/tree/index.js +2 -0
  575. package/dist/tree/index.jsx +2 -0
  576. package/dist/tree/types.d.ts +10 -0
  577. package/dist/tree/types.d.ts.map +1 -1
  578. package/dist/utils/animation.d.ts +60 -0
  579. package/dist/utils/animation.d.ts.map +1 -0
  580. package/dist/utils/dom.d.ts +49 -2
  581. package/dist/utils/dom.d.ts.map +1 -1
  582. package/dist/utils/index.d.ts +4 -1
  583. package/dist/utils/index.d.ts.map +1 -1
  584. package/dist/utils/index.js +6 -0
  585. package/dist/utils/index.jsx +6 -0
  586. package/dist/utils/keyboard.d.ts +17 -0
  587. package/dist/utils/keyboard.d.ts.map +1 -0
  588. package/dist/utils/mergeProps.d.ts.map +1 -1
  589. package/dist/utils/scrollIntoView.d.ts +30 -0
  590. package/dist/utils/scrollIntoView.d.ts.map +1 -0
  591. package/dist/visually-hidden/index.js +2 -0
  592. package/dist/visually-hidden/index.jsx +2 -0
  593. package/package.json +304 -3
  594. package/src/actiongroup/createActionGroup.ts +26 -109
  595. package/src/autocomplete/createAutocomplete.ts +202 -35
  596. package/src/breadcrumbs/createBreadcrumbs.ts +12 -4
  597. package/src/button/createToggleButtonGroup.ts +19 -14
  598. package/src/calendar/createCalendar.ts +5 -4
  599. package/src/calendar/createCalendarCell.ts +36 -5
  600. package/src/calendar/createCalendarGrid.ts +47 -12
  601. package/src/calendar/createCalendarMonthPicker.ts +105 -0
  602. package/src/calendar/createCalendarYearPicker.ts +144 -0
  603. package/src/calendar/createRangeCalendar.ts +27 -15
  604. package/src/calendar/createRangeCalendarCell.ts +17 -3
  605. package/src/calendar/index.ts +17 -0
  606. package/src/calendar/intl/index.ts +8 -0
  607. package/src/calendar/utils.ts +4 -0
  608. package/src/checkbox/createCheckbox.ts +10 -0
  609. package/src/checkbox/createCheckboxGroupItem.ts +12 -16
  610. package/src/color/createColorArea.ts +17 -10
  611. package/src/color/createColorField.ts +8 -1
  612. package/src/color/createColorSlider.ts +1 -2
  613. package/src/color/createColorSwatch.ts +4 -2
  614. package/src/color/createColorWheel.ts +0 -6
  615. package/src/color/intl/index.ts +316 -0
  616. package/src/combobox/createComboBox.ts +35 -4
  617. package/src/combobox/intl/generated-locales.ts +635 -0
  618. package/src/combobox/intl/index.ts +8 -2
  619. package/src/datepicker/createDateField.ts +228 -213
  620. package/src/datepicker/createDatePicker.ts +157 -146
  621. package/src/datepicker/createDatePickerGroup.ts +88 -82
  622. package/src/datepicker/createDateRangePicker.ts +230 -179
  623. package/src/datepicker/createDateSegment.ts +386 -384
  624. package/src/datepicker/createDisplayNames.ts +45 -0
  625. package/src/datepicker/createTimeField.ts +36 -129
  626. package/src/datepicker/index.ts +13 -14
  627. package/src/datepicker/intl.ts +633 -0
  628. package/src/dnd/DragManager.ts +693 -0
  629. package/src/dnd/DropTargetKeyboardNavigation.ts +337 -0
  630. package/src/dnd/createDrag.ts +31 -5
  631. package/src/dnd/createDraggableCollection.ts +33 -15
  632. package/src/dnd/createDraggableItem.ts +92 -5
  633. package/src/dnd/createDroppableCollection.ts +488 -371
  634. package/src/dnd/index.ts +11 -0
  635. package/src/dnd/intl/ar-AE.json +29 -0
  636. package/src/dnd/intl/bg-BG.json +29 -0
  637. package/src/dnd/intl/cs-CZ.json +29 -0
  638. package/src/dnd/intl/da-DK.json +29 -0
  639. package/src/dnd/intl/de-DE.json +29 -0
  640. package/src/dnd/intl/el-GR.json +29 -0
  641. package/src/dnd/intl/en-US.json +29 -0
  642. package/src/dnd/intl/es-ES.json +29 -0
  643. package/src/dnd/intl/et-EE.json +29 -0
  644. package/src/dnd/intl/fi-FI.json +29 -0
  645. package/src/dnd/intl/fr-FR.json +29 -0
  646. package/src/dnd/intl/he-IL.json +29 -0
  647. package/src/dnd/intl/hr-HR.json +29 -0
  648. package/src/dnd/intl/hu-HU.json +29 -0
  649. package/src/dnd/intl/index.ts +139 -0
  650. package/src/dnd/intl/it-IT.json +29 -0
  651. package/src/dnd/intl/ja-JP.json +29 -0
  652. package/src/dnd/intl/ko-KR.json +29 -0
  653. package/src/dnd/intl/lt-LT.json +29 -0
  654. package/src/dnd/intl/lv-LV.json +29 -0
  655. package/src/dnd/intl/nb-NO.json +29 -0
  656. package/src/dnd/intl/nl-NL.json +29 -0
  657. package/src/dnd/intl/pl-PL.json +29 -0
  658. package/src/dnd/intl/pt-BR.json +29 -0
  659. package/src/dnd/intl/pt-PT.json +29 -0
  660. package/src/dnd/intl/ro-RO.json +29 -0
  661. package/src/dnd/intl/ru-RU.json +29 -0
  662. package/src/dnd/intl/sk-SK.json +29 -0
  663. package/src/dnd/intl/sl-SI.json +29 -0
  664. package/src/dnd/intl/sr-SP.json +29 -0
  665. package/src/dnd/intl/sv-SE.json +29 -0
  666. package/src/dnd/intl/tr-TR.json +29 -0
  667. package/src/dnd/intl/uk-UA.json +29 -0
  668. package/src/dnd/intl/zh-CN.json +29 -0
  669. package/src/dnd/intl/zh-TW.json +29 -0
  670. package/src/dnd/utils.ts +63 -3
  671. package/src/focus/FocusScope.tsx +266 -24
  672. package/src/focus/index.ts +8 -0
  673. package/src/focus/virtualFocus.ts +55 -0
  674. package/src/form/createFormValidation.ts +8 -1
  675. package/src/gridlist/createGridList.ts +187 -48
  676. package/src/gridlist/createGridListItem.ts +87 -155
  677. package/src/gridlist/createGridListSection.ts +54 -0
  678. package/src/gridlist/index.ts +3 -0
  679. package/src/gridlist/types.ts +47 -0
  680. package/src/index.ts +51 -3
  681. package/src/interactions/FocusableProvider.tsx +11 -6
  682. package/src/interactions/PressEvent.ts +14 -0
  683. package/src/interactions/createFocus.ts +26 -21
  684. package/src/interactions/createFocusWithin.ts +23 -24
  685. package/src/interactions/createInteractionModality.ts +26 -15
  686. package/src/interactions/createKeyboard.ts +10 -0
  687. package/src/interactions/createPress.ts +29 -6
  688. package/src/label/createLabels.ts +7 -4
  689. package/src/listbox/createListBox.ts +203 -10
  690. package/src/listbox/createOption.ts +84 -74
  691. package/src/menu/createMenu.ts +93 -16
  692. package/src/menu/createMenuItem.ts +253 -41
  693. package/src/numberfield/createNumberField.ts +82 -14
  694. package/src/popover/calculatePosition.ts +19 -7
  695. package/src/popover/createOverlayPosition.ts +9 -0
  696. package/src/radio/createRadio.ts +19 -2
  697. package/src/select/createSelect.ts +41 -4
  698. package/src/selection/DOMLayoutDelegate.ts +102 -0
  699. package/src/selection/ListKeyboardDelegate.ts +398 -0
  700. package/src/selection/constants.ts +16 -0
  701. package/src/selection/createCollectionRowInteraction.ts +209 -0
  702. package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
  703. package/src/selection/createSelectableCollection.ts +645 -0
  704. package/src/selection/createSelectableItem.ts +512 -0
  705. package/src/selection/createSelectableList.ts +93 -0
  706. package/src/selection/createTypeSelect.ts +112 -51
  707. package/src/selection/index.ts +31 -0
  708. package/src/selection/selectItem.ts +80 -0
  709. package/src/selection/utils.ts +82 -0
  710. package/src/slider/createSlider.ts +48 -1
  711. package/src/spinbutton/createSpinButton.ts +163 -0
  712. package/src/spinbutton/index.ts +10 -0
  713. package/src/spinbutton/intl.ts +115 -0
  714. package/src/ssr/index.tsx +31 -0
  715. package/src/switch/createSwitch.ts +10 -0
  716. package/src/table/createTable.ts +82 -27
  717. package/src/table/createTableColumnHeader.ts +10 -0
  718. package/src/table/createTableRow.ts +208 -203
  719. package/src/table/createTableSelectAllCheckbox.ts +3 -4
  720. package/src/table/createTableSelectionCheckbox.ts +24 -1
  721. package/src/table/types.ts +37 -1
  722. package/src/table/utils.ts +41 -0
  723. package/src/tabs/createTabs.ts +95 -24
  724. package/src/tag/createTag.ts +30 -36
  725. package/src/tag/createTagGroup.ts +92 -0
  726. package/src/toast/createToast.ts +1 -0
  727. package/src/toggle/createToggle.ts +20 -0
  728. package/src/toolbar/createToolbar.ts +43 -94
  729. package/src/tree/createTree.ts +165 -52
  730. package/src/tree/createTreeItem.ts +105 -120
  731. package/src/tree/createTreeSelectionCheckbox.ts +14 -1
  732. package/src/tree/types.ts +10 -0
  733. package/src/utils/animation.ts +243 -0
  734. package/src/utils/dom.ts +216 -25
  735. package/src/utils/index.ts +10 -0
  736. package/src/utils/keyboard.ts +25 -0
  737. package/src/utils/mergeProps.ts +8 -1
  738. package/src/utils/scrollIntoView.ts +181 -0
  739. package/dist/datepicker/createTimeSegment.d.ts +0 -29
  740. package/dist/datepicker/createTimeSegment.d.ts.map +0 -1
  741. package/dist/index.js.map +0 -1
  742. package/dist/index.jsx.map +0 -1
  743. package/src/datepicker/createTimeSegment.ts +0 -352
@@ -0,0 +1,110 @@
1
+ import { i as mergeProps } from "./env.jsx";
2
+ import { t as filterDOMProps } from "./filterDOMProps.jsx";
3
+ import { t as access } from "./reactivity.jsx";
4
+ import { n as createFocusable } from "./createFocusable.jsx";
5
+ import { t as createField } from "./createField.jsx";
6
+ //#region src/textfield/createTextField.ts
7
+ /**
8
+ * Provides the behavior and accessibility implementation for a text field.
9
+ * Text fields allow users to input text with a keyboard.
10
+ *
11
+ * @param props - Props for the text field.
12
+ * @param ref - Optional ref callback for the input element.
13
+ */
14
+ function createTextField(props, ref) {
15
+ const getProps = () => access(props);
16
+ let lastInputValue;
17
+ const eventWithCurrentTarget = (event, element) => new Proxy(event, { get(target, property, receiver) {
18
+ if (property === "target" || property === "currentTarget") return element;
19
+ const value = Reflect.get(target, property, receiver);
20
+ return typeof value === "function" ? value.bind(target) : value;
21
+ } });
22
+ const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField(props);
23
+ const { focusableProps } = createFocusable({
24
+ get isDisabled() {
25
+ return getProps().isDisabled;
26
+ },
27
+ get autoFocus() {
28
+ return getProps().autoFocus;
29
+ },
30
+ get excludeFromTabOrder() {
31
+ return getProps().excludeFromTabOrder;
32
+ },
33
+ onFocus: getProps().onFocus,
34
+ onBlur: getProps().onBlur,
35
+ onFocusChange: getProps().onFocusChange,
36
+ onKeyDown: getProps().onKeyDown,
37
+ onKeyUp: getProps().onKeyUp
38
+ }, ref);
39
+ const getDomProps = () => filterDOMProps(getProps(), { labelable: true });
40
+ const getInputProps = () => {
41
+ const p = getProps();
42
+ const isInvalid = p.isInvalid ?? false;
43
+ const isTextarea = p.inputElementType === "textarea";
44
+ const validationBehavior = p.validationBehavior ?? "native";
45
+ return mergeProps(getDomProps(), {
46
+ disabled: p.isDisabled,
47
+ readOnly: p.isReadOnly,
48
+ required: validationBehavior === "native" && p.isRequired,
49
+ "aria-required": validationBehavior === "aria" && p.isRequired || void 0,
50
+ "aria-invalid": isInvalid || void 0,
51
+ value: p.value ?? p.defaultValue ?? "",
52
+ onChange: (e) => {
53
+ const target = e.target;
54
+ if (target.value !== lastInputValue) p.onChange?.(target.value);
55
+ },
56
+ type: isTextarea ? void 0 : p.type ?? "text",
57
+ inputMode: p.inputMode,
58
+ enterKeyHint: p.enterKeyHint,
59
+ name: p.name,
60
+ form: p.form,
61
+ pattern: isTextarea ? void 0 : p.pattern,
62
+ maxLength: p.maxLength,
63
+ minLength: p.minLength,
64
+ placeholder: p.placeholder,
65
+ autoComplete: p.autoComplete,
66
+ autoCorrect: p.autoCorrect,
67
+ autoCapitalize: p.autoCapitalize,
68
+ spellCheck: p.spellCheck,
69
+ onCopy: p.onCopy,
70
+ onCut: p.onCut,
71
+ onPaste: p.onPaste,
72
+ onCompositionStart: p.onCompositionStart,
73
+ onCompositionEnd: p.onCompositionEnd,
74
+ onCompositionUpdate: p.onCompositionUpdate,
75
+ onSelect: p.onSelect,
76
+ onBeforeInput: p.onBeforeInput,
77
+ onInput: (e) => {
78
+ const target = e.target;
79
+ const nextValue = target.value;
80
+ p.onInput?.(eventWithCurrentTarget(e, target));
81
+ lastInputValue = nextValue;
82
+ p.onChange?.(nextValue);
83
+ }
84
+ }, focusableProps, fieldProps);
85
+ };
86
+ const getIsInvalid = () => {
87
+ return getProps().isInvalid ?? false;
88
+ };
89
+ return {
90
+ get labelProps() {
91
+ return labelProps;
92
+ },
93
+ get inputProps() {
94
+ return getInputProps();
95
+ },
96
+ get descriptionProps() {
97
+ return descriptionProps;
98
+ },
99
+ get errorMessageProps() {
100
+ return errorMessageProps;
101
+ },
102
+ get isInvalid() {
103
+ return getIsInvalid();
104
+ }
105
+ };
106
+ }
107
+ //#endregion
108
+ export { createTextField as t };
109
+
110
+ //# sourceMappingURL=textfield.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textfield.jsx","names":[],"sources":["../../src/textfield/createTextField.ts"],"sourcesContent":["/**\n * TextField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a text field.\n *\n * This is a 1:1 port of @react-aria/textfield's useTextField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createField, type AriaFieldProps, type FieldAria } from \"../label\";\nimport { createFocusable, type FocusableDOMProps, type FocusableProps } from \"../interactions\";\nimport { mergeProps, filterDOMProps } from \"../utils\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaTextFieldProps extends AriaFieldProps, FocusableProps, FocusableDOMProps {\n /** The current value (controlled). */\n value?: string;\n /** The default value (uncontrolled). */\n defaultValue?: string;\n /** Handler that is called when the value changes. */\n onChange?: (value: string) => void;\n /** Whether the input is disabled. */\n isDisabled?: boolean;\n /** Whether the input is read only. */\n isReadOnly?: boolean;\n /** Whether the input is required. */\n isRequired?: boolean;\n /** Whether to use native HTML form validation or ARIA validation semantics. */\n validationBehavior?: \"aria\" | \"native\";\n /** The type of input to render. */\n type?: \"text\" | \"search\" | \"url\" | \"tel\" | \"email\" | \"password\" | string;\n /** The input mode hint for virtual keyboards. */\n inputMode?: \"none\" | \"text\" | \"tel\" | \"url\" | \"email\" | \"numeric\" | \"decimal\" | \"search\";\n /** Hint for the enter key action on virtual keyboards. */\n enterKeyHint?: \"enter\" | \"done\" | \"go\" | \"next\" | \"previous\" | \"search\" | \"send\";\n /** The name of the input element, used when submitting an HTML form. */\n name?: string;\n /** Associates the input with a form element by id. */\n form?: string;\n /** Regex pattern to validate the input value. */\n pattern?: string;\n /** The maximum number of characters supported by the input. */\n maxLength?: number;\n /** The minimum number of characters required by the input. */\n minLength?: number;\n /** Placeholder text for the input. */\n placeholder?: string;\n /** Whether to enable auto complete. */\n autoComplete?: string;\n /** Whether to enable auto correct. */\n autoCorrect?: string;\n /** Whether to enable spell check. */\n spellCheck?: \"true\" | \"false\";\n /** Controls whether and how text input is automatically capitalized. */\n autoCapitalize?: \"off\" | \"none\" | \"on\" | \"sentences\" | \"words\" | \"characters\";\n /** The element type to use for the input. Defaults to 'input'. */\n inputElementType?: \"input\" | \"textarea\";\n\n // Clipboard events\n onCopy?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n onCut?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n onPaste?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n\n // Composition events\n onCompositionStart?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n onCompositionEnd?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n onCompositionUpdate?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n\n // Selection events\n onSelect?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, Event>;\n\n // Input events\n onBeforeInput?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, InputEvent>;\n onInput?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, InputEvent>;\n}\n\nexport interface TextFieldAria<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement,\n> extends Omit<FieldAria, \"fieldProps\"> {\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<T>;\n /** Whether the text field is invalid. */\n isInvalid: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a text field.\n * Text fields allow users to input text with a keyboard.\n *\n * @param props - Props for the text field.\n * @param ref - Optional ref callback for the input element.\n */\nexport function createTextField<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement,\n>(props: MaybeAccessor<AriaTextFieldProps>, ref?: (el: T) => void): TextFieldAria<T> {\n const getProps = () => access(props);\n let lastInputValue: string | undefined;\n\n const eventWithCurrentTarget = (\n event: InputEvent,\n element: HTMLInputElement | HTMLTextAreaElement,\n ) =>\n new Proxy(event, {\n get(target, property, receiver) {\n if (property === \"target\" || property === \"currentTarget\") {\n return element;\n }\n\n const value = Reflect.get(target, property, receiver);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n\n // Get field accessibility props (label, description, error message)\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField(props);\n\n // Get focusable props\n const { focusableProps } = createFocusable(\n {\n get isDisabled() {\n return getProps().isDisabled;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get excludeFromTabOrder() {\n return getProps().excludeFromTabOrder;\n },\n onFocus: getProps().onFocus,\n onBlur: getProps().onBlur,\n onFocusChange: getProps().onFocusChange,\n onKeyDown: getProps().onKeyDown,\n onKeyUp: getProps().onKeyUp,\n },\n ref as ((el: HTMLElement) => void) | undefined,\n );\n\n // Filter DOM props\n const getDomProps = () =>\n filterDOMProps(getProps() as Record<string, unknown>, { labelable: true });\n\n // Build input props\n const getInputProps = (): JSX.InputHTMLAttributes<T> => {\n const p = getProps();\n const isInvalid = p.isInvalid ?? false;\n const isTextarea = p.inputElementType === \"textarea\";\n const validationBehavior = p.validationBehavior ?? \"native\";\n\n return mergeProps(\n getDomProps(),\n {\n disabled: p.isDisabled,\n readOnly: p.isReadOnly,\n required: validationBehavior === \"native\" && p.isRequired,\n \"aria-required\": (validationBehavior === \"aria\" && p.isRequired) || undefined,\n \"aria-invalid\": isInvalid || undefined,\n value: p.value ?? p.defaultValue ?? \"\",\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n if (target.value !== lastInputValue) {\n p.onChange?.(target.value);\n }\n },\n // Don't include type and pattern for textarea elements\n type: isTextarea ? undefined : (p.type ?? \"text\"),\n inputMode: p.inputMode,\n enterKeyHint: p.enterKeyHint,\n name: p.name,\n form: p.form,\n pattern: isTextarea ? undefined : p.pattern,\n maxLength: p.maxLength,\n minLength: p.minLength,\n placeholder: p.placeholder,\n autoComplete: p.autoComplete,\n autoCorrect: p.autoCorrect,\n autoCapitalize: p.autoCapitalize,\n spellCheck: p.spellCheck,\n\n // Clipboard events\n onCopy: p.onCopy,\n onCut: p.onCut,\n onPaste: p.onPaste,\n\n // Composition events\n onCompositionStart: p.onCompositionStart,\n onCompositionEnd: p.onCompositionEnd,\n onCompositionUpdate: p.onCompositionUpdate,\n\n // Selection events\n onSelect: p.onSelect,\n\n // Input events\n onBeforeInput: p.onBeforeInput,\n onInput: (e: InputEvent) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n const nextValue = target.value;\n p.onInput?.(\n eventWithCurrentTarget(e, target) as Parameters<NonNullable<typeof p.onInput>>[0],\n );\n lastInputValue = nextValue;\n p.onChange?.(nextValue);\n },\n },\n focusableProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<T>;\n };\n\n const getIsInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get inputProps() {\n return getInputProps();\n },\n get descriptionProps() {\n return descriptionProps;\n },\n get errorMessageProps() {\n return errorMessageProps;\n },\n get isInvalid() {\n return getIsInvalid();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;AA4FA,SAAgB,gBAEd,OAA0C,KAAyC;CACnF,MAAM,iBAAiB,OAAO,KAAK;CACnC,IAAI;CAEJ,MAAM,0BACJ,OACA,YAEA,IAAI,MAAM,OAAO,EACf,IAAI,QAAQ,UAAU,UAAU;EAC9B,IAAI,aAAa,YAAY,aAAa,iBACxC,OAAO;EAGT,MAAM,QAAQ,QAAQ,IAAI,QAAQ,UAAU,QAAQ;EACpD,OAAO,OAAO,UAAU,aAAa,MAAM,KAAK,MAAM,IAAI;CAC5D,EACF,CAAC;CAGH,MAAM,EAAE,YAAY,YAAY,kBAAkB,sBAAsB,YAAY,KAAK;CAGzF,MAAM,EAAE,mBAAmB,gBACzB;EACE,IAAI,aAAa;GACf,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,YAAY;GACd,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,IAAI,sBAAsB;GACxB,OAAO,SAAS,CAAC,CAAC;EACpB;EACA,SAAS,SAAS,CAAC,CAAC;EACpB,QAAQ,SAAS,CAAC,CAAC;EACnB,eAAe,SAAS,CAAC,CAAC;EAC1B,WAAW,SAAS,CAAC,CAAC;EACtB,SAAS,SAAS,CAAC,CAAC;CACtB,GACA,GACF;CAGA,MAAM,oBACJ,eAAe,SAAS,GAA8B,EAAE,WAAW,KAAK,CAAC;CAG3E,MAAM,sBAAkD;EACtD,MAAM,IAAI,SAAS;EACnB,MAAM,YAAY,EAAE,aAAa;EACjC,MAAM,aAAa,EAAE,qBAAqB;EAC1C,MAAM,qBAAqB,EAAE,sBAAsB;EAEnD,OAAO,WACL,YAAY,GACZ;GACE,UAAU,EAAE;GACZ,UAAU,EAAE;GACZ,UAAU,uBAAuB,YAAY,EAAE;GAC/C,iBAAkB,uBAAuB,UAAU,EAAE,cAAe,KAAA;GACpE,gBAAgB,aAAa,KAAA;GAC7B,OAAO,EAAE,SAAS,EAAE,gBAAgB;GACpC,WAAW,MAAa;IACtB,MAAM,SAAS,EAAE;IACjB,IAAI,OAAO,UAAU,gBACnB,EAAE,WAAW,OAAO,KAAK;GAE7B;GAEA,MAAM,aAAa,KAAA,IAAa,EAAE,QAAQ;GAC1C,WAAW,EAAE;GACb,cAAc,EAAE;GAChB,MAAM,EAAE;GACR,MAAM,EAAE;GACR,SAAS,aAAa,KAAA,IAAY,EAAE;GACpC,WAAW,EAAE;GACb,WAAW,EAAE;GACb,aAAa,EAAE;GACf,cAAc,EAAE;GAChB,aAAa,EAAE;GACf,gBAAgB,EAAE;GAClB,YAAY,EAAE;GAGd,QAAQ,EAAE;GACV,OAAO,EAAE;GACT,SAAS,EAAE;GAGX,oBAAoB,EAAE;GACtB,kBAAkB,EAAE;GACpB,qBAAqB,EAAE;GAGvB,UAAU,EAAE;GAGZ,eAAe,EAAE;GACjB,UAAU,MAAkB;IAC1B,MAAM,SAAS,EAAE;IACjB,MAAM,YAAY,OAAO;IACzB,EAAE,UACA,uBAAuB,GAAG,MAAM,CAClC;IACA,iBAAiB;IACjB,EAAE,WAAW,SAAS;GACxB;EACF,GACA,gBACA,UACF;CACF;CAEA,MAAM,qBAAqB;EACzB,OAAO,SAAS,CAAC,CAAC,aAAa;CACjC;CAEA,OAAO;EACL,IAAI,aAAa;GACf,OAAO;EACT;EACA,IAAI,aAAa;GACf,OAAO,cAAc;EACvB;EACA,IAAI,mBAAmB;GACrB,OAAO;EACT;EACA,IAAI,oBAAoB;GACtB,OAAO;EACT;EACA,IAAI,YAAY;GACd,OAAO,aAAa;EACtB;CACF;AACF"}
@@ -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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"}
@@ -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