@yahoo/uds 3.117.4 → 3.117.5
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/styles/styler.d.cts +41 -41
- package/dist/styles/styler.d.ts +41 -41
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.cjs +637 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js +637 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.cjs +36541 -0
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js +36524 -0
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.cjs +20 -0
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.js +21 -0
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/properties.cjs +480 -0
- package/dist/tailwind/dist/automated-config/dist/properties.js +481 -0
- package/dist/tailwind/dist/automated-config/dist/properties.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.cjs +10 -0
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.js +10 -0
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.cjs +18 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.js +18 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.cjs +15 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.js +15 -0
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/index.cjs +479 -0
- package/dist/tailwind/dist/automated-config/dist/utils/index.js +479 -0
- package/dist/tailwind/dist/automated-config/dist/utils/index.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.cjs +28 -0
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.js +29 -0
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.js.map +1 -0
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.cjs +10 -0
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.js +9 -0
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.js.map +1 -0
- package/dist/tailwind/dist/config/dist/index.cjs +27057 -0
- package/dist/tailwind/dist/config/dist/index.d.cts +11 -0
- package/dist/tailwind/dist/config/dist/index.d.cts.map +1 -0
- package/dist/tailwind/dist/config/dist/index.d.ts +11 -0
- package/dist/tailwind/dist/config/dist/index.d.ts.map +1 -0
- package/dist/tailwind/dist/config/dist/index.js +27057 -0
- package/dist/tailwind/dist/config/dist/index.js.map +1 -0
- package/dist/tailwind/dist/css/generate.cjs +2 -2
- package/dist/tailwind/dist/css/generate.d.cts +0 -1
- package/dist/tailwind/dist/css/generate.d.cts.map +1 -1
- package/dist/tailwind/dist/css/generate.d.ts +0 -1
- package/dist/tailwind/dist/css/generate.d.ts.map +1 -1
- package/dist/tailwind/dist/css/generate.js +1 -1
- package/dist/tailwind/dist/css/runner.cjs +3 -3
- package/dist/tailwind/dist/css/runner.js +1 -1
- package/dist/tailwind/dist/css/utils.cjs +2 -3
- package/dist/tailwind/dist/css/utils.js +1 -1
- package/dist/tailwind/dist/css-tokens/dist/index.cjs +168 -0
- package/dist/tailwind/dist/css-tokens/dist/index.js +127 -0
- package/dist/tailwind/dist/css-tokens/dist/index.js.map +1 -0
- package/dist/tailwind/dist/fixtures/dist/index.cjs +596 -0
- package/dist/tailwind/dist/fixtures/dist/index.js +589 -0
- package/dist/tailwind/dist/fixtures/dist/index.js.map +1 -0
- package/dist/tailwind/dist/fonts/dist/index.cjs +809 -0
- package/dist/tailwind/dist/fonts/dist/index.d.cts +632 -0
- package/dist/tailwind/dist/fonts/dist/index.d.cts.map +1 -0
- package/dist/tailwind/dist/fonts/dist/index.d.ts +632 -0
- package/dist/tailwind/dist/fonts/dist/index.d.ts.map +1 -0
- package/dist/tailwind/dist/fonts/dist/index.js +809 -0
- package/dist/tailwind/dist/fonts/dist/index.js.map +1 -0
- package/dist/tailwind/dist/modes/dist/index.cjs +9 -0
- package/dist/tailwind/dist/modes/dist/index.js +8 -0
- package/dist/tailwind/dist/modes/dist/index.js.map +1 -0
- package/dist/tailwind/dist/motion-tokens/dist/index.cjs +27 -0
- package/dist/tailwind/dist/motion-tokens/dist/index.js +26 -0
- package/dist/tailwind/dist/motion-tokens/dist/index.js.map +1 -0
- package/dist/tailwind/dist/palette/dist/index.cjs +29 -0
- package/dist/tailwind/dist/palette/dist/index.js +26 -0
- package/dist/tailwind/dist/palette/dist/index.js.map +1 -0
- package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +10 -10
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js +1 -1
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.cjs +4 -4
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.js +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +3 -3
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/safelist.cjs +3 -3
- package/dist/tailwind/dist/purger/optimized/utils/safelist.js +1 -1
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.cjs +5 -5
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.js +2 -2
- package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.cjs +8 -8
- package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.js +2 -2
- package/dist/tailwind/dist/tailwind/base/addScaleModeVars.cjs +10 -11
- package/dist/tailwind/dist/tailwind/base/addScaleModeVars.js +2 -2
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.cjs +3 -4
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.cjs +9 -10
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.js +2 -2
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.cjs +23 -23
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.js +2 -2
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.cts +3 -3
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.cts.map +1 -1
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.ts +3 -3
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.ts.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.cjs +4 -4
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/borderRadius.cjs +4 -4
- package/dist/tailwind/dist/tailwind/plugins/borderRadius.js +2 -2
- package/dist/tailwind/dist/tailwind/plugins/borderWidth.cjs +4 -4
- package/dist/tailwind/dist/tailwind/plugins/borderWidth.js +2 -2
- package/dist/tailwind/dist/tailwind/plugins/colors.cjs +12 -12
- package/dist/tailwind/dist/tailwind/plugins/colors.js +3 -3
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +22 -22
- package/dist/tailwind/dist/tailwind/plugins/components.js +3 -3
- package/dist/tailwind/dist/tailwind/plugins/elevation.cjs +3 -3
- package/dist/tailwind/dist/tailwind/plugins/elevation.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.cjs +2 -3
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/shadows.cjs +5 -5
- package/dist/tailwind/dist/tailwind/plugins/shadows.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/sizing.cjs +2 -2
- package/dist/tailwind/dist/tailwind/plugins/sizing.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/typography.cjs +6 -6
- package/dist/tailwind/dist/tailwind/plugins/typography.js +2 -2
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.cjs +6 -7
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.js +2 -2
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.cjs +6 -7
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.cjs +2 -3
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.cjs +4 -5
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.js +2 -2
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.cjs +4 -5
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.js +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.cjs +2 -3
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.d.cts +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.d.ts +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.cjs +3 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.js +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts +295 -0
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -0
- package/dist/tailwind/dist/types/dist/index.d.ts +295 -0
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -0
- package/dist/tailwind/dist/utils/generatePurgeCSSData.cjs +5 -5
- package/dist/tailwind/dist/utils/generatePurgeCSSData.js +2 -2
- package/dist/tailwind/dist/utils/parseTokens.cjs +29 -30
- package/dist/tailwind/dist/utils/parseTokens.d.cts +2 -2
- package/dist/tailwind/dist/utils/parseTokens.d.ts +2 -2
- package/dist/tailwind/dist/utils/parseTokens.js +2 -2
- package/dist/uds/generated/componentData.cjs +1105 -1105
- package/dist/uds/generated/componentData.js +1105 -1105
- package/generated/componentData.json +1508 -1508
- package/package.json +1 -1
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_index = require('../../../css-tokens/dist/index.cjs');
|
|
4
|
+
const require_properties = require('../properties.cjs');
|
|
5
|
+
const require_generateDefaultClassName = require('./generateDefaultClassName.cjs');
|
|
6
|
+
const require_generateSchemaKey = require('./generateSchemaKey.cjs');
|
|
7
|
+
const require_variantConfigGuards = require('./variantConfigGuards.cjs');
|
|
8
|
+
let lodash_es = require("lodash-es");
|
|
9
|
+
|
|
10
|
+
//#region ../automated-config/dist/utils/index.js
|
|
11
|
+
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
|
|
12
|
+
const CSS_GAP = "gap";
|
|
13
|
+
const CSS_LINE_HEIGHT = "line-height";
|
|
14
|
+
const CSS_BORDER_WIDTH = "border-width";
|
|
15
|
+
const CSS_BORDER_COLOR = "border-color";
|
|
16
|
+
const CSS_BOX_SHADOW = "box-shadow";
|
|
17
|
+
function deepMerge(target, source) {
|
|
18
|
+
return (0, lodash_es.mergeWith)({}, target, source);
|
|
19
|
+
}
|
|
20
|
+
const COMPONENTS_WITH_SHADOW_BORDERS = [
|
|
21
|
+
{
|
|
22
|
+
componentName: "button",
|
|
23
|
+
layer: "root"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
componentName: "iconbutton",
|
|
27
|
+
layer: "root"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
componentName: "chip",
|
|
31
|
+
layer: "root"
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Map our "states" to pseudo-classes (hover => :hover, pressed => :active, etc.).
|
|
36
|
+
* Adjust or extend as needed.
|
|
37
|
+
*/
|
|
38
|
+
const statePseudoMap = {
|
|
39
|
+
rest: "",
|
|
40
|
+
hover: ":hover:not(:active, :disabled, :has(:disabled))",
|
|
41
|
+
pressed: ":active:not(:disabled, :has(:disabled))",
|
|
42
|
+
disabled: ":is(:disabled, :has(:disabled))",
|
|
43
|
+
visited: ":visited",
|
|
44
|
+
focused: ":focus",
|
|
45
|
+
"focus-within": ":focus-within",
|
|
46
|
+
"focused-keyboard": ":focus-visible",
|
|
47
|
+
readonly: ":has(input:read-only)",
|
|
48
|
+
invalid: ":has(input[aria-invalid=\"true\"])",
|
|
49
|
+
"invalid&hover": ":has(input[aria-invalid=\"true\"]):hover:not(:active, :disabled, :has(:disabled))",
|
|
50
|
+
"invalid&pressed": ":has(input[aria-invalid=\"true\"]):active:not(:disabled, :has(:disabled))"
|
|
51
|
+
};
|
|
52
|
+
const statePseudoMapDocsMode = {
|
|
53
|
+
rest: "",
|
|
54
|
+
hover: "hover",
|
|
55
|
+
pressed: "active",
|
|
56
|
+
disabled: "has-disabled",
|
|
57
|
+
visited: "visited",
|
|
58
|
+
focused: "focus",
|
|
59
|
+
"focus-within": "focus-within",
|
|
60
|
+
"focused-keyboard": "focus-visible",
|
|
61
|
+
readonly: "input-readonly",
|
|
62
|
+
invalid: "has-input-invalid",
|
|
63
|
+
"invalid&hover": "has-input-invalid-and-hover",
|
|
64
|
+
"invalid&pressed": "has-input-invalid-and-active"
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Generates button line-height with icon size minimum.
|
|
68
|
+
* Ensures button line-height is at least as tall as the icon to prevent clipping.
|
|
69
|
+
* @returns Enhanced line-height CSS value with max(), or original value if icon size unavailable
|
|
70
|
+
*/
|
|
71
|
+
function getButtonLineHeightWithIconMinimum({ lineHeight, schema, iconLayerKey, state, theme }) {
|
|
72
|
+
const iconSizeValue = schema.variables?.[iconLayerKey]?.size?.[state]?.value;
|
|
73
|
+
if (iconSizeValue) return `max(${lineHeight}, ${theme(require_properties.configurableProperties.iconSize.twThemePath("iconSizes", iconSizeValue))})`;
|
|
74
|
+
return lineHeight;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Forces button borders to use box-shadow instead of border properties.
|
|
78
|
+
* Converts border-width and border-color into an inset box-shadow layer.
|
|
79
|
+
*
|
|
80
|
+
* Why box-shadow for borders?
|
|
81
|
+
* - Respects border-radius (unlike outline which stays rectangular)
|
|
82
|
+
* - Allows layering multiple shadows in a single property
|
|
83
|
+
* - GPU-accelerated and performant
|
|
84
|
+
* - Works perfectly with rounded/circular buttons
|
|
85
|
+
*
|
|
86
|
+
* @param classStyles - The CSS declarations for a button class
|
|
87
|
+
* @returns Modified styles with box-shadow layers, or original if no border
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* Input: { border-width: '2px', border-color: 'red', box-shadow: '0 2px 4px rgba(0,0,0,0.1)' }
|
|
91
|
+
* Output: { box-shadow: 'inset 0 0 0 2px red, 0 2px 4px rgba(0,0,0,0.1)' }
|
|
92
|
+
*/
|
|
93
|
+
function applyBoxShadowBorder(classStyles) {
|
|
94
|
+
const borderWidth = classStyles[CSS_BORDER_WIDTH];
|
|
95
|
+
const borderColor = classStyles[CSS_BORDER_COLOR];
|
|
96
|
+
if (!borderWidth || !borderColor) return classStyles;
|
|
97
|
+
const stripImportant = (value) => value.replace(/\s*!important\s*$/, "");
|
|
98
|
+
const hasImportant = (value) => value?.includes("!important") ?? false;
|
|
99
|
+
const layers = [`inset 0 0 0 ${stripImportant(borderWidth)} ${stripImportant(borderColor)}`, classStyles[CSS_BOX_SHADOW] && stripImportant(classStyles[CSS_BOX_SHADOW])].filter(Boolean);
|
|
100
|
+
const needsImportant = hasImportant(borderWidth) || hasImportant(borderColor) || hasImportant(classStyles[CSS_BOX_SHADOW]);
|
|
101
|
+
const newStyles = { ...classStyles };
|
|
102
|
+
newStyles[CSS_BOX_SHADOW] = layers.join(", ") + (needsImportant ? " !important" : "");
|
|
103
|
+
delete newStyles[CSS_BORDER_WIDTH];
|
|
104
|
+
delete newStyles[CSS_BORDER_COLOR];
|
|
105
|
+
return newStyles;
|
|
106
|
+
}
|
|
107
|
+
function generateClassName({ componentName, subComponentName, variantKey, variantValue, componentStateKey, componentStateValue, layer, layerOptionalPseudoSelector }) {
|
|
108
|
+
let className = "";
|
|
109
|
+
if (subComponentName) className = `uds-${componentName}-${subComponentName}-${variantKey}`.toLowerCase();
|
|
110
|
+
else className = `uds-${componentName}-${variantKey}`.toLowerCase();
|
|
111
|
+
if (variantValue) className = `${className}-${variantValue}`.toLowerCase();
|
|
112
|
+
if (componentStateKey && componentStateValue) className = `${className}-${componentStateKey}-${componentStateValue}`.toLowerCase();
|
|
113
|
+
className = `${className}-${layer}`.toLowerCase();
|
|
114
|
+
if (layerOptionalPseudoSelector) className = `${className}${layerOptionalPseudoSelector}`;
|
|
115
|
+
return className.replaceAll(/\s+/g, "-");
|
|
116
|
+
}
|
|
117
|
+
const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, existingValue, originalPropertyDefinition) => {
|
|
118
|
+
const { value, type } = schemaStateValue;
|
|
119
|
+
const propertyConfig = require_properties.configurableProperties[propertyName];
|
|
120
|
+
let newValue;
|
|
121
|
+
if (propertyConfig.customValueRenderer) newValue = propertyConfig.customValueRenderer(schemaStateValue, schema, theme, originalPropertyDefinition);
|
|
122
|
+
else {
|
|
123
|
+
const safeTwThemePath = propertyConfig.twThemePath;
|
|
124
|
+
newValue = theme(safeTwThemePath(type, String(value)));
|
|
125
|
+
}
|
|
126
|
+
if (propertyConfig.concatenate && existingValue) return `${existingValue}${propertyConfig.concatenationDelimiter || ", "}${newValue}`;
|
|
127
|
+
return newValue;
|
|
128
|
+
};
|
|
129
|
+
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, theme, currentStyles, previewOptions }) {
|
|
130
|
+
const schemaKey = require_generateSchemaKey.generateSchemaKey({
|
|
131
|
+
variantKey,
|
|
132
|
+
variantValue,
|
|
133
|
+
layer,
|
|
134
|
+
subComponentName,
|
|
135
|
+
componentStateKey,
|
|
136
|
+
componentStateValue
|
|
137
|
+
});
|
|
138
|
+
let className = generateClassName({
|
|
139
|
+
componentName,
|
|
140
|
+
variantKey,
|
|
141
|
+
variantValue,
|
|
142
|
+
layer,
|
|
143
|
+
subComponentName,
|
|
144
|
+
componentStateKey,
|
|
145
|
+
componentStateValue
|
|
146
|
+
});
|
|
147
|
+
const propertyStateMap = schema.variables?.[schemaKey]?.[propertyKey];
|
|
148
|
+
if (!propertyStateMap) throw new Error(`Prop definition (${componentName} - ${schemaKey} - ${propertyKey}) not found, this is not expected, please report the bug to the UDS team`);
|
|
149
|
+
const styles = {};
|
|
150
|
+
for (const propStateStr in propertyStateMap) {
|
|
151
|
+
const propertyState = propStateStr;
|
|
152
|
+
const propertyStateSelector = statePseudoMap[propertyState] ?? "";
|
|
153
|
+
const schemaValueForState = propertyStateMap[propertyState];
|
|
154
|
+
let fullClassName = ``;
|
|
155
|
+
if (layer === "root") if (componentStateKey && componentStateValue) {
|
|
156
|
+
const rootVariantClass = generateClassName({
|
|
157
|
+
componentName,
|
|
158
|
+
variantKey,
|
|
159
|
+
variantValue,
|
|
160
|
+
layer,
|
|
161
|
+
subComponentName
|
|
162
|
+
});
|
|
163
|
+
className = generateClassName({
|
|
164
|
+
componentName,
|
|
165
|
+
variantKey,
|
|
166
|
+
layer,
|
|
167
|
+
subComponentName,
|
|
168
|
+
componentStateKey,
|
|
169
|
+
componentStateValue
|
|
170
|
+
});
|
|
171
|
+
fullClassName = `.${rootVariantClass}${propertyStateSelector}.${className}`;
|
|
172
|
+
} else fullClassName = `.${className}${propertyStateSelector}`;
|
|
173
|
+
else {
|
|
174
|
+
const rootVariantClassName = generateClassName({
|
|
175
|
+
componentName,
|
|
176
|
+
variantKey,
|
|
177
|
+
variantValue,
|
|
178
|
+
layer: "root",
|
|
179
|
+
subComponentName
|
|
180
|
+
});
|
|
181
|
+
if (componentStateKey && componentStateValue) {
|
|
182
|
+
const rootVariantClassNameWithComponentState = generateClassName({
|
|
183
|
+
componentName,
|
|
184
|
+
variantKey,
|
|
185
|
+
layer: "root",
|
|
186
|
+
subComponentName,
|
|
187
|
+
componentStateKey,
|
|
188
|
+
componentStateValue
|
|
189
|
+
});
|
|
190
|
+
className = generateClassName({
|
|
191
|
+
componentName,
|
|
192
|
+
variantKey,
|
|
193
|
+
variantValue,
|
|
194
|
+
layer,
|
|
195
|
+
layerOptionalPseudoSelector,
|
|
196
|
+
subComponentName
|
|
197
|
+
});
|
|
198
|
+
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} .${className}`;
|
|
199
|
+
} else fullClassName = `.${rootVariantClassName}${propertyStateSelector} .${className}`;
|
|
200
|
+
}
|
|
201
|
+
const { cssProperties, extendedProperties: extendedPropertiesGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
202
|
+
const cssDeclarations = {};
|
|
203
|
+
const isExtendedPropertiesFunction = (0, lodash_es.isFunction)(extendedPropertiesGetter);
|
|
204
|
+
const extendedProperties = isExtendedPropertiesFunction ? extendedPropertiesGetter({
|
|
205
|
+
componentName,
|
|
206
|
+
subComponentName,
|
|
207
|
+
layer,
|
|
208
|
+
propertyKey
|
|
209
|
+
}) : extendedPropertiesGetter;
|
|
210
|
+
if (extendedProperties && extendedProperties.length) {
|
|
211
|
+
if (!isExtendedPropertiesFunction && (typeof cssProperties === "string" || Array.isArray(cssProperties) && cssProperties.length > 0)) throw new Error("Invalid configuration: cssProperties should not be configured when extendedProperties are defined. Please update your property configuration accordingly.");
|
|
212
|
+
for (const extendedProp of extendedProperties) {
|
|
213
|
+
const cssPropertiesRef = require_properties.configurableProperties[extendedProp].cssProperties;
|
|
214
|
+
if (typeof cssPropertiesRef === "string") {
|
|
215
|
+
const existingValue = currentStyles?.[fullClassName]?.[cssPropertiesRef];
|
|
216
|
+
cssDeclarations[cssPropertiesRef] = getTheCssPropertyValue(schema, theme, extendedProp, schemaValueForState, existingValue);
|
|
217
|
+
} else if (Array.isArray(cssPropertiesRef)) for (const cssProp of cssPropertiesRef) {
|
|
218
|
+
const existingValue = currentStyles?.[fullClassName]?.[cssProp];
|
|
219
|
+
cssDeclarations[cssProp] = getTheCssPropertyValue(schema, theme, extendedProp, schemaValueForState, existingValue);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} else if (typeof cssProperties === "string") {
|
|
223
|
+
const existingValue = currentStyles?.[fullClassName]?.[cssProperties];
|
|
224
|
+
cssDeclarations[cssProperties] = getTheCssPropertyValue(schema, theme, originalPropertyDefinition.name, schemaValueForState, existingValue, originalPropertyDefinition);
|
|
225
|
+
} else if (Array.isArray(cssProperties)) for (const cssProp of cssProperties) {
|
|
226
|
+
const existingValue = currentStyles?.[fullClassName]?.[cssProp];
|
|
227
|
+
cssDeclarations[cssProp] = getTheCssPropertyValue(schema, theme, originalPropertyDefinition.name, schemaValueForState, existingValue, originalPropertyDefinition);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Button root layer workarounds & enhancements.
|
|
231
|
+
* These handle Motion animation bridges and visual fixes until better config-to-component solutions exist.
|
|
232
|
+
*/
|
|
233
|
+
if (componentName === "button" && layer === "root") {
|
|
234
|
+
if (propertyKey === CSS_GAP) cssDeclarations[require_index.BUTTON_GAP_VAR] = cssDeclarations[CSS_GAP];
|
|
235
|
+
if (propertyKey === "scaleEffect" && propertyState === "hover") {
|
|
236
|
+
const rootClassName = `.${className}`;
|
|
237
|
+
const renderValue = (schemaValue) => require_properties.configurableProperties.scaleEffect.customValueRenderer?.(schemaValue, schema, () => "") ?? "1";
|
|
238
|
+
if (!styles[rootClassName]) styles[rootClassName] = {};
|
|
239
|
+
styles[rootClassName][require_index.BUTTON_SCALE_EFFECT_REST] = "1";
|
|
240
|
+
if (propertyStateMap.hover) styles[rootClassName][require_index.BUTTON_SCALE_EFFECT_HOVER] = renderValue(propertyStateMap.hover);
|
|
241
|
+
if (propertyStateMap.pressed) styles[rootClassName][require_index.BUTTON_SCALE_EFFECT_PRESSED] = renderValue(propertyStateMap.pressed);
|
|
242
|
+
}
|
|
243
|
+
if (cssDeclarations[CSS_LINE_HEIGHT]) {
|
|
244
|
+
const iconLayerKey = require_generateSchemaKey.generateSchemaKey({
|
|
245
|
+
variantKey,
|
|
246
|
+
variantValue,
|
|
247
|
+
layer: "icon",
|
|
248
|
+
subComponentName
|
|
249
|
+
});
|
|
250
|
+
cssDeclarations[CSS_LINE_HEIGHT] = getButtonLineHeightWithIconMinimum({
|
|
251
|
+
lineHeight: cssDeclarations[CSS_LINE_HEIGHT],
|
|
252
|
+
schema,
|
|
253
|
+
iconLayerKey,
|
|
254
|
+
state: propertyState,
|
|
255
|
+
theme
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (!styles[fullClassName]) styles[fullClassName] = {
|
|
260
|
+
...cssDeclarations,
|
|
261
|
+
...styles[fullClassName]
|
|
262
|
+
};
|
|
263
|
+
if (previewOptions?.generatePseudoStateClassModifier) {
|
|
264
|
+
const pseudoPrefixClass = statePseudoMapDocsMode[propertyState] ?? "";
|
|
265
|
+
if (pseudoPrefixClass.length) {
|
|
266
|
+
const importantCssDeclarations = Object.fromEntries(Object.entries(cssDeclarations).map(([prop, value]) => {
|
|
267
|
+
const strValue = String(value).trimEnd().replace(/;$/, "");
|
|
268
|
+
if (strValue.includes("!important")) return [prop, strValue];
|
|
269
|
+
return [prop, `${strValue} !important`];
|
|
270
|
+
}));
|
|
271
|
+
styles[`.${pseudoPrefixClass}${fullClassName}`.replace(propertyStateSelector, "")] = {
|
|
272
|
+
...importantCssDeclarations,
|
|
273
|
+
...styles[`.${pseudoPrefixClass}${fullClassName}`.replace(propertyStateSelector, "")]
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return styles;
|
|
279
|
+
}
|
|
280
|
+
function generateConfigStyles(config, schema, theme, previewOptions) {
|
|
281
|
+
const componentName = config.label.toLowerCase();
|
|
282
|
+
let styles = {};
|
|
283
|
+
for (const variantKey in config.variants) {
|
|
284
|
+
const variantConfig = config.variants[variantKey];
|
|
285
|
+
for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
286
|
+
const componentStates = variantConfig.componentStates;
|
|
287
|
+
for (const componentStateKey in componentStates) {
|
|
288
|
+
const componentState = componentStates[componentStateKey];
|
|
289
|
+
for (const componentStateOption of componentState.options) for (const layerKey in componentState.layers) {
|
|
290
|
+
const layer = componentState.layers[layerKey];
|
|
291
|
+
for (const propertyKey in layer.properties) {
|
|
292
|
+
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
293
|
+
const declarations = generateDeclaration({
|
|
294
|
+
componentName,
|
|
295
|
+
variantKey,
|
|
296
|
+
variantValue: variantOption,
|
|
297
|
+
componentStateKey,
|
|
298
|
+
componentStateValue: componentStateOption,
|
|
299
|
+
layer: layerKey,
|
|
300
|
+
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
301
|
+
propertyKey,
|
|
302
|
+
originalPropertyDefinition,
|
|
303
|
+
theme,
|
|
304
|
+
schema,
|
|
305
|
+
currentStyles: styles,
|
|
306
|
+
previewOptions
|
|
307
|
+
});
|
|
308
|
+
styles = deepMerge(styles, declarations);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
} else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) {
|
|
313
|
+
const layers = variantConfig.layers;
|
|
314
|
+
for (const layerKey in layers) {
|
|
315
|
+
const layer = layers[layerKey];
|
|
316
|
+
for (const propertyKey in layer.properties) {
|
|
317
|
+
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
318
|
+
const declarations = generateDeclaration({
|
|
319
|
+
componentName,
|
|
320
|
+
variantKey,
|
|
321
|
+
variantValue: variantOption,
|
|
322
|
+
layer: layerKey,
|
|
323
|
+
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
324
|
+
propertyKey,
|
|
325
|
+
originalPropertyDefinition,
|
|
326
|
+
theme,
|
|
327
|
+
schema,
|
|
328
|
+
currentStyles: styles,
|
|
329
|
+
previewOptions
|
|
330
|
+
});
|
|
331
|
+
styles = deepMerge(styles, declarations);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (config.subComponents) {
|
|
337
|
+
const { subComponents } = config;
|
|
338
|
+
for (const subComponentKey in subComponents) for (const variantKey in subComponents[subComponentKey].variants) {
|
|
339
|
+
const variantConfig = subComponents[subComponentKey].variants[variantKey];
|
|
340
|
+
for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
341
|
+
const componentStates = variantConfig.componentStates;
|
|
342
|
+
for (const componentStateKey in componentStates) {
|
|
343
|
+
const componentState = componentStates[componentStateKey];
|
|
344
|
+
for (const componentStateOption of componentState.options) for (const layerKey in componentState.layers) {
|
|
345
|
+
const layer = componentState.layers[layerKey];
|
|
346
|
+
for (const propertyKey in layer.properties) {
|
|
347
|
+
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
348
|
+
const declarations = generateDeclaration({
|
|
349
|
+
componentName,
|
|
350
|
+
variantKey,
|
|
351
|
+
variantValue: variantOption,
|
|
352
|
+
componentStateKey,
|
|
353
|
+
componentStateValue: componentStateOption,
|
|
354
|
+
subComponentName: subComponentKey,
|
|
355
|
+
layer: layerKey,
|
|
356
|
+
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
357
|
+
propertyKey,
|
|
358
|
+
originalPropertyDefinition,
|
|
359
|
+
theme,
|
|
360
|
+
schema,
|
|
361
|
+
currentStyles: styles,
|
|
362
|
+
previewOptions
|
|
363
|
+
});
|
|
364
|
+
styles = deepMerge(styles, declarations);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
} else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) {
|
|
369
|
+
const layers = variantConfig.layers;
|
|
370
|
+
for (const layerKey in layers) {
|
|
371
|
+
const layer = layers[layerKey];
|
|
372
|
+
for (const propertyKey in layer.properties) {
|
|
373
|
+
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
374
|
+
const declarations = generateDeclaration({
|
|
375
|
+
componentName,
|
|
376
|
+
subComponentName: subComponentKey,
|
|
377
|
+
variantKey,
|
|
378
|
+
variantValue: variantOption,
|
|
379
|
+
layer: layerKey,
|
|
380
|
+
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
381
|
+
propertyKey,
|
|
382
|
+
originalPropertyDefinition,
|
|
383
|
+
theme,
|
|
384
|
+
schema,
|
|
385
|
+
currentStyles: styles,
|
|
386
|
+
previewOptions
|
|
387
|
+
});
|
|
388
|
+
styles = deepMerge(styles, declarations);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Post-process button/iconbutton styles to force box-shadow for borders.
|
|
396
|
+
* This runs AFTER all properties have been processed and merged.
|
|
397
|
+
*/
|
|
398
|
+
const toApply = COMPONENTS_WITH_SHADOW_BORDERS.find((c) => c.componentName === componentName);
|
|
399
|
+
if (toApply) {
|
|
400
|
+
for (const className in styles) if (className.includes(`-${toApply.layer}`.toLowerCase())) styles[className] = applyBoxShadowBorder(styles[className]);
|
|
401
|
+
}
|
|
402
|
+
return styles;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* @param config - Component configuration (Button, IconButton, etc.)
|
|
406
|
+
* @param schema - Production schema with defaults and variables
|
|
407
|
+
* @param theme - Tailwind theme function to resolve design tokens
|
|
408
|
+
* @param previewOptions - Options for generating preview mode class modifiers
|
|
409
|
+
* @returns CSS styles object with grouped selectors for default aliases
|
|
410
|
+
*/
|
|
411
|
+
const generateStyles = (config, schema, theme, previewOptions) => {
|
|
412
|
+
const styles = generateConfigStyles(config, schema, theme, previewOptions);
|
|
413
|
+
if (!config.variants && !config.subComponents) return styles;
|
|
414
|
+
const componentName = config.label.toLowerCase();
|
|
415
|
+
if (componentName !== "button" && componentName !== "iconbutton") return styles;
|
|
416
|
+
const replacementMap = /* @__PURE__ */ new Map();
|
|
417
|
+
/**
|
|
418
|
+
* Helper: Extract all layer keys from a variant configuration
|
|
419
|
+
* Handles both simple variants (with direct layers) and variants with component states
|
|
420
|
+
*/
|
|
421
|
+
const getLayerKeys = (variantConfig) => {
|
|
422
|
+
if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) return Object.keys(variantConfig.layers);
|
|
423
|
+
else if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
424
|
+
const layerKeysSet = /* @__PURE__ */ new Set();
|
|
425
|
+
for (const componentStateConfig of Object.values(variantConfig.componentStates)) Object.keys(componentStateConfig.layers).forEach((key) => layerKeysSet.add(key));
|
|
426
|
+
return Array.from(layerKeysSet);
|
|
427
|
+
}
|
|
428
|
+
return [];
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* Helper: Build replacement map for default variant values
|
|
432
|
+
* For each default variant + layer combination, creates an entry like:
|
|
433
|
+
* "uds-button-size-sm-root" → ".uds-button-size-sm-root, .uds-button-size-default-root"
|
|
434
|
+
*/
|
|
435
|
+
const buildReplacements = (variants, subComponentName) => {
|
|
436
|
+
for (const [variantType, variantConfig] of Object.entries(variants)) {
|
|
437
|
+
if (!require_variantConfigGuards.isVariantConfigWithProperties(variantConfig) && !require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) continue;
|
|
438
|
+
const layerKeys = getLayerKeys(variantConfig);
|
|
439
|
+
if (layerKeys.length) {
|
|
440
|
+
const defaultValue = schema.defaults?.[variantType];
|
|
441
|
+
if (defaultValue) for (const layerKey of layerKeys) {
|
|
442
|
+
const baseClass = generateClassName({
|
|
443
|
+
componentName,
|
|
444
|
+
variantKey: variantType,
|
|
445
|
+
variantValue: defaultValue,
|
|
446
|
+
layer: layerKey,
|
|
447
|
+
subComponentName
|
|
448
|
+
});
|
|
449
|
+
const defaultClass = require_generateDefaultClassName.generateDefaultClassName(componentName, variantType, layerKey, subComponentName);
|
|
450
|
+
replacementMap.set(baseClass, `.${baseClass}, .${defaultClass}`);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
if (config.variants) buildReplacements(config.variants);
|
|
456
|
+
if (config.subComponents) for (const [subComponentName, subComponentConfig] of Object.entries(config.subComponents)) buildReplacements(subComponentConfig.variants, subComponentName);
|
|
457
|
+
const finalStyles = {};
|
|
458
|
+
for (const [selector, declarations] of Object.entries(styles)) {
|
|
459
|
+
let defaultsSelector = selector;
|
|
460
|
+
let hasMatch = false;
|
|
461
|
+
for (const [defaultVariantClass, replacement] of replacementMap.entries()) if (selector.includes(defaultVariantClass)) {
|
|
462
|
+
hasMatch = true;
|
|
463
|
+
const defaultMatch = replacement.match(/,\s*\.([a-z0-9-]+)/);
|
|
464
|
+
if (defaultMatch) {
|
|
465
|
+
const defaultClass = defaultMatch[1];
|
|
466
|
+
defaultsSelector = defaultsSelector.replaceAll(defaultVariantClass, defaultClass);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if (!hasMatch) {
|
|
470
|
+
finalStyles[selector] = declarations;
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
finalStyles[`${selector}, ${defaultsSelector}`] = declarations;
|
|
474
|
+
}
|
|
475
|
+
return finalStyles;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
//#endregion
|
|
479
|
+
exports.generateStyles = generateStyles;
|