@astryxdesign/core 0.4.6 → 0.4.7-canary.20bae6c
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 +36 -0
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +3 -2
- package/dist/AspectRatio/AspectRatio.d.ts +24 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +23 -4
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +3 -2
- package/dist/BottomSheet/BottomSheet.d.ts +1 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +54 -15
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts +6 -0
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -0
- package/dist/BottomSheet/BottomSheetEdgeTint.js +62 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +1 -0
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +1 -0
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +13 -6
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +23 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +11 -10
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +12 -4
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +13 -14
- package/dist/Calendar/getInitialFocusDate.d.ts +46 -0
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -0
- package/dist/Calendar/getInitialFocusDate.js +62 -0
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +3 -3
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +3 -3
- package/dist/Chat/ChatMessageList.d.ts +22 -3
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +6 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +3 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -3
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +3 -2
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +3 -2
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +4 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +3 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +34 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +3 -2
- package/dist/Dialog/Dialog.d.ts +7 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +89 -58
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +3 -2
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +6 -2
- package/dist/HoverCard/HoverCard.d.ts +6 -0
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +5 -0
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +67 -25
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +10 -3
- package/dist/Layer/LayerDepthContext.d.ts +52 -0
- package/dist/Layer/LayerDepthContext.d.ts.map +1 -0
- package/dist/Layer/LayerDepthContext.js +66 -0
- package/dist/Layer/index.d.ts +3 -0
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +4 -0
- package/dist/Layer/layerStack.d.ts +98 -0
- package/dist/Layer/layerStack.d.ts.map +1 -0
- package/dist/Layer/layerStack.js +306 -0
- package/dist/Layer/useLayerDismissal.d.ts +93 -0
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -0
- package/dist/Layer/useLayerDismissal.js +91 -0
- package/dist/Lightbox/Lightbox.d.ts +1 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +103 -81
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +38 -1
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +149 -23
- package/dist/MobileNav/MobileNav.d.ts +6 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +61 -36
- package/dist/MultiSelector/MultiSelector.d.ts +15 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +17 -6
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +3 -2
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +3 -2
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +3 -2
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +3 -2
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +20 -17
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +3 -4
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +3 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +3 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -3
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +5 -0
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +4 -3
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +4 -3
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -3
- package/dist/Stepper/Step.d.ts +140 -0
- package/dist/Stepper/Step.d.ts.map +1 -0
- package/dist/Stepper/Step.js +1045 -0
- package/dist/Stepper/StepStatus.d.ts +24 -0
- package/dist/Stepper/StepStatus.d.ts.map +1 -0
- package/dist/Stepper/StepStatus.js +1 -0
- package/dist/Stepper/Stepper.d.ts +93 -0
- package/dist/Stepper/Stepper.d.ts.map +1 -0
- package/dist/Stepper/Stepper.js +184 -0
- package/dist/Stepper/StepperContext.d.ts +41 -0
- package/dist/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/Stepper/StepperContext.js +34 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/Stepper/index.js +7 -0
- package/dist/Stepper/stepper.stylex.d.ts +15 -0
- package/dist/Stepper/stepper.stylex.d.ts.map +1 -0
- package/dist/Stepper/stepper.stylex.js +20 -0
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +3 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +3 -3
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +4 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +20 -8
- package/dist/Table/plugins/pagination/useTablePagination.d.ts +3 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +21 -4
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +10 -3
- package/dist/Table/plugins/selection/useTableSelection.d.ts +16 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +19 -5
- package/dist/Table/types.d.ts +22 -4
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +5 -0
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +6 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +3 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +3 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +3 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +5 -3
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +2 -2
- package/dist/Tooltip/Tooltip.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +5 -0
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +39 -24
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +3 -3
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +3 -3
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +3 -2
- package/dist/astryx.css +43 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -4
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +52 -91
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +10 -3
- package/dist/hooks/useListFocus.d.ts +5 -2
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +12 -6
- package/dist/hooks/useMergedRefs.d.ts +18 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/timeParser.d.ts +1 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +26 -12
- package/locales/en.json +27 -7
- package/locales/pseudo.json +15 -0
- package/package.json +8 -3
- package/src/AppShell/AppShell.tsx +3 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +6 -3
- package/src/AspectRatio/AspectRatio.test.tsx +57 -10
- package/src/AspectRatio/AspectRatio.tsx +40 -1
- package/src/Avatar/Avatar.doc.mjs +2 -1
- package/src/AvatarGroup/AvatarGroup.tsx +3 -2
- package/src/BottomSheet/BottomSheet.test.tsx +123 -0
- package/src/BottomSheet/BottomSheet.tsx +36 -4
- package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +225 -0
- package/src/BottomSheet/BottomSheetEdgeTint.tsx +82 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +66 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +19 -0
- package/src/BottomSheet/BottomSheetSwitcher.tsx +16 -2
- package/src/BottomSheet/useSheetGestures.test.ts +27 -0
- package/src/BottomSheet/useSheetGestures.ts +25 -5
- package/src/Breadcrumbs/BreadcrumbItem.tsx +9 -5
- package/src/Button/Button.doc.mjs +22 -0
- package/src/ButtonGroup/ButtonGroup.doc.mjs +7 -1
- package/src/ButtonGroup/ButtonGroup.test.tsx +185 -1
- package/src/ButtonGroup/ButtonGroup.tsx +11 -3
- package/src/Calendar/Calendar.doc.mjs +4 -3
- package/src/Calendar/Calendar.test.tsx +52 -0
- package/src/Calendar/Calendar.tsx +18 -15
- package/src/Calendar/getInitialFocusDate.test.ts +94 -0
- package/src/Calendar/getInitialFocusDate.ts +93 -0
- package/src/Carousel/Carousel.tsx +3 -2
- package/src/Chat/ChatLayout.tsx +3 -2
- package/src/Chat/ChatMessageList.doc.mjs +9 -1
- package/src/Chat/ChatMessageList.test.tsx +46 -0
- package/src/Chat/ChatMessageList.tsx +28 -4
- package/src/CheckboxInput/CheckboxInput.tsx +3 -2
- package/src/ClickableCard/ClickableCard.tsx +3 -2
- package/src/CodeBlock/CodeBlock.doc.mjs +6 -0
- package/src/CommandPalette/CommandPaletteInput.tsx +3 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +3 -2
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -0
- package/src/ContextMenu/ContextMenu.tsx +4 -3
- package/src/DateInput/DateInput.tsx +3 -2
- package/src/DateInput/DateInputTouch.test.tsx +36 -0
- package/src/DateInput/TouchDateField.tsx +35 -1
- package/src/DateTimeInput/DateTimeInput.tsx +2 -2
- package/src/Dialog/Dialog.doc.mjs +8 -3
- package/src/Dialog/Dialog.test.tsx +261 -1
- package/src/Dialog/Dialog.tsx +109 -58
- package/src/DropdownMenu/DropdownMenu.doc.mjs +6 -0
- package/src/Field/Field.doc.mjs +13 -2
- package/src/FileInput/FileInput.tsx +3 -2
- package/src/Heading/Heading.test.tsx +23 -1
- package/src/Heading/Heading.tsx +6 -2
- package/src/HoverCard/HoverCard.doc.mjs +5 -0
- package/src/HoverCard/HoverCard.tsx +6 -0
- package/src/HoverCard/useHoverCard.tsx +81 -30
- package/src/Item/Item.tsx +5 -4
- package/src/Kbd/Kbd.test.tsx +17 -0
- package/src/Kbd/Kbd.tsx +10 -3
- package/src/Layer/LayerDepthContext.tsx +62 -0
- package/src/Layer/index.ts +9 -0
- package/src/Layer/layerDismissalFamilies.test.tsx +359 -0
- package/src/Layer/layerDismissalInvariants.test.tsx +417 -0
- package/src/Layer/layerStack.ts +362 -0
- package/src/Layer/useLayerDismissal.test.tsx +469 -0
- package/src/Layer/useLayerDismissal.ts +173 -0
- package/src/Layout/Layout.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +12 -0
- package/src/Lightbox/Lightbox.tsx +124 -102
- package/src/Link/Link.doc.mjs +39 -0
- package/src/Markdown/index.ts +1 -0
- package/src/Markdown/parser.perf.test.ts +71 -1
- package/src/Markdown/parser.test.ts +145 -2
- package/src/Markdown/parser.ts +208 -22
- package/src/MobileNav/MobileNav.tsx +62 -36
- package/src/MoreMenu/MoreMenu.doc.mjs +7 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +27 -0
- package/src/MultiSelector/MultiSelector.test.tsx +105 -0
- package/src/MultiSelector/MultiSelector.tsx +50 -6
- package/src/MultiSelector/index.ts +1 -0
- package/src/NavMenu/NavHeadingMenu.tsx +3 -2
- package/src/NumberInput/NumberInput.doc.mjs +5 -0
- package/src/Outline/Outline.tsx +3 -2
- package/src/OverflowList/OverflowList.tsx +3 -2
- package/src/Overlay/Overlay.tsx +3 -2
- package/src/Popover/Popover.test.tsx +27 -1
- package/src/Popover/usePopover.tsx +31 -28
- package/src/PowerSearch/PowerSearch.doc.mjs +26 -0
- package/src/PowerSearch/PowerSearch.tsx +5 -2
- package/src/Resizable/ResizeHandle.tsx +3 -2
- package/src/SegmentedControl/SegmentedControl.tsx +3 -2
- package/src/SelectableCard/SelectableCard.tsx +3 -2
- package/src/Selector/Selector.doc.mjs +12 -1
- package/src/Selector/Selector.test.tsx +21 -0
- package/src/Selector/Selector.tsx +11 -1
- package/src/SideNav/SideNav.doc.mjs +6 -6
- package/src/SideNav/SideNav.tsx +4 -2
- package/src/SideNav/SideNavItem.tsx +4 -2
- package/src/Slider/Slider.tsx +3 -2
- package/src/Stepper/Step.doc.mjs +98 -0
- package/src/Stepper/Step.tsx +1638 -0
- package/src/Stepper/StepStatus.ts +26 -0
- package/src/Stepper/Stepper.doc.mjs +370 -0
- package/src/Stepper/Stepper.test.tsx +1024 -0
- package/src/Stepper/Stepper.tsx +258 -0
- package/src/Stepper/StepperContext.ts +71 -0
- package/src/Stepper/index.ts +18 -0
- package/src/Stepper/stepper.stylex.ts +19 -0
- package/src/Switch/Switch.tsx +3 -2
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.test.tsx +21 -4
- package/src/TabList/TabList.tsx +3 -2
- package/src/Table/BaseTable.tsx +6 -3
- package/src/Table/Table.test.tsx +35 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows-perf.test.tsx +112 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +100 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +17 -8
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +34 -4
- package/src/Table/plugins/pagination/useTablePagination.tsx +35 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -2
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +13 -7
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +12 -3
- package/src/Table/plugins/selection/useTableSelection.test.tsx +76 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +40 -7
- package/src/Table/types.ts +22 -4
- package/src/Table/useBaseTablePlugins.ts +5 -0
- package/src/Table/useTableGroupedRows.doc.mjs +5 -4
- package/src/Table/useTablePagination.doc.mjs +7 -0
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/Table/useTableSelection.doc.mjs +31 -0
- package/src/Text/Text.test.tsx +23 -1
- package/src/Text/Text.tsx +6 -2
- package/src/TextArea/TextArea.tsx +3 -2
- package/src/TextInput/TextInput.doc.mjs +10 -0
- package/src/TextInput/TextInput.tsx +3 -2
- package/src/Thumbnail/Thumbnail.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.tsx +2 -2
- package/src/Timestamp/Timestamp.tsx +4 -2
- package/src/Toast/Toast.doc.mjs +6 -0
- package/src/Token/TokenLink.tsx +2 -2
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Toolbar/Toolbar.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.test.tsx +32 -0
- package/src/Tooltip/Tooltip.tsx +5 -0
- package/src/Tooltip/useTooltip.tsx +47 -24
- package/src/TopNav/TopNavMegaMenu.tsx +3 -2
- package/src/Typeahead/BaseTypeahead.tsx +3 -2
- package/src/Typeahead/Typeahead.doc.mjs +5 -0
- package/src/Typeahead/Typeahead.tsx +3 -2
- package/src/__tests__/complexComponentContract.test.tsx +81 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useContainerReveal.doc.mjs +2 -2
- package/src/hooks/useFocusTrap.ts +54 -107
- package/src/hooks/useFocusTrapEscapeShim.test.tsx +165 -0
- package/src/hooks/useHotkeys.test.ts +18 -0
- package/src/hooks/useHotkeys.ts +10 -3
- package/src/hooks/useListFocus.doc.mjs +2 -2
- package/src/hooks/useListFocus.test.tsx +65 -3
- package/src/hooks/useListFocus.ts +15 -7
- package/src/hooks/useMergedRefs.doc.mjs +79 -0
- package/src/hooks/useMergedRefs.test.tsx +62 -0
- package/src/hooks/useMergedRefs.ts +36 -0
- package/src/index.ts +1 -0
- package/src/theme/MediaTheme.doc.mjs +5 -5
- package/src/utils/timeParser.test.ts +6 -1
- package/src/utils/timeParser.ts +35 -13
- package/src/__tests__/inputWidthContract.test.tsx +0 -69
|
@@ -128,6 +128,90 @@ describe('MultiSelector', () => {
|
|
|
128
128
|
expect(screen.getByText('2 selected')).toBeInTheDocument();
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
+
it('formats the count display with formatValue', () => {
|
|
132
|
+
render(
|
|
133
|
+
<MultiSelector
|
|
134
|
+
label="Spaces"
|
|
135
|
+
options={defaultOptions}
|
|
136
|
+
value={['Apple', 'Banana']}
|
|
137
|
+
onChange={() => {}}
|
|
138
|
+
formatValue={items => `${items.length} spaces selected`}
|
|
139
|
+
/>,
|
|
140
|
+
);
|
|
141
|
+
expect(screen.getByText('2 spaces selected')).toBeInTheDocument();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('passes selected values and resolved labels to formatValue', () => {
|
|
145
|
+
const formatValue = vi.fn(
|
|
146
|
+
(items: {value: string; label: string}[]) =>
|
|
147
|
+
`${items[0].label} and ${items.length - 1} more`,
|
|
148
|
+
);
|
|
149
|
+
render(
|
|
150
|
+
<MultiSelector
|
|
151
|
+
label="Fruit"
|
|
152
|
+
options={[
|
|
153
|
+
{value: 'a', label: 'Apple'},
|
|
154
|
+
{value: 'b', label: 'Banana'},
|
|
155
|
+
]}
|
|
156
|
+
value={['a', 'b']}
|
|
157
|
+
onChange={() => {}}
|
|
158
|
+
formatValue={formatValue}
|
|
159
|
+
/>,
|
|
160
|
+
);
|
|
161
|
+
expect(formatValue).toHaveBeenCalledWith([
|
|
162
|
+
{value: 'a', label: 'Apple'},
|
|
163
|
+
{value: 'b', label: 'Banana'},
|
|
164
|
+
]);
|
|
165
|
+
expect(screen.getByText('Apple and 1 more')).toBeInTheDocument();
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('formats the labels display with formatValue', () => {
|
|
169
|
+
render(
|
|
170
|
+
<MultiSelector
|
|
171
|
+
label="Fruit"
|
|
172
|
+
options={defaultOptions}
|
|
173
|
+
value={['Apple', 'Banana', 'Orange']}
|
|
174
|
+
onChange={() => {}}
|
|
175
|
+
triggerDisplay="labels"
|
|
176
|
+
formatValue={items => items.map(item => item.label).join(' & ')}
|
|
177
|
+
/>,
|
|
178
|
+
);
|
|
179
|
+
expect(screen.getByText('Apple & Banana & Orange')).toBeInTheDocument();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('ignores formatValue in badges display', () => {
|
|
183
|
+
render(
|
|
184
|
+
<MultiSelector
|
|
185
|
+
label="Fruit"
|
|
186
|
+
options={defaultOptions}
|
|
187
|
+
value={['Apple', 'Banana']}
|
|
188
|
+
onChange={() => {}}
|
|
189
|
+
triggerDisplay="badges"
|
|
190
|
+
formatValue={() => 'formatted'}
|
|
191
|
+
/>,
|
|
192
|
+
);
|
|
193
|
+
expect(screen.queryByText('formatted')).not.toBeInTheDocument();
|
|
194
|
+
const trigger = within(screen.getByRole('combobox'));
|
|
195
|
+
expect(trigger.getByText('Apple')).toBeInTheDocument();
|
|
196
|
+
expect(trigger.getByText('Banana')).toBeInTheDocument();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('shows the placeholder rather than calling formatValue when empty', () => {
|
|
200
|
+
const formatValue = vi.fn(() => 'formatted');
|
|
201
|
+
render(
|
|
202
|
+
<MultiSelector
|
|
203
|
+
label="Fruit"
|
|
204
|
+
options={defaultOptions}
|
|
205
|
+
value={[]}
|
|
206
|
+
onChange={() => {}}
|
|
207
|
+
placeholder="Pick fruits..."
|
|
208
|
+
formatValue={formatValue}
|
|
209
|
+
/>,
|
|
210
|
+
);
|
|
211
|
+
expect(screen.getByText('Pick fruits...')).toBeInTheDocument();
|
|
212
|
+
expect(formatValue).not.toHaveBeenCalled();
|
|
213
|
+
});
|
|
214
|
+
|
|
131
215
|
it('shows labels display', () => {
|
|
132
216
|
render(
|
|
133
217
|
<MultiSelector
|
|
@@ -1981,6 +2065,27 @@ describe('MultiSelector list structure', () => {
|
|
|
1981
2065
|
Node.DOCUMENT_POSITION_FOLLOWING,
|
|
1982
2066
|
).toBeTruthy();
|
|
1983
2067
|
});
|
|
2068
|
+
|
|
2069
|
+
it('hides a standalone divider from the accessibility tree (#4994)', async () => {
|
|
2070
|
+
const user = userEvent.setup();
|
|
2071
|
+
render(
|
|
2072
|
+
<MultiSelector
|
|
2073
|
+
label="Fruit"
|
|
2074
|
+
options={['Apple', {type: 'divider'}, 'Banana']}
|
|
2075
|
+
value={[]}
|
|
2076
|
+
onChange={() => {}}
|
|
2077
|
+
/>,
|
|
2078
|
+
);
|
|
2079
|
+
await user.click(screen.getByRole('combobox'));
|
|
2080
|
+
|
|
2081
|
+
// role="listbox" only permits option/group children. The divider still
|
|
2082
|
+
// renders role="separator" (unchanged visual/DOM), but must be excluded
|
|
2083
|
+
// from the accessibility tree so it never reaches the listbox's exposed
|
|
2084
|
+
// children (axe aria-required-children).
|
|
2085
|
+
const divider = document.querySelector('[role="separator"]');
|
|
2086
|
+
expect(divider).toBeTruthy();
|
|
2087
|
+
expect(divider).toHaveAttribute('aria-hidden', 'true');
|
|
2088
|
+
});
|
|
1984
2089
|
});
|
|
1985
2090
|
|
|
1986
2091
|
describe('MultiSelector search affordances', () => {
|
|
@@ -424,6 +424,11 @@ export type MultiSelectorStatusType = 'warning' | 'error' | 'success';
|
|
|
424
424
|
|
|
425
425
|
export type {MultiSelectorStatus};
|
|
426
426
|
|
|
427
|
+
export interface MultiSelectorSelectedItem {
|
|
428
|
+
value: string;
|
|
429
|
+
label: string;
|
|
430
|
+
}
|
|
431
|
+
|
|
427
432
|
export interface MultiSelectorProps<
|
|
428
433
|
T extends MultiSelectorOptionType = MultiSelectorOptionType,
|
|
429
434
|
> extends Omit<BaseProps, 'onChange' | 'defaultValue'> {
|
|
@@ -608,6 +613,17 @@ export interface MultiSelectorProps<
|
|
|
608
613
|
*/
|
|
609
614
|
triggerDisplay?: 'count' | 'labels' | 'badges';
|
|
610
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Formats the trigger text when triggerDisplay is 'count' or 'labels'.
|
|
618
|
+
* Receives the selected items (value plus resolved label, in selection
|
|
619
|
+
* order) and returns the full trigger text; the count is `items.length`.
|
|
620
|
+
* Not called when nothing is selected — the placeholder shows instead — and
|
|
621
|
+
* not called for triggerDisplay 'badges', which renders Badge elements
|
|
622
|
+
* rather than text.
|
|
623
|
+
* @default items => `${items.length} selected` for 'count', "A, B, C, +N" for 'labels'
|
|
624
|
+
*/
|
|
625
|
+
formatValue?: (items: MultiSelectorSelectedItem[]) => string;
|
|
626
|
+
|
|
611
627
|
/**
|
|
612
628
|
* Maximum number of badges to show before showing "+N".
|
|
613
629
|
* Only used when triggerDisplay is 'badges'.
|
|
@@ -711,6 +727,7 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
711
727
|
hasSearch = false,
|
|
712
728
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
713
729
|
triggerDisplay = 'count',
|
|
730
|
+
formatValue,
|
|
714
731
|
maxBadges = 3,
|
|
715
732
|
renderOption,
|
|
716
733
|
indicatorPosition = 'start',
|
|
@@ -1107,13 +1124,18 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
1107
1124
|
}, [popover.isOpen, highlightedIndex, getItemId]);
|
|
1108
1125
|
|
|
1109
1126
|
// Build trigger display content
|
|
1110
|
-
const
|
|
1127
|
+
const selectedItems = useMemo(() => {
|
|
1111
1128
|
return optimisticValue.map(v => {
|
|
1112
1129
|
const item = selectableItems.find(i => i.value === v);
|
|
1113
|
-
return item?.label ?? v;
|
|
1130
|
+
return {value: v, label: item?.label ?? v};
|
|
1114
1131
|
});
|
|
1115
1132
|
}, [optimisticValue, selectableItems]);
|
|
1116
1133
|
|
|
1134
|
+
const selectedLabels = useMemo(
|
|
1135
|
+
() => selectedItems.map(item => item.label),
|
|
1136
|
+
[selectedItems],
|
|
1137
|
+
);
|
|
1138
|
+
|
|
1117
1139
|
const renderTriggerContent = useCallback(() => {
|
|
1118
1140
|
if (optimisticValue.length === 0) {
|
|
1119
1141
|
return <span {...stylex.props(styles.triggerText)}>{placeholder}</span>;
|
|
@@ -1123,7 +1145,8 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
1123
1145
|
case 'count':
|
|
1124
1146
|
return (
|
|
1125
1147
|
<span {...stylex.props(styles.triggerText)}>
|
|
1126
|
-
{
|
|
1148
|
+
{formatValue?.(selectedItems) ??
|
|
1149
|
+
`${optimisticValue.length} selected`}
|
|
1127
1150
|
</span>
|
|
1128
1151
|
);
|
|
1129
1152
|
|
|
@@ -1134,7 +1157,11 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
1134
1157
|
remaining > 0
|
|
1135
1158
|
? `${displayed.join(', ')}, +${remaining}`
|
|
1136
1159
|
: displayed.join(', ');
|
|
1137
|
-
return
|
|
1160
|
+
return (
|
|
1161
|
+
<span {...stylex.props(styles.triggerText)}>
|
|
1162
|
+
{formatValue?.(selectedItems) ?? text}
|
|
1163
|
+
</span>
|
|
1164
|
+
);
|
|
1138
1165
|
}
|
|
1139
1166
|
|
|
1140
1167
|
case 'badges': {
|
|
@@ -1154,7 +1181,15 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
1154
1181
|
);
|
|
1155
1182
|
}
|
|
1156
1183
|
}
|
|
1157
|
-
}, [
|
|
1184
|
+
}, [
|
|
1185
|
+
optimisticValue,
|
|
1186
|
+
triggerDisplay,
|
|
1187
|
+
selectedItems,
|
|
1188
|
+
selectedLabels,
|
|
1189
|
+
placeholder,
|
|
1190
|
+
formatValue,
|
|
1191
|
+
maxBadges,
|
|
1192
|
+
]);
|
|
1158
1193
|
|
|
1159
1194
|
// Render search input
|
|
1160
1195
|
const renderSearch = useCallback(() => {
|
|
@@ -1420,8 +1455,17 @@ export function MultiSelector<T extends MultiSelectorOptionType>({
|
|
|
1420
1455
|
// A standalone divider between groups would orphan itself once its
|
|
1421
1456
|
// neighbors are filtered out, so skip it while searching.
|
|
1422
1457
|
if (!isSearching) {
|
|
1458
|
+
// role="listbox" only permits option/group children; the divider
|
|
1459
|
+
// carries no information the options don't, so it's hidden from
|
|
1460
|
+
// the accessibility tree entirely rather than exposing
|
|
1461
|
+
// role="separator" as a disallowed listbox child (axe
|
|
1462
|
+
// aria-required-children).
|
|
1423
1463
|
elements.push(
|
|
1424
|
-
<Divider
|
|
1464
|
+
<Divider
|
|
1465
|
+
key={`divider-${i}`}
|
|
1466
|
+
aria-hidden="true"
|
|
1467
|
+
xstyle={styles.divider}
|
|
1468
|
+
/>,
|
|
1425
1469
|
);
|
|
1426
1470
|
}
|
|
1427
1471
|
} else if (isSection(option)) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import React, {useCallback, useMemo, type ReactNode} from 'react';
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
17
|
import {spacingVars} from '../theme/tokens.stylex';
|
|
18
|
-
import {mergeProps
|
|
18
|
+
import {mergeProps} from '../utils';
|
|
19
19
|
import type {BaseProps} from '../BaseProps';
|
|
20
20
|
import {useListFocus} from '../hooks/useListFocus';
|
|
21
21
|
import {useTypeahead} from '../hooks/useTypeahead';
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type NavHeadingMenuSize,
|
|
27
27
|
} from './NavMenuContext';
|
|
28
28
|
|
|
29
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
29
30
|
const styles = stylex.create({
|
|
30
31
|
root: {
|
|
31
32
|
display: 'flex',
|
|
@@ -162,7 +163,7 @@ export function NavHeadingMenu({
|
|
|
162
163
|
return (
|
|
163
164
|
<NavHeadingMenuContext value={ctx}>
|
|
164
165
|
<div
|
|
165
|
-
ref={
|
|
166
|
+
ref={useMergedRefs(ref, listRef)}
|
|
166
167
|
role="menu"
|
|
167
168
|
onKeyDown={listKeyDown}
|
|
168
169
|
data-testid={testId}
|
|
@@ -61,6 +61,11 @@ export const docs = {
|
|
|
61
61
|
description:
|
|
62
62
|
'Whether the field is optional (mutually exclusive with isRequired).',
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
name: 'onKeyDown',
|
|
66
|
+
type: '(e: KeyboardEvent<HTMLInputElement>) => void',
|
|
67
|
+
description: 'Callback fired on keydown events on the input.',
|
|
68
|
+
},
|
|
64
69
|
{
|
|
65
70
|
name: 'isRequired',
|
|
66
71
|
type: 'boolean',
|
package/src/Outline/Outline.tsx
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import {useLinkComponent} from '../Link/useLinkComponent';
|
|
38
38
|
import {useListFocus} from '../hooks/useListFocus';
|
|
39
39
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
40
|
-
import {mergeProps
|
|
40
|
+
import {mergeProps} from '../utils';
|
|
41
41
|
import type {BaseProps} from '../BaseProps';
|
|
42
42
|
import {useScrollSpy} from './useScrollSpy';
|
|
43
43
|
import type {OutlineItem} from './types';
|
|
@@ -45,6 +45,7 @@ import {themeProps} from '../utils/themeProps';
|
|
|
45
45
|
import {focusOutlineProps} from '../utils/focusOutline.stylex';
|
|
46
46
|
import {useTranslator} from '../i18n';
|
|
47
47
|
|
|
48
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
48
49
|
export type {OutlineItem} from './types';
|
|
49
50
|
|
|
50
51
|
export interface OutlineProps extends BaseProps<HTMLElement> {
|
|
@@ -443,7 +444,7 @@ export function Outline({
|
|
|
443
444
|
return (
|
|
444
445
|
<nav
|
|
445
446
|
{...props}
|
|
446
|
-
ref={
|
|
447
|
+
ref={useMergedRefs(rootRef, ref)}
|
|
447
448
|
aria-label={label}
|
|
448
449
|
data-testid={testId}
|
|
449
450
|
{...mergeProps(
|
|
@@ -22,11 +22,12 @@ import {type ReactNode, type ReactElement, Children} from 'react';
|
|
|
22
22
|
import type {BaseProps} from '../BaseProps';
|
|
23
23
|
import type {SpacingStep} from '../utils/types';
|
|
24
24
|
import * as stylex from '@stylexjs/stylex';
|
|
25
|
-
import {mergeProps
|
|
25
|
+
import {mergeProps} from '../utils';
|
|
26
26
|
import {useOverflow} from '../hooks/useOverflow';
|
|
27
27
|
import {spacingVars} from '../theme/tokens.stylex';
|
|
28
28
|
import {themeProps} from '../utils/themeProps';
|
|
29
29
|
|
|
30
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
30
31
|
const styles = stylex.create({
|
|
31
32
|
container: {
|
|
32
33
|
display: 'flex',
|
|
@@ -280,7 +281,7 @@ export function OverflowList({
|
|
|
280
281
|
|
|
281
282
|
{/* Visible container */}
|
|
282
283
|
<div
|
|
283
|
-
ref={
|
|
284
|
+
ref={useMergedRefs(ref, containerRef)}
|
|
284
285
|
{...mergeProps(
|
|
285
286
|
themeProps('overflow-list'),
|
|
286
287
|
stylex.props(
|
package/src/Overlay/Overlay.tsx
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import type {ReactNode, Ref} from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
|
-
import {mergeProps
|
|
20
|
+
import {mergeProps} from '../utils';
|
|
21
21
|
import {useOverlay} from './useOverlay';
|
|
22
22
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
23
23
|
import {overlayScope, overlayContainerStyles} from './overlay.markers.stylex';
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
OverlayShowOn,
|
|
31
31
|
} from './OverlayScrim';
|
|
32
32
|
|
|
33
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
33
34
|
export interface OverlayProps extends Pick<
|
|
34
35
|
BaseProps<HTMLDivElement>,
|
|
35
36
|
'xstyle' | 'className' | 'style'
|
|
@@ -113,7 +114,7 @@ export function Overlay({
|
|
|
113
114
|
|
|
114
115
|
return (
|
|
115
116
|
<div
|
|
116
|
-
ref={
|
|
117
|
+
ref={useMergedRefs(ref, overlay.containerRef)}
|
|
117
118
|
{...mergeProps(
|
|
118
119
|
themeProps('overlay'),
|
|
119
120
|
stylex.props(overlayScope, overlayContainerStyles.root, xstyle),
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Popover.test.tsx
|
|
5
|
-
* @input Uses vitest, @testing-library/react, Popover
|
|
5
|
+
* @input Uses vitest, @testing-library/react, Popover, Dialog,
|
|
6
|
+
* SegmentedControl
|
|
6
7
|
* @output Unit tests for Popover component behavior
|
|
7
8
|
* @position Testing; validates Popover.tsx implementation
|
|
8
9
|
*
|
|
@@ -14,6 +15,7 @@ import {render, screen, fireEvent} from '@testing-library/react';
|
|
|
14
15
|
import React, {useRef} from 'react';
|
|
15
16
|
import {Popover} from './Popover';
|
|
16
17
|
import {Dialog} from '../Dialog';
|
|
18
|
+
import {SegmentedControl, SegmentedControlItem} from '../SegmentedControl';
|
|
17
19
|
|
|
18
20
|
// Store original matches to restore later
|
|
19
21
|
const originalMatches = HTMLElement.prototype.matches;
|
|
@@ -306,6 +308,30 @@ describe('Popover', () => {
|
|
|
306
308
|
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
307
309
|
});
|
|
308
310
|
|
|
311
|
+
it('dismisses on Escape pressed inside a roving-focus list', () => {
|
|
312
|
+
render(
|
|
313
|
+
<Popover
|
|
314
|
+
content={
|
|
315
|
+
<SegmentedControl value="grid" onChange={() => {}} label="View">
|
|
316
|
+
<SegmentedControlItem value="grid" label="Grid" />
|
|
317
|
+
<SegmentedControlItem value="list" label="List" />
|
|
318
|
+
</SegmentedControl>
|
|
319
|
+
}
|
|
320
|
+
label="Test">
|
|
321
|
+
<button type="button">Open</button>
|
|
322
|
+
</Popover>,
|
|
323
|
+
);
|
|
324
|
+
const trigger = screen.getByRole('button', {name: 'Open'});
|
|
325
|
+
fireEvent.click(trigger);
|
|
326
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'true');
|
|
327
|
+
|
|
328
|
+
// From the segment, so the list's own key handler runs first. jsdom has
|
|
329
|
+
// no popover display, so the open content still reads as hidden.
|
|
330
|
+
const segment = screen.getByRole('radio', {name: 'Grid', hidden: true});
|
|
331
|
+
fireEvent.keyDown(segment, {key: 'Escape'});
|
|
332
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
333
|
+
});
|
|
334
|
+
|
|
309
335
|
it('stays open on Escape when hasEscapeDismiss is false', () => {
|
|
310
336
|
render(
|
|
311
337
|
<Popover
|
|
@@ -19,6 +19,7 @@ import React, {useCallback, useEffect, useRef, type ReactNode} from 'react';
|
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import {useLayer, type ContextRenderProps} from '../Layer/useLayer';
|
|
21
21
|
import {useFocusTrap} from '../hooks/useFocusTrap';
|
|
22
|
+
import {LayerDepthProvider} from '../Layer/LayerDepthContext';
|
|
22
23
|
import type {StyleXStyles} from '@stylexjs/stylex';
|
|
23
24
|
import {
|
|
24
25
|
colorVars,
|
|
@@ -436,34 +437,36 @@ export function usePopover(options: UsePopoverOptions = {}): UsePopoverReturn {
|
|
|
436
437
|
: surfaceProps.className;
|
|
437
438
|
|
|
438
439
|
return layer.render(
|
|
439
|
-
<
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
{...
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
440
|
+
<LayerDepthProvider>
|
|
441
|
+
<div
|
|
442
|
+
ref={contentRef}
|
|
443
|
+
role={role === 'dialog' ? 'dialog' : undefined}
|
|
444
|
+
aria-modal={role === 'dialog' && isModal ? true : undefined}
|
|
445
|
+
aria-label={role === 'dialog' ? dialogLabel : undefined}
|
|
446
|
+
{...mergeProps(
|
|
447
|
+
{...surfaceProps, className: surfaceClassName},
|
|
448
|
+
stylex.props(
|
|
449
|
+
styles.contentWrapper,
|
|
450
|
+
hasSurface && styles.surface,
|
|
451
|
+
xstyle,
|
|
452
|
+
),
|
|
453
|
+
)}>
|
|
454
|
+
{children}
|
|
455
|
+
{hasCloseButton && (
|
|
456
|
+
<div
|
|
457
|
+
{...stylex.props(
|
|
458
|
+
styles.closeButtonWrapper,
|
|
459
|
+
rtlStyles.centerInline('100%'),
|
|
460
|
+
)}>
|
|
461
|
+
<Button
|
|
462
|
+
variant="secondary"
|
|
463
|
+
label={closeButtonLabel}
|
|
464
|
+
onClick={layer.hide}
|
|
465
|
+
/>
|
|
466
|
+
</div>
|
|
467
|
+
)}
|
|
468
|
+
</div>
|
|
469
|
+
</LayerDepthProvider>,
|
|
467
470
|
{...props, xstyle: props?.xstyle},
|
|
468
471
|
);
|
|
469
472
|
},
|
|
@@ -142,6 +142,32 @@ export const docs = {
|
|
|
142
142
|
description: 'Size of the search input and tokens.',
|
|
143
143
|
default: "'md'",
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
name: 'menuWidth',
|
|
147
|
+
type: 'number',
|
|
148
|
+
description: 'Maximum width for the operator/value dropdown menu in pixels.',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'maxOperatorMenuItems',
|
|
152
|
+
type: 'number',
|
|
153
|
+
description: 'Maximum number of items displayed in the operator dropdown.',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'tokenOverflowBehavior',
|
|
157
|
+
type: "'none' | 'unfocusedInline' | 'unfocusedLayer'",
|
|
158
|
+
description: 'Controls how tokens overflow when the container is too narrow. Forwarded to Tokenizer.',
|
|
159
|
+
default: "'none'",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'onFocus',
|
|
163
|
+
type: '(e: FocusEvent<HTMLInputElement>) => void',
|
|
164
|
+
description: 'Fires when focus enters the search input.',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'onBlur',
|
|
168
|
+
type: '(e: FocusEvent<HTMLInputElement>) => void',
|
|
169
|
+
description: 'Fires when focus leaves the search input.',
|
|
170
|
+
},
|
|
145
171
|
{
|
|
146
172
|
name: 'xstyle',
|
|
147
173
|
type: 'StyleXStyles',
|
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
typeScaleVars,
|
|
47
47
|
fontWeightVars,
|
|
48
48
|
} from '../theme/tokens.stylex';
|
|
49
|
-
import {mergeRefs} from '../utils';
|
|
50
49
|
import {useSize} from '../SizeContext/SizeContext';
|
|
51
50
|
import {useInternalConfig} from './useInternalConfig';
|
|
52
51
|
import {usePowerSearchSource} from './usePowerSearchSource';
|
|
@@ -75,6 +74,7 @@ import type {
|
|
|
75
74
|
PowerSearchComponents,
|
|
76
75
|
} from './types';
|
|
77
76
|
|
|
77
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
78
78
|
// =============================================================================
|
|
79
79
|
// Icon mapping for typeahead entries
|
|
80
80
|
// =============================================================================
|
|
@@ -1029,7 +1029,10 @@ export function PowerSearch({
|
|
|
1029
1029
|
return (
|
|
1030
1030
|
<>
|
|
1031
1031
|
<div
|
|
1032
|
-
ref={
|
|
1032
|
+
ref={useMergedRefs(
|
|
1033
|
+
ref,
|
|
1034
|
+
popover.triggerRef as React.Ref<HTMLDivElement>,
|
|
1035
|
+
)}
|
|
1033
1036
|
{...themeProps('power-search')}>
|
|
1034
1037
|
<Tokenizer
|
|
1035
1038
|
handleRef={tokenizerRef}
|
|
@@ -35,11 +35,12 @@ import {
|
|
|
35
35
|
spacingVars,
|
|
36
36
|
} from '../theme/tokens.stylex';
|
|
37
37
|
import {focusOutlineProps} from '../utils/focusOutline.stylex';
|
|
38
|
-
import {mergeProps,
|
|
38
|
+
import {mergeProps, rtlStyles} from '../utils';
|
|
39
39
|
import type {ResizableProps} from './useResizable';
|
|
40
40
|
import {themeProps} from '../utils/themeProps';
|
|
41
41
|
import {useTranslator} from '../i18n';
|
|
42
42
|
|
|
43
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
43
44
|
const KEYBOARD_STEP = 10;
|
|
44
45
|
const KEYBOARD_LARGE_STEP = 50;
|
|
45
46
|
|
|
@@ -549,7 +550,7 @@ export function ResizeHandle({
|
|
|
549
550
|
|
|
550
551
|
return (
|
|
551
552
|
<div
|
|
552
|
-
ref={
|
|
553
|
+
ref={useMergedRefs(ref, handleRef)}
|
|
553
554
|
role="separator"
|
|
554
555
|
aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}
|
|
555
556
|
aria-valuenow={ariaValueNow}
|
|
@@ -26,11 +26,12 @@ import type {
|
|
|
26
26
|
SegmentedControlSize,
|
|
27
27
|
SegmentedControlLayout,
|
|
28
28
|
} from './SegmentedControlContext';
|
|
29
|
-
import {mergeProps,
|
|
29
|
+
import {mergeProps, composeEventHandlers} from '../utils';
|
|
30
30
|
import {useSize} from '../SizeContext/SizeContext';
|
|
31
31
|
import type {BaseProps} from '../BaseProps';
|
|
32
32
|
import {themeProps} from '../utils/themeProps';
|
|
33
33
|
|
|
34
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
34
35
|
export interface SegmentedControlProps extends Omit<
|
|
35
36
|
BaseProps<HTMLDivElement>,
|
|
36
37
|
'onChange'
|
|
@@ -258,7 +259,7 @@ export function SegmentedControl({
|
|
|
258
259
|
return (
|
|
259
260
|
<SegmentedControlContext value={contextValue}>
|
|
260
261
|
<div
|
|
261
|
-
ref={
|
|
262
|
+
ref={useMergedRefs(ref, listRef, disabledMessageTooltip.ref)}
|
|
262
263
|
{...rest}
|
|
263
264
|
role="radiogroup"
|
|
264
265
|
aria-label={label}
|
|
@@ -40,7 +40,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
40
40
|
import type {StyleXStyles} from '@stylexjs/stylex';
|
|
41
41
|
import {colorVars, durationVars, easeVars} from '../theme/tokens.stylex';
|
|
42
42
|
import type {Elevation, SizeValue, SpacingStep} from '../utils/types';
|
|
43
|
-
import {mergeProps
|
|
43
|
+
import {mergeProps} from '../utils';
|
|
44
44
|
import {Card} from '../Card/Card';
|
|
45
45
|
import type {CardVariant} from '../Card/Card';
|
|
46
46
|
import {useClickableContainer} from '../hooks/useClickableContainer';
|
|
@@ -48,6 +48,7 @@ import type {BaseProps} from '../BaseProps';
|
|
|
48
48
|
import {themeProps} from '../utils/themeProps';
|
|
49
49
|
import {focusOutlineProps} from '../utils/focusOutline.stylex';
|
|
50
50
|
|
|
51
|
+
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
51
52
|
// =============================================================================
|
|
52
53
|
// Styles — selection + interaction; Card handles the rest
|
|
53
54
|
// =============================================================================
|
|
@@ -346,7 +347,7 @@ export function SelectableCard({
|
|
|
346
347
|
|
|
347
348
|
return (
|
|
348
349
|
<Card
|
|
349
|
-
ref={
|
|
350
|
+
ref={useMergedRefs(ref, containerRef)}
|
|
350
351
|
width={width}
|
|
351
352
|
height={height}
|
|
352
353
|
maxWidth={maxWidth}
|
|
@@ -171,7 +171,7 @@ export const docs = {
|
|
|
171
171
|
name: 'renderValue',
|
|
172
172
|
type: '(option: SelectorOptionData) => ReactNode',
|
|
173
173
|
description:
|
|
174
|
-
'Custom render function for the selected option inside the closed trigger. The trigger is sized by padding, so it is the size token for a one-line value (28/32/36) and exactly one text line taller for a two-line one (48/52/56)
|
|
174
|
+
'Custom render function for the selected option inside the closed trigger. The trigger is sized by padding, so it is the size token for a one-line value (28/32/36) and exactly one text line taller for a two-line one (48/52/56), always on the 4px rhythm, always aligned with the buttons and inputs beside it. Inside an InputGroup the group owns the row height: a SelectorOption folds onto one line and ellipsizes, and any taller node is cut off at the row.',
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
name: 'indicatorPosition',
|
|
@@ -186,6 +186,17 @@ export const docs = {
|
|
|
186
186
|
description:
|
|
187
187
|
'Width of the field (number = pixels, string used as-is, e.g. "100%"). Sizes the whole field (label, control, and status) so they stay aligned.',
|
|
188
188
|
},
|
|
189
|
+
{
|
|
190
|
+
name: 'startIcon',
|
|
191
|
+
type: 'IconType | ReactNode',
|
|
192
|
+
description: 'Icon displayed at the start of the selector trigger.',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'isLoading',
|
|
196
|
+
type: 'boolean',
|
|
197
|
+
description: 'Shows a loading spinner in the trigger.',
|
|
198
|
+
default: 'false',
|
|
199
|
+
},
|
|
189
200
|
{
|
|
190
201
|
name: 'xstyle',
|
|
191
202
|
type: 'StyleXStyles',
|