@astryxdesign/core 0.7.4 → 0.7.5-canary.04434e7
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 +2 -2
- package/dist/AlertDialog/index.d.ts +4 -4
- package/dist/AlertDialog/useImperativeAlertDialog.d.ts +1 -1
- package/dist/AppShell/AppShell.d.ts +4 -4
- package/dist/AppShell/index.d.ts +4 -4
- package/dist/AspectRatio/AspectRatio.d.ts +1 -1
- package/dist/AspectRatio/index.d.ts +2 -2
- package/dist/Avatar/Avatar.d.ts +2 -2
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -2
- package/dist/Avatar/index.d.ts +4 -4
- package/dist/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/dist/AvatarGroup/AvatarGroupContext.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/index.d.ts +6 -6
- package/dist/Badge/Badge.d.ts +2 -2
- package/dist/Badge/index.d.ts +2 -2
- package/dist/Banner/Banner.d.ts +4 -4
- package/dist/Banner/index.d.ts +2 -2
- package/dist/Blockquote/Blockquote.d.ts +1 -1
- package/dist/Blockquote/index.d.ts +2 -2
- package/dist/BottomSheet/BottomSheet.d.ts +10 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +12 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts +3 -3
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts +2 -2
- package/dist/BottomSheet/index.d.ts +4 -4
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/Breadcrumbs/index.d.ts +12 -12
- package/dist/Button/Button.d.ts +4 -4
- package/dist/Button/index.d.ts +2 -2
- package/dist/ButtonGroup/ButtonGroup.d.ts +4 -4
- package/dist/ButtonGroup/index.d.ts +4 -4
- package/dist/Calendar/Calendar.d.ts +3 -3
- package/dist/Calendar/dayCellUtils.d.ts +1 -1
- package/dist/Calendar/getInitialFocusDate.d.ts +2 -2
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +1 -1
- package/dist/Calendar/hooks/index.d.ts +6 -6
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +2 -2
- package/dist/Calendar/hooks/useCalendarDays.d.ts +2 -2
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts +2 -2
- package/dist/Calendar/index.d.ts +5 -5
- package/dist/Calendar/utils.d.ts +1 -1
- package/dist/Card/Card.d.ts +4 -4
- package/dist/Card/index.d.ts +2 -2
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/index.d.ts +2 -2
- package/dist/Center/Center.d.ts +2 -2
- package/dist/Center/index.d.ts +2 -2
- package/dist/Chat/ChatComposer.d.ts +1 -1
- package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
- package/dist/Chat/ChatComposerInput.d.ts +4 -4
- package/dist/Chat/ChatDictationButton.d.ts +2 -2
- package/dist/Chat/ChatLayout.d.ts +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts +2 -2
- package/dist/Chat/ChatMessageBubble.d.ts +2 -2
- package/dist/Chat/ChatMessageList.d.ts +3 -3
- package/dist/Chat/ChatMessageMetadata.d.ts +1 -1
- package/dist/Chat/ChatSendButton.d.ts +1 -1
- package/dist/Chat/ChatSystemMessage.d.ts +1 -1
- package/dist/Chat/ChatTokenizedText.d.ts +2 -2
- package/dist/Chat/ChatToolCalls.d.ts +1 -1
- package/dist/Chat/index.d.ts +43 -43
- package/dist/Chat/useChatComposerTokens.d.ts +1 -1
- package/dist/Chat/useChatDictation.d.ts +1 -1
- package/dist/Chat/useChatPasteAsToken.d.ts +1 -1
- package/dist/Chat/useTriggerMenu.d.ts +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts +4 -4
- package/dist/CheckboxInput/index.d.ts +2 -2
- package/dist/CheckboxList/CheckboxList.d.ts +4 -4
- package/dist/CheckboxList/CheckboxListItem.d.ts +2 -2
- package/dist/CheckboxList/index.d.ts +4 -4
- package/dist/Citation/Citation.d.ts +1 -1
- package/dist/Citation/index.d.ts +2 -2
- package/dist/ClickableCard/ClickableCard.d.ts +3 -3
- package/dist/ClickableCard/index.d.ts +2 -2
- package/dist/Code/Code.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/CodeBlock/CodeBlock.d.ts +2 -2
- package/dist/CodeBlock/highlightRanges.d.ts +1 -1
- package/dist/CodeBlock/index.d.ts +8 -8
- package/dist/Collapsible/Collapsible.d.ts +2 -2
- package/dist/Collapsible/CollapsibleGroup.d.ts +2 -2
- package/dist/Collapsible/index.d.ts +7 -7
- package/dist/CommandPalette/CommandPalette.d.ts +2 -2
- package/dist/CommandPalette/CommandPaletteContext.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteEmpty.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteFooter.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteGroup.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteItem.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteList.d.ts +1 -1
- package/dist/CommandPalette/index.d.ts +16 -16
- package/dist/ComplexSelector/ComplexSelector.d.ts +5 -5
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts +4 -4
- package/dist/ContextMenu/index.d.ts +9 -9
- package/dist/DateInput/DateInput.d.ts +7 -7
- package/dist/DateInput/MonthScroller.d.ts +1 -1
- package/dist/DateInput/NativeDateField.d.ts +1 -1
- package/dist/DateInput/TouchDateField.d.ts +1 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +1 -1
- package/dist/DateInput/index.d.ts +2 -2
- package/dist/DateInput/monthGeometry.d.ts +1 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts +6 -6
- package/dist/DateRangeInput/index.d.ts +2 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts +6 -6
- package/dist/DateTimeInput/NativeDateSegment.d.ts +3 -3
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +4 -4
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts +2 -2
- package/dist/Dialog/Dialog.d.ts +3 -3
- package/dist/Dialog/DialogHeader.d.ts +1 -1
- package/dist/Dialog/index.d.ts +6 -6
- package/dist/Dialog/useImperativeDialog.d.ts +1 -1
- package/dist/Divider/Divider.d.ts +2 -2
- package/dist/Divider/index.d.ts +2 -2
- package/dist/Drawer/Drawer.d.ts +3 -3
- package/dist/Drawer/DrawerHeader.d.ts +1 -1
- package/dist/Drawer/index.d.ts +4 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts +5 -5
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +2 -2
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +2 -2
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +12 -7
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +13 -5
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +2 -2
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts +1 -1
- package/dist/DropdownMenu/index.d.ts +10 -10
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +2 -2
- package/dist/DropdownMenu/renderDropdownItems.d.ts +1 -1
- package/dist/DropdownMenu/useMenuDrillIn.d.ts +1 -1
- package/dist/EmptyState/EmptyState.d.ts +1 -1
- package/dist/EmptyState/index.d.ts +2 -2
- package/dist/Field/Field.d.ts +5 -5
- package/dist/Field/FieldLabel.d.ts +2 -2
- package/dist/Field/PanelSearchInput.d.ts +1 -1
- package/dist/Field/fieldInputFamily.testing.d.ts +1 -1
- package/dist/Field/fieldParts.d.ts +1 -1
- package/dist/Field/index.d.ts +10 -10
- package/dist/Field/inputDisabledFocus.d.ts +14 -0
- package/dist/Field/inputDisabledFocus.d.ts.map +1 -0
- package/dist/Field/inputDisabledFocus.js +19 -0
- package/dist/FieldStatus/FieldStatus.d.ts +3 -3
- package/dist/FieldStatus/index.d.ts +2 -2
- package/dist/FieldStatus/useFieldStatusAnnouncement.d.ts +1 -1
- package/dist/FileInput/FileInput.d.ts +4 -4
- package/dist/FileInput/index.d.ts +2 -2
- package/dist/FormLayout/FormLayout.d.ts +2 -2
- package/dist/FormLayout/index.d.ts +4 -4
- package/dist/Grid/Grid.d.ts +3 -3
- package/dist/Grid/GridSpan.d.ts +1 -1
- package/dist/Grid/index.d.ts +4 -4
- package/dist/HStack/HStack.d.ts +2 -2
- package/dist/HStack/index.d.ts +1 -1
- package/dist/Heading/Heading.d.ts +4 -4
- package/dist/Heading/index.d.ts +1 -1
- package/dist/HoverCard/HoverCard.d.ts +4 -4
- package/dist/HoverCard/index.d.ts +4 -4
- package/dist/HoverCard/useHoverCard.d.ts +2 -2
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Icon/IconDefaultSizeContext.d.ts +1 -1
- package/dist/Icon/defaultIcons.d.ts +1 -1
- package/dist/Icon/globalIconRegistry.d.ts +1 -1
- package/dist/Icon/index.d.ts +5 -5
- package/dist/Icon/useIcon.d.ts +1 -1
- package/dist/IconButton/IconButton.d.ts +1 -1
- package/dist/IconButton/index.d.ts +2 -2
- package/dist/Indicator/CheckIndicator.d.ts +1 -1
- package/dist/Indicator/CheckboxIndicator.d.ts +1 -1
- package/dist/Indicator/RadioIndicator.d.ts +1 -1
- package/dist/Indicator/index.d.ts +8 -8
- package/dist/Indicator/indicatorRegistry.d.ts +2 -2
- package/dist/Indicator/types.d.ts +1 -1
- package/dist/Indicator/useIndicator.d.ts +2 -2
- package/dist/InputGroup/InputGroup.d.ts +2 -2
- package/dist/InputGroup/InputGroupText.d.ts +1 -1
- package/dist/InputGroup/index.d.ts +6 -6
- package/dist/InteractiveRoleContext/InteractiveRoleContext.d.ts +1 -1
- package/dist/InteractiveRoleContext/index.d.ts +1 -1
- package/dist/Item/Item.d.ts +1 -1
- package/dist/Item/ItemSwipeLayer.d.ts +2 -2
- package/dist/Item/index.d.ts +2 -2
- package/dist/Kbd/Kbd.d.ts +1 -1
- package/dist/Kbd/index.d.ts +2 -2
- package/dist/Layer/LayerProvider.d.ts +1 -1
- package/dist/Layer/index.d.ts +18 -18
- package/dist/Layer/layerInset.d.ts +1 -1
- package/dist/Layer/layerSlideRules.d.ts +1 -1
- package/dist/Layer/modalOutlet.d.ts +1 -1
- package/dist/Layer/modalOutlet.js +1 -1
- package/dist/Layer/useLayerDismissal.d.ts +1 -1
- package/dist/Layer/useTouchTrigger.d.ts +14 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +72 -17
- package/dist/Layout/Layout.d.ts +2 -2
- package/dist/Layout/LayoutContent.d.ts +2 -2
- package/dist/Layout/LayoutFooter.d.ts +2 -2
- package/dist/Layout/LayoutHeader.d.ts +2 -2
- package/dist/Layout/LayoutPanel.d.ts +3 -3
- package/dist/Layout/index.d.ts +29 -29
- package/dist/Layout/padding.stylex.d.ts +1 -1
- package/dist/Lightbox/Lightbox.d.ts +1 -1
- package/dist/Lightbox/index.d.ts +4 -4
- package/dist/Lightbox/useLightbox.d.ts +1 -1
- package/dist/Link/Link.d.ts +3 -3
- package/dist/Link/LinkContext.d.ts +1 -1
- package/dist/Link/LinkProvider.d.ts +1 -1
- package/dist/Link/index.d.ts +8 -8
- package/dist/Link/useLinkComponent.d.ts +1 -1
- package/dist/List/List.d.ts +3 -3
- package/dist/List/ListItem.d.ts +2 -2
- package/dist/List/index.d.ts +4 -4
- package/dist/Markdown/Markdown.d.ts +4 -4
- package/dist/Markdown/headingProjection.d.ts +3 -3
- package/dist/Markdown/index.d.ts +7 -7
- package/dist/Markdown/parser/index.d.ts +3 -3
- package/dist/Markdown/parser.d.ts +3 -3
- package/dist/Markdown/plugin-renderer/MarkdownPluginNodeRenderer.d.ts +1 -1
- package/dist/Markdown/plugin-renderer/index.d.ts +2 -2
- package/dist/Markdown/plugins/frontmatter.d.ts +2 -2
- package/dist/Markdown/plugins/headingLinks.d.ts +2 -2
- package/dist/Markdown/plugins/index.d.ts +14 -14
- package/dist/Markdown/plugins/protocol.d.ts +1 -1
- package/dist/Markdown/plugins/semanticFence.d.ts +2 -2
- package/dist/Markdown/plugins/softBreaks.d.ts +1 -1
- package/dist/Markdown/plugins/sourceDecoration.d.ts +2 -2
- package/dist/Markdown/plugins/sourceLines.d.ts +1 -1
- package/dist/Markdown/plugins/textTransform.d.ts +2 -2
- package/dist/Markdown/remark.d.ts +1 -1
- package/dist/Markdown/utils.d.ts +4 -4
- package/dist/MetadataList/MetadataList.d.ts +2 -2
- package/dist/MetadataList/MetadataListItem.d.ts +1 -1
- package/dist/MetadataList/index.d.ts +5 -5
- package/dist/MobileNav/MobileNav.d.ts +1 -1
- package/dist/MobileNav/MobileNavToggle.d.ts +1 -1
- package/dist/MobileNav/index.d.ts +4 -4
- package/dist/MoreMenu/MoreMenu.d.ts +4 -4
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts +7 -7
- package/dist/MultiSelector/hooks.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts +3 -3
- package/dist/MultiSelector/types.d.ts +1 -1
- package/dist/NavIcon/NavIcon.d.ts +1 -1
- package/dist/NavIcon/index.d.ts +2 -2
- package/dist/NavMenu/NavHeadingMenu.d.ts +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts +2 -2
- package/dist/NavMenu/index.d.ts +6 -6
- package/dist/NumberInput/NumberInput.d.ts +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +46 -20
- package/dist/NumberInput/index.d.ts +2 -2
- package/dist/NumberInput/numberInputCommit.d.ts +1 -1
- package/dist/NumberInput/numberParser.d.ts +1 -1
- package/dist/Outline/Outline.d.ts +3 -3
- package/dist/Outline/index.d.ts +7 -7
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -2
- package/dist/Outline/useOutlineFromDOM.d.ts +1 -1
- package/dist/Outline/useOutlineFromMarkdown.d.ts +3 -3
- package/dist/Outline/useScrollSpy.d.ts +1 -1
- package/dist/OverflowList/OverflowList.d.ts +2 -2
- package/dist/OverflowList/index.d.ts +2 -2
- package/dist/Overlay/Overlay.d.ts +2 -2
- package/dist/Overlay/index.d.ts +5 -5
- package/dist/Overlay/useOverlay.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts +2 -2
- package/dist/Pagination/index.d.ts +2 -2
- package/dist/Popover/Popover.d.ts +3 -3
- package/dist/Popover/index.d.ts +4 -4
- package/dist/Popover/usePopover.d.ts +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts +5 -5
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +2 -2
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +2 -2
- package/dist/PowerSearch/formatFilterValue.d.ts +3 -3
- package/dist/PowerSearch/index.d.ts +8 -8
- package/dist/PowerSearch/resolveDateTimeRangePart.d.ts +1 -1
- package/dist/PowerSearch/resolveOperatorLabel.d.ts +2 -2
- package/dist/PowerSearch/types.d.ts +1 -1
- package/dist/PowerSearch/useInternalConfig.d.ts +1 -1
- package/dist/PowerSearch/usePowerSearchConfig.d.ts +1 -1
- package/dist/PowerSearch/usePowerSearchSource.d.ts +3 -3
- package/dist/PowerSearch/utils.d.ts +3 -3
- package/dist/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/ProgressBar/index.d.ts +2 -2
- package/dist/RadioList/RadioList.d.ts +3 -3
- package/dist/RadioList/RadioListItem.d.ts +2 -2
- package/dist/RadioList/index.d.ts +4 -4
- package/dist/Resizable/ResizeHandle.d.ts +2 -2
- package/dist/Resizable/index.d.ts +6 -6
- package/dist/Resizable/useResizable.d.ts +2 -2
- package/dist/Resizable/utils.d.ts +3 -3
- package/dist/ScrollableArea/ScrollableArea.d.ts +3 -3
- package/dist/ScrollableArea/index.d.ts +4 -4
- package/dist/Section/Section.d.ts +3 -3
- package/dist/Section/index.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/index.d.ts +5 -5
- package/dist/SelectableCard/SelectableCard.d.ts +3 -3
- package/dist/SelectableCard/index.d.ts +2 -2
- package/dist/Selector/Selector.d.ts +8 -8
- package/dist/Selector/SelectorOption.d.ts +1 -1
- package/dist/Selector/hooks.d.ts +1 -1
- package/dist/Selector/index.d.ts +4 -4
- package/dist/Selector/types.d.ts +1 -1
- package/dist/Selector/useSelectorPresentation.d.ts +2 -2
- package/dist/Selector/utils.d.ts +1 -1
- package/dist/SideNav/SideNav.d.ts +3 -3
- package/dist/SideNav/SideNavCollapseButton.d.ts +3 -3
- package/dist/SideNav/SideNavHeading.d.ts +2 -2
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +34 -0
- package/dist/SideNav/SideNavItem.d.ts +4 -4
- package/dist/SideNav/SideNavSection.d.ts +1 -1
- package/dist/SideNav/index.d.ts +14 -14
- package/dist/SizeContext/index.d.ts +1 -1
- package/dist/Skeleton/Skeleton.d.ts +1 -1
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +12 -3
- package/dist/Skeleton/index.d.ts +2 -2
- package/dist/Slider/Slider.d.ts +3 -3
- package/dist/Slider/index.d.ts +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/index.d.ts +2 -2
- package/dist/Stack/Stack.d.ts +3 -3
- package/dist/Stack/StackItem.d.ts +2 -2
- package/dist/Stack/index.d.ts +6 -6
- package/dist/Stack/stack.stylex.d.ts +1 -1
- package/dist/StatusDot/StatusDot.d.ts +2 -2
- package/dist/StatusDot/index.d.ts +2 -2
- package/dist/Stepper/Step.d.ts +2 -2
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +3 -3
- package/dist/Stepper/Stepper.d.ts +2 -2
- package/dist/Stepper/index.d.ts +7 -7
- package/dist/Switch/Switch.d.ts +4 -4
- package/dist/Switch/index.d.ts +2 -2
- package/dist/TabList/Tab.d.ts +2 -2
- package/dist/TabList/TabList.d.ts +3 -3
- package/dist/TabList/TabMenu.d.ts +2 -2
- package/dist/TabList/index.d.ts +8 -8
- package/dist/Table/BaseTable.d.ts +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/TableBody.d.ts +1 -1
- package/dist/Table/TableCell.d.ts +3 -3
- package/dist/Table/TableContext.d.ts +1 -1
- package/dist/Table/TableFooter.d.ts +1 -1
- package/dist/Table/TableHeader.d.ts +1 -1
- package/dist/Table/TableHeaderCell.d.ts +3 -3
- package/dist/Table/TableRow.d.ts +2 -2
- package/dist/Table/TableSelectionToolbar.d.ts +2 -2
- package/dist/Table/columnUtils.d.ts +1 -1
- package/dist/Table/index.d.ts +54 -54
- package/dist/Table/plugins/columnResize/index.d.ts +2 -2
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts +1 -1
- package/dist/Table/plugins/columnSettings/index.d.ts +4 -4
- package/dist/Table/plugins/columnSettings/useTableColumnSettings.d.ts +2 -2
- package/dist/Table/plugins/columnSettings/useTableColumnSettingsState.d.ts +1 -1
- package/dist/Table/plugins/filtering/index.d.ts +4 -4
- package/dist/Table/plugins/filtering/useTableFilterState.d.ts +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts +2 -2
- package/dist/Table/plugins/groupedRows/index.d.ts +2 -2
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/pagination/index.d.ts +3 -3
- package/dist/Table/plugins/pagination/useTablePagination.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/index.d.ts +2 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/index.d.ts +2 -2
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowStatus/index.d.ts +2 -2
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts +2 -2
- package/dist/Table/plugins/selection/index.d.ts +4 -4
- package/dist/Table/plugins/selection/useTableSelection.d.ts +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts +1 -1
- package/dist/Table/plugins/sortable/index.d.ts +4 -4
- package/dist/Table/plugins/sortable/useTableSortable.d.ts +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts +1 -1
- package/dist/Table/plugins/stickyColumns/index.d.ts +2 -2
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts +1 -1
- package/dist/Table/plugins/tree/index.d.ts +4 -4
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +1 -1
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +1 -1
- package/dist/Table/tableContextMenu.d.ts +2 -2
- package/dist/Table/types.d.ts +3 -3
- package/dist/Table/useBaseTablePlugins.d.ts +1 -1
- package/dist/Table/useTableCellStyles.d.ts +2 -2
- package/dist/Table/utils.d.ts +2 -2
- package/dist/Text/Text.d.ts +3 -3
- package/dist/Text/index.d.ts +4 -4
- package/dist/TextArea/TextArea.d.ts +10 -8
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +14 -11
- package/dist/TextArea/index.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts +11 -9
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +27 -17
- package/dist/TextInput/index.d.ts +2 -2
- package/dist/Thumbnail/Thumbnail.d.ts +1 -1
- package/dist/Thumbnail/index.d.ts +2 -2
- package/dist/TimeInput/TimeInput.d.ts +6 -6
- package/dist/TimeInput/TouchTimeField.d.ts +1 -1
- package/dist/TimeInput/index.d.ts +3 -3
- package/dist/Timer/Timer.d.ts +2 -2
- package/dist/Timer/index.d.ts +2 -2
- package/dist/Timestamp/Timestamp.d.ts +3 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts +1 -1
- package/dist/Timestamp/formatInstant.d.ts +2 -2
- package/dist/Timestamp/formatRelativeTime.d.ts +1 -1
- package/dist/Timestamp/index.d.ts +3 -3
- package/dist/Timestamp/tooltipEntries.d.ts +2 -2
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/ToastContext.d.ts +1 -1
- package/dist/Toast/ToastViewport.d.ts +2 -2
- package/dist/Toast/index.d.ts +6 -6
- package/dist/Toast/useToast.d.ts +1 -1
- package/dist/ToggleButton/ToggleButton.d.ts +3 -3
- package/dist/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/dist/ToggleButton/index.d.ts +4 -4
- package/dist/Token/Token.d.ts +2 -2
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/index.d.ts +2 -2
- package/dist/Tokenizer/Tokenizer.d.ts +6 -6
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +44 -40
- package/dist/Tokenizer/index.d.ts +2 -2
- package/dist/Tokenizer/useEndLaneReserve.d.ts +3 -2
- package/dist/Tokenizer/useEndLaneReserve.d.ts.map +1 -1
- package/dist/Tokenizer/useEndLaneReserve.js +3 -2
- package/dist/Toolbar/Toolbar.d.ts +4 -4
- package/dist/Toolbar/index.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +3 -3
- package/dist/Tooltip/index.d.ts +4 -4
- package/dist/Tooltip/useTooltip.d.ts +2 -2
- package/dist/TopNav/TopNav.d.ts +1 -1
- package/dist/TopNav/TopNavHeading.d.ts +2 -2
- package/dist/TopNav/TopNavItem.d.ts +3 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.d.ts +2 -2
- package/dist/TopNav/TopNavMenu.d.ts +1 -1
- package/dist/TopNav/index.d.ts +16 -16
- package/dist/TreeList/TreeList.d.ts +3 -3
- package/dist/TreeList/TreeListItem.d.ts +1 -1
- package/dist/TreeList/TreeListTypes.d.ts +1 -1
- package/dist/TreeList/index.d.ts +3 -3
- package/dist/Typeahead/BaseTypeahead.d.ts +2 -2
- package/dist/Typeahead/Typeahead.d.ts +6 -6
- package/dist/Typeahead/TypeaheadItem.d.ts +2 -2
- package/dist/Typeahead/createStaticSource.d.ts +1 -1
- package/dist/Typeahead/index.d.ts +9 -9
- package/dist/Typeahead/utils.d.ts +3 -3
- package/dist/VStack/VStack.d.ts +2 -2
- package/dist/VStack/index.d.ts +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +24 -6
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +24 -5
- package/dist/VisuallyHidden/index.d.ts +2 -2
- package/dist/astryx.css +8 -16
- package/dist/hooks/index.d.ts +52 -52
- package/dist/hooks/useAutoMediaMode.d.ts +1 -1
- package/dist/hooks/useInputContainer.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts +3 -3
- package/dist/hooks/useMenuPress.d.ts +1 -1
- package/dist/hooks/usePressFeedback.d.ts +1 -1
- package/dist/hooks/useScrollableArea.d.ts +1 -1
- package/dist/i18n/InternationalizationContext.d.ts +2 -2
- package/dist/i18n/InternationalizationProvider.d.ts +1 -1
- package/dist/i18n/index.d.ts +12 -12
- package/dist/i18n/resolve.d.ts +1 -1
- package/dist/i18n/useLocale.d.ts +1 -1
- package/dist/index.d.ts +111 -111
- package/dist/theme/Theme.d.ts +2 -2
- package/dist/theme/contrast.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts +12 -12
- package/dist/theme/domainTokens/index.d.ts +6 -6
- package/dist/theme/generateThemeRules.d.ts +1 -1
- package/dist/theme/index.d.ts +31 -31
- package/dist/theme/localTokens.d.ts +1 -1
- package/dist/theme/mergeComponents.d.ts +1 -1
- package/dist/theme/onMediaTokens.d.ts +1 -1
- package/dist/theme/resolveThemeValues.d.ts +7 -7
- package/dist/theme/syntax/SyntaxTheme.d.ts +1 -1
- package/dist/theme/syntax/index.d.ts +7 -7
- package/dist/theme/syntax/presets.d.ts +1 -1
- package/dist/theme/themeAdaptations.d.ts +5 -5
- package/dist/theme/themeRegistry.d.ts +1 -1
- package/dist/theme/tokens.d.ts +1 -1
- package/dist/theme/types.d.ts +1 -1
- package/dist/theme/useTheme.d.ts +2 -2
- package/dist/utils/dateParser.d.ts +3 -3
- package/dist/utils/groupItems.d.ts +1 -1
- package/dist/utils/index.d.ts +29 -29
- package/dist/utils/plainDate.d.ts +3 -3
- package/package.json +5 -5
- package/src/Badge/Badge.doc.mjs +2 -1
- package/src/BottomSheet/BottomSheet.tsx +12 -1
- package/src/BottomSheet/__tests__/BottomSheetToastOutlet.a11y.chromium.spec.ts +82 -0
- package/src/DateInput/DateInputTouch.test.tsx +9 -0
- package/src/DateInput/Wheel.tsx +4 -1
- package/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts +158 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +5 -2
- package/src/DropdownMenu/DropdownMenuRadioItem.spec.md +226 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +32 -16
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +158 -0
- package/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts +539 -0
- package/src/Field/inputDisabledFocus.ts +28 -0
- package/src/HoverCard/HoverCard.test.tsx +93 -3
- package/src/Icon/Icon.spec.md +40 -29
- package/src/Layer/__tests__/TouchTrigger.a11y.chromium.spec.ts +199 -0
- package/src/Layer/modalOutlet.ts +1 -1
- package/src/Layer/useTouchTrigger.ts +95 -41
- package/src/NumberInput/NumberInput.doc.mjs +6 -6
- package/src/NumberInput/NumberInput.test.tsx +144 -14
- package/src/NumberInput/NumberInput.tsx +68 -21
- package/src/Pagination/Pagination.test.tsx +2 -2
- package/src/SideNav/SideNav.test.tsx +15 -6
- package/src/SideNav/SideNavHeading.tsx +41 -0
- package/src/Skeleton/Skeleton.test.tsx +108 -1
- package/src/Skeleton/Skeleton.tsx +30 -2
- package/src/Stepper/Step.tsx +7 -0
- package/src/Stepper/Stepper.test.tsx +33 -0
- package/src/TextArea/TextArea.doc.mjs +6 -6
- package/src/TextArea/TextArea.test.tsx +65 -6
- package/src/TextArea/TextArea.tsx +26 -14
- package/src/TextInput/TextInput.doc.mjs +8 -8
- package/src/TextInput/TextInput.test.tsx +83 -10
- package/src/TextInput/TextInput.tsx +38 -19
- package/src/Toast/ToastViewport.modalHost.test.tsx +139 -4
- package/src/Tokenizer/Tokenizer.test.tsx +26 -8
- package/src/Tokenizer/Tokenizer.tsx +65 -72
- package/src/Tokenizer/__tests__/TokenizerEndLane.a11y.chromium.spec.ts +471 -0
- package/src/Tokenizer/useEndLaneReserve.ts +3 -2
- package/src/Tooltip/Tooltip.test.tsx +148 -3
- package/src/Tooltip/__tests__/Tooltip.a11y.states.ts +2 -2
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +1 -1
- package/src/VisuallyHidden/VisuallyHidden.test.tsx +39 -0
- package/src/VisuallyHidden/VisuallyHidden.tsx +38 -5
- package/src/theme/tokens.test.ts +60 -0
|
@@ -39,9 +39,36 @@ const STAGGER_TIME = 100;
|
|
|
39
39
|
// Animation Keyframes
|
|
40
40
|
// =============================================================================
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The pulse climbs from 0.25 to 0.925 opacity in ten equal steps, then plays
|
|
44
|
+
* back down (`alternate`). The steps are written out as holds joined by
|
|
45
|
+
* 0.01% ramps, with a linear timing function, rather than produced by a
|
|
46
|
+
* `steps()` timing function: WebKit never runs a `steps()` animation on the
|
|
47
|
+
* compositor, so Safari would repaint the pulse on the main thread and freeze
|
|
48
|
+
* it whenever a script runs. These keyframes give the same values at the same
|
|
49
|
+
* times, which every engine can animate off the main thread.
|
|
50
|
+
*/
|
|
42
51
|
const skeletonFade = stylex.keyframes({
|
|
43
52
|
'0%': {opacity: 0.25},
|
|
44
|
-
'
|
|
53
|
+
'9.99%': {opacity: 0.25},
|
|
54
|
+
'10%': {opacity: 0.325},
|
|
55
|
+
'19.99%': {opacity: 0.325},
|
|
56
|
+
'20%': {opacity: 0.4},
|
|
57
|
+
'29.99%': {opacity: 0.4},
|
|
58
|
+
'30%': {opacity: 0.475},
|
|
59
|
+
'39.99%': {opacity: 0.475},
|
|
60
|
+
'40%': {opacity: 0.55},
|
|
61
|
+
'49.99%': {opacity: 0.55},
|
|
62
|
+
'50%': {opacity: 0.625},
|
|
63
|
+
'59.99%': {opacity: 0.625},
|
|
64
|
+
'60%': {opacity: 0.7},
|
|
65
|
+
'69.99%': {opacity: 0.7},
|
|
66
|
+
'70%': {opacity: 0.775},
|
|
67
|
+
'79.99%': {opacity: 0.775},
|
|
68
|
+
'80%': {opacity: 0.85},
|
|
69
|
+
'89.99%': {opacity: 0.85},
|
|
70
|
+
'90%': {opacity: 0.925},
|
|
71
|
+
'100%': {opacity: 0.925},
|
|
45
72
|
});
|
|
46
73
|
|
|
47
74
|
// =============================================================================
|
|
@@ -78,7 +105,8 @@ const styles = stylex.create({
|
|
|
78
105
|
default: skeletonFade,
|
|
79
106
|
'@media (prefers-reduced-motion: reduce)': 'none',
|
|
80
107
|
},
|
|
81
|
-
|
|
108
|
+
// Linear between the keyframes' holds; see skeletonFade.
|
|
109
|
+
animationTimingFunction: 'linear',
|
|
82
110
|
},
|
|
83
111
|
});
|
|
84
112
|
|
package/src/Stepper/Step.tsx
CHANGED
|
@@ -1316,6 +1316,10 @@ export function Step({
|
|
|
1316
1316
|
const iconLabelNode = (
|
|
1317
1317
|
<div {...stylex.props(styles.iconLabelRow)}>
|
|
1318
1318
|
{(!isCompact || indicatorPosition !== 'on-track') && indicatorNode}
|
|
1319
|
+
{/* A space between the indicator and the label: the row is a flex
|
|
1320
|
+
container, which drops whitespace-only text, so nothing changes on
|
|
1321
|
+
screen, but a text reading of the button then keeps "1 Account" as two
|
|
1322
|
+
words instead of "1Account". */}{' '}
|
|
1319
1323
|
<span
|
|
1320
1324
|
{...mergeProps(
|
|
1321
1325
|
labelThemeProps,
|
|
@@ -1576,6 +1580,8 @@ export function Step({
|
|
|
1576
1580
|
)}
|
|
1577
1581
|
/>
|
|
1578
1582
|
</div>
|
|
1583
|
+
{/* Whitespace between the indicator column and the label, as in
|
|
1584
|
+
iconLabelNode. */}{' '}
|
|
1579
1585
|
<div {...stylex.props(styles.otBodyV)}>
|
|
1580
1586
|
{labelLineNode}
|
|
1581
1587
|
{otDescriptionNode}
|
|
@@ -1658,6 +1664,7 @@ export function Step({
|
|
|
1658
1664
|
)}
|
|
1659
1665
|
/>
|
|
1660
1666
|
</div>
|
|
1667
|
+
{/* Whitespace between the rail and the label, as in iconLabelNode. */}{' '}
|
|
1661
1668
|
{/* The on-track indicator remains visible as a node on the rail at
|
|
1662
1669
|
compact widths, but the wrapper becomes presentational with its
|
|
1663
1670
|
label. Navigation moves to the named controls in the summary row. */}
|
|
@@ -2016,3 +2016,36 @@ describe('step-label and step-description theme targets', () => {
|
|
|
2016
2016
|
);
|
|
2017
2017
|
});
|
|
2018
2018
|
});
|
|
2019
|
+
|
|
2020
|
+
describe('clickable step text reading', () => {
|
|
2021
|
+
// axe-core's Label in Name rule joins a button's text nodes with nothing
|
|
2022
|
+
// between them, aria-hidden ones included, so a number badge next to a label
|
|
2023
|
+
// reads as one word ("1Account") that the step's name does not contain.
|
|
2024
|
+
// Whitespace between them changes nothing on screen (the rows are flex
|
|
2025
|
+
// containers) and keeps the two words apart.
|
|
2026
|
+
it.each([
|
|
2027
|
+
['vertical', 'separated'],
|
|
2028
|
+
['horizontal', 'separated'],
|
|
2029
|
+
['vertical', 'on-track'],
|
|
2030
|
+
['horizontal', 'on-track'],
|
|
2031
|
+
] as const)(
|
|
2032
|
+
'keeps the number and label apart in a %s %s step',
|
|
2033
|
+
(orientation, indicatorPosition) => {
|
|
2034
|
+
render(
|
|
2035
|
+
<Stepper
|
|
2036
|
+
orientation={orientation}
|
|
2037
|
+
indicatorPosition={indicatorPosition}
|
|
2038
|
+
activeStep={0}
|
|
2039
|
+
label="Steps"
|
|
2040
|
+
onStepClick={() => {}}>
|
|
2041
|
+
<Step step={0} label="Account" indicator="number" />
|
|
2042
|
+
<Step step={1} label="Payment" indicator="number" />
|
|
2043
|
+
</Stepper>,
|
|
2044
|
+
);
|
|
2045
|
+
|
|
2046
|
+
const button = screen.getByRole('button', {name: /Account/});
|
|
2047
|
+
expect(button.textContent).toMatch(/1\s+Account/);
|
|
2048
|
+
expect(button.textContent).not.toMatch(/1Account/);
|
|
2049
|
+
},
|
|
2050
|
+
);
|
|
2051
|
+
});
|
|
@@ -151,14 +151,14 @@ export const docs = {
|
|
|
151
151
|
name: 'isReadOnly',
|
|
152
152
|
type: 'boolean',
|
|
153
153
|
description:
|
|
154
|
-
'Makes the textarea read-only: the value is shown at full opacity and still submits with the form, but cannot be edited. Unlike isDisabled, a read-only textarea is not dimmed and
|
|
154
|
+
'Makes the textarea read-only: the value is shown at full opacity and still submits with the form, but cannot be edited. Unlike isDisabled, a read-only textarea is not dimmed and keeps its form value. isDisabled takes precedence when both are set.',
|
|
155
155
|
default: 'false',
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
name: 'disabledMessage',
|
|
159
159
|
type: 'string',
|
|
160
160
|
description:
|
|
161
|
-
'Explains why the textarea is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the textarea focusable via aria-disabled (the field becomes read-only). Use this instead of wrapping a disabled TextArea in Tooltip
|
|
161
|
+
'Explains why the textarea is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the textarea focusable via aria-disabled (the field becomes read-only). Use this instead of wrapping a disabled TextArea in Tooltip, so the reason is attached to the field itself.',
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
name: 'isLoading',
|
|
@@ -364,7 +364,7 @@ export const docs = {
|
|
|
364
364
|
{
|
|
365
365
|
guidance: false,
|
|
366
366
|
description:
|
|
367
|
-
"Don't wrap a disabled TextArea in Tooltip to explain why it's disabled
|
|
367
|
+
"Don't wrap a disabled TextArea in Tooltip to explain why it's disabled. Use the disabledMessage prop, which attaches the reason to the field itself.",
|
|
368
368
|
},
|
|
369
369
|
],
|
|
370
370
|
},
|
|
@@ -437,7 +437,7 @@ export const docsZh = {
|
|
|
437
437
|
name: 'isReadOnly',
|
|
438
438
|
type: 'boolean',
|
|
439
439
|
description:
|
|
440
|
-
'将文本域设为只读:值以完整不透明度显示并仍随表单提交,但无法编辑。与 isDisabled
|
|
440
|
+
'将文本域设为只读:值以完整不透明度显示并仍随表单提交,但无法编辑。与 isDisabled 不同,只读文本域不会变暗,并保留其表单值。同时设置时 isDisabled 优先。',
|
|
441
441
|
default: 'false',
|
|
442
442
|
},
|
|
443
443
|
{
|
|
@@ -637,7 +637,7 @@ export const docsZh = {
|
|
|
637
637
|
{
|
|
638
638
|
guidance: false,
|
|
639
639
|
description:
|
|
640
|
-
"Don't wrap a disabled TextArea in Tooltip to explain why it's disabled
|
|
640
|
+
"Don't wrap a disabled TextArea in Tooltip to explain why it's disabled. Use the disabledMessage prop, which attaches the reason to the field itself.",
|
|
641
641
|
},
|
|
642
642
|
],
|
|
643
643
|
},
|
|
@@ -710,7 +710,7 @@ export const docsDense = {
|
|
|
710
710
|
'Shows "Required" indicator+sets aria-required. Mutually exclusive w/ isOptional.',
|
|
711
711
|
isDisabled: 'Disables textarea, prevents interaction.',
|
|
712
712
|
isReadOnly:
|
|
713
|
-
'Read-only: value visible + still submits, but not editable. Unlike isDisabled: not dimmed
|
|
713
|
+
'Read-only: value visible + still submits, but not editable. Unlike isDisabled: not dimmed.',
|
|
714
714
|
disabledMessage:
|
|
715
715
|
'Explains why textarea is disabled. With isDisabled, shows tooltip on hover/focus + keeps textarea focusable via aria-disabled (field becomes read-only). Use instead of wrapping a disabled TextArea in Tooltip.',
|
|
716
716
|
isLoading: 'Loading state w/ spinner inside input.',
|
|
@@ -13,10 +13,27 @@ import {useState} from 'react';
|
|
|
13
13
|
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
|
|
14
14
|
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
|
|
15
15
|
import userEvent from '@testing-library/user-event';
|
|
16
|
+
import * as stylex from '@stylexjs/stylex';
|
|
17
|
+
import {colorVars} from '../theme/tokens.stylex';
|
|
16
18
|
import {TestIcon} from '../__tests__/TestIcon';
|
|
17
19
|
import {TextArea} from './TextArea';
|
|
18
20
|
import {__resetLiveRegionsForTest} from '../hooks/useAnnounce';
|
|
19
21
|
|
|
22
|
+
// jsdom cannot match `:focus-visible`: compare the ring's StyleX class hash.
|
|
23
|
+
const RING = stylex
|
|
24
|
+
.props(
|
|
25
|
+
stylex.create({
|
|
26
|
+
ring: {
|
|
27
|
+
boxShadow: {
|
|
28
|
+
default: null,
|
|
29
|
+
':has(> [aria-disabled="true"]:focus-visible)': `inset 0px 0px 0px 2px ${colorVars['--color-accent-muted']}`,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}).ring,
|
|
33
|
+
)
|
|
34
|
+
.className!.split(' ')
|
|
35
|
+
.pop()!;
|
|
36
|
+
|
|
20
37
|
// FieldStatus announces status messages through the persistent useAnnounce
|
|
21
38
|
// singletons; remove them between tests so role/aria-live queries in this
|
|
22
39
|
// file never match a leftover region.
|
|
@@ -166,11 +183,50 @@ describe('TextArea', () => {
|
|
|
166
183
|
expect(screen.getByRole('textbox')).toHaveAttribute('rows', '3');
|
|
167
184
|
});
|
|
168
185
|
|
|
169
|
-
it('
|
|
186
|
+
it('exposes aria-disabled and read-only, not native disabled, when isDisabled is true', () => {
|
|
170
187
|
render(
|
|
171
188
|
<TextArea label="Description" isDisabled value="" onChange={() => {}} />,
|
|
172
189
|
);
|
|
173
|
-
|
|
190
|
+
const textarea = screen.getByRole('textbox');
|
|
191
|
+
expect(textarea).not.toBeDisabled();
|
|
192
|
+
expect(textarea).toHaveAttribute('aria-disabled', 'true');
|
|
193
|
+
expect(textarea).toHaveAttribute('readonly');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('keeps a disabled textarea in the tab order (spec:AST-085)', async () => {
|
|
197
|
+
const user = userEvent.setup();
|
|
198
|
+
render(
|
|
199
|
+
<>
|
|
200
|
+
<TextArea label="First" value="" onChange={() => {}} />
|
|
201
|
+
<TextArea label="Second" isDisabled value="" onChange={() => {}} />
|
|
202
|
+
<TextArea label="Third" value="" onChange={() => {}} />
|
|
203
|
+
</>,
|
|
204
|
+
);
|
|
205
|
+
await user.tab();
|
|
206
|
+
await user.tab();
|
|
207
|
+
expect(screen.getByRole('textbox', {name: 'Second'})).toHaveFocus();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('runs no caller handler from a disabled textarea and rings it under focus (spec:AST-085 FR2, FR6)', async () => {
|
|
211
|
+
const user = userEvent.setup();
|
|
212
|
+
const handlers = {onPaste: vi.fn(), onKeyDown: vi.fn()};
|
|
213
|
+
render(
|
|
214
|
+
<TextArea
|
|
215
|
+
label="Notes"
|
|
216
|
+
isDisabled
|
|
217
|
+
value=""
|
|
218
|
+
onChange={() => {}}
|
|
219
|
+
{...handlers}
|
|
220
|
+
/>,
|
|
221
|
+
);
|
|
222
|
+
const textarea = screen.getByRole('textbox');
|
|
223
|
+
await user.click(textarea);
|
|
224
|
+
await user.keyboard('a');
|
|
225
|
+
await user.paste('x');
|
|
226
|
+
for (const handler of Object.values(handlers)) {
|
|
227
|
+
expect(handler).not.toHaveBeenCalled();
|
|
228
|
+
}
|
|
229
|
+
expect(textarea.parentElement).toHaveClass(RING);
|
|
174
230
|
});
|
|
175
231
|
|
|
176
232
|
it('is not disabled by default', () => {
|
|
@@ -872,7 +928,10 @@ describe('TextArea', () => {
|
|
|
872
928
|
/>
|
|
873
929
|
</form>,
|
|
874
930
|
);
|
|
875
|
-
expect(screen.getByRole('textbox')).
|
|
931
|
+
expect(screen.getByRole('textbox')).toHaveAttribute(
|
|
932
|
+
'aria-disabled',
|
|
933
|
+
'true',
|
|
934
|
+
);
|
|
876
935
|
expect([
|
|
877
936
|
...new FormData(container.querySelector('form')!).keys(),
|
|
878
937
|
]).toEqual([]);
|
|
@@ -1049,13 +1108,13 @@ describe('TextArea', () => {
|
|
|
1049
1108
|
expect(textarea).toHaveValue('');
|
|
1050
1109
|
});
|
|
1051
1110
|
|
|
1052
|
-
it('
|
|
1111
|
+
it('stays focusable when disabled without a reason', () => {
|
|
1053
1112
|
render(
|
|
1054
1113
|
<TextArea label="Notes" value="" onChange={() => {}} isDisabled />,
|
|
1055
1114
|
);
|
|
1056
1115
|
const textarea = screen.getByRole('textbox');
|
|
1057
|
-
expect(textarea).toBeDisabled();
|
|
1058
|
-
expect(textarea).
|
|
1116
|
+
expect(textarea).not.toBeDisabled();
|
|
1117
|
+
expect(textarea).toHaveAttribute('aria-disabled', 'true');
|
|
1059
1118
|
});
|
|
1060
1119
|
});
|
|
1061
1120
|
});
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
type FieldInputBaseProps,
|
|
53
53
|
useFieldInputStyling,
|
|
54
54
|
} from '../Field/fieldParts';
|
|
55
|
+
import {inputDisabledFocusStyles} from '../Field/inputDisabledFocus';
|
|
55
56
|
import type {SizeValue} from '../utils/types';
|
|
56
57
|
import {useInputContainer} from '../hooks/useInputContainer';
|
|
57
58
|
import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
@@ -253,7 +254,9 @@ export interface TextAreaProps extends Omit<
|
|
|
253
254
|
*/
|
|
254
255
|
rows?: number;
|
|
255
256
|
/**
|
|
256
|
-
* Whether the textarea is disabled.
|
|
257
|
+
* Whether the textarea is disabled. A disabled textarea is dimmed, cannot be
|
|
258
|
+
* edited, and is left out of form submission, but it stays in the tab order
|
|
259
|
+
* (`aria-disabled`, not the native attribute).
|
|
257
260
|
* @default false
|
|
258
261
|
*/
|
|
259
262
|
isDisabled?: boolean;
|
|
@@ -261,7 +264,7 @@ export interface TextAreaProps extends Omit<
|
|
|
261
264
|
* Whether the textarea is read-only.
|
|
262
265
|
* The value is shown at full opacity and still submits with the form, but
|
|
263
266
|
* cannot be edited. Unlike `isDisabled`, a read-only textarea is not dimmed
|
|
264
|
-
* and
|
|
267
|
+
* and keeps its form value — use it for a value the user should see and
|
|
265
268
|
* send but not change. `isDisabled` takes precedence when both are set.
|
|
266
269
|
* @default false
|
|
267
270
|
*/
|
|
@@ -273,8 +276,8 @@ export interface TextAreaProps extends Omit<
|
|
|
273
276
|
* discoverable by keyboard and assistive technology. The field cannot be
|
|
274
277
|
* edited (it becomes read-only) while disabled.
|
|
275
278
|
*
|
|
276
|
-
* Use this instead of wrapping a disabled textarea in `Tooltip
|
|
277
|
-
*
|
|
279
|
+
* Use this instead of wrapping a disabled textarea in `Tooltip`, so the
|
|
280
|
+
* reason is attached to the field itself.
|
|
278
281
|
*
|
|
279
282
|
* @example
|
|
280
283
|
* ```
|
|
@@ -443,12 +446,20 @@ export function TextArea({
|
|
|
443
446
|
// (spec:AST-086 FR8).
|
|
444
447
|
useBusyAnnouncement(isBusy, t('@astryx.spinner.loading'), containerRef);
|
|
445
448
|
|
|
446
|
-
// Disabled-reason tooltip.
|
|
447
|
-
// tooltip listeners attach to the textarea container (which already exists)
|
|
449
|
+
// Disabled-reason tooltip. The tooltip listeners attach to the textarea container (which already exists)
|
|
448
450
|
// and the textarea stays perceivable via aria-disabled instead of the native
|
|
449
451
|
// disabled attribute. The field is made read-only so it can't be typed into,
|
|
450
452
|
// and value mutation is blocked by the isDisabled guard in handleChange.
|
|
451
453
|
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
454
|
+
// A disabled field keeps its tab stop but, like a natively disabled one,
|
|
455
|
+
// runs no caller event handler other than focus and blur (`spec:AST-085` FR2).
|
|
456
|
+
const fieldProps = isDisabled
|
|
457
|
+
? Object.fromEntries(
|
|
458
|
+
Object.entries(rest).filter(
|
|
459
|
+
([key]) => !/^on[A-Z]/.test(key) || /^on(Focus|Blur)/.test(key),
|
|
460
|
+
),
|
|
461
|
+
)
|
|
462
|
+
: rest;
|
|
452
463
|
const disabledMessageTooltip = useTooltip({
|
|
453
464
|
placement: 'above',
|
|
454
465
|
// The container div is not naturally focusable; focusin bubbles up from
|
|
@@ -598,6 +609,7 @@ export function TextArea({
|
|
|
598
609
|
inputWrapperStyles.base,
|
|
599
610
|
styles.wrapper,
|
|
600
611
|
isDisabled && inputWrapperStyles.disabled,
|
|
612
|
+
isDisabled && inputDisabledFocusStyles.ring,
|
|
601
613
|
status && inputStatusBorderStyles[status.type],
|
|
602
614
|
status && !isDisabled && inputStatusHoverShadowStyles[status.type],
|
|
603
615
|
status && inputStatusFocusWithinStyles[status.type],
|
|
@@ -612,23 +624,23 @@ export function TextArea({
|
|
|
612
624
|
</span>
|
|
613
625
|
)}
|
|
614
626
|
<textarea
|
|
615
|
-
{...
|
|
627
|
+
{...fieldProps}
|
|
616
628
|
ref={useMergedRefs(ref, textareaRef)}
|
|
617
629
|
id={id}
|
|
618
630
|
name={isDisabled ? undefined : htmlName}
|
|
619
631
|
value={optimisticValue}
|
|
620
632
|
onChange={handleChange}
|
|
621
|
-
onPaste={onPaste}
|
|
633
|
+
onPaste={isDisabled ? undefined : onPaste}
|
|
622
634
|
onFocus={onFocus}
|
|
623
635
|
onBlur={onBlur}
|
|
624
636
|
placeholder={placeholder}
|
|
625
637
|
rows={rows}
|
|
626
|
-
//
|
|
627
|
-
// aria-disabled
|
|
628
|
-
// handleChange guard
|
|
629
|
-
|
|
630
|
-
aria-disabled={
|
|
631
|
-
readOnly={isReadOnly ||
|
|
638
|
+
// A disabled textarea keeps its place in the tab order
|
|
639
|
+
// (spec:AST-085): aria-disabled instead of the native attribute,
|
|
640
|
+
// with readOnly + the handleChange guard keeping the value from
|
|
641
|
+
// changing.
|
|
642
|
+
aria-disabled={isDisabled ? 'true' : undefined}
|
|
643
|
+
readOnly={isReadOnly || isDisabled || undefined}
|
|
632
644
|
spellCheck={hasSpellCheck}
|
|
633
645
|
autoFocus={hasAutoFocus}
|
|
634
646
|
data-autofocus={hasAutoFocus || undefined}
|
|
@@ -93,14 +93,14 @@ export const docs = {
|
|
|
93
93
|
name: 'isReadOnly',
|
|
94
94
|
type: 'boolean',
|
|
95
95
|
description:
|
|
96
|
-
'Makes the input read-only: the value is shown at full opacity and still submits with the form, but cannot be edited. Unlike isDisabled, a read-only input is not dimmed and
|
|
96
|
+
'Makes the input read-only: the value is shown at full opacity and still submits with the form, but cannot be edited. Unlike isDisabled, a read-only input is not dimmed and keeps its form value. isDisabled takes precedence when both are set.',
|
|
97
97
|
default: 'false',
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
name: 'disabledMessage',
|
|
101
101
|
type: 'string',
|
|
102
102
|
description:
|
|
103
|
-
'Explains why the input is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the input focusable via aria-disabled (the field becomes read-only). Use this instead of wrapping a disabled TextInput in Tooltip
|
|
103
|
+
'Explains why the input is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the input focusable via aria-disabled (the field becomes read-only). Use this instead of wrapping a disabled TextInput in Tooltip, so the reason is attached to the field itself.',
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
name: 'isLoading',
|
|
@@ -219,7 +219,7 @@ export const docs = {
|
|
|
219
219
|
{guidance: false, description: "Don't use placeholder text as a replacement for a label; placeholders disappear on focus and are not reliably read by screen readers."},
|
|
220
220
|
{guidance: false, description: "Don't use TextInput for multi-line content like comments or descriptions; use TextArea instead."},
|
|
221
221
|
{guidance: false, description: "Don't mark every field as required; only flag mandatory fields so users are not overwhelmed by validation errors."},
|
|
222
|
-
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled
|
|
222
|
+
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled. Use the disabledMessage prop, which attaches the reason to the field itself."},
|
|
223
223
|
],
|
|
224
224
|
anatomy: [
|
|
225
225
|
{name: 'Label', required: true, description: 'Text that identifies the field. Always rendered for accessibility even when visually hidden.'},
|
|
@@ -311,14 +311,14 @@ export const docsZh = {
|
|
|
311
311
|
name: 'isReadOnly',
|
|
312
312
|
type: 'boolean',
|
|
313
313
|
description:
|
|
314
|
-
'将输入框设为只读:值以完整不透明度显示并仍随表单提交,但无法编辑。与 isDisabled
|
|
314
|
+
'将输入框设为只读:值以完整不透明度显示并仍随表单提交,但无法编辑。与 isDisabled 不同,只读输入框不会变暗,并保留其表单值。同时设置时 isDisabled 优先。',
|
|
315
315
|
default: 'false',
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
name: 'disabledMessage',
|
|
319
319
|
type: 'string',
|
|
320
320
|
description:
|
|
321
|
-
'说明输入框被禁用的原因。与 isDisabled 一起使用时,在悬停/键盘聚焦时显示工具提示,并通过 aria-disabled 保持输入框可聚焦(字段变为只读)。请使用此属性,而不是用 Tooltip 包裹已禁用的 TextInput
|
|
321
|
+
'说明输入框被禁用的原因。与 isDisabled 一起使用时,在悬停/键盘聚焦时显示工具提示,并通过 aria-disabled 保持输入框可聚焦(字段变为只读)。请使用此属性,而不是用 Tooltip 包裹已禁用的 TextInput,以便把原因附加在字段本身上。',
|
|
322
322
|
},
|
|
323
323
|
{
|
|
324
324
|
name: 'isLoading',
|
|
@@ -430,7 +430,7 @@ export const docsZh = {
|
|
|
430
430
|
{guidance: false, description: "Don't use placeholder text as a replacement for a label; placeholders disappear on focus and are not reliably read by screen readers."},
|
|
431
431
|
{guidance: false, description: "Don't use TextInput for multi-line content like comments or descriptions; use TextArea instead."},
|
|
432
432
|
{guidance: false, description: "Don't mark every field as required; only flag mandatory fields so users are not overwhelmed by validation errors."},
|
|
433
|
-
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled
|
|
433
|
+
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled. Use the disabledMessage prop, which attaches the reason to the field itself."},
|
|
434
434
|
],
|
|
435
435
|
anatomy: [
|
|
436
436
|
{name: 'Label', required: true, description: 'Text that identifies the field. Always rendered for accessibility even when visually hidden.'},
|
|
@@ -458,7 +458,7 @@ export const docsDense = {
|
|
|
458
458
|
{guidance: false, description: "Don't use placeholder text as a replacement for a label; placeholders disappear on focus and are not reliably read by screen readers."},
|
|
459
459
|
{guidance: false, description: "Don't use TextInput for multi-line content like comments or descriptions; use TextArea instead."},
|
|
460
460
|
{guidance: false, description: "Don't mark every field as required; only flag mandatory fields so users are not overwhelmed by validation errors."},
|
|
461
|
-
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled
|
|
461
|
+
{guidance: false, description: "Don't wrap a disabled TextInput in Tooltip to explain why it's disabled. Use the disabledMessage prop, which attaches the reason to the field itself."},
|
|
462
462
|
],
|
|
463
463
|
anatomy: [
|
|
464
464
|
{name: 'Label', required: true, description: 'Text that identifies the field. Always rendered for accessibility even when visually hidden.'},
|
|
@@ -489,7 +489,7 @@ export const docsDense = {
|
|
|
489
489
|
isRequired: 'Shows "Required" indicator+sets aria-required. Mutually exclusive w/ isOptional.',
|
|
490
490
|
isDisabled: 'Disables input, prevents interaction, dims element.',
|
|
491
491
|
isReadOnly:
|
|
492
|
-
'Read-only: value visible + still submits, but not editable. Unlike isDisabled: not dimmed
|
|
492
|
+
'Read-only: value visible + still submits, but not editable. Unlike isDisabled: not dimmed.',
|
|
493
493
|
disabledMessage:
|
|
494
494
|
'Explains why input is disabled. With isDisabled, shows tooltip on hover/focus + keeps input focusable via aria-disabled (field becomes read-only). Use instead of wrapping a disabled TextInput in Tooltip.',
|
|
495
495
|
isLoading: 'Loading state w/ spinner+aria-busy.',
|
|
@@ -13,11 +13,28 @@
|
|
|
13
13
|
import {describe, it, expect, vi, beforeEach} from 'vitest';
|
|
14
14
|
import {render, screen, fireEvent, waitFor} from '@testing-library/react';
|
|
15
15
|
import userEvent from '@testing-library/user-event';
|
|
16
|
+
import * as stylex from '@stylexjs/stylex';
|
|
17
|
+
import {colorVars} from '../theme/tokens.stylex';
|
|
16
18
|
import {TestIcon} from '../__tests__/TestIcon';
|
|
17
19
|
import {declaredValue} from '../__tests__/stylexDeclarations';
|
|
18
20
|
import {InputGroup} from '../InputGroup';
|
|
19
21
|
import {TextInput} from './TextInput';
|
|
20
22
|
|
|
23
|
+
// jsdom cannot match `:focus-visible`: compare the ring's StyleX class hash.
|
|
24
|
+
const RING = stylex
|
|
25
|
+
.props(
|
|
26
|
+
stylex.create({
|
|
27
|
+
ring: {
|
|
28
|
+
boxShadow: {
|
|
29
|
+
default: null,
|
|
30
|
+
':has(> [aria-disabled="true"]:focus-visible)': `inset 0px 0px 0px 2px ${colorVars['--color-accent-muted']}`,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}).ring,
|
|
34
|
+
)
|
|
35
|
+
.className!.split(' ')
|
|
36
|
+
.pop()!;
|
|
37
|
+
|
|
21
38
|
// Mock showPopover/hidePopover since jsdom does not implement them. Used by the
|
|
22
39
|
// disabledMessage tooltip.
|
|
23
40
|
beforeEach(() => {
|
|
@@ -138,9 +155,55 @@ describe('TextInput', () => {
|
|
|
138
155
|
expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-required');
|
|
139
156
|
});
|
|
140
157
|
|
|
141
|
-
it('
|
|
158
|
+
it('exposes aria-disabled and read-only, not native disabled, when isDisabled is true', () => {
|
|
142
159
|
render(<TextInput label="Name" isDisabled value="" onChange={() => {}} />);
|
|
143
|
-
|
|
160
|
+
const input = screen.getByRole('textbox');
|
|
161
|
+
expect(input).not.toBeDisabled();
|
|
162
|
+
expect(input).toHaveAttribute('aria-disabled', 'true');
|
|
163
|
+
expect(input).toHaveAttribute('readonly');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('keeps a disabled input in the tab order (spec:AST-085)', async () => {
|
|
167
|
+
const user = userEvent.setup();
|
|
168
|
+
render(
|
|
169
|
+
<>
|
|
170
|
+
<TextInput label="First" value="" onChange={() => {}} />
|
|
171
|
+
<TextInput label="Second" isDisabled value="" onChange={() => {}} />
|
|
172
|
+
<TextInput label="Third" value="" onChange={() => {}} />
|
|
173
|
+
</>,
|
|
174
|
+
);
|
|
175
|
+
await user.tab();
|
|
176
|
+
await user.tab();
|
|
177
|
+
expect(screen.getByRole('textbox', {name: 'Second'})).toHaveFocus();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('runs no caller handler and submits no form from a disabled input (spec:AST-085 FR2)', async () => {
|
|
181
|
+
const user = userEvent.setup();
|
|
182
|
+
const handlers = {onEnter: vi.fn(), onKeyDown: vi.fn(), onPaste: vi.fn()};
|
|
183
|
+
const onSubmit = vi.fn((e: React.FormEvent) => e.preventDefault());
|
|
184
|
+
render(
|
|
185
|
+
<form onSubmit={onSubmit}>
|
|
186
|
+
<TextInput
|
|
187
|
+
label="Name"
|
|
188
|
+
isDisabled
|
|
189
|
+
value=""
|
|
190
|
+
onChange={() => {}}
|
|
191
|
+
{...handlers}
|
|
192
|
+
/>
|
|
193
|
+
</form>,
|
|
194
|
+
);
|
|
195
|
+
await user.click(screen.getByRole('textbox'));
|
|
196
|
+
await user.keyboard('{Enter}');
|
|
197
|
+
await user.paste('x');
|
|
198
|
+
for (const handler of [...Object.values(handlers), onSubmit]) {
|
|
199
|
+
expect(handler).not.toHaveBeenCalled();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('rings a disabled input under keyboard focus (spec:AST-085 FR6)', () => {
|
|
204
|
+
render(<TextInput label="Name" isDisabled value="" onChange={() => {}} />);
|
|
205
|
+
const wrapper = screen.getByRole('textbox').parentElement!;
|
|
206
|
+
expect(wrapper).toHaveClass(RING);
|
|
144
207
|
});
|
|
145
208
|
|
|
146
209
|
it('does not fire onChange when disabled', async () => {
|
|
@@ -515,7 +578,10 @@ describe('TextInput', () => {
|
|
|
515
578
|
/>
|
|
516
579
|
</form>,
|
|
517
580
|
);
|
|
518
|
-
expect(screen.getByRole('textbox')).
|
|
581
|
+
expect(screen.getByRole('textbox')).toHaveAttribute(
|
|
582
|
+
'aria-disabled',
|
|
583
|
+
'true',
|
|
584
|
+
);
|
|
519
585
|
expect([
|
|
520
586
|
...new FormData(container.querySelector('form')!).keys(),
|
|
521
587
|
]).toEqual([]);
|
|
@@ -888,13 +954,13 @@ describe('TextInput', () => {
|
|
|
888
954
|
expect(input).toHaveValue('');
|
|
889
955
|
});
|
|
890
956
|
|
|
891
|
-
it('
|
|
957
|
+
it('stays focusable when disabled without a reason', () => {
|
|
892
958
|
render(
|
|
893
959
|
<TextInput label="Owner" value="" onChange={() => {}} isDisabled />,
|
|
894
960
|
);
|
|
895
961
|
const input = screen.getByRole('textbox');
|
|
896
|
-
expect(input).toBeDisabled();
|
|
897
|
-
expect(input).
|
|
962
|
+
expect(input).not.toBeDisabled();
|
|
963
|
+
expect(input).toHaveAttribute('aria-disabled', 'true');
|
|
898
964
|
});
|
|
899
965
|
});
|
|
900
966
|
});
|
|
@@ -1093,8 +1159,12 @@ describe('TextInput clear button focus behavior', () => {
|
|
|
1093
1159
|
expect(document.activeElement).toBe(input);
|
|
1094
1160
|
});
|
|
1095
1161
|
|
|
1096
|
-
it('
|
|
1162
|
+
it('focuses the input inside the tap on pointer activation, without scrolling', () => {
|
|
1163
|
+
// iOS Safari brings up its keyboard only for a focus made while handling
|
|
1164
|
+
// the touch: a deferred focus would leave an unfocused field focused but
|
|
1165
|
+
// keyboardless.
|
|
1097
1166
|
const handleChange = vi.fn();
|
|
1167
|
+
const focusSpy = vi.spyOn(HTMLElement.prototype, 'focus');
|
|
1098
1168
|
const rafSpy = vi.spyOn(window, 'requestAnimationFrame');
|
|
1099
1169
|
render(
|
|
1100
1170
|
<TextInput
|
|
@@ -1104,14 +1174,17 @@ describe('TextInput clear button focus behavior', () => {
|
|
|
1104
1174
|
onChange={handleChange}
|
|
1105
1175
|
/>,
|
|
1106
1176
|
);
|
|
1107
|
-
|
|
1177
|
+
const input = screen.getByRole('textbox');
|
|
1108
1178
|
const clearButton = screen.getByRole('button', {name: /clear/i});
|
|
1179
|
+
expect(document.activeElement).not.toBe(input);
|
|
1109
1180
|
|
|
1110
|
-
// Pointer activation (detail > 0)
|
|
1111
1181
|
fireEvent.click(clearButton, {detail: 1});
|
|
1112
1182
|
|
|
1113
1183
|
expect(handleChange).toHaveBeenCalledWith('', expect.any(Object));
|
|
1114
|
-
expect(
|
|
1184
|
+
expect(document.activeElement).toBe(input);
|
|
1185
|
+
expect(focusSpy).toHaveBeenLastCalledWith({preventScroll: true});
|
|
1186
|
+
expect(rafSpy).not.toHaveBeenCalled();
|
|
1187
|
+
focusSpy.mockRestore();
|
|
1115
1188
|
rafSpy.mockRestore();
|
|
1116
1189
|
});
|
|
1117
1190
|
});
|