@astryxdesign/core 0.1.6 → 0.1.7-canary.0a6de96
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 +2 -0
- 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.map +1 -1
- package/dist/Collapsible/Collapsible.js +8 -1
- 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/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +4 -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/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/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- 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/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 +35 -3
- 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/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 +746 -0
- package/locales/pseudo.json +560 -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.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 +1 -0
- package/src/Collapsible/Collapsible.test.tsx +6 -0
- package/src/Collapsible/Collapsible.tsx +19 -4
- 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 +6 -0
- 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 +2 -2
- 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.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/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 +36 -19
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- 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/types.ts +18 -12
- 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/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 -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/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,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;
|
package/src/Field/Field.doc.mjs
CHANGED
|
@@ -104,8 +104,8 @@ export const docs = {
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
name: 'status',
|
|
107
|
-
type: '
|
|
108
|
-
description: 'Status indicator with type and optional message. When message is set, displays a colored status box.',
|
|
107
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string, messageID?: string}",
|
|
108
|
+
description: 'Status indicator with type and optional message. When message is set, displays a colored status box. messageID is for wiring aria-describedby on the input.',
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
name: 'statusVariant',
|
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {describe, it, expect, vi, afterEach, beforeEach} from 'vitest';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
render,
|
|
15
|
+
screen,
|
|
16
|
+
fireEvent,
|
|
17
|
+
createEvent,
|
|
18
|
+
waitFor,
|
|
19
|
+
} from '@testing-library/react';
|
|
14
20
|
import userEvent from '@testing-library/user-event';
|
|
15
21
|
import {FileInput} from './FileInput';
|
|
16
22
|
import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
|
|
@@ -588,6 +594,39 @@ describe('FileInput', () => {
|
|
|
588
594
|
expect(screen.getByText('Choose file')).toBeInTheDocument();
|
|
589
595
|
});
|
|
590
596
|
|
|
597
|
+
it('keeps the drag-over state while dragging over the dropzone children', () => {
|
|
598
|
+
render(
|
|
599
|
+
<FileInput
|
|
600
|
+
label="Upload"
|
|
601
|
+
value={null}
|
|
602
|
+
onChange={() => {}}
|
|
603
|
+
mode="dropzone"
|
|
604
|
+
/>,
|
|
605
|
+
);
|
|
606
|
+
const dropzone = screen.getByRole('button', {name: 'Upload'});
|
|
607
|
+
fireEvent.dragEnter(dropzone);
|
|
608
|
+
expect(screen.getByText('Drop files here')).toBeInTheDocument();
|
|
609
|
+
|
|
610
|
+
// Moving from the container onto one of its own children fires a
|
|
611
|
+
// dragleave on the container with the child as relatedTarget — the
|
|
612
|
+
// highlight must not flicker off while still inside the dropzone.
|
|
613
|
+
// (jsdom's DragEvent init drops relatedTarget, so set it directly.)
|
|
614
|
+
const child = screen.getByText('Drop files here');
|
|
615
|
+
const leaveToChild = createEvent.dragLeave(dropzone);
|
|
616
|
+
Object.defineProperty(leaveToChild, 'relatedTarget', {value: child});
|
|
617
|
+
fireEvent(dropzone, leaveToChild);
|
|
618
|
+
expect(screen.getByText('Drop files here')).toBeInTheDocument();
|
|
619
|
+
|
|
620
|
+
// Actually leaving the dropzone ends the drag-over state.
|
|
621
|
+
const leaveToOutside = createEvent.dragLeave(dropzone);
|
|
622
|
+
Object.defineProperty(leaveToOutside, 'relatedTarget', {
|
|
623
|
+
value: document.body,
|
|
624
|
+
});
|
|
625
|
+
fireEvent(dropzone, leaveToOutside);
|
|
626
|
+
expect(screen.queryByText('Drop files here')).not.toBeInTheDocument();
|
|
627
|
+
expect(screen.getByText('Choose file')).toBeInTheDocument();
|
|
628
|
+
});
|
|
629
|
+
|
|
591
630
|
it('displays file name in dropzone mode', () => {
|
|
592
631
|
const file = createFile('doc.pdf', 100, 'application/pdf');
|
|
593
632
|
render(
|
|
@@ -55,6 +55,7 @@ import {mergeProps, mergeRefs} from '../utils';
|
|
|
55
55
|
import type {BaseProps} from '../BaseProps';
|
|
56
56
|
import type {SizeValue} from '../utils/types';
|
|
57
57
|
import {themeProps} from '../utils/themeProps';
|
|
58
|
+
import {useTranslator} from '../i18n';
|
|
58
59
|
|
|
59
60
|
function formatFileSize(bytes: number): string {
|
|
60
61
|
if (bytes < 1024) {
|
|
@@ -425,6 +426,7 @@ export function FileInput({
|
|
|
425
426
|
ref,
|
|
426
427
|
...rest
|
|
427
428
|
}: FileInputProps) {
|
|
429
|
+
const t = useTranslator();
|
|
428
430
|
const id = useId();
|
|
429
431
|
const descriptionID = useId();
|
|
430
432
|
const statusMessageID = useId();
|
|
@@ -607,6 +609,15 @@ export function FileInput({
|
|
|
607
609
|
const handleDragLeave = useCallback((e: DragEvent) => {
|
|
608
610
|
e.preventDefault();
|
|
609
611
|
e.stopPropagation();
|
|
612
|
+
// Moving over the dropzone's own children (icon, text) fires dragleave on
|
|
613
|
+
// the container too — only a leave that actually exits the dropzone ends
|
|
614
|
+
// the drag-over state, otherwise the highlight flickers mid-drag.
|
|
615
|
+
if (
|
|
616
|
+
e.relatedTarget instanceof Node &&
|
|
617
|
+
e.currentTarget.contains(e.relatedTarget)
|
|
618
|
+
) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
610
621
|
setIsDragOver(false);
|
|
611
622
|
}, []);
|
|
612
623
|
|
|
@@ -774,7 +785,7 @@ export function FileInput({
|
|
|
774
785
|
/>
|
|
775
786
|
{isDropzone ? renderDropzoneContent() : renderCompactContent()}
|
|
776
787
|
{hasFiles && !isDisabled && !isLoading && (
|
|
777
|
-
<InputClearButton label={
|
|
788
|
+
<InputClearButton label={t('@astryx.fileInput.clearLabel', {label})} onClick={handleClear} />
|
|
778
789
|
)}
|
|
779
790
|
</div>
|
|
780
791
|
<div
|
package/src/Grid/Grid.doc.mjs
CHANGED
|
@@ -60,28 +60,28 @@ export const docs = {
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: 'gap',
|
|
63
|
-
type: '
|
|
63
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
64
64
|
description: 'Spacing between all items.',
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
name: 'rowGap',
|
|
68
|
-
type: '
|
|
68
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
69
69
|
description: 'Row spacing; overrides `gap` for the row axis.',
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: 'columnGap',
|
|
73
|
-
type: '
|
|
73
|
+
type: '0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10',
|
|
74
74
|
description: 'Column spacing; overrides `gap` for the column axis.',
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
name: 'align',
|
|
78
|
-
type: '
|
|
78
|
+
type: "'start' | 'center' | 'end' | 'stretch'",
|
|
79
79
|
description: 'Vertical alignment of items.',
|
|
80
80
|
default: "'stretch'",
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
name: 'justify',
|
|
84
|
-
type: '
|
|
84
|
+
type: "'start' | 'center' | 'end' | 'stretch'",
|
|
85
85
|
description: 'Horizontal alignment of items.',
|
|
86
86
|
default: "'stretch'",
|
|
87
87
|
},
|
package/src/Icon/Icon.test.tsx
CHANGED
|
@@ -96,6 +96,52 @@ describe('Icon', () => {
|
|
|
96
96
|
expect(screen.getByTestId('icon')).toBeInTheDocument();
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
it('sizes component-mode icons in rem so they scale with root font-size', () => {
|
|
100
|
+
const sizes = {
|
|
101
|
+
xsm: '0.75rem',
|
|
102
|
+
sm: '1rem',
|
|
103
|
+
md: '1.25rem',
|
|
104
|
+
lg: '1.5rem',
|
|
105
|
+
} as const;
|
|
106
|
+
for (const [size, expected] of Object.entries(sizes)) {
|
|
107
|
+
const {unmount} = render(
|
|
108
|
+
<Icon
|
|
109
|
+
icon={TestIcon}
|
|
110
|
+
size={size as keyof typeof sizes}
|
|
111
|
+
data-testid="icon"
|
|
112
|
+
/>,
|
|
113
|
+
);
|
|
114
|
+
const style = getComputedStyle(screen.getByTestId('icon'));
|
|
115
|
+
expect(style.width).toBe(expected);
|
|
116
|
+
expect(style.height).toBe(expected);
|
|
117
|
+
unmount();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('sizes registry (string-mode) icons in rem, including fontSize', () => {
|
|
122
|
+
const sizes = {
|
|
123
|
+
xsm: '0.75rem',
|
|
124
|
+
sm: '1rem',
|
|
125
|
+
md: '1.25rem',
|
|
126
|
+
lg: '1.5rem',
|
|
127
|
+
} as const;
|
|
128
|
+
for (const [size, expected] of Object.entries(sizes)) {
|
|
129
|
+
const {unmount} = render(
|
|
130
|
+
<Icon
|
|
131
|
+
icon="check"
|
|
132
|
+
size={size as keyof typeof sizes}
|
|
133
|
+
data-testid="icon"
|
|
134
|
+
/>,
|
|
135
|
+
);
|
|
136
|
+
const style = getComputedStyle(screen.getByTestId('icon'));
|
|
137
|
+
expect(style.width).toBe(expected);
|
|
138
|
+
expect(style.height).toBe(expected);
|
|
139
|
+
// fontSize is expressed in rem so 1em-based registry icons scale too.
|
|
140
|
+
expect(style.fontSize).toBe(expected);
|
|
141
|
+
unmount();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
99
145
|
it('forwards ref correctly', () => {
|
|
100
146
|
const ref = vi.fn();
|
|
101
147
|
render(<Icon icon={TestIcon} ref={ref} />);
|