@astryxdesign/core 0.5.2-canary.2da7a39 → 0.5.2-canary.2e51213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/AppShell.d.ts +2 -2
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +10 -7
- package/dist/Banner/Banner.d.ts +5 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +7 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +3 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +22 -15
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -2
- package/dist/Chat/ChatComposer.d.ts +2 -2
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +21 -2
- package/dist/Chat/ChatToolCalls.d.ts +1 -1
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +12 -34
- package/dist/Chat/useChatNewMessages.js +3 -3
- package/dist/CheckboxList/CheckboxListItem.d.ts +5 -3
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts +47 -13
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +269 -162
- package/dist/DateTimeInput/NativeDateSegment.d.ts +24 -0
- package/dist/DateTimeInput/NativeDateSegment.d.ts.map +1 -0
- package/dist/DateTimeInput/NativeDateSegment.js +235 -0
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +30 -0
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -0
- package/dist/DateTimeInput/NativeTimeSegment.js +248 -0
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +95 -0
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts.map +1 -0
- package/dist/DateTimeInput/nativePickerSegmentStyles.js +103 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +2 -4
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +10 -4
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +3 -5
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +4 -2
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +2 -4
- package/dist/Layout/Layout.d.ts +7 -8
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +7 -8
- package/dist/MultiSelector/MultiSelector.d.ts +11 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +89 -45
- package/dist/RadioList/RadioListItem.d.ts +30 -5
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +17 -4
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +102 -44
- package/dist/Resizable/index.d.ts +2 -0
- package/dist/Resizable/index.d.ts.map +1 -1
- package/dist/Resizable/index.js +1 -0
- package/dist/Resizable/useResizable.d.ts +89 -8
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +521 -38
- package/dist/Resizable/utils.d.ts +35 -0
- package/dist/Resizable/utils.d.ts.map +1 -0
- package/dist/Resizable/utils.js +27 -0
- package/dist/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +105 -57
- package/dist/Selector/useSelectorPresentation.d.ts +1 -0
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +17 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +3 -5
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +9 -10
- package/dist/Stepper/Step.d.ts +2 -1
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +75 -11
- package/dist/Stepper/Stepper.d.ts.map +1 -1
- package/dist/Stepper/Stepper.js +1 -0
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +2 -3
- package/dist/Table/index.d.ts +16 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +4 -0
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +8 -9
- package/dist/Table/plugins/rowStatus/index.d.ts +1 -1
- package/dist/Table/plugins/rowStatus/index.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts +11 -30
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +108 -62
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +9 -1
- package/dist/Text/useTruncation.d.ts +1 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +8 -7
- package/dist/TimeInput/TimeInput.d.ts +16 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +98 -60
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.d.ts +2 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +4 -145
- package/dist/Timestamp/formatRelativeTime.d.ts +20 -0
- package/dist/Timestamp/formatRelativeTime.d.ts.map +1 -0
- package/dist/Timestamp/formatRelativeTime.js +81 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +125 -77
- package/dist/Tokenizer/Tokenizer.d.ts +0 -38
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +94 -26
- package/dist/Tokenizer/useEndLaneReserve.d.ts +31 -0
- package/dist/Tokenizer/useEndLaneReserve.d.ts.map +1 -0
- package/dist/Tokenizer/useEndLaneReserve.js +136 -0
- package/dist/Tooltip/useTooltip.d.ts +1 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +53 -42
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +85 -30
- package/dist/Typeahead/Typeahead.d.ts +0 -21
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +108 -67
- package/dist/Typeahead/busyIndicatorLane.d.ts +62 -0
- package/dist/Typeahead/busyIndicatorLane.d.ts.map +1 -0
- package/dist/Typeahead/busyIndicatorLane.js +98 -0
- package/dist/astryx.css +25 -7
- package/dist/hooks/useFocusReturnVisibility.d.ts.map +1 -1
- package/dist/hooks/useFocusReturnVisibility.js +3 -5
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +11 -11
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +7 -4
- package/dist/theme/defineTheme.d.ts +13 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +7 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +1 -1
- package/dist/theme/localTokens.d.ts +18 -0
- package/dist/theme/localTokens.d.ts.map +1 -0
- package/dist/theme/localTokens.js +162 -0
- package/dist/utils/interactionModality.d.ts +6 -28
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +72 -37
- package/dist/utils/sharedResizeObserver.d.ts +17 -9
- package/dist/utils/sharedResizeObserver.d.ts.map +1 -1
- package/dist/utils/sharedResizeObserver.js +54 -12
- package/locales/en.json +8 -0
- package/locales/pseudo.json +6 -0
- package/package.json +7 -2
- package/src/AlertDialog/useImperativeAlertDialog.test.tsx +163 -0
- package/src/AppShell/AppShell.doc.mjs +4 -3
- package/src/AppShell/AppShell.test.tsx +21 -0
- package/src/AppShell/AppShell.tsx +12 -7
- package/src/Banner/Banner.doc.mjs +5 -1
- package/src/Banner/Banner.tsx +12 -1
- package/src/BottomSheet/BottomSheet.doc.mjs +31 -0
- package/src/BottomSheet/BottomSheet.spec.md +178 -0
- package/src/Breadcrumbs/BreadcrumbItem.tsx +18 -9
- package/src/Breadcrumbs/Breadcrumbs.doc.mjs +4 -1
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +12 -0
- package/src/Button/Button.doc.mjs +56 -0
- package/src/ButtonGroup/ButtonGroup.doc.mjs +47 -0
- package/src/Calendar/hooks/useCalendarConstraints.test.ts +153 -0
- package/src/Calendar/hooks/useCalendarDays.test.ts +265 -0
- package/src/Calendar/hooks/useCalendarNavigation.test.ts +252 -0
- package/src/Carousel/Carousel.test.tsx +83 -0
- package/src/Carousel/Carousel.tsx +8 -2
- package/src/Chat/ChatComposer.doc.mjs +7 -4
- package/src/Chat/ChatComposer.test.tsx +84 -2
- package/src/Chat/ChatComposer.tsx +45 -3
- package/src/Chat/ChatSendButton.test.tsx +189 -0
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/Chat/ChatToolCalls.test.tsx +33 -1
- package/src/Chat/ChatToolCalls.tsx +13 -34
- package/src/Chat/useChatNewMessages.ts +3 -3
- package/src/Chat/useChatPasteAsToken.test.ts +191 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +172 -31
- package/src/CheckboxList/CheckboxList.spec.md +215 -0
- package/src/CheckboxList/CheckboxList.test.tsx +45 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +11 -9
- package/src/CheckboxList/CheckboxListItem.tsx +5 -3
- package/src/Collapsible/useCollapsible.test.tsx +236 -0
- package/src/CommandPalette/CommandPalette.doc.mjs +72 -0
- package/src/CommandPalette/CommandPalette.spec.md +224 -0
- package/src/CommandPalette/CommandPaletteEmpty.test.tsx +101 -0
- package/src/ComplexSelector/ComplexSelector.doc.mjs +42 -0
- package/src/ComplexSelector/ComplexSelector.spec.md +190 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +48 -0
- package/src/ContextMenu/ContextMenu.spec.md +207 -0
- package/src/DateTimeInput/DateTimeInput.doc.mjs +43 -23
- package/src/DateTimeInput/DateTimeInput.tsx +388 -181
- package/src/DateTimeInput/DateTimeInputTouch.test.tsx +10 -2
- package/src/DateTimeInput/NativeDateSegment.tsx +308 -0
- package/src/DateTimeInput/NativePickerSegments.test.tsx +626 -0
- package/src/DateTimeInput/NativeTimeSegment.tsx +331 -0
- package/src/DateTimeInput/index.ts +1 -0
- package/src/DateTimeInput/nativePickerSegmentStyles.ts +120 -0
- package/src/Divider/Divider.doc.mjs +24 -0
- package/src/Divider/Divider.spec.md +157 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +104 -0
- package/src/DropdownMenu/DropdownMenu.spec.md +246 -0
- package/src/DropdownMenu/DropdownMenu.tsx +2 -4
- package/src/Field/Field.doc.mjs +1 -0
- package/src/Field/Field.test.tsx +39 -0
- package/src/Field/Field.tsx +18 -1
- package/src/Field/InputClearButton.test.tsx +68 -6
- package/src/Field/PanelSearchInput.tsx +3 -5
- package/src/FieldStatus/FieldStatus.doc.mjs +21 -0
- package/src/FieldStatus/FieldStatus.spec.md +213 -0
- package/src/FieldStatus/FieldStatus.test.tsx +17 -0
- package/src/FieldStatus/FieldStatus.tsx +7 -2
- package/src/Grid/Grid.doc.mjs +19 -0
- package/src/Grid/Grid.spec.md +162 -0
- package/src/Icon/Icon.doc.mjs +196 -48
- package/src/Icon/Icon.spec.md +192 -0
- package/src/IconButton/IconButton.doc.mjs +38 -0
- package/src/Kbd/Kbd.doc.mjs +18 -0
- package/src/Kbd/Kbd.spec.md +142 -0
- package/src/Layer/useTouchTrigger.ts +2 -4
- package/src/Layout/Layout.doc.mjs +57 -17
- package/src/Layout/Layout.spec.md +235 -0
- package/src/Layout/Layout.test.tsx +1 -1
- package/src/Layout/Layout.tsx +7 -8
- package/src/Layout/LayoutHeader.doc.mjs +9 -0
- package/src/Layout/LayoutPanel.doc.mjs +4 -3
- package/src/Lightbox/Lightbox.doc.mjs +149 -33
- package/src/Lightbox/Lightbox.spec.md +198 -0
- package/src/Lightbox/useLightbox.test.tsx +263 -0
- package/src/Markdown/Markdown.doc.mjs +60 -0
- package/src/Markdown/Markdown.spec.md +207 -0
- package/src/MobileNav/MobileNav.doc.mjs +140 -32
- package/src/MobileNav/MobileNav.spec.md +209 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +42 -0
- package/src/MoreMenu/MoreMenu.spec.md +222 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +124 -1
- package/src/MultiSelector/MultiSelector.spec.md +293 -0
- package/src/MultiSelector/MultiSelector.test.tsx +305 -2
- package/src/MultiSelector/MultiSelector.tsx +124 -55
- package/src/NavIcon/NavIcon.doc.mjs +17 -0
- package/src/NavIcon/NavIcon.spec.md +134 -0
- package/src/NavMenu/NavHeadingMenu.spec.md +210 -0
- package/src/NavMenu/NavMenu.doc.mjs +37 -0
- package/src/Outline/Outline.doc.mjs +35 -0
- package/src/Outline/Outline.spec.md +162 -0
- package/src/OverflowList/OverflowList.doc.mjs +24 -0
- package/src/OverflowList/OverflowList.spec.md +157 -0
- package/src/Pagination/Pagination.doc.mjs +74 -0
- package/src/Pagination/Pagination.spec.md +226 -0
- package/src/Popover/Popover.doc.mjs +264 -65
- package/src/Popover/Popover.spec.md +421 -0
- package/src/Popover/usePopover.doc.mjs +208 -33
- package/src/PowerSearch/PowerSearch.spec.md +291 -0
- package/src/PowerSearch/PowerSearchFilterEditor.test.tsx +253 -0
- package/src/PowerSearch/PowerSearchToken.test.tsx +228 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +198 -38
- package/src/ProgressBar/ProgressBar.spec.md +261 -0
- package/src/RadioList/RadioList.test.tsx +136 -2
- package/src/RadioList/RadioListItem.doc.mjs +30 -11
- package/src/RadioList/RadioListItem.tsx +44 -8
- package/src/Resizable/Resizable.doc.mjs +130 -24
- package/src/Resizable/Resizable.spec.md +246 -0
- package/src/Resizable/ResizeHandle.test.tsx +177 -56
- package/src/Resizable/ResizeHandle.tsx +128 -45
- package/src/Resizable/index.ts +2 -0
- package/src/Resizable/shippedDirections.test.ts +462 -0
- package/src/Resizable/useResizable.doc.mjs +124 -29
- package/src/Resizable/useResizable.test.ts +1277 -3
- package/src/Resizable/useResizable.ts +760 -48
- package/src/Resizable/utils.test.ts +74 -0
- package/src/Resizable/utils.ts +35 -0
- package/src/Section/Section.doc.mjs +17 -0
- package/src/Section/Section.spec.md +139 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +83 -0
- package/src/SegmentedControl/SegmentedControl.spec.md +152 -0
- package/src/Selector/Selector.doc.mjs +133 -97
- package/src/Selector/Selector.spec.md +300 -0
- package/src/Selector/Selector.test.tsx +318 -1
- package/src/Selector/Selector.tsx +127 -60
- package/src/Selector/useSelectorPresentation.ts +24 -4
- package/src/SideNav/SideNav.test.tsx +3 -3
- package/src/SideNav/SideNavCollapseButton.doc.mjs +8 -0
- package/src/SideNav/SideNavItem.doc.mjs +1 -1
- package/src/Skeleton/Skeleton.doc.mjs +12 -0
- package/src/Skeleton/Skeleton.spec.md +127 -0
- package/src/Slider/Slider.doc.mjs +184 -30
- package/src/Slider/Slider.spec.md +224 -0
- package/src/Slider/Slider.tsx +2 -5
- package/src/Spinner/Spinner.doc.mjs +5 -5
- package/src/Spinner/Spinner.test.tsx +32 -7
- package/src/Spinner/Spinner.tsx +46 -14
- package/src/Stack/Stack.doc.mjs +22 -0
- package/src/Stack/Stack.spec.md +155 -0
- package/src/StatusDot/StatusDot.doc.mjs +17 -0
- package/src/StatusDot/StatusDot.spec.md +138 -0
- package/src/Stepper/Step.doc.mjs +1 -1
- package/src/Stepper/Step.tsx +118 -5
- package/src/Stepper/Stepper.doc.mjs +51 -1
- package/src/Stepper/Stepper.spec.md +245 -0
- package/src/Stepper/Stepper.test.tsx +315 -0
- package/src/Stepper/Stepper.tsx +8 -0
- package/src/Switch/Switch.doc.mjs +40 -0
- package/src/Switch/Switch.spec.md +175 -0
- package/src/TabList/TabList.tsx +2 -3
- package/src/Table/Table.doc.mjs +102 -24
- package/src/Table/Table.perf.test.tsx +51 -1
- package/src/Table/Table.spec.md +325 -0
- package/src/Table/TableHeaderCell.test.tsx +291 -0
- package/src/Table/index.ts +19 -4
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +8 -12
- package/src/Table/plugins/filtering/useTableFilterState.test.tsx +143 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +2 -1
- package/src/Table/plugins/rowStatus/index.ts +1 -4
- package/src/Table/plugins/rowStatus/useTableRowStatus.public.test.ts +92 -0
- package/src/Table/plugins/rowStatus/useTableRowStatus.spec.md +354 -0
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +431 -56
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +155 -84
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +72 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +18 -1
- package/src/Table/useTableGroupedRows.doc.mjs +2 -2
- package/src/Table/useTableRowStatus.doc.mjs +5 -5
- package/src/Text/Text.doc.mjs +190 -43
- package/src/Text/Text.spec.md +206 -0
- package/src/Text/useTruncation.ts +8 -7
- package/src/TextArea/TextArea.doc.mjs +255 -45
- package/src/TextArea/TextArea.spec.md +205 -0
- package/src/TimeInput/NativeTimeInput.test.tsx +269 -0
- package/src/TimeInput/TimeInput.doc.mjs +47 -23
- package/src/TimeInput/TimeInput.tsx +109 -50
- package/src/TimeInput/index.ts +1 -0
- package/src/Timestamp/Timestamp.doc.mjs +2 -2
- package/src/Timestamp/Timestamp.test.tsx +75 -3
- package/src/Timestamp/Timestamp.tsx +7 -153
- package/src/Timestamp/formatRelativeTime.ts +96 -0
- package/src/Toast/ToastViewport.test.tsx +194 -0
- package/src/Toast/ToastViewport.tsx +136 -58
- package/src/ToggleButton/ToggleButton.doc.mjs +56 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -0
- package/src/Tokenizer/Tokenizer.spec.md +293 -0
- package/src/Tokenizer/Tokenizer.test.tsx +335 -1
- package/src/Tokenizer/Tokenizer.tsx +129 -46
- package/src/Tokenizer/useEndLaneReserve.ts +146 -0
- package/src/Toolbar/Toolbar.doc.mjs +19 -0
- package/src/Toolbar/Toolbar.spec.md +174 -0
- package/src/Tooltip/Tooltip.doc.mjs +17 -0
- package/src/Tooltip/Tooltip.spec.md +142 -0
- package/src/Tooltip/Tooltip.test.tsx +21 -1
- package/src/Tooltip/useTooltip.test.tsx +318 -0
- package/src/Tooltip/useTooltip.tsx +60 -39
- package/src/TreeList/TreeList.doc.mjs +58 -0
- package/src/TreeList/TreeList.spec.md +224 -0
- package/src/Typeahead/BaseTypeahead.tsx +96 -25
- package/src/Typeahead/Typeahead.doc.mjs +89 -1
- package/src/Typeahead/Typeahead.spec.md +257 -0
- package/src/Typeahead/Typeahead.test.tsx +502 -1
- package/src/Typeahead/Typeahead.tsx +187 -69
- package/src/Typeahead/TypeaheadItem.test.tsx +93 -2
- package/src/Typeahead/busyIndicatorLane.tsx +109 -0
- package/src/__tests__/stylexDeclarations.ts +51 -0
- package/src/hooks/useFocusReturnVisibility.ts +3 -5
- package/src/hooks/useOverflow.ts +11 -11
- package/src/hooks/useScrollLock.test.ts +103 -0
- package/src/hooks/useScrollOverflow.ts +7 -4
- package/src/i18n/useTranslator.test.tsx +197 -0
- package/src/theme/defineTheme.test.ts +227 -0
- package/src/theme/defineTheme.ts +30 -0
- package/src/theme/derivedVarRegistry.test.ts +6 -0
- package/src/theme/generateThemeRules.ts +4 -1
- package/src/theme/localTokens.ts +272 -0
- package/src/theme/themingTargets.test.ts +126 -28
- package/src/utils/interactionModality.test.ts +83 -0
- package/src/utils/interactionModality.ts +88 -36
- package/src/utils/sharedResizeObserver.test.ts +124 -5
- package/src/utils/sharedResizeObserver.ts +60 -14
package/dist/Stepper/Step.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Step.tsx
|
|
7
7
|
* @input Uses React, stylex, theme tokens (including the motion duration token
|
|
8
|
-
* the connector fill animates on), StepperContext
|
|
8
|
+
* the connector fill animates on), StepperContext, and per-step theme selector
|
|
9
|
+
* state
|
|
9
10
|
* @output Exports Step component and StepProps
|
|
10
11
|
* @position Individual step item; used inside Stepper
|
|
11
12
|
*
|
|
@@ -124,6 +125,37 @@ function CurrentIcon() {
|
|
|
124
125
|
// --- Styles ---
|
|
125
126
|
|
|
126
127
|
const BAR_WIDTH = spacingVars['--spacing-1'];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* How much of itself a connector gives up where it meets the indicator, read
|
|
131
|
+
* from the public `--step-connector-gap` declared on the Stepper root.
|
|
132
|
+
*
|
|
133
|
+
* Clipped, not padded. The gap has to apply to two layers — the track, which is
|
|
134
|
+
* the segment's own background, and the accent fill, which is an absolutely
|
|
135
|
+
* placed `::before`. Spending it on each separately meant two declarations on
|
|
136
|
+
* two boxes: a percentage then resolved against a different containing block
|
|
137
|
+
* for each and stopped them ~1.2px apart. `clip-path` is ONE declaration on the
|
|
138
|
+
* segment that clips the element and its pseudo-element together, against one
|
|
139
|
+
* reference box — so every accepted value behaves the same way on both layers,
|
|
140
|
+
* which is what a public input owes its full value domain.
|
|
141
|
+
*
|
|
142
|
+
* Clipping also cannot change layout: the segment keeps its box, so the node it
|
|
143
|
+
* positions cannot move and the Stepper cannot grow. A raw `1rem` padding grew
|
|
144
|
+
* a 180px stepper to 240px.
|
|
145
|
+
*
|
|
146
|
+
* Still clamped, because the value arrives with nothing in between to reject
|
|
147
|
+
* it. Both halves earn their place, and not for the reasons padding needed:
|
|
148
|
+
*
|
|
149
|
+
* - `max(0px, …)` — `inset()` ACCEPTS a negative length. Chromium computes
|
|
150
|
+
* `inset(0 0 -4px 0)` as-is rather than dropping it, which is the opposite
|
|
151
|
+
* of padding (there CSS clamps a negative to `0` for you). This normalises
|
|
152
|
+
* it to `0` so a negative gap means "no gap" rather than a clip rect
|
|
153
|
+
* stretched outside the segment's own box.
|
|
154
|
+
* - `min(…, --spacing-2)` — the flexible segment's own `min-height`, so an
|
|
155
|
+
* oversized gap leaves a short track rather than an unbounded one.
|
|
156
|
+
*/
|
|
157
|
+
const CONNECTOR_GAP = `max(0px, min(var(--step-connector-gap, 0px), ${spacingVars['--spacing-2']}))`;
|
|
158
|
+
|
|
127
159
|
// Every indicator — check, ring, custom icon, number badge — occupies the same
|
|
128
160
|
// box, so the `auto` mode swapping a number for a check as a step completes
|
|
129
161
|
// never nudges the label or the track.
|
|
@@ -503,6 +535,22 @@ const styles = {
|
|
|
503
535
|
kaIpWk: "x2u8bby",
|
|
504
536
|
$$css: true
|
|
505
537
|
},
|
|
538
|
+
otSegGapLeadV: {
|
|
539
|
+
kz4h6p: "x1yxrbr4",
|
|
540
|
+
$$css: true
|
|
541
|
+
},
|
|
542
|
+
otSegGapRailV: {
|
|
543
|
+
kz4h6p: "x1eyou77",
|
|
544
|
+
$$css: true
|
|
545
|
+
},
|
|
546
|
+
otSegGapLeadH: {
|
|
547
|
+
kz4h6p: "x17qoqre x153f7d5",
|
|
548
|
+
$$css: true
|
|
549
|
+
},
|
|
550
|
+
otSegGapRailH: {
|
|
551
|
+
kz4h6p: "x13hy1yx x7cmjge",
|
|
552
|
+
$$css: true
|
|
553
|
+
},
|
|
506
554
|
otSegFlexV: {
|
|
507
555
|
kUk6DE: "x98rzlu",
|
|
508
556
|
kAzted: "x175cymr",
|
|
@@ -773,13 +821,29 @@ export function Step({
|
|
|
773
821
|
const hasIndicator = indicator !== 'none';
|
|
774
822
|
const labelColorStyle = isDisabled ? styles.labelDisabled : progress === 'not-started' ? styles.labelNotStarted : isActive ? styles.labelInProgress : undefined;
|
|
775
823
|
|
|
824
|
+
// Both text parts carry {progress, status}, the phase vocabulary of
|
|
825
|
+
// `step-indicator` above. The label additionally owns Stepper's disabled
|
|
826
|
+
// paint, so it alone carries disabled below.
|
|
827
|
+
const labelThemeProps = themeProps('step-label', {
|
|
828
|
+
progress,
|
|
829
|
+
status: status ?? undefined,
|
|
830
|
+
// The label owns Stepper's disabled paint (`styles.labelDisabled` above),
|
|
831
|
+
// so it owns the selector too. The description does not change under
|
|
832
|
+
// disabled and deliberately keeps the smaller {progress, status} surface.
|
|
833
|
+
disabled: isDisabled ? 'disabled' : null
|
|
834
|
+
});
|
|
835
|
+
const descriptionThemeProps = themeProps('step-description', {
|
|
836
|
+
progress,
|
|
837
|
+
status: status ?? undefined
|
|
838
|
+
});
|
|
839
|
+
|
|
776
840
|
// Indicator + Label row
|
|
777
841
|
const iconLabelNode = /*#__PURE__*/_jsxs("div", {
|
|
778
842
|
...{
|
|
779
843
|
className: "x78zum5 x1q0g3np x6s0dn4 x1txdalj"
|
|
780
844
|
},
|
|
781
845
|
children: [indicatorNode, /*#__PURE__*/_jsx("span", {
|
|
782
|
-
...stylex.props(styles.label, labelColorStyle),
|
|
846
|
+
...mergeProps(labelThemeProps, stylex.props(styles.label, labelColorStyle)),
|
|
783
847
|
children: label
|
|
784
848
|
}), statusTextNode, isOptional && /*#__PURE__*/_jsxs(_Fragment, {
|
|
785
849
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -805,9 +869,9 @@ export function Step({
|
|
|
805
869
|
}
|
|
806
870
|
}[!!hasIndicator << 0],
|
|
807
871
|
children: /*#__PURE__*/_jsx("span", {
|
|
808
|
-
...{
|
|
872
|
+
...mergeProps(descriptionThemeProps, {
|
|
809
873
|
className: "x1lliihq x141an7d x1ojctns xv1l7n4"
|
|
810
|
-
},
|
|
874
|
+
}),
|
|
811
875
|
children: description
|
|
812
876
|
})
|
|
813
877
|
}) : null;
|
|
@@ -873,7 +937,7 @@ export function Step({
|
|
|
873
937
|
}
|
|
874
938
|
}[!!isVertical << 0],
|
|
875
939
|
children: [/*#__PURE__*/_jsx("span", {
|
|
876
|
-
...stylex.props(styles.label, labelColorStyle),
|
|
940
|
+
...mergeProps(labelThemeProps, stylex.props(styles.label, labelColorStyle)),
|
|
877
941
|
children: label
|
|
878
942
|
}), statusTextNode, isOptional && /*#__PURE__*/_jsxs(_Fragment, {
|
|
879
943
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -890,9 +954,9 @@ export function Step({
|
|
|
890
954
|
}), endContent]
|
|
891
955
|
});
|
|
892
956
|
const otDescriptionNode = isRenderable(description) ? /*#__PURE__*/_jsx("span", {
|
|
893
|
-
...{
|
|
957
|
+
...mergeProps(descriptionThemeProps, {
|
|
894
958
|
className: "x1lliihq x141an7d x1ojctns xv1l7n4"
|
|
895
|
-
},
|
|
959
|
+
}),
|
|
896
960
|
children: description
|
|
897
961
|
}) : null;
|
|
898
962
|
const otContentNode = !isRenderable(children) ? null : isVertical ? /*#__PURE__*/_jsxs("div", {
|
|
@@ -924,10 +988,10 @@ export function Step({
|
|
|
924
988
|
...stylex.props(styles.otIndicatorColV, styles.otRailBridgeV(densitySpace)),
|
|
925
989
|
children: [/*#__PURE__*/_jsx("div", {
|
|
926
990
|
"aria-hidden": "true",
|
|
927
|
-
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegBaseV, styles.otSegLeadV(densitySpace), styles.connectorTrack, beforeSegStyle, beforeTiming, styles.otSegHiddenIfFirst))
|
|
991
|
+
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegBaseV, styles.otSegLeadV(densitySpace), styles.connectorTrack, hasIndicator && styles.otSegGapLeadV, beforeSegStyle, beforeTiming, styles.otSegHiddenIfFirst))
|
|
928
992
|
}), indicatorNode, /*#__PURE__*/_jsx("div", {
|
|
929
993
|
"aria-hidden": "true",
|
|
930
|
-
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegBaseV, styles.otSegFlexV, styles.connectorTrack, afterSegStyle, railTiming, styles.otSegHiddenIfLast))
|
|
994
|
+
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegBaseV, styles.otSegFlexV, styles.connectorTrack, hasIndicator && styles.otSegGapRailV, afterSegStyle, railTiming, styles.otSegHiddenIfLast))
|
|
931
995
|
})]
|
|
932
996
|
}), /*#__PURE__*/_jsxs("div", {
|
|
933
997
|
...{
|
|
@@ -963,10 +1027,10 @@ export function Step({
|
|
|
963
1027
|
},
|
|
964
1028
|
children: [/*#__PURE__*/_jsx("div", {
|
|
965
1029
|
"aria-hidden": "true",
|
|
966
|
-
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegH, styles.connectorTrack, beforeSegStyle, beforeTiming, styles.otSegHiddenIfFirst))
|
|
1030
|
+
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegH, styles.connectorTrack, hasIndicator && styles.otSegGapLeadH, beforeSegStyle, beforeTiming, styles.otSegHiddenIfFirst))
|
|
967
1031
|
}), indicatorNode, /*#__PURE__*/_jsx("div", {
|
|
968
1032
|
"aria-hidden": "true",
|
|
969
|
-
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegH, styles.connectorTrack, afterSegStyle, railTiming, styles.otSegHiddenIfLast))
|
|
1033
|
+
...mergeProps(themeProps('step-connector'), stylex.props(styles.otSegH, styles.connectorTrack, hasIndicator && styles.otSegGapRailH, afterSegStyle, railTiming, styles.otSegHiddenIfLast))
|
|
970
1034
|
})]
|
|
971
1035
|
}), /*#__PURE__*/_jsxs("div", {
|
|
972
1036
|
...stylex.props(styles.otLabelWrapH, styles.otMarginTop(densitySpace)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../src/Stepper/Stepper.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAyC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAK7E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAE9B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9C;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;CAC9C;
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../src/Stepper/Stepper.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAyC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAK7E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAE9B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,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pC,CAAC,cAAc,CAAC,EAAE,aAAa,EAC/B,GAAG,SAAS,EACb,EAAE,YAAY,qBA8Ud;yBAnWe,OAAO"}
|
package/dist/TabList/TabList.js
CHANGED
|
@@ -34,7 +34,7 @@ import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
|
34
34
|
import { Icon } from "../Icon/index.js";
|
|
35
35
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
36
36
|
import { themeProps } from "../utils/themeProps.js";
|
|
37
|
-
import { observeResize
|
|
37
|
+
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
38
38
|
import { devWarn } from "../utils/devWarning.js";
|
|
39
39
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
40
40
|
import { useTranslator } from "../i18n/index.js";
|
|
@@ -372,8 +372,7 @@ export function TabList({
|
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
374
|
const onResize = () => revealSelectedTabRef.current();
|
|
375
|
-
observeResize(root, onResize);
|
|
376
|
-
return () => unobserveResize(root);
|
|
375
|
+
return observeResize(root, onResize);
|
|
377
376
|
}, [hasScroll, listRef]);
|
|
378
377
|
const scrollByPage = useCallback(direction => {
|
|
379
378
|
const strip = stripRef.current;
|
package/dist/Table/index.d.ts
CHANGED
|
@@ -6,6 +6,21 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update this header and /packages/core/src/Table/Table.doc.mjs
|
|
8
8
|
*/
|
|
9
|
+
import type { IconName } from '../Icon';
|
|
10
|
+
import type { TableRowStatusColor } from './plugins/rowStatus/useTableRowStatus';
|
|
11
|
+
/** Stable custom row-status marker contract. */
|
|
12
|
+
export interface TableRowStatus {
|
|
13
|
+
color: TableRowStatusColor | (string & {});
|
|
14
|
+
icon?: IconName;
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
/** Semantic row outcome resolved through the active theme. */
|
|
18
|
+
export interface TableSemanticRowStatus {
|
|
19
|
+
status: 'success' | 'warning' | 'error';
|
|
20
|
+
color?: never;
|
|
21
|
+
icon?: never;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
9
24
|
export { Table } from './Table';
|
|
10
25
|
export { TableRow } from './TableRow';
|
|
11
26
|
export { TableCell } from './TableCell';
|
|
@@ -53,7 +68,7 @@ export type { UseTableStickyColumnsConfig } from './plugins/stickyColumns';
|
|
|
53
68
|
export type { UseTableRowExpansionConfig } from './plugins/rowExpansion';
|
|
54
69
|
export type { UseTableRowIndexConfig } from './plugins/rowIndex';
|
|
55
70
|
export type { UseTableGroupedRowsConfig, UseTableGroupedRowsResult, } from './plugins/groupedRows';
|
|
56
|
-
export type { UseTableRowStatusConfig
|
|
71
|
+
export type { UseTableRowStatusConfig } from './plugins/rowStatus';
|
|
57
72
|
export type { TableTreeRowMeta, UseTableTreeDataConfig, UseTableTreeStateConfig, UseTableTreeStateResult, } from './plugins/tree';
|
|
58
73
|
export type { UseTableFilteringConfig, TableFilterState, TableFilterVariant, TableFilterValue, TableFilterFieldRef, } from './plugins/filtering';
|
|
59
74
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM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EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/Table/index.js
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* SYNC: When modified, update this header and /packages/core/src/Table/Table.doc.mjs
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/** Stable custom row-status marker contract. */
|
|
13
|
+
|
|
14
|
+
/** Semantic row outcome resolved through the active theme. */
|
|
15
|
+
|
|
12
16
|
export { Table } from "./Table.js";
|
|
13
17
|
export { TableRow } from "./TableRow.js";
|
|
14
18
|
export { TableCell } from "./TableCell.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableColumnResize.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/columnResize/useTableColumnResize.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,WAAW,EAEX,WAAW,EAEZ,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"useTableColumnResize.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/columnResize/useTableColumnResize.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,WAAW,EAEX,WAAW,EAEZ,MAAM,aAAa,CAAC;AAQrB,MAAM,WAAW,0BAA0B;IACzC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC;;;OAGG;IACH;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAE9D;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAClD;AAymBD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpE,MAAM,EAAE,0BAA0B,GACjC,WAAW,CAAC,CAAC,CAAC,CAsKhB"}
|
|
@@ -17,7 +17,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
17
17
|
import "../../../theme/tokens.stylex.js";
|
|
18
18
|
import { colorVars } from "../../../theme/tokens.stylex.js";
|
|
19
19
|
import { DEFAULT_MIN_COLUMN_WIDTH } from "../../columnUtils.js";
|
|
20
|
-
import { observeResize
|
|
20
|
+
import { observeResize } from "../../../utils/sharedResizeObserver.js";
|
|
21
21
|
|
|
22
22
|
// =============================================================================
|
|
23
23
|
// Config Type
|
|
@@ -490,11 +490,11 @@ export function useTableColumnResize(config) {
|
|
|
490
490
|
// --table-resize-height on the <table> element. This is initialized
|
|
491
491
|
// entirely by the resize plugin — the base table has no knowledge of it.
|
|
492
492
|
const observedTableRef = useRef(null);
|
|
493
|
+
const unobserveTableRef = useRef(null);
|
|
493
494
|
const measureRef = useCallback(el => {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
495
|
+
unobserveTableRef.current?.();
|
|
496
|
+
unobserveTableRef.current = null;
|
|
497
|
+
observedTableRef.current = null;
|
|
498
498
|
if (!el) {
|
|
499
499
|
return;
|
|
500
500
|
}
|
|
@@ -503,7 +503,7 @@ export function useTableColumnResize(config) {
|
|
|
503
503
|
tableRef.current = table;
|
|
504
504
|
}
|
|
505
505
|
if (table && typeof ResizeObserver !== 'undefined') {
|
|
506
|
-
observeResize(table, () => {
|
|
506
|
+
unobserveTableRef.current = observeResize(table, () => {
|
|
507
507
|
const height = table.getBoundingClientRect().height;
|
|
508
508
|
table.style.setProperty('--table-resize-height', `${height}px`);
|
|
509
509
|
});
|
|
@@ -514,9 +514,8 @@ export function useTableColumnResize(config) {
|
|
|
514
514
|
// Clean up observer on unmount
|
|
515
515
|
useEffect(() => {
|
|
516
516
|
return () => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
517
|
+
unobserveTableRef.current?.();
|
|
518
|
+
unobserveTableRef.current = null;
|
|
520
519
|
};
|
|
521
520
|
}, []);
|
|
522
521
|
return useMemo(() => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/rowStatus/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/rowStatus/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TableRowStatus, TableSemanticRowStatus } from '../../index';
|
|
2
2
|
import type { TablePlugin } from '../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Named colors supported by the custom row-status marker. These resolve to the
|
|
5
|
+
* design system's icon color tokens; raw CSS colors remain an escape hatch.
|
|
6
6
|
*/
|
|
7
7
|
export type TableRowStatusColor = 'accent' | 'success' | 'error' | 'warning' | 'red' | 'orange' | 'green' | 'yellow' | 'blue' | 'gray';
|
|
8
|
-
/**
|
|
9
|
-
* A row's status indicator. `color` accepts a semantic status color
|
|
10
|
-
* (mapped to a theme token) or any raw CSS color string as an escape hatch.
|
|
11
|
-
* By default the plugin renders a colored status dot. Provide `icon` to signal
|
|
12
|
-
* status by shape as well as color, which is more accessible when several
|
|
13
|
-
* statuses coexist. `label` is required so the status is never conveyed by
|
|
14
|
-
* color alone — it names the indicator for assistive technology and shows on
|
|
15
|
-
* hover. Return `null` for rows with no status.
|
|
16
|
-
*/
|
|
17
|
-
export interface TableRowStatus {
|
|
18
|
-
/** Semantic status color (preferred) or a raw CSS color string. */
|
|
19
|
-
color: TableRowStatusColor | (string & {});
|
|
20
|
-
/** Optional icon rendered as the signifier instead of the dot (shape as an a11y differentiator). */
|
|
21
|
-
icon?: IconName;
|
|
22
|
-
/**
|
|
23
|
-
* Accessible name for the status, announced to assistive technology and
|
|
24
|
-
* shown in a tooltip on hover. Required: a status must never be conveyed by
|
|
25
|
-
* color alone.
|
|
26
|
-
*/
|
|
27
|
-
label: string;
|
|
28
|
-
}
|
|
29
8
|
/** Configuration for {@link useTableRowStatus}. */
|
|
30
9
|
export interface UseTableRowStatusConfig<T extends Record<string, unknown>> {
|
|
31
10
|
/**
|
|
@@ -35,23 +14,25 @@ export interface UseTableRowStatusConfig<T extends Record<string, unknown>> {
|
|
|
35
14
|
* @example
|
|
36
15
|
* ```
|
|
37
16
|
* getStatus: row =>
|
|
38
|
-
* row.hasError ? {
|
|
17
|
+
* row.hasError ? {status: 'error', label: 'Error'} : null
|
|
39
18
|
* ```
|
|
40
19
|
*/
|
|
41
|
-
getStatus: (item: T) => TableRowStatus
|
|
20
|
+
getStatus: (item: T) => (TableRowStatus & {
|
|
21
|
+
status?: never;
|
|
22
|
+
}) | TableSemanticRowStatus | null;
|
|
42
23
|
}
|
|
43
24
|
/**
|
|
44
25
|
* Returns a {@link TablePlugin} that prepends a narrow column signaling per-row
|
|
45
|
-
* status
|
|
46
|
-
*
|
|
26
|
+
* status. A semantic `status` resolves a themed glyph and tone; a custom
|
|
27
|
+
* `color` renders the stable dot unless the caller also provides an `icon`.
|
|
47
28
|
*
|
|
48
29
|
* @example
|
|
49
30
|
* ```
|
|
50
31
|
* const rowStatus = useTableRowStatus<Row>({
|
|
51
32
|
* getStatus: row =>
|
|
52
33
|
* row.state === 'error'
|
|
53
|
-
* ? {
|
|
54
|
-
* :
|
|
34
|
+
* ? {status: 'error', label: 'Error'}
|
|
35
|
+
* : {color: 'blue', icon: 'info', label: 'Informational'},
|
|
55
36
|
* });
|
|
56
37
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowStatus}} />;
|
|
57
38
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableRowStatus.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/rowStatus/useTableRowStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTableRowStatus.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/rowStatus/useTableRowStatus.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,cAAc,EAAE,sBAAsB,EAAC,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAc,WAAW,EAAC,MAAM,aAAa,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,SAAS,GACT,OAAO,GACP,SAAS,GACT,KAAK,GACL,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;AA+BX,mDAAmD;AACnD,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxE;;;;;;;;;OASG;IACH,SAAS,EAAE,CACT,IAAI,EAAE,CAAC,KACJ,CAAC,cAAc,GAAG;QAAC,MAAM,CAAC,EAAE,KAAK,CAAA;KAAC,CAAC,GAAG,sBAAsB,GAAG,IAAI,CAAC;CAC1E;AAgGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACjC,WAAW,CAAC,CAAC,CAAC,CAkEhB"}
|
|
@@ -4,26 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTableRowStatus.tsx
|
|
7
|
-
* @input React, StyleX, Icon, i18n, VisuallyHidden, Table types
|
|
7
|
+
* @input React, StyleX, Icon, i18n, dev warnings, VisuallyHidden, Table types
|
|
8
8
|
* @output Exports useTableRowStatus hook + config type
|
|
9
9
|
* @position Row-status plugin; consumed by Table via plugins prop
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/Table/index.ts (exports)
|
|
13
|
+
* - /packages/core/src/Table/useTableRowStatus.doc.mjs
|
|
14
|
+
* - /packages/core/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx
|
|
15
|
+
* - /apps/storybook/stories/TableRowStatus.stories.tsx
|
|
16
|
+
* - /packages/cli/assets/templates/blocks/components/Table/TableRowStatusTable.tsx
|
|
13
17
|
*/
|
|
14
18
|
import { useMemo } from 'react';
|
|
15
19
|
import * as stylex from '@stylexjs/stylex';
|
|
16
20
|
import { Icon } from "../../../Icon/index.js";
|
|
17
21
|
import { Tooltip } from "../../../Tooltip/index.js";
|
|
18
22
|
import { useTranslator } from "../../../i18n/index.js";
|
|
23
|
+
import { warnOnce } from "../../../utils/devWarning.js";
|
|
19
24
|
import { VisuallyHidden } from "../../../VisuallyHidden/index.js";
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
27
|
+
* Named colors supported by the custom row-status marker. These resolve to the
|
|
28
|
+
* design system's icon color tokens; raw CSS colors remain an escape hatch.
|
|
24
29
|
*/
|
|
25
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
const
|
|
31
|
+
const NAMED_COLORS = {
|
|
27
32
|
accent: 'var(--color-icon-accent)',
|
|
28
33
|
success: 'var(--color-icon-green)',
|
|
29
34
|
error: 'var(--color-icon-red)',
|
|
@@ -36,8 +41,8 @@ const SEMANTIC_COLORS = {
|
|
|
36
41
|
gray: 'var(--color-icon-gray)'
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
/**
|
|
40
|
-
const
|
|
44
|
+
/** Preserve the released Icon color mapping for named custom-marker colors. */
|
|
45
|
+
const ICON_COLOR_BY_NAMED_COLOR = {
|
|
41
46
|
accent: 'accent',
|
|
42
47
|
success: 'success',
|
|
43
48
|
error: 'error',
|
|
@@ -50,28 +55,53 @@ const ICON_COLOR_BY_STATUS = {
|
|
|
50
55
|
gray: 'gray'
|
|
51
56
|
};
|
|
52
57
|
|
|
53
|
-
/**
|
|
54
|
-
* A row's status indicator. `color` accepts a semantic status color
|
|
55
|
-
* (mapped to a theme token) or any raw CSS color string as an escape hatch.
|
|
56
|
-
* By default the plugin renders a colored status dot. Provide `icon` to signal
|
|
57
|
-
* status by shape as well as color, which is more accessible when several
|
|
58
|
-
* statuses coexist. `label` is required so the status is never conveyed by
|
|
59
|
-
* color alone — it names the indicator for assistive technology and shows on
|
|
60
|
-
* hover. Return `null` for rows with no status.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
58
|
/** Configuration for {@link useTableRowStatus}. */
|
|
64
59
|
|
|
65
|
-
// The status column holds a small centered dot
|
|
66
|
-
//
|
|
60
|
+
// The status column holds a small centered dot or icon. A fixed narrow width
|
|
61
|
+
// keeps every row's indicator aligned in one gutter.
|
|
67
62
|
const STATUS_COLUMN_WIDTH = {
|
|
68
63
|
type: 'pixel',
|
|
69
64
|
value: 28
|
|
70
65
|
};
|
|
71
66
|
|
|
72
|
-
/** Resolve a
|
|
67
|
+
/** Resolve a named color to a token, or pass a raw CSS color through. */
|
|
73
68
|
function resolveColor(color) {
|
|
74
|
-
return
|
|
69
|
+
return NAMED_COLORS[color] ?? color;
|
|
70
|
+
}
|
|
71
|
+
function isTableRowSemanticStatus(value) {
|
|
72
|
+
return value === 'success' || value === 'warning' || value === 'error';
|
|
73
|
+
}
|
|
74
|
+
function resolveTableRowStatus(value) {
|
|
75
|
+
const untypedValue = value;
|
|
76
|
+
if (isTableRowSemanticStatus(untypedValue.status)) {
|
|
77
|
+
if (process.env.NODE_ENV !== 'production' && (Object.prototype.hasOwnProperty.call(untypedValue, 'color') || Object.prototype.hasOwnProperty.call(untypedValue, 'icon'))) {
|
|
78
|
+
warnOnce('useTableRowStatus:semantic-custom-conflict', 'useTableRowStatus', 'status cannot be combined with color or icon. The semantic status takes precedence and the custom marker fields are ignored.');
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
variant: 'icon',
|
|
82
|
+
icon: untypedValue.status,
|
|
83
|
+
iconColor: untypedValue.status
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (typeof untypedValue.color !== 'string') {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (typeof untypedValue.icon === 'string') {
|
|
90
|
+
const namedIconColor = ICON_COLOR_BY_NAMED_COLOR[untypedValue.color];
|
|
91
|
+
return namedIconColor == null ? {
|
|
92
|
+
variant: 'icon',
|
|
93
|
+
icon: untypedValue.icon,
|
|
94
|
+
customColor: untypedValue.color
|
|
95
|
+
} : {
|
|
96
|
+
variant: 'icon',
|
|
97
|
+
icon: untypedValue.icon,
|
|
98
|
+
iconColor: namedIconColor
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
variant: 'dot',
|
|
103
|
+
color: resolveColor(untypedValue.color)
|
|
104
|
+
};
|
|
75
105
|
}
|
|
76
106
|
const _temp = {
|
|
77
107
|
kzqmXN: "x1xc55vz",
|
|
@@ -81,6 +111,18 @@ const _temp = {
|
|
|
81
111
|
"$$css": true
|
|
82
112
|
};
|
|
83
113
|
const styles = {
|
|
114
|
+
wrap: {
|
|
115
|
+
k1xSpc: "x78zum5",
|
|
116
|
+
kGNEyG: "x6s0dn4",
|
|
117
|
+
kjj79g: "xl56j7k",
|
|
118
|
+
$$css: true
|
|
119
|
+
},
|
|
120
|
+
customIcon: color => [{
|
|
121
|
+
kMwMTN: color != null ? "x14rh7hd" : color,
|
|
122
|
+
$$css: true
|
|
123
|
+
}, {
|
|
124
|
+
"--x-color": color != null ? color : undefined
|
|
125
|
+
}],
|
|
84
126
|
dot: color => [_temp, {
|
|
85
127
|
kWkggS: color != null ? "xl8spv7" : color,
|
|
86
128
|
$$css: true
|
|
@@ -91,16 +133,16 @@ const styles = {
|
|
|
91
133
|
|
|
92
134
|
/**
|
|
93
135
|
* Returns a {@link TablePlugin} that prepends a narrow column signaling per-row
|
|
94
|
-
* status
|
|
95
|
-
*
|
|
136
|
+
* status. A semantic `status` resolves a themed glyph and tone; a custom
|
|
137
|
+
* `color` renders the stable dot unless the caller also provides an `icon`.
|
|
96
138
|
*
|
|
97
139
|
* @example
|
|
98
140
|
* ```
|
|
99
141
|
* const rowStatus = useTableRowStatus<Row>({
|
|
100
142
|
* getStatus: row =>
|
|
101
143
|
* row.state === 'error'
|
|
102
|
-
* ? {
|
|
103
|
-
* :
|
|
144
|
+
* ? {status: 'error', label: 'Error'}
|
|
145
|
+
* : {color: 'blue', icon: 'info', label: 'Informational'},
|
|
104
146
|
* });
|
|
105
147
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowStatus}} />;
|
|
106
148
|
* ```
|
|
@@ -110,43 +152,47 @@ export function useTableRowStatus(config) {
|
|
|
110
152
|
const {
|
|
111
153
|
getStatus
|
|
112
154
|
} = config;
|
|
113
|
-
return useMemo(() =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
const signifier = status.icon ? /*#__PURE__*/_jsx(Icon, {
|
|
130
|
-
icon: status.icon,
|
|
131
|
-
size: "xsm",
|
|
132
|
-
color: ICON_COLOR_BY_STATUS[status.color] ?? 'primary'
|
|
133
|
-
}) : /*#__PURE__*/_jsx("span", {
|
|
134
|
-
...stylex.props(styles.dot(resolveColor(status.color)))
|
|
135
|
-
});
|
|
136
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
|
137
|
-
content: status.label,
|
|
138
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
139
|
-
...{
|
|
140
|
-
className: "x78zum5 x6s0dn4 xl56j7k"
|
|
141
|
-
},
|
|
142
|
-
role: "img",
|
|
143
|
-
"aria-label": status.label,
|
|
144
|
-
children: signifier
|
|
145
|
-
})
|
|
146
|
-
});
|
|
155
|
+
return useMemo(() => {
|
|
156
|
+
const statusColumn = {
|
|
157
|
+
key: '__rowStatus',
|
|
158
|
+
// The gutter stays visually blank, but the th needs a discernible
|
|
159
|
+
// name for assistive technology (axe: empty-table-header).
|
|
160
|
+
header: /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
161
|
+
children: t('@astryx.table.rowStatus.columnHeader')
|
|
162
|
+
}),
|
|
163
|
+
width: STATUS_COLUMN_WIDTH,
|
|
164
|
+
resizable: false,
|
|
165
|
+
renderCell: item => {
|
|
166
|
+
const status = getStatus(item);
|
|
167
|
+
if (!status) {
|
|
168
|
+
return null;
|
|
147
169
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
170
|
+
const resolvedStatus = resolveTableRowStatus(status);
|
|
171
|
+
if (!resolvedStatus) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const signifier = resolvedStatus.variant === 'dot' ? /*#__PURE__*/_jsx("span", {
|
|
175
|
+
...stylex.props(styles.dot(resolvedStatus.color))
|
|
176
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
177
|
+
icon: resolvedStatus.icon,
|
|
178
|
+
size: "xsm",
|
|
179
|
+
color: 'iconColor' in resolvedStatus ? resolvedStatus.iconColor : 'inherit'
|
|
180
|
+
});
|
|
181
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
182
|
+
content: status.label,
|
|
183
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
184
|
+
...stylex.props(styles.wrap, resolvedStatus.variant === 'icon' && 'customColor' in resolvedStatus && styles.customIcon(resolvedStatus.customColor)),
|
|
185
|
+
role: "img",
|
|
186
|
+
"aria-label": status.label,
|
|
187
|
+
children: signifier
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return {
|
|
193
|
+
transformColumns(columns) {
|
|
194
|
+
return [statusColumn, ...columns];
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}, [getStatus, t]);
|
|
152
198
|
}
|