@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/dist/Field/Field.js
CHANGED
|
@@ -109,7 +109,10 @@ export function Field({
|
|
|
109
109
|
description: isHorizontalLabels ? undefined : description,
|
|
110
110
|
descriptionID: isHorizontalLabels ? undefined : resolvedDescriptionID
|
|
111
111
|
});
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
// The 'tooltip' variant surfaces status through the input's on-field icon
|
|
114
|
+
// tooltip, so Field renders no message box for it.
|
|
115
|
+
const statusNode = status?.message && statusVariant !== 'tooltip' ? /*#__PURE__*/_jsx(FieldStatus, {
|
|
113
116
|
type: status.type,
|
|
114
117
|
message: status.message,
|
|
115
118
|
id: resolvedMessageID,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file FieldLabel.tsx
|
|
3
|
-
* @input Uses React, Icon, IconType
|
|
3
|
+
* @input Uses React, Icon, IconType, useTranslator
|
|
4
4
|
* @output Exports FieldLabel component, FieldLabelProps
|
|
5
5
|
* @position Core label implementation; used by Field, CheckboxInput, Switch
|
|
6
6
|
*
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - /packages/core/src/Field/Field.doc.mjs (props table, features, implementation notes)
|
|
9
9
|
* - /packages/core/src/Field/index.ts (exports if types change)
|
|
10
10
|
* - /packages/cli/templates/blocks/components/Field/ (showcase blocks)
|
|
11
|
+
* - /packages/core/locales/en.json (@astryx.field.required / @astryx.field.optional)
|
|
11
12
|
*/
|
|
12
13
|
import type { ReactNode } from 'react';
|
|
13
14
|
import type { BaseProps } from '../BaseProps';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLabel.d.ts","sourceRoot":"","sources":["../../src/Field/FieldLabel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldLabel.d.ts","sourceRoot":"","sources":["../../src/Field/FieldLabel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAmD5D,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IAClE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,OAAO,EACP,YAAoB,EACpB,aAAqB,EACrB,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,+BA+DjB;yBAjFe,UAAU"}
|
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* @file FieldLabel.tsx
|
|
5
|
-
* @input Uses React, Icon, IconType
|
|
7
|
+
* @input Uses React, Icon, IconType, useTranslator
|
|
6
8
|
* @output Exports FieldLabel component, FieldLabelProps
|
|
7
9
|
* @position Core label implementation; used by Field, CheckboxInput, Switch
|
|
8
10
|
*
|
|
@@ -10,14 +12,15 @@
|
|
|
10
12
|
* - /packages/core/src/Field/Field.doc.mjs (props table, features, implementation notes)
|
|
11
13
|
* - /packages/core/src/Field/index.ts (exports if types change)
|
|
12
14
|
* - /packages/cli/templates/blocks/components/Field/ (showcase blocks)
|
|
15
|
+
* - /packages/core/locales/en.json (@astryx.field.required / @astryx.field.optional)
|
|
13
16
|
*/
|
|
14
|
-
|
|
15
17
|
import * as stylex from '@stylexjs/stylex';
|
|
16
18
|
import { mergeProps } from "../utils/index.js";
|
|
17
19
|
import "../theme/tokens.stylex.js";
|
|
18
20
|
import { colorVars, fontWeightVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
19
21
|
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
20
22
|
import { Tooltip } from "../Tooltip/index.js";
|
|
23
|
+
import { useTranslator } from "../i18n/index.js";
|
|
21
24
|
import { themeProps } from "../utils/themeProps.js";
|
|
22
25
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
26
|
const styles = {
|
|
@@ -42,7 +45,7 @@ const styles = {
|
|
|
42
45
|
ksu8eU: "xng3xce",
|
|
43
46
|
kMcinP: "xzpqnlu",
|
|
44
47
|
kZKoxP: "xjm9jq1",
|
|
45
|
-
|
|
48
|
+
kLqNvP: "x1o0tod",
|
|
46
49
|
kogj98: "xkdpibf",
|
|
47
50
|
kVQacm: "xb3r6kr",
|
|
48
51
|
kmVPX3: "x1717udv",
|
|
@@ -87,7 +90,8 @@ export function FieldLabel({
|
|
|
87
90
|
ref,
|
|
88
91
|
...rest
|
|
89
92
|
}) {
|
|
90
|
-
const
|
|
93
|
+
const t = useTranslator();
|
|
94
|
+
const statusText = isOptional ? t('@astryx.field.optional') : isRequired ? t('@astryx.field.required') : null;
|
|
91
95
|
|
|
92
96
|
// A group label (e.g. for a radiogroup) must not be a literal `<label>`
|
|
93
97
|
// element: a `<label>` semantically names a single form control and can't be
|
|
@@ -134,7 +138,7 @@ export function FieldLabel({
|
|
|
134
138
|
className: "x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4"
|
|
135
139
|
},
|
|
136
140
|
1: {
|
|
137
|
-
className: "x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 xng3xce xzpqnlu xjm9jq1
|
|
141
|
+
className: "x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 xng3xce xzpqnlu xjm9jq1 x1o0tod xkdpibf xb3r6kr x1717udv x47corl x10l6tqk x13vifvy x87ps6o xuxw1ft x1i1rx1s"
|
|
138
142
|
}
|
|
139
143
|
}[!!isLabelHidden << 0],
|
|
140
144
|
children: description
|
|
@@ -44,6 +44,7 @@ export declare const inputWrapperStyles: Readonly<{
|
|
|
44
44
|
readonly cursor: stylex.StyleXClassNameFor<"cursor", "not-allowed">;
|
|
45
45
|
readonly opacity: stylex.StyleXClassNameFor<"opacity", 0.5>;
|
|
46
46
|
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "light-dark(#CCD3DB, #494D53)">;
|
|
47
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", "none">;
|
|
47
48
|
}>;
|
|
48
49
|
}>;
|
|
49
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/Field/inputStyles.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAW3C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"inputStyles.stylex.d.ts","sourceRoot":"","sources":["../../src/Field/inputStyles.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAW3C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;EAUlC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;EAyBvC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;EAmBvC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;EAmBjC,CAAC"}
|
|
@@ -17,6 +17,7 @@ import type { InputStatusType } from '../Field/types';
|
|
|
17
17
|
export interface FieldStatusVariantMap {
|
|
18
18
|
attached: true;
|
|
19
19
|
detached: true;
|
|
20
|
+
tooltip: true;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* FieldStatus variant type. Extensible via module augmentation of FieldStatusVariantMap.
|
|
@@ -43,6 +44,15 @@ export interface FieldStatusProps extends BaseProps<HTMLDivElement> {
|
|
|
43
44
|
/**
|
|
44
45
|
* A status message component for form fields.
|
|
45
46
|
*
|
|
47
|
+
* The `detached` variant renders a leading status icon before the message so
|
|
48
|
+
* status is not conveyed by color or position alone (WCAG 1.4.1). The icon is
|
|
49
|
+
* decorative for assistive tech (`aria-hidden`): the message text already names
|
|
50
|
+
* the status in words and is announced through the live region. The `attached`
|
|
51
|
+
* variant keeps its status affordance on the bordered input, so it renders no
|
|
52
|
+
* icon here to avoid a duplicate. The `tooltip` variant renders no message box
|
|
53
|
+
* at all — the input surfaces the status through a tooltip on its on-field
|
|
54
|
+
* icon — so callers skip rendering FieldStatus for it.
|
|
55
|
+
*
|
|
46
56
|
* Screen-reader announcements go through the persistent `useAnnounce` live
|
|
47
57
|
* regions (assertive for errors, polite otherwise) rather than `role`/
|
|
48
58
|
* `aria-live` on the rendered element. Live regions that mount together with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldStatus.d.ts","sourceRoot":"","sources":["../../src/FieldStatus/FieldStatus.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldStatus.d.ts","sourceRoot":"","sources":["../../src/FieldStatus/FieldStatus.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAoEpD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IACtB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,IAAI,EACJ,OAAO,EACP,EAAE,EACF,OAAoB,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,gBAAgB,qBA2ClB;yBArDe,WAAW"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file FieldStatus.tsx
|
|
5
|
-
* @input Uses React, stylex, theme tokens, useAnnounce
|
|
5
|
+
* @input Uses React, stylex, theme tokens, useAnnounce, Icon
|
|
6
6
|
* @output Exports FieldStatus component, FieldStatusProps
|
|
7
7
|
* @position Core implementation; consumed by Field, Switch, CheckboxInput, and the FieldStatus entrypoint
|
|
8
8
|
*
|
|
@@ -24,7 +24,18 @@ import "../theme/tokens.stylex.js";
|
|
|
24
24
|
import { colorVars, radiusVars, spacingVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
25
25
|
import { useEntryAnimation } from "../hooks/useEntryAnimation.js";
|
|
26
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
27
|
-
import {
|
|
27
|
+
import { Icon } from "../Icon/index.js";
|
|
28
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
+
/**
|
|
30
|
+
* Maps each status type to its status glyph. Mirrors the mapping the input
|
|
31
|
+
* controls already use for the on-field status affordance, so the detached
|
|
32
|
+
* message shows the same icon a consumer sees elsewhere for that status.
|
|
33
|
+
*/
|
|
34
|
+
const statusIconMap = {
|
|
35
|
+
warning: 'warning',
|
|
36
|
+
error: 'error',
|
|
37
|
+
success: 'success'
|
|
38
|
+
};
|
|
28
39
|
const styles = {
|
|
29
40
|
base: {
|
|
30
41
|
kMv6JI: "x9ynric",
|
|
@@ -88,6 +99,15 @@ const colorStyles = {
|
|
|
88
99
|
/**
|
|
89
100
|
* A status message component for form fields.
|
|
90
101
|
*
|
|
102
|
+
* The `detached` variant renders a leading status icon before the message so
|
|
103
|
+
* status is not conveyed by color or position alone (WCAG 1.4.1). The icon is
|
|
104
|
+
* decorative for assistive tech (`aria-hidden`): the message text already names
|
|
105
|
+
* the status in words and is announced through the live region. The `attached`
|
|
106
|
+
* variant keeps its status affordance on the bordered input, so it renders no
|
|
107
|
+
* icon here to avoid a duplicate. The `tooltip` variant renders no message box
|
|
108
|
+
* at all — the input surfaces the status through a tooltip on its on-field
|
|
109
|
+
* icon — so callers skip rendering FieldStatus for it.
|
|
110
|
+
*
|
|
91
111
|
* Screen-reader announcements go through the persistent `useAnnounce` live
|
|
92
112
|
* regions (assertive for errors, polite otherwise) rather than `role`/
|
|
93
113
|
* `aria-live` on the rendered element. Live regions that mount together with
|
|
@@ -140,7 +160,23 @@ export function FieldStatus({
|
|
|
140
160
|
type,
|
|
141
161
|
variant
|
|
142
162
|
}), stylex.props(styles.base, entryStyle, variant === 'attached' ? styles.attached : styles.detached, colorStyles[type], xstyle), className, style),
|
|
143
|
-
children:
|
|
163
|
+
children: variant === 'detached' ? /*#__PURE__*/_jsxs("span", {
|
|
164
|
+
...{
|
|
165
|
+
className: "x78zum5 x1cy8zhl xzye2dw"
|
|
166
|
+
},
|
|
167
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
168
|
+
...{
|
|
169
|
+
className: "x3nfvp2 x6s0dn4 x14o5nre x2lah0s"
|
|
170
|
+
},
|
|
171
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
172
|
+
icon: statusIconMap[type],
|
|
173
|
+
size: "sm",
|
|
174
|
+
color: "inherit"
|
|
175
|
+
})
|
|
176
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
177
|
+
children: message
|
|
178
|
+
})]
|
|
179
|
+
}) : message
|
|
144
180
|
});
|
|
145
181
|
}
|
|
146
182
|
FieldStatus.displayName = 'FieldStatus';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InputStatus } from '../Field';
|
|
1
|
+
import { type InputStatus, type FieldStatusVariant } from '../Field';
|
|
2
2
|
export type { InputStatus as FileInputStatus, InputStatusType as FileInputStatusType, } from '../Field';
|
|
3
3
|
import type { BaseProps } from '../BaseProps';
|
|
4
4
|
import type { SizeValue } from '../utils/types';
|
|
@@ -86,6 +86,14 @@ export interface FileInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
86
86
|
* Validation status for the input.
|
|
87
87
|
*/
|
|
88
88
|
status?: InputStatus;
|
|
89
|
+
/**
|
|
90
|
+
* How the status message is placed relative to the input.
|
|
91
|
+
* - 'attached': message overlaps directly below the input (bordered treatment)
|
|
92
|
+
* - 'detached': message floats below as a separate element with spacing
|
|
93
|
+
* - 'tooltip': no message box; the status icon becomes a focusable info-tip button that reveals the message on hover, keyboard focus, or tap
|
|
94
|
+
* @default 'attached'
|
|
95
|
+
*/
|
|
96
|
+
statusVariant?: FieldStatusVariant;
|
|
89
97
|
/**
|
|
90
98
|
* Description text displayed below the label.
|
|
91
99
|
*/
|
|
@@ -126,7 +134,7 @@ export interface FileInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
126
134
|
* <FileInput label="Resume" value={file} onChange={setFile} accept=".pdf" />
|
|
127
135
|
* ```
|
|
128
136
|
*/
|
|
129
|
-
export declare function FileInput({ label, isLabelHidden, value, onChange, changeAction, accept, isMultiple, maxSize, maxFiles, isDisabled, disabledMessage, isRequired, isLoading, status: statusProp, description, placeholder, mode, isOptional, labelTooltip, width, xstyle, className, style, ref, ...rest }: FileInputProps): import("react").JSX.Element;
|
|
137
|
+
export declare function FileInput({ label, isLabelHidden, value, onChange, changeAction, accept, isMultiple, maxSize, maxFiles, isDisabled, disabledMessage, isRequired, isLoading, status: statusProp, statusVariant, description, placeholder, mode, isOptional, labelTooltip, width, xstyle, className, style, ref, ...rest }: FileInputProps): import("react").JSX.Element;
|
|
130
138
|
export declare namespace FileInput {
|
|
131
139
|
var displayName: string;
|
|
132
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AASlB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA+M9C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,SAAS,EACT,UAAU,GAAG,cAAc,GAAG,OAAO,CACtC;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,aAAqB,EACrB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,MAAM,EAAE,UAAU,EAClB,aAA0B,EAC1B,WAAW,EACX,WAAW,EACX,IAAc,EACd,UAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BA2ZhB;yBAtbe,SAAS"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file FileInput.tsx
|
|
7
|
-
* @input Uses React, useId, Field, Icon, Spinner
|
|
7
|
+
* @input Uses React, useId, Field, Icon, Spinner, VisuallyHidden
|
|
8
8
|
* @output Exports FileInput component, FileInputProps, FileInputStatus
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by FileInput.test.tsx
|
|
10
10
|
*
|
|
@@ -22,7 +22,10 @@ import { colorVars, sizeVars, spacingVars, radiusVars, typographyVars, typeScale
|
|
|
22
22
|
import { Field, InputClearButton } from "../Field/index.js";
|
|
23
23
|
import { Icon } from "../Icon/index.js";
|
|
24
24
|
import { Spinner } from "../Spinner/index.js";
|
|
25
|
+
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
25
26
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
27
|
+
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
28
|
+
import { useClickableContainer } from "../hooks/useClickableContainer.js";
|
|
26
29
|
import { useTooltip } from "../Tooltip/index.js";
|
|
27
30
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
28
31
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -182,6 +185,7 @@ export function FileInput({
|
|
|
182
185
|
isRequired = false,
|
|
183
186
|
isLoading = false,
|
|
184
187
|
status: statusProp,
|
|
188
|
+
statusVariant = 'attached',
|
|
185
189
|
description,
|
|
186
190
|
placeholder,
|
|
187
191
|
mode = 'input',
|
|
@@ -198,22 +202,24 @@ export function FileInput({
|
|
|
198
202
|
const id = useId();
|
|
199
203
|
const descriptionID = useId();
|
|
200
204
|
const statusMessageID = useId();
|
|
201
|
-
const
|
|
205
|
+
const requiredID = useId();
|
|
202
206
|
const inputRef = useRef(null);
|
|
207
|
+
const containerRef = useRef(null);
|
|
203
208
|
const [isDragOver, setIsDragOver] = useState(false);
|
|
204
209
|
const [validationError, setValidationError] = useState(null);
|
|
205
210
|
const [, startTransition] = useTransition();
|
|
206
211
|
|
|
207
212
|
// Announce successful file selection to screen readers via a persistent
|
|
208
|
-
// live region (forms-17).
|
|
209
|
-
//
|
|
213
|
+
// live region (forms-17). Validation errors are announced (assertively) by
|
|
214
|
+
// the FieldStatus that the derived error status mounts, so only the
|
|
215
|
+
// successful attach needs an explicit announcement here.
|
|
210
216
|
const announce = useAnnounce();
|
|
211
217
|
|
|
212
218
|
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
213
|
-
// tooltip listeners attach to the
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
219
|
+
// tooltip listeners attach to the visible container (which stays hoverable)
|
|
220
|
+
// and the trigger stays perceivable via aria-disabled instead of the native
|
|
221
|
+
// disabled attribute. Opening the picker is blocked by the isDisabled guards
|
|
222
|
+
// in the handlers.
|
|
217
223
|
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
218
224
|
const disabledMessageTooltip = useTooltip({
|
|
219
225
|
placement: 'above',
|
|
@@ -224,17 +230,24 @@ export function FileInput({
|
|
|
224
230
|
type: 'error',
|
|
225
231
|
message: validationError
|
|
226
232
|
} : undefined);
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
const {
|
|
234
|
+
statusIcon,
|
|
235
|
+
describedBy: statusTooltipDescribedBy
|
|
236
|
+
} = useInputStatusIcon({
|
|
237
|
+
status,
|
|
238
|
+
statusVariant
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// Required state. The trigger is a real button, but AT does not reliably
|
|
242
|
+
// announce aria-required, so the trigger instead points its aria-describedby
|
|
243
|
+
// at a visually hidden "Required" span — mirroring the Field label's visible
|
|
244
|
+
// indicator (where isOptional takes precedence) and the pattern Slider uses
|
|
245
|
+
// for its thumbs.
|
|
246
|
+
const conveysRequired = isRequired && !isOptional;
|
|
247
|
+
const ariaDescribedBy = [description ? descriptionID : null, statusVariant !== 'tooltip' && status?.message ? statusMessageID : null,
|
|
248
|
+
// The tooltip variant renders no message box; describe the input by the
|
|
249
|
+
// tooltip's content instead so the status is still announced.
|
|
250
|
+
statusTooltipDescribedBy, conveysRequired ? requiredID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
238
251
|
const defaultPlaceholder = isMultiple ? 'Choose files' : 'Choose file';
|
|
239
252
|
const displayPlaceholder = placeholder ?? defaultPlaceholder;
|
|
240
253
|
const handleFiles = useCallback(fileList => {
|
|
@@ -258,8 +271,9 @@ export function FileInput({
|
|
|
258
271
|
onChange(result);
|
|
259
272
|
|
|
260
273
|
// Announce the successful selection politely. Validation errors are
|
|
261
|
-
//
|
|
262
|
-
// attach here (do not
|
|
274
|
+
// announced assertively by the FieldStatus that the derived error
|
|
275
|
+
// status mounts, so only announce the attach here (do not
|
|
276
|
+
// double-announce errors).
|
|
263
277
|
if (errors.length === 0) {
|
|
264
278
|
announce(valid.length === 1 ? `1 file selected: ${valid[0].name}` : `${valid.length} files selected`);
|
|
265
279
|
}
|
|
@@ -290,12 +304,28 @@ export function FileInput({
|
|
|
290
304
|
inputRef.current?.click();
|
|
291
305
|
}
|
|
292
306
|
}, [isDisabled]);
|
|
307
|
+
|
|
308
|
+
// Explicit keyboard activation so Enter/Space open the picker even where a
|
|
309
|
+
// synthetic keydown does not raise a native click. The isDisabled guard
|
|
310
|
+
// blocks activation while focusable-disabled.
|
|
293
311
|
const handleKeyDown = useCallback(e => {
|
|
294
312
|
if ((e.key === 'Enter' || e.key === ' ') && !isDisabled) {
|
|
295
313
|
e.preventDefault();
|
|
296
314
|
inputRef.current?.click();
|
|
297
315
|
}
|
|
298
316
|
}, [isDisabled]);
|
|
317
|
+
|
|
318
|
+
// Make the surface clickable without giving it an interactive role. Clicks on
|
|
319
|
+
// the nested clear/status controls are ignored by the hook, so those buttons
|
|
320
|
+
// are plain siblings — no nested-interactive violation.
|
|
321
|
+
const {
|
|
322
|
+
onClick: onContainerClick,
|
|
323
|
+
onMouseUp: onContainerMouseUp
|
|
324
|
+
} = useClickableContainer({
|
|
325
|
+
containerRef,
|
|
326
|
+
onClick: handleClick,
|
|
327
|
+
disabled: isDisabled
|
|
328
|
+
});
|
|
299
329
|
const handleDragEnter = useCallback(e => {
|
|
300
330
|
e.preventDefault();
|
|
301
331
|
e.stopPropagation();
|
|
@@ -396,11 +426,7 @@ export function FileInput({
|
|
|
396
426
|
}
|
|
397
427
|
}[!!hasFiles << 1 | !!hasFiles << 0],
|
|
398
428
|
children: fileNames ?? displayPlaceholder
|
|
399
|
-
}),
|
|
400
|
-
icon: statusIconMap[status.type],
|
|
401
|
-
size: "md",
|
|
402
|
-
color: statusIconColorMap[status.type]
|
|
403
|
-
})]
|
|
429
|
+
}), statusIcon]
|
|
404
430
|
});
|
|
405
431
|
};
|
|
406
432
|
const isDropzone = mode === 'dropzone';
|
|
@@ -424,47 +450,54 @@ export function FileInput({
|
|
|
424
450
|
message: status.message,
|
|
425
451
|
messageID: status.message ? statusMessageID : undefined
|
|
426
452
|
} : undefined,
|
|
453
|
+
statusVariant: statusVariant,
|
|
427
454
|
labelTooltip: labelTooltip,
|
|
428
455
|
width: width,
|
|
429
456
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
430
457
|
ref: el => {
|
|
431
|
-
|
|
432
|
-
//
|
|
433
|
-
//
|
|
458
|
+
containerRef.current = el;
|
|
459
|
+
// Anchor + hover/focus listeners for the disabled-message tooltip on
|
|
460
|
+
// the visible container (the focusable trigger is visually hidden, so
|
|
461
|
+
// anchoring there would place the tooltip at a 1px box). focusin
|
|
462
|
+
// bubbles from the trigger button, so the tooltip still opens on
|
|
463
|
+
// keyboard focus. Handlers are gated internally by isEnabled.
|
|
434
464
|
disabledMessageTooltip.ref(el);
|
|
435
465
|
},
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
// aria-disabled so the reason is focus-discoverable; opening the picker
|
|
439
|
-
// is still blocked by the isDisabled guards in the handlers.
|
|
440
|
-
,
|
|
441
|
-
tabIndex: isDisabled && !showsDisabledMessage ? -1 : 0,
|
|
442
|
-
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
443
|
-
onClick: handleClick,
|
|
444
|
-
onKeyDown: handleKeyDown
|
|
445
|
-
// aria-label suppresses child content from the accessible name, so
|
|
446
|
-
// compose the selected filenames into it — otherwise a screen-reader
|
|
447
|
-
// user refocusing the control hears only the field label and cannot
|
|
448
|
-
// tell what (if anything) is attached.
|
|
449
|
-
,
|
|
450
|
-
"aria-label": hasFiles && fileNames ? t('@astryx.fileInput.triggerWithFiles', {
|
|
451
|
-
label,
|
|
452
|
-
fileNames
|
|
453
|
-
}) : label,
|
|
454
|
-
"aria-busy": isLoading || undefined
|
|
455
|
-
// These describe the operable control, so they belong on the focusable
|
|
456
|
-
// role="button" wrapper — not the hidden tabIndex={-1} file input the
|
|
457
|
-
// user never focuses (forms-6).
|
|
458
|
-
,
|
|
459
|
-
"aria-describedby": ariaDescribedBy,
|
|
460
|
-
"aria-required": isRequired ? 'true' : undefined,
|
|
461
|
-
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
466
|
+
onClick: !isDisabled ? onContainerClick : undefined,
|
|
467
|
+
onMouseUp: !isDisabled ? onContainerMouseUp : undefined,
|
|
462
468
|
...dragDropProps,
|
|
463
469
|
...mergeProps(themeProps('file-input', {
|
|
464
470
|
mode,
|
|
465
471
|
status: status?.type ?? null
|
|
466
472
|
}), stylex.props(isDropzone ? styles.dropzone : styles.compact, isDropzone && !isDisabled && styles.dropzoneHover, isDropzone && isDragOver && styles.dropzoneActive, isDropzone && isDisabled && styles.dropzoneDisabled, !isDropzone && isDisabled && styles.compactDisabled, status && statusBorderStyles[status.type], xstyle), className, style),
|
|
467
|
-
children: [/*#__PURE__*/_jsx(
|
|
473
|
+
children: [/*#__PURE__*/_jsx(VisuallyHidden, {
|
|
474
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
475
|
+
type: "button"
|
|
476
|
+
// With a disabledMessage the trigger keeps focusability via
|
|
477
|
+
// aria-disabled so the reason is focus-discoverable; opening the
|
|
478
|
+
// picker is still blocked by the isDisabled guards in the handlers.
|
|
479
|
+
// Otherwise the native disabled attribute removes it from the tab
|
|
480
|
+
// order.
|
|
481
|
+
,
|
|
482
|
+
disabled: isDisabled && !showsDisabledMessage,
|
|
483
|
+
tabIndex: isDisabled && !showsDisabledMessage ? -1 : 0,
|
|
484
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
485
|
+
onClick: handleClick,
|
|
486
|
+
onKeyDown: handleKeyDown
|
|
487
|
+
// aria-label suppresses child content from the accessible name, so
|
|
488
|
+
// compose the selected filenames into it — otherwise a
|
|
489
|
+
// screen-reader user refocusing the control hears only the field
|
|
490
|
+
// label and cannot tell what (if anything) is attached.
|
|
491
|
+
,
|
|
492
|
+
"aria-label": hasFiles && fileNames ? t('@astryx.fileInput.triggerWithFiles', {
|
|
493
|
+
label,
|
|
494
|
+
fileNames
|
|
495
|
+
}) : label,
|
|
496
|
+
"aria-busy": isLoading || undefined,
|
|
497
|
+
"aria-describedby": ariaDescribedBy,
|
|
498
|
+
"aria-invalid": status?.type === 'error' ? 'true' : undefined
|
|
499
|
+
})
|
|
500
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
468
501
|
...rest,
|
|
469
502
|
ref: mergeRefs(ref, inputRef),
|
|
470
503
|
id: id,
|
|
@@ -474,7 +507,7 @@ export function FileInput({
|
|
|
474
507
|
disabled: isDisabled,
|
|
475
508
|
onChange: handleInputChange
|
|
476
509
|
// The visually-hidden native input is never focused (tabIndex={-1});
|
|
477
|
-
// its describedby/required/invalid live on the
|
|
510
|
+
// its describedby/required/invalid live on the trigger button.
|
|
478
511
|
,
|
|
479
512
|
"aria-hidden": "true",
|
|
480
513
|
tabIndex: -1,
|
|
@@ -487,14 +520,9 @@ export function FileInput({
|
|
|
487
520
|
}),
|
|
488
521
|
onClick: handleClear
|
|
489
522
|
})]
|
|
490
|
-
}), /*#__PURE__*/_jsx(
|
|
491
|
-
id:
|
|
492
|
-
|
|
493
|
-
"aria-live": "polite",
|
|
494
|
-
...{
|
|
495
|
-
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
496
|
-
},
|
|
497
|
-
children: validationError
|
|
523
|
+
}), conveysRequired && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
524
|
+
id: requiredID,
|
|
525
|
+
children: t('@astryx.fileInput.required')
|
|
498
526
|
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
499
527
|
});
|
|
500
528
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AA4C3B;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,eAAe,EAAE,CACf,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAyBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAyT5E"}
|
|
@@ -17,7 +17,6 @@ import { useLayer } from "../Layer/useLayer.js";
|
|
|
17
17
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
18
18
|
import "../theme/tokens.stylex.js";
|
|
19
19
|
import { colorVars, shadowVars, radiusVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
20
|
-
import { mergeProps } from "../utils/index.js";
|
|
21
20
|
import { themeProps } from "../utils/themeProps.js";
|
|
22
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
const styles = {
|
|
@@ -259,6 +258,7 @@ export function useHoverCard(options = {}) {
|
|
|
259
258
|
// Render function that wraps layer.render with hover card behavior
|
|
260
259
|
const renderHoverCard = useCallback((children, props) => {
|
|
261
260
|
const renderPlacement = props?.placement ?? placement;
|
|
261
|
+
const themeClassName = themeProps('hovercard').className;
|
|
262
262
|
const renderProps = {
|
|
263
263
|
placement: renderPlacement,
|
|
264
264
|
alignment: props?.alignment ?? alignment,
|
|
@@ -267,15 +267,21 @@ export function useHoverCard(options = {}) {
|
|
|
267
267
|
// are non-modal, so group is honest semantics without a name.
|
|
268
268
|
role: label ? 'dialog' : 'group',
|
|
269
269
|
'aria-label': label || undefined,
|
|
270
|
-
|
|
270
|
+
// Consumer surface style props land on the layer container — the
|
|
271
|
+
// themed surface (bg/radius/shadow) where the theme class lives — so
|
|
272
|
+
// customizing the card targets the same element as the theme. The inner
|
|
273
|
+
// span keeps `styles.content` for padding.
|
|
274
|
+
xstyle: [popoverXstyle, layerAnimations[renderPlacement], props?.xstyle],
|
|
275
|
+
className: props?.className ? `${themeClassName} ${props.className}` : themeClassName,
|
|
276
|
+
style: props?.style,
|
|
271
277
|
// Render the layer as inline-safe phrasing markup so HoverCard stays
|
|
272
278
|
// valid (and hydration-stable) inside inline contexts like a `<p>`.
|
|
273
279
|
as: 'span'
|
|
274
280
|
};
|
|
275
281
|
return layer.render(/*#__PURE__*/_jsx("span", {
|
|
276
|
-
...
|
|
282
|
+
...{
|
|
277
283
|
className: "x1lliihq x1vlblms xvmdzux x126nfab x1t818jl"
|
|
278
|
-
}
|
|
284
|
+
},
|
|
279
285
|
onMouseEnter: () => {
|
|
280
286
|
isHoveringContentRef.current = true;
|
|
281
287
|
clearTimeouts();
|
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import React, { type ComponentType, type SVGProps } from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
|
+
import type { StyleXStyles } from '@stylexjs/stylex';
|
|
22
23
|
import type { IconName } from './globalIconRegistry';
|
|
23
24
|
declare const colorStyles: Readonly<{
|
|
24
25
|
readonly primary: Readonly<{
|
|
@@ -170,6 +171,19 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
170
171
|
* ```
|
|
171
172
|
*/
|
|
172
173
|
label?: string;
|
|
174
|
+
/**
|
|
175
|
+
* StyleX styles created via `stylex.create()`. Folded into the icon's own
|
|
176
|
+
* `stylex.props()` call (as the last argument) so it merges with the base
|
|
177
|
+
* color/size styles for optimal deduplication, matching how other Astryx
|
|
178
|
+
* components accept `xstyle`.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```
|
|
182
|
+
* const overrides = stylex.create({ root: { opacity: 0.5 } });
|
|
183
|
+
* <Icon icon="search" xstyle={overrides.root} />
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
xstyle?: StyleXStyles;
|
|
173
187
|
}
|
|
174
188
|
/**
|
|
175
189
|
* Renders an icon from the icon registry or a custom SVG component.
|
|
@@ -179,7 +193,7 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
179
193
|
* <Icon icon="close" size="md" color="primary" />
|
|
180
194
|
* ```
|
|
181
195
|
*/
|
|
182
|
-
export declare function Icon({ icon, color, size, label, ref, ...props }: IconProps): React.JSX.Element;
|
|
196
|
+
export declare function Icon({ icon, color, size, label, ref, className, style, xstyle, ...props }: IconProps): React.JSX.Element;
|
|
183
197
|
export declare namespace Icon {
|
|
184
198
|
var displayName: string;
|
|
185
199
|
}
|
package/dist/Icon/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAqBnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Df,CAAC;AAEH;;;;;;;;GAQG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;EAiBd,CAAC;AAyCH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,QAAQ,CAAC,aAAa,CAAC,EACvB,KAAK,GAAG,OAAO,CAChB;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAyBD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,KAAiB,EACjB,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,qBA4CX;yBAtDe,IAAI;;;AA8HpB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,EAChC,KAAK,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAC,GAC3C,KAAK,CAAC,SAAS,CAYjB"}
|