@astryxdesign/core 0.1.5 → 0.1.6-canary.02f2602
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 +24 -0
- package/README.md +2 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +21 -18
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts +0 -2
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -5
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +55 -53
- package/dist/AspectRatio/AspectRatio.js +5 -5
- package/dist/Avatar/Avatar.js +19 -19
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +9 -6
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -30
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +11 -8
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +53 -23
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +34 -18
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +51 -48
- package/dist/Card/Card.js +3 -3
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +27 -24
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +27 -24
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +23 -16
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +20 -16
- package/dist/Chat/ChatDictationButton.js +10 -10
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +23 -21
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +13 -11
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +20 -14
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +10 -8
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +17 -15
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +24 -19
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +16 -14
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +6 -4
- package/dist/Chat/ChatSystemMessage.js +11 -11
- package/dist/Chat/ChatTokenizedText.js +8 -8
- package/dist/Chat/ChatToolCalls.js +73 -73
- 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 +19 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +26 -24
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +12 -10
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +8 -6
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +20 -12
- package/dist/ClickableCard/ClickableCard.js +6 -6
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +114 -96
- package/dist/Collapsible/Collapsible.js +11 -11
- package/dist/Collapsible/CollapsibleGroup.js +7 -7
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +39 -34
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +17 -14
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +7 -4
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +14 -11
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +28 -23
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +32 -27
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +41 -33
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +20 -18
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +21 -15
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +34 -30
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.js +3 -3
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.js +11 -11
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +9 -9
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +17 -17
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.js +5 -5
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +35 -33
- package/dist/Lightbox/useLightbox.d.ts +0 -1
- package/dist/Lightbox/useLightbox.d.ts.map +1 -1
- package/dist/Lightbox/useLightbox.js +3 -4
- package/dist/Link/Link.d.ts +5 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +47 -18
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +111 -109
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +19 -17
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +9 -6
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +7 -4
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +69 -62
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +21 -17
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +19 -16
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.d.ts +0 -3
- package/dist/Overlay/useOverlay.d.ts.map +1 -1
- package/dist/Overlay/useOverlay.js +3 -6
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +73 -46
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +11 -8
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +95 -85
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +109 -103
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +12 -8
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +88 -75
- 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/ProgressBar/ProgressBar.js +13 -13
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.js +18 -18
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -7
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.js +5 -5
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -7
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +57 -51
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +38 -36
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +8 -6
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +92 -90
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +49 -43
- package/dist/SideNav/SideNavSection.js +14 -14
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -27
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +9 -6
- package/dist/TabList/TabMenu.js +23 -23
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -37
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +10 -8
- package/dist/Table/TableBody.js +3 -3
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.js +3 -3
- package/dist/Table/TableHeader.js +3 -3
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/index.d.ts +4 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +9 -9
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +127 -90
- package/dist/Table/plugins/groupedRows/index.d.ts +3 -0
- package/dist/Table/plugins/groupedRows/index.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/index.js +3 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +78 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +257 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +12 -9
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +30 -28
- package/dist/Table/plugins/rowIndex/index.d.ts +3 -0
- package/dist/Table/plugins/rowIndex/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/index.js +3 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +50 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +91 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +23 -20
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -21
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +20 -16
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +37 -31
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +28 -23
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +29 -14
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +14 -12
- package/dist/Toast/useToast.js +4 -4
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +29 -23
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +33 -31
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +36 -33
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +72 -70
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +10 -10
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +13 -9
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +37 -31
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +26 -22
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +15 -13
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -3
- package/dist/astryx.css +20 -2
- package/dist/astryx.umd.js +66 -64
- 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/hooks/useKeyboardHint.js +9 -9
- 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 +62 -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/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/locales/en.json +746 -0
- package/locales/pseudo.json +560 -0
- package/package.json +24 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AlertDialog/useImperativeAlertDialog.tsx +0 -2
- 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.tsx +34 -4
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.tsx +8 -5
- 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.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/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +3 -3
- 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.tsx +4 -1
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +7 -7
- 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/DialogHeader.tsx +4 -2
- package/src/DropdownMenu/DropdownMenu.tsx +12 -8
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +2 -2
- package/src/FileInput/FileInput.tsx +3 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Lightbox/useLightbox.tsx +0 -1
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -3
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Overlay/useOverlay.tsx +0 -3
- 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.tsx +11 -6
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +2 -2
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/TabList.tsx +4 -1
- package/src/Table/BaseTable.tsx +8 -1
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/Table.tsx +3 -1
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/index.ts +7 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +231 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +351 -0
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +8 -4
- package/src/Table/plugins/rowIndex/index.ts +4 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.test.tsx +132 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +114 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +71 -0
- package/src/Table/useTableRowIndex.doc.mjs +50 -0
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -3
- 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 +902 -0
- package/src/hooks/useHotkeys.doc.mjs +5 -5
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +83 -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/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
|
@@ -20,7 +20,8 @@ import { TimeInput } from "../TimeInput/index.js";
|
|
|
20
20
|
import { Selector } from "../Selector/index.js";
|
|
21
21
|
import { Tokenizer } from "../Tokenizer/index.js";
|
|
22
22
|
import { Typeahead } from "../Typeahead/index.js";
|
|
23
|
-
import {
|
|
23
|
+
import { useTranslator } from "../i18n/index.js";
|
|
24
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
// =============================================================================
|
|
25
26
|
// Helpers
|
|
26
27
|
// =============================================================================
|
|
@@ -53,6 +54,7 @@ function StringEditor({
|
|
|
53
54
|
onChange,
|
|
54
55
|
onEnter: _onEnter
|
|
55
56
|
}) {
|
|
57
|
+
const t = useTranslator();
|
|
56
58
|
const currentValue = filterValue?.type === 'string' ? filterValue.value : '';
|
|
57
59
|
|
|
58
60
|
// When a searchSource is provided, render a typeahead instead of a plain
|
|
@@ -62,8 +64,8 @@ function StringEditor({
|
|
|
62
64
|
id: currentValue,
|
|
63
65
|
label: currentValue
|
|
64
66
|
} : null;
|
|
65
|
-
return /*#__PURE__*/
|
|
66
|
-
label:
|
|
67
|
+
return /*#__PURE__*/_jsx(Typeahead, {
|
|
68
|
+
label: t('@astryx.powersearch.valueEditor.value'),
|
|
67
69
|
isLabelHidden: true,
|
|
68
70
|
searchSource: operatorValue.searchSource,
|
|
69
71
|
value: selectedItem,
|
|
@@ -80,28 +82,29 @@ function StringEditor({
|
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
|
-
placeholder:
|
|
85
|
+
placeholder: t('@astryx.powersearch.valueEditor.searchPlaceholder'),
|
|
84
86
|
debounceMs: 150
|
|
85
|
-
}
|
|
87
|
+
});
|
|
86
88
|
}
|
|
87
|
-
return /*#__PURE__*/
|
|
88
|
-
label:
|
|
89
|
+
return /*#__PURE__*/_jsx(TextInput, {
|
|
90
|
+
label: t('@astryx.powersearch.valueEditor.value'),
|
|
89
91
|
isLabelHidden: true,
|
|
90
92
|
value: currentValue,
|
|
91
|
-
placeholder:
|
|
93
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterValuePlaceholder'),
|
|
92
94
|
onChange: value => {
|
|
93
95
|
onChange({
|
|
94
96
|
type: 'string',
|
|
95
97
|
value
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
|
-
}
|
|
100
|
+
});
|
|
99
101
|
}
|
|
100
102
|
function StringListEditor({
|
|
101
103
|
operatorValue,
|
|
102
104
|
filterValue,
|
|
103
105
|
onChange
|
|
104
106
|
}) {
|
|
107
|
+
const t = useTranslator();
|
|
105
108
|
const currentValue = useMemo(() => {
|
|
106
109
|
if (filterValue?.type !== 'string_list') {
|
|
107
110
|
return [];
|
|
@@ -125,8 +128,8 @@ function StringListEditor({
|
|
|
125
128
|
// Enable creatable mode when no searchSource is provided (free-text tags)
|
|
126
129
|
// or when isArbitraryStringAllowed is explicitly set (#1107).
|
|
127
130
|
const hasCreate = operatorValue.isArbitraryStringAllowed || !operatorValue.searchSource;
|
|
128
|
-
return /*#__PURE__*/
|
|
129
|
-
label:
|
|
131
|
+
return /*#__PURE__*/_jsx(Tokenizer, {
|
|
132
|
+
label: t('@astryx.powersearch.valueEditor.values'),
|
|
130
133
|
isLabelHidden: true,
|
|
131
134
|
searchSource: source,
|
|
132
135
|
value: currentValue,
|
|
@@ -136,19 +139,20 @@ function StringListEditor({
|
|
|
136
139
|
value: items.map(item => item.label)
|
|
137
140
|
});
|
|
138
141
|
},
|
|
139
|
-
placeholder:
|
|
142
|
+
placeholder: t('@astryx.powersearch.valueEditor.addValuesPlaceholder'),
|
|
140
143
|
debounceMs: operatorValue.searchSource ? 150 : 0,
|
|
141
144
|
hasCreate: hasCreate
|
|
142
|
-
}
|
|
145
|
+
});
|
|
143
146
|
}
|
|
144
147
|
function IntegerEditor({
|
|
145
148
|
operatorValue,
|
|
146
149
|
filterValue,
|
|
147
150
|
onChange
|
|
148
151
|
}) {
|
|
152
|
+
const t = useTranslator();
|
|
149
153
|
const currentValue = filterValue?.type === 'integer' ? filterValue.value : undefined;
|
|
150
|
-
return /*#__PURE__*/
|
|
151
|
-
label:
|
|
154
|
+
return /*#__PURE__*/_jsx(NumberInput, {
|
|
155
|
+
label: t('@astryx.powersearch.valueEditor.value'),
|
|
152
156
|
isLabelHidden: true,
|
|
153
157
|
value: currentValue ?? null,
|
|
154
158
|
onChange: value => {
|
|
@@ -161,17 +165,18 @@ function IntegerEditor({
|
|
|
161
165
|
max: operatorValue.maxValue,
|
|
162
166
|
units: operatorValue.units,
|
|
163
167
|
isIntegerOnly: true,
|
|
164
|
-
placeholder:
|
|
165
|
-
}
|
|
168
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
169
|
+
});
|
|
166
170
|
}
|
|
167
171
|
function FloatEditor({
|
|
168
172
|
operatorValue,
|
|
169
173
|
filterValue,
|
|
170
174
|
onChange
|
|
171
175
|
}) {
|
|
176
|
+
const t = useTranslator();
|
|
172
177
|
const currentValue = filterValue?.type === 'float' ? filterValue.value : undefined;
|
|
173
|
-
return /*#__PURE__*/
|
|
174
|
-
label:
|
|
178
|
+
return /*#__PURE__*/_jsx(NumberInput, {
|
|
179
|
+
label: t('@astryx.powersearch.valueEditor.value'),
|
|
175
180
|
isLabelHidden: true,
|
|
176
181
|
value: currentValue ?? null,
|
|
177
182
|
onChange: value => {
|
|
@@ -183,17 +188,18 @@ function FloatEditor({
|
|
|
183
188
|
min: operatorValue.minValue,
|
|
184
189
|
max: operatorValue.maxValue,
|
|
185
190
|
units: operatorValue.units,
|
|
186
|
-
placeholder:
|
|
187
|
-
}
|
|
191
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterNumberPlaceholder')
|
|
192
|
+
});
|
|
188
193
|
}
|
|
189
194
|
function TimeEditor({
|
|
190
195
|
operatorValue,
|
|
191
196
|
filterValue,
|
|
192
197
|
onChange
|
|
193
198
|
}) {
|
|
199
|
+
const t = useTranslator();
|
|
194
200
|
const currentValue = filterValue?.type === 'time' ? filterValue.value : undefined;
|
|
195
|
-
return /*#__PURE__*/
|
|
196
|
-
label:
|
|
201
|
+
return /*#__PURE__*/_jsx(TimeInput, {
|
|
202
|
+
label: t('@astryx.powersearch.valueEditor.time'),
|
|
197
203
|
isLabelHidden: true,
|
|
198
204
|
value: currentValue,
|
|
199
205
|
onChange: value => {
|
|
@@ -206,12 +212,13 @@ function TimeEditor({
|
|
|
206
212
|
},
|
|
207
213
|
min: operatorValue.minValue,
|
|
208
214
|
max: operatorValue.maxValue
|
|
209
|
-
}
|
|
215
|
+
});
|
|
210
216
|
}
|
|
211
217
|
function DateAbsoluteEditor({
|
|
212
218
|
filterValue,
|
|
213
219
|
onChange
|
|
214
220
|
}) {
|
|
221
|
+
const t = useTranslator();
|
|
215
222
|
// Convert unixSeconds to ISO date string for the date input
|
|
216
223
|
const currentValue = useMemo(() => {
|
|
217
224
|
if (filterValue?.type !== 'date_absolute') {
|
|
@@ -220,8 +227,8 @@ function DateAbsoluteEditor({
|
|
|
220
227
|
const date = new Date(filterValue.unixSeconds * 1000);
|
|
221
228
|
return date.toISOString().split('T')[0];
|
|
222
229
|
}, [filterValue]);
|
|
223
|
-
return /*#__PURE__*/
|
|
224
|
-
label:
|
|
230
|
+
return /*#__PURE__*/_jsx(DateInput, {
|
|
231
|
+
label: t('@astryx.powersearch.valueEditor.date'),
|
|
225
232
|
isLabelHidden: true,
|
|
226
233
|
value: currentValue,
|
|
227
234
|
onChange: value => {
|
|
@@ -233,13 +240,14 @@ function DateAbsoluteEditor({
|
|
|
233
240
|
});
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
|
-
}
|
|
243
|
+
});
|
|
237
244
|
}
|
|
238
245
|
function DateRelativeEditor({
|
|
239
246
|
operatorValue,
|
|
240
247
|
filterValue,
|
|
241
248
|
onChange
|
|
242
249
|
}) {
|
|
250
|
+
const t = useTranslator();
|
|
243
251
|
const currentValue = filterValue?.type === 'date_relative' ? filterValue.value : undefined;
|
|
244
252
|
const options = useMemo(() => {
|
|
245
253
|
const result = [];
|
|
@@ -275,8 +283,8 @@ function DateRelativeEditor({
|
|
|
275
283
|
}
|
|
276
284
|
return result;
|
|
277
285
|
}, [operatorValue.isPastAllowed, operatorValue.isFutureAllowed]);
|
|
278
|
-
return /*#__PURE__*/
|
|
279
|
-
label:
|
|
286
|
+
return /*#__PURE__*/_jsx(Selector, {
|
|
287
|
+
label: t('@astryx.powersearch.valueEditor.relativeDate'),
|
|
280
288
|
isLabelHidden: true,
|
|
281
289
|
options: options,
|
|
282
290
|
value: currentValue,
|
|
@@ -286,12 +294,13 @@ function DateRelativeEditor({
|
|
|
286
294
|
value
|
|
287
295
|
}, true);
|
|
288
296
|
}
|
|
289
|
-
}
|
|
297
|
+
});
|
|
290
298
|
}
|
|
291
299
|
function DateRangeEditor({
|
|
292
300
|
filterValue,
|
|
293
301
|
onChange
|
|
294
302
|
}) {
|
|
303
|
+
const t = useTranslator();
|
|
295
304
|
const startValue = useMemo(() => {
|
|
296
305
|
if (filterValue?.type !== 'date_range') {
|
|
297
306
|
return undefined;
|
|
@@ -344,32 +353,33 @@ function DateRangeEditor({
|
|
|
344
353
|
}
|
|
345
354
|
});
|
|
346
355
|
}, [filterValue, onChange]);
|
|
347
|
-
return /*#__PURE__*/
|
|
348
|
-
children: [/*#__PURE__*/
|
|
349
|
-
label:
|
|
356
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
357
|
+
children: [/*#__PURE__*/_jsx(DateInput, {
|
|
358
|
+
label: t('@astryx.powersearch.valueEditor.startDate'),
|
|
350
359
|
isLabelHidden: true,
|
|
351
360
|
value: startValue,
|
|
352
361
|
onChange: handleStartChange
|
|
353
|
-
}
|
|
354
|
-
label:
|
|
362
|
+
}), /*#__PURE__*/_jsx(DateInput, {
|
|
363
|
+
label: t('@astryx.powersearch.valueEditor.endDate'),
|
|
355
364
|
isLabelHidden: true,
|
|
356
365
|
value: endValue,
|
|
357
366
|
onChange: handleEndChange
|
|
358
|
-
}
|
|
359
|
-
}
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
360
369
|
}
|
|
361
370
|
function EnumEditor({
|
|
362
371
|
operatorValue,
|
|
363
372
|
filterValue,
|
|
364
373
|
onChange
|
|
365
374
|
}) {
|
|
375
|
+
const t = useTranslator();
|
|
366
376
|
const currentValue = filterValue?.type === 'enum' ? filterValue.value : undefined;
|
|
367
377
|
const options = useMemo(() => operatorValue.values.map(item => ({
|
|
368
378
|
value: item.value,
|
|
369
379
|
label: item.label
|
|
370
380
|
})), [operatorValue.values]);
|
|
371
|
-
return /*#__PURE__*/
|
|
372
|
-
label:
|
|
381
|
+
return /*#__PURE__*/_jsx(Selector, {
|
|
382
|
+
label: t('@astryx.powersearch.valueEditor.value'),
|
|
373
383
|
isLabelHidden: true,
|
|
374
384
|
options: options,
|
|
375
385
|
value: currentValue,
|
|
@@ -379,13 +389,14 @@ function EnumEditor({
|
|
|
379
389
|
value
|
|
380
390
|
}, true);
|
|
381
391
|
}
|
|
382
|
-
}
|
|
392
|
+
});
|
|
383
393
|
}
|
|
384
394
|
function EnumListEditor({
|
|
385
395
|
operatorValue,
|
|
386
396
|
filterValue,
|
|
387
397
|
onChange
|
|
388
398
|
}) {
|
|
399
|
+
const t = useTranslator();
|
|
389
400
|
const items = useMemo(() => enumItemsToSearchableItems(operatorValue.values), [operatorValue.values]);
|
|
390
401
|
const source = useMemo(() => createStaticSource(items), [items]);
|
|
391
402
|
const currentValue = useMemo(() => {
|
|
@@ -400,8 +411,8 @@ function EnumListEditor({
|
|
|
400
411
|
};
|
|
401
412
|
});
|
|
402
413
|
}, [filterValue, operatorValue.values]);
|
|
403
|
-
return /*#__PURE__*/
|
|
404
|
-
label:
|
|
414
|
+
return /*#__PURE__*/_jsx(Tokenizer, {
|
|
415
|
+
label: t('@astryx.powersearch.valueEditor.values'),
|
|
405
416
|
isLabelHidden: true,
|
|
406
417
|
searchSource: source,
|
|
407
418
|
value: currentValue,
|
|
@@ -411,16 +422,17 @@ function EnumListEditor({
|
|
|
411
422
|
value: selectedItems.map(item => item.id)
|
|
412
423
|
});
|
|
413
424
|
},
|
|
414
|
-
placeholder:
|
|
425
|
+
placeholder: t('@astryx.powersearch.valueEditor.selectValuesPlaceholder'),
|
|
415
426
|
hasEntriesOnFocus: true,
|
|
416
427
|
debounceMs: 0
|
|
417
|
-
}
|
|
428
|
+
});
|
|
418
429
|
}
|
|
419
430
|
function EntityListEditor({
|
|
420
431
|
operatorValue,
|
|
421
432
|
filterValue,
|
|
422
433
|
onChange
|
|
423
434
|
}) {
|
|
435
|
+
const t = useTranslator();
|
|
424
436
|
const source = useMemo(() => {
|
|
425
437
|
if (operatorValue.searchSource) {
|
|
426
438
|
return operatorValue.searchSource;
|
|
@@ -444,8 +456,8 @@ function EntityListEditor({
|
|
|
444
456
|
} : undefined
|
|
445
457
|
}));
|
|
446
458
|
}, [filterValue]);
|
|
447
|
-
return /*#__PURE__*/
|
|
448
|
-
label:
|
|
459
|
+
return /*#__PURE__*/_jsx(Tokenizer, {
|
|
460
|
+
label: t('@astryx.powersearch.valueEditor.entities'),
|
|
449
461
|
isLabelHidden: true,
|
|
450
462
|
searchSource: source,
|
|
451
463
|
value: currentValue,
|
|
@@ -466,9 +478,9 @@ function EntityListEditor({
|
|
|
466
478
|
});
|
|
467
479
|
},
|
|
468
480
|
renderItem: operatorValue.renderItem,
|
|
469
|
-
placeholder:
|
|
481
|
+
placeholder: t('@astryx.powersearch.valueEditor.searchPlaceholder'),
|
|
470
482
|
debounceMs: operatorValue.searchSource ? 150 : 0
|
|
471
|
-
}
|
|
483
|
+
});
|
|
472
484
|
}
|
|
473
485
|
function CustomEditor({
|
|
474
486
|
operatorValue,
|
|
@@ -476,9 +488,10 @@ function CustomEditor({
|
|
|
476
488
|
onChange,
|
|
477
489
|
isDisabled
|
|
478
490
|
}) {
|
|
491
|
+
const t = useTranslator();
|
|
479
492
|
const currentValue = filterValue?.type === 'custom' ? filterValue.value : null;
|
|
480
493
|
const EditorComponent = operatorValue.Editor;
|
|
481
|
-
return /*#__PURE__*/
|
|
494
|
+
return /*#__PURE__*/_jsx(EditorComponent, {
|
|
482
495
|
isDisabled: isDisabled,
|
|
483
496
|
onChange: value => {
|
|
484
497
|
if (value != null) {
|
|
@@ -488,9 +501,9 @@ function CustomEditor({
|
|
|
488
501
|
});
|
|
489
502
|
}
|
|
490
503
|
},
|
|
491
|
-
placeholder:
|
|
504
|
+
placeholder: t('@astryx.powersearch.valueEditor.enterValuePlaceholder'),
|
|
492
505
|
value: currentValue
|
|
493
|
-
}
|
|
506
|
+
});
|
|
494
507
|
}
|
|
495
508
|
|
|
496
509
|
// =============================================================================
|
|
@@ -508,79 +521,79 @@ export function PowerSearchValueEditor({
|
|
|
508
521
|
case 'empty':
|
|
509
522
|
return null;
|
|
510
523
|
case 'string':
|
|
511
|
-
return /*#__PURE__*/
|
|
524
|
+
return /*#__PURE__*/_jsx(StringEditor, {
|
|
512
525
|
operatorValue: operatorValue,
|
|
513
526
|
filterValue: filterValue,
|
|
514
527
|
onChange: onChange,
|
|
515
528
|
onEnter: onEnter
|
|
516
|
-
}
|
|
529
|
+
});
|
|
517
530
|
case 'string_list':
|
|
518
|
-
return /*#__PURE__*/
|
|
531
|
+
return /*#__PURE__*/_jsx(StringListEditor, {
|
|
519
532
|
operatorValue: operatorValue,
|
|
520
533
|
filterValue: filterValue,
|
|
521
534
|
onChange: onChange
|
|
522
|
-
}
|
|
535
|
+
});
|
|
523
536
|
case 'integer':
|
|
524
|
-
return /*#__PURE__*/
|
|
537
|
+
return /*#__PURE__*/_jsx(IntegerEditor, {
|
|
525
538
|
operatorValue: operatorValue,
|
|
526
539
|
filterValue: filterValue,
|
|
527
540
|
onChange: onChange
|
|
528
|
-
}
|
|
541
|
+
});
|
|
529
542
|
case 'float':
|
|
530
|
-
return /*#__PURE__*/
|
|
543
|
+
return /*#__PURE__*/_jsx(FloatEditor, {
|
|
531
544
|
operatorValue: operatorValue,
|
|
532
545
|
filterValue: filterValue,
|
|
533
546
|
onChange: onChange
|
|
534
|
-
}
|
|
547
|
+
});
|
|
535
548
|
case 'time':
|
|
536
|
-
return /*#__PURE__*/
|
|
549
|
+
return /*#__PURE__*/_jsx(TimeEditor, {
|
|
537
550
|
operatorValue: operatorValue,
|
|
538
551
|
filterValue: filterValue,
|
|
539
552
|
onChange: onChange
|
|
540
|
-
}
|
|
553
|
+
});
|
|
541
554
|
case 'date_absolute':
|
|
542
|
-
return /*#__PURE__*/
|
|
555
|
+
return /*#__PURE__*/_jsx(DateAbsoluteEditor, {
|
|
543
556
|
operatorValue: operatorValue,
|
|
544
557
|
filterValue: filterValue,
|
|
545
558
|
onChange: onChange
|
|
546
|
-
}
|
|
559
|
+
});
|
|
547
560
|
case 'date_relative':
|
|
548
|
-
return /*#__PURE__*/
|
|
561
|
+
return /*#__PURE__*/_jsx(DateRelativeEditor, {
|
|
549
562
|
operatorValue: operatorValue,
|
|
550
563
|
filterValue: filterValue,
|
|
551
564
|
onChange: onChange
|
|
552
|
-
}
|
|
565
|
+
});
|
|
553
566
|
case 'date_range':
|
|
554
|
-
return /*#__PURE__*/
|
|
567
|
+
return /*#__PURE__*/_jsx(DateRangeEditor, {
|
|
555
568
|
operatorValue: operatorValue,
|
|
556
569
|
filterValue: filterValue,
|
|
557
570
|
onChange: onChange
|
|
558
|
-
}
|
|
571
|
+
});
|
|
559
572
|
case 'enum':
|
|
560
|
-
return /*#__PURE__*/
|
|
573
|
+
return /*#__PURE__*/_jsx(EnumEditor, {
|
|
561
574
|
operatorValue: operatorValue,
|
|
562
575
|
filterValue: filterValue,
|
|
563
576
|
onChange: onChange
|
|
564
|
-
}
|
|
577
|
+
});
|
|
565
578
|
case 'enum_list':
|
|
566
|
-
return /*#__PURE__*/
|
|
579
|
+
return /*#__PURE__*/_jsx(EnumListEditor, {
|
|
567
580
|
operatorValue: operatorValue,
|
|
568
581
|
filterValue: filterValue,
|
|
569
582
|
onChange: onChange
|
|
570
|
-
}
|
|
583
|
+
});
|
|
571
584
|
case 'entity_list':
|
|
572
|
-
return /*#__PURE__*/
|
|
585
|
+
return /*#__PURE__*/_jsx(EntityListEditor, {
|
|
573
586
|
operatorValue: operatorValue,
|
|
574
587
|
filterValue: filterValue,
|
|
575
588
|
onChange: onChange
|
|
576
|
-
}
|
|
589
|
+
});
|
|
577
590
|
case 'custom':
|
|
578
|
-
return /*#__PURE__*/
|
|
591
|
+
return /*#__PURE__*/_jsx(CustomEditor, {
|
|
579
592
|
operatorValue: operatorValue,
|
|
580
593
|
filterValue: filterValue,
|
|
581
594
|
onChange: onChange,
|
|
582
595
|
isDisabled: isDisabled
|
|
583
|
-
}
|
|
596
|
+
});
|
|
584
597
|
case 'nested':
|
|
585
598
|
// Nested filters are complex — simplified v1 just shows a message
|
|
586
599
|
return null;
|
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { OperatorValue, FilterValue } from './types';
|
|
11
11
|
import type { InternalConfig } from './useInternalConfig';
|
|
12
|
-
|
|
12
|
+
import type { TranslatorFn } from '../i18n';
|
|
13
|
+
export declare function formatFilterValue(_config: InternalConfig, operatorValue: OperatorValue, filterValue: FilterValue, maxLength: number, t: TranslatorFn, timezoneID?: string): string;
|
|
13
14
|
//# sourceMappingURL=formatFilterValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatFilterValue.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/formatFilterValue.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,WAAW,EAAW,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"formatFilterValue.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/formatFilterValue.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,WAAW,EAAW,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AA8C1C,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,YAAY,EACf,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAsHR"}
|
|
@@ -41,10 +41,10 @@ function formatRelativeDate(value) {
|
|
|
41
41
|
// value is stored as a descriptive string like "7d" or "1w"
|
|
42
42
|
return value;
|
|
43
43
|
}
|
|
44
|
-
function formatDateRange(_value) {
|
|
45
|
-
return '
|
|
44
|
+
function formatDateRange(_value, t) {
|
|
45
|
+
return t('@astryx.powersearch.valueEditor.dateRange');
|
|
46
46
|
}
|
|
47
|
-
export function formatFilterValue(_config, operatorValue, filterValue, maxLength, timezoneID) {
|
|
47
|
+
export function formatFilterValue(_config, operatorValue, filterValue, maxLength, t, timezoneID) {
|
|
48
48
|
switch (filterValue.type) {
|
|
49
49
|
case 'empty':
|
|
50
50
|
return '';
|
|
@@ -72,7 +72,9 @@ export function formatFilterValue(_config, operatorValue, filterValue, maxLength
|
|
|
72
72
|
if (joined.length <= maxLength) {
|
|
73
73
|
return joined;
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
76
|
+
count: items.length
|
|
77
|
+
});
|
|
76
78
|
}
|
|
77
79
|
case 'enum_list':
|
|
78
80
|
{
|
|
@@ -89,12 +91,16 @@ export function formatFilterValue(_config, operatorValue, filterValue, maxLength
|
|
|
89
91
|
if (joined.length <= maxLength) {
|
|
90
92
|
return joined;
|
|
91
93
|
}
|
|
92
|
-
return
|
|
94
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
95
|
+
count: labels.length
|
|
96
|
+
});
|
|
93
97
|
}
|
|
94
98
|
if (items.length === 1) {
|
|
95
99
|
return truncate(items[0], maxLength);
|
|
96
100
|
}
|
|
97
|
-
return
|
|
101
|
+
return t('@astryx.powersearch.valueEditor.itemsCount', {
|
|
102
|
+
count: items.length
|
|
103
|
+
});
|
|
98
104
|
}
|
|
99
105
|
case 'entity_list':
|
|
100
106
|
{
|
|
@@ -109,7 +115,9 @@ export function formatFilterValue(_config, operatorValue, filterValue, maxLength
|
|
|
109
115
|
if (joined.length <= maxLength) {
|
|
110
116
|
return joined;
|
|
111
117
|
}
|
|
112
|
-
return
|
|
118
|
+
return t('@astryx.powersearch.valueEditor.entitiesCount', {
|
|
119
|
+
count: entities.length
|
|
120
|
+
});
|
|
113
121
|
}
|
|
114
122
|
case 'time':
|
|
115
123
|
return filterValue.value;
|
|
@@ -118,7 +126,7 @@ export function formatFilterValue(_config, operatorValue, filterValue, maxLength
|
|
|
118
126
|
case 'date_relative':
|
|
119
127
|
return formatRelativeDate(filterValue.value);
|
|
120
128
|
case 'date_range':
|
|
121
|
-
return formatDateRange(filterValue.value);
|
|
129
|
+
return formatDateRange(filterValue.value, t);
|
|
122
130
|
case 'custom':
|
|
123
131
|
if (operatorValue.type === 'custom') {
|
|
124
132
|
return truncate(operatorValue.getString(filterValue.value), maxLength);
|
|
@@ -127,7 +135,9 @@ export function formatFilterValue(_config, operatorValue, filterValue, maxLength
|
|
|
127
135
|
case 'nested':
|
|
128
136
|
{
|
|
129
137
|
const count = filterValue.value.length;
|
|
130
|
-
return
|
|
138
|
+
return t('@astryx.powersearch.valueEditor.filtersCount', {
|
|
139
|
+
count
|
|
140
|
+
});
|
|
131
141
|
}
|
|
132
142
|
default:
|
|
133
143
|
return '';
|
|
@@ -10,7 +10,8 @@ export { PowerSearch } from './PowerSearch';
|
|
|
10
10
|
export type { PowerSearchProps, PowerSearchSize } from './PowerSearch';
|
|
11
11
|
export { PowerSearchToken } from './PowerSearchToken';
|
|
12
12
|
export { PowerSearchFilterEditor } from './PowerSearchFilterEditor';
|
|
13
|
+
export { resolveOperatorLabel } from './resolveOperatorLabel';
|
|
13
14
|
export { createPowerSearchConfig, usePowerSearchConfig, } from './usePowerSearchConfig';
|
|
14
15
|
export type { FieldDefinition, InferData } from './usePowerSearchConfig';
|
|
15
|
-
export type { PowerSearchConfig, PowerSearchField, PowerSearchOperator, OperatorValue, EmptyOperatorValue, StringOperatorValue, StringListOperatorValue, IntegerOperatorValue, FloatOperatorValue, TimeOperatorValue, DateAbsoluteOperatorValue, DateRelativeOperatorValue, DateRangeOperatorValue, EnumOperatorValue, EnumListOperatorValue, EntityListOperatorValue, CustomOperatorValue, NestedOperatorValue, FilterValue, FilterValueEmpty, FilterValueString, FilterValueStringList, FilterValueInteger, FilterValueFloat, FilterValueTime, FilterValueDateAbsolute, FilterValueDateRelative, FilterValueDateRange, FilterValueEnum, FilterValueEnumList, FilterValueEntityList, FilterValueCustom, FilterValueNested, PowerSearchFilter, PartialFilter, EnumItem, PowerSearchEntity, DateTimeRange, DateTimeRangePart, DateRangeFilterPreset, RelativeDateFilterPreset, OperatorTokenizationConfig, PowerSearchChangeType, PowerSearchHandle, PowerSearchTokenProps, PowerSearchEditorProps, PowerSearchComponentOverride, PowerSearchComponents, } from './types';
|
|
16
|
+
export type { PowerSearchConfig, PowerSearchField, PowerSearchOperator, PowerSearchOperatorBase, PowerSearchOperatorWithLabel, PowerSearchOperatorWithI18nKey, OperatorValue, EmptyOperatorValue, StringOperatorValue, StringListOperatorValue, IntegerOperatorValue, FloatOperatorValue, TimeOperatorValue, DateAbsoluteOperatorValue, DateRelativeOperatorValue, DateRangeOperatorValue, EnumOperatorValue, EnumListOperatorValue, EntityListOperatorValue, CustomOperatorValue, NestedOperatorValue, FilterValue, FilterValueEmpty, FilterValueString, FilterValueStringList, FilterValueInteger, FilterValueFloat, FilterValueTime, FilterValueDateAbsolute, FilterValueDateRelative, FilterValueDateRange, FilterValueEnum, FilterValueEnumList, FilterValueEntityList, FilterValueCustom, FilterValueNested, PowerSearchFilter, PartialFilter, EnumItem, PowerSearchEntity, DateTimeRange, DateTimeRangePart, DateRangeFilterPreset, RelativeDateFilterPreset, OperatorTokenizationConfig, PowerSearchChangeType, PowerSearchHandle, PowerSearchTokenProps, PowerSearchEditorProps, PowerSearchComponentOverride, PowerSearchComponents, } from './types';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAElE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEvE,YAAY,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEvE,YAAY,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAG9B,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EAGnB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAGjB,iBAAiB,EACjB,aAAa,EAGb,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EAGjB,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
|
|
@@ -13,4 +13,5 @@
|
|
|
13
13
|
export { PowerSearch } from "./PowerSearch.js";
|
|
14
14
|
export { PowerSearchToken } from "./PowerSearchToken.js";
|
|
15
15
|
export { PowerSearchFilterEditor } from "./PowerSearchFilterEditor.js";
|
|
16
|
+
export { resolveOperatorLabel } from "./resolveOperatorLabel.js";
|
|
16
17
|
export { createPowerSearchConfig, usePowerSearchConfig } from "./usePowerSearchConfig.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file resolveOperatorLabel.ts
|
|
3
|
+
* @input PowerSearchOperator + translator function
|
|
4
|
+
* @output Display string for the operator label
|
|
5
|
+
* @position Shared label-resolution helper used at every render site that
|
|
6
|
+
* reads an operator's display text (PowerSearch.tsx, PowerSearchToken.tsx,
|
|
7
|
+
* PowerSearchEditPopover.tsx, usePowerSearchSource.ts).
|
|
8
|
+
*
|
|
9
|
+
* A PowerSearchOperator is a discriminated union of two variants:
|
|
10
|
+
* - `{key, value, label}` — consumer-supplied raw text (used verbatim)
|
|
11
|
+
* - `{key, value, i18nKey}` — catalog-driven text (looked up via t())
|
|
12
|
+
*
|
|
13
|
+
* Astryx's shipped default operators use the i18nKey variant; consumers
|
|
14
|
+
* writing custom operators typically use the label variant.
|
|
15
|
+
*
|
|
16
|
+
* SYNC: When modified, update:
|
|
17
|
+
* - /packages/core/src/PowerSearch/types.ts (PowerSearchOperator type)
|
|
18
|
+
* - /packages/core/src/PowerSearch/index.ts (re-export)
|
|
19
|
+
*/
|
|
20
|
+
import type { TranslatorFn } from '../i18n';
|
|
21
|
+
import type { PowerSearchOperator } from './types';
|
|
22
|
+
export declare function resolveOperatorLabel(operator: PowerSearchOperator, t: TranslatorFn): string;
|
|
23
|
+
//# sourceMappingURL=resolveOperatorLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOperatorLabel.d.ts","sourceRoot":"","sources":["../../src/PowerSearch/resolveOperatorLabel.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAEjD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,CAAC,EAAE,YAAY,GACd,MAAM,CAKR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
export function resolveOperatorLabel(operator, t) {
|
|
24
|
+
if ('label' in operator && operator.label !== undefined) {
|
|
25
|
+
return operator.label;
|
|
26
|
+
}
|
|
27
|
+
return t(operator.i18nKey);
|
|
28
|
+
}
|
|
@@ -195,11 +195,37 @@ export interface RelativeDateFilterPreset {
|
|
|
195
195
|
readonly label: string;
|
|
196
196
|
readonly value: string;
|
|
197
197
|
}
|
|
198
|
-
export interface
|
|
198
|
+
export interface PowerSearchOperatorBase {
|
|
199
199
|
readonly key: string;
|
|
200
|
-
readonly label: string;
|
|
201
200
|
readonly value: OperatorValue;
|
|
202
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Operator variant that provides its label as raw text. The consumer owns
|
|
204
|
+
* translation of that string. Use this for genuinely custom operator labels
|
|
205
|
+
* that don't correspond to an entry in astryx's shipped translation catalog
|
|
206
|
+
* (e.g. `label: 'in my rotations'`).
|
|
207
|
+
*/
|
|
208
|
+
export interface PowerSearchOperatorWithLabel extends PowerSearchOperatorBase {
|
|
209
|
+
readonly label: string;
|
|
210
|
+
readonly i18nKey?: never;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Operator variant that references a translation-catalog key. The library
|
|
214
|
+
* looks the key up against the active InternationalizationProvider locale.
|
|
215
|
+
* Use `@astryx.powersearch.operator.*` for astryx's shipped defaults, or a
|
|
216
|
+
* key from your own catalog registered via InternationalizationProvider
|
|
217
|
+
* `messages` / `overrides` props.
|
|
218
|
+
*/
|
|
219
|
+
export interface PowerSearchOperatorWithI18nKey extends PowerSearchOperatorBase {
|
|
220
|
+
readonly i18nKey: string;
|
|
221
|
+
readonly label?: never;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A discriminated union: an operator must supply EXACTLY ONE of `label`
|
|
225
|
+
* (raw text) or `i18nKey` (catalog lookup). The type system prevents
|
|
226
|
+
* accidental omission — a bare `{key, value}` is a compile error.
|
|
227
|
+
*/
|
|
228
|
+
export type PowerSearchOperator = PowerSearchOperatorWithLabel | PowerSearchOperatorWithI18nKey;
|
|
203
229
|
export interface PowerSearchField {
|
|
204
230
|
readonly key: string;
|
|
205
231
|
readonly label: string;
|