@astryxdesign/core 0.1.6 → 0.1.7-canary.04cd8f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +25 -14
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +4 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +4 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +8 -6
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/Button/Button.d.ts +10 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +49 -6
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +27 -11
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +29 -7
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -5
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -1
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +9 -2
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -2
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +6 -4
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +4 -2
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +8 -2
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +3 -1
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +3 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +13 -8
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts +12 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +43 -6
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +4 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +4 -2
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +3 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +3 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +10 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +71 -53
- package/dist/Collapsible/Collapsible.d.ts +11 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +36 -4
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +8 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +4 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +4 -1
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +8 -4
- package/dist/ContextMenu/index.d.ts +3 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +7 -1
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +10 -5
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -6
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +15 -7
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +15 -12
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +7 -3
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +19 -9
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +89 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +170 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +70 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +10 -1
- package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemRoles.js +15 -0
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +11 -1
- package/dist/Icon/Icon.d.ts +17 -12
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +28 -20
- package/dist/Kbd/Kbd.js +1 -1
- package/dist/Layer/useLayer.d.ts +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +23 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +6 -4
- package/dist/Link/Link.d.ts +5 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +32 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +10 -8
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +4 -2
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +4 -1
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +13 -6
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +5 -1
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +22 -12
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +26 -20
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +34 -21
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +4 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +52 -14
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +3 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +5 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +7 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +6 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +5 -3
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +56 -19
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +12 -5
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +8 -6
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +1 -1
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +5 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +6 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -2
- package/dist/Table/plugins/tree/index.d.ts +5 -0
- package/dist/Table/plugins/tree/index.d.ts.map +1 -0
- package/dist/Table/plugins/tree/index.js +4 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
- package/dist/Table/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +6 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +8 -2
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +18 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +3 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +8 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +3 -1
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +8 -1
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +4 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +5 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +5 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +8 -4
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -0
- package/dist/astryx.css +38 -4
- package/dist/astryx.umd.js +62 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/docs-types.d.ts +13 -4
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +61 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/hct.d.ts +0 -1
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +0 -3
- package/dist/utils/color.d.ts +13 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +23 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/locales/en.json +754 -0
- package/locales/pseudo.json +566 -0
- package/package.json +23 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.doc.mjs +8 -0
- package/src/Button/Button.test.tsx +27 -0
- package/src/Button/Button.tsx +51 -5
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.test.tsx +103 -2
- package/src/Calendar/Calendar.tsx +29 -6
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.test.tsx +127 -2
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/index.ts +1 -0
- package/src/Chat/useChatStreamScroll.test.tsx +168 -0
- package/src/Chat/useChatStreamScroll.ts +67 -11
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +7 -0
- package/src/Collapsible/Collapsible.test.tsx +80 -0
- package/src/Collapsible/Collapsible.tsx +58 -5
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.test.tsx +75 -1
- package/src/ContextMenu/ContextMenu.tsx +14 -6
- package/src/ContextMenu/index.ts +15 -0
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.test.tsx +17 -5
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/Dialog.tsx +11 -15
- package/src/Dialog/DialogHeader.tsx +7 -3
- package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +23 -14
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +237 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +119 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
- package/src/DropdownMenu/index.ts +23 -3
- package/src/DropdownMenu/menuItemRoles.ts +22 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +3 -3
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/FileInput/FileInput.test.tsx +40 -1
- package/src/FileInput/FileInput.tsx +12 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/Icon/Icon.test.tsx +46 -0
- package/src/Icon/Icon.tsx +37 -24
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Kbd/Kbd.test.tsx +26 -0
- package/src/Kbd/Kbd.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +8 -5
- package/src/Layer/useLayer.test.tsx +136 -1
- package/src/Layer/useLayer.tsx +34 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -1
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +6 -3
- package/src/Selector/Selector.test.tsx +114 -6
- package/src/Selector/Selector.tsx +68 -17
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/TabList.tsx +12 -1
- package/src/TabList/TabMenu.tsx +4 -1
- package/src/Table/BaseTable.tsx +36 -19
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +7 -5
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -1
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +4 -4
- package/src/Table/plugins/tree/index.ts +12 -0
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
- package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
- package/src/Table/types.ts +18 -12
- package/src/Table/useBaseTablePlugins.ts +6 -2
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Table/useTableTreeData.doc.mjs +75 -0
- package/src/Table/useTableTreeState.doc.mjs +98 -0
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.tsx +10 -3
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +938 -0
- package/src/docs-types.ts +15 -10
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +82 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/hct.ts +0 -4
- package/src/utils/color.test.ts +101 -1
- package/src/utils/color.ts +23 -1
- package/src/utils/index.ts +8 -1
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file DropdownMenuRadioGroup.tsx
|
|
7
|
+
* @output DropdownMenuRadioGroup — a single-select group of menu items.
|
|
8
|
+
* @position Sub-component; wraps DropdownMenuRadioItem inside a DropdownMenu.
|
|
9
|
+
*
|
|
10
|
+
* Owns single-selection state (value/onChange) for its child
|
|
11
|
+
* DropdownMenuRadioItems and exposes it via context. Renders role="group" with
|
|
12
|
+
* an accessible name so the radios are announced as a set. Keyboard navigation
|
|
13
|
+
* comes from the parent DropdownMenu's useListFocus, which matches
|
|
14
|
+
* menuitemradio rows.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {useMemo, type ReactNode} from 'react';
|
|
18
|
+
import * as stylex from '@stylexjs/stylex';
|
|
19
|
+
import {spacingVars} from '../theme/tokens.stylex';
|
|
20
|
+
import {mergeProps} from '../utils';
|
|
21
|
+
import type {BaseProps} from '../BaseProps';
|
|
22
|
+
import {
|
|
23
|
+
DropdownMenuRadioGroupContext,
|
|
24
|
+
type DropdownMenuRadioGroupContextValue,
|
|
25
|
+
} from './DropdownMenuContext';
|
|
26
|
+
|
|
27
|
+
const styles = stylex.create({
|
|
28
|
+
// Match the menu's own inter-item rhythm (2px) so grouped radio items keep
|
|
29
|
+
// the same gap as ungrouped items instead of sitting flush against each
|
|
30
|
+
// other inside the role="group" wrapper.
|
|
31
|
+
group: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
gap: spacingVars['--spacing-0-5'],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export interface DropdownMenuRadioGroupProps extends Omit<
|
|
39
|
+
BaseProps,
|
|
40
|
+
'onChange'
|
|
41
|
+
> {
|
|
42
|
+
/**
|
|
43
|
+
* The currently selected value in the group. Pass `undefined` when nothing
|
|
44
|
+
* is selected yet.
|
|
45
|
+
*/
|
|
46
|
+
value: string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Callback fired when the selected value changes.
|
|
49
|
+
*/
|
|
50
|
+
onChange: (value: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Accessible label for the group. Required (together with `aria-labelledby`,
|
|
53
|
+
* one of the two) so screen readers announce the radios as a named set,
|
|
54
|
+
* e.g. "Sort by".
|
|
55
|
+
*/
|
|
56
|
+
'aria-label'?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The id of an element that labels the group, as an alternative to
|
|
59
|
+
* `aria-label`.
|
|
60
|
+
*/
|
|
61
|
+
'aria-labelledby'?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether selecting a value closes the menu. Radio items default to closing
|
|
64
|
+
* on selection (a single-choice commit), unlike checkbox items which stay
|
|
65
|
+
* open.
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
hasCloseOnSelect?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The `DropdownMenuRadioItem`s that make up the group.
|
|
71
|
+
*/
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A single-select group of radio menu items (role="group" of menuitemradio).
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```
|
|
80
|
+
* * import {
|
|
81
|
+
* DropdownMenuRadioGroup,
|
|
82
|
+
* DropdownMenuRadioItem,
|
|
83
|
+
* } from '@astryxdesign/core/DropdownMenu';
|
|
84
|
+
*
|
|
85
|
+
* <DropdownMenu button={{label: 'Sort'}}>
|
|
86
|
+
* <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
|
|
87
|
+
* <DropdownMenuRadioItem value="newest" label="Newest" />
|
|
88
|
+
* <DropdownMenuRadioItem value="oldest" label="Oldest" />
|
|
89
|
+
* </DropdownMenuRadioGroup>
|
|
90
|
+
* </DropdownMenu>
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function DropdownMenuRadioGroup({
|
|
94
|
+
value,
|
|
95
|
+
onChange,
|
|
96
|
+
hasCloseOnSelect = true,
|
|
97
|
+
children,
|
|
98
|
+
className,
|
|
99
|
+
style,
|
|
100
|
+
...rest
|
|
101
|
+
}: DropdownMenuRadioGroupProps) {
|
|
102
|
+
const contextValue = useMemo<DropdownMenuRadioGroupContextValue>(
|
|
103
|
+
() => ({value, onChange, hasCloseOnSelect}),
|
|
104
|
+
[value, onChange, hasCloseOnSelect],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div
|
|
109
|
+
{...rest}
|
|
110
|
+
role="group"
|
|
111
|
+
{...mergeProps(stylex.props(styles.group), {className, style})}>
|
|
112
|
+
<DropdownMenuRadioGroupContext value={contextValue}>
|
|
113
|
+
{children}
|
|
114
|
+
</DropdownMenuRadioGroupContext>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
DropdownMenuRadioGroup.displayName = 'DropdownMenuRadioGroup';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'DropdownMenuRadioItem',
|
|
7
|
+
subComponentOf: 'DropdownMenu',
|
|
8
|
+
displayName: 'Dropdown Menu Radio Item',
|
|
9
|
+
isHiddenFromOverview: true,
|
|
10
|
+
description:
|
|
11
|
+
'A single option in a DropdownMenuRadioGroup (role="menuitemradio"). Must be used inside a DropdownMenuRadioGroup.',
|
|
12
|
+
props: [
|
|
13
|
+
{
|
|
14
|
+
name: 'value',
|
|
15
|
+
type: 'string',
|
|
16
|
+
description:
|
|
17
|
+
"The value this item represents within its group. The group's value matches against this to determine the checked state.",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'label',
|
|
21
|
+
type: 'ReactNode',
|
|
22
|
+
description: 'Primary label text identifying the option.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'description',
|
|
26
|
+
type: 'ReactNode',
|
|
27
|
+
description: 'Secondary description text displayed below the label.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'icon',
|
|
31
|
+
type: 'IconType',
|
|
32
|
+
description:
|
|
33
|
+
'Icon to display before the label. See `npx astryx docs icons` for valid semantic names.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'isDisabled',
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
default: 'false',
|
|
39
|
+
description:
|
|
40
|
+
'Whether this individual radio item is disabled. Disabled items stay focusable (via aria-disabled) so they remain discoverable by keyboard and assistive technology, but selection is blocked.',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'endContent',
|
|
44
|
+
type: 'ReactNode',
|
|
45
|
+
description:
|
|
46
|
+
'Content to render after the label and description, such as a badge or metadata.',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const docsZh = {
|
|
52
|
+
name: 'DropdownMenuRadioItem',
|
|
53
|
+
isHiddenFromOverview: true,
|
|
54
|
+
displayName: 'Dropdown Menu Radio Item',
|
|
55
|
+
description:
|
|
56
|
+
'DropdownMenuRadioGroup 中的单个选项(role="menuitemradio")。必须在 DropdownMenuRadioGroup 内使用。',
|
|
57
|
+
propDescriptions: {
|
|
58
|
+
value: '该项在组内代表的值。组的 value 与之匹配以确定勾选状态。',
|
|
59
|
+
label: '标识该选项的主标签文本。',
|
|
60
|
+
description: '显示在标签下方的次要描述文本。',
|
|
61
|
+
icon: '显示在标签前的图标。',
|
|
62
|
+
isDisabled: '该单选项是否禁用。',
|
|
63
|
+
endContent: '在标签和描述之后渲染的内容。',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const docsDense = {
|
|
68
|
+
name: 'DropdownMenuRadioItem',
|
|
69
|
+
isHiddenFromOverview: true,
|
|
70
|
+
displayName: 'Dropdown Menu Radio Item',
|
|
71
|
+
description: 'one option in a DropdownMenuRadioGroup (menuitemradio)',
|
|
72
|
+
propDescriptions: {
|
|
73
|
+
value: "item's value within the group (matched vs group value)",
|
|
74
|
+
label: 'primary label text',
|
|
75
|
+
description: 'secondary text below label',
|
|
76
|
+
icon: 'icon before label',
|
|
77
|
+
isDisabled: 'disabled; stays focusable via aria-disabled',
|
|
78
|
+
endContent: 'content after label+description',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file DropdownMenuRadioItem.tsx
|
|
7
|
+
* @input React, stylex, Item + Icon + DropdownMenu context + tokens from core
|
|
8
|
+
* @output DropdownMenuRadioItem — a single option in a radio group.
|
|
9
|
+
* @position Sub-component; must be used inside a DropdownMenuRadioGroup.
|
|
10
|
+
*
|
|
11
|
+
* A menu item representing one option in a single-select group
|
|
12
|
+
* (role="menuitemradio"). The row owns the role and aria-checked; there is no
|
|
13
|
+
* nested native <input> (per the WAI-ARIA menuitemradio pattern). Selection
|
|
14
|
+
* state + onChange come from DropdownMenuRadioGroupContext. Keyboard nav +
|
|
15
|
+
* Enter/Space activation come from the parent DropdownMenu.
|
|
16
|
+
*
|
|
17
|
+
* The round radio visual (circle + center dot) is decorative (aria-hidden) —
|
|
18
|
+
* the row owns the checked state. Its size is derived from the menu's item size
|
|
19
|
+
* and it swaps to the inline-end of the row on coarse-pointer (touch) devices
|
|
20
|
+
* via CSS `order`. The dot is a shaped element, not an icon (a filled circle
|
|
21
|
+
* has no registry glyph).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {useCallback, type ReactNode} from 'react';
|
|
25
|
+
import * as stylex from '@stylexjs/stylex';
|
|
26
|
+
import {renderIconSlot, type IconType} from '../Icon';
|
|
27
|
+
import {Item} from '../Item';
|
|
28
|
+
import {useDropdownMenuContext} from './DropdownMenuContext';
|
|
29
|
+
import {
|
|
30
|
+
colorVars,
|
|
31
|
+
spacingVars,
|
|
32
|
+
durationVars,
|
|
33
|
+
easeVars,
|
|
34
|
+
borderVars,
|
|
35
|
+
} from '../theme/tokens.stylex';
|
|
36
|
+
import {mergeProps, themeProps} from '../utils';
|
|
37
|
+
import type {BaseProps} from '../BaseProps';
|
|
38
|
+
import {useDropdownMenuRadioGroupContext} from './DropdownMenuContext';
|
|
39
|
+
|
|
40
|
+
const styles = stylex.create({
|
|
41
|
+
root: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
borderRadius: `max(0px, calc(var(--_dropdown-menu-radius, ${spacingVars['--spacing-2']}) - var(--_dropdown-menu-padding, ${spacingVars['--spacing-1']})))`,
|
|
44
|
+
color: colorVars['--color-text-primary'],
|
|
45
|
+
backgroundColor: {
|
|
46
|
+
default: 'transparent',
|
|
47
|
+
':focus': colorVars['--color-overlay-hover'],
|
|
48
|
+
':hover': colorVars['--color-overlay-hover'],
|
|
49
|
+
},
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
outline: 'none',
|
|
52
|
+
},
|
|
53
|
+
disabled: {
|
|
54
|
+
opacity: 0.5,
|
|
55
|
+
cursor: 'not-allowed',
|
|
56
|
+
},
|
|
57
|
+
// Rendered in Item's `marker` slot as a raw flex child. On touch it moves to
|
|
58
|
+
// the inline-end of the row via `order`.
|
|
59
|
+
circle: {
|
|
60
|
+
display: 'flex',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
flexShrink: 0,
|
|
64
|
+
boxSizing: 'border-box',
|
|
65
|
+
borderWidth: borderVars['--border-width'],
|
|
66
|
+
borderStyle: 'solid',
|
|
67
|
+
borderRadius: '50%',
|
|
68
|
+
transitionProperty: 'background-color, border-color',
|
|
69
|
+
transitionDuration: {
|
|
70
|
+
default: durationVars['--duration-fast'],
|
|
71
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
72
|
+
},
|
|
73
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
74
|
+
order: {
|
|
75
|
+
default: 0,
|
|
76
|
+
'@media (pointer: coarse)': 1,
|
|
77
|
+
},
|
|
78
|
+
marginInlineStart: {
|
|
79
|
+
default: 0,
|
|
80
|
+
'@media (pointer: coarse)': 'auto',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
unchecked: {
|
|
84
|
+
borderColor: colorVars['--color-border-emphasized'],
|
|
85
|
+
backgroundColor: colorVars['--color-background-surface'],
|
|
86
|
+
},
|
|
87
|
+
checked: {
|
|
88
|
+
borderColor: colorVars['--color-accent'],
|
|
89
|
+
backgroundColor: colorVars['--color-accent'],
|
|
90
|
+
},
|
|
91
|
+
dot: {
|
|
92
|
+
borderRadius: '50%',
|
|
93
|
+
backgroundColor: colorVars['--color-on-accent'],
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const circleSizeStyles = stylex.create({
|
|
98
|
+
sm: {width: 18, height: 18},
|
|
99
|
+
md: {width: 22, height: 22},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const dotSizeStyles = stylex.create({
|
|
103
|
+
sm: {width: 6, height: 6},
|
|
104
|
+
md: {width: 8, height: 8},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export interface DropdownMenuRadioItemProps extends Omit<
|
|
108
|
+
BaseProps,
|
|
109
|
+
'role' | 'aria-checked' | 'tabIndex'
|
|
110
|
+
> {
|
|
111
|
+
/**
|
|
112
|
+
* The value this item represents within its group. The group's `value`
|
|
113
|
+
* matches against this to determine the checked state.
|
|
114
|
+
*/
|
|
115
|
+
value: string;
|
|
116
|
+
/**
|
|
117
|
+
* Primary label text identifying the option.
|
|
118
|
+
*/
|
|
119
|
+
label: ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Secondary description text displayed below the label.
|
|
122
|
+
*/
|
|
123
|
+
description?: ReactNode;
|
|
124
|
+
/**
|
|
125
|
+
* Icon to display before the label. Accepts a semantic icon name (see
|
|
126
|
+
* `npx astryx docs icons`) or a rendered node.
|
|
127
|
+
*/
|
|
128
|
+
icon?: ReactNode | IconType;
|
|
129
|
+
/**
|
|
130
|
+
* Whether this individual radio item is disabled. Disabled items stay
|
|
131
|
+
* focusable (via `aria-disabled`) so they remain discoverable by keyboard
|
|
132
|
+
* and assistive technology, but selection is blocked.
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
isDisabled?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Content to render after the label and description, such as a badge or
|
|
138
|
+
* metadata.
|
|
139
|
+
*/
|
|
140
|
+
endContent?: ReactNode;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A single option in a DropdownMenuRadioGroup (role="menuitemradio").
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```
|
|
148
|
+
* <DropdownMenuRadioGroup value={sort} onChange={setSort} aria-label="Sort by">
|
|
149
|
+
* <DropdownMenuRadioItem value="newest" label="Newest" />
|
|
150
|
+
* <DropdownMenuRadioItem value="oldest" label="Oldest" icon="clock" />
|
|
151
|
+
* </DropdownMenuRadioGroup>
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export function DropdownMenuRadioItem({
|
|
155
|
+
value,
|
|
156
|
+
label,
|
|
157
|
+
description,
|
|
158
|
+
icon,
|
|
159
|
+
isDisabled = false,
|
|
160
|
+
endContent,
|
|
161
|
+
xstyle,
|
|
162
|
+
className,
|
|
163
|
+
style,
|
|
164
|
+
...rest
|
|
165
|
+
}: DropdownMenuRadioItemProps) {
|
|
166
|
+
const menuCtx = useDropdownMenuContext();
|
|
167
|
+
const groupCtx = useDropdownMenuRadioGroupContext();
|
|
168
|
+
if (!groupCtx) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
'DropdownMenuRadioItem must be used within a DropdownMenuRadioGroup',
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
const menuSize = menuCtx?.menuSize ?? 'md';
|
|
174
|
+
const controlSize = menuSize === 'sm' ? 'sm' : 'md';
|
|
175
|
+
const isChecked = groupCtx.value === value;
|
|
176
|
+
|
|
177
|
+
const handleClick = useCallback(() => {
|
|
178
|
+
if (isDisabled) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
groupCtx.onChange(value);
|
|
182
|
+
if (groupCtx.hasCloseOnSelect) {
|
|
183
|
+
menuCtx?.closeMenu();
|
|
184
|
+
}
|
|
185
|
+
}, [isDisabled, groupCtx, value, menuCtx]);
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<Item
|
|
189
|
+
{...rest}
|
|
190
|
+
role="menuitemradio"
|
|
191
|
+
aria-checked={isChecked}
|
|
192
|
+
tabIndex={isDisabled ? undefined : -1}
|
|
193
|
+
marker={
|
|
194
|
+
<span
|
|
195
|
+
aria-hidden="true"
|
|
196
|
+
{...mergeProps(
|
|
197
|
+
themeProps('dropdown-menu-radio', {
|
|
198
|
+
size: controlSize,
|
|
199
|
+
checked: isChecked ? 'checked' : null,
|
|
200
|
+
disabled: isDisabled ? 'disabled' : null,
|
|
201
|
+
}),
|
|
202
|
+
stylex.props(
|
|
203
|
+
styles.circle,
|
|
204
|
+
circleSizeStyles[controlSize],
|
|
205
|
+
isChecked ? styles.checked : styles.unchecked,
|
|
206
|
+
),
|
|
207
|
+
)}>
|
|
208
|
+
{isChecked && (
|
|
209
|
+
<span {...stylex.props(styles.dot, dotSizeStyles[controlSize])} />
|
|
210
|
+
)}
|
|
211
|
+
</span>
|
|
212
|
+
}
|
|
213
|
+
startContent={
|
|
214
|
+
icon
|
|
215
|
+
? renderIconSlot(icon, {size: 'sm', color: 'secondary'})
|
|
216
|
+
: undefined
|
|
217
|
+
}
|
|
218
|
+
label={label}
|
|
219
|
+
description={description}
|
|
220
|
+
endContent={endContent}
|
|
221
|
+
onClick={handleClick}
|
|
222
|
+
isDisabled={isDisabled}
|
|
223
|
+
xstyle={[styles.root, isDisabled && styles.disabled, xstyle]}
|
|
224
|
+
{...mergeProps(themeProps('dropdown-menu-item', {size: menuSize}), {
|
|
225
|
+
className,
|
|
226
|
+
style,
|
|
227
|
+
})}
|
|
228
|
+
/>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
DropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file DropdownMenuSelectable.test.tsx
|
|
5
|
+
* @input vitest, @testing-library/react, DropdownMenu + selectable items
|
|
6
|
+
* @output Unit tests for DropdownMenuCheckboxItem / RadioGroup / RadioItem (#3829)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
10
|
+
import {render, screen} from '@testing-library/react';
|
|
11
|
+
import userEvent from '@testing-library/user-event';
|
|
12
|
+
import {DropdownMenu} from './DropdownMenu';
|
|
13
|
+
import {DropdownMenuCheckboxItem} from './DropdownMenuCheckboxItem';
|
|
14
|
+
import {DropdownMenuRadioGroup} from './DropdownMenuRadioGroup';
|
|
15
|
+
import {DropdownMenuRadioItem} from './DropdownMenuRadioItem';
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
HTMLElement.prototype.showPopover = vi.fn(function (this: HTMLElement) {
|
|
19
|
+
this.setAttribute('popover-open', '');
|
|
20
|
+
const event = new Event('toggle', {bubbles: false});
|
|
21
|
+
Object.defineProperty(event, 'newState', {value: 'open'});
|
|
22
|
+
this.dispatchEvent(event);
|
|
23
|
+
});
|
|
24
|
+
HTMLElement.prototype.hidePopover = vi.fn(function (this: HTMLElement) {
|
|
25
|
+
this.removeAttribute('popover-open');
|
|
26
|
+
const event = new Event('toggle', {bubbles: false});
|
|
27
|
+
Object.defineProperty(event, 'newState', {value: 'closed'});
|
|
28
|
+
this.dispatchEvent(event);
|
|
29
|
+
});
|
|
30
|
+
const originalMatches = HTMLElement.prototype.matches;
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
(HTMLElement.prototype as any).matches = function (
|
|
33
|
+
selector: string,
|
|
34
|
+
): boolean {
|
|
35
|
+
if (selector === ':popover-open') {
|
|
36
|
+
return this.hasAttribute('popover-open');
|
|
37
|
+
}
|
|
38
|
+
return originalMatches.call(this, selector);
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('DropdownMenuCheckboxItem', () => {
|
|
43
|
+
it('renders role menuitemcheckbox and reflects checked state', async () => {
|
|
44
|
+
const user = userEvent.setup();
|
|
45
|
+
render(
|
|
46
|
+
<DropdownMenu button={{label: 'View'}}>
|
|
47
|
+
<DropdownMenuCheckboxItem label="Show archived" value={true} />
|
|
48
|
+
</DropdownMenu>,
|
|
49
|
+
);
|
|
50
|
+
await user.click(screen.getByRole('button', {name: /View/}));
|
|
51
|
+
expect(
|
|
52
|
+
screen.getByRole('menuitemcheckbox', {
|
|
53
|
+
name: /Show archived/,
|
|
54
|
+
hidden: true,
|
|
55
|
+
}),
|
|
56
|
+
).toHaveAttribute('aria-checked', 'true');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('calls onChange with the toggled value on click', async () => {
|
|
60
|
+
const user = userEvent.setup();
|
|
61
|
+
const onChangeSpy = vi.fn();
|
|
62
|
+
render(
|
|
63
|
+
<DropdownMenu button={{label: 'View'}}>
|
|
64
|
+
<DropdownMenuCheckboxItem
|
|
65
|
+
label="Show archived"
|
|
66
|
+
value={false}
|
|
67
|
+
onChange={onChangeSpy}
|
|
68
|
+
/>
|
|
69
|
+
</DropdownMenu>,
|
|
70
|
+
);
|
|
71
|
+
await user.click(screen.getByRole('button', {name: /View/}));
|
|
72
|
+
await user.click(
|
|
73
|
+
screen.getByRole('menuitemcheckbox', {
|
|
74
|
+
name: /Show archived/,
|
|
75
|
+
hidden: true,
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
78
|
+
expect(onChangeSpy).toHaveBeenCalledWith(true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('does not toggle when disabled', async () => {
|
|
82
|
+
const user = userEvent.setup();
|
|
83
|
+
const onChangeSpy = vi.fn();
|
|
84
|
+
render(
|
|
85
|
+
<DropdownMenu button={{label: 'View'}}>
|
|
86
|
+
<DropdownMenuCheckboxItem
|
|
87
|
+
label="Show archived"
|
|
88
|
+
value={false}
|
|
89
|
+
onChange={onChangeSpy}
|
|
90
|
+
isDisabled
|
|
91
|
+
/>
|
|
92
|
+
</DropdownMenu>,
|
|
93
|
+
);
|
|
94
|
+
await user.click(screen.getByRole('button', {name: /View/}));
|
|
95
|
+
const item = screen.getByRole('menuitemcheckbox', {
|
|
96
|
+
name: /Show archived/,
|
|
97
|
+
hidden: true,
|
|
98
|
+
});
|
|
99
|
+
expect(item).toHaveAttribute('aria-disabled', 'true');
|
|
100
|
+
await user.click(item);
|
|
101
|
+
expect(onChangeSpy).not.toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('DropdownMenuRadioGroup / RadioItem', () => {
|
|
106
|
+
it('renders a named group with radios reflecting the selected value', async () => {
|
|
107
|
+
const user = userEvent.setup();
|
|
108
|
+
render(
|
|
109
|
+
<DropdownMenu button={{label: 'Sort'}}>
|
|
110
|
+
<DropdownMenuRadioGroup
|
|
111
|
+
value="newest"
|
|
112
|
+
onChange={() => {}}
|
|
113
|
+
aria-label="Sort by">
|
|
114
|
+
<DropdownMenuRadioItem value="newest" label="Newest" />
|
|
115
|
+
<DropdownMenuRadioItem value="oldest" label="Oldest" />
|
|
116
|
+
</DropdownMenuRadioGroup>
|
|
117
|
+
</DropdownMenu>,
|
|
118
|
+
);
|
|
119
|
+
await user.click(screen.getByRole('button', {name: /Sort/}));
|
|
120
|
+
expect(
|
|
121
|
+
screen.getByRole('menuitemradio', {name: 'Newest', hidden: true}),
|
|
122
|
+
).toHaveAttribute('aria-checked', 'true');
|
|
123
|
+
expect(
|
|
124
|
+
screen.getByRole('menuitemradio', {name: 'Oldest', hidden: true}),
|
|
125
|
+
).toHaveAttribute('aria-checked', 'false');
|
|
126
|
+
expect(
|
|
127
|
+
screen.getByRole('group', {name: 'Sort by', hidden: true}),
|
|
128
|
+
).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('calls onChange with the selected value', async () => {
|
|
132
|
+
const user = userEvent.setup();
|
|
133
|
+
const onChange = vi.fn();
|
|
134
|
+
render(
|
|
135
|
+
<DropdownMenu button={{label: 'Sort'}}>
|
|
136
|
+
<DropdownMenuRadioGroup
|
|
137
|
+
value="newest"
|
|
138
|
+
onChange={onChange}
|
|
139
|
+
aria-label="Sort by">
|
|
140
|
+
<DropdownMenuRadioItem value="newest" label="Newest" />
|
|
141
|
+
<DropdownMenuRadioItem value="oldest" label="Oldest" />
|
|
142
|
+
</DropdownMenuRadioGroup>
|
|
143
|
+
</DropdownMenu>,
|
|
144
|
+
);
|
|
145
|
+
await user.click(screen.getByRole('button', {name: /Sort/}));
|
|
146
|
+
await user.click(
|
|
147
|
+
screen.getByRole('menuitemradio', {name: 'Oldest', hidden: true}),
|
|
148
|
+
);
|
|
149
|
+
expect(onChange).toHaveBeenCalledWith('oldest');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('throws when a radio item is used outside a group', () => {
|
|
153
|
+
const spy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
154
|
+
expect(() =>
|
|
155
|
+
render(
|
|
156
|
+
<DropdownMenu button={{label: 'Sort'}}>
|
|
157
|
+
<DropdownMenuRadioItem value="x" label="X" />
|
|
158
|
+
</DropdownMenu>,
|
|
159
|
+
),
|
|
160
|
+
).toThrow(/DropdownMenuRadioGroup/);
|
|
161
|
+
spy.mockRestore();
|
|
162
|
+
});
|
|
163
|
+
});
|
|
@@ -18,7 +18,27 @@ export {
|
|
|
18
18
|
type DropdownMenuOption,
|
|
19
19
|
} from './DropdownMenu';
|
|
20
20
|
|
|
21
|
+
export {DropdownMenuItem, type DropdownMenuItemProps} from './DropdownMenuItem';
|
|
22
|
+
|
|
23
|
+
// Selectable items — checkbox (independent) and radio (single-select group).
|
|
24
|
+
export {
|
|
25
|
+
DropdownMenuCheckboxItem,
|
|
26
|
+
type DropdownMenuCheckboxItemProps,
|
|
27
|
+
} from './DropdownMenuCheckboxItem';
|
|
28
|
+
export {
|
|
29
|
+
DropdownMenuRadioGroup,
|
|
30
|
+
type DropdownMenuRadioGroupProps,
|
|
31
|
+
} from './DropdownMenuRadioGroup';
|
|
32
|
+
export {
|
|
33
|
+
DropdownMenuRadioItem,
|
|
34
|
+
type DropdownMenuRadioItemProps,
|
|
35
|
+
} from './DropdownMenuRadioItem';
|
|
36
|
+
|
|
37
|
+
// Menu-coordination context — public so consumers can build custom menu items
|
|
38
|
+
// that read the menu size / close the menu.
|
|
21
39
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
DropdownMenuContext,
|
|
41
|
+
useDropdownMenuContext,
|
|
42
|
+
type DropdownMenuContextValue,
|
|
43
|
+
type DropdownMenuSize,
|
|
44
|
+
} from './DropdownMenuContext';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file menuItemRoles.ts
|
|
5
|
+
* @output Shared menu-item role set + focus selector.
|
|
6
|
+
* @position Internal; used by DropdownMenu and ContextMenu so their
|
|
7
|
+
* roving-focus, typeahead, and Enter/Space activation stay in sync.
|
|
8
|
+
*
|
|
9
|
+
* Includes the selectable items (menuitemradio/menuitemcheckbox) alongside
|
|
10
|
+
* plain menuitem so checkbox/radio rows are reachable by arrow keys, typeahead,
|
|
11
|
+
* and Enter/Space — not just role="menuitem".
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const MENU_ITEM_ROLES: ReadonlySet<string> = new Set([
|
|
15
|
+
'menuitem',
|
|
16
|
+
'menuitemradio',
|
|
17
|
+
'menuitemcheckbox',
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const MENU_ITEM_SELECTOR: string = [...MENU_ITEM_ROLES]
|
|
21
|
+
.map(role => `[role="${role}"]:not([aria-disabled="true"])`)
|
|
22
|
+
.join(',');
|
|
@@ -39,7 +39,7 @@ export const docs = {
|
|
|
39
39
|
name: 'headingLevel',
|
|
40
40
|
type: '1 | 2 | 3 | 4 | 5 | 6',
|
|
41
41
|
description:
|
|
42
|
-
'Controls the rendered HTML heading tag (h1-h6)
|
|
42
|
+
'Controls only the rendered HTML heading tag (h1-h6) so the title fits the document outline. This is a semantic change for accessibility and does not change the visual size of the title, which stays fixed regardless of level.',
|
|
43
43
|
default: '3',
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -121,7 +121,7 @@ export const docsZh = {
|
|
|
121
121
|
name: 'headingLevel',
|
|
122
122
|
type: '1 | 2 | 3 | 4 | 5 | 6',
|
|
123
123
|
description:
|
|
124
|
-
'
|
|
124
|
+
'仅控制渲染的 HTML 标题标签(h1-h6),使标题适配文档大纲。这是用于无障碍的语义变化,不会改变标题的视觉大小,标题大小始终固定,与级别无关。',
|
|
125
125
|
default: '3',
|
|
126
126
|
},
|
|
127
127
|
{
|
|
@@ -173,7 +173,7 @@ export const docsDense = {
|
|
|
173
173
|
},
|
|
174
174
|
propDescriptions: {
|
|
175
175
|
title: 'Primary msg rendered as heading (h1-h6) inside empty state.',
|
|
176
|
-
headingLevel: 'Controls HTML heading tag (h1-h6) for document outline.',
|
|
176
|
+
headingLevel: 'Controls only HTML heading tag (h1-h6) for document outline; does not change visual title size.',
|
|
177
177
|
description: 'Optional secondary text w/ additional context below title.',
|
|
178
178
|
icon: 'Optional icon/illustration above title; rendered decorative (aria-hidden="true").',
|
|
179
179
|
actions: 'Optional action buttons below description; horizontal by default, vertical when isCompact.',
|
|
@@ -105,7 +105,10 @@ export interface EmptyStateProps extends BaseProps<HTMLDivElement> {
|
|
|
105
105
|
actions?: ReactNode;
|
|
106
106
|
/**
|
|
107
107
|
* Semantic heading level for the title element.
|
|
108
|
-
* Controls the rendered HTML tag (h1–h6)
|
|
108
|
+
* Controls only the rendered HTML tag (h1–h6) so the title fits the
|
|
109
|
+
* document outline. This is a semantic change for accessibility and does
|
|
110
|
+
* not change the visual size of the title, which stays fixed regardless
|
|
111
|
+
* of level.
|
|
109
112
|
* @default 3
|
|
110
113
|
*/
|
|
111
114
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|