@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
package/src/docs-types.ts
CHANGED
|
@@ -616,9 +616,7 @@ export interface SubComponentDoc extends Omit<BaseDoc, 'usage'> {
|
|
|
616
616
|
* in its own file inside its parent's directory.
|
|
617
617
|
*/
|
|
618
618
|
export type ComponentDoc =
|
|
619
|
-
|
|
|
620
|
-
| MultiComponentDoc
|
|
621
|
-
| SubComponentDoc;
|
|
619
|
+
SingleComponentDoc | MultiComponentDoc | SubComponentDoc;
|
|
622
620
|
|
|
623
621
|
/**
|
|
624
622
|
* Translation overlay for component documentation.
|
|
@@ -781,16 +779,23 @@ export interface ReferenceDoc {
|
|
|
781
779
|
export interface ReferenceTranslationDoc {
|
|
782
780
|
/** Translated/compressed description. */
|
|
783
781
|
description: string;
|
|
784
|
-
/** Section overrides
|
|
782
|
+
/** Section overrides, keyed to base sections by `section`. Order does not
|
|
783
|
+
* matter, and an overlay may cover any subset — sections it does not name
|
|
784
|
+
* keep their base content. (These used to be matched by array index, which
|
|
785
|
+
* meant a reordered or partial overlay grafted every title onto the wrong
|
|
786
|
+
* body: `docs tokens --dense` printed the colour table under a "Spacing"
|
|
787
|
+
* heading. See #2182.) */
|
|
785
788
|
sections: {
|
|
786
|
-
/**
|
|
789
|
+
/** Title of the BASE section this entry overrides, verbatim and in English
|
|
790
|
+
* (e.g. 'Spacing Tokens'). Must match a section in the base doc. */
|
|
791
|
+
section: string;
|
|
792
|
+
/** Translated/compressed section title, shown in place of the base title. */
|
|
787
793
|
title: string;
|
|
788
|
-
/** Content block overrides
|
|
789
|
-
* Use null for blocks that don't
|
|
794
|
+
/** Content block overrides, by index within the anchored base section.
|
|
795
|
+
* Only prose and list blocks need entries. Use null for blocks that don't
|
|
796
|
+
* change (code, table). */
|
|
790
797
|
content: (
|
|
791
|
-
|
|
792
|
-
| {type: 'list'; items: string[]}
|
|
793
|
-
| null
|
|
798
|
+
{type: 'prose'; text: string} | {type: 'list'; items: string[]} | null
|
|
794
799
|
)[];
|
|
795
800
|
}[];
|
|
796
801
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file InternationalizationContext.ts
|
|
7
|
+
* @input React createContext, i18n types
|
|
8
|
+
* @output Exports InternationalizationContext and InternationalizationContextValue
|
|
9
|
+
* @position Context definition for client-side locale + messages
|
|
10
|
+
*
|
|
11
|
+
* Separated from InternationalizationProvider.tsx so components can consume
|
|
12
|
+
* the context without pulling in the full provider implementation.
|
|
13
|
+
* Follows the LinkContext.ts / ThemeContext.ts pattern.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
16
|
+
* - /packages/core/src/i18n/InternationalizationProvider.tsx
|
|
17
|
+
* - /packages/core/src/i18n/t.client.ts
|
|
18
|
+
* - /packages/core/src/i18n/index.ts
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import {createContext} from 'react';
|
|
22
|
+
import type {Locale, MessagesByLocale, Overrides} from './types';
|
|
23
|
+
|
|
24
|
+
export interface InternationalizationContextValue {
|
|
25
|
+
locale: Locale;
|
|
26
|
+
messages: MessagesByLocale;
|
|
27
|
+
overrides?: Overrides;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Default value falls through to the shipped en catalog in resolve().
|
|
32
|
+
* A consumer that doesn't render a provider still gets English defaults.
|
|
33
|
+
*/
|
|
34
|
+
export const InternationalizationContext =
|
|
35
|
+
createContext<InternationalizationContextValue>({
|
|
36
|
+
locale: 'en',
|
|
37
|
+
messages: {},
|
|
38
|
+
});
|
|
39
|
+
InternationalizationContext.displayName = 'InternationalizationContext';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'InternationalizationProvider',
|
|
7
|
+
displayName: 'Internationalization Provider',
|
|
8
|
+
group: 'Utilities',
|
|
9
|
+
category: 'Utility',
|
|
10
|
+
isHiddenFromOverview: true,
|
|
11
|
+
keywords: [
|
|
12
|
+
'i18n',
|
|
13
|
+
'internationalization',
|
|
14
|
+
'localization',
|
|
15
|
+
'locale',
|
|
16
|
+
'translation',
|
|
17
|
+
'translations',
|
|
18
|
+
'provider',
|
|
19
|
+
'language',
|
|
20
|
+
],
|
|
21
|
+
usage: {
|
|
22
|
+
description:
|
|
23
|
+
"Wraps your app to set the active locale and (optionally) merge additional translation catalogs + per-locale overrides. Astryx components inside the subtree resolve their strings against this context. If no provider is present, components fall back to the shipped English defaults.",
|
|
24
|
+
},
|
|
25
|
+
props: [
|
|
26
|
+
{
|
|
27
|
+
name: 'locale',
|
|
28
|
+
type: 'string',
|
|
29
|
+
required: true,
|
|
30
|
+
description:
|
|
31
|
+
'BCP 47 language tag for the active locale (e.g. "en", "pt", "pt-BR", "zh-Hans"). Regional tags fall back to their base language, then to the shipped "en" catalog.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'messages',
|
|
35
|
+
type: 'MessagesByLocale',
|
|
36
|
+
required: false,
|
|
37
|
+
description:
|
|
38
|
+
'Optional map of BCP 47 tag to translation catalog. The shipped "en" catalog is always available and does not need to be listed here.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'overrides',
|
|
42
|
+
type: 'Overrides',
|
|
43
|
+
required: false,
|
|
44
|
+
description:
|
|
45
|
+
'Sparse per-locale key overrides applied on top of shipped defaults. Overrides are locale-keyed so a runtime locale swap picks up the correct set.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'children',
|
|
49
|
+
type: 'ReactNode',
|
|
50
|
+
required: true,
|
|
51
|
+
description: 'Content to render with the internationalization provider.',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @type {import('../docs-types').TranslationDoc} */
|
|
57
|
+
export const docsDense = {
|
|
58
|
+
description:
|
|
59
|
+
'Wraps app to set active locale and (optionally) merge translation catalogs + per-locale overrides. Astryx components resolve strings against this context; missing keys fall back to shipped English.',
|
|
60
|
+
usage: {
|
|
61
|
+
description:
|
|
62
|
+
'Wraps app to set active locale and (optionally) merge translation catalogs + per-locale overrides. Astryx components resolve strings against this context; missing keys fall back to shipped English.',
|
|
63
|
+
},
|
|
64
|
+
propDescriptions: {
|
|
65
|
+
locale:
|
|
66
|
+
'BCP 47 language tag (e.g. "en", "pt-BR"); regional tags fall back to base language then "en"',
|
|
67
|
+
messages:
|
|
68
|
+
'map of BCP 47 tag to translation catalog; "en" is always available',
|
|
69
|
+
overrides:
|
|
70
|
+
'sparse per-locale key overrides applied on top of shipped defaults',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file InternationalizationProvider.tsx
|
|
7
|
+
* @input React, InternationalizationContext, i18n types
|
|
8
|
+
* @output Exports InternationalizationProvider component and props type
|
|
9
|
+
* @position Provider component for astryx i18n locale + messages
|
|
10
|
+
*
|
|
11
|
+
* Wraps a subtree with a locale and (optional) additional message catalogs +
|
|
12
|
+
* overrides. Astryx components inside the subtree resolve their strings via
|
|
13
|
+
* this context. If a consumer never renders a provider, astryx components
|
|
14
|
+
* still work — they use the shipped en catalog directly.
|
|
15
|
+
*
|
|
16
|
+
* SYNC: When modified, update these files to stay in sync:
|
|
17
|
+
* - /packages/core/src/i18n/InternationalizationContext.ts
|
|
18
|
+
* - /packages/core/src/i18n/index.ts
|
|
19
|
+
* - /packages/core/src/i18n/InternationalizationProvider.doc.mjs
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {useMemo, type ReactNode} from 'react';
|
|
23
|
+
import {InternationalizationContext} from './InternationalizationContext';
|
|
24
|
+
import type {Locale, MessagesByLocale, Overrides} from './types';
|
|
25
|
+
|
|
26
|
+
export interface InternationalizationProviderProps {
|
|
27
|
+
/**
|
|
28
|
+
* BCP 47 language tag. Examples: `'en'`, `'pt'`, `'pt-BR'`, `'zh-Hans'`.
|
|
29
|
+
*
|
|
30
|
+
* Regional tags are respected — resolving a message walks the tag from
|
|
31
|
+
* most-specific to least-specific (`pt-BR` → `pt`), then falls back to
|
|
32
|
+
* the shipped `en` catalog.
|
|
33
|
+
*/
|
|
34
|
+
locale: Locale;
|
|
35
|
+
/**
|
|
36
|
+
* Additional shipped catalogs to make available for the selected locale.
|
|
37
|
+
* `en` is bundled with astryx and never needs to be listed here.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```
|
|
41
|
+
* import {fr} from '@astryxdesign/core/locales/fr.json';
|
|
42
|
+
* <InternationalizationProvider locale="fr" messages={{fr}}>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
messages?: MessagesByLocale;
|
|
46
|
+
/**
|
|
47
|
+
* Sparse per-locale overrides applied on top of shipped defaults.
|
|
48
|
+
* Only the keys you want to override need to be listed.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```
|
|
52
|
+
* <InternationalizationProvider
|
|
53
|
+
* locale="fr"
|
|
54
|
+
* overrides={{fr: {'@astryx.pagination.next': 'Suivant'}}}>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
overrides?: Overrides;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Provides locale + additional messages + overrides to all astryx
|
|
63
|
+
* components in the subtree.
|
|
64
|
+
*/
|
|
65
|
+
export function InternationalizationProvider({
|
|
66
|
+
locale,
|
|
67
|
+
messages,
|
|
68
|
+
overrides,
|
|
69
|
+
children,
|
|
70
|
+
}: InternationalizationProviderProps) {
|
|
71
|
+
const value = useMemo(
|
|
72
|
+
() => ({locale, messages: messages ?? {}, overrides}),
|
|
73
|
+
[locale, messages, overrides],
|
|
74
|
+
);
|
|
75
|
+
return (
|
|
76
|
+
<InternationalizationContext value={value}>
|
|
77
|
+
{children}
|
|
78
|
+
</InternationalizationContext>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
InternationalizationProvider.displayName = 'InternationalizationProvider';
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file e2e-pagination.test.tsx
|
|
5
|
+
* @input packages/core/src/Pagination, packages/core/src/i18n
|
|
6
|
+
* @output End-to-end tests proving the i18n framework actually swaps
|
|
7
|
+
* strings in real component output.
|
|
8
|
+
* @position Integration test: real component + real provider + real catalog.
|
|
9
|
+
* Not a unit test of resolve() — that's covered in resolve.test.ts.
|
|
10
|
+
*
|
|
11
|
+
* These assertions render <Pagination> and check that:
|
|
12
|
+
* 1. Default (no provider): English strings appear
|
|
13
|
+
* 2. With pseudo locale: accented+bracketed strings appear
|
|
14
|
+
* 3. With sparse override: only the overridden key changes
|
|
15
|
+
* 4. Regional locale fallback: pt-BR falls back to pt then en
|
|
16
|
+
* 5. Number formatting respects the locale (en-US vs de-DE separators)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {describe, test, expect} from 'vitest';
|
|
20
|
+
import {render, screen} from '@testing-library/react';
|
|
21
|
+
import {Pagination} from '../../Pagination';
|
|
22
|
+
import {InternationalizationProvider} from '../InternationalizationProvider';
|
|
23
|
+
import pseudoCatalog from '../../../locales/pseudo.json';
|
|
24
|
+
|
|
25
|
+
describe('Pagination × i18n — end to end', () => {
|
|
26
|
+
test('renders English strings by default (no provider)', () => {
|
|
27
|
+
render(
|
|
28
|
+
<Pagination
|
|
29
|
+
page={2}
|
|
30
|
+
totalItems={100}
|
|
31
|
+
pageSize={10}
|
|
32
|
+
onChange={() => {}}
|
|
33
|
+
variant="count"
|
|
34
|
+
/>,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// The nav landmark uses the default label "Pagination"
|
|
38
|
+
expect(
|
|
39
|
+
screen.getByRole('navigation', {name: 'Pagination'}),
|
|
40
|
+
).toBeInTheDocument();
|
|
41
|
+
|
|
42
|
+
// Prev/Next buttons carry English aria-labels
|
|
43
|
+
expect(
|
|
44
|
+
screen.getByRole('button', {name: 'Go to previous page'}),
|
|
45
|
+
).toBeInTheDocument();
|
|
46
|
+
expect(
|
|
47
|
+
screen.getByRole('button', {name: 'Go to next page'}),
|
|
48
|
+
).toBeInTheDocument();
|
|
49
|
+
|
|
50
|
+
// The visible count text is "11–20 of 100"
|
|
51
|
+
expect(screen.getByText(/11.20 of 100/)).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('renders pseudo strings when provider locale is pseudo', () => {
|
|
55
|
+
render(
|
|
56
|
+
<InternationalizationProvider
|
|
57
|
+
locale="pseudo"
|
|
58
|
+
messages={{pseudo: pseudoCatalog}}>
|
|
59
|
+
<Pagination
|
|
60
|
+
page={2}
|
|
61
|
+
totalItems={100}
|
|
62
|
+
pageSize={10}
|
|
63
|
+
onChange={() => {}}
|
|
64
|
+
variant="count"
|
|
65
|
+
/>
|
|
66
|
+
</InternationalizationProvider>,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// Nav landmark shows pseudo-translated label
|
|
70
|
+
expect(
|
|
71
|
+
screen.getByRole('navigation', {name: /Þàĝíñàţíóñ/}),
|
|
72
|
+
).toBeInTheDocument();
|
|
73
|
+
|
|
74
|
+
// Prev/Next aria-labels are pseudo-translated
|
|
75
|
+
expect(
|
|
76
|
+
screen.getByRole('button', {name: /Ĝó ţó þřéṽíóúš/}),
|
|
77
|
+
).toBeInTheDocument();
|
|
78
|
+
expect(
|
|
79
|
+
screen.getByRole('button', {name: /Ĝó ţó ñéẋţ/}),
|
|
80
|
+
).toBeInTheDocument();
|
|
81
|
+
|
|
82
|
+
// Visible count is pseudo-wrapped; numbers still format
|
|
83
|
+
expect(screen.getByText(/⟦11.20 óƒ 100⟧/)).toBeInTheDocument();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('sparse override changes only the overridden key', () => {
|
|
87
|
+
render(
|
|
88
|
+
<InternationalizationProvider
|
|
89
|
+
locale="fr"
|
|
90
|
+
overrides={{
|
|
91
|
+
fr: {'@astryx.pagination.next': 'Suivant'},
|
|
92
|
+
}}>
|
|
93
|
+
<Pagination
|
|
94
|
+
page={2}
|
|
95
|
+
totalItems={100}
|
|
96
|
+
pageSize={10}
|
|
97
|
+
onChange={() => {}}
|
|
98
|
+
/>
|
|
99
|
+
</InternationalizationProvider>,
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Overridden key: French
|
|
103
|
+
expect(screen.getByRole('button', {name: 'Suivant'})).toBeInTheDocument();
|
|
104
|
+
|
|
105
|
+
// NON-overridden keys fall through to English (fr has no other catalog)
|
|
106
|
+
expect(
|
|
107
|
+
screen.getByRole('navigation', {name: 'Pagination'}),
|
|
108
|
+
).toBeInTheDocument();
|
|
109
|
+
expect(
|
|
110
|
+
screen.getByRole('button', {name: 'Go to previous page'}),
|
|
111
|
+
).toBeInTheDocument();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('regional locale (pt-BR) falls back to base language (pt)', () => {
|
|
115
|
+
// pt-BR has one key, pt has another, en fills in the rest.
|
|
116
|
+
// Tests the resolveLocaleChain walking through resolve() end to end.
|
|
117
|
+
render(
|
|
118
|
+
<InternationalizationProvider
|
|
119
|
+
locale="pt-BR"
|
|
120
|
+
messages={{
|
|
121
|
+
'pt-BR': {
|
|
122
|
+
'@astryx.pagination.next': {defaultMessage: 'Próxima (BR)'},
|
|
123
|
+
},
|
|
124
|
+
pt: {
|
|
125
|
+
'@astryx.pagination.previous': {defaultMessage: 'Anterior'},
|
|
126
|
+
},
|
|
127
|
+
}}>
|
|
128
|
+
<Pagination
|
|
129
|
+
page={2}
|
|
130
|
+
totalItems={100}
|
|
131
|
+
pageSize={10}
|
|
132
|
+
onChange={() => {}}
|
|
133
|
+
/>
|
|
134
|
+
</InternationalizationProvider>,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
// next: from pt-BR
|
|
138
|
+
expect(
|
|
139
|
+
screen.getByRole('button', {name: 'Próxima (BR)'}),
|
|
140
|
+
).toBeInTheDocument();
|
|
141
|
+
|
|
142
|
+
// previous: from pt (fallback pt-BR → pt)
|
|
143
|
+
expect(screen.getByRole('button', {name: 'Anterior'})).toBeInTheDocument();
|
|
144
|
+
|
|
145
|
+
// label: neither pt-BR nor pt has it — falls back to en
|
|
146
|
+
expect(
|
|
147
|
+
screen.getByRole('navigation', {name: 'Pagination'}),
|
|
148
|
+
).toBeInTheDocument();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test('ICU number formatting respects the locale', () => {
|
|
152
|
+
// In de-DE, 1000 formats with "." as the thousands separator.
|
|
153
|
+
render(
|
|
154
|
+
<InternationalizationProvider locale="de-DE">
|
|
155
|
+
<Pagination
|
|
156
|
+
page={2}
|
|
157
|
+
totalItems={10000}
|
|
158
|
+
pageSize={10}
|
|
159
|
+
onChange={() => {}}
|
|
160
|
+
variant="count"
|
|
161
|
+
/>
|
|
162
|
+
</InternationalizationProvider>,
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
// We didn't provide a de-DE catalog — the string is en's pattern but
|
|
166
|
+
// numbers format under the de-DE locale, so "10000" becomes "10.000".
|
|
167
|
+
// Text is: "11–20 of 10.000"
|
|
168
|
+
// The dash between 11 and 20 is unicode en-dash (\u2013), match loosely
|
|
169
|
+
// by asserting the presence of the German-formatted 10.000.
|
|
170
|
+
expect(screen.getByText(/10\.000/)).toBeInTheDocument();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file e2e-powersearch.test.tsx
|
|
5
|
+
* @input packages/core/src/PowerSearch, packages/core/src/i18n
|
|
6
|
+
* @output End-to-end tests proving the i18n framework swaps strings inside
|
|
7
|
+
* PowerSearch's shipped-default operators AND UI chrome.
|
|
8
|
+
* @position Integration test: real PowerSearch + real provider + real catalog.
|
|
9
|
+
*
|
|
10
|
+
* The point of these tests is to prove that:
|
|
11
|
+
* 1. Astryx's default operators (built via `usePowerSearchConfig`) look
|
|
12
|
+
* up their labels through `t()` at render time — so an
|
|
13
|
+
* InternationalizationProvider swap changes them without touching
|
|
14
|
+
* the config object.
|
|
15
|
+
* 2. Consumer-provided operators with a raw `label` field are used
|
|
16
|
+
* verbatim (no lookup).
|
|
17
|
+
* 3. Consumer-provided operators with an `i18nKey` field are resolved
|
|
18
|
+
* against provider `overrides` / `messages`.
|
|
19
|
+
* 4. ICU plurals in result counts and value formatting swap per locale.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {describe, test, expect} from 'vitest';
|
|
23
|
+
import {render, screen} from '@testing-library/react';
|
|
24
|
+
import React, {useMemo} from 'react';
|
|
25
|
+
import {PowerSearch, usePowerSearchConfig} from '../../PowerSearch';
|
|
26
|
+
import type {FieldDefinition, PowerSearchFilter} from '../../PowerSearch';
|
|
27
|
+
import {InternationalizationProvider} from '../InternationalizationProvider';
|
|
28
|
+
import pseudoCatalog from '../../../locales/pseudo.json';
|
|
29
|
+
|
|
30
|
+
// Small harness — usePowerSearchConfig is a hook, so tests must render it
|
|
31
|
+
// via a component.
|
|
32
|
+
function Harness({
|
|
33
|
+
fieldDefs,
|
|
34
|
+
filters,
|
|
35
|
+
}: {
|
|
36
|
+
fieldDefs: ReadonlyArray<FieldDefinition>;
|
|
37
|
+
filters: ReadonlyArray<PowerSearchFilter>;
|
|
38
|
+
}) {
|
|
39
|
+
const {config} = usePowerSearchConfig(fieldDefs);
|
|
40
|
+
const stableFilters = useMemo(() => filters, [filters]);
|
|
41
|
+
return (
|
|
42
|
+
<PowerSearch
|
|
43
|
+
config={config}
|
|
44
|
+
filters={stableFilters}
|
|
45
|
+
onChange={() => {}}
|
|
46
|
+
resultCount={2}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const nameField: FieldDefinition = {
|
|
52
|
+
key: 'name',
|
|
53
|
+
type: 'string',
|
|
54
|
+
label: 'Name',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
describe('PowerSearch × i18n — end to end', () => {
|
|
58
|
+
test('renders English default operator labels with no provider', () => {
|
|
59
|
+
const filter: PowerSearchFilter = {
|
|
60
|
+
field: 'name',
|
|
61
|
+
operator: 'contains',
|
|
62
|
+
value: {type: 'string', value: 'ada'},
|
|
63
|
+
};
|
|
64
|
+
render(<Harness fieldDefs={[nameField]} filters={[filter]} />);
|
|
65
|
+
|
|
66
|
+
// The token displays field label + `: <operator label>` + value.
|
|
67
|
+
// The `contains` default operator should surface its English label.
|
|
68
|
+
expect(screen.getByText(/Name: contains/i)).toBeInTheDocument();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('resultCount uses ICU plural (2 results → "results")', () => {
|
|
72
|
+
render(<Harness fieldDefs={[nameField]} filters={[]} />);
|
|
73
|
+
expect(screen.getByText('2 results')).toBeInTheDocument();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('pseudo locale wraps default operator labels', () => {
|
|
77
|
+
const filter: PowerSearchFilter = {
|
|
78
|
+
field: 'name',
|
|
79
|
+
operator: 'contains',
|
|
80
|
+
value: {type: 'string', value: 'ada'},
|
|
81
|
+
};
|
|
82
|
+
render(
|
|
83
|
+
<InternationalizationProvider
|
|
84
|
+
locale="pseudo"
|
|
85
|
+
messages={{pseudo: pseudoCatalog}}>
|
|
86
|
+
<Harness fieldDefs={[nameField]} filters={[filter]} />
|
|
87
|
+
</InternationalizationProvider>,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Pseudo catalog wraps every en value in ⟦...⟧, so the default label
|
|
91
|
+
// "contains" becomes "⟦çöñţäîñš⟧" — token now shows "Name: ⟦çöñţäîñš⟧ ada"
|
|
92
|
+
// (the field label "Name" is consumer-provided, not translated).
|
|
93
|
+
expect(screen.getByText(/Name:.*⟦.*⟧/)).toBeInTheDocument();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('provider overrides translate default operator labels', () => {
|
|
97
|
+
const filter: PowerSearchFilter = {
|
|
98
|
+
field: 'name',
|
|
99
|
+
operator: 'contains',
|
|
100
|
+
value: {type: 'string', value: 'ada'},
|
|
101
|
+
};
|
|
102
|
+
render(
|
|
103
|
+
<InternationalizationProvider
|
|
104
|
+
locale="fr"
|
|
105
|
+
overrides={{
|
|
106
|
+
fr: {'@astryx.powersearch.operator.contains': 'contient'},
|
|
107
|
+
}}>
|
|
108
|
+
<Harness fieldDefs={[nameField]} filters={[filter]} />
|
|
109
|
+
</InternationalizationProvider>,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect(screen.getByText(/Name: contient/)).toBeInTheDocument();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('resultCount ICU plural swaps under provider overrides', () => {
|
|
116
|
+
render(
|
|
117
|
+
<InternationalizationProvider
|
|
118
|
+
locale="fr"
|
|
119
|
+
overrides={{
|
|
120
|
+
fr: {
|
|
121
|
+
'@astryx.powersearch.resultCount':
|
|
122
|
+
'{count, number} {count, plural, one {résultat} other {résultats}}',
|
|
123
|
+
},
|
|
124
|
+
}}>
|
|
125
|
+
<Harness fieldDefs={[nameField]} filters={[]} />
|
|
126
|
+
</InternationalizationProvider>,
|
|
127
|
+
);
|
|
128
|
+
expect(screen.getByText('2 résultats')).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
});
|