@astryxdesign/core 0.3.0 → 0.4.0
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 +156 -0
- package/dist/AlertDialog/AlertDialog.d.ts +10 -2
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +22 -3
- package/dist/AppShell/AppShell.d.ts +2 -2
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +40 -9
- package/dist/AspectRatio/AspectRatio.d.ts +13 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +9 -0
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +33 -20
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +2 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +15 -14
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +21 -8
- package/dist/Breadcrumbs/index.d.ts +2 -1
- package/dist/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/Breadcrumbs/index.js +1 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -15
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +2 -1
- package/dist/Calendar/styles.d.ts +0 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +0 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +8 -12
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +2 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +3 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +4 -3
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +17 -17
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +2 -6
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +36 -125
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -11
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +84 -67
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +35 -15
- package/dist/CommandPalette/CommandPaletteItem.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +6 -3
- package/dist/CommandPalette/CommandPaletteList.js +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +35 -33
- package/dist/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +1 -1
- package/dist/ContextMenu/index.d.ts +2 -1
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +1 -0
- package/dist/DateInput/DateInput.d.ts +9 -2
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +24 -23
- package/dist/DateRangeInput/DateRangeInput.d.ts +9 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +11 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts +9 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +22 -17
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +4 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts +33 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +62 -20
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +8 -11
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +32 -31
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts +25 -0
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuDivider.js +66 -0
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +15 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +20 -8
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +5 -5
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +24 -67
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -8
- package/dist/DropdownMenu/index.d.ts +2 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +4 -0
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +35 -27
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +9 -5
- package/dist/Field/InputClearButton.d.ts +16 -3
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +15 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -19
- package/dist/Indicator/CheckIndicator.d.ts +25 -0
- package/dist/Indicator/CheckIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckIndicator.js +155 -0
- package/dist/Indicator/CheckboxIndicator.d.ts +22 -0
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -0
- package/dist/Indicator/CheckboxIndicator.js +173 -0
- package/dist/Indicator/RadioIndicator.d.ts +23 -0
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -0
- package/dist/Indicator/RadioIndicator.js +137 -0
- package/dist/Indicator/index.d.ts +24 -0
- package/dist/Indicator/index.d.ts.map +1 -0
- package/dist/Indicator/index.js +26 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts +16 -0
- package/dist/Indicator/indicator.markers.stylex.d.ts.map +1 -0
- package/dist/Indicator/indicator.markers.stylex.js +21 -0
- package/dist/Indicator/indicatorRegistry.d.ts +71 -0
- package/dist/Indicator/indicatorRegistry.d.ts.map +1 -0
- package/dist/Indicator/indicatorRegistry.js +93 -0
- package/dist/Indicator/types.d.ts +167 -0
- package/dist/Indicator/types.d.ts.map +1 -0
- package/dist/Indicator/types.js +1 -0
- package/dist/Indicator/useIndicator.d.ts +18 -0
- package/dist/Indicator/useIndicator.d.ts.map +1 -0
- package/dist/Indicator/useIndicator.js +30 -0
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -8
- package/dist/Layer/useLayer.d.ts +14 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +25 -2
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +56 -53
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -5
- package/dist/MobileNav/MobileNav.js +8 -8
- package/dist/MoreMenu/MoreMenu.d.ts +14 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +78 -75
- package/dist/NumberInput/NumberInput.d.ts +27 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +230 -42
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +2 -3
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +61 -63
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +6 -8
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +7 -0
- package/dist/ProgressBar/ProgressBar.d.ts +11 -4
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +96 -6
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +29 -84
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +2 -3
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +2 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +3 -11
- package/dist/Selector/Selector.d.ts +2 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +164 -94
- package/dist/Selector/hooks.d.ts +18 -6
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +57 -40
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +29 -14
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +56 -20
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +28 -22
- package/dist/Stack/stack.stylex.d.ts +3 -3
- package/dist/Switch/Switch.js +11 -10
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -3
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +41 -19
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -0
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +22 -18
- package/dist/Table/plugins/rowExpansion/index.d.ts +1 -1
- package/dist/Table/plugins/rowExpansion/index.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/index.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +41 -76
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +94 -345
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +23 -4
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +29 -33
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +2 -1
- package/dist/Table/types.d.ts +11 -0
- package/dist/Table/types.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 +16 -6
- package/dist/TextInput/TextInput.d.ts +10 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +13 -19
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +32 -26
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -15
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +16 -34
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +20 -11
- 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 +3 -19
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +6 -5
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +54 -16
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +3 -9
- package/dist/TopNav/TopNavMegaMenu.d.ts +7 -0
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +146 -60
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +22 -3
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +83 -38
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +13 -0
- package/dist/TreeList/TreeListBranches.d.ts +1 -1
- package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
- package/dist/TreeList/TreeListBranches.js +14 -4
- package/dist/TreeList/TreeListItem.d.ts +11 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +57 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +16 -8
- package/dist/astryx.css +74 -85
- package/dist/astryx.umd.js +56 -56
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/containerReveal.stylex.d.ts +61 -0
- package/dist/hooks/containerReveal.stylex.d.ts.map +1 -0
- package/dist/hooks/containerReveal.stylex.js +63 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useClipboard.d.ts +59 -0
- package/dist/hooks/useClipboard.d.ts.map +1 -0
- package/dist/hooks/useClipboard.js +106 -0
- package/dist/hooks/useContainerReveal.d.ts +14 -8
- package/dist/hooks/useContainerReveal.d.ts.map +1 -1
- package/dist/hooks/useContainerReveal.js +28 -69
- package/dist/hooks/useIndicatorFocusRing.d.ts +28 -0
- package/dist/hooks/useIndicatorFocusRing.d.ts.map +1 -0
- package/dist/hooks/useIndicatorFocusRing.js +96 -0
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +12 -2
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +33 -18
- package/dist/hooks/useStreamingText.d.ts +18 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +47 -7
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +9 -3
- package/dist/hooks/useTypeahead.d.ts +3 -2
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +19 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/defineTheme.d.ts +16 -0
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +8 -0
- package/dist/theme/derivedVarRegistry.d.ts +8 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +14 -13
- package/dist/theme/expandColorScale.d.ts +3 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +17 -7
- package/dist/theme/expandTypeScale.d.ts.map +1 -1
- package/dist/theme/expandTypeScale.js +17 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +11 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.d.ts +107 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -0
- package/dist/utils/focusOutline.stylex.js +130 -0
- package/dist/utils/focusReturn.d.ts +24 -0
- package/dist/utils/focusReturn.d.ts.map +1 -0
- package/dist/utils/focusReturn.js +29 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/mergeRefs.d.ts.map +1 -1
- package/dist/utils/mergeRefs.js +7 -5
- package/dist/utils/rtlStyles.d.ts +2 -2
- package/dist/utils/rtlStyles.js +2 -2
- package/dist/utils/themeProps.d.ts +20 -1
- package/dist/utils/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +8 -2
- package/locales/en.json +12 -0
- package/locales/pseudo.json +9 -0
- package/package.json +7 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +16 -3
- package/src/AlertDialog/AlertDialog.test.tsx +208 -1
- package/src/AlertDialog/AlertDialog.tsx +21 -3
- package/src/AppShell/AppShell.doc.mjs +11 -0
- package/src/AppShell/AppShell.test.tsx +139 -0
- package/src/AppShell/AppShell.tsx +32 -22
- package/src/AspectRatio/AspectRatio.doc.mjs +27 -3
- package/src/AspectRatio/AspectRatio.test.tsx +30 -0
- package/src/AspectRatio/AspectRatio.tsx +13 -0
- package/src/Avatar/Avatar.doc.mjs +2 -13
- package/src/Avatar/Avatar.test.tsx +33 -8
- package/src/Avatar/Avatar.tsx +52 -50
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +2 -9
- package/src/Banner/Banner.tsx +9 -6
- package/src/Breadcrumbs/BreadcrumbItem.tsx +16 -6
- package/src/Breadcrumbs/index.ts +5 -1
- package/src/Button/Button.tsx +21 -41
- package/src/Calendar/Calendar.tsx +2 -1
- package/src/Calendar/styles.ts +0 -8
- package/src/Carousel/Carousel.doc.mjs +3 -0
- package/src/Carousel/Carousel.tsx +10 -6
- package/src/Chat/Chat.doc.mjs +2 -0
- package/src/Chat/ChatDictationButton.tsx +7 -1
- package/src/Chat/ChatLayoutScrollButton.test.tsx +22 -0
- package/src/Chat/ChatLayoutScrollButton.tsx +8 -1
- package/src/Chat/ChatSendButton.tsx +2 -3
- package/src/Chat/ChatToolCalls.test.tsx +35 -0
- package/src/Chat/ChatToolCalls.tsx +36 -16
- package/src/Chat/useTriggerMenu.tsx +2 -5
- package/src/CheckboxInput/CheckboxInput.doc.mjs +4 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +115 -0
- package/src/CheckboxInput/CheckboxInput.tsx +45 -202
- package/src/ClickableCard/ClickableCard.tsx +6 -11
- package/src/CodeBlock/CodeBlock.doc.mjs +3 -0
- package/src/CodeBlock/CodeBlock.test.tsx +91 -0
- package/src/CodeBlock/CodeBlock.tsx +57 -80
- package/src/Collapsible/Collapsible.tsx +22 -18
- package/src/CommandPalette/CommandPalette.test.tsx +29 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +7 -4
- package/src/CommandPalette/CommandPaletteList.tsx +2 -2
- package/src/ComplexSelector/ComplexSelector.doc.mjs +42 -0
- package/src/ComplexSelector/ComplexSelector.test.tsx +64 -0
- package/src/ComplexSelector/ComplexSelector.tsx +46 -29
- package/src/ContextMenu/ContextMenu.doc.mjs +1 -1
- package/src/ContextMenu/ContextMenu.test.tsx +41 -0
- package/src/ContextMenu/ContextMenu.tsx +3 -3
- package/src/ContextMenu/index.ts +5 -1
- package/src/DateInput/DateInput.doc.mjs +18 -3
- package/src/DateInput/DateInput.test.tsx +93 -11
- package/src/DateInput/DateInput.tsx +41 -19
- package/src/DateRangeInput/DateRangeInput.doc.mjs +10 -2
- package/src/DateRangeInput/DateRangeInput.test.tsx +110 -14
- package/src/DateRangeInput/DateRangeInput.tsx +24 -12
- package/src/DateTimeInput/DateTimeInput.doc.mjs +16 -2
- package/src/DateTimeInput/DateTimeInput.test.tsx +75 -0
- package/src/DateTimeInput/DateTimeInput.tsx +35 -8
- package/src/Dialog/Dialog.tsx +2 -9
- package/src/DropdownMenu/DropdownMenu.doc.mjs +5 -9
- package/src/DropdownMenu/DropdownMenu.test.tsx +534 -4
- package/src/DropdownMenu/DropdownMenu.tsx +113 -52
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +27 -30
- package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +34 -0
- package/src/DropdownMenu/DropdownMenuDivider.tsx +81 -0
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +39 -4
- package/src/DropdownMenu/DropdownMenuItem.tsx +48 -10
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +30 -76
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +25 -19
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +44 -14
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +1 -5
- package/src/DropdownMenu/index.ts +8 -1
- package/src/DropdownMenu/renderDropdownItems.tsx +33 -34
- package/src/EmptyState/EmptyState.doc.mjs +4 -0
- package/src/EmptyState/EmptyState.test.tsx +62 -0
- package/src/EmptyState/EmptyState.tsx +16 -6
- package/src/Field/Field.doc.mjs +1 -0
- package/src/Field/InputClearButton.test.tsx +117 -0
- package/src/Field/InputClearButton.tsx +30 -3
- package/src/HoverCard/useHoverCard.tsx +2 -23
- package/src/Icon/Icon.doc.mjs +2 -1
- package/src/Indicator/CheckIndicator.tsx +174 -0
- package/src/Indicator/CheckboxIndicator.tsx +257 -0
- package/src/Indicator/Indicator.doc.mjs +344 -0
- package/src/Indicator/Indicator.test.tsx +393 -0
- package/src/Indicator/RadioIndicator.tsx +206 -0
- package/src/Indicator/index.ts +45 -0
- package/src/Indicator/indicator.markers.stylex.ts +19 -0
- package/src/Indicator/indicatorRegistry.test.tsx +106 -0
- package/src/Indicator/indicatorRegistry.ts +120 -0
- package/src/Indicator/types.ts +186 -0
- package/src/Indicator/useIndicator.ts +39 -0
- package/src/Item/Item.doc.mjs +1 -1
- package/src/Item/Item.tsx +7 -14
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +85 -0
- package/src/Layer/useLayer.tsx +39 -1
- package/src/Lightbox/Lightbox.doc.mjs +1 -1
- package/src/Lightbox/Lightbox.tsx +43 -38
- package/src/Link/Link.tsx +4 -11
- package/src/MobileNav/MobileNav.tsx +3 -3
- package/src/MoreMenu/MoreMenu.doc.mjs +31 -0
- package/src/MoreMenu/MoreMenu.test.tsx +68 -1
- package/src/MoreMenu/MoreMenu.tsx +19 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +9 -1
- package/src/MultiSelector/MultiSelector.test.tsx +255 -16
- package/src/MultiSelector/MultiSelector.tsx +103 -99
- package/src/NumberInput/NumberInput.doc.mjs +265 -50
- package/src/NumberInput/NumberInput.test.tsx +726 -21
- package/src/NumberInput/NumberInput.tsx +353 -59
- package/src/Outline/Outline.tsx +2 -5
- package/src/Pagination/Pagination.doc.mjs +1 -1
- package/src/Pagination/Pagination.test.tsx +22 -7
- package/src/Pagination/Pagination.tsx +38 -35
- package/src/Popover/Popover.tsx +6 -7
- package/src/PowerSearch/PowerSearch.tsx +1 -1
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +42 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +7 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +27 -5
- package/src/ProgressBar/ProgressBar.test.tsx +224 -1
- package/src/ProgressBar/ProgressBar.tsx +124 -22
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioListItem.tsx +31 -130
- package/src/Resizable/ResizeHandle.tsx +2 -9
- package/src/SegmentedControl/SegmentedControlItem.tsx +2 -9
- package/src/SelectableCard/SelectableCard.tsx +4 -9
- package/src/Selector/Selector.doc.mjs +7 -4
- package/src/Selector/Selector.test.tsx +935 -25
- package/src/Selector/Selector.tsx +189 -106
- package/src/Selector/hooks.ts +77 -50
- package/src/SideNav/SideNav.test.tsx +46 -0
- package/src/SideNav/SideNav.tsx +1 -0
- package/src/SideNav/SideNavCollapseButton.tsx +15 -10
- package/src/SideNav/SideNavHeading.tsx +48 -10
- package/src/SideNav/SideNavItem.tsx +20 -12
- package/src/Stack/Stack.doc.mjs +110 -0
- package/src/StatusDot/StatusDot.doc.mjs +12 -3
- package/src/Switch/Switch.test.tsx +32 -0
- package/src/Switch/Switch.tsx +8 -8
- package/src/TabList/Tab.tsx +2 -9
- package/src/TabList/TabMenu.tsx +14 -21
- package/src/Table/BaseTable.tsx +11 -0
- package/src/Table/index.ts +1 -4
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +30 -14
- package/src/Table/plugins/rowExpansion/index.ts +1 -4
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +125 -175
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +115 -458
- package/src/Table/plugins/sortable/useTableSortable.tsx +2 -6
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -24
- package/src/Table/tableContextMenu.test.tsx +27 -0
- package/src/Table/tableContextMenu.tsx +1 -0
- package/src/Table/types.ts +11 -0
- package/src/Table/useTableGroupedRows.doc.mjs +1 -1
- package/src/Table/useTableRowExpansion.doc.mjs +43 -66
- package/src/TextArea/TextArea.doc.mjs +42 -2
- package/src/TextArea/TextArea.test.tsx +219 -0
- package/src/TextArea/TextArea.tsx +34 -7
- package/src/TextInput/TextInput.doc.mjs +18 -2
- package/src/TextInput/TextInput.test.tsx +189 -0
- package/src/TextInput/TextInput.tsx +25 -31
- package/src/Thumbnail/Thumbnail.tsx +2 -9
- package/src/TimeInput/TimeInput.doc.mjs +2 -2
- package/src/TimeInput/TimeInput.test.tsx +30 -3
- package/src/TimeInput/TimeInput.tsx +9 -26
- package/src/Timestamp/Timestamp.doc.mjs +4 -3
- package/src/Timestamp/TimestampHoverCard.tsx +13 -35
- package/src/Token/Token.tsx +5 -28
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +45 -3
- package/src/Tokenizer/Tokenizer.tsx +10 -2
- package/src/Tooltip/useTooltip.tsx +2 -23
- package/src/TopNav/TopNav.tsx +1 -3
- package/src/TopNav/TopNavHeading.tsx +42 -13
- package/src/TopNav/TopNavItem.tsx +3 -21
- package/src/TopNav/TopNavMegaMenu.test.tsx +433 -33
- package/src/TopNav/TopNavMegaMenu.tsx +118 -53
- package/src/TopNav/TopNavMegaMenuItem.tsx +2 -9
- package/src/TopNav/TopNavMenu.tsx +34 -37
- package/src/TreeList/TreeList.doc.mjs +5 -0
- package/src/TreeList/TreeList.test.tsx +206 -7
- package/src/TreeList/TreeList.tsx +22 -0
- package/src/TreeList/TreeListBranches.tsx +25 -2
- package/src/TreeList/TreeListItem.tsx +89 -52
- package/src/Typeahead/BaseTypeahead.tsx +19 -6
- package/src/Typeahead/Typeahead.doc.mjs +1 -0
- package/src/Typeahead/Typeahead.test.tsx +76 -3
- package/src/hooks/containerReveal.stylex.ts +102 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useClipboard.doc.mjs +87 -0
- package/src/hooks/useClipboard.test.tsx +151 -0
- package/src/hooks/useClipboard.ts +135 -0
- package/src/hooks/useContainerReveal.doc.mjs +7 -7
- package/src/hooks/useContainerReveal.test.tsx +42 -62
- package/src/hooks/useContainerReveal.ts +36 -91
- package/src/hooks/useImageMode.test.ts +1 -1
- package/src/hooks/useIndicatorFocusRing.tsx +120 -0
- package/src/hooks/useLongPress.test.tsx +18 -0
- package/src/hooks/useLongPress.ts +12 -2
- package/src/hooks/useScrollLock.test.ts +72 -0
- package/src/hooks/useScrollLock.ts +51 -19
- package/src/hooks/useStreamingText.test.ts +46 -1
- package/src/hooks/useStreamingText.ts +49 -7
- package/src/hooks/useTreeFocus.test.tsx +50 -0
- package/src/hooks/useTreeFocus.ts +14 -3
- package/src/hooks/useTypeahead.test.tsx +150 -0
- package/src/hooks/useTypeahead.ts +24 -9
- package/src/i18n/InternationalizationProvider.doc.mjs +7 -2
- package/src/index.ts +1 -0
- package/src/theme/defineTheme.ts +24 -0
- package/src/theme/derivedVarRegistry.test.ts +21 -1
- package/src/theme/derivedVarRegistry.ts +19 -6
- package/src/theme/expandColorScale.test.ts +14 -0
- package/src/theme/expandColorScale.ts +24 -9
- package/src/theme/expandTypeScale.test.ts +43 -0
- package/src/theme/expandTypeScale.ts +17 -0
- package/src/theme/generateThemeRules.test.ts +61 -20
- package/src/theme/generateThemeRules.ts +11 -0
- package/src/theme/index.ts +13 -0
- package/src/utils/focusOutline.stylex.ts +163 -0
- package/src/utils/focusReturn.test.ts +42 -0
- package/src/utils/focusReturn.ts +31 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/mergeRefs.test.ts +48 -0
- package/src/utils/mergeRefs.ts +12 -6
- package/src/utils/rtlStyles.ts +2 -2
- package/src/utils/themeProps.ts +26 -4
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts +0 -9
- package/dist/CheckboxInput/checkbox.markers.stylex.d.ts.map +0 -1
- package/dist/CheckboxInput/checkbox.markers.stylex.js +0 -14
- package/dist/RadioList/radio.markers.stylex.d.ts +0 -7
- package/dist/RadioList/radio.markers.stylex.d.ts.map +0 -1
- package/dist/RadioList/radio.markers.stylex.js +0 -12
- package/dist/hooks/containerReveal.pool.stylex.d.ts +0 -303
- package/dist/hooks/containerReveal.pool.stylex.d.ts.map +0 -1
- package/dist/hooks/containerReveal.pool.stylex.js +0 -292
- package/src/CheckboxInput/checkbox.markers.stylex.ts +0 -12
- package/src/RadioList/radio.markers.stylex.ts +0 -10
- package/src/hooks/containerReveal.pool.stylex.ts +0 -571
|
@@ -158,13 +158,21 @@ export function expandColorScale(config) {
|
|
|
158
158
|
const textSecondaryLightTone = isHigh ? 20 : 30;
|
|
159
159
|
const textSecondaryDarkTone = isHigh ? 80 : 70;
|
|
160
160
|
|
|
161
|
+
// Borders track contrast the same way text does: high contrast pulls the
|
|
162
|
+
// emphasized border tone toward mid-scale (stronger against both the near-
|
|
163
|
+
// white light surface and the near-black dark surface) and thickens the
|
|
164
|
+
// otherwise-decorative subtle hairline by doubling its alpha, so structural
|
|
165
|
+
// boundaries stay perceivable for users who opt into high contrast.
|
|
166
|
+
const borderSubtleAlpha = isHigh ? 0.2 : 0.1;
|
|
167
|
+
|
|
161
168
|
// Emphasized borders outline form controls (CheckboxInput, Selector), so
|
|
162
169
|
// they are non-text UI boundaries under WCAG 1.4.11 and must reach 3:1
|
|
163
|
-
// against the surface they sit on.
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
const
|
|
170
|
+
// against the surface they sit on. High contrast starts at a more
|
|
171
|
+
// aggressive tone (50 vs 70/30), guaranteeing a stronger result; standard
|
|
172
|
+
// contrast starts at 70/30 and walks toward mid-scale only as far as needed.
|
|
173
|
+
const borderEmphasizedStartLight = isHigh ? 50 : 70;
|
|
174
|
+
const borderEmphasizedStartDark = isHigh ? 50 : 30;
|
|
175
|
+
const borderEmphasized = ld(ensureContrastTone(seedHue, neutralVariantChroma, borderEmphasizedStartLight, -1, N[99], NON_TEXT_MIN_CONTRAST), ensureContrastTone(seedHue, neutralVariantChroma, borderEmphasizedStartDark, 1, N[10], NON_TEXT_MIN_CONTRAST));
|
|
168
176
|
return {
|
|
169
177
|
// Core semantic — only with a seed accent. Without one these fall through
|
|
170
178
|
// to colorDefaults, whose --color-accent is NOT what the default seed
|
|
@@ -202,8 +210,10 @@ export function expandColorScale(config) {
|
|
|
202
210
|
'--color-background-popover': ld(N[99], N[20]),
|
|
203
211
|
'--color-background-inverted': ld(N[10], N[99]),
|
|
204
212
|
// Border
|
|
205
|
-
//
|
|
206
|
-
|
|
213
|
+
// Border
|
|
214
|
+
// Decorative hairline — not a WCAG 1.4.11 boundary. High contrast
|
|
215
|
+
// doubles the alpha so structural boundaries stay perceivable.
|
|
216
|
+
'--color-border': ld(hexWithAlpha(N[10], borderSubtleAlpha), hexWithAlpha(N[95], borderSubtleAlpha)),
|
|
207
217
|
'--color-border-emphasized': borderEmphasized,
|
|
208
218
|
// Effects
|
|
209
219
|
'--color-skeleton': ld(NV[70], NV[30]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandTypeScale.d.ts","sourceRoot":"","sources":["../../src/theme/expandTypeScale.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAC/C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,MAAM,CACF,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,YAAY,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,CAAC,MAAM,GAAG,EAAE,CAAC,EACf,eAAe,CAChB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,CAAC,EAAE;QACR,yEAAyE;QACzE,OAAO,CAAC,EAAE,sBAAsB,CAAC;QACjC,oEAAoE;QACpE,IAAI,CAAC,EAAE,mBAAmB,CAAC;KAC5B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM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GG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAwIrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CA+CxE;AAiBD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,eAAe,GACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAmDxD"}
|
|
@@ -332,6 +332,23 @@ export function generateTypeScaleComponents(_config) {
|
|
|
332
332
|
lineHeight: `var(--text-heading-${level}-leading)`
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
|
+
// `Heading` renders both a `level:N` and, when set, a `type:display-N`
|
|
336
|
+
// visual-prop class simultaneously (type sizing takes precedence over
|
|
337
|
+
// level sizing — see Heading.tsx's own `type ? sizeByTypeStyles[type] :
|
|
338
|
+
// sizeByLevelStyles[level]`). Without a `type:display-N` rule here, the
|
|
339
|
+
// `level:N` rule is the only one that matches, so it silently wins
|
|
340
|
+
// regardless of `type` once a theme supplies a type scale. Emitting these
|
|
341
|
+
// after the level rules keeps them later in source order, so they take
|
|
342
|
+
// precedence at equal specificity, matching the component's own logic.
|
|
343
|
+
// fontWeight is intentionally omitted, mirroring the `text` branch below
|
|
344
|
+
// and preserving `defaultWeightByTypeStyles`.
|
|
345
|
+
for (const type of ['display-1', 'display-2', 'display-3']) {
|
|
346
|
+
headingRules[`type:${type}`] = {
|
|
347
|
+
fontFamily: 'var(--font-family-heading)',
|
|
348
|
+
fontSize: `var(--text-${type}-size)`,
|
|
349
|
+
lineHeight: `var(--text-${type}-leading)`
|
|
350
|
+
};
|
|
351
|
+
}
|
|
335
352
|
components.heading = headingRules;
|
|
336
353
|
const textRules = {};
|
|
337
354
|
for (const type of ['body', 'large', 'label', 'code', 'supporting', 'display-1', 'display-2', 'display-3']) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AA+DhD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAgKD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAoChE;
|
|
1
|
+
{"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AA+DhD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAgKD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAoChE;AAmQD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAe5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA4E9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CA2BpE"}
|
|
@@ -288,9 +288,11 @@ function generateComponentRules(components, parts) {
|
|
|
288
288
|
// Entries are processed in order (priority).
|
|
289
289
|
// - `vars`: emit internal CSS custom property declarations
|
|
290
290
|
// - `expand: 'container'`: expand padding to container layout tokens
|
|
291
|
+
// - `replaces: true`: emit only the var, dropping the source property
|
|
291
292
|
let finalProps = props;
|
|
292
293
|
const derivedProps = [];
|
|
293
294
|
let containerExpanded = false;
|
|
295
|
+
const replacedProps = new Set();
|
|
294
296
|
for (const [prop, value] of props) {
|
|
295
297
|
const derived = getDerivedVars(component, prop);
|
|
296
298
|
// Padding longhands (paddingBlock, paddingInline, etc.) also
|
|
@@ -300,6 +302,9 @@ function generateComponentRules(components, parts) {
|
|
|
300
302
|
if (entry.expand === 'container' && PADDING_PROPS.has(prop)) {
|
|
301
303
|
containerExpanded = true;
|
|
302
304
|
}
|
|
305
|
+
if (entry.replaces) {
|
|
306
|
+
replacedProps.add(prop);
|
|
307
|
+
}
|
|
303
308
|
if (entry.vars) {
|
|
304
309
|
for (const varName of entry.vars) {
|
|
305
310
|
derivedProps.push([varName, value]);
|
|
@@ -317,6 +322,12 @@ function generateComponentRules(components, parts) {
|
|
|
317
322
|
const containerTokens = expandContainerPadding(component, parsed);
|
|
318
323
|
finalProps = [...nonPaddingProps, ...containerTokens];
|
|
319
324
|
}
|
|
325
|
+
|
|
326
|
+
// Drop properties whose derived entry set `replaces` — their value is
|
|
327
|
+
// carried by the emitted var and must not land on the class element.
|
|
328
|
+
if (replacedProps.size > 0) {
|
|
329
|
+
finalProps = finalProps.filter(([p]) => !replacedProps.has(p));
|
|
330
|
+
}
|
|
320
331
|
if (derivedProps.length > 0) {
|
|
321
332
|
finalProps = [...finalProps, ...derivedProps];
|
|
322
333
|
}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { colorDefaults, spacingDefaults, sizeDefaults, borderDefaults, radiusDef
|
|
|
34
34
|
export type { ColorVarName, SpacingVarName, SizeVarName, BorderVarName, RadiusVarName, ShadowVarName, DurationVarName, EaseVarName, TypographyVarName, TextSizeVarName, FontWeightVarName, TypeScaleVarName, } from './tokens.stylex';
|
|
35
35
|
export { useTheme, useThemeName, ThemeContext } from './useTheme';
|
|
36
36
|
export type { UseThemeReturn, ThemeContextValue } from './useTheme';
|
|
37
|
+
export type { IndicatorComponent, IndicatorFamily, IndicatorFamilyMap, IndicatorMap, IndicatorName, IndicatorNameOfFamily, IndicatorProps, IndicatorRegistry, IndicatorSize, IndicatorState, } from '../Indicator';
|
|
37
38
|
export { resolveThemeToken, resolveThemeTokens, tokenVar, tokenVars, } from './tokens';
|
|
38
39
|
export type { ResolveThemeTokenOptions, ResolveThemeTokensOptions, ResolvedThemeMode, } from './tokens';
|
|
39
40
|
export type { TextColorMap } from '../Text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,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ACd,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,YAAY,CAAC;AAChE,YAAY,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,EACf,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC3C,YAAY,EACV,qBAAqB,EACrB,gBA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Y,EAAE,YAAY,EAAC,MAAM,YAAY,CAAC;AAChE,YAAY,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAElE,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,YAAY,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAC1C,YAAY,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,eAAe,EACf,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file focusOutline.stylex.ts
|
|
3
|
+
* @input Uses StyleX and theme color tokens
|
|
4
|
+
* @output Exports shared focus-outline prop builders
|
|
5
|
+
* @position Internal utility for consistent keyboard focus outlines across core components
|
|
6
|
+
*
|
|
7
|
+
* Centralizes the standard Astryx focus outline, shown only for keyboard focus.
|
|
8
|
+
* Every focusable surface drew the same 2px accent ring at 2px offset already;
|
|
9
|
+
* writing it per component meant five identical definitions to keep in step.
|
|
10
|
+
*
|
|
11
|
+
* These are utility styles, deliberately NOT a theme target. A shared
|
|
12
|
+
* `astryx-focus-outline` class was tried and pulled: a theme can only override
|
|
13
|
+
* the ring unconditionally through it (`generateThemeRules` mangles
|
|
14
|
+
* `:focus-visible` into `.focus-visible` and truncates `:has(:focus-visible)`
|
|
15
|
+
* at the paren), so the one thing such a target exists for — restyling a
|
|
16
|
+
* STATE — is exactly what it cannot express. Making focus outlines themeable
|
|
17
|
+
* is worth doing on top of this consolidation, once that is fixed.
|
|
18
|
+
*/
|
|
19
|
+
import * as stylex from '@stylexjs/stylex';
|
|
20
|
+
/**
|
|
21
|
+
* The standard focus ring as plain CSS values, for the one case that has to
|
|
22
|
+
* apply it imperatively: a control whose focusable input is visually hidden and
|
|
23
|
+
* whose ring must land on a *themeable indicator* beside it (see
|
|
24
|
+
* `useIndicatorFocusRing`). Everything else should use the styles above.
|
|
25
|
+
*
|
|
26
|
+
* Longhands, not the `outline` shorthand, for the same reason the styles are:
|
|
27
|
+
* a shorthand resets every longhand it covers, so a caller could not re-color
|
|
28
|
+
* the ring without restating its width and style. Split, each part is
|
|
29
|
+
* independently overridable — and `--color-accent` stays a var, so a theme's
|
|
30
|
+
* accent still flows through.
|
|
31
|
+
*
|
|
32
|
+
* Keys are camelCase to match `HTMLElement.style`, so this spreads straight
|
|
33
|
+
* onto an element:
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* Object.assign(el.style, FOCUS_OUTLINE_PARTS); // draw
|
|
37
|
+
* Object.assign(el.style, FOCUS_OUTLINE_PARTS_NONE); // clear
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const FOCUS_OUTLINE_PARTS: {
|
|
41
|
+
readonly outlineWidth: "2px";
|
|
42
|
+
readonly outlineStyle: "solid";
|
|
43
|
+
readonly outlineColor: stylex.StyleXVar<"light-dark(#0064E0, #2694FE)">;
|
|
44
|
+
readonly outlineOffset: "3px";
|
|
45
|
+
};
|
|
46
|
+
/** Clears {@link FOCUS_OUTLINE_PARTS}, one key per part so nothing lingers. */
|
|
47
|
+
export declare const FOCUS_OUTLINE_PARTS_NONE: {
|
|
48
|
+
readonly outlineWidth: "";
|
|
49
|
+
readonly outlineStyle: "";
|
|
50
|
+
readonly outlineColor: "";
|
|
51
|
+
readonly outlineOffset: "";
|
|
52
|
+
};
|
|
53
|
+
export declare const focusOutlineStyles: Readonly<{
|
|
54
|
+
readonly focusVisible: Readonly<{
|
|
55
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", "0" | "2px">;
|
|
56
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
|
|
57
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", "light-dark(#0064E0, #2694FE)" | null>;
|
|
58
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "0" | "3px">;
|
|
59
|
+
}>;
|
|
60
|
+
readonly focusWithin: Readonly<{
|
|
61
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", "0" | "2px">;
|
|
62
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
|
|
63
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", "light-dark(#0064E0, #2694FE)" | null>;
|
|
64
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "0" | "3px">;
|
|
65
|
+
}>;
|
|
66
|
+
readonly publishFocusVisibleVars: Readonly<{
|
|
67
|
+
readonly '--_focus-outline': stylex.StyleXClassNameFor<"--_focus-outline", "none" | `2px solid ${stylex.StyleXVar<"light-dark(#0064E0, #2694FE)">}`>;
|
|
68
|
+
readonly '--_focus-outline-offset': stylex.StyleXClassNameFor<"--_focus-outline-offset", "0" | "3px">;
|
|
69
|
+
}>;
|
|
70
|
+
readonly focusWithinOrPublished: Readonly<{
|
|
71
|
+
readonly outline: stylex.StyleXClassNameFor<"outline", `2px solid ${stylex.StyleXVar<"light-dark(#0064E0, #2694FE)">}` | "var(--_focus-outline, none)">;
|
|
72
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "3px" | "var(--_focus-outline-offset, 0)">;
|
|
73
|
+
}>;
|
|
74
|
+
}>;
|
|
75
|
+
type StyleXPropsArg = unknown;
|
|
76
|
+
export declare const focusOutlineProps: {
|
|
77
|
+
readonly focusVisible: (...styles: StyleXPropsArg[]) => Readonly<{
|
|
78
|
+
className?: string;
|
|
79
|
+
'data-style-src'?: string;
|
|
80
|
+
style?: Readonly<{
|
|
81
|
+
[$$Key$$: string]: string | number;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
84
|
+
readonly focusWithin: (...styles: StyleXPropsArg[]) => Readonly<{
|
|
85
|
+
className?: string;
|
|
86
|
+
'data-style-src'?: string;
|
|
87
|
+
style?: Readonly<{
|
|
88
|
+
[$$Key$$: string]: string | number;
|
|
89
|
+
}>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly publishFocusVisibleVars: (...styles: StyleXPropsArg[]) => Readonly<{
|
|
92
|
+
className?: string;
|
|
93
|
+
'data-style-src'?: string;
|
|
94
|
+
style?: Readonly<{
|
|
95
|
+
[$$Key$$: string]: string | number;
|
|
96
|
+
}>;
|
|
97
|
+
}>;
|
|
98
|
+
readonly focusWithinOrPublished: (...styles: StyleXPropsArg[]) => Readonly<{
|
|
99
|
+
className?: string;
|
|
100
|
+
'data-style-src'?: string;
|
|
101
|
+
style?: Readonly<{
|
|
102
|
+
[$$Key$$: string]: string | number;
|
|
103
|
+
}>;
|
|
104
|
+
}>;
|
|
105
|
+
};
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=focusOutline.stylex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusOutline.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/focusOutline.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAyB3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB;;;;;CAK3B,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;EAmD7B,CAAC;AAIH,KAAK,cAAc,GAAG,OAAO,CAAC;AAiB9B,eAAO,MAAM,iBAAiB;uCAdT,cAAc,EAAE;;;;;;;sCAAhB,cAAc,EAAE;;;;;;;kDAAhB,cAAc,EAAE;;;;;;;iDAAhB,cAAc,EAAE;;;;;;;CAuB3B,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file focusOutline.stylex.ts
|
|
5
|
+
* @input Uses StyleX and theme color tokens
|
|
6
|
+
* @output Exports shared focus-outline prop builders
|
|
7
|
+
* @position Internal utility for consistent keyboard focus outlines across core components
|
|
8
|
+
*
|
|
9
|
+
* Centralizes the standard Astryx focus outline, shown only for keyboard focus.
|
|
10
|
+
* Every focusable surface drew the same 2px accent ring at 2px offset already;
|
|
11
|
+
* writing it per component meant five identical definitions to keep in step.
|
|
12
|
+
*
|
|
13
|
+
* These are utility styles, deliberately NOT a theme target. A shared
|
|
14
|
+
* `astryx-focus-outline` class was tried and pulled: a theme can only override
|
|
15
|
+
* the ring unconditionally through it (`generateThemeRules` mangles
|
|
16
|
+
* `:focus-visible` into `.focus-visible` and truncates `:has(:focus-visible)`
|
|
17
|
+
* at the paren), so the one thing such a target exists for — restyling a
|
|
18
|
+
* STATE — is exactly what it cannot express. Making focus outlines themeable
|
|
19
|
+
* is worth doing on top of this consolidation, once that is fixed.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import * as stylex from '@stylexjs/stylex';
|
|
23
|
+
import "../theme/tokens.stylex.js";
|
|
24
|
+
import { colorVars } from "../theme/tokens.stylex.js";
|
|
25
|
+
const FOCUS_OUTLINE_WIDTH = '2px';
|
|
26
|
+
// 3px, per Design Conventions §User Interaction States: "2px --color-accent
|
|
27
|
+
// outline at 3px offset". Most components had drifted to 2px; Button, Calendar,
|
|
28
|
+
// Dialog and Pagination were the ones matching the spec, so the consolidation
|
|
29
|
+
// takes their value rather than the majority's.
|
|
30
|
+
const FOCUS_OUTLINE_OFFSET = '3px';
|
|
31
|
+
const FOCUS_OUTLINE_COLOR = colorVars['--color-accent'];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Written as longhands rather than the `outline` shorthand.
|
|
35
|
+
*
|
|
36
|
+
* A shorthand resets every longhand it covers, so `outline: 2px solid accent`
|
|
37
|
+
* would clobber a later `outlineColor` no matter the order — which is how
|
|
38
|
+
* destructive buttons silently lost their red ring. With longhands, a variant
|
|
39
|
+
* can re-color the ring and inherit width, style and offset.
|
|
40
|
+
*/
|
|
41
|
+
const focusOutlineLonghands = {
|
|
42
|
+
outlineWidth: FOCUS_OUTLINE_WIDTH,
|
|
43
|
+
outlineStyle: 'solid',
|
|
44
|
+
outlineColor: FOCUS_OUTLINE_COLOR
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The standard focus ring as plain CSS values, for the one case that has to
|
|
49
|
+
* apply it imperatively: a control whose focusable input is visually hidden and
|
|
50
|
+
* whose ring must land on a *themeable indicator* beside it (see
|
|
51
|
+
* `useIndicatorFocusRing`). Everything else should use the styles above.
|
|
52
|
+
*
|
|
53
|
+
* Longhands, not the `outline` shorthand, for the same reason the styles are:
|
|
54
|
+
* a shorthand resets every longhand it covers, so a caller could not re-color
|
|
55
|
+
* the ring without restating its width and style. Split, each part is
|
|
56
|
+
* independently overridable — and `--color-accent` stays a var, so a theme's
|
|
57
|
+
* accent still flows through.
|
|
58
|
+
*
|
|
59
|
+
* Keys are camelCase to match `HTMLElement.style`, so this spreads straight
|
|
60
|
+
* onto an element:
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* Object.assign(el.style, FOCUS_OUTLINE_PARTS); // draw
|
|
64
|
+
* Object.assign(el.style, FOCUS_OUTLINE_PARTS_NONE); // clear
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export const FOCUS_OUTLINE_PARTS = {
|
|
68
|
+
outlineWidth: FOCUS_OUTLINE_WIDTH,
|
|
69
|
+
outlineStyle: 'solid',
|
|
70
|
+
outlineColor: FOCUS_OUTLINE_COLOR,
|
|
71
|
+
outlineOffset: FOCUS_OUTLINE_OFFSET
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Clears {@link FOCUS_OUTLINE_PARTS}, one key per part so nothing lingers. */
|
|
75
|
+
export const FOCUS_OUTLINE_PARTS_NONE = {
|
|
76
|
+
outlineWidth: '',
|
|
77
|
+
outlineStyle: '',
|
|
78
|
+
outlineColor: '',
|
|
79
|
+
outlineOffset: ''
|
|
80
|
+
};
|
|
81
|
+
export const focusOutlineStyles = {
|
|
82
|
+
focusVisible: {
|
|
83
|
+
kMeerF: "x1k57tk5 x784prv",
|
|
84
|
+
k3XXqK: "x1t137rt x9v5kkp",
|
|
85
|
+
kjBf7l: "xzunyri",
|
|
86
|
+
kInvED: "x1wfwxd8 xj3ae5l",
|
|
87
|
+
$$css: true
|
|
88
|
+
},
|
|
89
|
+
focusWithin: {
|
|
90
|
+
kMeerF: "x1k57tk5 x1odlxkb",
|
|
91
|
+
k3XXqK: "x1t137rt xnnj0qo",
|
|
92
|
+
kjBf7l: "xee0hk0",
|
|
93
|
+
kInvED: "x1wfwxd8 xscfbxq",
|
|
94
|
+
$$css: true
|
|
95
|
+
},
|
|
96
|
+
publishFocusVisibleVars: {
|
|
97
|
+
"--_focus-outline": "x17wzz1v x1bqhfga",
|
|
98
|
+
"--_focus-outline-offset": "xgzxwq1 x1tcr69y",
|
|
99
|
+
$$css: true
|
|
100
|
+
},
|
|
101
|
+
focusWithinOrPublished: {
|
|
102
|
+
kI3sdo: "xaw4jrz x1irc7jg",
|
|
103
|
+
kInvED: "x1kvmbwa xscfbxq",
|
|
104
|
+
$$css: true
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// StyleX does not expose a stable public input type for stylex.props();
|
|
109
|
+
// keep this helper permissive so it mirrors stylex.props() itself.
|
|
110
|
+
|
|
111
|
+
function makeFocusOutlineProps(style) {
|
|
112
|
+
return (...styles) =>
|
|
113
|
+
// Caller styles LAST, so a component can deliberately re-color its ring —
|
|
114
|
+
// destructive buttons ring in error red, not accent. StyleX is last-wins,
|
|
115
|
+
// and reversing this to protect the ring silently ate that override.
|
|
116
|
+
//
|
|
117
|
+
// The hazard in this direction is the opposite one: a caller whose base
|
|
118
|
+
// style carries `outline: 'none'` wipes the ring out entirely (TreeList
|
|
119
|
+
// did, and shipped a focusable row with no visible focus). Two things
|
|
120
|
+
// guard it — this file states the rule, and the ring is written as
|
|
121
|
+
// LONGHANDS, so an override has to name `outlineStyle`/`outlineWidth`
|
|
122
|
+
// explicitly rather than erasing them through the `outline` shorthand.
|
|
123
|
+
stylex.props(style, ...styles);
|
|
124
|
+
}
|
|
125
|
+
export const focusOutlineProps = {
|
|
126
|
+
focusVisible: makeFocusOutlineProps(focusOutlineStyles.focusVisible),
|
|
127
|
+
focusWithin: makeFocusOutlineProps(focusOutlineStyles.focusWithin),
|
|
128
|
+
publishFocusVisibleVars: makeFocusOutlineProps(focusOutlineStyles.publishFocusVisibleVars),
|
|
129
|
+
focusWithinOrPublished: makeFocusOutlineProps(focusOutlineStyles.focusWithinOrPublished)
|
|
130
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file focusReturn.ts
|
|
3
|
+
* @input The document's current active element.
|
|
4
|
+
* @output Whether focus is currently "detached" — on nothing in particular.
|
|
5
|
+
* @position Utility; used by overlay triggers (e.g. DateInput, DateTimeInput)
|
|
6
|
+
* that return focus to their control when the overlay closes, but only when
|
|
7
|
+
* the dismiss did not already move focus somewhere the user chose.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* True when focus rests on nothing in particular — no active element, or the
|
|
11
|
+
* document body / root element.
|
|
12
|
+
*
|
|
13
|
+
* An overlay (popover, calendar, dropdown) that restores focus to its trigger
|
|
14
|
+
* on close should do so ONLY when this is true. A native `popover="auto"`
|
|
15
|
+
* light-dismiss fires its close synchronously with the pointer event that
|
|
16
|
+
* moved focus, so by the time the close handler runs, focus has already
|
|
17
|
+
* landed on whatever the user clicked — another field, a button, anywhere.
|
|
18
|
+
* Restoring focus unconditionally would yank it back and fight that click.
|
|
19
|
+
* The one case the browser leaves unresolved is Escape or a click on
|
|
20
|
+
* non-focusable empty space, which drops focus to the body; that is exactly
|
|
21
|
+
* when the trigger should reclaim it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isFocusDetached(doc?: Document): boolean;
|
|
24
|
+
//# sourceMappingURL=focusReturn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusReturn.d.ts","sourceRoot":"","sources":["../../src/utils/focusReturn.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,QAAmB,GAAG,OAAO,CAKjE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file focusReturn.ts
|
|
5
|
+
* @input The document's current active element.
|
|
6
|
+
* @output Whether focus is currently "detached" — on nothing in particular.
|
|
7
|
+
* @position Utility; used by overlay triggers (e.g. DateInput, DateTimeInput)
|
|
8
|
+
* that return focus to their control when the overlay closes, but only when
|
|
9
|
+
* the dismiss did not already move focus somewhere the user chose.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* True when focus rests on nothing in particular — no active element, or the
|
|
14
|
+
* document body / root element.
|
|
15
|
+
*
|
|
16
|
+
* An overlay (popover, calendar, dropdown) that restores focus to its trigger
|
|
17
|
+
* on close should do so ONLY when this is true. A native `popover="auto"`
|
|
18
|
+
* light-dismiss fires its close synchronously with the pointer event that
|
|
19
|
+
* moved focus, so by the time the close handler runs, focus has already
|
|
20
|
+
* landed on whatever the user clicked — another field, a button, anywhere.
|
|
21
|
+
* Restoring focus unconditionally would yank it back and fight that click.
|
|
22
|
+
* The one case the browser leaves unresolved is Escape or a click on
|
|
23
|
+
* non-focusable empty space, which drops focus to the body; that is exactly
|
|
24
|
+
* when the trigger should reclaim it.
|
|
25
|
+
*/
|
|
26
|
+
export function isFocusDetached(doc = document) {
|
|
27
|
+
const active = doc.activeElement;
|
|
28
|
+
return active == null || active === doc.body || active === doc.documentElement;
|
|
29
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { parseStyleKey } from './parseStyleKey';
|
|
|
15
15
|
export { getKey, type Key, type KeyFallback } from './getKey';
|
|
16
16
|
export { mergeProps } from './mergeProps';
|
|
17
17
|
export { mergeRefs } from './mergeRefs';
|
|
18
|
+
export { isFocusDetached } from './focusReturn';
|
|
18
19
|
export { composeEventHandlers } from './composeEventHandlers';
|
|
19
20
|
export { themeProps, themeDataAttributes } from './themeProps';
|
|
20
21
|
export type { ClassValue, ClassProps, ThemeDataAttributes, ThemeProps, } from './themeProps';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,YAAY,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC,YAAY,EAAC,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAEhF,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,k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
|
package/dist/utils/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { parseStyleKey } from "./parseStyleKey.js";
|
|
|
14
14
|
export { getKey } from "./getKey.js";
|
|
15
15
|
export { mergeProps } from "./mergeProps.js";
|
|
16
16
|
export { mergeRefs } from "./mergeRefs.js";
|
|
17
|
+
export { isFocusDetached } from "./focusReturn.js";
|
|
17
18
|
export { composeEventHandlers } from "./composeEventHandlers.js";
|
|
18
19
|
export { themeProps, themeDataAttributes } from "./themeProps.js";
|
|
19
20
|
export { groupItems, getItemGroup } from "./groupItems.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeRefs.d.ts","sourceRoot":"","sources":["../../src/utils/mergeRefs.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAE5C,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"mergeRefs.d.ts","sourceRoot":"","sources":["../../src/utils/mergeRefs.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAE5C,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAyB5E"}
|
package/dist/utils/mergeRefs.js
CHANGED
|
@@ -14,14 +14,16 @@ export function mergeRefs(...refs) {
|
|
|
14
14
|
for (const ref of refs) {
|
|
15
15
|
if (typeof ref === 'function') {
|
|
16
16
|
const cleanup = ref(value);
|
|
17
|
-
|
|
18
|
-
cleanups.push(cleanup);
|
|
19
|
-
}
|
|
17
|
+
cleanups.push(typeof cleanup === 'function' ? cleanup : () => ref(null));
|
|
20
18
|
} else if (ref != null) {
|
|
21
|
-
|
|
19
|
+
const mutableRef = ref;
|
|
20
|
+
mutableRef.current = value;
|
|
21
|
+
cleanups.push(() => {
|
|
22
|
+
mutableRef.current = null;
|
|
23
|
+
});
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
if (cleanups.length > 0) {
|
|
26
|
+
if (value != null && cleanups.length > 0) {
|
|
25
27
|
return () => {
|
|
26
28
|
for (const cleanup of cleanups) {
|
|
27
29
|
cleanup();
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file rtlStyles.ts
|
|
3
3
|
* @input None
|
|
4
4
|
* @output Shared StyleX style that horizontally mirrors an element under RTL
|
|
5
|
-
* @position Core utility; applied to directional
|
|
6
|
-
*
|
|
5
|
+
* @position Core utility; applied to directional icons in Calendar, Lightbox,
|
|
6
|
+
* Pagination, Carousel and the Table expand/disclosure plugins
|
|
7
7
|
*
|
|
8
8
|
* `mirror` flips its element on the horizontal axis only when an ancestor
|
|
9
9
|
* carries `dir="rtl"`. Using `scaleX(-1)` (not `scale(-1, -1)`) keeps the
|
package/dist/utils/rtlStyles.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @file rtlStyles.ts
|
|
5
5
|
* @input None
|
|
6
6
|
* @output Shared StyleX style that horizontally mirrors an element under RTL
|
|
7
|
-
* @position Core utility; applied to directional
|
|
8
|
-
*
|
|
7
|
+
* @position Core utility; applied to directional icons in Calendar, Lightbox,
|
|
8
|
+
* Pagination, Carousel and the Table expand/disclosure plugins
|
|
9
9
|
*
|
|
10
10
|
* `mirror` flips its element on the horizontal axis only when an ancestor
|
|
11
11
|
* carries `dir="rtl"`. Using `scaleX(-1)` (not `scale(-1, -1)`) keeps the
|
|
@@ -24,5 +24,24 @@ export declare function themeDataAttributes(props?: ClassProps): ThemeDataAttrib
|
|
|
24
24
|
* // → { className: 'astryx-button primary sm', data-variant: 'primary', data-size: 'sm' }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Options for {@link themeProps}.
|
|
29
|
+
*/
|
|
30
|
+
export type ThemePropsOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Stable class names to emit ALONGSIDE the component's own, for targets that
|
|
33
|
+
* have been renamed.
|
|
34
|
+
*
|
|
35
|
+
* A theme target is public API: renaming one silently breaks every theme
|
|
36
|
+
* that styles it. Emitting the old name beside the new one keeps those
|
|
37
|
+
* themes working through a deprecation window, at the cost of one extra
|
|
38
|
+
* class on the element until the old name is dropped in a major.
|
|
39
|
+
*
|
|
40
|
+
* Pass plain string literals — the theming guards scan for them statically.
|
|
41
|
+
* Document the old name with `deprecated` in the component's
|
|
42
|
+
* `theming.targets` so the docsite says which to use.
|
|
43
|
+
*/
|
|
44
|
+
legacyNames?: ReadonlyArray<string>;
|
|
45
|
+
};
|
|
46
|
+
export declare function themeProps(component: string, props?: ClassProps, options?: ThemePropsOptions): ThemeProps;
|
|
28
47
|
//# sourceMappingURL=themeProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeProps.d.ts","sourceRoot":"","sources":["../../src/utils/themeProps.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,GAAG,mBAAmB,CAAC;AA6DnE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"themeProps.d.ts","sourceRoot":"","sources":["../../src/utils/themeProps.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,GAAG,mBAAmB,CAAC;AA6DnE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,mBAAmB,CAa3E;AAED;;;;;;;;;;;GAWG;AACH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,UAAU,CAQZ"}
|
package/dist/utils/themeProps.js
CHANGED
|
@@ -89,9 +89,15 @@ export function themeDataAttributes(props) {
|
|
|
89
89
|
* // → { className: 'astryx-button primary sm', data-variant: 'primary', data-size: 'sm' }
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Options for {@link themeProps}.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
export function themeProps(component, props, options) {
|
|
97
|
+
const className = buildClassName(component, props);
|
|
98
|
+
const legacy = options?.legacyNames?.map(name => stableClassName(name)) ?? [];
|
|
93
99
|
return {
|
|
94
|
-
className:
|
|
100
|
+
className: legacy.length > 0 ? [className, ...legacy].join(' ') : className,
|
|
95
101
|
...themeDataAttributes(props)
|
|
96
102
|
};
|
|
97
103
|
}
|
package/locales/en.json
CHANGED
|
@@ -867,6 +867,14 @@
|
|
|
867
867
|
"defaultMessage": "Clear {label}",
|
|
868
868
|
"description": "Screen-reader-only label on the X that clears the value from a NumberInput. Example: `Clear Age`, `Clear Quantity`."
|
|
869
869
|
},
|
|
870
|
+
"@astryx.numberInput.decrementLabel": {
|
|
871
|
+
"defaultMessage": "Decrement {label}",
|
|
872
|
+
"description": "Accessible label for the NumberInput button that decreases the value by one configured step. Example: `Decrement Quantity`."
|
|
873
|
+
},
|
|
874
|
+
"@astryx.numberInput.incrementLabel": {
|
|
875
|
+
"defaultMessage": "Increment {label}",
|
|
876
|
+
"description": "Accessible label for the NumberInput button that increases the value by one configured step. Example: `Increment Quantity`."
|
|
877
|
+
},
|
|
870
878
|
"@astryx.selector.clearLabel": {
|
|
871
879
|
"defaultMessage": "Clear {label}",
|
|
872
880
|
"description": "Screen-reader-only label on the X that clears the selected value from a Selector. `{label}` is the selector's visible label — example: `Clear Country`."
|
|
@@ -923,6 +931,10 @@
|
|
|
923
931
|
"defaultMessage": "Go to step {stepNumber, number}: {label}, {status}",
|
|
924
932
|
"description": "Accessible name for a clickable lab Stepper step that also carries a status. {status} is one of the translated `step.status.*` words (completed/warning/error). Keep the pattern parallel to `step.goToStep`."
|
|
925
933
|
},
|
|
934
|
+
"@astryx.step.optional": {
|
|
935
|
+
"defaultMessage": "Optional",
|
|
936
|
+
"description": "Visible indicator appended after a lab Stepper step's label when the step is optional (isOptional). Very short; appears inline after the label text."
|
|
937
|
+
},
|
|
926
938
|
"@astryx.step.status.completed": {
|
|
927
939
|
"defaultMessage": "completed",
|
|
928
940
|
"description": "Screen-reader-only status word rendered next to a lab Stepper step label when the step is done (either progress-completed or status=success). Lowercase adjective; it is read mid-sentence after the step label."
|
package/locales/pseudo.json
CHANGED
|
@@ -650,6 +650,12 @@
|
|
|
650
650
|
"@astryx.numberInput.clearLabel": {
|
|
651
651
|
"defaultMessage": "⟦Çłéàř {label}⟧"
|
|
652
652
|
},
|
|
653
|
+
"@astryx.numberInput.decrementLabel": {
|
|
654
|
+
"defaultMessage": "⟦Ðéçřéɱéñţ {label}⟧"
|
|
655
|
+
},
|
|
656
|
+
"@astryx.numberInput.incrementLabel": {
|
|
657
|
+
"defaultMessage": "⟦Íñçřéɱéñţ {label}⟧"
|
|
658
|
+
},
|
|
653
659
|
"@astryx.selector.clearLabel": {
|
|
654
660
|
"defaultMessage": "⟦Çłéàř {label}⟧"
|
|
655
661
|
},
|
|
@@ -692,6 +698,9 @@
|
|
|
692
698
|
"@astryx.step.goToStepWithStatus": {
|
|
693
699
|
"defaultMessage": "⟦Ĝó ţó šţéþ {stepNumber, number}: {label}, {status}⟧"
|
|
694
700
|
},
|
|
701
|
+
"@astryx.step.optional": {
|
|
702
|
+
"defaultMessage": "⟦Óþţíóñàł⟧"
|
|
703
|
+
},
|
|
695
704
|
"@astryx.step.status.completed": {
|
|
696
705
|
"defaultMessage": "⟦çóɱþłéţéð⟧"
|
|
697
706
|
},
|