@astryxdesign/core 0.7.8 → 0.7.9-canary.0200dfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +9 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +37 -3
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +40 -8
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +4 -3
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +61 -21
- package/dist/Calendar/Calendar.d.ts +14 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +63 -74
- package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
- package/dist/Calendar/getInitialFocusDate.js +7 -5
- package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +57 -64
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
- package/dist/Calendar/styles.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +74 -18
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts +2 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.js +20 -0
- package/dist/CheckboxList/CheckboxListItem.d.ts +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +40 -14
- package/dist/ClickableCard/ClickableCard.d.ts +1 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +5 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +2 -0
- package/dist/DateInput/DateInput.d.ts +37 -6
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +97 -124
- package/dist/DateInput/MonthScroller.d.ts +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +26 -29
- package/dist/DateInput/MonthYearWheels.d.ts +10 -1
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -1
- package/dist/DateInput/MonthYearWheels.js +54 -42
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +7 -1
- package/dist/DateInput/TouchDateField.d.ts +1 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +26 -21
- package/dist/DateInput/monthGeometry.d.ts +42 -8
- package/dist/DateInput/monthGeometry.d.ts.map +1 -1
- package/dist/DateInput/monthGeometry.js +81 -7
- package/dist/DateInput/useCalendarPresentation.d.ts +10 -0
- package/dist/DateInput/useCalendarPresentation.d.ts.map +1 -0
- package/dist/DateInput/useCalendarPresentation.js +32 -0
- package/dist/DateInput/useTypedDate.d.ts +92 -0
- package/dist/DateInput/useTypedDate.d.ts.map +1 -0
- package/dist/DateInput/useTypedDate.js +269 -0
- package/dist/DateInput/wheelStrip.js +2 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts +17 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +15 -8
- package/dist/DateTimeInput/DateTimeInput.d.ts +26 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +92 -88
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +26 -20
- package/dist/Dialog/Dialog.d.ts +2 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +14 -3
- package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +11 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +11 -8
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -4
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +16 -2
- package/dist/HoverCard/useHoverCard.d.ts +3 -1
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts +1 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +6 -18
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +2 -2
- package/dist/InputGroup/InputGroupText.d.ts +2 -1
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -1
- package/dist/InputGroup/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +1 -1
- package/dist/Item/Item.d.ts +20 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +97 -29
- package/dist/Item/ItemListRowContext.d.ts +2 -0
- package/dist/Item/ItemListRowContext.d.ts.map +1 -0
- package/dist/Item/ItemListRowContext.js +16 -0
- package/dist/Layer/holdEntranceInput.d.ts +24 -0
- package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
- package/dist/Layer/holdEntranceInput.js +65 -0
- package/dist/Layer/inputHold.d.ts +49 -0
- package/dist/Layer/inputHold.d.ts.map +1 -0
- package/dist/Layer/inputHold.js +636 -0
- package/dist/Layer/outsidePress.d.ts +4 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +18 -1
- package/dist/Layer/preserveAnimations.d.ts +1 -5
- package/dist/Layer/preserveAnimations.d.ts.map +1 -1
- package/dist/Layer/preserveAnimations.js +12 -214
- package/dist/Layer/useBackdropPress.d.ts +8 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -1
- package/dist/Layer/useBackdropPress.js +31 -2
- package/dist/Layer/useLayer.d.ts +3 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -4
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +4 -0
- package/dist/Layout/LayoutContent.d.ts +3 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +12 -4
- package/dist/Layout/LayoutPanel.d.ts +13 -10
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +81 -11
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -0
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +1 -0
- package/dist/List/ListItem.d.ts +5 -4
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +45 -9
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +56 -39
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +11 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +39 -1
- package/dist/MoreMenu/MoreMenu.d.ts +5 -3
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -9
- package/dist/NumberInput/NumberInput.d.ts +4 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +244 -11
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +7 -2
- package/dist/Popover/usePopover.d.ts +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +12 -5
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +14 -11
- package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +6 -3
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +16 -3
- package/dist/Resizable/ResizeHandle.d.ts +5 -5
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +44 -5
- package/dist/Resizable/resizablePane.d.ts +58 -0
- package/dist/Resizable/resizablePane.d.ts.map +1 -0
- package/dist/Resizable/resizablePane.js +137 -0
- package/dist/Resizable/useResizable.d.ts +7 -0
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +13 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/SelectableCard/SelectableCard.d.ts +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +5 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +51 -10
- package/dist/SideNav/SideNav.d.ts +9 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +45 -10
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +14 -71
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.d.ts.map +1 -1
- package/dist/Spinner/spinnerRotor.d.ts +28 -0
- package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
- package/dist/Spinner/spinnerRotor.js +98 -0
- package/dist/Stack/StackItem.d.ts +8 -4
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +17 -4
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +13 -10
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -8
- package/dist/Timestamp/formatInstant.d.ts +10 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +13 -27
- package/dist/Timestamp/tooltipEntries.d.ts +5 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +6 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +9 -0
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +4 -1
- package/dist/Tokenizer/Tokenizer.d.ts +14 -10
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +189 -89
- package/dist/Tooltip/useTooltip.d.ts +3 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +164 -59
- package/dist/TreeList/TreeListItem.d.ts +2 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -3
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -1
- package/dist/animator/createAnimator.js +2 -2
- package/dist/astryx.css +362 -325
- package/dist/gestures/GestureHost.d.ts +2 -2
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +21 -6
- package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PanGestureRecognizer.js +15 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.d.ts +3 -6
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +7 -52
- package/dist/gestures/wheelSegmenter.d.ts +68 -1
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +199 -10
- package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
- package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
- package/dist/hooks/StackItemScrollRegion.js +40 -0
- package/dist/hooks/computeOverflow.d.ts +2 -0
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +1 -1
- package/dist/hooks/menuPressGesture.d.ts +133 -21
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +155 -30
- package/dist/hooks/menuPressValues.d.ts +16 -0
- package/dist/hooks/menuPressValues.d.ts.map +1 -0
- package/dist/hooks/menuPressValues.js +18 -0
- package/dist/hooks/useClickableContainer.d.ts +36 -7
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +63 -14
- package/dist/hooks/useFocusTrap.d.ts +10 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +225 -132
- package/dist/hooks/useKeyboardHighlight.d.ts +17 -0
- package/dist/hooks/useKeyboardHighlight.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHighlight.js +38 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +37 -12
- package/dist/hooks/useMenuPress.d.ts +34 -1
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +93 -5
- package/dist/hooks/useOverflow.d.ts +10 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +214 -23
- package/dist/hooks/usePressFeedback.d.ts +6 -6
- package/dist/hooks/usePressFeedback.js +6 -6
- package/dist/hooks/useScrollRegionProps.d.ts +35 -0
- package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
- package/dist/hooks/useScrollRegionProps.js +51 -0
- package/dist/i18n/InternationalizationContext.d.ts +6 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.d.ts +23 -3
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +8 -3
- package/dist/i18n/generated-english/DateInput/DateInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/DateInput.generated.js +0 -1
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts +8 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.js +16 -0
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.js +0 -1
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/useCalendarSystem.d.ts +19 -0
- package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
- package/dist/i18n/useCalendarSystem.js +61 -0
- package/dist/internal/calendar-system.d.ts +18 -0
- package/dist/internal/calendar-system.d.ts.map +1 -0
- package/dist/internal/calendar-system.js +19 -0
- package/dist/internal/spinner-rotor.d.ts +16 -0
- package/dist/internal/spinner-rotor.d.ts.map +1 -0
- package/dist/internal/spinner-rotor.js +16 -0
- package/dist/internal/touch.d.ts +20 -2
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +29 -3
- package/dist/motion/animator.d.ts +5 -5
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +7 -6
- package/dist/motion/carryAnimations.d.ts +58 -0
- package/dist/motion/carryAnimations.d.ts.map +1 -0
- package/dist/motion/carryAnimations.js +305 -0
- package/dist/motion/transientCopy.d.ts +4 -2
- package/dist/motion/transientCopy.d.ts.map +1 -1
- package/dist/motion/transientCopy.js +34 -5
- package/dist/motion/uikit/gestures.d.ts +41 -0
- package/dist/motion/uikit/gestures.d.ts.map +1 -1
- package/dist/motion/uikit/gestures.js +25 -0
- package/dist/motion/uikit/index.d.ts +1 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +1 -1
- package/dist/motion/uikit/timing.d.ts +14 -10
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +7 -5
- package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
- package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
- package/dist/privateAttributes/press.stylex.d.ts +142 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/press.stylex.js +101 -0
- package/dist/theme/themeMotion.d.ts +3 -2
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +3 -2
- package/dist/theme/tokens.stylex.d.ts +2 -2
- package/dist/theme/tokens.stylex.js +1 -1
- package/dist/utils/calendarDateParser.d.ts +110 -0
- package/dist/utils/calendarDateParser.d.ts.map +1 -0
- package/dist/utils/calendarDateParser.js +1225 -0
- package/dist/utils/calendarSystem.d.ts +176 -0
- package/dist/utils/calendarSystem.d.ts.map +1 -0
- package/dist/utils/calendarSystem.js +569 -0
- package/dist/utils/coarsePointer.d.ts +5 -0
- package/dist/utils/coarsePointer.d.ts.map +1 -1
- package/dist/utils/coarsePointer.js +22 -13
- package/dist/utils/flatTree.d.ts +6 -3
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +13 -3
- package/dist/utils/focusReturn.d.ts +34 -13
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +64 -17
- package/dist/utils/hitArea.d.ts +8 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +99 -9
- package/dist/utils/inputPresentation.d.ts +9 -1
- package/dist/utils/inputPresentation.d.ts.map +1 -1
- package/dist/utils/inputPresentation.js +15 -1
- package/dist/utils/inputStream.d.ts +14 -1
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +40 -9
- package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +29 -31
- package/dist/utils/plainDate.d.ts +38 -7
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +92 -18
- package/dist/utils/pressFeedback.d.ts +10 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +40 -15
- package/dist/utils/pressGesture.d.ts +12 -6
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +26 -8
- package/dist/utils/scrollView.d.ts +25 -0
- package/dist/utils/scrollView.d.ts.map +1 -0
- package/dist/utils/scrollView.js +108 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +1 -10
- package/dist/utils/touchHitArea.d.ts +30 -0
- package/dist/utils/touchHitArea.d.ts.map +1 -0
- package/dist/utils/touchHitArea.js +167 -0
- package/dist/utils/touchHitArea.stylex.d.ts +38 -0
- package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
- package/dist/utils/touchHitArea.stylex.js +48 -0
- package/dist/utils/triggerFocus.d.ts +5 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -1
- package/dist/utils/triggerFocus.js +9 -2
- package/locales/en.json +21 -1
- package/locales/pseudo.json +15 -0
- package/package.json +15 -4
- package/src/AppShell/observeMainOverflow.ts +9 -6
- package/src/BottomSheet/BottomSheet.tsx +45 -3
- package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
- package/src/BottomSheet/bottomSheetStack.ts +4 -3
- package/src/BottomSheet/useSheetGestures.ts +83 -20
- package/src/Calendar/Calendar.doc.mjs +76 -6
- package/src/Calendar/Calendar.tsx +123 -104
- package/src/Calendar/getInitialFocusDate.ts +22 -8
- package/src/Calendar/hooks/useCalendarDays.ts +89 -63
- package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +5 -4
- package/src/CheckboxInput/CheckboxInput.tsx +105 -20
- package/src/CheckboxInput/CheckboxRowPressContext.ts +22 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/CheckboxList/CheckboxListItem.tsx +35 -14
- package/src/ClickableCard/ClickableCard.tsx +8 -1
- package/src/ContextMenu/ContextMenu.tsx +2 -0
- package/src/DateInput/DateInput.doc.mjs +45 -12
- package/src/DateInput/DateInput.tsx +165 -179
- package/src/DateInput/MonthScroller.tsx +39 -37
- package/src/DateInput/MonthYearWheels.tsx +68 -47
- package/src/DateInput/PickerWheel.tsx +7 -2
- package/src/DateInput/TouchDateField.tsx +45 -17
- package/src/DateInput/monthGeometry.ts +110 -8
- package/src/DateInput/useCalendarPresentation.ts +64 -0
- package/src/DateInput/useTypedDate.ts +469 -0
- package/src/DateInput/wheelStrip.ts +2 -2
- package/src/DateRangeInput/DateRangeInput.doc.mjs +9 -0
- package/src/DateRangeInput/DateRangeInput.tsx +43 -9
- package/src/DateTimeInput/DateTimeInput.doc.mjs +42 -9
- package/src/DateTimeInput/DateTimeInput.tsx +138 -148
- package/src/DateTimeInput/TouchDateTimeField.tsx +31 -16
- package/src/Dialog/Dialog.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +14 -2
- package/src/Drawer/Drawer.doc.mjs +1 -1
- package/src/Drawer/useDrawerDialogPresence.ts +9 -2
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
- package/src/DropdownMenu/DropdownMenu.tsx +31 -7
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
- package/src/FileInput/FileInput.tsx +16 -2
- package/src/HoverCard/useHoverCard.tsx +3 -1
- package/src/Icon/useIcon.doc.mjs +94 -0
- package/src/InfoTip/InfoTip.doc.mjs +26 -2
- package/src/InfoTip/InfoTip.tsx +6 -27
- package/src/InputGroup/InputGroup.doc.mjs +4 -3
- package/src/InputGroup/InputGroup.tsx +4 -3
- package/src/InputGroup/InputGroupText.doc.mjs +45 -3
- package/src/InputGroup/InputGroupText.tsx +2 -1
- package/src/InputGroup/groupStyles.ts +3 -1
- package/src/Item/Item.tsx +139 -35
- package/src/Item/ItemListRowContext.tsx +18 -0
- package/src/Layer/holdEntranceInput.ts +84 -0
- package/src/Layer/inputHold.ts +734 -0
- package/src/Layer/outsidePress.ts +18 -1
- package/src/Layer/preserveAnimations.ts +12 -275
- package/src/Layer/useBackdropPress.ts +41 -1
- package/src/Layer/useLayer.tsx +77 -4
- package/src/Layer/useTouchTrigger.ts +4 -0
- package/src/Layout/LayoutContent.doc.mjs +6 -3
- package/src/Layout/LayoutContent.tsx +10 -4
- package/src/Layout/LayoutPanel.doc.mjs +14 -11
- package/src/Layout/LayoutPanel.tsx +113 -16
- package/src/Lightbox/Lightbox.tsx +4 -0
- package/src/List/List.doc.mjs +10 -1
- package/src/List/List.tsx +5 -0
- package/src/List/ListItem.tsx +63 -8
- package/src/Markdown/parser.ts +65 -42
- package/src/MetadataList/MetadataList.tsx +1 -1
- package/src/MobileNav/MobileNav.doc.mjs +3 -3
- package/src/MobileNav/MobileNav.tsx +39 -1
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
- package/src/MoreMenu/MoreMenu.tsx +5 -3
- package/src/MultiSelector/MultiSelector.tsx +7 -17
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.tsx +259 -11
- package/src/OverflowList/OverflowList.tsx +15 -9
- package/src/Popover/usePopover.tsx +1 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/PowerSearch/PowerSearch.tsx +20 -3
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -11
- package/src/PowerSearch/formatTokenValue.ts +7 -1
- package/src/RadioList/RadioListItem.doc.mjs +3 -2
- package/src/RadioList/RadioListItem.tsx +16 -6
- package/src/Resizable/Resizable.doc.mjs +40 -12
- package/src/Resizable/ResizeHandle.tsx +68 -6
- package/src/Resizable/resizablePane.ts +179 -0
- package/src/Resizable/useResizable.ts +15 -0
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -1
- package/src/Selector/Selector.tsx +83 -8
- package/src/SideNav/SideNav.doc.mjs +2 -2
- package/src/SideNav/SideNav.tsx +87 -12
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +7 -89
- package/src/Spinner/index.ts +1 -5
- package/src/Spinner/spinnerRotor.ts +113 -0
- package/src/Stack/Stack.doc.mjs +1 -1
- package/src/Stack/StackItem.tsx +27 -13
- package/src/Switch/Switch.tsx +7 -6
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/TabList/Tab.tsx +5 -1
- package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
- package/src/Timestamp/Timestamp.doc.mjs +3 -3
- package/src/Timestamp/Timestamp.tsx +13 -8
- package/src/Timestamp/formatInstant.ts +49 -28
- package/src/Timestamp/tooltipEntries.ts +7 -3
- package/src/Token/Token.tsx +18 -1
- package/src/Token/TokenLink.tsx +7 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
- package/src/Tokenizer/Tokenizer.tsx +252 -115
- package/src/Tooltip/useTooltip.tsx +180 -80
- package/src/TreeList/TreeListItem.tsx +36 -2
- package/src/Typeahead/BaseTypeahead.tsx +2 -0
- package/src/animator/createAnimator.ts +3 -3
- package/src/gestures/GestureHost.ts +21 -5
- package/src/gestures/PanGestureRecognizer.ts +19 -2
- package/src/gestures/README.md +14 -5
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
- package/src/gestures/nativeScroll.ts +12 -68
- package/src/gestures/wheelSegmenter.ts +243 -10
- package/src/hooks/StackItemScrollRegion.tsx +57 -0
- package/src/hooks/computeOverflow.ts +1 -1
- package/src/hooks/menuPressGesture.ts +244 -38
- package/src/hooks/menuPressValues.ts +18 -0
- package/src/hooks/useClickableContainer.doc.mjs +8 -2
- package/src/hooks/useClickableContainer.ts +93 -15
- package/src/hooks/useFocusTrap.ts +268 -151
- package/src/hooks/useKeyboardHighlight.ts +71 -0
- package/src/hooks/useMediaQuery.ts +41 -12
- package/src/hooks/useMenuPress.ts +118 -11
- package/src/hooks/useOverflow.ts +321 -75
- package/src/hooks/usePressFeedback.doc.mjs +3 -3
- package/src/hooks/usePressFeedback.ts +6 -6
- package/src/hooks/useScrollRegionProps.ts +76 -0
- package/src/i18n/InternationalizationContext.ts +6 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
- package/src/i18n/InternationalizationProvider.tsx +35 -3
- package/src/i18n/generated-english/DateInput/DateInput.generated.ts +0 -1
- package/src/i18n/generated-english/DateInput/useTypedDate.generated.ts +17 -0
- package/src/i18n/generated-english/DateTimeInput/DateTimeInput.generated.ts +0 -1
- package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +7 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +7 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useCalendarSystem.ts +95 -0
- package/src/internal/calendar-system.ts +26 -0
- package/src/internal/spinner-rotor.ts +20 -0
- package/src/internal/touch.ts +43 -2
- package/src/motion/MEASUREMENTS.md +11 -0
- package/src/motion/README.md +3 -3
- package/src/motion/animator.ts +7 -7
- package/src/motion/carryAnimations.ts +389 -0
- package/src/motion/transientCopy.ts +45 -5
- package/src/motion/uikit/gestures.ts +22 -0
- package/src/motion/uikit/index.ts +1 -0
- package/src/motion/uikit/timing.ts +7 -5
- package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
- package/src/privateAttributes/press.stylex.ts +261 -0
- package/src/theme/themeMotion.ts +3 -2
- package/src/theme/tokens.stylex.ts +1 -1
- package/src/utils/calendarDateParser.ts +1385 -0
- package/src/utils/calendarSystem.ts +832 -0
- package/src/utils/coarsePointer.ts +27 -14
- package/src/utils/flatTree.ts +15 -3
- package/src/utils/focusReturn.ts +78 -18
- package/src/utils/hitArea.ts +138 -9
- package/src/utils/inputPresentation.ts +21 -1
- package/src/utils/inputStream.ts +47 -10
- package/src/utils/interactionOverlay.stylex.ts +19 -22
- package/src/utils/plainDate.ts +130 -19
- package/src/utils/pressFeedback.ts +46 -14
- package/src/utils/pressGesture.ts +35 -9
- package/src/utils/scrollView.ts +135 -0
- package/src/utils/selectionLock.ts +5 -10
- package/src/utils/touchHitArea.stylex.ts +56 -0
- package/src/utils/touchHitArea.ts +177 -0
- package/src/utils/triggerFocus.ts +17 -4
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @file useMenuPress.ts
|
|
7
7
|
* @input The menu root, its trigger, the enabled-row selector, and callbacks
|
|
8
8
|
* for opening, highlighting, activating and dismissing
|
|
9
|
-
* @output useMenuPress, the marker attributes,
|
|
9
|
+
* @output useMenuPress, the marker attributes, the activation mark, and the
|
|
10
|
+
* internal useDropdownMenuPress entry with its touch model
|
|
10
11
|
* @position Core hook for DropdownMenu, ContextMenu, DropdownMenuSubMenu,
|
|
11
12
|
* Selector and MenuBottomSheetActionList. The transition table lives in
|
|
12
13
|
* menuPressGesture.ts.
|
|
@@ -29,10 +30,10 @@ import {
|
|
|
29
30
|
import {currentGesture} from '../Layer/gestureCounter';
|
|
30
31
|
import {
|
|
31
32
|
IDLE_MENU_PRESS,
|
|
32
|
-
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
33
|
+
menuPressTransition,
|
|
34
|
+
type MenuPressOutcome,
|
|
35
|
+
type MenuPressInput,
|
|
36
|
+
type MenuPressState,
|
|
36
37
|
type MenuPressPointerType,
|
|
37
38
|
} from './menuPressGesture';
|
|
38
39
|
import {MENU_PRESS_MARKER} from './menuPressMarker';
|
|
@@ -45,6 +46,12 @@ import {edgeAutoscroll} from '../utils/edgeAutoscroll';
|
|
|
45
46
|
import {focusForLastInput} from '../utils/focusReturn';
|
|
46
47
|
import {useInteractionModalityTrackingFor} from '../utils/interactionModality';
|
|
47
48
|
import {LONG_PRESS_DURATION_MS} from '../motion/uikit/longPress';
|
|
49
|
+
import {
|
|
50
|
+
clearMenuPressLit,
|
|
51
|
+
holdMenuPressPaint,
|
|
52
|
+
markMenuPressLit,
|
|
53
|
+
releaseMenuPressPaint,
|
|
54
|
+
} from '../privateAttributes/menuPressLit.stylex';
|
|
48
55
|
import {
|
|
49
56
|
__resetClickGuardForTest,
|
|
50
57
|
armClickGuard,
|
|
@@ -235,6 +242,44 @@ interface ResolvedPoint {
|
|
|
235
242
|
isOnTrigger: boolean;
|
|
236
243
|
}
|
|
237
244
|
|
|
245
|
+
/**
|
|
246
|
+
* DropdownMenu's options for the press model: everything the public hook
|
|
247
|
+
* takes, plus its touch model. DropdownMenu reaches the touch model through
|
|
248
|
+
* its `presentation`, so the public hook has no such option.
|
|
249
|
+
*
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
export interface DropdownMenuPressOptions extends UseMenuPressOptions {
|
|
253
|
+
/**
|
|
254
|
+
* How the finger that opened the menu from the trigger picks.
|
|
255
|
+
* `'pointer'`: its opening press follows the settle rule. `'uikit'`: it
|
|
256
|
+
* picks only after UIMenu's handoff distance, so the row that appeared
|
|
257
|
+
* under it never acts on a still lift. A mouse is unaffected.
|
|
258
|
+
* @default 'pointer'
|
|
259
|
+
*/
|
|
260
|
+
touchModel?: 'pointer' | 'uikit';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* What core's own menus get from {@link useDropdownMenuPress}: the public
|
|
265
|
+
* return. Not exported from the hooks entry point.
|
|
266
|
+
*
|
|
267
|
+
* @internal
|
|
268
|
+
*/
|
|
269
|
+
export type DropdownMenuPressReturn = UseMenuPressReturn;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Where a pointer is, for a finger's handoff distance. Positions reach the
|
|
273
|
+
* machine only under `touchModel: 'uikit'`. Without them, it keeps the settle
|
|
274
|
+
* rule.
|
|
275
|
+
*/
|
|
276
|
+
function handoffPosition(
|
|
277
|
+
event: PointerEvent,
|
|
278
|
+
hasHandoff: boolean,
|
|
279
|
+
): {x?: number; y?: number} {
|
|
280
|
+
return hasHandoff ? {x: event.clientX, y: event.clientY} : {};
|
|
281
|
+
}
|
|
282
|
+
|
|
238
283
|
/**
|
|
239
284
|
* The press model for a menu: the row under the release acts, the highlight
|
|
240
285
|
* follows a held pointer, and a mouse opens the menu on press.
|
|
@@ -271,13 +316,30 @@ interface ResolvedPoint {
|
|
|
271
316
|
* ```
|
|
272
317
|
*/
|
|
273
318
|
export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
319
|
+
// The touch model is DropdownMenu's alone; an untyped caller's
|
|
320
|
+
// `touchModel` does not reach the model.
|
|
321
|
+
const {touchModel: _touchModel, ...publicOptions} =
|
|
322
|
+
options as DropdownMenuPressOptions;
|
|
323
|
+
return useDropdownMenuPress({...publicOptions, touchModel: 'pointer'});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The press model with DropdownMenu's touch model
|
|
328
|
+
* ({@link DropdownMenuPressOptions.touchModel}). Not exported from the hooks
|
|
329
|
+
* entry point.
|
|
330
|
+
*
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
export function useDropdownMenuPress(
|
|
334
|
+
options: DropdownMenuPressOptions,
|
|
335
|
+
): DropdownMenuPressReturn {
|
|
274
336
|
const optionsRef = useRef(options);
|
|
275
337
|
optionsRef.current = options;
|
|
276
338
|
// The highlight, and the hover focus of the rows in this menu, follow the
|
|
277
339
|
// last input, which this tracks for the menu's own document.
|
|
278
340
|
useInteractionModalityTrackingFor(options.menuRef);
|
|
279
341
|
|
|
280
|
-
const gestureRef = useRef<
|
|
342
|
+
const gestureRef = useRef<MenuPressState<HTMLElement>>(IDLE_MENU_PRESS);
|
|
281
343
|
const pointerIdRef = useRef<number | null>(null);
|
|
282
344
|
const detachRef = useRef<(() => void) | null>(null);
|
|
283
345
|
// `useLongPress` detects the held finger, as in ContextMenu, so the hold
|
|
@@ -374,8 +436,18 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
374
436
|
autoscrollRef.current = null;
|
|
375
437
|
}, [autoscroll]);
|
|
376
438
|
|
|
439
|
+
const litRowRef = useRef<HTMLElement | null>(null);
|
|
440
|
+
const heldMenuRef = useRef<HTMLElement | null>(null);
|
|
377
441
|
const endGesture = useCallback(() => {
|
|
378
442
|
longPressApiRef.current?.cancel();
|
|
443
|
+
if (litRowRef.current != null) {
|
|
444
|
+
clearMenuPressLit(litRowRef.current);
|
|
445
|
+
litRowRef.current = null;
|
|
446
|
+
}
|
|
447
|
+
if (heldMenuRef.current != null) {
|
|
448
|
+
releaseMenuPressPaint(heldMenuRef.current);
|
|
449
|
+
heldMenuRef.current = null;
|
|
450
|
+
}
|
|
379
451
|
touchMovePreventerRef.current?.();
|
|
380
452
|
touchMovePreventerRef.current = null;
|
|
381
453
|
stopAutoscroll();
|
|
@@ -388,7 +460,34 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
388
460
|
|
|
389
461
|
const highlight = useCallback(
|
|
390
462
|
(row: HTMLElement | null) => {
|
|
463
|
+
// A held finger or pen marks the row it lights, for the row's pressed
|
|
464
|
+
// paint. A held mouse keeps the hover tint, as on a desktop.
|
|
465
|
+
const gesture = gestureRef.current;
|
|
466
|
+
const isHeld =
|
|
467
|
+
gesture.phase !== 'idle' && gesture.pointerType !== 'mouse';
|
|
468
|
+
const lit = isHeld ? row : null;
|
|
469
|
+
if (litRowRef.current !== lit) {
|
|
470
|
+
if (litRowRef.current != null) {
|
|
471
|
+
clearMenuPressLit(litRowRef.current);
|
|
472
|
+
}
|
|
473
|
+
litRowRef.current = lit;
|
|
474
|
+
if (lit != null) {
|
|
475
|
+
markMenuPressLit(lit);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
391
478
|
const {onHighlight, menuRef} = optionsRef.current;
|
|
479
|
+
// The row the press began on stays :active where a pointer hovers, so
|
|
480
|
+
// the menu holds every row but the lit one off that paint.
|
|
481
|
+
const held = isHeld ? menuRef.current : null;
|
|
482
|
+
if (heldMenuRef.current !== held) {
|
|
483
|
+
if (heldMenuRef.current != null) {
|
|
484
|
+
releaseMenuPressPaint(heldMenuRef.current);
|
|
485
|
+
}
|
|
486
|
+
heldMenuRef.current = held;
|
|
487
|
+
if (held != null) {
|
|
488
|
+
holdMenuPressPaint(held);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
392
491
|
if (onHighlight != null) {
|
|
393
492
|
onHighlight(row);
|
|
394
493
|
return;
|
|
@@ -449,13 +548,13 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
449
548
|
|
|
450
549
|
// Declared before `step` so the mutual recursion through refs type-checks.
|
|
451
550
|
const stepRef = useRef<
|
|
452
|
-
(event:
|
|
551
|
+
(event: MenuPressInput<HTMLElement>, native?: PointerEvent) => void
|
|
453
552
|
>(() => {});
|
|
454
553
|
|
|
455
554
|
const applyEffect = useCallback(
|
|
456
555
|
(
|
|
457
|
-
effect:
|
|
458
|
-
gesture:
|
|
556
|
+
effect: MenuPressOutcome<HTMLElement>,
|
|
557
|
+
gesture: MenuPressState<HTMLElement>,
|
|
459
558
|
native: PointerEvent | undefined,
|
|
460
559
|
) => {
|
|
461
560
|
const doc = getDocument();
|
|
@@ -511,8 +610,8 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
511
610
|
);
|
|
512
611
|
|
|
513
612
|
const step = useCallback(
|
|
514
|
-
(event:
|
|
515
|
-
const result =
|
|
613
|
+
(event: MenuPressInput<HTMLElement>, native?: PointerEvent) => {
|
|
614
|
+
const result = menuPressTransition(gestureRef.current, event);
|
|
516
615
|
gestureRef.current = result.gesture;
|
|
517
616
|
applyEffect(result.effect, result.gesture, native);
|
|
518
617
|
},
|
|
@@ -619,6 +718,10 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
619
718
|
row: point.row,
|
|
620
719
|
isInMenu: point.isInMenu,
|
|
621
720
|
time: Date.now(),
|
|
721
|
+
...handoffPosition(
|
|
722
|
+
event,
|
|
723
|
+
optionsRef.current.touchModel === 'uikit',
|
|
724
|
+
),
|
|
622
725
|
},
|
|
623
726
|
event,
|
|
624
727
|
);
|
|
@@ -636,6 +739,10 @@ export function useMenuPress(options: UseMenuPressOptions): UseMenuPressReturn {
|
|
|
636
739
|
isInMenu: point.isInMenu,
|
|
637
740
|
isOnTrigger: point.isOnTrigger,
|
|
638
741
|
time: Date.now(),
|
|
742
|
+
...handoffPosition(
|
|
743
|
+
event,
|
|
744
|
+
optionsRef.current.touchModel === 'uikit',
|
|
745
|
+
),
|
|
639
746
|
},
|
|
640
747
|
event,
|
|
641
748
|
);
|
package/src/hooks/useOverflow.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useOverflow.ts
|
|
7
|
-
* @input Uses React useState, useCallback, useRef;
|
|
7
|
+
* @input Uses React useState, useCallback, useRef; react-dom flushSync;
|
|
8
|
+
* useIsomorphicLayoutEffect
|
|
8
9
|
* @output Exports useOverflow hook for measuring and managing horizontal overflow
|
|
9
10
|
* @position Core hook; used by OverflowList and consumers for overflow patterns.
|
|
10
11
|
* Hidden copies of the children are measured, so nothing flickers. The
|
|
@@ -16,9 +17,10 @@
|
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
import {useState, useCallback, useRef} from 'react';
|
|
20
|
+
import {flushSync} from 'react-dom';
|
|
19
21
|
import {useIsomorphicLayoutEffect} from './useIsomorphicLayoutEffect';
|
|
20
22
|
import {observeResize} from '../utils/sharedResizeObserver';
|
|
21
|
-
import {computeOverflow} from './computeOverflow';
|
|
23
|
+
import {computeOverflow, countRows} from './computeOverflow';
|
|
22
24
|
import {useDevWarning} from './useDevWarning';
|
|
23
25
|
|
|
24
26
|
export interface UseOverflowOptions {
|
|
@@ -85,6 +87,161 @@ export interface UseOverflowReturn {
|
|
|
85
87
|
rowHeight: number;
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
// A measurement either applies its result at once or returns the update to
|
|
91
|
+
// apply after the frame paints.
|
|
92
|
+
type Measure = (timing: 'now' | 'beforePaint') => (() => void) | undefined;
|
|
93
|
+
|
|
94
|
+
// Measurements that the resize observer reported in the current frame.
|
|
95
|
+
const pendingMeasures = new Set<Measure>();
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Measures again for a resize the observer reported.
|
|
99
|
+
*
|
|
100
|
+
* The observer reports after layout and before paint. A state update here
|
|
101
|
+
* renders in a later task, after the frame paints. A microtask still runs
|
|
102
|
+
* before paint. It measures every reported list and renders the results once.
|
|
103
|
+
* An update that a measurement returns renders in a later task, after paint.
|
|
104
|
+
*/
|
|
105
|
+
function measureBeforePaint(measure: Measure): void {
|
|
106
|
+
if (pendingMeasures.size === 0) {
|
|
107
|
+
queueMicrotask(() => {
|
|
108
|
+
const measures = [...pendingMeasures];
|
|
109
|
+
pendingMeasures.clear();
|
|
110
|
+
const afterPaint: (() => void)[] = [];
|
|
111
|
+
// eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the new visible set must render before the frame that reported the resize paints
|
|
112
|
+
flushSync(() => {
|
|
113
|
+
for (const run of measures) {
|
|
114
|
+
const deferred = run('beforePaint');
|
|
115
|
+
if (deferred) {
|
|
116
|
+
afterPaint.push(deferred);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
for (const update of afterPaint) {
|
|
121
|
+
update();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
pendingMeasures.add(measure);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The registration call runs while React commits the ref, before paint, so it
|
|
130
|
+
* measures at once.
|
|
131
|
+
*/
|
|
132
|
+
function observeForOverflow(element: Element, measure: Measure): () => void {
|
|
133
|
+
let isRegistering = true;
|
|
134
|
+
const unobserve = observeResize(element, () => {
|
|
135
|
+
if (isRegistering) {
|
|
136
|
+
measure('now');
|
|
137
|
+
} else {
|
|
138
|
+
measureBeforePaint(measure);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
isRegistering = false;
|
|
142
|
+
return unobserve;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** A visible set as the list renders it, sized from the measure copy. */
|
|
146
|
+
interface RenderedSet {
|
|
147
|
+
widths: number[];
|
|
148
|
+
heights: number[];
|
|
149
|
+
/** The measured indicator, when the set collapses items. */
|
|
150
|
+
indicator: {width: number; height: number} | null;
|
|
151
|
+
indicatorFirst: boolean;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The rows a set fills at `availableWidth`, up to `maxRows`, or `null` when
|
|
156
|
+
* they are not known. The measured indicator holds every item, so the
|
|
157
|
+
* rendered one can be narrower. When the rows with and without it differ,
|
|
158
|
+
* the rows are not known.
|
|
159
|
+
*/
|
|
160
|
+
function rowsFilled(
|
|
161
|
+
set: RenderedSet,
|
|
162
|
+
gap: number,
|
|
163
|
+
availableWidth: number,
|
|
164
|
+
maxRows: number,
|
|
165
|
+
): number | null {
|
|
166
|
+
const rowsWithout = Math.min(
|
|
167
|
+
countRows(set.widths, gap, availableWidth),
|
|
168
|
+
maxRows,
|
|
169
|
+
);
|
|
170
|
+
if (!set.indicator) {
|
|
171
|
+
return rowsWithout;
|
|
172
|
+
}
|
|
173
|
+
const widths = set.indicatorFirst
|
|
174
|
+
? [set.indicator.width, ...set.widths]
|
|
175
|
+
: [...set.widths, set.indicator.width];
|
|
176
|
+
const rowsWith = Math.min(countRows(widths, gap, availableWidth), maxRows);
|
|
177
|
+
return rowsWith === rowsWithout ? rowsWith : null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The list's height follows its tallest child and, in a multi-row list, the
|
|
182
|
+
* rows it fills.
|
|
183
|
+
*/
|
|
184
|
+
function canChangeListHeight(
|
|
185
|
+
now: RenderedSet,
|
|
186
|
+
next: RenderedSet,
|
|
187
|
+
gap: number,
|
|
188
|
+
availableWidth: number,
|
|
189
|
+
maxRows: number,
|
|
190
|
+
): boolean {
|
|
191
|
+
const tallest = (set: RenderedSet) =>
|
|
192
|
+
Math.max(0, ...set.heights, set.indicator?.height ?? 0);
|
|
193
|
+
if (tallest(now) !== tallest(next)) {
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
if (maxRows <= 1) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const rowsNow = rowsFilled(now, gap, availableWidth, maxRows);
|
|
200
|
+
const rowsNext = rowsFilled(next, gap, availableWidth, maxRows);
|
|
201
|
+
return rowsNow === null || rowsNext === null || rowsNow !== rowsNext;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Whether the observed element's size follows the list's items: a list in a
|
|
206
|
+
* flex item sized from its content, a shrink-to-fit box, or such an ancestor.
|
|
207
|
+
* A fold then changes an observed size, so it cannot render inside the
|
|
208
|
+
* observer step. Size containment drops the items' contribution to the
|
|
209
|
+
* list's inline size, so a size that moves under it follows the items. The
|
|
210
|
+
* probe reverts at once, before any observer or the frame can see it.
|
|
211
|
+
*/
|
|
212
|
+
function observedSizeFollowsItems(
|
|
213
|
+
list: HTMLElement,
|
|
214
|
+
observed: HTMLElement,
|
|
215
|
+
): boolean {
|
|
216
|
+
const style = list.style as CSSStyleDeclaration | undefined;
|
|
217
|
+
if (style == null || typeof style.setProperty !== 'function') {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
const hadStyleAttribute = list.hasAttribute('style');
|
|
221
|
+
const value = style.getPropertyValue('contain');
|
|
222
|
+
const priority = style.getPropertyPriority('contain');
|
|
223
|
+
const width = observed.offsetWidth;
|
|
224
|
+
const height = observed.offsetHeight;
|
|
225
|
+
style.setProperty('contain', 'inline-size', 'important');
|
|
226
|
+
const follows =
|
|
227
|
+
observed.offsetWidth !== width || observed.offsetHeight !== height;
|
|
228
|
+
if (value !== '') {
|
|
229
|
+
style.setProperty('contain', value, priority);
|
|
230
|
+
} else if (hadStyleAttribute) {
|
|
231
|
+
style.removeProperty('contain');
|
|
232
|
+
} else {
|
|
233
|
+
style.removeProperty('contain');
|
|
234
|
+
// Chromium writes the inline style back to the attribute lazily. Reading
|
|
235
|
+
// the attribute first stops the removal from leaving `style=""`.
|
|
236
|
+
void list.getAttribute('style');
|
|
237
|
+
list.removeAttribute('style');
|
|
238
|
+
}
|
|
239
|
+
// Lay out again now. A later observer in this delivery reads the current
|
|
240
|
+
// layout without updating it, so it would get the contained size.
|
|
241
|
+
void observed.offsetWidth;
|
|
242
|
+
return follows;
|
|
243
|
+
}
|
|
244
|
+
|
|
88
245
|
/**
|
|
89
246
|
* Hook for managing horizontal overflow of a list of items.
|
|
90
247
|
*
|
|
@@ -106,6 +263,21 @@ export interface UseOverflowReturn {
|
|
|
106
263
|
export function useOverflow(
|
|
107
264
|
itemCount: number,
|
|
108
265
|
options: UseOverflowOptions = {},
|
|
266
|
+
): UseOverflowReturn {
|
|
267
|
+
return useOverflowInternal(itemCount, options, {tracksRows: true});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* `useOverflow` for a host inside Core that states whether it renders from
|
|
272
|
+
* `rows` and `rowHeight`. With `tracksRows` false, the hook does not track
|
|
273
|
+
* them and reports `rows: 1` and `rowHeight: 0`. A state write that nobody
|
|
274
|
+
* reads still re-renders the host. Internal: the public hook always tracks
|
|
275
|
+
* them.
|
|
276
|
+
*/
|
|
277
|
+
export function useOverflowInternal(
|
|
278
|
+
itemCount: number,
|
|
279
|
+
options: UseOverflowOptions,
|
|
280
|
+
{tracksRows}: {tracksRows: boolean},
|
|
109
281
|
): UseOverflowReturn {
|
|
110
282
|
const {
|
|
111
283
|
gap = 0,
|
|
@@ -129,6 +301,9 @@ export function useOverflow(
|
|
|
129
301
|
const [visibleCount, setVisibleCount] = useState(itemCount);
|
|
130
302
|
const [rows, setRows] = useState(1);
|
|
131
303
|
const [rowHeight, setRowHeight] = useState(0);
|
|
304
|
+
// The values last written to state. A measurement that matches them writes
|
|
305
|
+
// nothing, so a resize that changes nothing renders nothing.
|
|
306
|
+
const appliedRef = useRef({visibleCount: itemCount, rows: 1, rowHeight: 0});
|
|
132
307
|
const containerElRef = useRef<HTMLElement | null>(null);
|
|
133
308
|
const measureElRef = useRef<HTMLElement | null>(null);
|
|
134
309
|
const observedElRef = useRef<HTMLElement | null>(null);
|
|
@@ -136,80 +311,153 @@ export function useOverflow(
|
|
|
136
311
|
const unobserveContainerRef = useRef<(() => void) | null>(null);
|
|
137
312
|
const unobserveMeasureRef = useRef<(() => void) | null>(null);
|
|
138
313
|
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
314
|
+
const apply = useCallback(
|
|
315
|
+
(nextVisible: number, nextRows: number, nextRowHeight: number) => {
|
|
316
|
+
const applied = appliedRef.current;
|
|
317
|
+
if (applied.visibleCount !== nextVisible) {
|
|
318
|
+
applied.visibleCount = nextVisible;
|
|
319
|
+
setVisibleCount(nextVisible);
|
|
320
|
+
}
|
|
321
|
+
// A host that does not track rows renders from neither value, so they
|
|
322
|
+
// are not written.
|
|
323
|
+
if (!tracksRows) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (applied.rows !== nextRows) {
|
|
327
|
+
applied.rows = nextRows;
|
|
328
|
+
setRows(nextRows);
|
|
329
|
+
}
|
|
330
|
+
if (applied.rowHeight !== nextRowHeight) {
|
|
331
|
+
applied.rowHeight = nextRowHeight;
|
|
332
|
+
setRowHeight(nextRowHeight);
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
[tracksRows],
|
|
336
|
+
);
|
|
145
337
|
|
|
146
|
-
|
|
338
|
+
const calculate: Measure = useCallback(
|
|
339
|
+
(timing = 'now') => {
|
|
340
|
+
const container = containerElRef.current;
|
|
341
|
+
const measure = measureElRef.current;
|
|
342
|
+
if (!container || !measure) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
147
345
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
parent
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
346
|
+
let availableWidth: number;
|
|
347
|
+
|
|
348
|
+
if (observeParent && container.parentElement) {
|
|
349
|
+
const parent = container.parentElement;
|
|
350
|
+
const parentStyle = getComputedStyle(parent);
|
|
351
|
+
availableWidth =
|
|
352
|
+
parent.clientWidth -
|
|
353
|
+
parseFloat(parentStyle.paddingLeft) -
|
|
354
|
+
parseFloat(parentStyle.paddingRight);
|
|
355
|
+
} else {
|
|
356
|
+
availableWidth = container.offsetWidth;
|
|
357
|
+
}
|
|
158
358
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (children.length === 0) {
|
|
172
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- overflow count is derived from measured DOM widths
|
|
173
|
-
setVisibleCount(0);
|
|
174
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
175
|
-
setRows(0);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
359
|
+
const allChildren = Array.from(measure.children) as HTMLElement[];
|
|
360
|
+
|
|
361
|
+
// The measurement container holds itemCount items, plus optionally
|
|
362
|
+
// an overflow indicator as the last child.
|
|
363
|
+
const hasIndicator = allChildren.length > itemCount;
|
|
364
|
+
const children = hasIndicator
|
|
365
|
+
? allChildren.slice(0, itemCount)
|
|
366
|
+
: allChildren;
|
|
367
|
+
const indicatorWidth = hasIndicator
|
|
368
|
+
? allChildren[allChildren.length - 1].offsetWidth
|
|
369
|
+
: 0;
|
|
178
370
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
371
|
+
if (children.length === 0) {
|
|
372
|
+
apply(0, 0, appliedRef.current.rowHeight);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const widths = children.map(child => child.offsetWidth);
|
|
377
|
+
const measuredRowHeight = children.reduce(
|
|
378
|
+
(max, child) => Math.max(max, child.offsetHeight || 0),
|
|
379
|
+
0,
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
const {visibleCount: nextVisible, rows: nextRows} = computeOverflow({
|
|
383
|
+
widths,
|
|
384
|
+
gap,
|
|
385
|
+
availableWidth,
|
|
386
|
+
indicatorWidth,
|
|
387
|
+
minVisibleItems,
|
|
388
|
+
maxVisibleItems,
|
|
389
|
+
maxRows,
|
|
390
|
+
collapseFrom,
|
|
391
|
+
});
|
|
184
392
|
|
|
185
|
-
|
|
186
|
-
|
|
393
|
+
// Folding to a new list height inside the resize step makes Chromium
|
|
394
|
+
// report a loop error. That update renders after paint. The measure copy
|
|
395
|
+
// sizes both sets, a plain-text indicator included.
|
|
396
|
+
if (timing === 'beforePaint') {
|
|
397
|
+
const indicator = hasIndicator
|
|
398
|
+
? allChildren[allChildren.length - 1]
|
|
399
|
+
: null;
|
|
400
|
+
const renderedSet = (count: number): RenderedSet => {
|
|
401
|
+
const shown =
|
|
402
|
+
collapseFrom === 'end'
|
|
403
|
+
? children.slice(0, count)
|
|
404
|
+
: children.slice(children.length - count);
|
|
405
|
+
return {
|
|
406
|
+
widths: shown.map(child => child.offsetWidth),
|
|
407
|
+
heights: shown.map(child => child.offsetHeight || 0),
|
|
408
|
+
indicator:
|
|
409
|
+
indicator && count < itemCount
|
|
410
|
+
? {width: indicatorWidth, height: indicator.offsetHeight || 0}
|
|
411
|
+
: null,
|
|
412
|
+
indicatorFirst: collapseFrom === 'start',
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
// Under observeParent the list fills its parent's width only while
|
|
416
|
+
// items are collapsed. A fold that shows or hides the indicator
|
|
417
|
+
// changes that width, which can change the observed parent's height
|
|
418
|
+
// when a sibling wraps.
|
|
419
|
+
const changesParentFill =
|
|
420
|
+
observeParent &&
|
|
421
|
+
appliedRef.current.visibleCount < itemCount !==
|
|
422
|
+
nextVisible < itemCount;
|
|
423
|
+
// A multi-row list's max height follows the measured row height.
|
|
424
|
+
const changesRowHeight =
|
|
425
|
+
(maxRows ?? 1) > 1 &&
|
|
426
|
+
measuredRowHeight !== appliedRef.current.rowHeight;
|
|
427
|
+
const observed =
|
|
428
|
+
observeParent && container.parentElement
|
|
429
|
+
? container.parentElement
|
|
430
|
+
: container;
|
|
431
|
+
if (
|
|
432
|
+
changesParentFill ||
|
|
433
|
+
changesRowHeight ||
|
|
434
|
+
(nextVisible !== appliedRef.current.visibleCount &&
|
|
435
|
+
observedSizeFollowsItems(container, observed)) ||
|
|
436
|
+
canChangeListHeight(
|
|
437
|
+
renderedSet(appliedRef.current.visibleCount),
|
|
438
|
+
renderedSet(nextVisible),
|
|
439
|
+
gap,
|
|
440
|
+
availableWidth,
|
|
441
|
+
maxRows ?? 1,
|
|
442
|
+
)
|
|
443
|
+
) {
|
|
444
|
+
return () => apply(nextVisible, nextRows, measuredRowHeight);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
apply(nextVisible, nextRows, measuredRowHeight);
|
|
448
|
+
return undefined;
|
|
449
|
+
},
|
|
450
|
+
[
|
|
451
|
+
itemCount,
|
|
187
452
|
gap,
|
|
188
|
-
availableWidth,
|
|
189
|
-
indicatorWidth,
|
|
190
453
|
minVisibleItems,
|
|
191
454
|
maxVisibleItems,
|
|
192
455
|
maxRows,
|
|
193
456
|
collapseFrom,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
199
|
-
setRows(prev => (prev === nextRows ? prev : nextRows));
|
|
200
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
201
|
-
setRowHeight(prev =>
|
|
202
|
-
prev === measuredRowHeight ? prev : measuredRowHeight,
|
|
203
|
-
);
|
|
204
|
-
}, [
|
|
205
|
-
itemCount,
|
|
206
|
-
gap,
|
|
207
|
-
minVisibleItems,
|
|
208
|
-
maxVisibleItems,
|
|
209
|
-
maxRows,
|
|
210
|
-
collapseFrom,
|
|
211
|
-
observeParent,
|
|
212
|
-
]);
|
|
457
|
+
observeParent,
|
|
458
|
+
apply,
|
|
459
|
+
],
|
|
460
|
+
);
|
|
213
461
|
|
|
214
462
|
const containerRef = useCallback(
|
|
215
463
|
(el: HTMLElement | null) => {
|
|
@@ -223,9 +471,7 @@ export function useOverflow(
|
|
|
223
471
|
if (el) {
|
|
224
472
|
const target =
|
|
225
473
|
observeParent && el.parentElement ? el.parentElement : el;
|
|
226
|
-
unobserveContainerRef.current =
|
|
227
|
-
calculate();
|
|
228
|
-
});
|
|
474
|
+
unobserveContainerRef.current = observeForOverflow(target, calculate);
|
|
229
475
|
observedElRef.current = target;
|
|
230
476
|
}
|
|
231
477
|
},
|
|
@@ -243,9 +489,7 @@ export function useOverflow(
|
|
|
243
489
|
return;
|
|
244
490
|
}
|
|
245
491
|
|
|
246
|
-
unobserveMeasureRef.current =
|
|
247
|
-
calculate();
|
|
248
|
-
});
|
|
492
|
+
unobserveMeasureRef.current = observeForOverflow(el, calculate);
|
|
249
493
|
observedMeasureElRef.current = el;
|
|
250
494
|
},
|
|
251
495
|
[calculate],
|
|
@@ -254,7 +498,7 @@ export function useOverflow(
|
|
|
254
498
|
// Syncs the visible count with the rendered layout. It measures again after
|
|
255
499
|
// the items change.
|
|
256
500
|
useIsomorphicLayoutEffect(() => {
|
|
257
|
-
calculate();
|
|
501
|
+
calculate('now');
|
|
258
502
|
}, [calculate]);
|
|
259
503
|
|
|
260
504
|
const hasOverflow = visibleCount < itemCount;
|
|
@@ -264,7 +508,9 @@ export function useOverflow(
|
|
|
264
508
|
measureRef,
|
|
265
509
|
visibleCount,
|
|
266
510
|
hasOverflow,
|
|
267
|
-
|
|
268
|
-
|
|
511
|
+
// A host that stops tracking keeps state from earlier measurements, so
|
|
512
|
+
// the return uses the fixed values.
|
|
513
|
+
rows: tracksRows ? rows : 1,
|
|
514
|
+
rowHeight: tracksRows ? rowHeight : 0,
|
|
269
515
|
};
|
|
270
516
|
}
|