@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file resizablePane.ts
|
|
5
|
+
* @input A LayoutPanel's element, and the collapse state the ResizeHandle
|
|
6
|
+
* beside it reports
|
|
7
|
+
* @output The internal channel through which a LayoutPanel at a region's size
|
|
8
|
+
* lends its element to the ResizeHandle beside it, and the ResizeHandle a
|
|
9
|
+
* collapsing panel hands focus to
|
|
10
|
+
* @position Internal to Resizable and Layout; no entry point exports it. No
|
|
11
|
+
* React, and no DOM work on import
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** What a LayoutPanel lends the ResizeHandle beside it. */
|
|
15
|
+
export interface ResizablePane {
|
|
16
|
+
readonly element: HTMLElement;
|
|
17
|
+
/**
|
|
18
|
+
* The handle says whether its region is collapsed, and which handle focus
|
|
19
|
+
* inside the panel moves to as it collapses. The panel is then inert and
|
|
20
|
+
* hidden from assistive technology while it is collapsed.
|
|
21
|
+
*/
|
|
22
|
+
setCollapsed(isCollapsed: boolean, focusTarget: HTMLElement | null): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const lent = new WeakMap<Element, ResizablePane>();
|
|
26
|
+
const watchers = new Set<() => void>();
|
|
27
|
+
// The elements ResizeHandle renders, for a panel beside one to find it.
|
|
28
|
+
const resizeHandles = new WeakSet<Element>();
|
|
29
|
+
|
|
30
|
+
/** ResizeHandle registers the element it renders; returns the unregister. */
|
|
31
|
+
export function registerResizeHandle(element: Element): () => void {
|
|
32
|
+
resizeHandles.add(element);
|
|
33
|
+
return () => {
|
|
34
|
+
resizeHandles.delete(element);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function notifyWatchers(): void {
|
|
39
|
+
for (const watcher of [...watchers]) {
|
|
40
|
+
watcher();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Calls `listener` whenever a panel is lent beside a handle or taken back, so
|
|
46
|
+
* a handle looks for its pane again. Returns the function that stops it.
|
|
47
|
+
*/
|
|
48
|
+
export function watchResizablePanes(listener: () => void): () => void {
|
|
49
|
+
watchers.add(listener);
|
|
50
|
+
return () => {
|
|
51
|
+
watchers.delete(listener);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The pane a resize handle resizes: the lent LayoutPanel just before it, or
|
|
57
|
+
* just after it when the region is reversed.
|
|
58
|
+
*/
|
|
59
|
+
export function resizablePaneFor(
|
|
60
|
+
handle: Element,
|
|
61
|
+
isReversed: boolean,
|
|
62
|
+
): ResizablePane | null {
|
|
63
|
+
const sibling = isReversed
|
|
64
|
+
? handle.nextElementSibling
|
|
65
|
+
: handle.previousElementSibling;
|
|
66
|
+
return sibling == null ? null : (lent.get(sibling) ?? null);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Moves a handle's hold from `held` to `next`, and returns `next`. A pane the
|
|
71
|
+
* handle no longer holds opens. The held pane takes the region's collapse
|
|
72
|
+
* state, and focus inside it moves to `handle` as it collapses.
|
|
73
|
+
*/
|
|
74
|
+
export function handOverPane(
|
|
75
|
+
held: ResizablePane | null,
|
|
76
|
+
next: ResizablePane | null,
|
|
77
|
+
isCollapsed: boolean,
|
|
78
|
+
handle: HTMLElement | null,
|
|
79
|
+
): ResizablePane | null {
|
|
80
|
+
if (next !== held) {
|
|
81
|
+
held?.setCollapsed(false, null);
|
|
82
|
+
}
|
|
83
|
+
next?.setCollapsed(isCollapsed, handle);
|
|
84
|
+
return next;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The ResizeHandle beside a panel, on the side that faces the content. It is
|
|
89
|
+
* after a start panel, before an end panel, and on either side elsewhere.
|
|
90
|
+
*/
|
|
91
|
+
export function resizeHandleBeside(
|
|
92
|
+
panel: Element,
|
|
93
|
+
area: string | null | undefined,
|
|
94
|
+
): HTMLElement | null {
|
|
95
|
+
const candidates =
|
|
96
|
+
area === 'start'
|
|
97
|
+
? [panel.nextElementSibling]
|
|
98
|
+
: area === 'end'
|
|
99
|
+
? [panel.previousElementSibling]
|
|
100
|
+
: [panel.nextElementSibling, panel.previousElementSibling];
|
|
101
|
+
for (const candidate of candidates) {
|
|
102
|
+
if (candidate instanceof HTMLElement && resizeHandles.has(candidate)) {
|
|
103
|
+
return candidate;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** LayoutPanel's side of the channel, one per panel. */
|
|
110
|
+
export interface ResizablePaneLink {
|
|
111
|
+
/** For useSyncExternalStore: whether a handle holds the panel collapsed. */
|
|
112
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
113
|
+
readonly isCollapsed: () => boolean;
|
|
114
|
+
/** The handle that named itself for focus to move to, if any. */
|
|
115
|
+
focusTarget(): HTMLElement | null;
|
|
116
|
+
/**
|
|
117
|
+
* From the panel's callback ref: its element, lent beside its handle for
|
|
118
|
+
* the handle to find. Null takes it back.
|
|
119
|
+
*/
|
|
120
|
+
attach(element: HTMLElement | null): void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function createResizablePaneLink(): ResizablePaneLink {
|
|
124
|
+
let isCollapsed = false;
|
|
125
|
+
let focusTarget: HTMLElement | null = null;
|
|
126
|
+
let attached: ResizablePane | null = null;
|
|
127
|
+
const listeners = new Set<() => void>();
|
|
128
|
+
|
|
129
|
+
const setCollapsed = (next: boolean) => {
|
|
130
|
+
if (next === isCollapsed) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
isCollapsed = next;
|
|
134
|
+
for (const notify of [...listeners]) {
|
|
135
|
+
notify();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
subscribe(notify) {
|
|
141
|
+
listeners.add(notify);
|
|
142
|
+
return () => {
|
|
143
|
+
listeners.delete(notify);
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
isCollapsed: () => isCollapsed,
|
|
147
|
+
focusTarget: () => focusTarget,
|
|
148
|
+
attach(element) {
|
|
149
|
+
if (attached?.element === element) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const wasLent = attached != null;
|
|
153
|
+
if (attached != null && lent.get(attached.element) === attached) {
|
|
154
|
+
lent.delete(attached.element);
|
|
155
|
+
}
|
|
156
|
+
attached = null;
|
|
157
|
+
if (element == null) {
|
|
158
|
+
// Taken back: no handle holds it collapsed any more.
|
|
159
|
+
focusTarget = null;
|
|
160
|
+
setCollapsed(false);
|
|
161
|
+
} else {
|
|
162
|
+
const pane: ResizablePane = {
|
|
163
|
+
element,
|
|
164
|
+
setCollapsed(next, nextFocusTarget) {
|
|
165
|
+
if (attached === pane) {
|
|
166
|
+
focusTarget = nextFocusTarget;
|
|
167
|
+
setCollapsed(next);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
attached = pane;
|
|
172
|
+
lent.set(element, pane);
|
|
173
|
+
}
|
|
174
|
+
if (wasLent || element != null) {
|
|
175
|
+
notifyWatchers();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
@@ -338,6 +338,21 @@ const collapseControls = new WeakMap<ResizableProps, CollapseControls>();
|
|
|
338
338
|
*/
|
|
339
339
|
const effectiveMaxima = new WeakMap<ResizableProps, number>();
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* The props behind a component's `resizable` slot. It takes useResizable's
|
|
343
|
+
* output directly, and still takes that output's `props`.
|
|
344
|
+
*/
|
|
345
|
+
export function resizablePropsOf(
|
|
346
|
+
value: ResizableRegion | ResizableProps,
|
|
347
|
+
): ResizableProps {
|
|
348
|
+
return 'props' in value ? value.props : value;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Whether a `resizable` value is useResizable's output for one region. */
|
|
352
|
+
export function isResizableRegion(value: unknown): value is ResizableRegion {
|
|
353
|
+
return typeof value === 'object' && value !== null && 'props' in value;
|
|
354
|
+
}
|
|
355
|
+
|
|
341
356
|
/** The reported maximum for `props`, or `undefined` for a hand-built object. */
|
|
342
357
|
export function getEffectiveMaxPx(props: ResizableProps): number | undefined {
|
|
343
358
|
return effectiveMaxima.get(props);
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
type RefObject,
|
|
26
26
|
} from 'react';
|
|
27
27
|
import {
|
|
28
|
-
|
|
28
|
+
createMotionEngine,
|
|
29
29
|
type AnimateOptions,
|
|
30
30
|
type Animator,
|
|
31
31
|
type MotionCurve,
|
|
@@ -539,7 +539,7 @@ export class SegmentedSelectionMotion {
|
|
|
539
539
|
private readonly after: Animator;
|
|
540
540
|
|
|
541
541
|
constructor(
|
|
542
|
-
private readonly animator: Animator =
|
|
542
|
+
private readonly animator: Animator = createMotionEngine(null, {
|
|
543
543
|
pseudoElement: '::before',
|
|
544
544
|
}),
|
|
545
545
|
options: SegmentedSelectionMotionOptions = {},
|
|
@@ -552,7 +552,7 @@ export class SegmentedSelectionMotion {
|
|
|
552
552
|
this.now = options.now ?? defaultNow;
|
|
553
553
|
this.after =
|
|
554
554
|
options.afterAnimator ??
|
|
555
|
-
|
|
555
|
+
createMotionEngine(null, {
|
|
556
556
|
pseudoElement: '::after',
|
|
557
557
|
initial: {opacity: 0},
|
|
558
558
|
});
|
|
@@ -44,6 +44,7 @@ import type {StyleXStyles} from '@stylexjs/stylex';
|
|
|
44
44
|
import {colorVars, durationVars, easeVars} from '../theme/tokens.stylex';
|
|
45
45
|
import type {Elevation, SizeValue, SpacingStep} from '../utils/types';
|
|
46
46
|
import {isImeKeyEvent, mergeProps} from '../utils';
|
|
47
|
+
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
47
48
|
import {Card} from '../Card/Card';
|
|
48
49
|
import type {CardVariant} from '../Card/Card';
|
|
49
50
|
import {useClickableContainer} from '../hooks/useClickableContainer';
|
|
@@ -398,6 +399,7 @@ export function SelectableCard({
|
|
|
398
399
|
onChange,
|
|
399
400
|
onClick: onClickProp,
|
|
400
401
|
onMouseUp: onMouseUpProp,
|
|
402
|
+
onPointerDown: onPointerDownProp,
|
|
401
403
|
isDisabled = false,
|
|
402
404
|
children,
|
|
403
405
|
padding,
|
|
@@ -458,7 +460,7 @@ export function SelectableCard({
|
|
|
458
460
|
[isDisabled, requestChange],
|
|
459
461
|
);
|
|
460
462
|
|
|
461
|
-
const {onClick, onMouseUp} = useClickableContainer({
|
|
463
|
+
const {onClick, onMouseUp, onPointerDown} = useClickableContainer({
|
|
462
464
|
containerRef,
|
|
463
465
|
interactiveRef,
|
|
464
466
|
onClick: handleClick,
|
|
@@ -530,6 +532,11 @@ export function SelectableCard({
|
|
|
530
532
|
}
|
|
531
533
|
onClick={!isDisabled ? composedOnClick : undefined}
|
|
532
534
|
onMouseUp={!isDisabled ? composedOnMouseUp : undefined}
|
|
535
|
+
onPointerDown={
|
|
536
|
+
!isDisabled
|
|
537
|
+
? chainEventHandlers(onPointerDown, onPointerDownProp)
|
|
538
|
+
: onPointerDownProp
|
|
539
|
+
}
|
|
533
540
|
{...props}
|
|
534
541
|
onClickCapture={
|
|
535
542
|
!isDisabled && handleLayerClickCapture
|
|
@@ -53,6 +53,7 @@ import {useKeepLayerOpenProps, type LayerPlacement} from '../Layer/useLayer';
|
|
|
53
53
|
import {InternalInputClearButton} from '../Field/InputClearButton';
|
|
54
54
|
import {Spinner} from '../Spinner';
|
|
55
55
|
import {PanelSearchInput} from '../Field/PanelSearchInput';
|
|
56
|
+
import {useKeyboardHighlight} from '../hooks/useKeyboardHighlight';
|
|
56
57
|
import {useAnnounce} from '../hooks/useAnnounce';
|
|
57
58
|
import {useAnnounceRenderedText} from '../hooks/useAnnounceRenderedText';
|
|
58
59
|
import {
|
|
@@ -66,6 +67,7 @@ import {
|
|
|
66
67
|
fontWeightVars,
|
|
67
68
|
typeScaleVars,
|
|
68
69
|
borderVars,
|
|
70
|
+
focusVars,
|
|
69
71
|
} from '../theme/tokens.stylex';
|
|
70
72
|
import type {SelectorOptionType, SelectorOptionData} from './types';
|
|
71
73
|
import {isOptionData, isDivider, isSection, normalizeOption} from './utils';
|
|
@@ -456,7 +458,7 @@ const styles = stylex.create({
|
|
|
456
458
|
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
457
459
|
},
|
|
458
460
|
textAlign: 'start',
|
|
459
|
-
|
|
461
|
+
outlineStyle: 'none',
|
|
460
462
|
},
|
|
461
463
|
itemContent: {
|
|
462
464
|
display: 'flex',
|
|
@@ -489,6 +491,15 @@ const styles = stylex.create({
|
|
|
489
491
|
itemHighlighted: {
|
|
490
492
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
491
493
|
},
|
|
494
|
+
// The fill alone does not reach 3:1 against the listbox. After keyboard
|
|
495
|
+
// input, the active option also draws the standard focus ring, inside the
|
|
496
|
+
// row by its own width, as a focused menu row does.
|
|
497
|
+
itemKeyboardHighlighted: {
|
|
498
|
+
outlineWidth: focusVars['--focus-outline-width'],
|
|
499
|
+
outlineStyle: focusVars['--focus-outline-style'],
|
|
500
|
+
outlineColor: focusVars['--focus-outline-color'],
|
|
501
|
+
outlineOffset: `calc(-1 * ${focusVars['--focus-outline-width']})`,
|
|
502
|
+
},
|
|
492
503
|
itemSelected: {
|
|
493
504
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
494
505
|
},
|
|
@@ -920,13 +931,20 @@ interface SelectorOptionRowProps {
|
|
|
920
931
|
flatIndex: number;
|
|
921
932
|
id: string;
|
|
922
933
|
isHighlighted: boolean;
|
|
934
|
+
/** The highlight came from keyboard input, so the row draws the focus ring. */
|
|
935
|
+
isKeyboardHighlighted: boolean;
|
|
923
936
|
isSelected: boolean;
|
|
924
937
|
size: SelectorSize;
|
|
925
938
|
indicatorPosition: IndicatorPosition;
|
|
926
939
|
renderOption: ((option: SelectorOptionData) => ReactNode) | undefined;
|
|
927
940
|
SelectionMark: IndicatorComponent<IndicatorMap['check']>;
|
|
928
941
|
onSelect: (item: SelectorOptionData) => void;
|
|
929
|
-
|
|
942
|
+
/** `isActive`: the option was already the highlighted one when entered. */
|
|
943
|
+
onHover: (
|
|
944
|
+
item: SelectorOptionData,
|
|
945
|
+
flatIndex: number,
|
|
946
|
+
isActive: boolean,
|
|
947
|
+
) => void;
|
|
930
948
|
}
|
|
931
949
|
|
|
932
950
|
/**
|
|
@@ -938,6 +956,7 @@ const SelectorOptionRow = memo(function SelectorOptionRow({
|
|
|
938
956
|
flatIndex,
|
|
939
957
|
id,
|
|
940
958
|
isHighlighted,
|
|
959
|
+
isKeyboardHighlighted,
|
|
941
960
|
isSelected,
|
|
942
961
|
size,
|
|
943
962
|
indicatorPosition,
|
|
@@ -979,7 +998,7 @@ const SelectorOptionRow = memo(function SelectorOptionRow({
|
|
|
979
998
|
aria-selected={isSelected}
|
|
980
999
|
aria-disabled={item.disabled}
|
|
981
1000
|
onClick={() => onSelect(item)}
|
|
982
|
-
onMouseEnter={() => onHover(item, flatIndex)}
|
|
1001
|
+
onMouseEnter={() => onHover(item, flatIndex, isHighlighted)}
|
|
983
1002
|
{...mergeProps(
|
|
984
1003
|
// Stable theme target on the option row itself, mirroring
|
|
985
1004
|
// `multi-selector-option`: it carries the row's size and runtime
|
|
@@ -998,6 +1017,7 @@ const SelectorOptionRow = memo(function SelectorOptionRow({
|
|
|
998
1017
|
styles.item,
|
|
999
1018
|
itemSizeStyles[size],
|
|
1000
1019
|
isHighlighted && styles.itemHighlighted,
|
|
1020
|
+
isKeyboardHighlighted && styles.itemKeyboardHighlighted,
|
|
1001
1021
|
isSelected && styles.itemSelected,
|
|
1002
1022
|
item.disabled && styles.itemDisabled,
|
|
1003
1023
|
),
|
|
@@ -1482,10 +1502,10 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1482
1502
|
highlightedIndex,
|
|
1483
1503
|
setHighlightedIndex,
|
|
1484
1504
|
getItemId,
|
|
1485
|
-
onTriggerClick,
|
|
1486
|
-
onKeyDown,
|
|
1505
|
+
onTriggerClick: comboboxTriggerClick,
|
|
1506
|
+
onKeyDown: comboboxKeyDown,
|
|
1487
1507
|
onItemSelect,
|
|
1488
|
-
onItemMouseEnter,
|
|
1508
|
+
onItemMouseEnter: comboboxItemMouseEnter,
|
|
1489
1509
|
} = useCombobox({
|
|
1490
1510
|
selectableItems: filteredItems,
|
|
1491
1511
|
// The optimistic value, not the raw prop: with a pending changeAction the
|
|
@@ -1504,6 +1524,44 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1504
1524
|
listboxId,
|
|
1505
1525
|
});
|
|
1506
1526
|
|
|
1527
|
+
// Only after keyboard input does the active option draw the focus ring; a
|
|
1528
|
+
// pointer highlight keeps the fill alone, as a focused menu row does.
|
|
1529
|
+
// Modality changes only on a key or a press, so a hover alone still reads
|
|
1530
|
+
// as keyboard. The option the mouse enters therefore draws no ring until a
|
|
1531
|
+
// key moves the highlight again. Entering the option that is already
|
|
1532
|
+
// active, as when a key scrolls it under a still mouse, changes nothing.
|
|
1533
|
+
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
|
|
1534
|
+
const keyDownAfterHover = useCallback(
|
|
1535
|
+
(e: React.KeyboardEvent) => {
|
|
1536
|
+
setHoveredIndex(null);
|
|
1537
|
+
comboboxKeyDown(e);
|
|
1538
|
+
},
|
|
1539
|
+
[comboboxKeyDown],
|
|
1540
|
+
);
|
|
1541
|
+
const mouseEnterOption = useCallback(
|
|
1542
|
+
(item: SelectorOptionData, index: number, isActive: boolean) => {
|
|
1543
|
+
if (!isActive) {
|
|
1544
|
+
setHoveredIndex(index);
|
|
1545
|
+
}
|
|
1546
|
+
comboboxItemMouseEnter(item, index);
|
|
1547
|
+
},
|
|
1548
|
+
[comboboxItemMouseEnter],
|
|
1549
|
+
);
|
|
1550
|
+
const {
|
|
1551
|
+
isKeyboardHighlight: isHighlightFromKeyboard,
|
|
1552
|
+
noteHighlightMove,
|
|
1553
|
+
onKeyDown,
|
|
1554
|
+
onItemMouseEnter,
|
|
1555
|
+
} = useKeyboardHighlight(
|
|
1556
|
+
triggerModality.readModality,
|
|
1557
|
+
keyDownAfterHover,
|
|
1558
|
+
mouseEnterOption,
|
|
1559
|
+
);
|
|
1560
|
+
const onTriggerClick = useCallback(() => {
|
|
1561
|
+
comboboxTriggerClick();
|
|
1562
|
+
noteHighlightMove();
|
|
1563
|
+
}, [comboboxTriggerClick, noteHighlightMove]);
|
|
1564
|
+
|
|
1507
1565
|
// Type-to-select, shared with the other collections (menus, listboxes).
|
|
1508
1566
|
// Open, it walks the highlight — aria-activedescendant announces each match.
|
|
1509
1567
|
// Closed, it commits the match like a native select, which changes the value
|
|
@@ -1563,7 +1621,8 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1563
1621
|
const index = optionIndexFromRow(row);
|
|
1564
1622
|
const item = filteredItems[index];
|
|
1565
1623
|
if (item != null) {
|
|
1566
|
-
|
|
1624
|
+
// A press is pointer input, even on the active option.
|
|
1625
|
+
onItemMouseEnter(item, index, false);
|
|
1567
1626
|
}
|
|
1568
1627
|
},
|
|
1569
1628
|
onActivate: row => {
|
|
@@ -1580,6 +1639,8 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1580
1639
|
if (isDisabled || isEffectivelyReadOnly) {
|
|
1581
1640
|
return;
|
|
1582
1641
|
}
|
|
1642
|
+
noteHighlightMove();
|
|
1643
|
+
setHoveredIndex(null);
|
|
1583
1644
|
// With hasSearch the query input owns typing, so type-to-select is off.
|
|
1584
1645
|
if (!hasSearch && typeahead.onKeyDown(e)) {
|
|
1585
1646
|
e.preventDefault();
|
|
@@ -1587,7 +1648,14 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1587
1648
|
}
|
|
1588
1649
|
onKeyDown(e);
|
|
1589
1650
|
},
|
|
1590
|
-
[
|
|
1651
|
+
[
|
|
1652
|
+
isDisabled,
|
|
1653
|
+
isEffectivelyReadOnly,
|
|
1654
|
+
hasSearch,
|
|
1655
|
+
typeahead,
|
|
1656
|
+
onKeyDown,
|
|
1657
|
+
noteHighlightMove,
|
|
1658
|
+
],
|
|
1591
1659
|
);
|
|
1592
1660
|
|
|
1593
1661
|
// Highlight scrolling (and its hover/keyboard split) lives in useCombobox.
|
|
@@ -1729,6 +1797,11 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1729
1797
|
flatIndex={flatIndex}
|
|
1730
1798
|
id={getItemId(flatIndex)}
|
|
1731
1799
|
isHighlighted={flatIndex === highlightedIndex}
|
|
1800
|
+
isKeyboardHighlighted={
|
|
1801
|
+
flatIndex === highlightedIndex &&
|
|
1802
|
+
isHighlightFromKeyboard &&
|
|
1803
|
+
flatIndex !== hoveredIndex
|
|
1804
|
+
}
|
|
1732
1805
|
isSelected={item.value === normalizedValue}
|
|
1733
1806
|
size={size}
|
|
1734
1807
|
indicatorPosition={indicatorPosition}
|
|
@@ -1742,6 +1815,8 @@ export function Selector<T extends SelectorOptionType>(
|
|
|
1742
1815
|
renderOption,
|
|
1743
1816
|
indicatorPosition,
|
|
1744
1817
|
highlightedIndex,
|
|
1818
|
+
isHighlightFromKeyboard,
|
|
1819
|
+
hoveredIndex,
|
|
1745
1820
|
size,
|
|
1746
1821
|
normalizedValue,
|
|
1747
1822
|
getItemId,
|
|
@@ -104,8 +104,8 @@ export const docs = {
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
name: 'resizable',
|
|
107
|
-
type: 'boolean | { defaultWidth?: number; minWidth?: number; maxWidth?: number; autoSaveId?: string; onWidthChange?: (width: number) => void; defaultIsCollapsed?: boolean; isCollapsed?: boolean; onCollapseChange?: (isCollapsed: boolean) => void }',
|
|
108
|
-
description: 'Enables a resize handle at the inline-end edge. true for defaults (260px initial, 180-480px range), or a ResizableConfig object (defaultWidth, minWidth, maxWidth, autoSaveId for localStorage persistence of width and collapse state, onWidthChange). It can also own collapse state (defaultIsCollapsed, isCollapsed + onCollapseChange); when both props carry collapse state, resizable wins and a dev warning names the conflicting keys. The handle is hidden while collapsed.',
|
|
107
|
+
type: 'boolean | { defaultWidth?: number; minWidth?: number; maxWidth?: number; autoSaveId?: string; onWidthChange?: (width: number) => void; defaultIsCollapsed?: boolean; isCollapsed?: boolean; onCollapseChange?: (isCollapsed: boolean) => void } | ResizableRegion',
|
|
108
|
+
description: 'Enables a resize handle at the inline-end edge. true for defaults (260px initial, 180-480px range), or a ResizableConfig object (defaultWidth, minWidth, maxWidth, autoSaveId for localStorage persistence of width and collapse state, onWidthChange). It can also own collapse state (defaultIsCollapsed, isCollapsed + onCollapseChange); when both props carry collapse state, resizable wins and a dev warning names the conflicting keys. It also takes the output of useResizable(), whose axis (\'horizontal\' | \'vertical\') must be \'horizontal\': that region then owns the width and the collapse state, so the rail follows its isCollapsed, the toggle calls its collapse and expand, and its autoSaveId saves the width. With the hook\'s output, the region\'s own collapsible option also decides whether the rail collapses; a collapsible prop that disagrees, or the collapse state it sets, is ignored, with a dev warning. The handle is hidden while collapsed.',
|
|
109
109
|
default: 'false',
|
|
110
110
|
},
|
|
111
111
|
{
|
package/src/SideNav/SideNav.tsx
CHANGED
|
@@ -46,8 +46,12 @@ import {
|
|
|
46
46
|
import {SideNavCollapseButton} from './SideNavCollapseButton';
|
|
47
47
|
import {useSideNavRenderMode} from './SideNavRenderContext';
|
|
48
48
|
import {MobileNav} from '../MobileNav/MobileNav';
|
|
49
|
-
import {
|
|
50
|
-
|
|
49
|
+
import {
|
|
50
|
+
isResizableRegion,
|
|
51
|
+
useResizable,
|
|
52
|
+
type ResizableConfig,
|
|
53
|
+
type ResizableRegion,
|
|
54
|
+
} from '../Resizable/useResizable';
|
|
51
55
|
import {ResizeHandle} from '../Resizable/ResizeHandle';
|
|
52
56
|
import {themeProps} from '../utils/themeProps';
|
|
53
57
|
import {SizeProvider} from '../SizeContext/SizeContext';
|
|
@@ -170,6 +174,54 @@ function describeCollapseConflict(
|
|
|
170
174
|
);
|
|
171
175
|
}
|
|
172
176
|
|
|
177
|
+
/**
|
|
178
|
+
* The collapse config when `resizable` is useResizable's output. The region
|
|
179
|
+
* owns the collapse state and decides whether the rail collapses. A
|
|
180
|
+
* `collapsible` prop that sets state or disagrees is ignored and named in a
|
|
181
|
+
* development warning.
|
|
182
|
+
*/
|
|
183
|
+
function resolveRegionCollapseConfig(
|
|
184
|
+
collapsible: boolean | SideNavCollapsibleConfig | undefined,
|
|
185
|
+
region: ResizableRegion,
|
|
186
|
+
): ResolvedCollapseConfig {
|
|
187
|
+
const fromCollapsible = typeof collapsible === 'object' ? collapsible : {};
|
|
188
|
+
const ignoredKeys = [
|
|
189
|
+
fromCollapsible.defaultIsCollapsed !== undefined && 'defaultIsCollapsed',
|
|
190
|
+
fromCollapsible.isCollapsed !== undefined && 'isCollapsed',
|
|
191
|
+
fromCollapsible.onCollapsedChange !== undefined && 'onCollapsedChange',
|
|
192
|
+
].filter((key): key is string => key !== false);
|
|
193
|
+
// The region's own `collapsible` option decides whether the rail collapses.
|
|
194
|
+
const isRegionCollapsible = region.props._collapsible ?? false;
|
|
195
|
+
const conflicts: string[] = [];
|
|
196
|
+
if (ignoredKeys.length > 0) {
|
|
197
|
+
conflicts.push(
|
|
198
|
+
`\`collapsible\` sets ${ignoredKeys.map(key => `\`${key}\``).join(', ')}, ` +
|
|
199
|
+
'which the rail ignores: it follows the region.',
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
if (
|
|
203
|
+
collapsible !== undefined &&
|
|
204
|
+
Boolean(collapsible) !== isRegionCollapsible
|
|
205
|
+
) {
|
|
206
|
+
conflicts.push(
|
|
207
|
+
isRegionCollapsible
|
|
208
|
+
? '`collapsible` is false, but the region is collapsible, so the rail still collapses.'
|
|
209
|
+
: '`collapsible` turns collapse on, but the region is not collapsible, so the rail never collapses.',
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
isCollapsible: isRegionCollapsible,
|
|
214
|
+
defaultIsCollapsed: region.isCollapsed,
|
|
215
|
+
isCollapsed: undefined,
|
|
216
|
+
onCollapsedChange: undefined,
|
|
217
|
+
conflict:
|
|
218
|
+
conflicts.length === 0
|
|
219
|
+
? null
|
|
220
|
+
: "`resizable` is useResizable's output, which owns the collapse " +
|
|
221
|
+
`state and decides whether the rail collapses. ${conflicts.join(' ')}`,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
173
225
|
// =============================================================================
|
|
174
226
|
// Styles
|
|
175
227
|
// =============================================================================
|
|
@@ -397,12 +449,18 @@ export interface SideNavProps extends BaseProps<HTMLElement> {
|
|
|
397
449
|
* - `defaultIsCollapsed` / `isCollapsed` / `onCollapseChange` — collapse
|
|
398
450
|
* state, when `resizable` should own it rather than `collapsible`
|
|
399
451
|
*
|
|
452
|
+
* - `useResizable()`'s output — the caller's region owns the width and the
|
|
453
|
+
* collapse state. The rail follows its `isCollapsed`, the toggle calls
|
|
454
|
+
* its `collapse` and `expand`, and its `autoSaveId` saves the width.
|
|
455
|
+
* The region's own `collapsible` option also decides whether the rail
|
|
456
|
+
* collapses
|
|
457
|
+
*
|
|
400
458
|
* When both props carry collapse state, `resizable` wins and a dev warning
|
|
401
459
|
* names the conflicting keys.
|
|
402
460
|
*
|
|
403
461
|
* @default false
|
|
404
462
|
*/
|
|
405
|
-
resizable?: boolean | ResizableConfig;
|
|
463
|
+
resizable?: boolean | ResizableConfig | ResizableRegion;
|
|
406
464
|
|
|
407
465
|
/**
|
|
408
466
|
* Enables collapse behavior. The sidebar can be collapsed to a narrow
|
|
@@ -469,7 +527,7 @@ export function SideNav({
|
|
|
469
527
|
children,
|
|
470
528
|
footer,
|
|
471
529
|
footerIcons,
|
|
472
|
-
collapsible
|
|
530
|
+
collapsible: collapsibleProp,
|
|
473
531
|
resizable = false,
|
|
474
532
|
xstyle,
|
|
475
533
|
className,
|
|
@@ -480,15 +538,29 @@ export function SideNav({
|
|
|
480
538
|
...props
|
|
481
539
|
}: SideNavProps) {
|
|
482
540
|
const t = useComponentTranslator();
|
|
541
|
+
// Only a left-out `collapsible` becomes false, as before; `??` would also
|
|
542
|
+
// turn null into false.
|
|
543
|
+
const collapsible = collapsibleProp === undefined ? false : collapsibleProp;
|
|
483
544
|
// Parse collapsible prop
|
|
484
545
|
const collapsibleConfig = typeof collapsible === 'object' ? collapsible : {};
|
|
485
546
|
const hasCollapseButton = collapsibleConfig.hasButton ?? true;
|
|
486
547
|
|
|
548
|
+
// useResizable's output: the caller's region owns the width and collapse.
|
|
549
|
+
const ownerRegion = isResizableRegion(resizable) ? resizable : null;
|
|
487
550
|
// Resizable config
|
|
488
|
-
const resizableConfig =
|
|
551
|
+
const resizableConfig: ResizableConfig =
|
|
552
|
+
typeof resizable === 'object' && !isResizableRegion(resizable)
|
|
553
|
+
? resizable
|
|
554
|
+
: {};
|
|
489
555
|
const isResizable = !!resizable;
|
|
490
556
|
|
|
491
|
-
const collapseConfig =
|
|
557
|
+
const collapseConfig =
|
|
558
|
+
ownerRegion == null
|
|
559
|
+
? resolveCollapseConfig(
|
|
560
|
+
collapsible,
|
|
561
|
+
isResizableRegion(resizable) ? false : resizable,
|
|
562
|
+
)
|
|
563
|
+
: resolveRegionCollapseConfig(collapsibleProp, ownerRegion);
|
|
492
564
|
const {isCollapsible, onCollapsedChange} = collapseConfig;
|
|
493
565
|
|
|
494
566
|
useDevWarning(
|
|
@@ -534,6 +606,8 @@ export function SideNav({
|
|
|
534
606
|
|
|
535
607
|
// useResizable is the sole collapse owner in every SideNav mode. Keeping that
|
|
536
608
|
// owner mounted when resize is toggled preserves the current collapse state.
|
|
609
|
+
// Given the hook's output, the caller's region is the owner, and this one
|
|
610
|
+
// stays idle.
|
|
537
611
|
const resizableHook = useResizable({
|
|
538
612
|
defaultSize: resizableConfig.defaultWidth ?? 260,
|
|
539
613
|
minSize: resizableConfig.minWidth ?? 180,
|
|
@@ -547,7 +621,8 @@ export function SideNav({
|
|
|
547
621
|
onCollapseChange: onCollapsedChange,
|
|
548
622
|
});
|
|
549
623
|
|
|
550
|
-
const
|
|
624
|
+
const region = ownerRegion ?? resizableHook;
|
|
625
|
+
const collapsed = region.isCollapsed;
|
|
551
626
|
|
|
552
627
|
// A collapse or expand plays the rail's motion, except an app's change
|
|
553
628
|
// before the rail's first paint. It is measured in the commit before the
|
|
@@ -752,11 +827,11 @@ export function SideNav({
|
|
|
752
827
|
};
|
|
753
828
|
|
|
754
829
|
if (next) {
|
|
755
|
-
|
|
830
|
+
region.collapse();
|
|
756
831
|
} else {
|
|
757
|
-
|
|
832
|
+
region.expand();
|
|
758
833
|
}
|
|
759
|
-
}, [collapsed,
|
|
834
|
+
}, [collapsed, region]);
|
|
760
835
|
|
|
761
836
|
const showResizeHandle = isResizable && !collapsed;
|
|
762
837
|
|
|
@@ -875,7 +950,7 @@ export function SideNav({
|
|
|
875
950
|
|
|
876
951
|
// When resizable, override the nav width via inline style
|
|
877
952
|
const resizableNavStyle: React.CSSProperties | undefined = isResizable
|
|
878
|
-
? {...(style ?? {}), width: collapsed ? undefined :
|
|
953
|
+
? {...(style ?? {}), width: collapsed ? undefined : region.size}
|
|
879
954
|
: style;
|
|
880
955
|
|
|
881
956
|
const navElement = (
|
|
@@ -957,7 +1032,7 @@ export function SideNav({
|
|
|
957
1032
|
pillPlacement="end"
|
|
958
1033
|
isAlwaysVisible={false}
|
|
959
1034
|
xstyle={styles.resizableHandle}
|
|
960
|
-
resizable={resizableHook.props}
|
|
1035
|
+
resizable={ownerRegion ?? resizableHook.props}
|
|
961
1036
|
label={t('@astryx.sideNav.resizeSidebar')}
|
|
962
1037
|
aria-controls={navId}
|
|
963
1038
|
/>
|
|
@@ -29,7 +29,7 @@ import {TapGestureRecognizer} from '../gestures/TapGestureRecognizer';
|
|
|
29
29
|
import type {PointerKind} from '../gestures/types';
|
|
30
30
|
import {isRtlElement} from '../hooks/isRtlElement';
|
|
31
31
|
import {
|
|
32
|
-
|
|
32
|
+
createMotionEngine,
|
|
33
33
|
type Animator,
|
|
34
34
|
type MotionCurve,
|
|
35
35
|
type MotionHandle,
|
|
@@ -1186,7 +1186,7 @@ export class SliderTouchController {
|
|
|
1186
1186
|
private animatorFor(element: HTMLElement): Animator {
|
|
1187
1187
|
let animator = this.animators.get(element);
|
|
1188
1188
|
if (animator == null) {
|
|
1189
|
-
animator =
|
|
1189
|
+
animator = createMotionEngine(element);
|
|
1190
1190
|
this.animators.set(element, animator);
|
|
1191
1191
|
}
|
|
1192
1192
|
return animator;
|