@astryxdesign/core 0.7.7-canary.c0929c8 → 0.7.7-canary.c19ca12
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 +36 -6
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts +13 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.js +45 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +79 -9
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +23 -4
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +5 -4
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +3 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +2 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +7 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +47 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +13 -2
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +7 -1
- package/dist/CheckboxList/CheckboxListContext.d.ts +6 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +10 -2
- 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/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +13 -27
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +22 -41
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +5 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +23 -45
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +15 -11
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +5 -1
- package/dist/Field/Field.js +2 -2
- package/dist/Field/PanelSearchInput.d.ts +9 -1
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +3 -1
- package/dist/HoverCard/HoverCard.d.ts +4 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +27 -2
- package/dist/HoverCard/useHoverCard.d.ts +5 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +17 -31
- 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/InfoTip/InfoTip.d.ts +63 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -0
- package/dist/InfoTip/InfoTip.js +126 -0
- package/dist/InfoTip/index.d.ts +10 -0
- package/dist/InfoTip/index.d.ts.map +1 -0
- package/dist/InfoTip/index.js +12 -0
- package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +25 -20
- package/dist/Layer/useBackdropPress.d.ts +27 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -0
- package/dist/Layer/useBackdropPress.js +53 -0
- package/dist/Layer/usePressPin.d.ts +20 -10
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +66 -18
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +18 -0
- package/dist/MobileNav/MobileNav.js +0 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +2 -4
- package/dist/Outline/Outline.d.ts +2 -4
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -52
- package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromMarkdown.js +1 -0
- package/dist/Outline/useScrollSpy.js +3 -3
- package/dist/PowerSearch/PowerSearch.d.ts +36 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +571 -302
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +100 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +1913 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +32 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +17 -6
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +170 -61
- package/dist/PowerSearch/formatFilterValue.d.ts +7 -0
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +11 -1
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +160 -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/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +8 -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.map +1 -1
- package/dist/Resizable/ResizeHandle.js +118 -260
- package/dist/Resizable/resizeGesture.d.ts +91 -0
- package/dist/Resizable/resizeGesture.d.ts.map +1 -0
- package/dist/Resizable/resizeGesture.js +251 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +3 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +115 -8
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +8 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts +357 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +1349 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +70 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +264 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +96 -67
- package/dist/Selector/optionShape.d.ts +24 -0
- package/dist/Selector/optionShape.d.ts.map +1 -0
- package/dist/Selector/optionShape.js +48 -0
- package/dist/Selector/selectableOptionEntries.d.ts +20 -0
- package/dist/Selector/selectableOptionEntries.d.ts.map +1 -0
- package/dist/Selector/selectableOptionEntries.js +38 -0
- package/dist/Selector/utils.d.ts +2 -17
- package/dist/Selector/utils.d.ts.map +1 -1
- package/dist/Selector/utils.js +3 -51
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -9
- 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/switchTouch.d.ts +0 -7
- package/dist/Switch/switchTouch.d.ts.map +1 -1
- package/dist/Switch/switchTouch.js +2 -10
- package/dist/Switch/useSwitchTouch.d.ts +2 -11
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +35 -93
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- 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/Toast/Toast.d.ts +11 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +30 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +94 -34
- package/dist/Toast/types.d.ts +9 -3
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Token/Token.d.ts +2 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +13 -4
- package/dist/Token/TokenNamingContext.d.ts +14 -0
- package/dist/Token/TokenNamingContext.d.ts.map +1 -0
- package/dist/Token/TokenNamingContext.js +23 -0
- package/dist/Tokenizer/Tokenizer.d.ts +46 -59
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +40 -57
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +25 -28
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +157 -54
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +19 -0
- package/dist/Tooltip/Tooltip.d.ts +25 -30
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +24 -5
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +45 -28
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +52 -59
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +4 -7
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +4 -7
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -7
- 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 +96 -7
- package/dist/gestures/GestureHost.d.ts +27 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +157 -21
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +4 -3
- package/dist/hooks/actionGroupTracker.d.ts +7 -4
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +19 -56
- 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/pressGroupContext.d.ts +6 -0
- package/dist/hooks/pressGroupContext.d.ts.map +1 -0
- package/dist/hooks/pressGroupContext.js +20 -0
- 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/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useHighlightedOptionScroll.d.ts +11 -1
- package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
- package/dist/hooks/useHighlightedOptionScroll.js +112 -11
- 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/useLongPress.d.ts +6 -2
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +95 -15
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +7 -4
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +4 -2
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts +8 -0
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.js +12 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.js +1 -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-english/Tokenizer/TokenizerBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.js +7 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +33 -1
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +33 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/internal/SheetConfirmation.d.ts +11 -0
- package/dist/internal/SheetConfirmation.d.ts.map +1 -0
- package/dist/internal/SheetConfirmation.js +92 -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/sheetDraft.d.ts +35 -0
- package/dist/internal/sheetDraft.d.ts.map +1 -0
- package/dist/internal/sheetDraft.js +65 -0
- package/dist/internal/touch-sheet.d.ts +21 -0
- package/dist/internal/touch-sheet.d.ts.map +1 -0
- package/dist/internal/touch-sheet.js +19 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts +24 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts.map +1 -0
- package/dist/internal/useDismissSearchOnTouchDrag.js +56 -0
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +41 -18
- package/dist/motion/reducedMotion.d.ts +24 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +78 -1
- package/dist/motion/roles.d.ts +7 -1
- package/dist/motion/roles.d.ts.map +1 -1
- package/dist/motion/roles.js +20 -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 +6 -5
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +6 -5
- package/dist/motion/uikit/segmented.d.ts +55 -0
- package/dist/motion/uikit/segmented.d.ts.map +1 -0
- package/dist/motion/uikit/segmented.js +77 -0
- package/dist/motion/uikit/springs.d.ts +0 -18
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +5 -21
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +15 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +23 -0
- package/dist/privateAttributes/segmentTitle.stylex.d.ts +5 -0
- package/dist/privateAttributes/segmentTitle.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/segmentTitle.stylex.js +22 -0
- package/dist/utils/browserClickWait.d.ts +35 -0
- package/dist/utils/browserClickWait.d.ts.map +1 -0
- package/dist/utils/browserClickWait.js +123 -0
- package/dist/utils/clickGuard.d.ts +14 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +46 -1
- 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/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/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +19 -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 +128 -0
- package/locales/pseudo.json +96 -0
- package/package.json +18 -8
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +37 -5
- package/src/AppShell/useCloseMobileDrawerOnActivate.ts +52 -0
- package/src/BottomSheet/BottomSheet.tsx +95 -10
- package/src/BottomSheet/BottomSheetPanel.tsx +40 -5
- package/src/BottomSheet/bottomSheetStack.ts +8 -4
- package/src/BottomSheet/useSheetGestures.ts +3 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +13 -3
- package/src/Button/Button.tsx +63 -5
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.tsx +36 -9
- package/src/CheckboxList/CheckboxList.doc.mjs +4 -2
- package/src/CheckboxList/CheckboxList.tsx +6 -0
- package/src/CheckboxList/CheckboxListContext.tsx +6 -0
- package/src/CheckboxList/CheckboxListItem.tsx +11 -2
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/DateInput/DateInput.tsx +8 -2
- package/src/DateInput/MonthScroller.tsx +18 -22
- package/src/DateInput/Wheel.tsx +30 -32
- package/src/DateTimeInput/DateTimeInput.tsx +8 -2
- package/src/Dialog/Dialog.tsx +54 -45
- package/src/Drawer/Drawer.tsx +28 -11
- package/src/Drawer/useDrawerDialogPresence.ts +5 -1
- package/src/Field/Field.tsx +2 -2
- package/src/Field/PanelSearchInput.tsx +11 -0
- package/src/HoverCard/HoverCard.doc.mjs +4 -2
- package/src/HoverCard/HoverCard.tsx +35 -4
- package/src/HoverCard/useHoverCard.doc.mjs +178 -36
- package/src/HoverCard/useHoverCard.tsx +46 -52
- package/src/Icon/Icon.doc.mjs +49 -8
- package/src/Icon/Icon.tsx +15 -7
- package/src/InfoTip/InfoTip.doc.mjs +192 -0
- package/src/InfoTip/InfoTip.tsx +186 -0
- package/src/InfoTip/index.ts +14 -0
- package/src/Layer/layerAnimations.stylex.ts +24 -16
- package/src/Layer/useBackdropPress.ts +81 -0
- package/src/Layer/usePressPin.ts +86 -26
- package/src/Lightbox/Lightbox.tsx +18 -0
- package/src/MobileNav/MobileNav.tsx +1 -1
- package/src/MultiSelector/hooks.ts +2 -4
- package/src/Outline/Outline.doc.mjs +177 -51
- package/src/Outline/Outline.tsx +5 -57
- package/src/Outline/useOutlineFromMarkdown.doc.mjs +157 -0
- package/src/Outline/useOutlineFromMarkdown.ts +1 -0
- package/src/Outline/useScrollSpy.ts +3 -3
- package/src/PowerSearch/PowerSearch.doc.mjs +55 -6
- package/src/PowerSearch/PowerSearch.tsx +798 -324
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2515 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +28 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +203 -38
- package/src/PowerSearch/formatFilterValue.ts +18 -1
- package/src/PowerSearch/formatTokenValue.ts +215 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioList.tsx +7 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/Resizable/ResizeHandle.tsx +133 -328
- package/src/Resizable/resizeGesture.ts +368 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +3 -3
- package/src/SegmentedControl/SegmentedControl.tsx +179 -5
- package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +12 -1
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +1640 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +308 -0
- package/src/Selector/Selector.tsx +136 -89
- package/src/Selector/optionShape.ts +64 -0
- package/src/Selector/selectableOptionEntries.ts +39 -0
- package/src/Selector/utils.ts +9 -68
- package/src/SideNav/SideNavItem.tsx +3 -7
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- package/src/Switch/switchTouch.ts +2 -10
- package/src/Switch/useSwitchTouch.ts +38 -104
- package/src/Table/BaseTable.tsx +46 -12
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/Toast/Toast.doc.mjs +4 -3
- package/src/Toast/Toast.tsx +57 -32
- package/src/Toast/ToastViewport.tsx +121 -35
- package/src/Toast/types.ts +9 -3
- package/src/Token/Token.tsx +15 -4
- package/src/Token/TokenNamingContext.ts +28 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Tokenizer/Tokenizer.tsx +89 -85
- package/src/Tokenizer/TokenizerBottomSheet.tsx +219 -93
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +24 -0
- package/src/Tooltip/Tooltip.doc.mjs +123 -54
- package/src/Tooltip/Tooltip.tsx +36 -39
- package/src/Tooltip/index.ts +0 -1
- package/src/Tooltip/useTooltip.doc.mjs +171 -33
- package/src/Tooltip/useTooltip.tsx +98 -86
- package/src/TopNav/TopNavItem.tsx +6 -5
- package/src/TopNav/TopNavMegaMenuItem.tsx +6 -5
- package/src/TopNav/TopNavMenu.tsx +6 -5
- 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 +198 -20
- package/src/gestures/PressTracker.ts +4 -3
- package/src/gestures/README.md +7 -1
- package/src/hooks/actionGroupTracker.ts +32 -61
- package/src/hooks/index.ts +2 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- 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/useAttachment.ts +1 -1
- package/src/hooks/useHighlightedOptionScroll.ts +123 -15
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +136 -15
- package/src/hooks/useMediaQuery.doc.mjs +2 -2
- package/src/hooks/useMediaQuery.ts +13 -4
- package/src/hooks/useMenuPress.ts +8 -2
- package/src/i18n/generated-english/InfoTip/InfoTip.generated.ts +13 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearch.generated.ts +1 -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-english/Tokenizer/TokenizerBottomSheet.generated.ts +7 -1
- package/src/i18n/generated-locales/en.generated.ts +43 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +44 -0
- package/src/index.ts +14 -0
- package/src/internal/SheetConfirmation.tsx +101 -0
- package/src/internal/indicatorPress.stylex.ts +24 -0
- package/src/internal/sheetDraft.ts +80 -0
- package/src/internal/touch-sheet.ts +21 -0
- package/src/internal/useDismissSearchOnTouchDrag.ts +69 -0
- package/src/motion/MEASUREMENTS.md +7 -0
- package/src/motion/README.md +9 -5
- package/src/motion/animator.ts +61 -29
- package/src/motion/reducedMotion.ts +79 -1
- package/src/motion/roles.ts +20 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/motion/uikit/index.ts +5 -5
- package/src/motion/uikit/segmented.ts +74 -0
- package/src/motion/uikit/springs.ts +5 -21
- package/src/privateAttributes/pressGroupItem.stylex.ts +23 -0
- package/src/privateAttributes/segmentTitle.stylex.ts +22 -0
- package/src/utils/browserClickWait.ts +133 -0
- package/src/utils/clickGuard.ts +64 -1
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/focusReturn.ts +30 -0
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/pressFeedback.ts +19 -6
- package/src/utils/triggerFocus.ts +80 -0
- package/dist/internal/tokenizer-presentation.d.ts +0 -21
- package/dist/internal/tokenizer-presentation.d.ts.map +0 -1
- package/dist/internal/tokenizer-presentation.js +0 -21
- package/src/internal/tokenizer-presentation.ts +0 -25
package/dist/hooks/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { useClickableContainer, INTERACTIVE_SELECTORS, hasInteractiveAncestor, h
|
|
|
35
35
|
export { useInputContainer } from "./useInputContainer.js";
|
|
36
36
|
export { useInputStatusIcon } from "./useInputStatusIcon.js";
|
|
37
37
|
export { useInteractiveRole } from "./useInteractiveRole.js";
|
|
38
|
+
export { useAnimator } from "./useAnimator.js";
|
|
38
39
|
export { useLongPress } from "./useLongPress.js";
|
|
39
40
|
export { usePressFeedback } from "./usePressFeedback.js";
|
|
40
41
|
export { useDevWarning } from "./useDevWarning.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True inside a group whose tracker paints a pointer's press on its actions.
|
|
3
|
+
* Those actions take no `:active` paint, so one press never lights two.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PressGroupContext: import("react").Context<boolean>;
|
|
6
|
+
//# sourceMappingURL=pressGroupContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressGroupContext.d.ts","sourceRoot":"","sources":["../../src/hooks/pressGroupContext.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kCAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file pressGroupContext.ts
|
|
7
|
+
* @input Nothing
|
|
8
|
+
* @output PressGroupContext: true inside a group whose own tracker paints
|
|
9
|
+
* its actions' press
|
|
10
|
+
* @position Internal; not exported from the hooks entry. AlertDialog
|
|
11
|
+
* provides it around its tracked actions, and Button reads it.
|
|
12
|
+
*/
|
|
13
|
+
import { createContext } from 'react';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* True inside a group whose tracker paints a pointer's press on its actions.
|
|
17
|
+
* Those actions take no `:active` paint, so one press never lights two.
|
|
18
|
+
*/
|
|
19
|
+
export const PressGroupContext = /*#__PURE__*/createContext(false);
|
|
20
|
+
PressGroupContext.displayName = 'PressGroupContext';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useActionGroupTracking.ts
|
|
3
|
+
* @input A ref to a group of sibling actions, the actions' selector, and the
|
|
4
|
+
* component's tracking constants
|
|
5
|
+
* @output Exports useActionGroupTracking and ActionGroupTrackingOptions
|
|
6
|
+
* @position Internal hook, not exported from the hooks entry. A long press
|
|
7
|
+
* drives the shared action-group tracker (hooks/actionGroupTracker.ts) for
|
|
8
|
+
* a group that a held pointer slides across. AlertDialog consumes it.
|
|
9
|
+
*
|
|
10
|
+
* SYNC: When modified, update useActionGroupTracking.test.tsx
|
|
11
|
+
*/
|
|
12
|
+
import { type RefObject } from 'react';
|
|
13
|
+
import { LongPressGestureRecognizer } from '../gestures/LongPressGestureRecognizer.js';
|
|
14
|
+
import type { GestureTouch, PointerKind } from '../gestures/types.js';
|
|
15
|
+
export interface ActionGroupTrackingOptions {
|
|
16
|
+
/** Selects the actions inside the tracked element. */
|
|
17
|
+
itemSelector: string;
|
|
18
|
+
/** How long after touch-down the touched action highlights, ms. */
|
|
19
|
+
highlightOnsetMs: number;
|
|
20
|
+
/**
|
|
21
|
+
* How far outside an action a finger keeps it highlighted, px. A mouse or a
|
|
22
|
+
* pen hit-tests the actions' exact rects.
|
|
23
|
+
*/
|
|
24
|
+
highlightExpansion: number;
|
|
25
|
+
/** Pointers that are tracked; others keep the browser's click. @default every pointer */
|
|
26
|
+
pointerTypes?: ReadonlyArray<PointerKind>;
|
|
27
|
+
/** A press whose target this rejects is not tracked. */
|
|
28
|
+
shouldTrack?: (target: unknown) => boolean;
|
|
29
|
+
/** Off, nothing is attached and nothing is tracked. @default true */
|
|
30
|
+
isEnabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Let the gesture host write the group's `touch-action` and refuse a text
|
|
33
|
+
* selection while a finger or a pen holds it.
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
manageStyle?: boolean;
|
|
37
|
+
/** Runs the action under the finger at the lift. @default its own click */
|
|
38
|
+
onActivate?: (item: HTMLElement) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The group's press: a long press that a second finger on the group ends with
|
|
42
|
+
* nothing acting. A plain long press ignores a second finger.
|
|
43
|
+
*/
|
|
44
|
+
declare class ActionGroupPress extends LongPressGestureRecognizer {
|
|
45
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Track a held pointer on the group behind `ref` across the actions inside
|
|
49
|
+
* it, through the shared action-group tracker.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useActionGroupTracking(ref: RefObject<HTMLElement | null>, options: ActionGroupTrackingOptions): ActionGroupPress;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=useActionGroupTracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionGroupTracking.d.ts","sourceRoot":"","sources":["../../src/hooks/useActionGroupTracking.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAElE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;AAElF,OAAO,KAAK,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAOjE,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,YAAY,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,wDAAwD;IACxD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAC3C,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AASD;;;GAGG;AACH,cAAM,gBAAiB,SAAQ,0BAA0B;cACpC,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;CAO9D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CAoHlB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useActionGroupTracking.ts
|
|
7
|
+
* @input A ref to a group of sibling actions, the actions' selector, and the
|
|
8
|
+
* component's tracking constants
|
|
9
|
+
* @output Exports useActionGroupTracking and ActionGroupTrackingOptions
|
|
10
|
+
* @position Internal hook, not exported from the hooks entry. A long press
|
|
11
|
+
* drives the shared action-group tracker (hooks/actionGroupTracker.ts) for
|
|
12
|
+
* a group that a held pointer slides across. AlertDialog consumes it.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update useActionGroupTracking.test.tsx
|
|
15
|
+
*/
|
|
16
|
+
import { useEffect, useRef, useState } from 'react';
|
|
17
|
+
import { isActive } from "../gestures/GestureRecognizer.js";
|
|
18
|
+
import { LongPressGestureRecognizer } from "../gestures/LongPressGestureRecognizer.js";
|
|
19
|
+
import { lockSelection } from "../utils/selectionLock.js";
|
|
20
|
+
import { useGestureRecognizer } from "../gestures/useGestureRecognizer.js";
|
|
21
|
+
import { UIKIT_PRESS } from "../motion/uikit/gestures.js";
|
|
22
|
+
import { isIosWebKit } from "../utils/touchQueries.js";
|
|
23
|
+
import { createActionGroupTracker } from "./actionGroupTracker.js";
|
|
24
|
+
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
25
|
+
const PRESS = UIKIT_PRESS;
|
|
26
|
+
|
|
27
|
+
/** The ref handed to the recognizer while tracking is off: no element. */
|
|
28
|
+
const DETACHED = {
|
|
29
|
+
current: null
|
|
30
|
+
};
|
|
31
|
+
const EVERY_POINTER = ['touch', 'pen', 'mouse'];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The group's press: a long press that a second finger on the group ends with
|
|
35
|
+
* nothing acting. A plain long press ignores a second finger.
|
|
36
|
+
*/
|
|
37
|
+
class ActionGroupPress extends LongPressGestureRecognizer {
|
|
38
|
+
acceptsTouch(touch) {
|
|
39
|
+
if (isActive(this.state)) {
|
|
40
|
+
this.setState('cancelled');
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return super.acceptsTouch(touch);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Track a held pointer on the group behind `ref` across the actions inside
|
|
49
|
+
* it, through the shared action-group tracker.
|
|
50
|
+
*/
|
|
51
|
+
export function useActionGroupTracking(ref, options) {
|
|
52
|
+
const optionsRef = useRef(options);
|
|
53
|
+
// Keeps the recognizer's delegate and the tracker, which run outside
|
|
54
|
+
// render, reading the latest options.
|
|
55
|
+
useIsomorphicLayoutEffect(() => {
|
|
56
|
+
optionsRef.current = options;
|
|
57
|
+
});
|
|
58
|
+
// The pointer that started the current press. Only a finger gets the hit
|
|
59
|
+
// expansion; a mouse or a pen hit-tests the actions' exact rects.
|
|
60
|
+
const pointerRef = useRef('touch');
|
|
61
|
+
const landedRef = useRef(null);
|
|
62
|
+
const [tracker] = useState(() => createActionGroupTracker(() => ({
|
|
63
|
+
roots: () => [ref.current],
|
|
64
|
+
itemSelector: optionsRef.current.itemSelector,
|
|
65
|
+
highlightExpansion: pointerRef.current === 'touch' ? optionsRef.current.highlightExpansion : 0,
|
|
66
|
+
onActivate: optionsRef.current.onActivate,
|
|
67
|
+
// The browser's own click for a press the group ran is taken, so the
|
|
68
|
+
// action runs once. The gesture host swallows it for a press it claims.
|
|
69
|
+
// This covers one it does not claim, a mouse under a coarse pointer.
|
|
70
|
+
swallowsNativeClick: true
|
|
71
|
+
})));
|
|
72
|
+
const isEnabled = options.isEnabled ?? true;
|
|
73
|
+
// Synchronizes the tracker with tracking on and mounted. Turning tracking
|
|
74
|
+
// off, or unmounting, drops a tracked press and ends its release fades.
|
|
75
|
+
// The host reports no cancellation to a disabled recognizer, and the lift
|
|
76
|
+
// that runs an action often closes the owner before its fade ends.
|
|
77
|
+
useEffect(() => () => {
|
|
78
|
+
tracker.cancel();
|
|
79
|
+
tracker.dispose();
|
|
80
|
+
}, [tracker, isEnabled]);
|
|
81
|
+
return useGestureRecognizer(isEnabled ? ref : DETACHED, () => new ActionGroupPress({
|
|
82
|
+
name: 'ActionGroupTracking',
|
|
83
|
+
minimumPressDuration: options.highlightOnsetMs,
|
|
84
|
+
allowableMovement: Number.POSITIVE_INFINITY,
|
|
85
|
+
allowedPointerTypes: options.pointerTypes ?? EVERY_POINTER,
|
|
86
|
+
delaysTouchesBegan: true,
|
|
87
|
+
// The hold picks an action, so a held finger or pen starts no text
|
|
88
|
+
// selection and opens no callout while down. A long press brings this
|
|
89
|
+
// lock by default; this hold has no minimum duration, so it names it.
|
|
90
|
+
selectionLock: lockSelection,
|
|
91
|
+
shouldReceiveTouch: (recognizer, touch) => {
|
|
92
|
+
if (recognizer.numberOfTouches === 0) {
|
|
93
|
+
pointerRef.current = touch.pointerType;
|
|
94
|
+
const target = touch.target;
|
|
95
|
+
landedRef.current = typeof target?.nodeType === 'number' ? target : null;
|
|
96
|
+
}
|
|
97
|
+
return receiveTouch(recognizer, touch, optionsRef.current);
|
|
98
|
+
}
|
|
99
|
+
}), recognizer => {
|
|
100
|
+
switch (recognizer.state) {
|
|
101
|
+
case 'began':
|
|
102
|
+
{
|
|
103
|
+
const {
|
|
104
|
+
x,
|
|
105
|
+
y
|
|
106
|
+
} = recognizer.location();
|
|
107
|
+
tracker.begin(x, y, {
|
|
108
|
+
landed: landedRef.current
|
|
109
|
+
});
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 'changed':
|
|
113
|
+
{
|
|
114
|
+
const {
|
|
115
|
+
x,
|
|
116
|
+
y
|
|
117
|
+
} = recognizer.location();
|
|
118
|
+
tracker.move(x, y);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case 'ended':
|
|
122
|
+
{
|
|
123
|
+
const doc = ref.current?.ownerDocument;
|
|
124
|
+
const focusedBefore = doc?.activeElement ?? null;
|
|
125
|
+
const beganOn = tracker.beganOn;
|
|
126
|
+
// Whether a click on the lifted action would focus it. A mouse's or
|
|
127
|
+
// a pen's pointerdown already gave the engine's answer, on the action
|
|
128
|
+
// it began on. A tap focuses on a later mousedown, which the claimed
|
|
129
|
+
// touch cancels, so the platform answers for a finger.
|
|
130
|
+
// iOS WebKit focuses no tapped button; Chromium and Firefox do.
|
|
131
|
+
const clickFocuses = pointerRef.current === 'touch' ? !isIosWebKit(doc?.defaultView) : beganOn != null && focusedBefore === beganOn;
|
|
132
|
+
const lifted = tracker.end();
|
|
133
|
+
// The lift runs the action's own click(), which moves no focus. So
|
|
134
|
+
// focus moves to the lifted action, unless its click moved focus.
|
|
135
|
+
if (clickFocuses && lifted != null && lifted.isConnected && doc?.activeElement === focusedBefore && focusedBefore !== lifted) {
|
|
136
|
+
lifted.focus({
|
|
137
|
+
preventScroll: true,
|
|
138
|
+
focusVisible: false
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'cancelled':
|
|
144
|
+
tracker.cancel();
|
|
145
|
+
break;
|
|
146
|
+
case 'possible':
|
|
147
|
+
case 'failed':
|
|
148
|
+
// Listeners are not called for these.
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
isEnabled,
|
|
153
|
+
manageStyle: options.manageStyle ?? true,
|
|
154
|
+
actionGroup: true
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The recognizer's should-receive delegate. It also picks the press's clock.
|
|
160
|
+
* Inside a scroller the press waits the content-touch delay and fails past
|
|
161
|
+
* the slop, so the scroller takes a flick. Elsewhere it begins at once, with
|
|
162
|
+
* no movement limit.
|
|
163
|
+
*/
|
|
164
|
+
function receiveTouch(recognizer, touch, options) {
|
|
165
|
+
if (options.shouldTrack?.(touch.target) === false) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
if (recognizer.numberOfTouches === 0) {
|
|
169
|
+
const isInsideScroller = touch.scroll?.isInsideScroller === true;
|
|
170
|
+
recognizer.minimumPressDuration = isInsideScroller ? PRESS.contentTouchDelay.value : options.highlightOnsetMs;
|
|
171
|
+
recognizer.allowableMovement = isInsideScroller ? PRESS.slop.value : Number.POSITIVE_INFINITY;
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useAnimator.ts
|
|
3
|
+
* @input React (useState), the element ref the caller owns, the public
|
|
4
|
+
* animator factory (animator/createAnimator.ts) and useAttachment
|
|
5
|
+
* @output Exports `useAnimator(ref)`: the public animator for the element
|
|
6
|
+
* behind `ref`
|
|
7
|
+
* @position Public hook, exported from `@astryxdesign/core/hooks`. A thin
|
|
8
|
+
* wrapper over `createAnimator` with no behavior of its own.
|
|
9
|
+
*
|
|
10
|
+
* SYNC: When modified, update:
|
|
11
|
+
* - /packages/core/src/hooks/useAnimator.test.tsx
|
|
12
|
+
* - /packages/core/src/hooks/useAnimator.doc.mjs
|
|
13
|
+
*/
|
|
14
|
+
import { type RefObject } from 'react';
|
|
15
|
+
import { type AnimatorHandle } from '../animator/createAnimator.js';
|
|
16
|
+
/**
|
|
17
|
+
* Animates the element behind `ref` with the motion Core uses. Call
|
|
18
|
+
* `animate`, `decay`, `set`, `get`, `getVelocity` or `stop` on the returned
|
|
19
|
+
* animator from event handlers and effects. Pass the same `ref` to a gesture
|
|
20
|
+
* hook to drag and animate one element.
|
|
21
|
+
*
|
|
22
|
+
* The hook makes the animator once, and animating never re-renders the
|
|
23
|
+
* component. After each commit, the animator follows the element behind
|
|
24
|
+
* `ref`, also a node that replaces it. An unmount stops running motion and
|
|
25
|
+
* drops the values. A remount, or a node that replaces the element, starts
|
|
26
|
+
* at rest. While no element is attached, every call does nothing, and
|
|
27
|
+
* `animate` and `decay` resolve at once.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```
|
|
31
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
32
|
+
* const animator = useAnimator(ref);
|
|
33
|
+
* return (
|
|
34
|
+
* <div ref={ref} onClick={() => animator.animate({scale: 1.2})}>
|
|
35
|
+
* Card
|
|
36
|
+
* </div>
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useAnimator(ref: RefObject<HTMLElement | null>): AnimatorHandle;
|
|
41
|
+
//# sourceMappingURL=useAnimator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimator.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAW,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAGpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACjC,cAAc,CAehB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useAnimator.ts
|
|
7
|
+
* @input React (useState), the element ref the caller owns, the public
|
|
8
|
+
* animator factory (animator/createAnimator.ts) and useAttachment
|
|
9
|
+
* @output Exports `useAnimator(ref)`: the public animator for the element
|
|
10
|
+
* behind `ref`
|
|
11
|
+
* @position Public hook, exported from `@astryxdesign/core/hooks`. A thin
|
|
12
|
+
* wrapper over `createAnimator` with no behavior of its own.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update:
|
|
15
|
+
* - /packages/core/src/hooks/useAnimator.test.tsx
|
|
16
|
+
* - /packages/core/src/hooks/useAnimator.doc.mjs
|
|
17
|
+
*/
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import { createAttachableAnimator } from "../animator/createAnimator.js";
|
|
20
|
+
import { useAttachment } from "./useAttachment.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Animates the element behind `ref` with the motion Core uses. Call
|
|
24
|
+
* `animate`, `decay`, `set`, `get`, `getVelocity` or `stop` on the returned
|
|
25
|
+
* animator from event handlers and effects. Pass the same `ref` to a gesture
|
|
26
|
+
* hook to drag and animate one element.
|
|
27
|
+
*
|
|
28
|
+
* The hook makes the animator once, and animating never re-renders the
|
|
29
|
+
* component. After each commit, the animator follows the element behind
|
|
30
|
+
* `ref`, also a node that replaces it. An unmount stops running motion and
|
|
31
|
+
* drops the values. A remount, or a node that replaces the element, starts
|
|
32
|
+
* at rest. While no element is attached, every call does nothing, and
|
|
33
|
+
* `animate` and `decay` resolve at once.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
38
|
+
* const animator = useAnimator(ref);
|
|
39
|
+
* return (
|
|
40
|
+
* <div ref={ref} onClick={() => animator.animate({scale: 1.2})}>
|
|
41
|
+
* Card
|
|
42
|
+
* </div>
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function useAnimator(ref) {
|
|
47
|
+
const [{
|
|
48
|
+
handle,
|
|
49
|
+
attach
|
|
50
|
+
}] = useState(() => {
|
|
51
|
+
const {
|
|
52
|
+
animator,
|
|
53
|
+
attach: attachElement
|
|
54
|
+
} = createAttachableAnimator();
|
|
55
|
+
// The handle without `destroy`: the hook owns the element's lifetime.
|
|
56
|
+
const {
|
|
57
|
+
destroy: _destroy,
|
|
58
|
+
...handle
|
|
59
|
+
} = animator;
|
|
60
|
+
return {
|
|
61
|
+
handle,
|
|
62
|
+
attach: element => {
|
|
63
|
+
attachElement(element);
|
|
64
|
+
return () => attachElement(null);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
useAttachment(ref, attach, null);
|
|
69
|
+
return handle;
|
|
70
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @output Exports useAttachment and useAttachmentPair (two elements): they keep
|
|
6
6
|
* the attach function bound to the nodes the refs hold across commits
|
|
7
7
|
* @position Internal React helper, not in hooks/index.ts: the one attach and
|
|
8
|
-
* release lifecycle of the gesture hooks
|
|
8
|
+
* release lifecycle of the gesture hooks, the pager and useAnimator
|
|
9
9
|
*
|
|
10
10
|
* SYNC: When modified, update gestures/__tests__/useGestureRecognizer.test.tsx,
|
|
11
11
|
* gestures/__tests__/useFingerScroll.test.tsx and
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @output Exports useAttachment and useAttachmentPair (two elements): they keep
|
|
10
10
|
* the attach function bound to the nodes the refs hold across commits
|
|
11
11
|
* @position Internal React helper, not in hooks/index.ts: the one attach and
|
|
12
|
-
* release lifecycle of the gesture hooks
|
|
12
|
+
* release lifecycle of the gesture hooks, the pager and useAnimator
|
|
13
13
|
*
|
|
14
14
|
* SYNC: When modified, update gestures/__tests__/useGestureRecognizer.test.tsx,
|
|
15
15
|
* gestures/__tests__/useFingerScroll.test.tsx and
|
|
@@ -9,6 +9,12 @@ interface UseHighlightedOptionScrollOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
itemCount?: number;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Highlights the hovered option at `index`. `onHighlight` runs when the hover
|
|
14
|
+
* takes effect: at once, or after the pointer moves or presses when a
|
|
15
|
+
* keyboard move holds the highlight.
|
|
16
|
+
*/
|
|
17
|
+
export type HighlightFromHover = (index: number, onHighlight?: () => void) => void;
|
|
12
18
|
/**
|
|
13
19
|
* Keep the highlighted option visible during keyboard navigation — but not for
|
|
14
20
|
* hover highlights. Hover must highlight only: scrollIntoView moves the next
|
|
@@ -16,7 +22,11 @@ interface UseHighlightedOptionScrollOptions {
|
|
|
16
22
|
* scrolls again — a runaway auto-scroll loop with no user input.
|
|
17
23
|
* Keyboard paths call the raw setter directly and keep their scrolling; hover
|
|
18
24
|
* paths call the returned callback.
|
|
25
|
+
*
|
|
26
|
+
* A keyboard move holds the highlight. A key that scrolls the list moves rows
|
|
27
|
+
* under a still mouse, and the browser reports the row under it as entered;
|
|
28
|
+
* that row takes the highlight only once the pointer moves or presses.
|
|
19
29
|
*/
|
|
20
|
-
export declare function useHighlightedOptionScroll({ isOpen, highlightedIndex, setHighlightedIndex, getOptionId, itemCount, }: UseHighlightedOptionScrollOptions):
|
|
30
|
+
export declare function useHighlightedOptionScroll({ isOpen, highlightedIndex, setHighlightedIndex, getOptionId, itemCount, }: UseHighlightedOptionScrollOptions): HighlightFromHover;
|
|
21
31
|
export {};
|
|
22
32
|
//# sourceMappingURL=useHighlightedOptionScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHighlightedOptionScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useHighlightedOptionScroll.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHighlightedOptionScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useHighlightedOptionScroll.ts"],"names":[],"mappings":"AAkBA,UAAU,iCAAiC;IACzC,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,IAAI,KACrB,IAAI,CAAC;AAOV;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,SAAS,GACV,EAAE,iCAAiC,GAAG,kBAAkB,CAmHxD"}
|
|
@@ -8,11 +8,19 @@
|
|
|
8
8
|
* option-id resolver for the owning listbox
|
|
9
9
|
* @output Exports useHighlightedOptionScroll: keeps the highlighted option
|
|
10
10
|
* scrolled into view for keyboard navigation while hover-driven highlights
|
|
11
|
-
* never scroll
|
|
11
|
+
* never scroll, and a hover after a keyboard move waits for the pointer to
|
|
12
|
+
* move or press; the hover callback is stable while `setHighlightedIndex` is
|
|
12
13
|
* @position Internal hook; used by useCombobox, useMultiCombobox,
|
|
13
14
|
* BaseTypeahead, and DateTimeInput — the owners of combobox highlight state
|
|
14
15
|
*/
|
|
15
16
|
import { useCallback, useEffect, useRef } from 'react';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Highlights the hovered option at `index`. `onHighlight` runs when the hover
|
|
20
|
+
* takes effect: at once, or after the pointer moves or presses when a
|
|
21
|
+
* keyboard move holds the highlight.
|
|
22
|
+
*/
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* Keep the highlighted option visible during keyboard navigation — but not for
|
|
18
26
|
* hover highlights. Hover must highlight only: scrollIntoView moves the next
|
|
@@ -20,6 +28,10 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
|
20
28
|
* scrolls again — a runaway auto-scroll loop with no user input.
|
|
21
29
|
* Keyboard paths call the raw setter directly and keep their scrolling; hover
|
|
22
30
|
* paths call the returned callback.
|
|
31
|
+
*
|
|
32
|
+
* A keyboard move holds the highlight. A key that scrolls the list moves rows
|
|
33
|
+
* under a still mouse, and the browser reports the row under it as entered;
|
|
34
|
+
* that row takes the highlight only once the pointer moves or presses.
|
|
23
35
|
*/
|
|
24
36
|
export function useHighlightedOptionScroll({
|
|
25
37
|
isOpen,
|
|
@@ -28,24 +40,113 @@ export function useHighlightedOptionScroll({
|
|
|
28
40
|
getOptionId,
|
|
29
41
|
itemCount
|
|
30
42
|
}) {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
// The callback reads no render state, so memoized rows keep one function.
|
|
44
|
+
const hoveredIndexRef = useRef(null);
|
|
45
|
+
const shownIndexRef = useRef(highlightedIndex);
|
|
46
|
+
// The hover that came while a keyboard move held the highlight.
|
|
47
|
+
const waitingHoverRef = useRef(null);
|
|
48
|
+
// Set only while a keyboard move holds the highlight.
|
|
49
|
+
const removeHoldListenersRef = useRef(null);
|
|
50
|
+
const setHighlightedIndexRef = useRef(setHighlightedIndex);
|
|
51
|
+
// The pointer's last screen position a hold saw, kept across holds.
|
|
52
|
+
const lastPointerRef = useRef(null);
|
|
53
|
+
const applyHover = useCallback(hover => {
|
|
54
|
+
hoveredIndexRef.current = hover.index;
|
|
55
|
+
setHighlightedIndexRef.current(hover.index);
|
|
56
|
+
hover.onHighlight?.();
|
|
57
|
+
}, []);
|
|
58
|
+
const endHold = useCallback(() => {
|
|
59
|
+
removeHoldListenersRef.current?.();
|
|
60
|
+
removeHoldListenersRef.current = null;
|
|
61
|
+
}, []);
|
|
62
|
+
const releaseHold = useCallback(() => {
|
|
63
|
+
endHold();
|
|
64
|
+
const waiting = waitingHoverRef.current;
|
|
65
|
+
waitingHoverRef.current = null;
|
|
66
|
+
if (waiting != null) {
|
|
67
|
+
applyHover(waiting);
|
|
68
|
+
}
|
|
69
|
+
}, [applyHover, endHold]);
|
|
70
|
+
|
|
71
|
+
// Holds the highlight until the pointer moves or presses. The listeners
|
|
72
|
+
// live only while the hold does. Movement is read by screen coordinates: a
|
|
73
|
+
// scroll moves the rows, not the pointer. The browser reports a row as
|
|
74
|
+
// entered before the move that reaches it, so the first real move gives
|
|
75
|
+
// that row the highlight. A press releases at once, so a held press lights
|
|
76
|
+
// the pressed row.
|
|
77
|
+
const startHold = useCallback(() => {
|
|
78
|
+
waitingHoverRef.current = null;
|
|
79
|
+
if (removeHoldListenersRef.current != null) {
|
|
80
|
+
return;
|
|
35
81
|
}
|
|
82
|
+
const onPointerMove = event => {
|
|
83
|
+
const last = lastPointerRef.current;
|
|
84
|
+
lastPointerRef.current = {
|
|
85
|
+
x: event.screenX,
|
|
86
|
+
y: event.screenY
|
|
87
|
+
};
|
|
88
|
+
if (last != null && last.x === event.screenX && last.y === event.screenY) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
releaseHold();
|
|
92
|
+
};
|
|
93
|
+
const options = {
|
|
94
|
+
capture: true,
|
|
95
|
+
passive: true
|
|
96
|
+
};
|
|
97
|
+
document.addEventListener('pointermove', onPointerMove, options);
|
|
98
|
+
document.addEventListener('pointerdown', releaseHold, options);
|
|
99
|
+
removeHoldListenersRef.current = () => {
|
|
100
|
+
document.removeEventListener('pointermove', onPointerMove, options);
|
|
101
|
+
document.removeEventListener('pointerdown', releaseHold, options);
|
|
102
|
+
};
|
|
103
|
+
}, [releaseHold]);
|
|
104
|
+
const highlightFromHover = useCallback((index, onHighlight) => {
|
|
105
|
+
if (removeHoldListenersRef.current != null) {
|
|
106
|
+
waitingHoverRef.current = {
|
|
107
|
+
index,
|
|
108
|
+
onHighlight
|
|
109
|
+
};
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
hoveredIndexRef.current = index;
|
|
36
113
|
setHighlightedIndex(index);
|
|
37
|
-
|
|
114
|
+
onHighlight?.();
|
|
115
|
+
}, [setHighlightedIndex]);
|
|
116
|
+
|
|
117
|
+
// Effect: keeps the hold's document listeners calling the current setter.
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
setHighlightedIndexRef.current = setHighlightedIndex;
|
|
120
|
+
}, [setHighlightedIndex]);
|
|
121
|
+
|
|
122
|
+
// Effect: removes the hold's document listeners on unmount.
|
|
123
|
+
useEffect(() => endHold, [endHold]);
|
|
124
|
+
|
|
125
|
+
// Effect: scrolls the highlighted option into view in the document, and
|
|
126
|
+
// starts or ends the hold on its document listeners.
|
|
38
127
|
useEffect(() => {
|
|
39
|
-
|
|
40
|
-
|
|
128
|
+
// Only a move to the hovered row came from the hover. A hover on the row
|
|
129
|
+
// already highlighted changes nothing, so a later run for the same row
|
|
130
|
+
// (a new list) still scrolls it into view.
|
|
131
|
+
const hasMoved = shownIndexRef.current !== highlightedIndex;
|
|
132
|
+
shownIndexRef.current = highlightedIndex;
|
|
133
|
+
const isFromHover = hasMoved && hoveredIndexRef.current === highlightedIndex;
|
|
134
|
+
hoveredIndexRef.current = null;
|
|
135
|
+
if (isFromHover) {
|
|
41
136
|
return;
|
|
42
137
|
}
|
|
43
|
-
|
|
138
|
+
// A cleared highlight, a closed list, or a list that is not shown (a
|
|
139
|
+
// closed CommandPalette reports itself as open) has nothing to hold.
|
|
140
|
+
const option = isOpen && highlightedIndex >= 0 ? document.getElementById(getOptionId(highlightedIndex)) : null;
|
|
141
|
+
if (option == null) {
|
|
142
|
+
waitingHoverRef.current = null;
|
|
143
|
+
endHold();
|
|
44
144
|
return;
|
|
45
145
|
}
|
|
46
|
-
|
|
146
|
+
startHold();
|
|
147
|
+
option.scrollIntoView?.({
|
|
47
148
|
block: 'nearest'
|
|
48
149
|
});
|
|
49
|
-
}, [isOpen, highlightedIndex, getOptionId, itemCount]);
|
|
150
|
+
}, [isOpen, highlightedIndex, getOptionId, itemCount, endHold, startHold]);
|
|
50
151
|
return highlightFromHover;
|
|
51
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type IconSize } from '../Icon/
|
|
2
|
+
import { type IconSize } from '../Icon/Icon.js';
|
|
3
3
|
import type { InputStatus } from '../Field/types.js';
|
|
4
4
|
import type { FieldStatusPlacement } from '../Field/fieldStatusPlacement.js';
|
|
5
5
|
export interface UseInputStatusIconOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputStatusIcon.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputStatusIcon.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,
|
|
1
|
+
{"version":3,"file":"useInputStatusIcon.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputStatusIcon.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAC,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAKjE,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AA8DxE,MAAM,WAAW,yBAAyB;IACxC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yDAAyD;IACzD,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;OAOG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,aAA0B,EAC1B,SAAiB,EACjB,IAAW,GACZ,EAAE,yBAAyB,GAAG,wBAAwB,CAoGtD"}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { useCallback, useEffect, useState } from 'react';
|
|
15
15
|
import * as stylex from '@stylexjs/stylex';
|
|
16
|
-
import { Icon } from "../Icon/
|
|
17
|
-
import { useTooltip } from "../Tooltip/
|
|
16
|
+
import { Icon } from "../Icon/Icon.js";
|
|
17
|
+
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
18
18
|
import "../theme/tokens.stylex.js";
|
|
19
19
|
import { radiusVars } from "../theme/tokens.stylex.js";
|
|
20
20
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -21,8 +21,12 @@ export interface LongPressTolerance {
|
|
|
21
21
|
export interface UseLongPressHandlers {
|
|
22
22
|
onTouchStart: (e: React.TouchEvent) => void;
|
|
23
23
|
onTouchMove: (e: React.TouchEvent) => void;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The lift. Pass the event, so a press it is stamped past (its timer held
|
|
26
|
+
* back by a busy page) still reports first. Spreading the handlers does.
|
|
27
|
+
*/
|
|
28
|
+
onTouchEnd: (e?: React.TouchEvent) => void;
|
|
29
|
+
onTouchCancel: (e?: React.TouchEvent) => void;
|
|
26
30
|
/**
|
|
27
31
|
* Begin detection at a point, for a caller driving this from its own
|
|
28
32
|
* pointer events rather than the touch handlers above.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLongPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLongPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"AA+EA,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,WAAW,EAAE,CAAC,KAAK,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IACrD,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC;IACnD,2EAA2E;IAC3E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CACrD,oBAAoB,EACpB,OAAO,CACR;IACC,KAAK,EAAE,CACL,KAAK,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,EAC7B,SAAS,CAAC,EAAE,kBAAkB,KAC3B,IAAI,CAAC;CACX;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,mBAAmB,GAC3B,oBAAoB,CAStB;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,GAC3B,yBAAyB,CAuL3B"}
|