@astryxdesign/core 0.7.7 → 0.7.8-canary.0588a13
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/AlertDialog/AlertDialog.d.ts +4 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +46 -6
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +11 -3
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +1 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +55 -18
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +5 -0
- package/dist/BottomSheet/bottomSheetStack.js +1 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +16 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +17 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +18 -22
- package/dist/Calendar/getWeekdayHeaderNames.d.ts +16 -0
- package/dist/Calendar/getWeekdayHeaderNames.d.ts.map +1 -0
- package/dist/Calendar/getWeekdayHeaderNames.js +70 -0
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +2 -10
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.d.ts → weekdayHeaderNames.generated.d.ts} +14 -14
- package/dist/Calendar/weekdayHeaderNames.generated.d.ts.map +1 -0
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.js → weekdayHeaderNames.generated.js} +12 -12
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -0
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +2 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useChatDictation.js +2 -0
- package/dist/Chat/useChatNewMessages.js +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +2 -0
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +3 -0
- package/dist/Chat/useTriggerMenu.js +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +17 -12
- package/dist/CheckboxList/CheckboxList.d.ts +20 -2
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +12 -4
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +14 -2
- package/dist/CheckboxList/requiredGroup.d.ts +22 -0
- package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
- package/dist/CheckboxList/requiredGroup.js +52 -0
- package/dist/CodeBlock/CodeBlock.d.ts +10 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +28 -11
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +2 -0
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +2 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +14 -4
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +5 -2
- package/dist/DateInput/PickerWheel.d.ts +19 -0
- package/dist/DateInput/PickerWheel.d.ts.map +1 -0
- package/dist/DateInput/PickerWheel.js +646 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +9 -30
- package/dist/DateInput/Wheel.d.ts +18 -37
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +133 -120
- package/dist/DateInput/datePickerTouch.d.ts +13 -0
- package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
- package/dist/DateInput/datePickerTouch.js +14 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +10 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -1
- package/dist/DateInput/useOwnScrollGesture.js +16 -3
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +2 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
- package/dist/DateInput/useScrollSettle.js +3 -0
- package/dist/DateInput/useWheelListbox.d.ts +59 -0
- package/dist/DateInput/useWheelListbox.d.ts.map +1 -0
- package/dist/DateInput/useWheelListbox.js +88 -0
- package/dist/DateInput/wheelOptions.d.ts +94 -0
- package/dist/DateInput/wheelOptions.d.ts.map +1 -0
- package/dist/DateInput/wheelOptions.js +110 -0
- package/dist/DateInput/wheelPhysics.d.ts +127 -0
- package/dist/DateInput/wheelPhysics.d.ts.map +1 -0
- package/dist/DateInput/wheelPhysics.js +341 -0
- package/dist/DateInput/wheelStrip.d.ts +92 -0
- package/dist/DateInput/wheelStrip.d.ts.map +1 -0
- package/dist/DateInput/wheelStrip.js +258 -0
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +70 -127
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -32
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +3 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
- package/dist/DropdownMenu/useMenuOverflow.js +5 -0
- package/dist/Field/Field.js +2 -2
- package/dist/FieldStatus/useFieldStatusAnnouncement.d.ts.map +1 -1
- package/dist/FieldStatus/useFieldStatusAnnouncement.js +1 -0
- package/dist/FormLayout/FormLayout.d.ts +5 -1
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.d.ts +6 -4
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +48 -3
- package/dist/HoverCard/useHoverCard.d.ts +5 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +26 -34
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +20 -3
- package/dist/InfoTip/InfoTip.d.ts +5 -5
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +58 -19
- package/dist/Item/useSwipeAction.d.ts.map +1 -1
- package/dist/Item/useSwipeAction.js +3 -0
- package/dist/Layer/modalOutlet.d.ts.map +1 -1
- package/dist/Layer/modalOutlet.js +2 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +1 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +4 -1
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -1
- package/dist/Layer/useLayerDismissal.js +3 -0
- package/dist/Layer/useTouchTrigger.d.ts +13 -7
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +20 -6
- package/dist/Layout/index.d.ts +1 -1
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +1 -1
- package/dist/Layout/layoutReset.js +1 -1
- package/dist/Layout/overlayPaddingReset.stylex.d.ts +68 -0
- package/dist/Layout/overlayPaddingReset.stylex.d.ts.map +1 -0
- package/dist/Layout/overlayPaddingReset.stylex.js +72 -0
- package/dist/Layout/padding.stylex.d.ts +5 -129
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +9 -143
- package/dist/Layout/paddingStyles.stylex.d.ts +83 -0
- package/dist/Layout/paddingStyles.stylex.d.ts.map +1 -0
- package/dist/Layout/paddingStyles.stylex.js +99 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +20 -1
- package/dist/MobileNav/MobileNav.d.ts +3 -2
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +10 -26
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +2 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +2 -1
- package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.js +3 -0
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +3 -0
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +3 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +7 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +6 -0
- package/dist/Popover/usePopover.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts +41 -4
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +441 -134
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +125 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +2041 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +35 -2
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +43 -10
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -2
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +273 -86
- package/dist/PowerSearch/formatFilterValue.d.ts +14 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +31 -23
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +161 -0
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/powerSearchDateZone.d.ts +25 -0
- package/dist/PowerSearch/powerSearchDateZone.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchDateZone.js +57 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
- package/dist/PowerSearch/types.d.ts +8 -1
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBarTouch.js +2 -0
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -2
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -3
- package/dist/Resizable/ResizeHandle.d.ts +2 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +116 -92
- package/dist/Resizable/createResizable.d.ts +199 -0
- package/dist/Resizable/createResizable.d.ts.map +1 -0
- package/dist/Resizable/createResizable.js +733 -0
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.d.ts +3 -3
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +252 -459
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/SelectableCard/SelectableCard.d.ts +2 -0
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +36 -11
- package/dist/SelectableCard/selectableCardInput.d.ts +12 -0
- package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -0
- package/dist/SelectableCard/selectableCardInput.js +20 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +7 -9
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +36 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +16 -11
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +60 -58
- package/dist/Stepper/Stepper.d.ts.map +1 -1
- package/dist/Stepper/Stepper.js +10 -15
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -10
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +3 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +12 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +17 -3
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +27 -14
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -1
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +12 -8
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +2 -0
- package/dist/TimeInput/TimeWheels.d.ts +32 -0
- package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
- package/dist/TimeInput/TimeWheels.js +144 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +63 -116
- package/dist/TimeInput/timeWheelRules.d.ts +124 -0
- package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
- package/dist/TimeInput/timeWheelRules.js +277 -0
- package/dist/Timer/Timer.d.ts.map +1 -1
- package/dist/Timer/Timer.js +2 -0
- package/dist/Timestamp/Timestamp.js +1 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +1 -23
- package/dist/Toast/Toast.d.ts +11 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +25 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +97 -34
- package/dist/Toast/types.d.ts +9 -3
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +1 -0
- package/dist/Tokenizer/Tokenizer.d.ts +44 -46
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +20 -21
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +12 -18
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.d.ts +2 -23
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -29
- package/dist/Tooltip/useTooltip.d.ts +23 -30
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +200 -108
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +27 -18
- package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/animator/createAnimator.d.ts +98 -0
- package/dist/animator/createAnimator.d.ts.map +1 -0
- package/dist/animator/createAnimator.js +259 -0
- package/dist/astryx.css +53 -8
- package/dist/gestures/GestureHost.d.ts +16 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +4 -1
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +4 -3
- package/dist/hooks/ModalAnnounceProvider.d.ts.map +1 -1
- package/dist/hooks/ModalAnnounceProvider.js +1 -0
- package/dist/hooks/actionGroupTracker.d.ts +4 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +18 -7
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/longPressDetector.d.ts +66 -0
- package/dist/hooks/longPressDetector.d.ts.map +1 -0
- package/dist/hooks/longPressDetector.js +200 -0
- package/dist/hooks/pressGroupContext.d.ts +6 -0
- package/dist/hooks/pressGroupContext.d.ts.map +1 -0
- package/dist/hooks/pressGroupContext.js +20 -0
- package/dist/hooks/rootScrollStyles.d.ts +48 -0
- package/dist/hooks/rootScrollStyles.d.ts.map +1 -0
- package/dist/hooks/rootScrollStyles.js +207 -0
- package/dist/hooks/scrollLockTouchGuard.d.ts +13 -0
- package/dist/hooks/scrollLockTouchGuard.d.ts.map +1 -0
- package/dist/hooks/scrollLockTouchGuard.js +117 -0
- package/dist/hooks/scrollbarGutter.d.ts +4 -4
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -1
- package/dist/hooks/scrollbarGutter.js +36 -23
- package/dist/hooks/useActionGroupTracking.d.ts +53 -0
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
- package/dist/hooks/useActionGroupTracking.js +174 -0
- package/dist/hooks/useAnimator.d.ts +41 -0
- package/dist/hooks/useAnimator.d.ts.map +1 -0
- package/dist/hooks/useAnimator.js +70 -0
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +1 -0
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
- package/dist/hooks/useAutoMediaMode.js +1 -0
- package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
- package/dist/hooks/useBusyAnnouncement.js +2 -0
- package/dist/hooks/useDevWarning.d.ts.map +1 -1
- package/dist/hooks/useDevWarning.js +2 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +2 -0
- package/dist/hooks/useGridFocus.d.ts +8 -5
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +4 -3
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +3 -0
- package/dist/hooks/useImageMode.d.ts.map +1 -1
- package/dist/hooks/useImageMode.js +3 -0
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +1 -1
- package/dist/hooks/useLongPress.d.ts +8 -9
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +23 -106
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +2 -0
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +3 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +2 -1
- package/dist/hooks/usePressFeedback.d.ts.map +1 -1
- package/dist/hooks/usePressFeedback.js +1 -0
- package/dist/hooks/useResolvedRequired.d.ts +3 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -1
- package/dist/hooks/useResolvedRequired.js +3 -0
- package/dist/hooks/useScrollLock.d.ts +8 -9
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +50 -48
- package/dist/hooks/useScrollableArea.d.ts.map +1 -1
- package/dist/hooks/useScrollableArea.js +5 -0
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +3 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +45 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.js +3 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.js +3 -1
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +37 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +37 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/internal/indicatorPress.stylex.d.ts +20 -0
- package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
- package/dist/internal/indicatorPress.stylex.js +26 -0
- package/dist/internal/selectable-card.d.ts +21 -0
- package/dist/internal/selectable-card.d.ts.map +1 -0
- package/dist/internal/selectable-card.js +20 -0
- package/dist/internal/sheetDraft.d.ts +2 -2
- package/dist/internal/sheetDraft.js +2 -2
- package/dist/keyboard/index.d.ts +17 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/keyboard/index.js +19 -0
- package/dist/keyboard/keyboardHeight.d.ts +149 -0
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
- package/dist/keyboard/keyboardHeight.js +432 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
- package/dist/keyboard/keyboardLayoutGuide.js +207 -0
- package/dist/keyboard/keyboardModel.d.ts +93 -0
- package/dist/keyboard/keyboardModel.d.ts.map +1 -0
- package/dist/keyboard/keyboardModel.js +220 -0
- package/dist/keyboard/rideKeyboard.d.ts +42 -0
- package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
- package/dist/keyboard/rideKeyboard.js +77 -0
- package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
- package/dist/keyboard/useMobileKeyboard.js +699 -0
- package/dist/motion/android/index.d.ts +16 -0
- package/dist/motion/android/index.d.ts.map +1 -0
- package/dist/motion/android/index.js +18 -0
- package/dist/motion/android/keyboard.d.ts +83 -0
- package/dist/motion/android/keyboard.d.ts.map +1 -0
- package/dist/motion/android/keyboard.js +96 -0
- package/dist/motion/animatedLayout.d.ts +8 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +246 -53
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +45 -26
- package/dist/motion/frameBlock.d.ts +14 -0
- package/dist/motion/frameBlock.d.ts.map +1 -0
- package/dist/motion/frameBlock.js +16 -0
- package/dist/motion/progress.d.ts +88 -0
- package/dist/motion/progress.d.ts.map +1 -0
- package/dist/motion/progress.js +128 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +3 -1
- package/dist/motion/uikit/alert.d.ts +41 -0
- package/dist/motion/uikit/alert.d.ts.map +1 -0
- package/dist/motion/uikit/alert.js +43 -0
- package/dist/motion/uikit/datePicker.d.ts +58 -0
- package/dist/motion/uikit/datePicker.d.ts.map +1 -0
- package/dist/motion/uikit/datePicker.js +60 -0
- package/dist/motion/uikit/index.d.ts +6 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +6 -4
- package/dist/motion/uikit/picker.d.ts +96 -0
- package/dist/motion/uikit/picker.d.ts.map +1 -0
- package/dist/motion/uikit/picker.js +117 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +22 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +36 -0
- package/dist/privateAttributes/reducedMotion.stylex.d.ts +23 -0
- package/dist/privateAttributes/reducedMotion.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/reducedMotion.stylex.js +40 -0
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +29 -4
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -13
- package/dist/theme/motionKnobs.d.ts +4 -3
- package/dist/theme/motionKnobs.d.ts.map +1 -1
- package/dist/theme/motionKnobs.js +3 -2
- package/dist/theme/themeMotion.d.ts +6 -0
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +15 -2
- package/dist/theme/tokens.stylex.d.ts +3 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +4 -1
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/disabledInteraction.d.ts +10 -2
- package/dist/utils/disabledInteraction.d.ts.map +1 -1
- package/dist/utils/disabledInteraction.js +16 -2
- package/dist/utils/focusReturn.d.ts +22 -25
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +36 -29
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +4 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +6 -4
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +6 -4
- package/dist/utils/isFocusDetached.d.ts +27 -0
- package/dist/utils/isFocusDetached.d.ts.map +1 -0
- package/dist/utils/isFocusDetached.js +32 -0
- package/dist/utils/layoutViewport.d.ts +25 -0
- package/dist/utils/layoutViewport.d.ts.map +1 -0
- package/dist/utils/layoutViewport.js +102 -0
- package/dist/utils/plainDate.d.ts +31 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +68 -4
- package/dist/utils/pressFeedback.d.ts +6 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +97 -18
- package/dist/utils/pressGesture.d.ts +4 -2
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +3 -1
- package/dist/utils/selectionLock.d.ts +10 -1
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +31 -5
- package/dist/utils/sharedMutationObserver.d.ts +2 -1
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +2 -1
- package/dist/utils/timeParser.d.ts +2 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +29 -3
- package/dist/utils/triggerFocus.d.ts +36 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -0
- package/dist/utils/triggerFocus.js +65 -0
- package/locales/en.json +148 -0
- package/locales/pseudo.json +111 -0
- package/package.json +14 -9
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +46 -5
- package/src/AppShell/AppShell.tsx +13 -4
- package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
- package/src/BottomSheet/BottomSheet.tsx +1 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +80 -16
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/BottomSheet/BottomSheetSwitcher.tsx +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +1 -1
- package/src/BottomSheet/useSheetGestures.ts +16 -1
- package/src/Button/Button.tsx +26 -4
- package/src/Calendar/Calendar.tsx +40 -32
- package/src/Calendar/getWeekdayHeaderNames.ts +88 -0
- package/src/Calendar/hooks/useCalendarDays.ts +5 -10
- package/src/Calendar/{standaloneShortWeekdayNames.generated.ts → weekdayHeaderNames.generated.ts} +14 -14
- package/src/Carousel/Carousel.tsx +1 -0
- package/src/Chat/ChatComposerInput.tsx +4 -7
- package/src/Chat/ChatMessageList.tsx +2 -1
- package/src/Chat/useChatDictation.ts +1 -0
- package/src/Chat/useChatNewMessages.ts +1 -1
- package/src/Chat/useChatStreamScroll.ts +2 -0
- package/src/Chat/useSpeechRecognition.ts +2 -0
- package/src/Chat/useTriggerMenu.tsx +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.tsx +38 -15
- package/src/CheckboxList/CheckboxList.doc.mjs +14 -0
- package/src/CheckboxList/CheckboxList.tsx +43 -2
- package/src/CheckboxList/CheckboxListContext.tsx +9 -1
- package/src/CheckboxList/CheckboxListItem.tsx +23 -2
- package/src/CheckboxList/requiredGroup.ts +77 -0
- package/src/CodeBlock/CodeBlock.doc.mjs +9 -1
- package/src/CodeBlock/CodeBlock.tsx +41 -4
- package/src/CommandPalette/CommandPalette.tsx +1 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -0
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/DateInput/MonthScroller.tsx +8 -2
- package/src/DateInput/PickerWheel.tsx +796 -0
- package/src/DateInput/TouchDateField.tsx +6 -32
- package/src/DateInput/Wheel.tsx +188 -171
- package/src/DateInput/datePickerTouch.ts +15 -0
- package/src/DateInput/useOwnScrollGesture.ts +25 -3
- package/src/DateInput/usePointerDragScroll.ts +1 -0
- package/src/DateInput/useScrollSettle.ts +2 -0
- package/src/DateInput/useWheelListbox.ts +112 -0
- package/src/DateInput/wheelOptions.ts +184 -0
- package/src/DateInput/wheelPhysics.ts +406 -0
- package/src/DateInput/wheelStrip.ts +341 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +100 -189
- package/src/Dialog/Dialog.tsx +12 -32
- package/src/Drawer/useDrawerDialogPresence.ts +2 -0
- package/src/DropdownMenu/useMenuOverflow.ts +3 -0
- package/src/Field/Field.tsx +2 -2
- package/src/FieldStatus/useFieldStatusAnnouncement.ts +1 -0
- package/src/FormLayout/FormLayout.doc.mjs +181 -46
- package/src/FormLayout/FormLayout.tsx +5 -1
- package/src/HoverCard/HoverCard.doc.mjs +10 -8
- package/src/HoverCard/HoverCard.tsx +58 -6
- package/src/HoverCard/useHoverCard.doc.mjs +178 -36
- package/src/HoverCard/useHoverCard.tsx +55 -55
- package/src/Icon/Icon.doc.mjs +51 -10
- package/src/Icon/Icon.tsx +31 -8
- package/src/IconButton/IconButton.doc.mjs +141 -21
- package/src/InfoTip/InfoTip.tsx +72 -16
- package/src/Item/useSwipeAction.ts +2 -0
- package/src/Layer/modalOutlet.ts +2 -0
- package/src/Layer/outsidePress.ts +1 -0
- package/src/Layer/useLayer.tsx +3 -1
- package/src/Layer/useLayerDismissal.ts +2 -0
- package/src/Layer/useTouchTrigger.ts +19 -6
- package/src/Layout/index.ts +1 -1
- package/src/Layout/layoutReset.ts +1 -1
- package/src/Layout/overlayPaddingReset.stylex.ts +73 -0
- package/src/Layout/padding.stylex.ts +9 -133
- package/src/Layout/paddingStyles.stylex.ts +87 -0
- package/src/Lightbox/Lightbox.tsx +20 -1
- package/src/Lightbox/useLightbox.doc.mjs +167 -0
- package/src/MobileNav/MobileNav.tsx +10 -31
- package/src/MultiSelector/MultiSelector.tsx +2 -7
- package/src/NumberInput/NumberInput.tsx +2 -7
- package/src/Outline/useOutlineFromDOM.ts +2 -0
- package/src/Outline/useScrollSpy.ts +2 -0
- package/src/OverflowList/OverflowList.tsx +2 -0
- package/src/Overlay/Overlay.tsx +7 -2
- package/src/Popover/Popover.tsx +4 -0
- package/src/Popover/usePopover.tsx +2 -2
- package/src/PowerSearch/PowerSearch.doc.mjs +60 -8
- package/src/PowerSearch/PowerSearch.tsx +622 -157
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2700 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +65 -9
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +2 -0
- package/src/PowerSearch/PowerSearchToken.tsx +2 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +340 -59
- package/src/PowerSearch/formatFilterValue.ts +49 -27
- package/src/PowerSearch/formatTokenValue.ts +220 -0
- package/src/PowerSearch/index.ts +5 -1
- package/src/PowerSearch/powerSearchDateZone.ts +95 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/PowerSearch/types.ts +8 -1
- package/src/ProgressBar/ProgressBarTouch.ts +2 -0
- package/src/RadioList/RadioList.tsx +3 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/Resizable/Resizable.doc.mjs +5 -4
- package/src/Resizable/ResizeHandle.tsx +187 -135
- package/src/Resizable/createResizable.ts +1046 -0
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +292 -623
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +6 -3
- package/src/SelectableCard/SelectableCard.tsx +39 -10
- package/src/SelectableCard/selectableCardInput.ts +30 -0
- package/src/Selector/Selector.tsx +7 -19
- package/src/SideNav/SideNav.tsx +41 -5
- package/src/Slider/Slider.tsx +20 -11
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- package/src/Stepper/Stepper.tsx +10 -27
- package/src/Switch/Switch.tsx +2 -6
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +46 -12
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +1 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +31 -7
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +2 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -20
- package/src/Table/useTableRowExpansion.doc.mjs +9 -0
- package/src/Table/useTableTreeData.doc.mjs +15 -3
- package/src/TextArea/TextArea.tsx +2 -7
- package/src/TextInput/TextInput.tsx +13 -17
- package/src/TimeInput/TimeInput.tsx +2 -0
- package/src/TimeInput/TimeWheels.tsx +218 -0
- package/src/TimeInput/TouchTimeField.tsx +93 -155
- package/src/TimeInput/timeWheelRules.ts +352 -0
- package/src/Timer/Timer.tsx +1 -0
- package/src/Timestamp/Timestamp.tsx +1 -1
- package/src/Timestamp/formatInstant.ts +1 -33
- package/src/Toast/Toast.doc.mjs +4 -3
- package/src/Toast/Toast.tsx +52 -32
- package/src/Toast/ToastViewport.tsx +123 -35
- package/src/Toast/types.ts +9 -3
- package/src/Toast/useToast.tsx +1 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +10 -10
- package/src/Tokenizer/Tokenizer.tsx +61 -62
- package/src/Tokenizer/TokenizerBottomSheet.tsx +17 -23
- package/src/Tokenizer/index.ts +1 -0
- package/src/Tooltip/Tooltip.tsx +6 -42
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +243 -134
- package/src/Typeahead/BaseTypeahead.tsx +27 -17
- package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/animator/createAnimator.doc.mjs +153 -0
- package/src/animator/createAnimator.ts +324 -0
- package/src/gestures/GestureHost.ts +6 -5
- package/src/gestures/PressTracker.ts +4 -3
- package/src/gestures/README.md +10 -4
- package/src/hooks/ModalAnnounceProvider.tsx +1 -0
- package/src/hooks/actionGroupTracker.ts +25 -9
- package/src/hooks/index.ts +2 -0
- package/src/hooks/longPressDetector.ts +273 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- package/src/hooks/rootScrollStyles.ts +247 -0
- package/src/hooks/scrollLockTouchGuard.ts +149 -0
- package/src/hooks/scrollbarGutter.ts +41 -26
- package/src/hooks/useActionGroupTracking.ts +224 -0
- package/src/hooks/useAnimator.doc.mjs +109 -0
- package/src/hooks/useAnimator.ts +67 -0
- package/src/hooks/useAnnounceRenderedText.ts +1 -0
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useAutoMediaMode.ts +1 -0
- package/src/hooks/useBusyAnnouncement.ts +2 -0
- package/src/hooks/useDevWarning.ts +2 -0
- package/src/hooks/useFocusTrap.ts +2 -0
- package/src/hooks/useGridFocus.doc.mjs +6 -6
- package/src/hooks/useGridFocus.ts +10 -7
- package/src/hooks/useHotkeys.ts +2 -0
- package/src/hooks/useImageMode.ts +2 -0
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useKeyboardHint.tsx +1 -1
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +32 -122
- package/src/hooks/useMenuHover.ts +1 -0
- package/src/hooks/useMenuPress.ts +2 -0
- package/src/hooks/useOverflow.ts +2 -1
- package/src/hooks/usePressFeedback.ts +1 -0
- package/src/hooks/useResolvedRequired.ts +3 -0
- package/src/hooks/useScrollLock.doc.mjs +51 -12
- package/src/hooks/useScrollLock.ts +53 -60
- package/src/hooks/useScrollableArea.ts +4 -0
- package/src/hooks/useStreamingText.ts +2 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +46 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
- package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.ts +3 -1
- package/src/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.ts +3 -1
- package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
- package/src/i18n/generated-locales/en.generated.ts +47 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +48 -0
- package/src/index.ts +13 -0
- package/src/internal/indicatorPress.stylex.ts +24 -0
- package/src/internal/selectable-card.ts +21 -0
- package/src/internal/sheetDraft.ts +2 -2
- package/src/keyboard/README.md +197 -0
- package/src/keyboard/index.ts +48 -0
- package/src/keyboard/keyboardHeight.ts +543 -0
- package/src/keyboard/keyboardLayoutGuide.ts +266 -0
- package/src/keyboard/keyboardModel.ts +301 -0
- package/src/keyboard/rideKeyboard.ts +100 -0
- package/src/keyboard/useMobileKeyboard.ts +866 -0
- package/src/motion/MEASUREMENTS.md +28 -0
- package/src/motion/README.md +12 -5
- package/src/motion/android/index.ts +18 -0
- package/src/motion/android/keyboard.ts +96 -0
- package/src/motion/animatedLayout.ts +323 -60
- package/src/motion/animator.ts +66 -37
- package/src/motion/frameBlock.ts +16 -0
- package/src/motion/progress.ts +155 -0
- package/src/motion/reducedMotion.ts +3 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/motion/uikit/datePicker.ts +60 -0
- package/src/motion/uikit/index.ts +6 -4
- package/src/motion/uikit/picker.ts +116 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +44 -0
- package/src/privateAttributes/reducedMotion.stylex.ts +45 -0
- package/src/theme/Theme.tsx +37 -3
- package/src/theme/generateThemeRules.ts +14 -12
- package/src/theme/motionKnobs.ts +4 -3
- package/src/theme/themeMotion.ts +17 -2
- package/src/theme/tokens.stylex.ts +2 -0
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/disabledInteraction.ts +23 -2
- package/src/utils/focusReturn.ts +38 -31
- package/src/utils/index.ts +1 -1
- package/src/utils/interactionModality.ts +4 -0
- package/src/utils/interactionOverlay.stylex.ts +6 -4
- package/src/utils/isFocusDetached.ts +34 -0
- package/src/utils/layoutViewport.ts +104 -0
- package/src/utils/plainDate.ts +80 -4
- package/src/utils/pressFeedback.ts +126 -30
- package/src/utils/pressGesture.ts +4 -2
- package/src/utils/selectionLock.ts +40 -6
- package/src/utils/sharedMutationObserver.ts +2 -1
- package/src/utils/timeParser.ts +40 -3
- package/src/utils/triggerFocus.ts +80 -0
- package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
- package/dist/BottomSheet/useMobileKeyboard.js +0 -407
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +0 -14
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +0 -1
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +0 -26
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +0 -1
- package/dist/Layer/usePressPin.d.ts +0 -93
- package/dist/Layer/usePressPin.d.ts.map +0 -1
- package/dist/Layer/usePressPin.js +0 -363
- package/dist/internal/touch-sheet.d.ts +0 -21
- package/dist/internal/touch-sheet.d.ts.map +0 -1
- package/dist/internal/touch-sheet.js +0 -19
- package/src/BottomSheet/useMobileKeyboard.ts +0 -538
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +0 -38
- package/src/Layer/usePressPin.ts +0 -510
- package/src/internal/touch-sheet.ts +0 -21
|
@@ -6,39 +6,33 @@
|
|
|
6
6
|
* @file useResizable.ts
|
|
7
7
|
* @input Resize configuration (defaultSize, minSize, maxSize, snaps), with
|
|
8
8
|
* removed pixel-bound aliases rejected even through assembled objects, and
|
|
9
|
-
* collapse configuration (collapsible,
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* collapse configuration (collapsible, defaultIsCollapsed, isCollapsed)
|
|
10
|
+
* @output Hook return: size, isCollapsed, collapse/expand/resize methods, props
|
|
11
|
+
* for handle, over the internal resize factory (createResizable)
|
|
12
12
|
* @position Public hook; consumed by layout components via `resizable` prop
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
useCallback,
|
|
17
|
-
|
|
17
|
+
useReducer,
|
|
18
18
|
useRef,
|
|
19
19
|
useState,
|
|
20
20
|
useSyncExternalStore,
|
|
21
21
|
type RefObject,
|
|
22
22
|
} from 'react';
|
|
23
|
-
import {observeResize} from '../utils/sharedResizeObserver';
|
|
24
23
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
25
|
-
import {devWarn} from '../utils/devWarning';
|
|
26
24
|
import type {SizeValue} from '../utils/types';
|
|
27
25
|
import type {ResizableSize} from './utils';
|
|
26
|
+
import {
|
|
27
|
+
createResizableAs,
|
|
28
|
+
readInitialResizableState,
|
|
29
|
+
readResizableInternals,
|
|
30
|
+
type CreateResizableOptions,
|
|
31
|
+
type ResizableController,
|
|
32
|
+
type ResizableSnapshot,
|
|
33
|
+
} from './createResizable';
|
|
28
34
|
import {
|
|
29
35
|
DEFAULT_COLLAPSED_SIZE,
|
|
30
|
-
DEFAULT_MIN,
|
|
31
|
-
DEFAULT_SIZE_FALLBACK,
|
|
32
|
-
RESIZABLE_SIZE_GUIDANCE,
|
|
33
|
-
SERVER_BASIS,
|
|
34
|
-
clampSize,
|
|
35
|
-
dependsOnBasis,
|
|
36
|
-
loadPersistedState,
|
|
37
|
-
measureContentBox,
|
|
38
|
-
parseSize,
|
|
39
|
-
persistState,
|
|
40
|
-
resolveBound,
|
|
41
|
-
type PersistedResizableState,
|
|
42
36
|
type ResizableDirection,
|
|
43
37
|
} from './resizableModel';
|
|
44
38
|
|
|
@@ -211,633 +205,66 @@ export interface ResizableProps {
|
|
|
211
205
|
_isResizableProps: true;
|
|
212
206
|
}
|
|
213
207
|
|
|
214
|
-
/** A store that never changes on its own; the snapshot is re-read on render. */
|
|
215
|
-
const noopSubscribe = () => () => {};
|
|
216
|
-
|
|
217
|
-
// The window snapshots are module functions, so their identity is stable:
|
|
218
|
-
// React re-reads a snapshot after the commit whenever getSnapshot is a new
|
|
219
|
-
// function, and a window size read after the DOM changed forces a layout of
|
|
220
|
-
// the whole page. With these, the window is read during render only.
|
|
221
|
-
|
|
222
|
-
/** The viewport width, the basis without a container. */
|
|
223
|
-
function readViewportBasis(): number {
|
|
224
|
-
return typeof window === 'undefined' ? SERVER_BASIS : window.innerWidth;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function readServerBasis(): number {
|
|
228
|
-
return SERVER_BASIS;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/** The window's extent along a horizontal hook's axis. */
|
|
232
|
-
function readWindowWidth(): number | null {
|
|
233
|
-
return typeof window === 'undefined' ? null : window.innerWidth;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/** The window's extent along a vertical hook's axis. */
|
|
237
|
-
function readWindowHeight(): number | null {
|
|
238
|
-
return typeof window === 'undefined' ? null : window.innerHeight;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function readNoWindowExtent(): null {
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
208
|
// =============================================================================
|
|
245
|
-
// Single-region hook
|
|
209
|
+
// Single-region hook: the configuration object, on the factory
|
|
246
210
|
// =============================================================================
|
|
247
211
|
|
|
248
|
-
|
|
249
|
-
const {
|
|
250
|
-
defaultSize,
|
|
251
|
-
minSize,
|
|
252
|
-
maxSize,
|
|
253
|
-
containerRef,
|
|
254
|
-
direction = 'horizontal',
|
|
255
|
-
collapsible = false,
|
|
256
|
-
collapsedSize = DEFAULT_COLLAPSED_SIZE,
|
|
257
|
-
snaps: configuredSnaps,
|
|
258
|
-
autoSaveId,
|
|
259
|
-
defaultIsCollapsed,
|
|
260
|
-
isCollapsed: controlledIsCollapsed,
|
|
261
|
-
onSizeChange,
|
|
262
|
-
onCollapseChange,
|
|
263
|
-
} = config;
|
|
264
|
-
const emptySnapsRef = useRef<number[]>([]);
|
|
265
|
-
const snaps = configuredSnaps ?? emptySnapsRef.current;
|
|
266
|
-
|
|
267
|
-
const rawMin = minSize;
|
|
268
|
-
const rawMax = maxSize;
|
|
269
|
-
|
|
270
|
-
const parsedDefault = parseSize(defaultSize);
|
|
271
|
-
const parsedMin = parseSize(minSize);
|
|
272
|
-
const parsedMax = parseSize(maxSize);
|
|
273
|
-
const hasContainer = containerRef != null;
|
|
274
|
-
const persisted = autoSaveId ? loadPersistedState(autoSaveId) : null;
|
|
275
|
-
const initialDefaultRef = useRef<{px: number; isFinal: boolean} | null>(null);
|
|
276
|
-
const [, setDefaultBasisCleanupTick] = useState(0);
|
|
277
|
-
|
|
278
|
-
const defaultDependsOnBasis = dependsOnBasis(parsedDefault);
|
|
279
|
-
const boundsDependOnBasis =
|
|
280
|
-
dependsOnBasis(parsedMin) || dependsOnBasis(parsedMax);
|
|
281
|
-
// A default needs a live container only until its initial pixel choice is
|
|
282
|
-
// final. A persisted pixel choice wins without measuring the unused default.
|
|
283
|
-
// Bounds are different: percentages keep following the basis so they can
|
|
284
|
-
// re-clamp the selected pixel size.
|
|
285
|
-
const defaultNeedsInitialBasis =
|
|
286
|
-
persisted?.size == null &&
|
|
287
|
-
defaultDependsOnBasis &&
|
|
288
|
-
initialDefaultRef.current?.isFinal !== true;
|
|
289
|
-
const observeContainerBasis =
|
|
290
|
-
hasContainer && (boundsDependOnBasis || defaultNeedsInitialBasis);
|
|
291
|
-
const observeViewportBasis = !hasContainer && boundsDependOnBasis;
|
|
292
|
-
|
|
293
|
-
// The container basis, read through the shared observer. `useSyncExternalStore`
|
|
294
|
-
// rather than an effect: the store IS the measurement, so there is no render
|
|
295
|
-
// that paints before the basis is known and no `setState` in an effect.
|
|
296
|
-
//
|
|
297
|
-
// The subscription depends on the ELEMENT, not on the ref object. A ref is
|
|
298
|
-
// stable across an element swap, so `containerRef.current` can become a
|
|
299
|
-
// different node — a remount behind the same ref, a conditional branch, a
|
|
300
|
-
// portal moving — without any input to this hook changing. Keyed on the ref,
|
|
301
|
-
// the old detached node stayed observed (and a detached node measures 0,
|
|
302
|
-
// which is how a replacement zeroed the bounds) and the new one was never
|
|
303
|
-
// observed at all.
|
|
304
|
-
const containerElementRef = useRef<HTMLElement | null>(null);
|
|
305
|
-
// DOM ref changes are invisible to React. This state is only a version tick
|
|
306
|
-
// while basis observation is active; the element itself lives in a ref so it
|
|
307
|
-
// can be released without adding a cleanup render.
|
|
308
|
-
const [, setContainerElementVersion] = useState(0);
|
|
309
|
-
const containerBasisRef = useRef<number | null>(null);
|
|
310
|
-
const containerElement = observeContainerBasis
|
|
311
|
-
? containerElementRef.current
|
|
312
|
-
: null;
|
|
313
|
-
|
|
314
|
-
// Follow the ref only while some configuration needs its basis. A numeric-only
|
|
315
|
-
// region never reads the ref. Once observation stops, drop both the element
|
|
316
|
-
// and its measurement without a state update; a later percentage starts from
|
|
317
|
-
// the ref's then-current element and a fresh basis.
|
|
318
|
-
useIsomorphicLayoutEffect(() => {
|
|
319
|
-
if (!observeContainerBasis) {
|
|
320
|
-
containerElementRef.current = null;
|
|
321
|
-
containerBasisRef.current = null;
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
const element = containerRef?.current ?? null;
|
|
325
|
-
if (element !== containerElementRef.current) {
|
|
326
|
-
containerBasisRef.current = null;
|
|
327
|
-
containerElementRef.current = element;
|
|
328
|
-
setContainerElementVersion(version => version + 1);
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
const subscribeToContainer = useCallback(
|
|
333
|
-
(onStoreChange: () => void) => {
|
|
334
|
-
if (
|
|
335
|
-
!observeContainerBasis ||
|
|
336
|
-
containerElement == null ||
|
|
337
|
-
containerElement !== containerRef?.current
|
|
338
|
-
) {
|
|
339
|
-
return () => {};
|
|
340
|
-
}
|
|
341
|
-
// Unsubscribe by callback: several regions share one container, and any
|
|
342
|
-
// number of unrelated hooks may observe the same node.
|
|
343
|
-
return observeResize(containerElement, entry => {
|
|
344
|
-
containerBasisRef.current = measureContentBox(
|
|
345
|
-
containerElement,
|
|
346
|
-
direction,
|
|
347
|
-
entry,
|
|
348
|
-
);
|
|
349
|
-
onStoreChange();
|
|
350
|
-
});
|
|
351
|
-
},
|
|
352
|
-
[containerElement, observeContainerBasis, direction, containerRef],
|
|
353
|
-
);
|
|
354
|
-
const readContainerBasis = useCallback(() => {
|
|
355
|
-
if (!observeContainerBasis || containerElement == null) {
|
|
356
|
-
// An inactive subscription owns no current measurement. Clearing this is
|
|
357
|
-
// important when a percentage bound is added later: the first active
|
|
358
|
-
// render must measure the container as it is now, not clamp against the
|
|
359
|
-
// last basis seen by a default-only subscription.
|
|
360
|
-
containerBasisRef.current = null;
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
// Cached in a ref so the snapshot is referentially stable between resizes;
|
|
364
|
-
// returning a fresh measurement every call would loop the store.
|
|
365
|
-
if (containerBasisRef.current == null) {
|
|
366
|
-
containerBasisRef.current = measureContentBox(
|
|
367
|
-
containerElement,
|
|
368
|
-
direction,
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
return containerBasisRef.current;
|
|
372
|
-
}, [containerElement, observeContainerBasis, direction]);
|
|
373
|
-
const containerBasis = useSyncExternalStore(
|
|
374
|
-
subscribeToContainer,
|
|
375
|
-
readContainerBasis,
|
|
376
|
-
() => null,
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
// The viewport basis is always readable synchronously. Percentage-dependent
|
|
380
|
-
// BOUNDS subscribe to later resizes (FR6); a default reads the initial
|
|
381
|
-
// snapshot only, because it becomes a pixel choice immediately.
|
|
382
|
-
const subscribeToViewport = useCallback(
|
|
383
|
-
(onStoreChange: () => void) => {
|
|
384
|
-
if (
|
|
385
|
-
hasContainer ||
|
|
386
|
-
!observeViewportBasis ||
|
|
387
|
-
typeof window === 'undefined'
|
|
388
|
-
) {
|
|
389
|
-
return () => {};
|
|
390
|
-
}
|
|
391
|
-
window.addEventListener('resize', onStoreChange);
|
|
392
|
-
return () => window.removeEventListener('resize', onStoreChange);
|
|
393
|
-
},
|
|
394
|
-
[hasContainer, observeViewportBasis],
|
|
395
|
-
);
|
|
396
|
-
const viewportBasis = useSyncExternalStore(
|
|
397
|
-
subscribeToViewport,
|
|
398
|
-
readViewportBasis,
|
|
399
|
-
readServerBasis,
|
|
400
|
-
);
|
|
401
|
-
|
|
402
|
-
// The window's extent along the hook's axis, for the REPORTED maximum of an
|
|
403
|
-
// unbounded region (never for clamping). Read through the same store shape
|
|
404
|
-
// so a server-rendered handle hydrates with no maximum and gains the real
|
|
405
|
-
// one on the first client render, instead of a hydration mismatch. It takes
|
|
406
|
-
// no resize subscription: an unbounded pixel region observes nothing
|
|
407
|
-
// (component:Resizable Performance and resources).
|
|
408
|
-
const windowExtent = useSyncExternalStore(
|
|
409
|
-
noopSubscribe,
|
|
410
|
-
direction === 'vertical' ? readWindowHeight : readWindowWidth,
|
|
411
|
-
readNoWindowExtent,
|
|
412
|
-
);
|
|
413
|
-
|
|
414
|
-
// With a container, its content box is the basis; without one, the released
|
|
415
|
-
// viewport basis. Before a supplied container has been measured — the first
|
|
416
|
-
// render, the server, and any moment it is display:none or detached — the
|
|
417
|
-
// deterministic 1200px stands in, and the first real measurement replaces it.
|
|
418
|
-
//
|
|
419
|
-
// A zero measurement is not a measurement. A hidden or detached container
|
|
420
|
-
// reports 0, and resolving `'50%'` against it produced a real maximum of 0:
|
|
421
|
-
// the panel collapsed and, with `autoSaveId`, that 0 was written over a
|
|
422
|
-
// perfectly good saved width. Treating 0 as unmeasured keeps the temporary
|
|
423
|
-
// basis until the container is actually laid out (AST-010 Platform support).
|
|
424
|
-
const needsContainerBasis = observeContainerBasis;
|
|
425
|
-
const hasPositiveMeasurement = containerBasis != null && containerBasis > 0;
|
|
426
|
-
const liveBasis = hasContainer
|
|
427
|
-
? hasPositiveMeasurement
|
|
428
|
-
? containerBasis
|
|
429
|
-
: SERVER_BASIS
|
|
430
|
-
: viewportBasis;
|
|
431
|
-
const isBasisMeasured = needsContainerBasis ? hasPositiveMeasurement : true;
|
|
432
|
-
|
|
433
|
-
// One stable basis per gesture. A container that resizes mid-drag would
|
|
434
|
-
// otherwise move the bound under the pointer; the new basis applies once the
|
|
435
|
-
// gesture ends.
|
|
436
|
-
const gestureBasisRef = useRef<number | null>(null);
|
|
437
|
-
// Only forces the render that ends a gesture: it releases the frozen basis,
|
|
438
|
-
// and its commit writes the size the gesture settled on.
|
|
439
|
-
const [gestureTick, setGestureTick] = useState(0);
|
|
440
|
-
void gestureTick;
|
|
441
|
-
const basis = gestureBasisRef.current ?? liveBasis;
|
|
442
|
-
// The frozen basis also marks a gesture in flight, from `_onResizeStart`
|
|
443
|
-
// until `_onResizeEnd` or `_onResizeCancel`.
|
|
444
|
-
const isGestureActive = gestureBasisRef.current != null;
|
|
445
|
-
|
|
446
|
-
const didWarnMinRef = useRef(false);
|
|
447
|
-
const didWarnMaxRef = useRef(false);
|
|
448
|
-
const didWarnDefaultRef = useRef(false);
|
|
449
|
-
const didWarnInvertedRef = useRef(false);
|
|
450
|
-
|
|
451
|
-
// Bounds re-resolve from the live basis on every render — that is the whole
|
|
452
|
-
// point of a percentage bound — and clamp the pixel selection below.
|
|
453
|
-
const resolvedMin = resolveBound(
|
|
454
|
-
rawMin,
|
|
455
|
-
parsedMin,
|
|
456
|
-
basis,
|
|
457
|
-
DEFAULT_MIN,
|
|
458
|
-
'minSize',
|
|
459
|
-
RESIZABLE_SIZE_GUIDANCE,
|
|
460
|
-
didWarnMinRef,
|
|
461
|
-
);
|
|
462
|
-
const resolvedMax = resolveBound(
|
|
463
|
-
rawMax,
|
|
464
|
-
parsedMax,
|
|
465
|
-
basis,
|
|
466
|
-
Infinity,
|
|
467
|
-
'maxSize',
|
|
468
|
-
RESIZABLE_SIZE_GUIDANCE,
|
|
469
|
-
didWarnMaxRef,
|
|
470
|
-
);
|
|
471
|
-
|
|
472
|
-
// A basis-dependent default is resolved ONCE into a pixel size. Latched in a
|
|
473
|
-
// ref (React's sanctioned lazy-init shape) rather than recomputed, because a
|
|
474
|
-
// default that kept tracking its basis would be a second, responsive sizing
|
|
475
|
-
// mode — the thing this API deliberately does not have.
|
|
476
|
-
//
|
|
477
|
-
// Not final while a supplied container is still unmeasured: that render used
|
|
478
|
-
// the temporary 1200px stand-in, and the first real measurement replaces it.
|
|
479
|
-
// Once final, a default-only subscription is removed. The correction is not a
|
|
480
|
-
// user interaction, so it neither persists the placeholder nor fires
|
|
481
|
-
// `onSizeChange`.
|
|
482
|
-
if (initialDefaultRef.current == null || !initialDefaultRef.current.isFinal) {
|
|
483
|
-
initialDefaultRef.current = {
|
|
484
|
-
px: resolveBound(
|
|
485
|
-
defaultSize,
|
|
486
|
-
parsedDefault,
|
|
487
|
-
basis,
|
|
488
|
-
DEFAULT_SIZE_FALLBACK,
|
|
489
|
-
'defaultSize',
|
|
490
|
-
RESIZABLE_SIZE_GUIDANCE,
|
|
491
|
-
didWarnDefaultRef,
|
|
492
|
-
),
|
|
493
|
-
isFinal: isBasisMeasured,
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
const initialDefaultPx = initialDefaultRef.current.px;
|
|
497
|
-
|
|
498
|
-
// The size the user has settled on, or null while a container-relative
|
|
499
|
-
// default is still waiting for its first positive measurement. Once that
|
|
500
|
-
// basis is real, the default becomes an ordinary pixel selection — including
|
|
501
|
-
// any clamp applied at initialization. Leaving it represented by `null`
|
|
502
|
-
// allowed the raw default to be re-read later: 321px first clamped to 200px
|
|
503
|
-
// in a 400px container, then revived to 321px when the container grew.
|
|
504
|
-
//
|
|
505
|
-
// Initialized outright whenever the basis is already real on the first
|
|
506
|
-
// render — every pixel-only configuration, and the no-container percentage
|
|
507
|
-
// path. Only a supplied container needs a measurement that does not exist
|
|
508
|
-
// until after commit, so only it starts null. Initializing lazily in all
|
|
509
|
-
// cases cost every legacy pixel-only mount a second render pass, because the
|
|
510
|
-
// adjustment below then had to run on the first render to fill the value in.
|
|
511
|
-
const [chosenSize, setChosenSize] = useState<number | null>(() => {
|
|
512
|
-
if (persisted?.size != null) {
|
|
513
|
-
return persisted.size;
|
|
514
|
-
}
|
|
515
|
-
return isBasisMeasured
|
|
516
|
-
? clampSize(initialDefaultPx, resolvedMin, resolvedMax, snaps)
|
|
517
|
-
: null;
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
if (
|
|
521
|
-
hasContainer &&
|
|
522
|
-
!boundsDependOnBasis &&
|
|
523
|
-
isBasisMeasured &&
|
|
524
|
-
defaultNeedsInitialBasis &&
|
|
525
|
-
chosenSize != null
|
|
526
|
-
) {
|
|
527
|
-
// A programmatic resize may have selected pixels while the container was
|
|
528
|
-
// still unmeasured, so chosenSize can already be non-null here. Force the
|
|
529
|
-
// render that re-evaluates and removes the now-finished default subscription.
|
|
530
|
-
setDefaultBasisCleanupTick(tick => tick + 1);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
if (isBasisMeasured && chosenSize == null) {
|
|
534
|
-
// The supplied container has now been measured, so the selection latched
|
|
535
|
-
// against the temporary basis is replaced by one against the real one.
|
|
536
|
-
// Render-phase adjustment is deliberate: React re-runs this render before
|
|
537
|
-
// paint, so the corrected selection, paint, persistence, and ARIA all see
|
|
538
|
-
// the same pixel value. It fires no interaction callback.
|
|
539
|
-
setChosenSize(clampSize(initialDefaultPx, resolvedMin, resolvedMax, snaps));
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
// A re-resolved bound clamps the SELECTION, not just the paint. Deriving
|
|
543
|
-
// alone was not enough: the stored choice survived, so a container that
|
|
544
|
-
// shrank and grew again revived the pre-clamp size — measured 320px
|
|
545
|
-
// reviving to 560px. The clamp has to be committed to be permanent.
|
|
546
|
-
//
|
|
547
|
-
// Adjusting state during render (React's documented shape for "a prop
|
|
548
|
-
// changed, so state must follow") rather than in an effect: React re-runs
|
|
549
|
-
// this render before painting, so nothing shows at the stale size, and no
|
|
550
|
-
// interaction callback fires for what is only a layout correction (FR10).
|
|
551
|
-
//
|
|
552
|
-
// Held until the basis is final. Before a supplied container is measured the
|
|
553
|
-
// bounds come from the temporary 1200px stand-in, and committing against
|
|
554
|
-
// that would move a persisted size to fit a basis that was never real.
|
|
555
|
-
const [committedBounds, setCommittedBounds] = useState({
|
|
556
|
-
min: resolvedMin,
|
|
557
|
-
max: resolvedMax,
|
|
558
|
-
});
|
|
559
|
-
if (
|
|
560
|
-
isBasisMeasured &&
|
|
561
|
-
gestureBasisRef.current == null &&
|
|
562
|
-
(committedBounds.min !== resolvedMin || committedBounds.max !== resolvedMax)
|
|
563
|
-
) {
|
|
564
|
-
setCommittedBounds({min: resolvedMin, max: resolvedMax});
|
|
565
|
-
setChosenSize(current =>
|
|
566
|
-
current == null
|
|
567
|
-
? null
|
|
568
|
-
: clampSize(current, resolvedMin, resolvedMax, snaps),
|
|
569
|
-
);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
// Derived for paint, so the clamp above and the rendered size agree on the
|
|
573
|
-
// very render that observes a new basis.
|
|
574
|
-
const size = clampSize(
|
|
575
|
-
chosenSize ?? initialDefaultPx,
|
|
576
|
-
resolvedMin,
|
|
577
|
-
resolvedMax,
|
|
578
|
-
snaps,
|
|
579
|
-
);
|
|
580
|
-
const [uncontrolledIsCollapsed, setUncontrolledIsCollapsed] = useState(
|
|
581
|
-
() => persisted?.isCollapsed ?? defaultIsCollapsed ?? false,
|
|
582
|
-
);
|
|
583
|
-
|
|
584
|
-
const isControlled = controlledIsCollapsed !== undefined;
|
|
585
|
-
const isCollapsed =
|
|
586
|
-
collapsible &&
|
|
587
|
-
(isControlled ? controlledIsCollapsed : uncontrolledIsCollapsed);
|
|
588
|
-
const dragStartSizeRef = useRef(size);
|
|
589
|
-
|
|
590
|
-
// Mirrors isCollapsed so the callbacks below read the live value instead of
|
|
591
|
-
// the one their last render captured. Two cases reach them from a stale
|
|
592
|
-
// closure: two imperative calls in one tick, and a drag — ResizeHandle
|
|
593
|
-
// registers its pointermove listener once at pointer down, so a whole
|
|
594
|
-
// gesture runs against one props snapshot.
|
|
595
|
-
const isCollapsedRef = useRef(isCollapsed);
|
|
596
|
-
isCollapsedRef.current = isCollapsed;
|
|
597
|
-
|
|
598
|
-
// Controlled callers own the state; collapse() and a drag past the
|
|
599
|
-
// threshold report through onCollapseChange and change nothing here.
|
|
600
|
-
const setCollapsed = useCallback(
|
|
601
|
-
(value: boolean) => {
|
|
602
|
-
if (!isControlled) {
|
|
603
|
-
isCollapsedRef.current = value;
|
|
604
|
-
setUncontrolledIsCollapsed(value);
|
|
605
|
-
}
|
|
606
|
-
},
|
|
607
|
-
[isControlled],
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
useEffect(() => {
|
|
611
|
-
if (resolvedMin > resolvedMax && !didWarnInvertedRef.current) {
|
|
612
|
-
didWarnInvertedRef.current = true;
|
|
613
|
-
devWarn(
|
|
614
|
-
'useResizable',
|
|
615
|
-
`the resolved minimum (${resolvedMin}px) is above the resolved ` +
|
|
616
|
-
`maximum (${resolvedMax}px). The maximum wins, as it always has.`,
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
}, [resolvedMin, resolvedMax]);
|
|
620
|
-
|
|
621
|
-
// The size a gesture in flight has reached, for a region that unmounts
|
|
622
|
-
// before the gesture ends.
|
|
623
|
-
const pendingWriteRef = useRef<{
|
|
624
|
-
key: string;
|
|
625
|
-
state: PersistedResizableState;
|
|
626
|
-
} | null>(null);
|
|
627
|
-
|
|
628
|
-
useEffect(() => {
|
|
629
|
-
// Synchronizes the `autoSaveId` entry in localStorage with the size.
|
|
630
|
-
// Nothing is written while the basis is still the temporary stand-in. The
|
|
631
|
-
// size on such a render is a placeholder, and persisting it overwrites the
|
|
632
|
-
// real saved size with a value derived from a basis that was never real
|
|
633
|
-
// (AST-010 Platform support, FR9).
|
|
634
|
-
if (!autoSaveId || !isBasisMeasured) {
|
|
635
|
-
pendingWriteRef.current = null;
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
// Nor while a gesture is in flight. A drag commits a new size on every
|
|
639
|
-
// pointer move, and each write reaches every other open document of the
|
|
640
|
-
// origin as a `storage` event.
|
|
641
|
-
if (isGestureActive) {
|
|
642
|
-
pendingWriteRef.current = {key: autoSaveId, state: {size, isCollapsed}};
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
// A gesture's one write happens here, in the commit that applies its
|
|
646
|
-
// release, not in the handler that ended it: this render is the first to
|
|
647
|
-
// know the final size. A basis that changed mid-gesture applies only at
|
|
648
|
-
// the release and can re-clamp the size (AST-010 FR7), and a move the
|
|
649
|
-
// release arrived before renders together with it. The handler sees
|
|
650
|
-
// neither.
|
|
651
|
-
pendingWriteRef.current = null;
|
|
652
|
-
persistState(autoSaveId, {size, isCollapsed});
|
|
653
|
-
}, [size, isCollapsed, autoSaveId, isBasisMeasured, isGestureActive]);
|
|
654
|
-
|
|
655
|
-
// A region that unmounts mid-gesture never commits a release, so the size
|
|
656
|
-
// the gesture reached is written on the way out.
|
|
657
|
-
useEffect(
|
|
658
|
-
() => () => {
|
|
659
|
-
const pending = pendingWriteRef.current;
|
|
660
|
-
pendingWriteRef.current = null;
|
|
661
|
-
if (pending != null) {
|
|
662
|
-
persistState(pending.key, pending.state);
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
[],
|
|
666
|
-
);
|
|
667
|
-
|
|
668
|
-
const collapse = useCallback(() => {
|
|
669
|
-
// The already-collapsed guard keeps a repeated call from re-notifying a
|
|
670
|
-
// transition that already happened.
|
|
671
|
-
if (!collapsible || isCollapsedRef.current) {
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
setCollapsed(true);
|
|
675
|
-
onCollapseChange?.(true);
|
|
676
|
-
onSizeChange?.(0);
|
|
677
|
-
}, [collapsible, setCollapsed, onCollapseChange, onSizeChange]);
|
|
678
|
-
|
|
679
|
-
const expand = useCallback(() => {
|
|
680
|
-
const wasCollapsed = isCollapsedRef.current;
|
|
681
|
-
setCollapsed(false);
|
|
682
|
-
if (wasCollapsed) {
|
|
683
|
-
onCollapseChange?.(false);
|
|
684
|
-
}
|
|
685
|
-
onSizeChange?.(size);
|
|
686
|
-
}, [setCollapsed, size, onCollapseChange, onSizeChange]);
|
|
687
|
-
|
|
688
|
-
const resize = useCallback(
|
|
689
|
-
(newSize: number) => {
|
|
690
|
-
// An invalid programmatic size repairs nothing — it must not replace a
|
|
691
|
-
// legal selection with NaN, which would then reach paint, storage and
|
|
692
|
-
// `aria-valuenow`.
|
|
693
|
-
if (!Number.isFinite(newSize) || newSize < 0) {
|
|
694
|
-
devWarn(
|
|
695
|
-
'useResizable',
|
|
696
|
-
`resize(${String(newSize)}) is not a pixel size. Keeping the ` +
|
|
697
|
-
'current size. Percentages configure the hook; they are not a ' +
|
|
698
|
-
'programmatic input.',
|
|
699
|
-
);
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
const clamped = clampSize(newSize, resolvedMin, resolvedMax, snaps);
|
|
703
|
-
const wasCollapsed = isCollapsedRef.current;
|
|
704
|
-
setChosenSize(clamped);
|
|
705
|
-
setCollapsed(false);
|
|
706
|
-
// Resizing out of the collapsed state is an implicit expand — notify
|
|
707
|
-
// like the drag path does when it crosses back over the threshold.
|
|
708
|
-
if (wasCollapsed) {
|
|
709
|
-
onCollapseChange?.(false);
|
|
710
|
-
}
|
|
711
|
-
onSizeChange?.(clamped);
|
|
712
|
-
},
|
|
713
|
-
[
|
|
714
|
-
resolvedMin,
|
|
715
|
-
resolvedMax,
|
|
716
|
-
snaps,
|
|
717
|
-
setCollapsed,
|
|
718
|
-
onCollapseChange,
|
|
719
|
-
onSizeChange,
|
|
720
|
-
],
|
|
721
|
-
);
|
|
212
|
+
const EMPTY_SNAPS: number[] = [];
|
|
722
213
|
|
|
214
|
+
/**
|
|
215
|
+
* The configuration-object form: createResizable with no handle of its own,
|
|
216
|
+
* so the region's state has one copy, the factory's. The props it returns
|
|
217
|
+
* carry what the factory reports, and a ResizeHandle given them drives the
|
|
218
|
+
* factory's region through them.
|
|
219
|
+
*/
|
|
220
|
+
function useSingleResizable(config: UseResizableSingleConfig): ResizableRegion {
|
|
221
|
+
const {getResizable, size, isCollapsed, snapshot, collapse, expand, resize} =
|
|
222
|
+
useResizableController(config);
|
|
223
|
+
// The region's side of the handle's gesture, read at each input, so a whole
|
|
224
|
+
// drag reaches the factory as it is now.
|
|
225
|
+
const model = useCallback(() => {
|
|
226
|
+
const current = getResizable();
|
|
227
|
+
return current == null ? undefined : readResizableInternals(current)?.model;
|
|
228
|
+
}, [getResizable]);
|
|
723
229
|
const onResizeStart = useCallback(() => {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
gestureBasisRef.current = liveBasis;
|
|
727
|
-
dragStartSizeRef.current = isCollapsedRef.current ? 0 : size;
|
|
728
|
-
}, [size, liveBasis]);
|
|
729
|
-
|
|
230
|
+
model()?.start();
|
|
231
|
+
}, [model]);
|
|
730
232
|
const onResizeMove = useCallback(
|
|
731
233
|
(delta: number) => {
|
|
732
|
-
|
|
733
|
-
if (collapsible && raw < collapsedSize) {
|
|
734
|
-
if (!isCollapsedRef.current) {
|
|
735
|
-
setCollapsed(true);
|
|
736
|
-
onCollapseChange?.(true);
|
|
737
|
-
onSizeChange?.(0);
|
|
738
|
-
}
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
if (isCollapsedRef.current && raw >= collapsedSize) {
|
|
742
|
-
setCollapsed(false);
|
|
743
|
-
onCollapseChange?.(false);
|
|
744
|
-
}
|
|
745
|
-
const clamped = clampSize(raw, resolvedMin, resolvedMax, snaps);
|
|
746
|
-
setChosenSize(clamped);
|
|
747
|
-
onSizeChange?.(clamped);
|
|
234
|
+
model()?.move(delta);
|
|
748
235
|
},
|
|
749
|
-
[
|
|
750
|
-
collapsible,
|
|
751
|
-
collapsedSize,
|
|
752
|
-
setCollapsed,
|
|
753
|
-
resolvedMin,
|
|
754
|
-
resolvedMax,
|
|
755
|
-
snaps,
|
|
756
|
-
onSizeChange,
|
|
757
|
-
onCollapseChange,
|
|
758
|
-
],
|
|
236
|
+
[model],
|
|
759
237
|
);
|
|
760
|
-
|
|
761
|
-
// Releasing the frozen basis needs a render to apply whatever the basis
|
|
762
|
-
// became during the gesture; that render's commit writes the final size.
|
|
763
|
-
const releaseGestureBasis = useCallback(() => {
|
|
764
|
-
if (gestureBasisRef.current != null) {
|
|
765
|
-
gestureBasisRef.current = null;
|
|
766
|
-
setGestureTick(tick => tick + 1);
|
|
767
|
-
}
|
|
768
|
-
}, []);
|
|
769
|
-
|
|
770
238
|
const onResizeEnd = useCallback(() => {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
// A gesture that is cancelled rather than completed — pointercancel, a lost
|
|
777
|
-
// capture, a handle unmounted mid-drag — is still over. It does not signal a
|
|
778
|
-
// resize end (that is #5297's contract, and the sizes were committed during
|
|
779
|
-
// move anyway), but the basis it froze has to come back, or every later
|
|
780
|
-
// percentage bound stays pinned to the container size at grab time, and the
|
|
781
|
-
// size it reached has to reach storage.
|
|
782
|
-
const onResizeCancel = releaseGestureBasis;
|
|
783
|
-
|
|
784
|
-
// The maximum a handle REPORTS (End uses only a configured maximum). A
|
|
785
|
-
// configured maximum wins. Otherwise a measured extent stands in — the
|
|
786
|
-
// container's content box while a percentage bound already observes it, or
|
|
787
|
-
// the window's extent along the axis — and never drops below the current size, so
|
|
788
|
-
// `aria-valuenow` can never exceed `aria-valuemax` (a saved, default, or
|
|
789
|
-
// pre-resize size may already be larger than the window). An unobserved
|
|
790
|
-
// container reports nothing: measuring it would add an observer to an
|
|
791
|
-
// atomic pixel path.
|
|
792
|
-
const measuredBasisForMax = hasContainer
|
|
793
|
-
? hasPositiveMeasurement && observeContainerBasis
|
|
794
|
-
? containerBasis
|
|
795
|
-
: null
|
|
796
|
-
: windowExtent;
|
|
797
|
-
// Never below the announced value either: a collapsed pane announces the
|
|
798
|
-
// resolved minimum as its value, so the stand-in floors there as well, and
|
|
799
|
-
// `aria-valuemax` can never fall under `aria-valuemin`.
|
|
800
|
-
const effectiveMaxPx =
|
|
801
|
-
resolvedMax !== Infinity
|
|
802
|
-
? resolvedMax
|
|
803
|
-
: measuredBasisForMax == null
|
|
804
|
-
? undefined
|
|
805
|
-
: Math.max(measuredBasisForMax, isCollapsed ? resolvedMin : size);
|
|
239
|
+
model()?.end();
|
|
240
|
+
}, [model]);
|
|
241
|
+
const onResizeCancel = useCallback(() => {
|
|
242
|
+
model()?.cancel();
|
|
243
|
+
}, [model]);
|
|
806
244
|
|
|
807
245
|
const props: ResizableProps = {
|
|
808
|
-
_size:
|
|
246
|
+
_size: size,
|
|
809
247
|
_isCollapsed: isCollapsed,
|
|
810
248
|
_onResizeStart: onResizeStart,
|
|
811
249
|
_onResizeMove: onResizeMove,
|
|
812
250
|
_onResizeEnd: onResizeEnd,
|
|
813
251
|
_onResizeCancel: onResizeCancel,
|
|
814
|
-
_minSizePx:
|
|
815
|
-
_maxSizePx:
|
|
816
|
-
_snaps: snaps,
|
|
817
|
-
_collapsedSize: collapsedSize,
|
|
818
|
-
_collapsible: collapsible,
|
|
819
|
-
_direction: direction,
|
|
252
|
+
_minSizePx: snapshot.minPx,
|
|
253
|
+
_maxSizePx: snapshot.maxPx,
|
|
254
|
+
_snaps: config.snaps ?? EMPTY_SNAPS,
|
|
255
|
+
_collapsedSize: config.collapsedSize ?? DEFAULT_COLLAPSED_SIZE,
|
|
256
|
+
_collapsible: config.collapsible ?? false,
|
|
257
|
+
_direction: config.direction ?? 'horizontal',
|
|
820
258
|
_isResizableProps: true,
|
|
821
259
|
};
|
|
822
260
|
collapseControls.set(props, {collapse, expand});
|
|
823
|
-
// Without a configured maximum
|
|
824
|
-
// real measurement (an observed container, or the window)
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
// The released no-container basis is the window WIDTH on both axes; a
|
|
828
|
-
// vertical region's reported maximum reads the window height instead.
|
|
829
|
-
if (effectiveMaxPx != null) {
|
|
830
|
-
effectiveMaxima.set(props, effectiveMaxPx);
|
|
261
|
+
// Without a configured maximum a measured extent stands in, only once it
|
|
262
|
+
// is a real measurement (an observed container, or the window).
|
|
263
|
+
if (snapshot.effectiveMaxPx != null) {
|
|
264
|
+
effectiveMaxima.set(props, snapshot.effectiveMaxPx);
|
|
831
265
|
}
|
|
832
266
|
|
|
833
|
-
return {
|
|
834
|
-
size: isCollapsed ? 0 : size,
|
|
835
|
-
isCollapsed,
|
|
836
|
-
collapse,
|
|
837
|
-
expand,
|
|
838
|
-
resize,
|
|
839
|
-
props,
|
|
840
|
-
};
|
|
267
|
+
return {size, isCollapsed, collapse, expand, resize, props};
|
|
841
268
|
}
|
|
842
269
|
|
|
843
270
|
// =============================================================================
|
|
@@ -949,6 +376,248 @@ type MultiResizableArgument<Config extends UseResizableMultiConfig> =
|
|
|
949
376
|
}
|
|
950
377
|
: never;
|
|
951
378
|
|
|
379
|
+
// =============================================================================
|
|
380
|
+
// The resize factory in React
|
|
381
|
+
// =============================================================================
|
|
382
|
+
|
|
383
|
+
interface ResizableEntry {
|
|
384
|
+
readonly resizable: ResizableController;
|
|
385
|
+
/** The options the factory has now: those it was created with, or updated to. */
|
|
386
|
+
passed: CreateResizableOptions;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The factory a hook holds, and one store over it for React. It follows the
|
|
391
|
+
* factory the slot holds now and reads the snapshot that factory reports.
|
|
392
|
+
* Before there is one, it reads the state the region starts in. A reading
|
|
393
|
+
* equal in every part to the last one is the last one. So a mount that
|
|
394
|
+
* settles where it started renders once.
|
|
395
|
+
*/
|
|
396
|
+
interface ResizableSlot {
|
|
397
|
+
get(): ResizableEntry | null;
|
|
398
|
+
set(next: ResizableEntry | null): void;
|
|
399
|
+
subscribe(listener: () => void): () => void;
|
|
400
|
+
read(): ResizableSnapshot;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function sameSnapshot(a: ResizableSnapshot, b: ResizableSnapshot): boolean {
|
|
404
|
+
return (
|
|
405
|
+
a.size === b.size &&
|
|
406
|
+
a.isCollapsed === b.isCollapsed &&
|
|
407
|
+
a.expandedSize === b.expandedSize &&
|
|
408
|
+
a.minPx === b.minPx &&
|
|
409
|
+
a.maxPx === b.maxPx &&
|
|
410
|
+
a.effectiveMaxPx === b.effectiveMaxPx
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function createSlot(initial: ResizableSnapshot): ResizableSlot {
|
|
415
|
+
let current: ResizableEntry | null = null;
|
|
416
|
+
let last: ResizableSnapshot = initial;
|
|
417
|
+
const listeners = new Set<() => void>();
|
|
418
|
+
let stopFactory: (() => void) | null = null;
|
|
419
|
+
const notify = () => {
|
|
420
|
+
for (const listener of [...listeners]) {
|
|
421
|
+
listener();
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
const follow = () => {
|
|
425
|
+
stopFactory?.();
|
|
426
|
+
stopFactory = null;
|
|
427
|
+
if (current != null && listeners.size > 0) {
|
|
428
|
+
const {resizable} = current;
|
|
429
|
+
const channel = readResizableInternals(resizable);
|
|
430
|
+
stopFactory =
|
|
431
|
+
channel != null
|
|
432
|
+
? channel.subscribeSnapshot(notify)
|
|
433
|
+
: resizable.subscribe(notify);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
return {
|
|
437
|
+
get: () => current,
|
|
438
|
+
set(next) {
|
|
439
|
+
current = next;
|
|
440
|
+
follow();
|
|
441
|
+
notify();
|
|
442
|
+
},
|
|
443
|
+
subscribe(listener) {
|
|
444
|
+
listeners.add(listener);
|
|
445
|
+
if (listeners.size === 1) {
|
|
446
|
+
follow();
|
|
447
|
+
}
|
|
448
|
+
return () => {
|
|
449
|
+
listeners.delete(listener);
|
|
450
|
+
if (listeners.size === 0) {
|
|
451
|
+
stopFactory?.();
|
|
452
|
+
stopFactory = null;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
},
|
|
456
|
+
read() {
|
|
457
|
+
if (current == null) {
|
|
458
|
+
return last;
|
|
459
|
+
}
|
|
460
|
+
const {resizable} = current;
|
|
461
|
+
// A stand-in controller without the internal channel reports only its
|
|
462
|
+
// size and collapse state.
|
|
463
|
+
const next = readResizableInternals(resizable)?.snapshot() ?? {
|
|
464
|
+
...initial,
|
|
465
|
+
size: resizable.size,
|
|
466
|
+
isCollapsed: resizable.isCollapsed,
|
|
467
|
+
expandedSize: resizable.size,
|
|
468
|
+
};
|
|
469
|
+
if (!sameSnapshot(last, next)) {
|
|
470
|
+
last = next;
|
|
471
|
+
}
|
|
472
|
+
return last;
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/** What the hook renders from its factory. */
|
|
478
|
+
interface ResizableReading {
|
|
479
|
+
/** The region's size in px, 0 while collapsed. */
|
|
480
|
+
readonly size: number;
|
|
481
|
+
readonly isCollapsed: boolean;
|
|
482
|
+
readonly collapse: () => void;
|
|
483
|
+
readonly expand: () => void;
|
|
484
|
+
readonly resize: (size: number) => void;
|
|
485
|
+
/** The bounds the handle announces, and the size as expanded. */
|
|
486
|
+
readonly snapshot: ResizableSnapshot;
|
|
487
|
+
/** The factory the region has now: null before its first commit. */
|
|
488
|
+
readonly getResizable: () => ResizableController | null;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* createResizable in React, with nothing of its own. It creates the factory as
|
|
493
|
+
* it mounts, passes later options through `update` and returns what the
|
|
494
|
+
* factory reports.
|
|
495
|
+
* Before its first commit (the server, the first render, a hydrating render)
|
|
496
|
+
* it returns the state the factory starts in. While it is unmounted or an
|
|
497
|
+
* `<Activity>` hides it, the factory lets go of the page and keeps the region.
|
|
498
|
+
* So collapse, expand and resize apply and report whenever they are called, as
|
|
499
|
+
* React state did. A call before the first commit starts the factory early.
|
|
500
|
+
*
|
|
501
|
+
* A controlled `isCollapsed` is read from the options in the render that
|
|
502
|
+
* passes it, before `update` reaches the factory. So the size and collapse
|
|
503
|
+
* state a parent renders land in the same commit as the state its
|
|
504
|
+
* `onCollapseChange` set.
|
|
505
|
+
*/
|
|
506
|
+
function useResizableController(
|
|
507
|
+
options: CreateResizableOptions,
|
|
508
|
+
): ResizableReading {
|
|
509
|
+
const optionsRef = useRef(options);
|
|
510
|
+
optionsRef.current = options;
|
|
511
|
+
const [slot] = useState(() => createSlot(readInitialResizableState(options)));
|
|
512
|
+
const [serverInitial] = useState(() =>
|
|
513
|
+
readInitialResizableState(options, 'server'),
|
|
514
|
+
);
|
|
515
|
+
// The hook keeps one factory. After an unmount or an `<Activity>` hide, the
|
|
516
|
+
// same factory takes the page back (`resume`).
|
|
517
|
+
const follow = useCallback(() => {
|
|
518
|
+
const entry = slot.get();
|
|
519
|
+
if (entry != null) {
|
|
520
|
+
readResizableInternals(entry.resizable)?.resume();
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
const passed = optionsRef.current;
|
|
524
|
+
const resizable = createResizableAs('useResizable', null, passed);
|
|
525
|
+
slot.set({resizable, passed});
|
|
526
|
+
}, [slot]);
|
|
527
|
+
useIsomorphicLayoutEffect(() => {
|
|
528
|
+
follow();
|
|
529
|
+
});
|
|
530
|
+
// On unmount, or when an `<Activity>` hides the component, the factory lets
|
|
531
|
+
// go of the page and keeps the region. Calls meanwhile apply, and a reveal
|
|
532
|
+
// goes on from where the region stands. A stand-in without the internal
|
|
533
|
+
// channel goes.
|
|
534
|
+
useIsomorphicLayoutEffect(
|
|
535
|
+
() => () => {
|
|
536
|
+
const entry = slot.get();
|
|
537
|
+
if (entry == null) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
const channel = readResizableInternals(entry.resizable);
|
|
541
|
+
if (channel != null) {
|
|
542
|
+
channel.suspend();
|
|
543
|
+
} else {
|
|
544
|
+
slot.set(null);
|
|
545
|
+
entry.resizable.destroy();
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
[slot],
|
|
549
|
+
);
|
|
550
|
+
// The factory, a store outside React: each new options object reaches it
|
|
551
|
+
// through update().
|
|
552
|
+
useIsomorphicLayoutEffect(() => {
|
|
553
|
+
const entry = slot.get();
|
|
554
|
+
if (entry != null && options !== entry.passed) {
|
|
555
|
+
entry.passed = options;
|
|
556
|
+
entry.resizable.update(options);
|
|
557
|
+
}
|
|
558
|
+
}, [slot, options]);
|
|
559
|
+
// A container swapped behind `containerRef` with the same options: the
|
|
560
|
+
// factory follows it at each commit, as it follows new options.
|
|
561
|
+
useIsomorphicLayoutEffect(() => {
|
|
562
|
+
const entry = slot.get();
|
|
563
|
+
if (entry != null) {
|
|
564
|
+
readResizableInternals(entry.resizable)?.syncContainer();
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
const snapshot = useSyncExternalStore(
|
|
569
|
+
slot.subscribe,
|
|
570
|
+
slot.read,
|
|
571
|
+
() => serverInitial,
|
|
572
|
+
);
|
|
573
|
+
// When an `<Activity>` shows this component, React subscribes to the slot
|
|
574
|
+
// again but does not read it. The factory resumes and reports in that same
|
|
575
|
+
// commit. Render again with what it reports.
|
|
576
|
+
const [, rerender] = useReducer((count: number) => count + 1, 0);
|
|
577
|
+
useIsomorphicLayoutEffect(() => {
|
|
578
|
+
if (slot.read() !== snapshot) {
|
|
579
|
+
rerender();
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
const isControlled = options.isCollapsed !== undefined;
|
|
583
|
+
const isCollapsed = isControlled
|
|
584
|
+
? (options.collapsible ?? false) && Boolean(options.isCollapsed)
|
|
585
|
+
: snapshot.isCollapsed;
|
|
586
|
+
const size = isControlled
|
|
587
|
+
? isCollapsed
|
|
588
|
+
? 0
|
|
589
|
+
: snapshot.expandedSize
|
|
590
|
+
: snapshot.size;
|
|
591
|
+
|
|
592
|
+
const getResizable = useCallback(() => slot.get()?.resizable ?? null, [slot]);
|
|
593
|
+
// A call before the first commit, from a child's layout effect say, starts
|
|
594
|
+
// the factory now. The factory stays off the page until that commit.
|
|
595
|
+
const ensureResizable = useCallback((): ResizableController => {
|
|
596
|
+
const entry = slot.get();
|
|
597
|
+
if (entry != null) {
|
|
598
|
+
return entry.resizable;
|
|
599
|
+
}
|
|
600
|
+
const passed = optionsRef.current;
|
|
601
|
+
const resizable = createResizableAs('useResizable', null, passed);
|
|
602
|
+
readResizableInternals(resizable)?.suspend();
|
|
603
|
+
slot.set({resizable, passed});
|
|
604
|
+
return resizable;
|
|
605
|
+
}, [slot]);
|
|
606
|
+
const collapse = useCallback(() => {
|
|
607
|
+
ensureResizable().collapse();
|
|
608
|
+
}, [ensureResizable]);
|
|
609
|
+
const expand = useCallback(() => {
|
|
610
|
+
ensureResizable().expand();
|
|
611
|
+
}, [ensureResizable]);
|
|
612
|
+
const resize = useCallback(
|
|
613
|
+
(next: number) => {
|
|
614
|
+
ensureResizable().resize(next);
|
|
615
|
+
},
|
|
616
|
+
[ensureResizable],
|
|
617
|
+
);
|
|
618
|
+
return {snapshot, getResizable, size, isCollapsed, collapse, expand, resize};
|
|
619
|
+
}
|
|
620
|
+
|
|
952
621
|
export function useResizable<const Config extends UseResizableSingleConfig>(
|
|
953
622
|
config: SingleResizableArgument<Config>,
|
|
954
623
|
): ResizableRegion;
|