@astryxdesign/core 0.7.11 → 0.7.12-canary.ccb4a6d
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/AppShellMobileContext.d.ts.map +1 -1
- package/dist/AppShell/AppShellMobileContext.js +4 -3
- package/dist/AppShell/useAppShellMainId.d.ts.map +1 -1
- package/dist/AppShell/useAppShellMainId.js +3 -2
- package/dist/Avatar/AvatarSizeContext.d.ts.map +1 -1
- package/dist/Avatar/AvatarSizeContext.js +2 -2
- package/dist/Avatar/AvatarStatusLabelContext.d.ts +2 -2
- package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -1
- package/dist/Avatar/AvatarStatusLabelContext.js +3 -3
- package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupContext.js +2 -2
- package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetHostContext.js +3 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +48 -4
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcherContext.js +2 -2
- package/dist/BottomSheet/bottomSheetEscape.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetEscape.js +2 -2
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +2 -13
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +25 -42
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +12 -21
- package/dist/Button/buttonHitArea.d.ts.map +1 -1
- package/dist/Button/buttonHitArea.js +3 -3
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +13 -7
- package/dist/ButtonGroup/ButtonGroupContext.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroupContext.js +2 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +24 -15
- package/dist/Chat/ChatContext.d.ts.map +1 -1
- package/dist/Chat/ChatContext.js +6 -5
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +7 -22
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxRowPressContext.js +1 -1
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -3
- package/dist/CommandPalette/CommandPaletteContext.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteContext.js +4 -3
- package/dist/CommandPalette/busyStartSettle.d.ts.map +1 -1
- package/dist/CommandPalette/busyStartSettle.js +2 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +41 -4
- package/dist/Dialog/DialogContext.d.ts.map +1 -1
- package/dist/Dialog/DialogContext.js +3 -2
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +6 -5
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +4 -15
- package/dist/DropdownMenu/menuRegionStops.d.ts.map +1 -1
- package/dist/DropdownMenu/menuRegionStops.js +2 -37
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +2 -2
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +19 -16
- package/dist/HoverCard/HoverCard.d.ts +1 -2
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +1 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +5 -1
- package/dist/Icon/IconDefaultSizeContext.d.ts.map +1 -1
- package/dist/Icon/IconDefaultSizeContext.js +2 -2
- package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupContext.js +2 -2
- package/dist/InputGroup/InputGroupInternalContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupInternalContext.js +2 -2
- package/dist/InteractiveRoleContext/InteractiveRoleContext.d.ts.map +1 -1
- package/dist/InteractiveRoleContext/InteractiveRoleContext.js +5 -3
- package/dist/Item/ItemDescriptionContext.d.ts.map +1 -1
- package/dist/Item/ItemDescriptionContext.js +3 -3
- package/dist/Item/ItemListRowContext.d.ts.map +1 -1
- package/dist/Item/ItemListRowContext.js +3 -3
- package/dist/Item/ItemMarkerColumnsContext.d.ts +1 -1
- package/dist/Item/ItemMarkerColumnsContext.d.ts.map +1 -1
- package/dist/Item/ItemMarkerColumnsContext.js +2 -2
- package/dist/Layer/LayerContext.d.ts.map +1 -1
- package/dist/Layer/LayerContext.js +3 -2
- package/dist/Layer/LayerDepthContext.d.ts.map +1 -1
- package/dist/Layer/LayerDepthContext.js +3 -2
- package/dist/Layer/LayerTouch.d.ts +3 -2
- package/dist/Layer/LayerTouch.d.ts.map +1 -1
- package/dist/Layer/LayerTouch.js +3 -2
- package/dist/Layer/anchorName.d.ts.map +1 -1
- package/dist/Layer/anchorName.js +5 -1
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +115 -13
- package/dist/Layer/layerScopedContext.d.ts +5 -2
- package/dist/Layer/layerScopedContext.d.ts.map +1 -1
- package/dist/Layer/layerScopedContext.js +27 -10
- package/dist/Layer/layerSlideRules.d.ts +28 -26
- package/dist/Layer/layerSlideRules.d.ts.map +1 -1
- package/dist/Layer/layerSlideRules.js +41 -40
- package/dist/Layer/outsidePress.d.ts +21 -3
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +119 -29
- package/dist/Layer/settledBox.d.ts +9 -8
- package/dist/Layer/settledBox.d.ts.map +1 -1
- package/dist/Layer/settledBox.js +169 -49
- package/dist/Layer/toastHost.d.ts.map +1 -1
- package/dist/Layer/toastHost.js +3 -2
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +172 -60
- package/dist/Layer/useLayerKeyboardClearance.d.ts +14 -2
- package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
- package/dist/Layer/useLayerKeyboardClearance.js +83 -12
- package/dist/Layer/useTouchTrigger.d.ts +21 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +61 -37
- package/dist/Layout/Layout.d.ts +1 -1
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +10 -6
- package/dist/Layout/LayoutAreaContext.d.ts.map +1 -1
- package/dist/Layout/LayoutAreaContext.js +3 -3
- package/dist/Layout/LayoutContent.d.ts +6 -6
- package/dist/Layout/LayoutContent.js +9 -9
- package/dist/Layout/LayoutDividerContext.d.ts.map +1 -1
- package/dist/Layout/LayoutDividerContext.js +2 -2
- package/dist/Layout/LayoutSlotsContext.d.ts.map +1 -1
- package/dist/Layout/LayoutSlotsContext.js +2 -2
- package/dist/Link/LinkContext.d.ts +16 -0
- package/dist/Link/LinkContext.d.ts.map +1 -1
- package/dist/Link/LinkContext.js +3 -3
- package/dist/List/List.d.ts +12 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +29 -10
- package/dist/List/ListContext.d.ts +18 -3
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +9 -6
- package/dist/List/ListItem.d.ts +13 -4
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +37 -10
- package/dist/List/listLayoutUpdates.d.ts +34 -0
- package/dist/List/listLayoutUpdates.d.ts.map +1 -0
- package/dist/List/listLayoutUpdates.js +539 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +57 -10
- package/dist/Markdown/blockDirection.d.ts +26 -0
- package/dist/Markdown/blockDirection.d.ts.map +1 -0
- package/dist/Markdown/blockDirection.js +68 -0
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts +3 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.js +3 -1
- package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListContext.js +2 -2
- package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
- package/dist/NavMenu/NavMenuContext.js +5 -4
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +9 -9
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +11 -8
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +2 -2
- package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -1
- package/dist/RadioList/RadioListReasonContext.js +1 -1
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlContext.js +2 -2
- package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -1
- package/dist/SelectableCard/selectableCardInput.js +2 -2
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -1
- package/dist/Selector/SelectorRowLayoutContext.js +2 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts +4 -3
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.js +4 -3
- package/dist/SideNav/SideNavFocusTargetsContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavFocusTargetsContext.js +2 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -2
- package/dist/SideNav/SideNavRenderContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavRenderContext.js +4 -3
- package/dist/SideNav/railMotion.d.ts +40 -0
- package/dist/SideNav/railMotion.d.ts.map +1 -1
- package/dist/SideNav/railMotion.js +2 -2
- package/dist/SizeContext/SizeContext.d.ts.map +1 -1
- package/dist/SizeContext/SizeContext.js +2 -2
- package/dist/SnapPaging/SnapPaging.d.ts.map +1 -1
- package/dist/SnapPaging/SnapPaging.js +162 -36
- package/dist/SnapPaging/snapPagingValue.d.ts +29 -3
- package/dist/SnapPaging/snapPagingValue.d.ts.map +1 -1
- package/dist/SnapPaging/snapPagingValue.js +38 -6
- package/dist/Spinner/SpinnerOwnerContext.d.ts.map +1 -1
- package/dist/Spinner/SpinnerOwnerContext.js +2 -2
- package/dist/Stepper/StepperContext.d.ts.map +1 -1
- package/dist/Stepper/StepperContext.js +3 -3
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +8 -3
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +2 -2
- package/dist/Table/BaseTable.d.ts +3 -2
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +73 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -2
- package/dist/Table/TableContext.d.ts.map +1 -1
- package/dist/Table/TableContext.js +2 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +4 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +5 -3
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +16 -18
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +48 -39
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +4 -2
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +3 -2
- package/dist/Table/tableRowContextUsage.d.ts +21 -0
- package/dist/Table/tableRowContextUsage.d.ts.map +1 -0
- package/dist/Table/tableRowContextUsage.js +88 -0
- package/dist/Table/types.d.ts +58 -5
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +5 -2
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +18 -14
- package/dist/Text/TruncationTooltip.d.ts +45 -0
- package/dist/Text/TruncationTooltip.d.ts.map +1 -0
- package/dist/Text/TruncationTooltip.js +123 -0
- package/dist/Text/textClampContext.d.ts.map +1 -1
- package/dist/Text/textClampContext.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +4 -0
- package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.js +2 -2
- package/dist/Token/TokenNamingContext.d.ts.map +1 -1
- package/dist/Token/TokenNamingContext.js +2 -2
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerClearAllMessageContext.js +2 -2
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +12 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +2 -2
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +12 -6
- package/dist/Tooltip/tooltipPresentInterest.d.ts +29 -0
- package/dist/Tooltip/tooltipPresentInterest.d.ts.map +1 -0
- package/dist/Tooltip/tooltipPresentInterest.js +29 -0
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +30 -4
- package/dist/TopNav/TopNavContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavContext.js +2 -2
- package/dist/TopNav/TopNavMobileContentContext.d.ts +1 -1
- package/dist/TopNav/TopNavMobileContentContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavMobileContentContext.js +4 -3
- package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavRenderContext.js +4 -3
- package/dist/Typeahead/busyIndicatorLane.d.ts.map +1 -1
- package/dist/Typeahead/busyIndicatorLane.js +3 -2
- package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -1
- package/dist/Typeahead/committedChoicesKey.js +3 -2
- package/dist/Typeahead/trailingKeyDown.d.ts.map +1 -1
- package/dist/Typeahead/trailingKeyDown.js +3 -2
- package/dist/astryx.css +18 -8
- package/dist/gestures/GestureArena.d.ts +2 -0
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +8 -1
- package/dist/gestures/GestureRecognizer.d.ts +6 -0
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +9 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +9 -4
- package/dist/hooks/focusableSelector.d.ts +13 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +22 -2
- package/dist/hooks/longPressDetector.d.ts.map +1 -1
- package/dist/hooks/longPressDetector.js +1 -25
- package/dist/hooks/pressGroupContext.d.ts.map +1 -1
- package/dist/hooks/pressGroupContext.js +1 -1
- package/dist/hooks/useActionGroupTracking.d.ts +18 -1
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -1
- package/dist/hooks/useActionGroupTracking.js +13 -2
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +3 -2
- package/dist/hooks/useFocusTrap.d.ts +11 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +47 -2
- package/dist/hooks/useListFocus.d.ts +7 -0
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +20 -3
- package/dist/hooks/usePager.d.ts.map +1 -1
- package/dist/hooks/usePager.js +26 -3
- package/dist/hooks/useScrollOverflow.d.ts +22 -0
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +67 -11
- package/dist/i18n/InternationalizationContext.d.ts +19 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -3
- package/dist/i18n/englishFallback.d.ts.map +1 -1
- package/dist/i18n/englishFallback.js +5 -1
- package/dist/i18n/firstStrongDirection.d.ts +7 -0
- package/dist/i18n/firstStrongDirection.d.ts.map +1 -0
- package/dist/i18n/firstStrongDirection.js +65 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/internal/scroll-anchoring.d.ts +16 -0
- package/dist/internal/scroll-anchoring.d.ts.map +1 -0
- package/dist/internal/scroll-anchoring.js +16 -0
- package/dist/internal/touch.d.ts +2 -0
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +4 -1
- package/dist/motion/animatedLayout.d.ts +8 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +51 -3
- package/dist/motion/animator.d.ts +19 -2
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +72 -7
- package/dist/privateAttributes/itemKey.stylex.d.ts +5 -0
- package/dist/privateAttributes/itemKey.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/itemKey.stylex.js +25 -0
- package/dist/privateAttributes/leaving.stylex.d.ts +5 -0
- package/dist/privateAttributes/leaving.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/leaving.stylex.js +23 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/press.stylex.js +13 -3
- package/dist/privateAttributes/scrollAnchoring.stylex.d.ts +7 -0
- package/dist/privateAttributes/scrollAnchoring.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/scrollAnchoring.stylex.js +50 -0
- package/dist/privateAttributes/travelling.stylex.d.ts +27 -0
- package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/travelling.stylex.js +51 -0
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +95 -49
- package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
- package/dist/theme/syntax/SyntaxTheme.js +3 -2
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +3 -2
- package/dist/utils/calendarSystem.d.ts.map +1 -1
- package/dist/utils/calendarSystem.js +4 -1
- package/dist/utils/flatTree.d.ts +13 -0
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +28 -4
- package/dist/utils/inputAge.d.ts +22 -0
- package/dist/utils/inputAge.d.ts.map +1 -0
- package/dist/utils/inputAge.js +54 -0
- package/dist/utils/inputStream.d.ts +8 -0
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +53 -3
- package/dist/utils/moduleLoader.d.ts +23 -0
- package/dist/utils/moduleLoader.d.ts.map +1 -0
- package/dist/utils/moduleLoader.js +31 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +13 -8
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +7 -14
- package/dist/utils/sharedContext.d.ts +18 -0
- package/dist/utils/sharedContext.d.ts.map +1 -0
- package/dist/utils/sharedContext.js +33 -0
- package/dist/utils/sharedRealm.d.ts +24 -0
- package/dist/utils/sharedRealm.d.ts.map +1 -0
- package/dist/utils/sharedRealm.js +38 -0
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +10 -5
- package/src/AppShell/AppShellMobileContext.tsx +8 -3
- package/src/AppShell/useAppShellMainId.ts +7 -2
- package/src/Avatar/AvatarSizeContext.ts +6 -2
- package/src/Avatar/AvatarStatusLabelContext.ts +8 -3
- package/src/AvatarGroup/AvatarGroupContext.ts +7 -4
- package/src/BottomSheet/BottomSheetHostContext.ts +7 -3
- package/src/BottomSheet/BottomSheetPanel.tsx +56 -7
- package/src/BottomSheet/BottomSheetSwitcherContext.ts +7 -2
- package/src/BottomSheet/bottomSheetEscape.ts +6 -2
- package/src/BottomSheet/bottomSheetStack.ts +6 -14
- package/src/BottomSheet/useSheetGestures.ts +28 -48
- package/src/Breadcrumbs/Breadcrumbs.tsx +6 -5
- package/src/Button/Button.doc.mjs +3 -3
- package/src/Button/Button.tsx +10 -22
- package/src/Button/buttonHitArea.ts +7 -4
- package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -3
- package/src/ButtonGroup/ButtonGroup.tsx +27 -16
- package/src/ButtonGroup/ButtonGroupContext.ts +7 -4
- package/src/Carousel/Carousel.tsx +33 -15
- package/src/Chat/ChatContext.tsx +23 -7
- package/src/Chat/useChatStreamScroll.ts +7 -26
- package/src/CheckboxInput/CheckboxRowPressContext.ts +5 -1
- package/src/CheckboxList/CheckboxListContext.tsx +5 -1
- package/src/Collapsible/CollapsibleGroupContext.tsx +11 -3
- package/src/CommandPalette/CommandPaletteContext.ts +8 -3
- package/src/CommandPalette/busyStartSettle.ts +6 -2
- package/src/DateInput/TouchDateField.tsx +62 -4
- package/src/Dialog/DialogContext.ts +7 -2
- package/src/DropdownMenu/DropdownMenuContext.tsx +18 -5
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +6 -18
- package/src/DropdownMenu/menuRegionStops.ts +1 -49
- package/src/FormLayout/FormLayoutContext.ts +3 -3
- package/src/Heading/Heading.tsx +34 -18
- package/src/HoverCard/HoverCard.doc.mjs +3 -3
- package/src/HoverCard/HoverCard.tsx +1 -2
- package/src/HoverCard/useHoverCard.tsx +6 -2
- package/src/Icon/IconDefaultSizeContext.ts +6 -2
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/InputGroup/InputGroupContext.ts +7 -4
- package/src/InputGroup/InputGroupInternalContext.ts +6 -2
- package/src/InteractiveRoleContext/InteractiveRoleContext.ts +8 -3
- package/src/Item/ItemDescriptionContext.tsx +7 -3
- package/src/Item/ItemListRowContext.tsx +7 -3
- package/src/Item/ItemMarkerColumnsContext.tsx +7 -2
- package/src/Layer/LayerContext.ts +7 -2
- package/src/Layer/LayerDepthContext.tsx +3 -2
- package/src/Layer/LayerTouch.ts +6 -2
- package/src/Layer/anchorName.ts +8 -4
- package/src/Layer/inputHold.ts +138 -21
- package/src/Layer/layerScopedContext.tsx +34 -7
- package/src/Layer/layerSlideRules.ts +43 -40
- package/src/Layer/outsidePress.ts +144 -28
- package/src/Layer/settledBox.ts +216 -54
- package/src/Layer/toastHost.tsx +6 -2
- package/src/Layer/useLayer.tsx +200 -69
- package/src/Layer/useLayerKeyboardClearance.ts +90 -12
- package/src/Layer/useTouchTrigger.ts +89 -40
- package/src/Layout/Layout.doc.mjs +17 -0
- package/src/Layout/Layout.tsx +13 -9
- package/src/Layout/LayoutAreaContext.ts +8 -9
- package/src/Layout/LayoutContent.doc.mjs +11 -0
- package/src/Layout/LayoutContent.tsx +9 -9
- package/src/Layout/LayoutDividerContext.ts +6 -2
- package/src/Layout/LayoutSlotsContext.ts +6 -3
- package/src/Link/LinkContext.ts +7 -3
- package/src/List/List.doc.mjs +5 -0
- package/src/List/List.tsx +53 -5
- package/src/List/ListContext.tsx +28 -6
- package/src/List/ListItem.doc.mjs +11 -0
- package/src/List/ListItem.tsx +51 -14
- package/src/List/listLayoutUpdates.ts +603 -0
- package/src/Markdown/Markdown.tsx +93 -5
- package/src/Markdown/blockDirection.ts +100 -0
- package/src/Markdown/plugins/HeadingLinksRenderer.tsx +4 -0
- package/src/MetadataList/MetadataListContext.tsx +6 -2
- package/src/NavMenu/NavMenuContext.tsx +14 -5
- package/src/Popover/Popover.tsx +23 -16
- package/src/Popover/usePopover.tsx +21 -7
- package/src/RadioList/RadioList.tsx +7 -4
- package/src/RadioList/RadioListReasonContext.ts +1 -1
- package/src/Section/Section.doc.mjs +22 -0
- package/src/SegmentedControl/SegmentedControlContext.ts +6 -2
- package/src/SelectableCard/selectableCardInput.ts +6 -2
- package/src/Selector/SelectorRowLayoutContext.ts +6 -2
- package/src/SideNav/SideNavCollapseButton.doc.mjs +5 -5
- package/src/SideNav/SideNavCollapseButton.tsx +4 -3
- package/src/SideNav/SideNavCollapseContext.ts +12 -7
- package/src/SideNav/SideNavFocusTargetsContext.ts +6 -2
- package/src/SideNav/SideNavItem.tsx +6 -2
- package/src/SideNav/SideNavRenderContext.ts +9 -8
- package/src/SideNav/railMotion.ts +6 -2
- package/src/SizeContext/SizeContext.ts +6 -2
- package/src/SnapPaging/SnapPaging.ts +164 -39
- package/src/SnapPaging/snapPagingValue.ts +59 -12
- package/src/Spinner/SpinnerOwnerContext.ts +6 -2
- package/src/Stepper/StepperContext.ts +12 -3
- package/src/Switch/useSwitchTouch.ts +7 -5
- package/src/TabList/TabListContext.ts +7 -2
- package/src/Table/BaseTable.tsx +143 -19
- package/src/Table/Table.tsx +4 -3
- package/src/Table/TableContext.ts +6 -2
- package/src/Table/index.ts +2 -0
- package/src/Table/plugins/filtering/useTableFiltering.tsx +11 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +10 -3
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +38 -29
- package/src/Table/plugins/selection/useTableSelection.tsx +7 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +6 -2
- package/src/Table/tableRowContextUsage.ts +105 -0
- package/src/Table/types.ts +60 -2
- package/src/Table/useBaseTablePlugins.ts +5 -2
- package/src/Table/useTableRowIndex.doc.mjs +6 -7
- package/src/Text/Text.tsx +34 -18
- package/src/Text/TruncationTooltip.tsx +179 -0
- package/src/Text/textClampContext.ts +5 -1
- package/src/TimeInput/TimeInput.tsx +4 -0
- package/src/ToggleButton/ToggleButtonGroup.tsx +6 -2
- package/src/Token/TokenNamingContext.ts +6 -2
- package/src/Tokenizer/TokenizerClearAllMessageContext.ts +4 -4
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +3 -3
- package/src/Toolbar/Toolbar.tsx +16 -9
- package/src/Tooltip/tooltipPresentInterest.ts +43 -0
- package/src/Tooltip/useTooltip.tsx +33 -0
- package/src/TopNav/TopNavContext.ts +6 -2
- package/src/TopNav/TopNavMobileContentContext.ts +8 -3
- package/src/TopNav/TopNavRenderContext.ts +8 -4
- package/src/Typeahead/busyIndicatorLane.tsx +7 -2
- package/src/Typeahead/committedChoicesKey.tsx +4 -3
- package/src/Typeahead/trailingKeyDown.tsx +7 -2
- package/src/gestures/GestureArena.ts +8 -1
- package/src/gestures/GestureRecognizer.ts +9 -0
- package/src/gestures/PressTracker.ts +13 -4
- package/src/hooks/focusableSelector.ts +29 -1
- package/src/hooks/longPressDetector.ts +1 -35
- package/src/hooks/pressGroupContext.ts +5 -1
- package/src/hooks/useActionGroupTracking.ts +29 -2
- package/src/hooks/useAnnounce.ts +8 -4
- package/src/hooks/useFocusTrap.ts +62 -2
- package/src/hooks/useListFocus.ts +34 -7
- package/src/hooks/usePager.ts +30 -3
- package/src/hooks/useScrollOverflow.ts +65 -7
- package/src/i18n/InternationalizationContext.ts +12 -8
- package/src/i18n/englishFallback.ts +7 -1
- package/src/i18n/firstStrongDirection.ts +69 -0
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/internal/scroll-anchoring.ts +16 -0
- package/src/internal/touch.ts +4 -0
- package/src/motion/animatedLayout.ts +44 -3
- package/src/motion/animator.ts +97 -9
- package/src/privateAttributes/itemKey.stylex.ts +25 -0
- package/src/privateAttributes/leaving.stylex.ts +23 -0
- package/src/privateAttributes/press.stylex.ts +19 -7
- package/src/privateAttributes/scrollAnchoring.stylex.ts +50 -0
- package/src/privateAttributes/travelling.stylex.ts +88 -0
- package/src/theme/Theme.tsx +124 -60
- package/src/theme/syntax/SyntaxTheme.tsx +7 -2
- package/src/theme/useTheme.ts +7 -8
- package/src/utils/calendarSystem.ts +7 -1
- package/src/utils/flatTree.ts +31 -4
- package/src/utils/inputAge.ts +66 -0
- package/src/utils/inputStream.ts +52 -3
- package/src/utils/moduleLoader.ts +47 -0
- package/src/utils/pressFeedback.ts +16 -7
- package/src/utils/selectionLock.ts +8 -18
- package/src/utils/sharedContext.ts +42 -0
- package/src/utils/sharedRealm.ts +42 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTableRowIndex.tsx
|
|
7
|
-
* @input React, StyleX, Table types
|
|
7
|
+
* @input React, StyleX, Table types, and each body row's TableRowContext
|
|
8
8
|
* @output Exports useTableRowIndex hook + config type
|
|
9
9
|
* @position Row-index plugin; consumed by Table via plugins prop
|
|
10
10
|
*
|
|
@@ -21,22 +21,20 @@ import type {TableColumn, TablePlugin} from '../../types';
|
|
|
21
21
|
/**
|
|
22
22
|
* Configuration for {@link useTableRowIndex}.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `<Table data>` — to derive each row's 1-based ordinal. Pass `getRowKey` when
|
|
27
|
-
* items don't have a stable identity by reference (e.g. new objects each
|
|
28
|
-
* render); it must return a **unique** string per row (duplicate keys collapse
|
|
29
|
-
* to a single ordinal).
|
|
24
|
+
* Without `data`, the plugin numbers each body row from the position Table
|
|
25
|
+
* gives it. With `data`, numbers follow that array, as before.
|
|
30
26
|
*/
|
|
31
27
|
export interface UseTableRowIndexConfig<T extends Record<string, unknown>> {
|
|
32
|
-
/** The data array currently rendered by the table (post sort/filter/page). */
|
|
33
|
-
data: T[];
|
|
34
28
|
/**
|
|
35
|
-
* Optional
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
* Optional: the array whose order the numbers follow. Omit it to number
|
|
30
|
+
* rows from the positions Table gives them.
|
|
31
|
+
*/
|
|
32
|
+
data?: T[];
|
|
33
|
+
/**
|
|
34
|
+
* Optional key extractor returning a **unique** string per row, used with
|
|
35
|
+
* `data`. When provided, rows match `data` by the returned string (stable
|
|
36
|
+
* across new object identities); otherwise by reference identity. For a
|
|
37
|
+
* stable plugin identity across renders, memoize this with `useCallback`.
|
|
40
38
|
*/
|
|
41
39
|
getRowKey?: (item: T) => string;
|
|
42
40
|
/** Header label for the index column. @default '#' */
|
|
@@ -45,6 +43,7 @@ export interface UseTableRowIndexConfig<T extends Record<string, unknown>> {
|
|
|
45
43
|
startFrom?: number;
|
|
46
44
|
}
|
|
47
45
|
|
|
46
|
+
const INDEX_COLUMN_KEY = '__rowIndex';
|
|
48
47
|
const INDEX_COLUMN_WIDTH = {type: 'pixel' as const, value: 48};
|
|
49
48
|
|
|
50
49
|
const styles = stylex.create({
|
|
@@ -58,24 +57,26 @@ const styles = stylex.create({
|
|
|
58
57
|
|
|
59
58
|
/**
|
|
60
59
|
* Returns a {@link TablePlugin} that prepends a right-aligned, monospaced
|
|
61
|
-
* row-number column. Numbering follows the
|
|
62
|
-
*
|
|
60
|
+
* row-number column. Numbering follows the rows the table renders, so it
|
|
61
|
+
* reflects the current sort / filter / pagination view.
|
|
63
62
|
*
|
|
64
63
|
* @example
|
|
65
64
|
* ```
|
|
66
|
-
* const rowIndex = useTableRowIndex(
|
|
65
|
+
* const rowIndex = useTableRowIndex();
|
|
67
66
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowIndex}} />;
|
|
68
67
|
* ```
|
|
69
68
|
*/
|
|
70
69
|
export function useTableRowIndex<T extends Record<string, unknown>>(
|
|
71
|
-
config: UseTableRowIndexConfig<T
|
|
70
|
+
config: UseTableRowIndexConfig<T> = {},
|
|
72
71
|
): TablePlugin<T> {
|
|
73
72
|
const {data, getRowKey, label = '#', startFrom = 1} = config;
|
|
74
73
|
|
|
75
|
-
//
|
|
76
|
-
// data array or key extractor changes. Keyed by getRowKey when provided
|
|
74
|
+
// The lookup into a caller's `data`. Keyed by getRowKey when provided
|
|
77
75
|
// (stable across new object identities), otherwise by object reference.
|
|
78
76
|
const lookup = useMemo(() => {
|
|
77
|
+
if (data == null) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
79
80
|
const map = new Map<unknown, number>();
|
|
80
81
|
for (let i = 0; i < data.length; i++) {
|
|
81
82
|
const item = data[i];
|
|
@@ -85,19 +86,28 @@ export function useTableRowIndex<T extends Record<string, unknown>>(
|
|
|
85
86
|
map.get(getRowKey ? getRowKey(item) : item);
|
|
86
87
|
}, [data, getRowKey]);
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
return useMemo((): TablePlugin<T> => {
|
|
90
|
+
// Table runs each cell's transforms just before it renders that cell. So
|
|
91
|
+
// the index cell's renderer reads the position that its own transform
|
|
92
|
+
// stored.
|
|
93
|
+
const positions = new WeakMap<T, number>();
|
|
94
|
+
return {
|
|
95
|
+
rowModel: 'flat',
|
|
96
|
+
transformBodyCell(props, column, item, _columnIndex, _columns, context) {
|
|
97
|
+
if (lookup == null && column.key === INDEX_COLUMN_KEY && context) {
|
|
98
|
+
positions.set(item, context.logicalIndex);
|
|
99
|
+
}
|
|
100
|
+
return props;
|
|
101
|
+
},
|
|
92
102
|
transformColumns(columns) {
|
|
93
103
|
const indexColumn: TableColumn<T> = {
|
|
94
|
-
key:
|
|
104
|
+
key: INDEX_COLUMN_KEY,
|
|
95
105
|
header: label,
|
|
96
106
|
width: INDEX_COLUMN_WIDTH,
|
|
97
107
|
align: 'end',
|
|
98
108
|
resizable: false,
|
|
99
109
|
renderCell: (item: T) => {
|
|
100
|
-
const idx = lookup(item);
|
|
110
|
+
const idx = lookup == null ? positions.get(item) : lookup(item);
|
|
101
111
|
if (idx == null) {
|
|
102
112
|
return null;
|
|
103
113
|
}
|
|
@@ -108,7 +118,6 @@ export function useTableRowIndex<T extends Record<string, unknown>>(
|
|
|
108
118
|
};
|
|
109
119
|
return [indexColumn, ...columns];
|
|
110
120
|
},
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
);
|
|
121
|
+
};
|
|
122
|
+
}, [label, startFrom, lookup]);
|
|
114
123
|
}
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
import {
|
|
41
|
-
createContext,
|
|
42
41
|
use,
|
|
43
42
|
useCallback,
|
|
44
43
|
useEffect,
|
|
@@ -58,6 +57,7 @@ import {
|
|
|
58
57
|
useComponentTranslator,
|
|
59
58
|
} from '../../../i18n/useComponentTranslator';
|
|
60
59
|
import english from '../../../i18n/generated-english/Table/plugins/selection/useTableSelection.generated';
|
|
60
|
+
import {createSharedContext} from '../../../utils/sharedContext';
|
|
61
61
|
|
|
62
62
|
registerEnglishFallback(english);
|
|
63
63
|
|
|
@@ -190,7 +190,11 @@ function applyRowSelectionStyle(
|
|
|
190
190
|
// =============================================================================
|
|
191
191
|
|
|
192
192
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
193
|
-
const SelectionStoreContext =
|
|
193
|
+
const SelectionStoreContext = createSharedContext<SelectionStore<any> | null>(
|
|
194
|
+
'SelectionStoreContext',
|
|
195
|
+
1,
|
|
196
|
+
null,
|
|
197
|
+
);
|
|
194
198
|
SelectionStoreContext.displayName = 'SelectionStoreContext';
|
|
195
199
|
|
|
196
200
|
// =============================================================================
|
|
@@ -395,6 +399,7 @@ export function useTableSelection<T extends Record<string, unknown>>(
|
|
|
395
399
|
|
|
396
400
|
return useMemo(
|
|
397
401
|
(): TablePlugin<T> => ({
|
|
402
|
+
rowModel: 'flat',
|
|
398
403
|
transformTableContext(children: ReactNode) {
|
|
399
404
|
return (
|
|
400
405
|
<SelectionStoreContext value={store}>
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
import {
|
|
33
|
-
createContext,
|
|
34
33
|
use,
|
|
35
34
|
useCallback,
|
|
36
35
|
useEffect,
|
|
@@ -58,6 +57,7 @@ import {
|
|
|
58
57
|
useComponentTranslator,
|
|
59
58
|
} from '../../../i18n/useComponentTranslator';
|
|
60
59
|
import english from '../../../i18n/generated-english/Table/plugins/tree/useTableTreeData.generated';
|
|
60
|
+
import {createSharedContext} from '../../../utils/sharedContext';
|
|
61
61
|
|
|
62
62
|
registerEnglishFallback(english);
|
|
63
63
|
|
|
@@ -172,7 +172,11 @@ function createTreeStore<T extends Record<string, unknown>>(
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
-
const TreeStoreContext =
|
|
175
|
+
const TreeStoreContext = createSharedContext<TreeStore<any> | null>(
|
|
176
|
+
'TreeStoreContext',
|
|
177
|
+
1,
|
|
178
|
+
null,
|
|
179
|
+
);
|
|
176
180
|
TreeStoreContext.displayName = 'TreeStoreContext';
|
|
177
181
|
|
|
178
182
|
/** Indent token -> index, for the primitive row snapshot. */
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file tableRowContextUsage.ts
|
|
5
|
+
* @input Immutable row contexts and the plugins whose transforms read them
|
|
6
|
+
* @output Per-plugin tracked contexts, and which plugins read the row index or
|
|
7
|
+
* the row count
|
|
8
|
+
* @position Private to BaseTable's row memoization; plugins never import it
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {TablePlugin, TableRowContext} from './types';
|
|
12
|
+
import {warnOnce} from '../utils/devWarning';
|
|
13
|
+
|
|
14
|
+
const indexReadingPlugins = new WeakSet<object>();
|
|
15
|
+
const countReadingPlugins = new WeakSet<object>();
|
|
16
|
+
const trackedContexts = new WeakMap<
|
|
17
|
+
TableRowContext,
|
|
18
|
+
WeakMap<object, TableRowContext>
|
|
19
|
+
>();
|
|
20
|
+
let transformingPlugin: object | null = null;
|
|
21
|
+
|
|
22
|
+
/** Run one plugin transform; context reads inside it are in time. */
|
|
23
|
+
export function runPluginTransform<R>(plugin: object, transform: () => R): R {
|
|
24
|
+
const outer = transformingPlugin;
|
|
25
|
+
transformingPlugin = plugin;
|
|
26
|
+
try {
|
|
27
|
+
return transform();
|
|
28
|
+
} finally {
|
|
29
|
+
transformingPlugin = outer;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Tracking sees only reads made during the transform. A row that does not
|
|
35
|
+
* re-render keeps its old context, so a later read can return a stale index
|
|
36
|
+
* or count.
|
|
37
|
+
*/
|
|
38
|
+
function warnIfLate(plugin: object, field: string): void {
|
|
39
|
+
if (transformingPlugin !== plugin) {
|
|
40
|
+
warnOnce(
|
|
41
|
+
`table-row-context-late-read-${field}`,
|
|
42
|
+
'Table',
|
|
43
|
+
`A plugin read TableRowContext.${field} after its transform returned. ` +
|
|
44
|
+
'Read context values during the transform and copy them into any callback it returns.',
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Whether a transform of the plugin has read a row's `logicalIndex`. */
|
|
50
|
+
export function readsRowIndex<T extends Record<string, unknown>>(
|
|
51
|
+
plugin: TablePlugin<T>,
|
|
52
|
+
): boolean {
|
|
53
|
+
return indexReadingPlugins.has(plugin);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Whether a transform of the plugin has read a row count. */
|
|
57
|
+
export function readsRowCount<T extends Record<string, unknown>>(
|
|
58
|
+
plugin: TablePlugin<T>,
|
|
59
|
+
): boolean {
|
|
60
|
+
return countReadingPlugins.has(plugin);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The context as one plugin sees it. Its getters record which values the
|
|
65
|
+
* plugin reads, so a row re-renders for a moved index or a changed count only
|
|
66
|
+
* when a plugin can show it. The values stay the same as the context's.
|
|
67
|
+
*/
|
|
68
|
+
export function trackRowContext<T extends Record<string, unknown>>(
|
|
69
|
+
plugin: TablePlugin<T>,
|
|
70
|
+
context: TableRowContext,
|
|
71
|
+
): TableRowContext {
|
|
72
|
+
let byPlugin = trackedContexts.get(context);
|
|
73
|
+
if (byPlugin == null) {
|
|
74
|
+
byPlugin = new WeakMap();
|
|
75
|
+
trackedContexts.set(context, byPlugin);
|
|
76
|
+
}
|
|
77
|
+
const cached = byPlugin.get(plugin);
|
|
78
|
+
if (cached != null) {
|
|
79
|
+
return cached;
|
|
80
|
+
}
|
|
81
|
+
const render = Object.freeze({
|
|
82
|
+
...context.render,
|
|
83
|
+
get logicalRowCount() {
|
|
84
|
+
warnIfLate(plugin, 'render.logicalRowCount');
|
|
85
|
+
countReadingPlugins.add(plugin);
|
|
86
|
+
return context.render.logicalRowCount;
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const tracked: TableRowContext = Object.freeze({
|
|
90
|
+
...context,
|
|
91
|
+
render,
|
|
92
|
+
get logicalIndex() {
|
|
93
|
+
warnIfLate(plugin, 'logicalIndex');
|
|
94
|
+
indexReadingPlugins.add(plugin);
|
|
95
|
+
return context.logicalIndex;
|
|
96
|
+
},
|
|
97
|
+
get logicalRowCount() {
|
|
98
|
+
warnIfLate(plugin, 'logicalRowCount');
|
|
99
|
+
countReadingPlugins.add(plugin);
|
|
100
|
+
return context.logicalRowCount;
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
byPlugin.set(plugin, tracked);
|
|
104
|
+
return tracked;
|
|
105
|
+
}
|
package/src/Table/types.ts
CHANGED
|
@@ -422,6 +422,51 @@ export type TableContextActions =
|
|
|
422
422
|
// Plugin Interface
|
|
423
423
|
// =============================================================================
|
|
424
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Immutable facts about the table that Table passes to row, cell and
|
|
427
|
+
* scroll-wrapper transforms.
|
|
428
|
+
*/
|
|
429
|
+
export interface TableRenderContext {
|
|
430
|
+
/** The branch Table renders: `data` rows from `data`, or caller `children`. */
|
|
431
|
+
readonly mode: 'data' | 'children';
|
|
432
|
+
/**
|
|
433
|
+
* The row model the plugins admit. `flat` unless a plugin declares another
|
|
434
|
+
* model, or has a body transform and declares none (`custom`).
|
|
435
|
+
*/
|
|
436
|
+
readonly rowModel: 'flat' | 'tree' | 'grouped' | 'detail' | 'custom';
|
|
437
|
+
/** The number of product rows in the complete `data` input. */
|
|
438
|
+
readonly logicalRowCount: number;
|
|
439
|
+
/** The number of header rows: 1 when Table renders a header, else 0. */
|
|
440
|
+
readonly headerRowCount: number;
|
|
441
|
+
/** The scroll container around the `<table>`. Its reference is stable. */
|
|
442
|
+
readonly viewport: React.RefObject<HTMLDivElement | null>;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Immutable facts about one body row that Table passes to its transforms.
|
|
447
|
+
* Read its values during the transform, and copy what a returned callback
|
|
448
|
+
* needs: a row that does not re-render keeps its old context.
|
|
449
|
+
*/
|
|
450
|
+
export interface TableRowContext {
|
|
451
|
+
/** The row's key: its `idKey` value, or its index when there is no `idKey`. */
|
|
452
|
+
readonly key: string | number | undefined;
|
|
453
|
+
/** Whether the key is a usable identity. */
|
|
454
|
+
readonly identityStatus: 'valid' | 'missing' | 'invalid' | 'duplicate';
|
|
455
|
+
/** `product` for a row of a flat dataset; `unknown` for another row model. */
|
|
456
|
+
readonly kind: 'product' | 'synthetic' | 'unknown';
|
|
457
|
+
/**
|
|
458
|
+
* The zero-based position of the row in the complete `data` input. A row
|
|
459
|
+
* keeps this index when only some rows are mounted.
|
|
460
|
+
*/
|
|
461
|
+
readonly logicalIndex: number;
|
|
462
|
+
/** The number of product rows in the complete `data` input. */
|
|
463
|
+
readonly logicalRowCount: number;
|
|
464
|
+
/** The number of header rows: 1 when Table renders a header, else 0. */
|
|
465
|
+
readonly headerRowCount: number;
|
|
466
|
+
/** The table's render context. */
|
|
467
|
+
readonly render: TableRenderContext;
|
|
468
|
+
}
|
|
469
|
+
|
|
425
470
|
/**
|
|
426
471
|
* Table plugin — transforms render props at each structural level.
|
|
427
472
|
* Plugins compose by sequential application (first plugin's output feeds next).
|
|
@@ -449,6 +494,12 @@ export type TableContextActions =
|
|
|
449
494
|
export interface TablePlugin<
|
|
450
495
|
T extends Record<string, unknown> = Record<string, unknown>,
|
|
451
496
|
> {
|
|
497
|
+
/**
|
|
498
|
+
* The row model this plugin's body transforms keep. Declare `'flat'` when
|
|
499
|
+
* they keep one product row per data item. A body transform without a
|
|
500
|
+
* declaration makes the table's row model `custom`.
|
|
501
|
+
*/
|
|
502
|
+
readonly rowModel?: TableRenderContext['rowModel'];
|
|
452
503
|
/**
|
|
453
504
|
* Transform the column definitions before rendering.
|
|
454
505
|
* Runs before any element-level transforms. Use to filter, reorder,
|
|
@@ -471,14 +522,19 @@ export interface TablePlugin<
|
|
|
471
522
|
columnIndex: number,
|
|
472
523
|
columns: ReadonlyArray<TableColumn<T>>,
|
|
473
524
|
) => HeaderCellRenderProps;
|
|
474
|
-
/**
|
|
525
|
+
/**
|
|
526
|
+
* Transform each body `<tr>` props. Read `context` values during the
|
|
527
|
+
* transform, not later in a callback it returns.
|
|
528
|
+
*/
|
|
475
529
|
transformBodyRow?: (
|
|
476
530
|
props: BodyRowRenderProps,
|
|
477
531
|
item: T,
|
|
478
532
|
index: number,
|
|
533
|
+
context?: TableRowContext,
|
|
479
534
|
) => BodyRowRenderProps;
|
|
480
535
|
/**
|
|
481
|
-
* Transform each body `<td>` props.
|
|
536
|
+
* Transform each body `<td>` props. Read `context` values during the
|
|
537
|
+
* transform, not later in a callback it returns.
|
|
482
538
|
*
|
|
483
539
|
* `columnIndex` and the full `columns` list are provided for plugins that
|
|
484
540
|
* need to reason about column position (e.g. cumulative sticky offsets).
|
|
@@ -489,6 +545,7 @@ export interface TablePlugin<
|
|
|
489
545
|
item: T,
|
|
490
546
|
columnIndex: number,
|
|
491
547
|
columns: ReadonlyArray<TableColumn<T>>,
|
|
548
|
+
context?: TableRowContext,
|
|
492
549
|
) => BodyCellRenderProps;
|
|
493
550
|
/**
|
|
494
551
|
* Transform the scroll-wrapper region — the `<div>` wrapping the `<table>`
|
|
@@ -498,6 +555,7 @@ export interface TablePlugin<
|
|
|
498
555
|
*/
|
|
499
556
|
transformScrollWrapper?: (
|
|
500
557
|
props: ScrollWrapperRenderProps,
|
|
558
|
+
context?: TableRenderContext,
|
|
501
559
|
) => ScrollWrapperRenderProps;
|
|
502
560
|
/** Wrap the table output in context providers */
|
|
503
561
|
transformTableContext?: (children: ReactNode) => ReactNode;
|
|
@@ -89,6 +89,9 @@ function sortPluginEntries<T extends Record<string, unknown>>(
|
|
|
89
89
|
// ======================================================================
|
|
90
90
|
// Plugin Validation (dev mode only)
|
|
91
91
|
// ======================================================================
|
|
92
|
+
/** Known declaration fields on the TablePlugin interface. */
|
|
93
|
+
const VALID_DECLARATION_KEYS = new Set(['rowModel']);
|
|
94
|
+
|
|
92
95
|
/** Known transform method names on the TablePlugin interface. */
|
|
93
96
|
const VALID_TRANSFORM_KEYS = new Set([
|
|
94
97
|
'transformColumns',
|
|
@@ -117,11 +120,11 @@ function validatePlugin<T extends Record<string, unknown>>(
|
|
|
117
120
|
|
|
118
121
|
// Warn about unknown keys (likely misspelled transform names)
|
|
119
122
|
for (const key of keys) {
|
|
120
|
-
if (!VALID_TRANSFORM_KEYS.has(key)) {
|
|
123
|
+
if (!VALID_TRANSFORM_KEYS.has(key) && !VALID_DECLARATION_KEYS.has(key)) {
|
|
121
124
|
devWarn(
|
|
122
125
|
'Table',
|
|
123
126
|
`Plugin "${name}" has unknown key "${key}". ` +
|
|
124
|
-
`Valid keys: ${[...VALID_TRANSFORM_KEYS].join(', ')}. ` +
|
|
127
|
+
`Valid keys: ${[...VALID_DECLARATION_KEYS, ...VALID_TRANSFORM_KEYS].join(', ')}. ` +
|
|
125
128
|
`This key will be ignored.`,
|
|
126
129
|
);
|
|
127
130
|
}
|
|
@@ -7,20 +7,19 @@ export const docs = {
|
|
|
7
7
|
subComponentOf: 'Table',
|
|
8
8
|
displayName: 'useTableRowIndex',
|
|
9
9
|
description:
|
|
10
|
-
'Hook that returns a TablePlugin which prepends a right-aligned, monospaced row-number column. Numbering follows the
|
|
10
|
+
'Hook that returns a TablePlugin which prepends a right-aligned, monospaced row-number column. Numbering follows the rows the table renders (reflecting the current sort / filter / pagination view) and starts at 1 by default. Without data, Table gives each row its position; with data, numbers follow that array.',
|
|
11
11
|
props: [
|
|
12
12
|
{
|
|
13
13
|
name: 'data',
|
|
14
14
|
type: 'T[]',
|
|
15
15
|
description:
|
|
16
|
-
'
|
|
17
|
-
required: true,
|
|
16
|
+
'Optional: the array whose order the numbers follow. Omit it to number rows from the positions Table gives them.',
|
|
18
17
|
},
|
|
19
18
|
{
|
|
20
19
|
name: 'getRowKey',
|
|
21
20
|
type: '(item: T) => string',
|
|
22
21
|
description:
|
|
23
|
-
'Optional key extractor returning a unique string per row. When provided,
|
|
22
|
+
'Optional key extractor used with data, returning a unique string per row. When provided, rows match data by the returned string; otherwise by reference identity. Memoize with useCallback for a stable plugin identity.',
|
|
24
23
|
},
|
|
25
24
|
{
|
|
26
25
|
name: 'label',
|
|
@@ -40,10 +39,10 @@ export const docs = {
|
|
|
40
39
|
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
|
|
41
40
|
export const docsDense = {
|
|
42
41
|
description:
|
|
43
|
-
'Returns a TablePlugin that prepends a right-aligned monospaced row-number column. Numbering follows the rendered
|
|
42
|
+
'Returns a TablePlugin that prepends a right-aligned monospaced row-number column. Numbering follows the rendered rows (current sort/filter/page view), 1-based by default. Without data, Table supplies each row position; with data, numbers follow it.',
|
|
44
43
|
propDescriptions: {
|
|
45
|
-
data: '
|
|
46
|
-
getRowKey: 'Optional key extractor
|
|
44
|
+
data: 'Optional array whose order the numbers follow; omit to use Table row positions.',
|
|
45
|
+
getRowKey: 'Optional key extractor used with data; otherwise items match by reference.',
|
|
47
46
|
label: "Header label for the index column. Default '#'.",
|
|
48
47
|
startFrom: 'First index value. Default 1.',
|
|
49
48
|
},
|
package/src/Text/Text.tsx
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - /packages/cli/assets/templates/blocks/components/Text/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {use, useRef, type ReactNode} from 'react';
|
|
20
20
|
import * as stylex from '@stylexjs/stylex';
|
|
21
21
|
import type {
|
|
22
22
|
TextType,
|
|
@@ -47,6 +47,11 @@ import {
|
|
|
47
47
|
truncationTooltipStyles,
|
|
48
48
|
} from './text.stylex';
|
|
49
49
|
import {useTruncation} from './useTruncation';
|
|
50
|
+
import {
|
|
51
|
+
TruncationTooltip,
|
|
52
|
+
useTruncationTooltipInterest,
|
|
53
|
+
} from './TruncationTooltip';
|
|
54
|
+
import {composeEventHandlers} from '../utils/composeEventHandlers';
|
|
50
55
|
import type {LayerPlacement} from '../Layer';
|
|
51
56
|
import {mergeProps} from '../utils/mergeProps';
|
|
52
57
|
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
@@ -54,10 +59,6 @@ import type {BaseProps} from '../BaseProps';
|
|
|
54
59
|
import {themeProps} from '../utils/themeProps';
|
|
55
60
|
import {TextClampContext} from './textClampContext';
|
|
56
61
|
|
|
57
|
-
const LazyXDSTooltip = lazy(async () =>
|
|
58
|
-
import('../Tooltip/Tooltip').then(mod => ({default: mod.Tooltip})),
|
|
59
|
-
);
|
|
60
|
-
|
|
61
62
|
export type {TextType, TextSize};
|
|
62
63
|
|
|
63
64
|
export interface TextProps extends Omit<BaseProps, 'children'> {
|
|
@@ -273,6 +274,8 @@ export function Text({
|
|
|
273
274
|
typeof hasTruncateTooltip === 'string' ? hasTruncateTooltip : 'above';
|
|
274
275
|
const tooltipEnabled =
|
|
275
276
|
maxLines > 0 && hasTruncateTooltip !== false && truncation.isTruncated;
|
|
277
|
+
// The tooltip mounts on the first hover, tap or focus, not with the text.
|
|
278
|
+
const tooltipInterest = useTruncationTooltipInterest(tooltipEnabled);
|
|
276
279
|
|
|
277
280
|
// Ref for the text element (used as tooltip anchor)
|
|
278
281
|
const textRef = useRef<HTMLElement>(null);
|
|
@@ -321,24 +324,37 @@ export function Text({
|
|
|
321
324
|
className,
|
|
322
325
|
{...style, ...inlineStyle},
|
|
323
326
|
)}
|
|
324
|
-
{...props}
|
|
327
|
+
{...props}
|
|
328
|
+
onPointerEnter={composeEventHandlers(
|
|
329
|
+
tooltipInterest.onPointerEnter,
|
|
330
|
+
props.onPointerEnter,
|
|
331
|
+
)}
|
|
332
|
+
onPointerLeave={composeEventHandlers(
|
|
333
|
+
tooltipInterest.onPointerLeave,
|
|
334
|
+
props.onPointerLeave,
|
|
335
|
+
)}
|
|
336
|
+
onPointerDown={composeEventHandlers(
|
|
337
|
+
tooltipInterest.onPointerDown,
|
|
338
|
+
props.onPointerDown,
|
|
339
|
+
)}
|
|
340
|
+
onFocus={composeEventHandlers(tooltipInterest.onFocus, props.onFocus)}
|
|
341
|
+
onBlur={composeEventHandlers(tooltipInterest.onBlur, props.onBlur)}>
|
|
325
342
|
{/* Always mounted, so a change of maxLines keeps every child mounted. */}
|
|
326
343
|
<TextClampContext value={isClamped || isInClampedText}>
|
|
327
344
|
{children}
|
|
328
345
|
</TextClampContext>
|
|
329
346
|
</Component>
|
|
330
|
-
{tooltipEnabled && (
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
content
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
</Suspense>
|
|
347
|
+
{tooltipEnabled && tooltipInterest.isWanted && (
|
|
348
|
+
<TruncationTooltip
|
|
349
|
+
anchorRef={textRef}
|
|
350
|
+
content={
|
|
351
|
+
<span {...stylex.props(truncationTooltipStyles.content)}>
|
|
352
|
+
{truncation.fullText}
|
|
353
|
+
</span>
|
|
354
|
+
}
|
|
355
|
+
placement={tooltipPlacement}
|
|
356
|
+
interest={tooltipInterest}
|
|
357
|
+
/>
|
|
342
358
|
)}
|
|
343
359
|
</>
|
|
344
360
|
);
|