@astryxdesign/core 0.3.0 → 0.4.0-canary.3112e99
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 +3 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -17
- 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 +12 -16
- 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 +32 -31
- 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 +47 -33
- package/dist/DateRangeInput/DateRangeInput.d.ts +9 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +55 -32
- package/dist/DateTimeInput/DateTimeInput.d.ts +9 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +54 -30
- 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/DropdownMenuRadioGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +10 -3
- 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/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +21 -10
- 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 +177 -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 +80 -103
- 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 +8 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +119 -95
- 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/Popover/usePopover.d.ts +15 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +14 -2
- 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 +95 -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 +12 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +222 -111
- 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/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -6
- package/dist/Stack/stack.stylex.d.ts +3 -3
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +14 -13
- 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/TableRow.d.ts +1 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +4 -2
- 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 +14 -17
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +16 -34
- package/dist/Timestamp/formatInstant.d.ts +11 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -1
- 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 +84 -96
- 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/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +17 -4
- 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 +18 -2
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +10 -1
- 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 +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +23 -0
- package/dist/utils/focusOutline.stylex.d.ts +122 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -0
- package/dist/utils/focusOutline.stylex.js +143 -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 +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -1
- 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 +52 -0
- package/locales/pseudo.json +39 -0
- package/package.json +8 -3
- 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.test.tsx +58 -1
- package/src/Banner/Banner.tsx +33 -11
- package/src/Breadcrumbs/BreadcrumbItem.tsx +16 -6
- package/src/Breadcrumbs/index.ts +5 -1
- package/src/Button/Button.doc.mjs +2 -2
- package/src/Button/Button.tsx +22 -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 +120 -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 +73 -0
- package/src/ComplexSelector/ComplexSelector.tsx +41 -28
- 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 +112 -11
- package/src/DateInput/DateInput.tsx +44 -25
- package/src/DateRangeInput/DateRangeInput.doc.mjs +10 -2
- package/src/DateRangeInput/DateRangeInput.test.tsx +110 -14
- package/src/DateRangeInput/DateRangeInput.tsx +27 -21
- package/src/DateTimeInput/DateTimeInput.doc.mjs +16 -2
- package/src/DateTimeInput/DateTimeInput.test.tsx +154 -1
- package/src/DateTimeInput/DateTimeInput.tsx +58 -17
- 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/DropdownMenuRadioGroup.tsx +2 -1
- 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/FileInput/FileInput.tsx +21 -8
- 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 +46 -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 +197 -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 +45 -49
- 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 +16 -1
- package/src/MultiSelector/MultiSelector.test.tsx +259 -16
- package/src/MultiSelector/MultiSelector.tsx +144 -121
- 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.doc.mjs +2 -0
- package/src/Popover/Popover.tsx +6 -7
- package/src/Popover/usePopover.tsx +37 -4
- 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 +126 -30
- 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 +15 -4
- package/src/Selector/Selector.test.tsx +1234 -98
- package/src/Selector/Selector.tsx +254 -126
- 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/Slider/Slider.tsx +2 -11
- 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 +18 -10
- package/src/TabList/Tab.tsx +2 -9
- package/src/TabList/TabMenu.tsx +14 -21
- package/src/Table/BaseTable.tsx +11 -0
- package/src/Table/Table.test.tsx +31 -0
- package/src/Table/TableRow.tsx +6 -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 +84 -3
- package/src/TimeInput/TimeInput.tsx +26 -28
- package/src/Timestamp/Timestamp.doc.mjs +4 -3
- package/src/Timestamp/Timestamp.test.tsx +91 -14
- package/src/Timestamp/Timestamp.tsx +14 -2
- package/src/Timestamp/TimestampHoverCard.tsx +13 -35
- package/src/Timestamp/formatInstant.ts +16 -1
- 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.doc.mjs +5 -0
- 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 +208 -8
- 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/useInputStatusIcon.tsx +8 -8
- 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 +27 -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 +78 -20
- package/src/theme/generateThemeRules.ts +11 -0
- package/src/theme/index.ts +15 -0
- package/src/theme/tokens.stylex.ts +18 -0
- package/src/theme/tokens.test.ts +37 -0
- package/src/utils/focusOutline.stylex.ts +177 -0
- package/src/utils/focusReturn.test.ts +42 -0
- package/src/utils/focusReturn.ts +31 -0
- package/src/utils/index.ts +5 -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
|
@@ -291,6 +291,16 @@ describe('ProgressBar', () => {
|
|
|
291
291
|
describe('target marks', () => {
|
|
292
292
|
const MARK = '.astryx-progressbar-mark';
|
|
293
293
|
|
|
294
|
+
// The StyleX atomic classes on an element, without the stable astryx-*
|
|
295
|
+
// theme classes and the bare variant/placement tokens — so a comparison
|
|
296
|
+
// reflects the resolved styles, not the reflected props.
|
|
297
|
+
function styleClasses(el: HTMLElement): string {
|
|
298
|
+
return Array.from(el.classList)
|
|
299
|
+
.filter(c => /^x[a-z0-9]+$/.test(c))
|
|
300
|
+
.sort()
|
|
301
|
+
.join(' ');
|
|
302
|
+
}
|
|
303
|
+
|
|
294
304
|
it('renders no mark elements when marks is omitted', () => {
|
|
295
305
|
const {container} = render(<ProgressBar value={50} label="Progress" />);
|
|
296
306
|
expect(container.querySelectorAll(MARK)).toHaveLength(0);
|
|
@@ -405,6 +415,179 @@ describe('ProgressBar', () => {
|
|
|
405
415
|
expect(container.querySelectorAll(MARK)).toHaveLength(0);
|
|
406
416
|
});
|
|
407
417
|
|
|
418
|
+
// Mark color follows what the mark sits on: inside the filled area it
|
|
419
|
+
// takes the fill variant's on-color, out on the bare track it takes the
|
|
420
|
+
// primary text color. The choice is reflected as `data-placement`
|
|
421
|
+
// (plus `data-variant`, mirroring the fill) so themes can target it and
|
|
422
|
+
// tests can assert it without reading atomic class names.
|
|
423
|
+
it('marks the ticks inside the filled area as placed on the fill', () => {
|
|
424
|
+
const {container} = render(
|
|
425
|
+
<ProgressBar
|
|
426
|
+
value={60}
|
|
427
|
+
label="Progress"
|
|
428
|
+
marks={[
|
|
429
|
+
{value: 25, label: 'Behind'},
|
|
430
|
+
{value: 90, label: 'Ahead'},
|
|
431
|
+
]}
|
|
432
|
+
/>,
|
|
433
|
+
);
|
|
434
|
+
const marks = container.querySelectorAll<HTMLElement>(MARK);
|
|
435
|
+
expect(marks[0]).toHaveAttribute('data-placement', 'fill');
|
|
436
|
+
expect(marks[1]).toHaveAttribute('data-placement', 'track');
|
|
437
|
+
// Different placements resolve to different color styles.
|
|
438
|
+
expect(styleClasses(marks[0])).not.toBe(styleClasses(marks[1]));
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('treats a mark exactly at the current value as on the fill', () => {
|
|
442
|
+
const {container} = render(
|
|
443
|
+
<ProgressBar
|
|
444
|
+
value={70}
|
|
445
|
+
label="Progress"
|
|
446
|
+
marks={[{value: 70, label: 'Goal'}]}
|
|
447
|
+
/>,
|
|
448
|
+
);
|
|
449
|
+
expect(container.querySelector(MARK)).toHaveAttribute(
|
|
450
|
+
'data-placement',
|
|
451
|
+
'fill',
|
|
452
|
+
);
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
it('places every mark on the track at zero progress', () => {
|
|
456
|
+
// With no fill drawn, even a mark at 0 sits on the bare track.
|
|
457
|
+
const {container} = render(
|
|
458
|
+
<ProgressBar
|
|
459
|
+
value={0}
|
|
460
|
+
label="Progress"
|
|
461
|
+
marks={[
|
|
462
|
+
{value: 0, label: 'Start'},
|
|
463
|
+
{value: 50, label: 'Goal'},
|
|
464
|
+
]}
|
|
465
|
+
/>,
|
|
466
|
+
);
|
|
467
|
+
const marks = container.querySelectorAll<HTMLElement>(MARK);
|
|
468
|
+
expect(marks[0]).toHaveAttribute('data-placement', 'track');
|
|
469
|
+
expect(marks[1]).toHaveAttribute('data-placement', 'track');
|
|
470
|
+
expect(styleClasses(marks[0])).toBe(styleClasses(marks[1]));
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('mirrors the fill variant on marks so the on-color matches the bar', () => {
|
|
474
|
+
const {container} = render(
|
|
475
|
+
<ProgressBar
|
|
476
|
+
value={80}
|
|
477
|
+
variant="warning"
|
|
478
|
+
label="Budget used"
|
|
479
|
+
marks={[
|
|
480
|
+
{value: 50, label: 'Half'},
|
|
481
|
+
{value: 95, label: 'Cap'},
|
|
482
|
+
]}
|
|
483
|
+
/>,
|
|
484
|
+
);
|
|
485
|
+
const marks = container.querySelectorAll<HTMLElement>(MARK);
|
|
486
|
+
expect(marks[0]).toHaveAttribute('data-variant', 'warning');
|
|
487
|
+
expect(marks[0]).toHaveAttribute('data-placement', 'fill');
|
|
488
|
+
expect(marks[1]).toHaveAttribute('data-variant', 'warning');
|
|
489
|
+
expect(marks[1]).toHaveAttribute('data-placement', 'track');
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
it('uses the disabled variant for marks when the bar is disabled', () => {
|
|
493
|
+
const {container} = render(
|
|
494
|
+
<ProgressBar
|
|
495
|
+
value={80}
|
|
496
|
+
variant="error"
|
|
497
|
+
isDisabled
|
|
498
|
+
label="Canceled"
|
|
499
|
+
marks={[{value: 50, label: 'Half'}]}
|
|
500
|
+
/>,
|
|
501
|
+
);
|
|
502
|
+
expect(container.querySelector(MARK)).toHaveAttribute(
|
|
503
|
+
'data-variant',
|
|
504
|
+
'disabled',
|
|
505
|
+
);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it('keeps one plain foreground on both sides for neutral and disabled bars', () => {
|
|
509
|
+
// The neutral/disabled fill is the muted gray — it carries no semantic
|
|
510
|
+
// weight and has no on-token, so a mark on it takes the same plain
|
|
511
|
+
// foreground it would have out on the track.
|
|
512
|
+
for (const props of [
|
|
513
|
+
{variant: 'neutral'} as const,
|
|
514
|
+
{isDisabled: true} as const,
|
|
515
|
+
]) {
|
|
516
|
+
const {container, unmount} = render(
|
|
517
|
+
<ProgressBar
|
|
518
|
+
value={60}
|
|
519
|
+
label="Progress"
|
|
520
|
+
{...props}
|
|
521
|
+
marks={[
|
|
522
|
+
{value: 20, label: 'On fill'},
|
|
523
|
+
{value: 90, label: 'On track'},
|
|
524
|
+
]}
|
|
525
|
+
/>,
|
|
526
|
+
);
|
|
527
|
+
const marks = container.querySelectorAll<HTMLElement>(MARK);
|
|
528
|
+
expect(marks[0]).toHaveAttribute('data-placement', 'fill');
|
|
529
|
+
expect(marks[1]).toHaveAttribute('data-placement', 'track');
|
|
530
|
+
expect(styleClasses(marks[0])).toBe(styleClasses(marks[1]));
|
|
531
|
+
unmount();
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it("dims a disabled bar's marks below a live one's", () => {
|
|
536
|
+
// A disabled bar is deliberately low-emphasis (its label and value text
|
|
537
|
+
// drop to muted colors), so its marks step down to the secondary
|
|
538
|
+
// foreground on both sides rather than shouting over the grayed-out
|
|
539
|
+
// bar. A live neutral bar — same muted gray fill — keeps the
|
|
540
|
+
// full-contrast primary foreground.
|
|
541
|
+
const MARKS = [
|
|
542
|
+
{value: 20, label: 'On fill'},
|
|
543
|
+
{value: 90, label: 'On track'},
|
|
544
|
+
];
|
|
545
|
+
const {container: live} = render(
|
|
546
|
+
<ProgressBar value={60} variant="neutral" label="A" marks={MARKS} />,
|
|
547
|
+
);
|
|
548
|
+
const {container: off} = render(
|
|
549
|
+
<ProgressBar value={60} isDisabled label="B" marks={MARKS} />,
|
|
550
|
+
);
|
|
551
|
+
const liveMarks = live.querySelectorAll<HTMLElement>(MARK);
|
|
552
|
+
const offMarks = off.querySelectorAll<HTMLElement>(MARK);
|
|
553
|
+
expect(styleClasses(offMarks[0])).not.toBe(styleClasses(liveMarks[0]));
|
|
554
|
+
expect(styleClasses(offMarks[1])).not.toBe(styleClasses(liveMarks[1]));
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it('recolors marks per variant when they sit on the fill', () => {
|
|
558
|
+
// Two bars at the same progress with different variants give their
|
|
559
|
+
// on-fill marks different colors (different atomic classes), while
|
|
560
|
+
// their on-track marks stay the same divider color.
|
|
561
|
+
const {container: accent} = render(
|
|
562
|
+
<ProgressBar
|
|
563
|
+
value={60}
|
|
564
|
+
variant="accent"
|
|
565
|
+
label="A"
|
|
566
|
+
marks={[
|
|
567
|
+
{value: 20, label: 'On fill'},
|
|
568
|
+
{value: 90, label: 'On track'},
|
|
569
|
+
]}
|
|
570
|
+
/>,
|
|
571
|
+
);
|
|
572
|
+
const {container: error} = render(
|
|
573
|
+
<ProgressBar
|
|
574
|
+
value={60}
|
|
575
|
+
variant="error"
|
|
576
|
+
label="B"
|
|
577
|
+
marks={[
|
|
578
|
+
{value: 20, label: 'On fill'},
|
|
579
|
+
{value: 90, label: 'On track'},
|
|
580
|
+
]}
|
|
581
|
+
/>,
|
|
582
|
+
);
|
|
583
|
+
const accentMarks = accent.querySelectorAll<HTMLElement>(MARK);
|
|
584
|
+
const errorMarks = error.querySelectorAll<HTMLElement>(MARK);
|
|
585
|
+
expect(styleClasses(accentMarks[0])).not.toBe(
|
|
586
|
+
styleClasses(errorMarks[0]),
|
|
587
|
+
);
|
|
588
|
+
expect(styleClasses(accentMarks[1])).toBe(styleClasses(errorMarks[1]));
|
|
589
|
+
});
|
|
590
|
+
|
|
408
591
|
it('renders every mark as a focusable trigger (label is required, never decorative)', () => {
|
|
409
592
|
const {container} = render(
|
|
410
593
|
<ProgressBar
|
|
@@ -583,9 +766,49 @@ describe('ProgressBar', () => {
|
|
|
583
766
|
expect(trackHasOverflowHidden).toBe(true);
|
|
584
767
|
});
|
|
585
768
|
|
|
769
|
+
it('sizes the mark through the derived vars, so a theme override cannot lose the cascade', () => {
|
|
770
|
+
// width/height are declared as `var(--_progressbar-mark-*)` and nothing
|
|
771
|
+
// else declares those vars, so the value a theme sets on the
|
|
772
|
+
// `progressbar-mark` target lands even in a consumer whose StyleX is
|
|
773
|
+
// unlayered and would otherwise outrank `@layer astryx-theme`.
|
|
774
|
+
const {container} = render(
|
|
775
|
+
<ProgressBar
|
|
776
|
+
value={50}
|
|
777
|
+
label="Progress"
|
|
778
|
+
marks={[{value: 80, label: 'M'}]}
|
|
779
|
+
/>,
|
|
780
|
+
);
|
|
781
|
+
const mark = container.querySelector<HTMLElement>(MARK)!;
|
|
782
|
+
let css = '';
|
|
783
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
784
|
+
try {
|
|
785
|
+
for (const rule of Array.from(sheet.cssRules)) {
|
|
786
|
+
css += rule.cssText + '\n';
|
|
787
|
+
}
|
|
788
|
+
} catch {
|
|
789
|
+
// ignore cross-origin sheets
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
css += Array.from(document.querySelectorAll('style'))
|
|
793
|
+
.map(s => s.textContent || '')
|
|
794
|
+
.join('\n');
|
|
795
|
+
const markRules = Array.from(mark.classList)
|
|
796
|
+
.filter(cls => /^x[a-z0-9]+$/.test(cls))
|
|
797
|
+
.flatMap(
|
|
798
|
+
cls =>
|
|
799
|
+
css.match(new RegExp(`\\.${cls}\\b[^{]*\\{[^}]*\\}`, 'g')) ?? [],
|
|
800
|
+
);
|
|
801
|
+
expect(markRules.join('\n')).toMatch(
|
|
802
|
+
/width:\s*var\(--_progressbar-mark-width,\s*2px\)/,
|
|
803
|
+
);
|
|
804
|
+
expect(markRules.join('\n')).toMatch(
|
|
805
|
+
/height:\s*var\(--_progressbar-mark-height,\s*8px\)/,
|
|
806
|
+
);
|
|
807
|
+
});
|
|
808
|
+
|
|
586
809
|
it('renders the mark on the stable progressbar-mark target, centered for symmetric overhang', () => {
|
|
587
810
|
// The mark's width/height/color are directly overridable via the
|
|
588
|
-
// `progressbar-mark` theme target
|
|
811
|
+
// `progressbar-mark` theme target. It is centered
|
|
589
812
|
// on the track (translate -50%,-50%) so a themed taller tick overhangs the
|
|
590
813
|
// bar symmetrically above and below without being clipped.
|
|
591
814
|
const {container} = render(
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
typeScaleVars,
|
|
31
31
|
} from '../theme/tokens.stylex';
|
|
32
32
|
import {mergeProps} from '../utils';
|
|
33
|
+
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
33
34
|
import type {BaseProps} from '../BaseProps';
|
|
34
35
|
import {themeProps} from '../utils/themeProps';
|
|
35
36
|
import {VisuallyHidden} from '../VisuallyHidden';
|
|
@@ -122,8 +123,12 @@ export interface ProgressBarProps extends BaseProps<HTMLDivElement> {
|
|
|
122
123
|
/**
|
|
123
124
|
* Target marks drawn on the track at fixed points in the same `0..max`
|
|
124
125
|
* scale as `value` — e.g. a goal line. Marks stay visible whether progress
|
|
125
|
-
* is below or past them
|
|
126
|
-
*
|
|
126
|
+
* is below or past them, and take their color from what they sit on: a mark
|
|
127
|
+
* inside the filled area uses the fill variant's on-color (on-accent,
|
|
128
|
+
* on-warning, on-error, …), while a mark still out on the bare track uses
|
|
129
|
+
* `--color-text-primary` (`--color-text-secondary` on a disabled bar, which
|
|
130
|
+
* dims everything it draws). Each mark's required `label` names it for
|
|
131
|
+
* assistive tech and is revealed via a `Tooltip` on hover/focus. Ignored when
|
|
127
132
|
* `isIndeterminate` is true.
|
|
128
133
|
*/
|
|
129
134
|
marks?: ReadonlyArray<ProgressBarMark>;
|
|
@@ -257,28 +262,27 @@ const styles = stylex.create({
|
|
|
257
262
|
},
|
|
258
263
|
// A mark is a vertical tick centered on the track, a child of the
|
|
259
264
|
// `role="progressbar"` element (unchanged DOM). The track no longer clips, so
|
|
260
|
-
// its height — 8px by default
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
//
|
|
265
|
+
// its height — 8px by default — may exceed the bar and overhang; the centering
|
|
266
|
+
// translate keeps any overhang symmetric. Positioned horizontally via
|
|
267
|
+
// `insetInlineStart`; the translate mirrors under RTL.
|
|
268
|
+
//
|
|
269
|
+
// The dimensions read private vars rather than being plain declarations: a
|
|
270
|
+
// theme writes `width`/`height` on the `progressbar-mark` target as usual and
|
|
271
|
+
// the derived-var registry emits them as these vars instead of as competing
|
|
272
|
+
// properties. Nothing else declares them, so the theme value lands whatever
|
|
273
|
+
// the consumer's cascade looks like — a source-build app that compiles StyleX
|
|
274
|
+
// without `useCSSLayers` leaves the atomics unlayered, where they outrank
|
|
275
|
+
// every rule in `@layer astryx-theme` and made sizing the mark impossible
|
|
276
|
+
// without `!important`.
|
|
277
|
+
//
|
|
278
|
+
// The tick's color is not set here: it depends on what the mark sits on, so
|
|
279
|
+
// it comes from `markOnFillStyles[variant]` (mark inside the filled area) or
|
|
280
|
+
// `markOnTrackStyles.track` (mark out on the bare track).
|
|
264
281
|
mark: {
|
|
265
282
|
position: 'absolute',
|
|
266
283
|
top: '50%',
|
|
267
|
-
width:
|
|
268
|
-
height:
|
|
269
|
-
// Defaults to text-primary. Directly overridable via the `progressbar-mark`
|
|
270
|
-
// theme target — a theme can set `backgroundColor`, `width`, and `height`
|
|
271
|
-
// (e.g. a taller "flag" tick that overhangs the bar, or per-variant
|
|
272
|
-
// contrast) with `defineTheme`; no dedicated CSS vars needed.
|
|
273
|
-
backgroundColor: colorVars['--color-text-primary'],
|
|
274
|
-
outline: {
|
|
275
|
-
default: 'none',
|
|
276
|
-
':focus-visible': `2px solid ${colorVars['--color-accent']}`,
|
|
277
|
-
},
|
|
278
|
-
outlineOffset: {
|
|
279
|
-
default: '0',
|
|
280
|
-
':focus-visible': '2px',
|
|
281
|
-
},
|
|
284
|
+
width: 'var(--_progressbar-mark-width, 2px)',
|
|
285
|
+
height: 'var(--_progressbar-mark-height, 8px)',
|
|
282
286
|
transform: {
|
|
283
287
|
default: 'translate(-50%, -50%)',
|
|
284
288
|
':is([dir="rtl"] *)': 'translate(50%, -50%)',
|
|
@@ -307,6 +311,64 @@ const variantStyles = stylex.create({
|
|
|
307
311
|
},
|
|
308
312
|
});
|
|
309
313
|
|
|
314
|
+
// A mark sitting inside the filled area is drawn *on* the bar, so it takes the
|
|
315
|
+
// on-color that pairs with the fill's own variant color — the same pairing
|
|
316
|
+
// Badge uses for solid semantic backgrounds.
|
|
317
|
+
//
|
|
318
|
+
// `neutral` and `disabled` both fill with the muted `--color-text-disabled`
|
|
319
|
+
// gray, which carries no semantic weight and has no dedicated on-token, so
|
|
320
|
+
// they fall back to a plain foreground. They pick different ones: a `neutral`
|
|
321
|
+
// bar is live, so its mark keeps the full-contrast `--color-text-primary` a
|
|
322
|
+
// mark uses out on the track; a `disabled` bar is deliberately low-emphasis —
|
|
323
|
+
// its own label and value text drop to muted colors — so its mark steps down
|
|
324
|
+
// to `--color-text-secondary` rather than becoming the loudest thing on a
|
|
325
|
+
// grayed-out component.
|
|
326
|
+
const markOnFillStyles = stylex.create({
|
|
327
|
+
accent: {
|
|
328
|
+
backgroundColor: colorVars['--color-on-accent'],
|
|
329
|
+
},
|
|
330
|
+
success: {
|
|
331
|
+
backgroundColor: colorVars['--color-on-success'],
|
|
332
|
+
},
|
|
333
|
+
warning: {
|
|
334
|
+
backgroundColor: colorVars['--color-on-warning'],
|
|
335
|
+
},
|
|
336
|
+
error: {
|
|
337
|
+
backgroundColor: colorVars['--color-on-error'],
|
|
338
|
+
},
|
|
339
|
+
neutral: {
|
|
340
|
+
backgroundColor: colorVars['--color-text-primary'],
|
|
341
|
+
},
|
|
342
|
+
disabled: {
|
|
343
|
+
backgroundColor: colorVars['--color-text-secondary'],
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// A mark out on the bare track is a foreground tick over the muted track
|
|
348
|
+
// background, so it takes `--color-text-primary`.
|
|
349
|
+
//
|
|
350
|
+
// The obvious candidate was `--color-border-emphasized` — the emphasized
|
|
351
|
+
// divider color `Divider`'s `strong` variant and `Slider`'s marks use — but
|
|
352
|
+
// divider tokens sit a step or two from the track on the same neutral ramp, so
|
|
353
|
+
// a mark drawn in one is at or near invisible: measured against each shipped
|
|
354
|
+
// theme's track it lands between 1.00:1 (theme-neutral, both modes, where the
|
|
355
|
+
// track is aliased to that very token) and 2.9:1, under the 3:1 WCAG 1.4.11
|
|
356
|
+
// non-text floor in 7 of 8 themes. `--color-text-secondary` still misses in
|
|
357
|
+
// two. `--color-text-primary` is the one foreground guaranteed to read against
|
|
358
|
+
// every surface a theme defines: 5.8:1 to 15.7:1 on the track across all
|
|
359
|
+
// themes and both modes.
|
|
360
|
+
const markOnTrackStyles = stylex.create({
|
|
361
|
+
track: {
|
|
362
|
+
backgroundColor: colorVars['--color-text-primary'],
|
|
363
|
+
},
|
|
364
|
+
// A disabled bar dims everything it draws, so its track marks step down to
|
|
365
|
+
// the secondary foreground for the same reason the disabled on-fill mark
|
|
366
|
+
// does — matching the muted label and value text.
|
|
367
|
+
trackDisabled: {
|
|
368
|
+
backgroundColor: colorVars['--color-text-secondary'],
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
|
|
310
372
|
function defaultFormatValueLabel(value: number, max: number): string {
|
|
311
373
|
const pct = max > 0 ? Math.round((value / max) * 100) : 0;
|
|
312
374
|
return `${pct}%`;
|
|
@@ -338,8 +400,11 @@ function defaultFormatValueLabel(value: number, max: number): string {
|
|
|
338
400
|
* ```
|
|
339
401
|
*
|
|
340
402
|
* A mark's height, width, and color are directly themeable via the
|
|
341
|
-
* `progressbar-mark` target
|
|
342
|
-
*
|
|
403
|
+
* `progressbar-mark` target. The target reflects `data-placement`
|
|
404
|
+
* (`"fill"` when the mark sits inside the filled area, `"track"` when it is
|
|
405
|
+
* still out on the bare track) and `data-variant` (the fill's variant), so a
|
|
406
|
+
* theme can style the two cases separately — e.g. a taller "goal flag" tick
|
|
407
|
+
* that overhangs the bar (centered, so the overhang is symmetric):
|
|
343
408
|
*
|
|
344
409
|
* @example
|
|
345
410
|
* ```
|
|
@@ -387,6 +452,13 @@ export function ProgressBar({
|
|
|
387
452
|
// Marks make no sense without a determinate value, so they are only drawn
|
|
388
453
|
// in determinate mode. Non-finite mark values are dropped; the rest are
|
|
389
454
|
// clamped to the track edges, matching the bar's own `clampedValue`.
|
|
455
|
+
//
|
|
456
|
+
// Each mark also records whether it lands on the filled part of the bar
|
|
457
|
+
// (`isOnFill`), which decides its color: a mark inside the fill reads against
|
|
458
|
+
// the variant color, one out on the bare track reads against the track. A
|
|
459
|
+
// mark exactly at the fill's leading edge counts as on the fill — it is the
|
|
460
|
+
// "reached the target" moment — except at zero progress, where there is no
|
|
461
|
+
// fill for it to sit on.
|
|
390
462
|
const resolvedMarks =
|
|
391
463
|
!isIndeterminate && marks
|
|
392
464
|
? marks
|
|
@@ -394,7 +466,12 @@ export function ProgressBar({
|
|
|
394
466
|
.map(mark => {
|
|
395
467
|
const clamped = Math.min(Math.max(0, mark.value), safeMax);
|
|
396
468
|
const pct = safeMax > 0 ? (clamped / safeMax) * 100 : 0;
|
|
397
|
-
return {
|
|
469
|
+
return {
|
|
470
|
+
value: mark.value,
|
|
471
|
+
label: mark.label,
|
|
472
|
+
pct,
|
|
473
|
+
isOnFill: percentage > 0 && pct <= percentage,
|
|
474
|
+
};
|
|
398
475
|
})
|
|
399
476
|
: [];
|
|
400
477
|
|
|
@@ -471,21 +548,40 @@ export function ProgressBar({
|
|
|
471
548
|
)}
|
|
472
549
|
{/* Target marks — children of the progressbar element (unchanged),
|
|
473
550
|
layered above the fill so they show whether progress is below or
|
|
474
|
-
past them.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
551
|
+
past them. A mark's color follows what it sits on: inside the fill
|
|
552
|
+
it uses the fill variant's on-color, out on the bare track it uses
|
|
553
|
+
the emphasized divider color. Each mark is labeled, so it is a
|
|
554
|
+
focusable Tooltip trigger: the label is visible on hover/focus and
|
|
555
|
+
names the mark for assistive tech via the Tooltip's
|
|
556
|
+
aria-describedby, without adding a labeled child to the
|
|
557
|
+
progressbar's own a11y subtree. */}
|
|
478
558
|
{resolvedMarks.map(mark => {
|
|
479
559
|
// The tick element. It is both the Tooltip's anchor and the Suspense
|
|
480
560
|
// fallback shown while the lazy Tooltip chunk loads, so the tick is
|
|
481
561
|
// always visible and the label attaches once ready. The list `key`
|
|
482
562
|
// lives on the mapped <Suspense>, not here.
|
|
563
|
+
//
|
|
564
|
+
// `placement` is reflected as `data-placement` (and a class) so a
|
|
565
|
+
// theme can style the two cases separately on the
|
|
566
|
+
// `progressbar-mark` target; `variant` mirrors the fill's variant
|
|
567
|
+
// for the same reason.
|
|
483
568
|
const markEl = (
|
|
484
569
|
<span
|
|
485
570
|
tabIndex={0}
|
|
486
571
|
{...mergeProps(
|
|
487
|
-
themeProps('progressbar-mark'
|
|
488
|
-
|
|
572
|
+
themeProps('progressbar-mark', {
|
|
573
|
+
variant: fillVariant,
|
|
574
|
+
placement: mark.isOnFill ? 'fill' : 'track',
|
|
575
|
+
}),
|
|
576
|
+
stylex.props(
|
|
577
|
+
focusOutlineStyles.focusVisible,
|
|
578
|
+
styles.mark,
|
|
579
|
+
mark.isOnFill
|
|
580
|
+
? markOnFillStyles[fillVariant]
|
|
581
|
+
: isDisabled
|
|
582
|
+
? markOnTrackStyles.trackDisabled
|
|
583
|
+
: markOnTrackStyles.track,
|
|
584
|
+
),
|
|
489
585
|
)}
|
|
490
586
|
style={{insetInlineStart: `${mark.pct}%`}}
|
|
491
587
|
/>
|
|
@@ -12,8 +12,10 @@ export const docs = {
|
|
|
12
12
|
targets: [
|
|
13
13
|
{className: 'astryx-radio-list', visualProps: ['orientation', 'size']},
|
|
14
14
|
{className: 'astryx-radio-list-item'},
|
|
15
|
-
{className: 'astryx-radio', visualProps: ['size'], states: ['checked', 'disabled']},
|
|
16
|
-
{className: 'astryx-radio-dot', visualProps: ['size']},
|
|
15
|
+
{className: 'astryx-radio-indicator', visualProps: ['size'], states: ['checked', 'disabled']},
|
|
16
|
+
{className: 'astryx-radio-indicator-dot', visualProps: ['size']},
|
|
17
|
+
{className: 'astryx-radio', visualProps: ['size'], states: ['checked', 'disabled'], deprecatedFor: 'radio-indicator'},
|
|
18
|
+
{className: 'astryx-radio-dot', visualProps: ['size'], deprecatedFor: 'radio-indicator-dot'},
|
|
17
19
|
],
|
|
18
20
|
},
|
|
19
21
|
description: 'Radio group container with field integration for label, description, and status.',
|