@astryxdesign/core 0.7.6-canary.ec128c4 → 0.7.6-canary.f73623d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +183 -5
- package/dist/AppShell/observeMainOverflow.d.ts +9 -0
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -0
- package/dist/AppShell/observeMainOverflow.js +125 -0
- package/dist/Carousel/Carousel.d.ts +3 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +12 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +41 -4
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +11 -7
- package/dist/DateInput/usePointerDragScroll.d.ts +10 -1
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +25 -9
- package/dist/DateInput/useScrollSettle.d.ts +3 -1
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
- package/dist/DateInput/useScrollSettle.js +37 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +28 -19
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +19 -6
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +27 -6
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +8 -3
- package/dist/Markdown/plugins/headingLinks.a11y.chromium.spec.js +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +5 -29
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +23 -2
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +27 -0
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +32 -12
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +10 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +37 -30
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +11 -3
- package/dist/SideNav/SideNavItem.d.ts +2 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +18 -7
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +26 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +10 -3
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +36 -10
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +46 -58
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +19 -3
- package/dist/ToggleButton/ToggleButtonGroup.d.ts +7 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.js +16 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +37 -5
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +14 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +15 -4
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts +2 -0
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerClearAllMessageContext.js +17 -0
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -4
- package/dist/Typeahead/BaseTypeahead.d.ts +4 -4
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +43 -7
- package/dist/astryx.css +10 -3
- package/dist/gestures/GestureArena.d.ts +26 -1
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +71 -9
- package/dist/gestures/GestureHost.d.ts +2 -3
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +7 -7
- package/dist/gestures/GestureRecognizer.d.ts +3 -1
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +3 -1
- package/dist/gestures/PressTracker.d.ts +112 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -0
- package/dist/gestures/PressTracker.js +267 -0
- package/dist/gestures/index.d.ts +37 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +25 -0
- package/dist/gestures/useGestureRecognizer.d.ts +56 -0
- package/dist/gestures/useGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/useGestureRecognizer.js +226 -0
- package/dist/hooks/scrollKeyboardDelegation.d.ts.map +1 -1
- package/dist/hooks/scrollKeyboardDelegation.js +7 -3
- package/dist/hooks/useScrollOverflow.d.ts +2 -1
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +56 -10
- package/dist/i18n/generated-locales/af-ZA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/af-ZA.generated.js +0 -5
- package/dist/i18n/generated-locales/ar-SA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ar-SA.generated.js +0 -5
- package/dist/i18n/generated-locales/ca-ES.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ca-ES.generated.js +0 -5
- package/dist/i18n/generated-locales/cs-CZ.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/cs-CZ.generated.js +0 -5
- package/dist/i18n/generated-locales/da-DK.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/da-DK.generated.js +0 -5
- package/dist/i18n/generated-locales/de-DE.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/de-DE.generated.js +0 -5
- package/dist/i18n/generated-locales/el-GR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/el-GR.generated.js +0 -5
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +3 -5
- package/dist/i18n/generated-locales/es-ES.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/es-ES.generated.js +0 -5
- package/dist/i18n/generated-locales/fi-FI.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/fi-FI.generated.js +0 -5
- package/dist/i18n/generated-locales/fr-FR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/fr-FR.generated.js +0 -5
- package/dist/i18n/generated-locales/he-IL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/he-IL.generated.js +0 -5
- package/dist/i18n/generated-locales/hu-HU.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/hu-HU.generated.js +0 -5
- package/dist/i18n/generated-locales/it-IT.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/it-IT.generated.js +0 -5
- package/dist/i18n/generated-locales/ja-JP.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ja-JP.generated.js +0 -5
- package/dist/i18n/generated-locales/ko-KR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ko-KR.generated.js +0 -5
- package/dist/i18n/generated-locales/nl-NL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/nl-NL.generated.js +0 -5
- package/dist/i18n/generated-locales/no-NO.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/no-NO.generated.js +0 -5
- package/dist/i18n/generated-locales/pl-PL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pl-PL.generated.js +0 -5
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +3 -5
- package/dist/i18n/generated-locales/pt-BR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pt-BR.generated.js +0 -5
- package/dist/i18n/generated-locales/pt-PT.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pt-PT.generated.js +0 -5
- package/dist/i18n/generated-locales/ro-RO.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ro-RO.generated.js +0 -5
- package/dist/i18n/generated-locales/ru-RU.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ru-RU.generated.js +0 -5
- package/dist/i18n/generated-locales/sr-SP.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/sr-SP.generated.js +0 -5
- package/dist/i18n/generated-locales/sv-SE.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/sv-SE.generated.js +0 -5
- package/dist/i18n/generated-locales/tr-TR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/tr-TR.generated.js +0 -5
- package/dist/i18n/generated-locales/uk-UA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/uk-UA.generated.js +0 -5
- package/dist/i18n/generated-locales/vi-VN.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/vi-VN.generated.js +0 -5
- package/dist/i18n/generated-locales/zh-CN.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/zh-CN.generated.js +0 -5
- package/dist/i18n/generated-locales/zh-TW.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/zh-TW.generated.js +0 -5
- package/dist/motion/animator.d.ts +76 -7
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +589 -99
- package/dist/motion/coast.d.ts +4 -1
- package/dist/motion/coast.d.ts.map +1 -1
- package/dist/motion/coast.js +4 -2
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +6 -2
- package/dist/motion/reducedMotionPlan.d.ts +7 -0
- package/dist/motion/reducedMotionPlan.d.ts.map +1 -1
- package/dist/motion/reducedMotionPlan.js +14 -1
- package/dist/motion/resolveMotion.d.ts +42 -0
- package/dist/motion/resolveMotion.d.ts.map +1 -0
- package/dist/motion/resolveMotion.js +43 -0
- package/dist/motion/roleValue.d.ts +2 -1
- package/dist/motion/roleValue.d.ts.map +1 -1
- package/dist/motion/roleValue.js +2 -1
- package/dist/motion/uikit/timing.d.ts +7 -1
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +19 -1
- package/dist/theme/defineTheme.d.ts +19 -5
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +63 -3
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/motionKnobs.d.ts +56 -0
- package/dist/theme/motionKnobs.d.ts.map +1 -0
- package/dist/theme/motionKnobs.js +48 -0
- package/dist/theme/resolveThemeValues.d.ts +11 -4
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +40 -4
- package/dist/theme/themeAdaptations.d.ts +7 -3
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +36 -7
- package/dist/theme/themeMotion.d.ts +96 -0
- package/dist/theme/themeMotion.d.ts.map +1 -0
- package/dist/theme/themeMotion.js +177 -0
- package/dist/theme/tokenReferences.d.ts +31 -0
- package/dist/theme/tokenReferences.d.ts.map +1 -0
- package/dist/theme/tokenReferences.js +132 -0
- package/dist/theme/tokens.d.ts +1 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +9 -129
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +12 -0
- package/dist/utils/focusOutline.stylex.d.ts +6 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +7 -0
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +17 -8
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +20 -1
- package/dist/utils/sharedMutationObserver.d.ts +19 -11
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +66 -26
- package/dist/utils/touchPresentation.d.ts +2 -2
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +8 -5
- package/dist/utils/touchQueries.d.ts +13 -0
- package/dist/utils/touchQueries.d.ts.map +1 -0
- package/dist/utils/touchQueries.js +15 -0
- package/dist/utils/useFocusAcrossSwap.d.ts +19 -0
- package/dist/utils/useFocusAcrossSwap.d.ts.map +1 -0
- package/dist/utils/useFocusAcrossSwap.js +41 -0
- package/locales/af-ZA.json +0 -21
- package/locales/ar-SA.json +0 -21
- package/locales/ca-ES.json +0 -21
- package/locales/cs-CZ.json +0 -21
- package/locales/da-DK.json +0 -21
- package/locales/de-DE.json +0 -21
- package/locales/el-GR.json +0 -21
- package/locales/en.json +12 -20
- package/locales/es-ES.json +0 -21
- package/locales/fi-FI.json +0 -21
- package/locales/fr-FR.json +0 -21
- package/locales/he-IL.json +0 -21
- package/locales/hu-HU.json +0 -21
- package/locales/it-IT.json +0 -21
- package/locales/ja-JP.json +0 -21
- package/locales/ko-KR.json +0 -21
- package/locales/nl-NL.json +0 -21
- package/locales/no-NO.json +0 -21
- package/locales/pl-PL.json +0 -21
- package/locales/pseudo.json +8 -14
- package/locales/pt-BR.json +0 -21
- package/locales/pt-PT.json +0 -21
- package/locales/ro-RO.json +0 -21
- package/locales/ru-RU.json +0 -21
- package/locales/sr-SP.json +0 -21
- package/locales/sv-SE.json +0 -21
- package/locales/tr-TR.json +0 -21
- package/locales/uk-UA.json +0 -21
- package/locales/vi-VN.json +0 -21
- package/locales/zh-CN.json +0 -21
- package/locales/zh-TW.json +0 -21
- package/package.json +4 -4
- package/src/AppShell/AppShell.doc.mjs +1 -1
- package/src/AppShell/AppShell.spec.md +9 -12
- package/src/AppShell/AppShell.test.tsx +164 -2
- package/src/AppShell/AppShell.tsx +225 -5
- package/src/AppShell/__tests__/AppShellMainKeyboard.a11y.browser.spec.ts +534 -0
- package/src/AppShell/observeMainOverflow.test.ts +173 -0
- package/src/AppShell/observeMainOverflow.ts +143 -0
- package/src/Carousel/Carousel.doc.mjs +1 -1
- package/src/Carousel/Carousel.spec.md +9 -9
- package/src/Carousel/Carousel.test.tsx +124 -3
- package/src/Carousel/Carousel.tsx +10 -2
- package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +1 -16
- package/src/Chat/ChatComposer.spec.md +75 -59
- package/src/Chat/ChatComposerTokenElement.spec.md +45 -33
- package/src/Chat/ChatDictationButton.spec.md +126 -81
- package/src/Chat/ChatLayout.spec.md +41 -36
- package/src/Chat/ChatLayoutScrollButton.spec.md +87 -103
- package/src/Chat/ChatSendButton.spec.md +78 -67
- package/src/CodeBlock/__tests__/CodeBlockCopyClearance.a11y.chromium.spec.ts +38 -3
- package/src/ComplexSelector/ComplexSelector.test.tsx +111 -0
- package/src/ComplexSelector/ComplexSelector.tsx +41 -4
- package/src/ContextMenu/ContextMenu.spec.md +84 -56
- package/src/ContextMenu/ContextMenuItem.spec.md +132 -0
- package/src/DateInput/DateInputTouch.test.tsx +44 -0
- package/src/DateInput/Wheel.tsx +9 -6
- package/src/DateInput/usePointerDragScroll.ts +34 -10
- package/src/DateInput/useScrollSettle.ts +38 -7
- package/src/DropdownMenu/DropdownMenu.spec.md +198 -218
- package/src/DropdownMenu/DropdownMenu.test.tsx +117 -0
- package/src/DropdownMenu/DropdownMenu.tsx +33 -18
- package/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md +192 -0
- package/src/DropdownMenu/DropdownMenuDivider.spec.md +25 -31
- package/src/DropdownMenu/DropdownMenuGroup.spec.md +145 -0
- package/src/DropdownMenu/DropdownMenuItem.spec.md +48 -42
- package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +34 -37
- package/src/DropdownMenu/DropdownMenuRadioItem.spec.md +54 -53
- package/src/DropdownMenu/DropdownMenuSubMenu.spec.md +47 -41
- package/src/EmptyState/EmptyState.spec.md +35 -29
- package/src/Item/Item.test.tsx +60 -0
- package/src/Item/Item.tsx +14 -7
- package/src/Layer/useLayer.test.tsx +78 -3
- package/src/Layer/useLayer.tsx +27 -6
- package/src/Link/Link.spec.md +3 -2
- package/src/Link/Link.tsx +11 -0
- package/src/Link/__tests__/Link.truncation.a11y.chromium.spec.ts +58 -0
- package/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts +1 -1
- package/src/NavMenu/NavHeadingMenuItem.tsx +5 -39
- package/src/NumberInput/NumberInput.test.tsx +68 -7
- package/src/NumberInput/NumberInput.tsx +31 -1
- package/src/Outline/Outline.spec.md +165 -69
- package/src/Outline/Outline.test.tsx +67 -2
- package/src/Outline/Outline.tsx +23 -0
- package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +3 -4
- package/src/OverflowList/OverflowList.spec.md +102 -55
- package/src/Pagination/Pagination.spec.md +158 -84
- package/src/Popover/Popover.test.tsx +84 -0
- package/src/Popover/Popover.tsx +34 -14
- package/src/Popover/__tests__/PopoverSecondDocument.a11y.chromium.spec.ts +70 -8
- package/src/Popover/usePopover.tsx +10 -3
- package/src/PowerSearch/PowerSearch.test.tsx +24 -0
- package/src/PowerSearch/PowerSearch.tsx +42 -31
- package/src/RadioList/RadioList.spec.md +1 -1
- package/src/RadioList/RadioList.test.tsx +84 -0
- package/src/RadioList/RadioListItem.tsx +11 -2
- package/src/Resizable/Resizable.spec.md +144 -124
- package/src/SideNav/SideNav.test.tsx +124 -4
- package/src/SideNav/SideNavItem.spec.md +14 -24
- package/src/SideNav/SideNavItem.tsx +27 -10
- package/src/Skeleton/Skeleton.tsx +3 -1
- package/src/Spinner/Spinner.tsx +3 -1
- package/src/Stepper/Step.spec.md +36 -42
- package/src/Stepper/Step.tsx +33 -6
- package/src/Stepper/Stepper.doc.mjs +1 -1
- package/src/Stepper/Stepper.test.tsx +69 -7
- package/src/Switch/Switch.spec.md +1 -1
- package/src/Switch/Switch.test.tsx +66 -1
- package/src/Switch/Switch.tsx +11 -3
- package/src/Table/Table.spec.md +1 -1
- package/src/Table/Table.test.tsx +32 -0
- package/src/Table/Table.tsx +43 -11
- package/src/Table/__tests__/Table.a11y.states.ts +1 -5
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +73 -144
- package/src/Table/plugins/sortable/useTableSortable.tsx +44 -73
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +9 -21
- package/src/TimeInput/TimeInput.spec.md +13 -13
- package/src/Toast/Toast.spec.md +2 -5
- package/src/Toast/ToastViewport.test.tsx +79 -0
- package/src/Toast/ToastViewport.tsx +21 -3
- package/src/ToggleButton/ToggleButton.test.tsx +27 -0
- package/src/ToggleButton/ToggleButtonGroup.tsx +20 -1
- package/src/Token/Token.doc.mjs +2 -2
- package/src/Token/Token.spec.md +41 -51
- package/src/Token/Token.test.tsx +67 -0
- package/src/Token/Token.tsx +60 -5
- package/src/Token/TokenLink.tsx +21 -7
- package/src/Tokenizer/Tokenizer.spec.md +13 -1
- package/src/Tokenizer/Tokenizer.test.tsx +27 -0
- package/src/Tokenizer/Tokenizer.tsx +24 -10
- package/src/Tokenizer/TokenizerBottomSheet.test.tsx +8 -0
- package/src/Tokenizer/TokenizerClearAllMessageContext.ts +21 -0
- package/src/TreeList/TreeList.test.tsx +26 -0
- package/src/TreeList/TreeListItem.tsx +26 -4
- package/src/Typeahead/BaseTypeahead.doc.mjs +3 -3
- package/src/Typeahead/BaseTypeahead.spec.md +45 -45
- package/src/Typeahead/BaseTypeahead.tsx +48 -9
- package/src/Typeahead/Typeahead.test.tsx +120 -0
- package/src/__tests__/internalModulesNotExperimental.test.ts +88 -0
- package/src/__tests__/pressState.ts +8 -4
- package/src/gestures/GestureArena.ts +76 -11
- package/src/gestures/GestureHost.ts +6 -7
- package/src/gestures/GestureRecognizer.ts +3 -1
- package/src/gestures/PressTracker.ts +386 -0
- package/src/gestures/README.md +420 -0
- package/src/gestures/__tests__/GestureHost.test.ts +50 -1
- package/src/gestures/__tests__/PressTracker.test.ts +275 -0
- package/src/gestures/__tests__/arena.test.ts +35 -0
- package/src/gestures/__tests__/harness.ts +31 -2
- package/src/gestures/__tests__/pressTrackerFactory.test.ts +59 -0
- package/src/gestures/__tests__/useGestureRecognizer.test.tsx +570 -0
- package/src/gestures/index.ts +79 -0
- package/src/gestures/useGestureRecognizer.ts +305 -0
- package/src/hooks/scrollKeyboardDelegation.test.ts +33 -0
- package/src/hooks/scrollKeyboardDelegation.ts +9 -3
- package/src/hooks/useScrollOverflow.doc.mjs +1 -1
- package/src/hooks/useScrollOverflow.test.tsx +102 -1
- package/src/hooks/useScrollOverflow.ts +59 -10
- package/src/i18n/generated-locales/af-ZA.generated.ts +0 -7
- package/src/i18n/generated-locales/ar-SA.generated.ts +0 -6
- package/src/i18n/generated-locales/ca-ES.generated.ts +0 -7
- package/src/i18n/generated-locales/cs-CZ.generated.ts +0 -6
- package/src/i18n/generated-locales/da-DK.generated.ts +0 -6
- package/src/i18n/generated-locales/de-DE.generated.ts +0 -6
- package/src/i18n/generated-locales/el-GR.generated.ts +0 -7
- package/src/i18n/generated-locales/en.generated.ts +3 -6
- package/src/i18n/generated-locales/es-ES.generated.ts +0 -7
- package/src/i18n/generated-locales/fi-FI.generated.ts +0 -6
- package/src/i18n/generated-locales/fr-FR.generated.ts +0 -7
- package/src/i18n/generated-locales/he-IL.generated.ts +0 -6
- package/src/i18n/generated-locales/hu-HU.generated.ts +0 -6
- package/src/i18n/generated-locales/it-IT.generated.ts +0 -7
- package/src/i18n/generated-locales/ja-JP.generated.ts +0 -6
- package/src/i18n/generated-locales/ko-KR.generated.ts +0 -6
- package/src/i18n/generated-locales/nl-NL.generated.ts +0 -6
- package/src/i18n/generated-locales/no-NO.generated.ts +0 -6
- package/src/i18n/generated-locales/pl-PL.generated.ts +0 -7
- package/src/i18n/generated-locales/pseudo.generated.ts +3 -6
- package/src/i18n/generated-locales/pt-BR.generated.ts +0 -7
- package/src/i18n/generated-locales/pt-PT.generated.ts +0 -7
- package/src/i18n/generated-locales/ro-RO.generated.ts +0 -6
- package/src/i18n/generated-locales/ru-RU.generated.ts +0 -7
- package/src/i18n/generated-locales/sr-SP.generated.ts +0 -6
- package/src/i18n/generated-locales/sv-SE.generated.ts +0 -6
- package/src/i18n/generated-locales/tr-TR.generated.ts +0 -7
- package/src/i18n/generated-locales/uk-UA.generated.ts +0 -7
- package/src/i18n/generated-locales/vi-VN.generated.ts +0 -6
- package/src/i18n/generated-locales/zh-CN.generated.ts +0 -6
- package/src/i18n/generated-locales/zh-TW.generated.ts +0 -6
- package/src/motion/MEASUREMENTS.md +2 -1
- package/src/motion/README.md +102 -32
- package/src/motion/__tests__/animator.interaction.browser.spec.ts +843 -0
- package/src/motion/__tests__/motionBundle.ts +14 -0
- package/src/motion/animator.test.ts +978 -33
- package/src/motion/animator.ts +790 -104
- package/src/motion/coast.ts +10 -3
- package/src/motion/reducedMotion.ts +12 -2
- package/src/motion/reducedMotionPlan.test.ts +26 -0
- package/src/motion/reducedMotionPlan.ts +20 -1
- package/src/motion/resolveMotion.test.ts +123 -0
- package/src/motion/resolveMotion.ts +68 -0
- package/src/motion/roleValue.ts +2 -1
- package/src/motion/roles.test.ts +21 -4
- package/src/motion/uikit/tableImports.test.ts +293 -0
- package/src/motion/uikit/timing.ts +15 -1
- package/src/motion/uikit/values.test.ts +23 -12
- package/src/theme/Theme.doc.mjs +1 -1
- package/src/theme/defineTheme.ts +116 -7
- package/src/theme/expandMotionScale.test.ts +1 -1
- package/src/theme/index.ts +5 -0
- package/src/theme/motionKnobs.ts +82 -0
- package/src/theme/resolveThemeValues.ts +68 -6
- package/src/theme/themeAdaptations.ts +52 -12
- package/src/theme/themeMotion.test.ts +620 -0
- package/src/theme/themeMotion.ts +221 -0
- package/src/theme/tokenReferences.ts +149 -0
- package/src/theme/tokens.stylex.ts +10 -0
- package/src/theme/tokens.ts +15 -158
- package/src/utils/focusOutline.stylex.ts +28 -0
- package/src/utils/interactionOverlay.stylex.ts +12 -3
- package/src/utils/pressFeedback.test.ts +138 -0
- package/src/utils/pressFeedback.ts +34 -11
- package/src/utils/pressGesture.test.ts +9 -0
- package/src/utils/sharedMutationObserver.test.ts +54 -1
- package/src/utils/sharedMutationObserver.ts +87 -29
- package/src/utils/touchPresentation.ts +8 -5
- package/src/utils/touchQueries.ts +15 -0
- package/src/utils/useFocusAcrossSwap.ts +55 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/AppShell/AppShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/AppShell/AppShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiCf,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAW5C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAwChD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAE9D;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,kBA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ACH,GAAG,IAAI,EACR,EAAE,aAAa,qBA6wBf;yBA5xBe,QAAQ"}
|
|
@@ -23,7 +23,7 @@ import React from 'react';
|
|
|
23
23
|
import { isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import * as stylex from '@stylexjs/stylex';
|
|
25
25
|
import "../theme/tokens.stylex.js";
|
|
26
|
-
import { colorVars, fontWeightVars, radiusVars, spacingVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
26
|
+
import { colorVars, focusVars, fontWeightVars, radiusVars, spacingVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
27
27
|
import { Layout } from "../Layout/Layout.js";
|
|
28
28
|
import { LayoutHeader } from "../Layout/LayoutHeader.js";
|
|
29
29
|
import { LayoutPanel } from "../Layout/LayoutPanel.js";
|
|
@@ -38,7 +38,7 @@ import { TopNavRenderContext } from "../TopNav/TopNavRenderContext.js";
|
|
|
38
38
|
import { TopNavMobileContentContext } from "../TopNav/TopNavMobileContentContext.js";
|
|
39
39
|
import { AppShellMobileContext } from "./AppShellMobileContext.js";
|
|
40
40
|
import { mergeProps, isRenderable } from "../utils/index.js";
|
|
41
|
-
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
41
|
+
import { focusOutlineProps, focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
42
42
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
43
43
|
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
44
44
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -46,6 +46,8 @@ import { useTranslator } from "../i18n/index.js";
|
|
|
46
46
|
import { useThemeDefinition } from "../theme/useTheme.js";
|
|
47
47
|
import { DEFAULT_WIDTH_BREAKPOINTS } from "../theme/themeAdaptations.js";
|
|
48
48
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
49
|
+
import { attachScrollKeyboardDelegation } from "../hooks/scrollKeyboardDelegation.js";
|
|
50
|
+
import { observeMainOverflow } from "./observeMainOverflow.js";
|
|
49
51
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
50
52
|
const HasActivity = typeof React.Activity !== 'undefined';
|
|
51
53
|
const ActivityWrapper = HasActivity ? ({
|
|
@@ -168,6 +170,14 @@ const styles = {
|
|
|
168
170
|
kI3sdo: "x1uvtmcs",
|
|
169
171
|
$$css: true
|
|
170
172
|
},
|
|
173
|
+
mainElevatedCorner: {
|
|
174
|
+
krdFHd: "x9a4xmf",
|
|
175
|
+
$$css: true
|
|
176
|
+
},
|
|
177
|
+
mainScrollRegionInset: {
|
|
178
|
+
kInvED: "x1wfwxd8 x1nw7mhf",
|
|
179
|
+
$$css: true
|
|
180
|
+
},
|
|
171
181
|
contentBgSurface: {
|
|
172
182
|
kWkggS: "x10xzikg",
|
|
173
183
|
$$css: true
|
|
@@ -332,9 +342,87 @@ export function AppShell({
|
|
|
332
342
|
const handleSkipLinkClick = useCallback(() => {
|
|
333
343
|
document.getElementById(MAIN_CONTENT_ID)?.focus();
|
|
334
344
|
}, []);
|
|
345
|
+
|
|
346
|
+
// Main draws its focus ring only for focus a Tab press moved onto it, and
|
|
347
|
+
// keeps it for as long as that focus stays, even once the content fits.
|
|
348
|
+
// Programmatic focus (the skip link, a script's focus() on a route change)
|
|
349
|
+
// draws none (FR4), even after keyboard input, where :focus-visible alone
|
|
350
|
+
// would match. See the effect below for how a Tab move is told apart.
|
|
351
|
+
const [isTabFocus, setIsTabFocus] = useState(false);
|
|
352
|
+
// A window or tab switch blurs main without moving focus off it: main stays
|
|
353
|
+
// the document's active element, and focus comes back to it with no Tab
|
|
354
|
+
// press. The ring holds across that round trip; any real focus move ends it.
|
|
355
|
+
const isMainAwayRef = useRef(false);
|
|
356
|
+
const handleMainBlur = useCallback(event => {
|
|
357
|
+
if (event.target !== event.currentTarget) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (document.activeElement === event.currentTarget) {
|
|
361
|
+
isMainAwayRef.current = true;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
isMainAwayRef.current = false;
|
|
365
|
+
setIsTabFocus(false);
|
|
366
|
+
}, []);
|
|
335
367
|
const isFill = height === 'fill';
|
|
336
368
|
const isAuto = height === 'auto';
|
|
337
369
|
|
|
370
|
+
// With `fill`, main is the page's scroller. While its content overflows it
|
|
371
|
+
// must be reachable from the keyboard even when nothing inside it is
|
|
372
|
+
// focusable (AST-025 FR12): it joins the tab order, and Tab entry moves on
|
|
373
|
+
// to its first link or button when it has one. Only `fill` observes main
|
|
374
|
+
// (PR1); LayoutContent keeps owning main's overflow and styles.
|
|
375
|
+
const [isMainOverflowing, setIsMainOverflowing] = useState(false);
|
|
376
|
+
const isMainScrollRegion = isFill && isMainOverflowing;
|
|
377
|
+
// Main's node is owned through a ref, never React state. Under `fill` its
|
|
378
|
+
// overflow is observed while the node is attached, and while main is a
|
|
379
|
+
// scroll region the keyboard delegation is attached to it. The ref callback
|
|
380
|
+
// changes with `fill`, so switching modes detaches and re-attaches main in
|
|
381
|
+
// the same commit; a detached or replaced node releases both before the new
|
|
382
|
+
// node takes over.
|
|
383
|
+
const mainNodeRef = useRef(null);
|
|
384
|
+
const mainOverflowRef = useRef(null);
|
|
385
|
+
const mainDelegationRef = useRef(null);
|
|
386
|
+
const isMainScrollRegionRef = useRef(isMainScrollRegion);
|
|
387
|
+
const syncMainDelegation = useCallback(() => {
|
|
388
|
+
const node = isMainScrollRegionRef.current ? mainNodeRef.current : null;
|
|
389
|
+
const current = mainDelegationRef.current;
|
|
390
|
+
if (current?.node === node) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
current?.release();
|
|
394
|
+
mainDelegationRef.current = node == null ? null : {
|
|
395
|
+
node,
|
|
396
|
+
release: attachScrollKeyboardDelegation(node, node)
|
|
397
|
+
};
|
|
398
|
+
}, []);
|
|
399
|
+
const setMainNode = useCallback(node => {
|
|
400
|
+
mainNodeRef.current = node;
|
|
401
|
+
const observed = isFill ? node : null;
|
|
402
|
+
const current = mainOverflowRef.current;
|
|
403
|
+
if (current?.node !== observed) {
|
|
404
|
+
current?.stop();
|
|
405
|
+
mainOverflowRef.current = observed == null ? null : {
|
|
406
|
+
node: observed,
|
|
407
|
+
stop: observeMainOverflow(observed, setIsMainOverflowing)
|
|
408
|
+
};
|
|
409
|
+
if (observed == null) {
|
|
410
|
+
setIsMainOverflowing(false);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
syncMainDelegation();
|
|
414
|
+
}, [isFill, syncMainDelegation]);
|
|
415
|
+
useEffect(() => {
|
|
416
|
+
isMainScrollRegionRef.current = isMainScrollRegion;
|
|
417
|
+
syncMainDelegation();
|
|
418
|
+
}, [isMainScrollRegion, syncMainDelegation]);
|
|
419
|
+
useEffect(() => () => {
|
|
420
|
+
mainOverflowRef.current?.stop();
|
|
421
|
+
mainOverflowRef.current = null;
|
|
422
|
+
mainDelegationRef.current?.release();
|
|
423
|
+
mainDelegationRef.current = null;
|
|
424
|
+
}, []);
|
|
425
|
+
|
|
338
426
|
// Nav style derived values
|
|
339
427
|
const hasBanner = isRenderable(banner);
|
|
340
428
|
const hasTopNav = isRenderable(topNav);
|
|
@@ -459,6 +547,9 @@ export function AppShell({
|
|
|
459
547
|
// (`component:SideNav` FR6).
|
|
460
548
|
const railRef = useRef(null);
|
|
461
549
|
const mainRef = useRef(null);
|
|
550
|
+
// Main's node goes to the glide above and to the overflow observation
|
|
551
|
+
// that, under `fill`, makes main a keyboard stop.
|
|
552
|
+
const mainRefs = useMergedRefs(mainRef, setMainNode);
|
|
462
553
|
const backdropRef = useRef(null);
|
|
463
554
|
const contentLayout = useAnimatedLayout({
|
|
464
555
|
containerRef: shellRef
|
|
@@ -617,17 +708,104 @@ export function AppShell({
|
|
|
617
708
|
// Build main content
|
|
618
709
|
// =========================================================================
|
|
619
710
|
const shouldElevateWithCorner = isElevated && hasTopNav && showSideNavInline;
|
|
711
|
+
// While main is a keyboard stop, a Tab keydown anywhere in the document
|
|
712
|
+
// (capture, so Shift+Tab from the page start counts too) marks the next
|
|
713
|
+
// focus move, and so does the window's focus event for keyboard focus that
|
|
714
|
+
// enters the document from outside (Tab or Shift+Tab from the page
|
|
715
|
+
// embedding this one), where the browser's own `:focus-visible` then tells
|
|
716
|
+
// a key from a pointer. A mark counts only once its event's dispatch has
|
|
717
|
+
// finished uncancelled (`eventPhase === 0`): the browser's own focus move
|
|
718
|
+
// follows that dispatch in the same task, while a focus() a page's handler
|
|
719
|
+
// calls during it is programmatic and draws no ring (FR4). The marks expire
|
|
720
|
+
// on a zero-delay timer, so a cancelled Tab, a Tab out of the document or a
|
|
721
|
+
// window focus with nothing focused leaves nothing for a later focus().
|
|
722
|
+
useEffect(() => {
|
|
723
|
+
if (!isMainScrollRegion) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
let tabKeydown = null;
|
|
727
|
+
let windowFocus = null;
|
|
728
|
+
let expiry;
|
|
729
|
+
const expireMarks = () => {
|
|
730
|
+
clearTimeout(expiry);
|
|
731
|
+
expiry = setTimeout(() => {
|
|
732
|
+
tabKeydown = null;
|
|
733
|
+
windowFocus = null;
|
|
734
|
+
}, 0);
|
|
735
|
+
};
|
|
736
|
+
const onKeyDown = event => {
|
|
737
|
+
tabKeydown = event.key === 'Tab' ? event : null;
|
|
738
|
+
windowFocus = null;
|
|
739
|
+
expireMarks();
|
|
740
|
+
};
|
|
741
|
+
const onPointerDown = () => {
|
|
742
|
+
tabKeydown = null;
|
|
743
|
+
windowFocus = null;
|
|
744
|
+
};
|
|
745
|
+
const onWindowFocus = event => {
|
|
746
|
+
windowFocus = event;
|
|
747
|
+
expireMarks();
|
|
748
|
+
};
|
|
749
|
+
const onFocusIn = event => {
|
|
750
|
+
// Still dispatching: this focus move is a handler's focus(), so it
|
|
751
|
+
// reads no mark and leaves the mark for the browser's own move.
|
|
752
|
+
const tabDone = tabKeydown != null && tabKeydown.eventPhase === 0;
|
|
753
|
+
const focusDone = windowFocus != null && windowFocus.eventPhase === 0;
|
|
754
|
+
const arrivedByTab = tabDone && tabKeydown?.defaultPrevented === false;
|
|
755
|
+
const enteredDocument = focusDone;
|
|
756
|
+
if (tabDone) {
|
|
757
|
+
tabKeydown = null;
|
|
758
|
+
}
|
|
759
|
+
if (focusDone) {
|
|
760
|
+
windowFocus = null;
|
|
761
|
+
}
|
|
762
|
+
const main = mainNodeRef.current;
|
|
763
|
+
const isMain = event.target != null && event.target === main;
|
|
764
|
+
if (isMainAwayRef.current) {
|
|
765
|
+
// Focus comes back after a window or tab switch (main keeps the ring
|
|
766
|
+
// it had), or lands elsewhere (main's ring is over).
|
|
767
|
+
isMainAwayRef.current = false;
|
|
768
|
+
if (isMain && !arrivedByTab) {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
if (!isMain) {
|
|
772
|
+
setIsTabFocus(false);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (isMain) {
|
|
777
|
+
setIsTabFocus(arrivedByTab || enteredDocument && main.matches(':focus-visible'));
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
781
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
782
|
+
document.addEventListener('focusin', onFocusIn, true);
|
|
783
|
+
window.addEventListener('focus', onWindowFocus);
|
|
784
|
+
return () => {
|
|
785
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
786
|
+
document.removeEventListener('pointerdown', onPointerDown, true);
|
|
787
|
+
document.removeEventListener('focusin', onFocusIn, true);
|
|
788
|
+
window.removeEventListener('focus', onWindowFocus);
|
|
789
|
+
clearTimeout(expiry);
|
|
790
|
+
};
|
|
791
|
+
}, [isMainScrollRegion]);
|
|
792
|
+
|
|
793
|
+
// Tab focus on main draws the ring until main loses focus; programmatic
|
|
794
|
+
// focus never does (FR4).
|
|
795
|
+
const drawsMainFocusRing = isTabFocus;
|
|
620
796
|
const mainInner = /*#__PURE__*/_jsx(LayoutContent, {
|
|
621
|
-
ref:
|
|
797
|
+
ref: mainRefs,
|
|
622
798
|
padding: contentPadding ?? 0,
|
|
623
799
|
role: "main",
|
|
624
800
|
id: MAIN_CONTENT_ID
|
|
625
801
|
// Focusable skip-link target (WCAG 2.4.1) — without tabIndex, several
|
|
626
802
|
// browsers won't move focus to the div when the skip link is activated.
|
|
803
|
+
// A keyboard stop only while it scrolls overflowing content.
|
|
627
804
|
,
|
|
628
|
-
tabIndex: -1,
|
|
805
|
+
tabIndex: isMainScrollRegion ? 0 : -1,
|
|
629
806
|
isScrollable: isFill,
|
|
630
|
-
|
|
807
|
+
onBlur: handleMainBlur,
|
|
808
|
+
xstyle: [contentAreaStyle, drawsMainFocusRing && shouldElevateWithCorner && styles.mainElevatedCorner, drawsMainFocusRing ? [focusOutlineStyles.focusVisible, styles.mainScrollRegionInset] : styles.mainFocusTarget],
|
|
631
809
|
children: children
|
|
632
810
|
});
|
|
633
811
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls `onChange` with whether `main`'s content overflows it on either axis:
|
|
3
|
+
* once with the first measurement, then whenever the answer changes. Signals
|
|
4
|
+
* coalesce into one measurement per frame. A hidden, disconnected or
|
|
5
|
+
* zero-size main is unknown rather than fitting: the last answer stands until
|
|
6
|
+
* a later signal measures it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function observeMainOverflow(main: HTMLElement, onChange: (overflows: boolean) => void): () => void;
|
|
9
|
+
//# sourceMappingURL=observeMainOverflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observeMainOverflow.d.ts","sourceRoot":"","sources":["../../src/AppShell/observeMainOverflow.ts"],"names":[],"mappings":"AAyCA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,GACrC,MAAM,IAAI,CA2FZ"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file observeMainOverflow.ts
|
|
7
|
+
* @input AppShell's main region under `height="fill"`: its own scroll
|
|
8
|
+
* container, holding its content as direct children with no wrapper
|
|
9
|
+
* @output observeMainOverflow(main, onChange): reports whether main's content
|
|
10
|
+
* overflows it on either axis, once at the start and on every change, and
|
|
11
|
+
* returns the function that stops observing
|
|
12
|
+
* @position Internal to AppShell and never exported. AppShell makes main a
|
|
13
|
+
* keyboard stop only while it overflows (`spec:AST-025` FR12,
|
|
14
|
+
* `component:AppShell` FR4 and PR1). Main has no inner content box, so its
|
|
15
|
+
* content grows inside it without resizing it: its direct children's sizes
|
|
16
|
+
* are watched instead.
|
|
17
|
+
*
|
|
18
|
+
* SYNC: When modified, update:
|
|
19
|
+
* - /packages/core/src/AppShell/AppShell.tsx
|
|
20
|
+
* - /packages/core/src/AppShell/observeMainOverflow.test.ts
|
|
21
|
+
*/
|
|
22
|
+
import { getLogicalAxisMapping, measureLogicalScrollAxis } from "../hooks/scrollGeometry.js";
|
|
23
|
+
import { observeMutations } from "../utils/sharedMutationObserver.js";
|
|
24
|
+
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Main's content: layout attributes, text and children, all the way down.
|
|
28
|
+
* One shared observer serves every registration with these options.
|
|
29
|
+
*/
|
|
30
|
+
const CONTENT_MUTATIONS = {
|
|
31
|
+
attributes: true,
|
|
32
|
+
attributeFilter: ['class', 'dir', 'hidden', 'style'],
|
|
33
|
+
characterData: true,
|
|
34
|
+
childList: true,
|
|
35
|
+
subtree: true
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Calls `onChange` with whether `main`'s content overflows it on either axis:
|
|
40
|
+
* once with the first measurement, then whenever the answer changes. Signals
|
|
41
|
+
* coalesce into one measurement per frame. A hidden, disconnected or
|
|
42
|
+
* zero-size main is unknown rather than fitting: the last answer stands until
|
|
43
|
+
* a later signal measures it.
|
|
44
|
+
*/
|
|
45
|
+
export function observeMainOverflow(main, onChange) {
|
|
46
|
+
let isActive = true;
|
|
47
|
+
let frame = null;
|
|
48
|
+
let overflows = null;
|
|
49
|
+
const measure = () => {
|
|
50
|
+
frame = null;
|
|
51
|
+
if (!isActive) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const computedStyle = getComputedStyle(main);
|
|
55
|
+
const mapping = getLogicalAxisMapping(computedStyle.writingMode, computedStyle.direction);
|
|
56
|
+
const inline = measureLogicalScrollAxis(main, 'inline', mapping);
|
|
57
|
+
const block = measureLogicalScrollAxis(main, 'block', mapping);
|
|
58
|
+
if (inline == null || block == null) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const next = inline.isScrollable || block.isScrollable;
|
|
62
|
+
if (next !== overflows) {
|
|
63
|
+
overflows = next;
|
|
64
|
+
onChange(next);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const scheduleMeasure = () => {
|
|
68
|
+
if (isActive && frame == null) {
|
|
69
|
+
frame = window.requestAnimationFrame(measure);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Main keeps its size while its content grows; its children do not. Each
|
|
74
|
+
// direct child's size is watched, following the children as they change.
|
|
75
|
+
const childObservers = new Map();
|
|
76
|
+
const syncChildObservers = () => {
|
|
77
|
+
const children = new Set(Array.from(main.children));
|
|
78
|
+
for (const [child, stop] of childObservers) {
|
|
79
|
+
if (!children.has(child)) {
|
|
80
|
+
stop();
|
|
81
|
+
childObservers.delete(child);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const child of children) {
|
|
85
|
+
if (!childObservers.has(child)) {
|
|
86
|
+
childObservers.set(child, observeResize(child, scheduleMeasure));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const onContentChange = () => {
|
|
91
|
+
syncChildObservers();
|
|
92
|
+
scheduleMeasure();
|
|
93
|
+
};
|
|
94
|
+
measure();
|
|
95
|
+
syncChildObservers();
|
|
96
|
+
const stopObservingMain = observeResize(main, scheduleMeasure);
|
|
97
|
+
const stopObservingContent = observeMutations(main, CONTENT_MUTATIONS, onContentChange);
|
|
98
|
+
window.addEventListener('resize', scheduleMeasure);
|
|
99
|
+
window.visualViewport?.addEventListener('resize', scheduleMeasure);
|
|
100
|
+
main.addEventListener('load', scheduleMeasure, true);
|
|
101
|
+
main.addEventListener('transitionend', scheduleMeasure);
|
|
102
|
+
main.addEventListener('animationend', scheduleMeasure);
|
|
103
|
+
const fonts = document.fonts;
|
|
104
|
+
fonts?.addEventListener?.('loadingdone', scheduleMeasure);
|
|
105
|
+
void fonts?.ready.then(scheduleMeasure);
|
|
106
|
+
return () => {
|
|
107
|
+
isActive = false;
|
|
108
|
+
if (frame != null) {
|
|
109
|
+
window.cancelAnimationFrame(frame);
|
|
110
|
+
frame = null;
|
|
111
|
+
}
|
|
112
|
+
stopObservingMain();
|
|
113
|
+
stopObservingContent();
|
|
114
|
+
for (const stop of childObservers.values()) {
|
|
115
|
+
stop();
|
|
116
|
+
}
|
|
117
|
+
childObservers.clear();
|
|
118
|
+
window.removeEventListener('resize', scheduleMeasure);
|
|
119
|
+
window.visualViewport?.removeEventListener('resize', scheduleMeasure);
|
|
120
|
+
main.removeEventListener('load', scheduleMeasure, true);
|
|
121
|
+
main.removeEventListener('transitionend', scheduleMeasure);
|
|
122
|
+
main.removeEventListener('animationend', scheduleMeasure);
|
|
123
|
+
fonts?.removeEventListener?.('loadingdone', scheduleMeasure);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
* scroll control. Exposes APG
|
|
11
11
|
* carousel semantics: the root is a labelled region with
|
|
12
12
|
* aria-roledescription="carousel" and each item wrapper is a group with
|
|
13
|
-
* aria-roledescription="slide" named "Slide N of M".
|
|
13
|
+
* aria-roledescription="slide" named "Slide N of M". The scroll area is a
|
|
14
|
+
* group named like the carousel and a tab stop only while its content
|
|
15
|
+
* overflows (AST-025 FR12).
|
|
14
16
|
*
|
|
15
17
|
* SYNC: When modified, update:
|
|
16
18
|
* - /packages/core/src/Carousel/index.ts (exports)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,IAAI,IAAI,CAAC;IACnB;;;OAGG;IACH,UAAU,IAAI,IAAI,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,kEAAkE;IAClE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA+JD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,SAAS,EACT,QAAQ,EACR,GAAO,EACP,UAAiB,EACjB,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,OAAO,EACP,YAAY,EAAE,kBAAkB,EAChC,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,SAAS,EACb,EAAE,aAAa,+BA+Xf;yBA/Ye,QAAQ"}
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* scroll control. Exposes APG
|
|
15
15
|
* carousel semantics: the root is a labelled region with
|
|
16
16
|
* aria-roledescription="carousel" and each item wrapper is a group with
|
|
17
|
-
* aria-roledescription="slide" named "Slide N of M".
|
|
17
|
+
* aria-roledescription="slide" named "Slide N of M". The scroll area is a
|
|
18
|
+
* group named like the carousel and a tab stop only while its content
|
|
19
|
+
* overflows (AST-025 FR12).
|
|
18
20
|
*
|
|
19
21
|
* SYNC: When modified, update:
|
|
20
22
|
* - /packages/core/src/Carousel/index.ts (exports)
|
|
@@ -447,8 +449,15 @@ export function Carousel({
|
|
|
447
449
|
"aria-label": ariaLabel,
|
|
448
450
|
"aria-roledescription": "carousel",
|
|
449
451
|
children: [/*#__PURE__*/_jsx("div", {
|
|
450
|
-
ref: composedRef
|
|
451
|
-
|
|
452
|
+
ref: composedRef
|
|
453
|
+
// The scroll area takes keyboard scrolling (spec:AST-025 FR12): a
|
|
454
|
+
// group named like the carousel, in the tab order only while its
|
|
455
|
+
// content overflows. While it fits it still takes focus
|
|
456
|
+
// programmatically, for the edge buttons' hand-off (FR2).
|
|
457
|
+
,
|
|
458
|
+
role: "group",
|
|
459
|
+
"aria-label": ariaLabel,
|
|
460
|
+
tabIndex: hasOverflow ? 0 : -1,
|
|
452
461
|
onWheel: handleWheel,
|
|
453
462
|
...mergeProps(themeProps('carousel-scroller', {
|
|
454
463
|
gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAA4B,KAAK,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAI5D,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,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;;;;OA2BG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,iCAAiC,KAAK,SAAS,CAAC;IACxE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EAAE,oBAAoB,EACjC,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,IAAW,EACX,OAAiB,EACjB,SAAS,EACT,KAAK,EACL,SAAmB,EACnB,SAAmB,EACnB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EACF,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,kBAAkB,EAAE,mBAAmB,EACvC,GAAG,SAAS,EACb,EAAE,oBAAoB,CAAC,KAAK,CAAC,qBA0Z7B;yBAjce,eAAe"}
|
|
@@ -29,16 +29,23 @@ import { useTranslator } from "../i18n/index.js";
|
|
|
29
29
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
30
30
|
import { usePopover } from "../Popover/usePopover.js";
|
|
31
31
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
32
|
+
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
32
33
|
import "../theme/tokens.stylex.js";
|
|
33
34
|
import { colorVars, durationVars, easeVars, fontWeightVars, radiusVars, sizeVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
35
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
34
36
|
import { isRenderable, mergeProps } from "../utils/index.js";
|
|
35
37
|
import { composeEventHandlers } from "../utils/composeEventHandlers.js";
|
|
36
|
-
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
37
38
|
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
38
39
|
import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
39
40
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
41
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
41
42
|
const styles = {
|
|
43
|
+
statusTip: {
|
|
44
|
+
k1xSpc: "x3nfvp2",
|
|
45
|
+
kGNEyG: "x6s0dn4",
|
|
46
|
+
kmuXW: "x2lah0s",
|
|
47
|
+
$$css: true
|
|
48
|
+
},
|
|
42
49
|
triggerContainer: {
|
|
43
50
|
kVAEAm: "x1n2onr6",
|
|
44
51
|
k1xSpc: "x78zum5",
|
|
@@ -177,6 +184,11 @@ const RENDER_TRIGGER_PARTS_MESSAGE = '`container*` and `control*` styling props
|
|
|
177
184
|
* open and close, including the ones the selector performs itself.
|
|
178
185
|
*/
|
|
179
186
|
|
|
187
|
+
/** Keeps a click from reaching the control box's open-the-popup handler. */
|
|
188
|
+
function stopPropagation(event) {
|
|
189
|
+
event.stopPropagation();
|
|
190
|
+
}
|
|
191
|
+
|
|
180
192
|
/**
|
|
181
193
|
* A selector shell for rich, custom selection surfaces.
|
|
182
194
|
*
|
|
@@ -268,7 +280,19 @@ export function ComplexSelector({
|
|
|
268
280
|
const contentId = useId();
|
|
269
281
|
const descriptionId = useId();
|
|
270
282
|
const statusMessageId = useId();
|
|
271
|
-
|
|
283
|
+
// With `tooltip` placement Field renders no message box, so the status
|
|
284
|
+
// lives in an info-tip button on the trigger row (family:input-fields FR8).
|
|
285
|
+
// Only that placement renders an on-field status affordance here.
|
|
286
|
+
const isTooltipStatus = effectiveStatusVariant === 'tooltip';
|
|
287
|
+
const {
|
|
288
|
+
statusIcon: statusTip,
|
|
289
|
+
describedBy: statusTipDescribedBy
|
|
290
|
+
} = useInputStatusIcon({
|
|
291
|
+
status: isTooltipStatus ? status : undefined,
|
|
292
|
+
statusVariant: effectiveStatusVariant,
|
|
293
|
+
size: 'sm'
|
|
294
|
+
});
|
|
295
|
+
const ariaDescribedBy = [description ? descriptionId : null, isTooltipStatus ? statusTipDescribedBy : status?.message ? statusMessageId : null].filter(id => id != null).join(' ') || undefined;
|
|
272
296
|
const triggerRef = useRef(null);
|
|
273
297
|
const triggerButtonRef = useMergedRefs(triggerRef, ref);
|
|
274
298
|
const [isPending, startTransition] = useTransition();
|
|
@@ -464,8 +488,10 @@ export function ComplexSelector({
|
|
|
464
488
|
// The ring belongs to the wrapper (the focusable `<button>` sits
|
|
465
489
|
// inside it), but it must still be a KEYBOARD ring: `:focus-within`
|
|
466
490
|
// matched a mouse click on the trigger and drew the outline for
|
|
467
|
-
// pointer users too.
|
|
468
|
-
|
|
491
|
+
// pointer users too. It keys off the trigger alone, so the status
|
|
492
|
+
// info-tip beside it rings itself and the box does not ring too
|
|
493
|
+
// (architecture:interaction-modality INV3).
|
|
494
|
+
focusOutlineStyles.focusWithinCombobox, variant === 'secondary' && styles.triggerSecondary, variant === 'ghost' && styles.triggerGhost, variant !== 'input' && interactionOverlayStyles.backgroundImage, isDisabled && inputWrapperStyles.disabled, variant !== 'input' && isDisabled && styles.triggerGhostDisabled, isDisabled && styles.disabled, triggerLabel == null && styles.placeholder, controlXstyle), controlClassName, controlStyle),
|
|
469
495
|
children: [isRenderable(startIconSlot) && startIconSlot, /*#__PURE__*/_jsx("button", {
|
|
470
496
|
...rest,
|
|
471
497
|
ref: triggerButtonRef,
|
|
@@ -505,6 +531,17 @@ export function ComplexSelector({
|
|
|
505
531
|
},
|
|
506
532
|
children: triggerContent
|
|
507
533
|
})
|
|
534
|
+
}), isRenderable(statusTip) &&
|
|
535
|
+
/*#__PURE__*/
|
|
536
|
+
// The info-tip is its own control: a press on it, or on its message
|
|
537
|
+
// bubble (portaled, so outside this span in the DOM but inside it in
|
|
538
|
+
// React), shows the message without opening the popup.
|
|
539
|
+
_jsx("span", {
|
|
540
|
+
onClick: stopPropagation,
|
|
541
|
+
...{
|
|
542
|
+
className: "x3nfvp2 x6s0dn4 x2lah0s"
|
|
543
|
+
},
|
|
544
|
+
children: statusTip
|
|
508
545
|
}), isBusy && /*#__PURE__*/_jsx(Spinner, {
|
|
509
546
|
size: "sm",
|
|
510
547
|
"aria-hidden": "true"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AA8MA,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AA8MA,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAmOZ;yBAzOe,KAAK"}
|
package/dist/DateInput/Wheel.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* rubber-banding, and the settle animation are the platform's; all this adds
|
|
13
13
|
* is `scroll-snap-align: center` on each option, half a viewport of padding at
|
|
14
14
|
* each end so the first and last option can reach the middle, and a commit
|
|
15
|
-
* when the scrolling stops.
|
|
15
|
+
* when the scrolling stops and no finger or mouse drag still holds it.
|
|
16
16
|
*
|
|
17
17
|
* The falloff (rows fading and tipping away from the centre) is a CSS
|
|
18
18
|
* scroll-driven animation on a `view()` timeline — the browser interpolates it
|
|
@@ -99,6 +99,15 @@ export function Wheel({
|
|
|
99
99
|
// `selectedIndex` only catches up when the wheel settles.
|
|
100
100
|
const [activeIndex, setActiveIndex] = useState(selectedIndex);
|
|
101
101
|
|
|
102
|
+
// A mouse cannot drag a scroll container, so without this the wheel ignores
|
|
103
|
+
// the one gesture its shape invites. Touch is untouched — it pans natively,
|
|
104
|
+
// with momentum this could not match. See usePointerDragScroll. The drag it
|
|
105
|
+
// holds is not rest either: the settle below waits for its release, as it
|
|
106
|
+
// waits for a finger's (useScrollSettle).
|
|
107
|
+
const {
|
|
108
|
+
isDraggingRef
|
|
109
|
+
} = usePointerDragScroll(scrollerRef, isActive);
|
|
110
|
+
|
|
102
111
|
// Row height in px, read from layout rather than assumed, so a theme that
|
|
103
112
|
// retunes --date-input-touch-wheel-item-size still lands on the right row.
|
|
104
113
|
const itemBlockSize = useCallback(() => {
|
|
@@ -138,7 +147,7 @@ export function Wheel({
|
|
|
138
147
|
if (option.value !== value) {
|
|
139
148
|
onChange(option.value);
|
|
140
149
|
}
|
|
141
|
-
}, isActive);
|
|
150
|
+
}, isActive, isDraggingRef);
|
|
142
151
|
|
|
143
152
|
// Park the committed row under the band whenever the wheel is shown, or the
|
|
144
153
|
// value is changed from outside (the calendar scrolled to another month).
|
|
@@ -210,11 +219,6 @@ export function Wheel({
|
|
|
210
219
|
useOwnScrollGesture(scrollerRef, 'all', {
|
|
211
220
|
isEnabled: isActive
|
|
212
221
|
});
|
|
213
|
-
|
|
214
|
-
// A mouse cannot drag a scroll container, so without this the wheel ignores
|
|
215
|
-
// the one gesture its shape invites. Touch is untouched — it pans natively,
|
|
216
|
-
// with momentum this could not match. See usePointerDragScroll.
|
|
217
|
-
usePointerDragScroll(scrollerRef, isActive);
|
|
218
222
|
const moveBy = useCallback(delta => {
|
|
219
223
|
const next = Math.min(options.length - 1, Math.max(0, activeIndex + delta));
|
|
220
224
|
const option = options[next];
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* press of the button itself, and a wheel row is a click target.
|
|
4
4
|
*/
|
|
5
5
|
export declare const DRAG_SLOP = 4;
|
|
6
|
+
/** What {@link usePointerDragScroll} reports back about the drag. */
|
|
7
|
+
export type PointerDragScrollState = {
|
|
8
|
+
/**
|
|
9
|
+
* True while a mouse drag holds the container: from the press that moved
|
|
10
|
+
* past {@link DRAG_SLOP} until its release. Pass it to `useScrollSettle`,
|
|
11
|
+
* which treats a held drag as it treats a finger still down.
|
|
12
|
+
*/
|
|
13
|
+
isDraggingRef: React.RefObject<boolean>;
|
|
14
|
+
};
|
|
6
15
|
/**
|
|
7
16
|
* Let a mouse drag `ref`'s contents, on a container that already scrolls and
|
|
8
17
|
* snaps for touch.
|
|
@@ -11,5 +20,5 @@ export declare const DRAG_SLOP = 4;
|
|
|
11
20
|
* @param isEnabled - skip while the wheel is hidden; a hidden panel keeps its
|
|
12
21
|
* layout box, so its listeners would otherwise still be live
|
|
13
22
|
*/
|
|
14
|
-
export declare function usePointerDragScroll(ref: React.RefObject<HTMLElement | null>, isEnabled?: boolean):
|
|
23
|
+
export declare function usePointerDragScroll(ref: React.RefObject<HTMLElement | null>, isEnabled?: boolean): PointerDragScrollState;
|
|
15
24
|
//# sourceMappingURL=usePointerDragScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePointerDragScroll.d.ts","sourceRoot":"","sources":["../../src/DateInput/usePointerDragScroll.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePointerDragScroll.d.ts","sourceRoot":"","sources":["../../src/DateInput/usePointerDragScroll.ts"],"names":[],"mappings":"AAwDA;;;GAGG;AACH,eAAO,MAAM,SAAS,IAAI,CAAC;AAK3B,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACxC,SAAS,GAAE,OAAc,GACxB,sBAAsB,CAmJxB"}
|