@common-origin/design-system 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1122 -785
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Avatar/Avatar.d.mts +8 -0
- package/dist/components/atoms/Avatar/Avatar.mjs +103 -0
- package/dist/components/atoms/Avatar/Avatar.mjs.map +1 -0
- package/dist/components/atoms/Avatar/index.d.mts +1 -0
- package/dist/components/atoms/Badge/Badge.d.mts +25 -0
- package/dist/components/atoms/Badge/Badge.mjs +98 -0
- package/dist/components/atoms/Badge/Badge.mjs.map +1 -0
- package/dist/components/atoms/Badge/index.d.mts +2 -0
- package/dist/components/atoms/Box/Box.d.mts +62 -0
- package/dist/components/atoms/Box/Box.mjs +246 -0
- package/dist/components/atoms/Box/Box.mjs.map +1 -0
- package/dist/components/atoms/Box/index.d.mts +1 -0
- package/dist/components/atoms/Button/Button.d.mts +40 -0
- package/dist/components/atoms/Button/Button.mjs +208 -0
- package/dist/components/atoms/Button/Button.mjs.map +1 -0
- package/dist/components/atoms/Button/index.d.mts +1 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.d.mts +29 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.mjs +29 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.mjs.map +1 -0
- package/dist/components/atoms/CategoryBadge/index.d.mts +2 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.d.mts +69 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs +151 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs.map +1 -0
- package/dist/components/atoms/CategoryLabel/index.d.mts +2 -0
- package/dist/components/atoms/Chip/BooleanChip.d.mts +28 -0
- package/dist/components/atoms/Chip/BooleanChip.mjs +76 -0
- package/dist/components/atoms/Chip/BooleanChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/Chip.d.mts +37 -0
- package/dist/components/atoms/Chip/Chip.mjs +76 -0
- package/dist/components/atoms/Chip/Chip.mjs.map +1 -0
- package/dist/components/atoms/Chip/FilterChip.d.mts +13 -0
- package/dist/components/atoms/Chip/FilterChip.mjs +14 -0
- package/dist/components/atoms/Chip/FilterChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/InputChip.d.mts +27 -0
- package/dist/components/atoms/Chip/InputChip.mjs +97 -0
- package/dist/components/atoms/Chip/InputChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/index.d.mts +4 -0
- package/dist/components/atoms/Chip/shared/ChipBase.d.mts +12 -0
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +45 -0
- package/dist/components/atoms/Chip/shared/ChipBase.mjs.map +1 -0
- package/dist/components/atoms/Chip/shared/types.d.mts +34 -0
- package/dist/components/atoms/Chip/shared/types.d.ts +3 -1
- package/dist/components/atoms/Chip/shared/utils.d.mts +10 -0
- package/dist/components/atoms/Chip/shared/utils.d.ts +2 -3
- package/dist/components/atoms/Chip/shared/utils.mjs +46 -0
- package/dist/components/atoms/Chip/shared/utils.mjs.map +1 -0
- package/dist/components/atoms/Container/Container.d.mts +6 -0
- package/dist/components/atoms/Container/Container.mjs +24 -0
- package/dist/components/atoms/Container/Container.mjs.map +1 -0
- package/dist/components/atoms/Container/index.d.mts +1 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.d.mts +23 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.mjs +64 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.mjs.map +1 -0
- package/dist/components/atoms/DateFormatter/index.d.mts +1 -0
- package/dist/components/atoms/Divider/Divider.d.mts +30 -0
- package/dist/components/atoms/Divider/Divider.mjs +134 -0
- package/dist/components/atoms/Divider/Divider.mjs.map +1 -0
- package/dist/components/atoms/Divider/index.d.mts +1 -0
- package/dist/components/atoms/Icon/Icon.d.mts +22 -0
- package/dist/components/atoms/Icon/Icon.mjs +95 -0
- package/dist/components/atoms/Icon/Icon.mjs.map +1 -0
- package/dist/components/atoms/Icon/index.d.mts +1 -0
- package/dist/components/atoms/IconButton/IconButton.d.mts +14 -0
- package/dist/components/atoms/IconButton/IconButton.mjs +150 -0
- package/dist/components/atoms/IconButton/IconButton.mjs.map +1 -0
- package/dist/components/atoms/IconButton/index.d.mts +1 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.d.mts +26 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs +126 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs.map +1 -0
- package/dist/components/atoms/MoneyDisplay/index.d.mts +2 -0
- package/dist/components/atoms/Picture/Picture.d.mts +12 -0
- package/dist/components/atoms/Picture/Picture.mjs +65 -0
- package/dist/components/atoms/Picture/Picture.mjs.map +1 -0
- package/dist/components/atoms/Picture/index.d.mts +1 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +21 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.mjs +91 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.mjs.map +1 -0
- package/dist/components/atoms/ProgressBar/index.d.mts +2 -0
- package/dist/components/atoms/Stack/Stack.d.mts +16 -0
- package/dist/components/atoms/Stack/Stack.mjs +71 -0
- package/dist/components/atoms/Stack/Stack.mjs.map +1 -0
- package/dist/components/atoms/Stack/index.d.mts +1 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.d.mts +23 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs +18 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs.map +1 -0
- package/dist/components/atoms/StatusBadge/index.d.mts +2 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.d.mts +17 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs +28 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs.map +1 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.d.mts +49 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs +161 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs.map +1 -0
- package/dist/components/atoms/StatusLabel/index.d.mts +2 -0
- package/dist/components/atoms/Tag/Tag.d.mts +36 -0
- package/dist/components/atoms/Tag/Tag.mjs +115 -0
- package/dist/components/atoms/Tag/Tag.mjs.map +1 -0
- package/dist/components/atoms/Tag/index.d.mts +2 -0
- package/dist/components/atoms/Typography/Typography.d.mts +34 -0
- package/dist/components/atoms/Typography/Typography.mjs +139 -0
- package/dist/components/atoms/Typography/Typography.mjs.map +1 -0
- package/dist/components/atoms/Typography/index.d.mts +1 -0
- package/dist/components/atoms/index.d.mts +20 -0
- package/dist/components/index.d.mts +4 -0
- package/dist/components/layout/GridSystem/GridSystem.d.mts +58 -0
- package/dist/components/layout/GridSystem/GridSystem.mjs +221 -0
- package/dist/components/layout/GridSystem/GridSystem.mjs.map +1 -0
- package/dist/components/layout/GridSystem/index.d.mts +1 -0
- package/dist/components/layout/index.d.mts +1 -0
- package/dist/components/molecules/AccountCard/AccountCard.d.mts +44 -0
- package/dist/components/molecules/AccountCard/AccountCard.mjs +191 -0
- package/dist/components/molecules/AccountCard/AccountCard.mjs.map +1 -0
- package/dist/components/molecules/AccountCard/index.d.mts +2 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.d.mts +111 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +283 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs.map +1 -0
- package/dist/components/molecules/ActionSheet/index.d.mts +2 -0
- package/dist/components/molecules/AgentInput/AgentInput.d.mts +30 -0
- package/dist/components/molecules/AgentInput/AgentInput.mjs +735 -0
- package/dist/components/molecules/AgentInput/AgentInput.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.mts +43 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs +49 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.d.mts +29 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.mjs +55 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/index.d.mts +3 -0
- package/dist/components/molecules/Alert/Alert.d.mts +68 -0
- package/dist/components/molecules/Alert/Alert.mjs +284 -0
- package/dist/components/molecules/Alert/Alert.mjs.map +1 -0
- package/dist/components/molecules/Alert/index.d.mts +1 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.mts +16 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.mjs +74 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.mjs.map +1 -0
- package/dist/components/molecules/Breadcrumbs/index.d.mts +1 -0
- package/dist/components/molecules/CardLarge/CardLarge.d.mts +12 -0
- package/dist/components/molecules/CardLarge/CardLarge.mjs +75 -0
- package/dist/components/molecules/CardLarge/CardLarge.mjs.map +1 -0
- package/dist/components/molecules/CardLarge/index.d.mts +1 -0
- package/dist/components/molecules/CardSmall/CardSmall.d.mts +16 -0
- package/dist/components/molecules/CardSmall/CardSmall.mjs +73 -0
- package/dist/components/molecules/CardSmall/CardSmall.mjs.map +1 -0
- package/dist/components/molecules/CardSmall/index.d.mts +1 -0
- package/dist/components/molecules/Checkbox/Checkbox.d.mts +64 -0
- package/dist/components/molecules/Checkbox/Checkbox.mjs +139 -0
- package/dist/components/molecules/Checkbox/Checkbox.mjs.map +1 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.d.mts +40 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +99 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs.map +1 -0
- package/dist/components/molecules/Checkbox/index.d.mts +3 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.d.mts +7 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +54 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs.map +1 -0
- package/dist/components/molecules/ChipGroup/index.d.mts +1 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.d.mts +46 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.mjs +231 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.mjs.map +1 -0
- package/dist/components/molecules/CodeBlock/index.d.mts +1 -0
- package/dist/components/molecules/DateGroup/DateGroup.d.mts +37 -0
- package/dist/components/molecules/DateGroup/DateGroup.mjs +104 -0
- package/dist/components/molecules/DateGroup/DateGroup.mjs.map +1 -0
- package/dist/components/molecules/DateGroup/index.d.mts +2 -0
- package/dist/components/molecules/Dropdown/Dropdown.d.mts +27 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs +282 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs.map +1 -0
- package/dist/components/molecules/Dropdown/index.d.mts +1 -0
- package/dist/components/molecules/EmptyState/EmptyState.d.mts +32 -0
- package/dist/components/molecules/EmptyState/EmptyState.mjs +133 -0
- package/dist/components/molecules/EmptyState/EmptyState.mjs.map +1 -0
- package/dist/components/molecules/EmptyState/index.d.mts +2 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.d.mts +14 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs +99 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs.map +1 -0
- package/dist/components/molecules/FeatureBlock/index.d.mts +1 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.d.mts +54 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.mjs +140 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.mjs.map +1 -0
- package/dist/components/molecules/InlineAlert/index.d.mts +2 -0
- package/dist/components/molecules/List/List.d.mts +30 -0
- package/dist/components/molecules/List/List.mjs +45 -0
- package/dist/components/molecules/List/List.mjs.map +1 -0
- package/dist/components/molecules/List/ListContext.d.mts +6 -0
- package/dist/components/molecules/List/ListContext.mjs +11 -0
- package/dist/components/molecules/List/ListContext.mjs.map +1 -0
- package/dist/components/molecules/List/ListItem.d.mts +101 -0
- package/dist/components/molecules/List/ListItem.mjs +224 -0
- package/dist/components/molecules/List/ListItem.mjs.map +1 -0
- package/dist/components/molecules/List/index.d.mts +4 -0
- package/dist/components/molecules/Modal/Modal.d.mts +69 -0
- package/dist/components/molecules/Modal/Modal.mjs +259 -0
- package/dist/components/molecules/Modal/Modal.mjs.map +1 -0
- package/dist/components/molecules/Modal/index.d.mts +2 -0
- package/dist/components/molecules/NumberInput/NumberInput.d.mts +86 -0
- package/dist/components/molecules/NumberInput/NumberInput.mjs +268 -0
- package/dist/components/molecules/NumberInput/NumberInput.mjs.map +1 -0
- package/dist/components/molecules/NumberInput/index.d.mts +2 -0
- package/dist/components/molecules/PageTitle/PageTitle.d.mts +21 -0
- package/dist/components/molecules/PageTitle/PageTitle.mjs +77 -0
- package/dist/components/molecules/PageTitle/PageTitle.mjs.map +1 -0
- package/dist/components/molecules/PageTitle/index.d.mts +1 -0
- package/dist/components/molecules/PasswordField/PasswordField.d.mts +55 -0
- package/dist/components/molecules/PasswordField/PasswordField.mjs +146 -0
- package/dist/components/molecules/PasswordField/PasswordField.mjs.map +1 -0
- package/dist/components/molecules/PasswordField/index.d.mts +2 -0
- package/dist/components/molecules/SearchField/SearchField.d.mts +108 -0
- package/dist/components/molecules/SearchField/SearchField.mjs +340 -0
- package/dist/components/molecules/SearchField/SearchField.mjs.map +1 -0
- package/dist/components/molecules/SearchField/index.d.mts +2 -0
- package/dist/components/molecules/Sheet/Sheet.d.mts +96 -0
- package/dist/components/molecules/Sheet/Sheet.mjs +243 -0
- package/dist/components/molecules/Sheet/Sheet.mjs.map +1 -0
- package/dist/components/molecules/Sheet/index.d.mts +2 -0
- package/dist/components/molecules/Slider/Slider.d.mts +102 -0
- package/dist/components/molecules/Slider/Slider.mjs +462 -0
- package/dist/components/molecules/Slider/Slider.mjs.map +1 -0
- package/dist/components/molecules/Slider/index.d.mts +2 -0
- package/dist/components/molecules/TabBar/TabBar.d.mts +82 -0
- package/dist/components/molecules/TabBar/TabBar.mjs +213 -0
- package/dist/components/molecules/TabBar/TabBar.mjs.map +1 -0
- package/dist/components/molecules/TabBar/index.d.mts +2 -0
- package/dist/components/molecules/TextField/InputBase.d.mts +22 -0
- package/dist/components/molecules/TextField/InputBase.mjs +56 -0
- package/dist/components/molecules/TextField/InputBase.mjs.map +1 -0
- package/dist/components/molecules/TextField/TextField.d.mts +56 -0
- package/dist/components/molecules/TextField/TextField.mjs +115 -0
- package/dist/components/molecules/TextField/TextField.mjs.map +1 -0
- package/dist/components/molecules/TextField/index.d.mts +4 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.d.mts +39 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +224 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs.map +1 -0
- package/dist/components/molecules/TransactionListItem/index.d.mts +2 -0
- package/dist/components/molecules/index.d.mts +26 -0
- package/dist/data.js +261 -14
- package/dist/data.js.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +55 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/cssTokens.d.mts +14 -0
- package/dist/lib/cssTokens.d.ts +14 -0
- package/dist/lib/cssTokens.mjs +19 -0
- package/dist/lib/cssTokens.mjs.map +1 -0
- package/dist/lib/cssVariables.d.mts +15 -0
- package/dist/lib/cssVariables.d.ts +15 -0
- package/dist/lib/cssVariables.mjs +37 -0
- package/dist/lib/cssVariables.mjs.map +1 -0
- package/dist/lib/styleUtils.d.mts +42 -0
- package/dist/lib/styleUtils.d.ts +23 -0
- package/dist/lib/styleUtils.mjs +160 -0
- package/dist/lib/styleUtils.mjs.map +1 -0
- package/dist/lib/tokenAliases.d.mts +13 -0
- package/dist/lib/tokenAliases.d.ts +13 -0
- package/dist/lib/tokenAliases.mjs +121 -0
- package/dist/lib/tokenAliases.mjs.map +1 -0
- package/dist/lib/usePresence.d.mts +16 -0
- package/dist/lib/usePresence.mjs +50 -0
- package/dist/lib/usePresence.mjs.map +1 -0
- package/dist/{data.esm.js → styles/icons.json.mjs} +2 -1219
- package/dist/styles/icons.json.mjs.map +1 -0
- package/dist/styles/tokens.d.mts +3174 -0
- package/dist/styles/tokens.d.ts +3174 -0
- package/dist/styles/tokens.json +257 -12
- package/dist/{tokens/index.esm.js → styles/tokens.json.mjs} +259 -20
- package/dist/{tokens/index.esm.js.map → styles/tokens.json.mjs.map} +1 -1
- package/dist/tokens/index.js +261 -14
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +1462 -0
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/tokens/styles/tokens.d.mts +3174 -0
- package/dist/tokens/styles/tokens.d.ts +3174 -0
- package/dist/tokens/tokens.d.mts +4 -0
- package/dist/tokens/types/tokens.d.mts +6 -0
- package/dist/tokens/types/tokens.d.ts +3 -1204
- package/dist/tokens.css +710 -430
- package/dist/tokens.css.d.mts +4 -0
- package/dist/types/icons.d.mts +25 -0
- package/dist/types/icons.mjs +10 -0
- package/dist/types/icons.mjs.map +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/tokens.d.mts +6 -0
- package/dist/types/tokens.d.ts +3 -1204
- package/dist/types/tokens.mjs +10 -0
- package/dist/types/tokens.mjs.map +1 -0
- package/dist/vendor/tslib/tslib.es6.mjs +99 -0
- package/dist/vendor/tslib/tslib.es6.mjs.map +1 -0
- package/package.json +29 -13
- package/dist/client.esm.js +0 -7952
- package/dist/client.esm.js.map +0 -1
- package/dist/data.esm.js.map +0 -1
- package/dist/index.esm.js +0 -8
- package/dist/index.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenAliases.mjs","sources":["../../src/lib/tokenAliases.ts"],"sourcesContent":["import tokens from './cssTokens'\nimport type { Tokens } from '../types/tokens'\n\n// Props whose values are token keys keep their published vocabulary in 2.x (P7), but read the\n// semantic grammar's names (decision 0031, #189). Each map covers every key the prop type allows,\n// so TypeScript fails here if a key is added without a mapping.\nconst { semantic } = tokens\nconst { color, space, radius, surface } = semantic\n\ntype Semantic = Tokens['semantic']\n\n/** Box's spacing props (`p`, `m`, `gap`…): the old layout scale's keys, read from `space`. */\nexport const spaceByLayoutKey: Record<keyof Semantic['spacing']['layout'], string> = {\n none: space[0],\n xs: space[100],\n sm: space[200],\n md: space[300],\n lg: space[400],\n xl: space[500],\n '2xl': space[600],\n '3xl': space[700],\n '4xl': space[800],\n '5xl': space[900],\n '6xl': space[1000],\n '7xl': space[1200],\n '8xl': space[1400],\n '9xl': space[1600],\n '10xl': space[2000],\n '11xl': space[2400],\n // A keyword, not a step: it stays until the keyword question is settled (0031)\n auto: semantic.spacing.layout.auto,\n}\n\n/** Box's `borderRadius` prop: the old radius keys, read from `radius`. */\nexport const radiusByKey: Record<keyof Semantic['border']['radius'], string> = {\n none: radius.none,\n xs: radius.xs,\n sm: radius.sm,\n md: radius.md,\n lg: radius.lg,\n xl: radius.xl,\n '2xl': radius['2xl'],\n '3xl': radius['3xl'],\n circle: radius.full,\n}\n\n/** Box's `bg` prop: the old background keys, read from `surface` and `color.fill`. */\nexport const backgroundByKey: Record<keyof Semantic['color']['background'], string> = {\n default: surface.base,\n page: surface.base,\n subtle: surface.raised,\n overlay: surface.scrim,\n emphasis: color.fill.emphasis,\n 'emphasis-hover': color.fill['emphasis-hover'],\n 'emphasis-active': color.fill['emphasis-pressed'],\n surface: color.fill.muted,\n inverse: color.fill.inverse,\n interactive: color.fill.accent,\n 'interactive-hover': color.fill['accent-hover'],\n 'interactive-active': color.fill['accent-pressed'],\n 'interactive-subtle': color.fill['accent-muted'],\n 'interactive-subtle-hover': color.fill['accent-muted-hover'],\n 'interactive-subtle-active': color.fill['accent-muted-pressed'],\n error: color.fill.danger,\n 'error-hover': color.fill['danger-hover'],\n 'error-active': color.fill['danger-pressed'],\n 'error-subtle': color.fill['danger-muted'],\n success: color.fill.success,\n 'success-subtle': color.fill['success-muted'],\n warning: color.fill.warning,\n 'warning-subtle': color.fill['warning-muted'],\n disabled: color.fill.disabled,\n neutral: color.fill.default,\n 'neutral-hover': color.fill['default-hover'],\n 'neutral-active': color.fill['default-pressed'],\n transparent: color.fill.none,\n 'hover-overlay': color.fill['none-hover'],\n 'active-overlay': color.fill['none-pressed'],\n 'inverse-overlay': color.fill['inverse-none-hover'],\n // Moved to the component tier (decision 0031 §6)\n progressTrack: tokens.component.track.background,\n}\n\n/** Box's `color` prop: text colours, old and new keys. */\nexport const textColorByKey: Record<keyof Semantic['color']['text'], string> = {\n default: color.text.default,\n emphasis: color.text.emphasis,\n inverse: color.text.inverse,\n disabled: color.text.disabled,\n success: color.text.success,\n warning: color.text.warning,\n muted: color.text.muted,\n accent: color.text.accent,\n 'accent-hover': color.text['accent-hover'],\n 'accent-pressed': color.text['accent-pressed'],\n danger: color.text.danger,\n subdued: color.text.muted,\n interactive: color.text.accent,\n 'interactive-hover': color.text['accent-hover'],\n 'interactive-active': color.text['accent-pressed'],\n error: color.text.danger,\n}\n\n/** Box's border props: border colours, old and new keys. */\nexport const borderColorByKey: Record<keyof Semantic['color']['border'], string> = {\n default: color.border.default,\n success: color.border.success,\n warning: color.border.warning,\n none: color.border.none,\n emphasis: color.border.emphasis,\n input: color.border.input,\n 'input-hover': color.border['input-hover'],\n focus: color.border.focus,\n accent: color.border.accent,\n danger: color.border.danger,\n subtle: color.border.emphasis,\n control: color.border.input,\n // `strong` split by use (0031); as a generic firm outline it is the hovered-input border\n strong: color.border['input-hover'],\n interactive: color.border.accent,\n error: color.border.danger,\n}\n"],"names":["semantic","tokens","color","space","radius","surface","spaceByLayoutKey","none","xs","sm","md","lg","xl","auto","spacing","layout","radiusByKey","circle","full","backgroundByKey","base","page","subtle","raised","overlay","scrim","emphasis","fill","muted","inverse","interactive","accent","error","danger","success","warning","disabled","neutral","transparent","progressTrack","component","track","background","textColorByKey","text","subdued","borderColorByKey","border","input","focus","control","strong"],"mappings":";;;AAGA;AACA;AACA;AACQ,IAAAA,QAAQ,GAAKC,MAAM,CAAAD,QAAX,CAAA;AACR,IAAAE,KAAK,GAA6BF,QAAQ,MAArC;EAAEG,KAAK,GAAsBH,QAAQ,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KAAK;AACzB,EAAA,aAAa,EAAE9C,KAAK,CAAC6C,MAAM,CAAC,aAAa,CAAC;AAC1CE,EAAAA,KAAK,EAAE/C,KAAK,CAAC6C,MAAM,CAACE,KAAK;AACzBlB,EAAAA,MAAM,EAAE7B,KAAK,CAAC6C,MAAM,CAAChB,MAAM;AAC3BE,EAAAA,MAAM,EAAE/B,KAAK,CAAC6C,MAAM,CAACd,MAAM;AAC3BX,EAAAA,MAAM,EAAEpB,KAAK,CAAC6C,MAAM,CAACrB,QAAQ;AAC7BwB,EAAAA,OAAO,EAAEhD,KAAK,CAAC6C,MAAM,CAACC,KAAK;AAC3B;AACAG,EAAAA,MAAM,EAAEjD,KAAK,CAAC6C,MAAM,CAAC,aAAa,CAAC;AACnCjB,EAAAA,WAAW,EAAE5B,KAAK,CAAC6C,MAAM,CAAChB,MAAM;AAChCC,EAAAA,KAAK,EAAE9B,KAAK,CAAC6C,MAAM,CAACd,MAAAA;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export declare const EXIT_DURATION_MS: number;
|
|
3
|
+
/**
|
|
4
|
+
* Keeps an element mounted for `exitMs` after `isOpen` turns false, so its exit
|
|
5
|
+
* animation can run before it unmounts (decision 0005).
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePresence(isOpen: boolean, exitMs?: number): {
|
|
8
|
+
isPresent: boolean;
|
|
9
|
+
isExiting: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Makes an element inert while `isInert` is true, so an exiting overlay's controls leave
|
|
13
|
+
* the tab order and can't be activated. Set through the DOM because React 18 has no
|
|
14
|
+
* `inert` prop.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useInert(ref: RefObject<HTMLElement | null>, isInert: boolean): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import tokensJson from '../styles/tokens.json.mjs';
|
|
4
|
+
|
|
5
|
+
// How long an exiting element stays mounted: the duration of `exitAnimation` in styleUtils. A timer
|
|
6
|
+
// needs the resolved value, not the CSS variable (decision 0041).
|
|
7
|
+
var EXIT_DURATION_MS = parseInt(tokensJson.semantic.motion.duration.fast, 10);
|
|
8
|
+
/**
|
|
9
|
+
* Keeps an element mounted for `exitMs` after `isOpen` turns false, so its exit
|
|
10
|
+
* animation can run before it unmounts (decision 0005).
|
|
11
|
+
*/
|
|
12
|
+
function usePresence(isOpen, exitMs) {
|
|
13
|
+
if (exitMs === void 0) {
|
|
14
|
+
exitMs = EXIT_DURATION_MS;
|
|
15
|
+
}
|
|
16
|
+
var _a = useState(isOpen),
|
|
17
|
+
isMounted = _a[0],
|
|
18
|
+
setIsMounted = _a[1];
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if (isOpen) {
|
|
21
|
+
setIsMounted(true);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var timer = setTimeout(function () {
|
|
25
|
+
return setIsMounted(false);
|
|
26
|
+
}, exitMs);
|
|
27
|
+
return function () {
|
|
28
|
+
return clearTimeout(timer);
|
|
29
|
+
};
|
|
30
|
+
}, [isOpen, exitMs]);
|
|
31
|
+
return {
|
|
32
|
+
isPresent: isOpen || isMounted,
|
|
33
|
+
isExiting: !isOpen && isMounted
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Makes an element inert while `isInert` is true, so an exiting overlay's controls leave
|
|
38
|
+
* the tab order and can't be activated. Set through the DOM because React 18 has no
|
|
39
|
+
* `inert` prop.
|
|
40
|
+
*/
|
|
41
|
+
function useInert(ref, isInert) {
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
var node = ref.current;
|
|
44
|
+
if (!node) return;
|
|
45
|
+
if (isInert) node.setAttribute('inert', '');else node.removeAttribute('inert');
|
|
46
|
+
}, [ref, isInert]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { EXIT_DURATION_MS, useInert, usePresence };
|
|
50
|
+
//# sourceMappingURL=usePresence.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePresence.mjs","sources":["../../src/lib/usePresence.ts"],"sourcesContent":["import { useEffect, useState, type RefObject } from 'react'\n// The exit timer needs the resolved duration, not its CSS variable (decision 0041)\n// eslint-disable-next-line no-restricted-imports\nimport tokenValues from '../styles/tokens.json'\n\n// How long an exiting element stays mounted: the duration of `exitAnimation` in styleUtils. A timer\n// needs the resolved value, not the CSS variable (decision 0041).\nexport const EXIT_DURATION_MS = parseInt(tokenValues.semantic.motion.duration.fast, 10)\n\n/**\n * Keeps an element mounted for `exitMs` after `isOpen` turns false, so its exit\n * animation can run before it unmounts (decision 0005).\n */\nexport function usePresence(isOpen: boolean, exitMs: number = EXIT_DURATION_MS) {\n const [isMounted, setIsMounted] = useState(isOpen)\n\n useEffect(() => {\n if (isOpen) {\n setIsMounted(true)\n return\n }\n const timer = setTimeout(() => setIsMounted(false), exitMs)\n return () => clearTimeout(timer)\n }, [isOpen, exitMs])\n\n return {\n isPresent: isOpen || isMounted,\n isExiting: !isOpen && isMounted,\n }\n}\n\n/**\n * Makes an element inert while `isInert` is true, so an exiting overlay's controls leave\n * the tab order and can't be activated. Set through the DOM because React 18 has no\n * `inert` prop.\n */\nexport function useInert(ref: RefObject<HTMLElement | null>, isInert: boolean) {\n useEffect(() => {\n const node = ref.current\n if (!node) return\n if (isInert) node.setAttribute('inert', '')\n else node.removeAttribute('inert')\n }, [ref, isInert])\n}\n"],"names":["EXIT_DURATION_MS","parseInt","tokenValues","semantic","motion","duration","fast","usePresence","isOpen","exitMs","_a","useState","isMounted","setIsMounted","useEffect","timer","setTimeout","clearTimeout","isPresent","isExiting","useInert","ref","isInert","node","current","setAttribute","removeAttribute"],"mappings":";;;;AAKA;AACA;IACaA,gBAAgB,GAAGC,QAAQ,CAACC,UAAW,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAACC,IAAI,E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