@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
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* @output Real-browser evidence that a Popover rendered into a second document
|
|
9
9
|
* (a same-origin iframe, a Document Picture-in-Picture window) focuses its
|
|
10
10
|
* first control on open, keeps Tab inside, closes on Escape through the layer
|
|
11
|
-
* stack with and without light dismiss,
|
|
12
|
-
*
|
|
11
|
+
* stack with and without light dismiss, hands focus back to its trigger after
|
|
12
|
+
* an outside click, and scrolls once its own window is too short for it or
|
|
13
|
+
* its content grows past it, exactly as the same Popover does in the page.
|
|
13
14
|
* @position The half of the second-document rule jsdom cannot honestly reach:
|
|
14
|
-
* real key delivery to another window, native light dismiss,
|
|
15
|
-
*
|
|
16
|
-
* model the same rule with an iframe.
|
|
15
|
+
* real key delivery to another window, native light dismiss, the browser's
|
|
16
|
+
* own close watcher, and layout in another window. The Vitest cases in
|
|
17
|
+
* `Popover/Popover.test.tsx` model the same rule with an iframe.
|
|
17
18
|
*
|
|
18
19
|
* SYNC: Fixture lives in
|
|
19
20
|
* /apps/storybook/stories/PopoverSecondDocumentA11y.stories.tsx.
|
|
@@ -54,6 +55,8 @@ type Where = 'page' | 'iframe' | 'Picture-in-Picture window';
|
|
|
54
55
|
interface Surface {
|
|
55
56
|
frame: Frame;
|
|
56
57
|
keyboard: Keyboard;
|
|
58
|
+
/** Give the document's own window this height, in CSS pixels. */
|
|
59
|
+
resize: (height: number) => Promise<void>;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/** Load the story and return the document the test drives. */
|
|
@@ -67,20 +70,39 @@ async function mountStory(page: Page, where: Where): Promise<Surface> {
|
|
|
67
70
|
await popOut.waitFor();
|
|
68
71
|
|
|
69
72
|
if (where === 'page') {
|
|
70
|
-
|
|
73
|
+
const viewport = page.viewportSize();
|
|
74
|
+
if (viewport == null) {
|
|
75
|
+
throw new Error('the page has no viewport size');
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
frame: page.mainFrame(),
|
|
79
|
+
keyboard: page.keyboard,
|
|
80
|
+
resize: async height => {
|
|
81
|
+
await page.setViewportSize({width: viewport.width, height});
|
|
82
|
+
},
|
|
83
|
+
};
|
|
71
84
|
}
|
|
72
85
|
if (where === 'iframe') {
|
|
73
86
|
const element = await page
|
|
74
87
|
.locator('iframe[title="Second document"]')
|
|
75
88
|
.elementHandle();
|
|
76
89
|
const frame = await element?.contentFrame();
|
|
77
|
-
if (frame == null) {
|
|
90
|
+
if (element == null || frame == null) {
|
|
78
91
|
throw new Error('the story renders no iframe');
|
|
79
92
|
}
|
|
80
93
|
await frame.getByRole('button', {name: 'Settings', exact: true}).waitFor();
|
|
81
94
|
// Key presses go to whichever frame holds focus; the clicks below put it
|
|
82
95
|
// in this one.
|
|
83
|
-
return {
|
|
96
|
+
return {
|
|
97
|
+
frame,
|
|
98
|
+
keyboard: page.keyboard,
|
|
99
|
+
// The frame's window is as tall as the iframe element.
|
|
100
|
+
resize: async height => {
|
|
101
|
+
await element.evaluate((iframe, to) => {
|
|
102
|
+
(iframe as HTMLElement).style.height = `${to}px`;
|
|
103
|
+
}, height);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
84
106
|
}
|
|
85
107
|
// Opening the window needs a user gesture; the click is one.
|
|
86
108
|
const [pictureInPicture] = await Promise.all([
|
|
@@ -90,9 +112,19 @@ async function mountStory(page: Page, where: Where): Promise<Surface> {
|
|
|
90
112
|
await pictureInPicture
|
|
91
113
|
.getByRole('button', {name: 'Settings', exact: true})
|
|
92
114
|
.waitFor();
|
|
115
|
+
const pictureInPictureViewport = pictureInPicture.viewportSize();
|
|
116
|
+
if (pictureInPictureViewport == null) {
|
|
117
|
+
throw new Error('the Picture-in-Picture window has no viewport size');
|
|
118
|
+
}
|
|
93
119
|
return {
|
|
94
120
|
frame: pictureInPicture.mainFrame(),
|
|
95
121
|
keyboard: pictureInPicture.keyboard,
|
|
122
|
+
resize: async height => {
|
|
123
|
+
await pictureInPicture.setViewportSize({
|
|
124
|
+
width: pictureInPictureViewport.width,
|
|
125
|
+
height,
|
|
126
|
+
});
|
|
127
|
+
},
|
|
96
128
|
};
|
|
97
129
|
}
|
|
98
130
|
|
|
@@ -181,6 +213,36 @@ for (const where of [
|
|
|
181
213
|
await expect(trigger).toBeFocused();
|
|
182
214
|
});
|
|
183
215
|
|
|
216
|
+
test('scrolls once its own window is too short for it, and stops once it fits', async ({
|
|
217
|
+
page,
|
|
218
|
+
}) => {
|
|
219
|
+
const {frame, resize} = await mountStory(page, where);
|
|
220
|
+
await resize(700);
|
|
221
|
+
await open(frame, 'Long list');
|
|
222
|
+
const surface = frame.getByRole('dialog', {name: 'Long list'});
|
|
223
|
+
await expect(surface).toHaveCSS('overflow-y', 'visible');
|
|
224
|
+
|
|
225
|
+
await resize(240);
|
|
226
|
+
await expect(surface).toHaveCSS('overflow-y', 'auto');
|
|
227
|
+
await resize(700);
|
|
228
|
+
await expect(surface).toHaveCSS('overflow-y', 'visible');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('scrolls once its content grows past its window', async ({page}) => {
|
|
232
|
+
const {frame, resize} = await mountStory(page, where);
|
|
233
|
+
await resize(700);
|
|
234
|
+
await open(frame, 'Long list');
|
|
235
|
+
const surface = frame.getByRole('dialog', {name: 'Long list'});
|
|
236
|
+
await expect(surface).toHaveCSS('overflow-y', 'visible');
|
|
237
|
+
|
|
238
|
+
// An inline style is an attribute change the popover's mutation
|
|
239
|
+
// observer ignores, so only its ResizeObserver can see the growth.
|
|
240
|
+
await surface.evaluate(element => {
|
|
241
|
+
(element.firstElementChild as HTMLElement).style.minHeight = '2000px';
|
|
242
|
+
});
|
|
243
|
+
await expect(surface).toHaveCSS('overflow-y', 'auto');
|
|
244
|
+
});
|
|
245
|
+
|
|
184
246
|
if (where !== 'page') {
|
|
185
247
|
test('an Escape press affects only the document it was made in', async ({
|
|
186
248
|
page,
|
|
@@ -459,13 +459,20 @@ function usePopoverImplementation(
|
|
|
459
459
|
}
|
|
460
460
|
}, [layer.isOpen, hasAutoFocus, focusInitialTarget]);
|
|
461
461
|
|
|
462
|
-
// Combined ref for trigger element (layer anchor + our ref)
|
|
462
|
+
// Combined ref for trigger element (layer anchor + our ref). It is keyed on
|
|
463
|
+
// the layer's own ref, not the whole layer: the layer object changes with
|
|
464
|
+
// every new onShow or onHide, and a trigger ref that changed with it made
|
|
465
|
+
// React detach and reattach the trigger on every render. It reads nothing
|
|
466
|
+
// else from the layer, and layer.ref (useLayer's contextRef) reads only refs
|
|
467
|
+
// and its anchor name and anchor-clearance option, so nothing in it goes
|
|
468
|
+
// stale.
|
|
469
|
+
const layerRef = layer.ref;
|
|
463
470
|
const triggerRef = useCallback(
|
|
464
471
|
(el: HTMLElement | null) => {
|
|
465
472
|
triggerElementRef.current = el;
|
|
466
|
-
|
|
473
|
+
layerRef(el);
|
|
467
474
|
},
|
|
468
|
-
[
|
|
475
|
+
[layerRef],
|
|
469
476
|
);
|
|
470
477
|
|
|
471
478
|
// Show function with optional focus preservation
|
|
@@ -476,6 +476,30 @@ describe('PowerSearch', () => {
|
|
|
476
476
|
});
|
|
477
477
|
});
|
|
478
478
|
|
|
479
|
+
it('announces Clear all in its own words, "All filters removed" (component:PowerSearch; Tokenizer AR7)', async () => {
|
|
480
|
+
const onChange = vi.fn();
|
|
481
|
+
render(
|
|
482
|
+
<PowerSearch
|
|
483
|
+
config={config}
|
|
484
|
+
filters={[
|
|
485
|
+
{
|
|
486
|
+
field: 'status',
|
|
487
|
+
operator: 'is',
|
|
488
|
+
value: {type: 'enum', value: 'open'},
|
|
489
|
+
},
|
|
490
|
+
]}
|
|
491
|
+
onChange={onChange}
|
|
492
|
+
/>,
|
|
493
|
+
);
|
|
494
|
+
fireEvent.click(screen.getByRole('button', {name: 'Clear all'}));
|
|
495
|
+
expect(onChange).toHaveBeenCalledWith([], 'remove', 0);
|
|
496
|
+
await waitFor(() => {
|
|
497
|
+
expect(politeRegion()).toHaveTextContent('All filters removed');
|
|
498
|
+
});
|
|
499
|
+
// Not the Tokenizer's own words.
|
|
500
|
+
expect(politeRegion()).not.toHaveTextContent('All items removed');
|
|
501
|
+
});
|
|
502
|
+
|
|
479
503
|
it('does not announce the result count present on mount under StrictMode, only a later change', async () => {
|
|
480
504
|
// StrictMode replays the mount effects: a mounted-flag guard is reset by
|
|
481
505
|
// the replay and speaks the initial count unprompted; comparing against
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
type TokenizerHandle,
|
|
31
31
|
type TokenizerOverflowBehavior,
|
|
32
32
|
} from '../Tokenizer';
|
|
33
|
+
import {TokenizerClearAllMessageContext} from '../Tokenizer/TokenizerClearAllMessageContext';
|
|
33
34
|
import {TypeaheadItem} from '../Typeahead/TypeaheadItem';
|
|
34
35
|
import {Token} from '../Token';
|
|
35
36
|
import {Avatar} from '../Avatar';
|
|
@@ -1062,6 +1063,12 @@ export function PowerSearch({
|
|
|
1062
1063
|
// replay (which resets a flag and would speak the count present on mount
|
|
1063
1064
|
// unprompted) announces nothing until the count changes.
|
|
1064
1065
|
const announce = useAnnounce();
|
|
1066
|
+
// PowerSearch words its Clear all as its record does; the field announces
|
|
1067
|
+
// these words instead of Tokenizer's (component:Tokenizer AR7).
|
|
1068
|
+
const clearAllMessage = useMemo(
|
|
1069
|
+
() => t('@astryx.powersearch.allFiltersRemoved'),
|
|
1070
|
+
[t],
|
|
1071
|
+
);
|
|
1065
1072
|
const announcedResultCountRef = useRef(resultCountText);
|
|
1066
1073
|
useEffect(() => {
|
|
1067
1074
|
if (resultCountText === announcedResultCountRef.current) {
|
|
@@ -1099,37 +1106,41 @@ export function PowerSearch({
|
|
|
1099
1106
|
popover.triggerRef as React.Ref<HTMLDivElement>,
|
|
1100
1107
|
)}
|
|
1101
1108
|
{...themeProps('power-search')}>
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1109
|
+
{/* The field's Clear all announces PowerSearch's own words
|
|
1110
|
+
(component:PowerSearch; component:Tokenizer AR7). */}
|
|
1111
|
+
<TokenizerClearAllMessageContext value={clearAllMessage}>
|
|
1112
|
+
<Tokenizer
|
|
1113
|
+
handleRef={tokenizerRef}
|
|
1114
|
+
label={label}
|
|
1115
|
+
isLabelHidden={isLabelHidden}
|
|
1116
|
+
searchSource={searchSource}
|
|
1117
|
+
value={tokenizerValue}
|
|
1118
|
+
onChange={handleTokenizerChange}
|
|
1119
|
+
renderToken={renderToken}
|
|
1120
|
+
renderItem={renderItem}
|
|
1121
|
+
maxMenuItems={MAX_BROWSE_MENU_ITEMS}
|
|
1122
|
+
menuWidth={menuWidth}
|
|
1123
|
+
placeholder={filters.length === 0 ? placeholder : ''}
|
|
1124
|
+
hasAutoFocus={hasAutoFocus}
|
|
1125
|
+
hasClear={hasClear && !isReadOnly}
|
|
1126
|
+
startIcon={startIcon}
|
|
1127
|
+
endContent={combinedEndContent}
|
|
1128
|
+
isDisabled={isDisabled}
|
|
1129
|
+
disabledMessage={disabledMessage}
|
|
1130
|
+
size={size}
|
|
1131
|
+
tokenOverflowBehavior={tokenOverflowBehavior}
|
|
1132
|
+
hasEntriesOnFocus
|
|
1133
|
+
debounceMs={0}
|
|
1134
|
+
status={status}
|
|
1135
|
+
statusVariant={statusVariant}
|
|
1136
|
+
onFocus={onFocus}
|
|
1137
|
+
onBlur={onBlur}
|
|
1138
|
+
containerXstyle={xstyle}
|
|
1139
|
+
containerClassName={className}
|
|
1140
|
+
containerStyle={style}
|
|
1141
|
+
data-testid={testId}
|
|
1142
|
+
/>
|
|
1143
|
+
</TokenizerClearAllMessageContext>
|
|
1133
1144
|
</div>
|
|
1134
1145
|
{popover.render(popoverContent, {
|
|
1135
1146
|
placement: 'below',
|
|
@@ -120,7 +120,7 @@ Consumer migration instructions belong in consumer docs and release notes.
|
|
|
120
120
|
| FR3 | Selecting an enabled option calls `onChange(value)` once; RadioList holds no selection of its own. | Current tests |
|
|
121
121
|
| FR4 | With an empty `value`, keyboard focus entering the group lands on the first radio that is not natively disabled (in a group disabled with a reason, that is its first `aria-disabled` radio, keeping the enabled focus order under `spec:AST-085` FR1), or stays on the last one when entering backward. Focus moving between radios inside the group is not redirected. With a selection, the selected radio is the Tab stop. Arrow keys follow the browser's native radio behavior, which stops on `aria-disabled` radios. | WAI-ARIA radio group pattern; current tests |
|
|
122
122
|
| FR5 | `isDisabled` MUST disable every item: each radio stays focusable with `aria-disabled="true"`, is detached from the form so it does not submit, and refuses selection (`spec:AST-085` FR1–FR3, FR7). With `disabledMessage`, a reason tooltip also opens on group hover and keyboard focus, and the reason MUST describe each focusable radio (`spec:AST-085` FR5, FR7). Implementation gap: the reason describes only the radiogroup, so a focused radio is not described by it; and without a `disabledMessage`, each radio gets native `disabled` instead, which removes it from the tab order, and a radio focused when the group becomes disabled loses focus (`spec:AST-085` FR4). | `spec:AST-085` FR1–FR5, FR7; current tests |
|
|
123
|
-
| FR6 | `status.type === 'error'` sets `aria-invalid` on the radiogroup. The radiogroup exposes the effective required state (including a form-level default) with `aria-required`, while each radio's native `required` follows only the explicit `isRequired
|
|
123
|
+
| FR6 | `status.type === 'error'` sets `aria-invalid` on the radiogroup. The radiogroup exposes the effective required state (including a form-level default) with `aria-required`, while each radio's native `required` follows only the explicit `isRequired`; a natively required radio's `aria-invalid` follows the same status, so the browser's own invalid state never shows before an error. | Current source and tests |
|
|
124
124
|
| FR7 | The radiogroup lays options in a column with a small gap, or a row with a wider gap when horizontal, and passes `size` to every item. | Current source and tests |
|
|
125
125
|
| FR8 | Base props (`ref`, `id`, `aria-*`, `data-*`, `hidden`, `inert`, `dir`, DOM handlers) reach the radiogroup; a caller `onFocus` runs after FR4's entry handling. `container*` reaches the Field box where one renders (in a `horizontal-labels` FormLayout none renders, and `container*` has no effect and warns), and `control*` the radiogroup; root `xstyle`, `className`, and `style` are not accepted. | `family:input-fields` FR10; current tests |
|
|
126
126
|
| FR9 | The radiogroup carries `astryx-radio-list` and reflects `data-orientation` and `data-size`. | `architecture:component-theming-surface`; current tests |
|
|
@@ -165,6 +165,34 @@ describe('RadioList', () => {
|
|
|
165
165
|
expect(screen.getByText(/Required/)).toBeInTheDocument();
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
+
it('keeps required radios valid until the group shows an error', () => {
|
|
169
|
+
const {rerender} = render(
|
|
170
|
+
<RadioList label="Preference" value="" onChange={() => {}} isRequired>
|
|
171
|
+
<RadioListItem label="Option A" value="a" />
|
|
172
|
+
<RadioListItem label="Option B" value="b" />
|
|
173
|
+
</RadioList>,
|
|
174
|
+
);
|
|
175
|
+
// Native required alone makes Chromium report every radio invalid.
|
|
176
|
+
for (const radio of screen.getAllByRole('radio')) {
|
|
177
|
+
expect(radio).toBeRequired();
|
|
178
|
+
expect(radio).toHaveAttribute('aria-invalid', 'false');
|
|
179
|
+
}
|
|
180
|
+
rerender(
|
|
181
|
+
<RadioList
|
|
182
|
+
label="Preference"
|
|
183
|
+
value=""
|
|
184
|
+
onChange={() => {}}
|
|
185
|
+
isRequired
|
|
186
|
+
status={{type: 'error', message: 'Pick one'}}>
|
|
187
|
+
<RadioListItem label="Option A" value="a" />
|
|
188
|
+
<RadioListItem label="Option B" value="b" />
|
|
189
|
+
</RadioList>,
|
|
190
|
+
);
|
|
191
|
+
for (const radio of screen.getAllByRole('radio')) {
|
|
192
|
+
expect(radio).toHaveAttribute('aria-invalid', 'true');
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
168
196
|
it('shows Optional indicator when isOptional is true', () => {
|
|
169
197
|
render(
|
|
170
198
|
<RadioList label="Preference" value="" onChange={() => {}} isOptional>
|
|
@@ -471,6 +499,62 @@ describe('RadioList', () => {
|
|
|
471
499
|
fireEvent.click(pro);
|
|
472
500
|
expect(onChange).not.toHaveBeenCalled();
|
|
473
501
|
});
|
|
502
|
+
|
|
503
|
+
it('does not run a caller onClick while focusable-disabled', () => {
|
|
504
|
+
const onClick = vi.fn();
|
|
505
|
+
render(
|
|
506
|
+
<RadioList
|
|
507
|
+
label="Plan"
|
|
508
|
+
value="free"
|
|
509
|
+
onChange={() => {}}
|
|
510
|
+
isDisabled
|
|
511
|
+
disabledMessage="Upgrade your account to change plans">
|
|
512
|
+
<RadioListItem label="Free" value="free" onClick={onClick} />
|
|
513
|
+
<RadioListItem label="Pro" value="pro" onClick={onClick} />
|
|
514
|
+
</RadioList>,
|
|
515
|
+
);
|
|
516
|
+
fireEvent.click(screen.getByRole('radio', {name: 'Pro', hidden: true}));
|
|
517
|
+
fireEvent.click(screen.getByRole('radio', {name: 'Free', hidden: true}));
|
|
518
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('does not run a caller onClick from the keyboard while focusable-disabled', async () => {
|
|
522
|
+
const user = userEvent.setup();
|
|
523
|
+
const onClick = vi.fn();
|
|
524
|
+
render(
|
|
525
|
+
<RadioList
|
|
526
|
+
label="Plan"
|
|
527
|
+
value="free"
|
|
528
|
+
onChange={() => {}}
|
|
529
|
+
isDisabled
|
|
530
|
+
disabledMessage="Upgrade your account to change plans">
|
|
531
|
+
<RadioListItem label="Free" value="free" onClick={onClick} />
|
|
532
|
+
<RadioListItem label="Pro" value="pro" onClick={onClick} />
|
|
533
|
+
</RadioList>,
|
|
534
|
+
);
|
|
535
|
+
await user.tab();
|
|
536
|
+
expect(
|
|
537
|
+
screen.getByRole('radio', {name: 'Free', hidden: true}),
|
|
538
|
+
).toHaveFocus();
|
|
539
|
+
// Space activates the focused radio.
|
|
540
|
+
await user.keyboard(' ');
|
|
541
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
542
|
+
// An arrow key moves onto the next radio, and the browser clicks it.
|
|
543
|
+
await user.keyboard('{ArrowDown}');
|
|
544
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it('still runs a caller onClick on an enabled radio', () => {
|
|
548
|
+
const onClick = vi.fn();
|
|
549
|
+
render(
|
|
550
|
+
<RadioList label="Plan" value="free" onChange={() => {}}>
|
|
551
|
+
<RadioListItem label="Free" value="free" />
|
|
552
|
+
<RadioListItem label="Pro" value="pro" onClick={onClick} />
|
|
553
|
+
</RadioList>,
|
|
554
|
+
);
|
|
555
|
+
fireEvent.click(screen.getByRole('radio', {name: 'Pro'}));
|
|
556
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
557
|
+
});
|
|
474
558
|
});
|
|
475
559
|
describe('form participation', () => {
|
|
476
560
|
it('submits the selected value under htmlName', () => {
|
|
@@ -326,6 +326,12 @@ export function RadioListItem({
|
|
|
326
326
|
// from submission, matching a natively disabled control.
|
|
327
327
|
form={keepsFocusableForMessage ? '' : undefined}
|
|
328
328
|
required={context.isRequired}
|
|
329
|
+
// Chromium reports an unanswered native-required radio invalid before
|
|
330
|
+
// any interaction; the invalid state follows the group's status
|
|
331
|
+
// instead (RadioList FR6).
|
|
332
|
+
aria-invalid={
|
|
333
|
+
context.isRequired ? context.status?.type === 'error' : undefined
|
|
334
|
+
}
|
|
329
335
|
onChange={() => {
|
|
330
336
|
if (isDisabled) {
|
|
331
337
|
return;
|
|
@@ -334,8 +340,11 @@ export function RadioListItem({
|
|
|
334
340
|
}}
|
|
335
341
|
// A consumer onClick rides on the radio input itself, so it fires for
|
|
336
342
|
// both direct control clicks and row-surface clicks the row delegates
|
|
337
|
-
// to the input — the same routing CheckboxListItem uses.
|
|
338
|
-
|
|
343
|
+
// to the input — the same routing CheckboxListItem uses. A disabled
|
|
344
|
+
// radio that stays focusable (`aria-disabled`, not native `disabled`)
|
|
345
|
+
// is not silenced by the browser, so drop the handler here
|
|
346
|
+
// (`spec:AST-085` FR2), as CheckboxInput does.
|
|
347
|
+
onClick={isDisabled ? undefined : onClick}
|
|
339
348
|
// The radio names itself from the visible label element, which works
|
|
340
349
|
// for a rich label as well as a plain string. `aria-label` replaces
|
|
341
350
|
// that name rather than adding to it, so the two are mutually
|