@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
|
@@ -21,12 +21,22 @@
|
|
|
21
21
|
* While the panel is collapsed, aria-valuenow is clamped to aria-valuemin
|
|
22
22
|
* (a value below the minimum is invalid per WCAG 4.1.2) and a localized
|
|
23
23
|
* "Collapsed" aria-valuetext announces the real state.
|
|
24
|
+
*
|
|
25
|
+
* Dragging takes pointer capture on the grab zone, so the rest of the gesture
|
|
26
|
+
* is delivered to that element instead of being hit-tested against whatever
|
|
27
|
+
* the cursor happens to be over. A resizable region that contains an embedded
|
|
28
|
+
* frame otherwise loses the drag the moment the cursor crosses the frame: the
|
|
29
|
+
* events go to the guest document, and a listener on the host window never
|
|
30
|
+
* hears them again. Captured events are delivered to the capturing element,
|
|
31
|
+
* so the move/up/cancel handlers live on the grab zone (as in Slider), not on
|
|
32
|
+
* window.
|
|
24
33
|
*/
|
|
25
34
|
|
|
26
35
|
import {useCallback, useEffect, useRef, useState} from 'react';
|
|
27
36
|
import type {ReactNode} from 'react';
|
|
28
37
|
import * as stylex from '@stylexjs/stylex';
|
|
29
38
|
import type {BaseProps} from '../BaseProps';
|
|
39
|
+
import {devWarn} from '../utils/devWarning';
|
|
30
40
|
import {
|
|
31
41
|
colorVars,
|
|
32
42
|
durationVars,
|
|
@@ -85,6 +95,21 @@ function hitAreaBiasDir(
|
|
|
85
95
|
return effectiveSide === 'start' ? -1 : 1;
|
|
86
96
|
}
|
|
87
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Drag feedback lives on `<body>`, not on the handle: the pointer spends the
|
|
100
|
+
* drag off the handle, over whatever the panels contain, and the resize cursor
|
|
101
|
+
* has to hold there. Module scope so the writes stay outside the component.
|
|
102
|
+
*/
|
|
103
|
+
function applyBodyDragStyles(isHorizontal: boolean): void {
|
|
104
|
+
document.body.style.cursor = isHorizontal ? 'col-resize' : 'row-resize';
|
|
105
|
+
document.body.style.userSelect = 'none';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function clearBodyDragStyles(): void {
|
|
109
|
+
document.body.style.cursor = '';
|
|
110
|
+
document.body.style.userSelect = '';
|
|
111
|
+
}
|
|
112
|
+
|
|
88
113
|
const styles = stylex.create({
|
|
89
114
|
handle: {
|
|
90
115
|
position: 'relative',
|
|
@@ -369,9 +394,14 @@ export function ResizeHandle({
|
|
|
369
394
|
const t = useTranslator();
|
|
370
395
|
const label = labelFromProps ?? t('@astryx.resizable.handle.label');
|
|
371
396
|
const handleRef = useRef<HTMLDivElement>(null);
|
|
372
|
-
//
|
|
373
|
-
//
|
|
374
|
-
|
|
397
|
+
// The pointer that owns the in-flight drag, plus the values its deltas are
|
|
398
|
+
// measured against. A ref so moves don't re-render, and so unmount can tell
|
|
399
|
+
// a live drag from a finished one.
|
|
400
|
+
const dragRef = useRef<{
|
|
401
|
+
pointerId: number;
|
|
402
|
+
startPos: number;
|
|
403
|
+
rtl: number;
|
|
404
|
+
} | null>(null);
|
|
375
405
|
const [isDragging, setIsDragging] = useState(false);
|
|
376
406
|
const [isHovered, setIsHovered] = useState(false);
|
|
377
407
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -397,51 +427,96 @@ export function ResizeHandle({
|
|
|
397
427
|
|
|
398
428
|
const isInteracting = isHovered || isFocused;
|
|
399
429
|
|
|
430
|
+
// A handle whose axis disagrees with its hook drags along one axis while the
|
|
431
|
+
// hook measures percentage bounds on the other. `ResizableProps` is exported,
|
|
432
|
+
// so `_direction` is optional for old hand-built objects; absent means there
|
|
433
|
+
// is no hook axis to compare, not that the hook is horizontal.
|
|
434
|
+
const didWarnAxisRef = useRef(false);
|
|
435
|
+
useEffect(() => {
|
|
436
|
+
const hookDirection = resizable?._direction;
|
|
437
|
+
if (
|
|
438
|
+
hookDirection != null &&
|
|
439
|
+
hookDirection !== direction &&
|
|
440
|
+
!didWarnAxisRef.current
|
|
441
|
+
) {
|
|
442
|
+
didWarnAxisRef.current = true;
|
|
443
|
+
devWarn(
|
|
444
|
+
'ResizeHandle',
|
|
445
|
+
`direction="${direction}" but its useResizable region is ` +
|
|
446
|
+
`"${hookDirection}". They must match: the hook measures one axis ` +
|
|
447
|
+
'and the handle drags the other.',
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
}, [direction, resizable]);
|
|
451
|
+
|
|
400
452
|
// --- Pointer drag ---
|
|
453
|
+
const clearDrag = useCallback(() => {
|
|
454
|
+
dragRef.current = null;
|
|
455
|
+
setIsDragging(false);
|
|
456
|
+
clearBodyDragStyles();
|
|
457
|
+
}, []);
|
|
458
|
+
|
|
401
459
|
const handlePointerDown = useCallback(
|
|
402
|
-
(e: React.PointerEvent) => {
|
|
403
|
-
if (isDisabled || !resizable) {
|
|
460
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
461
|
+
if (isDisabled || !resizable || dragRef.current) {
|
|
404
462
|
return;
|
|
405
463
|
}
|
|
406
464
|
e.preventDefault();
|
|
407
465
|
e.stopPropagation();
|
|
466
|
+
// Take the pointer for the whole gesture. Without capture the browser
|
|
467
|
+
// re-hit-tests every move, so a frame anywhere under the drag path
|
|
468
|
+
// swallows the rest of it into the guest document.
|
|
469
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
470
|
+
dragRef.current = {
|
|
471
|
+
pointerId: e.pointerId,
|
|
472
|
+
startPos: isHorizontal ? e.clientX : e.clientY,
|
|
473
|
+
rtl: isHorizontal ? getRTLMultiplier() : 1,
|
|
474
|
+
};
|
|
408
475
|
setIsDragging(true);
|
|
409
476
|
resizable._onResizeStart();
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
477
|
+
applyBodyDragStyles(isHorizontal);
|
|
478
|
+
},
|
|
479
|
+
[isDisabled, resizable, isHorizontal, getRTLMultiplier],
|
|
480
|
+
);
|
|
414
481
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const onUp = () => {
|
|
421
|
-
cleanup();
|
|
422
|
-
setIsDragging(false);
|
|
423
|
-
resizable._onResizeEnd();
|
|
424
|
-
document.body.style.cursor = '';
|
|
425
|
-
document.body.style.userSelect = '';
|
|
426
|
-
};
|
|
427
|
-
const onCancel = () => {
|
|
428
|
-
cleanup();
|
|
429
|
-
setIsDragging(false);
|
|
430
|
-
document.body.style.cursor = '';
|
|
431
|
-
document.body.style.userSelect = '';
|
|
432
|
-
};
|
|
433
|
-
function cleanup() {
|
|
434
|
-
window.removeEventListener('pointermove', onMove);
|
|
435
|
-
window.removeEventListener('pointerup', onUp);
|
|
436
|
-
window.removeEventListener('pointercancel', onCancel);
|
|
437
|
-
dragCleanupRef.current = null;
|
|
482
|
+
const handlePointerMove = useCallback(
|
|
483
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
484
|
+
const drag = dragRef.current;
|
|
485
|
+
if (!drag || drag.pointerId !== e.pointerId || !resizable) {
|
|
486
|
+
return;
|
|
438
487
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
window.addEventListener('pointercancel', onCancel);
|
|
442
|
-
dragCleanupRef.current = cleanup;
|
|
488
|
+
const currentPos = isHorizontal ? e.clientX : e.clientY;
|
|
489
|
+
resizable._onResizeMove((currentPos - drag.startPos) * drag.rtl * sign);
|
|
443
490
|
},
|
|
444
|
-
[
|
|
491
|
+
[resizable, isHorizontal, sign],
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const handlePointerUp = useCallback(
|
|
495
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
496
|
+
if (dragRef.current?.pointerId !== e.pointerId) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
clearDrag();
|
|
500
|
+
resizable?._onResizeEnd();
|
|
501
|
+
},
|
|
502
|
+
[clearDrag, resizable],
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
// Serves pointercancel and lostpointercapture alike: an interrupted drag
|
|
506
|
+
// ends without signalling a resize end. lostpointercapture also fires on the
|
|
507
|
+
// implicit release after every pointerup/pointercancel, by which point the
|
|
508
|
+
// drag is already cleared and this is a no-op.
|
|
509
|
+
const cancelDrag = useCallback(
|
|
510
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
511
|
+
if (dragRef.current?.pointerId !== e.pointerId) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
clearDrag();
|
|
515
|
+
// Not a resize end, but still the end of the gesture: the region froze
|
|
516
|
+
// state for the duration of the drag and has to be told it is over.
|
|
517
|
+
resizable?._onResizeCancel?.();
|
|
518
|
+
},
|
|
519
|
+
[clearDrag, resizable],
|
|
445
520
|
);
|
|
446
521
|
|
|
447
522
|
// --- Keyboard ---
|
|
@@ -515,16 +590,20 @@ export function ResizeHandle({
|
|
|
515
590
|
}, [isDisabled, resizable]);
|
|
516
591
|
|
|
517
592
|
// --- Cleanup on unmount ---
|
|
518
|
-
//
|
|
519
|
-
//
|
|
520
|
-
//
|
|
521
|
-
//
|
|
593
|
+
// Removing the grab zone implicitly releases its captured pointer and takes
|
|
594
|
+
// its listeners with it, so an in-flight drag stops driving the region on
|
|
595
|
+
// its own. The body cursor/user-select overrides are not on the element,
|
|
596
|
+
// though, so they have to be released here or they stick after the handle
|
|
597
|
+
// is gone — and the region, which outlives this handle, still has to hear
|
|
598
|
+
// that its gesture is over.
|
|
599
|
+
const cancelOnUnmountRef = useRef<(() => void) | undefined>(undefined);
|
|
600
|
+
cancelOnUnmountRef.current = resizable?._onResizeCancel;
|
|
522
601
|
useEffect(() => {
|
|
523
602
|
return () => {
|
|
524
|
-
if (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
603
|
+
if (dragRef.current) {
|
|
604
|
+
dragRef.current = null;
|
|
605
|
+
clearBodyDragStyles();
|
|
606
|
+
cancelOnUnmountRef.current?.();
|
|
528
607
|
}
|
|
529
608
|
};
|
|
530
609
|
}, []);
|
|
@@ -617,6 +696,10 @@ export function ResizeHandle({
|
|
|
617
696
|
isDisabled && styles.disabled,
|
|
618
697
|
)}
|
|
619
698
|
onPointerDown={handlePointerDown}
|
|
699
|
+
onPointerMove={handlePointerMove}
|
|
700
|
+
onPointerUp={handlePointerUp}
|
|
701
|
+
onPointerCancel={cancelDrag}
|
|
702
|
+
onLostPointerCapture={cancelDrag}
|
|
620
703
|
onPointerEnter={() => setIsHovered(true)}
|
|
621
704
|
onPointerLeave={() => {
|
|
622
705
|
if (!isDragging) {
|
package/src/Resizable/index.ts
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* @position Package entry point for Resizable
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
export {percent} from './utils';
|
|
12
13
|
export {useResizable} from './useResizable';
|
|
14
|
+
export type {ResizablePercentSize, ResizableSize} from './utils';
|
|
13
15
|
export type {
|
|
14
16
|
ResizableRegion,
|
|
15
17
|
ResizableRegionConfig,
|