@astryxdesign/core 0.1.9 → 0.2.0-canary.136a00f
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 +107 -0
- package/dist/Avatar/Avatar.d.ts +42 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +190 -59
- package/dist/Avatar/AvatarStatusDot.d.ts +6 -4
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +7 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +58 -6
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +7 -2
- package/dist/Banner/Banner.js +2 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +11 -4
- package/dist/Breadcrumbs/index.d.ts +1 -0
- package/dist/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/Breadcrumbs/index.js +2 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +6 -4
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +50 -9
- package/dist/Calendar/dayCellUtils.d.ts +4 -4
- package/dist/Calendar/dayCellUtils.js +2 -2
- package/dist/Calendar/styles.d.ts +30 -31
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +30 -31
- package/dist/Card/Card.js +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +22 -12
- package/dist/Chat/ChatComposerInput.js +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +3 -1
- package/dist/Chat/ChatLayout.js +4 -4
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +8 -8
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +10 -3
- package/dist/Chat/useTriggerMenu.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +6 -6
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +19 -4
- package/dist/Citation/Citation.d.ts +22 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +20 -6
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +16 -10
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +3 -1
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +42 -3
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +23 -5
- package/dist/ContextMenu/index.d.ts +1 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +3 -1
- package/dist/DateInput/DateInput.d.ts +10 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +33 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts +10 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +23 -20
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +23 -18
- package/dist/Divider/Divider.d.ts +2 -2
- package/dist/Divider/Divider.d.ts.map +1 -1
- package/dist/Divider/Divider.js +13 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +6 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +22 -5
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +4 -1
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +5 -2
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +8 -11
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +3 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +5 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +104 -0
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +427 -0
- package/dist/DropdownMenu/index.d.ts +10 -0
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +13 -0
- package/dist/DropdownMenu/menuItemHover.d.ts +23 -0
- package/dist/DropdownMenu/menuItemHover.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemHover.js +33 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts +8 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -1
- package/dist/DropdownMenu/menuItemRoles.js +10 -1
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +21 -6
- package/dist/Field/Field.d.ts +3 -1
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +4 -1
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -5
- package/dist/Field/inputStyles.stylex.d.ts +1 -0
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +1 -0
- package/dist/FieldStatus/FieldStatus.d.ts +10 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +39 -3
- package/dist/FileInput/FileInput.d.ts +10 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +93 -65
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -4
- package/dist/Icon/Icon.d.ts +15 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +19 -3
- package/dist/Item/Item.d.ts +16 -3
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +31 -6
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +10 -2
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +19 -13
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +6 -3
- package/dist/List/ListItem.d.ts +11 -1
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +2 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +1 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +4 -2
- package/dist/MultiSelector/MultiSelector.d.ts +9 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +80 -42
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts +10 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +22 -17
- package/dist/Outline/Outline.js +2 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +11 -3
- package/dist/PowerSearch/PowerSearch.d.ts +9 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +2 -0
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +6 -1
- package/dist/RadioList/RadioList.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -5
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +49 -19
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -3
- package/dist/Selector/Selector.d.ts +8 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +66 -17
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +5 -5
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +13 -10
- package/dist/SideNav/SideNavItem.d.ts +1 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +12 -10
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +2 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +87 -34
- package/dist/Spinner/Spinner.d.ts +3 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +11 -2
- package/dist/Switch/Switch.d.ts +8 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +171 -91
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +2 -11
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +5 -9
- package/dist/TabList/TabListContext.d.ts +0 -5
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +0 -5
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +30 -4
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +15 -11
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +37 -27
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +3 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +15 -7
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +29 -23
- package/dist/Table/types.d.ts +32 -0
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/TextArea/TextArea.d.ts +10 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +18 -19
- package/dist/TextInput/TextInput.d.ts +10 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +20 -17
- package/dist/Thumbnail/Thumbnail.js +2 -2
- package/dist/TimeInput/TimeInput.d.ts +10 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +17 -17
- package/dist/Timestamp/Timestamp.d.ts +31 -3
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +47 -76
- package/dist/Timestamp/formatInstant.d.ts +41 -0
- package/dist/Timestamp/formatInstant.d.ts.map +1 -0
- package/dist/Timestamp/formatInstant.js +177 -0
- package/dist/Timestamp/index.d.ts +1 -0
- package/dist/Timestamp/index.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.d.ts +56 -0
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -0
- package/dist/Timestamp/tooltipEntries.js +163 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +61 -9
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +3 -1
- package/dist/Token/Token.d.ts +34 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +85 -45
- package/dist/Token/TokenLink.d.ts +62 -0
- package/dist/Token/TokenLink.d.ts.map +1 -0
- package/dist/Token/TokenLink.js +76 -0
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.d.ts +9 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +4 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +17 -1
- package/dist/TopNav/TopNavItem.d.ts +3 -1
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +30 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +1 -0
- package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
- package/dist/TreeList/TreeListBranches.js +8 -6
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +32 -14
- package/dist/Typeahead/BaseTypeahead.d.ts +9 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +22 -11
- package/dist/Typeahead/Typeahead.d.ts +9 -2
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +11 -2
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/Typeahead/TypeaheadItem.js +20 -10
- package/dist/astryx.css +70 -30
- package/dist/astryx.umd.js +51 -51
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/isRtlElement.d.ts +18 -0
- package/dist/hooks/isRtlElement.d.ts.map +1 -0
- package/dist/hooks/isRtlElement.js +27 -0
- package/dist/hooks/useAnnounce.d.ts +3 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +39 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +52 -11
- package/dist/hooks/useGridFocus.d.ts +6 -1
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +12 -9
- package/dist/hooks/useHotkeys.d.ts +9 -0
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +9 -0
- package/dist/hooks/useInputStatusIcon.d.ts +38 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -0
- package/dist/hooks/useInputStatusIcon.js +158 -0
- package/dist/hooks/useKeyboardHint.d.ts +1 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +4 -2
- package/dist/hooks/useListFocus.d.ts +39 -1
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +54 -9
- package/dist/i18n/InternationalizationContext.d.ts +1 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -0
- package/dist/i18n/InternationalizationProvider.d.ts +8 -1
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +5 -1
- package/dist/i18n/getLocaleDirection.d.ts +18 -0
- package/dist/i18n/getLocaleDirection.d.ts.map +1 -0
- package/dist/i18n/getLocaleDirection.js +29 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +7 -1
- package/dist/i18n/useDirection.d.ts +2 -0
- package/dist/i18n/useDirection.d.ts.map +1 -0
- package/dist/i18n/useDirection.js +27 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/plainDate.d.ts +17 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +23 -4
- package/dist/utils/rtlStyles.d.ts +24 -0
- package/dist/utils/rtlStyles.d.ts.map +1 -0
- package/dist/utils/rtlStyles.js +27 -0
- package/locales/en.json +112 -0
- package/locales/pseudo.json +84 -0
- package/package.json +6 -1
- package/src/Avatar/Avatar.doc.mjs +50 -3
- package/src/Avatar/Avatar.test.tsx +218 -0
- package/src/Avatar/Avatar.tsx +285 -79
- package/src/Avatar/AvatarStatusDot.doc.mjs +4 -4
- package/src/Avatar/AvatarStatusDot.tsx +6 -4
- package/src/AvatarGroup/AvatarGroup.doc.mjs +2 -0
- package/src/AvatarGroup/AvatarGroup.test.tsx +162 -2
- package/src/AvatarGroup/AvatarGroup.tsx +58 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +5 -2
- package/src/Banner/Banner.tsx +6 -6
- package/src/Breadcrumbs/BreadcrumbItem.tsx +10 -10
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +52 -1
- package/src/Breadcrumbs/index.ts +4 -0
- package/src/Button/Button.doc.mjs +0 -4
- package/src/Button/Button.test.tsx +16 -0
- package/src/Button/Button.tsx +6 -4
- package/src/Calendar/Calendar.test.tsx +170 -20
- package/src/Calendar/Calendar.tsx +73 -16
- package/src/Calendar/dayCellUtils.test.ts +18 -18
- package/src/Calendar/dayCellUtils.ts +2 -2
- package/src/Calendar/styles.ts +33 -39
- package/src/Card/Card.tsx +1 -1
- package/src/Carousel/Carousel.tsx +25 -6
- package/src/Chat/ChatComposer.doc.mjs +2 -2
- package/src/Chat/ChatComposerInput.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.tsx +2 -2
- package/src/Chat/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatLayout.tsx +4 -4
- package/src/Chat/ChatMessageBubble.tsx +15 -10
- package/src/Chat/ChatSystemMessage.test.tsx +5 -0
- package/src/Chat/ChatToolCalls.tsx +9 -2
- package/src/Chat/useTriggerMenu.tsx +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +6 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +23 -0
- package/src/CheckboxInput/CheckboxInput.tsx +21 -6
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -0
- package/src/CheckboxList/CheckboxList.test.tsx +94 -3
- package/src/CheckboxList/CheckboxListItem.tsx +17 -10
- package/src/Citation/Citation.doc.mjs +4 -3
- package/src/Citation/Citation.test.tsx +97 -0
- package/src/Citation/Citation.tsx +43 -11
- package/src/CodeBlock/CodeBlock.test.tsx +17 -0
- package/src/CodeBlock/CodeBlock.tsx +38 -11
- package/src/Collapsible/Collapsible.doc.mjs +1 -0
- package/src/Collapsible/Collapsible.test.tsx +7 -0
- package/src/Collapsible/Collapsible.tsx +16 -6
- package/src/CommandPalette/CommandPalette.test.tsx +95 -1
- package/src/CommandPalette/CommandPalette.tsx +41 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ContextMenu/ContextMenu.test.tsx +59 -2
- package/src/ContextMenu/ContextMenu.tsx +22 -11
- package/src/ContextMenu/index.ts +5 -0
- package/src/DateInput/DateInput.doc.mjs +25 -0
- package/src/DateInput/DateInput.test.tsx +230 -0
- package/src/DateInput/DateInput.tsx +51 -29
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +140 -0
- package/src/DateRangeInput/DateRangeInput.tsx +42 -30
- package/src/DateTimeInput/DateTimeInput.doc.mjs +22 -1
- package/src/DateTimeInput/DateTimeInput.test.tsx +112 -0
- package/src/DateTimeInput/DateTimeInput.tsx +44 -39
- package/src/Divider/Divider.test.tsx +32 -8
- package/src/Divider/Divider.tsx +14 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +60 -0
- package/src/DropdownMenu/DropdownMenu.tsx +31 -12
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +8 -2
- package/src/DropdownMenu/DropdownMenuItem.tsx +9 -3
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +4 -12
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +9 -10
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +9 -3
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +20 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +88 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +635 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +553 -0
- package/src/DropdownMenu/index.ts +16 -0
- package/src/DropdownMenu/menuItemHover.ts +39 -0
- package/src/DropdownMenu/menuItemRoles.ts +9 -0
- package/src/DropdownMenu/renderDropdownItems.tsx +29 -15
- package/src/Field/Field.tsx +14 -9
- package/src/Field/FieldLabel.test.tsx +25 -0
- package/src/Field/FieldLabel.tsx +12 -3
- package/src/Field/inputStyles.stylex.ts +2 -0
- package/src/FieldStatus/FieldStatus.test.tsx +72 -0
- package/src/FieldStatus/FieldStatus.tsx +48 -2
- package/src/FileInput/FileInput.doc.mjs +23 -2
- package/src/FileInput/FileInput.test.tsx +104 -13
- package/src/FileInput/FileInput.tsx +106 -79
- package/src/HoverCard/useHoverCard.tsx +15 -3
- package/src/Icon/Icon.doc.mjs +13 -0
- package/src/Icon/Icon.test.tsx +89 -0
- package/src/Icon/Icon.tsx +51 -3
- package/src/Item/Item.doc.mjs +5 -0
- package/src/Item/Item.test.tsx +88 -0
- package/src/Item/Item.tsx +57 -11
- package/src/Layer/layerAnimations.stylex.ts +23 -0
- package/src/Lightbox/Lightbox.tsx +15 -7
- package/src/List/List.test.tsx +17 -29
- package/src/List/List.tsx +6 -1
- package/src/List/ListItem.doc.mjs +12 -0
- package/src/List/ListItem.tsx +13 -0
- package/src/Markdown/Markdown.test.tsx +21 -0
- package/src/Markdown/Markdown.tsx +4 -0
- package/src/MetadataList/MetadataList.test.tsx +24 -0
- package/src/MetadataList/MetadataList.tsx +6 -2
- package/src/MultiSelector/MultiSelector.doc.mjs +20 -0
- package/src/MultiSelector/MultiSelector.test.tsx +402 -0
- package/src/MultiSelector/MultiSelector.tsx +120 -59
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +21 -0
- package/src/NumberInput/NumberInput.test.tsx +71 -0
- package/src/NumberInput/NumberInput.tsx +35 -26
- package/src/Outline/Outline.test.tsx +12 -12
- package/src/Outline/Outline.tsx +2 -2
- package/src/Pagination/Pagination.tsx +11 -3
- package/src/PowerSearch/PowerSearch.doc.mjs +15 -0
- package/src/PowerSearch/PowerSearch.test.tsx +23 -0
- package/src/PowerSearch/PowerSearch.tsx +10 -1
- package/src/ProgressBar/ProgressBar.test.tsx +34 -0
- package/src/ProgressBar/ProgressBar.tsx +16 -1
- package/src/RadioList/RadioList.doc.mjs +6 -0
- package/src/RadioList/RadioList.test.tsx +26 -4
- package/src/RadioList/RadioList.tsx +2 -2
- package/src/RadioList/RadioListItem.tsx +12 -5
- package/src/Resizable/ResizeHandle.test.tsx +94 -0
- package/src/Resizable/ResizeHandle.tsx +70 -20
- package/src/SegmentedControl/SegmentedControl.test.tsx +28 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +22 -2
- package/src/Selector/Selector.doc.mjs +15 -0
- package/src/Selector/Selector.test.tsx +370 -0
- package/src/Selector/Selector.tsx +88 -20
- package/src/SideNav/SideNav.tsx +1 -8
- package/src/SideNav/SideNavCollapseButton.tsx +9 -7
- package/src/SideNav/SideNavItem.tsx +5 -3
- package/src/Skeleton/Skeleton.test.tsx +16 -0
- package/src/Skeleton/Skeleton.tsx +13 -1
- package/src/Slider/Slider.doc.mjs +6 -0
- package/src/Slider/Slider.test.tsx +240 -12
- package/src/Slider/Slider.tsx +96 -23
- package/src/Spinner/Spinner.test.tsx +10 -8
- package/src/Spinner/Spinner.tsx +15 -5
- package/src/Switch/Switch.doc.mjs +142 -42
- package/src/Switch/Switch.test.tsx +111 -0
- package/src/Switch/Switch.tsx +149 -32
- package/src/TabList/Tab.tsx +2 -2
- package/src/TabList/TabList.doc.mjs +0 -6
- package/src/TabList/TabList.test.tsx +3 -15
- package/src/TabList/TabList.tsx +6 -17
- package/src/TabList/TabListContext.ts +0 -6
- package/src/TabList/TabMenu.tsx +2 -2
- package/src/Table/BaseTable.tsx +34 -2
- package/src/Table/Table.doc.mjs +11 -0
- package/src/Table/Table.test.tsx +85 -0
- package/src/Table/TableCell.tsx +3 -3
- package/src/Table/TableHeaderCell.tsx +3 -3
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +9 -6
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +19 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +27 -18
- package/src/Table/plugins/selection/useTableSelection.test.tsx +61 -3
- package/src/Table/plugins/selection/useTableSelection.tsx +3 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +38 -9
- package/src/Table/plugins/tree/useTableTreeData.tsx +17 -13
- package/src/Table/types.ts +33 -0
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/TextArea/TextArea.doc.mjs +21 -0
- package/src/TextArea/TextArea.test.tsx +23 -0
- package/src/TextArea/TextArea.tsx +27 -26
- package/src/TextInput/TextInput.doc.mjs +21 -0
- package/src/TextInput/TextInput.test.tsx +150 -0
- package/src/TextInput/TextInput.tsx +28 -25
- package/src/Thumbnail/Thumbnail.doc.mjs +1 -1
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.doc.mjs +21 -0
- package/src/TimeInput/TimeInput.test.tsx +23 -0
- package/src/TimeInput/TimeInput.tsx +24 -25
- package/src/Timestamp/Timestamp.doc.mjs +32 -6
- package/src/Timestamp/Timestamp.test.tsx +371 -0
- package/src/Timestamp/Timestamp.tsx +96 -93
- package/src/Timestamp/formatInstant.ts +218 -0
- package/src/Timestamp/index.ts +4 -0
- package/src/Timestamp/tooltipEntries.test.ts +552 -0
- package/src/Timestamp/tooltipEntries.ts +210 -0
- package/src/Toast/ToastViewport.test.tsx +218 -8
- package/src/Toast/ToastViewport.tsx +71 -12
- package/src/ToggleButton/ToggleButton.test.tsx +24 -0
- package/src/ToggleButton/ToggleButton.tsx +19 -1
- package/src/Token/Token.test.tsx +166 -15
- package/src/Token/Token.tsx +104 -47
- package/src/Token/TokenLink.tsx +107 -0
- package/src/Token/index.ts +1 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +23 -1
- package/src/Tokenizer/Tokenizer.test.tsx +23 -0
- package/src/Tokenizer/Tokenizer.tsx +14 -2
- package/src/Tooltip/Tooltip.test.tsx +46 -0
- package/src/Tooltip/useTooltip.tsx +20 -0
- package/src/TopNav/TopNav.test.tsx +93 -2
- package/src/TopNav/TopNavItem.doc.mjs +3 -3
- package/src/TopNav/TopNavItem.tsx +35 -6
- package/src/TopNav/TopNavMegaMenuFeaturedCard.doc.mjs +1 -1
- package/src/TreeList/TreeList.doc.mjs +6 -0
- package/src/TreeList/TreeList.test.tsx +50 -10
- package/src/TreeList/TreeList.tsx +5 -0
- package/src/TreeList/TreeListBranches.tsx +8 -6
- package/src/TreeList/TreeListItem.tsx +33 -11
- package/src/Typeahead/BaseTypeahead.tsx +42 -15
- package/src/Typeahead/Typeahead.doc.mjs +13 -0
- package/src/Typeahead/Typeahead.test.tsx +112 -0
- package/src/Typeahead/Typeahead.tsx +17 -1
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/__tests__/forcedColors.ts +60 -0
- package/src/__tests__/inputWidthContract.test.tsx +62 -0
- package/src/doc-mjs.d.ts +19 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/isRtlElement.ts +27 -0
- package/src/hooks/useAnnounce.test.tsx +75 -2
- package/src/hooks/useAnnounce.ts +47 -1
- package/src/hooks/useFocusTrap.test.tsx +104 -0
- package/src/hooks/useFocusTrap.ts +61 -12
- package/src/hooks/useGridFocus.doc.mjs +3 -3
- package/src/hooks/useGridFocus.test.tsx +41 -0
- package/src/hooks/useGridFocus.ts +21 -10
- package/src/hooks/useHotkeys.ts +9 -0
- package/src/hooks/useInputStatusIcon.test.tsx +162 -0
- package/src/hooks/useInputStatusIcon.tsx +224 -0
- package/src/hooks/useKeyboardHint.test.tsx +22 -0
- package/src/hooks/useKeyboardHint.tsx +6 -2
- package/src/hooks/useListFocus.doc.mjs +25 -3
- package/src/hooks/useListFocus.test.tsx +153 -1
- package/src/hooks/useListFocus.ts +102 -9
- package/src/i18n/InternationalizationContext.ts +4 -0
- package/src/i18n/InternationalizationProvider.tsx +12 -2
- package/src/i18n/__tests__/getLocaleDirection.test.ts +40 -0
- package/src/i18n/__tests__/useDirection.test.tsx +66 -0
- package/src/i18n/getLocaleDirection.ts +29 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useDirection.ts +29 -0
- package/src/reset.css +0 -26
- package/src/reset.test.ts +60 -0
- package/src/theme/derivedVarRegistry.test.ts +1 -0
- package/src/theme/derivedVarRegistry.ts +6 -0
- package/src/theme/generateThemeRules.test.ts +42 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +24 -6
- package/src/utils/plainDate.ts +18 -4
- package/src/utils/rtlStyles.ts +27 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# @xds/core
|
|
2
2
|
|
|
3
|
+
# 0.2.0
|
|
4
|
+
|
|
5
|
+
#### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- TabList: remove orientation prop (misleading no-op). The prop did not render vertical tabs; it only toggled the keyboard-hint badge arrows. Arrow navigation has always accepted both axes (horizontal and vertical) via orientation: both in useListFocus. Run astryx upgrade to auto-strip the prop from your code.
|
|
8
|
+
|
|
9
|
+
#### New Features
|
|
10
|
+
|
|
11
|
+
- `Avatar` gains optional interactivity via `href`/`onClick` (with `as`/`target`/`rel`), following Button's element-swap trichotomy: `href` renders a link through `useLinkComponent`, `onClick` (no href) renders a `<button type="button">`, and with neither the avatar stays the static, non-focusable element it is today (non-breaking default). Interactive avatars get the focus-visible accent ring and a required accessible name (from `alt`/`name`). Inside `AvatarGroup`, interactive avatars — and an interactive `AvatarGroupOverflow` — now share a single Tab stop with roving ArrowLeft/ArrowRight focus, and the group exposes a screen-reader keyboard hint via `aria-describedby`. A purely static facepile is unchanged. (#4170)
|
|
12
|
+
- Citation: `CitationSource.icon` now accepts a `ReactNode` (e.g. an Astryx `<Icon>`, an SVG, or a custom element) in addition to an image URL string, and a new `CitationSource.src` field holds a favicon/logo image URL (mirroring `Avatar`/`Thumbnail`). Additive and non-breaking: a string `icon` still renders as the favicon `<img>`, so existing callers are unaffected. When both a node `icon` and `src` are set, the node wins. The icon stays decorative — the accessible name still comes solely from the citation's `aria-label`.
|
|
13
|
+
- CodeBlock: move the collapse chevron to the left of the title/language label, following the leading-disclosure convention (points right `>` when collapsed, down `v` when expanded). It grows into place (width + inline margin) so it slides the title over smoothly instead of popping in and shifting the header. Respects `prefers-reduced-motion` (#4513)
|
|
14
|
+
- Collapsible: expose the trigger button as a distinct theming target (`astryx-collapsible-trigger`) so themes can style the trigger independently from the content — e.g. a heading font on the trigger while the content keeps the body font.
|
|
15
|
+
- DateInput: add `astryx-date-input-clear-icon` and `astryx-date-input-toggle-icon` theme targets on the clear and calendar-toggle glyphs, so consumers can recolor, resize, and hover-style each icon — and style the toggle's open/closed state — via `defineTheme` instead of a fragile descendant selector or raw CSS. The toggle reflects its open/closed state as a `data-state` attribute. `Icon` now fully handles its styling props (`className`, `style`, `xstyle`) so they compose with its base styles instead of being dropped. Default rendering is unchanged.
|
|
16
|
+
- DateRangeInput: add `astryx-date-range-input-clear-icon` and `astryx-date-range-input-toggle-icon` theme targets on the clear and calendar-toggle glyphs, so consumers can recolor, hover-morph, and resize them via `defineTheme` instead of a fragile descendant selector or raw CSS. The toggle icon reflects its open/closed state as a `data-state` attribute. `Icon` now fully handles its styling props (`className`, `style`, `xstyle`) so they compose with its base styles instead of being dropped. Default rendering is unchanged.
|
|
17
|
+
- DateTimeInput: add `astryx-date-time-input-date-segment` and `astryx-date-time-input-time-segment` theme targets on the two segment wrappers, so a theme can restyle their geometry (padding/height/font) via `defineTheme` instead of being unable to reach them at all. Both reflect `size` and `status` as data attributes, mirroring the root target. Default rendering is unchanged.
|
|
18
|
+
- DropdownMenu: add submenus via a single `DropdownMenuSubMenu` component (or a nested `items` array in data mode). The row adopts DropdownMenuItem semantics (label / icon / description / isDisabled) and its children — or an `items` array — become the flyout content. Flyouts open inline-end with auto-flip, hover-intent, and full keyboard support (Right/Enter/Space opens and focuses the first item; Left/Escape closes and returns focus to the trigger).
|
|
19
|
+
- Bordered inputs gain a `statusVariant="tooltip"` option that hides the status message box and surfaces the status as an info-tip on the on-field status icon. The icon is a real focusable button so the status is reachable by everyone: keyboard users tab to it (with a visible focus ring) and see the message on focus, pointer users see it on hover, and touch users tap to toggle it. The message is piped into both the input's and the button's `aria-describedby`, and the tooltip is dismissible with Escape. Added to TextInput, TextArea, NumberInput, DateInput, DateRangeInput, TimeInput, and FileInput.
|
|
20
|
+
- The bordered input family now accepts a `statusVariant` prop (`'attached' | 'detached'`, default `'attached'`) that forwards to the underlying `Field`, letting you float the status message below the input with spacing instead of overlapping it. Added to TextInput, TextArea, NumberInput, DateInput, DateRangeInput, TimeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput, and PowerSearch. Non-breaking: the default matches today's behavior. (#4187)
|
|
21
|
+
- Add RTL direction API: `useDirection()` hook, `getLocaleDirection(locale)` server-safe helper, and an optional `dir` prop on `InternationalizationProvider`.
|
|
22
|
+
- RTL: mirror directional disclosure/navigation chevrons under RTL via a shared `rtlStyles.mirror` CSS transform, applied to the icon wrapper in Lightbox and the Table tree / grouped-rows / row-expansion plugins. The mirror composes correctly with the Table chevrons' state-rotation (expanded chevrons still point down under RTL). Semantic aria-labels are unchanged.
|
|
23
|
+
- Selector & MultiSelector: add `astryx-selector-clear-icon`, `astryx-selector-indicator-icon`, `astryx-multi-selector-clear-icon`, and `astryx-multi-selector-indicator-icon` theme targets on the clear and chevron glyphs, so consumers can recolor, resize, and hover-style each icon — and style the chevron's open/closed state — via `defineTheme` instead of a fragile descendant selector or raw CSS. Each chevron reflects its open/closed state as a `data-state` attribute. `Icon` now fully handles its styling props (`className`, `style`, `xstyle`) so they compose with its base styles instead of being dropped. Default rendering is unchanged.
|
|
24
|
+
- add size prop (sm / md) to Switch to match CheckboxInput and RadioList boolean control scales (#4230)
|
|
25
|
+
- Table: `rowIndexStart` and `rowCount` props expose row numbering as a table-level ARIA concern, so `aria-rowindex`/`aria-rowcount` reflect a row's position in the full dataset: correct across pagination and even when no visible index column is rendered. Opt-in; tables that set neither prop are unchanged. Closes #3939.
|
|
26
|
+
- Timestamp: new `tooltipEntries` prop renders the hover tooltip across several time zones and/or formats at once — one line per entry, each with an optional `timezoneID` (IANA id; omit it or pass `'local'` for the viewer's zone), `format` (every non-relative `TimestampFormat` plus `'full'`), and `label`. The default is unchanged: with no entries the tooltip stays the single full absolute line in the viewer's zone. Configuring entries also attaches the tooltip to absolute formats, which previously had none — note that this gives those timestamps a tab stop and focus ring, as relative timestamps already have, so a column of them gains one tab stop per row. `hasTooltip={false}` still suppresses the tooltip, and an empty array counts as no configuration. Also corrects `isTimezoneShown`'s documentation, which claimed it applied to the `system_date_time` and `system_time` formats; it never has, and those formats stay machine-readable. (#4188)
|
|
27
|
+
- Token: make the `color` prop extensible via module augmentation. `TokenColor` is now derived from a `TokenColorMap` interface, so theme packages can add custom colors (and `astryx theme build` generates the type augmentation), matching Badge and Button.
|
|
28
|
+
- TreeList: the per-level indentation step is now the themeable `--tree-list-indent` variable (default `var(--spacing-4)`), so a theme can retune the indent metric via `defineTheme` on the `tree-list` target instead of the previously hardcoded, unreachable step (#4308).
|
|
29
|
+
- TreeList: add a `variant` prop (`'lineGuides' | 'noGuides'`, default `'lineGuides'`) to select the base hierarchy guide-line look. `noGuides` hides the connector lines while keeping indentation intact. Orthogonal to `density` (spacing); the guides stay themeable via the `astryx-tree-list-guide` target. Non-breaking — omitting the prop renders exactly as before.
|
|
30
|
+
|
|
31
|
+
#### Fixes
|
|
32
|
+
|
|
33
|
+
- Avatar: compose the status dot's label into the avatar's accessible name so assistive tech can reach the status the `role="img"` root previously pruned (WCAG 4.1.2)
|
|
34
|
+
- Calendar: expose selected state in day-button accessible names, announce range-selection progress and completion via the polite live region, and set aria-multiselectable on the grid in range mode
|
|
35
|
+
- CommandPalette: announce result counts, empty, and loading states to screen readers via the shared polite live region (WCAG 4.1.3)
|
|
36
|
+
- Divider: expose the label as the separator's accessible name via aria-labelledby; Spinner: name the status element from the visible label instead of duplicating it as aria-label
|
|
37
|
+
- FileInput: announce the required state via a visually hidden description on the trigger (aria-required is unsupported on role="button") and announce validation errors exactly once
|
|
38
|
+
- hooks: resolve focus-trap Escape by DOM depth instead of push order, exclude aria-hidden subtrees from trap tab cycles, and auto-clear live regions after announcing so stale status text does not linger
|
|
39
|
+
- List: keep list semantics for all listStyle variants by always emitting an explicit role="list", since the base style strips list-style-type for every variant and Safari/VoiceOver drops implicit list roles for such lists (WCAG 1.3.1)
|
|
40
|
+
- NumberInput: announce the units text through the input's accessible description, and stop TextInput/NumberInput from referencing the non-rendered status message id in aria-describedby inside InputGroup
|
|
41
|
+
- reset: stop suppressing `:focus-visible` outlines on coarse-pointer devices so keyboard users keep the WCAG 2.4.7 focus indicator
|
|
42
|
+
- hooks: auto-detect RTL direction for arrow-key navigation in useListFocus and useGridFocus (WCAG 1.3.2)
|
|
43
|
+
- Slider: constrain range thumb aria-valuemin/aria-valuemax by the sibling thumb (including minStepsBetweenThumbs) and render the label as a group label wired via aria-labelledby instead of an inert <label htmlFor>
|
|
44
|
+
- TopNav: disabled TopNavItems now render href-less anchors so they no longer navigate or fire clicks, and Outline's active item uses aria-current="location"
|
|
45
|
+
- Avatar: avoid remounting the avatar subtree when the name tooltip toggles — render the tooltip as a conditional sibling instead of forking the return so the avatar keeps its position in the React tree (and its image-load state) across tooltip changes.
|
|
46
|
+
- Card: rest the bordered variant on the subtle `--color-border` instead of `--color-border-emphasized`, so a Card's outer frame matches its own LayoutHeader/LayoutFooter dividers and neighboring ClickableCards instead of rendering a heavier edge.
|
|
47
|
+
- CheckboxInput, RadioList, Switch: align control sizes. The visible checkbox and radio controls now fill their size exactly (20px at `sm`, 24px at `md`) instead of being inset 2px. The `sm` Switch track is now 32px wide with a 2px inset.
|
|
48
|
+
- Export the `BaseProps` type through the `@astryxdesign/core/BaseProps` subpath. Previously it was only reachable through the package barrel, so the `import type {BaseProps} from '@astryxdesign/core/BaseProps'` specifier that `astryx swizzle` generates failed to resolve (#4091).
|
|
49
|
+
- Guard DropdownMenu item hover styles with `@media (hover: hover)` to prevent sticky highlights on touch devices. Forward BaseProps pass-throughs to the menu element.
|
|
50
|
+
- FieldStatus renders a leading status icon on the `detached` message so status is not conveyed by color/position alone (WCAG 1.4.1). The icon is decorative for assistive tech; the message text and live-region announcement carry the status. The `attached` variant is unchanged.
|
|
51
|
+
- FileInput no longer nests interactive controls (the clear and status buttons) inside a role="button" trigger. The trigger is now a visually hidden button alongside them in a non-interactive container, resolving the nested-interactive a11y violation (WCAG 4.1.2) while keeping click, keyboard, and drag-and-drop behavior. (#4522)
|
|
52
|
+
- Inputs no longer show the hover ring while disabled. The shared input wrapper's disabled state now suppresses both the base and status hover shadows, so TextInput, TextArea, NumberInput, DateInput, TimeInput, Selector, MultiSelector, Typeahead, and Tokenizer stay visually inert on hover when disabled.
|
|
53
|
+
- HoverCard: move themeProps className to the layer container (where bg/radius/shadow live) so themes can target the visual surface. Forward consumer xstyle/className/style to that same layer container so surface customization lands next to the theme class, instead of silently dropping them.
|
|
54
|
+
- With `statusVariant="detached"`, bordered inputs no longer render a status icon inside the control (this also covers DateTimeInput, which is fixed to the detached presentation) — the detached message box already carries a leading icon, so the on-field glyph was a duplicate. Also centers the detached message's icon on the first line of text.
|
|
55
|
+
- DropdownMenu/ContextMenu: mouse hover now moves the highlight instead of adding a second one, so keyboard focus and pointer hover share a single highlighted item (#4493)
|
|
56
|
+
- utils: clamp plainDateAddMonths to the target month's last day
|
|
57
|
+
Adding a month to Jan 31 landed on Mar 3 (Date#setMonth overflow) instead of Feb 28, so month arithmetic from end-of-month dates skipped February entirely. The helper now uses pure month arithmetic and clamps the day, matching Temporal.PlainDate.add and date-fns.
|
|
58
|
+
- Calendar RTL: month-navigation chevrons now mirror correctly under RTL (via the shared `rtlStyles.mirror` transform on the nav-icon wrapper), and the range-selection / hover-preview fill pills use logical CSS (`insetInline*`, `border*Start/EndRadius`) so their rounded start/end caps follow the reading direction instead of the physical left/right. LTR rendering is unchanged.
|
|
59
|
+
- Carousel now supports RTL: the directional scroll-button chevrons mirror under RTL, the scroll buttons respect RTL scroll semantics (previously the button was a no-op under RTL), and the button pills sit on the correct edges.
|
|
60
|
+
- RTL: migrate physical `left`/`right` CSS properties to their logical equivalents so components mirror correctly under `dir="rtl"`. This is the Phase 2 mechanical, one-to-one follow-up to the RTL direction API — a no-op in the default LTR direction with no visual change.
|
|
61
|
+
- RTL Phase 4 (behavioral): mirror directional behavior that logical-CSS and icon name-swaps alone couldn't fix. SideNavCollapseButton and TreeListItem now compose `rtlStyles.mirror` on the icon wrapper outside the state rotation, so the chevrons point toward the correct edge in every collapsed/expanded × LTR/RTL combination. TreeList connector/guide lines position via logical `inset-inline-start`/`inset-inline-end` so they mirror to the inline-start (right) edge under RTL alongside the chevron and row indent. Slider positions its thumb, fill, and marks via logical `inset-inline-start` and flips the physical centering transform under RTL, and its pointer/click math measures the value fraction from the inline-start (right) edge under RTL — so a click at 25% of the track maps to 75 instead of 25.
|
|
62
|
+
- RTL Phase 4b behavioral fixes: ChatMessageBubble grouped-bubble tail corners now use logical border radii so the tail follows reading direction (mirrors under RTL, text unaffected); Table sticky-column shadows make their `translateX` and gradient direction-aware so the shadow fades from the pinned edge toward scrolled content in both LTR and RTL instead of rendering inside-out, and gate shadow visibility on `Math.abs(scrollLeft)` so the start/end shadows still appear under RTL (where spec-compliant browsers report a negative `scrollLeft`); ResizeHandle's hit-area bias is now direction-aware (mirrors about center under RTL) and the pointer-drag delta reads the handle's computed direction so dragging resizes intuitively in RTL.
|
|
63
|
+
- Markdown honors the `components.image` override for standalone (block) images, matching the inline image path. A standalone `` line parses as a block image, whose render path previously hardcoded a bare `<img>` and ignored a supplied `components.image`; it now uses the override just like an inline image does.
|
|
64
|
+
- Selector & MultiSelector: keep group headers visible while searching; hide groups with no matching items. Previously, typing a query flattened grouped options into a single ungrouped list; now each group header stays above its matching items and a group is hidden only when none of its items match.
|
|
65
|
+
- SideNav: remove the top border above the footer region so the `footer` slot no longer renders a divider line.
|
|
66
|
+
- Slider: round snapped values to the min/step decimal precision
|
|
67
|
+
With fractional steps, `min + steps * step` accumulated binary floating-point error, so a keyboard nudge on a `step={0.1}` slider emitted `0.30000000000000004` through `onChange`/`onChangeEnd` (and into `aria-valuenow`/the value tooltip once the consumer echoed it back). Snapped values are now rounded to the combined decimal precision of `min` and `step`, which removes only the error — exact steps are unaffected.
|
|
68
|
+
- Tooltip: dismiss the tooltip when its trigger is pressed. Previously the tooltip stayed open through a click (e.g. a "Copy link" button's tooltip lingered after activation); now pressing the trigger hides its own tooltip. Applies to uncontrolled tooltips only.
|
|
69
|
+
- Typeahead: omit aria-activedescendant when search results are empty or index is out of bounds (#4059)
|
|
70
|
+
|
|
71
|
+
#### Documentation
|
|
72
|
+
|
|
73
|
+
- document `width` prop across 17 input component doc files (#4163)
|
|
74
|
+
|
|
75
|
+
#### Other Changes
|
|
76
|
+
|
|
77
|
+
- Add `@astryx/no-physical-properties` ESLint rule that flags physical left/right CSS properties inside `stylex.create()` and suggests the CSS logical equivalent for RTL support.
|
|
78
|
+
- KEY-BASED: `marginLeft`/`marginRight`, `paddingLeft`/`paddingRight`, `borderLeft`/`borderRight` (+ their `Width`/`Style`/`Color` longhands), `left`/`right` → `insetInlineStart`/`insetInlineEnd`, and the four physical corner radii → their diagonal-aware logical names (`borderTopLeftRadius` → `borderStartStartRadius`, etc.).
|
|
79
|
+
- VALUE-BASED: `textAlign: 'left'|'right'`, `float: 'left'|'right'`, and `clear: 'left'|'right'` (the key stays, only the physical value is flagged).
|
|
80
|
+
- Scoped strictly to `stylex.create()` — physical identifiers used elsewhere are ignored.
|
|
81
|
+
- `useDirection()` returns `'ltr' | 'rtl'` for the current provider context (falls back to `'ltr'` when called outside a provider).
|
|
82
|
+
- `getLocaleDirection(locale)` computes direction from a BCP 47 locale via `Intl.Locale.getTextInfo()` — safe to call from React Server Components and Next.js layouts to set `<html dir>`.
|
|
83
|
+
- `<InternationalizationProvider locale="ar">` auto-derives `dir="rtl"`. Pass an explicit `dir` prop to override (useful for RTL testing under an English catalog, or to force LTR).
|
|
84
|
+
- Pagination is the first component to consume the hook: prev/next chevron icons flip under RTL while the aria-labels stay semantic.
|
|
85
|
+
- Storybook gains a global `Direction` toolbar for toggling every story between LTR and RTL.
|
|
86
|
+
- Component-level CSS migrations (borders, chevrons, sliders, calendar range pills, etc.) land in follow-up PRs.
|
|
87
|
+
- `textAlign: 'left' | 'right'` → `'start' | 'end'` (Selector, Typeahead, Chat trigger menu, DropdownMenu, CommandPalette, NavMenu items).
|
|
88
|
+
- `borderLeft*`/`borderRight*` → `borderInlineStart*`/`borderInlineEnd*`, kept as separate start/end declarations (Banner, Table cell/header dividers, DateRangeInput preset sidebar).
|
|
89
|
+
- Static `left`/`right` positioning → `insetInlineStart`/`insetInlineEnd` for full-bleed overlays and single-side offsets (Button spinner overlay, Chat dock/blur/placeholder, Field sr-only label, Lightbox close/nav/counter buttons, TabList indicators, Thumbnail remove slot, CodeBlock copy button).
|
|
90
|
+
- Inline `marginLeft` indentation → `marginInlineStart` (TreeList rows).
|
|
91
|
+
|
|
92
|
+
#### Contributors
|
|
93
|
+
|
|
94
|
+
Thanks to everyone who contributed to this release:
|
|
95
|
+
|
|
96
|
+
- @AKnassa
|
|
97
|
+
- @arham766
|
|
98
|
+
- @bhamodi
|
|
99
|
+
- @cixzhang
|
|
100
|
+
- @ernestt
|
|
101
|
+
- @freddymeta
|
|
102
|
+
- @HelloOjasMutreja
|
|
103
|
+
- @humbertovirtudes
|
|
104
|
+
- @kentonquatman
|
|
105
|
+
- @lexs
|
|
106
|
+
- @nynexman4464
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
3
110
|
# 0.1.9
|
|
4
111
|
|
|
5
112
|
#### New Features
|
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Avatar.tsx
|
|
3
3
|
* @input Uses React, HTMLAttributes, ReactNode, useState; useTooltip
|
|
4
|
-
* (Tooltip hook) for the optional name-on-hover tooltip
|
|
4
|
+
* (Tooltip hook) for the optional name-on-hover tooltip; useTranslator (i18n)
|
|
5
5
|
* @output Exports Avatar component, AvatarProps, AvatarSize types
|
|
6
6
|
* @position Core implementation; consumed by index.ts
|
|
7
7
|
*
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
* - /packages/core/src/Avatar/index.ts (exports if types change)
|
|
11
11
|
* - /apps/storybook/stories/Avatar.stories.tsx (storybook stories)
|
|
12
12
|
* - /packages/cli/templates/blocks/components/Avatar/ (showcase blocks)
|
|
13
|
+
*
|
|
14
|
+
* Last synced props: alt, fallbackSrc, name, size, src, status, href, as, target, rel, onClick
|
|
13
15
|
*/
|
|
14
16
|
import { type ReactNode } from 'react';
|
|
15
17
|
import type { BaseProps } from '../BaseProps';
|
|
18
|
+
import type { LinkComponentType } from '../Link/types';
|
|
16
19
|
/**
|
|
17
20
|
* Named size options.
|
|
18
21
|
*
|
|
19
22
|
* Avatar uses the same abbreviated scale as Icon (`xsm`/`sm`/`md`/`lg`/`xl`),
|
|
20
23
|
* but the values are larger because avatars align with media rather than
|
|
21
|
-
* glyphs. The tiers
|
|
24
|
+
* glyphs. The tiers follow the standard avatar size scale.
|
|
22
25
|
*/
|
|
23
26
|
type AvatarNamedSize = 'xsm' | 'sm' | 'md' | 'lg' | 'xl';
|
|
24
27
|
/**
|
|
@@ -69,6 +72,11 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
69
72
|
/**
|
|
70
73
|
* Content displayed in the corner of the avatar.
|
|
71
74
|
* Typically used for status indicators or badges.
|
|
75
|
+
*
|
|
76
|
+
* When the element carries a string `label` prop (as `AvatarStatusDot`
|
|
77
|
+
* does), the label is composed into the avatar's accessible name
|
|
78
|
+
* (e.g. "Jane Doe, Online") so assistive tech can reach the status —
|
|
79
|
+
* the `role="img"` root prunes descendant semantics (WCAG 4.1.2).
|
|
72
80
|
*/
|
|
73
81
|
status?: ReactNode;
|
|
74
82
|
/**
|
|
@@ -84,6 +92,35 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
84
92
|
* @default true
|
|
85
93
|
*/
|
|
86
94
|
tooltip?: string | boolean;
|
|
95
|
+
/**
|
|
96
|
+
* When provided, the avatar becomes an interactive link (`<a>` or custom
|
|
97
|
+
* link component) pointing at `href`. Follows the same element-swap rules as
|
|
98
|
+
* Button: `href` renders a link, otherwise `onClick` renders a
|
|
99
|
+
* `<button type="button">`, otherwise the avatar stays a static (non-focusable)
|
|
100
|
+
* element. An interactive avatar requires a meaningful accessible name via
|
|
101
|
+
* `alt` or `name`.
|
|
102
|
+
*/
|
|
103
|
+
href?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Custom link component to use when `href` is provided. Overrides the
|
|
106
|
+
* provider-level default set by LinkProvider. Useful for Next.js `<Link>` or
|
|
107
|
+
* other router-aware components. Only applies when `href` is provided.
|
|
108
|
+
*/
|
|
109
|
+
as?: LinkComponentType;
|
|
110
|
+
/**
|
|
111
|
+
* HTML target attribute for the link. Only applies when `href` is provided.
|
|
112
|
+
*/
|
|
113
|
+
target?: string;
|
|
114
|
+
/**
|
|
115
|
+
* HTML rel attribute for the link. Only applies when `href` is provided.
|
|
116
|
+
*/
|
|
117
|
+
rel?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Click handler. When provided without `href`, renders the avatar as a
|
|
120
|
+
* focusable `<button type="button">`. An interactive avatar requires a
|
|
121
|
+
* meaningful accessible name via `alt` or `name`.
|
|
122
|
+
*/
|
|
123
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
87
124
|
}
|
|
88
125
|
/**
|
|
89
126
|
* Avatar component for displaying user profile pictures.
|
|
@@ -98,9 +135,11 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
98
135
|
* <Avatar src="/user.jpg" status={<OnlineIndicator />} />
|
|
99
136
|
* <Avatar name="jsmith" tooltip="Jane Smith, Staff Engineer" />
|
|
100
137
|
* <Avatar name="Jane" tooltip={false} />
|
|
138
|
+
* <Avatar src="/user.jpg" name="John Doe" href="/users/john" />
|
|
139
|
+
* <Avatar src="/user.jpg" name="John Doe" onClick={() => openProfile()} />
|
|
101
140
|
* ```
|
|
102
141
|
*/
|
|
103
|
-
export declare function Avatar({ alt, 'data-testid': testId, fallbackSrc, name, size, src, status, tooltip, xstyle, className, style, ref, ...props }: AvatarProps): import("react").JSX.Element;
|
|
142
|
+
export declare function Avatar({ alt, 'data-testid': testId, fallbackSrc, name, size, src, status, tooltip, href, as, target, rel, onClick, xstyle, className, style, ref, ...props }: AvatarProps): import("react").JSX.Element;
|
|
104
143
|
export declare namespace Avatar {
|
|
105
144
|
var displayName: string;
|
|
106
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAoC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAc5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AA4BrD;;;;;;GAMG;AACH,KAAK,eAAe,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD;;GAEG;AACH,KAAK,iBAAiB,GACpB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAgBpD;AAiJD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD;AAwDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAW,EACX,GAAG,EACH,MAAM,EACN,OAAc,EACd,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAoPb;yBAvQe,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Avatar.tsx
|
|
7
7
|
* @input Uses React, HTMLAttributes, ReactNode, useState; useTooltip
|
|
8
|
-
* (Tooltip hook) for the optional name-on-hover tooltip
|
|
8
|
+
* (Tooltip hook) for the optional name-on-hover tooltip; useTranslator (i18n)
|
|
9
9
|
* @output Exports Avatar component, AvatarProps, AvatarSize types
|
|
10
10
|
* @position Core implementation; consumed by index.ts
|
|
11
11
|
*
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* - /packages/core/src/Avatar/index.ts (exports if types change)
|
|
15
15
|
* - /apps/storybook/stories/Avatar.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/templates/blocks/components/Avatar/ (showcase blocks)
|
|
17
|
+
*
|
|
18
|
+
* Last synced props: alt, fallbackSrc, name, size, src, status, href, as, target, rel, onClick
|
|
17
19
|
*/
|
|
18
|
-
import { useMemo, useState } from 'react';
|
|
20
|
+
import { isValidElement, useMemo, useState } from 'react';
|
|
19
21
|
import * as stylex from '@stylexjs/stylex';
|
|
20
22
|
import "../theme/tokens.stylex.js";
|
|
21
23
|
import { colorVars, typographyVars, fontWeightVars, radiusVars } from "../theme/tokens.stylex.js";
|
|
@@ -24,6 +26,8 @@ import { useAvatarGroup } from "../AvatarGroup/AvatarGroupContext.js";
|
|
|
24
26
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
25
27
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
28
|
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
29
|
+
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
30
|
+
import { useTranslator } from "../i18n/index.js";
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
* The offset ratio for positioning elements on a circle's edge at 45°.
|
|
@@ -56,7 +60,7 @@ const INITIALS_FONT_SIZE_RATIO = 0.4;
|
|
|
56
60
|
*
|
|
57
61
|
* Avatar uses the same abbreviated scale as Icon (`xsm`/`sm`/`md`/`lg`/`xl`),
|
|
58
62
|
* but the values are larger because avatars align with media rather than
|
|
59
|
-
* glyphs. The tiers
|
|
63
|
+
* glyphs. The tiers follow the standard avatar size scale.
|
|
60
64
|
*/
|
|
61
65
|
|
|
62
66
|
/**
|
|
@@ -97,6 +101,7 @@ const styles = {
|
|
|
97
101
|
kVAEAm: "x1n2onr6",
|
|
98
102
|
k1xSpc: "x3nfvp2",
|
|
99
103
|
kmuXW: "x2lah0s",
|
|
104
|
+
kaIpWk: "xjspbzw",
|
|
100
105
|
$$css: true
|
|
101
106
|
},
|
|
102
107
|
content: {
|
|
@@ -114,10 +119,10 @@ const styles = {
|
|
|
114
119
|
kjj79g: "xl56j7k",
|
|
115
120
|
kzqmXN: "xh8yej3",
|
|
116
121
|
kZKoxP: "x5yr21d",
|
|
117
|
-
kWkggS: "
|
|
118
|
-
kMwMTN: "
|
|
122
|
+
kWkggS: "xelv01g",
|
|
123
|
+
kMwMTN: "xicfil",
|
|
119
124
|
kMv6JI: "x9ynric",
|
|
120
|
-
k63SB2: "
|
|
125
|
+
k63SB2: "xi08x9w",
|
|
121
126
|
kP9fke: "xtvhhri",
|
|
122
127
|
$$css: true
|
|
123
128
|
},
|
|
@@ -129,6 +134,24 @@ const styles = {
|
|
|
129
134
|
kI3sdo: "x17nn4n9",
|
|
130
135
|
kInvED: "x1wfwxd8 x7s97pk",
|
|
131
136
|
$$css: true
|
|
137
|
+
},
|
|
138
|
+
interactive: {
|
|
139
|
+
kysU6D: "xjyslct",
|
|
140
|
+
kmVPX3: "x1717udv",
|
|
141
|
+
kogj98: "x1ghz6dp",
|
|
142
|
+
kMzoRj: "xc342km",
|
|
143
|
+
ksu8eU: "xng3xce",
|
|
144
|
+
kWkggS: "xjbqb8w",
|
|
145
|
+
kMwMTN: "x1heor9g",
|
|
146
|
+
kVVagm: "xln7xf2",
|
|
147
|
+
kybGjl: "x1hl2dhg",
|
|
148
|
+
kkrTdU: "x1ypdohk",
|
|
149
|
+
kaIpWk: "xjspbzw",
|
|
150
|
+
kMeerF: "x1k57tk5 x784prv",
|
|
151
|
+
k3XXqK: "x1t137rt x9v5kkp",
|
|
152
|
+
kjBf7l: "xzunyri",
|
|
153
|
+
kInvED: "x1wfwxd8 x7s97pk",
|
|
154
|
+
$$css: true
|
|
132
155
|
}
|
|
133
156
|
};
|
|
134
157
|
|
|
@@ -155,7 +178,7 @@ const dynamicStyles = {
|
|
|
155
178
|
"--x-height": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(size)
|
|
156
179
|
}],
|
|
157
180
|
fontSize: size => [_temp, {
|
|
158
|
-
"--x-fontSize": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(size * INITIALS_FONT_SIZE_RATIO)
|
|
181
|
+
"--x-fontSize": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(`var(--_avatar-fallback-font-size, ${size * INITIALS_FONT_SIZE_RATIO}px)`)
|
|
159
182
|
}],
|
|
160
183
|
statusPosition: size => [_temp2, {
|
|
161
184
|
"--x-bottom": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(size * CIRCLE_EDGE_OFFSET_RATIO),
|
|
@@ -207,6 +230,26 @@ function getInitials(name) {
|
|
|
207
230
|
return (words[0].charAt(0) + words[words.length - 1].charAt(0)).toUpperCase();
|
|
208
231
|
}
|
|
209
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Reads the accessible status label off the `status` element, when it
|
|
235
|
+
* exposes one. `AvatarStatusDot`'s `label` prop is the canonical source,
|
|
236
|
+
* but any custom status element with a string `label` prop participates.
|
|
237
|
+
*
|
|
238
|
+
* The avatar root is `role="img"`, which prunes ALL descendant semantics
|
|
239
|
+
* from the accessibility tree — a label inside the status subtree is never
|
|
240
|
+
* announced on its own. Composing it into the avatar's own accessible name
|
|
241
|
+
* is the only way the status reaches assistive tech (WCAG 4.1.2).
|
|
242
|
+
*/
|
|
243
|
+
function getStatusLabel(status) {
|
|
244
|
+
if (! /*#__PURE__*/isValidElement(status)) {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
const {
|
|
248
|
+
label
|
|
249
|
+
} = status.props;
|
|
250
|
+
return typeof label === 'string' && label !== '' ? label : undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
210
253
|
/**
|
|
211
254
|
* Default person icon SVG for when no image or name is provided
|
|
212
255
|
*/
|
|
@@ -238,6 +281,8 @@ function DefaultIcon({
|
|
|
238
281
|
* <Avatar src="/user.jpg" status={<OnlineIndicator />} />
|
|
239
282
|
* <Avatar name="jsmith" tooltip="Jane Smith, Staff Engineer" />
|
|
240
283
|
* <Avatar name="Jane" tooltip={false} />
|
|
284
|
+
* <Avatar src="/user.jpg" name="John Doe" href="/users/john" />
|
|
285
|
+
* <Avatar src="/user.jpg" name="John Doe" onClick={() => openProfile()} />
|
|
241
286
|
* ```
|
|
242
287
|
*/
|
|
243
288
|
export function Avatar({
|
|
@@ -249,6 +294,11 @@ export function Avatar({
|
|
|
249
294
|
src,
|
|
250
295
|
status,
|
|
251
296
|
tooltip = true,
|
|
297
|
+
href,
|
|
298
|
+
as,
|
|
299
|
+
target,
|
|
300
|
+
rel,
|
|
301
|
+
onClick,
|
|
252
302
|
xstyle,
|
|
253
303
|
className,
|
|
254
304
|
style,
|
|
@@ -264,10 +314,21 @@ export function Avatar({
|
|
|
264
314
|
const showInitials = !showImage && !showFallbackImage && name;
|
|
265
315
|
const showIcon = !showImage && !showFallbackImage && !name;
|
|
266
316
|
|
|
267
|
-
// A meaningful accessible name comes from `alt
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
|
|
317
|
+
// A meaningful accessible name comes from `alt`/`name`, composed with the
|
|
318
|
+
// status element's `label` when one is present ("Jane Doe, Online") — the
|
|
319
|
+
// `role="img"` root prunes descendant semantics, so surfacing the label in
|
|
320
|
+
// the avatar's own name is the only way assistive tech can reach the
|
|
321
|
+
// status (WCAG 4.1.2). A labelled status alone is also meaningful. With
|
|
322
|
+
// neither a name nor a labelled status, the avatar is decorative — expose
|
|
323
|
+
// it as `presentation`/`aria-hidden` rather than announcing a meaningless
|
|
324
|
+
// generic "Avatar" (obs-9).
|
|
325
|
+
const t = useTranslator();
|
|
326
|
+
const nameLabel = alt || name;
|
|
327
|
+
const statusLabel = getStatusLabel(status);
|
|
328
|
+
const accessibleName = nameLabel && statusLabel ? t('@astryx.avatar.nameWithStatus', {
|
|
329
|
+
name: nameLabel,
|
|
330
|
+
status: statusLabel
|
|
331
|
+
}) : nameLabel || statusLabel;
|
|
271
332
|
const isDecorative = !accessibleName;
|
|
272
333
|
const avatarGroup = useAvatarGroup();
|
|
273
334
|
const resolvedSize = avatarGroup?.size ?? size;
|
|
@@ -293,18 +354,117 @@ export function Avatar({
|
|
|
293
354
|
// returns `describedBy` as a value we choose whether to apply — the only way
|
|
294
355
|
// to satisfy the per-case aria-describedby rule (default name: none; custom
|
|
295
356
|
// string: describe) without editing Tooltip. `focusTrigger: 'auto'` shows the
|
|
296
|
-
// tooltip on keyboard focus once the root is
|
|
357
|
+
// tooltip on keyboard focus once the root is focusable (natively for the
|
|
358
|
+
// interactive <a>/<button>, or via an explicit tab stop on the static div).
|
|
297
359
|
const tooltipHook = useTooltip({
|
|
298
360
|
placement: 'above',
|
|
299
361
|
isEnabled: showTooltip
|
|
300
362
|
});
|
|
363
|
+
// The tooltip ref attaches to whichever root element renders (static or
|
|
364
|
+
// interactive), so the tooltip works for link/button avatars too.
|
|
301
365
|
const rootRef = mergeRefs(ref, showTooltip ? tooltipHook.ref : undefined);
|
|
302
366
|
const describedByProp = showTooltip && isCustomTooltip ? {
|
|
303
367
|
'aria-describedby': [props['aria-describedby'], tooltipHook.describedBy].filter(Boolean).join(' ') || undefined
|
|
304
368
|
} : null;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
369
|
+
|
|
370
|
+
// Element-swap trichotomy, copied from Button: `href` renders a link,
|
|
371
|
+
// otherwise `onClick` renders a `<button>`, otherwise today's static element
|
|
372
|
+
// is unchanged (the non-breaking default).
|
|
373
|
+
const renderAsLink = href != null;
|
|
374
|
+
const renderAsButton = !renderAsLink && onClick != null;
|
|
375
|
+
const isInteractive = renderAsLink || renderAsButton;
|
|
376
|
+
const LinkComponent = useLinkComponent(as);
|
|
377
|
+
|
|
378
|
+
// An interactive control with no accessible name is an unacceptable control
|
|
379
|
+
// name. Warn in the same client-safe way sibling components do (Field,
|
|
380
|
+
// Timestamp, Popover) — a plain `console.warn`, never gated on `process.env`
|
|
381
|
+
// (which is not available on the client in this codebase).
|
|
382
|
+
if (isInteractive && !accessibleName) {
|
|
383
|
+
console.warn('Avatar: an interactive avatar (with `href` or `onClick`) needs a ' + 'meaningful accessible name. Pass `alt` or `name`.');
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// The inner visuals are identical across the static and interactive variants.
|
|
387
|
+
const visualContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
388
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
389
|
+
...stylex.props(styles.content, dynamicStyles.size(numericSize)),
|
|
390
|
+
children: [showImage && /*#__PURE__*/_jsx("img", {
|
|
391
|
+
src: src,
|
|
392
|
+
alt: "",
|
|
393
|
+
onError: () => setErroredSrc(src),
|
|
394
|
+
...{
|
|
395
|
+
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
396
|
+
}
|
|
397
|
+
}), showFallbackImage && /*#__PURE__*/_jsx("img", {
|
|
398
|
+
src: fallbackSrc,
|
|
399
|
+
alt: "",
|
|
400
|
+
onError: () => setErroredFallbackSrc(fallbackSrc),
|
|
401
|
+
...{
|
|
402
|
+
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
403
|
+
}
|
|
404
|
+
}), showInitials && /*#__PURE__*/_jsx("div", {
|
|
405
|
+
...stylex.props(styles.fallback, dynamicStyles.fontSize(numericSize)),
|
|
406
|
+
children: getInitials(name)
|
|
407
|
+
}), showIcon && /*#__PURE__*/_jsx("div", {
|
|
408
|
+
...{
|
|
409
|
+
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xelv01g xicfil x9ynric xi08x9w xtvhhri"
|
|
410
|
+
},
|
|
411
|
+
children: /*#__PURE__*/_jsx(DefaultIcon, {
|
|
412
|
+
size: numericSize
|
|
413
|
+
})
|
|
414
|
+
})]
|
|
415
|
+
}), status && /*#__PURE__*/_jsx("div", {
|
|
416
|
+
...stylex.props(styles.status, dynamicStyles.statusPosition(numericSize)),
|
|
417
|
+
children: status
|
|
418
|
+
})]
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// Shared StyleX + theme props for the root element in every variant. The
|
|
422
|
+
// group ring/overlap, the interactive focus-visible ring, and the
|
|
423
|
+
// tooltip tab-stop focus ring all live here so the interactive
|
|
424
|
+
// `<a>`/`<button>` and the static `<div>` carry the exact same box.
|
|
425
|
+
const rootStylexProps = mergeProps(themeProps('avatar', {
|
|
426
|
+
size: resolvedSize
|
|
427
|
+
}), stylex.props(styles.wrapper, isInteractive && styles.interactive, !isInteractive && showTooltip && !avatarGroup && styles.focusable, avatarGroup && groupStyles.ring, avatarGroup && groupStyles.overlap, avatarGroup && groupDynamicStyles.overlap(-avatarGroup.overlap), xstyle), className, style);
|
|
428
|
+
let rootElement;
|
|
429
|
+
|
|
430
|
+
// `props` is typed for the default `<div>` root (its event handlers are
|
|
431
|
+
// HTMLDivElement-typed). The interactive branches render an `<a>`/`<button>`,
|
|
432
|
+
// so the passthrough props are re-typed to the generic element here — the
|
|
433
|
+
// avatar's own handlers (onClick) are declared on HTMLElement and stay typed.
|
|
434
|
+
const interactivePassthrough = props;
|
|
435
|
+
if (renderAsLink) {
|
|
436
|
+
// The rendered link carries the `data-avatar-item` marker so AvatarGroup's
|
|
437
|
+
// roving focus (which selects on `[data-avatar-item]`, not a tag/role) picks
|
|
438
|
+
// it up while ignoring nested buttons in a custom status/badge slot.
|
|
439
|
+
rootElement = /*#__PURE__*/_jsx(LinkComponent, {
|
|
440
|
+
...interactivePassthrough,
|
|
441
|
+
...describedByProp,
|
|
442
|
+
ref: rootRef,
|
|
443
|
+
href: href,
|
|
444
|
+
target: target,
|
|
445
|
+
rel: rel,
|
|
446
|
+
"aria-label": accessibleName,
|
|
447
|
+
"data-avatar-item": "",
|
|
448
|
+
"data-testid": testId,
|
|
449
|
+
onClick: onClick,
|
|
450
|
+
...rootStylexProps,
|
|
451
|
+
children: visualContent
|
|
452
|
+
});
|
|
453
|
+
} else if (renderAsButton) {
|
|
454
|
+
rootElement = /*#__PURE__*/_jsx("button", {
|
|
455
|
+
...interactivePassthrough,
|
|
456
|
+
...describedByProp,
|
|
457
|
+
ref: rootRef,
|
|
458
|
+
type: "button",
|
|
459
|
+
"aria-label": accessibleName,
|
|
460
|
+
"data-avatar-item": "",
|
|
461
|
+
"data-testid": testId,
|
|
462
|
+
onClick: onClick,
|
|
463
|
+
...rootStylexProps,
|
|
464
|
+
children: visualContent
|
|
465
|
+
});
|
|
466
|
+
} else {
|
|
467
|
+
rootElement = /*#__PURE__*/_jsx("div", {
|
|
308
468
|
...props,
|
|
309
469
|
ref: rootRef,
|
|
310
470
|
role: isDecorative ? 'presentation' : 'img',
|
|
@@ -312,56 +472,27 @@ export function Avatar({
|
|
|
312
472
|
"aria-hidden": isDecorative || undefined
|
|
313
473
|
// The root is a div[role="img"], not natively focusable. When a name
|
|
314
474
|
// tooltip is active, add a tab stop so keyboard users can reveal it
|
|
315
|
-
// (WCAG 1.4.13 / 2.1.1) — matching Timestamp/Button.
|
|
475
|
+
// (WCAG 1.4.13 / 2.1.1) — matching Timestamp/Button. Suppressed inside
|
|
476
|
+
// an AvatarGroup, which owns a single roving tab stop for its members.
|
|
316
477
|
,
|
|
317
|
-
tabIndex: showTooltip ? 0 : undefined,
|
|
478
|
+
tabIndex: showTooltip && !avatarGroup ? 0 : undefined,
|
|
318
479
|
"data-testid": testId,
|
|
319
480
|
...describedByProp,
|
|
320
|
-
...
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
324
|
-
...stylex.props(styles.content, dynamicStyles.size(numericSize)),
|
|
325
|
-
children: [showImage && /*#__PURE__*/_jsx("img", {
|
|
326
|
-
src: src,
|
|
327
|
-
alt: "",
|
|
328
|
-
onError: () => setErroredSrc(src),
|
|
329
|
-
...{
|
|
330
|
-
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
331
|
-
}
|
|
332
|
-
}), showFallbackImage && /*#__PURE__*/_jsx("img", {
|
|
333
|
-
src: fallbackSrc,
|
|
334
|
-
alt: "",
|
|
335
|
-
onError: () => setErroredFallbackSrc(fallbackSrc),
|
|
336
|
-
...{
|
|
337
|
-
className: "xh8yej3 x5yr21d xl1xv1r"
|
|
338
|
-
}
|
|
339
|
-
}), showInitials && /*#__PURE__*/_jsx("div", {
|
|
340
|
-
...stylex.props(styles.fallback, dynamicStyles.fontSize(numericSize)),
|
|
341
|
-
children: getInitials(name)
|
|
342
|
-
}), showIcon && /*#__PURE__*/_jsx("div", {
|
|
343
|
-
...{
|
|
344
|
-
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d x17x4s8c xv1l7n4 x9ynric x1e4wzip xtvhhri"
|
|
345
|
-
},
|
|
346
|
-
children: /*#__PURE__*/_jsx(DefaultIcon, {
|
|
347
|
-
size: numericSize
|
|
348
|
-
})
|
|
349
|
-
})]
|
|
350
|
-
}), status && /*#__PURE__*/_jsx("div", {
|
|
351
|
-
...stylex.props(styles.status, dynamicStyles.statusPosition(numericSize)),
|
|
352
|
-
children: status
|
|
353
|
-
})]
|
|
354
|
-
})
|
|
355
|
-
});
|
|
356
|
-
if (!showTooltip) {
|
|
357
|
-
return avatarElement;
|
|
481
|
+
...rootStylexProps,
|
|
482
|
+
children: visualContent
|
|
483
|
+
});
|
|
358
484
|
}
|
|
485
|
+
const avatarElement = /*#__PURE__*/_jsx(AvatarSizeContext, {
|
|
486
|
+
value: numericSize,
|
|
487
|
+
children: rootElement
|
|
488
|
+
});
|
|
359
489
|
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
//
|
|
490
|
+
// Always return the same structure so the avatar keeps its position in the
|
|
491
|
+
// React tree regardless of the tooltip flag — toggling it must not remount
|
|
492
|
+
// the avatar subtree (and lose image-load state). The tooltip is a sibling
|
|
493
|
+
// (no wrapper DOM); the hook's ref is already on the root via `rootRef`.
|
|
363
494
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
364
|
-
children: [avatarElement, tooltipHook.renderTooltip(trimmedTooltip)]
|
|
495
|
+
children: [avatarElement, showTooltip ? tooltipHook.renderTooltip(trimmedTooltip) : null]
|
|
365
496
|
});
|
|
366
497
|
}
|
|
367
498
|
Avatar.displayName = 'Avatar';
|
|
@@ -60,10 +60,12 @@ export interface AvatarStatusDotProps extends BaseProps<HTMLDivElement> {
|
|
|
60
60
|
* Describes the meaning of the indicator for screen readers
|
|
61
61
|
* (e.g. "Online", "Accepted", "John Doe is busy").
|
|
62
62
|
*
|
|
63
|
-
* Note: inside an Avatar the
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
63
|
+
* Note: inside an Avatar the dot sits in the avatar's `role="img"`
|
|
64
|
+
* subtree, where descendant semantics are pruned — the dot is never its
|
|
65
|
+
* own stop there. Instead, Avatar reads this `label` and composes it into
|
|
66
|
+
* its own accessible name (e.g. "Jane Doe, Online"), which is how the
|
|
67
|
+
* status reaches assistive tech (WCAG 4.1.2). Standalone dots (outside an
|
|
68
|
+
* Avatar) expose `role="img"` with this label directly.
|
|
67
69
|
*/
|
|
68
70
|
label?: string;
|
|
69
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarStatusDot.d.ts","sourceRoot":"","sources":["../../src/Avatar/AvatarStatusDot.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiD5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAAC;AAErE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC
|
|
1
|
+
{"version":3,"file":"AvatarStatusDot.d.ts","sourceRoot":"","sources":["../../src/Avatar/AvatarStatusDot.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiD5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAAC;AAErE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AA2JD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,OAAmB,EACnB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAyCtB;yBAlDe,eAAe"}
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* one AvatarGroupOverflow). The group provides overlap styling via
|
|
9
9
|
* context — no child introspection needed.
|
|
10
10
|
*
|
|
11
|
+
* When the group contains interactive avatars (rendered as links/buttons) or an
|
|
12
|
+
* interactive AvatarGroupOverflow, it becomes a single Tab stop with roving
|
|
13
|
+
* arrow-key focus (via useListFocus with hasRovingTabIndex) and exposes a
|
|
14
|
+
* screen-reader keyboard hint via aria-describedby. A purely static facepile
|
|
15
|
+
* gets neither — it stays a plain non-focusable group.
|
|
16
|
+
*
|
|
11
17
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
18
|
* - /packages/core/src/AvatarGroup/AvatarGroup.doc.mjs (props table, features)
|
|
13
19
|
* - /packages/core/src/AvatarGroup/index.ts (exports if types change)
|
|
@@ -53,7 +59,7 @@ export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
53
59
|
* </AvatarGroup>
|
|
54
60
|
* ```
|
|
55
61
|
*/
|
|
56
|
-
export declare function AvatarGroup({ children, size, 'data-testid': testId, 'aria-label': ariaLabelFromProps, xstyle, className, style, ref, ...props }: AvatarGroupProps): ReactNode;
|
|
62
|
+
export declare function AvatarGroup({ children, size, 'data-testid': testId, 'aria-label': ariaLabelFromProps, 'aria-describedby': ariaDescribedByFromProps, onKeyDown, onFocus, xstyle, className, style, ref, ...props }: AvatarGroupProps): ReactNode;
|
|
57
63
|
export declare namespace AvatarGroup {
|
|
58
64
|
var displayName: string;
|
|
59
65
|
}
|