@astryxdesign/core 0.1.2 → 0.1.3
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
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
* SYNC: When modified, update:
|
|
12
12
|
* - /packages/core/src/NavMenu/index.ts
|
|
13
13
|
*/
|
|
14
|
-
import React, { useMemo } from 'react';
|
|
14
|
+
import React, { useCallback, useMemo } from 'react';
|
|
15
15
|
import * as stylex from '@stylexjs/stylex';
|
|
16
16
|
import "../theme/tokens.stylex.js";
|
|
17
17
|
import { spacingVars } from "../theme/tokens.stylex.js";
|
|
18
18
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
19
19
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
20
|
+
import { useTypeahead } from "../hooks/useTypeahead.js";
|
|
20
21
|
import { themeProps } from "../utils/themeProps.js";
|
|
21
22
|
import { NavHeadingMenuContext, useNavHeadingCloseContext } from "./NavMenuContext.js";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -79,10 +80,40 @@ export function NavHeadingMenu({
|
|
|
79
80
|
const closeMenu = closeCtx?.closeMenu;
|
|
80
81
|
const {
|
|
81
82
|
listRef,
|
|
82
|
-
handleKeyDown
|
|
83
|
+
handleKeyDown,
|
|
84
|
+
focusItem
|
|
83
85
|
} = useListFocus({
|
|
86
|
+
itemSelector: '[role="menuitem"]:not([aria-disabled="true"])',
|
|
84
87
|
onEscape: closeMenu
|
|
85
88
|
});
|
|
89
|
+
|
|
90
|
+
// First-character typeahead over the (enabled) menu items (menus-11).
|
|
91
|
+
const getMenuItems = useCallback(() => listRef.current ? Array.from(listRef.current.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) : [], [listRef]);
|
|
92
|
+
const typeahead = useTypeahead({
|
|
93
|
+
getItemLabels: () => getMenuItems().map(el => el.textContent),
|
|
94
|
+
onMatch: focusItem,
|
|
95
|
+
getCurrentIndex: () => getMenuItems().findIndex(el => el === document.activeElement || el.contains(document.activeElement))
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Extend useListFocus with Enter/Space activation. Items rendered without an
|
|
99
|
+
// `href` are `<div role="menuitem">` elements, which have no native keyboard
|
|
100
|
+
// activation — without this, Enter/Space on a focused onClick-only item does
|
|
101
|
+
// nothing. Anchor items (with `href`) already activate on Enter natively.
|
|
102
|
+
const listKeyDown = useCallback(e => {
|
|
103
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
104
|
+
const focused = document.activeElement;
|
|
105
|
+
if (focused?.getAttribute('role') === 'menuitem') {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
focused.click();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (typeahead.onKeyDown(e)) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
handleKeyDown(e);
|
|
116
|
+
}, [handleKeyDown, typeahead]);
|
|
86
117
|
const ctx = useMemo(() => ({
|
|
87
118
|
closeMenu: closeMenu ?? (() => {}),
|
|
88
119
|
size
|
|
@@ -96,7 +127,7 @@ export function NavHeadingMenu({
|
|
|
96
127
|
children: /*#__PURE__*/_jsx("div", {
|
|
97
128
|
ref: mergeRefs(ref, listRef),
|
|
98
129
|
role: "menu",
|
|
99
|
-
onKeyDown:
|
|
130
|
+
onKeyDown: listKeyDown,
|
|
100
131
|
"data-testid": testId,
|
|
101
132
|
...mergeProps(themeProps('nav-heading-menu', {
|
|
102
133
|
size
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file NumberInput.tsx
|
|
3
|
-
* @input Uses React, useId, useState, useMemo, useCallback, Field, Icon
|
|
3
|
+
* @input Uses React, useId, useState, useMemo, useCallback, Field, Icon, InputGroupContext
|
|
4
4
|
* @output Exports NumberInput component, NumberInputProps
|
|
5
5
|
* @position Core implementation; consumed by index.ts, tested by NumberInput.test.tsx
|
|
6
6
|
*
|
|
@@ -61,6 +61,27 @@ interface NumberInputPropsBase extends Omit<BaseProps, 'onChange' | 'defaultValu
|
|
|
61
61
|
* @default false
|
|
62
62
|
*/
|
|
63
63
|
isDisabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Explains why the input is disabled. When set together with `isDisabled`,
|
|
66
|
+
* the input shows a tooltip with this text on hover and keyboard focus, and
|
|
67
|
+
* stays focusable (via `aria-disabled`) so the reason is discoverable by
|
|
68
|
+
* keyboard and assistive technology. The field cannot be edited (it becomes
|
|
69
|
+
* read-only) while disabled.
|
|
70
|
+
*
|
|
71
|
+
* Use this instead of wrapping a disabled input in `Tooltip` — disabled
|
|
72
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```
|
|
76
|
+
* <NumberInput
|
|
77
|
+
* label="Quantity"
|
|
78
|
+
* value={quantity}
|
|
79
|
+
* isDisabled
|
|
80
|
+
* disabledMessage="Editing is locked while the order is processing"
|
|
81
|
+
* />
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
disabledMessage?: string;
|
|
64
85
|
/**
|
|
65
86
|
* Icon to display at the start of the input.
|
|
66
87
|
* Accepts a ReactNode (e.g. `<Icon icon={SearchIcon} />`) or an SVG icon component directly.
|
|
@@ -186,7 +207,7 @@ export type NumberInputProps = NumberInputPropsNonClearable | NumberInputPropsCl
|
|
|
186
207
|
* <NumberInput label="Price" value={price} onChange={setPrice} min={0} step={0.01} />
|
|
187
208
|
* ```
|
|
188
209
|
*/
|
|
189
|
-
export declare function NumberInput({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, startIcon, labelIcon, status, size: sizeProp, onChange, value, placeholder, labelTooltip, hasAutoFocus, htmlName, autoComplete, min, max, step, units, isIntegerOnly, onFocus, onBlur, hasClear, onEnter, onKeyDown, width, xstyle, className, style, ref, ...rest }: NumberInputProps): import("react").JSX.Element;
|
|
210
|
+
export declare function NumberInput({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, startIcon, labelIcon, status, size: sizeProp, onChange, value, placeholder, labelTooltip, hasAutoFocus, htmlName, autoComplete, min, max, step, units, isIntegerOnly, onFocus, onBlur, hasClear, onEnter, onKeyDown, width, xstyle, className, style, ref, ...rest }: NumberInputProps): import("react").JSX.Element;
|
|
190
211
|
export declare namespace NumberInput {
|
|
191
212
|
var displayName: string;
|
|
192
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAU3C,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAU3C,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAgE5D,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,UAAU,CAAC;AAMtD,YAAY,EACV,WAAW,IAAI,iBAAiB,EAChC,eAAe,IAAI,qBAAqB,GACzC,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,UAAU,oBAAqB,SAAQ,IAAI,CACzC,SAAS,EACT,UAAU,GAAG,cAAc,CAC5B;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,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4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file NumberInput.tsx
|
|
7
|
-
* @input Uses React, useId, useState, useMemo, useCallback, Field, Icon
|
|
7
|
+
* @input Uses React, useId, useState, useMemo, useCallback, Field, Icon, InputGroupContext
|
|
8
8
|
* @output Exports NumberInput component, NumberInputProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by NumberInput.test.tsx
|
|
10
10
|
*
|
|
@@ -21,6 +21,9 @@ import "../theme/tokens.stylex.js";
|
|
|
21
21
|
import { colorVars, sizeVars, radiusVars, typographyVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
22
22
|
import { Field, inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles } from "../Field/index.js";
|
|
23
23
|
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
24
|
+
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
25
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
26
|
+
import { getInputARIA } from "../utils/index.js";
|
|
24
27
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
25
28
|
import { useInputContainer } from "../hooks/useInputContainer.js";
|
|
26
29
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
@@ -55,7 +58,7 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
55
58
|
* Without `hasClear`, onChange only receives valid numbers.
|
|
56
59
|
* With `hasClear`, onChange also receives `null` when the user clears the input.
|
|
57
60
|
*/
|
|
58
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
61
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
59
62
|
/**
|
|
60
63
|
* Parse and validate a string input as a number.
|
|
61
64
|
* Returns null if the input is not a valid number or fails validation.
|
|
@@ -104,6 +107,7 @@ export function NumberInput({
|
|
|
104
107
|
isOptional = false,
|
|
105
108
|
isRequired = false,
|
|
106
109
|
isDisabled = false,
|
|
110
|
+
disabledMessage,
|
|
107
111
|
startIcon,
|
|
108
112
|
labelIcon,
|
|
109
113
|
status,
|
|
@@ -134,6 +138,7 @@ export function NumberInput({
|
|
|
134
138
|
}) {
|
|
135
139
|
const size = useSize(sizeProp, 'md');
|
|
136
140
|
const id = useId();
|
|
141
|
+
const inputLabelID = useId();
|
|
137
142
|
const descriptionID = useId();
|
|
138
143
|
const statusMessageID = useId();
|
|
139
144
|
const inputRef = useRef(null);
|
|
@@ -142,6 +147,20 @@ export function NumberInput({
|
|
|
142
147
|
|
|
143
148
|
// Pending input while user is typing (null = show formatted value)
|
|
144
149
|
const [pendingInput, setPendingInput] = useState(null);
|
|
150
|
+
|
|
151
|
+
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
152
|
+
// tooltip listeners attach to the input container (which already exists) and
|
|
153
|
+
// the input stays perceivable via aria-disabled instead of the native
|
|
154
|
+
// disabled attribute. The field is made read-only so it can't be typed into,
|
|
155
|
+
// and value mutation is blocked by the isDisabled guard in the handlers.
|
|
156
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
157
|
+
const disabledMessageTooltip = useTooltip({
|
|
158
|
+
placement: 'above',
|
|
159
|
+
// The container div is not naturally focusable; focusin bubbles up from
|
|
160
|
+
// the input, so always attach focus listeners.
|
|
161
|
+
focusTrigger: 'always',
|
|
162
|
+
isEnabled: showsDisabledMessage
|
|
163
|
+
});
|
|
145
164
|
const statusIconMap = {
|
|
146
165
|
warning: 'warning',
|
|
147
166
|
error: 'error',
|
|
@@ -152,7 +171,10 @@ export function NumberInput({
|
|
|
152
171
|
error: 'error',
|
|
153
172
|
success: 'success'
|
|
154
173
|
};
|
|
155
|
-
const
|
|
174
|
+
const {
|
|
175
|
+
ariaLabelledBy,
|
|
176
|
+
ariaDescribedBy
|
|
177
|
+
} = getInputARIA(inputLabelID, [description ? descriptionID : null, status?.message ? statusMessageID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null], inputGroup);
|
|
156
178
|
|
|
157
179
|
// Display value: pending input if typing, otherwise the raw value
|
|
158
180
|
// Note: With type="number", we can't use formatted display values
|
|
@@ -180,6 +202,12 @@ export function NumberInput({
|
|
|
180
202
|
|
|
181
203
|
// Handle input text change - update immediately if valid
|
|
182
204
|
const handleInputChange = useCallback(e => {
|
|
205
|
+
// Value can't change while showing a disabled message (the field is
|
|
206
|
+
// read-only and non-native-disabled), but guard the handler too so the
|
|
207
|
+
// pending value and onChange never fire.
|
|
208
|
+
if (isDisabled) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
183
211
|
const newValue = e.target.value;
|
|
184
212
|
setPendingInput(newValue);
|
|
185
213
|
|
|
@@ -192,7 +220,7 @@ export function NumberInput({
|
|
|
192
220
|
if (parsed !== null && parsed !== value) {
|
|
193
221
|
onChange(parsed);
|
|
194
222
|
}
|
|
195
|
-
}, [value, onChange, min, max, isIntegerOnly]);
|
|
223
|
+
}, [value, onChange, min, max, isIntegerOnly, isDisabled]);
|
|
196
224
|
|
|
197
225
|
// Handle focus
|
|
198
226
|
const handleFocus = useCallback(e => {
|
|
@@ -255,7 +283,13 @@ export function NumberInput({
|
|
|
255
283
|
disabled: isDisabled
|
|
256
284
|
});
|
|
257
285
|
const inputWrapper = /*#__PURE__*/_jsxs("div", {
|
|
258
|
-
ref:
|
|
286
|
+
ref: el => {
|
|
287
|
+
containerRef.current = el;
|
|
288
|
+
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
289
|
+
// Handlers are gated internally by isEnabled, and anchor names
|
|
290
|
+
// compose, so attaching unconditionally is safe.
|
|
291
|
+
disabledMessageTooltip.ref(el);
|
|
292
|
+
},
|
|
259
293
|
onClick: handleWrapperClick,
|
|
260
294
|
onMouseUp: handleWrapperMouseUp,
|
|
261
295
|
...mergeProps(themeProps('number-input', {
|
|
@@ -265,6 +299,9 @@ export function NumberInput({
|
|
|
265
299
|
children: [startIcon && renderIconSlot(startIcon, {
|
|
266
300
|
size: 'sm',
|
|
267
301
|
color: 'secondary'
|
|
302
|
+
}), inputGroup && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
303
|
+
id: inputLabelID,
|
|
304
|
+
children: label
|
|
268
305
|
}), /*#__PURE__*/_jsx("input", {
|
|
269
306
|
...rest,
|
|
270
307
|
ref: mergeRefs(ref, inputRef),
|
|
@@ -277,8 +314,14 @@ export function NumberInput({
|
|
|
277
314
|
onFocus: handleFocus,
|
|
278
315
|
onBlur: handleBlur,
|
|
279
316
|
onKeyDown: handleKeyDown,
|
|
280
|
-
placeholder: placeholder
|
|
281
|
-
disabled
|
|
317
|
+
placeholder: placeholder
|
|
318
|
+
// With a disabledMessage the input keeps focusability via aria-disabled
|
|
319
|
+
// so the reason is focus-discoverable; readOnly + the handler guards
|
|
320
|
+
// keep the value from changing.
|
|
321
|
+
,
|
|
322
|
+
disabled: isDisabled && !showsDisabledMessage,
|
|
323
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
324
|
+
readOnly: showsDisabledMessage || undefined,
|
|
282
325
|
autoFocus: hasAutoFocus,
|
|
283
326
|
"data-autofocus": hasAutoFocus || undefined,
|
|
284
327
|
min: min ?? undefined,
|
|
@@ -286,8 +329,8 @@ export function NumberInput({
|
|
|
286
329
|
step: step ?? undefined,
|
|
287
330
|
"aria-describedby": ariaDescribedBy,
|
|
288
331
|
"aria-required": isRequired === true ? 'true' : undefined,
|
|
289
|
-
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
290
|
-
"aria-
|
|
332
|
+
"aria-invalid": status?.type === 'error' || !isInputValid ? 'true' : undefined,
|
|
333
|
+
"aria-labelledby": ariaLabelledBy,
|
|
291
334
|
...{
|
|
292
335
|
0: {
|
|
293
336
|
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5"
|
|
@@ -307,6 +350,11 @@ export function NumberInput({
|
|
|
307
350
|
className: "x9ynric xjm74w1 xw6l6zx xv1l7n4 x2lah0s"
|
|
308
351
|
},
|
|
309
352
|
children: units
|
|
353
|
+
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
354
|
+
as: "div",
|
|
355
|
+
role: "alert",
|
|
356
|
+
"aria-live": "assertive",
|
|
357
|
+
children: !isInputValid ? 'Invalid number' : ''
|
|
310
358
|
}), hasClear && value != null && !isDisabled && /*#__PURE__*/_jsx("button", {
|
|
311
359
|
type: "button",
|
|
312
360
|
onClick: handleClear,
|
|
@@ -326,9 +374,11 @@ export function NumberInput({
|
|
|
326
374
|
})]
|
|
327
375
|
});
|
|
328
376
|
if (inputGroup) {
|
|
329
|
-
return
|
|
377
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
378
|
+
children: [inputWrapper, showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
379
|
+
});
|
|
330
380
|
}
|
|
331
|
-
return /*#__PURE__*/
|
|
381
|
+
return /*#__PURE__*/_jsxs(Field, {
|
|
332
382
|
label: label,
|
|
333
383
|
isLabelHidden: isLabelHidden,
|
|
334
384
|
description: description,
|
|
@@ -345,7 +395,7 @@ export function NumberInput({
|
|
|
345
395
|
} : undefined,
|
|
346
396
|
labelTooltip: labelTooltip,
|
|
347
397
|
width: width,
|
|
348
|
-
children: inputWrapper
|
|
398
|
+
children: [inputWrapper, showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
349
399
|
});
|
|
350
400
|
}
|
|
351
401
|
NumberInput.displayName = 'NumberInput';
|
|
@@ -116,7 +116,7 @@ export declare function generatePageRange(currentPage: number, totalPages: numbe
|
|
|
116
116
|
* />
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
|
-
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize, pageSizeOptions, onPageSizeChange, variant, siblingCount, size, isDisabled, label, 'data-testid': testId, xstyle, className, style, ref, }: PaginationProps): import("react").JSX.Element | null;
|
|
119
|
+
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, siblingCount, size, isDisabled, label, 'data-testid': testId, xstyle, className, style, ref, }: PaginationProps): import("react").JSX.Element | null;
|
|
120
120
|
export declare namespace Pagination {
|
|
121
121
|
var displayName: string;
|
|
122
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC;AAE3D,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;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"../Button/index.js";
|
|
|
26
26
|
import { Icon } from "../Icon/index.js";
|
|
27
27
|
import { Selector } from "../Selector/index.js";
|
|
28
28
|
import { Text } from "../Text/index.js";
|
|
29
|
+
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
29
30
|
import { mergeProps } from "../utils/index.js";
|
|
30
31
|
import { themeProps } from "../utils/themeProps.js";
|
|
31
32
|
|
|
@@ -159,7 +160,7 @@ export function Pagination({
|
|
|
159
160
|
totalItems,
|
|
160
161
|
totalPages: totalPagesProp,
|
|
161
162
|
hasMore,
|
|
162
|
-
pageSize = 10,
|
|
163
|
+
pageSize: pageSizeProp = 10,
|
|
163
164
|
pageSizeOptions,
|
|
164
165
|
onPageSizeChange,
|
|
165
166
|
variant = 'pages',
|
|
@@ -175,6 +176,18 @@ export function Pagination({
|
|
|
175
176
|
}) {
|
|
176
177
|
const [, startTransition] = useTransition();
|
|
177
178
|
|
|
179
|
+
// pageSize is typed as number, so 0, NaN, and negatives are valid at the
|
|
180
|
+
// type level but yield Infinity/NaN page counts, and
|
|
181
|
+
// Array.from({length: Infinity}) crashes the dots variant. Coerce to a
|
|
182
|
+
// positive integer; non-finite values fall back to the default.
|
|
183
|
+
const pageSize = Number.isFinite(pageSizeProp) ? Math.max(1, Math.floor(pageSizeProp)) : 10;
|
|
184
|
+
|
|
185
|
+
// Announce page changes politely (navigation-10). The controls carry no
|
|
186
|
+
// live region, so page transitions were previously silent to screen readers.
|
|
187
|
+
// Only user-driven changes go through handlePageChange, so initial mount is
|
|
188
|
+
// never announced.
|
|
189
|
+
const announce = useAnnounce();
|
|
190
|
+
|
|
178
191
|
// Track the page optimistically so rapid prev/next clicks advance from the
|
|
179
192
|
// in-flight target instead of stalling on the last committed page.
|
|
180
193
|
const [optimisticPage, setOptimisticPage] = useOptimistic(page);
|
|
@@ -202,6 +215,7 @@ export function Pagination({
|
|
|
202
215
|
// Keep onChange urgent so controlled page state updates in the same commit
|
|
203
216
|
// as the click; only the optimistic indicator and changeAction defer.
|
|
204
217
|
onChange(newPage);
|
|
218
|
+
announce(computedTotalPages != null ? `Page ${newPage} of ${computedTotalPages}` : `Page ${newPage}`);
|
|
205
219
|
startTransition(async () => {
|
|
206
220
|
setOptimisticPage(newPage);
|
|
207
221
|
await changeAction?.(newPage);
|
|
@@ -128,6 +128,22 @@ export interface PopoverProps extends Pick<BaseProps, 'xstyle' | 'className' | '
|
|
|
128
128
|
* @default true
|
|
129
129
|
*/
|
|
130
130
|
hasAutoFocus?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether clicking outside dismisses the popover.
|
|
133
|
+
* Set to `false` for surfaces that should stay open until explicitly
|
|
134
|
+
* dismissed, like onboarding coachmarks or multi-step flows.
|
|
135
|
+
* @default true
|
|
136
|
+
*/
|
|
137
|
+
hasLightDismiss?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether pressing Escape dismisses the popover.
|
|
140
|
+
*
|
|
141
|
+
* Only takes full effect together with `hasLightDismiss={false}`: with
|
|
142
|
+
* light dismiss on, the browser's native light dismiss also closes on
|
|
143
|
+
* Escape. Set both to `false` for explicit-dismiss-only surfaces.
|
|
144
|
+
* @default true
|
|
145
|
+
*/
|
|
146
|
+
hasEscapeDismiss?: boolean;
|
|
131
147
|
/**
|
|
132
148
|
* Test ID for the popover container.
|
|
133
149
|
*/
|
|
@@ -144,7 +160,7 @@ export interface PopoverProps extends Pick<BaseProps, 'xstyle' | 'className' | '
|
|
|
144
160
|
* (immune to pressed-state transforms like `:active { scale(0.98) }`).
|
|
145
161
|
*
|
|
146
162
|
* Focus is trapped inside the popover when open.
|
|
147
|
-
* Supports light dismiss (click outside or Escape to close).
|
|
163
|
+
* Supports light dismiss by default (click outside or Escape to close).
|
|
148
164
|
*
|
|
149
165
|
* For hover-triggered overlays, use {@link HoverCard} instead.
|
|
150
166
|
*
|
|
@@ -168,7 +184,7 @@ export interface PopoverProps extends Pick<BaseProps, 'xstyle' | 'className' | '
|
|
|
168
184
|
* />
|
|
169
185
|
* ```
|
|
170
186
|
*/
|
|
171
|
-
export declare function Popover({ children, anchorRef, content, placement, alignment, isOpen, onOpenChange, isEnabled, width, label, hasCloseButton, closeButtonLabel, hasAutoFocus, xstyle, className, style, 'data-testid': testId, }: PopoverProps): ReactElement;
|
|
187
|
+
export declare function Popover({ children, anchorRef, content, placement, alignment, isOpen, onOpenChange, isEnabled, width, label, hasCloseButton, closeButtonLabel, hasAutoFocus, hasLightDismiss, hasEscapeDismiss, xstyle, className, style, 'data-testid': testId, }: PopoverProps): ReactElement;
|
|
172
188
|
export declare namespace Popover {
|
|
173
189
|
var displayName: string;
|
|
174
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../src/Popover/Popover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAGZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AA4BtE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,GAAG,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC,sCAAsC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+DAA+D;IAC/D,eAAe,EAAE,QAAQ,CAAC;IAC1B,6DAA6D;IAC7D,eAAe,EAAE,OAAO,CAAC;IACzB,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,EACT,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,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ExB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAmB,EACnB,SAAmB,EACnB,MAAM,EACN,YAAY,EACZ,SAAgB,EAChB,KAAK,EACL,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAsB,EACtB,gBAAuB,EACvB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,GACtB,EAAE,YAAY,GAAG,YAAY,CAgR7B;yBApSe,OAAO"}
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -97,7 +97,7 @@ const styles = {
|
|
|
97
97
|
* (immune to pressed-state transforms like `:active { scale(0.98) }`).
|
|
98
98
|
*
|
|
99
99
|
* Focus is trapped inside the popover when open.
|
|
100
|
-
* Supports light dismiss (click outside or Escape to close).
|
|
100
|
+
* Supports light dismiss by default (click outside or Escape to close).
|
|
101
101
|
*
|
|
102
102
|
* For hover-triggered overlays, use {@link HoverCard} instead.
|
|
103
103
|
*
|
|
@@ -135,6 +135,8 @@ export function Popover({
|
|
|
135
135
|
hasCloseButton,
|
|
136
136
|
closeButtonLabel,
|
|
137
137
|
hasAutoFocus,
|
|
138
|
+
hasLightDismiss = true,
|
|
139
|
+
hasEscapeDismiss = true,
|
|
138
140
|
xstyle,
|
|
139
141
|
className,
|
|
140
142
|
style,
|
|
@@ -154,7 +156,8 @@ export function Popover({
|
|
|
154
156
|
}, [onOpenChange]);
|
|
155
157
|
const popover = usePopover({
|
|
156
158
|
dialogLabel: label,
|
|
157
|
-
hasLightDismiss
|
|
159
|
+
hasLightDismiss,
|
|
160
|
+
hasEscapeDismiss,
|
|
158
161
|
hasCloseButton,
|
|
159
162
|
closeButtonLabel,
|
|
160
163
|
hasAutoFocus,
|
|
@@ -42,6 +42,18 @@ export interface UsePopoverOptions {
|
|
|
42
42
|
* @default true
|
|
43
43
|
*/
|
|
44
44
|
hasLightDismiss?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether pressing Escape dismisses the popover.
|
|
47
|
+
*
|
|
48
|
+
* Takes effect together with `hasLightDismiss: false`: with light dismiss
|
|
49
|
+
* on, the native popover uses `popover="auto"`, whose browser-level light
|
|
50
|
+
* dismiss also closes on Escape, so Escape handling stays registered to
|
|
51
|
+
* keep topmost-only dismissal intact. Set both to `false` for
|
|
52
|
+
* explicit-dismiss-only surfaces like onboarding coachmarks.
|
|
53
|
+
*
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
hasEscapeDismiss?: boolean;
|
|
45
57
|
/**
|
|
46
58
|
* Whether to automatically focus the first focusable element when opened.
|
|
47
59
|
* @default true
|
|
@@ -60,9 +72,32 @@ export interface UsePopoverOptions {
|
|
|
60
72
|
closeButtonLabel?: string;
|
|
61
73
|
/**
|
|
62
74
|
* Accessible label for the dialog.
|
|
63
|
-
* Required for screen readers to announce the dialog purpose
|
|
75
|
+
* Required for screen readers to announce the dialog purpose
|
|
76
|
+
* (only applies when `role` is `'dialog'`).
|
|
64
77
|
*/
|
|
65
78
|
dialogLabel?: string;
|
|
79
|
+
/**
|
|
80
|
+
* ARIA role stamped on the popover content wrapper.
|
|
81
|
+
*
|
|
82
|
+
* - `'dialog'` (default): the wrapper is a `role="dialog"` and, when
|
|
83
|
+
* `isModal` is true, carries `aria-modal`. Use for genuine dialog content.
|
|
84
|
+
* - `'none'`: the wrapper carries no role or `aria-modal`, so the popup's own
|
|
85
|
+
* content role (e.g. a child `role="listbox"` or `role="menu"`) is the
|
|
86
|
+
* exposed semantics. Use for comboboxes, listboxes, and menus — their
|
|
87
|
+
* trigger keeps DOM focus, so announcing an unnamed modal dialog around
|
|
88
|
+
* them is incorrect.
|
|
89
|
+
*
|
|
90
|
+
* @default 'dialog'
|
|
91
|
+
*/
|
|
92
|
+
role?: 'dialog' | 'none';
|
|
93
|
+
/**
|
|
94
|
+
* Whether the dialog is modal (`aria-modal`). Only applies when `role` is
|
|
95
|
+
* `'dialog'`. Set to `false` for non-modal dialogs that do not inert the rest
|
|
96
|
+
* of the page.
|
|
97
|
+
*
|
|
98
|
+
* @default true
|
|
99
|
+
*/
|
|
100
|
+
isModal?: boolean;
|
|
66
101
|
/**
|
|
67
102
|
* Whether to apply the default popover surface (background, border-radius,
|
|
68
103
|
* box-shadow) to the content wrapper.
|
|
@@ -136,7 +171,7 @@ export interface UsePopoverReturn {
|
|
|
136
171
|
* ARIA attributes to spread on the trigger element
|
|
137
172
|
*/
|
|
138
173
|
triggerProps: {
|
|
139
|
-
'aria-haspopup': 'dialog';
|
|
174
|
+
'aria-haspopup': 'dialog' | 'true';
|
|
140
175
|
'aria-expanded': boolean;
|
|
141
176
|
'aria-controls': string;
|
|
142
177
|
};
|
|
@@ -148,7 +183,7 @@ export interface UsePopoverReturn {
|
|
|
148
183
|
* - `useLayer` for popover positioning using CSS anchor positioning
|
|
149
184
|
* - `useFocusTrap` for trapping focus within the popover content
|
|
150
185
|
* - Auto-focus first element on open
|
|
151
|
-
* - Escape key to close
|
|
186
|
+
* - Escape key to close (configurable via hasEscapeDismiss)
|
|
152
187
|
* - Hidden close button that reveals on focus for accessibility
|
|
153
188
|
*
|
|
154
189
|
* The render function automatically wraps your content in a focus trap container
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../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,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CA0J5E"}
|
|
@@ -50,7 +50,7 @@ const styles = {
|
|
|
50
50
|
* - `useLayer` for popover positioning using CSS anchor positioning
|
|
51
51
|
* - `useFocusTrap` for trapping focus within the popover content
|
|
52
52
|
* - Auto-focus first element on open
|
|
53
|
-
* - Escape key to close
|
|
53
|
+
* - Escape key to close (configurable via hasEscapeDismiss)
|
|
54
54
|
* - Hidden close button that reveals on focus for accessibility
|
|
55
55
|
*
|
|
56
56
|
* The render function automatically wraps your content in a focus trap container
|
|
@@ -89,11 +89,14 @@ export function usePopover(options = {}) {
|
|
|
89
89
|
onHide,
|
|
90
90
|
xstyle,
|
|
91
91
|
hasLightDismiss = true,
|
|
92
|
+
hasEscapeDismiss = true,
|
|
92
93
|
hasAutoFocus = true,
|
|
93
94
|
hasSurface = true,
|
|
94
95
|
hasCloseButton = true,
|
|
95
96
|
closeButtonLabel = 'Close popover',
|
|
96
|
-
dialogLabel
|
|
97
|
+
dialogLabel,
|
|
98
|
+
role = 'dialog',
|
|
99
|
+
isModal = true
|
|
97
100
|
} = options;
|
|
98
101
|
|
|
99
102
|
// Track the trigger element for returning focus
|
|
@@ -110,13 +113,15 @@ export function usePopover(options = {}) {
|
|
|
110
113
|
onHide
|
|
111
114
|
});
|
|
112
115
|
|
|
113
|
-
// Focus trap for the popover content
|
|
116
|
+
// Focus trap for the popover content. Escape stays registered while light
|
|
117
|
+
// dismiss is on (native popover="auto" closes on Escape regardless), so a
|
|
118
|
+
// host Dialog keeps deferring to this trap instead of double-dismissing.
|
|
114
119
|
const {
|
|
115
120
|
containerRef: contentRef,
|
|
116
121
|
focusFirst
|
|
117
122
|
} = useFocusTrap({
|
|
118
123
|
isActive: layer.isOpen,
|
|
119
|
-
onEscape: layer.hide
|
|
124
|
+
onEscape: hasEscapeDismiss || hasLightDismiss ? layer.hide : undefined
|
|
120
125
|
});
|
|
121
126
|
|
|
122
127
|
// Auto-focus first element when popover opens (unless skipped)
|
|
@@ -156,18 +161,28 @@ export function usePopover(options = {}) {
|
|
|
156
161
|
|
|
157
162
|
// ARIA attributes for the trigger
|
|
158
163
|
const triggerProps = {
|
|
159
|
-
'aria-haspopup': 'dialog',
|
|
164
|
+
'aria-haspopup': role === 'dialog' ? 'dialog' : 'true',
|
|
160
165
|
'aria-expanded': layer.isOpen,
|
|
161
166
|
'aria-controls': layer.id
|
|
162
167
|
};
|
|
163
168
|
|
|
169
|
+
// Dev-time guardrail: a dialog popover should always be labeled. Warn once
|
|
170
|
+
// per hook instance (in an effect) rather than on every render.
|
|
171
|
+
const warnedUnnamedDialogRef = useRef(false);
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (role === 'dialog' && !dialogLabel && !warnedUnnamedDialogRef.current) {
|
|
174
|
+
warnedUnnamedDialogRef.current = true;
|
|
175
|
+
console.warn('usePopover: role="dialog" without a `dialogLabel` renders an unnamed ' + 'dialog. Pass `dialogLabel`, or use `role: "none"` for listbox/menu ' + 'popups whose content already carries its own role.');
|
|
176
|
+
}
|
|
177
|
+
}, [role, dialogLabel]);
|
|
178
|
+
|
|
164
179
|
// Wrapped render function that includes surface styles and optional hidden close button
|
|
165
180
|
const render = useCallback((children, props) => {
|
|
166
181
|
return layer.render(/*#__PURE__*/_jsxs("div", {
|
|
167
182
|
ref: contentRef,
|
|
168
|
-
role:
|
|
169
|
-
"aria-modal":
|
|
170
|
-
"aria-label": dialogLabel,
|
|
183
|
+
role: role === 'dialog' ? 'dialog' : undefined,
|
|
184
|
+
"aria-modal": role === 'dialog' && isModal ? true : undefined,
|
|
185
|
+
"aria-label": role === 'dialog' ? dialogLabel : undefined,
|
|
171
186
|
...stylex.props(styles.contentWrapper, hasSurface && styles.surface, xstyle),
|
|
172
187
|
children: [children, hasCloseButton && /*#__PURE__*/_jsx("div", {
|
|
173
188
|
...{
|
|
@@ -183,7 +198,7 @@ export function usePopover(options = {}) {
|
|
|
183
198
|
...props,
|
|
184
199
|
xstyle: props?.xstyle
|
|
185
200
|
});
|
|
186
|
-
}, [layer, hasCloseButton, hasSurface, closeButtonLabel, contentRef, dialogLabel, xstyle]);
|
|
201
|
+
}, [layer, hasCloseButton, hasSurface, closeButtonLabel, contentRef, dialogLabel, role, isModal, xstyle]);
|
|
187
202
|
return {
|
|
188
203
|
triggerRef,
|
|
189
204
|
contentRef,
|
|
@@ -37,6 +37,16 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
37
37
|
isReadOnly?: boolean;
|
|
38
38
|
/** Whether the input is disabled. @default false */
|
|
39
39
|
isDisabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Explains why the search is disabled. When set together with `isDisabled`,
|
|
42
|
+
* the search shows a tooltip with this text on hover and keyboard focus, and
|
|
43
|
+
* the input stays focusable (via `aria-disabled`) so the reason is
|
|
44
|
+
* discoverable by keyboard and assistive technology. Input stays blocked.
|
|
45
|
+
*
|
|
46
|
+
* Use this instead of wrapping a disabled PowerSearch in `Tooltip` — disabled
|
|
47
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
48
|
+
*/
|
|
49
|
+
disabledMessage?: string;
|
|
40
50
|
/**
|
|
41
51
|
* Icon to display at the start of the input.
|
|
42
52
|
* Accepts a ReactNode (e.g. `<Icon icon={SearchIcon} />`) or an SVG icon component directly.
|
|
@@ -155,7 +165,7 @@ export interface PowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange
|
|
|
155
165
|
* };
|
|
156
166
|
* ```
|
|
157
167
|
*/
|
|
158
|
-
export declare function PowerSearch({ config: configProp, filters, onChange, label, isLabelHidden, placeholder, hasAutoFocus, hasClear, isReadOnly, isDisabled, startIcon, onFocus, onBlur, status, maxTokenLength, popoverSaveButtonLabel, timezoneID, tokenOverflowBehavior, endContent, resultCount, ref, handleRef, size: sizeProp, 'data-testid': testId, xstyle, className, style, components: componentOverrides, }: PowerSearchProps): React.JSX.Element;
|
|
168
|
+
export declare function PowerSearch({ config: configProp, filters, onChange, label, isLabelHidden, placeholder, hasAutoFocus, hasClear, isReadOnly, isDisabled, disabledMessage, startIcon, onFocus, onBlur, status, maxTokenLength, popoverSaveButtonLabel, timezoneID, tokenOverflowBehavior, endContent, resultCount, ref, handleRef, size: sizeProp, 'data-testid': testId, xstyle, className, style, components: componentOverrides, }: PowerSearchProps): React.JSX.Element;
|
|
159
169
|
export declare namespace PowerSearch {
|
|
160
170
|
var displayName: string;
|
|
161
171
|
}
|