@yahoo/uds 3.157.0 → 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.
Files changed (96) hide show
  1. package/dist/automated-config/dist/generated/generatedConfigs.cjs +67 -51
  2. package/dist/automated-config/dist/generated/generatedConfigs.d.cts +15 -1
  3. package/dist/automated-config/dist/generated/generatedConfigs.d.ts +15 -1
  4. package/dist/automated-config/dist/generated/generatedConfigs.js +67 -51
  5. package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +1 -1
  6. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
  7. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
  8. package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +1 -1
  9. package/dist/automated-config/dist/properties.cjs +8 -1
  10. package/dist/automated-config/dist/properties.d.cts +8 -0
  11. package/dist/automated-config/dist/properties.d.ts +8 -0
  12. package/dist/automated-config/dist/properties.js +8 -1
  13. package/dist/automated-config/dist/utils/buildConfigSchema.cjs +7 -0
  14. package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +10 -3
  15. package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +10 -3
  16. package/dist/automated-config/dist/utils/buildConfigSchema.js +7 -0
  17. package/dist/automated-config/dist/utils/getButtonControlHeight.cjs +129 -0
  18. package/dist/automated-config/dist/utils/getButtonControlHeight.d.cts +133 -0
  19. package/dist/automated-config/dist/utils/getButtonControlHeight.d.ts +133 -0
  20. package/dist/automated-config/dist/utils/getButtonControlHeight.js +122 -0
  21. package/dist/automated-config/dist/utils/getButtonControlHeightPx.cjs +114 -0
  22. package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.cts +78 -0
  23. package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.ts +78 -0
  24. package/dist/automated-config/dist/utils/getButtonControlHeightPx.js +108 -0
  25. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
  26. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
  27. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +110 -0
  28. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.cts +19 -0
  29. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.ts +19 -0
  30. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.js +108 -0
  31. package/dist/automated-config/dist/utils/index.cjs +85 -28
  32. package/dist/automated-config/dist/utils/index.d.cts +15 -4
  33. package/dist/automated-config/dist/utils/index.d.ts +15 -4
  34. package/dist/automated-config/dist/utils/index.js +85 -28
  35. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.cjs +15 -0
  36. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.cts +20 -0
  37. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.ts +20 -0
  38. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.js +15 -0
  39. package/dist/components/client/Button.cjs +3 -3
  40. package/dist/components/client/Button.js +3 -3
  41. package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
  42. package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
  43. package/dist/config/dist/index.cjs +5 -5
  44. package/dist/config/dist/index.js +5 -5
  45. package/dist/css/dist/packages/automated-config/dist/properties.cjs +8 -1
  46. package/dist/css/dist/packages/automated-config/dist/properties.js +8 -1
  47. package/dist/css/dist/packages/config/dist/index.cjs +5 -5
  48. package/dist/css/dist/packages/config/dist/index.js +5 -5
  49. package/dist/css-tokens/dist/index.cjs +2 -0
  50. package/dist/css-tokens/dist/index.d.cts +2 -1
  51. package/dist/css-tokens/dist/index.d.ts +2 -1
  52. package/dist/css-tokens/dist/index.js +2 -1
  53. package/dist/index.cjs +23 -0
  54. package/dist/index.d.cts +6 -2
  55. package/dist/index.d.ts +6 -2
  56. package/dist/index.js +6 -2
  57. package/dist/styles/styler.d.cts +12 -12
  58. package/dist/styles/styler.d.ts +12 -12
  59. package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +67 -51
  60. package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +67 -51
  61. package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.cjs +8 -1
  62. package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.js +8 -1
  63. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.cjs +126 -0
  64. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js +123 -0
  65. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +20 -0
  66. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js +20 -0
  67. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +82 -28
  68. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +82 -28
  69. package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +5 -5
  70. package/dist/tailwind-internal/dist/packages/config/dist/index.js +5 -5
  71. package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +2 -0
  72. package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +2 -1
  73. package/dist/tailwind-internal/dist/plugins/components.cjs +1 -1
  74. package/dist/tailwind-internal/dist/plugins/components.js +1 -1
  75. package/dist/tokens/automation/index.cjs +22 -0
  76. package/dist/tokens/automation/index.d.cts +5 -1
  77. package/dist/tokens/automation/index.d.ts +5 -1
  78. package/dist/tokens/automation/index.js +5 -1
  79. package/dist/tokens/consts/cssTokens.cjs +1 -0
  80. package/dist/tokens/consts/cssTokens.d.cts +2 -2
  81. package/dist/tokens/consts/cssTokens.d.ts +2 -2
  82. package/dist/tokens/consts/cssTokens.js +2 -2
  83. package/dist/tokens/index.cjs +23 -0
  84. package/dist/tokens/index.d.cts +6 -2
  85. package/dist/tokens/index.d.ts +6 -2
  86. package/dist/tokens/index.js +6 -2
  87. package/dist/uds/generated/componentData.cjs +133 -130
  88. package/dist/uds/generated/componentData.js +133 -130
  89. package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
  90. package/dist/uds/generated/migrationSchemaVersion.js +1 -1
  91. package/dist/uds/generated/tailwindPurge.cjs +5 -5
  92. package/dist/uds/generated/tailwindPurge.js +5 -5
  93. package/generated/componentData.json +191 -188
  94. package/generated/migrationSchemaVersion.ts +1 -1
  95. package/generated/tailwindPurge.ts +1 -1
  96. package/package.json +1 -1
