@astryxdesign/core 0.7.7 → 0.7.8-canary.36cde5e
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 +5 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +1 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +25 -4
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +5 -0
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -1
- package/dist/BottomSheet/useMobileKeyboard.js +6 -0
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +12 -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 +15 -16
- 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 +4 -0
- 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/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 +625 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +1 -0
- package/dist/DateInput/Wheel.d.ts +18 -37
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +84 -113
- 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 +74 -0
- package/dist/DateInput/wheelOptions.d.ts.map +1 -0
- package/dist/DateInput/wheelOptions.js +98 -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 +2 -0
- 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 +20 -33
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +5 -2
- 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 +3 -0
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -1
- package/dist/Layer/useLayerDismissal.js +3 -0
- package/dist/Layer/usePressPin.d.ts +17 -5
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +62 -12
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +3 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +19 -0
- package/dist/MobileNav/MobileNav.d.ts +3 -2
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +9 -25
- 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/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +6 -0
- package/dist/PowerSearch/PowerSearch.d.ts +43 -4
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +445 -134
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +102 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +1919 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +35 -2
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +25 -6
- 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 +7 -2
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +193 -83
- package/dist/PowerSearch/formatFilterValue.d.ts +18 -6
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +33 -12
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +162 -0
- package/dist/PowerSearch/powerSearchDateZone.d.ts +21 -0
- package/dist/PowerSearch/powerSearchDateZone.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchDateZone.js +37 -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 +2 -0
- 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 +101 -77
- package/dist/Resizable/createResizable.d.ts +145 -0
- package/dist/Resizable/createResizable.d.ts.map +1 -0
- package/dist/Resizable/createResizable.js +575 -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 +5 -8
- 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/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.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +4 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -0
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +10 -7
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +2 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +2 -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/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 +49 -37
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +22 -19
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +19 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +34 -53
- 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 +39 -6
- package/dist/gestures/GestureHost.d.ts +16 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +1 -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 +13 -3
- 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 +134 -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/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 +7 -9
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +55 -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 +42 -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-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +30 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +30 -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/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +7 -7
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +45 -20
- 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/index.d.ts +4 -3
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +4 -3
- 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/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 +7 -0
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/focusReturn.d.ts +15 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +28 -0
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +4 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/plainDate.d.ts +8 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +19 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +20 -6
- 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 +120 -0
- package/locales/pseudo.json +90 -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 +4 -0
- package/src/BottomSheet/BottomSheet.tsx +1 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +39 -3
- package/src/BottomSheet/BottomSheetSwitcher.tsx +5 -0
- package/src/BottomSheet/useMobileKeyboard.ts +4 -0
- package/src/BottomSheet/useSheetGestures.ts +10 -1
- package/src/Button/Button.tsx +26 -4
- package/src/Calendar/Calendar.tsx +36 -25
- package/src/Carousel/Carousel.tsx +1 -0
- package/src/Chat/ChatComposerInput.tsx +2 -0
- 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/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 +765 -0
- package/src/DateInput/TouchDateField.tsx +1 -0
- package/src/DateInput/Wheel.tsx +94 -150
- 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 +155 -0
- package/src/DateInput/wheelPhysics.ts +406 -0
- package/src/DateInput/wheelStrip.ts +341 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -0
- 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 +49 -54
- package/src/Icon/Icon.doc.mjs +49 -8
- package/src/Icon/Icon.tsx +15 -7
- package/src/IconButton/IconButton.doc.mjs +141 -21
- 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 +2 -0
- package/src/Layer/useLayerDismissal.ts +2 -0
- package/src/Layer/usePressPin.ts +81 -15
- package/src/Layer/useTouchTrigger.ts +2 -0
- package/src/Lightbox/Lightbox.tsx +19 -0
- package/src/MobileNav/MobileNav.tsx +9 -30
- package/src/Outline/useOutlineFromDOM.ts +2 -0
- package/src/Outline/useScrollSpy.ts +2 -0
- package/src/OverflowList/OverflowList.tsx +2 -0
- package/src/Popover/Popover.tsx +4 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +60 -8
- package/src/PowerSearch/PowerSearch.tsx +627 -157
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2525 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +39 -6
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +2 -0
- package/src/PowerSearch/PowerSearchToken.tsx +7 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +244 -58
- package/src/PowerSearch/formatFilterValue.ts +55 -17
- package/src/PowerSearch/formatTokenValue.ts +222 -0
- package/src/PowerSearch/powerSearchDateZone.ts +64 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/PowerSearch/types.ts +2 -0
- 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 +169 -109
- package/src/Resizable/createResizable.ts +831 -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 +5 -12
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- 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 +4 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +2 -0
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/TimeInput/TimeInput.tsx +2 -0
- package/src/TimeInput/TouchTimeField.tsx +2 -0
- package/src/Timer/Timer.tsx +1 -0
- package/src/Timestamp/Timestamp.tsx +1 -1
- 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 +19 -3
- package/src/Tokenizer/Tokenizer.tsx +73 -51
- package/src/Tokenizer/TokenizerBottomSheet.tsx +1 -1
- package/src/Tokenizer/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +61 -56
- 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 +1 -1
- 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 +20 -5
- 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 +182 -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 +57 -60
- package/src/hooks/useScrollableArea.ts +4 -0
- package/src/hooks/useStreamingText.ts +2 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +43 -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-locales/en.generated.ts +41 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +42 -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/motion/MEASUREMENTS.md +18 -0
- package/src/motion/README.md +10 -5
- package/src/motion/animatedLayout.ts +10 -5
- package/src/motion/animator.ts +66 -31
- 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/index.ts +4 -3
- 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/motionKnobs.ts +4 -3
- package/src/theme/themeMotion.ts +7 -0
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/focusReturn.ts +30 -0
- package/src/utils/interactionModality.ts +4 -0
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/plainDate.ts +21 -0
- package/src/utils/pressFeedback.ts +24 -6
- package/src/utils/triggerFocus.ts +80 -0
- 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/internal/touch-sheet.ts +0 -21
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type WheelCurve, type WheelLayout } from './wheelPhysics.js';
|
|
2
|
+
/** How a motion ended: arrived on its row, or stopped before. */
|
|
3
|
+
export type WheelMotionOutcome = 'arrived' | 'stopped';
|
|
4
|
+
/** Options for one motion. */
|
|
5
|
+
export interface PlayOptions {
|
|
6
|
+
/** Tick as rows reach the band (a drag's release); a tap's spin does not. */
|
|
7
|
+
ticks?: boolean;
|
|
8
|
+
/** Called once when the motion ends, either way. */
|
|
9
|
+
onEnd?: (outcome: WheelMotionOutcome, offset: number) => void;
|
|
10
|
+
/** Started by a touch drag's release, which cross-fades under Reduce Motion. */
|
|
11
|
+
touchRelease?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The momentum that continues a throw: a coast, and its bounce at an end.
|
|
14
|
+
* It is direct movement, so it plays under Reduce Motion too, as scrolling
|
|
15
|
+
* keeps decelerating under iOS Reduce Motion.
|
|
16
|
+
*/
|
|
17
|
+
momentum?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** One picker column's offset and everything that moves it. */
|
|
20
|
+
export interface WheelStrip {
|
|
21
|
+
/** The strip the offset moves (null detaches it). */
|
|
22
|
+
attach(strip: HTMLElement | null): void;
|
|
23
|
+
/** Update the rows (a new option list); keeps the offset. */
|
|
24
|
+
setLayout(layout: WheelLayout): void;
|
|
25
|
+
/**
|
|
26
|
+
* Tell `listener` the position of the row nearest the band whenever it
|
|
27
|
+
* changes. That is on a drag frame, where a motion stops or ends, and at
|
|
28
|
+
* rest. A cross-fade's landing counts as an end. A motion itself reports
|
|
29
|
+
* nothing until it ends, so the compositor plays it without the main thread
|
|
30
|
+
* painting a mark per row.
|
|
31
|
+
*/
|
|
32
|
+
onNearestChange(listener: ((position: number) => void) | null): void;
|
|
33
|
+
/** Whether a motion is playing. */
|
|
34
|
+
isMoving(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The offset on screen at `time` (ms, the document timeline's clock; default
|
|
37
|
+
* now). It is the animator's presentation value. So a motion that has not
|
|
38
|
+
* started on screen yet shows its start.
|
|
39
|
+
*/
|
|
40
|
+
offset(time?: number): number;
|
|
41
|
+
/** Where the wheel will be at rest: the motion's end, or the offset now. */
|
|
42
|
+
target(): number;
|
|
43
|
+
/**
|
|
44
|
+
* Show `offset` at once, stopping any motion: a drag frame or a park. A drag
|
|
45
|
+
* frame passes `ticks`, which also keeps the strip on its own compositing
|
|
46
|
+
* layer for the frames that follow.
|
|
47
|
+
*/
|
|
48
|
+
setOffset(offset: number, options?: {
|
|
49
|
+
ticks?: boolean;
|
|
50
|
+
}): void;
|
|
51
|
+
/** Forget the previous drag frame (a new gesture starts). */
|
|
52
|
+
resetDrag(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Stop the motion where it was on screen at `time` (a finger landing on a
|
|
55
|
+
* spinning wheel: its touch-down time). Returns that offset.
|
|
56
|
+
*/
|
|
57
|
+
stop(time?: number): number;
|
|
58
|
+
/** Play `curve` from the current offset; the strip ends at `curve.to`. */
|
|
59
|
+
play(curve: WheelCurve, options?: PlayOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Forget the row last reported nearest the band, so the next report names it
|
|
62
|
+
* again even unchanged. A caller that clears its mark as a motion starts then
|
|
63
|
+
* gets it back. That happens when the motion ends on the row it began on.
|
|
64
|
+
*/
|
|
65
|
+
forgetNearest(): void;
|
|
66
|
+
/** Stop everything; a motion still running ends as stopped. */
|
|
67
|
+
dispose(): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a wheel's strip on a fresh animator. It uses the internal animator
|
|
71
|
+
* for three jobs the public handle lacks:
|
|
72
|
+
*
|
|
73
|
+
* - It plays a closed-form curve on the compositor: a coast onto a row, a
|
|
74
|
+
* snap, a spin.
|
|
75
|
+
* - It times haptic ticks on that curve's clock.
|
|
76
|
+
* - It substitutes Reduce Motion's cross-fade for a move.
|
|
77
|
+
*
|
|
78
|
+
* A release's coast and its bounce at an end are momentum (`decay`), so they
|
|
79
|
+
* keep their motion under Reduce Motion. Every other curve is a transition
|
|
80
|
+
* (`play`). Under Reduce Motion the animator cross-fades it after a touch or
|
|
81
|
+
* on a coarse pointer. Otherwise it lands at once.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```
|
|
85
|
+
* const strip = createWheelStrip({rowHeight: 28, rowCount: 60});
|
|
86
|
+
* strip.attach(element);
|
|
87
|
+
* strip.setOffset(30 * 28);
|
|
88
|
+
* strip.play(planRelease(strip.offset(), 900, layout).curve, {ticks: true, momentum: true});
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function createWheelStrip(initialLayout: WheelLayout): WheelStrip;
|
|
92
|
+
//# sourceMappingURL=wheelStrip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wheelStrip.d.ts","sourceRoot":"","sources":["../../src/DateInput/wheelStrip.ts"],"names":[],"mappings":"AAqBA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAExB,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC;AAEvD,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oDAAoD;IACpD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,gFAAgF;IAChF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,6DAA6D;IAC7D,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC;;;;;;OAMG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;IACrE,mCAAmC;IACnC,QAAQ,IAAI,OAAO,CAAC;IACpB;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,MAAM,IAAI,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI,CAAC;IAC7D,6DAA6D;IAC7D,SAAS,IAAI,IAAI,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACrD;;;;OAIG;IACH,aAAa,IAAI,IAAI,CAAC;IACtB,+DAA+D;IAC/D,OAAO,IAAI,IAAI,CAAC;CACjB;AAgBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,WAAW,GAAG,UAAU,CA+MvE"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file wheelStrip.ts
|
|
5
|
+
* @input The touch wheel's strip (its flat rows in one element), its layout,
|
|
6
|
+
* and curves from wheelPhysics.ts
|
|
7
|
+
* @output createWheelStrip: the one owner of a wheel's offset. It writes a
|
|
8
|
+
* drag's frames, plays and stops curves, ticks, and reports the nearest row
|
|
9
|
+
* @position Glue of the touch picker wheel (PickerWheel.tsx) over the shared
|
|
10
|
+
* animator (motion/animator.ts)
|
|
11
|
+
*
|
|
12
|
+
* The strip is the one element that moves, on `translate`, so a motion plays
|
|
13
|
+
* on the compositor with no layout or paint per frame.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update wheelStrip.test.ts and PickerWheel.tsx.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { canVibrate, playHaptic } from "../gestures/haptics.js";
|
|
19
|
+
import { createMotionAnimator } from "../motion/animator.js";
|
|
20
|
+
import { reducedMotionFade } from "../motion/reducedMotion.js";
|
|
21
|
+
import { picker } from "../motion/uikit/picker.js";
|
|
22
|
+
import { nearestIndex, reachesRow, tickTimes } from "./wheelPhysics.js";
|
|
23
|
+
|
|
24
|
+
/** How a motion ended: arrived on its row, or stopped before. */
|
|
25
|
+
|
|
26
|
+
/** Options for one motion. */
|
|
27
|
+
|
|
28
|
+
/** One picker column's offset and everything that moves it. */
|
|
29
|
+
|
|
30
|
+
function now() {
|
|
31
|
+
const time = typeof document !== 'undefined' ? document.timeline?.currentTime : null;
|
|
32
|
+
return typeof time === 'number' ? time : performance.now();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates a wheel's strip on a fresh animator. It uses the internal animator
|
|
37
|
+
* for three jobs the public handle lacks:
|
|
38
|
+
*
|
|
39
|
+
* - It plays a closed-form curve on the compositor: a coast onto a row, a
|
|
40
|
+
* snap, a spin.
|
|
41
|
+
* - It times haptic ticks on that curve's clock.
|
|
42
|
+
* - It substitutes Reduce Motion's cross-fade for a move.
|
|
43
|
+
*
|
|
44
|
+
* A release's coast and its bounce at an end are momentum (`decay`), so they
|
|
45
|
+
* keep their motion under Reduce Motion. Every other curve is a transition
|
|
46
|
+
* (`play`). Under Reduce Motion the animator cross-fades it after a touch or
|
|
47
|
+
* on a coarse pointer. Otherwise it lands at once.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```
|
|
51
|
+
* const strip = createWheelStrip({rowHeight: 28, rowCount: 60});
|
|
52
|
+
* strip.attach(element);
|
|
53
|
+
* strip.setOffset(30 * 28);
|
|
54
|
+
* strip.play(planRelease(strip.offset(), 900, layout).curve, {ticks: true, momentum: true});
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export function createWheelStrip(initialLayout) {
|
|
58
|
+
const animator = createMotionAnimator(null);
|
|
59
|
+
let layout = initialLayout;
|
|
60
|
+
let running = null;
|
|
61
|
+
let nearestListener = null;
|
|
62
|
+
let lastNearest = null;
|
|
63
|
+
let lastTick = -Infinity;
|
|
64
|
+
/** Last offset a drag frame showed, for its ticks. */
|
|
65
|
+
let dragPrevious = null;
|
|
66
|
+
const shown = time =>
|
|
67
|
+
// The strip's top sits on the band's row: offset `o` is `translate` −o.
|
|
68
|
+
-animator.get('y', time);
|
|
69
|
+
const reportNearest = offset => {
|
|
70
|
+
const position = nearestIndex(offset, layout);
|
|
71
|
+
if (position === lastNearest) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
lastNearest = position;
|
|
75
|
+
nearestListener?.(position);
|
|
76
|
+
};
|
|
77
|
+
const tick = time => {
|
|
78
|
+
if (time - lastTick < picker.selectionTick.minimumIntervalMs) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
lastTick = time;
|
|
82
|
+
playHaptic('selection');
|
|
83
|
+
};
|
|
84
|
+
const clear = motion => {
|
|
85
|
+
for (const timer of motion.timers) {
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
}
|
|
88
|
+
motion.timers.length = 0;
|
|
89
|
+
if (running === motion) {
|
|
90
|
+
running = null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The motion's timers, from `origin` (when it started on screen): its
|
|
96
|
+
* ticks, a cross-fade's landing, and its end.
|
|
97
|
+
*/
|
|
98
|
+
const schedule = (motion, origin, {
|
|
99
|
+
endMs,
|
|
100
|
+
ticks,
|
|
101
|
+
landingMs
|
|
102
|
+
}) => {
|
|
103
|
+
for (const timer of motion.timers) {
|
|
104
|
+
clearTimeout(timer);
|
|
105
|
+
}
|
|
106
|
+
motion.timers.length = 0;
|
|
107
|
+
const elapsed = now() - origin;
|
|
108
|
+
if (ticks) {
|
|
109
|
+
for (const t of tickTimes(motion.curve, layout.rowHeight)) {
|
|
110
|
+
motion.timers.push(setTimeout(() => {
|
|
111
|
+
if (running === motion) {
|
|
112
|
+
tick(now());
|
|
113
|
+
}
|
|
114
|
+
}, Math.max(0, t * 1000 - elapsed)));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (landingMs != null) {
|
|
118
|
+
motion.timers.push(setTimeout(() => {
|
|
119
|
+
if (running === motion) {
|
|
120
|
+
reportNearest(motion.curve.to);
|
|
121
|
+
}
|
|
122
|
+
}, Math.max(0, landingMs - elapsed)));
|
|
123
|
+
}
|
|
124
|
+
motion.timers.push(setTimeout(() => {
|
|
125
|
+
if (running !== motion) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
clear(motion);
|
|
129
|
+
reportNearest(motion.curve.to);
|
|
130
|
+
motion.onEnd?.('arrived', motion.curve.to);
|
|
131
|
+
}, Math.max(0, endMs - elapsed)));
|
|
132
|
+
};
|
|
133
|
+
const stop = time => {
|
|
134
|
+
const motion = running;
|
|
135
|
+
if (motion == null) {
|
|
136
|
+
return shown();
|
|
137
|
+
}
|
|
138
|
+
const offset = shown(time);
|
|
139
|
+
clear(motion);
|
|
140
|
+
// `set` ends the strip's animation and puts it where it was shown.
|
|
141
|
+
animator.set({
|
|
142
|
+
y: -offset
|
|
143
|
+
});
|
|
144
|
+
reportNearest(offset);
|
|
145
|
+
motion.onEnd?.('stopped', offset);
|
|
146
|
+
return offset;
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
attach(strip) {
|
|
150
|
+
animator.attach(strip);
|
|
151
|
+
},
|
|
152
|
+
setLayout(next) {
|
|
153
|
+
layout = next;
|
|
154
|
+
},
|
|
155
|
+
onNearestChange(listener) {
|
|
156
|
+
nearestListener = listener;
|
|
157
|
+
lastNearest = null;
|
|
158
|
+
},
|
|
159
|
+
isMoving() {
|
|
160
|
+
return running != null;
|
|
161
|
+
},
|
|
162
|
+
offset(time) {
|
|
163
|
+
return shown(time);
|
|
164
|
+
},
|
|
165
|
+
target() {
|
|
166
|
+
return running?.curve.to ?? shown();
|
|
167
|
+
},
|
|
168
|
+
setOffset(offset, {
|
|
169
|
+
ticks = false
|
|
170
|
+
} = {}) {
|
|
171
|
+
if (running != null) {
|
|
172
|
+
stop();
|
|
173
|
+
}
|
|
174
|
+
if (ticks && dragPrevious != null && canVibrate() && reachesRow(dragPrevious, offset, layout.rowHeight)) {
|
|
175
|
+
tick(now());
|
|
176
|
+
}
|
|
177
|
+
dragPrevious = offset;
|
|
178
|
+
// A park is a one-off write: no layer for a strip at rest.
|
|
179
|
+
animator.set({
|
|
180
|
+
y: -offset
|
|
181
|
+
}, {
|
|
182
|
+
promote: ticks
|
|
183
|
+
});
|
|
184
|
+
reportNearest(offset);
|
|
185
|
+
},
|
|
186
|
+
resetDrag() {
|
|
187
|
+
dragPrevious = null;
|
|
188
|
+
},
|
|
189
|
+
stop,
|
|
190
|
+
play(curve, {
|
|
191
|
+
ticks = false,
|
|
192
|
+
onEnd,
|
|
193
|
+
touchRelease = false,
|
|
194
|
+
momentum = false
|
|
195
|
+
} = {}) {
|
|
196
|
+
stop();
|
|
197
|
+
dragPrevious = null;
|
|
198
|
+
const element = animator.element;
|
|
199
|
+
// What Reduce Motion makes of a transition: null while motion plays.
|
|
200
|
+
// Momentum is never substituted.
|
|
201
|
+
const fade = momentum ? null : reducedMotionFade(element, {
|
|
202
|
+
touchRelease
|
|
203
|
+
});
|
|
204
|
+
const endMs = fade == null ? curve.duration * 1000 : fade.duration;
|
|
205
|
+
if (!(endMs > 0)) {
|
|
206
|
+
animator.set({
|
|
207
|
+
y: -curve.to
|
|
208
|
+
});
|
|
209
|
+
reportNearest(curve.to);
|
|
210
|
+
onEnd?.('arrived', curve.to);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const motionCurve = {
|
|
214
|
+
duration: curve.duration,
|
|
215
|
+
at: t => -curve.value(t),
|
|
216
|
+
velocity: t => -curve.velocity(t)
|
|
217
|
+
};
|
|
218
|
+
const handle = momentum ? animator.decay({
|
|
219
|
+
y: motionCurve
|
|
220
|
+
}, {
|
|
221
|
+
touchRelease
|
|
222
|
+
}) : animator.play({
|
|
223
|
+
y: motionCurve
|
|
224
|
+
}, {
|
|
225
|
+
touchRelease
|
|
226
|
+
});
|
|
227
|
+
const motion = {
|
|
228
|
+
curve,
|
|
229
|
+
onEnd,
|
|
230
|
+
timers: []
|
|
231
|
+
};
|
|
232
|
+
running = motion;
|
|
233
|
+
const plan = {
|
|
234
|
+
endMs,
|
|
235
|
+
// A cross-fade has no travel to tick through.
|
|
236
|
+
ticks: ticks && fade == null && canVibrate(),
|
|
237
|
+
// A cross-fade lands its rows at its midpoint, faded out.
|
|
238
|
+
landingMs: fade == null ? null : endMs / 2
|
|
239
|
+
};
|
|
240
|
+
schedule(motion, now(), plan);
|
|
241
|
+
// A busy main thread can hold a motion's first frame: its timers then
|
|
242
|
+
// follow the start the browser gives it. The animator's start promise
|
|
243
|
+
// only resolves, so nothing here waits on a rejection.
|
|
244
|
+
void handle.started.then(start => {
|
|
245
|
+
if (running === motion) {
|
|
246
|
+
schedule(motion, start, plan);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
forgetNearest() {
|
|
251
|
+
lastNearest = null;
|
|
252
|
+
},
|
|
253
|
+
dispose() {
|
|
254
|
+
stop();
|
|
255
|
+
animator.dispose();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchDateTimeField.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/TouchDateTimeField.tsx"],"names":[],"mappings":"AA6GA,OAAO,KAAK,EAAC,kBAAkB,EAAoB,MAAM,iBAAiB,CAAC;AAoV3E,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAElB,aAAa,EAAE,cAAc,EAC7B,kBAAkB,EAAE,mBAAmB,EACvC,QAAgB,EAChB,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,wBAAwB,EACzC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EAEZ,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,gBAAoB,EAClC,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"TouchDateTimeField.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/TouchDateTimeField.tsx"],"names":[],"mappings":"AA6GA,OAAO,KAAK,EAAC,kBAAkB,EAAoB,MAAM,iBAAiB,CAAC;AAoV3E,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAElB,aAAa,EAAE,cAAc,EAC7B,kBAAkB,EAAE,mBAAmB,EACvC,QAAgB,EAChB,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,wBAAwB,EACzC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EAEZ,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,gBAAoB,EAClC,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,kBAAkB,+BAggCpB;yBAviCe,kBAAkB"}
|
|
@@ -545,6 +545,8 @@ export function TouchDateTimeField({
|
|
|
545
545
|
return {
|
|
546
546
|
value: hour,
|
|
547
547
|
label: String(hour),
|
|
548
|
+
// Keys step in time order: 12 PM comes before 1 PM.
|
|
549
|
+
order: hour24,
|
|
548
550
|
isDisabled: !rangeOverlaps(hour24 * 3600, hour24 * 3600 + 3599, timeBounds.min, timeBounds.max)
|
|
549
551
|
};
|
|
550
552
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAkC9C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,4EAA4E;AAC5E,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAuBD,2FAA2F;AAC3F,eAAO,MAAM,uCAAuC;;;;;;;;;;;CAW1C,CAAC;AAwLX;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc;;;;;EAUpE;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAE3C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EAAE,UAAU,EAClB,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAmB,EACnB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCAyZb;yBAzae,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -55,7 +55,7 @@ import { DialogContext } from "./DialogContext.js";
|
|
|
55
55
|
import { themeProps } from "../utils/themeProps.js";
|
|
56
56
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
57
57
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
58
|
-
import { focusForLastInput,
|
|
58
|
+
import { focusForLastInput, prepareFocusReturnOnRemoval } from "../utils/focusReturn.js";
|
|
59
59
|
import { ModalAnnounceProvider } from "../hooks/ModalAnnounceProvider.js";
|
|
60
60
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
61
61
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -414,7 +414,8 @@ export function Dialog({
|
|
|
414
414
|
const allowEscape = purpose !== 'required';
|
|
415
415
|
const allowBackdropClick = purpose === 'info';
|
|
416
416
|
|
|
417
|
-
//
|
|
417
|
+
// Syncs the native dialog with `isOpen` through `showModal()` and `close()`.
|
|
418
|
+
// An inline dialog is not in the top layer, so it skips this.
|
|
418
419
|
useEffect(() => {
|
|
419
420
|
if (isInline) {
|
|
420
421
|
return;
|
|
@@ -461,39 +462,15 @@ export function Dialog({
|
|
|
461
462
|
}, [isOpen, isInline]);
|
|
462
463
|
|
|
463
464
|
// A dialog that unmounts while open (rendered only while open, or removed
|
|
464
|
-
// with the rest of a view) never runs the close branch above
|
|
465
|
-
//
|
|
466
|
-
// it, or dropped to the body by the removal, goes back to the opener.
|
|
465
|
+
// with the rest of a view) never runs the close branch above. Focus the
|
|
466
|
+
// removal lost goes back to the opener.
|
|
467
467
|
useEffect(() => {
|
|
468
|
-
|
|
468
|
+
const dialog = dialogRef.current;
|
|
469
|
+
if (isInline || dialog == null) {
|
|
469
470
|
return;
|
|
470
471
|
}
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
// element can no longer be found once the dialog is gone.
|
|
474
|
-
const host = dialog?.ownerDocument.defaultView?.frameElement ?? null;
|
|
475
|
-
return () => {
|
|
476
|
-
const trigger = triggerElementRef.current;
|
|
477
|
-
if (dialog == null || trigger == null) {
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
// Checked once the commit has finished: StrictMode's simulated unmount
|
|
481
|
-
// leaves the dialog in the document, and only a real removal returns
|
|
482
|
-
// focus.
|
|
483
|
-
queueMicrotask(() => {
|
|
484
|
-
if (dialog.isConnected || !trigger.isConnected) {
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
// isFocusLost reads the dialog's own document. For a dialog in an
|
|
488
|
-
// iframe, the document that hosts the frame must also have lost focus
|
|
489
|
-
// or keep it on that frame, wherever the opener is: a control the
|
|
490
|
-
// user pressed outside the frame to remove the dialog, or the frame
|
|
491
|
-
// itself, keeps its focus.
|
|
492
|
-
if (isFocusLost(dialog) && (host == null || isFocusLost(host))) {
|
|
493
|
-
focusForLastInput(trigger);
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
};
|
|
472
|
+
const returnFocusOnRemoval = prepareFocusReturnOnRemoval(dialog);
|
|
473
|
+
return () => returnFocusOnRemoval(triggerElementRef.current);
|
|
497
474
|
}, [isInline]);
|
|
498
475
|
|
|
499
476
|
// Host app-global surfaces (toasts) inside this modal while it is open, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawerDialogPresence.d.ts","sourceRoot":"","sources":["../../src/Drawer/useDrawerDialogPresence.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAef,KAAK,8BAA8B,GAAG;IACpC,SAAS,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,CAAC;AA6DF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,OAAO,EACP,aAAa,GACd,EAAE,8BAA8B,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"useDrawerDialogPresence.d.ts","sourceRoot":"","sources":["../../src/Drawer/useDrawerDialogPresence.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAef,KAAK,8BAA8B,GAAG;IACpC,SAAS,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,CAAC;AA6DF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,OAAO,EACP,aAAa,GACd,EAAE,8BAA8B,GAAG,IAAI,CAsEvC"}
|
|
@@ -109,6 +109,9 @@ export function useDrawerDialogPresence({
|
|
|
109
109
|
}) {
|
|
110
110
|
// Element focused when the drawer opened — restored on close.
|
|
111
111
|
const triggerElementRef = useRef(null);
|
|
112
|
+
|
|
113
|
+
// Syncs the drawer's native host with `isOpen`. It shows or hides the
|
|
114
|
+
// top-layer host, keeps the opener, waits for the exit, and returns focus.
|
|
112
115
|
useEffect(() => {
|
|
113
116
|
const dialog = dialogRef.current;
|
|
114
117
|
if (!dialog) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuOverflow.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/useMenuOverflow.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,OAAO,EACf,gBAAgB,CAAC,EAAE,OAAO,GACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"useMenuOverflow.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/useMenuOverflow.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,OAAO,EACf,gBAAgB,CAAC,EAAE,OAAO,GACzB,OAAO,CA+ET"}
|
|
@@ -43,6 +43,9 @@ export function useMenuOverflow(menuRef, content, isOpen, expectedOverflow) {
|
|
|
43
43
|
hasOverflow
|
|
44
44
|
});
|
|
45
45
|
}, [menuRef]);
|
|
46
|
+
|
|
47
|
+
// Syncs the overflow measurement with the open menu. It measures, then
|
|
48
|
+
// observes resize, DOM changes and window resize.
|
|
46
49
|
useIsomorphicLayoutEffect(() => {
|
|
47
50
|
if (!isOpen) {
|
|
48
51
|
return;
|
|
@@ -71,6 +74,8 @@ export function useMenuOverflow(menuRef, content, isOpen, expectedOverflow) {
|
|
|
71
74
|
window.visualViewport?.removeEventListener('resize', measureOverflow);
|
|
72
75
|
};
|
|
73
76
|
}, [isOpen, measureOverflow, menuRef]);
|
|
77
|
+
|
|
78
|
+
// Measures overflow again after the content changes while the menu is open.
|
|
74
79
|
useIsomorphicLayoutEffect(() => {
|
|
75
80
|
if (isOpen) {
|
|
76
81
|
measureOverflow();
|
package/dist/Field/Field.js
CHANGED
|
@@ -22,11 +22,11 @@ import { FieldStatus } from "../FieldStatus/FieldStatus.js";
|
|
|
22
22
|
import { useFieldStatusAnnouncement } from "../FieldStatus/useFieldStatusAnnouncement.js";
|
|
23
23
|
import "../theme/tokens.stylex.js";
|
|
24
24
|
import { spacingVars, borderVars, sizeVars } from "../theme/tokens.stylex.js";
|
|
25
|
-
import { mergeProps } from "../utils/
|
|
25
|
+
import { mergeProps } from "../utils/mergeProps.js";
|
|
26
26
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
27
27
|
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
28
28
|
import { Text } from "../Text/Text.js";
|
|
29
|
-
import { VisuallyHidden } from "../VisuallyHidden/
|
|
29
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
30
30
|
import { themeProps } from "../utils/themeProps.js";
|
|
31
31
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
32
32
|
const styles = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldStatusAnnouncement.d.ts","sourceRoot":"","sources":["../../src/FieldStatus/useFieldStatusAnnouncement.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,eAAe,GAAG,SAAS,GAChC,IAAI,
|
|
1
|
+
{"version":3,"file":"useFieldStatusAnnouncement.d.ts","sourceRoot":"","sources":["../../src/FieldStatus/useFieldStatusAnnouncement.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,eAAe,GAAG,SAAS,GAChC,IAAI,CAQN"}
|
|
@@ -30,6 +30,7 @@ import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
|
30
30
|
*/
|
|
31
31
|
export function useFieldStatusAnnouncement(message, type) {
|
|
32
32
|
const announce = useAnnounce();
|
|
33
|
+
// Syncs the live region with the status message.
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
if (message) {
|
|
35
36
|
announce(message, type === 'error' ? 'assertive' : 'polite');
|
|
@@ -48,7 +48,11 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
48
48
|
* shows an indicator (the "required" one).
|
|
49
49
|
* - `'required'` — fields read as required; only a field with `isOptional`
|
|
50
50
|
* shows an indicator (the "optional" one). Fields without `isOptional`
|
|
51
|
-
* expose `aria-required` even though they show no indicator.
|
|
51
|
+
* expose `aria-required` even though they show no indicator. Checkboxes,
|
|
52
|
+
* switches and checkbox groups are the exception: an unchecked box, an off
|
|
53
|
+
* switch or an empty group is an answer, so they take no required state
|
|
54
|
+
* from the default. A checkbox or switch is required only through its own
|
|
55
|
+
* `isRequired`.
|
|
52
56
|
* - unset — today's behavior: `isRequired` and `isOptional` each show their
|
|
53
57
|
* own indicator independently.
|
|
54
58
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AA2C7B,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC
|
|
1
|
+
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AA2C7B,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACtC;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAsB,EACtB,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BA0BjB;yBAnCe,UAAU"}
|
|
@@ -47,9 +47,10 @@ export interface HoverCardProps extends Pick<BaseProps, 'xstyle' | 'className' |
|
|
|
47
47
|
hideDelay?: number;
|
|
48
48
|
/**
|
|
49
49
|
* When to trigger on focus:
|
|
50
|
-
* - `auto`:
|
|
51
|
-
*
|
|
52
|
-
* - `
|
|
50
|
+
* - `auto`: focus on the trigger itself, or within a trigger that is
|
|
51
|
+
* focusable when focus arrives
|
|
52
|
+
* - `always`: focus on the trigger or anything inside it
|
|
53
|
+
* - `never`: never on focus (for composite widgets)
|
|
53
54
|
*
|
|
54
55
|
* @default 'auto'
|
|
55
56
|
*/
|
|
@@ -87,7 +88,8 @@ export interface HoverCardProps extends Pick<BaseProps, 'xstyle' | 'className' |
|
|
|
87
88
|
/**
|
|
88
89
|
* Whether to show hover indication (dashed underline) on a text trigger.
|
|
89
90
|
* An element trigger keeps its own styling, so this has no effect on it.
|
|
90
|
-
* - `'auto'`: Show when children is
|
|
91
|
+
* - `'auto'`: Show when children is text: strings and numbers, such as
|
|
92
|
+
* `Edited {when}`, with holes such as `false` and `null` ignored
|
|
91
93
|
* - `true`: Show on a text trigger
|
|
92
94
|
* - `false`: Never show
|
|
93
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/HoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"HoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/HoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,YAAY,EACV,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AA6ExB,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,SAAS,EACT,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;;;;;;OASG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAoCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,OAAO,EACP,SAAmB,EACnB,SAAoB,EACpB,KAAW,EACX,SAAe,EACf,YAAqB,EACrB,YAAqB,EACrB,SAAgB,EAChB,KAAK,EACL,YAAY,EACZ,kBAA2B,EAC3B,MAAM,EACN,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,cAAc,GAAG,YAAY,CA2M/B;yBA7Ne,SAAS"}
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
* - /apps/storybook/stories/HoverCard.stories.tsx
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/HoverCard/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useCallback, useRef } from 'react';
|
|
18
|
+
import { useCallback, useRef, useState } from 'react';
|
|
19
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
20
|
+
import { observeMutations } from "../utils/sharedMutationObserver.js";
|
|
19
21
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
20
22
|
import * as stylex from '@stylexjs/stylex';
|
|
21
23
|
import { useHoverCard } from "./useHoverCard.js";
|
|
@@ -65,7 +67,26 @@ function supportsAriaExpanded(el) {
|
|
|
65
67
|
* Check if children are text-only (no React elements)
|
|
66
68
|
*/
|
|
67
69
|
function isTextOnly(children) {
|
|
68
|
-
|
|
70
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
// Text written around an expression, such as `Edited {when}`, reaches React
|
|
74
|
+
// as several strings. Holes that render nothing do not change that; one
|
|
75
|
+
// element does.
|
|
76
|
+
if (!Array.isArray(children)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
let hasText = false;
|
|
80
|
+
for (const child of children.flat(Infinity)) {
|
|
81
|
+
if (!isRenderable(child)) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (typeof child !== 'string' && typeof child !== 'number') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
hasText = true;
|
|
88
|
+
}
|
|
89
|
+
return hasText;
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
/**
|
|
@@ -138,6 +159,30 @@ export function HoverCard({
|
|
|
138
159
|
onHide: handleHide
|
|
139
160
|
});
|
|
140
161
|
|
|
162
|
+
// The wrapper's first element is the trigger, and it can be replaced after
|
|
163
|
+
// mount: by new children, or by a child component that swaps its own root
|
|
164
|
+
// without a render here. Syncs with the DOM: on a replacement the wiring
|
|
165
|
+
// below re-runs, so the old element is released before the new one is wired.
|
|
166
|
+
const [triggerReplacements, setTriggerReplacements] = useState(0);
|
|
167
|
+
const observedTriggerRef = useRef(null);
|
|
168
|
+
useIsomorphicLayoutEffect(() => {
|
|
169
|
+
const wrapper = wrapperRef.current;
|
|
170
|
+
if (textOnly || wrapper == null) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
observedTriggerRef.current = wrapper.firstElementChild;
|
|
174
|
+
return observeMutations(wrapper, {
|
|
175
|
+
childList: true
|
|
176
|
+
}, () => {
|
|
177
|
+
const trigger = wrapper.firstElementChild;
|
|
178
|
+
if (trigger === observedTriggerRef.current) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
observedTriggerRef.current = trigger;
|
|
182
|
+
setTriggerReplacements(count => count + 1);
|
|
183
|
+
});
|
|
184
|
+
}, [textOnly]);
|
|
185
|
+
|
|
141
186
|
// For element children with display:contents, attach ref to first child
|
|
142
187
|
useIsomorphicLayoutEffect(() => {
|
|
143
188
|
if (textOnly) {
|
|
@@ -224,7 +269,7 @@ export function HoverCard({
|
|
|
224
269
|
firstChild.removeAttribute('aria-describedby');
|
|
225
270
|
}
|
|
226
271
|
};
|
|
227
|
-
}, [textOnly, label, hoverCard.ref, hoverCard.id, hoverCard.isOpen, hoverCard.describedBy]);
|
|
272
|
+
}, [textOnly, label, hoverCard.ref, hoverCard.id, hoverCard.isOpen, hoverCard.describedBy, triggerReplacements]);
|
|
228
273
|
|
|
229
274
|
// While closed, useLayer leaves only an inert <template> marker at this JSX
|
|
230
275
|
// position. When the card needs to open, it uses that marker to keep the
|