@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
package/dist/TabList/TabList.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TabList.tsx
|
|
7
|
-
* @input Uses React, StyleX, TabListContext
|
|
7
|
+
* @input Uses React, StyleX, TabListContext, useListFocus, useKeyboardHint
|
|
8
8
|
* @output Exports TabList component and TabListProps type
|
|
9
|
-
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children
|
|
9
|
+
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children.
|
|
10
|
+
* Owns roving-tabindex keyboard navigation (Arrow/Home/End) across the tab
|
|
11
|
+
* strip via the shared useListFocus hook so it is a single Tab stop.
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update:
|
|
12
14
|
* - /packages/core/src/TabList/TabList.doc.mjs
|
|
@@ -14,16 +16,25 @@
|
|
|
14
16
|
* - /packages/core/src/TabList/TabList.test.tsx
|
|
15
17
|
* - /packages/cli/templates/blocks/components/TabList/ (showcase blocks)
|
|
16
18
|
*/
|
|
17
|
-
import React, { useMemo } from 'react';
|
|
19
|
+
import React, { useCallback, useMemo } from 'react';
|
|
18
20
|
import * as stylex from '@stylexjs/stylex';
|
|
19
21
|
import "../theme/tokens.stylex.js";
|
|
20
22
|
import { borderVars, colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
21
23
|
import { TabListContext } from "./TabListContext.js";
|
|
22
24
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
23
|
-
import { mergeProps } from "../utils/index.js";
|
|
25
|
+
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
26
|
+
import { useListFocus } from "../hooks/useListFocus.js";
|
|
27
|
+
import { useKeyboardHint } from "../hooks/useKeyboardHint.js";
|
|
24
28
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
25
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
|
-
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Selector matching the focusable stops in the tab strip: every Tab
|
|
33
|
+
* (`[data-tab-value]`) and every TabMenu trigger (`[data-tab-menu]`),
|
|
34
|
+
* in DOM order. Disabled stops are filtered out by the handler.
|
|
35
|
+
*/
|
|
36
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
37
|
+
const TAB_STOP_SELECTOR = '[data-tab-value],[data-tab-menu]';
|
|
27
38
|
const styles = {
|
|
28
39
|
nav: {
|
|
29
40
|
k1xSpc: "x78zum5",
|
|
@@ -68,30 +79,96 @@ export function TabList({
|
|
|
68
79
|
size: sizeProp,
|
|
69
80
|
layout = 'hug',
|
|
70
81
|
hasDivider = false,
|
|
82
|
+
orientation = 'horizontal',
|
|
71
83
|
xstyle,
|
|
72
84
|
className,
|
|
73
85
|
style,
|
|
74
86
|
children,
|
|
87
|
+
onKeyDown: onKeyDownProp,
|
|
88
|
+
onFocus: onFocusProp,
|
|
89
|
+
onBlur: onBlurProp,
|
|
90
|
+
'aria-label': ariaLabel = 'Tabs',
|
|
91
|
+
'aria-orientation': _ariaOrientation,
|
|
92
|
+
[EDGE_COMP_ATTR]: _edgeCompAttr,
|
|
75
93
|
...restProps
|
|
76
94
|
}) {
|
|
77
95
|
const size = useSize(sizeProp, 'md');
|
|
96
|
+
|
|
97
|
+
// Roving-tabindex keyboard navigation across the tab strip via the shared
|
|
98
|
+
// hook. `orientation: 'both'` accepts both arrow axes per the WAI-ARIA APG
|
|
99
|
+
// allowance for tab strips (ArrowRight/ArrowDown advance, ArrowLeft/ArrowUp
|
|
100
|
+
// retreat) regardless of the component's `orientation` prop, which only
|
|
101
|
+
// drives the keyboard hint badge (see useKeyboardHint below). We do not set
|
|
102
|
+
// `aria-orientation` on the `<nav>`: that attribute is invalid on the
|
|
103
|
+
// navigation role and triggers an axe `aria-allowed-attr` violation.
|
|
104
|
+
//
|
|
105
|
+
// `hasRovingTabIndex` makes the hook own the single tab stop: it stamps
|
|
106
|
+
// tabindex 0/-1, repairs the stop on mount and as stops mount/unmount or
|
|
107
|
+
// toggle disabled, and — via `handleFocus` on the nav — keeps the stop in
|
|
108
|
+
// sync after clicks or programmatic focus. Individual Tabs still render
|
|
109
|
+
// `tabIndex={isSelected ? 0 : -1}` (see Tab.tsx) as the initial source of
|
|
110
|
+
// truth; the hook's repair preserves an existing tab stop and only promotes
|
|
111
|
+
// the first enabled stop when none is tabbable.
|
|
112
|
+
const {
|
|
113
|
+
listRef,
|
|
114
|
+
handleKeyDown,
|
|
115
|
+
handleFocus
|
|
116
|
+
} = useListFocus({
|
|
117
|
+
itemSelector: TAB_STOP_SELECTOR,
|
|
118
|
+
orientation: 'both',
|
|
119
|
+
hasRovingTabIndex: true
|
|
120
|
+
});
|
|
121
|
+
const {
|
|
122
|
+
hintElement,
|
|
123
|
+
onKeyDown: onHintKeyDown,
|
|
124
|
+
onFocus: onHintFocus,
|
|
125
|
+
onBlur: onHintBlur
|
|
126
|
+
} = useKeyboardHint({
|
|
127
|
+
orientation
|
|
128
|
+
});
|
|
78
129
|
const contextValue = useMemo(() => ({
|
|
79
130
|
value,
|
|
80
131
|
onChange,
|
|
81
132
|
size,
|
|
82
133
|
layout
|
|
83
134
|
}), [value, onChange, size, layout]);
|
|
135
|
+
const handleRootKeyDown = useCallback(e => {
|
|
136
|
+
onKeyDownProp?.(e);
|
|
137
|
+
if (e.defaultPrevented) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
onHintKeyDown(e);
|
|
141
|
+
handleKeyDown(e);
|
|
142
|
+
}, [onKeyDownProp, onHintKeyDown, handleKeyDown]);
|
|
143
|
+
const handleRootFocus = useCallback(e => {
|
|
144
|
+
onFocusProp?.(e);
|
|
145
|
+
if (e.defaultPrevented) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
onHintFocus(e);
|
|
149
|
+
handleFocus(e);
|
|
150
|
+
}, [onFocusProp, onHintFocus, handleFocus]);
|
|
151
|
+
const handleRootBlur = useCallback(e => {
|
|
152
|
+
onBlurProp?.(e);
|
|
153
|
+
if (e.defaultPrevented) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
onHintBlur(e);
|
|
157
|
+
}, [onBlurProp, onHintBlur]);
|
|
84
158
|
return /*#__PURE__*/_jsx(TabListContext, {
|
|
85
159
|
value: contextValue,
|
|
86
|
-
children: /*#__PURE__*/
|
|
87
|
-
ref: ref,
|
|
88
|
-
"aria-label": "Tabs",
|
|
89
|
-
[EDGE_COMP_ATTR]: '',
|
|
160
|
+
children: /*#__PURE__*/_jsxs("nav", {
|
|
161
|
+
ref: mergeRefs(ref, listRef),
|
|
90
162
|
...restProps,
|
|
163
|
+
"aria-label": ariaLabel,
|
|
164
|
+
onKeyDown: handleRootKeyDown,
|
|
165
|
+
onFocus: handleRootFocus,
|
|
166
|
+
onBlur: handleRootBlur,
|
|
167
|
+
[EDGE_COMP_ATTR]: '',
|
|
91
168
|
...mergeProps(themeProps('tab-list', {
|
|
92
169
|
size
|
|
93
170
|
}), stylex.props(styles.nav, layout === 'fill' && styles.fill, hasDivider && styles.divider, xstyle), className, style),
|
|
94
|
-
children: children
|
|
171
|
+
children: [children, hintElement]
|
|
95
172
|
})
|
|
96
173
|
});
|
|
97
174
|
}
|
|
@@ -9,6 +9,11 @@ export type TabListSize = 'sm' | 'md' | 'lg';
|
|
|
9
9
|
* - `'fill'`: tabs stretch equally to fill the container width.
|
|
10
10
|
*/
|
|
11
11
|
export type TabListLayout = 'hug' | 'fill';
|
|
12
|
+
/**
|
|
13
|
+
* Orientation of the tab strip. Controls which arrow keys move focus
|
|
14
|
+
* between tabs and the reported `aria-orientation`.
|
|
15
|
+
*/
|
|
16
|
+
export type TabListOrientation = 'horizontal' | 'vertical';
|
|
12
17
|
/**
|
|
13
18
|
* Context for communicating value/onChange/size/layout from TabList to children.
|
|
14
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabListContext.d.ts","sourceRoot":"","sources":["../../src/TabList/TabListContext.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"TabListContext.d.ts","sourceRoot":"","sources":["../../src/TabList/TabListContext.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAG9E;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CASvD"}
|
|
@@ -23,6 +23,11 @@ import { createContext, use } from 'react';
|
|
|
23
23
|
* - `'fill'`: tabs stretch equally to fill the container width.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Orientation of the tab strip. Controls which arrow keys move focus
|
|
28
|
+
* between tabs and the reported `aria-orientation`.
|
|
29
|
+
*/
|
|
30
|
+
|
|
26
31
|
/**
|
|
27
32
|
* Context for communicating value/onChange/size/layout from TabList to children.
|
|
28
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabMenu.d.ts","sourceRoot":"","sources":["../../src/TabList/TabMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAiBtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,CAAC,iBAAiB,CAAC,EAC5B,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AA8KD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,GAAG,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"TabMenu.d.ts","sourceRoot":"","sources":["../../src/TabList/TabMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAiBtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,CAAC,iBAAiB,CAAC,EAC5B,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AA8KD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,GAAG,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,YAAY,qBAiJd;yBAxJe,OAAO"}
|
package/dist/TabList/TabMenu.js
CHANGED
|
@@ -138,7 +138,10 @@ export function TabMenu({
|
|
|
138
138
|
const popover = usePopover({
|
|
139
139
|
hasLightDismiss: true,
|
|
140
140
|
hasCloseButton: false,
|
|
141
|
-
hasAutoFocus: false
|
|
141
|
+
hasAutoFocus: false,
|
|
142
|
+
// The popup's own role="menu" is the exposed semantics; a modal dialog
|
|
143
|
+
// wrapper would announce an unnamed dialog around the menu.
|
|
144
|
+
role: 'none'
|
|
142
145
|
});
|
|
143
146
|
const {
|
|
144
147
|
listRef,
|
|
@@ -169,6 +172,8 @@ export function TabMenu({
|
|
|
169
172
|
"aria-haspopup": "menu",
|
|
170
173
|
"aria-expanded": popover.isOpen,
|
|
171
174
|
"aria-controls": menuId,
|
|
175
|
+
"data-tab-menu": "",
|
|
176
|
+
tabIndex: hasSelectedOption ? 0 : -1,
|
|
172
177
|
onClick: handleToggle,
|
|
173
178
|
...mergeProps(themeProps('tab-menu'), stylex.props(styles.trigger, sizeStyles[size], hasSelectedOption && styles.triggerSelected, tabScope, xstyle), className, style),
|
|
174
179
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTable.d.ts","sourceRoot":"","sources":["../../src/Table/BaseTable.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,KAAK,YAAY,EAAkB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAGhF,OAAO,KAAK,EACV,cAAc,EAYf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseTable.d.ts","sourceRoot":"","sources":["../../src/Table/BaseTable.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,KAAK,YAAY,EAAkB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAGhF,OAAO,KAAK,EACV,cAAc,EAYf,MAAM,SAAS,CAAC;AA+hBjB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,EAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAAC,KACrD,YAAY,CAAC"}
|
package/dist/Table/BaseTable.js
CHANGED
|
@@ -139,6 +139,7 @@ function TableRowInner({
|
|
|
139
139
|
}
|
|
140
140
|
return /*#__PURE__*/_jsx(CellComponent, {
|
|
141
141
|
...cellRenderProps.htmlProps,
|
|
142
|
+
contextMenuActions: cellRenderProps.contextMenuActions,
|
|
142
143
|
xstyle: cellRenderProps.styles,
|
|
143
144
|
children: content
|
|
144
145
|
}, col.key);
|
|
@@ -152,12 +153,13 @@ function TableRowInner({
|
|
|
152
153
|
children: cells
|
|
153
154
|
})
|
|
154
155
|
}, item, rowIndex);
|
|
155
|
-
|
|
156
|
+
const row = /*#__PURE__*/_jsx(RowComponent, {
|
|
156
157
|
ref: rowRenderProps.ref,
|
|
157
158
|
...rowRenderProps.htmlProps,
|
|
158
159
|
xstyle: rowRenderProps.styles,
|
|
159
160
|
children: rowRenderProps.children
|
|
160
161
|
}, rowKey);
|
|
162
|
+
return row;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
/**
|
|
@@ -314,18 +316,20 @@ function BaseTableInner({
|
|
|
314
316
|
below
|
|
315
317
|
} = cellRenderProps;
|
|
316
318
|
const hasSlots = before != null || after != null || overlay != null || below != null;
|
|
319
|
+
const headerInner = hasSlots ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
320
|
+
children: [before, after != null ? /*#__PURE__*/_jsxs("div", {
|
|
321
|
+
...{
|
|
322
|
+
className: "x3nfvp2 x6s0dn4 xzye2dw xeuugli"
|
|
323
|
+
},
|
|
324
|
+
children: [resolvedContent, after]
|
|
325
|
+
}) : resolvedContent, overlay, below]
|
|
326
|
+
}) : resolvedContent;
|
|
317
327
|
return /*#__PURE__*/_jsx(HeaderCellComponent, {
|
|
318
328
|
...mergedHtmlProps,
|
|
319
329
|
...headerTitleProp,
|
|
330
|
+
contextMenuActions: cellRenderProps.contextMenuActions,
|
|
320
331
|
xstyle: cellRenderProps.styles,
|
|
321
|
-
children:
|
|
322
|
-
children: [before, after != null ? /*#__PURE__*/_jsxs("div", {
|
|
323
|
-
...{
|
|
324
|
-
className: "x3nfvp2 x6s0dn4 xzye2dw xeuugli"
|
|
325
|
-
},
|
|
326
|
-
children: [resolvedContent, after]
|
|
327
|
-
}) : resolvedContent, overlay, below]
|
|
328
|
-
}) : resolvedContent
|
|
332
|
+
children: headerInner
|
|
329
333
|
}, col.key);
|
|
330
334
|
});
|
|
331
335
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAQ3D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,WAAW,EAEZ,MAAM,SAAS,CAAC;AAOjB,oDAAoD;AAEpD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/D,kCAAkC;AAElC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE,8DAA8D;AAE9D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpD;;;;;GAKG;AAEH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,IAAI,CACzE,cAAc,CAAC,CAAC,CAAC,EACjB,SAAS,GAAG,YAAY,CACzB;IACC,uCAAuC;IACvC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1C;
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAQ3D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,WAAW,EAEZ,MAAM,SAAS,CAAC;AAOjB,oDAAoD;AAEpD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/D,kCAAkC;AAElC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE,8DAA8D;AAE9D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpD;;;;;GAKG;AAEH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,IAAI,CACzE,cAAc,CAAC,CAAC,CAAC,EACjB,SAAS,GAAG,YAAY,CACzB;IACC,uCAAuC;IACvC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1C;AAyJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK,EAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAAC,KACjD,YAAY,CAAC"}
|
package/dist/Table/Table.js
CHANGED
|
@@ -80,7 +80,16 @@ function TableScrollWrapper({
|
|
|
80
80
|
...restHtmlProps
|
|
81
81
|
} = htmlProps ?? {};
|
|
82
82
|
return /*#__PURE__*/_jsxs("div", {
|
|
83
|
-
ref: ref
|
|
83
|
+
ref: ref
|
|
84
|
+
// Keyboard-focusable so keyboard users can scroll a horizontally
|
|
85
|
+
// overflowing table. Uses role="group" (not "region") so multiple
|
|
86
|
+
// tables on a page don't create duplicate same-named landmarks
|
|
87
|
+
// (axe: landmark-unique). Callers may override role/aria-label via
|
|
88
|
+
// htmlProps.
|
|
89
|
+
,
|
|
90
|
+
tabIndex: 0,
|
|
91
|
+
role: "group",
|
|
92
|
+
"aria-label": "Table",
|
|
84
93
|
...restHtmlProps,
|
|
85
94
|
...mergeProps(themeProps('table-scroll-wrapper'), stylex.props(scrollWrapperStyles.base, scrollWrapperStyles.containerBleed, ...(pluginStyles ?? []))),
|
|
86
95
|
children: [beforeTable, children, afterTable]
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { ReactNode } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
14
|
import type { StyleXStyles } from '../theme/types';
|
|
15
|
+
import type { TableContextActions } from './types';
|
|
15
16
|
/** Props for TableCell — thin `<td>` wrapper */
|
|
16
17
|
export interface TableCellProps extends BaseProps<HTMLTableCellElement> {
|
|
17
18
|
/** Ref forwarded to the root element */
|
|
@@ -30,6 +31,12 @@ export interface TableCellProps extends BaseProps<HTMLTableCellElement> {
|
|
|
30
31
|
* Must be a `stylex.create()` value — not an inline style object.
|
|
31
32
|
*/
|
|
32
33
|
xstyle?: StyleXStyles | StyleXStyles[];
|
|
34
|
+
/**
|
|
35
|
+
* Right-click actions rendered as a context menu around the cell content.
|
|
36
|
+
* The cell owns the wrapper so it controls how the menu interacts with its
|
|
37
|
+
* padding / content. Empty or undefined renders no menu.
|
|
38
|
+
*/
|
|
39
|
+
contextMenuActions?: TableContextActions;
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
35
42
|
* TableCell — a `<td>` wrapper for children/streaming mode.
|
|
@@ -45,7 +52,7 @@ export interface TableCellProps extends BaseProps<HTMLTableCellElement> {
|
|
|
45
52
|
* </TableRow>
|
|
46
53
|
* ```
|
|
47
54
|
*/
|
|
48
|
-
export declare function TableCell({ children, xstyle, ref, className: incomingClassName, style: incomingStyle, ...props }: TableCellProps): import("react").JSX.Element;
|
|
55
|
+
export declare function TableCell({ children, xstyle, ref, className: incomingClassName, style: incomingStyle, contextMenuActions, ...props }: TableCellProps): import("react").JSX.Element;
|
|
49
56
|
export declare namespace TableCell {
|
|
50
57
|
var displayName: string;
|
|
51
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableCell.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableCell.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAgBjD,gDAAgD;AAChD,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IACrE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;IAChD,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;CAC1C;AAsHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,MAAM,EACN,GAAG,EACH,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,aAAa,EACpB,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,cAAc,+BAwDhB;yBAhEe,SAAS"}
|
package/dist/Table/TableCell.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
17
|
import "../theme/tokens.stylex.js";
|
|
18
18
|
import { borderVars, colorVars, spacingVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
19
|
+
import { wrapInTableContextMenu } from "./tableContextMenu.js";
|
|
19
20
|
import "./table.stylex.js";
|
|
20
21
|
import { overflowStyles, wrapStyles, containerEdgeStyles, tableRowMarker } from "./table.stylex.js";
|
|
21
22
|
import { useTableContext, buildDividerStyles, mergeXStyle } from "./useTableCellStyles.js";
|
|
@@ -47,6 +48,69 @@ const densityStyles = {
|
|
|
47
48
|
$$css: true
|
|
48
49
|
}
|
|
49
50
|
};
|
|
51
|
+
|
|
52
|
+
// When a cell owns a context menu, its padding moves from the `<td>` onto the
|
|
53
|
+
// right-click trigger wrapper so the *entire* cell (padding included) opens the
|
|
54
|
+
// menu. Without this, right-clicking the padding ring near a cell edge falls
|
|
55
|
+
// through to the browser's native menu. Paired with `contextMenuCellStyles` on
|
|
56
|
+
// the `<td>` (font/box-sizing only — no padding).
|
|
57
|
+
const densityTextStyles = {
|
|
58
|
+
compact: {
|
|
59
|
+
kGuDYH: "xjm74w1",
|
|
60
|
+
kB7OPa: "x9f619",
|
|
61
|
+
$$css: true
|
|
62
|
+
},
|
|
63
|
+
balanced: {
|
|
64
|
+
kGuDYH: "xjm74w1",
|
|
65
|
+
kB7OPa: "x9f619",
|
|
66
|
+
$$css: true
|
|
67
|
+
},
|
|
68
|
+
spacious: {
|
|
69
|
+
kGuDYH: "xjm74w1",
|
|
70
|
+
kB7OPa: "x9f619",
|
|
71
|
+
$$css: true
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const densityPaddingStyles = {
|
|
75
|
+
compact: {
|
|
76
|
+
k8WAf4: "xu0wf1k",
|
|
77
|
+
kg3NbH: "xf314gf",
|
|
78
|
+
$$css: true
|
|
79
|
+
},
|
|
80
|
+
balanced: {
|
|
81
|
+
k8WAf4: "xce4md1",
|
|
82
|
+
kg3NbH: "xrrkdod",
|
|
83
|
+
$$css: true
|
|
84
|
+
},
|
|
85
|
+
spacious: {
|
|
86
|
+
k8WAf4: "x8o8v82",
|
|
87
|
+
kg3NbH: "x1pzlopt",
|
|
88
|
+
$$css: true
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// The trigger wrapper fills the whole cell (a `<td>` child with height:100%
|
|
93
|
+
// stretches to the row height) so a right-click anywhere in the cell opens the
|
|
94
|
+
// menu. It carries the density padding relocated off the `<td>`.
|
|
95
|
+
const triggerFillStyles = {
|
|
96
|
+
fill: {
|
|
97
|
+
k1xSpc: "x1lliihq",
|
|
98
|
+
kB7OPa: "x9f619",
|
|
99
|
+
kZKoxP: "x5yr21d",
|
|
100
|
+
kzqmXN: "xh8yej3",
|
|
101
|
+
$$css: true
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// `height:100%` on the `<td>` is the CSS trick that lets a block child resolve
|
|
106
|
+
// its own `height:100%` against the row height — so the trigger fills the cell
|
|
107
|
+
// vertically (top/bottom padding included) and is fully right-clickable.
|
|
108
|
+
const contextMenuCellStyles = {
|
|
109
|
+
cell: {
|
|
110
|
+
kZKoxP: "x5yr21d",
|
|
111
|
+
$$css: true
|
|
112
|
+
}
|
|
113
|
+
};
|
|
50
114
|
const dividerRowStyles = {
|
|
51
115
|
cell: {
|
|
52
116
|
kt9PQ7: "x92x3c3 x1wp2rvj",
|
|
@@ -98,23 +162,28 @@ export function TableCell({
|
|
|
98
162
|
ref,
|
|
99
163
|
className: incomingClassName,
|
|
100
164
|
style: incomingStyle,
|
|
165
|
+
contextMenuActions,
|
|
101
166
|
...props
|
|
102
167
|
}) {
|
|
103
168
|
const ctx = useTableContext();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
169
|
+
const hasContextMenu = typeof contextMenuActions === 'function' || Array.isArray(contextMenuActions) && contextMenuActions.length > 0;
|
|
170
|
+
|
|
171
|
+
// When the cell owns a context menu, its density padding is relocated onto
|
|
172
|
+
// the right-click trigger wrapper (see `content` below) so the entire cell —
|
|
173
|
+
// padding included — opens the menu. Otherwise padding lives on the `<td>`.
|
|
174
|
+
const cellStyles = ctx ? [hasContextMenu ? densityTextStyles[ctx.density] : densityStyles[ctx.density], ctx.textOverflow === 'truncate' ? overflowStyles.cell : wrapStyles.cell, containerEdgeStyles[ctx.density], verticalAlignStyles[ctx.verticalAlign], ...buildDividerStyles(ctx, dividerRowStyles.cell, dividerColumnStyles.cell), ...(hasContextMenu ? [contextMenuCellStyles.cell] : [])] : [];
|
|
175
|
+
|
|
176
|
+
// The cell owns the context-menu wrapper so it controls how the menu
|
|
177
|
+
// interacts with its padding / content. No-op when no actions. When actions
|
|
178
|
+
// exist we make the trigger fill the cell and carry the density padding so a
|
|
179
|
+
// right-click anywhere in the cell (including the padding ring) opens it.
|
|
180
|
+
const triggerXstyle = hasContextMenu && ctx ? [triggerFillStyles.fill, densityPaddingStyles[ctx.density]] : hasContextMenu ? triggerFillStyles.fill : undefined;
|
|
181
|
+
const content = wrapInTableContextMenu(children, contextMenuActions, triggerXstyle);
|
|
113
182
|
return /*#__PURE__*/_jsx("td", {
|
|
114
183
|
ref: ref,
|
|
115
184
|
...props,
|
|
116
185
|
...mergeProps(themeProps('table-cell'), stylex.props(...mergeXStyle(cellStyles, xstyle)), incomingClassName, incomingStyle),
|
|
117
|
-
children:
|
|
186
|
+
children: content
|
|
118
187
|
});
|
|
119
188
|
}
|
|
120
189
|
TableCell.displayName = 'TableCell';
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { ReactNode } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
14
|
import type { StyleXStyles } from '../theme/types';
|
|
15
|
+
import type { TableContextActions } from './types';
|
|
15
16
|
/** Props for TableHeaderCell — `<th>` wrapper with context-aware styling */
|
|
16
17
|
export interface TableHeaderCellProps extends BaseProps<HTMLTableCellElement> {
|
|
17
18
|
/** Ref forwarded to the root element */
|
|
@@ -24,6 +25,12 @@ export interface TableHeaderCellProps extends BaseProps<HTMLTableCellElement> {
|
|
|
24
25
|
* Must be a `stylex.create()` value — not an inline style object.
|
|
25
26
|
*/
|
|
26
27
|
xstyle?: StyleXStyles | StyleXStyles[];
|
|
28
|
+
/**
|
|
29
|
+
* Right-click actions rendered as a context menu around the cell content.
|
|
30
|
+
* The cell owns the wrapper so it controls how the menu interacts with its
|
|
31
|
+
* padding / content. Empty or undefined renders no menu.
|
|
32
|
+
*/
|
|
33
|
+
contextMenuActions?: TableContextActions;
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* TableHeaderCell — a `<th>` wrapper for header cells.
|
|
@@ -44,7 +51,7 @@ export interface TableHeaderCellProps extends BaseProps<HTMLTableCellElement> {
|
|
|
44
51
|
* </thead>
|
|
45
52
|
* ```
|
|
46
53
|
*/
|
|
47
|
-
export declare function TableHeaderCell({ children, xstyle, ref, className: incomingClassName, style: incomingStyle, ...props }: TableHeaderCellProps): import("react").JSX.Element;
|
|
54
|
+
export declare function TableHeaderCell({ children, xstyle, ref, className: incomingClassName, style: incomingStyle, contextMenuActions, ...props }: TableHeaderCellProps): import("react").JSX.Element;
|
|
48
55
|
export declare namespace TableHeaderCell {
|
|
49
56
|
var displayName: string;
|
|
50
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAOjD,4EAA4E;AAC5E,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC3E,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,oDAAoD;IACpD,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;CAC1C;AAkDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,GAAG,EACH,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,aAAa,EACpB,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAsCtB;yBA9Ce,eAAe"}
|
|
@@ -18,6 +18,7 @@ import "../theme/tokens.stylex.js";
|
|
|
18
18
|
import { colorVars, spacingVars, fontWeightVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
19
19
|
import { overflowStyles, containerEdgeStyles } from "./table.stylex.js";
|
|
20
20
|
import { useTableContext, mergeXStyle } from "./useTableCellStyles.js";
|
|
21
|
+
import { wrapInTableContextMenu } from "./tableContextMenu.js";
|
|
21
22
|
import { mergeProps } from "../utils/index.js";
|
|
22
23
|
import { themeProps } from "../utils/themeProps.js";
|
|
23
24
|
|
|
@@ -96,32 +97,31 @@ export function TableHeaderCell({
|
|
|
96
97
|
ref,
|
|
97
98
|
className: incomingClassName,
|
|
98
99
|
style: incomingStyle,
|
|
100
|
+
contextMenuActions,
|
|
99
101
|
...props
|
|
100
102
|
}) {
|
|
101
103
|
const ctx = useTableContext();
|
|
102
|
-
if (!ctx) {
|
|
103
|
-
return /*#__PURE__*/_jsx("th", {
|
|
104
|
-
ref: ref,
|
|
105
|
-
...props,
|
|
106
|
-
...mergeProps(themeProps('table-header-cell'), stylex.props(xstyle), incomingClassName, incomingStyle),
|
|
107
|
-
children: children
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
104
|
|
|
111
105
|
// Header cells always get the bottom divider (separates header from body).
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
const cellStyles = [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
// When used standalone (no table context) the cell renders plain, with no
|
|
107
|
+
// density/divider styles.
|
|
108
|
+
const cellStyles = [];
|
|
109
|
+
if (ctx) {
|
|
110
|
+
cellStyles.push(headerStyles.cell, densityStyles[ctx.density], headerDividerStyles.cell, overflowStyles.cell, containerEdgeStyles[ctx.density]);
|
|
111
|
+
// Column dividers come from the shared builder (column axis only).
|
|
112
|
+
if (ctx.dividers === 'columns' || ctx.dividers === 'grid') {
|
|
113
|
+
cellStyles.push(dividerColumnStyles.cell);
|
|
114
|
+
}
|
|
119
115
|
}
|
|
116
|
+
|
|
117
|
+
// The cell owns the context-menu wrapper so it controls how the menu
|
|
118
|
+
// interacts with its padding / content. No-op when no actions.
|
|
119
|
+
const content = wrapInTableContextMenu(children, contextMenuActions);
|
|
120
120
|
return /*#__PURE__*/_jsx("th", {
|
|
121
121
|
ref: ref,
|
|
122
122
|
...props,
|
|
123
123
|
...mergeProps(themeProps('table-header-cell'), stylex.props(...mergeXStyle(cellStyles, xstyle)), incomingClassName, incomingStyle),
|
|
124
|
-
children:
|
|
124
|
+
children: content
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
TableHeaderCell.displayName = 'TableHeaderCell';
|
package/dist/Table/index.d.ts
CHANGED
|
@@ -23,10 +23,12 @@ export { useTableColumnSettings } from './plugins/columnSettings';
|
|
|
23
23
|
export { useTableColumnSettingsState } from './plugins/columnSettings';
|
|
24
24
|
export { useTableColumnResize } from './plugins/columnResize';
|
|
25
25
|
export { useTableStickyColumns } from './plugins/stickyColumns';
|
|
26
|
+
export { useTableRowExpansion, useTableRowExpansionState, } from './plugins/rowExpansion';
|
|
27
|
+
export { resolveContextActions } from './tableContextMenu';
|
|
26
28
|
export { useTableFiltering, useTableFilterState, toSearchFilters, } from './plugins/filtering';
|
|
27
29
|
export { useBaseTablePlugins } from './useBaseTablePlugins';
|
|
28
30
|
export { proportional, pixel, generateColumns, resolveColumnWidths, DEFAULT_MIN_COLUMN_WIDTH, } from './columnUtils';
|
|
29
|
-
export type { TableColumn, TableColumnAlign, TableVerticalAlign, ColumnWidth, ProportionalWidth, PixelWidth, TablePlugin, TableRenderProps, HeaderRowRenderProps, HeaderCellRenderProps, BodyRowRenderProps, BodyCellRenderProps, ScrollWrapperRenderProps, BaseTableProps, } from './types';
|
|
31
|
+
export type { TableColumn, TableColumnAlign, TableVerticalAlign, ColumnWidth, ProportionalWidth, PixelWidth, TablePlugin, TableContextAction, TableContextActions, TableRenderProps, HeaderRowRenderProps, HeaderCellRenderProps, BodyRowRenderProps, BodyCellRenderProps, ScrollWrapperRenderProps, BaseTableProps, } from './types';
|
|
30
32
|
export type { TableProps, TableDensity, TableDividers, TableTextOverflow, } from './Table';
|
|
31
33
|
export type { TableRowProps } from './TableRow';
|
|
32
34
|
export type { TableCellProps } from './TableCell';
|
|
@@ -44,5 +46,6 @@ export type { UseTableColumnSettingsConfig, ColumnSettingsOption, } from './plug
|
|
|
44
46
|
export type { UseTableColumnSettingsStateConfig, UseTableColumnSettingsStateReturn, } from './plugins/columnSettings';
|
|
45
47
|
export type { UseTableColumnResizeConfig } from './plugins/columnResize';
|
|
46
48
|
export type { UseTableStickyColumnsConfig } from './plugins/stickyColumns';
|
|
49
|
+
export type { UseTableRowExpansionConfig } from './plugins/rowExpansion';
|
|
47
50
|
export type { UseTableFilteringConfig, TableFilterState, TableFilterVariant, TableFilterValue, TableFilterFieldRef, } from './plugins/filtering';
|
|
48
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,2BAA2B,EAAC,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,YAAY,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,YAAY,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AACjE,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAC,yBAAyB,EAAC,MAAM,SAAS,CAAC;AACvD,YAAY,EAAC,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAC,0BAA0B,EAAC,MAAM,wBAAwB,CAAC;AACvE,YAAY,EAAC,2BAA2B,EAAC,MAAM,yBAAyB,CAAC;AACzE,YAAY,EAAC,0BAA0B,EAAC,MAAM,wBAAwB,CAAC;AACvE,YAAY,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/Table/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file index.ts
|
|
7
5
|
* @input Imports from Table component files
|
|
@@ -10,6 +8,7 @@
|
|
|
10
8
|
*
|
|
11
9
|
* SYNC: When modified, update this header and /packages/core/src/Table/Table.doc.mjs
|
|
12
10
|
*/
|
|
11
|
+
|
|
13
12
|
export { Table } from "./Table.js";
|
|
14
13
|
export { TableRow } from "./TableRow.js";
|
|
15
14
|
export { TableCell } from "./TableCell.js";
|
|
@@ -27,6 +26,8 @@ export { useTableColumnSettings } from "./plugins/columnSettings/index.js";
|
|
|
27
26
|
export { useTableColumnSettingsState } from "./plugins/columnSettings/index.js";
|
|
28
27
|
export { useTableColumnResize } from "./plugins/columnResize/index.js";
|
|
29
28
|
export { useTableStickyColumns } from "./plugins/stickyColumns/index.js";
|
|
29
|
+
export { useTableRowExpansion, useTableRowExpansionState } from "./plugins/rowExpansion/index.js";
|
|
30
|
+
export { resolveContextActions } from "./tableContextMenu.js";
|
|
30
31
|
export { useTableFiltering, useTableFilterState, toSearchFilters } from "./plugins/filtering/index.js";
|
|
31
32
|
export { useBaseTablePlugins } from "./useBaseTablePlugins.js";
|
|
32
33
|
export { proportional, pixel, generateColumns, resolveColumnWidths, DEFAULT_MIN_COLUMN_WIDTH } from "./columnUtils.js";
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @param data - Full data array
|
|
14
14
|
* @param page - Current page number (1-based)
|
|
15
|
-
* @param pageSize - Number of items per page
|
|
15
|
+
* @param pageSize - Number of items per page; coerced to a positive integer,
|
|
16
|
+
* non-finite values fall back to 10
|
|
16
17
|
* @returns Slice of data for the current page
|
|
17
18
|
*
|
|
18
19
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateData.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/pagination/paginateData.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"paginateData.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/pagination/paginateData.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,CAAC,EAAE,EACT,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,EAAE,CASL"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @param data - Full data array
|
|
17
17
|
* @param page - Current page number (1-based)
|
|
18
|
-
* @param pageSize - Number of items per page
|
|
18
|
+
* @param pageSize - Number of items per page; coerced to a positive integer,
|
|
19
|
+
* non-finite values fall back to 10
|
|
19
20
|
* @returns Slice of data for the current page
|
|
20
21
|
*
|
|
21
22
|
* @example
|
|
@@ -27,6 +28,10 @@
|
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
30
|
export function paginateData(data, page, pageSize) {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
// Same coercion as Pagination and useTablePagination: a 0/NaN/negative
|
|
32
|
+
// pageSize would slice every page empty while the pagination chrome still
|
|
33
|
+
// renders page buttons.
|
|
34
|
+
const size = Number.isFinite(pageSize) ? Math.max(1, Math.floor(pageSize)) : 10;
|
|
35
|
+
const start = (page - 1) * size;
|
|
36
|
+
return data.slice(start, start + size);
|
|
32
37
|
}
|