@astryxdesign/core 0.1.6-canary.1b61ba6 → 0.1.6-canary.1d64659
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/README.md +0 -2
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +1 -4
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +1 -3
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +1 -4
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +6 -8
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -4
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +4 -34
- package/dist/ButtonGroup/ButtonGroup.d.ts +5 -20
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +11 -27
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +5 -8
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +5 -8
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +1 -4
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +2 -9
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +2 -6
- package/dist/Chat/ChatLayout.d.ts +11 -1
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +4 -6
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +2 -4
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +2 -8
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +1 -3
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +1 -3
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +8 -13
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +1 -3
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +1 -3
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts +1 -12
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +6 -43
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +2 -4
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -4
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +1 -3
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +1 -3
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +2 -10
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +2 -4
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +3 -8
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +1 -4
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +1 -4
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +1 -4
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +5 -10
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +6 -11
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +7 -15
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -15
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +3 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +5 -11
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +1 -11
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -6
- package/dist/Link/Link.d.ts +1 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -4
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +8 -10
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +2 -4
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +1 -4
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +1 -4
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -13
- package/dist/NavItem/index.d.ts +9 -0
- package/dist/NavItem/index.d.ts.map +1 -0
- package/dist/NavItem/index.js +10 -0
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +1 -5
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +1 -4
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +11 -38
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +1 -4
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +12 -22
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +20 -26
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -7
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +21 -34
- package/dist/PowerSearch/formatFilterValue.d.ts +1 -2
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +9 -19
- package/dist/PowerSearch/index.d.ts +1 -2
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +0 -1
- package/dist/PowerSearch/types.d.ts +2 -28
- 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 +8 -15
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +1 -4
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +5 -11
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +2 -4
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +1 -3
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +3 -5
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -7
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +1 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +16 -29
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -5
- 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 +19 -56
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +4 -11
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +3 -6
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +6 -8
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +2 -5
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +4 -6
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -2
- package/dist/Table/types.d.ts +10 -17
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +1 -5
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +2 -8
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +2 -7
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +1 -3
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +1 -3
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +2 -8
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +1 -3
- package/dist/TopNav/TopNav.d.ts +1 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +1 -4
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +3 -5
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +1 -5
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +1 -7
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +4 -8
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +1 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +0 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +0 -1
- package/dist/astryx.css +1 -3
- package/dist/astryx.umd.js +60 -62
- package/dist/astryx.umd.js.map +4 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/package.json +2 -23
- package/src/AlertDialog/AlertDialog.tsx +1 -4
- package/src/AppShell/AppShell.doc.mjs +2 -8
- package/src/AppShell/AppShell.tsx +1 -3
- package/src/AvatarGroup/AvatarGroup.tsx +1 -4
- package/src/Banner/Banner.tsx +5 -10
- package/src/Breadcrumbs/Breadcrumbs.tsx +1 -4
- package/src/Button/Button.tsx +4 -34
- package/src/ButtonGroup/ButtonGroup.test.tsx +2 -386
- package/src/ButtonGroup/ButtonGroup.tsx +11 -27
- package/src/Calendar/Calendar.tsx +5 -8
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +7 -10
- package/src/Chat/ChatComposer.tsx +1 -5
- package/src/Chat/ChatComposerDrawer.tsx +2 -9
- package/src/Chat/ChatComposerInput.tsx +4 -10
- package/src/Chat/ChatLayout.test.tsx +2 -127
- package/src/Chat/ChatLayout.tsx +12 -5
- package/src/Chat/ChatLayoutScrollButton.tsx +2 -4
- package/src/Chat/ChatMessage.tsx +1 -5
- package/src/Chat/ChatMessageBubble.tsx +0 -2
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +0 -2
- package/src/Chat/ChatMessageMetadata.tsx +9 -15
- package/src/Chat/ChatPastedTextToken.tsx +1 -3
- package/src/Chat/ChatSendButton.tsx +1 -3
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/index.ts +0 -1
- package/src/Chat/useChatStreamScroll.ts +11 -67
- package/src/Chat/useSpeechRecognition.ts +2 -11
- package/src/Chat/useTriggerMenu.tsx +2 -4
- package/src/CheckboxList/CheckboxList.doc.mjs +1 -1
- package/src/CheckboxList/CheckboxList.tsx +0 -2
- package/src/CheckboxList/CheckboxListItem.tsx +1 -7
- package/src/Citation/Citation.tsx +2 -4
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +2 -4
- package/src/CommandPalette/CommandPalette.tsx +3 -10
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +1 -5
- package/src/CommandPalette/CommandPaletteList.tsx +1 -4
- package/src/ContextMenu/ContextMenu.tsx +1 -4
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.tsx +5 -13
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +6 -14
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +7 -17
- package/src/Dialog/Dialog.tsx +15 -11
- package/src/Dialog/DialogHeader.tsx +3 -7
- package/src/DropdownMenu/DropdownMenu.tsx +8 -12
- package/src/Field/Field.doc.mjs +2 -2
- package/src/FileInput/FileInput.test.tsx +1 -40
- package/src/FileInput/FileInput.tsx +1 -12
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Lightbox/Lightbox.doc.mjs +2 -7
- package/src/Lightbox/Lightbox.tsx +4 -6
- package/src/Link/Link.tsx +1 -4
- package/src/Markdown/Markdown.tsx +4 -12
- package/src/MobileNav/MobileNav.tsx +2 -4
- package/src/MobileNav/MobileNavToggle.tsx +3 -5
- package/src/MoreMenu/MoreMenu.tsx +1 -4
- package/src/MultiSelector/MultiSelector.tsx +5 -14
- package/src/NavItem/index.ts +11 -0
- package/src/NumberInput/NumberInput.tsx +1 -3
- package/src/Outline/Outline.tsx +1 -4
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +12 -35
- package/src/Popover/usePopover.tsx +1 -6
- package/src/PowerSearch/PowerSearch.doc.mjs +4 -4
- package/src/PowerSearch/PowerSearch.tsx +10 -22
- package/src/PowerSearch/PowerSearchEditPopover.tsx +20 -27
- package/src/PowerSearch/PowerSearchToken.tsx +6 -17
- package/src/PowerSearch/PowerSearchValueEditor.tsx +21 -34
- package/src/PowerSearch/formatFilterValue.ts +8 -21
- package/src/PowerSearch/index.ts +0 -5
- package/src/PowerSearch/types.ts +9 -33
- package/src/PowerSearch/usePowerSearchConfig.ts +27 -59
- package/src/PowerSearch/usePowerSearchSource.ts +8 -17
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +1 -4
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.tsx +6 -11
- package/src/SideNav/SideNav.tsx +2 -4
- package/src/SideNav/SideNavCollapseButton.tsx +1 -3
- package/src/SideNav/SideNavHeading.tsx +3 -5
- package/src/SideNav/SideNavItem.tsx +1 -3
- 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/TabList/TabList.tsx +1 -4
- package/src/Table/BaseTable.tsx +19 -36
- package/src/Table/Table.test.tsx +1 -132
- package/src/Table/Table.tsx +4 -6
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +30 -31
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +4 -6
- package/src/Table/plugins/pagination/useTablePagination.tsx +1 -4
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +8 -9
- package/src/Table/plugins/selection/useTableSelection.tsx +7 -6
- package/src/Table/plugins/sortable/useTableSortable.tsx +5 -8
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +4 -4
- package/src/Table/types.ts +12 -18
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextInput/TextInput.tsx +1 -3
- package/src/Thumbnail/Thumbnail.tsx +2 -4
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +2 -6
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Toast/Toast.tsx +1 -3
- package/src/Toast/ToastViewport.tsx +1 -3
- package/src/Token/Token.tsx +2 -4
- 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.tsx +1 -4
- package/src/TopNav/TopNavHeading.tsx +3 -5
- package/src/TreeList/TreeList.tsx +1 -5
- package/src/TreeList/TreeListItem.tsx +1 -6
- package/src/Typeahead/BaseTypeahead.tsx +4 -11
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +1 -3
- package/src/VisuallyHidden/VisuallyHidden.tsx +0 -1
- package/src/index.ts +0 -3
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +0 -23
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +0 -1
- package/dist/PowerSearch/resolveOperatorLabel.js +0 -28
- package/dist/authoring/doc.d.ts +0 -145
- package/dist/authoring/doc.d.ts.map +0 -1
- package/dist/authoring/doc.js +0 -100
- package/dist/authoring/index.d.ts +0 -29
- package/dist/authoring/index.d.ts.map +0 -1
- package/dist/authoring/index.js +0 -28
- package/dist/authoring/integration.d.ts +0 -35
- package/dist/authoring/integration.d.ts.map +0 -1
- package/dist/authoring/integration.js +0 -30
- package/dist/authoring/template.d.ts +0 -66
- package/dist/authoring/template.d.ts.map +0 -1
- package/dist/authoring/template.js +0 -55
- package/dist/config.d.ts +0 -80
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -40
- package/dist/i18n/InternationalizationContext.d.ts +0 -12
- package/dist/i18n/InternationalizationContext.d.ts.map +0 -1
- package/dist/i18n/InternationalizationContext.js +0 -29
- package/dist/i18n/InternationalizationProvider.d.ts +0 -62
- package/dist/i18n/InternationalizationProvider.d.ts.map +0 -1
- package/dist/i18n/InternationalizationProvider.js +0 -44
- package/dist/i18n/index.d.ts +0 -24
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/index.js +0 -21
- package/dist/i18n/resolve.d.ts +0 -22
- package/dist/i18n/resolve.d.ts.map +0 -1
- package/dist/i18n/resolve.js +0 -141
- package/dist/i18n/translator.d.ts +0 -25
- package/dist/i18n/translator.d.ts.map +0 -1
- package/dist/i18n/translator.js +0 -1
- package/dist/i18n/types.d.ts +0 -47
- package/dist/i18n/types.d.ts.map +0 -1
- package/dist/i18n/types.js +0 -1
- package/dist/i18n/useTranslator.d.ts +0 -15
- package/dist/i18n/useTranslator.d.ts.map +0 -1
- package/dist/i18n/useTranslator.js +0 -39
- package/locales/en.json +0 -746
- package/locales/pseudo.json +0 -560
- package/src/Chat/useChatStreamScroll.test.tsx +0 -168
- package/src/PowerSearch/formatFilterValue.test.ts +0 -282
- package/src/PowerSearch/resolveOperatorLabel.ts +0 -34
- package/src/authoring/doc.ts +0 -166
- package/src/authoring/index.test.ts +0 -52
- package/src/authoring/index.ts +0 -50
- package/src/authoring/integration.ts +0 -42
- package/src/authoring/template.ts +0 -74
- package/src/config.test.ts +0 -16
- package/src/config.ts +0 -92
- package/src/docPropLiterals.test.ts +0 -938
- package/src/i18n/InternationalizationContext.ts +0 -39
- package/src/i18n/InternationalizationProvider.doc.mjs +0 -72
- package/src/i18n/InternationalizationProvider.tsx +0 -83
- package/src/i18n/__tests__/e2e-pagination.test.tsx +0 -172
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +0 -130
- package/src/i18n/__tests__/resolve.test.ts +0 -284
- package/src/i18n/index.ts +0 -32
- package/src/i18n/resolve.ts +0 -165
- package/src/i18n/translator.ts +0 -31
- package/src/i18n/types.ts +0 -53
- package/src/i18n/useTranslator.doc.mjs +0 -46
- package/src/i18n/useTranslator.ts +0 -50
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
|
|
4
|
-
import {act, render} from '@testing-library/react';
|
|
5
|
-
import {useRef} from 'react';
|
|
6
|
-
import {
|
|
7
|
-
useChatStreamScroll,
|
|
8
|
-
type UseChatStreamScrollOptions,
|
|
9
|
-
type UseChatStreamScrollReturn,
|
|
10
|
-
} from './useChatStreamScroll';
|
|
11
|
-
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// Test infrastructure
|
|
14
|
-
//
|
|
15
|
-
// jsdom has no layout engine, so these tests cover only the SYNCHRONOUS
|
|
16
|
-
// scroll paths (instant positioning, lock state, rAF scheduling decisions).
|
|
17
|
-
// The spring physics itself (frame-by-frame integration, scrollend re-lock,
|
|
18
|
-
// user-scroll detection) is layout/browser-dependent and is verified
|
|
19
|
-
// manually via Storybook — mocking it here would only test the mock.
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
let rafQueue: FrameRequestCallback[] = [];
|
|
23
|
-
|
|
24
|
-
function flushRaf() {
|
|
25
|
-
// One flush = one frame: callbacks scheduled during a flush run next flush.
|
|
26
|
-
const frame = rafQueue;
|
|
27
|
-
rafQueue = [];
|
|
28
|
-
act(() => {
|
|
29
|
-
for (const cb of frame) {
|
|
30
|
-
cb(performance.now());
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
rafQueue = [];
|
|
37
|
-
vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => {
|
|
38
|
-
rafQueue.push(cb);
|
|
39
|
-
return rafQueue.length;
|
|
40
|
-
});
|
|
41
|
-
vi.stubGlobal('cancelAnimationFrame', () => {});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
afterEach(() => {
|
|
45
|
-
vi.unstubAllGlobals();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
function setGeometry(
|
|
49
|
-
el: HTMLElement,
|
|
50
|
-
{scrollHeight, clientHeight}: {scrollHeight: number; clientHeight: number},
|
|
51
|
-
) {
|
|
52
|
-
Object.defineProperty(el, 'scrollHeight', {
|
|
53
|
-
value: scrollHeight,
|
|
54
|
-
configurable: true,
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(el, 'clientHeight', {
|
|
57
|
-
value: clientHeight,
|
|
58
|
-
configurable: true,
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(el, 'offsetHeight', {
|
|
61
|
-
value: clientHeight,
|
|
62
|
-
configurable: true,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function Harness({
|
|
67
|
-
options,
|
|
68
|
-
api,
|
|
69
|
-
}: {
|
|
70
|
-
options?: Partial<UseChatStreamScrollOptions>;
|
|
71
|
-
api: {current: UseChatStreamScrollReturn | null};
|
|
72
|
-
}) {
|
|
73
|
-
const scrollRef = useRef<HTMLDivElement>(null);
|
|
74
|
-
api.current = useChatStreamScroll({scrollRef, ...options});
|
|
75
|
-
return <div ref={scrollRef} data-testid="scroller" />;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function renderHook(options?: Partial<UseChatStreamScrollOptions>) {
|
|
79
|
-
const api: {current: UseChatStreamScrollReturn | null} = {current: null};
|
|
80
|
-
const utils = render(<Harness options={options} api={api} />);
|
|
81
|
-
const el = utils.getByTestId('scroller');
|
|
82
|
-
return {api, el, ...utils};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
describe('useChatStreamScroll — initial positioning', () => {
|
|
86
|
-
it('default: jumps to the bottom on mount when content is scrollable', () => {
|
|
87
|
-
const {el} = renderHook();
|
|
88
|
-
setGeometry(el, {scrollHeight: 1000, clientHeight: 400});
|
|
89
|
-
flushRaf();
|
|
90
|
-
expect(el.scrollTop).toBe(600);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('positions the first async fill in one synchronous step', () => {
|
|
94
|
-
const {api, el} = renderHook();
|
|
95
|
-
// Mount while loading — nothing scrollable yet.
|
|
96
|
-
setGeometry(el, {scrollHeight: 400, clientHeight: 400});
|
|
97
|
-
flushRaf();
|
|
98
|
-
expect(el.scrollTop).toBe(0);
|
|
99
|
-
|
|
100
|
-
// Async content lands; the layout's ResizeObserver calls scrollIfLocked.
|
|
101
|
-
setGeometry(el, {scrollHeight: 1200, clientHeight: 400});
|
|
102
|
-
act(() => api.current!.scrollIfLocked());
|
|
103
|
-
// Positioned synchronously — no animation frames needed.
|
|
104
|
-
expect(el.scrollTop).toBe(800);
|
|
105
|
-
|
|
106
|
-
// Subsequent growth (streaming) goes back to the spring: nothing moves
|
|
107
|
-
// until animation frames run.
|
|
108
|
-
setGeometry(el, {scrollHeight: 1600, clientHeight: 400});
|
|
109
|
-
act(() => api.current!.scrollIfLocked());
|
|
110
|
-
expect(el.scrollTop).toBe(800);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('consumes the pending first fill via the mount jump too', () => {
|
|
114
|
-
const {api, el} = renderHook();
|
|
115
|
-
// Content already present at mount.
|
|
116
|
-
setGeometry(el, {scrollHeight: 1000, clientHeight: 400});
|
|
117
|
-
flushRaf();
|
|
118
|
-
expect(el.scrollTop).toBe(600);
|
|
119
|
-
|
|
120
|
-
// Growth after the mount jump is streaming — spring path, not instant.
|
|
121
|
-
setGeometry(el, {scrollHeight: 1400, clientHeight: 400});
|
|
122
|
-
act(() => api.current!.scrollIfLocked());
|
|
123
|
-
expect(el.scrollTop).toBe(600);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('default: starts locked', () => {
|
|
127
|
-
const {api} = renderHook();
|
|
128
|
-
expect(api.current!.isLocked).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
describe("useChatStreamScroll — scrollToBottom({behavior: 'instant'})", () => {
|
|
133
|
-
it('jumps synchronously without scheduling animation frames', () => {
|
|
134
|
-
const {api, el} = renderHook();
|
|
135
|
-
setGeometry(el, {scrollHeight: 1000, clientHeight: 400});
|
|
136
|
-
flushRaf(); // consume the mount jump
|
|
137
|
-
el.scrollTop = 100; // user scrolled up
|
|
138
|
-
|
|
139
|
-
rafQueue = [];
|
|
140
|
-
act(() => api.current!.scrollToBottom({behavior: 'instant'}));
|
|
141
|
-
expect(el.scrollTop).toBe(600);
|
|
142
|
-
expect(rafQueue).toHaveLength(0);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('re-locks after an instant jump', () => {
|
|
146
|
-
const {api, el} = renderHook();
|
|
147
|
-
setGeometry(el, {scrollHeight: 1000, clientHeight: 400});
|
|
148
|
-
flushRaf();
|
|
149
|
-
act(() => api.current!.unlock());
|
|
150
|
-
expect(api.current!.isLocked).toBe(false);
|
|
151
|
-
|
|
152
|
-
act(() => api.current!.scrollToBottom({behavior: 'instant'}));
|
|
153
|
-
expect(api.current!.isLocked).toBe(true);
|
|
154
|
-
expect(el.scrollTop).toBe(600);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('default scrollToBottom animates instead of jumping', () => {
|
|
158
|
-
const {api, el} = renderHook();
|
|
159
|
-
setGeometry(el, {scrollHeight: 1000, clientHeight: 400});
|
|
160
|
-
flushRaf();
|
|
161
|
-
el.scrollTop = 100;
|
|
162
|
-
|
|
163
|
-
act(() => api.current!.scrollToBottom());
|
|
164
|
-
// Spring path: position is untouched until animation frames run.
|
|
165
|
-
expect(el.scrollTop).toBe(100);
|
|
166
|
-
expect(rafQueue.length).toBeGreaterThan(0);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
@@ -1,282 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
package/src/authoring/doc.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file doc.ts
|
|
5
|
-
* @input A component/function/generic doc object (without the `type` tag).
|
|
6
|
-
* @output Type-preserving `createComponentDoc`/`createFunctionDoc`/`createDoc`
|
|
7
|
-
* helpers plus the doc-authoring TypeScript surface.
|
|
8
|
-
* @position Integration-author authoring surface. See `./index.ts` for why
|
|
9
|
-
* these authoring factories live in `@astryxdesign/core`.
|
|
10
|
-
*
|
|
11
|
-
* A doc describes a documentable unit of the design system so the CLI and docs
|
|
12
|
-
* surfaces can list, search, and render it. There are three kinds, each a tiny
|
|
13
|
-
* runtime identity helper that stamps a `type` discriminant:
|
|
14
|
-
*
|
|
15
|
-
* - `createComponentDoc` -> `type: 'component'` — a component (or a family).
|
|
16
|
-
* - `createFunctionDoc` -> `type: 'function'` — any function, including
|
|
17
|
-
* hooks: an "inputs + outputs" surface (`params` + `returns`).
|
|
18
|
-
* - `createDoc` -> `type: 'generic'` — reference/topic docs.
|
|
19
|
-
*
|
|
20
|
-
* These factories do NOT validate. Validation happens at the CLI load boundary,
|
|
21
|
-
* where doc discovery runs the loaded value through a schema that accepts BOTH
|
|
22
|
-
* the stamped formats and the legacy loose `export const docs = {...}` shape.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Fields shared by every doc kind (component + function + generic).
|
|
27
|
-
*
|
|
28
|
-
* `group` vs `parent` are distinct:
|
|
29
|
-
* - `group` is a FLAT sidebar bucket label; many docs can share it and it is
|
|
30
|
-
* NOT an inheritance key.
|
|
31
|
-
* - `parent` is a DIRECTED inheritance/composition pointer — a doc naming the
|
|
32
|
-
* doc it belongs to (e.g. a sub-component naming its parent component). The
|
|
33
|
-
* legacy `subComponentOf` field is a synonym.
|
|
34
|
-
*
|
|
35
|
-
* `relatedDocs` is a single flat curated cross-reference list; it replaces the
|
|
36
|
-
* legacy split `relatedComponents` + `relatedHooks`.
|
|
37
|
-
*/
|
|
38
|
-
export interface AstryxBaseDocInput {
|
|
39
|
-
/** Name of the documented unit, without any prefix, PascalCase. Required. */
|
|
40
|
-
name: string;
|
|
41
|
-
/** Human-readable display name for gallery/sidebar. */
|
|
42
|
-
displayName?: string;
|
|
43
|
-
/** Short description. */
|
|
44
|
-
description?: string;
|
|
45
|
-
/** Usage documentation (description, best practices, anatomy, slotElements). */
|
|
46
|
-
usage?: unknown;
|
|
47
|
-
/** Flat sidebar grouping label (not an inheritance key). */
|
|
48
|
-
group?: string;
|
|
49
|
-
/** Overview-page functional category. */
|
|
50
|
-
category?: string;
|
|
51
|
-
/** CLI fuzzy-search keywords. */
|
|
52
|
-
keywords?: string[];
|
|
53
|
-
/** Directed inheritance/composition pointer to the doc this belongs to. */
|
|
54
|
-
parent?: string;
|
|
55
|
-
/** Flat curated cross-reference list of related doc names. */
|
|
56
|
-
relatedDocs?: string[];
|
|
57
|
-
/** Hide the whole doc from human-facing UI (stays importable/discoverable). */
|
|
58
|
-
hidden?: boolean;
|
|
59
|
-
/** Exclude from the categorized overview page (kept in sidebar/CLI). */
|
|
60
|
-
isHiddenFromOverview?: boolean;
|
|
61
|
-
/** Any additional fields the rich doc surface carries. */
|
|
62
|
-
[key: string]: unknown;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** A single documented prop (mirrors `PropDoc` from core docs-types). */
|
|
66
|
-
export interface AstryxPropInput {
|
|
67
|
-
name: string;
|
|
68
|
-
type: string;
|
|
69
|
-
description: string;
|
|
70
|
-
default?: string;
|
|
71
|
-
required?: boolean;
|
|
72
|
-
[key: string]: unknown;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** A single documented param (mirrors `HookParamDoc`). */
|
|
76
|
-
export interface AstryxParamInput {
|
|
77
|
-
name: string;
|
|
78
|
-
type: string;
|
|
79
|
-
description: string;
|
|
80
|
-
default?: string;
|
|
81
|
-
required?: boolean;
|
|
82
|
-
[key: string]: unknown;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** A single documented return field (mirrors `HookReturnDoc`). */
|
|
86
|
-
export interface AstryxReturnInput {
|
|
87
|
-
name: string;
|
|
88
|
-
type: string;
|
|
89
|
-
description: string;
|
|
90
|
-
[key: string]: unknown;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Input accepted by {@link createComponentDoc}. A component (or a family). The
|
|
95
|
-
* `type` discriminant is injected by the factory. `anatomy`/`slotElements` live
|
|
96
|
-
* inside `usage`; `importPath` is DERIVED (never authored).
|
|
97
|
-
*/
|
|
98
|
-
export interface AstryxComponentDocInput extends AstryxBaseDocInput {
|
|
99
|
-
/** All public props for the component. */
|
|
100
|
-
props: AstryxPropInput[];
|
|
101
|
-
/** Theming/selector-surface metadata. */
|
|
102
|
-
theming?: unknown;
|
|
103
|
-
/** Interactive-preview playground configuration. */
|
|
104
|
-
playground?: unknown;
|
|
105
|
-
/** Short code examples rendered after the props table. */
|
|
106
|
-
examples?: unknown[];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Input accepted by {@link createFunctionDoc}. Covers any function, including
|
|
111
|
-
* hooks: an inputs (`params`) + outputs (`returns`) surface. The `type`
|
|
112
|
-
* discriminant is injected by the factory; `importPath` is DERIVED.
|
|
113
|
-
*/
|
|
114
|
-
export interface AstryxFunctionDocInput extends AstryxBaseDocInput {
|
|
115
|
-
/** Function/hook parameters or options-object fields. */
|
|
116
|
-
params: AstryxParamInput[];
|
|
117
|
-
/** Return value documentation. One entry per field (or a single primitive). */
|
|
118
|
-
returns: AstryxReturnInput[];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Input accepted by {@link createDoc}. A generic reference/topic doc — just the
|
|
123
|
-
* shared base. The `type` discriminant is injected by the factory.
|
|
124
|
-
*/
|
|
125
|
-
export type AstryxGenericDocInput = AstryxBaseDocInput;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Back-compat alias. Previously `createDoc` accepted a broad component-doc
|
|
129
|
-
* record; the union of the three input kinds preserves that permissiveness for
|
|
130
|
-
* any code referring to the old name.
|
|
131
|
-
*/
|
|
132
|
-
export type AstryxComponentDoc =
|
|
133
|
-
| AstryxComponentDocInput
|
|
134
|
-
| AstryxFunctionDocInput
|
|
135
|
-
| AstryxGenericDocInput;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Author a component doc. Stamp-only: returns the def with `type: 'component'`
|
|
139
|
-
* injected. Validation happens at the CLI load boundary.
|
|
140
|
-
*/
|
|
141
|
-
export function createComponentDoc<T extends AstryxComponentDocInput>(
|
|
142
|
-
def: T,
|
|
143
|
-
): T & {type: 'component'} {
|
|
144
|
-
return {...def, type: 'component'};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Author a function doc (covers any function, including hooks). Stamp-only:
|
|
149
|
-
* returns the def with `type: 'function'` injected. Validation happens at the
|
|
150
|
-
* CLI load boundary.
|
|
151
|
-
*/
|
|
152
|
-
export function createFunctionDoc<T extends AstryxFunctionDocInput>(
|
|
153
|
-
def: T,
|
|
154
|
-
): T & {type: 'function'} {
|
|
155
|
-
return {...def, type: 'function'};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Author a generic reference/topic doc. Stamp-only: returns the def with
|
|
160
|
-
* `type: 'generic'` injected. Validation happens at the CLI load boundary.
|
|
161
|
-
*/
|
|
162
|
-
export function createDoc<T extends AstryxGenericDocInput>(
|
|
163
|
-
def: T,
|
|
164
|
-
): T & {type: 'generic'} {
|
|
165
|
-
return {...def, type: 'generic'};
|
|
166
|
-
}
|