@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
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
} from 'react';
|
|
38
38
|
import {flushSync} from 'react-dom';
|
|
39
39
|
import * as stylex from '@stylexjs/stylex';
|
|
40
|
-
import {AlertDialog} from '../AlertDialog/AlertDialog';
|
|
41
40
|
import {BottomSheet} from '../BottomSheet/BottomSheet';
|
|
42
41
|
import {Button} from '../Button/Button';
|
|
43
42
|
import {EmptyState} from '../EmptyState/EmptyState';
|
|
@@ -50,9 +49,21 @@ import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
|
50
49
|
import {useAnnounce} from '../hooks/useAnnounce';
|
|
51
50
|
import {useAnnounceRenderedText} from '../hooks/useAnnounceRenderedText';
|
|
52
51
|
import {Text} from '../Text/Text';
|
|
52
|
+
import {SheetConfirmation} from '../internal/SheetConfirmation';
|
|
53
|
+
import {
|
|
54
|
+
hasSameSelection,
|
|
55
|
+
nameSheetDraftChange,
|
|
56
|
+
type SheetDraftChange,
|
|
57
|
+
} from '../internal/sheetDraft';
|
|
58
|
+
import {useDismissSearchOnTouchDrag} from '../internal/useDismissSearchOnTouchDrag';
|
|
53
59
|
import {warnOnce} from '../utils/devWarning';
|
|
54
60
|
import type {SearchableItem, SearchSource} from '../Typeahead/types';
|
|
55
|
-
import {
|
|
61
|
+
import {
|
|
62
|
+
colorVars,
|
|
63
|
+
radiusVars,
|
|
64
|
+
sizeVars,
|
|
65
|
+
spacingVars,
|
|
66
|
+
} from '../theme/tokens.stylex';
|
|
56
67
|
import {
|
|
57
68
|
registerEnglishFallback,
|
|
58
69
|
useComponentTranslator,
|
|
@@ -88,12 +99,12 @@ const styles = stylex.create({
|
|
|
88
99
|
searchRow: {
|
|
89
100
|
paddingBlockEnd: spacingVars['--spacing-2'],
|
|
90
101
|
},
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
102
|
+
// A dropdown panel is already a bordered box, so its search field has no
|
|
103
|
+
// border. The sheet is not, so its field takes the shared input box at the
|
|
104
|
+
// `lg` height.
|
|
94
105
|
searchField: {
|
|
95
|
-
minHeight:
|
|
96
|
-
paddingBlock: spacingVars['--spacing-
|
|
106
|
+
minHeight: sizeVars['--size-element-lg'],
|
|
107
|
+
paddingBlock: spacingVars['--spacing-1'],
|
|
97
108
|
},
|
|
98
109
|
list: {
|
|
99
110
|
display: 'flex',
|
|
@@ -192,7 +203,10 @@ const styles = stylex.create({
|
|
|
192
203
|
export interface TokenizerBottomSheetProps<T extends SearchableItem> {
|
|
193
204
|
/** Whether the sheet is open. */
|
|
194
205
|
isOpen: boolean;
|
|
195
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Called with `false` when the sheet closes: Save, a clean dismissal, or a
|
|
208
|
+
* confirmed discard.
|
|
209
|
+
*/
|
|
196
210
|
onOpenChange: (isOpen: boolean) => void;
|
|
197
211
|
/** The trigger, which takes focus back after the sheet closes. */
|
|
198
212
|
finalFocusRef: RefObject<HTMLElement | null>;
|
|
@@ -208,10 +222,10 @@ export interface TokenizerBottomSheetProps<T extends SearchableItem> {
|
|
|
208
222
|
/** The field label; names the sheet, the search field, and the list. */
|
|
209
223
|
label: string;
|
|
210
224
|
searchSource: SearchSource<T>;
|
|
211
|
-
/** The committed selection. */
|
|
225
|
+
/** The committed selection; the draft the sheet edits starts from it. */
|
|
212
226
|
value: T[];
|
|
213
|
-
/**
|
|
214
|
-
|
|
227
|
+
/** The selection limit, enforced on the draft. */
|
|
228
|
+
maxEntries: number | undefined;
|
|
215
229
|
hasCreate: boolean;
|
|
216
230
|
maxMenuItems: number;
|
|
217
231
|
minQueryLength: number;
|
|
@@ -219,38 +233,35 @@ export interface TokenizerBottomSheetProps<T extends SearchableItem> {
|
|
|
219
233
|
/** The no-results message; a string becomes the empty state's title. */
|
|
220
234
|
emptySearchText: ReactNode;
|
|
221
235
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* dialog, where `useAnnounce` routes it
|
|
225
|
-
* whether the item was added.
|
|
236
|
+
* Save's one report: the whole draft and the last edit that still holds.
|
|
237
|
+
* The sheet announces each edit itself when it happens, from inside its
|
|
238
|
+
* dialog, where `useAnnounce` routes it; nothing is announced on Save.
|
|
226
239
|
*/
|
|
227
|
-
|
|
228
|
-
/** Tokenizer's remove path, silent for the same reason. */
|
|
229
|
-
onRemove: (item: T, options: {silent: true}) => boolean;
|
|
230
|
-
/** Tokenizer's clear-all path. */
|
|
231
|
-
onClearAll: () => void;
|
|
240
|
+
onCommit: (items: T[], change: SheetDraftChange<T>) => void;
|
|
232
241
|
onChangeQuery?: (query: string) => void;
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
/**
|
|
236
245
|
* The touch surface of Tokenizer's `bottom-sheet` presentation.
|
|
237
246
|
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
*
|
|
247
|
+
* One open sheet edits one draft that starts as `value`; rows, the create row
|
|
248
|
+
* and Clear all change the draft, and Save reports it once. Rows keep their
|
|
249
|
+
* position while the sheet is open: the items selected when it opened lead,
|
|
250
|
+
* in `value` order, then draft-selected items the results do not carry, then
|
|
251
|
+
* the results; the next open takes a fresh snapshot and regroups
|
|
252
|
+
* selected-first.
|
|
253
|
+
*
|
|
254
|
+
* The sheet is BottomSheet around the content, split in two so the content —
|
|
245
255
|
* search, rows, footer, and every announcement about them — is rendered
|
|
246
256
|
* inside the sheet's dialog, where `useAnnounce` routes into it while it is
|
|
247
|
-
* open
|
|
248
|
-
*
|
|
257
|
+
* open: a component that renders a modal and announces about its content is
|
|
258
|
+
* inside that modal only when the announcing code is.
|
|
249
259
|
*
|
|
250
260
|
* The outer part also tells the content how a close came about: a close the
|
|
251
|
-
* person made (
|
|
261
|
+
* person made (Save, swipe, scrim, Escape) clears the query so the next open
|
|
252
262
|
* lists the bootstrap set, while a close the field forced (becoming disabled
|
|
253
|
-
* while open) keeps it
|
|
263
|
+
* while open) keeps it. A swipe, scrim or Escape close of a changed draft is
|
|
264
|
+
* routed to the content first, which asks before discarding.
|
|
254
265
|
*/
|
|
255
266
|
export function TokenizerBottomSheet<T extends SearchableItem>({
|
|
256
267
|
isOpen,
|
|
@@ -263,7 +274,9 @@ export function TokenizerBottomSheet<T extends SearchableItem>({
|
|
|
263
274
|
// this handle, from the closing event, so a close the field forces by
|
|
264
275
|
// becoming disabled (which never comes through here) keeps it.
|
|
265
276
|
const clearQueryRef = useRef<(() => void) | null>(null);
|
|
266
|
-
|
|
277
|
+
// Set by the content: a dismissal asks first while the draft is changed.
|
|
278
|
+
const requestDismissRef = useRef<(() => void) | null>(null);
|
|
279
|
+
const closeSheet = () => {
|
|
267
280
|
clearQueryRef.current?.();
|
|
268
281
|
onOpenChange(false);
|
|
269
282
|
};
|
|
@@ -273,8 +286,10 @@ export function TokenizerBottomSheet<T extends SearchableItem>({
|
|
|
273
286
|
onOpenChange={next => {
|
|
274
287
|
if (next) {
|
|
275
288
|
onOpenChange(true);
|
|
289
|
+
} else if (requestDismissRef.current != null) {
|
|
290
|
+
requestDismissRef.current();
|
|
276
291
|
} else {
|
|
277
|
-
|
|
292
|
+
closeSheet();
|
|
278
293
|
}
|
|
279
294
|
}}
|
|
280
295
|
finalFocusRef={finalFocusRef}
|
|
@@ -286,7 +301,8 @@ export function TokenizerBottomSheet<T extends SearchableItem>({
|
|
|
286
301
|
isOpen={isOpen}
|
|
287
302
|
label={label}
|
|
288
303
|
clearQueryRef={clearQueryRef}
|
|
289
|
-
|
|
304
|
+
requestDismissRef={requestDismissRef}
|
|
305
|
+
onCloseSheet={closeSheet}
|
|
290
306
|
/>
|
|
291
307
|
</BottomSheet>
|
|
292
308
|
);
|
|
@@ -300,27 +316,28 @@ type TokenizerSheetContentProps<T extends SearchableItem> = Omit<
|
|
|
300
316
|
> & {
|
|
301
317
|
/** Set by the content: clears and reports its query; called on a user close. */
|
|
302
318
|
clearQueryRef: RefObject<(() => void) | null>;
|
|
303
|
-
/**
|
|
304
|
-
|
|
319
|
+
/** Set by the content: a swipe, scrim or Escape close, which asks first while the draft is changed. */
|
|
320
|
+
requestDismissRef: RefObject<(() => void) | null>;
|
|
321
|
+
/** Close the sheet as the person's own act. */
|
|
322
|
+
onCloseSheet: () => void;
|
|
305
323
|
};
|
|
306
324
|
|
|
307
325
|
function TokenizerSheetContent<T extends SearchableItem>({
|
|
308
326
|
isOpen,
|
|
309
327
|
initialQuery,
|
|
310
328
|
clearQueryRef,
|
|
311
|
-
|
|
329
|
+
requestDismissRef,
|
|
330
|
+
onCloseSheet,
|
|
312
331
|
label,
|
|
313
332
|
searchSource,
|
|
314
333
|
value,
|
|
315
|
-
|
|
334
|
+
maxEntries,
|
|
316
335
|
hasCreate,
|
|
317
336
|
maxMenuItems,
|
|
318
337
|
minQueryLength,
|
|
319
338
|
debounceMs,
|
|
320
339
|
emptySearchText,
|
|
321
|
-
|
|
322
|
-
onRemove,
|
|
323
|
-
onClearAll,
|
|
340
|
+
onCommit,
|
|
324
341
|
onChangeQuery,
|
|
325
342
|
}: TokenizerSheetContentProps<T>) {
|
|
326
343
|
const t = useComponentTranslator();
|
|
@@ -348,6 +365,8 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
348
365
|
// sheet makes goes through `useAnnounce`, called inside the sheet's
|
|
349
366
|
// dialog, so FR14 routes the words into it while the sheet is open.
|
|
350
367
|
const [isClearConfirmationOpen, setIsClearConfirmationOpen] = useState(false);
|
|
368
|
+
const [isDiscardConfirmationOpen, setIsDiscardConfirmationOpen] =
|
|
369
|
+
useState(false);
|
|
351
370
|
const clearAllRef = useRef<HTMLButtonElement>(null);
|
|
352
371
|
const announce = useAnnounce();
|
|
353
372
|
const closeClearConfirmation = (confirmed: boolean) => {
|
|
@@ -360,7 +379,28 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
360
379
|
clearAllRef.current?.focus();
|
|
361
380
|
}
|
|
362
381
|
};
|
|
363
|
-
|
|
382
|
+
// Keep editing: the confirmation is gone, and focus returns to the search
|
|
383
|
+
// field, where the sheet's own reading order starts.
|
|
384
|
+
const closeDiscardConfirmation = () => {
|
|
385
|
+
// eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the confirmation must be gone before focus moves back into the sheet
|
|
386
|
+
flushSync(() => setIsDiscardConfirmationOpen(false));
|
|
387
|
+
searchRef.current?.focus({preventScroll: true});
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// ---- draft ----
|
|
391
|
+
// One open sheet edits one draft. The caller's `value` is unchanged until
|
|
392
|
+
// Save, so a dismissal can discard cleanly; `lastDraftChangeRef` is the
|
|
393
|
+
// edit Save names when it still holds.
|
|
394
|
+
const [valueAtOpen, setValueAtOpen] = useState<T[]>(() => [...value]);
|
|
395
|
+
const [draftValue, setDraftValue] = useState<T[]>(() => [...value]);
|
|
396
|
+
const lastDraftChangeRef = useRef<SheetDraftChange<T> | null>(null);
|
|
397
|
+
const isDraftDirty = !hasSameSelection(valueAtOpen, draftValue);
|
|
398
|
+
const selectedIds = useMemo(
|
|
399
|
+
() => new Set(draftValue.map(v => v.id)),
|
|
400
|
+
[draftValue],
|
|
401
|
+
);
|
|
402
|
+
const isAtMax = maxEntries != null && draftValue.length >= maxEntries;
|
|
403
|
+
const isDraftOverMax = maxEntries != null && draftValue.length > maxEntries;
|
|
364
404
|
|
|
365
405
|
// ---- sheet session ----
|
|
366
406
|
// Starts from the field's copy, which `onChangeQuery` keeps current, so the
|
|
@@ -421,7 +461,12 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
421
461
|
setWasOpen(isOpen);
|
|
422
462
|
if (isOpen) {
|
|
423
463
|
setSelectedItemsAtOpen(value);
|
|
464
|
+
setValueAtOpen([...value]);
|
|
465
|
+
setDraftValue([...value]);
|
|
466
|
+
lastDraftChangeRef.current = null;
|
|
424
467
|
setRenderedItemCount(LIST_RENDER_BATCH_SIZE);
|
|
468
|
+
setIsClearConfirmationOpen(false);
|
|
469
|
+
setIsDiscardConfirmationOpen(false);
|
|
425
470
|
// An open lists the bootstrap set, or searches a query kept across a
|
|
426
471
|
// close the field forced (FR18), and that load is pending; a kept
|
|
427
472
|
// query below the threshold leaves nothing pending, since no search
|
|
@@ -533,7 +578,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
533
578
|
selectedAtOpenMatches.map(item => item.id),
|
|
534
579
|
);
|
|
535
580
|
const resultIds = new Set(results.map(item => item.id));
|
|
536
|
-
const selectedItemsMissingFromResults =
|
|
581
|
+
const selectedItemsMissingFromResults = draftValue.filter(
|
|
537
582
|
item =>
|
|
538
583
|
!selectedAtOpenIds.has(item.id) &&
|
|
539
584
|
!resultIds.has(item.id) &&
|
|
@@ -547,7 +592,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
547
592
|
...selectedItemsMissingFromResults,
|
|
548
593
|
...results.filter(item => !selectedAtOpenIds.has(item.id)),
|
|
549
594
|
];
|
|
550
|
-
}, [query, results, selectedItemsAtOpen,
|
|
595
|
+
}, [query, results, selectedItemsAtOpen, draftValue]);
|
|
551
596
|
|
|
552
597
|
const renderedItems = visibleItems.slice(0, renderedItemCount);
|
|
553
598
|
|
|
@@ -601,7 +646,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
601
646
|
const lowered = trimmedQuery.toLowerCase();
|
|
602
647
|
if (
|
|
603
648
|
selectedIds.has(trimmedQuery) ||
|
|
604
|
-
|
|
649
|
+
draftValue.some(item => item.label.toLowerCase() === lowered) ||
|
|
605
650
|
results.some(item => item.label.toLowerCase() === lowered)
|
|
606
651
|
) {
|
|
607
652
|
return null;
|
|
@@ -616,7 +661,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
616
661
|
isAtMax,
|
|
617
662
|
isPending,
|
|
618
663
|
selectedIds,
|
|
619
|
-
|
|
664
|
+
draftValue,
|
|
620
665
|
results,
|
|
621
666
|
t,
|
|
622
667
|
]);
|
|
@@ -642,6 +687,43 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
642
687
|
onChangeQuery?.(next);
|
|
643
688
|
};
|
|
644
689
|
|
|
690
|
+
// A swipe, scrim or Escape close: asks first while the draft is changed.
|
|
691
|
+
useImperativeHandle(
|
|
692
|
+
requestDismissRef,
|
|
693
|
+
() => () => {
|
|
694
|
+
if (isDraftDirty) {
|
|
695
|
+
setIsDiscardConfirmationOpen(true);
|
|
696
|
+
} else {
|
|
697
|
+
onCloseSheet();
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
[isDraftDirty, onCloseSheet],
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
const handleSave = () => {
|
|
704
|
+
if (isDraftOverMax) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
const change = isDraftDirty
|
|
708
|
+
? nameSheetDraftChange(
|
|
709
|
+
valueAtOpen,
|
|
710
|
+
draftValue,
|
|
711
|
+
lastDraftChangeRef.current,
|
|
712
|
+
)
|
|
713
|
+
: null;
|
|
714
|
+
if (change != null) {
|
|
715
|
+
onCommit([...draftValue], change);
|
|
716
|
+
}
|
|
717
|
+
onCloseSheet();
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// Focus moves to the sheet's panel, not the page body behind the modal.
|
|
721
|
+
// The keyboard then leaves and the query stays.
|
|
722
|
+
const listDragProps = useDismissSearchOnTouchDrag(
|
|
723
|
+
() => [searchRef.current],
|
|
724
|
+
() => listRef.current?.closest<HTMLElement>('[tabindex="-1"]'),
|
|
725
|
+
);
|
|
726
|
+
|
|
645
727
|
const searchLabel = t('@astryx.tokenizer.search', {label});
|
|
646
728
|
// An empty state only once the search has settled; while pending the busy
|
|
647
729
|
// row above stands in for it.
|
|
@@ -725,6 +807,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
725
807
|
placeholder={t('@astryx.tokenizer.searchPlaceholder')}
|
|
726
808
|
value={query}
|
|
727
809
|
onValueChange={handleQueryChange}
|
|
810
|
+
hasInputBox
|
|
728
811
|
fieldXstyle={styles.searchField}
|
|
729
812
|
/>
|
|
730
813
|
</div>
|
|
@@ -736,6 +819,7 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
736
819
|
aria-busy={isPending || undefined}
|
|
737
820
|
data-rendered-count={renderedItems.length}
|
|
738
821
|
data-total-count={visibleItems.length}
|
|
822
|
+
{...listDragProps}
|
|
739
823
|
onFocusCapture={event => {
|
|
740
824
|
isRowFocusedRef.current =
|
|
741
825
|
event.target instanceof HTMLElement &&
|
|
@@ -775,13 +859,18 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
775
859
|
variant="secondary"
|
|
776
860
|
size="lg"
|
|
777
861
|
onClick={() => {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
862
|
+
const base = {id: trimmedQuery, label: trimmedQuery};
|
|
863
|
+
const createdItem = base as T;
|
|
864
|
+
setDraftValue(current => [...current, createdItem]);
|
|
865
|
+
lastDraftChangeRef.current = {
|
|
866
|
+
item: createdItem,
|
|
867
|
+
type: 'create',
|
|
868
|
+
};
|
|
869
|
+
// The created value, as the inline field announces it; the
|
|
870
|
+
// item's label is the row's caption ("Create …").
|
|
871
|
+
announce(
|
|
872
|
+
t('@astryx.tokenizer.tokenAdded', {label: trimmedQuery}),
|
|
873
|
+
);
|
|
785
874
|
// The same path a typed change takes, so the bootstrap
|
|
786
875
|
// reload shows its pending state and reports the change.
|
|
787
876
|
handleQueryChange('');
|
|
@@ -863,14 +952,18 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
863
952
|
return;
|
|
864
953
|
}
|
|
865
954
|
if (isSelected) {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
955
|
+
setDraftValue(current =>
|
|
956
|
+
current.filter(selected => selected.id !== item.id),
|
|
957
|
+
);
|
|
958
|
+
lastDraftChangeRef.current = {item, type: 'remove'};
|
|
959
|
+
announce(
|
|
960
|
+
t('@astryx.tokenizer.tokenRemoved', {
|
|
961
|
+
label: item.label,
|
|
962
|
+
}),
|
|
963
|
+
);
|
|
964
|
+
} else {
|
|
965
|
+
setDraftValue(current => [...current, item]);
|
|
966
|
+
lastDraftChangeRef.current = {item, type: 'add'};
|
|
874
967
|
announce(
|
|
875
968
|
t('@astryx.tokenizer.tokenAdded', {
|
|
876
969
|
label: item.label,
|
|
@@ -903,38 +996,44 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
903
996
|
</div>
|
|
904
997
|
)}
|
|
905
998
|
</div>
|
|
906
|
-
{
|
|
907
|
-
<
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
999
|
+
<div {...stylex.props(styles.footer)}>
|
|
1000
|
+
<Button
|
|
1001
|
+
label={t('@astryx.tokenizer.clearAll')}
|
|
1002
|
+
variant="secondary"
|
|
1003
|
+
size="lg"
|
|
1004
|
+
isDisabled={draftValue.length === 0}
|
|
1005
|
+
// With a tooltip, Button's disabled mode is `aria-disabled`: the
|
|
1006
|
+
// action keeps its focus order and says why it does nothing
|
|
1007
|
+
// (`spec:AST-085` FR1), instead of leaving the tab order as a
|
|
1008
|
+
// natively disabled button does — a confirmed Clear all returns
|
|
1009
|
+
// focus here before the search field takes it (FR24).
|
|
1010
|
+
tooltip={
|
|
1011
|
+
draftValue.length === 0
|
|
1012
|
+
? t('@astryx.tokenizer.nothingToClear')
|
|
1013
|
+
: undefined
|
|
1014
|
+
}
|
|
1015
|
+
ref={clearAllRef}
|
|
1016
|
+
onClick={() => setIsClearConfirmationOpen(true)}
|
|
1017
|
+
xstyle={styles.footerAction}
|
|
1018
|
+
/>
|
|
1019
|
+
<Button
|
|
1020
|
+
label={t('@astryx.tokenizer.save')}
|
|
1021
|
+
variant="primary"
|
|
1022
|
+
size="lg"
|
|
1023
|
+
isDisabled={isDraftOverMax}
|
|
1024
|
+
// Over the limit (a `value` already over it at open, or a lowered
|
|
1025
|
+
// limit while open) Save keeps its tab stop and says why it waits.
|
|
1026
|
+
tooltip={
|
|
1027
|
+
isDraftOverMax
|
|
1028
|
+
? t('@astryx.tokenizer.selectionLimit', {count: maxEntries ?? 0})
|
|
1029
|
+
: undefined
|
|
1030
|
+
}
|
|
1031
|
+
onClick={handleSave}
|
|
1032
|
+
xstyle={styles.footerAction}
|
|
1033
|
+
/>
|
|
1034
|
+
</div>
|
|
936
1035
|
{isClearConfirmationOpen && (
|
|
937
|
-
<
|
|
1036
|
+
<SheetConfirmation
|
|
938
1037
|
isOpen
|
|
939
1038
|
onOpenChange={next => {
|
|
940
1039
|
if (!next) {
|
|
@@ -943,13 +1042,40 @@ function TokenizerSheetContent<T extends SearchableItem>({
|
|
|
943
1042
|
}}
|
|
944
1043
|
title={t('@astryx.tokenizer.clearAllTitle')}
|
|
945
1044
|
description={t('@astryx.tokenizer.clearAllDescription', {label})}
|
|
1045
|
+
cancelLabel={t('@astryx.alertDialog.cancel')}
|
|
946
1046
|
actionLabel={t('@astryx.tokenizer.clearSelection')}
|
|
947
1047
|
onAction={() => {
|
|
948
|
-
|
|
1048
|
+
// A clear is a removal of the draft's last item, for Save's
|
|
1049
|
+
// `remove` when it is the last edit that holds.
|
|
1050
|
+
const lastItem = draftValue[draftValue.length - 1];
|
|
1051
|
+
if (lastItem != null) {
|
|
1052
|
+
setDraftValue([]);
|
|
1053
|
+
lastDraftChangeRef.current = {item: lastItem, type: 'remove'};
|
|
1054
|
+
}
|
|
949
1055
|
closeClearConfirmation(true);
|
|
950
1056
|
}}
|
|
951
1057
|
/>
|
|
952
1058
|
)}
|
|
1059
|
+
{isDiscardConfirmationOpen && (
|
|
1060
|
+
<SheetConfirmation
|
|
1061
|
+
isOpen
|
|
1062
|
+
onOpenChange={next => {
|
|
1063
|
+
if (!next) {
|
|
1064
|
+
closeDiscardConfirmation();
|
|
1065
|
+
}
|
|
1066
|
+
}}
|
|
1067
|
+
title={t('@astryx.tokenizer.discardChangesTitle')}
|
|
1068
|
+
description={t('@astryx.tokenizer.discardChangesDescription', {
|
|
1069
|
+
label,
|
|
1070
|
+
})}
|
|
1071
|
+
cancelLabel={t('@astryx.tokenizer.keepEditing')}
|
|
1072
|
+
actionLabel={t('@astryx.tokenizer.discardChanges')}
|
|
1073
|
+
onAction={() => {
|
|
1074
|
+
setIsDiscardConfirmationOpen(false);
|
|
1075
|
+
onCloseSheet();
|
|
1076
|
+
}}
|
|
1077
|
+
/>
|
|
1078
|
+
)}
|
|
953
1079
|
</div>
|
|
954
1080
|
);
|
|
955
1081
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file TokenizerItemRemovableContext.ts
|
|
7
|
+
* @input None
|
|
8
|
+
* @output A context carrying a predicate that tells which tokens the user can
|
|
9
|
+
* remove
|
|
10
|
+
* @position Internal to Core: not exported from the Tokenizer barrel. A
|
|
11
|
+
* component that composes Tokenizer and locks some tokens (PowerSearch: its
|
|
12
|
+
* read-only filters, and every filter of a read-only field) provides it. In
|
|
13
|
+
* the popover presentation, Clear all then keeps a locked token, Backspace
|
|
14
|
+
* removes nothing while the last token is locked, and Clear all shows only
|
|
15
|
+
* while a removable token remains. Without it, every token is removable.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {createContext} from 'react';
|
|
19
|
+
import type {SearchableItem} from '../Typeahead/types';
|
|
20
|
+
|
|
21
|
+
export const TokenizerItemRemovableContext = createContext<
|
|
22
|
+
((item: SearchableItem) => boolean) | null
|
|
23
|
+
>(null);
|
|
24
|
+
TokenizerItemRemovableContext.displayName = 'TokenizerItemRemovableContext';
|