@astryxdesign/core 0.1.9-canary.d2d84f8 → 0.1.9-canary.e00a241
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/dist/Avatar/Avatar.d.ts +6 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +46 -12
- package/dist/Avatar/AvatarStatusDot.d.ts +6 -4
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- 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/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/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +3 -1
- 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/CheckboxInput/CheckboxInput.js +4 -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 +13 -7
- 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/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +14 -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 +1 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +31 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts +1 -0
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +20 -19
- 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 +4 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +4 -1
- 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/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 +4 -1
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +4 -2
- package/dist/FileInput/FileInput.d.ts +1 -0
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +91 -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/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +15 -9
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +6 -3
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +65 -40
- package/dist/NumberInput/NumberInput.d.ts +1 -0
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +20 -17
- package/dist/Outline/Outline.js +2 -2
- package/dist/RadioList/RadioList.d.ts +2 -2
- package/dist/RadioList/RadioListItem.js +4 -4
- 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 +2 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +58 -16
- 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/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 +160 -91
- 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/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +30 -4
- 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 +36 -26
- 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 +14 -6
- 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 +1 -0
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +16 -19
- package/dist/TextInput/TextInput.d.ts +1 -0
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +18 -17
- package/dist/TimeInput/TimeInput.d.ts +1 -0
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +15 -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/Token/Token.d.ts +30 -3
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +17 -2
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +2 -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.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +19 -10
- package/dist/Typeahead/Typeahead.js +1 -1
- 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 +38 -14
- package/dist/astryx.umd.js +52 -52
- 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/useListFocus.d.ts +39 -1
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +54 -9
- 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 +76 -0
- package/locales/pseudo.json +57 -0
- package/package.json +6 -1
- package/src/Avatar/Avatar.doc.mjs +18 -4
- package/src/Avatar/Avatar.test.tsx +106 -0
- package/src/Avatar/Avatar.tsx +62 -10
- package/src/Avatar/AvatarStatusDot.doc.mjs +4 -4
- package/src/Avatar/AvatarStatusDot.tsx +6 -4
- package/src/AvatarGroup/AvatarGroup.test.tsx +16 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +10 -10
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +51 -0
- package/src/Breadcrumbs/index.ts +4 -0
- package/src/Button/Button.doc.mjs +0 -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/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatMessageBubble.tsx +15 -10
- package/src/Chat/ChatSystemMessage.test.tsx +5 -0
- package/src/Chat/ChatToolCalls.tsx +9 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +6 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -4
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -0
- 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.tsx +35 -8
- 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/ContextMenu/ContextMenu.test.tsx +42 -0
- package/src/ContextMenu/ContextMenu.tsx +13 -11
- package/src/ContextMenu/index.ts +5 -0
- package/src/DateInput/DateInput.doc.mjs +15 -5
- package/src/DateInput/DateInput.test.tsx +210 -3
- package/src/DateInput/DateInput.tsx +41 -29
- package/src/DateRangeInput/DateRangeInput.doc.mjs +11 -3
- package/src/DateRangeInput/DateRangeInput.test.tsx +120 -3
- package/src/DateRangeInput/DateRangeInput.tsx +29 -27
- 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 +8 -2
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +8 -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/inputStyles.stylex.ts +2 -0
- package/src/FieldStatus/FieldStatus.tsx +10 -4
- package/src/FileInput/FileInput.doc.mjs +13 -7
- package/src/FileInput/FileInput.test.tsx +84 -16
- package/src/FileInput/FileInput.tsx +96 -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/Lightbox/Lightbox.tsx +11 -3
- package/src/List/List.test.tsx +17 -29
- package/src/List/List.tsx +6 -1
- package/src/Markdown/Markdown.test.tsx +21 -0
- package/src/Markdown/Markdown.tsx +4 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +11 -0
- package/src/MultiSelector/MultiSelector.test.tsx +306 -3
- package/src/MultiSelector/MultiSelector.tsx +88 -57
- package/src/NumberInput/NumberInput.doc.mjs +11 -5
- package/src/NumberInput/NumberInput.test.tsx +48 -0
- package/src/NumberInput/NumberInput.tsx +25 -26
- package/src/Outline/Outline.test.tsx +12 -12
- package/src/Outline/Outline.tsx +2 -2
- package/src/RadioList/RadioList.doc.mjs +6 -0
- package/src/RadioList/RadioList.tsx +2 -2
- package/src/RadioList/RadioListItem.tsx +4 -4
- package/src/Resizable/ResizeHandle.test.tsx +94 -0
- package/src/Resizable/ResizeHandle.tsx +70 -20
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -0
- package/src/Selector/Selector.doc.mjs +8 -0
- package/src/Selector/Selector.test.tsx +328 -3
- package/src/Selector/Selector.tsx +70 -19
- package/src/SideNav/SideNav.tsx +1 -8
- package/src/SideNav/SideNavCollapseButton.tsx +9 -7
- package/src/SideNav/SideNavItem.tsx +5 -3
- 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 +22 -0
- package/src/Switch/Switch.tsx +90 -33
- 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/Table/BaseTable.tsx +34 -2
- package/src/Table/Table.doc.mjs +11 -0
- package/src/Table/Table.test.tsx +85 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +9 -6
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +24 -17
- 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 +37 -8
- 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 +11 -5
- package/src/TextArea/TextArea.tsx +17 -26
- package/src/TextInput/TextInput.doc.mjs +11 -5
- package/src/TextInput/TextInput.test.tsx +130 -3
- package/src/TextInput/TextInput.tsx +18 -25
- package/src/Thumbnail/Thumbnail.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.doc.mjs +11 -5
- package/src/TimeInput/TimeInput.tsx +14 -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/Token/Token.test.tsx +21 -15
- package/src/Token/Token.tsx +31 -14
- package/src/Token/index.ts +1 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +8 -1
- package/src/Tokenizer/Tokenizer.tsx +4 -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 +29 -14
- package/src/Typeahead/Typeahead.doc.mjs +6 -0
- package/src/Typeahead/Typeahead.test.tsx +27 -0
- package/src/Typeahead/Typeahead.tsx +1 -1
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- 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/useListFocus.doc.mjs +25 -3
- package/src/hooks/useListFocus.test.tsx +153 -1
- package/src/hooks/useListFocus.ts +102 -9
- 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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file menuItemHover.ts
|
|
3
|
+
* @output Exports focusMenuItemOnHover
|
|
4
|
+
* @position Shared helper for DropdownMenu/ContextMenu item components
|
|
5
|
+
*
|
|
6
|
+
* Menus keep a single highlighted item by using DOM focus as the sole
|
|
7
|
+
* highlight source. Mouse hover moves focus onto the pointed-at item so the
|
|
8
|
+
* one focus highlight follows the pointer — instead of a separate `:hover`
|
|
9
|
+
* background leaving the keyboard-focused item highlighted at the same time.
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update the item components that use it:
|
|
12
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuItem.tsx
|
|
13
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.tsx
|
|
14
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuRadioItem.tsx
|
|
15
|
+
*/
|
|
16
|
+
import type { PointerEvent } from 'react';
|
|
17
|
+
/**
|
|
18
|
+
* Move focus to a menu item as the pointer moves over it, so hover and
|
|
19
|
+
* keyboard navigation share a single focus-driven highlight. Only reacts to a
|
|
20
|
+
* real mouse (not touch/pen, which have no hover), and skips disabled items.
|
|
21
|
+
*/
|
|
22
|
+
export declare function focusMenuItemOnHover(e: PointerEvent<HTMLElement>, isDisabled?: boolean): void;
|
|
23
|
+
//# sourceMappingURL=menuItemHover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuItemHover.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/menuItemHover.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,EAC5B,UAAU,CAAC,EAAE,OAAO,GACnB,IAAI,CAQN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file menuItemHover.ts
|
|
7
|
+
* @output Exports focusMenuItemOnHover
|
|
8
|
+
* @position Shared helper for DropdownMenu/ContextMenu item components
|
|
9
|
+
*
|
|
10
|
+
* Menus keep a single highlighted item by using DOM focus as the sole
|
|
11
|
+
* highlight source. Mouse hover moves focus onto the pointed-at item so the
|
|
12
|
+
* one focus highlight follows the pointer — instead of a separate `:hover`
|
|
13
|
+
* background leaving the keyboard-focused item highlighted at the same time.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update the item components that use it:
|
|
16
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuItem.tsx
|
|
17
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.tsx
|
|
18
|
+
* - /packages/core/src/DropdownMenu/DropdownMenuRadioItem.tsx
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Move focus to a menu item as the pointer moves over it, so hover and
|
|
22
|
+
* keyboard navigation share a single focus-driven highlight. Only reacts to a
|
|
23
|
+
* real mouse (not touch/pen, which have no hover), and skips disabled items.
|
|
24
|
+
*/
|
|
25
|
+
export function focusMenuItemOnHover(e, isDisabled) {
|
|
26
|
+
if (isDisabled || e.pointerType !== 'mouse') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const el = e.currentTarget;
|
|
30
|
+
if (el !== el.ownerDocument.activeElement) {
|
|
31
|
+
el.focus();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -10,4 +10,12 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const MENU_ITEM_ROLES: ReadonlySet<string>;
|
|
12
12
|
export declare const MENU_ITEM_SELECTOR: string;
|
|
13
|
+
/**
|
|
14
|
+
* Boundary selector for a single menu level. A menu and its submenu flyouts
|
|
15
|
+
* both use `role="menu"`, and flyouts render inline (native popover, not a
|
|
16
|
+
* portal), so a nested menu's items and key events would otherwise be picked
|
|
17
|
+
* up by the parent. Pass this as `useListFocus`'s `boundarySelector` so each
|
|
18
|
+
* level scopes item collection and key handling to its own container.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MENU_BOUNDARY_SELECTOR = "[role=\"menu\"]";
|
|
13
21
|
//# sourceMappingURL=menuItemRoles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuItemRoles.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/menuItemRoles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAI9C,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,MAErB,CAAC"}
|
|
1
|
+
{"version":3,"file":"menuItemRoles.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/menuItemRoles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAI9C,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,MAErB,CAAC;AAEb;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,oBAAkB,CAAC"}
|
|
@@ -12,4 +12,13 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export const MENU_ITEM_ROLES = new Set(['menuitem', 'menuitemradio', 'menuitemcheckbox']);
|
|
15
|
-
export const MENU_ITEM_SELECTOR = [...MENU_ITEM_ROLES].map(role => `[role="${role}"]:not([aria-disabled="true"])`).join(',');
|
|
15
|
+
export const MENU_ITEM_SELECTOR = [...MENU_ITEM_ROLES].map(role => `[role="${role}"]:not([aria-disabled="true"])`).join(',');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Boundary selector for a single menu level. A menu and its submenu flyouts
|
|
19
|
+
* both use `role="menu"`, and flyouts render inline (native popover, not a
|
|
20
|
+
* portal), so a nested menu's items and key events would otherwise be picked
|
|
21
|
+
* up by the parent. Pass this as `useListFocus`'s `boundarySelector` so each
|
|
22
|
+
* level scopes item collection and key handling to its own container.
|
|
23
|
+
*/
|
|
24
|
+
export const MENU_BOUNDARY_SELECTOR = '[role="menu"]';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDropdownItems.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/renderDropdownItems.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"renderDropdownItems.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/renderDropdownItems.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AAyBxB;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,SAAS,CA6D1E"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import * as stylex from '@stylexjs/stylex';
|
|
10
10
|
import { Divider } from "../Divider/index.js";
|
|
11
11
|
import { DropdownMenuItem } from "./DropdownMenuItem.js";
|
|
12
|
+
import { DropdownMenuSubMenu } from "./DropdownMenuSubMenu.js";
|
|
12
13
|
import "../theme/tokens.stylex.js";
|
|
13
14
|
import { spacingVars, typographyVars, typeScaleVars, colorVars } from "../theme/tokens.stylex.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -55,12 +56,26 @@ export function renderDropdownItems(items) {
|
|
|
55
56
|
}, getItemKey(item)))]
|
|
56
57
|
}, getSectionKey(option, i)));
|
|
57
58
|
} else if (!('type' in option)) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
// A plain item that declares nested `items` becomes a submenu (data-mode
|
|
60
|
+
// parity with the compound DropdownMenuSubMenu API); otherwise it's a
|
|
61
|
+
// leaf. renderDropdownItems owns the recursion and hands the rendered
|
|
62
|
+
// children to DropdownMenuSubMenu — so DropdownMenuSubMenu never imports
|
|
63
|
+
// this module back (no import cycle).
|
|
64
|
+
if (option.items && option.items.length > 0) {
|
|
65
|
+
elements.push(/*#__PURE__*/_jsx(DropdownMenuSubMenu, {
|
|
66
|
+
icon: option.icon,
|
|
67
|
+
label: option.label,
|
|
68
|
+
isDisabled: option.isDisabled,
|
|
69
|
+
children: renderDropdownItems(option.items)
|
|
70
|
+
}, getItemKey(option)));
|
|
71
|
+
} else {
|
|
72
|
+
elements.push(/*#__PURE__*/_jsx(DropdownMenuItem, {
|
|
73
|
+
icon: option.icon,
|
|
74
|
+
label: option.label,
|
|
75
|
+
onClick: option.onClick,
|
|
76
|
+
isDisabled: option.isDisabled
|
|
77
|
+
}, getItemKey(option)));
|
|
78
|
+
}
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
return elements;
|
package/dist/Field/Field.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { type ReactNode } from 'react';
|
|
15
15
|
import type { BaseProps } from '../BaseProps';
|
|
16
16
|
import type { SizeValue } from '../utils/types';
|
|
17
|
+
import type { FieldStatusVariant } from '../FieldStatus/FieldStatus';
|
|
17
18
|
import type { IconType } from '../Icon';
|
|
18
19
|
export type { SizeValue } from '../utils/types';
|
|
19
20
|
export type FieldStatusType = 'warning' | 'error' | 'success';
|
|
@@ -105,9 +106,10 @@ export interface FieldProps extends Omit<BaseProps<HTMLDivElement>, 'children'>
|
|
|
105
106
|
* How the status message is rendered relative to the input.
|
|
106
107
|
* - 'attached': Status sits directly below the input (default, for bordered inputs)
|
|
107
108
|
* - 'detached': Status is a separate element below the field (for checkboxes, switches, sliders)
|
|
109
|
+
* - 'tooltip': No message box; the input surfaces status through a tooltip on its on-field icon
|
|
108
110
|
* @default 'attached'
|
|
109
111
|
*/
|
|
110
|
-
statusVariant?:
|
|
112
|
+
statusVariant?: FieldStatusVariant;
|
|
111
113
|
/**
|
|
112
114
|
* Width of the field. Numbers are treated as pixels, strings are used as-is
|
|
113
115
|
* (e.g. `'100%'`). Sizes the whole field — label, control, and status — so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAM,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAM,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAqCtC,YAAY,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,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EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,UAAU,+BAwGZ;yBA9He,KAAK"}
|
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,
|
|
@@ -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.
|
|
@@ -48,7 +49,9 @@ export interface FieldStatusProps extends BaseProps<HTMLDivElement> {
|
|
|
48
49
|
* decorative for assistive tech (`aria-hidden`): the message text already names
|
|
49
50
|
* the status in words and is announced through the live region. The `attached`
|
|
50
51
|
* variant keeps its status affordance on the bordered input, so it renders no
|
|
51
|
-
* icon here to avoid a duplicate.
|
|
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.
|
|
52
55
|
*
|
|
53
56
|
* Screen-reader announcements go through the persistent `useAnnounce` live
|
|
54
57
|
* regions (assertive for errors, polite otherwise) rather than `role`/
|
|
@@ -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"}
|
|
@@ -104,7 +104,9 @@ const colorStyles = {
|
|
|
104
104
|
* decorative for assistive tech (`aria-hidden`): the message text already names
|
|
105
105
|
* the status in words and is announced through the live region. The `attached`
|
|
106
106
|
* variant keeps its status affordance on the bordered input, so it renders no
|
|
107
|
-
* icon here to avoid a duplicate.
|
|
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.
|
|
108
110
|
*
|
|
109
111
|
* Screen-reader announcements go through the persistent `useAnnounce` live
|
|
110
112
|
* regions (assertive for errors, polite otherwise) rather than `role`/
|
|
@@ -164,7 +166,7 @@ export function FieldStatus({
|
|
|
164
166
|
},
|
|
165
167
|
children: [/*#__PURE__*/_jsx("span", {
|
|
166
168
|
...{
|
|
167
|
-
className: "
|
|
169
|
+
className: "x3nfvp2 x6s0dn4 x14o5nre x2lah0s"
|
|
168
170
|
},
|
|
169
171
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
170
172
|
icon: statusIconMap[type],
|
|
@@ -90,6 +90,7 @@ export interface FileInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
90
90
|
* How the status message is placed relative to the input.
|
|
91
91
|
* - 'attached': message overlaps directly below the input (bordered treatment)
|
|
92
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
|
|
93
94
|
* @default 'attached'
|
|
94
95
|
*/
|
|
95
96
|
statusVariant?: FieldStatusVariant;
|
|
@@ -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,MA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AE,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";
|
|
@@ -199,22 +202,24 @@ export function FileInput({
|
|
|
199
202
|
const id = useId();
|
|
200
203
|
const descriptionID = useId();
|
|
201
204
|
const statusMessageID = useId();
|
|
202
|
-
const
|
|
205
|
+
const requiredID = useId();
|
|
203
206
|
const inputRef = useRef(null);
|
|
207
|
+
const containerRef = useRef(null);
|
|
204
208
|
const [isDragOver, setIsDragOver] = useState(false);
|
|
205
209
|
const [validationError, setValidationError] = useState(null);
|
|
206
210
|
const [, startTransition] = useTransition();
|
|
207
211
|
|
|
208
212
|
// Announce successful file selection to screen readers via a persistent
|
|
209
|
-
// live region (forms-17).
|
|
210
|
-
//
|
|
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.
|
|
211
216
|
const announce = useAnnounce();
|
|
212
217
|
|
|
213
218
|
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
214
|
-
// tooltip listeners attach to the
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
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.
|
|
218
223
|
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
219
224
|
const disabledMessageTooltip = useTooltip({
|
|
220
225
|
placement: 'above',
|
|
@@ -225,17 +230,24 @@ export function FileInput({
|
|
|
225
230
|
type: 'error',
|
|
226
231
|
message: validationError
|
|
227
232
|
} : undefined);
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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;
|
|
239
251
|
const defaultPlaceholder = isMultiple ? 'Choose files' : 'Choose file';
|
|
240
252
|
const displayPlaceholder = placeholder ?? defaultPlaceholder;
|
|
241
253
|
const handleFiles = useCallback(fileList => {
|
|
@@ -259,8 +271,9 @@ export function FileInput({
|
|
|
259
271
|
onChange(result);
|
|
260
272
|
|
|
261
273
|
// Announce the successful selection politely. Validation errors are
|
|
262
|
-
//
|
|
263
|
-
// 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).
|
|
264
277
|
if (errors.length === 0) {
|
|
265
278
|
announce(valid.length === 1 ? `1 file selected: ${valid[0].name}` : `${valid.length} files selected`);
|
|
266
279
|
}
|
|
@@ -291,12 +304,28 @@ export function FileInput({
|
|
|
291
304
|
inputRef.current?.click();
|
|
292
305
|
}
|
|
293
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.
|
|
294
311
|
const handleKeyDown = useCallback(e => {
|
|
295
312
|
if ((e.key === 'Enter' || e.key === ' ') && !isDisabled) {
|
|
296
313
|
e.preventDefault();
|
|
297
314
|
inputRef.current?.click();
|
|
298
315
|
}
|
|
299
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
|
+
});
|
|
300
329
|
const handleDragEnter = useCallback(e => {
|
|
301
330
|
e.preventDefault();
|
|
302
331
|
e.stopPropagation();
|
|
@@ -397,11 +426,7 @@ export function FileInput({
|
|
|
397
426
|
}
|
|
398
427
|
}[!!hasFiles << 1 | !!hasFiles << 0],
|
|
399
428
|
children: fileNames ?? displayPlaceholder
|
|
400
|
-
}),
|
|
401
|
-
icon: statusIconMap[status.type],
|
|
402
|
-
size: "md",
|
|
403
|
-
color: statusIconColorMap[status.type]
|
|
404
|
-
})]
|
|
429
|
+
}), statusIcon]
|
|
405
430
|
});
|
|
406
431
|
};
|
|
407
432
|
const isDropzone = mode === 'dropzone';
|
|
@@ -430,43 +455,49 @@ export function FileInput({
|
|
|
430
455
|
width: width,
|
|
431
456
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
432
457
|
ref: el => {
|
|
433
|
-
|
|
434
|
-
//
|
|
435
|
-
//
|
|
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.
|
|
436
464
|
disabledMessageTooltip.ref(el);
|
|
437
465
|
},
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
// aria-disabled so the reason is focus-discoverable; opening the picker
|
|
441
|
-
// is still blocked by the isDisabled guards in the handlers.
|
|
442
|
-
,
|
|
443
|
-
tabIndex: isDisabled && !showsDisabledMessage ? -1 : 0,
|
|
444
|
-
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
445
|
-
onClick: handleClick,
|
|
446
|
-
onKeyDown: handleKeyDown
|
|
447
|
-
// aria-label suppresses child content from the accessible name, so
|
|
448
|
-
// compose the selected filenames into it — otherwise a screen-reader
|
|
449
|
-
// user refocusing the control hears only the field label and cannot
|
|
450
|
-
// tell what (if anything) is attached.
|
|
451
|
-
,
|
|
452
|
-
"aria-label": hasFiles && fileNames ? t('@astryx.fileInput.triggerWithFiles', {
|
|
453
|
-
label,
|
|
454
|
-
fileNames
|
|
455
|
-
}) : label,
|
|
456
|
-
"aria-busy": isLoading || undefined
|
|
457
|
-
// These describe the operable control, so they belong on the focusable
|
|
458
|
-
// role="button" wrapper — not the hidden tabIndex={-1} file input the
|
|
459
|
-
// user never focuses (forms-6).
|
|
460
|
-
,
|
|
461
|
-
"aria-describedby": ariaDescribedBy,
|
|
462
|
-
"aria-required": isRequired ? 'true' : undefined,
|
|
463
|
-
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
466
|
+
onClick: !isDisabled ? onContainerClick : undefined,
|
|
467
|
+
onMouseUp: !isDisabled ? onContainerMouseUp : undefined,
|
|
464
468
|
...dragDropProps,
|
|
465
469
|
...mergeProps(themeProps('file-input', {
|
|
466
470
|
mode,
|
|
467
471
|
status: status?.type ?? null
|
|
468
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),
|
|
469
|
-
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", {
|
|
470
501
|
...rest,
|
|
471
502
|
ref: mergeRefs(ref, inputRef),
|
|
472
503
|
id: id,
|
|
@@ -476,7 +507,7 @@ export function FileInput({
|
|
|
476
507
|
disabled: isDisabled,
|
|
477
508
|
onChange: handleInputChange
|
|
478
509
|
// The visually-hidden native input is never focused (tabIndex={-1});
|
|
479
|
-
// its describedby/required/invalid live on the
|
|
510
|
+
// its describedby/required/invalid live on the trigger button.
|
|
480
511
|
,
|
|
481
512
|
"aria-hidden": "true",
|
|
482
513
|
tabIndex: -1,
|
|
@@ -489,14 +520,9 @@ export function FileInput({
|
|
|
489
520
|
}),
|
|
490
521
|
onClick: handleClear
|
|
491
522
|
})]
|
|
492
|
-
}), /*#__PURE__*/_jsx(
|
|
493
|
-
id:
|
|
494
|
-
|
|
495
|
-
"aria-live": "polite",
|
|
496
|
-
...{
|
|
497
|
-
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
498
|
-
},
|
|
499
|
-
children: validationError
|
|
523
|
+
}), conveysRequired && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
524
|
+
id: requiredID,
|
|
525
|
+
children: t('@astryx.fileInput.required')
|
|
500
526
|
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
501
527
|
});
|
|
502
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;AA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AK,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,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