@base-ui/react 1.1.0 → 1.2.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/CHANGELOG.md +173 -0
- package/accordion/item/AccordionItem.d.ts +1 -1
- package/accordion/item/AccordionItemContext.d.ts +1 -1
- package/accordion/root/AccordionRoot.d.ts +9 -9
- package/alert-dialog/root/AlertDialogRoot.d.ts +3 -3
- package/alert-dialog/root/AlertDialogRoot.js +6 -4
- package/autocomplete/index.parts.d.ts +2 -1
- package/autocomplete/index.parts.js +8 -1
- package/autocomplete/root/AutocompleteRoot.d.ts +19 -14
- package/autocomplete/root/AutocompleteRoot.js +4 -6
- package/avatar/fallback/AvatarFallback.d.ts +7 -2
- package/avatar/fallback/AvatarFallback.js +34 -6
- package/avatar/image/AvatarImage.d.ts +7 -2
- package/avatar/image/AvatarImage.js +35 -6
- package/avatar/image/useImageLoadingStatus.d.ts +2 -2
- package/avatar/root/AvatarRoot.js +2 -2
- package/button/Button.d.ts +1 -1
- package/button/Button.js +2 -2
- package/checkbox/indicator/CheckboxIndicator.d.ts +1 -1
- package/checkbox/indicator/CheckboxIndicator.js +4 -4
- package/checkbox/root/CheckboxRoot.d.ts +13 -13
- package/checkbox/root/CheckboxRoot.js +31 -8
- package/checkbox-group/CheckboxGroup.d.ts +5 -5
- package/checkbox-group/CheckboxGroup.js +2 -2
- package/checkbox-group/useCheckboxGroupParent.d.ts +3 -3
- package/collapsible/panel/CollapsiblePanel.d.ts +2 -2
- package/collapsible/root/CollapsibleRoot.d.ts +4 -4
- package/collapsible/root/useCollapsibleRoot.d.ts +2 -2
- package/combobox/arrow/ComboboxArrow.js +2 -2
- package/combobox/arrow/ComboboxArrowDataAttributes.js +2 -2
- package/combobox/backdrop/ComboboxBackdrop.js +2 -2
- package/combobox/chip/ComboboxChip.js +6 -3
- package/combobox/chip/ComboboxChipContext.js +1 -0
- package/combobox/chip-remove/ComboboxChipRemove.js +28 -33
- package/combobox/chips/ComboboxChipsContext.js +1 -0
- package/combobox/clear/ComboboxClear.d.ts +2 -2
- package/combobox/clear/ComboboxClear.js +2 -3
- package/combobox/group/ComboboxGroup.d.ts +1 -1
- package/combobox/group/ComboboxGroupContext.d.ts +1 -1
- package/combobox/group/ComboboxGroupContext.js +1 -0
- package/combobox/icon/ComboboxIcon.d.ts +1 -1
- package/combobox/index.parts.d.ts +2 -1
- package/combobox/index.parts.js +8 -1
- package/combobox/input/ComboboxInput.d.ts +1 -1
- package/combobox/input/ComboboxInput.js +38 -8
- package/combobox/item/ComboboxItem.d.ts +3 -3
- package/combobox/item/ComboboxItem.js +15 -15
- package/combobox/item/ComboboxItemContext.js +1 -0
- package/combobox/item-indicator/ComboboxItemIndicator.d.ts +1 -1
- package/combobox/item-indicator/ComboboxItemIndicator.js +2 -2
- package/combobox/list/ComboboxList.js +2 -2
- package/combobox/popup/ComboboxPopup.d.ts +2 -2
- package/combobox/popup/ComboboxPopup.js +3 -4
- package/combobox/popup/ComboboxPopupDataAttributes.js +2 -2
- package/combobox/portal/ComboboxPortal.d.ts +1 -1
- package/combobox/portal/ComboboxPortalContext.js +1 -0
- package/combobox/positioner/ComboboxPositioner.js +5 -3
- package/combobox/positioner/ComboboxPositionerDataAttributes.js +2 -2
- package/combobox/root/AriaCombobox.d.ts +49 -44
- package/combobox/root/AriaCombobox.js +44 -62
- package/combobox/root/ComboboxRoot.d.ts +19 -14
- package/combobox/root/ComboboxRoot.js +3 -1
- package/combobox/root/ComboboxRootContext.d.ts +1 -0
- package/combobox/root/ComboboxRootContext.js +1 -0
- package/combobox/root/utils/useFilter.d.ts +2 -2
- package/combobox/root/utils/useFilteredItems.d.ts +4 -0
- package/combobox/root/utils/useFilteredItems.js +14 -0
- package/combobox/row/ComboboxRowContext.js +1 -0
- package/combobox/store.d.ts +11 -11
- package/combobox/store.js +3 -3
- package/combobox/trigger/ComboboxTrigger.d.ts +1 -1
- package/combobox/trigger/ComboboxTrigger.js +3 -4
- package/composite/item/CompositeItem.d.ts +6 -6
- package/composite/list/CompositeList.d.ts +3 -3
- package/composite/list/CompositeListContext.d.ts +1 -1
- package/composite/list/useCompositeListItem.d.ts +5 -5
- package/composite/root/CompositeRoot.d.ts +19 -19
- package/composite/root/useCompositeRoot.d.ts +12 -12
- package/context-menu/index.d.ts +1 -0
- package/context-menu/index.parts.d.ts +1 -0
- package/context-menu/index.parts.js +7 -0
- package/context-menu/root/ContextMenuRoot.d.ts +1 -1
- package/context-menu/root/ContextMenuRootContext.js +1 -0
- package/context-menu/trigger/ContextMenuTrigger.js +13 -3
- package/csp-provider/CSPContext.d.ts +2 -2
- package/csp-provider/CSPProvider.d.ts +2 -2
- package/dialog/backdrop/DialogBackdrop.d.ts +1 -1
- package/dialog/backdrop/DialogBackdrop.js +2 -2
- package/dialog/close/DialogClose.js +2 -2
- package/dialog/popup/DialogPopup.d.ts +2 -2
- package/dialog/popup/DialogPopup.js +2 -2
- package/dialog/portal/DialogPortal.d.ts +2 -2
- package/dialog/portal/DialogPortalContext.js +1 -0
- package/dialog/root/DialogRoot.d.ts +10 -10
- package/dialog/root/DialogRoot.js +17 -4
- package/dialog/root/useDialogRoot.d.ts +3 -3
- package/dialog/root/useDialogRoot.js +4 -0
- package/dialog/store/DialogStore.d.ts +258 -17
- package/dialog/store/DialogStore.js +3 -0
- package/dialog/trigger/DialogTrigger.d.ts +3 -3
- package/dialog/trigger/DialogTrigger.js +3 -3
- package/dialog/viewport/DialogViewport.js +5 -2
- package/direction-provider/DirectionProvider.d.ts +1 -1
- package/drawer/backdrop/DrawerBackdrop.d.ts +28 -0
- package/drawer/backdrop/DrawerBackdrop.js +63 -0
- package/drawer/backdrop/DrawerBackdropCssVars.d.ts +7 -0
- package/drawer/backdrop/DrawerBackdropCssVars.js +14 -0
- package/drawer/close/DrawerClose.d.ts +23 -0
- package/drawer/close/DrawerClose.js +15 -0
- package/drawer/content/DrawerContent.d.ts +15 -0
- package/drawer/content/DrawerContent.js +32 -0
- package/drawer/description/DrawerDescription.d.ts +18 -0
- package/drawer/description/DrawerDescription.js +15 -0
- package/drawer/indent/DrawerIndent.d.ts +20 -0
- package/drawer/indent/DrawerIndent.js +87 -0
- package/drawer/indent-background/DrawerIndentBackground.d.ts +18 -0
- package/drawer/indent-background/DrawerIndentBackground.js +47 -0
- package/drawer/index.d.ts +14 -0
- package/drawer/index.js +9 -0
- package/drawer/index.parts.d.ts +14 -0
- package/drawer/index.parts.js +109 -0
- package/drawer/popup/DrawerPopup.d.ts +69 -0
- package/drawer/popup/DrawerPopup.js +291 -0
- package/drawer/popup/DrawerPopupCssVars.d.ts +37 -0
- package/drawer/popup/DrawerPopupCssVars.js +44 -0
- package/drawer/popup/DrawerPopupDataAttributes.d.ts +27 -0
- package/drawer/popup/DrawerPopupDataAttributes.js +34 -0
- package/drawer/portal/DrawerPortal.d.ts +29 -0
- package/drawer/portal/DrawerPortal.js +16 -0
- package/drawer/provider/DrawerProvider.d.ts +16 -0
- package/drawer/provider/DrawerProvider.js +100 -0
- package/drawer/provider/DrawerProviderContext.d.ts +19 -0
- package/drawer/provider/DrawerProviderContext.js +21 -0
- package/drawer/root/DrawerRoot.d.ts +124 -0
- package/drawer/root/DrawerRoot.js +235 -0
- package/drawer/root/DrawerRootContext.d.ts +89 -0
- package/drawer/root/DrawerRootContext.js +21 -0
- package/drawer/root/useDrawerSnapPoints.d.ts +15 -0
- package/drawer/root/useDrawerSnapPoints.js +155 -0
- package/drawer/swipe-area/DrawerSwipeArea.d.ts +45 -0
- package/drawer/swipe-area/DrawerSwipeArea.js +385 -0
- package/drawer/title/DrawerTitle.d.ts +18 -0
- package/drawer/title/DrawerTitle.js +15 -0
- package/drawer/trigger/DrawerTrigger.d.ts +43 -0
- package/drawer/trigger/DrawerTrigger.js +15 -0
- package/drawer/viewport/DrawerViewport.d.ts +30 -0
- package/drawer/viewport/DrawerViewport.js +873 -0
- package/drawer/viewport/DrawerViewportContext.d.ts +11 -0
- package/drawer/viewport/DrawerViewportContext.js +21 -0
- package/esm/accordion/item/AccordionItem.d.ts +1 -1
- package/esm/accordion/item/AccordionItemContext.d.ts +1 -1
- package/esm/accordion/root/AccordionRoot.d.ts +9 -9
- package/esm/alert-dialog/root/AlertDialogRoot.d.ts +3 -3
- package/esm/alert-dialog/root/AlertDialogRoot.js +6 -4
- package/esm/autocomplete/index.parts.d.ts +2 -1
- package/esm/autocomplete/index.parts.js +2 -1
- package/esm/autocomplete/root/AutocompleteRoot.d.ts +19 -14
- package/esm/autocomplete/root/AutocompleteRoot.js +4 -6
- package/esm/avatar/fallback/AvatarFallback.d.ts +7 -2
- package/esm/avatar/fallback/AvatarFallback.js +33 -6
- package/esm/avatar/image/AvatarImage.d.ts +7 -2
- package/esm/avatar/image/AvatarImage.js +34 -6
- package/esm/avatar/image/useImageLoadingStatus.d.ts +2 -2
- package/esm/avatar/root/AvatarRoot.js +2 -2
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js +2 -2
- package/esm/checkbox/indicator/CheckboxIndicator.d.ts +1 -1
- package/esm/checkbox/indicator/CheckboxIndicator.js +4 -4
- package/esm/checkbox/root/CheckboxRoot.d.ts +13 -13
- package/esm/checkbox/root/CheckboxRoot.js +31 -8
- package/esm/checkbox-group/CheckboxGroup.d.ts +5 -5
- package/esm/checkbox-group/CheckboxGroup.js +2 -2
- package/esm/checkbox-group/useCheckboxGroupParent.d.ts +3 -3
- package/esm/collapsible/panel/CollapsiblePanel.d.ts +2 -2
- package/esm/collapsible/root/CollapsibleRoot.d.ts +4 -4
- package/esm/collapsible/root/useCollapsibleRoot.d.ts +2 -2
- package/esm/combobox/arrow/ComboboxArrow.js +2 -2
- package/esm/combobox/arrow/ComboboxArrowDataAttributes.js +2 -2
- package/esm/combobox/backdrop/ComboboxBackdrop.js +2 -2
- package/esm/combobox/chip/ComboboxChip.js +6 -3
- package/esm/combobox/chip/ComboboxChipContext.js +2 -0
- package/esm/combobox/chip-remove/ComboboxChipRemove.js +28 -33
- package/esm/combobox/chips/ComboboxChipsContext.js +2 -0
- package/esm/combobox/clear/ComboboxClear.d.ts +2 -2
- package/esm/combobox/clear/ComboboxClear.js +2 -3
- package/esm/combobox/group/ComboboxGroup.d.ts +1 -1
- package/esm/combobox/group/ComboboxGroupContext.d.ts +1 -1
- package/esm/combobox/group/ComboboxGroupContext.js +2 -0
- package/esm/combobox/icon/ComboboxIcon.d.ts +1 -1
- package/esm/combobox/index.parts.d.ts +2 -1
- package/esm/combobox/index.parts.js +2 -1
- package/esm/combobox/input/ComboboxInput.d.ts +1 -1
- package/esm/combobox/input/ComboboxInput.js +38 -8
- package/esm/combobox/item/ComboboxItem.d.ts +3 -3
- package/esm/combobox/item/ComboboxItem.js +15 -15
- package/esm/combobox/item/ComboboxItemContext.js +2 -0
- package/esm/combobox/item-indicator/ComboboxItemIndicator.d.ts +1 -1
- package/esm/combobox/item-indicator/ComboboxItemIndicator.js +2 -2
- package/esm/combobox/list/ComboboxList.js +2 -2
- package/esm/combobox/popup/ComboboxPopup.d.ts +2 -2
- package/esm/combobox/popup/ComboboxPopup.js +3 -4
- package/esm/combobox/popup/ComboboxPopupDataAttributes.js +2 -2
- package/esm/combobox/portal/ComboboxPortal.d.ts +1 -1
- package/esm/combobox/portal/ComboboxPortalContext.js +2 -0
- package/esm/combobox/positioner/ComboboxPositioner.js +5 -3
- package/esm/combobox/positioner/ComboboxPositionerDataAttributes.js +2 -2
- package/esm/combobox/root/AriaCombobox.d.ts +49 -44
- package/esm/combobox/root/AriaCombobox.js +45 -63
- package/esm/combobox/root/ComboboxRoot.d.ts +19 -14
- package/esm/combobox/root/ComboboxRoot.js +3 -1
- package/esm/combobox/root/ComboboxRootContext.d.ts +1 -0
- package/esm/combobox/root/ComboboxRootContext.js +2 -0
- package/esm/combobox/root/utils/useFilter.d.ts +2 -2
- package/esm/combobox/root/utils/useFilteredItems.d.ts +4 -0
- package/esm/combobox/root/utils/useFilteredItems.js +9 -0
- package/esm/combobox/row/ComboboxRowContext.js +2 -0
- package/esm/combobox/store.d.ts +11 -11
- package/esm/combobox/store.js +3 -3
- package/esm/combobox/trigger/ComboboxTrigger.d.ts +1 -1
- package/esm/combobox/trigger/ComboboxTrigger.js +3 -4
- package/esm/composite/item/CompositeItem.d.ts +6 -6
- package/esm/composite/list/CompositeList.d.ts +3 -3
- package/esm/composite/list/CompositeListContext.d.ts +1 -1
- package/esm/composite/list/useCompositeListItem.d.ts +5 -5
- package/esm/composite/root/CompositeRoot.d.ts +19 -19
- package/esm/composite/root/useCompositeRoot.d.ts +12 -12
- package/esm/context-menu/index.d.ts +1 -0
- package/esm/context-menu/index.parts.d.ts +1 -0
- package/esm/context-menu/index.parts.js +1 -0
- package/esm/context-menu/root/ContextMenuRoot.d.ts +1 -1
- package/esm/context-menu/root/ContextMenuRootContext.js +2 -0
- package/esm/context-menu/trigger/ContextMenuTrigger.js +13 -3
- package/esm/csp-provider/CSPContext.d.ts +2 -2
- package/esm/csp-provider/CSPProvider.d.ts +2 -2
- package/esm/dialog/backdrop/DialogBackdrop.d.ts +1 -1
- package/esm/dialog/backdrop/DialogBackdrop.js +2 -2
- package/esm/dialog/close/DialogClose.js +2 -2
- package/esm/dialog/popup/DialogPopup.d.ts +2 -2
- package/esm/dialog/popup/DialogPopup.js +2 -2
- package/esm/dialog/portal/DialogPortal.d.ts +2 -2
- package/esm/dialog/portal/DialogPortalContext.js +2 -0
- package/esm/dialog/root/DialogRoot.d.ts +10 -10
- package/esm/dialog/root/DialogRoot.js +17 -4
- package/esm/dialog/root/useDialogRoot.d.ts +3 -3
- package/esm/dialog/root/useDialogRoot.js +4 -0
- package/esm/dialog/store/DialogStore.d.ts +258 -17
- package/esm/dialog/store/DialogStore.js +3 -0
- package/esm/dialog/trigger/DialogTrigger.d.ts +3 -3
- package/esm/dialog/trigger/DialogTrigger.js +2 -2
- package/esm/dialog/viewport/DialogViewport.js +5 -2
- package/esm/direction-provider/DirectionProvider.d.ts +1 -1
- package/esm/drawer/backdrop/DrawerBackdrop.d.ts +28 -0
- package/esm/drawer/backdrop/DrawerBackdrop.js +57 -0
- package/esm/drawer/backdrop/DrawerBackdropCssVars.d.ts +7 -0
- package/esm/drawer/backdrop/DrawerBackdropCssVars.js +8 -0
- package/esm/drawer/close/DrawerClose.d.ts +23 -0
- package/esm/drawer/close/DrawerClose.js +10 -0
- package/esm/drawer/content/DrawerContent.d.ts +15 -0
- package/esm/drawer/content/DrawerContent.js +27 -0
- package/esm/drawer/description/DrawerDescription.d.ts +18 -0
- package/esm/drawer/description/DrawerDescription.js +10 -0
- package/esm/drawer/indent/DrawerIndent.d.ts +20 -0
- package/esm/drawer/indent/DrawerIndent.js +81 -0
- package/esm/drawer/indent-background/DrawerIndentBackground.d.ts +18 -0
- package/esm/drawer/indent-background/DrawerIndentBackground.js +41 -0
- package/esm/drawer/index.d.ts +14 -0
- package/esm/drawer/index.js +1 -0
- package/esm/drawer/index.parts.d.ts +14 -0
- package/esm/drawer/index.parts.js +14 -0
- package/esm/drawer/popup/DrawerPopup.d.ts +69 -0
- package/esm/drawer/popup/DrawerPopup.js +285 -0
- package/esm/drawer/popup/DrawerPopupCssVars.d.ts +37 -0
- package/esm/drawer/popup/DrawerPopupCssVars.js +38 -0
- package/esm/drawer/popup/DrawerPopupDataAttributes.d.ts +27 -0
- package/esm/drawer/popup/DrawerPopupDataAttributes.js +28 -0
- package/esm/drawer/portal/DrawerPortal.d.ts +29 -0
- package/esm/drawer/portal/DrawerPortal.js +11 -0
- package/esm/drawer/provider/DrawerProvider.d.ts +16 -0
- package/esm/drawer/provider/DrawerProvider.js +95 -0
- package/esm/drawer/provider/DrawerProviderContext.d.ts +19 -0
- package/esm/drawer/provider/DrawerProviderContext.js +13 -0
- package/esm/drawer/root/DrawerRoot.d.ts +124 -0
- package/esm/drawer/root/DrawerRoot.js +229 -0
- package/esm/drawer/root/DrawerRootContext.d.ts +89 -0
- package/esm/drawer/root/DrawerRootContext.js +13 -0
- package/esm/drawer/root/useDrawerSnapPoints.d.ts +15 -0
- package/esm/drawer/root/useDrawerSnapPoints.js +149 -0
- package/esm/drawer/swipe-area/DrawerSwipeArea.d.ts +45 -0
- package/esm/drawer/swipe-area/DrawerSwipeArea.js +379 -0
- package/esm/drawer/title/DrawerTitle.d.ts +18 -0
- package/esm/drawer/title/DrawerTitle.js +10 -0
- package/esm/drawer/trigger/DrawerTrigger.d.ts +43 -0
- package/esm/drawer/trigger/DrawerTrigger.js +10 -0
- package/esm/drawer/viewport/DrawerViewport.d.ts +30 -0
- package/esm/drawer/viewport/DrawerViewport.js +867 -0
- package/esm/drawer/viewport/DrawerViewportContext.d.ts +11 -0
- package/esm/drawer/viewport/DrawerViewportContext.js +13 -0
- package/esm/field/control/FieldControl.d.ts +3 -3
- package/esm/field/control/FieldControl.js +22 -20
- package/esm/field/error/FieldError.d.ts +5 -2
- package/esm/field/error/FieldError.js +50 -7
- package/esm/field/item/FieldItem.d.ts +1 -1
- package/esm/field/item/FieldItemContext.js +2 -0
- package/esm/field/label/FieldLabel.d.ts +1 -1
- package/esm/field/label/FieldLabel.js +7 -2
- package/esm/field/root/FieldRoot.d.ts +9 -9
- package/esm/field/root/FieldRootContext.d.ts +1 -1
- package/esm/field/useField.d.ts +1 -1
- package/esm/field/useField.js +2 -0
- package/esm/field/validity/FieldValidity.d.ts +2 -0
- package/esm/field/validity/FieldValidity.js +11 -4
- package/esm/fieldset/legend/FieldsetLegend.js +2 -2
- package/esm/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/esm/fieldset/root/FieldsetRoot.js +3 -3
- package/esm/floating-ui-react/components/FloatingDelayGroup.d.ts +2 -7
- package/esm/floating-ui-react/components/FloatingDelayGroup.js +2 -9
- package/esm/floating-ui-react/components/FloatingFocusManager.d.ts +11 -21
- package/esm/floating-ui-react/components/FloatingFocusManager.js +63 -76
- package/esm/floating-ui-react/components/FloatingPortal.d.ts +8 -9
- package/esm/floating-ui-react/components/FloatingPortal.js +1 -3
- package/esm/floating-ui-react/components/FloatingTree.d.ts +1 -1
- package/esm/floating-ui-react/hooks/useClick.d.ts +12 -6
- package/esm/floating-ui-react/hooks/useClick.js +6 -5
- package/esm/floating-ui-react/hooks/useClientPoint.d.ts +2 -12
- package/esm/floating-ui-react/hooks/useClientPoint.js +5 -16
- package/esm/floating-ui-react/hooks/useDismiss.d.ts +15 -15
- package/esm/floating-ui-react/hooks/useDismiss.js +6 -3
- package/esm/floating-ui-react/hooks/useFloating.js +2 -0
- package/esm/floating-ui-react/hooks/useFloatingRootContext.d.ts +4 -10
- package/esm/floating-ui-react/hooks/useFloatingRootContext.js +5 -3
- package/esm/floating-ui-react/hooks/useFocus.d.ts +2 -8
- package/esm/floating-ui-react/hooks/useFocus.js +11 -12
- package/esm/floating-ui-react/hooks/useHover.d.ts +7 -30
- package/esm/floating-ui-react/hooks/useHover.js +20 -37
- package/esm/floating-ui-react/hooks/useHoverFloatingInteraction.d.ts +2 -7
- package/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +35 -40
- package/esm/floating-ui-react/hooks/useHoverInteractionSharedState.d.ts +17 -14
- package/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js +36 -30
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +7 -3
- package/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +57 -60
- package/esm/floating-ui-react/hooks/useInteractions.d.ts +2 -2
- package/esm/floating-ui-react/hooks/useListNavigation.d.ts +19 -35
- package/esm/floating-ui-react/hooks/useListNavigation.js +13 -12
- package/esm/floating-ui-react/hooks/useRole.d.ts +1 -7
- package/esm/floating-ui-react/hooks/useRole.js +2 -3
- package/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.d.ts +2 -2
- package/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js +2 -0
- package/esm/floating-ui-react/hooks/useTypeahead.d.ts +6 -16
- package/esm/floating-ui-react/hooks/useTypeahead.js +48 -16
- package/esm/floating-ui-react/middleware/arrow.d.ts +1 -1
- package/esm/floating-ui-react/safePolygon.d.ts +3 -3
- package/esm/floating-ui-react/types.d.ts +14 -14
- package/esm/floating-ui-react/utils/composite.d.ts +5 -5
- package/esm/floating-ui-react/utils/composite.js +1 -2
- package/esm/floating-ui-react/utils/element.d.ts +2 -1
- package/esm/floating-ui-react/utils/element.js +16 -4
- package/esm/floating-ui-react/utils/enqueueFocus.d.ts +3 -3
- package/esm/floating-ui-react/utils/event.js +2 -4
- package/esm/floating-ui-react/utils/markOthers.js +2 -2
- package/esm/floating-ui-react/utils/tabbable.js +6 -5
- package/esm/form/Form.d.ts +5 -5
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/input/Input.d.ts +3 -3
- package/esm/labelable-provider/LabelableContext.d.ts +1 -1
- package/esm/labelable-provider/LabelableContext.js +1 -1
- package/esm/labelable-provider/LabelableProvider.js +33 -3
- package/esm/labelable-provider/useLabelableId.d.ts +3 -2
- package/esm/labelable-provider/useLabelableId.js +38 -12
- package/esm/menu/arrow/MenuArrow.js +2 -2
- package/esm/menu/arrow/MenuArrowDataAttributes.js +2 -2
- package/esm/menu/backdrop/MenuBackdrop.js +2 -2
- package/esm/menu/checkbox-item/MenuCheckboxItem.d.ts +8 -8
- package/esm/menu/checkbox-item/MenuCheckboxItemContext.js +2 -0
- package/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +2 -2
- package/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js +3 -3
- package/esm/menu/group/MenuGroupContext.js +2 -0
- package/esm/menu/index.d.ts +2 -1
- package/esm/menu/index.parts.d.ts +1 -0
- package/esm/menu/index.parts.js +1 -0
- package/esm/menu/item/MenuItem.d.ts +5 -5
- package/esm/menu/item/MenuItem.js +2 -2
- package/esm/menu/item/useMenuItem.js +12 -48
- package/esm/menu/item/useMenuItemCommonProps.d.ts +43 -0
- package/esm/menu/item/useMenuItemCommonProps.js +66 -0
- package/esm/menu/link-item/MenuLinkItem.d.ts +34 -0
- package/esm/menu/link-item/MenuLinkItem.js +55 -0
- package/esm/menu/link-item/MenuLinkItemDataAttributes.d.ts +6 -0
- package/esm/menu/link-item/MenuLinkItemDataAttributes.js +7 -0
- package/esm/menu/popup/MenuPopup.d.ts +3 -2
- package/esm/menu/popup/MenuPopup.js +2 -2
- package/esm/menu/popup/MenuPopupDataAttributes.js +2 -2
- package/esm/menu/portal/MenuPortal.d.ts +1 -1
- package/esm/menu/portal/MenuPortalContext.js +2 -0
- package/esm/menu/positioner/MenuPositioner.js +6 -12
- package/esm/menu/positioner/MenuPositionerDataAttributes.js +2 -2
- package/esm/menu/radio-group/MenuRadioGroup.d.ts +2 -2
- package/esm/menu/radio-group/MenuRadioGroup.js +2 -2
- package/esm/menu/radio-group/MenuRadioGroupContext.js +2 -0
- package/esm/menu/radio-item/MenuRadioItem.d.ts +5 -5
- package/esm/menu/radio-item/MenuRadioItemContext.js +2 -0
- package/esm/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +2 -2
- package/esm/menu/radio-item-indicator/MenuRadioItemIndicator.js +3 -3
- package/esm/menu/root/MenuRoot.d.ts +15 -15
- package/esm/menu/root/MenuRoot.js +38 -36
- package/esm/menu/store/MenuStore.d.ts +255 -15
- package/esm/menu/store/MenuStore.js +2 -11
- package/esm/menu/submenu-root/MenuSubmenuRoot.d.ts +2 -2
- package/esm/menu/submenu-root/MenuSubmenuRootContext.js +2 -0
- package/esm/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +22 -22
- package/esm/menu/submenu-trigger/MenuSubmenuTrigger.js +9 -7
- package/esm/menu/trigger/MenuTrigger.d.ts +10 -6
- package/esm/menu/trigger/MenuTrigger.js +4 -3
- package/esm/menubar/Menubar.d.ts +4 -4
- package/esm/menubar/Menubar.js +2 -2
- package/esm/meter/root/MeterRoot.d.ts +6 -6
- package/esm/meter/root/MeterRoot.js +3 -11
- package/esm/meter/value/MeterValue.d.ts +1 -1
- package/esm/navigation-menu/arrow/NavigationMenuArrow.js +2 -2
- package/esm/navigation-menu/arrow/NavigationMenuArrowDataAttributes.js +2 -2
- package/esm/navigation-menu/backdrop/NavigationMenuBackdrop.js +2 -2
- package/esm/navigation-menu/content/NavigationMenuContent.d.ts +8 -1
- package/esm/navigation-menu/content/NavigationMenuContent.js +26 -5
- package/esm/navigation-menu/icon/NavigationMenuIcon.d.ts +1 -1
- package/esm/navigation-menu/icon/NavigationMenuIcon.js +2 -2
- package/esm/navigation-menu/item/NavigationMenuItem.d.ts +1 -1
- package/esm/navigation-menu/item/NavigationMenuItemContext.js +2 -0
- package/esm/navigation-menu/link/NavigationMenuLink.d.ts +2 -2
- package/esm/navigation-menu/link/NavigationMenuLink.js +2 -2
- package/esm/navigation-menu/list/NavigationMenuDismissContext.js +2 -0
- package/esm/navigation-menu/list/NavigationMenuList.d.ts +1 -1
- package/esm/navigation-menu/list/NavigationMenuList.js +2 -2
- package/esm/navigation-menu/popup/NavigationMenuPopup.d.ts +13 -0
- package/esm/navigation-menu/popup/NavigationMenuPopup.js +2 -2
- package/esm/navigation-menu/popup/NavigationMenuPopupDataAttributes.js +2 -2
- package/esm/navigation-menu/portal/NavigationMenuPortal.d.ts +2 -2
- package/esm/navigation-menu/portal/NavigationMenuPortalContext.js +2 -0
- package/esm/navigation-menu/positioner/NavigationMenuPositioner.js +2 -2
- package/esm/navigation-menu/positioner/NavigationPositionerDataAttributes.js +2 -2
- package/esm/navigation-menu/root/NavigationMenuRoot.d.ts +6 -6
- package/esm/navigation-menu/root/NavigationMenuRoot.js +2 -2
- package/esm/navigation-menu/root/NavigationMenuRootContext.js +2 -0
- package/esm/navigation-menu/trigger/NavigationMenuTrigger.js +8 -124
- package/esm/navigation-menu/utils/isOutsideMenuEvent.d.ts +1 -1
- package/esm/navigation-menu/viewport/NavigationMenuViewport.js +21 -1
- package/esm/number-field/input/NumberFieldInput.js +3 -11
- package/esm/number-field/root/NumberFieldRoot.d.ts +27 -20
- package/esm/number-field/root/NumberFieldRoot.js +22 -7
- package/esm/number-field/root/NumberFieldRootContext.d.ts +2 -2
- package/esm/number-field/root/useNumberFieldButton.d.ts +3 -3
- package/esm/number-field/root/useNumberFieldButton.js +12 -7
- package/esm/number-field/scrub-area/NumberFieldScrubArea.d.ts +2 -2
- package/esm/number-field/scrub-area/NumberFieldScrubArea.js +16 -0
- package/esm/number-field/scrub-area/NumberFieldScrubAreaContext.js +2 -0
- package/esm/number-field/utils/stateAttributesMapping.js +3 -1
- package/esm/number-field/utils/subscribeToVisualViewportResize.d.ts +1 -1
- package/esm/number-field/utils/types.d.ts +5 -5
- package/esm/number-field/utils/validate.d.ts +3 -1
- package/esm/number-field/utils/validate.js +3 -2
- package/esm/popover/arrow/PopoverArrow.js +2 -2
- package/esm/popover/arrow/PopoverArrowDataAttributes.js +2 -2
- package/esm/popover/backdrop/PopoverBackdrop.js +2 -2
- package/esm/popover/popup/PopoverPopup.d.ts +3 -2
- package/esm/popover/popup/PopoverPopup.js +2 -2
- package/esm/popover/portal/PopoverPortal.d.ts +1 -1
- package/esm/popover/portal/PopoverPortal.js +1 -2
- package/esm/popover/portal/PopoverPortalContext.js +2 -0
- package/esm/popover/positioner/PopoverPositioner.js +3 -3
- package/esm/popover/positioner/PopoverPositionerDataAttributes.js +2 -2
- package/esm/popover/root/PopoverRoot.d.ts +9 -9
- package/esm/popover/root/PopoverRoot.js +18 -5
- package/esm/popover/store/PopoverStore.d.ts +255 -15
- package/esm/popover/trigger/PopoverTrigger.d.ts +7 -7
- package/esm/popover/trigger/PopoverTrigger.js +2 -2
- package/esm/popover/viewport/PopoverViewport.d.ts +9 -1
- package/esm/popover/viewport/PopoverViewport.js +19 -196
- package/esm/popover/viewport/PopoverViewportDataAttributes.d.ts +5 -0
- package/esm/popover/viewport/PopoverViewportDataAttributes.js +5 -0
- package/esm/preview-card/arrow/PreviewCardArrow.js +2 -2
- package/esm/preview-card/arrow/PreviewCardArrowDataAttributes.js +2 -2
- package/esm/preview-card/backdrop/PreviewCardBackdrop.js +2 -2
- package/esm/preview-card/popup/PreviewCardPopup.js +2 -2
- package/esm/preview-card/popup/PreviewCardPopupDataAttributes.js +2 -2
- package/esm/preview-card/portal/PreviewCardPortal.d.ts +1 -1
- package/esm/preview-card/portal/PreviewCardPortalContext.js +2 -0
- package/esm/preview-card/positioner/PreviewCardPositioner.js +2 -2
- package/esm/preview-card/positioner/PreviewCardPositionerContext.d.ts +1 -1
- package/esm/preview-card/positioner/PreviewCardPositionerDataAttributes.js +2 -2
- package/esm/preview-card/root/PreviewCardRoot.d.ts +8 -8
- package/esm/preview-card/root/PreviewCardRoot.js +17 -4
- package/esm/preview-card/store/PreviewCardStore.d.ts +255 -15
- package/esm/preview-card/trigger/PreviewCardTrigger.d.ts +4 -4
- package/esm/preview-card/trigger/PreviewCardTrigger.js +2 -2
- package/esm/preview-card/viewport/PreviewCardViewport.d.ts +6 -1
- package/esm/preview-card/viewport/PreviewCardViewport.js +14 -230
- package/esm/progress/root/ProgressRoot.d.ts +6 -6
- package/esm/progress/root/ProgressRoot.js +2 -13
- package/esm/progress/value/ProgressValue.d.ts +1 -1
- package/esm/radio/indicator/RadioIndicator.d.ts +1 -1
- package/esm/radio/indicator/RadioIndicator.js +4 -4
- package/esm/radio/root/RadioRoot.d.ts +37 -17
- package/esm/radio/root/RadioRoot.js +45 -11
- package/esm/radio-group/RadioGroup.d.ts +18 -12
- package/esm/radio-group/RadioGroup.js +69 -62
- package/esm/radio-group/RadioGroupContext.d.ts +9 -8
- package/esm/radio-group/RadioGroupContext.js +1 -13
- package/esm/scroll-area/root/ScrollAreaRoot.d.ts +4 -2
- package/esm/scroll-area/root/ScrollAreaRoot.js +2 -1
- package/esm/scroll-area/root/ScrollAreaRootContext.js +2 -0
- package/esm/scroll-area/root/ScrollAreaRootDataAttributes.d.ts +4 -0
- package/esm/scroll-area/root/ScrollAreaRootDataAttributes.js +4 -0
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +2 -2
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbar.js +2 -2
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbarContext.js +2 -0
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.d.ts +1 -1
- package/esm/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.js +1 -1
- package/esm/scroll-area/thumb/ScrollAreaThumb.d.ts +1 -1
- package/esm/scroll-area/thumb/ScrollAreaThumb.js +2 -2
- package/esm/scroll-area/utils/scrollEdges.d.ts +2 -0
- package/esm/scroll-area/utils/scrollEdges.js +22 -0
- package/esm/scroll-area/viewport/ScrollAreaViewport.js +18 -15
- package/esm/scroll-area/viewport/ScrollAreaViewportContext.js +2 -0
- package/esm/scroll-area/viewport/ScrollAreaViewportDataAttributes.d.ts +4 -0
- package/esm/scroll-area/viewport/ScrollAreaViewportDataAttributes.js +4 -0
- package/esm/select/arrow/SelectArrow.js +2 -2
- package/esm/select/arrow/SelectArrowDataAttributes.js +2 -2
- package/esm/select/backdrop/SelectBackdrop.js +2 -2
- package/esm/select/group/SelectGroupContext.js +2 -0
- package/esm/select/icon/SelectIcon.js +2 -2
- package/esm/select/item/SelectItem.d.ts +2 -2
- package/esm/select/item/SelectItem.js +13 -13
- package/esm/select/item/SelectItemContext.js +2 -0
- package/esm/select/item-indicator/SelectItemIndicator.d.ts +1 -1
- package/esm/select/item-indicator/SelectItemIndicator.js +2 -2
- package/esm/select/popup/SelectPopup.d.ts +11 -0
- package/esm/select/popup/SelectPopup.js +64 -35
- package/esm/select/popup/SelectPopupDataAttributes.js +2 -2
- package/esm/select/portal/SelectPortalContext.js +2 -0
- package/esm/select/positioner/SelectPositioner.d.ts +1 -1
- package/esm/select/positioner/SelectPositioner.js +14 -11
- package/esm/select/positioner/SelectPositionerContext.js +2 -0
- package/esm/select/positioner/SelectPositionerDataAttributes.js +2 -2
- package/esm/select/root/SelectRoot.d.ts +27 -22
- package/esm/select/root/SelectRoot.js +2 -0
- package/esm/select/root/SelectRootContext.d.ts +14 -14
- package/esm/select/root/SelectRootContext.js +2 -0
- package/esm/select/scroll-arrow/SelectScrollArrow.d.ts +1 -1
- package/esm/select/scroll-arrow/SelectScrollArrow.js +2 -2
- package/esm/select/scroll-down-arrow/SelectScrollDownArrow.d.ts +1 -1
- package/esm/select/scroll-down-arrow/SelectScrollDownArrowDataAttributes.js +1 -1
- package/esm/select/scroll-up-arrow/SelectScrollUpArrow.d.ts +1 -1
- package/esm/select/scroll-up-arrow/SelectScrollUpArrowDataAttributes.js +1 -1
- package/esm/select/store.d.ts +3 -3
- package/esm/select/store.js +3 -3
- package/esm/select/trigger/SelectTrigger.d.ts +1 -1
- package/esm/select/trigger/SelectTrigger.js +2 -2
- package/esm/select/value/SelectValue.d.ts +4 -0
- package/esm/select/value/SelectValue.js +2 -2
- package/esm/separator/Separator.d.ts +1 -1
- package/esm/separator/Separator.js +2 -2
- package/esm/slider/root/SliderRoot.d.ts +17 -17
- package/esm/slider/root/SliderRoot.js +3 -2
- package/esm/slider/root/SliderRootContext.d.ts +2 -2
- package/esm/slider/root/stateAttributesMapping.js +3 -1
- package/esm/slider/thumb/SliderThumb.d.ts +7 -7
- package/esm/slider/utils/getPushedThumbValues.d.ts +1 -1
- package/esm/slider/utils/resolveThumbCollision.d.ts +2 -2
- package/esm/slider/value/SliderValue.d.ts +1 -1
- package/esm/switch/root/SwitchRoot.d.ts +11 -11
- package/esm/switch/root/SwitchRoot.js +7 -1
- package/esm/switch/root/SwitchRootContext.js +2 -0
- package/esm/tabs/indicator/TabsIndicator.d.ts +1 -1
- package/esm/tabs/indicator/TabsIndicator.js +2 -2
- package/esm/tabs/list/TabsList.d.ts +2 -2
- package/esm/tabs/list/TabsList.js +2 -2
- package/esm/tabs/panel/TabsPanel.d.ts +4 -2
- package/esm/tabs/panel/TabsPanel.js +35 -9
- package/esm/tabs/root/TabsRoot.d.ts +4 -4
- package/esm/tabs/root/TabsRootContext.d.ts +1 -1
- package/esm/tabs/tab/TabsTab.d.ts +1 -1
- package/esm/tabs/tab/TabsTab.js +2 -2
- package/esm/toast/action/ToastAction.js +2 -2
- package/esm/toast/arrow/ToastArrow.js +2 -2
- package/esm/toast/arrow/ToastArrowDataAttributes.js +4 -3
- package/esm/toast/close/ToastClose.js +6 -8
- package/esm/toast/content/ToastContent.js +2 -2
- package/esm/toast/createToastManager.d.ts +5 -5
- package/esm/toast/createToastManager.js +3 -6
- package/esm/toast/description/ToastDescription.js +4 -6
- package/esm/toast/positioner/ToastPositioner.d.ts +2 -2
- package/esm/toast/positioner/ToastPositioner.js +6 -7
- package/esm/toast/positioner/ToastPositionerDataAttributes.js +2 -2
- package/esm/toast/provider/ToastProvider.d.ts +3 -3
- package/esm/toast/provider/ToastProvider.js +26 -285
- package/esm/toast/provider/ToastProviderContext.d.ts +4 -25
- package/esm/toast/provider/ToastProviderContext.js +3 -1
- package/esm/toast/root/ToastRoot.d.ts +1 -1
- package/esm/toast/root/ToastRoot.js +19 -27
- package/esm/toast/root/ToastRootContext.js +2 -0
- package/esm/toast/store.d.ts +51 -0
- package/esm/toast/store.js +355 -0
- package/esm/toast/title/ToastTitle.js +4 -6
- package/esm/toast/useToastManager.d.ts +20 -21
- package/esm/toast/useToastManager.js +8 -14
- package/esm/toast/viewport/ToastViewport.js +66 -92
- package/esm/toggle/Toggle.d.ts +10 -8
- package/esm/toggle/Toggle.js +13 -3
- package/esm/toggle-group/ToggleGroup.d.ts +22 -10
- package/esm/toggle-group/ToggleGroup.js +8 -5
- package/esm/toggle-group/ToggleGroupContext.d.ts +10 -5
- package/esm/toolbar/button/ToolbarButton.d.ts +2 -2
- package/esm/toolbar/button/ToolbarButton.js +2 -2
- package/esm/toolbar/group/ToolbarGroup.d.ts +1 -1
- package/esm/toolbar/group/ToolbarGroup.js +2 -2
- package/esm/toolbar/group/ToolbarGroupContext.js +2 -0
- package/esm/toolbar/input/ToolbarInput.d.ts +3 -3
- package/esm/toolbar/input/ToolbarInput.js +2 -2
- package/esm/toolbar/link/ToolbarLink.js +2 -2
- package/esm/toolbar/root/ToolbarRoot.d.ts +3 -3
- package/esm/toolbar/root/ToolbarRoot.js +2 -2
- package/esm/tooltip/arrow/TooltipArrow.d.ts +1 -0
- package/esm/tooltip/arrow/TooltipArrow.js +2 -2
- package/esm/tooltip/arrow/TooltipArrowDataAttributes.js +2 -2
- package/esm/tooltip/popup/TooltipPopup.js +2 -2
- package/esm/tooltip/popup/TooltipPopupDataAttributes.js +2 -2
- package/esm/tooltip/portal/TooltipPortal.d.ts +1 -1
- package/esm/tooltip/portal/TooltipPortalContext.js +2 -0
- package/esm/tooltip/positioner/TooltipPositioner.d.ts +1 -1
- package/esm/tooltip/positioner/TooltipPositionerContext.d.ts +1 -1
- package/esm/tooltip/positioner/TooltipPositionerDataAttributes.js +2 -2
- package/esm/tooltip/provider/TooltipProvider.d.ts +3 -3
- package/esm/tooltip/provider/TooltipProviderContext.js +2 -0
- package/esm/tooltip/root/TooltipRoot.d.ts +12 -12
- package/esm/tooltip/root/TooltipRoot.js +23 -11
- package/esm/tooltip/store/TooltipStore.d.ts +256 -16
- package/esm/tooltip/trigger/TooltipTrigger.d.ts +11 -4
- package/esm/tooltip/trigger/TooltipTrigger.js +12 -6
- package/esm/tooltip/trigger/TooltipTriggerDataAttributes.d.ts +4 -0
- package/esm/tooltip/trigger/TooltipTriggerDataAttributes.js +4 -0
- package/esm/tooltip/viewport/TooltipViewport.d.ts +9 -1
- package/esm/tooltip/viewport/TooltipViewport.js +14 -195
- package/esm/unstable-use-media-query/index.d.ts +5 -5
- package/esm/use-button/useButton.d.ts +4 -4
- package/esm/use-button/useButton.js +7 -2
- package/esm/use-render/useRender.d.ts +9 -9
- package/esm/utils/InternalBackdrop.d.ts +1 -1
- package/esm/utils/createBaseUIEventDetails.d.ts +3 -0
- package/esm/utils/formatNumber.d.ts +2 -1
- package/esm/utils/formatNumber.js +11 -0
- package/esm/utils/getDisabledMountTransitionStyles.d.ts +1 -1
- package/esm/utils/getPseudoElementBounds.js +1 -1
- package/esm/utils/itemEquality.d.ts +5 -5
- package/esm/utils/itemEquality.js +17 -17
- package/esm/utils/popupStateMapping.d.ts +10 -0
- package/esm/utils/popupStateMapping.js +10 -0
- package/esm/utils/popups/popupStoreUtils.js +2 -0
- package/esm/utils/popups/popupTriggerMap.d.ts +14 -1
- package/esm/utils/popups/popupTriggerMap.js +27 -9
- package/esm/utils/popups/store.d.ts +28 -18
- package/esm/utils/popups/store.js +8 -5
- package/esm/utils/reason-parts.d.ts +3 -0
- package/esm/utils/reason-parts.js +3 -0
- package/esm/utils/scrollable.d.ts +4 -0
- package/esm/utils/scrollable.js +32 -0
- package/esm/utils/types.d.ts +6 -6
- package/esm/utils/useAnchorPositioning.d.ts +26 -26
- package/esm/utils/useAnchorPositioning.js +19 -16
- package/esm/utils/useFocusableWhenDisabled.d.ts +4 -4
- package/esm/utils/useMixedToggleClickHandler.d.ts +1 -1
- package/esm/utils/useMixedToggleClickHandler.js +2 -0
- package/esm/utils/useOpenChangeComplete.d.ts +2 -2
- package/esm/utils/usePopupAutoResize.d.ts +3 -3
- package/esm/utils/usePopupAutoResize.js +3 -1
- package/esm/utils/usePopupViewport.d.ts +58 -0
- package/esm/utils/usePopupViewport.js +247 -0
- package/esm/utils/useRenderElement.d.ts +9 -9
- package/esm/utils/useRenderElement.js +28 -1
- package/esm/utils/useSwipeDismiss.d.ts +108 -0
- package/esm/utils/useSwipeDismiss.js +944 -0
- package/esm/utils/useValueChanged.js +2 -0
- package/field/control/FieldControl.d.ts +3 -3
- package/field/control/FieldControl.js +21 -20
- package/field/error/FieldError.d.ts +5 -2
- package/field/error/FieldError.js +51 -7
- package/field/item/FieldItem.d.ts +1 -1
- package/field/item/FieldItemContext.js +1 -0
- package/field/label/FieldLabel.d.ts +1 -1
- package/field/label/FieldLabel.js +7 -2
- package/field/root/FieldRoot.d.ts +9 -9
- package/field/root/FieldRootContext.d.ts +1 -1
- package/field/useField.d.ts +1 -1
- package/field/useField.js +1 -0
- package/field/validity/FieldValidity.d.ts +2 -0
- package/field/validity/FieldValidity.js +9 -3
- package/fieldset/legend/FieldsetLegend.js +2 -2
- package/fieldset/root/FieldsetRoot.d.ts +1 -1
- package/fieldset/root/FieldsetRoot.js +3 -3
- package/floating-ui-react/components/FloatingDelayGroup.d.ts +2 -7
- package/floating-ui-react/components/FloatingDelayGroup.js +2 -9
- package/floating-ui-react/components/FloatingFocusManager.d.ts +11 -21
- package/floating-ui-react/components/FloatingFocusManager.js +61 -74
- package/floating-ui-react/components/FloatingPortal.d.ts +8 -9
- package/floating-ui-react/components/FloatingPortal.js +1 -3
- package/floating-ui-react/components/FloatingTree.d.ts +1 -1
- package/floating-ui-react/hooks/useClick.d.ts +12 -6
- package/floating-ui-react/hooks/useClick.js +6 -5
- package/floating-ui-react/hooks/useClientPoint.d.ts +2 -12
- package/floating-ui-react/hooks/useClientPoint.js +4 -16
- package/floating-ui-react/hooks/useDismiss.d.ts +15 -15
- package/floating-ui-react/hooks/useDismiss.js +4 -2
- package/floating-ui-react/hooks/useFloating.js +1 -0
- package/floating-ui-react/hooks/useFloatingRootContext.d.ts +4 -10
- package/floating-ui-react/hooks/useFloatingRootContext.js +4 -3
- package/floating-ui-react/hooks/useFocus.d.ts +2 -8
- package/floating-ui-react/hooks/useFocus.js +9 -11
- package/floating-ui-react/hooks/useHover.d.ts +7 -30
- package/floating-ui-react/hooks/useHover.js +18 -36
- package/floating-ui-react/hooks/useHoverFloatingInteraction.d.ts +2 -7
- package/floating-ui-react/hooks/useHoverFloatingInteraction.js +33 -39
- package/floating-ui-react/hooks/useHoverInteractionSharedState.d.ts +17 -14
- package/floating-ui-react/hooks/useHoverInteractionSharedState.js +36 -30
- package/floating-ui-react/hooks/useHoverReferenceInteraction.d.ts +7 -3
- package/floating-ui-react/hooks/useHoverReferenceInteraction.js +55 -59
- package/floating-ui-react/hooks/useInteractions.d.ts +2 -2
- package/floating-ui-react/hooks/useListNavigation.d.ts +19 -35
- package/floating-ui-react/hooks/useListNavigation.js +11 -11
- package/floating-ui-react/hooks/useRole.d.ts +1 -7
- package/floating-ui-react/hooks/useRole.js +2 -3
- package/floating-ui-react/hooks/useSyncedFloatingRootContext.d.ts +2 -2
- package/floating-ui-react/hooks/useSyncedFloatingRootContext.js +1 -0
- package/floating-ui-react/hooks/useTypeahead.d.ts +6 -16
- package/floating-ui-react/hooks/useTypeahead.js +46 -15
- package/floating-ui-react/middleware/arrow.d.ts +1 -1
- package/floating-ui-react/safePolygon.d.ts +3 -3
- package/floating-ui-react/types.d.ts +14 -14
- package/floating-ui-react/utils/composite.d.ts +5 -5
- package/floating-ui-react/utils/composite.js +1 -3
- package/floating-ui-react/utils/element.d.ts +2 -1
- package/floating-ui-react/utils/element.js +16 -4
- package/floating-ui-react/utils/enqueueFocus.d.ts +3 -3
- package/floating-ui-react/utils/event.js +2 -4
- package/floating-ui-react/utils/markOthers.js +2 -2
- package/floating-ui-react/utils/tabbable.js +5 -4
- package/form/Form.d.ts +5 -5
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/input/Input.d.ts +3 -3
- package/labelable-provider/LabelableContext.d.ts +1 -1
- package/labelable-provider/LabelableContext.js +1 -1
- package/labelable-provider/LabelableProvider.js +33 -3
- package/labelable-provider/useLabelableId.d.ts +3 -2
- package/labelable-provider/useLabelableId.js +39 -12
- package/menu/arrow/MenuArrow.js +2 -2
- package/menu/arrow/MenuArrowDataAttributes.js +2 -2
- package/menu/backdrop/MenuBackdrop.js +2 -2
- package/menu/checkbox-item/MenuCheckboxItem.d.ts +8 -8
- package/menu/checkbox-item/MenuCheckboxItemContext.js +1 -0
- package/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +2 -2
- package/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js +3 -3
- package/menu/group/MenuGroupContext.js +1 -0
- package/menu/index.d.ts +2 -1
- package/menu/index.parts.d.ts +1 -0
- package/menu/index.parts.js +7 -0
- package/menu/item/MenuItem.d.ts +5 -5
- package/menu/item/MenuItem.js +2 -2
- package/menu/item/useMenuItem.js +12 -48
- package/menu/item/useMenuItemCommonProps.d.ts +43 -0
- package/menu/item/useMenuItemCommonProps.js +72 -0
- package/menu/link-item/MenuLinkItem.d.ts +34 -0
- package/menu/link-item/MenuLinkItem.js +60 -0
- package/menu/link-item/MenuLinkItemDataAttributes.d.ts +6 -0
- package/menu/link-item/MenuLinkItemDataAttributes.js +13 -0
- package/menu/popup/MenuPopup.d.ts +3 -2
- package/menu/popup/MenuPopup.js +2 -2
- package/menu/popup/MenuPopupDataAttributes.js +2 -2
- package/menu/portal/MenuPortal.d.ts +1 -1
- package/menu/portal/MenuPortalContext.js +1 -0
- package/menu/positioner/MenuPositioner.js +6 -12
- package/menu/positioner/MenuPositionerDataAttributes.js +2 -2
- package/menu/radio-group/MenuRadioGroup.d.ts +2 -2
- package/menu/radio-group/MenuRadioGroup.js +2 -2
- package/menu/radio-group/MenuRadioGroupContext.js +1 -0
- package/menu/radio-item/MenuRadioItem.d.ts +5 -5
- package/menu/radio-item/MenuRadioItemContext.js +1 -0
- package/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +2 -2
- package/menu/radio-item-indicator/MenuRadioItemIndicator.js +3 -3
- package/menu/root/MenuRoot.d.ts +15 -15
- package/menu/root/MenuRoot.js +39 -37
- package/menu/store/MenuStore.d.ts +255 -15
- package/menu/store/MenuStore.js +2 -11
- package/menu/submenu-root/MenuSubmenuRoot.d.ts +2 -2
- package/menu/submenu-root/MenuSubmenuRootContext.js +1 -0
- package/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +22 -22
- package/menu/submenu-trigger/MenuSubmenuTrigger.js +10 -8
- package/menu/trigger/MenuTrigger.d.ts +10 -6
- package/menu/trigger/MenuTrigger.js +5 -4
- package/menubar/Menubar.d.ts +4 -4
- package/menubar/Menubar.js +2 -2
- package/meter/root/MeterRoot.d.ts +6 -6
- package/meter/root/MeterRoot.js +1 -10
- package/meter/value/MeterValue.d.ts +1 -1
- package/navigation-menu/arrow/NavigationMenuArrow.js +2 -2
- package/navigation-menu/arrow/NavigationMenuArrowDataAttributes.js +2 -2
- package/navigation-menu/backdrop/NavigationMenuBackdrop.js +2 -2
- package/navigation-menu/content/NavigationMenuContent.d.ts +8 -1
- package/navigation-menu/content/NavigationMenuContent.js +26 -5
- package/navigation-menu/icon/NavigationMenuIcon.d.ts +1 -1
- package/navigation-menu/icon/NavigationMenuIcon.js +2 -2
- package/navigation-menu/item/NavigationMenuItem.d.ts +1 -1
- package/navigation-menu/item/NavigationMenuItemContext.js +1 -0
- package/navigation-menu/link/NavigationMenuLink.d.ts +2 -2
- package/navigation-menu/link/NavigationMenuLink.js +2 -2
- package/navigation-menu/list/NavigationMenuDismissContext.js +1 -0
- package/navigation-menu/list/NavigationMenuList.d.ts +1 -1
- package/navigation-menu/list/NavigationMenuList.js +2 -2
- package/navigation-menu/popup/NavigationMenuPopup.d.ts +13 -0
- package/navigation-menu/popup/NavigationMenuPopup.js +2 -2
- package/navigation-menu/popup/NavigationMenuPopupDataAttributes.js +2 -2
- package/navigation-menu/portal/NavigationMenuPortal.d.ts +2 -2
- package/navigation-menu/portal/NavigationMenuPortalContext.js +1 -0
- package/navigation-menu/positioner/NavigationMenuPositioner.js +2 -2
- package/navigation-menu/positioner/NavigationPositionerDataAttributes.js +2 -2
- package/navigation-menu/root/NavigationMenuRoot.d.ts +6 -6
- package/navigation-menu/root/NavigationMenuRoot.js +2 -2
- package/navigation-menu/root/NavigationMenuRootContext.js +1 -0
- package/navigation-menu/trigger/NavigationMenuTrigger.js +7 -124
- package/navigation-menu/utils/isOutsideMenuEvent.d.ts +1 -1
- package/navigation-menu/viewport/NavigationMenuViewport.js +21 -1
- package/number-field/input/NumberFieldInput.js +3 -11
- package/number-field/root/NumberFieldRoot.d.ts +27 -20
- package/number-field/root/NumberFieldRoot.js +22 -7
- package/number-field/root/NumberFieldRootContext.d.ts +2 -2
- package/number-field/root/useNumberFieldButton.d.ts +3 -3
- package/number-field/root/useNumberFieldButton.js +12 -7
- package/number-field/scrub-area/NumberFieldScrubArea.d.ts +2 -2
- package/number-field/scrub-area/NumberFieldScrubArea.js +16 -0
- package/number-field/scrub-area/NumberFieldScrubAreaContext.js +1 -0
- package/number-field/utils/stateAttributesMapping.js +3 -1
- package/number-field/utils/subscribeToVisualViewportResize.d.ts +1 -1
- package/number-field/utils/types.d.ts +5 -5
- package/number-field/utils/validate.d.ts +3 -1
- package/number-field/utils/validate.js +3 -2
- package/package.json +13 -4
- package/popover/arrow/PopoverArrow.js +2 -2
- package/popover/arrow/PopoverArrowDataAttributes.js +2 -2
- package/popover/backdrop/PopoverBackdrop.js +2 -2
- package/popover/popup/PopoverPopup.d.ts +3 -2
- package/popover/popup/PopoverPopup.js +2 -2
- package/popover/portal/PopoverPortal.d.ts +1 -1
- package/popover/portal/PopoverPortal.js +1 -2
- package/popover/portal/PopoverPortalContext.js +1 -0
- package/popover/positioner/PopoverPositioner.js +3 -3
- package/popover/positioner/PopoverPositionerDataAttributes.js +2 -2
- package/popover/root/PopoverRoot.d.ts +9 -9
- package/popover/root/PopoverRoot.js +18 -5
- package/popover/store/PopoverStore.d.ts +255 -15
- package/popover/trigger/PopoverTrigger.d.ts +7 -7
- package/popover/trigger/PopoverTrigger.js +3 -3
- package/popover/viewport/PopoverViewport.d.ts +9 -1
- package/popover/viewport/PopoverViewport.js +19 -196
- package/popover/viewport/PopoverViewportDataAttributes.d.ts +5 -0
- package/popover/viewport/PopoverViewportDataAttributes.js +5 -0
- package/preview-card/arrow/PreviewCardArrow.js +2 -2
- package/preview-card/arrow/PreviewCardArrowDataAttributes.js +2 -2
- package/preview-card/backdrop/PreviewCardBackdrop.js +2 -2
- package/preview-card/popup/PreviewCardPopup.js +2 -2
- package/preview-card/popup/PreviewCardPopupDataAttributes.js +2 -2
- package/preview-card/portal/PreviewCardPortal.d.ts +1 -1
- package/preview-card/portal/PreviewCardPortalContext.js +1 -0
- package/preview-card/positioner/PreviewCardPositioner.js +2 -2
- package/preview-card/positioner/PreviewCardPositionerContext.d.ts +1 -1
- package/preview-card/positioner/PreviewCardPositionerDataAttributes.js +2 -2
- package/preview-card/root/PreviewCardRoot.d.ts +8 -8
- package/preview-card/root/PreviewCardRoot.js +17 -4
- package/preview-card/store/PreviewCardStore.d.ts +255 -15
- package/preview-card/trigger/PreviewCardTrigger.d.ts +4 -4
- package/preview-card/trigger/PreviewCardTrigger.js +3 -3
- package/preview-card/viewport/PreviewCardViewport.d.ts +6 -1
- package/preview-card/viewport/PreviewCardViewport.js +14 -230
- package/progress/root/ProgressRoot.d.ts +6 -6
- package/progress/root/ProgressRoot.js +1 -12
- package/progress/value/ProgressValue.d.ts +1 -1
- package/radio/indicator/RadioIndicator.d.ts +1 -1
- package/radio/indicator/RadioIndicator.js +4 -4
- package/radio/root/RadioRoot.d.ts +37 -17
- package/radio/root/RadioRoot.js +45 -11
- package/radio-group/RadioGroup.d.ts +18 -12
- package/radio-group/RadioGroup.js +68 -61
- package/radio-group/RadioGroupContext.d.ts +9 -8
- package/radio-group/RadioGroupContext.js +1 -13
- package/scroll-area/root/ScrollAreaRoot.d.ts +4 -2
- package/scroll-area/root/ScrollAreaRoot.js +2 -1
- package/scroll-area/root/ScrollAreaRootContext.js +1 -0
- package/scroll-area/root/ScrollAreaRootDataAttributes.d.ts +4 -0
- package/scroll-area/root/ScrollAreaRootDataAttributes.js +4 -0
- package/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +2 -2
- package/scroll-area/scrollbar/ScrollAreaScrollbar.js +2 -2
- package/scroll-area/scrollbar/ScrollAreaScrollbarContext.js +1 -0
- package/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.d.ts +1 -1
- package/scroll-area/scrollbar/ScrollAreaScrollbarDataAttributes.js +1 -1
- package/scroll-area/thumb/ScrollAreaThumb.d.ts +1 -1
- package/scroll-area/thumb/ScrollAreaThumb.js +2 -2
- package/scroll-area/utils/scrollEdges.d.ts +2 -0
- package/scroll-area/utils/scrollEdges.js +29 -0
- package/scroll-area/viewport/ScrollAreaViewport.js +18 -15
- package/scroll-area/viewport/ScrollAreaViewportContext.js +1 -0
- package/scroll-area/viewport/ScrollAreaViewportDataAttributes.d.ts +4 -0
- package/scroll-area/viewport/ScrollAreaViewportDataAttributes.js +4 -0
- package/select/arrow/SelectArrow.js +2 -2
- package/select/arrow/SelectArrowDataAttributes.js +2 -2
- package/select/backdrop/SelectBackdrop.js +2 -2
- package/select/group/SelectGroupContext.js +1 -0
- package/select/icon/SelectIcon.js +2 -2
- package/select/item/SelectItem.d.ts +2 -2
- package/select/item/SelectItem.js +13 -13
- package/select/item/SelectItemContext.js +1 -0
- package/select/item-indicator/SelectItemIndicator.d.ts +1 -1
- package/select/item-indicator/SelectItemIndicator.js +2 -2
- package/select/popup/SelectPopup.d.ts +11 -0
- package/select/popup/SelectPopup.js +64 -35
- package/select/popup/SelectPopupDataAttributes.js +2 -2
- package/select/portal/SelectPortalContext.js +1 -0
- package/select/positioner/SelectPositioner.d.ts +1 -1
- package/select/positioner/SelectPositioner.js +13 -10
- package/select/positioner/SelectPositionerContext.js +1 -0
- package/select/positioner/SelectPositionerDataAttributes.js +2 -2
- package/select/root/SelectRoot.d.ts +27 -22
- package/select/root/SelectRoot.js +2 -0
- package/select/root/SelectRootContext.d.ts +14 -14
- package/select/root/SelectRootContext.js +1 -0
- package/select/scroll-arrow/SelectScrollArrow.d.ts +1 -1
- package/select/scroll-arrow/SelectScrollArrow.js +2 -2
- package/select/scroll-down-arrow/SelectScrollDownArrow.d.ts +1 -1
- package/select/scroll-down-arrow/SelectScrollDownArrowDataAttributes.js +1 -1
- package/select/scroll-up-arrow/SelectScrollUpArrow.d.ts +1 -1
- package/select/scroll-up-arrow/SelectScrollUpArrowDataAttributes.js +1 -1
- package/select/store.d.ts +3 -3
- package/select/store.js +3 -3
- package/select/trigger/SelectTrigger.d.ts +1 -1
- package/select/trigger/SelectTrigger.js +2 -2
- package/select/value/SelectValue.d.ts +4 -0
- package/select/value/SelectValue.js +2 -2
- package/separator/Separator.d.ts +1 -1
- package/separator/Separator.js +2 -2
- package/slider/root/SliderRoot.d.ts +17 -17
- package/slider/root/SliderRoot.js +3 -2
- package/slider/root/SliderRootContext.d.ts +2 -2
- package/slider/root/stateAttributesMapping.js +3 -1
- package/slider/thumb/SliderThumb.d.ts +7 -7
- package/slider/utils/getPushedThumbValues.d.ts +1 -1
- package/slider/utils/resolveThumbCollision.d.ts +2 -2
- package/slider/value/SliderValue.d.ts +1 -1
- package/switch/root/SwitchRoot.d.ts +11 -11
- package/switch/root/SwitchRoot.js +7 -1
- package/switch/root/SwitchRootContext.js +1 -0
- package/tabs/indicator/TabsIndicator.d.ts +1 -1
- package/tabs/indicator/TabsIndicator.js +2 -2
- package/tabs/list/TabsList.d.ts +2 -2
- package/tabs/list/TabsList.js +2 -2
- package/tabs/panel/TabsPanel.d.ts +4 -2
- package/tabs/panel/TabsPanel.js +37 -10
- package/tabs/root/TabsRoot.d.ts +4 -4
- package/tabs/root/TabsRootContext.d.ts +1 -1
- package/tabs/tab/TabsTab.d.ts +1 -1
- package/tabs/tab/TabsTab.js +2 -2
- package/toast/action/ToastAction.js +2 -2
- package/toast/arrow/ToastArrow.js +2 -2
- package/toast/arrow/ToastArrowDataAttributes.js +4 -3
- package/toast/close/ToastClose.js +5 -7
- package/toast/content/ToastContent.js +2 -2
- package/toast/createToastManager.d.ts +5 -5
- package/toast/createToastManager.js +3 -6
- package/toast/description/ToastDescription.js +4 -6
- package/toast/positioner/ToastPositioner.d.ts +2 -2
- package/toast/positioner/ToastPositioner.js +5 -6
- package/toast/positioner/ToastPositionerDataAttributes.js +2 -2
- package/toast/provider/ToastProvider.d.ts +3 -3
- package/toast/provider/ToastProvider.js +24 -284
- package/toast/provider/ToastProviderContext.d.ts +4 -25
- package/toast/provider/ToastProviderContext.js +3 -2
- package/toast/root/ToastRoot.d.ts +1 -1
- package/toast/root/ToastRoot.js +18 -26
- package/toast/root/ToastRootContext.js +1 -0
- package/toast/store.d.ts +51 -0
- package/toast/store.js +362 -0
- package/toast/title/ToastTitle.js +4 -6
- package/toast/useToastManager.d.ts +20 -21
- package/toast/useToastManager.js +8 -14
- package/toast/viewport/ToastViewport.js +65 -91
- package/toggle/Toggle.d.ts +10 -8
- package/toggle/Toggle.js +13 -3
- package/toggle-group/ToggleGroup.d.ts +22 -10
- package/toggle-group/ToggleGroup.js +8 -5
- package/toggle-group/ToggleGroupContext.d.ts +10 -5
- package/toolbar/button/ToolbarButton.d.ts +2 -2
- package/toolbar/button/ToolbarButton.js +2 -2
- package/toolbar/group/ToolbarGroup.d.ts +1 -1
- package/toolbar/group/ToolbarGroup.js +2 -2
- package/toolbar/group/ToolbarGroupContext.js +1 -0
- package/toolbar/input/ToolbarInput.d.ts +3 -3
- package/toolbar/input/ToolbarInput.js +2 -2
- package/toolbar/link/ToolbarLink.js +2 -2
- package/toolbar/root/ToolbarRoot.d.ts +3 -3
- package/toolbar/root/ToolbarRoot.js +2 -2
- package/tooltip/arrow/TooltipArrow.d.ts +1 -0
- package/tooltip/arrow/TooltipArrow.js +2 -2
- package/tooltip/arrow/TooltipArrowDataAttributes.js +2 -2
- package/tooltip/popup/TooltipPopup.js +2 -2
- package/tooltip/popup/TooltipPopupDataAttributes.js +2 -2
- package/tooltip/portal/TooltipPortal.d.ts +1 -1
- package/tooltip/portal/TooltipPortalContext.js +1 -0
- package/tooltip/positioner/TooltipPositioner.d.ts +1 -1
- package/tooltip/positioner/TooltipPositionerContext.d.ts +1 -1
- package/tooltip/positioner/TooltipPositionerDataAttributes.js +2 -2
- package/tooltip/provider/TooltipProvider.d.ts +3 -3
- package/tooltip/provider/TooltipProviderContext.js +1 -0
- package/tooltip/root/TooltipRoot.d.ts +12 -12
- package/tooltip/root/TooltipRoot.js +23 -11
- package/tooltip/store/TooltipStore.d.ts +256 -16
- package/tooltip/trigger/TooltipTrigger.d.ts +11 -4
- package/tooltip/trigger/TooltipTrigger.js +12 -6
- package/tooltip/trigger/TooltipTriggerDataAttributes.d.ts +4 -0
- package/tooltip/trigger/TooltipTriggerDataAttributes.js +4 -0
- package/tooltip/viewport/TooltipViewport.d.ts +9 -1
- package/tooltip/viewport/TooltipViewport.js +14 -195
- package/unstable-use-media-query/index.d.ts +5 -5
- package/use-button/useButton.d.ts +4 -4
- package/use-button/useButton.js +7 -2
- package/use-render/useRender.d.ts +9 -9
- package/utils/InternalBackdrop.d.ts +1 -1
- package/utils/createBaseUIEventDetails.d.ts +3 -0
- package/utils/formatNumber.d.ts +2 -1
- package/utils/formatNumber.js +12 -0
- package/utils/getDisabledMountTransitionStyles.d.ts +1 -1
- package/utils/getPseudoElementBounds.js +1 -1
- package/utils/itemEquality.d.ts +5 -5
- package/utils/itemEquality.js +18 -18
- package/utils/popupStateMapping.d.ts +10 -0
- package/utils/popupStateMapping.js +10 -0
- package/utils/popups/popupStoreUtils.js +1 -0
- package/utils/popups/popupTriggerMap.d.ts +14 -1
- package/utils/popups/popupTriggerMap.js +27 -10
- package/utils/popups/store.d.ts +28 -18
- package/utils/popups/store.js +8 -5
- package/utils/reason-parts.d.ts +3 -0
- package/utils/reason-parts.js +4 -1
- package/utils/scrollable.d.ts +4 -0
- package/utils/scrollable.js +40 -0
- package/utils/types.d.ts +6 -6
- package/utils/useAnchorPositioning.d.ts +26 -26
- package/utils/useAnchorPositioning.js +19 -16
- package/utils/useFocusableWhenDisabled.d.ts +4 -4
- package/utils/useMixedToggleClickHandler.d.ts +1 -1
- package/utils/useMixedToggleClickHandler.js +1 -0
- package/utils/useOpenChangeComplete.d.ts +2 -2
- package/utils/usePopupAutoResize.d.ts +3 -3
- package/utils/usePopupAutoResize.js +2 -1
- package/utils/usePopupViewport.d.ts +58 -0
- package/utils/usePopupViewport.js +253 -0
- package/utils/useRenderElement.d.ts +9 -9
- package/utils/useRenderElement.js +28 -1
- package/utils/useSwipeDismiss.d.ts +108 -0
- package/utils/useSwipeDismiss.js +952 -0
- package/utils/useValueChanged.js +1 -0
- package/esm/toast/viewport/ToastViewportContext.d.ts +0 -6
- package/esm/toast/viewport/ToastViewportContext.js +0 -11
- package/toast/viewport/ToastViewportContext.d.ts +0 -6
- package/toast/viewport/ToastViewportContext.js +0 -20
|
@@ -0,0 +1,873 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DrawerViewport = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
11
|
+
var _dom = require("@floating-ui/utils/dom");
|
|
12
|
+
var _owner = require("@base-ui/utils/owner");
|
|
13
|
+
var _useStableCallback = require("@base-ui/utils/useStableCallback");
|
|
14
|
+
var _DialogRootContext = require("../../dialog/root/DialogRootContext");
|
|
15
|
+
var _DialogViewport = require("../../dialog/viewport/DialogViewport");
|
|
16
|
+
var _mergeProps = require("../../merge-props");
|
|
17
|
+
var _DrawerRootContext = require("../root/DrawerRootContext");
|
|
18
|
+
var _useDrawerSnapPoints = require("../root/useDrawerSnapPoints");
|
|
19
|
+
var _DrawerProviderContext = require("../provider/DrawerProviderContext");
|
|
20
|
+
var _clamp = require("../../utils/clamp");
|
|
21
|
+
var _useSwipeDismiss = require("../../utils/useSwipeDismiss");
|
|
22
|
+
var _DrawerPopupCssVars = require("../popup/DrawerPopupCssVars");
|
|
23
|
+
var _DrawerPopupDataAttributes = require("../popup/DrawerPopupDataAttributes");
|
|
24
|
+
var _DrawerBackdropCssVars = require("../backdrop/DrawerBackdropCssVars");
|
|
25
|
+
var _reasons = require("../../utils/reasons");
|
|
26
|
+
var _createBaseUIEventDetails = require("../../utils/createBaseUIEventDetails");
|
|
27
|
+
var _utils = require("../../floating-ui-react/utils");
|
|
28
|
+
var _DrawerViewportContext = require("./DrawerViewportContext");
|
|
29
|
+
var _stateAttributesMapping = require("../../utils/stateAttributesMapping");
|
|
30
|
+
var _scrollable = require("../../utils/scrollable");
|
|
31
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
|
+
const MIN_SWIPE_THRESHOLD = 10;
|
|
33
|
+
const FAST_SWIPE_VELOCITY = 0.5;
|
|
34
|
+
const SNAP_VELOCITY_THRESHOLD = 0.5;
|
|
35
|
+
const SNAP_VELOCITY_MULTIPLIER = 300;
|
|
36
|
+
const MAX_SNAP_VELOCITY = 4;
|
|
37
|
+
const MIN_SWIPE_RELEASE_VELOCITY = 0.2;
|
|
38
|
+
const MAX_SWIPE_RELEASE_VELOCITY = 4;
|
|
39
|
+
const MIN_SWIPE_RELEASE_DURATION_MS = 80;
|
|
40
|
+
const MAX_SWIPE_RELEASE_DURATION_MS = 360;
|
|
41
|
+
const MIN_SWIPE_RELEASE_SCALAR = 0.1;
|
|
42
|
+
const MAX_SWIPE_RELEASE_SCALAR = 1;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A positioning container for the drawer popup that can be made scrollable.
|
|
46
|
+
* Renders a `<div>` element.
|
|
47
|
+
*
|
|
48
|
+
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
49
|
+
*/
|
|
50
|
+
const DrawerViewport = exports.DrawerViewport = /*#__PURE__*/React.forwardRef(function DrawerViewport(props, forwardedRef) {
|
|
51
|
+
const {
|
|
52
|
+
className,
|
|
53
|
+
render,
|
|
54
|
+
children,
|
|
55
|
+
...elementProps
|
|
56
|
+
} = props;
|
|
57
|
+
const {
|
|
58
|
+
store
|
|
59
|
+
} = (0, _DialogRootContext.useDialogRootContext)();
|
|
60
|
+
const {
|
|
61
|
+
swipeDirection,
|
|
62
|
+
notifyParentSwipingChange,
|
|
63
|
+
notifyParentSwipeProgressChange,
|
|
64
|
+
frontmostHeight,
|
|
65
|
+
snapToSequentialPoints
|
|
66
|
+
} = (0, _DrawerRootContext.useDrawerRootContext)();
|
|
67
|
+
const providerContext = (0, _DrawerProviderContext.useDrawerProviderContext)(true);
|
|
68
|
+
const visualStateStore = providerContext?.visualStateStore;
|
|
69
|
+
const open = store.useState('open');
|
|
70
|
+
const mounted = store.useState('mounted');
|
|
71
|
+
const nested = store.useState('nested');
|
|
72
|
+
const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');
|
|
73
|
+
const viewportElement = store.useState('viewportElement');
|
|
74
|
+
const popupElementState = store.useState('popupElement');
|
|
75
|
+
const nestedDrawerOpen = nestedOpenDialogCount > 0;
|
|
76
|
+
const scrollAxis = swipeDirection === 'left' || swipeDirection === 'right' ? 'horizontal' : 'vertical';
|
|
77
|
+
const {
|
|
78
|
+
snapPoints,
|
|
79
|
+
resolvedSnapPoints,
|
|
80
|
+
activeSnapPoint,
|
|
81
|
+
activeSnapPointOffset,
|
|
82
|
+
setActiveSnapPoint,
|
|
83
|
+
popupHeight
|
|
84
|
+
} = (0, _useDrawerSnapPoints.useDrawerSnapPoints)();
|
|
85
|
+
const [swipeRelease, setSwipeRelease] = React.useState(null);
|
|
86
|
+
const pendingSwipeCloseSnapPointRef = React.useRef(undefined);
|
|
87
|
+
const resetSwipeRef = React.useRef(null);
|
|
88
|
+
const nestedSwipeActiveRef = React.useRef(false);
|
|
89
|
+
const lastPointerTypeRef = React.useRef('');
|
|
90
|
+
const ignoreNextTouchStartFromPenRef = React.useRef(false);
|
|
91
|
+
const touchScrollStateRef = React.useRef(null);
|
|
92
|
+
const snapPointRange = React.useMemo(() => {
|
|
93
|
+
if (!snapPoints || snapPoints.length < 2) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (swipeDirection !== 'down' && swipeDirection !== 'up') {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
if (resolvedSnapPoints.length < 2) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const offsets = resolvedSnapPoints.map(point => point.offset).filter(offset => Number.isFinite(offset)).sort((a, b) => a - b);
|
|
103
|
+
if (offsets.length < 2) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const minOffset = offsets[0];
|
|
107
|
+
const nextOffset = offsets[1];
|
|
108
|
+
const maxOffset = offsets[offsets.length - 1];
|
|
109
|
+
let range = nextOffset - minOffset;
|
|
110
|
+
if (!Number.isFinite(range) || range <= 0) {
|
|
111
|
+
const fallbackRange = maxOffset - minOffset;
|
|
112
|
+
if (!Number.isFinite(fallbackRange) || fallbackRange <= 0) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
range = fallbackRange;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
minOffset,
|
|
119
|
+
range
|
|
120
|
+
};
|
|
121
|
+
}, [resolvedSnapPoints, snapPoints, swipeDirection]);
|
|
122
|
+
const snapPointProgress = React.useMemo(() => {
|
|
123
|
+
if (!snapPointRange || activeSnapPointOffset === null) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return (0, _clamp.clamp)((activeSnapPointOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
127
|
+
}, [activeSnapPointOffset, snapPointRange]);
|
|
128
|
+
const swipeDirections = React.useMemo(() => {
|
|
129
|
+
if (snapPoints && snapPoints.length > 0 && (swipeDirection === 'down' || swipeDirection === 'up')) {
|
|
130
|
+
return swipeDirection === 'down' ? ['down', 'up'] : ['up', 'down'];
|
|
131
|
+
}
|
|
132
|
+
return [swipeDirection];
|
|
133
|
+
}, [snapPoints, swipeDirection]);
|
|
134
|
+
const setSwipeDismissed = (0, _useStableCallback.useStableCallback)(dismissed => {
|
|
135
|
+
setSwipeDismissedElements(store.context.popupRef.current, store.context.backdropRef.current, dismissed);
|
|
136
|
+
});
|
|
137
|
+
const clearSwipeRelease = (0, _useStableCallback.useStableCallback)(() => {
|
|
138
|
+
setSwipeDismissed(false);
|
|
139
|
+
store.context.popupRef.current?.removeAttribute(_stateAttributesMapping.TransitionStatusDataAttributes.endingStyle);
|
|
140
|
+
setSwipeRelease(null);
|
|
141
|
+
});
|
|
142
|
+
const applySwipeProgress = (0, _useStableCallback.useStableCallback)(({
|
|
143
|
+
resolvedProgress,
|
|
144
|
+
shouldTrackProgress,
|
|
145
|
+
notifyParent
|
|
146
|
+
}) => {
|
|
147
|
+
const isActive = open && !nested && shouldTrackProgress;
|
|
148
|
+
const swipeProgress = isActive ? resolvedProgress : 0;
|
|
149
|
+
if (notifyParent && notifyParentSwipeProgressChange) {
|
|
150
|
+
const nestedSwipeProgress = open && shouldTrackProgress ? resolvedProgress : 0;
|
|
151
|
+
notifyParentSwipeProgressChange(nestedSwipeProgress);
|
|
152
|
+
}
|
|
153
|
+
visualStateStore?.set({
|
|
154
|
+
swipeProgress,
|
|
155
|
+
frontmostHeight: swipeProgress > 0 ? frontmostHeight : 0
|
|
156
|
+
});
|
|
157
|
+
const backdropElement = store.context.backdropRef.current;
|
|
158
|
+
if (!backdropElement) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (!isActive || swipeProgress <= 0) {
|
|
162
|
+
backdropElement.style.setProperty(_DrawerBackdropCssVars.DrawerBackdropCssVars.swipeProgress, '0');
|
|
163
|
+
backdropElement.style.removeProperty(_DrawerPopupCssVars.DrawerPopupCssVars.height);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
backdropElement.style.setProperty(_DrawerBackdropCssVars.DrawerBackdropCssVars.swipeProgress, `${swipeProgress}`);
|
|
167
|
+
if (frontmostHeight > 0) {
|
|
168
|
+
backdropElement.style.setProperty(_DrawerPopupCssVars.DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
169
|
+
} else {
|
|
170
|
+
backdropElement.style.removeProperty(_DrawerPopupCssVars.DrawerPopupCssVars.height);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
function resolveSwipeRelease({
|
|
174
|
+
direction,
|
|
175
|
+
deltaX,
|
|
176
|
+
deltaY,
|
|
177
|
+
velocityX,
|
|
178
|
+
velocityY,
|
|
179
|
+
releaseVelocityX,
|
|
180
|
+
releaseVelocityY
|
|
181
|
+
}) {
|
|
182
|
+
if (!direction) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const popupElement = store.context.popupRef.current;
|
|
186
|
+
if (!popupElement) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
const size = direction === 'left' || direction === 'right' ? popupElement.offsetWidth : popupElement.offsetHeight;
|
|
190
|
+
if (!Number.isFinite(size) || size <= 0) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const axisDelta = direction === 'left' || direction === 'right' ? deltaX : deltaY;
|
|
194
|
+
const snapPointBaseOffset = snapPoints && snapPoints.length > 0 ? activeSnapPointOffset ?? 0 : 0;
|
|
195
|
+
let baseOffset = 0;
|
|
196
|
+
if (direction === 'down') {
|
|
197
|
+
baseOffset = snapPointBaseOffset;
|
|
198
|
+
} else if (direction === 'up') {
|
|
199
|
+
baseOffset = -snapPointBaseOffset;
|
|
200
|
+
}
|
|
201
|
+
const translation = baseOffset + axisDelta;
|
|
202
|
+
const translationAlongDirection = direction === 'left' || direction === 'up' ? -translation : translation;
|
|
203
|
+
const remainingDistance = Math.max(0, size - translationAlongDirection);
|
|
204
|
+
if (!Number.isFinite(remainingDistance) || remainingDistance <= 0) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const axisVelocity = direction === 'left' || direction === 'right' ? releaseVelocityX : releaseVelocityY;
|
|
208
|
+
const fallbackVelocity = direction === 'left' || direction === 'right' ? velocityX : velocityY;
|
|
209
|
+
const resolvedVelocity = Math.abs(axisVelocity) > 0 && Number.isFinite(axisVelocity) ? axisVelocity : fallbackVelocity;
|
|
210
|
+
const directionalVelocity = direction === 'left' || direction === 'up' ? -resolvedVelocity : resolvedVelocity;
|
|
211
|
+
if (!Number.isFinite(directionalVelocity) || directionalVelocity <= MIN_SWIPE_RELEASE_VELOCITY) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
const clampedVelocity = (0, _clamp.clamp)(directionalVelocity, MIN_SWIPE_RELEASE_VELOCITY, MAX_SWIPE_RELEASE_VELOCITY);
|
|
215
|
+
const durationMs = (0, _clamp.clamp)(remainingDistance / clampedVelocity, MIN_SWIPE_RELEASE_DURATION_MS, MAX_SWIPE_RELEASE_DURATION_MS);
|
|
216
|
+
if (!Number.isFinite(durationMs)) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const normalizedDuration = (durationMs - MIN_SWIPE_RELEASE_DURATION_MS) / (MAX_SWIPE_RELEASE_DURATION_MS - MIN_SWIPE_RELEASE_DURATION_MS);
|
|
220
|
+
const durationScalar = (0, _clamp.clamp)(MIN_SWIPE_RELEASE_SCALAR + normalizedDuration * (MAX_SWIPE_RELEASE_SCALAR - MIN_SWIPE_RELEASE_SCALAR), MIN_SWIPE_RELEASE_SCALAR, MAX_SWIPE_RELEASE_SCALAR);
|
|
221
|
+
if (!Number.isFinite(durationScalar) || durationScalar <= 0) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
return durationScalar;
|
|
225
|
+
}
|
|
226
|
+
function updateNestedSwipeActive(details) {
|
|
227
|
+
if (nestedSwipeActiveRef.current || !details) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const direction = details.direction ?? swipeDirection;
|
|
231
|
+
const delta = direction === 'left' || direction === 'right' ? details.deltaX : details.deltaY;
|
|
232
|
+
if (!Number.isFinite(delta) || Math.abs(delta) < MIN_SWIPE_THRESHOLD) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
nestedSwipeActiveRef.current = true;
|
|
236
|
+
notifyParentSwipingChange?.(true);
|
|
237
|
+
}
|
|
238
|
+
const swipe = (0, _useSwipeDismiss.useSwipeDismiss)({
|
|
239
|
+
enabled: mounted && !nestedDrawerOpen,
|
|
240
|
+
directions: swipeDirections,
|
|
241
|
+
elementRef: store.context.popupRef,
|
|
242
|
+
ignoreSelectorWhenTouch: false,
|
|
243
|
+
ignoreScrollableAncestors: true,
|
|
244
|
+
movementCssVars: {
|
|
245
|
+
x: _DrawerPopupCssVars.DrawerPopupCssVars.swipeMovementX,
|
|
246
|
+
y: _DrawerPopupCssVars.DrawerPopupCssVars.swipeMovementY
|
|
247
|
+
},
|
|
248
|
+
onSwipeStart(event) {
|
|
249
|
+
if ('touches' in event || 'pointerType' in event && event.pointerType === 'touch') {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const popupElement = store.context.popupRef.current;
|
|
253
|
+
if (!popupElement) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const doc = (0, _owner.ownerDocument)(popupElement);
|
|
257
|
+
const selection = doc.getSelection?.();
|
|
258
|
+
if (!selection || selection.isCollapsed) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const anchorElement = (0, _dom.isElement)(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
262
|
+
const focusElement = (0, _dom.isElement)(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
263
|
+
if (!(0, _utils.contains)(popupElement, anchorElement) && !(0, _utils.contains)(popupElement, focusElement)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
selection.removeAllRanges();
|
|
267
|
+
},
|
|
268
|
+
onSwipingChange(swiping) {
|
|
269
|
+
setBackdropSwipingAttribute(store.context.backdropRef.current, swiping);
|
|
270
|
+
if (!swiping) {
|
|
271
|
+
nestedSwipeActiveRef.current = false;
|
|
272
|
+
notifyParentSwipingChange?.(false);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
swipeThreshold({
|
|
276
|
+
element,
|
|
277
|
+
direction
|
|
278
|
+
}) {
|
|
279
|
+
return getBaseSwipeThreshold(element, direction);
|
|
280
|
+
},
|
|
281
|
+
canStart(position) {
|
|
282
|
+
const popupElement = store.context.popupRef.current;
|
|
283
|
+
if (!popupElement) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
const doc = popupElement.ownerDocument;
|
|
287
|
+
const elementAtPoint = typeof doc.elementFromPoint === 'function' ? doc.elementFromPoint(position.x, position.y) : null;
|
|
288
|
+
return !!(elementAtPoint && (0, _utils.contains)(popupElement, elementAtPoint));
|
|
289
|
+
},
|
|
290
|
+
onProgress(progress, details) {
|
|
291
|
+
updateNestedSwipeActive(details);
|
|
292
|
+
const currentDirection = details?.direction ?? swipe.swipeDirection;
|
|
293
|
+
const isDismissSwipe = currentDirection === undefined || currentDirection === swipeDirection;
|
|
294
|
+
const hasSnapPoints = Boolean(snapPoints && snapPoints.length > 0);
|
|
295
|
+
const isVerticalSwipe = swipeDirection === 'down' || swipeDirection === 'up';
|
|
296
|
+
const shouldTrackProgress = hasSnapPoints && isVerticalSwipe || !hasSnapPoints || swipeDirection === 'left' || swipeDirection === 'right' || isDismissSwipe;
|
|
297
|
+
let resolvedProgress = progress;
|
|
298
|
+
if (snapPointRange && popupHeight > 0) {
|
|
299
|
+
if (details && Number.isFinite(details.deltaY)) {
|
|
300
|
+
const baseOffset = activeSnapPointOffset ?? snapPointRange.minOffset;
|
|
301
|
+
const nextOffset = (0, _clamp.clamp)(baseOffset + details.deltaY, 0, popupHeight);
|
|
302
|
+
resolvedProgress = (0, _clamp.clamp)((nextOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
303
|
+
} else if (snapPointProgress !== null) {
|
|
304
|
+
resolvedProgress = snapPointProgress;
|
|
305
|
+
} else if (currentDirection === 'down' || currentDirection === 'up') {
|
|
306
|
+
const displacement = progress * popupHeight;
|
|
307
|
+
const baseOffset = activeSnapPointOffset ?? snapPointRange.minOffset;
|
|
308
|
+
const nextOffset = currentDirection === 'down' ? baseOffset + displacement : baseOffset - displacement;
|
|
309
|
+
resolvedProgress = (0, _clamp.clamp)((nextOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
applySwipeProgress({
|
|
313
|
+
resolvedProgress,
|
|
314
|
+
shouldTrackProgress,
|
|
315
|
+
notifyParent: true
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
onRelease({
|
|
319
|
+
event,
|
|
320
|
+
deltaX,
|
|
321
|
+
deltaY,
|
|
322
|
+
direction,
|
|
323
|
+
velocityX,
|
|
324
|
+
velocityY,
|
|
325
|
+
releaseVelocityX,
|
|
326
|
+
releaseVelocityY
|
|
327
|
+
}) {
|
|
328
|
+
const swipeReleasePayload = {
|
|
329
|
+
deltaX,
|
|
330
|
+
deltaY,
|
|
331
|
+
velocityX,
|
|
332
|
+
velocityY,
|
|
333
|
+
releaseVelocityX,
|
|
334
|
+
releaseVelocityY
|
|
335
|
+
};
|
|
336
|
+
function startSwipeRelease(resolvedDirection) {
|
|
337
|
+
// Start ending transition styles earlier and synchronously to prevent a period where
|
|
338
|
+
// the popup appears stuck on release before the actual closing animation starts.
|
|
339
|
+
const popupElement = store.context.popupRef.current;
|
|
340
|
+
if (!popupElement) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
notifyParentSwipingChange?.(false);
|
|
344
|
+
setSwipeDismissed(true);
|
|
345
|
+
popupElement.style.removeProperty('transition');
|
|
346
|
+
popupElement.setAttribute(_stateAttributesMapping.TransitionStatusDataAttributes.endingStyle, '');
|
|
347
|
+
ReactDOM.flushSync(() => {
|
|
348
|
+
setSwipeRelease(resolveSwipeRelease({
|
|
349
|
+
direction: resolvedDirection,
|
|
350
|
+
...swipeReleasePayload
|
|
351
|
+
}));
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
if (!snapPoints || snapPoints.length === 0) {
|
|
355
|
+
if (!direction) {
|
|
356
|
+
clearSwipeRelease();
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
const element = store.context.popupRef.current;
|
|
360
|
+
if (!element) {
|
|
361
|
+
clearSwipeRelease();
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
const baseThreshold = getBaseSwipeThreshold(element, direction);
|
|
365
|
+
const delta = direction === 'left' || direction === 'right' ? deltaX : deltaY;
|
|
366
|
+
if (!Number.isFinite(delta)) {
|
|
367
|
+
clearSwipeRelease();
|
|
368
|
+
return undefined;
|
|
369
|
+
}
|
|
370
|
+
const directionalDelta = direction === 'left' || direction === 'up' ? -delta : delta;
|
|
371
|
+
if (directionalDelta <= 0) {
|
|
372
|
+
clearSwipeRelease();
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
const velocity = direction === 'left' || direction === 'right' ? velocityX : velocityY;
|
|
376
|
+
const directionalVelocity = direction === 'left' || direction === 'up' ? -velocity : velocity;
|
|
377
|
+
if (directionalVelocity >= FAST_SWIPE_VELOCITY && directionalDelta > 0) {
|
|
378
|
+
startSwipeRelease(direction);
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
const shouldClose = directionalDelta > baseThreshold;
|
|
382
|
+
if (shouldClose) {
|
|
383
|
+
startSwipeRelease(direction);
|
|
384
|
+
} else {
|
|
385
|
+
clearSwipeRelease();
|
|
386
|
+
}
|
|
387
|
+
return shouldClose;
|
|
388
|
+
}
|
|
389
|
+
if (swipeDirection !== 'down' && swipeDirection !== 'up') {
|
|
390
|
+
clearSwipeRelease();
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
if (!popupHeight || resolvedSnapPoints.length === 0) {
|
|
394
|
+
clearSwipeRelease();
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
const dragDelta = swipeDirection === 'down' ? deltaY : -deltaY;
|
|
398
|
+
if (!Number.isFinite(dragDelta)) {
|
|
399
|
+
clearSwipeRelease();
|
|
400
|
+
return undefined;
|
|
401
|
+
}
|
|
402
|
+
const dragDirection = Math.sign(dragDelta);
|
|
403
|
+
const releaseDirectionalVelocity = swipeDirection === 'down' ? releaseVelocityY : -releaseVelocityY;
|
|
404
|
+
const fallbackDirectionalVelocity = swipeDirection === 'down' ? velocityY : -velocityY;
|
|
405
|
+
let resolvedDirectionalVelocity = Number.isFinite(releaseDirectionalVelocity) ? releaseDirectionalVelocity : fallbackDirectionalVelocity;
|
|
406
|
+
if (dragDirection !== 0 && Math.abs(dragDelta) >= MIN_SWIPE_THRESHOLD && Number.isFinite(resolvedDirectionalVelocity)) {
|
|
407
|
+
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
408
|
+
if (velocityDirection !== 0 && velocityDirection !== dragDirection) {
|
|
409
|
+
// Ignore touch reversals that would otherwise flip the snap decision.
|
|
410
|
+
resolvedDirectionalVelocity = fallbackDirectionalVelocity;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const currentOffset = activeSnapPointOffset ?? 0;
|
|
414
|
+
const dragTargetOffset = (0, _clamp.clamp)(currentOffset + dragDelta, 0, popupHeight);
|
|
415
|
+
const velocityOffset = Number.isFinite(resolvedDirectionalVelocity) && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD ? (0, _clamp.clamp)(resolvedDirectionalVelocity, -MAX_SNAP_VELOCITY, MAX_SNAP_VELOCITY) * SNAP_VELOCITY_MULTIPLIER : 0;
|
|
416
|
+
const targetOffset = snapToSequentialPoints ? dragTargetOffset : (0, _clamp.clamp)(dragTargetOffset + velocityOffset, 0, popupHeight);
|
|
417
|
+
const snapPointEventDetails = (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.swipe, event);
|
|
418
|
+
const closeFromSnapPoints = () => {
|
|
419
|
+
pendingSwipeCloseSnapPointRef.current = activeSnapPoint;
|
|
420
|
+
setActiveSnapPoint?.(null, snapPointEventDetails);
|
|
421
|
+
startSwipeRelease(swipeDirection);
|
|
422
|
+
return true;
|
|
423
|
+
};
|
|
424
|
+
if (snapToSequentialPoints) {
|
|
425
|
+
const orderedSnapPoints = [...resolvedSnapPoints].sort((first, second) => first.offset - second.offset);
|
|
426
|
+
if (orderedSnapPoints.length === 0) {
|
|
427
|
+
clearSwipeRelease();
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
let currentIndex = 0;
|
|
431
|
+
let closestDistance = Math.abs(currentOffset - orderedSnapPoints[0].offset);
|
|
432
|
+
for (let index = 1; index < orderedSnapPoints.length; index += 1) {
|
|
433
|
+
const distance = Math.abs(currentOffset - orderedSnapPoints[index].offset);
|
|
434
|
+
if (distance < closestDistance) {
|
|
435
|
+
closestDistance = distance;
|
|
436
|
+
currentIndex = index;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
let targetSnapPoint = orderedSnapPoints[0];
|
|
440
|
+
closestDistance = Math.abs(targetOffset - targetSnapPoint.offset);
|
|
441
|
+
for (const snapPoint of orderedSnapPoints) {
|
|
442
|
+
const distance = Math.abs(targetOffset - snapPoint.offset);
|
|
443
|
+
if (distance < closestDistance) {
|
|
444
|
+
closestDistance = distance;
|
|
445
|
+
targetSnapPoint = snapPoint;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
449
|
+
const shouldAdvance = dragDirection !== 0 && velocityDirection !== 0 && velocityDirection === dragDirection && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD;
|
|
450
|
+
let effectiveTargetOffset = targetOffset;
|
|
451
|
+
if (shouldAdvance) {
|
|
452
|
+
const adjacentIndex = (0, _clamp.clamp)(currentIndex + dragDirection, 0, orderedSnapPoints.length - 1);
|
|
453
|
+
if (adjacentIndex !== currentIndex) {
|
|
454
|
+
const adjacentPoint = orderedSnapPoints[adjacentIndex];
|
|
455
|
+
const shouldForceAdjacent = dragDirection > 0 ? targetOffset < adjacentPoint.offset : targetOffset > adjacentPoint.offset;
|
|
456
|
+
if (shouldForceAdjacent) {
|
|
457
|
+
targetSnapPoint = adjacentPoint;
|
|
458
|
+
effectiveTargetOffset = adjacentPoint.offset;
|
|
459
|
+
}
|
|
460
|
+
} else if (dragDirection > 0) {
|
|
461
|
+
return closeFromSnapPoints();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
const closeOffset = popupHeight;
|
|
465
|
+
const closeDistance = Math.abs(effectiveTargetOffset - closeOffset);
|
|
466
|
+
const snapDistance = Math.abs(effectiveTargetOffset - targetSnapPoint.offset);
|
|
467
|
+
if (closeDistance < snapDistance) {
|
|
468
|
+
return closeFromSnapPoints();
|
|
469
|
+
}
|
|
470
|
+
setActiveSnapPoint?.(targetSnapPoint.value, snapPointEventDetails);
|
|
471
|
+
clearSwipeRelease();
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
if (resolvedDirectionalVelocity >= FAST_SWIPE_VELOCITY && dragDelta > 0) {
|
|
475
|
+
return closeFromSnapPoints();
|
|
476
|
+
}
|
|
477
|
+
let closestSnapPoint = resolvedSnapPoints[0];
|
|
478
|
+
let closestDistance = Math.abs(targetOffset - closestSnapPoint.offset);
|
|
479
|
+
for (const snapPoint of resolvedSnapPoints) {
|
|
480
|
+
const distance = Math.abs(targetOffset - snapPoint.offset);
|
|
481
|
+
if (distance < closestDistance) {
|
|
482
|
+
closestDistance = distance;
|
|
483
|
+
closestSnapPoint = snapPoint;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const closeOffset = popupHeight;
|
|
487
|
+
const closeDistance = Math.abs(targetOffset - closeOffset);
|
|
488
|
+
if (closeDistance < closestDistance) {
|
|
489
|
+
return closeFromSnapPoints();
|
|
490
|
+
}
|
|
491
|
+
setActiveSnapPoint?.(closestSnapPoint.value, snapPointEventDetails);
|
|
492
|
+
clearSwipeRelease();
|
|
493
|
+
return false;
|
|
494
|
+
},
|
|
495
|
+
onDismiss(event) {
|
|
496
|
+
visualStateStore?.set({
|
|
497
|
+
swipeProgress: 0,
|
|
498
|
+
frontmostHeight: 0
|
|
499
|
+
});
|
|
500
|
+
const backdropElement = store.context.backdropRef.current;
|
|
501
|
+
if (backdropElement) {
|
|
502
|
+
backdropElement.style.setProperty(_DrawerBackdropCssVars.DrawerBackdropCssVars.swipeProgress, '0');
|
|
503
|
+
backdropElement.style.removeProperty(_DrawerPopupCssVars.DrawerPopupCssVars.height);
|
|
504
|
+
}
|
|
505
|
+
const dismissEventDetails = (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.swipe, event);
|
|
506
|
+
store.setOpen(false, dismissEventDetails);
|
|
507
|
+
if (dismissEventDetails.isCanceled) {
|
|
508
|
+
const pendingSnapPoint = pendingSwipeCloseSnapPointRef.current;
|
|
509
|
+
if (pendingSnapPoint !== undefined) {
|
|
510
|
+
setActiveSnapPoint?.(pendingSnapPoint, (0, _createBaseUIEventDetails.createChangeEventDetails)(_reasons.REASONS.swipe, event));
|
|
511
|
+
}
|
|
512
|
+
pendingSwipeCloseSnapPointRef.current = undefined;
|
|
513
|
+
resetSwipeRef.current?.();
|
|
514
|
+
clearSwipeRelease();
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
pendingSwipeCloseSnapPointRef.current = undefined;
|
|
518
|
+
setSwipeDismissed(true);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
const swipePointerProps = swipe.getPointerProps();
|
|
522
|
+
const swipeTouchProps = swipe.getTouchProps();
|
|
523
|
+
const resetSwipe = swipe.reset;
|
|
524
|
+
resetSwipeRef.current = resetSwipe;
|
|
525
|
+
React.useEffect(() => {
|
|
526
|
+
const rootElement = viewportElement ?? popupElementState;
|
|
527
|
+
if (!rootElement) {
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
const doc = (0, _owner.ownerDocument)(rootElement);
|
|
531
|
+
const win = (0, _owner.ownerWindow)(doc);
|
|
532
|
+
function handleNativeTouchMove(event) {
|
|
533
|
+
const touchState = touchScrollStateRef.current;
|
|
534
|
+
const touch = event.touches[0];
|
|
535
|
+
if (!touch || !touchState) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const target = (0, _dom.isElement)(event.target) ? event.target : null;
|
|
539
|
+
const updateTouchPosition = () => {
|
|
540
|
+
touchState.lastX = touch.clientX;
|
|
541
|
+
touchState.lastY = touch.clientY;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
// Preserve native range interaction by never locking touchmove for range inputs.
|
|
545
|
+
if (isEventOnRangeInput(event, win)) {
|
|
546
|
+
touchState.allowSwipe = false;
|
|
547
|
+
updateTouchPosition();
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Avoid blocking pinch zoom or text selection adjustments on iOS Safari.
|
|
552
|
+
if (event.touches.length === 2) {
|
|
553
|
+
updateTouchPosition();
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
let allowTouchMove = false;
|
|
557
|
+
|
|
558
|
+
// Allow the ability to adjust text selection.
|
|
559
|
+
if (target) {
|
|
560
|
+
const selection = target.ownerDocument.defaultView?.getSelection();
|
|
561
|
+
if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {
|
|
562
|
+
allowTouchMove = true;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// Allow user to drag the selection handles in an input element.
|
|
567
|
+
if (target instanceof win.HTMLInputElement) {
|
|
568
|
+
const input = target;
|
|
569
|
+
if (input.selectionStart != null && input.selectionEnd != null && input.selectionStart < input.selectionEnd && doc.activeElement === input) {
|
|
570
|
+
allowTouchMove = true;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
if (allowTouchMove || !open || !mounted || nestedDrawerOpen) {
|
|
574
|
+
updateTouchPosition();
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const scrollTarget = touchState.scrollTarget;
|
|
578
|
+
if (!scrollTarget || scrollTarget === doc.documentElement || scrollTarget === doc.body) {
|
|
579
|
+
if (event.cancelable) {
|
|
580
|
+
event.preventDefault();
|
|
581
|
+
}
|
|
582
|
+
updateTouchPosition();
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const hasScrollableContent = hasScrollableContentOnAxis(scrollTarget, scrollAxis);
|
|
586
|
+
if (!hasScrollableContent) {
|
|
587
|
+
// If the scroll container doesn't overflow on the drawer axis, prevent the window from
|
|
588
|
+
// scrolling instead.
|
|
589
|
+
if (event.cancelable) {
|
|
590
|
+
event.preventDefault();
|
|
591
|
+
}
|
|
592
|
+
updateTouchPosition();
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const delta = scrollAxis === 'vertical' ? touch.clientY - touchState.lastY : touch.clientX - touchState.lastX;
|
|
596
|
+
if (delta !== 0) {
|
|
597
|
+
const canSwipeFromScrollEdge = canSwipeFromScrollEdgeOnMove(scrollTarget, scrollAxis, swipeDirection, delta);
|
|
598
|
+
if (touchState.allowSwipe !== true) {
|
|
599
|
+
if (!event.cancelable) {
|
|
600
|
+
touchState.allowSwipe = false;
|
|
601
|
+
} else if (canSwipeFromScrollEdge) {
|
|
602
|
+
touchState.allowSwipe = true;
|
|
603
|
+
event.preventDefault();
|
|
604
|
+
} else {
|
|
605
|
+
touchState.allowSwipe = false;
|
|
606
|
+
}
|
|
607
|
+
} else if (event.cancelable) {
|
|
608
|
+
event.preventDefault();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
updateTouchPosition();
|
|
612
|
+
}
|
|
613
|
+
doc.addEventListener('touchmove', handleNativeTouchMove, {
|
|
614
|
+
passive: false,
|
|
615
|
+
capture: true
|
|
616
|
+
});
|
|
617
|
+
return () => {
|
|
618
|
+
doc.removeEventListener('touchmove', handleNativeTouchMove, {
|
|
619
|
+
capture: true
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
}, [mounted, nestedDrawerOpen, open, popupElementState, scrollAxis, swipeDirection, viewportElement]);
|
|
623
|
+
React.useEffect(() => {
|
|
624
|
+
if (!snapPointRange || swipe.swiping) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
const resolvedProgress = !open || nested ? 0 : snapPointProgress ?? 0;
|
|
628
|
+
applySwipeProgress({
|
|
629
|
+
resolvedProgress,
|
|
630
|
+
shouldTrackProgress: true,
|
|
631
|
+
notifyParent: false
|
|
632
|
+
});
|
|
633
|
+
}, [applySwipeProgress, frontmostHeight, nested, notifyParentSwipeProgressChange, open, snapPointProgress, snapPointRange, swipe.swiping, store, visualStateStore]);
|
|
634
|
+
React.useEffect(() => {
|
|
635
|
+
if (!notifyParentSwipeProgressChange) {
|
|
636
|
+
return undefined;
|
|
637
|
+
}
|
|
638
|
+
if (!open) {
|
|
639
|
+
notifyParentSwipeProgressChange(0);
|
|
640
|
+
}
|
|
641
|
+
return () => {
|
|
642
|
+
notifyParentSwipeProgressChange(0);
|
|
643
|
+
};
|
|
644
|
+
}, [notifyParentSwipeProgressChange, open]);
|
|
645
|
+
React.useEffect(() => {
|
|
646
|
+
if (open) {
|
|
647
|
+
resetSwipe();
|
|
648
|
+
clearSwipeRelease();
|
|
649
|
+
}
|
|
650
|
+
}, [clearSwipeRelease, open, resetSwipe]);
|
|
651
|
+
React.useEffect(() => {
|
|
652
|
+
return () => {
|
|
653
|
+
visualStateStore?.set({
|
|
654
|
+
swipeProgress: 0,
|
|
655
|
+
frontmostHeight: 0
|
|
656
|
+
});
|
|
657
|
+
setBackdropSwipingAttribute(store.context.backdropRef.current, false);
|
|
658
|
+
notifyParentSwipingChange?.(false);
|
|
659
|
+
};
|
|
660
|
+
}, [notifyParentSwipingChange, store, visualStateStore]);
|
|
661
|
+
const swipeProviderValue = React.useMemo(() => ({
|
|
662
|
+
swiping: swipe.swiping,
|
|
663
|
+
getDragStyles: swipe.getDragStyles,
|
|
664
|
+
swipeStrength: swipeRelease ?? null,
|
|
665
|
+
setSwipeDismissed(dismissed) {
|
|
666
|
+
setSwipeDismissedElements(store.context.popupRef.current, store.context.backdropRef.current, dismissed);
|
|
667
|
+
}
|
|
668
|
+
}), [store, swipe.getDragStyles, swipe.swiping, swipeRelease]);
|
|
669
|
+
function resetTouchTrackingState() {
|
|
670
|
+
touchScrollStateRef.current = null;
|
|
671
|
+
lastPointerTypeRef.current = '';
|
|
672
|
+
ignoreNextTouchStartFromPenRef.current = false;
|
|
673
|
+
}
|
|
674
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogViewport.DialogViewport, {
|
|
675
|
+
ref: forwardedRef,
|
|
676
|
+
className: className,
|
|
677
|
+
render: render,
|
|
678
|
+
...(0, _mergeProps.mergeProps)(elementProps, {
|
|
679
|
+
onPointerDown(event) {
|
|
680
|
+
lastPointerTypeRef.current = event.pointerType;
|
|
681
|
+
ignoreNextTouchStartFromPenRef.current = event.pointerType === 'pen';
|
|
682
|
+
if (!open || !mounted || nestedDrawerOpen || event.pointerType === 'touch') {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const doc = (0, _owner.ownerDocument)(event.currentTarget);
|
|
686
|
+
const elementAtPoint = typeof doc.elementFromPoint === 'function' ? doc.elementFromPoint(event.clientX, event.clientY) : null;
|
|
687
|
+
if (elementAtPoint?.closest('[data-swipe-ignore]')) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
swipePointerProps.onPointerDown?.(event);
|
|
691
|
+
},
|
|
692
|
+
onPointerMove(event) {
|
|
693
|
+
if (event.pointerType === 'touch') {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
swipePointerProps.onPointerMove?.(event);
|
|
697
|
+
},
|
|
698
|
+
onPointerUp(event) {
|
|
699
|
+
if (lastPointerTypeRef.current === event.pointerType) {
|
|
700
|
+
lastPointerTypeRef.current = '';
|
|
701
|
+
}
|
|
702
|
+
if (event.pointerType === 'touch') {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
swipePointerProps.onPointerUp?.(event);
|
|
706
|
+
},
|
|
707
|
+
onPointerCancel(event) {
|
|
708
|
+
if (lastPointerTypeRef.current === event.pointerType) {
|
|
709
|
+
lastPointerTypeRef.current = '';
|
|
710
|
+
}
|
|
711
|
+
if (event.pointerType === 'touch') {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
swipePointerProps.onPointerCancel?.(event);
|
|
715
|
+
},
|
|
716
|
+
onTouchStart(event) {
|
|
717
|
+
const startedFromPenPointerDown = lastPointerTypeRef.current === 'pen' && ignoreNextTouchStartFromPenRef.current;
|
|
718
|
+
if (startedFromPenPointerDown) {
|
|
719
|
+
ignoreNextTouchStartFromPenRef.current = false;
|
|
720
|
+
touchScrollStateRef.current = null;
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (!open || !mounted || nestedDrawerOpen) {
|
|
724
|
+
touchScrollStateRef.current = null;
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const touch = event.touches[0];
|
|
728
|
+
if (!touch) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
if (isReactTouchEventOnRangeInput(event)) {
|
|
732
|
+
touchScrollStateRef.current = null;
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
const rootElement = viewportElement ?? popupElementState;
|
|
736
|
+
const target = (0, _dom.isElement)(event.target) ? event.target : null;
|
|
737
|
+
const scrollTarget = rootElement && target && (0, _utils.contains)(rootElement, target) ? (0, _scrollable.findScrollableTouchTarget)(target, rootElement, scrollAxis) : null;
|
|
738
|
+
let allowSwipe = null;
|
|
739
|
+
if (scrollTarget) {
|
|
740
|
+
const canSwipeFromEdge = isAtSwipeStartEdge(scrollTarget, scrollAxis, swipeDirection);
|
|
741
|
+
allowSwipe = canSwipeFromEdge ? null : false;
|
|
742
|
+
}
|
|
743
|
+
touchScrollStateRef.current = {
|
|
744
|
+
lastX: touch.clientX,
|
|
745
|
+
lastY: touch.clientY,
|
|
746
|
+
scrollTarget,
|
|
747
|
+
allowSwipe
|
|
748
|
+
};
|
|
749
|
+
swipeTouchProps.onTouchStart?.(event);
|
|
750
|
+
},
|
|
751
|
+
onTouchMove(event) {
|
|
752
|
+
if (isReactTouchEventOnRangeInput(event)) {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const touchState = touchScrollStateRef.current;
|
|
756
|
+
if (touchState?.scrollTarget && touchState.allowSwipe !== true) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
swipeTouchProps.onTouchMove?.(event);
|
|
760
|
+
},
|
|
761
|
+
onTouchEnd(event) {
|
|
762
|
+
resetTouchTrackingState();
|
|
763
|
+
swipeTouchProps.onTouchEnd?.(event);
|
|
764
|
+
},
|
|
765
|
+
onTouchCancel(event) {
|
|
766
|
+
resetTouchTrackingState();
|
|
767
|
+
swipeTouchProps.onTouchCancel?.(event);
|
|
768
|
+
}
|
|
769
|
+
}),
|
|
770
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DrawerViewportContext.DrawerViewportContext.Provider, {
|
|
771
|
+
value: swipeProviderValue,
|
|
772
|
+
children: children
|
|
773
|
+
})
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
if (process.env.NODE_ENV !== "production") DrawerViewport.displayName = "DrawerViewport";
|
|
777
|
+
function setSwipeDismissedElements(popupElement, backdropElement, dismissed) {
|
|
778
|
+
if (dismissed) {
|
|
779
|
+
popupElement?.setAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swipeDismiss, '');
|
|
780
|
+
backdropElement?.setAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swipeDismiss, '');
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
popupElement?.removeAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swipeDismiss);
|
|
784
|
+
backdropElement?.removeAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swipeDismiss);
|
|
785
|
+
}
|
|
786
|
+
function setBackdropSwipingAttribute(backdropElement, swiping) {
|
|
787
|
+
if (!backdropElement) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (swiping) {
|
|
791
|
+
backdropElement.setAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swiping, '');
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
backdropElement.removeAttribute(_DrawerPopupDataAttributes.DrawerPopupDataAttributes.swiping);
|
|
795
|
+
}
|
|
796
|
+
function getBaseSwipeThreshold(element, direction) {
|
|
797
|
+
const size = direction === 'left' || direction === 'right' ? element.offsetWidth : element.offsetHeight;
|
|
798
|
+
return Math.max(size * 0.5, MIN_SWIPE_THRESHOLD);
|
|
799
|
+
}
|
|
800
|
+
function isRangeInput(target, win) {
|
|
801
|
+
return target instanceof win.HTMLInputElement && target.type === 'range';
|
|
802
|
+
}
|
|
803
|
+
function isEventOnRangeInput(event, win) {
|
|
804
|
+
const composedPath = event.composedPath();
|
|
805
|
+
if (composedPath) {
|
|
806
|
+
return composedPath.some(pathTarget => isRangeInput(pathTarget, win));
|
|
807
|
+
}
|
|
808
|
+
return isRangeInput(event.target, win);
|
|
809
|
+
}
|
|
810
|
+
function isReactTouchEventOnRangeInput(event) {
|
|
811
|
+
return isEventOnRangeInput(event.nativeEvent, (0, _owner.ownerWindow)(event.currentTarget));
|
|
812
|
+
}
|
|
813
|
+
function hasScrollableContentOnAxis(scrollTarget, axis) {
|
|
814
|
+
return axis === 'vertical' ? scrollTarget.scrollHeight > scrollTarget.clientHeight : scrollTarget.scrollWidth > scrollTarget.clientWidth;
|
|
815
|
+
}
|
|
816
|
+
function getScrollMetrics(scrollTarget, axis) {
|
|
817
|
+
if (axis === 'vertical') {
|
|
818
|
+
const max = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight);
|
|
819
|
+
return {
|
|
820
|
+
offset: scrollTarget.scrollTop,
|
|
821
|
+
max
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
const max = Math.max(0, scrollTarget.scrollWidth - scrollTarget.clientWidth);
|
|
825
|
+
return {
|
|
826
|
+
offset: scrollTarget.scrollLeft,
|
|
827
|
+
max
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function isAtSwipeStartEdge(scrollTarget, axis, direction) {
|
|
831
|
+
const {
|
|
832
|
+
offset,
|
|
833
|
+
max
|
|
834
|
+
} = getScrollMetrics(scrollTarget, axis);
|
|
835
|
+
const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis);
|
|
836
|
+
if (dismissFromStartEdge === null) {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
return dismissFromStartEdge ? offset <= 0 : offset >= max;
|
|
840
|
+
}
|
|
841
|
+
function canSwipeFromScrollEdgeOnMove(scrollTarget, axis, direction, delta) {
|
|
842
|
+
const {
|
|
843
|
+
offset,
|
|
844
|
+
max
|
|
845
|
+
} = getScrollMetrics(scrollTarget, axis);
|
|
846
|
+
const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis);
|
|
847
|
+
if (dismissFromStartEdge === null) {
|
|
848
|
+
return false;
|
|
849
|
+
}
|
|
850
|
+
const movingTowardDismiss = dismissFromStartEdge ? delta > 0 : delta < 0;
|
|
851
|
+
if (!movingTowardDismiss) {
|
|
852
|
+
return false;
|
|
853
|
+
}
|
|
854
|
+
return dismissFromStartEdge ? offset <= 0 : offset >= max;
|
|
855
|
+
}
|
|
856
|
+
function shouldDismissFromStartEdge(direction, axis) {
|
|
857
|
+
if (axis === 'vertical') {
|
|
858
|
+
if (direction === 'down') {
|
|
859
|
+
return true;
|
|
860
|
+
}
|
|
861
|
+
if (direction === 'up') {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
866
|
+
if (direction === 'right') {
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
if (direction === 'left') {
|
|
870
|
+
return false;
|
|
871
|
+
}
|
|
872
|
+
return null;
|
|
873
|
+
}
|