@yahoo/uds 3.166.0 → 3.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +92 -46
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +46 -0
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +46 -0
- package/dist/automated-config/dist/generated/generatedConfigs.js +92 -46
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +24 -1
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +24 -1
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/automated-config/dist/utils/index.cjs +32 -3
- package/dist/automated-config/dist/utils/index.d.cts +9 -1
- package/dist/automated-config/dist/utils/index.d.ts +9 -1
- package/dist/automated-config/dist/utils/index.js +33 -4
- package/dist/cli/commands/sync.cjs +36 -0
- package/dist/cli/commands/sync.js +36 -0
- package/dist/components/IconSlot.cjs +29 -0
- package/dist/components/IconSlot.js +29 -0
- package/dist/components/client/Avatar/AvatarIcon.cjs +3 -0
- package/dist/components/client/Avatar/AvatarIcon.js +3 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.cjs +28 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.d.cts +29 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.d.ts +30 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.js +27 -0
- package/dist/components/client/Avatar/index.cjs +3 -0
- package/dist/components/client/Avatar/index.d.cts +2 -1
- package/dist/components/client/Avatar/index.d.ts +2 -1
- package/dist/components/client/Avatar/index.js +2 -1
- package/dist/components/client/Badge.cjs +4 -1
- package/dist/components/client/Badge.js +4 -1
- package/dist/components/client/Chip/ChipBase.cjs +4 -0
- package/dist/components/client/Chip/ChipBase.js +4 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.cjs +28 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.d.cts +29 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.d.ts +30 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.js +27 -0
- package/dist/components/client/Chip/index.cjs +3 -0
- package/dist/components/client/Chip/index.d.cts +2 -1
- package/dist/components/client/Chip/index.d.ts +2 -1
- package/dist/components/client/Chip/index.js +2 -1
- package/dist/components/client/Input/Input.cjs +10 -2
- package/dist/components/client/Input/Input.js +10 -2
- package/dist/components/client/Input/InputHelpTextInternal.cjs +6 -1
- package/dist/components/client/Input/InputHelpTextInternal.js +6 -1
- package/dist/components/client/Input/UDSInputConfigProvider.cjs +33 -0
- package/dist/components/client/Input/UDSInputConfigProvider.d.cts +32 -0
- package/dist/components/client/Input/UDSInputConfigProvider.d.ts +33 -0
- package/dist/components/client/Input/UDSInputConfigProvider.js +32 -0
- package/dist/components/client/Input/index.cjs +3 -0
- package/dist/components/client/Input/index.d.cts +2 -1
- package/dist/components/client/Input/index.d.ts +2 -1
- package/dist/components/client/Input/index.js +2 -1
- package/dist/components/client/Menu/Menu.ItemBase.cjs +4 -2
- package/dist/components/client/Menu/Menu.ItemBase.js +4 -2
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.cjs +30 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.d.cts +29 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.d.ts +30 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.js +29 -0
- package/dist/components/client/Menu/index.cjs +3 -0
- package/dist/components/client/Menu/index.d.cts +2 -1
- package/dist/components/client/Menu/index.d.ts +2 -1
- package/dist/components/client/Menu/index.js +2 -1
- package/dist/components/client/PaddleNav/PaddleButton.cjs +3 -1
- package/dist/components/client/PaddleNav/PaddleButton.js +3 -1
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.cjs +30 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.d.cts +29 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.d.ts +30 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.js +29 -0
- package/dist/components/client/PaddleNav/index.cjs +3 -0
- package/dist/components/client/PaddleNav/index.d.cts +3 -1
- package/dist/components/client/PaddleNav/index.d.ts +3 -1
- package/dist/components/client/PaddleNav/index.js +2 -1
- package/dist/components/client/Pagination/PaginationNext.cjs +3 -1
- package/dist/components/client/Pagination/PaginationNext.js +3 -1
- package/dist/components/client/Pagination/PaginationPrev.cjs +3 -1
- package/dist/components/client/Pagination/PaginationPrev.js +3 -1
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.cjs +30 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.d.cts +29 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.d.ts +30 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.js +29 -0
- package/dist/components/client/Pagination/index.cjs +3 -0
- package/dist/components/client/Pagination/index.d.cts +2 -1
- package/dist/components/client/Pagination/index.d.ts +2 -1
- package/dist/components/client/Pagination/index.js +2 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
- package/dist/components/client/Select/SelectItem.cjs +4 -2
- package/dist/components/client/Select/SelectItem.js +4 -2
- package/dist/components/client/Select/UDSSelectItemConfigProvider.cjs +30 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.d.cts +29 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.d.ts +30 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.js +29 -0
- package/dist/components/client/Select/index.cjs +3 -0
- package/dist/components/client/Select/index.d.cts +3 -1
- package/dist/components/client/Select/index.d.ts +3 -1
- package/dist/components/client/Select/index.js +2 -1
- package/dist/components/client/Tabs/Tab.cjs +4 -2
- package/dist/components/client/Tabs/Tab.js +4 -2
- package/dist/components/client/Tabs/UDSTabConfigProvider.cjs +22 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.d.cts +27 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.d.ts +28 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.js +21 -0
- package/dist/components/client/Tabs/index.cjs +3 -0
- package/dist/components/client/Tabs/index.d.cts +3 -1
- package/dist/components/client/Tabs/index.d.ts +3 -1
- package/dist/components/client/Tabs/index.js +2 -1
- package/dist/components/client/UDSBadgeConfigProvider.cjs +28 -0
- package/dist/components/client/UDSBadgeConfigProvider.d.cts +29 -0
- package/dist/components/client/UDSBadgeConfigProvider.d.ts +30 -0
- package/dist/components/client/UDSBadgeConfigProvider.js +27 -0
- package/dist/components/client/index.cjs +27 -0
- package/dist/components/client/index.d.cts +10 -1
- package/dist/components/client/index.d.ts +10 -1
- package/dist/components/client/index.js +10 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +52 -16
- package/dist/components/client/providers/UDSConfigProvider.d.cts +9 -0
- package/dist/components/client/providers/UDSConfigProvider.d.ts +9 -0
- package/dist/components/client/providers/UDSConfigProvider.js +52 -16
- package/dist/components/client/providers/createUDSConfigProvider.cjs +41 -0
- package/dist/components/client/providers/createUDSConfigProvider.d.cts +38 -0
- package/dist/components/client/providers/createUDSConfigProvider.d.ts +39 -0
- package/dist/components/client/providers/createUDSConfigProvider.js +39 -0
- package/dist/components/index.cjs +27 -0
- package/dist/components/index.d.cts +10 -1
- package/dist/components/index.d.ts +10 -1
- package/dist/components/index.js +10 -1
- package/dist/css/dist/css/utils.cjs +58 -0
- package/dist/css/dist/css/utils.js +58 -0
- package/dist/css/dist/runtimeConfig/hookMetadata.cjs +320 -0
- package/dist/css/dist/runtimeConfig/hookMetadata.js +320 -0
- package/dist/css-tokens/dist/index.cjs +26 -0
- package/dist/css-tokens/dist/index.d.cts +25 -1
- package/dist/css-tokens/dist/index.d.ts +25 -1
- package/dist/css-tokens/dist/index.js +25 -1
- package/dist/index.cjs +47 -0
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +20 -2
- package/dist/runtime/avatarConfig.cjs +21 -0
- package/dist/runtime/avatarConfig.d.cts +13 -0
- package/dist/runtime/avatarConfig.d.ts +13 -0
- package/dist/runtime/avatarConfig.js +20 -0
- package/dist/runtime/badgeConfig.cjs +17 -0
- package/dist/runtime/badgeConfig.d.cts +13 -0
- package/dist/runtime/badgeConfig.d.ts +13 -0
- package/dist/runtime/badgeConfig.js +16 -0
- package/dist/runtime/chipConfig.cjs +12 -0
- package/dist/runtime/chipConfig.d.cts +13 -0
- package/dist/runtime/chipConfig.d.ts +13 -0
- package/dist/runtime/chipConfig.js +11 -0
- package/dist/runtime/index.cjs +18 -0
- package/dist/runtime/index.d.cts +10 -1
- package/dist/runtime/index.d.ts +10 -1
- package/dist/runtime/index.js +10 -1
- package/dist/runtime/inputConfig.cjs +14 -0
- package/dist/runtime/inputConfig.d.cts +15 -0
- package/dist/runtime/inputConfig.d.ts +15 -0
- package/dist/runtime/inputConfig.js +13 -0
- package/dist/runtime/menuItemConfig.cjs +13 -0
- package/dist/runtime/menuItemConfig.d.cts +15 -0
- package/dist/runtime/menuItemConfig.d.ts +15 -0
- package/dist/runtime/menuItemConfig.js +12 -0
- package/dist/runtime/paddleNavConfig.cjs +18 -0
- package/dist/runtime/paddleNavConfig.d.cts +13 -0
- package/dist/runtime/paddleNavConfig.d.ts +13 -0
- package/dist/runtime/paddleNavConfig.js +17 -0
- package/dist/runtime/paginationConfig.cjs +12 -0
- package/dist/runtime/paginationConfig.d.cts +13 -0
- package/dist/runtime/paginationConfig.d.ts +13 -0
- package/dist/runtime/paginationConfig.js +11 -0
- package/dist/runtime/selectItemConfig.cjs +13 -0
- package/dist/runtime/selectItemConfig.d.cts +15 -0
- package/dist/runtime/selectItemConfig.d.ts +15 -0
- package/dist/runtime/selectItemConfig.js +12 -0
- package/dist/runtime/tabConfig.cjs +12 -0
- package/dist/runtime/tabConfig.d.cts +14 -0
- package/dist/runtime/tabConfig.d.ts +14 -0
- package/dist/runtime/tabConfig.js +11 -0
- package/dist/runtime/udsConfig.cjs +18 -0
- package/dist/runtime/udsConfig.d.cts +18 -0
- package/dist/runtime/udsConfig.d.ts +18 -0
- package/dist/runtime/udsConfig.js +18 -0
- package/dist/styles/styler.d.cts +9 -9
- package/dist/styles/styler.d.ts +9 -9
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +92 -46
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +92 -46
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +32 -3
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +33 -4
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +26 -0
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +25 -1
- package/dist/tokens/consts/cssTokens.cjs +2 -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 +2 -0
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/uds/generated/componentData.cjs +2544 -2427
- package/dist/uds/generated/componentData.js +2544 -2427
- package/dist/uds/generated/tailwindPurge.cjs +40 -3
- package/dist/uds/generated/tailwindPurge.js +40 -3
- package/dist/uds/package.cjs +2 -2
- package/dist/uds/package.js +2 -2
- package/generated/componentData.json +2915 -2748
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +3 -3
|
@@ -263,6 +263,28 @@ function generateClassName({ componentName, subComponentName, variantKey, varian
|
|
|
263
263
|
function getLayerClassSelector(layer, className, componentName, propertyStateSelector) {
|
|
264
264
|
return componentName === "input" && (layer === "inputWrapperDynamic" || layer === "inputWrapper") && propertyStateSelector.includes("focus-within") ? `.${className}:not(.uds-ring):not(.uds-select-field-trigger)` : `.${className}`;
|
|
265
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Zero-specificity guards for `userOverridableProperties` layers: exclude
|
|
268
|
+
* elements the runtime marked with the matching attribute (set by `IconSlot`
|
|
269
|
+
* when a custom slot icon carries the explicit prop — non-`inherit` `color`
|
|
270
|
+
* or explicit `size`). `:where()` contributes (0,0,0), so the rule's
|
|
271
|
+
* class-count specificity tier — which the whole state cascade relies on — is
|
|
272
|
+
* unchanged; the rule simply stops matching, letting the consumer's own
|
|
273
|
+
* styling win.
|
|
274
|
+
*/
|
|
275
|
+
const USER_OVERRIDE_GUARDS = {
|
|
276
|
+
color: `:where(:not([${require_index.ICON_COLOR_OVERRIDE_ATTRIBUTE}]))`,
|
|
277
|
+
iconSize: `:where(:not([${require_index.ICON_SIZE_OVERRIDE_ATTRIBUTE}]))`
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Appends a {@link USER_OVERRIDE_GUARDS} guard to a layer class selector,
|
|
281
|
+
* inserting before a pseudo-element (e.g. `::placeholder`) if the layer
|
|
282
|
+
* carries one — a pseudo-class after a pseudo-element is invalid CSS.
|
|
283
|
+
*/
|
|
284
|
+
function appendUserOverrideGuard(layerClassSelector, guard) {
|
|
285
|
+
const pseudoElementIndex = layerClassSelector.indexOf("::");
|
|
286
|
+
return pseudoElementIndex === -1 ? `${layerClassSelector}${guard}` : `${layerClassSelector.slice(0, pseudoElementIndex)}${guard}${layerClassSelector.slice(pseudoElementIndex)}`;
|
|
287
|
+
}
|
|
266
288
|
const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, existingValue, originalPropertyDefinition) => {
|
|
267
289
|
const { value, type } = schemaStateValue;
|
|
268
290
|
const propertyConfig = require_properties.configurableProperties[propertyName];
|
|
@@ -324,9 +346,10 @@ function selectiveEmittedStates(stateMap, orderedStateKeys, emittableStates) {
|
|
|
324
346
|
}
|
|
325
347
|
return emitted;
|
|
326
348
|
}
|
|
327
|
-
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, declaredStates, layerUsesAtomicStates, theme, currentStyles, previewOptions, excludedPseudoStates = [], emit, fallbackStateMap, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
349
|
+
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, declaredStates, layerUsesAtomicStates, userOverridableProperties, theme, currentStyles, previewOptions, excludedPseudoStates = [], emit, fallbackStateMap, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
328
350
|
const shouldUseExhaustive = (emit ?? "exhaustive") === "exhaustive" && layerUsesAtomicStates;
|
|
329
351
|
const { cssProperties: configuredCssProperties, extendedProperties: configuredExtendedGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
352
|
+
const userOverrideGuard = userOverridableProperties?.includes(originalPropertyDefinition.name) ? USER_OVERRIDE_GUARDS[originalPropertyDefinition.name] : void 0;
|
|
330
353
|
const configuredExtendedProperties = (0, lodash_es.isFunction)(configuredExtendedGetter) ? configuredExtendedGetter({
|
|
331
354
|
componentName,
|
|
332
355
|
subComponentName,
|
|
@@ -423,7 +446,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
423
446
|
subComponentName
|
|
424
447
|
});
|
|
425
448
|
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
426
|
-
|
|
449
|
+
const guardedLayerClassSelector = userOverrideGuard ? appendUserOverrideGuard(layerClassSelector, userOverrideGuard) : layerClassSelector;
|
|
450
|
+
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} ${guardedLayerClassSelector}`;
|
|
427
451
|
} else {
|
|
428
452
|
className = generateClassName({
|
|
429
453
|
componentName,
|
|
@@ -434,7 +458,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
434
458
|
subComponentName
|
|
435
459
|
});
|
|
436
460
|
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
437
|
-
|
|
461
|
+
const guardedLayerClassSelector = userOverrideGuard ? appendUserOverrideGuard(layerClassSelector, userOverrideGuard) : layerClassSelector;
|
|
462
|
+
fullClassName = bumpRootSpecificity ? `.${rootVariantClassName}.${rootVariantClassName}${propertyStateSelector} ${guardedLayerClassSelector}` : `.${rootVariantClassName}${propertyStateSelector} ${guardedLayerClassSelector}`;
|
|
438
463
|
}
|
|
439
464
|
}
|
|
440
465
|
const { cssProperties, extendedProperties: extendedPropertiesGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
@@ -692,6 +717,7 @@ function emitSchemaOverrideStyles({ componentName, subComponentName, variantKey,
|
|
|
692
717
|
originalPropertyDefinition,
|
|
693
718
|
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(universalLayer, originalPropertyDefinition)),
|
|
694
719
|
layerUsesAtomicStates: (universalLayer.atomicStates?.length ?? 0) > 0,
|
|
720
|
+
userOverridableProperties: universalLayer.userOverridableProperties,
|
|
695
721
|
theme,
|
|
696
722
|
schema,
|
|
697
723
|
currentStyles: styles,
|
|
@@ -738,6 +764,7 @@ function emitUniversalLayers({ componentName, subComponentName, variantKey, vari
|
|
|
738
764
|
originalPropertyDefinition,
|
|
739
765
|
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
740
766
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
767
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
741
768
|
theme,
|
|
742
769
|
schema,
|
|
743
770
|
currentStyles: styles,
|
|
@@ -793,6 +820,7 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
793
820
|
originalPropertyDefinition,
|
|
794
821
|
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
795
822
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
823
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
796
824
|
theme,
|
|
797
825
|
schema,
|
|
798
826
|
currentStyles: styles,
|
|
@@ -873,6 +901,7 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
873
901
|
originalPropertyDefinition,
|
|
874
902
|
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
875
903
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
904
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
876
905
|
theme,
|
|
877
906
|
schema,
|
|
878
907
|
currentStyles: styles,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { AtomicState, INTERACTIVE_ATOMICS, InteractiveAtomic, MAX_MODIFIERS_PER_COMPOUND, MODIFIER_ATOMICS, ModifierAtomic, isAtomicState, isInteractiveAtomic, isModifierAtomic } from "../types/StateAxis.cjs";
|
|
3
3
|
import { ArbitraryFixtures, InferArbitraryType } from "../../../fixtures/dist/index.cjs";
|
|
4
4
|
import { ConfigurablePropertiesName, SelectedConfigurableProperty, configurableProperties } from "../properties.cjs";
|
|
5
|
-
import { ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, PossibleStatesWithRest, SubComponentConfig, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.cjs";
|
|
5
|
+
import { ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, PossibleStatesWithRest, SubComponentConfig, UserOverridableProperty, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.cjs";
|
|
6
6
|
import { VariableState } from "../types/ConfigSchema.cjs";
|
|
7
7
|
import { ComponentSchema, buildConfigSchema, findFixtureType, findFixtureTypeForValue } from "./buildConfigSchema.cjs";
|
|
8
8
|
import { canonicalizeStateKey, splitStateKey } from "./canonicalizeStateKey.cjs";
|
|
@@ -95,6 +95,7 @@ declare function generateDeclaration({
|
|
|
95
95
|
originalPropertyDefinition,
|
|
96
96
|
declaredStates,
|
|
97
97
|
layerUsesAtomicStates,
|
|
98
|
+
userOverridableProperties,
|
|
98
99
|
theme,
|
|
99
100
|
currentStyles,
|
|
100
101
|
previewOptions,
|
|
@@ -117,6 +118,7 @@ declare function generateDeclaration({
|
|
|
117
118
|
originalPropertyDefinition: SelectedConfigurableProperty<ConfigurablePropertiesName, any>;
|
|
118
119
|
declaredStates: ReadonlySet<string>;
|
|
119
120
|
layerUsesAtomicStates: boolean;
|
|
121
|
+
userOverridableProperties?: readonly string[];
|
|
120
122
|
theme: ThemeFn;
|
|
121
123
|
currentStyles: Readonly<Record<string, Record<string, string>>>;
|
|
122
124
|
previewOptions?: {
|
|
@@ -217,6 +219,12 @@ declare function createLayerConfig<T extends {
|
|
|
217
219
|
* full breakdown.
|
|
218
220
|
*/
|
|
219
221
|
atomicStates?: AtomicState[];
|
|
222
|
+
/**
|
|
223
|
+
* Marks the listed properties as consumer-overridable defaults: every
|
|
224
|
+
* emitted rule for them carries the matching zero-specificity
|
|
225
|
+
* `:where(:not([data-uds-icon-*]))` guard. See {@link LayerConfig}.
|
|
226
|
+
*/
|
|
227
|
+
userOverridableProperties?: readonly UserOverridableProperty[];
|
|
220
228
|
properties: Readonly<Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>>;
|
|
221
229
|
}>(config: T): T;
|
|
222
230
|
declare function createSubComponentConfig(config: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { AtomicState, INTERACTIVE_ATOMICS, InteractiveAtomic, MAX_MODIFIERS_PER_COMPOUND, MODIFIER_ATOMICS, ModifierAtomic, isAtomicState, isInteractiveAtomic, isModifierAtomic } from "../types/StateAxis.js";
|
|
3
3
|
import { ArbitraryFixtures, InferArbitraryType } from "../../../fixtures/dist/index.js";
|
|
4
4
|
import { ConfigurablePropertiesName, SelectedConfigurableProperty, configurableProperties } from "../properties.js";
|
|
5
|
-
import { ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, PossibleStatesWithRest, SubComponentConfig, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.js";
|
|
5
|
+
import { ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, PossibleStatesWithRest, SubComponentConfig, UserOverridableProperty, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.js";
|
|
6
6
|
import { VariableState } from "../types/ConfigSchema.js";
|
|
7
7
|
import { ComponentSchema, buildConfigSchema, findFixtureType, findFixtureTypeForValue } from "./buildConfigSchema.js";
|
|
8
8
|
import { canonicalizeStateKey, splitStateKey } from "./canonicalizeStateKey.js";
|
|
@@ -95,6 +95,7 @@ declare function generateDeclaration({
|
|
|
95
95
|
originalPropertyDefinition,
|
|
96
96
|
declaredStates,
|
|
97
97
|
layerUsesAtomicStates,
|
|
98
|
+
userOverridableProperties,
|
|
98
99
|
theme,
|
|
99
100
|
currentStyles,
|
|
100
101
|
previewOptions,
|
|
@@ -117,6 +118,7 @@ declare function generateDeclaration({
|
|
|
117
118
|
originalPropertyDefinition: SelectedConfigurableProperty<ConfigurablePropertiesName, any>;
|
|
118
119
|
declaredStates: ReadonlySet<string>;
|
|
119
120
|
layerUsesAtomicStates: boolean;
|
|
121
|
+
userOverridableProperties?: readonly string[];
|
|
120
122
|
theme: ThemeFn;
|
|
121
123
|
currentStyles: Readonly<Record<string, Record<string, string>>>;
|
|
122
124
|
previewOptions?: {
|
|
@@ -217,6 +219,12 @@ declare function createLayerConfig<T extends {
|
|
|
217
219
|
* full breakdown.
|
|
218
220
|
*/
|
|
219
221
|
atomicStates?: AtomicState[];
|
|
222
|
+
/**
|
|
223
|
+
* Marks the listed properties as consumer-overridable defaults: every
|
|
224
|
+
* emitted rule for them carries the matching zero-specificity
|
|
225
|
+
* `:where(:not([data-uds-icon-*]))` guard. See {@link LayerConfig}.
|
|
226
|
+
*/
|
|
227
|
+
userOverridableProperties?: readonly UserOverridableProperty[];
|
|
220
228
|
properties: Readonly<Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>>;
|
|
221
229
|
}>(config: T): T;
|
|
222
230
|
declare function createSubComponentConfig(config: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { BUTTON_GAP_VAR, BUTTON_SCALE_EFFECT_HOVER, BUTTON_SCALE_EFFECT_PRESSED, BUTTON_SCALE_EFFECT_REST } from "../../../css-tokens/dist/index.js";
|
|
2
|
+
import { BUTTON_GAP_VAR, BUTTON_SCALE_EFFECT_HOVER, BUTTON_SCALE_EFFECT_PRESSED, BUTTON_SCALE_EFFECT_REST, ICON_COLOR_OVERRIDE_ATTRIBUTE, ICON_SIZE_OVERRIDE_ATTRIBUTE } from "../../../css-tokens/dist/index.js";
|
|
3
3
|
import { mapTextVariantFixtureToValue } from "../mapTextVariantFixtureToValue.js";
|
|
4
4
|
import { configurableProperties } from "../properties.js";
|
|
5
5
|
import { INTERACTIVE_ATOMICS, MODIFIER_ATOMICS, comparePriority } from "../types/StateAxis.js";
|
|
@@ -262,6 +262,28 @@ function generateClassName({ componentName, subComponentName, variantKey, varian
|
|
|
262
262
|
function getLayerClassSelector(layer, className, componentName, propertyStateSelector) {
|
|
263
263
|
return componentName === "input" && (layer === "inputWrapperDynamic" || layer === "inputWrapper") && propertyStateSelector.includes("focus-within") ? `.${className}:not(.uds-ring):not(.uds-select-field-trigger)` : `.${className}`;
|
|
264
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Zero-specificity guards for `userOverridableProperties` layers: exclude
|
|
267
|
+
* elements the runtime marked with the matching attribute (set by `IconSlot`
|
|
268
|
+
* when a custom slot icon carries the explicit prop — non-`inherit` `color`
|
|
269
|
+
* or explicit `size`). `:where()` contributes (0,0,0), so the rule's
|
|
270
|
+
* class-count specificity tier — which the whole state cascade relies on — is
|
|
271
|
+
* unchanged; the rule simply stops matching, letting the consumer's own
|
|
272
|
+
* styling win.
|
|
273
|
+
*/
|
|
274
|
+
const USER_OVERRIDE_GUARDS = {
|
|
275
|
+
color: `:where(:not([${ICON_COLOR_OVERRIDE_ATTRIBUTE}]))`,
|
|
276
|
+
iconSize: `:where(:not([${ICON_SIZE_OVERRIDE_ATTRIBUTE}]))`
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Appends a {@link USER_OVERRIDE_GUARDS} guard to a layer class selector,
|
|
280
|
+
* inserting before a pseudo-element (e.g. `::placeholder`) if the layer
|
|
281
|
+
* carries one — a pseudo-class after a pseudo-element is invalid CSS.
|
|
282
|
+
*/
|
|
283
|
+
function appendUserOverrideGuard(layerClassSelector, guard) {
|
|
284
|
+
const pseudoElementIndex = layerClassSelector.indexOf("::");
|
|
285
|
+
return pseudoElementIndex === -1 ? `${layerClassSelector}${guard}` : `${layerClassSelector.slice(0, pseudoElementIndex)}${guard}${layerClassSelector.slice(pseudoElementIndex)}`;
|
|
286
|
+
}
|
|
265
287
|
const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, existingValue, originalPropertyDefinition) => {
|
|
266
288
|
const { value, type } = schemaStateValue;
|
|
267
289
|
const propertyConfig = configurableProperties[propertyName];
|
|
@@ -323,9 +345,10 @@ function selectiveEmittedStates(stateMap, orderedStateKeys, emittableStates) {
|
|
|
323
345
|
}
|
|
324
346
|
return emitted;
|
|
325
347
|
}
|
|
326
|
-
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, declaredStates, layerUsesAtomicStates, theme, currentStyles, previewOptions, excludedPseudoStates = [], emit, fallbackStateMap, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
348
|
+
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, declaredStates, layerUsesAtomicStates, userOverridableProperties, theme, currentStyles, previewOptions, excludedPseudoStates = [], emit, fallbackStateMap, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
327
349
|
const shouldUseExhaustive = (emit ?? "exhaustive") === "exhaustive" && layerUsesAtomicStates;
|
|
328
350
|
const { cssProperties: configuredCssProperties, extendedProperties: configuredExtendedGetter } = configurableProperties[originalPropertyDefinition.name];
|
|
351
|
+
const userOverrideGuard = userOverridableProperties?.includes(originalPropertyDefinition.name) ? USER_OVERRIDE_GUARDS[originalPropertyDefinition.name] : void 0;
|
|
329
352
|
const configuredExtendedProperties = isFunction(configuredExtendedGetter) ? configuredExtendedGetter({
|
|
330
353
|
componentName,
|
|
331
354
|
subComponentName,
|
|
@@ -422,7 +445,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
422
445
|
subComponentName
|
|
423
446
|
});
|
|
424
447
|
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
425
|
-
|
|
448
|
+
const guardedLayerClassSelector = userOverrideGuard ? appendUserOverrideGuard(layerClassSelector, userOverrideGuard) : layerClassSelector;
|
|
449
|
+
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} ${guardedLayerClassSelector}`;
|
|
426
450
|
} else {
|
|
427
451
|
className = generateClassName({
|
|
428
452
|
componentName,
|
|
@@ -433,7 +457,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
433
457
|
subComponentName
|
|
434
458
|
});
|
|
435
459
|
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
436
|
-
|
|
460
|
+
const guardedLayerClassSelector = userOverrideGuard ? appendUserOverrideGuard(layerClassSelector, userOverrideGuard) : layerClassSelector;
|
|
461
|
+
fullClassName = bumpRootSpecificity ? `.${rootVariantClassName}.${rootVariantClassName}${propertyStateSelector} ${guardedLayerClassSelector}` : `.${rootVariantClassName}${propertyStateSelector} ${guardedLayerClassSelector}`;
|
|
437
462
|
}
|
|
438
463
|
}
|
|
439
464
|
const { cssProperties, extendedProperties: extendedPropertiesGetter } = configurableProperties[originalPropertyDefinition.name];
|
|
@@ -691,6 +716,7 @@ function emitSchemaOverrideStyles({ componentName, subComponentName, variantKey,
|
|
|
691
716
|
originalPropertyDefinition,
|
|
692
717
|
declaredStates: new Set(resolvePropertyStates(universalLayer, originalPropertyDefinition)),
|
|
693
718
|
layerUsesAtomicStates: (universalLayer.atomicStates?.length ?? 0) > 0,
|
|
719
|
+
userOverridableProperties: universalLayer.userOverridableProperties,
|
|
694
720
|
theme,
|
|
695
721
|
schema,
|
|
696
722
|
currentStyles: styles,
|
|
@@ -737,6 +763,7 @@ function emitUniversalLayers({ componentName, subComponentName, variantKey, vari
|
|
|
737
763
|
originalPropertyDefinition,
|
|
738
764
|
declaredStates: new Set(resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
739
765
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
766
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
740
767
|
theme,
|
|
741
768
|
schema,
|
|
742
769
|
currentStyles: styles,
|
|
@@ -792,6 +819,7 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
792
819
|
originalPropertyDefinition,
|
|
793
820
|
declaredStates: new Set(resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
794
821
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
822
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
795
823
|
theme,
|
|
796
824
|
schema,
|
|
797
825
|
currentStyles: styles,
|
|
@@ -872,6 +900,7 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
872
900
|
originalPropertyDefinition,
|
|
873
901
|
declaredStates: new Set(resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
874
902
|
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
903
|
+
userOverridableProperties: layer.userOverridableProperties,
|
|
875
904
|
theme,
|
|
876
905
|
schema,
|
|
877
906
|
currentStyles: styles,
|
|
@@ -3,12 +3,21 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_defaultTokensConfig = require("../../defaultTokensConfig.cjs");
|
|
5
5
|
const require_serializeToJS = require("../../utils/dist/serializeToJS.cjs");
|
|
6
|
+
const require_runtime_avatarConfig = require("../../runtime/avatarConfig.cjs");
|
|
7
|
+
const require_runtime_badgeConfig = require("../../runtime/badgeConfig.cjs");
|
|
6
8
|
const require_runtime_bottomSheetConfig = require("../../runtime/bottomSheetConfig.cjs");
|
|
7
9
|
const require_runtime_breakpointsConfig = require("../../runtime/breakpointsConfig.cjs");
|
|
8
10
|
const require_runtime_buttonConfig = require("../../runtime/buttonConfig.cjs");
|
|
11
|
+
const require_runtime_chipConfig = require("../../runtime/chipConfig.cjs");
|
|
9
12
|
const require_runtime_iconButtonConfig = require("../../runtime/iconButtonConfig.cjs");
|
|
13
|
+
const require_runtime_inputConfig = require("../../runtime/inputConfig.cjs");
|
|
14
|
+
const require_runtime_menuItemConfig = require("../../runtime/menuItemConfig.cjs");
|
|
10
15
|
const require_runtime_modalConfig = require("../../runtime/modalConfig.cjs");
|
|
16
|
+
const require_runtime_paddleNavConfig = require("../../runtime/paddleNavConfig.cjs");
|
|
17
|
+
const require_runtime_paginationConfig = require("../../runtime/paginationConfig.cjs");
|
|
11
18
|
const require_runtime_popoverConfig = require("../../runtime/popoverConfig.cjs");
|
|
19
|
+
const require_runtime_selectItemConfig = require("../../runtime/selectItemConfig.cjs");
|
|
20
|
+
const require_runtime_tabConfig = require("../../runtime/tabConfig.cjs");
|
|
12
21
|
const require_runtime_toastConfig = require("../../runtime/toastConfig.cjs");
|
|
13
22
|
const require_runtime_tooltipConfig = require("../../runtime/tooltipConfig.cjs");
|
|
14
23
|
const require_config = require("../dist/utils/rules/config.cjs");
|
|
@@ -86,12 +95,21 @@ const syncCommand = {
|
|
|
86
95
|
const exportsTS = [`export const config: UniversalTokensConfig = ${serializedConfig} as UniversalTokensConfig;`];
|
|
87
96
|
const exportsJS = [`export const config = ${serializedConfig};`];
|
|
88
97
|
const runtimeConfigs = {
|
|
98
|
+
avatar: [require_runtime_avatarConfig.configToAvatarConfigContext(config), "UDSAvatarConfigContextType"],
|
|
99
|
+
badge: [require_runtime_badgeConfig.configToBadgeConfigContext(config), "UDSBadgeConfigContextType"],
|
|
89
100
|
bottomSheet: [require_runtime_bottomSheetConfig.configToBottomSheetConfigContext(config), "UDSBottomSheetConfigContextType"],
|
|
90
101
|
breakpoints: [require_runtime_breakpointsConfig.configToBreakpointsConfigContext(config), "UDSBreakpointsConfigContextType"],
|
|
91
102
|
button: [require_runtime_buttonConfig.configToButtonConfigContext(config), "UDSButtonConfigContextType"],
|
|
103
|
+
chip: [require_runtime_chipConfig.configToChipConfigContext(config), "UDSChipConfigContextType"],
|
|
92
104
|
iconButton: [require_runtime_iconButtonConfig.configToIconButtonConfigContext(config), "UDSIconButtonConfigContextType"],
|
|
105
|
+
input: [require_runtime_inputConfig.configToInputConfigContext(config), "UDSInputConfigContextType"],
|
|
106
|
+
menuItem: [require_runtime_menuItemConfig.configToMenuItemConfigContext(config), "UDSMenuItemConfigContextType"],
|
|
93
107
|
modal: [require_runtime_modalConfig.configToModalConfigContext(config), "UDSModalConfigContextType"],
|
|
108
|
+
paddleNav: [require_runtime_paddleNavConfig.configToPaddleNavConfigContext(config), "UDSPaddleNavConfigContextType"],
|
|
109
|
+
pagination: [require_runtime_paginationConfig.configToPaginationConfigContext(config), "UDSPaginationConfigContextType"],
|
|
94
110
|
popover: [require_runtime_popoverConfig.configToPopoverConfigContext(config), "UDSPopoverConfigContextType"],
|
|
111
|
+
selectItem: [require_runtime_selectItemConfig.configToSelectItemConfigContext(config), "UDSSelectItemConfigContextType"],
|
|
112
|
+
tab: [require_runtime_tabConfig.configToTabConfigContext(config), "UDSTabConfigContextType"],
|
|
95
113
|
toast: [require_runtime_toastConfig.configToToastConfigContext(config), "UDSToastConfigContextType"],
|
|
96
114
|
tooltip: [require_runtime_tooltipConfig.configToTooltipConfigContext(config), "UDSTooltipConfigContextType"]
|
|
97
115
|
};
|
|
@@ -105,22 +123,40 @@ const syncCommand = {
|
|
|
105
123
|
runtimeTypeImports.push("UDSConfigContextType");
|
|
106
124
|
importsTS.push(`import type { ${runtimeTypeImports.sort().join(", ")} } from '@yahoo/uds/runtime';`);
|
|
107
125
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
126
|
+
avatar: avatarRuntimeConfig,
|
|
127
|
+
badge: badgeRuntimeConfig,
|
|
108
128
|
bottomSheet: bottomSheetRuntimeConfig,
|
|
109
129
|
breakpoints: breakpointsRuntimeConfig,
|
|
110
130
|
button: buttonRuntimeConfig,
|
|
131
|
+
chip: chipRuntimeConfig,
|
|
111
132
|
iconButton: iconButtonRuntimeConfig,
|
|
133
|
+
input: inputRuntimeConfig,
|
|
134
|
+
menuItem: menuItemRuntimeConfig,
|
|
112
135
|
modal: modalRuntimeConfig,
|
|
136
|
+
paddleNav: paddleNavRuntimeConfig,
|
|
137
|
+
pagination: paginationRuntimeConfig,
|
|
113
138
|
popover: popoverRuntimeConfig,
|
|
139
|
+
selectItem: selectItemRuntimeConfig,
|
|
140
|
+
tab: tabRuntimeConfig,
|
|
114
141
|
toast: toastRuntimeConfig,
|
|
115
142
|
tooltip: tooltipRuntimeConfig,
|
|
116
143
|
};`);
|
|
117
144
|
exportsJS.push(`export const runtimeConfig = {
|
|
145
|
+
avatar: avatarRuntimeConfig,
|
|
146
|
+
badge: badgeRuntimeConfig,
|
|
118
147
|
bottomSheet: bottomSheetRuntimeConfig,
|
|
119
148
|
breakpoints: breakpointsRuntimeConfig,
|
|
120
149
|
button: buttonRuntimeConfig,
|
|
150
|
+
chip: chipRuntimeConfig,
|
|
121
151
|
iconButton: iconButtonRuntimeConfig,
|
|
152
|
+
input: inputRuntimeConfig,
|
|
153
|
+
menuItem: menuItemRuntimeConfig,
|
|
122
154
|
modal: modalRuntimeConfig,
|
|
155
|
+
paddleNav: paddleNavRuntimeConfig,
|
|
156
|
+
pagination: paginationRuntimeConfig,
|
|
123
157
|
popover: popoverRuntimeConfig,
|
|
158
|
+
selectItem: selectItemRuntimeConfig,
|
|
159
|
+
tab: tabRuntimeConfig,
|
|
124
160
|
toast: toastRuntimeConfig,
|
|
125
161
|
tooltip: tooltipRuntimeConfig,
|
|
126
162
|
};`);
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { defaultTokensConfig } from "../../defaultTokensConfig.js";
|
|
3
3
|
import { serializeToJS } from "../../utils/dist/serializeToJS.js";
|
|
4
|
+
import { configToAvatarConfigContext } from "../../runtime/avatarConfig.js";
|
|
5
|
+
import { configToBadgeConfigContext } from "../../runtime/badgeConfig.js";
|
|
4
6
|
import { configToBottomSheetConfigContext } from "../../runtime/bottomSheetConfig.js";
|
|
5
7
|
import { configToBreakpointsConfigContext } from "../../runtime/breakpointsConfig.js";
|
|
6
8
|
import { configToButtonConfigContext } from "../../runtime/buttonConfig.js";
|
|
9
|
+
import { configToChipConfigContext } from "../../runtime/chipConfig.js";
|
|
7
10
|
import { configToIconButtonConfigContext } from "../../runtime/iconButtonConfig.js";
|
|
11
|
+
import { configToInputConfigContext } from "../../runtime/inputConfig.js";
|
|
12
|
+
import { configToMenuItemConfigContext } from "../../runtime/menuItemConfig.js";
|
|
8
13
|
import { configToModalConfigContext } from "../../runtime/modalConfig.js";
|
|
14
|
+
import { configToPaddleNavConfigContext } from "../../runtime/paddleNavConfig.js";
|
|
15
|
+
import { configToPaginationConfigContext } from "../../runtime/paginationConfig.js";
|
|
9
16
|
import { configToPopoverConfigContext } from "../../runtime/popoverConfig.js";
|
|
17
|
+
import { configToSelectItemConfigContext } from "../../runtime/selectItemConfig.js";
|
|
18
|
+
import { configToTabConfigContext } from "../../runtime/tabConfig.js";
|
|
10
19
|
import { configToToastConfigContext } from "../../runtime/toastConfig.js";
|
|
11
20
|
import { configToTooltipConfigContext } from "../../runtime/tooltipConfig.js";
|
|
12
21
|
import { getEditorsWithStaleRules } from "../dist/utils/rules/config.js";
|
|
@@ -82,12 +91,21 @@ const syncCommand = {
|
|
|
82
91
|
const exportsTS = [`export const config: UniversalTokensConfig = ${serializedConfig} as UniversalTokensConfig;`];
|
|
83
92
|
const exportsJS = [`export const config = ${serializedConfig};`];
|
|
84
93
|
const runtimeConfigs = {
|
|
94
|
+
avatar: [configToAvatarConfigContext(config), "UDSAvatarConfigContextType"],
|
|
95
|
+
badge: [configToBadgeConfigContext(config), "UDSBadgeConfigContextType"],
|
|
85
96
|
bottomSheet: [configToBottomSheetConfigContext(config), "UDSBottomSheetConfigContextType"],
|
|
86
97
|
breakpoints: [configToBreakpointsConfigContext(config), "UDSBreakpointsConfigContextType"],
|
|
87
98
|
button: [configToButtonConfigContext(config), "UDSButtonConfigContextType"],
|
|
99
|
+
chip: [configToChipConfigContext(config), "UDSChipConfigContextType"],
|
|
88
100
|
iconButton: [configToIconButtonConfigContext(config), "UDSIconButtonConfigContextType"],
|
|
101
|
+
input: [configToInputConfigContext(config), "UDSInputConfigContextType"],
|
|
102
|
+
menuItem: [configToMenuItemConfigContext(config), "UDSMenuItemConfigContextType"],
|
|
89
103
|
modal: [configToModalConfigContext(config), "UDSModalConfigContextType"],
|
|
104
|
+
paddleNav: [configToPaddleNavConfigContext(config), "UDSPaddleNavConfigContextType"],
|
|
105
|
+
pagination: [configToPaginationConfigContext(config), "UDSPaginationConfigContextType"],
|
|
90
106
|
popover: [configToPopoverConfigContext(config), "UDSPopoverConfigContextType"],
|
|
107
|
+
selectItem: [configToSelectItemConfigContext(config), "UDSSelectItemConfigContextType"],
|
|
108
|
+
tab: [configToTabConfigContext(config), "UDSTabConfigContextType"],
|
|
91
109
|
toast: [configToToastConfigContext(config), "UDSToastConfigContextType"],
|
|
92
110
|
tooltip: [configToTooltipConfigContext(config), "UDSTooltipConfigContextType"]
|
|
93
111
|
};
|
|
@@ -101,22 +119,40 @@ const syncCommand = {
|
|
|
101
119
|
runtimeTypeImports.push("UDSConfigContextType");
|
|
102
120
|
importsTS.push(`import type { ${runtimeTypeImports.sort().join(", ")} } from '@yahoo/uds/runtime';`);
|
|
103
121
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
122
|
+
avatar: avatarRuntimeConfig,
|
|
123
|
+
badge: badgeRuntimeConfig,
|
|
104
124
|
bottomSheet: bottomSheetRuntimeConfig,
|
|
105
125
|
breakpoints: breakpointsRuntimeConfig,
|
|
106
126
|
button: buttonRuntimeConfig,
|
|
127
|
+
chip: chipRuntimeConfig,
|
|
107
128
|
iconButton: iconButtonRuntimeConfig,
|
|
129
|
+
input: inputRuntimeConfig,
|
|
130
|
+
menuItem: menuItemRuntimeConfig,
|
|
108
131
|
modal: modalRuntimeConfig,
|
|
132
|
+
paddleNav: paddleNavRuntimeConfig,
|
|
133
|
+
pagination: paginationRuntimeConfig,
|
|
109
134
|
popover: popoverRuntimeConfig,
|
|
135
|
+
selectItem: selectItemRuntimeConfig,
|
|
136
|
+
tab: tabRuntimeConfig,
|
|
110
137
|
toast: toastRuntimeConfig,
|
|
111
138
|
tooltip: tooltipRuntimeConfig,
|
|
112
139
|
};`);
|
|
113
140
|
exportsJS.push(`export const runtimeConfig = {
|
|
141
|
+
avatar: avatarRuntimeConfig,
|
|
142
|
+
badge: badgeRuntimeConfig,
|
|
114
143
|
bottomSheet: bottomSheetRuntimeConfig,
|
|
115
144
|
breakpoints: breakpointsRuntimeConfig,
|
|
116
145
|
button: buttonRuntimeConfig,
|
|
146
|
+
chip: chipRuntimeConfig,
|
|
117
147
|
iconButton: iconButtonRuntimeConfig,
|
|
148
|
+
input: inputRuntimeConfig,
|
|
149
|
+
menuItem: menuItemRuntimeConfig,
|
|
118
150
|
modal: modalRuntimeConfig,
|
|
151
|
+
paddleNav: paddleNavRuntimeConfig,
|
|
152
|
+
pagination: paginationRuntimeConfig,
|
|
119
153
|
popover: popoverRuntimeConfig,
|
|
154
|
+
selectItem: selectItemRuntimeConfig,
|
|
155
|
+
tab: tabRuntimeConfig,
|
|
120
156
|
toast: toastRuntimeConfig,
|
|
121
157
|
tooltip: tooltipRuntimeConfig,
|
|
122
158
|
};`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_index = require("../css-tokens/dist/index.cjs");
|
|
4
5
|
const require_styles_styler = require("../styles/styler.cjs");
|
|
5
6
|
const require_components_Icon = require("./Icon.cjs");
|
|
6
7
|
let react = require("react");
|
|
@@ -10,6 +11,32 @@ let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
|
10
11
|
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
11
12
|
//#region src/components/IconSlot.tsx
|
|
12
13
|
/**
|
|
14
|
+
* When the consumer's own element carries an explicit non-`inherit` color or
|
|
15
|
+
* an explicit size, mark it with {@link ICON_COLOR_OVERRIDE_ATTRIBUTE} /
|
|
16
|
+
* {@link ICON_SIZE_OVERRIDE_ATTRIBUTE}. Config-generated icon rules for
|
|
17
|
+
* layers that list the property in `userOverridableProperties` exclude
|
|
18
|
+
* marked elements via a zero-specificity `:where(:not([...]))` guard, so the
|
|
19
|
+
* explicit prop wins over the configured value (across ALL configured
|
|
20
|
+
* states) without `!important`. For size, disabling the configured
|
|
21
|
+
* width/height box lets the svg's own attributes (matching the explicit
|
|
22
|
+
* size's artwork and viewBox) govern.
|
|
23
|
+
*
|
|
24
|
+
* Detection intentionally reads the element's OWN props (never `iconProps`):
|
|
25
|
+
* components pass their own defaults through `iconProps` (e.g. Button's
|
|
26
|
+
* `color="current"`, or configured icon sizes routed from runtime config),
|
|
27
|
+
* so only element props signal consumer intent.
|
|
28
|
+
*/
|
|
29
|
+
function getUserOverrideAttributes(elProps) {
|
|
30
|
+
let attributes;
|
|
31
|
+
const color = elProps?.color;
|
|
32
|
+
if (typeof color === "string" && color !== "inherit") attributes = { [require_index.ICON_COLOR_OVERRIDE_ATTRIBUTE]: "" };
|
|
33
|
+
if (typeof elProps?.size === "string") attributes = {
|
|
34
|
+
...attributes,
|
|
35
|
+
[require_index.ICON_SIZE_OVERRIDE_ATTRIBUTE]: ""
|
|
36
|
+
};
|
|
37
|
+
return attributes;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
13
40
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
14
41
|
*
|
|
15
42
|
* Useful in components that use icons and have a startIcon and endIcon. It allows
|
|
@@ -41,6 +68,7 @@ const IconSlot = (0, react.memo)(function IconSlot({ icon, iconProps, className:
|
|
|
41
68
|
const elProps = iconEl?.props;
|
|
42
69
|
return (0, react.isValidElement)(iconEl) && (0, react.cloneElement)(iconEl, {
|
|
43
70
|
...rest,
|
|
71
|
+
...getUserOverrideAttributes(elProps),
|
|
44
72
|
className: require_styles_styler.cx(mergedClassName, elProps?.className)
|
|
45
73
|
});
|
|
46
74
|
}
|
|
@@ -49,6 +77,7 @@ const IconSlot = (0, react.memo)(function IconSlot({ icon, iconProps, className:
|
|
|
49
77
|
...props,
|
|
50
78
|
...elProps,
|
|
51
79
|
...rest,
|
|
80
|
+
...getUserOverrideAttributes(elProps),
|
|
52
81
|
className: require_styles_styler.cx(mergedClassName, elProps.className)
|
|
53
82
|
});
|
|
54
83
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { ICON_COLOR_OVERRIDE_ATTRIBUTE, ICON_SIZE_OVERRIDE_ATTRIBUTE } from "../css-tokens/dist/index.js";
|
|
2
3
|
import { cx } from "../styles/styler.js";
|
|
3
4
|
import { Icon } from "./Icon.js";
|
|
4
5
|
import { cloneElement, isValidElement, memo } from "react";
|
|
@@ -6,6 +7,32 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
7
|
import { isFunction } from "lodash-es";
|
|
7
8
|
//#region src/components/IconSlot.tsx
|
|
8
9
|
/**
|
|
10
|
+
* When the consumer's own element carries an explicit non-`inherit` color or
|
|
11
|
+
* an explicit size, mark it with {@link ICON_COLOR_OVERRIDE_ATTRIBUTE} /
|
|
12
|
+
* {@link ICON_SIZE_OVERRIDE_ATTRIBUTE}. Config-generated icon rules for
|
|
13
|
+
* layers that list the property in `userOverridableProperties` exclude
|
|
14
|
+
* marked elements via a zero-specificity `:where(:not([...]))` guard, so the
|
|
15
|
+
* explicit prop wins over the configured value (across ALL configured
|
|
16
|
+
* states) without `!important`. For size, disabling the configured
|
|
17
|
+
* width/height box lets the svg's own attributes (matching the explicit
|
|
18
|
+
* size's artwork and viewBox) govern.
|
|
19
|
+
*
|
|
20
|
+
* Detection intentionally reads the element's OWN props (never `iconProps`):
|
|
21
|
+
* components pass their own defaults through `iconProps` (e.g. Button's
|
|
22
|
+
* `color="current"`, or configured icon sizes routed from runtime config),
|
|
23
|
+
* so only element props signal consumer intent.
|
|
24
|
+
*/
|
|
25
|
+
function getUserOverrideAttributes(elProps) {
|
|
26
|
+
let attributes;
|
|
27
|
+
const color = elProps?.color;
|
|
28
|
+
if (typeof color === "string" && color !== "inherit") attributes = { [ICON_COLOR_OVERRIDE_ATTRIBUTE]: "" };
|
|
29
|
+
if (typeof elProps?.size === "string") attributes = {
|
|
30
|
+
...attributes,
|
|
31
|
+
[ICON_SIZE_OVERRIDE_ATTRIBUTE]: ""
|
|
32
|
+
};
|
|
33
|
+
return attributes;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
9
36
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
10
37
|
*
|
|
11
38
|
* Useful in components that use icons and have a startIcon and endIcon. It allows
|
|
@@ -37,6 +64,7 @@ const IconSlot = memo(function IconSlot({ icon, iconProps, className: slotClassN
|
|
|
37
64
|
const elProps = iconEl?.props;
|
|
38
65
|
return isValidElement(iconEl) && cloneElement(iconEl, {
|
|
39
66
|
...rest,
|
|
67
|
+
...getUserOverrideAttributes(elProps),
|
|
40
68
|
className: cx(mergedClassName, elProps?.className)
|
|
41
69
|
});
|
|
42
70
|
}
|
|
@@ -45,6 +73,7 @@ const IconSlot = memo(function IconSlot({ icon, iconProps, className: slotClassN
|
|
|
45
73
|
...props,
|
|
46
74
|
...elProps,
|
|
47
75
|
...rest,
|
|
76
|
+
...getUserOverrideAttributes(elProps),
|
|
48
77
|
className: cx(mergedClassName, elProps.className)
|
|
49
78
|
});
|
|
50
79
|
});
|
|
@@ -5,6 +5,7 @@ require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
5
5
|
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
6
|
const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
7
7
|
const require_components_Box = require("../../Box.cjs");
|
|
8
|
+
const require_components_client_Avatar_UDSAvatarConfigProvider = require("./UDSAvatarConfigProvider.cjs");
|
|
8
9
|
const require_components_client_Avatar_utils = require("./utils.cjs");
|
|
9
10
|
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
10
11
|
let react = require("react");
|
|
@@ -24,6 +25,7 @@ const mapVariantToIcon = {
|
|
|
24
25
|
* @returns The AvatarIcon element.
|
|
25
26
|
*/
|
|
26
27
|
const AvatarIcon = (0, react.forwardRef)(({ size = "md", variant = require_components_client_Avatar_utils.DEFAULT_AVATAR_VARIANT, customSize, icon, slotProps, className, ...props }, ref) => {
|
|
28
|
+
const { iconSize } = require_components_client_Avatar_UDSAvatarConfigProvider.useAvatarConfig(size);
|
|
27
29
|
const classNames = (0, react.useMemo)(() => ({
|
|
28
30
|
root: require_components_client_Avatar_utils.buildAvatarRootClasses(size, {
|
|
29
31
|
avatarIconVariantRoot: variant,
|
|
@@ -52,6 +54,7 @@ const AvatarIcon = (0, react.forwardRef)(({ size = "md", variant = require_compo
|
|
|
52
54
|
iconProps: {
|
|
53
55
|
variant: "fill",
|
|
54
56
|
color: "current",
|
|
57
|
+
size: iconSize,
|
|
55
58
|
...slotProps?.icon
|
|
56
59
|
},
|
|
57
60
|
className: classNames.icon
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
4
|
import { IconSlot } from "../../IconSlot.js";
|
|
5
5
|
import { Box } from "../../Box.js";
|
|
6
|
+
import { useAvatarConfig } from "./UDSAvatarConfigProvider.js";
|
|
6
7
|
import { DEFAULT_AVATAR_VARIANT, buildAvatarRootClasses, buildInlineSizeStyles } from "./utils.js";
|
|
7
8
|
import { Building, Person } from "@yahoo/uds-icons";
|
|
8
9
|
import { forwardRef, useMemo } from "react";
|
|
@@ -22,6 +23,7 @@ const mapVariantToIcon = {
|
|
|
22
23
|
* @returns The AvatarIcon element.
|
|
23
24
|
*/
|
|
24
25
|
const AvatarIcon = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT, customSize, icon, slotProps, className, ...props }, ref) => {
|
|
26
|
+
const { iconSize } = useAvatarConfig(size);
|
|
25
27
|
const classNames = useMemo(() => ({
|
|
26
28
|
root: buildAvatarRootClasses(size, {
|
|
27
29
|
avatarIconVariantRoot: variant,
|
|
@@ -50,6 +52,7 @@ const AvatarIcon = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT,
|
|
|
50
52
|
iconProps: {
|
|
51
53
|
variant: "fill",
|
|
52
54
|
color: "current",
|
|
55
|
+
size: iconSize,
|
|
53
56
|
...slotProps?.icon
|
|
54
57
|
},
|
|
55
58
|
className: classNames.icon
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
//#region src/components/client/Avatar/UDSAvatarConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSAvatarConfigProvider, useConfigContext } = require("../providers/createUDSConfigProvider.cjs").createUDSConfigProvider("Avatar");
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the configured icon size for an Avatar size.
|
|
8
|
+
*
|
|
9
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Avatar
|
|
10
|
+
* is used in many apps without a `UDSConfigProvider`, so it gracefully falls
|
|
11
|
+
* back to `undefined` (letting `Icon` apply its own default size) when no
|
|
12
|
+
* config is present — preserving the previous rendering exactly.
|
|
13
|
+
*/
|
|
14
|
+
const useAvatarConfig = (sizeProp) => {
|
|
15
|
+
const context = useConfigContext();
|
|
16
|
+
if (!context) return {
|
|
17
|
+
size: sizeProp,
|
|
18
|
+
iconSize: void 0
|
|
19
|
+
};
|
|
20
|
+
const size = sizeProp ?? context.defaultSize;
|
|
21
|
+
return {
|
|
22
|
+
size,
|
|
23
|
+
iconSize: context.iconSize[size]
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.UDSAvatarConfigProvider = UDSAvatarConfigProvider;
|
|
28
|
+
exports.useAvatarConfig = useAvatarConfig;
|