@astryxdesign/core 0.1.9 → 0.2.0-canary.0e01213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/dist/Avatar/Avatar.d.ts +42 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +190 -59
- package/dist/Avatar/AvatarStatusDot.d.ts +6 -4
- package/dist/Avatar/AvatarStatusDot.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +7 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +58 -6
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +7 -2
- package/dist/Banner/Banner.js +2 -2
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +11 -4
- package/dist/Breadcrumbs/index.d.ts +1 -0
- package/dist/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/Breadcrumbs/index.js +2 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +6 -4
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +50 -9
- package/dist/Calendar/dayCellUtils.d.ts +4 -4
- package/dist/Calendar/dayCellUtils.js +2 -2
- package/dist/Calendar/styles.d.ts +30 -31
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +30 -31
- package/dist/Card/Card.js +1 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +22 -12
- package/dist/Center/Center.d.ts +20 -3
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +10 -2
- package/dist/Chat/ChatComposerInput.js +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +3 -1
- package/dist/Chat/ChatLayout.d.ts +7 -0
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +16 -5
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +8 -8
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +10 -3
- package/dist/Chat/useTriggerMenu.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +6 -6
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +19 -4
- package/dist/Citation/Citation.d.ts +22 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +20 -6
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +16 -10
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +3 -1
- package/dist/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +42 -3
- package/dist/CommandPalette/CommandPaletteItem.js +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +23 -5
- package/dist/ContextMenu/index.d.ts +1 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +3 -1
- package/dist/DateInput/DateInput.d.ts +10 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +33 -19
- package/dist/DateRangeInput/DateRangeInput.d.ts +10 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +23 -20
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +23 -18
- package/dist/Divider/Divider.d.ts +2 -2
- package/dist/Divider/Divider.d.ts.map +1 -1
- package/dist/Divider/Divider.js +13 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +6 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +22 -5
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +18 -12
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +42 -64
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +5 -2
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +8 -11
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +3 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +10 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +104 -0
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +435 -0
- package/dist/DropdownMenu/index.d.ts +10 -0
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +13 -0
- package/dist/DropdownMenu/menuItemHover.d.ts +24 -0
- package/dist/DropdownMenu/menuItemHover.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemHover.js +34 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts +8 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -1
- package/dist/DropdownMenu/menuItemRoles.js +10 -1
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +27 -10
- package/dist/Field/Field.d.ts +3 -1
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +4 -1
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -5
- package/dist/Field/inputStyles.stylex.d.ts +1 -0
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +1 -0
- package/dist/FieldStatus/FieldStatus.d.ts +10 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +51 -5
- package/dist/FileInput/FileInput.d.ts +10 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +93 -65
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +3 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -4
- package/dist/Icon/Icon.d.ts +15 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +19 -3
- package/dist/Item/Item.d.ts +16 -3
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +31 -6
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +10 -2
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +34 -15
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +6 -3
- package/dist/List/ListItem.d.ts +11 -1
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +2 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +1 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +4 -2
- package/dist/MultiSelector/MultiSelector.d.ts +9 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +87 -45
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -1
- package/dist/NumberInput/NumberInput.d.ts +10 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +22 -17
- package/dist/Outline/Outline.js +2 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +11 -3
- package/dist/PowerSearch/PowerSearch.d.ts +9 -2
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +2 -0
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +6 -1
- package/dist/RadioList/RadioList.d.ts +2 -2
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -5
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +49 -19
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -3
- package/dist/Selector/Selector.d.ts +8 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +72 -19
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +5 -5
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +13 -10
- package/dist/SideNav/SideNavItem.d.ts +1 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +12 -10
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +2 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +87 -34
- package/dist/Spinner/Spinner.d.ts +3 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +11 -2
- package/dist/Switch/Switch.d.ts +8 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +171 -91
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts +2 -11
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +5 -9
- package/dist/TabList/TabListContext.d.ts +0 -5
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +0 -5
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +30 -4
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +15 -11
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +18 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +58 -30
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +3 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +15 -7
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +65 -25
- package/dist/Table/types.d.ts +32 -0
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Text/Text.d.ts +10 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +25 -2
- package/dist/Text/index.d.ts +2 -2
- package/dist/Text/index.d.ts.map +1 -1
- package/dist/TextArea/TextArea.d.ts +10 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +119 -52
- package/dist/TextInput/TextInput.d.ts +10 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +20 -17
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +51 -45
- package/dist/TimeInput/TimeInput.d.ts +10 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +17 -17
- package/dist/Timestamp/Timestamp.d.ts +31 -3
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +48 -77
- package/dist/Timestamp/formatInstant.d.ts +41 -0
- package/dist/Timestamp/formatInstant.d.ts.map +1 -0
- package/dist/Timestamp/formatInstant.js +177 -0
- package/dist/Timestamp/index.d.ts +1 -0
- package/dist/Timestamp/index.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.d.ts +56 -0
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -0
- package/dist/Timestamp/tooltipEntries.js +163 -0
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +61 -9
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +3 -1
- package/dist/Token/Token.d.ts +34 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +85 -45
- package/dist/Token/TokenLink.d.ts +62 -0
- package/dist/Token/TokenLink.d.ts.map +1 -0
- package/dist/Token/TokenLink.js +76 -0
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.d.ts +9 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +4 -2
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +17 -1
- package/dist/TopNav/TopNavItem.d.ts +3 -1
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +30 -3
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +9 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +1 -0
- package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
- package/dist/TreeList/TreeListBranches.js +8 -6
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +32 -14
- package/dist/Typeahead/BaseTypeahead.d.ts +9 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +22 -11
- package/dist/Typeahead/Typeahead.d.ts +9 -2
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +11 -2
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/Typeahead/TypeaheadItem.js +20 -10
- package/dist/astryx.css +115 -35
- package/dist/astryx.umd.js +51 -51
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/containerReveal.pool.stylex.d.ts +281 -0
- package/dist/hooks/containerReveal.pool.stylex.d.ts.map +1 -0
- package/dist/hooks/containerReveal.pool.stylex.js +281 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/isRtlElement.d.ts +18 -0
- package/dist/hooks/isRtlElement.d.ts.map +1 -0
- package/dist/hooks/isRtlElement.js +27 -0
- package/dist/hooks/useAnnounce.d.ts +3 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +39 -1
- package/dist/hooks/useContainerReveal.d.ts +83 -0
- package/dist/hooks/useContainerReveal.d.ts.map +1 -0
- package/dist/hooks/useContainerReveal.js +123 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +52 -11
- package/dist/hooks/useGridFocus.d.ts +6 -1
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +12 -9
- package/dist/hooks/useHotkeys.d.ts +9 -0
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +9 -0
- package/dist/hooks/useInputStatusIcon.d.ts +38 -0
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -0
- package/dist/hooks/useInputStatusIcon.js +169 -0
- package/dist/hooks/useKeyboardHint.d.ts +1 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +4 -2
- package/dist/hooks/useListFocus.d.ts +39 -1
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +54 -9
- package/dist/i18n/InternationalizationContext.d.ts +1 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -0
- package/dist/i18n/InternationalizationProvider.d.ts +8 -1
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +5 -1
- package/dist/i18n/getLocaleDirection.d.ts +18 -0
- package/dist/i18n/getLocaleDirection.d.ts.map +1 -0
- package/dist/i18n/getLocaleDirection.js +29 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +7 -1
- package/dist/i18n/useDirection.d.ts +2 -0
- package/dist/i18n/useDirection.d.ts.map +1 -0
- package/dist/i18n/useDirection.js +27 -0
- package/dist/theme/defineTheme.d.ts +6 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +13 -0
- package/dist/theme/expandColorScale.d.ts +19 -2
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +38 -10
- package/dist/theme/index.d.ts +3 -3
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/types.d.ts +39 -2
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/plainDate.d.ts +17 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +23 -4
- package/dist/utils/rtlStyles.d.ts +24 -0
- package/dist/utils/rtlStyles.d.ts.map +1 -0
- package/dist/utils/rtlStyles.js +27 -0
- package/locales/en.json +120 -0
- package/locales/pseudo.json +90 -0
- package/package.json +8 -3
- package/src/Avatar/Avatar.doc.mjs +50 -3
- package/src/Avatar/Avatar.test.tsx +218 -0
- package/src/Avatar/Avatar.tsx +285 -79
- package/src/Avatar/AvatarStatusDot.doc.mjs +4 -4
- package/src/Avatar/AvatarStatusDot.tsx +6 -4
- package/src/AvatarGroup/AvatarGroup.doc.mjs +2 -0
- package/src/AvatarGroup/AvatarGroup.test.tsx +162 -2
- package/src/AvatarGroup/AvatarGroup.tsx +58 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +5 -2
- package/src/Banner/Banner.tsx +6 -6
- package/src/Breadcrumbs/BreadcrumbItem.tsx +10 -10
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +52 -1
- package/src/Breadcrumbs/index.ts +4 -0
- package/src/Button/Button.doc.mjs +0 -4
- package/src/Button/Button.test.tsx +16 -0
- package/src/Button/Button.tsx +6 -4
- package/src/Calendar/Calendar.test.tsx +170 -20
- package/src/Calendar/Calendar.tsx +73 -16
- package/src/Calendar/dayCellUtils.test.ts +18 -18
- package/src/Calendar/dayCellUtils.ts +2 -2
- package/src/Calendar/styles.ts +33 -39
- package/src/Card/Card.tsx +1 -1
- package/src/Carousel/Carousel.tsx +25 -6
- package/src/Center/Center.doc.mjs +38 -0
- package/src/Center/Center.test.tsx +75 -0
- package/src/Center/Center.tsx +37 -2
- package/src/Chat/ChatComposer.doc.mjs +2 -2
- package/src/Chat/ChatComposerInput.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.tsx +2 -2
- package/src/Chat/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatLayout.test.tsx +57 -0
- package/src/Chat/ChatLayout.tsx +26 -5
- package/src/Chat/ChatMessageBubble.tsx +15 -10
- package/src/Chat/ChatSystemMessage.test.tsx +5 -0
- package/src/Chat/ChatToolCalls.tsx +9 -2
- package/src/Chat/useTriggerMenu.tsx +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +6 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +23 -0
- package/src/CheckboxInput/CheckboxInput.tsx +21 -6
- package/src/CheckboxList/CheckboxList.doc.mjs +6 -0
- package/src/CheckboxList/CheckboxList.test.tsx +94 -3
- package/src/CheckboxList/CheckboxListItem.tsx +17 -10
- package/src/Citation/Citation.doc.mjs +4 -3
- package/src/Citation/Citation.test.tsx +97 -0
- package/src/Citation/Citation.tsx +43 -11
- package/src/CodeBlock/CodeBlock.test.tsx +17 -0
- package/src/CodeBlock/CodeBlock.tsx +38 -11
- package/src/Collapsible/Collapsible.doc.mjs +1 -0
- package/src/Collapsible/Collapsible.test.tsx +7 -0
- package/src/Collapsible/Collapsible.tsx +16 -6
- package/src/CommandPalette/CommandPalette.test.tsx +95 -1
- package/src/CommandPalette/CommandPalette.tsx +41 -2
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -1
- package/src/ContextMenu/ContextMenu.test.tsx +59 -2
- package/src/ContextMenu/ContextMenu.tsx +22 -11
- package/src/ContextMenu/index.ts +5 -0
- package/src/DateInput/DateInput.doc.mjs +25 -0
- package/src/DateInput/DateInput.test.tsx +230 -0
- package/src/DateInput/DateInput.tsx +51 -29
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +140 -0
- package/src/DateRangeInput/DateRangeInput.tsx +42 -30
- package/src/DateTimeInput/DateTimeInput.doc.mjs +22 -1
- package/src/DateTimeInput/DateTimeInput.test.tsx +112 -0
- package/src/DateTimeInput/DateTimeInput.tsx +44 -39
- package/src/Divider/Divider.test.tsx +32 -8
- package/src/Divider/Divider.tsx +14 -1
- package/src/DropdownMenu/DropdownMenu.doc.mjs +5 -2
- package/src/DropdownMenu/DropdownMenu.test.tsx +95 -0
- package/src/DropdownMenu/DropdownMenu.tsx +31 -12
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +49 -66
- package/src/DropdownMenu/DropdownMenuItem.tsx +9 -3
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +4 -12
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +9 -10
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +19 -4
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +84 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +88 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +680 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +569 -0
- package/src/DropdownMenu/index.ts +16 -0
- package/src/DropdownMenu/menuItemHover.ts +40 -0
- package/src/DropdownMenu/menuItemRoles.ts +9 -0
- package/src/DropdownMenu/renderDropdownItems.tsx +40 -14
- package/src/Field/Field.doc.mjs +4 -0
- package/src/Field/Field.tsx +14 -9
- package/src/Field/FieldLabel.test.tsx +25 -0
- package/src/Field/FieldLabel.tsx +12 -3
- package/src/Field/inputStyles.stylex.ts +2 -0
- package/src/FieldStatus/FieldStatus.doc.mjs +1 -0
- package/src/FieldStatus/FieldStatus.test.tsx +133 -0
- package/src/FieldStatus/FieldStatus.tsx +61 -4
- package/src/FileInput/FileInput.doc.mjs +23 -2
- package/src/FileInput/FileInput.test.tsx +104 -13
- package/src/FileInput/FileInput.tsx +106 -79
- package/src/Heading/Heading.tsx +2 -1
- package/src/HoverCard/useHoverCard.tsx +15 -3
- package/src/Icon/Icon.doc.mjs +13 -0
- package/src/Icon/Icon.test.tsx +89 -0
- package/src/Icon/Icon.tsx +51 -3
- package/src/Item/Item.doc.mjs +5 -0
- package/src/Item/Item.test.tsx +88 -0
- package/src/Item/Item.tsx +57 -11
- package/src/Layer/layerAnimations.stylex.ts +23 -0
- package/src/Lightbox/Lightbox.test.tsx +33 -0
- package/src/Lightbox/Lightbox.tsx +30 -10
- package/src/List/List.test.tsx +17 -29
- package/src/List/List.tsx +6 -1
- package/src/List/ListItem.doc.mjs +12 -0
- package/src/List/ListItem.tsx +13 -0
- package/src/Markdown/Markdown.test.tsx +21 -0
- package/src/Markdown/Markdown.tsx +4 -0
- package/src/MetadataList/MetadataList.test.tsx +24 -0
- package/src/MetadataList/MetadataList.tsx +6 -2
- package/src/MultiSelector/MultiSelector.doc.mjs +20 -0
- package/src/MultiSelector/MultiSelector.test.tsx +436 -0
- package/src/MultiSelector/MultiSelector.tsx +133 -67
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +21 -0
- package/src/NumberInput/NumberInput.test.tsx +71 -0
- package/src/NumberInput/NumberInput.tsx +35 -26
- package/src/Outline/Outline.test.tsx +12 -12
- package/src/Outline/Outline.tsx +2 -2
- package/src/Pagination/Pagination.tsx +11 -3
- package/src/PowerSearch/PowerSearch.doc.mjs +15 -0
- package/src/PowerSearch/PowerSearch.test.tsx +23 -0
- package/src/PowerSearch/PowerSearch.tsx +10 -1
- package/src/ProgressBar/ProgressBar.test.tsx +34 -0
- package/src/ProgressBar/ProgressBar.tsx +16 -1
- package/src/RadioList/RadioList.doc.mjs +6 -0
- package/src/RadioList/RadioList.test.tsx +26 -4
- package/src/RadioList/RadioList.tsx +2 -2
- package/src/RadioList/RadioListItem.tsx +12 -5
- package/src/Resizable/ResizeHandle.test.tsx +94 -0
- package/src/Resizable/ResizeHandle.tsx +70 -20
- package/src/SegmentedControl/SegmentedControl.test.tsx +28 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +22 -2
- package/src/Selector/Selector.doc.mjs +15 -0
- package/src/Selector/Selector.test.tsx +400 -0
- package/src/Selector/Selector.tsx +95 -23
- package/src/SideNav/SideNav.tsx +1 -8
- package/src/SideNav/SideNavCollapseButton.tsx +9 -7
- package/src/SideNav/SideNavItem.tsx +5 -3
- package/src/Skeleton/Skeleton.test.tsx +16 -0
- package/src/Skeleton/Skeleton.tsx +13 -1
- package/src/Slider/Slider.doc.mjs +6 -0
- package/src/Slider/Slider.test.tsx +240 -12
- package/src/Slider/Slider.tsx +96 -23
- package/src/Spinner/Spinner.test.tsx +10 -8
- package/src/Spinner/Spinner.tsx +15 -5
- package/src/Switch/Switch.doc.mjs +142 -42
- package/src/Switch/Switch.test.tsx +111 -0
- package/src/Switch/Switch.tsx +149 -32
- package/src/TabList/Tab.tsx +2 -2
- package/src/TabList/TabList.doc.mjs +0 -6
- package/src/TabList/TabList.test.tsx +3 -15
- package/src/TabList/TabList.tsx +6 -17
- package/src/TabList/TabListContext.ts +0 -6
- package/src/TabList/TabMenu.tsx +2 -2
- package/src/Table/BaseTable.tsx +34 -2
- package/src/Table/Table.doc.mjs +11 -0
- package/src/Table/Table.test.tsx +85 -0
- package/src/Table/TableCell.tsx +3 -3
- package/src/Table/TableHeaderCell.tsx +3 -3
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +9 -6
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +19 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +48 -21
- package/src/Table/plugins/selection/useTableSelection.test.tsx +61 -3
- package/src/Table/plugins/selection/useTableSelection.tsx +3 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +38 -9
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +161 -2
- package/src/Table/plugins/tree/useTableTreeData.tsx +71 -14
- package/src/Table/types.ts +33 -0
- package/src/Table/useTableRowExpansion.doc.mjs +55 -2
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/Table/useTableTreeData.doc.mjs +9 -0
- package/src/Text/Heading.doc.mjs +3 -3
- package/src/Text/Text.doc.mjs +1 -1
- package/src/Text/Text.test.tsx +42 -0
- package/src/Text/Text.tsx +25 -1
- package/src/Text/index.ts +2 -6
- package/src/TextArea/TextArea.doc.mjs +23 -2
- package/src/TextArea/TextArea.test.tsx +132 -4
- package/src/TextArea/TextArea.tsx +161 -67
- package/src/TextInput/TextInput.doc.mjs +21 -0
- package/src/TextInput/TextInput.test.tsx +150 -0
- package/src/TextInput/TextInput.tsx +28 -25
- package/src/Thumbnail/Thumbnail.doc.mjs +1 -1
- package/src/Thumbnail/Thumbnail.test.tsx +24 -1
- package/src/Thumbnail/Thumbnail.tsx +28 -35
- package/src/TimeInput/TimeInput.doc.mjs +21 -0
- package/src/TimeInput/TimeInput.test.tsx +23 -0
- package/src/TimeInput/TimeInput.tsx +24 -25
- package/src/Timestamp/Timestamp.doc.mjs +32 -6
- package/src/Timestamp/Timestamp.test.tsx +371 -0
- package/src/Timestamp/Timestamp.tsx +96 -93
- package/src/Timestamp/formatInstant.ts +218 -0
- package/src/Timestamp/index.ts +4 -0
- package/src/Timestamp/tooltipEntries.test.ts +552 -0
- package/src/Timestamp/tooltipEntries.ts +210 -0
- package/src/Toast/ToastViewport.test.tsx +218 -8
- package/src/Toast/ToastViewport.tsx +71 -12
- package/src/ToggleButton/ToggleButton.test.tsx +24 -0
- package/src/ToggleButton/ToggleButton.tsx +19 -1
- package/src/Token/Token.test.tsx +166 -15
- package/src/Token/Token.tsx +104 -47
- package/src/Token/TokenLink.tsx +107 -0
- package/src/Token/index.ts +1 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +23 -1
- package/src/Tokenizer/Tokenizer.test.tsx +23 -0
- package/src/Tokenizer/Tokenizer.tsx +14 -2
- package/src/Tooltip/Tooltip.test.tsx +46 -0
- package/src/Tooltip/useTooltip.tsx +20 -0
- package/src/TopNav/TopNav.test.tsx +93 -2
- package/src/TopNav/TopNavItem.doc.mjs +3 -3
- package/src/TopNav/TopNavItem.tsx +35 -6
- package/src/TopNav/TopNavMegaMenu.tsx +26 -2
- package/src/TopNav/TopNavMegaMenuFeaturedCard.doc.mjs +1 -1
- package/src/TreeList/TreeList.doc.mjs +6 -0
- package/src/TreeList/TreeList.test.tsx +50 -10
- package/src/TreeList/TreeList.tsx +5 -0
- package/src/TreeList/TreeListBranches.tsx +8 -6
- package/src/TreeList/TreeListItem.tsx +33 -11
- package/src/Typeahead/BaseTypeahead.tsx +42 -15
- package/src/Typeahead/Typeahead.doc.mjs +13 -0
- package/src/Typeahead/Typeahead.test.tsx +112 -0
- package/src/Typeahead/Typeahead.tsx +17 -1
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/__tests__/babelPluginAddExtensions.test.ts +190 -0
- package/src/__tests__/forcedColors.ts +60 -0
- package/src/__tests__/inputWidthContract.test.tsx +62 -0
- package/src/doc-mjs.d.ts +19 -0
- package/src/hooks/containerReveal.pool.stylex.ts +464 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/isRtlElement.ts +27 -0
- package/src/hooks/useAnnounce.test.tsx +75 -2
- package/src/hooks/useAnnounce.ts +47 -1
- package/src/hooks/useContainerReveal.test.tsx +116 -0
- package/src/hooks/useContainerReveal.ts +180 -0
- package/src/hooks/useFocusTrap.test.tsx +104 -0
- package/src/hooks/useFocusTrap.ts +61 -12
- package/src/hooks/useGridFocus.doc.mjs +3 -3
- package/src/hooks/useGridFocus.test.tsx +41 -0
- package/src/hooks/useGridFocus.ts +21 -10
- package/src/hooks/useHotkeys.ts +9 -0
- package/src/hooks/useInputStatusIcon.test.tsx +221 -0
- package/src/hooks/useInputStatusIcon.tsx +235 -0
- package/src/hooks/useKeyboardHint.test.tsx +22 -0
- package/src/hooks/useKeyboardHint.tsx +6 -2
- package/src/hooks/useListFocus.doc.mjs +25 -3
- package/src/hooks/useListFocus.test.tsx +153 -1
- package/src/hooks/useListFocus.ts +102 -9
- package/src/i18n/InternationalizationContext.ts +4 -0
- package/src/i18n/InternationalizationProvider.tsx +12 -2
- package/src/i18n/__tests__/getLocaleDirection.test.ts +40 -0
- package/src/i18n/__tests__/useDirection.test.tsx +66 -0
- package/src/i18n/getLocaleDirection.ts +29 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/useDirection.ts +29 -0
- package/src/reset.css +0 -26
- package/src/reset.test.ts +60 -0
- package/src/theme/defineTheme.ts +6 -0
- package/src/theme/derivedVarRegistry.test.ts +1 -0
- package/src/theme/derivedVarRegistry.ts +6 -0
- package/src/theme/expandColorScale.test.ts +144 -0
- package/src/theme/expandColorScale.ts +53 -15
- package/src/theme/generateThemeRules.test.ts +42 -0
- package/src/theme/index.ts +4 -8
- package/src/theme/types.ts +43 -13
- package/src/utils/index.ts +2 -0
- package/src/utils/plainDate.test.ts +24 -6
- package/src/utils/plainDate.ts +18 -4
- package/src/utils/rtlStyles.ts +27 -0
- package/dist/Thumbnail/thumbnail.markers.stylex.d.ts +0 -9
- package/dist/Thumbnail/thumbnail.markers.stylex.d.ts.map +0 -1
- package/dist/Thumbnail/thumbnail.markers.stylex.js +0 -14
- package/src/Thumbnail/thumbnail.markers.stylex.ts +0 -12
package/src/doc-mjs.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Ambient module declaration for `*.doc.mjs` imports.
|
|
5
|
+
*
|
|
6
|
+
* Component contract tests (packages/core/src/__tests__/*Contract.test.tsx)
|
|
7
|
+
* import `{Name}.doc.mjs` files directly to assert their documented props
|
|
8
|
+
* stay in sync with the component's real API. Without this declaration,
|
|
9
|
+
* TypeScript has no way to type a `.mjs` import and fails with
|
|
10
|
+
* TS7016 ("Could not find a declaration file for module").
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare module '*.doc.mjs' {
|
|
14
|
+
import type {ComponentDoc, TranslationDoc} from './docs-types';
|
|
15
|
+
|
|
16
|
+
export const docs: ComponentDoc;
|
|
17
|
+
export const docsZh: ComponentDoc;
|
|
18
|
+
export const docsDense: TranslationDoc;
|
|
19
|
+
}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file containerReveal.pool.stylex.ts
|
|
5
|
+
* @input Uses StyleX, theme tokens
|
|
6
|
+
* @output A fixed pool of scoped markers, each paired with its reveal style
|
|
7
|
+
* blocks (reveal / conceal, each with a layout-preserved variant) compiled
|
|
8
|
+
* against that marker.
|
|
9
|
+
* @position Internal to useContainerReveal.
|
|
10
|
+
*
|
|
11
|
+
* WHY A POOL OF LITERAL BLOCKS: `stylex.when.ancestor(':hover', marker)` is
|
|
12
|
+
* resolved by the StyleX compiler, which welds the marker's class into the
|
|
13
|
+
* emitted selector (`.marker:hover *`). A marker and the styles referencing it
|
|
14
|
+
* are therefore inseparable at build time — the marker cannot be passed as a
|
|
15
|
+
* runtime argument, so the blocks cannot be produced by a loop or a helper and
|
|
16
|
+
* must be written out literally per marker. A single shared marker would leak
|
|
17
|
+
* hover/focus across NESTED reveal containers (an ancestor container's :hover
|
|
18
|
+
* matches a descendant container's revealed content), so useContainerReveal
|
|
19
|
+
* hands each concurrently mounted container a distinct marker from this pool
|
|
20
|
+
* (see the free-list there).
|
|
21
|
+
*
|
|
22
|
+
* The reveal recipe hides content with `position: absolute` (removed from
|
|
23
|
+
* layout flow, so it reserves no space) plus `opacity: 0`. Both keep the
|
|
24
|
+
* content in the accessibility tree and tab order — unlike display/visibility
|
|
25
|
+
* — so it stays reachable by keyboard and assistive tech while hidden.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import * as stylex from '@stylexjs/stylex';
|
|
29
|
+
import {durationVars, easeVars} from '../theme/tokens.stylex';
|
|
30
|
+
|
|
31
|
+
export const POOL_SIZE = 6;
|
|
32
|
+
|
|
33
|
+
export const m0 = stylex.defineMarker();
|
|
34
|
+
const s0 = stylex.create({
|
|
35
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
36
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
37
|
+
// flow and fades in. Always shown on touch.
|
|
38
|
+
reveal: {
|
|
39
|
+
transitionProperty: 'opacity',
|
|
40
|
+
transitionDuration: {
|
|
41
|
+
default: durationVars['--duration-fast'],
|
|
42
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
43
|
+
},
|
|
44
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
45
|
+
opacity: {
|
|
46
|
+
default: 0,
|
|
47
|
+
[stylex.when.ancestor(':hover', m0)]: {'@media (hover: hover)': 1},
|
|
48
|
+
[stylex.when.ancestor(':focus-within', m0)]: 1,
|
|
49
|
+
'@media (any-pointer: coarse)': 1,
|
|
50
|
+
},
|
|
51
|
+
position: {
|
|
52
|
+
default: 'absolute',
|
|
53
|
+
[stylex.when.ancestor(':hover', m0)]: {'@media (hover: hover)': 'static'},
|
|
54
|
+
[stylex.when.ancestor(':focus-within', m0)]: 'static',
|
|
55
|
+
'@media (any-pointer: coarse)': 'static',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
59
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
60
|
+
revealLayoutPreserved: {
|
|
61
|
+
transitionProperty: 'opacity',
|
|
62
|
+
transitionDuration: {
|
|
63
|
+
default: durationVars['--duration-fast'],
|
|
64
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
65
|
+
},
|
|
66
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
67
|
+
opacity: {
|
|
68
|
+
default: 0,
|
|
69
|
+
[stylex.when.ancestor(':hover', m0)]: {'@media (hover: hover)': 1},
|
|
70
|
+
[stylex.when.ancestor(':focus-within', m0)]: 1,
|
|
71
|
+
'@media (any-pointer: coarse)': 1,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
75
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
76
|
+
// visible on touch. Never leaves the a11y tree.
|
|
77
|
+
conceal: {
|
|
78
|
+
transitionProperty: 'opacity',
|
|
79
|
+
transitionDuration: {
|
|
80
|
+
default: durationVars['--duration-fast'],
|
|
81
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
82
|
+
},
|
|
83
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
84
|
+
opacity: {
|
|
85
|
+
default: 1,
|
|
86
|
+
[stylex.when.ancestor(':hover', m0)]: {'@media (hover: hover)': 0},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
concealLayoutPreserved: {
|
|
90
|
+
transitionProperty: 'opacity',
|
|
91
|
+
transitionDuration: {
|
|
92
|
+
default: durationVars['--duration-fast'],
|
|
93
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
94
|
+
},
|
|
95
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
96
|
+
opacity: {
|
|
97
|
+
default: 1,
|
|
98
|
+
[stylex.when.ancestor(':hover', m0)]: {'@media (hover: hover)': 0},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const m1 = stylex.defineMarker();
|
|
104
|
+
const s1 = stylex.create({
|
|
105
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
106
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
107
|
+
// flow and fades in. Always shown on touch.
|
|
108
|
+
reveal: {
|
|
109
|
+
transitionProperty: 'opacity',
|
|
110
|
+
transitionDuration: {
|
|
111
|
+
default: durationVars['--duration-fast'],
|
|
112
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
113
|
+
},
|
|
114
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
115
|
+
opacity: {
|
|
116
|
+
default: 0,
|
|
117
|
+
[stylex.when.ancestor(':hover', m1)]: {'@media (hover: hover)': 1},
|
|
118
|
+
[stylex.when.ancestor(':focus-within', m1)]: 1,
|
|
119
|
+
'@media (any-pointer: coarse)': 1,
|
|
120
|
+
},
|
|
121
|
+
position: {
|
|
122
|
+
default: 'absolute',
|
|
123
|
+
[stylex.when.ancestor(':hover', m1)]: {'@media (hover: hover)': 'static'},
|
|
124
|
+
[stylex.when.ancestor(':focus-within', m1)]: 'static',
|
|
125
|
+
'@media (any-pointer: coarse)': 'static',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
129
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
130
|
+
revealLayoutPreserved: {
|
|
131
|
+
transitionProperty: 'opacity',
|
|
132
|
+
transitionDuration: {
|
|
133
|
+
default: durationVars['--duration-fast'],
|
|
134
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
135
|
+
},
|
|
136
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
137
|
+
opacity: {
|
|
138
|
+
default: 0,
|
|
139
|
+
[stylex.when.ancestor(':hover', m1)]: {'@media (hover: hover)': 1},
|
|
140
|
+
[stylex.when.ancestor(':focus-within', m1)]: 1,
|
|
141
|
+
'@media (any-pointer: coarse)': 1,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
145
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
146
|
+
// visible on touch. Never leaves the a11y tree.
|
|
147
|
+
conceal: {
|
|
148
|
+
transitionProperty: 'opacity',
|
|
149
|
+
transitionDuration: {
|
|
150
|
+
default: durationVars['--duration-fast'],
|
|
151
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
152
|
+
},
|
|
153
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
154
|
+
opacity: {
|
|
155
|
+
default: 1,
|
|
156
|
+
[stylex.when.ancestor(':hover', m1)]: {'@media (hover: hover)': 0},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
concealLayoutPreserved: {
|
|
160
|
+
transitionProperty: 'opacity',
|
|
161
|
+
transitionDuration: {
|
|
162
|
+
default: durationVars['--duration-fast'],
|
|
163
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
164
|
+
},
|
|
165
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
166
|
+
opacity: {
|
|
167
|
+
default: 1,
|
|
168
|
+
[stylex.when.ancestor(':hover', m1)]: {'@media (hover: hover)': 0},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
export const m2 = stylex.defineMarker();
|
|
174
|
+
const s2 = stylex.create({
|
|
175
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
176
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
177
|
+
// flow and fades in. Always shown on touch.
|
|
178
|
+
reveal: {
|
|
179
|
+
transitionProperty: 'opacity',
|
|
180
|
+
transitionDuration: {
|
|
181
|
+
default: durationVars['--duration-fast'],
|
|
182
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
183
|
+
},
|
|
184
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
185
|
+
opacity: {
|
|
186
|
+
default: 0,
|
|
187
|
+
[stylex.when.ancestor(':hover', m2)]: {'@media (hover: hover)': 1},
|
|
188
|
+
[stylex.when.ancestor(':focus-within', m2)]: 1,
|
|
189
|
+
'@media (any-pointer: coarse)': 1,
|
|
190
|
+
},
|
|
191
|
+
position: {
|
|
192
|
+
default: 'absolute',
|
|
193
|
+
[stylex.when.ancestor(':hover', m2)]: {'@media (hover: hover)': 'static'},
|
|
194
|
+
[stylex.when.ancestor(':focus-within', m2)]: 'static',
|
|
195
|
+
'@media (any-pointer: coarse)': 'static',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
199
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
200
|
+
revealLayoutPreserved: {
|
|
201
|
+
transitionProperty: 'opacity',
|
|
202
|
+
transitionDuration: {
|
|
203
|
+
default: durationVars['--duration-fast'],
|
|
204
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
205
|
+
},
|
|
206
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
207
|
+
opacity: {
|
|
208
|
+
default: 0,
|
|
209
|
+
[stylex.when.ancestor(':hover', m2)]: {'@media (hover: hover)': 1},
|
|
210
|
+
[stylex.when.ancestor(':focus-within', m2)]: 1,
|
|
211
|
+
'@media (any-pointer: coarse)': 1,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
215
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
216
|
+
// visible on touch. Never leaves the a11y tree.
|
|
217
|
+
conceal: {
|
|
218
|
+
transitionProperty: 'opacity',
|
|
219
|
+
transitionDuration: {
|
|
220
|
+
default: durationVars['--duration-fast'],
|
|
221
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
222
|
+
},
|
|
223
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
224
|
+
opacity: {
|
|
225
|
+
default: 1,
|
|
226
|
+
[stylex.when.ancestor(':hover', m2)]: {'@media (hover: hover)': 0},
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
concealLayoutPreserved: {
|
|
230
|
+
transitionProperty: 'opacity',
|
|
231
|
+
transitionDuration: {
|
|
232
|
+
default: durationVars['--duration-fast'],
|
|
233
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
234
|
+
},
|
|
235
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
236
|
+
opacity: {
|
|
237
|
+
default: 1,
|
|
238
|
+
[stylex.when.ancestor(':hover', m2)]: {'@media (hover: hover)': 0},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export const m3 = stylex.defineMarker();
|
|
244
|
+
const s3 = stylex.create({
|
|
245
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
246
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
247
|
+
// flow and fades in. Always shown on touch.
|
|
248
|
+
reveal: {
|
|
249
|
+
transitionProperty: 'opacity',
|
|
250
|
+
transitionDuration: {
|
|
251
|
+
default: durationVars['--duration-fast'],
|
|
252
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
253
|
+
},
|
|
254
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
255
|
+
opacity: {
|
|
256
|
+
default: 0,
|
|
257
|
+
[stylex.when.ancestor(':hover', m3)]: {'@media (hover: hover)': 1},
|
|
258
|
+
[stylex.when.ancestor(':focus-within', m3)]: 1,
|
|
259
|
+
'@media (any-pointer: coarse)': 1,
|
|
260
|
+
},
|
|
261
|
+
position: {
|
|
262
|
+
default: 'absolute',
|
|
263
|
+
[stylex.when.ancestor(':hover', m3)]: {'@media (hover: hover)': 'static'},
|
|
264
|
+
[stylex.when.ancestor(':focus-within', m3)]: 'static',
|
|
265
|
+
'@media (any-pointer: coarse)': 'static',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
269
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
270
|
+
revealLayoutPreserved: {
|
|
271
|
+
transitionProperty: 'opacity',
|
|
272
|
+
transitionDuration: {
|
|
273
|
+
default: durationVars['--duration-fast'],
|
|
274
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
275
|
+
},
|
|
276
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
277
|
+
opacity: {
|
|
278
|
+
default: 0,
|
|
279
|
+
[stylex.when.ancestor(':hover', m3)]: {'@media (hover: hover)': 1},
|
|
280
|
+
[stylex.when.ancestor(':focus-within', m3)]: 1,
|
|
281
|
+
'@media (any-pointer: coarse)': 1,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
285
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
286
|
+
// visible on touch. Never leaves the a11y tree.
|
|
287
|
+
conceal: {
|
|
288
|
+
transitionProperty: 'opacity',
|
|
289
|
+
transitionDuration: {
|
|
290
|
+
default: durationVars['--duration-fast'],
|
|
291
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
292
|
+
},
|
|
293
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
294
|
+
opacity: {
|
|
295
|
+
default: 1,
|
|
296
|
+
[stylex.when.ancestor(':hover', m3)]: {'@media (hover: hover)': 0},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
concealLayoutPreserved: {
|
|
300
|
+
transitionProperty: 'opacity',
|
|
301
|
+
transitionDuration: {
|
|
302
|
+
default: durationVars['--duration-fast'],
|
|
303
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
304
|
+
},
|
|
305
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
306
|
+
opacity: {
|
|
307
|
+
default: 1,
|
|
308
|
+
[stylex.when.ancestor(':hover', m3)]: {'@media (hover: hover)': 0},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
export const m4 = stylex.defineMarker();
|
|
314
|
+
const s4 = stylex.create({
|
|
315
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
316
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
317
|
+
// flow and fades in. Always shown on touch.
|
|
318
|
+
reveal: {
|
|
319
|
+
transitionProperty: 'opacity',
|
|
320
|
+
transitionDuration: {
|
|
321
|
+
default: durationVars['--duration-fast'],
|
|
322
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
323
|
+
},
|
|
324
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
325
|
+
opacity: {
|
|
326
|
+
default: 0,
|
|
327
|
+
[stylex.when.ancestor(':hover', m4)]: {'@media (hover: hover)': 1},
|
|
328
|
+
[stylex.when.ancestor(':focus-within', m4)]: 1,
|
|
329
|
+
'@media (any-pointer: coarse)': 1,
|
|
330
|
+
},
|
|
331
|
+
position: {
|
|
332
|
+
default: 'absolute',
|
|
333
|
+
[stylex.when.ancestor(':hover', m4)]: {'@media (hover: hover)': 'static'},
|
|
334
|
+
[stylex.when.ancestor(':focus-within', m4)]: 'static',
|
|
335
|
+
'@media (any-pointer: coarse)': 'static',
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
339
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
340
|
+
revealLayoutPreserved: {
|
|
341
|
+
transitionProperty: 'opacity',
|
|
342
|
+
transitionDuration: {
|
|
343
|
+
default: durationVars['--duration-fast'],
|
|
344
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
345
|
+
},
|
|
346
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
347
|
+
opacity: {
|
|
348
|
+
default: 0,
|
|
349
|
+
[stylex.when.ancestor(':hover', m4)]: {'@media (hover: hover)': 1},
|
|
350
|
+
[stylex.when.ancestor(':focus-within', m4)]: 1,
|
|
351
|
+
'@media (any-pointer: coarse)': 1,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
355
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
356
|
+
// visible on touch. Never leaves the a11y tree.
|
|
357
|
+
conceal: {
|
|
358
|
+
transitionProperty: 'opacity',
|
|
359
|
+
transitionDuration: {
|
|
360
|
+
default: durationVars['--duration-fast'],
|
|
361
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
362
|
+
},
|
|
363
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
364
|
+
opacity: {
|
|
365
|
+
default: 1,
|
|
366
|
+
[stylex.when.ancestor(':hover', m4)]: {'@media (hover: hover)': 0},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
concealLayoutPreserved: {
|
|
370
|
+
transitionProperty: 'opacity',
|
|
371
|
+
transitionDuration: {
|
|
372
|
+
default: durationVars['--duration-fast'],
|
|
373
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
374
|
+
},
|
|
375
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
376
|
+
opacity: {
|
|
377
|
+
default: 1,
|
|
378
|
+
[stylex.when.ancestor(':hover', m4)]: {'@media (hover: hover)': 0},
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
export const m5 = stylex.defineMarker();
|
|
384
|
+
const s5 = stylex.create({
|
|
385
|
+
// Hidden at rest via position + opacity (kept in the a11y tree and tab
|
|
386
|
+
// order); on container :hover (fine pointer) or :focus-within it returns to
|
|
387
|
+
// flow and fades in. Always shown on touch.
|
|
388
|
+
reveal: {
|
|
389
|
+
transitionProperty: 'opacity',
|
|
390
|
+
transitionDuration: {
|
|
391
|
+
default: durationVars['--duration-fast'],
|
|
392
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
393
|
+
},
|
|
394
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
395
|
+
opacity: {
|
|
396
|
+
default: 0,
|
|
397
|
+
[stylex.when.ancestor(':hover', m5)]: {'@media (hover: hover)': 1},
|
|
398
|
+
[stylex.when.ancestor(':focus-within', m5)]: 1,
|
|
399
|
+
'@media (any-pointer: coarse)': 1,
|
|
400
|
+
},
|
|
401
|
+
position: {
|
|
402
|
+
default: 'absolute',
|
|
403
|
+
[stylex.when.ancestor(':hover', m5)]: {'@media (hover: hover)': 'static'},
|
|
404
|
+
[stylex.when.ancestor(':focus-within', m5)]: 'static',
|
|
405
|
+
'@media (any-pointer: coarse)': 'static',
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
// Opacity-only reveal that keeps the box reserved (no layout shift). Use for
|
|
409
|
+
// content that is already positioned (e.g. an absolute overlay).
|
|
410
|
+
revealLayoutPreserved: {
|
|
411
|
+
transitionProperty: 'opacity',
|
|
412
|
+
transitionDuration: {
|
|
413
|
+
default: durationVars['--duration-fast'],
|
|
414
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
415
|
+
},
|
|
416
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
417
|
+
opacity: {
|
|
418
|
+
default: 0,
|
|
419
|
+
[stylex.when.ancestor(':hover', m5)]: {'@media (hover: hover)': 1},
|
|
420
|
+
[stylex.when.ancestor(':focus-within', m5)]: 1,
|
|
421
|
+
'@media (any-pointer: coarse)': 1,
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
// Inverted: visible at rest, fades OUT on :hover only. Deliberately ignores
|
|
425
|
+
// :focus-within (a keyboard user must never watch content vanish) and stays
|
|
426
|
+
// visible on touch. Never leaves the a11y tree.
|
|
427
|
+
conceal: {
|
|
428
|
+
transitionProperty: 'opacity',
|
|
429
|
+
transitionDuration: {
|
|
430
|
+
default: durationVars['--duration-fast'],
|
|
431
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
432
|
+
},
|
|
433
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
434
|
+
opacity: {
|
|
435
|
+
default: 1,
|
|
436
|
+
[stylex.when.ancestor(':hover', m5)]: {'@media (hover: hover)': 0},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
concealLayoutPreserved: {
|
|
440
|
+
transitionProperty: 'opacity',
|
|
441
|
+
transitionDuration: {
|
|
442
|
+
default: durationVars['--duration-fast'],
|
|
443
|
+
'@media (prefers-reduced-motion: reduce)': '0s',
|
|
444
|
+
},
|
|
445
|
+
transitionTimingFunction: easeVars['--ease-standard'],
|
|
446
|
+
opacity: {
|
|
447
|
+
default: 1,
|
|
448
|
+
[stylex.when.ancestor(':hover', m5)]: {'@media (hover: hover)': 0},
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// The compiled StyleX objects carry `when.ancestor` conditionals the public
|
|
454
|
+
// `StyleXStyles` type does not model, so the slot shape is inferred.
|
|
455
|
+
export const POOL = [
|
|
456
|
+
{marker: m0, reveal: s0.reveal, revealLayoutPreserved: s0.revealLayoutPreserved, conceal: s0.conceal, concealLayoutPreserved: s0.concealLayoutPreserved},
|
|
457
|
+
{marker: m1, reveal: s1.reveal, revealLayoutPreserved: s1.revealLayoutPreserved, conceal: s1.conceal, concealLayoutPreserved: s1.concealLayoutPreserved},
|
|
458
|
+
{marker: m2, reveal: s2.reveal, revealLayoutPreserved: s2.revealLayoutPreserved, conceal: s2.conceal, concealLayoutPreserved: s2.concealLayoutPreserved},
|
|
459
|
+
{marker: m3, reveal: s3.reveal, revealLayoutPreserved: s3.revealLayoutPreserved, conceal: s3.conceal, concealLayoutPreserved: s3.concealLayoutPreserved},
|
|
460
|
+
{marker: m4, reveal: s4.reveal, revealLayoutPreserved: s4.revealLayoutPreserved, conceal: s4.conceal, concealLayoutPreserved: s4.concealLayoutPreserved},
|
|
461
|
+
{marker: m5, reveal: s5.reveal, revealLayoutPreserved: s5.revealLayoutPreserved, conceal: s5.conceal, concealLayoutPreserved: s5.concealLayoutPreserved},
|
|
462
|
+
] as const;
|
|
463
|
+
|
|
464
|
+
export type RevealSlot = (typeof POOL)[number];
|
package/src/hooks/index.ts
CHANGED
|
@@ -76,6 +76,12 @@ export type {
|
|
|
76
76
|
export {useInputContainer} from './useInputContainer';
|
|
77
77
|
export type {UseInputContainerOptions} from './useInputContainer';
|
|
78
78
|
|
|
79
|
+
export {useInputStatusIcon} from './useInputStatusIcon';
|
|
80
|
+
export type {
|
|
81
|
+
UseInputStatusIconOptions,
|
|
82
|
+
UseInputStatusIconReturn,
|
|
83
|
+
} from './useInputStatusIcon';
|
|
84
|
+
|
|
79
85
|
export {useInteractiveRole} from './useInteractiveRole';
|
|
80
86
|
export type {
|
|
81
87
|
InteractiveRole,
|
|
@@ -86,3 +92,10 @@ export {useLongPress} from './useLongPress';
|
|
|
86
92
|
export type {UseLongPressOptions, UseLongPressHandlers} from './useLongPress';
|
|
87
93
|
|
|
88
94
|
export {useDevWarning} from './useDevWarning';
|
|
95
|
+
|
|
96
|
+
export {useContainerReveal} from './useContainerReveal';
|
|
97
|
+
export type {
|
|
98
|
+
UseContainerRevealOptions,
|
|
99
|
+
UseContainerRevealReturn,
|
|
100
|
+
ContentRevealOptions,
|
|
101
|
+
} from './useContainerReveal';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file isRtlElement.ts
|
|
7
|
+
* @input DOM element (nullable)
|
|
8
|
+
* @output Exports isRtlElement helper resolving an element's computed text
|
|
9
|
+
* direction
|
|
10
|
+
* @position Internal hook utility; used by useListFocus and useGridFocus to
|
|
11
|
+
* auto-detect RTL for arrow-key navigation (same getComputedStyle precedent
|
|
12
|
+
* as Resizable's ResizeHandle drag deltas).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Whether `el` renders right-to-left, per its computed `direction`.
|
|
17
|
+
*
|
|
18
|
+
* SSR-safe: returns false when `el` is null or no DOM is available. Callers
|
|
19
|
+
* should invoke this lazily (on keydown, not on render) so getComputedStyle
|
|
20
|
+
* runs only when a horizontal arrow key is actually handled.
|
|
21
|
+
*/
|
|
22
|
+
export function isRtlElement(el: HTMLElement | null): boolean {
|
|
23
|
+
if (!el || typeof window === 'undefined') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return window.getComputedStyle(el).direction === 'rtl';
|
|
27
|
+
}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* SYNC: When useAnnounce.ts changes, update tests to match new behavior
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {describe, it, expect, afterEach} from 'vitest';
|
|
13
|
-
import {renderHook, waitFor} from '@testing-library/react';
|
|
12
|
+
import {describe, it, expect, afterEach, vi} from 'vitest';
|
|
13
|
+
import {act, renderHook, waitFor} from '@testing-library/react';
|
|
14
14
|
import {useAnnounce, __resetLiveRegionsForTest} from './useAnnounce';
|
|
15
15
|
|
|
16
16
|
afterEach(() => {
|
|
@@ -82,6 +82,79 @@ describe('useAnnounce', () => {
|
|
|
82
82
|
expect(politeRegion()).toBeNull();
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
+
it('clears the region after the clear delay, but not before', () => {
|
|
86
|
+
vi.useFakeTimers();
|
|
87
|
+
try {
|
|
88
|
+
const {result} = renderHook(() => useAnnounce());
|
|
89
|
+
result.current('Saved');
|
|
90
|
+
// Flush the rAF that re-sets the message.
|
|
91
|
+
act(() => {
|
|
92
|
+
vi.advanceTimersByTime(50);
|
|
93
|
+
});
|
|
94
|
+
expect(politeRegion()?.textContent).toBe('Saved');
|
|
95
|
+
|
|
96
|
+
// The message survives long enough for AT to finish reading it.
|
|
97
|
+
act(() => {
|
|
98
|
+
vi.advanceTimersByTime(1000);
|
|
99
|
+
});
|
|
100
|
+
expect(politeRegion()?.textContent).toBe('Saved');
|
|
101
|
+
|
|
102
|
+
// After the clear delay, stale status text is removed from the DOM.
|
|
103
|
+
act(() => {
|
|
104
|
+
vi.advanceTimersByTime(10_000);
|
|
105
|
+
});
|
|
106
|
+
expect(politeRegion()?.textContent).toBe('');
|
|
107
|
+
} finally {
|
|
108
|
+
vi.useRealTimers();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('resets the clear timer on each announce', () => {
|
|
113
|
+
vi.useFakeTimers();
|
|
114
|
+
try {
|
|
115
|
+
const {result} = renderHook(() => useAnnounce());
|
|
116
|
+
result.current('first');
|
|
117
|
+
act(() => {
|
|
118
|
+
vi.advanceTimersByTime(1500);
|
|
119
|
+
});
|
|
120
|
+
// Announcing again must reset the pending clear, not inherit it.
|
|
121
|
+
result.current('second');
|
|
122
|
+
act(() => {
|
|
123
|
+
vi.advanceTimersByTime(1900);
|
|
124
|
+
});
|
|
125
|
+
// 3.4s after 'first' (past its clear point) but only 1.9s after
|
|
126
|
+
// 'second' — the newer message must still be present.
|
|
127
|
+
expect(politeRegion()?.textContent).toBe('second');
|
|
128
|
+
act(() => {
|
|
129
|
+
vi.advanceTimersByTime(10_000);
|
|
130
|
+
});
|
|
131
|
+
expect(politeRegion()?.textContent).toBe('');
|
|
132
|
+
} finally {
|
|
133
|
+
vi.useRealTimers();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('re-announces normally after a clear', () => {
|
|
138
|
+
vi.useFakeTimers();
|
|
139
|
+
try {
|
|
140
|
+
const {result} = renderHook(() => useAnnounce());
|
|
141
|
+
result.current('gone soon');
|
|
142
|
+
act(() => {
|
|
143
|
+
vi.advanceTimersByTime(10_000);
|
|
144
|
+
});
|
|
145
|
+
expect(politeRegion()?.textContent).toBe('');
|
|
146
|
+
|
|
147
|
+
// The clear-then-rAF re-announce pattern still works after a clear.
|
|
148
|
+
result.current('back again');
|
|
149
|
+
act(() => {
|
|
150
|
+
vi.advanceTimersByTime(50);
|
|
151
|
+
});
|
|
152
|
+
expect(politeRegion()?.textContent).toBe('back again');
|
|
153
|
+
} finally {
|
|
154
|
+
vi.useRealTimers();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
85
158
|
it('reuses the same singleton regions across hook instances', async () => {
|
|
86
159
|
const {result: a} = renderHook(() => useAnnounce());
|
|
87
160
|
a.current('first');
|