@astryxdesign/core 0.3.0 → 0.4.0
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.map +1 -1
- package/dist/Banner/Banner.js +15 -14
- 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 +11 -15
- 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 +35 -33
- 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 +24 -23
- package/dist/DateRangeInput/DateRangeInput.d.ts +9 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts +9 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +22 -17
- 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/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/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 +167 -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 +56 -53
- 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.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +78 -75
- 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/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 +96 -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 +2 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +164 -94
- 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/Stack/stack.stylex.d.ts +3 -3
- package/dist/Switch/Switch.js +11 -10
- 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/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 +7 -15
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +16 -34
- 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 +74 -85
- 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/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 +16 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +8 -0
- 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 +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.d.ts +107 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -0
- package/dist/utils/focusOutline.stylex.js +130 -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 +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- 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 +12 -0
- package/locales/pseudo.json +9 -0
- package/package.json +7 -2
- 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.tsx +9 -6
- package/src/Breadcrumbs/BreadcrumbItem.tsx +16 -6
- package/src/Breadcrumbs/index.ts +5 -1
- package/src/Button/Button.tsx +21 -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 +115 -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 +64 -0
- package/src/ComplexSelector/ComplexSelector.tsx +46 -29
- 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 +93 -11
- package/src/DateInput/DateInput.tsx +41 -19
- package/src/DateRangeInput/DateRangeInput.doc.mjs +10 -2
- package/src/DateRangeInput/DateRangeInput.test.tsx +110 -14
- package/src/DateRangeInput/DateRangeInput.tsx +24 -12
- package/src/DateTimeInput/DateTimeInput.doc.mjs +16 -2
- package/src/DateTimeInput/DateTimeInput.test.tsx +75 -0
- package/src/DateTimeInput/DateTimeInput.tsx +35 -8
- 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/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/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 +45 -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 +186 -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 +43 -38
- 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 +9 -1
- package/src/MultiSelector/MultiSelector.test.tsx +255 -16
- package/src/MultiSelector/MultiSelector.tsx +103 -99
- 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.tsx +6 -7
- 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 +124 -22
- 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 +7 -4
- package/src/Selector/Selector.test.tsx +935 -25
- package/src/Selector/Selector.tsx +189 -106
- 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/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 +8 -8
- package/src/TabList/Tab.tsx +2 -9
- package/src/TabList/TabMenu.tsx +14 -21
- package/src/Table/BaseTable.tsx +11 -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 +30 -3
- package/src/TimeInput/TimeInput.tsx +9 -26
- package/src/Timestamp/Timestamp.doc.mjs +4 -3
- package/src/Timestamp/TimestampHoverCard.tsx +13 -35
- 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.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 +206 -7
- 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/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 +24 -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 +61 -20
- package/src/theme/generateThemeRules.ts +11 -0
- package/src/theme/index.ts +13 -0
- package/src/utils/focusOutline.stylex.ts +163 -0
- package/src/utils/focusReturn.test.ts +42 -0
- package/src/utils/focusReturn.ts +31 -0
- package/src/utils/index.ts +1 -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
package/src/Selector/hooks.ts
CHANGED
|
@@ -4,15 +4,36 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file hooks.ts
|
|
7
|
+
* @input Uses untransformed DOM layout geometry from the Selector's outer
|
|
8
|
+
* anchor, listbox, and selected option
|
|
7
9
|
* @output Hooks for Selector
|
|
8
10
|
* @position Internal hooks; used by Selector.tsx
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
|
-
import {useCallback,
|
|
13
|
+
import {useCallback, useState} from 'react';
|
|
12
14
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
13
15
|
import type {RefObject} from 'react';
|
|
14
16
|
import type {SelectorOptionData} from './types';
|
|
15
17
|
|
|
18
|
+
// The selected row renders one optical pixel below the closed trigger label at
|
|
19
|
+
// the same mathematical center, so compensate before viewport clamping.
|
|
20
|
+
const SELECTED_ITEM_OPTICAL_OFFSET = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Return an element's document-relative layout top without CSS transforms.
|
|
24
|
+
* getBoundingClientRect includes the popover's entry scale, which would make
|
|
25
|
+
* the measured error grow with each option's distance from the menu top.
|
|
26
|
+
*/
|
|
27
|
+
function getLayoutTop(element: HTMLElement): number {
|
|
28
|
+
let top = 0;
|
|
29
|
+
let current: HTMLElement | null = element;
|
|
30
|
+
while (current) {
|
|
31
|
+
top += current.offsetTop;
|
|
32
|
+
current = current.offsetParent as HTMLElement | null;
|
|
33
|
+
}
|
|
34
|
+
return top;
|
|
35
|
+
}
|
|
36
|
+
|
|
16
37
|
// =============================================================================
|
|
17
38
|
// useSelectedItemOffset - Position dropdown to center selected item over trigger
|
|
18
39
|
// =============================================================================
|
|
@@ -22,7 +43,7 @@ interface UseSelectedItemOffsetOptions {
|
|
|
22
43
|
selectedItemIndex: number;
|
|
23
44
|
listboxId: string;
|
|
24
45
|
listboxRef: RefObject<HTMLDivElement | null>;
|
|
25
|
-
|
|
46
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
26
47
|
}
|
|
27
48
|
|
|
28
49
|
interface UseSelectedItemOffsetResult {
|
|
@@ -32,9 +53,9 @@ interface UseSelectedItemOffsetResult {
|
|
|
32
53
|
|
|
33
54
|
/**
|
|
34
55
|
* Calculates the offset needed to position the dropdown so that the selected
|
|
35
|
-
* item appears centered over the
|
|
56
|
+
* item appears centered over the outer selector control (macOS-style selector).
|
|
36
57
|
*
|
|
37
|
-
* The desired dropdown top is calculated directly from the
|
|
58
|
+
* The desired dropdown top is calculated directly from the anchor center and
|
|
38
59
|
* selected-item center, then clamped to the viewport. This preserves the
|
|
39
60
|
* default "selected item over trigger" behavior while letting the menu slide
|
|
40
61
|
* upward near the bottom edge or downward near the top edge instead of being
|
|
@@ -45,7 +66,7 @@ export function useSelectedItemOffset({
|
|
|
45
66
|
selectedItemIndex,
|
|
46
67
|
listboxId,
|
|
47
68
|
listboxRef,
|
|
48
|
-
|
|
69
|
+
anchorRef,
|
|
49
70
|
}: UseSelectedItemOffsetOptions): UseSelectedItemOffsetResult {
|
|
50
71
|
const [offset, setOffset] = useState(0);
|
|
51
72
|
const [isPositioned, setIsPositioned] = useState(false);
|
|
@@ -67,7 +88,7 @@ export function useSelectedItemOffset({
|
|
|
67
88
|
return;
|
|
68
89
|
}
|
|
69
90
|
|
|
70
|
-
if (!listboxRef.current || !
|
|
91
|
+
if (!listboxRef.current || !anchorRef.current) {
|
|
71
92
|
commitPosition(0, true);
|
|
72
93
|
return;
|
|
73
94
|
}
|
|
@@ -83,34 +104,37 @@ export function useSelectedItemOffset({
|
|
|
83
104
|
return;
|
|
84
105
|
}
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const listboxRect = listboxRef.current.getBoundingClientRect();
|
|
89
|
-
const itemRect = targetItem.getBoundingClientRect();
|
|
90
|
-
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
107
|
+
const listbox = listboxRef.current;
|
|
108
|
+
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
91
109
|
|
|
92
|
-
|
|
110
|
+
// offset* metrics intentionally exclude the popover's entry transform.
|
|
111
|
+
const listboxHeight = listbox.offsetHeight;
|
|
93
112
|
if (listboxHeight <= 0) {
|
|
94
113
|
commitPosition(0, true);
|
|
95
114
|
return;
|
|
96
115
|
}
|
|
97
116
|
|
|
98
117
|
// Item center relative to listbox top. This remains stable even as the
|
|
99
|
-
// popover
|
|
118
|
+
// popover animates between scale values. scrollTop keeps the calculation
|
|
119
|
+
// correct when a previously scrolled listbox is reopened.
|
|
100
120
|
const itemCenterInListbox =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
121
|
+
getLayoutTop(targetItem) -
|
|
122
|
+
getLayoutTop(listbox) -
|
|
123
|
+
listbox.scrollTop +
|
|
124
|
+
targetItem.offsetHeight / 2;
|
|
125
|
+
const anchorCenter = anchorRect.top + anchorRect.height / 2;
|
|
126
|
+
|
|
127
|
+
// Desired top aligns the selected item's center with the anchor center.
|
|
128
|
+
const desiredTop =
|
|
129
|
+
anchorCenter - itemCenterInListbox - SELECTED_ITEM_OPTICAL_OFFSET;
|
|
106
130
|
const viewportHeight = window.innerHeight;
|
|
107
131
|
const maxTop = Math.max(0, viewportHeight - listboxHeight);
|
|
108
132
|
const clampedTop = Math.min(Math.max(desiredTop, 0), maxTop);
|
|
109
133
|
|
|
110
|
-
// useLayer positions the popover below the
|
|
134
|
+
// useLayer positions the popover below the outer anchor. Apply a negative
|
|
111
135
|
// block-start margin to the layer container so the listbox top moves from
|
|
112
|
-
//
|
|
113
|
-
const clampedOffset = Math.max(0,
|
|
136
|
+
// anchorRect.bottom to clampedTop.
|
|
137
|
+
const clampedOffset = Math.max(0, anchorRect.bottom - clampedTop);
|
|
114
138
|
|
|
115
139
|
commitPosition(clampedOffset, true);
|
|
116
140
|
}, [
|
|
@@ -118,7 +142,7 @@ export function useSelectedItemOffset({
|
|
|
118
142
|
selectedItemIndex,
|
|
119
143
|
listboxId,
|
|
120
144
|
listboxRef,
|
|
121
|
-
|
|
145
|
+
anchorRef,
|
|
122
146
|
commitPosition,
|
|
123
147
|
]);
|
|
124
148
|
|
|
@@ -126,7 +150,7 @@ export function useSelectedItemOffset({
|
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
// =============================================================================
|
|
129
|
-
// useCombobox - Keyboard navigation
|
|
153
|
+
// useCombobox - Keyboard navigation and selection
|
|
130
154
|
// =============================================================================
|
|
131
155
|
|
|
132
156
|
interface UseComboboxOptions {
|
|
@@ -145,6 +169,13 @@ interface UseComboboxOptions {
|
|
|
145
169
|
* navigation owns those keys there) or when there is no value.
|
|
146
170
|
*/
|
|
147
171
|
onClear?: () => void;
|
|
172
|
+
/**
|
|
173
|
+
* With `hasSearch`, printable characters typed on the trigger are appended to
|
|
174
|
+
* the search query (opening the popup if needed), so type-to-find works
|
|
175
|
+
* without a separate open step. Characters keep arriving here until focus
|
|
176
|
+
* lands in the search input, which then owns its own typing.
|
|
177
|
+
*/
|
|
178
|
+
onSearchSeed?: (char: string) => void;
|
|
148
179
|
listboxId: string;
|
|
149
180
|
}
|
|
150
181
|
|
|
@@ -159,7 +190,12 @@ interface UseComboboxResult {
|
|
|
159
190
|
}
|
|
160
191
|
|
|
161
192
|
/**
|
|
162
|
-
* Handles keyboard navigation
|
|
193
|
+
* Handles keyboard navigation and selection for combobox/listbox patterns.
|
|
194
|
+
*
|
|
195
|
+
* Type-to-select is not handled here: callers that want it compose the shared
|
|
196
|
+
* `useTypeahead` hook and run it ahead of this handler (see Selector). That
|
|
197
|
+
* keeps matching consistent with the other collections and leaves consumers
|
|
198
|
+
* whose own input already filters the items (CommandPalette) untouched.
|
|
163
199
|
*/
|
|
164
200
|
export function useCombobox({
|
|
165
201
|
selectableItems,
|
|
@@ -171,13 +207,10 @@ export function useCombobox({
|
|
|
171
207
|
onClose,
|
|
172
208
|
onSelect,
|
|
173
209
|
onClear,
|
|
210
|
+
onSearchSeed,
|
|
174
211
|
listboxId,
|
|
175
212
|
}: UseComboboxOptions): UseComboboxResult {
|
|
176
213
|
const [highlightedIndex, setHighlightedIndex] = useState<number>(-1);
|
|
177
|
-
const [typeahead, setTypeahead] = useState('');
|
|
178
|
-
const typeaheadTimeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(
|
|
179
|
-
undefined,
|
|
180
|
-
);
|
|
181
214
|
|
|
182
215
|
const getItemId = useCallback(
|
|
183
216
|
(index: number) => `${listboxId}-item-${index}`,
|
|
@@ -274,6 +307,8 @@ export function useCombobox({
|
|
|
274
307
|
if (hasSearch) {
|
|
275
308
|
break;
|
|
276
309
|
}
|
|
310
|
+
// A space mid-typeahead extends the query instead of activating; the
|
|
311
|
+
// caller's useTypeahead claims it before this handler ever runs.
|
|
277
312
|
// falls through
|
|
278
313
|
case 'Enter':
|
|
279
314
|
e.preventDefault();
|
|
@@ -349,28 +384,20 @@ export function useCombobox({
|
|
|
349
384
|
break;
|
|
350
385
|
|
|
351
386
|
default:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
item =>
|
|
365
|
-
!item.disabled &&
|
|
366
|
-
item.label?.toLowerCase().startsWith(newTypeahead),
|
|
367
|
-
);
|
|
368
|
-
if (matchIndex >= 0) {
|
|
369
|
-
if (!isOpen) {
|
|
370
|
-
onOpen();
|
|
371
|
-
}
|
|
372
|
-
setHighlightedIndex(matchIndex);
|
|
387
|
+
// Keys land here only while the trigger holds focus — once the search
|
|
388
|
+
// input takes over it handles its own typing — so they belong in the
|
|
389
|
+
// query, including the ones racing the open.
|
|
390
|
+
if (
|
|
391
|
+
hasSearch &&
|
|
392
|
+
onSearchSeed &&
|
|
393
|
+
e.key.length === 1 &&
|
|
394
|
+
!e.ctrlKey &&
|
|
395
|
+
!e.metaKey
|
|
396
|
+
) {
|
|
397
|
+
if (!isOpen) {
|
|
398
|
+
onOpen();
|
|
373
399
|
}
|
|
400
|
+
onSearchSeed(e.key);
|
|
374
401
|
}
|
|
375
402
|
break;
|
|
376
403
|
}
|
|
@@ -385,9 +412,9 @@ export function useCombobox({
|
|
|
385
412
|
selectItem,
|
|
386
413
|
findSelectedIndex,
|
|
387
414
|
getEnabledIndices,
|
|
388
|
-
typeahead,
|
|
389
415
|
hasSearch,
|
|
390
416
|
onClear,
|
|
417
|
+
onSearchSeed,
|
|
391
418
|
value,
|
|
392
419
|
],
|
|
393
420
|
);
|
|
@@ -183,6 +183,27 @@ describe('SideNav', () => {
|
|
|
183
183
|
expect(nav.children).toHaveLength(1);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
+
it('centers footer content when collapsed, matching children alignment', () => {
|
|
187
|
+
render(
|
|
188
|
+
<SideNav
|
|
189
|
+
data-testid="nav"
|
|
190
|
+
collapsible={{isCollapsed: true, hasButton: false}}
|
|
191
|
+
footer={<span data-testid="footer-content">F</span>}>
|
|
192
|
+
<span data-testid="children-content">C</span>
|
|
193
|
+
</SideNav>,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
// scrollableCollapsed (wraps children) and stickyBottomCollapsed (wraps
|
|
197
|
+
// footer) are structurally parallel collapsed-rail containers; both
|
|
198
|
+
// must center their content the same way, or full-width footer content
|
|
199
|
+
// stretches to the collapsed rail's width instead of centering.
|
|
200
|
+
const childrenContainer =
|
|
201
|
+
screen.getByTestId('children-content').parentElement;
|
|
202
|
+
const footerContainer = screen.getByTestId('footer-content').parentElement;
|
|
203
|
+
expect(getComputedStyle(childrenContainer!).alignItems).toBe('center');
|
|
204
|
+
expect(getComputedStyle(footerContainer!).alignItems).toBe('center');
|
|
205
|
+
});
|
|
206
|
+
|
|
186
207
|
it('fires a consumer onClick on the collapse button in addition to toggling', async () => {
|
|
187
208
|
const user = userEvent.setup();
|
|
188
209
|
const onClick = vi.fn();
|
|
@@ -592,6 +613,31 @@ describe('SideNavHeading collapsed', () => {
|
|
|
592
613
|
expect(menu!.contains(button)).toBe(false);
|
|
593
614
|
}
|
|
594
615
|
});
|
|
616
|
+
|
|
617
|
+
it('anchors the collapsed icon-only trigger so the popover positions against it', () => {
|
|
618
|
+
render(
|
|
619
|
+
<CollapsedWrapper>
|
|
620
|
+
<SideNavHeading
|
|
621
|
+
heading="My App"
|
|
622
|
+
icon={<span data-testid="app-icon">🏠</span>}
|
|
623
|
+
menu={<div role="menuitem">Alpha</div>}
|
|
624
|
+
/>
|
|
625
|
+
</CollapsedWrapper>,
|
|
626
|
+
);
|
|
627
|
+
const trigger = screen.getByRole('button', {name: 'My App'});
|
|
628
|
+
// The same element also carries the collapsed-item Tooltip's own
|
|
629
|
+
// anchor-name (via anchorRef={collapsedItemRef}), so a plain
|
|
630
|
+
// non-empty check would pass even when the menu popover itself isn't
|
|
631
|
+
// anchored. Assert the popover's own position-anchor id specifically
|
|
632
|
+
// appears in the trigger's (possibly multi-value) anchor-name list.
|
|
633
|
+
const popoverEl = document.querySelector('[popover]') as HTMLElement;
|
|
634
|
+
const anchorId = popoverEl.style.positionAnchor;
|
|
635
|
+
expect(anchorId).not.toBe('');
|
|
636
|
+
const triggerAnchorNames = trigger.style.anchorName
|
|
637
|
+
.split(',')
|
|
638
|
+
.map(s => s.trim());
|
|
639
|
+
expect(triggerAnchorNames).toContain(anchorId);
|
|
640
|
+
});
|
|
595
641
|
});
|
|
596
642
|
|
|
597
643
|
// =============================================================================
|
package/src/SideNav/SideNav.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file SideNavCollapseButton.tsx
|
|
7
|
-
* @input Uses React, StyleX, SideNavCollapseContext,
|
|
7
|
+
* @input Uses React, StyleX, SideNavCollapseContext, Icon
|
|
8
8
|
* @output Exports SideNavCollapseButton component
|
|
9
9
|
* @position Composable toggle button for sidenav collapse
|
|
10
10
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import React, {type ReactNode} from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
22
|
import {durationVars, easeVars} from '../theme/tokens.stylex';
|
|
23
|
-
import {
|
|
23
|
+
import {Icon} from '../Icon';
|
|
24
24
|
import {Button} from '../Button';
|
|
25
25
|
import type {BaseProps} from '../BaseProps';
|
|
26
26
|
import {composeEventHandlers, rtlStyles} from '../utils';
|
|
@@ -107,7 +107,6 @@ export function SideNavCollapseButton({
|
|
|
107
107
|
...props
|
|
108
108
|
}: SideNavCollapseButtonProps) {
|
|
109
109
|
const t = useTranslator();
|
|
110
|
-
const chevronLeftIcon = useIcon('chevronLeft');
|
|
111
110
|
const {isCollapsed, toggle, isCollapsible} =
|
|
112
111
|
useSideNavCollapseState(handleRef);
|
|
113
112
|
const {isMobile} = useAppShellMobile();
|
|
@@ -132,14 +131,20 @@ export function SideNavCollapseButton({
|
|
|
132
131
|
onClick={composeEventHandlers(onClickProp, toggle)}
|
|
133
132
|
icon={
|
|
134
133
|
children ?? (
|
|
134
|
+
// The RTL mirror stays on its own element, wrapping (not merged
|
|
135
|
+
// into) the state rotation: both are `transform`, so on a single
|
|
136
|
+
// element one would overwrite the other and the chevron would stop
|
|
137
|
+
// mirroring under RTL. See utils/rtlStyles.ts.
|
|
135
138
|
<span {...stylex.props(rtlStyles.mirror)}>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
{/* `sm` (1rem) matches what this glyph already renders at: Button's
|
|
140
|
+
icon slot pins its wrapper to 16px, and the registry SVG is
|
|
141
|
+
1em, so the chevron is 16px today. */}
|
|
142
|
+
<Icon
|
|
143
|
+
icon="chevronLeft"
|
|
144
|
+
size="sm"
|
|
145
|
+
color="inherit"
|
|
146
|
+
xstyle={[styles.chevron, isCollapsed && styles.chevronCollapsed]}
|
|
147
|
+
/>
|
|
143
148
|
</span>
|
|
144
149
|
)
|
|
145
150
|
}
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
// of lazy loading layer resources.
|
|
34
34
|
import {usePopover} from '../Popover/usePopover';
|
|
35
35
|
import {Link} from '../Link';
|
|
36
|
-
import {
|
|
36
|
+
import {Icon} from '../Icon';
|
|
37
37
|
import {Tooltip} from '../Tooltip';
|
|
38
38
|
import {navItemStyles} from '../NavItem/navItemStyles.stylex';
|
|
39
39
|
import {useSideNavCollapse} from './SideNavCollapseContext';
|
|
@@ -172,6 +172,11 @@ const styles = stylex.create({
|
|
|
172
172
|
minWidth: spacingVars['--spacing-7'],
|
|
173
173
|
minHeight: spacingVars['--spacing-7'],
|
|
174
174
|
color: colorVars['--color-icon-secondary'],
|
|
175
|
+
// 28px is the hit/alignment box, not the glyph. Icon sizes its own span
|
|
176
|
+
// with a matching font-size (the registry chevron is a 1em SVG), so pin
|
|
177
|
+
// font-size back to inherit to keep the glyph at the 14px it renders at
|
|
178
|
+
// today. The 28px min box still wins over Icon's width/height.
|
|
179
|
+
fontSize: 'inherit',
|
|
175
180
|
},
|
|
176
181
|
headerEndContent: {
|
|
177
182
|
flexShrink: 0,
|
|
@@ -217,8 +222,15 @@ const styles = stylex.create({
|
|
|
217
222
|
minWidth: spacingVars['--spacing-7'],
|
|
218
223
|
minHeight: spacingVars['--spacing-7'],
|
|
219
224
|
color: colorVars['--color-icon-secondary'],
|
|
225
|
+
// See `chevron` — keep the glyph on the inherited font-size.
|
|
226
|
+
fontSize: 'inherit',
|
|
220
227
|
transform: 'rotate(180deg)',
|
|
221
228
|
},
|
|
229
|
+
// Glyph inside a chevron *trigger* (the button already carries the 28px box
|
|
230
|
+
// and the color, so the Icon only has to avoid resizing itself).
|
|
231
|
+
chevronGlyph: {
|
|
232
|
+
fontSize: 'inherit',
|
|
233
|
+
},
|
|
222
234
|
popover: {
|
|
223
235
|
minWidth: 'anchor-size(width)',
|
|
224
236
|
marginBlockStart: spacingVars['--spacing-1'],
|
|
@@ -344,7 +356,6 @@ export function SideNavHeading({
|
|
|
344
356
|
...props
|
|
345
357
|
}: SideNavHeadingProps) {
|
|
346
358
|
const t = useTranslator();
|
|
347
|
-
const chevronDownIcon = useIcon('chevronDown');
|
|
348
359
|
const LinkComponent = useLinkComponent(as);
|
|
349
360
|
const {isCollapsed} = useSideNavCollapse();
|
|
350
361
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
@@ -387,7 +398,11 @@ export function SideNavHeading({
|
|
|
387
398
|
if (isCollapsed && icon) {
|
|
388
399
|
const collapsedIcon = <span {...stylex.props(styles.icon)}>{icon}</span>;
|
|
389
400
|
|
|
390
|
-
const collapsedSetRef = mergeRefs<HTMLElement>(
|
|
401
|
+
const collapsedSetRef = mergeRefs<HTMLElement>(
|
|
402
|
+
collapsedItemRef,
|
|
403
|
+
ref,
|
|
404
|
+
menu ? popover.triggerRef : undefined,
|
|
405
|
+
);
|
|
391
406
|
|
|
392
407
|
let collapsedElement: ReactNode;
|
|
393
408
|
|
|
@@ -454,9 +469,12 @@ export function SideNavHeading({
|
|
|
454
469
|
)}>
|
|
455
470
|
{heading}
|
|
456
471
|
</span>
|
|
457
|
-
<
|
|
458
|
-
|
|
459
|
-
|
|
472
|
+
<Icon
|
|
473
|
+
icon="chevronDown"
|
|
474
|
+
size="sm"
|
|
475
|
+
color="secondary"
|
|
476
|
+
xstyle={styles.popoverChevron}
|
|
477
|
+
/>
|
|
460
478
|
</span>
|
|
461
479
|
{subheading && (
|
|
462
480
|
<span {...stylex.props(styles.subheading)}>
|
|
@@ -551,7 +569,12 @@ export function SideNavHeading({
|
|
|
551
569
|
);
|
|
552
570
|
|
|
553
571
|
const chevronElement = showChevron && (
|
|
554
|
-
<
|
|
572
|
+
<Icon
|
|
573
|
+
icon="chevronDown"
|
|
574
|
+
size="sm"
|
|
575
|
+
color="secondary"
|
|
576
|
+
xstyle={styles.chevron}
|
|
577
|
+
/>
|
|
555
578
|
);
|
|
556
579
|
|
|
557
580
|
const headerEndContentElement = headerEndContent && (
|
|
@@ -567,7 +590,12 @@ export function SideNavHeading({
|
|
|
567
590
|
onClick={triggerProps.onClick}>
|
|
568
591
|
{icon && <span {...stylex.props(styles.icon)}>{icon}</span>}
|
|
569
592
|
{renderTextContent(
|
|
570
|
-
<
|
|
593
|
+
<Icon
|
|
594
|
+
icon="chevronDown"
|
|
595
|
+
size="sm"
|
|
596
|
+
color="secondary"
|
|
597
|
+
xstyle={styles.popoverChevron}
|
|
598
|
+
/>,
|
|
571
599
|
)}
|
|
572
600
|
</button>
|
|
573
601
|
);
|
|
@@ -619,7 +647,12 @@ export function SideNavHeading({
|
|
|
619
647
|
}}
|
|
620
648
|
{...popover.triggerProps}
|
|
621
649
|
{...stylex.props(styles.chevron, styles.interactive)}>
|
|
622
|
-
|
|
650
|
+
<Icon
|
|
651
|
+
icon="chevronDown"
|
|
652
|
+
size="sm"
|
|
653
|
+
color="inherit"
|
|
654
|
+
xstyle={styles.chevronGlyph}
|
|
655
|
+
/>
|
|
623
656
|
</button>,
|
|
624
657
|
)}
|
|
625
658
|
{headerEndContentElement}
|
|
@@ -685,7 +718,12 @@ export function SideNavHeading({
|
|
|
685
718
|
}}
|
|
686
719
|
{...popover.triggerProps}
|
|
687
720
|
{...stylex.props(styles.chevron, styles.interactive)}>
|
|
688
|
-
|
|
721
|
+
<Icon
|
|
722
|
+
icon="chevronDown"
|
|
723
|
+
size="sm"
|
|
724
|
+
color="inherit"
|
|
725
|
+
xstyle={styles.chevronGlyph}
|
|
726
|
+
/>
|
|
689
727
|
</button>
|
|
690
728
|
) : undefined,
|
|
691
729
|
)}
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
borderVars,
|
|
39
39
|
radiusVars,
|
|
40
40
|
} from '../theme/tokens.stylex';
|
|
41
|
-
import {
|
|
41
|
+
import {Icon, renderIconSlot, type IconType} from '../Icon';
|
|
42
42
|
import {useLinkComponent} from '../Link/useLinkComponent';
|
|
43
43
|
import type {LinkComponentType} from '../Link/types';
|
|
44
44
|
import {usePopover} from '../Popover/usePopover';
|
|
@@ -108,6 +108,11 @@ const styles = stylex.create({
|
|
|
108
108
|
justifyContent: 'center',
|
|
109
109
|
width: spacingVars['--spacing-6'],
|
|
110
110
|
height: spacingVars['--spacing-6'],
|
|
111
|
+
// Icon's `lg` would also set font-size: 1.5rem, and the registry chevron
|
|
112
|
+
// is a 1em SVG — that would blow the glyph up from the 14px it inherits
|
|
113
|
+
// from the row to the full 24px box. The 24px box is the touch/alignment
|
|
114
|
+
// target, not the glyph size, so keep the glyph on the inherited size.
|
|
115
|
+
fontSize: 'inherit',
|
|
111
116
|
transitionProperty: 'transform',
|
|
112
117
|
transitionDuration: durationVars['--duration-fast'],
|
|
113
118
|
transitionTimingFunction: easeVars['--ease-standard'],
|
|
@@ -358,7 +363,6 @@ export function SideNavItem({
|
|
|
358
363
|
xstyle,
|
|
359
364
|
}: SideNavItemProps) {
|
|
360
365
|
const t = useTranslator();
|
|
361
|
-
const chevronDownIcon = useIcon('chevronDown');
|
|
362
366
|
const {isCollapsed} = useSideNavCollapse();
|
|
363
367
|
const renderMode = useSideNavRenderMode();
|
|
364
368
|
const {closeMobileNav} = useAppShellMobile();
|
|
@@ -574,13 +578,15 @@ export function SideNavItem({
|
|
|
574
578
|
<span {...stylex.props(styles.endContent)}>{endContent}</span>
|
|
575
579
|
)}
|
|
576
580
|
{!isCollapsed && isItemCollapsible && !hasIndependentToggle && (
|
|
577
|
-
<
|
|
578
|
-
|
|
581
|
+
<Icon
|
|
582
|
+
icon="chevronDown"
|
|
583
|
+
size="lg"
|
|
584
|
+
color="inherit"
|
|
585
|
+
xstyle={[
|
|
579
586
|
styles.expandChevron,
|
|
580
587
|
!isItemCollapsed && styles.expandChevronExpanded,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
</span>
|
|
588
|
+
]}
|
|
589
|
+
/>
|
|
584
590
|
)}
|
|
585
591
|
</>
|
|
586
592
|
);
|
|
@@ -637,13 +643,15 @@ export function SideNavItem({
|
|
|
637
643
|
aria-expanded={!isItemCollapsed}
|
|
638
644
|
aria-controls={`${id}-children`}
|
|
639
645
|
{...stylex.props(styles.expandToggle)}>
|
|
640
|
-
<
|
|
641
|
-
|
|
646
|
+
<Icon
|
|
647
|
+
icon="chevronDown"
|
|
648
|
+
size="lg"
|
|
649
|
+
color="inherit"
|
|
650
|
+
xstyle={[
|
|
642
651
|
styles.expandChevron,
|
|
643
652
|
!isItemCollapsed && styles.expandChevronExpanded,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
</span>
|
|
653
|
+
]}
|
|
654
|
+
/>
|
|
647
655
|
</button>
|
|
648
656
|
</div>
|
|
649
657
|
);
|