@astryxdesign/core 0.1.1 → 0.1.2-canary.04e71b2
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 +105 -0
- package/README.md +131 -13
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +11 -5
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +4 -1
- package/dist/Banner/Banner.d.ts +7 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +9 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +24 -5
- package/dist/Button/Button.d.ts +12 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +53 -17
- package/dist/Calendar/Calendar.d.ts +5 -4
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +82 -43
- package/dist/Calendar/hooks/index.d.ts +0 -2
- package/dist/Calendar/hooks/index.d.ts.map +1 -1
- package/dist/Calendar/hooks/index.js +1 -2
- package/dist/Calendar/index.d.ts +3 -3
- package/dist/Calendar/index.d.ts.map +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar/styles.d.ts +3 -9
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +3 -11
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +17 -3
- package/dist/Center/Center.d.ts +11 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +9 -3
- package/dist/Chat/ChatMessageList.d.ts +14 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +2 -0
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +4 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts +23 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +51 -9
- package/dist/CheckboxList/CheckboxList.d.ts +13 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +39 -9
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +49 -37
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +5 -5
- package/dist/ContextMenu/ContextMenu.d.ts +4 -5
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +93 -11
- package/dist/DateInput/DateInput.d.ts +23 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +59 -8
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +42 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts +35 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +78 -15
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +42 -14
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +7 -1
- package/dist/Field/Field.d.ts +19 -2
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +4 -0
- package/dist/Field/FieldLabel.d.ts +21 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +41 -26
- package/dist/FileInput/FileInput.d.ts +22 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +56 -10
- package/dist/Grid/Grid.d.ts +11 -1
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +8 -0
- package/dist/HoverCard/HoverCard.d.ts +2 -2
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +18 -6
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +7 -3
- package/dist/InputGroup/InputGroup.d.ts +2 -2
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +14 -5
- package/dist/InputGroup/InputGroupContext.d.ts +4 -0
- package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupContext.js +2 -2
- package/dist/InputGroup/index.d.ts +1 -0
- package/dist/InputGroup/index.d.ts.map +1 -1
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +34 -2
- package/dist/Layer/anchorName.d.ts +20 -0
- package/dist/Layer/anchorName.d.ts.map +1 -0
- package/dist/Layer/anchorName.js +36 -0
- package/dist/Layer/layerAnimations.stylex.d.ts +4 -0
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +8 -4
- package/dist/Layer/useLayer.d.ts +29 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +55 -11
- package/dist/Layout/Layout.d.ts +4 -11
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +10 -11
- package/dist/Layout/LayoutFooter.d.ts +2 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.d.ts +2 -2
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.d.ts +2 -2
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.d.ts +51 -0
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +63 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -2
- package/dist/Link/Link.d.ts +17 -2
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +20 -9
- package/dist/Link/LinkProvider.d.ts +1 -0
- package/dist/Link/LinkProvider.d.ts.map +1 -1
- package/dist/Link/LinkProvider.js +1 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +18 -3
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +13 -0
- package/dist/MoreMenu/MoreMenu.d.ts +1 -7
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +0 -2
- package/dist/MultiSelector/MultiSelector.d.ts +25 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +103 -22
- package/dist/MultiSelector/hooks.d.ts +12 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +14 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +34 -3
- package/dist/NumberInput/NumberInput.d.ts +23 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +62 -12
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +46 -28
- package/dist/Popover/usePopover.d.ts +25 -2
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +18 -6
- package/dist/PowerSearch/PowerSearch.d.ts +11 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +6 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +3 -5
- package/dist/RadioList/RadioList.d.ts +20 -2
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +105 -9
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +13 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts +13 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +78 -44
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +7 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +13 -2
- package/dist/Selector/Selector.d.ts +22 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +84 -23
- package/dist/Selector/hooks.d.ts +8 -1
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +14 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +8 -2
- package/dist/Slider/Slider.d.ts +21 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +38 -11
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Stack/Stack.d.ts +38 -23
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +25 -1
- package/dist/Stack/StackItem.d.ts +12 -23
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +8 -1
- package/dist/Switch/Switch.d.ts +23 -2
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +41 -11
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +6 -0
- package/dist/TabList/TabList.d.ts +16 -4
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +86 -10
- package/dist/TabList/TabListContext.d.ts +5 -0
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +5 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +6 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +38 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +36 -7
- package/dist/Table/TableCell.d.ts +8 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +10 -10
- package/dist/Table/TableHeaderCell.d.ts +8 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +16 -16
- package/dist/Table/TableRow.d.ts +6 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +15 -7
- package/dist/Table/index.d.ts +4 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +3 -2
- package/dist/Table/plugins/pagination/paginateData.d.ts +2 -1
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +8 -3
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -1
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +59 -3
- package/dist/Table/plugins/stickyColumns/index.d.ts +3 -0
- package/dist/Table/plugins/stickyColumns/index.d.ts.map +1 -0
- package/dist/Table/plugins/stickyColumns/index.js +3 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts +25 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +369 -0
- package/dist/Table/tableContextMenu.d.ts +33 -0
- package/dist/Table/tableContextMenu.d.ts.map +1 -0
- package/dist/Table/tableContextMenu.js +133 -0
- package/dist/Table/types.d.ts +161 -5
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +1 -1
- package/dist/Text/text.stylex.d.ts +2 -2
- package/dist/Text/text.stylex.js +2 -2
- package/dist/TextArea/TextArea.d.ts +22 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +41 -9
- package/dist/TextInput/TextInput.d.ts +23 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +55 -10
- package/dist/TimeInput/TimeInput.d.ts +23 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +53 -10
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +28 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +14 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +132 -3
- package/dist/ToggleButton/ToggleButton.d.ts +7 -9
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +34 -57
- package/dist/Tokenizer/Tokenizer.d.ts +12 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +27 -5
- package/dist/Toolbar/Toolbar.d.ts +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +51 -7
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +57 -9
- package/dist/TreeList/TreeList.d.ts +1 -1
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +72 -2
- package/dist/TreeList/TreeListItem.d.ts +11 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +51 -12
- package/dist/TreeList/treeListItem.markers.stylex.d.ts +16 -0
- package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +1 -0
- package/dist/TreeList/treeListItem.markers.stylex.js +22 -0
- package/dist/Typeahead/BaseTypeahead.d.ts +9 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +67 -6
- package/dist/Typeahead/Typeahead.d.ts +24 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +29 -5
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +61 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.js +65 -0
- package/dist/VisuallyHidden/index.d.ts +11 -0
- package/dist/VisuallyHidden/index.d.ts.map +1 -0
- package/dist/VisuallyHidden/index.js +13 -0
- package/dist/astryx.css +40 -1
- package/dist/astryx.umd.js +147 -0
- package/dist/astryx.umd.js.map +7 -0
- package/dist/hooks/focusableSelector.d.ts +22 -0
- package/dist/hooks/focusableSelector.d.ts.map +1 -0
- package/dist/hooks/focusableSelector.js +24 -0
- package/dist/hooks/index.d.ts +12 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +7 -2
- package/dist/hooks/useAnnounce.d.ts +40 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -0
- package/dist/hooks/useAnnounce.js +142 -0
- package/dist/hooks/useClickableContainer.d.ts +16 -1
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +16 -4
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +4 -4
- package/dist/hooks/useFocusTrap.d.ts +18 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +87 -3
- package/dist/hooks/useGridFocus.d.ts +88 -1
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +261 -62
- package/dist/hooks/useKeyboardHint.d.ts +82 -0
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHint.js +220 -0
- package/dist/hooks/useListFocus.d.ts +78 -7
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +305 -52
- package/dist/hooks/useLongPress.d.ts +21 -0
- package/dist/hooks/useLongPress.d.ts.map +1 -0
- package/dist/hooks/useLongPress.js +89 -0
- package/dist/hooks/useTreeFocus.d.ts +157 -0
- package/dist/hooks/useTreeFocus.d.ts.map +1 -0
- package/dist/hooks/useTreeFocus.js +337 -0
- package/dist/hooks/useTypeahead.d.ts +63 -0
- package/dist/hooks/useTypeahead.d.ts.map +1 -0
- package/dist/hooks/useTypeahead.js +117 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/generateThemeRules.js +1 -1
- package/dist/theme/syntax/SyntaxTheme.d.ts +1 -1
- package/dist/theme/syntax/SyntaxTheme.js +1 -1
- package/dist/theme/syntax/defineSyntaxTheme.d.ts.map +1 -1
- package/dist/theme/syntax/defineSyntaxTheme.js +2 -2
- package/dist/theme/syntax/presets.d.ts +1 -1
- package/dist/theme/syntax/presets.d.ts.map +1 -1
- package/dist/theme/syntax/presets.js +1 -1
- package/dist/theme/syntax/tokens.d.ts +1 -1
- package/dist/theme/syntax/tokens.js +1 -1
- package/dist/theme/types.d.ts +1 -1
- package/dist/utils/dateTypes.d.ts +12 -0
- package/dist/utils/dateTypes.d.ts.map +1 -1
- package/dist/utils/dateTypes.js +41 -1
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/inputAria.d.ts +29 -0
- package/dist/utils/inputAria.d.ts.map +1 -0
- package/dist/utils/inputAria.js +30 -0
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -2
- package/package.json +15 -5
- package/src/Avatar/Avatar.test.tsx +37 -0
- package/src/Avatar/Avatar.tsx +10 -5
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +3 -0
- package/src/Banner/Banner.doc.mjs +8 -0
- package/src/Banner/Banner.test.tsx +16 -7
- package/src/Banner/Banner.tsx +9 -2
- package/src/Breadcrumbs/BreadcrumbItem.tsx +25 -7
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -10
- package/src/Button/Button.doc.mjs +6 -0
- package/src/Button/Button.test.tsx +105 -11
- package/src/Button/Button.tsx +76 -21
- package/src/Calendar/Calendar.doc.mjs +4 -4
- package/src/Calendar/Calendar.test.tsx +168 -30
- package/src/Calendar/Calendar.tsx +121 -66
- package/src/Calendar/hooks/index.ts +0 -6
- package/src/Calendar/index.ts +1 -3
- package/src/Calendar/styles.ts +4 -9
- package/src/Carousel/Carousel.doc.mjs +7 -1
- package/src/Carousel/Carousel.test.tsx +20 -0
- package/src/Carousel/Carousel.tsx +16 -1
- package/src/Center/Center.doc.mjs +12 -2
- package/src/Center/Center.tsx +28 -3
- package/src/Chat/ChatComposer.doc.mjs +3 -0
- package/src/Chat/ChatComposerDrawer.doc.mjs +12 -0
- package/src/Chat/ChatMessageList.doc.mjs +8 -0
- package/src/Chat/ChatMessageList.test.tsx +18 -0
- package/src/Chat/ChatMessageList.tsx +16 -0
- package/src/Chat/useTriggerMenu.tsx +3 -0
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +172 -27
- package/src/CheckboxInput/CheckboxInput.tsx +78 -6
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxList.test.tsx +169 -16
- package/src/CheckboxList/CheckboxList.tsx +56 -3
- package/src/CheckboxList/CheckboxListContext.tsx +7 -0
- package/src/Citation/Citation.doc.mjs +10 -0
- package/src/Citation/Citation.test.tsx +117 -0
- package/src/Citation/Citation.tsx +9 -1
- package/src/ClickableCard/ClickableCard.doc.mjs +15 -0
- package/src/CodeBlock/CodeBlock.test.tsx +115 -0
- package/src/CodeBlock/CodeBlock.tsx +61 -33
- package/src/CommandPalette/CommandPalette.test.tsx +47 -1
- package/src/CommandPalette/CommandPalette.tsx +9 -21
- package/src/ContextMenu/ContextMenu.doc.mjs +4 -4
- package/src/ContextMenu/ContextMenu.test.tsx +155 -1
- package/src/ContextMenu/ContextMenu.tsx +113 -16
- package/src/DateInput/DateInput.doc.mjs +281 -56
- package/src/DateInput/DateInput.test.tsx +188 -2
- package/src/DateInput/DateInput.tsx +89 -10
- package/src/DateRangeInput/DateRangeInput.doc.mjs +251 -46
- package/src/DateRangeInput/DateRangeInput.test.tsx +182 -20
- package/src/DateRangeInput/DateRangeInput.tsx +63 -5
- package/src/DateTimeInput/DateTimeInput.doc.mjs +368 -67
- package/src/DateTimeInput/DateTimeInput.test.tsx +279 -11
- package/src/DateTimeInput/DateTimeInput.tsx +125 -17
- package/src/Dialog/Dialog.doc.mjs +2 -2
- package/src/Dialog/Dialog.tsx +12 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -8
- package/src/DropdownMenu/DropdownMenu.test.tsx +56 -42
- package/src/DropdownMenu/DropdownMenu.tsx +52 -18
- package/src/EmptyState/EmptyState.test.tsx +4 -2
- package/src/EmptyState/EmptyState.tsx +6 -2
- package/src/Field/Field.test.tsx +32 -0
- package/src/Field/Field.tsx +23 -5
- package/src/Field/FieldLabel.tsx +55 -17
- package/src/FileInput/FileInput.doc.mjs +17 -0
- package/src/FileInput/FileInput.test.tsx +283 -49
- package/src/FileInput/FileInput.tsx +76 -4
- package/src/Grid/Grid.doc.mjs +14 -4
- package/src/Grid/Grid.tsx +20 -0
- package/src/HoverCard/HoverCard.doc.mjs +3 -0
- package/src/HoverCard/HoverCard.test.tsx +189 -2
- package/src/HoverCard/HoverCard.tsx +20 -16
- package/src/HoverCard/useHoverCard.tsx +13 -10
- package/src/Icon/Icon.doc.mjs +8 -0
- package/src/InputGroup/InputGroup.doc.mjs +2 -2
- package/src/InputGroup/InputGroup.test.tsx +98 -60
- package/src/InputGroup/InputGroup.tsx +21 -4
- package/src/InputGroup/InputGroupContext.ts +9 -4
- package/src/InputGroup/index.ts +1 -0
- package/src/Kbd/Kbd.test.tsx +22 -4
- package/src/Kbd/Kbd.tsx +37 -12
- package/src/Layer/anchorName.test.ts +146 -0
- package/src/Layer/anchorName.ts +46 -0
- package/src/Layer/layerAnimations.stylex.ts +20 -4
- package/src/Layer/useLayer.doc.mjs +12 -2
- package/src/Layer/useLayer.tsx +100 -15
- package/src/Layout/Layout.doc.mjs +1 -1
- package/src/Layout/Layout.tsx +8 -16
- package/src/Layout/LayoutFooter.doc.mjs +4 -4
- package/src/Layout/LayoutFooter.tsx +3 -3
- package/src/Layout/LayoutHeader.doc.mjs +4 -4
- package/src/Layout/LayoutHeader.tsx +3 -3
- package/src/Layout/LayoutPanel.tsx +3 -3
- package/src/Layout/padding.stylex.ts +52 -0
- package/src/Lightbox/Lightbox.doc.mjs +9 -2
- package/src/Lightbox/Lightbox.test.tsx +53 -5
- package/src/Lightbox/Lightbox.tsx +9 -4
- package/src/Link/Link.doc.mjs +14 -0
- package/src/Link/Link.test.tsx +52 -2
- package/src/Link/Link.tsx +42 -7
- package/src/Link/LinkProvider.tsx +1 -0
- package/src/List/List.doc.mjs +7 -0
- package/src/Markdown/Markdown.doc.mjs +2 -0
- package/src/Markdown/Markdown.test.tsx +28 -26
- package/src/Markdown/Markdown.tsx +21 -6
- package/src/MetadataList/MetadataListItem.doc.mjs +4 -0
- package/src/MobileNav/MobileNav.doc.mjs +8 -8
- package/src/MobileNav/MobileNav.tsx +13 -0
- package/src/MobileNav/MobileNavReopen.test.tsx +118 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -17
- package/src/MoreMenu/MoreMenu.tsx +0 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +25 -0
- package/src/MultiSelector/MultiSelector.test.tsx +375 -8
- package/src/MultiSelector/MultiSelector.tsx +145 -21
- package/src/MultiSelector/hooks.ts +27 -0
- package/src/NavMenu/NavHeadingMenu.test.tsx +77 -1
- package/src/NavMenu/NavHeadingMenu.tsx +50 -3
- package/src/NumberInput/NumberInput.doc.mjs +17 -0
- package/src/NumberInput/NumberInput.test.tsx +242 -40
- package/src/NumberInput/NumberInput.tsx +89 -11
- package/src/OverflowList/OverflowList.doc.mjs +17 -0
- package/src/Pagination/Pagination.doc.mjs +3 -3
- package/src/Pagination/Pagination.test.tsx +250 -14
- package/src/Pagination/Pagination.tsx +54 -29
- package/src/Popover/usePopover.doc.mjs +7 -3
- package/src/Popover/usePopover.tsx +49 -6
- package/src/PowerSearch/PowerSearch.doc.mjs +15 -0
- package/src/PowerSearch/PowerSearch.test.tsx +97 -1
- package/src/PowerSearch/PowerSearch.tsx +16 -3
- package/src/ProgressBar/ProgressBar.test.tsx +45 -27
- package/src/ProgressBar/ProgressBar.tsx +3 -4
- package/src/RadioList/RadioList.doc.mjs +9 -0
- package/src/RadioList/RadioList.test.tsx +252 -16
- package/src/RadioList/RadioList.tsx +166 -10
- package/src/RadioList/RadioListItem.tsx +14 -2
- package/src/Resizable/Resizable.doc.mjs +1 -1
- package/src/Section/Section.doc.mjs +11 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +9 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +214 -42
- package/src/SegmentedControl/SegmentedControl.tsx +102 -54
- package/src/SegmentedControl/SegmentedControlContext.ts +7 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +14 -1
- package/src/SelectableCard/SelectableCard.doc.mjs +15 -0
- package/src/Selector/Selector.doc.mjs +25 -0
- package/src/Selector/Selector.test.tsx +322 -15
- package/src/Selector/Selector.tsx +126 -40
- package/src/Selector/hooks.ts +23 -0
- package/src/SideNav/SideNav.test.tsx +16 -0
- package/src/SideNav/SideNavItem.tsx +2 -4
- package/src/Skeleton/Skeleton.doc.mjs +11 -1
- package/src/Skeleton/Skeleton.test.tsx +25 -0
- package/src/Skeleton/Skeleton.tsx +11 -1
- package/src/Slider/Slider.doc.mjs +19 -0
- package/src/Slider/Slider.test.tsx +158 -18
- package/src/Slider/Slider.tsx +54 -6
- package/src/Spinner/Spinner.tsx +7 -1
- package/src/Stack/Stack.doc.mjs +77 -0
- package/src/Stack/Stack.test.tsx +55 -5
- package/src/Stack/Stack.tsx +73 -24
- package/src/Stack/StackItem.test.tsx +23 -0
- package/src/Stack/StackItem.tsx +20 -23
- package/src/Switch/Switch.doc.mjs +15 -0
- package/src/Switch/Switch.test.tsx +162 -27
- package/src/Switch/Switch.tsx +61 -21
- package/src/TabList/Tab.tsx +6 -0
- package/src/TabList/TabList.doc.mjs +12 -0
- package/src/TabList/TabList.test.tsx +208 -0
- package/src/TabList/TabList.tsx +102 -12
- package/src/TabList/TabListContext.ts +7 -3
- package/src/TabList/TabMenu.tsx +6 -3
- package/src/Table/BaseTable.tsx +72 -41
- package/src/Table/Table.doc.mjs +14 -0
- package/src/Table/Table.test.tsx +39 -30
- package/src/Table/Table.tsx +27 -1
- package/src/Table/TableCell.tsx +25 -23
- package/src/Table/TableHeaderCell.tsx +28 -29
- package/src/Table/TableRow.tsx +37 -7
- package/src/Table/index.ts +6 -2
- package/src/Table/plugins/pagination/paginateData.ts +10 -3
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +16 -0
- package/src/Table/plugins/pagination/useTablePagination.tsx +8 -1
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +91 -2
- package/src/Table/plugins/sortable/useTableSortable.tsx +53 -1
- package/src/Table/plugins/stickyColumns/index.ts +4 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx +163 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +407 -0
- package/src/Table/tableContextMenu.test.tsx +157 -0
- package/src/Table/tableContextMenu.tsx +142 -0
- package/src/Table/types.ts +175 -4
- package/src/Table/useBaseTablePlugins.ts +1 -0
- package/src/Table/useTableColumnResize.doc.mjs +96 -0
- package/src/Table/useTableStickyColumns.doc.mjs +59 -0
- package/src/Text/Heading.doc.mjs +15 -2
- package/src/Text/Text.doc.mjs +7 -1
- package/src/Text/text.stylex.ts +2 -2
- package/src/TextArea/TextArea.doc.mjs +17 -0
- package/src/TextArea/TextArea.test.tsx +167 -35
- package/src/TextArea/TextArea.tsx +62 -15
- package/src/TextInput/TextInput.doc.mjs +17 -0
- package/src/TextInput/TextInput.test.tsx +168 -34
- package/src/TextInput/TextInput.tsx +77 -9
- package/src/TimeInput/TimeInput.doc.mjs +335 -60
- package/src/TimeInput/TimeInput.test.tsx +144 -7
- package/src/TimeInput/TimeInput.tsx +74 -5
- package/src/Timestamp/Timestamp.doc.mjs +9 -0
- package/src/Timestamp/Timestamp.test.tsx +44 -18
- package/src/Timestamp/Timestamp.tsx +30 -10
- package/src/Toast/Toast.tsx +14 -0
- package/src/Toast/ToastViewport.test.tsx +204 -0
- package/src/Toast/ToastViewport.tsx +167 -21
- package/src/ToggleButton/ToggleButton.doc.mjs +9 -3
- package/src/ToggleButton/ToggleButton.test.tsx +39 -18
- package/src/ToggleButton/ToggleButton.tsx +46 -83
- package/src/Tokenizer/Tokenizer.doc.mjs +15 -0
- package/src/Tokenizer/Tokenizer.test.tsx +105 -1
- package/src/Tokenizer/Tokenizer.tsx +41 -2
- package/src/Toolbar/Toolbar.doc.mjs +65 -5
- package/src/Toolbar/Toolbar.test.tsx +109 -6
- package/src/Toolbar/Toolbar.tsx +59 -5
- package/src/Tooltip/Tooltip.test.tsx +81 -0
- package/src/Tooltip/useTooltip.tsx +57 -11
- package/src/TreeList/TreeList.test.tsx +295 -6
- package/src/TreeList/TreeList.tsx +73 -1
- package/src/TreeList/TreeListItem.tsx +51 -5
- package/src/TreeList/treeListItem.markers.stylex.ts +20 -0
- package/src/Typeahead/BaseTypeahead.tsx +86 -9
- package/src/Typeahead/Typeahead.doc.mjs +136 -30
- package/src/Typeahead/Typeahead.test.tsx +331 -1
- package/src/Typeahead/Typeahead.tsx +52 -1
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +80 -0
- package/src/VisuallyHidden/VisuallyHidden.test.tsx +76 -0
- package/src/VisuallyHidden/VisuallyHidden.tsx +113 -0
- package/src/VisuallyHidden/index.ts +15 -0
- package/src/hooks/focusableSelector.ts +25 -0
- package/src/hooks/index.ts +28 -2
- package/src/hooks/useAnnounce.test.tsx +101 -0
- package/src/hooks/useAnnounce.ts +168 -0
- package/src/hooks/useClickableContainer.ts +16 -4
- package/src/hooks/useEntryAnimation.ts +16 -4
- package/src/hooks/useFocusTrap.test.tsx +132 -0
- package/src/hooks/useFocusTrap.ts +98 -4
- package/src/hooks/useGridFocus.doc.mjs +40 -2
- package/src/hooks/useGridFocus.test.tsx +132 -0
- package/src/hooks/useGridFocus.ts +343 -67
- package/src/hooks/useImageMode.test.ts +133 -0
- package/src/hooks/useKeyboardHint.doc.mjs +101 -0
- package/src/hooks/useKeyboardHint.test.tsx +70 -0
- package/src/hooks/useKeyboardHint.tsx +332 -0
- package/src/hooks/useListFocus.doc.mjs +50 -10
- package/src/hooks/useListFocus.test.tsx +375 -0
- package/src/hooks/useListFocus.ts +395 -57
- package/src/hooks/useLongPress.test.tsx +134 -0
- package/src/hooks/useLongPress.ts +119 -0
- package/src/hooks/useTreeFocus.doc.mjs +140 -0
- package/src/hooks/useTreeFocus.test.tsx +214 -0
- package/src/hooks/useTreeFocus.ts +559 -0
- package/src/hooks/useTypeahead.test.tsx +109 -0
- package/src/hooks/useTypeahead.ts +183 -0
- package/src/index.ts +1 -0
- package/src/theme/derivedVarRegistry.test.ts +4 -0
- package/src/theme/generateThemeRules.test.ts +7 -8
- package/src/theme/generateThemeRules.ts +1 -1
- package/src/theme/syntax/SyntaxTheme.tsx +1 -1
- package/src/theme/syntax/defineSyntaxTheme.ts +20 -11
- package/src/theme/syntax/presets.ts +5 -2
- package/src/theme/syntax/tokens.ts +1 -1
- package/src/theme/types.ts +1 -1
- package/src/utils/dateTypes.test.ts +40 -0
- package/src/utils/dateTypes.ts +40 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/inputAria.test.ts +39 -0
- package/src/utils/inputAria.ts +58 -0
- package/src/utils/timeParser.test.ts +10 -0
- package/src/utils/timeParser.ts +5 -2
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts +0 -57
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts.map +0 -1
- package/dist/Calendar/hooks/useCalendarRovingTabindex.js +0 -96
- package/src/Calendar/hooks/useCalendarRovingTabindex.ts +0 -118
|
@@ -84,11 +84,19 @@ export const docs = {
|
|
|
84
84
|
name: 'isDisabled',
|
|
85
85
|
type: 'boolean',
|
|
86
86
|
description: 'Disables the selector.',
|
|
87
|
+
default: 'false',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'disabledMessage',
|
|
91
|
+
type: 'string',
|
|
92
|
+
description:
|
|
93
|
+
'Explains why the selector is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the trigger focusable via aria-disabled (activation stays blocked). Use this instead of wrapping a disabled Selector in Tooltip — disabled controls swallow the hover events an external Tooltip needs.',
|
|
87
94
|
},
|
|
88
95
|
{
|
|
89
96
|
name: 'isLabelHidden',
|
|
90
97
|
type: 'boolean',
|
|
91
98
|
description: 'Visually hides the label while keeping it accessible.',
|
|
99
|
+
default: 'false',
|
|
92
100
|
},
|
|
93
101
|
{
|
|
94
102
|
name: 'description',
|
|
@@ -99,11 +107,13 @@ export const docs = {
|
|
|
99
107
|
name: 'isOptional',
|
|
100
108
|
type: 'boolean',
|
|
101
109
|
description: 'Marks the field as optional.',
|
|
110
|
+
default: 'false',
|
|
102
111
|
},
|
|
103
112
|
{
|
|
104
113
|
name: 'isRequired',
|
|
105
114
|
type: 'boolean',
|
|
106
115
|
description: 'Marks the field as required.',
|
|
116
|
+
default: 'false',
|
|
107
117
|
},
|
|
108
118
|
{
|
|
109
119
|
name: 'status',
|
|
@@ -172,6 +182,11 @@ export const docs = {
|
|
|
172
182
|
description:
|
|
173
183
|
'Put more than ~20 options without sections; consider Typeahead for large lists.',
|
|
174
184
|
},
|
|
185
|
+
{
|
|
186
|
+
guidance: false,
|
|
187
|
+
description:
|
|
188
|
+
'Wrap a disabled Selector in Tooltip to explain why it is disabled; disabled triggers swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
189
|
+
},
|
|
175
190
|
],
|
|
176
191
|
anatomy: [
|
|
177
192
|
{
|
|
@@ -259,6 +274,11 @@ export const docsZh = {
|
|
|
259
274
|
description:
|
|
260
275
|
'Put more than ~20 options without sections; consider Typeahead for large lists.',
|
|
261
276
|
},
|
|
277
|
+
{
|
|
278
|
+
guidance: false,
|
|
279
|
+
description:
|
|
280
|
+
'Wrap a disabled Selector in Tooltip to explain why it is disabled; disabled triggers swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
281
|
+
},
|
|
262
282
|
],
|
|
263
283
|
anatomy: [
|
|
264
284
|
{
|
|
@@ -346,6 +366,11 @@ export const docsDense = {
|
|
|
346
366
|
description:
|
|
347
367
|
'Put more than ~20 options without sections; consider Typeahead for large lists.',
|
|
348
368
|
},
|
|
369
|
+
{
|
|
370
|
+
guidance: false,
|
|
371
|
+
description:
|
|
372
|
+
'Wrap a disabled Selector in Tooltip to explain why it is disabled; disabled triggers swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
373
|
+
},
|
|
349
374
|
],
|
|
350
375
|
anatomy: [
|
|
351
376
|
{
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
13
|
-
import {render, screen, waitFor} from '@testing-library/react';
|
|
13
|
+
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
|
|
14
14
|
import userEvent from '@testing-library/user-event';
|
|
15
15
|
import {Selector} from './Selector';
|
|
16
16
|
import {SelectorOption} from './SelectorOption';
|
|
@@ -83,7 +83,12 @@ function mockSelectorRects() {
|
|
|
83
83
|
'innerHeight',
|
|
84
84
|
);
|
|
85
85
|
HTMLElement.prototype.getBoundingClientRect = function () {
|
|
86
|
-
|
|
86
|
+
// The trigger is role="combobox" by default, or a plain button with
|
|
87
|
+
// aria-haspopup="listbox" in hasSearch mode — match either.
|
|
88
|
+
if (
|
|
89
|
+
this.getAttribute('role') === 'combobox' ||
|
|
90
|
+
this.getAttribute('aria-haspopup') === 'listbox'
|
|
91
|
+
) {
|
|
87
92
|
return rect({top: 160, bottom: 190, height: 30});
|
|
88
93
|
}
|
|
89
94
|
if (this.getAttribute('role') === 'listbox') {
|
|
@@ -108,9 +113,7 @@ function mockSelectorRects() {
|
|
|
108
113
|
|
|
109
114
|
describe('Selector', () => {
|
|
110
115
|
it('renders with placeholder when no value', () => {
|
|
111
|
-
render(
|
|
112
|
-
<Selector label="Fruit" options={OPTIONS} placeholder="Pick one" />,
|
|
113
|
-
);
|
|
116
|
+
render(<Selector label="Fruit" options={OPTIONS} placeholder="Pick one" />);
|
|
114
117
|
expect(screen.getByRole('combobox')).toHaveTextContent('Pick one');
|
|
115
118
|
});
|
|
116
119
|
|
|
@@ -147,6 +150,25 @@ describe('Selector', () => {
|
|
|
147
150
|
expect(screen.getByTestId('option-badge')).toHaveTextContent('Owner');
|
|
148
151
|
});
|
|
149
152
|
|
|
153
|
+
it('exposes the popup as a listbox, not a modal dialog', () => {
|
|
154
|
+
render(
|
|
155
|
+
<Selector
|
|
156
|
+
label="Fruit"
|
|
157
|
+
options={OPTIONS}
|
|
158
|
+
value="Banana"
|
|
159
|
+
onChange={() => {}}
|
|
160
|
+
/>,
|
|
161
|
+
);
|
|
162
|
+
// The combobox trigger keeps DOM focus; the popup must expose its own
|
|
163
|
+
// role="listbox" and must not be wrapped in a role="dialog" aria-modal
|
|
164
|
+
// element, which would tell AT the focused trigger is inert.
|
|
165
|
+
expect(screen.getByRole('listbox', {hidden: true})).toBeInTheDocument();
|
|
166
|
+
expect(screen.queryByRole('dialog', {hidden: true})).not.toBeInTheDocument();
|
|
167
|
+
expect(
|
|
168
|
+
document.querySelector('[aria-modal="true"]'),
|
|
169
|
+
).not.toBeInTheDocument();
|
|
170
|
+
});
|
|
171
|
+
|
|
150
172
|
it('supports explicit menu placement', () => {
|
|
151
173
|
render(
|
|
152
174
|
<Selector
|
|
@@ -310,6 +332,59 @@ describe('Selector', () => {
|
|
|
310
332
|
expect(onChange).toHaveBeenCalledWith(null);
|
|
311
333
|
});
|
|
312
334
|
|
|
335
|
+
it('clears the value via Delete on the focused trigger', async () => {
|
|
336
|
+
const user = userEvent.setup();
|
|
337
|
+
const onChange = vi.fn();
|
|
338
|
+
render(
|
|
339
|
+
<Selector
|
|
340
|
+
label="Fruit"
|
|
341
|
+
options={OPTIONS}
|
|
342
|
+
value="Banana"
|
|
343
|
+
onChange={onChange}
|
|
344
|
+
hasClear
|
|
345
|
+
/>,
|
|
346
|
+
);
|
|
347
|
+
const trigger = screen.getByRole('combobox');
|
|
348
|
+
trigger.focus();
|
|
349
|
+
await user.keyboard('{Delete}');
|
|
350
|
+
expect(onChange).toHaveBeenCalledWith(null);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('clears the value via Backspace on the focused trigger', async () => {
|
|
354
|
+
const user = userEvent.setup();
|
|
355
|
+
const onChange = vi.fn();
|
|
356
|
+
render(
|
|
357
|
+
<Selector
|
|
358
|
+
label="Fruit"
|
|
359
|
+
options={OPTIONS}
|
|
360
|
+
value="Banana"
|
|
361
|
+
onChange={onChange}
|
|
362
|
+
hasClear
|
|
363
|
+
/>,
|
|
364
|
+
);
|
|
365
|
+
const trigger = screen.getByRole('combobox');
|
|
366
|
+
trigger.focus();
|
|
367
|
+
await user.keyboard('{Backspace}');
|
|
368
|
+
expect(onChange).toHaveBeenCalledWith(null);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('does not clear via Delete when hasClear is not set', async () => {
|
|
372
|
+
const user = userEvent.setup();
|
|
373
|
+
const onChange = vi.fn();
|
|
374
|
+
render(
|
|
375
|
+
<Selector
|
|
376
|
+
label="Fruit"
|
|
377
|
+
options={OPTIONS}
|
|
378
|
+
value="Banana"
|
|
379
|
+
onChange={onChange}
|
|
380
|
+
/>,
|
|
381
|
+
);
|
|
382
|
+
const trigger = screen.getByRole('combobox');
|
|
383
|
+
trigger.focus();
|
|
384
|
+
await user.keyboard('{Delete}');
|
|
385
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
386
|
+
});
|
|
387
|
+
|
|
313
388
|
it('shows placeholder after clearing', () => {
|
|
314
389
|
render(
|
|
315
390
|
<Selector
|
|
@@ -355,8 +430,33 @@ describe('Selector', () => {
|
|
|
355
430
|
hasSearch
|
|
356
431
|
/>,
|
|
357
432
|
);
|
|
358
|
-
await user.click(screen.getByRole('
|
|
359
|
-
expect(screen.getByRole('
|
|
433
|
+
await user.click(screen.getByRole('button', {name: 'Fruit'}));
|
|
434
|
+
expect(screen.getByRole('combobox', h)).toBeInTheDocument();
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
it('wires the search input as the combobox with activedescendant (comboboxes-4)', async () => {
|
|
438
|
+
const user = userEvent.setup();
|
|
439
|
+
render(
|
|
440
|
+
<Selector
|
|
441
|
+
label="Fruit"
|
|
442
|
+
options={OPTIONS}
|
|
443
|
+
value="Apple"
|
|
444
|
+
onChange={() => {}}
|
|
445
|
+
hasSearch
|
|
446
|
+
/>,
|
|
447
|
+
);
|
|
448
|
+
const triggerBtn = screen.getByRole('button', {name: 'Fruit'});
|
|
449
|
+
// In hasSearch mode the trigger is a plain button, not a combobox.
|
|
450
|
+
expect(triggerBtn).not.toHaveAttribute('role', 'combobox');
|
|
451
|
+
await user.click(triggerBtn);
|
|
452
|
+
const search = screen.getByRole('combobox', h);
|
|
453
|
+
expect(search).toHaveAttribute('aria-autocomplete', 'list');
|
|
454
|
+
expect(search).toHaveAttribute('aria-expanded', 'true');
|
|
455
|
+
expect(search).toHaveAttribute('aria-controls');
|
|
456
|
+
// ArrowDown moves the highlight; the search input reports it via
|
|
457
|
+
// aria-activedescendant (previously silent on the trigger).
|
|
458
|
+
await user.keyboard('{ArrowDown}');
|
|
459
|
+
expect(search).toHaveAttribute('aria-activedescendant');
|
|
360
460
|
});
|
|
361
461
|
|
|
362
462
|
it('does not render search input when hasSearch is false', async () => {
|
|
@@ -369,6 +469,8 @@ describe('Selector', () => {
|
|
|
369
469
|
onChange={() => {}}
|
|
370
470
|
/>,
|
|
371
471
|
);
|
|
472
|
+
// hasSearch is false, so the trigger itself is the combobox and there is
|
|
473
|
+
// no separate search input inside the popup.
|
|
372
474
|
await user.click(screen.getByRole('combobox'));
|
|
373
475
|
expect(screen.queryByRole('searchbox', h)).not.toBeInTheDocument();
|
|
374
476
|
});
|
|
@@ -384,8 +486,8 @@ describe('Selector', () => {
|
|
|
384
486
|
hasSearch
|
|
385
487
|
/>,
|
|
386
488
|
);
|
|
387
|
-
await user.click(screen.getByRole('
|
|
388
|
-
await user.type(screen.getByRole('
|
|
489
|
+
await user.click(screen.getByRole('button', {name: 'Fruit'}));
|
|
490
|
+
await user.type(screen.getByRole('combobox', h), 'ban');
|
|
389
491
|
const options = screen.getAllByRole('option', h);
|
|
390
492
|
expect(options).toHaveLength(1);
|
|
391
493
|
expect(options[0]).toHaveTextContent('Banana');
|
|
@@ -402,8 +504,8 @@ describe('Selector', () => {
|
|
|
402
504
|
hasSearch
|
|
403
505
|
/>,
|
|
404
506
|
);
|
|
405
|
-
await user.click(screen.getByRole('
|
|
406
|
-
await user.type(screen.getByRole('
|
|
507
|
+
await user.click(screen.getByRole('button', {name: 'Fruit'}));
|
|
508
|
+
await user.type(screen.getByRole('combobox', h), 'xyz');
|
|
407
509
|
expect(screen.queryAllByRole('option', h)).toHaveLength(0);
|
|
408
510
|
expect(screen.getByText('No results found')).toBeInTheDocument();
|
|
409
511
|
});
|
|
@@ -420,8 +522,8 @@ describe('Selector', () => {
|
|
|
420
522
|
hasSearch
|
|
421
523
|
/>,
|
|
422
524
|
);
|
|
423
|
-
await user.click(screen.getByRole('
|
|
424
|
-
await user.type(screen.getByRole('
|
|
525
|
+
await user.click(screen.getByRole('button', {name: 'Fruit'}));
|
|
526
|
+
await user.type(screen.getByRole('combobox', h), 'ban');
|
|
425
527
|
await user.click(screen.getByRole('option', {name: /Banana/, ...h}));
|
|
426
528
|
expect(onChange).toHaveBeenCalledWith('Banana');
|
|
427
529
|
});
|
|
@@ -441,7 +543,9 @@ describe('Selector', () => {
|
|
|
441
543
|
</>,
|
|
442
544
|
);
|
|
443
545
|
|
|
444
|
-
|
|
546
|
+
// In hasSearch mode the trigger is a plain button (the popup's search
|
|
547
|
+
// input is the combobox); it still owns aria-expanded.
|
|
548
|
+
const trigger = screen.getByRole('button', {name: 'Fruit'});
|
|
445
549
|
await user.click(trigger);
|
|
446
550
|
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
447
551
|
|
|
@@ -461,10 +565,213 @@ describe('Selector', () => {
|
|
|
461
565
|
searchPlaceholder="Find a fruit..."
|
|
462
566
|
/>,
|
|
463
567
|
);
|
|
464
|
-
await user.click(screen.getByRole('
|
|
568
|
+
await user.click(screen.getByRole('button', {name: 'Fruit'}));
|
|
465
569
|
expect(
|
|
466
570
|
screen.getByPlaceholderText('Find a fruit...'),
|
|
467
571
|
).toBeInTheDocument();
|
|
468
572
|
});
|
|
469
573
|
});
|
|
574
|
+
|
|
575
|
+
describe('keyboard accessibility', () => {
|
|
576
|
+
it('trigger is focusable via Tab when enabled', async () => {
|
|
577
|
+
const user = userEvent.setup();
|
|
578
|
+
render(<Selector label="Fruit" options={OPTIONS} />);
|
|
579
|
+
|
|
580
|
+
await user.tab();
|
|
581
|
+
expect(screen.getByRole('combobox')).toHaveFocus();
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
it('trigger is not focusable when disabled', () => {
|
|
585
|
+
render(<Selector label="Fruit" options={OPTIONS} isDisabled />);
|
|
586
|
+
expect(screen.getByRole('combobox')).toHaveAttribute('tabIndex', '-1');
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
it('opens the listbox with ArrowDown from a focused trigger', async () => {
|
|
590
|
+
const user = userEvent.setup();
|
|
591
|
+
render(<Selector label="Fruit" options={OPTIONS} />);
|
|
592
|
+
|
|
593
|
+
const trigger = screen.getByRole('combobox');
|
|
594
|
+
await user.tab();
|
|
595
|
+
expect(trigger).toHaveFocus();
|
|
596
|
+
|
|
597
|
+
await user.keyboard('{ArrowDown}');
|
|
598
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it('opens and selects an option with Enter (no mouse)', async () => {
|
|
602
|
+
const user = userEvent.setup();
|
|
603
|
+
const onChange = vi.fn();
|
|
604
|
+
render(<Selector label="Fruit" options={OPTIONS} onChange={onChange} />);
|
|
605
|
+
|
|
606
|
+
await user.tab();
|
|
607
|
+
await user.keyboard('{Enter}'); // open
|
|
608
|
+
await user.keyboard('{ArrowDown}'); // move highlight
|
|
609
|
+
await user.keyboard('{Enter}'); // select
|
|
610
|
+
|
|
611
|
+
expect(onChange).toHaveBeenCalled();
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it('clear button is reachable by keyboard', () => {
|
|
615
|
+
render(
|
|
616
|
+
<Selector
|
|
617
|
+
label="Fruit"
|
|
618
|
+
options={OPTIONS}
|
|
619
|
+
value="Apple"
|
|
620
|
+
onChange={() => {}}
|
|
621
|
+
hasClear
|
|
622
|
+
/>,
|
|
623
|
+
);
|
|
624
|
+
const clear = screen.getByRole('button', {name: 'Clear Fruit'});
|
|
625
|
+
expect(clear).not.toHaveAttribute('tabIndex', '-1');
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it('scrolls the highlighted option into view during arrow navigation', async () => {
|
|
629
|
+
const scrollIntoView = vi.fn();
|
|
630
|
+
Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', {
|
|
631
|
+
configurable: true,
|
|
632
|
+
value: scrollIntoView,
|
|
633
|
+
});
|
|
634
|
+
try {
|
|
635
|
+
const user = userEvent.setup();
|
|
636
|
+
const longOptions = Array.from(
|
|
637
|
+
{length: 20},
|
|
638
|
+
(_, i) => `Option ${i + 1}`,
|
|
639
|
+
);
|
|
640
|
+
render(<Selector label="Fruit" options={longOptions} />);
|
|
641
|
+
|
|
642
|
+
await user.tab();
|
|
643
|
+
await user.keyboard('{Enter}'); // open
|
|
644
|
+
scrollIntoView.mockClear();
|
|
645
|
+
await user.keyboard('{ArrowDown}'); // move highlight
|
|
646
|
+
await user.keyboard('{ArrowDown}');
|
|
647
|
+
|
|
648
|
+
expect(scrollIntoView).toHaveBeenCalledWith({block: 'nearest'});
|
|
649
|
+
} finally {
|
|
650
|
+
delete (HTMLElement.prototype as unknown as {scrollIntoView?: unknown})
|
|
651
|
+
.scrollIntoView;
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
describe('disabledMessage', () => {
|
|
657
|
+
it('shows the reason tooltip on hover when disabled with a reason', async () => {
|
|
658
|
+
render(
|
|
659
|
+
<Selector
|
|
660
|
+
label="Fruit"
|
|
661
|
+
options={OPTIONS}
|
|
662
|
+
isDisabled
|
|
663
|
+
disabledMessage="You need the Editor role"
|
|
664
|
+
data-testid="fruit-selector"
|
|
665
|
+
/>,
|
|
666
|
+
);
|
|
667
|
+
|
|
668
|
+
const container = screen.getByTestId('fruit-selector');
|
|
669
|
+
const tooltip = screen.getByRole('tooltip', h);
|
|
670
|
+
expect(tooltip).toHaveTextContent('You need the Editor role');
|
|
671
|
+
|
|
672
|
+
fireEvent.mouseEnter(container);
|
|
673
|
+
await waitFor(() => {
|
|
674
|
+
expect(tooltip).toHaveAttribute('popover-open');
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
fireEvent.mouseLeave(container);
|
|
678
|
+
await waitFor(() => {
|
|
679
|
+
expect(tooltip).not.toHaveAttribute('popover-open');
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
it('shows the reason tooltip on keyboard focus', async () => {
|
|
684
|
+
const user = userEvent.setup();
|
|
685
|
+
render(
|
|
686
|
+
<Selector
|
|
687
|
+
label="Fruit"
|
|
688
|
+
options={OPTIONS}
|
|
689
|
+
isDisabled
|
|
690
|
+
disabledMessage="You need the Editor role"
|
|
691
|
+
/>,
|
|
692
|
+
);
|
|
693
|
+
|
|
694
|
+
const tooltip = screen.getByRole('tooltip', h);
|
|
695
|
+
await user.tab();
|
|
696
|
+
expect(screen.getByRole('combobox')).toHaveFocus();
|
|
697
|
+
await waitFor(() => {
|
|
698
|
+
expect(tooltip).toHaveAttribute('popover-open');
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
it('does not render a tooltip when not disabled', () => {
|
|
703
|
+
render(
|
|
704
|
+
<Selector
|
|
705
|
+
label="Fruit"
|
|
706
|
+
options={OPTIONS}
|
|
707
|
+
disabledMessage="You need the Editor role"
|
|
708
|
+
/>,
|
|
709
|
+
);
|
|
710
|
+
expect(screen.queryByRole('tooltip', h)).not.toBeInTheDocument();
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
it('does not render a tooltip when disabled without a reason', () => {
|
|
714
|
+
render(<Selector label="Fruit" options={OPTIONS} isDisabled />);
|
|
715
|
+
expect(screen.queryByRole('tooltip', h)).not.toBeInTheDocument();
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
it('keeps the trigger focusable via aria-disabled when a reason is provided', () => {
|
|
719
|
+
render(
|
|
720
|
+
<Selector
|
|
721
|
+
label="Fruit"
|
|
722
|
+
options={OPTIONS}
|
|
723
|
+
isDisabled
|
|
724
|
+
disabledMessage="You need the Editor role"
|
|
725
|
+
/>,
|
|
726
|
+
);
|
|
727
|
+
const trigger = screen.getByRole('combobox');
|
|
728
|
+
expect(trigger).not.toBeDisabled();
|
|
729
|
+
expect(trigger).toHaveAttribute('aria-disabled', 'true');
|
|
730
|
+
expect(trigger).toHaveAttribute('tabIndex', '0');
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
it('links the reason tooltip from the trigger via aria-describedby', () => {
|
|
734
|
+
render(
|
|
735
|
+
<Selector
|
|
736
|
+
label="Fruit"
|
|
737
|
+
options={OPTIONS}
|
|
738
|
+
isDisabled
|
|
739
|
+
disabledMessage="You need the Editor role"
|
|
740
|
+
/>,
|
|
741
|
+
);
|
|
742
|
+
const trigger = screen.getByRole('combobox');
|
|
743
|
+
const tooltip = screen.getByRole('tooltip', h);
|
|
744
|
+
expect(trigger.getAttribute('aria-describedby')).toContain(tooltip.id);
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
it('blocks activation while focusable-disabled', async () => {
|
|
748
|
+
const user = userEvent.setup();
|
|
749
|
+
const onChange = vi.fn();
|
|
750
|
+
render(
|
|
751
|
+
<Selector
|
|
752
|
+
label="Fruit"
|
|
753
|
+
options={OPTIONS}
|
|
754
|
+
onChange={onChange}
|
|
755
|
+
isDisabled
|
|
756
|
+
disabledMessage="You need the Editor role"
|
|
757
|
+
/>,
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
const trigger = screen.getByRole('combobox');
|
|
761
|
+
await user.click(trigger);
|
|
762
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
763
|
+
|
|
764
|
+
await user.keyboard('{Enter}');
|
|
765
|
+
await user.keyboard('{ArrowDown}');
|
|
766
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
767
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
it('remains non-focusable when disabled without a reason', () => {
|
|
771
|
+
render(<Selector label="Fruit" options={OPTIONS} isDisabled />);
|
|
772
|
+
const trigger = screen.getByRole('combobox');
|
|
773
|
+
expect(trigger).toBeDisabled();
|
|
774
|
+
expect(trigger).toHaveAttribute('tabIndex', '-1');
|
|
775
|
+
});
|
|
776
|
+
});
|
|
470
777
|
});
|