@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
package/src/utils/dom.ts
CHANGED
|
@@ -63,38 +63,153 @@ export function getEventTarget<T extends EventTarget>(event: Event): T | null {
|
|
|
63
63
|
return event.target as T | null;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
// Ports @react-aria/utils `isElementVisible`/`isFocusable`/`isTabbable` (v3.34.1,
|
|
67
|
+
// the version paired with our pinned RAC 1.19.0) so focusability matches upstream:
|
|
68
|
+
// a candidate must match the focusable selector AND not be inside an `inert`
|
|
69
|
+
// subtree AND be visible (unless `skipVisibilityCheck`). The previous `isFocusable`
|
|
70
|
+
// was a simplified tagName/tabindex check with no visibility or `inert` filtering.
|
|
71
|
+
// Owner-window lookups go through `getOwnerWindow`, which falls back to the global
|
|
72
|
+
// window, so these stay robust on detached documents (`defaultView === null`).
|
|
73
|
+
|
|
74
|
+
const supportsCheckVisibility =
|
|
75
|
+
typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
|
|
76
|
+
|
|
77
|
+
// Solid clones templates with the document that is global at creation time, so a
|
|
78
|
+
// node portaled into another document (e.g. an iframe) keeps its original realm's
|
|
79
|
+
// prototype even though `getOwnerWindow` now resolves to the other document's
|
|
80
|
+
// window. Upstream React creates portal nodes with the container's `ownerDocument`,
|
|
81
|
+
// so its single `instanceof getOwnerWindow(element)` check suffices; we also accept
|
|
82
|
+
// the global realm's constructors so cross-document focus scopes still recognize
|
|
83
|
+
// real elements. In the common same-realm case this is identical to upstream.
|
|
84
|
+
function isHTMLOrSVGElement(element: Element): element is HTMLElement | SVGElement {
|
|
85
|
+
const windowObject = getOwnerWindow(element);
|
|
86
|
+
return (
|
|
87
|
+
element instanceof windowObject.HTMLElement ||
|
|
88
|
+
element instanceof windowObject.SVGElement ||
|
|
89
|
+
(typeof HTMLElement !== "undefined" && element instanceof HTMLElement) ||
|
|
90
|
+
(typeof SVGElement !== "undefined" && element instanceof SVGElement)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function isStyleVisible(element: Element): boolean {
|
|
95
|
+
if (!isHTMLOrSVGElement(element)) {
|
|
72
96
|
return false;
|
|
73
97
|
}
|
|
74
98
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
99
|
+
const { display, visibility } = element.style;
|
|
100
|
+
|
|
101
|
+
let isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
|
|
102
|
+
|
|
103
|
+
if (isVisible) {
|
|
104
|
+
const { getComputedStyle } = getOwnerWindow(element);
|
|
105
|
+
const { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
|
|
106
|
+
|
|
107
|
+
isVisible =
|
|
108
|
+
computedDisplay !== "none" &&
|
|
109
|
+
computedVisibility !== "hidden" &&
|
|
110
|
+
computedVisibility !== "collapse";
|
|
83
111
|
}
|
|
84
112
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
return isVisible;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isAttributeVisible(element: Element, childElement?: Element): boolean {
|
|
117
|
+
return (
|
|
118
|
+
!element.hasAttribute("hidden") &&
|
|
119
|
+
// Ignore HiddenSelect when tree walking.
|
|
120
|
+
!element.hasAttribute("data-react-aria-prevent-focus") &&
|
|
121
|
+
(element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY"
|
|
122
|
+
? element.hasAttribute("open")
|
|
123
|
+
: true)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Whether an element is visible, and so eligible for focus. Adapted from
|
|
129
|
+
* @react-aria/utils, which adapts testing-library/jest-dom and
|
|
130
|
+
* vue-test-utils-next (MIT): uses `checkVisibility` when supported, otherwise
|
|
131
|
+
* walks computed style and visibility-affecting attributes up the ancestor chain.
|
|
132
|
+
*/
|
|
133
|
+
export function isElementVisible(element: Element, childElement?: Element): boolean {
|
|
134
|
+
if (supportsCheckVisibility) {
|
|
135
|
+
return (
|
|
136
|
+
element.checkVisibility({ visibilityProperty: true }) &&
|
|
137
|
+
!element.closest("[data-react-aria-prevent-focus]")
|
|
138
|
+
);
|
|
90
139
|
}
|
|
91
140
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
element
|
|
95
|
-
element
|
|
96
|
-
|
|
97
|
-
|
|
141
|
+
return (
|
|
142
|
+
element.nodeName !== "#comment" &&
|
|
143
|
+
isStyleVisible(element) &&
|
|
144
|
+
isAttributeVisible(element, childElement) &&
|
|
145
|
+
(!element.parentElement || isElementVisible(element.parentElement, element))
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const focusableElements = [
|
|
150
|
+
"input:not([disabled]):not([type=hidden])",
|
|
151
|
+
"select:not([disabled])",
|
|
152
|
+
"textarea:not([disabled])",
|
|
153
|
+
"button:not([disabled])",
|
|
154
|
+
"a[href]",
|
|
155
|
+
"area[href]",
|
|
156
|
+
"summary",
|
|
157
|
+
"iframe",
|
|
158
|
+
"object",
|
|
159
|
+
"embed",
|
|
160
|
+
"audio[controls]",
|
|
161
|
+
"video[controls]",
|
|
162
|
+
'[contenteditable]:not([contenteditable^="false"])',
|
|
163
|
+
"permission",
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
const FOCUSABLE_ELEMENT_SELECTOR =
|
|
167
|
+
focusableElements.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
168
|
+
|
|
169
|
+
focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
170
|
+
const TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex="-1"]),');
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Checks if an element is a valid focusable element: it matches the focusable
|
|
174
|
+
* selector, is not inside an `inert` subtree, and is visible. A negative tabindex
|
|
175
|
+
* is programmatically focusable (matched here) but not tabbable. `skipVisibilityCheck`
|
|
176
|
+
* lets callers (e.g. the press-path `preventFocus` ancestor walk) skip the
|
|
177
|
+
* `isElementVisible` step, which also avoids touching layout on detached documents.
|
|
178
|
+
*/
|
|
179
|
+
export function isFocusable(
|
|
180
|
+
element: Element,
|
|
181
|
+
options?: { skipVisibilityCheck?: boolean },
|
|
182
|
+
): boolean {
|
|
183
|
+
return (
|
|
184
|
+
element.matches(FOCUSABLE_ELEMENT_SELECTOR) &&
|
|
185
|
+
!isInert(element) &&
|
|
186
|
+
(options?.skipVisibilityCheck || isElementVisible(element))
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Checks if an element is tabbable (reachable via the Tab key): focusable,
|
|
192
|
+
* visible, not inert, and not `tabindex="-1"`.
|
|
193
|
+
*/
|
|
194
|
+
export function isTabbable(element: Element): boolean {
|
|
195
|
+
return (
|
|
196
|
+
element.matches(TABBABLE_ELEMENT_SELECTOR) && isElementVisible(element) && !isInert(element)
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function isInert(element: Element): boolean {
|
|
201
|
+
let node: Element | null = element;
|
|
202
|
+
while (node != null) {
|
|
203
|
+
// Realm-tolerant HTMLElement check (see isHTMLOrSVGElement): Solid-portaled
|
|
204
|
+
// nodes keep their creating realm's prototype, so also accept the global one.
|
|
205
|
+
const isHTMLElement =
|
|
206
|
+
node instanceof getOwnerWindow(node).HTMLElement ||
|
|
207
|
+
(typeof HTMLElement !== "undefined" && node instanceof HTMLElement);
|
|
208
|
+
if (isHTMLElement && (node as HTMLElement).inert) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
node = node.parentElement;
|
|
98
213
|
}
|
|
99
214
|
|
|
100
215
|
return false;
|
|
@@ -285,6 +400,30 @@ export function getScrollParent(node: Element, checkForOverflow?: boolean): Elem
|
|
|
285
400
|
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
286
401
|
}
|
|
287
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Gets every scrollable ancestor of an element, from the nearest up to (and
|
|
405
|
+
* including) the document scrolling element.
|
|
406
|
+
* @param node - The starting element
|
|
407
|
+
* @param checkForOverflow - If true, only include parents that actually overflow
|
|
408
|
+
*/
|
|
409
|
+
export function getScrollParents(node: Element, checkForOverflow?: boolean): Element[] {
|
|
410
|
+
const parentElements: Element[] = [];
|
|
411
|
+
const root = document.scrollingElement || document.documentElement;
|
|
412
|
+
let current: Element | null = node;
|
|
413
|
+
|
|
414
|
+
while (current) {
|
|
415
|
+
if (isScrollable(current, checkForOverflow)) {
|
|
416
|
+
parentElements.push(current);
|
|
417
|
+
}
|
|
418
|
+
if (current === root) {
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
current = current.parentElement;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return parentElements;
|
|
425
|
+
}
|
|
426
|
+
|
|
288
427
|
/**
|
|
289
428
|
* Checks if an element will open a virtual keyboard when focused.
|
|
290
429
|
* Used for iOS Safari scroll handling.
|
|
@@ -332,3 +471,54 @@ export function willOpenKeyboard(target: Element | null): boolean {
|
|
|
332
471
|
|
|
333
472
|
return false;
|
|
334
473
|
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Returns the deepest active element, descending through open shadow roots.
|
|
477
|
+
* Mirrors @react-aria/utils' `getActiveElement`.
|
|
478
|
+
*/
|
|
479
|
+
export function getActiveElement(doc: Document = document): Element | null {
|
|
480
|
+
let activeElement = doc.activeElement;
|
|
481
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
482
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
483
|
+
}
|
|
484
|
+
return activeElement;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Whether the (deepest) active element is `element` or is contained within it.
|
|
489
|
+
* Mirrors @react-aria/utils' `isFocusWithin`.
|
|
490
|
+
*/
|
|
491
|
+
export function isFocusWithin(element: Element): boolean {
|
|
492
|
+
const activeElement = getActiveElement(getOwnerDocument(element));
|
|
493
|
+
return !!activeElement && nodeContains(element, activeElement);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Creates a `TreeWalker` that visits the focusable (or, when `tabbable`, the
|
|
498
|
+
* tabbable) descendants of `root`, skipping invisible and inert elements.
|
|
499
|
+
* Mirrors @react-aria/focus's `getFocusableTreeWalker`, minus the focus-scope
|
|
500
|
+
* containment filter (we don't model nested scopes here). Used to treat a
|
|
501
|
+
* selectable collection as a single tab stop.
|
|
502
|
+
*/
|
|
503
|
+
export function getFocusableTreeWalker(
|
|
504
|
+
root: Element,
|
|
505
|
+
opts?: { tabbable?: boolean; from?: Node },
|
|
506
|
+
): TreeWalker {
|
|
507
|
+
const accept = (node: Element) => (opts?.tabbable ? isTabbable(node) : isFocusable(node));
|
|
508
|
+
const walker = getOwnerDocument(root).createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
509
|
+
acceptNode(node) {
|
|
510
|
+
// Skip nodes inside the optional starting node.
|
|
511
|
+
if (opts?.from?.contains(node)) {
|
|
512
|
+
return NodeFilter.FILTER_REJECT;
|
|
513
|
+
}
|
|
514
|
+
if (accept(node as Element)) {
|
|
515
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
516
|
+
}
|
|
517
|
+
return NodeFilter.FILTER_SKIP;
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
if (opts?.from) {
|
|
521
|
+
walker.currentNode = opts.from;
|
|
522
|
+
}
|
|
523
|
+
return walker;
|
|
524
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export {
|
|
|
21
21
|
nodeContains,
|
|
22
22
|
getEventTarget,
|
|
23
23
|
isFocusable,
|
|
24
|
+
isTabbable,
|
|
25
|
+
isElementVisible,
|
|
24
26
|
isValidKeyboardEvent,
|
|
25
27
|
isValidInputKey,
|
|
26
28
|
isHTMLAnchorLink,
|
|
@@ -29,9 +31,12 @@ export {
|
|
|
29
31
|
openLink,
|
|
30
32
|
isScrollable,
|
|
31
33
|
getScrollParent,
|
|
34
|
+
getScrollParents,
|
|
32
35
|
willOpenKeyboard,
|
|
33
36
|
} from "./dom";
|
|
34
37
|
|
|
38
|
+
export { scrollIntoView, scrollIntoViewport } from "./scrollIntoView";
|
|
39
|
+
|
|
35
40
|
export {
|
|
36
41
|
areRectanglesOverlapping,
|
|
37
42
|
getPointClientRect,
|
|
@@ -51,6 +56,7 @@ export {
|
|
|
51
56
|
} from "./events";
|
|
52
57
|
|
|
53
58
|
export { disableTextSelection, restoreTextSelection } from "./textSelection";
|
|
59
|
+
export { isCtrlKeyPressed } from "./keyboard";
|
|
54
60
|
|
|
55
61
|
export { focusWithoutScrolling, focusSafely, preventFocus } from "./focus";
|
|
56
62
|
|
|
@@ -68,3 +74,5 @@ export {
|
|
|
68
74
|
getDescriptionNodeCount,
|
|
69
75
|
clearDescriptionNodes,
|
|
70
76
|
} from "./createDescription";
|
|
77
|
+
|
|
78
|
+
export { createEnterAnimation, createExitAnimation, type ElementAccessor } from "./animation";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard / modifier-key helpers.
|
|
3
|
+
* Based on @react-aria/utils' keyboard utilities.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { isMac } from "./platform";
|
|
7
|
+
|
|
8
|
+
/** The modifier-key fields consulted by {@link isCtrlKeyPressed}. */
|
|
9
|
+
interface ModifierKeyEvent {
|
|
10
|
+
ctrlKey?: boolean;
|
|
11
|
+
metaKey?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether the platform's non-contiguous selection modifier is pressed:
|
|
16
|
+
* the Command key on macOS, the Control key elsewhere. Mirrors
|
|
17
|
+
* `@react-aria/utils`' `isCtrlKeyPressed`.
|
|
18
|
+
*/
|
|
19
|
+
export function isCtrlKeyPressed(e: ModifierKeyEvent): boolean {
|
|
20
|
+
if (isMac()) {
|
|
21
|
+
return e.metaKey === true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return e.ctrlKey === true;
|
|
25
|
+
}
|
package/src/utils/mergeProps.ts
CHANGED
|
@@ -44,7 +44,14 @@ export function mergeProps<R extends object = Record<string, unknown>, T extends
|
|
|
44
44
|
key[2] === key[2]?.toUpperCase()
|
|
45
45
|
) {
|
|
46
46
|
setResultValue(key, chainHandlers(existingValue as Function, value as Function));
|
|
47
|
-
} else if (
|
|
47
|
+
} else if (
|
|
48
|
+
(key === "class" || key === "className" || key === "UNSAFE_className") &&
|
|
49
|
+
typeof existingValue === "string" &&
|
|
50
|
+
typeof value === "string"
|
|
51
|
+
) {
|
|
52
|
+
// Join only when both sides are plain strings (react-aria mergeProps
|
|
53
|
+
// semantics); a render-prop class function must pass through intact,
|
|
54
|
+
// not be coerced to its source text.
|
|
48
55
|
setResultValue(key, mergeClassNames(existingValue, value));
|
|
49
56
|
} else if (
|
|
50
57
|
key === "style" &&
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scroll-into-view utilities.
|
|
3
|
+
* Based on @react-aria/utils scrollIntoView (react-aria/src/utils/scrollIntoView.ts).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { getScrollParents } from "./dom";
|
|
7
|
+
import { isIOS } from "./platform";
|
|
8
|
+
import { isTestEnv } from "./env";
|
|
9
|
+
|
|
10
|
+
interface ScrollIntoViewOpts {
|
|
11
|
+
/** The position to align items along the block axis in. */
|
|
12
|
+
block?: ScrollLogicalPosition;
|
|
13
|
+
/** The position to align items along the inline axis in. */
|
|
14
|
+
inline?: ScrollLogicalPosition;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ScrollIntoViewportOpts {
|
|
18
|
+
/** The optional containing element of the target to be centered in the viewport. */
|
|
19
|
+
containingElement?: Element | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Scrolls `scrollView` so that `element` is visible.
|
|
24
|
+
* Similar to `element.scrollIntoView({block: 'nearest'})` (not supported in Edge),
|
|
25
|
+
* but doesn't affect parents above `scrollView`.
|
|
26
|
+
*/
|
|
27
|
+
export function scrollIntoView(
|
|
28
|
+
scrollView: HTMLElement,
|
|
29
|
+
element: HTMLElement,
|
|
30
|
+
opts: ScrollIntoViewOpts = {},
|
|
31
|
+
): void {
|
|
32
|
+
const { block = "nearest", inline = "nearest" } = opts;
|
|
33
|
+
|
|
34
|
+
if (scrollView === element) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let y = scrollView.scrollTop;
|
|
39
|
+
let x = scrollView.scrollLeft;
|
|
40
|
+
|
|
41
|
+
const target = element.getBoundingClientRect();
|
|
42
|
+
const view = scrollView.getBoundingClientRect();
|
|
43
|
+
const itemStyle = window.getComputedStyle(element);
|
|
44
|
+
const viewStyle = window.getComputedStyle(scrollView);
|
|
45
|
+
const root = document.scrollingElement || document.documentElement;
|
|
46
|
+
const isRoot = scrollView === root;
|
|
47
|
+
|
|
48
|
+
const viewTop = scrollView === root ? 0 : view.top;
|
|
49
|
+
const viewBottom = scrollView === root ? scrollView.clientHeight : view.bottom;
|
|
50
|
+
const viewLeft = scrollView === root ? 0 : view.left;
|
|
51
|
+
const viewRight = scrollView === root ? scrollView.clientWidth : view.right;
|
|
52
|
+
|
|
53
|
+
const scrollMarginTop = parseFloat(itemStyle.scrollMarginTop) || 0;
|
|
54
|
+
const scrollMarginBottom = parseFloat(itemStyle.scrollMarginBottom) || 0;
|
|
55
|
+
const scrollMarginLeft = parseFloat(itemStyle.scrollMarginLeft) || 0;
|
|
56
|
+
const scrollMarginRight = parseFloat(itemStyle.scrollMarginRight) || 0;
|
|
57
|
+
|
|
58
|
+
const scrollPaddingTop = parseFloat(viewStyle.scrollPaddingTop) || 0;
|
|
59
|
+
const scrollPaddingBottom = parseFloat(viewStyle.scrollPaddingBottom) || 0;
|
|
60
|
+
const scrollPaddingLeft = parseFloat(viewStyle.scrollPaddingLeft) || 0;
|
|
61
|
+
const scrollPaddingRight = parseFloat(viewStyle.scrollPaddingRight) || 0;
|
|
62
|
+
|
|
63
|
+
const borderTopWidth = parseFloat(viewStyle.borderTopWidth) || 0;
|
|
64
|
+
const borderBottomWidth = parseFloat(viewStyle.borderBottomWidth) || 0;
|
|
65
|
+
const borderLeftWidth = parseFloat(viewStyle.borderLeftWidth) || 0;
|
|
66
|
+
const borderRightWidth = parseFloat(viewStyle.borderRightWidth) || 0;
|
|
67
|
+
|
|
68
|
+
const scrollAreaTop = target.top - scrollMarginTop;
|
|
69
|
+
const scrollAreaBottom = target.bottom + scrollMarginBottom;
|
|
70
|
+
const scrollAreaLeft = target.left - scrollMarginLeft;
|
|
71
|
+
const scrollAreaRight = target.right + scrollMarginRight;
|
|
72
|
+
|
|
73
|
+
const scrollBarOffsetX = scrollView === root ? 0 : borderLeftWidth + borderRightWidth;
|
|
74
|
+
const scrollBarOffsetY = scrollView === root ? 0 : borderTopWidth + borderBottomWidth;
|
|
75
|
+
const scrollBarWidth =
|
|
76
|
+
scrollView === root ? 0 : scrollView.offsetWidth - scrollView.clientWidth - scrollBarOffsetX;
|
|
77
|
+
const scrollBarHeight =
|
|
78
|
+
scrollView === root ? 0 : scrollView.offsetHeight - scrollView.clientHeight - scrollBarOffsetY;
|
|
79
|
+
|
|
80
|
+
const scrollPortTop = viewTop + (isRoot ? 0 : borderTopWidth) + scrollPaddingTop;
|
|
81
|
+
const scrollPortBottom =
|
|
82
|
+
viewBottom - (isRoot ? 0 : borderBottomWidth) - scrollPaddingBottom - scrollBarHeight;
|
|
83
|
+
let scrollPortLeft = viewLeft + (isRoot ? 0 : borderLeftWidth) + scrollPaddingLeft;
|
|
84
|
+
let scrollPortRight = viewRight - (isRoot ? 0 : borderRightWidth) - scrollPaddingRight;
|
|
85
|
+
|
|
86
|
+
// IOS always positions the scrollbar on the right ¯\_(ツ)_/¯
|
|
87
|
+
if (viewStyle.direction === "rtl" && !isIOS()) {
|
|
88
|
+
scrollPortLeft += scrollBarWidth;
|
|
89
|
+
} else {
|
|
90
|
+
scrollPortRight -= scrollBarWidth;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const shouldScrollBlock = scrollAreaTop < scrollPortTop || scrollAreaBottom > scrollPortBottom;
|
|
94
|
+
const shouldScrollInline = scrollAreaLeft < scrollPortLeft || scrollAreaRight > scrollPortRight;
|
|
95
|
+
|
|
96
|
+
if (shouldScrollBlock && block === "start") {
|
|
97
|
+
y += scrollAreaTop - scrollPortTop;
|
|
98
|
+
} else if (shouldScrollBlock && block === "center") {
|
|
99
|
+
y += (scrollAreaTop + scrollAreaBottom) / 2 - (scrollPortTop + scrollPortBottom) / 2;
|
|
100
|
+
} else if (shouldScrollBlock && block === "end") {
|
|
101
|
+
y += scrollAreaBottom - scrollPortBottom;
|
|
102
|
+
} else if (shouldScrollBlock && block === "nearest") {
|
|
103
|
+
const start = scrollAreaTop - scrollPortTop;
|
|
104
|
+
const end = scrollAreaBottom - scrollPortBottom;
|
|
105
|
+
y += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (shouldScrollInline && inline === "start") {
|
|
109
|
+
x += scrollAreaLeft - scrollPortLeft;
|
|
110
|
+
} else if (shouldScrollInline && inline === "center") {
|
|
111
|
+
x += (scrollAreaLeft + scrollAreaRight) / 2 - (scrollPortLeft + scrollPortRight) / 2;
|
|
112
|
+
} else if (shouldScrollInline && inline === "end") {
|
|
113
|
+
x += scrollAreaRight - scrollPortRight;
|
|
114
|
+
} else if (shouldScrollInline && inline === "nearest") {
|
|
115
|
+
const start = scrollAreaLeft - scrollPortLeft;
|
|
116
|
+
const end = scrollAreaRight - scrollPortRight;
|
|
117
|
+
x += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (isTestEnv()) {
|
|
121
|
+
scrollView.scrollLeft = x;
|
|
122
|
+
scrollView.scrollTop = y;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
scrollView.scrollTo({ left: x, top: y });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Scrolls the `targetElement` so it is visible in the viewport. Accepts an optional
|
|
131
|
+
* `opts.containingElement` that will be centered in the viewport prior to scrolling the
|
|
132
|
+
* targetElement into view. If scrolling is prevented on the body (e.g. targetElement is in a
|
|
133
|
+
* popover), this will only scroll the scroll parents of the targetElement up to but not including
|
|
134
|
+
* the body itself.
|
|
135
|
+
*/
|
|
136
|
+
export function scrollIntoViewport(
|
|
137
|
+
targetElement: Element | null,
|
|
138
|
+
opts: ScrollIntoViewportOpts = {},
|
|
139
|
+
): void {
|
|
140
|
+
const { containingElement } = opts;
|
|
141
|
+
if (targetElement && targetElement.isConnected) {
|
|
142
|
+
const root = document.scrollingElement || document.documentElement;
|
|
143
|
+
const isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
|
|
144
|
+
if (!isScrollPrevented) {
|
|
145
|
+
const { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
146
|
+
|
|
147
|
+
// use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
|
|
148
|
+
// won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
|
|
149
|
+
targetElement?.scrollIntoView?.({ block: "nearest" });
|
|
150
|
+
const { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
151
|
+
// Account for sub pixel differences from rounding
|
|
152
|
+
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
153
|
+
containingElement?.scrollIntoView?.({ block: "center", inline: "center" });
|
|
154
|
+
targetElement.scrollIntoView?.({ block: "nearest" });
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
const { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
158
|
+
|
|
159
|
+
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
|
|
160
|
+
let scrollParents = getScrollParents(targetElement, true);
|
|
161
|
+
for (const scrollParent of scrollParents) {
|
|
162
|
+
scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);
|
|
163
|
+
}
|
|
164
|
+
const { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
165
|
+
// Account for sub pixel differences from rounding
|
|
166
|
+
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
167
|
+
scrollParents = containingElement ? getScrollParents(containingElement, true) : [];
|
|
168
|
+
// scroll containing element into view first, then rescroll target element into view like the non chrome flow above
|
|
169
|
+
for (const scrollParent of scrollParents) {
|
|
170
|
+
scrollIntoView(scrollParent as HTMLElement, containingElement as HTMLElement, {
|
|
171
|
+
block: "center",
|
|
172
|
+
inline: "center",
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
for (const scrollParent of getScrollParents(targetElement, true)) {
|
|
176
|
+
scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|