@astryxdesign/core 0.4.5 → 0.4.6-canary.cea9ecd
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/CHANGELOG.md +134 -0
- package/dist/Avatar/Avatar.d.ts +10 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +139 -30
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -1
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- package/dist/Avatar/AvatarStatusDot.js +30 -4
- package/dist/Avatar/AvatarStatusLabelContext.d.ts +39 -0
- package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -0
- package/dist/Avatar/AvatarStatusLabelContext.js +41 -0
- package/dist/AvatarGroup/AvatarGroup.d.ts +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +15 -9
- package/dist/Blockquote/Blockquote.d.ts +4 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +9 -10
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +21 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +47 -34
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +21 -12
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +8 -4
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +5 -5
- package/dist/Center/Center.d.ts +23 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +12 -6
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +3 -3
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +2 -2
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +2 -2
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts +1 -1
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -3
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -2
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +5 -5
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +4 -4
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +1 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -2
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +6 -6
- package/dist/DateInput/DateInput.d.ts +31 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +90 -22
- package/dist/DateInput/MonthScroller.d.ts +35 -0
- package/dist/DateInput/MonthScroller.d.ts.map +1 -0
- package/dist/DateInput/MonthScroller.js +658 -0
- package/dist/DateInput/MonthYearWheels.d.ts +24 -0
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -0
- package/dist/DateInput/MonthYearWheels.js +114 -0
- package/dist/DateInput/TouchDateField.d.ts +10 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -0
- package/dist/DateInput/TouchDateField.js +810 -0
- package/dist/DateInput/Wheel.d.ts +41 -0
- package/dist/DateInput/Wheel.d.ts.map +1 -0
- package/dist/DateInput/Wheel.js +315 -0
- package/dist/DateInput/monthGeometry.d.ts +65 -0
- package/dist/DateInput/monthGeometry.d.ts.map +1 -0
- package/dist/DateInput/monthGeometry.js +98 -0
- package/dist/DateInput/tokens.stylex.d.ts +63 -0
- package/dist/DateInput/tokens.stylex.d.ts.map +1 -0
- package/dist/DateInput/tokens.stylex.js +74 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +41 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -0
- package/dist/DateInput/useOwnScrollGesture.js +202 -0
- package/dist/DateInput/usePointerDragScroll.d.ts +15 -0
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -0
- package/dist/DateInput/usePointerDragScroll.js +216 -0
- package/dist/DateInput/useScrollSettle.d.ts +26 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -0
- package/dist/DateInput/useScrollSettle.js +149 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +17 -14
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +17 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +2 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +4 -4
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +6 -0
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +5 -5
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +6 -6
- package/dist/HoverCard/HoverCard.d.ts +13 -3
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +17 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +78 -9
- package/dist/InputGroup/InputGroup.js +1 -1
- package/dist/Item/Item.d.ts +9 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +52 -14
- package/dist/Layer/index.d.ts +4 -2
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +2 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +3 -2
- package/dist/Layer/useTouchTrigger.d.ts +113 -0
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -0
- package/dist/Layer/useTouchTrigger.js +241 -0
- package/dist/Layout/container.stylex.d.ts +4 -2
- package/dist/Layout/container.stylex.d.ts.map +1 -1
- package/dist/Layout/container.stylex.js +19 -11
- package/dist/Layout/index.d.ts +1 -0
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +4 -0
- package/dist/Layout/padding.stylex.d.ts +315 -12
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +389 -12
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +5 -4
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -6
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +1 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +24 -6
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +8 -8
- package/dist/NavItem/navItemStyles.stylex.d.ts +4 -4
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +4 -4
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +3 -3
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +36 -8
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +3 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +11 -12
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +11 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +23 -8
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +70 -40
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +7 -7
- package/dist/Section/Section.d.ts +36 -1
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +12 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -3
- package/dist/Selector/Selector.d.ts +26 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +93 -20
- package/dist/Selector/SelectorOption.d.ts +14 -1
- package/dist/Selector/SelectorOption.d.ts.map +1 -1
- package/dist/Selector/SelectorOption.js +6 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
- package/dist/Selector/SelectorRowLayoutContext.js +27 -0
- package/dist/Selector/types.d.ts +1 -0
- package/dist/Selector/types.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +4 -4
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -7
- package/dist/Stack/Stack.d.ts +23 -1
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +12 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +2 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +1 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +3 -3
- package/dist/Table/TableRow.js +4 -4
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -2
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +2 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +2 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +5 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +12 -9
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +3 -3
- package/dist/TextArea/TextArea.js +1 -1
- package/dist/TextInput/TextInput.js +1 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +3 -3
- package/dist/TimeInput/TimeInput.js +2 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +6 -4
- package/dist/Timestamp/formatInstant.d.ts +3 -2
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +8 -8
- package/dist/Timestamp/tooltipEntries.d.ts +2 -1
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +5 -3
- package/dist/Toast/Toast.d.ts +4 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +10 -7
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +6 -6
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +1 -1
- package/dist/Tooltip/Tooltip.d.ts +16 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +21 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +71 -13
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +4 -4
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +2 -2
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +2 -2
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -4
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -7
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -2
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +1 -1
- package/dist/astryx.css +124 -62
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
- package/dist/hooks/containerReveal.stylex.js +18 -18
- package/dist/hooks/scrollbarGutter.d.ts +28 -0
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
- package/dist/hooks/scrollbarGutter.js +103 -0
- package/dist/hooks/useAutoMediaMode.d.ts +31 -0
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -0
- package/dist/hooks/useAutoMediaMode.js +201 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +1 -1
- package/dist/hooks/useListFocus.d.ts +5 -2
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +12 -6
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +13 -1
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +2 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/useCollator.d.ts +12 -0
- package/dist/i18n/useCollator.d.ts.map +1 -0
- package/dist/i18n/useCollator.js +40 -0
- package/dist/i18n/useLocale.d.ts +3 -0
- package/dist/i18n/useLocale.d.ts.map +1 -0
- package/dist/i18n/useLocale.js +31 -0
- package/dist/theme/MediaTheme.d.ts +25 -5
- package/dist/theme/MediaTheme.d.ts.map +1 -1
- package/dist/theme/MediaTheme.js +31 -6
- package/dist/theme/defineTheme.d.ts +5 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +5 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +66 -5
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.d.ts +6 -0
- package/dist/theme/syntax/index.d.ts.map +1 -1
- package/dist/theme/syntax/index.js +7 -2
- package/dist/utils/dateParser.d.ts +4 -3
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +8 -8
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/plainDate.d.ts +5 -2
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +20 -4
- package/locales/en.json +28 -0
- package/locales/pseudo.json +21 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.doc.mjs +10 -6
- package/src/Avatar/Avatar.test.tsx +219 -1
- package/src/Avatar/Avatar.tsx +179 -37
- package/src/Avatar/AvatarStatusDot.tsx +30 -4
- package/src/Avatar/AvatarStatusLabelContext.ts +47 -0
- package/src/AvatarGroup/AvatarGroup.doc.mjs +10 -6
- package/src/AvatarGroup/AvatarGroup.test.tsx +62 -0
- package/src/AvatarGroup/AvatarGroup.tsx +3 -1
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +31 -8
- package/src/Banner/Banner.doc.mjs +2 -0
- package/src/Blockquote/Blockquote.doc.mjs +30 -7
- package/src/Blockquote/Blockquote.test.tsx +34 -3
- package/src/Blockquote/Blockquote.tsx +11 -9
- package/src/BottomSheet/BottomSheet.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.test.tsx +24 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +91 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +58 -3
- package/src/Breadcrumbs/BreadcrumbItem.tsx +36 -23
- package/src/Breadcrumbs/Breadcrumbs.doc.mjs +26 -2
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -0
- package/src/Button/Button.tsx +12 -9
- package/src/Calendar/Calendar.tsx +15 -9
- package/src/Calendar/hooks/useCalendarNavigation.ts +6 -4
- package/src/Calendar/styles.ts +8 -5
- package/src/Center/Center.doc.mjs +48 -0
- package/src/Center/Center.test.tsx +158 -0
- package/src/Center/Center.tsx +50 -9
- package/src/Chat/ChatComposer.tsx +11 -5
- package/src/Chat/ChatComposerDrawer.tsx +4 -1
- package/src/Chat/ChatToolCalls.tsx +13 -4
- package/src/Chat/{useChatDictation.test.ts → useChatDictation.test.tsx} +29 -14
- package/src/Chat/useChatDictation.ts +1 -1
- package/src/Chat/useSpeechRecognition.ts +5 -3
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.tsx +5 -2
- package/src/Citation/Citation.test.tsx +6 -1
- package/src/Citation/Citation.tsx +11 -5
- package/src/ClickableCard/ClickableCard.tsx +7 -4
- package/src/CodeBlock/CodeBlock.tsx +4 -1
- package/src/Collapsible/Collapsible.tsx +5 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +6 -3
- package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -0
- package/src/ComplexSelector/ComplexSelector.tsx +14 -7
- package/src/DateInput/DateInput.test.tsx +17 -1
- package/src/DateInput/DateInput.tsx +93 -21
- package/src/DateInput/DateInputTouch.test.tsx +2582 -0
- package/src/DateInput/MonthScroller.tsx +878 -0
- package/src/DateInput/MonthYearWheels.tsx +147 -0
- package/src/DateInput/TouchDateField.tsx +1223 -0
- package/src/DateInput/Wheel.tsx +473 -0
- package/src/DateInput/monthGeometry.ts +118 -0
- package/src/DateInput/tokens.stylex.ts +99 -0
- package/src/DateInput/useOwnScrollGesture.ts +227 -0
- package/src/DateInput/usePointerDragScroll.ts +220 -0
- package/src/DateInput/useScrollSettle.ts +164 -0
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +31 -13
- package/src/DateTimeInput/DateTimeInput.tsx +25 -9
- package/src/Dialog/Dialog.test.tsx +24 -0
- package/src/Dialog/Dialog.tsx +3 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -2
- package/src/Field/Field.doc.mjs +2 -0
- package/src/Field/FieldLabel.tsx +9 -3
- package/src/Field/InputClearButton.test.tsx +110 -3
- package/src/Field/InputClearButton.tsx +38 -0
- package/src/Field/inputStyles.stylex.ts +17 -13
- package/src/FileInput/FileInput.tsx +15 -8
- package/src/FormLayout/FormLayout.doc.mjs +1 -1
- package/src/HoverCard/HoverCard.doc.mjs +18 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -0
- package/src/HoverCard/HoverCard.tsx +22 -2
- package/src/HoverCard/index.ts +1 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +103 -7
- package/src/InputGroup/InputGroup.tsx +1 -1
- package/src/Item/Item.doc.mjs +1 -0
- package/src/Item/Item.test.tsx +50 -0
- package/src/Item/Item.tsx +54 -6
- package/src/Layer/index.ts +10 -0
- package/src/Layer/useLayer.tsx +13 -2
- package/src/Layer/useTouchTrigger.test.ts +70 -0
- package/src/Layer/useTouchTrigger.ts +366 -0
- package/src/Layout/Layout.doc.mjs +18 -0
- package/src/Layout/container.stylex.ts +11 -3
- package/src/Layout/index.ts +4 -0
- package/src/Layout/overlayPaddingReset.test.tsx +222 -0
- package/src/Layout/padding.stylex.ts +192 -12
- package/src/Lightbox/Lightbox.tsx +11 -3
- package/src/Link/Link.tsx +9 -6
- package/src/MetadataList/MetadataList.tsx +4 -1
- package/src/MobileNav/MobileNav.tsx +61 -5
- package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
- package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
- package/src/MultiSelector/MultiSelector.test.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +26 -10
- package/src/NavItem/navItemStyles.stylex.ts +7 -4
- package/src/NavMenu/NavHeadingMenuItem.tsx +6 -3
- package/src/NumberInput/NumberInput.doc.mjs +24 -0
- package/src/NumberInput/NumberInput.test.tsx +138 -0
- package/src/NumberInput/NumberInput.tsx +47 -8
- package/src/Outline/Outline.tsx +5 -2
- package/src/Pagination/Pagination.tsx +5 -2
- package/src/Popover/Popover.test.tsx +27 -1
- package/src/PowerSearch/PowerSearch.tsx +17 -8
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.test.ts +22 -2
- package/src/PowerSearch/formatFilterValue.ts +31 -6
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/RadioList/RadioList.test.tsx +170 -2
- package/src/RadioList/RadioListItem.tsx +88 -53
- package/src/Resizable/ResizeHandle.test.tsx +22 -0
- package/src/Resizable/ResizeHandle.tsx +25 -7
- package/src/Section/Section.doc.mjs +55 -0
- package/src/Section/Section.test.tsx +201 -4
- package/src/Section/Section.tsx +69 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +31 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +15 -3
- package/src/SelectableCard/SelectableCard.tsx +6 -3
- package/src/Selector/Selector.doc.mjs +16 -2
- package/src/Selector/Selector.test.tsx +525 -1
- package/src/Selector/Selector.tsx +180 -25
- package/src/Selector/SelectorOption.doc.mjs +7 -0
- package/src/Selector/SelectorOption.tsx +21 -0
- package/src/Selector/SelectorRowLayoutContext.ts +32 -0
- package/src/Selector/types.ts +4 -4
- package/src/SideNav/SideNavHeading.tsx +14 -5
- package/src/SideNav/SideNavItem.tsx +9 -3
- package/src/Slider/Slider.tsx +25 -6
- package/src/Stack/Stack.doc.mjs +72 -0
- package/src/Stack/Stack.test.tsx +156 -0
- package/src/Stack/Stack.tsx +50 -8
- package/src/Switch/Switch.tsx +5 -2
- package/src/TabList/Tab.tsx +4 -1
- package/src/TabList/TabMenu.tsx +9 -3
- package/src/Table/TableRow.tsx +4 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +6 -2
- package/src/Table/plugins/filtering/useTableFiltering.tsx +4 -1
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +10 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +6 -3
- package/src/Table/plugins/sortable/useTableSortable.tsx +4 -1
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +34 -0
- package/src/Table/plugins/sortable/useTableSortableState.tsx +26 -23
- package/src/Table/plugins/tree/useTableTreeData.tsx +10 -4
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.tsx +1 -1
- package/src/TextInput/TextInput.tsx +1 -1
- package/src/Thumbnail/Thumbnail.tsx +9 -3
- package/src/TimeInput/TimeInput.tsx +1 -1
- package/src/Timestamp/Timestamp.test.tsx +27 -7
- package/src/Timestamp/Timestamp.tsx +8 -4
- package/src/Timestamp/formatInstant.ts +9 -7
- package/src/Timestamp/tooltipEntries.test.ts +11 -6
- package/src/Timestamp/tooltipEntries.ts +6 -2
- package/src/Toast/Toast.tsx +9 -7
- package/src/Token/Token.tsx +14 -5
- package/src/Tokenizer/Tokenizer.tsx +4 -1
- package/src/Tooltip/Tooltip.doc.mjs +18 -0
- package/src/Tooltip/Tooltip.test.tsx +254 -1
- package/src/Tooltip/Tooltip.tsx +22 -2
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/useTooltip.doc.mjs +2 -0
- package/src/Tooltip/useTooltip.tsx +99 -21
- package/src/TopNav/TopNavHeading.tsx +13 -4
- package/src/TopNav/TopNavItem.tsx +6 -3
- package/src/TopNav/TopNavMegaMenu.tsx +5 -2
- package/src/TopNav/TopNavMegaMenuItem.tsx +5 -2
- package/src/TopNav/TopNavMenu.tsx +10 -4
- package/src/TreeList/TreeListItem.tsx +22 -7
- package/src/Typeahead/BaseTypeahead.tsx +5 -2
- package/src/Typeahead/Typeahead.tsx +4 -1
- package/src/hooks/containerReveal.stylex.ts +54 -18
- package/src/hooks/scrollbarGutter.test.ts +167 -0
- package/src/hooks/scrollbarGutter.ts +121 -0
- package/src/hooks/useAutoMediaMode.test.ts +109 -0
- package/src/hooks/useAutoMediaMode.ts +233 -0
- package/src/hooks/useInputStatusIcon.tsx +4 -1
- package/src/hooks/useListFocus.doc.mjs +2 -2
- package/src/hooks/useListFocus.test.tsx +65 -3
- package/src/hooks/useListFocus.ts +15 -7
- package/src/hooks/useScrollLock.doc.mjs +4 -4
- package/src/hooks/useScrollLock.test.ts +73 -0
- package/src/hooks/useScrollLock.ts +14 -0
- package/src/i18n/InternationalizationContext.ts +2 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +37 -1
- package/src/i18n/__tests__/useCollator.test.tsx +115 -0
- package/src/i18n/__tests__/useLocale.test.tsx +52 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useCollator.doc.mjs +84 -0
- package/src/i18n/useCollator.ts +44 -0
- package/src/i18n/useLocale.doc.mjs +70 -0
- package/src/i18n/useLocale.ts +34 -0
- package/src/i18n/useTranslator.doc.mjs +1 -1
- package/src/reset.css +9 -2
- package/src/reset.test.ts +22 -0
- package/src/theme/MediaTheme.doc.mjs +23 -4
- package/src/theme/MediaTheme.dom.test.tsx +97 -0
- package/src/theme/MediaTheme.tsx +42 -7
- package/src/theme/defineTheme.test.ts +9 -3
- package/src/theme/defineTheme.ts +5 -0
- package/src/theme/derivedVarRegistry.test.ts +19 -5
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +118 -0
- package/src/theme/generateThemeRules.ts +83 -5
- package/src/theme/index.ts +1 -1
- package/src/theme/syntax/index.ts +6 -2
- package/src/theme/syntax/serverSafeSyntax.test.ts +68 -0
- package/src/utils/dateParser.test.ts +20 -0
- package/src/utils/dateParser.ts +14 -7
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +6 -0
- package/src/utils/plainDate.ts +21 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file MobileNavScrollbarGutter.test.tsx
|
|
5
|
+
* @input Uses vitest, @testing-library/react, MobileNav, a stubbed viewport
|
|
6
|
+
* @output Unit tests for the scrollbar gutter MobileNav reserves while open
|
|
7
|
+
* @position Testing; guards MobileNav.tsx against the open-drawer page shift
|
|
8
|
+
*
|
|
9
|
+
* MobileNav clips the document to lock background scroll, which hides a
|
|
10
|
+
* classic scrollbar and widens the layout viewport by its width — the page
|
|
11
|
+
* behind the drawer jumps sideways. The clip has to be paired with holding
|
|
12
|
+
* that gutter open.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When MobileNav.tsx changes, update tests to match new behavior
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {describe, it, expect, beforeAll, afterEach} from 'vitest';
|
|
18
|
+
import {render, cleanup} from '@testing-library/react';
|
|
19
|
+
import {MobileNav} from './MobileNav';
|
|
20
|
+
|
|
21
|
+
beforeAll(() => {
|
|
22
|
+
// jsdom doesn't implement showModal/close on <dialog>
|
|
23
|
+
HTMLDialogElement.prototype.showModal =
|
|
24
|
+
HTMLDialogElement.prototype.showModal ||
|
|
25
|
+
function (this: HTMLDialogElement) {
|
|
26
|
+
this.setAttribute('open', '');
|
|
27
|
+
};
|
|
28
|
+
HTMLDialogElement.prototype.close =
|
|
29
|
+
HTMLDialogElement.prototype.close ||
|
|
30
|
+
function (this: HTMLDialogElement) {
|
|
31
|
+
this.removeAttribute('open');
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/** jsdom does no layout, so both halves of the measurement are stubbed. */
|
|
36
|
+
function stubViewport(innerWidth: number, clientWidth: number) {
|
|
37
|
+
Object.defineProperty(window, 'innerWidth', {
|
|
38
|
+
value: innerWidth,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(document.documentElement, 'clientWidth', {
|
|
43
|
+
value: clientWidth,
|
|
44
|
+
configurable: true,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const rootGutter = () => document.documentElement.style.scrollbarGutter;
|
|
49
|
+
|
|
50
|
+
describe('MobileNav scrollbar gutter', () => {
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
cleanup();
|
|
53
|
+
document.documentElement.style.cssText = '';
|
|
54
|
+
// @ts-expect-error -- drop the viewport stub so jsdom's own value comes back
|
|
55
|
+
delete document.documentElement.clientWidth;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('holds the gutter open while the drawer is open', () => {
|
|
59
|
+
stubViewport(1024, 1009);
|
|
60
|
+
|
|
61
|
+
const view = render(
|
|
62
|
+
<MobileNav isOpen={true} onOpenChange={() => {}}>
|
|
63
|
+
<span>Nav content</span>
|
|
64
|
+
</MobileNav>,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(document.documentElement.style.overflow).toBe('clip');
|
|
68
|
+
expect(rootGutter()).toBe('stable');
|
|
69
|
+
|
|
70
|
+
view.unmount();
|
|
71
|
+
|
|
72
|
+
expect(document.documentElement.style.overflow).toBe('');
|
|
73
|
+
expect(rootGutter()).toBe('');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('gives the gutter back when the drawer closes', () => {
|
|
77
|
+
stubViewport(1024, 1009);
|
|
78
|
+
|
|
79
|
+
const view = render(
|
|
80
|
+
<MobileNav isOpen={true} onOpenChange={() => {}}>
|
|
81
|
+
<span>Nav content</span>
|
|
82
|
+
</MobileNav>,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
expect(rootGutter()).toBe('stable');
|
|
86
|
+
|
|
87
|
+
view.rerender(
|
|
88
|
+
<MobileNav isOpen={false} onOpenChange={() => {}}>
|
|
89
|
+
<span>Nav content</span>
|
|
90
|
+
</MobileNav>,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
expect(rootGutter()).toBe('');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('holds nothing when the scrollbar is an overlay one', () => {
|
|
97
|
+
stubViewport(1024, 1024);
|
|
98
|
+
|
|
99
|
+
render(
|
|
100
|
+
<MobileNav isOpen={true} onOpenChange={() => {}}>
|
|
101
|
+
<span>Nav content</span>
|
|
102
|
+
</MobileNav>,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
expect(document.documentElement.style.overflow).toBe('clip');
|
|
106
|
+
expect(rootGutter()).toBe('');
|
|
107
|
+
expect(document.documentElement.style.paddingRight).toBe('');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -1790,7 +1790,7 @@ describe('MultiSelector clear icon theme target', () => {
|
|
|
1790
1790
|
expect(css).toContain('.astryx-multi-selector-clear-icon {');
|
|
1791
1791
|
expect(css).toContain('width: 12px');
|
|
1792
1792
|
expect(css).toContain('height: 12px');
|
|
1793
|
-
expect(css).toContain('.astryx-multi-selector-clear-icon:hover
|
|
1793
|
+
expect(css).toContain('.astryx-multi-selector-clear-icon:hover');
|
|
1794
1794
|
expect(css).toContain('color: var(--color-icon-primary)');
|
|
1795
1795
|
});
|
|
1796
1796
|
});
|
|
@@ -103,7 +103,10 @@ const styles = stylex.create({
|
|
|
103
103
|
fontSize: typeScaleVars['--text-label-size'],
|
|
104
104
|
lineHeight: typeScaleVars['--text-label-leading'],
|
|
105
105
|
color: colorVars['--color-text-primary'],
|
|
106
|
-
cursor:
|
|
106
|
+
cursor: {
|
|
107
|
+
default: 'pointer',
|
|
108
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
109
|
+
},
|
|
107
110
|
},
|
|
108
111
|
// Trigger button — the actual combobox button, visually integrated with the container
|
|
109
112
|
trigger: {
|
|
@@ -124,7 +127,10 @@ const styles = stylex.create({
|
|
|
124
127
|
fontSize: 'inherit',
|
|
125
128
|
lineHeight: 'inherit',
|
|
126
129
|
color: 'inherit',
|
|
127
|
-
cursor:
|
|
130
|
+
cursor: {
|
|
131
|
+
default: 'pointer',
|
|
132
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
133
|
+
},
|
|
128
134
|
// The wrapper (inputWrapperStyles.base) renders the focus ring via
|
|
129
135
|
// :focus-within when this button is focused, matching
|
|
130
136
|
// TextInput/NumberInput/Selector. The button must not draw its own
|
|
@@ -190,16 +196,17 @@ const styles = stylex.create({
|
|
|
190
196
|
backgroundColor: 'transparent',
|
|
191
197
|
backgroundImage: {
|
|
192
198
|
default: null,
|
|
193
|
-
':hover': {
|
|
199
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
194
200
|
'@media (hover: hover)': `linear-gradient(${colorVars['--color-overlay-hover']}, ${colorVars['--color-overlay-hover']})`,
|
|
195
201
|
},
|
|
196
202
|
':active': `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
|
|
197
203
|
},
|
|
198
204
|
boxShadow: {
|
|
199
205
|
default: 'none',
|
|
200
|
-
':hover:not(:focus-within)':
|
|
201
|
-
|
|
202
|
-
|
|
206
|
+
':hover:not(:focus-within):where(:not(:disabled,[aria-disabled="true"]))':
|
|
207
|
+
{
|
|
208
|
+
'@media (hover: hover)': 'none',
|
|
209
|
+
},
|
|
203
210
|
':focus-within': 'none',
|
|
204
211
|
},
|
|
205
212
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
@@ -229,7 +236,10 @@ const styles = stylex.create({
|
|
|
229
236
|
borderStyle: 'none',
|
|
230
237
|
backgroundColor: 'transparent',
|
|
231
238
|
color: 'inherit',
|
|
232
|
-
cursor:
|
|
239
|
+
cursor: {
|
|
240
|
+
default: 'pointer',
|
|
241
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
242
|
+
},
|
|
233
243
|
borderRadius: radiusVars['--radius-element'],
|
|
234
244
|
},
|
|
235
245
|
|
|
@@ -251,7 +261,10 @@ const styles = stylex.create({
|
|
|
251
261
|
display: 'flex',
|
|
252
262
|
alignItems: 'center',
|
|
253
263
|
gap: spacingVars['--spacing-2'],
|
|
254
|
-
cursor:
|
|
264
|
+
cursor: {
|
|
265
|
+
default: 'pointer',
|
|
266
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
267
|
+
},
|
|
255
268
|
},
|
|
256
269
|
|
|
257
270
|
// Section heading. Plain secondary text, no rules — the same treatment
|
|
@@ -282,7 +295,10 @@ const styles = stylex.create({
|
|
|
282
295
|
gap: spacingVars['--spacing-2'],
|
|
283
296
|
width: '100%',
|
|
284
297
|
borderRadius: radiusVars['--radius-element'],
|
|
285
|
-
cursor:
|
|
298
|
+
cursor: {
|
|
299
|
+
default: 'pointer',
|
|
300
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
301
|
+
},
|
|
286
302
|
// Row typography lives here, not on the label span, so a theme override on
|
|
287
303
|
// the row target reaches both the fallback label and renderOption output
|
|
288
304
|
// (a declaration on the span would win over the inherited row value).
|
|
@@ -301,7 +317,7 @@ const styles = stylex.create({
|
|
|
301
317
|
itemDisabled: {
|
|
302
318
|
opacity: 0.5,
|
|
303
319
|
color: colorVars['--color-text-disabled'],
|
|
304
|
-
cursor: '
|
|
320
|
+
cursor: 'default',
|
|
305
321
|
},
|
|
306
322
|
|
|
307
323
|
// Decorative checkbox (non-interactive, purely visual)
|
|
@@ -65,14 +65,17 @@ export const navItemStyles = stylex.create({
|
|
|
65
65
|
backgroundColor: 'transparent',
|
|
66
66
|
color: colorVars['--color-text-primary'],
|
|
67
67
|
textDecoration: 'none',
|
|
68
|
-
cursor:
|
|
68
|
+
cursor: {
|
|
69
|
+
default: 'pointer',
|
|
70
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
71
|
+
},
|
|
69
72
|
fontFamily: 'inherit',
|
|
70
73
|
fontSize: typeScaleVars['--text-label-size'],
|
|
71
74
|
fontWeight: fontWeightVars['--font-weight-normal'],
|
|
72
75
|
lineHeight: typeScaleVars['--text-label-leading'],
|
|
73
76
|
textAlign: 'start',
|
|
74
77
|
boxSizing: 'border-box',
|
|
75
|
-
':hover': {
|
|
78
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
76
79
|
'@media (hover: hover)': {
|
|
77
80
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
78
81
|
},
|
|
@@ -98,7 +101,7 @@ export const navItemStyles = stylex.create({
|
|
|
98
101
|
'@media (forced-colors: active)': 'HighlightText',
|
|
99
102
|
},
|
|
100
103
|
fontWeight: fontWeightVars['--font-weight-medium'],
|
|
101
|
-
':hover': {
|
|
104
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
102
105
|
'@media (hover: hover)': {
|
|
103
106
|
backgroundColor: {
|
|
104
107
|
default: colorVars['--color-neutral'],
|
|
@@ -120,7 +123,7 @@ export const navItemStyles = stylex.create({
|
|
|
120
123
|
/** Disabled state — muted color, no interaction */
|
|
121
124
|
disabled: {
|
|
122
125
|
color: colorVars['--color-text-disabled'],
|
|
123
|
-
cursor: '
|
|
126
|
+
cursor: 'default',
|
|
124
127
|
pointerEvents: 'none' as const,
|
|
125
128
|
},
|
|
126
129
|
|
|
@@ -43,12 +43,15 @@ const styles = stylex.create({
|
|
|
43
43
|
backgroundColor: {
|
|
44
44
|
default: 'transparent',
|
|
45
45
|
':focus': colorVars['--color-overlay-hover'],
|
|
46
|
-
':hover': {
|
|
46
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
47
47
|
'@media (hover: hover)': colorVars['--color-overlay-hover'],
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
border: 'none',
|
|
51
|
-
cursor:
|
|
51
|
+
cursor: {
|
|
52
|
+
default: 'pointer',
|
|
53
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
54
|
+
},
|
|
52
55
|
textAlign: 'start',
|
|
53
56
|
outline: 'none',
|
|
54
57
|
textDecoration: 'none',
|
|
@@ -61,7 +64,7 @@ const styles = stylex.create({
|
|
|
61
64
|
},
|
|
62
65
|
disabled: {
|
|
63
66
|
opacity: 0.5,
|
|
64
|
-
cursor: '
|
|
67
|
+
cursor: 'default',
|
|
65
68
|
},
|
|
66
69
|
});
|
|
67
70
|
|
|
@@ -219,6 +219,19 @@ export const docs = {
|
|
|
219
219
|
states: ['disabled', 'readonly'],
|
|
220
220
|
},
|
|
221
221
|
],
|
|
222
|
+
derived: [
|
|
223
|
+
// `padding` in any spelling — the shorthand, `paddingBlock`, or a lone
|
|
224
|
+
// `paddingBlockStart` — is parsed by the shared container expansion and
|
|
225
|
+
// emitted as normalized per-side `--astryx-number-input-padding-*`
|
|
226
|
+
// tokens. The wrapper and the number-stepper column both read those, so
|
|
227
|
+
// the column stays flush with the field edges under a themed padding.
|
|
228
|
+
{property: 'padding', expand: 'container'},
|
|
229
|
+
// Scoped to this component's own subtree: the stepper column's outer
|
|
230
|
+
// corners follow the field radius, so a themed `number-input`
|
|
231
|
+
// borderRadius has to reach the var the column reads, not just the
|
|
232
|
+
// wrapper's own `border-radius`.
|
|
233
|
+
{property: 'borderRadius', vars: ['--_field-radius']},
|
|
234
|
+
],
|
|
222
235
|
},
|
|
223
236
|
usage: {
|
|
224
237
|
description:
|
|
@@ -475,6 +488,17 @@ export const docsZh = {
|
|
|
475
488
|
states: ['disabled', 'readonly'],
|
|
476
489
|
},
|
|
477
490
|
],
|
|
491
|
+
derived: [
|
|
492
|
+
// 任何写法的 `padding`(简写、`paddingBlock`,或单独的
|
|
493
|
+
// `paddingBlockStart`)都由共享的 container 展开解析,并输出为规范化的
|
|
494
|
+
// 每侧 `--astryx-number-input-padding-*` 令牌。容器与数字步进器列都读取
|
|
495
|
+
// 这些令牌,因此在主题化内边距下步进器仍与字段边缘齐平。
|
|
496
|
+
{property: 'padding', expand: 'container'},
|
|
497
|
+
// 作用域限于该组件自身的子树:步进器列的外角跟随字段圆角,因此主题化的
|
|
498
|
+
// `number-input` borderRadius 必须传到步进器读取的变量,而不只是容器
|
|
499
|
+
// 自身的 `border-radius`。
|
|
500
|
+
{property: 'borderRadius', vars: ['--_field-radius']},
|
|
501
|
+
],
|
|
478
502
|
},
|
|
479
503
|
usage: {
|
|
480
504
|
description:
|
|
@@ -15,6 +15,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
15
15
|
import {TestIcon} from '../__tests__/TestIcon';
|
|
16
16
|
import {InputGroup} from '../InputGroup';
|
|
17
17
|
import {NumberInput} from './NumberInput';
|
|
18
|
+
import {defineTheme} from '../theme/defineTheme';
|
|
19
|
+
import {generateThemeCSS} from '../theme/generateThemeRules';
|
|
18
20
|
import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
|
|
19
21
|
|
|
20
22
|
// FieldStatus announces status messages through the persistent useAnnounce
|
|
@@ -1745,3 +1747,139 @@ describe('NumberInput readonly theme state', () => {
|
|
|
1745
1747
|
expect(root).not.toHaveAttribute('data-readonly');
|
|
1746
1748
|
});
|
|
1747
1749
|
});
|
|
1750
|
+
|
|
1751
|
+
describe('NumberInput stepper padding coupling', () => {
|
|
1752
|
+
function generateThemeTestCSS(theme: Parameters<typeof generateThemeCSS>[0]) {
|
|
1753
|
+
const {prose, component} = generateThemeCSS(theme);
|
|
1754
|
+
return [prose, component].filter(Boolean).join('\n\n');
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
// The chains the wrapper and the stepper column both read. Spelled out here
|
|
1758
|
+
// rather than imported so the test pins the actual token names a theme sets:
|
|
1759
|
+
// if the chain is renamed or a level is dropped, this fails.
|
|
1760
|
+
const BLOCK_START =
|
|
1761
|
+
'var(--astryx-number-input-padding-block-start, var(--astryx-number-input-padding, var(--spacing-1)))';
|
|
1762
|
+
const BLOCK_END =
|
|
1763
|
+
'var(--astryx-number-input-padding-block-end, var(--astryx-number-input-padding, var(--spacing-1)))';
|
|
1764
|
+
|
|
1765
|
+
// jsdom re-serializes a var() chain without the spaces after its commas.
|
|
1766
|
+
const noSpace = (value: string) => value.replace(/\s+/g, '');
|
|
1767
|
+
|
|
1768
|
+
it('reads its padding from the public number-input padding tokens', () => {
|
|
1769
|
+
const {container} = render(
|
|
1770
|
+
<NumberInput
|
|
1771
|
+
label="Quantity"
|
|
1772
|
+
value={5}
|
|
1773
|
+
onChange={() => {}}
|
|
1774
|
+
hasNumberSteppers
|
|
1775
|
+
/>,
|
|
1776
|
+
);
|
|
1777
|
+
const root = container.querySelector('.astryx-number-input') as HTMLElement;
|
|
1778
|
+
// Read as physical properties: StyleX compiles the block-axis logical
|
|
1779
|
+
// properties to `padding-top`/`padding-bottom` (identical in every
|
|
1780
|
+
// horizontal writing mode). Per side, not through the shared field base's
|
|
1781
|
+
// `paddingBlock` shorthand, so each edge can be cancelled on its own.
|
|
1782
|
+
const wrapper = getComputedStyle(root);
|
|
1783
|
+
expect(noSpace(wrapper.paddingTop)).toBe(noSpace(BLOCK_START));
|
|
1784
|
+
expect(noSpace(wrapper.paddingBottom)).toBe(noSpace(BLOCK_END));
|
|
1785
|
+
|
|
1786
|
+
// The column cancels the wrapper's block padding by reading the same
|
|
1787
|
+
// tokens — not a hardcoded default — so it stays flush when a theme
|
|
1788
|
+
// changes the padding. The column is the stepper buttons' direct parent.
|
|
1789
|
+
const steppers = container.querySelector(
|
|
1790
|
+
'button[aria-label="Increment Quantity"]',
|
|
1791
|
+
)?.parentElement as HTMLElement;
|
|
1792
|
+
const column = getComputedStyle(steppers);
|
|
1793
|
+
expect(noSpace(column.marginTop)).toBe(
|
|
1794
|
+
noSpace(`calc(-1 * ${BLOCK_START})`),
|
|
1795
|
+
);
|
|
1796
|
+
expect(noSpace(column.marginBottom)).toBe(
|
|
1797
|
+
noSpace(`calc(-1 * ${BLOCK_END})`),
|
|
1798
|
+
);
|
|
1799
|
+
});
|
|
1800
|
+
|
|
1801
|
+
// jsdom cannot resolve the @layer cascade, so the generated CSS is the
|
|
1802
|
+
// proof. Each case is a spelling of the SAME declaration: the column has to
|
|
1803
|
+
// track all of them, not just the one the component happened to name.
|
|
1804
|
+
describe('a themed padding reaches the steppers in every spelling', () => {
|
|
1805
|
+
it.each([
|
|
1806
|
+
[
|
|
1807
|
+
'the padding shorthand, two values',
|
|
1808
|
+
{padding: '14px 20px'},
|
|
1809
|
+
[
|
|
1810
|
+
'--astryx-number-input-padding-block-start: 14px',
|
|
1811
|
+
'--astryx-number-input-padding-block-end: 14px',
|
|
1812
|
+
'--astryx-number-input-padding-inline: 20px',
|
|
1813
|
+
],
|
|
1814
|
+
],
|
|
1815
|
+
[
|
|
1816
|
+
'the padding shorthand, one value',
|
|
1817
|
+
{padding: '10px'},
|
|
1818
|
+
['--astryx-number-input-padding: 10px'],
|
|
1819
|
+
],
|
|
1820
|
+
[
|
|
1821
|
+
'the block/inline longhands',
|
|
1822
|
+
{paddingBlock: '10px', paddingInline: '20px'},
|
|
1823
|
+
[
|
|
1824
|
+
'--astryx-number-input-padding-block-start: 10px',
|
|
1825
|
+
'--astryx-number-input-padding-block-end: 10px',
|
|
1826
|
+
'--astryx-number-input-padding-inline: 20px',
|
|
1827
|
+
],
|
|
1828
|
+
],
|
|
1829
|
+
[
|
|
1830
|
+
'a single edge longhand',
|
|
1831
|
+
{paddingBlockStart: '12px'},
|
|
1832
|
+
['--astryx-number-input-padding-block-start: 12px'],
|
|
1833
|
+
],
|
|
1834
|
+
[
|
|
1835
|
+
// A single var carrying "4px 12px" would make the column's
|
|
1836
|
+
// calc(-1 * …) invalid and drop the margin outright; the expansion
|
|
1837
|
+
// splits the two values into their own edges instead.
|
|
1838
|
+
'an asymmetric block padding',
|
|
1839
|
+
{paddingBlock: '4px 12px'},
|
|
1840
|
+
[
|
|
1841
|
+
'--astryx-number-input-padding-block-start: 4px',
|
|
1842
|
+
'--astryx-number-input-padding-block-end: 12px',
|
|
1843
|
+
],
|
|
1844
|
+
],
|
|
1845
|
+
[
|
|
1846
|
+
// `paddingTop` is `paddingBlockStart` in every horizontal writing
|
|
1847
|
+
// mode, so it normalizes onto the same tokens. The physical inline
|
|
1848
|
+
// pair is deliberately not mapped — see generateThemeRules.
|
|
1849
|
+
'the physical block longhands',
|
|
1850
|
+
{paddingTop: '14px', paddingBottom: '6px'},
|
|
1851
|
+
[
|
|
1852
|
+
'--astryx-number-input-padding-block-start: 14px',
|
|
1853
|
+
'--astryx-number-input-padding-block-end: 6px',
|
|
1854
|
+
],
|
|
1855
|
+
],
|
|
1856
|
+
])('%s', (_label, base, expected) => {
|
|
1857
|
+
const theme = defineTheme({
|
|
1858
|
+
name: 'number-input-padding-spelling-test',
|
|
1859
|
+
components: {'number-input': {base}},
|
|
1860
|
+
});
|
|
1861
|
+
const css = generateThemeTestCSS(theme);
|
|
1862
|
+
for (const declaration of expected) {
|
|
1863
|
+
expect(css).toContain(declaration);
|
|
1864
|
+
}
|
|
1865
|
+
// The expansion consumes the padding: a raw declaration left on the
|
|
1866
|
+
// wrapper is padding the column cannot see, which is the gap itself.
|
|
1867
|
+
expect(css).not.toMatch(
|
|
1868
|
+
/^\s*padding(-block|-inline|-top|-bottom)?(-start|-end)?:/m,
|
|
1869
|
+
);
|
|
1870
|
+
});
|
|
1871
|
+
});
|
|
1872
|
+
|
|
1873
|
+
it('carries a themed border radius to the stepper column corners', () => {
|
|
1874
|
+
// The column's outer corners read --_field-radius. Emitting only
|
|
1875
|
+
// `border-radius` on the wrapper rounds the field and leaves the steppers
|
|
1876
|
+
// at the default radius, which is visible wherever the two differ.
|
|
1877
|
+
const theme = defineTheme({
|
|
1878
|
+
name: 'number-input-radius-test',
|
|
1879
|
+
components: {'number-input': {base: {borderRadius: '2px'}}},
|
|
1880
|
+
});
|
|
1881
|
+
const css = generateThemeTestCSS(theme);
|
|
1882
|
+
expect(css).toContain('--_field-radius: 2px');
|
|
1883
|
+
expect(css).toContain('border-radius: 2px');
|
|
1884
|
+
});
|
|
1885
|
+
});
|
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
colorVars,
|
|
32
32
|
sizeVars,
|
|
33
33
|
spacingVars,
|
|
34
|
-
radiusVars,
|
|
35
34
|
typographyVars,
|
|
36
35
|
typeScaleVars,
|
|
37
36
|
borderVars,
|
|
@@ -56,9 +55,41 @@ import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
|
56
55
|
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
57
56
|
import {useInputGroup} from '../InputGroup/InputGroupContext';
|
|
58
57
|
|
|
58
|
+
// Public padding tokens for the `number-input` theme target. A theme writes an
|
|
59
|
+
// ordinary `padding` (in ANY spelling — the shorthand, `paddingBlock`, or a
|
|
60
|
+
// single `paddingBlockStart`) and the pipeline's `container` expansion parses
|
|
61
|
+
// it and emits these normalized per-side tokens; the wrapper and the stepper
|
|
62
|
+
// column both read them, so the column tracks whatever the theme sets instead
|
|
63
|
+
// of assuming the default. Routing through the shared expansion rather than a
|
|
64
|
+
// hand-rolled property→var mapping is what makes every spelling work: a
|
|
65
|
+
// mapping only fires for the exact property name it names.
|
|
66
|
+
//
|
|
67
|
+
// Read order per level: `var(--astryx-…, <next level>)`, terminating at the
|
|
68
|
+
// shared field defaults (NOT the container default --spacing-4, which is a
|
|
69
|
+
// layout metric and would resize every themed field). Built as chained const
|
|
70
|
+
// strings — no function calls — so StyleX can statically analyze them; same
|
|
71
|
+
// shape as the card/section/dialog chains in Layout/container.stylex.ts.
|
|
72
|
+
const FIELD_PAD_BLOCK = spacingVars['--spacing-1'];
|
|
73
|
+
const FIELD_PAD_INLINE = spacingVars['--spacing-2'];
|
|
74
|
+
const padBlockAll = `var(--astryx-number-input-padding, ${FIELD_PAD_BLOCK})`;
|
|
75
|
+
const padInlineAll = `var(--astryx-number-input-padding, ${FIELD_PAD_INLINE})`;
|
|
76
|
+
const padInline = `var(--astryx-number-input-padding-inline, ${padInlineAll})`;
|
|
77
|
+
const padInlineStart = `var(--astryx-number-input-padding-inline-start, ${padInline})`;
|
|
78
|
+
const padInlineEnd = `var(--astryx-number-input-padding-inline-end, ${padInline})`;
|
|
79
|
+
const padBlockStart = `var(--astryx-number-input-padding-block-start, ${padBlockAll})`;
|
|
80
|
+
const padBlockEnd = `var(--astryx-number-input-padding-block-end, ${padBlockAll})`;
|
|
81
|
+
|
|
59
82
|
const styles = stylex.create({
|
|
60
83
|
wrapper: {
|
|
61
84
|
zIndex: 1,
|
|
85
|
+
// Applied per side rather than through the shared field base's
|
|
86
|
+
// `paddingBlock`/`paddingInline` shorthands, because the stepper column
|
|
87
|
+
// has to cancel the block padding edge by edge — an asymmetric
|
|
88
|
+
// `paddingBlock: 4px 12px` needs two different negative margins.
|
|
89
|
+
paddingBlockStart: padBlockStart,
|
|
90
|
+
paddingBlockEnd: padBlockEnd,
|
|
91
|
+
paddingInlineStart: padInlineStart,
|
|
92
|
+
paddingInlineEnd: padInlineEnd,
|
|
62
93
|
},
|
|
63
94
|
wrapperWithNumberSteppers: {
|
|
64
95
|
paddingInlineEnd: 0,
|
|
@@ -84,7 +115,7 @@ const styles = stylex.create({
|
|
|
84
115
|
},
|
|
85
116
|
},
|
|
86
117
|
inputDisabled: {
|
|
87
|
-
cursor: '
|
|
118
|
+
cursor: 'default',
|
|
88
119
|
},
|
|
89
120
|
inputInvalid: {
|
|
90
121
|
color: colorVars['--color-text-secondary'],
|
|
@@ -102,13 +133,18 @@ const styles = stylex.create({
|
|
|
102
133
|
flexDirection: 'column',
|
|
103
134
|
flexShrink: 0,
|
|
104
135
|
width: spacingVars['--spacing-4'],
|
|
105
|
-
|
|
136
|
+
// Cancel the wrapper's block padding edge by edge so the column spans the
|
|
137
|
+
// field's full height. Reading the same tokens the wrapper applies is what
|
|
138
|
+
// keeps it flush under a themed padding — including an asymmetric one,
|
|
139
|
+
// where a single `marginBlock` would be wrong at one end.
|
|
140
|
+
marginBlockStart: `calc(-1 * ${padBlockStart})`,
|
|
141
|
+
marginBlockEnd: `calc(-1 * ${padBlockEnd})`,
|
|
106
142
|
borderInlineStartWidth: borderVars['--border-width'],
|
|
107
143
|
borderInlineStartStyle: 'solid',
|
|
108
144
|
borderInlineStartColor: colorVars['--color-border-emphasized'],
|
|
109
145
|
overflow: 'hidden',
|
|
110
|
-
borderStartEndRadius:
|
|
111
|
-
borderEndEndRadius:
|
|
146
|
+
borderStartEndRadius: 'var(--_field-radius)',
|
|
147
|
+
borderEndEndRadius: 'var(--_field-radius)',
|
|
112
148
|
},
|
|
113
149
|
numberStepperButton: {
|
|
114
150
|
boxSizing: 'border-box',
|
|
@@ -125,17 +161,20 @@ const styles = stylex.create({
|
|
|
125
161
|
backgroundColor: colorVars['--color-background-surface'],
|
|
126
162
|
backgroundImage: {
|
|
127
163
|
default: null,
|
|
128
|
-
':hover': {
|
|
164
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
129
165
|
'@media (hover: hover)': `linear-gradient(${colorVars['--color-overlay-hover']}, ${colorVars['--color-overlay-hover']})`,
|
|
130
166
|
},
|
|
131
167
|
':active': `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`,
|
|
132
168
|
},
|
|
133
|
-
cursor:
|
|
169
|
+
cursor: {
|
|
170
|
+
default: 'pointer',
|
|
171
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
172
|
+
},
|
|
134
173
|
outline: 'none',
|
|
135
174
|
},
|
|
136
175
|
numberStepperButtonDisabled: {
|
|
137
176
|
color: colorVars['--color-icon-disabled'],
|
|
138
|
-
cursor: '
|
|
177
|
+
cursor: 'default',
|
|
139
178
|
backgroundImage: 'none',
|
|
140
179
|
},
|
|
141
180
|
decrementButton: {
|
package/src/Outline/Outline.tsx
CHANGED
|
@@ -190,7 +190,10 @@ const styles = stylex.create({
|
|
|
190
190
|
borderRadius: radiusVars['--radius-element'],
|
|
191
191
|
boxSizing: 'border-box',
|
|
192
192
|
color: colorVars['--color-text-secondary'],
|
|
193
|
-
cursor:
|
|
193
|
+
cursor: {
|
|
194
|
+
default: 'pointer',
|
|
195
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
196
|
+
},
|
|
194
197
|
display: 'flex',
|
|
195
198
|
fontWeight: fontWeightVars['--font-weight-normal'],
|
|
196
199
|
outline: 'none',
|
|
@@ -203,7 +206,7 @@ const styles = stylex.create({
|
|
|
203
206
|
width: '100%',
|
|
204
207
|
fontSize: typeScaleVars['--text-body-size'],
|
|
205
208
|
lineHeight: typeScaleVars['--text-body-leading'],
|
|
206
|
-
':hover': {
|
|
209
|
+
':hover:where(:not(:disabled,[aria-disabled="true"]))': {
|
|
207
210
|
'@media (hover: hover)': {
|
|
208
211
|
backgroundColor: colorVars['--color-overlay-hover'],
|
|
209
212
|
color: colorVars['--color-text-primary'],
|
|
@@ -214,7 +214,10 @@ const styles = stylex.create({
|
|
|
214
214
|
padding: 0,
|
|
215
215
|
borderRadius: '50%',
|
|
216
216
|
backgroundColor: colorVars['--color-neutral'],
|
|
217
|
-
cursor:
|
|
217
|
+
cursor: {
|
|
218
|
+
default: 'pointer',
|
|
219
|
+
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
220
|
+
},
|
|
218
221
|
transitionProperty: 'background-color',
|
|
219
222
|
transitionDuration: durationVars['--duration-fast'],
|
|
220
223
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
@@ -227,7 +230,7 @@ const styles = stylex.create({
|
|
|
227
230
|
backgroundColor: colorVars['--color-accent'],
|
|
228
231
|
},
|
|
229
232
|
dotDisabled: {
|
|
230
|
-
cursor: '
|
|
233
|
+
cursor: 'default',
|
|
231
234
|
opacity: 0.5,
|
|
232
235
|
},
|
|
233
236
|
activePage: {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Popover.test.tsx
|
|
5
|
-
* @input Uses vitest, @testing-library/react, Popover
|
|
5
|
+
* @input Uses vitest, @testing-library/react, Popover, Dialog,
|
|
6
|
+
* SegmentedControl
|
|
6
7
|
* @output Unit tests for Popover component behavior
|
|
7
8
|
* @position Testing; validates Popover.tsx implementation
|
|
8
9
|
*
|
|
@@ -14,6 +15,7 @@ import {render, screen, fireEvent} from '@testing-library/react';
|
|
|
14
15
|
import React, {useRef} from 'react';
|
|
15
16
|
import {Popover} from './Popover';
|
|
16
17
|
import {Dialog} from '../Dialog';
|
|
18
|
+
import {SegmentedControl, SegmentedControlItem} from '../SegmentedControl';
|
|
17
19
|
|
|
18
20
|
// Store original matches to restore later
|
|
19
21
|
const originalMatches = HTMLElement.prototype.matches;
|
|
@@ -306,6 +308,30 @@ describe('Popover', () => {
|
|
|
306
308
|
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
307
309
|
});
|
|
308
310
|
|
|
311
|
+
it('dismisses on Escape pressed inside a roving-focus list', () => {
|
|
312
|
+
render(
|
|
313
|
+
<Popover
|
|
314
|
+
content={
|
|
315
|
+
<SegmentedControl value="grid" onChange={() => {}} label="View">
|
|
316
|
+
<SegmentedControlItem value="grid" label="Grid" />
|
|
317
|
+
<SegmentedControlItem value="list" label="List" />
|
|
318
|
+
</SegmentedControl>
|
|
319
|
+
}
|
|
320
|
+
label="Test">
|
|
321
|
+
<button type="button">Open</button>
|
|
322
|
+
</Popover>,
|
|
323
|
+
);
|
|
324
|
+
const trigger = screen.getByRole('button', {name: 'Open'});
|
|
325
|
+
fireEvent.click(trigger);
|
|
326
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
327
|
+
|
|
328
|
+
// From the segment, so the list's own key handler runs first. jsdom has
|
|
329
|
+
// no popover display, so the open content still reads as hidden.
|
|
330
|
+
const segment = screen.getByRole('radio', {name: 'Grid', hidden: true});
|
|
331
|
+
fireEvent.keyDown(segment, {key: 'Escape'});
|
|
332
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
333
|
+
});
|
|
334
|
+
|
|
309
335
|
it('stays open on Escape when hasEscapeDismiss is false', () => {
|
|
310
336
|
render(
|
|
311
337
|
<Popover
|