@astryxdesign/core 0.1.7 → 0.1.8-canary.0c4d8d7
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 +65 -0
- package/README.md +30 -19
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +6 -2
- package/dist/AppShell/AppShellMobileContext.d.ts +8 -0
- package/dist/AppShell/AppShellMobileContext.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts +10 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +12 -8
- package/dist/Avatar/AvatarSizeContext.d.ts +1 -1
- package/dist/Avatar/AvatarSizeContext.js +1 -1
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -2
- package/dist/Avatar/AvatarStatusDot.js +2 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +16 -14
- package/dist/Banner/Banner.d.ts +9 -1
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +31 -2
- package/dist/Button/Button.d.ts +8 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +31 -2
- package/dist/ButtonGroup/ButtonGroup.d.ts +9 -1
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +30 -1
- package/dist/Card/Card.d.ts +8 -2
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +28 -2
- package/dist/Carousel/Carousel.d.ts +6 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +55 -5
- package/dist/Chat/ChatComposer.d.ts +8 -0
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +31 -6
- package/dist/Chat/ChatComposerDrawer.d.ts +2 -0
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +11 -1
- package/dist/Chat/ChatComposerInput.d.ts +20 -3
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +19 -3
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +1 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.d.ts +5 -1
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +12 -3
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +10 -4
- package/dist/ClickableCard/ClickableCard.d.ts +9 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +3 -0
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +8 -1
- package/dist/Collapsible/Collapsible.d.ts +11 -1
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +36 -4
- package/dist/CommandPalette/CommandPaletteInput.d.ts +7 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +6 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +4 -3
- package/dist/ContextMenu/index.d.ts +3 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/ContextMenu/index.js +7 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +10 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +8 -4
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +88 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +169 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +18 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +68 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +69 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -0
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +178 -0
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +10 -1
- package/dist/DropdownMenu/menuItemRoles.d.ts +13 -0
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -0
- package/dist/DropdownMenu/menuItemRoles.js +15 -0
- package/dist/FieldStatus/FieldStatus.d.ts +8 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +22 -4
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +10 -2
- package/dist/HoverCard/HoverCard.d.ts +9 -1
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -0
- package/dist/HoverCard/useHoverCard.d.ts +8 -0
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +7 -2
- package/dist/Icon/Icon.d.ts +43 -13
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +62 -27
- package/dist/Layer/useLayer.d.ts +6 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +2 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +6 -1
- package/dist/MobileNav/MobileNavToggle.d.ts.map +1 -1
- package/dist/MobileNav/MobileNavToggle.js +4 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +39 -12
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +16 -0
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/Outline/Outline.d.ts +68 -3
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +128 -26
- package/dist/Outline/useScrollSpy.d.ts +27 -7
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +202 -70
- package/dist/OverflowList/OverflowList.d.ts +20 -3
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +29 -4
- package/dist/PowerSearch/PowerSearchEditPopover.js +1 -1
- package/dist/PowerSearch/usePowerSearchSource.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts +9 -2
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +14 -11
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +4 -2
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +16 -0
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +21 -8
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +15 -1
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -2
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +2 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.js +1 -1
- package/dist/Table/index.d.ts +4 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -0
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +24 -2
- package/dist/Table/plugins/rowStatus/index.d.ts +3 -0
- package/dist/Table/plugins/rowStatus/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowStatus/index.js +3 -0
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts +60 -0
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -0
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +145 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts +12 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +4 -1
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +18 -7
- package/dist/Table/plugins/tree/index.d.ts +5 -0
- package/dist/Table/plugins/tree/index.d.ts.map +1 -0
- package/dist/Table/plugins/tree/index.js +4 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +38 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.js +358 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts +51 -0
- package/dist/Table/plugins/tree/useTableTreeState.d.ts.map +1 -0
- package/dist/Table/plugins/tree/useTableTreeState.js +175 -0
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +6 -3
- package/dist/Thumbnail/Thumbnail.d.ts +8 -1
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +46 -8
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +15 -4
- package/dist/Tokenizer/Tokenizer.d.ts +1 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +16 -4
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +8 -1
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +18 -8
- package/dist/TopNav/TopNavMegaMenu.js +10 -4
- package/dist/TopNav/TopNavMenu.d.ts +2 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +68 -6
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +5 -14
- package/dist/astryx.css +51 -16
- package/dist/astryx.umd.js +56 -56
- package/dist/astryx.umd.js.map +4 -4
- package/dist/authoring/doc.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.d.ts +47 -0
- package/dist/hooks/computeOverflow.d.ts.map +1 -0
- package/dist/hooks/computeOverflow.js +213 -0
- package/dist/hooks/useOverflow.d.ts +19 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +37 -25
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +51 -0
- package/dist/theme/hct.d.ts +0 -1
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +0 -3
- package/dist/utils/types.d.ts +13 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/docs.mjs +32 -461
- package/locales/en.json +212 -172
- package/locales/fr-FR.json +10 -0
- package/locales/pseudo.json +30 -0
- package/package.json +3 -1
- package/scripts/postinstall.mjs +93 -0
- package/src/AppShell/AppShell.tsx +6 -0
- package/src/AppShell/AppShellMobileContext.tsx +8 -0
- package/src/AppShell/useAppShellMobile.doc.mjs +8 -0
- package/src/Avatar/Avatar.doc.mjs +6 -6
- package/src/Avatar/Avatar.tsx +16 -11
- package/src/Avatar/AvatarSizeContext.ts +1 -1
- package/src/Avatar/AvatarStatusDot.tsx +2 -2
- package/src/AvatarGroup/AvatarGroup.doc.mjs +1 -1
- package/src/AvatarGroup/AvatarGroup.test.tsx +17 -3
- package/src/AvatarGroup/AvatarGroup.tsx +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.doc.mjs +4 -4
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +21 -5
- package/src/Banner/Banner.doc.mjs +9 -0
- package/src/Banner/Banner.test.tsx +30 -0
- package/src/Banner/Banner.tsx +47 -3
- package/src/Button/Button.doc.mjs +9 -0
- package/src/Button/Button.test.tsx +49 -0
- package/src/Button/Button.tsx +25 -1
- package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -0
- package/src/ButtonGroup/ButtonGroup.test.tsx +37 -0
- package/src/ButtonGroup/ButtonGroup.tsx +32 -0
- package/src/Card/Card.doc.mjs +9 -0
- package/src/Card/Card.test.tsx +21 -3
- package/src/Card/Card.tsx +35 -2
- package/src/Carousel/Carousel.doc.mjs +1 -0
- package/src/Carousel/Carousel.test.tsx +149 -1
- package/src/Carousel/Carousel.tsx +62 -5
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposer.doc.mjs +9 -0
- package/src/Chat/ChatComposer.test.tsx +35 -0
- package/src/Chat/ChatComposer.tsx +58 -9
- package/src/Chat/ChatComposerDrawer.test.tsx +61 -0
- package/src/Chat/ChatComposerDrawer.tsx +11 -1
- package/src/Chat/ChatComposerInput.doc.mjs +7 -0
- package/src/Chat/ChatComposerInput.test.tsx +87 -0
- package/src/Chat/ChatComposerInput.tsx +35 -3
- package/src/Chat/ChatLayout.tsx +3 -1
- package/src/Chat/ChatLayoutScrollButton.tsx +3 -1
- package/src/Chat/ChatMessage.tsx +4 -2
- package/src/Chat/ChatMessageMetadata.tsx +1 -2
- package/src/Chat/ChatSendButton.tsx +5 -1
- package/src/Chat/ChatToolCalls.test.tsx +64 -0
- package/src/Chat/ChatToolCalls.tsx +13 -1
- package/src/Chat/useTriggerMenu.tsx +3 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +32 -1
- package/src/CheckboxList/CheckboxList.test.tsx +9 -1
- package/src/Citation/Citation.test.tsx +51 -0
- package/src/Citation/Citation.tsx +8 -2
- package/src/ClickableCard/ClickableCard.doc.mjs +2 -0
- package/src/ClickableCard/ClickableCard.test.tsx +34 -0
- package/src/ClickableCard/ClickableCard.tsx +11 -1
- package/src/CodeBlock/CodeBlock.test.tsx +56 -0
- package/src/CodeBlock/CodeBlock.tsx +9 -1
- package/src/Collapsible/Collapsible.doc.mjs +7 -0
- package/src/Collapsible/Collapsible.test.tsx +80 -0
- package/src/Collapsible/Collapsible.tsx +58 -5
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +26 -9
- package/src/CommandPalette/CommandPaletteInput.test.tsx +34 -0
- package/src/CommandPalette/CommandPaletteInput.tsx +11 -0
- package/src/ContextMenu/ContextMenu.test.tsx +75 -1
- package/src/ContextMenu/ContextMenu.tsx +10 -5
- package/src/ContextMenu/index.ts +15 -0
- package/src/DateTimeInput/DateTimeInput.test.tsx +35 -0
- package/src/DateTimeInput/DateTimeInput.tsx +14 -2
- package/src/Dialog/Dialog.tsx +12 -2
- package/src/DropdownMenu/DropdownMenu.doc.mjs +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +11 -6
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +95 -0
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +236 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +29 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +7 -1
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +118 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +80 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +232 -0
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +163 -0
- package/src/DropdownMenu/index.ts +23 -3
- package/src/DropdownMenu/menuItemRoles.ts +22 -0
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/Field.test.tsx +57 -12
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/FieldStatus/FieldStatus.doc.mjs +17 -5
- package/src/FieldStatus/FieldStatus.test.tsx +78 -40
- package/src/FieldStatus/FieldStatus.tsx +22 -4
- package/src/FileInput/FileInput.test.tsx +52 -3
- package/src/FileInput/FileInput.tsx +13 -2
- package/src/HoverCard/HoverCard.doc.mjs +13 -0
- package/src/HoverCard/HoverCard.test.tsx +21 -2
- package/src/HoverCard/HoverCard.tsx +11 -0
- package/src/HoverCard/useHoverCard.doc.mjs +2 -0
- package/src/HoverCard/useHoverCard.tsx +24 -2
- package/src/Icon/Icon.doc.mjs +12 -0
- package/src/Icon/Icon.test.tsx +142 -0
- package/src/Icon/Icon.tsx +98 -30
- package/src/IconButton/IconButton.doc.mjs +8 -0
- package/src/IconButton/IconButton.test.tsx +15 -18
- package/src/Item/Item.doc.mjs +1 -1
- package/src/Layer/useLayer.tsx +8 -0
- package/src/MobileNav/MobileNav.tsx +12 -1
- package/src/MobileNav/MobileNavToggle.test.tsx +116 -0
- package/src/MobileNav/MobileNavToggle.tsx +9 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +4 -2
- package/src/MultiSelector/MultiSelector.test.tsx +162 -1
- package/src/MultiSelector/MultiSelector.tsx +55 -12
- package/src/MultiSelector/hooks.ts +17 -0
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/NumberInput/NumberInput.test.tsx +11 -7
- package/src/NumberInput/NumberInput.tsx +1 -2
- package/src/Outline/Outline.doc.mjs +123 -3
- package/src/Outline/Outline.test.tsx +735 -0
- package/src/Outline/Outline.tsx +183 -33
- package/src/Outline/useScrollSpy.ts +248 -72
- package/src/OverflowList/OverflowList.doc.mjs +39 -6
- package/src/OverflowList/OverflowList.test.tsx +111 -0
- package/src/OverflowList/OverflowList.tsx +48 -8
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +67 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +1 -1
- package/src/PowerSearch/usePowerSearchSource.ts +1 -2
- package/src/SelectableCard/SelectableCard.doc.mjs +2 -0
- package/src/SelectableCard/SelectableCard.test.tsx +46 -4
- package/src/SelectableCard/SelectableCard.tsx +27 -14
- package/src/Selector/Selector.test.tsx +69 -0
- package/src/Selector/Selector.tsx +5 -1
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/Selector/hooks.ts +17 -0
- package/src/SideNav/SideNav.test.tsx +119 -3
- package/src/SideNav/SideNavCollapseButton.tsx +6 -1
- package/src/SideNav/SideNavHeading.tsx +24 -8
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +5 -1
- package/src/Slider/Slider.test.tsx +62 -2
- package/src/Slider/Slider.tsx +15 -1
- package/src/Switch/Switch.doc.mjs +1 -1
- package/src/Switch/Switch.test.tsx +32 -1
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/TabList/TabList.test.tsx +66 -0
- package/src/TabList/TabList.tsx +8 -0
- package/src/TabList/TabMenu.tsx +4 -1
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/Table.tsx +1 -1
- package/src/Table/index.ts +12 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +6 -2
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +90 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +37 -5
- package/src/Table/plugins/rowStatus/index.ts +7 -0
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +138 -0
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +189 -0
- package/src/Table/plugins/selection/useTableSelection.test.tsx +16 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +18 -1
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +95 -9
- package/src/Table/plugins/sortable/useTableSortable.tsx +23 -7
- package/src/Table/plugins/tree/index.ts +12 -0
- package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +163 -0
- package/src/Table/plugins/tree/useTableTreeData.test.tsx +594 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +495 -0
- package/src/Table/plugins/tree/useTableTreeState.test.tsx +636 -0
- package/src/Table/plugins/tree/useTableTreeState.tsx +253 -0
- package/src/Table/useBaseTablePlugins.ts +6 -2
- package/src/Table/useTableRowStatus.doc.mjs +30 -0
- package/src/Table/useTableSelection.doc.mjs +65 -14
- package/src/Table/useTableTreeData.doc.mjs +75 -0
- package/src/Table/useTableTreeState.doc.mjs +98 -0
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextArea/TextArea.test.tsx +9 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/Thumbnail/Thumbnail.doc.mjs +9 -0
- package/src/Thumbnail/Thumbnail.test.tsx +38 -8
- package/src/Thumbnail/Thumbnail.tsx +28 -1
- package/src/TimeInput/TimeInput.test.tsx +76 -1
- package/src/TimeInput/TimeInput.tsx +19 -6
- package/src/Tokenizer/Tokenizer.doc.mjs +1 -1
- package/src/Tokenizer/Tokenizer.test.tsx +137 -2
- package/src/Tokenizer/Tokenizer.tsx +16 -4
- package/src/Toolbar/Toolbar.tsx +10 -3
- package/src/TopNav/TopNav.test.tsx +80 -1
- package/src/TopNav/TopNavHeading.tsx +24 -8
- package/src/TopNav/TopNavMegaMenu.test.tsx +149 -1
- package/src/TopNav/TopNavMegaMenu.tsx +10 -4
- package/src/TopNav/TopNavMenu.test.tsx +118 -4
- package/src/TopNav/TopNavMenu.tsx +83 -5
- package/src/TreeList/TreeList.test.tsx +32 -1
- package/src/TreeList/TreeListItem.tsx +19 -10
- package/src/authoring/doc.ts +1 -3
- package/src/docs-script.test.mjs +18 -13
- package/src/hooks/computeOverflow.test.ts +422 -0
- package/src/hooks/computeOverflow.ts +290 -0
- package/src/hooks/useOverflow.test.ts +96 -4
- package/src/hooks/useOverflow.ts +77 -33
- package/src/postinstall.test.mjs +71 -0
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/generateThemeRules.test.ts +65 -0
- package/src/theme/generateThemeRules.ts +56 -0
- package/src/theme/hct.ts +0 -4
- package/src/utils/types.ts +14 -0
- package/dist/TreeList/treeListItem.markers.stylex.d.ts +0 -16
- package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +0 -1
- package/dist/TreeList/treeListItem.markers.stylex.js +0 -22
- package/src/TreeList/treeListItem.markers.stylex.ts +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/authoring/doc.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0DAA0D;IAC1D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,0CAA0C;IAC1C,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,yDAAyD;IACzD,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/authoring/doc.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0DAA0D;IAC1D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,0CAA0C;IAC1C,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,yDAAyD;IACzD,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC5B,uBAAuB,GAAG,sBAAsB,GAAG,qBAAqB,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,uBAAuB,EAClE,GAAG,EAAE,CAAC,GACL,CAAC,GAAG;IAAC,IAAI,EAAE,WAAW,CAAA;CAAC,CAEzB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,sBAAsB,EAChE,GAAG,EAAE,CAAC,GACL,CAAC,GAAG;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,CAExB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,qBAAqB,EACvD,GAAG,EAAE,CAAC,GACL,CAAC,GAAG;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAEvB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file computeOverflow.ts
|
|
3
|
+
* @input Plain measurements (item widths, gap, available width, indicator width, limits)
|
|
4
|
+
* @output Pure overflow computation: how many items are visible and their row layout
|
|
5
|
+
* @position Pure helper consumed by useOverflow; contains no DOM or React code so the
|
|
6
|
+
* fit/clamp math and the multi-row packing can be unit-tested in isolation.
|
|
7
|
+
*
|
|
8
|
+
* There is a single source of truth for `visibleCount`:
|
|
9
|
+
* visibleCount = clamp(fitCount, minVisibleItems, maxVisibleItems ?? itemCount)
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/hooks/useOverflow.ts (the only caller)
|
|
13
|
+
*/
|
|
14
|
+
export interface ComputeOverflowInput {
|
|
15
|
+
/** Measured widths of each item, in original DOM order. */
|
|
16
|
+
widths: number[];
|
|
17
|
+
/** Gap between items, in pixels. */
|
|
18
|
+
gap: number;
|
|
19
|
+
/** Width available to lay items out, in pixels. */
|
|
20
|
+
availableWidth: number;
|
|
21
|
+
/** Measured width of the overflow indicator (0 if none). */
|
|
22
|
+
indicatorWidth: number;
|
|
23
|
+
/** Floor — always show at least this many items. */
|
|
24
|
+
minVisibleItems: number;
|
|
25
|
+
/** Ceiling — never show more than this many items. `undefined` = no cap. */
|
|
26
|
+
maxVisibleItems?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Bounded multi-row: wrap items across up to this many rows, then collapse
|
|
29
|
+
* the rest into the overflow indicator. `undefined` (or `1`) = single line.
|
|
30
|
+
*/
|
|
31
|
+
maxRows?: number;
|
|
32
|
+
/** Which end items collapse from. */
|
|
33
|
+
collapseFrom: 'start' | 'end';
|
|
34
|
+
}
|
|
35
|
+
export interface ComputeOverflowResult {
|
|
36
|
+
/** Number of items that should be rendered in the visible container. */
|
|
37
|
+
visibleCount: number;
|
|
38
|
+
/** Number of rows the visible items occupy (always 1 for the single-line path). */
|
|
39
|
+
rows: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Pure overflow computation. Given plain measurements and the configured
|
|
43
|
+
* limits, return how many items should be visible and how many rows they
|
|
44
|
+
* occupy. No DOM, no React — safe to unit-test directly.
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeOverflow(input: ComputeOverflowInput): ComputeOverflowResult;
|
|
47
|
+
//# sourceMappingURL=computeOverflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/computeOverflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;AA0LD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,qBAAqB,CAqDvB"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file computeOverflow.ts
|
|
5
|
+
* @input Plain measurements (item widths, gap, available width, indicator width, limits)
|
|
6
|
+
* @output Pure overflow computation: how many items are visible and their row layout
|
|
7
|
+
* @position Pure helper consumed by useOverflow; contains no DOM or React code so the
|
|
8
|
+
* fit/clamp math and the multi-row packing can be unit-tested in isolation.
|
|
9
|
+
*
|
|
10
|
+
* There is a single source of truth for `visibleCount`:
|
|
11
|
+
* visibleCount = clamp(fitCount, minVisibleItems, maxVisibleItems ?? itemCount)
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update:
|
|
14
|
+
* - /packages/core/src/hooks/useOverflow.ts (the only caller)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function clamp(value, min, max) {
|
|
18
|
+
return Math.max(Math.min(value, max), min);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the ceiling and floor into a single [floor, ceiling] pair.
|
|
23
|
+
*
|
|
24
|
+
* `maxVisibleItems` is clamped to `itemCount` (a cap larger than the list is a
|
|
25
|
+
* no-op). When `maxVisibleItems < minVisibleItems`, the floor wins (D1) via the
|
|
26
|
+
* final clamp — the hook is responsible for the dev-only warning.
|
|
27
|
+
*/
|
|
28
|
+
function resolveBounds(itemCount, minVisibleItems, maxVisibleItems) {
|
|
29
|
+
const floor = Math.max(0, Math.min(minVisibleItems, itemCount));
|
|
30
|
+
const rawCeiling = maxVisibleItems == null ? itemCount : maxVisibleItems;
|
|
31
|
+
const ceiling = Math.max(0, Math.min(rawCeiling, itemCount));
|
|
32
|
+
return {
|
|
33
|
+
floor,
|
|
34
|
+
ceiling
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Single-line greedy fit: how many items fit in one row of `availableWidth`,
|
|
40
|
+
* reserving indicator space for every non-final admitted item. Mirrors the
|
|
41
|
+
* original in-hook loop so single-line behavior is unchanged.
|
|
42
|
+
*/
|
|
43
|
+
function computeSingleLineFit(orderedWidths, gap, availableWidth, indicatorWidth, floor, ceiling) {
|
|
44
|
+
let totalWidth = 0;
|
|
45
|
+
let count = 0;
|
|
46
|
+
for (let i = 0; i < orderedWidths.length; i++) {
|
|
47
|
+
if (count >= ceiling) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
const itemWidth = orderedWidths[i];
|
|
51
|
+
const gapWidth = i > 0 ? gap : 0;
|
|
52
|
+
const candidateWidth = totalWidth + itemWidth + gapWidth;
|
|
53
|
+
const isLastItem = i === orderedWidths.length - 1;
|
|
54
|
+
const reservedWidth = isLastItem ? 0 : indicatorWidth + (count > 0 || indicatorWidth > 0 ? gap : 0);
|
|
55
|
+
if (candidateWidth + reservedWidth > availableWidth && count >= floor) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
totalWidth = candidateWidth;
|
|
59
|
+
count++;
|
|
60
|
+
}
|
|
61
|
+
return count;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Pack items into rows, wrapping when the next item would exceed
|
|
66
|
+
* `availableWidth`. On the last allowed row, keep `indicatorReserve` px free so
|
|
67
|
+
* the overflow indicator fits. Stops admitting once no further item can be
|
|
68
|
+
* placed within `maxRows`.
|
|
69
|
+
*/
|
|
70
|
+
function packRows(orderedWidths, gap, availableWidth, indicatorReserve, maxRows) {
|
|
71
|
+
let placed = 0;
|
|
72
|
+
let row = 1;
|
|
73
|
+
let rowWidth = 0;
|
|
74
|
+
for (let i = 0; i < orderedWidths.length; i++) {
|
|
75
|
+
const w = orderedWidths[i];
|
|
76
|
+
const isFirstInRow = rowWidth === 0;
|
|
77
|
+
const candidate = isFirstInRow ? w : rowWidth + gap + w;
|
|
78
|
+
const onLastRow = row === maxRows;
|
|
79
|
+
const reserve = onLastRow && indicatorReserve > 0 ? indicatorReserve + gap : 0;
|
|
80
|
+
if (candidate + reserve <= availableWidth) {
|
|
81
|
+
rowWidth = candidate;
|
|
82
|
+
placed++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (isFirstInRow) {
|
|
86
|
+
// A single item wider than the row occupies this row alone (it will be
|
|
87
|
+
// clipped visually). But if it can't coexist with the reserved indicator
|
|
88
|
+
// on the last row, stop here.
|
|
89
|
+
if (onLastRow && reserve > 0) {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
rowWidth = candidate;
|
|
93
|
+
placed++;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (row >= maxRows) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
row++;
|
|
100
|
+
rowWidth = 0;
|
|
101
|
+
i--; // re-attempt this item as the first on the new row
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
placed,
|
|
105
|
+
rows: row
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Count how many rows a set of items occupies when wrapped at availableWidth. */
|
|
110
|
+
function countRows(orderedWidths, gap, availableWidth) {
|
|
111
|
+
if (orderedWidths.length === 0) {
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
let rows = 1;
|
|
115
|
+
let rowWidth = 0;
|
|
116
|
+
for (let i = 0; i < orderedWidths.length; i++) {
|
|
117
|
+
const w = orderedWidths[i];
|
|
118
|
+
const isFirstInRow = rowWidth === 0;
|
|
119
|
+
const candidate = isFirstInRow ? w : rowWidth + gap + w;
|
|
120
|
+
if (candidate <= availableWidth || isFirstInRow) {
|
|
121
|
+
rowWidth = candidate;
|
|
122
|
+
} else {
|
|
123
|
+
rows++;
|
|
124
|
+
rowWidth = w;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return rows;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Multi-row packing (Strategy A): simulate wrapping items into rows of
|
|
132
|
+
* `availableWidth`, admitting items until a new item would require a row beyond
|
|
133
|
+
* `maxRows`, reserving indicator space on the final row when items overflow.
|
|
134
|
+
* Returns the admitted count and how many rows those items occupy. Assumes
|
|
135
|
+
* uniform row height.
|
|
136
|
+
*/
|
|
137
|
+
function computeMultiRowFit(orderedWidths, gap, availableWidth, indicatorWidth, maxRows) {
|
|
138
|
+
const n = orderedWidths.length;
|
|
139
|
+
if (n === 0) {
|
|
140
|
+
return {
|
|
141
|
+
count: 0,
|
|
142
|
+
rows: 0
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// If everything fits within maxRows without reserving indicator space, there
|
|
147
|
+
// is no overflow and no indicator is needed.
|
|
148
|
+
const packAll = packRows(orderedWidths, gap, availableWidth, 0, maxRows);
|
|
149
|
+
if (packAll.placed === n) {
|
|
150
|
+
return {
|
|
151
|
+
count: n,
|
|
152
|
+
rows: packAll.rows
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Overflow → reserve indicator space on the final row and re-pack.
|
|
157
|
+
const packWithIndicator = packRows(orderedWidths, gap, availableWidth, indicatorWidth, maxRows);
|
|
158
|
+
const count = packWithIndicator.placed;
|
|
159
|
+
const rows = countRows(orderedWidths.slice(0, count), gap, availableWidth);
|
|
160
|
+
return {
|
|
161
|
+
count,
|
|
162
|
+
rows: Math.max(count > 0 ? 1 : 0, rows)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Pure overflow computation. Given plain measurements and the configured
|
|
168
|
+
* limits, return how many items should be visible and how many rows they
|
|
169
|
+
* occupy. No DOM, no React — safe to unit-test directly.
|
|
170
|
+
*/
|
|
171
|
+
export function computeOverflow(input) {
|
|
172
|
+
const {
|
|
173
|
+
widths,
|
|
174
|
+
gap,
|
|
175
|
+
availableWidth,
|
|
176
|
+
indicatorWidth,
|
|
177
|
+
minVisibleItems,
|
|
178
|
+
maxVisibleItems,
|
|
179
|
+
maxRows,
|
|
180
|
+
collapseFrom
|
|
181
|
+
} = input;
|
|
182
|
+
const itemCount = widths.length;
|
|
183
|
+
if (itemCount === 0) {
|
|
184
|
+
return {
|
|
185
|
+
visibleCount: 0,
|
|
186
|
+
rows: 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const {
|
|
190
|
+
floor,
|
|
191
|
+
ceiling
|
|
192
|
+
} = resolveBounds(itemCount, minVisibleItems, maxVisibleItems);
|
|
193
|
+
const orderedWidths = collapseFrom === 'end' ? widths : [...widths].reverse();
|
|
194
|
+
const multiRow = maxRows != null && maxRows > 1;
|
|
195
|
+
if (!multiRow) {
|
|
196
|
+
const fitCount = computeSingleLineFit(orderedWidths, gap, availableWidth, indicatorWidth, floor, ceiling);
|
|
197
|
+
const visibleCount = clamp(fitCount, floor, ceiling);
|
|
198
|
+
return {
|
|
199
|
+
visibleCount,
|
|
200
|
+
rows: visibleCount > 0 ? 1 : 0
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const {
|
|
204
|
+
count,
|
|
205
|
+
rows
|
|
206
|
+
} = computeMultiRowFit(orderedWidths, gap, availableWidth, indicatorWidth, maxRows);
|
|
207
|
+
const visibleCount = clamp(count, floor, ceiling);
|
|
208
|
+
const resolvedRows = visibleCount === count ? rows : countRows(orderedWidths.slice(0, visibleCount), gap, availableWidth);
|
|
209
|
+
return {
|
|
210
|
+
visibleCount,
|
|
211
|
+
rows: visibleCount > 0 ? Math.max(1, resolvedRows) : 0
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -9,6 +9,21 @@ export interface UseOverflowOptions {
|
|
|
9
9
|
* @default 0
|
|
10
10
|
*/
|
|
11
11
|
minVisibleItems?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum number of items to ever show, even if they all fit. The ceiling
|
|
14
|
+
* partner to `minVisibleItems`. `undefined` means no cap. When it is less
|
|
15
|
+
* than `minVisibleItems`, the floor wins and a dev-only warning is emitted.
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
maxVisibleItems?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Wrap items across up to this many rows before collapsing the rest into the
|
|
21
|
+
* overflow indicator. `undefined` (or `1`) keeps the single-line behavior.
|
|
22
|
+
* A number, not a boolean: unbounded wrapping is a plain flex-wrap layout,
|
|
23
|
+
* not overflow collapse. Assumes uniform row height.
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
maxRows?: number;
|
|
12
27
|
/**
|
|
13
28
|
* Which end to collapse items from.
|
|
14
29
|
* @default 'end'
|
|
@@ -35,6 +50,10 @@ export interface UseOverflowReturn {
|
|
|
35
50
|
visibleCount: number;
|
|
36
51
|
/** Whether any items are overflowing */
|
|
37
52
|
hasOverflow: boolean;
|
|
53
|
+
/** Number of rows the visible items occupy (1 for the single-line path) */
|
|
54
|
+
rows: number;
|
|
55
|
+
/** Measured max item height in pixels; used to size the multi-row container */
|
|
56
|
+
rowHeight: number;
|
|
38
57
|
}
|
|
39
58
|
/**
|
|
40
59
|
* Hook for managing horizontal overflow of a list of items.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAyJnB"}
|
|
@@ -10,14 +10,18 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Measures children rendered in a hidden container to determine how many fit
|
|
12
12
|
* in the available width, without flickering. Uses ResizeObserver to react
|
|
13
|
-
* to container size changes.
|
|
13
|
+
* to container size changes. Supports an optional item cap (`maxVisibleItems`)
|
|
14
|
+
* and bounded multi-row wrapping (`maxRows`); the fit/clamp/row-packing math
|
|
15
|
+
* lives in the pure `computeOverflow` helper.
|
|
14
16
|
*
|
|
15
17
|
* SYNC: When modified, update:
|
|
16
18
|
* - /packages/core/src/hooks/index.ts
|
|
19
|
+
* - /packages/core/src/hooks/computeOverflow.ts (the pure computation)
|
|
17
20
|
*/
|
|
18
21
|
import { useState, useCallback, useRef } from 'react';
|
|
19
22
|
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
20
23
|
import { observeResize, unobserveResize } from "../utils/sharedResizeObserver.js";
|
|
24
|
+
import { computeOverflow } from "./computeOverflow.js";
|
|
21
25
|
/**
|
|
22
26
|
* Hook for managing horizontal overflow of a list of items.
|
|
23
27
|
*
|
|
@@ -40,11 +44,18 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
40
44
|
const {
|
|
41
45
|
gap = 0,
|
|
42
46
|
minVisibleItems = 0,
|
|
47
|
+
maxVisibleItems,
|
|
48
|
+
maxRows,
|
|
43
49
|
collapseFrom = 'end',
|
|
44
50
|
behavior = 'observeSelf'
|
|
45
51
|
} = options;
|
|
52
|
+
if (process.env.NODE_ENV !== 'production' && maxVisibleItems != null && maxVisibleItems < minVisibleItems) {
|
|
53
|
+
console.warn(`useOverflow: maxVisibleItems (${maxVisibleItems}) is less than ` + `minVisibleItems (${minVisibleItems}); the floor wins and ` + `minVisibleItems items will be shown.`);
|
|
54
|
+
}
|
|
46
55
|
const observeParent = behavior === 'observeParent';
|
|
47
56
|
const [visibleCount, setVisibleCount] = useState(itemCount);
|
|
57
|
+
const [rows, setRows] = useState(1);
|
|
58
|
+
const [rowHeight, setRowHeight] = useState(0);
|
|
48
59
|
const containerElRef = useRef(null);
|
|
49
60
|
const measureElRef = useRef(null);
|
|
50
61
|
const observedElRef = useRef(null);
|
|
@@ -72,34 +83,33 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
72
83
|
if (children.length === 0) {
|
|
73
84
|
// eslint-disable-next-line @eslint-react/set-state-in-effect -- overflow count is derived from measured DOM widths
|
|
74
85
|
setVisibleCount(0);
|
|
86
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
87
|
+
setRows(0);
|
|
75
88
|
return;
|
|
76
89
|
}
|
|
77
|
-
|
|
78
|
-
// Collect widths of all children
|
|
79
90
|
const widths = children.map(child => child.offsetWidth);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
totalWidth = candidateWidth;
|
|
97
|
-
count++;
|
|
98
|
-
}
|
|
91
|
+
const measuredRowHeight = children.reduce((max, child) => Math.max(max, child.offsetHeight || 0), 0);
|
|
92
|
+
const {
|
|
93
|
+
visibleCount: nextVisible,
|
|
94
|
+
rows: nextRows
|
|
95
|
+
} = computeOverflow({
|
|
96
|
+
widths,
|
|
97
|
+
gap,
|
|
98
|
+
availableWidth,
|
|
99
|
+
indicatorWidth,
|
|
100
|
+
minVisibleItems,
|
|
101
|
+
maxVisibleItems,
|
|
102
|
+
maxRows,
|
|
103
|
+
collapseFrom
|
|
104
|
+
});
|
|
99
105
|
|
|
100
106
|
// eslint-disable-next-line @eslint-react/set-state-in-effect -- overflow count is derived from measured DOM widths
|
|
101
|
-
setVisibleCount(
|
|
102
|
-
|
|
107
|
+
setVisibleCount(nextVisible);
|
|
108
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
109
|
+
setRows(prev => prev === nextRows ? prev : nextRows);
|
|
110
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- derived from measured DOM
|
|
111
|
+
setRowHeight(prev => prev === measuredRowHeight ? prev : measuredRowHeight);
|
|
112
|
+
}, [itemCount, gap, minVisibleItems, maxVisibleItems, maxRows, collapseFrom, observeParent]);
|
|
103
113
|
const containerRef = useCallback(el => {
|
|
104
114
|
containerElRef.current = el;
|
|
105
115
|
|
|
@@ -132,6 +142,8 @@ export function useOverflow(itemCount, options = {}) {
|
|
|
132
142
|
containerRef,
|
|
133
143
|
measureRef,
|
|
134
144
|
visibleCount,
|
|
135
|
-
hasOverflow
|
|
145
|
+
hasOverflow,
|
|
146
|
+
rows,
|
|
147
|
+
rowHeight
|
|
136
148
|
};
|
|
137
149
|
}
|
package/dist/theme/Theme.js
CHANGED
|
@@ -115,7 +115,7 @@ function useThemeStyleInjection(theme) {
|
|
|
115
115
|
// One-time perf hint per theme
|
|
116
116
|
if (!warnedThemes.has(theme.name)) {
|
|
117
117
|
warnedThemes.add(theme.name);
|
|
118
|
-
console.warn(`[Astryx] Theme "${theme.name}" is using runtime style injection. ` + `For better performance, use the pre-built theme:\n\n` + ` import {${theme.name}Theme} from '@astryxdesign/theme-${theme.name}/built';\n` + ` import '@astryxdesign/theme-${theme.name}/theme.css';\n\n` + `For custom themes, run \`npx
|
|
118
|
+
console.warn(`[Astryx] Theme "${theme.name}" is using runtime style injection. ` + `For better performance, use the pre-built theme:\n\n` + ` import {${theme.name}Theme} from '@astryxdesign/theme-${theme.name}/built';\n` + ` import '@astryxdesign/theme-${theme.name}/theme.css';\n\n` + `For custom themes, run \`npx @astryxdesign/cli theme build <file>\` to generate ` + `the built artifacts.`);
|
|
119
119
|
}
|
|
120
120
|
const {
|
|
121
121
|
prose,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Two distribution modes:
|
|
5
5
|
* - Unbuilt: Theme generates CSS and injects a <style> tag at runtime
|
|
6
|
-
* - Built: `
|
|
6
|
+
* - Built: `astryx theme build` pre-compiles to a CSS file; Theme just
|
|
7
7
|
* sets the data-astryx-theme attribute
|
|
8
8
|
*
|
|
9
9
|
* Token values can be:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Two distribution modes:
|
|
7
7
|
* - Unbuilt: Theme generates CSS and injects a <style> tag at runtime
|
|
8
|
-
* - Built: `
|
|
8
|
+
* - Built: `astryx theme build` pre-compiles to a CSS file; Theme just
|
|
9
9
|
* sets the data-astryx-theme attribute
|
|
10
10
|
*
|
|
11
11
|
* Token values can be:
|
|
@@ -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,
|
|
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;AAwPD;;;;;;;;;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;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAQhE"}
|
|
@@ -247,6 +247,10 @@ export function generateThemeRules(theme) {
|
|
|
247
247
|
// 4. Prop-level color overrides (for text/heading/link specificity)
|
|
248
248
|
generateColorOverrides(theme.components || {}, parts);
|
|
249
249
|
|
|
250
|
+
// 5. Text `size`-prop font-size overrides (so an explicit size beats a
|
|
251
|
+
// themed type's font-size across the astryx-base → astryx-theme layers)
|
|
252
|
+
generateSizeOverrides(theme.components || {}, parts);
|
|
253
|
+
|
|
250
254
|
// (on-media rules are generated separately — see generateOnMediaCSS)
|
|
251
255
|
|
|
252
256
|
return parts;
|
|
@@ -408,6 +412,53 @@ function generateColorOverrides(components, parts) {
|
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Map a Text `size` prop value to its raw font-size token.
|
|
417
|
+
* Mirrors `sizeStyles` in `Text/text.stylex.ts` (note `xsm` → `--font-size-xs`).
|
|
418
|
+
* <!-- SYNC: packages/core/src/Text/text.stylex.ts (sizeStyles) -->
|
|
419
|
+
*/
|
|
420
|
+
const TEXT_SIZE_TOKEN_MAP = {
|
|
421
|
+
'4xs': 'var(--font-size-4xs)',
|
|
422
|
+
'3xs': 'var(--font-size-3xs)',
|
|
423
|
+
'2xs': 'var(--font-size-2xs)',
|
|
424
|
+
xsm: 'var(--font-size-xs)',
|
|
425
|
+
sm: 'var(--font-size-sm)',
|
|
426
|
+
base: 'var(--font-size-base)',
|
|
427
|
+
lg: 'var(--font-size-lg)',
|
|
428
|
+
xl: 'var(--font-size-xl)',
|
|
429
|
+
'2xl': 'var(--font-size-2xl)',
|
|
430
|
+
'3xl': 'var(--font-size-3xl)',
|
|
431
|
+
'4xl': 'var(--font-size-4xl)'
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Generate `size`-prop font-size overrides for the Text component.
|
|
436
|
+
*
|
|
437
|
+
* The `size` prop is documented as a font-size override that wins over the
|
|
438
|
+
* size implied by `type`. Its StyleX class lives in `@layer astryx-base`, but a
|
|
439
|
+
* theme's per-type font-size rule (`.astryx-text.<type>`) lives in the higher
|
|
440
|
+
* `@layer astryx-theme`, so the layer cascade let the theme silently shadow
|
|
441
|
+
* `size` for any `type` the theme styled. Re-emitting the size classes here —
|
|
442
|
+
* same layer as the type rules, same `.astryx-text.<x>` specificity, later in
|
|
443
|
+
* source — restores `size` as a real override.
|
|
444
|
+
*
|
|
445
|
+
* Only `font-size` is overridden; line-height and other type properties are
|
|
446
|
+
* intentionally preserved, matching the prop's documented contract.
|
|
447
|
+
*
|
|
448
|
+
* Gated on the theme touching `text` (which includes the auto-generated
|
|
449
|
+
* type-scale rules) — with no theme type rule to beat, the base-layer StyleX
|
|
450
|
+
* class already wins and no override is needed.
|
|
451
|
+
*/
|
|
452
|
+
function generateSizeOverrides(components, parts) {
|
|
453
|
+
if (!('text' in components)) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
for (const [sizeName, sizeValue] of Object.entries(TEXT_SIZE_TOKEN_MAP)) {
|
|
457
|
+
const suffix = parseStyleKey(`size:${sizeName}`);
|
|
458
|
+
parts.push(` ${componentClassSelector('text', suffix)} { font-size: ${sizeValue}; }`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
411
462
|
/**
|
|
412
463
|
* Generate theme rules split into component and prose groups.
|
|
413
464
|
*
|
package/dist/theme/hct.d.ts
CHANGED
package/dist/theme/hct.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hct.d.ts","sourceRoot":"","sources":["../../src/theme/hct.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAoFD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;
|
|
1
|
+
{"version":3,"file":"hct.d.ts","sourceRoot":"","sources":["../../src/theme/hct.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAoFD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAkBD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAkBzC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA8BzC;AAkDD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/D"}
|
package/dist/theme/hct.js
CHANGED
|
@@ -79,9 +79,6 @@ function labToXyz(L, a, b) {
|
|
|
79
79
|
export function toneToY(tone) {
|
|
80
80
|
return labFInv((tone + 16) / 116);
|
|
81
81
|
}
|
|
82
|
-
export function yToTone(y) {
|
|
83
|
-
return 116 * labF(y) - 16;
|
|
84
|
-
}
|
|
85
82
|
|
|
86
83
|
// =============================================================================
|
|
87
84
|
// Hex <-> RGB
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -8,6 +8,19 @@
|
|
|
8
8
|
* Size value type - accepts numbers (treated as pixels) or strings (e.g., '100%', '50vh').
|
|
9
9
|
*/
|
|
10
10
|
export type SizeValue = number | string;
|
|
11
|
+
/**
|
|
12
|
+
* Resting elevation level for configurable surfaces.
|
|
13
|
+
*
|
|
14
|
+
* Maps to the shadow token scale:
|
|
15
|
+
* - `none` = flat (`box-shadow: none`)
|
|
16
|
+
* - `low` = `--shadow-low`
|
|
17
|
+
* - `med` = `--shadow-med`
|
|
18
|
+
* - `high` = `--shadow-high`
|
|
19
|
+
*
|
|
20
|
+
* Components narrow this union to the steps they actually need — e.g. Card
|
|
21
|
+
* exposes all four, while ChatComposer exposes only `'none' | 'low'`.
|
|
22
|
+
*/
|
|
23
|
+
export type Elevation = 'none' | 'low' | 'med' | 'high';
|
|
11
24
|
/**
|
|
12
25
|
* Numeric spacing step from the Astryx spacing scale.
|
|
13
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC"}
|