@astryxdesign/core 0.1.6 → 0.1.7-canary.04cd8f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +25 -14
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +4 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +4 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +8 -6
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/Button/Button.d.ts +10 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +49 -6
- package/dist/ButtonGroup/ButtonGroup.d.ts +20 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +27 -11
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +29 -7
- package/dist/Carousel/Carousel.d.ts +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -5
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -1
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +9 -2
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -2
- package/dist/Chat/ChatLayout.d.ts +1 -11
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +6 -4
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +4 -2
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +8 -2
- package/dist/Chat/ChatMessageBubble.d.ts +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +3 -1
- package/dist/Chat/ChatMessageList.d.ts +1 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +3 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +13 -8
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts +12 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +43 -6
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +4 -2
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +4 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +4 -2
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +3 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +3 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +10 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +71 -53
- package/dist/Collapsible/Collapsible.d.ts +11 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +36 -4
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +8 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +4 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteList.js +4 -1
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +8 -4
- package/dist/ContextMenu/index.d.ts +3 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +7 -1
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +10 -5
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -6
- package/dist/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +15 -7
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +15 -12
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +7 -3
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +19 -9
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +89 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +170 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +70 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +10 -1
- package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemRoles.js +15 -0
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +11 -1
- package/dist/Icon/Icon.d.ts +17 -12
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +28 -20
- package/dist/Kbd/Kbd.js +1 -1
- package/dist/Layer/useLayer.d.ts +10 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +23 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +6 -4
- package/dist/Link/Link.d.ts +5 -1
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +32 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +10 -8
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +4 -2
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +4 -1
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +13 -6
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +5 -1
- package/dist/Outline/Outline.d.ts +1 -1
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +22 -12
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +26 -20
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +34 -21
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -1
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +19 -9
- package/dist/PowerSearch/index.d.ts +2 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/index.js +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +23 -0
- package/dist/PowerSearch/resolveOperatorLabel.d.ts.map +1 -0
- package/dist/PowerSearch/resolveOperatorLabel.js +28 -0
- package/dist/PowerSearch/types.d.ts +28 -2
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.js +27 -27
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/PowerSearch/usePowerSearchSource.js +15 -8
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +4 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +52 -14
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +3 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +5 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +7 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +6 -1
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +5 -3
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +56 -19
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +12 -5
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +6 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +8 -6
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +1 -1
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +5 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +6 -4
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -2
- package/dist/Table/plugins/tree/index.d.ts +5 -0
- package/dist/Table/plugins/tree/index.d.ts.map +1 -0
- package/dist/Table/plugins/tree/index.js +4 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
- package/dist/Table/types.d.ts +17 -10
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +6 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +5 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +8 -2
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +18 -3
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +3 -1
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +8 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +3 -1
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +8 -1
- package/dist/TopNav/TopNav.d.ts +2 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +4 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +5 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +5 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +8 -4
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +1 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -0
- package/dist/astryx.css +38 -4
- package/dist/astryx.umd.js +62 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts +145 -0
- package/dist/authoring/doc.d.ts.map +1 -0
- package/dist/authoring/doc.js +100 -0
- package/dist/authoring/index.d.ts +29 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +28 -0
- package/dist/authoring/integration.d.ts +35 -0
- package/dist/authoring/integration.d.ts.map +1 -0
- package/dist/authoring/integration.js +30 -0
- package/dist/authoring/template.d.ts +66 -0
- package/dist/authoring/template.d.ts.map +1 -0
- package/dist/authoring/template.js +55 -0
- package/dist/config.d.ts +80 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/docs-types.d.ts +13 -4
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +61 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/hct.d.ts +0 -1
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +0 -3
- package/dist/utils/color.d.ts +13 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +23 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/locales/en.json +754 -0
- package/locales/pseudo.json +566 -0
- package/package.json +23 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/AlertDialog/AlertDialog.tsx +4 -1
- package/src/AppShell/AppShell.doc.mjs +8 -2
- package/src/AppShell/AppShell.tsx +3 -1
- package/src/AvatarGroup/AvatarGroup.tsx +4 -1
- package/src/Banner/Banner.tsx +10 -5
- package/src/Breadcrumbs/Breadcrumbs.tsx +4 -1
- package/src/Button/Button.doc.mjs +8 -0
- package/src/Button/Button.test.tsx +27 -0
- package/src/Button/Button.tsx +51 -5
- package/src/ButtonGroup/ButtonGroup.test.tsx +386 -2
- package/src/ButtonGroup/ButtonGroup.tsx +27 -11
- package/src/Calendar/Calendar.test.tsx +103 -2
- package/src/Calendar/Calendar.tsx +29 -6
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Carousel/Carousel.tsx +10 -7
- package/src/Chat/ChatComposer.tsx +5 -1
- package/src/Chat/ChatComposerDrawer.tsx +9 -2
- package/src/Chat/ChatComposerInput.tsx +10 -4
- package/src/Chat/ChatLayout.test.tsx +127 -2
- package/src/Chat/ChatLayout.tsx +5 -12
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/ChatMessage.tsx +5 -1
- package/src/Chat/ChatMessageBubble.tsx +2 -0
- package/src/Chat/ChatMessageList.doc.mjs +1 -1
- package/src/Chat/ChatMessageList.tsx +2 -0
- package/src/Chat/ChatMessageMetadata.tsx +15 -9
- package/src/Chat/ChatPastedTextToken.tsx +3 -1
- package/src/Chat/ChatSendButton.tsx +3 -1
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/index.ts +1 -0
- package/src/Chat/useChatStreamScroll.test.tsx +168 -0
- package/src/Chat/useChatStreamScroll.ts +67 -11
- package/src/Chat/useSpeechRecognition.ts +11 -2
- package/src/Chat/useTriggerMenu.tsx +4 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -1
- package/src/CheckboxList/CheckboxList.tsx +2 -0
- package/src/CheckboxList/CheckboxListItem.tsx +7 -1
- package/src/Citation/Citation.tsx +4 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +1 -1
- package/src/CodeBlock/CodeBlock.tsx +91 -40
- package/src/Collapsible/Collapsible.doc.mjs +7 -0
- package/src/Collapsible/Collapsible.test.tsx +80 -0
- package/src/Collapsible/Collapsible.tsx +58 -5
- package/src/CommandPalette/CommandPalette.tsx +10 -3
- package/src/CommandPalette/CommandPaletteInput.test.tsx +1 -1
- package/src/CommandPalette/CommandPaletteInput.tsx +5 -1
- package/src/CommandPalette/CommandPaletteList.tsx +4 -1
- package/src/ContextMenu/ContextMenu.test.tsx +75 -1
- package/src/ContextMenu/ContextMenu.tsx +14 -6
- package/src/ContextMenu/index.ts +15 -0
- package/src/DateInput/DateInput.doc.mjs +2 -2
- package/src/DateInput/DateInput.test.tsx +17 -5
- package/src/DateInput/DateInput.tsx +13 -5
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +14 -6
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -2
- package/src/DateTimeInput/DateTimeInput.tsx +17 -7
- package/src/Dialog/Dialog.tsx +11 -15
- package/src/Dialog/DialogHeader.tsx +7 -3
- package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +23 -14
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +237 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +119 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
- package/src/DropdownMenu/index.ts +23 -3
- package/src/DropdownMenu/menuItemRoles.ts +22 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Field/Field.doc.mjs +3 -3
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/FileInput/FileInput.test.tsx +40 -1
- package/src/FileInput/FileInput.tsx +12 -1
- package/src/Grid/Grid.doc.mjs +5 -5
- package/src/Icon/Icon.test.tsx +46 -0
- package/src/Icon/Icon.tsx +37 -24
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Kbd/Kbd.test.tsx +26 -0
- package/src/Kbd/Kbd.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +8 -5
- package/src/Layer/useLayer.test.tsx +136 -1
- package/src/Layer/useLayer.tsx +34 -2
- package/src/Lightbox/Lightbox.doc.mjs +7 -2
- package/src/Lightbox/Lightbox.tsx +6 -4
- package/src/Link/Link.test.tsx +74 -2
- package/src/Link/Link.tsx +48 -1
- package/src/Markdown/Markdown.tsx +12 -4
- package/src/MobileNav/MobileNav.tsx +4 -2
- package/src/MobileNav/MobileNavToggle.tsx +5 -3
- package/src/MoreMenu/MoreMenu.tsx +4 -1
- package/src/MultiSelector/MultiSelector.tsx +14 -5
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.tsx +4 -1
- package/src/OverflowList/OverflowList.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/Popover/usePopover.tsx +6 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +9 -4
- package/src/PowerSearch/PowerSearch.tsx +22 -10
- package/src/PowerSearch/PowerSearchEditPopover.tsx +27 -20
- package/src/PowerSearch/PowerSearchToken.tsx +17 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +34 -21
- package/src/PowerSearch/formatFilterValue.test.ts +282 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -8
- package/src/PowerSearch/index.ts +5 -0
- package/src/PowerSearch/resolveOperatorLabel.ts +34 -0
- package/src/PowerSearch/types.ts +33 -9
- package/src/PowerSearch/usePowerSearchConfig.ts +59 -27
- package/src/PowerSearch/usePowerSearchSource.ts +17 -8
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/ResizeHandle.tsx +4 -1
- package/src/Section/Section.doc.mjs +4 -4
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +6 -3
- package/src/Selector/Selector.test.tsx +114 -6
- package/src/Selector/Selector.tsx +68 -17
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavCollapseButton.tsx +3 -1
- package/src/SideNav/SideNavHeading.tsx +5 -3
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +3 -1
- package/src/Slider/Slider.doc.mjs +2 -2
- package/src/Stack/Stack.doc.mjs +10 -10
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/TabList.tsx +12 -1
- package/src/TabList/TabMenu.tsx +4 -1
- package/src/Table/BaseTable.tsx +36 -19
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.test.tsx +132 -1
- package/src/Table/Table.tsx +6 -4
- package/src/Table/index.ts +7 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +31 -30
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +7 -5
- package/src/Table/plugins/pagination/useTablePagination.tsx +4 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -1
- package/src/Table/plugins/selection/useTableSelection.tsx +6 -7
- package/src/Table/plugins/sortable/useTableSortable.tsx +8 -5
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +4 -4
- package/src/Table/plugins/tree/index.ts +12 -0
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
- package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
- package/src/Table/types.ts +18 -12
- package/src/Table/useBaseTablePlugins.ts +6 -2
- package/src/Table/useTableFiltering.doc.mjs +2 -2
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/Table/useTableSortable.doc.mjs +11 -11
- package/src/Table/useTableTreeData.doc.mjs +75 -0
- package/src/Table/useTableTreeState.doc.mjs +98 -0
- package/src/Text/Text.doc.mjs +2 -2
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.tsx +6 -2
- package/src/Timestamp/Timestamp.doc.mjs +4 -4
- package/src/Timestamp/Timestamp.test.tsx +120 -7
- package/src/Timestamp/Timestamp.tsx +21 -1
- package/src/Toast/Toast.tsx +3 -1
- package/src/Toast/ToastViewport.tsx +3 -1
- package/src/Token/Token.tsx +4 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.tsx +4 -4
- package/src/Toolbar/Toolbar.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.tsx +10 -3
- package/src/TopNav/TopNav.doc.mjs +1 -0
- package/src/TopNav/TopNav.test.tsx +30 -0
- package/src/TopNav/TopNav.tsx +6 -4
- package/src/TopNav/TopNavHeading.tsx +5 -3
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListItem.tsx +6 -1
- package/src/Typeahead/BaseTypeahead.tsx +11 -4
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.tsx +3 -1
- package/src/VisuallyHidden/VisuallyHidden.tsx +1 -0
- package/src/authoring/doc.ts +166 -0
- package/src/authoring/index.test.ts +52 -0
- package/src/authoring/index.ts +50 -0
- package/src/authoring/integration.ts +42 -0
- package/src/authoring/template.ts +74 -0
- package/src/config.test.ts +16 -0
- package/src/config.ts +92 -0
- package/src/docPropLiterals.test.ts +938 -0
- package/src/docs-types.ts +15 -10
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +82 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/e2e-powersearch.test.tsx +130 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +46 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/hct.ts +0 -4
- package/src/utils/color.test.ts +101 -1
- package/src/utils/color.ts +23 -1
- package/src/utils/index.ts +8 -1
- package/dist/NavItem/index.d.ts +0 -9
- package/dist/NavItem/index.d.ts.map +0 -1
- package/dist/NavItem/index.js +0 -10
- package/src/NavItem/index.ts +0 -11
|
@@ -45,9 +45,15 @@ export const docs = {
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
name: 'mobileNav',
|
|
48
|
+
// Kept as the bare `ReactNode`, not widened to the true
|
|
49
|
+
// `false | MobileNavConfig | ReactNode`: the docsite playground hides a
|
|
50
|
+
// prop by exact-matching the type string against UNSUPPORTED_PROP_TYPES,
|
|
51
|
+
// and widening drops that match. This prop's slotElements happen to hide
|
|
52
|
+
// it a second way today, but the hide should not rest on that
|
|
53
|
+
// coincidence. The legal values live in the description instead (#1645).
|
|
48
54
|
type: 'ReactNode',
|
|
49
55
|
description:
|
|
50
|
-
|
|
56
|
+
"Mobile navigation configuration. Accepts false (disable), a config object (tune auto behavior), or ReactNode (full custom drawer). The config object is {hasToggle?: boolean, isOpen?: boolean, onOpenChange?: (isOpen: boolean) => void, content?: ReactNode, breakpoint?: 'sm' | 'md' | 'lg' | 'none', defaultIsMobile?: boolean}; breakpoint defaults to 'md'.",
|
|
51
57
|
slotElements: [{__element: 'MobileNav', props: {}}],
|
|
52
58
|
},
|
|
53
59
|
{
|
|
@@ -139,7 +145,7 @@ export const docsZh = {
|
|
|
139
145
|
},
|
|
140
146
|
{name: 'topNav', type: 'ReactNode', description: '顶部导航插槽,通常为 TopNav。'},
|
|
141
147
|
{name: 'sideNav', type: 'ReactNode', description: '侧边导航插槽,通常为 SideNav。'},
|
|
142
|
-
{name: 'mobileNav', type: 'ReactNode', description:
|
|
148
|
+
{name: 'mobileNav', type: 'ReactNode', description: "移动端导航配置。接受 false(禁用)、配置对象(调整自动行为)或 ReactNode(完全自定义抽屉)。配置对象为 {hasToggle?, isOpen?, onOpenChange?, content?, breakpoint?: 'sm' | 'md' | 'lg' | 'none', defaultIsMobile?};breakpoint 默认为 'md'。"},
|
|
143
149
|
{name: 'banner', type: 'ReactNode', description: '横幅插槽,用于全局公告,放置在 topNav 上方。'},
|
|
144
150
|
{
|
|
145
151
|
name: 'height',
|
|
@@ -53,6 +53,7 @@ import {mergeProps, mergeRefs, isRenderable} from '../utils';
|
|
|
53
53
|
import {useMediaQuery} from '../hooks/useMediaQuery';
|
|
54
54
|
import {observeResize, unobserveResize} from '../utils/sharedResizeObserver';
|
|
55
55
|
import {themeProps} from '../utils/themeProps';
|
|
56
|
+
import {useTranslator} from '../i18n';
|
|
56
57
|
|
|
57
58
|
const HasActivity = typeof React.Activity !== 'undefined';
|
|
58
59
|
const ActivityWrapper = HasActivity
|
|
@@ -472,6 +473,7 @@ export function AppShell({
|
|
|
472
473
|
ref,
|
|
473
474
|
...rest
|
|
474
475
|
}: AppShellProps) {
|
|
476
|
+
const t = useTranslator();
|
|
475
477
|
// =========================================================================
|
|
476
478
|
// Parse mobileNav prop — normalize to config, custom element, or disabled
|
|
477
479
|
// =========================================================================
|
|
@@ -756,7 +758,7 @@ export function AppShell({
|
|
|
756
758
|
<div
|
|
757
759
|
{...stylex.props(styles.autoMobileTopBar)}
|
|
758
760
|
role="navigation"
|
|
759
|
-
aria-label=
|
|
761
|
+
aria-label={t('@astryx.appShell.mobileNavigation')}>
|
|
760
762
|
<SideNavRenderContext value="topbar">
|
|
761
763
|
{sideNav}
|
|
762
764
|
</SideNavRenderContext>
|
|
@@ -25,6 +25,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
25
25
|
import {mergeProps} from '../utils';
|
|
26
26
|
import {AvatarGroupContext} from './AvatarGroupContext';
|
|
27
27
|
import {themeProps} from '../utils/themeProps';
|
|
28
|
+
import {useTranslator} from '../i18n';
|
|
28
29
|
|
|
29
30
|
const OVERLAP_RATIO = 0.25;
|
|
30
31
|
|
|
@@ -76,13 +77,15 @@ export function AvatarGroup({
|
|
|
76
77
|
children,
|
|
77
78
|
size = 'small',
|
|
78
79
|
'data-testid': testId,
|
|
79
|
-
'aria-label':
|
|
80
|
+
'aria-label': ariaLabelFromProps,
|
|
80
81
|
xstyle,
|
|
81
82
|
className,
|
|
82
83
|
style,
|
|
83
84
|
ref,
|
|
84
85
|
...props
|
|
85
86
|
}: AvatarGroupProps): ReactNode {
|
|
87
|
+
const t = useTranslator();
|
|
88
|
+
const ariaLabel = ariaLabelFromProps ?? t('@astryx.avatarGroup.label');
|
|
86
89
|
const numericSize = resolveSize(size);
|
|
87
90
|
const overlap = Math.round(numericSize * OVERLAP_RATIO);
|
|
88
91
|
|
package/src/Banner/Banner.tsx
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
import {mergeProps} from '../utils';
|
|
51
51
|
import {edgeCompSlot} from '../Layout/edgeCompensation.stylex';
|
|
52
52
|
import {themeProps} from '../utils/themeProps';
|
|
53
|
+
import {useTranslator} from '../i18n';
|
|
53
54
|
|
|
54
55
|
// =============================================================================
|
|
55
56
|
// Types
|
|
@@ -296,7 +297,10 @@ const styles = stylex.create({
|
|
|
296
297
|
chevron: {
|
|
297
298
|
display: 'inline-flex',
|
|
298
299
|
transitionProperty: 'transform',
|
|
299
|
-
transitionDuration:
|
|
300
|
+
transitionDuration: {
|
|
301
|
+
default: durationVars['--duration-fast'],
|
|
302
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
303
|
+
},
|
|
300
304
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
301
305
|
},
|
|
302
306
|
chevronExpanded: {
|
|
@@ -385,6 +389,7 @@ export function Banner({
|
|
|
385
389
|
ref,
|
|
386
390
|
...rest
|
|
387
391
|
}: BannerProps) {
|
|
392
|
+
const t = useTranslator();
|
|
388
393
|
const [isDismissed, setIsDismissed] = useState(false);
|
|
389
394
|
const [isExpanded, setIsExpanded] = useState(defaultIsExpanded);
|
|
390
395
|
// Links the expand/collapse toggle to the content region it shows/hides so
|
|
@@ -469,8 +474,8 @@ export function Banner({
|
|
|
469
474
|
<Button
|
|
470
475
|
variant="ghost"
|
|
471
476
|
size="sm"
|
|
472
|
-
label={isExpanded ? '
|
|
473
|
-
tooltip={isExpanded ? '
|
|
477
|
+
label={isExpanded ? t('@astryx.banner.collapse') : t('@astryx.banner.expand')}
|
|
478
|
+
tooltip={isExpanded ? t('@astryx.banner.collapse') : t('@astryx.banner.expand')}
|
|
474
479
|
icon={
|
|
475
480
|
<span
|
|
476
481
|
{...stylex.props(
|
|
@@ -490,8 +495,8 @@ export function Banner({
|
|
|
490
495
|
<Button
|
|
491
496
|
variant="ghost"
|
|
492
497
|
size="sm"
|
|
493
|
-
label=
|
|
494
|
-
tooltip=
|
|
498
|
+
label={t('@astryx.banner.dismiss')}
|
|
499
|
+
tooltip={t('@astryx.banner.dismiss')}
|
|
495
500
|
icon={<Icon icon="close" size="sm" color="inherit" />}
|
|
496
501
|
onClick={handleDismiss}
|
|
497
502
|
isIconOnly
|
|
@@ -22,6 +22,7 @@ import {spacingVars} from '../theme/tokens.stylex';
|
|
|
22
22
|
import {mergeProps} from '../utils';
|
|
23
23
|
import type {BaseProps} from '../BaseProps';
|
|
24
24
|
import {themeProps} from '../utils/themeProps';
|
|
25
|
+
import {useTranslator} from '../i18n';
|
|
25
26
|
|
|
26
27
|
// =============================================================================
|
|
27
28
|
// Variant type
|
|
@@ -150,10 +151,12 @@ export function Breadcrumbs({
|
|
|
150
151
|
xstyle,
|
|
151
152
|
className,
|
|
152
153
|
style,
|
|
153
|
-
label
|
|
154
|
+
label: labelFromProps,
|
|
154
155
|
ref,
|
|
155
156
|
...rest
|
|
156
157
|
}: BreadcrumbsProps) {
|
|
158
|
+
const t = useTranslator();
|
|
159
|
+
const label = labelFromProps ?? t('@astryx.breadcrumbs.label');
|
|
157
160
|
const ctxValue = useMemo<BreadcrumbContextValue>(
|
|
158
161
|
() => ({variant, separator}),
|
|
159
162
|
[variant, separator],
|
|
@@ -104,6 +104,12 @@ export const docs = {
|
|
|
104
104
|
'When true, renders as a square icon-only button with label as aria-label. Requires icon. Tip: for a dedicated icon-only button component, use IconButton from \'@astryxdesign/core/IconButton\' instead.',
|
|
105
105
|
default: 'false',
|
|
106
106
|
},
|
|
107
|
+
{
|
|
108
|
+
name: 'width',
|
|
109
|
+
type: 'SizeValue',
|
|
110
|
+
description:
|
|
111
|
+
"Width of the button. Numbers are treated as pixels, strings are used as-is (e.g., '100%' for a full-width button). By default the button sizes to its content.",
|
|
112
|
+
},
|
|
107
113
|
{
|
|
108
114
|
name: 'children',
|
|
109
115
|
type: 'ReactNode',
|
|
@@ -205,6 +211,7 @@ export const docsZh = {
|
|
|
205
211
|
default: 'false',
|
|
206
212
|
},
|
|
207
213
|
{name: 'icon', type: 'ReactNode', description: '图标元素。仅提供 icon 而不提供 children 时,按钮渲染为正方形的纯图标按钮。'},
|
|
214
|
+
{name: 'width', type: 'SizeValue', description: "按钮宽度。数字按像素处理,字符串按原样使用(如 '100%' 表示全宽按钮)。默认按内容自适应宽度。"},
|
|
208
215
|
{name: 'children', type: 'ReactNode', description: '可选的可见内容覆盖;label 仍然是必需的(用于无障碍名称)。大多数情况使用 <Button label="Save" />。'},
|
|
209
216
|
{
|
|
210
217
|
name: 'endContent',
|
|
@@ -272,6 +279,7 @@ export const docsDense = {
|
|
|
272
279
|
isLoading: 'shows spinner+disables interaction; announces via live region',
|
|
273
280
|
icon: 'icon element rendered before label text',
|
|
274
281
|
isIconOnly: 'when true, renders square icon-only button; label becomes aria-label',
|
|
282
|
+
width: "Width of button. Numbers=pixels, strings=as-is (e.g. '100%' for full-width).",
|
|
275
283
|
children: 'optional visible override; label is still required for a11y. Prefer <Button label="Save" /> over using children',
|
|
276
284
|
endContent: 'trailing icon/badge after label; ignored when isIconOnly; color inherited',
|
|
277
285
|
tooltip: 'tooltip on hover',
|
|
@@ -243,6 +243,33 @@ describe('Button', () => {
|
|
|
243
243
|
expect(button).toHaveAttribute('data-size', 'sm');
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
it('applies string width as-is', () => {
|
|
247
|
+
render(<Button label="Sign in" width="100%" />);
|
|
248
|
+
const button = screen.getByRole('button');
|
|
249
|
+
// StyleX compiles the dynamic width to an inline CSS custom property.
|
|
250
|
+
expect(button.getAttribute('style')).toContain('100%');
|
|
251
|
+
expect(button.className).toContain('dynamicStyles.width');
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('applies numeric width as pixels', () => {
|
|
255
|
+
render(<Button label="Sign in" width={240} />);
|
|
256
|
+
expect(screen.getByRole('button').getAttribute('style')).toContain('240');
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('omits width styling when the prop is not provided', () => {
|
|
260
|
+
render(<Button label="Sign in" />);
|
|
261
|
+
expect(screen.getByRole('button').className).not.toContain(
|
|
262
|
+
'dynamicStyles.width',
|
|
263
|
+
);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('applies width when rendered as a link via href', () => {
|
|
267
|
+
render(<Button label="Sign in" href="https://example.com" width="100%" />);
|
|
268
|
+
expect(
|
|
269
|
+
screen.getByRole('link', {name: 'Sign in'}).getAttribute('style'),
|
|
270
|
+
).toContain('100%');
|
|
271
|
+
});
|
|
272
|
+
|
|
246
273
|
// P0: onClick fires before clickAction, clickAction respects preventDefault
|
|
247
274
|
it('fires onClick before clickAction', async () => {
|
|
248
275
|
const user = userEvent.setup();
|
package/src/Button/Button.tsx
CHANGED
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
* - /apps/storybook/stories/Button.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/templates/blocks/components/Button/ (showcase blocks)
|
|
17
17
|
*
|
|
18
|
-
* Last synced props: label, variant, size, isDisabled, isLoading, isInterruptible, clickAction, icon, isIconOnly, children, tooltip, endContent, href, as, target, rel
|
|
18
|
+
* Last synced props: label, variant, size, isDisabled, isLoading, isInterruptible, clickAction, icon, isIconOnly, width, children, tooltip, endContent, href, as, target, rel
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import {useRef, useTransition, type ReactNode} from 'react';
|
|
22
22
|
import type {BaseProps} from '../BaseProps';
|
|
23
|
+
import type {SizeValue} from '../utils/types';
|
|
23
24
|
import * as stylex from '@stylexjs/stylex';
|
|
24
25
|
import {useTooltip} from '../Tooltip/useTooltip';
|
|
25
26
|
import {
|
|
@@ -130,6 +131,12 @@ const styles = stylex.create({
|
|
|
130
131
|
},
|
|
131
132
|
});
|
|
132
133
|
|
|
134
|
+
// Dynamic style for the consumer-controlled button width. Numbers are treated
|
|
135
|
+
// as pixels by StyleX; strings (e.g. '100%') are used as-is.
|
|
136
|
+
const dynamicStyles = stylex.create({
|
|
137
|
+
width: (width: SizeValue | null) => ({width}),
|
|
138
|
+
});
|
|
139
|
+
|
|
133
140
|
const sizeStyles = stylex.create({
|
|
134
141
|
sm: {
|
|
135
142
|
height: sizeVars['--size-element-sm'],
|
|
@@ -341,6 +348,12 @@ export interface ButtonProps extends BaseProps<HTMLButtonElement> {
|
|
|
341
348
|
* @default false
|
|
342
349
|
*/
|
|
343
350
|
isIconOnly?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Width of the button. Numbers are treated as pixels, strings are used as-is
|
|
353
|
+
* (e.g. `'100%'` for a full-width button). By default the button sizes to
|
|
354
|
+
* its content.
|
|
355
|
+
*/
|
|
356
|
+
width?: SizeValue;
|
|
344
357
|
/**
|
|
345
358
|
* Optional visible content. When provided, rendered instead of `label` as the
|
|
346
359
|
* visible text (label still serves as the accessible name via aria-label).
|
|
@@ -434,6 +447,36 @@ const loadingStyles = stylex.create({
|
|
|
434
447
|
},
|
|
435
448
|
});
|
|
436
449
|
|
|
450
|
+
/**
|
|
451
|
+
* "I am the last member of the group" — the trailing end cap.
|
|
452
|
+
*
|
|
453
|
+
* NOT `:last-child`: several members render an invisible layer element AFTER
|
|
454
|
+
* their button (a tooltip'd Button returns button + layer; DropdownMenu returns
|
|
455
|
+
* trigger + popover). `useLayer` renders those inline rather than portaling
|
|
456
|
+
* them, so the layer — not the button — took the `:last-child` slot and the real
|
|
457
|
+
* trailing button silently kept square corners (#2508).
|
|
458
|
+
*
|
|
459
|
+
* Layers always carry the native `popover` attribute (useLayer.tsx), and a
|
|
460
|
+
* popover is never an in-flow member — it is `display: none` until shown, then
|
|
461
|
+
* promoted to the top layer. So "last member" is: no following element sibling
|
|
462
|
+
* that isn't a popover.
|
|
463
|
+
*
|
|
464
|
+
* Reading it the other way round — marking the *buttons* and testing for a
|
|
465
|
+
* marked sibling — is the trap: it silently reclassifies anything it doesn't
|
|
466
|
+
* recognise as "not a member", so a member wrapped in a `display: contents`
|
|
467
|
+
* wrapper (Tooltip, HoverCard) or a raw child would make the button BEFORE it
|
|
468
|
+
* round mid-group. Ignoring known layers keeps the predicate conservative: an
|
|
469
|
+
* unrecognised sibling still counts, exactly as `:last-child` did, so the worst
|
|
470
|
+
* case degrades to the old behaviour instead of a wrong corner.
|
|
471
|
+
*
|
|
472
|
+
* Kept as a same-file const: StyleX only statically evaluates a selector key
|
|
473
|
+
* from a const in the same file.
|
|
474
|
+
*
|
|
475
|
+
* The leading edge still uses `:first-child` — a member's button always precedes
|
|
476
|
+
* its own layer, so the first button is genuinely `:first-child`.
|
|
477
|
+
*/
|
|
478
|
+
const IS_LAST_ITEM = ':not(:has(~ *:not([popover])))';
|
|
479
|
+
|
|
437
480
|
const groupStyles = stylex.create({
|
|
438
481
|
horizontal: {
|
|
439
482
|
borderStartStartRadius: {
|
|
@@ -446,11 +489,11 @@ const groupStyles = stylex.create({
|
|
|
446
489
|
},
|
|
447
490
|
borderStartEndRadius: {
|
|
448
491
|
default: 0,
|
|
449
|
-
|
|
492
|
+
[IS_LAST_ITEM]: radiusVars['--radius-element'],
|
|
450
493
|
},
|
|
451
494
|
borderEndEndRadius: {
|
|
452
495
|
default: 0,
|
|
453
|
-
|
|
496
|
+
[IS_LAST_ITEM]: radiusVars['--radius-element'],
|
|
454
497
|
},
|
|
455
498
|
borderInlineStartWidth: {
|
|
456
499
|
default: borderVars['--border-width'],
|
|
@@ -473,11 +516,11 @@ const groupStyles = stylex.create({
|
|
|
473
516
|
},
|
|
474
517
|
borderEndStartRadius: {
|
|
475
518
|
default: 0,
|
|
476
|
-
|
|
519
|
+
[IS_LAST_ITEM]: radiusVars['--radius-element'],
|
|
477
520
|
},
|
|
478
521
|
borderEndEndRadius: {
|
|
479
522
|
default: 0,
|
|
480
|
-
|
|
523
|
+
[IS_LAST_ITEM]: radiusVars['--radius-element'],
|
|
481
524
|
},
|
|
482
525
|
borderBlockStartWidth: {
|
|
483
526
|
default: borderVars['--border-width'],
|
|
@@ -518,6 +561,7 @@ const groupStyles = stylex.create({
|
|
|
518
561
|
* <Button label="Edit" icon={<PencilIcon />} />
|
|
519
562
|
* <Button label="Messages" endContent={<Badge label={3} />} />
|
|
520
563
|
* <Button label="Edit" icon={<PencilIcon />} endContent={<Badge label="New" />} />
|
|
564
|
+
* <Button label="Sign in" variant="primary" width="100%" />
|
|
521
565
|
* <Button label="Visit site" href="https://example.com" variant="primary" />
|
|
522
566
|
* <Button label="Open in new tab" href="https://example.com" target="_blank" rel="noopener noreferrer" />
|
|
523
567
|
* ```
|
|
@@ -533,6 +577,7 @@ export function Button({
|
|
|
533
577
|
clickAction,
|
|
534
578
|
icon,
|
|
535
579
|
isIconOnly = false,
|
|
580
|
+
width,
|
|
536
581
|
children,
|
|
537
582
|
endContent,
|
|
538
583
|
tooltip,
|
|
@@ -646,6 +691,7 @@ export function Button({
|
|
|
646
691
|
(buttonGroup.orientation === 'horizontal'
|
|
647
692
|
? groupStyles.onSolidHorizontal
|
|
648
693
|
: groupStyles.onSolidVertical),
|
|
694
|
+
width != null && dynamicStyles.width(width),
|
|
649
695
|
xstyle,
|
|
650
696
|
);
|
|
651
697
|
|