@astryxdesign/core 0.1.4-canary.fd7ab46 → 0.1.4
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/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +18 -20
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -3
- package/dist/AppShell/AppShell.d.ts +1 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +53 -55
- package/dist/AspectRatio/AspectRatio.d.ts +10 -48
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +12 -33
- package/dist/AspectRatio/index.d.ts +1 -1
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +25 -27
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.js +5 -5
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +25 -32
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.js +7 -7
- package/dist/Button/Button.js +19 -19
- package/dist/ButtonGroup/ButtonGroup.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +48 -68
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +2 -2
- package/dist/Card/Card.d.ts +2 -4
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +10 -18
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +21 -24
- package/dist/Carousel/carousel.markers.stylex.d.ts +7 -0
- package/dist/Carousel/carousel.markers.stylex.d.ts.map +1 -0
- package/dist/Carousel/carousel.markers.stylex.js +12 -0
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.js +23 -23
- package/dist/Chat/ChatComposerDrawer.js +14 -14
- package/dist/Chat/ChatComposerInput.d.ts +1 -1
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +15 -27
- package/dist/Chat/ChatDictationButton.d.ts +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +11 -13
- package/dist/Chat/ChatLayout.js +17 -17
- package/dist/Chat/ChatLayoutScrollButton.d.ts +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +10 -12
- package/dist/Chat/ChatMessage.js +12 -12
- package/dist/Chat/ChatMessageBubble.js +7 -7
- package/dist/Chat/ChatMessageList.js +14 -14
- package/dist/Chat/ChatMessageMetadata.d.ts +1 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +12 -14
- package/dist/Chat/ChatPastedTextToken.js +13 -13
- package/dist/Chat/ChatSendButton.js +3 -3
- package/dist/Chat/ChatSystemMessage.d.ts +1 -1
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +17 -17
- package/dist/Chat/ChatTokenizedText.d.ts +1 -1
- package/dist/Chat/ChatTokenizedText.d.ts.map +1 -1
- package/dist/Chat/ChatTokenizedText.js +15 -24
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +74 -81
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -15
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +23 -25
- package/dist/CheckboxList/CheckboxList.js +9 -9
- package/dist/CheckboxList/CheckboxListItem.d.ts +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +6 -8
- package/dist/Citation/Citation.js +10 -10
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +9 -32
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts +1 -10
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +52 -88
- package/dist/Collapsible/Collapsible.d.ts +3 -9
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +22 -110
- package/dist/Collapsible/CollapsibleGroup.d.ts +7 -39
- package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroup.js +12 -73
- package/dist/Collapsible/CollapsibleGroupContext.d.ts +0 -31
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -33
- package/dist/Collapsible/index.d.ts +0 -1
- package/dist/Collapsible/index.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.d.ts +1 -4
- package/dist/Collapsible/useCollapsible.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.js +6 -20
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +34 -36
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.js +13 -13
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +2 -7
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +43 -76
- package/dist/DateInput/DateInput.js +18 -18
- package/dist/DateRangeInput/DateRangeInput.js +21 -21
- package/dist/DateTimeInput/DateTimeInput.d.ts +2 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +26 -30
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.js +16 -16
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.js +10 -10
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +17 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.js +29 -29
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.d.ts +3 -4
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +12 -29
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.d.ts +1 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +12 -16
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +11 -11
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +18 -18
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.d.ts +2 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +31 -44
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +31 -55
- package/dist/Lightbox/useLightbox.js +3 -3
- package/dist/Link/Link.js +15 -15
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +102 -102
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.js +15 -15
- package/dist/MobileNav/MobileNavToggle.js +5 -5
- package/dist/MoreMenu/MoreMenu.js +3 -3
- package/dist/MultiSelector/MultiSelector.js +56 -56
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +32 -48
- package/dist/Outline/Outline.js +15 -15
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.js +3 -3
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +72 -125
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.js +7 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +92 -110
- package/dist/PowerSearch/PowerSearchEditPopover.js +84 -84
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.js +5 -5
- package/dist/PowerSearch/PowerSearchValueEditor.js +54 -54
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +18 -25
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +21 -24
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -28
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +10 -32
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +12 -18
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.js +46 -46
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +34 -38
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +6 -8
- package/dist/SideNav/SideNavHeading.js +87 -87
- package/dist/SideNav/SideNavItem.js +42 -42
- package/dist/SideNav/SideNavSection.d.ts +1 -1
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +16 -18
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts +4 -8
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -34
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.js +5 -5
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +30 -57
- package/dist/TabList/tab.markers.stylex.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -50
- package/dist/Table/Table.js +7 -7
- package/dist/Table/TableBody.d.ts +1 -1
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -9
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.d.ts +1 -1
- package/dist/Table/TableFooter.d.ts.map +1 -1
- package/dist/Table/TableFooter.js +5 -9
- package/dist/Table/TableHeader.d.ts +1 -1
- package/dist/Table/TableHeader.d.ts.map +1 -1
- package/dist/Table/TableHeader.js +5 -9
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +11 -14
- package/dist/Table/plugins/filtering/useTableFiltering.js +71 -71
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +1 -5
- package/dist/Table/plugins/pagination/useTablePagination.js +7 -7
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +22 -22
- package/dist/Table/plugins/selection/useTableSelection.js +18 -18
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.js +1 -11
- package/dist/Table/plugins/sortable/useTableSortable.js +17 -17
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -8
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.js +15 -15
- package/dist/Thumbnail/Thumbnail.d.ts +2 -3
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +29 -30
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +21 -26
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +26 -37
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +11 -23
- package/dist/Toast/useToast.js +4 -4
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.js +21 -21
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +34 -36
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.d.ts +1 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.js +32 -32
- package/dist/TopNav/TopNavHeading.js +67 -67
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +14 -25
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.js +8 -8
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.js +30 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +20 -23
- package/dist/Typeahead/Typeahead.js +12 -12
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/astryx.css +0 -7
- package/dist/astryx.umd.js +60 -60
- package/dist/astryx.umd.js.map +4 -4
- package/dist/docs-types.d.ts +2 -8
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.d.ts +1 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +1 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useFocusTrap.d.ts +0 -3
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -38
- package/dist/hooks/useInteractiveRole.d.ts +2 -6
- package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
- package/dist/hooks/useInteractiveRole.js +2 -6
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/hooks/useStreamingText.d.ts +1 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +5 -14
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +3 -10
- package/dist/theme/hct.d.ts +15 -0
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +9 -9
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/dist/theme/tokens.d.ts +2 -10
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +4 -220
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -8
- package/package.json +3 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +0 -4
- package/src/AlertDialog/AlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.tsx +0 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +1 -28
- package/src/AspectRatio/AspectRatio.test.tsx +1 -142
- package/src/AspectRatio/AspectRatio.tsx +10 -70
- package/src/AspectRatio/index.ts +1 -5
- package/src/Avatar/Avatar.doc.mjs +0 -11
- package/src/Avatar/Avatar.test.tsx +1 -32
- package/src/Avatar/Avatar.tsx +20 -12
- package/src/Banner/Banner.doc.mjs +0 -8
- package/src/Banner/Banner.test.tsx +0 -38
- package/src/Banner/Banner.tsx +1 -8
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +17 -122
- package/src/Calendar/Calendar.tsx +5 -26
- package/src/Calendar/dayCellUtils.ts +1 -3
- package/src/Calendar/styles.ts +2 -12
- package/src/Card/Card.tsx +6 -16
- package/src/Carousel/Carousel.doc.mjs +12 -12
- package/src/Carousel/Carousel.test.tsx +0 -13
- package/src/Carousel/Carousel.tsx +2 -4
- package/src/Carousel/carousel.markers.stylex.ts +10 -0
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.test.tsx +1 -27
- package/src/Chat/ChatComposerInput.tsx +15 -20
- package/src/Chat/ChatDictationButton.tsx +4 -4
- package/src/Chat/ChatLayoutScrollButton.tsx +1 -3
- package/src/Chat/ChatMessageMetadata.tsx +6 -4
- package/src/Chat/ChatSystemMessage.test.tsx +11 -26
- package/src/Chat/ChatSystemMessage.tsx +7 -7
- package/src/Chat/ChatTokenizedText.test.tsx +16 -29
- package/src/Chat/ChatTokenizedText.tsx +8 -15
- package/src/Chat/ChatToolCalls.test.tsx +0 -55
- package/src/Chat/ChatToolCalls.tsx +12 -10
- package/src/Chat/index.ts +4 -1
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +4 -71
- package/src/CheckboxInput/CheckboxInput.tsx +0 -2
- package/src/CheckboxList/CheckboxList.test.tsx +0 -19
- package/src/CheckboxList/CheckboxListItem.tsx +2 -11
- package/src/Citation/Citation.doc.mjs +0 -5
- package/src/ClickableCard/ClickableCard.tsx +2 -45
- package/src/CodeBlock/CodeBlock.doc.mjs +2 -7
- package/src/CodeBlock/CodeBlock.test.tsx +3 -122
- package/src/CodeBlock/CodeBlock.tsx +4 -62
- package/src/Collapsible/Collapsible.doc.mjs +4 -8
- package/src/Collapsible/Collapsible.tsx +10 -86
- package/src/Collapsible/CollapsibleGroup.doc.mjs +3 -27
- package/src/Collapsible/CollapsibleGroup.test.tsx +0 -318
- package/src/Collapsible/CollapsibleGroup.tsx +9 -107
- package/src/Collapsible/CollapsibleGroupContext.tsx +2 -42
- package/src/Collapsible/index.ts +0 -4
- package/src/Collapsible/useCollapsible.ts +6 -20
- package/src/CommandPalette/CommandPalette.doc.mjs +0 -4
- package/src/CommandPalette/CommandPalette.tsx +3 -5
- package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +0 -5
- package/src/CommandPalette/CommandPaletteGroup.doc.mjs +0 -10
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteItem.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteList.doc.mjs +0 -9
- package/src/ContextMenu/ContextMenu.doc.mjs +0 -15
- package/src/ContextMenu/ContextMenu.test.tsx +0 -87
- package/src/ContextMenu/ContextMenu.tsx +28 -87
- package/src/ContextMenu/ContextMenuItem.doc.mjs +0 -6
- package/src/DateInput/DateInput.test.tsx +20 -11
- package/src/DateRangeInput/DateRangeInput.test.tsx +44 -31
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -3
- package/src/DateTimeInput/DateTimeInput.test.tsx +16 -118
- package/src/DateTimeInput/DateTimeInput.tsx +2 -8
- package/src/DateTimeInput/index.ts +0 -1
- package/src/Dialog/Dialog.doc.mjs +0 -4
- package/src/Dialog/DialogHeader.doc.mjs +0 -45
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +2 -22
- package/src/DropdownMenu/DropdownMenuItem.tsx +17 -5
- package/src/Field/Field.test.tsx +4 -1
- package/src/Field/FieldLabel.test.tsx +2 -2
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +3 -0
- package/src/Grid/Grid.test.tsx +18 -43
- package/src/Grid/Grid.tsx +9 -26
- package/src/HoverCard/HoverCard.doc.mjs +6 -6
- package/src/HoverCard/useHoverCard.doc.mjs +5 -5
- package/src/HoverCard/useHoverCard.tsx +2 -9
- package/src/Icon/Icon.test.tsx +29 -41
- package/src/Icon/Icon.tsx +2 -6
- package/src/InputGroup/InputGroup.tsx +2 -2
- package/src/Item/Item.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +2 -221
- package/src/Layer/useLayer.tsx +30 -69
- package/src/Layout/LayoutContent.doc.mjs +0 -12
- package/src/Layout/LayoutPanel.doc.mjs +0 -40
- package/src/Lightbox/Lightbox.doc.mjs +0 -5
- package/src/Lightbox/Lightbox.test.tsx +2 -123
- package/src/Lightbox/Lightbox.tsx +1 -29
- package/src/Markdown/Markdown.tsx +7 -9
- package/src/Markdown/parser.perf.test.ts +12 -34
- package/src/NavMenu/NavMenu.doc.mjs +0 -15
- package/src/NumberInput/NumberInput.test.tsx +3 -48
- package/src/NumberInput/NumberInput.tsx +15 -32
- package/src/Overlay/Overlay.doc.mjs +0 -6
- package/src/Pagination/Pagination.test.tsx +0 -162
- package/src/Pagination/Pagination.tsx +26 -80
- package/src/Popover/Popover.doc.mjs +6 -6
- package/src/Popover/Popover.test.tsx +0 -65
- package/src/Popover/usePopover.doc.mjs +1 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.test.tsx +1 -109
- package/src/PowerSearch/PowerSearch.tsx +16 -37
- package/src/ProgressBar/ProgressBar.test.tsx +0 -30
- package/src/ProgressBar/ProgressBar.tsx +5 -12
- package/src/RadioList/RadioList.test.tsx +0 -19
- package/src/RadioList/RadioListItem.tsx +4 -9
- package/src/Resizable/ResizeHandle.tsx +4 -22
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/SegmentedControl/SegmentedControl.test.tsx +0 -192
- package/src/SegmentedControl/SegmentedControl.tsx +5 -27
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -9
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.test.tsx +1 -27
- package/src/SideNav/SideNav.doc.mjs +1 -7
- package/src/SideNav/SideNav.test.tsx +0 -66
- package/src/SideNav/SideNav.tsx +2 -6
- package/src/SideNav/SideNavCollapseButton.tsx +3 -4
- package/src/SideNav/SideNavSection.tsx +4 -6
- package/src/Switch/Switch.doc.mjs +7 -7
- package/src/Switch/Switch.test.tsx +3 -102
- package/src/Switch/Switch.tsx +7 -20
- package/src/TabList/TabList.test.tsx +1 -185
- package/src/TabList/TabMenu.tsx +9 -45
- package/src/Table/BaseTable.tsx +2 -13
- package/src/Table/Table.test.tsx +0 -87
- package/src/Table/TableBody.tsx +2 -15
- package/src/Table/TableFooter.tsx +2 -15
- package/src/Table/TableHeader.tsx +2 -15
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -13
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -3
- package/src/Table/plugins/pagination/paginateData.ts +1 -5
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -13
- package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -23
- package/src/Table/plugins/selection/useTableSelectionState.tsx +6 -11
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +1 -35
- package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -8
- package/src/TextArea/TextArea.test.tsx +3 -3
- package/src/TextInput/TextInput.test.tsx +3 -3
- package/src/Thumbnail/Thumbnail.test.tsx +2 -36
- package/src/Thumbnail/Thumbnail.tsx +2 -4
- package/src/TimeInput/TimeInput.test.tsx +0 -37
- package/src/TimeInput/TimeInput.tsx +1 -11
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +0 -52
- package/src/Timestamp/Timestamp.tsx +16 -30
- package/src/Toast/Toast.tsx +3 -11
- package/src/Toast/ToastViewport.test.tsx +0 -64
- package/src/Toast/ToastViewport.tsx +0 -12
- package/src/ToggleButton/ToggleButton.doc.mjs +0 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +0 -54
- package/src/Tokenizer/Tokenizer.tsx +4 -5
- package/src/Tooltip/Tooltip.doc.mjs +6 -6
- package/src/Tooltip/useTooltip.doc.mjs +5 -5
- package/src/Tooltip/useTooltip.tsx +2 -12
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.test.tsx +7 -23
- package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +2 -9
- package/src/TreeList/TreeList.doc.mjs +2 -2
- package/src/Typeahead/BaseTypeahead.doc.mjs +0 -19
- package/src/Typeahead/BaseTypeahead.tsx +2 -5
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.test.tsx +1 -45
- package/src/docs-types.ts +1 -9
- package/src/hooks/focusableSelector.ts +1 -1
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useFocusTrap.doc.mjs +2 -4
- package/src/hooks/useFocusTrap.test.tsx +1 -149
- package/src/hooks/useFocusTrap.ts +1 -50
- package/src/hooks/useInteractiveRole.ts +4 -12
- package/src/hooks/useStreamingText.test.ts +19 -54
- package/src/hooks/useStreamingText.ts +5 -16
- package/src/hooks/useTreeFocus.test.tsx +3 -1
- package/src/reset.css +0 -29
- package/src/theme/SyntaxTheme.doc.mjs +4 -4
- package/src/theme/defineTheme.ts +13 -4
- package/src/theme/derivedVarRegistry.test.ts +2 -2
- package/src/theme/expandColorScale.test.ts +0 -29
- package/src/theme/expandColorScale.ts +6 -11
- package/src/theme/hct.ts +17 -9
- package/src/theme/tokens.test.ts +9 -182
- package/src/theme/tokens.ts +4 -239
- package/src/theme/useTheme.test.tsx +0 -20
- package/src/utils/index.ts +0 -4
- package/src/utils/sharedResizeObserver.test.ts +2 -2
- package/src/utils/timeParser.test.ts +0 -13
- package/src/utils/timeParser.ts +5 -8
- package/dist/hooks/useHotkeys.d.ts +0 -51
- package/dist/hooks/useHotkeys.d.ts.map +0 -1
- package/dist/hooks/useHotkeys.js +0 -160
- package/dist/utils/color.d.ts +0 -42
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js +0 -150
- package/dist/utils/composeEventHandlers.d.ts +0 -30
- package/dist/utils/composeEventHandlers.d.ts.map +0 -1
- package/dist/utils/composeEventHandlers.js +0 -40
- package/src/Chat/ChatDictationButton.test.tsx +0 -43
- package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -33
- package/src/Chat/ChatMessageMetadata.test.tsx +0 -32
- package/src/Collapsible/Collapsible.test.tsx +0 -405
- package/src/FieldStatus/FieldStatus.test.tsx +0 -282
- package/src/InteractiveRoleContext/InteractiveRoleContext.test.tsx +0 -185
- package/src/Layout/Layout.test.tsx +0 -285
- package/src/Layout/LayoutSlots.test.tsx +0 -364
- package/src/Outline/parseOutlineFromMarkdown.test.ts +0 -80
- package/src/OverflowList/OverflowList.test.tsx +0 -416
- package/src/Overlay/Overlay.test.tsx +0 -356
- package/src/Resizable/ResizeHandle.test.tsx +0 -218
- package/src/SizeContext/SizeContext.test.tsx +0 -226
- package/src/__tests__/TestIcon.tsx +0 -26
- package/src/__tests__/fastRoleQueries.ts +0 -66
- package/src/docPropReferences.test.ts +0 -178
- package/src/hooks/useHotkeys.doc.mjs +0 -52
- package/src/hooks/useHotkeys.test.ts +0 -245
- package/src/hooks/useHotkeys.ts +0 -203
- package/src/utils/color.test.ts +0 -133
- package/src/utils/color.ts +0 -148
- package/src/utils/composeEventHandlers.test.ts +0 -71
- package/src/utils/composeEventHandlers.ts +0 -44
- package/src/utils/mergeProps.test.ts +0 -166
|
@@ -39,11 +39,10 @@ export const docs = {
|
|
|
39
39
|
],
|
|
40
40
|
usage: {
|
|
41
41
|
description:
|
|
42
|
-
'Traps focus within a container element following the WAI-ARIA dialog focus trap pattern. Listens to focus events on the document and redirects focus back into the container if it escapes via keyboard navigation. Handles both Tab and Shift+Tab wrapping.
|
|
42
|
+
'Traps focus within a container element following the WAI-ARIA dialog focus trap pattern. Listens to focus events on the document and redirects focus back into the container if it escapes via keyboard navigation. Handles both Tab and Shift+Tab wrapping. Mouse clicks outside the container are not intercepted; use a light-dismiss handler for that.',
|
|
43
43
|
bestPractices: [
|
|
44
44
|
{ guidance: true, description: 'Call focusFirst() when opening a dialog/modal to move focus into the trapped region.' },
|
|
45
45
|
{ guidance: true, description: 'Provide an onEscape callback to close the dialog when Escape is pressed.' },
|
|
46
|
-
{ guidance: true, description: 'Rely on the built-in focus restoration on close; only add your own onHide focus handling when you need to send focus somewhere other than the previously-focused element.' },
|
|
47
46
|
{ guidance: false, description: 'Use on non-modal content like tooltips or dropdowns; those need light-dismiss, not focus trapping.' },
|
|
48
47
|
],
|
|
49
48
|
},
|
|
@@ -68,11 +67,10 @@ export const docsDense = {
|
|
|
68
67
|
},
|
|
69
68
|
usage: {
|
|
70
69
|
description:
|
|
71
|
-
'Traps focus within container element following WAI-ARIA dialog focus trap pattern. Listens to document focus events + redirects focus back into container if it escapes via keyboard navigation. Handles both Tab + Shift+Tab wrapping.
|
|
70
|
+
'Traps focus within container element following WAI-ARIA dialog focus trap pattern. Listens to document focus events + redirects focus back into container if it escapes via keyboard navigation. Handles both Tab + Shift+Tab wrapping. Mouse clicks outside container not intercepted; use light-dismiss handler for that.',
|
|
72
71
|
bestPractices: [
|
|
73
72
|
{ guidance: true, description: 'Call focusFirst() when opening dialog/modal to move focus into trapped region.' },
|
|
74
73
|
{ guidance: true, description: 'Provide onEscape callback to close dialog when Escape pressed.' },
|
|
75
|
-
{ guidance: true, description: 'Rely on built-in focus restoration on close; add own onHide focus handling only to send focus somewhere other than previously-focused element.' },
|
|
76
74
|
{ guidance: false, description: 'Use on non-modal content like tooltips / dropdowns; those need light-dismiss, not focus trapping.' },
|
|
77
75
|
],
|
|
78
76
|
},
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
import {describe, it, expect, vi} from 'vitest';
|
|
13
13
|
import {render, screen, fireEvent} from '@testing-library/react';
|
|
14
|
-
import {FOCUSABLE_SELECTOR} from './focusableSelector';
|
|
15
14
|
import {useFocusTrap} from './useFocusTrap';
|
|
16
15
|
|
|
17
16
|
function Trap({children}: {children: React.ReactNode}) {
|
|
@@ -50,41 +49,6 @@ function EscapeTrap({
|
|
|
50
49
|
);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
function RestoreTrap({isActive}: {isActive: boolean}) {
|
|
54
|
-
const {containerRef} = useFocusTrap<HTMLDivElement>({isActive});
|
|
55
|
-
return (
|
|
56
|
-
<div ref={containerRef} data-testid="restore-trap">
|
|
57
|
-
<button type="button" data-testid="inside">
|
|
58
|
-
Inside trap
|
|
59
|
-
</button>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function RestoreFixture({
|
|
65
|
-
isActive,
|
|
66
|
-
showPrev = true,
|
|
67
|
-
showTrap = true,
|
|
68
|
-
}: {
|
|
69
|
-
isActive: boolean;
|
|
70
|
-
showPrev?: boolean;
|
|
71
|
-
showTrap?: boolean;
|
|
72
|
-
}) {
|
|
73
|
-
return (
|
|
74
|
-
<div>
|
|
75
|
-
{showPrev && (
|
|
76
|
-
<button type="button" data-testid="prev">
|
|
77
|
-
Previously focused
|
|
78
|
-
</button>
|
|
79
|
-
)}
|
|
80
|
-
<button type="button" data-testid="other">
|
|
81
|
-
Other outside
|
|
82
|
-
</button>
|
|
83
|
-
{showTrap && <RestoreTrap isActive={isActive} />}
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
52
|
describe('useFocusTrap tabbable model (infra-8)', () => {
|
|
89
53
|
it('treats a contenteditable as focusable (focusFirst lands on it)', () => {
|
|
90
54
|
render(
|
|
@@ -120,48 +84,6 @@ describe('useFocusTrap tabbable model (infra-8)', () => {
|
|
|
120
84
|
});
|
|
121
85
|
});
|
|
122
86
|
|
|
123
|
-
describe('FOCUSABLE_SELECTOR href matching', () => {
|
|
124
|
-
// Only real links (<a href>/<area href>) are focusable via href. A bare
|
|
125
|
-
// [href] term also matched non-focusable elements carrying href (e.g. a
|
|
126
|
-
// <link> in the head, or a custom element), which useFocusTrap would then
|
|
127
|
-
// treat as tab stops when computing trap boundaries.
|
|
128
|
-
it('matches real links but not other elements carrying href', () => {
|
|
129
|
-
const container = document.createElement('div');
|
|
130
|
-
container.innerHTML =
|
|
131
|
-
'<a href="#a" data-testid="anchor">Anchor</a>' +
|
|
132
|
-
'<map name="m">' +
|
|
133
|
-
'<area href="#area" shape="rect" coords="0,0,1,1" data-testid="area" />' +
|
|
134
|
-
'</map>' +
|
|
135
|
-
'<span href="#span" data-testid="span">Span</span>' +
|
|
136
|
-
'<link href="#link" data-testid="link" />';
|
|
137
|
-
|
|
138
|
-
const matches = Array.from(
|
|
139
|
-
container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),
|
|
140
|
-
);
|
|
141
|
-
const byTestId = (id: string) =>
|
|
142
|
-
container.querySelector(`[data-testid="${id}"]`);
|
|
143
|
-
|
|
144
|
-
// Real links are focusable via href.
|
|
145
|
-
expect(matches).toContain(byTestId('anchor'));
|
|
146
|
-
expect(matches).toContain(byTestId('area'));
|
|
147
|
-
// Non-link elements carrying href are not focusable and must be excluded.
|
|
148
|
-
expect(matches).not.toContain(byTestId('span'));
|
|
149
|
-
expect(matches).not.toContain(byTestId('link'));
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('treats an <a href> inside a trap as focusable (focusFirst lands on it)', () => {
|
|
153
|
-
render(
|
|
154
|
-
<Trap>
|
|
155
|
-
<a href="#link" data-testid="anchor">
|
|
156
|
-
Link
|
|
157
|
-
</a>
|
|
158
|
-
</Trap>,
|
|
159
|
-
);
|
|
160
|
-
fireEvent.click(screen.getByTestId('focus-first'));
|
|
161
|
-
expect(screen.getByTestId('anchor')).toHaveFocus();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
87
|
describe('useFocusTrap Escape coordination', () => {
|
|
166
88
|
it('calls onEscape for a single active trap', () => {
|
|
167
89
|
const onEscape = vi.fn();
|
|
@@ -203,78 +125,8 @@ describe('useFocusTrap Escape coordination', () => {
|
|
|
203
125
|
const {rerender} = render(
|
|
204
126
|
<EscapeTrap isActive onEscape={onEscape} label="toggle" />,
|
|
205
127
|
);
|
|
206
|
-
rerender(
|
|
207
|
-
<EscapeTrap isActive={false} onEscape={onEscape} label="toggle" />,
|
|
208
|
-
);
|
|
128
|
+
rerender(<EscapeTrap isActive={false} onEscape={onEscape} label="toggle" />);
|
|
209
129
|
fireEvent.keyDown(document, {key: 'Escape'});
|
|
210
130
|
expect(onEscape).not.toHaveBeenCalled();
|
|
211
131
|
});
|
|
212
132
|
});
|
|
213
|
-
|
|
214
|
-
describe('useFocusTrap focus restoration', () => {
|
|
215
|
-
it('restores focus to the previously-focused element when deactivated', () => {
|
|
216
|
-
const {rerender} = render(<RestoreFixture isActive={false} />);
|
|
217
|
-
const prev = screen.getByTestId('prev');
|
|
218
|
-
prev.focus();
|
|
219
|
-
expect(prev).toHaveFocus();
|
|
220
|
-
|
|
221
|
-
// Activate the trap (captures `prev` as the restore target) and move focus
|
|
222
|
-
// inside it, as auto-focus or a keyboard user would.
|
|
223
|
-
rerender(<RestoreFixture isActive={true} />);
|
|
224
|
-
screen.getByTestId('inside').focus();
|
|
225
|
-
expect(screen.getByTestId('inside')).toHaveFocus();
|
|
226
|
-
|
|
227
|
-
// Deactivating returns focus to where it was before the trap opened.
|
|
228
|
-
rerender(<RestoreFixture isActive={false} />);
|
|
229
|
-
expect(prev).toHaveFocus();
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('does not steal focus when it was moved elsewhere outside the trap', () => {
|
|
233
|
-
const {rerender} = render(<RestoreFixture isActive={false} />);
|
|
234
|
-
const prev = screen.getByTestId('prev');
|
|
235
|
-
prev.focus();
|
|
236
|
-
|
|
237
|
-
rerender(<RestoreFixture isActive={true} />);
|
|
238
|
-
// The user (or a consumer that self-restores) moves focus to a different
|
|
239
|
-
// outside control while the trap is open.
|
|
240
|
-
const other = screen.getByTestId('other');
|
|
241
|
-
other.focus();
|
|
242
|
-
|
|
243
|
-
rerender(<RestoreFixture isActive={false} />);
|
|
244
|
-
// Focus is left where the user put it — not yanked back to `prev`.
|
|
245
|
-
expect(other).toHaveFocus();
|
|
246
|
-
expect(prev).not.toHaveFocus();
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it('does not crash or restore when the captured element was removed', () => {
|
|
250
|
-
const {rerender} = render(<RestoreFixture isActive={false} />);
|
|
251
|
-
const prev = screen.getByTestId('prev');
|
|
252
|
-
prev.focus();
|
|
253
|
-
|
|
254
|
-
rerender(<RestoreFixture isActive={true} />);
|
|
255
|
-
screen.getByTestId('inside').focus();
|
|
256
|
-
|
|
257
|
-
// Remove the captured element from the DOM before the trap deactivates.
|
|
258
|
-
rerender(<RestoreFixture isActive={true} showPrev={false} />);
|
|
259
|
-
expect(() =>
|
|
260
|
-
rerender(<RestoreFixture isActive={false} showPrev={false} />),
|
|
261
|
-
).not.toThrow();
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it('restores focus when the trap unmounts while active', () => {
|
|
265
|
-
const {rerender} = render(
|
|
266
|
-
<RestoreFixture isActive={true} showTrap={false} />,
|
|
267
|
-
);
|
|
268
|
-
const prev = screen.getByTestId('prev');
|
|
269
|
-
prev.focus();
|
|
270
|
-
|
|
271
|
-
// Mounting the trap active captures `prev`; then focus moves inside it.
|
|
272
|
-
rerender(<RestoreFixture isActive={true} showTrap={true} />);
|
|
273
|
-
screen.getByTestId('inside').focus();
|
|
274
|
-
expect(screen.getByTestId('inside')).toHaveFocus();
|
|
275
|
-
|
|
276
|
-
// Unmounting the trap (cleanup path, not an isActive flip) still restores.
|
|
277
|
-
rerender(<RestoreFixture isActive={true} showTrap={false} />);
|
|
278
|
-
expect(prev).toHaveFocus();
|
|
279
|
-
});
|
|
280
|
-
});
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useFocusTrap.ts
|
|
7
7
|
* @input Uses React useCallback, useEffect, useRef
|
|
8
|
-
* @output Exports useFocusTrap hook for trapping focus within a container
|
|
9
|
-
* restoring focus to the previously-focused element on deactivation
|
|
8
|
+
* @output Exports useFocusTrap hook for trapping focus within a container
|
|
10
9
|
* @position Core hook; used by dialogs, modals, date pickers
|
|
11
10
|
*
|
|
12
11
|
* Based on WAI-ARIA dialog pattern:
|
|
@@ -179,9 +178,6 @@ export interface UseFocusTrapReturn<T extends HTMLElement = HTMLElement> {
|
|
|
179
178
|
* - Listens to focus events on the document
|
|
180
179
|
* - Redirects focus back into the container if it escapes
|
|
181
180
|
* - Handles both Tab and Shift+Tab navigation
|
|
182
|
-
* - Restores focus to the element that was focused before activation when the
|
|
183
|
-
* trap deactivates or unmounts, unless focus was already moved elsewhere
|
|
184
|
-
* (so consumers that restore focus themselves are unaffected)
|
|
185
181
|
*
|
|
186
182
|
* @example
|
|
187
183
|
* ```
|
|
@@ -221,51 +217,6 @@ export function useFocusTrap<T extends HTMLElement = HTMLElement>(
|
|
|
221
217
|
}
|
|
222
218
|
}, []);
|
|
223
219
|
|
|
224
|
-
/**
|
|
225
|
-
* Capture the element focused before the trap activated, and restore focus to
|
|
226
|
-
* it when the trap deactivates (or the component unmounts). Overlays are
|
|
227
|
-
* opened imperatively (e.g. `showPopover()`), so the browser's declarative
|
|
228
|
-
* popover focus restoration does not apply — without this, closing a Popover
|
|
229
|
-
* via Escape or light dismiss drops keyboard focus to `<body>`.
|
|
230
|
-
*
|
|
231
|
-
* The restore is guarded so it never steals focus a consumer moved on
|
|
232
|
-
* purpose: it only runs when focus would otherwise be lost — i.e. the active
|
|
233
|
-
* element is nothing, the document body/root, or still inside the (possibly
|
|
234
|
-
* now-unmounted) trap container. If focus already moved to some other element
|
|
235
|
-
* outside the trap (the user clicked elsewhere, or a consumer such as
|
|
236
|
-
* DropdownMenu already refocused its trigger), the restore is a no-op.
|
|
237
|
-
*/
|
|
238
|
-
useEffect(() => {
|
|
239
|
-
if (!isActive) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const previouslyFocused = document.activeElement as HTMLElement | null;
|
|
244
|
-
// Snapshot the container now; by cleanup it may be detached or unmounted.
|
|
245
|
-
const container = containerRef.current;
|
|
246
|
-
|
|
247
|
-
return () => {
|
|
248
|
-
const active = document.activeElement;
|
|
249
|
-
const focusWasLost =
|
|
250
|
-
active == null ||
|
|
251
|
-
active === document.body ||
|
|
252
|
-
active === document.documentElement ||
|
|
253
|
-
(container != null && container.contains(active));
|
|
254
|
-
|
|
255
|
-
if (!focusWasLost) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
previouslyFocused != null &&
|
|
261
|
-
previouslyFocused.isConnected &&
|
|
262
|
-
typeof previouslyFocused.focus === 'function'
|
|
263
|
-
) {
|
|
264
|
-
previouslyFocused.focus();
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
}, [isActive]);
|
|
268
|
-
|
|
269
220
|
/**
|
|
270
221
|
* Handle focus events - redirect focus back into container if it escapes.
|
|
271
222
|
* Only redirects for keyboard navigation, not mouse clicks.
|
|
@@ -11,14 +11,11 @@
|
|
|
11
11
|
* Centralizes the "what element should I render as?" decision for
|
|
12
12
|
* polymorphic components. The priority order:
|
|
13
13
|
*
|
|
14
|
-
* 1. href → 'link' (navigation always wins
|
|
14
|
+
* 1. href → 'link' (navigation always wins)
|
|
15
15
|
* 2. onClick → 'button' (explicit interactivity)
|
|
16
16
|
* 3. interactive trigger context → 'button' (implicit via parent)
|
|
17
17
|
* 4. else → 'inert' (non-interactive)
|
|
18
18
|
*
|
|
19
|
-
* A disabled `href` is excluded at step 1 and therefore resolves via the
|
|
20
|
-
* remaining steps — 'inert' when no onClick or context applies.
|
|
21
|
-
*
|
|
22
19
|
* This hook is the single place to add new context-based triggers
|
|
23
20
|
* (e.g., Popover, DropdownMenu, Disclosure). Components that consume
|
|
24
21
|
* this hook never need updating when new trigger contexts are added.
|
|
@@ -52,12 +49,8 @@ export interface UseInteractiveRoleOptions {
|
|
|
52
49
|
onClick?: ((...args: never[]) => unknown) | null;
|
|
53
50
|
|
|
54
51
|
/**
|
|
55
|
-
* Whether the component is disabled. When true
|
|
56
|
-
*
|
|
57
|
-
* decided by the remaining inputs: `onClick` → `'button'`, an interactive
|
|
58
|
-
* context → its role, otherwise `'inert'`. In particular a disabled `href`
|
|
59
|
-
* with no `onClick` and no context override resolves to `'inert'`, not a
|
|
60
|
-
* link or a button.
|
|
52
|
+
* Whether the component is disabled. When true and href is provided,
|
|
53
|
+
* falls back to button (disabled links are an a11y anti-pattern).
|
|
61
54
|
* @default false
|
|
62
55
|
*/
|
|
63
56
|
isDisabled?: boolean;
|
|
@@ -90,8 +83,7 @@ export function useInteractiveRole({
|
|
|
90
83
|
}: UseInteractiveRoleOptions): InteractiveRole {
|
|
91
84
|
const contextRole = useInteractiveRoleContext();
|
|
92
85
|
|
|
93
|
-
// 1. href → link (unless disabled —
|
|
94
|
-
// resolved by the checks below, landing on 'inert' if nothing else applies)
|
|
86
|
+
// 1. href → link (unless disabled — disabled links fall through to button)
|
|
95
87
|
if (href != null && !isDisabled) {
|
|
96
88
|
return 'link';
|
|
97
89
|
}
|
|
@@ -8,10 +8,6 @@ describe('useStreamingText', () => {
|
|
|
8
8
|
let rafCallbacks: ((time: number) => void)[];
|
|
9
9
|
let originalRAF: typeof requestAnimationFrame;
|
|
10
10
|
let originalCAF: typeof cancelAnimationFrame;
|
|
11
|
-
let originalMatchMedia: typeof window.matchMedia | undefined;
|
|
12
|
-
// Toggled per-test to drive the reduced-motion media query. Reset in
|
|
13
|
-
// beforeEach so the preference never leaks between tests.
|
|
14
|
-
let prefersReducedMotion: boolean;
|
|
15
11
|
|
|
16
12
|
beforeEach(() => {
|
|
17
13
|
rafCallbacks = [];
|
|
@@ -23,44 +19,33 @@ describe('useStreamingText', () => {
|
|
|
23
19
|
});
|
|
24
20
|
globalThis.cancelAnimationFrame = vi.fn();
|
|
25
21
|
|
|
26
|
-
// Mock matchMedia for useTheme → useMediaQuery
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
addEventListener: vi.fn(),
|
|
43
|
-
removeEventListener: vi.fn(),
|
|
44
|
-
dispatchEvent: vi.fn(),
|
|
45
|
-
})),
|
|
46
|
-
});
|
|
22
|
+
// Mock matchMedia for useTheme → useMediaQuery
|
|
23
|
+
if (!window.matchMedia) {
|
|
24
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
25
|
+
writable: true,
|
|
26
|
+
value: vi.fn().mockImplementation((query: string) => ({
|
|
27
|
+
matches: false,
|
|
28
|
+
media: query,
|
|
29
|
+
onchange: null,
|
|
30
|
+
addListener: vi.fn(),
|
|
31
|
+
removeListener: vi.fn(),
|
|
32
|
+
addEventListener: vi.fn(),
|
|
33
|
+
removeEventListener: vi.fn(),
|
|
34
|
+
dispatchEvent: vi.fn(),
|
|
35
|
+
})),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
47
38
|
});
|
|
48
39
|
|
|
49
40
|
afterEach(() => {
|
|
50
41
|
globalThis.requestAnimationFrame = originalRAF;
|
|
51
42
|
globalThis.cancelAnimationFrame = originalCAF;
|
|
52
|
-
// Restore matchMedia so the mock never leaks into other suites. jsdom
|
|
53
|
-
// has no matchMedia by default, so drop the property when there was none.
|
|
54
|
-
if (originalMatchMedia === undefined) {
|
|
55
|
-
// @ts-expect-error jsdom leaves matchMedia undefined by default
|
|
56
|
-
delete window.matchMedia;
|
|
57
|
-
} else {
|
|
58
|
-
window.matchMedia = originalMatchMedia;
|
|
59
|
-
}
|
|
60
43
|
});
|
|
61
44
|
|
|
62
45
|
it('returns full text when not streaming', () => {
|
|
63
|
-
const {result} = renderHook(() =>
|
|
46
|
+
const {result} = renderHook(() =>
|
|
47
|
+
useStreamingText('Hello world', false),
|
|
48
|
+
);
|
|
64
49
|
expect(result.current).toBe('Hello world');
|
|
65
50
|
});
|
|
66
51
|
|
|
@@ -71,26 +56,6 @@ describe('useStreamingText', () => {
|
|
|
71
56
|
expect(result.current).toBe('Hello world');
|
|
72
57
|
});
|
|
73
58
|
|
|
74
|
-
it('snaps to full text immediately when reduced motion is preferred', () => {
|
|
75
|
-
prefersReducedMotion = true;
|
|
76
|
-
const {result} = renderHook(() => useStreamingText('Hello world', true));
|
|
77
|
-
expect(result.current).toBe('Hello world');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('keeps snapping to the full text on updates when reduced motion is preferred', () => {
|
|
81
|
-
prefersReducedMotion = true;
|
|
82
|
-
const {result, rerender} = renderHook(
|
|
83
|
-
({text}) => useStreamingText(text, true),
|
|
84
|
-
{initialProps: {text: 'Hello'}},
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
expect(result.current).toBe('Hello');
|
|
88
|
-
|
|
89
|
-
// A later chunk arrives — it should appear in full, not reveal char-by-char.
|
|
90
|
-
rerender({text: 'Hello world'});
|
|
91
|
-
expect(result.current).toBe('Hello world');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
59
|
it('starts with empty string when streaming', () => {
|
|
95
60
|
const {result} = renderHook(() => useStreamingText('Hello world', true));
|
|
96
61
|
expect(result.current).toBe('');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useStreamingText.ts
|
|
7
|
-
* @input Uses React useState, useEffect, useRef,
|
|
7
|
+
* @input Uses React useState, useEffect, useRef, useTheme
|
|
8
8
|
* @output Exports useStreamingText hook for smooth text streaming
|
|
9
9
|
* @position Core hook; smooths bursty streamed text into steady character reveal
|
|
10
10
|
*
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import {useEffect, useMemo, useRef, useState} from 'react';
|
|
26
|
-
import {useMediaQuery} from './useMediaQuery';
|
|
27
26
|
import {useTheme} from '../theme/useTheme';
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -72,9 +71,7 @@ const CHARS_PER_TICK = {
|
|
|
72
71
|
* Smooths bursty streamed text into a steady character-by-character reveal.
|
|
73
72
|
*
|
|
74
73
|
* Returns a string that grows steadily toward `targetText`. When `isStreaming`
|
|
75
|
-
* is false, returns the full `targetText` immediately.
|
|
76
|
-
* reduced motion, the progressive reveal is skipped entirely and the full
|
|
77
|
-
* `targetText` is returned immediately.
|
|
74
|
+
* is false, returns the full `targetText` immediately.
|
|
78
75
|
*
|
|
79
76
|
* The hook advances on word and syntax boundaries, avoiding slices inside
|
|
80
77
|
* markdown markers like `**`, backticks, `[]()`, etc. This prevents visual
|
|
@@ -146,17 +143,9 @@ export function useStreamingText(
|
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
// Respect the user's reduced-motion preference — skip the progressive
|
|
150
|
-
// reveal and snap straight to the full text. Uses the package's SSR-safe
|
|
151
|
-
// useMediaQuery (useMediaQuery.ts) so the read stays in sync if the
|
|
152
|
-
// preference changes mid-stream.
|
|
153
|
-
const prefersReducedMotion = useMediaQuery(
|
|
154
|
-
'(prefers-reduced-motion: reduce)',
|
|
155
|
-
);
|
|
156
|
-
|
|
157
146
|
// Animation loop
|
|
158
147
|
useEffect(() => {
|
|
159
|
-
if (!isStreaming || speed === 'instant'
|
|
148
|
+
if (!isStreaming || speed === 'instant') {
|
|
160
149
|
return;
|
|
161
150
|
}
|
|
162
151
|
|
|
@@ -185,9 +174,9 @@ export function useStreamingText(
|
|
|
185
174
|
rafRef.current = null;
|
|
186
175
|
}
|
|
187
176
|
};
|
|
188
|
-
}, [isStreaming, charsPerTick, tickMs, speed
|
|
177
|
+
}, [isStreaming, charsPerTick, tickMs, speed]);
|
|
189
178
|
|
|
190
|
-
if (!isStreaming || speed === 'instant'
|
|
179
|
+
if (!isStreaming || speed === 'instant') {
|
|
191
180
|
return targetText;
|
|
192
181
|
}
|
|
193
182
|
|
|
@@ -44,7 +44,9 @@ function Tree({
|
|
|
44
44
|
const nodes = isOpen && expanded.length > 0 ? expanded : collapsed;
|
|
45
45
|
const {treeRef, handleKeyDown} = useTreeFocus<HTMLUListElement>({
|
|
46
46
|
onToggleExpand: () => setIsOpen(o => !o),
|
|
47
|
-
onActivate: onActivate
|
|
47
|
+
onActivate: onActivate
|
|
48
|
+
? (_item, id) => onActivate(id)
|
|
49
|
+
: undefined,
|
|
48
50
|
});
|
|
49
51
|
return (
|
|
50
52
|
<ul ref={treeRef} role="tree" onKeyDown={handleKeyDown}>
|
package/src/reset.css
CHANGED
|
@@ -200,35 +200,6 @@
|
|
|
200
200
|
height: auto;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
/* ===========================================================================
|
|
204
|
-
AspectRatio Fit Baseline
|
|
205
|
-
=========================================================================== */
|
|
206
|
-
|
|
207
|
-
/*
|
|
208
|
-
* Child sizing for AspectRatio's `fit` prop — the component marks the
|
|
209
|
-
* child's direct parent with `data-astryx-aspect-ratio-override` (carrying
|
|
210
|
-
* the fit value), and these direct-child rules size the child, so
|
|
211
|
-
* consumers don't hand-write width/height/object-fit on every media child.
|
|
212
|
-
* The marker sits on the parent itself, so the rules don't depend on
|
|
213
|
-
* AspectRatio's internal element structure or its theming surface. As with
|
|
214
|
-
* the [data-astryx-media] baseline below, the rules are zero-specificity
|
|
215
|
-
* and any styling the child sets itself still wins. `fit="center"` needs
|
|
216
|
-
* no rules here — the component centers the child from its own wrapper.
|
|
217
|
-
*/
|
|
218
|
-
:where([data-astryx-aspect-ratio-override="cover"], [data-astryx-aspect-ratio-override="contain"])
|
|
219
|
-
> :where(*) {
|
|
220
|
-
width: 100%;
|
|
221
|
-
height: 100%;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
:where([data-astryx-aspect-ratio-override="cover"]) > :where(img, video) {
|
|
225
|
-
object-fit: cover;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
:where([data-astryx-aspect-ratio-override="contain"]) > :where(img, video) {
|
|
229
|
-
object-fit: contain;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
203
|
/* ===========================================================================
|
|
233
204
|
Forms
|
|
234
205
|
=========================================================================== */
|
|
@@ -50,9 +50,9 @@ export const docs = {
|
|
|
50
50
|
'Syntax themes support light-dark() tuples: each token can have different values for light and dark mode, resolved automatically by the color scheme.',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
guidance:
|
|
53
|
+
guidance: false,
|
|
54
54
|
description:
|
|
55
|
-
'
|
|
55
|
+
'Wrap individual CodeBlock instances with SyntaxTheme: use the syntaxTheme prop on CodeBlock directly for per-instance overrides.',
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
58
|
},
|
|
@@ -96,9 +96,9 @@ export const docsDense = {
|
|
|
96
96
|
'Syntax themes support light-dark() tuples: each token can have different values for light/dark mode, resolved automatically by color scheme.',
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
guidance:
|
|
99
|
+
guidance: false,
|
|
100
100
|
description:
|
|
101
|
-
'
|
|
101
|
+
'Wrap individual CodeBlock instances w/ SyntaxTheme: use syntaxTheme prop on CodeBlock directly for per-instance overrides instead.',
|
|
102
102
|
},
|
|
103
103
|
],
|
|
104
104
|
},
|
package/src/theme/defineTheme.ts
CHANGED
|
@@ -56,8 +56,14 @@ import {
|
|
|
56
56
|
generateTypeScaleComponents,
|
|
57
57
|
type TypeScaleConfig,
|
|
58
58
|
} from './expandTypeScale';
|
|
59
|
-
import {
|
|
60
|
-
|
|
59
|
+
import {
|
|
60
|
+
expandMotionScale,
|
|
61
|
+
type MotionScaleConfig,
|
|
62
|
+
} from './expandMotionScale';
|
|
63
|
+
import {
|
|
64
|
+
expandRadiusScale,
|
|
65
|
+
type RadiusScaleConfig,
|
|
66
|
+
} from './expandRadiusScale';
|
|
61
67
|
import {expandColorScale, type ColorScaleConfig} from './expandColorScale';
|
|
62
68
|
|
|
63
69
|
import type {DomainTokenName} from './domainTokens';
|
|
@@ -147,7 +153,10 @@ export type StyleOverrides = Record<string, string | Record<string, string>>;
|
|
|
147
153
|
* }
|
|
148
154
|
* ```
|
|
149
155
|
*/
|
|
150
|
-
export type ComponentStyleMap = Record<
|
|
156
|
+
export type ComponentStyleMap = Record<
|
|
157
|
+
string,
|
|
158
|
+
Record<string, StyleOverrides>
|
|
159
|
+
>;
|
|
151
160
|
|
|
152
161
|
/** Input to defineTheme */
|
|
153
162
|
export interface DefineThemeInput {
|
|
@@ -278,7 +287,7 @@ export interface DefineThemeInput {
|
|
|
278
287
|
/**
|
|
279
288
|
* Default syntax highlighting theme for code components.
|
|
280
289
|
* Sets --color-syntax-* tokens at the theme root. Can be overridden
|
|
281
|
-
* per-region
|
|
290
|
+
* per-region via SyntaxTheme or per-instance via syntaxTheme prop.
|
|
282
291
|
*
|
|
283
292
|
* @example
|
|
284
293
|
* ```tsx
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
import {describe, it, expect} from 'vitest';
|
|
16
16
|
import {derivedVarRegistry, getDerivedVars} from './derivedVarRegistry';
|
|
17
|
-
import {readdirSync, readFileSync} from '
|
|
18
|
-
import {join} from '
|
|
17
|
+
import {readdirSync, readFileSync} from 'fs';
|
|
18
|
+
import {join} from 'path';
|
|
19
19
|
|
|
20
20
|
const SRC_DIR = join(__dirname, '..');
|
|
21
21
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import {describe, it, expect} from 'vitest';
|
|
4
4
|
import {expandColorScale} from './expandColorScale';
|
|
5
5
|
import {defineTheme} from './defineTheme';
|
|
6
|
-
import {generateThemeRules} from './generateThemeRules';
|
|
7
6
|
|
|
8
7
|
describe('expandColorScale', () => {
|
|
9
8
|
it('produces all expected token keys', () => {
|
|
@@ -61,19 +60,6 @@ describe('expandColorScale', () => {
|
|
|
61
60
|
expect(warm['--color-neutral']).not.toBe(neutral['--color-neutral']);
|
|
62
61
|
});
|
|
63
62
|
|
|
64
|
-
it('emits derived accent tokens as references to --color-accent', () => {
|
|
65
|
-
const tokens = expandColorScale({accent: '#0064E0'});
|
|
66
|
-
// Reference tokens follow a scoped --color-accent override at runtime.
|
|
67
|
-
expect(tokens['--color-text-accent']).toBe('var(--color-accent)');
|
|
68
|
-
expect(tokens['--color-icon-accent']).toBe('var(--color-accent)');
|
|
69
|
-
expect(tokens['--color-accent-muted']).toBe(
|
|
70
|
-
'light-dark(color-mix(in srgb, var(--color-accent) 20%, transparent), color-mix(in srgb, var(--color-accent) 25%, transparent))',
|
|
71
|
-
);
|
|
72
|
-
// The base token and the contrast-computed on-accent stay resolved.
|
|
73
|
-
expect(tokens['--color-accent']).toMatch(/^light-dark\(#/);
|
|
74
|
-
expect(tokens['--color-on-accent']).toMatch(/^light-dark\(#/);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
63
|
it('contrast high produces different --color-text-primary than standard', () => {
|
|
78
64
|
const standard = expandColorScale({
|
|
79
65
|
accent: '#0064E0',
|
|
@@ -95,19 +81,4 @@ describe('expandColorScale + defineTheme integration', () => {
|
|
|
95
81
|
});
|
|
96
82
|
expect(theme.tokens['--color-accent']).toBe('red');
|
|
97
83
|
});
|
|
98
|
-
|
|
99
|
-
it('generated theme CSS keeps the accent references (#3495)', () => {
|
|
100
|
-
const theme = defineTheme({
|
|
101
|
-
name: 'test-accent-refs',
|
|
102
|
-
color: {accent: '#DC2626'},
|
|
103
|
-
});
|
|
104
|
-
const css = generateThemeRules(theme).join('\n');
|
|
105
|
-
expect(css).toContain('--color-text-accent: var(--color-accent);');
|
|
106
|
-
expect(css).toContain('--color-icon-accent: var(--color-accent);');
|
|
107
|
-
expect(css).toContain(
|
|
108
|
-
'--color-accent-muted: light-dark(color-mix(in srgb, var(--color-accent) 20%, transparent), color-mix(in srgb, var(--color-accent) 25%, transparent));',
|
|
109
|
-
);
|
|
110
|
-
// The base token itself stays a resolved color pair.
|
|
111
|
-
expect(css).toMatch(/--color-accent: light-dark\(#/);
|
|
112
|
-
});
|
|
113
84
|
});
|