@proyecto-viviana/solidaria 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunk/actiongroup.js +207 -0
- package/dist/_chunk/actiongroup.js.map +1 -0
- package/dist/_chunk/actiongroup.jsx +207 -0
- package/dist/_chunk/actiongroup.jsx.map +1 -0
- package/dist/_chunk/ariaHideOutside.js +122 -0
- package/dist/_chunk/ariaHideOutside.js.map +1 -0
- package/dist/_chunk/ariaHideOutside.jsx +122 -0
- package/dist/_chunk/ariaHideOutside.jsx.map +1 -0
- package/dist/_chunk/autocomplete.js +196 -0
- package/dist/_chunk/autocomplete.js.map +1 -0
- package/dist/_chunk/autocomplete.jsx +196 -0
- package/dist/_chunk/autocomplete.jsx.map +1 -0
- package/dist/_chunk/breadcrumbs.js +119 -0
- package/dist/_chunk/breadcrumbs.js.map +1 -0
- package/dist/_chunk/breadcrumbs.jsx +119 -0
- package/dist/_chunk/breadcrumbs.jsx.map +1 -0
- package/dist/_chunk/button.js +276 -0
- package/dist/_chunk/button.js.map +1 -0
- package/dist/_chunk/button.jsx +276 -0
- package/dist/_chunk/button.jsx.map +1 -0
- package/dist/_chunk/calendar.js +1036 -0
- package/dist/_chunk/calendar.js.map +1 -0
- package/dist/_chunk/calendar.jsx +1036 -0
- package/dist/_chunk/calendar.jsx.map +1 -0
- package/dist/_chunk/checkbox.js +234 -0
- package/dist/_chunk/checkbox.js.map +1 -0
- package/dist/_chunk/checkbox.jsx +234 -0
- package/dist/_chunk/checkbox.jsx.map +1 -0
- package/dist/_chunk/color.js +1174 -0
- package/dist/_chunk/color.js.map +1 -0
- package/dist/_chunk/color.jsx +1174 -0
- package/dist/_chunk/color.jsx.map +1 -0
- package/dist/_chunk/combobox.js +436 -0
- package/dist/_chunk/combobox.js.map +1 -0
- package/dist/_chunk/combobox.jsx +436 -0
- package/dist/_chunk/combobox.jsx.map +1 -0
- package/dist/_chunk/createCollator.js +229 -0
- package/dist/_chunk/createCollator.js.map +1 -0
- package/dist/_chunk/createCollator.jsx +223 -0
- package/dist/_chunk/createCollator.jsx.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.js +133 -0
- package/dist/_chunk/createCollectionRowInteraction.js.map +1 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx +133 -0
- package/dist/_chunk/createCollectionRowInteraction.jsx.map +1 -0
- package/dist/_chunk/createField.js +54 -0
- package/dist/_chunk/createField.js.map +1 -0
- package/dist/_chunk/createField.jsx +54 -0
- package/dist/_chunk/createField.jsx.map +1 -0
- package/dist/_chunk/createFocus.js +101 -0
- package/dist/_chunk/createFocus.js.map +1 -0
- package/dist/_chunk/createFocus.jsx +101 -0
- package/dist/_chunk/createFocus.jsx.map +1 -0
- package/dist/_chunk/createFocusRing.js +54 -0
- package/dist/_chunk/createFocusRing.js.map +1 -0
- package/dist/_chunk/createFocusRing.jsx +54 -0
- package/dist/_chunk/createFocusRing.jsx.map +1 -0
- package/dist/_chunk/createFocusWithin.js +121 -0
- package/dist/_chunk/createFocusWithin.js.map +1 -0
- package/dist/_chunk/createFocusWithin.jsx +121 -0
- package/dist/_chunk/createFocusWithin.jsx.map +1 -0
- package/dist/_chunk/createFocusable.js +131 -0
- package/dist/_chunk/createFocusable.js.map +1 -0
- package/dist/_chunk/createFocusable.jsx +131 -0
- package/dist/_chunk/createFocusable.jsx.map +1 -0
- package/dist/_chunk/createFormValidation.js +135 -0
- package/dist/_chunk/createFormValidation.js.map +1 -0
- package/dist/_chunk/createFormValidation.jsx +135 -0
- package/dist/_chunk/createFormValidation.jsx.map +1 -0
- package/dist/_chunk/createHover.js +130 -0
- package/dist/_chunk/createHover.js.map +1 -0
- package/dist/_chunk/createHover.jsx +130 -0
- package/dist/_chunk/createHover.jsx.map +1 -0
- package/dist/_chunk/createInteractionModality.js +269 -0
- package/dist/_chunk/createInteractionModality.js.map +1 -0
- package/dist/_chunk/createInteractionModality.jsx +269 -0
- package/dist/_chunk/createInteractionModality.jsx.map +1 -0
- package/dist/_chunk/createLabel.js +46 -0
- package/dist/_chunk/createLabel.js.map +1 -0
- package/dist/_chunk/createLabel.jsx +46 -0
- package/dist/_chunk/createLabel.jsx.map +1 -0
- package/dist/_chunk/createLabels.js +31 -0
- package/dist/_chunk/createLabels.js.map +1 -0
- package/dist/_chunk/createLabels.jsx +31 -0
- package/dist/_chunk/createLabels.jsx.map +1 -0
- package/dist/_chunk/createLandmark.js +198 -0
- package/dist/_chunk/createLandmark.js.map +1 -0
- package/dist/_chunk/createLandmark.jsx +198 -0
- package/dist/_chunk/createLandmark.jsx.map +1 -0
- package/dist/_chunk/createLongPress.js +91 -0
- package/dist/_chunk/createLongPress.js.map +1 -0
- package/dist/_chunk/createLongPress.jsx +91 -0
- package/dist/_chunk/createLongPress.jsx.map +1 -0
- package/dist/_chunk/createOverlay.js +327 -0
- package/dist/_chunk/createOverlay.js.map +1 -0
- package/dist/_chunk/createOverlay.jsx +327 -0
- package/dist/_chunk/createOverlay.jsx.map +1 -0
- package/dist/_chunk/createPress.js +526 -0
- package/dist/_chunk/createPress.js.map +1 -0
- package/dist/_chunk/createPress.jsx +526 -0
- package/dist/_chunk/createPress.jsx.map +1 -0
- package/dist/_chunk/createProgressBar.js +81 -0
- package/dist/_chunk/createProgressBar.js.map +1 -0
- package/dist/_chunk/createProgressBar.jsx +81 -0
- package/dist/_chunk/createProgressBar.jsx.map +1 -0
- package/dist/_chunk/createSelectableItem.js +298 -0
- package/dist/_chunk/createSelectableItem.js.map +1 -0
- package/dist/_chunk/createSelectableItem.jsx +298 -0
- package/dist/_chunk/createSelectableItem.jsx.map +1 -0
- package/dist/_chunk/createToggle.js +158 -0
- package/dist/_chunk/createToggle.js.map +1 -0
- package/dist/_chunk/createToggle.jsx +158 -0
- package/dist/_chunk/createToggle.jsx.map +1 -0
- package/dist/_chunk/createTypeSelect.js +125 -0
- package/dist/_chunk/createTypeSelect.js.map +1 -0
- package/dist/_chunk/createTypeSelect.jsx +125 -0
- package/dist/_chunk/createTypeSelect.jsx.map +1 -0
- package/dist/_chunk/datepicker.js +1393 -0
- package/dist/_chunk/datepicker.js.map +1 -0
- package/dist/_chunk/datepicker.jsx +1393 -0
- package/dist/_chunk/datepicker.jsx.map +1 -0
- package/dist/_chunk/dialog.js +62 -0
- package/dist/_chunk/dialog.js.map +1 -0
- package/dist/_chunk/dialog.jsx +62 -0
- package/dist/_chunk/dialog.jsx.map +1 -0
- package/dist/_chunk/disclosure.js +185 -0
- package/dist/_chunk/disclosure.js.map +1 -0
- package/dist/_chunk/disclosure.jsx +185 -0
- package/dist/_chunk/disclosure.jsx.map +1 -0
- package/dist/_chunk/dnd.js +1304 -0
- package/dist/_chunk/dnd.js.map +1 -0
- package/dist/_chunk/dnd.jsx +1304 -0
- package/dist/_chunk/dnd.jsx.map +1 -0
- package/dist/_chunk/env.js +105 -0
- package/dist/_chunk/env.js.map +1 -0
- package/dist/_chunk/env.jsx +105 -0
- package/dist/_chunk/env.jsx.map +1 -0
- package/dist/_chunk/filterDOMProps.js +82 -0
- package/dist/_chunk/filterDOMProps.js.map +1 -0
- package/dist/_chunk/filterDOMProps.jsx +82 -0
- package/dist/_chunk/filterDOMProps.jsx.map +1 -0
- package/dist/_chunk/focus.js +399 -0
- package/dist/_chunk/focus.js.map +1 -0
- package/dist/_chunk/focus.jsx +399 -0
- package/dist/_chunk/focus.jsx.map +1 -0
- package/dist/_chunk/focus2.js +895 -0
- package/dist/_chunk/focus2.js.map +1 -0
- package/dist/_chunk/focus2.jsx +870 -0
- package/dist/_chunk/focus2.jsx.map +1 -0
- package/dist/_chunk/form.js +39 -0
- package/dist/_chunk/form.js.map +1 -0
- package/dist/_chunk/form.jsx +39 -0
- package/dist/_chunk/form.jsx.map +1 -0
- package/dist/_chunk/grid.js +623 -0
- package/dist/_chunk/grid.js.map +1 -0
- package/dist/_chunk/grid.jsx +623 -0
- package/dist/_chunk/grid.jsx.map +1 -0
- package/dist/_chunk/gridlist.js +364 -0
- package/dist/_chunk/gridlist.js.map +1 -0
- package/dist/_chunk/gridlist.jsx +364 -0
- package/dist/_chunk/gridlist.jsx.map +1 -0
- package/dist/_chunk/i18n.js +254 -0
- package/dist/_chunk/i18n.js.map +1 -0
- package/dist/_chunk/i18n.jsx +254 -0
- package/dist/_chunk/i18n.jsx.map +1 -0
- package/dist/_chunk/interactions.js +241 -0
- package/dist/_chunk/interactions.js.map +1 -0
- package/dist/_chunk/interactions.jsx +237 -0
- package/dist/_chunk/interactions.jsx.map +1 -0
- package/dist/_chunk/link.js +96 -0
- package/dist/_chunk/link.js.map +1 -0
- package/dist/_chunk/link.jsx +96 -0
- package/dist/_chunk/link.jsx.map +1 -0
- package/dist/_chunk/listbox.js +324 -0
- package/dist/_chunk/listbox.js.map +1 -0
- package/dist/_chunk/listbox.jsx +324 -0
- package/dist/_chunk/listbox.jsx.map +1 -0
- package/dist/_chunk/live-announcer.js +207 -0
- package/dist/_chunk/live-announcer.js.map +1 -0
- package/dist/_chunk/live-announcer.jsx +207 -0
- package/dist/_chunk/live-announcer.jsx.map +1 -0
- package/dist/_chunk/menu.js +518 -0
- package/dist/_chunk/menu.js.map +1 -0
- package/dist/_chunk/menu.jsx +518 -0
- package/dist/_chunk/menu.jsx.map +1 -0
- package/dist/_chunk/meter.js +33 -0
- package/dist/_chunk/meter.js.map +1 -0
- package/dist/_chunk/meter.jsx +33 -0
- package/dist/_chunk/meter.jsx.map +1 -0
- package/dist/_chunk/numberfield.js +258 -0
- package/dist/_chunk/numberfield.js.map +1 -0
- package/dist/_chunk/numberfield.jsx +258 -0
- package/dist/_chunk/numberfield.jsx.map +1 -0
- package/dist/_chunk/overlays.js +186 -0
- package/dist/_chunk/overlays.js.map +1 -0
- package/dist/_chunk/overlays.jsx +162 -0
- package/dist/_chunk/overlays.jsx.map +1 -0
- package/dist/_chunk/popover.js +574 -0
- package/dist/_chunk/popover.js.map +1 -0
- package/dist/_chunk/popover.jsx +574 -0
- package/dist/_chunk/popover.jsx.map +1 -0
- package/dist/_chunk/radio.js +319 -0
- package/dist/_chunk/radio.js.map +1 -0
- package/dist/_chunk/radio.jsx +319 -0
- package/dist/_chunk/radio.jsx.map +1 -0
- package/dist/_chunk/searchfield.js +209 -0
- package/dist/_chunk/searchfield.js.map +1 -0
- package/dist/_chunk/searchfield.jsx +209 -0
- package/dist/_chunk/searchfield.jsx.map +1 -0
- package/dist/_chunk/select.js +403 -0
- package/dist/_chunk/select.js.map +1 -0
- package/dist/_chunk/select.jsx +394 -0
- package/dist/_chunk/select.jsx.map +1 -0
- package/dist/_chunk/selection.js +679 -0
- package/dist/_chunk/selection.js.map +1 -0
- package/dist/_chunk/selection.jsx +679 -0
- package/dist/_chunk/selection.jsx.map +1 -0
- package/dist/_chunk/separator.js +29 -0
- package/dist/_chunk/separator.js.map +1 -0
- package/dist/_chunk/separator.jsx +29 -0
- package/dist/_chunk/separator.jsx.map +1 -0
- package/dist/_chunk/slider.js +255 -0
- package/dist/_chunk/slider.js.map +1 -0
- package/dist/_chunk/slider.jsx +255 -0
- package/dist/_chunk/slider.jsx.map +1 -0
- package/dist/_chunk/steplist.js +66 -0
- package/dist/_chunk/steplist.js.map +1 -0
- package/dist/_chunk/steplist.jsx +66 -0
- package/dist/_chunk/steplist.jsx.map +1 -0
- package/dist/_chunk/switch.js +34 -0
- package/dist/_chunk/switch.js.map +1 -0
- package/dist/_chunk/switch.jsx +34 -0
- package/dist/_chunk/switch.jsx.map +1 -0
- package/dist/_chunk/table.js +1051 -0
- package/dist/_chunk/table.js.map +1 -0
- package/dist/_chunk/table.jsx +1051 -0
- package/dist/_chunk/table.jsx.map +1 -0
- package/dist/_chunk/tabs.js +260 -0
- package/dist/_chunk/tabs.js.map +1 -0
- package/dist/_chunk/tabs.jsx +260 -0
- package/dist/_chunk/tabs.jsx.map +1 -0
- package/dist/_chunk/tag.js +286 -0
- package/dist/_chunk/tag.js.map +1 -0
- package/dist/_chunk/tag.jsx +286 -0
- package/dist/_chunk/tag.jsx.map +1 -0
- package/dist/_chunk/textfield.js +109 -0
- package/dist/_chunk/textfield.js.map +1 -0
- package/dist/_chunk/textfield.jsx +109 -0
- package/dist/_chunk/textfield.jsx.map +1 -0
- package/dist/_chunk/toast.js +250 -0
- package/dist/_chunk/toast.js.map +1 -0
- package/dist/_chunk/toast.jsx +250 -0
- package/dist/_chunk/toast.jsx.map +1 -0
- package/dist/_chunk/toolbar.js +258 -0
- package/dist/_chunk/toolbar.js.map +1 -0
- package/dist/_chunk/toolbar.jsx +258 -0
- package/dist/_chunk/toolbar.jsx.map +1 -0
- package/dist/_chunk/tooltip.js +185 -0
- package/dist/_chunk/tooltip.js.map +1 -0
- package/dist/_chunk/tooltip.jsx +185 -0
- package/dist/_chunk/tooltip.jsx.map +1 -0
- package/dist/_chunk/tree.js +424 -0
- package/dist/_chunk/tree.js.map +1 -0
- package/dist/_chunk/tree.jsx +424 -0
- package/dist/_chunk/tree.jsx.map +1 -0
- package/dist/_chunk/utils.js +665 -0
- package/dist/_chunk/utils.js.map +1 -0
- package/dist/_chunk/utils.jsx +665 -0
- package/dist/_chunk/utils.jsx.map +1 -0
- package/dist/_chunk/visually-hidden.js +92 -0
- package/dist/_chunk/visually-hidden.js.map +1 -0
- package/dist/_chunk/visually-hidden.jsx +92 -0
- package/dist/_chunk/visually-hidden.jsx.map +1 -0
- package/dist/actiongroup/index.js +2 -0
- package/dist/actiongroup/index.jsx +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts +2 -0
- package/dist/autocomplete/createAutocomplete.d.ts.map +1 -1
- package/dist/autocomplete/index.js +2 -0
- package/dist/autocomplete/index.jsx +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/index.jsx +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button/index.jsx +2 -0
- package/dist/calendar/createCalendar.d.ts.map +1 -1
- package/dist/calendar/createCalendarCell.d.ts.map +1 -1
- package/dist/calendar/createCalendarGrid.d.ts.map +1 -1
- package/dist/calendar/createCalendarMonthPicker.d.ts +41 -0
- package/dist/calendar/createCalendarMonthPicker.d.ts.map +1 -0
- package/dist/calendar/createCalendarYearPicker.d.ts +49 -0
- package/dist/calendar/createCalendarYearPicker.d.ts.map +1 -0
- package/dist/calendar/createRangeCalendar.d.ts.map +1 -1
- package/dist/calendar/index.d.ts +2 -0
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/index.jsx +2 -0
- package/dist/calendar/utils.d.ts +4 -0
- package/dist/calendar/utils.d.ts.map +1 -1
- package/dist/checkbox/createCheckbox.d.ts +4 -0
- package/dist/checkbox/createCheckbox.d.ts.map +1 -1
- package/dist/checkbox/createCheckboxGroupItem.d.ts.map +1 -1
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.jsx +2 -0
- package/dist/collections/index.js +160 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/index.jsx +160 -0
- package/dist/collections/index.jsx.map +1 -0
- package/dist/color/index.js +2 -0
- package/dist/color/index.jsx +2 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.jsx +2 -0
- package/dist/datepicker/createDateSegment.d.ts.map +1 -1
- package/dist/datepicker/index.js +2 -0
- package/dist/datepicker/index.jsx +2 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/index.jsx +2 -0
- package/dist/disclosure/index.js +2 -0
- package/dist/disclosure/index.jsx +2 -0
- package/dist/dnd/createDroppableCollection.d.ts.map +1 -1
- package/dist/dnd/index.js +2 -0
- package/dist/dnd/index.jsx +2 -0
- package/dist/dnd/utils.d.ts +2 -2
- package/dist/dnd/utils.d.ts.map +1 -1
- package/dist/focus/FocusScope.d.ts.map +1 -1
- package/dist/focus/index.js +2 -0
- package/dist/focus/index.jsx +2 -0
- package/dist/form/createFormValidation.d.ts.map +1 -1
- package/dist/form/index.js +3 -0
- package/dist/form/index.jsx +3 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.jsx +2 -0
- package/dist/gridlist/createGridList.d.ts +7 -1
- package/dist/gridlist/createGridList.d.ts.map +1 -1
- package/dist/gridlist/createGridListItem.d.ts +1 -1
- package/dist/gridlist/createGridListItem.d.ts.map +1 -1
- package/dist/gridlist/createGridListSection.d.ts +15 -0
- package/dist/gridlist/createGridListSection.d.ts.map +1 -0
- package/dist/gridlist/index.d.ts +2 -1
- package/dist/gridlist/index.d.ts.map +1 -1
- package/dist/gridlist/index.js +2 -0
- package/dist/gridlist/index.jsx +2 -0
- package/dist/gridlist/types.d.ts +50 -0
- package/dist/gridlist/types.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.jsx +3 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -18311
- package/dist/index.jsx +71 -18242
- package/dist/interactions/PressEvent.d.ts +11 -0
- package/dist/interactions/PressEvent.d.ts.map +1 -1
- package/dist/interactions/createInteractionModality.d.ts +0 -1
- package/dist/interactions/createInteractionModality.d.ts.map +1 -1
- package/dist/interactions/createKeyboard.d.ts.map +1 -1
- package/dist/interactions/createPress.d.ts.map +1 -1
- package/dist/interactions/index.js +10 -0
- package/dist/interactions/index.jsx +10 -0
- package/dist/label/index.js +4 -0
- package/dist/label/index.jsx +4 -0
- package/dist/landmark/index.js +2 -0
- package/dist/landmark/index.jsx +2 -0
- package/dist/link/index.js +2 -0
- package/dist/link/index.jsx +2 -0
- package/dist/listbox/createListBox.d.ts +37 -0
- package/dist/listbox/createListBox.d.ts.map +1 -1
- package/dist/listbox/createOption.d.ts +6 -0
- package/dist/listbox/createOption.d.ts.map +1 -1
- package/dist/listbox/index.js +2 -0
- package/dist/listbox/index.jsx +2 -0
- package/dist/live-announcer/index.js +2 -0
- package/dist/live-announcer/index.jsx +2 -0
- package/dist/menu/createMenu.d.ts +7 -4
- package/dist/menu/createMenu.d.ts.map +1 -1
- package/dist/menu/createMenuItem.d.ts +9 -1
- package/dist/menu/createMenuItem.d.ts.map +1 -1
- package/dist/menu/index.js +2 -0
- package/dist/menu/index.jsx +2 -0
- package/dist/meter/index.js +2 -0
- package/dist/meter/index.jsx +2 -0
- package/dist/numberfield/createNumberField.d.ts.map +1 -1
- package/dist/numberfield/index.js +2 -0
- package/dist/numberfield/index.jsx +2 -0
- package/dist/overlays/index.js +4 -0
- package/dist/overlays/index.jsx +4 -0
- package/dist/popover/calculatePosition.d.ts +2 -0
- package/dist/popover/calculatePosition.d.ts.map +1 -1
- package/dist/popover/createOverlayPosition.d.ts +8 -0
- package/dist/popover/createOverlayPosition.d.ts.map +1 -1
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.jsx +2 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.jsx +2 -0
- package/dist/radio/createRadio.d.ts +2 -0
- package/dist/radio/createRadio.d.ts.map +1 -1
- package/dist/radio/index.js +2 -0
- package/dist/radio/index.jsx +2 -0
- package/dist/searchfield/index.js +2 -0
- package/dist/searchfield/index.jsx +2 -0
- package/dist/select/createSelect.d.ts.map +1 -1
- package/dist/select/index.js +2 -0
- package/dist/select/index.jsx +2 -0
- package/dist/selection/DOMLayoutDelegate.d.ts +58 -0
- package/dist/selection/DOMLayoutDelegate.d.ts.map +1 -0
- package/dist/selection/ListKeyboardDelegate.d.ts +95 -0
- package/dist/selection/ListKeyboardDelegate.d.ts.map +1 -0
- package/dist/selection/constants.d.ts +15 -0
- package/dist/selection/constants.d.ts.map +1 -0
- package/dist/selection/createCollectionRowInteraction.d.ts +13 -0
- package/dist/selection/createCollectionRowInteraction.d.ts.map +1 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts +31 -0
- package/dist/selection/createScrollIntoViewOnFocus.d.ts.map +1 -0
- package/dist/selection/createSelectableCollection.d.ts +69 -0
- package/dist/selection/createSelectableCollection.d.ts.map +1 -0
- package/dist/selection/createSelectableItem.d.ts +154 -0
- package/dist/selection/createSelectableItem.d.ts.map +1 -0
- package/dist/selection/createSelectableList.d.ts +43 -0
- package/dist/selection/createSelectableList.d.ts.map +1 -0
- package/dist/selection/createTypeSelect.d.ts.map +1 -1
- package/dist/selection/index.d.ts +9 -0
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +4 -0
- package/dist/selection/index.jsx +4 -0
- package/dist/selection/selectItem.d.ts +29 -0
- package/dist/selection/selectItem.d.ts.map +1 -0
- package/dist/selection/utils.d.ts +40 -0
- package/dist/selection/utils.d.ts.map +1 -0
- package/dist/separator/index.js +2 -0
- package/dist/separator/index.jsx +2 -0
- package/dist/slider/createSlider.d.ts.map +1 -1
- package/dist/slider/index.js +2 -0
- package/dist/slider/index.jsx +2 -0
- package/dist/ssr/index.d.ts +17 -0
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +299 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/index.jsx +292 -0
- package/dist/ssr/index.jsx.map +1 -0
- package/dist/steplist/index.js +2 -0
- package/dist/steplist/index.jsx +2 -0
- package/dist/switch/createSwitch.d.ts +4 -0
- package/dist/switch/createSwitch.d.ts.map +1 -1
- package/dist/switch/index.js +2 -0
- package/dist/switch/index.jsx +2 -0
- package/dist/table/createTable.d.ts.map +1 -1
- package/dist/table/createTableRow.d.ts +1 -1
- package/dist/table/createTableRow.d.ts.map +1 -1
- package/dist/table/createTableSelectAllCheckbox.d.ts.map +1 -1
- package/dist/table/index.js +2 -0
- package/dist/table/index.jsx +2 -0
- package/dist/table/types.d.ts +27 -1
- package/dist/table/types.d.ts.map +1 -1
- package/dist/tabs/createTabs.d.ts +4 -3
- package/dist/tabs/createTabs.d.ts.map +1 -1
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.jsx +2 -0
- package/dist/tag/createTag.d.ts +2 -0
- package/dist/tag/createTag.d.ts.map +1 -1
- package/dist/tag/index.js +2 -0
- package/dist/tag/index.jsx +2 -0
- package/dist/textfield/index.js +2 -0
- package/dist/textfield/index.jsx +2 -0
- package/dist/toast/createToast.d.ts.map +1 -1
- package/dist/toast/index.js +2 -0
- package/dist/toast/index.jsx +2 -0
- package/dist/toggle/createToggle.d.ts +4 -0
- package/dist/toggle/createToggle.d.ts.map +1 -1
- package/dist/toggle/index.js +3 -0
- package/dist/toggle/index.jsx +3 -0
- package/dist/toolbar/createToolbar.d.ts +1 -1
- package/dist/toolbar/createToolbar.d.ts.map +1 -1
- package/dist/toolbar/index.js +2 -0
- package/dist/toolbar/index.jsx +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/index.jsx +2 -0
- package/dist/tree/createTree.d.ts +5 -1
- package/dist/tree/createTree.d.ts.map +1 -1
- package/dist/tree/createTreeItem.d.ts +1 -1
- package/dist/tree/createTreeItem.d.ts.map +1 -1
- package/dist/tree/index.js +2 -0
- package/dist/tree/index.jsx +2 -0
- package/dist/tree/types.d.ts +10 -0
- package/dist/tree/types.d.ts.map +1 -1
- package/dist/utils/animation.d.ts +60 -0
- package/dist/utils/animation.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +48 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.jsx +5 -0
- package/dist/utils/keyboard.d.ts +17 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/scrollIntoView.d.ts +30 -0
- package/dist/utils/scrollIntoView.d.ts.map +1 -0
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.jsx +2 -0
- package/package.json +304 -3
- package/src/autocomplete/createAutocomplete.ts +67 -21
- package/src/calendar/createCalendar.ts +2 -0
- package/src/calendar/createCalendarCell.ts +19 -2
- package/src/calendar/createCalendarGrid.ts +43 -9
- package/src/calendar/createCalendarMonthPicker.ts +105 -0
- package/src/calendar/createCalendarYearPicker.ts +144 -0
- package/src/calendar/createRangeCalendar.ts +2 -0
- package/src/calendar/index.ts +17 -0
- package/src/calendar/utils.ts +4 -0
- package/src/checkbox/createCheckbox.ts +10 -0
- package/src/checkbox/createCheckboxGroupItem.ts +12 -16
- package/src/datepicker/createDateSegment.ts +6 -1
- package/src/dnd/createDroppableCollection.ts +4 -1
- package/src/dnd/utils.ts +27 -3
- package/src/focus/FocusScope.tsx +152 -18
- package/src/form/createFormValidation.ts +8 -1
- package/src/gridlist/createGridList.ts +145 -42
- package/src/gridlist/createGridListItem.ts +87 -155
- package/src/gridlist/createGridListSection.ts +54 -0
- package/src/gridlist/index.ts +3 -0
- package/src/gridlist/types.ts +47 -0
- package/src/index.ts +40 -0
- package/src/interactions/PressEvent.ts +14 -0
- package/src/interactions/createInteractionModality.ts +21 -12
- package/src/interactions/createKeyboard.ts +10 -0
- package/src/interactions/createPress.ts +29 -6
- package/src/listbox/createListBox.ts +129 -8
- package/src/listbox/createOption.ts +68 -73
- package/src/menu/createMenu.ts +93 -16
- package/src/menu/createMenuItem.ts +253 -41
- package/src/numberfield/createNumberField.ts +82 -14
- package/src/popover/calculatePosition.ts +19 -7
- package/src/popover/createOverlayPosition.ts +9 -0
- package/src/radio/createRadio.ts +19 -2
- package/src/select/createSelect.ts +18 -2
- package/src/selection/DOMLayoutDelegate.ts +102 -0
- package/src/selection/ListKeyboardDelegate.ts +398 -0
- package/src/selection/constants.ts +16 -0
- package/src/selection/createCollectionRowInteraction.ts +209 -0
- package/src/selection/createScrollIntoViewOnFocus.ts +65 -0
- package/src/selection/createSelectableCollection.ts +645 -0
- package/src/selection/createSelectableItem.ts +498 -0
- package/src/selection/createSelectableList.ts +93 -0
- package/src/selection/createTypeSelect.ts +112 -51
- package/src/selection/index.ts +31 -0
- package/src/selection/selectItem.ts +80 -0
- package/src/selection/utils.ts +82 -0
- package/src/slider/createSlider.ts +48 -1
- package/src/ssr/index.tsx +31 -0
- package/src/switch/createSwitch.ts +10 -0
- package/src/table/createTable.ts +56 -26
- package/src/table/createTableRow.ts +198 -203
- package/src/table/createTableSelectAllCheckbox.ts +3 -4
- package/src/table/types.ts +29 -1
- package/src/tabs/createTabs.ts +50 -20
- package/src/tag/createTag.ts +9 -4
- package/src/toast/createToast.ts +1 -0
- package/src/toggle/createToggle.ts +20 -0
- package/src/toolbar/createToolbar.ts +43 -42
- package/src/tree/createTree.ts +100 -42
- package/src/tree/createTreeItem.ts +105 -120
- package/src/tree/types.ts +10 -0
- package/src/utils/animation.ts +151 -0
- package/src/utils/dom.ts +215 -25
- package/src/utils/index.ts +8 -0
- package/src/utils/keyboard.ts +25 -0
- package/src/utils/mergeProps.ts +8 -1
- package/src/utils/scrollIntoView.ts +181 -0
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
|
@@ -3,12 +3,21 @@
|
|
|
3
3
|
* Based on @react-aria/tree/useTreeItem.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { createMemo,
|
|
6
|
+
import { createMemo, type Accessor } from "solid-js";
|
|
7
7
|
import type { JSX } from "solid-js";
|
|
8
8
|
import { createId } from "@proyecto-viviana/solid-stately";
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
Collection,
|
|
11
|
+
Key,
|
|
12
|
+
Selection,
|
|
13
|
+
TreeState,
|
|
14
|
+
TreeCollection,
|
|
15
|
+
} from "@proyecto-viviana/solid-stately";
|
|
10
16
|
import type { AriaTreeItemProps, TreeItemAria } from "./types";
|
|
11
17
|
import { getTreeData } from "./createTree";
|
|
18
|
+
import { createSelectableItem, type SelectableItemState } from "../selection/createSelectableItem";
|
|
19
|
+
import { mergeCollectionRowInteractionProps } from "../selection/createCollectionRowInteraction";
|
|
20
|
+
import { mergeProps } from "../utils/mergeProps";
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
23
|
* Creates accessibility props for a tree item.
|
|
@@ -16,28 +25,20 @@ import { getTreeData } from "./createTree";
|
|
|
16
25
|
export function createTreeItem<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(
|
|
17
26
|
props: Accessor<AriaTreeItemProps<T>>,
|
|
18
27
|
state: Accessor<TreeState<T, C>>,
|
|
19
|
-
|
|
28
|
+
ref: Accessor<HTMLElement | null>,
|
|
20
29
|
): TreeItemAria {
|
|
21
|
-
const
|
|
22
|
-
const rowId = createId();
|
|
30
|
+
const fallbackRowId = createId();
|
|
23
31
|
const expandButtonId = createId();
|
|
24
32
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
return s.isSelected(p.node.key);
|
|
33
|
+
const rowId = createMemo(() => {
|
|
34
|
+
const treeData = getTreeData(state());
|
|
35
|
+
return treeData ? `${treeData.treeId}-row-${String(props().node.key)}` : fallbackRowId;
|
|
29
36
|
});
|
|
30
37
|
|
|
31
|
-
const
|
|
32
|
-
const s = state();
|
|
33
|
-
const p = props();
|
|
34
|
-
return p.isDisabled === true || s.isDisabled(p.node.key);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const isFocused = createMemo(() => {
|
|
38
|
+
const isSelected = createMemo(() => {
|
|
38
39
|
const s = state();
|
|
39
40
|
const p = props();
|
|
40
|
-
return s.
|
|
41
|
+
return s.isSelected(p.node.key);
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
const isExpanded = createMemo(() => {
|
|
@@ -56,97 +57,77 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
56
57
|
return p.node.level;
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
if (p.onAction) {
|
|
101
|
-
p.onAction();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
60
|
+
const selectableState: SelectableItemState<T> = {
|
|
61
|
+
collection: () => state().collection as unknown as Collection<T>,
|
|
62
|
+
isFocused: () => state().isFocused,
|
|
63
|
+
setFocused: (focused: boolean) => state().setFocused(focused),
|
|
64
|
+
focusedKey: () => state().focusedKey,
|
|
65
|
+
childFocusStrategy: () => state().childFocusStrategy,
|
|
66
|
+
setFocusedKey: (key: Key | null, strategy) => state().setFocusedKey(key, strategy),
|
|
67
|
+
selectionMode: () => state().selectionMode,
|
|
68
|
+
selectionBehavior: () => props().selectionBehavior ?? state().selectionBehavior,
|
|
69
|
+
disallowEmptySelection: () => state().disallowEmptySelection,
|
|
70
|
+
selectedKeys: () => state().selectedKeys as Selection,
|
|
71
|
+
disabledKeys: () => state().disabledKeys,
|
|
72
|
+
disabledBehavior: () => state().disabledBehavior,
|
|
73
|
+
isEmpty: () => {
|
|
74
|
+
const keys = state().selectedKeys;
|
|
75
|
+
return keys !== "all" && keys.size === 0;
|
|
76
|
+
},
|
|
77
|
+
isSelectAll: () => state().selectedKeys === "all",
|
|
78
|
+
isSelected: (key: Key) => state().isSelected(key),
|
|
79
|
+
isDisabled: (key: Key) => {
|
|
80
|
+
const s = state();
|
|
81
|
+
const item = s.collection.getItem(key);
|
|
82
|
+
return (
|
|
83
|
+
s.disabledBehavior === "all" &&
|
|
84
|
+
s.isDisabled(key) &&
|
|
85
|
+
item?.props?.disabledBehavior !== "selection"
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
canSelectItem: (key: Key) => {
|
|
89
|
+
const s = state();
|
|
90
|
+
return s.selectionMode !== "none" && !s.isDisabled(key);
|
|
91
|
+
},
|
|
92
|
+
setSelectionBehavior: (behavior) => state().setSelectionBehavior(behavior),
|
|
93
|
+
toggleSelection: (key: Key) => state().toggleSelection(key),
|
|
94
|
+
replaceSelection: (key: Key) => state().replaceSelection(key),
|
|
95
|
+
setSelectedKeys: (keys: Iterable<Key>) => state().setSelectedKeys(keys),
|
|
96
|
+
selectAll: () => state().selectAll(),
|
|
97
|
+
clearSelection: () => state().clearSelection(),
|
|
98
|
+
toggleSelectAll: () => state().toggleSelectAll(),
|
|
99
|
+
extendSelection: (toKey: Key, _collection: Collection<T>) => state().extendSelection(toKey),
|
|
104
100
|
};
|
|
105
101
|
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (isDisabled()) return;
|
|
111
|
-
|
|
112
|
-
if (e.key === "Enter") {
|
|
113
|
-
// Get tree metadata for actions
|
|
102
|
+
const selectableItem = createSelectableItem<T>(
|
|
103
|
+
() => {
|
|
104
|
+
const s = state();
|
|
105
|
+
const p = props();
|
|
114
106
|
const treeData = getTreeData(s);
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
p.onAction
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const p = props();
|
|
140
|
-
s.setFocusedKey(p.node.key);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const onPointerDown = () => {
|
|
144
|
-
setIsPressed(true);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const onPointerUp = () => {
|
|
148
|
-
setIsPressed(false);
|
|
149
|
-
};
|
|
107
|
+
const treeAction = treeData?.actions.onAction;
|
|
108
|
+
const shouldToggleOnAction =
|
|
109
|
+
!treeAction && !p.onAction && s.selectionMode === "none" && isExpandable();
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
key: p.node.key,
|
|
113
|
+
id: rowId(),
|
|
114
|
+
isVirtualized: p.isVirtualized,
|
|
115
|
+
isDisabled: p.isDisabled,
|
|
116
|
+
onAction:
|
|
117
|
+
treeAction || p.onAction || shouldToggleOnAction
|
|
118
|
+
? () => {
|
|
119
|
+
p.onAction?.();
|
|
120
|
+
treeAction?.(p.node.key);
|
|
121
|
+
if (shouldToggleOnAction) {
|
|
122
|
+
s.toggleKey(p.node.key);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
: undefined,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
selectableState,
|
|
129
|
+
ref,
|
|
130
|
+
);
|
|
150
131
|
|
|
151
132
|
// Compute sibling position (aria-posinset/aria-setsize)
|
|
152
133
|
const siblingInfo = createMemo(() => {
|
|
@@ -175,7 +156,6 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
175
156
|
});
|
|
176
157
|
|
|
177
158
|
const rowProps = createMemo(() => {
|
|
178
|
-
const s = state();
|
|
179
159
|
const p = props();
|
|
180
160
|
const node = p.node;
|
|
181
161
|
const { posinset, setsize } = siblingInfo();
|
|
@@ -185,20 +165,13 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
185
165
|
|
|
186
166
|
const baseProps: Record<string, unknown> = {
|
|
187
167
|
role: "row",
|
|
188
|
-
id: rowId,
|
|
189
168
|
"aria-label": textValue || undefined,
|
|
190
|
-
"aria-selected":
|
|
191
|
-
"aria-disabled": isDisabled() || undefined,
|
|
169
|
+
"aria-selected": selectableState.canSelectItem?.(node.key) ? isSelected() : undefined,
|
|
170
|
+
"aria-disabled": selectableItem.isDisabled() || undefined,
|
|
192
171
|
"aria-expanded": isExpandable() ? isExpanded() : undefined,
|
|
193
172
|
"aria-level": node.level + 1, // 1-based for ARIA
|
|
194
173
|
"aria-posinset": posinset,
|
|
195
174
|
"aria-setsize": setsize,
|
|
196
|
-
tabIndex: isFocused() ? 0 : -1,
|
|
197
|
-
onClick,
|
|
198
|
-
onKeyDown,
|
|
199
|
-
onFocus,
|
|
200
|
-
onPointerDown,
|
|
201
|
-
onPointerUp,
|
|
202
175
|
};
|
|
203
176
|
|
|
204
177
|
// Add aria-rowindex for virtualized trees
|
|
@@ -206,12 +179,23 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
206
179
|
baseProps["aria-rowindex"] = node.rowIndex + 1; // 1-based
|
|
207
180
|
}
|
|
208
181
|
|
|
209
|
-
|
|
182
|
+
const treeData = getTreeData(state());
|
|
183
|
+
const mergedProps = mergeProps<JSX.HTMLAttributes<HTMLDivElement>>(
|
|
184
|
+
selectableItem.itemProps,
|
|
185
|
+
baseProps,
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return mergeCollectionRowInteractionProps(mergedProps, {
|
|
189
|
+
ref,
|
|
190
|
+
keyboardNavigationBehavior: () => treeData?.keyboardNavigationBehavior ?? "arrow",
|
|
191
|
+
direction: () => treeData?.direction ?? "ltr",
|
|
192
|
+
});
|
|
210
193
|
});
|
|
211
194
|
|
|
212
195
|
const gridCellProps = createMemo(() => {
|
|
213
196
|
return {
|
|
214
197
|
role: "gridcell",
|
|
198
|
+
"aria-colindex": 1,
|
|
215
199
|
} as JSX.HTMLAttributes<HTMLDivElement>;
|
|
216
200
|
});
|
|
217
201
|
|
|
@@ -221,7 +205,7 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
221
205
|
const s = state();
|
|
222
206
|
const p = props();
|
|
223
207
|
|
|
224
|
-
if (isDisabled()) return;
|
|
208
|
+
if (selectableItem.isDisabled()) return;
|
|
225
209
|
|
|
226
210
|
s.toggleKey(p.node.key);
|
|
227
211
|
};
|
|
@@ -237,7 +221,8 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
237
221
|
type: "button",
|
|
238
222
|
id: expandButtonId,
|
|
239
223
|
"aria-label": isExpanded() ? "Collapse" : "Expand",
|
|
240
|
-
"aria-labelledby": isExpandable() ? `${expandButtonId} ${rowId}` : undefined,
|
|
224
|
+
"aria-labelledby": isExpandable() ? `${expandButtonId} ${rowId()}` : undefined,
|
|
225
|
+
"data-react-aria-prevent-focus": true,
|
|
241
226
|
onClick: onExpandClick,
|
|
242
227
|
onPointerDown: stopPointerPropagation,
|
|
243
228
|
onPointerUp: stopPointerPropagation,
|
|
@@ -264,10 +249,10 @@ export function createTreeItem<T extends object, C extends TreeCollection<T> = T
|
|
|
264
249
|
return isSelected();
|
|
265
250
|
},
|
|
266
251
|
get isDisabled() {
|
|
267
|
-
return isDisabled();
|
|
252
|
+
return selectableItem.isDisabled();
|
|
268
253
|
},
|
|
269
254
|
get isPressed() {
|
|
270
|
-
return isPressed();
|
|
255
|
+
return selectableItem.isPressed();
|
|
271
256
|
},
|
|
272
257
|
get isExpanded() {
|
|
273
258
|
return isExpanded();
|
package/src/tree/types.ts
CHANGED
|
@@ -22,6 +22,16 @@ export interface AriaTreeProps {
|
|
|
22
22
|
isVirtualized?: boolean;
|
|
23
23
|
/** Handler called when an item action is triggered. */
|
|
24
24
|
onAction?: (key: Key) => void;
|
|
25
|
+
/**
|
|
26
|
+
* How keyboard navigation should behave within rows.
|
|
27
|
+
*
|
|
28
|
+
* `"arrow"` treats the tree as a single tab stop and uses arrow keys to move
|
|
29
|
+
* through row children. `"tab"` lets tabbable row children participate in
|
|
30
|
+
* normal tab order and stops child key events before tree navigation.
|
|
31
|
+
*
|
|
32
|
+
* @default "arrow"
|
|
33
|
+
*/
|
|
34
|
+
keyboardNavigationBehavior?: "arrow" | "tab";
|
|
25
35
|
/** Whether the tree is disabled. */
|
|
26
36
|
isDisabled?: boolean;
|
|
27
37
|
/** The writing direction for the tree. Determines expand/collapse key mapping. */
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enter/exit animation primitives for Solidaria.
|
|
3
|
+
*
|
|
4
|
+
* A faithful SolidJS port of `react-aria`'s `useEnterAnimation` /
|
|
5
|
+
* `useExitAnimation` (react-aria/src/utils/animation.ts). These drive the
|
|
6
|
+
* `data-entering` / `data-exiting` render-prop flags that overlay styles key
|
|
7
|
+
* their motion tokens off of (opacity/translate transitions on Modal, Popover,
|
|
8
|
+
* Tooltip, …). Without them a styled overlay ships the tokens but never flips
|
|
9
|
+
* the state that triggers the transition, so it appears/disappears instantly.
|
|
10
|
+
*
|
|
11
|
+
* Two mechanisms are covered, exactly as upstream:
|
|
12
|
+
* 1. CSS `@keyframes` — the `animation` property is present while entering and
|
|
13
|
+
* removed when the animation finishes.
|
|
14
|
+
* 2. CSS transitions — the initial styles apply while entering and are removed
|
|
15
|
+
* immediately, so the transition plays. Premature transitions triggered
|
|
16
|
+
* before the ready state (e.g. a popover positioned after mount) are
|
|
17
|
+
* cancelled so only the intended enter transition runs.
|
|
18
|
+
*
|
|
19
|
+
* SolidJS notes:
|
|
20
|
+
* - Refs are passed as accessors (`() => element`) rather than React ref
|
|
21
|
+
* objects, so a signal-backed ref re-runs the effect when the element mounts.
|
|
22
|
+
* - `isReady` gates the enter animation. In React the caller unmounts the
|
|
23
|
+
* overlay while closed, so the hook re-initializes per open; a Solid component
|
|
24
|
+
* often stays mounted with its overlay behind a `<Show>`, so pass
|
|
25
|
+
* `isReady={isOpen}` to defer the enter until the element actually mounts.
|
|
26
|
+
* - `createEffect` replaces `useLayoutEffect`; effects never run during SSR, so
|
|
27
|
+
* the `CSSTransition` reference is only touched on the client.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { createEffect, createSignal, onCleanup, type Accessor } from "solid-js";
|
|
31
|
+
|
|
32
|
+
/** A reactive accessor for the animated element (null until mounted). */
|
|
33
|
+
export type ElementAccessor = () => Element | null | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Runs `onEnd` once the element's animations settle while `isActive` is true.
|
|
37
|
+
* Mirrors the private `useAnimation` helper in react-aria's animation utils.
|
|
38
|
+
*/
|
|
39
|
+
function createAnimation(
|
|
40
|
+
ref: ElementAccessor,
|
|
41
|
+
isActive: Accessor<boolean>,
|
|
42
|
+
onEnd: () => void,
|
|
43
|
+
): void {
|
|
44
|
+
createEffect(() => {
|
|
45
|
+
if (!isActive()) return;
|
|
46
|
+
const element = ref();
|
|
47
|
+
if (!element) return;
|
|
48
|
+
|
|
49
|
+
if (!("getAnimations" in element)) {
|
|
50
|
+
// JSDOM and other environments without the Web Animations API.
|
|
51
|
+
onEnd();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const animations = element.getAnimations();
|
|
56
|
+
if (animations.length === 0) {
|
|
57
|
+
onEnd();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let canceled = false;
|
|
62
|
+
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
63
|
+
if (!canceled) onEnd();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onCleanup(() => {
|
|
67
|
+
canceled = true;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Tracks whether an element is playing its enter animation.
|
|
74
|
+
*
|
|
75
|
+
* Returns an accessor that is `true` while the element should carry
|
|
76
|
+
* `data-entering` (its initial, pre-transition styles), then flips to `false`
|
|
77
|
+
* once the animation is set up — which removes the initial styles and lets the
|
|
78
|
+
* CSS transition play.
|
|
79
|
+
*
|
|
80
|
+
* @param ref - Accessor for the animated element.
|
|
81
|
+
* @param isReady - Whether the element is ready to animate in. Defaults to
|
|
82
|
+
* `true`. Pass an `isOpen` accessor when the component stays mounted while the
|
|
83
|
+
* overlay is hidden, so the enter state does not resolve before the element
|
|
84
|
+
* mounts.
|
|
85
|
+
*/
|
|
86
|
+
export function createEnterAnimation(
|
|
87
|
+
ref: ElementAccessor,
|
|
88
|
+
isReady: Accessor<boolean> = () => true,
|
|
89
|
+
): Accessor<boolean> {
|
|
90
|
+
const [isEntering, setIsEntering] = createSignal(true);
|
|
91
|
+
const isAnimationReady = () => isEntering() && isReady();
|
|
92
|
+
|
|
93
|
+
// Cancel any transitions triggered before the ready state (case 2 above), so
|
|
94
|
+
// only the intended enter transition — the one that starts when the initial
|
|
95
|
+
// styles are removed — runs.
|
|
96
|
+
createEffect(() => {
|
|
97
|
+
if (!isAnimationReady()) return;
|
|
98
|
+
const element = ref();
|
|
99
|
+
if (!element || !("getAnimations" in element)) return;
|
|
100
|
+
for (const animation of element.getAnimations()) {
|
|
101
|
+
if (animation instanceof CSSTransition) {
|
|
102
|
+
animation.cancel();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
createAnimation(ref, isAnimationReady, () => setIsEntering(false));
|
|
108
|
+
|
|
109
|
+
return isAnimationReady;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Tracks whether an element is playing its exit animation.
|
|
114
|
+
*
|
|
115
|
+
* Keeps the caller informed so the element can stay mounted (`isOpen ||
|
|
116
|
+
* isExiting`) until its exit transition finishes. Implements the same
|
|
117
|
+
* `'closed' | 'open' | 'exiting'` state machine as react-aria's
|
|
118
|
+
* `useExitAnimation`, including interruption: reopening mid-exit returns to the
|
|
119
|
+
* open state.
|
|
120
|
+
*
|
|
121
|
+
* @param ref - Accessor for the animated element.
|
|
122
|
+
* @param isOpen - Whether the element is currently open.
|
|
123
|
+
*/
|
|
124
|
+
export function createExitAnimation(
|
|
125
|
+
ref: ElementAccessor,
|
|
126
|
+
isOpen: Accessor<boolean>,
|
|
127
|
+
): Accessor<boolean> {
|
|
128
|
+
const [exitState, setExitState] = createSignal<"closed" | "open" | "exiting">(
|
|
129
|
+
isOpen() ? "open" : "closed",
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
createEffect(() => {
|
|
133
|
+
const open = isOpen();
|
|
134
|
+
setExitState((current) => {
|
|
135
|
+
// Open element requested to close: begin exiting.
|
|
136
|
+
if (current === "open" && !open) return "exiting";
|
|
137
|
+
// Closed or mid-exit element requested to open: the animation was
|
|
138
|
+
// interrupted (or it is a fresh open), so return to the open state.
|
|
139
|
+
if ((current === "closed" || current === "exiting") && open) return "open";
|
|
140
|
+
return current;
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const isExiting = () => exitState() === "exiting";
|
|
145
|
+
|
|
146
|
+
createAnimation(ref, isExiting, () => {
|
|
147
|
+
setExitState((state) => (state === "exiting" ? "closed" : state));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return isExiting;
|
|
151
|
+
}
|