@astryxdesign/core 0.3.0 → 0.4.0-canary.3112e99
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 +156 -0
- package/dist/AlertDialog/AlertDialog.d.ts +10 -2
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +22 -3
- package/dist/AppShell/AppShell.d.ts +2 -2
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +40 -9
- package/dist/AspectRatio/AspectRatio.d.ts +13 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +9 -0
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +33 -20
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +2 -3
- package/dist/Banner/Banner.d.ts +3 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -17
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +21 -8
- package/dist/Breadcrumbs/index.d.ts +2 -1
- package/dist/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/Breadcrumbs/index.js +1 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +12 -16
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +2 -1
- package/dist/Calendar/styles.d.ts +0 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +0 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -12
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +2 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +4 -3
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +17 -17
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -6
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +36 -125
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -11
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +84 -67
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +35 -15
- package/dist/CommandPalette/CommandPaletteItem.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +6 -3
- package/dist/CommandPalette/CommandPaletteList.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +32 -31
- package/dist/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +1 -1
- package/dist/ContextMenu/index.d.ts +2 -1
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +1 -0
- package/dist/DateInput/DateInput.d.ts +9 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +47 -33
- package/dist/DateRangeInput/DateRangeInput.d.ts +9 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +55 -32
- package/dist/DateTimeInput/DateTimeInput.d.ts +9 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +54 -30
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +4 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts +33 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +62 -20
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +8 -11
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +32 -31
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts +25 -0
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuDivider.js +66 -0
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +15 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +20 -8
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +10 -3
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +5 -5
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +24 -67
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -8
- package/dist/DropdownMenu/index.d.ts +2 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +4 -0
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +35 -27
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +9 -5
- package/dist/Field/InputClearButton.d.ts +16 -3
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +15 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +21 -10
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -19
- package/dist/Indicator/CheckIndicator.d.ts +25 -0
- package/dist/Indicator/CheckIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckIndicator.js +155 -0
- package/dist/Indicator/CheckboxIndicator.d.ts +22 -0
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckboxIndicator.js +173 -0
- package/dist/Indicator/RadioIndicator.d.ts +23 -0
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -0
- package/dist/Indicator/RadioIndicator.js +137 -0
- package/dist/Indicator/index.d.ts +24 -0
- package/dist/Indicator/index.d.ts.map +1 -0
- package/dist/Indicator/index.js +26 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts +16 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts.map +1 -0
- package/dist/Indicator/indicator.markers.stylex.js +21 -0
- package/dist/Indicator/indicatorRegistry.d.ts +71 -0
- package/dist/Indicator/indicatorRegistry.d.ts.map +1 -0
- package/dist/Indicator/indicatorRegistry.js +93 -0
- package/dist/Indicator/types.d.ts +177 -0
- package/dist/Indicator/types.d.ts.map +1 -0
- package/dist/Indicator/types.js +1 -0
- package/dist/Indicator/useIndicator.d.ts +18 -0
- package/dist/Indicator/useIndicator.d.ts.map +1 -0
- package/dist/Indicator/useIndicator.js +30 -0
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -8
- package/dist/Layer/useLayer.d.ts +14 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +25 -2
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +80 -103
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -5
- package/dist/MobileNav/MobileNav.js +8 -8
- package/dist/MoreMenu/MoreMenu.d.ts +14 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -0
- package/dist/MultiSelector/MultiSelector.d.ts +8 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +119 -95
- package/dist/NumberInput/NumberInput.d.ts +27 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +230 -42
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +2 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +61 -63
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +6 -8
- package/dist/Popover/usePopover.d.ts +15 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +14 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +7 -0
- package/dist/ProgressBar/ProgressBar.d.ts +11 -4
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +95 -6
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +29 -84
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +2 -3
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -11
- package/dist/Selector/Selector.d.ts +12 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +222 -111
- package/dist/Selector/hooks.d.ts +18 -6
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +57 -40
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +29 -14
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +56 -20
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +28 -22
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -6
- package/dist/Stack/stack.stylex.d.ts +3 -3
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +14 -13
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -3
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +41 -19
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -0
- package/dist/Table/TableRow.d.ts +1 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +4 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +22 -18
- package/dist/Table/plugins/rowExpansion/index.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/index.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/index.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +41 -76
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +94 -345
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -4
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +29 -33
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +2 -1
- package/dist/Table/types.d.ts +11 -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 +16 -6
- package/dist/TextInput/TextInput.d.ts +10 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +13 -19
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +32 -26
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +14 -17
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +16 -34
- package/dist/Timestamp/formatInstant.d.ts +11 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +20 -11
- 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 +3 -19
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +6 -5
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +54 -16
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -9
- package/dist/TopNav/TopNavMegaMenu.d.ts +7 -0
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +146 -60
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +22 -3
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +83 -38
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +13 -0
- package/dist/TreeList/TreeListBranches.d.ts +1 -1
- package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
- package/dist/TreeList/TreeListBranches.js +14 -4
- package/dist/TreeList/TreeListItem.d.ts +11 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +57 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +16 -8
- package/dist/astryx.css +84 -96
- package/dist/astryx.umd.js +56 -56
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/containerReveal.stylex.d.ts +61 -0
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -0
- package/dist/hooks/containerReveal.stylex.js +63 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useClipboard.d.ts +59 -0
- package/dist/hooks/useClipboard.d.ts.map +1 -0
- package/dist/hooks/useClipboard.js +106 -0
- package/dist/hooks/useContainerReveal.d.ts +14 -8
- package/dist/hooks/useContainerReveal.d.ts.map +1 -1
- package/dist/hooks/useContainerReveal.js +28 -69
- package/dist/hooks/useIndicatorFocusRing.d.ts +28 -0
- package/dist/hooks/useIndicatorFocusRing.d.ts.map +1 -0
- package/dist/hooks/useIndicatorFocusRing.js +96 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +17 -4
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +12 -2
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +33 -18
- package/dist/hooks/useStreamingText.d.ts +18 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +47 -7
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +9 -3
- package/dist/hooks/useTypeahead.d.ts +3 -2
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +19 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/defineTheme.d.ts +18 -2
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +10 -1
- package/dist/theme/derivedVarRegistry.d.ts +8 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +14 -13
- package/dist/theme/expandColorScale.d.ts +3 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +17 -7
- package/dist/theme/expandTypeScale.d.ts.map +1 -1
- package/dist/theme/expandTypeScale.js +17 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +11 -0
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +23 -0
- package/dist/utils/focusOutline.stylex.d.ts +122 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -0
- package/dist/utils/focusOutline.stylex.js +143 -0
- package/dist/utils/focusReturn.d.ts +24 -0
- package/dist/utils/focusReturn.d.ts.map +1 -0
- package/dist/utils/focusReturn.js +29 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -1
- package/dist/utils/mergeRefs.d.ts.map +1 -1
- package/dist/utils/mergeRefs.js +7 -5
- package/dist/utils/rtlStyles.d.ts +2 -2
- package/dist/utils/rtlStyles.js +2 -2
- package/dist/utils/themeProps.d.ts +20 -1
- package/dist/utils/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +8 -2
- package/locales/en.json +52 -0
- package/locales/pseudo.json +39 -0
- package/package.json +8 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +16 -3
- package/src/AlertDialog/AlertDialog.test.tsx +208 -1
- package/src/AlertDialog/AlertDialog.tsx +21 -3
- package/src/AppShell/AppShell.doc.mjs +11 -0
- package/src/AppShell/AppShell.test.tsx +139 -0
- package/src/AppShell/AppShell.tsx +32 -22
- package/src/AspectRatio/AspectRatio.doc.mjs +27 -3
- package/src/AspectRatio/AspectRatio.test.tsx +30 -0
- package/src/AspectRatio/AspectRatio.tsx +13 -0
- package/src/Avatar/Avatar.doc.mjs +2 -13
- package/src/Avatar/Avatar.test.tsx +33 -8
- package/src/Avatar/Avatar.tsx +52 -50
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +2 -9
- package/src/Banner/Banner.test.tsx +58 -1
- package/src/Banner/Banner.tsx +33 -11
- package/src/Breadcrumbs/BreadcrumbItem.tsx +16 -6
- package/src/Breadcrumbs/index.ts +5 -1
- package/src/Button/Button.doc.mjs +2 -2
- package/src/Button/Button.tsx +22 -41
- package/src/Calendar/Calendar.tsx +2 -1
- package/src/Calendar/styles.ts +0 -8
- package/src/Carousel/Carousel.doc.mjs +3 -0
- package/src/Carousel/Carousel.tsx +10 -6
- package/src/Chat/Chat.doc.mjs +2 -0
- package/src/Chat/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatLayoutScrollButton.test.tsx +22 -0
- package/src/Chat/ChatLayoutScrollButton.tsx +8 -1
- package/src/Chat/ChatSendButton.tsx +2 -3
- package/src/Chat/ChatToolCalls.test.tsx +35 -0
- package/src/Chat/ChatToolCalls.tsx +36 -16
- package/src/Chat/useTriggerMenu.tsx +2 -5
- package/src/CheckboxInput/CheckboxInput.doc.mjs +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +120 -0
- package/src/CheckboxInput/CheckboxInput.tsx +45 -202
- package/src/ClickableCard/ClickableCard.tsx +6 -11
- package/src/CodeBlock/CodeBlock.doc.mjs +3 -0
- package/src/CodeBlock/CodeBlock.test.tsx +91 -0
- package/src/CodeBlock/CodeBlock.tsx +57 -80
- package/src/Collapsible/Collapsible.tsx +22 -18
- package/src/CommandPalette/CommandPalette.test.tsx +29 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +7 -4
- package/src/CommandPalette/CommandPaletteList.tsx +2 -2
- package/src/ComplexSelector/ComplexSelector.doc.mjs +42 -0
- package/src/ComplexSelector/ComplexSelector.test.tsx +73 -0
- package/src/ComplexSelector/ComplexSelector.tsx +41 -28
- package/src/ContextMenu/ContextMenu.doc.mjs +1 -1
- package/src/ContextMenu/ContextMenu.test.tsx +41 -0
- package/src/ContextMenu/ContextMenu.tsx +3 -3
- package/src/ContextMenu/index.ts +5 -1
- package/src/DateInput/DateInput.doc.mjs +18 -3
- package/src/DateInput/DateInput.test.tsx +112 -11
- package/src/DateInput/DateInput.tsx +44 -25
- package/src/DateRangeInput/DateRangeInput.doc.mjs +10 -2
- package/src/DateRangeInput/DateRangeInput.test.tsx +110 -14
- package/src/DateRangeInput/DateRangeInput.tsx +27 -21
- package/src/DateTimeInput/DateTimeInput.doc.mjs +16 -2
- package/src/DateTimeInput/DateTimeInput.test.tsx +154 -1
- package/src/DateTimeInput/DateTimeInput.tsx +58 -17
- package/src/Dialog/Dialog.tsx +2 -9
- package/src/DropdownMenu/DropdownMenu.doc.mjs +5 -9
- package/src/DropdownMenu/DropdownMenu.test.tsx +534 -4
- package/src/DropdownMenu/DropdownMenu.tsx +113 -52
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +27 -30
- package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +34 -0
- package/src/DropdownMenu/DropdownMenuDivider.tsx +81 -0
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +39 -4
- package/src/DropdownMenu/DropdownMenuItem.tsx +48 -10
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +2 -1
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +30 -76
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +25 -19
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +44 -14
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +1 -5
- package/src/DropdownMenu/index.ts +8 -1
- package/src/DropdownMenu/renderDropdownItems.tsx +33 -34
- package/src/EmptyState/EmptyState.doc.mjs +4 -0
- package/src/EmptyState/EmptyState.test.tsx +62 -0
- package/src/EmptyState/EmptyState.tsx +16 -6
- package/src/Field/Field.doc.mjs +1 -0
- package/src/Field/InputClearButton.test.tsx +117 -0
- package/src/Field/InputClearButton.tsx +30 -3
- package/src/FileInput/FileInput.tsx +21 -8
- package/src/HoverCard/useHoverCard.tsx +2 -23
- package/src/Icon/Icon.doc.mjs +2 -1
- package/src/Indicator/CheckIndicator.tsx +174 -0
- package/src/Indicator/CheckboxIndicator.tsx +257 -0
- package/src/Indicator/Indicator.doc.mjs +344 -0
- package/src/Indicator/Indicator.test.tsx +393 -0
- package/src/Indicator/RadioIndicator.tsx +206 -0
- package/src/Indicator/index.ts +46 -0
- package/src/Indicator/indicator.markers.stylex.ts +19 -0
- package/src/Indicator/indicatorRegistry.test.tsx +106 -0
- package/src/Indicator/indicatorRegistry.ts +120 -0
- package/src/Indicator/types.ts +197 -0
- package/src/Indicator/useIndicator.ts +39 -0
- package/src/Item/Item.doc.mjs +1 -1
- package/src/Item/Item.tsx +7 -14
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +85 -0
- package/src/Layer/useLayer.tsx +39 -1
- package/src/Lightbox/Lightbox.doc.mjs +1 -1
- package/src/Lightbox/Lightbox.tsx +45 -49
- package/src/Link/Link.tsx +4 -11
- package/src/MobileNav/MobileNav.tsx +3 -3
- package/src/MoreMenu/MoreMenu.doc.mjs +31 -0
- package/src/MoreMenu/MoreMenu.test.tsx +68 -1
- package/src/MoreMenu/MoreMenu.tsx +19 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +16 -1
- package/src/MultiSelector/MultiSelector.test.tsx +259 -16
- package/src/MultiSelector/MultiSelector.tsx +144 -121
- package/src/NumberInput/NumberInput.doc.mjs +265 -50
- package/src/NumberInput/NumberInput.test.tsx +726 -21
- package/src/NumberInput/NumberInput.tsx +353 -59
- package/src/Outline/Outline.tsx +2 -5
- package/src/Pagination/Pagination.doc.mjs +1 -1
- package/src/Pagination/Pagination.test.tsx +22 -7
- package/src/Pagination/Pagination.tsx +38 -35
- package/src/Popover/Popover.doc.mjs +2 -0
- package/src/Popover/Popover.tsx +6 -7
- package/src/Popover/usePopover.tsx +37 -4
- package/src/PowerSearch/PowerSearch.tsx +1 -1
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +42 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +7 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +27 -5
- package/src/ProgressBar/ProgressBar.test.tsx +224 -1
- package/src/ProgressBar/ProgressBar.tsx +126 -30
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioListItem.tsx +31 -130
- package/src/Resizable/ResizeHandle.tsx +2 -9
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -9
- package/src/SelectableCard/SelectableCard.tsx +4 -9
- package/src/Selector/Selector.doc.mjs +15 -4
- package/src/Selector/Selector.test.tsx +1234 -98
- package/src/Selector/Selector.tsx +254 -126
- package/src/Selector/hooks.ts +77 -50
- package/src/SideNav/SideNav.test.tsx +46 -0
- package/src/SideNav/SideNav.tsx +1 -0
- package/src/SideNav/SideNavCollapseButton.tsx +15 -10
- package/src/SideNav/SideNavHeading.tsx +48 -10
- package/src/SideNav/SideNavItem.tsx +20 -12
- package/src/Slider/Slider.tsx +2 -11
- package/src/Stack/Stack.doc.mjs +110 -0
- package/src/StatusDot/StatusDot.doc.mjs +12 -3
- package/src/Switch/Switch.test.tsx +32 -0
- package/src/Switch/Switch.tsx +18 -10
- package/src/TabList/Tab.tsx +2 -9
- package/src/TabList/TabMenu.tsx +14 -21
- package/src/Table/BaseTable.tsx +11 -0
- package/src/Table/Table.test.tsx +31 -0
- package/src/Table/TableRow.tsx +6 -0
- package/src/Table/index.ts +1 -4
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +30 -14
- package/src/Table/plugins/rowExpansion/index.ts +1 -4
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +125 -175
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +115 -458
- package/src/Table/plugins/sortable/useTableSortable.tsx +2 -6
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -24
- package/src/Table/tableContextMenu.test.tsx +27 -0
- package/src/Table/tableContextMenu.tsx +1 -0
- package/src/Table/types.ts +11 -0
- package/src/Table/useTableGroupedRows.doc.mjs +1 -1
- package/src/Table/useTableRowExpansion.doc.mjs +43 -66
- package/src/TextArea/TextArea.doc.mjs +42 -2
- package/src/TextArea/TextArea.test.tsx +219 -0
- package/src/TextArea/TextArea.tsx +34 -7
- package/src/TextInput/TextInput.doc.mjs +18 -2
- package/src/TextInput/TextInput.test.tsx +189 -0
- package/src/TextInput/TextInput.tsx +25 -31
- package/src/Thumbnail/Thumbnail.tsx +2 -9
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.test.tsx +84 -3
- package/src/TimeInput/TimeInput.tsx +26 -28
- package/src/Timestamp/Timestamp.doc.mjs +4 -3
- package/src/Timestamp/Timestamp.test.tsx +91 -14
- package/src/Timestamp/Timestamp.tsx +14 -2
- package/src/Timestamp/TimestampHoverCard.tsx +13 -35
- package/src/Timestamp/formatInstant.ts +16 -1
- package/src/Token/Token.tsx +5 -28
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +45 -3
- package/src/Tokenizer/Tokenizer.tsx +10 -2
- package/src/Tooltip/useTooltip.tsx +2 -23
- package/src/TopNav/TopNav.tsx +1 -3
- package/src/TopNav/TopNavHeading.tsx +42 -13
- package/src/TopNav/TopNavItem.tsx +3 -21
- package/src/TopNav/TopNavMegaMenu.doc.mjs +5 -0
- package/src/TopNav/TopNavMegaMenu.test.tsx +433 -33
- package/src/TopNav/TopNavMegaMenu.tsx +118 -53
- package/src/TopNav/TopNavMegaMenuItem.tsx +2 -9
- package/src/TopNav/TopNavMenu.tsx +34 -37
- package/src/TreeList/TreeList.doc.mjs +5 -0
- package/src/TreeList/TreeList.test.tsx +208 -8
- package/src/TreeList/TreeList.tsx +22 -0
- package/src/TreeList/TreeListBranches.tsx +25 -2
- package/src/TreeList/TreeListItem.tsx +89 -52
- package/src/Typeahead/BaseTypeahead.tsx +19 -6
- package/src/Typeahead/Typeahead.doc.mjs +1 -0
- package/src/Typeahead/Typeahead.test.tsx +76 -3
- package/src/hooks/containerReveal.stylex.ts +102 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useClipboard.doc.mjs +87 -0
- package/src/hooks/useClipboard.test.tsx +151 -0
- package/src/hooks/useClipboard.ts +135 -0
- package/src/hooks/useContainerReveal.doc.mjs +7 -7
- package/src/hooks/useContainerReveal.test.tsx +42 -62
- package/src/hooks/useContainerReveal.ts +36 -91
- package/src/hooks/useImageMode.test.ts +1 -1
- package/src/hooks/useIndicatorFocusRing.tsx +120 -0
- package/src/hooks/useInputStatusIcon.tsx +8 -8
- package/src/hooks/useLongPress.test.tsx +18 -0
- package/src/hooks/useLongPress.ts +12 -2
- package/src/hooks/useScrollLock.test.ts +72 -0
- package/src/hooks/useScrollLock.ts +51 -19
- package/src/hooks/useStreamingText.test.ts +46 -1
- package/src/hooks/useStreamingText.ts +49 -7
- package/src/hooks/useTreeFocus.test.tsx +50 -0
- package/src/hooks/useTreeFocus.ts +14 -3
- package/src/hooks/useTypeahead.test.tsx +150 -0
- package/src/hooks/useTypeahead.ts +24 -9
- package/src/i18n/InternationalizationProvider.doc.mjs +7 -2
- package/src/index.ts +1 -0
- package/src/theme/defineTheme.ts +27 -0
- package/src/theme/derivedVarRegistry.test.ts +21 -1
- package/src/theme/derivedVarRegistry.ts +19 -6
- package/src/theme/expandColorScale.test.ts +14 -0
- package/src/theme/expandColorScale.ts +24 -9
- package/src/theme/expandTypeScale.test.ts +43 -0
- package/src/theme/expandTypeScale.ts +17 -0
- package/src/theme/generateThemeRules.test.ts +78 -20
- package/src/theme/generateThemeRules.ts +11 -0
- package/src/theme/index.ts +15 -0
- package/src/theme/tokens.stylex.ts +18 -0
- package/src/theme/tokens.test.ts +37 -0
- package/src/utils/focusOutline.stylex.ts +177 -0
- package/src/utils/focusReturn.test.ts +42 -0
- package/src/utils/focusReturn.ts +31 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/mergeRefs.test.ts +48 -0
- package/src/utils/mergeRefs.ts +12 -6
- package/src/utils/rtlStyles.ts +2 -2
- package/src/utils/themeProps.ts +26 -4
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts +0 -9
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts.map +0 -1
- package/dist/CheckboxInput/checkbox.markers.stylex.js +0 -14
- package/dist/RadioList/radio.markers.stylex.d.ts +0 -7
- package/dist/RadioList/radio.markers.stylex.d.ts.map +0 -1
- package/dist/RadioList/radio.markers.stylex.js +0 -12
- package/dist/hooks/containerReveal.pool.stylex.d.ts +0 -303
- package/dist/hooks/containerReveal.pool.stylex.d.ts.map +0 -1
- package/dist/hooks/containerReveal.pool.stylex.js +0 -292
- package/src/CheckboxInput/checkbox.markers.stylex.ts +0 -12
- package/src/RadioList/radio.markers.stylex.ts +0 -10
- package/src/hooks/containerReveal.pool.stylex.ts +0 -571
|
@@ -35,6 +35,7 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
|
35
35
|
import { Card } from "../Card/Card.js";
|
|
36
36
|
import { useClickableContainer } from "../hooks/useClickableContainer.js";
|
|
37
37
|
import { themeProps } from "../utils/themeProps.js";
|
|
38
|
+
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
38
39
|
|
|
39
40
|
// =============================================================================
|
|
40
41
|
// Styles — selection + interaction; Card handles the rest
|
|
@@ -47,12 +48,6 @@ const styles = {
|
|
|
47
48
|
k1ekBW: "x16mfhj0",
|
|
48
49
|
kIyJzY: "xuedmi6",
|
|
49
50
|
kAMwcw: "xlr8y92",
|
|
50
|
-
kInvED: "x1hl8ikr",
|
|
51
|
-
$$css: true
|
|
52
|
-
},
|
|
53
|
-
focusWithin: {
|
|
54
|
-
kRYL1X: "x1irc7jg",
|
|
55
|
-
koJ47v: "xdjuwb3",
|
|
56
51
|
$$css: true
|
|
57
52
|
},
|
|
58
53
|
overlay: {
|
|
@@ -261,11 +256,8 @@ export function SelectableCard({
|
|
|
261
256
|
...mergeProps(themeProps('selectable-card', {
|
|
262
257
|
variant,
|
|
263
258
|
selected: isSelected ? 'true' : 'false'
|
|
264
|
-
}),
|
|
265
|
-
|
|
266
|
-
style
|
|
267
|
-
}),
|
|
268
|
-
xstyle: [styles.interactive, styles.focusWithin, isSelected && selectedStyleForVariant(variant), !isDisabled && styles.overlay, !isDisabled && styles.hoverOnPointer, isDisabled && styles.disabled, xstyleProp],
|
|
259
|
+
}), focusOutlineProps.focusWithin(), classNameProp, style),
|
|
260
|
+
xstyle: [styles.interactive, isSelected && selectedStyleForVariant(variant), !isDisabled && styles.overlay, !isDisabled && styles.hoverOnPointer, isDisabled && styles.disabled, xstyleProp],
|
|
269
261
|
onClick: !isDisabled ? composedOnClick : undefined,
|
|
270
262
|
onMouseUp: !isDisabled ? composedOnMouseUp : undefined,
|
|
271
263
|
...props,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Selector.tsx
|
|
3
|
-
* @input Uses React, StyleX, usePopover, useTooltip, Icon, InputGroupContext
|
|
3
|
+
* @input Uses React, StyleX, usePopover, useTooltip, Icon, InputGroupContext,
|
|
4
|
+
* and Selector positioning hooks
|
|
4
5
|
* @output Exports Selector component
|
|
5
6
|
* @position Core implementation; consumed by index.ts
|
|
6
7
|
*
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
*/
|
|
14
15
|
import React, { type ReactNode } from 'react';
|
|
15
16
|
import { type IconType } from '../Icon';
|
|
17
|
+
import type { IndicatorPosition } from '../Indicator';
|
|
16
18
|
import { type FieldStatusVariant } from '../Field';
|
|
17
19
|
import type { LayerPlacement } from '../Layer/useLayer';
|
|
18
20
|
import type { SelectorOptionType, SelectorOptionData } from './types';
|
|
@@ -143,6 +145,15 @@ interface SelectorPropsBase<T extends SelectorOptionType = SelectorOptionType> e
|
|
|
143
145
|
* Only called for selectable options (not dividers/sections).
|
|
144
146
|
*/
|
|
145
147
|
renderOption?: (option: SelectorOptionData) => ReactNode;
|
|
148
|
+
/**
|
|
149
|
+
* Which edge of the option row carries the selected mark. `start` reserves a
|
|
150
|
+
* mark column ahead of every label so they stay aligned, the way a native
|
|
151
|
+
* menu does; `end` is the house convention shared with Typeahead and
|
|
152
|
+
* CommandPalette.
|
|
153
|
+
*
|
|
154
|
+
* @default 'end'
|
|
155
|
+
*/
|
|
156
|
+
indicatorPosition?: IndicatorPosition;
|
|
146
157
|
/**
|
|
147
158
|
* Whether to show a search input for filtering options.
|
|
148
159
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"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"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Selector.tsx
|
|
7
|
-
* @input Uses React, StyleX, usePopover, useTooltip, Icon, InputGroupContext
|
|
7
|
+
* @input Uses React, StyleX, usePopover, useTooltip, Icon, InputGroupContext,
|
|
8
|
+
* and Selector positioning hooks
|
|
8
9
|
* @output Exports Selector component
|
|
9
10
|
* @position Core implementation; consumed by index.ts
|
|
10
11
|
*
|
|
@@ -20,7 +21,8 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
20
21
|
import { usePopover } from "../Popover/usePopover.js";
|
|
21
22
|
import { useTooltip } from "../Tooltip/index.js";
|
|
22
23
|
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
23
|
-
import {
|
|
24
|
+
import { useIndicator } from "../Indicator/index.js";
|
|
25
|
+
import { Field, InputClearButton, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputWrapperStyles } from "../Field/index.js";
|
|
24
26
|
import { Divider } from "../Divider/index.js";
|
|
25
27
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
26
28
|
import { Spinner } from "../Spinner/index.js";
|
|
@@ -30,15 +32,18 @@ import "../theme/tokens.stylex.js";
|
|
|
30
32
|
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
31
33
|
import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptions } from "./utils.js";
|
|
32
34
|
import { useCombobox, useSelectedItemOffset } from "./hooks.js";
|
|
35
|
+
import { useTypeahead } from "../hooks/useTypeahead.js";
|
|
33
36
|
import { SelectorOption } from "./SelectorOption.js";
|
|
34
37
|
import { getInputARIA, mergeProps } from "../utils/index.js";
|
|
35
38
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
36
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
41
|
+
import { stableClassName } from "../naming.js";
|
|
37
42
|
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
38
43
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
39
44
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
40
45
|
import { useTranslator } from "../i18n/index.js";
|
|
41
|
-
import { jsx as _jsx,
|
|
46
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
42
47
|
const styles = {
|
|
43
48
|
triggerContainer: {
|
|
44
49
|
kVAEAm: "x1n2onr6",
|
|
@@ -60,6 +65,21 @@ const styles = {
|
|
|
60
65
|
kMwMTN: "xv1l7n4",
|
|
61
66
|
$$css: true
|
|
62
67
|
},
|
|
68
|
+
triggerIcon: {
|
|
69
|
+
kmuXW: "x2lah0s",
|
|
70
|
+
$$css: true
|
|
71
|
+
},
|
|
72
|
+
triggerIconRotation: {
|
|
73
|
+
k1ekBW: "x11xpdln",
|
|
74
|
+
kIyJzY: "xuedmi6",
|
|
75
|
+
kAMwcw: "xlr8y92",
|
|
76
|
+
k3nNDw: "x1g0ag68",
|
|
77
|
+
$$css: true
|
|
78
|
+
},
|
|
79
|
+
triggerIconOpen: {
|
|
80
|
+
k3aq6I: "x19jd1h0",
|
|
81
|
+
$$css: true
|
|
82
|
+
},
|
|
63
83
|
triggerGhost: {
|
|
64
84
|
kzqmXN: "x14atkfc",
|
|
65
85
|
kMzoRj: "xc342km",
|
|
@@ -67,8 +87,6 @@ const styles = {
|
|
|
67
87
|
kKwaWg: "x1ilzqfv xq8i9tn",
|
|
68
88
|
kGVxlE: "x1gnnqk1 x1irk71m x15ysqaf",
|
|
69
89
|
k63SB2: "x1e4wzip",
|
|
70
|
-
kI3sdo: "x1a2a7pz x1irc7jg",
|
|
71
|
-
kInvED: "x1wfwxd8 xscfbxq",
|
|
72
90
|
k1ekBW: "xrafxwg",
|
|
73
91
|
k3aq6I: "x3oybdh xk4oym4",
|
|
74
92
|
$$css: true
|
|
@@ -78,6 +96,20 @@ const styles = {
|
|
|
78
96
|
k3aq6I: "x1c071of x1pdlv7q",
|
|
79
97
|
$$css: true
|
|
80
98
|
},
|
|
99
|
+
statusButton: {
|
|
100
|
+
k1xSpc: "x78zum5",
|
|
101
|
+
kGNEyG: "x6s0dn4",
|
|
102
|
+
kjj79g: "xl56j7k",
|
|
103
|
+
kmVPX3: "x1717udv",
|
|
104
|
+
kogj98: "x1ghz6dp",
|
|
105
|
+
kMzoRj: "xc342km",
|
|
106
|
+
ksu8eU: "xng3xce",
|
|
107
|
+
kWkggS: "xjbqb8w",
|
|
108
|
+
kMwMTN: "x1heor9g",
|
|
109
|
+
kkrTdU: "x1ypdohk",
|
|
110
|
+
kaIpWk: "xh6dtrn",
|
|
111
|
+
$$css: true
|
|
112
|
+
},
|
|
81
113
|
popover: {
|
|
82
114
|
k7Eaqz: "xrzjruh",
|
|
83
115
|
$$css: true
|
|
@@ -249,6 +281,7 @@ export function Selector(props) {
|
|
|
249
281
|
startIcon,
|
|
250
282
|
htmlName,
|
|
251
283
|
renderOption,
|
|
284
|
+
indicatorPosition = 'end',
|
|
252
285
|
hasSearch = false,
|
|
253
286
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
254
287
|
placement,
|
|
@@ -275,6 +308,9 @@ export function Selector(props) {
|
|
|
275
308
|
const statusMessageId = useId();
|
|
276
309
|
const inputLabelId = useId();
|
|
277
310
|
const searchId = useId();
|
|
311
|
+
// Measure from the same outer control that usePopover anchors to; using the
|
|
312
|
+
// shorter inner button makes every size's selected row land too low.
|
|
313
|
+
const anchorRef = useRef(null);
|
|
278
314
|
const triggerRef = useRef(null);
|
|
279
315
|
const searchRef = useRef(null);
|
|
280
316
|
const inputGroup = useInputGroup();
|
|
@@ -285,6 +321,7 @@ export function Selector(props) {
|
|
|
285
321
|
const [, startTransition] = useTransition();
|
|
286
322
|
const [optimisticValue, setOptimisticValue] = useOptimistic(normalizedValue);
|
|
287
323
|
const isBusy = isLoading || optimisticValue !== normalizedValue;
|
|
324
|
+
const announce = useAnnounce();
|
|
288
325
|
|
|
289
326
|
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
290
327
|
// tooltip listeners attach to the trigger container (which already exists)
|
|
@@ -325,15 +362,15 @@ export function Selector(props) {
|
|
|
325
362
|
// Ref for listbox to measure selected item position
|
|
326
363
|
const listboxRef = useRef(null);
|
|
327
364
|
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
|
|
332
|
-
const announce = useAnnounce();
|
|
365
|
+
// Typeahead is defined below (it needs the popover), but closing and clearing
|
|
366
|
+
// must drop its pending buffer — otherwise a stale prefix survives the reset
|
|
367
|
+
// window and poisons the next keystroke ("Dog" then "c" would search "dc").
|
|
368
|
+
const resetTypeaheadRef = useRef(() => {});
|
|
333
369
|
|
|
334
370
|
// Layer for dropdown positioning
|
|
335
371
|
const handleLayerHide = useCallback(() => {
|
|
336
372
|
setSearchQuery('');
|
|
373
|
+
resetTypeaheadRef.current();
|
|
337
374
|
// Clear any lingering result count when the popover closes so stale status
|
|
338
375
|
// text does not linger in the a11y tree.
|
|
339
376
|
announce('');
|
|
@@ -346,7 +383,10 @@ export function Selector(props) {
|
|
|
346
383
|
hasAutoFocus: false,
|
|
347
384
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
348
385
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
349
|
-
role: 'none'
|
|
386
|
+
role: 'none',
|
|
387
|
+
// The theme target belongs on the SURFACE that paints the popup, which
|
|
388
|
+
// `usePopover` owns — not on the scrolling list inside it.
|
|
389
|
+
surfaceTarget: 'selector-popup'
|
|
350
390
|
});
|
|
351
391
|
|
|
352
392
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -384,7 +424,7 @@ export function Selector(props) {
|
|
|
384
424
|
selectedItemIndex,
|
|
385
425
|
listboxId,
|
|
386
426
|
listboxRef,
|
|
387
|
-
|
|
427
|
+
anchorRef
|
|
388
428
|
});
|
|
389
429
|
const selectedItemOffset = shouldOverlaySelectedItem ? rawOffset : 0;
|
|
390
430
|
const isPositioned = shouldOverlaySelectedItem ? rawIsPositioned : true;
|
|
@@ -396,6 +436,7 @@ export function Selector(props) {
|
|
|
396
436
|
// Clear the current value. Shared by the clear button and the keyboard
|
|
397
437
|
// Delete/Backspace path so clearing is reachable without a mouse.
|
|
398
438
|
const clearValue = useCallback(() => {
|
|
439
|
+
resetTypeaheadRef.current();
|
|
399
440
|
onChange?.(null);
|
|
400
441
|
if (changeAction) {
|
|
401
442
|
startTransition(async () => {
|
|
@@ -405,10 +446,25 @@ export function Selector(props) {
|
|
|
405
446
|
}
|
|
406
447
|
}, [onChange, changeAction, startTransition, setOptimisticValue]);
|
|
407
448
|
|
|
408
|
-
//
|
|
449
|
+
// Type-to-find appends to the query rather than replacing it: characters
|
|
450
|
+
// typed before focus reaches the search input must not be dropped.
|
|
451
|
+
const appendSearchQuery = useCallback(char => {
|
|
452
|
+
setSearchQuery(query => query + char);
|
|
453
|
+
}, []);
|
|
454
|
+
const commitValue = useCallback(newValue => {
|
|
455
|
+
onChange?.(newValue);
|
|
456
|
+
if (changeAction) {
|
|
457
|
+
startTransition(async () => {
|
|
458
|
+
setOptimisticValue(newValue);
|
|
459
|
+
await changeAction(newValue);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}, [onChange, changeAction, startTransition, setOptimisticValue]);
|
|
463
|
+
|
|
464
|
+
// Selector behavior (keyboard nav, selection)
|
|
409
465
|
const {
|
|
410
466
|
highlightedIndex,
|
|
411
|
-
setHighlightedIndex
|
|
467
|
+
setHighlightedIndex,
|
|
412
468
|
getItemId,
|
|
413
469
|
onTriggerClick,
|
|
414
470
|
onKeyDown,
|
|
@@ -416,7 +472,11 @@ export function Selector(props) {
|
|
|
416
472
|
onItemMouseEnter
|
|
417
473
|
} = useCombobox({
|
|
418
474
|
selectableItems: filteredItems,
|
|
419
|
-
value:
|
|
475
|
+
// The optimistic value, not the raw prop: with a pending changeAction the
|
|
476
|
+
// prop still holds the old selection, so the popup would open with the
|
|
477
|
+
// highlight on it and Delete/Backspace could clear a value the action has
|
|
478
|
+
// already replaced.
|
|
479
|
+
value: optimisticValue,
|
|
420
480
|
isDisabled,
|
|
421
481
|
isOpen: popover.isOpen,
|
|
422
482
|
hasSearch,
|
|
@@ -424,24 +484,56 @@ export function Selector(props) {
|
|
|
424
484
|
popover.show();
|
|
425
485
|
if (hasSearch) {
|
|
426
486
|
requestAnimationFrame(() => {
|
|
427
|
-
searchRef.current
|
|
487
|
+
const input = searchRef.current;
|
|
488
|
+
if (input) {
|
|
489
|
+
input.focus();
|
|
490
|
+
// When typing seeded the query, place the caret after it so the
|
|
491
|
+
// user keeps typing where they left off.
|
|
492
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
493
|
+
}
|
|
428
494
|
});
|
|
429
495
|
}
|
|
430
496
|
}, [popover, hasSearch]),
|
|
431
497
|
onClose: popover.hide,
|
|
432
|
-
onSelect:
|
|
433
|
-
onChange?.(newValue);
|
|
434
|
-
if (changeAction) {
|
|
435
|
-
startTransition(async () => {
|
|
436
|
-
setOptimisticValue(newValue);
|
|
437
|
-
await changeAction(newValue);
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
}, [onChange, changeAction, startTransition, setOptimisticValue]),
|
|
498
|
+
onSelect: commitValue,
|
|
441
499
|
onClear: hasClear ? clearValue : undefined,
|
|
500
|
+
onSearchSeed: appendSearchQuery,
|
|
442
501
|
listboxId
|
|
443
502
|
});
|
|
444
503
|
|
|
504
|
+
// Type-to-select, shared with the other collections (menus, listboxes).
|
|
505
|
+
// Open, it walks the highlight — aria-activedescendant announces each match.
|
|
506
|
+
// Closed, it commits the match like a native select, which changes the value
|
|
507
|
+
// without opening the popup or moving focus, so nothing else would prompt
|
|
508
|
+
// assistive tech to re-read the trigger: announce it explicitly.
|
|
509
|
+
const typeahead = useTypeahead({
|
|
510
|
+
getItemLabels: () => selectableItems.map(item => item.label ?? item.value),
|
|
511
|
+
isDisabled: index => selectableItems[index]?.disabled === true,
|
|
512
|
+
// Cycle onward from the highlight when open, from the committed selection
|
|
513
|
+
// when closed — the optimistic one, so a pending changeAction cannot strand
|
|
514
|
+
// cycling on the first match. -1 means nothing is selected or highlighted,
|
|
515
|
+
// which the hook reads as "search from the top".
|
|
516
|
+
getCurrentIndex: () => popover.isOpen ? highlightedIndex : selectedItemIndex,
|
|
517
|
+
onMatch: index => {
|
|
518
|
+
const item = selectableItems[index];
|
|
519
|
+
if (popover.isOpen) {
|
|
520
|
+
setHighlightedIndex(index);
|
|
521
|
+
} else if (item.value !== optimisticValue) {
|
|
522
|
+
commitValue(item.value);
|
|
523
|
+
announce(item.label ?? item.value);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
resetTypeaheadRef.current = typeahead.reset;
|
|
528
|
+
const handleTriggerKeyDown = useCallback(e => {
|
|
529
|
+
// With hasSearch the query input owns typing, so type-to-select is off.
|
|
530
|
+
if (!isDisabled && !hasSearch && typeahead.onKeyDown(e)) {
|
|
531
|
+
e.preventDefault();
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
onKeyDown(e);
|
|
535
|
+
}, [isDisabled, hasSearch, typeahead, onKeyDown]);
|
|
536
|
+
|
|
445
537
|
// Keep the highlighted option visible during keyboard navigation. The
|
|
446
538
|
// listbox is a fixed-height scroll container, so without this the virtual
|
|
447
539
|
// cursor walks off-screen once navigation passes the visible window. Mirrors
|
|
@@ -535,11 +627,50 @@ export function Selector(props) {
|
|
|
535
627
|
});
|
|
536
628
|
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, t]);
|
|
537
629
|
|
|
630
|
+
// The single-selection mark, resolved from the theme once per render. A
|
|
631
|
+
// theme that maps `check` to another indicator (a radio, say) changes every
|
|
632
|
+
// selected-option mark in the app through this one lookup.
|
|
633
|
+
const SelectionMark = useIndicator('check');
|
|
634
|
+
|
|
538
635
|
// Render an individual item
|
|
539
636
|
const renderItem = useCallback((item, flatIndex) => {
|
|
540
637
|
const isHighlighted = flatIndex === highlightedIndex;
|
|
541
638
|
const isSelected = item.value === normalizedValue;
|
|
542
|
-
|
|
639
|
+
|
|
640
|
+
/*
|
|
641
|
+
* Rendered UNCONDITIONALLY, with the state passed down: the default
|
|
642
|
+
* check draws nothing when unchecked, but a theme that replaces the
|
|
643
|
+
* `check` indicator with a radio needs the unselected state to draw
|
|
644
|
+
* its empty circle. `{isSelected && …}` would make that impossible.
|
|
645
|
+
*
|
|
646
|
+
* `selector-check` stays the stable target for the mark's position
|
|
647
|
+
* in the row; the indicator owns what the mark looks like.
|
|
648
|
+
*/
|
|
649
|
+
const mark = /*#__PURE__*/_jsx("span", {
|
|
650
|
+
...{
|
|
651
|
+
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo"
|
|
652
|
+
},
|
|
653
|
+
children: /*#__PURE__*/_jsx(SelectionMark, {
|
|
654
|
+
state: isSelected ? 'checked' : 'unchecked',
|
|
655
|
+
size: "sm",
|
|
656
|
+
isDisabled: item.disabled ?? false,
|
|
657
|
+
...themeProps('selector-check')
|
|
658
|
+
})
|
|
659
|
+
});
|
|
660
|
+
const optionContent = /*#__PURE__*/_jsx("span", {
|
|
661
|
+
...{
|
|
662
|
+
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
663
|
+
},
|
|
664
|
+
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
665
|
+
option: item
|
|
666
|
+
})
|
|
667
|
+
});
|
|
668
|
+
const content = indicatorPosition === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
669
|
+
children: [mark, optionContent]
|
|
670
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
671
|
+
children: [optionContent, mark]
|
|
672
|
+
});
|
|
673
|
+
return /*#__PURE__*/_jsx("div", {
|
|
543
674
|
id: getItemId(flatIndex),
|
|
544
675
|
role: "option",
|
|
545
676
|
"aria-selected": isSelected,
|
|
@@ -547,20 +678,9 @@ export function Selector(props) {
|
|
|
547
678
|
onClick: () => onItemSelect(item),
|
|
548
679
|
onMouseEnter: () => onItemMouseEnter(item, flatIndex),
|
|
549
680
|
...stylex.props(styles.item, itemSizeStyles[size], isHighlighted && styles.itemHighlighted, isSelected && styles.itemSelected, item.disabled && styles.itemDisabled),
|
|
550
|
-
children:
|
|
551
|
-
...{
|
|
552
|
-
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
553
|
-
},
|
|
554
|
-
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
555
|
-
option: item
|
|
556
|
-
})
|
|
557
|
-
}), isSelected && /*#__PURE__*/_jsx(Icon, {
|
|
558
|
-
icon: "check",
|
|
559
|
-
size: "sm",
|
|
560
|
-
color: "accent"
|
|
561
|
-
})]
|
|
681
|
+
children: content
|
|
562
682
|
}, item.value);
|
|
563
|
-
}, [renderOption, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter]);
|
|
683
|
+
}, [renderOption, indicatorPosition, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
564
684
|
|
|
565
685
|
// Render all options (handling sections/dividers)
|
|
566
686
|
const renderOptions = useCallback(() => {
|
|
@@ -574,9 +694,9 @@ export function Selector(props) {
|
|
|
574
694
|
// result-count live region instead.
|
|
575
695
|
return [/*#__PURE__*/_jsx("div", {
|
|
576
696
|
role: "presentation",
|
|
577
|
-
...{
|
|
697
|
+
...mergeProps(themeProps('selector-empty-state'), {
|
|
578
698
|
className: "x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib"
|
|
579
|
-
},
|
|
699
|
+
}),
|
|
580
700
|
children: "No results found"
|
|
581
701
|
}, "empty")];
|
|
582
702
|
}
|
|
@@ -638,6 +758,7 @@ export function Selector(props) {
|
|
|
638
758
|
const selectorContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
639
759
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
640
760
|
ref: el => {
|
|
761
|
+
anchorRef.current = el;
|
|
641
762
|
popover.triggerRef(el);
|
|
642
763
|
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
643
764
|
// Handlers are gated internally by isEnabled, and anchor names
|
|
@@ -649,8 +770,9 @@ export function Selector(props) {
|
|
|
649
770
|
...mergeProps(themeProps('selector', {
|
|
650
771
|
variant,
|
|
651
772
|
size,
|
|
652
|
-
status: status?.type ?? null
|
|
653
|
-
|
|
773
|
+
status: status?.type ?? null,
|
|
774
|
+
disabled: isDisabled ? 'disabled' : null
|
|
775
|
+
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, variant === 'ghost' && focusOutlineStyles.focusWithin, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, !selectedItem && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
654
776
|
children: [startIcon && renderIconSlot(startIcon, {
|
|
655
777
|
size: 'sm',
|
|
656
778
|
color: 'secondary'
|
|
@@ -682,7 +804,7 @@ export function Selector(props) {
|
|
|
682
804
|
,
|
|
683
805
|
disabled: isDisabled && !showsDisabledMessage,
|
|
684
806
|
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
685
|
-
onKeyDown:
|
|
807
|
+
onKeyDown: handleTriggerKeyDown,
|
|
686
808
|
tabIndex: isDisabled && !showsDisabledMessage ? -1 : 0,
|
|
687
809
|
...{
|
|
688
810
|
className: "x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x1a2a7pz"
|
|
@@ -703,73 +825,47 @@ export function Selector(props) {
|
|
|
703
825
|
disabled: isDisabled
|
|
704
826
|
}), isBusy && /*#__PURE__*/_jsx(Spinner, {
|
|
705
827
|
size: "sm"
|
|
706
|
-
}), hasClear && value != null && !isDisabled && /*#__PURE__*/_jsx(
|
|
707
|
-
|
|
708
|
-
onClick: handleClear,
|
|
709
|
-
"aria-label": t('@astryx.selector.clearLabel', {
|
|
828
|
+
}), hasClear && value != null && !isDisabled && /*#__PURE__*/_jsx(InputClearButton, {
|
|
829
|
+
label: t('@astryx.selector.clearLabel', {
|
|
710
830
|
label
|
|
711
831
|
}),
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
832
|
+
onClick: handleClear,
|
|
833
|
+
iconClassName: stableClassName('selector-clear-icon')
|
|
834
|
+
}), showStatusIcon ? showStatusTooltip ? /*#__PURE__*/_jsx("button", {
|
|
835
|
+
ref: statusTooltip.ref,
|
|
836
|
+
type: "button",
|
|
837
|
+
"aria-label": t(STATUS_BUTTON_LABEL_KEY[status.type]),
|
|
838
|
+
"aria-describedby": statusTooltip.describedBy,
|
|
839
|
+
onClick: e => e.stopPropagation(),
|
|
840
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.statusButton),
|
|
715
841
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
716
|
-
icon: "close",
|
|
717
|
-
size: "sm",
|
|
718
|
-
color: "secondary"
|
|
719
|
-
// Stable theme target on the clear glyph itself, so a theme can
|
|
720
|
-
// restyle just this icon (color, size, hover) via `defineTheme`.
|
|
721
|
-
// Same-element rules in @layer astryx-theme win over the icon's
|
|
722
|
-
// own base color/size, which a button-level target could not
|
|
723
|
-
// reach.
|
|
724
|
-
,
|
|
725
|
-
...themeProps('selector-clear-icon')
|
|
726
|
-
})
|
|
727
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
728
|
-
...{
|
|
729
|
-
0: {
|
|
730
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k x1kky2od xlup9mm x11xpdln xuedmi6 xlr8y92 x1g0ag68 xv9yike"
|
|
731
|
-
},
|
|
732
|
-
2: {
|
|
733
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k x1kky2od xlup9mm x11xpdln xuedmi6 xlr8y92 x1g0ag68 xv9yike x19jd1h0"
|
|
734
|
-
},
|
|
735
|
-
1: {
|
|
736
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k x1kky2od xlup9mm x11xpdln xuedmi6 xlr8y92 x1g0ag68 xv9yike xq2gx43"
|
|
737
|
-
},
|
|
738
|
-
3: {
|
|
739
|
-
className: "x2lah0s x78zum5 x6s0dn4 xl56j7k x1kky2od xlup9mm x11xpdln xuedmi6 xlr8y92 x1g0ag68 xv9yike x19jd1h0 xq2gx43"
|
|
740
|
-
}
|
|
741
|
-
}[!!(!showStatusIcon && popover.isOpen) << 1 | !!showStatusIcon << 0],
|
|
742
|
-
children: showStatusIcon ? showStatusTooltip ? /*#__PURE__*/_jsx("button", {
|
|
743
|
-
ref: statusTooltip.ref,
|
|
744
|
-
type: "button",
|
|
745
|
-
"aria-label": t(STATUS_BUTTON_LABEL_KEY[status.type]),
|
|
746
|
-
"aria-describedby": statusTooltip.describedBy,
|
|
747
|
-
onClick: e => e.stopPropagation(),
|
|
748
|
-
...{
|
|
749
|
-
className: "x78zum5 x6s0dn4 xl56j7k x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1heor9g x1ypdohk xh6dtrn x1a2a7pz x1p25gnr x1y3gkto"
|
|
750
|
-
},
|
|
751
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
752
|
-
icon: STATUS_ICON_MAP[status.type],
|
|
753
|
-
size: "sm",
|
|
754
|
-
color: STATUS_ICON_COLOR_MAP[status.type]
|
|
755
|
-
})
|
|
756
|
-
}) : /*#__PURE__*/_jsx(Icon, {
|
|
757
842
|
icon: STATUS_ICON_MAP[status.type],
|
|
758
843
|
size: "sm",
|
|
759
|
-
color: STATUS_ICON_COLOR_MAP[status.type]
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
844
|
+
color: STATUS_ICON_COLOR_MAP[status.type],
|
|
845
|
+
xstyle: styles.triggerIcon
|
|
846
|
+
})
|
|
847
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
848
|
+
icon: STATUS_ICON_MAP[status.type],
|
|
849
|
+
size: "sm",
|
|
850
|
+
color: STATUS_ICON_COLOR_MAP[status.type],
|
|
851
|
+
xstyle: styles.triggerIcon
|
|
852
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
853
|
+
icon: "chevronDown",
|
|
854
|
+
size: "sm",
|
|
855
|
+
color: "secondary"
|
|
856
|
+
// The rotation rides on the glyph, alongside the box and color
|
|
857
|
+
// the wrapper used to provide, so one element carries the mark,
|
|
858
|
+
// its open/closed transform, and the theme target.
|
|
859
|
+
,
|
|
860
|
+
xstyle: [styles.triggerIcon, styles.triggerIconRotation, popover.isOpen && styles.triggerIconOpen]
|
|
861
|
+
// Stable theme target on the chevron glyph itself, so a theme can
|
|
862
|
+
// restyle just this icon (color, size, hover) — and its
|
|
863
|
+
// open/closed state — via `defineTheme`. Same-element rules in
|
|
864
|
+
// @layer astryx-theme win over the icon's own base color/size,
|
|
865
|
+
// which a button-level target could not reach.
|
|
866
|
+
,
|
|
867
|
+
...themeProps('selector-indicator-icon', {
|
|
868
|
+
state: popover.isOpen ? 'expanded' : 'collapsed'
|
|
773
869
|
})
|
|
774
870
|
})]
|
|
775
871
|
}), popover.render(hasSearch ? /*#__PURE__*/_jsxs("div", {
|
|
@@ -779,8 +875,13 @@ export function Selector(props) {
|
|
|
779
875
|
role: "listbox",
|
|
780
876
|
"aria-labelledby": triggerId,
|
|
781
877
|
...{
|
|
782
|
-
|
|
783
|
-
|
|
878
|
+
0: {
|
|
879
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo"
|
|
880
|
+
},
|
|
881
|
+
1: {
|
|
882
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq"
|
|
883
|
+
}
|
|
884
|
+
}[!!(variant !== 'ghost') << 0],
|
|
784
885
|
children: renderOptions()
|
|
785
886
|
})]
|
|
786
887
|
}) : /*#__PURE__*/_jsx("div", {
|
|
@@ -790,16 +891,26 @@ export function Selector(props) {
|
|
|
790
891
|
"aria-labelledby": triggerId,
|
|
791
892
|
...{
|
|
792
893
|
0: {
|
|
793
|
-
className: "x9f619 xuyqlj2 x1odjw0f
|
|
894
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo"
|
|
895
|
+
},
|
|
896
|
+
2: {
|
|
897
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq"
|
|
794
898
|
},
|
|
795
899
|
1: {
|
|
796
|
-
className: "x9f619 xuyqlj2 x1odjw0f
|
|
900
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj xg01cxk xq2gx43"
|
|
901
|
+
},
|
|
902
|
+
3: {
|
|
903
|
+
className: "x9f619 xuyqlj2 x1odjw0f xu0wf1k x2hg6jq xg01cxk xq2gx43"
|
|
797
904
|
}
|
|
798
|
-
}[!!!isPositioned << 0],
|
|
905
|
+
}[!!(variant !== 'ghost') << 1 | !!!isPositioned << 0],
|
|
799
906
|
children: renderOptions()
|
|
800
907
|
}), {
|
|
801
908
|
placement: popoverPlacement,
|
|
802
909
|
alignment: 'start',
|
|
910
|
+
// The system's standard menu clearance, except in overlay mode:
|
|
911
|
+
// there the measured negative margin owns the block geometry and
|
|
912
|
+
// the menu is meant to sit on the trigger, not clear it.
|
|
913
|
+
offset: shouldOverlaySelectedItem ? undefined : spacingVars['--spacing-1'],
|
|
803
914
|
xstyle: [styles.popover, layerAnimations[popoverPlacement]],
|
|
804
915
|
style: popoverOffsetStyle
|
|
805
916
|
}), showStatusTooltip && statusTooltip.renderTooltip(status?.message ?? ''), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|