@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
|
@@ -45,12 +45,9 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
45
45
|
import {colorVars} from '../../../theme/tokens.stylex';
|
|
46
46
|
import {CheckboxInput} from '../../../CheckboxInput';
|
|
47
47
|
import {mergeRefs} from '../../../utils';
|
|
48
|
-
import type {
|
|
49
|
-
TablePlugin,
|
|
50
|
-
TableColumn,
|
|
51
|
-
BodyRowRenderProps,
|
|
52
|
-
} from '../../types';
|
|
48
|
+
import type {TablePlugin, TableColumn, BodyRowRenderProps} from '../../types';
|
|
53
49
|
import {pixel} from '../../columnUtils';
|
|
50
|
+
import {useTranslator} from '../../../i18n';
|
|
54
51
|
|
|
55
52
|
// =============================================================================
|
|
56
53
|
// Config Type
|
|
@@ -181,6 +178,7 @@ function SelectAllCheckboxInner<T extends Record<string, unknown>>({
|
|
|
181
178
|
}: {
|
|
182
179
|
store: SelectionStore<T>;
|
|
183
180
|
}) {
|
|
181
|
+
const t = useTranslator();
|
|
184
182
|
const getSnapshot = useCallback(() => {
|
|
185
183
|
const config = store.getConfig();
|
|
186
184
|
const allSelected = config.getIsAllSelected();
|
|
@@ -197,7 +195,7 @@ function SelectAllCheckboxInner<T extends Record<string, unknown>>({
|
|
|
197
195
|
|
|
198
196
|
return (
|
|
199
197
|
<CheckboxInput
|
|
200
|
-
label=
|
|
198
|
+
label={t('@astryx.table.selection.selectAllRows')}
|
|
201
199
|
isLabelHidden
|
|
202
200
|
value={allSelected ? true : indeterminate ? 'indeterminate' : false}
|
|
203
201
|
onChange={() =>
|
|
@@ -232,6 +230,7 @@ function SelectionCellContentInner<T extends Record<string, unknown>>({
|
|
|
232
230
|
store: SelectionStore<T>;
|
|
233
231
|
item: T;
|
|
234
232
|
}) {
|
|
233
|
+
const t = useTranslator();
|
|
235
234
|
const config = store.getConfig();
|
|
236
235
|
const isSelected = useIsItemSelected(store, item);
|
|
237
236
|
const selectable = config.getIsItemSelectable?.(item) ?? true;
|
|
@@ -243,7 +242,7 @@ function SelectionCellContentInner<T extends Record<string, unknown>>({
|
|
|
243
242
|
|
|
244
243
|
return (
|
|
245
244
|
<CheckboxInput
|
|
246
|
-
label=
|
|
245
|
+
label={t('@astryx.table.selection.selectRow')}
|
|
247
246
|
isLabelHidden
|
|
248
247
|
value={isSelected}
|
|
249
248
|
onChange={() =>
|
|
@@ -18,6 +18,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
18
18
|
import {colorVars, spacingVars, radiusVars} from '../../../theme/tokens.stylex';
|
|
19
19
|
import {Icon} from '../../../Icon';
|
|
20
20
|
import {resolveContextActions} from '../../tableContextMenu';
|
|
21
|
+
import {useTranslator} from '../../../i18n';
|
|
21
22
|
import type {
|
|
22
23
|
TablePlugin,
|
|
23
24
|
HeaderCellRenderProps,
|
|
@@ -344,6 +345,7 @@ export function useTableSortable<
|
|
|
344
345
|
T extends Record<string, unknown>,
|
|
345
346
|
TSortKey extends string = string,
|
|
346
347
|
>(config: UseTableSortableConfig<TSortKey>): TablePlugin<T> {
|
|
348
|
+
const t = useTranslator();
|
|
347
349
|
const configRef = useRef(config);
|
|
348
350
|
configRef.current = config;
|
|
349
351
|
|
|
@@ -367,12 +369,13 @@ export function useTableSortable<
|
|
|
367
369
|
// checked/clear state always reflects the latest sort.
|
|
368
370
|
const getSortActions = (): TableContextAction[] => {
|
|
369
371
|
const c = configRef.current;
|
|
370
|
-
const dir =
|
|
372
|
+
const dir =
|
|
373
|
+
c.sort.find(e => e.sortKey === sortKey)?.direction ?? null;
|
|
371
374
|
const actions: TableContextAction[] = [
|
|
372
375
|
{
|
|
373
376
|
id: 'sort-asc',
|
|
374
377
|
group: 'sort',
|
|
375
|
-
label: '
|
|
378
|
+
label: t('@astryx.table.sort.ascending'),
|
|
376
379
|
icon: <Icon icon="arrowUp" size="xsm" aria-hidden />,
|
|
377
380
|
checked: dir === 'ascending',
|
|
378
381
|
onSelect: () =>
|
|
@@ -383,7 +386,7 @@ export function useTableSortable<
|
|
|
383
386
|
{
|
|
384
387
|
id: 'sort-desc',
|
|
385
388
|
group: 'sort',
|
|
386
|
-
label: '
|
|
389
|
+
label: t('@astryx.table.sort.descending'),
|
|
387
390
|
icon: <Icon icon="arrowDown" size="xsm" aria-hidden />,
|
|
388
391
|
checked: dir === 'descending',
|
|
389
392
|
onSelect: () =>
|
|
@@ -396,7 +399,7 @@ export function useTableSortable<
|
|
|
396
399
|
actions.push({
|
|
397
400
|
id: 'sort-clear',
|
|
398
401
|
group: 'sort-clear',
|
|
399
|
-
label: '
|
|
402
|
+
label: t('@astryx.table.sort.clear'),
|
|
400
403
|
icon: <Icon icon="close" size="xsm" aria-hidden />,
|
|
401
404
|
onSelect: () =>
|
|
402
405
|
c.onSortChange(c.sort.filter(e => e.sortKey !== sortKey)),
|
|
@@ -430,6 +433,6 @@ export function useTableSortable<
|
|
|
430
433
|
};
|
|
431
434
|
},
|
|
432
435
|
}),
|
|
433
|
-
[],
|
|
436
|
+
[t],
|
|
434
437
|
);
|
|
435
438
|
}
|
|
@@ -23,7 +23,7 @@ export const docs = {
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: 'variant',
|
|
26
|
-
type: "'popover' | 'inline'",
|
|
26
|
+
type: "'popover' | 'inline' | 'inline-compact'",
|
|
27
27
|
description: 'Display variant for filter controls.',
|
|
28
28
|
default: "'popover'",
|
|
29
29
|
},
|
|
@@ -50,7 +50,7 @@ export const docsZh = {
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
name: 'variant',
|
|
53
|
-
type: "'popover' | 'inline'",
|
|
53
|
+
type: "'popover' | 'inline' | 'inline-compact'",
|
|
54
54
|
description: '筛选控件的显示变体。',
|
|
55
55
|
default: "'popover'",
|
|
56
56
|
},
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'useTableGroupedRows',
|
|
7
|
+
subComponentOf: 'Table',
|
|
8
|
+
displayName: 'useTableGroupedRows',
|
|
9
|
+
description:
|
|
10
|
+
'Hook that groups a flat data array into collapsible section rows. Each distinct groupBy value becomes a full-width section-header row with a chevron toggle, the group label, and a member count; collapsing hides that group\'s data rows while keeping the header visible. Mirrors useTableRowExpansionState: the consumer owns the collapsedGroups set and the hook returns {data, plugin, idKey}: pass all three to Table (data, plugins, and idKey respectively).',
|
|
11
|
+
props: [
|
|
12
|
+
{
|
|
13
|
+
name: 'data',
|
|
14
|
+
type: 'T[]',
|
|
15
|
+
description: 'The flat data to group.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'groupBy',
|
|
20
|
+
type: '(item: T) => string',
|
|
21
|
+
description:
|
|
22
|
+
'Derive the group key for a row. Rows with the same key share a section.',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'collapsedGroups',
|
|
27
|
+
type: 'Set<string>',
|
|
28
|
+
description: 'Set of currently-collapsed group keys.',
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'onToggleGroup',
|
|
33
|
+
type: '(groupKey: string) => void',
|
|
34
|
+
description: 'Called with a group key when its header is toggled.',
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'renderGroupHeader',
|
|
39
|
+
type: '(groupKey: string, count: number, collapsed: boolean) => ReactNode',
|
|
40
|
+
description:
|
|
41
|
+
"Custom renderer for a group header's content (right of the chevron). Defaults to `<groupKey> (<count>)`.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'getRowKey',
|
|
45
|
+
type: '(item: T) => string',
|
|
46
|
+
description:
|
|
47
|
+
'Stable key for a real row. Falls back to a positional key when omitted.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'groupOrder',
|
|
51
|
+
type: 'string[]',
|
|
52
|
+
description:
|
|
53
|
+
'Explicit group ordering; groups not listed keep first-seen order after these.',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @type {import('../docs-types').TranslationDoc} */
|
|
59
|
+
export const docsDense = {
|
|
60
|
+
description:
|
|
61
|
+
'Groups a flat data array into collapsible section rows. Each groupBy value becomes a full-width header (chevron + label + count); collapsing hides its rows. Returns {data, plugin, idKey}: pass to Table data / plugins / idKey. Consumer owns the collapsedGroups set.',
|
|
62
|
+
propDescriptions: {
|
|
63
|
+
data: 'The flat data to group.',
|
|
64
|
+
groupBy: 'Derive a row\'s group key. Same key = same section.',
|
|
65
|
+
collapsedGroups: 'Set of currently-collapsed group keys.',
|
|
66
|
+
onToggleGroup: 'Called with the group key when a header is toggled.',
|
|
67
|
+
renderGroupHeader: "Custom header content (right of chevron). Default '<key> (<count>)'.",
|
|
68
|
+
getRowKey: 'Stable key for a real row; positional fallback when omitted.',
|
|
69
|
+
groupOrder: 'Pin these group keys first; others keep first-seen order.',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'useTableRowIndex',
|
|
7
|
+
subComponentOf: 'Table',
|
|
8
|
+
displayName: 'useTableRowIndex',
|
|
9
|
+
description:
|
|
10
|
+
'Hook that returns a TablePlugin which prepends a right-aligned, monospaced row-number column. Numbering follows the rendered data order (reflecting the current sort / filter / pagination view) and starts at 1 by default. Astryx renderCell receives only the row item, so the plugin takes the rendered data array to derive each ordinal.',
|
|
11
|
+
props: [
|
|
12
|
+
{
|
|
13
|
+
name: 'data',
|
|
14
|
+
type: 'T[]',
|
|
15
|
+
description:
|
|
16
|
+
'The data array currently rendered by the table (post sort/filter/page). Numbering follows this order.',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'getRowKey',
|
|
21
|
+
type: '(item: T) => string',
|
|
22
|
+
description:
|
|
23
|
+
'Optional key extractor returning a unique string per row. When provided, index lookup is keyed by the returned string; otherwise items are matched by reference identity. Memoize with useCallback for a stable plugin identity.',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'label',
|
|
27
|
+
type: 'ReactNode',
|
|
28
|
+
description: 'Header label for the index column.',
|
|
29
|
+
default: "'#'",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'startFrom',
|
|
33
|
+
type: 'number',
|
|
34
|
+
description: 'First index value.',
|
|
35
|
+
default: '1',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @type {import('../docs-types').TranslationDoc} */
|
|
41
|
+
export const docsDense = {
|
|
42
|
+
description:
|
|
43
|
+
'Returns a TablePlugin that prepends a right-aligned monospaced row-number column. Numbering follows the rendered data order (current sort/filter/page view), 1-based by default. Pass the rendered data array; renderCell only receives the item so the plugin derives ordinals from it.',
|
|
44
|
+
propDescriptions: {
|
|
45
|
+
data: 'The rendered data array (post sort/filter/page). Numbering follows this order.',
|
|
46
|
+
getRowKey: 'Optional key extractor returning a unique string per row; otherwise items match by reference.',
|
|
47
|
+
label: "Header label for the index column. Default '#'.",
|
|
48
|
+
startFrom: 'First index value. Default 1.',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -13,20 +13,20 @@ export const docs = {
|
|
|
13
13
|
props: [
|
|
14
14
|
{
|
|
15
15
|
name: 'sort',
|
|
16
|
-
type:
|
|
17
|
-
description:
|
|
16
|
+
type: "Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>",
|
|
17
|
+
description: "Current sort state (TableSortState<TSortKey>). Ordered array of entries; the first is the primary sort, the rest are tiebreakers. An empty array means unsorted. Direction is the full word — 'ascending' / 'descending', not 'asc' / 'desc'.",
|
|
18
18
|
required: true,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
name: 'onSortChange',
|
|
22
|
-
type:
|
|
23
|
-
description: 'Called when the user clicks a header cell to change sort.',
|
|
22
|
+
type: "(sort: Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>) => void",
|
|
23
|
+
description: 'Called when the user clicks a header cell to change sort. Receives the next sort state.',
|
|
24
24
|
required: true,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: 'allowUnsortedState',
|
|
28
28
|
type: 'boolean',
|
|
29
|
-
description:
|
|
29
|
+
description: "Allow cycling back to unsorted. When true: 'ascending', 'descending', unsorted. When false: 'ascending', 'descending', 'ascending'.",
|
|
30
30
|
default: 'false',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -45,20 +45,20 @@ export const docsZh = {
|
|
|
45
45
|
props: [
|
|
46
46
|
{
|
|
47
47
|
name: 'sort',
|
|
48
|
-
type:
|
|
49
|
-
description:
|
|
48
|
+
type: "Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>",
|
|
49
|
+
description: "当前排序状态。{sortKey, direction} 条目的有序数组。第一个条目是主排序。方向值为完整单词 'ascending' / 'descending',不是 'asc' / 'desc'。",
|
|
50
50
|
required: true,
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'onSortChange',
|
|
54
|
-
type:
|
|
54
|
+
type: "(sort: Array<{sortKey: TSortKey, direction: 'ascending' | 'descending'}>) => void",
|
|
55
55
|
description: '用户点击表头单元格更改排序时调用。',
|
|
56
56
|
required: true,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: 'allowUnsortedState',
|
|
60
60
|
type: 'boolean',
|
|
61
|
-
description:
|
|
61
|
+
description: "允许循环回到未排序状态。为 true 时:'ascending'、'descending'、未排序。为 false 时:'ascending'、'descending'、'ascending'。",
|
|
62
62
|
default: 'false',
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -75,9 +75,9 @@ export const docsDense = {
|
|
|
75
75
|
displayName: 'useTableSortable',
|
|
76
76
|
description: 'Headless multi-sort plugin. Consumer owns sort state + callback. Shift+click for secondary sort. Sort indicators auto-render in header cells.',
|
|
77
77
|
propDescriptions: {
|
|
78
|
-
sort:
|
|
78
|
+
sort: "Current sort state; ordered array of {sortKey, direction: 'ascending'|'descending'} entries. Not 'asc'/'desc'.",
|
|
79
79
|
onSortChange: 'Called on header click to change sort.',
|
|
80
|
-
allowUnsortedState:
|
|
80
|
+
allowUnsortedState: "Allow cycling to unsorted. true: ascending>descending>unsorted. false: ascending>descending>ascending.",
|
|
81
81
|
isMultiSortEnabled: 'Enable multi-sort via Shift+click. Regular click replaces sort state.',
|
|
82
82
|
},
|
|
83
83
|
};
|
package/src/Text/Text.doc.mjs
CHANGED
|
@@ -23,8 +23,8 @@ export const docs = {
|
|
|
23
23
|
props: [
|
|
24
24
|
{
|
|
25
25
|
name: 'type',
|
|
26
|
-
type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3'",
|
|
27
|
-
description:
|
|
26
|
+
type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3' | 'inherit'",
|
|
27
|
+
description: "Semantic text type. Determines size, weight, and line-height from the theme. 'inherit' takes all three from the surrounding text instead. Themes may add custom types. Note: this prop is called `type`, not `variant`.",
|
|
28
28
|
default: "'body'",
|
|
29
29
|
},
|
|
30
30
|
{
|
|
@@ -123,6 +123,7 @@ import {useInputGroup} from '../InputGroup/InputGroupContext';
|
|
|
123
123
|
import type {BaseProps} from '../BaseProps';
|
|
124
124
|
import type {SizeValue} from '../utils/types';
|
|
125
125
|
import {themeProps} from '../utils/themeProps';
|
|
126
|
+
import {useTranslator} from '../i18n';
|
|
126
127
|
|
|
127
128
|
export type TextInputType = 'text' | 'password' | 'email';
|
|
128
129
|
|
|
@@ -298,6 +299,7 @@ export function TextInput({
|
|
|
298
299
|
ref,
|
|
299
300
|
...rest
|
|
300
301
|
}: TextInputProps) {
|
|
302
|
+
const t = useTranslator();
|
|
301
303
|
const size = useSize(sizeProp, 'md');
|
|
302
304
|
|
|
303
305
|
const id = useId();
|
|
@@ -448,7 +450,7 @@ export function TextInput({
|
|
|
448
450
|
<button
|
|
449
451
|
type="button"
|
|
450
452
|
onClick={handleClear}
|
|
451
|
-
aria-label={
|
|
453
|
+
aria-label={t('@astryx.textInput.clearLabel', {label})}
|
|
452
454
|
{...stylex.props(styles.clearButton)}>
|
|
453
455
|
<Icon icon="close" size="sm" color="secondary" />
|
|
454
456
|
</button>
|
|
@@ -40,6 +40,7 @@ import {useImageMode} from '../hooks/useImageMode';
|
|
|
40
40
|
import type {BaseProps} from '../BaseProps';
|
|
41
41
|
import {mergeProps} from '../utils';
|
|
42
42
|
import {themeProps} from '../utils/themeProps';
|
|
43
|
+
import {useTranslator} from '../i18n';
|
|
43
44
|
|
|
44
45
|
/** Sample the region behind the remove button (20px button, 4px inset, in 64px container). */
|
|
45
46
|
const BUTTON_REGION = {x: 0.5, y: 0.06, width: 0.44, height: 0.44};
|
|
@@ -252,6 +253,7 @@ export function Thumbnail({
|
|
|
252
253
|
ref,
|
|
253
254
|
...props
|
|
254
255
|
}: ThumbnailProps) {
|
|
256
|
+
const t = useTranslator();
|
|
255
257
|
const imageMode = useImageMode(src, {region: BUTTON_REGION, fallback: null});
|
|
256
258
|
|
|
257
259
|
const hasSrc = src != null;
|
|
@@ -281,7 +283,7 @@ export function Thumbnail({
|
|
|
281
283
|
onRemove != null && !isDisabled ? (
|
|
282
284
|
<Button
|
|
283
285
|
icon={<Icon icon="close" size="xsm" />}
|
|
284
|
-
label={
|
|
286
|
+
label={t('@astryx.thumbnail.remove', {accessibleName})}
|
|
285
287
|
variant="secondary"
|
|
286
288
|
size="sm"
|
|
287
289
|
isIconOnly
|
|
@@ -315,7 +317,7 @@ export function Thumbnail({
|
|
|
315
317
|
<button
|
|
316
318
|
type="button"
|
|
317
319
|
onClick={onClick}
|
|
318
|
-
aria-label={
|
|
320
|
+
aria-label={t('@astryx.thumbnail.open', {accessibleName})}
|
|
319
321
|
{...stylex.props(styles.interactiveButton)}>
|
|
320
322
|
{imageContent}
|
|
321
323
|
</button>
|
|
@@ -225,7 +225,7 @@ export const docs = {
|
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
name: 'status',
|
|
228
|
-
type: '
|
|
228
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
229
229
|
description:
|
|
230
230
|
'Status indicator that colors the border and displays an icon. When a message is provided it is rendered below the input.',
|
|
231
231
|
},
|
|
@@ -368,7 +368,7 @@ export const docsZh = {
|
|
|
368
368
|
},
|
|
369
369
|
{
|
|
370
370
|
name: 'status',
|
|
371
|
-
type: '
|
|
371
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
372
372
|
description:
|
|
373
373
|
'为边框着色并显示图标的状态指示器。当提供消息时,消息渲染在输入框下方。',
|
|
374
374
|
},
|
|
@@ -69,6 +69,7 @@ import {useInputGroup} from '../InputGroup/InputGroupContext';
|
|
|
69
69
|
import {groupStyles} from '../InputGroup/groupStyles';
|
|
70
70
|
import {useTooltip} from '../Tooltip';
|
|
71
71
|
import {themeProps} from '../utils/themeProps';
|
|
72
|
+
import {useTranslator} from '../i18n';
|
|
72
73
|
|
|
73
74
|
const styles = stylex.create({
|
|
74
75
|
icon: {
|
|
@@ -341,7 +342,7 @@ export function TimeInput({
|
|
|
341
342
|
hasAutoFocus = false,
|
|
342
343
|
hourFormat = '12h',
|
|
343
344
|
increment = 1,
|
|
344
|
-
placeholder
|
|
345
|
+
placeholder: placeholderFromProps,
|
|
345
346
|
size: sizeProp,
|
|
346
347
|
status,
|
|
347
348
|
labelTooltip,
|
|
@@ -351,6 +352,9 @@ export function TimeInput({
|
|
|
351
352
|
style,
|
|
352
353
|
ref,
|
|
353
354
|
}: TimeInputProps) {
|
|
355
|
+
const t = useTranslator();
|
|
356
|
+
const placeholder =
|
|
357
|
+
placeholderFromProps ?? t('@astryx.timeInput.placeholder');
|
|
354
358
|
const size = useSize(sizeProp, 'md');
|
|
355
359
|
|
|
356
360
|
const id = useId();
|
|
@@ -659,7 +663,7 @@ export function TimeInput({
|
|
|
659
663
|
<button
|
|
660
664
|
type="button"
|
|
661
665
|
onClick={handleClear}
|
|
662
|
-
aria-label={
|
|
666
|
+
aria-label={t('@astryx.timeInput.clearLabel', {label})}
|
|
663
667
|
{...stylex.props(styles.clearButton)}>
|
|
664
668
|
<Icon icon="close" size="sm" color="secondary" />
|
|
665
669
|
</button>
|
|
@@ -61,24 +61,24 @@ export const docs = {
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
name: 'type',
|
|
64
|
-
type: '
|
|
64
|
+
type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3' | 'inherit'",
|
|
65
65
|
description: 'Semantic text type from Text. Determines size, weight, and line-height.',
|
|
66
66
|
default: "'supporting'",
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
name: 'size',
|
|
70
|
-
type: '
|
|
70
|
+
type: "'4xs' | '3xs' | '2xs' | 'xsm' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'",
|
|
71
71
|
description: 'Explicit font size override. Overrides the size from type.',
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
name: 'color',
|
|
75
|
-
type: '
|
|
75
|
+
type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'accent' | 'inherit'",
|
|
76
76
|
description: 'Text color.',
|
|
77
77
|
default: "'secondary'",
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
name: 'weight',
|
|
81
|
-
type: '
|
|
81
|
+
type: "'normal' | 'medium' | 'semibold' | 'bold'",
|
|
82
82
|
description: 'Font weight override.',
|
|
83
83
|
},
|
|
84
84
|
],
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
|
|
4
|
-
import {render, screen, act} from '@testing-library/react';
|
|
4
|
+
import {render, screen, act, waitFor} from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
5
6
|
import {Timestamp} from './Timestamp';
|
|
6
7
|
|
|
7
8
|
describe('Timestamp', () => {
|
|
@@ -41,9 +42,7 @@ describe('Timestamp', () => {
|
|
|
41
42
|
);
|
|
42
43
|
expect(screen.getByText('59 minutes ago')).toBeInTheDocument();
|
|
43
44
|
|
|
44
|
-
rerender(
|
|
45
|
-
<Timestamp value={Date.now() / 1000 - 86399} format="relative" />,
|
|
46
|
-
);
|
|
45
|
+
rerender(<Timestamp value={Date.now() / 1000 - 86399} format="relative" />);
|
|
47
46
|
expect(screen.getByText('23 hours ago')).toBeInTheDocument();
|
|
48
47
|
|
|
49
48
|
rerender(
|
|
@@ -52,9 +51,7 @@ describe('Timestamp', () => {
|
|
|
52
51
|
expect(screen.getByText('29 days ago')).toBeInTheDocument();
|
|
53
52
|
|
|
54
53
|
// Same guarantee on the future side.
|
|
55
|
-
rerender(
|
|
56
|
-
<Timestamp value={Date.now() / 1000 + 3599} format="relative" />,
|
|
57
|
-
);
|
|
54
|
+
rerender(<Timestamp value={Date.now() / 1000 + 3599} format="relative" />);
|
|
58
55
|
expect(screen.getByText('in 59 minutes')).toBeInTheDocument();
|
|
59
56
|
});
|
|
60
57
|
|
|
@@ -342,4 +339,120 @@ describe('Timestamp', () => {
|
|
|
342
339
|
warn.mockRestore();
|
|
343
340
|
}
|
|
344
341
|
});
|
|
342
|
+
|
|
343
|
+
// --- Tooltip keyboard reachability (WCAG 1.4.13 / 2.1.1) ---
|
|
344
|
+
|
|
345
|
+
describe('tooltip keyboard reachability', () => {
|
|
346
|
+
const originalMatches = HTMLElement.prototype.matches;
|
|
347
|
+
const originalShowPopover = HTMLElement.prototype.showPopover;
|
|
348
|
+
const originalHidePopover = HTMLElement.prototype.hidePopover;
|
|
349
|
+
|
|
350
|
+
beforeEach(() => {
|
|
351
|
+
// The tooltip is lazy-loaded via a dynamic import; real timers let the
|
|
352
|
+
// import promise and RTL's waitFor resolve naturally (the outer
|
|
353
|
+
// beforeEach installs fake timers, which would stall them).
|
|
354
|
+
vi.useRealTimers();
|
|
355
|
+
|
|
356
|
+
// Mock the Popover API, which jsdom does not implement.
|
|
357
|
+
HTMLElement.prototype.showPopover = vi.fn();
|
|
358
|
+
HTMLElement.prototype.hidePopover = vi.fn();
|
|
359
|
+
|
|
360
|
+
// jsdom does not derive :focus-visible from keyboard focus for a <time>
|
|
361
|
+
// element; treat the focused element as focus-visible so the tooltip's
|
|
362
|
+
// keyboard-focus path can be exercised.
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
364
|
+
(HTMLElement.prototype as any).matches = function (
|
|
365
|
+
selector: string,
|
|
366
|
+
): boolean {
|
|
367
|
+
if (selector === ':focus-visible') {
|
|
368
|
+
return this === document.activeElement;
|
|
369
|
+
}
|
|
370
|
+
return originalMatches.call(this, selector);
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
afterEach(() => {
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
376
|
+
(HTMLElement.prototype as any).matches = originalMatches;
|
|
377
|
+
HTMLElement.prototype.showPopover = originalShowPopover;
|
|
378
|
+
HTMLElement.prototype.hidePopover = originalHidePopover;
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('makes the <time> element focusable while the tooltip is attached', () => {
|
|
382
|
+
render(
|
|
383
|
+
<Timestamp
|
|
384
|
+
value={Date.now() / 1000 - 3600}
|
|
385
|
+
format="relative"
|
|
386
|
+
data-testid="ts"
|
|
387
|
+
/>,
|
|
388
|
+
);
|
|
389
|
+
expect(screen.getByTestId('ts')).toHaveAttribute('tabindex', '0');
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('shows the tooltip when the timestamp receives keyboard focus', async () => {
|
|
393
|
+
const user = userEvent.setup();
|
|
394
|
+
render(
|
|
395
|
+
<Timestamp
|
|
396
|
+
value={Date.now() / 1000 - 3600}
|
|
397
|
+
format="relative"
|
|
398
|
+
data-testid="ts"
|
|
399
|
+
/>,
|
|
400
|
+
);
|
|
401
|
+
const el = screen.getByTestId('ts');
|
|
402
|
+
|
|
403
|
+
// Wait for the lazy-loaded tooltip layer to mount and confirm it
|
|
404
|
+
// carries the full absolute time (same string as the aria-label).
|
|
405
|
+
// Compare with normalized whitespace: Intl output can contain narrow
|
|
406
|
+
// no-break spaces that jest-dom's matcher normalization would break on.
|
|
407
|
+
const layer = await screen.findByRole('tooltip', {hidden: true});
|
|
408
|
+
const normalize = (s: string) => s.replace(/\s+/g, ' ');
|
|
409
|
+
expect(normalize(layer.textContent ?? '')).toContain(
|
|
410
|
+
normalize(el.getAttribute('aria-label') ?? '\0'),
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// Tab onto the timestamp — the only tab stop in the document.
|
|
414
|
+
await user.tab();
|
|
415
|
+
expect(el).toHaveFocus();
|
|
416
|
+
await waitFor(() => {
|
|
417
|
+
expect(HTMLElement.prototype.showPopover).toHaveBeenCalled();
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('does not add a tab stop when the tooltip is disabled', () => {
|
|
422
|
+
render(
|
|
423
|
+
<Timestamp
|
|
424
|
+
value={Date.now() / 1000 - 3600}
|
|
425
|
+
format="relative"
|
|
426
|
+
hasTooltip={false}
|
|
427
|
+
data-testid="ts"
|
|
428
|
+
/>,
|
|
429
|
+
);
|
|
430
|
+
expect(screen.getByTestId('ts')).not.toHaveAttribute('tabindex');
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it('does not add a tab stop for absolute formats (no tooltip)', () => {
|
|
434
|
+
render(
|
|
435
|
+
<Timestamp
|
|
436
|
+
value="2026-02-19T17:00:00Z"
|
|
437
|
+
format="date_time"
|
|
438
|
+
data-testid="ts"
|
|
439
|
+
/>,
|
|
440
|
+
);
|
|
441
|
+
expect(screen.getByTestId('ts')).not.toHaveAttribute('tabindex');
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('keeps the full absolute aria-label while the tooltip is attached', () => {
|
|
445
|
+
render(
|
|
446
|
+
<Timestamp
|
|
447
|
+
value={Date.now() / 1000 - 3600}
|
|
448
|
+
format="relative"
|
|
449
|
+
data-testid="ts"
|
|
450
|
+
/>,
|
|
451
|
+
);
|
|
452
|
+
const label = screen.getByTestId('ts').getAttribute('aria-label');
|
|
453
|
+
expect(label).toBeTruthy();
|
|
454
|
+
// The label is the full absolute string, not the relative text.
|
|
455
|
+
expect(label).not.toContain('ago');
|
|
456
|
+
});
|
|
457
|
+
});
|
|
345
458
|
});
|
|
@@ -23,6 +23,7 @@ import type {TextType, TextSize, TextColor, TextWeight} from '../theme/types';
|
|
|
23
23
|
import {mergeProps, mergeRefs} from '../utils';
|
|
24
24
|
import type {BaseProps} from '../BaseProps';
|
|
25
25
|
import {themeProps} from '../utils/themeProps';
|
|
26
|
+
import {colorVars} from '../theme/tokens.stylex';
|
|
26
27
|
|
|
27
28
|
const LazyXDSTooltip = lazy(async () =>
|
|
28
29
|
import('../Tooltip/Tooltip').then(mod => ({default: mod.Tooltip})),
|
|
@@ -118,6 +119,18 @@ const styles = stylex.create({
|
|
|
118
119
|
color: 'inherit',
|
|
119
120
|
fontWeight: 'inherit',
|
|
120
121
|
},
|
|
122
|
+
// Visible focus ring for the tooltip tab stop, matching the repo-wide
|
|
123
|
+
// focus-visible outline treatment (see Token, Thumbnail).
|
|
124
|
+
focusable: {
|
|
125
|
+
outline: {
|
|
126
|
+
default: null,
|
|
127
|
+
':focus-visible': `2px solid ${colorVars['--color-accent']}`,
|
|
128
|
+
},
|
|
129
|
+
outlineOffset: {
|
|
130
|
+
default: '0',
|
|
131
|
+
':focus-visible': '2px',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
121
134
|
});
|
|
122
135
|
|
|
123
136
|
// =============================================================================
|
|
@@ -431,8 +444,15 @@ export function Timestamp({
|
|
|
431
444
|
aria-label={
|
|
432
445
|
effectiveFormat === 'relative' ? fullAbsoluteText : undefined
|
|
433
446
|
}
|
|
447
|
+
// The absolute-time tooltip is anchored here with the default 'auto'
|
|
448
|
+
// focus trigger, which only activates on focusable anchors. A bare
|
|
449
|
+
// <time> is not focusable, so without a tab stop sighted keyboard
|
|
450
|
+
// users could never reveal the tooltip (WCAG 1.4.13 / 2.1.1). Only
|
|
451
|
+
// add the tab stop while a tooltip is actually attached — no
|
|
452
|
+
// gratuitous tab stops otherwise.
|
|
453
|
+
tabIndex={showTooltip ? 0 : undefined}
|
|
434
454
|
data-testid={testId}
|
|
435
|
-
{...stylex.props(styles.time)}>
|
|
455
|
+
{...stylex.props(styles.time, showTooltip && styles.focusable)}>
|
|
436
456
|
{displayText}
|
|
437
457
|
</time>
|
|
438
458
|
</Text>
|