@astryxdesign/core 0.1.6 → 0.1.7-canary.04cd8f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +25 -14
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +4 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +4 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +8 -6
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/Button/Button.d.ts +10 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +49 -6
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +27 -11
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +29 -7
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -5
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -1
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +9 -2
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -2
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +6 -4
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +4 -2
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +8 -2
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +3 -1
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +3 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +13 -8
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts +12 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +43 -6
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +4 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +4 -2
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +3 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +3 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +10 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +71 -53
- package/dist/Collapsible/Collapsible.d.ts +11 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +36 -4
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +8 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +4 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +4 -1
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +8 -4
- package/dist/ContextMenu/index.d.ts +3 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +7 -1
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +10 -5
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -6
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +15 -7
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +15 -12
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +7 -3
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +19 -9
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +89 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +170 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +70 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +10 -1
- package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemRoles.js +15 -0
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +11 -1
- package/dist/Icon/Icon.d.ts +17 -12
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +28 -20
- package/dist/Kbd/Kbd.js +1 -1
- package/dist/Layer/useLayer.d.ts +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +23 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +6 -4
- package/dist/Link/Link.d.ts +5 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +32 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +10 -8
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +4 -2
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +4 -1
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +13 -6
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +5 -1
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +22 -12
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +26 -20
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +34 -21
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +4 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +52 -14
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +3 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +5 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +7 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +6 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +5 -3
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +56 -19
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +12 -5
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +8 -6
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +1 -1
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +5 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +6 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -2
- package/dist/Table/plugins/tree/index.d.ts +5 -0
- package/dist/Table/plugins/tree/index.d.ts.map +1 -0
- package/dist/Table/plugins/tree/index.js +4 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
- package/dist/Table/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +6 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +8 -2
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +18 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +3 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +8 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +3 -1
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +8 -1
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +4 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +5 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +5 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +8 -4
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -0
- package/dist/astryx.css +38 -4
- package/dist/astryx.umd.js +62 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/docs-types.d.ts +13 -4
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +61 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/hct.d.ts +0 -1
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +0 -3
- package/dist/utils/color.d.ts +13 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +23 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/locales/en.json +754 -0
- package/locales/pseudo.json +566 -0
- package/package.json +23 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.doc.mjs +8 -0
- package/src/Button/Button.test.tsx +27 -0
- package/src/Button/Button.tsx +51 -5
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.test.tsx +103 -2
- package/src/Calendar/Calendar.tsx +29 -6
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.test.tsx +127 -2
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/index.ts +1 -0
- package/src/Chat/useChatStreamScroll.test.tsx +168 -0
- package/src/Chat/useChatStreamScroll.ts +67 -11
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +7 -0
- package/src/Collapsible/Collapsible.test.tsx +80 -0
- package/src/Collapsible/Collapsible.tsx +58 -5
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.test.tsx +75 -1
- package/src/ContextMenu/ContextMenu.tsx +14 -6
- package/src/ContextMenu/index.ts +15 -0
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.test.tsx +17 -5
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/Dialog.tsx +11 -15
- package/src/Dialog/DialogHeader.tsx +7 -3
- package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +23 -14
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +237 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +119 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
- package/src/DropdownMenu/index.ts +23 -3
- package/src/DropdownMenu/menuItemRoles.ts +22 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +3 -3
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/FileInput/FileInput.test.tsx +40 -1
- package/src/FileInput/FileInput.tsx +12 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/Icon/Icon.test.tsx +46 -0
- package/src/Icon/Icon.tsx +37 -24
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Kbd/Kbd.test.tsx +26 -0
- package/src/Kbd/Kbd.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +8 -5
- package/src/Layer/useLayer.test.tsx +136 -1
- package/src/Layer/useLayer.tsx +34 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -1
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +6 -3
- package/src/Selector/Selector.test.tsx +114 -6
- package/src/Selector/Selector.tsx +68 -17
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/TabList.tsx +12 -1
- package/src/TabList/TabMenu.tsx +4 -1
- package/src/Table/BaseTable.tsx +36 -19
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +7 -5
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -1
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +4 -4
- package/src/Table/plugins/tree/index.ts +12 -0
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
- package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
- package/src/Table/types.ts +18 -12
- package/src/Table/useBaseTablePlugins.ts +6 -2
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Table/useTableTreeData.doc.mjs +75 -0
- package/src/Table/useTableTreeState.doc.mjs +98 -0
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.tsx +10 -3
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +938 -0
- package/src/docs-types.ts +15 -10
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +82 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/hct.ts +0 -4
- package/src/utils/color.test.ts +101 -1
- package/src/utils/color.ts +23 -1
- package/src/utils/index.ts +8 -1
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import {Badge} from '../Badge';
|
|
26
26
|
import {Button} from '../Button';
|
|
27
27
|
import {HoverCard} from '../HoverCard';
|
|
28
|
+
import {useTranslator} from '../i18n';
|
|
28
29
|
|
|
29
30
|
// =============================================================================
|
|
30
31
|
// Types
|
|
@@ -88,6 +89,7 @@ export function ChatPastedTextToken({
|
|
|
88
89
|
text,
|
|
89
90
|
onExpand,
|
|
90
91
|
}: ChatPastedTextTokenProps) {
|
|
92
|
+
const t = useTranslator();
|
|
91
93
|
const label = formatLabel(text);
|
|
92
94
|
|
|
93
95
|
const cardContent = (
|
|
@@ -97,7 +99,7 @@ export function ChatPastedTextToken({
|
|
|
97
99
|
<span {...stylex.props(styles.meta)}>{label}</span>
|
|
98
100
|
{onExpand && (
|
|
99
101
|
<Button
|
|
100
|
-
label=
|
|
102
|
+
label={t('@astryx.chat.pastedText.expand')}
|
|
101
103
|
variant="ghost"
|
|
102
104
|
size="sm"
|
|
103
105
|
onClick={onExpand}
|
|
@@ -25,6 +25,7 @@ import {useChatComposerContext} from './ChatContext';
|
|
|
25
25
|
|
|
26
26
|
import type {BaseProps} from '../BaseProps';
|
|
27
27
|
import {themeProps} from '../utils/themeProps';
|
|
28
|
+
import {useTranslator} from '../i18n';
|
|
28
29
|
|
|
29
30
|
// =============================================================================
|
|
30
31
|
// Types
|
|
@@ -75,6 +76,7 @@ const styles = stylex.create({
|
|
|
75
76
|
* ```
|
|
76
77
|
*/
|
|
77
78
|
export function ChatSendButton(props: ChatSendButtonProps): ReactNode {
|
|
79
|
+
const t = useTranslator();
|
|
78
80
|
const context = useChatComposerContext();
|
|
79
81
|
|
|
80
82
|
const {
|
|
@@ -94,7 +96,7 @@ export function ChatSendButton(props: ChatSendButtonProps): ReactNode {
|
|
|
94
96
|
return (
|
|
95
97
|
<Button
|
|
96
98
|
ref={ref}
|
|
97
|
-
label={isStopShown ? '
|
|
99
|
+
label={isStopShown ? t('@astryx.chatSendButton.stop') : t('@astryx.chatSendButton.send')}
|
|
98
100
|
variant={isStopShown ? 'secondary' : 'primary'}
|
|
99
101
|
size={size}
|
|
100
102
|
icon={
|
|
@@ -38,7 +38,7 @@ export const docs = {
|
|
|
38
38
|
name: 'calls',
|
|
39
39
|
type: 'ChatToolCallItem[]',
|
|
40
40
|
description:
|
|
41
|
-
|
|
41
|
+
"Array of tool call data. Each item has name, status, target, duration, node, additions, deletions, stats, errorMessage, resultDetail, key, and data. status is one of 'pending', 'running', 'complete', or 'error' (defaults to 'complete').",
|
|
42
42
|
required: true,
|
|
43
43
|
},
|
|
44
44
|
{
|
package/src/Chat/index.ts
CHANGED
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
});
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* - Locked (default): content growth auto-scrolls to bottom via rAF spring
|
|
13
13
|
* - Scrolling up (any source): unlocks immediately
|
|
14
14
|
* - Scrolling settles at bottom: re-locks on scrollend
|
|
15
|
+
* - The first fill positions instantly (whether content is present at
|
|
16
|
+
* mount or arrives async); only subsequent growth springs
|
|
17
|
+
* - `scrollToBottom({behavior: 'instant'})` jumps in one frame, no animation
|
|
15
18
|
*
|
|
16
19
|
* Uses scroll direction (lastScrollTop comparison) to detect user
|
|
17
20
|
* intent — works for wheel, touch, scrollbar drag, keyboard, everything.
|
|
@@ -28,6 +31,18 @@ import {useCallback, useEffect, useRef, useState} from 'react';
|
|
|
28
31
|
// Types
|
|
29
32
|
// =============================================================================
|
|
30
33
|
|
|
34
|
+
export interface ChatScrollToBottomOptions {
|
|
35
|
+
/**
|
|
36
|
+
* `'instant'` jumps to the bottom in a single frame instead of running
|
|
37
|
+
* the spring animation. Use for programmatic positioning (opening a
|
|
38
|
+
* conversation, restoring a session) — keep the default `'spring'` for
|
|
39
|
+
* user-initiated scrolls like the scroll-to-bottom button. Mirrors the
|
|
40
|
+
* DOM's `scrollTo({behavior})`.
|
|
41
|
+
* @default 'spring'
|
|
42
|
+
*/
|
|
43
|
+
behavior?: 'instant' | 'spring';
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
export interface UseChatStreamScrollOptions {
|
|
32
47
|
/**
|
|
33
48
|
* Ref to the scrollable container element.
|
|
@@ -81,7 +96,7 @@ export interface UseChatStreamScrollReturn {
|
|
|
81
96
|
isLocked: boolean;
|
|
82
97
|
|
|
83
98
|
/** Scroll to the bottom of the container and re-lock. */
|
|
84
|
-
scrollToBottom: () => void;
|
|
99
|
+
scrollToBottom: (options?: ChatScrollToBottomOptions) => void;
|
|
85
100
|
|
|
86
101
|
/** Scroll so a specific element is at the top of the visible area. No lock change. */
|
|
87
102
|
scrollToMessage: (el: HTMLElement) => void;
|
|
@@ -118,6 +133,9 @@ export function useChatStreamScroll({
|
|
|
118
133
|
const [isLocked, setIsLocked] = useState(true);
|
|
119
134
|
|
|
120
135
|
const lockedRef = useRef(true);
|
|
136
|
+
// True until the initial fill has been positioned — consumed by the first
|
|
137
|
+
// scrollIfLocked that sees scrollable content.
|
|
138
|
+
const initialFillPendingRef = useRef(true);
|
|
121
139
|
const velocityRef = useRef(0);
|
|
122
140
|
const animatingRef = useRef(false);
|
|
123
141
|
const lastTickRef = useRef<number | undefined>(undefined);
|
|
@@ -179,14 +197,36 @@ export function useChatStreamScroll({
|
|
|
179
197
|
}
|
|
180
198
|
}, [animate]);
|
|
181
199
|
|
|
200
|
+
// Jump to the bottom in a single frame — cancels any in-flight spring so
|
|
201
|
+
// a later animation tick can't fight the assignment.
|
|
202
|
+
const jumpToBottom = useCallback(() => {
|
|
203
|
+
const el = scrollRef.current;
|
|
204
|
+
if (!el) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
animatingRef.current = false;
|
|
208
|
+
velocityRef.current = 0;
|
|
209
|
+
lastTickRef.current = undefined;
|
|
210
|
+
el.scrollTop = el.scrollHeight - el.clientHeight;
|
|
211
|
+
lastScrollTopRef.current = el.scrollTop;
|
|
212
|
+
}, [scrollRef]);
|
|
213
|
+
|
|
182
214
|
// --- Public API ---
|
|
183
215
|
|
|
184
|
-
const scrollToBottom = useCallback(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
216
|
+
const scrollToBottom = useCallback(
|
|
217
|
+
(options?: ChatScrollToBottomOptions) => {
|
|
218
|
+
lockedRef.current = true;
|
|
219
|
+
setIsLocked(true);
|
|
220
|
+
setIsScrolledUp(false);
|
|
221
|
+
initialFillPendingRef.current = false;
|
|
222
|
+
if (options?.behavior === 'instant') {
|
|
223
|
+
jumpToBottom();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
startAnimation();
|
|
227
|
+
},
|
|
228
|
+
[startAnimation, jumpToBottom],
|
|
229
|
+
);
|
|
190
230
|
|
|
191
231
|
const scrollToMessage = useCallback(
|
|
192
232
|
(el: HTMLElement) => {
|
|
@@ -232,10 +272,25 @@ export function useChatStreamScroll({
|
|
|
232
272
|
if (!enabled) {
|
|
233
273
|
return;
|
|
234
274
|
}
|
|
235
|
-
if (lockedRef.current) {
|
|
236
|
-
|
|
275
|
+
if (!lockedRef.current) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
// Initial fill: content appearing for the first time (e.g. an
|
|
279
|
+
// async-loaded conversation) positions in one frame instead of
|
|
280
|
+
// spring-flying from the top. Stays pending through empty/loading
|
|
281
|
+
// resizes until the container is actually scrollable.
|
|
282
|
+
const el = scrollRef.current;
|
|
283
|
+
if (
|
|
284
|
+
initialFillPendingRef.current &&
|
|
285
|
+
el &&
|
|
286
|
+
el.scrollHeight > el.clientHeight
|
|
287
|
+
) {
|
|
288
|
+
initialFillPendingRef.current = false;
|
|
289
|
+
jumpToBottom();
|
|
290
|
+
return;
|
|
237
291
|
}
|
|
238
|
-
|
|
292
|
+
startAnimation();
|
|
293
|
+
}, [enabled, startAnimation, jumpToBottom, scrollRef]);
|
|
239
294
|
|
|
240
295
|
// --- Event listeners ---
|
|
241
296
|
|
|
@@ -314,11 +369,12 @@ export function useChatStreamScroll({
|
|
|
314
369
|
el.addEventListener('wheel', onWheel, {passive: true});
|
|
315
370
|
el.addEventListener('touchmove', onTouchMove, {passive: true});
|
|
316
371
|
|
|
317
|
-
// Initial scroll to bottom
|
|
372
|
+
// Initial scroll to bottom — content already present at mount.
|
|
318
373
|
requestAnimationFrame(() => {
|
|
319
374
|
if (el.scrollHeight > el.clientHeight) {
|
|
320
375
|
el.scrollTop = el.scrollHeight - el.clientHeight;
|
|
321
376
|
lastScrollTopRef.current = el.scrollTop;
|
|
377
|
+
initialFillPendingRef.current = false;
|
|
322
378
|
}
|
|
323
379
|
});
|
|
324
380
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {useState, useCallback, useEffect, useMemo, useRef} from 'react';
|
|
17
|
+
import {useTranslator} from '../i18n';
|
|
17
18
|
|
|
18
19
|
// =============================================================================
|
|
19
20
|
// Types
|
|
@@ -258,6 +259,7 @@ export function getDefaultAudioContext(): AudioContext {
|
|
|
258
259
|
export function useSpeechRecognition(
|
|
259
260
|
options: UseSpeechRecognitionOptions = {},
|
|
260
261
|
): UseSpeechRecognitionReturn {
|
|
262
|
+
const t = useTranslator();
|
|
261
263
|
const {
|
|
262
264
|
lang,
|
|
263
265
|
continuous = true,
|
|
@@ -408,13 +410,20 @@ export function useSpeechRecognition(
|
|
|
408
410
|
recognition.onnomatch = () => {
|
|
409
411
|
callbacksRef.current.onError?.({
|
|
410
412
|
error: 'no-speech',
|
|
411
|
-
message: '
|
|
413
|
+
message: t('@astryx.chat.speechRecognition.noSpeechDetected'),
|
|
412
414
|
});
|
|
413
415
|
};
|
|
414
416
|
|
|
415
417
|
recognitionRef.current = recognition;
|
|
416
418
|
recognition.start();
|
|
417
|
-
}, [
|
|
419
|
+
}, [
|
|
420
|
+
lang,
|
|
421
|
+
continuous,
|
|
422
|
+
interimResults,
|
|
423
|
+
startVolumePolling,
|
|
424
|
+
stopVolumePolling,
|
|
425
|
+
t,
|
|
426
|
+
]);
|
|
418
427
|
|
|
419
428
|
const stop = useCallback(() => {
|
|
420
429
|
recognitionRef.current?.stop();
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
import {mergeProps, groupItems} from '../utils';
|
|
41
41
|
import type {SearchableItem} from '../Typeahead/types';
|
|
42
42
|
import {themeProps} from '../utils/themeProps';
|
|
43
|
+
import {useTranslator} from '../i18n';
|
|
43
44
|
import type {ChatComposerTrigger, ChatComposerToken} from './ChatComposerInput';
|
|
44
45
|
|
|
45
46
|
// =============================================================================
|
|
@@ -254,6 +255,7 @@ function deleteTriggerText(
|
|
|
254
255
|
export function useTriggerMenu(
|
|
255
256
|
options: UseTriggerMenuOptions,
|
|
256
257
|
): UseTriggerMenuReturn {
|
|
258
|
+
const t = useTranslator();
|
|
257
259
|
const {
|
|
258
260
|
triggers,
|
|
259
261
|
editableRef,
|
|
@@ -697,7 +699,7 @@ export function useTriggerMenu(
|
|
|
697
699
|
<div
|
|
698
700
|
id={listboxId}
|
|
699
701
|
role="listbox"
|
|
700
|
-
aria-label={trigger?.menuLabel ?? '
|
|
702
|
+
aria-label={trigger?.menuLabel ?? t('@astryx.chatTriggerMenu.suggestions')}
|
|
701
703
|
{...mergeProps(
|
|
702
704
|
themeProps('trigger-menu'),
|
|
703
705
|
stylex.props(styles.dropdown),
|
|
@@ -710,7 +712,7 @@ export function useTriggerMenu(
|
|
|
710
712
|
xstyle: [styles.popoverSurface, styles.popoverGap],
|
|
711
713
|
},
|
|
712
714
|
);
|
|
713
|
-
}, [popover, listboxId, state, selectItem, getItemId]);
|
|
715
|
+
}, [popover, listboxId, state, selectItem, getItemId, t]);
|
|
714
716
|
|
|
715
717
|
return {
|
|
716
718
|
state,
|
|
@@ -113,7 +113,7 @@ export const docs = {
|
|
|
113
113
|
{
|
|
114
114
|
name: 'labelIcon',
|
|
115
115
|
type: 'IconType',
|
|
116
|
-
description: 'Icon to display before the label text. See `
|
|
116
|
+
description: 'Icon to display before the label text. See `astryx docs icons` for valid semantic names.',
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
name: 'status',
|
|
@@ -248,6 +248,22 @@ describe('CheckboxInput', () => {
|
|
|
248
248
|
expect(screen.getByLabelText('Select row')).toBeInTheDocument();
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
+
it('keeps description linked via aria-describedby when isLabelHidden', () => {
|
|
252
|
+
render(
|
|
253
|
+
<CheckboxInput
|
|
254
|
+
label="Select row"
|
|
255
|
+
isLabelHidden
|
|
256
|
+
description="Selects this row for bulk actions"
|
|
257
|
+
value={false}
|
|
258
|
+
onChange={() => {}}
|
|
259
|
+
/>,
|
|
260
|
+
);
|
|
261
|
+
const checkbox = screen.getByRole('checkbox');
|
|
262
|
+
const description = screen.getByText('Selects this row for bulk actions');
|
|
263
|
+
expect(description.id).not.toBe('');
|
|
264
|
+
expect(checkbox.getAttribute('aria-describedby')).toContain(description.id);
|
|
265
|
+
});
|
|
266
|
+
|
|
251
267
|
it('shows label visually by default', () => {
|
|
252
268
|
render(
|
|
253
269
|
<CheckboxInput label="Accept terms" value={false} onChange={() => {}} />,
|
|
@@ -446,9 +446,11 @@ export function CheckboxInput({
|
|
|
446
446
|
);
|
|
447
447
|
|
|
448
448
|
// Build aria-describedby from description and status message
|
|
449
|
-
// Only include descriptionID when the element actually renders
|
|
449
|
+
// Only include descriptionID when the element actually renders.
|
|
450
|
+
// FieldLabel renders the description (with descriptionID) even when the
|
|
451
|
+
// label is visually hidden — it's sr-only, so keep it linked.
|
|
450
452
|
const describedByParts: string[] = [];
|
|
451
|
-
if (description
|
|
453
|
+
if (description) {
|
|
452
454
|
describedByParts.push(descriptionID);
|
|
453
455
|
}
|
|
454
456
|
if (status?.message) {
|
|
@@ -85,7 +85,7 @@ export const docs = {
|
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
name: 'status',
|
|
88
|
-
type: '
|
|
88
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
89
89
|
description: 'Status indicator ({ type, message }).',
|
|
90
90
|
},
|
|
91
91
|
{
|
|
@@ -108,6 +108,11 @@ export const docs = {
|
|
|
108
108
|
{ guidance: false, description: 'Wrap a disabled CheckboxList in Tooltip to explain why it is disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.' },
|
|
109
109
|
],
|
|
110
110
|
},
|
|
111
|
+
theming: {
|
|
112
|
+
targets: [
|
|
113
|
+
{className: 'astryx-checkbox-list'},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
111
116
|
};
|
|
112
117
|
|
|
113
118
|
/** @type {import('../docs-types').TranslationDoc} */
|
|
@@ -163,6 +163,7 @@ export function CheckboxList({
|
|
|
163
163
|
className,
|
|
164
164
|
style,
|
|
165
165
|
'data-testid': dataTestId,
|
|
166
|
+
...rest
|
|
166
167
|
}: CheckboxListProps) {
|
|
167
168
|
const inputID = useId();
|
|
168
169
|
const labelID = useId();
|
|
@@ -234,6 +235,7 @@ export function CheckboxList({
|
|
|
234
235
|
|
|
235
236
|
return (
|
|
236
237
|
<Field
|
|
238
|
+
{...rest}
|
|
237
239
|
ref={ref}
|
|
238
240
|
data-testid={dataTestId}
|
|
239
241
|
label={label}
|
|
@@ -26,6 +26,7 @@ import {CheckboxInput} from '../CheckboxInput/CheckboxInput';
|
|
|
26
26
|
import {ListItem} from '../List/ListItem';
|
|
27
27
|
import {ListContext} from '../List/ListContext';
|
|
28
28
|
import {CheckboxListContext} from './CheckboxListContext';
|
|
29
|
+
import {useTranslator} from '../i18n';
|
|
29
30
|
|
|
30
31
|
// =============================================================================
|
|
31
32
|
// Styles
|
|
@@ -132,6 +133,7 @@ export function CheckboxListItem({
|
|
|
132
133
|
onClick: onClickProp,
|
|
133
134
|
...restProps
|
|
134
135
|
}: CheckboxListItemProps) {
|
|
136
|
+
const t = useTranslator();
|
|
135
137
|
const ctx = use(CheckboxListContext);
|
|
136
138
|
|
|
137
139
|
if (ctx && ctx.value !== undefined && value === undefined) {
|
|
@@ -224,7 +226,11 @@ export function CheckboxListItem({
|
|
|
224
226
|
style={style}
|
|
225
227
|
startContent={
|
|
226
228
|
<CheckboxInput
|
|
227
|
-
label={
|
|
229
|
+
label={
|
|
230
|
+
typeof label === 'string'
|
|
231
|
+
? label
|
|
232
|
+
: t('@astryx.checkboxList.item.checkbox')
|
|
233
|
+
}
|
|
228
234
|
isLabelHidden
|
|
229
235
|
value={resolvedChecked}
|
|
230
236
|
onChange={() => handleToggle()}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import {mergeProps} from '../utils';
|
|
29
29
|
import type {BaseProps} from '../BaseProps';
|
|
30
30
|
import {themeProps} from '../utils/themeProps';
|
|
31
|
+
import {useTranslator} from '../i18n';
|
|
31
32
|
|
|
32
33
|
export interface CitationSource {
|
|
33
34
|
title?: string;
|
|
@@ -154,6 +155,7 @@ export function Citation({
|
|
|
154
155
|
'data-testid': testId,
|
|
155
156
|
...rest
|
|
156
157
|
}: CitationProps): React.ReactElement {
|
|
158
|
+
const t = useTranslator();
|
|
157
159
|
const title = source.title ?? String(number);
|
|
158
160
|
const href = source.url;
|
|
159
161
|
const icon = source.icon;
|
|
@@ -181,7 +183,7 @@ export function Citation({
|
|
|
181
183
|
{...rest}
|
|
182
184
|
ref={elementRef}
|
|
183
185
|
role={noteRole}
|
|
184
|
-
aria-label={
|
|
186
|
+
aria-label={t('@astryx.citation.label', {number, title})}
|
|
185
187
|
data-testid={testId}
|
|
186
188
|
{...linkProps}
|
|
187
189
|
{...mergeProps(
|
|
@@ -204,7 +206,7 @@ export function Citation({
|
|
|
204
206
|
{...rest}
|
|
205
207
|
ref={elementRef}
|
|
206
208
|
role={noteRole}
|
|
207
|
-
aria-label={
|
|
209
|
+
aria-label={t('@astryx.citation.label', {number, title})}
|
|
208
210
|
data-testid={testId}
|
|
209
211
|
{...linkProps}
|
|
210
212
|
{...mergeProps(
|
|
@@ -26,7 +26,7 @@ export const docs = {
|
|
|
26
26
|
{name: 'target', type: 'string', description: 'Link target.', default: "'_self'"},
|
|
27
27
|
{name: 'isDisabled', type: 'boolean', description: 'Disables the card.', default: 'false'},
|
|
28
28
|
{name: 'children', type: 'ReactNode', description: 'Card content.'},
|
|
29
|
-
{name: 'padding', type:
|
|
29
|
+
{name: 'padding', type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10', description: 'Inner padding.', default: '4'},
|
|
30
30
|
{name: 'variant', type: "'default' | 'transparent' | 'muted' | 'blue' | 'cyan' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'teal' | 'yellow'", description: 'Background color variant.', default: "'default'"},
|
|
31
31
|
{name: 'width', type: 'SizeValue', description: 'Card width.'},
|
|
32
32
|
{name: 'height', type: 'SizeValue', description: 'Card height.'},
|