@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
package/toast/root/ToastRoot.js
CHANGED
|
@@ -94,16 +94,7 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
94
94
|
swipeDirections = Array.isArray(swipeDirection) ? swipeDirection : [swipeDirection];
|
|
95
95
|
}
|
|
96
96
|
const swipeEnabled = swipeDirections.length > 0;
|
|
97
|
-
const
|
|
98
|
-
toasts,
|
|
99
|
-
focused,
|
|
100
|
-
close,
|
|
101
|
-
remove,
|
|
102
|
-
setToasts,
|
|
103
|
-
pauseTimers,
|
|
104
|
-
expanded,
|
|
105
|
-
setHovering
|
|
106
|
-
} = (0, _ToastProviderContext.useToastContext)();
|
|
97
|
+
const store = (0, _ToastProviderContext.useToastProviderContext)();
|
|
107
98
|
const [currentSwipeDirection, setCurrentSwipeDirection] = React.useState(undefined);
|
|
108
99
|
const [isSwiping, setIsSwiping] = React.useState(false);
|
|
109
100
|
const [isRealSwipe, setIsRealSwipe] = React.useState(false);
|
|
@@ -138,17 +129,17 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
138
129
|
y: 0
|
|
139
130
|
});
|
|
140
131
|
const isFirstPointerMoveRef = React.useRef(false);
|
|
141
|
-
const domIndex =
|
|
142
|
-
const visibleIndex =
|
|
143
|
-
const offsetY =
|
|
144
|
-
|
|
145
|
-
|
|
132
|
+
const domIndex = store.useState('toastIndex', toast.id);
|
|
133
|
+
const visibleIndex = store.useState('toastVisibleIndex', toast.id);
|
|
134
|
+
const offsetY = store.useState('toastOffsetY', toast.id);
|
|
135
|
+
const focused = store.useState('focused');
|
|
136
|
+
const expanded = store.useState('expanded');
|
|
146
137
|
(0, _useOpenChangeComplete.useOpenChangeComplete)({
|
|
147
138
|
open: toast.transitionStatus !== 'ending',
|
|
148
139
|
ref: rootRef,
|
|
149
140
|
onComplete() {
|
|
150
141
|
if (toast.transitionStatus === 'ending') {
|
|
151
|
-
|
|
142
|
+
store.removeToast(toast.id);
|
|
152
143
|
}
|
|
153
144
|
}
|
|
154
145
|
});
|
|
@@ -168,12 +159,13 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
168
159
|
const height = element.offsetHeight;
|
|
169
160
|
element.style.height = previousHeight;
|
|
170
161
|
function update() {
|
|
171
|
-
|
|
172
|
-
...t,
|
|
162
|
+
store.updateToastInternal(toast.id, {
|
|
173
163
|
ref: rootRef,
|
|
174
164
|
height,
|
|
175
|
-
transitionStatus
|
|
176
|
-
|
|
165
|
+
...(toast.transitionStatus === 'starting' ? {
|
|
166
|
+
transitionStatus: undefined
|
|
167
|
+
} : {})
|
|
168
|
+
});
|
|
177
169
|
}
|
|
178
170
|
if (flushSync) {
|
|
179
171
|
ReactDOM.flushSync(update);
|
|
@@ -215,7 +207,7 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
215
207
|
return;
|
|
216
208
|
}
|
|
217
209
|
if (event.pointerType === 'touch') {
|
|
218
|
-
pauseTimers();
|
|
210
|
+
store.pauseTimers();
|
|
219
211
|
}
|
|
220
212
|
const target = (0, _utils.getTarget)(event.nativeEvent);
|
|
221
213
|
const isInteractiveElement = target ? target.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]') : false;
|
|
@@ -239,7 +231,7 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
239
231
|
y: transform.y
|
|
240
232
|
});
|
|
241
233
|
}
|
|
242
|
-
setHovering(true);
|
|
234
|
+
store.setHovering(true);
|
|
243
235
|
setIsSwiping(true);
|
|
244
236
|
setIsRealSwipe(false);
|
|
245
237
|
setLockedDirection(null);
|
|
@@ -414,7 +406,7 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
414
406
|
if (shouldClose) {
|
|
415
407
|
setCurrentSwipeDirection(dismissDirection);
|
|
416
408
|
setDragDismissed(true);
|
|
417
|
-
|
|
409
|
+
store.closeToast(toast.id);
|
|
418
410
|
} else {
|
|
419
411
|
setDragOffset({
|
|
420
412
|
x: initialTransform.x,
|
|
@@ -428,7 +420,7 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
428
420
|
if (!rootRef.current || !(0, _utils.contains)(rootRef.current, (0, _utils.activeElement)((0, _owner.ownerDocument)(rootRef.current)))) {
|
|
429
421
|
return;
|
|
430
422
|
}
|
|
431
|
-
|
|
423
|
+
store.closeToast(toast.id);
|
|
432
424
|
}
|
|
433
425
|
}
|
|
434
426
|
React.useEffect(() => {
|
|
@@ -503,14 +495,14 @@ const ToastRoot = exports.ToastRoot = /*#__PURE__*/React.forwardRef(function Toa
|
|
|
503
495
|
visibleIndex,
|
|
504
496
|
expanded
|
|
505
497
|
}), [toast, titleId, descriptionId, isSwiping, currentSwipeDirection, recalculateHeight, domIndex, visibleIndex, expanded]);
|
|
506
|
-
const state =
|
|
498
|
+
const state = {
|
|
507
499
|
transitionStatus: toast.transitionStatus,
|
|
508
500
|
expanded,
|
|
509
501
|
limited: toast.limited || false,
|
|
510
502
|
type: toast.type,
|
|
511
503
|
swiping: toastRoot.swiping,
|
|
512
504
|
swipeDirection: toastRoot.swipeDirection
|
|
513
|
-
}
|
|
505
|
+
};
|
|
514
506
|
const element = (0, _useRenderElement.useRenderElement)('div', componentProps, {
|
|
515
507
|
ref: [forwardedRef, toastRoot.rootRef],
|
|
516
508
|
state,
|
package/toast/store.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ReactStore } from '@base-ui/utils/store';
|
|
2
|
+
import { ToastManagerAddOptions, ToastManagerPromiseOptions, ToastManagerUpdateOptions, ToastObject } from "./useToastManager.js";
|
|
3
|
+
type ToastInternalUpdateOptions<Data extends object> = Partial<Omit<ToastObject<Data>, 'id'>>;
|
|
4
|
+
export type State = {
|
|
5
|
+
toasts: ToastObject<any>[];
|
|
6
|
+
hovering: boolean;
|
|
7
|
+
focused: boolean;
|
|
8
|
+
timeout: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
isWindowFocused: boolean;
|
|
11
|
+
viewport: HTMLElement | null;
|
|
12
|
+
prevFocusElement: HTMLElement | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const selectors: {
|
|
15
|
+
toasts: (state: State) => ToastObject<any>[];
|
|
16
|
+
isEmpty: (state: State) => boolean;
|
|
17
|
+
toast: (args_0: State, id: string) => ToastObject<any> | undefined;
|
|
18
|
+
toastIndex: (args_0: State, id: string) => number;
|
|
19
|
+
toastOffsetY: (args_0: State, id: string) => number;
|
|
20
|
+
toastVisibleIndex: (args_0: State, id: string) => number;
|
|
21
|
+
hovering: (state: State) => boolean;
|
|
22
|
+
focused: (state: State) => boolean;
|
|
23
|
+
expanded: (state: State) => boolean;
|
|
24
|
+
expandedOrOutOfFocus: (state: State) => boolean;
|
|
25
|
+
prevFocusElement: (state: State) => HTMLElement | null;
|
|
26
|
+
};
|
|
27
|
+
export declare class ToastStore extends ReactStore<State, {}, typeof selectors> {
|
|
28
|
+
private timers;
|
|
29
|
+
private areTimersPaused;
|
|
30
|
+
constructor(initialState: State);
|
|
31
|
+
setFocused(focused: boolean): void;
|
|
32
|
+
setHovering(hovering: boolean): void;
|
|
33
|
+
setIsWindowFocused(isWindowFocused: boolean): void;
|
|
34
|
+
setPrevFocusElement(prevFocusElement: HTMLElement | null): void;
|
|
35
|
+
setViewport: (viewport: HTMLElement | null) => void;
|
|
36
|
+
disposeEffect: () => () => void;
|
|
37
|
+
removeToast(toastId: string): void;
|
|
38
|
+
addToast: <Data extends object>(toast: ToastManagerAddOptions<Data>) => string;
|
|
39
|
+
updateToast: <Data extends object>(id: string, updates: ToastManagerUpdateOptions<Data>) => void;
|
|
40
|
+
updateToastInternal: <Data extends object>(id: string, updates: ToastInternalUpdateOptions<Data>) => void;
|
|
41
|
+
closeToast: (toastId: string) => void;
|
|
42
|
+
promiseToast: <Value, Data extends object>(promiseValue: Promise<Value>, options: ToastManagerPromiseOptions<Value, Data>) => Promise<Value>;
|
|
43
|
+
pauseTimers(): void;
|
|
44
|
+
resumeTimers(): void;
|
|
45
|
+
restoreFocusToPrevElement(): void;
|
|
46
|
+
handleDocumentPointerDown: (event: PointerEvent) => void;
|
|
47
|
+
private scheduleTimer;
|
|
48
|
+
private setToasts;
|
|
49
|
+
private handleFocusManagement;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
package/toast/store.js
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectors = exports.ToastStore = void 0;
|
|
7
|
+
var _store = require("@base-ui/utils/store");
|
|
8
|
+
var _generateId = require("@base-ui/utils/generateId");
|
|
9
|
+
var _owner = require("@base-ui/utils/owner");
|
|
10
|
+
var _useTimeout = require("@base-ui/utils/useTimeout");
|
|
11
|
+
var _resolvePromiseOptions = require("./utils/resolvePromiseOptions");
|
|
12
|
+
var _utils = require("../floating-ui-react/utils");
|
|
13
|
+
var _focusVisible = require("./utils/focusVisible");
|
|
14
|
+
const toastMapSelector = (0, _store.createSelectorMemoized)(state => state.toasts, toasts => {
|
|
15
|
+
const map = new Map();
|
|
16
|
+
let visibleIndex = 0;
|
|
17
|
+
let offsetY = 0;
|
|
18
|
+
toasts.forEach((toast, toastIndex) => {
|
|
19
|
+
const isEnding = toast.transitionStatus === 'ending';
|
|
20
|
+
map.set(toast.id, {
|
|
21
|
+
value: toast,
|
|
22
|
+
domIndex: toastIndex,
|
|
23
|
+
visibleIndex: isEnding ? -1 : visibleIndex,
|
|
24
|
+
offsetY
|
|
25
|
+
});
|
|
26
|
+
offsetY += toast.height || 0;
|
|
27
|
+
if (!isEnding) {
|
|
28
|
+
visibleIndex += 1;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return map;
|
|
32
|
+
});
|
|
33
|
+
const selectors = exports.selectors = {
|
|
34
|
+
toasts: (0, _store.createSelector)(state => state.toasts),
|
|
35
|
+
isEmpty: (0, _store.createSelector)(state => state.toasts.length === 0),
|
|
36
|
+
toast: (0, _store.createSelector)(toastMapSelector, (toastMap, id) => toastMap.get(id)?.value),
|
|
37
|
+
toastIndex: (0, _store.createSelector)(toastMapSelector, (toastMap, id) => toastMap.get(id)?.domIndex ?? -1),
|
|
38
|
+
toastOffsetY: (0, _store.createSelector)(toastMapSelector, (toastMap, id) => toastMap.get(id)?.offsetY ?? 0),
|
|
39
|
+
toastVisibleIndex: (0, _store.createSelector)(toastMapSelector, (toastMap, id) => toastMap.get(id)?.visibleIndex ?? -1),
|
|
40
|
+
hovering: (0, _store.createSelector)(state => state.hovering),
|
|
41
|
+
focused: (0, _store.createSelector)(state => state.focused),
|
|
42
|
+
expanded: (0, _store.createSelector)(state => state.hovering || state.focused),
|
|
43
|
+
expandedOrOutOfFocus: (0, _store.createSelector)(state => state.hovering || state.focused || !state.isWindowFocused),
|
|
44
|
+
prevFocusElement: (0, _store.createSelector)(state => state.prevFocusElement)
|
|
45
|
+
};
|
|
46
|
+
class ToastStore extends _store.ReactStore {
|
|
47
|
+
timers = new Map();
|
|
48
|
+
areTimersPaused = false;
|
|
49
|
+
constructor(initialState) {
|
|
50
|
+
super(initialState, {}, selectors);
|
|
51
|
+
}
|
|
52
|
+
setFocused(focused) {
|
|
53
|
+
this.set('focused', focused);
|
|
54
|
+
}
|
|
55
|
+
setHovering(hovering) {
|
|
56
|
+
this.set('hovering', hovering);
|
|
57
|
+
}
|
|
58
|
+
setIsWindowFocused(isWindowFocused) {
|
|
59
|
+
this.set('isWindowFocused', isWindowFocused);
|
|
60
|
+
}
|
|
61
|
+
setPrevFocusElement(prevFocusElement) {
|
|
62
|
+
this.set('prevFocusElement', prevFocusElement);
|
|
63
|
+
}
|
|
64
|
+
setViewport = viewport => {
|
|
65
|
+
this.set('viewport', viewport);
|
|
66
|
+
};
|
|
67
|
+
disposeEffect = () => {
|
|
68
|
+
return () => {
|
|
69
|
+
this.timers.forEach(timer => {
|
|
70
|
+
timer.timeout?.clear();
|
|
71
|
+
});
|
|
72
|
+
this.timers.clear();
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
removeToast(toastId) {
|
|
76
|
+
const index = selectors.toastIndex(this.state, toastId);
|
|
77
|
+
if (index === -1) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const toast = this.state.toasts[index];
|
|
81
|
+
toast?.onRemove?.();
|
|
82
|
+
const newToasts = [...this.state.toasts];
|
|
83
|
+
newToasts.splice(index, 1);
|
|
84
|
+
this.setToasts(newToasts);
|
|
85
|
+
}
|
|
86
|
+
addToast = toast => {
|
|
87
|
+
const {
|
|
88
|
+
toasts,
|
|
89
|
+
timeout,
|
|
90
|
+
limit
|
|
91
|
+
} = this.state;
|
|
92
|
+
const id = toast.id || (0, _generateId.generateId)('toast');
|
|
93
|
+
const toastToAdd = {
|
|
94
|
+
...toast,
|
|
95
|
+
id,
|
|
96
|
+
transitionStatus: 'starting'
|
|
97
|
+
};
|
|
98
|
+
const updatedToasts = [toastToAdd, ...toasts];
|
|
99
|
+
const activeToasts = updatedToasts.filter(t => t.transitionStatus !== 'ending');
|
|
100
|
+
|
|
101
|
+
// Mark oldest toasts for removal when over limit
|
|
102
|
+
if (activeToasts.length > limit) {
|
|
103
|
+
const excessCount = activeToasts.length - limit;
|
|
104
|
+
const oldestActiveToasts = activeToasts.slice(-excessCount);
|
|
105
|
+
const limitedIds = new Set(oldestActiveToasts.map(t => t.id));
|
|
106
|
+
this.setToasts(updatedToasts.map(t => {
|
|
107
|
+
const limited = limitedIds.has(t.id);
|
|
108
|
+
if (t.limited !== limited) {
|
|
109
|
+
return {
|
|
110
|
+
...t,
|
|
111
|
+
limited
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return t;
|
|
115
|
+
}));
|
|
116
|
+
} else {
|
|
117
|
+
this.setToasts(updatedToasts.map(t => t.limited ? {
|
|
118
|
+
...t,
|
|
119
|
+
limited: false
|
|
120
|
+
} : t));
|
|
121
|
+
}
|
|
122
|
+
const duration = toastToAdd.timeout ?? timeout;
|
|
123
|
+
if (toastToAdd.type !== 'loading' && duration > 0) {
|
|
124
|
+
this.scheduleTimer(id, duration, () => this.closeToast(id));
|
|
125
|
+
}
|
|
126
|
+
if (selectors.expandedOrOutOfFocus(this.state)) {
|
|
127
|
+
this.pauseTimers();
|
|
128
|
+
}
|
|
129
|
+
return id;
|
|
130
|
+
};
|
|
131
|
+
updateToast = (id, updates) => {
|
|
132
|
+
this.updateToastInternal(id, updates);
|
|
133
|
+
};
|
|
134
|
+
updateToastInternal = (id, updates) => {
|
|
135
|
+
const {
|
|
136
|
+
timeout,
|
|
137
|
+
toasts
|
|
138
|
+
} = this.state;
|
|
139
|
+
const prevToast = selectors.toast(this.state, id) ?? null;
|
|
140
|
+
if (!prevToast) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Ignore updates for toasts that are already closing.
|
|
145
|
+
// This prevents races where async updates (e.g. promise success/error)
|
|
146
|
+
// can block a dismissal from completing.
|
|
147
|
+
if (prevToast.transitionStatus === 'ending') {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const nextToast = {
|
|
151
|
+
...prevToast,
|
|
152
|
+
...updates
|
|
153
|
+
};
|
|
154
|
+
this.setToasts(toasts.map(toast => toast.id === id ? {
|
|
155
|
+
...toast,
|
|
156
|
+
...updates
|
|
157
|
+
} : toast));
|
|
158
|
+
const nextTimeout = nextToast.timeout ?? timeout;
|
|
159
|
+
const prevTimeout = prevToast?.timeout ?? timeout;
|
|
160
|
+
const timeoutUpdated = Object.hasOwn(updates, 'timeout');
|
|
161
|
+
const shouldHaveTimer = nextToast.transitionStatus !== 'ending' && nextToast.type !== 'loading' && nextTimeout > 0;
|
|
162
|
+
const hasTimer = this.timers.has(id);
|
|
163
|
+
const timeoutChanged = prevTimeout !== nextTimeout;
|
|
164
|
+
const wasLoading = prevToast?.type === 'loading';
|
|
165
|
+
if (!shouldHaveTimer && hasTimer) {
|
|
166
|
+
const timer = this.timers.get(id);
|
|
167
|
+
timer?.timeout?.clear();
|
|
168
|
+
this.timers.delete(id);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Schedule or reschedule timer if needed
|
|
173
|
+
if (shouldHaveTimer && (!hasTimer || timeoutChanged || timeoutUpdated || wasLoading)) {
|
|
174
|
+
const timer = this.timers.get(id);
|
|
175
|
+
if (timer) {
|
|
176
|
+
timer.timeout?.clear();
|
|
177
|
+
this.timers.delete(id);
|
|
178
|
+
}
|
|
179
|
+
this.scheduleTimer(id, nextTimeout, () => this.closeToast(id));
|
|
180
|
+
if (selectors.expandedOrOutOfFocus(this.state)) {
|
|
181
|
+
this.pauseTimers();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
closeToast = toastId => {
|
|
186
|
+
const toast = selectors.toast(this.state, toastId);
|
|
187
|
+
toast?.onClose?.();
|
|
188
|
+
const {
|
|
189
|
+
limit,
|
|
190
|
+
toasts
|
|
191
|
+
} = this.state;
|
|
192
|
+
let activeIndex = 0;
|
|
193
|
+
const newToasts = toasts.map(item => {
|
|
194
|
+
if (item.id === toastId) {
|
|
195
|
+
return {
|
|
196
|
+
...item,
|
|
197
|
+
transitionStatus: 'ending',
|
|
198
|
+
height: 0
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (item.transitionStatus === 'ending') {
|
|
202
|
+
return item;
|
|
203
|
+
}
|
|
204
|
+
const isLimited = activeIndex >= limit;
|
|
205
|
+
activeIndex += 1;
|
|
206
|
+
return item.limited !== isLimited ? {
|
|
207
|
+
...item,
|
|
208
|
+
limited: isLimited
|
|
209
|
+
} : item;
|
|
210
|
+
});
|
|
211
|
+
const timer = this.timers.get(toastId);
|
|
212
|
+
if (timer && timer.timeout) {
|
|
213
|
+
timer.timeout.clear();
|
|
214
|
+
this.timers.delete(toastId);
|
|
215
|
+
}
|
|
216
|
+
this.handleFocusManagement(toastId);
|
|
217
|
+
this.setToasts(newToasts);
|
|
218
|
+
};
|
|
219
|
+
promiseToast = (promiseValue, options) => {
|
|
220
|
+
// Create a loading toast (which does not auto-dismiss).
|
|
221
|
+
const loadingOptions = (0, _resolvePromiseOptions.resolvePromiseOptions)(options.loading);
|
|
222
|
+
const id = this.addToast({
|
|
223
|
+
...loadingOptions,
|
|
224
|
+
type: 'loading'
|
|
225
|
+
});
|
|
226
|
+
const handledPromise = promiseValue.then(result => {
|
|
227
|
+
const successOptions = (0, _resolvePromiseOptions.resolvePromiseOptions)(options.success, result);
|
|
228
|
+
this.updateToast(id, {
|
|
229
|
+
...successOptions,
|
|
230
|
+
type: 'success',
|
|
231
|
+
timeout: successOptions.timeout
|
|
232
|
+
});
|
|
233
|
+
return result;
|
|
234
|
+
}).catch(error => {
|
|
235
|
+
const errorOptions = (0, _resolvePromiseOptions.resolvePromiseOptions)(options.error, error);
|
|
236
|
+
this.updateToast(id, {
|
|
237
|
+
...errorOptions,
|
|
238
|
+
type: 'error',
|
|
239
|
+
timeout: errorOptions.timeout
|
|
240
|
+
});
|
|
241
|
+
return Promise.reject(error);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Private API used exclusively by `Manager` to handoff the promise
|
|
245
|
+
// back to the manager after it's handled here.
|
|
246
|
+
if ({}.hasOwnProperty.call(options, 'setPromise')) {
|
|
247
|
+
options.setPromise(handledPromise);
|
|
248
|
+
}
|
|
249
|
+
return handledPromise;
|
|
250
|
+
};
|
|
251
|
+
pauseTimers() {
|
|
252
|
+
if (this.areTimersPaused) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
this.areTimersPaused = true;
|
|
256
|
+
this.timers.forEach(timer => {
|
|
257
|
+
if (timer.timeout) {
|
|
258
|
+
timer.timeout.clear();
|
|
259
|
+
const elapsed = Date.now() - timer.start;
|
|
260
|
+
const remaining = timer.delay - elapsed;
|
|
261
|
+
timer.remaining = remaining > 0 ? remaining : 0;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
resumeTimers() {
|
|
266
|
+
if (!this.areTimersPaused) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
this.areTimersPaused = false;
|
|
270
|
+
this.timers.forEach((timer, id) => {
|
|
271
|
+
timer.remaining = timer.remaining > 0 ? timer.remaining : timer.delay;
|
|
272
|
+
timer.timeout ??= _useTimeout.Timeout.create();
|
|
273
|
+
timer.timeout.start(timer.remaining, () => {
|
|
274
|
+
this.timers.delete(id);
|
|
275
|
+
timer.callback();
|
|
276
|
+
});
|
|
277
|
+
timer.start = Date.now();
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
restoreFocusToPrevElement() {
|
|
281
|
+
this.state.prevFocusElement?.focus({
|
|
282
|
+
preventScroll: true
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
handleDocumentPointerDown = event => {
|
|
286
|
+
if (event.pointerType !== 'touch') {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const target = (0, _utils.getTarget)(event);
|
|
290
|
+
if ((0, _utils.contains)(this.state.viewport, target)) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
this.resumeTimers();
|
|
294
|
+
this.update({
|
|
295
|
+
hovering: false,
|
|
296
|
+
focused: false
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
scheduleTimer(id, delay, callback) {
|
|
300
|
+
const start = Date.now();
|
|
301
|
+
const shouldStartActive = !selectors.expandedOrOutOfFocus(this.state);
|
|
302
|
+
const currentTimeout = shouldStartActive ? _useTimeout.Timeout.create() : undefined;
|
|
303
|
+
currentTimeout?.start(delay, () => {
|
|
304
|
+
this.timers.delete(id);
|
|
305
|
+
callback();
|
|
306
|
+
});
|
|
307
|
+
this.timers.set(id, {
|
|
308
|
+
timeout: currentTimeout,
|
|
309
|
+
start: shouldStartActive ? start : 0,
|
|
310
|
+
delay,
|
|
311
|
+
remaining: delay,
|
|
312
|
+
callback
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
setToasts(newToasts) {
|
|
316
|
+
const updates = {
|
|
317
|
+
toasts: newToasts
|
|
318
|
+
};
|
|
319
|
+
if (newToasts.length === 0) {
|
|
320
|
+
updates.hovering = false;
|
|
321
|
+
updates.focused = false;
|
|
322
|
+
}
|
|
323
|
+
this.update(updates);
|
|
324
|
+
}
|
|
325
|
+
handleFocusManagement(toastId) {
|
|
326
|
+
const activeEl = (0, _utils.activeElement)((0, _owner.ownerDocument)(this.state.viewport));
|
|
327
|
+
if (!this.state.viewport || !(0, _utils.contains)(this.state.viewport, activeEl) || !(0, _focusVisible.isFocusVisible)(activeEl)) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const toasts = selectors.toasts(this.state);
|
|
331
|
+
const currentIndex = selectors.toastIndex(this.state, toastId);
|
|
332
|
+
let nextToast = null;
|
|
333
|
+
|
|
334
|
+
// Try to find the next toast that isn't animating out
|
|
335
|
+
let index = currentIndex + 1;
|
|
336
|
+
while (index < toasts.length) {
|
|
337
|
+
if (toasts[index].transitionStatus !== 'ending') {
|
|
338
|
+
nextToast = toasts[index];
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
index += 1;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Go backwards if no next toast is found
|
|
345
|
+
if (!nextToast) {
|
|
346
|
+
index = currentIndex - 1;
|
|
347
|
+
while (index >= 0) {
|
|
348
|
+
if (toasts[index].transitionStatus !== 'ending') {
|
|
349
|
+
nextToast = toasts[index];
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
index -= 1;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (nextToast) {
|
|
356
|
+
nextToast.ref?.current?.focus();
|
|
357
|
+
} else {
|
|
358
|
+
this.restoreFocusToPrevElement();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
exports.ToastStore = ToastStore;
|
|
@@ -26,14 +26,12 @@ const ToastTitle = exports.ToastTitle = /*#__PURE__*/React.forwardRef(function T
|
|
|
26
26
|
...elementProps
|
|
27
27
|
} = componentProps;
|
|
28
28
|
const {
|
|
29
|
-
toast
|
|
29
|
+
toast,
|
|
30
|
+
setTitleId
|
|
30
31
|
} = (0, _ToastRootContext.useToastRootContext)();
|
|
31
32
|
const children = childrenProp ?? toast.title;
|
|
32
33
|
const shouldRender = Boolean(children);
|
|
33
34
|
const id = (0, _useId.useId)(idProp);
|
|
34
|
-
const {
|
|
35
|
-
setTitleId
|
|
36
|
-
} = (0, _ToastRootContext.useToastRootContext)();
|
|
37
35
|
(0, _useIsoLayoutEffect.useIsoLayoutEffect)(() => {
|
|
38
36
|
if (!shouldRender) {
|
|
39
37
|
return undefined;
|
|
@@ -43,9 +41,9 @@ const ToastTitle = exports.ToastTitle = /*#__PURE__*/React.forwardRef(function T
|
|
|
43
41
|
setTitleId(undefined);
|
|
44
42
|
};
|
|
45
43
|
}, [shouldRender, id, setTitleId]);
|
|
46
|
-
const state =
|
|
44
|
+
const state = {
|
|
47
45
|
type: toast.type
|
|
48
|
-
}
|
|
46
|
+
};
|
|
49
47
|
const element = (0, _useRenderElement.useRenderElement)('h2', componentProps, {
|
|
50
48
|
ref: forwardedRef,
|
|
51
49
|
state,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ToastContext } from "./provider/ToastProviderContext.js";
|
|
3
2
|
import type { ToastPositionerProps } from "./positioner/ToastPositioner.js";
|
|
4
3
|
/**
|
|
5
4
|
* Returns the array of toasts and methods to manage them.
|
|
6
5
|
*/
|
|
7
|
-
export declare function useToastManager(): UseToastManagerReturnValue
|
|
6
|
+
export declare function useToastManager<Data extends object = any>(): UseToastManagerReturnValue<Data>;
|
|
8
7
|
export interface ToastObject<Data extends object> {
|
|
9
8
|
/**
|
|
10
9
|
* The unique identifier for the toast.
|
|
@@ -13,7 +12,7 @@ export interface ToastObject<Data extends object> {
|
|
|
13
12
|
/**
|
|
14
13
|
* The ref for the toast.
|
|
15
14
|
*/
|
|
16
|
-
ref?: React.RefObject<HTMLElement | null
|
|
15
|
+
ref?: React.RefObject<HTMLElement | null> | undefined;
|
|
17
16
|
/**
|
|
18
17
|
* The title of the toast.
|
|
19
18
|
*/
|
|
@@ -22,7 +21,7 @@ export interface ToastObject<Data extends object> {
|
|
|
22
21
|
* The type of the toast. Used to conditionally style the toast,
|
|
23
22
|
* including conditionally rendering elements based on the type.
|
|
24
23
|
*/
|
|
25
|
-
type?: string;
|
|
24
|
+
type?: string | undefined;
|
|
26
25
|
/**
|
|
27
26
|
* The description of the toast.
|
|
28
27
|
*/
|
|
@@ -32,14 +31,14 @@ export interface ToastObject<Data extends object> {
|
|
|
32
31
|
* A value of `0` will prevent the toast from being dismissed automatically.
|
|
33
32
|
* @default 5000
|
|
34
33
|
*/
|
|
35
|
-
timeout?: number;
|
|
34
|
+
timeout?: number | undefined;
|
|
36
35
|
/**
|
|
37
36
|
* The priority of the toast.
|
|
38
37
|
* - `low` - The toast will be announced politely.
|
|
39
38
|
* - `high` - The toast will be announced urgently.
|
|
40
39
|
* @default 'low'
|
|
41
40
|
*/
|
|
42
|
-
priority?: 'low' | 'high';
|
|
41
|
+
priority?: ('low' | 'high') | undefined;
|
|
43
42
|
/**
|
|
44
43
|
* The transition status of the toast.
|
|
45
44
|
*/
|
|
@@ -47,49 +46,49 @@ export interface ToastObject<Data extends object> {
|
|
|
47
46
|
/**
|
|
48
47
|
* Determines if the toast was closed due to the limit being reached.
|
|
49
48
|
*/
|
|
50
|
-
limited?: boolean;
|
|
49
|
+
limited?: boolean | undefined;
|
|
51
50
|
/**
|
|
52
51
|
* The height of the toast.
|
|
53
52
|
*/
|
|
54
|
-
height?: number;
|
|
53
|
+
height?: number | undefined;
|
|
55
54
|
/**
|
|
56
55
|
* Callback function to be called when the toast is closed.
|
|
57
56
|
*/
|
|
58
|
-
onClose?: () => void;
|
|
57
|
+
onClose?: (() => void) | undefined;
|
|
59
58
|
/**
|
|
60
59
|
* Callback function to be called when the toast is removed from the list after any animations are complete when closed.
|
|
61
60
|
*/
|
|
62
|
-
onRemove?: () => void;
|
|
61
|
+
onRemove?: (() => void) | undefined;
|
|
63
62
|
/**
|
|
64
63
|
* The props for the action button.
|
|
65
64
|
*/
|
|
66
|
-
actionProps?: React.ComponentPropsWithoutRef<'button'
|
|
65
|
+
actionProps?: React.ComponentPropsWithoutRef<'button'> | undefined;
|
|
67
66
|
/**
|
|
68
67
|
* The props forwarded to the toast positioner element when rendering anchored toasts.
|
|
69
68
|
*/
|
|
70
|
-
positionerProps?: ToastManagerPositionerProps;
|
|
69
|
+
positionerProps?: ToastManagerPositionerProps | undefined;
|
|
71
70
|
/**
|
|
72
71
|
* Custom data for the toast.
|
|
73
72
|
*/
|
|
74
|
-
data?: Data;
|
|
73
|
+
data?: Data | undefined;
|
|
75
74
|
}
|
|
76
75
|
export interface ToastManagerPositionerProps extends Omit<ToastPositionerProps, 'anchor' | 'toast'> {
|
|
77
76
|
/**
|
|
78
77
|
* An element to position the toast against.
|
|
79
78
|
*/
|
|
80
|
-
anchor?: Element | null;
|
|
79
|
+
anchor?: (Element | null) | undefined;
|
|
81
80
|
}
|
|
82
|
-
export interface UseToastManagerReturnValue {
|
|
83
|
-
toasts:
|
|
84
|
-
add: <
|
|
81
|
+
export interface UseToastManagerReturnValue<Data extends object = any> {
|
|
82
|
+
toasts: ToastObject<Data>[];
|
|
83
|
+
add: <T extends Data = Data>(options: ToastManagerAddOptions<T>) => string;
|
|
85
84
|
close: (toastId: string) => void;
|
|
86
|
-
update: <
|
|
87
|
-
promise: <Value,
|
|
85
|
+
update: <T extends Data = Data>(toastId: string, options: ToastManagerUpdateOptions<T>) => void;
|
|
86
|
+
promise: <Value, T extends Data = Data>(promise: Promise<Value>, options: ToastManagerPromiseOptions<Value, T>) => Promise<Value>;
|
|
88
87
|
}
|
|
89
88
|
export interface ToastManagerAddOptions<Data extends object> extends Omit<ToastObject<Data>, 'id' | 'animation' | 'height' | 'ref' | 'limited'> {
|
|
90
|
-
id?: string;
|
|
89
|
+
id?: string | undefined;
|
|
91
90
|
}
|
|
92
|
-
export interface ToastManagerUpdateOptions<Data extends object> extends Partial<
|
|
91
|
+
export interface ToastManagerUpdateOptions<Data extends object> extends Partial<Omit<ToastObject<Data>, 'id' | 'ref' | 'height' | 'transitionStatus' | 'limited'>> {}
|
|
93
92
|
export interface ToastManagerPromiseOptions<Value, Data extends object> {
|
|
94
93
|
loading: string | ToastManagerUpdateOptions<Data>;
|
|
95
94
|
success: string | ToastManagerUpdateOptions<Data> | ((result: Value) => string | ToastManagerUpdateOptions<Data>);
|