@astryxdesign/core 0.1.6 → 0.1.7-canary.04cd8f7
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 +68 -0
- package/README.md +25 -14
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +4 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +4 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +8 -6
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/Button/Button.d.ts +10 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +49 -6
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +27 -11
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +29 -7
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -5
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -1
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +9 -2
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -2
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +6 -4
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +4 -2
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +8 -2
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +3 -1
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +3 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +13 -8
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts +12 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +43 -6
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +4 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +4 -2
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +3 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +3 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +10 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +71 -53
- package/dist/Collapsible/Collapsible.d.ts +11 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +36 -4
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +8 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +4 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +4 -1
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +8 -4
- package/dist/ContextMenu/index.d.ts +3 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +7 -1
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +10 -5
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -6
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +15 -7
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +15 -12
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +7 -3
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +19 -9
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +89 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +170 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +70 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +10 -1
- package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemRoles.js +15 -0
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +11 -1
- package/dist/Icon/Icon.d.ts +17 -12
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +28 -20
- package/dist/Kbd/Kbd.js +1 -1
- package/dist/Layer/useLayer.d.ts +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +23 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +6 -4
- package/dist/Link/Link.d.ts +5 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +32 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +10 -8
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +4 -2
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +4 -1
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +13 -6
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +5 -1
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +22 -12
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +26 -20
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +34 -21
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +4 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +52 -14
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +3 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +5 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +7 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +6 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +5 -3
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +56 -19
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +12 -5
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +8 -6
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +1 -1
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +5 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +6 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -2
- package/dist/Table/plugins/tree/index.d.ts +5 -0
- package/dist/Table/plugins/tree/index.d.ts.map +1 -0
- package/dist/Table/plugins/tree/index.js +4 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
- package/dist/Table/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +6 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +8 -2
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +18 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +3 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +8 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +3 -1
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +8 -1
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +4 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +5 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +5 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +8 -4
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -0
- package/dist/astryx.css +38 -4
- package/dist/astryx.umd.js +62 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/docs-types.d.ts +13 -4
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +61 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/hct.d.ts +0 -1
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +0 -3
- package/dist/utils/color.d.ts +13 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +23 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/locales/en.json +754 -0
- package/locales/pseudo.json +566 -0
- package/package.json +23 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.doc.mjs +8 -0
- package/src/Button/Button.test.tsx +27 -0
- package/src/Button/Button.tsx +51 -5
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.test.tsx +103 -2
- package/src/Calendar/Calendar.tsx +29 -6
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.test.tsx +127 -2
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/index.ts +1 -0
- package/src/Chat/useChatStreamScroll.test.tsx +168 -0
- package/src/Chat/useChatStreamScroll.ts +67 -11
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +7 -0
- package/src/Collapsible/Collapsible.test.tsx +80 -0
- package/src/Collapsible/Collapsible.tsx +58 -5
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.test.tsx +75 -1
- package/src/ContextMenu/ContextMenu.tsx +14 -6
- package/src/ContextMenu/index.ts +15 -0
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.test.tsx +17 -5
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/Dialog.tsx +11 -15
- package/src/Dialog/DialogHeader.tsx +7 -3
- package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +23 -14
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +237 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +119 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
- package/src/DropdownMenu/index.ts +23 -3
- package/src/DropdownMenu/menuItemRoles.ts +22 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +3 -3
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/FileInput/FileInput.test.tsx +40 -1
- package/src/FileInput/FileInput.tsx +12 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/Icon/Icon.test.tsx +46 -0
- package/src/Icon/Icon.tsx +37 -24
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Kbd/Kbd.test.tsx +26 -0
- package/src/Kbd/Kbd.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +8 -5
- package/src/Layer/useLayer.test.tsx +136 -1
- package/src/Layer/useLayer.tsx +34 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -1
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +6 -3
- package/src/Selector/Selector.test.tsx +114 -6
- package/src/Selector/Selector.tsx +68 -17
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/TabList.tsx +12 -1
- package/src/TabList/TabMenu.tsx +4 -1
- package/src/Table/BaseTable.tsx +36 -19
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +7 -5
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -1
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +4 -4
- package/src/Table/plugins/tree/index.ts +12 -0
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
- package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
- package/src/Table/types.ts +18 -12
- package/src/Table/useBaseTablePlugins.ts +6 -2
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Table/useTableTreeData.doc.mjs +75 -0
- package/src/Table/useTableTreeState.doc.mjs +98 -0
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.tsx +10 -3
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +938 -0
- package/src/docs-types.ts +15 -10
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +82 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/hct.ts +0 -4
- package/src/utils/color.test.ts +101 -1
- package/src/utils/color.ts +23 -1
- package/src/utils/index.ts +8 -1
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useTableTreeState.tsx
|
|
7
|
+
* @input React
|
|
8
|
+
* @output Exports useTableTreeState hook and config/result types
|
|
9
|
+
* @position Tree state helper; owns the expanded set + flattens nested data.
|
|
10
|
+
* Pairs with useTableTreeData (the headless tree plugin).
|
|
11
|
+
*
|
|
12
|
+
* Modeled after useTableSortableState — a convenience layer that owns state
|
|
13
|
+
* (controlled or uncontrolled) and produces both the visible flattened rows
|
|
14
|
+
* and a ready-to-use config for the headless plugin. Data shaping stays
|
|
15
|
+
* outside the render pipeline: Table always receives exactly the rows it
|
|
16
|
+
* renders, so collapsed subtrees are unmounted, not hidden.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {useCallback, useMemo, useRef, useState} from 'react';
|
|
20
|
+
import type {
|
|
21
|
+
TableTreeRowMeta,
|
|
22
|
+
UseTableTreeDataConfig,
|
|
23
|
+
} from './useTableTreeData';
|
|
24
|
+
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Config
|
|
27
|
+
// =============================================================================
|
|
28
|
+
|
|
29
|
+
export interface UseTableTreeStateConfig<T extends Record<string, unknown>> {
|
|
30
|
+
/** Nested data: rows may carry child rows under `childrenKey`. */
|
|
31
|
+
data: T[];
|
|
32
|
+
/** Row ID accessor: property name, or a function returning a unique id. */
|
|
33
|
+
idKey: (keyof T & string) | ((item: T) => string | number);
|
|
34
|
+
/**
|
|
35
|
+
* Property holding each row's children array.
|
|
36
|
+
* @default 'children'
|
|
37
|
+
*/
|
|
38
|
+
childrenKey?: string;
|
|
39
|
+
/** Initial expanded row ids for uncontrolled mode. Ignored when `expandedIds` is provided. */
|
|
40
|
+
defaultExpandedIds?: Iterable<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Controlled set of expanded row ids. When provided, the hook uses this
|
|
43
|
+
* instead of internal state. Pair with `onExpandedIdsChange`.
|
|
44
|
+
*/
|
|
45
|
+
expandedIds?: ReadonlySet<string>;
|
|
46
|
+
/** Called with the next expanded set whenever expansion changes. */
|
|
47
|
+
onExpandedIdsChange?: (ids: ReadonlySet<string>) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Should this row show an expander? Overrides the default
|
|
50
|
+
* "has a non-empty children array" check — use for lazy loading, where a
|
|
51
|
+
* row is expandable before its children have been fetched.
|
|
52
|
+
*/
|
|
53
|
+
isItemExpandable?: (item: T) => boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Sort each sibling group independently during flattening. Children always
|
|
56
|
+
* stay directly under their parent — sorting never crosses levels. Pass
|
|
57
|
+
* `applySort` from `useTableSortableState` to compose with column sorting.
|
|
58
|
+
*/
|
|
59
|
+
sortSiblings?: (siblings: T[]) => T[];
|
|
60
|
+
/** Indent step per level, forwarded to useTableTreeData. */
|
|
61
|
+
indent?: 'sm' | 'md' | 'lg';
|
|
62
|
+
/** Column that carries the tree affordance, forwarded to useTableTreeData. */
|
|
63
|
+
treeColumnKey?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// =============================================================================
|
|
67
|
+
// Result
|
|
68
|
+
// =============================================================================
|
|
69
|
+
|
|
70
|
+
export interface UseTableTreeStateResult<T extends Record<string, unknown>> {
|
|
71
|
+
/** The flattened, currently-visible rows. Pass to `<Table data>`. */
|
|
72
|
+
visibleData: T[];
|
|
73
|
+
/** Ready-to-use config for useTableTreeData. */
|
|
74
|
+
treeConfig: UseTableTreeDataConfig<T>;
|
|
75
|
+
/** The current expanded row ids. */
|
|
76
|
+
expandedIds: ReadonlySet<string>;
|
|
77
|
+
/** Expand every expandable row in the tree. */
|
|
78
|
+
expandAll: () => void;
|
|
79
|
+
/** Collapse every row. */
|
|
80
|
+
collapseAll: () => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// =============================================================================
|
|
84
|
+
// Hook
|
|
85
|
+
// =============================================================================
|
|
86
|
+
|
|
87
|
+
export function useTableTreeState<T extends Record<string, unknown>>(
|
|
88
|
+
config: UseTableTreeStateConfig<T>,
|
|
89
|
+
): UseTableTreeStateResult<T> {
|
|
90
|
+
const {
|
|
91
|
+
data,
|
|
92
|
+
idKey,
|
|
93
|
+
childrenKey = 'children',
|
|
94
|
+
defaultExpandedIds,
|
|
95
|
+
expandedIds: controlledExpandedIds,
|
|
96
|
+
onExpandedIdsChange,
|
|
97
|
+
isItemExpandable,
|
|
98
|
+
sortSiblings,
|
|
99
|
+
indent,
|
|
100
|
+
treeColumnKey,
|
|
101
|
+
} = config;
|
|
102
|
+
|
|
103
|
+
const getId = useCallback(
|
|
104
|
+
(item: T): string =>
|
|
105
|
+
typeof idKey === 'function' ? String(idKey(item)) : String(item[idKey]),
|
|
106
|
+
[idKey],
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const getChildren = useCallback(
|
|
110
|
+
(item: T): T[] => {
|
|
111
|
+
const children = item[childrenKey];
|
|
112
|
+
return Array.isArray(children) ? (children as T[]) : [];
|
|
113
|
+
},
|
|
114
|
+
[childrenKey],
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const getIsExpandable = useCallback(
|
|
118
|
+
(item: T): boolean =>
|
|
119
|
+
isItemExpandable ? isItemExpandable(item) : getChildren(item).length > 0,
|
|
120
|
+
[isItemExpandable, getChildren],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Internal state (used in uncontrolled mode)
|
|
124
|
+
const [internalExpandedIds, setInternalExpandedIds] = useState<
|
|
125
|
+
ReadonlySet<string>
|
|
126
|
+
>(() => new Set(defaultExpandedIds));
|
|
127
|
+
|
|
128
|
+
// Resolve controlled vs uncontrolled
|
|
129
|
+
const isControlled = controlledExpandedIds !== undefined;
|
|
130
|
+
const expandedIds = isControlled
|
|
131
|
+
? controlledExpandedIds
|
|
132
|
+
: internalExpandedIds;
|
|
133
|
+
|
|
134
|
+
// Stable refs so callbacks don't churn on inline-prop identity changes
|
|
135
|
+
const expandedIdsRef = useRef(expandedIds);
|
|
136
|
+
expandedIdsRef.current = expandedIds;
|
|
137
|
+
const onExpandedIdsChangeRef = useRef(onExpandedIdsChange);
|
|
138
|
+
onExpandedIdsChangeRef.current = onExpandedIdsChange;
|
|
139
|
+
|
|
140
|
+
const commitExpandedIds = useCallback(
|
|
141
|
+
(next: ReadonlySet<string>) => {
|
|
142
|
+
// Advance the ref immediately so a second commit in the same React
|
|
143
|
+
// batch (e.g. two onToggleItem calls in one event handler) builds
|
|
144
|
+
// on this one instead of the pre-batch set. The ref re-syncs from
|
|
145
|
+
// the resolved state on the next render either way.
|
|
146
|
+
expandedIdsRef.current = next;
|
|
147
|
+
if (!isControlled) {
|
|
148
|
+
setInternalExpandedIds(next);
|
|
149
|
+
}
|
|
150
|
+
onExpandedIdsChangeRef.current?.(next);
|
|
151
|
+
},
|
|
152
|
+
[isControlled],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// Flatten: depth-first walk emitting only visible rows, collecting per-row
|
|
156
|
+
// meta ({level, hasChildren, isExpanded}) in the same pass. Children mount
|
|
157
|
+
// only when their parent is expanded, so collapsed subtrees stay unmounted.
|
|
158
|
+
// `path` holds the ids on the current ancestor chain: an edge pointing back
|
|
159
|
+
// at an ancestor is skipped instead of recursing forever. Sibling arrays
|
|
160
|
+
// are copied before sortSiblings so an in-place sorter can't reorder the
|
|
161
|
+
// consumer's data.
|
|
162
|
+
const {visibleData, metaMap} = useMemo(() => {
|
|
163
|
+
const rows: T[] = [];
|
|
164
|
+
const meta = new Map<string, TableTreeRowMeta>();
|
|
165
|
+
const path = new Set<string>();
|
|
166
|
+
const walk = (items: T[], level: number) => {
|
|
167
|
+
const siblings = sortSiblings ? sortSiblings([...items]) : items;
|
|
168
|
+
for (const item of siblings) {
|
|
169
|
+
const id = getId(item);
|
|
170
|
+
if (path.has(id)) {
|
|
171
|
+
continue; // cyclic edge — this row is its own ancestor
|
|
172
|
+
}
|
|
173
|
+
const hasChildren = getIsExpandable(item);
|
|
174
|
+
const isExpanded = hasChildren && expandedIds.has(id);
|
|
175
|
+
rows.push(item);
|
|
176
|
+
meta.set(id, {id, level, hasChildren, isExpanded});
|
|
177
|
+
if (isExpanded) {
|
|
178
|
+
path.add(id);
|
|
179
|
+
walk(getChildren(item), level + 1);
|
|
180
|
+
path.delete(id);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
walk(data, 0);
|
|
185
|
+
return {visibleData: rows, metaMap: meta};
|
|
186
|
+
}, [data, expandedIds, getId, getChildren, getIsExpandable, sortSiblings]);
|
|
187
|
+
|
|
188
|
+
// Every expandable row id across the whole tree, including collapsed
|
|
189
|
+
// subtrees (drives expandAll and the migration no-op flag). Same
|
|
190
|
+
// ancestor-chain guard as the flatten walk.
|
|
191
|
+
const allExpandableIds = useMemo(() => {
|
|
192
|
+
const idsAcc: string[] = [];
|
|
193
|
+
const path = new Set<string>();
|
|
194
|
+
const walk = (items: T[]) => {
|
|
195
|
+
for (const item of items) {
|
|
196
|
+
const id = getId(item);
|
|
197
|
+
if (path.has(id)) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (getIsExpandable(item)) {
|
|
201
|
+
idsAcc.push(id);
|
|
202
|
+
}
|
|
203
|
+
path.add(id);
|
|
204
|
+
walk(getChildren(item));
|
|
205
|
+
path.delete(id);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
walk(data);
|
|
209
|
+
return idsAcc;
|
|
210
|
+
}, [data, getId, getChildren, getIsExpandable]);
|
|
211
|
+
|
|
212
|
+
const hasExpandableRows = allExpandableIds.length > 0;
|
|
213
|
+
|
|
214
|
+
const onToggleItem = useCallback(
|
|
215
|
+
(item: T) => {
|
|
216
|
+
const id = getId(item);
|
|
217
|
+
const next = new Set(expandedIdsRef.current);
|
|
218
|
+
if (next.has(id)) {
|
|
219
|
+
next.delete(id);
|
|
220
|
+
} else {
|
|
221
|
+
next.add(id);
|
|
222
|
+
}
|
|
223
|
+
commitExpandedIds(next);
|
|
224
|
+
},
|
|
225
|
+
[getId, commitExpandedIds],
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const expandAll = useCallback(() => {
|
|
229
|
+
commitExpandedIds(new Set(allExpandableIds));
|
|
230
|
+
}, [commitExpandedIds, allExpandableIds]);
|
|
231
|
+
|
|
232
|
+
const collapseAll = useCallback(() => {
|
|
233
|
+
commitExpandedIds(new Set());
|
|
234
|
+
}, [commitExpandedIds]);
|
|
235
|
+
|
|
236
|
+
const getRowMeta = useCallback(
|
|
237
|
+
(item: T): TableTreeRowMeta | undefined => metaMap.get(getId(item)),
|
|
238
|
+
[metaMap, getId],
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const treeConfig = useMemo(
|
|
242
|
+
(): UseTableTreeDataConfig<T> => ({
|
|
243
|
+
getRowMeta,
|
|
244
|
+
onToggleItem,
|
|
245
|
+
hasExpandableRows,
|
|
246
|
+
indent,
|
|
247
|
+
treeColumnKey,
|
|
248
|
+
}),
|
|
249
|
+
[getRowMeta, onToggleItem, hasExpandableRows, indent, treeColumnKey],
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
return {visibleData, treeConfig, expandedIds, expandAll, collapseAll};
|
|
253
|
+
}
|
package/src/Table/types.ts
CHANGED
|
@@ -223,13 +223,13 @@ export interface TableColumn<T extends Record<string, unknown>> {
|
|
|
223
223
|
/** Props passed through the plugin pipeline for the `<table>` element */
|
|
224
224
|
export interface TableRenderProps {
|
|
225
225
|
htmlProps: HTMLAttributes<HTMLTableElement>;
|
|
226
|
-
|
|
226
|
+
xstyle: StyleXStyles[];
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/** Props passed through the plugin pipeline for the header `<tr>` */
|
|
230
230
|
export interface HeaderRowRenderProps {
|
|
231
231
|
htmlProps: HTMLAttributes<HTMLTableRowElement>;
|
|
232
|
-
|
|
232
|
+
xstyle: StyleXStyles[];
|
|
233
233
|
children: ReactNode;
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -250,7 +250,7 @@ export interface HeaderRowRenderProps {
|
|
|
250
250
|
*/
|
|
251
251
|
export interface HeaderCellRenderProps {
|
|
252
252
|
htmlProps: ThHTMLAttributes<HTMLTableCellElement>;
|
|
253
|
-
|
|
253
|
+
xstyle: StyleXStyles[];
|
|
254
254
|
/** Content rendered before the header label. */
|
|
255
255
|
before?: ReactNode;
|
|
256
256
|
/** The header label content. Initialized from `column.header ?? column.key`. Plugins may wrap or replace. */
|
|
@@ -286,7 +286,7 @@ export interface HeaderCellRenderProps {
|
|
|
286
286
|
/** Props passed through the plugin pipeline for each body `<tr>` */
|
|
287
287
|
export interface BodyRowRenderProps {
|
|
288
288
|
htmlProps: HTMLAttributes<HTMLTableRowElement>;
|
|
289
|
-
|
|
289
|
+
xstyle: StyleXStyles[];
|
|
290
290
|
children: ReactNode;
|
|
291
291
|
/** Ref for the `<tr>` element. Plugins can set this to access the row DOM node. */
|
|
292
292
|
ref?: Ref<HTMLTableRowElement>;
|
|
@@ -295,7 +295,7 @@ export interface BodyRowRenderProps {
|
|
|
295
295
|
/** Props passed through the plugin pipeline for each body `<td>` */
|
|
296
296
|
export interface BodyCellRenderProps {
|
|
297
297
|
htmlProps: TdHTMLAttributes<HTMLTableCellElement>;
|
|
298
|
-
|
|
298
|
+
xstyle: StyleXStyles[];
|
|
299
299
|
/**
|
|
300
300
|
* Right-click context-menu actions for this body cell. Plugins append their
|
|
301
301
|
* actions in `transformBodyCell`; BaseTable concatenates the arrays across
|
|
@@ -341,7 +341,7 @@ export interface ScrollWrapperRenderProps {
|
|
|
341
341
|
htmlProps: HTMLAttributes<HTMLDivElement> & {
|
|
342
342
|
ref?: Ref<HTMLDivElement>;
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
xstyle: StyleXStyles[];
|
|
345
345
|
/** Content rendered before the `<table>`, inside the scroll container. */
|
|
346
346
|
beforeTable?: ReactNode;
|
|
347
347
|
/** Content rendered after the `<table>`, inside the scroll container. */
|
|
@@ -389,8 +389,7 @@ export interface TableContextAction {
|
|
|
389
389
|
* every render.
|
|
390
390
|
*/
|
|
391
391
|
export type TableContextActions =
|
|
392
|
-
| TableContextAction[]
|
|
393
|
-
| (() => TableContextAction[]);
|
|
392
|
+
TableContextAction[] | (() => TableContextAction[]);
|
|
394
393
|
|
|
395
394
|
// =============================================================================
|
|
396
395
|
// Plugin Interface
|
|
@@ -543,7 +542,14 @@ export interface BaseTableProps<
|
|
|
543
542
|
|
|
544
543
|
/** Children mode — render `<tr>`/`<td>` directly instead of data-driven */
|
|
545
544
|
children?: ReactNode;
|
|
546
|
-
/**
|
|
545
|
+
/**
|
|
546
|
+
* Additional HTML attributes for the `<table>` element.
|
|
547
|
+
*
|
|
548
|
+
* @deprecated Pass `className`, `style`, `xstyle`, and other HTML
|
|
549
|
+
* attributes directly on the component instead — they now reach the root
|
|
550
|
+
* `<table>` and win over `tableProps` on conflicts. Migrate with
|
|
551
|
+
* `npx astryx upgrade --codemod migrate-table-tableprops-to-direct-props`.
|
|
552
|
+
*/
|
|
547
553
|
tableProps?: HTMLAttributes<HTMLTableElement>;
|
|
548
554
|
/**
|
|
549
555
|
* Optional wrapper rendered around the `<table>` element, inside the
|
|
@@ -551,15 +557,15 @@ export interface BaseTableProps<
|
|
|
551
557
|
* horizontal scroll container so plugin chrome (pagination, toolbars)
|
|
552
558
|
* stays outside the scrollable area.
|
|
553
559
|
*
|
|
554
|
-
* Receives `htmlProps` (including an optional `ref`) and `
|
|
560
|
+
* Receives `htmlProps` (including an optional `ref`) and `xstyle` produced
|
|
555
561
|
* by the plugin `transformScrollWrapper` pipeline, plus `beforeTable`/`afterTable`
|
|
556
|
-
* chrome. The wrapper must spread `htmlProps` (and apply `
|
|
562
|
+
* chrome. The wrapper must spread `htmlProps` (and apply `xstyle`) onto its
|
|
557
563
|
* scroll-container element so plugins can attach refs / scroll listeners.
|
|
558
564
|
*/
|
|
559
565
|
scrollWrapper?: ComponentType<{
|
|
560
566
|
children: ReactNode;
|
|
561
567
|
htmlProps?: HTMLAttributes<HTMLDivElement> & {ref?: Ref<HTMLDivElement>};
|
|
562
|
-
|
|
568
|
+
xstyle?: StyleXStyles[];
|
|
563
569
|
beforeTable?: ReactNode;
|
|
564
570
|
afterTable?: ReactNode;
|
|
565
571
|
}>;
|
|
@@ -18,12 +18,15 @@
|
|
|
18
18
|
* Canonical order:
|
|
19
19
|
* 1. columnSettings — column filtering (future: transformColumns)
|
|
20
20
|
* 2. sort — header cell sort controls
|
|
21
|
-
* 3.
|
|
22
|
-
* 4.
|
|
21
|
+
* 3. tree — indent + expander on the tree column
|
|
22
|
+
* 4. selection — checkbox column + row selection
|
|
23
|
+
* 5. pagination — pagination controls around the table
|
|
23
24
|
*
|
|
24
25
|
* Rationale:
|
|
25
26
|
* - columnSettings filters columns before sort/selection see them
|
|
26
27
|
* - sort adds header cell UI before selection adds its header column
|
|
28
|
+
* - tree wraps the first *user* column before selection prepends its
|
|
29
|
+
* checkbox column, so the expander never lands in the checkbox column
|
|
27
30
|
* - selection adds its column after sort so the checkbox header
|
|
28
31
|
* doesn't get a sort button
|
|
29
32
|
* - pagination wraps the table in context last (outermost provider)
|
|
@@ -46,6 +49,7 @@ import type {TablePlugin} from './types';
|
|
|
46
49
|
const PLUGIN_ORDER: ReadonlyArray<string> = [
|
|
47
50
|
'columnSettings',
|
|
48
51
|
'sort',
|
|
52
|
+
'tree',
|
|
49
53
|
'selection',
|
|
50
54
|
'pagination',
|
|
51
55
|
];
|
|
@@ -23,7 +23,7 @@ export const docs = {
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'variant',
|
|
26
|
-
type: "'popover' | 'inline'",
|
|
26
|
+
type: "'popover' | 'inline' | 'inline-compact'",
|
|
27
27
|
description: 'Display variant for filter controls.',
|
|
28
28
|
default: "'popover'",
|
|
29
29
|
},
|
|
@@ -50,7 +50,7 @@ export const docsZh = {
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
name: 'variant',
|
|
53
|
-
type: "'popover' | 'inline'",
|
|
53
|
+
type: "'popover' | 'inline' | 'inline-compact'",
|
|
54
54
|
description: '筛选控件的显示变体。',
|
|
55
55
|
default: "'popover'",
|
|
56
56
|
},
|
|
@@ -7,7 +7,7 @@ export const docs = {
|
|
|
7
7
|
subComponentOf: 'Table',
|
|
8
8
|
displayName: 'useTableGroupedRows',
|
|
9
9
|
description:
|
|
10
|
-
'Hook that groups a flat data array into collapsible section rows. Each distinct groupBy value becomes a full-width section-header row with a chevron toggle, the group label, and a member count; collapsing hides that group\
|
|
10
|
+
'Hook that groups a flat data array into collapsible section rows. Each distinct groupBy value becomes a full-width section-header row with a chevron toggle, the group label, and a member count; collapsing hides that group\'s data rows while keeping the header visible. Mirrors useTableRowExpansionState: the consumer owns the collapsedGroups set and the hook returns {data, plugin, idKey}: pass all three to Table (data, plugins, and idKey respectively).',
|
|
11
11
|
props: [
|
|
12
12
|
{
|
|
13
13
|
name: 'data',
|
|
@@ -58,10 +58,10 @@ export const docs = {
|
|
|
58
58
|
/** @type {import('../docs-types').TranslationDoc} */
|
|
59
59
|
export const docsDense = {
|
|
60
60
|
description:
|
|
61
|
-
'Groups a flat data array into collapsible section rows. Each groupBy value becomes a full-width header (chevron + label + count); collapsing hides its rows. Returns {data, plugin, idKey}
|
|
61
|
+
'Groups a flat data array into collapsible section rows. Each groupBy value becomes a full-width header (chevron + label + count); collapsing hides its rows. Returns {data, plugin, idKey}: pass to Table data / plugins / idKey. Consumer owns the collapsedGroups set.',
|
|
62
62
|
propDescriptions: {
|
|
63
63
|
data: 'The flat data to group.',
|
|
64
|
-
groupBy: 'Derive a row\
|
|
64
|
+
groupBy: 'Derive a row\'s group key. Same key = same section.',
|
|
65
65
|
collapsedGroups: 'Set of currently-collapsed group keys.',
|
|
66
66
|
onToggleGroup: 'Called with the group key when a header is toggled.',
|
|
67
67
|
renderGroupHeader: "Custom header content (right of chevron). Default '<key> (<count>)'.",
|
|
@@ -13,20 +13,20 @@ export const docs = {
|
|
|
13
13
|
props: [
|
|
14
14
|
{
|
|
15
15
|
name: 'sort',
|
|
16
|
-
type:
|
|
17
|
-
description:
|
|
16
|
+
type: "Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>",
|
|
17
|
+
description: "Current sort state (TableSortState<TSortKey>). Ordered array of entries; the first is the primary sort, the rest are tiebreakers. An empty array means unsorted. Direction is the full word: 'ascending' / 'descending', not 'asc' / 'desc'.",
|
|
18
18
|
required: true,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
name: 'onSortChange',
|
|
22
|
-
type:
|
|
23
|
-
description: 'Called when the user clicks a header cell to change sort.',
|
|
22
|
+
type: "(sort: Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>) => void",
|
|
23
|
+
description: 'Called when the user clicks a header cell to change sort. Receives the next sort state.',
|
|
24
24
|
required: true,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: 'allowUnsortedState',
|
|
28
28
|
type: 'boolean',
|
|
29
|
-
description:
|
|
29
|
+
description: "Allow cycling back to unsorted. When true: 'ascending', 'descending', unsorted. When false: 'ascending', 'descending', 'ascending'.",
|
|
30
30
|
default: 'false',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -45,20 +45,20 @@ export const docsZh = {
|
|
|
45
45
|
props: [
|
|
46
46
|
{
|
|
47
47
|
name: 'sort',
|
|
48
|
-
type:
|
|
49
|
-
description:
|
|
48
|
+
type: "Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>",
|
|
49
|
+
description: "当前排序状态。{sortKey, direction} 条目的有序数组。第一个条目是主排序。方向值为完整单词 'ascending' / 'descending',不是 'asc' / 'desc'。",
|
|
50
50
|
required: true,
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'onSortChange',
|
|
54
|
-
type:
|
|
54
|
+
type: "(sort: Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>) => void",
|
|
55
55
|
description: '用户点击表头单元格更改排序时调用。',
|
|
56
56
|
required: true,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: 'allowUnsortedState',
|
|
60
60
|
type: 'boolean',
|
|
61
|
-
description:
|
|
61
|
+
description: "允许循环回到未排序状态。为 true 时:'ascending'、'descending'、未排序。为 false 时:'ascending'、'descending'、'ascending'。",
|
|
62
62
|
default: 'false',
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -75,9 +75,9 @@ export const docsDense = {
|
|
|
75
75
|
displayName: 'useTableSortable',
|
|
76
76
|
description: 'Headless multi-sort plugin. Consumer owns sort state + callback. Shift+click for secondary sort. Sort indicators auto-render in header cells.',
|
|
77
77
|
propDescriptions: {
|
|
78
|
-
sort:
|
|
78
|
+
sort: "Current sort state; ordered array of {sortKey, direction: 'ascending'|'descending'} entries. Not 'asc'/'desc'.",
|
|
79
79
|
onSortChange: 'Called on header click to change sort.',
|
|
80
|
-
allowUnsortedState:
|
|
80
|
+
allowUnsortedState: "Allow cycling to unsorted. true: ascending>descending>unsorted. false: ascending>descending>ascending.",
|
|
81
81
|
isMultiSortEnabled: 'Enable multi-sort via Shift+click. Regular click replaces sort state.',
|
|
82
82
|
},
|
|
83
83
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'useTableTreeData',
|
|
7
|
+
subComponentOf: 'Table',
|
|
8
|
+
displayName: 'useTableTreeData',
|
|
9
|
+
description:
|
|
10
|
+
'Headless tree plugin for Table: renders nested rows with per-level indentation and expand/collapse chevrons in the tree column (the first column by default), and reflects hierarchy on body rows via aria-level and aria-expanded. Composable with the other Table plugins: the canonical plugin order places tree before selection, so the checkbox column lands left of the indented tree column. Feed it the treeConfig from useTableTreeState, or construct the config directly for server-driven or pre-flattened trees. When no row is expandable (flat data), every transform is a pass-through and the table renders identically to one without the plugin. Known limitation: the tree column wraps its cell content, so textOverflow="truncate" tooltips do not apply within the tree column.',
|
|
11
|
+
props: [
|
|
12
|
+
{
|
|
13
|
+
name: 'getRowMeta',
|
|
14
|
+
type: '(item: T) => TableTreeRowMeta | undefined',
|
|
15
|
+
description:
|
|
16
|
+
'Structural meta for a visible row: {id, level (0-based), hasChildren, isExpanded}.',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'onToggleItem',
|
|
21
|
+
type: '(item: T) => void',
|
|
22
|
+
description: 'Toggle a row’s expansion.',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'hasExpandableRows',
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
description:
|
|
29
|
+
'Whether any row in the dataset is expandable. When false the plugin is a no-op: no expanders, no indent, no tree ARIA.',
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'indent',
|
|
34
|
+
type: "'sm' | 'md' | 'lg'",
|
|
35
|
+
description:
|
|
36
|
+
'Indent step per level, mapped to the spacing-3 / spacing-4 / spacing-6 tokens.',
|
|
37
|
+
default: "'md'",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'treeColumnKey',
|
|
41
|
+
type: 'string',
|
|
42
|
+
description:
|
|
43
|
+
'Column that carries the indent + expander. Defaults to the first column.',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
examples: [
|
|
47
|
+
{
|
|
48
|
+
label: 'File tree with expandable folders',
|
|
49
|
+
code: `const {visibleData, treeConfig} = useTableTreeState({
|
|
50
|
+
data: files, // rows may nest under 'children'
|
|
51
|
+
idKey: 'id',
|
|
52
|
+
defaultExpandedIds: ['src'],
|
|
53
|
+
});
|
|
54
|
+
const tree = useTableTreeData(treeConfig);
|
|
55
|
+
|
|
56
|
+
<Table data={visibleData} columns={columns} idKey="id" plugins={{tree}} />;`,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const docsDense = {
|
|
62
|
+
name: 'useTableTreeData',
|
|
63
|
+
displayName: 'useTableTreeData',
|
|
64
|
+
description:
|
|
65
|
+
'Headless tree plugin: indent + expander chevron on the tree column (first column by default), aria-level/aria-expanded on body rows. Canonical plugin order puts tree before selection (checkbox column lands left of tree column). Consume treeConfig from useTableTreeState, or construct directly for server-driven trees. hasExpandableRows=false => full no-op (flat-data migration).',
|
|
66
|
+
propDescriptions: {
|
|
67
|
+
getRowMeta:
|
|
68
|
+
'structural meta per visible row: {id, level (0-based), hasChildren, isExpanded}',
|
|
69
|
+
onToggleItem: 'toggle row expansion',
|
|
70
|
+
hasExpandableRows: 'false => plugin is a no-op (no expanders/indent/ARIA)',
|
|
71
|
+
indent:
|
|
72
|
+
"indent step per level: 'sm' | 'md' | 'lg' (spacing-3/4/6). Defaults to 'md'.",
|
|
73
|
+
treeColumnKey: 'column carrying indent + expander. Defaults to first column.',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'useTableTreeState',
|
|
7
|
+
subComponentOf: 'Table',
|
|
8
|
+
displayName: 'useTableTreeState',
|
|
9
|
+
description:
|
|
10
|
+
'State management companion for useTableTreeData. Owns the expanded set (controlled or uncontrolled) and flattens nested data into the visible row array — collapsed subtrees are unmounted, not hidden, so the table body contains exactly the visible rows. Returns expandAll/collapseAll helpers and a ready-to-use config for the tree plugin. Note: because collapsed rows unmount, cell-local React state inside collapsed subtrees is lost on collapse; lift state that must survive.',
|
|
11
|
+
props: [
|
|
12
|
+
{
|
|
13
|
+
name: 'data',
|
|
14
|
+
type: 'T[]',
|
|
15
|
+
description:
|
|
16
|
+
'Nested data: rows may carry child rows under childrenKey. Flat data (no children anywhere) makes the plugin a no-op, so it can be adopted before the data becomes hierarchical.',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'idKey',
|
|
21
|
+
type: '(keyof T & string) | ((item: T) => string | number)',
|
|
22
|
+
description:
|
|
23
|
+
'Row ID accessor: property name or function returning a unique id.',
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'childrenKey',
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Property holding each row’s children array.',
|
|
30
|
+
default: "'children'",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'defaultExpandedIds',
|
|
34
|
+
type: 'Iterable<string>',
|
|
35
|
+
description:
|
|
36
|
+
'Initial expanded row ids for uncontrolled mode. Ignored when expandedIds is provided.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'expandedIds',
|
|
40
|
+
type: 'ReadonlySet<string>',
|
|
41
|
+
description:
|
|
42
|
+
'Controlled set of expanded row ids. Pair with onExpandedIdsChange.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'onExpandedIdsChange',
|
|
46
|
+
type: '(ids: ReadonlySet<string>) => void',
|
|
47
|
+
description:
|
|
48
|
+
'Called with the next expanded set whenever expansion changes (both modes). In lazy-loading setups, trigger the children fetch here.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'isItemExpandable',
|
|
52
|
+
type: '(item: T) => boolean',
|
|
53
|
+
description:
|
|
54
|
+
'Should this row show an expander? Overrides the default non-empty-children check — use for lazy loading, where a row is expandable before its children have been fetched.',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'sortSiblings',
|
|
58
|
+
type: '(siblings: T[]) => T[]',
|
|
59
|
+
description:
|
|
60
|
+
'Sort each sibling group independently during flattening; children always stay directly under their parent. Pass applySort from useTableSortableState to compose with column sorting.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'indent',
|
|
64
|
+
type: "'sm' | 'md' | 'lg'",
|
|
65
|
+
description:
|
|
66
|
+
'Indent step per level (spacing-3 / spacing-4 / spacing-6), forwarded to useTableTreeData.',
|
|
67
|
+
default: "'md'",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'treeColumnKey',
|
|
71
|
+
type: 'string',
|
|
72
|
+
description:
|
|
73
|
+
'Column that carries the indent + expander, forwarded to useTableTreeData. Defaults to the first column.',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const docsDense = {
|
|
79
|
+
name: 'useTableTreeState',
|
|
80
|
+
displayName: 'useTableTreeState',
|
|
81
|
+
description:
|
|
82
|
+
'State companion for useTableTreeData. Owns expanded set (controlled or uncontrolled), flattens nested data to visible rows (collapsed subtrees unmounted, not hidden). Returns {visibleData, treeConfig, expandedIds, expandAll, collapseAll}. Cell-local state in collapsed subtrees is lost on collapse; lift state that must survive.',
|
|
83
|
+
propDescriptions: {
|
|
84
|
+
data: 'nested data; rows carry child rows under childrenKey. Flat data => plugin is a no-op.',
|
|
85
|
+
idKey: 'row ID accessor: property name or fn returning unique id',
|
|
86
|
+
childrenKey: "property holding children array. Defaults to 'children'.",
|
|
87
|
+
defaultExpandedIds: 'initial expanded ids (uncontrolled)',
|
|
88
|
+
expandedIds: 'controlled expanded set; pair with onExpandedIdsChange',
|
|
89
|
+
onExpandedIdsChange:
|
|
90
|
+
'called with next expanded set on change (both modes); trigger lazy children fetch here',
|
|
91
|
+
isItemExpandable:
|
|
92
|
+
'overrides non-empty-children expandability check (lazy loading)',
|
|
93
|
+
sortSiblings:
|
|
94
|
+
'sorts each sibling group during flattening; pass applySort from useTableSortableState',
|
|
95
|
+
indent: "indent step per level: 'sm' | 'md' | 'lg'. Defaults to 'md'.",
|
|
96
|
+
treeColumnKey: 'column carrying indent + expander. Defaults to first column.',
|
|
97
|
+
},
|
|
98
|
+
};
|
package/src/Text/Text.doc.mjs
CHANGED
|
@@ -23,8 +23,8 @@ export const docs = {
|
|
|
23
23
|
props: [
|
|
24
24
|
{
|
|
25
25
|
name: 'type',
|
|
26
|
-
type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3'",
|
|
27
|
-
description:
|
|
26
|
+
type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3' | 'inherit'",
|
|
27
|
+
description: "Semantic text type. Determines size, weight, and line-height from the theme. 'inherit' takes all three from the surrounding text instead. Themes may add custom types. Note: this prop is called `type`, not `variant`.",
|
|
28
28
|
default: "'body'",
|
|
29
29
|
},
|
|
30
30
|
{
|