@astryxdesign/core 0.1.6 → 0.1.7-canary.0a6de96
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 +2 -0
- 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.map +1 -1
- package/dist/Collapsible/Collapsible.js +8 -1
- 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/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +4 -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/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/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- 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/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 +35 -3
- 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/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 +746 -0
- package/locales/pseudo.json +560 -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.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 +1 -0
- package/src/Collapsible/Collapsible.test.tsx +6 -0
- package/src/Collapsible/Collapsible.tsx +19 -4
- 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 +6 -0
- 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 +2 -2
- 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.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/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- 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 +2 -2
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/TabList.tsx +4 -1
- package/src/Table/BaseTable.tsx +36 -19
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- 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/types.ts +18 -12
- 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/Text/Text.doc.mjs +2 -2
- 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/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/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
|
@@ -54,6 +54,7 @@ import {getIcon} from '../Icon/globalIconRegistry';
|
|
|
54
54
|
import {useSideNavRenderMode} from './SideNavRenderContext';
|
|
55
55
|
import {useAppShellMobile} from '../AppShell/AppShellMobileContext';
|
|
56
56
|
import {themeProps} from '../utils/themeProps';
|
|
57
|
+
import {useTranslator} from '../i18n';
|
|
57
58
|
|
|
58
59
|
// =============================================================================
|
|
59
60
|
// Styles
|
|
@@ -356,6 +357,7 @@ export function SideNavItem({
|
|
|
356
357
|
'data-testid': testId,
|
|
357
358
|
ref,
|
|
358
359
|
}: SideNavItemProps) {
|
|
360
|
+
const t = useTranslator();
|
|
359
361
|
const {isCollapsed} = useSideNavCollapse();
|
|
360
362
|
const renderMode = useSideNavRenderMode();
|
|
361
363
|
const {closeMobileNav} = useAppShellMobile();
|
|
@@ -626,7 +628,7 @@ export function SideNavItem({
|
|
|
626
628
|
<button
|
|
627
629
|
type="button"
|
|
628
630
|
onClick={handleToggleClick}
|
|
629
|
-
aria-label={isItemCollapsed ?
|
|
631
|
+
aria-label={isItemCollapsed ? t('@astryx.sideNavItem.expand', {label}) : t('@astryx.sideNavItem.collapse', {label})}
|
|
630
632
|
aria-expanded={!isItemCollapsed}
|
|
631
633
|
aria-controls={`${id}-children`}
|
|
632
634
|
{...stylex.props(styles.expandToggle)}>
|
|
@@ -132,7 +132,7 @@ export const docs = {
|
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
name: 'status',
|
|
135
|
-
type: '
|
|
135
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
136
136
|
description:
|
|
137
137
|
'Status indicator object (`{ type, message }`) for validation feedback.',
|
|
138
138
|
},
|
|
@@ -286,7 +286,7 @@ export const docsZh = {
|
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
name: 'status',
|
|
289
|
-
type: '
|
|
289
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
290
290
|
description:
|
|
291
291
|
'验证反馈的状态指示器对象(`{ type, message }`)。',
|
|
292
292
|
},
|
package/src/Stack/Stack.doc.mjs
CHANGED
|
@@ -24,25 +24,25 @@ export const docs = {
|
|
|
24
24
|
props: [
|
|
25
25
|
{
|
|
26
26
|
name: 'gap',
|
|
27
|
-
type: '
|
|
27
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
28
28
|
description:
|
|
29
29
|
'Spacing step (number literal): 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10. Pass as a JSX number expression e.g. gap={4}, NOT a string like gap="4".',
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: 'padding',
|
|
33
|
-
type: '
|
|
33
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
34
34
|
description:
|
|
35
35
|
'Inner padding on all sides, using the spacing scale (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10). Matches the padding prop on Card, LayoutContent, and LayoutPanel. Pass as a JSX number expression e.g. padding={3}.',
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'paddingInline',
|
|
39
|
-
type: '
|
|
39
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
40
40
|
description:
|
|
41
41
|
'Inline (horizontal) padding, using the spacing scale. Overrides padding on the inline axis when both are set.',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
name: 'paddingBlock',
|
|
45
|
-
type: '
|
|
45
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
46
46
|
description:
|
|
47
47
|
'Block (vertical) padding, using the spacing scale. Overrides padding on the block axis when both are set.',
|
|
48
48
|
},
|
|
@@ -127,25 +127,25 @@ export const docs = {
|
|
|
127
127
|
props: [
|
|
128
128
|
{
|
|
129
129
|
name: 'gap',
|
|
130
|
-
type: '
|
|
130
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
131
131
|
description:
|
|
132
132
|
'Spacing step (number literal): 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10. Pass as a JSX number expression e.g. gap={4}, NOT a string like gap="4".',
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
name: 'padding',
|
|
136
|
-
type: '
|
|
136
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
137
137
|
description:
|
|
138
138
|
'Inner padding on all sides, using the spacing scale (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10). Matches the padding prop on Card, LayoutContent, and LayoutPanel. Pass as a JSX number expression e.g. padding={3}.',
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
name: 'paddingInline',
|
|
142
|
-
type: '
|
|
142
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
143
143
|
description:
|
|
144
144
|
'Inline (horizontal) padding, using the spacing scale. Overrides padding on the inline axis when both are set.',
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
name: 'paddingBlock',
|
|
148
|
-
type: '
|
|
148
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
149
149
|
description:
|
|
150
150
|
'Block (vertical) padding, using the spacing scale. Overrides padding on the block axis when both are set.',
|
|
151
151
|
},
|
|
@@ -289,7 +289,7 @@ export const docsZh = {
|
|
|
289
289
|
props: [
|
|
290
290
|
{
|
|
291
291
|
name: 'gap',
|
|
292
|
-
type: '
|
|
292
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
293
293
|
description:
|
|
294
294
|
'间距步进(数字字面量):0、0.5、1、1.5、2、3、4、5、6、8、10。在 JSX 中使用数字表达式 e.g. gap={4},不要使用字符串 gap="4"。',
|
|
295
295
|
},
|
|
@@ -358,7 +358,7 @@ export const docsZh = {
|
|
|
358
358
|
props: [
|
|
359
359
|
{
|
|
360
360
|
name: 'gap',
|
|
361
|
-
type: '
|
|
361
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
362
362
|
description:
|
|
363
363
|
'间距步进(数字字面量):0、0.5、1、1.5、2、3、4、5、6、8、10。在 JSX 中使用数字表达式 e.g. gap={4},不要使用字符串 gap="4"。',
|
|
364
364
|
},
|
|
@@ -90,7 +90,7 @@ export const docs = {
|
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
name: 'status',
|
|
93
|
-
type: '
|
|
93
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
94
94
|
description:
|
|
95
95
|
'Status indicator with type and message. Displays a colored message box below the switch and sets aria-invalid when type is "error".',
|
|
96
96
|
},
|
|
@@ -236,7 +236,7 @@ export const docsZh = {
|
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
238
|
name: 'status',
|
|
239
|
-
type: '
|
|
239
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
240
240
|
description:
|
|
241
241
|
'带类型和消息的状态指示器。在开关下方显示彩色消息框,当类型为 "error" 时设置 aria-invalid。',
|
|
242
242
|
},
|
|
@@ -197,6 +197,22 @@ describe('Switch', () => {
|
|
|
197
197
|
expect(screen.getByLabelText('Toggle row')).toBeInTheDocument();
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
+
it('keeps description linked via aria-describedby when isLabelHidden', () => {
|
|
201
|
+
render(
|
|
202
|
+
<Switch
|
|
203
|
+
label="Toggle row"
|
|
204
|
+
isLabelHidden
|
|
205
|
+
description="Enables sync for this row"
|
|
206
|
+
value={false}
|
|
207
|
+
onChange={() => {}}
|
|
208
|
+
/>,
|
|
209
|
+
);
|
|
210
|
+
const switchEl = screen.getByRole('switch');
|
|
211
|
+
const description = screen.getByText('Enables sync for this row');
|
|
212
|
+
expect(description.id).not.toBe('');
|
|
213
|
+
expect(switchEl.getAttribute('aria-describedby')).toContain(description.id);
|
|
214
|
+
});
|
|
215
|
+
|
|
200
216
|
it('shows label visually by default', () => {
|
|
201
217
|
render(
|
|
202
218
|
<Switch label="Enable notifications" value={false} onChange={() => {}} />,
|
package/src/Switch/Switch.tsx
CHANGED
|
@@ -393,9 +393,11 @@ export function Switch({
|
|
|
393
393
|
});
|
|
394
394
|
|
|
395
395
|
// Build aria-describedby from description and status message
|
|
396
|
-
// Only include descriptionID when the element actually renders
|
|
396
|
+
// Only include descriptionID when the element actually renders.
|
|
397
|
+
// FieldLabel renders the description (with descriptionID) even when the
|
|
398
|
+
// label is visually hidden — it's sr-only, so keep it linked.
|
|
397
399
|
const describedByParts: string[] = [];
|
|
398
|
-
if (description
|
|
400
|
+
if (description) {
|
|
399
401
|
describedByParts.push(descriptionID);
|
|
400
402
|
}
|
|
401
403
|
if (status?.message) {
|
package/src/TabList/TabList.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import {useListFocus} from '../hooks/useListFocus';
|
|
|
29
29
|
import {useKeyboardHint} from '../hooks/useKeyboardHint';
|
|
30
30
|
import {EDGE_COMP_ATTR} from '../Layout/edgeCompensation.stylex';
|
|
31
31
|
import {themeProps} from '../utils/themeProps';
|
|
32
|
+
import {useTranslator} from '../i18n';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Selector matching the focusable stops in the tab strip: every Tab
|
|
@@ -129,11 +130,13 @@ export function TabList({
|
|
|
129
130
|
onKeyDown: onKeyDownProp,
|
|
130
131
|
onFocus: onFocusProp,
|
|
131
132
|
onBlur: onBlurProp,
|
|
132
|
-
'aria-label':
|
|
133
|
+
'aria-label': ariaLabelFromProps,
|
|
133
134
|
'aria-orientation': _ariaOrientation,
|
|
134
135
|
[EDGE_COMP_ATTR]: _edgeCompAttr,
|
|
135
136
|
...restProps
|
|
136
137
|
}: TabListProps) {
|
|
138
|
+
const t = useTranslator();
|
|
139
|
+
const ariaLabel = ariaLabelFromProps ?? t('@astryx.tabList.label');
|
|
137
140
|
const size = useSize(sizeProp, 'md');
|
|
138
141
|
|
|
139
142
|
// Roving-tabindex keyboard navigation across the tab strip via the shared
|
package/src/Table/BaseTable.tsx
CHANGED
|
@@ -45,6 +45,7 @@ import {mergeProps} from '../utils';
|
|
|
45
45
|
import {EmptyState} from '../EmptyState';
|
|
46
46
|
import {Text} from '../Text';
|
|
47
47
|
import {themeProps} from '../utils/themeProps';
|
|
48
|
+
import {useTranslator} from '../i18n';
|
|
48
49
|
|
|
49
50
|
const styles = stylex.create({
|
|
50
51
|
table: {
|
|
@@ -162,7 +163,7 @@ function TableRowInner<T extends Record<string, unknown>>({
|
|
|
162
163
|
|
|
163
164
|
const initialBodyCellRenderProps: BodyCellRenderProps = {
|
|
164
165
|
htmlProps: initialCellHtmlProps,
|
|
165
|
-
|
|
166
|
+
xstyle: [],
|
|
166
167
|
columnIndex,
|
|
167
168
|
columns: columns as ReadonlyArray<TableColumn<Record<string, unknown>>>,
|
|
168
169
|
};
|
|
@@ -206,7 +207,7 @@ function TableRowInner<T extends Record<string, unknown>>({
|
|
|
206
207
|
key={col.key}
|
|
207
208
|
{...cellRenderProps.htmlProps}
|
|
208
209
|
contextMenuActions={cellRenderProps.contextMenuActions}
|
|
209
|
-
xstyle={cellRenderProps.
|
|
210
|
+
xstyle={cellRenderProps.xstyle}>
|
|
210
211
|
{content}
|
|
211
212
|
</CellComponent>
|
|
212
213
|
);
|
|
@@ -218,7 +219,7 @@ function TableRowInner<T extends Record<string, unknown>>({
|
|
|
218
219
|
p => p.transformBodyRow,
|
|
219
220
|
{
|
|
220
221
|
htmlProps: {},
|
|
221
|
-
|
|
222
|
+
xstyle: [],
|
|
222
223
|
children: <>{cells}</>,
|
|
223
224
|
} satisfies BodyRowRenderProps,
|
|
224
225
|
item,
|
|
@@ -230,7 +231,7 @@ function TableRowInner<T extends Record<string, unknown>>({
|
|
|
230
231
|
key={rowKey}
|
|
231
232
|
ref={rowRenderProps.ref}
|
|
232
233
|
{...rowRenderProps.htmlProps}
|
|
233
|
-
xstyle={rowRenderProps.
|
|
234
|
+
xstyle={rowRenderProps.xstyle}>
|
|
234
235
|
{rowRenderProps.children}
|
|
235
236
|
</RowComponent>
|
|
236
237
|
);
|
|
@@ -324,8 +325,13 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
324
325
|
textOverflow = 'wrap',
|
|
325
326
|
scrollWrapper: ScrollWrapper,
|
|
326
327
|
emptyState,
|
|
328
|
+
xstyle,
|
|
329
|
+
className,
|
|
330
|
+
style,
|
|
327
331
|
ref,
|
|
332
|
+
...rest
|
|
328
333
|
}: BaseTableProps<T> & {ref?: Ref<HTMLTableElement>}): ReactElement {
|
|
334
|
+
const t = useTranslator();
|
|
329
335
|
// Use stable empty array when no plugins provided
|
|
330
336
|
const plugins = pluginsProp ?? (EMPTY_PLUGINS as TablePlugin<T>[]);
|
|
331
337
|
|
|
@@ -365,7 +371,7 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
365
371
|
// --- Plugin pipeline: table ---
|
|
366
372
|
const tableRenderProps = applyPlugins(plugins, p => p.transformTable, {
|
|
367
373
|
htmlProps: {...userTableProps},
|
|
368
|
-
|
|
374
|
+
xstyle: children ? [styles.table, styles.tableAutoLayout] : [styles.table],
|
|
369
375
|
} satisfies TableRenderProps);
|
|
370
376
|
|
|
371
377
|
// --- Plugin pipeline: header cells ---
|
|
@@ -386,7 +392,7 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
386
392
|
|
|
387
393
|
const initialHeaderRenderProps: HeaderCellRenderProps = {
|
|
388
394
|
htmlProps: initialHeaderHtmlProps,
|
|
389
|
-
|
|
395
|
+
xstyle: [],
|
|
390
396
|
content: headerContent,
|
|
391
397
|
columnIndex,
|
|
392
398
|
columns: resolvedColumns as ReadonlyArray<
|
|
@@ -447,7 +453,7 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
447
453
|
{...mergedHtmlProps}
|
|
448
454
|
{...headerTitleProp}
|
|
449
455
|
contextMenuActions={cellRenderProps.contextMenuActions}
|
|
450
|
-
xstyle={cellRenderProps.
|
|
456
|
+
xstyle={cellRenderProps.xstyle}>
|
|
451
457
|
{headerInner}
|
|
452
458
|
</HeaderCellComponent>
|
|
453
459
|
);
|
|
@@ -459,7 +465,7 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
459
465
|
p => p.transformHeaderRow,
|
|
460
466
|
{
|
|
461
467
|
htmlProps: {},
|
|
462
|
-
|
|
468
|
+
xstyle: [],
|
|
463
469
|
children: <>{headerCells}</>,
|
|
464
470
|
} satisfies HeaderRowRenderProps,
|
|
465
471
|
);
|
|
@@ -468,12 +474,15 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
468
474
|
const hasData = data != null && data.length > 0;
|
|
469
475
|
const hasColumns = resolvedColumns.length > 0;
|
|
470
476
|
|
|
477
|
+
// Style precedence: deprecated tableProps.style < consumer style < the
|
|
478
|
+
// computed column min-width (structural — derived from column defs, so it
|
|
479
|
+
// must win when present; when absent, a consumer minWidth survives).
|
|
471
480
|
const tableStyle: React.CSSProperties = {
|
|
472
481
|
...tableRenderProps.htmlProps.style,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
482
|
+
...style,
|
|
483
|
+
...(resolvedWidths.tableMinWidth > 0
|
|
484
|
+
? {minWidth: `${resolvedWidths.tableMinWidth}px`}
|
|
485
|
+
: null),
|
|
477
486
|
};
|
|
478
487
|
|
|
479
488
|
let tableElement: ReactNode = (
|
|
@@ -482,10 +491,13 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
482
491
|
{...tableRenderProps.htmlProps}
|
|
483
492
|
{...mergeProps(
|
|
484
493
|
themeProps('base-table'),
|
|
485
|
-
stylex.props(...tableRenderProps.
|
|
486
|
-
tableRenderProps.htmlProps.className,
|
|
494
|
+
stylex.props(...tableRenderProps.xstyle, xstyle),
|
|
495
|
+
[tableRenderProps.htmlProps.className, className]
|
|
496
|
+
.filter(Boolean)
|
|
497
|
+
.join(' ') || undefined,
|
|
498
|
+
tableStyle,
|
|
487
499
|
)}
|
|
488
|
-
|
|
500
|
+
{...rest}>
|
|
489
501
|
{children ? (
|
|
490
502
|
children
|
|
491
503
|
) : (
|
|
@@ -495,7 +507,7 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
495
507
|
<RowComponent
|
|
496
508
|
{...headerRowRenderProps.htmlProps}
|
|
497
509
|
isHeaderRow
|
|
498
|
-
xstyle={headerRowRenderProps.
|
|
510
|
+
xstyle={headerRowRenderProps.xstyle}>
|
|
499
511
|
{headerRowRenderProps.children}
|
|
500
512
|
</RowComponent>
|
|
501
513
|
</TableHeader>
|
|
@@ -527,7 +539,12 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
527
539
|
emptyState !== false && (
|
|
528
540
|
<tr>
|
|
529
541
|
<td colSpan={resolvedColumns.length}>
|
|
530
|
-
{emptyState ??
|
|
542
|
+
{emptyState ?? (
|
|
543
|
+
<EmptyState
|
|
544
|
+
title={t('@astryx.table.noData')}
|
|
545
|
+
isCompact
|
|
546
|
+
/>
|
|
547
|
+
)}
|
|
531
548
|
</td>
|
|
532
549
|
</tr>
|
|
533
550
|
)}
|
|
@@ -551,14 +568,14 @@ function BaseTableInner<T extends Record<string, unknown>>({
|
|
|
551
568
|
p => p.transformScrollWrapper,
|
|
552
569
|
{
|
|
553
570
|
htmlProps: {},
|
|
554
|
-
|
|
571
|
+
xstyle: [],
|
|
555
572
|
} satisfies ScrollWrapperRenderProps,
|
|
556
573
|
);
|
|
557
574
|
|
|
558
575
|
tableElement = (
|
|
559
576
|
<ScrollWrapper
|
|
560
577
|
htmlProps={scrollWrapperRenderProps.htmlProps}
|
|
561
|
-
|
|
578
|
+
xstyle={scrollWrapperRenderProps.xstyle}
|
|
562
579
|
beforeTable={scrollWrapperRenderProps.beforeTable}
|
|
563
580
|
afterTable={scrollWrapperRenderProps.afterTable}>
|
|
564
581
|
{tableElement}
|
package/src/Table/Table.test.tsx
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import {describe, it, expect, vi} from 'vitest';
|
|
13
13
|
import {render, screen} from '@testing-library/react';
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
14
15
|
import {BaseTable} from './BaseTable';
|
|
15
16
|
import {Table} from './Table';
|
|
16
17
|
import {TableRow} from './TableRow';
|
|
@@ -414,6 +415,136 @@ describe('BaseTable', () => {
|
|
|
414
415
|
);
|
|
415
416
|
});
|
|
416
417
|
|
|
418
|
+
describe('root element styling props (#3679)', () => {
|
|
419
|
+
it('applies className to the table element', () => {
|
|
420
|
+
render(<Table data={users} columns={columns} className="custom-table" />);
|
|
421
|
+
expect(screen.getByRole('table').className).toContain('custom-table');
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it('applies style to the table element', () => {
|
|
425
|
+
render(<Table data={users} columns={columns} style={{opacity: 0.9}} />);
|
|
426
|
+
expect(screen.getByRole('table').style.opacity).toBe('0.9');
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('accepts xstyle without error', () => {
|
|
430
|
+
render(<Table data={users} columns={columns} xstyle={undefined} />);
|
|
431
|
+
expect(screen.getByRole('table')).toBeInTheDocument();
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it('spreads id and aria attributes onto the table element', () => {
|
|
435
|
+
render(
|
|
436
|
+
<Table
|
|
437
|
+
data={users}
|
|
438
|
+
columns={columns}
|
|
439
|
+
id="users-table"
|
|
440
|
+
aria-label="Users"
|
|
441
|
+
data-analytics="tables"
|
|
442
|
+
/>,
|
|
443
|
+
);
|
|
444
|
+
const table = screen.getByRole('table', {name: 'Users'});
|
|
445
|
+
expect(table.id).toBe('users-table');
|
|
446
|
+
expect(table).toHaveAttribute('data-analytics', 'tables');
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it('composes with deprecated tableProps, direct props winning conflicts', () => {
|
|
450
|
+
render(
|
|
451
|
+
<Table
|
|
452
|
+
data={users}
|
|
453
|
+
columns={columns}
|
|
454
|
+
className="direct"
|
|
455
|
+
style={{opacity: 1}}
|
|
456
|
+
tableProps={{
|
|
457
|
+
className: 'legacy',
|
|
458
|
+
style: {color: 'red', opacity: 0.5},
|
|
459
|
+
}}
|
|
460
|
+
/>,
|
|
461
|
+
);
|
|
462
|
+
const table = screen.getByRole('table');
|
|
463
|
+
expect(table.className).toContain('legacy');
|
|
464
|
+
expect(table.className).toContain('direct');
|
|
465
|
+
// Direct style wins the conflicting key; non-conflicting legacy survives.
|
|
466
|
+
expect(table.style.opacity).toBe('1');
|
|
467
|
+
expect(table.style.color).toBe('red');
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it('keeps the computed column min-width over a consumer style.minWidth', () => {
|
|
471
|
+
const {tableMinWidth} = resolveColumnWidths(columns);
|
|
472
|
+
render(
|
|
473
|
+
<Table data={users} columns={columns} style={{minWidth: '10px'}} />,
|
|
474
|
+
);
|
|
475
|
+
expect(screen.getByRole('table').style.minWidth).toBe(
|
|
476
|
+
`${tableMinWidth}px`,
|
|
477
|
+
);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it('lets a consumer style.minWidth survive when columns compute none', () => {
|
|
481
|
+
const plain: TableColumn<User>[] = [{key: 'name'}, {key: 'age'}];
|
|
482
|
+
render(<Table data={users} columns={plain} style={{minWidth: '10px'}} />);
|
|
483
|
+
expect(screen.getByRole('table').style.minWidth).toBe('10px');
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
it('direct id and aria attributes beat the same keys in tableProps', () => {
|
|
487
|
+
render(
|
|
488
|
+
<Table
|
|
489
|
+
data={users}
|
|
490
|
+
columns={columns}
|
|
491
|
+
id="direct-id"
|
|
492
|
+
aria-label="Direct"
|
|
493
|
+
tableProps={{id: 'legacy-id', 'aria-label': 'Legacy'}}
|
|
494
|
+
/>,
|
|
495
|
+
);
|
|
496
|
+
const table = screen.getByRole('table', {name: 'Direct'});
|
|
497
|
+
expect(table.id).toBe('direct-id');
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
it('keeps the astryx theme classes alongside a consumer className', () => {
|
|
501
|
+
render(<Table data={users} columns={columns} className="custom-table" />);
|
|
502
|
+
const table = screen.getByRole('table');
|
|
503
|
+
expect(table.className).toContain('astryx-base-table');
|
|
504
|
+
expect(table.className).toContain('astryx-table');
|
|
505
|
+
expect(table.className).toContain('custom-table');
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it('passes event handlers through to the table element', async () => {
|
|
509
|
+
const onClick = vi.fn();
|
|
510
|
+
render(<Table data={users} columns={columns} onClick={onClick} />);
|
|
511
|
+
screen
|
|
512
|
+
.getByRole('table')
|
|
513
|
+
.dispatchEvent(new MouseEvent('click', {bubbles: true}));
|
|
514
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
it('applies dynamic xstyle values to the table element', () => {
|
|
518
|
+
const dynamic = stylex.create({
|
|
519
|
+
opacity: (value: number) => ({opacity: value}),
|
|
520
|
+
});
|
|
521
|
+
render(
|
|
522
|
+
<Table data={users} columns={columns} xstyle={dynamic.opacity(0.42)} />,
|
|
523
|
+
);
|
|
524
|
+
expect(screen.getByRole('table').getAttribute('style')).toContain('0.42');
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('honors className in children mode', () => {
|
|
528
|
+
render(
|
|
529
|
+
<Table className="custom-table">
|
|
530
|
+
<tbody>
|
|
531
|
+
<TableRow>
|
|
532
|
+
<TableCell>Cell</TableCell>
|
|
533
|
+
</TableRow>
|
|
534
|
+
</tbody>
|
|
535
|
+
</Table>,
|
|
536
|
+
);
|
|
537
|
+
expect(screen.getByRole('table').className).toContain('custom-table');
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
it('honors className on an unwrapped BaseTable (no scrollWrapper)', () => {
|
|
541
|
+
render(
|
|
542
|
+
<BaseTable data={users} columns={columns} className="custom-table" />,
|
|
543
|
+
);
|
|
544
|
+
expect(screen.getByRole('table').className).toContain('custom-table');
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
|
|
417
548
|
describe('plugin pipeline', () => {
|
|
418
549
|
it('applies transformTable plugin', () => {
|
|
419
550
|
const plugin: TablePlugin<User> = {
|
|
@@ -826,7 +957,7 @@ describe('Table', () => {
|
|
|
826
957
|
const userPlugin: TablePlugin<User> = {
|
|
827
958
|
transformTable: props => {
|
|
828
959
|
// XDS plugin should have already added styles
|
|
829
|
-
expect(props.
|
|
960
|
+
expect(props.xstyle.length).toBeGreaterThan(1);
|
|
830
961
|
return {
|
|
831
962
|
...props,
|
|
832
963
|
htmlProps: {...props.htmlProps, 'data-testid': 'after-xds'},
|
package/src/Table/Table.tsx
CHANGED
|
@@ -31,6 +31,7 @@ import type {
|
|
|
31
31
|
TableRenderProps,
|
|
32
32
|
} from './types';
|
|
33
33
|
import type {StyleXStyles} from '../theme/types';
|
|
34
|
+
import {useTranslator} from '../i18n';
|
|
34
35
|
|
|
35
36
|
// =============================================================================
|
|
36
37
|
// Table Types
|
|
@@ -135,7 +136,7 @@ const scrollWrapperStyles = stylex.create({
|
|
|
135
136
|
function TableScrollWrapper({
|
|
136
137
|
children,
|
|
137
138
|
htmlProps,
|
|
138
|
-
|
|
139
|
+
xstyle: pluginStyles,
|
|
139
140
|
beforeTable,
|
|
140
141
|
afterTable,
|
|
141
142
|
}: {
|
|
@@ -143,10 +144,11 @@ function TableScrollWrapper({
|
|
|
143
144
|
htmlProps?: React.HTMLAttributes<HTMLDivElement> & {
|
|
144
145
|
ref?: React.Ref<HTMLDivElement>;
|
|
145
146
|
};
|
|
146
|
-
|
|
147
|
+
xstyle?: StyleXStyles[];
|
|
147
148
|
beforeTable?: React.ReactNode;
|
|
148
149
|
afterTable?: React.ReactNode;
|
|
149
150
|
}) {
|
|
151
|
+
const t = useTranslator();
|
|
150
152
|
const {ref, ...restHtmlProps} = htmlProps ?? {};
|
|
151
153
|
return (
|
|
152
154
|
<div
|
|
@@ -158,7 +160,7 @@ function TableScrollWrapper({
|
|
|
158
160
|
// htmlProps.
|
|
159
161
|
tabIndex={0}
|
|
160
162
|
role="group"
|
|
161
|
-
aria-label=
|
|
163
|
+
aria-label={t('@astryx.table.label')}
|
|
162
164
|
{...restHtmlProps}
|
|
163
165
|
{...mergeProps(
|
|
164
166
|
themeProps('table-scroll-wrapper'),
|
|
@@ -194,7 +196,7 @@ function buildTableStylePlugin<
|
|
|
194
196
|
? `${existingClass} ${tableClass}`
|
|
195
197
|
: tableClass,
|
|
196
198
|
},
|
|
197
|
-
|
|
199
|
+
xstyle: [...props.xstyle, tableStyles.base],
|
|
198
200
|
};
|
|
199
201
|
},
|
|
200
202
|
};
|