@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
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
render,
|
|
15
|
+
screen,
|
|
16
|
+
fireEvent,
|
|
17
|
+
waitFor,
|
|
18
|
+
within,
|
|
19
|
+
} from '@testing-library/react';
|
|
14
20
|
import userEvent from '@testing-library/user-event';
|
|
15
21
|
import {getButton, queryButton} from '../__tests__/fastRoleQueries';
|
|
16
22
|
import {DateInput} from './DateInput';
|
|
@@ -133,21 +139,27 @@ describe('DateInput', () => {
|
|
|
133
139
|
});
|
|
134
140
|
|
|
135
141
|
it('announces an alert message when typed input is invalid', () => {
|
|
136
|
-
|
|
142
|
+
// Scope to the component's own container: the embedded Calendar uses the
|
|
143
|
+
// shared `useAnnounce` hook, whose global polite/assertive live-region pair
|
|
144
|
+
// (both mounted on document.body by any announce) would otherwise make a
|
|
145
|
+
// document-wide `getByRole('alert')` ambiguous.
|
|
146
|
+
const {container} = render(<DateInput label="Date" onChange={() => {}} />);
|
|
137
147
|
|
|
138
148
|
const input = screen.getByRole('combobox');
|
|
139
149
|
fireEvent.change(input, {target: {value: '13/45/2024'}});
|
|
140
150
|
|
|
141
|
-
expect(
|
|
151
|
+
expect(within(container).getByRole('alert')).toHaveTextContent(
|
|
152
|
+
'Invalid date',
|
|
153
|
+
);
|
|
142
154
|
});
|
|
143
155
|
|
|
144
156
|
it('does not announce an alert message when input is valid', () => {
|
|
145
|
-
render(<DateInput label="Date" onChange={() => {}} />);
|
|
157
|
+
const {container} = render(<DateInput label="Date" onChange={() => {}} />);
|
|
146
158
|
|
|
147
159
|
const input = screen.getByRole('combobox');
|
|
148
160
|
fireEvent.change(input, {target: {value: '03/15/2026'}});
|
|
149
161
|
|
|
150
|
-
expect(
|
|
162
|
+
expect(within(container).getByRole('alert')).toHaveTextContent('');
|
|
151
163
|
expect(screen.queryByText('Invalid date')).not.toBeInTheDocument();
|
|
152
164
|
});
|
|
153
165
|
|
|
@@ -137,6 +137,7 @@ import {mergeProps, mergeRefs} from '../utils';
|
|
|
137
137
|
import type {BaseProps} from '../BaseProps';
|
|
138
138
|
import type {SizeValue} from '../utils/types';
|
|
139
139
|
import {themeProps} from '../utils/themeProps';
|
|
140
|
+
import {useTranslator} from '../i18n';
|
|
140
141
|
|
|
141
142
|
export interface DateInputProps extends Omit<
|
|
142
143
|
BaseProps,
|
|
@@ -311,7 +312,7 @@ export function DateInput({
|
|
|
311
312
|
min,
|
|
312
313
|
max,
|
|
313
314
|
dateConstraints,
|
|
314
|
-
placeholder
|
|
315
|
+
placeholder: placeholderFromProps,
|
|
315
316
|
size: sizeProp,
|
|
316
317
|
status,
|
|
317
318
|
labelTooltip,
|
|
@@ -324,6 +325,9 @@ export function DateInput({
|
|
|
324
325
|
ref,
|
|
325
326
|
...rest
|
|
326
327
|
}: DateInputProps) {
|
|
328
|
+
const t = useTranslator();
|
|
329
|
+
const placeholder =
|
|
330
|
+
placeholderFromProps ?? t('@astryx.dateInput.placeholder');
|
|
327
331
|
const size = useSize(sizeProp, 'md');
|
|
328
332
|
const id = useId();
|
|
329
333
|
const inputLabelID = useId();
|
|
@@ -415,8 +419,8 @@ export function DateInput({
|
|
|
415
419
|
: parseDateInput(pendingInput) !== null;
|
|
416
420
|
|
|
417
421
|
const popover = usePopover({
|
|
418
|
-
dialogLabel: '
|
|
419
|
-
closeButtonLabel: '
|
|
422
|
+
dialogLabel: t('@astryx.dateInput.dialogLabel'),
|
|
423
|
+
closeButtonLabel: t('@astryx.dateInput.closeCalendar'),
|
|
420
424
|
onHide: () => inputRef.current?.focus(),
|
|
421
425
|
});
|
|
422
426
|
|
|
@@ -582,7 +586,11 @@ export function DateInput({
|
|
|
582
586
|
type="button"
|
|
583
587
|
onClick={handleToggle}
|
|
584
588
|
disabled={isEffectivelyDisabled}
|
|
585
|
-
aria-label={
|
|
589
|
+
aria-label={
|
|
590
|
+
popover.isOpen
|
|
591
|
+
? t('@astryx.dateInput.toggleCalendarClose')
|
|
592
|
+
: t('@astryx.dateInput.openCalendar')
|
|
593
|
+
}
|
|
586
594
|
{...stylex.props(
|
|
587
595
|
styles.iconButton,
|
|
588
596
|
isEffectivelyDisabled && styles.iconButtonDisabled,
|
|
@@ -637,7 +645,7 @@ export function DateInput({
|
|
|
637
645
|
<button
|
|
638
646
|
type="button"
|
|
639
647
|
onClick={handleClear}
|
|
640
|
-
aria-label={
|
|
648
|
+
aria-label={t('@astryx.dateInput.clear', {label})}
|
|
641
649
|
{...stylex.props(styles.iconButton)}>
|
|
642
650
|
<Icon icon="close" size="sm" color="secondary" />
|
|
643
651
|
</button>
|
|
@@ -54,6 +54,7 @@ import type {BaseProps} from '../BaseProps';
|
|
|
54
54
|
import type {SizeValue} from '../utils/types';
|
|
55
55
|
import {useSize} from '../SizeContext/SizeContext';
|
|
56
56
|
import {themeProps} from '../utils/themeProps';
|
|
57
|
+
import {useTranslator} from '../i18n';
|
|
57
58
|
|
|
58
59
|
export type {DateRange} from '../Calendar';
|
|
59
60
|
|
|
@@ -381,7 +382,7 @@ export function DateRangeInput({
|
|
|
381
382
|
dateConstraints,
|
|
382
383
|
presets,
|
|
383
384
|
hasClear = true,
|
|
384
|
-
placeholder
|
|
385
|
+
placeholder: placeholderFromProps,
|
|
385
386
|
size: sizeProp,
|
|
386
387
|
status,
|
|
387
388
|
labelTooltip,
|
|
@@ -393,6 +394,9 @@ export function DateRangeInput({
|
|
|
393
394
|
ref,
|
|
394
395
|
...rest
|
|
395
396
|
}: DateRangeInputProps) {
|
|
397
|
+
const t = useTranslator();
|
|
398
|
+
const placeholder =
|
|
399
|
+
placeholderFromProps ?? t('@astryx.dateRangeInput.placeholder');
|
|
396
400
|
const size = useSize(sizeProp, 'md');
|
|
397
401
|
const id = useId();
|
|
398
402
|
const descriptionID = useId();
|
|
@@ -448,8 +452,8 @@ export function DateRangeInput({
|
|
|
448
452
|
);
|
|
449
453
|
|
|
450
454
|
const popover = usePopover({
|
|
451
|
-
dialogLabel: '
|
|
452
|
-
closeButtonLabel: '
|
|
455
|
+
dialogLabel: t('@astryx.dateRangeInput.dialogLabel'),
|
|
456
|
+
closeButtonLabel: t('@astryx.dateInput.closeCalendar'),
|
|
453
457
|
});
|
|
454
458
|
|
|
455
459
|
const fireChange = useCallback(
|
|
@@ -557,7 +561,11 @@ export function DateRangeInput({
|
|
|
557
561
|
type="button"
|
|
558
562
|
onClick={handleToggle}
|
|
559
563
|
disabled={isEffectivelyDisabled}
|
|
560
|
-
aria-label={
|
|
564
|
+
aria-label={
|
|
565
|
+
popover.isOpen
|
|
566
|
+
? t('@astryx.dateInput.toggleCalendarClose')
|
|
567
|
+
: t('@astryx.dateInput.openCalendar')
|
|
568
|
+
}
|
|
561
569
|
tabIndex={-1}
|
|
562
570
|
{...stylex.props(
|
|
563
571
|
styles.iconButton,
|
|
@@ -594,7 +602,7 @@ export function DateRangeInput({
|
|
|
594
602
|
<button
|
|
595
603
|
type="button"
|
|
596
604
|
onClick={handleClear}
|
|
597
|
-
aria-label={
|
|
605
|
+
aria-label={t('@astryx.dateInput.clear', {label})}
|
|
598
606
|
{...stylex.props(styles.iconButton)}>
|
|
599
607
|
<Icon icon="close" size="sm" color="secondary" />
|
|
600
608
|
</button>
|
|
@@ -613,7 +621,7 @@ export function DateRangeInput({
|
|
|
613
621
|
{presets && presets.length > 0 && (
|
|
614
622
|
<div
|
|
615
623
|
role="group"
|
|
616
|
-
aria-label=
|
|
624
|
+
aria-label={t('@astryx.dateRangeInput.presetDateRanges')}
|
|
617
625
|
{...stylex.props(styles.presetSidebar)}>
|
|
618
626
|
{presets.map(preset => {
|
|
619
627
|
const presetRange = preset.getRange();
|
|
@@ -157,7 +157,7 @@ export const docs = {
|
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
name: 'status',
|
|
160
|
-
type: '
|
|
160
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
161
161
|
description:
|
|
162
162
|
'Status indicator object for error, warning, or success states with a message.',
|
|
163
163
|
},
|
|
@@ -449,7 +449,7 @@ export const docsZh = {
|
|
|
449
449
|
},
|
|
450
450
|
{
|
|
451
451
|
name: 'status',
|
|
452
|
-
type: '
|
|
452
|
+
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
453
453
|
description: '错误、警告或成功状态的状态指示对象,附带消息。',
|
|
454
454
|
},
|
|
455
455
|
{
|
|
@@ -77,6 +77,7 @@ import type {BaseProps} from '../BaseProps';
|
|
|
77
77
|
import type {SizeValue} from '../utils/types';
|
|
78
78
|
import {useSize} from '../SizeContext/SizeContext';
|
|
79
79
|
import {themeProps} from '../utils/themeProps';
|
|
80
|
+
import {useTranslator} from '../i18n';
|
|
80
81
|
|
|
81
82
|
export type ISODateTimeString = string & {
|
|
82
83
|
readonly __brand: 'ISODateTimeString';
|
|
@@ -418,8 +419,8 @@ export function DateTimeInput({
|
|
|
418
419
|
hourFormat = '12h',
|
|
419
420
|
timeIncrement = 1,
|
|
420
421
|
hasClear = false,
|
|
421
|
-
placeholder
|
|
422
|
-
timePlaceholder
|
|
422
|
+
placeholder: placeholderFromProps,
|
|
423
|
+
timePlaceholder: timePlaceholderFromProps,
|
|
423
424
|
timeLabel,
|
|
424
425
|
size: sizeProp,
|
|
425
426
|
status,
|
|
@@ -432,6 +433,11 @@ export function DateTimeInput({
|
|
|
432
433
|
ref,
|
|
433
434
|
...rest
|
|
434
435
|
}: DateTimeInputProps) {
|
|
436
|
+
const t = useTranslator();
|
|
437
|
+
const placeholder =
|
|
438
|
+
placeholderFromProps ?? t('@astryx.dateTimeInput.placeholder');
|
|
439
|
+
const timePlaceholder =
|
|
440
|
+
timePlaceholderFromProps ?? t('@astryx.dateTimeInput.timePlaceholder');
|
|
435
441
|
const size = useSize(sizeProp, 'md');
|
|
436
442
|
const dateInputId = useId();
|
|
437
443
|
const timeInputId = useId();
|
|
@@ -599,8 +605,8 @@ export function DateTimeInput({
|
|
|
599
605
|
|
|
600
606
|
// --- Popover ---
|
|
601
607
|
const popover = usePopover({
|
|
602
|
-
dialogLabel: '
|
|
603
|
-
closeButtonLabel: '
|
|
608
|
+
dialogLabel: t('@astryx.dateTimeInput.dialogLabel'),
|
|
609
|
+
closeButtonLabel: t('@astryx.dateInput.closeCalendar'),
|
|
604
610
|
onHide: () => dateInputRef.current?.focus(),
|
|
605
611
|
});
|
|
606
612
|
|
|
@@ -887,7 +893,11 @@ export function DateTimeInput({
|
|
|
887
893
|
type="button"
|
|
888
894
|
onClick={handleCalendarToggle}
|
|
889
895
|
disabled={isEffectivelyDisabled}
|
|
890
|
-
aria-label={
|
|
896
|
+
aria-label={
|
|
897
|
+
popover.isOpen
|
|
898
|
+
? t('@astryx.dateInput.toggleCalendarClose')
|
|
899
|
+
: t('@astryx.dateInput.openCalendar')
|
|
900
|
+
}
|
|
891
901
|
{...stylex.props(
|
|
892
902
|
styles.iconButton,
|
|
893
903
|
isEffectivelyDisabled && styles.iconButtonDisabled,
|
|
@@ -942,7 +952,7 @@ export function DateTimeInput({
|
|
|
942
952
|
<button
|
|
943
953
|
type="button"
|
|
944
954
|
onClick={handleClear}
|
|
945
|
-
aria-label={
|
|
955
|
+
aria-label={t('@astryx.dateInput.clear', {label})}
|
|
946
956
|
{...stylex.props(styles.iconButton)}>
|
|
947
957
|
<Icon icon="close" size="sm" color="secondary" />
|
|
948
958
|
</button>
|
|
@@ -990,7 +1000,7 @@ export function DateTimeInput({
|
|
|
990
1000
|
disabled={isEffectivelyDisabled && !showsDisabledMessage}
|
|
991
1001
|
aria-disabled={showsDisabledMessage ? 'true' : undefined}
|
|
992
1002
|
readOnly={showsDisabledMessage || undefined}
|
|
993
|
-
aria-label={timeLabel ??
|
|
1003
|
+
aria-label={timeLabel ?? t('@astryx.dateTimeInput.timeSuffix', {label})}
|
|
994
1004
|
aria-describedby={ariaDescribedBy}
|
|
995
1005
|
aria-required={isRequired === true ? 'true' : undefined}
|
|
996
1006
|
aria-invalid={
|
package/src/Dialog/Dialog.tsx
CHANGED
|
@@ -508,6 +508,10 @@ export function Dialog({
|
|
|
508
508
|
</div>
|
|
509
509
|
);
|
|
510
510
|
|
|
511
|
+
// Filter out native open to prevent InvalidStateError when accidentally passed
|
|
512
|
+
const hasPosition = position != null && !isFullscreen;
|
|
513
|
+
const {open: _open, ...safeProps} = props as Record<string, unknown>;
|
|
514
|
+
|
|
511
515
|
// --- Inline rendering path (for documentation previews) ---
|
|
512
516
|
if (isInline) {
|
|
513
517
|
if (!isOpen) {
|
|
@@ -516,6 +520,7 @@ export function Dialog({
|
|
|
516
520
|
|
|
517
521
|
return (
|
|
518
522
|
<div
|
|
523
|
+
{...safeProps}
|
|
519
524
|
{...mergeProps(
|
|
520
525
|
themeProps('dialog', {variant}),
|
|
521
526
|
stylex.props(
|
|
@@ -526,30 +531,18 @@ export function Dialog({
|
|
|
526
531
|
),
|
|
527
532
|
className,
|
|
528
533
|
style,
|
|
529
|
-
)}
|
|
530
|
-
data-testid={
|
|
531
|
-
(props as Record<string, unknown>)['data-testid'] as
|
|
532
|
-
| string
|
|
533
|
-
| undefined
|
|
534
|
-
}>
|
|
534
|
+
)}>
|
|
535
535
|
{innerContent}
|
|
536
536
|
</div>
|
|
537
537
|
);
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
// --- Standard modal rendering path ---
|
|
541
|
-
const hasPosition = position != null && !isFullscreen;
|
|
542
|
-
|
|
543
|
-
// Filter out native open to prevent InvalidStateError when accidentally passed
|
|
544
|
-
const {open: _open, ...safeProps} = props as Record<string, unknown>;
|
|
545
541
|
|
|
546
542
|
return (
|
|
547
543
|
<dialog
|
|
548
544
|
ref={mergeRefs(ref, dialogRef)}
|
|
549
|
-
|
|
550
|
-
onCancel={handleCancel}
|
|
551
|
-
aria-modal="true"
|
|
552
|
-
role={purpose === 'required' ? 'alertdialog' : undefined}
|
|
545
|
+
{...safeProps}
|
|
553
546
|
{...mergeProps(
|
|
554
547
|
themeProps('dialog', {variant}),
|
|
555
548
|
stylex.props(
|
|
@@ -570,7 +563,10 @@ export function Dialog({
|
|
|
570
563
|
className,
|
|
571
564
|
style,
|
|
572
565
|
)}
|
|
573
|
-
{
|
|
566
|
+
onClick={handleClick}
|
|
567
|
+
onCancel={handleCancel}
|
|
568
|
+
aria-modal="true"
|
|
569
|
+
{...(purpose === 'required' ? {role: 'alertdialog'} : undefined)}>
|
|
574
570
|
{innerContent}
|
|
575
571
|
</dialog>
|
|
576
572
|
);
|
|
@@ -26,6 +26,7 @@ import {Heading} from '../Heading/Heading';
|
|
|
26
26
|
import {Text} from '../Text/Text';
|
|
27
27
|
import type {BaseProps} from '../BaseProps';
|
|
28
28
|
import {useDialogContext} from './DialogContext';
|
|
29
|
+
import {useTranslator} from '../i18n';
|
|
29
30
|
|
|
30
31
|
const styles = stylex.create({
|
|
31
32
|
container: {
|
|
@@ -130,7 +131,9 @@ export function DialogHeader({
|
|
|
130
131
|
className,
|
|
131
132
|
style,
|
|
132
133
|
ref,
|
|
134
|
+
...rest
|
|
133
135
|
}: DialogHeaderProps) {
|
|
136
|
+
const t = useTranslator();
|
|
134
137
|
const titleRef = useRef<HTMLHeadingElement>(null);
|
|
135
138
|
const dialogContext = useDialogContext();
|
|
136
139
|
const shouldAutoFocus = dialogContext?.isInline !== true;
|
|
@@ -150,7 +153,8 @@ export function DialogHeader({
|
|
|
150
153
|
hasDivider={hasDivider}
|
|
151
154
|
xstyle={xstyle}
|
|
152
155
|
className={className}
|
|
153
|
-
style={style}
|
|
156
|
+
style={style}
|
|
157
|
+
{...rest}>
|
|
154
158
|
<div {...stylex.props(styles.container)}>
|
|
155
159
|
{startContent && (
|
|
156
160
|
<div {...stylex.props(styles.actions)}>{startContent}</div>
|
|
@@ -179,8 +183,8 @@ export function DialogHeader({
|
|
|
179
183
|
{onOpenChange && (
|
|
180
184
|
<Button
|
|
181
185
|
variant="ghost"
|
|
182
|
-
label=
|
|
183
|
-
tooltip=
|
|
186
|
+
label={t('@astryx.dialog.close')}
|
|
187
|
+
tooltip={t('@astryx.dialog.close')}
|
|
184
188
|
icon={<Icon icon="close" color="inherit" />}
|
|
185
189
|
onClick={() => {
|
|
186
190
|
onOpenChange?.(false);
|
|
@@ -8,10 +8,33 @@ export const docs = {
|
|
|
8
8
|
group: 'DropdownMenu',
|
|
9
9
|
category: 'Action',
|
|
10
10
|
keywords: ["dropdown","menu","popover","select","actions","contextmenu","overflow","kebab","menubutton"],
|
|
11
|
+
playground: {
|
|
12
|
+
// `items` is required; without seeded entries the properties-tab preview
|
|
13
|
+
// renders an empty trigger button. Provide a few actions so the preview
|
|
14
|
+
// is meaningful.
|
|
15
|
+
defaults: {
|
|
16
|
+
button: {label: 'Actions'},
|
|
17
|
+
items: [
|
|
18
|
+
{label: 'Edit'},
|
|
19
|
+
{label: 'Duplicate'},
|
|
20
|
+
{label: 'Delete'},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
11
24
|
theming: {
|
|
12
25
|
targets: [
|
|
13
26
|
{className: 'astryx-dropdown-menu'},
|
|
14
27
|
{className: 'astryx-dropdown-menu-item', visualProps: ['size']},
|
|
28
|
+
{
|
|
29
|
+
className: 'astryx-dropdown-menu-checkbox',
|
|
30
|
+
visualProps: ['size'],
|
|
31
|
+
states: ['checked', 'disabled'],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
className: 'astryx-dropdown-menu-radio',
|
|
35
|
+
visualProps: ['size'],
|
|
36
|
+
states: ['checked', 'disabled'],
|
|
37
|
+
},
|
|
15
38
|
],
|
|
16
39
|
vars: [
|
|
17
40
|
{name: '--_dropdown-menu-radius', description: 'Border radius of the menu popup', default: 'var(--radius-element)', private: true},
|
|
@@ -38,6 +38,7 @@ import {Icon} from '../Icon';
|
|
|
38
38
|
import type {IconType} from '../Icon';
|
|
39
39
|
|
|
40
40
|
import {renderDropdownItems} from './renderDropdownItems';
|
|
41
|
+
import {MENU_ITEM_ROLES, MENU_ITEM_SELECTOR} from './menuItemRoles';
|
|
41
42
|
import {
|
|
42
43
|
DropdownMenuContext,
|
|
43
44
|
type DropdownMenuContextValue,
|
|
@@ -55,6 +56,7 @@ import {
|
|
|
55
56
|
import {mergeProps} from '../utils';
|
|
56
57
|
import type {BaseProps} from '../BaseProps';
|
|
57
58
|
import {themeProps} from '../utils/themeProps';
|
|
59
|
+
import {useTranslator} from '../i18n';
|
|
58
60
|
|
|
59
61
|
const styles = stylex.create({
|
|
60
62
|
dropdown: {
|
|
@@ -111,9 +113,7 @@ export interface DropdownMenuSection {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
export type DropdownMenuOption =
|
|
114
|
-
|
|
|
115
|
-
| DropdownMenuDivider
|
|
116
|
-
| DropdownMenuSection;
|
|
116
|
+
DropdownMenuItemData | DropdownMenuDivider | DropdownMenuSection;
|
|
117
117
|
|
|
118
118
|
// =============================================================================
|
|
119
119
|
// Props
|
|
@@ -149,8 +149,7 @@ interface DropdownMenuCompoundProps extends DropdownMenuBaseProps {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export type DropdownMenuProps =
|
|
152
|
-
|
|
|
153
|
-
| DropdownMenuCompoundProps;
|
|
152
|
+
DropdownMenuDataProps | DropdownMenuCompoundProps;
|
|
154
153
|
|
|
155
154
|
// =============================================================================
|
|
156
155
|
// DropdownMenu
|
|
@@ -176,10 +175,13 @@ export type DropdownMenuProps =
|
|
|
176
175
|
* />
|
|
177
176
|
* ```
|
|
178
177
|
*/
|
|
179
|
-
|
|
178
|
+
// When the consumer doesn't pass `button`, the default label is looked up
|
|
179
|
+
// at render time so it respects the active InternationalizationProvider
|
|
180
|
+
// locale.
|
|
181
|
+
const DEFAULT_BUTTON_I18N_KEY = '@astryx.dropdownMenu.label' as const;
|
|
180
182
|
|
|
181
183
|
export function DropdownMenu({
|
|
182
|
-
button
|
|
184
|
+
button: buttonFromProps,
|
|
183
185
|
isMenuOpen: controlledIsOpen,
|
|
184
186
|
onOpenChange,
|
|
185
187
|
menuWidth,
|
|
@@ -192,11 +194,14 @@ export function DropdownMenu({
|
|
|
192
194
|
'data-testid': testId,
|
|
193
195
|
...props
|
|
194
196
|
}: DropdownMenuProps) {
|
|
197
|
+
const t = useTranslator();
|
|
198
|
+
const button = buttonFromProps ?? {label: t(DEFAULT_BUTTON_I18N_KEY)};
|
|
199
|
+
|
|
195
200
|
const items = ('items' in props ? props.items : undefined) ?? [];
|
|
196
201
|
const children = props.children;
|
|
197
202
|
|
|
198
203
|
const menuId = useId();
|
|
199
|
-
const menuSize = button
|
|
204
|
+
const menuSize = button.size ?? 'md';
|
|
200
205
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
201
206
|
|
|
202
207
|
// Open state
|
|
@@ -251,14 +256,17 @@ export function DropdownMenu({
|
|
|
251
256
|
popover.hide();
|
|
252
257
|
}, [popover]);
|
|
253
258
|
|
|
254
|
-
// Single keyboard navigation path for both modes
|
|
259
|
+
// Single keyboard navigation path for both modes.
|
|
260
|
+
// The selector matches plain items plus selectable items
|
|
261
|
+
// (menuitemradio/menuitemcheckbox) so lab checkbox/radio rows are reachable
|
|
262
|
+
// and roved to alongside plain items — not just role="menuitem".
|
|
255
263
|
const {
|
|
256
264
|
listRef,
|
|
257
265
|
handleKeyDown: listNavKeyDown,
|
|
258
266
|
focusFirst,
|
|
259
267
|
focusItem,
|
|
260
268
|
} = useListFocus<HTMLDivElement>({
|
|
261
|
-
itemSelector:
|
|
269
|
+
itemSelector: MENU_ITEM_SELECTOR,
|
|
262
270
|
wrap: false,
|
|
263
271
|
onEscape: closeMenu,
|
|
264
272
|
});
|
|
@@ -269,9 +277,7 @@ export function DropdownMenu({
|
|
|
269
277
|
(): HTMLElement[] =>
|
|
270
278
|
listRef.current
|
|
271
279
|
? Array.from(
|
|
272
|
-
listRef.current.querySelectorAll<HTMLElement>(
|
|
273
|
-
'[role="menuitem"]:not([aria-disabled="true"])',
|
|
274
|
-
),
|
|
280
|
+
listRef.current.querySelectorAll<HTMLElement>(MENU_ITEM_SELECTOR),
|
|
275
281
|
)
|
|
276
282
|
: [],
|
|
277
283
|
[listRef],
|
|
@@ -304,7 +310,10 @@ export function DropdownMenu({
|
|
|
304
310
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
305
311
|
e.preventDefault();
|
|
306
312
|
const focused = document.activeElement as HTMLElement | null;
|
|
307
|
-
if (
|
|
313
|
+
if (
|
|
314
|
+
focused &&
|
|
315
|
+
MENU_ITEM_ROLES.has(focused.getAttribute('role') ?? '')
|
|
316
|
+
) {
|
|
308
317
|
focused.click();
|
|
309
318
|
}
|
|
310
319
|
return;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../docs-types').ComponentDoc} */
|
|
4
|
+
|
|
5
|
+
export const docs = {
|
|
6
|
+
name: 'DropdownMenuCheckboxItem',
|
|
7
|
+
subComponentOf: 'DropdownMenu',
|
|
8
|
+
displayName: 'Dropdown Menu Checkbox Item',
|
|
9
|
+
isHiddenFromOverview: true,
|
|
10
|
+
description:
|
|
11
|
+
'A checkable menu item (role="menuitemcheckbox") that toggles an independent boolean. Use for on/off options inside a DropdownMenu; for a one-of-N choice use DropdownMenuRadioGroup.',
|
|
12
|
+
props: [
|
|
13
|
+
{
|
|
14
|
+
name: 'label',
|
|
15
|
+
type: 'ReactNode',
|
|
16
|
+
description: 'Primary label text identifying the item.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'description',
|
|
20
|
+
type: 'ReactNode',
|
|
21
|
+
description: 'Secondary description text displayed below the label.',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'icon',
|
|
25
|
+
type: 'IconType',
|
|
26
|
+
description:
|
|
27
|
+
'Icon to display before the label. See `npx astryx docs icons` for valid semantic names.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'value',
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
description: 'Whether the item is checked. Controlled — pair with onChange.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'onChange',
|
|
36
|
+
type: '(checked: boolean) => void',
|
|
37
|
+
description: 'Callback fired with the next checked state when the item is toggled.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'isDisabled',
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
default: 'false',
|
|
43
|
+
description:
|
|
44
|
+
'Whether the item is disabled. Disabled items stay focusable (via aria-disabled) so they remain discoverable by keyboard and assistive technology, but activation is blocked.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'hasCloseOnSelect',
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
default: 'false',
|
|
50
|
+
description:
|
|
51
|
+
'Whether toggling the item closes the menu. Checkbox items default to staying open so several can be toggled in a single session.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'endContent',
|
|
55
|
+
type: 'ReactNode',
|
|
56
|
+
description:
|
|
57
|
+
'Content to render after the label and description, such as a keyboard shortcut hint or badge.',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const docsZh = {
|
|
63
|
+
name: 'DropdownMenuCheckboxItem',
|
|
64
|
+
isHiddenFromOverview: true,
|
|
65
|
+
displayName: 'Dropdown Menu Checkbox Item',
|
|
66
|
+
description:
|
|
67
|
+
'可勾选的菜单项(role="menuitemcheckbox"),用于切换独立的布尔值。用于 DropdownMenu 中的开关选项;单选请使用 DropdownMenuRadioGroup。',
|
|
68
|
+
propDescriptions: {
|
|
69
|
+
label: '标识该项的主标签文本。',
|
|
70
|
+
description: '显示在标签下方的次要描述文本。',
|
|
71
|
+
icon: '显示在标签前的图标。',
|
|
72
|
+
value: '该项是否被勾选。受控 — 与 onChange 搭配使用。',
|
|
73
|
+
onChange: '切换该项时以下一个勾选状态触发的回调。',
|
|
74
|
+
isDisabled: '该项是否禁用。',
|
|
75
|
+
hasCloseOnSelect: '切换该项是否关闭菜单。默认保持打开。',
|
|
76
|
+
endContent: '在标签和描述之后渲染的内容。',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const docsDense = {
|
|
81
|
+
name: 'DropdownMenuCheckboxItem',
|
|
82
|
+
isHiddenFromOverview: true,
|
|
83
|
+
displayName: 'Dropdown Menu Checkbox Item',
|
|
84
|
+
description: 'checkable menu item (menuitemcheckbox); independent boolean toggle',
|
|
85
|
+
propDescriptions: {
|
|
86
|
+
label: 'primary label text',
|
|
87
|
+
description: 'secondary text below label',
|
|
88
|
+
icon: 'icon before label',
|
|
89
|
+
value: 'checked state (controlled, w/ onChange)',
|
|
90
|
+
onChange: 'fired w/ next checked state on toggle',
|
|
91
|
+
isDisabled: 'disabled; stays focusable via aria-disabled',
|
|
92
|
+
hasCloseOnSelect: 'close menu on toggle (default false — stays open)',
|
|
93
|
+
endContent: 'content after label+description',
|
|
94
|
+
},
|
|
95
|
+
};
|