@proyecto-viviana/solidaria 0.2.5 → 0.3.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 (555) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -236
  3. package/dist/actiongroup/createActionGroup.d.ts +29 -0
  4. package/dist/actiongroup/createActionGroup.d.ts.map +1 -0
  5. package/dist/actiongroup/index.d.ts +2 -0
  6. package/dist/actiongroup/index.d.ts.map +1 -0
  7. package/dist/autocomplete/createAutocomplete.d.ts +16 -12
  8. package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
  9. package/dist/autocomplete/index.d.ts +1 -1
  10. package/dist/autocomplete/index.d.ts.map +1 -1
  11. package/dist/breadcrumbs/createBreadcrumbs.d.ts +11 -7
  12. package/dist/breadcrumbs/createBreadcrumbs.d.ts.map +1 -1
  13. package/dist/breadcrumbs/index.d.ts +1 -1
  14. package/dist/button/createButton.d.ts +1 -1
  15. package/dist/button/createButton.d.ts.map +1 -1
  16. package/dist/button/createToggleButton.d.ts +3 -3
  17. package/dist/button/createToggleButtonGroup.d.ts +32 -0
  18. package/dist/button/createToggleButtonGroup.d.ts.map +1 -0
  19. package/dist/button/index.d.ts +6 -4
  20. package/dist/button/index.d.ts.map +1 -1
  21. package/dist/button/types.d.ts +18 -12
  22. package/dist/button/types.d.ts.map +1 -1
  23. package/dist/calendar/createCalendar.d.ts +15 -5
  24. package/dist/calendar/createCalendar.d.ts.map +1 -1
  25. package/dist/calendar/createCalendarCell.d.ts +8 -2
  26. package/dist/calendar/createCalendarCell.d.ts.map +1 -1
  27. package/dist/calendar/createCalendarGrid.d.ts +4 -4
  28. package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
  29. package/dist/calendar/createRangeCalendar.d.ts +15 -5
  30. package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
  31. package/dist/calendar/createRangeCalendarCell.d.ts +7 -3
  32. package/dist/calendar/createRangeCalendarCell.d.ts.map +1 -1
  33. package/dist/calendar/index.d.ts +5 -5
  34. package/dist/calendar/index.d.ts.map +1 -1
  35. package/dist/calendar/intl/index.d.ts +12 -0
  36. package/dist/calendar/intl/index.d.ts.map +1 -0
  37. package/dist/calendar/utils.d.ts +12 -0
  38. package/dist/calendar/utils.d.ts.map +1 -0
  39. package/dist/checkbox/createCheckbox.d.ts +6 -6
  40. package/dist/checkbox/createCheckbox.d.ts.map +1 -1
  41. package/dist/checkbox/createCheckboxGroup.d.ts +11 -7
  42. package/dist/checkbox/createCheckboxGroup.d.ts.map +1 -1
  43. package/dist/checkbox/createCheckboxGroupItem.d.ts +4 -4
  44. package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
  45. package/dist/checkbox/createCheckboxGroupState.d.ts +2 -2
  46. package/dist/checkbox/createCheckboxGroupState.d.ts.map +1 -1
  47. package/dist/checkbox/index.d.ts +8 -8
  48. package/dist/checkbox/index.d.ts.map +1 -1
  49. package/dist/collections/index.d.ts +56 -0
  50. package/dist/collections/index.d.ts.map +1 -0
  51. package/dist/color/createColorArea.d.ts +3 -3
  52. package/dist/color/createColorArea.d.ts.map +1 -1
  53. package/dist/color/createColorField.d.ts +4 -4
  54. package/dist/color/createColorField.d.ts.map +1 -1
  55. package/dist/color/createColorSlider.d.ts +4 -4
  56. package/dist/color/createColorSlider.d.ts.map +1 -1
  57. package/dist/color/createColorSwatch.d.ts +2 -2
  58. package/dist/color/createColorSwatch.d.ts.map +1 -1
  59. package/dist/color/createColorWheel.d.ts +3 -3
  60. package/dist/color/createColorWheel.d.ts.map +1 -1
  61. package/dist/color/index.d.ts +6 -6
  62. package/dist/color/types.d.ts +98 -16
  63. package/dist/color/types.d.ts.map +1 -1
  64. package/dist/combobox/createComboBox.d.ts +16 -7
  65. package/dist/combobox/createComboBox.d.ts.map +1 -1
  66. package/dist/combobox/index.d.ts +1 -1
  67. package/dist/combobox/intl/index.d.ts +1 -1
  68. package/dist/datepicker/createDateField.d.ts +18 -6
  69. package/dist/datepicker/createDateField.d.ts.map +1 -1
  70. package/dist/datepicker/createDatePicker.d.ts +57 -5
  71. package/dist/datepicker/createDatePicker.d.ts.map +1 -1
  72. package/dist/datepicker/createDatePickerGroup.d.ts +19 -0
  73. package/dist/datepicker/createDatePickerGroup.d.ts.map +1 -0
  74. package/dist/datepicker/createDateRangePicker.d.ts +42 -0
  75. package/dist/datepicker/createDateRangePicker.d.ts.map +1 -0
  76. package/dist/datepicker/createDateSegment.d.ts +11 -3
  77. package/dist/datepicker/createDateSegment.d.ts.map +1 -1
  78. package/dist/datepicker/createTimeField.d.ts +11 -5
  79. package/dist/datepicker/createTimeField.d.ts.map +1 -1
  80. package/dist/datepicker/createTimeSegment.d.ts +29 -0
  81. package/dist/datepicker/createTimeSegment.d.ts.map +1 -0
  82. package/dist/datepicker/index.d.ts +7 -4
  83. package/dist/datepicker/index.d.ts.map +1 -1
  84. package/dist/dialog/createDialog.d.ts +5 -5
  85. package/dist/dialog/createDialog.d.ts.map +1 -1
  86. package/dist/dialog/index.d.ts +2 -2
  87. package/dist/dialog/index.d.ts.map +1 -1
  88. package/dist/dialog/types.d.ts +4 -4
  89. package/dist/disclosure/createDisclosure.d.ts +5 -2
  90. package/dist/disclosure/createDisclosure.d.ts.map +1 -1
  91. package/dist/disclosure/createDisclosureGroup.d.ts +4 -3
  92. package/dist/disclosure/createDisclosureGroup.d.ts.map +1 -1
  93. package/dist/disclosure/index.d.ts +2 -2
  94. package/dist/dnd/createDrag.d.ts +2 -2
  95. package/dist/dnd/createDrag.d.ts.map +1 -1
  96. package/dist/dnd/createDraggableCollection.d.ts +6 -2
  97. package/dist/dnd/createDraggableCollection.d.ts.map +1 -1
  98. package/dist/dnd/createDraggableItem.d.ts +3 -3
  99. package/dist/dnd/createDraggableItem.d.ts.map +1 -1
  100. package/dist/dnd/createDrop.d.ts +2 -2
  101. package/dist/dnd/createDrop.d.ts.map +1 -1
  102. package/dist/dnd/createDroppableCollection.d.ts +55 -4
  103. package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
  104. package/dist/dnd/createDroppableItem.d.ts +3 -3
  105. package/dist/dnd/createDroppableItem.d.ts.map +1 -1
  106. package/dist/dnd/index.d.ts +12 -12
  107. package/dist/dnd/index.d.ts.map +1 -1
  108. package/dist/dnd/types.d.ts +2 -2
  109. package/dist/dnd/types.d.ts.map +1 -1
  110. package/dist/dnd/utils.d.ts +1 -1
  111. package/dist/dnd/utils.d.ts.map +1 -1
  112. package/dist/focus/FocusScope.d.ts +1 -1
  113. package/dist/focus/FocusScope.d.ts.map +1 -1
  114. package/dist/focus/createAutoFocus.d.ts.map +1 -1
  115. package/dist/focus/createFocusRestore.d.ts.map +1 -1
  116. package/dist/focus/createVirtualFocus.d.ts +4 -4
  117. package/dist/focus/createVirtualFocus.d.ts.map +1 -1
  118. package/dist/focus/index.d.ts +4 -4
  119. package/dist/focus/index.d.ts.map +1 -1
  120. package/dist/form/createFormReset.d.ts +1 -1
  121. package/dist/form/createFormValidation.d.ts +3 -3
  122. package/dist/form/createFormValidation.d.ts.map +1 -1
  123. package/dist/form/index.d.ts +2 -2
  124. package/dist/form/index.d.ts.map +1 -1
  125. package/dist/grid/GridKeyboardDelegate.d.ts +5 -5
  126. package/dist/grid/createGrid.d.ts +3 -3
  127. package/dist/grid/createGrid.d.ts.map +1 -1
  128. package/dist/grid/createGridCell.d.ts +3 -3
  129. package/dist/grid/createGridRow.d.ts +3 -3
  130. package/dist/grid/index.d.ts +5 -5
  131. package/dist/grid/types.d.ts +8 -8
  132. package/dist/gridlist/createGridList.d.ts +6 -4
  133. package/dist/gridlist/createGridList.d.ts.map +1 -1
  134. package/dist/gridlist/createGridListItem.d.ts +4 -4
  135. package/dist/gridlist/createGridListItem.d.ts.map +1 -1
  136. package/dist/gridlist/createGridListSelectionCheckbox.d.ts +3 -3
  137. package/dist/gridlist/createGridListSelectionCheckbox.d.ts.map +1 -1
  138. package/dist/gridlist/index.d.ts +4 -4
  139. package/dist/gridlist/types.d.ts +11 -7
  140. package/dist/gridlist/types.d.ts.map +1 -1
  141. package/dist/i18n/createCollator.d.ts.map +1 -1
  142. package/dist/i18n/createDateFormatter.d.ts.map +1 -1
  143. package/dist/i18n/createFilter.d.ts.map +1 -1
  144. package/dist/i18n/createNumberFormatter.d.ts +1 -1
  145. package/dist/i18n/createNumberFormatter.d.ts.map +1 -1
  146. package/dist/i18n/createStringFormatter.d.ts +2 -2
  147. package/dist/i18n/createStringFormatter.d.ts.map +1 -1
  148. package/dist/i18n/index.d.ts +8 -8
  149. package/dist/i18n/index.d.ts.map +1 -1
  150. package/dist/i18n/locale.d.ts +2 -2
  151. package/dist/i18n/locale.d.ts.map +1 -1
  152. package/dist/i18n/utils.d.ts.map +1 -1
  153. package/dist/index.d.ts +52 -49
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/index.js +18089 -15690
  156. package/dist/index.js.map +1 -7
  157. package/dist/index.jsx +18242 -0
  158. package/dist/index.jsx.map +1 -0
  159. package/dist/interactions/FocusableProvider.d.ts +2 -2
  160. package/dist/interactions/FocusableProvider.d.ts.map +1 -1
  161. package/dist/interactions/PressEvent.d.ts +2 -2
  162. package/dist/interactions/createFocus.d.ts +1 -1
  163. package/dist/interactions/createFocus.d.ts.map +1 -1
  164. package/dist/interactions/createFocusRing.d.ts +1 -1
  165. package/dist/interactions/createFocusRing.d.ts.map +1 -1
  166. package/dist/interactions/createFocusWithin.d.ts +1 -1
  167. package/dist/interactions/createFocusWithin.d.ts.map +1 -1
  168. package/dist/interactions/createFocusable.d.ts +3 -3
  169. package/dist/interactions/createFocusable.d.ts.map +1 -1
  170. package/dist/interactions/createHover.d.ts +5 -5
  171. package/dist/interactions/createHover.d.ts.map +1 -1
  172. package/dist/interactions/createInteractionModality.d.ts +3 -3
  173. package/dist/interactions/createInteractionModality.d.ts.map +1 -1
  174. package/dist/interactions/createKeyboard.d.ts +1 -1
  175. package/dist/interactions/createLongPress.d.ts +5 -5
  176. package/dist/interactions/createMove.d.ts +5 -5
  177. package/dist/interactions/createMove.d.ts.map +1 -1
  178. package/dist/interactions/createPress.d.ts +4 -4
  179. package/dist/interactions/createPress.d.ts.map +1 -1
  180. package/dist/interactions/index.d.ts +12 -12
  181. package/dist/interactions/index.d.ts.map +1 -1
  182. package/dist/label/createField.d.ts +4 -4
  183. package/dist/label/createField.d.ts.map +1 -1
  184. package/dist/label/createLabel.d.ts +7 -7
  185. package/dist/label/createLabel.d.ts.map +1 -1
  186. package/dist/label/createLabels.d.ts +1 -1
  187. package/dist/label/createLabels.d.ts.map +1 -1
  188. package/dist/label/index.d.ts +5 -5
  189. package/dist/landmark/createLandmark.d.ts +5 -5
  190. package/dist/landmark/createLandmark.d.ts.map +1 -1
  191. package/dist/landmark/index.d.ts +1 -1
  192. package/dist/link/createLink.d.ts +23 -7
  193. package/dist/link/createLink.d.ts.map +1 -1
  194. package/dist/link/index.d.ts +1 -1
  195. package/dist/listbox/createListBox.d.ts +12 -6
  196. package/dist/listbox/createListBox.d.ts.map +1 -1
  197. package/dist/listbox/createOption.d.ts +21 -4
  198. package/dist/listbox/createOption.d.ts.map +1 -1
  199. package/dist/listbox/index.d.ts +2 -2
  200. package/dist/listbox/index.d.ts.map +1 -1
  201. package/dist/live-announcer/announce.d.ts +2 -2
  202. package/dist/live-announcer/announce.d.ts.map +1 -1
  203. package/dist/live-announcer/index.d.ts +1 -1
  204. package/dist/menu/createMenu.d.ts +8 -7
  205. package/dist/menu/createMenu.d.ts.map +1 -1
  206. package/dist/menu/createMenuItem.d.ts +16 -4
  207. package/dist/menu/createMenuItem.d.ts.map +1 -1
  208. package/dist/menu/createMenuTrigger.d.ts +4 -4
  209. package/dist/menu/index.d.ts +3 -3
  210. package/dist/menu/index.d.ts.map +1 -1
  211. package/dist/meter/createMeter.d.ts +6 -6
  212. package/dist/meter/createMeter.d.ts.map +1 -1
  213. package/dist/meter/index.d.ts +1 -1
  214. package/dist/numberfield/createNumberField.d.ts +27 -8
  215. package/dist/numberfield/createNumberField.d.ts.map +1 -1
  216. package/dist/numberfield/index.d.ts +1 -1
  217. package/dist/overlays/ariaHideOutside.d.ts.map +1 -1
  218. package/dist/overlays/createModal.d.ts +19 -3
  219. package/dist/overlays/createModal.d.ts.map +1 -1
  220. package/dist/overlays/createOverlay.d.ts +1 -1
  221. package/dist/overlays/createOverlay.d.ts.map +1 -1
  222. package/dist/overlays/createOverlayTrigger.d.ts +6 -6
  223. package/dist/overlays/index.d.ts +6 -6
  224. package/dist/overlays/index.d.ts.map +1 -1
  225. package/dist/popover/calculatePosition.d.ts +4 -4
  226. package/dist/popover/calculatePosition.d.ts.map +1 -1
  227. package/dist/popover/createOverlayPosition.d.ts +3 -3
  228. package/dist/popover/createOverlayPosition.d.ts.map +1 -1
  229. package/dist/popover/createPopover.d.ts +4 -4
  230. package/dist/popover/createPopover.d.ts.map +1 -1
  231. package/dist/popover/index.d.ts +3 -3
  232. package/dist/progress/createProgressBar.d.ts +7 -5
  233. package/dist/progress/createProgressBar.d.ts.map +1 -1
  234. package/dist/progress/index.d.ts +1 -1
  235. package/dist/radio/createRadio.d.ts +7 -7
  236. package/dist/radio/createRadio.d.ts.map +1 -1
  237. package/dist/radio/createRadioGroup.d.ts +11 -11
  238. package/dist/radio/createRadioGroup.d.ts.map +1 -1
  239. package/dist/radio/createRadioGroupState.d.ts +3 -3
  240. package/dist/radio/createRadioGroupState.d.ts.map +1 -1
  241. package/dist/radio/index.d.ts +3 -3
  242. package/dist/radio/index.d.ts.map +1 -1
  243. package/dist/searchfield/createSearchField.d.ts +7 -7
  244. package/dist/searchfield/createSearchField.d.ts.map +1 -1
  245. package/dist/searchfield/index.d.ts +2 -2
  246. package/dist/select/createHiddenSelect.d.ts +4 -4
  247. package/dist/select/createHiddenSelect.d.ts.map +1 -1
  248. package/dist/select/createSelect.d.ts +14 -6
  249. package/dist/select/createSelect.d.ts.map +1 -1
  250. package/dist/select/index.d.ts +2 -2
  251. package/dist/select/index.d.ts.map +1 -1
  252. package/dist/selection/createTypeSelect.d.ts +2 -2
  253. package/dist/selection/index.d.ts +1 -1
  254. package/dist/separator/createSeparator.d.ts +9 -5
  255. package/dist/separator/createSeparator.d.ts.map +1 -1
  256. package/dist/separator/index.d.ts +1 -1
  257. package/dist/slider/createSlider.d.ts +11 -7
  258. package/dist/slider/createSlider.d.ts.map +1 -1
  259. package/dist/slider/index.d.ts +2 -2
  260. package/dist/ssr/index.d.ts +1 -1
  261. package/dist/ssr/index.d.ts.map +1 -1
  262. package/dist/steplist/createStepList.d.ts +36 -0
  263. package/dist/steplist/createStepList.d.ts.map +1 -0
  264. package/dist/steplist/index.d.ts +2 -0
  265. package/dist/steplist/index.d.ts.map +1 -0
  266. package/dist/switch/createSwitch.d.ts +6 -4
  267. package/dist/switch/createSwitch.d.ts.map +1 -1
  268. package/dist/switch/index.d.ts +1 -1
  269. package/dist/table/createTable.d.ts +3 -3
  270. package/dist/table/createTable.d.ts.map +1 -1
  271. package/dist/table/createTableCell.d.ts +3 -3
  272. package/dist/table/createTableCell.d.ts.map +1 -1
  273. package/dist/table/createTableColumnHeader.d.ts +3 -3
  274. package/dist/table/createTableColumnHeader.d.ts.map +1 -1
  275. package/dist/table/createTableColumnResize.d.ts +41 -0
  276. package/dist/table/createTableColumnResize.d.ts.map +1 -0
  277. package/dist/table/createTableHeaderRow.d.ts +3 -3
  278. package/dist/table/createTableRow.d.ts +3 -3
  279. package/dist/table/createTableRow.d.ts.map +1 -1
  280. package/dist/table/createTableRowGroup.d.ts +2 -2
  281. package/dist/table/createTableRowGroup.d.ts.map +1 -1
  282. package/dist/table/createTableSelectAllCheckbox.d.ts +3 -3
  283. package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
  284. package/dist/table/createTableSelectionCheckbox.d.ts +3 -3
  285. package/dist/table/index.d.ts +11 -9
  286. package/dist/table/index.d.ts.map +1 -1
  287. package/dist/table/types.d.ts +15 -7
  288. package/dist/table/types.d.ts.map +1 -1
  289. package/dist/tabs/createTabs.d.ts +28 -25
  290. package/dist/tabs/createTabs.d.ts.map +1 -1
  291. package/dist/tabs/index.d.ts +1 -1
  292. package/dist/tag/createTag.d.ts +2 -2
  293. package/dist/tag/createTag.d.ts.map +1 -1
  294. package/dist/tag/createTagGroup.d.ts +5 -5
  295. package/dist/tag/createTagGroup.d.ts.map +1 -1
  296. package/dist/tag/index.d.ts +2 -2
  297. package/dist/tag/index.d.ts.map +1 -1
  298. package/dist/textfield/createTextField.d.ts +17 -11
  299. package/dist/textfield/createTextField.d.ts.map +1 -1
  300. package/dist/textfield/index.d.ts +1 -1
  301. package/dist/textfield/index.d.ts.map +1 -1
  302. package/dist/toast/createToast.d.ts +6 -2
  303. package/dist/toast/createToast.d.ts.map +1 -1
  304. package/dist/toast/createToastRegion.d.ts +5 -3
  305. package/dist/toast/createToastRegion.d.ts.map +1 -1
  306. package/dist/toast/index.d.ts +2 -2
  307. package/dist/toast/index.d.ts.map +1 -1
  308. package/dist/toggle/createToggle.d.ts +9 -9
  309. package/dist/toggle/createToggle.d.ts.map +1 -1
  310. package/dist/toggle/createToggleState.d.ts +2 -2
  311. package/dist/toggle/createToggleState.d.ts.map +1 -1
  312. package/dist/toggle/index.d.ts +4 -4
  313. package/dist/toggle/index.d.ts.map +1 -1
  314. package/dist/toolbar/createToolbar.d.ts +9 -9
  315. package/dist/toolbar/createToolbar.d.ts.map +1 -1
  316. package/dist/toolbar/index.d.ts +1 -1
  317. package/dist/toolbar/index.d.ts.map +1 -1
  318. package/dist/tooltip/createTooltip.d.ts +5 -5
  319. package/dist/tooltip/createTooltip.d.ts.map +1 -1
  320. package/dist/tooltip/createTooltipTrigger.d.ts +10 -5
  321. package/dist/tooltip/createTooltipTrigger.d.ts.map +1 -1
  322. package/dist/tooltip/index.d.ts +2 -2
  323. package/dist/tree/createTree.d.ts +3 -3
  324. package/dist/tree/createTree.d.ts.map +1 -1
  325. package/dist/tree/createTreeItem.d.ts +4 -4
  326. package/dist/tree/createTreeItem.d.ts.map +1 -1
  327. package/dist/tree/createTreeSelectionCheckbox.d.ts +3 -3
  328. package/dist/tree/createTreeSelectionCheckbox.d.ts.map +1 -1
  329. package/dist/tree/index.d.ts +4 -4
  330. package/dist/tree/types.d.ts +13 -5
  331. package/dist/tree/types.d.ts.map +1 -1
  332. package/dist/utils/createDescription.d.ts +2 -2
  333. package/dist/utils/createDescription.d.ts.map +1 -1
  334. package/dist/utils/dom.d.ts.map +1 -1
  335. package/dist/utils/env.d.ts +1 -1
  336. package/dist/utils/env.d.ts.map +1 -1
  337. package/dist/utils/focus.d.ts +1 -1
  338. package/dist/utils/focus.d.ts.map +1 -1
  339. package/dist/utils/geometry.d.ts.map +1 -1
  340. package/dist/utils/index.d.ts +12 -12
  341. package/dist/utils/index.d.ts.map +1 -1
  342. package/dist/utils/mergeProps.d.ts.map +1 -1
  343. package/dist/utils/platform.d.ts.map +1 -1
  344. package/dist/utils/reactivity.d.ts +1 -1
  345. package/dist/visually-hidden/createVisuallyHidden.d.ts +2 -2
  346. package/dist/visually-hidden/createVisuallyHidden.d.ts.map +1 -1
  347. package/dist/visually-hidden/index.d.ts +1 -1
  348. package/package.json +34 -32
  349. package/src/actiongroup/createActionGroup.ts +334 -0
  350. package/src/actiongroup/index.ts +8 -0
  351. package/src/autocomplete/createAutocomplete.ts +137 -131
  352. package/src/autocomplete/index.ts +1 -1
  353. package/src/breadcrumbs/createBreadcrumbs.ts +37 -51
  354. package/src/breadcrumbs/index.ts +1 -1
  355. package/src/button/createButton.ts +102 -73
  356. package/src/button/createToggleButton.ts +10 -10
  357. package/src/button/createToggleButtonGroup.ts +121 -0
  358. package/src/button/index.ts +10 -4
  359. package/src/button/types.ts +18 -12
  360. package/src/calendar/createCalendar.ts +62 -29
  361. package/src/calendar/createCalendarCell.ts +102 -48
  362. package/src/calendar/createCalendarGrid.ts +78 -47
  363. package/src/calendar/createRangeCalendar.ts +66 -31
  364. package/src/calendar/createRangeCalendarCell.ts +115 -37
  365. package/src/calendar/index.ts +5 -9
  366. package/src/calendar/intl/index.ts +210 -0
  367. package/src/calendar/utils.ts +227 -0
  368. package/src/checkbox/createCheckbox.ts +13 -21
  369. package/src/checkbox/createCheckboxGroup.ts +86 -45
  370. package/src/checkbox/createCheckboxGroupItem.ts +16 -27
  371. package/src/checkbox/createCheckboxGroupState.ts +3 -22
  372. package/src/checkbox/index.ts +8 -10
  373. package/src/collections/index.ts +246 -0
  374. package/src/color/createColorArea.ts +458 -314
  375. package/src/color/createColorField.ts +186 -137
  376. package/src/color/createColorSlider.ts +444 -197
  377. package/src/color/createColorSwatch.ts +65 -40
  378. package/src/color/createColorWheel.ts +343 -208
  379. package/src/color/index.ts +24 -24
  380. package/src/color/types.ts +198 -116
  381. package/src/combobox/createComboBox.ts +727 -647
  382. package/src/combobox/index.ts +6 -6
  383. package/src/combobox/intl/index.ts +5 -5
  384. package/src/datepicker/createDateField.ts +192 -39
  385. package/src/datepicker/createDatePicker.ts +294 -63
  386. package/src/datepicker/createDatePickerGroup.ts +149 -0
  387. package/src/datepicker/createDateRangePicker.ts +294 -0
  388. package/src/datepicker/createDateSegment.ts +316 -75
  389. package/src/datepicker/createTimeField.ts +38 -34
  390. package/src/datepicker/createTimeSegment.ts +352 -0
  391. package/src/datepicker/index.ts +24 -11
  392. package/src/dialog/createDialog.ts +127 -120
  393. package/src/dialog/index.ts +2 -2
  394. package/src/dialog/types.ts +19 -19
  395. package/src/disclosure/createDisclosure.ts +138 -33
  396. package/src/disclosure/createDisclosureGroup.ts +8 -18
  397. package/src/disclosure/index.ts +2 -2
  398. package/src/dnd/createDrag.ts +218 -209
  399. package/src/dnd/createDraggableCollection.ts +96 -63
  400. package/src/dnd/createDraggableItem.ts +260 -243
  401. package/src/dnd/createDrop.ts +313 -321
  402. package/src/dnd/createDroppableCollection.ts +799 -293
  403. package/src/dnd/createDroppableItem.ts +215 -213
  404. package/src/dnd/index.ts +66 -47
  405. package/src/dnd/types.ts +86 -89
  406. package/src/dnd/utils.ts +281 -294
  407. package/src/focus/FocusScope.tsx +155 -164
  408. package/src/focus/createAutoFocus.ts +305 -321
  409. package/src/focus/createFocusRestore.ts +300 -313
  410. package/src/focus/createVirtualFocus.ts +380 -396
  411. package/src/focus/index.ts +4 -8
  412. package/src/form/createFormReset.ts +4 -4
  413. package/src/form/createFormValidation.ts +201 -224
  414. package/src/form/index.ts +8 -11
  415. package/src/grid/GridKeyboardDelegate.ts +30 -30
  416. package/src/grid/createGrid.ts +38 -36
  417. package/src/grid/createGridCell.ts +18 -18
  418. package/src/grid/createGridRow.ts +14 -14
  419. package/src/grid/index.ts +5 -5
  420. package/src/grid/types.ts +8 -8
  421. package/src/gridlist/createGridList.ts +45 -24
  422. package/src/gridlist/createGridListItem.ts +68 -23
  423. package/src/gridlist/createGridListSelectionCheckbox.ts +12 -9
  424. package/src/gridlist/index.ts +4 -4
  425. package/src/gridlist/types.ts +11 -7
  426. package/src/i18n/createCollator.ts +66 -79
  427. package/src/i18n/createDateFormatter.ts +75 -83
  428. package/src/i18n/createFilter.ts +118 -131
  429. package/src/i18n/createNumberFormatter.ts +50 -52
  430. package/src/i18n/createStringFormatter.ts +19 -15
  431. package/src/i18n/index.ts +37 -40
  432. package/src/i18n/locale.tsx +163 -188
  433. package/src/i18n/utils.ts +95 -99
  434. package/src/index.ts +114 -164
  435. package/src/interactions/FocusableProvider.tsx +3 -7
  436. package/src/interactions/PressEvent.ts +4 -4
  437. package/src/interactions/createFocus.ts +16 -11
  438. package/src/interactions/createFocusRing.ts +21 -19
  439. package/src/interactions/createFocusWithin.ts +24 -16
  440. package/src/interactions/createFocusable.ts +15 -16
  441. package/src/interactions/createHover.ts +70 -55
  442. package/src/interactions/createInteractionModality.ts +75 -82
  443. package/src/interactions/createKeyboard.ts +2 -2
  444. package/src/interactions/createLongPress.ts +174 -174
  445. package/src/interactions/createMove.ts +299 -289
  446. package/src/interactions/createPress.ts +168 -91
  447. package/src/interactions/index.ts +24 -16
  448. package/src/label/createField.ts +18 -19
  449. package/src/label/createLabel.ts +18 -30
  450. package/src/label/createLabels.ts +8 -12
  451. package/src/label/index.ts +5 -5
  452. package/src/landmark/createLandmark.ts +356 -377
  453. package/src/landmark/index.ts +8 -8
  454. package/src/link/createLink.ts +96 -54
  455. package/src/link/index.ts +1 -1
  456. package/src/listbox/createListBox.ts +319 -269
  457. package/src/listbox/createOption.ts +208 -151
  458. package/src/listbox/index.ts +8 -12
  459. package/src/live-announcer/announce.ts +295 -322
  460. package/src/live-announcer/index.ts +9 -9
  461. package/src/menu/createMenu.ts +434 -396
  462. package/src/menu/createMenuItem.ts +201 -149
  463. package/src/menu/createMenuTrigger.ts +88 -88
  464. package/src/menu/index.ts +9 -18
  465. package/src/meter/createMeter.ts +7 -20
  466. package/src/meter/index.ts +1 -1
  467. package/src/numberfield/createNumberField.ts +368 -268
  468. package/src/numberfield/index.ts +5 -5
  469. package/src/overlays/ariaHideOutside.ts +223 -219
  470. package/src/overlays/createInteractOutside.ts +152 -149
  471. package/src/overlays/createModal.tsx +238 -202
  472. package/src/overlays/createOverlay.ts +195 -155
  473. package/src/overlays/createOverlayTrigger.ts +85 -85
  474. package/src/overlays/createPreventScroll.ts +288 -266
  475. package/src/overlays/index.ts +37 -44
  476. package/src/popover/calculatePosition.ts +117 -119
  477. package/src/popover/createOverlayPosition.ts +52 -43
  478. package/src/popover/createPopover.ts +63 -24
  479. package/src/popover/index.ts +3 -3
  480. package/src/progress/createProgressBar.ts +36 -32
  481. package/src/progress/index.ts +1 -1
  482. package/src/radio/createRadio.ts +95 -73
  483. package/src/radio/createRadioGroup.ts +142 -62
  484. package/src/radio/createRadioGroupState.ts +7 -31
  485. package/src/radio/index.ts +3 -8
  486. package/src/searchfield/createSearchField.ts +269 -186
  487. package/src/searchfield/index.ts +2 -2
  488. package/src/select/createHiddenSelect.tsx +276 -236
  489. package/src/select/createSelect.ts +430 -395
  490. package/src/select/index.ts +9 -14
  491. package/src/selection/createTypeSelect.ts +11 -11
  492. package/src/selection/index.ts +1 -1
  493. package/src/separator/createSeparator.ts +20 -25
  494. package/src/separator/index.ts +1 -1
  495. package/src/slider/createSlider.ts +333 -349
  496. package/src/slider/index.ts +2 -2
  497. package/src/ssr/index.tsx +331 -370
  498. package/src/steplist/createStepList.ts +106 -0
  499. package/src/steplist/index.ts +8 -0
  500. package/src/switch/createSwitch.ts +9 -14
  501. package/src/switch/index.ts +1 -1
  502. package/src/table/createTable.ts +155 -86
  503. package/src/table/createTableCell.ts +17 -16
  504. package/src/table/createTableColumnHeader.ts +67 -20
  505. package/src/table/createTableColumnResize.ts +256 -0
  506. package/src/table/createTableHeaderRow.ts +7 -7
  507. package/src/table/createTableRow.ts +149 -29
  508. package/src/table/createTableRowGroup.ts +5 -7
  509. package/src/table/createTableSelectAllCheckbox.ts +12 -11
  510. package/src/table/createTableSelectionCheckbox.ts +8 -8
  511. package/src/table/index.ts +14 -9
  512. package/src/table/types.ts +15 -7
  513. package/src/tabs/createTabs.ts +138 -127
  514. package/src/tabs/index.ts +1 -1
  515. package/src/tag/createTag.ts +171 -40
  516. package/src/tag/createTagGroup.ts +50 -39
  517. package/src/tag/index.ts +2 -6
  518. package/src/textfield/createTextField.ts +67 -35
  519. package/src/textfield/index.ts +1 -5
  520. package/src/toast/createToast.ts +34 -26
  521. package/src/toast/createToastRegion.ts +169 -27
  522. package/src/toast/index.ts +2 -6
  523. package/src/toggle/createToggle.ts +95 -53
  524. package/src/toggle/createToggleState.ts +2 -10
  525. package/src/toggle/index.ts +4 -5
  526. package/src/toolbar/createToolbar.ts +226 -169
  527. package/src/toolbar/index.ts +1 -1
  528. package/src/tooltip/createTooltip.ts +66 -79
  529. package/src/tooltip/createTooltipTrigger.ts +238 -222
  530. package/src/tooltip/index.ts +6 -6
  531. package/src/tree/createTree.ts +259 -246
  532. package/src/tree/createTreeItem.ts +282 -233
  533. package/src/tree/createTreeSelectionCheckbox.ts +71 -68
  534. package/src/tree/index.ts +16 -16
  535. package/src/tree/types.ts +95 -87
  536. package/src/utils/createDescription.ts +6 -23
  537. package/src/utils/dom.ts +61 -54
  538. package/src/utils/env.ts +53 -54
  539. package/src/utils/events.ts +7 -7
  540. package/src/utils/filterDOMProps.ts +49 -49
  541. package/src/utils/focus.ts +60 -68
  542. package/src/utils/geometry.ts +1 -4
  543. package/src/utils/globalListeners.ts +9 -9
  544. package/src/utils/index.ts +12 -22
  545. package/src/utils/mergeProps.ts +42 -15
  546. package/src/utils/platform.ts +16 -6
  547. package/src/utils/reactivity.ts +3 -3
  548. package/src/utils/textSelection.ts +16 -16
  549. package/src/visually-hidden/createVisuallyHidden.ts +127 -124
  550. package/src/visually-hidden/index.ts +6 -6
  551. package/dist/i18n/NumberFormatter.d.ts +0 -43
  552. package/dist/i18n/NumberFormatter.d.ts.map +0 -1
  553. package/dist/index.ssr.js +0 -15875
  554. package/dist/index.ssr.js.map +0 -7
  555. package/src/i18n/NumberFormatter.ts +0 -266
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.jsx","names":["#shouldStopPropagation","getOwnerDocument","getOwnerWindow","getOwnerDocument","getOwnerDocument","getOwnerWindow","isDisabledValue","isDisabledValue","getActiveElement","createSyntheticBlurHandler","getOwnerDocument","getActiveElement","getOwnerDocument","isDisabledValue","currentModality","getOwnerWindow","getOwnerDocument","isGlobalFocusVisible","isFocusVisible","isDisabledValue","NumberFormatter","isTabbable","getFocusableElements","getActiveElement","getOwnerDocument","clamp","inputEvent","visualViewport","getOwnerDocument","getOwnerDocument","getOwnerWindow","DEFAULT_PAGE_SIZE","isFocusVisible","enUS","esES","getActiveElement","getOwnerDocument","isToday","isTodayUtil","isToday","isTodayUtil","normalizeDigit","extractNormalizedDigits","getSegmentLabel","SEGMENT_LABELS","createId","createId","createId","createId","createId","createId","createId"],"sources":["../src/interactions/PressEvent.ts","../src/utils/mergeProps.ts","../src/utils/filterDOMProps.ts","../src/utils/reactivity.ts","../src/utils/platform.ts","../src/utils/dom.ts","../src/utils/geometry.ts","../src/utils/events.ts","../src/utils/textSelection.ts","../src/utils/focus.ts","../src/utils/globalListeners.ts","../src/utils/env.ts","../src/utils/createDescription.ts","../src/interactions/createPress.ts","../src/interactions/createLongPress.ts","../src/interactions/createMove.ts","../src/interactions/createFocus.ts","../src/interactions/createFocusWithin.ts","../src/interactions/createKeyboard.ts","../src/interactions/createFocusable.ts","../src/interactions/createInteractionModality.ts","../src/interactions/createFocusRing.ts","../src/interactions/createHover.ts","../src/button/createButton.ts","../src/button/createToggleButton.ts","../src/i18n/utils.ts","../src/i18n/locale.tsx","../src/i18n/createNumberFormatter.ts","../src/i18n/createDateFormatter.ts","../src/i18n/createCollator.ts","../src/i18n/createFilter.ts","../src/i18n/createStringFormatter.ts","../src/toolbar/createToolbar.ts","../src/button/createToggleButtonGroup.ts","../src/actiongroup/createActionGroup.ts","../src/collections/index.ts","../src/toggle/createToggle.ts","../src/checkbox/createCheckbox.ts","../src/ssr/index.tsx","../src/label/createLabels.ts","../src/label/createLabel.ts","../src/label/createField.ts","../src/checkbox/createCheckboxGroup.ts","../src/checkbox/createCheckboxGroupItem.ts","../src/radio/createRadioGroup.ts","../src/radio/createRadio.ts","../src/switch/createSwitch.ts","../src/link/createLink.ts","../src/textfield/createTextField.ts","../src/progress/createProgressBar.ts","../src/separator/createSeparator.ts","../src/autocomplete/createAutocomplete.ts","../src/overlays/createPreventScroll.ts","../src/overlays/createOverlayTrigger.ts","../src/overlays/createInteractOutside.ts","../src/overlays/createOverlay.ts","../src/overlays/ariaHideOutside.ts","../src/overlays/createModal.tsx","../src/selection/createTypeSelect.ts","../src/listbox/createListBox.ts","../src/listbox/createOption.ts","../src/menu/createMenu.ts","../src/menu/createMenuItem.ts","../src/menu/createMenuTrigger.ts","../src/select/createSelect.ts","../src/form/createFormValidation.ts","../src/select/createHiddenSelect.tsx","../src/tabs/createTabs.ts","../src/breadcrumbs/createBreadcrumbs.ts","../src/numberfield/createNumberField.ts","../src/searchfield/createSearchField.ts","../src/slider/createSlider.ts","../src/tooltip/createTooltip.ts","../src/tooltip/createTooltipTrigger.ts","../src/live-announcer/announce.ts","../src/combobox/intl/en-US.json","../src/combobox/intl/es-ES.json","../src/combobox/intl/index.ts","../src/combobox/createComboBox.ts","../src/dialog/createDialog.ts","../src/toast/createToast.ts","../src/landmark/createLandmark.ts","../src/toast/createToastRegion.ts","../src/popover/calculatePosition.ts","../src/popover/createOverlayPosition.ts","../src/popover/createPopover.ts","../src/focus/FocusScope.tsx","../src/focus/createFocusRestore.ts","../src/focus/createVirtualFocus.ts","../src/focus/createAutoFocus.ts","../src/disclosure/createDisclosure.ts","../src/disclosure/createDisclosureGroup.ts","../src/meter/createMeter.ts","../src/tag/createTagGroup.ts","../src/tag/createTag.ts","../src/calendar/intl/index.ts","../src/calendar/utils.ts","../src/calendar/createCalendar.ts","../src/calendar/createCalendarGrid.ts","../src/calendar/createCalendarCell.ts","../src/calendar/createRangeCalendar.ts","../src/calendar/createRangeCalendarCell.ts","../src/datepicker/createDateField.ts","../src/datepicker/createDateSegment.ts","../src/datepicker/createTimeField.ts","../src/datepicker/createTimeSegment.ts","../src/datepicker/createDatePicker.ts","../src/datepicker/createDateRangePicker.ts","../src/grid/GridKeyboardDelegate.ts","../src/grid/createGrid.ts","../src/grid/createGridRow.ts","../src/grid/createGridCell.ts","../src/table/createTable.ts","../src/table/createTableHeaderRow.ts","../src/table/createTableColumnHeader.ts","../src/table/createTableRow.ts","../src/table/createTableCell.ts","../src/table/createTableRowGroup.ts","../src/table/createTableSelectionCheckbox.ts","../src/table/createTableSelectAllCheckbox.ts","../src/table/createTableColumnResize.ts","../src/gridlist/createGridList.ts","../src/gridlist/createGridListItem.ts","../src/gridlist/createGridListSelectionCheckbox.ts","../src/tree/createTree.ts","../src/tree/createTreeItem.ts","../src/tree/createTreeSelectionCheckbox.ts","../src/color/createColorSlider.ts","../src/color/createColorArea.ts","../src/color/createColorWheel.ts","../src/color/createColorField.ts","../src/color/createColorSwatch.ts","../src/dnd/utils.ts","../src/dnd/createDraggableCollection.ts","../src/dnd/createDrag.ts","../src/dnd/createDrop.ts","../src/dnd/createDroppableCollection.ts","../src/dnd/createDraggableItem.ts","../src/dnd/createDroppableItem.ts","../src/visually-hidden/createVisuallyHidden.ts","../src/form/createFormReset.ts","../src/steplist/createStepList.ts"],"sourcesContent":["/**\n * PressEvent class that matches React-Aria's PressEvent interface.\n * Wraps native events with press-specific data.\n */\n\nexport type PointerType = \"mouse\" | \"pen\" | \"touch\" | \"keyboard\" | \"virtual\";\nexport type PressEventType = \"pressstart\" | \"pressend\" | \"pressup\" | \"press\";\n\n/**\n * Minimal event data needed to create a PressEvent.\n * Allows both native Event objects and synthetic event-like objects.\n */\nexport interface PressEventSource {\n currentTarget?: EventTarget | null;\n shiftKey?: boolean;\n ctrlKey?: boolean;\n metaKey?: boolean;\n altKey?: boolean;\n clientX?: number;\n clientY?: number;\n}\n\nexport interface IPressEvent {\n /** The type of press event being fired. */\n type: PressEventType;\n /** The pointer type that triggered the press event. */\n pointerType: PointerType;\n /** The target element of the press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the press event. */\n altKey: boolean;\n /** X position of the press relative to the target element. */\n x: number;\n /** Y position of the press relative to the target element. */\n y: number;\n /**\n * By default, press events stop propagation to parent elements.\n * Call continuePropagation() to allow the event to bubble up.\n */\n continuePropagation(): void;\n}\n\n/**\n * PressEvent class that provides all press event data.\n * Based on React-Aria's PressEvent implementation.\n */\nexport class PressEvent implements IPressEvent {\n type: PressEventType;\n pointerType: PointerType;\n target: Element;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n x: number;\n y: number;\n\n #shouldStopPropagation = true;\n\n constructor(\n type: PressEventType,\n pointerType: PointerType,\n originalEvent: PressEventSource | null,\n target: Element | null,\n ) {\n this.type = type;\n this.pointerType = pointerType;\n const eventTarget = target ?? (originalEvent?.currentTarget as Element | undefined);\n this.target = eventTarget as Element;\n\n // Extract modifier keys from the original event\n this.shiftKey = originalEvent?.shiftKey ?? false;\n this.ctrlKey = originalEvent?.ctrlKey ?? false;\n this.metaKey = originalEvent?.metaKey ?? false;\n this.altKey = originalEvent?.altKey ?? false;\n\n // Calculate position relative to target\n this.x = 0;\n this.y = 0;\n\n if (originalEvent && originalEvent.clientX !== undefined && eventTarget) {\n const rect = eventTarget.getBoundingClientRect();\n this.x = originalEvent.clientX - rect.left;\n this.y = (originalEvent.clientY ?? 0) - rect.top;\n } else if (eventTarget) {\n // For keyboard events, use center of element\n const rect = eventTarget.getBoundingClientRect();\n this.x = rect.width / 2;\n this.y = rect.height / 2;\n }\n }\n\n /**\n * Call this to allow the press event to propagate to parent elements.\n * By default, press events stop propagation.\n */\n continuePropagation(): void {\n this.#shouldStopPropagation = false;\n }\n\n /**\n * Whether the event should stop propagation.\n * Used internally by the press handler.\n */\n get shouldStopPropagation(): boolean {\n return this.#shouldStopPropagation;\n }\n}\n\n/**\n * Creates a PressEvent from a native event or event-like source.\n */\nexport function createPressEvent(\n type: PressEventType,\n pointerType: PointerType,\n originalEvent: PressEventSource | null,\n target: Element | null,\n): PressEvent {\n return new PressEvent(type, pointerType, originalEvent, target);\n}\n","type Props = { [key: string]: unknown };\n\n/**\n * Merges multiple props objects together, handling event handlers specially\n * by chaining them rather than replacing.\n *\n * Based on react-aria's mergeProps but adapted for SolidJS.\n *\n * @param args - Props objects to merge\n * @returns Merged props object. Use type parameter R to specify the result type.\n */\nexport function mergeProps<R extends object = Record<string, unknown>, T extends object = object>(\n ...args: T[]\n): R {\n const result: Props = {};\n const setResultValue = (key: string, value: unknown) => {\n const resultDescriptor = Object.getOwnPropertyDescriptor(result, key);\n\n if (resultDescriptor?.get || resultDescriptor?.set) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n writable: true,\n value,\n });\n return;\n }\n\n result[key] = value;\n };\n\n for (const props of args) {\n for (const key in props) {\n const descriptor = Object.getOwnPropertyDescriptor(props, key);\n const hasGetter = typeof descriptor?.get === \"function\";\n const getValue = () => (hasGetter ? descriptor.get!.call(props) : props[key]);\n const value = getValue();\n const existingValue = result[key];\n\n if (\n typeof existingValue === \"function\" &&\n typeof value === \"function\" &&\n key.startsWith(\"on\") &&\n key[2] === key[2]?.toUpperCase()\n ) {\n setResultValue(key, chainHandlers(existingValue as Function, value as Function));\n } else if (key === \"class\" || key === \"className\") {\n setResultValue(key, mergeClassNames(existingValue, value));\n } else if (\n key === \"style\" &&\n typeof existingValue === \"object\" &&\n typeof value === \"object\"\n ) {\n setResultValue(key, { ...(existingValue as object), ...(value as object) });\n } else if (hasGetter && (value !== undefined || !(key in result))) {\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: getValue,\n });\n } else if (value !== undefined) {\n setResultValue(key, value);\n }\n }\n }\n\n return result as R;\n}\n\nfunction chainHandlers(existingHandler: Function, newHandler: Function) {\n return (...args: unknown[]) => {\n existingHandler(...args);\n newHandler(...args);\n };\n}\n\nfunction mergeClassNames(...classes: unknown[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","/**\n * filterDOMProps for Solidaria\n *\n * Filters out all props that aren't valid DOM props.\n * This is a 1:1 port of @react-aria/utils filterDOMProps.\n */\n\nconst DOMPropNames = new Set([\"id\"]);\n\nconst labelablePropNames = new Set([\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"aria-details\",\n]);\n\n// See LinkDOMProps in dom.d.ts.\nconst linkPropNames = new Set([\n \"href\",\n \"hrefLang\",\n \"target\",\n \"rel\",\n \"download\",\n \"ping\",\n \"referrerPolicy\",\n]);\n\nconst globalAttrs = new Set([\"dir\", \"lang\", \"hidden\", \"inert\", \"translate\"]);\n\nconst globalEvents = new Set([\n \"onClick\",\n \"onAuxClick\",\n \"onContextMenu\",\n \"onDoubleClick\",\n \"onMouseDown\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"onMouseMove\",\n \"onMouseOut\",\n \"onMouseOver\",\n \"onMouseUp\",\n \"onTouchCancel\",\n \"onTouchEnd\",\n \"onTouchMove\",\n \"onTouchStart\",\n \"onPointerDown\",\n \"onPointerMove\",\n \"onPointerUp\",\n \"onPointerCancel\",\n \"onPointerEnter\",\n \"onPointerLeave\",\n \"onPointerOver\",\n \"onPointerOut\",\n \"onGotPointerCapture\",\n \"onLostPointerCapture\",\n \"onScroll\",\n \"onWheel\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onAnimationIteration\",\n \"onTransitionCancel\",\n \"onTransitionEnd\",\n \"onTransitionRun\",\n \"onTransitionStart\",\n]);\n\nconst propRe = /^(data-.*)$/;\n\nexport interface FilterDOMPropsOptions {\n /**\n * If labelling associated aria properties should be included in the filter.\n */\n labelable?: boolean;\n /** Whether the element is a link and should include DOM props for <a> elements. */\n isLink?: boolean;\n /** Whether to include global DOM attributes. */\n global?: boolean;\n /** Whether to include DOM events. */\n events?: boolean;\n /**\n * A Set of other property names that should be included in the filter.\n */\n propNames?: Set<string>;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterDOMProps<T extends object>(\n props: T,\n opts: FilterDOMPropsOptions = {},\n): Partial<T> {\n const { labelable, isLink, global, events = global, propNames } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n (labelable && labelablePropNames.has(prop)) ||\n (isLink && linkPropNames.has(prop)) ||\n (global && globalAttrs.has(prop)) ||\n (events &&\n (globalEvents.has(prop) ||\n (prop.endsWith(\"Capture\") && globalEvents.has(prop.slice(0, -7))))) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n (filteredProps as Record<string, unknown>)[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n","/**\n * Reactivity utilities for Solidaria\n *\n * Provides type-safe utilities for working with SolidJS reactivity patterns.\n */\n\nimport { Accessor } from \"solid-js\";\n\n/**\n * A value that may be either a raw value or an accessor function.\n * This is a common pattern in SolidJS for props that may be reactive.\n */\nexport type MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Unwraps a MaybeAccessor to get the underlying value.\n * If the input is a function, it calls it to get the value.\n * Otherwise, it returns the value directly.\n *\n * @param value - The value or accessor to unwrap.\n */\nexport function access<T>(value: MaybeAccessor<T>): T {\n return typeof value === \"function\" ? (value as Accessor<T>)() : value;\n}\n\n/**\n * A value that may be undefined or an accessor that returns the value or undefined.\n */\nexport type MaybeAccessorValue<T> = T | undefined | Accessor<T | undefined>;\n\n/**\n * Checks if a value is an accessor function.\n */\nexport function isAccessor<T>(value: MaybeAccessor<T>): value is Accessor<T> {\n return typeof value === \"function\";\n}\n","/**\n * Platform detection utilities.\n * Based on @react-aria/utils platform detection.\n */\n\ninterface NavigatorWithUserAgentData extends Navigator {\n userAgentData?: {\n platform?: string;\n };\n}\n\nfunction getNavigator(): NavigatorWithUserAgentData | null {\n if (typeof window === \"undefined\" || window.navigator == null) return null;\n return window.navigator as NavigatorWithUserAgentData;\n}\n\nfunction testPlatform(re: RegExp): boolean {\n const nav = getNavigator();\n if (!nav) return false;\n return re.test(nav.platform || nav.userAgentData?.platform || \"\");\n}\n\nfunction testUserAgent(re: RegExp): boolean {\n const nav = getNavigator();\n return nav ? re.test(nav.userAgent) : false;\n}\n\nexport function isMac(): boolean {\n return testPlatform(/^Mac/i);\n}\n\nexport function isIPhone(): boolean {\n return testPlatform(/^iPhone/i);\n}\n\nexport function isIPad(): boolean {\n return testPlatform(/^iPad/i) || (isMac() && navigator.maxTouchPoints > 1);\n}\n\nexport function isIOS(): boolean {\n return isIPhone() || isIPad();\n}\n\nexport function isAppleDevice(): boolean {\n return isMac() || isIOS();\n}\n\nexport function isWebKit(): boolean {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n}\n\nexport function isChrome(): boolean {\n return testUserAgent(/Chrome/i);\n}\n\nexport function isAndroid(): boolean {\n return testUserAgent(/Android/i);\n}\n\nexport function isFirefox(): boolean {\n return testUserAgent(/Firefox/i);\n}\n","/**\n * DOM utilities for cross-browser compatibility.\n * Based on @react-aria/utils DOM utilities.\n */\n\n/**\n * Gets the owner document of an element, or the global document.\n */\nexport function getOwnerDocument(el: Element | null | undefined): Document {\n return el?.ownerDocument ?? document;\n}\n\n/**\n * Gets the owner window of an element, or the global window.\n */\nexport function getOwnerWindow(el: Element | null | undefined): Window & typeof globalThis {\n return getOwnerDocument(el).defaultView ?? window;\n}\n\n/**\n * Cross-browser implementation of Node.contains that works with ShadowDOM.\n * In Safari, Node.contains doesn't properly detect elements inside shadow roots.\n */\nexport function nodeContains(parent: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n // Standard contains check\n if (parent.contains(child)) {\n return true;\n }\n\n // Check if child is in a shadow root\n let node: Node | null = child;\n while (node) {\n if (node === parent) {\n return true;\n }\n\n // Check shadow root host\n if ((node as ShadowRoot).host) {\n node = (node as ShadowRoot).host;\n } else {\n node = node.parentNode;\n }\n }\n\n return false;\n}\n\n/**\n * Gets the event target, handling composed path for shadow DOM.\n */\nexport function getEventTarget<T extends EventTarget>(event: Event): T | null {\n // Use composedPath to get the real target when using Shadow DOM\n if (typeof event.composedPath === \"function\") {\n const path = event.composedPath();\n if (path.length > 0) {\n return path[0] as T;\n }\n }\n return event.target as T | null;\n}\n\n/**\n * Checks if an element is a valid focusable element.\n */\nexport function isFocusable(element: Element): boolean {\n // Check if element is disabled\n if ((element as HTMLInputElement).disabled) {\n return false;\n }\n\n // Check native focusable elements\n const tagName = element.tagName.toLowerCase();\n if ([\"input\", \"select\", \"textarea\", \"button\", \"a\", \"area\"].includes(tagName)) {\n // For anchor elements, they must have href to be focusable\n if (tagName === \"a\" || tagName === \"area\") {\n return element.hasAttribute(\"href\");\n }\n return true;\n }\n\n // A negative tabIndex is not tabbable, but it is still programmatically focusable.\n // React Aria's focusable selector includes all tabindex values for this reason.\n const tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex != null) {\n return true;\n }\n\n // Check for contenteditable\n if (\n element.hasAttribute(\"contenteditable\") &&\n element.getAttribute(\"contenteditable\") !== \"false\"\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Checks if a keyboard event should trigger the default action (like clicking).\n */\nexport function isValidKeyboardEvent(event: KeyboardEvent, currentTarget: Element): boolean {\n const { key, code } = event;\n const element = currentTarget as HTMLElement;\n const tagName = element.tagName.toLowerCase();\n const role = element.getAttribute(\"role\");\n\n // Only accept Enter and Space\n const isActivationKey = key === \"Enter\" || key === \" \" || key === \"Spacebar\" || code === \"Space\";\n if (!isActivationKey) {\n return false;\n }\n\n // Text inputs should handle their own keyboard events\n if (tagName === \"textarea\") {\n return false;\n }\n\n // Content editable elements should handle their own keyboard events\n if (element.isContentEditable) {\n return false;\n }\n\n // Links should only respond to Enter, not Space\n const isLink = role === \"link\" || (!role && isHTMLAnchorLink(element));\n if (isLink && key !== \"Enter\") {\n return false;\n }\n\n // Input elements have specific key handling\n if (tagName === \"input\") {\n return isValidInputKey(element as HTMLInputElement, key);\n }\n\n return true;\n}\n\n/**\n * Checks if a key is valid for a specific input type.\n */\nexport function isValidInputKey(target: HTMLInputElement, key: string): boolean {\n const type = target.type.toLowerCase();\n\n // Checkbox and radio only respond to Space\n if (type === \"checkbox\" || type === \"radio\") {\n return key === \" \" || key === \"Spacebar\";\n }\n\n // Text-like inputs handle their own keyboard events\n const textInputTypes = [\n \"text\",\n \"search\",\n \"url\",\n \"tel\",\n \"email\",\n \"password\",\n \"date\",\n \"month\",\n \"week\",\n \"time\",\n \"datetime-local\",\n \"number\",\n ];\n if (textInputTypes.includes(type)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Checks if an element is an HTML anchor link (has href attribute).\n */\nexport function isHTMLAnchorLink(target: Element): boolean {\n return target.tagName === \"A\" && target.hasAttribute(\"href\");\n}\n\n/**\n * Whether to prevent default on keyboard events for this element.\n */\nexport function shouldPreventDefaultKeyboard(target: Element, key: string): boolean {\n if (target instanceof HTMLInputElement) {\n return !isValidInputKey(target, key);\n }\n\n return shouldPreventDefaultUp(target);\n}\n\n/**\n * Whether to prevent default on pointer up for this element.\n */\nexport function shouldPreventDefaultUp(target: Element): boolean {\n const tagName = target.tagName.toLowerCase();\n\n // Never prevent default on form elements\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n return false;\n }\n\n // Don't prevent default on links\n if (tagName === \"a\" || target.getAttribute(\"role\") === \"link\") {\n return false;\n }\n\n // Buttons with submit/reset type should not prevent default\n if (tagName === \"button\") {\n const type = (target as HTMLButtonElement).type;\n if (type === \"submit\" || type === \"reset\") {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Opens a link, supporting both same-window and new-window navigation.\n * Used for keyboard activation of links with Space key (which doesn't natively open links).\n */\nexport function openLink(target: HTMLAnchorElement, event: Event, allowOpener = false): void {\n const { href, target: linkTarget, rel } = target;\n (openLink as { isOpening?: boolean }).isOpening = true;\n\n // Handle modifier keys for open-in-new-tab behavior\n const keyEvent = event as KeyboardEvent;\n const shouldOpenInNewTab =\n linkTarget === \"_blank\" ||\n keyEvent?.metaKey ||\n keyEvent?.ctrlKey ||\n keyEvent?.shiftKey ||\n keyEvent?.altKey;\n\n if (shouldOpenInNewTab) {\n const features = !allowOpener && rel?.includes(\"noopener\") ? \"noopener\" : undefined;\n window.open(href, linkTarget || \"_blank\", features);\n } else {\n window.location.href = href;\n }\n\n (openLink as { isOpening?: boolean }).isOpening = false;\n}\n\n(openLink as { isOpening?: boolean }).isOpening = false;\n\n/**\n * Checks if an element is scrollable based on its overflow style.\n * @param node - The element to check\n * @param checkForOverflow - If true, also check if the element actually overflows\n */\nexport function isScrollable(node: Element | null, checkForOverflow?: boolean): boolean {\n if (!node) {\n return false;\n }\n\n const style = window.getComputedStyle(node);\n const scrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n\n if (scrollable && checkForOverflow) {\n return node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;\n }\n\n return scrollable;\n}\n\n/**\n * Gets the nearest scrollable parent element.\n * @param node - The starting element\n * @param checkForOverflow - If true, only return parents that actually overflow\n */\nexport function getScrollParent(node: Element, checkForOverflow?: boolean): Element {\n let scrollableNode: Element | null = node;\n\n if (isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n return scrollableNode || document.scrollingElement || document.documentElement;\n}\n\n/**\n * Checks if an element will open a virtual keyboard when focused.\n * Used for iOS Safari scroll handling.\n */\nexport function willOpenKeyboard(target: Element | null): boolean {\n if (!target) {\n return false;\n }\n\n const tagName = target.tagName.toLowerCase();\n\n // Inputs that open keyboard (not all input types do)\n if (tagName === \"input\") {\n const type = (target as HTMLInputElement).type.toLowerCase();\n // These input types open the keyboard\n const keyboardTypes = [\n \"text\",\n \"search\",\n \"url\",\n \"tel\",\n \"email\",\n \"password\",\n \"date\",\n \"month\",\n \"week\",\n \"time\",\n \"datetime-local\",\n \"number\",\n ];\n return keyboardTypes.includes(type);\n }\n\n // Textareas always open keyboard\n if (tagName === \"textarea\") {\n return true;\n }\n\n // Contenteditable elements open keyboard\n if (\n target.hasAttribute(\"contenteditable\") &&\n target.getAttribute(\"contenteditable\") !== \"false\"\n ) {\n return true;\n }\n\n return false;\n}\n","/**\n * Geometry utilities for pointer/touch hit testing.\n * Based on @react-aria/interactions geometry utilities.\n */\n\nexport interface Rect {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface EventPoint {\n clientX: number;\n clientY: number;\n width?: number;\n height?: number;\n radiusX?: number;\n radiusY?: number;\n}\n\n/**\n * Checks if two rectangles overlap.\n */\nexport function areRectanglesOverlapping(a: Rect, b: Rect): boolean {\n if (a.left > b.right || b.left > a.right) {\n return false;\n }\n\n if (a.top > b.bottom || b.top > a.bottom) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Gets the bounding rectangle for an event point (touch/pointer).\n * Takes into account the size of the touch point.\n */\nexport function getPointClientRect(point: EventPoint): Rect {\n let offsetX = 0;\n let offsetY = 0;\n\n if (point.width !== undefined && point.width > 0) {\n offsetX = point.width / 2;\n } else if (point.radiusX !== undefined && point.radiusX > 0) {\n // Fallback to radiusX/radiusY (Touch)\n offsetX = point.radiusX;\n }\n\n if (point.height !== undefined && point.height > 0) {\n offsetY = point.height / 2;\n } else if (point.radiusY !== undefined && point.radiusY > 0) {\n offsetY = point.radiusY;\n }\n\n return {\n top: point.clientY - offsetY,\n right: point.clientX + offsetX,\n bottom: point.clientY + offsetY,\n left: point.clientX - offsetX,\n };\n}\n\n/**\n * Checks if a pointer/touch point is over an element.\n */\nexport function isPointOverTarget(point: EventPoint, target: Element): boolean {\n const rect = target.getBoundingClientRect();\n const pointRect = getPointClientRect(point);\n\n return areRectanglesOverlapping(\n {\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n },\n pointRect,\n );\n}\n\n/**\n * Gets the first touch from a TouchEvent's targetTouches.\n */\nexport function getTouchFromEvent(event: TouchEvent): Touch | null {\n const { targetTouches } = event;\n if (targetTouches.length > 0) {\n return targetTouches[0];\n }\n return null;\n}\n\n/**\n * Finds a touch by its identifier in changedTouches.\n */\nexport function getTouchById(event: TouchEvent, pointerId: number | null): Touch | null {\n if (pointerId == null) {\n return null;\n }\n\n const { changedTouches } = event;\n for (let i = 0; i < changedTouches.length; i++) {\n const touch = changedTouches[i];\n if (touch.identifier === pointerId) {\n return touch;\n }\n }\n\n return null;\n}\n","/**\n * Event utilities for detecting virtual clicks and event handling.\n * Based on @react-aria/utils event utilities.\n */\n\nimport { isAndroid } from \"./platform\";\n\n/**\n * Checks if a click event was generated from a virtual source like a screen reader.\n * Virtual clicks typically have detail of 0 and may have zero coordinates.\n */\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as PointerEvent).pointerType === \"\" && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event.\n // If pointerType is defined, event is from a click listener.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === \"click\" && (event as MouseEvent).buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\n/**\n * Checks if a pointer event was generated by a virtual source.\n * iOS VoiceOver fires pointer events with incorrect coordinates.\n * These events have zero width/height.\n */\nexport function isVirtualPointerEvent(event: PointerEvent): boolean {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0.\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === \"mouse\")\n );\n}\n\n/**\n * Creates a synthetic mouse event for programmatic clicking.\n */\nexport function createMouseEvent(type: string, nativeEvent?: Event): MouseEvent {\n const init: MouseEventInit = {\n bubbles: true,\n cancelable: true,\n view: window,\n };\n\n // Copy properties from the native event if provided\n if (nativeEvent) {\n const e = nativeEvent as MouseEvent;\n init.screenX = e.screenX;\n init.screenY = e.screenY;\n init.clientX = e.clientX;\n init.clientY = e.clientY;\n init.ctrlKey = e.ctrlKey;\n init.shiftKey = e.shiftKey;\n init.altKey = e.altKey;\n init.metaKey = e.metaKey;\n init.button = e.button;\n init.buttons = e.buttons;\n init.relatedTarget = e.relatedTarget;\n }\n\n return new MouseEvent(type, init);\n}\n\n/**\n * Creates a chain of event handlers that calls each in sequence.\n */\nexport function chain<T extends (...args: any[]) => any>(\n ...callbacks: (T | undefined | null)[]\n): T {\n return ((...args: Parameters<T>) => {\n for (const callback of callbacks) {\n if (typeof callback === \"function\") {\n callback(...args);\n }\n }\n }) as T;\n}\n\n/**\n * Sets the target property on an event object.\n * Used for synthetic events where target needs to be modified.\n */\nexport function setEventTarget<T extends Event>(event: T, target: EventTarget): void {\n Object.defineProperty(event, \"target\", {\n value: target,\n writable: false,\n configurable: true,\n });\n Object.defineProperty(event, \"currentTarget\", {\n value: target,\n writable: false,\n configurable: true,\n });\n}\n","/**\n * Text selection management utilities.\n * Based on @react-aria/interactions textSelection utilities.\n *\n * On iOS, long press triggers text selection. The only way to prevent this\n * is to set user-select: none on the entire page. On other platforms,\n * we can just set it on the target element.\n */\n\nimport { isIOS } from \"./platform\";\nimport { getOwnerDocument } from \"./dom\";\n\ntype State = \"default\" | \"disabled\" | \"restoring\";\n\n// Global state to manage text selection across multiple press interactions\nlet state: State = \"default\";\nlet savedUserSelect = \"\";\nlet modifiedElementMap = new WeakMap<HTMLElement, string>();\n\n/**\n * Disables text selection on the page or element during press.\n * On iOS, applies to the entire document. On other platforms, just the target.\n */\nexport function disableTextSelection(target?: HTMLElement): void {\n if (isIOS()) {\n // iOS requires disabling selection on the entire page\n if (state === \"default\") {\n const documentElement = getOwnerDocument(target).documentElement;\n savedUserSelect = documentElement.style.webkitUserSelect;\n documentElement.style.webkitUserSelect = \"none\";\n }\n state = \"disabled\";\n } else if (target) {\n // On other platforms, just disable on the target\n const element = target as HTMLElement;\n if (!modifiedElementMap.has(element)) {\n modifiedElementMap.set(element, element.style.userSelect);\n element.style.userSelect = \"none\";\n }\n }\n}\n\n/**\n * Restores text selection after press ends.\n * On iOS, waits 300ms to avoid selection appearing during tap.\n */\nexport function restoreTextSelection(target?: HTMLElement): void {\n if (isIOS()) {\n // Don't restore if another press is active\n if (state !== \"disabled\") {\n return;\n }\n\n state = \"restoring\";\n\n // Wait for iOS to finish any pending selection actions\n // 300ms is the iOS long-press delay\n setTimeout(() => {\n // Use runAfterTransition to avoid CSS recomputation during animation\n runAfterTransition(() => {\n // Only restore if still in 'restoring' state (no new press started)\n if (state === \"restoring\") {\n const documentElement = getOwnerDocument(target).documentElement;\n if (savedUserSelect) {\n documentElement.style.webkitUserSelect = savedUserSelect;\n } else {\n documentElement.style.removeProperty(\"-webkit-user-select\");\n }\n savedUserSelect = \"\";\n state = \"default\";\n }\n });\n }, 300);\n } else if (target) {\n // On other platforms, restore immediately\n const element = target as HTMLElement;\n const savedValue = modifiedElementMap.get(element);\n if (savedValue !== undefined) {\n if (savedValue) {\n element.style.userSelect = savedValue;\n } else {\n element.style.removeProperty(\"user-select\");\n }\n modifiedElementMap.delete(element);\n }\n }\n}\n\n// Tracks pending transitions for runAfterTransition\nconst pendingTransitions = new Set<() => void>();\nlet transitionTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Runs a callback after CSS transitions complete.\n * Batches multiple callbacks to avoid unnecessary layout thrashing.\n */\nfunction runAfterTransition(callback: () => void): void {\n // If we haven't started tracking transitions, run immediately\n pendingTransitions.add(callback);\n\n // Debounce - wait for any transitions to settle\n if (transitionTimeout != null) {\n clearTimeout(transitionTimeout);\n }\n\n transitionTimeout = setTimeout(() => {\n // Run all pending callbacks\n for (const cb of pendingTransitions) {\n cb();\n }\n pendingTransitions.clear();\n transitionTimeout = null;\n }, 0);\n}\n","/**\n * Focus management utilities.\n * Based on @react-aria/utils focus utilities.\n */\n\nimport { getEventTarget, getOwnerDocument, getOwnerWindow, isFocusable } from \"./dom\";\n\n/**\n * Focuses an element without scrolling the page.\n * Uses preventScroll option with fallback for older browsers.\n */\nexport function focusWithoutScrolling(element: HTMLElement | null): void {\n if (!element) return;\n\n try {\n element.focus({ preventScroll: true });\n } catch {\n // Fallback for browsers that don't support preventScroll\n const scrollableElements = getScrollableAncestors(element);\n const scrollPositions = scrollableElements.map((el) => ({\n element: el,\n scrollTop: el.scrollTop,\n scrollLeft: el.scrollLeft,\n }));\n\n element.focus();\n\n for (const { element: el, scrollTop, scrollLeft } of scrollPositions) {\n el.scrollTop = scrollTop;\n el.scrollLeft = scrollLeft;\n }\n }\n}\n\n/**\n * Gets all scrollable ancestors of an element.\n */\nfunction getScrollableAncestors(element: Element): Element[] {\n const ancestors: Element[] = [];\n let parent = element.parentElement;\n\n while (parent) {\n const style = getComputedStyle(parent);\n const overflowY = style.overflowY;\n const overflowX = style.overflowX;\n\n if (\n overflowY === \"auto\" ||\n overflowY === \"scroll\" ||\n overflowX === \"auto\" ||\n overflowX === \"scroll\"\n ) {\n ancestors.push(parent);\n }\n\n parent = parent.parentElement;\n }\n\n // Also include the document scrolling element\n const doc = getOwnerDocument(element);\n ancestors.push(doc.documentElement);\n\n return ancestors;\n}\n\n/**\n * Prevents focus from moving to a new element temporarily.\n * Used when clicking on a button that shouldn't steal focus.\n */\nexport function preventFocus(target: Element | null): (() => void) | undefined {\n while (target && !isFocusable(target)) {\n target = target.parentElement;\n }\n\n const ownerWindow = getOwnerWindow(target);\n const activeElement = ownerWindow.document.activeElement as HTMLElement | null;\n\n if (!activeElement || activeElement === target) {\n return undefined;\n }\n\n let isRefocusing = false;\n\n const onBlur = (event: FocusEvent) => {\n if (getEventTarget(event) === activeElement || isRefocusing) {\n event.stopImmediatePropagation();\n }\n };\n\n const onFocusOut = (event: FocusEvent) => {\n if (getEventTarget(event) === activeElement || isRefocusing) {\n event.stopImmediatePropagation();\n\n if (!target && !isRefocusing) {\n isRefocusing = true;\n focusWithoutScrolling(activeElement);\n cleanup();\n }\n }\n };\n\n const onFocus = (event: FocusEvent) => {\n if (getEventTarget(event) === target || isRefocusing) {\n event.stopImmediatePropagation();\n }\n };\n\n const onFocusIn = (event: FocusEvent) => {\n if (getEventTarget(event) === target || isRefocusing) {\n event.stopImmediatePropagation();\n\n if (!isRefocusing) {\n isRefocusing = true;\n focusWithoutScrolling(activeElement);\n cleanup();\n }\n }\n };\n\n ownerWindow.addEventListener(\"blur\", onBlur, true);\n ownerWindow.addEventListener(\"focusout\", onFocusOut, true);\n ownerWindow.addEventListener(\"focusin\", onFocusIn, true);\n ownerWindow.addEventListener(\"focus\", onFocus, true);\n\n const raf = ownerWindow.requestAnimationFrame(cleanup);\n\n function cleanup() {\n ownerWindow.cancelAnimationFrame(raf);\n ownerWindow.removeEventListener(\"blur\", onBlur, true);\n ownerWindow.removeEventListener(\"focusout\", onFocusOut, true);\n ownerWindow.removeEventListener(\"focusin\", onFocusIn, true);\n ownerWindow.removeEventListener(\"focus\", onFocus, true);\n isRefocusing = false;\n }\n\n return cleanup;\n}\n\n/**\n * Safely focuses an element, alias for focusWithoutScrolling.\n * This matches the react-aria focusSafely function name.\n */\nexport const focusSafely = focusWithoutScrolling;\n","/**\n * Global listener management utility.\n * Based on @react-aria/utils useGlobalListeners hook, adapted for SolidJS.\n *\n * In SolidJS, we use onCleanup for automatic cleanup instead of useEffect return.\n */\n\nimport { onCleanup } from \"solid-js\";\n\nexport interface GlobalListenerOptions extends AddEventListenerOptions {\n /** Whether to add the listener to the window instead of document */\n isWindow?: boolean;\n}\n\n/**\n * Creates a manager for global event listeners that automatically cleans up.\n * Use this in a component to register document/window level listeners\n * that will be removed when the component unmounts.\n */\nexport function createGlobalListeners() {\n const listeners: Array<{\n target: EventTarget;\n type: string;\n handler: EventListener;\n options?: AddEventListenerOptions;\n }> = [];\n\n /**\n * Adds a global event listener.\n */\n function addGlobalListener<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: GlobalListenerOptions,\n ): void;\n function addGlobalListener<K extends keyof WindowEventMap>(\n type: K,\n handler: (ev: WindowEventMap[K]) => void,\n options?: GlobalListenerOptions & { isWindow: true },\n ): void;\n function addGlobalListener(\n type: string,\n handler: EventListener,\n options?: GlobalListenerOptions,\n ): void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n passive: options.passive,\n once: options.once,\n }\n : undefined;\n\n target.addEventListener(type, handler, listenerOptions);\n listeners.push({ target, type, handler, options: listenerOptions });\n }\n\n /**\n * Removes a specific global event listener.\n */\n function removeGlobalListener<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: AddEventListenerOptions,\n ): void;\n function removeGlobalListener<K extends keyof WindowEventMap>(\n type: K,\n handler: (ev: WindowEventMap[K]) => void,\n options?: AddEventListenerOptions & { isWindow: true },\n ): void;\n function removeGlobalListener(\n type: string,\n handler: EventListener,\n options?: AddEventListenerOptions & { isWindow?: boolean },\n ): void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n }\n : undefined;\n\n target.removeEventListener(type, handler, listenerOptions);\n\n // Remove from tracked listeners\n const index = listeners.findIndex(\n (l) =>\n l.target === target &&\n l.type === type &&\n l.handler === handler &&\n l.options?.capture === listenerOptions?.capture,\n );\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n }\n\n /**\n * Removes all registered global listeners.\n */\n function removeAllGlobalListeners(): void {\n for (const { target, type, handler, options } of listeners) {\n target.removeEventListener(type, handler, options);\n }\n listeners.length = 0;\n }\n\n // Automatically clean up when the component/scope is disposed\n onCleanup(removeAllGlobalListeners);\n\n return {\n addGlobalListener,\n removeGlobalListener,\n removeAllGlobalListeners,\n };\n}\n\n/**\n * Simple utility to add a single global listener with automatic cleanup.\n * For one-off listeners where the full manager isn't needed.\n */\nexport function addGlobalListenerOnce<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: GlobalListenerOptions,\n): () => void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n passive: options.passive,\n once: options.once,\n }\n : undefined;\n\n target.addEventListener(type, handler as EventListener, listenerOptions);\n\n return () => {\n target.removeEventListener(type, handler as EventListener, listenerOptions);\n };\n}\n","/**\n * Environment detection utilities.\n * These avoid direct references to process.env which can cause TypeScript issues in browser environments.\n * Compatible with Node.js and Vite environments.\n */\n\ntype ImportMetaWithEnv = ImportMeta & {\n env?: Record<string, unknown> & { DEV?: boolean; PROD?: boolean };\n};\ntype ProcessLike = { env?: Record<string, string | undefined> };\n\nfunction getEnvVar(key: string): string | undefined {\n const importMetaEnv = (import.meta as ImportMetaWithEnv).env;\n if (importMetaEnv && typeof importMetaEnv[key] === \"string\") {\n return importMetaEnv[key] as string;\n }\n\n const processEnv = (globalThis as typeof globalThis & { process?: ProcessLike }).process?.env;\n if (processEnv) {\n return processEnv[key];\n }\n return undefined;\n}\n\n/**\n * Check if we're running in a test environment.\n */\nexport function isTestEnv(): boolean {\n return getEnvVar(\"NODE_ENV\") === \"test\";\n}\n\n/**\n * Check if we're running in a development environment (not production).\n */\nexport function isDevEnv(): boolean {\n const importMetaEnv = (import.meta as ImportMetaWithEnv).env;\n if (importMetaEnv?.DEV === true) {\n return true;\n }\n const nodeEnv = getEnvVar(\"NODE_ENV\");\n return nodeEnv !== \"production\";\n}\n\n/**\n * Check if we're running in production.\n */\nexport function isProdEnv(): boolean {\n const importMetaEnv = (import.meta as ImportMetaWithEnv).env;\n if (importMetaEnv?.PROD === true) {\n return true;\n }\n return getEnvVar(\"NODE_ENV\") === \"production\";\n}\n","/**\n * createDescription - Creates a hidden element for dynamic aria-describedby content.\n *\n * This utility creates a visually hidden element containing description text and\n * returns an aria-describedby prop pointing to it. Multiple components using the\n * same description will share the same element (reference counted).\n *\n * Port of @react-aria/utils/useDescription.\n *\n * @example\n * ```tsx\n * function SortableColumn(props) {\n * const descriptionProps = createDescription(\n * () => props.sortDirection ? `Sorted ${props.sortDirection}` : undefined\n * );\n *\n * return (\n * <th {...descriptionProps}>\n * {props.children}\n * </th>\n * );\n * }\n * ```\n */\n\nimport { createSignal, createEffect, onCleanup, type Accessor } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport interface DescriptionProps {\n \"aria-describedby\"?: string;\n}\n\nlet descriptionId = 0;\nconst descriptionNodes = new Map<string, { refCount: number; element: Element }>();\n\n/**\n * Creates an invisible description element and returns aria-describedby props.\n *\n * The element is created in the DOM and reference counted - multiple uses of\n * the same description text will share the same element. When all references\n * are removed, the element is cleaned up.\n *\n * @param description - Accessor that returns the description text, or undefined\n * @returns Object with aria-describedby prop (or empty object if no description)\n *\n * @example\n * ```tsx\n * const descProps = createDescription(() => 'Press Enter to submit');\n * return <button {...descProps}>Submit</button>;\n * ```\n */\nexport function createDescription(description: Accessor<string | undefined>): DescriptionProps {\n if (isServer) {\n return {};\n }\n\n const [id, setId] = createSignal<string | undefined>();\n\n createEffect(() => {\n const desc = description();\n\n if (!desc) {\n setId(undefined);\n return;\n }\n\n let node = descriptionNodes.get(desc);\n\n if (!node) {\n const newId = `solidaria-description-${descriptionId++}`;\n setId(newId);\n\n const element = document.createElement(\"div\");\n element.id = newId;\n element.style.display = \"none\";\n element.textContent = desc;\n document.body.appendChild(element);\n\n node = { refCount: 0, element };\n descriptionNodes.set(desc, node);\n } else {\n setId(node.element.id);\n }\n\n node.refCount++;\n\n onCleanup(() => {\n if (node && --node.refCount === 0) {\n node.element.remove();\n descriptionNodes.delete(desc);\n }\n });\n });\n\n return {\n get \"aria-describedby\"() {\n const desc = description();\n return desc ? id() : undefined;\n },\n };\n}\n\n/**\n * Utility to get all active description nodes (for testing).\n * @internal\n */\nexport function getDescriptionNodeCount(): number {\n return descriptionNodes.size;\n}\n\n/**\n * Utility to clear all description nodes (for testing cleanup).\n * @internal\n */\nexport function clearDescriptionNodes(): void {\n for (const [, node] of descriptionNodes) {\n node.element.remove();\n }\n descriptionNodes.clear();\n}\n","/**\n * createPress - Handles press interactions across mouse, touch, keyboard, and virtual clicks.\n *\n * This is a 1-1 port of React-Aria's usePress hook adapted for SolidJS.\n * All behaviors, edge cases, and platform-specific handling are preserved.\n */\n\nimport { createSignal, JSX, Accessor, onCleanup } from \"solid-js\";\nimport { PressEvent, PointerType, createPressEvent, type PressEventSource } from \"./PressEvent\";\nimport {\n nodeContains,\n getEventTarget,\n isValidKeyboardEvent,\n isHTMLAnchorLink,\n shouldPreventDefaultKeyboard,\n isVirtualClick,\n isVirtualPointerEvent,\n isPointOverTarget,\n getTouchFromEvent,\n getTouchById,\n disableTextSelection,\n restoreTextSelection,\n preventFocus,\n openLink,\n isMac,\n createGlobalListeners,\n setEventTarget,\n} from \"../utils\";\n\nexport { PressEvent, type PointerType } from \"./PressEvent\";\nexport type { IPressEvent, PressEventType } from \"./PressEvent\";\n\nexport interface CreatePressProps {\n /** Whether the target is currently disabled. */\n isDisabled?: Accessor<boolean> | boolean;\n /** Handler called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /**\n * Handler called when a press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler called when a press is released over the target, regardless of whether it started on the target. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /**\n * Handler called on native click event.\n * Some third-party libraries pass onClick instead of onPress.\n * This matches the browser's native activation behavior for certain elements.\n */\n onClick?: (e: MouseEvent) => void;\n /** Whether the press should be visual only, not triggering onPress. */\n isPressed?: Accessor<boolean> | boolean;\n /** Whether to prevent focus when pressing. */\n preventFocusOnPress?: boolean;\n /** Whether long press should cancel when pointer moves out of target. */\n shouldCancelOnPointerExit?: boolean;\n /** Whether text selection should be allowed during press. */\n allowTextSelectionOnPress?: boolean;\n}\n\nexport interface PressResult {\n /** Whether the target is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Props to spread on the target element. */\n pressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === \"function\") {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\nfunction isPressedValue(isPressed: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isPressed === \"function\") {\n return isPressed();\n }\n return isPressed ?? false;\n}\n\n// Track which links have been programmatically clicked to avoid double activation\nconst linkClickedSet = new WeakSet<HTMLElement>();\n\n// CSS for preventing double-tap zoom delay\nlet pressableCSSInjected = false;\nfunction injectPressableCSS(): void {\n if (pressableCSSInjected || typeof document === \"undefined\") return;\n\n const style = document.createElement(\"style\");\n style.id = \"solidaria-pressable-style\";\n style.textContent = `\n [data-solidaria-pressable] {\n touch-action: pan-x pan-y pinch-zoom;\n }\n `;\n document.head.appendChild(style);\n pressableCSSInjected = true;\n}\n\n/**\n * Handles press interactions across mouse, touch, keyboard, and screen readers.\n * Provides consistent press behavior regardless of input method.\n *\n * Based on react-aria's usePress but adapted for SolidJS.\n */\nexport function createPress(props: CreatePressProps = {}): PressResult {\n // Internal pressed state (for visual feedback)\n const [internalIsPressed, setInternalIsPressed] = createSignal(false);\n\n // Use controlled isPressed if provided, otherwise internal state\n const isPressed = (): boolean => {\n const controlledPressed = isPressedValue(props.isPressed);\n if (controlledPressed) {\n return controlledPressed;\n }\n return internalIsPressed();\n };\n\n // State tracking (using plain variables - SolidJS doesn't need refs for mutable state)\n let pressState = {\n isPressed: false,\n ignoreEmulatedMouseEvents: false,\n ignoreClickAfterPress: false,\n didFirePressStart: false,\n isTriggeringEvent: false,\n activePointerId: null as number | null,\n target: null as Element | null,\n isOverTarget: false,\n pointerType: null as PointerType | null,\n userSelect: undefined as string | undefined,\n metaKeyEvents: null as Map<string, KeyboardEvent> | null,\n clickCleanup: null as (() => void) | null,\n focusCleanup: null as (() => void) | null,\n };\n\n // Global listeners manager\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n\n // Inject CSS on first use\n injectPressableCSS();\n\n // --- Event Triggers ---\n\n const triggerPressStart = (\n originalEvent: PressEventSource,\n pointerType: PointerType,\n ): boolean => {\n if (isDisabledValue(props.isDisabled) || pressState.didFirePressStart) {\n return false;\n }\n\n let shouldStopPropagation = true;\n pressState.isTriggeringEvent = true;\n\n if (props.onPressStart) {\n const event = createPressEvent(\"pressstart\", pointerType, originalEvent, pressState.target!);\n props.onPressStart(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (props.onPressChange) {\n props.onPressChange(true);\n }\n\n pressState.isTriggeringEvent = false;\n pressState.didFirePressStart = true;\n setInternalIsPressed(true);\n\n return shouldStopPropagation;\n };\n\n const triggerPressEnd = (\n originalEvent: PressEventSource,\n pointerType: PointerType,\n wasPressed = true,\n ): boolean => {\n if (!pressState.didFirePressStart) {\n return false;\n }\n\n pressState.didFirePressStart = false;\n pressState.isTriggeringEvent = true;\n\n let shouldStopPropagation = true;\n if (props.onPressEnd) {\n const event = createPressEvent(\"pressend\", pointerType, originalEvent, pressState.target!);\n props.onPressEnd(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (props.onPressChange) {\n props.onPressChange(false);\n }\n\n setInternalIsPressed(false);\n\n if (wasPressed && !isDisabledValue(props.isDisabled)) {\n if (props.onPress) {\n const event = createPressEvent(\"press\", pointerType, originalEvent, pressState.target!);\n props.onPress(event);\n shouldStopPropagation = shouldStopPropagation && event.shouldStopPropagation;\n }\n }\n\n pressState.isTriggeringEvent = false;\n\n return shouldStopPropagation;\n };\n\n const triggerPressUp = (originalEvent: PressEventSource, pointerType: PointerType): boolean => {\n if (isDisabledValue(props.isDisabled)) {\n return false;\n }\n\n if (props.onPressUp) {\n pressState.isTriggeringEvent = true;\n const event = createPressEvent(\"pressup\", pointerType, originalEvent, pressState.target!);\n props.onPressUp(event);\n pressState.isTriggeringEvent = false;\n return event.shouldStopPropagation;\n }\n\n return true;\n };\n\n const triggerSyntheticClick = (\n originalEvent: KeyboardEvent | TouchEvent,\n target: HTMLElement,\n ): void => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n if (props.onClick) {\n const event = new MouseEvent(\"click\", originalEvent as MouseEventInit);\n setEventTarget(event, target);\n props.onClick(event);\n }\n };\n\n const cancel = (originalEvent: PressEventSource): void => {\n if (!pressState.isPressed) {\n return;\n }\n\n if (pressState.target && pressState.didFirePressStart && pressState.pointerType != null) {\n triggerPressEnd(originalEvent, pressState.pointerType, false);\n }\n\n pressState.isPressed = false;\n pressState.isOverTarget = false;\n pressState.activePointerId = null;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n // Clean up click timeout/listener if set\n if (pressState.clickCleanup) {\n pressState.clickCleanup();\n pressState.clickCleanup = null;\n }\n\n if (pressState.focusCleanup) {\n pressState.focusCleanup();\n pressState.focusCleanup = null;\n }\n\n if (!props.allowTextSelectionOnPress) {\n restoreTextSelection(pressState.target as HTMLElement);\n }\n };\n\n // --- Pointer Event Handlers (used when PointerEvent is available) ---\n\n const onPointerDown: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n // Only handle left clicks, and ignore events that bubbled through portals\n const button = e.button ?? 0;\n if (button !== 0 || !nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n // iOS VoiceOver bug: fires pointer events with incorrect coordinates\n // Let the click handler deal with it instead\n if (isVirtualPointerEvent(e)) {\n pressState.pointerType = \"virtual\";\n return;\n }\n\n pressState.pointerType = e.pointerType as PointerType;\n\n if (!pressState.isPressed) {\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.activePointerId = e.pointerId;\n pressState.target = e.currentTarget;\n\n if (!props.allowTextSelectionOnPress) {\n disableTextSelection(pressState.target as HTMLElement);\n }\n\n const shouldStopPropagation = triggerPressStart(e, pressState.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n // Set up global listeners for pointer events\n addGlobalListener(\"pointerup\", onPointerUp);\n addGlobalListener(\"pointercancel\", onPointerCancel);\n }\n };\n\n // Mouse down handler when using pointer events - only prevents focus, doesn't trigger press\n const onMouseDownPointer: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n if (e.button === 0) {\n if (props.preventFocusOnPress) {\n pressState.focusCleanup?.();\n pressState.focusCleanup = preventFocus(getEventTarget(e) as Element | null) ?? null;\n }\n e.stopPropagation();\n }\n };\n\n const onPointerUp = (e: PointerEvent): void => {\n // Only handle events for our active pointer\n const button = e.button ?? 0;\n if (\n e.pointerId !== pressState.activePointerId ||\n !pressState.isPressed ||\n button !== 0 ||\n !pressState.target\n ) {\n return;\n }\n\n const isOverTarget = nodeContains(pressState.target, getEventTarget(e) as Element);\n if (isOverTarget && pressState.pointerType != null && pressState.pointerType !== \"virtual\") {\n // Pointer released over target - wait for onClick to complete the press sequence.\n // This matches React-Aria's behavior for compatibility with DOM mutations and third-party libraries.\n // https://github.com/adobe/react-spectrum/issues/1513\n // https://issues.chromium.org/issues/40732224\n //\n // However, if stopPropagation is called on the click event (e.g., by a child input element),\n // the onClick handler on this element won't fire. We work around this by triggering a click\n // ourselves after a timeout. This timeout is canceled during the click event in case the\n // real one fires first. The timeout must be at least 32ms, because Safari on iOS delays the\n // click event on non-form elements without certain ARIA roles (for hover emulation).\n // https://github.com/WebKit/WebKit/blob/dccfae42bb29bd4bdef052e469f604a9387241c0/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm#L875-L892\n let clickFired = false;\n const timeout = setTimeout(() => {\n // Guard for SSR/test environments where the element may no longer exist\n if (typeof HTMLElement === \"undefined\") {\n return;\n }\n if (pressState.isPressed && pressState.target instanceof HTMLElement) {\n if (clickFired) {\n // Click already happened, just cancel the press state\n cancel(e);\n } else {\n // Click didn't happen (probably due to stopPropagation), trigger it manually\n pressState.target.focus();\n pressState.target.click();\n }\n }\n }, 80);\n\n // Use a capturing listener to track if a click occurred.\n // If stopPropagation is called it may never reach our handler.\n const doc = pressState.target.ownerDocument ?? document;\n const clickListener = () => {\n clickFired = true;\n };\n doc.addEventListener(\"click\", clickListener, true);\n\n // Store cleanup function\n pressState.clickCleanup = () => {\n clearTimeout(timeout);\n doc.removeEventListener(\"click\", clickListener, true);\n };\n\n pressState.isOverTarget = false;\n } else {\n // Pointer released outside target, or virtual - cancel the press\n cancel(e);\n }\n };\n\n const onPointerCancel = (e: PointerEvent): void => {\n if (e.pointerId === pressState.activePointerId) {\n cancel(e);\n }\n };\n\n const onPointerUpTarget: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n if (!nodeContains(e.currentTarget, getEventTarget(e)) || pressState.pointerType === \"virtual\") {\n return;\n }\n\n if (e.button === 0 && !pressState.isPressed) {\n triggerPressUp(e, (pressState.pointerType || e.pointerType || \"mouse\") as PointerType);\n }\n };\n\n const onPointerEnter: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n if (\n e.pointerId === pressState.activePointerId &&\n pressState.target &&\n !pressState.isOverTarget &&\n pressState.pointerType != null\n ) {\n pressState.isOverTarget = true;\n triggerPressStart(e, pressState.pointerType);\n }\n };\n\n const onPointerLeave: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n if (\n e.pointerId === pressState.activePointerId &&\n pressState.target &&\n pressState.isOverTarget &&\n pressState.pointerType != null\n ) {\n pressState.isOverTarget = false;\n triggerPressEnd(e, pressState.pointerType, false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n // --- Touch Event Helpers ---\n\n const createTouchEvent = (target: Element, event: TouchEvent): PressEventSource => {\n let clientX = 0;\n let clientY = 0;\n if (event.targetTouches && event.targetTouches.length === 1) {\n clientX = event.targetTouches[0].clientX;\n clientY = event.targetTouches[0].clientY;\n }\n return {\n currentTarget: target,\n shiftKey: event.shiftKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n altKey: event.altKey,\n clientX,\n clientY,\n };\n };\n\n // --- Touch Event Handlers (fallback for testing/older browsers) ---\n\n const onTouchStart: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n // If already pressed via pointer events, ignore touch events\n if (pressState.isPressed) {\n return;\n }\n\n const touch = getTouchFromEvent(e);\n if (!touch) {\n return;\n }\n\n pressState.activePointerId = touch.identifier;\n pressState.ignoreEmulatedMouseEvents = true;\n pressState.isOverTarget = true;\n pressState.isPressed = true;\n pressState.target = e.currentTarget;\n pressState.pointerType = \"touch\";\n\n if (!props.allowTextSelectionOnPress) {\n disableTextSelection(pressState.target as HTMLElement);\n }\n\n const shouldStopPropagation = triggerPressStart(\n createTouchEvent(pressState.target, e),\n \"touch\",\n );\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n addGlobalListener(\"scroll\", onScroll, { capture: true, isWindow: true });\n };\n\n const onTouchMove: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (!pressState.isPressed) {\n return;\n }\n\n const touch = getTouchById(e, pressState.activePointerId);\n if (!touch) {\n return;\n }\n\n const target = pressState.target!;\n const isOverTarget = isPointOverTarget(touch, target);\n\n if (isOverTarget !== pressState.isOverTarget) {\n pressState.isOverTarget = isOverTarget;\n if (isOverTarget) {\n triggerPressStart(createTouchEvent(target, e), \"touch\");\n } else {\n triggerPressEnd(createTouchEvent(target, e), \"touch\", false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(createTouchEvent(target, e));\n }\n }\n }\n };\n\n const onTouchEnd: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (!pressState.isPressed) {\n return;\n }\n\n const touch = getTouchById(e, pressState.activePointerId);\n if (!touch) {\n return;\n }\n\n const target = pressState.target!;\n const isOverTarget = isPointOverTarget(touch, target);\n\n if (isOverTarget) {\n triggerPressUp(createTouchEvent(target, e), \"touch\");\n triggerPressEnd(\n createTouchEvent(target, e),\n \"touch\",\n isOverTarget && pressState.isOverTarget,\n );\n if (target instanceof HTMLElement) {\n triggerSyntheticClick(e, target);\n }\n } else {\n triggerPressEnd(createTouchEvent(target, e), \"touch\", false);\n }\n\n pressState.isPressed = false;\n pressState.isOverTarget = false;\n pressState.activePointerId = null;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n if (!props.allowTextSelectionOnPress) {\n restoreTextSelection(target as HTMLElement);\n }\n };\n\n const onTouchCancel: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (pressState.target) {\n cancel(createTouchEvent(pressState.target, e));\n } else {\n cancel(e);\n }\n };\n\n const onScroll = (e: Event): void => {\n if (pressState.isPressed && nodeContains(e.target as Element, pressState.target)) {\n cancel(e);\n }\n };\n\n // --- Mouse Event Handlers (fallback when PointerEvent is not available) ---\n\n const onMouseDownFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n // Only handle left button\n if (e.button !== 0) {\n return;\n }\n\n // Ignore emulated mouse events from touch\n if (pressState.ignoreEmulatedMouseEvents) {\n e.stopPropagation();\n return;\n }\n\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.target = e.currentTarget;\n pressState.pointerType = isVirtualClick(e) ? \"virtual\" : \"mouse\";\n\n const shouldStopPropagation = triggerPressStart(e, pressState.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n if (props.preventFocusOnPress) {\n pressState.focusCleanup?.();\n pressState.focusCleanup = preventFocus(getEventTarget(e) as Element | null) ?? null;\n }\n\n addGlobalListener(\"mouseup\", onMouseUpFallback);\n };\n\n const onMouseUpFallback = (e: MouseEvent): void => {\n if (e.button !== 0) {\n return;\n }\n\n if (!pressState.ignoreEmulatedMouseEvents && e.button === 0 && !pressState.isPressed) {\n triggerPressUp(e, pressState.pointerType || \"mouse\");\n }\n };\n\n const onMouseEnterFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!pressState.isPressed || pressState.ignoreEmulatedMouseEvents) {\n return;\n }\n\n if (\n pressState.isPressed &&\n !pressState.ignoreEmulatedMouseEvents &&\n pressState.pointerType != null\n ) {\n pressState.isOverTarget = true;\n triggerPressStart(e, pressState.pointerType);\n }\n };\n\n const onMouseLeaveFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!pressState.isPressed || pressState.ignoreEmulatedMouseEvents) {\n return;\n }\n\n if (\n pressState.isPressed &&\n !pressState.ignoreEmulatedMouseEvents &&\n pressState.pointerType != null\n ) {\n pressState.isOverTarget = false;\n triggerPressEnd(e, pressState.pointerType, false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n // --- Keyboard Event Handlers ---\n\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n if (!isValidKeyboardEvent(e, e.currentTarget)) {\n return;\n }\n\n // Prevent key repeat\n if (e.repeat) {\n e.preventDefault();\n return;\n }\n\n pressState.target = e.currentTarget;\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.pointerType = \"keyboard\";\n\n const shouldStopPropagation = triggerPressStart(e, \"keyboard\");\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n // Prevent default for non-native interactive elements\n if (shouldPreventDefaultKeyboard(e.currentTarget, e.key)) {\n e.preventDefault();\n }\n\n // macOS bug: keyup doesn't fire while Meta key is held\n // Track keydown events while Meta is held so we can manually dispatch keyup\n if (isMac() && e.metaKey && !e.ctrlKey && !e.altKey) {\n pressState.metaKeyEvents = pressState.metaKeyEvents || new Map();\n pressState.metaKeyEvents.set(e.key, e);\n }\n\n // For Enter key on native buttons, the click fires on keydown\n // Set flag to ignore it\n if (e.key === \"Enter\") {\n pressState.ignoreClickAfterPress = true;\n }\n\n // Set up global keyup listener\n addGlobalListener(\"keyup\", onKeyUp, { capture: true });\n };\n\n const onKeyUp = (e: KeyboardEvent): void => {\n if (!pressState.isPressed || pressState.pointerType !== \"keyboard\") {\n return;\n }\n\n if (!isValidKeyboardEvent(e, pressState.target!)) {\n return;\n }\n\n // Handle macOS Meta key bug\n if (isMac() && e.key === \"Meta\" && pressState.metaKeyEvents?.size) {\n // When Meta releases, dispatch keyup for any keys that were pressed during\n for (const [key, event] of pressState.metaKeyEvents) {\n pressState.target?.dispatchEvent(\n new KeyboardEvent(\"keyup\", {\n key,\n code: event.code,\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n pressState.metaKeyEvents.clear();\n return;\n }\n\n const target = pressState.target!;\n const eventTarget = getEventTarget(e) as Element;\n const wasPressed = nodeContains(target, eventTarget);\n const shouldStopPropagation = wasPressed ? triggerPressUp(e, \"keyboard\") : true;\n const shouldStopPropagationEnd = triggerPressEnd(e, \"keyboard\", wasPressed);\n\n pressState.isPressed = false;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n // Prevent default for non-native interactive elements, but preserve native\n // input behavior such as checkbox Space toggling.\n if (shouldPreventDefaultKeyboard(getEventTarget(e) as Element, e.key)) {\n e.preventDefault();\n }\n\n if (wasPressed && target instanceof HTMLElement) {\n triggerSyntheticClick(e, target);\n }\n\n // Handle link activation with non-Enter keys. Native links only respond to\n // Enter, but role-overridden links should also work with Space.\n if (\n e.key !== \"Enter\" &&\n isHTMLAnchorLink(target) &&\n wasPressed &&\n !linkClickedSet.has(target as HTMLElement)\n ) {\n linkClickedSet.add(target as HTMLElement);\n openLink(target as HTMLAnchorElement, e);\n // Clean up the marker\n setTimeout(() => {\n linkClickedSet.delete(target as HTMLElement);\n }, 0);\n }\n\n // For Space key on non-native targets, the click fires after keyup.\n // Set flag to ignore it when we already synthesized the click.\n if (e.key === \" \" && wasPressed && shouldPreventDefaultKeyboard(target, e.key)) {\n pressState.ignoreClickAfterPress = true;\n } else if (e.key === \"Enter\") {\n pressState.ignoreClickAfterPress = false;\n }\n\n if (shouldStopPropagation && shouldStopPropagationEnd) {\n e.stopPropagation();\n }\n };\n\n // --- Click Event Handler ---\n\n const onClick: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n // Don't handle click if it's not on the target\n if (!nodeContains(e.currentTarget, e.target as Element)) {\n return;\n }\n\n // Only process left clicks that aren't from our own event triggers\n if (e.button === 0 && !pressState.isTriggeringEvent) {\n if (pressState.ignoreClickAfterPress) {\n pressState.ignoreClickAfterPress = false;\n return;\n }\n\n if (isDisabledValue(props.isDisabled)) {\n e.preventDefault();\n return;\n }\n\n // If triggered from a screen reader or by using element.click(),\n // trigger as if it were a keyboard/virtual click.\n let shouldStopPropagation = true;\n\n if (\n !pressState.ignoreEmulatedMouseEvents &&\n !pressState.isPressed &&\n (pressState.pointerType === \"virtual\" || isVirtualClick(e))\n ) {\n pressState.target = e.currentTarget;\n const stopPressStart = triggerPressStart(e, \"virtual\");\n const stopPressUp = triggerPressUp(e, \"virtual\");\n const stopPressEnd = triggerPressEnd(e, \"virtual\", true);\n props.onClick?.(e);\n shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;\n } else if (pressState.isPressed && pressState.pointerType !== \"keyboard\") {\n // Complete the press sequence for pointer/touch/mouse events\n const pointerType =\n pressState.pointerType ||\n ((e as unknown as PointerEvent).pointerType as PointerType) ||\n \"virtual\";\n const stopPressUp = triggerPressUp(e, pointerType);\n const stopPressEnd = triggerPressEnd(e, pointerType, true);\n shouldStopPropagation = stopPressUp && stopPressEnd;\n pressState.isOverTarget = false;\n props.onClick?.(e);\n cancel(e);\n }\n\n pressState.ignoreEmulatedMouseEvents = false;\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n }\n };\n\n // --- Drag Event Handler ---\n\n const onDragStart: JSX.EventHandler<HTMLElement, DragEvent> = (e) => {\n // Safari doesn't fire pointercancel on drag, so we need to cancel manually\n if (pressState.isPressed) {\n cancel(e);\n }\n };\n\n // --- Build Props ---\n // Conditionally use pointer events or mouse events based on browser support\n // This matches React-Aria's approach exactly\n\n const pressProps: JSX.HTMLAttributes<HTMLElement> & { \"data-solidaria-pressable\": string } =\n typeof PointerEvent !== \"undefined\"\n ? {\n // Keyboard events\n onKeyDown,\n onKeyUp,\n onClick,\n onDragStart,\n // Pointer events (preferred when available)\n onPointerDown,\n onPointerUp: onPointerUpTarget,\n onPointerEnter,\n onPointerLeave,\n // Mouse down only for focus prevention when using pointer events\n onMouseDown: onMouseDownPointer,\n // Touch events (always included for ignoreEmulatedMouseEvents handling)\n onTouchStart,\n onTouchMove,\n onTouchEnd,\n onTouchCancel,\n // Attribute for CSS touch-action\n \"data-solidaria-pressable\": \"\",\n }\n : {\n // Keyboard events\n onKeyDown,\n onKeyUp,\n onClick,\n onDragStart,\n // Mouse events (fallback when PointerEvent not available)\n onMouseDown: onMouseDownFallback,\n onMouseUp: onMouseUpFallback,\n onMouseEnter: onMouseEnterFallback,\n onMouseLeave: onMouseLeaveFallback,\n // Touch events (always included)\n onTouchStart,\n onTouchMove,\n onTouchEnd,\n onTouchCancel,\n // Attribute for CSS touch-action\n \"data-solidaria-pressable\": \"\",\n };\n\n // Clean up on unmount\n onCleanup(() => {\n removeAllGlobalListeners();\n // Clean up click timeout/listener if pending\n if (pressState.clickCleanup) {\n pressState.clickCleanup();\n pressState.clickCleanup = null;\n }\n if (pressState.focusCleanup) {\n pressState.focusCleanup();\n pressState.focusCleanup = null;\n }\n });\n\n return {\n isPressed,\n pressProps,\n };\n}\n","/**\n * createLongPress - Handles long press interactions across mouse and touch.\n *\n * Port of @react-aria/interactions useLongPress, adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { createPress, type PressEvent } from \"./createPress\";\nimport { mergeProps, focusWithoutScrolling, createGlobalListeners } from \"../utils\";\nimport { createDescription } from \"../utils/createDescription\";\nimport { type MaybeAccessor } from \"../utils/reactivity\";\n\nexport interface LongPressEvent {\n /** The type of long press event being fired. */\n type: \"longpressstart\" | \"longpressend\" | \"longpress\";\n /** The pointer type that triggered the long press. */\n pointerType: PressEvent[\"pointerType\"];\n /** The target element of the long press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the long press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the long press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the long press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the long press event. */\n altKey: boolean;\n /** X position relative to the target. */\n x: number;\n /** Y position relative to the target. */\n y: number;\n}\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void;\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number;\n /**\n * A description for assistive technology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string;\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\nfunction isDisabledValue(isDisabled: MaybeAccessor<boolean> | undefined): boolean {\n return typeof isDisabled === \"function\" ? isDisabled() : !!isDisabled;\n}\n\nfunction createLongPressEvent(type: LongPressEvent[\"type\"], e: PressEvent): LongPressEvent {\n return {\n type,\n pointerType: e.pointerType,\n target: e.target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey,\n x: e.x,\n y: e.y,\n };\n}\n\n/**\n * Handles long press interactions across mouse and touch devices.\n */\nexport function createLongPress(props: LongPressProps = {}): LongPressResult {\n const {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription,\n } = props;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const { addGlobalListener } = createGlobalListeners();\n\n const { pressProps } = createPress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === \"mouse\" || e.pointerType === \"touch\") {\n onLongPressStart?.(createLongPressEvent(\"longpressstart\", e));\n\n timeoutId = setTimeout(() => {\n // Prevent other press handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent(\"pointercancel\", { bubbles: true }));\n\n // Ensure target is focused. On touch devices, browsers typically focus on pointer up.\n if (document.activeElement !== e.target) {\n focusWithoutScrolling(e.target as HTMLElement);\n }\n\n onLongPress?.(createLongPressEvent(\"longpress\", e));\n timeoutId = undefined;\n }, threshold);\n\n if (e.pointerType === \"touch\") {\n const onContextMenu = (event: Event) => {\n event.preventDefault();\n };\n const target = e.target as HTMLElement;\n target.addEventListener(\"contextmenu\", onContextMenu, { once: true });\n\n addGlobalListener(\n \"pointerup\",\n () => {\n setTimeout(() => {\n target.removeEventListener(\"contextmenu\", onContextMenu);\n }, 30);\n },\n { isWindow: true, once: true },\n );\n }\n }\n },\n onPressEnd(e) {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n if (onLongPressEnd && (e.pointerType === \"mouse\" || e.pointerType === \"touch\")) {\n onLongPressEnd(createLongPressEvent(\"longpressend\", e));\n }\n },\n });\n\n const descriptionProps = createDescription(() =>\n onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : undefined,\n );\n\n onCleanup(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n });\n\n const longPressProps = mergeProps(pressProps) as JSX.HTMLAttributes<HTMLElement>;\n Object.defineProperty(longPressProps, \"aria-describedby\", {\n get: () => descriptionProps[\"aria-describedby\"],\n enumerable: true,\n configurable: true,\n });\n\n return {\n longPressProps,\n };\n}\n","/**\n * createMove - Handles move interactions across mouse, touch, pointer, and keyboard.\n *\n * Port of @react-aria/interactions useMove, adapted for SolidJS.\n */\n\nimport { JSX, createSignal, createEffect, onCleanup } from \"solid-js\";\nimport { disableTextSelection, restoreTextSelection, createGlobalListeners } from \"../utils\";\n\nexport type PointerType = \"mouse\" | \"pen\" | \"touch\" | \"keyboard\";\n\ninterface BaseMoveEvent {\n pointerType: PointerType;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n}\n\nexport interface MoveStartEvent extends BaseMoveEvent {\n type: \"movestart\";\n}\n\nexport interface MoveMoveEvent extends BaseMoveEvent {\n type: \"move\";\n deltaX: number;\n deltaY: number;\n}\n\nexport interface MoveEndEvent extends BaseMoveEvent {\n type: \"moveend\";\n}\n\nexport interface MoveEvents {\n onMoveStart?: (e: MoveStartEvent) => void;\n onMove?: (e: MoveMoveEvent) => void;\n onMoveEnd?: (e: MoveEndEvent) => void;\n}\n\nexport interface MoveResult {\n /** Props to spread on the target element. */\n moveProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\ninterface MoveState {\n didMove: boolean;\n lastPosition: { pageX: number; pageY: number } | null;\n id: number | null;\n}\n\nfunction createBaseEvent(\n originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean },\n pointerType: PointerType,\n): BaseMoveEvent {\n return {\n pointerType,\n shiftKey: originalEvent.shiftKey,\n ctrlKey: originalEvent.ctrlKey,\n metaKey: originalEvent.metaKey,\n altKey: originalEvent.altKey,\n };\n}\n\n/**\n * Handles move interactions across mouse, touch, pointer, and keyboard.\n */\nexport function createMove(props: MoveEvents = {}): MoveResult {\n const { onMoveStart, onMove, onMoveEnd } = props;\n\n const state: MoveState = {\n didMove: false,\n lastPosition: null,\n id: null,\n };\n\n const { addGlobalListener, removeGlobalListener } = createGlobalListeners();\n const [pointerDown, setPointerDown] = createSignal<\"pointer\" | \"mouse\" | \"touch\" | null>(null);\n\n const move = (\n originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean },\n pointerType: PointerType,\n deltaX: number,\n deltaY: number,\n ) => {\n if (deltaX === 0 && deltaY === 0) {\n return;\n }\n\n if (!state.didMove) {\n state.didMove = true;\n onMoveStart?.({\n type: \"movestart\",\n ...createBaseEvent(originalEvent, pointerType),\n });\n }\n\n onMove?.({\n type: \"move\",\n deltaX,\n deltaY,\n ...createBaseEvent(originalEvent, pointerType),\n });\n };\n\n const end = (\n originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean },\n pointerType: PointerType,\n ) => {\n restoreTextSelection();\n if (state.didMove) {\n onMoveEnd?.({\n type: \"moveend\",\n ...createBaseEvent(originalEvent, pointerType),\n });\n }\n };\n\n createEffect(() => {\n const activePointer = pointerDown();\n if (!activePointer) return;\n\n if (activePointer === \"pointer\") {\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId === state.id) {\n const pointerType = (e.pointerType || \"mouse\") as PointerType;\n move(\n e,\n pointerType,\n e.pageX - (state.lastPosition?.pageX ?? 0),\n e.pageY - (state.lastPosition?.pageY ?? 0),\n );\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n }\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.id) {\n const pointerType = (e.pointerType || \"mouse\") as PointerType;\n end(e, pointerType);\n state.id = null;\n removeGlobalListener(\"pointermove\", onPointerMove, { isWindow: true });\n removeGlobalListener(\"pointerup\", onPointerUp, { isWindow: true });\n removeGlobalListener(\"pointercancel\", onPointerUp, { isWindow: true });\n setPointerDown(null);\n }\n };\n\n addGlobalListener(\"pointermove\", onPointerMove, { isWindow: true });\n addGlobalListener(\"pointerup\", onPointerUp, { isWindow: true });\n addGlobalListener(\"pointercancel\", onPointerUp, { isWindow: true });\n onCleanup(() => {\n removeGlobalListener(\"pointermove\", onPointerMove, { isWindow: true });\n removeGlobalListener(\"pointerup\", onPointerUp, { isWindow: true });\n removeGlobalListener(\"pointercancel\", onPointerUp, { isWindow: true });\n });\n }\n\n // Mouse/touch listeners are attached directly in their handlers.\n });\n\n const start = () => {\n disableTextSelection();\n state.didMove = false;\n };\n\n const moveProps: JSX.HTMLAttributes<HTMLElement> = {};\n\n const hasPointerEvents =\n typeof window !== \"undefined\" && typeof window.PointerEvent !== \"undefined\";\n\n moveProps.onMouseDown = (e: MouseEvent) => {\n if (pointerDown() != null) {\n return;\n }\n if (e.button === 0) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n setPointerDown(\"mouse\");\n\n const onMouseMove = (event: MouseEvent) => {\n move(\n event,\n \"mouse\",\n event.pageX - (state.lastPosition?.pageX ?? 0),\n event.pageY - (state.lastPosition?.pageY ?? 0),\n );\n state.lastPosition = { pageX: event.pageX, pageY: event.pageY };\n };\n const onMouseUp = (event: MouseEvent) => {\n end(event, \"mouse\");\n removeGlobalListener(\"mousemove\", onMouseMove);\n removeGlobalListener(\"mouseup\", onMouseUp);\n setPointerDown(null);\n };\n addGlobalListener(\"mousemove\", onMouseMove);\n addGlobalListener(\"mouseup\", onMouseUp);\n }\n };\n\n moveProps.onTouchStart = (e: TouchEvent) => {\n if (pointerDown() != null || e.changedTouches.length === 0 || state.id != null) {\n return;\n }\n const { pageX, pageY, identifier } = e.changedTouches[0];\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX, pageY };\n state.id = identifier;\n setPointerDown(\"touch\");\n\n const onTouchMove = (event: TouchEvent) => {\n const touchIndex = [...event.changedTouches].findIndex(\n ({ identifier: touchId }) => touchId === state.id,\n );\n if (touchIndex >= 0) {\n const { pageX: moveX, pageY: moveY } = event.changedTouches[touchIndex];\n move(\n event,\n \"touch\",\n moveX - (state.lastPosition?.pageX ?? 0),\n moveY - (state.lastPosition?.pageY ?? 0),\n );\n state.lastPosition = { pageX: moveX, pageY: moveY };\n }\n };\n const onTouchEnd = (event: TouchEvent) => {\n const touchIndex = [...event.changedTouches].findIndex(\n ({ identifier: touchId }) => touchId === state.id,\n );\n if (touchIndex >= 0) {\n end(event, \"touch\");\n state.id = null;\n removeGlobalListener(\"touchmove\", onTouchMove);\n removeGlobalListener(\"touchend\", onTouchEnd);\n removeGlobalListener(\"touchcancel\", onTouchEnd);\n setPointerDown(null);\n }\n };\n addGlobalListener(\"touchmove\", onTouchMove);\n addGlobalListener(\"touchend\", onTouchEnd);\n addGlobalListener(\"touchcancel\", onTouchEnd);\n };\n\n if (hasPointerEvents) {\n moveProps.onPointerDown = (e: PointerEvent) => {\n const button = e.button ?? 0;\n if (button === 0 && state.id == null) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n state.id = e.pointerId;\n setPointerDown(\"pointer\");\n }\n };\n }\n\n const triggerKeyboardMove = (e: KeyboardEvent, deltaX: number, deltaY: number) => {\n start();\n move(e, \"keyboard\", deltaX, deltaY);\n end(e, \"keyboard\");\n };\n\n moveProps.onKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case \"Left\":\n case \"ArrowLeft\":\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, -1, 0);\n break;\n case \"Right\":\n case \"ArrowRight\":\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 1, 0);\n break;\n case \"Up\":\n case \"ArrowUp\":\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, -1);\n break;\n case \"Down\":\n case \"ArrowDown\":\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, 1);\n break;\n default:\n break;\n }\n };\n\n return { moveProps };\n}\n","/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget } from \"../utils\";\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n const { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;\n\n let cleanupRef: (() => void) | undefined;\n const syntheticBlurHandler = createSyntheticBlurHandler();\n\n // Cleanup on unmount\n onCleanup(() => {\n if (cleanupRef) {\n cleanupRef();\n }\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Only handle if target is the currentTarget (not bubbled from children)\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n cleanupRef?.();\n cleanupRef = undefined;\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n // Set up synthetic blur handler for Firefox bug\n cleanupRef = syntheticBlurHandler(e, e.target);\n }\n };\n\n // If disabled or no handlers, return empty props\n if (isDisabled) {\n return {\n focusProps: {},\n };\n }\n\n const hasHandlers = onFocusProp || onFocusChange || onBlurProp;\n\n return {\n focusProps: {\n onFocus: hasHandlers ? onFocus : undefined,\n onBlur: onBlurProp || onFocusChange ? onBlur : undefined,\n },\n };\n}\n","/**\n * createFocusWithin - Handles focus events for the target and its descendants.\n *\n * This is a 1-1 port of React-Aria's useFocusWithin hook adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from \"solid-js\";\nimport { getOwnerDocument, getEventTarget, nodeContains, createGlobalListeners } from \"../utils\";\nimport { setEventTarget } from \"../utils/events\";\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean;\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void;\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nfunction createSyntheticBlurHandler(): (\n _e: FocusEvent,\n target: Element,\n) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = () => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener(\"focusout\", onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n isFocused = false;\n observer?.disconnect();\n observer = null;\n const ownerDocument = target.ownerDocument;\n const relatedTarget =\n target === ownerDocument.activeElement ? null : ownerDocument.activeElement;\n target.dispatchEvent(new FocusEvent(\"blur\", { relatedTarget }));\n target.dispatchEvent(new FocusEvent(\"focusout\", { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: [\"disabled\"] });\n\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the target and its descendants.\n *\n * Based on react-aria's useFocusWithin but adapted for SolidJS.\n */\nexport function createFocusWithin(props: FocusWithinProps = {}): FocusWithinResult {\n const { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;\n\n // State tracking\n let isFocusWithin = false;\n\n // Global listeners manager\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n const syntheticBlurHandler = createSyntheticBlurHandler();\n let cleanupRef: (() => void) | undefined;\n\n // Cleanup on unmount\n onCleanup(() => {\n cleanupRef?.();\n removeAllGlobalListeners();\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // We don't want to trigger onBlurWithin and then immediately onFocusWithin again\n // when moving focus inside the element. Only trigger if the currentTarget doesn't\n // include the relatedTarget (where focus is moving).\n if (isFocusWithin && !e.currentTarget.contains(e.relatedTarget as Node)) {\n isFocusWithin = false;\n removeAllGlobalListeners();\n cleanupRef?.();\n cleanupRef = undefined;\n\n if (onBlurWithin) {\n onBlurWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (!isFocusWithin && activeElement === getEventTarget(e)) {\n if (onFocusWithin) {\n onFocusWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(true);\n }\n\n isFocusWithin = true;\n cleanupRef = syntheticBlurHandler(e, e.target);\n\n // Browsers don't fire blur events when elements are removed from the DOM.\n // However, if a focus event occurs outside the element we're tracking, we\n // can manually fire onBlur.\n const currentTarget = e.currentTarget;\n\n addGlobalListener(\n \"focus\",\n (focusEvent: Event) => {\n if (\n isFocusWithin &&\n !nodeContains(currentTarget, (focusEvent as FocusEvent).target as Element)\n ) {\n // Create a synthetic blur event\n const window = ownerDocument?.defaultView;\n if (window) {\n const nativeEvent = new window.FocusEvent(\"blur\", {\n relatedTarget: (focusEvent as FocusEvent).target as Element,\n });\n setEventTarget(nativeEvent, currentTarget);\n\n isFocusWithin = false;\n removeAllGlobalListeners();\n\n if (onBlurWithin) {\n onBlurWithin(nativeEvent);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n cleanupRef?.();\n cleanupRef = undefined;\n }\n }\n },\n { capture: true },\n );\n }\n };\n\n if (isDisabled) {\n return {\n focusWithinProps: {\n onFocus: undefined,\n onBlur: undefined,\n },\n };\n }\n\n return {\n focusWithinProps: {\n onFocus,\n onBlur,\n },\n };\n}\n","/**\n * createKeyboard - Handles keyboard interactions for a focusable element.\n *\n * This is a 1-1 port of React-Aria's useKeyboard hook adapted for SolidJS.\n */\n\nimport { JSX } from \"solid-js\";\n\n/**\n * Keyboard event with continuePropagation support.\n * By default, keyboard events stop propagation.\n */\nexport interface KeyboardEvent extends globalThis.KeyboardEvent {\n /** Call this to allow the event to propagate to parent elements. */\n continuePropagation(): void;\n}\n\nexport interface KeyboardEvents {\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n}\n\nexport interface CreateKeyboardProps extends KeyboardEvents {\n /** Whether the keyboard events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface KeyboardResult {\n /** Props to spread onto the target element. */\n keyboardProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Wraps a keyboard event handler to make stopPropagation the default,\n * and support continuePropagation instead.\n */\nfunction createEventHandler<T extends globalThis.KeyboardEvent>(\n handler?: (e: KeyboardEvent) => void,\n): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n return (e: T) => {\n let shouldStopPropagation = true;\n\n // Create a wrapped event with continuePropagation\n const event = Object.assign(e, {\n continuePropagation() {\n shouldStopPropagation = false;\n },\n }) as KeyboardEvent;\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n\n/**\n * Handles keyboard interactions for a focusable element.\n *\n * Based on react-aria's useKeyboard but adapted for SolidJS.\n */\nexport function createKeyboard(props: CreateKeyboardProps = {}): KeyboardResult {\n if (props.isDisabled) {\n return {\n keyboardProps: {},\n };\n }\n\n return {\n keyboardProps: {\n onKeyDown: createEventHandler(props.onKeyDown),\n onKeyUp: createEventHandler(props.onKeyUp),\n },\n };\n}\n","/**\n * createFocusable - Makes an element focusable and capable of auto focus.\n *\n * This is a 1-1 port of React-Aria's useFocusable hook adapted for SolidJS.\n */\n\nimport { JSX, Accessor, createContext, useContext, onMount } from \"solid-js\";\nimport { createFocus, type FocusEvents } from \"./createFocus\";\nimport { createKeyboard, type KeyboardEvents } from \"./createKeyboard\";\nimport { mergeProps, focusSafely } from \"../utils\";\n\nexport interface FocusableDOMProps {\n /** Whether to exclude the element from the sequential tab order. */\n excludeFromTabOrder?: boolean;\n}\n\nexport interface FocusableProps extends FocusEvents, KeyboardEvents {\n /** Whether the element should receive focus on mount. */\n autoFocus?: boolean;\n}\n\nexport interface CreateFocusableProps extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: Accessor<boolean> | boolean;\n}\n\nexport interface FocusableResult {\n /** Props to spread on the focusable element. */\n focusableProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// --- FocusableContext ---\n\nexport interface FocusableContextValue {\n ref?: (el: HTMLElement) => void;\n [key: string]: unknown;\n}\n\n/**\n * Context for passing focusable props to nested focusable children.\n * Used by FocusableProvider to pass DOM props to the nearest focusable child.\n */\nexport const FocusableContext = createContext<FocusableContextValue | null>(null);\n\n/**\n * Hook to consume the FocusableContext and sync the ref.\n */\nfunction useFocusableContext(\n setRef: (el: HTMLElement) => void,\n): Omit<FocusableContextValue, \"ref\"> {\n const context = useContext(FocusableContext) || {};\n\n // If context has a ref, sync our ref to it\n if (context.ref) {\n const contextRef = context.ref;\n // Create a combined ref that calls both\n const originalSetRef = setRef;\n setRef = (el: HTMLElement) => {\n originalSetRef(el);\n contextRef(el);\n };\n }\n\n // Return context without the ref\n const { ref: _, ...otherProps } = context;\n return otherProps;\n}\n\nexport interface FocusableProviderProps {\n /** The child element to provide DOM props to. */\n children?: JSX.Element;\n}\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === \"function\") {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\n/**\n * Makes an element focusable, handling disabled state and tab order.\n * Provides focus state tracking and autoFocus support.\n *\n * Based on react-aria's useFocusable but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createFocusable } from 'solidaria';\n *\n * function FocusableInput(props) {\n * let ref;\n * const { focusableProps } = createFocusable({\n * autoFocus: props.autoFocus,\n * onFocusChange: (focused) => console.log('Focus:', focused),\n * });\n *\n * return (\n * <input\n * {...focusableProps}\n * ref={(el) => { ref = el; focusableProps.ref?.(el); }}\n * />\n * );\n * }\n * ```\n */\nexport function createFocusable(\n props: CreateFocusableProps = {},\n ref?: (el: HTMLElement) => void,\n): FocusableResult {\n let elementRef: HTMLElement | null = null;\n let autoFocusDone = false;\n\n // Set up ref handler\n const setRef = (el: HTMLElement) => {\n elementRef = el;\n ref?.(el);\n };\n\n // Get focus and keyboard props from the respective hooks\n const { focusProps } = createFocus({\n isDisabled: isDisabledValue(props.isDisabled),\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n onFocusChange: props.onFocusChange,\n });\n\n const { keyboardProps } = createKeyboard({\n isDisabled: isDisabledValue(props.isDisabled),\n onKeyDown: props.onKeyDown,\n onKeyUp: props.onKeyUp,\n });\n\n // Merge focus and keyboard interactions\n const interactions = mergeProps(focusProps, keyboardProps);\n\n // Get context props (from FocusableProvider if present)\n const contextProps = useFocusableContext(setRef);\n const interactionProps = isDisabledValue(props.isDisabled) ? {} : contextProps;\n\n // Handle autoFocus\n onMount(() => {\n if (props.autoFocus && elementRef && !autoFocusDone) {\n focusSafely(elementRef);\n autoFocusDone = true;\n }\n });\n\n // Build final focusable props\n const focusableProps = mergeProps(\n {\n ...interactions,\n get tabIndex() {\n if (isDisabledValue(props.isDisabled)) {\n return undefined;\n }\n return props.excludeFromTabOrder ? -1 : 0;\n },\n ref: setRef,\n },\n interactionProps,\n ) as JSX.HTMLAttributes<HTMLElement>;\n\n return {\n focusableProps,\n };\n}\n","/**\n * createInteractionModality + focus-visible tracking for solidaria\n *\n * Port of @react-aria/interactions useFocusVisible/useInteractionModality.\n * Tracks the current interaction modality (keyboard, pointer, or virtual) and\n * provides focus-visible state and listeners.\n */\n\nimport { type Accessor, createSignal, createEffect, onCleanup } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { getOwnerDocument, getOwnerWindow, isMac, isVirtualClick, openLink } from \"../utils\";\n\nexport type Modality = \"keyboard\" | \"pointer\" | \"virtual\";\nexport type PointerType = \"mouse\" | \"pen\" | \"touch\" | \"keyboard\" | \"virtual\";\ntype HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;\ntype Handler = (modality: Modality, e: HandlerEvent) => void;\n\nexport type FocusVisibleHandler = (isFocusVisible: boolean) => void;\n\nexport interface FocusVisibleProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean;\n /** Whether the element will be auto focused. */\n autoFocus?: boolean;\n}\n\nexport interface FocusVisibleResult {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: Accessor<boolean>;\n}\n\nexport interface InteractionModalityResult {\n /** The current interaction modality. */\n modality: Accessor<Modality | null>;\n}\n\nlet currentModality: Modality | null = null;\nlet currentPointerType: PointerType = \"keyboard\";\nconst changeHandlers = new Set<Handler>();\n\nexport let hasSetupGlobalListeners: Map<\n Window,\n { focus: typeof window.HTMLElement.prototype.focus; canOverride: boolean }\n> = new Map();\nlet hasEventBeforeFocus = false;\nlet hasBlurredWindowRecently = false;\nlet ignoreFocusEvent = false;\n\nconst FOCUS_VISIBLE_INPUT_KEYS: Record<string, boolean> = {\n Tab: true,\n Escape: true,\n};\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (const handler of changeHandlers) {\n handler(modality, e);\n }\n}\n\nfunction isValidKey(e: KeyboardEvent) {\n return !(\n e.metaKey ||\n (!isMac() && e.altKey) ||\n e.ctrlKey ||\n e.key === \"Control\" ||\n e.key === \"Shift\" ||\n e.key === \"Meta\"\n );\n}\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true;\n const isOpening = (openLink as { isOpening?: boolean }).isOpening;\n if (!isOpening && isValidKey(e)) {\n currentModality = \"keyboard\";\n currentPointerType = \"keyboard\";\n triggerChangeHandlers(\"keyboard\", e);\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = \"pointer\";\n currentPointerType = \"pointerType\" in e ? (e.pointerType as PointerType) : \"mouse\";\n if (e.type === \"mousedown\" || e.type === \"pointerdown\") {\n hasEventBeforeFocus = true;\n triggerChangeHandlers(\"pointer\", e);\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n if (!e.isTrusted) {\n return;\n }\n\n const isOpening = (openLink as { isOpening?: boolean }).isOpening;\n if (!isOpening && isVirtualClick(e)) {\n hasEventBeforeFocus = true;\n currentModality = \"virtual\";\n currentPointerType = \"virtual\";\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n if (!e.isTrusted || ignoreFocusEvent) {\n return;\n }\n\n const target = e.target as EventTarget | null;\n const targetElement = target && (target as Element).nodeType ? (target as Element) : null;\n const ownerWindow = targetElement ? getOwnerWindow(targetElement) : window;\n const ownerDocument = targetElement ? getOwnerDocument(targetElement) : document;\n\n if (target === ownerWindow || target === ownerDocument) {\n return;\n }\n\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = \"virtual\";\n currentPointerType = \"virtual\";\n triggerChangeHandlers(\"virtual\", e);\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = false;\n}\n\nfunction handleWindowBlur() {\n if (ignoreFocusEvent) {\n return;\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = true;\n}\n\nfunction setupGlobalFocusEvents(element?: HTMLElement | null) {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n if (hasSetupGlobalListeners.get(windowObject)) {\n return;\n }\n\n const documentObject = getOwnerDocument(element);\n\n const originalFocus = windowObject.HTMLElement.prototype.focus;\n let canOverride = true;\n try {\n windowObject.HTMLElement.prototype.focus = function () {\n hasEventBeforeFocus = true;\n originalFocus.apply(this, arguments as unknown as [options?: FocusOptions | undefined]);\n };\n } catch {\n canOverride = false;\n }\n\n documentObject.addEventListener(\"keydown\", handleKeyboardEvent, true);\n documentObject.addEventListener(\"keyup\", handleKeyboardEvent, true);\n documentObject.addEventListener(\"click\", handleClickEvent, true);\n\n windowObject.addEventListener(\"focus\", handleFocusEvent, true);\n windowObject.addEventListener(\"blur\", handleWindowBlur, false);\n\n if (typeof windowObject.PointerEvent !== \"undefined\") {\n documentObject.addEventListener(\"pointerdown\", handlePointerEvent, true);\n documentObject.addEventListener(\"pointermove\", handlePointerEvent, true);\n documentObject.addEventListener(\"pointerup\", handlePointerEvent, true);\n } else {\n documentObject.addEventListener(\"mousedown\", handlePointerEvent, true);\n documentObject.addEventListener(\"mousemove\", handlePointerEvent, true);\n documentObject.addEventListener(\"mouseup\", handlePointerEvent, true);\n }\n\n windowObject.addEventListener(\n \"beforeunload\",\n () => {\n tearDownWindowFocusTracking(element);\n },\n { once: true },\n );\n\n hasSetupGlobalListeners.set(windowObject, { focus: originalFocus, canOverride });\n}\n\nfunction tearDownWindowFocusTracking(element?: HTMLElement | null, loadListener?: () => void) {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n\n if (loadListener) {\n documentObject.removeEventListener(\"DOMContentLoaded\", loadListener);\n }\n\n if (!hasSetupGlobalListeners.has(windowObject)) {\n return;\n }\n\n const entry = hasSetupGlobalListeners.get(windowObject)!;\n if (entry.canOverride) {\n windowObject.HTMLElement.prototype.focus = entry.focus;\n }\n\n documentObject.removeEventListener(\"keydown\", handleKeyboardEvent, true);\n documentObject.removeEventListener(\"keyup\", handleKeyboardEvent, true);\n documentObject.removeEventListener(\"click\", handleClickEvent, true);\n\n windowObject.removeEventListener(\"focus\", handleFocusEvent, true);\n windowObject.removeEventListener(\"blur\", handleWindowBlur, false);\n\n if (typeof windowObject.PointerEvent !== \"undefined\") {\n documentObject.removeEventListener(\"pointerdown\", handlePointerEvent, true);\n documentObject.removeEventListener(\"pointermove\", handlePointerEvent, true);\n documentObject.removeEventListener(\"pointerup\", handlePointerEvent, true);\n } else {\n documentObject.removeEventListener(\"mousedown\", handlePointerEvent, true);\n documentObject.removeEventListener(\"mousemove\", handlePointerEvent, true);\n documentObject.removeEventListener(\"mouseup\", handlePointerEvent, true);\n }\n\n hasSetupGlobalListeners.delete(windowObject);\n}\n\n/**\n * Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.\n */\nexport function addWindowFocusTracking(element?: HTMLElement | null): () => void {\n const documentObject = getOwnerDocument(element);\n let loadListener: (() => void) | undefined;\n\n if (documentObject.readyState !== \"loading\") {\n setupGlobalFocusEvents(element);\n } else {\n loadListener = () => {\n setupGlobalFocusEvents(element);\n };\n documentObject.addEventListener(\"DOMContentLoaded\", loadListener);\n }\n\n return () => tearDownWindowFocusTracking(element, loadListener);\n}\n\nexport function setupGlobalFocusListeners(): void {\n addWindowFocusTracking();\n}\n\nif (typeof document !== \"undefined\") {\n addWindowFocusTracking();\n}\n\n/**\n * If true, keyboard focus is visible.\n */\nexport function isFocusVisible(): boolean {\n return currentModality !== \"pointer\";\n}\n\n/**\n * Gets the current interaction modality.\n */\nexport function getInteractionModality(): Modality | null {\n return currentModality;\n}\n\n/**\n * Sets the current interaction modality.\n */\nexport function setInteractionModality(modality: Modality): void {\n currentModality = modality;\n currentPointerType = modality === \"pointer\" ? \"mouse\" : modality;\n triggerChangeHandlers(modality, null);\n}\n\n/**\n * Gets the current pointer type.\n */\nexport function getPointerType(): PointerType {\n return currentPointerType;\n}\n\nfunction isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent): boolean {\n if (!e) {\n return true;\n }\n\n const target = \"target\" in e ? (e.target as Element | null) : null;\n const ownerDocument = target ? getOwnerDocument(target) : document;\n const ownerWindow = target ? getOwnerWindow(target) : window;\n\n const IHTMLInputElement = ownerWindow.HTMLInputElement;\n const IHTMLTextAreaElement = ownerWindow.HTMLTextAreaElement;\n const IHTMLElement = ownerWindow.HTMLElement;\n const IKeyboardEvent = ownerWindow.KeyboardEvent;\n\n const nonTextInputTypes = new Set([\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"button\",\n \"submit\",\n \"reset\",\n ]);\n\n isTextInput =\n isTextInput ||\n (ownerDocument.activeElement instanceof IHTMLInputElement &&\n !nonTextInputTypes.has(ownerDocument.activeElement.type)) ||\n ownerDocument.activeElement instanceof IHTMLTextAreaElement ||\n (ownerDocument.activeElement instanceof IHTMLElement &&\n ownerDocument.activeElement.isContentEditable);\n\n return !(\n isTextInput &&\n modality === \"keyboard\" &&\n e instanceof IKeyboardEvent &&\n !FOCUS_VISIBLE_INPUT_KEYS[e.key]\n );\n}\n\n/**\n * Listens for trigger change and reports if focus is visible.\n */\nexport function createFocusVisibleListener(\n handler: FocusVisibleHandler,\n opts?: { isTextInput?: boolean },\n): () => void {\n setupGlobalFocusEvents();\n const listener: Handler = (modality: Modality, e: HandlerEvent) => {\n if (!isKeyboardFocusEvent(!!opts?.isTextInput, modality, e)) {\n return;\n }\n handler(isFocusVisible());\n };\n changeHandlers.add(listener);\n return () => {\n changeHandlers.delete(listener);\n };\n}\n\n/**\n * Manages focus visible state for the page.\n */\nexport function createFocusVisible(props: FocusVisibleProps = {}): FocusVisibleResult {\n if (isServer) {\n return { isFocusVisible: () => false };\n }\n\n const { isTextInput, autoFocus } = props;\n const [isVisible, setIsVisible] = createSignal<boolean>(autoFocus || isFocusVisible());\n\n createEffect(() => {\n const cleanup = createFocusVisibleListener(setIsVisible, { isTextInput });\n onCleanup(cleanup);\n });\n\n return { isFocusVisible: isVisible };\n}\n\n/**\n * Tracks the current interaction modality.\n */\nexport function createInteractionModality(): InteractionModalityResult {\n if (isServer) {\n return {\n modality: () => null,\n };\n }\n\n const [modality, setModality] = createSignal<Modality | null>(currentModality);\n\n createEffect(() => {\n setupGlobalFocusEvents();\n const handler: Handler = (newModality: Modality) => {\n setModality(newModality);\n };\n changeHandlers.add(handler);\n onCleanup(() => {\n changeHandlers.delete(handler);\n });\n });\n\n return {\n modality,\n };\n}\n\n/**\n * Adds a listener for modality changes.\n */\nexport function addModalityListener(handler: (modality: Modality) => void): () => void {\n const wrapped: Handler = (modality) => {\n handler(modality);\n };\n changeHandlers.add(wrapped);\n return () => {\n changeHandlers.delete(wrapped);\n };\n}\n\n/**\n * Hook to track whether the user is currently interacting with the keyboard.\n */\nexport function useIsKeyboardFocused(): Accessor<boolean> {\n if (isServer) {\n return () => false;\n }\n\n const { modality } = createInteractionModality();\n return () => modality() === \"keyboard\";\n}\n","/**\n * createFocusRing hook for Solidaria\n *\n * Determines whether a focus ring should be visible for a given element.\n * Focus rings are visible when the user navigates with keyboard, but hidden\n * when using mouse/touch.\n *\n * Port of @react-aria/focus useFocusRing.\n */\n\nimport {\n type JSX,\n type Accessor,\n createSignal,\n createEffect,\n onCleanup,\n createMemo,\n} from \"solid-js\";\nimport { createFocus } from \"./createFocus\";\nimport { createFocusWithin } from \"./createFocusWithin\";\nimport {\n createFocusVisibleListener,\n isFocusVisible as isGlobalFocusVisible,\n} from \"./createInteractionModality\";\n\nexport interface FocusRingProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean;\n /** Whether the element will be auto focused. */\n autoFocus?: boolean;\n /** Whether focus should be tracked within the element. */\n within?: boolean;\n}\n\nexport interface FocusRingResult {\n /** Whether the element is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the focus ring should be visible. */\n isFocusVisible: Accessor<boolean>;\n /** Props to spread on the element to track focus. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Determines whether a focus ring should be visible for a given element.\n *\n * Focus rings are visible when:\n * - The element is focused AND\n * - The user is navigating with keyboard (not mouse/touch)\n *\n * For text inputs, focus rings are always visible when focused.\n */\nexport function createFocusRing(props: FocusRingProps = {}): FocusRingResult {\n const { isTextInput = false, autoFocus = false, within = false } = props;\n\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusVisibleFlag, setFocusVisibleFlag] = createSignal(autoFocus || isGlobalFocusVisible());\n const isFocusVisible = createMemo(() => isFocused() && focusVisibleFlag());\n\n createEffect(() => {\n const cleanup = createFocusVisibleListener(\n (visible) => {\n setFocusVisibleFlag(visible);\n },\n { isTextInput },\n );\n onCleanup(cleanup);\n });\n\n const onFocusChange = (focused: boolean) => {\n setIsFocused(focused);\n };\n\n const focusResult = createFocus({\n isDisabled: within,\n onFocusChange,\n });\n\n const focusWithinResult = createFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange,\n });\n\n return {\n isFocused,\n isFocusVisible,\n focusProps: (within\n ? focusWithinResult.focusWithinProps\n : focusResult.focusProps) as JSX.HTMLAttributes<HTMLElement>,\n };\n}\n","/**\n * createHover hook for Solidaria\n *\n * Handles pointer hover interactions for an element. Normalizes behavior\n * across browsers and platforms, and ignores emulated mouse events on touch devices.\n *\n * Port of @react-aria/interactions useHover.\n */\n\nimport {\n type JSX,\n type Accessor,\n createSignal,\n createEffect,\n onCleanup,\n createMemo,\n} from \"solid-js\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { isTestEnv } from \"../utils/env\";\nimport { createGlobalListeners, nodeContains } from \"../utils\";\n\nexport interface HoverEvent {\n /** The type of hover event being fired. */\n type: \"hoverstart\" | \"hoverend\";\n /** The pointer type that triggered the hover event. */\n pointerType: \"mouse\" | \"pen\";\n /** The target element of the hover event. */\n target: Element;\n}\n\nexport interface HoverEvents {\n /** Handler called when the hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when the hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when the hover state changes. */\n onHoverChange?: (isHovering: boolean) => void;\n}\n\nexport interface CreateHoverProps extends HoverEvents {\n /** Whether the hover events should be disabled. */\n isDisabled?: boolean;\n}\n\n/** Event handler props returned by createHover - safe to spread on any element */\nexport type HoverProps = Pick<\n JSX.HTMLAttributes<HTMLElement>,\n | \"onPointerEnter\"\n | \"onPointerLeave\"\n | \"onPointerOver\"\n | \"onPointerOut\"\n | \"onMouseEnter\"\n | \"onMouseLeave\"\n>;\n\nexport interface HoverResult {\n /** Props to spread on the target element. */\n hoverProps: HoverProps;\n /** Whether the element is currently hovered. */\n isHovered: Accessor<boolean>;\n}\n\n// iOS fires onPointerEnter twice: once with pointerType=\"touch\" and again with pointerType=\"mouse\".\n// We want to ignore these emulated events so they do not trigger hover behavior.\nlet globalIgnoreEmulatedMouseEvents = false;\nlet hoverCount = 0;\n\nfunction setGlobalIgnoreEmulatedMouseEvents() {\n globalIgnoreEmulatedMouseEvents = true;\n setTimeout(() => {\n globalIgnoreEmulatedMouseEvents = false;\n }, 50);\n}\n\nfunction handleGlobalPointerEvent(e: PointerEvent) {\n if (e.pointerType === \"touch\") {\n setGlobalIgnoreEmulatedMouseEvents();\n }\n}\n\nfunction setupGlobalTouchEvents() {\n if (typeof document === \"undefined\") {\n return () => {};\n }\n\n if (hoverCount === 0) {\n if (typeof PointerEvent !== \"undefined\") {\n document.addEventListener(\"pointerup\", handleGlobalPointerEvent);\n } else if (isTestEnv()) {\n document.addEventListener(\"touchend\", setGlobalIgnoreEmulatedMouseEvents);\n }\n }\n\n hoverCount++;\n return () => {\n hoverCount--;\n if (hoverCount > 0) {\n return;\n }\n\n if (typeof PointerEvent !== \"undefined\") {\n document.removeEventListener(\"pointerup\", handleGlobalPointerEvent);\n } else if (isTestEnv()) {\n document.removeEventListener(\"touchend\", setGlobalIgnoreEmulatedMouseEvents);\n }\n };\n}\n\n/**\n * Handles pointer hover interactions for an element.\n */\nexport function createHover(props: MaybeAccessor<CreateHoverProps> = {}): HoverResult {\n const getProps = () => access(props);\n const [isHovered, setIsHovered] = createSignal(false);\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n\n // Track internal hover state\n let state = {\n isHovered: false,\n ignoreEmulatedMouseEvents: false,\n pointerType: \"\" as \"mouse\" | \"pen\" | \"\",\n target: null as Element | null,\n };\n\n // Setup global touch events\n createEffect(() => {\n const cleanup = setupGlobalTouchEvents();\n onCleanup(cleanup);\n });\n\n // Reset hover when disabled\n createEffect(() => {\n const p = getProps();\n if (p.isDisabled && state.isHovered) {\n triggerHoverEnd(state.target as Element, state.pointerType as \"mouse\" | \"pen\");\n }\n });\n\n function triggerHoverStart(\n target: Element,\n pointerType: \"mouse\" | \"pen\",\n eventTarget: Element | null,\n ) {\n const p = getProps();\n state.pointerType = pointerType;\n\n const isOverTarget = eventTarget instanceof Element ? target.contains(eventTarget) : true;\n if (p.isDisabled || state.isHovered || !isOverTarget) {\n return;\n }\n\n state.isHovered = true;\n state.target = target;\n\n addGlobalListener(\n \"pointerover\",\n (event: PointerEvent) => {\n if (\n state.isHovered &&\n state.target &&\n !nodeContains(state.target, event.target as Element)\n ) {\n triggerHoverEnd(event.target as Element, event.pointerType as \"mouse\" | \"pen\");\n }\n },\n { capture: true },\n );\n\n p.onHoverStart?.({\n type: \"hoverstart\",\n target,\n pointerType,\n });\n\n p.onHoverChange?.(true);\n setIsHovered(true);\n }\n\n function triggerHoverEnd(target: Element | null, pointerType: \"mouse\" | \"pen\") {\n const p = getProps();\n state.pointerType = \"\";\n state.target = null;\n\n if (!state.isHovered || !target) {\n return;\n }\n\n state.isHovered = false;\n removeAllGlobalListeners();\n\n p.onHoverEnd?.({\n type: \"hoverend\",\n target,\n pointerType,\n });\n\n p.onHoverChange?.(false);\n setIsHovered(false);\n }\n\n const hoverProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => {\n if (typeof PointerEvent !== \"undefined\") {\n return {\n onPointerEnter: (e: PointerEvent) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === \"mouse\") {\n return;\n }\n if (e.pointerType === \"touch\") {\n return;\n }\n triggerHoverStart(\n e.currentTarget as Element,\n e.pointerType as \"mouse\" | \"pen\",\n e.target as Element,\n );\n },\n onPointerLeave: (e: PointerEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, e.pointerType as \"mouse\" | \"pen\");\n }\n },\n onPointerOver: (e: PointerEvent) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === \"mouse\") {\n return;\n }\n if (e.pointerType === \"touch\") {\n return;\n }\n triggerHoverStart(\n e.currentTarget as Element,\n e.pointerType as \"mouse\" | \"pen\",\n e.target as Element,\n );\n },\n onPointerOut: (e: PointerEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, e.pointerType as \"mouse\" | \"pen\");\n }\n },\n };\n }\n\n // Fallback for environments without PointerEvent (mainly tests)\n return {\n onTouchStart: () => {\n state.ignoreEmulatedMouseEvents = true;\n },\n onMouseEnter: (e: MouseEvent) => {\n if (!state.ignoreEmulatedMouseEvents && !globalIgnoreEmulatedMouseEvents) {\n triggerHoverStart(e.currentTarget as Element, \"mouse\", e.target as Element);\n }\n state.ignoreEmulatedMouseEvents = false;\n },\n onMouseLeave: (e: MouseEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, \"mouse\");\n }\n },\n };\n });\n\n return {\n hoverProps: hoverProps() as HoverProps,\n isHovered,\n };\n}\n","import { Accessor } from \"solid-js\";\nimport { createPress } from \"../interactions\";\nimport { createFocusable } from \"../interactions\";\nimport { mergeProps, filterDOMProps } from \"../utils\";\nimport type { AriaButtonProps, ButtonAria } from \"./types\";\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === \"function\") {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a button component.\n * Handles press interactions across mouse, touch, keyboard and screen readers.\n *\n * Based on react-aria's useButton but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createButton } from 'solidaria';\n *\n * function Button(props) {\n * let ref;\n * const { buttonProps, isPressed } = createButton(props);\n *\n * return (\n * <button\n * {...buttonProps}\n * ref={ref}\n * class={isPressed() ? 'pressed' : ''}\n * >\n * {props.children}\n * </button>\n * );\n * }\n * ```\n */\nexport function createButton(props: AriaButtonProps = {}): ButtonAria {\n const elementType = props.elementType ?? \"button\";\n const isDisabled = () => isDisabledValue(props.isDisabled);\n\n const { pressProps, isPressed } = createPress({\n isDisabled,\n onPress: (event) => props.onPress?.(event),\n onPressStart: (event) => props.onPressStart?.(event),\n onPressEnd: (event) => props.onPressEnd?.(event),\n onPressUp: (event) => props.onPressUp?.(event),\n onPressChange: (pressed) => props.onPressChange?.(pressed),\n onClick: (event) => props.onClick?.(event),\n get preventFocusOnPress() {\n return props.preventFocusOnPress;\n },\n });\n\n const { focusableProps } = createFocusable({\n isDisabled,\n autoFocus: props.autoFocus,\n excludeFromTabOrder: props.excludeFromTabOrder,\n });\n\n const isNativeButton = elementType === \"button\";\n const isLink = elementType === \"a\";\n\n // Handle allowFocusWhenDisabled - set tabIndex to -1 when disabled but focusable\n // This allows tooltips to be shown on disabled buttons\n if (props.allowFocusWhenDisabled) {\n Object.defineProperty(focusableProps, \"tabIndex\", {\n enumerable: true,\n configurable: true,\n get() {\n return isDisabled() ? -1 : props.excludeFromTabOrder ? -1 : 0;\n },\n });\n }\n\n let additionalProps: Record<string, unknown> = {};\n\n if (isNativeButton) {\n additionalProps = {\n get type() {\n return props.type ?? \"button\";\n },\n get disabled() {\n return isDisabled();\n },\n get form() {\n return props.form;\n },\n get formAction() {\n return props.formAction;\n },\n get formEncType() {\n return props.formEncType;\n },\n get formMethod() {\n return props.formMethod;\n },\n get formNoValidate() {\n return props.formNoValidate;\n },\n get formTarget() {\n return props.formTarget;\n },\n get name() {\n return props.name;\n },\n get value() {\n return props.value;\n },\n };\n } else {\n // Non-native buttons need role; focusableProps supplies tabIndex.\n additionalProps = {\n role: \"button\",\n get href() {\n return isLink && !isDisabled() ? props.href : undefined;\n },\n get target() {\n return isLink ? props.target : undefined;\n },\n get type() {\n return elementType === \"input\" ? (props.type ?? \"button\") : undefined;\n },\n get disabled() {\n return elementType === \"input\" ? isDisabled() : undefined;\n },\n get \"aria-disabled\"() {\n return isDisabled() && elementType !== \"input\" ? true : undefined;\n },\n get rel() {\n return isLink ? props.rel : undefined;\n },\n };\n }\n\n const ariaProps: Record<string, unknown> = {\n get \"aria-haspopup\"() {\n return props[\"aria-haspopup\"];\n },\n get \"aria-expanded\"() {\n return props[\"aria-expanded\"];\n },\n get \"aria-controls\"() {\n return props[\"aria-controls\"];\n },\n get \"aria-pressed\"() {\n return props[\"aria-pressed\"];\n },\n get \"aria-current\"() {\n return props[\"aria-current\"];\n },\n get \"aria-disabled\"() {\n return props[\"aria-disabled\"];\n },\n };\n\n const buttonProps = mergeProps(\n additionalProps,\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>,\n filterDOMProps(props as Record<string, unknown>, { labelable: true }),\n ariaProps,\n );\n\n return {\n buttonProps,\n isPressed,\n };\n}\n","import { Accessor, createSignal } from \"solid-js\";\nimport { createButton } from \"./createButton\";\nimport { mergeProps } from \"../utils\";\nimport type { AriaButtonProps, ButtonAria } from \"./types\";\nimport type { PressEvent } from \"../interactions\";\n\nexport interface AriaToggleButtonProps extends Omit<AriaButtonProps, \"aria-pressed\"> {\n /** Whether the button is selected (controlled). */\n isSelected?: Accessor<boolean> | boolean;\n /** Handler called when the button's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n /** The default selected state (uncontrolled). */\n defaultSelected?: boolean;\n}\n\nexport interface ToggleButtonAria extends ButtonAria {\n /** Whether the button is currently selected. */\n isSelected: Accessor<boolean>;\n}\n\nfunction getSelectedValue(isSelected: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isSelected === \"function\") {\n return isSelected();\n }\n return isSelected ?? false;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * Toggle buttons allow users to toggle a selection on or off.\n *\n * Based on react-aria's useToggleButton but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createToggleButton } from 'solidaria';\n *\n * function ToggleButton(props) {\n * const { buttonProps, isPressed, isSelected } = createToggleButton(props);\n *\n * return (\n * <button\n * {...buttonProps}\n * class={isSelected() ? 'selected' : ''}\n * style={{ opacity: isPressed() ? 0.8 : 1 }}\n * >\n * {props.children}\n * </button>\n * );\n * }\n * ```\n */\nexport function createToggleButton(props: AriaToggleButtonProps = {}): ToggleButtonAria {\n // Handle controlled vs uncontrolled state\n const isControlled = props.isSelected !== undefined;\n const [uncontrolledSelected, setUncontrolledSelected] = createSignal(\n props.defaultSelected ?? false,\n );\n\n const isSelected = (): boolean => {\n if (isControlled) {\n return getSelectedValue(props.isSelected);\n }\n return uncontrolledSelected();\n };\n\n const toggleSelection = () => {\n const newValue = !isSelected();\n if (!isControlled) {\n setUncontrolledSelected(newValue);\n }\n props.onChange?.(newValue);\n };\n\n // Create the press handler that toggles selection\n const onPress = (e: PressEvent) => {\n toggleSelection();\n props.onPress?.(e);\n };\n\n // Get button props with our custom press handler\n const { buttonProps: baseButtonProps, isPressed } = createButton(\n mergeProps(props, {\n onPress,\n }) as AriaButtonProps,\n );\n\n // Create buttonProps with a getter for aria-pressed so it stays reactive\n const buttonProps = {\n ...baseButtonProps,\n get \"aria-pressed\"() {\n return isSelected();\n },\n };\n\n return {\n buttonProps,\n isPressed,\n isSelected,\n };\n}\n","/**\n * i18n utilities for solidaria\n *\n * RTL detection and locale utilities.\n *\n * Port of @react-aria/i18n utils.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set([\n \"Arab\",\n \"Syrc\",\n \"Samr\",\n \"Mand\",\n \"Thaa\",\n \"Mend\",\n \"Nkoo\",\n \"Adlm\",\n \"Rohg\",\n \"Hebr\",\n]);\n\nconst RTL_LANGS = new Set([\n \"ae\",\n \"ar\",\n \"arc\",\n \"bcc\",\n \"bqi\",\n \"ckb\",\n \"dv\",\n \"fa\",\n \"glk\",\n \"he\",\n \"ku\",\n \"mzn\",\n \"nqo\",\n \"pnb\",\n \"ps\",\n \"sd\",\n \"ug\",\n \"ur\",\n \"yi\",\n]);\n\n/**\n * Determines if a locale is read right to left.\n * Uses Intl.Locale API when available for accurate detection.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (typeof Intl !== \"undefined\" && Intl.Locale) {\n try {\n const locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // getTextInfo() was implemented as a property by some browsers before it was standardized as a function.\n const localeAny = locale as unknown as {\n getTextInfo?: () => { direction: string };\n textInfo?: { direction: string };\n };\n const textInfo =\n typeof localeAny.getTextInfo === \"function\" ? localeAny.getTextInfo() : localeAny.textInfo;\n\n if (textInfo) {\n return textInfo.direction === \"rtl\";\n }\n\n // Fallback: guess using the script.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n } catch {\n // Fall through to language-based detection\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n const lang = localeString.split(\"-\")[0];\n return RTL_LANGS.has(lang);\n}\n\n/**\n * Creates a cache key for formatter options.\n */\nexport function createCacheKey(locale: string, options?: Record<string, unknown>): string {\n if (!options) {\n return locale;\n }\n return (\n locale +\n Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n );\n}\n","/**\n * Locale context and provider for solidaria\n *\n * Provides locale and text direction to the component tree.\n *\n * Port of @react-aria/i18n context and useDefaultLocale.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from \"solid-js\";\nimport { isRTL } from \"./utils\";\n\n/** Text direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Locale information including language code and text direction. */\nexport interface Locale {\n /** The BCP47 language code for the locale (e.g., 'en-US', 'ar-SA'). */\n locale: string;\n /** The writing direction for the locale. */\n direction: Direction;\n}\n\nexport interface I18nProviderProps extends ParentProps {\n /** The locale to apply to the children. If not provided, uses browser default. */\n locale?: string;\n}\n\n// Symbol for server-provided locale\nconst localeSymbol = Symbol.for(\"solidaria.i18n.locale\");\n\nlet currentLocale: Locale | null = null;\nconst listeners = new Set<(locale: Locale) => void>();\n\n/**\n * Gets the default locale from the browser/system.\n */\nexport function getDefaultLocale(): Locale {\n let locale =\n (typeof window !== \"undefined\" &&\n (window as unknown as Record<symbol, string>)[localeSymbol]) ||\n (typeof navigator !== \"undefined\" &&\n (navigator.language || (navigator as unknown as { userLanguage?: string }).userLanguage)) ||\n \"en-US\";\n\n // Validate the locale is supported\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = \"en-US\";\n }\n\n return {\n locale,\n direction: isRTL(locale) ? \"rtl\" : \"ltr\",\n };\n}\n\nfunction updateLocale(): void {\n currentLocale = getDefaultLocale();\n for (const listener of listeners) {\n listener(currentLocale);\n }\n}\n\nconst I18nContext = createContext<Accessor<Locale> | null>(null);\n\n/**\n * Returns the current browser/system locale, and updates when it changes.\n *\n * @example\n * ```tsx\n * const locale = createDefaultLocale();\n * console.log(locale().locale); // 'en-US'\n * console.log(locale().direction); // 'ltr'\n * ```\n */\nexport function createDefaultLocale(): Accessor<Locale> {\n if (!currentLocale) {\n currentLocale = getDefaultLocale();\n }\n\n const [locale, setLocale] = createSignal<Locale>(currentLocale);\n\n createEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (listeners.size === 0) {\n window.addEventListener(\"languagechange\", updateLocale);\n }\n\n listeners.add(setLocale);\n\n onCleanup(() => {\n listeners.delete(setLocale);\n if (listeners.size === 0) {\n window.removeEventListener(\"languagechange\", updateLocale);\n }\n });\n });\n\n return locale;\n}\n\n/**\n * Returns the current locale and layout direction from context or browser default.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const locale = useLocale();\n * return <div dir={locale().direction}>{locale().locale}</div>;\n * }\n * ```\n */\nexport function useLocale(): Accessor<Locale> {\n const context = useContext(I18nContext);\n const defaultLocale = createDefaultLocale();\n return context || defaultLocale;\n}\n\n/**\n * Provides the locale for the application to all child components.\n *\n * @example\n * ```tsx\n * // Use browser default locale\n * <I18nProvider>\n * <App />\n * </I18nProvider>\n *\n * // Override with specific locale\n * <I18nProvider locale=\"ar-SA\">\n * <App /> // Will have RTL direction\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n const defaultLocale = createDefaultLocale();\n\n const locale = createMemo<Locale>(() => {\n if (props.locale) {\n return {\n locale: props.locale,\n direction: isRTL(props.locale) ? \"rtl\" : \"ltr\",\n };\n }\n return defaultLocale();\n });\n\n return <I18nContext.Provider value={locale}>{props.children}</I18nContext.Provider>;\n}\n","/**\n * createNumberFormatter hook for solidaria\n *\n * Provides localized number formatting with automatic locale updates.\n *\n * Port of @react-aria/i18n useNumberFormatter.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { NumberFormatter, type NumberFormatOptions } from \"@internationalized/number\";\n\n/**\n * Provides localized number formatting for the current locale.\n * Automatically updates when the locale changes.\n *\n * @example\n * ```tsx\n * function PriceDisplay(props: { value: number }) {\n * const formatter = createNumberFormatter({\n * style: 'currency',\n * currency: 'USD',\n * });\n *\n * return <span>{formatter().format(props.value)}</span>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Percent formatting\n * const percentFormatter = createNumberFormatter({\n * style: 'percent',\n * minimumFractionDigits: 1,\n * });\n * percentFormatter().format(0.125); // '12.5%'\n *\n * // Unit formatting\n * const tempFormatter = createNumberFormatter({\n * style: 'unit',\n * unit: 'celsius',\n * });\n * tempFormatter().format(25); // '25°C'\n * ```\n */\nexport function createNumberFormatter(options: NumberFormatOptions = {}): () => NumberFormatter {\n const locale = useLocale();\n\n return createMemo(() => new NumberFormatter(locale().locale, options));\n}\n","/**\n * createDateFormatter hook for solidaria\n *\n * Provides localized date formatting with caching.\n *\n * Port of @react-aria/i18n useDateFormatter.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst dateFormatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Gets or creates a cached date formatter.\n */\nfunction getCachedDateFormatter(\n locale: string,\n options?: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (dateFormatterCache.has(cacheKey)) {\n return dateFormatterCache.get(cacheKey)!;\n }\n\n const formatter = new Intl.DateTimeFormat(locale, options);\n dateFormatterCache.set(cacheKey, formatter);\n return formatter;\n}\n\n/**\n * Provides localized date and time formatting for the current locale.\n * Automatically updates when the locale changes.\n *\n * @example\n * ```tsx\n * function DateDisplay(props: { date: Date }) {\n * const formatter = createDateFormatter({\n * year: 'numeric',\n * month: 'long',\n * day: 'numeric',\n * });\n *\n * return <span>{formatter().format(props.date)}</span>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Short date\n * const shortDate = createDateFormatter({ dateStyle: 'short' });\n * shortDate().format(new Date()); // '1/19/26' (US) or '19/01/26' (UK)\n *\n * // Full date with time\n * const fullDateTime = createDateFormatter({\n * dateStyle: 'full',\n * timeStyle: 'short',\n * });\n *\n * // Time only\n * const timeFormatter = createDateFormatter({\n * hour: 'numeric',\n * minute: '2-digit',\n * });\n * ```\n */\nexport function createDateFormatter(\n options?: Intl.DateTimeFormatOptions,\n): () => Intl.DateTimeFormat {\n const locale = useLocale();\n\n return createMemo(() => getCachedDateFormatter(locale().locale, options));\n}\n","/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { useLocale } from \"./locale\";\nimport { createCacheKey } from \"./utils\";\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(options?: Intl.CollatorOptions): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n","/**\n * createFilter hook for solidaria\n *\n * Provides localized string filtering with collation support.\n *\n * Port of @react-aria/i18n useFilter.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createCollator } from \"./createCollator\";\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean;\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean;\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean;\n}\n\n/**\n * Provides localized string search functionality for filtering or matching items.\n * Respects locale-specific collation rules for case and diacritic sensitivity.\n *\n * @example\n * ```tsx\n * function SearchableList(props: { items: { name: string }[] }) {\n * const [query, setQuery] = createSignal('');\n * const filter = createFilter({ sensitivity: 'base' });\n *\n * const filteredItems = () =>\n * props.items.filter((item) =>\n * filter().contains(item.name, query())\n * );\n *\n * return (\n * <>\n * <input\n * value={query()}\n * onInput={(e) => setQuery(e.target.value)}\n * placeholder=\"Search...\"\n * />\n * <ul>\n * <For each={filteredItems()}>\n * {(item) => <li>{item.name}</li>}\n * </For>\n * </ul>\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive, diacritic-insensitive filtering\n * const filter = createFilter({ sensitivity: 'base' });\n * filter().contains('Café', 'cafe'); // true\n * filter().startsWith('Hello', 'hello'); // true\n * ```\n */\nexport function createFilter(options?: Intl.CollatorOptions): () => Filter {\n const collator = createCollator({\n usage: \"search\",\n ...options,\n });\n\n return createMemo(() => {\n const coll = collator();\n\n const startsWith = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings for safe slicing\n const normalizedStr = str.normalize(\"NFC\");\n const normalizedSub = substring.normalize(\"NFC\");\n\n return coll.compare(normalizedStr.slice(0, normalizedSub.length), normalizedSub) === 0;\n };\n\n const endsWith = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n const normalizedStr = str.normalize(\"NFC\");\n const normalizedSub = substring.normalize(\"NFC\");\n\n return coll.compare(normalizedStr.slice(-normalizedSub.length), normalizedSub) === 0;\n };\n\n const contains = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n const normalizedStr = str.normalize(\"NFC\");\n const normalizedSub = substring.normalize(\"NFC\");\n const sliceLen = normalizedSub.length;\n\n for (let scan = 0; scan + sliceLen <= normalizedStr.length; scan++) {\n const slice = normalizedStr.slice(scan, scan + sliceLen);\n if (coll.compare(normalizedSub, slice) === 0) {\n return true;\n }\n }\n\n return false;\n };\n\n return {\n startsWith,\n endsWith,\n contains,\n };\n });\n}\n","/**\n * String formatter for localized strings with ICU MessageFormat support.\n * Port of @react-aria/i18n useLocalizedStringFormatter.\n */\n\nimport {\n LocalizedString,\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n type LocalizedStrings,\n} from \"@internationalized/string\";\nimport { createMemo, type Accessor } from \"solid-js\";\nimport { useLocale } from \"./locale\";\n\n// Cache for dictionaries to avoid recreating them\nconst cache = new WeakMap<\n LocalizedStrings<string, LocalizedString>,\n LocalizedStringDictionary<string, LocalizedString>\n>();\n\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(\n strings: LocalizedStrings<K, T>,\n): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings as LocalizedStrings<string, LocalizedString>);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(\n strings as LocalizedStrings<string, LocalizedString>,\n );\n cache.set(strings as LocalizedStrings<string, LocalizedString>, dictionary);\n }\n return dictionary as LocalizedStringDictionary<K, T>;\n}\n\n/**\n * Returns a cached LocalizedStringDictionary for the given strings.\n */\nexport function createStringDictionary<\n K extends string = string,\n T extends LocalizedString = string,\n>(strings: LocalizedStrings<K, T>, packageName?: string): LocalizedStringDictionary<K, T> {\n return (\n (packageName && LocalizedStringDictionary.getGlobalDictionaryForPackage(packageName)) ||\n getCachedDictionary(strings)\n );\n}\n\n/**\n * Provides localized string formatting for the current locale.\n * Supports interpolating variables, selecting the correct pluralization,\n * and formatting numbers. Automatically updates when the locale changes.\n *\n * @param strings - A mapping of languages to localized strings by key.\n * @param packageName - Optional package name for global dictionary lookup.\n *\n * @example\n * ```tsx\n * const strings = {\n * 'en-US': {\n * greeting: 'Hello, {name}!',\n * count: '{count, plural, one {# item} other {# items}}'\n * }\n * };\n *\n * function MyComponent() {\n * const stringFormatter = createStringFormatter(strings);\n *\n * return (\n * <div>\n * {stringFormatter().format('greeting', { name: 'World' })}\n * {stringFormatter().format('count', { count: 5 })}\n * </div>\n * );\n * }\n * ```\n */\nexport function createStringFormatter<\n K extends string = string,\n T extends LocalizedString = string,\n>(strings: LocalizedStrings<K, T>, packageName?: string): Accessor<LocalizedStringFormatter<K, T>> {\n const localeAccessor = useLocale();\n const dictionary = createStringDictionary(strings, packageName);\n\n return createMemo(() => new LocalizedStringFormatter(localeAccessor().locale, dictionary));\n}\n\nexport type {\n LocalizedString,\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n LocalizedStrings,\n};\n","/**\n * createToolbar - Accessibility hook for toolbar elements\n *\n * Provides keyboard navigation between toolbar items using arrow keys.\n * Based on @react-aria/toolbar useToolbar.\n */\n\nimport { createSignal, onMount, onCleanup, type Accessor } from \"solid-js\";\nimport { type MaybeAccessor, access } from \"../utils\";\nimport { useLocale } from \"../i18n\";\nimport { getOwnerDocument, isFocusable } from \"../utils\";\nimport { focusSafely } from \"../utils/focus\";\n\nexport type Orientation = \"horizontal\" | \"vertical\";\n\nexport interface AriaToolbarProps {\n /** The orientation of the toolbar. @default 'horizontal' */\n orientation?: MaybeAccessor<Orientation>;\n /** An accessibility label for the toolbar. */\n \"aria-label\"?: MaybeAccessor<string>;\n /** Identifies the element (or elements) that labels the toolbar. */\n \"aria-labelledby\"?: MaybeAccessor<string>;\n}\n\nexport interface ToolbarAria {\n /** Props for the toolbar container element. */\n toolbarProps: {\n role: \"toolbar\" | \"group\";\n \"aria-orientation\": Orientation;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n tabIndex?: number;\n ref: (el: HTMLElement) => void;\n };\n /** The orientation of the toolbar. */\n orientation: Accessor<Orientation>;\n}\n\ninterface FocusManagerOptions {\n from?: Element;\n tabbable?: boolean;\n wrap?: boolean;\n accept?: (node: Element) => boolean;\n}\n\ninterface FocusManager {\n focusNext(opts?: FocusManagerOptions): HTMLElement | null;\n focusPrevious(opts?: FocusManagerOptions): HTMLElement | null;\n focusFirst(opts?: FocusManagerOptions): HTMLElement | null;\n focusLast(opts?: FocusManagerOptions): HTMLElement | null;\n}\n\nfunction isTabbable(element: Element): boolean {\n if (!isFocusable(element)) {\n return false;\n }\n const tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex != null) {\n return parseInt(tabIndex, 10) >= 0;\n }\n return true;\n}\n\nfunction getFocusableElements(root: Element, tabbable = false): HTMLElement[] {\n const elements: HTMLElement[] = [];\n const filter = tabbable ? isTabbable : isFocusable;\n\n // Check the root element itself\n if (filter(root)) {\n elements.push(root as HTMLElement);\n }\n\n // Check all descendants\n const descendants = root.querySelectorAll(\"*\");\n for (let i = 0; i < descendants.length; i++) {\n const el = descendants[i];\n if (filter(el)) {\n elements.push(el as HTMLElement);\n }\n }\n\n return elements;\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement;\n}\n\nconst TEXT_INPUT_TYPES = new Set([\n \"\",\n \"text\",\n \"search\",\n \"url\",\n \"tel\",\n \"password\",\n \"email\",\n \"number\",\n \"date\",\n \"datetime-local\",\n \"month\",\n \"time\",\n \"week\",\n]);\n\nfunction isTextInputLikeElement(target: EventTarget | null): boolean {\n if (!(target instanceof HTMLElement)) {\n return false;\n }\n\n if (target.isContentEditable || !!target.closest('[contenteditable=\"true\"]')) {\n return true;\n }\n\n if (target.getAttribute(\"role\") === \"textbox\") {\n return true;\n }\n\n if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) {\n return true;\n }\n\n if (target instanceof HTMLInputElement) {\n const type = target.type.toLowerCase();\n return TEXT_INPUT_TYPES.has(type);\n }\n\n return false;\n}\n\nfunction createFocusManager(ref: Accessor<HTMLElement | undefined>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const doc = getOwnerDocument(root);\n const current = from || getActiveElement(doc);\n\n let elements = getFocusableElements(root, tabbable);\n if (accept) {\n elements = elements.filter(accept);\n }\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let nextIndex = currentIndex + 1;\n\n if (nextIndex >= elements.length) {\n if (wrap) {\n nextIndex = 0;\n } else {\n return null;\n }\n }\n\n const nextElement = elements[nextIndex];\n if (nextElement) {\n focusSafely(nextElement);\n return nextElement;\n }\n\n return null;\n },\n\n focusPrevious(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const doc = getOwnerDocument(root);\n const current = from || getActiveElement(doc);\n\n let elements = getFocusableElements(root, tabbable);\n if (accept) {\n elements = elements.filter(accept);\n }\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let prevIndex = currentIndex - 1;\n\n if (prevIndex < 0) {\n if (wrap) {\n prevIndex = elements.length - 1;\n } else {\n return null;\n }\n }\n\n const prevElement = elements[prevIndex];\n if (prevElement) {\n focusSafely(prevElement);\n return prevElement;\n }\n\n return null;\n },\n\n focusFirst(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n\n const { tabbable = true, accept } = opts;\n let elements = getFocusableElements(root, tabbable);\n if (accept) {\n elements = elements.filter(accept);\n }\n\n if (elements.length > 0) {\n focusSafely(elements[0]);\n return elements[0];\n }\n\n return null;\n },\n\n focusLast(opts: FocusManagerOptions = {}) {\n const root = ref();\n if (!root) return null;\n\n const { tabbable = true, accept } = opts;\n let elements = getFocusableElements(root, tabbable);\n if (accept) {\n elements = elements.filter(accept);\n }\n\n if (elements.length > 0) {\n const lastElement = elements[elements.length - 1];\n focusSafely(lastElement);\n return lastElement;\n }\n\n return null;\n },\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toolbar.\n * A toolbar is a container for a set of interactive controls with arrow key navigation.\n *\n * @example\n * ```tsx\n * let ref;\n * const { toolbarProps } = createToolbar({ orientation: 'horizontal' });\n * return (\n * <div {...toolbarProps}>\n * <Button>Cut</Button>\n * <Button>Copy</Button>\n * <Button>Paste</Button>\n * </div>\n * );\n * ```\n */\nexport function createToolbar(props: AriaToolbarProps = {}): ToolbarAria {\n let toolbarRef: HTMLElement | undefined;\n const [isInToolbar, setIsInToolbar] = createSignal(false);\n let lastFocusedElement: Element | null = null;\n\n const locale = useLocale();\n const orientation = () => access(props.orientation) ?? \"horizontal\";\n const ariaLabel = () => access(props[\"aria-label\"]);\n const ariaLabelledby = () => access(props[\"aria-labelledby\"]);\n\n const focusManager = createFocusManager(() => toolbarRef);\n\n // Check if this toolbar is nested inside another toolbar\n onMount(() => {\n if (toolbarRef) {\n const parentToolbar = toolbarRef.parentElement?.closest('[role=\"toolbar\"]');\n setIsInToolbar(!!parentToolbar);\n }\n });\n\n // Keyboard event handler\n const onKeyDown = (e: KeyboardEvent) => {\n const root = toolbarRef;\n if (!root) return;\n\n // Don't handle if nested toolbar (parent handles navigation)\n if (isInToolbar()) return;\n\n const target = e.target;\n if (!(target instanceof Element) || !root.contains(target)) {\n return;\n }\n\n // Let modified shortcuts pass through.\n if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {\n return;\n }\n\n // Text entry controls should keep arrow/home/end for caret/value navigation.\n if (isTextInputLikeElement(target)) {\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowLeft\":\n case \"ArrowDown\":\n case \"ArrowUp\":\n case \"Home\":\n case \"End\":\n return;\n }\n }\n\n const dir = locale().direction;\n const isRTL = dir === \"rtl\";\n const isHorizontal = orientation() === \"horizontal\";\n\n let handled = false;\n\n switch (e.key) {\n case \"ArrowRight\":\n if (isHorizontal) {\n if (isRTL) {\n focusManager.focusPrevious({ tabbable: true });\n } else {\n focusManager.focusNext({ tabbable: true });\n }\n handled = true;\n }\n break;\n case \"ArrowLeft\":\n if (isHorizontal) {\n if (isRTL) {\n focusManager.focusNext({ tabbable: true });\n } else {\n focusManager.focusPrevious({ tabbable: true });\n }\n handled = true;\n }\n break;\n case \"ArrowDown\":\n if (!isHorizontal) {\n focusManager.focusNext({ tabbable: true });\n handled = true;\n }\n break;\n case \"ArrowUp\":\n if (!isHorizontal) {\n focusManager.focusPrevious({ tabbable: true });\n handled = true;\n }\n break;\n case \"Home\":\n focusManager.focusFirst({ tabbable: true });\n handled = true;\n break;\n case \"End\":\n focusManager.focusLast({ tabbable: true });\n handled = true;\n break;\n case \"Tab\":\n // Store the last focused element for re-entry\n lastFocusedElement = e.target as Element;\n break;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Focus handler - restore last focused element when re-entering\n const onFocus = (e: FocusEvent) => {\n if (isInToolbar()) return;\n\n // Only restore if focus is coming from outside the toolbar\n const root = toolbarRef;\n if (!root) return;\n\n const relatedTarget = e.relatedTarget as Element | null;\n\n // If focus came from outside and we have a last focused element\n if (\n lastFocusedElement &&\n root.contains(lastFocusedElement) &&\n (!relatedTarget || !root.contains(relatedTarget))\n ) {\n // Restore focus to the last focused element\n focusSafely(lastFocusedElement as HTMLElement);\n }\n };\n\n // Set up capture event listeners\n const setRef = (el: HTMLElement) => {\n toolbarRef = el;\n\n // Use capture phase for keyboard events\n el.addEventListener(\"keydown\", onKeyDown, true);\n el.addEventListener(\"focus\", onFocus, true);\n\n onCleanup(() => {\n el.removeEventListener(\"keydown\", onKeyDown, true);\n el.removeEventListener(\"focus\", onFocus, true);\n });\n };\n\n return {\n toolbarProps: {\n get role() {\n return isInToolbar() ? \"group\" : \"toolbar\";\n },\n get \"aria-orientation\"() {\n return orientation();\n },\n get \"aria-label\"() {\n return ariaLabel();\n },\n get \"aria-labelledby\"() {\n // Only use aria-labelledby if no aria-label is provided\n return ariaLabel() ? undefined : ariaLabelledby();\n },\n ref: setRef,\n },\n orientation,\n };\n}\n","import type { JSX } from \"solid-js\";\nimport type { Key, ToggleGroupProps, ToggleGroupState } from \"@proyecto-viviana/solid-stately\";\nimport { createToolbar, type Orientation } from \"../toolbar\";\nimport { mergeProps } from \"../utils\";\nimport {\n createToggleButton,\n type AriaToggleButtonProps,\n type ToggleButtonAria,\n} from \"./createToggleButton\";\n\nexport interface AriaToggleButtonGroupProps extends ToggleGroupProps {\n /**\n * The orientation of the toggle button group.\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n}\n\nexport interface ToggleButtonGroupAria {\n /** Props for the group container. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nexport interface AriaToggleButtonGroupItemProps extends Omit<AriaToggleButtonProps, \"children\"> {\n /** Key used in the group selection state. */\n id: Key;\n}\n\nfunction isDisabledValue(isDisabled: AriaToggleButtonProps[\"isDisabled\"]): boolean {\n if (typeof isDisabled === \"function\") {\n return isDisabled();\n }\n return !!isDisabled;\n}\n\n/**\n * Provides ARIA behavior for a toggle button group container.\n */\nexport function createToggleButtonGroup(\n props: AriaToggleButtonGroupProps,\n state: ToggleGroupState,\n): ToggleButtonGroupAria {\n const { toolbarProps } = createToolbar({\n get orientation() {\n return props.orientation;\n },\n get \"aria-label\"() {\n return props[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return props[\"aria-labelledby\"];\n },\n });\n\n const groupProps = mergeProps(toolbarProps as Record<string, unknown>, {\n get role() {\n return state.selectionMode === \"single\" ? \"radiogroup\" : toolbarProps.role;\n },\n get \"aria-disabled\"() {\n return props.isDisabled || undefined;\n },\n }) as JSX.HTMLAttributes<HTMLElement>;\n\n return { groupProps };\n}\n\n/**\n * Provides ARIA behavior for an item within a toggle button group.\n */\nexport function createToggleButtonGroupItem(\n props: AriaToggleButtonGroupItemProps,\n state: ToggleGroupState,\n): ToggleButtonAria {\n const { id: _id, ...toggleProps } = props;\n\n const toggleButton = createToggleButton({\n ...toggleProps,\n get isSelected() {\n return state.selectedKeys.has(props.id);\n },\n onChange(isSelected) {\n state.setSelected(props.id, isSelected);\n props.onChange?.(isSelected);\n },\n get isDisabled() {\n return isDisabledValue(props.isDisabled) || state.isDisabled;\n },\n });\n\n const baseButtonProps = toggleButton.buttonProps as Record<string, unknown>;\n const buttonProps: Record<string, unknown> = {\n ...baseButtonProps,\n get role() {\n if (state.selectionMode === \"single\") {\n return \"radio\";\n }\n return baseButtonProps.role as string | undefined;\n },\n get \"aria-checked\"() {\n if (state.selectionMode !== \"single\") {\n return undefined;\n }\n return state.selectedKeys.has(props.id);\n },\n get \"aria-pressed\"() {\n if (state.selectionMode === \"single\") {\n return undefined;\n }\n return baseButtonProps[\"aria-pressed\"];\n },\n };\n\n return {\n ...toggleButton,\n buttonProps,\n };\n}\n","import { onCleanup, type JSX, type Accessor } from \"solid-js\";\nimport { createButton } from \"../button\";\nimport {\n filterDOMProps,\n getEventTarget,\n mergeProps,\n nodeContains,\n isFocusable,\n focusSafely,\n} from \"../utils\";\nimport { useLocale } from \"../i18n\";\nimport type { Orientation } from \"../toolbar\";\nimport type { Key, ListState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaActionGroupProps<T = unknown> {\n /** List items (optional, parity with React Aria prop shape). */\n items?: T[];\n /** Whether the whole action group is disabled. */\n isDisabled?: boolean;\n /** Group orientation. */\n orientation?: Orientation;\n /** Accessible label. */\n \"aria-label\"?: string;\n /** Labelled-by id. */\n \"aria-labelledby\"?: string;\n /** Handler called when an item action is triggered. */\n onAction?: (key: Key) => void;\n}\n\nexport interface ActionGroupAria {\n actionGroupProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nexport interface AriaActionGroupItemProps {\n key: Key;\n}\n\nexport interface ActionGroupItemAria {\n buttonProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\ninterface ActionGroupData {\n onAction?: (key: Key) => void;\n}\n\nconst actionGroupData = new WeakMap<object, ActionGroupData>();\n\nconst GROUP_ROLE_BY_MODE = {\n none: \"toolbar\",\n single: \"radiogroup\",\n multiple: \"toolbar\",\n} as const;\n\nconst ITEM_ROLE_BY_MODE = {\n none: undefined,\n single: \"radio\",\n multiple: \"checkbox\",\n} as const;\n\nfunction isActionGroupDisabled<T>(props: AriaActionGroupProps<T>, state: ListState<T>): boolean {\n if (props.isDisabled) return true;\n const keys = [...state.collection().getKeys()];\n if (keys.length === 0) return true;\n return !keys.some((key) => !state.isDisabled(key));\n}\n\nexport function createActionGroup<T>(\n props: AriaActionGroupProps<T>,\n state: ListState<T>,\n _ref?: Accessor<HTMLElement | null>,\n): ActionGroupAria {\n const locale = useLocale();\n let groupRef: HTMLElement | undefined;\n const applyRoleAttributes = (): void => {\n if (!groupRef) return;\n const selectionMode = state.selectionMode();\n const mappedRole = GROUP_ROLE_BY_MODE[selectionMode];\n const nestedToolbar = Boolean(groupRef.parentElement?.closest('[role=\"toolbar\"]'));\n const role = mappedRole === \"toolbar\" && nestedToolbar ? \"group\" : mappedRole;\n groupRef.setAttribute(\"role\", role);\n if (mappedRole === \"toolbar\" && !nestedToolbar) {\n groupRef.setAttribute(\"aria-orientation\", props.orientation ?? \"horizontal\");\n } else {\n groupRef.removeAttribute(\"aria-orientation\");\n }\n };\n\n const getFocusableItems = (root: HTMLElement): HTMLElement[] => {\n const out: HTMLElement[] = [];\n const pushIfFocusable = (el: Element | null | undefined): void => {\n if (!el || !(el instanceof HTMLElement)) return;\n if (isFocusable(el) && el.getAttribute(\"aria-disabled\") !== \"true\") {\n out.push(el);\n }\n };\n\n pushIfFocusable(root);\n for (const node of root.querySelectorAll(\"*\")) {\n pushIfFocusable(node);\n }\n return out;\n };\n\n const focusRelative = (\n root: HTMLElement,\n direction: \"next\" | \"previous\" | \"first\" | \"last\",\n ): HTMLElement | null => {\n const focusables = getFocusableItems(root);\n if (focusables.length === 0) return null;\n\n if (direction === \"first\") {\n const first = focusables[0];\n focusSafely(first);\n return first;\n }\n\n if (direction === \"last\") {\n const last = focusables[focusables.length - 1];\n focusSafely(last);\n return last;\n }\n\n const active = root.ownerDocument.activeElement as HTMLElement | null;\n const currentIndex = active ? focusables.indexOf(active) : -1;\n const delta = direction === \"next\" ? 1 : -1;\n const nextIndex =\n currentIndex === -1\n ? direction === \"next\"\n ? 0\n : focusables.length - 1\n : (currentIndex + delta + focusables.length) % focusables.length;\n const next = focusables[nextIndex];\n focusSafely(next);\n return next;\n };\n\n const resolveKeyFromElement = (element: HTMLElement | null): Key | null => {\n if (!element) return null;\n const keyedElement = element.closest(\"[data-key]\");\n if (!(keyedElement instanceof HTMLElement)) return null;\n const rawKey = keyedElement.getAttribute(\"data-key\");\n if (!rawKey) return null;\n for (const item of state.collection()) {\n if (String(item.key) === rawKey) {\n return item.key;\n }\n }\n return null;\n };\n\n const handleFocusMove = (movedTo: HTMLElement | null): void => {\n const key = resolveKeyFromElement(movedTo);\n if (key == null) return;\n state.setFocusedKey(key);\n if (state.selectionMode() === \"single\") {\n state.replaceSelection(key);\n }\n };\n\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n const root = groupRef;\n if (!root || isActionGroupDisabled(props, state)) return;\n if (!nodeContains(e.currentTarget, getEventTarget(e))) return;\n\n const orientation = props.orientation ?? \"horizontal\";\n const isHorizontal = orientation === \"horizontal\";\n const isRTL = locale().direction === \"rtl\" && isHorizontal;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\": {\n if (e.key === \"ArrowRight\" && isHorizontal && isRTL) {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"previous\"));\n return;\n }\n if ((e.key === \"ArrowRight\" && isHorizontal) || (e.key === \"ArrowDown\" && !isHorizontal)) {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"next\"));\n }\n return;\n }\n case \"ArrowLeft\":\n case \"ArrowUp\": {\n if (e.key === \"ArrowLeft\" && isHorizontal && isRTL) {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"next\"));\n return;\n }\n if ((e.key === \"ArrowLeft\" && isHorizontal) || (e.key === \"ArrowUp\" && !isHorizontal)) {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"previous\"));\n }\n return;\n }\n case \"Home\": {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"first\"));\n return;\n }\n case \"End\": {\n e.preventDefault();\n e.stopPropagation();\n handleFocusMove(focusRelative(root, \"last\"));\n return;\n }\n }\n };\n\n const actionGroupProps: JSX.HTMLAttributes<HTMLElement> = mergeProps(\n filterDOMProps(props as Record<string, unknown>, { labelable: true }),\n {\n ref: (el: HTMLElement) => {\n groupRef = el;\n applyRoleAttributes();\n queueMicrotask(() => {\n if (!groupRef) return;\n applyRoleAttributes();\n });\n },\n onKeyDown,\n get \"aria-label\"() {\n return props[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return props[\"aria-label\"] ? undefined : props[\"aria-labelledby\"];\n },\n get \"aria-disabled\"() {\n return isActionGroupDisabled(props, state) || undefined;\n },\n },\n );\n\n actionGroupData.set(state, {\n get onAction() {\n return props.onAction;\n },\n });\n\n onCleanup(() => {\n actionGroupData.delete(state);\n });\n\n return { actionGroupProps };\n}\n\nexport function createActionGroupItem<T>(\n props: AriaActionGroupItemProps,\n state: ListState<T>,\n): ActionGroupItemAria {\n const button = createButton({\n elementType: \"button\",\n isDisabled: state.isDisabled(props.key),\n onPress: () => {\n state.setFocusedKey(props.key);\n actionGroupData.get(state)?.onAction?.(props.key);\n if (state.selectionMode() !== \"none\") {\n state.select(props.key);\n }\n },\n });\n\n const isFocused = () => props.key === state.focusedKey();\n const getFirstEnabledKey = (): Key | null => {\n const collection = state.collection();\n let key = collection.getFirstKey();\n while (key != null && state.isDisabled(key)) {\n key = collection.getKeyAfter(key);\n }\n return key;\n };\n\n const getDefaultTabStopKey = (): Key | null => {\n const selectionMode = state.selectionMode();\n if (selectionMode !== \"none\") {\n const selectedKeys = state.selectedKeys();\n if (selectedKeys === \"all\") {\n return getFirstEnabledKey();\n }\n\n for (const item of state.collection()) {\n if (!state.isDisabled(item.key) && selectedKeys.has(item.key)) {\n return item.key;\n }\n }\n }\n\n return getFirstEnabledKey();\n };\n\n onCleanup(() => {\n if (isFocused()) {\n state.setFocusedKey(null);\n }\n });\n\n const buttonProps: JSX.HTMLAttributes<HTMLElement> = mergeProps(button.buttonProps, {\n get role() {\n return ITEM_ROLE_BY_MODE[state.selectionMode()];\n },\n get \"aria-checked\"() {\n const mode = state.selectionMode();\n if (mode === \"none\") return undefined;\n return state.isSelected(props.key);\n },\n get tabIndex() {\n if (state.isDisabled(props.key)) {\n return -1;\n }\n\n if (isFocused()) {\n return 0;\n }\n\n if (state.focusedKey() != null) {\n return -1;\n }\n\n const defaultTabStopKey = getDefaultTabStopKey();\n return defaultTabStopKey === props.key ? 0 : -1;\n },\n \"data-key\": String(props.key),\n onFocus: () => {\n state.setFocusedKey(props.key);\n },\n });\n\n return { buttonProps };\n}\n","import { createContext, createMemo, useContext, type Accessor } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils\";\nimport {\n ListCollection,\n type Collection as StatelyCollection,\n type CollectionNode as StatelyCollectionNode,\n type Key,\n} from \"@proyecto-viviana/solid-stately\";\n\nexport interface CachedChildrenOptions<T> {\n items?: Iterable<T>;\n children?: ((item: T) => unknown) | unknown;\n dependencies?: ReadonlyArray<unknown>;\n getKey?: (item: T) => Key;\n idScope?: Key;\n addIdAndValue?: boolean;\n}\n\nexport interface CollectionBuilderProps<T> extends CachedChildrenOptions<T> {}\n\nexport interface CollectionProps<T> extends CollectionBuilderProps<T> {}\n\nexport interface CollectionCompatNode<TProps = unknown, TValue = unknown> {\n key: Key;\n value: TValue;\n props: TProps;\n}\n\nconst COLLECTION_NODE_PROP = \"__collectionNode\";\n\nfunction applyCollectionMetadata<T>(\n rendered: unknown,\n item: T,\n key: Key,\n addIdAndValue: boolean,\n): unknown {\n if (typeof rendered !== \"object\" || rendered === null) return rendered;\n const next = {\n ...(rendered as Record<string, unknown>),\n key,\n [COLLECTION_NODE_PROP]: {\n key,\n value: item,\n props: rendered as Record<string, unknown>,\n } satisfies CollectionCompatNode<Record<string, unknown>, T>,\n } as Record<string, unknown>;\n if (addIdAndValue) {\n next.id = key;\n next.value = item;\n }\n return next;\n}\n\n/**\n * Compatibility helper mirroring React Aria collections API shape.\n * For Solid, this is a lightweight mapper over item arrays.\n */\nexport function CollectionBuilder<T>(props: CollectionBuilderProps<T>): unknown {\n if (typeof props.children === \"function\" && props.items) {\n const children = props.children as (item: T) => unknown;\n const mapped: unknown[] = [];\n let index = 0;\n\n for (const item of props.items) {\n const baseKey = getResolvedItemKey(item, index, props.getKey);\n if (baseKey == null) {\n throw new Error(\"Could not determine key for item\");\n }\n const key = props.idScope != null ? `${String(props.idScope)}:${String(baseKey)}` : baseKey;\n const rendered = children(item);\n const withMeta = applyCollectionMetadata(rendered, item, key, props.addIdAndValue ?? false);\n mapped.push(withMeta);\n index += 1;\n }\n\n return mapped;\n }\n return props.children ?? null;\n}\n\nexport function Collection<T>(props: CollectionProps<T>): unknown {\n return CollectionBuilder({\n ...props,\n addIdAndValue: props.addIdAndValue ?? true,\n });\n}\n\n/**\n * Identity helper retained for API compatibility.\n */\nexport function createLeafComponent<TProps>(\n component: (props: TProps, node?: CollectionCompatNode<TProps, unknown>) => unknown,\n): (props: TProps) => unknown {\n return (props: TProps) => {\n const node = (props as Record<string, unknown>)[COLLECTION_NODE_PROP] as\n | CollectionCompatNode<TProps, unknown>\n | undefined;\n if (component.length >= 2 && !node) {\n throw new Error(`${component.name || \"Component\"} cannot be rendered outside a collection.`);\n }\n return component(props, node);\n };\n}\n\n/**\n * Identity helper retained for API compatibility.\n */\nexport function createBranchComponent<TProps>(\n component: (props: TProps, node?: CollectionCompatNode<TProps, unknown>) => unknown,\n): (props: TProps) => unknown {\n return (props: TProps) => {\n const node = (props as Record<string, unknown>)[COLLECTION_NODE_PROP] as\n | CollectionCompatNode<TProps, unknown>\n | undefined;\n if (component.length >= 2 && !node) {\n throw new Error(`${component.name || \"Component\"} cannot be rendered outside a collection.`);\n }\n return component(props, node);\n };\n}\n\nconst HiddenContext = createContext<Accessor<boolean>>(() => false);\n\n/**\n * Wraps a component and suppresses rendering when the hidden context is true.\n */\nexport function createHideableComponent<TProps>(\n component: (props: TProps) => unknown,\n): (props: TProps) => unknown {\n return (props: TProps) => {\n const isHidden = useIsHidden();\n if (isHidden()) return null;\n return component(props);\n };\n}\n\nexport function useIsHidden(): Accessor<boolean> {\n return useContext(HiddenContext) ?? (() => false);\n}\n\n/**\n * Memoized item renderer for dynamic child mapping.\n */\nexport function useCachedChildren<T>(\n options: MaybeAccessor<CachedChildrenOptions<T>>,\n): Accessor<unknown[]> {\n let objectCache = new WeakMap<object, unknown>();\n const primitiveCache = new Map<Key, unknown>();\n let lastDependencies: ReadonlyArray<unknown> | undefined;\n let lastIdScope: Key | undefined;\n let lastAddIdAndValue: boolean | undefined;\n let lastGetKey: ((item: T) => Key) | undefined;\n\n const clearCaches = (): void => {\n objectCache = new WeakMap<object, unknown>();\n primitiveCache.clear();\n };\n\n const getItemKey = (item: T, index: number, getKey?: (item: T) => Key): Key | undefined => {\n return getResolvedItemKey(item, index, getKey);\n };\n\n return createMemo(() => {\n const resolved = access(options);\n const resolvedAddIdAndValue = resolved.addIdAndValue ?? false;\n const resolvedGetKey = resolved.getKey;\n const resolvedIdScope = resolved.idScope;\n\n if (resolved.dependencies && resolved.dependencies !== lastDependencies) {\n clearCaches();\n lastDependencies = resolved.dependencies;\n }\n if (\n resolvedIdScope !== lastIdScope ||\n resolvedAddIdAndValue !== lastAddIdAndValue ||\n resolvedGetKey !== lastGetKey\n ) {\n clearCaches();\n lastIdScope = resolvedIdScope;\n lastAddIdAndValue = resolvedAddIdAndValue;\n lastGetKey = resolvedGetKey;\n }\n\n if (typeof resolved.children === \"function\" && resolved.items) {\n const children = resolved.children as (item: T) => unknown;\n const rendered: unknown[] = [];\n let index = 0;\n\n for (const item of resolved.items) {\n const baseKey = getItemKey(item, index, resolvedGetKey);\n if (baseKey == null) {\n throw new Error(\"Could not determine key for item\");\n }\n const key =\n resolvedIdScope != null ? `${String(resolvedIdScope)}:${String(baseKey)}` : baseKey;\n let child: unknown;\n\n if (typeof item === \"object\" && item !== null) {\n child = objectCache.get(item as object);\n if (child === undefined) {\n child = applyCollectionMetadata(children(item), item, key, resolvedAddIdAndValue);\n objectCache.set(item as object, child);\n }\n } else {\n if (primitiveCache.has(key)) {\n child = primitiveCache.get(key);\n } else {\n child = applyCollectionMetadata(children(item), item, key, resolvedAddIdAndValue);\n primitiveCache.set(key, child);\n }\n }\n\n rendered.push(child);\n index += 1;\n }\n\n return rendered;\n }\n const child = resolved.children;\n return child == null ? [] : [child];\n });\n}\n\n/**\n * Minimal BaseCollection compatibility class.\n */\nexport class BaseCollection<T = unknown> extends ListCollection<T> {}\n\nexport type CollectionNode<T = unknown> = StatelyCollectionNode<T>;\nexport type ItemNode<T = unknown> = StatelyCollectionNode<T>;\nexport type SectionNode<T = unknown> = StatelyCollectionNode<T>;\nexport type FilterableNode<T = unknown> = StatelyCollectionNode<T>;\nexport type LoaderNode<T = unknown> = StatelyCollectionNode<T>;\nexport type HeaderNode<T = unknown> = StatelyCollectionNode<T>;\nexport type CollectionType<T = unknown> = StatelyCollection<T>;\n\nfunction getResolvedItemKey<T>(item: T, index: number, getKey?: (item: T) => Key): Key | undefined {\n if (getKey) return getKey(item);\n if (typeof item === \"object\" && item !== null) {\n const keyed = item as Record<string, unknown>;\n const keyValue = keyed.key ?? keyed.id;\n if (typeof keyValue === \"string\" || typeof keyValue === \"number\") return keyValue;\n }\n if (typeof item === \"string\" || typeof item === \"number\") return index;\n return undefined;\n}\n","/**\n * Toggle hook for Solidaria\n *\n * Handles interactions for toggle elements, e.g. Checkboxes and Switches.\n *\n * This is a 1:1 port of @react-aria/toggle's useToggle hook.\n */\n\nimport { JSX, Accessor, createEffect } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { isDevEnv } from \"../utils/env\";\nimport { type ToggleState } from \"@proyecto-viviana/solid-stately\";\nimport { type PressEvent } from \"../interactions/PressEvent\";\n\nexport interface AriaToggleProps {\n /** Whether the element should be selected (controlled). */\n isSelected?: boolean;\n /** Whether the element should be selected by default (uncontrolled). */\n defaultSelected?: boolean;\n /** Handler that is called when the element's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n /** The value of the input element, used when submitting an HTML form. */\n value?: string;\n /** The name of the input element, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the input with. */\n form?: string;\n /** Whether the element is disabled. */\n isDisabled?: boolean;\n /** Whether the element is read only. */\n isReadOnly?: boolean;\n /** Whether the element is required. */\n isRequired?: boolean;\n /** Whether the element is invalid. */\n isInvalid?: boolean;\n /** The element's children. */\n children?: JSX.Element;\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide an error message for the object. */\n \"aria-errormessage\"?: string;\n /** Identifies the element (or elements) whose contents or presence are controlled by the current element. */\n \"aria-controls\"?: string;\n /** The element's unique identifier. */\n id?: string;\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /** Handler that is called when a press is released over the target, regardless of whether it started on the target or not. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to exclude the element from the tab order. */\n excludeFromTabOrder?: boolean;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n}\n\nexport interface ToggleAria {\n /** Props to be spread on the label element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props to be spread on the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the toggle is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the toggle is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the toggle is disabled. */\n isDisabled: boolean;\n /** Whether the toggle is read only. */\n isReadOnly: boolean;\n /** Whether the toggle is invalid. */\n isInvalid: boolean;\n}\n\n/**\n * Handles interactions for toggle elements, e.g. Checkboxes and Switches.\n */\nexport function createToggle(\n props: MaybeAccessor<AriaToggleProps>,\n state: ToggleState,\n ref: () => HTMLInputElement | null,\n): ToggleAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled ?? false;\n const isReadOnly = () => getProps().isReadOnly ?? false;\n const isInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n // Handle press state for keyboard interactions and cases where labelProps is not used.\n const { pressProps, isPressed } = createPress({\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onPressChange() {\n return getProps().onPressChange;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressUp() {\n return getProps().onPressUp;\n },\n get onClick() {\n return getProps().onClick;\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n // Handle press state on the label.\n const { pressProps: labelPressProps, isPressed: isLabelPressed } = createPress({\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onPressChange() {\n return getProps().onPressChange;\n },\n get onPressUp() {\n return getProps().onPressUp;\n },\n get onClick() {\n return getProps().onClick;\n },\n onPress(e: PressEvent) {\n getProps().onPress?.(e);\n state.toggle();\n ref()?.focus();\n },\n get isDisabled() {\n return isDisabled() || isReadOnly();\n },\n });\n\n // Handle focusable - extract the relevant props for createFocusable\n const { focusableProps } = createFocusable(\n {\n get isDisabled() {\n return isDisabled();\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get excludeFromTabOrder() {\n return getProps().excludeFromTabOrder;\n },\n },\n ref as unknown as (el: HTMLElement) => void,\n );\n\n // Combine press and focusable props for input\n const interactions = mergeProps(pressProps, focusableProps);\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Handle input change\n const onChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n // Since we spread props on label, onChange will end up there as well as in here.\n // So we have to stop propagation at the lowest level that we care about\n e.stopPropagation();\n\n // Don't update state if readonly\n if (isReadOnly()) {\n // Reset the checkbox to its previous state since the browser already toggled it\n e.currentTarget.checked = state.isSelected();\n return;\n }\n\n state.setSelected(e.currentTarget.checked);\n };\n\n // Warn if no accessible label\n createEffect(() => {\n const p = getProps();\n const hasChildren = p.children != null;\n const hasAriaLabel = p[\"aria-label\"] != null || p[\"aria-labelledby\"] != null;\n if (!hasChildren && !hasAriaLabel && isDevEnv()) {\n console.warn(\n \"If you do not provide children, you must specify an aria-label for accessibility\",\n );\n }\n });\n\n // Combined pressed state\n const combinedIsPressed: Accessor<boolean> = () => isPressed() || isLabelPressed();\n\n return {\n labelProps: mergeProps(labelPressProps, {\n onClick: (e: MouseEvent) => e.preventDefault(),\n }) as JSX.LabelHTMLAttributes<HTMLLabelElement>,\n get inputProps() {\n const p = getProps();\n return mergeProps(domProps(), {\n \"aria-invalid\": isInvalid() || undefined,\n \"aria-errormessage\": p[\"aria-errormessage\"],\n \"aria-controls\": p[\"aria-controls\"],\n \"aria-readonly\": isReadOnly() || undefined,\n onChange,\n disabled: isDisabled(),\n ...(p.value == null ? {} : { value: p.value }),\n name: p.name,\n form: p.form,\n type: \"checkbox\" as const,\n ...interactions,\n // Stop click propagation to prevent labelProps.onClick from calling preventDefault\n // which would prevent the checkbox from toggling in JSDOM/testing-library environments\n onClick: (e: MouseEvent) => e.stopPropagation(),\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isSelected: state.isSelected,\n isPressed: combinedIsPressed,\n isDisabled: isDisabled(),\n isReadOnly: isReadOnly(),\n isInvalid: isInvalid(),\n };\n}\n","/**\n * Checkbox hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckbox hook.\n */\n\nimport { JSX, Accessor, createEffect } from \"solid-js\";\nimport { createToggle, type AriaToggleProps } from \"../toggle\";\nimport { type ToggleState } from \"@proyecto-viviana/solid-stately\";\nimport { createPress } from \"../interactions/createPress\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaCheckboxProps extends AriaToggleProps {\n /**\n * Indeterminism is presentational only.\n * The indeterminate visual representation remains regardless of user interaction.\n */\n isIndeterminate?: boolean;\n /**\n * Whether the checkbox is required.\n */\n isRequired?: boolean;\n /**\n * The validation behavior for the checkbox.\n * @default 'native'\n */\n validationBehavior?: \"aria\" | \"native\";\n}\n\nexport interface CheckboxAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the checkbox is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the checkbox is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the checkbox is disabled. */\n isDisabled: boolean;\n /** Whether the checkbox is read only. */\n isReadOnly: boolean;\n /** Whether the checkbox is invalid. */\n isInvalid: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n *\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `createToggleState`.\n * @param inputRef - A ref accessor for the HTML input element.\n */\nexport function createCheckbox(\n props: MaybeAccessor<AriaCheckboxProps>,\n state: ToggleState,\n inputRef: () => HTMLInputElement | null,\n): CheckboxAria {\n const getProps = () => access(props);\n\n // Get toggle aria props\n const toggleResult = createToggle(props, state, inputRef);\n const {\n labelProps: baseLabelProps,\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n } = toggleResult;\n\n // Handle indeterminate state\n createEffect(() => {\n const input = inputRef();\n const isIndeterminate = getProps().isIndeterminate;\n if (input) {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n input.indeterminate = !!isIndeterminate;\n }\n });\n\n // Reset validation state on label press for checkbox with a hidden input.\n const { pressProps } = createPress({\n get isDisabled() {\n return isDisabled || isReadOnly;\n },\n onPress() {\n // Validation state reset would be handled here if we had form validation\n // For now, this is a no-op placeholder matching React-Aria's pattern\n },\n });\n\n return {\n labelProps: mergeProps(\n baseLabelProps as unknown as Record<string, unknown>,\n pressProps as unknown as Record<string, unknown>,\n {\n // Prevent label from being focused when mouse down on it.\n // Note, this does not prevent the input from being focused in the `click` event.\n onMouseDown: (e: MouseEvent) => e.preventDefault(),\n } as Record<string, unknown>,\n ) as JSX.LabelHTMLAttributes<HTMLLabelElement>,\n get inputProps() {\n const p = getProps();\n const { isRequired, validationBehavior = \"native\" } = p;\n\n return mergeProps(toggleResult.inputProps, {\n checked: isSelected(),\n \"aria-required\": (isRequired && validationBehavior === \"aria\") || undefined,\n required: isRequired && validationBehavior === \"native\",\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n };\n}\n","/**\n * SSR utilities for Solidaria\n *\n * SolidJS has built-in SSR support with `isServer` and `createUniqueId()`.\n * These utilities provide a consistent API matching React-Aria's patterns\n * with additional features for hydration management.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n useContext,\n createUniqueId,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport interface SSRProviderProps extends ParentProps {}\n\nexport interface SSRContextValue {\n /** Whether currently rendering on the server. */\n isSSR: boolean;\n /** Prefix for generated IDs, allowing nested providers. */\n prefix: string;\n}\n\nconst SSRContext = createContext<SSRContextValue>({\n isSSR: isServer,\n prefix: \"\",\n});\n\n/**\n * Returns whether the component is currently being server side rendered.\n * Can be used to delay browser-specific rendering until after hydration.\n *\n * Note: This returns a static boolean. For reactive hydration detection,\n * use `createHydrationState()`.\n */\nexport function createIsSSR(): boolean {\n return isServer;\n}\n\n/**\n * Check if we can use DOM APIs.\n * This is useful for code that needs to run only in the browser.\n */\nexport const canUseDOM = !isServer;\n\n/**\n * Generate a unique ID that is stable across server and client.\n * Uses SolidJS's built-in createUniqueId which handles SSR correctly.\n *\n * @param defaultId - Optional default ID to use instead of generating one.\n *\n * @example\n * ```tsx\n * function TextField(props) {\n * const inputId = createId(props.id);\n * return (\n * <>\n * <label for={inputId}>{props.label}</label>\n * <input id={inputId} />\n * </>\n * );\n * }\n * ```\n */\nexport function createId(defaultId?: string): string {\n if (defaultId) {\n return defaultId;\n }\n const ctx = useContext(SSRContext);\n const uniqueId = createUniqueId();\n return ctx.prefix ? `solidaria-${ctx.prefix}-${uniqueId}` : `solidaria-${uniqueId}`;\n}\n\n/**\n * Provides SSR context to the component tree.\n *\n * While SolidJS handles most SSR scenarios automatically, this provider\n * can be useful for:\n * - Nested ID prefixes to avoid collisions in micro-frontends\n * - Explicit hydration boundary markers\n * - Testing SSR behavior\n *\n * @example\n * ```tsx\n * // Root of your app\n * <SSRProvider>\n * <App />\n * </SSRProvider>\n *\n * // With custom prefix for micro-frontend\n * <SSRProvider prefix=\"widget\">\n * <Widget />\n * </SSRProvider>\n * ```\n */\nexport function SSRProvider(props: SSRProviderProps & { prefix?: string }): JSX.Element {\n const parentContext = useContext(SSRContext);\n\n const value = createMemo<SSRContextValue>(() => ({\n isSSR: isServer,\n prefix: props.prefix\n ? parentContext.prefix\n ? `${parentContext.prefix}-${props.prefix}`\n : props.prefix\n : parentContext.prefix,\n }));\n\n return <SSRContext.Provider value={value()}>{props.children}</SSRContext.Provider>;\n}\n\n/**\n * Tracks whether the component is currently hydrating.\n *\n * During server-side rendering, this returns `true`. After hydration\n * completes on the client, it switches to `false`. This is useful for\n * components that need to show different content during hydration.\n *\n * @example\n * ```tsx\n * function ClientOnlyComponent() {\n * const isHydrating = createHydrationState();\n *\n * return (\n * <Show when={!isHydrating()} fallback={<LoadingPlaceholder />}>\n * <InteractiveWidget />\n * </Show>\n * );\n * }\n * ```\n */\nexport function createHydrationState(): Accessor<boolean> {\n // On the server, always return true\n if (isServer) {\n return () => true;\n }\n\n // On the client, track hydration state\n const [isHydrating, setIsHydrating] = createSignal(true);\n\n onMount(() => {\n setIsHydrating(false);\n });\n\n return isHydrating;\n}\n\n/**\n * Hook that returns `true` during SSR and initial hydration.\n * Use this to delay browser-specific code until hydration is complete.\n *\n * Unlike `createIsSSR()` which is static, this updates reactively\n * after hydration completes.\n *\n * @example\n * ```tsx\n * function BrowserOnlyFeature() {\n * const isSSR = useIsSSR();\n *\n * createEffect(() => {\n * if (!isSSR()) {\n * // Safe to access browser APIs here\n * window.localStorage.getItem('key');\n * }\n * });\n *\n * return <Show when={!isSSR()}>...</Show>;\n * }\n * ```\n */\nexport function useIsSSR(): Accessor<boolean> {\n return createHydrationState();\n}\n\n/**\n * Creates an effect that only runs on the client after hydration.\n * This is a convenience wrapper that ensures browser-specific code\n * doesn't run during SSR.\n *\n * @param fn - The effect function to run\n *\n * @example\n * ```tsx\n * function Analytics() {\n * createBrowserEffect(() => {\n * // Safe to access window, document, localStorage, etc.\n * window.analytics.track('page_view');\n * });\n *\n * return null;\n * }\n * ```\n */\nexport function createBrowserEffect(fn: () => void | (() => void)): void {\n if (isServer) {\n return;\n }\n\n createEffect(() => {\n const cleanup = fn();\n if (typeof cleanup === \"function\") {\n onCleanup(cleanup);\n }\n });\n}\n\n/**\n * Creates a value that is computed only on the client.\n * On the server, returns the fallback value.\n *\n * @param fn - Function to compute the value on the client\n * @param fallback - Value to return during SSR\n *\n * @example\n * ```tsx\n * function WindowSize() {\n * const width = createBrowserValue(\n * () => window.innerWidth,\n * 0\n * );\n *\n * return <span>Width: {width()}</span>;\n * }\n * ```\n */\nexport function createBrowserValue<T>(fn: () => T, fallback: T): Accessor<T> {\n if (isServer) {\n return () => fallback;\n }\n\n const [value, setValue] = createSignal<T>(fallback);\n\n onMount(() => {\n setValue(() => fn());\n });\n\n return value;\n}\n\n/**\n * Returns the window object if available, or undefined during SSR.\n * Useful for accessing browser globals safely.\n *\n * @example\n * ```tsx\n * const win = getWindow();\n * if (win) {\n * win.addEventListener('resize', handler);\n * }\n * ```\n */\nexport function getWindow(): Window | undefined {\n if (typeof window !== \"undefined\") {\n return window;\n }\n return undefined;\n}\n\n/**\n * Returns the document object if available, or undefined during SSR.\n * Useful for accessing document safely.\n *\n * @example\n * ```tsx\n * const doc = getDocument();\n * if (doc) {\n * doc.addEventListener('keydown', handler);\n * }\n * ```\n */\nexport function getDocument(): Document | undefined {\n if (typeof document !== \"undefined\") {\n return document;\n }\n return undefined;\n}\n\n/**\n * Returns the owner document of an element, with SSR safety.\n *\n * @param el - The element to get the owner document from\n */\nexport function getOwnerDocument(el: Element | null | undefined): Document | undefined {\n return el?.ownerDocument ?? getDocument();\n}\n\n/**\n * Returns the owner window of an element, with SSR safety.\n *\n * @param el - The element to get the owner window from\n */\nexport function getOwnerWindow(el: Element | null | undefined): Window | undefined {\n return getOwnerDocument(el)?.defaultView ?? getWindow();\n}\n\n/**\n * Gets the appropriate container for portals, with SSR safety.\n * Returns the specified container, or document.body on the client,\n * or undefined during SSR.\n *\n * @param container - Optional custom container element\n *\n * @example\n * ```tsx\n * function Modal(props) {\n * const container = getPortalContainer(props.container);\n *\n * return (\n * <Show when={container}>\n * <Portal mount={container}>\n * {props.children}\n * </Portal>\n * </Show>\n * );\n * }\n * ```\n */\nexport function getPortalContainer(container?: Element): Element | undefined {\n if (container) {\n return container;\n }\n return getDocument()?.body;\n}\n","/**\n * Labels utility for Solidaria\n *\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n *\n * This is a 1:1 port of @react-aria/utils's useLabels hook.\n */\n\nimport { createId } from \"../ssr\";\nimport type { AriaLabelingProps, DOMProps } from \"./createLabel\";\n\n/**\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n *\n * @param props - Aria label props.\n * @param defaultLabel - Default value for aria-label when not present.\n */\nexport function createLabels(\n props: DOMProps & AriaLabelingProps,\n defaultLabel?: string,\n): DOMProps & AriaLabelingProps {\n let { id, \"aria-label\": label, \"aria-labelledby\": labelledBy } = props;\n\n // Generate an ID if not provided\n id = createId(id);\n\n // If there is both an aria-label and aria-labelledby,\n // combine them by pointing to the element itself.\n if (labelledBy && label) {\n const ids = new Set([id, ...labelledBy.trim().split(/\\s+/)]);\n labelledBy = [...ids].join(\" \");\n } else if (labelledBy) {\n labelledBy = labelledBy.trim().split(/\\s+/).join(\" \");\n }\n\n // If no labels are provided, use the default\n if (!label && !labelledBy && defaultLabel) {\n label = defaultLabel;\n }\n\n return {\n id,\n \"aria-label\": label,\n \"aria-labelledby\": labelledBy,\n };\n}\n","/**\n * Label hook for Solidaria\n *\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n *\n * This is a 1:1 port of @react-aria/label's useLabel hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { createLabels } from \"./createLabels\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { isDevEnv } from \"../utils/env\";\n\nexport interface AriaLabelingProps {\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n \"aria-details\"?: string;\n}\n\nexport interface LabelableProps {\n /** The content to display as the label. */\n label?: JSX.Element;\n}\n\nexport interface DOMProps {\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: \"label\" | \"span\" | \"div\";\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement> | JSX.HTMLAttributes<HTMLSpanElement>;\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps;\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n *\n * @param props - The props for labels and fields.\n */\nexport function createLabel(props: MaybeAccessor<LabelAriaProps>): LabelAria {\n const getProps = () => access(props);\n\n const id = createId(getProps().id);\n const labelId = createId();\n\n const getLabelProps = (): LabelAria[\"labelProps\"] => {\n const { label, labelElementType = \"label\" } = getProps();\n\n if (!label) {\n return {};\n }\n\n return {\n id: labelId,\n ...(labelElementType === \"label\" ? { for: id } : {}),\n };\n };\n\n const getFieldProps = (): LabelAria[\"fieldProps\"] => {\n const { label, \"aria-labelledby\": ariaLabelledby, \"aria-label\": ariaLabel } = getProps();\n\n let labelledBy = ariaLabelledby;\n\n if (label) {\n labelledBy = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n } else if (!ariaLabelledby && !ariaLabel && isDevEnv()) {\n console.warn(\n \"If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility\",\n );\n }\n\n return createLabels({\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": labelledBy,\n });\n };\n\n return {\n get labelProps() {\n return getLabelProps();\n },\n get fieldProps() {\n return getFieldProps();\n },\n };\n}\n","/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport {\n createLabel,\n type LabelAriaProps,\n type LabelAria,\n type AriaLabelingProps,\n type DOMProps,\n} from \"./createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps\n extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, \"isRequired\"> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria[\"descriptionProps\"] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria[\"errorMessageProps\"] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()[\"aria-describedby\"];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n \"aria-describedby\": ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n","/**\n * Checkbox group hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckboxGroup hook.\n */\n\nimport { JSX, createEffect } from \"solid-js\";\nimport { createField } from \"../label\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport {\n type CheckboxGroupState,\n type CheckboxGroupProps,\n type ValidityState,\n} from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaCheckboxGroupProps extends CheckboxGroupProps {\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n \"aria-details\"?: string;\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element;\n}\n\nexport interface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group's visible label (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the checkbox group is invalid. */\n isInvalid: boolean;\n /** Validation errors, if any. */\n validationErrors: string[];\n /** Validation details, if any. */\n validationDetails: ValidityState;\n}\n\n// WeakMap to share data between checkbox group and checkbox group items\nexport const checkboxGroupData = new WeakMap<\n CheckboxGroupState,\n {\n name?: string;\n form?: string;\n descriptionId?: string;\n errorMessageId?: string;\n validationBehavior: \"aria\" | \"native\";\n }\n>();\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n *\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `createCheckboxGroupState`.\n */\nexport function createCheckboxGroup(\n props: MaybeAccessor<AriaCheckboxGroupProps>,\n state: CheckboxGroupState,\n): CheckboxGroupAria {\n const getProps = () => access(props);\n const displayValidation = () => state.displayValidation();\n const validationErrors = () => displayValidation().validationErrors;\n const validationDetails = () => displayValidation().validationDetails;\n\n const isInvalid = () => displayValidation().isInvalid;\n const fallbackErrorMessage = () => {\n const errors = validationErrors();\n return errors.length > 0 ? errors : undefined;\n };\n\n // Use field for label association\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return getProps()[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return getProps()[\"aria-details\"];\n },\n get description() {\n return getProps().description;\n },\n get errorMessage() {\n return getProps().errorMessage ?? fallbackErrorMessage();\n },\n get isInvalid() {\n return isInvalid();\n },\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: \"span\",\n });\n\n const updateCheckboxGroupData = () => {\n checkboxGroupData.set(state, {\n name: getProps().name,\n form: getProps().form,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior: getProps().validationBehavior ?? \"native\",\n });\n };\n\n // Store group metadata synchronously for first-render children, then keep it reactive.\n updateCheckboxGroupData();\n createEffect(updateCheckboxGroupData);\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n get onBlurWithin() {\n return getProps().onBlur;\n },\n get onFocusWithin() {\n return getProps().onFocus;\n },\n get onFocusWithinChange() {\n return getProps().onFocusChange;\n },\n });\n\n return {\n get groupProps() {\n return mergeProps(domProps(), {\n role: \"group\",\n \"aria-disabled\": state.isDisabled || undefined,\n ...fieldProps,\n ...focusWithinProps,\n }) as JSX.HTMLAttributes<HTMLElement>;\n },\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return descriptionProps;\n },\n get errorMessageProps() {\n return errorMessageProps;\n },\n get isInvalid() {\n return isInvalid();\n },\n get validationErrors() {\n return validationErrors();\n },\n get validationDetails() {\n return validationDetails();\n },\n };\n}\n","/**\n * Checkbox group item hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox component\n * contained within a checkbox group.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckboxGroupItem hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createCheckbox, type AriaCheckboxProps, type CheckboxAria } from \"./createCheckbox\";\nimport { type ToggleState, type CheckboxGroupState } from \"@proyecto-viviana/solid-stately\";\nimport { checkboxGroupData } from \"./createCheckboxGroup\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaCheckboxGroupItemProps extends Omit<\n AriaCheckboxProps,\n \"isSelected\" | \"defaultSelected\"\n> {\n /** The value of the checkbox. */\n value: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component\n * contained within a checkbox group.\n *\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox group, as returned by `createCheckboxGroupState`.\n * @param inputRef - A ref accessor for the HTML input element.\n */\nexport function createCheckboxGroupItem(\n props: MaybeAccessor<AriaCheckboxGroupItemProps>,\n state: CheckboxGroupState,\n inputRef: () => HTMLInputElement | null,\n): CheckboxAria {\n const getProps = () => access(props);\n\n // Create toggle state that syncs with the group state\n const toggleState: ToggleState = {\n isSelected: () => state.isSelected(getProps().value),\n defaultSelected: state.defaultValue.includes(getProps().value),\n setSelected(isSelected: boolean) {\n const value = getProps().value;\n if (isSelected) {\n state.addValue(value);\n } else {\n state.removeValue(value);\n }\n getProps().onChange?.(isSelected);\n },\n toggle() {\n state.toggleValue(getProps().value);\n },\n };\n\n const getGroupData = () => checkboxGroupData.get(state);\n\n const checkboxProps = (): AriaCheckboxProps => {\n const p = getProps();\n const groupData = getGroupData();\n\n return {\n ...p,\n isReadOnly: p.isReadOnly ?? state.isReadOnly,\n isDisabled: p.isDisabled ?? state.isDisabled,\n isInvalid: p.isInvalid ?? state.isInvalid,\n name: p.name ?? groupData?.name,\n form: p.form ?? groupData?.form,\n isRequired: p.isRequired ?? state.isRequired(),\n validationBehavior: p.validationBehavior ?? groupData?.validationBehavior ?? \"native\",\n };\n };\n\n const result = createCheckbox(checkboxProps, toggleState, inputRef);\n\n return {\n ...result,\n get inputProps() {\n const baseInputProps = result.inputProps;\n const groupData = getGroupData();\n\n const describedByIds: string[] = [];\n\n const propsDescribedBy = getProps()[\"aria-describedby\"];\n if (propsDescribedBy) {\n describedByIds.push(propsDescribedBy);\n }\n\n if (state.isInvalid && groupData?.errorMessageId) {\n describedByIds.push(groupData.errorMessageId);\n }\n\n if (groupData?.descriptionId) {\n describedByIds.push(groupData.descriptionId);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n\n return {\n ...baseInputProps,\n \"aria-describedby\": ariaDescribedBy,\n } as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n };\n}\n","/**\n * Radio group hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n *\n * This is a 1:1 port of @react-aria/radio's useRadioGroup hook.\n */\n\nimport { JSX } from \"solid-js\";\nimport { createField } from \"../label/createField\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { focusSafely, getEventTarget } from \"../utils\";\nimport { useLocale } from \"../i18n\";\nimport { createId } from \"../ssr\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { type RadioGroupState, type ValidityState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaRadioGroupProps {\n /** The content to display as the label. */\n label?: JSX.Element;\n /** A description for the radio group. Provides additional context. */\n description?: JSX.Element;\n /** An error message for the radio group. */\n errorMessage?:\n | JSX.Element\n | ((validation: { isInvalid: boolean; validationErrors: string[] }) => JSX.Element);\n /** Whether the radio group is disabled. */\n isDisabled?: boolean;\n /** Whether the radio group is read only. */\n isReadOnly?: boolean;\n /** Whether the radio group is required. */\n isRequired?: boolean;\n /** Whether the radio group is invalid. */\n isInvalid?: boolean;\n /** The axis the Radio Button(s) should align with. Defaults to 'vertical'. */\n orientation?: \"horizontal\" | \"vertical\";\n /** The name of the radio group, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the radio group with. */\n form?: string;\n /** Validation behavior for the radio group. */\n validationBehavior?: \"aria\" | \"native\";\n /** Handler that is called when the radio group receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide an error message for the object. */\n \"aria-errormessage\"?: string;\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the radio group's visible label (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the radio group description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the radio group error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the radio group is invalid. */\n isInvalid: boolean;\n /** Validation errors, if any. */\n validationErrors: string[];\n /** Validation details, if any. */\n validationDetails: ValidityState;\n}\n\n// WeakMap to share data between radio group and radio items\ninterface RadioGroupData {\n name: string;\n form: string | undefined;\n descriptionId: string | undefined;\n errorMessageId: string | undefined;\n validationBehavior: \"aria\" | \"native\";\n}\n\nexport const radioGroupData: WeakMap<RadioGroupState, RadioGroupData> = new WeakMap();\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n */\nexport function createRadioGroup(\n props: MaybeAccessor<AriaRadioGroupProps>,\n state: RadioGroupState,\n): RadioGroupAria {\n const getProps = () => access(props);\n const locale = useLocale();\n\n const orientation = () => getProps().orientation ?? \"vertical\";\n const isReadOnly = () => getProps().isReadOnly ?? false;\n const isRequired = () => getProps().isRequired ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const validationBehavior = () => getProps().validationBehavior ?? \"native\";\n const displayValidation = () => state.displayValidation();\n const validationErrors = () => displayValidation().validationErrors;\n const validationDetails = () => displayValidation().validationDetails;\n const isInvalid = () => displayValidation().isInvalid;\n const fallbackErrorMessage = () => {\n const errors = validationErrors();\n return errors.length > 0 ? errors : undefined;\n };\n\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({\n get id() {\n return getProps().id;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get description() {\n return getProps().description;\n },\n get errorMessage() {\n return getProps().errorMessage ?? fallbackErrorMessage();\n },\n get isInvalid() {\n return isInvalid();\n },\n // Radio group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: \"span\",\n });\n\n // Handle focus within - reset focusable radio when group loses focus and no selection\n const { focusWithinProps } = createFocusWithin({\n onBlurWithin(e: FocusEvent) {\n getProps().onBlur?.(e);\n if (!state.selectedValue()) {\n state.setLastFocusedValue(null);\n }\n },\n onFocusWithin: (e: FocusEvent) => getProps().onFocus?.(e),\n onFocusWithinChange: (isFocused: boolean) => getProps().onFocusChange?.(isFocused),\n });\n\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n const groupName = getProps().name ?? createId();\n\n radioGroupData.set(state, {\n name: groupName,\n form: getProps().form,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior: validationBehavior(),\n });\n\n const getNavigableRadios = (root: HTMLElement): HTMLInputElement[] => {\n return Array.from(root.querySelectorAll('input[type=\"radio\"]')).filter(\n (el): el is HTMLInputElement => {\n return el instanceof HTMLInputElement && !el.matches(\":disabled\");\n },\n );\n };\n\n // Keyboard navigation parity with React Aria.\n const onKeyDown: JSX.EventHandler<HTMLDivElement, KeyboardEvent> = (e) => {\n let nextDir: \"next\" | \"prev\" | null = null;\n const currentOrientation = orientation();\n const isHorizontal = currentOrientation !== \"vertical\";\n const isRTL = locale().direction === \"rtl\" && isHorizontal;\n\n switch (e.key) {\n case \"ArrowRight\":\n nextDir = isRTL ? \"prev\" : \"next\";\n break;\n case \"ArrowLeft\":\n nextDir = isRTL ? \"next\" : \"prev\";\n break;\n case \"ArrowDown\":\n nextDir = \"next\";\n break;\n case \"ArrowUp\":\n nextDir = \"prev\";\n break;\n default:\n return;\n }\n\n e.preventDefault();\n\n const root = e.currentTarget;\n if (!(root instanceof HTMLElement)) {\n return;\n }\n\n const radios = getNavigableRadios(root);\n if (radios.length === 0) {\n return;\n }\n\n const eventTarget = getEventTarget<Element>(e);\n const activeElement = root.ownerDocument.activeElement;\n\n const currentRadio =\n eventTarget instanceof HTMLInputElement && eventTarget.type === \"radio\"\n ? eventTarget\n : activeElement instanceof HTMLInputElement && activeElement.type === \"radio\"\n ? activeElement\n : null;\n\n const currentIndex = currentRadio ? radios.indexOf(currentRadio) : -1;\n\n let nextIndex: number;\n if (nextDir === \"next\") {\n nextIndex = currentIndex >= 0 ? (currentIndex + 1) % radios.length : 0;\n } else {\n nextIndex =\n currentIndex >= 0 ? (currentIndex - 1 + radios.length) % radios.length : radios.length - 1;\n }\n\n const nextRadio = radios[nextIndex];\n if (!nextRadio) {\n return;\n }\n\n focusSafely(nextRadio);\n state.setSelectedValue(nextRadio.value);\n };\n\n return {\n get radioGroupProps() {\n return mergeProps(domProps(), focusWithinProps as unknown as Record<string, unknown>, {\n role: \"radiogroup\",\n onKeyDown,\n \"aria-invalid\": isInvalid() || undefined,\n \"aria-errormessage\": getProps()[\"aria-errormessage\"],\n \"aria-readonly\": isReadOnly() || undefined,\n \"aria-required\": isRequired() || undefined,\n \"aria-disabled\": isDisabled() || undefined,\n \"aria-orientation\": orientation(),\n ...fieldProps,\n }) as JSX.HTMLAttributes<HTMLDivElement>;\n },\n labelProps: labelProps as JSX.HTMLAttributes<HTMLElement>,\n descriptionProps,\n errorMessageProps,\n get isInvalid() {\n return isInvalid();\n },\n get validationErrors() {\n return validationErrors();\n },\n get validationDetails() {\n return validationDetails();\n },\n };\n}\n","/**\n * Radio hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n *\n * This is a 1:1 port of @react-aria/radio's useRadio hook.\n */\n\nimport { JSX, Accessor, createEffect } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { isDevEnv } from \"../utils/env\";\nimport { type RadioGroupState, radioGroupSyncVersion } from \"@proyecto-viviana/solid-stately\";\nimport { radioGroupData } from \"./createRadioGroup\";\nimport { type PressEvent } from \"../interactions/PressEvent\";\n\nexport interface AriaRadioProps {\n /** The value of the radio button, used when submitting an HTML form. */\n value: string;\n /** Whether the radio button is disabled. */\n isDisabled?: boolean;\n /** The label for the radio button. */\n children?: JSX.Element;\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /** Handler that is called when a press is released over the target, regardless of whether it started on the target or not. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n}\n\nexport interface RadioAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the radio is disabled. */\n isDisabled: boolean;\n /** Whether the radio is currently selected. */\n isSelected: Accessor<boolean>;\n /** Whether the radio is in a pressed state. */\n isPressed: Accessor<boolean>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n */\nexport function createRadio(\n props: MaybeAccessor<AriaRadioProps>,\n state: RadioGroupState,\n ref: () => HTMLInputElement | null,\n): RadioAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled || state.isDisabled;\n const value = () => getProps().value;\n const isSelected: Accessor<boolean> = () => {\n const selected = state.selectedValue();\n const v = value();\n return selected === v;\n };\n\n createEffect(() => {\n const p = getProps();\n const hasChildren = p.children != null;\n const hasAriaLabel = p[\"aria-label\"] != null || p[\"aria-labelledby\"] != null;\n if (!hasChildren && !hasAriaLabel && isDevEnv()) {\n console.warn(\n \"If you do not provide children, you must specify an aria-label for accessibility\",\n );\n }\n });\n\n // SolidJS-specific: Sync DOM checked state whenever selection changes\n // This handles:\n // 1. Initial render with controlled value\n // 2. Controlled mode where parent doesn't update value after click\n // 3. Native radio group behavior (clicking one unchecks others)\n //\n // Unlike React's VDOM reconciliation that re-applies all props on every render,\n // SolidJS only updates when signals change. Native radio behavior can change\n // the DOM checked state without our knowledge, so we need to actively sync.\n //\n // We track `syncVersion` to ensure this effect runs on EVERY selection attempt,\n // even in controlled mode where isSelected() may not change.\n createEffect(() => {\n // The WeakMap accessor is outside the public API to maintain React Aria parity.\n const syncVersion = radioGroupSyncVersion.get(state);\n syncVersion?.();\n\n const shouldBeChecked = isSelected();\n const inputEl = ref();\n if (!inputEl) return;\n\n if (inputEl.checked !== shouldBeChecked) {\n inputEl.checked = shouldBeChecked;\n }\n });\n\n // SolidJS-specific: Unlike React, the input's `checked` state can get out of sync\n // with our reactive state. This happens because:\n // 1. A readonly `<input type=\"radio\" />` is always \"checkable\" in the browser\n // 2. Even controlled inputs (`<input checked={isChecked} />`) will change their\n // internal `checked` state when clicked, regardless of what the signal says\n //\n // To prevent this, we force the input's `checked` DOM property to match our state\n // after processing the change. This is the pattern used by Kobalte and other\n // SolidJS component libraries.\n const onChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n e.stopPropagation();\n\n const target = e.target as HTMLInputElement;\n\n // Guard against disabled state - JSDOM's fireEvent may bypass disabled check\n if (isDisabled()) {\n target.checked = isSelected();\n return;\n }\n\n state.setSelectedValue(value());\n\n // Focus the input when clicked\n // In real browsers this happens automatically, but JSDOM/fireEvent doesn't trigger it\n target.focus();\n\n // Force the DOM checked state to match our reactive state\n // This handles controlled mode where the parent might not update the value\n target.checked = isSelected();\n };\n\n // Handle press state for keyboard interactions and cases where labelProps is not used.\n const { pressProps, isPressed } = createPress({\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onPressChange() {\n return getProps().onPressChange;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressUp() {\n return getProps().onPressUp;\n },\n get onClick() {\n return getProps().onClick;\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const { pressProps: labelPressProps, isPressed: isLabelPressed } = createPress({\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onPressChange() {\n return getProps().onPressChange;\n },\n get onPressUp() {\n return getProps().onPressUp;\n },\n get onClick() {\n return getProps().onClick;\n },\n onPress(e: PressEvent) {\n getProps().onPress?.(e);\n state.setSelectedValue(value());\n ref()?.focus();\n },\n get isDisabled() {\n return isDisabled();\n },\n });\n\n const { focusableProps } = createFocusable(\n {\n get isDisabled() {\n return isDisabled();\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n onFocus(e: FocusEvent) {\n getProps().onFocus?.(e);\n state.setLastFocusedValue(value());\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n },\n ref as unknown as (el: HTMLElement) => void,\n );\n\n const interactions = mergeProps(pressProps, focusableProps);\n\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n const getTabIndex = (): number | undefined => {\n if (isDisabled()) {\n return undefined;\n }\n\n const selected = state.selectedValue();\n const lastFocused = state.lastFocusedValue();\n const currentValue = value();\n\n if (selected != null) {\n if (selected === currentValue) {\n return 0;\n }\n return -1;\n } else {\n if (lastFocused === currentValue || lastFocused == null) {\n return 0;\n }\n return -1;\n }\n };\n\n const getGroupData = () => radioGroupData.get(state);\n\n const combinedIsPressed: Accessor<boolean> = () => isPressed() || isLabelPressed();\n\n return {\n labelProps: mergeProps(labelPressProps, {\n onClick: (e: MouseEvent) => e.preventDefault(),\n onMouseDown: (e: MouseEvent) => e.preventDefault(),\n }),\n get inputProps() {\n const p = getProps();\n const groupData = getGroupData();\n\n const describedByIds: string[] = [];\n if (p[\"aria-describedby\"]) {\n describedByIds.push(p[\"aria-describedby\"]);\n }\n if (state.isInvalid && groupData?.errorMessageId) {\n describedByIds.push(groupData.errorMessageId);\n }\n if (groupData?.descriptionId) {\n describedByIds.push(groupData.descriptionId);\n }\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(\" \") : undefined;\n const validationBehavior = groupData?.validationBehavior ?? \"native\";\n\n return mergeProps(domProps(), interactions, {\n type: \"radio\" as const,\n name: groupData?.name,\n form: groupData?.form,\n tabIndex: getTabIndex(),\n disabled: isDisabled(),\n required: validationBehavior === \"native\" ? state.isRequired : undefined,\n checked: isSelected(),\n value: value(),\n onChange,\n \"aria-describedby\": ariaDescribedBy,\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isDisabled: isDisabled(),\n isSelected,\n isPressed: combinedIsPressed,\n };\n}\n","/**\n * Switch hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n *\n * This is a 1:1 port of @react-aria/switch's useSwitch hook.\n */\n\nimport { JSX, Accessor } from \"solid-js\";\nimport { createToggle, type AriaToggleProps } from \"../toggle/createToggle\";\nimport { type ToggleState } from \"@proyecto-viviana/solid-stately\";\nimport { type MaybeAccessor } from \"../utils/reactivity\";\n\nexport interface AriaSwitchProps extends AriaToggleProps {\n // Switch uses the same props as toggle\n}\n\nexport interface SwitchAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the switch is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the switch is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the switch is disabled. */\n isDisabled: boolean;\n /** Whether the switch is read only. */\n isReadOnly: boolean;\n /** Whether the switch is invalid. */\n isInvalid: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n */\nexport function createSwitch(\n props: MaybeAccessor<AriaSwitchProps>,\n state: ToggleState,\n ref: () => HTMLInputElement | null,\n): SwitchAria {\n // Don't destructure inputProps - it's a getter that needs to be evaluated each time\n const toggle = createToggle(props, state, ref);\n\n return {\n labelProps: toggle.labelProps,\n get inputProps() {\n // Access toggle.inputProps (the getter) each time to get fresh values\n const baseProps = toggle.inputProps;\n return {\n ...baseProps,\n role: \"switch\" as const,\n checked: toggle.isSelected(),\n };\n },\n isSelected: toggle.isSelected,\n isPressed: toggle.isPressed,\n isDisabled: toggle.isDisabled,\n isReadOnly: toggle.isReadOnly,\n isInvalid: toggle.isInvalid,\n };\n}\n","/**\n * Link hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n *\n * This is a 1:1 port of @react-aria/link's useLink hook.\n */\n\nimport { type Accessor } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport { type PressEvent } from \"../interactions/PressEvent\";\n\nexport interface AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean;\n /** The HTML element used to render the link, e.g. 'a', or 'span'. @default 'a' */\n elementType?: string;\n /** The URL to link to. */\n href?: string;\n /** Additional options forwarded to client-side router navigation handlers. */\n routerOptions?: Record<string, unknown>;\n /** The target window for the link. */\n target?: string;\n /** The relationship between the linked resource and the current page. */\n rel?: string;\n /** Hints the language of the linked resource. */\n hrefLang?: string;\n /** Instructs the browser to download the URL instead of navigating to it. */\n download?: string | boolean;\n /** Space-separated list of URLs to ping when following the link. */\n ping?: string;\n /** Referrer policy for fetches initiated by this link. */\n referrerPolicy?:\n | \"\"\n | \"no-referrer\"\n | \"no-referrer-when-downgrade\"\n | \"origin\"\n | \"origin-when-cross-origin\"\n | \"same-origin\"\n | \"strict-origin\"\n | \"strict-origin-when-cross-origin\"\n | \"unsafe-url\";\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when a press is released over the target. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler that is called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n /** Indicates the current \"page\" or state within a set of related elements. */\n \"aria-current\"?: \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | \"true\" | \"false\" | boolean;\n /** Defines a string value that labels the current element. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed description. */\n \"aria-details\"?: string;\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: Record<string, unknown>;\n /** Whether the link is currently pressed. */\n isPressed: Accessor<boolean>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function createLink(props: MaybeAccessor<AriaLinkProps> = {}): LinkAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? \"a\";\n\n // Create press handling\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onPressUp() {\n return getProps().onPressUp;\n },\n get onPressChange() {\n return getProps().onPressChange;\n },\n });\n\n // Create focusable handling\n const { focusableProps } = createFocusable({\n get isDisabled() {\n return isDisabled();\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n });\n\n // Build link props\n const getLinkProps = (): Record<string, unknown> => {\n const p = getProps();\n const elType = elementType();\n const disabled = isDisabled();\n\n let baseProps: Record<string, unknown> = {};\n\n // If not an <a>, add role and tabIndex\n if (elType !== \"a\") {\n baseProps = {\n role: \"link\",\n tabIndex: disabled ? undefined : 0,\n };\n }\n\n // ARIA attributes\n const ariaProps: Record<string, unknown> = {\n \"aria-disabled\": disabled || undefined,\n };\n\n if (p[\"aria-current\"] !== undefined) {\n ariaProps[\"aria-current\"] = p[\"aria-current\"];\n }\n if (p[\"aria-label\"]) {\n ariaProps[\"aria-label\"] = p[\"aria-label\"];\n }\n if (p[\"aria-labelledby\"]) {\n ariaProps[\"aria-labelledby\"] = p[\"aria-labelledby\"];\n }\n if (p[\"aria-describedby\"]) {\n ariaProps[\"aria-describedby\"] = p[\"aria-describedby\"];\n }\n if (p[\"aria-details\"]) {\n ariaProps[\"aria-details\"] = p[\"aria-details\"];\n }\n\n // Handle onClick - prevent default navigation when appropriate\n const onClick = (e: MouseEvent) => {\n // If disabled, prevent navigation and don't call user's onClick\n if (disabled) {\n e.preventDefault();\n return;\n }\n\n // If onPress is provided, prevent default navigation\n // This allows onPress to handle the action (e.g., client-side routing)\n if (p.onPress) {\n e.preventDefault();\n }\n\n // Call user's onClick if provided\n p.onClick?.(e);\n };\n\n return mergeProps(\n filterDOMProps(p as Record<string, unknown>, {\n labelable: true,\n isLink: elType === \"a\",\n }),\n baseProps,\n ariaProps,\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>,\n { onClick },\n );\n };\n\n return {\n get linkProps() {\n return getLinkProps();\n },\n isPressed,\n };\n}\n","/**\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","/**\n * ProgressBar hook for Solidaria\n *\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n *\n * This is a 1:1 port of @react-aria/progress's useProgressBar hook.\n */\n\nimport { createLabel } from \"../label/createLabel\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaProgressBarProps {\n /** The element id. */\n id?: string;\n /** The current value (controlled). */\n value?: number;\n /** The smallest value allowed for the input. @default 0 */\n minValue?: number;\n /** The largest value allowed for the input. @default 100 */\n maxValue?: number;\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: string;\n /** Whether presentation is indeterminate when progress isn't known. */\n isIndeterminate?: boolean;\n /** The display format of the value label. */\n formatOptions?: Intl.NumberFormatOptions;\n /** The content to display as the label. */\n label?: string;\n /** An accessibility label for this item. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n \"aria-details\"?: string;\n}\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: Record<string, unknown>;\n /** Props for the progress bar's visual label element (if any). */\n labelProps: Record<string, unknown>;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction getSafeRange(min: number, max: number): number {\n const range = max - min;\n return Number.isFinite(range) && range > 0 ? range : 1;\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function createProgressBar(\n props: MaybeAccessor<AriaProgressBarProps> = {},\n): ProgressBarAria {\n const getProps = () => access(props);\n\n // Create label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return getProps().id;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: \"span\",\n });\n\n // Build progress bar props\n const getProgressBarProps = (): Record<string, unknown> => {\n const p = getProps();\n const value = p.value ?? 0;\n const minValue = p.minValue ?? 0;\n const maxValue = p.maxValue ?? 100;\n const isIndeterminate = p.isIndeterminate ?? false;\n const formatOptions = p.formatOptions ?? { style: \"percent\" as const };\n\n const clampedValue = clamp(value, minValue, maxValue);\n const percentage = (clampedValue - minValue) / getSafeRange(minValue, maxValue);\n\n // Format value label\n let valueLabel = p.valueLabel;\n if (!isIndeterminate && !valueLabel) {\n const valueToFormat = formatOptions.style === \"percent\" ? percentage : clampedValue;\n try {\n const formatter = new Intl.NumberFormat(undefined, formatOptions);\n valueLabel = formatter.format(valueToFormat);\n } catch {\n // Fallback if formatting fails\n valueLabel = `${Math.round(percentage * 100)}%`;\n }\n }\n\n const domProps = filterDOMProps(p as Record<string, unknown>, { labelable: true });\n\n return mergeProps(domProps, fieldProps as Record<string, unknown>, {\n \"aria-valuenow\": isIndeterminate ? undefined : clampedValue,\n \"aria-valuemin\": minValue,\n \"aria-valuemax\": maxValue,\n \"aria-valuetext\": isIndeterminate ? undefined : valueLabel,\n role: \"progressbar\",\n });\n };\n\n return {\n get progressBarProps() {\n return getProgressBarProps();\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n };\n}\n","/**\n * createSeparator - SolidJS implementation of React Aria's useSeparator\n *\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\n\nimport type { JSX } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils\";\nimport { filterDOMProps } from \"../utils\";\n\nexport type Orientation = \"horizontal\" | \"vertical\";\n\nexport interface AriaSeparatorProps {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * The HTML element type that will be used to render the separator.\n * @default 'hr'\n */\n elementType?: string;\n /** An accessibility label for the separator. */\n \"aria-label\"?: string;\n /** Identifies the element(s) that labels the separator. */\n \"aria-labelledby\"?: string;\n /** Identifies the element(s) that describes the separator. */\n \"aria-describedby\"?: string;\n /** Identifies the element(s) that provide a detailed description. */\n \"aria-details\"?: string;\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface SeparatorAria {\n /** Props for the separator element. */\n separatorProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for a separator.\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\nexport function createSeparator(props: MaybeAccessor<AriaSeparatorProps> = {}): SeparatorAria {\n const getSeparatorProps = (): JSX.HTMLAttributes<HTMLElement> => {\n const p = access(props);\n const domProps = filterDOMProps(p as Record<string, unknown>, { labelable: true });\n\n // if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined\n // if it's vertical, we need to specify it\n let ariaOrientation: \"vertical\" | undefined;\n if (p.orientation === \"vertical\") {\n ariaOrientation = \"vertical\";\n }\n\n if (p.elementType !== \"hr\") {\n return {\n ...domProps,\n role: \"separator\",\n \"aria-orientation\": ariaOrientation,\n };\n }\n\n return {\n ...domProps,\n };\n };\n\n return {\n get separatorProps() {\n return getSeparatorProps();\n },\n };\n}\n","/**\n * createAutocomplete - Accessibility hook for autocomplete components\n *\n * Provides keyboard navigation, virtual focus via aria-activedescendant,\n * and filtering capabilities for autocomplete inputs.\n *\n * Based on @react-aria/autocomplete useAutocomplete.\n */\n\nimport { createSignal, createEffect, onCleanup, type Accessor } from \"solid-js\";\nimport { createId, getOwnerDocument } from \"../ssr\";\nimport { type AutocompleteState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface CollectionOptions {\n /** The id of the collection element. */\n id?: string;\n /** Accessible label for the collection. */\n \"aria-label\"?: string;\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean;\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean;\n}\n\nexport interface AutocompleteInputProps {\n /** Current input value. */\n value: Accessor<string>;\n /** Handler for input value changes. */\n onChange: (value: string) => void;\n /** Handler for key events. */\n onKeyDown: (e: KeyboardEvent) => void;\n /** Handler for focus events. */\n onFocus: (e: FocusEvent) => void;\n /** Handler for blur events. */\n onBlur: (e: FocusEvent) => void;\n /** The id of the currently focused item for aria-activedescendant. */\n \"aria-activedescendant\": Accessor<string | undefined>;\n /** The id of the controlled collection. */\n \"aria-controls\": string;\n /** Autocomplete type. */\n \"aria-autocomplete\": \"list\" | \"none\" | \"inline\" | \"both\";\n /** Enter key hint for mobile keyboards. */\n enterKeyHint: \"go\";\n /** Disable autocorrect. */\n autoCorrect: \"off\";\n /** Disable spell check. */\n spellCheck: \"false\";\n /** Disable browser autocomplete. */\n autoComplete: \"off\";\n}\n\nexport interface AriaAutocompleteOptions<_T = unknown> {\n /** Ref accessor for the input element. */\n inputRef: Accessor<HTMLInputElement | undefined>;\n /** Ref accessor for the collection element. */\n collectionRef: Accessor<HTMLElement | undefined>;\n /** Optional id override for the controlled collection element. */\n collectionId?: string;\n /** Optional accessible name for the controlled collection element. */\n collectionAriaLabel?: string;\n /**\n * An optional filter function used to determine if an option should be included.\n * @param textValue - The text value of the item\n * @param inputValue - The current input value\n */\n filter?: (textValue: string, inputValue: string) => boolean;\n /**\n * Whether to focus the first item after filtering.\n * @default false\n */\n disableAutoFocusFirst?: boolean;\n /**\n * Whether to disable virtual focus (aria-activedescendant).\n * @default false\n */\n disableVirtualFocus?: boolean;\n}\n\nexport interface AutocompleteAria<_T = unknown> {\n /** Props for the autocomplete input element. */\n inputProps: AutocompleteInputProps;\n /** Props for the collection (ListBox/Menu). */\n collectionProps: CollectionOptions;\n /** A filter function that returns if the item should be shown. */\n filter?: (textValue: string) => boolean;\n}\n\nfunction toKeyboardEventInit(e: KeyboardEvent): KeyboardEventInit {\n return {\n key: e.key,\n code: e.code,\n location: e.location,\n repeat: e.repeat,\n isComposing: e.isComposing,\n ctrlKey: e.ctrlKey,\n shiftKey: e.shiftKey,\n altKey: e.altKey,\n metaKey: e.metaKey,\n bubbles: e.bubbles,\n cancelable: e.cancelable,\n };\n}\n\n// Custom event names for collection communication\nexport const AUTOCOMPLETE_FOCUS_EVENT = \"autocomplete:focus\";\nexport const AUTOCOMPLETE_CLEAR_FOCUS_EVENT = \"autocomplete:clearfocus\";\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component.\n * An autocomplete combines a text input with a collection, allowing users to filter\n * the collection's contents to match a query.\n *\n * @example\n * ```tsx\n * const state = createAutocompleteState({ defaultInputValue: '' });\n * let inputRef, collectionRef;\n *\n * const { inputProps, collectionProps, filter } = createAutocomplete({\n * inputRef: () => inputRef,\n * collectionRef: () => collectionRef,\n * filter: (textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase()),\n * }, state);\n *\n * return (\n * <div>\n * <input ref={inputRef} {...inputProps} />\n * <ul ref={collectionRef} {...collectionProps}>\n * {items.filter(item => filter?.(item.name) ?? true).map(item => (\n * <li key={item.id}>{item.name}</li>\n * ))}\n * </ul>\n * </div>\n * );\n * ```\n */\nexport function createAutocomplete<T = unknown>(\n props: AriaAutocompleteOptions<T>,\n state: AutocompleteState,\n): AutocompleteAria<T> {\n const {\n inputRef,\n collectionRef,\n filter,\n collectionId: collectionIdProp,\n collectionAriaLabel,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false,\n } = props;\n\n const collectionId = collectionIdProp ?? createId();\n const [shouldUseVirtualFocus] = createSignal(!disableVirtualFocus);\n let lastInputType = \"\";\n\n // Track the input type for determining focus behavior\n const handleInput = (e: Event) => {\n const inputEvent = e as InputEvent;\n lastInputType = inputEvent.inputType || \"\";\n };\n\n // Set up input event listener\n createEffect(() => {\n const input = inputRef();\n if (input) {\n input.addEventListener(\"input\", handleInput);\n onCleanup(() => {\n input.removeEventListener(\"input\", handleInput);\n });\n }\n });\n\n // Focus first item in collection\n const focusFirstItem = () => {\n const collection = collectionRef();\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { focusStrategy: \"first\" },\n }),\n );\n }\n };\n\n // Clear virtual focus\n const clearVirtualFocus = (clearFocusKey = false) => {\n state.setFocusedNodeId(null);\n const collection = collectionRef();\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { clearFocusKey },\n }),\n );\n }\n };\n\n // Handle input value changes\n const onChange = (value: string) => {\n // Focus first item when typing forward, clear when backspacing/pasting\n if (lastInputType === \"insertText\" && !disableAutoFocusFirst) {\n focusFirstItem();\n } else if (\n lastInputType &&\n (lastInputType.includes(\"insert\") ||\n lastInputType.includes(\"delete\") ||\n lastInputType.includes(\"history\"))\n ) {\n clearVirtualFocus(true);\n }\n\n state.setInputValue(value);\n };\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n if (\"isComposing\" in e && e.isComposing) {\n return;\n }\n\n const focusedNodeId = state.focusedNodeId();\n const collection = collectionRef();\n const ownerDocument = getOwnerDocument(inputRef() ?? collection);\n\n switch (e.key) {\n case \"Escape\":\n // Let the input handle Escape (e.g., clear value)\n if (e.defaultPrevented) {\n return;\n }\n break;\n\n case \" \":\n // Space shouldn't trigger item action\n return;\n\n case \"Tab\":\n // Let Tab propagate normally for focus management\n return;\n\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"Home\":\n case \"End\":\n case \"PageUp\":\n case \"PageDown\": {\n // Prevent cursor movement in input\n e.preventDefault();\n\n // Dispatch focus event to collection\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n }),\n );\n }\n break;\n }\n\n case \"ArrowLeft\":\n case \"ArrowRight\":\n // Clear activedescendant so screen reader announces cursor movement\n clearVirtualFocus();\n return;\n\n case \"Enter\":\n // Trigger click on focused item\n if (focusedNodeId) {\n const item = ownerDocument?.getElementById(focusedNodeId);\n if (item) {\n item.click();\n e.preventDefault();\n }\n }\n return;\n }\n\n // Forward keyboard events to collection/focused item\n if (!e.defaultPrevented && collection) {\n e.stopPropagation();\n\n if (focusedNodeId) {\n const item = ownerDocument?.getElementById(focusedNodeId);\n if (item) {\n item.dispatchEvent(new KeyboardEvent(e.type, toKeyboardEventInit(e)));\n }\n } else {\n collection.dispatchEvent(new KeyboardEvent(e.type, toKeyboardEventInit(e)));\n }\n }\n };\n\n // Handle focus events\n const onFocus = (e: FocusEvent) => {\n if (!e.isTrusted) return;\n\n // Restore virtual focus when refocusing input\n const focusedNodeId = state.focusedNodeId();\n if (focusedNodeId) {\n const item = document.getElementById(focusedNodeId);\n if (item) {\n // Item still exists, keep focus on it\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (!e.isTrusted) return;\n // Virtual focus blur handling would go here\n };\n\n // Create filter function\n const filterFn = filter\n ? (textValue: string) => filter(textValue, state.inputValue())\n : undefined;\n\n return {\n inputProps: {\n value: state.inputValue,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n get \"aria-activedescendant\"() {\n return () => (shouldUseVirtualFocus() ? (state.focusedNodeId() ?? undefined) : undefined);\n },\n \"aria-controls\": collectionId,\n \"aria-autocomplete\": \"list\",\n enterKeyHint: \"go\",\n autoCorrect: \"off\",\n spellCheck: \"false\",\n autoComplete: \"off\",\n },\n collectionProps: {\n id: collectionId,\n \"aria-label\": collectionAriaLabel,\n shouldUseVirtualFocus: shouldUseVirtualFocus(),\n disallowTypeAhead: shouldUseVirtualFocus(),\n },\n filter: filterFn,\n };\n}\n","/**\n * Prevents scrolling on the document body while mounted.\n * Based on @react-aria/overlays usePreventScroll.\n */\n\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { isIOS, getScrollParent, isScrollable, willOpenKeyboard, chain } from \"../utils\";\n\nexport interface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== \"undefined\" && window.visualViewport;\n\n// The number of active createPreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore: (() => void) | undefined;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function createPreventScroll(options: PreventScrollOptions = {}): void {\n createEffect(() => {\n const isDisabled = options.isDisabled;\n\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n onCleanup(() => {\n preventScrollCount--;\n if (preventScrollCount === 0 && restore) {\n restore();\n restore = undefined;\n }\n });\n });\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard(): () => void {\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n const restoreFns: Array<() => void> = [];\n\n if (scrollbarWidth > 0) {\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n if (\"scrollbarGutter\" in document.documentElement.style) {\n restoreFns.push(setStyle(document.documentElement, \"scrollbarGutter\", \"stable\"));\n } else {\n restoreFns.push(setStyle(document.documentElement, \"paddingRight\", `${scrollbarWidth}px`));\n }\n }\n\n restoreFns.push(setStyle(document.documentElement, \"overflow\", \"hidden\"));\n\n return () => {\n restoreFns.forEach((fn) => fn());\n };\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari(): () => void {\n let scrollable: Element;\n let allowTouchMove = false;\n\n const onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n const target = e.target as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n const selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n \"selectionStart\" in target &&\n \"selectionEnd\" in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n const style = document.createElement(\"style\");\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n const onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (\n scrollable.scrollHeight === scrollable.clientHeight &&\n scrollable.scrollWidth === scrollable.clientWidth\n ) {\n e.preventDefault();\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const target = e.target as HTMLElement;\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({ preventScroll: true });\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n const focusable = target.parentElement?.closest(\"[tabindex]\") as HTMLElement | null;\n focusable?.focus({ preventScroll: true });\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n const focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n const wasKeyboardVisible =\n document.activeElement != null && willOpenKeyboard(document.activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, { ...opts, preventScroll: true });\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n const removeEvents = chain(\n addEvent(document, \"touchstart\", onTouchStart, { passive: false, capture: true }),\n addEvent(document, \"touchmove\", onTouchMove, { passive: false, capture: true }),\n addEvent(document, \"blur\", onBlur, true),\n );\n\n return () => {\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, styleName: string, value: string): () => void {\n const cur =\n element.style.getPropertyValue(styleName) ||\n (element.style as unknown as Record<string, string>)[styleName];\n (element.style as unknown as Record<string, string>)[styleName] = value;\n\n return () => {\n (element.style as unknown as Record<string, string>)[styleName] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n): () => void {\n target.addEventListener(event, handler as EventListener, options);\n return () => {\n target.removeEventListener(event, handler as EventListener, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean): void {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener(\"resize\", () => scrollIntoView(target), { once: true });\n }\n}\n\nfunction scrollIntoView(target: Element): void {\n const root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n const scrollableParent = getScrollParent(nextTarget);\n if (\n scrollableParent !== document.documentElement &&\n scrollableParent !== document.body &&\n scrollableParent !== nextTarget\n ) {\n const scrollableRect = scrollableParent.getBoundingClientRect();\n const targetRect = nextTarget.getBoundingClientRect();\n if (\n targetRect.top < scrollableRect.top ||\n targetRect.bottom > scrollableRect.top + nextTarget.clientHeight\n ) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n const adjustment =\n targetRect.top -\n scrollableRect.top -\n ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollableParent.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(\n 0,\n Math.min(\n scrollableParent.scrollHeight - scrollableParent.clientHeight,\n scrollableParent.scrollTop + adjustment,\n ),\n ),\n behavior: \"smooth\",\n });\n }\n }\n\n nextTarget = scrollableParent.parentElement;\n }\n}\n","/**\n * Handles the behavior and accessibility for an overlay trigger.\n * Based on @react-aria/overlays useOverlayTrigger.\n */\n\nimport { createEffect } from \"solid-js\";\nimport type { OverlayTriggerState } from \"@proyecto-viviana/solid-stately\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils\";\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: \"dialog\" | \"menu\" | \"listbox\" | \"tree\" | \"grid\";\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: {\n \"aria-haspopup\"?: boolean | \"listbox\";\n \"aria-expanded\": boolean;\n \"aria-controls\"?: string;\n onPress: () => void;\n };\n /** Props for the overlay container element. */\n overlayProps: {\n id: string;\n };\n}\n\n// Map for storing close functions, used by useCloseOnScroll\nexport const onCloseMap = new WeakMap<Element, () => void>();\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function createOverlayTrigger(\n props: MaybeAccessor<OverlayTriggerProps>,\n state: OverlayTriggerState,\n ref?: () => Element | null,\n): OverlayTriggerAria {\n const propsAccessor = () => access(props);\n const overlayId = createId();\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n createEffect(() => {\n const element = ref?.();\n if (element) {\n onCloseMap.set(element, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n const getAriaHasPopup = (): boolean | \"listbox\" | undefined => {\n const type = propsAccessor().type;\n if (type === \"menu\") {\n return true;\n } else if (type === \"listbox\") {\n return \"listbox\";\n }\n return undefined;\n };\n\n return {\n triggerProps: {\n get \"aria-haspopup\"() {\n return getAriaHasPopup();\n },\n get \"aria-expanded\"() {\n return state.isOpen();\n },\n get \"aria-controls\"() {\n return state.isOpen() ? overlayId : undefined;\n },\n onPress: state.toggle,\n },\n overlayProps: {\n id: overlayId,\n },\n };\n}\n","/**\n * Detects interactions outside a given element.\n * Based on @react-aria/interactions useInteractOutside.\n */\n\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { getOwnerDocument } from \"../utils\";\n\nexport interface InteractOutsideProps {\n /** Reference to the element to detect interactions outside of. */\n ref: () => Element | null;\n /** Handler called when an interaction outside the element completes. */\n onInteractOutside?: (e: PointerEvent) => void;\n /** Handler called when an interaction outside the element starts. */\n onInteractOutsideStart?: (e: PointerEvent) => void;\n /** Whether the interact outside events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Detects interactions outside a given element, used in components like\n * Dialogs and Popovers so they can close when a user clicks outside them.\n */\nexport function createInteractOutside(props: InteractOutsideProps): void {\n let isPointerDown = false;\n let ignoreEmulatedMouseEvents = false;\n\n createEffect(() => {\n const { ref, onInteractOutside, onInteractOutsideStart, isDisabled } = props;\n\n if (isDisabled) {\n return;\n }\n\n const element = ref();\n const documentObject = getOwnerDocument(element);\n\n const onPointerDown = (e: PointerEvent) => {\n if (onInteractOutside && isValidEvent(e, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e);\n }\n isPointerDown = true;\n }\n };\n\n const triggerInteractOutside = (e: PointerEvent) => {\n if (onInteractOutside) {\n onInteractOutside(e);\n }\n };\n\n // Use pointer events if available. Otherwise, fall back to mouse and touch events.\n if (typeof PointerEvent !== \"undefined\") {\n const onClick = (e: PointerEvent) => {\n if (isPointerDown && isValidEvent(e, ref)) {\n triggerInteractOutside(e);\n }\n isPointerDown = false;\n };\n\n // Use click instead of pointerup to avoid Android Chrome issue\n // https://issues.chromium.org/issues/40732224\n documentObject.addEventListener(\"pointerdown\", onPointerDown as EventListener, true);\n documentObject.addEventListener(\"click\", onClick as EventListener, true);\n\n onCleanup(() => {\n documentObject.removeEventListener(\"pointerdown\", onPointerDown as EventListener, true);\n documentObject.removeEventListener(\"click\", onClick as EventListener, true);\n });\n } else {\n // Fallback for environments without PointerEvent (mainly tests)\n const onMouseUp = (e: MouseEvent) => {\n if (ignoreEmulatedMouseEvents) {\n ignoreEmulatedMouseEvents = false;\n } else if (isPointerDown && isValidEvent(e as unknown as PointerEvent, ref)) {\n triggerInteractOutside(e as unknown as PointerEvent);\n }\n isPointerDown = false;\n };\n\n const onTouchEnd = (e: TouchEvent) => {\n ignoreEmulatedMouseEvents = true;\n if (isPointerDown && isValidEvent(e as unknown as PointerEvent, ref)) {\n triggerInteractOutside(e as unknown as PointerEvent);\n }\n isPointerDown = false;\n };\n\n const onMouseDown = (e: MouseEvent) => {\n if (onInteractOutside && isValidEvent(e as unknown as PointerEvent, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e as unknown as PointerEvent);\n }\n isPointerDown = true;\n }\n };\n\n const onTouchStart = (e: TouchEvent) => {\n if (onInteractOutside && isValidEvent(e as unknown as PointerEvent, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e as unknown as PointerEvent);\n }\n isPointerDown = true;\n }\n };\n\n documentObject.addEventListener(\"mousedown\", onMouseDown as EventListener, true);\n documentObject.addEventListener(\"mouseup\", onMouseUp as EventListener, true);\n documentObject.addEventListener(\"touchstart\", onTouchStart as EventListener, true);\n documentObject.addEventListener(\"touchend\", onTouchEnd as EventListener, true);\n\n onCleanup(() => {\n documentObject.removeEventListener(\"mousedown\", onMouseDown as EventListener, true);\n documentObject.removeEventListener(\"mouseup\", onMouseUp as EventListener, true);\n documentObject.removeEventListener(\"touchstart\", onTouchStart as EventListener, true);\n documentObject.removeEventListener(\"touchend\", onTouchEnd as EventListener, true);\n });\n }\n });\n}\n\nfunction isValidEvent(\n event: PointerEvent | MouseEvent | TouchEvent,\n ref: () => Element | null,\n): boolean {\n // Only handle primary button clicks\n if (\"button\" in event && event.button > 0) {\n return false;\n }\n\n if (event.target) {\n // If the event target is no longer in the document, ignore\n const ownerDocument = (event.target as Element).ownerDocument;\n if (!ownerDocument || !ownerDocument.documentElement.contains(event.target as Node)) {\n return false;\n }\n // If the target is within a top layer element (e.g. toasts), ignore\n if ((event.target as Element).closest?.(\"[data-solidaria-top-layer]\")) {\n return false;\n }\n }\n\n const element = ref();\n if (!element) {\n return false;\n }\n\n // When the event source is inside a Shadow DOM, event.target is just the shadow root.\n // Using event.composedPath instead means we can get the actual element inside the shadow root.\n return !event.composedPath().includes(element);\n}\n","/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Based on @react-aria/overlays useOverlay.\n */\n\nimport { createEffect, onCleanup, type JSX } from \"solid-js\";\nimport { createInteractOutside } from \"./createInteractOutside\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { getOwnerDocument, nodeContains } from \"../utils\";\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: () => void;\n /**\n * Whether to close the overlay when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean;\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean;\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to apply to the underlay element, if any. */\n underlayProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Stack of visible overlays, used to ensure only topmost overlay closes\nconst visibleOverlays: Array<() => Element | null> = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function createOverlay(props: AriaOverlayProps, ref: () => Element | null): OverlayAria {\n const onClose = () => props.onClose;\n const shouldCloseOnBlur = () => props.shouldCloseOnBlur;\n const isOpen = () => props.isOpen ?? false;\n const isDismissable = () => props.isDismissable ?? false;\n const isKeyboardDismissDisabled = () => props.isKeyboardDismissDisabled ?? false;\n const shouldCloseOnInteractOutside = () => props.shouldCloseOnInteractOutside;\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n createEffect(() => {\n if (isOpen() && !visibleOverlays.includes(ref)) {\n visibleOverlays.push(ref);\n }\n\n onCleanup(() => {\n const index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n });\n });\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n const onHide = () => {\n const close = onClose();\n if (visibleOverlays[visibleOverlays.length - 1] === ref && close) {\n close();\n }\n };\n\n const onInteractOutsideStart = (e: PointerEvent) => {\n const shouldClose = shouldCloseOnInteractOutside();\n if (!shouldClose || shouldClose(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n };\n\n const onInteractOutside = (e: PointerEvent) => {\n const shouldClose = shouldCloseOnInteractOutside();\n if (!shouldClose || shouldClose(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n onHide();\n }\n };\n\n // Handle clicking outside the overlay to close it.\n createEffect(() => {\n if (!isDismissable() || !isOpen()) {\n return;\n }\n\n createInteractOutside({\n ref,\n onInteractOutside,\n onInteractOutsideStart,\n isDisabled: false,\n });\n });\n\n createEffect(() => {\n if (!isOpen() || !shouldCloseOnBlur()) {\n return;\n }\n\n const overlay = ref();\n if (!overlay) {\n return;\n }\n\n const ownerDocument = getOwnerDocument(overlay);\n const onFocusIn = (event: FocusEvent) => {\n if (!isOpen()) {\n return;\n }\n\n const currentOverlay = ref();\n const target = event.target as Element | null;\n if (!currentOverlay || !target || nodeContains(currentOverlay, target)) {\n return;\n }\n\n const shouldClose = shouldCloseOnInteractOutside();\n if (!shouldClose || shouldClose(target)) {\n onHide();\n }\n };\n\n ownerDocument.addEventListener(\"focusin\", onFocusIn, true);\n onCleanup(() => ownerDocument.removeEventListener(\"focusin\", onFocusIn, true));\n });\n\n // Handle focus within for blur detection\n const { focusWithinProps } = createFocusWithin({\n get isDisabled() {\n return !shouldCloseOnBlur();\n },\n onBlurWithin: (e) => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a browser bug.\n // Clicking on the body to close the overlay should already be handled by createInteractOutside.\n if (!e.relatedTarget) {\n return;\n }\n\n const shouldClose = shouldCloseOnInteractOutside();\n if (!shouldClose || shouldClose(e.relatedTarget as Element)) {\n onClose()?.();\n }\n },\n });\n\n // Handle the escape key\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (e.key === \"Escape\" && !isKeyboardDismissDisabled() && !e.isComposing) {\n e.stopPropagation();\n e.preventDefault();\n onHide();\n }\n };\n\n const onPointerDownUnderlay: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n // Fixes a Firefox issue that starts text selection\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1675846\n if (e.target === e.currentTarget) {\n e.preventDefault();\n }\n };\n\n return {\n overlayProps: {\n onKeyDown,\n ...focusWithinProps,\n },\n underlayProps: {\n onPointerDown: onPointerDownUnderlay,\n },\n };\n}\n","/**\n * Hides all elements in the DOM outside the given targets from screen readers.\n * Based on @react-aria/overlays ariaHideOutside.\n */\n\nimport { getOwnerWindow } from \"../utils\";\n\nconst supportsInert = typeof HTMLElement !== \"undefined\" && \"inert\" in HTMLElement.prototype;\n\nexport interface AriaHideOutsideOptions {\n /** The root element to start hiding from. */\n root?: Element;\n /** Whether to use the `inert` attribute instead of `aria-hidden`. */\n shouldUseInert?: boolean;\n}\n\n// Keeps a ref count of all hidden elements. Added to when hiding an element, and\n// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.\nconst refCountMap = new WeakMap<Element, number>();\n\ninterface ObserverWrapper {\n visibleNodes: Set<Element>;\n hiddenNodes: Set<Element>;\n observe: () => void;\n disconnect: () => void;\n}\n\nconst observerStack: ObserverWrapper[] = [];\n\n/**\n * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,\n * and returns a function to revert these changes. In addition, changes to the DOM are watched\n * and new elements outside the targets are automatically hidden.\n * @param targets - The elements that should remain visible.\n * @param options - Options for hiding behavior.\n * @returns - A function to restore all hidden elements.\n */\nexport function ariaHideOutside(\n targets: Element[],\n options?: AriaHideOutsideOptions | Element,\n): () => void {\n const windowObj = getOwnerWindow(targets?.[0]);\n const opts = options instanceof windowObj.Element ? { root: options } : options;\n const root = opts?.root ?? document.body;\n const shouldUseInert = opts?.shouldUseInert && supportsInert;\n const visibleNodes = new Set<Element>(targets);\n const hiddenNodes = new Set<Element>();\n\n const getHidden = (element: Element): boolean => {\n return shouldUseInert && element instanceof windowObj.HTMLElement\n ? element.inert\n : element.getAttribute(\"aria-hidden\") === \"true\";\n };\n\n const setHidden = (element: Element, hidden: boolean): void => {\n if (shouldUseInert && element instanceof windowObj.HTMLElement) {\n element.inert = hidden;\n } else if (hidden) {\n element.setAttribute(\"aria-hidden\", \"true\");\n } else {\n element.removeAttribute(\"aria-hidden\");\n if (element instanceof windowObj.HTMLElement) {\n // We only ever call setHidden with hidden = false when the nodeCount is 1 aka\n // we are trying to make the element visible to screen readers again, so remove inert as well\n element.inert = false;\n }\n }\n };\n\n const hide = (node: Element): void => {\n let refCount = refCountMap.get(node) ?? 0;\n\n // If already aria-hidden, and the ref count is zero, then this element\n // was already hidden and there's nothing for us to do.\n if (getHidden(node) && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n setHidden(node, true);\n }\n\n hiddenNodes.add(node);\n refCountMap.set(node, refCount + 1);\n };\n\n const walk = (walkRoot: Element): void => {\n // Keep live announcer and top layer elements (e.g. toasts) visible.\n for (const element of walkRoot.querySelectorAll(\n \"[data-live-announcer], [data-solidaria-top-layer]\",\n )) {\n visibleNodes.add(element);\n }\n\n const acceptNode = (node: Element): number => {\n // Skip this node and its children if it is one of the target nodes, or a live announcer.\n // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is\n // made for elements with role=\"row\" since VoiceOver on iOS has issues hiding elements with role=\"row\".\n // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).\n if (\n hiddenNodes.has(node) ||\n visibleNodes.has(node) ||\n (node.parentElement &&\n hiddenNodes.has(node.parentElement) &&\n node.parentElement.getAttribute(\"role\") !== \"row\")\n ) {\n return NodeFilter.FILTER_REJECT;\n }\n\n // Skip this node but continue to children if one of the targets is inside the node.\n for (const target of visibleNodes) {\n if (node.contains(target)) {\n return NodeFilter.FILTER_SKIP;\n }\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n const walker = document.createTreeWalker(walkRoot, NodeFilter.SHOW_ELEMENT, { acceptNode });\n\n // TreeWalker does not include the root.\n const acceptRoot = acceptNode(walkRoot);\n if (acceptRoot === NodeFilter.FILTER_ACCEPT) {\n hide(walkRoot);\n }\n\n if (acceptRoot !== NodeFilter.FILTER_REJECT) {\n let node = walker.nextNode() as Element;\n while (node != null) {\n hide(node);\n node = walker.nextNode() as Element;\n }\n }\n };\n\n // If there is already a MutationObserver listening from a previous call,\n // disconnect it so the new one takes over.\n if (observerStack.length) {\n observerStack[observerStack.length - 1].disconnect();\n }\n\n walk(root);\n\n const observer = new MutationObserver((changes) => {\n for (const change of changes) {\n if (change.type !== \"childList\") {\n continue;\n }\n\n // If the parent element of the added nodes is not within one of the targets,\n // and not already inside a hidden node, hide all of the new children.\n if (![...visibleNodes, ...hiddenNodes].some((node) => node.contains(change.target))) {\n for (const node of change.addedNodes) {\n if (\n (node instanceof HTMLElement || node instanceof SVGElement) &&\n (node.dataset.liveAnnouncer === \"true\" || node.dataset.solidariaTopLayer === \"true\")\n ) {\n visibleNodes.add(node);\n } else if (node instanceof Element) {\n walk(node);\n }\n }\n }\n }\n });\n\n observer.observe(root, { childList: true, subtree: true });\n\n const observerWrapper: ObserverWrapper = {\n visibleNodes,\n hiddenNodes,\n observe() {\n observer.observe(root, { childList: true, subtree: true });\n },\n disconnect() {\n observer.disconnect();\n },\n };\n\n observerStack.push(observerWrapper);\n\n return (): void => {\n observer.disconnect();\n\n for (const node of hiddenNodes) {\n const count = refCountMap.get(node);\n if (count == null) {\n continue;\n }\n if (count === 1) {\n setHidden(node, false);\n refCountMap.delete(node);\n } else {\n refCountMap.set(node, count - 1);\n }\n }\n\n // Remove this observer from the stack, and start the previous one.\n if (observerWrapper === observerStack[observerStack.length - 1]) {\n observerStack.pop();\n if (observerStack.length) {\n observerStack[observerStack.length - 1].observe();\n }\n } else {\n observerStack.splice(observerStack.indexOf(observerWrapper), 1);\n }\n };\n}\n\n/**\n * Keeps an element visible when aria-hiding is active.\n * Used for elements like live regions that should remain accessible.\n */\nexport function keepVisible(element: Element): (() => void) | undefined {\n const observer = observerStack[observerStack.length - 1];\n if (observer && !observer.visibleNodes.has(element)) {\n observer.visibleNodes.add(element);\n return () => {\n observer.visibleNodes.delete(element);\n };\n }\n}\n","/**\n * Modal context and hooks for managing modal accessibility.\n * Based on @react-aria/overlays useModal.\n */\n\nimport {\n createContext,\n createSignal,\n useContext,\n createEffect,\n onCleanup,\n type JSX,\n type Accessor,\n type ParentComponent,\n} from \"solid-js\";\nimport { Portal } from \"solid-js/web\";\nimport { isServer } from \"solid-js/web\";\n\nexport interface ModalProviderProps {\n children: JSX.Element;\n}\n\nexport interface PortalProviderProps {\n /** Returns the element where overlays should portal. Pass null to clear inherited context. */\n getContainer?: (() => Element | null) | null;\n children: JSX.Element;\n}\n\nexport interface PortalProviderContextValue {\n getContainer?: () => Element | null;\n}\n\ninterface ModalContext {\n parent: ModalContext | null;\n modalCount: Accessor<number>;\n addModal: () => void;\n removeModal: () => void;\n}\n\nconst ModalContext = createContext<ModalContext | null>(null);\nconst PortalContext = createContext<PortalProviderContextValue>({});\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using SolidJS context in order to account for things\n * like portals, which can cause the component tree and the DOM tree to differ significantly in structure.\n */\nexport const ModalProvider: ParentComponent<ModalProviderProps> = (props) => {\n const parent = useContext(ModalContext);\n const [modalCount, setModalCount] = createSignal(0);\n\n const context: ModalContext = {\n parent,\n modalCount,\n addModal() {\n setModalCount((count) => count + 1);\n if (parent) {\n parent.addModal();\n }\n },\n removeModal() {\n setModalCount((count) => count - 1);\n if (parent) {\n parent.removeModal();\n }\n },\n };\n\n return <ModalContext.Provider value={context}>{props.children}</ModalContext.Provider>;\n};\n\n/**\n * Sets the portal container for overlays rendered by descendants.\n */\nexport const UNSAFE_PortalProvider: ParentComponent<PortalProviderProps> = (props) => {\n const parent = useUNSAFE_PortalContext();\n\n return (\n <PortalContext.Provider\n value={{\n getContainer:\n props.getContainer === null ? undefined : (props.getContainer ?? parent.getContainer),\n }}\n >\n {props.children}\n </PortalContext.Provider>\n );\n};\n\n/**\n * Returns the portal container configuration inherited from the nearest provider.\n */\nexport function useUNSAFE_PortalContext(): PortalProviderContextValue {\n return useContext(PortalContext) ?? {};\n}\n\nexport interface ModalProviderAria {\n /** Props to be spread on the container element. */\n modalProviderProps: {\n \"aria-hidden\"?: true;\n };\n}\n\n/**\n * Used to determine if the tree should be aria-hidden based on how many\n * modals are open.\n */\nexport function useModalProvider(): ModalProviderAria {\n const context = useContext(ModalContext);\n return {\n modalProviderProps: {\n get \"aria-hidden\"() {\n return context && context.modalCount() > 0 ? true : undefined;\n },\n },\n };\n}\n\n/**\n * Creates a root node that will be aria-hidden if there are other modals open.\n */\nconst OverlayContainerDOM: ParentComponent<ModalProviderProps> = (props) => {\n const { modalProviderProps } = useModalProvider();\n return (\n <div data-overlay-container {...modalProviderProps}>\n {props.children}\n </div>\n );\n};\n\n/**\n * An OverlayProvider acts as a container for the top-level application.\n * Any application that uses modal dialogs or other overlays should\n * be wrapped in a `<OverlayProvider>`. This is used to ensure that\n * the main content of the application is hidden from screen readers\n * if a modal or other overlay is opened. Only the top-most modal or\n * overlay should be accessible at once.\n */\nexport const OverlayProvider: ParentComponent<ModalProviderProps> = (props) => {\n return (\n <ModalProvider>\n <OverlayContainerDOM>{props.children}</OverlayContainerDOM>\n </ModalProvider>\n );\n};\n\nexport interface OverlayContainerProps extends ModalProviderProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element;\n}\n\n/**\n * A container for overlays like modals and popovers. Renders the overlay\n * into a Portal which is placed at the end of the document body.\n * Also ensures that the overlay is hidden from screen readers if a\n * nested modal is opened. Only the top-most modal or overlay should\n * be accessible at once.\n */\nexport const OverlayContainer: ParentComponent<OverlayContainerProps> = (props) => {\n // Don't render portal on server\n if (isServer) {\n return null;\n }\n\n const portalContext = useUNSAFE_PortalContext();\n const portalContainer = () =>\n props.portalContainer ?? portalContext.getContainer?.() ?? document.body;\n\n createEffect(() => {\n const container = portalContainer();\n if (container?.closest(\"[data-overlay-container]\")) {\n throw new Error(\n \"An OverlayContainer must not be inside another container. Please change the portalContainer prop.\",\n );\n }\n });\n\n return (\n <Portal mount={portalContainer()}>\n <OverlayProvider>{props.children}</OverlayProvider>\n </Portal>\n );\n};\n\nexport interface AriaModalOptions {\n /** Whether the modal is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface ModalAria {\n /** Props for the modal content element. */\n modalProps: {\n \"data-ismodal\": boolean;\n };\n}\n\n/**\n * Hides content outside the current `<OverlayContainer>` from screen readers\n * on mount and restores it on unmount. Typically used by modal dialogs and\n * other types of overlays to ensure that only the top-most modal is\n * accessible at once.\n */\nexport function createModal(options?: AriaModalOptions): ModalAria {\n // Add aria-hidden to all parent providers on mount, and restore on unmount.\n const context = useContext(ModalContext);\n\n if (!context) {\n throw new Error(\"Modal is not contained within a provider\");\n }\n\n createEffect(() => {\n if (options?.isDisabled || !context.parent) {\n return;\n }\n\n // The immediate context is from the provider containing this modal, so we only\n // want to trigger aria-hidden on its parents not on the modal provider itself.\n context.parent.addModal();\n\n onCleanup(() => {\n if (context.parent) {\n context.parent.removeModal();\n }\n });\n });\n\n return {\n modalProps: {\n \"data-ismodal\": !options?.isDisabled,\n },\n };\n}\n","/**\n * createTypeSelect - Handles typeahead interactions with collections.\n * Based on @react-aria/selection useTypeSelect.\n *\n * Allows users to navigate to items by typing characters that match\n * item text values. Supports multi-character search with debouncing.\n */\n\nimport type { JSX, Accessor } from \"solid-js\";\nimport type { Key, Collection, CollectionNode } from \"@proyecto-viviana/solid-stately\";\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface TypeSelectOptions<T> {\n /** The collection to search through. */\n collection: Accessor<Collection<T>>;\n /** The currently focused key. */\n focusedKey: Accessor<Key | null>;\n /** Callback to set the focused key when a match is found. */\n onFocusedKeyChange: (key: Key) => void;\n /** Callback when an item is focused by typing. */\n onTypeSelect?: (key: Key) => void;\n /** Function to check if a key is disabled. */\n isKeyDisabled?: (key: Key) => boolean;\n /** Whether type-to-select is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface TypeSelectAria {\n /** Props to spread on the collection element. */\n typeSelectProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Internal state for tracking the search buffer\ninterface TypeSelectState {\n search: string;\n timeout: ReturnType<typeof setTimeout> | undefined;\n}\n\n/**\n * Get a printable character from a key event.\n * Returns the character if it's a single printable character,\n * or empty string for non-printable keys.\n */\nfunction getStringForKey(key: string): string {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n return \"\";\n}\n\n/**\n * Search for a key in the collection that matches the search string.\n * Starts searching from the key after `fromKey`, wrapping around if needed.\n */\nfunction getKeyForSearch<T>(\n collection: Collection<T>,\n search: string,\n fromKey: Key | null,\n isKeyDisabled?: (key: Key) => boolean,\n): Key | null {\n const searchLower = search.toLowerCase();\n\n // Collect all items in order\n const items: CollectionNode<T>[] = [];\n for (const item of collection) {\n if (item.type === \"item\") {\n items.push(item);\n }\n }\n\n if (items.length === 0) return null;\n\n // Find the starting index\n let startIndex = 0;\n if (fromKey != null) {\n const fromIndex = items.findIndex((item) => item.key === fromKey);\n if (fromIndex !== -1) {\n // Start searching from the item AFTER the current one\n startIndex = (fromIndex + 1) % items.length;\n }\n }\n\n // Search from startIndex, wrapping around\n for (let i = 0; i < items.length; i++) {\n const index = (startIndex + i) % items.length;\n const item = items[index];\n\n // Skip disabled items\n if (item.isDisabled || (isKeyDisabled && isKeyDisabled(item.key))) {\n continue;\n }\n\n // Check if the text value starts with the search string\n const textValue = item.textValue || \"\";\n if (textValue.toLowerCase().startsWith(searchLower)) {\n return item.key;\n }\n }\n\n return null;\n}\n\n/**\n * Creates typeahead/type-to-select functionality for a collection.\n *\n * @example\n * ```tsx\n * const { typeSelectProps } = createTypeSelect({\n * collection: () => state.collection(),\n * focusedKey: () => state.focusedKey(),\n * onFocusedKeyChange: (key) => state.setFocusedKey(key),\n * });\n *\n * return <ul {...mergeProps(listBoxProps, typeSelectProps)}>...</ul>;\n * ```\n */\nexport function createTypeSelect<T>(options: TypeSelectOptions<T>): TypeSelectAria {\n // Create mutable state object to persist across keystrokes\n const state: TypeSelectState = {\n search: \"\",\n timeout: undefined,\n };\n\n const onKeyDownCapture: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (options.isDisabled) return;\n\n const character = getStringForKey(e.key);\n\n // Ignore non-printable characters, modifier key combos,\n // and events that didn't originate from within the element\n if (\n !character ||\n e.ctrlKey ||\n e.metaKey ||\n e.altKey ||\n !e.currentTarget.contains(e.target as HTMLElement)\n ) {\n return;\n }\n\n // Don't start search with space (common action key)\n if (state.search.length === 0 && character === \" \") {\n return;\n }\n\n // If there's already search text and the user types a space,\n // prevent it from triggering selection and include it in the search\n if (character === \" \" && state.search.trim().length > 0) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n // Append to the search buffer\n state.search += character;\n\n // Find a matching key\n const collection = options.collection();\n const currentKey = options.focusedKey();\n\n // First, try to find a match starting after the current key\n let key = getKeyForSearch(collection, state.search, currentKey, options.isKeyDisabled);\n\n // If no match found, try from the beginning\n if (key == null && currentKey != null) {\n key = getKeyForSearch(collection, state.search, null, options.isKeyDisabled);\n }\n\n if (key != null) {\n options.onFocusedKeyChange(key);\n options.onTypeSelect?.(key);\n }\n\n // Reset the debounce timer\n if (state.timeout !== undefined) {\n clearTimeout(state.timeout);\n }\n state.timeout = setTimeout(() => {\n state.search = \"\";\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n // Handler for bubble phase (used in test environments and as fallback)\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = onKeyDownCapture;\n\n return {\n typeSelectProps: {\n // Use capture phase to handle spacebar before other handlers in production\n onKeyDownCapture,\n // Also attach to bubble phase for test environments\n onKeyDown,\n } as JSX.HTMLAttributes<HTMLElement>,\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n * Based on @react-aria/listbox useListBox.\n */\n\nimport { createEffect, onCleanup, type JSX } from \"solid-js\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { createLabel } from \"../label/createLabel\";\nimport { createTypeSelect } from \"../selection/createTypeSelect\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { isDevEnv } from \"../utils/env\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaListBoxProps {\n /** An ID for the listbox. */\n id?: string;\n /** Whether the listbox is disabled. */\n isDisabled?: boolean;\n /** The label for the listbox. */\n label?: JSX.Element;\n /** An accessible label for the listbox when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the listbox. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the listbox. */\n \"aria-describedby\"?: string;\n /** Handler called when focus moves into the listbox. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves out of the listbox. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler called when an item is activated (pressed). */\n onAction?: (key: Key) => void;\n /** Whether focus should automatically wrap around. */\n shouldFocusWrap?: boolean;\n /** Whether selection should occur on press up. */\n shouldSelectOnPressUp?: boolean;\n /** Whether to focus items on hover. */\n shouldFocusOnHover?: boolean;\n /**\n * Whether keyboard focus movement should also update selection in single selection mode.\n * @default true\n */\n shouldSelectOnFocus?: boolean;\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n}\n\nexport interface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox's label element (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Shared data between listbox and options\nconst listBoxData = new WeakMap<object, ListBoxData>();\n\ninterface ListBoxData {\n id: string;\n onAction?: (key: Key) => void;\n shouldSelectOnPressUp?: boolean;\n shouldFocusOnHover?: boolean;\n isDisabled?: boolean;\n}\n\nexport function getListBoxData(state: ListState): ListBoxData | undefined {\n return listBoxData.get(state);\n}\n\nfunction findNextEnabledKey<T>(\n state: ListState<T>,\n currentKey: Key | null,\n direction: \"next\" | \"prev\",\n wrap: boolean,\n): Key | null {\n const collection = state.collection();\n const getAdjacentKey =\n direction === \"next\"\n ? (key: Key) => collection.getKeyAfter(key)\n : (key: Key) => collection.getKeyBefore(key);\n const getBoundaryKey =\n direction === \"next\" ? () => collection.getFirstKey() : () => collection.getLastKey();\n\n let key = currentKey != null ? getAdjacentKey(currentKey) : getBoundaryKey();\n while (key != null && state.isDisabled(key)) {\n key = getAdjacentKey(key);\n }\n\n if (key == null && wrap) {\n key = getBoundaryKey();\n while (key != null && state.isDisabled(key)) {\n key = getAdjacentKey(key);\n }\n }\n\n return key;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n */\nexport function createListBox<T>(\n props: MaybeAccessor<AriaListBoxProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null,\n): ListBoxAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\n \"[solidaria] A ListBox requires an aria-label or aria-labelledby attribute for accessibility.\",\n );\n }\n }\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n const updateSharedData = () => {\n const p = getProps();\n listBoxData.set(state, {\n id,\n onAction: p.onAction,\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n shouldFocusOnHover: p.shouldFocusOnHover,\n isDisabled: p.isDisabled,\n });\n };\n\n // Ensure options created in the same render pass can read parent metadata.\n updateSharedData();\n\n // Share data with child options\n createEffect(() => {\n updateSharedData();\n\n onCleanup(() => {\n listBoxData.delete(state);\n });\n });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n onFocusWithin: (e) => getProps().onFocus?.(e),\n onBlurWithin: (e) => getProps().onBlur?.(e),\n onFocusWithinChange: (isFocused) => {\n getProps().onFocusChange?.(isFocused);\n state.setFocused(isFocused);\n },\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return id;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Type-to-select\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.focusedKey(),\n onFocusedKeyChange: (key) => state.setFocusedKey(key),\n isKeyDisabled: (key) => state.isDisabled(key),\n get isDisabled() {\n return getProps().disallowTypeAhead ?? false;\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n const collection = state.collection();\n const shouldWrap = p.shouldFocusWrap ?? false;\n const shouldSelectOnFocus = p.shouldSelectOnFocus ?? true;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n const nextKey = findNextEnabledKey(state, state.focusedKey(), \"next\", shouldWrap);\n if (nextKey != null) {\n state.setFocusedKey(nextKey);\n if (shouldSelectOnFocus && !e.shiftKey && state.selectionMode() === \"single\") {\n state.replaceSelection(nextKey);\n } else if (e.shiftKey && state.selectionMode() === \"multiple\") {\n state.extendSelection(nextKey, collection);\n }\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n const prevKey = findNextEnabledKey(state, state.focusedKey(), \"prev\", shouldWrap);\n if (prevKey != null) {\n state.setFocusedKey(prevKey);\n if (shouldSelectOnFocus && !e.shiftKey && state.selectionMode() === \"single\") {\n state.replaceSelection(prevKey);\n } else if (e.shiftKey && state.selectionMode() === \"multiple\") {\n state.extendSelection(prevKey, collection);\n }\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const firstKey = findNextEnabledKey(state, null, \"next\", false);\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n if (e.ctrlKey && e.shiftKey && state.selectionMode() === \"multiple\") {\n // Select from current to first\n state.extendSelection(firstKey, collection);\n } else if (shouldSelectOnFocus && !e.shiftKey && state.selectionMode() === \"single\") {\n state.replaceSelection(firstKey);\n }\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n const lastKey = findNextEnabledKey(state, null, \"prev\", false);\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n if (e.ctrlKey && e.shiftKey && state.selectionMode() === \"multiple\") {\n // Select from current to last\n state.extendSelection(lastKey, collection);\n } else if (shouldSelectOnFocus && !e.shiftKey && state.selectionMode() === \"single\") {\n state.replaceSelection(lastKey);\n }\n }\n break;\n }\n case \" \":\n case \"Enter\": {\n e.preventDefault();\n const focusedKey = state.focusedKey();\n if (focusedKey != null && !state.isDisabled(focusedKey)) {\n if (state.selectionMode() !== \"none\") {\n state.toggleSelection(focusedKey);\n }\n p.onAction?.(focusedKey);\n }\n break;\n }\n case \"a\": {\n if ((e.ctrlKey || e.metaKey) && state.selectionMode() === \"multiple\") {\n e.preventDefault();\n state.selectAll();\n }\n break;\n }\n case \"Escape\": {\n e.preventDefault();\n if (!state.disallowEmptySelection()) {\n state.clearSelection();\n }\n break;\n }\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get listBoxProps() {\n const p = getProps();\n const selectionMode = state.selectionMode();\n\n const baseProps = mergeProps(\n domProps(),\n focusWithinProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n role: \"listbox\",\n tabIndex: p.isDisabled ? undefined : 0,\n \"aria-disabled\": p.isDisabled || undefined,\n \"aria-multiselectable\": selectionMode === \"multiple\" ? true : undefined,\n \"aria-activedescendant\":\n state.focusedKey() != null ? String(state.focusedKey()) : undefined,\n onKeyDown,\n },\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(\n baseProps,\n typeSelectProps as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * Based on @react-aria/listbox useOption.\n */\n\nimport { type JSX, type Accessor } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createHover, type HoverEvents } from \"../interactions/createHover\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { getListBoxData } from \"./createListBox\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaOptionProps {\n /** The unique key for the option. */\n key: Key;\n /** Optional DOM id for the option element. Defaults to the key. */\n optionId?: string;\n /** Whether the option is disabled. */\n isDisabled?: boolean;\n /** An accessible label for the option. */\n \"aria-label\"?: string;\n /** Whether selection should occur on press up. */\n shouldSelectOnPressUp?: boolean;\n /** Whether to focus the option on hover. */\n shouldFocusOnHover?: boolean;\n /** Whether the option should use virtual focus instead of receiving DOM focus. */\n shouldUseVirtualFocus?: boolean;\n /** Whether press-up may occur without the press starting on this option. */\n allowsDifferentPressOrigin?: boolean;\n /** Handler called when hover starts. */\n onHoverStart?: HoverEvents[\"onHoverStart\"];\n /** Handler called when hover ends. */\n onHoverEnd?: HoverEvents[\"onHoverEnd\"];\n /** Handler called when hover state changes. */\n onHoverChange?: HoverEvents[\"onHoverChange\"];\n /** Handler called when the option is activated. */\n onAction?: () => void;\n}\n\nexport interface OptionAria {\n /** Props for the option element. */\n optionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the label text inside the option. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description text inside the option. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the option is currently selected. */\n isSelected: Accessor<boolean>;\n /** Whether the option is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the option is keyboard focused. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the option is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the option is currently hovered. */\n isHovered: Accessor<boolean>;\n /** Whether the option is disabled. */\n isDisabled: Accessor<boolean>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n */\nexport function createOption<T>(\n props: MaybeAccessor<AriaOptionProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null,\n): OptionAria {\n const getProps = () => access(props);\n\n const getData = () => getListBoxData(state);\n\n const isDisabled: Accessor<boolean> = () => {\n return Boolean(\n getData()?.isDisabled || getProps().isDisabled || state.isDisabled(getProps().key),\n );\n };\n\n const isSelected: Accessor<boolean> = () => {\n return state.isSelected(getProps().key);\n };\n\n const isFocused: Accessor<boolean> = () => {\n return state.focusedKey() === getProps().key;\n };\n\n const shouldSelectOnPressUp = () => {\n return getProps().shouldSelectOnPressUp ?? getData()?.shouldSelectOnPressUp ?? true;\n };\n\n const shouldUseVirtualFocus = () => {\n return getProps().shouldUseVirtualFocus ?? false;\n };\n\n const allowsDifferentPressOrigin = () => {\n return getProps().allowsDifferentPressOrigin ?? false;\n };\n\n const selectAndAction = () => {\n const key = getProps().key;\n if (state.selectionMode() !== \"none\") {\n state.select(key);\n }\n getProps().onAction?.();\n getData()?.onAction?.(key);\n };\n\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n get preventFocusOnPress() {\n return shouldUseVirtualFocus();\n },\n onPressStart(e) {\n if (!shouldSelectOnPressUp() && e.pointerType !== \"keyboard\" && e.pointerType !== \"virtual\") {\n selectAndAction();\n }\n },\n onPressUp(e) {\n if (shouldSelectOnPressUp() && allowsDifferentPressOrigin() && e.pointerType === \"mouse\") {\n selectAndAction();\n }\n },\n onPress(e) {\n if (\n (shouldSelectOnPressUp() && !allowsDifferentPressOrigin()) ||\n (shouldSelectOnPressUp() &&\n allowsDifferentPressOrigin() &&\n e.pointerType !== \"keyboard\" &&\n e.pointerType !== \"mouse\") ||\n e.pointerType === \"keyboard\" ||\n e.pointerType === \"virtual\"\n ) {\n selectAndAction();\n }\n },\n });\n\n const { hoverProps, isHovered } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n onHoverStart(e) {\n const shouldFocus = getProps().shouldFocusOnHover ?? getData()?.shouldFocusOnHover;\n if (shouldFocus) {\n state.setFocusedKey(getProps().key);\n }\n getProps().onHoverStart?.(e);\n },\n onHoverEnd(e) {\n getProps().onHoverEnd?.(e);\n },\n onHoverChange(isHovering) {\n getProps().onHoverChange?.(isHovering);\n },\n });\n\n const { isFocusVisible, focusProps } = createFocusRing();\n\n const labelId = `${getProps().key}-label`;\n const descriptionId = `${getProps().key}-desc`;\n\n return {\n get optionProps() {\n const key = getProps().key;\n const selectionMode = state.selectionMode();\n const ariaLabel = getProps()[\"aria-label\"];\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n {\n role: \"option\",\n id: getProps().optionId ?? String(key),\n \"data-key\": String(key),\n \"aria-selected\": selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": !ariaLabel ? labelId : undefined,\n \"aria-describedby\": descriptionId,\n tabIndex: shouldUseVirtualFocus() ? undefined : isFocused() ? 0 : -1,\n \"data-selected\": isSelected() || undefined,\n \"data-focused\": isFocused() || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n \"data-pressed\": isPressed() || undefined,\n \"data-disabled\": isDisabled() || undefined,\n \"data-hovered\": isHovered() || undefined,\n } as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n labelProps: {\n id: labelId,\n },\n descriptionProps: {\n id: descriptionId,\n },\n isSelected,\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isPressed,\n isHovered,\n isDisabled,\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * Based on @react-aria/menu useMenu.\n */\n\nimport { createEffect, onCleanup, type JSX, type Accessor } from \"solid-js\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { createLabel } from \"../label/createLabel\";\nimport { createTypeSelect } from \"../selection/createTypeSelect\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { isDevEnv } from \"../utils/env\";\nimport type { MenuState, Key, Collection } from \"@proyecto-viviana/solid-stately\";\n\n/**\n * Default number of items to skip for page up/down when DOM measurement is not available.\n */\nconst DEFAULT_PAGE_SIZE = 10;\n\n/**\n * Find the next non-disabled key in a collection.\n */\nfunction findNextNonDisabledKey<T>(\n collection: Collection<T>,\n currentKey: Key | null,\n direction: \"next\" | \"prev\",\n isDisabled: (key: Key) => boolean,\n wrap: boolean,\n): Key | null {\n const getNextKey =\n direction === \"next\"\n ? (key: Key) => collection.getKeyAfter(key)\n : (key: Key) => collection.getKeyBefore(key);\n\n const getFirstKey =\n direction === \"next\" ? () => collection.getFirstKey() : () => collection.getLastKey();\n\n let nextKey = currentKey != null ? getNextKey(currentKey) : getFirstKey();\n\n // Skip disabled keys\n while (nextKey != null && isDisabled(nextKey)) {\n nextKey = getNextKey(nextKey);\n }\n\n // If we've reached the end and wrapping is enabled\n if (nextKey == null && wrap) {\n nextKey = getFirstKey();\n // Skip disabled keys from the start\n while (nextKey != null && isDisabled(nextKey)) {\n nextKey = getNextKey(nextKey);\n }\n }\n\n return nextKey;\n}\n\nexport interface AriaMenuProps {\n /** An ID for the menu. */\n id?: string;\n /** Whether the menu is disabled. */\n isDisabled?: boolean;\n /** The label for the menu. */\n label?: JSX.Element;\n /** An accessible label for the menu when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the menu. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the menu. */\n \"aria-describedby\"?: string;\n /** Handler called when focus moves into the menu. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves out of the menu. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler called when an item is activated (pressed). */\n onAction?: (key: Key) => void;\n /** Handler called when the menu should close. */\n onClose?: () => void;\n /** Whether focus should automatically wrap around. */\n shouldFocusWrap?: boolean;\n /** Whether to auto-focus the first item when the menu opens. */\n autoFocus?: boolean | \"first\" | \"last\";\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n}\n\nexport interface MenuAria {\n /** Props for the menu element. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the menu's label element (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Shared data between menu and menu items\nconst menuData = new WeakMap<object, MenuData>();\n\ninterface MenuData {\n id: string;\n onAction?: (key: Key) => void;\n onClose?: () => void;\n isDisabled?: boolean;\n}\n\nexport function getMenuData(state: MenuState): MenuData | undefined {\n return menuData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n */\nexport function createMenu<T>(\n props: MaybeAccessor<AriaMenuProps>,\n state: MenuState<T>,\n ref?: Accessor<HTMLElement | null>,\n): MenuAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\n \"[solidaria] A Menu requires an aria-label or aria-labelledby attribute for accessibility.\",\n );\n }\n }\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n const updateSharedData = () => {\n const p = getProps();\n menuData.set(state, {\n id,\n onAction: p.onAction,\n onClose: p.onClose,\n isDisabled: p.isDisabled,\n });\n };\n\n // Ensure menu items created in the same render pass can read parent metadata.\n updateSharedData();\n\n // Share data with child menu items\n createEffect(() => {\n updateSharedData();\n\n onCleanup(() => {\n menuData.delete(state);\n });\n });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n onFocusWithin: (e) => getProps().onFocus?.(e),\n onBlurWithin: (e) => getProps().onBlur?.(e),\n onFocusWithinChange: (isFocused) => {\n getProps().onFocusChange?.(isFocused);\n state.setFocused(isFocused);\n },\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return id;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Type-to-select\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.focusedKey(),\n onFocusedKeyChange: (key) => state.setFocusedKey(key),\n isKeyDisabled: (key) => state.isDisabled(key),\n get isDisabled() {\n return getProps().disallowTypeAhead ?? false;\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (getProps().isDisabled) return;\n\n const collection = state.collection();\n const p = getProps();\n const wrap = p.shouldFocusWrap ?? false;\n\n // Use state.isDisabled which properly checks the disabledKeys accessor\n const isDisabled = (key: Key) => state.isDisabled(key);\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const nextKey = findNextNonDisabledKey(collection, currentKey, \"next\", isDisabled, wrap);\n if (nextKey != null) {\n state.setFocusedKey(nextKey);\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const prevKey = findNextNonDisabledKey(collection, currentKey, \"prev\", isDisabled, wrap);\n if (prevKey != null) {\n state.setFocusedKey(prevKey);\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n // Find first non-disabled key\n let firstKey = collection.getFirstKey();\n while (firstKey != null && isDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n // Find last non-disabled key\n let lastKey = collection.getLastKey();\n while (lastKey != null && isDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n break;\n }\n case \" \":\n case \"Enter\": {\n e.preventDefault();\n const focusedKey = state.focusedKey();\n // Don't activate disabled items\n if (focusedKey != null && !isDisabled(focusedKey)) {\n state.select(focusedKey, e, collection);\n p.onAction?.(focusedKey);\n p.onClose?.();\n }\n break;\n }\n case \"Escape\": {\n e.preventDefault();\n p.onClose?.();\n break;\n }\n case \"PageDown\": {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const el = ref?.();\n\n if (el) {\n // Use DOM measurements to calculate how many items fit in a page\n const visibleHeight = el.clientHeight;\n let traveled = 0;\n let targetKey = currentKey;\n\n while (targetKey != null && traveled < visibleHeight) {\n const nextKey = collection.getKeyAfter(targetKey);\n if (nextKey == null) break;\n\n // Try to measure the item height\n const itemElement = el.querySelector(`[data-key=\"${targetKey}\"]`);\n traveled += itemElement?.clientHeight ?? 32;\n\n // Skip disabled items\n if (!isDisabled(nextKey)) {\n targetKey = nextKey;\n } else {\n // Skip over disabled items without counting them\n const afterDisabled = findNextNonDisabledKey(\n collection,\n nextKey,\n \"next\",\n isDisabled,\n false,\n );\n if (afterDisabled != null) {\n targetKey = afterDisabled;\n } else {\n break;\n }\n }\n }\n\n if (targetKey != null && targetKey !== currentKey) {\n state.setFocusedKey(targetKey);\n }\n } else {\n // Fallback: move by DEFAULT_PAGE_SIZE items\n let count = DEFAULT_PAGE_SIZE;\n let targetKey = currentKey;\n\n while (count > 0 && targetKey != null) {\n const nextKey = findNextNonDisabledKey(\n collection,\n targetKey,\n \"next\",\n isDisabled,\n false,\n );\n if (nextKey == null) break;\n targetKey = nextKey;\n count--;\n }\n\n if (targetKey != null) {\n state.setFocusedKey(targetKey);\n }\n }\n break;\n }\n case \"PageUp\": {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const el = ref?.();\n\n if (el) {\n // Use DOM measurements to calculate how many items fit in a page\n const visibleHeight = el.clientHeight;\n let traveled = 0;\n let targetKey = currentKey;\n\n while (targetKey != null && traveled < visibleHeight) {\n const prevKey = collection.getKeyBefore(targetKey);\n if (prevKey == null) break;\n\n // Try to measure the item height\n const itemElement = el.querySelector(`[data-key=\"${targetKey}\"]`);\n traveled += itemElement?.clientHeight ?? 32;\n\n // Skip disabled items\n if (!isDisabled(prevKey)) {\n targetKey = prevKey;\n } else {\n // Skip over disabled items without counting them\n const beforeDisabled = findNextNonDisabledKey(\n collection,\n prevKey,\n \"prev\",\n isDisabled,\n false,\n );\n if (beforeDisabled != null) {\n targetKey = beforeDisabled;\n } else {\n break;\n }\n }\n }\n\n if (targetKey != null && targetKey !== currentKey) {\n state.setFocusedKey(targetKey);\n }\n } else {\n // Fallback: move by DEFAULT_PAGE_SIZE items\n let count = DEFAULT_PAGE_SIZE;\n let targetKey = currentKey;\n\n while (count > 0 && targetKey != null) {\n const prevKey = findNextNonDisabledKey(\n collection,\n targetKey,\n \"prev\",\n isDisabled,\n false,\n );\n if (prevKey == null) break;\n targetKey = prevKey;\n count--;\n }\n\n if (targetKey != null) {\n state.setFocusedKey(targetKey);\n }\n }\n break;\n }\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get menuProps() {\n const p = getProps();\n\n const baseProps = mergeProps(\n domProps(),\n focusWithinProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n role: \"menu\",\n tabIndex: p.isDisabled ? undefined : 0,\n \"aria-disabled\": p.isDisabled || undefined,\n onKeyDown,\n } as Record<string, unknown>,\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(\n baseProps,\n typeSelectProps as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a menu item.\n * Based on @react-aria/menu useMenuItem.\n */\n\nimport { type JSX, type Accessor } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createHover } from \"../interactions/createHover\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { getMenuData } from \"./createMenu\";\nimport type { MenuState, Key, SelectionMode } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaMenuItemProps {\n /** The unique key for the menu item. */\n key: Key;\n /** Whether the menu item is disabled. */\n isDisabled?: boolean;\n /** An accessible label for the menu item. */\n \"aria-label\"?: string;\n /** Handler called when the menu item is selected. */\n onAction?: () => void;\n /** Whether to close the menu when this item is selected. */\n closeOnSelect?: boolean;\n /** A URL to link to. Turns the menu item into a link. */\n href?: string;\n /** The target window for the link. */\n target?: string;\n /** The relationship between the linked resource and the current page. */\n rel?: string;\n /** Causes the browser to download the linked URL. A string may be provided to suggest a file name. */\n download?: boolean | string;\n}\n\nexport interface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the label text inside the menu item. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description text inside the menu item. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the keyboard shortcut inside the menu item. */\n keyboardShortcutProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the menu item is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the menu item is keyboard focused. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the menu item is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the menu item is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the menu item is selected. */\n isSelected: Accessor<boolean>;\n /** The parent menu selection mode. */\n selectionMode: Accessor<SelectionMode>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu item.\n */\nexport function createMenuItem<T>(\n props: MaybeAccessor<AriaMenuItemProps>,\n state: MenuState<T>,\n _ref?: () => HTMLElement | null,\n): MenuItemAria {\n const getProps = () => access(props);\n\n // Get shared data from menu\n const getData = () => getMenuData(state);\n\n // Computed states\n const isDisabled: Accessor<boolean> = () => {\n return Boolean(\n getData()?.isDisabled || getProps().isDisabled || state.isDisabled(getProps().key),\n );\n };\n\n const isFocused: Accessor<boolean> = () => {\n return state.focusedKey() === getProps().key;\n };\n\n const isSelected: Accessor<boolean> = () => {\n return selectionMode() !== \"none\" && state.isSelected(getProps().key);\n };\n\n const selectionMode: Accessor<SelectionMode> = () => {\n return state.selectionMode();\n };\n\n // Whether this is a link item\n const isLink = () => !!getProps().href;\n\n // Handle press\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPress() {\n const p = getProps();\n const key = p.key;\n const data = getData();\n\n state.select(key, undefined, state.collection());\n\n // Call item-specific onAction\n p.onAction?.();\n\n // Call menu-level onAction\n data?.onAction?.(key);\n\n // Close menu if closeOnSelect is not explicitly false\n // For link items, default to closing the menu\n if (p.closeOnSelect !== false) {\n data?.onClose?.();\n }\n },\n });\n\n // Handle hover\n const { hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n onHoverStart() {\n state.setFocusedKey(getProps().key);\n },\n });\n\n // Handle focus ring\n const { isFocusVisible, focusProps } = createFocusRing();\n\n // Generate unique IDs for label and description\n const labelId = `${getProps().key}-label`;\n const descriptionId = `${getProps().key}-desc`;\n const keyboardId = `${getProps().key}-kbd`;\n\n return {\n get menuItemProps() {\n const p = getProps();\n const key = p.key;\n const ariaLabel = p[\"aria-label\"];\n const mode = selectionMode();\n const selected = isSelected();\n\n const baseProps: Record<string, unknown> = {\n role:\n mode === \"single\"\n ? \"menuitemradio\"\n : mode === \"multiple\"\n ? \"menuitemcheckbox\"\n : \"menuitem\",\n id: String(key),\n \"aria-disabled\": isDisabled() || undefined,\n \"aria-checked\": mode !== \"none\" ? selected : undefined,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": !ariaLabel ? labelId : undefined,\n \"aria-describedby\": descriptionId,\n tabIndex: isFocused() ? 0 : -1,\n \"data-selected\": selected || undefined,\n \"data-focused\": isFocused() || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n \"data-pressed\": isPressed() || undefined,\n \"data-disabled\": isDisabled() || undefined,\n };\n\n // Add link props when href is present\n if (isLink()) {\n baseProps.href = isDisabled() ? undefined : p.href;\n if (p.target) baseProps.target = p.target;\n if (p.rel) baseProps.rel = p.rel;\n if (p.download != null && p.download !== false) {\n baseProps.download = p.download === true ? \"\" : p.download;\n }\n }\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n baseProps,\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n labelProps: {\n id: labelId,\n },\n descriptionProps: {\n id: descriptionId,\n },\n keyboardShortcutProps: {\n id: keyboardId,\n \"aria-hidden\": true,\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isPressed,\n isDisabled,\n isSelected,\n selectionMode,\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * Based on @react-aria/menu useMenuTrigger.\n */\n\nimport { type JSX } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { OverlayTriggerState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaMenuTriggerProps {\n /** The type of menu that the menu trigger opens. */\n type?: \"menu\" | \"listbox\";\n /** Whether the menu trigger is disabled. */\n isDisabled?: boolean;\n /** An ID for the menu. */\n id?: string;\n}\n\nexport interface MenuTriggerAria {\n /** Props for the menu trigger button. */\n menuTriggerProps: JSX.HTMLAttributes<HTMLElement> & {\n onPress: () => void;\n onKeyDown: (e: KeyboardEvent) => void;\n };\n /** Props for the menu element. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n */\nexport function createMenuTrigger(\n props: MaybeAccessor<AriaMenuTriggerProps>,\n state: OverlayTriggerState,\n): MenuTriggerAria {\n const getProps = () => access(props);\n const menuId = createId(getProps().id);\n\n const onPress = () => {\n if (!getProps().isDisabled) {\n state.toggle();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled) return;\n\n switch (e.key) {\n case \"Enter\":\n case \" \":\n case \"ArrowDown\": {\n e.preventDefault();\n if (!state.isOpen()) {\n state.open();\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n if (!state.isOpen()) {\n state.open();\n }\n break;\n }\n }\n };\n\n return {\n get menuTriggerProps() {\n const p = getProps();\n const type = p.type ?? \"menu\";\n const isOpen = state.isOpen();\n\n return {\n \"aria-haspopup\": type,\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? menuId : undefined,\n \"aria-disabled\": p.isDisabled || undefined,\n onPress,\n onKeyDown,\n };\n },\n menuProps: {\n id: menuId,\n },\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a select component.\n * A select displays a collapsible list of options and allows a user to select one of them.\n * Based on @react-aria/select useSelect.\n */\n\nimport { type JSX, type Accessor, createEffect, onCleanup } from \"solid-js\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { createLabel } from \"../label/createLabel\";\nimport { createTypeSelect } from \"../selection/createTypeSelect\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { SelectState, CollectionNode } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaSelectProps {\n /** An ID for the select. */\n id?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** Whether the select is invalid. */\n isInvalid?: boolean;\n /** The label for the select. */\n label?: JSX.Element;\n /** An accessible label for the select when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the select. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the select. */\n \"aria-describedby\"?: string;\n /** Placeholder text when no option is selected. */\n placeholder?: string;\n /** Whether the select should be auto-focused. */\n autoFocus?: boolean;\n /** Handler called when focus moves to the select. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves away from the select. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** The name of the select, used when submitting an HTML form. */\n name?: string;\n /** Associates the hidden native select with a form element by id. */\n form?: string;\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n /** Whether the select can open when its collection is empty. @default false */\n allowsEmptyCollection?: boolean;\n /** Whether validation should use ARIA attributes or native browser validation. */\n validationBehavior?: \"aria\" | \"native\";\n}\n\nexport interface SelectAria<T> {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the trigger button element. */\n triggerProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the value display element. */\n valueProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox/menu popup. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the select is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the select has keyboard focus. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the select is currently open. */\n isOpen: Accessor<boolean>;\n /** The currently selected item. */\n selectedItem: Accessor<CollectionNode<T> | null>;\n}\n\n// Shared data between select and options\nconst selectData = new WeakMap<object, SelectData>();\n\ninterface SelectData {\n id: string;\n}\n\nexport function getSelectData(state: SelectState): SelectData | undefined {\n return selectData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a select component.\n */\nexport function createSelect<T>(\n props: MaybeAccessor<AriaSelectProps>,\n state: SelectState<T>,\n _ref?: () => HTMLElement | null,\n): SelectAria<T> {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const buttonId = `${id}-button`;\n const listBoxId = `${id}-listbox`;\n const valueId = `${id}-value`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Share data with child options\n createEffect(() => {\n selectData.set(state, { id });\n\n onCleanup(() => {\n selectData.delete(state);\n });\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return buttonId;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n get autoFocus() {\n return getProps().autoFocus;\n },\n });\n\n // Track focus state\n const isFocused = state.isFocused;\n\n // Handle press on trigger\n const canOpen = () =>\n getProps().allowsEmptyCollection || state.collection().getFirstKey() != null;\n\n // Helper to check if key is disabled\n const isKeyDisabled = (key: string | number): boolean => {\n const collection = state.collection();\n return state.isKeyDisabled?.(key) || collection.getItem(key)?.isDisabled || false;\n };\n\n // Helper to find the next non-disabled key.\n const findNextKey = (\n fromKey: string | number | null,\n direction: \"forward\" | \"backward\",\n ): string | number | null => {\n const collection = state.collection();\n const getAdjacent =\n direction === \"forward\"\n ? (k: string | number) => collection.getKeyAfter(k)\n : (k: string | number) => collection.getKeyBefore(k);\n const getBoundary =\n direction === \"forward\" ? () => collection.getFirstKey() : () => collection.getLastKey();\n\n let key = fromKey == null ? getBoundary() : getAdjacent(fromKey);\n while (key != null && isKeyDisabled(key)) {\n key = getAdjacent(key);\n }\n\n return key;\n };\n\n const focusKeyForOpen = (): string | number | null => {\n const selectedKey = state.selectedKey();\n if (selectedKey != null && !isKeyDisabled(selectedKey)) {\n return selectedKey;\n }\n return findNextKey(null, \"forward\");\n };\n\n const openWithFocus = () => {\n if (state.isOpen() || !canOpen()) {\n return;\n }\n state.open();\n const focusKey = focusKeyForOpen();\n if (focusKey != null) {\n state.setFocusedKey(focusKey);\n }\n };\n\n const { pressProps } = createPress({\n get isDisabled() {\n return getProps().isDisabled ?? state.isDisabled;\n },\n onPress(e) {\n if (e.pointerType === \"keyboard\") {\n return;\n }\n\n if (state.isOpen()) {\n state.close();\n } else {\n openWithFocus();\n }\n },\n });\n\n // Type-to-select - for Select, typing directly selects items when closed\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.selectedKey(), // Use selectedKey as the \"focused\" key for closed Select\n onFocusedKeyChange: (key) => {\n // When closed, type-to-select directly changes selection\n if (!state.isOpen()) {\n state.setSelectedKey(key);\n } else {\n // When open, update focused key (listbox handles selection)\n state.setFocusedKey(key);\n }\n },\n isKeyDisabled,\n get isDisabled() {\n return Boolean(\n (getProps().disallowTypeAhead ?? false) || getProps().isDisabled || state.isDisabled,\n );\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (getProps().isDisabled ?? state.isDisabled) return;\n\n const currentKey = state.focusedKey() ?? state.selectedKey();\n\n switch (e.key) {\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (state.isOpen()) {\n state.close();\n } else {\n openWithFocus();\n }\n break;\n\n case \"ArrowDown\":\n e.preventDefault();\n if (!state.isOpen()) {\n if (!canOpen()) {\n return;\n }\n // ArrowDown: Open the dropdown and focus first/selected item\n state.open();\n const focusKey =\n currentKey != null && !isKeyDisabled(currentKey)\n ? currentKey\n : findNextKey(currentKey, \"forward\");\n if (focusKey) {\n state.setFocusedKey(focusKey);\n }\n }\n // When open, navigation is handled by the listbox\n break;\n\n case \"ArrowUp\":\n e.preventDefault();\n if (!state.isOpen()) {\n if (!canOpen()) {\n return;\n }\n // ArrowUp: Open the dropdown and focus last/selected item\n state.open();\n const focusKey =\n currentKey != null && !isKeyDisabled(currentKey)\n ? currentKey\n : findNextKey(currentKey, \"backward\");\n if (focusKey) {\n state.setFocusedKey(focusKey);\n }\n }\n // When open, navigation is handled by the listbox\n break;\n\n case \"ArrowRight\":\n // ArrowRight: Select next option (for horizontal keyboard navigation pattern)\n if (!state.isOpen()) {\n e.preventDefault();\n const nextKey = findNextKey(currentKey, \"forward\");\n if (nextKey != null) {\n state.setSelectedKey(nextKey);\n }\n }\n break;\n\n case \"ArrowLeft\":\n // ArrowLeft: Select previous option (for horizontal keyboard navigation pattern)\n if (!state.isOpen()) {\n e.preventDefault();\n const prevKey = findNextKey(currentKey, \"backward\");\n if (prevKey != null) {\n state.setSelectedKey(prevKey);\n }\n }\n break;\n\n case \"Home\":\n // Home: Select first option\n if (!state.isOpen()) {\n e.preventDefault();\n const firstKey = findNextKey(null, \"forward\");\n if (firstKey != null) {\n state.setSelectedKey(firstKey);\n }\n }\n break;\n\n case \"End\":\n // End: Select last option\n if (!state.isOpen()) {\n e.preventDefault();\n const lastKey = findNextKey(null, \"backward\");\n if (lastKey != null) {\n state.setSelectedKey(lastKey);\n }\n }\n break;\n\n case \"Escape\":\n if (state.isOpen()) {\n e.preventDefault();\n state.close();\n }\n break;\n }\n };\n\n // Handle focus events\n const handleFocus = (e: FocusEvent) => {\n state.setFocused(true);\n getProps().onFocus?.(e);\n getProps().onFocusChange?.(true);\n };\n\n const handleBlur = (e: FocusEvent) => {\n state.setFocused(false);\n getProps().onBlur?.(e);\n getProps().onFocusChange?.(false);\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get triggerProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n\n const baseProps = mergeProps(\n domProps(),\n pressProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n id: buttonId,\n type: \"button\",\n tabIndex: isDisabled ? undefined : 0,\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? listBoxId : undefined,\n \"aria-disabled\": isDisabled || undefined,\n \"aria-required\": p.isRequired || undefined,\n \"aria-describedby\": p[\"aria-describedby\"] || undefined,\n onKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n \"data-open\": isOpen || undefined,\n \"data-disabled\": isDisabled || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n } as Record<string, unknown>,\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(\n baseProps,\n typeSelectProps as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get valueProps() {\n return {\n id: valueId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get menuProps() {\n return {\n id: listBoxId,\n role: \"listbox\",\n \"aria-labelledby\": buttonId,\n \"aria-multiselectable\": state.selectionMode() === \"multiple\" ? true : undefined,\n tabIndex: -1,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isOpen: state.isOpen,\n selectedItem: state.selectedItem,\n };\n}\n","/**\n * createFormValidation hook for solidaria\n *\n * Connects form validation state to native HTML form validation.\n * Handles the invalid event, form reset, and focus management.\n *\n * Port of react-aria's useFormValidation.\n */\n\nimport { type Accessor, createEffect, onCleanup } from \"solid-js\";\nimport { type FormValidationState, type ValidationResult } from \"@proyecto-viviana/solid-stately\";\nimport { setInteractionModality } from \"../interactions/createInteractionModality\";\n\nexport type ValidatableElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n\nexport type ValidationBehavior = \"aria\" | \"native\";\n\nexport interface FormValidationProps {\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** Custom focus function to call on validation error. */\n focus?: () => void;\n}\n\nfunction getValidity(input: ValidatableElement): ValidityState {\n // Create a snapshot of the validity state (the native object is live)\n const validity = input.validity;\n return {\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n valid: validity.valid,\n };\n}\n\nfunction getNativeValidity(input: ValidatableElement): ValidationResult {\n return {\n isInvalid: !input.validity.valid,\n validationDetails: getValidity(input),\n validationErrors: input.validationMessage ? [input.validationMessage] : [],\n };\n}\n\nfunction getFirstInvalidInput(form: HTMLFormElement): ValidatableElement | null {\n for (let i = 0; i < form.elements.length; i++) {\n const element = form.elements[i] as ValidatableElement;\n if (!element.validity.valid) {\n return element;\n }\n }\n return null;\n}\n\n/**\n * Connects form validation state to a native HTML form input.\n *\n * This hook:\n * - Sets custom validity on the native input based on validation state\n * - Handles the 'invalid' event to commit validation and focus the first invalid input\n * - Handles form reset to clear validation state\n * - Handles input change to commit validation\n *\n * @example\n * ```tsx\n * function MyTextField(props) {\n * let inputRef: HTMLInputElement | undefined;\n *\n * const validationState = createFormValidationState({\n * value: props.value,\n * validate: props.validate,\n * validationBehavior: 'native',\n * });\n *\n * createFormValidation(\n * { validationBehavior: 'native' },\n * validationState,\n * () => inputRef\n * );\n *\n * return (\n * <input\n * ref={inputRef}\n * value={props.value}\n * aria-invalid={validationState.displayValidation().isInvalid || undefined}\n * />\n * );\n * }\n * ```\n */\nexport function createFormValidation(\n props: FormValidationProps,\n state: FormValidationState,\n ref: Accessor<ValidatableElement | undefined>,\n): void {\n const validationBehavior = () => props.validationBehavior ?? \"aria\";\n const focus = () => props.focus;\n\n // Track whether we should ignore form reset (for React-like programmatic resets)\n let isIgnoredReset = false;\n\n // Set custom validity on the native input\n createEffect(() => {\n const input = ref();\n if (validationBehavior() === \"native\" && input && !input.disabled) {\n const realtimeValidation = state.realtimeValidation();\n const errorMessage = realtimeValidation.isInvalid\n ? realtimeValidation.validationErrors.join(\" \") || \"Invalid value.\"\n : \"\";\n input.setCustomValidity(errorMessage);\n\n // Prevent default tooltip for validation message\n if (!input.hasAttribute(\"title\")) {\n input.title = \"\";\n }\n\n // Update validation with native validity if not already invalid\n if (!realtimeValidation.isInvalid) {\n state.updateValidation(getNativeValidity(input));\n }\n }\n });\n\n // Set up event listeners\n createEffect(() => {\n const input = ref();\n if (!input) {\n return;\n }\n\n const form = input.form;\n\n // Handle invalid event\n const onInvalid = (e: Event) => {\n // Only commit validation if we are not already displaying one\n if (!state.displayValidation().isInvalid) {\n state.commitValidation();\n }\n\n // Auto focus the first invalid input in a form\n if (!e.defaultPrevented && form && getFirstInvalidInput(form) === input) {\n const focusFn = focus();\n if (focusFn) {\n focusFn();\n } else {\n input.focus();\n }\n // Always show focus ring\n setInteractionModality(\"keyboard\");\n }\n\n // Prevent default browser error UI\n e.preventDefault();\n };\n\n // Handle change event\n const onChange = () => {\n state.commitValidation();\n };\n\n // Handle form reset\n const onReset = () => {\n if (!isIgnoredReset) {\n state.resetValidation();\n }\n };\n\n // Patch form.reset to detect programmatic resets\n let originalReset: (() => void) | undefined;\n if (form) {\n originalReset = form.reset.bind(form);\n form.reset = () => {\n // Ignore programmatic resets outside user events\n isIgnoredReset =\n !window.event ||\n (window.event.type === \"message\" && window.event.target instanceof MessagePort);\n originalReset?.();\n isIgnoredReset = false;\n };\n }\n\n input.addEventListener(\"invalid\", onInvalid);\n input.addEventListener(\"change\", onChange);\n form?.addEventListener(\"reset\", onReset);\n\n onCleanup(() => {\n input.removeEventListener(\"invalid\", onInvalid);\n input.removeEventListener(\"change\", onChange);\n form?.removeEventListener(\"reset\", onReset);\n if (form && originalReset) {\n form.reset = originalReset;\n }\n });\n });\n}\n","/**\n * Provides a hidden native select element for form integration.\n * Based on @react-aria/select useHiddenSelect.\n */\n\nimport { type JSX, type Accessor, For, createEffect, onCleanup } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { createFormValidation } from \"../form/createFormValidation\";\nimport type { SelectState, Key, FormValidationState } from \"@proyecto-viviana/solid-stately\";\n\nexport type ValidationBehavior = \"aria\" | \"native\";\n\nexport interface AriaHiddenSelectProps<T> {\n /** The state object for the select. */\n state: SelectState<T>;\n /** The name attribute for the hidden select. */\n name?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** Describes the type of autocomplete functionality the select should provide. */\n autoComplete?: string;\n /** The `form` attribute to associate the select with a form by ID. */\n form?: string;\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** A ref to the trigger element for focus on validation error. */\n triggerRef?: Accessor<HTMLElement | null>;\n /** Form validation state (optional, for native validation). */\n validationState?: FormValidationState;\n}\n\nexport interface HiddenSelectAria {\n /** Props for the container element. */\n containerProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the hidden select element. */\n selectProps: JSX.SelectHTMLAttributes<HTMLSelectElement>;\n /** Props for the hidden input element (for form submission). */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Provides the accessibility implementation for a hidden select.\n * This is used for native form submission and accessibility on mobile devices.\n */\nexport function createHiddenSelect<T>(\n props: MaybeAccessor<AriaHiddenSelectProps<T>>,\n): HiddenSelectAria {\n const getProps = () => access(props);\n\n // Track the select element for form reset/validation\n let selectRef: HTMLSelectElement | undefined;\n\n // Set up form reset handler\n createEffect(() => {\n const p = getProps();\n if (!selectRef) return;\n\n const form = selectRef.form;\n if (!form) return;\n\n const handleReset = () => {\n // Reset to default selected key (first key or null)\n const defaultKey = p.state.collection().getFirstKey();\n p.state.setSelectedKey(defaultKey);\n };\n\n form.addEventListener(\"reset\", handleReset);\n\n onCleanup(() => {\n form.removeEventListener(\"reset\", handleReset);\n });\n });\n\n // Set up form validation handler for native validation\n createEffect(() => {\n const p = getProps();\n if (!selectRef || p.validationBehavior !== \"native\" || !p.validationState) return;\n\n createFormValidation(\n {\n validationBehavior: p.validationBehavior,\n focus: () => p.triggerRef?.()?.focus(),\n },\n p.validationState,\n () => selectRef,\n );\n });\n\n return {\n get containerProps() {\n return {\n \"aria-hidden\": true,\n \"data-a11y-ignore\": \"aria-hidden-focus\",\n } as JSX.HTMLAttributes<HTMLDivElement>;\n },\n get selectProps() {\n const p = getProps();\n const state = p.state;\n const selectedKey = state.selectedKey();\n const selectedKeys =\n typeof state.selectedKeys === \"function\"\n ? state.selectedKeys()\n : selectedKey != null\n ? new Set([selectedKey])\n : new Set<Key>();\n const validationBehavior = p.validationBehavior ?? \"aria\";\n const isMultiple =\n typeof state.selectionMode === \"function\" && state.selectionMode() === \"multiple\";\n const multipleValue =\n selectedKeys === \"all\"\n ? Array.from(state.collection()).map((item) => String(item.key))\n : Array.from(selectedKeys).map(String);\n\n return {\n ref: (el: HTMLSelectElement) => {\n selectRef = el;\n },\n tabIndex: -1,\n autoComplete: p.autoComplete,\n disabled: p.isDisabled ?? state.isDisabled,\n multiple: isMultiple || undefined,\n name: p.name,\n form: p.form,\n // Add required attribute for native form validation\n required: validationBehavior === \"native\" && p.isRequired,\n value: isMultiple ? multipleValue : selectedKey != null ? String(selectedKey) : \"\",\n onChange: (e: Event) => {\n const target = e.target as HTMLSelectElement;\n if (isMultiple) {\n if (typeof state.setSelectedKeys === \"function\") {\n state.setSelectedKeys(Array.from(target.selectedOptions).map((o) => o.value as Key));\n } else {\n const first = target.selectedOptions[0]?.value;\n state.setSelectedKey((first ?? null) as Key | null);\n }\n } else {\n state.setSelectedKey(target.value as Key);\n }\n },\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n opacity: 0,\n \"font-size\": \"16px\", // Prevents zoom on iOS\n border: \"none\",\n cursor: \"default\",\n margin: 0,\n padding: 0,\n \"pointer-events\": \"none\",\n },\n } as JSX.SelectHTMLAttributes<HTMLSelectElement>;\n },\n get inputProps() {\n const p = getProps();\n const state = p.state;\n const selectedKey = state.selectedKey();\n const validationBehavior = p.validationBehavior ?? \"aria\";\n\n // For native validation with required, use type=\"text\" with display:none\n // so the browser will validate it on form submit\n const useTextInput = validationBehavior === \"native\" && p.isRequired;\n\n return {\n type: useTextInput ? \"text\" : \"hidden\",\n name: p.name,\n form: p.form,\n value: selectedKey != null ? String(selectedKey) : \"\",\n disabled: p.isDisabled ?? state.isDisabled,\n required: useTextInput ? p.isRequired : undefined,\n style: useTextInput ? { display: \"none\" } : undefined,\n } as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n };\n}\n\nexport interface HiddenSelectProps<T> {\n /** The state object for the select. */\n state: SelectState<T>;\n /** The name attribute for the hidden select. */\n name?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** A ref to the trigger element. */\n triggerRef?: () => HTMLElement | null;\n /** Label for the select. */\n label?: string;\n /** Describes the type of autocomplete functionality the select should provide. */\n autoComplete?: string;\n /** The `form` attribute to associate the select with a form by ID. */\n form?: string;\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** Form validation state (optional, for native validation). */\n validationState?: FormValidationState;\n}\n\n/**\n * A component that renders a hidden native select for form submission.\n * This is useful on mobile devices where native select behavior is preferred.\n */\nexport function HiddenSelect<T>(props: HiddenSelectProps<T>): JSX.Element {\n const { containerProps, selectProps } = createHiddenSelect({\n get state() {\n return props.state;\n },\n get name() {\n return props.name;\n },\n get isDisabled() {\n return props.isDisabled;\n },\n get isRequired() {\n return props.isRequired;\n },\n get autoComplete() {\n return props.autoComplete;\n },\n get form() {\n return props.form;\n },\n get validationBehavior() {\n return props.validationBehavior;\n },\n get triggerRef() {\n return props.triggerRef;\n },\n get validationState() {\n return props.validationState;\n },\n });\n\n const collection = () => props.state.collection();\n const selectedKey = () => props.state.selectedKey();\n const selectedKeys = () =>\n typeof props.state.selectedKeys === \"function\"\n ? props.state.selectedKeys()\n : selectedKey() != null\n ? new Set([selectedKey() as Key])\n : new Set<Key>();\n const isMultiple = () =>\n typeof props.state.selectionMode === \"function\" && props.state.selectionMode() === \"multiple\";\n\n return (\n <div {...containerProps}>\n <label>\n {props.label}\n <select {...selectProps}>\n <option />\n <For each={Array.from(collection())}>\n {(item) => (\n <option\n value={String(item.key)}\n selected={\n isMultiple()\n ? selectedKeys() === \"all\"\n ? true\n : (selectedKeys() as Set<Key>).has(item.key)\n : item.key === selectedKey()\n }\n >\n {item.textValue}\n </option>\n )}\n </For>\n </select>\n </label>\n </div>\n );\n}\n","/**\n * ARIA hooks for tab components.\n * Based on @react-aria/tabs.\n */\n\nimport { type Accessor, createEffect, createMemo } from \"solid-js\";\nimport { createFocusRing } from \"../interactions\";\nimport { createPress } from \"../interactions\";\nimport { createHover } from \"../interactions\";\nimport { createId } from \"../ssr\";\nimport { useLocale } from \"../i18n\";\nimport type { Key, Collection, CollectionNode } from \"@proyecto-viviana/solid-stately\";\n\nexport type TabOrientation = \"horizontal\" | \"vertical\";\nexport type KeyboardActivation = \"automatic\" | \"manual\";\n\nexport interface TabListState<T = unknown> {\n collection: Accessor<Collection<T>>;\n selectedKey: Accessor<Key | null>;\n setSelectedKey(key: Key): void;\n selectedItem: Accessor<CollectionNode<T> | null>;\n isDisabled: Accessor<boolean>;\n keyboardActivation: Accessor<KeyboardActivation>;\n orientation: Accessor<TabOrientation>;\n isKeyDisabled(key: Key): boolean;\n disabledKeys: Accessor<Set<Key>>;\n isFocused: Accessor<boolean>;\n setFocused(isFocused: boolean): void;\n focusedKey: Accessor<Key | null>;\n setFocusedKey(key: Key | null): void;\n}\n\nexport interface AriaTabListProps {\n /** The orientation of the tab list. */\n orientation?: TabOrientation;\n /** How tabs are activated (on focus or on click). */\n keyboardActivation?: KeyboardActivation;\n /** Whether the tab list is disabled. */\n isDisabled?: boolean;\n /** Label for the tab list. */\n \"aria-label\"?: string;\n /** ID of element that labels the tab list. */\n \"aria-labelledby\"?: string;\n /** ID of element that describes the tab list. */\n \"aria-describedby\"?: string;\n}\n\nexport interface TabListAria {\n /** Props for the tab list container element. */\n tabListProps: {\n role: \"tablist\";\n \"aria-orientation\": TabOrientation;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n onKeyDown: (e: KeyboardEvent) => void;\n onFocus: (e: FocusEvent) => void;\n onBlur: (e: FocusEvent) => void;\n };\n}\n\nexport interface AriaTabProps {\n /** The key of the tab. */\n key: Key;\n /** Whether the tab is disabled. */\n isDisabled?: boolean;\n /** Label for the tab. */\n \"aria-label\"?: string;\n /** ID reference for the tab label. */\n \"aria-labelledby\"?: string;\n}\n\nexport interface TabAria {\n /** Props for the tab element. */\n tabProps: {\n id: string;\n role: \"tab\";\n \"aria-selected\": boolean;\n \"aria-disabled\": boolean | undefined;\n \"aria-controls\": string | undefined;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n tabIndex: number;\n onKeyDown: (e: KeyboardEvent) => void;\n onMouseDown: (e: MouseEvent) => void;\n onPointerDown: (e: PointerEvent) => void;\n onClick: (e: MouseEvent) => void;\n onFocus: (e: FocusEvent) => void;\n };\n /** Whether the tab is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the tab is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the tab is pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the tab has focus. */\n isFocused: Accessor<boolean>;\n /** Whether the tab has visible focus ring. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the tab is hovered. */\n isHovered: Accessor<boolean>;\n}\n\nexport interface AriaTabPanelProps {\n /** The key of the associated tab. */\n id?: Key;\n /** Label for the tab panel. */\n \"aria-label\"?: string;\n /** ID of element that labels the tab panel. */\n \"aria-labelledby\"?: string;\n /** ID of element that describes the tab panel. */\n \"aria-describedby\"?: string;\n}\n\nexport interface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: {\n id: string;\n role: \"tabpanel\";\n \"aria-labelledby\"?: string;\n \"aria-label\"?: string;\n \"aria-describedby\"?: string;\n tabIndex: number;\n };\n /** Whether this panel is the selected one. */\n isSelected: Accessor<boolean>;\n}\n\nconst tabListIds = new WeakMap<TabListState<unknown>, string>();\n\nfunction getTabListId<T>(state: TabListState<T>): string {\n let id = tabListIds.get(state as TabListState<unknown>);\n if (!id) {\n id = createId();\n tabListIds.set(state as TabListState<unknown>, id);\n }\n return id;\n}\n\nfunction generateTabId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, \"-\");\n return `${baseId}-tab-${keyStr}`;\n}\n\nfunction generateTabPanelId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, \"-\");\n return `${baseId}-tabpanel-${keyStr}`;\n}\n\nfunction getNextKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[0] ?? null;\n\n // Find next non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const nextIndex = (currentIndex + i) % keys.length;\n const nextKey = keys[nextIndex];\n if (!state.isKeyDisabled(nextKey)) {\n return nextKey;\n }\n }\n\n return null;\n}\n\nfunction getPreviousKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[keys.length - 1] ?? null;\n\n // Find previous non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const prevIndex = (currentIndex - i + keys.length) % keys.length;\n const prevKey = keys[prevIndex];\n if (!state.isKeyDisabled(prevKey)) {\n return prevKey;\n }\n }\n\n return null;\n}\n\nfunction getFirstKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n for (const node of coll) {\n if (!state.isKeyDisabled(node.key)) {\n return node.key;\n }\n }\n return null;\n}\n\nfunction getLastKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n const keys = [...coll].map((node) => node.key).reverse();\n for (const key of keys) {\n if (!state.isKeyDisabled(key)) {\n return key;\n }\n }\n return null;\n}\n\n/**\n * Creates ARIA props for a tab list container.\n */\nexport function createTabList<T>(props: AriaTabListProps, state: TabListState<T>): TabListAria {\n const locale = useLocale();\n const orientation = () => props.orientation ?? state.orientation() ?? \"horizontal\";\n const keyboardActivation = () =>\n props.keyboardActivation ?? state.keyboardActivation() ?? \"automatic\";\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled()) return;\n\n const currentKey = state.focusedKey() ?? state.selectedKey();\n if (currentKey === null) return;\n\n let nextKey: Key | null = null;\n const isHorizontal = orientation() === \"horizontal\";\n const isRTL = locale().direction === \"rtl\";\n\n switch (e.key) {\n case \"ArrowLeft\":\n if (isHorizontal) {\n nextKey = isRTL ? getNextKey(state, currentKey) : getPreviousKey(state, currentKey);\n }\n break;\n case \"ArrowRight\":\n if (isHorizontal) {\n nextKey = isRTL ? getPreviousKey(state, currentKey) : getNextKey(state, currentKey);\n }\n break;\n case \"ArrowUp\":\n if (!isHorizontal) {\n nextKey = getPreviousKey(state, currentKey);\n }\n break;\n case \"ArrowDown\":\n if (!isHorizontal) {\n nextKey = getNextKey(state, currentKey);\n }\n break;\n case \"Home\":\n nextKey = getFirstKey(state);\n break;\n case \"End\":\n nextKey = getLastKey(state);\n break;\n case \"Enter\":\n case \" \":\n // In manual mode, Enter/Space activates the focused tab\n if (keyboardActivation() === \"manual\" && state.focusedKey()) {\n state.setSelectedKey(state.focusedKey()!);\n e.preventDefault();\n }\n return;\n default:\n return;\n }\n\n if (nextKey !== null) {\n e.preventDefault();\n state.setFocusedKey(nextKey);\n }\n };\n\n const handleFocus = () => {\n state.setFocused(true);\n // If no focused key, focus the selected key\n if (state.focusedKey() === null && state.selectedKey() !== null) {\n state.setFocusedKey(state.selectedKey());\n }\n };\n\n const handleBlur = (e: FocusEvent) => {\n // Only blur if focus is leaving the tab list entirely\n const relatedTarget = e.relatedTarget as Element | null;\n if (relatedTarget && (e.currentTarget as Element).contains(relatedTarget)) {\n return;\n }\n state.setFocused(false);\n };\n\n return {\n tabListProps: {\n role: \"tablist\",\n \"aria-orientation\": orientation(),\n \"aria-label\": props[\"aria-label\"],\n \"aria-labelledby\": props[\"aria-labelledby\"],\n \"aria-describedby\": props[\"aria-describedby\"],\n onKeyDown: handleKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n },\n };\n}\n\n/**\n * Creates ARIA props for an individual tab.\n */\nexport function createTab<T>(\n props: AriaTabProps,\n state: TabListState<T>,\n ref?: Accessor<HTMLElement | null>,\n): TabAria {\n const key = () => props.key;\n\n const isSelected = createMemo(() => state.selectedKey() === key());\n const isDisabled = createMemo(() => {\n if (props.isDisabled) return true;\n return state.isKeyDisabled(key());\n });\n\n const isFocused = createMemo(() => state.focusedKey() === key());\n\n // Focus ring\n const { isFocusVisible, focusProps } = createFocusRing();\n\n // Press handling\n const { isPressed, pressProps } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPress: () => {\n const tabKey = key();\n const wasSelected = state.selectedKey() === tabKey;\n\n state.setFocusedKey(tabKey);\n\n if (state.keyboardActivation() === \"manual\" || wasSelected) {\n state.setSelectedKey(tabKey);\n }\n },\n });\n\n // Hover handling\n const { isHovered } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n\n // Generate IDs\n const tabId = generateTabId(state, key());\n const tabPanelId = generateTabPanelId(state, key());\n\n // Helper to safely call event handlers that may be bound tuples\n const callHandler = <E extends Event>(handler: unknown, event: E) => {\n if (typeof handler === \"function\") {\n (handler as (e: E) => void)(event);\n return;\n }\n if (Array.isArray(handler) && handler.length >= 2 && typeof handler[1] === \"function\") {\n (handler[1] as (this: unknown, e: E) => void).call(handler[0], event);\n }\n };\n\n // Focus management\n const handleFocus = (e: FocusEvent) => {\n state.setFocusedKey(key());\n callHandler(focusProps.onFocus, e);\n };\n\n // Combine all handlers\n const handleKeyDown = (e: KeyboardEvent) => {\n callHandler(pressProps.onKeyDown, e);\n };\n\n const handleMouseDown = (e: MouseEvent) => {\n callHandler(pressProps.onMouseDown, e);\n };\n\n const handlePointerDown = (e: PointerEvent) => {\n callHandler(pressProps.onPointerDown, e);\n };\n\n const handleClick = (e: MouseEvent) => {\n callHandler(pressProps.onClick, e);\n };\n\n // Keep DOM focus aligned with focusedKey updates from keyboard delegate.\n createEffect(() => {\n const element = ref?.();\n if (!isFocused() || !element) return;\n\n const activeElement = element.ownerDocument?.activeElement;\n if (activeElement !== element) {\n element.focus();\n }\n });\n\n return {\n tabProps: {\n id: tabId,\n role: \"tab\",\n get \"aria-selected\"() {\n return isSelected();\n },\n get \"aria-disabled\"() {\n return isDisabled() || undefined;\n },\n get \"aria-controls\"() {\n return isSelected() ? tabPanelId : undefined;\n },\n \"aria-label\": props[\"aria-label\"],\n \"aria-labelledby\": props[\"aria-labelledby\"],\n get tabIndex() {\n return isSelected() && !isDisabled() ? 0 : -1;\n },\n onKeyDown: handleKeyDown,\n onMouseDown: handleMouseDown,\n onPointerDown: handlePointerDown,\n onClick: handleClick,\n onFocus: handleFocus,\n },\n isSelected,\n isDisabled,\n isPressed,\n isFocused,\n isFocusVisible,\n isHovered,\n };\n}\n\n/**\n * Creates ARIA props for a tab panel.\n */\nexport function createTabPanel<T>(\n props: AriaTabPanelProps,\n state: TabListState<T> | null,\n): TabPanelAria {\n const fallbackId = createId();\n\n // Shared panel pattern: if no explicit id is provided, associate the panel\n // with the currently selected tab.\n const associatedKey = createMemo<Key | null>(() => {\n if (state === null) return null;\n return props.id ?? state.selectedKey();\n });\n\n // If state is null, the panel is always visible (SSR fallback).\n const isSelected = createMemo(() => {\n if (state === null) return true;\n if (props.id === undefined) {\n return state.selectedKey() !== null;\n }\n return state.selectedKey() === props.id;\n });\n\n return {\n tabPanelProps: {\n get id() {\n const key = associatedKey();\n if (state && key !== null) {\n return generateTabPanelId(state, key);\n }\n return fallbackId;\n },\n role: \"tabpanel\",\n get \"aria-labelledby\"() {\n if (props[\"aria-labelledby\"]) return props[\"aria-labelledby\"];\n const key = associatedKey();\n if (state && key !== null) {\n return generateTabId(state, key);\n }\n return undefined;\n },\n \"aria-label\": props[\"aria-label\"],\n \"aria-describedby\": props[\"aria-describedby\"],\n // Make panel focusable if no tabbable children\n tabIndex: 0,\n },\n isSelected,\n };\n}\n","/**\n * Breadcrumbs hooks for Solidaria\n *\n * Provides accessibility implementation for breadcrumb navigation.\n * Port of @react-aria/breadcrumbs.\n */\n\nimport { createLink, type AriaLinkProps, type LinkAria } from \"../link\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\n\nexport interface AriaBreadcrumbsProps {\n /** Provides a label for the breadcrumbs navigation. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the breadcrumbs. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the breadcrumbs. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed description. */\n \"aria-details\"?: string;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n}\n\nexport interface BreadcrumbsAria {\n /** Props for the breadcrumbs nav element. */\n navProps: Record<string, unknown>;\n}\n\nexport interface AriaBreadcrumbItemProps extends Omit<AriaLinkProps, \"aria-current\"> {\n /** The DOM id for the breadcrumb item. */\n id?: string;\n /** Whether this is the current/last item in the breadcrumb trail. */\n isCurrent?: boolean;\n /** The type of current location for aria-current. @default 'page' */\n \"aria-current\"?: \"page\" | \"step\" | \"location\" | \"date\" | \"time\" | boolean;\n /** The HTML element type. @default 'a' */\n elementType?: string;\n}\n\nexport interface BreadcrumbItemAria extends LinkAria {\n /** Props for the breadcrumb item element. */\n itemProps: Record<string, unknown>;\n}\n\n/**\n * Provides accessibility implementation for the breadcrumbs navigation container.\n */\nexport function createBreadcrumbs(\n props: MaybeAccessor<AriaBreadcrumbsProps> = {},\n): BreadcrumbsAria {\n const getProps = () => access(props);\n\n const getNavProps = (): Record<string, unknown> => {\n const p = getProps();\n\n // Only apply a default label when no other label source exists.\n const ariaLabel = p[\"aria-label\"] ?? (p[\"aria-labelledby\"] ? undefined : \"Breadcrumbs\");\n\n return mergeProps(filterDOMProps(p as Record<string, unknown>, { labelable: true }), {\n \"aria-label\": ariaLabel,\n \"aria-details\": p[\"aria-details\"],\n });\n };\n\n return {\n get navProps() {\n return getNavProps();\n },\n };\n}\n\n/**\n * Provides accessibility implementation for an individual breadcrumb item.\n */\nexport function createBreadcrumbItem(\n props: MaybeAccessor<AriaBreadcrumbItemProps> = {},\n): BreadcrumbItemAria {\n const getProps = () => access(props);\n\n const isCurrent = () => getProps().isCurrent ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? \"a\";\n\n // Use createLink for base link behavior\n // Current items are treated as disabled (can't navigate to current page)\n const { linkProps, isPressed } = createLink({\n get isDisabled() {\n return isDisabled() || isCurrent();\n },\n get elementType() {\n return elementType();\n },\n get href() {\n return isCurrent() ? undefined : getProps().href;\n },\n get target() {\n return getProps().target;\n },\n get rel() {\n return getProps().rel;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onClick() {\n return getProps().onClick;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return getProps()[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return getProps()[\"aria-details\"];\n },\n });\n\n const getItemProps = (): Record<string, unknown> => {\n const p = getProps();\n const current = isCurrent();\n\n // Start with link props, forwarding id if provided\n let baseProps: Record<string, unknown> = p.id ? mergeProps(linkProps, { id: p.id }) : linkProps;\n\n // Add aria-current for current page\n if (current) {\n const ariaCurrent = p[\"aria-current\"] ?? \"page\";\n baseProps = mergeProps(baseProps, {\n \"aria-current\": ariaCurrent,\n });\n }\n\n // Add aria-disabled for disabled items\n if (isDisabled()) {\n baseProps = mergeProps(baseProps, {\n \"aria-disabled\": true,\n });\n }\n\n return baseProps;\n };\n\n return {\n get itemProps() {\n return getItemProps();\n },\n get linkProps() {\n return linkProps;\n },\n isPressed,\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a number field.\n * Based on @react-aria/numberfield useNumberField.\n */\n\nimport { type JSX, createMemo } from \"solid-js\";\nimport { createLabel } from \"../label/createLabel\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { NumberFieldState } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaButtonProps } from \"../button/types\";\nimport type { PressEvent } from \"../interactions\";\n\nexport interface AriaNumberFieldProps {\n /** A label for the number field. */\n label?: JSX.Element;\n /** An accessible label for the number field. */\n \"aria-label\"?: string;\n /** The element ID that labels the number field. */\n \"aria-labelledby\"?: string;\n /** The element ID that describes the number field. */\n \"aria-describedby\"?: string;\n /** Whether the number field is disabled. */\n isDisabled?: boolean;\n /** Whether the number field is read-only. */\n isReadOnly?: boolean;\n /** Whether the number field is required. */\n isRequired?: boolean;\n /** Whether the number field is invalid. */\n isInvalid?: boolean;\n /** A description for the number field. */\n description?: JSX.Element;\n /** An error message for the number field. */\n errorMessage?: JSX.Element;\n /** The ID of the number field. */\n id?: string;\n /** Whether to auto-focus the input. */\n autoFocus?: boolean;\n /** The name for the form input. */\n name?: string;\n /** The form element this input belongs to. */\n form?: string;\n /** Handler for focus events. */\n onFocus?: JSX.EventHandler<HTMLInputElement, FocusEvent>;\n /** Handler for blur events. */\n onBlur?: JSX.EventHandler<HTMLInputElement, FocusEvent>;\n /** Handler called when focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler for key down events. */\n onKeyDown?: JSX.EventHandler<HTMLInputElement, KeyboardEvent>;\n /** Handler for key up events. */\n onKeyUp?: JSX.EventHandler<HTMLInputElement, KeyboardEvent>;\n /** Handler for paste events. */\n onPaste?: JSX.EventHandler<HTMLInputElement, ClipboardEvent>;\n /** Handler for copy events. */\n onCopy?: JSX.EventHandler<HTMLInputElement, ClipboardEvent>;\n /** Handler for cut events. */\n onCut?: JSX.EventHandler<HTMLInputElement, ClipboardEvent>;\n}\n\nexport interface NumberFieldAria {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element group. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button. */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button. */\n decrementButtonProps: AriaButtonProps;\n /** Props for the description element. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field.\n */\nexport function createNumberField(\n props: MaybeAccessor<AriaNumberFieldProps>,\n state: NumberFieldState,\n inputRef?: () => HTMLInputElement | null,\n): NumberFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const incrementId = `${id}-increment`;\n const decrementId = `${id}-decrement`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Get the label text for button aria-labels\n const getLabelText = (): string => {\n const p = getProps();\n if (p[\"aria-label\"]) return p[\"aria-label\"];\n if (typeof p.label === \"string\") return p.label;\n return \"value\";\n };\n\n // Filter DOM props\n const domProps = createMemo(() =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true }),\n );\n\n // Handle input change\n const onInputChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n const value = e.currentTarget.value;\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n // Handle input blur - commit value\n const onInputBlur: JSX.EventHandler<HTMLInputElement, FocusEvent> = (e) => {\n state.commit();\n const p = getProps();\n p.onBlur?.(e);\n p.onFocusChange?.(false);\n };\n\n const onInputFocus: JSX.EventHandler<HTMLInputElement, FocusEvent> = (e) => {\n const p = getProps();\n p.onFocus?.(e);\n p.onFocusChange?.(true);\n };\n\n // Handle keyboard events\n const onKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) {\n p.onKeyDown?.(e);\n return;\n }\n\n switch (e.key) {\n case \"ArrowUp\":\n e.preventDefault();\n state.increment();\n break;\n case \"ArrowDown\":\n e.preventDefault();\n state.decrement();\n break;\n case \"PageUp\":\n e.preventDefault();\n state.incrementToMax();\n break;\n case \"PageDown\":\n e.preventDefault();\n state.decrementToMin();\n break;\n case \"Home\":\n e.preventDefault();\n state.decrementToMin();\n break;\n case \"End\":\n e.preventDefault();\n state.incrementToMax();\n break;\n case \"Enter\":\n state.commit();\n break;\n }\n\n p.onKeyDown?.(e);\n };\n\n const onKeyUp: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n getProps().onKeyUp?.(e);\n };\n\n const onButtonPressStart = (e: PressEvent) => {\n const input = inputRef?.();\n\n // Keep existing input focus in place. This avoids hiding software keyboards\n // and prevents a blur/refocus flicker when mouse pressing the steppers.\n if (input && input.ownerDocument.activeElement === input) {\n return;\n }\n\n if (e.pointerType === \"mouse\") {\n input?.focus();\n } else if (e.target instanceof HTMLElement) {\n e.target.focus();\n }\n };\n\n let incrementTouchPressUp = false;\n let decrementTouchPressUp = false;\n\n const onIncrementPressStart = (e: PressEvent) => {\n if (e.pointerType !== \"touch\") {\n state.increment();\n } else {\n incrementTouchPressUp = false;\n }\n\n onButtonPressStart(e);\n };\n\n const onIncrementPressUp = (e: PressEvent) => {\n if (e.pointerType === \"touch\") {\n incrementTouchPressUp = true;\n }\n };\n\n const onIncrementPressEnd = (e: PressEvent) => {\n if (e.pointerType === \"touch\" && incrementTouchPressUp) {\n state.increment();\n }\n\n incrementTouchPressUp = false;\n };\n\n const onDecrementPressStart = (e: PressEvent) => {\n if (e.pointerType !== \"touch\") {\n state.decrement();\n } else {\n decrementTouchPressUp = false;\n }\n\n onButtonPressStart(e);\n };\n\n const onDecrementPressUp = (e: PressEvent) => {\n if (e.pointerType === \"touch\") {\n decrementTouchPressUp = true;\n }\n };\n\n const onDecrementPressEnd = (e: PressEvent) => {\n if (e.pointerType === \"touch\" && decrementTouchPressUp) {\n state.decrement();\n }\n\n decrementTouchPressUp = false;\n };\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const parts: string[] = [];\n if (p[\"aria-describedby\"]) parts.push(p[\"aria-describedby\"]);\n if (p.description) parts.push(descriptionId);\n if (p.isInvalid && p.errorMessage) parts.push(errorMessageId);\n return parts.length > 0 ? parts.join(\" \") : undefined;\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get groupProps() {\n return {\n role: \"group\",\n \"aria-disabled\": getProps().isDisabled || undefined,\n \"aria-invalid\": getProps().isInvalid || undefined,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled();\n const isReadOnly = p.isReadOnly ?? state.isReadOnly();\n\n return mergeProps(\n domProps(),\n fieldProps as Record<string, unknown>,\n {\n id: inputId,\n type: \"text\",\n inputMode: \"decimal\" as const,\n autoComplete: \"off\",\n autoCorrect: \"off\",\n spellcheck: false,\n role: \"spinbutton\",\n \"aria-valuenow\": isNaN(state.numberValue()) ? undefined : state.numberValue(),\n \"aria-valuemin\": state.minValue(),\n \"aria-valuemax\": state.maxValue(),\n \"aria-valuetext\": isNaN(state.numberValue()) ? undefined : state.inputValue(),\n \"aria-invalid\": p.isInvalid || undefined,\n \"aria-required\": p.isRequired || undefined,\n \"aria-describedby\": getAriaDescribedBy(),\n disabled: isDisabled || undefined,\n readOnly: isReadOnly || undefined,\n required: p.isRequired || undefined,\n value: state.inputValue(),\n onInput: onInputChange,\n onChange: onInputChange,\n onFocus: onInputFocus,\n onBlur: onInputBlur,\n onKeyDown,\n onKeyUp,\n onPaste: p.onPaste,\n onCopy: p.onCopy,\n onCut: p.onCut,\n name: p.name,\n form: p.form,\n autoFocus: p.autoFocus,\n } as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get incrementButtonProps() {\n return {\n id: incrementId,\n \"aria-label\": `Increase ${getLabelText()}`,\n \"aria-controls\": inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n get isDisabled() {\n return !state.canIncrement();\n },\n onPressStart: onIncrementPressStart,\n onPressUp: onIncrementPressUp,\n onPressEnd: onIncrementPressEnd,\n } as AriaButtonProps;\n },\n get decrementButtonProps() {\n return {\n id: decrementId,\n \"aria-label\": `Decrease ${getLabelText()}`,\n \"aria-controls\": inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n get isDisabled() {\n return !state.canDecrement();\n },\n onPressStart: onDecrementPressStart,\n onPressUp: onDecrementPressUp,\n onPressEnd: onDecrementPressEnd,\n } as AriaButtonProps;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a search field.\n * A search field allows a user to enter and clear a search query.\n * Based on @react-aria/searchfield useSearchField.\n */\n\nimport { type JSX } from \"solid-js\";\nimport { createTextField, type AriaTextFieldProps, type TextFieldAria } from \"../textfield\";\nimport { mergeProps } from \"../utils\";\nimport { type MaybeAccessor, access } from \"../utils/reactivity\";\nimport type { SearchFieldState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaSearchFieldProps extends AriaTextFieldProps {\n /** Handler that is called when the user submits the search (pressing Enter). */\n onSubmit?: (value: string) => void;\n /** Handler that is called when the clear button is pressed or Escape clears the field. */\n onClear?: () => void;\n}\n\nexport interface SearchFieldAria extends Omit<TextFieldAria, \"inputProps\"> {\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the clear button. */\n clearButtonProps: {\n \"aria-label\": string;\n tabIndex: number;\n disabled?: boolean;\n onMouseDown: (e: MouseEvent) => void;\n onClick: () => void;\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search field.\n */\nexport function createSearchField(\n props: MaybeAccessor<AriaSearchFieldProps>,\n state: SearchFieldState,\n inputRef?: () => HTMLInputElement | null,\n): SearchFieldAria {\n const getProps = () => access(props);\n\n const setValue = (value: string) => {\n if (state.value() === value) {\n return;\n }\n\n state.setValue(value);\n getProps().onChange?.(value);\n };\n\n // Use createTextField for the base implementation\n const textFieldAria = createTextField({\n get value() {\n return state.value();\n },\n get isDisabled() {\n return getProps().isDisabled;\n },\n get isReadOnly() {\n return getProps().isReadOnly;\n },\n get isRequired() {\n return getProps().isRequired;\n },\n get isInvalid() {\n return getProps().isInvalid;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return getProps()[\"aria-describedby\"];\n },\n get description() {\n return getProps().description;\n },\n get errorMessage() {\n return getProps().errorMessage;\n },\n get placeholder() {\n return getProps().placeholder;\n },\n get name() {\n return getProps().name;\n },\n get form() {\n return getProps().form;\n },\n get validationBehavior() {\n return getProps().validationBehavior ?? \"native\";\n },\n get type() {\n return getProps().type ?? \"search\";\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get excludeFromTabOrder() {\n return getProps().excludeFromTabOrder;\n },\n get autoComplete() {\n return getProps().autoComplete;\n },\n get inputMode() {\n return getProps().inputMode;\n },\n get enterKeyHint() {\n return getProps().enterKeyHint;\n },\n get autoCorrect() {\n return getProps().autoCorrect;\n },\n get autoCapitalize() {\n return getProps().autoCapitalize;\n },\n get spellCheck() {\n return getProps().spellCheck;\n },\n get maxLength() {\n return getProps().maxLength;\n },\n get minLength() {\n return getProps().minLength;\n },\n get pattern() {\n return getProps().pattern;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get onCopy() {\n return getProps().onCopy;\n },\n get onCut() {\n return getProps().onCut;\n },\n get onPaste() {\n return getProps().onPaste;\n },\n get onCompositionStart() {\n return getProps().onCompositionStart;\n },\n get onCompositionEnd() {\n return getProps().onCompositionEnd;\n },\n get onCompositionUpdate() {\n return getProps().onCompositionUpdate;\n },\n get onSelect() {\n return getProps().onSelect;\n },\n get onBeforeInput() {\n return getProps().onBeforeInput;\n },\n get onInput() {\n return getProps().onInput;\n },\n onChange: setValue,\n });\n\n // Handle keyboard events for search field\n const onKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n\n if (p.isDisabled || p.isReadOnly) {\n if (e.key === \"Enter\") {\n e.preventDefault();\n }\n return;\n }\n\n if (e.key === \"Enter\" && p.onSubmit) {\n e.preventDefault();\n p.onSubmit(state.value());\n }\n\n if (e.key === \"Escape\") {\n const currentValue = state.value();\n const inputValue = inputRef?.()?.value ?? \"\";\n\n // Only clear if there's a value\n if (currentValue !== \"\" || inputValue !== \"\") {\n e.preventDefault();\n e.stopPropagation();\n const input = inputRef?.();\n if (input) {\n input.value = \"\";\n }\n setValue(\"\");\n p.onClear?.();\n }\n }\n };\n\n // Handle clear button click\n const onClearButtonClick = () => {\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n const input = inputRef?.();\n if (input) {\n input.value = \"\";\n }\n setValue(\"\");\n p.onClear?.();\n // Focus the input after clearing\n inputRef?.()?.focus();\n };\n\n // Prevent focus from leaving input on mobile when clicking clear button\n const onClearButtonMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n };\n\n return {\n get labelProps() {\n return textFieldAria.labelProps;\n },\n get inputProps() {\n return mergeProps(\n {\n onKeyDown,\n // Clear defaultValue since it's handled by state\n defaultValue: undefined,\n } as Record<string, unknown>,\n textFieldAria.inputProps as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get clearButtonProps() {\n const p = getProps();\n const isDisabled = p.isDisabled || p.isReadOnly;\n\n return {\n \"aria-label\": \"Clear search\",\n tabIndex: -1, // Exclude from tab order\n disabled: isDisabled,\n onMouseDown: onClearButtonMouseDown,\n onClick: onClearButtonClick,\n };\n },\n get descriptionProps() {\n return textFieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n };\n}\n","/**\n * Provides the behavior and accessibility implementation for a slider component.\n * A slider allows users to select a value from a range.\n * Based on @react-aria/slider useSlider.\n */\n\nimport { type JSX, onCleanup, onMount } from \"solid-js\";\nimport { createLabel } from \"../label/createLabel\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { focusWithoutScrolling } from \"../utils/focus\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { SliderState, SliderOrientation } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaSliderProps {\n /** An ID for the slider. */\n id?: string;\n /** Whether the slider is disabled. */\n isDisabled?: boolean;\n /** The label for the slider. */\n label?: JSX.Element;\n /** An accessible label for the slider when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the slider. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the slider. */\n \"aria-describedby\"?: string;\n /** The orientation of the slider. */\n orientation?: SliderOrientation;\n /** The name for the form input. */\n name?: string;\n /** The form element this input belongs to. */\n form?: string;\n}\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the root group element. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the track element. */\n trackProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the thumb element. */\n thumbProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the hidden input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the output element (showing current value). */\n outputProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider.\n */\nexport function createSlider(\n props: MaybeAccessor<AriaSliderProps>,\n state: SliderState,\n trackRef?: () => HTMLElement | null,\n inputRef?: () => HTMLInputElement | null,\n): SliderAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const outputId = `${id}-output`;\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n within: true,\n });\n\n // Track pointer state for drag handling\n let currentPointerId: number | null = null;\n\n // Calculate position from pointer event\n const getPositionFromPointer = (clientX: number, clientY: number): number => {\n const track = trackRef?.();\n if (!track) return 0;\n\n const rect = track.getBoundingClientRect();\n const isVertical = state.orientation === \"vertical\";\n\n let position: number;\n if (isVertical) {\n position = (rect.bottom - clientY) / rect.height;\n } else {\n position = (clientX - rect.left) / rect.width;\n }\n\n return Math.max(0, Math.min(1, position));\n };\n\n // Handle pointer down on track\n const onTrackPointerDown = (e: PointerEvent) => {\n if (state.isDisabled || e.button !== 0) return;\n\n e.preventDefault();\n currentPointerId = e.pointerId;\n\n const track = trackRef?.();\n if (track) {\n track.setPointerCapture(e.pointerId);\n }\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n focusWithoutScrolling(inputRef?.() ?? null);\n state.setDragging(true);\n };\n\n // Handle pointer move for dragging\n const onTrackPointerMove = (e: PointerEvent) => {\n if (!state.isDragging() || e.pointerId !== currentPointerId) return;\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n };\n\n // Handle pointer up to end drag\n const onTrackPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== currentPointerId) return;\n\n const track = trackRef?.();\n if (track) {\n track.releasePointerCapture(e.pointerId);\n }\n\n currentPointerId = null;\n focusWithoutScrolling(inputRef?.() ?? null);\n state.setDragging(false);\n };\n\n // Keyboard navigation that is not consistently handled by the native range input.\n const onThumbKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled) return;\n\n switch (e.key) {\n case \"PageUp\":\n e.preventDefault();\n state.increment(state.pageStep / state.step);\n break;\n case \"PageDown\":\n e.preventDefault();\n state.decrement(state.pageStep / state.step);\n break;\n case \"Home\":\n e.preventDefault();\n state.setValue(state.minValue);\n break;\n case \"End\":\n e.preventDefault();\n state.setValue(state.maxValue);\n break;\n }\n };\n\n // Handle focus events\n const onFocus = () => {\n state.setFocused(true);\n };\n\n const onBlur = () => {\n state.setFocused(false);\n };\n\n // Handle pointer down on thumb (for direct thumb dragging)\n const onThumbPointerDown = (e: PointerEvent) => {\n if (state.isDisabled || e.button !== 0) return;\n\n e.preventDefault();\n e.stopPropagation(); // Prevent track from also handling\n currentPointerId = e.pointerId;\n focusWithoutScrolling(inputRef?.() ?? null);\n\n // Capture pointer on document for smooth dragging\n document.body.setPointerCapture(e.pointerId);\n state.setDragging(true);\n };\n\n // Global pointer move handler for thumb dragging\n const onDocumentPointerMove = (e: PointerEvent) => {\n if (!state.isDragging() || e.pointerId !== currentPointerId) return;\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n };\n\n // Global pointer up handler\n const onDocumentPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== currentPointerId) return;\n\n try {\n document.body.releasePointerCapture(e.pointerId);\n } catch {\n // Ignore if capture was already released\n }\n\n currentPointerId = null;\n focusWithoutScrolling(inputRef?.() ?? null);\n state.setDragging(false);\n };\n\n // Set up global listeners on mount (client-side only)\n onMount(() => {\n if (typeof document === \"undefined\") return;\n\n document.addEventListener(\"pointermove\", onDocumentPointerMove);\n document.addEventListener(\"pointerup\", onDocumentPointerUp);\n document.addEventListener(\"pointercancel\", onDocumentPointerUp);\n\n // Cleanup when component unmounts\n onCleanup(() => {\n document.removeEventListener(\"pointermove\", onDocumentPointerMove);\n document.removeEventListener(\"pointerup\", onDocumentPointerUp);\n document.removeEventListener(\"pointercancel\", onDocumentPointerUp);\n });\n });\n\n const labelledBy = () => (fieldProps as { \"aria-labelledby\"?: string })[\"aria-labelledby\"];\n const ariaLabel = () => (fieldProps as { \"aria-label\"?: string })[\"aria-label\"];\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get groupProps() {\n return mergeProps(\n domProps(),\n fieldProps as Record<string, unknown>,\n {\n role: \"group\",\n \"data-disabled\": state.isDisabled || undefined,\n \"data-orientation\": state.orientation,\n } as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n get trackProps() {\n return {\n onPointerDown: onTrackPointerDown,\n onPointerMove: onTrackPointerMove,\n onPointerUp: onTrackPointerUp,\n onPointerCancel: onTrackPointerUp,\n style: {\n position: \"relative\",\n \"touch-action\": \"none\",\n },\n \"data-disabled\": state.isDisabled || undefined,\n \"data-orientation\": state.orientation,\n \"data-dragging\": state.isDragging() || undefined,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get thumbProps() {\n const percent = state.getValuePercent();\n const isVertical = state.orientation === \"vertical\";\n\n return {\n onPointerDown: onThumbPointerDown,\n onKeyDown: onThumbKeyDown,\n style: {\n position: \"absolute\",\n [isVertical ? \"bottom\" : \"left\"]: `${percent * 100}%`,\n transform: isVertical ? \"translateY(50%)\" : \"translateX(-50%)\",\n \"touch-action\": \"none\",\n },\n \"data-disabled\": state.isDisabled || undefined,\n \"data-dragging\": state.isDragging() || undefined,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n const p = getProps();\n\n return mergeProps(\n focusProps as Record<string, unknown>,\n {\n type: \"range\",\n id: inputId,\n min: state.minValue,\n max: state.maxValue,\n step: state.step,\n value: state.value(),\n name: p.name,\n form: p.form,\n disabled: state.isDisabled,\n \"aria-orientation\": state.orientation,\n \"aria-valuetext\": state.getFormattedValue(),\n \"aria-labelledby\": labelledBy(),\n \"aria-label\": labelledBy() ? undefined : ariaLabel(),\n tabIndex: state.isDisabled ? undefined : 0,\n onInput: (e: Event) => {\n const target = e.target as HTMLInputElement;\n state.setValue(parseFloat(target.value));\n },\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n state.setValue(parseFloat(target.value));\n },\n onFocus,\n onBlur,\n } as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get outputProps() {\n return {\n id: outputId,\n for: inputId,\n \"aria-live\": \"off\",\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n","/**\n * createTooltip hook for Solidaria\n *\n * Provides the accessibility implementation for a Tooltip component.\n *\n * Port of @react-aria/tooltip useTooltip.\n */\n\nimport { type JSX } from \"solid-js\";\nimport { type TooltipTriggerState } from \"@proyecto-viviana/solid-stately\";\nimport { createHover } from \"../interactions/createHover\";\nimport { filterDOMProps, mergeProps } from \"../utils\";\n\nexport interface TooltipProps {\n /** Whether the tooltip is disabled. */\n isDisabled?: boolean;\n /** Custom aria-label for the tooltip. */\n \"aria-label\"?: string;\n /** ID of an element that labels the tooltip. */\n \"aria-labelledby\"?: string;\n /** ID of an element that describes the tooltip. */\n \"aria-describedby\"?: string;\n}\n\nexport interface TooltipAria {\n /** Props to spread on the tooltip element. */\n tooltipProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the accessibility implementation for a Tooltip component.\n *\n * When hovering over the tooltip itself, it stays open. When the mouse leaves\n * the tooltip, it closes.\n *\n * @example\n * ```tsx\n * import { createTooltip } from 'solidaria';\n * import { createTooltipTriggerState } from 'solid-stately';\n *\n * function Tooltip(props) {\n * const state = props.state;\n * const { tooltipProps } = createTooltip(props, state);\n *\n * return (\n * <div {...tooltipProps} role=\"tooltip\">\n * {props.children}\n * </div>\n * );\n * }\n * ```\n */\nexport function createTooltip(props: TooltipProps = {}, state?: TooltipTriggerState): TooltipAria {\n const domProps = filterDOMProps(props, { labelable: true });\n\n const { hoverProps } = createHover({\n onHoverStart: () => state?.open(true),\n onHoverEnd: () => state?.close(),\n });\n\n return {\n tooltipProps: mergeProps<JSX.HTMLAttributes<HTMLElement>>(domProps, hoverProps, {\n role: \"tooltip\",\n }),\n };\n}\n","/**\n * createTooltipTrigger hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tooltip trigger,\n * e.g. a button that shows a description when focused or hovered.\n *\n * Port of @react-aria/tooltip useTooltipTrigger.\n */\n\nimport { type JSX, createEffect, onCleanup } from \"solid-js\";\nimport { type TooltipTriggerState } from \"@proyecto-viviana/solid-stately\";\nimport { createHover } from \"../interactions/createHover\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { createId } from \"../ssr\";\n\nexport interface TooltipTriggerProps {\n /** Whether the tooltip should be disabled. */\n isDisabled?: boolean;\n /**\n * The trigger mechanism for the tooltip.\n * @default 'hover'\n */\n trigger?: \"focus\" | \"hover\";\n /**\n * Whether the tooltip should close when the trigger is pressed.\n * @default true\n */\n shouldCloseOnPress?: boolean;\n /**\n * ID of the tooltip element.\n * @internal Used by component wrappers to merge explicit tooltip ids with trigger aria-describedby.\n */\n tooltipId?: string;\n}\n\nexport interface TooltipTriggerAria {\n /** Props to spread on the trigger element. */\n triggerProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to spread on the tooltip element (id for accessibility). */\n tooltipProps: { readonly id: string };\n}\n\ntype Modality = \"keyboard\" | \"pointer\" | \"virtual\";\nlet currentModality: Modality | null = null;\n\n// Track interaction modality (pointer vs keyboard)\nif (typeof document !== \"undefined\") {\n document.addEventListener(\n \"keydown\",\n () => {\n currentModality = \"keyboard\";\n },\n true,\n );\n document.addEventListener(\n \"pointerdown\",\n () => {\n currentModality = \"pointer\";\n },\n true,\n );\n document.addEventListener(\n \"pointermove\",\n () => {\n currentModality = \"pointer\";\n },\n true,\n );\n}\n\nfunction isFocusVisible(): boolean {\n return currentModality === \"keyboard\";\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tooltip trigger.\n *\n * @example\n * ```tsx\n * import { createTooltipTrigger } from 'solidaria';\n * import { createTooltipTriggerState } from 'solid-stately';\n *\n * function TooltipButton(props) {\n * let ref;\n * const state = createTooltipTriggerState({ delay: 500 });\n * const { triggerProps, tooltipProps } = createTooltipTrigger(\n * { isDisabled: props.isDisabled },\n * state,\n * () => ref\n * );\n *\n * return (\n * <>\n * <button ref={ref} {...triggerProps}>\n * Hover me\n * </button>\n * <Show when={state.isOpen()}>\n * <div {...tooltipProps}>Tooltip content</div>\n * </Show>\n * </>\n * );\n * }\n * ```\n */\nexport function createTooltipTrigger(\n props: TooltipTriggerProps,\n state: TooltipTriggerState,\n ref: () => HTMLElement | null | undefined,\n): TooltipTriggerAria {\n const isDisabled = () => props.isDisabled ?? false;\n const trigger = () => props.trigger ?? \"hover\";\n const shouldCloseOnPress = () => props.shouldCloseOnPress ?? true;\n\n const generatedTooltipId = createId();\n const tooltipId = () => props.tooltipId ?? generatedTooltipId;\n\n // Track hover and focus state\n let isHovered = false;\n let isFocused = false;\n\n const handleShow = () => {\n if (!isDisabled() && (isHovered || isFocused)) {\n state.open(isFocused);\n }\n };\n\n const handleHide = (immediate?: boolean) => {\n if (!isHovered && !isFocused) {\n state.close(immediate);\n }\n };\n\n // Handle Escape key to dismiss tooltip\n createEffect(() => {\n if (!state.isOpen()) return;\n\n const onKeyDown = (e: KeyboardEvent) => {\n const element = ref();\n if (element) {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n state.close(true);\n }\n }\n };\n\n document.addEventListener(\"keydown\", onKeyDown, true);\n onCleanup(() => {\n document.removeEventListener(\"keydown\", onKeyDown, true);\n });\n });\n\n const onHoverStart = () => {\n if (isDisabled() || trigger() === \"focus\") {\n return;\n }\n // Hover events (onPointerEnter) only fire from pointer interactions,\n // so we can always set isHovered to true here\n isHovered = true;\n handleShow();\n };\n\n const onHoverEnd = () => {\n if (isDisabled() || trigger() === \"focus\") {\n return;\n }\n isFocused = false;\n isHovered = false;\n handleHide();\n };\n\n const closeOnPress = () => {\n if (isDisabled() || !shouldCloseOnPress()) {\n return;\n }\n isFocused = false;\n isHovered = false;\n handleHide(true);\n };\n\n const onKeyDownPress = (event: KeyboardEvent) => {\n if (event.key !== \"Enter\" && event.key !== \" \" && event.key !== \"Spacebar\") {\n return;\n }\n closeOnPress();\n };\n\n const onFocus = () => {\n if (isDisabled()) {\n return;\n }\n\n const visible = isFocusVisible();\n if (visible) {\n isFocused = true;\n handleShow();\n }\n };\n\n const onBlur = () => {\n isFocused = false;\n isHovered = false;\n handleHide(true);\n };\n\n const { hoverProps } = createHover(() => ({\n isDisabled: isDisabled(),\n onHoverStart,\n onHoverEnd,\n }));\n\n const { focusableProps } = createFocusable({\n isDisabled,\n onFocus,\n onBlur,\n });\n\n const triggerProps = {\n ...focusableProps,\n ...hoverProps,\n get \"aria-describedby\"() {\n return !isDisabled() && state.isOpen() ? tooltipId() : undefined;\n },\n onPointerDown: closeOnPress,\n onKeyDown: onKeyDownPress,\n // Remove tabIndex set by focusableProps to avoid overriding\n tabIndex: undefined,\n };\n\n return {\n triggerProps: triggerProps as JSX.HTMLAttributes<HTMLElement>,\n tooltipProps: {\n get id() {\n return tooltipId();\n },\n },\n };\n}\n","/**\n * Live announcer for solidaria\n *\n * Provides functions to make announcements to screen readers using\n * ARIA live regions. Useful for announcing dynamic content changes.\n *\n * Port of react-aria's @react-aria/live-announcer.\n *\n * SSR Safety: All functions are safe to call during SSR. The announcer\n * will only be created when running in the browser.\n */\n\nimport { onCleanup, createEffect } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport type Assertiveness = \"assertive\" | \"polite\";\n\nexport type Message = string | { \"aria-labelledby\": string };\n\nconst LIVEREGION_TIMEOUT_DELAY = 7000;\n\n/**\n * Singleton class that manages live region announcements.\n * Implemented using vanilla DOM for simplicity and framework independence.\n */\nclass LiveAnnouncer {\n node: HTMLElement | null = null;\n assertiveLog: HTMLElement | null = null;\n politeLog: HTMLElement | null = null;\n\n constructor() {\n if (typeof document !== \"undefined\") {\n this.node = document.createElement(\"div\");\n this.node.dataset.liveAnnouncer = \"true\";\n // Visually hidden styles\n Object.assign(this.node.style, {\n border: \"0\",\n clip: \"rect(0 0 0 0)\",\n clipPath: \"inset(50%)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0\",\n position: \"absolute\",\n width: \"1px\",\n whiteSpace: \"nowrap\",\n });\n\n this.assertiveLog = this.createLog(\"assertive\");\n this.node.appendChild(this.assertiveLog);\n\n this.politeLog = this.createLog(\"polite\");\n this.node.appendChild(this.politeLog);\n\n document.body.prepend(this.node);\n }\n }\n\n isAttached(): boolean {\n return this.node?.isConnected ?? false;\n }\n\n createLog(ariaLive: string): HTMLElement {\n const node = document.createElement(\"div\");\n node.setAttribute(\"role\", \"log\");\n node.setAttribute(\"aria-live\", ariaLive);\n node.setAttribute(\"aria-relevant\", \"additions\");\n return node;\n }\n\n destroy(): void {\n if (!this.node) {\n return;\n }\n\n document.body.removeChild(this.node);\n this.node = null;\n }\n\n announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ): void {\n if (!this.node) {\n return;\n }\n\n const node = document.createElement(\"div\");\n if (typeof message === \"object\") {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute(\"role\", \"img\");\n node.setAttribute(\"aria-labelledby\", message[\"aria-labelledby\"]);\n } else {\n node.textContent = message;\n }\n\n if (assertiveness === \"assertive\") {\n this.assertiveLog?.appendChild(node);\n } else {\n this.politeLog?.appendChild(node);\n }\n\n if (message !== \"\") {\n setTimeout(() => {\n node.remove();\n }, timeout);\n }\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!this.node) {\n return;\n }\n\n if ((!assertiveness || assertiveness === \"assertive\") && this.assertiveLog) {\n this.assertiveLog.innerHTML = \"\";\n }\n\n if ((!assertiveness || assertiveness === \"polite\") && this.politeLog) {\n this.politeLog.innerHTML = \"\";\n }\n }\n}\n\nlet liveAnnouncer: LiveAnnouncer | null = null;\n\n/**\n * Announces a message to screen readers using ARIA live regions.\n *\n * @param message - The message to announce, or an object with aria-labelledby\n * @param assertiveness - 'assertive' interrupts, 'polite' waits for a pause\n * @param timeout - How long to keep the message in the DOM (default 7000ms)\n *\n * @example\n * ```tsx\n * // Simple announcement\n * announce('Item added to cart');\n *\n * // Polite announcement (won't interrupt)\n * announce('3 results found', 'polite');\n *\n * // Using aria-labelledby for complex content\n * announce({ 'aria-labelledby': 'my-element-id' });\n * ```\n */\nexport function announce(\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n): void {\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n // Wait for the live announcer regions to be added to the DOM, then announce.\n // Otherwise Safari won't announce the message if it's added too quickly.\n // Found most times less than 100ms were not consistent when announcing with Safari.\n\n // Check for test environment\n const isTestEnv =\n typeof (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST === \"boolean\"\n ? (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST\n : typeof (globalThis as Record<string, unknown>).vitest !== \"undefined\";\n\n if (!isTestEnv) {\n setTimeout(() => {\n if (liveAnnouncer?.isAttached()) {\n liveAnnouncer?.announce(message, assertiveness, timeout);\n }\n }, 100);\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n}\n\n/**\n * Clears all queued announcements for the given assertiveness level.\n *\n * @param assertiveness - Which log to clear ('assertive' or 'polite')\n *\n * @example\n * ```tsx\n * // Clear assertive announcements\n * clearAnnouncer('assertive');\n *\n * // Clear polite announcements\n * clearAnnouncer('polite');\n * ```\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n if (liveAnnouncer) {\n liveAnnouncer.clear(assertiveness);\n }\n}\n\n/**\n * Removes the live announcer from the DOM entirely.\n * Call this when unmounting your app or when announcements are no longer needed.\n *\n * @example\n * ```tsx\n * // Clean up on app unmount\n * onCleanup(() => {\n * destroyAnnouncer();\n * });\n * ```\n */\nexport function destroyAnnouncer(): void {\n if (liveAnnouncer) {\n liveAnnouncer.destroy();\n liveAnnouncer = null;\n }\n}\n\nexport interface UseAnnouncerResult {\n /** Announce a message to screen readers. */\n announce: (message: Message, assertiveness?: Assertiveness, timeout?: number) => void;\n /** Clear announcements for the given assertiveness level. */\n clear: (assertiveness?: Assertiveness) => void;\n}\n\n/**\n * Hook that provides access to the live announcer with automatic cleanup.\n *\n * This is the recommended way to use the announcer in SolidJS components.\n * It ensures the announcer is created only on the client and provides\n * type-safe methods for announcing and clearing messages.\n *\n * SSR Safety: Returns no-op functions during SSR. The announcer is only\n * created when the component mounts on the client.\n *\n * @example\n * ```tsx\n * function SearchResults(props) {\n * const announcer = useAnnouncer();\n *\n * createEffect(() => {\n * const count = props.results.length;\n * announcer.announce(`${count} results found`, 'polite');\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Form() {\n * const announcer = useAnnouncer();\n *\n * const onSubmit = async () => {\n * try {\n * await submitForm();\n * announcer.announce('Form submitted successfully');\n * } catch (error) {\n * announcer.announce('Error submitting form', 'assertive');\n * }\n * };\n *\n * return <form onSubmit={onSubmit}>...</form>;\n * }\n * ```\n */\nexport function useAnnouncer(): UseAnnouncerResult {\n // During SSR, return no-op functions\n if (isServer) {\n return {\n announce: () => {},\n clear: () => {},\n };\n }\n\n // Ensure the announcer is initialized\n createEffect(() => {\n // Initialize on first use\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n }\n });\n\n return {\n announce: (\n message: Message,\n assertiveness: Assertiveness = \"assertive\",\n timeout: number = LIVEREGION_TIMEOUT_DELAY,\n ) => {\n announce(message, assertiveness, timeout);\n },\n clear: (assertiveness?: Assertiveness) => {\n clearAnnouncer(assertiveness);\n },\n };\n}\n","","","/**\n * ComboBox internationalization strings\n * Based on @react-aria/combobox/intl\n */\n\nimport type { LocalizedStrings } from \"@internationalized/string\";\n\n// Import locale files\nimport enUS from \"./en-US.json\" with { type: \"json\" };\nimport esES from \"./es-ES.json\" with { type: \"json\" };\n\nexport type ComboBoxIntlStrings = {\n focusAnnouncement: string;\n countAnnouncement: string;\n selectedAnnouncement: string;\n buttonLabel: string;\n listboxLabel: string;\n};\n\nexport const comboBoxIntlStrings: LocalizedStrings<keyof ComboBoxIntlStrings, string> = {\n \"en-US\": enUS,\n \"es-ES\": esES,\n};\n","/**\n * Provides the behavior and accessibility implementation for a combobox component.\n * A combobox combines a text input with a listbox, allowing users to filter a list of options.\n * Based on @react-aria/combobox useComboBox.\n */\n\nimport { type JSX, type Accessor, createEffect, onCleanup } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { createPress } from \"../interactions/createPress\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { createLabel } from \"../label/createLabel\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { isAppleDevice } from \"../utils/platform\";\nimport { openLink } from \"../utils/dom\";\nimport { ariaHideOutside } from \"../overlays/ariaHideOutside\";\nimport { announce } from \"../live-announcer\";\nimport { createStringFormatter } from \"../i18n\";\nimport { comboBoxIntlStrings } from \"./intl\";\nimport { isDevEnv } from \"../utils/env\";\nimport type { ComboBoxState, CollectionNode, Key } from \"@proyecto-viviana/solid-stately\";\n\n/**\n * Helper to count items in a collection\n */\nfunction getItemCount<T>(collection: { getKeys(): Iterable<Key> }): number {\n let count = 0;\n for (const _ of collection.getKeys()) {\n count++;\n }\n return count;\n}\n\nexport interface AriaComboBoxProps {\n /** An ID for the combobox. */\n id?: string;\n /** Whether the combobox is disabled. */\n isDisabled?: boolean;\n /** Whether the combobox is required. */\n isRequired?: boolean;\n /** Whether the combobox is read-only. */\n isReadOnly?: boolean;\n /** The label for the combobox. */\n label?: JSX.Element;\n /** An accessible label for the combobox when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the combobox. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the combobox. */\n \"aria-describedby\"?: string;\n /** Description text for assistive technology and form help. */\n description?: string;\n /** Error message text for assistive technology and validation feedback. */\n errorMessage?: string;\n /** Whether the current value is invalid. */\n isInvalid?: boolean;\n /** Placeholder text for the input when no value is entered. */\n placeholder?: string;\n /** Whether the combobox should be auto-focused. */\n autoFocus?: boolean;\n /** Handler called when focus moves to the combobox input. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves away from the combobox input. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** The name of the combobox, used when submitting an HTML form. */\n name?: string;\n /** The form owner for the combobox input. */\n form?: string;\n /**\n * Describes the type of autocomplete functionality the input should provide.\n * @default 'list'\n */\n autoComplete?: \"list\" | \"none\" | \"inline\" | \"both\";\n /** Whether focus should wrap from the last item to the first. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface ComboBoxAria<T> {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the trigger button element. */\n buttonProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox popup. */\n listBoxProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the input is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the input has keyboard focus. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the listbox is currently open. */\n isOpen: Accessor<boolean>;\n /** The currently selected item. */\n selectedItem: Accessor<CollectionNode<T> | null>;\n}\n\n// Shared data between combobox and options\nconst comboBoxData = new WeakMap<object, ComboBoxData>();\n\ninterface ComboBoxData {\n id: string;\n listBoxId: string;\n}\n\nexport function getComboBoxData(state: ComboBoxState<unknown>): ComboBoxData | undefined {\n return comboBoxData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combobox component.\n */\nexport function createComboBox<T>(\n props: MaybeAccessor<AriaComboBoxProps>,\n state: ComboBoxState<T>,\n inputRef: () => HTMLInputElement | null,\n buttonRef?: () => HTMLElement | null,\n listBoxRef?: () => HTMLElement | null,\n): ComboBoxAria<T> {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\n \"[solidaria] A ComboBox requires a label, aria-label, or aria-labelledby attribute for accessibility.\",\n );\n }\n }\n\n // Track if a pointerdown happened inside the listbox to prevent blur from closing\n let isPointerDownInsideListBox = false;\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const buttonId = `${id}-button`;\n const listBoxId = `${id}-listbox`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.isInvalid && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n // Set up global pointerdown listener to track clicks inside listbox\n // This is needed because the option's createPress stops propagation\n createEffect(() => {\n if (typeof document === \"undefined\") return;\n\n const handleGlobalPointerDown = (e: PointerEvent) => {\n const target = e.target as HTMLElement;\n // Check if the click is inside the listbox\n if (target.closest(`[id=\"${listBoxId}\"]`)) {\n isPointerDownInsideListBox = true;\n }\n };\n\n document.addEventListener(\"pointerdown\", handleGlobalPointerDown, true);\n\n onCleanup(() => {\n document.removeEventListener(\"pointerdown\", handleGlobalPointerDown, true);\n });\n });\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, {\n labelable: true,\n propNames: new Set([\"form\"]),\n });\n\n // Share data with child options\n createEffect(() => {\n comboBoxData.set(state, { id, listBoxId });\n\n onCleanup(() => {\n comboBoxData.delete(state);\n });\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"label\",\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n get autoFocus() {\n return getProps().autoFocus;\n },\n });\n\n // Track focus state from state\n const isFocused = state.isFocused;\n\n // String formatter for VoiceOver announcements\n // Only create on client side\n const stringFormatter = !isServer ? createStringFormatter(comboBoxIntlStrings) : null;\n\n // Track previous values for announcements\n let lastFocusedKey: Key | null = null;\n let lastSelectedKey: Key | null = null;\n let lastOptionCount = 0;\n let lastIsOpen = false;\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. This matches React Aria's behavior.\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const focusedKey = state.focusedKey();\n const isOpen = state.isOpen();\n const collection = state.collection();\n\n // Get the focused item\n const focusedItem = focusedKey != null && isOpen ? collection.getItem(focusedKey) : null;\n\n // Announce focus changes on Apple devices\n if (isAppleDevice() && focusedItem != null && focusedKey !== lastFocusedKey) {\n const isSelected = state.selectedKey() === focusedKey;\n const optionText = focusedItem.textValue || \"\";\n\n // For now, we don't support sections, so isGroupChange is always false\n const announcement = stringFormatter().format(\"focusAnnouncement\", {\n isGroupChange: false,\n groupTitle: \"\",\n groupCount: 0,\n optionText,\n isSelected,\n });\n\n announce(announcement, \"polite\");\n }\n\n lastFocusedKey = focusedKey;\n });\n\n // Announce the number of available suggestions when it changes\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const isOpen = state.isOpen();\n const collection = state.collection();\n const optionCount = getItemCount(collection);\n const focusedKey = state.focusedKey();\n\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n const didOpenWithoutFocusedItem =\n isOpen !== lastIsOpen && (focusedKey == null || isAppleDevice());\n\n if (isOpen && (didOpenWithoutFocusedItem || optionCount !== lastOptionCount)) {\n const announcement = stringFormatter().format(\"countAnnouncement\", { optionCount });\n announce(announcement, \"polite\");\n }\n\n lastOptionCount = optionCount;\n lastIsOpen = isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const selectedKey = state.selectedKey();\n const selectedItem = state.selectedItem();\n\n if (isAppleDevice() && state.isFocused() && selectedItem && selectedKey !== lastSelectedKey) {\n const optionText = selectedItem.textValue || \"\";\n const announcement = stringFormatter().format(\"selectedAnnouncement\", { optionText });\n announce(announcement, \"polite\");\n }\n\n lastSelectedKey = selectedKey;\n });\n\n // Hide other page content from screen readers when the listbox is open.\n // This requires both the input and listbox refs to be available.\n // Note: This feature is important for screen reader accessibility but\n // only works when a popoverRef/listBoxRef is provided.\n createEffect(() => {\n if (isServer) return;\n\n const isOpen = state.isOpen();\n const inputEl = inputRef();\n const listBoxEl = listBoxRef?.();\n\n // Only apply ariaHideOutside if we have both elements available\n // This ensures the listbox won't be accidentally hidden\n if (isOpen && inputEl && listBoxEl) {\n const cleanup = ariaHideOutside([inputEl, listBoxEl]);\n onCleanup(cleanup);\n }\n });\n\n // Handle press on button trigger\n let wasOpenOnButtonPressStart = false;\n const scheduleButtonOpenFallback = (startedOpen: boolean) => {\n if (startedOpen) {\n return;\n }\n\n setTimeout(() => {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n if (!state.isOpen() && !isDisabled && !isReadOnly) {\n inputRef()?.focus();\n state.open(null, \"manual\");\n }\n }, 0);\n };\n\n const { pressProps } = createPress({\n get isDisabled() {\n return (\n (getProps().isDisabled ?? state.isDisabled) || (getProps().isReadOnly ?? state.isReadOnly)\n );\n },\n preventFocusOnPress: true,\n onPressStart(e) {\n if (e.pointerType === \"touch\") {\n return;\n }\n\n wasOpenOnButtonPressStart = state.isOpen();\n inputRef()?.focus();\n state.toggle(\n e.pointerType === \"keyboard\" || e.pointerType === \"virtual\" ? \"first\" : null,\n \"manual\",\n );\n scheduleButtonOpenFallback(wasOpenOnButtonPressStart);\n },\n onPress(e) {\n if (e.pointerType !== \"touch\") {\n return;\n }\n\n wasOpenOnButtonPressStart = state.isOpen();\n inputRef()?.focus();\n state.toggle(null, \"manual\");\n scheduleButtonOpenFallback(wasOpenOnButtonPressStart);\n },\n });\n\n // Handle input change\n const onInputChange: JSX.EventHandler<HTMLInputElement, InputEvent> = (e) => {\n const target = e.target as HTMLInputElement;\n state.setInputValue(target.value);\n };\n\n // Keyboard navigation for input\n const onInputKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n const collection = state.collection();\n const focusedKey = state.focusedKey();\n const shouldWrap = p.shouldFocusWrap ?? false;\n\n switch (e.key) {\n case \"Enter\":\n if (state.isOpen() && focusedKey != null) {\n e.preventDefault();\n\n // Check if the focused item is a link\n // Link href can be in props (for components) or value (for dynamic items)\n const collectionItem = collection.getItem(focusedKey);\n const itemHref =\n collectionItem?.props?.href ??\n (collectionItem?.value as Record<string, unknown> | null)?.href;\n if (itemHref) {\n // Find the actual anchor element in the DOM and trigger navigation\n const listBox = listBoxRef?.();\n if (listBox) {\n const item = listBox.querySelector(`[data-key=\"${CSS.escape(String(focusedKey))}\"]`);\n if (item instanceof HTMLAnchorElement) {\n openLink(item, e);\n }\n }\n state.close();\n } else {\n state.commit();\n }\n }\n break;\n\n case \"Escape\":\n if (state.isOpen()) {\n e.preventDefault();\n e.stopPropagation();\n state.revert();\n }\n break;\n\n case \"ArrowDown\":\n e.preventDefault();\n if (!state.isOpen()) {\n state.open(\"first\", \"manual\");\n } else {\n // Move to next item\n if (focusedKey == null) {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n } else {\n let nextKey = collection.getKeyAfter(focusedKey);\n // Skip disabled keys\n while (nextKey != null && state.isKeyDisabled(nextKey)) {\n nextKey = collection.getKeyAfter(nextKey);\n }\n if (nextKey != null) {\n state.setFocusedKey(nextKey);\n } else if (shouldWrap) {\n // Wrap to first\n let firstKey = collection.getFirstKey();\n while (firstKey != null && state.isKeyDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n }\n }\n }\n break;\n\n case \"ArrowUp\":\n e.preventDefault();\n if (!state.isOpen()) {\n state.open(\"last\", \"manual\");\n } else {\n // Move to previous item\n if (focusedKey == null) {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n } else {\n let prevKey = collection.getKeyBefore(focusedKey);\n // Skip disabled keys\n while (prevKey != null && state.isKeyDisabled(prevKey)) {\n prevKey = collection.getKeyBefore(prevKey);\n }\n if (prevKey != null) {\n state.setFocusedKey(prevKey);\n } else if (shouldWrap) {\n // Wrap to last\n let lastKey = collection.getLastKey();\n while (lastKey != null && state.isKeyDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n }\n }\n }\n break;\n\n case \"Home\":\n if (state.isOpen()) {\n e.preventDefault();\n let firstKey = collection.getFirstKey();\n while (firstKey != null && state.isKeyDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n }\n break;\n\n case \"End\":\n if (state.isOpen()) {\n e.preventDefault();\n let lastKey = collection.getLastKey();\n while (lastKey != null && state.isKeyDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n }\n break;\n\n case \"Backspace\":\n // In multiple mode, remove last selected key when input is empty\n if (state.selectionMode() === \"multiple\" && state.inputValue() === \"\") {\n const keys = state.selectedKeys();\n if (keys.size > 0) {\n const lastKey = Array.from(keys).pop()!;\n state.removeSelectedKey(lastKey);\n }\n }\n break;\n\n case \"Tab\":\n // Commit on Tab if menu is open\n if (state.isOpen() && focusedKey != null) {\n state.commit();\n }\n break;\n }\n };\n\n // Handle focus events\n const handleFocus = (e: FocusEvent) => {\n state.setFocused(true);\n getProps().onFocus?.(e);\n getProps().onFocusChange?.(true);\n };\n\n // Track the last touch event time for iPad VoiceOver double-tap debouncing\n let lastEventTime = 0;\n\n const handleBlur = (e: FocusEvent) => {\n // Use synchronous ref checks instead of requestAnimationFrame\n // This matches React Aria's implementation and is more reliable\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n const button = buttonRef?.();\n const listBox = listBoxRef?.();\n\n // Don't blur if focus is moving to the button\n const blurFromButton = button && button === relatedTarget;\n\n // Don't blur if focus is moving into the listbox/popover\n const blurIntoPopover = listBox?.contains(relatedTarget);\n\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n // If a pointerdown happened inside the listbox, don't close\n // This handles the case when clicking on a non-focusable option\n if (isPointerDownInsideListBox) {\n isPointerDownInsideListBox = false;\n return;\n }\n\n // Call user's onBlur handler\n getProps().onBlur?.(e);\n\n state.setFocused(false);\n getProps().onFocusChange?.(false);\n };\n\n // Handle touch events for iPad VoiceOver\n // VoiceOver on iOS fires a touchend at the center of the element on double-tap.\n // We detect this and toggle the combobox manually to avoid issues with focus management.\n const handleTouchEnd = (e: TouchEvent) => {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Debounce rapid consecutive touchend events (< 500ms)\n // This handles VoiceOver's double-tap behavior\n if (e.timeStamp - lastEventTime < 500) {\n e.preventDefault();\n inputRef()?.focus();\n return;\n }\n\n // Detect VoiceOver virtual click - it fires at the exact center of the element\n const rect = (e.target as Element).getBoundingClientRect();\n const touch = e.changedTouches[0];\n const centerX = Math.ceil(rect.left + 0.5 * rect.width);\n const centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef()?.focus();\n state.toggle(null, \"manual\");\n lastEventTime = e.timeStamp;\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n const focusedKey = state.focusedKey();\n\n return mergeProps(\n domProps(),\n focusProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n id: inputId,\n type: \"text\",\n role: \"combobox\",\n get value() {\n return state.inputValue();\n },\n tabIndex: isDisabled ? undefined : 0,\n disabled: isDisabled || undefined,\n readOnly: isReadOnly || undefined,\n placeholder: p.placeholder,\n autoComplete: \"off\",\n \"aria-autocomplete\": p.autoComplete ?? \"list\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? listBoxId : undefined,\n \"aria-activedescendant\":\n isOpen && focusedKey != null ? `${listBoxId}-option-${focusedKey}` : undefined,\n \"aria-disabled\": isDisabled || undefined,\n \"aria-required\": p.isRequired || undefined,\n \"aria-invalid\": p.isInvalid || undefined,\n \"aria-describedby\": getAriaDescribedBy(),\n name: p.name,\n onInput: onInputChange,\n onKeyDown: onInputKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onTouchEnd: handleTouchEnd,\n \"data-open\": isOpen || undefined,\n \"data-disabled\": isDisabled || undefined,\n \"data-readonly\": isReadOnly || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n } as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get buttonProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n {\n id: buttonId,\n type: \"button\",\n tabIndex: -1,\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? listBoxId : undefined,\n \"aria-disabled\": isDisabled || isReadOnly || undefined,\n disabled: isDisabled || isReadOnly || undefined,\n \"aria-label\": stringFormatter?.().format(\"buttonLabel\") ?? \"Show suggestions\",\n \"data-open\": isOpen || undefined,\n \"data-disabled\": isDisabled || isReadOnly || undefined,\n } as Record<string, unknown>,\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n get listBoxProps() {\n const isMulti = state.selectionMode() === \"multiple\";\n return {\n id: listBoxId,\n role: \"listbox\",\n \"aria-labelledby\": inputId,\n \"aria-multiselectable\": isMulti || undefined,\n tabIndex: -1,\n shouldSelectOnPressUp: true,\n shouldFocusOnHover: true,\n // Track pointerdown inside listbox to prevent blur from closing\n // Use capture phase because createPress calls stopPropagation on pointerdown\n onPointerDownCapture: () => {\n isPointerDownInsideListBox = true;\n },\n onMouseDownCapture: () => {\n // Fallback for environments without PointerEvent\n isPointerDownInsideListBox = true;\n },\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n role: \"alert\",\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isOpen: state.isOpen,\n selectedItem: state.selectedItem,\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Ported from React Aria:\n * https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/dialog/src/useDialog.ts\n */\n\nimport {\n Accessor,\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n onCleanup,\n} from \"solid-js\";\nimport { filterDOMProps, focusSafely } from \"../utils\";\nimport type { AriaLabelingProps, DOMProps } from \"./types\";\n\nexport interface AriaDialogProps extends DOMProps, AriaLabelingProps {\n /**\n * The role of the dialog element.\n * @default 'dialog'\n */\n role?: \"dialog\" | \"alertdialog\";\n}\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: Accessor<Record<string, unknown>>;\n\n /** Props for the dialog title element. */\n titleProps: Accessor<Record<string, unknown>>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function createDialog(\n props: AriaDialogProps | Accessor<AriaDialogProps>,\n ref: Accessor<HTMLElement | undefined>,\n): DialogAria {\n // Support both direct props and accessor pattern\n const getProps = typeof props === \"function\" ? props : () => props;\n\n const role = () => getProps().role ?? \"dialog\";\n const generatedTitleId = createUniqueId();\n const [isRefocusing, setIsRefocusing] = createSignal(false);\n\n const titleId = createMemo(() => {\n const p = getProps();\n // Use provided aria-labelledby, or generated ID if no aria-label\n if (p[\"aria-labelledby\"]) return undefined;\n return p[\"aria-label\"] ? undefined : generatedTitleId;\n });\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n // Only run on the client (SSR-safe)\n createEffect(() => {\n // Guard against SSR - document is not available on the server\n if (typeof document === \"undefined\") return;\n\n const dialogEl = ref();\n if (dialogEl && !dialogEl.contains(document.activeElement)) {\n focusSafely(dialogEl);\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n const timeout = setTimeout(() => {\n // Check that the dialog is still focused, or focused was lost to the body.\n if (document.activeElement === dialogEl || document.activeElement === document.body) {\n setIsRefocusing(true);\n dialogEl.blur();\n focusSafely(dialogEl);\n setIsRefocusing(false);\n }\n }, 500);\n\n onCleanup(() => {\n clearTimeout(timeout);\n });\n }\n });\n\n // Note: Focus containment is typically handled by createModal at a higher level\n // For standalone dialogs, focus containment should be managed by the overlay system\n\n const dialogProps = createMemo(() => {\n const p = getProps();\n return {\n ...filterDOMProps(p),\n role: role(),\n tabIndex: -1,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"] || titleId(),\n \"aria-describedby\": p[\"aria-describedby\"],\n // Prevent blur events from reaching createOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above createEffect.\n onBlur: (e: FocusEvent) => {\n if (isRefocusing()) {\n e.stopPropagation();\n }\n },\n };\n });\n\n const titlePropsValue = createMemo(() => ({\n id: titleId(),\n }));\n\n return {\n dialogProps,\n titleProps: titlePropsValue,\n };\n}\n","/**\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 \"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 * createLandmark - SolidJS implementation of React Aria's useLandmark\n *\n * Provides landmark navigation in an application. Call this with a role and label\n * to register a landmark navigable with the F6 key.\n *\n * ARIA landmarks help screen reader users navigate between major sections of a page.\n * The F6 key (or Shift+F6) cycles through all registered landmarks.\n */\n\nimport type { JSX, Accessor } from \"solid-js\";\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils\";\nimport { filterDOMProps } from \"../utils\";\n\n/** ARIA landmark roles */\nexport type AriaLandmarkRole =\n | \"main\"\n | \"region\"\n | \"search\"\n | \"navigation\"\n | \"form\"\n | \"banner\"\n | \"contentinfo\"\n | \"complementary\";\n\nexport interface AriaLandmarkProps {\n /** The ARIA landmark role. */\n role: AriaLandmarkRole;\n /**\n * A human-readable label for the landmark.\n * Required when multiple landmarks with the same role exist on a page.\n */\n \"aria-label\"?: string;\n /** Identifies the element(s) that labels the landmark. */\n \"aria-labelledby\"?: string;\n /** The element's unique identifier. */\n id?: string;\n /**\n * A custom focus handler called when this landmark receives focus via F6 navigation.\n * Use this to focus a specific element within the landmark instead of the container.\n */\n focus?: () => void;\n}\n\nexport interface LandmarkAria<T extends HTMLElement = HTMLElement> {\n /** Props to spread on the landmark element. */\n landmarkProps: JSX.HTMLAttributes<T>;\n}\n\nexport interface LandmarkController {\n /** Focus the next landmark in DOM order. */\n focusNext: () => void;\n /** Focus the previous landmark in DOM order. */\n focusPrevious: () => void;\n /** Focus the main landmark. */\n focusMain: () => void;\n /** Navigate to a specific landmark by role. If multiple exist, the first one is focused. */\n navigate: (role: AriaLandmarkRole) => void;\n}\n\ninterface LandmarkEntry {\n ref: HTMLElement;\n role: AriaLandmarkRole;\n label?: string;\n focus?: () => void;\n lastFocused?: HTMLElement;\n}\n\n/**\n * Manages all registered landmarks and handles F6 keyboard navigation.\n */\nclass LandmarkManager {\n private landmarks: LandmarkEntry[] = [];\n private currentIndex = -1;\n private listening = false;\n\n constructor() {\n if (typeof window !== \"undefined\") {\n this.startListening();\n }\n }\n\n private startListening() {\n if (this.listening) return;\n this.listening = true;\n\n window.addEventListener(\"keydown\", this.handleKeyDown.bind(this), true);\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n // F6 to navigate landmarks\n if (event.key === \"F6\") {\n event.preventDefault();\n if (event.shiftKey) {\n this.focusPrevious();\n } else {\n this.focusNext();\n }\n }\n }\n\n register(entry: LandmarkEntry): void {\n // Insert in DOM order using compareDocumentPosition\n const index = this.findInsertionIndex(entry.ref);\n this.landmarks.splice(index, 0, entry);\n\n // Validate: if multiple landmarks have the same role, they should have different labels\n this.validateLabels();\n }\n\n unregister(ref: HTMLElement): void {\n const index = this.landmarks.findIndex((l) => l.ref === ref);\n if (index !== -1) {\n this.landmarks.splice(index, 1);\n // Adjust currentIndex if needed\n if (this.currentIndex >= this.landmarks.length) {\n this.currentIndex = this.landmarks.length - 1;\n }\n }\n }\n\n private findInsertionIndex(ref: HTMLElement): number {\n // Binary search for insertion point based on DOM order\n let low = 0;\n let high = this.landmarks.length;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const comparison = this.landmarks[mid].ref.compareDocumentPosition(ref);\n\n // Node.DOCUMENT_POSITION_FOLLOWING = 4\n if (comparison & Node.DOCUMENT_POSITION_FOLLOWING) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n\n return low;\n }\n\n private validateLabels(): void {\n // Group landmarks by role\n const roleGroups = new Map<AriaLandmarkRole, LandmarkEntry[]>();\n for (const landmark of this.landmarks) {\n const group = roleGroups.get(landmark.role) || [];\n group.push(landmark);\n roleGroups.set(landmark.role, group);\n }\n\n // Warn if multiple landmarks with the same role lack unique labels\n for (const [role, group] of roleGroups) {\n if (group.length > 1) {\n const labels = group.map((l) => l.label);\n const uniqueLabels = new Set(labels.filter(Boolean));\n if (uniqueLabels.size < group.length) {\n console.warn(\n `Multiple landmarks with role \"${role}\" exist. Each should have a unique aria-label or aria-labelledby.`,\n );\n }\n }\n }\n }\n\n focusNext(): void {\n if (this.landmarks.length === 0) return;\n\n // Find the currently focused landmark\n const activeElement = document.activeElement;\n this.currentIndex = this.findCurrentLandmarkIndex(activeElement);\n\n // Move to next\n this.currentIndex = (this.currentIndex + 1) % this.landmarks.length;\n this.focusLandmark(this.landmarks[this.currentIndex]);\n }\n\n focusPrevious(): void {\n if (this.landmarks.length === 0) return;\n\n // Find the currently focused landmark\n const activeElement = document.activeElement;\n this.currentIndex = this.findCurrentLandmarkIndex(activeElement);\n\n // Move to previous\n this.currentIndex = (this.currentIndex - 1 + this.landmarks.length) % this.landmarks.length;\n this.focusLandmark(this.landmarks[this.currentIndex]);\n }\n\n focusMain(): void {\n const main = this.landmarks.find((l) => l.role === \"main\");\n if (main) {\n this.focusLandmark(main);\n }\n }\n\n navigate(role: AriaLandmarkRole): void {\n const landmark = this.landmarks.find((l) => l.role === role);\n if (landmark) {\n this.focusLandmark(landmark);\n }\n }\n\n private findCurrentLandmarkIndex(activeElement: Element | null): number {\n if (!activeElement) return -1;\n\n // Check if active element is within any landmark\n for (let i = 0; i < this.landmarks.length; i++) {\n if (this.landmarks[i].ref.contains(activeElement)) {\n // Store the last focused element for this landmark\n if (activeElement instanceof HTMLElement) {\n this.landmarks[i].lastFocused = activeElement;\n }\n return i;\n }\n }\n\n return -1;\n }\n\n private focusLandmark(landmark: LandmarkEntry): void {\n // If a custom focus handler is provided, use it\n if (landmark.focus) {\n landmark.focus();\n return;\n }\n\n // If we previously focused an element in this landmark, try to restore it\n if (landmark.lastFocused && landmark.ref.contains(landmark.lastFocused)) {\n landmark.lastFocused.focus();\n return;\n }\n\n // Try to find the first focusable element\n const focusable = this.findFirstFocusable(landmark.ref);\n if (focusable) {\n focusable.focus();\n return;\n }\n\n // Fallback: make the landmark itself focusable and focus it\n if (!landmark.ref.hasAttribute(\"tabindex\")) {\n landmark.ref.setAttribute(\"tabindex\", \"-1\");\n }\n landmark.ref.focus();\n }\n\n private findFirstFocusable(container: HTMLElement): HTMLElement | null {\n const focusableSelectors = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n ].join(\", \");\n\n return container.querySelector<HTMLElement>(focusableSelectors);\n }\n\n getController(): LandmarkController {\n return {\n focusNext: () => this.focusNext(),\n focusPrevious: () => this.focusPrevious(),\n focusMain: () => this.focusMain(),\n navigate: (role) => this.navigate(role),\n };\n }\n}\n\n// Global singleton instance\nlet landmarkManager: LandmarkManager | null = null;\n\nfunction getLandmarkManager(): LandmarkManager {\n if (!landmarkManager) {\n landmarkManager = new LandmarkManager();\n }\n return landmarkManager;\n}\n\n/**\n * Provides landmark navigation in an application.\n * Call this with a role and label to register a landmark navigable with F6.\n *\n * @example\n * ```tsx\n * function Navigation(props) {\n * let ref: HTMLElement;\n * const { landmarkProps } = createLandmark({\n * role: 'navigation',\n * 'aria-label': 'Main navigation'\n * });\n *\n * return (\n * <nav {...landmarkProps} ref={ref}>\n * {props.children}\n * </nav>\n * );\n * }\n * ```\n */\nexport function createLandmark<T extends HTMLElement = HTMLElement>(\n props: MaybeAccessor<AriaLandmarkProps>,\n ref: Accessor<T | undefined>,\n): LandmarkAria<T> {\n // Register with the landmark manager\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const p = access(props);\n const entry: LandmarkEntry = {\n ref: element,\n role: p.role,\n label: p[\"aria-label\"],\n focus: p.focus,\n };\n\n const manager = getLandmarkManager();\n manager.register(entry);\n\n onCleanup(() => {\n manager.unregister(element);\n });\n });\n\n const getLandmarkProps = (): JSX.HTMLAttributes<T> => {\n const p = access(props);\n const domProps = filterDOMProps(p as unknown as Record<string, unknown>, { labelable: true });\n\n return {\n ...domProps,\n role: p.role,\n };\n };\n\n return {\n get landmarkProps() {\n return getLandmarkProps();\n },\n };\n}\n\n/**\n * Returns a controller for programmatic landmark navigation.\n *\n * @example\n * ```tsx\n * const controller = getLandmarkController();\n * controller.focusMain(); // Focus the main landmark\n * controller.focusNext(); // Focus the next landmark\n * ```\n */\nexport function getLandmarkController(): LandmarkController {\n return getLandmarkManager().getController();\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","/**\n * Position calculation utilities for popovers and overlays.\n * Ported from @react-aria/overlays calculatePosition.ts\n */\n\n// Types\nexport type Placement =\n | \"bottom\"\n | \"bottom left\"\n | \"bottom right\"\n | \"bottom start\"\n | \"bottom end\"\n | \"top\"\n | \"top left\"\n | \"top right\"\n | \"top start\"\n | \"top end\"\n | \"left\"\n | \"left top\"\n | \"left bottom\"\n | \"right\"\n | \"right top\"\n | \"right bottom\"\n | \"start\"\n | \"start top\"\n | \"start bottom\"\n | \"end\"\n | \"end top\"\n | \"end bottom\";\n\nexport type PlacementAxis = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type Axis = \"top\" | \"left\";\nexport type SizeAxis = \"width\" | \"height\";\n\ninterface Position {\n top?: number;\n left?: number;\n bottom?: number;\n right?: number;\n}\n\ninterface Dimensions {\n width: number;\n height: number;\n totalWidth: number;\n totalHeight: number;\n top: number;\n left: number;\n scroll: Position;\n}\n\ninterface ParsedPlacement {\n placement: PlacementAxis;\n crossPlacement: PlacementAxis | \"center\";\n axis: Axis;\n crossAxis: Axis;\n size: SizeAxis;\n crossSize: SizeAxis;\n}\n\ninterface Offset {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface PositionOpts {\n arrowSize: number;\n placement: Placement;\n targetNode: Element;\n overlayNode: Element;\n scrollNode: Element;\n padding: number;\n shouldFlip: boolean;\n boundaryElement: Element;\n offset: number;\n crossOffset: number;\n maxHeight?: number;\n arrowBoundaryOffset?: number;\n}\n\ntype HeightGrowthDirection = \"top\" | \"bottom\";\n\nexport interface PositionResult {\n position: Position;\n arrowOffsetLeft?: number;\n arrowOffsetTop?: number;\n triggerAnchorPoint: { x: number; y: number };\n maxHeight: number;\n placement: PlacementAxis;\n}\n\n// Constants\nconst AXIS: Record<string, Axis> = {\n top: \"top\",\n bottom: \"top\",\n left: \"left\",\n right: \"left\",\n};\n\nconst FLIPPED_DIRECTION: Record<string, string> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\nconst CROSS_AXIS: Record<string, Axis> = {\n top: \"left\",\n left: \"top\",\n};\n\nconst AXIS_SIZE: Record<string, SizeAxis> = {\n top: \"height\",\n left: \"width\",\n};\n\nconst TOTAL_SIZE: Record<SizeAxis, \"totalWidth\" | \"totalHeight\"> = {\n width: \"totalWidth\",\n height: \"totalHeight\",\n};\n\nconst PARSED_PLACEMENT_CACHE: Record<string, ParsedPlacement> = {};\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction isWebKit(): boolean {\n return typeof window !== \"undefined\" && \"WebkitAppearance\" in document.documentElement.style;\n}\n\nconst getVisualViewport = () => (typeof document !== \"undefined\" ? window.visualViewport : null);\n\nfunction getContainerDimensions(\n containerNode: Element,\n visualViewport: VisualViewport | null,\n): Dimensions {\n let width = 0,\n height = 0,\n totalWidth = 0,\n totalHeight = 0,\n top = 0,\n left = 0;\n const scroll: Position = {};\n const isPinchZoomedIn = (visualViewport?.scale ?? 1) > 1;\n\n if (containerNode.tagName === \"BODY\" || containerNode.tagName === \"HTML\") {\n const documentElement = document.documentElement;\n totalWidth = documentElement.clientWidth;\n totalHeight = documentElement.clientHeight;\n width = visualViewport?.width ?? totalWidth;\n height = visualViewport?.height ?? totalHeight;\n scroll.top = documentElement.scrollTop || (containerNode as HTMLElement).scrollTop;\n scroll.left = documentElement.scrollLeft || (containerNode as HTMLElement).scrollLeft;\n\n if (visualViewport) {\n top = visualViewport.offsetTop;\n left = visualViewport.offsetLeft;\n }\n } else {\n ({ width, height, top, left } = getElementOffset(containerNode, false));\n scroll.top = (containerNode as HTMLElement).scrollTop;\n scroll.left = (containerNode as HTMLElement).scrollLeft;\n totalWidth = width;\n totalHeight = height;\n }\n\n if (\n isWebKit() &&\n (containerNode.tagName === \"BODY\" || containerNode.tagName === \"HTML\") &&\n isPinchZoomedIn\n ) {\n scroll.top = 0;\n scroll.left = 0;\n top = visualViewport?.pageTop ?? 0;\n left = visualViewport?.pageLeft ?? 0;\n }\n\n return { width, height, totalWidth, totalHeight, scroll, top, left };\n}\n\nfunction getScroll(node: Element): Offset {\n return {\n top: (node as HTMLElement).scrollTop,\n left: (node as HTMLElement).scrollLeft,\n width: (node as HTMLElement).scrollWidth,\n height: (node as HTMLElement).scrollHeight,\n };\n}\n\nfunction getDelta(\n axis: Axis,\n offset: number,\n size: number,\n boundaryDimensions: Dimensions,\n containerDimensions: Dimensions,\n padding: number,\n containerOffsetWithBoundary: Offset,\n): number {\n const containerScroll = containerDimensions.scroll[axis] ?? 0;\n const boundarySize = boundaryDimensions[AXIS_SIZE[axis]];\n\n const boundaryStartEdge =\n containerOffsetWithBoundary[axis] + (boundaryDimensions.scroll[AXIS[axis]] ?? 0) + padding;\n const boundaryEndEdge =\n containerOffsetWithBoundary[axis] +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n boundarySize -\n padding;\n\n const startEdgeOffset =\n offset -\n containerScroll +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n containerOffsetWithBoundary[axis] -\n boundaryDimensions[AXIS[axis]];\n const endEdgeOffset =\n offset -\n containerScroll +\n size +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n containerOffsetWithBoundary[axis] -\n boundaryDimensions[AXIS[axis]];\n\n if (startEdgeOffset < boundaryStartEdge) {\n return boundaryStartEdge - startEdgeOffset;\n } else if (endEdgeOffset > boundaryEndEdge) {\n return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);\n } else {\n return 0;\n }\n}\n\nfunction getMargins(node: Element): Position {\n const style = window.getComputedStyle(node);\n return {\n top: parseInt(style.marginTop, 10) || 0,\n bottom: parseInt(style.marginBottom, 10) || 0,\n left: parseInt(style.marginLeft, 10) || 0,\n right: parseInt(style.marginRight, 10) || 0,\n };\n}\n\nfunction parsePlacement(input: Placement): ParsedPlacement {\n if (PARSED_PLACEMENT_CACHE[input]) {\n return PARSED_PLACEMENT_CACHE[input];\n }\n\n const [placement, crossPlacement] = input.split(\" \") as [PlacementAxis, string?];\n const resolvedCrossPlacementInput = crossPlacement ?? \"center\";\n const axis: Axis = AXIS[placement] || \"right\";\n const crossAxis: Axis = CROSS_AXIS[axis];\n\n let resolvedCrossPlacement: PlacementAxis | \"center\" = \"center\";\n if (AXIS[resolvedCrossPlacementInput]) {\n resolvedCrossPlacement = resolvedCrossPlacementInput as PlacementAxis;\n }\n\n const size = AXIS_SIZE[axis];\n const crossSize = AXIS_SIZE[crossAxis];\n PARSED_PLACEMENT_CACHE[input] = {\n placement,\n crossPlacement: resolvedCrossPlacement,\n axis,\n crossAxis,\n size,\n crossSize,\n };\n return PARSED_PLACEMENT_CACHE[input];\n}\n\nfunction computePosition(\n childOffset: Offset,\n _boundaryDimensions: Dimensions,\n overlaySize: Offset,\n placementInfo: ParsedPlacement,\n offset: number,\n crossOffset: number,\n _containerOffsetWithBoundary: Offset,\n isContainerPositioned: boolean,\n arrowSize: number,\n arrowBoundaryOffset: number,\n containerDimensions: Dimensions,\n): Position {\n const { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;\n const position: Position = {};\n\n position[crossAxis] = childOffset[crossAxis] ?? 0;\n if (crossPlacement === \"center\") {\n position[crossAxis]! += ((childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0)) / 2;\n } else if (crossPlacement !== crossAxis) {\n position[crossAxis]! += (childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0);\n }\n\n position[crossAxis]! += crossOffset;\n\n const minPosition =\n childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;\n const maxPosition =\n childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;\n position[crossAxis] = clamp(position[crossAxis]!, minPosition, maxPosition);\n\n if (placement === axis) {\n const containerHeight = isContainerPositioned\n ? containerDimensions[size]\n : containerDimensions[TOTAL_SIZE[size]];\n position[FLIPPED_DIRECTION[axis] as keyof Position] = Math.floor(\n containerHeight - childOffset[axis] + offset,\n );\n } else {\n position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);\n }\n return position;\n}\n\nfunction getMaxHeight(\n position: Position,\n boundaryDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n _isContainerPositioned: boolean,\n margins: Position,\n padding: number,\n overlayHeight: number,\n heightGrowthDirection: HeightGrowthDirection,\n containerDimensions: Dimensions,\n isContainerDescendentOfBoundary: boolean,\n visualViewport: VisualViewport | null,\n): number {\n const overlayTop =\n (position.top != null\n ? position.top\n : containerDimensions[TOTAL_SIZE.height] - (position.bottom ?? 0) - overlayHeight) -\n (containerDimensions.scroll.top ?? 0);\n\n const boundaryToContainerTransformOffset = isContainerDescendentOfBoundary\n ? containerOffsetWithBoundary.top\n : 0;\n const boundingRect = {\n top: Math.max(\n boundaryDimensions.top + boundaryToContainerTransformOffset,\n (visualViewport?.offsetTop ?? boundaryDimensions.top) + boundaryToContainerTransformOffset,\n ),\n bottom: Math.min(\n boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset,\n (visualViewport?.offsetTop ?? 0) + (visualViewport?.height ?? 0),\n ),\n };\n\n const maxHeight =\n heightGrowthDirection !== \"top\"\n ? Math.max(\n 0,\n boundingRect.bottom - overlayTop - ((margins.top ?? 0) + (margins.bottom ?? 0) + padding),\n )\n : Math.max(\n 0,\n overlayTop +\n overlayHeight -\n boundingRect.top -\n ((margins.top ?? 0) + (margins.bottom ?? 0) + padding),\n );\n return maxHeight;\n}\n\nfunction getAvailableSpace(\n boundaryDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n childOffset: Offset,\n margins: Position,\n padding: number,\n placementInfo: ParsedPlacement,\n containerDimensions: Dimensions,\n isContainerDescendentOfBoundary: boolean,\n): number {\n const { placement, axis, size } = placementInfo;\n if (placement === axis) {\n return Math.max(\n 0,\n childOffset[axis] -\n (containerDimensions.scroll[axis] ?? 0) -\n (boundaryDimensions[axis] +\n (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0)) -\n (margins[axis] ?? 0) -\n (margins[FLIPPED_DIRECTION[axis] as keyof Position] ?? 0) -\n padding,\n );\n }\n\n return Math.max(\n 0,\n boundaryDimensions[size] +\n boundaryDimensions[axis] +\n (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) -\n childOffset[axis] -\n childOffset[size] +\n (containerDimensions.scroll[axis] ?? 0) -\n (margins[axis] ?? 0) -\n (margins[FLIPPED_DIRECTION[axis] as keyof Position] ?? 0) -\n padding,\n );\n}\n\nexport function calculatePositionInternal(\n placementInput: Placement,\n childOffset: Offset,\n overlaySize: Offset,\n _scrollSize: Offset,\n margins: Position,\n padding: number,\n flip: boolean,\n boundaryDimensions: Dimensions,\n containerDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n offset: number,\n crossOffset: number,\n isContainerPositioned: boolean,\n userSetMaxHeight: number | undefined,\n arrowSize: number,\n arrowBoundaryOffset: number,\n isContainerDescendentOfBoundary: boolean,\n visualViewport: VisualViewport | null,\n): PositionResult {\n let placementInfo = parsePlacement(placementInput);\n let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;\n let position = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n placementInfo,\n offset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions,\n );\n let normalizedOffset = offset;\n const space = getAvailableSpace(\n boundaryDimensions,\n containerOffsetWithBoundary,\n childOffset,\n margins,\n padding + offset,\n placementInfo,\n containerDimensions,\n isContainerDescendentOfBoundary,\n );\n\n if (flip && overlaySize[size] > space) {\n const flippedPlacementInfo = parsePlacement(\n `${FLIPPED_DIRECTION[placement]} ${crossPlacement}` as Placement,\n );\n const flippedPosition = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n flippedPlacementInfo,\n offset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions,\n );\n\n const flippedSpace = getAvailableSpace(\n boundaryDimensions,\n containerOffsetWithBoundary,\n childOffset,\n margins,\n padding + offset,\n flippedPlacementInfo,\n containerDimensions,\n isContainerDescendentOfBoundary,\n );\n\n if (flippedSpace > space) {\n placementInfo = flippedPlacementInfo;\n position = flippedPosition;\n normalizedOffset = offset;\n }\n }\n\n let heightGrowthDirection: HeightGrowthDirection = \"bottom\";\n if (placementInfo.axis === \"top\") {\n if (placementInfo.placement === \"top\") {\n heightGrowthDirection = \"top\";\n } else if (placementInfo.placement === \"bottom\") {\n heightGrowthDirection = \"bottom\";\n }\n } else if (placementInfo.crossAxis === \"top\") {\n if (placementInfo.crossPlacement === \"top\") {\n heightGrowthDirection = \"bottom\";\n } else if (placementInfo.crossPlacement === \"bottom\") {\n heightGrowthDirection = \"top\";\n }\n }\n\n let delta = getDelta(\n crossAxis,\n position[crossAxis]!,\n overlaySize[crossSize],\n boundaryDimensions,\n containerDimensions,\n padding,\n containerOffsetWithBoundary,\n );\n position[crossAxis]! += delta;\n\n let maxHeight = getMaxHeight(\n position,\n boundaryDimensions,\n containerOffsetWithBoundary,\n isContainerPositioned,\n margins,\n padding,\n overlaySize.height,\n heightGrowthDirection,\n containerDimensions,\n isContainerDescendentOfBoundary,\n visualViewport,\n );\n\n if (userSetMaxHeight && userSetMaxHeight < maxHeight) {\n maxHeight = userSetMaxHeight;\n }\n\n overlaySize.height = Math.min(overlaySize.height, maxHeight);\n\n position = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n placementInfo,\n normalizedOffset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions,\n );\n delta = getDelta(\n crossAxis,\n position[crossAxis]!,\n overlaySize[crossSize],\n boundaryDimensions,\n containerDimensions,\n padding,\n containerOffsetWithBoundary,\n );\n position[crossAxis]! += delta;\n\n const arrowPosition: Position = {};\n\n ({ placement, crossPlacement } = placementInfo);\n let origin = childOffset[crossAxis] - position[crossAxis]! - (margins[AXIS[crossAxis]] ?? 0);\n let preferredArrowPosition = origin + 0.5 * childOffset[crossSize];\n\n const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;\n const overlayMargin =\n AXIS[crossAxis] === \"left\"\n ? (margins.left ?? 0) + (margins.right ?? 0)\n : (margins.top ?? 0) + (margins.bottom ?? 0);\n const arrowMaxPosition =\n overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;\n\n const arrowOverlappingChildMinEdge =\n childOffset[crossAxis] +\n arrowSize / 2 -\n (position[crossAxis]! + (margins[AXIS[crossAxis]] ?? 0));\n const arrowOverlappingChildMaxEdge =\n childOffset[crossAxis] +\n childOffset[crossSize] -\n arrowSize / 2 -\n (position[crossAxis]! + (margins[AXIS[crossAxis]] ?? 0));\n\n const arrowPositionOverlappingChild = clamp(\n preferredArrowPosition,\n arrowOverlappingChildMinEdge,\n arrowOverlappingChildMaxEdge,\n );\n arrowPosition[crossAxis] = clamp(\n arrowPositionOverlappingChild,\n arrowMinPosition,\n arrowMaxPosition,\n );\n\n if (arrowSize) {\n origin = arrowPosition[crossAxis]!;\n } else if (crossPlacement === \"right\" || crossPlacement === \"bottom\") {\n origin += childOffset[crossSize];\n } else if (crossPlacement === \"center\") {\n origin += childOffset[crossSize] / 2;\n }\n\n const crossOrigin = placement === \"left\" || placement === \"top\" ? overlaySize[size] : 0;\n const triggerAnchorPoint = {\n x: placement === \"top\" || placement === \"bottom\" ? origin : crossOrigin,\n y: placement === \"left\" || placement === \"right\" ? origin : crossOrigin,\n };\n\n return {\n position,\n maxHeight: maxHeight,\n arrowOffsetLeft: arrowPosition.left,\n arrowOffsetTop: arrowPosition.top,\n placement,\n triggerAnchorPoint,\n };\n}\n\nexport function getRect(node: Element, ignoreScale: boolean) {\n const { top, left, width: bWidth, height: bHeight } = node.getBoundingClientRect();\n let width = bWidth;\n let height = bHeight;\n\n if (ignoreScale && node instanceof (node.ownerDocument.defaultView?.HTMLElement ?? HTMLElement)) {\n width = (node as HTMLElement).offsetWidth;\n height = (node as HTMLElement).offsetHeight;\n }\n\n return { top, left, width, height };\n}\n\nfunction getElementOffset(node: Element, ignoreScale: boolean): Offset {\n const { top, left, width, height } = getRect(node, ignoreScale);\n const { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;\n return {\n top: top + scrollTop - clientTop,\n left: left + scrollLeft - clientLeft,\n width,\n height,\n };\n}\n\nfunction getPosition(node: Element, parent: Element, ignoreScale: boolean): Offset {\n const style = window.getComputedStyle(node);\n let offset: Offset;\n if (style.position === \"fixed\") {\n offset = getRect(node, ignoreScale);\n } else {\n offset = getElementOffset(node, ignoreScale);\n const parentOffset = getElementOffset(parent, ignoreScale);\n const parentStyle = window.getComputedStyle(parent);\n parentOffset.top +=\n (parseInt(parentStyle.borderTopWidth, 10) || 0) - (parent as HTMLElement).scrollTop;\n parentOffset.left +=\n (parseInt(parentStyle.borderLeftWidth, 10) || 0) - (parent as HTMLElement).scrollLeft;\n offset.top -= parentOffset.top;\n offset.left -= parentOffset.left;\n }\n\n offset.top -= parseInt(style.marginTop, 10) || 0;\n offset.left -= parseInt(style.marginLeft, 10) || 0;\n return offset;\n}\n\nfunction getContainingBlock(node: HTMLElement): Element {\n let offsetParent = node.offsetParent;\n\n if (\n offsetParent &&\n offsetParent === document.body &&\n window.getComputedStyle(offsetParent).position === \"static\" &&\n !isContainingBlock(offsetParent)\n ) {\n offsetParent = document.documentElement;\n }\n\n if (offsetParent == null) {\n offsetParent = node.parentElement;\n while (offsetParent && !isContainingBlock(offsetParent)) {\n offsetParent = offsetParent.parentElement;\n }\n }\n\n return offsetParent || document.documentElement;\n}\n\nfunction isContainingBlock(node: Element): boolean {\n const style = window.getComputedStyle(node);\n return (\n style.transform !== \"none\" ||\n /transform|perspective/.test(style.willChange) ||\n style.filter !== \"none\" ||\n style.contain === \"paint\" ||\n (\"backdropFilter\" in style && style.getPropertyValue(\"backdrop-filter\") !== \"none\") ||\n (\"WebkitBackdropFilter\" in style &&\n style.getPropertyValue(\"-webkit-backdrop-filter\") !== \"none\")\n );\n}\n\n/**\n * Determines where to place the overlay with regards to the target and the position of an optional indicator.\n */\nexport function calculatePosition(opts: PositionOpts): PositionResult {\n const {\n placement,\n targetNode,\n overlayNode,\n scrollNode,\n padding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize,\n arrowBoundaryOffset = 0,\n } = opts;\n\n const visualViewport = getVisualViewport();\n const container =\n overlayNode instanceof HTMLElement ? getContainingBlock(overlayNode) : document.documentElement;\n const isViewportContainer = container === document.documentElement;\n const containerPositionStyle = window.getComputedStyle(container).position;\n const isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== \"static\";\n const childOffset: Offset = isViewportContainer\n ? getElementOffset(targetNode, false)\n : getPosition(targetNode, container, false);\n\n if (!isViewportContainer) {\n const { marginTop, marginLeft } = window.getComputedStyle(targetNode);\n childOffset.top += parseInt(marginTop, 10) || 0;\n childOffset.left += parseInt(marginLeft, 10) || 0;\n }\n\n const overlaySize: Offset = getElementOffset(overlayNode, true);\n const margins = getMargins(overlayNode);\n overlaySize.width += (margins.left ?? 0) + (margins.right ?? 0);\n overlaySize.height += (margins.top ?? 0) + (margins.bottom ?? 0);\n\n const scrollSize = getScroll(scrollNode);\n const boundaryDimensions = getContainerDimensions(boundaryElement, visualViewport);\n const containerDimensions = getContainerDimensions(container, visualViewport);\n const containerOffsetWithBoundary: Offset = getPosition(boundaryElement, container, false);\n\n const isContainerDescendentOfBoundary = boundaryElement.contains(container);\n return calculatePositionInternal(\n placement,\n childOffset,\n overlaySize,\n scrollSize,\n margins,\n padding,\n shouldFlip,\n boundaryDimensions,\n containerDimensions,\n containerOffsetWithBoundary,\n offset,\n crossOffset,\n isContainerPositioned,\n maxHeight,\n arrowSize,\n arrowBoundaryOffset,\n isContainerDescendentOfBoundary,\n visualViewport,\n );\n}\n","/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n *\n * Ported from @react-aria/overlays useOverlayPosition.\n */\n\nimport { createEffect, createSignal, onCleanup, type JSX } from \"solid-js\";\nimport { useLocale } from \"../i18n\";\nimport {\n calculatePosition,\n getRect,\n type Placement,\n type PlacementAxis,\n type PositionResult,\n} from \"./calculatePosition\";\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n * @default true\n */\n shouldFlip?: boolean;\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: () => Element | null;\n /**\n * The ref for the overlay element.\n */\n overlayRef: () => Element | null;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: () => Element | null;\n /**\n * A ref for the scrollable region within the overlay.\n * @default overlayRef\n */\n scrollRef?: () => Element | null;\n /**\n * Whether the overlay should update its position automatically.\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n * @default 0\n */\n arrowBoundaryOffset?: number;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the overlay tip arrow if any. */\n arrowProps: JSX.HTMLAttributes<HTMLElement>;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: () => PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: () => { x: number; y: number } | null;\n /** Updates the position of the overlay. */\n updatePosition: () => void;\n}\n\nconst visualViewport = typeof document !== \"undefined\" ? window.visualViewport : null;\n\nfunction translateRTL(position: string, direction: string): string {\n if (direction === \"rtl\") {\n return position.replace(\"start\", \"right\").replace(\"end\", \"left\");\n }\n return position.replace(\"start\", \"left\").replace(\"end\", \"right\");\n}\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function createOverlayPosition(props: AriaPositionProps): PositionAria {\n const locale = useLocale();\n const direction = () => locale().direction;\n\n const arrowSize = () => props.arrowSize ?? 0;\n const targetRef = () => props.targetRef();\n const overlayRef = () => props.overlayRef();\n const arrowRef = () => props.arrowRef?.() ?? null;\n const scrollRef = () => props.scrollRef?.() ?? overlayRef();\n const placement = () => (props.placement ?? \"bottom\") as Placement;\n const containerPadding = () => props.containerPadding ?? 12;\n const shouldFlip = () => props.shouldFlip ?? true;\n const boundaryElement = () =>\n props.boundaryElement ?? (typeof document !== \"undefined\" ? document.body : null);\n const offset = () => props.offset ?? 0;\n const crossOffset = () => props.crossOffset ?? 0;\n const shouldUpdatePosition = () => props.shouldUpdatePosition ?? true;\n const isOpen = () => props.isOpen ?? true;\n const onClose = () => props.onClose;\n const maxHeight = () => props.maxHeight;\n const arrowBoundaryOffset = () => props.arrowBoundaryOffset ?? 0;\n\n const [position, setPosition] = createSignal<PositionResult | null>(null);\n\n // Track the last scale to freeze overlay during pinch zoom\n let lastScale = visualViewport?.scale;\n\n createEffect(() => {\n if (isOpen()) {\n lastScale = visualViewport?.scale;\n }\n });\n\n const updatePosition = () => {\n const overlayNode = overlayRef();\n const targetNode = targetRef();\n const boundary = boundaryElement();\n\n if (!shouldUpdatePosition() || !isOpen() || !overlayNode || !targetNode || !boundary) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale) {\n return;\n }\n\n const scrollNode = scrollRef();\n const arrowNode = arrowRef();\n\n // Reset overlay's previous max height\n const overlay = overlayNode as HTMLElement;\n if (!maxHeight() && overlayNode) {\n overlay.style.top = \"0px\";\n overlay.style.bottom = \"\";\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + \"px\";\n }\n\n const result = calculatePosition({\n placement: translateRTL(placement(), direction()) as Placement,\n overlayNode,\n targetNode,\n scrollNode: scrollNode || overlayNode,\n padding: containerPadding(),\n shouldFlip: shouldFlip(),\n boundaryElement: boundary,\n offset: offset(),\n crossOffset: crossOffset(),\n maxHeight: maxHeight(),\n arrowSize: arrowSize() ?? (arrowNode ? getRect(arrowNode, true).width : 0),\n arrowBoundaryOffset: arrowBoundaryOffset(),\n });\n\n if (!result.position) {\n return;\n }\n\n // Apply styles directly for immediate positioning\n overlay.style.top = \"\";\n overlay.style.bottom = \"\";\n overlay.style.left = \"\";\n overlay.style.right = \"\";\n\n const pos = result.position as Record<string, number | undefined>;\n Object.keys(pos).forEach((key) => {\n overlay.style.setProperty(key, pos[key] + \"px\");\n });\n overlay.style.maxHeight = result.maxHeight != null ? result.maxHeight + \"px\" : \"\";\n\n setPosition(result);\n };\n\n // Update position when dependencies change\n createEffect(() => {\n // Track all dependencies\n shouldUpdatePosition();\n placement();\n overlayRef();\n targetRef();\n arrowRef();\n scrollRef();\n containerPadding();\n shouldFlip();\n boundaryElement();\n offset();\n crossOffset();\n isOpen();\n maxHeight();\n arrowBoundaryOffset();\n arrowSize();\n\n updatePosition();\n });\n\n // Update position on window resize\n createEffect(() => {\n if (!isOpen()) return;\n\n const handleResize = () => updatePosition();\n window.addEventListener(\"resize\", handleResize, false);\n\n onCleanup(() => {\n window.removeEventListener(\"resize\", handleResize, false);\n });\n });\n\n // Update position when overlay changes size using ResizeObserver\n createEffect(() => {\n const overlayNode = overlayRef();\n if (!overlayNode || !isOpen()) return;\n\n const resizeObserver = new ResizeObserver(() => updatePosition());\n resizeObserver.observe(overlayNode);\n\n onCleanup(() => {\n resizeObserver.disconnect();\n });\n });\n\n // Update position when target changes size\n createEffect(() => {\n const targetNode = targetRef();\n if (!targetNode || !isOpen()) return;\n\n const resizeObserver = new ResizeObserver(() => updatePosition());\n resizeObserver.observe(targetNode);\n\n onCleanup(() => {\n resizeObserver.disconnect();\n });\n });\n\n // Handle visual viewport resize (for iOS virtual keyboard)\n createEffect(() => {\n if (!isOpen()) return;\n\n let timeout: ReturnType<typeof setTimeout>;\n let isResizing = false;\n\n const onResize = () => {\n isResizing = true;\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n isResizing = false;\n }, 500);\n updatePosition();\n };\n\n const onScroll = () => {\n if (isResizing) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener(\"resize\", onResize);\n visualViewport?.addEventListener(\"scroll\", onScroll);\n\n onCleanup(() => {\n visualViewport?.removeEventListener(\"resize\", onResize);\n visualViewport?.removeEventListener(\"scroll\", onScroll);\n clearTimeout(timeout);\n });\n });\n\n // Close on scroll (when scrolling a parent of the trigger)\n createEffect(() => {\n const targetNode = targetRef();\n const closeHandler = onClose();\n if (!targetNode || !isOpen() || !closeHandler) return;\n\n const handleScroll = (e: Event) => {\n const target = e.target as Element;\n // Don't close if scrolling within the overlay\n if (overlayRef()?.contains(target)) return;\n // Close if scrolling a parent of the target (but not body/html)\n if (\n target !== document.body &&\n target !== document.documentElement &&\n target.contains(targetNode)\n ) {\n closeHandler();\n }\n };\n\n document.addEventListener(\"scroll\", handleScroll, true);\n\n onCleanup(() => {\n document.removeEventListener(\"scroll\", handleScroll, true);\n });\n });\n\n return {\n overlayProps: {\n get style(): JSX.CSSProperties {\n const current = position();\n return {\n position: current ? \"absolute\" : \"fixed\",\n top: !current ? 0 : undefined,\n left: !current ? 0 : undefined,\n \"z-index\": 100000,\n \"max-height\": current?.maxHeight ?? \"100vh\",\n } as JSX.CSSProperties;\n },\n },\n placement: () => position()?.placement ?? null,\n triggerAnchorPoint: () => position()?.triggerAnchorPoint ?? null,\n arrowProps: {\n \"aria-hidden\": \"true\",\n role: \"presentation\",\n get style(): JSX.CSSProperties {\n const current = position();\n return {\n left: current?.arrowOffsetLeft != null ? `${current.arrowOffsetLeft}px` : undefined,\n top: current?.arrowOffsetTop != null ? `${current.arrowOffsetTop}px` : undefined,\n };\n },\n },\n updatePosition,\n };\n}\n\nexport { type Placement, type PlacementAxis } from \"./calculatePosition\";\n","/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n *\n * Ported from @react-aria/overlays usePopover.\n */\n\nimport { createEffect, onCleanup, type JSX } from \"solid-js\";\nimport { createOverlay } from \"../overlays/createOverlay\";\nimport {\n createOverlayPosition,\n type AriaPositionProps,\n type PlacementAxis,\n} from \"./createOverlayPosition\";\nimport { createPreventScroll } from \"../overlays/createPreventScroll\";\nimport { ariaHideOutside, keepVisible } from \"../overlays/ariaHideOutside\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n isOpen: () => boolean;\n /** Opens the overlay. */\n open: () => void;\n /** Closes the overlay. */\n close: () => void;\n /** Toggles the overlay's open state. */\n toggle: () => void;\n}\n\nexport interface AriaPopoverProps extends Omit<\n AriaPositionProps,\n \"isOpen\" | \"onClose\" | \"targetRef\" | \"overlayRef\"\n> {\n /**\n * The ref for the element which the popover positions itself with respect to.\n */\n triggerRef: () => Element | null;\n /**\n * The ref for the popover element.\n */\n popoverRef: () => Element | null;\n /** A ref for the popover arrow element. */\n arrowRef?: () => Element | null;\n /**\n * An optional ref for a group of popovers, e.g. submenus.\n * When provided, this element is used to detect outside interactions\n * and hiding elements from assistive technologies instead of the popoverRef.\n */\n groupRef?: () => Element | null;\n /**\n * Whether the popover is non-modal, i.e. elements outside the popover may be\n * interacted with by assistive technologies.\n *\n * Most popovers should not use this option as it may negatively impact the screen\n * reader experience. Only use with components such as combobox, which are designed\n * to handle this situation carefully.\n */\n isNonModal?: boolean;\n /**\n * Whether pressing the escape key to close the popover should be disabled.\n *\n * Most popovers should not use this option. When set to true, an alternative\n * way to close the popover with a keyboard must be provided.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the popover ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the popover.\n * By default, onClose will always be called on interaction outside the popover ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n /**\n * The type of trigger that opened the popover.\n * Used for submenu detection.\n */\n trigger?: string;\n}\n\nexport interface PopoverAria {\n /** Props for the popover element. */\n popoverProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the popover tip arrow if any. */\n arrowProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to apply to the underlay element, if any. */\n underlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Placement of the popover with respect to the trigger. */\n placement: () => PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: () => { x: number; y: number } | null;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport function createPopover(props: AriaPopoverProps, state: OverlayTriggerState): PopoverAria {\n const triggerRef = () => props.triggerRef();\n const popoverRef = () => props.popoverRef();\n const groupRef = () => props.groupRef?.() ?? null;\n const isNonModal = () => props.isNonModal ?? false;\n const isKeyboardDismissDisabled = () => props.isKeyboardDismissDisabled ?? false;\n const shouldCloseOnInteractOutside = props.shouldCloseOnInteractOutside;\n const isSubmenu = () => props.trigger === \"SubmenuTrigger\";\n\n // Overlay behavior (dismiss handling)\n const { overlayProps, underlayProps } = createOverlay(\n {\n get isOpen() {\n return state.isOpen();\n },\n onClose: state.close,\n get shouldCloseOnBlur() {\n return !isSubmenu();\n },\n get isDismissable() {\n return !isNonModal() || isSubmenu();\n },\n get isKeyboardDismissDisabled() {\n return isKeyboardDismissDisabled();\n },\n get shouldCloseOnInteractOutside() {\n return shouldCloseOnInteractOutside;\n },\n },\n () => groupRef() ?? popoverRef(),\n );\n\n // Overlay positioning\n const {\n overlayProps: positionProps,\n arrowProps,\n placement,\n triggerAnchorPoint,\n } = createOverlayPosition({\n ...props,\n targetRef: triggerRef,\n overlayRef: popoverRef,\n get isOpen() {\n return state.isOpen();\n },\n get onClose() {\n return isNonModal() && !isSubmenu() ? state.close : null;\n },\n });\n\n // Prevent scroll when modal popover is open\n createPreventScroll({\n get isDisabled() {\n return isNonModal() || !state.isOpen();\n },\n });\n\n // Aria-hide outside elements\n createEffect(() => {\n if (state.isOpen() && popoverRef()) {\n const element = groupRef() ?? popoverRef();\n if (!element) return;\n\n let cleanup: (() => void) | undefined;\n\n if (isNonModal()) {\n cleanup = keepVisible(element);\n } else {\n cleanup = ariaHideOutside([element], { shouldUseInert: true });\n }\n\n onCleanup(() => {\n cleanup?.();\n });\n }\n });\n\n const merged = mergeProps(overlayProps, positionProps) as Record<string, unknown>;\n const popoverProps = new Proxy(merged, {\n get(target, key: string) {\n if (key === \"style\") return positionProps.style;\n return target[key];\n },\n has(target, key) {\n return key in target;\n },\n ownKeys(target) {\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(target, key) {\n if (key === \"style\") {\n return {\n configurable: true,\n enumerable: true,\n get: () => positionProps.style,\n };\n }\n return Reflect.getOwnPropertyDescriptor(target, key);\n },\n });\n\n return {\n popoverProps,\n arrowProps,\n underlayProps,\n placement,\n triggerAnchorPoint,\n };\n}\n\nexport { type PlacementAxis } from \"./createOverlayPosition\";\n","/**\n * FocusScope component for managing focus containment, restoration, and auto-focus.\n * Based on @react-aria/focus FocusScope.\n */\n\nimport {\n createContext,\n useContext,\n createEffect,\n onCleanup,\n type JSX,\n type Accessor,\n type ParentComponent,\n createSignal,\n onMount,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { getOwnerDocument, isFocusable } from \"../utils\";\nimport { focusSafely } from \"../utils/focus\";\n\nexport interface FocusScopeProps {\n /** The contents of the focus scope. */\n children: JSX.Element;\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean;\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean;\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean;\n}\n\nexport interface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: Element;\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean;\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean;\n /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean;\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement | null;\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement | null;\n}\n\ninterface FocusScopeContextValue {\n focusManager: FocusManager;\n scopeRef: Accessor<Element[]>;\n}\n\nconst FocusScopeContext = createContext<FocusScopeContextValue | null>(null);\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager | undefined {\n return useContext(FocusScopeContext)?.focusManager;\n}\n\n/**\n * Checks if an element is tabbable (focusable via Tab key).\n */\nfunction isTabbable(element: Element): boolean {\n if (!isFocusable(element)) {\n return false;\n }\n\n // Check tabIndex\n const tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex != null) {\n return parseInt(tabIndex, 10) >= 0;\n }\n\n return true;\n}\n\n/**\n * Gets all focusable elements within a scope.\n */\nfunction getFocusableElements(scope: Element[], tabbable = false): HTMLElement[] {\n const elements: HTMLElement[] = [];\n const filter = tabbable ? isTabbable : isFocusable;\n\n for (const scopeElement of scope) {\n // Check the element itself\n if (filter(scopeElement)) {\n elements.push(scopeElement as HTMLElement);\n }\n\n // Check all descendants\n const descendants = scopeElement.querySelectorAll(\"*\");\n for (let i = 0; i < descendants.length; i++) {\n const el = descendants[i];\n if (filter(el)) {\n elements.push(el as HTMLElement);\n }\n }\n }\n\n return elements;\n}\n\n/**\n * Checks if an element is within a scope.\n */\nfunction isElementInScope(element: Element | null, scope: Element[]): boolean {\n if (!element) return false;\n return scope.some((node) => node.contains(element));\n}\n\n/**\n * Gets the active element, accounting for shadow DOM.\n */\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement;\n}\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport const FocusScope: ParentComponent<FocusScopeProps> = (props) => {\n if (isServer) {\n return <>{props.children}</>;\n }\n\n let startRef: HTMLSpanElement | undefined;\n let endRef: HTMLSpanElement | undefined;\n const [scopeElements, setScopeElements] = createSignal<Element[]>([]);\n\n // Store the element that was focused when the scope mounted\n let nodeToRestore: Element | null = null;\n\n const getRestorableElement = (element: Element | null, doc: Document): Element | null => {\n if (!element || element === doc.body || element === doc.documentElement) {\n return null;\n }\n return element;\n };\n\n // Create focus manager\n const focusManager: FocusManager = {\n focusNext(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n const doc = getOwnerDocument(scope[0]);\n const current = from || getActiveElement(doc);\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let nextIndex = currentIndex + 1;\n\n if (nextIndex >= elements.length) {\n if (wrap) {\n nextIndex = 0;\n } else {\n return null;\n }\n }\n\n const nextElement = elements[nextIndex];\n if (nextElement) {\n focusSafely(nextElement);\n return nextElement;\n }\n\n return null;\n },\n\n focusPrevious(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { from, tabbable = true, wrap = false, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n const doc = getOwnerDocument(scope[0]);\n const current = from || getActiveElement(doc);\n\n if (!current || elements.length === 0) return null;\n\n const currentIndex = elements.indexOf(current as HTMLElement);\n let prevIndex = currentIndex - 1;\n\n if (prevIndex < 0) {\n if (wrap) {\n prevIndex = elements.length - 1;\n } else {\n return null;\n }\n }\n\n const prevElement = elements[prevIndex];\n if (prevElement) {\n focusSafely(prevElement);\n return prevElement;\n }\n\n return null;\n },\n\n focusFirst(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { tabbable = true, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n\n if (elements.length > 0) {\n focusSafely(elements[0]);\n return elements[0];\n }\n\n return null;\n },\n\n focusLast(opts = {}) {\n const scope = scopeElements();\n if (scope.length === 0) return null;\n\n const { tabbable = true, accept } = opts;\n const elements = getFocusableElements(scope, tabbable).filter((el) => !accept || accept(el));\n\n if (elements.length > 0) {\n const lastElement = elements[elements.length - 1];\n focusSafely(lastElement);\n return lastElement;\n }\n\n return null;\n },\n };\n\n // Collect scope elements after render\n onMount(() => {\n if (!startRef || !endRef) return;\n\n const nodes: Element[] = [];\n let node = startRef.nextSibling;\n while (node && node !== endRef) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n nodes.push(node as Element);\n }\n node = node.nextSibling;\n }\n setScopeElements(nodes);\n });\n\n // Save the currently focused element for restoration (must happen before autoFocus/contain effects run).\n onMount(() => {\n if (!props.restoreFocus) return;\n\n // Focus can be in the main document, or inside this iframe's document.\n const scopeDoc = startRef ? getOwnerDocument(startRef) : document;\n const scopeActive = getActiveElement(scopeDoc);\n const topActive = getActiveElement(document);\n\n // If the scope is in an iframe and that iframe is currently focused, prefer the iframe document's active element.\n if (\n scopeDoc !== document &&\n document.activeElement instanceof HTMLIFrameElement &&\n document.activeElement.contentDocument === scopeDoc &&\n scopeActive &&\n scopeActive !== scopeDoc.body\n ) {\n nodeToRestore = getRestorableElement(scopeActive, scopeDoc);\n return;\n }\n\n nodeToRestore = getRestorableElement(topActive, document);\n });\n\n // Auto-focus first element\n createEffect(() => {\n if (!props.autoFocus) return;\n\n const scope = scopeElements();\n if (scope.length === 0) return;\n\n const doc = getOwnerDocument(scope[0]);\n const activeElement = getActiveElement(doc);\n\n // Only auto-focus if focus is not already inside the scope\n if (!isElementInScope(activeElement, scope)) {\n focusManager.focusFirst();\n }\n });\n\n // Focus containment\n createEffect(() => {\n if (!props.contain) return;\n\n const scope = scopeElements();\n if (scope.length === 0) return;\n\n const doc = getOwnerDocument(scope[0]);\n let focusedNode: Element | null = null;\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\" || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n const scope = scopeElements();\n const activeElement = getActiveElement(doc);\n if (!isElementInScope(activeElement, scope)) {\n return;\n }\n\n const elements = getFocusableElements(scope, true);\n if (elements.length === 0) return;\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n if (e.shiftKey && activeElement === firstElement) {\n e.preventDefault();\n focusSafely(lastElement);\n } else if (!e.shiftKey && activeElement === lastElement) {\n e.preventDefault();\n focusSafely(firstElement);\n }\n };\n\n const onFocusIn = (e: FocusEvent) => {\n const scope = scopeElements();\n const target = e.target as Element;\n\n if (isElementInScope(target, scope)) {\n focusedNode = target;\n } else if (focusedNode) {\n // Focus escaped the scope, bring it back\n focusSafely(focusedNode as HTMLElement);\n } else {\n // No previous focus, focus first element\n focusManager.focusFirst();\n }\n };\n\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n\n onCleanup(() => {\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n });\n });\n\n // Restore focus on unmount\n onCleanup(() => {\n if (props.restoreFocus && nodeToRestore && (nodeToRestore as HTMLElement).focus) {\n const doc = getOwnerDocument(nodeToRestore as Element);\n const win = doc.defaultView ?? window;\n\n // Use requestAnimationFrame to ensure the element is still in the DOM\n win.requestAnimationFrame(() => {\n if (nodeToRestore && doc.body.contains(nodeToRestore as Node)) {\n (nodeToRestore as HTMLElement).focus();\n }\n });\n }\n });\n\n return (\n <FocusScopeContext.Provider value={{ focusManager, scopeRef: scopeElements }}>\n <span data-focus-scope-start hidden ref={startRef} />\n {props.children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusScopeContext.Provider>\n );\n};\n\nexport default FocusScope;\n","/**\n * Focus restoration utilities for solidaria\n *\n * Provides enhanced focus restoration with retry logic, cross-scope tracking,\n * and safe restoration patterns.\n */\n\nimport { createEffect, onCleanup, onMount } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { getOwnerDocument } from \"../utils\";\nimport { focusSafely } from \"../utils/focus\";\n\nexport interface FocusRestoreOptions {\n /**\n * Whether to restore focus when the component unmounts.\n * @default true\n */\n restoreOnUnmount?: boolean;\n /**\n * Maximum number of retries if the element is not in the DOM.\n * @default 3\n */\n maxRetries?: number;\n /**\n * Delay between retries in milliseconds.\n * @default 50\n */\n retryDelay?: number;\n /**\n * Callback when focus is successfully restored.\n */\n onRestore?: (element: HTMLElement) => void;\n /**\n * Callback when focus restoration fails.\n */\n onRestoreFailed?: () => void;\n /**\n * Whether to prevent scrolling when restoring focus.\n * @default true\n */\n preventScroll?: boolean;\n}\n\nexport interface FocusRestoreResult {\n /**\n * Manually restore focus to the saved element.\n */\n restore: () => boolean;\n /**\n * Get the saved element (if any).\n */\n getSavedElement: () => HTMLElement | null;\n /**\n * Save the currently focused element.\n */\n saveCurrentFocus: () => void;\n /**\n * Clear the saved element without restoring.\n */\n clear: () => void;\n}\n\n// Stack to track focus history across scopes\nconst focusStack: HTMLElement[] = [];\n\n/**\n * Push an element onto the focus stack.\n */\nexport function pushFocusStack(element: HTMLElement): void {\n focusStack.push(element);\n}\n\n/**\n * Pop the last element from the focus stack.\n */\nexport function popFocusStack(): HTMLElement | undefined {\n return focusStack.pop();\n}\n\n/**\n * Get the current focus stack length.\n */\nexport function getFocusStackLength(): number {\n return focusStack.length;\n}\n\n/**\n * Clear the entire focus stack.\n */\nexport function clearFocusStack(): void {\n focusStack.length = 0;\n}\n\n/**\n * Gets the active element, accounting for shadow DOM.\n */\nfunction getActiveElement(doc: Document): HTMLElement | null {\n let activeElement = doc.activeElement as HTMLElement | null;\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement as HTMLElement;\n }\n return activeElement;\n}\n\n/**\n * Checks if an element is still valid for focus restoration.\n */\nfunction isValidForRestore(element: HTMLElement | null): boolean {\n if (!element) return false;\n if (!document.body.contains(element)) return false;\n if (element.hasAttribute(\"disabled\")) return false;\n if (element.getAttribute(\"aria-disabled\") === \"true\") return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n return true;\n}\n\n/**\n * Attempts to restore focus with retries.\n */\nfunction tryRestoreFocus(\n element: HTMLElement | null,\n options: Required<\n Pick<\n FocusRestoreOptions,\n \"maxRetries\" | \"retryDelay\" | \"preventScroll\" | \"onRestore\" | \"onRestoreFailed\"\n >\n >,\n): void {\n const { maxRetries, retryDelay, preventScroll, onRestore, onRestoreFailed } = options;\n let attempts = 0;\n\n const attempt = () => {\n if (!element) {\n onRestoreFailed?.();\n return;\n }\n\n if (isValidForRestore(element)) {\n if (preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n onRestore?.(element);\n return;\n }\n\n attempts++;\n if (attempts < maxRetries) {\n setTimeout(attempt, retryDelay);\n } else {\n onRestoreFailed?.();\n }\n };\n\n // Use requestAnimationFrame for the first attempt to ensure DOM is ready\n requestAnimationFrame(attempt);\n}\n\n/**\n * Creates a focus restoration manager.\n *\n * This hook saves the currently focused element when mounted and provides\n * methods to restore focus later, with retry logic for reliability.\n *\n * @example\n * ```tsx\n * function Modal(props) {\n * const focusRestore = createFocusRestore({\n * restoreOnUnmount: true,\n * onRestore: () => console.log('Focus restored'),\n * });\n *\n * return (\n * <div role=\"dialog\">\n * {props.children}\n * <button onClick={() => focusRestore.restore()}>\n * Close\n * </button>\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Manual focus management\n * function Dropdown() {\n * const focusRestore = createFocusRestore({ restoreOnUnmount: false });\n *\n * const onOpen = () => {\n * focusRestore.saveCurrentFocus();\n * // Focus dropdown content\n * };\n *\n * const onClose = () => {\n * focusRestore.restore();\n * };\n *\n * return <div>...</div>;\n * }\n * ```\n */\nexport function createFocusRestore(options: FocusRestoreOptions = {}): FocusRestoreResult {\n const {\n restoreOnUnmount = true,\n maxRetries = 3,\n retryDelay = 50,\n onRestore,\n onRestoreFailed,\n preventScroll = true,\n } = options;\n\n // During SSR, return no-op functions\n if (isServer) {\n return {\n restore: () => false,\n getSavedElement: () => null,\n saveCurrentFocus: () => {},\n clear: () => {},\n };\n }\n\n let savedElement: HTMLElement | null = null;\n\n // Save focus on mount\n onMount(() => {\n saveCurrentFocus();\n });\n\n // Restore focus on cleanup\n onCleanup(() => {\n if (restoreOnUnmount && savedElement) {\n tryRestoreFocus(savedElement, {\n maxRetries,\n retryDelay,\n preventScroll,\n onRestore: onRestore ?? (() => {}),\n onRestoreFailed: onRestoreFailed ?? (() => {}),\n });\n }\n });\n\n function saveCurrentFocus(): void {\n const doc = typeof document !== \"undefined\" ? document : null;\n if (!doc) return;\n\n const active = getActiveElement(doc);\n if (active && active !== doc.body) {\n savedElement = active;\n pushFocusStack(active);\n }\n }\n\n function restore(): boolean {\n if (!savedElement) return false;\n\n if (isValidForRestore(savedElement)) {\n if (preventScroll) {\n focusSafely(savedElement);\n } else {\n savedElement.focus();\n }\n onRestore?.(savedElement);\n return true;\n }\n\n // Try the focus stack\n while (focusStack.length > 0) {\n const stackElement = popFocusStack();\n if (stackElement && isValidForRestore(stackElement)) {\n if (preventScroll) {\n focusSafely(stackElement);\n } else {\n stackElement.focus();\n }\n onRestore?.(stackElement);\n return true;\n }\n }\n\n onRestoreFailed?.();\n return false;\n }\n\n function getSavedElement(): HTMLElement | null {\n return savedElement;\n }\n\n function clear(): void {\n savedElement = null;\n }\n\n return {\n restore,\n getSavedElement,\n saveCurrentFocus,\n clear,\n };\n}\n","/**\n * Virtual focus management for solidaria\n *\n * Provides virtual focus for large collections where tracking DOM focus\n * on every item is impractical. Instead, a single element receives real\n * focus while aria-activedescendant indicates the virtually focused item.\n *\n * This is commonly used in:\n * - Virtualized lists (where not all items are in the DOM)\n * - Large trees\n * - Autocomplete/combobox suggestions\n * - Grid/table navigation\n */\n\nimport { type Accessor, createSignal, createEffect, onCleanup } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\n\nexport interface VirtualFocusOptions<T> {\n /**\n * The items in the collection.\n */\n items: Accessor<T[]>;\n /**\n * Function to get a unique key for each item.\n */\n getKey: (item: T) => string;\n /**\n * Function to check if an item is disabled.\n */\n isDisabled?: (item: T) => boolean;\n /**\n * Initial focused key.\n */\n defaultFocusedKey?: string;\n /**\n * Controlled focused key.\n */\n focusedKey?: Accessor<string | null>;\n /**\n * Callback when focused key changes.\n */\n onFocusChange?: (key: string | null) => void;\n /**\n * Whether to wrap focus at the edges.\n * @default true\n */\n wrap?: boolean;\n /**\n * Whether to loop through disabled items.\n * @default false\n */\n skipDisabled?: boolean;\n /**\n * Orientation for keyboard navigation.\n * @default 'vertical'\n */\n orientation?: \"horizontal\" | \"vertical\" | \"both\";\n}\n\nexport interface VirtualFocusResult<T> {\n /**\n * The currently focused key.\n */\n focusedKey: Accessor<string | null>;\n /**\n * The currently focused item (if any).\n */\n focusedItem: Accessor<T | null>;\n /**\n * Set the focused key.\n */\n setFocusedKey: (key: string | null) => void;\n /**\n * Move focus to the next item.\n */\n focusNext: () => void;\n /**\n * Move focus to the previous item.\n */\n focusPrevious: () => void;\n /**\n * Move focus to the first item.\n */\n focusFirst: () => void;\n /**\n * Move focus to the last item.\n */\n focusLast: () => void;\n /**\n * Move focus by a page (for large lists).\n */\n focusPageDown: (pageSize?: number) => void;\n /**\n * Move focus up by a page (for large lists).\n */\n focusPageUp: (pageSize?: number) => void;\n /**\n * Check if a key is the currently focused key.\n */\n isFocused: (key: string) => boolean;\n /**\n * Props to spread on the container element.\n */\n containerProps: {\n \"aria-activedescendant\": Accessor<string | undefined>;\n onKeyDown: (e: KeyboardEvent) => void;\n };\n /**\n * Get props for an item element.\n */\n getItemProps: (key: string) => {\n id: string;\n \"aria-selected\"?: boolean;\n };\n}\n\nconst DEFAULT_PAGE_SIZE = 10;\n\n/**\n * Creates virtual focus management for a collection.\n *\n * Virtual focus uses aria-activedescendant to indicate which item is\n * \"focused\" while keeping real DOM focus on a container element. This\n * is more performant for large collections and required for virtualized\n * lists where items may not be in the DOM.\n *\n * @example\n * ```tsx\n * function Listbox(props) {\n * const virtualFocus = createVirtualFocus({\n * items: () => props.items,\n * getKey: (item) => item.id,\n * isDisabled: (item) => item.disabled,\n * });\n *\n * return (\n * <ul\n * role=\"listbox\"\n * tabIndex={0}\n * aria-activedescendant={virtualFocus.containerProps['aria-activedescendant']()}\n * onKeyDown={virtualFocus.containerProps.onKeyDown}\n * >\n * <For each={props.items}>\n * {(item) => (\n * <li\n * {...virtualFocus.getItemProps(item.id)}\n * role=\"option\"\n * aria-selected={virtualFocus.isFocused(item.id)}\n * >\n * {item.name}\n * </li>\n * )}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With controlled focus\n * function ControlledListbox() {\n * const [focusedKey, setFocusedKey] = createSignal<string | null>(null);\n *\n * const virtualFocus = createVirtualFocus({\n * items: () => items,\n * getKey: (item) => item.id,\n * focusedKey: focusedKey,\n * onFocusChange: setFocusedKey,\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n */\nexport function createVirtualFocus<T>(options: VirtualFocusOptions<T>): VirtualFocusResult<T> {\n const {\n items,\n getKey,\n isDisabled = () => false,\n defaultFocusedKey,\n focusedKey: controlledFocusedKey,\n onFocusChange,\n wrap = true,\n skipDisabled = true,\n orientation = \"vertical\",\n } = options;\n\n // During SSR, return minimal implementation\n if (isServer) {\n const emptyAccessor = () => null;\n return {\n focusedKey: emptyAccessor,\n focusedItem: emptyAccessor,\n setFocusedKey: () => {},\n focusNext: () => {},\n focusPrevious: () => {},\n focusFirst: () => {},\n focusLast: () => {},\n focusPageDown: () => {},\n focusPageUp: () => {},\n isFocused: () => false,\n containerProps: {\n \"aria-activedescendant\": () => undefined,\n onKeyDown: () => {},\n },\n getItemProps: (key: string) => ({ id: `item-${key}` }),\n };\n }\n\n // Internal state for uncontrolled mode\n const [internalKey, setInternalKey] = createSignal<string | null>(defaultFocusedKey ?? null);\n\n // Use controlled or uncontrolled value\n const focusedKey = controlledFocusedKey ?? internalKey;\n\n const setFocusedKey = (key: string | null) => {\n if (controlledFocusedKey) {\n onFocusChange?.(key);\n } else {\n setInternalKey(key);\n onFocusChange?.(key);\n }\n };\n\n // Get focused item\n const focusedItem = (): T | null => {\n const key = focusedKey();\n if (!key) return null;\n return items().find((item) => getKey(item) === key) ?? null;\n };\n\n // Get valid items (not disabled if skipDisabled is true)\n const getValidItems = (): T[] => {\n if (!skipDisabled) return items();\n return items().filter((item) => !isDisabled(item));\n };\n\n // Get index of key in valid items\n const getKeyIndex = (key: string | null): number => {\n if (!key) return -1;\n const validItems = getValidItems();\n return validItems.findIndex((item) => getKey(item) === key);\n };\n\n // Focus by index\n const focusByIndex = (index: number): void => {\n const validItems = getValidItems();\n if (validItems.length === 0) return;\n\n let targetIndex = index;\n\n if (wrap) {\n targetIndex = ((index % validItems.length) + validItems.length) % validItems.length;\n } else {\n targetIndex = Math.max(0, Math.min(index, validItems.length - 1));\n }\n\n const item = validItems[targetIndex];\n if (item) {\n setFocusedKey(getKey(item));\n }\n };\n\n const focusNext = (): void => {\n const currentIndex = getKeyIndex(focusedKey());\n focusByIndex(currentIndex + 1);\n };\n\n const focusPrevious = (): void => {\n const currentIndex = getKeyIndex(focusedKey());\n if (currentIndex === -1) {\n focusByIndex(getValidItems().length - 1);\n } else {\n focusByIndex(currentIndex - 1);\n }\n };\n\n const focusFirst = (): void => {\n focusByIndex(0);\n };\n\n const focusLast = (): void => {\n focusByIndex(getValidItems().length - 1);\n };\n\n const focusPageDown = (pageSize: number = DEFAULT_PAGE_SIZE): void => {\n const currentIndex = getKeyIndex(focusedKey());\n focusByIndex(currentIndex + pageSize);\n };\n\n const focusPageUp = (pageSize: number = DEFAULT_PAGE_SIZE): void => {\n const currentIndex = getKeyIndex(focusedKey());\n if (currentIndex === -1) {\n focusByIndex(getValidItems().length - 1);\n } else {\n focusByIndex(currentIndex - pageSize);\n }\n };\n\n const isFocused = (key: string): boolean => {\n return focusedKey() === key;\n };\n\n // Keyboard handler\n const onKeyDown = (e: KeyboardEvent): void => {\n const isVertical = orientation === \"vertical\" || orientation === \"both\";\n const isHorizontal = orientation === \"horizontal\" || orientation === \"both\";\n\n switch (e.key) {\n case \"ArrowDown\":\n if (isVertical) {\n e.preventDefault();\n focusNext();\n }\n break;\n case \"ArrowUp\":\n if (isVertical) {\n e.preventDefault();\n focusPrevious();\n }\n break;\n case \"ArrowRight\":\n if (isHorizontal) {\n e.preventDefault();\n focusNext();\n }\n break;\n case \"ArrowLeft\":\n if (isHorizontal) {\n e.preventDefault();\n focusPrevious();\n }\n break;\n case \"Home\":\n e.preventDefault();\n focusFirst();\n break;\n case \"End\":\n e.preventDefault();\n focusLast();\n break;\n case \"PageDown\":\n e.preventDefault();\n focusPageDown();\n break;\n case \"PageUp\":\n e.preventDefault();\n focusPageUp();\n break;\n }\n };\n\n const containerProps = {\n \"aria-activedescendant\": () => {\n const key = focusedKey();\n return key ? `item-${key}` : undefined;\n },\n onKeyDown,\n };\n\n const getItemProps = (key: string) => ({\n id: `item-${key}`,\n });\n\n return {\n focusedKey,\n focusedItem,\n setFocusedKey,\n focusNext,\n focusPrevious,\n focusFirst,\n focusLast,\n focusPageDown,\n focusPageUp,\n isFocused,\n containerProps,\n getItemProps,\n };\n}\n","/**\n * Auto-focus management for solidaria\n *\n * Provides priority-based auto-focus with deferred execution\n * and conflict resolution for multiple auto-focus elements.\n */\n\nimport { createEffect, onCleanup, onMount } from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { focusSafely } from \"../utils/focus\";\n\nexport interface AutoFocusOptions {\n /**\n * Whether auto-focus is enabled.\n * @default true\n */\n isEnabled?: boolean;\n /**\n * Priority level (higher = more important).\n * When multiple elements request auto-focus, the highest priority wins.\n * @default 0\n */\n priority?: number;\n /**\n * Delay in milliseconds before focusing.\n * Useful for animations or transitions.\n * @default 0\n */\n delay?: number;\n /**\n * Whether to focus even if another element is already focused.\n * @default false\n */\n force?: boolean;\n /**\n * Whether to prevent scrolling when focusing.\n * @default true\n */\n preventScroll?: boolean;\n /**\n * Callback when focus is applied.\n */\n onFocus?: (element: HTMLElement) => void;\n /**\n * Callback when focus is skipped (due to lower priority or other reasons).\n */\n onSkip?: () => void;\n}\n\nexport interface AutoFocusResult {\n /**\n * Manually trigger the auto-focus.\n */\n focus: () => void;\n /**\n * Cancel any pending auto-focus.\n */\n cancel: () => void;\n}\n\ninterface QueuedFocus {\n ref: () => HTMLElement | null | undefined;\n priority: number;\n delay: number;\n force: boolean;\n preventScroll: boolean;\n onFocus?: (element: HTMLElement) => void;\n onSkip?: () => void;\n}\n\n// Global queue for managing auto-focus requests\nlet autoFocusQueue: QueuedFocus[] = [];\nlet processingTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Process the auto-focus queue and focus the highest priority element.\n */\nfunction processAutoFocusQueue(): void {\n if (processingTimeout) {\n clearTimeout(processingTimeout);\n processingTimeout = null;\n }\n\n if (autoFocusQueue.length === 0) return;\n\n // Sort by priority (highest first)\n autoFocusQueue.sort((a, b) => b.priority - a.priority);\n\n // Get the highest priority item\n const winner = autoFocusQueue[0];\n const losers = autoFocusQueue.slice(1);\n\n // Clear the queue\n autoFocusQueue = [];\n\n // Notify losers\n for (const loser of losers) {\n loser.onSkip?.();\n }\n\n // Focus the winner\n const element = winner.ref();\n if (!element) {\n winner.onSkip?.();\n return;\n }\n\n // Check if we should focus\n const activeElement = document.activeElement;\n const shouldFocus =\n winner.force ||\n !activeElement ||\n activeElement === document.body ||\n activeElement === document.documentElement;\n\n if (!shouldFocus) {\n winner.onSkip?.();\n return;\n }\n\n // Apply focus with optional delay\n if (winner.delay > 0) {\n setTimeout(() => {\n const el = winner.ref();\n if (el && document.body.contains(el)) {\n if (winner.preventScroll) {\n focusSafely(el);\n } else {\n el.focus();\n }\n winner.onFocus?.(el);\n }\n }, winner.delay);\n } else {\n if (winner.preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n winner.onFocus?.(element);\n }\n}\n\n/**\n * Queue an element for auto-focus.\n */\nfunction queueAutoFocus(item: QueuedFocus): void {\n autoFocusQueue.push(item);\n\n // Schedule processing on next frame to allow all components to register\n if (processingTimeout === null) {\n processingTimeout = setTimeout(processAutoFocusQueue, 0);\n }\n}\n\n/**\n * Remove an item from the auto-focus queue.\n */\nfunction removeFromQueue(ref: () => HTMLElement | null | undefined): void {\n autoFocusQueue = autoFocusQueue.filter((item) => item.ref !== ref);\n}\n\n/**\n * Creates auto-focus behavior for an element.\n *\n * This hook registers the element for auto-focus when mounted. If multiple\n * elements request auto-focus, the one with the highest priority wins.\n *\n * @param ref - Accessor for the element to focus\n * @param options - Auto-focus options\n *\n * @example\n * ```tsx\n * function Dialog(props) {\n * let contentRef: HTMLDivElement | undefined;\n *\n * createAutoFocus(() => contentRef, {\n * priority: 10, // High priority for dialogs\n * onFocus: () => console.log('Dialog focused'),\n * });\n *\n * return (\n * <div ref={contentRef} tabIndex={-1}>\n * {props.children}\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With delay for animations\n * function AnimatedPanel() {\n * let panelRef: HTMLDivElement | undefined;\n *\n * createAutoFocus(() => panelRef, {\n * delay: 300, // Wait for animation\n * });\n *\n * return <div ref={panelRef} class=\"animated-panel\">...</div>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Conditional auto-focus\n * function Input(props) {\n * let inputRef: HTMLInputElement | undefined;\n *\n * createAutoFocus(() => inputRef, {\n * isEnabled: props.autoFocus,\n * });\n *\n * return <input ref={inputRef} />;\n * }\n * ```\n */\nexport function createAutoFocus(\n ref: () => HTMLElement | null | undefined,\n options: AutoFocusOptions = {},\n): AutoFocusResult {\n const {\n isEnabled = true,\n priority = 0,\n delay = 0,\n force = false,\n preventScroll = true,\n onFocus,\n onSkip,\n } = options;\n\n // During SSR, return no-op functions\n if (isServer) {\n return {\n focus: () => {},\n cancel: () => {},\n };\n }\n\n let canceled = false;\n\n // Queue auto-focus on mount\n onMount(() => {\n if (!isEnabled || canceled) return;\n\n queueAutoFocus({\n ref,\n priority,\n delay,\n force,\n preventScroll,\n onFocus,\n onSkip,\n });\n });\n\n // Remove from queue on cleanup\n onCleanup(() => {\n removeFromQueue(ref);\n });\n\n const focus = (): void => {\n if (canceled) return;\n\n const element = ref();\n if (!element) return;\n\n if (preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n onFocus?.(element);\n };\n\n const cancel = (): void => {\n canceled = true;\n removeFromQueue(ref);\n };\n\n return {\n focus,\n cancel,\n };\n}\n\n/**\n * Clears all pending auto-focus requests.\n * Useful for testing or when navigating away.\n */\nexport function clearAutoFocusQueue(): void {\n if (processingTimeout) {\n clearTimeout(processingTimeout);\n processingTimeout = null;\n }\n autoFocusQueue = [];\n}\n\n/**\n * Gets the current auto-focus queue length.\n * Useful for debugging.\n */\nexport function getAutoFocusQueueLength(): number {\n return autoFocusQueue.length;\n}\n","/**\n * createDisclosure hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a disclosure component.\n *\n * Port of @react-aria/disclosure useDisclosure.\n */\n\nimport { type JSX, createEffect, onCleanup } from \"solid-js\";\nimport { type DisclosureState } from \"@proyecto-viviana/solid-stately\";\nimport { createId, canUseDOM } from \"../ssr\";\nimport { createPress } from \"../interactions/createPress\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\nexport interface AriaDisclosureProps {\n /** Whether the disclosure is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DisclosureAria {\n /** Props for the disclosure trigger button. */\n buttonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Props for the disclosure panel. */\n panelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the disclosure trigger is currently pressed. */\n isPressed: () => boolean;\n}\n\nexport function getDisclosurePanelHiddenAttribute(\n isExpanded: boolean,\n hasDOM = canUseDOM,\n): true | undefined {\n return hasDOM ? undefined : !isExpanded || undefined;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a disclosure component.\n *\n * A disclosure is a widget that can be toggled to show or hide content.\n * It consists of a trigger button and a panel.\n *\n * @example\n * ```tsx\n * import { createDisclosure } from 'solidaria';\n * import { createDisclosureState } from 'solid-stately';\n *\n * function Disclosure(props) {\n * const state = createDisclosureState(props);\n * let panelRef;\n * const { buttonProps, panelProps } = createDisclosure(\n * { get isDisabled() { return props.isDisabled; } },\n * state,\n * () => panelRef\n * );\n *\n * return (\n * <div>\n * <button {...buttonProps}>Toggle</button>\n * <div {...panelProps} ref={panelRef}>\n * {props.children}\n * </div>\n * </div>\n * );\n * }\n * ```\n */\nexport function createDisclosure(\n props: AriaDisclosureProps | (() => AriaDisclosureProps),\n state: DisclosureState,\n panelRef: () => HTMLElement | null,\n): DisclosureAria {\n // Handle both plain object and accessor function patterns\n const getProps = typeof props === \"function\" ? props : () => props;\n\n const triggerId = createId();\n const panelId = createId();\n\n let raf: number | null = null;\n let isExpandedRef: boolean | null = null;\n\n const requestFrame = (callback: FrameRequestCallback): number => {\n if (typeof requestAnimationFrame === \"function\") {\n return requestAnimationFrame(callback);\n }\n\n return window.setTimeout(() => callback(performance.now()), 16);\n };\n\n const cancelFrame = (id: number) => {\n if (typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(id);\n } else {\n window.clearTimeout(id);\n }\n };\n\n const cancelPendingRaf = () => {\n if (raf != null && canUseDOM) {\n cancelFrame(raf);\n raf = null;\n }\n };\n\n const setPanelSize = (panel: HTMLElement, width: string, height: string) => {\n panel.style.setProperty(\"--disclosure-panel-width\", width);\n panel.style.setProperty(\"--disclosure-panel-height\", height);\n };\n\n const getPanelAnimations = (panel: HTMLElement): Animation[] => {\n return typeof panel.getAnimations === \"function\" ? panel.getAnimations() : [];\n };\n\n // Handle browser find-in-page reveal for collapsed panels.\n createEffect(() => {\n if (!canUseDOM) return;\n\n const panel = panelRef();\n if (!panel) return;\n\n const handleBeforeMatch = () => {\n cancelPendingRaf();\n raf = requestFrame(() => {\n if (panelRef() === panel) {\n panel.setAttribute(\"hidden\", \"until-found\");\n }\n raf = null;\n });\n\n state.toggle();\n };\n\n panel.addEventListener(\"beforematch\", handleBeforeMatch);\n onCleanup(() => {\n panel.removeEventListener(\"beforematch\", handleBeforeMatch);\n });\n });\n\n // Handle panel visibility and animation sizing.\n createEffect(() => {\n if (!canUseDOM) return;\n\n const panel = panelRef();\n if (!panel) return;\n\n const isExpanded = state.isExpanded();\n cancelPendingRaf();\n\n if (isExpandedRef === null || typeof panel.getAnimations !== \"function\") {\n if (isExpanded) {\n panel.removeAttribute(\"hidden\");\n setPanelSize(panel, \"auto\", \"auto\");\n } else {\n panel.setAttribute(\"hidden\", \"until-found\");\n setPanelSize(panel, \"0px\", \"0px\");\n }\n } else if (isExpanded !== isExpandedRef) {\n if (isExpanded) {\n panel.removeAttribute(\"hidden\");\n setPanelSize(panel, `${panel.scrollWidth}px`, `${panel.scrollHeight}px`);\n\n Promise.all(getPanelAnimations(panel).map((animation) => animation.finished))\n .then(() => {\n if (panelRef() === panel && state.isExpanded()) {\n setPanelSize(panel, \"auto\", \"auto\");\n }\n })\n .catch(() => {});\n } else {\n setPanelSize(panel, `${panel.scrollWidth}px`, `${panel.scrollHeight}px`);\n\n // Force style recalculation before animating to zero.\n window.getComputedStyle(panel).height;\n\n setPanelSize(panel, \"0px\", \"0px\");\n\n Promise.all(getPanelAnimations(panel).map((animation) => animation.finished))\n .then(() => {\n if (panelRef() === panel && !state.isExpanded()) {\n panel.setAttribute(\"hidden\", \"until-found\");\n }\n })\n .catch(() => {});\n }\n }\n\n isExpandedRef = isExpanded;\n });\n\n onCleanup(cancelPendingRaf);\n\n // Use createPress for proper interaction handling (matches Select/Menu pattern)\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return getProps().isDisabled;\n },\n onPressStart(event) {\n if (event.pointerType === \"keyboard\") {\n state.toggle();\n }\n },\n onPress(event) {\n if (event.pointerType !== \"keyboard\") {\n state.toggle();\n }\n },\n });\n\n return {\n isPressed,\n // Button props - merge with pressProps for consistent interaction handling\n // Using getter (not createMemo) to match createSelect pattern\n get buttonProps(): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const p = getProps();\n return mergeProps(\n pressProps as Record<string, unknown>,\n {\n id: triggerId,\n type: \"button\",\n \"aria-expanded\": state.isExpanded(),\n \"aria-controls\": panelId,\n disabled: p.isDisabled,\n } as Record<string, unknown>,\n ) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n },\n // Panel props\n get panelProps(): JSX.HTMLAttributes<HTMLElement> {\n return {\n id: panelId,\n role: \"group\",\n \"aria-labelledby\": triggerId,\n \"aria-hidden\": !state.isExpanded(),\n hidden: getDisclosurePanelHiddenAttribute(state.isExpanded()),\n };\n },\n };\n}\n","/**\n * createDisclosureGroup hook for Solidaria\n *\n * Provides accessibility implementation for a group of disclosures (accordion).\n *\n * Port of @react-aria/disclosure.\n */\n\nimport { type JSX } from \"solid-js\";\nimport { type DisclosureGroupState } from \"@proyecto-viviana/solid-stately\";\nimport { type MaybeAccessor } from \"../utils/reactivity\";\n\nexport interface AriaDisclosureGroupProps {\n /** Whether the disclosure group is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DisclosureGroupAria {\n /** Props for the disclosure group container. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides accessibility implementation for a group of disclosures (accordion).\n *\n * @example\n * ```tsx\n * import { createDisclosureGroup } from 'solidaria';\n * import { createDisclosureGroupState } from 'solid-stately';\n *\n * function Accordion(props) {\n * const state = createDisclosureGroupState(props);\n * const { groupProps } = createDisclosureGroup(props, state);\n *\n * return (\n * <div {...groupProps}>\n * {props.children}\n * </div>\n * );\n * }\n * ```\n */\nexport function createDisclosureGroup(\n _props: MaybeAccessor<AriaDisclosureGroupProps>,\n _state: DisclosureGroupState,\n): DisclosureGroupAria {\n return {\n get groupProps() {\n return {};\n },\n };\n}\n","/**\n * Meter hook for Solidaria\n *\n * Provides the accessibility implementation for a meter component.\n * Meters represent a quantity within a known range, or a fractional value.\n * Unlike progress bars, meters represent a current value rather than progress toward a goal.\n *\n * This is a port of @react-aria/meter's useMeter hook.\n */\n\nimport { createProgressBar, type AriaProgressBarProps } from \"../progress/createProgressBar\";\n\nexport interface AriaMeterProps extends Omit<AriaProgressBarProps, \"isIndeterminate\"> {\n /** The current value (controlled). */\n value?: number;\n /** The smallest value allowed for the input. @default 0 */\n minValue?: number;\n /** The largest value allowed for the input. @default 100 */\n maxValue?: number;\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: string;\n /** The display format of the value label. */\n formatOptions?: Intl.NumberFormatOptions;\n /** The content to display as the label. */\n label?: string;\n /** An accessibility label for this item. */\n \"aria-label\"?: string;\n /** Identifies the element (or elements) that labels the current element. */\n \"aria-labelledby\"?: string;\n /** Identifies the element (or elements) that describes the object. */\n \"aria-describedby\"?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n \"aria-details\"?: string;\n}\n\nexport interface MeterAria {\n /** Props for the meter container element. */\n meterProps: Record<string, unknown>;\n /** Props for the meter's visual label element (if any). */\n labelProps: Record<string, unknown>;\n}\n\n/**\n * Provides the accessibility implementation for a meter component.\n * Meters represent a quantity within a known range, or a fractional value.\n */\nexport function createMeter(props: AriaMeterProps = {}): MeterAria {\n // Reuse progress bar implementation\n const { progressBarProps, labelProps } = createProgressBar(props);\n\n return {\n get meterProps() {\n return {\n ...progressBarProps,\n role: \"meter\",\n };\n },\n get labelProps() {\n return labelProps;\n },\n };\n}\n","/**\n * TagGroup hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * Based on @react-aria/tag useTagGroup\n */\n\nimport { createEffect, onCleanup } from \"solid-js\";\nimport { createLabel } from \"../label/createLabel\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTagGroupProps {\n /** An ID for the tag group. */\n id?: string;\n /** Whether the tag group is disabled. */\n isDisabled?: boolean;\n /** The label for the tag group. */\n label?: string;\n /** An accessible label for the tag group when no visible label is provided. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the tag group. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the tag group. */\n \"aria-describedby\"?: string;\n /** A description of the tag group. */\n description?: string;\n /** An error message for the tag group. */\n errorMessage?: string;\n /** Handler that is called when a user removes a tag. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagGroupAria {\n /** Props for the tag group container element. */\n gridProps: Record<string, unknown>;\n /** Props for the tag group's visible label (if any). */\n labelProps: Record<string, unknown>;\n /** Props for the tag group description element, if any. */\n descriptionProps: Record<string, unknown>;\n /** Props for the tag group error message element, if any. */\n errorMessageProps: Record<string, unknown>;\n}\n\n// Shared data between tag group and tags\nconst tagGroupData = new WeakMap<object, TagGroupData>();\n\ninterface TagGroupData {\n id: string;\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport function getTagGroupData(state: ListState): TagGroupData | undefined {\n return tagGroupData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\nexport function createTagGroup<T>(\n props: MaybeAccessor<AriaTagGroupProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null,\n): TagGroupAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n const getFallbackAriaLabel = () => {\n const p = getProps();\n return !p.label && !p[\"aria-label\"] && !p[\"aria-labelledby\"] ? \"Tag list\" : undefined;\n };\n const sharedData: TagGroupData = {\n id,\n get onRemove() {\n return getProps().onRemove;\n },\n };\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Create label handling\n const { labelProps, fieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"] ?? getFallbackAriaLabel();\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Share data with child tags before they create their aria state.\n tagGroupData.set(state, sharedData);\n\n // Clean up the shared state when the tag group owner is disposed.\n createEffect(() => {\n tagGroupData.set(state, sharedData);\n\n onCleanup(() => {\n if (tagGroupData.get(state) === sharedData) {\n tagGroupData.delete(state);\n }\n });\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n return {\n get gridProps() {\n const p = getProps();\n const hasItems = state.collection().size > 0;\n\n return mergeProps(domProps(), fieldProps as Record<string, unknown>, {\n id,\n role: hasItems ? \"grid\" : \"group\",\n \"aria-multiselectable\": hasItems && state.selectionMode() === \"multiple\" ? true : undefined,\n \"aria-atomic\": false,\n \"aria-relevant\": \"additions\",\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": p.isDisabled || undefined,\n });\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n };\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n };\n },\n };\n}\n","/**\n * Tag hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n *\n * Based on @react-aria/tag useTag\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createFocusable } from \"../interactions/createFocusable\";\nimport { createPress } from \"../interactions/createPress\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { getTagGroupData } from \"./createTagGroup\";\nimport type { ListState, Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTagProps {\n /** The unique key for this tag. */\n key: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for the tag used for accessibility. */\n textValue?: string;\n}\n\nexport interface TagAria {\n /** Props for the tag row element. */\n rowProps: Record<string, unknown>;\n /** Props for the tag cell element. */\n gridCellProps: Record<string, unknown>;\n /** Props for the tag remove button. */\n removeButtonProps: Record<string, unknown>;\n /** Whether the tag can be removed. */\n allowsRemoving: boolean;\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n */\nexport function createTag<T>(\n props: MaybeAccessor<AriaTagProps>,\n state: ListState<T>,\n ref: () => HTMLElement | null,\n): TagAria {\n const getProps = () => access(props);\n const rowId = createId();\n const cellId = createId();\n const removeButtonId = createId();\n\n // Get shared data from tag group\n const getData = () => getTagGroupData(state);\n\n // Get key\n const key = () => getProps().key;\n\n // Compute states\n const isDisabled = createMemo(() => {\n const p = getProps();\n return p.isDisabled || state.isDisabled(key());\n });\n\n const isSelected = createMemo(() => {\n return state.isSelected(key());\n });\n\n const isSelectable = createMemo(() => state.selectionMode() !== \"none\");\n\n const isFocused = createMemo(() => {\n return state.focusedKey() === key();\n });\n\n const getFirstFocusableKey = (): Key | null => {\n const collection = state.collection();\n let candidate = collection.getFirstKey();\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyAfter(candidate);\n }\n return candidate;\n };\n\n const getLastFocusableKey = (): Key | null => {\n const collection = state.collection();\n let candidate = collection.getLastKey();\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyBefore(candidate);\n }\n return candidate;\n };\n\n const getNextFocusableKey = (fromKey: Key): Key | null => {\n const collection = state.collection();\n let candidate = collection.getKeyAfter(fromKey);\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyAfter(candidate);\n }\n\n if (candidate != null) {\n return candidate;\n }\n\n return getFirstFocusableKey();\n };\n\n const getPreviousFocusableKey = (fromKey: Key): Key | null => {\n const collection = state.collection();\n let candidate = collection.getKeyBefore(fromKey);\n while (candidate != null && state.isDisabled(candidate)) {\n candidate = collection.getKeyBefore(candidate);\n }\n\n if (candidate != null) {\n return candidate;\n }\n\n return getLastFocusableKey();\n };\n\n const focusKey = (nextKey: Key | null) => {\n if (nextKey == null) {\n return;\n }\n\n state.setFocusedKey(nextKey);\n const currentElement = ref();\n\n if (!currentElement) {\n return;\n }\n\n if (nextKey === key()) {\n currentElement.focus();\n return;\n }\n\n const tagList = currentElement.parentElement;\n if (!tagList) {\n return;\n }\n\n const nextTag = Array.from(tagList.querySelectorAll<HTMLElement>('[role=\"row\"]')).find(\n (el) => el.getAttribute(\"data-key\") === String(nextKey),\n );\n\n nextTag?.focus();\n };\n\n // Handle press for selection\n const { pressProps, isPressed } = createPress({\n isDisabled,\n onPress: () => {\n if (!isDisabled()) {\n state.setFocusedKey(key());\n state.toggleSelection(key());\n }\n },\n });\n\n // Handle focusable\n const { focusableProps } = createFocusable(\n {\n isDisabled,\n onFocus: () => {\n state.setFocusedKey(key());\n },\n },\n ref,\n );\n\n // Handle keyboard for navigation and removal\n const handleKeyDown = (e: KeyboardEvent) => {\n if (isDisabled()) return;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n focusKey(getNextFocusableKey(key()));\n return;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n focusKey(getPreviousFocusableKey(key()));\n return;\n case \"Home\":\n e.preventDefault();\n focusKey(getFirstFocusableKey());\n return;\n case \"End\":\n e.preventDefault();\n focusKey(getLastFocusableKey());\n return;\n default:\n break;\n }\n\n if (e.key === \"Delete\" || e.key === \"Backspace\") {\n e.preventDefault();\n const data = getData();\n if (data?.onRemove) {\n // Remove selected keys if this tag is selected, otherwise just this tag\n if (isSelected()) {\n const selection = state.selectedKeys();\n const keysToRemove =\n selection === \"all\"\n ? new Set(Array.from(state.collection()).map((item) => (item as { key: Key }).key))\n : new Set(selection);\n data.onRemove(keysToRemove);\n } else {\n data.onRemove(new Set([key()]));\n }\n }\n }\n };\n\n // Compute tabIndex\n const tabIndex = createMemo(() => {\n if (isDisabled()) return -1;\n\n if (isFocused()) {\n return 0;\n }\n\n if (state.focusedKey() !== null) {\n return -1;\n }\n\n const collection = state.collection();\n let defaultTabStop: Key | null = null;\n\n if (state.selectionMode() !== \"none\") {\n for (const item of collection) {\n if (!state.isDisabled(item.key) && state.isSelected(item.key)) {\n defaultTabStop = item.key;\n break;\n }\n }\n }\n\n if (defaultTabStop == null) {\n defaultTabStop = getFirstFocusableKey();\n }\n\n if (key() === defaultTabStop) {\n return 0;\n }\n\n return -1;\n });\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>);\n\n // Check if removal is allowed\n const allowsRemoving = createMemo(() => {\n const data = getData();\n return !!data?.onRemove;\n });\n\n return {\n get rowProps() {\n return mergeProps(\n domProps(),\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>,\n {\n id: rowId,\n role: \"row\",\n tabIndex: tabIndex(),\n \"data-key\": String(key()),\n \"aria-selected\": isSelectable() ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n onKeyDown: handleKeyDown,\n },\n );\n },\n get gridCellProps() {\n return {\n id: cellId,\n role: \"gridcell\",\n \"aria-describedby\": allowsRemoving() ? removeButtonId : undefined,\n };\n },\n get removeButtonProps() {\n const data = getData();\n return {\n id: removeButtonId,\n \"aria-label\": \"Remove\",\n \"aria-labelledby\": `${removeButtonId} ${rowId}`,\n isDisabled: isDisabled(),\n onPress: () => {\n if (data?.onRemove && !isDisabled()) {\n data.onRemove(new Set([key()]));\n }\n },\n };\n },\n get allowsRemoving() {\n return allowsRemoving();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isFocused() {\n return isFocused();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","import {\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n type LocalizedStrings,\n} from \"@internationalized/string\";\n\ntype CalendarPromptKey = \"startRangeSelectionPrompt\" | \"finishRangeSelectionPrompt\";\ntype CalendarLabelKey =\n | \"dateRange\"\n | \"dateSelected\"\n | \"maximumDate\"\n | \"minimumDate\"\n | \"selectedDateDescription\"\n | \"selectedRangeDescription\"\n | \"todayDate\"\n | \"todayDateSelected\";\ntype CalendarLabelVariables = {\n date?: string;\n dateRange?: string;\n startDate?: string;\n endDate?: string;\n};\ntype CalendarLabelMessage = string | ((args: CalendarLabelVariables | undefined) => string);\n\nconst calendarPromptStrings: LocalizedStrings<CalendarPromptKey, string> = {\n \"ar-AE\": {\n startRangeSelectionPrompt: \"انقر لبدء عملية تحديد نطاق التاريخ\",\n finishRangeSelectionPrompt: \"انقر لإنهاء عملية تحديد نطاق التاريخ\",\n },\n \"bg-BG\": {\n startRangeSelectionPrompt: \"Натиснете, за да пристъпите към избора на времеви интервал\",\n finishRangeSelectionPrompt: \"Натиснете, за да довършите избора на времеви интервал\",\n },\n \"cs-CZ\": {\n startRangeSelectionPrompt: \"Kliknutím zahájíte výběr rozsahu dat\",\n finishRangeSelectionPrompt: \"Kliknutím dokončíte výběr rozsahu dat\",\n },\n \"da-DK\": {\n startRangeSelectionPrompt: \"Klik for at starte valg af datoområde\",\n finishRangeSelectionPrompt: \"Klik for at fuldføre valg af datoområde\",\n },\n \"de-DE\": {\n startRangeSelectionPrompt: \"Klicken, um die Auswahl des Datumsbereichs zu beginnen\",\n finishRangeSelectionPrompt: \"Klicken, um die Auswahl des Datumsbereichs zu beenden\",\n },\n \"el-GR\": {\n startRangeSelectionPrompt: \"Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών\",\n finishRangeSelectionPrompt: \"Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών\",\n },\n \"en-US\": {\n startRangeSelectionPrompt: \"Click to start selecting date range\",\n finishRangeSelectionPrompt: \"Click to finish selecting date range\",\n },\n \"es-ES\": {\n startRangeSelectionPrompt: \"Haga clic para comenzar a seleccionar un rango de fechas\",\n finishRangeSelectionPrompt: \"Haga clic para terminar de seleccionar rango de fechas\",\n },\n \"et-EE\": {\n startRangeSelectionPrompt: \"Klõpsake kuupäevavahemiku valimiseks\",\n finishRangeSelectionPrompt: \"Klõpsake kuupäevavahemiku valimise lõpetamiseks\",\n },\n \"fi-FI\": {\n startRangeSelectionPrompt: \"Aloita päivämääräalueen valinta napsauttamalla tätä.\",\n finishRangeSelectionPrompt: \"Lopeta päivämääräalueen valinta napsauttamalla tätä.\",\n },\n \"fr-FR\": {\n startRangeSelectionPrompt: \"Cliquer pour commencer à sélectionner la plage de dates\",\n finishRangeSelectionPrompt: \"Cliquer pour finir de sélectionner la plage de dates\",\n },\n \"he-IL\": {\n startRangeSelectionPrompt: \"לחץ כדי להתחיל בבחירת טווח התאריכים\",\n finishRangeSelectionPrompt: \"חץ כדי לסיים את בחירת טווח התאריכים\",\n },\n \"hr-HR\": {\n startRangeSelectionPrompt: \"Kliknite da započnete raspon odabranih datuma\",\n finishRangeSelectionPrompt: \"Kliknite da dovršite raspon odabranih datuma\",\n },\n \"hu-HU\": {\n startRangeSelectionPrompt: \"Kattintson a dátumtartomány kijelölésének indításához\",\n finishRangeSelectionPrompt: \"Kattintson a dátumtartomány kijelölésének befejezéséhez\",\n },\n \"it-IT\": {\n startRangeSelectionPrompt: \"Fai clic per selezionare l’intervallo di date\",\n finishRangeSelectionPrompt: \"Fai clic per completare la selezione dell’intervallo di date\",\n },\n \"ja-JP\": {\n startRangeSelectionPrompt: \"クリックして日付範囲の選択を開始\",\n finishRangeSelectionPrompt: \"クリックして日付範囲の選択を終了\",\n },\n \"ko-KR\": {\n startRangeSelectionPrompt: \"날짜 범위 선택을 시작하려면 클릭하십시오.\",\n finishRangeSelectionPrompt: \"날짜 범위 선택을 완료하려면 클릭하십시오.\",\n },\n \"lt-LT\": {\n startRangeSelectionPrompt: \"Spustelėkite, kad pradėtumėte pasirinkti datų intervalą\",\n finishRangeSelectionPrompt: \"Spustelėkite, kad baigtumėte pasirinkti datų intervalą\",\n },\n \"lv-LV\": {\n startRangeSelectionPrompt: \"Noklikšķiniet, lai sāktu datumu diapazona atlasi\",\n finishRangeSelectionPrompt: \"Noklikšķiniet, lai pabeigtu datumu diapazona atlasi\",\n },\n \"nb-NO\": {\n startRangeSelectionPrompt: \"Klikk for å starte valg av datoområde\",\n finishRangeSelectionPrompt: \"Klikk for å fullføre valg av datoområde\",\n },\n \"nl-NL\": {\n startRangeSelectionPrompt: \"Klik om het datumbereik te selecteren\",\n finishRangeSelectionPrompt: \"Klik om de selectie van het datumbereik te voltooien\",\n },\n \"pl-PL\": {\n startRangeSelectionPrompt: \"Kliknij, aby rozpocząć wybór zakresu dat\",\n finishRangeSelectionPrompt: \"Kliknij, aby zakończyć wybór zakresu dat\",\n },\n \"pt-BR\": {\n startRangeSelectionPrompt: \"Clique para iniciar a seleção do intervalo de datas\",\n finishRangeSelectionPrompt: \"Clique para concluir a seleção do intervalo de datas\",\n },\n \"pt-PT\": {\n startRangeSelectionPrompt: \"Clique para começar a selecionar o intervalo de datas\",\n finishRangeSelectionPrompt: \"Clique para terminar de selecionar o intervalo de datas\",\n },\n \"ro-RO\": {\n startRangeSelectionPrompt: \"Apăsaţi pentru a începe selecţia razei pentru dată\",\n finishRangeSelectionPrompt: \"Apăsaţi pentru a finaliza selecţia razei pentru dată\",\n },\n \"ru-RU\": {\n startRangeSelectionPrompt: \"Щелкните, чтобы начать выбор диапазона дат\",\n finishRangeSelectionPrompt: \"Щелкните, чтобы завершить выбор диапазона дат\",\n },\n \"sk-SK\": {\n startRangeSelectionPrompt: \"Kliknutím spustíte výber rozsahu dátumov\",\n finishRangeSelectionPrompt: \"Kliknutím dokončíte výber rozsahu dátumov\",\n },\n \"sl-SI\": {\n startRangeSelectionPrompt: \"Kliknite za začetek izbire datumskega obsega\",\n finishRangeSelectionPrompt: \"Kliknite za dokončanje izbire datumskega obsega\",\n },\n \"sr-SP\": {\n startRangeSelectionPrompt: \"Kliknite da započnete opseg izabranih datuma\",\n finishRangeSelectionPrompt: \"Kliknite da dovršite opseg izabranih datuma\",\n },\n \"sv-SE\": {\n startRangeSelectionPrompt: \"Klicka för att välja datumintervall\",\n finishRangeSelectionPrompt: \"Klicka för att avsluta val av datumintervall\",\n },\n \"tr-TR\": {\n startRangeSelectionPrompt: \"Tarih aralığı seçimini başlatmak için tıklayın\",\n finishRangeSelectionPrompt: \"Tarih aralığı seçimini tamamlamak için tıklayın\",\n },\n \"uk-UA\": {\n startRangeSelectionPrompt: \"Натисніть, щоб почати вибір діапазону дат\",\n finishRangeSelectionPrompt: \"Натисніть, щоб завершити вибір діапазону дат\",\n },\n \"zh-CN\": {\n startRangeSelectionPrompt: \"单击以开始选择日期范围\",\n finishRangeSelectionPrompt: \"单击以完成选择日期范围\",\n },\n \"zh-TW\": {\n startRangeSelectionPrompt: \"按一下以開始選取日期範圍\",\n finishRangeSelectionPrompt: \"按一下以完成選取日期範圍\",\n },\n};\n\nconst calendarPromptDictionary = new LocalizedStringDictionary(calendarPromptStrings);\n\nconst calendarLabelStrings: LocalizedStrings<CalendarLabelKey, CalendarLabelMessage> = {\n \"en-US\": {\n dateRange: (args) => `${args?.startDate} to ${args?.endDate}`,\n dateSelected: (args) => `${args?.date} selected`,\n maximumDate: \"Last available date\",\n minimumDate: \"First available date\",\n selectedDateDescription: (args) => `Selected Date: ${args?.date}`,\n selectedRangeDescription: (args) => `Selected Range: ${args?.dateRange}`,\n todayDate: (args) => `Today, ${args?.date}`,\n todayDateSelected: (args) => `Today, ${args?.date} selected`,\n },\n \"fr-FR\": {\n dateRange: (args) => `${args?.startDate} à ${args?.endDate}`,\n dateSelected: (args) => `${args?.date} sélectionné`,\n maximumDate: \"Dernière date disponible\",\n minimumDate: \"Première date disponible\",\n selectedDateDescription: (args) => `Date sélectionnée : ${args?.date}`,\n selectedRangeDescription: (args) => `Plage sélectionnée : ${args?.dateRange}`,\n todayDate: (args) => `Aujourd'hui, ${args?.date}`,\n todayDateSelected: (args) => `Aujourd’hui, ${args?.date} sélectionné`,\n },\n \"ar-AE\": {\n dateRange: (args) => `${args?.startDate} إلى ${args?.endDate}`,\n dateSelected: (args) => `${args?.date} المحدد`,\n maximumDate: \"آخر تاريخ متاح\",\n minimumDate: \"أول تاريخ متاح\",\n selectedDateDescription: (args) => `تاريخ محدد: ${args?.date}`,\n selectedRangeDescription: (args) => `المدى الزمني المحدد: ${args?.dateRange}`,\n todayDate: (args) => `اليوم، ${args?.date}`,\n todayDateSelected: (args) => `اليوم، ${args?.date} محدد`,\n },\n};\nconst calendarLabelDictionary = new LocalizedStringDictionary(calendarLabelStrings);\n\nexport function formatCalendarPrompt(locale: string, key: CalendarPromptKey): string {\n return new LocalizedStringFormatter(locale, calendarPromptDictionary).format(key);\n}\n\nexport function formatCalendarLabel(\n locale: string,\n key: CalendarLabelKey,\n variables?: CalendarLabelVariables,\n): string {\n return new LocalizedStringFormatter(locale, calendarLabelDictionary).format(key, variables);\n}\n","import {\n type CalendarDate,\n DateFormatter,\n endOfMonth,\n isSameDay,\n startOfMonth,\n} from \"@internationalized/date\";\nimport type { CalendarState, RangeCalendarState } from \"@proyecto-viviana/solid-stately\";\nimport { formatCalendarLabel } from \"./intl\";\n\nexport interface CalendarHookData {\n errorMessageId?: string;\n selectedDateDescription?: string;\n}\n\nconst hookData = new WeakMap<CalendarState | RangeCalendarState, CalendarHookData>();\n\nexport function setCalendarHookData(\n state: CalendarState | RangeCalendarState,\n data: CalendarHookData,\n): void {\n hookData.set(state, data);\n}\n\nexport function getCalendarHookData(\n state: CalendarState | RangeCalendarState,\n): CalendarHookData | undefined {\n return hookData.get(state);\n}\n\nexport function getEraFormat(date: CalendarDate | undefined): \"short\" | undefined {\n return date?.calendar.identifier === \"gregory\" && date.era === \"BC\" ? \"short\" : undefined;\n}\n\nexport function formatVisibleRangeDescription(\n startDate: CalendarDate,\n endDate: CalendarDate,\n timeZone: string,\n locale: string,\n): string {\n const era = getEraFormat(startDate) || getEraFormat(endDate);\n const monthFormatter = new DateFormatter(locale, {\n month: \"long\",\n year: \"numeric\",\n era,\n calendar: startDate.calendar.identifier,\n timeZone,\n } as Intl.DateTimeFormatOptions);\n const dateFormatter = new DateFormatter(locale, {\n month: \"long\",\n year: \"numeric\",\n day: \"numeric\",\n era,\n calendar: startDate.calendar.identifier,\n timeZone,\n } as Intl.DateTimeFormatOptions);\n\n if (isSameDay(startDate, startOfMonth(startDate))) {\n const startMonth = startDate.calendar.getFormattableMonth?.(startDate) ?? startDate;\n const endMonth = endDate.calendar.getFormattableMonth?.(endDate) ?? endDate;\n\n if (isSameDay(endDate, endOfMonth(startDate))) {\n return monthFormatter.format(startMonth.toDate(timeZone));\n }\n\n if (isSameDay(endDate, endOfMonth(endDate))) {\n return formatRange(monthFormatter, startMonth, endMonth, timeZone);\n }\n }\n\n return formatRange(dateFormatter, startDate, endDate, timeZone);\n}\n\nexport function formatSelectedDateDescription(state: CalendarState | RangeCalendarState): string {\n const locale = state.locale();\n const timeZone = state.timeZone;\n let start: CalendarDate | undefined;\n let end: CalendarDate | undefined;\n\n if (\"highlightedRange\" in state) {\n const range = state.highlightedRange();\n start = range?.start;\n end = range?.end;\n } else {\n const value = state.value();\n start = (value as CalendarDate | null) ?? undefined;\n end = (value as CalendarDate | null) ?? undefined;\n }\n\n const anchorDate = \"anchorDate\" in state ? state.anchorDate() : null;\n if (anchorDate || !start || !end) {\n return \"\";\n }\n\n const dateFormatter = new DateFormatter(locale, {\n weekday: \"long\",\n month: \"long\",\n year: \"numeric\",\n day: \"numeric\",\n era: getEraFormat(start) || getEraFormat(end),\n timeZone,\n } as Intl.DateTimeFormatOptions);\n\n if (isSameDay(start, end)) {\n return formatCalendarLabel(locale, \"selectedDateDescription\", {\n date: dateFormatter.format(start.toDate(timeZone)),\n });\n }\n\n return formatCalendarLabel(locale, \"selectedRangeDescription\", {\n dateRange: formatLabelRange(dateFormatter, start, end, timeZone, locale),\n });\n}\n\nfunction formatRange(\n dateFormatter: DateFormatter,\n startDate: CalendarDate,\n endDate: CalendarDate,\n timeZone: string,\n): string {\n const formatter = dateFormatter as DateFormatter & {\n formatRangeToParts?: (start: Date, end: Date) => Intl.DateTimeFormatPart[];\n };\n const start = startDate.toDate(timeZone);\n const end = endDate.toDate(timeZone);\n\n if (!formatter.formatRangeToParts) {\n return `${dateFormatter.format(start)} to ${dateFormatter.format(end)}`;\n }\n\n const parts = formatter.formatRangeToParts(start, end) as Array<\n Intl.DateTimeFormatPart & { source?: \"startRange\" | \"shared\" | \"endRange\" }\n >;\n let separatorIndex = -1;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (part?.source === \"shared\" && part.type === \"literal\") {\n separatorIndex = i;\n } else if (part?.source === \"endRange\") {\n break;\n }\n }\n\n if (separatorIndex < 0) {\n return `${dateFormatter.format(start)} to ${dateFormatter.format(end)}`;\n }\n\n let startValue = \"\";\n let endValue = \"\";\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (!part) {\n continue;\n }\n\n if (i < separatorIndex) {\n startValue += part.value;\n } else if (i > separatorIndex) {\n endValue += part.value;\n }\n }\n\n return `${startValue} to ${endValue}`;\n}\n\nfunction formatLabelRange(\n dateFormatter: DateFormatter,\n startDate: CalendarDate,\n endDate: CalendarDate,\n timeZone: string,\n locale: string,\n): string {\n const formatter = dateFormatter as DateFormatter & {\n formatRangeToParts?: (start: Date, end: Date) => Intl.DateTimeFormatPart[];\n };\n const start = startDate.toDate(timeZone);\n const end = endDate.toDate(timeZone);\n\n if (!formatter.formatRangeToParts) {\n return formatCalendarLabel(locale, \"dateRange\", {\n startDate: dateFormatter.format(start),\n endDate: dateFormatter.format(end),\n });\n }\n\n const parts = formatter.formatRangeToParts(start, end) as Array<\n Intl.DateTimeFormatPart & { source?: \"startRange\" | \"shared\" | \"endRange\" }\n >;\n let separatorIndex = -1;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (part?.source === \"shared\" && part.type === \"literal\") {\n separatorIndex = i;\n } else if (part?.source === \"endRange\") {\n break;\n }\n }\n\n if (separatorIndex < 0) {\n return formatCalendarLabel(locale, \"dateRange\", {\n startDate: dateFormatter.format(start),\n endDate: dateFormatter.format(end),\n });\n }\n\n let startValue = \"\";\n let endValue = \"\";\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (!part) {\n continue;\n }\n\n if (i < separatorIndex) {\n startValue += part.value;\n } else if (i > separatorIndex) {\n endValue += part.value;\n }\n }\n\n return formatCalendarLabel(locale, \"dateRange\", {\n startDate: startValue,\n endDate: endValue,\n });\n}\n","/**\n * createCalendar hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar component.\n * Based on @react-aria/calendar useCalendar\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport type { CalendarState } from \"@proyecto-viviana/solid-stately\";\nimport { formatVisibleRangeDescription, setCalendarHookData } from \"./utils\";\n\nexport interface AriaCalendarProps {\n /** An ID for the calendar. */\n id?: string;\n /** Whether the calendar is disabled. */\n isDisabled?: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly?: boolean;\n /** An accessible label for the calendar. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the calendar. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the calendar. */\n \"aria-describedby\"?: string;\n /** The ID of an element that provides additional details about the calendar. */\n \"aria-details\"?: string;\n /** Whether the current selection is invalid. */\n isInvalid?: boolean;\n /** Error message rendered for invalid selections. */\n errorMessage?: string;\n /** ID of the rendered error message element. */\n errorMessageId?: string;\n /** Minimum number of visible months. */\n visibleMonths?: number;\n}\n\nexport interface CalendarAria {\n /** Props for the calendar container element. */\n calendarProps: Record<string, unknown>;\n /** Props for the previous button. */\n prevButtonProps: Record<string, unknown>;\n /** Props for the next button. */\n nextButtonProps: Record<string, unknown>;\n /** Props for the title/heading element. */\n titleProps: Record<string, unknown>;\n /** Props for the error message element, if any. */\n errorMessageProps: Record<string, unknown>;\n /** An accessible label for the title. */\n title: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a calendar component.\n */\nexport function createCalendar<T extends CalendarState>(\n props: MaybeAccessor<AriaCalendarProps>,\n state: T,\n): CalendarAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const titleId = createId();\n const errorMessageId = createId(getProps().errorMessageId);\n\n // Title (e.g., \"December 2024\")\n const title = createMemo(() => state.title());\n const visibleRangeDescription = createMemo(() => {\n const range = state.visibleRange();\n return formatVisibleRangeDescription(range.start, range.end, state.timeZone, state.locale());\n });\n const calendarLabel = createMemo(() => {\n const p = getProps();\n return [p[\"aria-label\"], visibleRangeDescription()].filter(Boolean).join(\", \");\n });\n\n const initialProps = getProps();\n if (\n initialProps.id ||\n initialProps[\"aria-label\"] ||\n initialProps[\"aria-labelledby\"] ||\n initialProps[\"aria-describedby\"] ||\n initialProps[\"aria-details\"] ||\n initialProps.errorMessage ||\n initialProps.errorMessageId\n ) {\n setCalendarHookData(state, {\n errorMessageId:\n initialProps.errorMessage || initialProps.errorMessageId ? errorMessageId : undefined,\n });\n }\n\n // Previous button props\n const prevButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n \"aria-label\": \"Previous month\",\n onClick: () => {\n if (!isDisabled) {\n state.focusPreviousPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Next button props\n const nextButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n \"aria-label\": \"Next month\",\n onClick: () => {\n if (!isDisabled) {\n state.focusNextPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Title props\n const titleProps = createMemo(() => ({\n id: titleId,\n \"aria-live\": \"polite\" as const,\n }));\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n }));\n\n // Calendar container props\n const calendarProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps({\n id,\n role: \"application\",\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-label\": calendarLabel(),\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-details\": p[\"aria-details\"],\n });\n });\n\n return {\n get calendarProps() {\n return calendarProps();\n },\n get prevButtonProps() {\n return prevButtonProps();\n },\n get nextButtonProps() {\n return nextButtonProps();\n },\n get titleProps() {\n return titleProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get title() {\n return title();\n },\n };\n}\n","/**\n * createCalendarGrid hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar grid.\n * Based on @react-aria/calendar useCalendarGrid\n */\n\nimport { createMemo } from \"solid-js\";\nimport { DateFormatter, startOfWeek, today } from \"@internationalized/date\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { CalendarState, CalendarDate } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaCalendarGridProps {\n /** The start date of the grid (defaults to start of focused month). */\n startDate?: CalendarDate;\n /** The end date of the grid (defaults to end of focused month). */\n endDate?: CalendarDate;\n /** The number of weeks to display. */\n weekdayStyle?: \"narrow\" | \"short\" | \"long\";\n}\n\nexport interface CalendarGridAria {\n /** Props for the grid element (table or grid role). */\n gridProps: Record<string, unknown>;\n /** Props for the header row. */\n headerProps: Record<string, unknown>;\n /** Week day labels for the header. */\n weekDays: string[];\n}\n\n/**\n * Provides the behavior and accessibility implementation for a calendar grid.\n */\nexport function createCalendarGrid<T extends CalendarState>(\n props: MaybeAccessor<AriaCalendarGridProps>,\n state: T,\n ref?: () => HTMLElement | null,\n): CalendarGridAria {\n // Week days for headers\n const weekDays = createMemo(() => {\n const gridProps = access(props);\n const formatter = new DateFormatter(state.locale(), {\n weekday: gridProps.weekdayStyle ?? \"narrow\",\n timeZone: state.timeZone,\n });\n const weekStart = startOfWeek(today(state.timeZone), state.locale(), state.firstDayOfWeek());\n\n return Array.from({ length: 7 }, (_, index) =>\n formatter.format(weekStart.add({ days: index }).toDate(state.timeZone)),\n );\n });\n\n // Handle keyboard navigation\n const isRTL = (): boolean => {\n const element = ref?.();\n const scopedDirection = element?.closest(\"[dir]\")?.getAttribute(\"dir\");\n const documentDirection = typeof document !== \"undefined\" ? document.dir : \"\";\n return (scopedDirection ?? documentDirection) === \"rtl\";\n };\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled()) return;\n\n switch (e.key) {\n case \"ArrowLeft\":\n e.preventDefault();\n e.stopPropagation();\n if (isRTL()) {\n state.focusNextDay();\n } else {\n state.focusPreviousDay();\n }\n break;\n case \"ArrowRight\":\n e.preventDefault();\n e.stopPropagation();\n if (isRTL()) {\n state.focusPreviousDay();\n } else {\n state.focusNextDay();\n }\n break;\n case \"ArrowUp\":\n e.preventDefault();\n e.stopPropagation();\n state.focusPreviousWeek();\n break;\n case \"ArrowDown\":\n e.preventDefault();\n e.stopPropagation();\n state.focusNextWeek();\n break;\n case \"PageUp\":\n e.preventDefault();\n e.stopPropagation();\n if (e.shiftKey) {\n state.focusPreviousSection(); // Previous year\n } else {\n state.setFocusedDate(state.focusedDate().subtract({ months: 1 }));\n }\n break;\n case \"PageDown\":\n e.preventDefault();\n e.stopPropagation();\n if (e.shiftKey) {\n state.focusNextSection(); // Next year\n } else {\n state.setFocusedDate(state.focusedDate().add({ months: 1 }));\n }\n break;\n case \"Home\":\n e.preventDefault();\n e.stopPropagation();\n state.focusPageStart();\n break;\n case \"End\":\n e.preventDefault();\n e.stopPropagation();\n state.focusPageEnd();\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n state.selectFocusedDate();\n break;\n case \"Escape\":\n if (\n \"anchorDate\" in state &&\n typeof state.anchorDate === \"function\" &&\n state.anchorDate() &&\n \"setAnchorDate\" in state &&\n typeof state.setAnchorDate === \"function\"\n ) {\n e.preventDefault();\n e.stopPropagation();\n state.setAnchorDate(null);\n if (\"setDragging\" in state && typeof state.setDragging === \"function\") {\n state.setDragging(false);\n }\n }\n break;\n }\n };\n\n // Grid props\n const gridProps = createMemo(() => ({\n role: \"grid\",\n \"aria-readonly\": state.isReadOnly() || undefined,\n \"aria-disabled\": state.isDisabled() || undefined,\n tabIndex: state.isFocused() ? 0 : -1,\n onFocus: () => state.setFocused(true),\n onBlur: () => state.setFocused(false),\n onKeyDown: handleKeyDown,\n }));\n\n // Header props are intentionally empty. Consumers render this on <thead>,\n // which already has correct table semantics.\n const headerProps = createMemo(() => ({}));\n\n return {\n get gridProps() {\n return gridProps();\n },\n get headerProps() {\n return headerProps();\n },\n get weekDays() {\n return weekDays();\n },\n };\n}\n","/**\n * createCalendarCell hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar cell.\n * Based on @react-aria/calendar useCalendarCell\n */\n\nimport { createSignal, createMemo, createEffect, type Accessor } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { focusSafely } from \"../utils/focus\";\nimport { createFocusRing } from \"../interactions/createFocusRing\";\nimport { getInteractionModality } from \"../interactions/createInteractionModality\";\nimport { useLocale } from \"../i18n\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport type { CalendarState, CalendarDate, DateValue } from \"@proyecto-viviana/solid-stately\";\nimport { isToday as isTodayUtil, DateFormatter, getLocalTimeZone } from \"@internationalized/date\";\nimport { getCalendarHookData } from \"./utils\";\n\nexport interface AriaCalendarCellProps {\n /** The date represented by the cell. */\n date: DateValue;\n /** Whether the cell is disabled. */\n isDisabled?: boolean;\n /** Whether the date is outside the current month grid. */\n isOutsideMonth?: boolean;\n}\n\nexport interface CalendarCellAria {\n /** Props for the cell element (td or gridcell). */\n cellProps: Record<string, unknown>;\n /** Props for the button inside the cell. */\n buttonProps: Record<string, unknown>;\n /** Whether the cell is selected. */\n isSelected: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell should display a keyboard focus ring. */\n isFocusVisible: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable (e.g., booked date). */\n isUnavailable: boolean;\n /** Whether the cell is part of an invalid selection. */\n isInvalid: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a calendar cell.\n */\nexport function createCalendarCell<T extends CalendarState>(\n props: MaybeAccessor<AriaCalendarCellProps>,\n state: T,\n ref?: () => HTMLElement | null,\n): CalendarCellAria {\n const getProps = () => access(props);\n const [isPressed, setIsPressed] = createSignal(false);\n const { focusProps, isFocusVisible: isRingFocusVisible } = createFocusRing();\n const timeZone = getLocalTimeZone();\n const inheritedLocale = useLocale();\n const stateWithLocale = state as T & { locale?: Accessor<string> };\n const locale = () => stateWithLocale.locale?.() ?? inheritedLocale().locale;\n let ignoreNextClick = false;\n\n // Get the date from props\n const date = createMemo(() => getProps().date as CalendarDate);\n\n // Check states\n const isSelected = createMemo(() => state.isSelected(date()));\n const isFocused = createMemo(() => state.isCellFocused(date()));\n const isInvalid = createMemo(() => state.isValueInvalid() && isSelected());\n const isDisabled = createMemo(() => {\n return getProps().isDisabled || state.isCellDisabled(date());\n });\n const isUnavailable = createMemo(() => state.isCellUnavailable(date()));\n const isOutsideMonth = createMemo(\n () => getProps().isOutsideMonth ?? state.isOutsideVisibleRange(date()),\n );\n const isToday = createMemo(() => isTodayUtil(date(), timeZone));\n const isCellFocusVisible = createMemo(\n () => isFocused() && isRingFocusVisible() && getInteractionModality() !== null,\n );\n\n // Format the date for display\n const formattedDate = createMemo(() => {\n const d = date();\n const formatter = new DateFormatter(locale(), {\n day: \"numeric\",\n timeZone,\n calendar: d.calendar.identifier,\n } as Intl.DateTimeFormatOptions);\n\n return (\n formatter.formatToParts(d.toDate(timeZone)).find((part) => part.type === \"day\")?.value ??\n d.day.toString()\n );\n });\n\n // Handle pointer down - this is where selection happens\n // Using pointerdown instead of click ensures selection happens immediately\n // before focus changes can interfere with the event\n const handlePointerDown = (e: PointerEvent) => {\n if (!isDisabled() && !isUnavailable()) {\n setIsPressed(true);\n // Select the date on pointer down for immediate response\n // This matches React Aria's behavior of using onPressStart\n state.selectDate(date());\n ignoreNextClick = true;\n // Prevent default to avoid double-triggering with onClick\n e.preventDefault();\n }\n };\n\n // Handle click - kept for accessibility (keyboard Enter/Space)\n const handleClick = () => {\n if (ignoreNextClick) {\n ignoreNextClick = false;\n return;\n }\n\n // Only select on click if not already selected via pointerdown\n // This handles keyboard activation (Enter/Space)\n if (!isDisabled() && !isUnavailable()) {\n state.selectDate(date());\n }\n };\n\n const handlePointerUp = () => {\n setIsPressed(false);\n };\n\n // Keep DOM focus synchronized with focused date updates.\n // Use focusSafely (preventScroll) to match @react-aria/calendar — bare focus()\n // causes the browser to auto-scroll the page when bringing the cell into view,\n // which is wrong inside a popover. Scroll-into-view should be opt-in based on\n // interaction modality (handled at a higher layer when needed).\n createEffect(() => {\n const element = ref?.();\n if (element && isFocused()) {\n focusSafely(element);\n }\n });\n\n // Cell props (for the td element)\n const cellProps = createMemo(() => ({\n role: \"gridcell\",\n \"aria-disabled\": isDisabled() || isUnavailable() || undefined,\n \"aria-selected\": isSelected() || undefined,\n \"aria-invalid\": isInvalid() || undefined,\n }));\n\n // Button props (for the interactive element inside)\n const buttonProps = createMemo(() => {\n const d = date();\n const formatter = new DateFormatter(locale(), {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n calendar: d.calendar.identifier,\n } as Intl.DateTimeFormatOptions);\n let label = formatter.format(d.toDate(timeZone));\n if (isSelected()) {\n label += \" selected\";\n }\n const errorMessageId = getCalendarHookData(state)?.errorMessageId;\n\n return mergeProps(\n focusProps as Record<string, unknown>,\n {\n role: \"button\",\n tabIndex: isFocused() ? 0 : -1,\n \"aria-label\": label,\n \"aria-disabled\": isDisabled() || isUnavailable() || undefined,\n \"aria-invalid\": isInvalid() || undefined,\n \"aria-describedby\": isInvalid() ? errorMessageId : undefined,\n \"aria-pressed\": isPressed() || undefined,\n \"data-focus-visible\": isCellFocusVisible() || undefined,\n disabled: isDisabled() || isUnavailable(),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n onPointerUp: handlePointerUp,\n onPointerLeave: handlePointerUp,\n onFocus: () => {\n // Only update if this cell isn't already the focused date.\n // This prevents infinite loops when focus is programmatically set.\n if (!state.isCellFocused(d)) {\n state.setFocusedDate(d);\n }\n state.setFocused(true);\n },\n } as Record<string, unknown>,\n );\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isFocused() {\n return isFocused();\n },\n get isFocusVisible() {\n return isCellFocusVisible();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isUnavailable() {\n return isUnavailable();\n },\n get isInvalid() {\n return isInvalid();\n },\n get isOutsideMonth() {\n return isOutsideMonth();\n },\n get isToday() {\n return isToday();\n },\n get isPressed() {\n return isPressed();\n },\n get formattedDate() {\n return formattedDate();\n },\n };\n}\n","/**\n * createRangeCalendar hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a range calendar component.\n * Based on @react-aria/calendar useRangeCalendar\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport type { RangeCalendarState } from \"@proyecto-viviana/solid-stately\";\nimport {\n formatSelectedDateDescription,\n formatVisibleRangeDescription,\n getCalendarHookData,\n setCalendarHookData,\n} from \"./utils\";\n\nexport interface AriaRangeCalendarProps {\n /** An ID for the calendar. */\n id?: string;\n /** Whether the calendar is disabled. */\n isDisabled?: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly?: boolean;\n /** An accessible label for the calendar. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the calendar. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the calendar. */\n \"aria-describedby\"?: string;\n /** The ID of an element that provides additional details about the calendar. */\n \"aria-details\"?: string;\n /** Whether the current selection is invalid. */\n isInvalid?: boolean;\n /** Error message rendered for invalid selections. */\n errorMessage?: string;\n /** ID of the rendered error message element. */\n errorMessageId?: string;\n}\n\nexport interface RangeCalendarAria {\n /** Props for the calendar container element. */\n calendarProps: Record<string, unknown>;\n /** Props for the previous button. */\n prevButtonProps: Record<string, unknown>;\n /** Props for the next button. */\n nextButtonProps: Record<string, unknown>;\n /** Props for the title/heading element. */\n titleProps: Record<string, unknown>;\n /** Props for the error message element, if any. */\n errorMessageProps: Record<string, unknown>;\n /** An accessible label for the title. */\n title: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar component.\n */\nexport function createRangeCalendar<T extends RangeCalendarState>(\n props: MaybeAccessor<AriaRangeCalendarProps>,\n state: T,\n): RangeCalendarAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const titleId = createId();\n const errorMessageId = createId(getProps().errorMessageId);\n\n // Title (e.g., \"December 2024\")\n const title = createMemo(() => state.title());\n const visibleRangeDescription = createMemo(() => {\n const range = state.visibleRange();\n return formatVisibleRangeDescription(range.start, range.end, state.timeZone, state.locale());\n });\n const calendarLabel = createMemo(() => {\n const p = getProps();\n return [p[\"aria-label\"], visibleRangeDescription()].filter(Boolean).join(\", \");\n });\n const selectedDateDescription = createMemo(() => formatSelectedDateDescription(state));\n\n const initialProps = getProps();\n const existingHookData = getCalendarHookData(state);\n setCalendarHookData(state, {\n errorMessageId:\n initialProps.errorMessage || initialProps.errorMessageId\n ? errorMessageId\n : existingHookData?.errorMessageId,\n get selectedDateDescription() {\n return selectedDateDescription();\n },\n });\n\n // Previous button props\n const prevButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled() || state.isPreviousVisibleRangeInvalid();\n\n return {\n \"aria-label\": \"Previous month\",\n onClick: () => {\n if (!isDisabled) {\n state.focusPreviousPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Next button props\n const nextButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled() || state.isNextVisibleRangeInvalid();\n\n return {\n \"aria-label\": \"Next month\",\n onClick: () => {\n if (!isDisabled) {\n state.focusNextPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Title props\n const titleProps = createMemo(() => ({\n id: titleId,\n \"aria-live\": \"polite\" as const,\n }));\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n }));\n\n // Calendar container props\n const calendarProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps({\n id,\n role: \"application\",\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-label\": calendarLabel(),\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-details\": p[\"aria-details\"],\n });\n });\n\n return {\n get calendarProps() {\n return calendarProps();\n },\n get prevButtonProps() {\n return prevButtonProps();\n },\n get nextButtonProps() {\n return nextButtonProps();\n },\n get titleProps() {\n return titleProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get title() {\n return title();\n },\n };\n}\n","/**\n * createRangeCalendarCell hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a range calendar cell.\n * Based on @react-aria/calendar useCalendarCell (with range support)\n */\n\nimport { createSignal, createMemo, createEffect } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { focusSafely } from \"../utils/focus\";\nimport { createDescription } from \"../utils/createDescription\";\nimport type { RangeCalendarState, CalendarDate, DateValue } from \"@proyecto-viviana/solid-stately\";\nimport { isToday as isTodayUtil, DateFormatter, getLocalTimeZone } from \"@internationalized/date\";\nimport { getCalendarHookData, getEraFormat } from \"./utils\";\nimport { formatCalendarLabel, formatCalendarPrompt } from \"./intl\";\n\nexport interface AriaRangeCalendarCellProps {\n /** The date represented by the cell. */\n date: DateValue;\n /** Whether the cell is disabled. */\n isDisabled?: boolean;\n /** Whether the date is outside the current month grid. */\n isOutsideMonth?: boolean;\n}\n\nexport interface RangeCalendarCellAria {\n /** Props for the cell element (td or gridcell). */\n cellProps: Record<string, unknown>;\n /** Props for the button inside the cell. */\n buttonProps: Record<string, unknown>;\n /** Whether the cell is within the selected range. */\n isSelected: boolean;\n /** Whether the cell is the start of the selection. */\n isSelectionStart: boolean;\n /** Whether the cell is the end of the selection. */\n isSelectionEnd: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable (e.g., booked date). */\n isUnavailable: boolean;\n /** Whether the cell is part of an invalid selection. */\n isInvalid: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar cell.\n */\nexport function createRangeCalendarCell<T extends RangeCalendarState>(\n props: MaybeAccessor<AriaRangeCalendarCellProps>,\n state: T,\n ref?: () => HTMLElement | null,\n): RangeCalendarCellAria {\n const getProps = () => access(props);\n const [isPressed, setIsPressed] = createSignal(false);\n const timeZone = getLocalTimeZone();\n\n // Get the date from props\n const date = createMemo(() => getProps().date as CalendarDate);\n\n // Check states\n const isSelected = createMemo(() => state.isSelected(date()));\n const isSelectionStart = createMemo(() => state.isSelectionStart(date()));\n const isSelectionEnd = createMemo(() => state.isSelectionEnd(date()));\n const isFocused = createMemo(() => state.isCellFocused(date()));\n const isInvalid = createMemo(() => {\n const range = state.highlightedRange();\n const d = date();\n return (\n state.isValueInvalid() &&\n !state.anchorDate() &&\n !!range &&\n d.compare(range.start) >= 0 &&\n d.compare(range.end) <= 0\n );\n });\n const isDisabled = createMemo(() => {\n return getProps().isDisabled || state.isCellDisabled(date());\n });\n const isUnavailable = createMemo(() => state.isCellUnavailable(date()));\n const isSelectable = createMemo(() => !isDisabled() && !isUnavailable());\n const isOutsideMonth = createMemo(() => {\n return getProps().isOutsideMonth ?? state.isOutsideVisibleRange(date());\n });\n const isToday = createMemo(() => isTodayUtil(date(), timeZone));\n const rangeSelectionPrompt = createMemo(() => {\n if (!isFocused() || state.isReadOnly() || !isSelectable()) {\n return undefined;\n }\n\n return formatCalendarPrompt(\n state.locale(),\n state.anchorDate() ? \"finishRangeSelectionPrompt\" : \"startRangeSelectionPrompt\",\n );\n });\n const descriptionProps = createDescription(rangeSelectionPrompt);\n\n // Format the date for display\n const formattedDate = createMemo(() => {\n return date().day.toString();\n });\n\n // Handle pointer down - selection on pointerdown avoids losing selection when\n // hover/focus updates re-render cells before click fires.\n const handlePointerDown = (e: PointerEvent) => {\n if (isSelectable()) {\n setIsPressed(true);\n state.selectDate(date());\n e.preventDefault();\n }\n };\n\n // Handle click for keyboard activation (Enter/Space).\n const handleClick = () => {\n if (isSelectable()) {\n state.selectDate(date());\n }\n };\n\n const handlePointerUp = () => {\n setIsPressed(false);\n };\n\n // Handle hover during range selection\n const handlePointerEnter = () => {\n if (state.isDragging() && isSelectable()) {\n state.setFocusedDate(date());\n }\n };\n\n // Keep DOM focus synchronized with focused date updates.\n // Use focusSafely (preventScroll) to match @react-aria/calendar — bare focus()\n // causes the browser to auto-scroll the page when bringing the cell into view,\n // which is wrong inside a popover.\n createEffect(() => {\n const element = ref?.();\n if (element && isFocused()) {\n focusSafely(element);\n }\n });\n\n // Cell props (for the td element)\n const cellProps = createMemo(() => ({\n role: \"gridcell\",\n \"aria-disabled\": isDisabled() || isUnavailable() || undefined,\n \"aria-selected\": isSelected() || undefined,\n \"aria-invalid\": isInvalid() || undefined,\n }));\n\n // Button props (for the interactive element inside)\n const buttonProps = createMemo(() => {\n const d = date();\n const formatter = new DateFormatter(state.locale(), {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n era: getEraFormat(d),\n calendar: d.calendar.identifier,\n timeZone,\n } as Intl.DateTimeFormatOptions);\n const hookData = getCalendarHookData(state);\n let label = \"\";\n\n if (\n hookData?.selectedDateDescription &&\n !state.anchorDate() &&\n state.value() &&\n (state.isSelectionStart(d) || state.isSelectionEnd(d))\n ) {\n label = `${hookData.selectedDateDescription}, `;\n }\n\n label += formatter.format(d.toDate(timeZone));\n if (isToday()) {\n label = formatCalendarLabel(\n state.locale(),\n isSelected() ? \"todayDateSelected\" : \"todayDate\",\n { date: label },\n );\n } else if (isSelected()) {\n label = formatCalendarLabel(state.locale(), \"dateSelected\", { date: label });\n }\n\n const errorMessageId = hookData?.errorMessageId;\n const describedByIds = [\n isInvalid() ? errorMessageId : undefined,\n descriptionProps[\"aria-describedby\"],\n ].filter(Boolean);\n\n return {\n role: \"button\",\n tabIndex: isFocused() ? 0 : -1,\n \"aria-label\": label,\n \"aria-disabled\": isDisabled() || isUnavailable() || undefined,\n \"aria-invalid\": isInvalid() || undefined,\n \"aria-describedby\": describedByIds.length ? describedByIds.join(\" \") : undefined,\n \"aria-pressed\": isPressed() || undefined,\n disabled: isDisabled() || isUnavailable(),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n onPointerUp: handlePointerUp,\n onPointerLeave: handlePointerUp,\n onPointerEnter: handlePointerEnter,\n onFocus: () => {\n if (!state.isCellFocused(d)) {\n state.setFocusedDate(d);\n }\n state.setFocused(true);\n },\n };\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isSelectionStart() {\n return isSelectionStart();\n },\n get isSelectionEnd() {\n return isSelectionEnd();\n },\n get isFocused() {\n return isFocused();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isUnavailable() {\n return isUnavailable();\n },\n get isInvalid() {\n return isInvalid();\n },\n get isOutsideMonth() {\n return isOutsideMonth();\n },\n get isToday() {\n return isToday();\n },\n get isPressed() {\n return isPressed();\n },\n get formattedDate() {\n return formattedDate();\n },\n };\n}\n","/**\n * createDateField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date field component.\n * Based on @react-aria/datepicker useDateField\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { createLabel } from \"../label/createLabel\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { useLocale } from \"../i18n\";\nimport type { DateFieldState, DateSegment } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaDateFieldProps {\n /** An ID for the date field. */\n id?: string;\n /** A visible label for the date field. */\n label?: string;\n /** An accessible label for the date field. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the date field. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the date field. */\n \"aria-describedby\"?: string;\n /** Whether the date field is disabled. */\n isDisabled?: boolean;\n /** Whether the date field is read-only. */\n isReadOnly?: boolean;\n /** Whether the date field is required. */\n isRequired?: boolean;\n /** Whether the date field is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n /** Whether the element should receive focus on mount. */\n autoFocus?: boolean;\n}\n\nexport interface DatePickerOverlayState {\n /** Whether the calendar overlay is open. */\n isOpen: boolean;\n /** Open the calendar overlay. */\n open: () => void;\n /** Close the calendar overlay. */\n close: () => void;\n /** Toggle the calendar overlay. */\n toggle: () => void;\n}\n\nexport interface DateFieldAria {\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the field container element. */\n fieldProps: Record<string, unknown>;\n /** Props for the input container (holds segments). */\n inputProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n /** The segments to render. */\n segments: DateSegment[];\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n */\nexport function createDateField<T extends DateFieldState>(\n props: MaybeAccessor<AriaDateFieldProps>,\n state: T,\n _ref?: () => HTMLElement | null,\n overlayState?: DatePickerOverlayState,\n): DateFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n const locale = useLocale();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if ((p.isInvalid || state.isInvalid()) && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n // Segments from state\n const segments = createMemo(() => state.segments());\n\n // Label ID for linking input to label\n const getLabelId = () => (labelProps as Record<string, string | undefined>).id;\n\n // Localized role description\n const getRoleDescription = () => {\n const language = locale().locale.toLowerCase().split(\"-\")[0] ?? \"en\";\n return language === \"es\" ? \"Campo de fecha\" : \"Date field\";\n };\n\n // Focus management helpers for segment navigation\n const focusSegment = (target: \"first\" | \"last\" | \"prev\" | \"next\", container: HTMLElement) => {\n const spinbuttons = Array.from(container.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]'));\n if (spinbuttons.length === 0) return;\n\n const active = document.activeElement as HTMLElement | null;\n const currentIndex = active ? spinbuttons.indexOf(active) : -1;\n\n if (target === \"first\") {\n spinbuttons[0]?.focus();\n return;\n }\n\n if (target === \"last\") {\n spinbuttons[spinbuttons.length - 1]?.focus();\n return;\n }\n\n let nextIndex: number;\n if (currentIndex < 0) {\n nextIndex = target === \"next\" ? 0 : spinbuttons.length - 1;\n } else {\n nextIndex = target === \"next\" ? currentIndex + 1 : currentIndex - 1;\n }\n\n if (nextIndex >= 0 && nextIndex < spinbuttons.length) {\n spinbuttons[nextIndex]?.focus();\n }\n };\n\n // Field container props\n const fieldProps = createMemo(() => {\n const p = getProps();\n\n const baseProps: Record<string, unknown> = mergeProps(\n labelFieldProps as Record<string, unknown>,\n {\n id,\n role: \"group\",\n \"aria-disabled\": p.isDisabled || state.isDisabled() || undefined,\n \"aria-readonly\": p.isReadOnly || state.isReadOnly() || undefined,\n \"aria-required\": p.isRequired || state.isRequired() || undefined,\n \"aria-invalid\": p.isInvalid || state.isInvalid() || undefined,\n \"aria-describedby\": getAriaDescribedBy(),\n },\n );\n\n // Integrate with date picker overlay when available\n if (overlayState) {\n const existingOnKeyDown = baseProps.onKeyDown as ((e: KeyboardEvent) => void) | undefined;\n\n baseProps.onKeyDown = (e: KeyboardEvent) => {\n existingOnKeyDown?.(e);\n if (e.altKey && (e.key === \"ArrowDown\" || e.key === \"ArrowUp\")) {\n e.preventDefault();\n e.stopPropagation();\n overlayState.open();\n }\n };\n }\n\n return baseProps;\n });\n\n // Input container props\n const inputProps = createMemo(() => {\n const p = getProps();\n const labelId = getLabelId();\n const ariaLabelledBy = labelId\n ? p[\"aria-labelledby\"]\n ? `${labelId} ${p[\"aria-labelledby\"]}`\n : labelId\n : p[\"aria-labelledby\"];\n\n const isDisabled = p.isDisabled || state.isDisabled();\n const isReadOnly = p.isReadOnly || state.isReadOnly();\n const isRequired = p.isRequired || state.isRequired();\n const isInvalid = p.isInvalid || state.isInvalid();\n const hasValue = state.value() != null;\n\n return {\n role: \"presentation\",\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": isDisabled || undefined,\n \"aria-readonly\": isReadOnly || undefined,\n \"aria-required\": isRequired || undefined,\n \"aria-invalid\": isInvalid || undefined,\n \"aria-roledescription\": getRoleDescription(),\n autoFocus: p.autoFocus,\n contentEditable: true,\n suppressContentEditableWarning: true,\n spellCheck: false,\n autoCorrect: \"off\",\n enterKeyHint: \"next\",\n inputMode: \"numeric\" as const,\n style: { caretColor: \"transparent\" },\n \"data-placeholder\": !hasValue ? \"true\" : undefined,\n onKeyDown: (e: KeyboardEvent) => {\n const target = e.target as HTMLElement;\n const currentTarget = e.currentTarget as HTMLElement;\n\n // Only handle at the container level, not when a segment is focused\n if (target !== currentTarget) return;\n\n const dir = locale().direction;\n const rtl = dir === \"rtl\";\n\n switch (e.key) {\n case \"ArrowRight\":\n e.preventDefault();\n focusSegment(rtl ? \"prev\" : \"next\", currentTarget);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n focusSegment(rtl ? \"next\" : \"prev\", currentTarget);\n break;\n case \"Home\":\n e.preventDefault();\n focusSegment(\"first\", currentTarget);\n break;\n case \"End\":\n e.preventDefault();\n focusSegment(\"last\", currentTarget);\n break;\n }\n },\n onFocus: () => {\n // Focus state is tracked by the component layer\n },\n onBlur: () => {\n state.confirmPlaceholder();\n },\n onClick: (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n const currentTarget = e.currentTarget as HTMLElement;\n\n // Only handle when clicking the container itself (empty area between segments)\n if (target !== currentTarget) return;\n\n const spinbuttons = Array.from(\n currentTarget.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]'),\n );\n if (spinbuttons.length > 0) {\n spinbuttons[0].focus();\n }\n },\n };\n });\n\n // Description props\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: \"alert\",\n }));\n\n return {\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get inputProps() {\n return inputProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get segments() {\n return segments();\n },\n };\n}\n","/**\n * createDateSegment hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date segment.\n * Based on @react-aria/datepicker useDateSegment\n */\n\nimport { createSignal, createMemo, onCleanup } from \"solid-js\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { DateFieldState, DateSegment, DateSegmentType } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\n\nexport interface AriaDateSegmentProps {\n /** The segment data. */\n segment: DateSegment;\n /** The ID of the calendar dialog controlled by this segment (when inside a datepicker). */\n \"aria-controls\"?: string;\n /** The ID of an element that describes the segment. */\n \"aria-describedby\"?: string;\n}\n\nexport interface DateSegmentAria {\n /** Props for the segment element. */\n segmentProps: Record<string, unknown>;\n /** Whether the segment is focused. */\n isFocused: boolean;\n /** Whether the segment is editable. */\n isEditable: boolean;\n /** Whether the segment is a placeholder. */\n isPlaceholder: boolean;\n /** The text to display. */\n text: string;\n /** Whether the segment is hovered. */\n isHovered: boolean;\n /** Whether the segment has keyboard focus visible. */\n isFocusVisible: boolean;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date segment.\n */\nexport function createDateSegment<T extends DateFieldState>(\n props: MaybeAccessor<AriaDateSegmentProps>,\n state: T,\n ref?: () => HTMLElement | null,\n): DateSegmentAria {\n const getProps = () => access(props);\n const [isFocused, setIsFocused] = createSignal(false);\n const [isFocusVisible, setIsFocusVisible] = createSignal(false);\n const [isHovered, setIsHovered] = createSignal(false);\n const [enteredKeys, setEnteredKeys] = createSignal(\"\");\n const [isComposing, setIsComposing] = createSignal(false);\n const locale = useLocale();\n\n // Get the segment from props\n const segment = createMemo(() => getProps().segment);\n\n // Check if editable\n const isEditable = createMemo(() => {\n const seg = segment();\n return seg.isEditable && !state.isDisabled() && !state.isReadOnly();\n });\n\n // Long press state for ArrowUp / ArrowDown\n let longPressTimeout: ReturnType<typeof setTimeout> | null = null;\n let longPressInterval: ReturnType<typeof setInterval> | null = null;\n let hadPointerDown = false;\n\n const clearLongPress = () => {\n if (longPressTimeout) {\n clearTimeout(longPressTimeout);\n longPressTimeout = null;\n }\n if (longPressInterval) {\n clearInterval(longPressInterval);\n longPressInterval = null;\n }\n };\n\n const startLongPress = (action: () => void) => {\n clearLongPress();\n longPressTimeout = setTimeout(() => {\n action();\n longPressInterval = setInterval(() => {\n action();\n }, 100);\n }, 300);\n };\n\n onCleanup(() => {\n clearLongPress();\n });\n\n const focusSegment = (target: \"first\" | \"last\" | \"prev\" | \"next\") => {\n const el = ref?.();\n if (!el) return;\n\n const container = el.parentElement;\n if (!container) return;\n\n const segments = Array.from(container.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]'));\n\n if (segments.length === 0) return;\n\n if (target === \"first\") {\n segments[0]?.focus();\n return;\n }\n\n if (target === \"last\") {\n segments[segments.length - 1]?.focus();\n return;\n }\n\n const currentIndex = segments.indexOf(el);\n if (currentIndex < 0) return;\n\n const nextIndex = target === \"next\" ? currentIndex + 1 : currentIndex - 1;\n if (nextIndex >= 0 && nextIndex < segments.length) {\n segments[nextIndex]?.focus();\n }\n };\n\n const clearCurrentSegment = (type: DateSegmentType) => {\n state.clearSegment(type);\n setEnteredKeys(\"\");\n };\n\n // Handle keyboard input\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isEditable()) return;\n if (isComposing()) return;\n\n const seg = segment();\n const type = seg.type;\n\n if (type === \"literal\") return;\n\n // Keyboard interaction means focus is visible\n setIsFocusVisible(true);\n\n switch (e.key) {\n case \"ArrowRight\":\n e.preventDefault();\n focusSegment(locale().direction === \"rtl\" ? \"prev\" : \"next\");\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n focusSegment(locale().direction === \"rtl\" ? \"next\" : \"prev\");\n break;\n case \"ArrowUp\":\n e.preventDefault();\n state.incrementSegment(type);\n if (!e.repeat) {\n startLongPress(() => state.incrementSegment(type));\n }\n break;\n case \"ArrowDown\":\n e.preventDefault();\n state.decrementSegment(type);\n if (!e.repeat) {\n startLongPress(() => state.decrementSegment(type));\n }\n break;\n case \"Home\":\n e.preventDefault();\n focusSegment(\"first\");\n break;\n case \"End\":\n e.preventDefault();\n focusSegment(\"last\");\n break;\n case \"Backspace\":\n e.preventDefault();\n // Match common date-field UX: backspace on an empty placeholder moves to previous segment.\n if (seg.isPlaceholder) {\n focusSegment(\"prev\");\n } else {\n clearCurrentSegment(type);\n }\n break;\n case \"Delete\":\n e.preventDefault();\n clearCurrentSegment(type);\n break;\n default:\n // Handle numeric input\n const normalizedDigit = normalizeDigit(e.key);\n if (normalizedDigit) {\n e.preventDefault();\n handleNumericInput(normalizedDigit, type, seg);\n }\n break;\n }\n };\n\n const handleKeyUp = () => {\n clearLongPress();\n };\n\n // Handle numeric input\n const handleNumericInput = (key: string, type: DateSegmentType, seg: DateSegment) => {\n const newKeys = enteredKeys() + key;\n const numValue = parseInt(newKeys, 10);\n const maxValue = seg.maxValue ?? 99;\n const minValue = seg.minValue ?? 0;\n const maxDigits = String(maxValue).length;\n\n // Check if we should accept more digits\n if (numValue <= maxValue) {\n state.setSegment(type, numValue);\n\n // If entering more digits wouldn't make sense, clear entered keys\n const potentialNextValue = parseInt(newKeys + \"0\", 10);\n if (potentialNextValue > maxValue || newKeys.length >= maxDigits) {\n setEnteredKeys(\"\");\n focusSegment(\"next\");\n } else {\n setEnteredKeys(newKeys);\n }\n } else {\n // Start fresh with just this key\n const singleValue = parseInt(key, 10);\n if (singleValue >= minValue && singleValue <= maxValue) {\n state.setSegment(type, singleValue);\n const potentialNextValue = parseInt(key + \"0\", 10);\n if (potentialNextValue > maxValue || key.length >= maxDigits) {\n setEnteredKeys(\"\");\n focusSegment(\"next\");\n } else {\n setEnteredKeys(key);\n }\n } else {\n setEnteredKeys(\"\");\n }\n }\n };\n\n const handleBeforeInput = (e: InputEvent) => {\n if (!isEditable()) return;\n if (isComposing()) return;\n\n const seg = segment();\n if (seg.type === \"literal\") return;\n\n if (e.inputType === \"deleteContentBackward\" || e.inputType === \"deleteContentForward\") {\n e.preventDefault();\n clearCurrentSegment(seg.type);\n return;\n }\n\n if (e.inputType === \"insertText\" && e.data) {\n const normalizedDigit = normalizeDigit(e.data);\n if (!normalizedDigit) return;\n e.preventDefault();\n handleNumericInput(normalizedDigit, seg.type, seg);\n }\n };\n\n const handleCompositionStart = () => {\n if (!isEditable()) return;\n setIsComposing(true);\n setEnteredKeys(\"\");\n };\n\n const handleCompositionEnd = (e: CompositionEvent) => {\n if (!isEditable()) return;\n setIsComposing(false);\n\n const seg = segment();\n if (seg.type === \"literal\") return;\n\n const digits = extractNormalizedDigits(e.data ?? \"\");\n if (digits.length === 0) return;\n\n for (const digit of digits) {\n handleNumericInput(digit, seg.type, seg);\n }\n };\n\n // Handle focus\n const handleFocus = () => {\n setIsFocused(true);\n setEnteredKeys(\"\");\n\n if (!hadPointerDown) {\n setIsFocusVisible(true);\n }\n hadPointerDown = false;\n\n // Select all text in the segment\n const el = ref?.();\n if (el && typeof window !== \"undefined\") {\n const selection = window.getSelection();\n if (selection) {\n const range = new Range();\n range.selectNodeContents(el);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n setIsFocusVisible(false);\n setEnteredKeys(\"\");\n clearLongPress();\n state.confirmPlaceholder();\n };\n\n const handleMouseEnter = () => {\n setIsHovered(true);\n };\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n // Segment props\n const segmentProps = createMemo(() => {\n const seg = segment();\n const type = seg.type;\n const p = getProps();\n\n // Literal segments don't need interaction props\n if (type === \"literal\") {\n return {\n \"aria-hidden\": true,\n };\n }\n\n return {\n role: \"spinbutton\",\n tabIndex: isEditable() ? 0 : -1,\n \"aria-label\": getSegmentLabel(type, locale().locale),\n \"aria-valuenow\": seg.value,\n \"aria-valuemin\": seg.minValue,\n \"aria-valuemax\": seg.maxValue,\n \"aria-valuetext\": seg.isPlaceholder ? \"\" : seg.text,\n \"aria-readonly\": state.isReadOnly() || undefined,\n \"aria-disabled\": state.isDisabled() || undefined,\n \"aria-invalid\": state.isInvalid() || undefined,\n \"aria-controls\": p[\"aria-controls\"] || undefined,\n \"aria-describedby\": p[\"aria-describedby\"] || undefined,\n contentEditable: isEditable(),\n suppressContentEditableWarning: true,\n inputMode: \"numeric\" as const,\n autoCorrect: \"off\",\n enterKeyHint: \"next\" as const,\n spellCheck: false,\n \"data-placeholder\": seg.isPlaceholder ? \"true\" : undefined,\n \"data-readonly\": state.isReadOnly() || undefined,\n \"data-disabled\": state.isDisabled() || undefined,\n \"data-invalid\": state.isInvalid() || undefined,\n \"data-type\": seg.type,\n \"data-hovered\": isHovered() || undefined,\n \"data-focused\": isFocused() || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onBeforeInput: handleBeforeInput,\n onCompositionStart: handleCompositionStart,\n onCompositionEnd: handleCompositionEnd,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onPointerDown: (e: PointerEvent) => {\n // Prevent cursor positioning in the middle of the segment\n e.preventDefault();\n hadPointerDown = true;\n setIsFocusVisible(false);\n },\n onPointerUp: () => {\n clearLongPress();\n },\n };\n });\n\n // Text to display\n const text = createMemo(() => {\n const seg = segment();\n return seg.isPlaceholder ? seg.placeholder : seg.text;\n });\n\n return {\n get segmentProps() {\n return segmentProps();\n },\n get isFocused() {\n return isFocused();\n },\n get isEditable() {\n return isEditable();\n },\n get isPlaceholder() {\n return segment().isPlaceholder;\n },\n get text() {\n return text();\n },\n get isHovered() {\n return isHovered();\n },\n get isFocusVisible() {\n return isFocusVisible();\n },\n };\n}\n\nconst SEGMENT_LABELS: Record<string, Record<Exclude<DateSegmentType, \"literal\">, string>> = {\n en: {\n year: \"Year\",\n month: \"Month\",\n day: \"Day\",\n hour: \"Hour\",\n minute: \"Minute\",\n second: \"Second\",\n dayPeriod: \"AM/PM\",\n era: \"Era\",\n timeZoneName: \"Time zone\",\n },\n es: {\n year: \"Año\",\n month: \"Mes\",\n day: \"Día\",\n hour: \"Hora\",\n minute: \"Minuto\",\n second: \"Segundo\",\n dayPeriod: \"AM/PM\",\n era: \"Era\",\n timeZoneName: \"Zona horaria\",\n },\n};\n\nfunction getSegmentLabel(type: DateSegmentType, locale: string): string {\n if (type === \"literal\") return \"\";\n\n const language = locale.toLowerCase().split(\"-\")[0] ?? \"en\";\n const labels = SEGMENT_LABELS[language] ?? SEGMENT_LABELS.en;\n return labels[type];\n}\n\nfunction normalizeDigit(input: string): string | null {\n if (/^[0-9]$/.test(input)) {\n return input;\n }\n\n const codePoint = input.codePointAt(0);\n if (codePoint == null) return null;\n\n // Full-width digits 0-9\n if (codePoint >= 0xff10 && codePoint <= 0xff19) {\n return String(codePoint - 0xff10);\n }\n\n return null;\n}\n\nfunction extractNormalizedDigits(value: string): string[] {\n const digits: string[] = [];\n for (const char of value) {\n const normalized = normalizeDigit(char);\n if (normalized) {\n digits.push(normalized);\n }\n }\n return digits;\n}\n","/**\n * createTimeField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a time field component.\n * Based on @react-aria/datepicker useTimeField\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { createLabel } from \"../label/createLabel\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport type { TimeFieldState, TimeSegment, TimeValue } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTimeFieldProps {\n /** An ID for the time field. */\n id?: string;\n /** A visible label for the time field. */\n label?: string;\n /** An accessible label for the time field. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the time field. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the time field. */\n \"aria-describedby\"?: string;\n /** Whether the time field is disabled. */\n isDisabled?: boolean;\n /** Whether the time field is read-only. */\n isReadOnly?: boolean;\n /** Whether the time field is required. */\n isRequired?: boolean;\n /** Whether the time field is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n /** The name of the input element, used when submitting an HTML form. */\n name?: string;\n /** The id of the form the hidden input belongs to. */\n form?: string;\n /** Describes the autocomplete behavior for the hidden input. */\n autoComplete?: string;\n}\n\nexport interface TimeFieldAria {\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the field container element. */\n fieldProps: Record<string, unknown>;\n /** Props for the input container (holds segments). */\n inputProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n /** The segments to render. */\n segments: TimeSegment[];\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n */\nexport function createTimeField<T extends TimeFieldState<TimeValue>>(\n props: MaybeAccessor<AriaTimeFieldProps>,\n state: T,\n _ref?: () => HTMLElement | null,\n): TimeFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if ((p.isInvalid || state.isInvalid()) && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n // Segments from state\n const segments = createMemo(() => state.segments());\n\n // Field container props\n const fieldProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(labelFieldProps as Record<string, unknown>, {\n id,\n role: \"group\",\n \"aria-disabled\": p.isDisabled || state.isDisabled() || undefined,\n \"aria-readonly\": p.isReadOnly || state.isReadOnly() || undefined,\n \"aria-required\": p.isRequired || state.isRequired() || undefined,\n \"aria-invalid\": p.isInvalid || state.isInvalid() || undefined,\n \"aria-describedby\": getAriaDescribedBy(),\n });\n });\n\n // Input container props\n const inputProps = createMemo(() => ({\n role: \"presentation\",\n }));\n\n // Description props\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: \"alert\",\n }));\n\n return {\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get inputProps() {\n return inputProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get segments() {\n return segments();\n },\n };\n}\n","/**\n * createTimeSegment hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a time segment.\n * Based on @react-aria/datepicker useDateSegment semantics (time-field scope).\n */\n\nimport { createMemo, createSignal } from \"solid-js\";\nimport { useLocale } from \"../i18n\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport type { TimeFieldState, TimeSegment, TimeSegmentType } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaTimeSegmentProps {\n /** The segment data. */\n segment: TimeSegment;\n}\n\nexport interface TimeSegmentAria {\n /** Props for the segment element. */\n segmentProps: Record<string, unknown>;\n /** Whether the segment is focused. */\n isFocused: boolean;\n /** Whether the segment is editable. */\n isEditable: boolean;\n /** Whether the segment is a placeholder. */\n isPlaceholder: boolean;\n /** The text to display. */\n text: string;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a time segment.\n */\nexport function createTimeSegment<T extends TimeFieldState>(\n props: MaybeAccessor<AriaTimeSegmentProps>,\n state: T,\n ref?: () => HTMLElement | null,\n): TimeSegmentAria {\n const getProps = () => access(props);\n const [isFocused, setIsFocused] = createSignal(false);\n const [enteredKeys, setEnteredKeys] = createSignal(\"\");\n const [isComposing, setIsComposing] = createSignal(false);\n const locale = useLocale();\n\n const segment = createMemo(() => getProps().segment);\n\n const isEditable = createMemo(() => {\n const seg = segment();\n return seg.isEditable && !state.isDisabled() && !state.isReadOnly();\n });\n\n const focusSegment = (target: \"first\" | \"last\" | \"prev\" | \"next\") => {\n const el = ref?.();\n if (!el) return;\n\n const container = el.parentElement;\n if (!container) return;\n\n const segments = Array.from(container.querySelectorAll<HTMLElement>('[role=\"spinbutton\"]'));\n\n if (segments.length === 0) return;\n\n if (target === \"first\") {\n segments[0]?.focus();\n return;\n }\n\n if (target === \"last\") {\n segments[segments.length - 1]?.focus();\n return;\n }\n\n const currentIndex = segments.indexOf(el);\n if (currentIndex < 0) return;\n\n const nextIndex = target === \"next\" ? currentIndex + 1 : currentIndex - 1;\n if (nextIndex >= 0 && nextIndex < segments.length) {\n segments[nextIndex]?.focus();\n }\n };\n\n const clearCurrentSegment = (type: TimeSegmentType) => {\n state.clearSegment(type);\n setEnteredKeys(\"\");\n };\n\n const handleNumericInput = (key: string, type: TimeSegmentType, seg: TimeSegment) => {\n const newKeys = enteredKeys() + key;\n const numValue = parseInt(newKeys, 10);\n const maxValue = seg.maxValue ?? 99;\n const minValue = seg.minValue ?? 0;\n const maxDigits = String(maxValue).length;\n\n if (numValue <= maxValue) {\n state.setSegment(type, numValue);\n\n const potentialNextValue = parseInt(newKeys + \"0\", 10);\n if (potentialNextValue > maxValue || newKeys.length >= maxDigits) {\n setEnteredKeys(\"\");\n focusSegment(\"next\");\n } else {\n setEnteredKeys(newKeys);\n }\n } else {\n const singleValue = parseInt(key, 10);\n if (singleValue >= minValue && singleValue <= maxValue) {\n state.setSegment(type, singleValue);\n const potentialNextValue = parseInt(key + \"0\", 10);\n if (potentialNextValue > maxValue || key.length >= maxDigits) {\n setEnteredKeys(\"\");\n focusSegment(\"next\");\n } else {\n setEnteredKeys(key);\n }\n } else {\n setEnteredKeys(\"\");\n }\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isEditable()) return;\n if (isComposing()) return;\n\n const seg = segment();\n const type = seg.type;\n\n if (type === \"literal\") return;\n\n switch (e.key) {\n case \"ArrowRight\":\n e.preventDefault();\n focusSegment(locale().direction === \"rtl\" ? \"prev\" : \"next\");\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n focusSegment(locale().direction === \"rtl\" ? \"next\" : \"prev\");\n break;\n case \"ArrowUp\":\n e.preventDefault();\n state.incrementSegment(type);\n break;\n case \"ArrowDown\":\n e.preventDefault();\n state.decrementSegment(type);\n break;\n case \"Home\":\n e.preventDefault();\n focusSegment(\"first\");\n break;\n case \"End\":\n e.preventDefault();\n focusSegment(\"last\");\n break;\n case \"Backspace\":\n e.preventDefault();\n if (seg.isPlaceholder) {\n focusSegment(\"prev\");\n } else {\n clearCurrentSegment(type);\n }\n break;\n case \"Delete\":\n e.preventDefault();\n clearCurrentSegment(type);\n break;\n default:\n const normalizedDigit = normalizeDigit(e.key);\n if (normalizedDigit) {\n e.preventDefault();\n handleNumericInput(normalizedDigit, type, seg);\n }\n break;\n }\n };\n\n const handleBeforeInput = (e: InputEvent) => {\n if (!isEditable()) return;\n if (isComposing()) return;\n\n const seg = segment();\n if (seg.type === \"literal\") return;\n\n if (e.inputType === \"deleteContentBackward\" || e.inputType === \"deleteContentForward\") {\n e.preventDefault();\n clearCurrentSegment(seg.type);\n return;\n }\n\n if (e.inputType === \"insertText\" && e.data) {\n const normalizedDigit = normalizeDigit(e.data);\n if (!normalizedDigit) return;\n e.preventDefault();\n handleNumericInput(normalizedDigit, seg.type, seg);\n }\n };\n\n const handleCompositionStart = () => {\n if (!isEditable()) return;\n setIsComposing(true);\n setEnteredKeys(\"\");\n };\n\n const handleCompositionEnd = (e: CompositionEvent) => {\n if (!isEditable()) return;\n setIsComposing(false);\n\n const seg = segment();\n if (seg.type === \"literal\") return;\n\n const digits = extractNormalizedDigits(e.data ?? \"\");\n if (digits.length === 0) return;\n\n for (const digit of digits) {\n handleNumericInput(digit, seg.type, seg);\n }\n };\n\n const handleFocus = () => {\n setIsFocused(true);\n setEnteredKeys(\"\");\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n setEnteredKeys(\"\");\n\n const maybeState = state as unknown as { confirmPlaceholder?: () => void };\n maybeState.confirmPlaceholder?.();\n };\n\n const segmentProps = createMemo(() => {\n const seg = segment();\n const type = seg.type;\n\n if (type === \"literal\") {\n return {\n \"aria-hidden\": true,\n };\n }\n\n return {\n role: \"spinbutton\",\n tabIndex: isEditable() ? 0 : -1,\n \"aria-label\": getSegmentLabel(type, locale().locale),\n \"aria-valuenow\": seg.value,\n \"aria-valuemin\": seg.minValue,\n \"aria-valuemax\": seg.maxValue,\n \"aria-valuetext\": seg.isPlaceholder ? seg.placeholder : seg.text,\n \"aria-readonly\": state.isReadOnly() || undefined,\n \"aria-disabled\": state.isDisabled() || undefined,\n \"aria-invalid\": state.isInvalid() || undefined,\n contentEditable: isEditable(),\n suppressContentEditableWarning: true,\n inputMode: \"numeric\" as const,\n autoCorrect: \"off\",\n enterKeyHint: \"next\" as const,\n spellCheck: false,\n onKeyDown: handleKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onBeforeInput: handleBeforeInput,\n onCompositionStart: handleCompositionStart,\n onCompositionEnd: handleCompositionEnd,\n onMouseDown: (e: MouseEvent) => {\n e.preventDefault();\n },\n };\n });\n\n const text = createMemo(() => {\n const seg = segment();\n return seg.isPlaceholder ? seg.placeholder : seg.text;\n });\n\n return {\n get segmentProps() {\n return segmentProps();\n },\n get isFocused() {\n return isFocused();\n },\n get isEditable() {\n return isEditable();\n },\n get isPlaceholder() {\n return segment().isPlaceholder;\n },\n get text() {\n return text();\n },\n };\n}\n\ntype EditableTimeSegmentType = Exclude<TimeSegmentType, \"literal\">;\n\nconst SEGMENT_LABELS: Record<string, Record<EditableTimeSegmentType, string>> = {\n en: {\n hour: \"Hour\",\n minute: \"Minute\",\n second: \"Second\",\n dayPeriod: \"AM/PM\",\n },\n es: {\n hour: \"Hora\",\n minute: \"Minuto\",\n second: \"Segundo\",\n dayPeriod: \"AM/PM\",\n },\n};\n\nfunction getSegmentLabel(type: TimeSegmentType, locale: string): string {\n if (type === \"literal\") return \"\";\n\n const language = locale.toLowerCase().split(\"-\")[0] ?? \"en\";\n const labels = SEGMENT_LABELS[language] ?? SEGMENT_LABELS.en;\n return labels[type];\n}\n\nfunction normalizeDigit(input: string): string | null {\n if (/^[0-9]$/.test(input)) {\n return input;\n }\n\n const code = input.codePointAt(0);\n if (code === undefined) return null;\n\n if (code >= 0x0660 && code <= 0x0669) {\n return String(code - 0x0660);\n }\n\n if (code >= 0x06f0 && code <= 0x06f9) {\n return String(code - 0x06f0);\n }\n\n if (code >= 0xff10 && code <= 0xff19) {\n return String(code - 0xff10);\n }\n\n return null;\n}\n\nfunction extractNormalizedDigits(input: string): string[] {\n const digits: string[] = [];\n for (const char of input) {\n const normalized = normalizeDigit(char);\n if (normalized) {\n digits.push(normalized);\n }\n }\n return digits;\n}\n","/**\n * createDatePicker hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date picker component.\n * Based on @react-aria/datepicker useDatePicker\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { createLabel } from \"../label/createLabel\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { useLocale } from \"../i18n\";\nimport { createPress } from \"../interactions/createPress\";\nimport { DateFormatter, getLocalTimeZone } from \"@internationalized/date\";\nimport type { DateFieldState, CalendarState } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaDatePickerProps {\n /** An ID for the date picker. */\n id?: string;\n /** A visible label for the date picker. */\n label?: string;\n /** An accessible label for the date picker. */\n \"aria-label\"?: string;\n /** The ID of an element that labels the date picker. */\n \"aria-labelledby\"?: string;\n /** The ID of an element that describes the date picker. */\n \"aria-describedby\"?: string;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /** Whether the date picker is read-only. */\n isReadOnly?: boolean;\n /** Whether the date picker is required. */\n isRequired?: boolean;\n /** Whether the date picker is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n /** Accessible label for the calendar trigger button. */\n buttonAriaLabel?: string;\n /** Accessible label for the calendar dialog. */\n dialogAriaLabel?: string;\n /** Accessible label for the calendar grid region. */\n calendarAriaLabel?: string;\n /** The minimum allowed date. */\n minValue?: Date;\n /** The maximum allowed date. */\n maxValue?: Date;\n /** Whether a date is unavailable. */\n isDateUnavailable?: (date: unknown) => boolean;\n /** The first day of the week. */\n firstDayOfWeek?: number;\n /** Page behavior for calendar. */\n pageBehavior?: \"single\" | \"visible\";\n /** Whether to force leading zeros. */\n shouldForceLeadingZeros?: boolean;\n /** Callback when focus changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Callback when focused. */\n onFocus?: (e: FocusEvent) => void;\n /** Callback when blurred. */\n onBlur?: (e: FocusEvent) => void;\n /** The name attribute for form submission. */\n name?: string;\n /** The form attribute. */\n form?: string;\n /** Auto focus the field. */\n autoFocus?: boolean;\n /** The placeholder value. */\n placeholderValue?: unknown;\n /** Whether to hide the time zone. */\n hideTimeZone?: boolean;\n /** The hour cycle. */\n hourCycle?: 12 | 24;\n /** The granularity. */\n granularity?: \"day\" | \"hour\" | \"minute\" | \"second\";\n}\n\nexport interface DatePickerState {\n /** Whether the calendar is open. */\n isOpen: boolean;\n /** Open the calendar. */\n open: () => void;\n /** Close the calendar. */\n close: () => void;\n /** Toggle the calendar. */\n toggle: () => void;\n}\n\nexport interface DatePickerAria {\n /** Props for the group container. */\n groupProps: Record<string, unknown>;\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the date field container. */\n fieldProps: Record<string, unknown>;\n /** Props for the button that opens the calendar. */\n buttonProps: Record<string, unknown>;\n /** Props for the calendar dialog. */\n dialogProps: Record<string, unknown>;\n /** Props for the calendar. */\n calendarProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n /** Whether the picker is invalid. */\n isInvalid: boolean;\n /** Validation errors. */\n validationErrors: string[];\n /** Validation details. */\n validationDetails: Record<string, unknown>;\n /** Focus manager for programmatic segment focus. */\n focusManager: {\n focusFirst: () => void;\n focusLast: () => void;\n } & {\n /** @internal Wires the actual focus implementations from the component layer */\n _register?: (first: () => void, last: () => void) => void;\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\n */\nexport function createDatePicker<T extends DateFieldState, C extends CalendarState>(\n props: MaybeAccessor<AriaDatePickerProps>,\n state: T,\n overlayState: DatePickerState,\n _calendarState?: C,\n): DatePickerAria {\n const locale = useLocale();\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n const dialogId = createId();\n const buttonId = createId();\n const fieldId = createId();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) {\n ids.push(p[\"aria-describedby\"]);\n }\n if (valueDescription()) {\n ids.push(valueDescriptionId);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if ((p.isInvalid || state.isInvalid()) && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n // Selected date description for screen readers\n const valueDescriptionId = createId();\n const valueDescription = createMemo(() => {\n const v = state.value?.();\n if (!v) return \"\";\n const formatter = new DateFormatter(locale().locale, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n });\n return formatter.format(v.toDate(getLocalTimeZone()));\n });\n\n // Group props\n const groupProps = createMemo(() => {\n const p = getProps();\n const isInvalid = p.isInvalid || state.isInvalid();\n const describedBy = getAriaDescribedBy();\n const labelField = labelFieldProps as Record<string, unknown>;\n\n return {\n id,\n role: \"group\",\n \"aria-label\": labelField[\"aria-label\"] || undefined,\n \"aria-labelledby\": labelField[\"aria-labelledby\"] || undefined,\n \"aria-disabled\": p.isDisabled || state.isDisabled() || undefined,\n \"aria-readonly\": p.isReadOnly || state.isReadOnly() || undefined,\n \"aria-required\": p.isRequired || state.isRequired() || undefined,\n \"aria-invalid\": isInvalid || undefined,\n \"aria-describedby\": describedBy,\n };\n });\n\n // Field props - applied to DateInput container\n const fieldProps = createMemo(() => {\n const p = getProps();\n const describedBy = getAriaDescribedBy();\n\n return {\n id: fieldId,\n \"aria-describedby\": describedBy,\n value: state.value?.(),\n defaultValue: state.defaultValue,\n onChange: (value: unknown) => {\n state.setValue?.(value as T extends DateFieldState<infer V> ? V | null : null);\n },\n placeholderValue: p.placeholderValue,\n hideTimeZone: p.hideTimeZone,\n hourCycle: p.hourCycle,\n shouldForceLeadingZeros: p.shouldForceLeadingZeros,\n granularity: p.granularity,\n isDisabled: p.isDisabled || state.isDisabled(),\n isReadOnly: p.isReadOnly || state.isReadOnly(),\n isRequired: p.isRequired || state.isRequired(),\n autoFocus: p.autoFocus,\n name: p.name,\n form: p.form,\n };\n });\n\n // Button props with createPress for keyboard/mouse/touch activation\n const buttonPress = createPress({\n get isDisabled() {\n const p = getProps();\n return p.isDisabled || state.isDisabled();\n },\n onPress: () => {\n overlayState.open();\n },\n });\n\n const buttonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n const defaults = getDatePickerLabelDefaults(locale().locale);\n const labelId = (labelProps as Record<string, unknown>)[\"id\"] as string | undefined;\n const labelledBy = labelId ? `${buttonId} ${labelId}` : buttonId;\n const describedBy = getAriaDescribedBy();\n\n return mergeProps(buttonPress.pressProps as Record<string, unknown>, {\n id: buttonId,\n type: \"button\" as const,\n \"aria-label\": p.buttonAriaLabel ?? defaults.button,\n \"aria-labelledby\": labelledBy,\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": overlayState.isOpen,\n \"aria-controls\": overlayState.isOpen ? dialogId : undefined,\n \"aria-describedby\": describedBy,\n \"aria-disabled\": isDisabled || undefined,\n tabIndex: 0,\n });\n });\n\n // Dialog props\n const dialogProps = createMemo(() => {\n const p = getProps();\n const defaults = getDatePickerLabelDefaults(locale().locale);\n const labelId = (labelProps as Record<string, unknown>)[\"id\"] as string | undefined;\n const labelledBy = labelId ? `${buttonId} ${labelId}` : buttonId;\n\n return {\n id: dialogId,\n role: \"dialog\",\n \"aria-modal\": true,\n \"aria-labelledby\": labelledBy,\n \"aria-label\": p.dialogAriaLabel ?? defaults.dialog,\n };\n });\n\n // Calendar props\n const calendarProps = createMemo(() => {\n const p = getProps();\n const defaults = getDatePickerLabelDefaults(locale().locale);\n const currentValue = state.value?.();\n\n return {\n autoFocus: true,\n value: currentValue,\n onChange: (value: unknown) => {\n if (state.setValue) {\n state.setValue(value as Parameters<typeof state.setValue>[0]);\n }\n },\n minValue: p.minValue,\n maxValue: p.maxValue,\n isDisabled: p.isDisabled || state.isDisabled(),\n isReadOnly: p.isReadOnly || state.isReadOnly(),\n isDateUnavailable: p.isDateUnavailable,\n defaultFocusedValue: currentValue ? undefined : p.placeholderValue,\n isInvalid: p.isInvalid || state.isInvalid(),\n errorMessage:\n typeof p.errorMessage === \"string\"\n ? p.errorMessage\n : state.isInvalid()\n ? \"Invalid date\"\n : undefined,\n firstDayOfWeek: p.firstDayOfWeek,\n pageBehavior: p.pageBehavior,\n \"aria-label\": p.calendarAriaLabel ?? p.dialogAriaLabel ?? defaults.calendar,\n };\n });\n\n // Description props for the description element\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Value description element props\n const valueDescriptionProps = createMemo(() => ({\n id: valueDescriptionId,\n \"aria-hidden\": true,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: \"alert\",\n }));\n\n // Label click focuses first segment — component layer wires the actual ref\n let focusFirstSegment: (() => void) | undefined;\n let focusLastSegment: (() => void) | undefined;\n\n const enhancedLabelProps = createMemo(() => {\n return {\n ...labelProps,\n onClick: () => {\n focusFirstSegment?.();\n },\n };\n });\n\n const isInvalid = createMemo(() => {\n const p = getProps();\n return p.isInvalid || state.isInvalid();\n });\n\n const validationErrors = createMemo(() => {\n const p = getProps();\n if (p.isInvalid && typeof p.errorMessage === \"string\") {\n return [p.errorMessage];\n }\n return [];\n });\n\n const validationDetails = createMemo(() => {\n const p = getProps();\n return {\n minValue: p.minValue,\n maxValue: p.maxValue,\n isDateUnavailable: p.isDateUnavailable,\n isInvalid: isInvalid(),\n };\n });\n\n return {\n get groupProps() {\n return groupProps();\n },\n get labelProps() {\n return enhancedLabelProps() as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get dialogProps() {\n return dialogProps();\n },\n get calendarProps() {\n return calendarProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get isInvalid() {\n return isInvalid();\n },\n get validationErrors() {\n return validationErrors();\n },\n get validationDetails() {\n return validationDetails();\n },\n focusManager: {\n focusFirst: () => focusFirstSegment?.(),\n focusLast: () => focusLastSegment?.(),\n /** @internal Wires the actual focus implementations from the component layer */\n _register: (first: () => void, last: () => void) => {\n focusFirstSegment = first;\n focusLastSegment = last;\n },\n },\n };\n}\n\nfunction getDatePickerLabelDefaults(locale: string): {\n button: string;\n dialog: string;\n calendar: string;\n} {\n const language = locale.toLowerCase().split(\"-\")[0] ?? \"en\";\n\n if (language === \"es\") {\n return {\n button: \"Abrir calendario\",\n dialog: \"Calendario\",\n calendar: \"Calendario\",\n };\n }\n\n return {\n button: \"Open calendar\",\n dialog: \"Calendar\",\n calendar: \"Calendar\",\n };\n}\n","/**\n * createDateRangePicker hook for Solidaria\n *\n * Provides behavior and accessibility wiring for range date pickers.\n * Compatibility target: @react-aria/datepicker useDateRangePicker.\n */\n\nimport { createMemo } from \"solid-js\";\nimport { createId } from \"../ssr\";\nimport { createLabel } from \"../label/createLabel\";\nimport { access, type MaybeAccessor } from \"../utils/reactivity\";\nimport { mergeProps } from \"../utils/mergeProps\";\nimport { useLocale } from \"../i18n\";\nimport type { RangeCalendarState } from \"@proyecto-viviana/solid-stately\";\nimport type { DatePickerState } from \"./createDatePicker\";\n\nexport interface AriaDateRangePickerProps {\n id?: string;\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isRequired?: boolean;\n isInvalid?: boolean;\n description?: string;\n errorMessage?: string;\n buttonAriaLabel?: string;\n dialogAriaLabel?: string;\n calendarAriaLabel?: string;\n startFieldAriaLabel?: string;\n endFieldAriaLabel?: string;\n}\n\nexport interface DateRangePickerAria {\n groupProps: Record<string, unknown>;\n labelProps: Record<string, unknown>;\n startFieldProps: Record<string, unknown>;\n endFieldProps: Record<string, unknown>;\n startInputProps: Record<string, unknown>;\n endInputProps: Record<string, unknown>;\n buttonProps: Record<string, unknown>;\n dialogProps: Record<string, unknown>;\n calendarProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n}\n\nexport function createDateRangePicker<T extends RangeCalendarState>(\n props: MaybeAccessor<AriaDateRangePickerProps>,\n state: T,\n overlayState: DatePickerState,\n): DateRangePickerAria {\n const locale = useLocale();\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const startFieldId = createId();\n const endFieldId = createId();\n const descriptionId = createId();\n const errorMessageId = createId();\n const dialogId = createId();\n\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() {\n return getProps().label;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return getProps()[\"aria-labelledby\"];\n },\n labelElementType: \"span\",\n });\n\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p[\"aria-describedby\"]) ids.push(p[\"aria-describedby\"]);\n if (p.description) ids.push(descriptionId);\n if (p.isInvalid && p.errorMessage) ids.push(errorMessageId);\n return ids.length > 0 ? ids.join(\" \") : undefined;\n };\n\n const groupProps = createMemo(() => {\n const p = getProps();\n const isInvalid = p.isInvalid;\n return mergeProps(labelFieldProps as Record<string, unknown>, {\n id,\n role: \"group\",\n \"aria-disabled\": p.isDisabled || state.isDisabled() || undefined,\n \"aria-readonly\": p.isReadOnly || state.isReadOnly() || undefined,\n \"aria-required\": p.isRequired || undefined,\n \"aria-invalid\": isInvalid || undefined,\n \"aria-describedby\": getAriaDescribedBy(),\n });\n });\n\n const startFieldProps = createMemo(() => {\n const p = getProps();\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n const isDisabled = p.isDisabled || state.isDisabled();\n const isReadOnly = p.isReadOnly || state.isReadOnly();\n const isInvalid = p.isInvalid;\n\n return {\n id: startFieldId,\n \"aria-label\": p.startFieldAriaLabel ?? defaults.startField,\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": isDisabled || undefined,\n \"aria-readonly\": isReadOnly || undefined,\n \"aria-invalid\": isInvalid || undefined,\n tabIndex: isDisabled ? -1 : 0,\n onClick: () => {\n if (!isDisabled) {\n overlayState.open();\n }\n },\n onKeyDown: (event: KeyboardEvent) => {\n if (isDisabled) return;\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault();\n overlayState.open();\n }\n },\n };\n });\n\n const endFieldProps = createMemo(() => {\n const p = getProps();\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n const isDisabled = p.isDisabled || state.isDisabled();\n const isReadOnly = p.isReadOnly || state.isReadOnly();\n const isInvalid = p.isInvalid;\n\n return {\n id: endFieldId,\n \"aria-label\": p.endFieldAriaLabel ?? defaults.endField,\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": isDisabled || undefined,\n \"aria-readonly\": isReadOnly || undefined,\n \"aria-invalid\": isInvalid || undefined,\n tabIndex: isDisabled ? -1 : 0,\n onClick: () => {\n if (!isDisabled) {\n overlayState.open();\n }\n },\n onKeyDown: (event: KeyboardEvent) => {\n if (isDisabled) return;\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault();\n overlayState.open();\n }\n },\n };\n });\n\n const startInputProps = createMemo(() => {\n const p = getProps();\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n const isDisabled = p.isDisabled || state.isDisabled();\n const isReadOnly = p.isReadOnly || state.isReadOnly();\n const isInvalid = p.isInvalid;\n\n return {\n id: startFieldId,\n \"aria-label\": p.startFieldAriaLabel ?? defaults.startField,\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": isDisabled || undefined,\n \"aria-readonly\": isReadOnly || undefined,\n \"aria-invalid\": isInvalid || undefined,\n };\n });\n\n const endInputProps = createMemo(() => {\n const p = getProps();\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n const isDisabled = p.isDisabled || state.isDisabled();\n const isReadOnly = p.isReadOnly || state.isReadOnly();\n const isInvalid = p.isInvalid;\n\n return {\n id: endFieldId,\n \"aria-label\": p.endFieldAriaLabel ?? defaults.endField,\n \"aria-describedby\": getAriaDescribedBy(),\n \"aria-disabled\": isDisabled || undefined,\n \"aria-readonly\": isReadOnly || undefined,\n \"aria-invalid\": isInvalid || undefined,\n };\n });\n\n const buttonProps = createMemo(() => {\n const p = getProps();\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n const isDisabled = p.isDisabled || state.isDisabled();\n return {\n \"aria-label\": p.buttonAriaLabel ?? defaults.button,\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": overlayState.isOpen,\n \"aria-controls\": overlayState.isOpen ? dialogId : undefined,\n disabled: isDisabled,\n tabIndex: 0,\n onClick: () => {\n if (!isDisabled) overlayState.toggle();\n },\n };\n });\n\n const dialogProps = createMemo(() => {\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n return {\n id: dialogId,\n role: \"dialog\",\n \"aria-modal\": true,\n \"aria-label\": getProps().dialogAriaLabel ?? defaults.dialog,\n };\n });\n\n const calendarProps = createMemo(() => {\n const defaults = getDateRangePickerLabelDefaults(locale().locale);\n return {\n \"aria-label\": getProps().calendarAriaLabel ?? getProps().dialogAriaLabel ?? defaults.calendar,\n };\n });\n\n const descriptionProps = createMemo(() => ({ id: descriptionId }));\n const errorMessageProps = createMemo(() => ({ id: errorMessageId, role: \"alert\" }));\n\n return {\n get groupProps() {\n return groupProps();\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get startFieldProps() {\n return startFieldProps();\n },\n get endFieldProps() {\n return endFieldProps();\n },\n get startInputProps() {\n return startInputProps();\n },\n get endInputProps() {\n return endInputProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get dialogProps() {\n return dialogProps();\n },\n get calendarProps() {\n return calendarProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n };\n}\n\nfunction getDateRangePickerLabelDefaults(locale: string): {\n button: string;\n dialog: string;\n calendar: string;\n startField: string;\n endField: string;\n} {\n const language = locale.toLowerCase().split(\"-\")[0] ?? \"en\";\n\n if (language === \"es\") {\n return {\n button: \"Abrir calendario de rango\",\n dialog: \"Calendario de rango\",\n calendar: \"Calendario de rango\",\n startField: \"Fecha de inicio\",\n endField: \"Fecha de fin\",\n };\n }\n\n return {\n button: \"Open range calendar\",\n dialog: \"Range calendar\",\n calendar: \"Range calendar\",\n startField: \"Start date\",\n endField: \"End date\",\n };\n}\n","/**\n * GridKeyboardDelegate - Handles keyboard navigation in a grid.\n * Based on @react-aria/grid/GridKeyboardDelegate.\n */\n\nimport type { GridCollection, GridNode, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { KeyboardDelegate } from \"./types\";\nimport type { Accessor } from \"solid-js\";\n\nexport interface GridKeyboardDelegateOptions<T> {\n /** The grid collection. */\n collection: GridCollection<T>;\n /** Set of disabled keys. */\n disabledKeys: Set<Key>;\n /** Ref to the grid element. */\n ref: Accessor<HTMLElement | null>;\n /** Focus mode: row or cell. */\n focusMode: \"row\" | \"cell\";\n /** Text direction (ltr or rtl). */\n direction: \"ltr\" | \"rtl\";\n}\n\n/**\n * A keyboard delegate that handles navigation in a grid.\n */\nexport class GridKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: GridCollection<T>;\n private disabledKeys: Set<Key>;\n private ref: Accessor<HTMLElement | null>;\n private focusMode: \"row\" | \"cell\";\n private direction: \"ltr\" | \"rtl\";\n\n constructor(options: GridKeyboardDelegateOptions<T>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.ref = options.ref;\n this.focusMode = options.focusMode;\n this.direction = options.direction;\n }\n\n /**\n * Check if a key is disabled.\n */\n private isDisabled(key: Key): boolean {\n return this.disabledKeys.has(key);\n }\n\n /**\n * Get the parent row key for a cell.\n */\n private getRowKey(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n if (item.type === \"item\") {\n return key;\n }\n\n if (item.type === \"cell\" && item.parentKey != null) {\n return item.parentKey;\n }\n\n return null;\n }\n\n /**\n * Get all body rows (excluding header rows).\n */\n private getBodyRows(): GridNode<T>[] {\n return this.collection.rows.filter((row) => row.type === \"item\");\n }\n\n /**\n * Get the first non-disabled key.\n */\n getFirstKey(fromKey?: Key, global?: boolean): Key | null {\n const rows = this.getBodyRows();\n\n if (this.focusMode === \"row\" || global) {\n // Find first non-disabled row\n for (const row of rows) {\n if (!this.isDisabled(row.key)) {\n return row.key;\n }\n }\n return null;\n }\n\n // Cell focus mode - get first cell of current row or first row\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n if (rowKey != null) {\n const children = [...this.collection.getChildren(rowKey)];\n if (children.length > 0) {\n return children[0].key;\n }\n }\n }\n\n // Fall back to first cell of first row\n if (rows.length > 0) {\n const children = [...this.collection.getChildren(rows[0].key)];\n if (children.length > 0) {\n return children[0].key;\n }\n }\n\n return null;\n }\n\n /**\n * Get the last non-disabled key.\n */\n getLastKey(fromKey?: Key, global?: boolean): Key | null {\n const rows = this.getBodyRows();\n\n if (this.focusMode === \"row\" || global) {\n // Find last non-disabled row\n for (let i = rows.length - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n return null;\n }\n\n // Cell focus mode - get last cell of current row or last row\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n if (rowKey != null) {\n const children = [...this.collection.getChildren(rowKey)];\n if (children.length > 0) {\n return children[children.length - 1].key;\n }\n }\n }\n\n // Fall back to last cell of last row\n if (rows.length > 0) {\n const children = [...this.collection.getChildren(rows[rows.length - 1].key)];\n if (children.length > 0) {\n return children[children.length - 1].key;\n }\n }\n\n return null;\n }\n\n /**\n * Get the key above the current key.\n */\n getKeyAbove(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n\n if (this.focusMode === \"row\" || item.type === \"item\") {\n // Find the row and get the previous one\n const rowKey = item.type === \"item\" ? key : item.parentKey;\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex > 0) {\n // Find previous non-disabled row\n for (let i = rowIndex - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n }\n return null;\n }\n\n // Cell focus mode - get cell in same column of previous row\n if (item.type === \"cell\" && item.parentKey != null) {\n const rowIndex = rows.findIndex((r) => r.key === item.parentKey);\n const colIndex = item.column ?? item.index;\n\n if (rowIndex > 0) {\n for (let i = rowIndex - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key below the current key.\n */\n getKeyBelow(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n\n if (this.focusMode === \"row\" || item.type === \"item\") {\n // Find the row and get the next one\n const rowKey = item.type === \"item\" ? key : item.parentKey;\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex >= 0 && rowIndex < rows.length - 1) {\n // Find next non-disabled row\n for (let i = rowIndex + 1; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n }\n return null;\n }\n\n // Cell focus mode - get cell in same column of next row\n if (item.type === \"cell\" && item.parentKey != null) {\n const rowIndex = rows.findIndex((r) => r.key === item.parentKey);\n const colIndex = item.column ?? item.index;\n\n if (rowIndex >= 0 && rowIndex < rows.length - 1) {\n for (let i = rowIndex + 1; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key to the left of the current key.\n */\n getKeyLeftOf(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n // In row focus mode, left/right might not be meaningful\n if (this.focusMode === \"row\") {\n return null;\n }\n\n if (item.type === \"cell\" && item.parentKey != null) {\n const children = [...this.collection.getChildren(item.parentKey)];\n const colIndex = children.findIndex((c) => c.key === key);\n\n if (this.direction === \"rtl\") {\n // RTL: left moves to higher index\n if (colIndex < children.length - 1) {\n return children[colIndex + 1].key;\n }\n } else {\n // LTR: left moves to lower index\n if (colIndex > 0) {\n return children[colIndex - 1].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key to the right of the current key.\n */\n getKeyRightOf(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n // In row focus mode, left/right might not be meaningful\n if (this.focusMode === \"row\") {\n return null;\n }\n\n if (item.type === \"cell\" && item.parentKey != null) {\n const children = [...this.collection.getChildren(item.parentKey)];\n const colIndex = children.findIndex((c) => c.key === key);\n\n if (this.direction === \"rtl\") {\n // RTL: right moves to lower index\n if (colIndex > 0) {\n return children[colIndex - 1].key;\n }\n } else {\n // LTR: right moves to higher index\n if (colIndex < children.length - 1) {\n return children[colIndex + 1].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key for page up.\n */\n getKeyPageAbove(key: Key): Key | null {\n const el = this.ref();\n if (!el) return null;\n\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n const rowKey = this.getRowKey(key);\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex < 0) return null;\n\n // Calculate how many rows fit in a page (rough estimate)\n const rowHeight = el.scrollHeight / rows.length;\n const pageSize = Math.max(1, Math.floor(el.clientHeight / rowHeight));\n\n const targetIndex = Math.max(0, rowIndex - pageSize);\n\n // Find first non-disabled row at or before target\n for (let i = targetIndex; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n if (this.focusMode === \"row\" || item.type === \"item\") {\n return rows[i].key;\n }\n\n // Cell focus mode - return cell at same column\n const colIndex = item.type === \"cell\" ? (item.column ?? item.index) : 0;\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key for page down.\n */\n getKeyPageBelow(key: Key): Key | null {\n const el = this.ref();\n if (!el) return null;\n\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n const rowKey = this.getRowKey(key);\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex < 0) return null;\n\n // Calculate how many rows fit in a page (rough estimate)\n const rowHeight = el.scrollHeight / rows.length;\n const pageSize = Math.max(1, Math.floor(el.clientHeight / rowHeight));\n\n const targetIndex = Math.min(rows.length - 1, rowIndex + pageSize);\n\n // Find first non-disabled row at or after target\n for (let i = targetIndex; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n if (this.focusMode === \"row\" || item.type === \"item\") {\n return rows[i].key;\n }\n\n // Cell focus mode - return cell at same column\n const colIndex = item.type === \"cell\" ? (item.column ?? item.index) : 0;\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key that matches the search string.\n */\n getKeyForSearch(search: string, fromKey?: Key): Key | null {\n const searchLower = search.toLowerCase();\n const rows = this.getBodyRows();\n\n let startIndex = 0;\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n const idx = rows.findIndex((r) => r.key === rowKey);\n if (idx >= 0) {\n startIndex = idx + 1;\n }\n }\n\n // Search from startIndex to end\n for (let i = startIndex; i < rows.length; i++) {\n const row = rows[i];\n if (!this.isDisabled(row.key)) {\n const textValue = row.textValue?.toLowerCase() ?? \"\";\n if (textValue.startsWith(searchLower)) {\n return row.key;\n }\n }\n }\n\n // Wrap around and search from beginning\n for (let i = 0; i < startIndex; i++) {\n const row = rows[i];\n if (!this.isDisabled(row.key)) {\n const textValue = row.textValue?.toLowerCase() ?? \"\";\n if (textValue.startsWith(searchLower)) {\n return row.key;\n }\n }\n }\n\n return null;\n }\n}\n","/**\n * createGrid - Provides accessibility for a grid component.\n * Based on @react-aria/grid/useGrid.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { GridState, GridCollection, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { GridProps, GridAria, KeyboardDelegate } from \"./types\";\nimport { GridKeyboardDelegate } from \"./GridKeyboardDelegate\";\nimport { useLocale } from \"../i18n\";\n\n// Global map to store grid metadata for child components\nconst gridMap = new WeakMap<\n object,\n {\n keyboardDelegate: KeyboardDelegate;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n }\n>();\n\n/**\n * Get the grid metadata for child components.\n */\nexport function getGridData<T>(state: GridState<T, GridCollection<T>>) {\n return gridMap.get(state);\n}\n\n/**\n * Creates accessibility props for a grid component.\n * A grid displays data in rows and columns and enables navigation via arrow keys.\n */\nexport function createGrid<T extends object>(\n props: Accessor<GridProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n ref: Accessor<HTMLElement | null>,\n): GridAria {\n const id = createId(props().id);\n const locale = useLocale();\n\n // Track focused state\n const [_isFocused, setIsFocused] = createSignal(false);\n\n // Create keyboard delegate\n const keyboardDelegate = createMemo(() => {\n const p = props();\n const s = state();\n\n if (p.keyboardDelegate) {\n return p.keyboardDelegate;\n }\n\n return new GridKeyboardDelegate({\n collection: s.collection,\n disabledKeys: s.disabledKeys,\n ref,\n focusMode: p.focusMode ?? \"row\",\n direction: locale().direction,\n });\n });\n\n // Store metadata for child components\n const storeGridData = () => {\n const s = state();\n const p = props();\n gridMap.set(s, {\n keyboardDelegate: keyboardDelegate(),\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n });\n };\n\n // Update grid data whenever state changes\n createMemo(() => {\n storeGridData();\n });\n\n // Keyboard navigation handler\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const delegate = keyboardDelegate();\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Home\" || e.key === \"End\") {\n const firstKey = delegate.getFirstKey?.();\n if (firstKey != null) {\n e.preventDefault();\n s.setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case \"ArrowDown\":\n nextKey = delegate.getKeyBelow?.(focusedKey) ?? null;\n break;\n case \"ArrowUp\":\n nextKey = delegate.getKeyAbove?.(focusedKey) ?? null;\n break;\n case \"ArrowLeft\":\n nextKey = delegate.getKeyLeftOf?.(focusedKey) ?? null;\n break;\n case \"ArrowRight\":\n nextKey = delegate.getKeyRightOf?.(focusedKey) ?? null;\n break;\n case \"Home\":\n if (e.ctrlKey) {\n nextKey = delegate.getFirstKey?.() ?? null;\n } else {\n // Go to first cell in row - for now just use first key\n nextKey = delegate.getFirstKey?.(focusedKey) ?? null;\n }\n break;\n case \"End\":\n if (e.ctrlKey) {\n nextKey = delegate.getLastKey?.() ?? null;\n } else {\n // Go to last cell in row - for now just use last key\n nextKey = delegate.getLastKey?.(focusedKey) ?? null;\n }\n break;\n case \"PageDown\":\n nextKey = delegate.getKeyPageBelow?.(focusedKey) ?? null;\n break;\n case \"PageUp\":\n nextKey = delegate.getKeyPageAbove?.(focusedKey) ?? null;\n break;\n case \"Escape\":\n if (p.escapeKeyBehavior !== \"none\") {\n s.clearSelection();\n }\n return;\n case \"a\":\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === \"multiple\") {\n s.selectAll();\n }\n }\n return;\n case \" \":\n case \"Enter\":\n e.preventDefault();\n // Toggle selection or trigger action\n if (s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(focusedKey);\n } else {\n s.toggleSelection(focusedKey);\n }\n }\n return;\n default:\n // Type to select\n if (!p.disallowTypeAhead && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n const key = delegate.getKeyForSearch?.(e.key, focusedKey);\n if (key != null) {\n e.preventDefault();\n s.setFocusedKey(key);\n }\n }\n return;\n }\n\n if (nextKey != null) {\n e.preventDefault();\n s.setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(nextKey);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n setIsFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = keyboardDelegate().getFirstKey?.();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the grid entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n setIsFocused(false);\n }\n };\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\"Grid: An aria-label or aria-labelledby prop is required for accessibility.\");\n }\n });\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"grid\",\n id,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? \"true\" : undefined,\n tabIndex: s.collection.size === 0 ? 0 : -1,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n baseProps[\"aria-colcount\"] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n","/**\n * createGridRow - Provides accessibility for a grid row.\n * Based on @react-aria/grid/useGridRow.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { GridState, GridCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { GridRowProps, GridRowAria } from \"./types\";\nimport { getGridData } from \"./createGrid\";\n\n/**\n * Creates accessibility props for a grid row.\n */\nexport function createGridRow<T extends object>(\n props: Accessor<GridRowProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n _ref: Accessor<HTMLElement | null>,\n): GridRowAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.key;\n });\n\n // Handle click/press for selection\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onRowAction = gridData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(p.key);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.key);\n } else {\n // Replace selection\n s.replaceSelection(p.key);\n }\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onRowAction = gridData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== \"none\") {\n s.toggleSelection(p.key);\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n if (p.isVirtualized && p.index != null) {\n baseProps[\"aria-rowindex\"] = p.index + 1; // aria-rowindex is 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createGridCell - Provides accessibility for a grid cell.\n * Based on @react-aria/grid/useGridCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { GridState, GridCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { GridCellProps, GridCellAria } from \"./types\";\nimport { getGridData } from \"./createGrid\";\n\n/**\n * Creates accessibility props for a grid cell.\n */\nexport function createGridCell<T extends object>(\n props: Accessor<GridCellProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n _ref: Accessor<HTMLElement | null>,\n): GridCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is selected\n const node = s.collection.getItem(p.key);\n if (node?.parentKey != null) {\n return s.isSelected(node.parentKey);\n }\n return false;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = s.collection.getItem(p.key);\n if (node?.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.key;\n });\n\n // Handle click/press for cell actions\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onCellAction = gridData?.actions.onCellAction;\n\n // Get parent row key for selection\n const node = s.collection.getItem(p.key);\n const rowKey = node?.parentKey;\n\n // Handle selection on parent row\n if (rowKey != null && s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(rowKey);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(rowKey);\n } else {\n // Replace selection\n s.replaceSelection(rowKey);\n }\n }\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter or Space triggers cell action\n if (e.key === \"Enter\" || e.key === \" \") {\n // Only handle if there's an action to trigger\n const gridData = getGridData(s);\n const onCellAction = gridData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const cellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = s.collection.getItem(p.key);\n\n // Determine the role based on node type\n let role: string = \"gridcell\";\n if (node?.type === \"rowheader\") {\n role = \"rowheader\";\n } else if (node?.type === \"column\") {\n role = \"columnheader\";\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n \"aria-disabled\": isDisabled() || undefined,\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add column index for virtualized grids\n if (p.isVirtualized && node?.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // aria-colindex is 1-based\n }\n\n // Add colspan if present\n if (node?.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n get isFocused() {\n return isFocused();\n },\n };\n}\n","/**\n * createTable - Provides accessibility for a table component.\n * Based on @react-aria/table/useTable.\n */\n\nimport { createMemo, createEffect, on, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection, Key, GridNode } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableProps, TableAria } from \"./types\";\nimport { useLocale } from \"../i18n\";\nimport { announce } from \"../live-announcer\";\n\n// Global map to store table metadata for child components\nconst tableMap = new WeakMap<\n object,\n {\n tableId: string;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n focusMode?: \"row\" | \"cell\";\n }\n>();\n\n/**\n * Get the table metadata for child components.\n */\nexport function getTableData<T>(state: TableState<T, TableCollection<T>>) {\n return tableMap.get(state);\n}\n\n/**\n * Helper to get cells from a row by iterating children\n */\nfunction getChildCells<T>(collection: TableCollection<T>, rowKey: Key): GridNode<T>[] {\n const children = collection.getChildren(rowKey);\n return [...children].filter((node) => node.type === \"cell\" || node.type === \"rowheader\");\n}\n\n/**\n * Helper to get cell at specific index in a row\n */\nfunction getCellAtIndex<T>(\n collection: TableCollection<T>,\n rowKey: Key,\n index: number,\n): GridNode<T> | null {\n const cells = getChildCells(collection, rowKey);\n return cells[index] ?? null;\n}\n\n/**\n * Helper to check if a node is a cell\n */\nfunction isCell<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"cell\" || node?.type === \"rowheader\";\n}\n\n/**\n * Helper to check if a node is a row\n */\nfunction isRow<T>(node: GridNode<T> | null): boolean {\n return node?.type === \"item\";\n}\n\nfunction focusCurrentElement(el: HTMLElement | null | undefined) {\n const target = el?.querySelector<HTMLElement>(\n '[role=\"row\"][tabindex=\"0\"], [role=\"rowheader\"][tabindex=\"0\"], [role=\"gridcell\"][tabindex=\"0\"], [role=\"columnheader\"][tabindex=\"0\"]',\n );\n target?.focus();\n}\n\n/**\n * Creates accessibility props for a table component.\n */\nexport function createTable<T extends object>(\n props: Accessor<AriaTableProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableElement | null>,\n): TableAria {\n const id = createId(props().id);\n const locale = useLocale();\n\n // Track previous sort descriptor for announcements\n let prevSortDescriptor: { column: Key; direction: \"ascending\" | \"descending\" } | null = null;\n let isFirstRender = true;\n let typeaheadBuffer = \"\";\n let typeaheadTimeout: ReturnType<typeof setTimeout> | undefined;\n\n // Store metadata for child components\n const storeTableData = () => {\n const s = state();\n const p = props();\n tableMap.set(s, {\n tableId: id,\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n focusMode: p.focusMode,\n });\n };\n\n // Update table data whenever props/state changes\n createMemo(() => {\n storeTableData();\n });\n\n // Announce sort changes (only after initial render)\n createEffect(\n on(\n () => state().sortDescriptor,\n (sortDescriptor) => {\n if (isFirstRender) {\n isFirstRender = false;\n prevSortDescriptor = sortDescriptor;\n return;\n }\n\n if (\n sortDescriptor &&\n (sortDescriptor.column !== prevSortDescriptor?.column ||\n sortDescriptor.direction !== prevSortDescriptor?.direction)\n ) {\n const collection = state().collection;\n const column = collection.columns.find((c) => c.key === sortDescriptor.column);\n const columnName = column?.textValue ?? String(sortDescriptor.column);\n const directionText =\n sortDescriptor.direction === \"ascending\" ? \"ascending\" : \"descending\";\n\n announce(`Sorted by ${columnName}, ${directionText}`, \"assertive\", 500);\n }\n\n prevSortDescriptor = sortDescriptor;\n },\n ),\n );\n\n // Keyboard navigation handler with full 2D navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const collection = s.collection;\n const p = props();\n const focusMode = p.focusMode ?? \"row\";\n const isRTL = locale().direction === \"rtl\";\n const setFocusedKey = (key: Key) => {\n s.setFocusedKey(key);\n queueMicrotask(() => focusCurrentElement(ref()));\n };\n const runTypeahead = (focusedKey: Key, focusedItem: GridNode<T>) => {\n if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) {\n return false;\n }\n\n typeaheadBuffer += e.key.toLocaleLowerCase();\n if (typeaheadTimeout) {\n clearTimeout(typeaheadTimeout);\n }\n typeaheadTimeout = setTimeout(() => {\n typeaheadBuffer = \"\";\n typeaheadTimeout = undefined;\n }, 500);\n\n const rows = Array.from(collection).filter((node) => !s.isDisabled(node.key));\n if (rows.length === 0) {\n return true;\n }\n\n const currentRowKey =\n isCell(focusedItem) && focusedItem.parentKey != null ? focusedItem.parentKey : focusedKey;\n const currentIndex = rows.findIndex((node) => node.key === currentRowKey);\n const orderedRows =\n currentIndex >= 0\n ? [...rows.slice(currentIndex + 1), ...rows.slice(0, currentIndex + 1)]\n : rows;\n const match = orderedRows.find((node) =>\n collection.getTextValue(node.key).toLocaleLowerCase().startsWith(typeaheadBuffer),\n );\n\n if (match) {\n e.preventDefault();\n setFocusedKey(match.key);\n }\n\n return true;\n };\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Home\" || e.key === \"End\") {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n e.preventDefault();\n setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n const focusedItem = collection.getItem(focusedKey);\n if (!focusedItem) return;\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the next row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const nextRowKey = collection.getKeyAfter(focusedItem.parentKey);\n if (nextRowKey != null) {\n const cellIndex = focusedItem.index;\n const nextCell = getCellAtIndex(collection, nextRowKey, cellIndex);\n nextKey = nextCell?.key ?? nextRowKey;\n }\n } else {\n // Move to next row\n nextKey = collection.getKeyAfter(focusedKey);\n }\n break;\n }\n\n case \"ArrowUp\": {\n e.preventDefault();\n // If focused on a cell, move to the same column in the previous row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const prevRowKey = collection.getKeyBefore(focusedItem.parentKey);\n if (prevRowKey != null) {\n const cellIndex = focusedItem.index;\n const prevCell = getCellAtIndex(collection, prevRowKey, cellIndex);\n nextKey = prevCell?.key ?? prevRowKey;\n }\n } else {\n // Move to previous row\n nextKey = collection.getKeyBefore(focusedKey);\n }\n break;\n }\n\n case \"ArrowRight\": {\n e.preventDefault();\n const goNext = !isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the first/last cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the next/prev cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"ArrowLeft\": {\n e.preventDefault();\n const goNext = isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the last/first cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the prev/next cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === \"row\") {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case \"Home\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+Home: Go to first row/cell\n const firstRowKey = collection.getFirstKey();\n if (firstRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, firstRowKey);\n nextKey = cells[0]?.key ?? firstRowKey;\n } else {\n nextKey = firstRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // Home: Go to first cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[0]?.key ?? null;\n } else {\n // On row: go to first row\n nextKey = collection.getFirstKey();\n }\n break;\n }\n\n case \"End\": {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+End: Go to last row/cell\n const lastRowKey = collection.getLastKey();\n if (lastRowKey != null) {\n if (isCell(focusedItem) || focusMode === \"cell\") {\n const cells = getChildCells(collection, lastRowKey);\n nextKey = cells[cells.length - 1]?.key ?? lastRowKey;\n } else {\n nextKey = lastRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // End: Go to last cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[cells.length - 1]?.key ?? null;\n } else {\n // On row: go to last row\n nextKey = collection.getLastKey();\n }\n break;\n }\n\n case \"PageDown\": {\n e.preventDefault();\n // Move down by roughly a page (using DOM measurements if available)\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move down until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const next = collection.getKeyAfter(currentKey);\n if (next == null) break;\n\n // Estimate row height (default to 40px if we can't measure)\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = next;\n }\n\n if (currentKey != null) {\n // If we started on a cell, focus the same column in the new row\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const next = collection.getKeyAfter(current);\n if (next == null) break;\n current = next;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"PageUp\": {\n e.preventDefault();\n // Move up by roughly a page\n const el = ref();\n if (el && el.clientHeight > 0) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move up until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const prev = collection.getKeyBefore(currentKey);\n if (prev == null) break;\n\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = prev;\n }\n\n if (currentKey != null) {\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const prev = collection.getKeyBefore(current);\n if (prev == null) break;\n current = prev;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case \"Escape\":\n if (p.escapeKeyBehavior !== \"none\") {\n s.clearSelection();\n }\n return;\n\n case \"a\":\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === \"multiple\") {\n s.selectAll();\n }\n }\n return;\n\n case \" \":\n case \"Enter\":\n e.preventDefault();\n // Toggle selection or trigger action\n if (s.selectionMode !== \"none\") {\n // For cells, select the parent row\n const keyToSelect =\n isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(keyToSelect);\n } else {\n s.toggleSelection(keyToSelect);\n }\n }\n return;\n\n default:\n if (runTypeahead(focusedKey, focusedItem)) {\n return;\n }\n return;\n }\n\n if (nextKey != null) {\n setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n // For cells, select the parent row\n const focusedNode = collection.getItem(nextKey);\n const keyToSelect =\n focusedNode && isCell(focusedNode) && focusedNode.parentKey != null\n ? focusedNode.parentKey\n : nextKey;\n s.extendSelection(keyToSelect);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the table entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n }\n };\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p[\"aria-label\"] && !p[\"aria-labelledby\"]) {\n console.warn(\"Table: An aria-label or aria-labelledby prop is required for accessibility.\");\n }\n });\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"grid\",\n id,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? \"true\" : undefined,\n // Keep the grid itself tabbable so keyboard users can enter\n // row/cell navigation without requiring a prior pointer interaction.\n tabIndex: 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n baseProps[\"aria-colcount\"] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n","/**\n * createTableHeaderRow - Provides accessibility for a table header row.\n * Based on @react-aria/table/useTableHeaderRow.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableHeaderRowProps, TableHeaderRowAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table header row.\n */\nexport function createTableHeaderRow<T extends object>(\n props: Accessor<AriaTableHeaderRowProps>,\n _state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>,\n): TableHeaderRowAria {\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n };\n}\n","/**\n * createTableColumnHeader - Provides accessibility for a table column header.\n * Based on @react-aria/table/useTableColumnHeader.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableColumnHeaderProps, TableColumnHeaderAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * Creates accessibility props for a table column header.\n */\nexport function createTableColumnHeader<T extends object>(\n props: Accessor<AriaTableColumnHeaderProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableColumnHeaderAria {\n const [isPressed, setIsPressed] = createSignal(false);\n let ignoreNextClick = false;\n let ignoreNextClickTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n const sortColumn = () => {\n const s = state();\n const p = props();\n\n if (p.allowsSorting) {\n s.sort(p.node.key);\n }\n };\n\n const clearPendingClickIgnore = () => {\n if (ignoreNextClickTimeout != null) {\n clearTimeout(ignoreNextClickTimeout);\n ignoreNextClickTimeout = undefined;\n }\n };\n\n const ignorePointerGeneratedClick = () => {\n clearPendingClickIgnore();\n ignoreNextClick = true;\n ignoreNextClickTimeout = setTimeout(() => {\n ignoreNextClick = false;\n ignoreNextClickTimeout = undefined;\n }, 0);\n };\n\n // Handle click for sorting. Pointer activation is handled on pointerup because\n // focusing the table header can re-render its child content before a native\n // click is dispatched.\n const onClick = () => {\n if (ignoreNextClick) {\n ignoreNextClick = false;\n clearPendingClickIgnore();\n return;\n }\n\n sortColumn();\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const p = props();\n\n if (\n p.allowsSorting &&\n (e.key === \"Enter\" || e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\")\n ) {\n e.preventDefault();\n sortColumn();\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (e.button !== 0) {\n return;\n }\n\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n if (isPressed()) {\n ignorePointerGeneratedClick();\n sortColumn();\n }\n\n setIsPressed(false);\n };\n\n const onPointerCancel = () => {\n setIsPressed(false);\n };\n\n const columnHeaderProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine sort state\n let ariaSort: \"none\" | \"ascending\" | \"descending\" | undefined = undefined;\n if (p.allowsSorting) {\n const sortDescriptor = s.sortDescriptor;\n if (sortDescriptor?.column === node.key) {\n ariaSort = sortDescriptor.direction;\n } else {\n ariaSort = \"none\";\n }\n }\n\n const baseProps: Record<string, unknown> = {\n role: \"columnheader\",\n id: tableData ? `${tableData.tableId}-${node.key}` : undefined,\n \"aria-sort\": ariaSort,\n tabIndex: isFocused() ? 0 : -1,\n onFocus,\n };\n\n // Add click handler if sortable\n if (p.allowsSorting) {\n baseProps.onClick = onClick;\n baseProps.onKeyDown = onKeyDown;\n baseProps.onPointerDown = onPointerDown;\n baseProps.onPointerUp = onPointerUp;\n baseProps.onPointerCancel = onPointerCancel;\n baseProps.onPointerLeave = onPointerCancel;\n baseProps.style = { cursor: \"pointer\" };\n }\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get columnHeaderProps() {\n return columnHeaderProps();\n },\n };\n}\n","/**\n * createTableRow - Provides accessibility for a table row.\n * Based on @react-aria/table/useTableRow.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { Key, TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableRowProps, TableRowAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * Creates accessibility props for a table row.\n */\nexport function createTableRow<T extends object>(\n props: Accessor<AriaTableRowProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>,\n): TableRowAria {\n const [isPressed, setIsPressed] = createSignal(false);\n let didSelectOnPointer = false;\n let didActionOnPointer = false;\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return !!p.isDisabled || s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n const isInteractive = () => {\n const s = state();\n const p = props();\n const tableData = getTableData(s);\n return (\n s.selectionMode !== \"none\" || !!tableData?.actions.onRowAction || !!p.onAction || !!p.href\n );\n };\n\n const selectRow = (e: MouseEvent | PointerEvent | KeyboardEvent, forceReplace = false) => {\n const s = state();\n const p = props();\n\n if (s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(p.node.key);\n } else if (!forceReplace && (e.ctrlKey || e.metaKey || s.selectionBehavior === \"toggle\")) {\n s.toggleSelection(p.node.key);\n } else if (!forceReplace && s.selectionMode === \"single\" && s.isSelected(p.node.key)) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection\n s.replaceSelection(p.node.key);\n }\n }\n };\n\n const activateLink = (e: MouseEvent | KeyboardEvent) => {\n props().onLinkAction?.(e);\n };\n\n const runRowAction = (p: AriaTableRowProps, onRowAction: ((key: Key) => void) | undefined) => {\n if (onRowAction) {\n onRowAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const isFromInteractiveElement = (e: Event) => {\n const target = e.target;\n if (!(target instanceof Element)) return false;\n return !!target.closest(\n 'a[href],button,input,select,textarea,[role=\"button\"],[role=\"checkbox\"],[role=\"link\"]',\n );\n };\n\n // Handle click/press for selection\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n\n if (isFromInteractiveElement(e)) {\n didSelectOnPointer = false;\n didActionOnPointer = false;\n return;\n }\n\n if (p.href) {\n if (s.selectionBehavior === \"replace\" && s.selectionMode !== \"none\") {\n if (!didSelectOnPointer) {\n selectRow(e, true);\n }\n } else if (!didActionOnPointer) {\n activateLink(e);\n }\n didSelectOnPointer = false;\n didActionOnPointer = false;\n return;\n }\n\n if (!didSelectOnPointer) {\n selectRow(e);\n }\n didSelectOnPointer = false;\n\n if (!didActionOnPointer) {\n runRowAction(p, onRowAction);\n }\n didActionOnPointer = false;\n };\n\n const onDblClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled() || !p.href || s.selectionBehavior !== \"replace\") return;\n\n activateLink(e);\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === \"Enter\") {\n e.preventDefault();\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n\n if (p.href) {\n activateLink(e);\n return;\n }\n\n // Handle selection\n if (s.selectionMode !== \"none\") {\n selectRow(e);\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n\n if (e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\") {\n e.preventDefault();\n\n if (p.href && s.selectionMode !== \"none\") {\n selectRow(e, s.selectionBehavior === \"replace\");\n return;\n }\n\n if (p.href) {\n activateLink(e);\n return;\n }\n\n if (s.selectionMode !== \"none\") {\n selectRow(e);\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = (e: PointerEvent) => {\n if (isInteractive() && !isDisabled()) {\n setIsPressed(true);\n }\n const s = state();\n const tableData = getTableData(s);\n if (s.selectionMode !== \"none\" && !tableData?.shouldSelectOnPressUp && !isDisabled()) {\n selectRow(e);\n didSelectOnPointer = true;\n }\n };\n\n const onPointerUp = (e: PointerEvent) => {\n const s = state();\n const p = props();\n const tableData = getTableData(s);\n if (s.selectionMode !== \"none\" && tableData?.shouldSelectOnPressUp && !isDisabled()) {\n selectRow(e);\n didSelectOnPointer = true;\n }\n if (\n s.selectionMode === \"none\" &&\n tableData?.shouldSelectOnPressUp &&\n !isDisabled() &&\n !isFromInteractiveElement(e)\n ) {\n if (p.href) {\n activateLink(e);\n } else {\n runRowAction(p, tableData?.actions.onRowAction);\n }\n didActionOnPointer = true;\n }\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onDblClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createTableCell - Provides accessibility for a table cell.\n * Based on @react-aria/table/useTableCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableCellProps, TableCellAria } from \"./types\";\nimport { getTableData } from \"./createTable\";\n\n/**\n * Creates accessibility props for a table cell.\n */\nexport function createTableCell<T extends object>(\n props: Accessor<AriaTableCellProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>,\n): TableCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = p.node;\n if (node.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click for cell actions\n const onClick = () => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter triggers cell action\n if (e.key === \"Enter\") {\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const gridCellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine the role based on node type\n let role: string = \"gridcell\";\n if (node.type === \"rowheader\") {\n role = \"rowheader\";\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n id:\n tableData && node.parentKey != null\n ? `${tableData.tableId}-${node.parentKey}-${node.key}`\n : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps[\"aria-colindex\"] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps[\"aria-colspan\"] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get gridCellProps() {\n return gridCellProps();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createTableRowGroup - Provides accessibility for a table row group.\n * Based on @react-aria/grid/useTableRowGroup.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { AriaTableRowGroupProps, TableRowGroupAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table row group (thead, tbody, tfoot).\n */\nexport function createTableRowGroup(props: Accessor<AriaTableRowGroupProps>): TableRowGroupAria {\n const rowGroupProps = createMemo(() => {\n // Access props for reactivity tracking, even though not currently used\n void props();\n\n const baseProps: Record<string, unknown> = {\n role: \"rowgroup\",\n };\n\n return baseProps as JSX.HTMLAttributes<HTMLTableSectionElement>;\n });\n\n return {\n get rowGroupProps() {\n return rowGroupProps();\n },\n };\n}\n","/**\n * createTableSelectionCheckbox - Provides accessibility for a table row selection checkbox.\n * Based on @react-aria/table/useTableSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table row selection checkbox.\n */\nexport function createTableSelectionCheckbox<T extends object>(\n props: Accessor<AriaTableSelectionCheckboxProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: \"checkbox\",\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": \"Select\",\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * createTableSelectAllCheckbox - Provides accessibility for a table select-all checkbox.\n * Based on @react-aria/table/useTableSelectAllCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TableState, TableCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { TableSelectAllCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a table select-all checkbox.\n */\nexport function createTableSelectAllCheckbox<T extends object>(\n state: Accessor<TableState<T, TableCollection<T>>>,\n): TableSelectAllCheckboxAria {\n const isSelectAll = createMemo(() => {\n const s = state();\n return s.selectedKeys === \"all\";\n });\n\n const isEmpty = createMemo(() => {\n const s = state();\n return s.collection.size === 0;\n });\n\n const isIndeterminate = createMemo(() => {\n const s = state();\n const selectedKeys = s.selectedKeys;\n if (selectedKeys === \"all\") return false;\n if (selectedKeys.size === 0) return false;\n return selectedKeys.size < s.collection.size;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n return s.selectionMode !== \"multiple\" || isEmpty();\n });\n\n const onChange = () => {\n const s = state();\n if (!isDisabled()) {\n s.toggleSelectAll();\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n checked: isSelectAll(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": s.selectionMode === \"single\" ? \"Select\" : \"Select All\",\n };\n\n // Handle indeterminate state\n // Note: indeterminate is not a standard HTML attribute, it must be set via JavaScript\n // The component using this should handle this separately\n if (isIndeterminate()) {\n baseProps[\"data-indeterminate\"] = \"true\";\n baseProps[\"aria-checked\"] = \"mixed\";\n }\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * ARIA hook for table column resize interactions.\n * Based on @react-aria/table/useTableColumnResize.\n *\n * Provides pointer-drag and keyboard-based column resizing with\n * correct ARIA attributes for screen readers.\n */\n\nimport { createSignal, createMemo, type Accessor, type JSX } from \"solid-js\";\nimport type { Key, TableColumnResizeState } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\n\nexport interface CreateTableColumnResizeProps {\n /** The column being resized. */\n column: { key: Key };\n /** Accessible label for the resizer. */\n \"aria-label\": string;\n /** Whether resizing is disabled. */\n isDisabled?: boolean;\n /** Called when a resize operation starts. */\n onResizeStart?: (widths: Map<Key, number>) => void;\n /** Called during resize with updated widths. */\n onResize?: (widths: Map<Key, number>) => void;\n /** Called when resize operation ends. */\n onResizeEnd?: (widths: Map<Key, number>) => void;\n}\n\nexport interface TableColumnResizeResult {\n /** Props for the visible resizer handle element (div). */\n resizerProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the hidden range input (screen reader accessible). */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether this column is currently being resized. */\n isResizing: Accessor<boolean>;\n}\n\nconst KEYBOARD_STEP = 10; // px per arrow key press\n\n/**\n * Creates ARIA-compliant column resize behavior.\n *\n * Returns props for a visible drag handle (div) and a visually-hidden\n * range input that allows keyboard and screen-reader users to resize columns.\n */\nexport function createTableColumnResize(\n props: Accessor<CreateTableColumnResizeProps>,\n state: Accessor<TableColumnResizeState>,\n): TableColumnResizeResult {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n\n const [isPointerDragging, setIsPointerDragging] = createSignal(false);\n const [isKeyboardResizing, setIsKeyboardResizing] = createSignal(false);\n\n const isResizing = createMemo(() => getState().resizingColumn() === getProps().column.key);\n\n const isRtl = createMemo(() => {\n const l = locale();\n return l?.direction === \"rtl\";\n });\n\n // ---- Pointer (mouse/touch) drag ----\n\n let startX = 0;\n let startWidth = 0;\n\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled) return;\n e.preventDefault();\n e.stopPropagation();\n\n const key = getProps().column.key;\n startX = e.clientX;\n startWidth = getState().getColumnWidth(key);\n\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n setIsPointerDragging(true);\n\n const target = e.currentTarget as HTMLElement;\n target.setPointerCapture(e.pointerId);\n };\n\n const onPointerMove = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n\n const deltaX = e.clientX - startX;\n const direction = isRtl() ? -1 : 1;\n const newWidth = startWidth + deltaX * direction;\n\n const key = getProps().column.key;\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (!isPointerDragging()) return;\n e.preventDefault();\n setIsPointerDragging(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // ---- Keyboard resize (on the hidden input) ----\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled) return;\n\n const key = getProps().column.key;\n const rtlMul = isRtl() ? -1 : 1;\n\n switch (e.key) {\n case \"Enter\": {\n if (isKeyboardResizing()) {\n // End resize\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n } else {\n // Start resize\n setIsKeyboardResizing(true);\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n e.preventDefault();\n break;\n }\n case \"Escape\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n e.preventDefault();\n }\n break;\n }\n case \"Tab\": {\n if (isKeyboardResizing()) {\n setIsKeyboardResizing(false);\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n }\n // Let Tab propagate for focus management\n break;\n }\n case \"ArrowRight\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth + KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n case \"ArrowLeft\": {\n if (isKeyboardResizing()) {\n const currentWidth = getState().getColumnWidth(key);\n const widths = getState().updateResizedColumns(\n key,\n currentWidth - KEYBOARD_STEP * rtlMul,\n );\n getProps().onResize?.(widths);\n e.preventDefault();\n }\n break;\n }\n }\n };\n\n // Handle input change (from screen reader range slider)\n const onInputChange = (e: Event) => {\n const input = e.target as HTMLInputElement;\n const newWidth = parseFloat(input.value);\n if (isNaN(newWidth)) return;\n\n const key = getProps().column.key;\n if (!isResizing()) {\n getState().startResize(key);\n getProps().onResizeStart?.(getState().columnWidths());\n }\n\n const widths = getState().updateResizedColumns(key, newWidth);\n getProps().onResize?.(widths);\n\n // End immediately for discrete input changes\n getState().endResize();\n getProps().onResizeEnd?.(getState().columnWidths());\n };\n\n // Visible resize handle props. The accessible resize control is the hidden\n // range input below, matching React Aria's ColumnResizer structure.\n const resizerProps: JSX.HTMLAttributes<HTMLDivElement> = {\n role: \"presentation\",\n tabIndex: -1,\n style: {\n \"touch-action\": \"none\",\n cursor: \"col-resize\",\n },\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n // Visually hidden range input props\n const inputProps: JSX.InputHTMLAttributes<HTMLInputElement> = {\n get type() {\n return \"range\";\n },\n get tabIndex() {\n return getProps().isDisabled ? -1 : 0;\n },\n get disabled() {\n return getProps().isDisabled;\n },\n get \"aria-label\"() {\n return getProps()[\"aria-label\"];\n },\n get \"aria-orientation\"() {\n return \"horizontal\" as const;\n },\n get min() {\n return getState().getColumnMinWidth(getProps().column.key);\n },\n get max() {\n const maxW = getState().getColumnMaxWidth(getProps().column.key);\n return maxW === Infinity ? 9999 : maxW;\n },\n get value() {\n return getState().getColumnWidth(getProps().column.key);\n },\n style: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n \"border-width\": \"0\",\n },\n onKeyDown,\n onChange: onInputChange,\n };\n\n return {\n resizerProps,\n inputProps,\n isResizing,\n };\n}\n","/**\n * createGridList - Provides accessibility for a grid list.\n * Based on @react-aria/gridlist/useGridList.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { GridState, GridCollection, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaGridListProps, GridListAria } from \"./types\";\n\n/**\n * Metadata stored for a grid list instance.\n */\ninterface GridListData {\n /** The generated ID for the grid list. */\n gridListId: string;\n /** How selection should behave when pressing an item. */\n selectionBehavior: \"replace\" | \"toggle\";\n /** Actions registered for the grid list. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store grid list data for child components to access.\n */\nconst gridListDataMap = new WeakMap<object, GridListData>();\n\n/**\n * Gets the grid list data for a given state.\n */\nexport function getGridListData<T extends object, C extends GridCollection<T>>(\n state: GridState<T, C>,\n): GridListData | undefined {\n return gridListDataMap.get(state);\n}\n\n/**\n * Creates accessibility props for a grid list.\n */\nexport function createGridList<T extends object, C extends GridCollection<T> = GridCollection<T>>(\n props: Accessor<AriaGridListProps>,\n state: Accessor<GridState<T, C>>,\n _ref: Accessor<HTMLElement | null>,\n): GridListAria {\n // Generate a unique ID for the grid list\n const gridListId = props().id ?? createId();\n\n // Store grid list data for child components\n const gridListData: GridListData = {\n gridListId,\n get selectionBehavior() {\n return props().selectionBehavior ?? \"replace\";\n },\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n gridListDataMap.set(state(), gridListData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n if (focusedKey != null) {\n const nextKey = collection.getKeyAfter(focusedKey);\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n } else {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n if (focusedKey != null) {\n const prevKey = collection.getKeyBefore(focusedKey);\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n } else {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case \"a\":\n case \"A\": {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === \"multiple\") {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n case \" \":\n case \"Space\":\n case \"Spacebar\": {\n if (focusedKey != null && s.selectionMode !== \"none\" && !s.isDisabled(focusedKey)) {\n e.preventDefault();\n s.toggleSelection(focusedKey);\n }\n break;\n }\n case \"Enter\": {\n if (focusedKey != null && !s.isDisabled(focusedKey)) {\n e.preventDefault();\n p.onAction?.(focusedKey);\n }\n break;\n }\n case \"Escape\": {\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n s.setFocused(true);\n\n // If nothing is focused, focus the first item\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n };\n\n const onBlur = () => {\n const s = state();\n s.setFocused(false);\n };\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"grid\",\n id: gridListId,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? true : undefined,\n \"aria-disabled\": p.isDisabled || undefined,\n tabIndex: p.isDisabled ? undefined : 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n // Add row count for virtualized lists\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n","/**\n * createGridListItem - Provides accessibility for a grid list item.\n * Based on @react-aria/gridlist/useGridListItem.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { GridState, GridCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaGridListItemProps, GridListItemAria } from \"./types\";\nimport { getGridListData } from \"./createGridList\";\n\n/**\n * Creates accessibility props for a grid list item.\n */\nexport function createGridListItem<\n T extends object,\n C extends GridCollection<T> = GridCollection<T>,\n>(\n props: Accessor<AriaGridListItemProps>,\n state: Accessor<GridState<T, C>>,\n _ref: Accessor<HTMLElement | null>,\n): GridListItemAria {\n const [isPressed, setIsPressed] = createSignal(false);\n let isPointerPressed = false;\n let ignoreNextClick = false;\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n const handleActivation = (e: MouseEvent | PointerEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid list metadata for actions\n const gridListData = getGridListData(s);\n const onAction = gridListData?.actions.onAction;\n\n // Handle selection\n if (s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(p.node.key);\n } else if (p.selectionBehavior === \"toggle\" || e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection or toggle if already selected\n if (isSelected() && s.selectedKeys !== \"all\") {\n const selectedKeys = s.selectedKeys as Set<unknown>;\n if (selectedKeys.size === 1) {\n // Single selection, trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n }\n } else {\n // No selection mode, just trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n // Handle click/press for selection and actions.\n const onClick = (e: MouseEvent) => {\n if (ignoreNextClick) {\n ignoreNextClick = false;\n return;\n }\n\n handleActivation(e);\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === \"Enter\") {\n // Get grid list metadata for actions\n const gridListData = getGridListData(s);\n const onAction = gridListData?.actions.onAction;\n\n if (onAction || p.onAction) {\n e.preventDefault();\n\n if (onAction) {\n onAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n } else if (e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\") {\n // Space toggles selection\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.toggleSelection(p.node.key);\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n if (isDisabled()) return;\n isPointerPressed = true;\n setIsPressed(true);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n const wasPointerPressed = isPointerPressed;\n isPointerPressed = false;\n setIsPressed(false);\n\n if (!wasPointerPressed || isDisabled()) return;\n\n const currentTarget = e.currentTarget;\n const target = e.target;\n if (\n currentTarget instanceof HTMLElement &&\n target instanceof Node &&\n !currentTarget.contains(target)\n ) {\n return;\n }\n\n ignoreNextClick = true;\n handleActivation(e);\n };\n\n const onPointerCancel = () => {\n isPointerPressed = false;\n setIsPressed(false);\n };\n\n const onPointerLeave = () => {\n isPointerPressed = false;\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n onPointerCancel,\n onPointerLeave,\n };\n\n // Add aria-rowindex for virtualized lists\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: \"gridcell\",\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n","/**\n * createGridListSelectionCheckbox - Provides accessibility for a grid list item selection checkbox.\n * Based on @react-aria/gridlist.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { GridState, GridCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaGridListSelectionCheckboxProps, GridListSelectionCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a grid list item selection checkbox.\n */\nexport function createGridListSelectionCheckbox<\n T extends object,\n C extends GridCollection<T> = GridCollection<T>,\n>(\n props: Accessor<AriaGridListSelectionCheckboxProps>,\n state: Accessor<GridState<T, C>>,\n): GridListSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: \"checkbox\",\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n \"aria-label\": \"Select\",\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * createTree - Provides accessibility for a tree component.\n * Based on @react-aria/tree/useTree.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection, Key } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeProps, TreeAria } from \"./types\";\n\n/**\n * Metadata stored for a tree instance.\n */\ninterface TreeData {\n /** The generated ID for the tree. */\n treeId: string;\n /** Actions registered for the tree. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store tree data for child components to access.\n */\nconst treeDataMap = new WeakMap<object, TreeData>();\n\n/**\n * Gets the tree data for a given state.\n */\nexport function getTreeData<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>,\n): TreeData | undefined {\n return treeDataMap.get(state);\n}\n\n/**\n * Creates accessibility props for a tree.\n */\nexport function createTree<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeProps>,\n state: Accessor<TreeState<T, C>>,\n _ref: Accessor<HTMLDivElement | null>,\n): TreeAria {\n // Generate a unique ID for the tree\n const treeId = props().id ?? createId();\n\n // Store tree data for child components\n const treeData: TreeData = {\n treeId,\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n treeDataMap.set(state(), treeData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n const direction = p.direction ?? \"ltr\";\n // In RTL, ArrowLeft expands and ArrowRight collapses (opposite of LTR)\n const expandKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const collapseKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n if (focusedKey != null) {\n const nextKey = collection.getKeyAfter(focusedKey);\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n } else {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n if (focusedKey != null) {\n const prevKey = collection.getKeyBefore(focusedKey);\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n } else {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n }\n break;\n }\n case \"ArrowRight\":\n case \"ArrowLeft\": {\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (e.key === expandKey) {\n // Expand or move to first child\n if (node?.isExpandable) {\n if (!s.isExpanded(focusedKey)) {\n s.expandKey(focusedKey);\n } else {\n const children = [...collection.getChildren(focusedKey)];\n if (children.length > 0) {\n s.setFocusedKey(children[0].key);\n }\n }\n }\n } else if (e.key === collapseKey) {\n // Collapse or move to parent\n if (node?.isExpandable && s.isExpanded(focusedKey)) {\n s.collapseKey(focusedKey);\n } else if (node?.parentKey != null) {\n s.setFocusedKey(node.parentKey);\n }\n }\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case \"End\": {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case \"a\":\n case \"A\": {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === \"multiple\") {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n case \" \":\n case \"Space\":\n case \"Spacebar\": {\n if (focusedKey != null && s.selectionMode !== \"none\" && !s.isDisabled(focusedKey)) {\n e.preventDefault();\n s.toggleSelection(focusedKey);\n }\n break;\n }\n case \"Enter\": {\n if (focusedKey != null && !s.isDisabled(focusedKey)) {\n e.preventDefault();\n p.onAction?.(focusedKey);\n }\n break;\n }\n case \"Escape\": {\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n case \"*\": {\n // Expand all siblings at current level\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node) {\n // Find all siblings at the same level\n const parentKey = node.parentKey;\n let siblings: Key[];\n if (parentKey != null) {\n siblings = [...collection.getChildren(parentKey)].map((n) => n.key);\n } else {\n // Root level siblings\n siblings = collection.rows.filter((n) => n.level === 0).map((n) => n.key);\n }\n // Expand all expandable siblings\n for (const siblingKey of siblings) {\n const sibling = collection.getItem(siblingKey);\n if (sibling?.isExpandable && !s.isExpanded(siblingKey)) {\n s.expandKey(siblingKey);\n }\n }\n }\n }\n break;\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n s.setFocused(true);\n\n // If nothing is focused, focus the first item\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n };\n\n const onBlur = () => {\n const s = state();\n s.setFocused(false);\n };\n\n const treeProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: \"treegrid\",\n id: treeId,\n \"aria-label\": p[\"aria-label\"],\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-multiselectable\": s.selectionMode === \"multiple\" ? true : undefined,\n \"aria-disabled\": p.isDisabled || undefined,\n tabIndex: p.isDisabled ? undefined : 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n // Add row count for virtualized trees\n if (p.isVirtualized) {\n baseProps[\"aria-rowcount\"] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get treeProps() {\n return treeProps();\n },\n };\n}\n","/**\n * createTreeItem - Provides accessibility for a tree item.\n * Based on @react-aria/tree/useTreeItem.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport { createId } from \"@proyecto-viviana/solid-stately\";\nimport type { TreeState, TreeCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeItemProps, TreeItemAria } from \"./types\";\nimport { getTreeData } from \"./createTree\";\n\n/**\n * Creates accessibility props for a tree item.\n */\nexport function createTreeItem<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeItemProps<T>>,\n state: Accessor<TreeState<T, C>>,\n _ref: Accessor<HTMLElement | null>,\n): TreeItemAria {\n const [isPressed, setIsPressed] = createSignal(false);\n const rowId = createId();\n const expandButtonId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return p.isDisabled === true || s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n const isExpanded = createMemo(() => {\n const s = state();\n const p = props();\n return s.isExpanded(p.node.key);\n });\n\n const isExpandable = createMemo(() => {\n const p = props();\n return p.node.isExpandable ?? false;\n });\n\n const level = createMemo(() => {\n const p = props();\n return p.node.level;\n });\n\n // Handle click/press for selection and actions\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get tree metadata for actions\n const treeData = getTreeData(s);\n const onAction = treeData?.actions.onAction;\n\n // Handle selection\n if (s.selectionMode !== \"none\") {\n if (e.shiftKey && s.selectionMode === \"multiple\") {\n s.extendSelection(p.node.key);\n } else if (p.selectionBehavior === \"toggle\" || e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection or toggle if already selected\n if (isSelected() && s.selectedKeys !== \"all\") {\n const selectedKeys = s.selectedKeys as Set<unknown>;\n if (selectedKeys.size === 1) {\n // Single selection, trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n }\n } else {\n // No selection mode, just trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === \"Enter\") {\n // Get tree metadata for actions\n const treeData = getTreeData(s);\n const onAction = treeData?.actions.onAction;\n\n if (onAction || p.onAction) {\n e.preventDefault();\n\n if (onAction) {\n onAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n } else if (e.key === \" \" || e.key === \"Space\" || e.key === \"Spacebar\") {\n // Space toggles selection\n if (s.selectionMode !== \"none\") {\n e.preventDefault();\n s.toggleSelection(p.node.key);\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n // Compute sibling position (aria-posinset/aria-setsize)\n const siblingInfo = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const parentKey = node.parentKey;\n\n if (parentKey != null) {\n const parentNode = s.collection.getItem(parentKey);\n if (parentNode) {\n return {\n posinset: node.index + 1, // 1-based\n setsize: parentNode.childNodes.length,\n };\n }\n }\n\n // Root-level: count root nodes\n const rootNodes = s.collection.rows.filter((n) => n.level === 0);\n const rootIndex = rootNodes.findIndex((n) => n.key === node.key);\n return {\n posinset: rootIndex >= 0 ? rootIndex + 1 : node.index + 1,\n setsize: rootNodes.length,\n };\n });\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const { posinset, setsize } = siblingInfo();\n\n // Use textValue for aria-label (if available), or explicit textValue prop\n const textValue = p.textValue ?? node.textValue;\n\n const baseProps: Record<string, unknown> = {\n role: \"row\",\n id: rowId,\n \"aria-label\": textValue || undefined,\n \"aria-selected\": s.selectionMode !== \"none\" ? isSelected() : undefined,\n \"aria-disabled\": isDisabled() || undefined,\n \"aria-expanded\": isExpandable() ? isExpanded() : undefined,\n \"aria-level\": node.level + 1, // 1-based for ARIA\n \"aria-posinset\": posinset,\n \"aria-setsize\": setsize,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-rowindex for virtualized trees\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps[\"aria-rowindex\"] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: \"gridcell\",\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n // Expand button handler\n const onExpandClick = (e: MouseEvent) => {\n e.stopPropagation(); // Don't trigger row click\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n s.toggleKey(p.node.key);\n };\n\n const stopPointerPropagation = (e: Event) => {\n // Prevent row pointer handlers from flipping pressed state and re-rendering\n // before the button click handler can run.\n e.stopPropagation();\n };\n\n const expandButtonProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"button\",\n id: expandButtonId,\n \"aria-label\": isExpanded() ? \"Collapse\" : \"Expand\",\n \"aria-labelledby\": isExpandable() ? `${expandButtonId} ${rowId}` : undefined,\n onClick: onExpandClick,\n onPointerDown: stopPointerPropagation,\n onPointerUp: stopPointerPropagation,\n onMouseDown: stopPointerPropagation,\n onMouseUp: stopPointerPropagation,\n tabIndex: -1, // Not in tab order, use arrow keys\n \"aria-hidden\": !isExpandable() ? true : undefined,\n };\n\n return baseProps as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get isExpandable() {\n return isExpandable();\n },\n get level() {\n return level();\n },\n };\n}\n","/**\n * createTreeSelectionCheckbox - Provides accessibility for a tree item's selection checkbox.\n * Based on @react-aria/gridlist/useGridListSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type { TreeState, TreeCollection } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaTreeSelectionCheckboxProps, TreeSelectionCheckboxAria } from \"./types\";\n\n/**\n * Creates accessibility props for a tree selection checkbox.\n */\nexport function createTreeSelectionCheckbox<\n T extends object,\n C extends TreeCollection<T> = TreeCollection<T>,\n>(\n props: Accessor<AriaTreeSelectionCheckboxProps>,\n state: Accessor<TreeState<T, C>>,\n): TreeSelectionCheckboxAria {\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = (e: Event) => {\n const s = state();\n const p = props();\n const target = e.target as HTMLInputElement;\n\n if (isDisabled()) return;\n\n if (target.checked) {\n s.toggleSelection(p.key);\n } else {\n s.toggleSelection(p.key);\n }\n };\n\n const onClick = (e: MouseEvent) => {\n // Stop propagation to prevent row click from also firing\n e.stopPropagation();\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: \"checkbox\",\n \"aria-label\": \"Select\",\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n onClick,\n tabIndex: -1, // Use arrow keys to navigate, not tab\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n","/**\n * createColorSlider hook.\n *\n * Provides ARIA attributes and keyboard handling for a color slider.\n */\n\nimport { createMemo, onCleanup, type Accessor } from \"solid-js\";\nimport type { ColorSliderState } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\nimport { createId } from \"../ssr\";\nimport { focusWithoutScrolling } from \"../utils/focus\";\nimport type { AriaColorSliderOptions, ColorSliderAria } from \"./types\";\n\n/**\n * Creates ARIA props for a color slider.\n */\nexport function createColorSlider(\n props: Accessor<AriaColorSliderOptions>,\n state: Accessor<ColorSliderState>,\n trackRef: Accessor<HTMLDivElement | null>,\n inputRef?: Accessor<HTMLInputElement | null>,\n): ColorSliderAria {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n const isRTL = () => locale().direction === \"rtl\";\n\n // Generate IDs\n const trackId = createId();\n const inputId = createId();\n const labelId = createId();\n let cleanupPointerDrag: (() => void) | undefined;\n let cleanupMouseDrag: (() => void) | undefined;\n\n const getInput = () =>\n inputRef?.() ?? trackRef()?.querySelector<HTMLInputElement>('input[type=\"range\"]') ?? null;\n const focusInput = () => {\n focusWithoutScrolling(getInput());\n queueMicrotask(() => focusWithoutScrolling(getInput()));\n };\n\n // Get channel name for ARIA label\n const channelName = createMemo(() => {\n const p = getProps();\n if (p.channelName) return p.channelName;\n const s = getState();\n return s.value.getChannelName(s.channel, \"en-US\");\n });\n\n const orientation = () => getProps().orientation ?? \"horizontal\";\n const hasVisibleLabel = () => getProps().label != null;\n const trackElementId = () => getProps().id ?? trackId;\n const trackLabelledBy = () => {\n const p = getProps();\n return p[\"aria-labelledby\"] ?? (hasVisibleLabel() ? labelId : undefined);\n };\n const inputLabelledBy = () => (hasVisibleLabel() ? labelId : trackElementId());\n const trackAriaLabel = () => {\n const p = getProps();\n if (p[\"aria-label\"]) return p[\"aria-label\"];\n if (p[\"aria-labelledby\"] || hasVisibleLabel()) return undefined;\n return channelName();\n };\n\n const updateFromPointer = (clientX: number, clientY: number) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const track = trackRef();\n if (!track) return;\n\n const rect = track.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return;\n\n let percent: number;\n if (orientation() === \"vertical\") {\n percent = 1 - (clientY - rect.top) / rect.height;\n } else {\n const physicalPercent = (clientX - rect.left) / rect.width;\n percent = isRTL() ? 1 - physicalPercent : physicalPercent;\n }\n\n getState().setThumbPercent(Math.max(0, Math.min(1, percent)));\n };\n\n const endDrag = (target: EventTarget | null, pointerId?: number) => {\n const s = getState();\n if (!s.isDragging) return;\n s.setDragging(false);\n focusInput();\n if (pointerId == null) return;\n try {\n (target as HTMLElement | null)?.releasePointerCapture?.(pointerId);\n } catch {\n // Some synthetic pointer sequences do not have active capture by the time\n // drag end runs. React Aria treats capture as best-effort as well.\n }\n };\n\n const installPointerDragListeners = () => {\n if (typeof window === \"undefined\") return;\n cleanupPointerDrag?.();\n\n const onPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n updateFromPointer(e.clientX, e.clientY);\n };\n const onPointerEnd = (e: PointerEvent) => {\n cleanupPointerDrag?.();\n cleanupPointerDrag = undefined;\n endDrag(trackRef(), e.pointerId);\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerEnd);\n window.addEventListener(\"pointercancel\", onPointerEnd);\n\n cleanupPointerDrag = () => {\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerEnd);\n window.removeEventListener(\"pointercancel\", onPointerEnd);\n };\n };\n\n const installMouseDragListeners = () => {\n if (typeof window === \"undefined\") return;\n cleanupMouseDrag?.();\n\n const onMouseMove = (e: MouseEvent) => {\n if (!getState().isDragging) return;\n updateFromPointer(e.clientX, e.clientY);\n };\n const onMouseEnd = () => {\n cleanupMouseDrag?.();\n cleanupMouseDrag = undefined;\n endDrag(trackRef());\n };\n\n window.addEventListener(\"mousemove\", onMouseMove);\n window.addEventListener(\"mouseup\", onMouseEnd);\n\n cleanupMouseDrag = () => {\n window.removeEventListener(\"mousemove\", onMouseMove);\n window.removeEventListener(\"mouseup\", onMouseEnd);\n };\n };\n\n onCleanup(() => {\n cleanupPointerDrag?.();\n cleanupMouseDrag?.();\n });\n\n // Handle pointer interaction on the track\n const onTrackPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n updateFromPointer(e.clientX, e.clientY);\n focusInput();\n getState().setDragging(true);\n try {\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n } catch {\n // Keep drag behavior working in environments where pointer capture is not\n // active for this event, including Playwright's synthetic mouse pointer.\n }\n installPointerDragListeners();\n e.preventDefault();\n };\n\n const onTrackPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n updateFromPointer(e.clientX, e.clientY);\n };\n\n const onTrackPointerUp = (e: PointerEvent) => {\n cleanupPointerDrag?.();\n cleanupPointerDrag = undefined;\n endDrag(e.currentTarget, e.pointerId);\n };\n\n const onTrackPointerCancel = (e: PointerEvent) => {\n cleanupPointerDrag?.();\n cleanupPointerDrag = undefined;\n endDrag(e.currentTarget, e.pointerId);\n };\n\n const onTrackMouseDown = (e: MouseEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n updateFromPointer(e.clientX, e.clientY);\n getState().setDragging(true);\n installMouseDragListeners();\n e.preventDefault();\n };\n\n const onTrackMouseMove = (e: MouseEvent) => {\n if (!getState().isDragging) return;\n updateFromPointer(e.clientX, e.clientY);\n };\n\n const onTrackMouseUp = (e: MouseEvent) => {\n cleanupMouseDrag?.();\n cleanupMouseDrag = undefined;\n endDrag(e.currentTarget);\n };\n\n // Handle keyboard\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented) return;\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case \"ArrowUp\":\n s.incrementThumb();\n break;\n case \"ArrowDown\":\n s.decrementThumb();\n break;\n case \"ArrowRight\":\n if (orientation() === \"horizontal\" && isRTL()) {\n s.decrementThumb();\n } else {\n s.incrementThumb();\n }\n break;\n case \"ArrowLeft\":\n if (orientation() === \"horizontal\" && isRTL()) {\n s.incrementThumb();\n } else {\n s.decrementThumb();\n }\n break;\n case \"PageUp\":\n s.incrementThumb(s.pageSize);\n break;\n case \"PageDown\":\n s.decrementThumb(s.pageSize);\n break;\n case \"Home\":\n s.setThumbValue(s.minValue);\n break;\n case \"End\":\n s.setThumbValue(s.maxValue);\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Generate gradient background for the slider track\n const generateBackground = () => {\n const s = getState();\n const value = s.getDisplayColor();\n const channel = s.channel;\n const to = orientation() === \"vertical\" ? \"top\" : isRTL() ? \"left\" : \"right\";\n\n switch (channel) {\n case \"hue\": {\n const stops = [0, 60, 120, 180, 240, 300, 360]\n .map((hue) => value.withChannelValue(\"hue\", hue).toString(\"css\"))\n .join(\", \");\n return `linear-gradient(to ${to}, ${stops})`;\n }\n case \"lightness\": {\n const min = s.minValue;\n const max = s.maxValue;\n const start = value.withChannelValue(channel, min).toString(\"css\");\n const middle = value.withChannelValue(channel, (max - min) / 2).toString(\"css\");\n const end = value.withChannelValue(channel, max).toString(\"css\");\n return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;\n }\n case \"saturation\":\n case \"brightness\":\n case \"red\":\n case \"green\":\n case \"blue\":\n case \"alpha\": {\n const start = value.withChannelValue(channel, s.minValue).toString(\"css\");\n const end = value.withChannelValue(channel, s.maxValue).toString(\"css\");\n return `linear-gradient(to ${to}, ${start}, ${end})`;\n }\n default:\n return undefined;\n }\n };\n\n // Track props\n const trackProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const bg = generateBackground();\n return {\n id: trackElementId(),\n role: \"group\" as const,\n \"aria-label\": trackAriaLabel(),\n \"aria-labelledby\": trackLabelledBy(),\n onPointerDown: onTrackPointerDown,\n onPointerMove: onTrackPointerMove,\n onPointerUp: onTrackPointerUp,\n onPointerCancel: onTrackPointerCancel,\n onMouseDown: onTrackMouseDown,\n onMouseMove: onTrackMouseMove,\n onMouseUp: onTrackMouseUp,\n style: {\n position: \"relative\" as const,\n \"touch-action\": \"none\",\n \"forced-color-adjust\": \"none\" as const,\n ...(bg ? { background: bg } : {}),\n },\n \"data-disabled\": s.isDisabled || undefined,\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const percent = s.getThumbPercent();\n const x = orientation() === \"horizontal\" ? (isRTL() ? 1 - percent : percent) : 0.5;\n const y = orientation() === \"horizontal\" ? 0.5 : 1 - percent;\n\n return {\n role: \"presentation\" as const,\n onKeyDown,\n style: {\n position: \"absolute\" as const,\n left: `${x * 100}%`,\n top: `${y * 100}%`,\n transform: \"translate(-50%, -50%)\",\n \"touch-action\": \"none\",\n \"forced-color-adjust\": \"none\" as const,\n },\n \"data-dragging\": s.isDragging || undefined,\n \"data-disabled\": s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n const ariaValueText = () => {\n const s = getState();\n const loc = locale().locale;\n const displayColor = s.getDisplayColor();\n let valueText = s.getThumbValueLabel();\n\n if (s.channel === \"hue\") {\n valueText += `, ${displayColor.getHueName(loc)}`;\n } else if (s.channel !== \"alpha\") {\n valueText += `, ${displayColor.getColorName(loc)}`;\n }\n\n return valueText;\n };\n\n // Input props (hidden, for accessibility)\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n type: \"range\",\n id: inputId,\n min: s.minValue,\n max: s.maxValue,\n step: s.step,\n value: s.getThumbValue(),\n name: p.name,\n form: p.form,\n disabled: s.isDisabled || p.isDisabled,\n tabIndex: s.isDisabled || p.isDisabled ? undefined : 0,\n \"aria-orientation\": orientation(),\n \"aria-labelledby\": inputLabelledBy(),\n \"aria-describedby\": p[\"aria-describedby\"] ?? \"\",\n \"aria-details\": p[\"aria-details\"] ?? \"\",\n \"aria-valuetext\": ariaValueText(),\n onKeyDown,\n onInput: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setThumbValue(parseFloat(target.value));\n },\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setThumbValue(parseFloat(target.value));\n },\n onFocus: () => {\n // Focus handling\n },\n style: {\n position: \"absolute\" as const,\n opacity: \"0.0001\",\n width: \"100%\",\n height: \"100%\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n border: \"0\",\n \"pointer-events\": \"none\" as const,\n },\n };\n });\n\n // Output props\n const outputProps = createMemo(() => {\n return {\n \"aria-live\": \"off\" as const,\n for: inputId,\n };\n });\n\n // Label props\n const labelProps = createMemo(() => {\n return {\n id: labelId,\n onClick: () => {\n if (typeof document !== \"undefined\") {\n document.getElementById(inputId)?.focus();\n }\n },\n };\n });\n\n return {\n get trackProps() {\n return trackProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get inputProps() {\n return inputProps();\n },\n get outputProps() {\n return outputProps();\n },\n get labelProps() {\n return labelProps();\n },\n };\n}\n","/**\n * createColorArea hook.\n *\n * Provides ARIA attributes and keyboard/pointer handling for a 2D color area.\n */\n\nimport { createMemo, createSignal, type Accessor } from \"solid-js\";\nimport type { Color, ColorAreaState, ColorChannel } from \"@proyecto-viviana/solid-stately\";\nimport { parseColor } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\nimport { createId } from \"../ssr\";\nimport type { AriaColorAreaOptions, ColorAreaAria } from \"./types\";\n\n/**\n * Creates ARIA props for a color area.\n */\nexport function createColorArea(\n props: Accessor<AriaColorAreaOptions>,\n state: Accessor<ColorAreaState>,\n areaRef: Accessor<HTMLDivElement | null>,\n): ColorAreaAria {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n const isRTL = () => locale().direction === \"rtl\";\n const [focusedInput, setFocusedInput] = createSignal<\"x\" | \"y\" | null>(null);\n const [valueChangedViaKeyboard, setValueChangedViaKeyboard] = createSignal(false);\n const [valueChangedViaInputChangeEvent, setValueChangedViaInputChangeEvent] = createSignal(false);\n\n // Generate IDs\n const colorAreaId = createId();\n const xInputId = createId();\n const yInputId = createId();\n\n const colorPickerLabel = () => \"Color picker\";\n const colorInputLabel = () => {\n const ariaLabel = getProps()[\"aria-label\"];\n return ariaLabel ? `${ariaLabel}, ${colorPickerLabel()}` : colorPickerLabel();\n };\n const colorAreaLabel = () => {\n const ariaLabel = getProps()[\"aria-label\"];\n return ariaLabel ? `${ariaLabel}, ${colorPickerLabel()}` : undefined;\n };\n const formatChannelValueText = (channel: ColorChannel) => {\n const value = getState().getDisplayColor();\n const loc = locale().locale;\n return `${value.getChannelName(channel, loc)}: ${value.formatChannelValue(channel, loc)}`;\n };\n const getAriaValueTextForChannel = (channel: ColorChannel) => {\n const s = getState();\n const value = s.getDisplayColor();\n const loc = locale().locale;\n if (valueChangedViaInputChangeEvent() || valueChangedViaKeyboard()) {\n return `${formatChannelValueText(channel)}, ${value.getColorName(loc)}`;\n }\n\n const otherChannel = channel === s.yChannel ? s.xChannel : s.yChannel;\n return (\n [\n formatChannelValueText(channel),\n formatChannelValueText(otherChannel),\n formatChannelValueText(s.zChannel),\n ].join(\", \") + `, ${value.getColorName(loc)}`\n );\n };\n\n const updateFromInput = (e: Event, axis: \"x\" | \"y\") => {\n const target = e.target as HTMLInputElement;\n const nextValue = parseFloat(target.value);\n\n setValueChangedViaInputChangeEvent(true);\n if (axis === \"x\") {\n getState().setXValue(nextValue);\n } else {\n getState().setYValue(nextValue);\n }\n };\n\n // Calculate position from pointer event\n const getPositionFromEvent = (e: MouseEvent | PointerEvent) => {\n const area = areaRef();\n if (!area) return null;\n\n const rect = area.getBoundingClientRect();\n if (rect.width === 0 || rect.height === 0) return null;\n\n const physicalX = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));\n const x = isRTL() ? 1 - physicalX : physicalX;\n const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));\n\n return { x, y };\n };\n\n // Handle pointer down\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const pos = getPositionFromEvent(e);\n if (!pos) return;\n\n getState().setColorFromPoint(pos.x, pos.y);\n getState().setDragging(true);\n\n // Capture pointer for dragging\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n };\n\n // Handle pointer move\n const onPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n\n const pos = getPositionFromEvent(e);\n if (!pos) return;\n\n getState().setColorFromPoint(pos.x, pos.y);\n };\n\n // Handle pointer up\n const onPointerUp = (e: PointerEvent) => {\n if (getState().isDragging) {\n getState().setDragging(false);\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n const xStep =\n e.shiftKey && s.xChannelPageStep > s.xChannelStep ? s.xChannelPageStep : s.xChannelStep;\n const yStep =\n e.shiftKey && s.yChannelPageStep > s.yChannelStep ? s.yChannelPageStep : s.yChannelStep;\n let focusedAxis: \"x\" | \"y\" = \"x\";\n let handled = true;\n\n switch (e.key) {\n case \"ArrowRight\":\n if (isRTL()) {\n s.decrementX(xStep);\n } else {\n s.incrementX(xStep);\n }\n break;\n case \"ArrowLeft\":\n if (isRTL()) {\n s.incrementX(xStep);\n } else {\n s.decrementX(xStep);\n }\n break;\n case \"ArrowUp\":\n s.incrementY(yStep);\n focusedAxis = \"y\";\n break;\n case \"ArrowDown\":\n s.decrementY(yStep);\n focusedAxis = \"y\";\n break;\n case \"PageUp\":\n s.incrementY(s.yChannelPageStep);\n focusedAxis = \"y\";\n break;\n case \"PageDown\":\n s.decrementY(s.yChannelPageStep);\n focusedAxis = \"y\";\n break;\n case \"Home\":\n if (isRTL()) {\n s.incrementX(s.xChannelPageStep);\n } else {\n s.decrementX(s.xChannelPageStep);\n }\n break;\n case \"End\":\n if (isRTL()) {\n s.decrementX(s.xChannelPageStep);\n } else {\n s.incrementX(s.xChannelPageStep);\n }\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n setFocusedInput(focusedAxis);\n setValueChangedViaKeyboard(true);\n s.setDragging(true);\n s.setDragging(false);\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onFocusOut = (e: FocusEvent) => {\n const currentTarget = e.currentTarget as HTMLElement;\n const relatedTarget = e.relatedTarget as Node | null;\n if (!relatedTarget || !currentTarget.contains(relatedTarget)) {\n setValueChangedViaKeyboard(false);\n setValueChangedViaInputChangeEvent(false);\n }\n };\n\n // Color area props\n const colorAreaProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n id: p.id ?? colorAreaId,\n role: \"group\" as const,\n \"aria-label\": colorAreaLabel(),\n \"aria-labelledby\": p[\"aria-labelledby\"],\n onPointerDown,\n onPointerMove,\n onPointerUp,\n style: {\n position: \"relative\" as const,\n \"touch-action\": \"none\",\n \"forced-color-adjust\": \"none\" as const,\n ...generateGradient(),\n },\n \"data-disabled\": s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Generate gradient background for the color area\n function generateGradient(): Record<string, string> {\n const s = getState();\n const value = s.value;\n const xCh = s.xChannel;\n const yCh = s.yChannel;\n const zCh = s.zChannel;\n const zValue = value.getChannelValue(zCh);\n const end = isRTL() ? \"left\" : \"right\";\n\n const hue = (color: Color) =>\n [0, 60, 120, 180, 240, 300, 360]\n .map((h) => color.withChannelValue(\"hue\", h).toString(\"css\"))\n .join(\", \");\n\n const hslChannels: Record<string, (c: Color) => string> = {\n hue,\n saturation: (color) =>\n `${color.withChannelValue(\"saturation\", 0).toString(\"css\")}, transparent`,\n lightness: () => \"black, transparent, white\",\n };\n\n const hsbChannels: Record<string, (c: Color) => string> = {\n hue,\n saturation: (color) =>\n `${color.withChannelValue(\"saturation\", 0).toString(\"css\")}, transparent`,\n brightness: () => \"black, transparent\",\n };\n\n switch (value.getColorSpace()) {\n case \"rgb\": {\n const rgb = parseColor(\"rgb(0, 0, 0)\");\n return {\n background: [\n `linear-gradient(to ${end}, ${rgb.withChannelValue(xCh, 0).toString(\"css\")}, ${rgb.withChannelValue(xCh, 255).toString(\"css\")})`,\n `linear-gradient(to top, ${rgb.withChannelValue(yCh, 0).toString(\"css\")}, ${rgb.withChannelValue(yCh, 255).toString(\"css\")})`,\n rgb.withChannelValue(zCh, zValue).toString(\"css\"),\n ].join(\",\"),\n \"background-blend-mode\": \"screen\",\n };\n }\n case \"hsl\": {\n const channels = value.getColorChannels();\n const base = parseColor(\"hsl(0, 100%, 50%)\").withChannelValue(zCh, zValue);\n const bg = channels\n .filter((c: ColorChannel) => c !== zCh)\n .map(\n (c: ColorChannel) =>\n `linear-gradient(to ${c === xCh ? end : \"top\"}, ${hslChannels[c]?.(base) ?? \"\"})`,\n )\n .reverse();\n if (zCh === \"hue\") {\n bg.push(base.toString(\"css\"));\n }\n\n return {\n background: bg.join(\", \"),\n };\n }\n case \"hsb\": {\n const channels = value.getColorChannels();\n const base = parseColor(\"hsb(0, 100%, 100%)\").withChannelValue(zCh, zValue);\n const bg = channels\n .filter((c: ColorChannel) => c !== zCh)\n .map(\n (c: ColorChannel) =>\n `linear-gradient(to ${c === xCh ? end : \"top\"}, ${hsbChannels[c]?.(base) ?? \"\"})`,\n )\n .reverse();\n if (zCh === \"hue\") {\n bg.push(base.toString(\"css\"));\n }\n\n return {\n background: bg.join(\", \"),\n };\n }\n default:\n return {};\n }\n }\n\n // Gradient props (the visual area)\n const gradientProps = createMemo(() => {\n const gradientStyles = generateGradient();\n return {\n role: \"presentation\" as const,\n style: {\n width: \"100%\",\n height: \"100%\",\n \"forced-color-adjust\": \"none\" as const,\n ...gradientStyles,\n },\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const pos = s.getThumbPosition();\n const x = isRTL() ? 1 - pos.x : pos.x;\n\n return {\n role: \"presentation\" as const,\n style: {\n position: \"absolute\" as const,\n left: `${x * 100}%`,\n top: `${pos.y * 100}%`,\n transform: \"translate(-50%, -50%)\",\n \"touch-action\": \"none\",\n \"forced-color-adjust\": \"none\" as const,\n },\n onKeyDown,\n onFocusOut,\n \"data-dragging\": s.isDragging || undefined,\n \"data-disabled\": s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // X input props (hidden, for accessibility)\n const xInputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const xRange = s.value.getChannelRange(s.xChannel);\n\n return {\n type: \"range\",\n id: p.id ?? xInputId,\n \"aria-label\": colorInputLabel(),\n \"aria-roledescription\": \"2D slider\",\n \"aria-valuetext\": getAriaValueTextForChannel(s.xChannel),\n \"aria-orientation\": \"horizontal\" as const,\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-details\": p[\"aria-details\"],\n min: xRange.minValue,\n max: xRange.maxValue,\n step: xRange.step,\n value: s.getXValue(),\n name: p.xName,\n form: p.form,\n disabled: s.isDisabled || p.isDisabled,\n \"aria-hidden\":\n !focusedInput() || focusedInput() === \"x\" || valueChangedViaKeyboard()\n ? undefined\n : (\"true\" as const),\n onFocus: () => setFocusedInput(\"x\"),\n onKeyDown,\n onInput: (e: Event) => updateFromInput(e, \"x\"),\n onChange: (e: Event) => updateFromInput(e, \"x\"),\n onBlur: () => {\n if (s.isDragging) {\n s.setDragging(false);\n }\n },\n tabIndex: !focusedInput() || focusedInput() === \"x\" ? undefined : -1,\n style: {\n position: \"absolute\" as const,\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n border: \"0\",\n },\n };\n });\n\n // Y input props (hidden, for accessibility)\n const yInputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const yRange = s.value.getChannelRange(s.yChannel);\n\n return {\n type: \"range\",\n id: p.id ?? yInputId,\n \"aria-label\": colorInputLabel(),\n \"aria-roledescription\": \"2D slider\",\n \"aria-valuetext\": getAriaValueTextForChannel(s.yChannel),\n \"aria-orientation\": \"vertical\" as const,\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-details\": p[\"aria-details\"],\n min: yRange.minValue,\n max: yRange.maxValue,\n step: yRange.step,\n value: s.getYValue(),\n name: p.yName,\n form: p.form,\n disabled: s.isDisabled || p.isDisabled,\n \"aria-hidden\":\n focusedInput() === \"y\" || valueChangedViaKeyboard() ? undefined : (\"true\" as const),\n onFocus: () => setFocusedInput(\"y\"),\n onKeyDown,\n onInput: (e: Event) => updateFromInput(e, \"y\"),\n onChange: (e: Event) => updateFromInput(e, \"y\"),\n tabIndex: focusedInput() === \"y\" ? undefined : -1,\n style: {\n position: \"absolute\" as const,\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n border: \"0\",\n },\n };\n });\n\n return {\n get colorAreaProps() {\n return colorAreaProps();\n },\n get gradientProps() {\n return gradientProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get xInputProps() {\n return xInputProps();\n },\n get yInputProps() {\n return yInputProps();\n },\n };\n}\n","/**\n * createColorWheel hook.\n *\n * Provides ARIA attributes and keyboard/pointer handling for a circular hue selector.\n */\n\nimport { createMemo, onCleanup, type Accessor } from \"solid-js\";\nimport type { ColorWheelState } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\nimport { createId } from \"../ssr\";\nimport { focusWithoutScrolling } from \"../utils/focus\";\nimport type { AriaColorWheelOptions, ColorWheelAria } from \"./types\";\n\n/**\n * Creates ARIA props for a color wheel.\n */\nexport function createColorWheel(\n props: Accessor<AriaColorWheelOptions>,\n state: Accessor<ColorWheelState>,\n wheelRef: Accessor<HTMLDivElement | null>,\n): ColorWheelAria {\n const getProps = () => props();\n const getState = () => state();\n const locale = useLocale();\n\n // Generate IDs\n const inputId = createId();\n let cleanupPointerDrag: (() => void) | undefined;\n let cleanupMouseDrag: (() => void) | undefined;\n let dragElement: HTMLElement | null = null;\n\n const outerRadius = () => getProps().outerRadius ?? 100;\n const innerRadius = () => getProps().innerRadius ?? 74;\n const thumbRadius = () => (innerRadius() + outerRadius()) / 2;\n\n const getInput = () => wheelRef()?.querySelector<HTMLInputElement>('input[type=\"range\"]') ?? null;\n const focusInput = () => {\n focusWithoutScrolling(getInput());\n queueMicrotask(() => focusWithoutScrolling(getInput()));\n };\n\n const getPointFromEvent = (clientX: number, clientY: number, element?: HTMLElement | null) => {\n const wheel = element ?? dragElement ?? wheelRef();\n if (!wheel) return null;\n\n const rect = wheel.getBoundingClientRect();\n const centerX = rect.left + rect.width / 2;\n const centerY = rect.top + rect.height / 2;\n\n return {\n x: clientX - centerX,\n y: clientY - centerY,\n };\n };\n\n const updateFromPoint = (\n clientX: number,\n clientY: number,\n requireTrackHit = false,\n element?: HTMLElement | null,\n ) => {\n if (getProps().isDisabled || getState().isDisabled) return false;\n\n const point = getPointFromEvent(clientX, clientY, element);\n if (!point) return false;\n\n const distance = Math.sqrt(point.x ** 2 + point.y ** 2);\n if (requireTrackHit && (distance <= innerRadius() || distance >= outerRadius())) {\n return false;\n }\n\n getState().setHueFromPoint(point.x, point.y, thumbRadius());\n return true;\n };\n\n const endDrag = () => {\n if (!getState().isDragging) return;\n getState().setDragging(false);\n dragElement = null;\n focusInput();\n };\n\n const installPointerDragListeners = () => {\n if (typeof window === \"undefined\") return;\n cleanupPointerDrag?.();\n\n const onPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n updateFromPoint(e.clientX, e.clientY);\n };\n const onPointerEnd = () => {\n cleanupPointerDrag?.();\n cleanupPointerDrag = undefined;\n endDrag();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerEnd);\n window.addEventListener(\"pointercancel\", onPointerEnd);\n\n cleanupPointerDrag = () => {\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerEnd);\n window.removeEventListener(\"pointercancel\", onPointerEnd);\n };\n };\n\n const installMouseDragListeners = () => {\n if (typeof window === \"undefined\") return;\n cleanupMouseDrag?.();\n\n const onMouseMove = (e: MouseEvent) => {\n if (!getState().isDragging) return;\n updateFromPoint(e.clientX, e.clientY);\n };\n const onMouseEnd = () => {\n cleanupMouseDrag?.();\n cleanupMouseDrag = undefined;\n endDrag();\n };\n\n window.addEventListener(\"mousemove\", onMouseMove);\n window.addEventListener(\"mouseup\", onMouseEnd);\n\n cleanupMouseDrag = () => {\n window.removeEventListener(\"mousemove\", onMouseMove);\n window.removeEventListener(\"mouseup\", onMouseEnd);\n };\n };\n\n onCleanup(() => {\n cleanupPointerDrag?.();\n cleanupMouseDrag?.();\n });\n\n const onTrackPointerDown = (e: PointerEvent) => {\n dragElement = e.currentTarget as HTMLElement;\n if (!updateFromPoint(e.clientX, e.clientY, true, dragElement)) {\n dragElement = null;\n return;\n }\n focusInput();\n getState().setDragging(true);\n installPointerDragListeners();\n e.preventDefault();\n };\n\n const onTrackMouseDown = (e: MouseEvent) => {\n dragElement = e.currentTarget as HTMLElement;\n if (!updateFromPoint(e.clientX, e.clientY, true, dragElement)) {\n dragElement = null;\n return;\n }\n focusInput();\n getState().setDragging(true);\n installMouseDragListeners();\n e.preventDefault();\n };\n\n const onThumbPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n focusInput();\n getState().setDragging(true);\n installPointerDragListeners();\n e.preventDefault();\n e.stopPropagation();\n };\n\n const onThumbMouseDown = (e: MouseEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n focusInput();\n getState().setDragging(true);\n installMouseDragListeners();\n e.preventDefault();\n e.stopPropagation();\n };\n\n // Handle keyboard\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented) return;\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n s.increment();\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n s.decrement();\n break;\n case \"PageUp\":\n s.increment(s.pageStep);\n break;\n case \"PageDown\":\n s.decrement(s.pageStep);\n break;\n case \"Home\":\n s.setHue(0);\n break;\n case \"End\":\n s.setHue(359);\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n s.setDragging(true);\n s.setDragging(false);\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Hue spectrum conic gradient\n const conicGradient = `conic-gradient(from 90deg, hsl(0, 100%, 50%), hsl(30, 100%, 50%), hsl(60, 100%, 50%), hsl(90, 100%, 50%), hsl(120, 100%, 50%), hsl(150, 100%, 50%), hsl(180, 100%, 50%), hsl(210, 100%, 50%), hsl(240, 100%, 50%), hsl(270, 100%, 50%), hsl(300, 100%, 50%), hsl(330, 100%, 50%), hsl(360, 100%, 50%))`;\n\n const ringPath = () => {\n const outer = outerRadius();\n const inner = innerRadius();\n const circlePath = (radius: number) =>\n [\n `M ${outer}, ${outer} m ${-radius}, 0`,\n `a ${radius}, ${radius}, 0, 1, 0, ${radius * 2}, 0`,\n `a ${radius}, ${radius}, 0, 1, 0 ${-radius * 2}, 0`,\n ].join(\" \");\n return `path(evenodd, \"${circlePath(outer)} ${circlePath(inner)}\")`;\n };\n\n // Track props (the wheel container)\n const trackProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n onPointerDown: onTrackPointerDown,\n onMouseDown: onTrackMouseDown,\n style: {\n position: \"relative\" as const,\n \"touch-action\": \"none\",\n width: `${outerRadius() * 2}px`,\n height: `${outerRadius() * 2}px`,\n background: conicGradient,\n \"clip-path\": ringPath(),\n \"forced-color-adjust\": \"none\" as const,\n },\n \"data-disabled\": s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const position = s.getThumbPosition(thumbRadius());\n\n return {\n onPointerDown: onThumbPointerDown,\n onMouseDown: onThumbMouseDown,\n onKeyDown,\n style: {\n position: \"absolute\" as const,\n left: `${outerRadius() + position.x}px`,\n top: `${outerRadius() + position.y}px`,\n transform: \"translate(-50%, -50%)\",\n \"touch-action\": \"none\",\n \"forced-color-adjust\": \"none\" as const,\n },\n \"data-dragging\": s.isDragging || undefined,\n \"data-disabled\": s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Input props (hidden, for accessibility)\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n type: \"range\",\n id: p.id ?? inputId,\n min: 0,\n max: 360,\n step: s.step,\n value: s.getHue(),\n name: p.name,\n form: p.form,\n disabled: s.isDisabled || p.isDisabled,\n tabIndex: s.isDisabled || p.isDisabled ? undefined : 0,\n \"aria-label\":\n p[\"aria-label\"] ??\n (p[\"aria-labelledby\"] ? undefined : s.value.getChannelName(\"hue\", locale().locale)),\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": p[\"aria-describedby\"],\n \"aria-details\": p[\"aria-details\"],\n \"aria-errormessage\": p[\"aria-errormessage\"],\n \"aria-valuetext\": `${s.value.formatChannelValue(\"hue\", locale().locale)}, ${s.value.getHueName(locale().locale)}`,\n onKeyDown,\n onInput: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setHue(parseFloat(target.value));\n },\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setHue(parseFloat(target.value));\n },\n onBlur: () => {\n if (s.isDragging) {\n s.setDragging(false);\n }\n },\n style: {\n position: \"absolute\" as const,\n width: \"100%\",\n height: \"100%\",\n opacity: \"0.0001\",\n padding: \"0\",\n margin: \"0\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n border: \"0\",\n \"pointer-events\": \"none\" as const,\n },\n };\n });\n\n return {\n get trackProps() {\n return trackProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get inputProps() {\n return inputProps();\n },\n };\n}\n","/**\n * createColorField hook.\n *\n * Provides ARIA attributes and keyboard handling for a color input field.\n */\n\nimport { createEffect, createMemo, type Accessor } from \"solid-js\";\nimport type { ColorFieldState } from \"@proyecto-viviana/solid-stately\";\nimport { createId } from \"../ssr\";\nimport type { AriaColorFieldOptions, ColorFieldAria } from \"./types\";\n\n/**\n * Creates ARIA props for a color field.\n */\nexport function createColorField(\n props: Accessor<AriaColorFieldOptions>,\n state: Accessor<ColorFieldState>,\n inputRef: Accessor<HTMLInputElement | null>,\n): ColorFieldAria {\n const getProps = () => props();\n const getState = () => state();\n\n const generatedInputId = createId();\n const labelId = createId();\n const descriptionId = createId();\n const errorMessageId = createId();\n\n let didAutoFocus = false;\n createEffect(() => {\n const input = inputRef();\n if (!didAutoFocus && getProps().autoFocus && input) {\n didAutoFocus = true;\n input.focus();\n }\n });\n\n const isDisabled = () => getProps().isDisabled || getState().isDisabled;\n const isReadOnly = () => getProps().isReadOnly || getState().isReadOnly;\n const isInvalid = () => getProps().isInvalid || getState().isInvalid;\n const validationBehavior = () => getProps().validationBehavior ?? \"native\";\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = getState();\n\n if (isDisabled() || isReadOnly()) {\n return;\n }\n\n let handled = true;\n\n switch (e.key) {\n case \"ArrowUp\":\n s.increment();\n break;\n case \"ArrowDown\":\n s.decrement();\n break;\n case \"PageUp\":\n s.incrementToMax();\n break;\n case \"PageDown\":\n s.decrementToMin();\n break;\n case \"Home\":\n s.decrementToMin();\n break;\n case \"End\":\n s.incrementToMax();\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n }\n };\n\n const onWheel = (e: WheelEvent) => {\n const p = getProps();\n const s = getState();\n\n if (\n p.isWheelDisabled ||\n isDisabled() ||\n isReadOnly() ||\n document.activeElement !== inputRef()\n ) {\n return;\n }\n\n if (e.deltaY < 0) {\n s.increment();\n } else if (e.deltaY > 0) {\n s.decrement();\n } else {\n return;\n }\n\n e.preventDefault();\n };\n\n const labelProps = createMemo(() => {\n return {\n id: labelId,\n for: getProps().id ?? generatedInputId,\n };\n });\n\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n const errorMessageProps = createMemo(() => ({\n id: getProps()[\"aria-errormessage\"] ?? errorMessageId,\n }));\n\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const channelLabel =\n s.channel && s.colorValue ? s.colorValue.getChannelName(s.channel, \"en-US\") : undefined;\n const required = p.isRequired || s.isRequired;\n const invalid = isInvalid();\n const describedBy = p[\"aria-describedby\"];\n\n return {\n id: p.id ?? generatedInputId,\n type: \"text\",\n value: s.inputValue,\n name: s.channel ? undefined : p.name,\n form: s.channel ? undefined : p.form,\n placeholder: p.placeholder,\n disabled: isDisabled(),\n readOnly: isReadOnly(),\n required: validationBehavior() === \"native\" ? required || undefined : undefined,\n tabIndex: p.excludeFromTabOrder ? -1 : undefined,\n autoComplete: \"off\",\n autoCorrect: \"off\",\n spellCheck: \"false\",\n \"aria-label\": p[\"aria-label\"] ?? channelLabel,\n \"aria-labelledby\": p[\"aria-labelledby\"],\n \"aria-describedby\": describedBy,\n \"aria-details\": p[\"aria-details\"],\n \"aria-errormessage\": invalid ? (p[\"aria-errormessage\"] ?? errorMessageId) : undefined,\n \"aria-invalid\": invalid || undefined,\n \"aria-required\": validationBehavior() === \"aria\" && required ? true : undefined,\n role: s.channel ? undefined : (\"textbox\" as const),\n \"aria-valuenow\": undefined,\n \"aria-valuemin\": undefined,\n \"aria-valuemax\": undefined,\n \"aria-valuetext\": undefined,\n onInput: (e: InputEvent) => {\n const target = e.target as HTMLInputElement;\n if (s.validate(target.value)) {\n s.setInputValue(target.value);\n } else {\n target.value = s.inputValue;\n }\n },\n onChange: () => {\n s.commit();\n },\n onBlur: () => {\n s.commit();\n },\n onKeyDown,\n onWheel,\n };\n });\n\n return {\n get labelProps() {\n return labelProps();\n },\n get inputProps() {\n return inputProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n };\n}\n","/**\n * createColorSwatch hook.\n *\n * Provides ARIA attributes for a color swatch display.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport { normalizeColor } from \"@proyecto-viviana/solid-stately\";\nimport { useLocale } from \"../i18n\";\nimport { createId } from \"../ssr\";\nimport { filterDOMProps } from \"../utils/filterDOMProps\";\nimport type { AriaColorSwatchOptions, ColorSwatchAria } from \"./types\";\n\n/**\n * Creates ARIA props for a color swatch.\n */\nexport function createColorSwatch(props: Accessor<AriaColorSwatchOptions>): ColorSwatchAria {\n const getProps = () => props();\n const locale = useLocale();\n const generatedId = createId();\n const id = () => getProps().id ?? generatedId;\n\n const color = createMemo(() => normalizeColor(getProps().color ?? \"#fff0\"));\n\n const colorName = createMemo(() => {\n const p = getProps();\n if (p.colorName) return p.colorName;\n\n const resolvedColor = color();\n if (resolvedColor.getChannelValue(\"alpha\") === 0) {\n return \"transparent\";\n }\n\n return resolvedColor.getColorName(locale().locale);\n });\n\n const swatchProps = createMemo(() => {\n const p = getProps();\n const domProps = filterDOMProps(p as Record<string, unknown>, { labelable: true });\n const ariaLabel = [colorName(), p[\"aria-label\"] || \"\"].filter(Boolean).join(\", \");\n\n return {\n ...domProps,\n id: id(),\n slot: p.slot,\n role: \"img\" as const,\n \"aria-roledescription\": \"color swatch\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": p[\"aria-labelledby\"] ? `${id()} ${p[\"aria-labelledby\"]}` : undefined,\n style: {\n \"background-color\": color().toString(\"css\"),\n \"forced-color-adjust\": \"none\" as const,\n },\n };\n });\n\n return {\n get swatchProps() {\n return swatchProps();\n },\n get color() {\n return color();\n },\n };\n}\n","/**\n * Drag and Drop utilities for solidaria.\n */\n\nimport type {\n DragItem,\n DropItem,\n TextDropItem,\n FileDropItem,\n DirectoryDropItem,\n DropOperation,\n} from \"@proyecto-viviana/solid-stately\";\n\n// Native drag types that can be transferred between applications\nexport const NATIVE_DRAG_TYPES: Set<string> = new Set([\"text/plain\", \"text/uri-list\", \"text/html\"]);\n\n// Custom drag type for serializing multiple items\nexport const CUSTOM_DRAG_TYPE = \"application/vnd.solidaria.items+json\";\n\n// Generic type for unknown file types\nexport const GENERIC_TYPE = \"application/octet-stream\";\n\n// Drop operation bit flags\nexport enum DROP_OPERATION {\n none = 0,\n cancel = 0,\n move = 1 << 0,\n copy = 1 << 1,\n link = 1 << 2,\n all = (1 << 0) | (1 << 1) | (1 << 2),\n}\n\n// Map from effectAllowed to DROP_OPERATION\nexport const DROP_OPERATION_ALLOWED: Record<string, number> = {\n none: DROP_OPERATION.none,\n copy: DROP_OPERATION.copy,\n copyLink: DROP_OPERATION.copy | DROP_OPERATION.link,\n copyMove: DROP_OPERATION.copy | DROP_OPERATION.move,\n link: DROP_OPERATION.link,\n linkMove: DROP_OPERATION.link | DROP_OPERATION.move,\n move: DROP_OPERATION.move,\n all: DROP_OPERATION.all,\n uninitialized: DROP_OPERATION.all,\n};\n\n// Map from DROP_OPERATION to effectAllowed\nexport const EFFECT_ALLOWED: Record<number, string> = {\n [DROP_OPERATION.none]: \"none\",\n [DROP_OPERATION.move]: \"move\",\n [DROP_OPERATION.copy]: \"copy\",\n [DROP_OPERATION.copy | DROP_OPERATION.move]: \"copyMove\",\n [DROP_OPERATION.link]: \"link\",\n [DROP_OPERATION.link | DROP_OPERATION.move]: \"linkMove\",\n [DROP_OPERATION.copy | DROP_OPERATION.link]: \"copyLink\",\n [DROP_OPERATION.all]: \"all\",\n};\n\n// Map from dropEffect to DropOperation\nexport const DROP_EFFECT_TO_DROP_OPERATION: Record<string, DropOperation> = {\n none: \"cancel\",\n link: \"link\",\n copy: \"copy\",\n move: \"move\",\n};\n\n// Map from DropOperation to dropEffect\nexport const DROP_OPERATION_TO_DROP_EFFECT: Record<DropOperation, string> = {\n cancel: \"none\",\n link: \"link\",\n copy: \"copy\",\n move: \"move\",\n};\n\n/**\n * Get the types present in drag items.\n */\nexport function getTypes(items: DragItem[]): Set<string> {\n const types = new Set<string>();\n for (const item of items) {\n for (const type of Object.keys(item)) {\n types.add(type);\n }\n }\n return types;\n}\n\n/**\n * Write drag items to a DataTransfer object.\n */\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]): void {\n const groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n const customData: object[] = [];\n\n for (const item of items) {\n const types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n const dataByType: Record<string, string> = {};\n for (const type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n const data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (const [type, typeItems] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Join all items of this type with newlines\n const data = typeItems.join(\"\\n\");\n dataTransfer.items.add(data, type);\n } else {\n // Set first item for non-native types\n dataTransfer.items.add(typeItems[0], type);\n }\n }\n\n if (needsCustomData) {\n const data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\n/**\n * Read drop items from a DataTransfer object.\n */\nexport function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {\n const items: DropItem[] = [];\n\n if (!dataTransfer) {\n return items;\n }\n\n // Check for custom drag type first\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n const data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n const parsed = JSON.parse(data);\n for (const item of parsed) {\n items.push({\n kind: \"text\",\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type]),\n });\n }\n hasCustomType = true;\n } catch {\n // ignore parsing errors\n }\n }\n\n // Fall back to native items\n if (!hasCustomType) {\n const stringItems = new Map<string, string>();\n\n for (const item of dataTransfer.items) {\n if (item.kind === \"string\") {\n const type = item.type || GENERIC_TYPE;\n stringItems.set(type, dataTransfer.getData(item.type));\n } else if (item.kind === \"file\") {\n const file = item.getAsFile();\n if (file) {\n items.push(createFileItem(file));\n }\n }\n }\n\n if (stringItems.size > 0) {\n items.push({\n kind: \"text\",\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type) ?? \"\"),\n });\n }\n }\n\n return items;\n}\n\n/**\n * Create a FileDropItem from a File object.\n */\nfunction createFileItem(file: File): FileDropItem {\n return {\n kind: \"file\",\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => file.text(),\n getFile: () => Promise.resolve(file),\n };\n}\n\n/**\n * DragTypes implementation for checking drag types.\n */\nexport class DragTypesImpl {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n let hasFiles = false;\n\n for (const item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === \"file\") {\n hasFiles = true;\n }\n if (item.type) {\n this.types.add(item.type);\n } else {\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // Safari doesn't expose file types until drop\n this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes(\"Files\");\n }\n\n has(type: string | symbol): boolean {\n if (this.includesUnknownTypes || (typeof type === \"symbol\" && this.types.has(GENERIC_TYPE))) {\n return true;\n }\n return typeof type === \"string\" && this.types.has(type);\n }\n}\n\n/**\n * Check if a drop item is a text item.\n */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === \"text\";\n}\n\n/**\n * Check if a drop item is a file item.\n */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === \"file\";\n}\n\n/**\n * Check if a drop item is a directory item.\n */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n return dropItem.kind === \"directory\";\n}\n\n// Global state for tracking drag operations\nlet globalDropEffect: string | undefined;\nlet globalAllowedDropOperations: number = DROP_OPERATION.none;\n\nexport function setGlobalDropEffect(effect: string | undefined): void {\n globalDropEffect = effect;\n}\n\nexport function getGlobalDropEffect(): string | undefined {\n return globalDropEffect;\n}\n\nexport function setGlobalAllowedDropOperations(ops: number): void {\n globalAllowedDropOperations = ops;\n}\n\nexport function getGlobalAllowedDropOperations(): number {\n return globalAllowedDropOperations;\n}\n","/**\n * createDraggableCollection - ARIA hook for draggable collection items.\n *\n * Provides accessibility support for dragging items from a collection\n * component like ListBox, GridList, or Table.\n */\n\nimport { createMemo, createEffect, onCleanup, type Accessor } from \"solid-js\";\nimport type { DraggableCollectionState } from \"@proyecto-viviana/solid-stately\";\nimport { getTypes } from \"./utils\";\n\n// Global state for tracking the dragging collection\nlet globalDraggingCollectionRef: HTMLElement | null = null;\nlet globalDraggingKeys: Set<string | number> = new Set();\nlet globalDraggingTypes: Set<string> = new Set();\n\nexport function setGlobalDraggingCollectionRef(ref: HTMLElement | null): void {\n globalDraggingCollectionRef = ref;\n}\n\nexport function getGlobalDraggingCollectionRef(): HTMLElement | null {\n return globalDraggingCollectionRef;\n}\n\nexport function setGlobalDraggingKeys(keys: Set<string | number>): void {\n globalDraggingKeys = new Set(keys);\n}\n\nexport function getGlobalDraggingKeys(): Set<string | number> {\n return new Set(globalDraggingKeys);\n}\n\nexport function setGlobalDraggingTypes(types: Set<string>): void {\n globalDraggingTypes = new Set(types);\n}\n\nexport function getGlobalDraggingTypes(): Set<string> {\n return new Set(globalDraggingTypes);\n}\n\nexport interface DraggableCollectionOptions {\n /** Reference to the collection element. */\n ref: Accessor<HTMLElement | null>;\n}\n\nexport interface DraggableCollectionAria {\n /** The draggable collection state. */\n state: DraggableCollectionState;\n}\n\n/**\n * Creates ARIA support for a draggable collection.\n *\n * @param _options - Collection options\n * @param state - Draggable collection state\n * @returns Draggable collection ARIA result\n */\nexport function createDraggableCollection(\n options: DraggableCollectionOptions,\n state: DraggableCollectionState,\n): DraggableCollectionAria {\n const ref = createMemo(() => options.ref());\n\n // Track dragging state globally\n createEffect(() => {\n const currentRef = ref();\n if (state.draggingKeys.size > 0) {\n if (globalDraggingCollectionRef !== currentRef) {\n setGlobalDraggingCollectionRef(currentRef);\n }\n setGlobalDraggingKeys(state.draggingKeys);\n setGlobalDraggingTypes(getTypes(state.getItems(state.draggingKeys)));\n return;\n }\n\n // Clear global drag tracking when this collection is no longer dragging.\n if (globalDraggingCollectionRef === currentRef) {\n setGlobalDraggingCollectionRef(null);\n setGlobalDraggingKeys(new Set());\n setGlobalDraggingTypes(new Set());\n }\n });\n\n // Clean up on unmount\n onCleanup(() => {\n if (globalDraggingCollectionRef === ref()) {\n setGlobalDraggingCollectionRef(null);\n setGlobalDraggingKeys(new Set());\n setGlobalDraggingTypes(new Set());\n }\n });\n\n return {\n state,\n };\n}\n","/**\n * createDrag - ARIA hook for drag operations.\n *\n * Provides accessibility props for draggable elements with support for\n * mouse, touch, and keyboard interactions.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport { createDragState } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaDragOptions, DragAria } from \"./types\";\nimport {\n getTypes,\n writeToDataTransfer,\n DROP_OPERATION,\n EFFECT_ALLOWED,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalAllowedDropOperations,\n setGlobalDropEffect,\n getGlobalDropEffect,\n} from \"./utils\";\nimport { setGlobalDraggingTypes } from \"./createDraggableCollection\";\n\n/**\n * Creates ARIA props for a draggable element.\n *\n * @param props - Accessor returning drag options\n * @returns Drag ARIA props and state\n */\nexport function createDrag(props: Accessor<AriaDragOptions>): DragAria {\n const getProps = createMemo(() => props());\n\n const state = createDragState(() => ({\n getItems: getProps().getItems,\n getAllowedDropOperations: getProps().getAllowedDropOperations,\n onDragStart: getProps().onDragStart,\n onDragMove: getProps().onDragMove,\n onDragEnd: getProps().onDragEnd,\n isDisabled: getProps().isDisabled,\n hasDragButton: getProps().hasDragButton,\n preview: getProps().preview,\n }));\n\n let lastX = 0;\n let lastY = 0;\n\n const onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) return;\n e.stopPropagation();\n\n const p = getProps();\n\n state.startDrag(e.clientX, e.clientY);\n\n const items = state.getItems();\n setGlobalDraggingTypes(getTypes(items));\n e.dataTransfer?.clearData?.();\n if (e.dataTransfer) {\n writeToDataTransfer(e.dataTransfer, items);\n }\n\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n const effectAllowed = EFFECT_ALLOWED[allowed] || \"none\";\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = (\n effectAllowed === \"cancel\" ? \"none\" : effectAllowed\n ) as DataTransfer[\"effectAllowed\"];\n }\n\n if (typeof p.preview?.current === \"function\" && e.dataTransfer) {\n p.preview.current(items, (node, userX, userY) => {\n if (!node || !e.dataTransfer) return;\n\n const size = node.getBoundingClientRect();\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let defaultX = e.clientX - rect.x;\n let defaultY = e.clientY - rect.y;\n\n if (defaultX > size.width || defaultY > size.height) {\n defaultX = size.width / 2;\n defaultY = size.height / 2;\n }\n\n let offsetX = typeof userX === \"number\" ? userX : defaultX;\n let offsetY = typeof userY === \"number\" ? userY : defaultY;\n\n offsetX = Math.max(0, Math.min(offsetX, size.width));\n offsetY = Math.max(0, Math.min(offsetY, size.height));\n\n e.dataTransfer.setDragImage(node, offsetX, offsetY);\n });\n }\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDrag = (e: DragEvent) => {\n e.stopPropagation();\n\n if (e.clientX === lastX && e.clientY === lastY) {\n return;\n }\n\n state.moveDrag(e.clientX, e.clientY);\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDragEnd = (e: DragEvent) => {\n e.stopPropagation();\n\n let dropEffect: string = e.dataTransfer?.dropEffect ?? \"none\";\n // Chrome Android fix - use global drop effect\n if (getGlobalDropEffect()) {\n dropEffect = getGlobalDropEffect()!;\n }\n\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n state.endDrag(e.clientX, e.clientY, dropOperation);\n\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDraggingTypes(new Set());\n setGlobalDropEffect(undefined);\n };\n\n // Keyboard/screen reader drag initiation\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Enter\" && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \"Enter\" && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n // Would initiate keyboard-based drag mode\n // This is a simplified version - full implementation needs DragManager\n const rect = (e.target as HTMLElement).getBoundingClientRect();\n state.startDrag(rect.x + rect.width / 2, rect.y + rect.height / 2);\n const items = state.getItems();\n setGlobalDraggingTypes(getTypes(items));\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n setGlobalAllowedDropOperations(allowed);\n }\n };\n\n const dragProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n draggable: false as const,\n };\n }\n\n const baseProps: Record<string, unknown> = {\n draggable: true as const,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n if (!p.hasDragButton) {\n baseProps.onKeyDown = onKeyDown;\n baseProps.onKeyUp = onKeyUp;\n }\n\n return baseProps;\n });\n\n const dragButtonProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: \"button\" as const,\n \"aria-label\": \"Drag\",\n onKeyDown,\n onKeyUp,\n };\n });\n\n return {\n get dragProps() {\n return dragProps() as DragAria[\"dragProps\"];\n },\n get dragButtonProps() {\n return dragButtonProps() as DragAria[\"dragButtonProps\"];\n },\n get isDragging() {\n return state.isDragging;\n },\n };\n}\n","/**\n * createDrop - ARIA hook for drop operations.\n *\n * Provides accessibility props for drop target elements with support for\n * mouse, touch, and keyboard interactions.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport { createDropState } from \"@proyecto-viviana/solid-stately\";\nimport type { AriaDropOptions, DropAria } from \"./types\";\nimport {\n readFromDataTransfer,\n DragTypesImpl,\n DROP_OPERATION,\n DROP_OPERATION_ALLOWED,\n DROP_OPERATION_TO_DROP_EFFECT,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalDropEffect,\n getGlobalAllowedDropOperations,\n} from \"./utils\";\nimport type { DropOperation } from \"@proyecto-viviana/solid-stately\";\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Creates ARIA props for a drop target element.\n *\n * @param props - Accessor returning drop options\n * @returns Drop ARIA props and state\n */\nexport function createDrop(props: Accessor<AriaDropOptions>): DropAria {\n const getProps = createMemo(() => props());\n\n const state = createDropState(() => ({\n getDropOperation: getProps().getDropOperation,\n onDropEnter: getProps().onDropEnter,\n onDropMove: getProps().onDropMove,\n onDropActivate: getProps().onDropActivate,\n onDropExit: getProps().onDropExit,\n onDrop: getProps().onDrop,\n hasDropButton: getProps().hasDropButton,\n isDisabled: getProps().isDisabled,\n }));\n\n let x = 0;\n let y = 0;\n let dragOverElements = new Set<Element>();\n let dropEffect: DataTransfer[\"dropEffect\"] = \"none\";\n let allowedOperations = DROP_OPERATION.all;\n let dropActivateTimer: ReturnType<typeof setTimeout> | undefined;\n\n const fireDropEnter = (e: DragEvent) => {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.enterTarget(e.clientX - rect.x, e.clientY - rect.y);\n };\n\n const fireDropExit = (e: DragEvent) => {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.exitTarget(e.clientX - rect.x, e.clientY - rect.y);\n };\n\n const getAllowedOperations = (e: DragEvent): number => {\n let allowed =\n DROP_OPERATION_ALLOWED[e.dataTransfer?.effectAllowed ?? \"none\"] ?? DROP_OPERATION.none;\n\n // Use global allowed operations if set (for internal drags)\n const globalAllowed = getGlobalAllowedDropOperations();\n if (globalAllowed) {\n allowed &= globalAllowed;\n }\n\n let modifierAllowed = DROP_OPERATION.none;\n\n // macOS: Alt=copy, Ctrl=link, Cmd=move\n // Windows/Linux: Alt=link, Shift=move, Ctrl=copy\n const isMac = typeof navigator !== \"undefined\" && /mac/i.test(navigator.platform);\n\n if (isMac) {\n if (e.altKey) modifierAllowed |= DROP_OPERATION.copy;\n if (e.ctrlKey) modifierAllowed |= DROP_OPERATION.link;\n if (e.metaKey) modifierAllowed |= DROP_OPERATION.move;\n } else {\n if (e.altKey) modifierAllowed |= DROP_OPERATION.link;\n if (e.shiftKey) modifierAllowed |= DROP_OPERATION.move;\n if (e.ctrlKey) modifierAllowed |= DROP_OPERATION.copy;\n }\n\n if (modifierAllowed) {\n return allowed & modifierAllowed;\n }\n\n return allowed;\n };\n\n const allowedOperationsToArray = (ops: number): DropOperation[] => {\n const result: DropOperation[] = [];\n if (ops & DROP_OPERATION.move) result.push(\"move\");\n if (ops & DROP_OPERATION.copy) result.push(\"copy\");\n if (ops & DROP_OPERATION.link) result.push(\"link\");\n return result;\n };\n\n const getDropOperationForAllowed = (allowed: number, operation: DropOperation): DropOperation => {\n const op = DROP_OPERATION[operation];\n return allowed & op ? operation : \"cancel\";\n };\n\n const onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n dragOverElements.add(e.target as Element);\n if (dragOverElements.size > 1) {\n return;\n }\n\n const p = getProps();\n const allowedOpsBits = getAllowedOperations(e);\n const allowedOps = allowedOperationsToArray(allowedOpsBits);\n let dropOp: DropOperation = allowedOps[0] ?? \"cancel\";\n\n if (typeof p.getDropOperation === \"function\" && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n dropOp = getDropOperationForAllowed(allowedOpsBits, p.getDropOperation(types, allowedOps));\n }\n\n if (typeof p.getDropOperationForPoint === \"function\" && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperationForPoint(types, allowedOps, e.clientX - rect.x, e.clientY - rect.y),\n );\n }\n\n x = e.clientX;\n y = e.clientY;\n allowedOperations = allowedOpsBits;\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || \"none\") as DataTransfer[\"dropEffect\"];\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n\n if (dropOp !== \"cancel\") {\n fireDropEnter(e);\n }\n };\n\n const onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const allowedOpsBits = getAllowedOperations(e);\n\n // Skip if position and operations haven't changed\n if (e.clientX === x && e.clientY === y && allowedOpsBits === allowedOperations) {\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n return;\n }\n\n x = e.clientX;\n y = e.clientY;\n\n const prevDropEffect = dropEffect;\n const p = getProps();\n\n if (allowedOpsBits !== allowedOperations) {\n const allowedOps = allowedOperationsToArray(allowedOpsBits);\n let dropOp: DropOperation = allowedOps[0] ?? \"cancel\";\n\n if (typeof p.getDropOperation === \"function\" && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n dropOp = getDropOperationForAllowed(allowedOpsBits, p.getDropOperation(types, allowedOps));\n }\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || \"none\") as DataTransfer[\"dropEffect\"];\n }\n\n if (typeof p.getDropOperationForPoint === \"function\" && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperationForPoint(\n types,\n allowedOperationsToArray(allowedOpsBits),\n x - rect.x,\n y - rect.y,\n ),\n );\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || \"none\") as DataTransfer[\"dropEffect\"];\n }\n\n allowedOperations = allowedOpsBits;\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n\n if (dropEffect === \"none\" && prevDropEffect !== \"none\") {\n fireDropExit(e);\n } else if (dropEffect !== \"none\" && prevDropEffect === \"none\") {\n fireDropEnter(e);\n }\n\n if (dropEffect !== \"none\") {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.moveInTarget(x - rect.x, y - rect.y);\n }\n\n clearTimeout(dropActivateTimer);\n\n if (typeof p.onDropActivate === \"function\" && dropEffect !== \"none\") {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const activateX = x - rect.x;\n const activateY = y - rect.y;\n dropActivateTimer = setTimeout(() => {\n state.activateTarget(activateX, activateY);\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n const onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Track drag over elements (WebKit workaround for relatedTarget being null)\n dragOverElements.delete(e.target as Element);\n\n for (const element of dragOverElements) {\n if (!e.currentTarget || !(e.currentTarget as Element).contains(element)) {\n dragOverElements.delete(element);\n }\n }\n\n if (dragOverElements.size > 0) {\n return;\n }\n\n if (dropEffect !== \"none\") {\n fireDropExit(e);\n }\n\n clearTimeout(dropActivateTimer);\n };\n\n const onDropHandler = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Track drop effect globally for Chrome Android\n setGlobalDropEffect(dropEffect);\n\n const p = getProps();\n if (typeof p.onDrop === \"function\" && e.dataTransfer) {\n const items = readFromDataTransfer(e.dataTransfer);\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n\n state.drop(e.clientX - rect.x, e.clientY - rect.y, items, dropOperation);\n }\n\n dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(dropActivateTimer);\n };\n\n const dropProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {};\n }\n\n const baseProps: Record<string, unknown> = {\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop: onDropHandler,\n };\n\n return baseProps;\n });\n\n const dropButtonProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: \"button\" as const,\n \"aria-label\": \"Drop\",\n };\n });\n\n return {\n get dropProps() {\n return dropProps() as DropAria[\"dropProps\"];\n },\n get isDropTarget() {\n return state.isDropTarget;\n },\n get dropButtonProps() {\n return dropButtonProps() as DropAria[\"dropButtonProps\"];\n },\n };\n}\n","/**\n * createDroppableCollection - ARIA hook for droppable collection targets.\n *\n * Provides accessibility support for dropping items into a collection\n * component like ListBox, GridList, or Table.\n */\n\nimport { createMemo, onCleanup, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type {\n DroppableCollectionState,\n DropTarget,\n DropOperation,\n DropItem,\n DragTypes,\n Key,\n} from \"@proyecto-viviana/solid-stately\";\nimport { DIRECTORY_DRAG_TYPE } from \"@proyecto-viviana/solid-stately\";\nimport { createDrop } from \"./createDrop\";\nimport {\n getGlobalDraggingCollectionRef,\n getGlobalDraggingKeys,\n getGlobalDraggingTypes,\n} from \"./createDraggableCollection\";\nimport { getGlobalAllowedDropOperations, DROP_OPERATION } from \"./utils\";\n\n// Global state for tracking the drop collection\nlet globalDropCollectionRef: HTMLElement | null = null;\n\nexport function setGlobalDropCollectionRef(ref: HTMLElement | null): void {\n globalDropCollectionRef = ref;\n}\n\nexport function getGlobalDropCollectionRef(): HTMLElement | null {\n return globalDropCollectionRef;\n}\n\nexport interface DropTargetDelegate {\n /**\n * Returns a drop target from a point within the collection.\n */\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n /**\n * Returns the next keyboard-navigable drop target.\n */\n getKeyboardNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n /**\n * Returns the next page-navigable drop target.\n */\n getKeyboardPageNavigationTarget?(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null;\n}\n\nexport interface KeyboardDelegateLike {\n getFirstKey?: () => string | number | null;\n getLastKey?: () => string | number | null;\n getKeyBelow?: (key: string | number) => string | number | null;\n getKeyAbove?: (key: string | number) => string | number | null;\n getKeyRightOf?: (key: string | number) => string | number | null;\n getKeyLeftOf?: (key: string | number) => string | number | null;\n getKeyPageBelow?: (key: string | number) => string | number | null;\n getKeyPageAbove?: (key: string | number) => string | number | null;\n}\n\ninterface CollectionNodeLike {\n type?: string;\n key: Key;\n parentKey?: Key | null;\n childNodes?: CollectionNodeLike[];\n isExpanded?: boolean;\n}\n\ninterface CollectionLike {\n getItem(key: Key): CollectionNodeLike | null;\n [Symbol.iterator](): Iterator<CollectionNodeLike>;\n}\n\nexport interface DroppableCollectionOptions {\n /** Reference to the collection element. */\n ref: Accessor<HTMLElement | null>;\n /** A delegate that provides drop targets for pointer coordinates. */\n dropTargetDelegate: DropTargetDelegate;\n /** Handler called when items are dropped to be inserted. */\n onInsert?: (e: { items: DropItem[]; target: DropTarget; dropOperation: DropOperation }) => void;\n /** Handler called when items are dropped on the root. */\n onRootDrop?: (e: { items: DropItem[]; dropOperation: DropOperation }) => void;\n /** Handler called when items are dropped on an item. */\n onItemDrop?: (e: {\n items: DropItem[];\n target: DropTarget;\n dropOperation: DropOperation;\n isInternal: boolean;\n }) => void;\n /** Handler called when items are reordered within the collection. */\n onReorder?: (e: {\n keys: Set<string | number>;\n target: DropTarget;\n dropOperation: DropOperation;\n }) => void;\n /** Handler called when items are moved within/between collections. */\n onMove?: (e: {\n keys: Set<string | number>;\n target: DropTarget;\n dropOperation: DropOperation;\n }) => void;\n /** Handler called when a drop occurs on any collection target. */\n onDrop?: (e: {\n items: DropItem[];\n target: DropTarget;\n dropOperation: DropOperation;\n x: number;\n y: number;\n }) => void;\n /** Handler called when the drop target is activated (held over). */\n onDropActivate?: (e: { target: DropTarget; x: number; y: number }) => void;\n /** Optional keyboard delegate used as fallback when drop-target delegates do not provide keyboard navigation methods. */\n keyboardDelegate?: KeyboardDelegateLike;\n /** Optional keyboard handler composed with internal drop target navigation keys. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Collection snapshot used to restore focus and selection after a drop mutates items. */\n collection?: CollectionLike;\n /** Current collection selection used to avoid replacing user-updated selection after a drop. */\n selectedKeys?: \"all\" | Iterable<Key>;\n /** Sets collection selection after a drop when new rows were inserted and selection was unchanged. */\n setSelectedKeys?: (keys: Set<Key>) => void;\n /** Sets collection focus after a drop when new rows were inserted. */\n setFocusedKey?: (key: Key | null) => void;\n /** Whether the collection is disabled for dropping. */\n isDisabled?: boolean;\n /** Accepted drag types. 'all' accepts any type. */\n acceptedDragTypes?: \"all\" | Array<string | symbol>;\n}\n\nexport function getDropItemTypes(item: DropItem): Set<string | symbol> {\n if (item.kind === \"file\") {\n return new Set([item.type]);\n }\n if (item.kind === \"text\") {\n return new Set(item.types);\n }\n return new Set([DIRECTORY_DRAG_TYPE]);\n}\n\nexport interface DroppableCollectionAria {\n /** Props to spread on the collection element. */\n collectionProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Creates ARIA support for a droppable collection.\n *\n * @param options - Collection options accessor\n * @param state - Droppable collection state\n * @returns Droppable collection ARIA result\n */\nexport function createDroppableCollection(\n options: Accessor<DroppableCollectionOptions>,\n state: DroppableCollectionState,\n): DroppableCollectionAria {\n const getOptions = createMemo(() => options());\n\n // Track the next target during drag operations\n let nextTarget: DropTarget | null = null;\n let currentDropOperation: DropOperation | null = null;\n\n const isInternalDropOperation = (): boolean => {\n const ref = getOptions().ref();\n const draggingRef = getGlobalDraggingCollectionRef();\n return ref !== null && draggingRef === ref;\n };\n\n const getDropOperationForTarget = (\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[],\n ): DropOperation => {\n return state.getDropOperation(target, types, allowedOperations);\n };\n\n // Create base drop behavior\n const drop = createDrop(() => ({\n isDisabled: getOptions().isDisabled,\n getDropOperationForPoint: (types, allowedOperations, x, y) => {\n const opts = getOptions();\n const isValidDropTarget = (target: DropTarget) =>\n getDropOperationForTarget(target, types, allowedOperations) !== \"cancel\";\n\n const target = opts.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);\n\n if (!target) {\n currentDropOperation = \"cancel\";\n nextTarget = null;\n return \"cancel\";\n }\n\n currentDropOperation = getDropOperationForTarget(target, types, allowedOperations);\n\n // If target doesn't accept, try root\n if (currentDropOperation === \"cancel\") {\n const rootTarget: DropTarget = { type: \"root\" };\n const rootOp = getDropOperationForTarget(rootTarget, types, allowedOperations);\n if (rootOp !== \"cancel\") {\n nextTarget = rootTarget;\n currentDropOperation = rootOp;\n return currentDropOperation;\n }\n }\n\n // Update drop collection ref\n const ref = opts.ref();\n if (target && currentDropOperation !== \"cancel\" && ref !== globalDropCollectionRef) {\n setGlobalDropCollectionRef(ref);\n }\n\n nextTarget = currentDropOperation === \"cancel\" ? null : target;\n return currentDropOperation;\n },\n onDropEnter: () => {\n if (nextTarget) {\n state.setTarget(nextTarget);\n }\n },\n onDropMove: () => {\n if (nextTarget) {\n state.setTarget(nextTarget);\n }\n },\n onDropExit: () => {\n setGlobalDropCollectionRef(null);\n state.setTarget(null);\n },\n onDropActivate: (e) => {\n const opts = getOptions();\n if (\n state.target?.type === \"item\" &&\n state.target.dropPosition === \"on\" &&\n typeof opts.onDropActivate === \"function\"\n ) {\n opts.onDropActivate({\n target: state.target,\n x: e.x,\n y: e.y,\n });\n }\n },\n onDrop: (e) => {\n const opts = getOptions();\n setGlobalDropCollectionRef(opts.ref());\n\n if (state.target) {\n const target = state.target;\n const previousCollection = opts.collection;\n const previousSelectedKeys = normalizeSelection(opts.selectedKeys);\n opts.onDrop?.({\n items: e.items,\n target,\n dropOperation: e.dropOperation,\n x: e.x,\n y: e.y,\n });\n void Promise.resolve(handleDrop(e.items, target, e.dropOperation)).then(() => {\n queueMicrotask(() => {\n updateFocusAfterDrop(getOptions(), previousCollection, previousSelectedKeys, target);\n });\n });\n }\n },\n }));\n\n const handleDrop = async (\n items: DropItem[],\n target: DropTarget,\n dropOperation: DropOperation,\n ) => {\n const opts = getOptions();\n const isInternal = isInternalDropOperation();\n\n // Filter items by accepted types\n let filteredItems = items;\n const acceptedTypes = opts.acceptedDragTypes;\n if (acceptedTypes && acceptedTypes !== \"all\") {\n filteredItems = items.filter((item) => {\n const itemTypes = getDropItemTypes(item);\n return acceptedTypes.some((type) => itemTypes.has(type));\n });\n }\n\n if (filteredItems.length === 0) return;\n\n // Call appropriate handlers based on target type\n if (target.type === \"root\" && opts.onRootDrop) {\n await opts.onRootDrop({ items: filteredItems, dropOperation });\n }\n\n if (target.type === \"item\") {\n if (target.dropPosition === \"on\" && opts.onItemDrop) {\n await opts.onItemDrop({\n items: filteredItems,\n target,\n dropOperation,\n isInternal,\n });\n }\n\n // Handle move for internal operations\n if (opts.onMove && isInternal) {\n const draggingKeys = getGlobalDraggingKeys();\n await opts.onMove({\n keys: draggingKeys,\n target,\n dropOperation,\n });\n }\n\n if (target.dropPosition !== \"on\") {\n if (!isInternal && opts.onInsert) {\n await opts.onInsert({\n items: filteredItems,\n target,\n dropOperation,\n });\n }\n\n if (isInternal && opts.onReorder) {\n const draggingKeys = getGlobalDraggingKeys();\n await opts.onReorder({\n keys: draggingKeys,\n target,\n dropOperation,\n });\n }\n }\n }\n };\n\n // Clean up on unmount\n onCleanup(() => {\n const ref = getOptions().ref();\n if (globalDropCollectionRef === ref) {\n setGlobalDropCollectionRef(null);\n }\n });\n\n const collectionProps = createMemo(() => {\n const baseDropProps = drop.dropProps;\n const onKeyDownBase = baseDropProps.onKeyDown as ((e: KeyboardEvent) => void) | undefined;\n const onKeyDown = (e: KeyboardEvent): void => {\n onKeyDownBase?.(e);\n const opts = getOptions();\n if (opts.isDisabled) return;\n const resolveDirection = (): \"ltr\" | \"rtl\" => {\n const refEl = opts.ref();\n if (\n refEl &&\n typeof window !== \"undefined\" &&\n typeof window.getComputedStyle === \"function\"\n ) {\n const computedDir = window.getComputedStyle(refEl).direction;\n if (computedDir === \"rtl\") return \"rtl\";\n }\n return typeof document !== \"undefined\" && document.dir === \"rtl\" ? \"rtl\" : \"ltr\";\n };\n const isRtl = resolveDirection() === \"rtl\";\n const forwardHorizontalKey = isRtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backwardHorizontalKey = isRtl ? \"ArrowRight\" : \"ArrowLeft\";\n const callUserOnKeyDown = () => opts.onKeyDown?.(e);\n const getKeyboardAllowedOperations = (): DropOperation[] => {\n const allowedBits = getGlobalAllowedDropOperations();\n if (!allowedBits) return [\"copy\", \"move\", \"link\"];\n const allowed: DropOperation[] = [];\n if (allowedBits & DROP_OPERATION.copy) allowed.push(\"copy\");\n if (allowedBits & DROP_OPERATION.move) allowed.push(\"move\");\n if (allowedBits & DROP_OPERATION.link) allowed.push(\"link\");\n return allowed.length > 0 ? allowed : [\"copy\", \"move\", \"link\"];\n };\n const getKeyboardDragTypes = (): DragTypes => {\n const draggingTypes = getGlobalDraggingTypes();\n if (draggingTypes.size === 0) {\n return { has: () => true };\n }\n return {\n has: (type: string | symbol) => typeof type === \"string\" && draggingTypes.has(type),\n };\n };\n const isValidDropTarget = (target: DropTarget) =>\n state.getDropOperation(target, getKeyboardDragTypes(), getKeyboardAllowedOperations()) !==\n \"cancel\";\n const targetsEqual = (a: DropTarget, b: DropTarget): boolean => {\n if (a.type !== b.type) return false;\n if (a.type === \"root\" && b.type === \"root\") return true;\n if (a.type !== \"item\" || b.type !== \"item\") return false;\n return a.key === b.key && a.dropPosition === b.dropPosition;\n };\n const findNextValidTarget = (\n start: DropTarget | null,\n getNext: (target: DropTarget | null) => DropTarget | null,\n ): DropTarget | null => {\n let current = start;\n let seenRoot = 0;\n let safety = 0;\n while (safety < 256) {\n safety += 1;\n const next = getNext(current);\n if (!next) return null;\n if (current && targetsEqual(current, next)) {\n return isValidDropTarget(next) ? next : null;\n }\n current = next;\n if (next.type === \"root\") {\n seenRoot += 1;\n if (seenRoot >= 2) {\n return isValidDropTarget(next) ? next : null;\n }\n }\n if (isValidDropTarget(next)) return next;\n }\n return null;\n };\n const resolveTargetForKey = (\n key: string | number | null,\n direction: \"next\" | \"previous\",\n ): DropTarget | null => {\n if (key == null) return null;\n const onTarget: DropTarget = { type: \"item\", key, dropPosition: \"on\" };\n if (isValidDropTarget(onTarget)) return onTarget;\n const insertionOrder: Array<\"before\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"after\"] : [\"after\", \"before\"];\n for (const position of insertionOrder) {\n const insertionTarget: DropTarget = { type: \"item\", key, dropPosition: position };\n if (isValidDropTarget(insertionTarget)) return insertionTarget;\n }\n return null;\n };\n const resolveBoundaryTargetForDirection = (\n key: string | number | null,\n direction: \"next\" | \"previous\",\n ): DropTarget | null => {\n if (key == null) return null;\n const boundaryOrder: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const position of boundaryOrder) {\n const candidate: DropTarget = { type: \"item\", key, dropPosition: position };\n if (isValidDropTarget(candidate)) return candidate;\n }\n return null;\n };\n const resolveFallbackKeyboardTarget = (\n keyName: string,\n currentTarget: DropTarget | null = state.target,\n ): DropTarget | null => {\n const keyboardDelegate = opts.keyboardDelegate;\n if (!keyboardDelegate) return null;\n const currentKey = currentTarget?.type === \"item\" ? currentTarget.key : null;\n const keyForDirection = (\n direction: \"next\" | \"previous\",\n getter: ((key: string | number) => string | number | null) | undefined,\n ): DropTarget | null => {\n if (currentKey == null) {\n const boundaryKey =\n direction === \"next\"\n ? keyboardDelegate.getFirstKey?.()\n : keyboardDelegate.getLastKey?.();\n return resolveBoundaryTargetForDirection(boundaryKey ?? null, direction);\n }\n if (!getter) return null;\n let nextKey = getter(currentKey);\n let safety = 0;\n while (nextKey != null && safety < 256) {\n const resolvedTarget = resolveTargetForKey(nextKey, direction);\n if (resolvedTarget) return resolvedTarget;\n const candidate = getter(nextKey);\n if (candidate === nextKey) break;\n nextKey = candidate;\n safety += 1;\n }\n return null;\n };\n\n if (keyName === \"ArrowDown\") return keyForDirection(\"next\", keyboardDelegate.getKeyBelow);\n if (keyName === \"ArrowUp\") return keyForDirection(\"previous\", keyboardDelegate.getKeyAbove);\n if (keyName === forwardHorizontalKey) {\n return keyForDirection(\n \"next\",\n isRtl ? keyboardDelegate.getKeyLeftOf : keyboardDelegate.getKeyRightOf,\n );\n }\n if (keyName === backwardHorizontalKey) {\n return keyForDirection(\n \"previous\",\n isRtl ? keyboardDelegate.getKeyRightOf : keyboardDelegate.getKeyLeftOf,\n );\n }\n if (keyName === \"Home\")\n return resolveBoundaryTargetForDirection(\n keyboardDelegate.getFirstKey?.() ?? null,\n \"next\",\n );\n if (keyName === \"End\")\n return resolveBoundaryTargetForDirection(\n keyboardDelegate.getLastKey?.() ?? null,\n \"previous\",\n );\n if (keyName === \"PageDown\") {\n if (currentKey != null && keyboardDelegate.getKeyPageBelow) {\n return resolveTargetForKey(keyboardDelegate.getKeyPageBelow(currentKey), \"next\");\n }\n return keyForDirection(\"next\", keyboardDelegate.getKeyBelow);\n }\n if (keyName === \"PageUp\") {\n if (currentKey != null && keyboardDelegate.getKeyPageAbove) {\n return resolveTargetForKey(keyboardDelegate.getKeyPageAbove(currentKey), \"previous\");\n }\n return keyForDirection(\"previous\", keyboardDelegate.getKeyAbove);\n }\n return null;\n };\n const resolvePageTargetForState = (\n direction: \"next\" | \"previous\",\n currentTarget: DropTarget,\n ): DropTarget | null => {\n const keyboardDelegate = opts.keyboardDelegate;\n if (!keyboardDelegate) return null;\n if (direction === \"next\") {\n let targetKey = keyboardDelegate.getFirstKey?.() ?? null;\n let dropPosition: \"before\" | \"on\" | \"after\" = \"after\";\n if (currentTarget.type === \"item\") {\n targetKey = currentTarget.key;\n dropPosition = currentTarget.dropPosition;\n }\n let nextKey =\n targetKey != null ? (keyboardDelegate.getKeyPageBelow?.(targetKey) ?? null) : null;\n if (\n nextKey == null ||\n (currentTarget.type === \"item\" && currentTarget.key === keyboardDelegate.getLastKey?.())\n ) {\n nextKey = keyboardDelegate.getLastKey?.() ?? null;\n dropPosition = \"after\";\n }\n if (nextKey == null) return null;\n return {\n type: \"item\",\n key: nextKey,\n dropPosition,\n };\n }\n\n if (currentTarget.type === \"item\") {\n if (currentTarget.key === keyboardDelegate.getFirstKey?.()) {\n return { type: \"root\" };\n }\n let nextKey = keyboardDelegate.getKeyPageAbove?.(currentTarget.key) ?? null;\n let dropPosition: \"before\" | \"on\" | \"after\" = currentTarget.dropPosition;\n if (nextKey == null) {\n nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n dropPosition = \"before\";\n }\n if (nextKey == null) return null;\n return {\n type: \"item\",\n key: nextKey,\n dropPosition,\n };\n }\n\n return currentTarget.type === \"root\" ? currentTarget : null;\n };\n if (e.key === \"PageDown\" || e.key === \"PageUp\") {\n if (\n (e.key === \"PageDown\" && !opts.keyboardDelegate?.getKeyPageBelow) ||\n (e.key === \"PageUp\" && !opts.keyboardDelegate?.getKeyPageAbove)\n ) {\n callUserOnKeyDown();\n return;\n }\n const direction = e.key === \"PageDown\" ? \"next\" : \"previous\";\n const pageNavigation = opts.dropTargetDelegate.getKeyboardPageNavigationTarget;\n const stepNavigation = opts.dropTargetDelegate.getKeyboardNavigationTarget;\n const resolveStepTarget = (\n target: DropTarget | null,\n navDirection: \"next\" | \"previous\",\n ): DropTarget | null =>\n stepNavigation?.(target, navDirection, isValidDropTarget) ??\n resolveFallbackKeyboardTarget(\n navDirection === \"next\" ? \"ArrowDown\" : \"ArrowUp\",\n target,\n ) ??\n resolveFallbackKeyboardTarget(navDirection === \"next\" ? \"Home\" : \"End\", target) ??\n null;\n let nextTarget: DropTarget | null = null;\n if (!state.target) {\n nextTarget = findNextValidTarget(null, (target) => resolveStepTarget(target, direction));\n } else {\n const pageTarget =\n pageNavigation?.(state.target, direction, isValidDropTarget) ??\n resolvePageTargetForState(direction, state.target) ??\n null;\n if (pageTarget && isValidDropTarget(pageTarget)) {\n nextTarget = pageTarget;\n } else {\n const startTarget = pageTarget ?? state.target;\n nextTarget =\n findNextValidTarget(startTarget, (target) => resolveStepTarget(target, direction)) ??\n findNextValidTarget(startTarget, (target) =>\n resolveStepTarget(target, direction === \"next\" ? \"previous\" : \"next\"),\n );\n }\n }\n if (nextTarget) {\n e.preventDefault();\n state.setTarget(nextTarget);\n }\n callUserOnKeyDown();\n return;\n }\n if (\n (e.key === \"ArrowDown\" ||\n e.key === \"ArrowUp\" ||\n e.key === \"ArrowRight\" ||\n e.key === \"ArrowLeft\" ||\n e.key === \"Home\" ||\n e.key === \"End\") &&\n opts.dropTargetDelegate.getKeyboardNavigationTarget\n ) {\n if (\n (e.key === \"ArrowDown\" && !opts.keyboardDelegate?.getKeyBelow) ||\n (e.key === \"ArrowUp\" && !opts.keyboardDelegate?.getKeyAbove) ||\n (e.key === \"ArrowLeft\" && !opts.keyboardDelegate?.getKeyLeftOf) ||\n (e.key === \"ArrowRight\" && !opts.keyboardDelegate?.getKeyRightOf) ||\n (e.key === \"Home\" && !opts.keyboardDelegate?.getFirstKey) ||\n (e.key === \"End\" && !opts.keyboardDelegate?.getLastKey)\n ) {\n callUserOnKeyDown();\n return;\n }\n const isForwardKey =\n e.key === \"ArrowDown\" || e.key === forwardHorizontalKey || e.key === \"Home\";\n const direction = isForwardKey ? \"next\" : \"previous\";\n const navigationStart = e.key === \"Home\" || e.key === \"End\" ? null : state.target;\n const nextTarget = findNextValidTarget(\n navigationStart,\n (target) =>\n opts.dropTargetDelegate.getKeyboardNavigationTarget?.(\n target,\n direction,\n isValidDropTarget,\n ) ?? resolveFallbackKeyboardTarget(e.key, target),\n );\n if (nextTarget) {\n e.preventDefault();\n state.setTarget(nextTarget);\n }\n callUserOnKeyDown();\n return;\n }\n if (\n e.key === \"ArrowDown\" ||\n e.key === \"ArrowUp\" ||\n e.key === \"ArrowRight\" ||\n e.key === \"ArrowLeft\" ||\n e.key === \"Home\" ||\n e.key === \"End\"\n ) {\n if (\n (e.key === \"ArrowDown\" && !opts.keyboardDelegate?.getKeyBelow) ||\n (e.key === \"ArrowUp\" && !opts.keyboardDelegate?.getKeyAbove) ||\n (e.key === \"ArrowLeft\" && !opts.keyboardDelegate?.getKeyLeftOf) ||\n (e.key === \"ArrowRight\" && !opts.keyboardDelegate?.getKeyRightOf) ||\n (e.key === \"Home\" && !opts.keyboardDelegate?.getFirstKey) ||\n (e.key === \"End\" && !opts.keyboardDelegate?.getLastKey)\n ) {\n callUserOnKeyDown();\n return;\n }\n const navigationStart = e.key === \"Home\" || e.key === \"End\" ? null : state.target;\n const nextTarget = findNextValidTarget(navigationStart, (target) =>\n resolveFallbackKeyboardTarget(e.key, target),\n );\n if (nextTarget) {\n e.preventDefault();\n state.setTarget(nextTarget);\n }\n callUserOnKeyDown();\n return;\n }\n if (e.key === \"Enter\" && state.target) {\n e.preventDefault();\n state.activateTarget(0, 0);\n callUserOnKeyDown();\n return;\n }\n if (e.key === \"Escape\" && state.target) {\n e.preventDefault();\n state.exitTarget(0, 0);\n callUserOnKeyDown();\n return;\n }\n callUserOnKeyDown();\n };\n return {\n ...baseDropProps,\n onKeyDown,\n };\n });\n\n return {\n get collectionProps() {\n return collectionProps() as DroppableCollectionAria[\"collectionProps\"];\n },\n };\n}\n\nfunction normalizeSelection(selection: \"all\" | Iterable<Key> | undefined): \"all\" | Set<Key> | null {\n if (selection == null) return null;\n if (selection === \"all\") return \"all\";\n return new Set(selection);\n}\n\nfunction selectionEquals(a: \"all\" | Set<Key> | null, b: \"all\" | Set<Key> | null): boolean {\n if (a === b) return true;\n if (!a || !b || a === \"all\" || b === \"all\") return false;\n if (a.size !== b.size) return false;\n for (const key of a) {\n if (!b.has(key)) return false;\n }\n return true;\n}\n\nfunction getNewItemKeys(collection: CollectionLike, previousCollection: CollectionLike): Set<Key> {\n const keys = new Set<Key>();\n const visit = (node: CollectionNodeLike) => {\n if (node.type === \"item\" && !previousCollection.getItem(node.key)) {\n keys.add(node.key);\n }\n for (const child of node.childNodes ?? []) {\n visit(child);\n }\n };\n\n for (const node of collection) {\n visit(node);\n }\n return keys;\n}\n\nfunction updateFocusAfterDrop(\n opts: DroppableCollectionOptions,\n previousCollection: CollectionLike | undefined,\n previousSelectedKeys: \"all\" | Set<Key> | null,\n target: DropTarget,\n): void {\n const collection = opts.collection;\n if (!collection || !previousCollection) return;\n\n const newKeys = getNewItemKeys(collection, previousCollection);\n if (newKeys.size === 0) return;\n\n const currentSelectedKeys = normalizeSelection(opts.selectedKeys);\n if (\n opts.setSelectedKeys &&\n previousSelectedKeys &&\n selectionEquals(previousSelectedKeys, currentSelectedKeys)\n ) {\n opts.setSelectedKeys(newKeys);\n }\n\n const first = newKeys.values().next().value;\n if (first == null) return;\n\n let focusKey: Key | null = first;\n const item = collection.getItem(first);\n const parent = item?.parentKey != null ? collection.getItem(item.parentKey) : null;\n const isDroppedOnCollapsedParent =\n target.type === \"item\" &&\n target.dropPosition === \"on\" &&\n item?.parentKey != null &&\n parent?.isExpanded !== true;\n\n if (item && (item.type === \"cell\" || item.type === \"rowheader\" || isDroppedOnCollapsedParent)) {\n focusKey = item.parentKey ?? first;\n }\n\n opts.setFocusedKey?.(focusKey);\n\n queueMicrotask(() => {\n const row = opts.ref()?.querySelector<HTMLElement>('[role=\"row\"][tabindex=\"0\"]');\n row?.focus();\n });\n}\n","/**\n * createDraggableItem - ARIA hook for draggable items within a collection.\n *\n * Provides accessibility props for items that can be dragged from a collection.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type {\n DraggableCollectionState,\n DragPreviewRenderer,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n getTypes,\n writeToDataTransfer,\n DROP_OPERATION,\n EFFECT_ALLOWED,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalAllowedDropOperations,\n setGlobalDropEffect,\n getGlobalDropEffect,\n} from \"./utils\";\nimport { setGlobalDraggingTypes } from \"./createDraggableCollection\";\n\nexport interface DraggableItemOptions {\n /** The unique key of the item. */\n key: string | number;\n /** Whether the item has a separate drag button affordance. */\n hasDragButton?: boolean;\n /** Whether this item is disabled for dragging. */\n isDisabled?: boolean;\n /** Preview renderer function ref. */\n preview?: { current: DragPreviewRenderer | null };\n}\n\nexport interface DraggableItemAria {\n /** Props for the draggable item element. */\n dragProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Whether the item is currently being dragged. */\n isDragging: boolean;\n}\n\n/**\n * Creates ARIA props for a draggable item within a collection.\n *\n * @param options - Accessor returning item options\n * @param state - Draggable collection state\n * @returns Draggable item ARIA props\n */\nexport function createDraggableItem(\n options: Accessor<DraggableItemOptions>,\n state: DraggableCollectionState,\n): DraggableItemAria {\n const getOptions = createMemo(() => options());\n\n // Track position for drag move\n let lastX = 0;\n let lastY = 0;\n\n const isDragging = createMemo(() => {\n const key = getOptions().key;\n return state.draggingKeys.has(key);\n });\n\n const getKeysForDrag = (): Set<string | number> => {\n const { key } = getOptions();\n // If the key is not selected, only drag that item\n // If it is selected, drag all selected items\n // For now, just return the single key\n return new Set([key]);\n };\n\n const onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) return;\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled || state.isDisabled) return;\n\n const keys = getKeysForDrag();\n\n // Start drag state\n state.startDrag(keys, e.clientX, e.clientY);\n\n // Get items and write to data transfer\n const items = state.getItems(keys);\n setGlobalDraggingTypes(getTypes(items));\n e.dataTransfer?.clearData?.();\n if (e.dataTransfer) {\n writeToDataTransfer(e.dataTransfer, items);\n }\n\n // Set allowed drop operations\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n const effectAllowed = EFFECT_ALLOWED[allowed] || \"none\";\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = (\n effectAllowed === \"cancel\" ? \"none\" : effectAllowed\n ) as DataTransfer[\"effectAllowed\"];\n }\n\n // Handle custom preview from item options or collection state.\n const preview = opts.preview ?? state.preview;\n if (typeof preview?.current === \"function\" && e.dataTransfer) {\n preview.current(items, (node, userX, userY) => {\n if (!node || !e.dataTransfer) return;\n\n const size = node.getBoundingClientRect();\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let defaultX = e.clientX - rect.x;\n let defaultY = e.clientY - rect.y;\n\n if (defaultX > size.width || defaultY > size.height) {\n defaultX = size.width / 2;\n defaultY = size.height / 2;\n }\n\n let offsetX = typeof userX === \"number\" ? userX : defaultX;\n let offsetY = typeof userY === \"number\" ? userY : defaultY;\n\n offsetX = Math.max(0, Math.min(offsetX, size.width));\n offsetY = Math.max(0, Math.min(offsetY, size.height));\n\n e.dataTransfer.setDragImage(node, offsetX, offsetY);\n });\n }\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDrag = (e: DragEvent) => {\n e.stopPropagation();\n\n if (e.clientX === lastX && e.clientY === lastY) {\n return;\n }\n\n state.moveDrag(e.clientX, e.clientY);\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDragEnd = (e: DragEvent) => {\n e.stopPropagation();\n\n let dropEffect: string = e.dataTransfer?.dropEffect ?? \"none\";\n // Chrome Android fix - use global drop effect\n if (getGlobalDropEffect()) {\n dropEffect = getGlobalDropEffect()!;\n }\n\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n const isInternal = false; // Would check global state\n state.endDrag(e.clientX, e.clientY, dropOperation, isInternal);\n\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDraggingTypes(new Set());\n setGlobalDropEffect(undefined);\n };\n\n // Keyboard/screen reader drag initiation\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Enter\" && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \"Enter\" && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled || state.isDisabled) return;\n\n const keys = getKeysForDrag();\n const rect = (e.target as HTMLElement).getBoundingClientRect();\n state.startDrag(keys, rect.x + rect.width / 2, rect.y + rect.height / 2);\n const items = state.getItems(keys);\n setGlobalDraggingTypes(getTypes(items));\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n setGlobalAllowedDropOperations(allowed);\n }\n };\n\n const dragProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled || state.isDisabled) {\n return {\n draggable: false as const,\n };\n }\n\n const baseProps: Record<string, unknown> = {\n draggable: true as const,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n // Add keyboard handlers if no separate drag button\n if (!opts.hasDragButton) {\n baseProps.onKeyDown = onKeyDown;\n baseProps.onKeyUp = onKeyUp;\n }\n\n return baseProps;\n });\n\n const dragButtonProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled || state.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: \"button\" as const,\n \"aria-label\": \"Drag\",\n onKeyDown,\n onKeyUp,\n };\n });\n\n return {\n get dragProps() {\n return dragProps() as DraggableItemAria[\"dragProps\"];\n },\n get dragButtonProps() {\n return dragButtonProps() as DraggableItemAria[\"dragButtonProps\"];\n },\n get isDragging() {\n return isDragging();\n },\n };\n}\n","/**\n * createDroppableItem - ARIA hook for droppable items within a collection.\n *\n * Provides accessibility props for items that can receive drops.\n */\n\nimport { createMemo, type Accessor } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\nimport type {\n DroppableCollectionState,\n DropTarget,\n DropOperation,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n DragTypesImpl,\n DROP_OPERATION,\n DROP_OPERATION_ALLOWED,\n DROP_OPERATION_TO_DROP_EFFECT,\n getGlobalAllowedDropOperations,\n} from \"./utils\";\n\nexport interface DroppableItemOptions {\n /** The unique key of the item. */\n key: string | number;\n /** Reference to the item element. */\n ref: Accessor<HTMLElement | null>;\n /** Whether this item is disabled for dropping. */\n isDisabled?: boolean;\n}\n\nexport interface DroppableItemAria {\n /** Props for the droppable item element. */\n dropProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the item is currently a drop target. */\n isDropTarget: boolean;\n}\n\n/**\n * Creates ARIA props for a droppable item within a collection.\n *\n * @param options - Accessor returning item options\n * @param state - Droppable collection state\n * @returns Droppable item ARIA props\n */\nexport function createDroppableItem(\n options: Accessor<DroppableItemOptions>,\n state: DroppableCollectionState,\n): DroppableItemAria {\n const getOptions = createMemo(() => options());\n\n const isDropTarget = createMemo(() => {\n const { key } = getOptions();\n const target = state.target;\n return target?.type === \"item\" && target.key === key;\n });\n\n const getTarget = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget => {\n const { key } = getOptions();\n return {\n type: \"item\",\n key,\n dropPosition,\n };\n };\n\n const getDropOperation = (e: DragEvent, target: DropTarget): DropOperation => {\n if (!e.dataTransfer) return \"cancel\";\n\n const types = new DragTypesImpl(e.dataTransfer);\n let allowedBits = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed] || DROP_OPERATION.all;\n\n // Use global allowed operations for internal drags\n const globalAllowed = getGlobalAllowedDropOperations();\n if (globalAllowed) {\n allowedBits &= globalAllowed;\n }\n\n const allowedOperations: DropOperation[] = [];\n if (allowedBits & DROP_OPERATION.move) allowedOperations.push(\"move\");\n if (allowedBits & DROP_OPERATION.copy) allowedOperations.push(\"copy\");\n if (allowedBits & DROP_OPERATION.link) allowedOperations.push(\"link\");\n\n return state.getDropOperation(target, types, allowedOperations);\n };\n\n let dropActivateTimer: ReturnType<typeof setTimeout> | undefined;\n const DROP_ACTIVATE_TIMEOUT = 800;\n\n const onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled) return;\n\n // Determine drop position based on cursor position\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const x = e.clientX - rect.x;\n const y = e.clientY - rect.y;\n const height = rect.height;\n\n let dropPosition: \"before\" | \"on\" | \"after\";\n if (y < height * 0.25) {\n dropPosition = \"before\";\n } else if (y > height * 0.75) {\n dropPosition = \"after\";\n } else {\n dropPosition = \"on\";\n }\n\n const target = getTarget(dropPosition);\n const operation = getDropOperation(e, target);\n\n if (operation !== \"cancel\") {\n state.setTarget(target);\n e.dataTransfer!.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[\n operation\n ] as DataTransfer[\"dropEffect\"];\n }\n };\n\n const onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled) return;\n\n // Update drop position based on cursor\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const x = e.clientX - rect.x;\n const y = e.clientY - rect.y;\n const height = rect.height;\n\n let dropPosition: \"before\" | \"on\" | \"after\";\n if (y < height * 0.25) {\n dropPosition = \"before\";\n } else if (y > height * 0.75) {\n dropPosition = \"after\";\n } else {\n dropPosition = \"on\";\n }\n\n const target = getTarget(dropPosition);\n const operation = getDropOperation(e, target);\n\n if (operation !== \"cancel\") {\n state.setTarget(target);\n e.dataTransfer!.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[\n operation\n ] as DataTransfer[\"dropEffect\"];\n\n // Handle drop activate for 'on' position\n clearTimeout(dropActivateTimer);\n if (dropPosition === \"on\") {\n dropActivateTimer = setTimeout(() => {\n state.activateTarget(x, y);\n }, DROP_ACTIVATE_TIMEOUT);\n }\n } else {\n e.dataTransfer!.dropEffect = \"none\";\n }\n };\n\n const onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n clearTimeout(dropActivateTimer);\n\n // Only clear target if leaving this item\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n const currentTarget = e.currentTarget as HTMLElement;\n if (!relatedTarget || !currentTarget.contains(relatedTarget)) {\n // Clear if no longer over this item\n const { key } = getOptions();\n if (state.target?.type === \"item\" && state.target.key === key) {\n // State clearing handled by parent collection\n }\n }\n };\n\n const onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n clearTimeout(dropActivateTimer);\n\n // Drop handling is done by the parent collection\n };\n\n const dropProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled) {\n return {};\n }\n\n return {\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop,\n };\n });\n\n return {\n get dropProps() {\n return dropProps() as DroppableItemAria[\"dropProps\"];\n },\n get isDropTarget() {\n return isDropTarget();\n },\n };\n}\n","/**\n * createVisuallyHidden hook for solidaria\n *\n * Provides styles and props to visually hide content while keeping it\n * accessible to screen readers.\n *\n * Port of react-aria's useVisuallyHidden.\n */\n\nimport { type Accessor, type JSX, createMemo, createSignal } from \"solid-js\";\nimport { createFocusWithin } from \"../interactions/createFocusWithin\";\nimport { access, type MaybeAccessor } from \"../utils\";\nimport { mergeProps } from \"../utils/mergeProps\";\n\nexport interface AriaVisuallyHiddenProps {\n /** Inline styles to merge with the visually hidden styles. */\n style?: JSX.CSSProperties;\n /** Whether the element should become visible when focused (e.g., skip links). */\n isFocusable?: boolean;\n}\n\nexport interface VisuallyHiddenAria {\n /** Props to spread on the visually hidden element. */\n visuallyHiddenProps: Accessor<JSX.HTMLAttributes<HTMLElement>>;\n}\n\n/**\n * CSS styles that visually hide an element while keeping it accessible.\n * These styles ensure the element is read by screen readers but not visible on screen.\n */\nexport const visuallyHiddenStyles: JSX.CSSProperties = {\n border: \"0\",\n clip: \"rect(0 0 0 0)\",\n \"clip-path\": \"inset(50%)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0\",\n position: \"absolute\",\n width: \"1px\",\n \"white-space\": \"nowrap\",\n};\n\n/**\n * Provides props for an element that hides its children visually\n * but keeps content visible to assistive technology.\n *\n * @example\n * ```tsx\n * function SkipLink() {\n * let ref: HTMLAnchorElement | undefined;\n * const { visuallyHiddenProps } = createVisuallyHidden({ isFocusable: true });\n *\n * return (\n * <a\n * ref={ref}\n * href=\"#main-content\"\n * {...visuallyHiddenProps()}\n * >\n * Skip to main content\n * </a>\n * );\n * }\n *\n * // For content that should always be hidden\n * function ScreenReaderOnly(props: ParentProps) {\n * const { visuallyHiddenProps } = createVisuallyHidden();\n *\n * return (\n * <span {...visuallyHiddenProps()}>\n * {props.children}\n * </span>\n * );\n * }\n * ```\n */\nexport function createVisuallyHidden(\n props: MaybeAccessor<AriaVisuallyHiddenProps> = {},\n): VisuallyHiddenAria {\n const [isFocused, setIsFocused] = createSignal(false);\n\n const isFocusable = () => access(props).isFocusable ?? false;\n const style = () => access(props).style;\n\n // Track focus within for focusable visually hidden elements\n const { focusWithinProps } = createFocusWithin({\n get isDisabled() {\n return !isFocusable();\n },\n onFocusWithinChange: (val: boolean) => setIsFocused(val),\n });\n\n // Compute combined styles\n const combinedStyles = createMemo<JSX.CSSProperties | undefined>(() => {\n if (isFocused()) {\n // If focused, show the element (for skip links, etc.)\n return style();\n } else if (style()) {\n return { ...visuallyHiddenStyles, ...style() };\n } else {\n return visuallyHiddenStyles;\n }\n });\n\n const visuallyHiddenProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n ...mergeProps(\n focusWithinProps as unknown as Record<string, unknown>,\n isFocusable()\n ? {\n onFocusIn: () => setIsFocused(true),\n onFocusOut: (e: FocusEvent) => {\n const currentTarget = e.currentTarget as Element | null;\n const relatedTarget = e.relatedTarget as Element | null;\n if (currentTarget && !currentTarget.contains(relatedTarget)) {\n setIsFocused(false);\n }\n },\n }\n : {},\n { style: combinedStyles() },\n ),\n }));\n\n return {\n visuallyHiddenProps,\n };\n}\n","/**\n * createFormReset - Handles form reset events for form fields.\n *\n * Resets the field value to its default when the containing form is reset.\n * Port of @react-aria/utils useFormReset.\n */\n\nimport { type Accessor, createEffect, onCleanup } from \"solid-js\";\n\nexport interface FormResetOptions<T> {\n /** The default value to reset to. */\n defaultValue: T;\n /** Function to set the current value. */\n onReset: (value: T) => void;\n}\n\n/**\n * Listens for form reset events and resets the field value to its default.\n *\n * @example\n * ```tsx\n * createFormReset(\n * () => inputRef,\n * { label: 'Default' },\n * (value) => state.setSelectedKey(value.key)\n * );\n * ```\n */\nexport function createFormReset<T>(\n ref: Accessor<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>,\n defaultValue: T,\n onReset: (value: T) => void,\n): void {\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const form = element.form;\n if (!form) return;\n\n const handleReset = () => {\n onReset(defaultValue);\n };\n\n form.addEventListener(\"reset\", handleReset);\n\n onCleanup(() => {\n form.removeEventListener(\"reset\", handleReset);\n });\n });\n}\n","/**\n * ARIA hooks for StepList components.\n * Provides accessible step list and step item props.\n */\n\nimport type { JSX } from \"solid-js\";\nimport type { StepListState } from \"@proyecto-viviana/solid-stately\";\nimport type { Key } from \"@proyecto-viviana/solid-stately\";\n\nexport interface AriaStepListProps {\n /** Accessible label for the step list. */\n \"aria-label\"?: string;\n /** ID of element that labels the step list. */\n \"aria-labelledby\"?: string;\n}\n\nexport interface StepListAria {\n /** Props for the step list container element. */\n stepListProps: JSX.HTMLAttributes<HTMLOListElement>;\n}\n\n/**\n * Creates ARIA props for a step list container.\n */\nexport function createStepList(props: AriaStepListProps, _state: StepListState): StepListAria {\n return {\n stepListProps: {\n get \"aria-label\"() {\n return props[\"aria-label\"] ?? \"Step List\";\n },\n get \"aria-labelledby\"() {\n return props[\"aria-labelledby\"];\n },\n },\n };\n}\n\nexport interface AriaStepProps {\n /** The key of this step. */\n key: Key;\n}\n\nexport interface StepAria {\n /** Props for the step element (anchor/link). */\n stepProps: JSX.HTMLAttributes<HTMLAnchorElement>;\n /** Accessible text describing the step state. */\n stepStateText: string;\n}\n\n/**\n * Creates ARIA props for an individual step within a step list.\n */\nexport function createStep(props: AriaStepProps, state: StepListState): StepAria {\n const isSelected = () => state.selectedKey() === props.key;\n const isCompleted = () => state.isCompleted(props.key);\n const selectable = () => state.isSelectable(props.key);\n\n const getStepStateText = (): string => {\n if (isSelected()) return \"Current\";\n if (isCompleted()) return \"Completed\";\n return \"Not completed\";\n };\n\n const handleClick: JSX.EventHandler<HTMLAnchorElement, MouseEvent> = (e) => {\n e.preventDefault();\n if (selectable()) {\n state.setSelectedKey(props.key);\n }\n };\n\n const handleKeyDown: JSX.EventHandler<HTMLAnchorElement, KeyboardEvent> = (e) => {\n // Prevent arrow key scrolling — tab order handles navigation\n if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n return;\n }\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (selectable()) {\n state.setSelectedKey(props.key);\n }\n }\n };\n\n return {\n get stepProps() {\n return {\n role: \"link\" as const,\n get \"aria-current\"() {\n return isSelected() ? (\"step\" as const) : undefined;\n },\n get \"aria-disabled\"() {\n return !selectable() ? true : undefined;\n },\n get tabIndex() {\n return selectable() ? 0 : undefined;\n },\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n };\n },\n get stepStateText() {\n return getStepStateText();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAoDA,IAAa,aAAb,MAA+C;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,yBAAyB;CAEzB,YACE,MACA,aACA,eACA,QACA;AACA,OAAK,OAAO;AACZ,OAAK,cAAc;EACnB,MAAM,cAAc,UAAW,eAAe;AAC9C,OAAK,SAAS;AAGd,OAAK,WAAW,eAAe,YAAY;AAC3C,OAAK,UAAU,eAAe,WAAW;AACzC,OAAK,UAAU,eAAe,WAAW;AACzC,OAAK,SAAS,eAAe,UAAU;AAGvC,OAAK,IAAI;AACT,OAAK,IAAI;AAET,MAAI,iBAAiB,cAAc,YAAY,KAAA,KAAa,aAAa;GACvE,MAAM,OAAO,YAAY,uBAAuB;AAChD,QAAK,IAAI,cAAc,UAAU,KAAK;AACtC,QAAK,KAAK,cAAc,WAAW,KA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