@@ -0,0 +1,129 @@
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 ../automated-config/dist/utils/getButtonControlHeight.js
7
+ /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
8
+ /** Sizes where IconButton control height should match Button. */
9
+ const SHARED_BUTTON_ICONBUTTON_SIZES = new Set([
10
+ "xs",
11
+ "sm",
12
+ "md",
13
+ "lg"
14
+ ]);
15
+ function getButtonIconSizeVar({ schema, iconLayerKey, state, theme }) {
16
+ const iconSizeValue = schema.variables?.[iconLayerKey]?.size?.[state]?.value;
17
+ if (typeof iconSizeValue === "string" && iconSizeValue) return theme(require_properties.configurableProperties.iconSize.twThemePath("iconSizes", iconSizeValue));
18
+ }
19
+ /**
20
+ * Button content box: max(icon size, text line-height).
21
+ * Matches Figma auto-layout and keeps IconButton height aligned with Button.
22
+ */
23
+ function getButtonControlContentSize({ schema, rootLayerKey, iconLayerKey, state, theme }) {
24
+ const iconSizeVar = getButtonIconSizeVar({
25
+ schema,
26
+ iconLayerKey,
27
+ state,
28
+ theme
29
+ });
30
+ const textVariantValue = schema.variables?.[rootLayerKey]?.textVariant?.[state]?.value;
31
+ if (iconSizeVar && typeof textVariantValue === "string" && textVariantValue) return `max(${iconSizeVar}, ${theme(require_mapTextVariantFixtureToValue.mapTextVariantFixtureToValue("lineHeight")("textVariants", textVariantValue))})`;
32
+ if (iconSizeVar) return iconSizeVar;
33
+ }
34
+ /** `round(up, …, 1px)` matches Math.ceil in getButtonControlHeightPx and Figma hug height. */
35
+ function formatControlHeightCalc(calcExpression) {
36
+ return `round(up, ${calcExpression}, 1px)`;
37
+ }
38
+ /**
39
+ * Button control height: vertical padding on both sides plus max(icon size, text line-height).
40
+ */
41
+ function getButtonControlHeight({ paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
42
+ const contentSize = getButtonControlContentSize({
43
+ schema,
44
+ rootLayerKey,
45
+ iconLayerKey,
46
+ state,
47
+ theme
48
+ });
49
+ if (!contentSize) return;
50
+ return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${contentSize})`);
51
+ }
52
+ /**
53
+ * IconButton control height: uniform padding plus icon size only (no typography).
54
+ */
55
+ function getIconButtonControlHeight({ paddingVertical, schema, iconLayerKey, state, theme }) {
56
+ const iconSizeVar = getButtonIconSizeVar({
57
+ schema,
58
+ iconLayerKey,
59
+ state,
60
+ theme
61
+ });
62
+ if (!iconSizeVar) return;
63
+ return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${iconSizeVar})`);
64
+ }
65
+ /**
66
+ * Layout line-height for button root: max(icon size, text line-height).
67
+ */
68
+ function getButtonContentLineHeight({ schema, rootLayerKey, iconLayerKey, state, theme }) {
69
+ return getButtonControlContentSize({
70
+ schema,
71
+ rootLayerKey,
72
+ iconLayerKey,
73
+ state,
74
+ theme
75
+ }) ?? "1em";
76
+ }
77
+ function applyButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
78
+ const controlHeight = rootLayerKey ? getButtonControlHeight({
79
+ paddingVertical,
80
+ schema,
81
+ rootLayerKey,
82
+ iconLayerKey,
83
+ state,
84
+ theme
85
+ }) : getIconButtonControlHeight({
86
+ paddingVertical,
87
+ schema,
88
+ iconLayerKey,
89
+ state,
90
+ theme
91
+ });
92
+ if (controlHeight) {
93
+ cssDeclarations[require_index.BUTTON_CONTROL_HEIGHT_VAR] = controlHeight;
94
+ cssDeclarations.height = `var(${require_index.BUTTON_CONTROL_HEIGHT_VAR})`;
95
+ }
96
+ }
97
+ function applyIconButtonSquareDimensions(cssDeclarations) {
98
+ if (cssDeclarations[require_index.BUTTON_CONTROL_HEIGHT_VAR]) cssDeclarations.width = `var(${require_index.BUTTON_CONTROL_HEIGHT_VAR})`;
99
+ }
100
+ /**
101
+ * IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
102
+ * xl uses icon-only height from IconButton tokens.
103
+ */
104
+ function applyIconButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, iconButtonSchema, buttonHeightReferenceSchema, variantValue, iconLayerKey: _iconLayerKey, state, theme }) {
105
+ if (buttonHeightReferenceSchema && SHARED_BUTTON_ICONBUTTON_SIZES.has(variantValue) && require_iconButtonMatchButtonHeight.isIconButtonMatchButtonHeightEnabled(iconButtonSchema, variantValue)) {
106
+ const buttonRootLayerKey = `size/${variantValue}/root`;
107
+ const buttonIconLayerKey = `size/${variantValue}/icon`;
108
+ const buttonSpacingValue = buttonHeightReferenceSchema.variables?.[buttonRootLayerKey]?.spacingVertical?.[state]?.value;
109
+ applyButtonControlHeightDeclarations({
110
+ cssDeclarations,
111
+ paddingVertical: typeof buttonSpacingValue === "string" && buttonSpacingValue ? theme(require_properties.configurableProperties.spacingVertical.twThemePath("spacingAliases", buttonSpacingValue)) : paddingVertical,
112
+ schema: buttonHeightReferenceSchema,
113
+ rootLayerKey: buttonRootLayerKey,
114
+ iconLayerKey: buttonIconLayerKey,
115
+ state,
116
+ theme
117
+ });
118
+ applyIconButtonSquareDimensions(cssDeclarations);
119
+ }
120
+ }
121
+ //#endregion
122
+ exports.SHARED_BUTTON_ICONBUTTON_SIZES = SHARED_BUTTON_ICONBUTTON_SIZES;
123
+ exports.applyButtonControlHeightDeclarations = applyButtonControlHeightDeclarations;
124
+ exports.applyIconButtonControlHeightDeclarations = applyIconButtonControlHeightDeclarations;
125
+ exports.getButtonContentLineHeight = getButtonContentLineHeight;
126
+ exports.getButtonControlContentSize = getButtonControlContentSize;
127
+ exports.getButtonControlHeight = getButtonControlHeight;
128
+ exports.getButtonIconSizeVar = getButtonIconSizeVar;
129
+ exports.getIconButtonControlHeight = getIconButtonControlHeight;
@@ -0,0 +1,133 @@
1
+
2
+ import { IconButtonMatchButtonHeightConfig } from "./iconButtonMatchButtonHeight.cjs";
3
+
4
+ //#region ../automated-config/dist/utils/getButtonControlHeight.d.ts
5
+ //#region src/utils/getButtonControlHeight.d.ts
6
+ type ThemeFn = (path: string) => string;
7
+ /** Sizes where IconButton control height should match Button. */
8
+ declare const SHARED_BUTTON_ICONBUTTON_SIZES: Set<string>;
9
+ type ButtonControlSchema = IconButtonMatchButtonHeightConfig & {
10
+ variables?: Record<string, Record<string, Record<string, {
11
+ value?: unknown;
12
+ }>>>;
13
+ };
14
+ declare function getButtonIconSizeVar({
15
+ schema,
16
+ iconLayerKey,
17
+ state,
18
+ theme
19
+ }: {
20
+ schema: ButtonControlSchema;
21
+ iconLayerKey: string;
22
+ state: string;
23
+ theme: ThemeFn;
24
+ }): string | undefined;
25
+ /**
26
+ * Button content box: max(icon size, text line-height).
27
+ * Matches Figma auto-layout and keeps IconButton height aligned with Button.
28
+ */
29
+ declare function getButtonControlContentSize({
30
+ schema,
31
+ rootLayerKey,
32
+ iconLayerKey,
33
+ state,
34
+ theme
35
+ }: {
36
+ schema: ButtonControlSchema;
37
+ rootLayerKey: string;
38
+ iconLayerKey: string;
39
+ state: string;
40
+ theme: ThemeFn;
41
+ }): string | undefined;
42
+ /**
43
+ * Button control height: vertical padding on both sides plus max(icon size, text line-height).
44
+ */
45
+ declare function getButtonControlHeight({
46
+ paddingVertical,
47
+ schema,
48
+ rootLayerKey,
49
+ iconLayerKey,
50
+ state,
51
+ theme
52
+ }: {
53
+ paddingVertical: string;
54
+ schema: ButtonControlSchema;
55
+ rootLayerKey: string;
56
+ iconLayerKey: string;
57
+ state: string;
58
+ theme: ThemeFn;
59
+ }): string | undefined;
60
+ /**
61
+ * IconButton control height: uniform padding plus icon size only (no typography).
62
+ */
63
+ declare function getIconButtonControlHeight({
64
+ paddingVertical,
65
+ schema,
66
+ iconLayerKey,
67
+ state,
68
+ theme
69
+ }: {
70
+ paddingVertical: string;
71
+ schema: ButtonControlSchema;
72
+ iconLayerKey: string;
73
+ state: string;
74
+ theme: ThemeFn;
75
+ }): string | undefined;
76
+ /**
77
+ * Layout line-height for button root: max(icon size, text line-height).
78
+ */
79
+ declare function getButtonContentLineHeight({
80
+ schema,
81
+ rootLayerKey,
82
+ iconLayerKey,
83
+ state,
84
+ theme
85
+ }: {
86
+ schema: ButtonControlSchema;
87
+ rootLayerKey: string;
88
+ iconLayerKey: string;
89
+ state: string;
90
+ theme: ThemeFn;
91
+ }): string;
92
+ declare function applyButtonControlHeightDeclarations({
93
+ cssDeclarations,
94
+ paddingVertical,
95
+ schema,
96
+ rootLayerKey,
97
+ iconLayerKey,
98
+ state,
99
+ theme
100
+ }: {
101
+ cssDeclarations: Record<string, string>;
102
+ paddingVertical: string;
103
+ schema: ButtonControlSchema;
104
+ rootLayerKey?: string;
105
+ iconLayerKey: string;
106
+ state: string;
107
+ theme: ThemeFn;
108
+ }): void;
109
+ /**
110
+ * IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
111
+ * xl uses icon-only height from IconButton tokens.
112
+ */
113
+ declare function applyIconButtonControlHeightDeclarations({
114
+ cssDeclarations,
115
+ paddingVertical,
116
+ iconButtonSchema,
117
+ buttonHeightReferenceSchema,
118
+ variantValue,
119
+ iconLayerKey: _iconLayerKey,
120
+ state,
121
+ theme
122
+ }: {
123
+ cssDeclarations: Record<string, string>;
124
+ paddingVertical: string;
125
+ iconButtonSchema: ButtonControlSchema;
126
+ buttonHeightReferenceSchema?: ButtonControlSchema;
127
+ variantValue: string;
128
+ iconLayerKey: string;
129
+ state: string;
130
+ theme: ThemeFn;
131
+ }): void; //#endregion
132
+ //#endregion
133
+ export { type ButtonControlSchema, SHARED_BUTTON_ICONBUTTON_SIZES, applyButtonControlHeightDeclarations, applyIconButtonControlHeightDeclarations, getButtonContentLineHeight, getButtonControlContentSize, getButtonControlHeight, getButtonIconSizeVar, getIconButtonControlHeight };
@@ -0,0 +1,133 @@
1
+
2
+ import { IconButtonMatchButtonHeightConfig } from "./iconButtonMatchButtonHeight.js";
3
+
4
+ //#region ../automated-config/dist/utils/getButtonControlHeight.d.ts
5
+ //#region src/utils/getButtonControlHeight.d.ts
6
+ type ThemeFn = (path: string) => string;
7
+ /** Sizes where IconButton control height should match Button. */
8
+ declare const SHARED_BUTTON_ICONBUTTON_SIZES: Set<string>;
9
+ type ButtonControlSchema = IconButtonMatchButtonHeightConfig & {
10
+ variables?: Record<string, Record<string, Record<string, {
11
+ value?: unknown;
12
+ }>>>;
13
+ };
14
+ declare function getButtonIconSizeVar({
15
+ schema,
16
+ iconLayerKey,
17
+ state,
18
+ theme
19
+ }: {
20
+ schema: ButtonControlSchema;
21
+ iconLayerKey: string;
22
+ state: string;
23
+ theme: ThemeFn;
24
+ }): string | undefined;
25
+ /**
26
+ * Button content box: max(icon size, text line-height).
27
+ * Matches Figma auto-layout and keeps IconButton height aligned with Button.
28
+ */
29
+ declare function getButtonControlContentSize({
30
+ schema,
31
+ rootLayerKey,
32
+ iconLayerKey,
33
+ state,
34
+ theme
35
+ }: {
36
+ schema: ButtonControlSchema;
37
+ rootLayerKey: string;
38
+ iconLayerKey: string;
39
+ state: string;
40
+ theme: ThemeFn;
41
+ }): string | undefined;
42
+ /**
43
+ * Button control height: vertical padding on both sides plus max(icon size, text line-height).
44
+ */
45
+ declare function getButtonControlHeight({
46
+ paddingVertical,
47
+ schema,
48
+ rootLayerKey,
49
+ iconLayerKey,
50
+ state,
51
+ theme
52
+ }: {
53
+ paddingVertical: string;
54
+ schema: ButtonControlSchema;
55
+ rootLayerKey: string;
56
+ iconLayerKey: string;
57
+ state: string;
58
+ theme: ThemeFn;
59
+ }): string | undefined;
60
+ /**
61
+ * IconButton control height: uniform padding plus icon size only (no typography).
62
+ */
63
+ declare function getIconButtonControlHeight({
64
+ paddingVertical,
65
+ schema,
66
+ iconLayerKey,
67
+ state,
68
+ theme
69
+ }: {
70
+ paddingVertical: string;
71
+ schema: ButtonControlSchema;
72
+ iconLayerKey: string;
73
+ state: string;
74
+ theme: ThemeFn;
75
+ }): string | undefined;
76
+ /**
77
+ * Layout line-height for button root: max(icon size, text line-height).
78
+ */
79
+ declare function getButtonContentLineHeight({
80
+ schema,
81
+ rootLayerKey,
82
+ iconLayerKey,
83
+ state,
84
+ theme
85
+ }: {
86
+ schema: ButtonControlSchema;
87
+ rootLayerKey: string;
88
+ iconLayerKey: string;
89
+ state: string;
90
+ theme: ThemeFn;
91
+ }): string;
92
+ declare function applyButtonControlHeightDeclarations({
93
+ cssDeclarations,
94
+ paddingVertical,
95
+ schema,
96
+ rootLayerKey,
97
+ iconLayerKey,
98
+ state,
99
+ theme
100
+ }: {
101
+ cssDeclarations: Record<string, string>;
102
+ paddingVertical: string;
103
+ schema: ButtonControlSchema;
104
+ rootLayerKey?: string;
105
+ iconLayerKey: string;
106
+ state: string;
107
+ theme: ThemeFn;
108
+ }): void;
109
+ /**
110
+ * IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
111
+ * xl uses icon-only height from IconButton tokens.
112
+ */
113
+ declare function applyIconButtonControlHeightDeclarations({
114
+ cssDeclarations,
115
+ paddingVertical,
116
+ iconButtonSchema,
117
+ buttonHeightReferenceSchema,
118
+ variantValue,
119
+ iconLayerKey: _iconLayerKey,
120
+ state,
121
+ theme
122
+ }: {
123
+ cssDeclarations: Record<string, string>;
124
+ paddingVertical: string;
125
+ iconButtonSchema: ButtonControlSchema;
126
+ buttonHeightReferenceSchema?: ButtonControlSchema;
127
+ variantValue: string;
128
+ iconLayerKey: string;
129
+ state: string;
130
+ theme: ThemeFn;
131
+ }): void; //#endregion
132
+ //#endregion
133
+ export { type ButtonControlSchema, SHARED_BUTTON_ICONBUTTON_SIZES, applyButtonControlHeightDeclarations, applyIconButtonControlHeightDeclarations, getButtonContentLineHeight, getButtonControlContentSize, getButtonControlHeight, getButtonIconSizeVar, getIconButtonControlHeight };
@@ -0,0 +1,122 @@
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 ../automated-config/dist/utils/getButtonControlHeight.js
7
+ /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
8
+ /** Sizes where IconButton control height should match Button. */
9
+ const SHARED_BUTTON_ICONBUTTON_SIZES = new Set([
10
+ "xs",
11
+ "sm",
12
+ "md",
13
+ "lg"
14
+ ]);
15
+ function getButtonIconSizeVar({ schema, iconLayerKey, state, theme }) {
16
+ const iconSizeValue = schema.variables?.[iconLayerKey]?.size?.[state]?.value;
17
+ if (typeof iconSizeValue === "string" && iconSizeValue) return theme(configurableProperties.iconSize.twThemePath("iconSizes", iconSizeValue));
18
+ }
19
+ /**
20
+ * Button content box: max(icon size, text line-height).
21
+ * Matches Figma auto-layout and keeps IconButton height aligned with Button.
22
+ */
23
+ function getButtonControlContentSize({ schema, rootLayerKey, iconLayerKey, state, theme }) {
24
+ const iconSizeVar = getButtonIconSizeVar({
25
+ schema,
26
+ iconLayerKey,
27
+ state,
28
+ theme
29
+ });
30
+ const textVariantValue = schema.variables?.[rootLayerKey]?.textVariant?.[state]?.value;
31
+ if (iconSizeVar && typeof textVariantValue === "string" && textVariantValue) return `max(${iconSizeVar}, ${theme(mapTextVariantFixtureToValue("lineHeight")("textVariants", textVariantValue))})`;
32
+ if (iconSizeVar) return iconSizeVar;
33
+ }
34
+ /** `round(up, …, 1px)` matches Math.ceil in getButtonControlHeightPx and Figma hug height. */
35
+ function formatControlHeightCalc(calcExpression) {
36
+ return `round(up, ${calcExpression}, 1px)`;
37
+ }
38
+ /**
39
+ * Button control height: vertical padding on both sides plus max(icon size, text line-height).
40
+ */
41
+ function getButtonControlHeight({ paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
42
+ const contentSize = getButtonControlContentSize({
43
+ schema,
44
+ rootLayerKey,
45
+ iconLayerKey,
46
+ state,
47
+ theme
48
+ });
49
+ if (!contentSize) return;
50
+ return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${contentSize})`);
51
+ }
52
+ /**
53
+ * IconButton control height: uniform padding plus icon size only (no typography).
54
+ */
55
+ function getIconButtonControlHeight({ paddingVertical, schema, iconLayerKey, state, theme }) {
56
+ const iconSizeVar = getButtonIconSizeVar({
57
+ schema,
58
+ iconLayerKey,
59
+ state,
60
+ theme
61
+ });
62
+ if (!iconSizeVar) return;
63
+ return formatControlHeightCalc(`calc(2 * ${paddingVertical} + ${iconSizeVar})`);
64
+ }
65
+ /**
66
+ * Layout line-height for button root: max(icon size, text line-height).
67
+ */
68
+ function getButtonContentLineHeight({ schema, rootLayerKey, iconLayerKey, state, theme }) {
69
+ return getButtonControlContentSize({
70
+ schema,
71
+ rootLayerKey,
72
+ iconLayerKey,
73
+ state,
74
+ theme
75
+ }) ?? "1em";
76
+ }
77
+ function applyButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, schema, rootLayerKey, iconLayerKey, state, theme }) {
78
+ const controlHeight = rootLayerKey ? getButtonControlHeight({
79
+ paddingVertical,
80
+ schema,
81
+ rootLayerKey,
82
+ iconLayerKey,
83
+ state,
84
+ theme
85
+ }) : getIconButtonControlHeight({
86
+ paddingVertical,
87
+ schema,
88
+ iconLayerKey,
89
+ state,
90
+ theme
91
+ });
92
+ if (controlHeight) {
93
+ cssDeclarations[BUTTON_CONTROL_HEIGHT_VAR] = controlHeight;
94
+ cssDeclarations.height = `var(${BUTTON_CONTROL_HEIGHT_VAR})`;
95
+ }
96
+ }
97
+ function applyIconButtonSquareDimensions(cssDeclarations) {
98
+ if (cssDeclarations[BUTTON_CONTROL_HEIGHT_VAR]) cssDeclarations.width = `var(${BUTTON_CONTROL_HEIGHT_VAR})`;
99
+ }
100
+ /**
101
+ * IconButton height for xs–lg mirrors Button (padding + max(icon, line-height)).
102
+ * xl uses icon-only height from IconButton tokens.
103
+ */
104
+ function applyIconButtonControlHeightDeclarations({ cssDeclarations, paddingVertical, iconButtonSchema, buttonHeightReferenceSchema, variantValue, iconLayerKey: _iconLayerKey, state, theme }) {
105
+ if (buttonHeightReferenceSchema && SHARED_BUTTON_ICONBUTTON_SIZES.has(variantValue) && isIconButtonMatchButtonHeightEnabled(iconButtonSchema, variantValue)) {
106
+ const buttonRootLayerKey = `size/${variantValue}/root`;
107
+ const buttonIconLayerKey = `size/${variantValue}/icon`;
108
+ const buttonSpacingValue = buttonHeightReferenceSchema.variables?.[buttonRootLayerKey]?.spacingVertical?.[state]?.value;
109
+ applyButtonControlHeightDeclarations({
110
+ cssDeclarations,
111
+ paddingVertical: typeof buttonSpacingValue === "string" && buttonSpacingValue ? theme(configurableProperties.spacingVertical.twThemePath("spacingAliases", buttonSpacingValue)) : paddingVertical,
112
+ schema: buttonHeightReferenceSchema,
113
+ rootLayerKey: buttonRootLayerKey,
114
+ iconLayerKey: buttonIconLayerKey,
115
+ state,
116
+ theme
117
+ });
118
+ applyIconButtonSquareDimensions(cssDeclarations);
119
+ }
120
+ }
121
+ //#endregion
122
+ export { SHARED_BUTTON_ICONBUTTON_SIZES, applyButtonControlHeightDeclarations, applyIconButtonControlHeightDeclarations, getButtonContentLineHeight, getButtonControlContentSize, getButtonControlHeight, getButtonIconSizeVar, getIconButtonControlHeight };
@@ -0,0 +1,114 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ require("../../../_virtual/_rolldown/runtime.cjs");
3
+ const require_index = require("../../../fixtures/dist/index.cjs");
4
+ const require_iconButtonMatchButtonHeight = require("./iconButtonMatchButtonHeight.cjs");
5
+ let _yahoo_uds_icons_tokens = require("@yahoo/uds-icons/tokens");
6
+ let lodash_es = require("lodash-es");
7
+ //#region ../automated-config/dist/utils/getButtonControlHeightPx.js
8
+ /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
9
+ const SHARED_BUTTON_ICONBUTTON_SIZES = new Set([
10
+ "xs",
11
+ "sm",
12
+ "md",
13
+ "lg"
14
+ ]);
15
+ function resolveSpacingPx(config, alias) {
16
+ if (!alias) return 0;
17
+ const scaleValue = (0, lodash_es.get)(config, [
18
+ "scaleMode",
19
+ "large",
20
+ "spacing",
21
+ alias.replace(".", "_")
22
+ ]);
23
+ if (typeof scaleValue === "number") return scaleValue;
24
+ return require_index.spacingMap[alias] ?? 0;
25
+ }
26
+ function resolveTypographyPx(config, textVariant, property) {
27
+ if (!textVariant) return 0;
28
+ const typographyConfig = config.typography[textVariant];
29
+ if (!typographyConfig?.[property]) return 0;
30
+ const defaultBreakpoint = config.globalDefaults.breakpoint;
31
+ const value = defaultBreakpoint === "base" ? typographyConfig[property].base : typographyConfig[property].breakpoints[defaultBreakpoint];
32
+ if (typeof value === "number") return value;
33
+ if (value && typeof value === "object" && "value" in value) return value.value;
34
+ return 0;
35
+ }
36
+ /** Ceil fractional totals so Figma-bound controlHeight matches auto-layout hug (e.g. xs + ui3 15.4lh → 28). */
37
+ function snapControlHeightPx(value) {
38
+ return Math.ceil(value);
39
+ }
40
+ /** Pixel control height for Button: padding + max(icon size, text line-height). */
41
+ function getButtonControlHeightPx(config, size) {
42
+ const button = config.button;
43
+ if (!button?.variables) return 0;
44
+ const layerPrefix = `size/${size}`;
45
+ const paddingAlias = button.variables[`${layerPrefix}/root`]?.spacingVertical?.rest?.value;
46
+ const iconSizeAlias = button.variables[`${layerPrefix}/icon`]?.size?.rest?.value;
47
+ const textVariant = button.variables[`${layerPrefix}/root`]?.textVariant?.rest?.value;
48
+ const padding = resolveSpacingPx(config, paddingAlias);
49
+ const iconSize = _yahoo_uds_icons_tokens.ICON_SIZE_MAP[iconSizeAlias ?? "sm"] ?? 16;
50
+ const lineHeight = resolveTypographyPx(config, textVariant, "lineHeight");
51
+ return snapControlHeightPx(padding * 2 + Math.max(iconSize, lineHeight || iconSize));
52
+ }
53
+ /** Pixel control height for IconButton: uniform padding plus icon size only. */
54
+ function getIconButtonOnlyControlHeightPx(config, size) {
55
+ const iconButton = config.iconButton;
56
+ if (!iconButton?.variables) return 0;
57
+ const layerPrefix = `size/${size}`;
58
+ const paddingAlias = iconButton.variables[`${layerPrefix}/root`]?.spacing?.rest?.value;
59
+ const iconSizeAlias = iconButton.variables[`${layerPrefix}/icon`]?.size?.rest?.value;
60
+ const padding = resolveSpacingPx(config, paddingAlias);
61
+ const iconSize = _yahoo_uds_icons_tokens.ICON_SIZE_MAP[iconSizeAlias ?? "sm"] ?? 16;
62
+ return snapControlHeightPx(padding * 2 + iconSize);
63
+ }
64
+ /** Pixel control height for IconButton when match-button-height is enabled for that size. */
65
+ function getIconButtonControlHeightPx(config, size) {
66
+ if (SHARED_BUTTON_ICONBUTTON_SIZES.has(size)) {
67
+ if (!require_iconButtonMatchButtonHeight.isIconButtonMatchButtonHeightEnabled(config, size)) return 0;
68
+ return getButtonControlHeightPx(config, size);
69
+ }
70
+ return 0;
71
+ }
72
+ function setControlHeightVar(config, componentKey, size, heightPx) {
73
+ const rootKey = `size/${size}/root`;
74
+ const componentConfig = config[componentKey];
75
+ const existingRoot = componentConfig?.variables?.[rootKey] ?? {};
76
+ return {
77
+ ...config,
78
+ [componentKey]: {
79
+ ...componentConfig,
80
+ variables: {
81
+ ...componentConfig?.variables,
82
+ [rootKey]: {
83
+ ...existingRoot,
84
+ controlHeight: { rest: {
85
+ type: "positiveIntegers",
86
+ value: snapControlHeightPx(heightPx),
87
+ valueType: "alias"
88
+ } }
89
+ }
90
+ }
91
+ }
92
+ };
93
+ }
94
+ function syncButtonControlHeightVarForSize(config, size) {
95
+ if (!SHARED_BUTTON_ICONBUTTON_SIZES.has(size) || !require_iconButtonMatchButtonHeight.isIconButtonMatchButtonHeightEnabled(config, size)) return config;
96
+ return setControlHeightVar(config, "iconButton", size, getButtonControlHeightPx(config, size));
97
+ }
98
+ function syncIconButtonControlHeightVarForSize(config, size) {
99
+ const heightPx = getIconButtonControlHeightPx(config, size);
100
+ if (heightPx <= 0) return config;
101
+ return setControlHeightVar(config, "iconButton", size, heightPx);
102
+ }
103
+ function syncIconButtonOnlyControlHeightVarForSize(config, size) {
104
+ const heightPx = getIconButtonOnlyControlHeightPx(config, size);
105
+ if (heightPx <= 0) return config;
106
+ return setControlHeightVar(config, "iconButton", size, heightPx);
107
+ }
108
+ //#endregion
109
+ exports.getButtonControlHeightPx = getButtonControlHeightPx;
110
+ exports.getIconButtonControlHeightPx = getIconButtonControlHeightPx;
111
+ exports.getIconButtonOnlyControlHeightPx = getIconButtonOnlyControlHeightPx;
112
+ exports.syncButtonControlHeightVarForSize = syncButtonControlHeightVarForSize;
113
+ exports.syncIconButtonControlHeightVarForSize = syncIconButtonControlHeightVarForSize;
114
+ exports.syncIconButtonOnlyControlHeightVarForSize = syncIconButtonOnlyControlHeightVarForSize;