@yahoo/uds 3.156.2 → 3.157.1
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/automated-config/dist/generated/autoVariants.cjs +9 -4
- package/dist/automated-config/dist/generated/autoVariants.d.cts +2 -1
- package/dist/automated-config/dist/generated/autoVariants.d.ts +2 -1
- package/dist/automated-config/dist/generated/autoVariants.js +9 -4
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +158 -141
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +158 -141
- package/dist/automated-config/dist/generated/generatedConfigs.js +3078 -3089
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +1217 -491
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +1217 -491
- package/dist/automated-config/dist/properties.cjs +9 -2
- package/dist/automated-config/dist/properties.d.cts +23 -0
- package/dist/automated-config/dist/properties.d.ts +23 -0
- package/dist/automated-config/dist/properties.js +9 -2
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +77 -4
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +77 -4
- package/dist/automated-config/dist/types/ConfigSchema.d.cts +14 -2
- package/dist/automated-config/dist/types/ConfigSchema.d.ts +14 -2
- package/dist/automated-config/dist/types/StateAxis.cjs +90 -0
- package/dist/automated-config/dist/types/StateAxis.d.cts +70 -0
- package/dist/automated-config/dist/types/StateAxis.d.ts +70 -0
- package/dist/automated-config/dist/types/StateAxis.js +84 -0
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +105 -82
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +41 -12
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +41 -12
- package/dist/automated-config/dist/utils/buildConfigSchema.js +106 -83
- package/dist/automated-config/dist/utils/canonicalizeStateKey.cjs +32 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.d.cts +48 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.d.ts +48 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.js +31 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.cjs +129 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.cts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.ts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.js +122 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.cjs +114 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.cts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.ts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.js +108 -0
- package/dist/automated-config/dist/utils/getConfigComponentVariant.d.cts +8 -0
- package/dist/automated-config/dist/utils/getConfigComponentVariant.d.ts +8 -0
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +3 -3
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +3 -3
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +12 -5
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.cts +8 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.ts +8 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +12 -5
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +110 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.cts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.ts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.js +108 -0
- package/dist/automated-config/dist/utils/index.cjs +478 -111
- package/dist/automated-config/dist/utils/index.d.cts +76 -15
- package/dist/automated-config/dist/utils/index.d.ts +76 -15
- package/dist/automated-config/dist/utils/index.js +479 -113
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.cjs +15 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.cts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.ts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.js +15 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.cts +80 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.ts +80 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.js +120 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.cjs +131 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.d.cts +49 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.d.ts +49 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.js +130 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.cjs +118 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.d.cts +68 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.d.ts +68 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.js +117 -0
- package/dist/automated-config/dist/utils/variantConfigGuards.d.cts +13 -0
- package/dist/automated-config/dist/utils/variantConfigGuards.d.ts +13 -0
- package/dist/components/client/Button.cjs +3 -3
- package/dist/components/client/Button.js +3 -3
- package/dist/components/client/Input/Input.cjs +42 -6
- package/dist/components/client/Input/Input.d.cts +13 -0
- package/dist/components/client/Input/Input.d.ts +13 -0
- package/dist/components/client/Input/Input.js +42 -6
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/config/dist/index.cjs +224 -553
- package/dist/config/dist/index.js +224 -553
- package/dist/css/dist/commands/css.cjs +1 -0
- package/dist/css/dist/commands/css.helpers.cjs +6 -0
- package/dist/css/dist/commands/css.helpers.js +6 -0
- package/dist/css/dist/commands/css.js +1 -0
- package/dist/css/dist/css/generate.cjs +4 -2
- package/dist/css/dist/css/generate.d.cts +28 -0
- package/dist/css/dist/css/generate.d.ts +28 -0
- package/dist/css/dist/css/generate.helpers.cjs +5 -1
- package/dist/css/dist/css/generate.helpers.js +6 -2
- package/dist/css/dist/css/generate.js +4 -2
- package/dist/css/dist/css/postcss.cjs +81 -0
- package/dist/css/dist/css/postcss.helpers.cjs +60 -0
- package/dist/css/dist/css/postcss.helpers.js +59 -1
- package/dist/css/dist/css/postcss.js +82 -2
- package/dist/css/dist/css/runner.cjs +12 -2
- package/dist/css/dist/css/runner.js +12 -2
- package/dist/css/dist/css/theme.d.cts +6 -0
- package/dist/css/dist/css/theme.d.ts +6 -0
- package/dist/css/dist/packages/automated-config/dist/properties.cjs +9 -2
- package/dist/css/dist/packages/automated-config/dist/properties.js +9 -2
- package/dist/css/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
- package/dist/css/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
- package/dist/css/dist/packages/config/dist/index.cjs +224 -553
- package/dist/css/dist/packages/config/dist/index.js +224 -553
- package/dist/css/dist/utils/optimizeCSS.cjs +59 -0
- package/dist/css/dist/utils/optimizeCSS.js +59 -0
- package/dist/css-tokens/dist/index.cjs +2 -0
- package/dist/css-tokens/dist/index.d.cts +2 -1
- package/dist/css-tokens/dist/index.d.ts +2 -1
- package/dist/css-tokens/dist/index.js +2 -1
- package/dist/index.cjs +48 -0
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +14 -3
- package/dist/styles/styler.d.cts +8 -7
- package/dist/styles/styler.d.ts +8 -7
- package/dist/styles/variants.d.cts +9 -4
- package/dist/styles/variants.d.ts +9 -4
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3078 -3089
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.cjs +9 -2
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.js +9 -2
- package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.cjs +81 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.js +76 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.cjs +33 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js +32 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +0 -7
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +1 -7
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.cjs +126 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js +123 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +422 -111
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +423 -112
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.js +121 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.cjs +132 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.js +131 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.cjs +95 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.js +95 -0
- package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +224 -553
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +224 -553
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +2 -0
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +2 -1
- package/dist/tailwind-internal/dist/plugins/components.cjs +28 -24
- package/dist/tailwind-internal/dist/plugins/components.js +28 -24
- package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.cts +3 -0
- package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.ts +3 -0
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/tokens/automation/index.cjs +47 -0
- package/dist/tokens/automation/index.d.cts +13 -2
- package/dist/tokens/automation/index.d.ts +13 -2
- package/dist/tokens/automation/index.js +13 -2
- package/dist/tokens/consts/cssTokens.cjs +1 -0
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +48 -0
- package/dist/tokens/index.d.cts +15 -4
- package/dist/tokens/index.d.ts +15 -4
- package/dist/tokens/index.js +14 -3
- package/dist/tokens/types.d.cts +1 -1
- package/dist/tokens/types.d.ts +1 -1
- package/dist/uds/generated/componentData.cjs +2177 -2172
- package/dist/uds/generated/componentData.js +2177 -2172
- package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
- package/dist/uds/generated/migrationSchemaVersion.js +1 -1
- package/dist/uds/generated/tailwindPurge.cjs +79 -78
- package/dist/uds/generated/tailwindPurge.js +79 -78
- package/generated/componentData.json +2718 -2713
- package/generated/migrationSchemaVersion.ts +1 -1
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ const require_index$1 = require("../../motion-tokens/dist/index.cjs");
|
|
|
8
8
|
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
9
9
|
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
10
10
|
const isInputWrapperCtx = (context) => {
|
|
11
|
-
return context.componentName === "input" && context.layer === "inputWrapper";
|
|
11
|
+
return context.componentName === "input" && (context.layer === "inputWrapper" || context.layer === "inputWrapperDynamic");
|
|
12
12
|
};
|
|
13
13
|
const hexToRgb = (hex) => {
|
|
14
14
|
hex = hex.replace("#", "");
|
|
@@ -434,6 +434,12 @@ const paginationWidthVar = {
|
|
|
434
434
|
possibleFixtures: ["positiveIntegers"],
|
|
435
435
|
twThemePath: (_, value) => `${value}px`
|
|
436
436
|
};
|
|
437
|
+
const controlHeight = {
|
|
438
|
+
name: "controlHeight",
|
|
439
|
+
cssProperties: [],
|
|
440
|
+
possibleFixtures: ["positiveIntegers"],
|
|
441
|
+
twThemePath: (_, value) => `${value}px`
|
|
442
|
+
};
|
|
437
443
|
const publicProperties = {
|
|
438
444
|
backgroundColor,
|
|
439
445
|
borderWidth,
|
|
@@ -530,7 +536,8 @@ const publicProperties = {
|
|
|
530
536
|
twThemePath: () => "",
|
|
531
537
|
customValueRenderer: ({ value }) => `${String(value)}%`
|
|
532
538
|
},
|
|
533
|
-
paginationWidthVar
|
|
539
|
+
paginationWidthVar,
|
|
540
|
+
controlHeight
|
|
534
541
|
};
|
|
535
542
|
const internalProperties = {
|
|
536
543
|
outlineWidth,
|
|
@@ -8,7 +8,7 @@ import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
|
|
|
8
8
|
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
9
9
|
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
10
10
|
const isInputWrapperCtx = (context) => {
|
|
11
|
-
return context.componentName === "input" && context.layer === "inputWrapper";
|
|
11
|
+
return context.componentName === "input" && (context.layer === "inputWrapper" || context.layer === "inputWrapperDynamic");
|
|
12
12
|
};
|
|
13
13
|
const hexToRgb = (hex) => {
|
|
14
14
|
hex = hex.replace("#", "");
|
|
@@ -434,6 +434,12 @@ const paginationWidthVar = {
|
|
|
434
434
|
possibleFixtures: ["positiveIntegers"],
|
|
435
435
|
twThemePath: (_, value) => `${value}px`
|
|
436
436
|
};
|
|
437
|
+
const controlHeight = {
|
|
438
|
+
name: "controlHeight",
|
|
439
|
+
cssProperties: [],
|
|
440
|
+
possibleFixtures: ["positiveIntegers"],
|
|
441
|
+
twThemePath: (_, value) => `${value}px`
|
|
442
|
+
};
|
|
437
443
|
const publicProperties = {
|
|
438
444
|
backgroundColor,
|
|
439
445
|
borderWidth,
|
|
@@ -530,7 +536,8 @@ const publicProperties = {
|
|
|
530
536
|
twThemePath: () => "",
|
|
531
537
|
customValueRenderer: ({ value }) => `${String(value)}%`
|
|
532
538
|
},
|
|
533
|
-
paginationWidthVar
|
|
539
|
+
paginationWidthVar,
|
|
540
|
+
controlHeight
|
|
534
541
|
};
|
|
535
542
|
const internalProperties = {
|
|
536
543
|
outlineWidth,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.js
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* Atomic-state taxonomy.
|
|
7
|
+
*
|
|
8
|
+
* Every interactive component reacts to a fixed set of "atomic" states, each
|
|
9
|
+
* belonging to one axis:
|
|
10
|
+
*
|
|
11
|
+
* - `interactive` — pointer/keyboard focus signals. At runtime at most one of
|
|
12
|
+
* these is meaningfully "active" at a time on a given element (you can't
|
|
13
|
+
* simultaneously hover and press distinctly enough to style separately, etc.).
|
|
14
|
+
*
|
|
15
|
+
* - `modifier` — semantic flags that can stack independently of each other and
|
|
16
|
+
* of the interactive state. An input can be `invalid` AND `readonly` at the
|
|
17
|
+
* same time, optionally also `hover`ed.
|
|
18
|
+
*
|
|
19
|
+
* Compound states (`'invalid&hover'`, `'invalid&readonly&hover'`, etc.) are
|
|
20
|
+
* built by listing 0..N modifiers followed by 0..1 interactive. The
|
|
21
|
+
* `canonicalizeStateKey` helper enforces this ordering so that, e.g.,
|
|
22
|
+
* `['hover', 'invalid']` and `['invalid', 'hover']` resolve to the same key.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Interactive atomics:
|
|
26
|
+
*
|
|
27
|
+
* - `hover`/`pressed` for pointer interaction.
|
|
28
|
+
* - `focus-within` for containers that wrap a focusable child (e.g. an input
|
|
29
|
+
* wrapper).
|
|
30
|
+
* - `focus-visible` for keyboard-only focus rings on focusable elements.
|
|
31
|
+
*/
|
|
32
|
+
const INTERACTIVE_ATOMICS = [
|
|
33
|
+
"hover",
|
|
34
|
+
"pressed",
|
|
35
|
+
"focus-within",
|
|
36
|
+
"focus-visible"
|
|
37
|
+
];
|
|
38
|
+
const MODIFIER_ATOMICS = [
|
|
39
|
+
"invalid",
|
|
40
|
+
"readonly",
|
|
41
|
+
"placeholder-shown",
|
|
42
|
+
"autofill",
|
|
43
|
+
"visited"
|
|
44
|
+
];
|
|
45
|
+
const INTERACTIVE_ATOMIC_SET = new Set(INTERACTIVE_ATOMICS);
|
|
46
|
+
const MODIFIER_ATOMIC_SET = new Set(MODIFIER_ATOMICS);
|
|
47
|
+
function isInteractiveAtomic(state) {
|
|
48
|
+
return INTERACTIVE_ATOMIC_SET.has(state);
|
|
49
|
+
}
|
|
50
|
+
function isModifierAtomic(state) {
|
|
51
|
+
return MODIFIER_ATOMIC_SET.has(state);
|
|
52
|
+
}
|
|
53
|
+
function isAtomicState(state) {
|
|
54
|
+
return isInteractiveAtomic(state) || isModifierAtomic(state);
|
|
55
|
+
}
|
|
56
|
+
const STATE_PRIORITY_INDEX = new Map([
|
|
57
|
+
"visited",
|
|
58
|
+
"placeholder-shown",
|
|
59
|
+
"autofill",
|
|
60
|
+
"focus-within",
|
|
61
|
+
"focus-visible",
|
|
62
|
+
"hover",
|
|
63
|
+
"pressed",
|
|
64
|
+
"invalid",
|
|
65
|
+
"readonly"
|
|
66
|
+
].map((atom, i) => [atom, i]));
|
|
67
|
+
/**
|
|
68
|
+
* Comparator usable with `Array.prototype.sort`. Atoms not in `STATE_PRIORITY`
|
|
69
|
+
* sort to the front (weakest) — this only triggers for unknown strings; every
|
|
70
|
+
* known `AtomicState` is in the priority array.
|
|
71
|
+
*/
|
|
72
|
+
function comparePriority(a, b) {
|
|
73
|
+
return (STATE_PRIORITY_INDEX.get(a) ?? -1) - (STATE_PRIORITY_INDEX.get(b) ?? -1);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.INTERACTIVE_ATOMICS = INTERACTIVE_ATOMICS;
|
|
77
|
+
exports.MODIFIER_ATOMICS = MODIFIER_ATOMICS;
|
|
78
|
+
exports.comparePriority = comparePriority;
|
|
79
|
+
exports.isAtomicState = isAtomicState;
|
|
80
|
+
exports.isInteractiveAtomic = isInteractiveAtomic;
|
|
81
|
+
exports.isModifierAtomic = isModifierAtomic;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.js
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
5
|
+
/**
|
|
6
|
+
* Atomic-state taxonomy.
|
|
7
|
+
*
|
|
8
|
+
* Every interactive component reacts to a fixed set of "atomic" states, each
|
|
9
|
+
* belonging to one axis:
|
|
10
|
+
*
|
|
11
|
+
* - `interactive` — pointer/keyboard focus signals. At runtime at most one of
|
|
12
|
+
* these is meaningfully "active" at a time on a given element (you can't
|
|
13
|
+
* simultaneously hover and press distinctly enough to style separately, etc.).
|
|
14
|
+
*
|
|
15
|
+
* - `modifier` — semantic flags that can stack independently of each other and
|
|
16
|
+
* of the interactive state. An input can be `invalid` AND `readonly` at the
|
|
17
|
+
* same time, optionally also `hover`ed.
|
|
18
|
+
*
|
|
19
|
+
* Compound states (`'invalid&hover'`, `'invalid&readonly&hover'`, etc.) are
|
|
20
|
+
* built by listing 0..N modifiers followed by 0..1 interactive. The
|
|
21
|
+
* `canonicalizeStateKey` helper enforces this ordering so that, e.g.,
|
|
22
|
+
* `['hover', 'invalid']` and `['invalid', 'hover']` resolve to the same key.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Interactive atomics:
|
|
26
|
+
*
|
|
27
|
+
* - `hover`/`pressed` for pointer interaction.
|
|
28
|
+
* - `focus-within` for containers that wrap a focusable child (e.g. an input
|
|
29
|
+
* wrapper).
|
|
30
|
+
* - `focus-visible` for keyboard-only focus rings on focusable elements.
|
|
31
|
+
*/
|
|
32
|
+
const INTERACTIVE_ATOMICS = [
|
|
33
|
+
"hover",
|
|
34
|
+
"pressed",
|
|
35
|
+
"focus-within",
|
|
36
|
+
"focus-visible"
|
|
37
|
+
];
|
|
38
|
+
const MODIFIER_ATOMICS = [
|
|
39
|
+
"invalid",
|
|
40
|
+
"readonly",
|
|
41
|
+
"placeholder-shown",
|
|
42
|
+
"autofill",
|
|
43
|
+
"visited"
|
|
44
|
+
];
|
|
45
|
+
const INTERACTIVE_ATOMIC_SET = new Set(INTERACTIVE_ATOMICS);
|
|
46
|
+
const MODIFIER_ATOMIC_SET = new Set(MODIFIER_ATOMICS);
|
|
47
|
+
function isInteractiveAtomic(state) {
|
|
48
|
+
return INTERACTIVE_ATOMIC_SET.has(state);
|
|
49
|
+
}
|
|
50
|
+
function isModifierAtomic(state) {
|
|
51
|
+
return MODIFIER_ATOMIC_SET.has(state);
|
|
52
|
+
}
|
|
53
|
+
function isAtomicState(state) {
|
|
54
|
+
return isInteractiveAtomic(state) || isModifierAtomic(state);
|
|
55
|
+
}
|
|
56
|
+
const STATE_PRIORITY_INDEX = new Map([
|
|
57
|
+
"visited",
|
|
58
|
+
"placeholder-shown",
|
|
59
|
+
"autofill",
|
|
60
|
+
"focus-within",
|
|
61
|
+
"focus-visible",
|
|
62
|
+
"hover",
|
|
63
|
+
"pressed",
|
|
64
|
+
"invalid",
|
|
65
|
+
"readonly"
|
|
66
|
+
].map((atom, i) => [atom, i]));
|
|
67
|
+
/**
|
|
68
|
+
* Comparator usable with `Array.prototype.sort`. Atoms not in `STATE_PRIORITY`
|
|
69
|
+
* sort to the front (weakest) — this only triggers for unknown strings; every
|
|
70
|
+
* known `AtomicState` is in the priority array.
|
|
71
|
+
*/
|
|
72
|
+
function comparePriority(a, b) {
|
|
73
|
+
return (STATE_PRIORITY_INDEX.get(a) ?? -1) - (STATE_PRIORITY_INDEX.get(b) ?? -1);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { INTERACTIVE_ATOMICS, MODIFIER_ATOMICS, comparePriority, isAtomicState, isInteractiveAtomic, isModifierAtomic };
|
package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_StateAxis = require("../types/StateAxis.cjs");
|
|
3
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
+
function canonicalizeStateKey(atoms) {
|
|
7
|
+
if (atoms.length === 0) return "rest";
|
|
8
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9
|
+
const modifiers = [];
|
|
10
|
+
const interactives = [];
|
|
11
|
+
for (const atom of atoms) {
|
|
12
|
+
if (seen.has(atom)) continue;
|
|
13
|
+
seen.add(atom);
|
|
14
|
+
if (require_StateAxis.isModifierAtomic(atom)) modifiers.push(atom);
|
|
15
|
+
else if (require_StateAxis.isInteractiveAtomic(atom)) interactives.push(atom);
|
|
16
|
+
else throw new Error(`canonicalizeStateKey received an unrecognized atom "${atom}". Atoms must be in MODIFIER_ATOMICS or INTERACTIVE_ATOMICS — see StateAxis.`);
|
|
17
|
+
}
|
|
18
|
+
modifiers.sort(require_StateAxis.comparePriority);
|
|
19
|
+
interactives.sort(require_StateAxis.comparePriority);
|
|
20
|
+
const ordered = [...modifiers, ...interactives];
|
|
21
|
+
return ordered.length === 0 ? "rest" : ordered.join("&");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Splits a canonical (or legacy) state key into its atomic parts.
|
|
25
|
+
* `'rest'` and `''` produce an empty array.
|
|
26
|
+
*/
|
|
27
|
+
function splitStateKey(stateKey) {
|
|
28
|
+
if (!stateKey || stateKey === "rest") return [];
|
|
29
|
+
return stateKey.split("&");
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.canonicalizeStateKey = canonicalizeStateKey;
|
|
33
|
+
exports.splitStateKey = splitStateKey;
|
package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { comparePriority, isInteractiveAtomic, isModifierAtomic } from "../types/StateAxis.js";
|
|
3
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
+
function canonicalizeStateKey(atoms) {
|
|
7
|
+
if (atoms.length === 0) return "rest";
|
|
8
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9
|
+
const modifiers = [];
|
|
10
|
+
const interactives = [];
|
|
11
|
+
for (const atom of atoms) {
|
|
12
|
+
if (seen.has(atom)) continue;
|
|
13
|
+
seen.add(atom);
|
|
14
|
+
if (isModifierAtomic(atom)) modifiers.push(atom);
|
|
15
|
+
else if (isInteractiveAtomic(atom)) interactives.push(atom);
|
|
16
|
+
else throw new Error(`canonicalizeStateKey received an unrecognized atom "${atom}". Atoms must be in MODIFIER_ATOMICS or INTERACTIVE_ATOMICS — see StateAxis.`);
|
|
17
|
+
}
|
|
18
|
+
modifiers.sort(comparePriority);
|
|
19
|
+
interactives.sort(comparePriority);
|
|
20
|
+
const ordered = [...modifiers, ...interactives];
|
|
21
|
+
return ordered.length === 0 ? "rest" : ordered.join("&");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Splits a canonical (or legacy) state key into its atomic parts.
|
|
25
|
+
* `'rest'` and `''` produce an empty array.
|
|
26
|
+
*/
|
|
27
|
+
function splitStateKey(stateKey) {
|
|
28
|
+
if (!stateKey || stateKey === "rest") return [];
|
|
29
|
+
return stateKey.split("&");
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { canonicalizeStateKey, splitStateKey };
|
|
@@ -5,12 +5,5 @@
|
|
|
5
5
|
function getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption) {
|
|
6
6
|
return componentState.excludePseudoStatesForOptions?.[componentStateOption] ?? [];
|
|
7
7
|
}
|
|
8
|
-
function filterPseudoStatesByExclusion(pseudoStates, excludedPseudoStates) {
|
|
9
|
-
if (!pseudoStates) return [];
|
|
10
|
-
if (excludedPseudoStates.length === 0) return [...pseudoStates];
|
|
11
|
-
const excluded = new Set(excludedPseudoStates);
|
|
12
|
-
return pseudoStates.filter((pseudoState) => !excluded.has(pseudoState));
|
|
13
|
-
}
|
|
14
8
|
//#endregion
|
|
15
|
-
exports.filterPseudoStatesByExclusion = filterPseudoStatesByExclusion;
|
|
16
9
|
exports.getExcludedPseudoStatesForComponentStateOption = getExcludedPseudoStatesForComponentStateOption;
|
|
@@ -5,11 +5,5 @@
|
|
|
5
5
|
function getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption) {
|
|
6
6
|
return componentState.excludePseudoStatesForOptions?.[componentStateOption] ?? [];
|
|
7
7
|
}
|
|
8
|
-
function filterPseudoStatesByExclusion(pseudoStates, excludedPseudoStates) {
|
|
9
|
-
if (!pseudoStates) return [];
|
|
10
|
-
if (excludedPseudoStates.length === 0) return [...pseudoStates];
|
|
11
|
-
const excluded = new Set(excludedPseudoStates);
|
|
12
|
-
return pseudoStates.filter((pseudoState) => !excluded.has(pseudoState));
|
|
13
|
-
}
|
|
14
8
|
//#endregion
|
|
15
|
-
export {
|
|
9
|
+
export { getExcludedPseudoStatesForComponentStateOption };
|
package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.cjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_index = require("../../../css-tokens/dist/index.cjs");
|
|
3
|
+
const require_mapTextVariantFixtureToValue = require("../mapTextVariantFixtureToValue.cjs");
|
|
4
|
+
const require_properties = require("../properties.cjs");
|
|
5
|
+
const require_iconButtonMatchButtonHeight = require("./iconButtonMatchButtonHeight.cjs");
|
|
6
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js
|
|
7
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
8
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
9
|
+
/** Sizes where IconButton control height should match Button. */
|
|
10
|
+
const SHARED_BUTTON_ICONBUTTON_SIZES = new Set([
|
|
11
|
+
"xs",
|
|
12
|
+
"sm",
|
|
13
|
+
"md",
|
|
14
|
+
"lg"
|
|
15
|
+
]);
|
|
16
|
+
function getButtonIconSizeVar({ schema, iconLayerKey, state, theme }) {
|
|
17
|
+
const iconSizeValue = schema.variables?.[iconLayerKey]?.size?.[state]?.value;
|
|
18
|
+
if (typeof iconSizeValue === "string" && iconSizeValue) return theme(require_properties.configurableProperties.iconSize.twThemePath("iconSizes", iconSizeValue));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Button content box: max(icon size, text line-height).
|
|
22
|
+
* Matches Figma auto-layout and keeps IconButton height aligned with Button.
|
|
23
|
+
*/
|
|
24
|
+
function getButtonControlContentSize({ schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
25
|
+
const iconSizeVar = getButtonIconSizeVar({
|
|
26
|
+
schema,
|
|
27
|
+
iconLayerKey,
|
|
28
|
+
state,
|
|
29
|
+
theme
|
|
30
|
+
});
|
|
31
|
+
const textVariantValue = schema.variables?.[rootLayerKey]?.textVariant?.[state]?.value;
|
|
32
|
+
if (iconSizeVar && typeof textVariantValue === "string" && textVariantValue) return `max(${iconSizeVar}, ${theme(require_mapTextVariantFixtureToValue.mapTextVariantFixtureToValue("lineHeight")("textVariants", textVariantValue))})`;
|
|
33
|
+
if (iconSizeVar) return iconSizeVar;
|
|
34
|
+
}
|
|
35
|
+
/** `round(up, …, 1px)` matches Math.ceil in getButtonControlHeightPx and Figma hug height. */
|
|
36
|
+
function formatControlHeightCalc(calcExpression) {
|
|
37
|
+
return `round(up, ${calcExpression}, 1px)`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Button control height: vertical padding on both sides plus max(icon size, text line-height).
|
|
41
|
+
*/
|
|
42
|
+
function getButtonControlHeight({ paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
43
|
+
const contentSize = getButtonControlContentSize({
|
|
44
|
+
schema,
|
|
45
|
+
rootLayerKey,
|
|
46
|
+
iconLayerKey,
|
|
47
|
+
state,
|
|
48
|
+
theme
|
|
49
|
+
});
|
|
50
|
+
if (!contentSize) return;
|
|
51
|
+
return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${contentSize})`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* IconButton control height: uniform padding plus icon size only (no typography).
|
|
55
|
+
*/
|
|
56
|
+
function getIconButtonControlHeight({ paddingVertical, schema, iconLayerKey, state, theme }) {
|
|
57
|
+
const iconSizeVar = getButtonIconSizeVar({
|
|
58
|
+
schema,
|
|
59
|
+
iconLayerKey,
|
|
60
|
+
state,
|
|
61
|
+
theme
|
|
62
|
+
});
|
|
63
|
+
if (!iconSizeVar) return;
|
|
64
|
+
return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${iconSizeVar})`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Layout line-height for button root: max(icon size, text line-height).
|
|
68
|
+
*/
|
|
69
|
+
function getButtonContentLineHeight({ schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
70
|
+
return getButtonControlContentSize({
|
|
71
|
+
schema,
|
|
72
|
+
rootLayerKey,
|
|
73
|
+
iconLayerKey,
|
|
74
|
+
state,
|
|
75
|
+
theme
|
|
76
|
+
}) ?? "1em";
|
|
77
|
+
}
|
|
78
|
+
function applyButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
79
|
+
const controlHeight = rootLayerKey ? getButtonControlHeight({
|
|
80
|
+
paddingVertical,
|
|
81
|
+
schema,
|
|
82
|
+
rootLayerKey,
|
|
83
|
+
iconLayerKey,
|
|
84
|
+
state,
|
|
85
|
+
theme
|
|
86
|
+
}) : getIconButtonControlHeight({
|
|
87
|
+
paddingVertical,
|
|
88
|
+
schema,
|
|
89
|
+
iconLayerKey,
|
|
90
|
+
state,
|
|
91
|
+
theme
|
|
92
|
+
});
|
|
93
|
+
if (controlHeight) {
|
|
94
|
+
cssDeclarations[require_index.BUTTON_CONTROL_HEIGHT_VAR] = controlHeight;
|
|
95
|
+
cssDeclarations.height = `var(${require_index.BUTTON_CONTROL_HEIGHT_VAR})`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function applyIconButtonSquareDimensions(cssDeclarations) {
|
|
99
|
+
if (cssDeclarations[require_index.BUTTON_CONTROL_HEIGHT_VAR]) cssDeclarations.width = `var(${require_index.BUTTON_CONTROL_HEIGHT_VAR})`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
|
|
103
|
+
* xl uses icon-only height from IconButton tokens.
|
|
104
|
+
*/
|
|
105
|
+
function applyIconButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, iconButtonSchema, buttonHeightReferenceSchema, variantValue, iconLayerKey: _iconLayerKey, state, theme }) {
|
|
106
|
+
if (buttonHeightReferenceSchema && SHARED_BUTTON_ICONBUTTON_SIZES.has(variantValue) && require_iconButtonMatchButtonHeight.isIconButtonMatchButtonHeightEnabled(iconButtonSchema, variantValue)) {
|
|
107
|
+
const buttonRootLayerKey = `size/${variantValue}/root`;
|
|
108
|
+
const buttonIconLayerKey = `size/${variantValue}/icon`;
|
|
109
|
+
const buttonSpacingValue = buttonHeightReferenceSchema.variables?.[buttonRootLayerKey]?.spacingVertical?.[state]?.value;
|
|
110
|
+
applyButtonControlHeightDeclarations({
|
|
111
|
+
cssDeclarations,
|
|
112
|
+
paddingVertical: typeof buttonSpacingValue === "string" && buttonSpacingValue ? theme(require_properties.configurableProperties.spacingVertical.twThemePath("spacingAliases", buttonSpacingValue)) : paddingVertical,
|
|
113
|
+
schema: buttonHeightReferenceSchema,
|
|
114
|
+
rootLayerKey: buttonRootLayerKey,
|
|
115
|
+
iconLayerKey: buttonIconLayerKey,
|
|
116
|
+
state,
|
|
117
|
+
theme
|
|
118
|
+
});
|
|
119
|
+
applyIconButtonSquareDimensions(cssDeclarations);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
exports.SHARED_BUTTON_ICONBUTTON_SIZES = SHARED_BUTTON_ICONBUTTON_SIZES;
|
|
124
|
+
exports.applyButtonControlHeightDeclarations = applyButtonControlHeightDeclarations;
|
|
125
|
+
exports.applyIconButtonControlHeightDeclarations = applyIconButtonControlHeightDeclarations;
|
|
126
|
+
exports.getButtonContentLineHeight = getButtonContentLineHeight;
|
package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { BUTTON_CONTROL_HEIGHT_VAR } from "../../../css-tokens/dist/index.js";
|
|
3
|
+
import { mapTextVariantFixtureToValue } from "../mapTextVariantFixtureToValue.js";
|
|
4
|
+
import { configurableProperties } from "../properties.js";
|
|
5
|
+
import { isIconButtonMatchButtonHeightEnabled } from "./iconButtonMatchButtonHeight.js";
|
|
6
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js
|
|
7
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
8
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
9
|
+
/** Sizes where IconButton control height should match Button. */
|
|
10
|
+
const SHARED_BUTTON_ICONBUTTON_SIZES = new Set([
|
|
11
|
+
"xs",
|
|
12
|
+
"sm",
|
|
13
|
+
"md",
|
|
14
|
+
"lg"
|
|
15
|
+
]);
|
|
16
|
+
function getButtonIconSizeVar({ schema, iconLayerKey, state, theme }) {
|
|
17
|
+
const iconSizeValue = schema.variables?.[iconLayerKey]?.size?.[state]?.value;
|
|
18
|
+
if (typeof iconSizeValue === "string" && iconSizeValue) return theme(configurableProperties.iconSize.twThemePath("iconSizes", iconSizeValue));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Button content box: max(icon size, text line-height).
|
|
22
|
+
* Matches Figma auto-layout and keeps IconButton height aligned with Button.
|
|
23
|
+
*/
|
|
24
|
+
function getButtonControlContentSize({ schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
25
|
+
const iconSizeVar = getButtonIconSizeVar({
|
|
26
|
+
schema,
|
|
27
|
+
iconLayerKey,
|
|
28
|
+
state,
|
|
29
|
+
theme
|
|
30
|
+
});
|
|
31
|
+
const textVariantValue = schema.variables?.[rootLayerKey]?.textVariant?.[state]?.value;
|
|
32
|
+
if (iconSizeVar && typeof textVariantValue === "string" && textVariantValue) return `max(${iconSizeVar}, ${theme(mapTextVariantFixtureToValue("lineHeight")("textVariants", textVariantValue))})`;
|
|
33
|
+
if (iconSizeVar) return iconSizeVar;
|
|
34
|
+
}
|
|
35
|
+
/** `round(up, …, 1px)` matches Math.ceil in getButtonControlHeightPx and Figma hug height. */
|
|
36
|
+
function formatControlHeightCalc(calcExpression) {
|
|
37
|
+
return `round(up, ${calcExpression}, 1px)`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Button control height: vertical padding on both sides plus max(icon size, text line-height).
|
|
41
|
+
*/
|
|
42
|
+
function getButtonControlHeight({ paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
43
|
+
const contentSize = getButtonControlContentSize({
|
|
44
|
+
schema,
|
|
45
|
+
rootLayerKey,
|
|
46
|
+
iconLayerKey,
|
|
47
|
+
state,
|
|
48
|
+
theme
|
|
49
|
+
});
|
|
50
|
+
if (!contentSize) return;
|
|
51
|
+
return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${contentSize})`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* IconButton control height: uniform padding plus icon size only (no typography).
|
|
55
|
+
*/
|
|
56
|
+
function getIconButtonControlHeight({ paddingVertical, schema, iconLayerKey, state, theme }) {
|
|
57
|
+
const iconSizeVar = getButtonIconSizeVar({
|
|
58
|
+
schema,
|
|
59
|
+
iconLayerKey,
|
|
60
|
+
state,
|
|
61
|
+
theme
|
|
62
|
+
});
|
|
63
|
+
if (!iconSizeVar) return;
|
|
64
|
+
return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${iconSizeVar})`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Layout line-height for button root: max(icon size, text line-height).
|
|
68
|
+
*/
|
|
69
|
+
function getButtonContentLineHeight({ schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
70
|
+
return getButtonControlContentSize({
|
|
71
|
+
schema,
|
|
72
|
+
rootLayerKey,
|
|
73
|
+
iconLayerKey,
|
|
74
|
+
state,
|
|
75
|
+
theme
|
|
76
|
+
}) ?? "1em";
|
|
77
|
+
}
|
|
78
|
+
function applyButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
|
|
79
|
+
const controlHeight = rootLayerKey ? getButtonControlHeight({
|
|
80
|
+
paddingVertical,
|
|
81
|
+
schema,
|
|
82
|
+
rootLayerKey,
|
|
83
|
+
iconLayerKey,
|
|
84
|
+
state,
|
|
85
|
+
theme
|
|
86
|
+
}) : getIconButtonControlHeight({
|
|
87
|
+
paddingVertical,
|
|
88
|
+
schema,
|
|
89
|
+
iconLayerKey,
|
|
90
|
+
state,
|
|
91
|
+
theme
|
|
92
|
+
});
|
|
93
|
+
if (controlHeight) {
|
|
94
|
+
cssDeclarations[BUTTON_CONTROL_HEIGHT_VAR] = controlHeight;
|
|
95
|
+
cssDeclarations.height = `var(${BUTTON_CONTROL_HEIGHT_VAR})`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function applyIconButtonSquareDimensions(cssDeclarations) {
|
|
99
|
+
if (cssDeclarations[BUTTON_CONTROL_HEIGHT_VAR]) cssDeclarations.width = `var(${BUTTON_CONTROL_HEIGHT_VAR})`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
|
|
103
|
+
* xl uses icon-only height from IconButton tokens.
|
|
104
|
+
*/
|
|
105
|
+
function applyIconButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, iconButtonSchema, buttonHeightReferenceSchema, variantValue, iconLayerKey: _iconLayerKey, state, theme }) {
|
|
106
|
+
if (buttonHeightReferenceSchema && SHARED_BUTTON_ICONBUTTON_SIZES.has(variantValue) && isIconButtonMatchButtonHeightEnabled(iconButtonSchema, variantValue)) {
|
|
107
|
+
const buttonRootLayerKey = `size/${variantValue}/root`;
|
|
108
|
+
const buttonIconLayerKey = `size/${variantValue}/icon`;
|
|
109
|
+
const buttonSpacingValue = buttonHeightReferenceSchema.variables?.[buttonRootLayerKey]?.spacingVertical?.[state]?.value;
|
|
110
|
+
applyButtonControlHeightDeclarations({
|
|
111
|
+
cssDeclarations,
|
|
112
|
+
paddingVertical: typeof buttonSpacingValue === "string" && buttonSpacingValue ? theme(configurableProperties.spacingVertical.twThemePath("spacingAliases", buttonSpacingValue)) : paddingVertical,
|
|
113
|
+
schema: buttonHeightReferenceSchema,
|
|
114
|
+
rootLayerKey: buttonRootLayerKey,
|
|
115
|
+
iconLayerKey: buttonIconLayerKey,
|
|
116
|
+
state,
|
|
117
|
+
theme
|
|
118
|
+
});
|
|
119
|
+
applyIconButtonSquareDimensions(cssDeclarations);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { SHARED_BUTTON_ICONBUTTON_SIZES, applyButtonControlHeightDeclarations, applyIconButtonControlHeightDeclarations, getButtonContentLineHeight };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_getButtonControlHeight = require("./getButtonControlHeight.cjs");
|
|
3
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
+
function asMatchButtonHeightConfig(config) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
function getMatchButtonHeightMap(config) {
|
|
10
|
+
return config.iconButton?.matchButtonHeight ?? config.matchButtonHeight;
|
|
11
|
+
}
|
|
12
|
+
function isMatchButtonHeightSize(size) {
|
|
13
|
+
return require_getButtonControlHeight.SHARED_BUTTON_ICONBUTTON_SIZES.has(size);
|
|
14
|
+
}
|
|
15
|
+
function isIconButtonMatchButtonHeightEnabled(config, size) {
|
|
16
|
+
if (!isMatchButtonHeightSize(size)) return false;
|
|
17
|
+
return getMatchButtonHeightMap(asMatchButtonHeightConfig(config))?.[size] === true;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.isIconButtonMatchButtonHeightEnabled = isIconButtonMatchButtonHeightEnabled;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { SHARED_BUTTON_ICONBUTTON_SIZES } from "./getButtonControlHeight.js";
|
|
3
|
+
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
6
|
+
function asMatchButtonHeightConfig(config) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
function getMatchButtonHeightMap(config) {
|
|
10
|
+
return config.iconButton?.matchButtonHeight ?? config.matchButtonHeight;
|
|
11
|
+
}
|
|
12
|
+
function isMatchButtonHeightSize(size) {
|
|
13
|
+
return SHARED_BUTTON_ICONBUTTON_SIZES.has(size);
|
|
14
|
+
}
|
|
15
|
+
function isIconButtonMatchButtonHeightEnabled(config, size) {
|
|
16
|
+
if (!isMatchButtonHeightSize(size)) return false;
|
|
17
|
+
return getMatchButtonHeightMap(asMatchButtonHeightConfig(config))?.[size] === true;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isIconButtonMatchButtonHeightEnabled };
|