@astryxdesign/core 0.7.17-canary.gffd1fc0 → 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +334 -0
- package/README.md +26 -9
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +6 -8
- package/dist/AppShell/AppShell.d.ts +7 -3
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +74 -36
- package/dist/AppShell/unreadWidthPoint.d.ts +29 -0
- package/dist/AppShell/unreadWidthPoint.d.ts.map +1 -0
- package/dist/AppShell/unreadWidthPoint.js +134 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -1
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +2 -2
- package/dist/Banner/Banner.d.ts +6 -4
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -29
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +3 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +11 -7
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +57 -2
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts +5 -0
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +6 -14
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +12 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +45 -7
- package/dist/Calendar/Calendar.js +8 -2
- package/dist/Calendar/styles.d.ts +10 -6
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +7 -3
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +23 -4
- package/dist/Chat/ChatComposer.d.ts +1 -1
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -4
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +8 -4
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +7 -0
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -9
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -0
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +1 -0
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +8 -0
- package/dist/Chat/pastedTextLabel.d.ts +4 -0
- package/dist/Chat/pastedTextLabel.d.ts.map +1 -0
- package/dist/Chat/pastedTextLabel.js +21 -0
- package/dist/Chat/useChatPasteAsToken.d.ts.map +1 -1
- package/dist/Chat/useChatPasteAsToken.js +8 -8
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +3 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +69 -18
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +8 -1
- package/dist/Code/Code.d.ts.map +1 -1
- package/dist/Code/Code.js +5 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +39 -12
- package/dist/CodeBlock/highlightRanges.d.ts.map +1 -1
- package/dist/CodeBlock/highlightRanges.js +6 -5
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -0
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +1 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +32 -5
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +1 -0
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +3 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +8 -8
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +5 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +7 -0
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +2 -1
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +2 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +104 -18
- package/dist/Dialog/DialogContext.d.ts +5 -4
- package/dist/Dialog/DialogContext.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +38 -12
- package/dist/Drawer/DrawerHeader.d.ts.map +1 -1
- package/dist/Drawer/DrawerHeader.js +23 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +23 -17
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -3
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +19 -2
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +6 -3
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +31 -7
- package/dist/DropdownMenu/menuRowCorners.stylex.d.ts +24 -0
- package/dist/DropdownMenu/menuRowCorners.stylex.d.ts.map +1 -0
- package/dist/DropdownMenu/menuRowCorners.stylex.js +29 -0
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +2 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +2 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -0
- package/dist/Field/inputDisabledFocus.d.ts.map +1 -1
- package/dist/Field/inputDisabledFocus.js +5 -0
- package/dist/Field/inputStyles.stylex.d.ts +31 -4
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +30 -5
- package/dist/Grid/Grid.d.ts +2 -1
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +5 -2
- package/dist/Heading/Heading.d.ts +1 -1
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +15 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +32 -2
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +12 -6
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -1
- package/dist/Indicator/RadioIndicator.js +18 -4
- package/dist/Indicator/indicatorRegistry.d.ts +3 -26
- package/dist/Indicator/indicatorRegistry.d.ts.map +1 -1
- package/dist/Indicator/indicatorRegistry.js +2 -11
- package/dist/Indicator/themeIndicators.d.ts +15 -0
- package/dist/Indicator/themeIndicators.d.ts.map +1 -0
- package/dist/Indicator/themeIndicators.js +21 -0
- package/dist/Indicator/types.d.ts +14 -0
- package/dist/Indicator/types.d.ts.map +1 -1
- package/dist/Indicator/useThemeIndicator.d.ts +3 -0
- package/dist/Indicator/useThemeIndicator.d.ts.map +1 -0
- package/dist/Indicator/useThemeIndicator.js +19 -0
- package/dist/Item/Item.d.ts +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +30 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +9 -2
- package/dist/Layer/layerExitCopy.d.ts.map +1 -1
- package/dist/Layer/layerExitCopy.js +1 -1
- package/dist/Layer/layerSlideRules.d.ts +23 -15
- package/dist/Layer/layerSlideRules.d.ts.map +1 -1
- package/dist/Layer/layerSlideRules.js +54 -54
- package/dist/Layer/useLayer.d.ts +41 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +199 -126
- package/dist/Layer/useLayerKeyboardClearance.d.ts +5 -5
- package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
- package/dist/Layer/useLayerKeyboardClearance.js +5 -5
- package/dist/Layout/LayoutContainerContext.d.ts +4 -0
- package/dist/Layout/LayoutContainerContext.d.ts.map +1 -0
- package/dist/Layout/LayoutContainerContext.js +20 -0
- package/dist/Layout/LayoutContainerScope.d.ts +15 -0
- package/dist/Layout/LayoutContainerScope.d.ts.map +1 -0
- package/dist/Layout/LayoutContainerScope.js +23 -0
- package/dist/Layout/LayoutContent.d.ts +2 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +7 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutFooter.js +5 -1
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.js +5 -1
- package/dist/Layout/containerCorners.stylex.d.ts +15 -7
- package/dist/Layout/containerCorners.stylex.d.ts.map +1 -1
- package/dist/Layout/containerCorners.stylex.js +16 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +324 -6
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +14 -6
- package/dist/List/ListContext.d.ts +38 -1
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +50 -2
- package/dist/List/ListItem.js +2 -2
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +85 -96
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.js +12 -5
- package/dist/Markdown/plugins/protocol.js +3 -3
- package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListItem.js +11 -3
- package/dist/MobileNav/MobileNav.d.ts +1 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +6 -3
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +33 -9
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +5 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -0
- package/dist/NavMenu/NavMenuContext.d.ts +7 -0
- package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
- package/dist/NavMenu/NavMenuContext.js +9 -0
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +8 -2
- package/dist/Outline/Outline.d.ts +7 -3
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +11 -3
- package/dist/Outline/useScrollSpy.d.ts +1 -1
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +6 -2
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +51 -25
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +33 -13
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +5 -1
- package/dist/Popover/popoverAnchor.d.ts +11 -0
- package/dist/Popover/popoverAnchor.d.ts.map +1 -0
- package/dist/Popover/popoverAnchor.js +33 -0
- package/dist/Popover/usePopover.d.ts +20 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +110 -10
- package/dist/PowerSearch/PowerSearch.d.ts +1 -0
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +46 -9
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +7 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -0
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +2 -4
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +6 -13
- package/dist/ProgressBar/ProgressBar.d.ts +5 -4
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +26 -26
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +51 -0
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +1 -1
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +1 -1
- package/dist/Resizable/resizableModel.d.ts +45 -3
- package/dist/Resizable/resizableModel.d.ts.map +1 -1
- package/dist/Resizable/resizableModel.js +91 -3
- package/dist/Resizable/resizeGesture.d.ts +3 -0
- package/dist/Resizable/resizeGesture.d.ts.map +1 -1
- package/dist/Resizable/resizeGesture.js +6 -0
- package/dist/Resizable/useResizable.d.ts +1 -33
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +8 -72
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +1 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +27 -5
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +70 -8
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +34 -14
- package/dist/Selector/hooks.d.ts +5 -0
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +72 -16
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +9 -3
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +18 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +47 -33
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +21 -12
- package/dist/Swipe/useSwipeAction.js +3 -3
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +64 -46
- package/dist/Switch/useSwitchTouch.d.ts +22 -1
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +54 -3
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +3 -3
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +37 -18
- package/dist/Table/Table.d.ts +4 -3
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +32 -14
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +6 -0
- package/dist/Table/TableHeaderCell.d.ts +1 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +42 -9
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +9 -1
- package/dist/Table/TableRowPlacementContext.d.ts +18 -0
- package/dist/Table/TableRowPlacementContext.d.ts.map +1 -0
- package/dist/Table/TableRowPlacementContext.js +41 -0
- package/dist/Table/TableSelectionToolbar.d.ts.map +1 -1
- package/dist/Table/TableSelectionToolbar.js +7 -0
- package/dist/Table/columnUtils.d.ts +5 -0
- package/dist/Table/columnUtils.d.ts.map +1 -1
- package/dist/Table/columnUtils.js +9 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +2 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +8 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +10 -6
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +5 -1
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +76 -15
- package/dist/Table/table.stylex.d.ts +31 -5
- package/dist/Table/table.stylex.d.ts.map +1 -1
- package/dist/Table/table.stylex.js +33 -5
- package/dist/Table/types.d.ts +3 -1
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.d.ts +35 -1
- package/dist/Text/TruncationTooltip.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.js +115 -0
- package/dist/Text/text.stylex.d.ts +2 -2
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +23 -4
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +15 -1
- package/dist/TextInput/TextInput.d.ts +9 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +19 -18
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +13 -4
- package/dist/Timer/Timer.d.ts.map +1 -1
- package/dist/Timer/Timer.js +10 -7
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +55 -4
- package/dist/Toast/Toast.d.ts +1 -6
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +77 -44
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +48 -21
- package/dist/Toast/types.d.ts +8 -0
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +14 -7
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +14 -9
- package/dist/Token/Token.d.ts +1 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +6 -2
- package/dist/Tokenizer/Tokenizer.d.ts +2 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +102 -62
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +33 -5
- package/dist/Tooltip/Tooltip.d.ts +12 -1
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +31 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +20 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +24 -8
- package/dist/TopNav/TopNavContext.d.ts +13 -0
- package/dist/TopNav/TopNavContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavContext.js +27 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +21 -9
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +25 -17
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +13 -2
- package/dist/TopNav/TopNavMegaMenuItem.d.ts +9 -1
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +14 -2
- package/dist/TopNav/TopNavMenu.d.ts +8 -0
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +20 -5
- package/dist/TopNav/TopNavRenderContext.d.ts +13 -0
- package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavRenderContext.js +24 -9
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +7 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +20 -2
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +24 -9
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/Typeahead/TypeaheadItem.js +7 -0
- package/dist/astryx.css +215 -56
- package/dist/gestures/GestureHost.d.ts +7 -0
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +37 -0
- package/dist/hooks/anchoredHint.d.ts.map +1 -1
- package/dist/hooks/anchoredHint.js +0 -1
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +7 -0
- package/dist/hooks/focusableSelector.d.ts +16 -9
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +53 -2
- package/dist/hooks/scrollEdgeFade.d.ts +34 -0
- package/dist/hooks/scrollEdgeFade.d.ts.map +1 -0
- package/dist/hooks/scrollEdgeFade.js +173 -0
- package/dist/hooks/statusButtonPress.d.ts +15 -0
- package/dist/hooks/statusButtonPress.d.ts.map +1 -0
- package/dist/hooks/statusButtonPress.js +19 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +2 -1
- package/dist/hooks/useFocusTrap.d.ts +26 -16
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +75 -112
- package/dist/hooks/useGroupPressTracking.d.ts +1 -1
- package/dist/hooks/useGroupPressTracking.js +1 -1
- package/dist/hooks/useOverflow.d.ts +25 -2
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +137 -8
- package/dist/hooks/useResolvedRequired.d.ts +27 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -1
- package/dist/hooks/useResolvedRequired.js +30 -1
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +4 -2
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +8 -8
- package/dist/i18n/InternationalizationContext.d.ts +13 -6
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +11 -6
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +7 -0
- package/dist/i18n/defaultTranslator.d.ts +17 -0
- package/dist/i18n/defaultTranslator.d.ts.map +1 -0
- package/dist/i18n/defaultTranslator.js +18 -0
- package/dist/i18n/firstStrongDirection.d.ts +3 -2
- package/dist/i18n/firstStrongDirection.d.ts.map +1 -1
- package/dist/i18n/firstStrongDirection.js +50 -12
- package/dist/i18n/generated-english/Chat/ChatPastedTextToken.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Chat/ChatPastedTextToken.generated.js +1 -2
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.js +12 -0
- package/dist/i18n/generated-english/Chat/useTriggerMenu.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Chat/useTriggerMenu.generated.js +1 -0
- package/dist/i18n/generated-english/CodeBlock/CodeBlock.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/CodeBlock/CodeBlock.generated.js +2 -1
- package/dist/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.js +2 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.js +1 -0
- package/dist/i18n/generated-english/Slider/Slider.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Slider/Slider.generated.js +2 -1
- package/dist/i18n/generated-english/TextArea/TextArea.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/TextArea/TextArea.generated.js +1 -0
- package/dist/i18n/generated-english/TextInput/TextInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/TextInput/TextInput.generated.js +1 -0
- package/dist/i18n/generated-english/Timestamp/Timestamp.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Timestamp/Timestamp.generated.js +2 -1
- package/dist/i18n/generated-english/Tokenizer/Tokenizer.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Tokenizer/Tokenizer.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +9 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +9 -0
- package/dist/i18n/publicContext.d.ts.map +1 -1
- package/dist/i18n/publicContext.js +4 -2
- package/dist/i18n/translatingContext.d.ts +2 -0
- package/dist/i18n/translatingContext.d.ts.map +1 -0
- package/dist/i18n/translatingContext.js +25 -0
- package/dist/i18n/useComponentTranslator.d.ts.map +1 -1
- package/dist/i18n/useComponentTranslator.js +3 -2
- package/dist/i18n/useListFormatter.d.ts.map +1 -1
- package/dist/i18n/useListFormatter.js +3 -2
- package/dist/i18n/useTranslator.d.ts.map +1 -1
- package/dist/i18n/useTranslator.js +3 -2
- package/dist/internal/touch.d.ts +2 -0
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +5 -1
- package/dist/keyboard/keyboardHeight.d.ts +34 -3
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -1
- package/dist/keyboard/keyboardHeight.js +101 -24
- package/dist/keyboard/keyboardTarget.d.ts +19 -16
- package/dist/keyboard/keyboardTarget.d.ts.map +1 -1
- package/dist/keyboard/keyboardTarget.js +529 -72
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -1
- package/dist/keyboard/useMobileKeyboard.js +1 -8
- package/dist/palette/color.d.ts +23 -0
- package/dist/palette/color.d.ts.map +1 -0
- package/dist/palette/color.js +126 -0
- package/dist/palette/generator.d.ts +69 -0
- package/dist/palette/generator.d.ts.map +1 -0
- package/dist/palette/generator.js +778 -0
- package/dist/palette/index.d.ts +12 -0
- package/dist/palette/index.d.ts.map +1 -0
- package/dist/palette/index.js +13 -0
- package/dist/palette/mapping.d.ts +319 -0
- package/dist/palette/mapping.d.ts.map +1 -0
- package/dist/palette/mapping.js +1312 -0
- package/dist/palette/themePalette.d.ts +20 -0
- package/dist/palette/themePalette.d.ts.map +1 -0
- package/dist/palette/themePalette.js +145 -0
- package/dist/palette/types.d.ts +178 -0
- package/dist/palette/types.d.ts.map +1 -0
- package/dist/palette/types.js +1 -0
- package/dist/privateAttributes/mediaDarkPage.d.ts +5 -0
- package/dist/privateAttributes/mediaDarkPage.d.ts.map +1 -0
- package/dist/privateAttributes/mediaDarkPage.js +27 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +2 -1
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/pressGroupItem.stylex.js +2 -1
- package/dist/privateAttributes/scheme.d.ts +10 -0
- package/dist/privateAttributes/scheme.d.ts.map +1 -0
- package/dist/privateAttributes/scheme.js +34 -0
- package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/travelling.stylex.js +2 -2
- package/dist/theme/MediaDarkPage.d.ts +18 -0
- package/dist/theme/MediaDarkPage.d.ts.map +1 -0
- package/dist/theme/MediaDarkPage.js +35 -0
- package/dist/theme/MediaTheme.d.ts.map +1 -1
- package/dist/theme/MediaTheme.js +9 -1
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +99 -31
- package/dist/theme/defineTheme.d.ts +31 -6
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +65 -29
- package/dist/theme/derivedVarRegistry.d.ts +19 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +49 -4
- package/dist/theme/expandRadiusScale.d.ts +1 -2
- package/dist/theme/expandRadiusScale.d.ts.map +1 -1
- package/dist/theme/expandRadiusScale.js +1 -5
- package/dist/theme/generateThemeRules.d.ts +10 -3
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +310 -207
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/invertedSurfaceSide.d.ts +17 -0
- package/dist/theme/invertedSurfaceSide.d.ts.map +1 -0
- package/dist/theme/invertedSurfaceSide.js +47 -0
- package/dist/theme/resolveThemeValues.d.ts +5 -2
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +7 -1
- package/dist/theme/statusRoleDefaults.d.ts +43 -0
- package/dist/theme/statusRoleDefaults.d.ts.map +1 -0
- package/dist/theme/statusRoleDefaults.js +196 -0
- package/dist/theme/statusRoleDerivation.d.ts +4 -0
- package/dist/theme/statusRoleDerivation.d.ts.map +1 -1
- package/dist/theme/statusRoleDerivation.js +3 -1
- package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
- package/dist/theme/syntax/SyntaxTheme.js +7 -0
- package/dist/theme/themeAdaptations.d.ts +24 -1
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +48 -5
- package/dist/theme/tokenDefaults.d.ts +3 -0
- package/dist/theme/tokenDefaults.d.ts.map +1 -0
- package/dist/theme/tokenDefaults.js +30 -0
- package/dist/theme/tokenValues.d.ts +26 -0
- package/dist/theme/tokenValues.d.ts.map +1 -0
- package/dist/theme/tokenValues.js +180 -0
- package/dist/theme/tokens.d.ts +3 -2
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +7 -161
- package/dist/theme/tokens.stylex.d.ts +4 -4
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +7 -5
- package/dist/theme/useTheme.d.ts +40 -3
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +137 -32
- package/dist/utils/devWarning.d.ts +17 -0
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +20 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +7 -4
- package/dist/utils/focusReturn.d.ts +110 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +418 -12
- package/dist/utils/hitArea.d.ts +28 -0
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +52 -18
- package/dist/utils/inputStream.d.ts +27 -0
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +72 -5
- package/dist/utils/nodeType.d.ts +2 -0
- package/dist/utils/nodeType.d.ts.map +1 -1
- package/dist/utils/nodeType.js +10 -0
- package/dist/utils/timeFormat.d.ts +14 -4
- package/dist/utils/timeFormat.d.ts.map +1 -1
- package/dist/utils/timeFormat.js +42 -4
- package/dist/utils/touchPresentation.d.ts +2 -2
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +10 -7
- package/dist/utils/touchPresentation.stylex.d.ts +4 -3
- package/dist/utils/touchPresentation.stylex.d.ts.map +1 -1
- package/dist/utils/touchPresentation.stylex.js +3 -3
- package/dist/utils/touchQueries.d.ts +3 -2
- package/dist/utils/touchQueries.d.ts.map +1 -1
- package/dist/utils/touchQueries.js +3 -2
- package/dist/utils/typeaheadMatch.d.ts +13 -0
- package/dist/utils/typeaheadMatch.d.ts.map +1 -1
- package/dist/utils/typeaheadMatch.js +15 -1
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -1
- package/dist/virtualization/useInlineListWindow.js +38 -22
- package/locales/en.json +36 -0
- package/locales/pseudo.json +27 -0
- package/package.json +10 -5
- package/scripts/agent-doc-state.mjs +71 -4
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -1
- package/src/AlertDialog/AlertDialog.tsx +34 -7
- package/src/AppShell/AppShell.doc.mjs +22 -0
- package/src/AppShell/AppShell.tsx +112 -65
- package/src/AppShell/unreadWidthPoint.ts +162 -0
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +6 -1
- package/src/Badge/Badge.tsx +5 -2
- package/src/Banner/Banner.doc.mjs +15 -0
- package/src/Banner/Banner.tsx +56 -45
- package/src/BottomSheet/BottomSheet.doc.mjs +6 -3
- package/src/BottomSheet/BottomSheet.tsx +3 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +15 -7
- package/src/BottomSheet/BottomSheetSwitcher.tsx +73 -1
- package/src/BottomSheet/BottomSheetSwitcherContext.ts +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +6 -14
- package/src/Breadcrumbs/BreadcrumbItem.tsx +14 -1
- package/src/Button/Button.doc.mjs +9 -3
- package/src/Button/Button.tsx +65 -11
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.tsx +32 -20
- package/src/Calendar/styles.ts +12 -3
- package/src/Card/Card.doc.mjs +2 -2
- package/src/Card/Card.tsx +22 -3
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposer.doc.mjs +3 -3
- package/src/Chat/ChatComposer.tsx +11 -5
- package/src/Chat/ChatComposerDrawer.tsx +11 -7
- package/src/Chat/ChatDictationButton.tsx +12 -0
- package/src/Chat/ChatMessageBubble.tsx +2 -2
- package/src/Chat/ChatPastedTextToken.tsx +3 -9
- package/src/Chat/ChatSendButton.tsx +5 -0
- package/src/Chat/ChatSystemMessage.tsx +1 -0
- package/src/Chat/ChatToolCalls.tsx +16 -0
- package/src/Chat/pastedTextLabel.ts +23 -0
- package/src/Chat/useChatPasteAsToken.ts +9 -8
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +20 -0
- package/src/CheckboxInput/CheckboxInput.tsx +83 -26
- package/src/CheckboxList/CheckboxList.doc.mjs +15 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/Citation/Citation.tsx +16 -1
- package/src/Code/Code.tsx +3 -0
- package/src/CodeBlock/CodeBlock.doc.mjs +7 -0
- package/src/CodeBlock/CodeBlock.tsx +60 -13
- package/src/CodeBlock/highlightRanges.ts +7 -5
- package/src/Collapsible/Collapsible.tsx +2 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -0
- package/src/ComplexSelector/ComplexSelector.doc.mjs +30 -2
- package/src/ComplexSelector/ComplexSelector.tsx +19 -1
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -1
- package/src/ContextMenu/ContextMenu.tsx +44 -5
- package/src/ContextMenu/ContextMenuItem.doc.mjs +55 -5
- package/src/DateInput/MonthScroller.tsx +1 -0
- package/src/DateInput/PickerWheel.tsx +1 -0
- package/src/DateInput/TouchDateField.tsx +2 -0
- package/src/DateInput/Wheel.tsx +1 -0
- package/src/DateInput/usePointerDragScroll.ts +6 -2
- package/src/DateRangeInput/DateRangeInput.tsx +16 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -0
- package/src/Dialog/Dialog.doc.mjs +11 -1
- package/src/Dialog/Dialog.tsx +116 -19
- package/src/Dialog/DialogContext.ts +5 -4
- package/src/Dialog/DialogHeader.tsx +50 -12
- package/src/Drawer/DrawerHeader.tsx +31 -6
- package/src/DropdownMenu/DropdownMenu.doc.mjs +20 -1
- package/src/DropdownMenu/DropdownMenu.tsx +29 -22
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +4 -4
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +3 -2
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +5 -5
- package/src/DropdownMenu/DropdownMenuItem.tsx +3 -1
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +4 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +3 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +23 -1
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +37 -9
- package/src/DropdownMenu/menuRowCorners.stylex.ts +40 -0
- package/src/EmptyState/EmptyState.tsx +2 -0
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/FieldLabel.doc.mjs +3 -3
- package/src/Field/FieldLabel.tsx +9 -2
- package/src/Field/inputDisabledFocus.ts +18 -0
- package/src/Field/inputStyles.stylex.ts +52 -1
- package/src/Grid/Grid.doc.mjs +6 -3
- package/src/Grid/Grid.tsx +5 -2
- package/src/Heading/Heading.tsx +24 -1
- package/src/Icon/Icon.doc.mjs +1 -1
- package/src/Icon/Icon.tsx +40 -2
- package/src/Indicator/CheckboxIndicator.tsx +11 -6
- package/src/Indicator/Indicator.doc.mjs +1 -1
- package/src/Indicator/RadioIndicator.tsx +31 -4
- package/src/Indicator/indicatorRegistry.ts +7 -23
- package/src/Indicator/themeIndicators.ts +29 -0
- package/src/Indicator/types.ts +14 -0
- package/src/Indicator/useThemeIndicator.ts +24 -0
- package/src/Item/Item.doc.mjs +3 -3
- package/src/Item/Item.tsx +48 -7
- package/src/Kbd/Kbd.doc.mjs +6 -2
- package/src/Kbd/Kbd.tsx +16 -1
- package/src/Layer/layerExitCopy.ts +0 -1
- package/src/Layer/layerSlideRules.ts +62 -74
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.tsx +293 -137
- package/src/Layer/useLayerKeyboardClearance.ts +9 -12
- package/src/Layout/Layout.doc.mjs +3 -3
- package/src/Layout/LayoutContainerContext.ts +27 -0
- package/src/Layout/LayoutContainerScope.tsx +32 -0
- package/src/Layout/LayoutContent.tsx +5 -2
- package/src/Layout/LayoutFooter.tsx +3 -1
- package/src/Layout/LayoutHeader.tsx +3 -1
- package/src/Layout/containerCorners.stylex.ts +44 -7
- package/src/Lightbox/Lightbox.tsx +460 -8
- package/src/Link/Link.doc.mjs +18 -0
- package/src/Link/Link.tsx +3 -1
- package/src/List/List.tsx +14 -2
- package/src/List/ListContext.tsx +60 -1
- package/src/List/ListItem.doc.mjs +11 -9
- package/src/List/ListItem.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +1 -1
- package/src/Markdown/Markdown.tsx +189 -190
- package/src/Markdown/plugins/HeadingLinksRenderer.tsx +14 -4
- package/src/Markdown/plugins/protocol.ts +3 -3
- package/src/MetadataList/MetadataListItem.tsx +18 -3
- package/src/MobileNav/MobileNav.doc.mjs +134 -52
- package/src/MobileNav/MobileNav.tsx +13 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.tsx +51 -8
- package/src/NavMenu/NavHeadingMenu.tsx +5 -1
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -0
- package/src/NavMenu/NavMenu.doc.mjs +105 -2
- package/src/NavMenu/NavMenuContext.tsx +13 -0
- package/src/NumberInput/NumberInput.doc.mjs +12 -10
- package/src/NumberInput/NumberInput.tsx +19 -11
- package/src/Outline/Outline.doc.mjs +26 -8
- package/src/Outline/Outline.tsx +35 -5
- package/src/Outline/useScrollSpy.ts +8 -3
- package/src/OverflowList/OverflowList.doc.mjs +15 -0
- package/src/OverflowList/OverflowList.tsx +62 -26
- package/src/Pagination/Pagination.doc.mjs +12 -0
- package/src/Pagination/Pagination.tsx +40 -6
- package/src/Popover/Popover.doc.mjs +10 -0
- package/src/Popover/Popover.tsx +8 -4
- package/src/Popover/popoverAnchor.ts +47 -0
- package/src/Popover/usePopover.doc.mjs +16 -2
- package/src/Popover/usePopover.tsx +152 -16
- package/src/PowerSearch/PowerSearch.doc.mjs +8 -8
- package/src/PowerSearch/PowerSearch.tsx +65 -12
- package/src/PowerSearch/PowerSearchEditPopover.tsx +1 -0
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +12 -0
- package/src/PowerSearch/PowerSearchToken.tsx +12 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +14 -19
- package/src/ProgressBar/ProgressBar.doc.mjs +2 -2
- package/src/ProgressBar/ProgressBar.tsx +44 -30
- package/src/RadioList/RadioList.tsx +63 -0
- package/src/RadioList/RadioListItem.tsx +4 -1
- package/src/Resizable/ResizeHandle.tsx +2 -3
- package/src/Resizable/resizableModel.ts +105 -3
- package/src/Resizable/resizeGesture.ts +14 -0
- package/src/Resizable/useResizable.ts +14 -75
- package/src/SegmentedControl/SegmentedControlItem.tsx +1 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +76 -12
- package/src/Selector/Selector.doc.mjs +34 -7
- package/src/Selector/Selector.tsx +55 -25
- package/src/Selector/SelectorOption.doc.mjs +5 -5
- package/src/Selector/hooks.ts +92 -17
- package/src/Selector/useSelectorPresentation.ts +18 -3
- package/src/SideNav/SideNavHeading.tsx +15 -4
- package/src/SideNav/SideNavItem.doc.mjs +10 -10
- package/src/Slider/Slider.tsx +4 -1
- package/src/Spinner/Spinner.tsx +56 -41
- package/src/Stepper/Step.tsx +18 -3
- package/src/Stepper/Stepper.doc.mjs +14 -2
- package/src/Swipe/useSwipeAction.ts +3 -3
- package/src/Switch/Switch.doc.mjs +61 -5
- package/src/Switch/Switch.tsx +72 -35
- package/src/Switch/useSwitchTouch.ts +68 -3
- package/src/TabList/Tab.tsx +6 -0
- package/src/Table/BaseTable.tsx +73 -35
- package/src/Table/Table.doc.mjs +109 -5
- package/src/Table/Table.tsx +42 -17
- package/src/Table/TableBody.tsx +10 -1
- package/src/Table/TableCell.tsx +6 -0
- package/src/Table/TableHeaderCell.tsx +52 -7
- package/src/Table/TableRow.tsx +8 -1
- package/src/Table/TableRowPlacementContext.ts +58 -0
- package/src/Table/TableSelectionToolbar.tsx +12 -0
- package/src/Table/columnUtils.ts +9 -1
- package/src/Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs +1 -1
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +15 -2
- package/src/Table/plugins/sortable/useTableSortableState.doc.mjs +5 -5
- package/src/Table/plugins/sortable/useTableSortableState.tsx +15 -8
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +8 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +90 -14
- package/src/Table/table.stylex.ts +44 -5
- package/src/Table/types.ts +3 -1
- package/src/Table/useTableColumnResize.doc.mjs +3 -3
- package/src/Table/useTableColumnSettings.doc.mjs +3 -3
- package/src/Table/useTableFilterState.doc.mjs +6 -3
- package/src/Table/useTableFiltering.doc.mjs +71 -4
- package/src/Table/useTableInfiniteScroll.doc.mjs +2 -2
- package/src/Table/useTablePagination.doc.mjs +24 -3
- package/src/Table/useTableSelection.doc.mjs +30 -6
- package/src/Table/useTableSelectionState.doc.mjs +30 -2
- package/src/Table/useTableSortable.doc.mjs +104 -17
- package/src/Table/useTableStickyColumns.doc.mjs +3 -3
- package/src/Table/useTableTreeData.doc.mjs +2 -2
- package/src/Text/Heading.doc.mjs +2 -2
- package/src/Text/Text.doc.mjs +1 -1
- package/src/Text/TruncationTooltip.tsx +168 -1
- package/src/Text/useTruncation.ts +20 -4
- package/src/TextArea/TextArea.doc.mjs +5 -5
- package/src/TextArea/TextArea.tsx +20 -1
- package/src/TextInput/TextInput.doc.mjs +5 -5
- package/src/TextInput/TextInput.tsx +23 -18
- package/src/Thumbnail/Thumbnail.tsx +2 -1
- package/src/Timer/Timer.tsx +21 -6
- package/src/Timestamp/Timestamp.tsx +67 -4
- package/src/Toast/Toast.doc.mjs +15 -5
- package/src/Toast/Toast.tsx +83 -62
- package/src/Toast/ToastViewport.tsx +62 -23
- package/src/Toast/types.ts +8 -0
- package/src/Toast/useToast.doc.mjs +80 -15
- package/src/Toast/useToast.tsx +18 -7
- package/src/ToggleButton/ToggleButton.doc.mjs +1 -1
- package/src/ToggleButton/ToggleButton.tsx +25 -2
- package/src/Token/Token.tsx +5 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +15 -3
- package/src/Tokenizer/Tokenizer.tsx +130 -75
- package/src/Toolbar/Toolbar.tsx +55 -4
- package/src/Tooltip/Tooltip.tsx +34 -0
- package/src/Tooltip/useTooltip.tsx +26 -0
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.tsx +13 -3
- package/src/TopNav/TopNavContext.ts +31 -1
- package/src/TopNav/TopNavHeading.tsx +22 -9
- package/src/TopNav/TopNavMegaMenu.tsx +27 -18
- package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +14 -2
- package/src/TopNav/TopNavMegaMenuItem.doc.mjs +26 -5
- package/src/TopNav/TopNavMegaMenuItem.tsx +26 -2
- package/src/TopNav/TopNavMenu.doc.mjs +19 -8
- package/src/TopNav/TopNavMenu.tsx +34 -2
- package/src/TopNav/TopNavRenderContext.ts +30 -9
- package/src/TreeList/TreeList.tsx +12 -0
- package/src/TreeList/TreeListItem.tsx +26 -5
- package/src/Typeahead/BaseTypeahead.doc.mjs +6 -0
- package/src/Typeahead/BaseTypeahead.tsx +2 -0
- package/src/Typeahead/Typeahead.doc.mjs +15 -2
- package/src/Typeahead/Typeahead.tsx +37 -13
- package/src/Typeahead/TypeaheadItem.tsx +12 -0
- package/src/gestures/GestureHost.ts +34 -0
- package/src/gestures/README.md +9 -6
- package/src/hooks/anchoredHint.tsx +1 -2
- package/src/hooks/computeOverflow.ts +10 -0
- package/src/hooks/focusableSelector.ts +59 -2
- package/src/hooks/scrollEdgeFade.ts +129 -0
- package/src/hooks/statusButtonPress.ts +26 -0
- package/src/hooks/useAnnounce.ts +2 -1
- package/src/hooks/useFocusTrap.ts +110 -141
- package/src/hooks/useGroupPressTracking.ts +1 -1
- package/src/hooks/useOverflow.ts +227 -13
- package/src/hooks/useResolvedRequired.ts +50 -1
- package/src/hooks/useTreeFocus.ts +8 -4
- package/src/hooks/useTypeahead.ts +12 -10
- package/src/i18n/InternationalizationContext.ts +16 -7
- package/src/i18n/InternationalizationProvider.doc.mjs +1 -1
- package/src/i18n/InternationalizationProvider.tsx +12 -0
- package/src/i18n/defaultTranslator.ts +25 -0
- package/src/i18n/firstStrongDirection.ts +54 -13
- package/src/i18n/generated-english/Chat/ChatPastedTextToken.generated.ts +1 -2
- package/src/i18n/generated-english/Chat/pastedTextLabel.generated.ts +13 -0
- package/src/i18n/generated-english/Chat/useTriggerMenu.generated.ts +1 -0
- package/src/i18n/generated-english/CodeBlock/CodeBlock.generated.ts +2 -1
- package/src/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.ts +2 -1
- package/src/i18n/generated-english/MultiSelector/MultiSelector.generated.ts +1 -0
- package/src/i18n/generated-english/Slider/Slider.generated.ts +2 -1
- package/src/i18n/generated-english/TextArea/TextArea.generated.ts +1 -0
- package/src/i18n/generated-english/TextInput/TextInput.generated.ts +1 -0
- package/src/i18n/generated-english/Timestamp/Timestamp.generated.ts +2 -1
- package/src/i18n/generated-english/Tokenizer/Tokenizer.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +11 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +11 -0
- package/src/i18n/publicContext.ts +4 -2
- package/src/i18n/translatingContext.ts +28 -0
- package/src/i18n/useComponentTranslator.ts +3 -2
- package/src/i18n/useListFormatter.ts +3 -2
- package/src/i18n/useTranslator.ts +3 -2
- package/src/internal/touch.ts +7 -0
- package/src/keyboard/README.md +58 -16
- package/src/keyboard/keyboardHeight.ts +138 -26
- package/src/keyboard/keyboardTarget.ts +667 -71
- package/src/keyboard/useMobileKeyboard.ts +1 -7
- package/src/palette/color.ts +205 -0
- package/src/palette/generator.ts +1134 -0
- package/src/palette/index.ts +35 -0
- package/src/palette/mapping.ts +1630 -0
- package/src/palette/themePalette.ts +175 -0
- package/src/palette/types.ts +194 -0
- package/src/privateAttributes/mediaDarkPage.ts +27 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +2 -1
- package/src/privateAttributes/scheme.ts +37 -0
- package/src/privateAttributes/travelling.stylex.ts +6 -4
- package/src/reset.css +1 -1
- package/src/theme/MediaDarkPage.tsx +41 -0
- package/src/theme/MediaTheme.tsx +8 -1
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +140 -35
- package/src/theme/defineTheme.ts +103 -40
- package/src/theme/derivedVarRegistry.ts +61 -4
- package/src/theme/expandRadiusScale.ts +1 -5
- package/src/theme/generateThemeRules.ts +398 -342
- package/src/theme/index.ts +2 -4
- package/src/theme/invertedSurfaceSide.ts +65 -0
- package/src/theme/resolveThemeValues.ts +8 -2
- package/src/theme/statusRoleDefaults.ts +330 -0
- package/src/theme/statusRoleDerivation.ts +2 -1
- package/src/theme/syntax/SyntaxTheme.tsx +12 -0
- package/src/theme/themeAdaptations.ts +53 -5
- package/src/theme/tokenDefaults.ts +44 -0
- package/src/theme/tokenValues.ts +193 -0
- package/src/theme/tokens.stylex.ts +7 -5
- package/src/theme/tokens.ts +14 -176
- package/src/theme/useTheme.ts +164 -35
- package/src/utils/devWarning.ts +24 -0
- package/src/utils/focusOutline.stylex.ts +7 -4
- package/src/utils/focusReturn.ts +578 -16
- package/src/utils/hitArea.ts +70 -33
- package/src/utils/inputStream.ts +81 -5
- package/src/utils/nodeType.ts +10 -0
- package/src/utils/timeFormat.ts +54 -4
- package/src/utils/touchPresentation.stylex.ts +7 -6
- package/src/utils/touchPresentation.ts +10 -7
- package/src/utils/touchQueries.ts +3 -2
- package/src/utils/typeaheadMatch.ts +20 -1
- package/src/virtualization/useInlineListWindow.ts +57 -33
package/src/Toast/Toast.doc.mjs
CHANGED
|
@@ -52,6 +52,13 @@ export const docs = {
|
|
|
52
52
|
'Duration in ms before auto-dismiss. Timed content must satisfy WCAG 2.2.1.',
|
|
53
53
|
default: '5000',
|
|
54
54
|
},
|
|
55
|
+
{
|
|
56
|
+
name: 'isExiting',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
description:
|
|
59
|
+
'Whether the toast is leaving: it plays its exit motion and stops responding to swipes. The toast viewport sets it while a toast leaves; set it only when you render Toast yourself.',
|
|
60
|
+
default: 'false',
|
|
61
|
+
},
|
|
55
62
|
{
|
|
56
63
|
name: 'endContent',
|
|
57
64
|
type: 'ReactNode',
|
|
@@ -93,7 +100,10 @@ export const docs = {
|
|
|
93
100
|
},
|
|
94
101
|
],
|
|
95
102
|
theming: {
|
|
96
|
-
targets: [
|
|
103
|
+
targets: [
|
|
104
|
+
{className: 'astryx-toast', visualProps: ['type']},
|
|
105
|
+
{className: 'astryx-toast-close'},
|
|
106
|
+
],
|
|
97
107
|
vars: [
|
|
98
108
|
{
|
|
99
109
|
name: '--_toast-slide-y',
|
|
@@ -131,7 +141,7 @@ export const docs = {
|
|
|
131
141
|
|
|
132
142
|
usage: {
|
|
133
143
|
description:
|
|
134
|
-
'Toast shows a brief, non-blocking notification to confirm an action or present temporary information. Use it for scenarios where the user needs feedback but not a decision, such as saving, deleting, or changing a status.\n\nFor production use, prefer the `useToast()` hook; it handles positioning, stacking, auto-dismiss, and deduplication via `ToastViewport`. Toasts stay within viewport and safe-area gutters, wrap long message content, and enter, exit, or swipe-dismiss toward their configured top or bottom edge. The vertical swipe uses the same spatial model as placement motion: top Toasts leave upward and bottom Toasts leave downward. Swipe waits for dominant edge-directed intent before cancelling native touch movement and reports the existing manual dismissal reason. Pen is supported as direct-contact input; mouse drag is excluded to avoid conflicting with desktop text selection, where the visible close control remains available. Set `isAutoHide: false` explicitly when an action or message must remain available. The `Toast` component renders the visual toast element inline and is useful for previews, documentation, and static showcases where the viewport lifecycle is not needed. Host `data-*` attributes on `Toast` reach the toast element; its role, live-region attributes, and theme attributes stay component-owned.',
|
|
144
|
+
'Toast shows a brief, non-blocking notification to confirm an action or present temporary information; show one with `const showToast = useToast()`, which needs no provider or mounted ToastViewport: inside LayerProvider (or a ToastViewport) it uses that viewport, and otherwise the first toast mounts a fallback viewport on document.body with a development warning. Use it for scenarios where the user needs feedback but not a decision, such as saving, deleting, or changing a status.\n\nFor production use, prefer the `useToast()` hook; it handles positioning, stacking, auto-dismiss, and deduplication via `ToastViewport`. Only the viewport announces a toast: a `Toast` rendered on its own, as in a preview, is not a live region and announces nothing. Toasts stay within viewport and safe-area gutters, wrap long message content, and enter, exit, or swipe-dismiss toward their configured top or bottom edge. The vertical swipe uses the same spatial model as placement motion: top Toasts leave upward and bottom Toasts leave downward. Swipe waits for dominant edge-directed intent before cancelling native touch movement and reports the existing manual dismissal reason. Pen is supported as direct-contact input; mouse drag is excluded to avoid conflicting with desktop text selection, where the visible close control remains available. Set `isAutoHide: false` explicitly when an action or message must remain available. The `Toast` component renders the visual toast element inline and is useful for previews, documentation, and static showcases where the viewport lifecycle is not needed. Host `data-*` attributes on `Toast` reach the toast element; its role, live-region attributes, and theme attributes stay component-owned.',
|
|
135
145
|
bestPractices: [
|
|
136
146
|
{
|
|
137
147
|
guidance: true,
|
|
@@ -215,7 +225,7 @@ export const docsZh = {
|
|
|
215
225
|
},
|
|
216
226
|
usage: {
|
|
217
227
|
description:
|
|
218
|
-
'Toast
|
|
228
|
+
'Toast 显示简短的非阻塞通知,用于确认操作或呈现临时信息;用 `const showToast = useToast()` 显示,无需 provider 或已挂载的 ToastViewport:在 LayerProvider(或 ToastViewport)内使用该视口,否则第一个 toast 会在 document.body 上挂载后备视口并给出开发警告。适用于用户需要反馈但不需要做决定的场景,如保存、删除或状态变更。\n\n生产环境中推荐使用 `useToast()` hook,它通过 `ToastViewport` 处理定位、堆叠、自动关闭和去重。Toast 会保持在视口和安全区域边距内,较长的消息会换行,并根据配置的顶部或底部边缘进入、退出或滑动关闭。垂直滑动与位置动效使用同一空间模型:顶部 Toast 向上离开,底部 Toast 向下离开。只有在动作明确朝向关闭边缘时才会接管原生触摸移动,滑动关闭继续报告现有的 manual 原因。触控笔属于直接接触输入,因此支持相同手势;鼠标拖动会与桌面文本选择冲突,所以不启用,关闭按钮始终可用。当操作或消息必须持续可用时,请显式设置 `isAutoHide: false`。`Toast` 组件以内联方式渲染 toast 视觉元素,适用于不需要视口生命周期的预览、文档和静态展示。',
|
|
219
229
|
bestPractices: [
|
|
220
230
|
{
|
|
221
231
|
guidance: true,
|
|
@@ -276,10 +286,10 @@ export const docsZh = {
|
|
|
276
286
|
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
|
|
277
287
|
export const docsDense = {
|
|
278
288
|
description:
|
|
279
|
-
'toast notification w/ auto-dismiss, stacking, dedup, smooth animations; MediaTheme inverted surface',
|
|
289
|
+
'toast notification w/ auto-dismiss, stacking, dedup, smooth animations; show via useToast() (no provider needed; fallback viewport auto-mounts); MediaTheme inverted surface',
|
|
280
290
|
usage: {
|
|
281
291
|
description:
|
|
282
|
-
'Brief non-blocking notification for action confirmations and temporary info. Use where user needs feedback not decisions: saves, deletes, status changes. useToast() hook for production (safe-area positioning, responsive message wrapping, stacking, auto-dismiss, dedup via ToastViewport). Enters, exits, or swipe-dismisses toward configured edge; touch is claimed only after dominant edge-directed intent; swipe reports manual. Pen uses the direct-contact gesture; mouse drag stays off to preserve text selection and the close control remains available. Set isAutoHide false explicitly for must-remain actions/messages. Toast renders inline for previews/docs/static showcases. Host data-* attrs on Toast reach the toast element; role, live-region, theme attrs stay owned.',
|
|
292
|
+
'Brief non-blocking notification for action confirmations and temporary info; show w/ `const showToast = useToast()`, no provider/ToastViewport needed (uses LayerProvider/ToastViewport if present, else first toast mounts fallback viewport on document.body, dev warning). Use where user needs feedback not decisions: saves, deletes, status changes. useToast() hook for production (safe-area positioning, responsive message wrapping, stacking, auto-dismiss, dedup via ToastViewport). Enters, exits, or swipe-dismisses toward configured edge; touch is claimed only after dominant edge-directed intent; swipe reports manual. Pen uses the direct-contact gesture; mouse drag stays off to preserve text selection and the close control remains available. Set isAutoHide false explicitly for must-remain actions/messages. Toast renders inline for previews/docs/static showcases. Host data-* attrs on Toast reach the toast element; role, live-region, theme attrs stay owned.',
|
|
283
293
|
bestPractices: [
|
|
284
294
|
{
|
|
285
295
|
guidance: true,
|
package/src/Toast/Toast.tsx
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* - /packages/cli/assets/templates/blocks/components/Toast/ (showcase blocks)
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {useCallback, useEffect, useRef} from 'react';
|
|
20
|
+
import {use, useCallback, useEffect, useMemo, useRef} from 'react';
|
|
21
21
|
import type {FocusEvent, ReactNode, RefObject} from 'react';
|
|
22
22
|
import * as stylex from '@stylexjs/stylex';
|
|
23
23
|
import {Button} from '../Button';
|
|
@@ -37,10 +37,14 @@ import {INTERACTIVE_SELECTORS} from '../hooks/useClickableContainer';
|
|
|
37
37
|
import {useAnnounceRenderedText} from '../hooks/useAnnounceRenderedText';
|
|
38
38
|
import type {AnnounceFn} from '../hooks/useAnnounce';
|
|
39
39
|
import {useTheme} from '../theme';
|
|
40
|
+
import {ThemeContext, useThemeDefinition} from '../theme/useTheme';
|
|
41
|
+
import {useIsHydrating} from '../hooks/useIsHydrating';
|
|
42
|
+
import {resolveThemeTokens} from '../theme/tokens';
|
|
43
|
+
import {invertedSideIn} from '../theme/invertedSurfaceSide';
|
|
44
|
+
import {MediaDarkPage} from '../theme/MediaDarkPage';
|
|
40
45
|
import {MediaTheme} from '../theme/MediaTheme';
|
|
41
46
|
import {useSurfaceMediaMode} from '../hooks/useAutoMediaMode';
|
|
42
47
|
import {pickInvertedSide} from '../hooks/mediaSide';
|
|
43
|
-
import {parseColor} from '../utils/color';
|
|
44
48
|
import type {
|
|
45
49
|
ToastType,
|
|
46
50
|
ToastDismissReason,
|
|
@@ -134,6 +138,11 @@ const styles = stylex.create({
|
|
|
134
138
|
opacity: 0,
|
|
135
139
|
transform: `translateY(var(--_toast-swipe-exit-y, var(--_toast-swipe-y, var(--_toast-slide-y, ${TOAST_EDGE_DRIFT})))) scale(var(--_toast-swipe-scale, 1))`,
|
|
136
140
|
},
|
|
141
|
+
// The close button draws in the card's text color, the color the card's
|
|
142
|
+
// body text inherits.
|
|
143
|
+
close: {
|
|
144
|
+
color: 'inherit',
|
|
145
|
+
},
|
|
137
146
|
endContent: {
|
|
138
147
|
flexShrink: 0,
|
|
139
148
|
display: 'flex',
|
|
@@ -175,11 +184,6 @@ interface ToastSurfaceProps extends ToastProps {
|
|
|
175
184
|
* toast's auto-hide timer starts over.
|
|
176
185
|
*/
|
|
177
186
|
timerKey?: string;
|
|
178
|
-
/**
|
|
179
|
-
* False when the viewport announces the toast: the card then carries no
|
|
180
|
-
* live region of its own, so an update in place is announced once.
|
|
181
|
-
*/
|
|
182
|
-
isLiveRegion?: boolean;
|
|
183
187
|
/**
|
|
184
188
|
* True once the toast's row has started to open. The card then has no
|
|
185
189
|
* starting style, so a move between modal outlets starts no transition.
|
|
@@ -225,7 +229,6 @@ export function ToastSurface({
|
|
|
225
229
|
renderContent,
|
|
226
230
|
gestureDirection,
|
|
227
231
|
timerKey,
|
|
228
|
-
isLiveRegion = true,
|
|
229
232
|
announce,
|
|
230
233
|
isRenderedBodyAnnouncement = false,
|
|
231
234
|
hasEntryStarted = false,
|
|
@@ -404,9 +407,11 @@ export function ToastSurface({
|
|
|
404
407
|
// The viewport announces a plain-text body when it dispatches the toast.
|
|
405
408
|
// This reads a component body or a custom layout after commit. A body is
|
|
406
409
|
// read whole, links included. A custom layout leaves out its controls.
|
|
410
|
+
// Only the viewport passes `announce`. The card never holds a live role, so
|
|
411
|
+
// a Toast rendered on its own announces nothing; its caller owns that.
|
|
407
412
|
useAnnounceRenderedText(
|
|
408
413
|
renderContent != null ? rootRef : bodyRef,
|
|
409
|
-
|
|
414
|
+
announce != null && (renderContent != null || isRenderedBodyAnnouncement),
|
|
410
415
|
timerKey ?? '',
|
|
411
416
|
{
|
|
412
417
|
politeness: isError ? 'assertive' : 'polite',
|
|
@@ -423,31 +428,46 @@ export function ToastSurface({
|
|
|
423
428
|
}, [onDismiss]);
|
|
424
429
|
|
|
425
430
|
// Before the measurement, take the side from the theme's resolved surface by
|
|
426
|
-
// the measurement's rule. If the surface is translucent, or
|
|
427
|
-
//
|
|
431
|
+
// the measurement's rule. If the surface is translucent, or an on-color
|
|
432
|
+
// cannot be read, use the mode.
|
|
428
433
|
const {mode, tokens} = useTheme();
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
434
|
+
const surfaceToken = isError
|
|
435
|
+
? '--color-background-error-inverted'
|
|
436
|
+
: '--color-background-inverted';
|
|
437
|
+
const fromTokens = invertedSideIn(tokens, surfaceToken);
|
|
438
|
+
// A system-mode page's scheme is the reader's, which the server does not
|
|
439
|
+
// know. The card takes its light-page side, and the side it takes on a
|
|
440
|
+
// dark page rides beside it; the theme writes that side's rules for a dark
|
|
441
|
+
// page, so the first paint is right in both.
|
|
442
|
+
const theme = useThemeDefinition();
|
|
443
|
+
// While a system-mode page renders on the server (or hydrates the server's
|
|
444
|
+
// markup), its scheme is the reader's and unknown; later renders know it.
|
|
445
|
+
const isHydrating = useIsHydrating();
|
|
446
|
+
const themeMode = use(ThemeContext)?.mode ?? 'system';
|
|
447
|
+
const isSchemeUnknown = themeMode === 'system' && isHydrating;
|
|
448
|
+
const sides = useMemo(
|
|
449
|
+
() =>
|
|
450
|
+
theme == null
|
|
451
|
+
? null
|
|
452
|
+
: {
|
|
453
|
+
light: invertedSideIn(
|
|
454
|
+
resolveThemeTokens(theme, {mode: 'light'}),
|
|
455
|
+
surfaceToken,
|
|
456
|
+
),
|
|
457
|
+
dark: invertedSideIn(
|
|
458
|
+
resolveThemeTokens(theme, {mode: 'dark'}),
|
|
459
|
+
surfaceToken,
|
|
460
|
+
),
|
|
461
|
+
},
|
|
462
|
+
[theme, surfaceToken],
|
|
435
463
|
);
|
|
436
|
-
const
|
|
437
|
-
surface !== null && surface.a >= 1
|
|
438
|
-
? pickInvertedSide(
|
|
439
|
-
surface,
|
|
440
|
-
null,
|
|
441
|
-
parseColor(tokens['--color-on-dark'] ?? ''),
|
|
442
|
-
parseColor(tokens['--color-on-light'] ?? ''),
|
|
443
|
-
)
|
|
444
|
-
: null;
|
|
464
|
+
const pageSide = isSchemeUnknown ? sides?.light : fromTokens;
|
|
445
465
|
const fallbackMediaMode =
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
466
|
+
pageSide ?? (isError || mode === 'light' ? 'dark' : 'light');
|
|
467
|
+
const darkPageSide =
|
|
468
|
+
isSchemeUnknown && sides?.dark != null && sides.dark !== fallbackMediaMode
|
|
469
|
+
? sides.dark
|
|
470
|
+
: null;
|
|
451
471
|
// Once painted, the card's text takes the side that reads best on it.
|
|
452
472
|
const measuredMediaMode = useSurfaceMediaMode(
|
|
453
473
|
rootRef,
|
|
@@ -459,9 +479,6 @@ export function ToastSurface({
|
|
|
459
479
|
<div
|
|
460
480
|
{...pickDataAttributes(rest)}
|
|
461
481
|
ref={rootRef}
|
|
462
|
-
role={isLiveRegion ? (isError ? 'alert' : 'status') : undefined}
|
|
463
|
-
aria-live={isLiveRegion ? (isError ? 'assertive' : 'polite') : undefined}
|
|
464
|
-
aria-atomic={isLiveRegion ? 'true' : undefined}
|
|
465
482
|
onMouseEnter={pauseForPointer}
|
|
466
483
|
onMouseLeave={resumeForPointer}
|
|
467
484
|
onFocusCapture={pauseForFocus}
|
|
@@ -476,36 +493,40 @@ export function ToastSurface({
|
|
|
476
493
|
isExiting && styles.exiting,
|
|
477
494
|
),
|
|
478
495
|
)}>
|
|
479
|
-
<
|
|
480
|
-
{
|
|
481
|
-
renderContent(
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
<div
|
|
492
|
-
{
|
|
493
|
-
|
|
496
|
+
<MediaDarkPage side={measuredMediaMode == null ? darkPageSide : null}>
|
|
497
|
+
<MediaTheme mode={measuredMediaMode ?? fallbackMediaMode}>
|
|
498
|
+
{renderContent ? (
|
|
499
|
+
renderContent({
|
|
500
|
+
body,
|
|
501
|
+
endContent,
|
|
502
|
+
type,
|
|
503
|
+
isAutoHide,
|
|
504
|
+
autoHideDuration,
|
|
505
|
+
dismiss: handleDismiss,
|
|
506
|
+
})
|
|
507
|
+
) : (
|
|
508
|
+
<div {...stylex.props(styles.inner)}>
|
|
509
|
+
<div ref={bodyRef} {...stylex.props(styles.content)}>
|
|
510
|
+
{body}
|
|
511
|
+
</div>
|
|
494
512
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
513
|
+
<div {...stylex.props(styles.endContent)}>
|
|
514
|
+
{endContent}
|
|
515
|
+
<Button
|
|
516
|
+
variant="ghost"
|
|
517
|
+
size="sm"
|
|
518
|
+
icon={<Icon icon="close" size="sm" color="inherit" />}
|
|
519
|
+
className={themeProps('toast-close').className}
|
|
520
|
+
xstyle={styles.close}
|
|
521
|
+
label={t('@astryx.toast.dismiss')}
|
|
522
|
+
onClick={handleDismiss}
|
|
523
|
+
isIconOnly
|
|
524
|
+
/>
|
|
525
|
+
</div>
|
|
505
526
|
</div>
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
</
|
|
527
|
+
)}
|
|
528
|
+
</MediaTheme>
|
|
529
|
+
</MediaDarkPage>
|
|
509
530
|
</div>
|
|
510
531
|
);
|
|
511
532
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
useMemo,
|
|
26
26
|
useRef,
|
|
27
27
|
useState,
|
|
28
|
+
useSyncExternalStore,
|
|
28
29
|
} from 'react';
|
|
29
30
|
import {useCommittedRefInto} from '../hooks/useCommittedRef';
|
|
30
31
|
import type {ReactNode} from 'react';
|
|
@@ -66,6 +67,8 @@ import {
|
|
|
66
67
|
useComponentTranslator,
|
|
67
68
|
} from '../i18n/useComponentTranslator';
|
|
68
69
|
import english from '../i18n/generated-english/Toast/ToastViewport.generated';
|
|
70
|
+
import {Theme} from '../theme/Theme';
|
|
71
|
+
import type {ThemeSource} from '../theme/useTheme';
|
|
69
72
|
|
|
70
73
|
registerEnglishFallback(english);
|
|
71
74
|
|
|
@@ -265,8 +268,35 @@ interface ToastRowProps {
|
|
|
265
268
|
onExited: (id: string) => void;
|
|
266
269
|
onDismiss: (id: string, reason: ToastDismissReason) => void;
|
|
267
270
|
announce: AnnounceFn;
|
|
268
|
-
|
|
269
|
-
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const noCallerTheme = () => () => {};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Draws a toast shown into the fallback viewport under the caller's current
|
|
277
|
+
* Theme, so the caller's theme CSS reaches it and the page's `<html>` does
|
|
278
|
+
* not.
|
|
279
|
+
*/
|
|
280
|
+
function CallerTheme({
|
|
281
|
+
source,
|
|
282
|
+
children,
|
|
283
|
+
}: {
|
|
284
|
+
source: ThemeSource | undefined;
|
|
285
|
+
children: ReactNode;
|
|
286
|
+
}): ReactNode {
|
|
287
|
+
const caller = useSyncExternalStore(
|
|
288
|
+
source?.subscribe ?? noCallerTheme,
|
|
289
|
+
() => source?.get() ?? null,
|
|
290
|
+
() => source?.get() ?? null,
|
|
291
|
+
);
|
|
292
|
+
if (caller == null) {
|
|
293
|
+
return children;
|
|
294
|
+
}
|
|
295
|
+
return (
|
|
296
|
+
<Theme theme={caller.theme} mode={caller.mode}>
|
|
297
|
+
{children}
|
|
298
|
+
</Theme>
|
|
299
|
+
);
|
|
270
300
|
}
|
|
271
301
|
|
|
272
302
|
/**
|
|
@@ -290,7 +320,6 @@ function ToastRow({
|
|
|
290
320
|
onExited,
|
|
291
321
|
onDismiss,
|
|
292
322
|
announce,
|
|
293
|
-
isLiveRegion,
|
|
294
323
|
}: ToastRowProps) {
|
|
295
324
|
const o = entry.options;
|
|
296
325
|
const type = o.type ?? 'info';
|
|
@@ -360,24 +389,25 @@ function ToastRow({
|
|
|
360
389
|
styles.toastWrapperInner,
|
|
361
390
|
isSettled && !isExiting && styles.toastWrapperInnerSettled,
|
|
362
391
|
)}>
|
|
363
|
-
<
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
392
|
+
<CallerTheme source={entry.callerTheme}>
|
|
393
|
+
<ToastSurface
|
|
394
|
+
type={type}
|
|
395
|
+
body={o.body}
|
|
396
|
+
endContent={o.endContent}
|
|
397
|
+
isAutoHide={isAutoHide}
|
|
398
|
+
autoHideDuration={dur}
|
|
399
|
+
isExiting={isExiting}
|
|
400
|
+
gestureDirection={isReversed ? -1 : 1}
|
|
401
|
+
onDismiss={reason => onDismiss(entry.id, reason)}
|
|
402
|
+
renderContent={o.renderContent}
|
|
403
|
+
timerKey={entry.id}
|
|
404
|
+
announce={announce}
|
|
405
|
+
isRenderedBodyAnnouncement={
|
|
406
|
+
o.renderContent == null && getNodeText(o.body) === ''
|
|
407
|
+
}
|
|
408
|
+
hasEntryStarted={hasEntryStarted}
|
|
409
|
+
/>
|
|
410
|
+
</CallerTheme>
|
|
381
411
|
</div>
|
|
382
412
|
</div>
|
|
383
413
|
);
|
|
@@ -567,7 +597,17 @@ export function ToastViewport({
|
|
|
567
597
|
const keepsRow =
|
|
568
598
|
overwritten != null && !exitingIdsRef.current.has(overwritten.id);
|
|
569
599
|
const placed: ToastEntry = keepsRow
|
|
570
|
-
? {
|
|
600
|
+
? {
|
|
601
|
+
...entry,
|
|
602
|
+
rowKey: overwritten.rowKey ?? overwritten.id,
|
|
603
|
+
// Adding or removing a Theme changes the row's tree, which
|
|
604
|
+
// remounts the card and loses focus. So between a toast with a
|
|
605
|
+
// Theme and one without, the card keeps its first Theme, or none.
|
|
606
|
+
callerTheme:
|
|
607
|
+
entry.callerTheme != null && overwritten.callerTheme != null
|
|
608
|
+
? entry.callerTheme
|
|
609
|
+
: overwritten.callerTheme,
|
|
610
|
+
}
|
|
571
611
|
: entry;
|
|
572
612
|
if (keepsRow) {
|
|
573
613
|
// If the update removes the focused control, the commit hands focus
|
|
@@ -1020,7 +1060,6 @@ export function ToastViewport({
|
|
|
1020
1060
|
onExited={handleExited}
|
|
1021
1061
|
onDismiss={removeToast}
|
|
1022
1062
|
announce={announce}
|
|
1023
|
-
isLiveRegion={false}
|
|
1024
1063
|
/>
|
|
1025
1064
|
))}
|
|
1026
1065
|
</LayerContentBoundary>
|
package/src/Toast/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
import type {ReactNode} from 'react';
|
|
4
|
+
import type {ThemeSource} from '../theme/useTheme';
|
|
4
5
|
|
|
5
6
|
/** Toast status type. Controls color scheme. */
|
|
6
7
|
export type ToastType = 'info' | 'error';
|
|
@@ -106,4 +107,11 @@ export interface ToastEntry {
|
|
|
106
107
|
* toast's, so the card updates in place and focus inside it stays.
|
|
107
108
|
*/
|
|
108
109
|
rowKey?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The Theme the toast was shown from, when the fallback viewport draws it.
|
|
112
|
+
* The fallback viewport sits outside the app's tree. The row draws the
|
|
113
|
+
* toast under this Theme and follows its changes.
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
callerTheme?: ThemeSource;
|
|
109
117
|
}
|
|
@@ -5,24 +5,65 @@ export const docs = {
|
|
|
5
5
|
name: 'useToast',
|
|
6
6
|
displayName: 'useToast',
|
|
7
7
|
group: 'Toast',
|
|
8
|
-
keywords: [
|
|
8
|
+
keywords: [
|
|
9
|
+
'toast',
|
|
10
|
+
'notification',
|
|
11
|
+
'snackbar',
|
|
12
|
+
'alert',
|
|
13
|
+
'message',
|
|
14
|
+
'feedback',
|
|
15
|
+
'flash',
|
|
16
|
+
],
|
|
9
17
|
params: [
|
|
10
18
|
// useToast takes no arguments; returns a show function
|
|
11
19
|
],
|
|
12
20
|
returns: [
|
|
13
21
|
{
|
|
14
|
-
name: '
|
|
22
|
+
name: 'value',
|
|
15
23
|
type: '(options: ToastOptions) => () => void',
|
|
16
|
-
description:
|
|
24
|
+
description:
|
|
25
|
+
"useToast returns the show function itself, not an object: `const showToast = useToast(); showToast({body: 'Saved'});`. Call it with toast options to show a toast; it returns a function that dismisses that toast. ToastOptions fields: " +
|
|
26
|
+
'body: ReactNode (required) is the message. ' +
|
|
27
|
+
'type?: "info" | "error" sets the color; default "info". ' +
|
|
28
|
+
'isAutoHide?: boolean dismisses the toast on a timer; default true for "info" and false for "error". ' +
|
|
29
|
+
'autoHideDuration?: number is the time in milliseconds before the auto-dismiss; default 5000. ' +
|
|
30
|
+
'endContent?: ReactNode is trailing content, for example an Undo Button. ' +
|
|
31
|
+
'uniqueID?: string identifies the toast for deduplication. ' +
|
|
32
|
+
'collisionBehavior?: "overwrite" | "ignore" sets what a new toast with the same uniqueID does: "overwrite" replaces the shown toast in place, "ignore" keeps the shown toast and drops the new one; default "overwrite". ' +
|
|
33
|
+
'onHide?: (reason: "auto" | "manual") => void runs when the toast is removed. ' +
|
|
34
|
+
'renderContent?: (toast) => ReactNode replaces the content of the card with your own layout; it receives body, endContent, type, isAutoHide, autoHideDuration and dismiss. Your layout must include the control that closes the toast. ' +
|
|
35
|
+
'Import the ToastOptions type from @astryxdesign/core/Toast.',
|
|
17
36
|
},
|
|
18
37
|
],
|
|
19
38
|
usage: {
|
|
20
|
-
description:
|
|
39
|
+
description:
|
|
40
|
+
'Hook for showing toast notifications from anywhere in your component tree; it needs no provider or mounted ToastViewport: inside LayerProvider (or a ToastViewport) it uses that viewport, and otherwise the first toast mounts a fallback viewport on document.body with a development warning. Returns the show function itself (not an object): `const showToast = useToast()`; call it with toast options to show the notification.',
|
|
21
41
|
bestPractices: [
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
{
|
|
43
|
+
guidance: true,
|
|
44
|
+
description:
|
|
45
|
+
'Use for transient success/error feedback that does not require user action.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
guidance: true,
|
|
49
|
+
description:
|
|
50
|
+
'Set uniqueID to deduplicate toasts from rapid user actions.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
guidance: true,
|
|
54
|
+
description:
|
|
55
|
+
'For an undo action, pass endContent: <Button label="Undo" variant="ghost" onClick={...} />, and call the dismiss function that showToast returns from that onClick.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
guidance: false,
|
|
59
|
+
description:
|
|
60
|
+
'Use for critical errors that require acknowledgment; use AlertDialog instead.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
guidance: false,
|
|
64
|
+
description:
|
|
65
|
+
'Call useToast in the same component that renders LayerProvider; it must be called from a child component inside the provider.',
|
|
66
|
+
},
|
|
26
67
|
],
|
|
27
68
|
},
|
|
28
69
|
relatedComponents: ['Toast', 'Banner', 'AlertDialog'],
|
|
@@ -33,17 +74,41 @@ export const docs = {
|
|
|
33
74
|
|
|
34
75
|
/** @type {import('@astryxdesign/cli/authoring').HookTranslationDoc} */
|
|
35
76
|
export const docsDense = {
|
|
36
|
-
description:
|
|
77
|
+
description:
|
|
78
|
+
'Show toast notifications from anywhere in component tree; no provider needed: uses LayerProvider/ToastViewport if present, else first toast mounts fallback viewport on document.body (dev warning). Returns the show fn itself, not an object (`const showToast = useToast()`); call it w/ toast options to show notification.',
|
|
37
79
|
returnDescriptions: {
|
|
38
|
-
|
|
80
|
+
value:
|
|
81
|
+
'Returns the show fn itself, not an object: `const showToast = useToast(); showToast({body: \'Saved\'})`. Shows toast; returns dismiss fn. ToastOptions: body: ReactNode (required); type?: "info"|"error" (default "info"); isAutoHide?: boolean (default true for info, false for error); autoHideDuration?: ms (default 5000); endContent?: ReactNode (e.g. Undo Button); uniqueID?: string (dedupe); collisionBehavior?: "overwrite"|"ignore" (same uniqueID; default "overwrite"); onHide?: (reason: "auto"|"manual") => void; renderContent?: (toast) => ReactNode (own card content; gets body, endContent, type, isAutoHide, autoHideDuration, dismiss; must render its own close control). Type: ToastOptions from @astryxdesign/core/Toast.',
|
|
39
82
|
},
|
|
40
83
|
usage: {
|
|
41
|
-
description:
|
|
84
|
+
description:
|
|
85
|
+
'Show toast notifications from anywhere in component tree; no provider needed: uses LayerProvider/ToastViewport if present, else first toast mounts fallback viewport on document.body (dev warning). Returns the show fn itself, not an object (`const showToast = useToast()`); call it w/ toast options to show notification.',
|
|
42
86
|
bestPractices: [
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
87
|
+
{
|
|
88
|
+
guidance: true,
|
|
89
|
+
description:
|
|
90
|
+
'Use for transient success/error feedback not requiring user action.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
guidance: true,
|
|
94
|
+
description:
|
|
95
|
+
'Set uniqueID to deduplicate toasts from rapid user actions.',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
guidance: true,
|
|
99
|
+
description:
|
|
100
|
+
'Undo: endContent = <Button label="Undo" variant="ghost" onClick={...} />; call dismiss fn returned by showToast from that onClick.',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
guidance: false,
|
|
104
|
+
description:
|
|
105
|
+
'Use for critical errors requiring acknowledgment; use AlertDialog instead.',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
guidance: false,
|
|
109
|
+
description:
|
|
110
|
+
'Call useToast in same component that renders LayerProvider; must be called from child component inside provider.',
|
|
111
|
+
},
|
|
47
112
|
],
|
|
48
113
|
},
|
|
49
114
|
};
|
package/src/Toast/useToast.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {ToastContext, type ToastContextValue} from './ToastContext';
|
|
|
9
9
|
import {ToastViewport} from './ToastViewport';
|
|
10
10
|
import {createToastQueue, ToastQueueConnector} from '../Layer/toastHost';
|
|
11
11
|
import {ThemeNestingContext} from '../theme/Theme';
|
|
12
|
+
import {ThemeSourceContext} from '../theme/useTheme';
|
|
12
13
|
import {warnOnce} from '../utils/devWarning';
|
|
13
14
|
import type {
|
|
14
15
|
ToastOptions,
|
|
@@ -29,11 +30,11 @@ const fallback = sharedForReact('toast/use-toast/fallback', 1, () => ({
|
|
|
29
30
|
|
|
30
31
|
const ROOT_THEME_ATTRS = ['data-theme', dataAttr('theme')] as const;
|
|
31
32
|
|
|
32
|
-
// The fallback container is a
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
33
|
+
// The fallback container is a separate tree with no ThemeContext. A toast
|
|
34
|
+
// shown from inside a Theme draws under that Theme (CallerTheme). For other
|
|
35
|
+
// toasts, this copies the theme attributes of <html> to the container, so the
|
|
36
|
+
// theme's scoped CSS reaches them. The container lives as long as the app, so
|
|
37
|
+
// the observer stays connected.
|
|
37
38
|
function syncRootThemeAttrs(container: HTMLElement): void {
|
|
38
39
|
const sync = () => {
|
|
39
40
|
let mirroredMode: string | null = null;
|
|
@@ -138,16 +139,26 @@ function generateToastId(): string {
|
|
|
138
139
|
*/
|
|
139
140
|
export function useToast(): ShowToastFn {
|
|
140
141
|
const contextFromProvider = use(ToastContext);
|
|
142
|
+
// The fallback viewport renders outside this tree, and a host page can
|
|
143
|
+
// rewrite `<html>`. So the toast takes its caller's Theme.
|
|
144
|
+
const callerTheme = use(ThemeSourceContext);
|
|
141
145
|
|
|
142
146
|
const showToast = useCallback(
|
|
143
147
|
(options: ToastOptions): ToastDismissFn => {
|
|
144
148
|
const ctx = contextFromProvider ?? getFallbackContext();
|
|
145
149
|
const id = generateToastId();
|
|
146
|
-
const entry: ToastEntry = {
|
|
150
|
+
const entry: ToastEntry = {
|
|
151
|
+
id,
|
|
152
|
+
options,
|
|
153
|
+
createdAt: Date.now(),
|
|
154
|
+
...(contextFromProvider == null && callerTheme != null
|
|
155
|
+
? {callerTheme}
|
|
156
|
+
: null),
|
|
157
|
+
};
|
|
147
158
|
ctx.addToast(entry);
|
|
148
159
|
return () => ctx.removeToast(id, 'manual');
|
|
149
160
|
},
|
|
150
|
-
[contextFromProvider],
|
|
161
|
+
[contextFromProvider, callerTheme],
|
|
151
162
|
);
|
|
152
163
|
|
|
153
164
|
return showToast;
|
|
@@ -17,7 +17,7 @@ export const docs = {
|
|
|
17
17
|
theming: {
|
|
18
18
|
targets: [
|
|
19
19
|
{className: 'astryx-toggle-button-group'},
|
|
20
|
-
{className: 'astryx-toggle-button', states: ['isPressed'], visualProps: ['elevation']},
|
|
20
|
+
{className: 'astryx-toggle-button', states: ['isPressed', 'grouped'], visualProps: ['elevation']},
|
|
21
21
|
],
|
|
22
22
|
},
|
|
23
23
|
description: 'A button that toggles between pressed and unpressed states. Thin wrapper over Button with controlled toggle pattern, icon swap, and font weight emphasis.',
|