@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
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from '../../../theme/tokens.stylex';
|
|
22
22
|
import {Icon} from '../../../Icon';
|
|
23
23
|
import type {TablePlugin} from '../../types';
|
|
24
|
+
import {useTranslator} from '../../../i18n';
|
|
24
25
|
|
|
25
26
|
// A synthetic group-header row injected into the flattened data. Real rows
|
|
26
27
|
// never carry this marker.
|
|
@@ -180,7 +181,7 @@ const styles = stylex.create({
|
|
|
180
181
|
* pass all three to `<Table>`.
|
|
181
182
|
*
|
|
182
183
|
* @example
|
|
183
|
-
* ```
|
|
184
|
+
* ```
|
|
184
185
|
* const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
|
|
185
186
|
* const grouped = useTableGroupedRows({
|
|
186
187
|
* data: rows,
|
|
@@ -205,6 +206,7 @@ const styles = stylex.create({
|
|
|
205
206
|
export function useTableGroupedRows<T extends Record<string, unknown>>(
|
|
206
207
|
config: UseTableGroupedRowsConfig<T>,
|
|
207
208
|
): UseTableGroupedRowsResult<T> {
|
|
209
|
+
const t = useTranslator();
|
|
208
210
|
const {
|
|
209
211
|
data,
|
|
210
212
|
groupBy,
|
|
@@ -305,7 +307,7 @@ export function useTableGroupedRows<T extends Record<string, unknown>>(
|
|
|
305
307
|
onClick: toggle,
|
|
306
308
|
'aria-expanded': !collapsed,
|
|
307
309
|
},
|
|
308
|
-
|
|
310
|
+
xstyle: [...props.xstyle, styles.headerRow],
|
|
309
311
|
children: (
|
|
310
312
|
// colSpan larger than the column count is clamped by the browser
|
|
311
313
|
// to the actual number of columns, so the header always spans the
|
|
@@ -323,8 +325,8 @@ export function useTableGroupedRows<T extends Record<string, unknown>>(
|
|
|
323
325
|
}}
|
|
324
326
|
aria-label={
|
|
325
327
|
collapsed
|
|
326
|
-
?
|
|
327
|
-
:
|
|
328
|
+
? t('@astryx.tableGroupedRows.expandGroup', {groupKey: header.groupKey})
|
|
329
|
+
: t('@astryx.tableGroupedRows.collapseGroup', {groupKey: header.groupKey})
|
|
328
330
|
}
|
|
329
331
|
aria-expanded={!collapsed}>
|
|
330
332
|
<span
|
|
@@ -342,7 +344,7 @@ export function useTableGroupedRows<T extends Record<string, unknown>>(
|
|
|
342
344
|
};
|
|
343
345
|
},
|
|
344
346
|
}),
|
|
345
|
-
[collapsedGroups, onToggleGroup, renderGroupHeader],
|
|
347
|
+
[collapsedGroups, onToggleGroup, renderGroupHeader, t],
|
|
346
348
|
);
|
|
347
349
|
|
|
348
350
|
return {plugin, data: flattened, idKey};
|
|
@@ -22,6 +22,7 @@ import {spacingVars} from '../../../theme/tokens.stylex';
|
|
|
22
22
|
import {Pagination} from '../../../Pagination';
|
|
23
23
|
import type {PaginationProps} from '../../../Pagination';
|
|
24
24
|
import type {TablePlugin} from '../../types';
|
|
25
|
+
import {useTranslator} from '../../../i18n';
|
|
25
26
|
|
|
26
27
|
// =============================================================================
|
|
27
28
|
// Styles
|
|
@@ -193,6 +194,7 @@ export interface UseTablePaginationConfig {
|
|
|
193
194
|
export function useTablePagination<T extends Record<string, unknown>>(
|
|
194
195
|
config: UseTablePaginationConfig,
|
|
195
196
|
): TablePlugin<T> {
|
|
197
|
+
const t = useTranslator();
|
|
196
198
|
const {
|
|
197
199
|
page,
|
|
198
200
|
onPageChange,
|
|
@@ -206,8 +208,9 @@ export function useTablePagination<T extends Record<string, unknown>>(
|
|
|
206
208
|
size = 'md',
|
|
207
209
|
position = 'below',
|
|
208
210
|
align = 'center',
|
|
209
|
-
label
|
|
211
|
+
label: labelFromProps,
|
|
210
212
|
} = config;
|
|
213
|
+
const label = labelFromProps ?? t('@astryx.table.pagination.label');
|
|
211
214
|
|
|
212
215
|
// Same guard as Pagination itself: 0/NaN/negative pageSize would produce an
|
|
213
216
|
// Infinity/NaN totalPages here, which bypasses Pagination's own coercion
|
|
@@ -17,6 +17,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
17
17
|
import {spacingVars, colorVars, radiusVars} from '../../../theme/tokens.stylex';
|
|
18
18
|
import {Icon} from '../../../Icon';
|
|
19
19
|
import {resolveContextActions} from '../../tableContextMenu';
|
|
20
|
+
import {useTranslator} from '../../../i18n';
|
|
20
21
|
import type {
|
|
21
22
|
TablePlugin,
|
|
22
23
|
TableColumn,
|
|
@@ -356,6 +357,7 @@ function ExpansionChevron({
|
|
|
356
357
|
export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
357
358
|
config: UseTableRowExpansionConfig<T>,
|
|
358
359
|
): TablePlugin<T> {
|
|
360
|
+
const t = useTranslator();
|
|
359
361
|
const {
|
|
360
362
|
expandedKeys,
|
|
361
363
|
onToggle,
|
|
@@ -397,7 +399,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
397
399
|
<ExpansionChevron
|
|
398
400
|
isExpanded={isExpanded}
|
|
399
401
|
onToggle={() => onToggle(key)}
|
|
400
|
-
ariaLabel={isExpanded ? '
|
|
402
|
+
ariaLabel={isExpanded ? t('@astryx.tableRowExpansion.collapseRow') : t('@astryx.tableRowExpansion.expandRow')}
|
|
401
403
|
/>
|
|
402
404
|
);
|
|
403
405
|
},
|
|
@@ -409,6 +411,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
409
411
|
getChildren,
|
|
410
412
|
getIsItemExpandable,
|
|
411
413
|
getDepth,
|
|
414
|
+
t,
|
|
412
415
|
],
|
|
413
416
|
);
|
|
414
417
|
|
|
@@ -436,10 +439,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
436
439
|
? originalRenderCell(item)
|
|
437
440
|
: String(
|
|
438
441
|
((item as Record<string, unknown>)[col.key] as
|
|
439
|
-
|
|
|
440
|
-
| number
|
|
441
|
-
| null
|
|
442
|
-
| undefined) ?? '',
|
|
442
|
+
string | number | null | undefined) ?? '',
|
|
443
443
|
);
|
|
444
444
|
|
|
445
445
|
if (depth === 0) {
|
|
@@ -457,7 +457,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
457
457
|
<ExpansionChevron
|
|
458
458
|
isExpanded={isExpanded}
|
|
459
459
|
onToggle={() => onToggle(key)}
|
|
460
|
-
ariaLabel={isExpanded ? '
|
|
460
|
+
ariaLabel={isExpanded ? t('@astryx.tableRowExpansion.collapseRow') : t('@astryx.tableRowExpansion.expandRow')}
|
|
461
461
|
/>
|
|
462
462
|
) : (
|
|
463
463
|
<span {...stylex.props(expansionStyles.placeholder)} />
|
|
@@ -499,7 +499,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
499
499
|
{...stylex.props(expansionStyles.chevronButton)}
|
|
500
500
|
onClick={() => onToggleExpandAll(!allExpanded)}
|
|
501
501
|
aria-label={
|
|
502
|
-
allExpanded ? '
|
|
502
|
+
allExpanded ? t('@astryx.tableRowExpansion.collapseAllRows') : t('@astryx.tableRowExpansion.expandAllRows')
|
|
503
503
|
}>
|
|
504
504
|
<span
|
|
505
505
|
{...stylex.props(
|
|
@@ -570,7 +570,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
570
570
|
...props.htmlProps,
|
|
571
571
|
onClick: () => onToggle(key),
|
|
572
572
|
},
|
|
573
|
-
|
|
573
|
+
xstyle: [...props.xstyle, expansionStyles.clickableRow],
|
|
574
574
|
};
|
|
575
575
|
},
|
|
576
576
|
}),
|
|
@@ -585,6 +585,7 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(
|
|
|
585
585
|
isAllExpanded,
|
|
586
586
|
onToggleExpandAll,
|
|
587
587
|
expansionColumn,
|
|
588
|
+
t,
|
|
588
589
|
],
|
|
589
590
|
);
|
|
590
591
|
}
|
|
@@ -62,7 +62,7 @@ const styles = stylex.create({
|
|
|
62
62
|
* so it reflects the current sort / filter / pagination view.
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
|
-
* ```
|
|
65
|
+
* ```
|
|
66
66
|
* const rowIndex = useTableRowIndex({data});
|
|
67
67
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowIndex}} />;
|
|
68
68
|
* ```
|
|
@@ -45,12 +45,9 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
45
45
|
import {colorVars} from '../../../theme/tokens.stylex';
|
|
46
46
|
import {CheckboxInput} from '../../../CheckboxInput';
|
|
47
47
|
import {mergeRefs} from '../../../utils';
|
|
48
|
-
import type {
|
|
49
|
-
TablePlugin,
|
|
50
|
-
TableColumn,
|
|
51
|
-
BodyRowRenderProps,
|
|
52
|
-
} from '../../types';
|
|
48
|
+
import type {TablePlugin, TableColumn, BodyRowRenderProps} from '../../types';
|
|
53
49
|
import {pixel} from '../../columnUtils';
|
|
50
|
+
import {useTranslator} from '../../../i18n';
|
|
54
51
|
|
|
55
52
|
// =============================================================================
|
|
56
53
|
// Config Type
|
|
@@ -181,6 +178,7 @@ function SelectAllCheckboxInner<T extends Record<string, unknown>>({
|
|
|
181
178
|
}: {
|
|
182
179
|
store: SelectionStore<T>;
|
|
183
180
|
}) {
|
|
181
|
+
const t = useTranslator();
|
|
184
182
|
const getSnapshot = useCallback(() => {
|
|
185
183
|
const config = store.getConfig();
|
|
186
184
|
const allSelected = config.getIsAllSelected();
|
|
@@ -197,7 +195,7 @@ function SelectAllCheckboxInner<T extends Record<string, unknown>>({
|
|
|
197
195
|
|
|
198
196
|
return (
|
|
199
197
|
<CheckboxInput
|
|
200
|
-
label=
|
|
198
|
+
label={t('@astryx.table.selection.selectAllRows')}
|
|
201
199
|
isLabelHidden
|
|
202
200
|
value={allSelected ? true : indeterminate ? 'indeterminate' : false}
|
|
203
201
|
onChange={() =>
|
|
@@ -232,6 +230,7 @@ function SelectionCellContentInner<T extends Record<string, unknown>>({
|
|
|
232
230
|
store: SelectionStore<T>;
|
|
233
231
|
item: T;
|
|
234
232
|
}) {
|
|
233
|
+
const t = useTranslator();
|
|
235
234
|
const config = store.getConfig();
|
|
236
235
|
const isSelected = useIsItemSelected(store, item);
|
|
237
236
|
const selectable = config.getIsItemSelectable?.(item) ?? true;
|
|
@@ -243,7 +242,7 @@ function SelectionCellContentInner<T extends Record<string, unknown>>({
|
|
|
243
242
|
|
|
244
243
|
return (
|
|
245
244
|
<CheckboxInput
|
|
246
|
-
label=
|
|
245
|
+
label={t('@astryx.table.selection.selectRow')}
|
|
247
246
|
isLabelHidden
|
|
248
247
|
value={isSelected}
|
|
249
248
|
onChange={() =>
|
|
@@ -18,6 +18,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
18
18
|
import {colorVars, spacingVars, radiusVars} from '../../../theme/tokens.stylex';
|
|
19
19
|
import {Icon} from '../../../Icon';
|
|
20
20
|
import {resolveContextActions} from '../../tableContextMenu';
|
|
21
|
+
import {useTranslator} from '../../../i18n';
|
|
21
22
|
import type {
|
|
22
23
|
TablePlugin,
|
|
23
24
|
HeaderCellRenderProps,
|
|
@@ -344,6 +345,7 @@ export function useTableSortable<
|
|
|
344
345
|
T extends Record<string, unknown>,
|
|
345
346
|
TSortKey extends string = string,
|
|
346
347
|
>(config: UseTableSortableConfig<TSortKey>): TablePlugin<T> {
|
|
348
|
+
const t = useTranslator();
|
|
347
349
|
const configRef = useRef(config);
|
|
348
350
|
configRef.current = config;
|
|
349
351
|
|
|
@@ -367,12 +369,13 @@ export function useTableSortable<
|
|
|
367
369
|
// checked/clear state always reflects the latest sort.
|
|
368
370
|
const getSortActions = (): TableContextAction[] => {
|
|
369
371
|
const c = configRef.current;
|
|
370
|
-
const dir =
|
|
372
|
+
const dir =
|
|
373
|
+
c.sort.find(e => e.sortKey === sortKey)?.direction ?? null;
|
|
371
374
|
const actions: TableContextAction[] = [
|
|
372
375
|
{
|
|
373
376
|
id: 'sort-asc',
|
|
374
377
|
group: 'sort',
|
|
375
|
-
label: '
|
|
378
|
+
label: t('@astryx.table.sort.ascending'),
|
|
376
379
|
icon: <Icon icon="arrowUp" size="xsm" aria-hidden />,
|
|
377
380
|
checked: dir === 'ascending',
|
|
378
381
|
onSelect: () =>
|
|
@@ -383,7 +386,7 @@ export function useTableSortable<
|
|
|
383
386
|
{
|
|
384
387
|
id: 'sort-desc',
|
|
385
388
|
group: 'sort',
|
|
386
|
-
label: '
|
|
389
|
+
label: t('@astryx.table.sort.descending'),
|
|
387
390
|
icon: <Icon icon="arrowDown" size="xsm" aria-hidden />,
|
|
388
391
|
checked: dir === 'descending',
|
|
389
392
|
onSelect: () =>
|
|
@@ -396,7 +399,7 @@ export function useTableSortable<
|
|
|
396
399
|
actions.push({
|
|
397
400
|
id: 'sort-clear',
|
|
398
401
|
group: 'sort-clear',
|
|
399
|
-
label: '
|
|
402
|
+
label: t('@astryx.table.sort.clear'),
|
|
400
403
|
icon: <Icon icon="close" size="xsm" aria-hidden />,
|
|
401
404
|
onSelect: () =>
|
|
402
405
|
c.onSortChange(c.sort.filter(e => e.sortKey !== sortKey)),
|
|
@@ -430,6 +433,6 @@ export function useTableSortable<
|
|
|
430
433
|
};
|
|
431
434
|
},
|
|
432
435
|
}),
|
|
433
|
-
[],
|
|
436
|
+
[t],
|
|
434
437
|
);
|
|
435
438
|
}
|
|
@@ -337,8 +337,8 @@ export function useTableStickyColumns<T extends Record<string, unknown>>(
|
|
|
337
337
|
...props.htmlProps,
|
|
338
338
|
style: {...props.htmlProps.style, ...offsetStyle},
|
|
339
339
|
},
|
|
340
|
-
|
|
341
|
-
...props.
|
|
340
|
+
xstyle: [
|
|
341
|
+
...props.xstyle,
|
|
342
342
|
stickyStyles.cell,
|
|
343
343
|
stickyStyles.headerCell,
|
|
344
344
|
side.edge === 'start' ? shadowStyles.start : shadowStyles.end,
|
|
@@ -365,8 +365,8 @@ export function useTableStickyColumns<T extends Record<string, unknown>>(
|
|
|
365
365
|
...props.htmlProps,
|
|
366
366
|
style: {...props.htmlProps.style, ...offsetStyle},
|
|
367
367
|
},
|
|
368
|
-
|
|
369
|
-
...props.
|
|
368
|
+
xstyle: [
|
|
369
|
+
...props.xstyle,
|
|
370
370
|
stickyStyles.cell,
|
|
371
371
|
stickyStyles.bodyCell,
|
|
372
372
|
side.edge === 'start' ? shadowStyles.start : shadowStyles.end,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
export {useTableTreeData} from './useTableTreeData';
|
|
4
|
+
export type {
|
|
5
|
+
TableTreeRowMeta,
|
|
6
|
+
UseTableTreeDataConfig,
|
|
7
|
+
} from './useTableTreeData';
|
|
8
|
+
export {useTableTreeState} from './useTableTreeState';
|
|
9
|
+
export type {
|
|
10
|
+
UseTableTreeStateConfig,
|
|
11
|
+
UseTableTreeStateResult,
|
|
12
|
+
} from './useTableTreeState';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file useTableTreeData-perf.test.tsx
|
|
5
|
+
* @input Table, useTableTreeData, useTableTreeState, React testing utilities
|
|
6
|
+
* @output Performance tests for tree plugin render behavior
|
|
7
|
+
* @position Test file; validates toggle render efficiency and DOM cost
|
|
8
|
+
*
|
|
9
|
+
* The tree plugin uses an external store so a toggle re-renders only the
|
|
10
|
+
* affected cells — not the whole table body. Note: expanding inserts rows,
|
|
11
|
+
* which shifts the rowIndex of every row *after* the insertion point (the
|
|
12
|
+
* row memo comparator includes rowIndex by design), so the guarantee is
|
|
13
|
+
* scoped to rows before the toggled row.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {describe, it, expect} from 'vitest';
|
|
17
|
+
import {render, screen, act} from '@testing-library/react';
|
|
18
|
+
import {useMemo} from 'react';
|
|
19
|
+
import userEvent from '@testing-library/user-event';
|
|
20
|
+
import {Table} from '../../Table';
|
|
21
|
+
import type {TableColumn} from '../../types';
|
|
22
|
+
import {useTableTreeData} from './useTableTreeData';
|
|
23
|
+
import {useTableTreeState} from './useTableTreeState';
|
|
24
|
+
|
|
25
|
+
interface TreeRow extends Record<string, unknown> {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
children?: TreeRow[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 5 roots; the last root has 2 children. */
|
|
32
|
+
const roots: TreeRow[] = [
|
|
33
|
+
...Array.from({length: 4}, (_, i) => ({
|
|
34
|
+
id: `root-${i}`,
|
|
35
|
+
name: `Root ${i}`,
|
|
36
|
+
})),
|
|
37
|
+
{
|
|
38
|
+
id: 'root-4',
|
|
39
|
+
name: 'Root 4',
|
|
40
|
+
children: [
|
|
41
|
+
{id: 'child-0', name: 'Child 0'},
|
|
42
|
+
{id: 'child-1', name: 'Child 1'},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function TreeRenderCountTable({
|
|
48
|
+
renderCounts,
|
|
49
|
+
}: {
|
|
50
|
+
renderCounts: Record<string, number>;
|
|
51
|
+
}) {
|
|
52
|
+
const columns = useMemo<TableColumn<TreeRow>[]>(
|
|
53
|
+
() => [
|
|
54
|
+
{
|
|
55
|
+
key: 'name',
|
|
56
|
+
header: 'Name',
|
|
57
|
+
renderCell: (item: TreeRow) => {
|
|
58
|
+
renderCounts[item.id] = (renderCounts[item.id] ?? 0) + 1;
|
|
59
|
+
return item.name;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
[renderCounts],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const {visibleData, treeConfig} = useTableTreeState<TreeRow>({
|
|
67
|
+
data: roots,
|
|
68
|
+
idKey: 'id',
|
|
69
|
+
});
|
|
70
|
+
const tree = useTableTreeData(treeConfig);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Table data={visibleData} columns={columns} idKey="id" plugins={{tree}} />
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
describe('Tree plugin render performance', () => {
|
|
78
|
+
it('expanding the last root does not re-render preceding rows', async () => {
|
|
79
|
+
const user = userEvent.setup();
|
|
80
|
+
const renderCounts: Record<string, number> = {};
|
|
81
|
+
|
|
82
|
+
render(<TreeRenderCountTable renderCounts={renderCounts} />);
|
|
83
|
+
|
|
84
|
+
const initialCounts = {...renderCounts};
|
|
85
|
+
expect(Object.keys(initialCounts)).toHaveLength(5);
|
|
86
|
+
|
|
87
|
+
await act(async () => {
|
|
88
|
+
await user.click(screen.getByRole('button', {name: 'Expand row'}));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
for (let i = 0; i < 4; i++) {
|
|
92
|
+
expect(renderCounts[`root-${i}`]).toBe(initialCounts[`root-${i}`]);
|
|
93
|
+
}
|
|
94
|
+
// The children mounted exactly once.
|
|
95
|
+
expect(renderCounts['child-0']).toBe(1);
|
|
96
|
+
expect(renderCounts['child-1']).toBe(1);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('collapsing unmounts the subtree rows entirely', async () => {
|
|
100
|
+
const user = userEvent.setup();
|
|
101
|
+
const renderCounts: Record<string, number> = {};
|
|
102
|
+
|
|
103
|
+
render(<TreeRenderCountTable renderCounts={renderCounts} />);
|
|
104
|
+
|
|
105
|
+
await act(async () => {
|
|
106
|
+
await user.click(screen.getByRole('button', {name: 'Expand row'}));
|
|
107
|
+
});
|
|
108
|
+
expect(screen.getAllByRole('row')).toHaveLength(8); // header + 5 roots + 2 children
|
|
109
|
+
|
|
110
|
+
await act(async () => {
|
|
111
|
+
await user.click(screen.getByRole('button', {name: 'Collapse row'}));
|
|
112
|
+
});
|
|
113
|
+
expect(screen.getAllByRole('row')).toHaveLength(6); // header + 5 roots
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('adds at most one wrapper, one expander/spacer to the tree column and zero DOM to other columns', () => {
|
|
117
|
+
const {container} = render(
|
|
118
|
+
<Table
|
|
119
|
+
data={
|
|
120
|
+
[{id: 'a', name: 'a', children: [{id: 'b', name: 'b'}]}] as TreeRow[]
|
|
121
|
+
}
|
|
122
|
+
columns={[
|
|
123
|
+
{key: 'name', header: 'Name'},
|
|
124
|
+
{key: 'id', header: 'Id'},
|
|
125
|
+
]}
|
|
126
|
+
idKey="id"
|
|
127
|
+
plugins={{}}
|
|
128
|
+
/>,
|
|
129
|
+
);
|
|
130
|
+
const plainSecondCellHTML =
|
|
131
|
+
container.querySelectorAll('tbody td')[1].innerHTML;
|
|
132
|
+
|
|
133
|
+
function DomBudgetTable() {
|
|
134
|
+
const {visibleData, treeConfig} = useTableTreeState<TreeRow>({
|
|
135
|
+
data: [{id: 'a', name: 'a', children: [{id: 'b', name: 'b'}]}],
|
|
136
|
+
idKey: 'id',
|
|
137
|
+
});
|
|
138
|
+
const tree = useTableTreeData(treeConfig);
|
|
139
|
+
return (
|
|
140
|
+
<Table
|
|
141
|
+
data={visibleData}
|
|
142
|
+
columns={[
|
|
143
|
+
{key: 'name', header: 'Name'},
|
|
144
|
+
{key: 'id', header: 'Id'},
|
|
145
|
+
]}
|
|
146
|
+
idKey="id"
|
|
147
|
+
plugins={{tree}}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
const {container: treeContainer} = render(<DomBudgetTable />);
|
|
152
|
+
const cells = treeContainer.querySelectorAll('tbody td');
|
|
153
|
+
|
|
154
|
+
// Tree column: one flex wrapper containing one expander button + text.
|
|
155
|
+
const wrapper = cells[0].firstElementChild as HTMLElement;
|
|
156
|
+
expect(wrapper.tagName).toBe('DIV');
|
|
157
|
+
expect(wrapper.children).toHaveLength(1);
|
|
158
|
+
expect(wrapper.querySelector('button')).not.toBeNull();
|
|
159
|
+
|
|
160
|
+
// Other columns: byte-identical to the plugin-free render.
|
|
161
|
+
expect(cells[1].innerHTML).toBe(plainSecondCellHTML);
|
|
162
|
+
});
|
|
163
|
+
});
|