@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
|
@@ -32,6 +32,7 @@ import {TimeInput} from '../TimeInput';
|
|
|
32
32
|
import {Selector} from '../Selector';
|
|
33
33
|
import {Tokenizer} from '../Tokenizer';
|
|
34
34
|
import {Typeahead} from '../Typeahead';
|
|
35
|
+
import {useTranslator} from '../i18n';
|
|
35
36
|
|
|
36
37
|
export interface PowerSearchValueEditorProps {
|
|
37
38
|
operatorValue: OperatorValue;
|
|
@@ -85,6 +86,7 @@ function StringEditor({
|
|
|
85
86
|
onChange: (value: FilterValue, shouldSave?: boolean) => void;
|
|
86
87
|
onEnter?: () => void;
|
|
87
88
|
}) {
|
|
89
|
+
const t = useTranslator();
|
|
88
90
|
const currentValue = filterValue?.type === 'string' ? filterValue.value : '';
|
|
89
91
|
|
|
90
92
|
// When a searchSource is provided, render a typeahead instead of a plain
|
|
@@ -96,7 +98,7 @@ function StringEditor({
|
|
|
96
98
|
|
|
97
99
|
return (
|
|
98
100
|
<Typeahead
|
|
99
|
-
label=
|
|
101
|
+
label={t('@astryx.powersearch.valueEditor.value')}
|
|
100
102
|
isLabelHidden
|
|
101
103
|
searchSource={operatorValue.searchSource}
|
|
102
104
|
value={selectedItem}
|
|
@@ -107,7 +109,7 @@ function StringEditor({
|
|
|
107
109
|
onChange({type: 'string', value: ''});
|
|
108
110
|
}
|
|
109
111
|
}}
|
|
110
|
-
placeholder=
|
|
112
|
+
placeholder={t('@astryx.powersearch.valueEditor.searchPlaceholder')}
|
|
111
113
|
debounceMs={150}
|
|
112
114
|
/>
|
|
113
115
|
);
|
|
@@ -115,10 +117,10 @@ function StringEditor({
|
|
|
115
117
|
|
|
116
118
|
return (
|
|
117
119
|
<TextInput
|
|
118
|
-
label=
|
|
120
|
+
label={t('@astryx.powersearch.valueEditor.value')}
|
|
119
121
|
isLabelHidden
|
|
120
122
|
value={currentValue}
|
|
121
|
-
placeholder=
|
|
123
|
+
placeholder={t('@astryx.powersearch.valueEditor.enterValuePlaceholder')}
|
|
122
124
|
onChange={(value: string) => {
|
|
123
125
|
onChange({type: 'string', value});
|
|
124
126
|
}}
|
|
@@ -135,6 +137,7 @@ function StringListEditor({
|
|
|
135
137
|
filterValue: FilterValue | undefined;
|
|
136
138
|
onChange: (value: FilterValue) => void;
|
|
137
139
|
}) {
|
|
140
|
+
const t = useTranslator();
|
|
138
141
|
const currentValue: SearchableItem[] = useMemo(() => {
|
|
139
142
|
if (filterValue?.type !== 'string_list') {
|
|
140
143
|
return [];
|
|
@@ -160,7 +163,7 @@ function StringListEditor({
|
|
|
160
163
|
|
|
161
164
|
return (
|
|
162
165
|
<Tokenizer
|
|
163
|
-
label=
|
|
166
|
+
label={t('@astryx.powersearch.valueEditor.values')}
|
|
164
167
|
isLabelHidden
|
|
165
168
|
searchSource={source}
|
|
166
169
|
value={currentValue}
|
|
@@ -170,7 +173,7 @@ function StringListEditor({
|
|
|
170
173
|
value: items.map(item => item.label),
|
|
171
174
|
});
|
|
172
175
|
}}
|
|
173
|
-
placeholder=
|
|
176
|
+
placeholder={t('@astryx.powersearch.valueEditor.addValuesPlaceholder')}
|
|
174
177
|
debounceMs={operatorValue.searchSource ? 150 : 0}
|
|
175
178
|
hasCreate={hasCreate}
|
|
176
179
|
/>
|
|
@@ -186,12 +189,13 @@ function IntegerEditor({
|
|
|
186
189
|
filterValue: FilterValue | undefined;
|
|
187
190
|
onChange: (value: FilterValue) => void;
|
|
188
191
|
}) {
|
|
192
|
+
const t = useTranslator();
|
|
189
193
|
const currentValue =
|
|
190
194
|
filterValue?.type === 'integer' ? filterValue.value : undefined;
|
|
191
195
|
|
|
192
196
|
return (
|
|
193
197
|
<NumberInput
|
|
194
|
-
label=
|
|
198
|
+
label={t('@astryx.powersearch.valueEditor.value')}
|
|
195
199
|
isLabelHidden
|
|
196
200
|
value={currentValue ?? null}
|
|
197
201
|
onChange={(value: number) => {
|
|
@@ -201,7 +205,7 @@ function IntegerEditor({
|
|
|
201
205
|
max={operatorValue.maxValue}
|
|
202
206
|
units={operatorValue.units}
|
|
203
207
|
isIntegerOnly
|
|
204
|
-
placeholder=
|
|
208
|
+
placeholder={t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')}
|
|
205
209
|
/>
|
|
206
210
|
);
|
|
207
211
|
}
|
|
@@ -215,12 +219,13 @@ function FloatEditor({
|
|
|
215
219
|
filterValue: FilterValue | undefined;
|
|
216
220
|
onChange: (value: FilterValue) => void;
|
|
217
221
|
}) {
|
|
222
|
+
const t = useTranslator();
|
|
218
223
|
const currentValue =
|
|
219
224
|
filterValue?.type === 'float' ? filterValue.value : undefined;
|
|
220
225
|
|
|
221
226
|
return (
|
|
222
227
|
<NumberInput
|
|
223
|
-
label=
|
|
228
|
+
label={t('@astryx.powersearch.valueEditor.value')}
|
|
224
229
|
isLabelHidden
|
|
225
230
|
value={currentValue ?? null}
|
|
226
231
|
onChange={(value: number) => {
|
|
@@ -229,7 +234,7 @@ function FloatEditor({
|
|
|
229
234
|
min={operatorValue.minValue}
|
|
230
235
|
max={operatorValue.maxValue}
|
|
231
236
|
units={operatorValue.units}
|
|
232
|
-
placeholder=
|
|
237
|
+
placeholder={t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')}
|
|
233
238
|
/>
|
|
234
239
|
);
|
|
235
240
|
}
|
|
@@ -243,6 +248,7 @@ function TimeEditor({
|
|
|
243
248
|
filterValue: FilterValue | undefined;
|
|
244
249
|
onChange: (value: FilterValue) => void;
|
|
245
250
|
}) {
|
|
251
|
+
const t = useTranslator();
|
|
246
252
|
const currentValue =
|
|
247
253
|
filterValue?.type === 'time'
|
|
248
254
|
? (filterValue.value as ISOTimeString)
|
|
@@ -250,7 +256,7 @@ function TimeEditor({
|
|
|
250
256
|
|
|
251
257
|
return (
|
|
252
258
|
<TimeInput
|
|
253
|
-
label=
|
|
259
|
+
label={t('@astryx.powersearch.valueEditor.time')}
|
|
254
260
|
isLabelHidden
|
|
255
261
|
value={currentValue}
|
|
256
262
|
onChange={value => {
|
|
@@ -272,6 +278,7 @@ function DateAbsoluteEditor({
|
|
|
272
278
|
filterValue: FilterValue | undefined;
|
|
273
279
|
onChange: (value: FilterValue) => void;
|
|
274
280
|
}) {
|
|
281
|
+
const t = useTranslator();
|
|
275
282
|
// Convert unixSeconds to ISO date string for the date input
|
|
276
283
|
const currentValue = useMemo(() => {
|
|
277
284
|
if (filterValue?.type !== 'date_absolute') {
|
|
@@ -283,7 +290,7 @@ function DateAbsoluteEditor({
|
|
|
283
290
|
|
|
284
291
|
return (
|
|
285
292
|
<DateInput
|
|
286
|
-
label=
|
|
293
|
+
label={t('@astryx.powersearch.valueEditor.date')}
|
|
287
294
|
isLabelHidden
|
|
288
295
|
value={currentValue}
|
|
289
296
|
onChange={value => {
|
|
@@ -305,6 +312,7 @@ function DateRelativeEditor({
|
|
|
305
312
|
filterValue: FilterValue | undefined;
|
|
306
313
|
onChange: (value: FilterValue, shouldSave?: boolean) => void;
|
|
307
314
|
}) {
|
|
315
|
+
const t = useTranslator();
|
|
308
316
|
const currentValue =
|
|
309
317
|
filterValue?.type === 'date_relative' ? filterValue.value : undefined;
|
|
310
318
|
|
|
@@ -342,7 +350,7 @@ function DateRelativeEditor({
|
|
|
342
350
|
|
|
343
351
|
return (
|
|
344
352
|
<Selector
|
|
345
|
-
label=
|
|
353
|
+
label={t('@astryx.powersearch.valueEditor.relativeDate')}
|
|
346
354
|
isLabelHidden
|
|
347
355
|
options={options}
|
|
348
356
|
value={currentValue}
|
|
@@ -361,6 +369,7 @@ function DateRangeEditor({
|
|
|
361
369
|
filterValue: FilterValue | undefined;
|
|
362
370
|
onChange: (value: FilterValue) => void;
|
|
363
371
|
}) {
|
|
372
|
+
const t = useTranslator();
|
|
364
373
|
const startValue = useMemo(() => {
|
|
365
374
|
if (filterValue?.type !== 'date_range') {
|
|
366
375
|
return undefined;
|
|
@@ -428,13 +437,13 @@ function DateRangeEditor({
|
|
|
428
437
|
return (
|
|
429
438
|
<>
|
|
430
439
|
<DateInput
|
|
431
|
-
label=
|
|
440
|
+
label={t('@astryx.powersearch.valueEditor.startDate')}
|
|
432
441
|
isLabelHidden
|
|
433
442
|
value={startValue}
|
|
434
443
|
onChange={handleStartChange}
|
|
435
444
|
/>
|
|
436
445
|
<DateInput
|
|
437
|
-
label=
|
|
446
|
+
label={t('@astryx.powersearch.valueEditor.endDate')}
|
|
438
447
|
isLabelHidden
|
|
439
448
|
value={endValue}
|
|
440
449
|
onChange={handleEndChange}
|
|
@@ -452,6 +461,7 @@ function EnumEditor({
|
|
|
452
461
|
filterValue: FilterValue | undefined;
|
|
453
462
|
onChange: (value: FilterValue, shouldSave?: boolean) => void;
|
|
454
463
|
}) {
|
|
464
|
+
const t = useTranslator();
|
|
455
465
|
const currentValue =
|
|
456
466
|
filterValue?.type === 'enum' ? filterValue.value : undefined;
|
|
457
467
|
|
|
@@ -466,7 +476,7 @@ function EnumEditor({
|
|
|
466
476
|
|
|
467
477
|
return (
|
|
468
478
|
<Selector
|
|
469
|
-
label=
|
|
479
|
+
label={t('@astryx.powersearch.valueEditor.value')}
|
|
470
480
|
isLabelHidden
|
|
471
481
|
options={options}
|
|
472
482
|
value={currentValue}
|
|
@@ -486,6 +496,7 @@ function EnumListEditor({
|
|
|
486
496
|
filterValue: FilterValue | undefined;
|
|
487
497
|
onChange: (value: FilterValue) => void;
|
|
488
498
|
}) {
|
|
499
|
+
const t = useTranslator();
|
|
489
500
|
const items = useMemo(
|
|
490
501
|
() => enumItemsToSearchableItems(operatorValue.values),
|
|
491
502
|
[operatorValue.values],
|
|
@@ -505,7 +516,7 @@ function EnumListEditor({
|
|
|
505
516
|
|
|
506
517
|
return (
|
|
507
518
|
<Tokenizer
|
|
508
|
-
label=
|
|
519
|
+
label={t('@astryx.powersearch.valueEditor.values')}
|
|
509
520
|
isLabelHidden
|
|
510
521
|
searchSource={source}
|
|
511
522
|
value={currentValue}
|
|
@@ -515,7 +526,7 @@ function EnumListEditor({
|
|
|
515
526
|
value: selectedItems.map(item => item.id),
|
|
516
527
|
});
|
|
517
528
|
}}
|
|
518
|
-
placeholder=
|
|
529
|
+
placeholder={t('@astryx.powersearch.valueEditor.selectValuesPlaceholder')}
|
|
519
530
|
hasEntriesOnFocus
|
|
520
531
|
debounceMs={0}
|
|
521
532
|
/>
|
|
@@ -531,6 +542,7 @@ function EntityListEditor({
|
|
|
531
542
|
filterValue: FilterValue | undefined;
|
|
532
543
|
onChange: (value: FilterValue) => void;
|
|
533
544
|
}) {
|
|
545
|
+
const t = useTranslator();
|
|
534
546
|
const source = useMemo<SearchSource<SearchableItem>>(() => {
|
|
535
547
|
if (operatorValue.searchSource) {
|
|
536
548
|
return operatorValue.searchSource;
|
|
@@ -555,7 +567,7 @@ function EntityListEditor({
|
|
|
555
567
|
|
|
556
568
|
return (
|
|
557
569
|
<Tokenizer
|
|
558
|
-
label=
|
|
570
|
+
label={t('@astryx.powersearch.valueEditor.entities')}
|
|
559
571
|
isLabelHidden
|
|
560
572
|
searchSource={source}
|
|
561
573
|
value={currentValue}
|
|
@@ -574,7 +586,7 @@ function EntityListEditor({
|
|
|
574
586
|
});
|
|
575
587
|
}}
|
|
576
588
|
renderItem={operatorValue.renderItem}
|
|
577
|
-
placeholder=
|
|
589
|
+
placeholder={t('@astryx.powersearch.valueEditor.searchPlaceholder')}
|
|
578
590
|
debounceMs={operatorValue.searchSource ? 150 : 0}
|
|
579
591
|
/>
|
|
580
592
|
);
|
|
@@ -591,6 +603,7 @@ function CustomEditor({
|
|
|
591
603
|
onChange: (value: FilterValue) => void;
|
|
592
604
|
isDisabled?: boolean;
|
|
593
605
|
}) {
|
|
606
|
+
const t = useTranslator();
|
|
594
607
|
const currentValue =
|
|
595
608
|
filterValue?.type === 'custom' ? filterValue.value : null;
|
|
596
609
|
const EditorComponent = operatorValue.Editor;
|
|
@@ -603,7 +616,7 @@ function CustomEditor({
|
|
|
603
616
|
onChange({type: 'custom', value});
|
|
604
617
|
}
|
|
605
618
|
}}
|
|
606
|
-
placeholder=
|
|
619
|
+
placeholder={t('@astryx.powersearch.valueEditor.enterValuePlaceholder')}
|
|
607
620
|
value={currentValue}
|
|
608
621
|
/>
|
|
609
622
|
);
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import {describe, expect, it} from 'vitest';
|
|
4
|
+
import {formatFilterValue} from './formatFilterValue';
|
|
5
|
+
import type {TranslatorFn} from '../i18n';
|
|
6
|
+
import type {OperatorValue, FilterValue} from './types';
|
|
7
|
+
|
|
8
|
+
// Minimal stand-in for the real translator: resolves just the count/range keys
|
|
9
|
+
// formatFilterValue uses, with the same singular/plural forms as en.json so the
|
|
10
|
+
// overflow-summary assertions ("3 items", "2 entities", "1 filter") hold.
|
|
11
|
+
const t: TranslatorFn = (key, values) => {
|
|
12
|
+
const count = Number(values?.count ?? 0);
|
|
13
|
+
switch (key) {
|
|
14
|
+
case '@astryx.powersearch.valueEditor.itemsCount':
|
|
15
|
+
return `${count} ${count === 1 ? 'item' : 'items'}`;
|
|
16
|
+
case '@astryx.powersearch.valueEditor.entitiesCount':
|
|
17
|
+
return `${count} ${count === 1 ? 'entity' : 'entities'}`;
|
|
18
|
+
case '@astryx.powersearch.valueEditor.filtersCount':
|
|
19
|
+
return `${count} ${count === 1 ? 'filter' : 'filters'}`;
|
|
20
|
+
case '@astryx.powersearch.valueEditor.dateRange':
|
|
21
|
+
return 'date range';
|
|
22
|
+
default:
|
|
23
|
+
return key;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// _config is unused by formatFilterValue; a stub keeps the call type-clean.
|
|
28
|
+
const fmt = (
|
|
29
|
+
operator: OperatorValue,
|
|
30
|
+
value: FilterValue,
|
|
31
|
+
maxLength = 20,
|
|
32
|
+
timezoneID?: string,
|
|
33
|
+
): string =>
|
|
34
|
+
formatFilterValue({} as never, operator, value, maxLength, t, timezoneID);
|
|
35
|
+
|
|
36
|
+
const ELLIPSIS = '…';
|
|
37
|
+
|
|
38
|
+
describe('formatFilterValue', () => {
|
|
39
|
+
it('returns an empty string for an empty value', () => {
|
|
40
|
+
expect(fmt({type: 'empty'}, {type: 'empty'})).toBe('');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('string', () => {
|
|
44
|
+
it('returns the string unchanged when within maxLength', () => {
|
|
45
|
+
expect(fmt({type: 'string'}, {type: 'string', value: 'hello'})).toBe(
|
|
46
|
+
'hello',
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('truncates with an ellipsis when longer than maxLength', () => {
|
|
51
|
+
const out = fmt(
|
|
52
|
+
{type: 'string'},
|
|
53
|
+
{type: 'string', value: 'abcdefghij'},
|
|
54
|
+
5,
|
|
55
|
+
);
|
|
56
|
+
expect(out).toBe('abcd' + ELLIPSIS);
|
|
57
|
+
expect(out.length).toBe(5);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('keeps a string exactly at the boundary intact', () => {
|
|
61
|
+
expect(fmt({type: 'string'}, {type: 'string', value: 'abcde'}, 5)).toBe(
|
|
62
|
+
'abcde',
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('integer / float', () => {
|
|
68
|
+
it('formats an integer with locale grouping', () => {
|
|
69
|
+
const expected = new Intl.NumberFormat().format(1234567);
|
|
70
|
+
expect(
|
|
71
|
+
fmt({type: 'integer'}, {type: 'integer', value: 1234567}, 40),
|
|
72
|
+
).toBe(expected);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('appends integer units only when the operator is an integer', () => {
|
|
76
|
+
expect(
|
|
77
|
+
fmt({type: 'integer', units: 'ms'}, {type: 'integer', value: 42}),
|
|
78
|
+
).toBe('42 ms');
|
|
79
|
+
// mismatched operator type → no units
|
|
80
|
+
expect(fmt({type: 'string'}, {type: 'integer', value: 42})).toBe('42');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('appends float units only when the operator is a float', () => {
|
|
84
|
+
expect(
|
|
85
|
+
fmt({type: 'float', units: 'kg'}, {type: 'float', value: 3.5}),
|
|
86
|
+
).toBe('3.5 kg');
|
|
87
|
+
expect(fmt({type: 'string'}, {type: 'float', value: 3.5})).toBe('3.5');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('enum', () => {
|
|
92
|
+
const enumOp: OperatorValue = {
|
|
93
|
+
type: 'enum',
|
|
94
|
+
values: [
|
|
95
|
+
{value: 'us', label: 'United States'},
|
|
96
|
+
{value: 'ca', label: 'Canada'},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
it('maps the stored value to its label', () => {
|
|
101
|
+
expect(fmt(enumOp, {type: 'enum', value: 'ca'}, 40)).toBe('Canada');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('falls back to the raw value when no label matches', () => {
|
|
105
|
+
expect(fmt(enumOp, {type: 'enum', value: 'mx'}, 40)).toBe('mx');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('uses the raw value when the operator is not an enum', () => {
|
|
109
|
+
expect(fmt({type: 'string'}, {type: 'enum', value: 'ca'}, 40)).toBe('ca');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('truncates a long enum label', () => {
|
|
113
|
+
expect(fmt(enumOp, {type: 'enum', value: 'us'}, 5)).toBe(
|
|
114
|
+
'Unit' + ELLIPSIS,
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('string_list', () => {
|
|
120
|
+
const op: OperatorValue = {type: 'string_list'};
|
|
121
|
+
it('returns an empty string for no items', () => {
|
|
122
|
+
expect(fmt(op, {type: 'string_list', value: []})).toBe('');
|
|
123
|
+
});
|
|
124
|
+
it('returns the single item, truncated', () => {
|
|
125
|
+
expect(fmt(op, {type: 'string_list', value: ['solo']})).toBe('solo');
|
|
126
|
+
});
|
|
127
|
+
it('joins multiple items when they fit', () => {
|
|
128
|
+
expect(fmt(op, {type: 'string_list', value: ['a', 'b', 'c']})).toBe(
|
|
129
|
+
'a, b, c',
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
it('summarizes as a count when the join exceeds maxLength', () => {
|
|
133
|
+
expect(
|
|
134
|
+
fmt(op, {type: 'string_list', value: ['alpha', 'bravo', 'charlie']}, 8),
|
|
135
|
+
).toBe('3 items');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('enum_list', () => {
|
|
140
|
+
const enumOp: OperatorValue = {
|
|
141
|
+
type: 'enum_list',
|
|
142
|
+
values: [
|
|
143
|
+
{value: 'r', label: 'Red'},
|
|
144
|
+
{value: 'g', label: 'Green'},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
it('returns an empty string for no items', () => {
|
|
148
|
+
expect(fmt(enumOp, {type: 'enum_list', value: []})).toBe('');
|
|
149
|
+
});
|
|
150
|
+
it('maps a single value to its label', () => {
|
|
151
|
+
expect(fmt(enumOp, {type: 'enum_list', value: ['g']}, 40)).toBe('Green');
|
|
152
|
+
});
|
|
153
|
+
it('joins mapped labels when they fit', () => {
|
|
154
|
+
expect(fmt(enumOp, {type: 'enum_list', value: ['r', 'g']}, 40)).toBe(
|
|
155
|
+
'Red, Green',
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
it('summarizes labels as a count when too long', () => {
|
|
159
|
+
expect(fmt(enumOp, {type: 'enum_list', value: ['r', 'g']}, 5)).toBe(
|
|
160
|
+
'2 items',
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
it('uses raw values with a non-enum operator', () => {
|
|
164
|
+
expect(
|
|
165
|
+
fmt({type: 'string'}, {type: 'enum_list', value: ['x', 'y']}, 40),
|
|
166
|
+
).toBe('2 items');
|
|
167
|
+
expect(
|
|
168
|
+
fmt({type: 'string'}, {type: 'enum_list', value: ['solo']}, 40),
|
|
169
|
+
).toBe('solo');
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe('entity_list', () => {
|
|
174
|
+
const op: OperatorValue = {type: 'entity_list'};
|
|
175
|
+
it('returns an empty string for no entities', () => {
|
|
176
|
+
expect(fmt(op, {type: 'entity_list', value: []})).toBe('');
|
|
177
|
+
});
|
|
178
|
+
it('returns a single entity label', () => {
|
|
179
|
+
expect(
|
|
180
|
+
fmt(op, {type: 'entity_list', value: [{id: '1', label: 'Ada'}]}),
|
|
181
|
+
).toBe('Ada');
|
|
182
|
+
});
|
|
183
|
+
it('joins entity labels when they fit', () => {
|
|
184
|
+
expect(
|
|
185
|
+
fmt(op, {
|
|
186
|
+
type: 'entity_list',
|
|
187
|
+
value: [
|
|
188
|
+
{id: '1', label: 'Ada'},
|
|
189
|
+
{id: '2', label: 'Bob'},
|
|
190
|
+
],
|
|
191
|
+
}),
|
|
192
|
+
).toBe('Ada, Bob');
|
|
193
|
+
});
|
|
194
|
+
it('summarizes as an entity count when too long', () => {
|
|
195
|
+
expect(
|
|
196
|
+
fmt(
|
|
197
|
+
op,
|
|
198
|
+
{
|
|
199
|
+
type: 'entity_list',
|
|
200
|
+
value: [
|
|
201
|
+
{id: '1', label: 'Alexander'},
|
|
202
|
+
{id: '2', label: 'Bartholomew'},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
8,
|
|
206
|
+
),
|
|
207
|
+
).toBe('2 entities');
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
describe('dates and time', () => {
|
|
212
|
+
it('returns a time value verbatim', () => {
|
|
213
|
+
expect(fmt({type: 'time'}, {type: 'time', value: '14:30'})).toBe('14:30');
|
|
214
|
+
});
|
|
215
|
+
it('returns a relative date value verbatim', () => {
|
|
216
|
+
expect(
|
|
217
|
+
fmt({type: 'date_relative'}, {type: 'date_relative', value: '7d'}),
|
|
218
|
+
).toBe('7d');
|
|
219
|
+
});
|
|
220
|
+
it('renders a fixed placeholder for a date range', () => {
|
|
221
|
+
expect(
|
|
222
|
+
fmt(
|
|
223
|
+
{type: 'date_range'},
|
|
224
|
+
{
|
|
225
|
+
type: 'date_range',
|
|
226
|
+
value: {start: {type: 'NOW'}, end: {type: 'NOW'}},
|
|
227
|
+
},
|
|
228
|
+
),
|
|
229
|
+
).toBe('date range');
|
|
230
|
+
});
|
|
231
|
+
it('formats an absolute date and truncates to maxLength', () => {
|
|
232
|
+
const full = fmt(
|
|
233
|
+
{type: 'date_absolute'},
|
|
234
|
+
{type: 'date_absolute', unixSeconds: 0},
|
|
235
|
+
60,
|
|
236
|
+
'UTC',
|
|
237
|
+
);
|
|
238
|
+
expect(full).toContain('1970');
|
|
239
|
+
const short = fmt(
|
|
240
|
+
{type: 'date_absolute'},
|
|
241
|
+
{type: 'date_absolute', unixSeconds: 0},
|
|
242
|
+
6,
|
|
243
|
+
'UTC',
|
|
244
|
+
);
|
|
245
|
+
expect(short.length).toBe(6);
|
|
246
|
+
expect(short.endsWith(ELLIPSIS)).toBe(true);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
describe('custom', () => {
|
|
251
|
+
it('stringifies via the operator getString and truncates', () => {
|
|
252
|
+
const op: OperatorValue = {
|
|
253
|
+
type: 'custom',
|
|
254
|
+
Editor: (() => null) as never,
|
|
255
|
+
getString: v => `custom:${v}`,
|
|
256
|
+
};
|
|
257
|
+
expect(fmt(op, {type: 'custom', value: 'x'})).toBe('custom:x');
|
|
258
|
+
});
|
|
259
|
+
it('returns the raw value when the operator is not custom', () => {
|
|
260
|
+
expect(fmt({type: 'string'}, {type: 'custom', value: 'raw'})).toBe('raw');
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe('nested', () => {
|
|
265
|
+
it('uses the singular form for a single nested filter', () => {
|
|
266
|
+
expect(
|
|
267
|
+
fmt({type: 'nested'}, {type: 'nested', value: [{} as never]}),
|
|
268
|
+
).toBe('1 filter');
|
|
269
|
+
});
|
|
270
|
+
it('uses the plural form for multiple nested filters', () => {
|
|
271
|
+
expect(
|
|
272
|
+
fmt(
|
|
273
|
+
{type: 'nested'},
|
|
274
|
+
{
|
|
275
|
+
type: 'nested',
|
|
276
|
+
value: [{} as never, {} as never, {} as never],
|
|
277
|
+
},
|
|
278
|
+
),
|
|
279
|
+
).toBe('3 filters');
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type {OperatorValue, FilterValue, EnumItem} from './types';
|
|
14
14
|
import type {InternalConfig} from './useInternalConfig';
|
|
15
|
+
import type {TranslatorFn} from '../i18n';
|
|
15
16
|
|
|
16
17
|
function truncate(str: string, maxLength: number): string {
|
|
17
18
|
if (str.length <= maxLength) {
|
|
@@ -50,8 +51,11 @@ function formatRelativeDate(value: string): string {
|
|
|
50
51
|
return value;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
function formatDateRange(
|
|
54
|
-
|
|
54
|
+
function formatDateRange(
|
|
55
|
+
_value: {start: unknown; end: unknown},
|
|
56
|
+
t: TranslatorFn,
|
|
57
|
+
): string {
|
|
58
|
+
return t('@astryx.powersearch.valueEditor.dateRange');
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export function formatFilterValue(
|
|
@@ -59,6 +63,7 @@ export function formatFilterValue(
|
|
|
59
63
|
operatorValue: OperatorValue,
|
|
60
64
|
filterValue: FilterValue,
|
|
61
65
|
maxLength: number,
|
|
66
|
+
t: TranslatorFn,
|
|
62
67
|
timezoneID?: string,
|
|
63
68
|
): string {
|
|
64
69
|
switch (filterValue.type) {
|
|
@@ -101,7 +106,9 @@ export function formatFilterValue(
|
|
|
101
106
|
if (joined.length <= maxLength) {
|
|
102
107
|
return joined;
|
|
103
108
|
}
|
|
104
|
-
return
|
|
109
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
110
|
+
count: items.length,
|
|
111
|
+
});
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
case 'enum_list': {
|
|
@@ -118,12 +125,16 @@ export function formatFilterValue(
|
|
|
118
125
|
if (joined.length <= maxLength) {
|
|
119
126
|
return joined;
|
|
120
127
|
}
|
|
121
|
-
return
|
|
128
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
129
|
+
count: labels.length,
|
|
130
|
+
});
|
|
122
131
|
}
|
|
123
132
|
if (items.length === 1) {
|
|
124
133
|
return truncate(items[0], maxLength);
|
|
125
134
|
}
|
|
126
|
-
return
|
|
135
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
136
|
+
count: items.length,
|
|
137
|
+
});
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
case 'entity_list': {
|
|
@@ -138,7 +149,9 @@ export function formatFilterValue(
|
|
|
138
149
|
if (joined.length <= maxLength) {
|
|
139
150
|
return joined;
|
|
140
151
|
}
|
|
141
|
-
return
|
|
152
|
+
return t('@astryx.powersearch.valueEditor.entitiesCount', {
|
|
153
|
+
count: entities.length,
|
|
154
|
+
});
|
|
142
155
|
}
|
|
143
156
|
|
|
144
157
|
case 'time':
|
|
@@ -154,7 +167,7 @@ export function formatFilterValue(
|
|
|
154
167
|
return formatRelativeDate(filterValue.value);
|
|
155
168
|
|
|
156
169
|
case 'date_range':
|
|
157
|
-
return formatDateRange(filterValue.value);
|
|
170
|
+
return formatDateRange(filterValue.value, t);
|
|
158
171
|
|
|
159
172
|
case 'custom':
|
|
160
173
|
if (operatorValue.type === 'custom') {
|
|
@@ -164,7 +177,7 @@ export function formatFilterValue(
|
|
|
164
177
|
|
|
165
178
|
case 'nested': {
|
|
166
179
|
const count = filterValue.value.length;
|
|
167
|
-
return
|
|
180
|
+
return t('@astryx.powersearch.valueEditor.filtersCount', {count});
|
|
168
181
|
}
|
|
169
182
|
|
|
170
183
|
default:
|
package/src/PowerSearch/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type {PowerSearchProps, PowerSearchSize} from './PowerSearch';
|
|
|
17
17
|
export {PowerSearchToken} from './PowerSearchToken';
|
|
18
18
|
export {PowerSearchFilterEditor} from './PowerSearchFilterEditor';
|
|
19
19
|
|
|
20
|
+
export {resolveOperatorLabel} from './resolveOperatorLabel';
|
|
21
|
+
|
|
20
22
|
export {
|
|
21
23
|
createPowerSearchConfig,
|
|
22
24
|
usePowerSearchConfig,
|
|
@@ -28,6 +30,9 @@ export type {
|
|
|
28
30
|
PowerSearchConfig,
|
|
29
31
|
PowerSearchField,
|
|
30
32
|
PowerSearchOperator,
|
|
33
|
+
PowerSearchOperatorBase,
|
|
34
|
+
PowerSearchOperatorWithLabel,
|
|
35
|
+
PowerSearchOperatorWithI18nKey,
|
|
31
36
|
|
|
32
37
|
// Operator value types
|
|
33
38
|
OperatorValue,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file resolveOperatorLabel.ts
|
|
5
|
+
* @input PowerSearchOperator + translator function
|
|
6
|
+
* @output Display string for the operator label
|
|
7
|
+
* @position Shared label-resolution helper used at every render site that
|
|
8
|
+
* reads an operator's display text (PowerSearch.tsx, PowerSearchToken.tsx,
|
|
9
|
+
* PowerSearchEditPopover.tsx, usePowerSearchSource.ts).
|
|
10
|
+
*
|
|
11
|
+
* A PowerSearchOperator is a discriminated union of two variants:
|
|
12
|
+
* - `{key, value, label}` — consumer-supplied raw text (used verbatim)
|
|
13
|
+
* - `{key, value, i18nKey}` — catalog-driven text (looked up via t())
|
|
14
|
+
*
|
|
15
|
+
* Astryx's shipped default operators use the i18nKey variant; consumers
|
|
16
|
+
* writing custom operators typically use the label variant.
|
|
17
|
+
*
|
|
18
|
+
* SYNC: When modified, update:
|
|
19
|
+
* - /packages/core/src/PowerSearch/types.ts (PowerSearchOperator type)
|
|
20
|
+
* - /packages/core/src/PowerSearch/index.ts (re-export)
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type {TranslatorFn} from '../i18n';
|
|
24
|
+
import type {PowerSearchOperator} from './types';
|
|
25
|
+
|
|
26
|
+
export function resolveOperatorLabel(
|
|
27
|
+
operator: PowerSearchOperator,
|
|
28
|
+
t: TranslatorFn,
|
|
29
|
+
): string {
|
|
30
|
+
if ('label' in operator && operator.label !== undefined) {
|
|
31
|
+
return operator.label;
|
|
32
|
+
}
|
|
33
|
+
return t(operator.i18nKey);
|
|
34
|
+
}
|