@astryxdesign/core 0.1.5 → 0.1.6-canary.02f2602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +2 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +21 -18
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts +0 -2
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -5
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +55 -53
- package/dist/AspectRatio/AspectRatio.js +5 -5
- package/dist/Avatar/Avatar.js +19 -19
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +9 -6
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -30
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +11 -8
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +53 -23
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +34 -18
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +51 -48
- package/dist/Card/Card.js +3 -3
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +27 -24
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +27 -24
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +23 -16
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +20 -16
- package/dist/Chat/ChatDictationButton.js +10 -10
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +23 -21
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +13 -11
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +20 -14
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +10 -8
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +17 -15
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +24 -19
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +16 -14
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +6 -4
- package/dist/Chat/ChatSystemMessage.js +11 -11
- package/dist/Chat/ChatTokenizedText.js +8 -8
- package/dist/Chat/ChatToolCalls.js +73 -73
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +19 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +26 -24
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +12 -10
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +8 -6
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +20 -12
- package/dist/ClickableCard/ClickableCard.js +6 -6
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +114 -96
- package/dist/Collapsible/Collapsible.js +11 -11
- package/dist/Collapsible/CollapsibleGroup.js +7 -7
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +39 -34
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +17 -14
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +7 -4
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +14 -11
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +28 -23
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +32 -27
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +41 -33
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +20 -18
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +21 -15
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +34 -30
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.js +3 -3
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.js +11 -11
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +9 -9
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +17 -17
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.js +5 -5
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +35 -33
- package/dist/Lightbox/useLightbox.d.ts +0 -1
- package/dist/Lightbox/useLightbox.d.ts.map +1 -1
- package/dist/Lightbox/useLightbox.js +3 -4
- package/dist/Link/Link.d.ts +5 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +47 -18
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +111 -109
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +19 -17
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +9 -6
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +7 -4
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +69 -62
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +21 -17
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +19 -16
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.d.ts +0 -3
- package/dist/Overlay/useOverlay.d.ts.map +1 -1
- package/dist/Overlay/useOverlay.js +3 -6
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +73 -46
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +11 -8
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +95 -85
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +109 -103
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +12 -8
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +88 -75
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/ProgressBar/ProgressBar.js +13 -13
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.js +18 -18
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -7
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.js +5 -5
- package/dist/SegmentedControl/SegmentedControlItem.js +7 -7
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +57 -51
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +38 -36
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +8 -6
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +92 -90
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +49 -43
- package/dist/SideNav/SideNavSection.js +14 -14
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -27
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +9 -6
- package/dist/TabList/TabMenu.js +23 -23
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -37
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +10 -8
- package/dist/Table/TableBody.js +3 -3
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.js +3 -3
- package/dist/Table/TableHeader.js +3 -3
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/index.d.ts +4 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +9 -9
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +127 -90
- package/dist/Table/plugins/groupedRows/index.d.ts +3 -0
- package/dist/Table/plugins/groupedRows/index.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/index.js +3 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +78 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +257 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +12 -9
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +30 -28
- package/dist/Table/plugins/rowIndex/index.d.ts +3 -0
- package/dist/Table/plugins/rowIndex/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/index.js +3 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +50 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -0
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +91 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +23 -20
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -21
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +20 -16
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +37 -31
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +28 -23
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +29 -14
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +14 -12
- package/dist/Toast/useToast.js +4 -4
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +29 -23
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +33 -31
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +36 -33
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +72 -70
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +10 -10
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +13 -9
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +37 -31
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +26 -22
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +15 -13
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -3
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -3
- package/dist/astryx.css +20 -2
- package/dist/astryx.umd.js +66 -64
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +62 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/locales/en.json +746 -0
- package/locales/pseudo.json +560 -0
- package/package.json +24 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AlertDialog/useImperativeAlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.tsx +34 -4
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.tsx +8 -5
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +3 -3
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.tsx +4 -1
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +7 -7
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/DialogHeader.tsx +4 -2
- package/src/DropdownMenu/DropdownMenu.tsx +12 -8
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +2 -2
- package/src/FileInput/FileInput.tsx +3 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Lightbox/useLightbox.tsx +0 -1
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -3
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Overlay/useOverlay.tsx +0 -3
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.tsx +11 -6
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +2 -2
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/TabList.tsx +4 -1
- package/src/Table/BaseTable.tsx +8 -1
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/Table.tsx +3 -1
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/index.ts +7 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +231 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +351 -0
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +8 -4
- package/src/Table/plugins/rowIndex/index.ts +4 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.test.tsx +132 -0
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +114 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +71 -0
- package/src/Table/useTableRowIndex.doc.mjs +50 -0
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -3
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +902 -0
- package/src/hooks/useHotkeys.doc.mjs +5 -5
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +83 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -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,
|
|
@@ -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.'},
|
|
@@ -45,6 +45,7 @@ import type {SyntaxToken, TokenLine} from './tokenizer';
|
|
|
45
45
|
import {ensureHighlightStyles} from './highlightStyles';
|
|
46
46
|
import {applyHighlightRangesChunked} from './highlightRanges';
|
|
47
47
|
import {themeProps} from '../utils/themeProps';
|
|
48
|
+
import {useTranslator} from '../i18n';
|
|
48
49
|
import {SyntaxTheme, type SyntaxThemeDefinition} from '../theme/syntax';
|
|
49
50
|
|
|
50
51
|
// ---------------------------------------------------------------------------
|
|
@@ -78,6 +79,13 @@ const dynamicStyles = stylex.create({
|
|
|
78
79
|
minWidth: value === 'fit-content' ? 'min(100%, 400px)' : null,
|
|
79
80
|
maxWidth: value === 'fit-content' ? '100%' : null,
|
|
80
81
|
}),
|
|
82
|
+
// Width of the line-number column, sized to the widest number. `ch` is the
|
|
83
|
+
// advance of "0" in the (monospace) code font, so N digits => N ch. Set on
|
|
84
|
+
// <code>; `--_codeblock-gutter-width` is unregistered so it inherits (with its var()
|
|
85
|
+
// substituted) down to the line divs that read it for their grid track.
|
|
86
|
+
gutterWidth: (digits: number) => ({
|
|
87
|
+
'--_codeblock-gutter-width': `${digits}ch`,
|
|
88
|
+
}),
|
|
81
89
|
});
|
|
82
90
|
|
|
83
91
|
const styles = stylex.create({
|
|
@@ -188,22 +196,6 @@ const styles = stylex.create({
|
|
|
188
196
|
':focus-visible': '2px',
|
|
189
197
|
},
|
|
190
198
|
},
|
|
191
|
-
gutter: {
|
|
192
|
-
flexShrink: 0,
|
|
193
|
-
paddingBlock: spacingVars['--spacing-3'],
|
|
194
|
-
paddingInlineStart: spacingVars['--spacing-4'],
|
|
195
|
-
paddingInlineEnd: spacingVars['--spacing-3'],
|
|
196
|
-
textAlign: 'end',
|
|
197
|
-
userSelect: 'none',
|
|
198
|
-
color: 'var(--color-syntax-punctuation)',
|
|
199
|
-
borderRightWidth: borderVars['--border-width'],
|
|
200
|
-
borderRightStyle: 'solid',
|
|
201
|
-
borderRightColor: colorVars['--color-border'],
|
|
202
|
-
},
|
|
203
|
-
gutterLine: {
|
|
204
|
-
fontFamily: typographyVars['--font-family-code'],
|
|
205
|
-
lineHeight: typeScaleVars['--text-code-leading'],
|
|
206
|
-
},
|
|
207
199
|
code: {
|
|
208
200
|
display: 'block',
|
|
209
201
|
flex: 1,
|
|
@@ -222,9 +214,53 @@ const styles = stylex.create({
|
|
|
222
214
|
wordBreak: 'break-all',
|
|
223
215
|
overflowWrap: 'break-word',
|
|
224
216
|
},
|
|
217
|
+
// With line numbers on, the <code> element hosts the full-height divider
|
|
218
|
+
// between the number gutter and the code. It spans the code's block padding
|
|
219
|
+
// too (inset-block: 0), so the rule reaches the top and bottom edges the way
|
|
220
|
+
// the old separate gutter column did. The numbers themselves are drawn per
|
|
221
|
+
// line (see `lineNumbered`) — a separate column can't track wrap height.
|
|
222
|
+
codeNumbered: {
|
|
223
|
+
position: 'relative',
|
|
224
|
+
'::after': {
|
|
225
|
+
content: '""',
|
|
226
|
+
position: 'absolute',
|
|
227
|
+
insetBlock: 0,
|
|
228
|
+
insetInlineStart: `calc(${spacingVars['--spacing-4']} + var(--_codeblock-gutter-width) + ${spacingVars['--spacing-3']})`,
|
|
229
|
+
width: 0,
|
|
230
|
+
borderInlineStartWidth: borderVars['--border-width'],
|
|
231
|
+
borderInlineStartStyle: 'solid',
|
|
232
|
+
borderInlineStartColor: colorVars['--color-border'],
|
|
233
|
+
pointerEvents: 'none',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
225
236
|
line: {
|
|
226
237
|
lineHeight: typeScaleVars['--text-code-leading'],
|
|
227
238
|
},
|
|
239
|
+
// Per-line number gutter: a two-column grid ([number] [code]). The number is
|
|
240
|
+
// a ::before generated from the data-line attribute. Because the number and
|
|
241
|
+
// its code occupy one grid row, the row grows to fit wrapped code while the
|
|
242
|
+
// number stays pinned to the row's first visual line (alignSelf: start) —
|
|
243
|
+
// this is what keeps numbers aligned when isWrapped wraps a line.
|
|
244
|
+
lineNumbered: {
|
|
245
|
+
display: 'grid',
|
|
246
|
+
gridTemplateColumns: 'var(--_codeblock-gutter-width) 1fr',
|
|
247
|
+
columnGap: `calc(${spacingVars['--spacing-3']} + ${borderVars['--border-width']} + ${spacingVars['--spacing-4']})`,
|
|
248
|
+
'::before': {
|
|
249
|
+
content: 'attr(data-line)',
|
|
250
|
+
gridColumn: '1',
|
|
251
|
+
alignSelf: 'start',
|
|
252
|
+
textAlign: 'end',
|
|
253
|
+
color: 'var(--color-syntax-punctuation)',
|
|
254
|
+
userSelect: 'none',
|
|
255
|
+
fontFamily: typographyVars['--font-family-code'],
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
// In span mode the tokens are wrapped in this element so they form a single
|
|
259
|
+
// grid item in column 2 (otherwise each token span would flow into its own
|
|
260
|
+
// grid cell). minWidth:0 lets it shrink so long lines wrap within the track.
|
|
261
|
+
lineContent: {
|
|
262
|
+
minWidth: 0,
|
|
263
|
+
},
|
|
228
264
|
lineChunk: {
|
|
229
265
|
contentVisibility: 'auto',
|
|
230
266
|
},
|
|
@@ -239,12 +275,6 @@ const styles = stylex.create({
|
|
|
239
275
|
sizeMd: {
|
|
240
276
|
fontSize: typeScaleVars['--text-code-size'],
|
|
241
277
|
},
|
|
242
|
-
gutterSm: {
|
|
243
|
-
fontSize: typeScaleVars['--text-supporting-size'],
|
|
244
|
-
},
|
|
245
|
-
gutterMd: {
|
|
246
|
-
fontSize: typeScaleVars['--text-code-size'],
|
|
247
|
-
},
|
|
248
278
|
copyButton: {
|
|
249
279
|
display: 'inline-flex',
|
|
250
280
|
alignItems: 'center',
|
|
@@ -285,11 +315,13 @@ const CodeChunk = React.memo(function CodeChunk({
|
|
|
285
315
|
startIndex,
|
|
286
316
|
highlightSet,
|
|
287
317
|
renderLineContent,
|
|
318
|
+
lineNumbers,
|
|
288
319
|
}: {
|
|
289
320
|
lines: string[];
|
|
290
321
|
startIndex: number;
|
|
291
322
|
highlightSet: Set<number> | null;
|
|
292
323
|
renderLineContent: (line: string, lineIndex: number) => React.ReactNode;
|
|
324
|
+
lineNumbers: boolean;
|
|
293
325
|
}) {
|
|
294
326
|
return (
|
|
295
327
|
<>
|
|
@@ -301,6 +333,7 @@ const CodeChunk = React.memo(function CodeChunk({
|
|
|
301
333
|
data-line={i + 1}
|
|
302
334
|
{...stylex.props(
|
|
303
335
|
styles.line,
|
|
336
|
+
lineNumbers && styles.lineNumbered,
|
|
304
337
|
(highlightSet?.has(i + 1) ?? false) && styles.lineHighlighted,
|
|
305
338
|
)}>
|
|
306
339
|
{renderLineContent(line, i)}
|
|
@@ -315,6 +348,7 @@ function renderLines(
|
|
|
315
348
|
lines: string[],
|
|
316
349
|
highlightSet: Set<number> | null,
|
|
317
350
|
renderLineContent: (line: string, lineIndex: number) => React.ReactNode,
|
|
351
|
+
lineNumbers: boolean,
|
|
318
352
|
chunkSize: number = LINE_CHUNK_SIZE,
|
|
319
353
|
): React.ReactNode {
|
|
320
354
|
chunkSize = Math.max(1, Math.floor(chunkSize));
|
|
@@ -326,6 +360,7 @@ function renderLines(
|
|
|
326
360
|
startIndex={0}
|
|
327
361
|
highlightSet={highlightSet}
|
|
328
362
|
renderLineContent={renderLineContent}
|
|
363
|
+
lineNumbers={lineNumbers}
|
|
329
364
|
/>
|
|
330
365
|
);
|
|
331
366
|
}
|
|
@@ -347,6 +382,7 @@ function renderLines(
|
|
|
347
382
|
startIndex={start}
|
|
348
383
|
highlightSet={highlightSet}
|
|
349
384
|
renderLineContent={renderLineContent}
|
|
385
|
+
lineNumbers={lineNumbers}
|
|
350
386
|
/>
|
|
351
387
|
</div>,
|
|
352
388
|
);
|
|
@@ -542,12 +578,16 @@ function SpanCodeContent({
|
|
|
542
578
|
highlightSet,
|
|
543
579
|
isWrapped,
|
|
544
580
|
sizeStyle,
|
|
581
|
+
hasLineNumbers,
|
|
582
|
+
maxDigits,
|
|
545
583
|
}: {
|
|
546
584
|
lines: string[];
|
|
547
585
|
tokenLines: TokenLine[];
|
|
548
586
|
highlightSet: Set<number> | null;
|
|
549
587
|
isWrapped: boolean;
|
|
550
588
|
sizeStyle: stylex.StyleXStyles;
|
|
589
|
+
hasLineNumbers: boolean;
|
|
590
|
+
maxDigits: number;
|
|
551
591
|
}) {
|
|
552
592
|
useInsertionEffect(() => {
|
|
553
593
|
ensureHighlightStyles();
|
|
@@ -556,7 +596,13 @@ function SpanCodeContent({
|
|
|
556
596
|
const renderLineContent = useCallback(
|
|
557
597
|
(line: string, lineIndex: number): React.ReactNode => {
|
|
558
598
|
const tokens = tokenLines[lineIndex] ?? [];
|
|
559
|
-
|
|
599
|
+
// Wrap tokens in a single element so they occupy one grid cell when line
|
|
600
|
+
// numbers are on (see `lineNumbered`); an inline span is a no-op when off.
|
|
601
|
+
return (
|
|
602
|
+
<span {...stylex.props(styles.lineContent)}>
|
|
603
|
+
{buildSpanLine(line, tokens)}
|
|
604
|
+
</span>
|
|
605
|
+
);
|
|
560
606
|
},
|
|
561
607
|
[tokenLines],
|
|
562
608
|
);
|
|
@@ -567,8 +613,10 @@ function SpanCodeContent({
|
|
|
567
613
|
styles.code,
|
|
568
614
|
sizeStyle,
|
|
569
615
|
isWrapped && styles.codeWrapped,
|
|
616
|
+
hasLineNumbers && styles.codeNumbered,
|
|
617
|
+
hasLineNumbers && dynamicStyles.gutterWidth(maxDigits),
|
|
570
618
|
)}>
|
|
571
|
-
{renderLines(lines, highlightSet, renderLineContent)}
|
|
619
|
+
{renderLines(lines, highlightSet, renderLineContent, hasLineNumbers)}
|
|
572
620
|
</code>
|
|
573
621
|
);
|
|
574
622
|
}
|
|
@@ -583,12 +631,16 @@ function RangeCodeContent({
|
|
|
583
631
|
highlightSet,
|
|
584
632
|
isWrapped,
|
|
585
633
|
sizeStyle,
|
|
634
|
+
hasLineNumbers,
|
|
635
|
+
maxDigits,
|
|
586
636
|
}: {
|
|
587
637
|
lines: string[];
|
|
588
638
|
tokenLines: TokenLine[];
|
|
589
639
|
highlightSet: Set<number> | null;
|
|
590
640
|
isWrapped: boolean;
|
|
591
641
|
sizeStyle: stylex.StyleXStyles;
|
|
642
|
+
hasLineNumbers: boolean;
|
|
643
|
+
maxDigits: number;
|
|
592
644
|
}) {
|
|
593
645
|
const codeRef = useRef<HTMLElement>(null);
|
|
594
646
|
|
|
@@ -606,6 +658,9 @@ function RangeCodeContent({
|
|
|
606
658
|
return applyHighlightRangesChunked(codeEl, tokenLines);
|
|
607
659
|
}, [tokenLines]);
|
|
608
660
|
|
|
661
|
+
// Range mode keeps the line's text as a bare text node (its firstChild) so
|
|
662
|
+
// applyHighlightRangesChunked can map token offsets onto it \u2014 no wrapper. The
|
|
663
|
+
// number ::before is a pseudo-element, so it never becomes a child node here.
|
|
609
664
|
const renderLineContent = useCallback(
|
|
610
665
|
(line: string): React.ReactNode => line || '\u200b',
|
|
611
666
|
[],
|
|
@@ -618,8 +673,10 @@ function RangeCodeContent({
|
|
|
618
673
|
styles.code,
|
|
619
674
|
sizeStyle,
|
|
620
675
|
isWrapped && styles.codeWrapped,
|
|
676
|
+
hasLineNumbers && styles.codeNumbered,
|
|
677
|
+
hasLineNumbers && dynamicStyles.gutterWidth(maxDigits),
|
|
621
678
|
)}>
|
|
622
|
-
{renderLines(lines, highlightSet, renderLineContent)}
|
|
679
|
+
{renderLines(lines, highlightSet, renderLineContent, hasLineNumbers)}
|
|
623
680
|
</code>
|
|
624
681
|
);
|
|
625
682
|
}
|
|
@@ -662,6 +719,7 @@ export function CodeBlock({
|
|
|
662
719
|
ref,
|
|
663
720
|
...props
|
|
664
721
|
}: CodeBlockProps) {
|
|
722
|
+
const t = useTranslator();
|
|
665
723
|
const [copied, setCopied] = useState(false);
|
|
666
724
|
const copyResetTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
667
725
|
const announce = useAnnounce();
|
|
@@ -718,7 +776,8 @@ export function CodeBlock({
|
|
|
718
776
|
}, [code, onCopy, announce]);
|
|
719
777
|
|
|
720
778
|
const sizeStyle = size === 'sm' ? styles.sizeSm : styles.sizeMd;
|
|
721
|
-
|
|
779
|
+
// Digits in the largest line number — sizes the gutter column width.
|
|
780
|
+
const maxLineDigits = String(lines.length).length;
|
|
722
781
|
const languageLabel =
|
|
723
782
|
hasLanguageLabel && language !== 'plaintext' ? language : null;
|
|
724
783
|
const showHeader = title != null || languageLabel != null;
|
|
@@ -748,7 +807,7 @@ export function CodeBlock({
|
|
|
748
807
|
e.stopPropagation();
|
|
749
808
|
void handleCopy();
|
|
750
809
|
}}
|
|
751
|
-
aria-label={copied ? '
|
|
810
|
+
aria-label={copied ? t('@astryx.codeBlock.copied') : t('@astryx.codeBlock.copyCode')}
|
|
752
811
|
{...stylex.props(
|
|
753
812
|
styles.copyButton,
|
|
754
813
|
!showHeader && styles.copyButtonAbsolute,
|
|
@@ -811,7 +870,7 @@ export function CodeBlock({
|
|
|
811
870
|
// create duplicate same-named landmarks (axe: landmark-unique).
|
|
812
871
|
tabIndex={0}
|
|
813
872
|
role="group"
|
|
814
|
-
aria-label={languageLabel ?? '
|
|
873
|
+
aria-label={languageLabel ?? t('@astryx.codeBlock.code')}
|
|
815
874
|
{...mergeProps(stylex.props(styles.scrollContainer), {
|
|
816
875
|
style: scrollStyle,
|
|
817
876
|
})}>
|
|
@@ -820,18 +879,6 @@ export function CodeBlock({
|
|
|
820
879
|
styles.codeWrapper,
|
|
821
880
|
showHeader && !hasLineNumbers && styles.codeWrapperCompact,
|
|
822
881
|
)}>
|
|
823
|
-
{hasLineNumbers && (
|
|
824
|
-
<div
|
|
825
|
-
{...stylex.props(styles.gutter, gutterSizeStyle)}
|
|
826
|
-
aria-hidden="true">
|
|
827
|
-
{lines.map((_, i) => (
|
|
828
|
-
// eslint-disable-next-line @eslint-react/no-array-index-key -- gutter line numbers are positional by definition
|
|
829
|
-
<div key={i} {...stylex.props(styles.gutterLine)}>
|
|
830
|
-
{i + 1}
|
|
831
|
-
</div>
|
|
832
|
-
))}
|
|
833
|
-
</div>
|
|
834
|
-
)}
|
|
835
882
|
{useSpans ? (
|
|
836
883
|
<SpanCodeContent
|
|
837
884
|
lines={lines}
|
|
@@ -839,6 +886,8 @@ export function CodeBlock({
|
|
|
839
886
|
highlightSet={highlightSet}
|
|
840
887
|
isWrapped={isWrapped}
|
|
841
888
|
sizeStyle={sizeStyle}
|
|
889
|
+
hasLineNumbers={hasLineNumbers}
|
|
890
|
+
maxDigits={maxLineDigits}
|
|
842
891
|
/>
|
|
843
892
|
) : (
|
|
844
893
|
<RangeCodeContent
|
|
@@ -847,6 +896,8 @@ export function CodeBlock({
|
|
|
847
896
|
highlightSet={highlightSet}
|
|
848
897
|
isWrapped={isWrapped}
|
|
849
898
|
sizeStyle={sizeStyle}
|
|
899
|
+
hasLineNumbers={hasLineNumbers}
|
|
900
|
+
maxDigits={maxLineDigits}
|
|
850
901
|
/>
|
|
851
902
|
)}
|
|
852
903
|
</div>
|
|
@@ -70,7 +70,7 @@ export const docs = {
|
|
|
70
70
|
usage: {
|
|
71
71
|
description: 'Collapsible hides and reveals content behind a trigger button. Use it in settings panels, FAQ pages, or detail views to keep the page scannable while letting users drill into sections they care about. Wrap multiple collapsibles in CollapsibleGroup for accordion behavior. For custom collapsible components, use the `useCollapsible` hook directly (`astryx hook useCollapsible`).',
|
|
72
72
|
bestPractices: [
|
|
73
|
-
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists
|
|
73
|
+
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists: built-in row hairlines with themed border tokens, no hand-rolled borders.' },
|
|
74
74
|
{ guidance: true, description: 'Wrap each Collapsible in an Card for visual separation in accordion layouts, or use CollapsibleGroup\'s hasDividers for flat lists; don\'t combine both.' },
|
|
75
75
|
{ guidance: true, description: 'Use CollapsibleGroup with type="single" for settings or FAQ pages where only one section should be open at a time.' },
|
|
76
76
|
{ guidance: true, description: 'Use type="multiple" when users need to compare content across sections, like feature lists or pricing tiers.' },
|
|
@@ -92,7 +92,7 @@ export const docsZh = {
|
|
|
92
92
|
usage: {
|
|
93
93
|
description: 'Collapsible hides and reveals content behind a trigger button. Use it in settings panels, FAQ pages, or detail views to keep the page scannable while letting users drill into sections they care about. Wrap multiple collapsibles in CollapsibleGroup for accordion behavior.',
|
|
94
94
|
bestPractices: [
|
|
95
|
-
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists
|
|
95
|
+
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists: built-in row hairlines with themed border tokens, no hand-rolled borders.' },
|
|
96
96
|
{ guidance: true, description: 'Wrap each Collapsible in an Card for visual separation in accordion layouts, or use CollapsibleGroup\'s hasDividers for flat lists; don\'t combine both.' },
|
|
97
97
|
{ guidance: true, description: 'Use CollapsibleGroup with type="single" for settings or FAQ pages where only one section should be open at a time.' },
|
|
98
98
|
{ guidance: true, description: 'Use type="multiple" when users need to compare content across sections, like feature lists or pricing tiers.' },
|
|
@@ -110,7 +110,7 @@ export const docsDense = {
|
|
|
110
110
|
usage: {
|
|
111
111
|
description: 'Collapsible hides and reveals content behind a trigger button. Use in settings, FAQs, or detail views. Wrap in CollapsibleGroup for accordion behavior.',
|
|
112
112
|
bestPractices: [
|
|
113
|
-
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists
|
|
113
|
+
{ guidance: true, description: 'Use hasDividers on CollapsibleGroup for FAQ-style lists: built-in row hairlines, no hand-rolled borders.' },
|
|
114
114
|
{ guidance: true, description: 'Wrap each Collapsible in an Card for visual separation, or use CollapsibleGroup\'s hasDividers for flat lists; not both.' },
|
|
115
115
|
{ guidance: true, description: 'Use CollapsibleGroup with type="single" for settings or FAQ pages where only one section should be open at a time.' },
|
|
116
116
|
{ guidance: true, description: 'Use type="multiple" when users need to compare across sections.' },
|
|
@@ -36,6 +36,7 @@ import {CommandPaletteInput} from './CommandPaletteInput';
|
|
|
36
36
|
import {CommandPaletteFooter} from './CommandPaletteFooter';
|
|
37
37
|
import {CommandPaletteEmpty} from './CommandPaletteEmpty';
|
|
38
38
|
import type {BaseProps} from '../BaseProps';
|
|
39
|
+
import {useTranslator} from '../i18n';
|
|
39
40
|
|
|
40
41
|
export interface CommandPaletteProps<
|
|
41
42
|
T extends SearchableItem = SearchableItem,
|
|
@@ -260,14 +261,20 @@ export function CommandPalette<T extends SearchableItem = SearchableItem>({
|
|
|
260
261
|
input,
|
|
261
262
|
footer,
|
|
262
263
|
renderItem,
|
|
263
|
-
emptySearchText
|
|
264
|
-
emptyBootstrapText
|
|
264
|
+
emptySearchText: emptySearchTextFromProps,
|
|
265
|
+
emptyBootstrapText: emptyBootstrapTextFromProps,
|
|
265
266
|
value: controlledValue,
|
|
266
267
|
onValueChange,
|
|
267
|
-
label
|
|
268
|
+
label: labelFromProps,
|
|
268
269
|
width = 640,
|
|
269
270
|
maxHeight = 480,
|
|
270
271
|
}: CommandPaletteProps<T>) {
|
|
272
|
+
const t = useTranslator();
|
|
273
|
+
const label = labelFromProps ?? t('@astryx.commandPalette.label');
|
|
274
|
+
const emptySearchText =
|
|
275
|
+
emptySearchTextFromProps ?? t('@astryx.commandPalette.emptySearch');
|
|
276
|
+
const emptyBootstrapText =
|
|
277
|
+
emptyBootstrapTextFromProps ?? t('@astryx.commandPalette.emptyBootstrap');
|
|
271
278
|
const listId = useId();
|
|
272
279
|
// search: the committed query — only advances when async results arrive.
|
|
273
280
|
// optimisticSearch: updates immediately on keystroke, drives input + empty state.
|
|
@@ -17,7 +17,7 @@ import type {CommandPaletteContextValue} from './CommandPaletteContext';
|
|
|
17
17
|
describe('CommandPaletteInput', () => {
|
|
18
18
|
it('renders with default placeholder', () => {
|
|
19
19
|
render(<CommandPaletteInput />);
|
|
20
|
-
expect(screen.getByPlaceholderText('Search
|
|
20
|
+
expect(screen.getByPlaceholderText('Search…')).toBeInTheDocument();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
it('renders with custom placeholder', () => {
|
|
@@ -27,6 +27,7 @@ import {useCommandPaletteContext} from './CommandPaletteContext';
|
|
|
27
27
|
import {useDialogContext} from '../Dialog/DialogContext';
|
|
28
28
|
import type {BaseProps} from '../BaseProps';
|
|
29
29
|
import {themeProps} from '../utils/themeProps';
|
|
30
|
+
import {useTranslator} from '../i18n';
|
|
30
31
|
|
|
31
32
|
const styles = stylex.create({
|
|
32
33
|
wrapper: {
|
|
@@ -147,7 +148,7 @@ export interface CommandPaletteInputProps extends Omit<
|
|
|
147
148
|
export function CommandPaletteInput({
|
|
148
149
|
value: controlledValue,
|
|
149
150
|
onValueChange,
|
|
150
|
-
placeholder
|
|
151
|
+
placeholder: placeholderFromProps,
|
|
151
152
|
hasAutoFocus = true,
|
|
152
153
|
endContent,
|
|
153
154
|
onChange,
|
|
@@ -156,6 +157,9 @@ export function CommandPaletteInput({
|
|
|
156
157
|
xstyle,
|
|
157
158
|
...props
|
|
158
159
|
}: CommandPaletteInputProps) {
|
|
160
|
+
const t = useTranslator();
|
|
161
|
+
const placeholder =
|
|
162
|
+
placeholderFromProps ?? t('@astryx.commandPalette.input.placeholder');
|
|
159
163
|
const ctx = useCommandPaletteContext();
|
|
160
164
|
const dialogContext = useDialogContext();
|
|
161
165
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
@@ -20,6 +20,7 @@ import {mergeProps} from '../utils';
|
|
|
20
20
|
import {spacingVars} from '../theme/tokens.stylex';
|
|
21
21
|
import {useCommandPaletteContext} from './CommandPaletteContext';
|
|
22
22
|
import {themeProps} from '../utils/themeProps';
|
|
23
|
+
import {useTranslator} from '../i18n';
|
|
23
24
|
|
|
24
25
|
const styles = stylex.create({
|
|
25
26
|
list: {
|
|
@@ -72,13 +73,15 @@ export interface CommandPaletteListProps extends BaseProps<HTMLDivElement> {
|
|
|
72
73
|
*/
|
|
73
74
|
export function CommandPaletteList({
|
|
74
75
|
children,
|
|
75
|
-
label
|
|
76
|
+
label: labelFromProps,
|
|
76
77
|
ref,
|
|
77
78
|
xstyle,
|
|
78
79
|
className,
|
|
79
80
|
style,
|
|
80
81
|
...props
|
|
81
82
|
}: CommandPaletteListProps) {
|
|
83
|
+
const t = useTranslator();
|
|
84
|
+
const label = labelFromProps ?? t('@astryx.commandPalette.list.label');
|
|
82
85
|
const ctx = useCommandPaletteContext();
|
|
83
86
|
|
|
84
87
|
return (
|
|
@@ -62,6 +62,7 @@ import {mergeProps, mergeRefs} from '../utils';
|
|
|
62
62
|
import type {BaseProps} from '../BaseProps';
|
|
63
63
|
import type {StyleXStyles} from '../theme/types';
|
|
64
64
|
import {themeProps} from '../utils/themeProps';
|
|
65
|
+
import {useTranslator} from '../i18n';
|
|
65
66
|
import type {
|
|
66
67
|
DropdownMenuOption,
|
|
67
68
|
DropdownMenuItemData,
|
|
@@ -205,7 +206,7 @@ export function ContextMenu({
|
|
|
205
206
|
children,
|
|
206
207
|
menuWidth,
|
|
207
208
|
size = 'md',
|
|
208
|
-
label
|
|
209
|
+
label: labelFromProps,
|
|
209
210
|
isDisabled = false,
|
|
210
211
|
onOpenChange,
|
|
211
212
|
ref,
|
|
@@ -216,6 +217,8 @@ export function ContextMenu({
|
|
|
216
217
|
'data-testid': testId,
|
|
217
218
|
...props
|
|
218
219
|
}: ContextMenuProps) {
|
|
220
|
+
const t = useTranslator();
|
|
221
|
+
const label = labelFromProps ?? t('@astryx.contextMenu.label');
|
|
219
222
|
const items = ('items' in props ? props.items : undefined) ?? [];
|
|
220
223
|
const menuContent = 'menuContent' in props ? props.menuContent : undefined;
|
|
221
224
|
|
|
@@ -111,7 +111,7 @@ export const docs = {
|
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: 'status',
|
|
114
|
-
type: '
|
|
114
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
115
115
|
description:
|
|
116
116
|
'Status indicator object for error, warning, or success states with a message.',
|
|
117
117
|
},
|
|
@@ -374,7 +374,7 @@ export const docsZh = {
|
|
|
374
374
|
},
|
|
375
375
|
{
|
|
376
376
|
name: 'status',
|
|
377
|
-
type: '
|
|
377
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
378
378
|
description: '错误、警告或成功状态的状态指示对象,附带消息。',
|
|
379
379
|
},
|
|
380
380
|
{
|