@astryxdesign/core 0.1.2 → 0.1.3-canary.102854d
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 +31 -12
- 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 +124 -61
- package/dist/Calendar/dayCellUtils.d.ts +67 -5
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/dayCellUtils.js +139 -18
- 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 +12 -5
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +96 -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 +13 -9
- 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 +79 -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 +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/rowExpansion/index.d.ts +3 -0
- package/dist/Table/plugins/rowExpansion/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowExpansion/index.js +3 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +90 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +398 -0
- 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 +37 -0
- package/dist/Table/tableContextMenu.d.ts.map +1 -0
- package/dist/Table/tableContextMenu.js +140 -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 +22 -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.doc.mjs +2 -2
- 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 +42 -22
- 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 +247 -30
- package/src/Calendar/Calendar.tsx +173 -86
- package/src/Calendar/dayCellUtils.test.ts +306 -1
- package/src/Calendar/dayCellUtils.ts +206 -13
- 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 +129 -16
- package/src/DateInput/DateInput.doc.mjs +291 -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/__tests__/edgeCompensation.test.tsx +72 -0
- 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 +35 -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 +31 -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 +9 -3
- 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 +24 -18
- 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 +105 -24
- package/src/Table/TableHeaderCell.tsx +28 -29
- package/src/Table/index.ts +8 -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/rowExpansion/index.ts +7 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +155 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +590 -0
- 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 +181 -0
- package/src/Table/tableContextMenu.tsx +160 -0
- package/src/Table/types.ts +74 -0
- package/src/Table/useTableColumnResize.doc.mjs +3 -3
- package/src/Table/useTablePagination.doc.mjs +4 -1
- package/src/Table/useTableRowExpansion.doc.mjs +63 -0
- package/src/Table/useTableSortable.doc.mjs +4 -1
- 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 +345 -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 +146 -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
|
@@ -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,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAsD3B;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,kBAAkB,KAAK,SAAS,CAAC;CAC/E;AAyBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CA+PtE"}
|
|
@@ -18,7 +18,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;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,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,+
|
|
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;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;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;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
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TreeList.tsx
|
|
3
|
-
* @input Uses React, StyleX, theme tokens, TreeListItem, TreeListTypes
|
|
3
|
+
* @input Uses React, StyleX, theme tokens, TreeListItem, TreeListTypes, useTreeFocus
|
|
4
4
|
* @output Exports TreeList component, TreeListProps type
|
|
5
5
|
* @position Core implementation; consumed by index.ts
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeList.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeList.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAQvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAE1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAuED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,OAAoB,EACpB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,EAAE,aAAa,+BAgJf;yBAzJe,QAAQ"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TreeList.tsx
|
|
7
|
-
* @input Uses React, StyleX, theme tokens, TreeListItem, TreeListTypes
|
|
7
|
+
* @input Uses React, StyleX, theme tokens, TreeListItem, TreeListTypes, useTreeFocus
|
|
8
8
|
* @output Exports TreeList component, TreeListProps type
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -21,6 +21,7 @@ import { spacingVars } from "../theme/tokens.stylex.js";
|
|
|
21
21
|
import { mergeProps } from "../utils/index.js";
|
|
22
22
|
import { TreeListItem } from "./TreeListItem.js";
|
|
23
23
|
import { themeProps } from "../utils/themeProps.js";
|
|
24
|
+
import { useTreeFocus } from "../hooks/useTreeFocus.js";
|
|
24
25
|
|
|
25
26
|
// =============================================================================
|
|
26
27
|
// Types
|
|
@@ -55,6 +56,35 @@ function collectExpandedKeys(items) {
|
|
|
55
56
|
return keys;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Compute the initial roving-tabindex seed: the first selected enabled item in
|
|
61
|
+
* document order, else the first enabled item, else the first item. The hook
|
|
62
|
+
* (useTreeFocus with hasRovingTabIndex) takes ownership after mount — it
|
|
63
|
+
* preserves this seeded `tabindex="0"` on its repair pass and moves the stop
|
|
64
|
+
* with keyboard navigation.
|
|
65
|
+
*/
|
|
66
|
+
function findInitialTabbableId(items) {
|
|
67
|
+
let firstEnabled;
|
|
68
|
+
const walk = list => {
|
|
69
|
+
for (const item of list) {
|
|
70
|
+
if (item.isSelected && item.isDisabled !== true) {
|
|
71
|
+
return item.id;
|
|
72
|
+
}
|
|
73
|
+
if (firstEnabled == null && item.isDisabled !== true) {
|
|
74
|
+
firstEnabled = item.id;
|
|
75
|
+
}
|
|
76
|
+
if (item.children != null && item.children.length > 0) {
|
|
77
|
+
const selected = walk(item.children);
|
|
78
|
+
if (selected != null) {
|
|
79
|
+
return selected;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
};
|
|
85
|
+
return walk(items) ?? firstEnabled ?? items[0]?.id;
|
|
86
|
+
}
|
|
87
|
+
|
|
58
88
|
// =============================================================================
|
|
59
89
|
// Component
|
|
60
90
|
// =============================================================================
|
|
@@ -106,6 +136,40 @@ export function TreeList({
|
|
|
106
136
|
return next;
|
|
107
137
|
});
|
|
108
138
|
}, [expandedKeysFromProps]);
|
|
139
|
+
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
// Roving tabindex + APG tree keyboard model (via useTreeFocus)
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
// The hook (hasRovingTabIndex) owns the tree's single tab stop: it repairs
|
|
145
|
+
// the stop on mount and moves it with keyboard navigation. We only seed the
|
|
146
|
+
// initially-tabbable treeitem in the render (selected item or first enabled);
|
|
147
|
+
// the hook's repair pass preserves that seeded `tabindex="0"`.
|
|
148
|
+
const initialTabbableId = useMemo(() => findInitialTabbableId(items), [items]);
|
|
149
|
+
|
|
150
|
+
// Enter/Space activation: prefer the treeitem's own inner action (link or
|
|
151
|
+
// button); return true when handled so the hook does not also toggle. Scoped
|
|
152
|
+
// to this treeitem's own row — never a descendant treeitem's action inside an
|
|
153
|
+
// expanded group.
|
|
154
|
+
const activateItem = useCallback(current => {
|
|
155
|
+
const candidates = current.querySelectorAll('a[href], button:not([aria-label="Toggle children"])');
|
|
156
|
+
for (const candidate of candidates) {
|
|
157
|
+
if (candidate.closest('[role="treeitem"]') === current) {
|
|
158
|
+
candidate.click();
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}, []);
|
|
164
|
+
const {
|
|
165
|
+
treeRef,
|
|
166
|
+
handleKeyDown,
|
|
167
|
+
handleFocus
|
|
168
|
+
} = useTreeFocus({
|
|
169
|
+
onToggleExpand: handleToggle,
|
|
170
|
+
onActivate: activateItem,
|
|
171
|
+
hasRovingTabIndex: true
|
|
172
|
+
});
|
|
109
173
|
function renderItems(items, nestedLevel, ancestorsIsLast) {
|
|
110
174
|
return items.map((item, index) => {
|
|
111
175
|
const isLast = index === items.length - 1;
|
|
@@ -131,7 +195,10 @@ export function TreeList({
|
|
|
131
195
|
isExpanded: isExpanded,
|
|
132
196
|
onToggle: handleToggle,
|
|
133
197
|
density: density,
|
|
134
|
-
renderedChildren: renderedChildren
|
|
198
|
+
renderedChildren: renderedChildren,
|
|
199
|
+
posInSet: index + 1,
|
|
200
|
+
setSize: items.length,
|
|
201
|
+
isTabbable: item.id === initialTabbableId
|
|
135
202
|
}, item.id);
|
|
136
203
|
});
|
|
137
204
|
}
|
|
@@ -148,8 +215,11 @@ export function TreeList({
|
|
|
148
215
|
},
|
|
149
216
|
children: header
|
|
150
217
|
}), /*#__PURE__*/_jsx("ul", {
|
|
218
|
+
ref: treeRef,
|
|
151
219
|
role: "tree",
|
|
152
220
|
"aria-labelledby": header != null ? headerId : undefined,
|
|
221
|
+
onKeyDown: handleKeyDown,
|
|
222
|
+
onFocus: handleFocus,
|
|
153
223
|
...{
|
|
154
224
|
className: "x1ghz6dp x1717udv x3ct3a4"
|
|
155
225
|
},
|
|
@@ -31,8 +31,18 @@ export interface TreeListItemInternalProps {
|
|
|
31
31
|
density: TreeListDensity;
|
|
32
32
|
/** Pre-rendered children subtree (rendered by the parent recursion) */
|
|
33
33
|
renderedChildren?: ReactNode;
|
|
34
|
+
/** 1-based position of this item among its siblings (aria-posinset). */
|
|
35
|
+
posInSet: number;
|
|
36
|
+
/** Number of siblings at this level (aria-setsize). */
|
|
37
|
+
setSize: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this treeitem is the initial roving-tabindex seed. Exactly one
|
|
40
|
+
* treeitem is seeded tabbable at mount; useTreeFocus (hasRovingTabIndex)
|
|
41
|
+
* then owns the tab stop dynamically.
|
|
42
|
+
*/
|
|
43
|
+
isTabbable: boolean;
|
|
34
44
|
}
|
|
35
|
-
export declare function TreeListItem({ id, label, description, startContent, endContent, onClick, href, target, isDisabled, isSelected, hasChildren, nestedLevel, isLast, ancestorsIsLast, isExpanded, onToggle, density, renderedChildren, }: TreeListItemInternalProps): import("react").JSX.Element;
|
|
45
|
+
export declare function TreeListItem({ id, label, description, startContent, endContent, onClick, href, target, isDisabled, isSelected, hasChildren, nestedLevel, isLast, ancestorsIsLast, isExpanded, onToggle, density, renderedChildren, posInSet, setSize, isTabbable, }: TreeListItemInternalProps): import("react").JSX.Element;
|
|
36
46
|
export declare namespace TreeListItem {
|
|
37
47
|
var displayName: string;
|
|
38
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeListItem.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeListItem.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAoNrD,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,eAAe,CAAC;IACzB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAMD,wBAAgB,YAAY,CAAC,EAC3B,EAAE,EACF,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAkB,EAClB,UAAkB,EAClB,WAAW,EACX,WAAW,EACX,MAAM,EACN,eAAe,EACf,UAAU,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,UAAU,GACX,EAAE,yBAAyB,+BA2L3B;yBAjNe,YAAY"}
|