@astryxdesign/core 0.1.2 → 0.1.3-canary.6d57c8d
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 +165 -0
- package/README.md +12 -12
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +11 -5
- 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.map +1 -1
- package/dist/Button/Button.js +2 -4
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +0 -1
- 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/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +0 -1
- 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 +8 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -3
- 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/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +0 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +9 -5
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +51 -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 +167 -99
- 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/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 +32 -6
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +16 -6
- 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/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +3 -3
- 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 +33 -1
- 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 +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -9
- 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 +16 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +18 -7
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -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 +27 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +141 -42
- 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 +15 -1
- package/dist/Popover/Popover.d.ts +18 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/usePopover.d.ts +38 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +24 -9
- 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 +24 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +122 -43
- 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/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +2 -0
- 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 +36 -9
- 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 +87 -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 +11 -8
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +10 -1
- 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/index.d.ts +2 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -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/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 +66 -0
- package/dist/Table/types.d.ts.map +1 -1
- 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 +147 -76
- 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 +131 -3
- package/dist/Tokenizer/Tokenizer.d.ts +12 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +26 -4
- 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 +56 -9
- package/dist/TopNav/TopNavHeading.d.ts +7 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +8 -0
- 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 +13 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +69 -6
- package/dist/Typeahead/Typeahead.d.ts +26 -3
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +65 -29
- 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 +18 -0
- package/dist/astryx.umd.js +55 -55
- package/dist/astryx.umd.js.map +4 -4
- 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/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/docs.mjs +2 -2
- package/package.json +12 -8
- package/src/Avatar/Avatar.test.tsx +37 -0
- package/src/Avatar/Avatar.tsx +10 -5
- package/src/Breadcrumbs/BreadcrumbItem.tsx +25 -7
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +31 -10
- package/src/Button/Button.tsx +3 -16
- package/src/ButtonGroup/ButtonGroup.test.tsx +9 -9
- package/src/ButtonGroup/ButtonGroup.tsx +0 -1
- 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/ChatComposerInput.test.tsx +26 -7
- package/src/Chat/ChatComposerInput.tsx +0 -1
- package/src/Chat/ChatDictationButton.doc.mjs +1 -1
- 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 +22 -4
- package/src/CheckboxInput/CheckboxInput.doc.mjs +10 -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 +192 -26
- package/src/CheckboxList/CheckboxList.tsx +56 -3
- package/src/CheckboxList/CheckboxListContext.tsx +7 -0
- package/src/CheckboxList/CheckboxListItem.tsx +0 -3
- package/src/Citation/Citation.doc.mjs +10 -0
- package/src/Citation/Citation.test.tsx +121 -0
- package/src/Citation/Citation.tsx +15 -3
- package/src/CodeBlock/CodeBlock.test.tsx +115 -0
- package/src/CodeBlock/CodeBlock.tsx +63 -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 +286 -56
- package/src/DateInput/DateInput.test.tsx +248 -2
- package/src/DateInput/DateInput.tsx +196 -100
- 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/Field/Field.doc.mjs +59 -18
- 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 +17 -4
- package/src/Grid/Grid.test.tsx +43 -30
- package/src/Grid/Grid.tsx +38 -3
- package/src/Icon/Icon.doc.mjs +3 -3
- package/src/InputGroup/InputGroup.doc.mjs +111 -23
- package/src/InputGroup/InputGroup.test.tsx +257 -60
- package/src/InputGroup/InputGroup.tsx +23 -5
- package/src/InputGroup/InputGroupContext.ts +9 -4
- package/src/InputGroup/groupStyles.ts +7 -1
- package/src/InputGroup/index.ts +1 -0
- package/src/Kbd/Kbd.test.tsx +22 -4
- package/src/Kbd/Kbd.tsx +35 -3
- package/src/Layer/layerAnimations.stylex.ts +20 -4
- package/src/Layer/useLayer.doc.mjs +5 -0
- package/src/Layer/useLayer.test.tsx +111 -0
- package/src/Layer/useLayer.tsx +90 -9
- 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 -0
- 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 +50 -0
- package/src/Link/Link.tsx +39 -4
- package/src/Markdown/Markdown.test.tsx +11 -0
- package/src/Markdown/Markdown.tsx +7 -0
- package/src/MetadataList/MetadataListItem.doc.mjs +4 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -17
- package/src/MoreMenu/MoreMenu.tsx +0 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +30 -0
- package/src/MultiSelector/MultiSelector.test.tsx +375 -8
- package/src/MultiSelector/MultiSelector.tsx +194 -48
- 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/Pagination/Pagination.doc.mjs +3 -3
- package/src/Pagination/Pagination.test.tsx +117 -5
- package/src/Pagination/Pagination.tsx +21 -1
- package/src/Popover/Popover.doc.mjs +26 -0
- package/src/Popover/Popover.test.tsx +121 -0
- package/src/Popover/Popover.tsx +23 -2
- package/src/Popover/usePopover.doc.mjs +9 -3
- package/src/Popover/usePopover.tsx +70 -12
- 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 +34 -26
- 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/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 +1 -1
- package/src/Selector/Selector.doc.mjs +26 -0
- package/src/Selector/Selector.test.tsx +387 -15
- package/src/Selector/Selector.tsx +175 -67
- package/src/Selector/hooks.ts +23 -0
- package/src/SideNav/SideNav.test.tsx +48 -0
- package/src/SideNav/SideNavHeading.tsx +8 -2
- package/src/SideNav/SideNavItem.tsx +2 -4
- package/src/Skeleton/Skeleton.test.tsx +25 -0
- package/src/Skeleton/Skeleton.tsx +11 -1
- package/src/Slider/Slider.doc.mjs +15 -0
- package/src/Slider/Slider.test.tsx +155 -2
- package/src/Slider/Slider.tsx +53 -5
- 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 +6 -0
- package/src/TabList/TabList.test.tsx +251 -0
- package/src/TabList/TabList.tsx +103 -12
- package/src/TabList/TabListContext.ts +7 -3
- package/src/TabList/TabMenu.tsx +6 -3
- package/src/Table/BaseTable.tsx +21 -17
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +10 -0
- package/src/Table/Table.tsx +8 -0
- package/src/Table/TableCell.tsx +25 -23
- package/src/Table/TableHeaderCell.tsx +28 -29
- package/src/Table/index.ts +3 -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/tableContextMenu.test.tsx +157 -0
- package/src/Table/tableContextMenu.tsx +142 -0
- package/src/Table/types.ts +74 -0
- package/src/Table/useTableColumnResize.doc.mjs +3 -3
- package/src/Table/useTableStickyColumns.doc.mjs +2 -2
- package/src/Text/Text.doc.mjs +18 -18
- 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/Thumbnail/Thumbnail.doc.mjs +4 -4
- package/src/TimeInput/TimeInput.doc.mjs +340 -60
- package/src/TimeInput/TimeInput.test.tsx +255 -7
- package/src/TimeInput/TimeInput.tsx +176 -70
- package/src/Timestamp/Timestamp.doc.mjs +19 -19
- package/src/Toast/Toast.tsx +14 -0
- package/src/Toast/ToastViewport.test.tsx +214 -0
- package/src/Toast/ToastViewport.tsx +167 -21
- package/src/Tokenizer/Tokenizer.doc.mjs +29 -14
- package/src/Tokenizer/Tokenizer.test.tsx +105 -1
- package/src/Tokenizer/Tokenizer.tsx +37 -1
- package/src/Toolbar/Toolbar.test.tsx +109 -6
- package/src/Toolbar/Toolbar.tsx +59 -5
- package/src/Tooltip/Tooltip.test.tsx +68 -0
- package/src/Tooltip/useTooltip.tsx +55 -8
- package/src/TopNav/TopNav.test.tsx +50 -0
- package/src/TopNav/TopNavHeading.tsx +17 -1
- 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 +93 -9
- package/src/Typeahead/Typeahead.doc.mjs +141 -30
- package/src/Typeahead/Typeahead.test.tsx +331 -1
- package/src/Typeahead/Typeahead.tsx +105 -33
- 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/docs-script.test.mjs +50 -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/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 +10 -5
- 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
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import * as stylex from '@stylexjs/stylex';
|
|
7
7
|
import "../theme/tokens.stylex.js";
|
|
8
8
|
import { spacingVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
9
9
|
import { mergeProps } from "../utils/index.js";
|
|
10
|
+
import { INTERACTIVE_SELECTORS } from "../hooks/useClickableContainer.js";
|
|
10
11
|
import { Toast } from "./Toast.js";
|
|
11
12
|
import { ToastContext } from "./ToastContext.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -74,6 +75,39 @@ export function ToastViewport({
|
|
|
74
75
|
const [exitingIds, setExitingIds] = useState(new Set());
|
|
75
76
|
const toastsRef = useRef(toasts);
|
|
76
77
|
toastsRef.current = toasts;
|
|
78
|
+
|
|
79
|
+
// Show the popover on mount so it enters the top layer.
|
|
80
|
+
const viewportRef = useRef(null);
|
|
81
|
+
// The element that was focused before the user jumped into the viewport
|
|
82
|
+
// (via F6). Used to restore focus once all toasts are dismissed so focus
|
|
83
|
+
// never falls to <body>.
|
|
84
|
+
const prevFocusRef = useRef(null);
|
|
85
|
+
// When a toast is dismissed while focus lives inside it, we need to move
|
|
86
|
+
// focus to a sensible neighbor after that toast unmounts. This holds the
|
|
87
|
+
// id of the toast whose removal should trigger a focus handoff.
|
|
88
|
+
const focusHandoffIdRef = useRef(null);
|
|
89
|
+
// The next toast id that should receive focus once the dismissed toast has
|
|
90
|
+
// unmounted, or 'restore' to fall back to the previously-focused element.
|
|
91
|
+
const pendingFocusRef = useRef(null);
|
|
92
|
+
|
|
93
|
+
// Collect a focusable control within a toast node, if any.
|
|
94
|
+
// Reuses the canonical INTERACTIVE_SELECTORS list (native controls plus
|
|
95
|
+
// role-based interactive elements) instead of a hand-rolled subset, then
|
|
96
|
+
// narrows to the first candidate that can actually receive focus —
|
|
97
|
+
// excluding elements opted out with `tabindex="-1"` and disabled controls.
|
|
98
|
+
const getFocusable = useCallback(container => {
|
|
99
|
+
if (!container) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const candidates = container.querySelectorAll(INTERACTIVE_SELECTORS);
|
|
103
|
+
for (const candidate of candidates) {
|
|
104
|
+
if (candidate.getAttribute('tabindex') === '-1' || candidate.hasAttribute('disabled') || candidate.getAttribute('aria-disabled') === 'true') {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
return candidate;
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}, []);
|
|
77
111
|
const addToast = useCallback(entry => {
|
|
78
112
|
setToasts(prev => {
|
|
79
113
|
const {
|
|
@@ -97,6 +131,25 @@ export function ToastViewport({
|
|
|
97
131
|
if (entry) {
|
|
98
132
|
entry.options.onHide?.(reason);
|
|
99
133
|
}
|
|
134
|
+
// If focus currently lives inside the toast being dismissed, remember
|
|
135
|
+
// that its removal must hand focus off to a neighbor (or the element
|
|
136
|
+
// focused before the user entered the viewport) rather than <body>.
|
|
137
|
+
const el = viewportRef.current;
|
|
138
|
+
const active = document.activeElement;
|
|
139
|
+
const dismissedNode = el?.querySelector(`[data-toast-id="${id}"]`) ?? null;
|
|
140
|
+
if (dismissedNode && active instanceof Node && dismissedNode.contains(active)) {
|
|
141
|
+
focusHandoffIdRef.current = id;
|
|
142
|
+
// Pick the neighbor to receive focus while the DOM is still intact:
|
|
143
|
+
// prefer the next toast, then the previous, else restore.
|
|
144
|
+
const remaining = toastsRef.current.filter(t => t.id !== id);
|
|
145
|
+
if (remaining.length > 0) {
|
|
146
|
+
const dismissedIndex = toastsRef.current.findIndex(t => t.id === id);
|
|
147
|
+
const next = toastsRef.current[dismissedIndex + 1] ?? toastsRef.current[dismissedIndex - 1];
|
|
148
|
+
pendingFocusRef.current = next ? next.id : 'restore';
|
|
149
|
+
} else {
|
|
150
|
+
pendingFocusRef.current = 'restore';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
100
153
|
setExitingIds(prev => {
|
|
101
154
|
if (prev.has(id)) {
|
|
102
155
|
return prev;
|
|
@@ -115,6 +168,41 @@ export function ToastViewport({
|
|
|
115
168
|
});
|
|
116
169
|
setToasts(prev => prev.filter(t => t.id !== id));
|
|
117
170
|
}, []);
|
|
171
|
+
|
|
172
|
+
// After a dismissed toast unmounts, hand focus off so it never falls to
|
|
173
|
+
// <body>. Runs in a layout effect once the toast list no longer contains
|
|
174
|
+
// the dismissed toast.
|
|
175
|
+
useLayoutEffect(() => {
|
|
176
|
+
const handoffId = focusHandoffIdRef.current;
|
|
177
|
+
const target = pendingFocusRef.current;
|
|
178
|
+
if (handoffId == null || target == null) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// Wait until the dismissed toast is actually gone from the list.
|
|
182
|
+
if (toasts.some(t => t.id === handoffId)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
focusHandoffIdRef.current = null;
|
|
186
|
+
pendingFocusRef.current = null;
|
|
187
|
+
const el = viewportRef.current;
|
|
188
|
+
if (target !== 'restore' && el) {
|
|
189
|
+
const nextNode = el.querySelector(`[data-toast-id="${target}"]`);
|
|
190
|
+
const focusable = getFocusable(nextNode) ?? nextNode;
|
|
191
|
+
if (focusable) {
|
|
192
|
+
focusable.focus();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// No remaining toast to receive focus — restore the previously-focused
|
|
197
|
+
// element if it's still connected, else fall back to the container.
|
|
198
|
+
const prev = prevFocusRef.current;
|
|
199
|
+
prevFocusRef.current = null;
|
|
200
|
+
if (prev && prev.isConnected) {
|
|
201
|
+
prev.focus();
|
|
202
|
+
} else if (el) {
|
|
203
|
+
el.focus();
|
|
204
|
+
}
|
|
205
|
+
}, [toasts, getFocusable]);
|
|
118
206
|
const findByUniqueID = useCallback(uid => {
|
|
119
207
|
return toastsRef.current.find(t => t.options.uniqueID === uid);
|
|
120
208
|
}, []);
|
|
@@ -139,7 +227,6 @@ export function ToastViewport({
|
|
|
139
227
|
}
|
|
140
228
|
|
|
141
229
|
// Show the popover on mount so it enters the top layer
|
|
142
|
-
const viewportRef = useRef(null);
|
|
143
230
|
useEffect(() => {
|
|
144
231
|
if (!isTopLayer) {
|
|
145
232
|
return;
|
|
@@ -153,13 +240,53 @@ export function ToastViewport({
|
|
|
153
240
|
}
|
|
154
241
|
}
|
|
155
242
|
}, [isTopLayer]);
|
|
243
|
+
|
|
244
|
+
// F6 jumps focus into the toast viewport — the standard "go to
|
|
245
|
+
// notifications" affordance. Focus the first control in the newest toast,
|
|
246
|
+
// or the viewport container if none. Toasts are non-modal, so this only
|
|
247
|
+
// moves focus in; Shift+Tab / Escape let focus leave naturally.
|
|
248
|
+
const hasToasts = toasts.length > 0;
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
if (!hasToasts) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const handleKeyDown = e => {
|
|
254
|
+
if (e.key !== 'F6') {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const el = viewportRef.current;
|
|
258
|
+
if (!el) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
// Already inside the viewport — nothing to do.
|
|
262
|
+
const active = document.activeElement;
|
|
263
|
+
if (active instanceof Node && el.contains(active)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
// Remember where focus was so it can be restored on dismiss.
|
|
268
|
+
if (active instanceof HTMLElement) {
|
|
269
|
+
prevFocusRef.current = active;
|
|
270
|
+
}
|
|
271
|
+
// Newest toast is the last one rendered in the DOM.
|
|
272
|
+
const toastNodes = el.querySelectorAll('[data-toast-id]');
|
|
273
|
+
const newest = toastNodes[toastNodes.length - 1] ?? null;
|
|
274
|
+
const focusable = getFocusable(newest) ?? newest ?? el;
|
|
275
|
+
focusable.focus();
|
|
276
|
+
};
|
|
277
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
278
|
+
return () => {
|
|
279
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
280
|
+
};
|
|
281
|
+
}, [hasToasts, getFocusable]);
|
|
156
282
|
const posStyle = position === 'topEnd' ? styles.topEnd : position === 'topStart' ? styles.topStart : position === 'bottomStart' ? styles.bottomStart : styles.bottomEnd;
|
|
157
283
|
return /*#__PURE__*/_jsxs(ToastContext, {
|
|
158
284
|
value: contextValue,
|
|
159
285
|
children: [children, /*#__PURE__*/_jsx("div", {
|
|
160
286
|
ref: viewportRef,
|
|
161
287
|
role: "region",
|
|
162
|
-
"aria-label": "Notifications"
|
|
288
|
+
"aria-label": "Notifications",
|
|
289
|
+
tabIndex: -1
|
|
163
290
|
// popover="manual" promotes to the top layer (above dialogs).
|
|
164
291
|
// Omitted inside dialogs where the viewport is already in a top layer.
|
|
165
292
|
,
|
|
@@ -174,6 +301,7 @@ export function ToastViewport({
|
|
|
174
301
|
const dur = o.autoHideDuration ?? 5000;
|
|
175
302
|
const isExiting = exitingIds.has(entry.id);
|
|
176
303
|
return /*#__PURE__*/_jsx("div", {
|
|
304
|
+
"data-toast-id": entry.id,
|
|
177
305
|
...{
|
|
178
306
|
0: {
|
|
179
307
|
className: "x67bb7w xrvj5dj x1tu4anv xvmdzux xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7"
|
|
@@ -97,6 +97,17 @@ export interface TokenizerProps<T extends SearchableItem> extends Omit<BaseProps
|
|
|
97
97
|
emptySearchResultsText?: string;
|
|
98
98
|
/** Whether the input is disabled. @default false */
|
|
99
99
|
isDisabled?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Explains why the tokenizer is disabled. When set together with
|
|
102
|
+
* `isDisabled`, the tokenizer shows a tooltip with this text on hover and
|
|
103
|
+
* keyboard focus, and the input stays focusable (via `aria-disabled`) so the
|
|
104
|
+
* reason is discoverable by keyboard and assistive technology. Input stays
|
|
105
|
+
* blocked.
|
|
106
|
+
*
|
|
107
|
+
* Use this instead of wrapping a disabled tokenizer in `Tooltip` — disabled
|
|
108
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
109
|
+
*/
|
|
110
|
+
disabledMessage?: string;
|
|
100
111
|
/** Show clear button (clears all tokens). @default false */
|
|
101
112
|
hasClear?: boolean;
|
|
102
113
|
/**
|
|
@@ -178,7 +189,7 @@ export interface TokenizerProps<T extends SearchableItem> extends Omit<BaseProps
|
|
|
178
189
|
* />
|
|
179
190
|
* ```
|
|
180
191
|
*/
|
|
181
|
-
export declare function Tokenizer<T extends SearchableItem>({ label, isLabelHidden, description, isRequired, isOptional, status, startIcon, labelTooltip, searchSource, value, onChange, renderItem, renderToken, maxEntries, placeholder, hasEntriesOnFocus, maxMenuItems, emptySearchResultsText, isDisabled, hasClear, endContent, hasAutoFocus, size: sizeProp, tokenOverflowBehavior, debounceMs, hasCreate, onChangeQuery, onFocus, onBlur, width, xstyle, className, style, 'data-testid': testId, ref, handleRef, }: TokenizerProps<T>): React.JSX.Element;
|
|
192
|
+
export declare function Tokenizer<T extends SearchableItem>({ label, isLabelHidden, description, isRequired, isOptional, status, startIcon, labelTooltip, searchSource, value, onChange, renderItem, renderToken, maxEntries, placeholder, hasEntriesOnFocus, maxMenuItems, emptySearchResultsText, isDisabled, disabledMessage, hasClear, endContent, hasAutoFocus, size: sizeProp, tokenOverflowBehavior, debounceMs, hasCreate, onChangeQuery, onFocus, onBlur, width, xstyle, className, style, 'data-testid': testId, ref, handleRef, }: TokenizerProps<T>): React.JSX.Element;
|
|
182
193
|
export declare namespace Tokenizer {
|
|
183
194
|
var displayName: string;
|
|
184
195
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tokenizer.d.ts","sourceRoot":"","sources":["../../src/Tokenizer/Tokenizer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAGL,KAAK,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,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,UAAkB,EAClB,eAAe,EACf,QAAgB,EAChB,UAAU,EACV,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,qBAA8B,EAC9B,UAAU,EACV,SAAiB,EACjB,aAAa,EACb,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,SAAS,GACV,EAAE,cAAc,CAAC,CAAC,CAAC,qBA0dnB;yBAhgBe,SAAS"}
|
|
@@ -23,6 +23,7 @@ import { Token } from "../Token/index.js";
|
|
|
23
23
|
import { renderIconSlot } from "../Icon/index.js";
|
|
24
24
|
import { OverflowList } from "../OverflowList/index.js";
|
|
25
25
|
import { useLayer } from "../Layer/useLayer.js";
|
|
26
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
26
27
|
import "../theme/tokens.stylex.js";
|
|
27
28
|
import { colorVars, spacingVars, sizeVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
28
29
|
import { mergeProps } from "../utils/index.js";
|
|
@@ -234,6 +235,7 @@ export function Tokenizer({
|
|
|
234
235
|
maxMenuItems,
|
|
235
236
|
emptySearchResultsText,
|
|
236
237
|
isDisabled = false,
|
|
238
|
+
disabledMessage,
|
|
237
239
|
hasClear = false,
|
|
238
240
|
endContent,
|
|
239
241
|
hasAutoFocus,
|
|
@@ -258,6 +260,19 @@ export function Tokenizer({
|
|
|
258
260
|
const statusMessageId = useId();
|
|
259
261
|
const inputRef = useRef(null);
|
|
260
262
|
const wrapperRef = useRef(null);
|
|
263
|
+
|
|
264
|
+
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
265
|
+
// tooltip listeners attach to the input wrapper and the typeahead input stays
|
|
266
|
+
// perceivable via aria-disabled instead of the disabled attribute. Input is
|
|
267
|
+
// blocked by the isDisabled guards in BaseTypeahead and handleWrapperClick.
|
|
268
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
269
|
+
const disabledMessageTooltip = useTooltip({
|
|
270
|
+
placement: 'above',
|
|
271
|
+
// The wrapper is not naturally focusable; focusin bubbles up from the
|
|
272
|
+
// input, so always attach focus listeners.
|
|
273
|
+
focusTrigger: 'always',
|
|
274
|
+
isEnabled: showsDisabledMessage
|
|
275
|
+
});
|
|
261
276
|
useImperativeHandle(handleRef, () => ({
|
|
262
277
|
focus() {
|
|
263
278
|
inputRef.current?.focus();
|
|
@@ -452,7 +467,7 @@ export function Tokenizer({
|
|
|
452
467
|
}
|
|
453
468
|
}
|
|
454
469
|
}, [isDisabled, isLayerMode, layer]);
|
|
455
|
-
const ariaDescribedBy = [description ? descriptionId : null, status?.message ? statusMessageId : null].filter(Boolean).join(' ') || undefined;
|
|
470
|
+
const ariaDescribedBy = [description ? descriptionId : null, status?.message ? statusMessageId : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
456
471
|
const sizeStyle = sizeStyles[size];
|
|
457
472
|
|
|
458
473
|
// Render tokens
|
|
@@ -481,7 +496,13 @@ export function Tokenizer({
|
|
|
481
496
|
left: 'anchor(start)'
|
|
482
497
|
};
|
|
483
498
|
const wrapperContent = /*#__PURE__*/_jsxs("div", {
|
|
484
|
-
ref:
|
|
499
|
+
ref: el => {
|
|
500
|
+
wrapperRef.current = el;
|
|
501
|
+
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
502
|
+
// Handlers are gated internally by isEnabled, so attaching
|
|
503
|
+
// unconditionally is safe.
|
|
504
|
+
disabledMessageTooltip.ref(el);
|
|
505
|
+
},
|
|
485
506
|
role: "group",
|
|
486
507
|
"aria-label": label,
|
|
487
508
|
onClick: handleWrapperClick,
|
|
@@ -524,6 +545,7 @@ export function Tokenizer({
|
|
|
524
545
|
maxMenuItems: maxMenuItems,
|
|
525
546
|
emptySearchResultsText: emptySearchResultsText,
|
|
526
547
|
isDisabled: isDisabled,
|
|
548
|
+
isFocusableDisabled: showsDisabledMessage,
|
|
527
549
|
hasAutoFocus: hasAutoFocus,
|
|
528
550
|
inputId: inputId,
|
|
529
551
|
ariaDescribedBy: ariaDescribedBy,
|
|
@@ -586,7 +608,7 @@ export function Tokenizer({
|
|
|
586
608
|
} else {
|
|
587
609
|
tokenizerContent = wrapperContent;
|
|
588
610
|
}
|
|
589
|
-
return /*#__PURE__*/
|
|
611
|
+
return /*#__PURE__*/_jsxs(Field, {
|
|
590
612
|
ref: ref,
|
|
591
613
|
label: label,
|
|
592
614
|
isLabelHidden: isLabelHidden,
|
|
@@ -606,7 +628,7 @@ export function Tokenizer({
|
|
|
606
628
|
xstyle: xstyle,
|
|
607
629
|
className: className,
|
|
608
630
|
style: style,
|
|
609
|
-
children: tokenizerContent
|
|
631
|
+
children: [tokenizerContent, showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
610
632
|
});
|
|
611
633
|
}
|
|
612
634
|
Tokenizer.displayName = 'Tokenizer';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Toolbar.tsx
|
|
3
|
-
* @input Uses Section, SizeContext, useListFocus, StyleX, spacingVars, sizeVars
|
|
3
|
+
* @input Uses Section, SizeContext, useListFocus, useKeyboardHint, StyleX, spacingVars, sizeVars
|
|
4
4
|
* @output Exports Toolbar component and ToolbarProps
|
|
5
5
|
* @position Core implementation; consumed by index.ts
|
|
6
6
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - /apps/storybook/stories/Toolbar.stories.tsx
|
|
12
12
|
* - /packages/cli/templates/blocks/components/Toolbar/ (showcase blocks)
|
|
13
13
|
*/
|
|
14
|
-
import type
|
|
14
|
+
import { type ReactNode } from 'react';
|
|
15
15
|
import type { BaseProps } from '../BaseProps';
|
|
16
16
|
import type { SectionVariant } from '../Section/Section';
|
|
17
17
|
import type { SpacingStep } from '../utils/types';
|
|
@@ -90,7 +90,7 @@ export interface ToolbarProps extends BaseProps<HTMLDivElement> {
|
|
|
90
90
|
* />
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare function Toolbar({ startContent, centerContent, endContent, label, size, gap, orientation, variant, dividers, xstyle, className, style, ref, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
93
|
+
export declare function Toolbar({ startContent, centerContent, endContent, label, size, gap, orientation, variant, dividers, xstyle, className, style, ref, onKeyDown: onKeyDownProp, onFocus: onFocusProp, onBlur: onBlurProp, role: _role, 'aria-label': _ariaLabel, 'aria-orientation': _ariaOrientation, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
94
94
|
export declare namespace Toolbar {
|
|
95
95
|
var displayName: string;
|
|
96
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAqH5D,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC;AAEtC,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC7D,gDAAgD;IAChD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,KAAK,EACL,IAAW,EACX,GAAO,EACP,WAA0B,EAC1B,OAAuB,EACvB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,KAAK,EACX,YAAY,EAAE,UAAU,EACxB,kBAAkB,EAAE,gBAAgB,EACpC,GAAG,KAAK,EACT,EAAE,YAAY,+BA+Id;yBApKe,OAAO"}
|
package/dist/Toolbar/Toolbar.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Toolbar.tsx
|
|
7
|
-
* @input Uses Section, SizeContext, useListFocus, StyleX, spacingVars, sizeVars
|
|
7
|
+
* @input Uses Section, SizeContext, useListFocus, useKeyboardHint, StyleX, spacingVars, sizeVars
|
|
8
8
|
* @output Exports Toolbar component and ToolbarProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
* - /apps/storybook/stories/Toolbar.stories.tsx
|
|
16
16
|
* - /packages/cli/templates/blocks/components/Toolbar/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
+
import { useCallback } from 'react';
|
|
18
19
|
import * as stylex from '@stylexjs/stylex';
|
|
19
20
|
import "../theme/tokens.stylex.js";
|
|
20
21
|
import { spacingVars, sizeVars } from "../theme/tokens.stylex.js";
|
|
21
22
|
import { mergeProps } from "../utils/index.js";
|
|
22
23
|
import { Section } from "../Section/Section.js";
|
|
23
24
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
25
|
+
import { useKeyboardHint } from "../hooks/useKeyboardHint.js";
|
|
24
26
|
import { SizeProvider } from "../SizeContext/SizeContext.js";
|
|
25
27
|
import { edgeCompSlot } from "../Layout/edgeCompensation.stylex.js";
|
|
26
28
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -167,6 +169,12 @@ export function Toolbar({
|
|
|
167
169
|
className,
|
|
168
170
|
style,
|
|
169
171
|
ref,
|
|
172
|
+
onKeyDown: onKeyDownProp,
|
|
173
|
+
onFocus: onFocusProp,
|
|
174
|
+
onBlur: onBlurProp,
|
|
175
|
+
role: _role,
|
|
176
|
+
'aria-label': _ariaLabel,
|
|
177
|
+
'aria-orientation': _ariaOrientation,
|
|
170
178
|
...props
|
|
171
179
|
}) {
|
|
172
180
|
const hasCenterContent = centerContent != null;
|
|
@@ -175,11 +183,45 @@ export function Toolbar({
|
|
|
175
183
|
const gapVar = spacingVars[spacingStepToVar[gap]];
|
|
176
184
|
const {
|
|
177
185
|
listRef,
|
|
178
|
-
handleKeyDown
|
|
186
|
+
handleKeyDown,
|
|
187
|
+
handleFocus
|
|
179
188
|
} = useListFocus({
|
|
180
|
-
itemSelector: 'button, input, [tabindex
|
|
189
|
+
itemSelector: 'button, input, [tabindex]',
|
|
190
|
+
orientation,
|
|
191
|
+
hasRovingTabIndex: true,
|
|
192
|
+
hasCaretGuard: true
|
|
193
|
+
});
|
|
194
|
+
const {
|
|
195
|
+
hintElement,
|
|
196
|
+
onKeyDown: onHintKeyDown,
|
|
197
|
+
onFocus: onHintFocus,
|
|
198
|
+
onBlur: onHintBlur
|
|
199
|
+
} = useKeyboardHint({
|
|
181
200
|
orientation
|
|
182
201
|
});
|
|
202
|
+
const handleToolbarKeyDown = useCallback(e => {
|
|
203
|
+
onKeyDownProp?.(e);
|
|
204
|
+
if (e.defaultPrevented) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
onHintKeyDown(e);
|
|
208
|
+
handleKeyDown(e);
|
|
209
|
+
}, [onKeyDownProp, onHintKeyDown, handleKeyDown]);
|
|
210
|
+
const handleToolbarFocus = useCallback(e => {
|
|
211
|
+
onFocusProp?.(e);
|
|
212
|
+
if (e.defaultPrevented) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
onHintFocus(e);
|
|
216
|
+
handleFocus(e);
|
|
217
|
+
}, [onFocusProp, onHintFocus, handleFocus]);
|
|
218
|
+
const handleToolbarBlur = useCallback(e => {
|
|
219
|
+
onBlurProp?.(e);
|
|
220
|
+
if (e.defaultPrevented) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
onHintBlur(e);
|
|
224
|
+
}, [onBlurProp, onHintBlur]);
|
|
183
225
|
return /*#__PURE__*/_jsx(SizeProvider, {
|
|
184
226
|
value: size,
|
|
185
227
|
children: /*#__PURE__*/_jsx(Section, {
|
|
@@ -190,17 +232,19 @@ export function Toolbar({
|
|
|
190
232
|
xstyle: xstyle,
|
|
191
233
|
className: className,
|
|
192
234
|
style: style,
|
|
193
|
-
children: /*#__PURE__*/
|
|
235
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
194
236
|
ref: listRef,
|
|
195
237
|
role: "toolbar",
|
|
196
238
|
"aria-label": label,
|
|
197
239
|
"aria-orientation": orientation,
|
|
198
|
-
onKeyDown:
|
|
240
|
+
onKeyDown: handleToolbarKeyDown,
|
|
241
|
+
onFocus: handleToolbarFocus,
|
|
242
|
+
onBlur: handleToolbarBlur,
|
|
199
243
|
...mergeProps(themeProps('toolbar', {
|
|
200
244
|
size
|
|
201
245
|
}), stylex.props(hasCenterContent ? styles.baseGrid : styles.baseFlex, orientation === 'vertical' && styles.vertical, sizeStyles.base, dynamicStyles.gap(gapVar), dynamicStyles.tabIndicatorBottom(`calc(-1 * (${blockPaddingVarForSize[size]}${dividers?.includes('bottom') ? ' + 1px' : ''}))`))),
|
|
202
246
|
...props,
|
|
203
|
-
children: hasCenterContent ?
|
|
247
|
+
children: [hasCenterContent ?
|
|
204
248
|
/*#__PURE__*/
|
|
205
249
|
// Three-slot grid layout
|
|
206
250
|
_jsxs(_Fragment, {
|
|
@@ -225,7 +269,7 @@ export function Toolbar({
|
|
|
225
269
|
...stylex.props(styles.endSlot, !hasStartContent && styles.endOnly, edgeCompSlot.inset(edgeCompInsetForSize[size]), dynamicStyles.gap(gapVar)),
|
|
226
270
|
children: endContent
|
|
227
271
|
})]
|
|
228
|
-
})
|
|
272
|
+
}), hintElement]
|
|
229
273
|
})
|
|
230
274
|
})
|
|
231
275
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cA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,14 @@ import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
|
18
18
|
import { themeProps } from "../utils/themeProps.js";
|
|
19
19
|
import "../theme/tokens.stylex.js";
|
|
20
20
|
import { colorVars, radiusVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Grace period (ms) before hiding on pointer-leave when no explicit `hideDelay`
|
|
24
|
+
* is set, so the pointer can travel across the small gap from the trigger onto
|
|
25
|
+
* the tooltip surface without the tooltip disappearing (WCAG 1.4.13 hoverable).
|
|
26
|
+
*/
|
|
21
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
const HOVER_BRIDGE_DELAY = 100;
|
|
22
29
|
const styles = {
|
|
23
30
|
container: {
|
|
24
31
|
kWkggS: "x19aspcf",
|
|
@@ -143,21 +150,29 @@ export function useTooltip(options = {}) {
|
|
|
143
150
|
}, delay);
|
|
144
151
|
}, [isEnabled, isOpen, clearTimeouts, layer, delay]);
|
|
145
152
|
|
|
146
|
-
// Schedule hide with delay (suppressed when isOpen is true)
|
|
153
|
+
// Schedule hide with delay (suppressed when isOpen is true).
|
|
154
|
+
// A small hover bridge (when hideDelay is 0) lets the pointer travel from the
|
|
155
|
+
// trigger onto the tooltip surface without the tooltip vanishing — required
|
|
156
|
+
// for WCAG 1.4.13 (Content on Hover or Focus: hoverable).
|
|
147
157
|
const scheduleHide = useCallback(() => {
|
|
148
158
|
if (isOpen === true) {
|
|
149
159
|
return;
|
|
150
160
|
}
|
|
151
161
|
clearTimeouts();
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
layer.hide();
|
|
155
|
-
}, hideDelay);
|
|
156
|
-
} else {
|
|
162
|
+
const effectiveHideDelay = hideDelay > 0 ? hideDelay : HOVER_BRIDGE_DELAY;
|
|
163
|
+
hideTimeoutRef.current = setTimeout(() => {
|
|
157
164
|
layer.hide();
|
|
158
|
-
}
|
|
165
|
+
}, effectiveHideDelay);
|
|
159
166
|
}, [isOpen, clearTimeouts, layer, hideDelay]);
|
|
160
167
|
|
|
168
|
+
// Cancel a pending hide (e.g. the pointer entered the tooltip surface).
|
|
169
|
+
const cancelHide = useCallback(() => {
|
|
170
|
+
if (hideTimeoutRef.current) {
|
|
171
|
+
clearTimeout(hideTimeoutRef.current);
|
|
172
|
+
hideTimeoutRef.current = null;
|
|
173
|
+
}
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
161
176
|
// Event handlers
|
|
162
177
|
const handleMouseEnter = useCallback(() => {
|
|
163
178
|
// Suppress tooltips on touch devices — hover is simulated and eats a tap
|
|
@@ -245,6 +260,32 @@ export function useTooltip(options = {}) {
|
|
|
245
260
|
}
|
|
246
261
|
}, [isOpen, clearTimeouts, layer]);
|
|
247
262
|
|
|
263
|
+
// Dismiss on Escape (WCAG 1.4.13 — dismissible). Uncontrolled tooltips only;
|
|
264
|
+
// a controlled tooltip's visibility is owned by the consumer. The listener is
|
|
265
|
+
// mounted for the lifetime of an uncontrolled tooltip rather than gated on
|
|
266
|
+
// `layer.isOpen` (React state, which can lag a frame behind the DOM) —
|
|
267
|
+
// `layer.hide()` self-guards and no-ops when the layer is already closed.
|
|
268
|
+
// Guarded against IME composition-cancel.
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
if (isOpen !== undefined) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const handleKeyDown = e => {
|
|
274
|
+
if (e.key !== 'Escape') {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (e.isComposing || e.keyCode === 229) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
clearTimeouts();
|
|
281
|
+
layer.hide();
|
|
282
|
+
};
|
|
283
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
284
|
+
return () => {
|
|
285
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
286
|
+
};
|
|
287
|
+
}, [isOpen, layer, clearTimeouts]);
|
|
288
|
+
|
|
248
289
|
// Render function that wraps layer.render with tooltip styling
|
|
249
290
|
const renderTooltip = useCallback((children, props) => {
|
|
250
291
|
const renderPlacement = props?.placement ?? placement;
|
|
@@ -253,7 +294,13 @@ export function useTooltip(options = {}) {
|
|
|
253
294
|
alignment: props?.alignment ?? alignment,
|
|
254
295
|
role: 'tooltip',
|
|
255
296
|
xstyle: [popoverXstyle, layerAnimations[renderPlacement]],
|
|
256
|
-
className: themeProps('tooltip').className
|
|
297
|
+
className: themeProps('tooltip').className,
|
|
298
|
+
// Keep the tooltip open while the pointer is over the surface itself
|
|
299
|
+
// (WCAG 1.4.13 hoverable). These sit on the layer container — the
|
|
300
|
+
// element the user actually hovers — not the inner content div, since
|
|
301
|
+
// mouseenter/leave do not bubble.
|
|
302
|
+
onMouseEnter: cancelHide,
|
|
303
|
+
onMouseLeave: scheduleHide
|
|
257
304
|
};
|
|
258
305
|
return layer.render(/*#__PURE__*/_jsx("div", {
|
|
259
306
|
...{
|
|
@@ -261,7 +308,7 @@ export function useTooltip(options = {}) {
|
|
|
261
308
|
},
|
|
262
309
|
children: children
|
|
263
310
|
}), renderProps);
|
|
264
|
-
}, [layer, placement, alignment, popoverXstyle]);
|
|
311
|
+
}, [layer, placement, alignment, popoverXstyle, cancelHide, scheduleHide]);
|
|
265
312
|
return {
|
|
266
313
|
ref,
|
|
267
314
|
positionRef: layer.ref,
|
|
@@ -26,6 +26,12 @@ export interface TopNavHeadingProps extends BaseProps<HTMLElement> {
|
|
|
26
26
|
* Can be an image, NavIcon, or any ReactNode.
|
|
27
27
|
*/
|
|
28
28
|
logo?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Accessible name for the logo when it links somewhere (`headingHref`) and
|
|
31
|
+
* has no adjacent text to name it (for example a logo-only heading). Defaults
|
|
32
|
+
* to `heading` when available. Ignored when the logo is not a link.
|
|
33
|
+
*/
|
|
34
|
+
logoLabel?: string;
|
|
29
35
|
/**
|
|
30
36
|
* Product/app name.
|
|
31
37
|
*/
|
|
@@ -99,7 +105,7 @@ export interface TopNavHeadingProps extends BaseProps<HTMLElement> {
|
|
|
99
105
|
* />
|
|
100
106
|
* ```
|
|
101
107
|
*/
|
|
102
|
-
export declare function TopNavHeading({ as, logo, heading, headingHref: headingHrefProp, href, superheading, superheadingHref, subheading, subheadingHref, headerEndContent, menu, xstyle, className, style, 'data-testid': testId, ref, ...props }: TopNavHeadingProps): import("react").JSX.Element;
|
|
108
|
+
export declare function TopNavHeading({ as, logo, logoLabel, heading, headingHref: headingHrefProp, href, superheading, superheadingHref, subheading, subheadingHref, headerEndContent, menu, xstyle, className, style, 'data-testid': testId, ref, ...props }: TopNavHeadingProps): import("react").JSX.Element;
|
|
103
109
|
export declare namespace TopNavHeading {
|
|
104
110
|
var displayName: string;
|
|
105
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNavHeading.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavHeading.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAkB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAatD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA2K5C,MAAM,WAAW,kBAAmB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC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IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,EAAE,EACF,IAAI,EACJ,SAAS,EACT,OAAO,EACP,WAAW,EAAE,eAAe,EAC5B,IAAI,EACJ,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,KAAK,EACT,EAAE,kBAAkB,+BA2VpB;yBA9We,aAAa"}
|
|
@@ -106,6 +106,7 @@ const styles = {
|
|
|
106
106
|
export function TopNavHeading({
|
|
107
107
|
as,
|
|
108
108
|
logo,
|
|
109
|
+
logoLabel,
|
|
109
110
|
heading,
|
|
110
111
|
headingHref: headingHrefProp,
|
|
111
112
|
href,
|
|
@@ -125,6 +126,10 @@ export function TopNavHeading({
|
|
|
125
126
|
const LinkComponent = useLinkComponent(as);
|
|
126
127
|
// Support both headingHref and legacy href
|
|
127
128
|
const headingHref = headingHrefProp ?? href;
|
|
129
|
+
// When the logo is wrapped in a link it needs its own accessible name (the
|
|
130
|
+
// logo image itself is decorative). Prefer an explicit logoLabel, fall back
|
|
131
|
+
// to the heading text. axe: link-name.
|
|
132
|
+
const logoLinkLabel = logoLabel ?? heading;
|
|
128
133
|
const rootRef = useRef(null);
|
|
129
134
|
const popover = usePopover({
|
|
130
135
|
dialogLabel: 'Navigation menu',
|
|
@@ -239,6 +244,7 @@ export function TopNavHeading({
|
|
|
239
244
|
return /*#__PURE__*/_jsx(Element, {
|
|
240
245
|
ref: ref,
|
|
241
246
|
href: headingHref,
|
|
247
|
+
"aria-label": headingHref ? logoLabel : undefined,
|
|
242
248
|
"data-testid": testId,
|
|
243
249
|
...mergeProps(themeProps('top-nav-heading'), stylex.props(styles.root, !!headingHref && styles.menuTrigger, xstyle), className, style),
|
|
244
250
|
...props,
|
|
@@ -323,6 +329,7 @@ export function TopNavHeading({
|
|
|
323
329
|
...mergeProps(themeProps('top-nav-heading'), stylex.props(styles.root, xstyle), className, style),
|
|
324
330
|
children: [logo && (headingHref ? /*#__PURE__*/_jsx(LinkComponent, {
|
|
325
331
|
href: headingHref,
|
|
332
|
+
"aria-label": logoLinkLabel,
|
|
326
333
|
onClick: e => e.stopPropagation(),
|
|
327
334
|
...{
|
|
328
335
|
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k"
|
|
@@ -374,6 +381,7 @@ export function TopNavHeading({
|
|
|
374
381
|
...props,
|
|
375
382
|
children: [logo && (headingHref ? /*#__PURE__*/_jsx(LinkComponent, {
|
|
376
383
|
href: headingHref,
|
|
384
|
+
"aria-label": logoLinkLabel,
|
|
377
385
|
...{
|
|
378
386
|
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k"
|
|
379
387
|
},
|