@yahoo/uds 3.157.1 → 3.158.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/generated/autoVariants.cjs +26 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +17 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +17 -0
- package/dist/automated-config/dist/generated/autoVariants.js +26 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +3220 -545
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +335 -11
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +335 -11
- package/dist/automated-config/dist/generated/generatedConfigs.js +3218 -546
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +275 -44
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +275 -44
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +3 -1
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +3 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +43 -35
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +4 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +4 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.js +44 -36
- package/dist/automated-config/dist/utils/componentStatePseudoStates.cjs +4 -0
- package/dist/automated-config/dist/utils/componentStatePseudoStates.js +4 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +5 -2
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +6 -3
- package/dist/automated-config/dist/utils/index.cjs +21 -5
- package/dist/automated-config/dist/utils/index.d.cts +1 -0
- package/dist/automated-config/dist/utils/index.d.ts +1 -0
- package/dist/automated-config/dist/utils/index.js +22 -6
- package/dist/automated-config/dist/utils/pseudoStateSelectors.cjs +6 -3
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.cts +1 -1
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.ts +1 -1
- package/dist/automated-config/dist/utils/pseudoStateSelectors.js +6 -3
- package/dist/components/client/Input/Input.cjs +1 -1
- package/dist/components/client/Input/Input.js +1 -1
- package/dist/components/client/Menu/Menu.Item.cjs +1 -0
- package/dist/components/client/Menu/Menu.Item.js +1 -0
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Select/Select.cjs +179 -0
- package/dist/components/client/Select/Select.d.cts +55 -0
- package/dist/components/client/Select/Select.d.ts +56 -0
- package/dist/components/client/Select/Select.js +176 -0
- package/dist/components/client/Select/SelectContent.cjs +75 -0
- package/dist/components/client/Select/SelectContent.d.cts +44 -0
- package/dist/components/client/Select/SelectContent.d.ts +45 -0
- package/dist/components/client/Select/SelectContent.js +73 -0
- package/dist/components/client/Select/SelectDivider.cjs +63 -0
- package/dist/components/client/Select/SelectDivider.d.cts +44 -0
- package/dist/components/client/Select/SelectDivider.d.ts +45 -0
- package/dist/components/client/Select/SelectDivider.js +61 -0
- package/dist/components/client/Select/SelectHelpText.cjs +51 -0
- package/dist/components/client/Select/SelectHelpText.d.cts +27 -0
- package/dist/components/client/Select/SelectHelpText.d.ts +28 -0
- package/dist/components/client/Select/SelectHelpText.js +48 -0
- package/dist/components/client/Select/SelectItem.cjs +172 -0
- package/dist/components/client/Select/SelectItem.d.cts +29 -0
- package/dist/components/client/Select/SelectItem.d.ts +30 -0
- package/dist/components/client/Select/SelectItem.js +170 -0
- package/dist/components/client/Select/SelectTrigger.cjs +138 -0
- package/dist/components/client/Select/SelectTrigger.d.cts +27 -0
- package/dist/components/client/Select/SelectTrigger.d.ts +28 -0
- package/dist/components/client/Select/SelectTrigger.js +136 -0
- package/dist/components/client/Select/SelectValue.cjs +28 -0
- package/dist/components/client/Select/SelectValue.d.cts +19 -0
- package/dist/components/client/Select/SelectValue.d.ts +20 -0
- package/dist/components/client/Select/SelectValue.js +26 -0
- package/dist/components/client/Select/index.cjs +11 -0
- package/dist/components/client/Select/index.d.cts +6 -0
- package/dist/components/client/Select/index.d.ts +7 -0
- package/dist/components/client/Select/index.js +7 -0
- package/dist/components/client/Select/selectContext.cjs +20 -0
- package/dist/components/client/Select/selectContext.d.cts +23 -0
- package/dist/components/client/Select/selectContext.d.ts +24 -0
- package/dist/components/client/Select/selectContext.js +16 -0
- package/dist/components/client/Select/selectFieldStyles.cjs +85 -0
- package/dist/components/client/Select/selectFieldStyles.d.cts +37 -0
- package/dist/components/client/Select/selectFieldStyles.d.ts +38 -0
- package/dist/components/client/Select/selectFieldStyles.js +75 -0
- package/dist/components/client/index.cjs +8 -0
- package/dist/components/client/index.d.cts +5 -1
- package/dist/components/client/index.d.ts +5 -1
- package/dist/components/client/index.js +5 -1
- package/dist/components/index.cjs +8 -0
- package/dist/components/index.d.cts +5 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +5 -1
- package/dist/config/dist/index.cjs +380 -70
- package/dist/config/dist/index.js +380 -70
- package/dist/css/dist/css/utils.cjs +3 -0
- package/dist/css/dist/css/utils.js +3 -0
- package/dist/css/dist/packages/config/dist/index.cjs +380 -70
- package/dist/css/dist/packages/config/dist/index.js +380 -70
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/dist/styles/styler.d.cts +42 -25
- package/dist/styles/styler.d.ts +42 -25
- package/dist/styles/variants.d.cts +54 -0
- package/dist/styles/variants.d.ts +54 -0
- package/dist/tailwind/utils/index.cjs +3 -0
- package/dist/tailwind/utils/index.d.cts +2 -1
- package/dist/tailwind/utils/index.d.ts +2 -1
- package/dist/tailwind/utils/index.js +2 -1
- package/dist/tailwind-internal/dist/base/addColorModeVars.cjs +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVars.js +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVarsV2.cjs +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVarsV2.js +1 -1
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.cjs +74 -6
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.d.cts +14 -0
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.d.ts +14 -0
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.js +74 -7
- package/dist/tailwind-internal/dist/components/getResponsiveTextStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/components/getResponsiveTextStyles.js +1 -1
- package/dist/tailwind-internal/dist/index.d.cts +1 -0
- package/dist/tailwind-internal/dist/index.d.ts +1 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +3220 -545
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3218 -546
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +4 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +4 -1
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +21 -5
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +22 -6
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.cjs +6 -3
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.js +6 -3
- package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +380 -70
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +380 -70
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +10 -10
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +1 -1
- package/dist/tailwind-internal/dist/plugins/a11y.cjs +6 -2
- package/dist/tailwind-internal/dist/plugins/a11y.js +6 -2
- package/dist/tailwind-internal/dist/plugins/blurBgFallback.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/blurBgFallback.js +1 -1
- package/dist/tailwind-internal/dist/plugins/borderRadius.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/borderRadius.js +1 -1
- package/dist/tailwind-internal/dist/plugins/borderWidth.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/borderWidth.js +1 -1
- package/dist/tailwind-internal/dist/plugins/colors.cjs +2 -2
- package/dist/tailwind-internal/dist/plugins/colors.js +2 -2
- package/dist/tailwind-internal/dist/plugins/components.cjs +30 -26
- package/dist/tailwind-internal/dist/plugins/components.js +6 -2
- package/dist/tailwind-internal/dist/plugins/elevation.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/elevation.js +1 -1
- package/dist/tailwind-internal/dist/plugins/shadows.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/shadows.js +1 -1
- package/dist/tailwind-internal/dist/plugins/typography.cjs +2 -2
- package/dist/tailwind-internal/dist/plugins/typography.js +2 -2
- package/dist/tailwind-internal/dist/utils/getElevationStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getElevationStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getFontStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getFontStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getMotionStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getMotionStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowPresetValues.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowPresetValues.js +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/parseTokens.cjs +2 -2
- package/dist/tailwind-internal/dist/utils/parseTokens.js +2 -2
- package/dist/tokens/automation/configs/index.cjs +3 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +3 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +3 -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/types/dist/index.d.cts +36 -1
- package/dist/types/dist/index.d.ts +36 -1
- package/dist/uds/generated/componentData.cjs +528 -121
- package/dist/uds/generated/componentData.js +528 -121
- package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
- package/dist/uds/generated/migrationSchemaVersion.js +1 -1
- package/dist/uds/generated/tailwindPurge.cjs +1501 -315
- package/dist/uds/generated/tailwindPurge.js +1501 -315
- package/generated/componentData.json +630 -134
- package/generated/migrationSchemaVersion.ts +1 -1
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +1 -1
|
@@ -15,10 +15,13 @@ const require_getConfigComponentVariant = require("./getConfigComponentVariant.c
|
|
|
15
15
|
function getConfigVariantPseudoStates(config, variantKey, state, subComponentName, componentStateValue) {
|
|
16
16
|
const componentVariant = require_getConfigComponentVariant.getConfigComponentVariant(config, variantKey, subComponentName);
|
|
17
17
|
if (!componentVariant) return null;
|
|
18
|
-
const
|
|
18
|
+
const componentStateConfig = state && require_variantConfigGuards.isVariantConfigWithComponentStates(componentVariant) ? componentVariant.componentStates[state] : void 0;
|
|
19
|
+
const excludedPseudoStates = componentStateConfig && componentStateValue ? require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentStateConfig, componentStateValue) : [];
|
|
20
|
+
const excludedLayers = componentStateConfig && componentStateValue ? require_componentStatePseudoStates.getExcludedLayersForComponentStateOption(componentStateConfig, componentStateValue) : [];
|
|
19
21
|
const variantLayers = require_variantConfigGuards.isVariantConfigWithProperties(componentVariant) ? Object.entries(componentVariant?.layers ?? {}) : [];
|
|
20
22
|
const stateLayers = require_variantConfigGuards.isVariantConfigWithComponentStates(componentVariant) && state ? Object.entries(componentVariant.componentStates[state].layers ?? {}) : [];
|
|
21
|
-
|
|
23
|
+
const excludedLayerSet = new Set(excludedLayers);
|
|
24
|
+
return [...variantLayers, ...stateLayers].filter(([layerKey]) => !excludedLayerSet.has(layerKey)).flatMap(([layerKey, layer]) => Object.entries(layer.properties).map(([propertyKey, property]) => [
|
|
22
25
|
layerKey,
|
|
23
26
|
layer,
|
|
24
27
|
propertyKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { filterPseudoStatesByExclusion, getExcludedPseudoStatesForComponentStateOption } from "./componentStatePseudoStates.js";
|
|
2
|
+
import { filterPseudoStatesByExclusion, getExcludedLayersForComponentStateOption, getExcludedPseudoStatesForComponentStateOption } from "./componentStatePseudoStates.js";
|
|
3
3
|
import { resolvePropertyStates } from "./resolvePropertyStates.js";
|
|
4
4
|
import { isVariantConfigWithComponentStates, isVariantConfigWithProperties } from "./variantConfigGuards.js";
|
|
5
5
|
import { getConfigComponentVariant } from "./getConfigComponentVariant.js";
|
|
@@ -15,10 +15,13 @@ import { getConfigComponentVariant } from "./getConfigComponentVariant.js";
|
|
|
15
15
|
function getConfigVariantPseudoStates(config, variantKey, state, subComponentName, componentStateValue) {
|
|
16
16
|
const componentVariant = getConfigComponentVariant(config, variantKey, subComponentName);
|
|
17
17
|
if (!componentVariant) return null;
|
|
18
|
-
const
|
|
18
|
+
const componentStateConfig = state && isVariantConfigWithComponentStates(componentVariant) ? componentVariant.componentStates[state] : void 0;
|
|
19
|
+
const excludedPseudoStates = componentStateConfig && componentStateValue ? getExcludedPseudoStatesForComponentStateOption(componentStateConfig, componentStateValue) : [];
|
|
20
|
+
const excludedLayers = componentStateConfig && componentStateValue ? getExcludedLayersForComponentStateOption(componentStateConfig, componentStateValue) : [];
|
|
19
21
|
const variantLayers = isVariantConfigWithProperties(componentVariant) ? Object.entries(componentVariant?.layers ?? {}) : [];
|
|
20
22
|
const stateLayers = isVariantConfigWithComponentStates(componentVariant) && state ? Object.entries(componentVariant.componentStates[state].layers ?? {}) : [];
|
|
21
|
-
|
|
23
|
+
const excludedLayerSet = new Set(excludedLayers);
|
|
24
|
+
return [...variantLayers, ...stateLayers].filter(([layerKey]) => !excludedLayerSet.has(layerKey)).flatMap(([layerKey, layer]) => Object.entries(layer.properties).map(([propertyKey, property]) => [
|
|
22
25
|
layerKey,
|
|
23
26
|
layer,
|
|
24
27
|
propertyKey,
|
|
@@ -90,7 +90,8 @@ const COMPONENTS_WITH_SHADOW_BORDERS = [
|
|
|
90
90
|
const LEGACY_STATE_KEYS = [
|
|
91
91
|
"disabled",
|
|
92
92
|
"focused",
|
|
93
|
-
"focused-keyboard"
|
|
93
|
+
"focused-keyboard",
|
|
94
|
+
"selected"
|
|
94
95
|
];
|
|
95
96
|
/**
|
|
96
97
|
* Enumerates every canonical state key the system supports: rest, every atom,
|
|
@@ -254,6 +255,14 @@ function generateClassName({ componentName, subComponentName, variantKey, varian
|
|
|
254
255
|
if (layerOptionalPseudoSelector) className = `${className}${layerOptionalPseudoSelector}`;
|
|
255
256
|
return className.replaceAll(/\s+/g, "-");
|
|
256
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Select triggers carry `uds-ring-shadow` and draw focus via the focus-ring tokens.
|
|
260
|
+
* Input wrappers still use `focus-within` border styling, so exclude `.uds-ring` and
|
|
261
|
+
* `.uds-select-field-trigger` descendants from those rules.
|
|
262
|
+
*/
|
|
263
|
+
function getLayerClassSelector(layer, className, componentName, propertyStateSelector) {
|
|
264
|
+
return componentName === "input" && (layer === "inputWrapperDynamic" || layer === "inputWrapper") && propertyStateSelector.includes("focus-within") ? `.${className}:not(.uds-ring):not(.uds-select-field-trigger)` : `.${className}`;
|
|
265
|
+
}
|
|
257
266
|
const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, existingValue, originalPropertyDefinition) => {
|
|
258
267
|
const { value, type } = schemaStateValue;
|
|
259
268
|
const propertyConfig = require_properties.configurableProperties[propertyName];
|
|
@@ -353,7 +362,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
353
362
|
for (const propStateStr of orderedStateKeys) {
|
|
354
363
|
if (!emittableStates.has(propStateStr)) continue;
|
|
355
364
|
const propertyState = propStateStr;
|
|
356
|
-
|
|
365
|
+
let propertyStateSelector = require_pseudoStateSelectors.getStateSelector(propertyState);
|
|
366
|
+
if (componentName === "selectitem" && propertyState === "focused") propertyStateSelector = ":is(:focus, [data-active-item])";
|
|
357
367
|
const schemaValueForState = shouldUseExhaustive || layerUsesAtomicStates ? require_resolveSlotByCascade.resolveSlotByCascade(propStateStr, resolutionStates) : propertyStateMap[propertyState];
|
|
358
368
|
if (!schemaValueForState) continue;
|
|
359
369
|
if (!shouldUseExhaustive) {
|
|
@@ -412,7 +422,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
412
422
|
layerOptionalPseudoSelector,
|
|
413
423
|
subComponentName
|
|
414
424
|
});
|
|
415
|
-
|
|
425
|
+
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
426
|
+
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} ${layerClassSelector}`;
|
|
416
427
|
} else {
|
|
417
428
|
className = generateClassName({
|
|
418
429
|
componentName,
|
|
@@ -422,7 +433,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
422
433
|
layerOptionalPseudoSelector,
|
|
423
434
|
subComponentName
|
|
424
435
|
});
|
|
425
|
-
|
|
436
|
+
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
437
|
+
fullClassName = bumpRootSpecificity ? `.${rootVariantClassName}.${rootVariantClassName}${propertyStateSelector} ${layerClassSelector}` : `.${rootVariantClassName}${propertyStateSelector} ${layerClassSelector}`;
|
|
426
438
|
}
|
|
427
439
|
}
|
|
428
440
|
const { cssProperties, extendedProperties: extendedPropertiesGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
@@ -563,8 +575,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
563
575
|
});
|
|
564
576
|
}
|
|
565
577
|
}
|
|
578
|
+
if (propertyKey === "borderRadius" && cssDeclarations[CSS_BORDER_RADIUS] && (componentName === "paddlenav" && layer === "root" || componentName === "input" && layer === "inputWrapperDynamic")) cssDeclarations[NESTED_BORDER_RADIUS_SIZE_VAR] = cssDeclarations[CSS_BORDER_RADIUS];
|
|
566
579
|
if (componentName === "paddlenav" && layer === "root") {
|
|
567
|
-
if (propertyKey === "borderRadius" && cssDeclarations[CSS_BORDER_RADIUS]) cssDeclarations[NESTED_BORDER_RADIUS_SIZE_VAR] = cssDeclarations[CSS_BORDER_RADIUS];
|
|
568
580
|
if (propertyKey === "borderWidth" && cssDeclarations[CSS_BORDER_WIDTH]) cssDeclarations[NESTED_BORDER_RADIUS_WIDTH_VAR] = cssDeclarations[CSS_BORDER_WIDTH];
|
|
569
581
|
}
|
|
570
582
|
if ((componentName === "tabs" || componentName === "tab") && layer === "root") {
|
|
@@ -763,7 +775,9 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
763
775
|
const componentState = componentStates[componentStateKey];
|
|
764
776
|
for (const componentStateOption of componentState.options) {
|
|
765
777
|
const excludedPseudoStates = require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption);
|
|
778
|
+
const excludedLayers = new Set(require_componentStatePseudoStates.getExcludedLayersForComponentStateOption(componentState, componentStateOption));
|
|
766
779
|
for (const layerKey in componentState.layers) {
|
|
780
|
+
if (excludedLayers.has(layerKey)) continue;
|
|
767
781
|
const layer = componentState.layers[layerKey];
|
|
768
782
|
for (const propertyKey in layer.properties) {
|
|
769
783
|
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
@@ -840,7 +854,9 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
840
854
|
const componentState = componentStates[componentStateKey];
|
|
841
855
|
for (const componentStateOption of componentState.options) {
|
|
842
856
|
const excludedPseudoStates = require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption);
|
|
857
|
+
const excludedLayers = new Set(require_componentStatePseudoStates.getExcludedLayersForComponentStateOption(componentState, componentStateOption));
|
|
843
858
|
for (const layerKey in componentState.layers) {
|
|
859
|
+
if (excludedLayers.has(layerKey)) continue;
|
|
844
860
|
const layer = componentState.layers[layerKey];
|
|
845
861
|
for (const propertyKey in layer.properties) {
|
|
846
862
|
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
@@ -200,6 +200,7 @@ declare function createComponentStates<T extends {
|
|
|
200
200
|
label: string;
|
|
201
201
|
options: readonly string[];
|
|
202
202
|
excludePseudoStatesForOptions?: Partial<Record<string, readonly PossibleStates[]>>;
|
|
203
|
+
excludeLayersForOptions?: Partial<Record<string, readonly string[]>>;
|
|
203
204
|
layers?: {
|
|
204
205
|
root: LayerConfig;
|
|
205
206
|
} & Record<string, LayerConfig>;
|
|
@@ -200,6 +200,7 @@ declare function createComponentStates<T extends {
|
|
|
200
200
|
label: string;
|
|
201
201
|
options: readonly string[];
|
|
202
202
|
excludePseudoStatesForOptions?: Partial<Record<string, readonly PossibleStates[]>>;
|
|
203
|
+
excludeLayersForOptions?: Partial<Record<string, readonly string[]>>;
|
|
203
204
|
layers?: {
|
|
204
205
|
root: LayerConfig;
|
|
205
206
|
} & Record<string, LayerConfig>;
|
|
@@ -3,7 +3,7 @@ import { BUTTON_GAP_VAR, BUTTON_SCALE_EFFECT_HOVER, BUTTON_SCALE_EFFECT_PRESSED,
|
|
|
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";
|
|
6
|
-
import { getExcludedPseudoStatesForComponentStateOption } from "./componentStatePseudoStates.js";
|
|
6
|
+
import { getExcludedLayersForComponentStateOption, getExcludedPseudoStatesForComponentStateOption } from "./componentStatePseudoStates.js";
|
|
7
7
|
import { generateSchemaKey } from "./generateSchemaKey.js";
|
|
8
8
|
import "./canonicalizeStateKey.js";
|
|
9
9
|
import { atomicAndCompoundStateKeys, resolvePropertyStates } from "./resolvePropertyStates.js";
|
|
@@ -89,7 +89,8 @@ const COMPONENTS_WITH_SHADOW_BORDERS = [
|
|
|
89
89
|
const LEGACY_STATE_KEYS = [
|
|
90
90
|
"disabled",
|
|
91
91
|
"focused",
|
|
92
|
-
"focused-keyboard"
|
|
92
|
+
"focused-keyboard",
|
|
93
|
+
"selected"
|
|
93
94
|
];
|
|
94
95
|
/**
|
|
95
96
|
* Enumerates every canonical state key the system supports: rest, every atom,
|
|
@@ -253,6 +254,14 @@ function generateClassName({ componentName, subComponentName, variantKey, varian
|
|
|
253
254
|
if (layerOptionalPseudoSelector) className = `${className}${layerOptionalPseudoSelector}`;
|
|
254
255
|
return className.replaceAll(/\s+/g, "-");
|
|
255
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Select triggers carry `uds-ring-shadow` and draw focus via the focus-ring tokens.
|
|
259
|
+
* Input wrappers still use `focus-within` border styling, so exclude `.uds-ring` and
|
|
260
|
+
* `.uds-select-field-trigger` descendants from those rules.
|
|
261
|
+
*/
|
|
262
|
+
function getLayerClassSelector(layer, className, componentName, propertyStateSelector) {
|
|
263
|
+
return componentName === "input" && (layer === "inputWrapperDynamic" || layer === "inputWrapper") && propertyStateSelector.includes("focus-within") ? `.${className}:not(.uds-ring):not(.uds-select-field-trigger)` : `.${className}`;
|
|
264
|
+
}
|
|
256
265
|
const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, existingValue, originalPropertyDefinition) => {
|
|
257
266
|
const { value, type } = schemaStateValue;
|
|
258
267
|
const propertyConfig = configurableProperties[propertyName];
|
|
@@ -352,7 +361,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
352
361
|
for (const propStateStr of orderedStateKeys) {
|
|
353
362
|
if (!emittableStates.has(propStateStr)) continue;
|
|
354
363
|
const propertyState = propStateStr;
|
|
355
|
-
|
|
364
|
+
let propertyStateSelector = getStateSelector(propertyState);
|
|
365
|
+
if (componentName === "selectitem" && propertyState === "focused") propertyStateSelector = ":is(:focus, [data-active-item])";
|
|
356
366
|
const schemaValueForState = shouldUseExhaustive || layerUsesAtomicStates ? resolveSlotByCascade(propStateStr, resolutionStates) : propertyStateMap[propertyState];
|
|
357
367
|
if (!schemaValueForState) continue;
|
|
358
368
|
if (!shouldUseExhaustive) {
|
|
@@ -411,7 +421,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
411
421
|
layerOptionalPseudoSelector,
|
|
412
422
|
subComponentName
|
|
413
423
|
});
|
|
414
|
-
|
|
424
|
+
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
425
|
+
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} ${layerClassSelector}`;
|
|
415
426
|
} else {
|
|
416
427
|
className = generateClassName({
|
|
417
428
|
componentName,
|
|
@@ -421,7 +432,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
421
432
|
layerOptionalPseudoSelector,
|
|
422
433
|
subComponentName
|
|
423
434
|
});
|
|
424
|
-
|
|
435
|
+
const layerClassSelector = getLayerClassSelector(layer, className, componentName, propertyStateSelector);
|
|
436
|
+
fullClassName = bumpRootSpecificity ? `.${rootVariantClassName}.${rootVariantClassName}${propertyStateSelector} ${layerClassSelector}` : `.${rootVariantClassName}${propertyStateSelector} ${layerClassSelector}`;
|
|
425
437
|
}
|
|
426
438
|
}
|
|
427
439
|
const { cssProperties, extendedProperties: extendedPropertiesGetter } = configurableProperties[originalPropertyDefinition.name];
|
|
@@ -562,8 +574,8 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
562
574
|
});
|
|
563
575
|
}
|
|
564
576
|
}
|
|
577
|
+
if (propertyKey === "borderRadius" && cssDeclarations[CSS_BORDER_RADIUS] && (componentName === "paddlenav" && layer === "root" || componentName === "input" && layer === "inputWrapperDynamic")) cssDeclarations[NESTED_BORDER_RADIUS_SIZE_VAR] = cssDeclarations[CSS_BORDER_RADIUS];
|
|
565
578
|
if (componentName === "paddlenav" && layer === "root") {
|
|
566
|
-
if (propertyKey === "borderRadius" && cssDeclarations[CSS_BORDER_RADIUS]) cssDeclarations[NESTED_BORDER_RADIUS_SIZE_VAR] = cssDeclarations[CSS_BORDER_RADIUS];
|
|
567
579
|
if (propertyKey === "borderWidth" && cssDeclarations[CSS_BORDER_WIDTH]) cssDeclarations[NESTED_BORDER_RADIUS_WIDTH_VAR] = cssDeclarations[CSS_BORDER_WIDTH];
|
|
568
580
|
}
|
|
569
581
|
if ((componentName === "tabs" || componentName === "tab") && layer === "root") {
|
|
@@ -762,7 +774,9 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
762
774
|
const componentState = componentStates[componentStateKey];
|
|
763
775
|
for (const componentStateOption of componentState.options) {
|
|
764
776
|
const excludedPseudoStates = getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption);
|
|
777
|
+
const excludedLayers = new Set(getExcludedLayersForComponentStateOption(componentState, componentStateOption));
|
|
765
778
|
for (const layerKey in componentState.layers) {
|
|
779
|
+
if (excludedLayers.has(layerKey)) continue;
|
|
766
780
|
const layer = componentState.layers[layerKey];
|
|
767
781
|
for (const propertyKey in layer.properties) {
|
|
768
782
|
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
@@ -839,7 +853,9 @@ function generateConfigStyles(config, schema, theme, previewOptions, emit, gener
|
|
|
839
853
|
const componentState = componentStates[componentStateKey];
|
|
840
854
|
for (const componentStateOption of componentState.options) {
|
|
841
855
|
const excludedPseudoStates = getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption);
|
|
856
|
+
const excludedLayers = new Set(getExcludedLayersForComponentStateOption(componentState, componentStateOption));
|
|
842
857
|
for (const layerKey in componentState.layers) {
|
|
858
|
+
if (excludedLayers.has(layerKey)) continue;
|
|
843
859
|
const layer = componentState.layers[layerKey];
|
|
844
860
|
for (const propertyKey in layer.properties) {
|
|
845
861
|
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
@@ -6,7 +6,8 @@ const require_canonicalizeStateKey = require("./canonicalizeStateKey.cjs");
|
|
|
6
6
|
const LEGACY_STATE_ATOMS = new Set([
|
|
7
7
|
"disabled",
|
|
8
8
|
"focused",
|
|
9
|
-
"focused-keyboard"
|
|
9
|
+
"focused-keyboard",
|
|
10
|
+
"selected"
|
|
10
11
|
]);
|
|
11
12
|
function isKnownStateAtom(atom) {
|
|
12
13
|
return require_StateAxis.isAtomicState(atom) || LEGACY_STATE_ATOMS.has(atom);
|
|
@@ -64,7 +65,8 @@ const ATOMIC_SELECTORS = {
|
|
|
64
65
|
readonly: ":has(:read-only:where(input, textarea))",
|
|
65
66
|
invalid: ":has([aria-invalid=\"true\"])",
|
|
66
67
|
"placeholder-shown": ":has(:placeholder-shown)",
|
|
67
|
-
autofill: ":has(:autofill, :-webkit-autofill)"
|
|
68
|
+
autofill: ":has(:autofill, :-webkit-autofill)",
|
|
69
|
+
selected: "[aria-selected=\"true\"]"
|
|
68
70
|
};
|
|
69
71
|
const ATOMIC_DOCS_CLASSES = {
|
|
70
72
|
hover: "hover",
|
|
@@ -78,7 +80,8 @@ const ATOMIC_DOCS_CLASSES = {
|
|
|
78
80
|
readonly: "input-readonly",
|
|
79
81
|
invalid: "has-input-invalid",
|
|
80
82
|
"placeholder-shown": "has-input-placeholder-shown",
|
|
81
|
-
autofill: "has-input-autofill"
|
|
83
|
+
autofill: "has-input-autofill",
|
|
84
|
+
selected: "aria-selected"
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Returns the CSS pseudo-selector string for a state key.
|
|
@@ -8,7 +8,7 @@ import { AtomicState } from "../types/StateAxis.cjs";
|
|
|
8
8
|
* unmigrated configs. They aren't composable through `StateAxis`, so the new
|
|
9
9
|
* resolver/StateBuilder never emit them.
|
|
10
10
|
*/
|
|
11
|
-
type LegacyStateAtom = 'disabled' | 'focused' | 'focused-keyboard';
|
|
11
|
+
type LegacyStateAtom = 'disabled' | 'focused' | 'focused-keyboard' | 'selected';
|
|
12
12
|
type KnownStateAtom = AtomicState | LegacyStateAtom;
|
|
13
13
|
declare function isKnownStateAtom(atom: string): atom is KnownStateAtom;
|
|
14
14
|
/**
|
|
@@ -8,7 +8,7 @@ import { AtomicState } from "../types/StateAxis.js";
|
|
|
8
8
|
* unmigrated configs. They aren't composable through `StateAxis`, so the new
|
|
9
9
|
* resolver/StateBuilder never emit them.
|
|
10
10
|
*/
|
|
11
|
-
type LegacyStateAtom = 'disabled' | 'focused' | 'focused-keyboard';
|
|
11
|
+
type LegacyStateAtom = 'disabled' | 'focused' | 'focused-keyboard' | 'selected';
|
|
12
12
|
type KnownStateAtom = AtomicState | LegacyStateAtom;
|
|
13
13
|
declare function isKnownStateAtom(atom: string): atom is KnownStateAtom;
|
|
14
14
|
/**
|
|
@@ -6,7 +6,8 @@ import { splitStateKey } from "./canonicalizeStateKey.js";
|
|
|
6
6
|
const LEGACY_STATE_ATOMS = new Set([
|
|
7
7
|
"disabled",
|
|
8
8
|
"focused",
|
|
9
|
-
"focused-keyboard"
|
|
9
|
+
"focused-keyboard",
|
|
10
|
+
"selected"
|
|
10
11
|
]);
|
|
11
12
|
function isKnownStateAtom(atom) {
|
|
12
13
|
return isAtomicState(atom) || LEGACY_STATE_ATOMS.has(atom);
|
|
@@ -64,7 +65,8 @@ const ATOMIC_SELECTORS = {
|
|
|
64
65
|
readonly: ":has(:read-only:where(input, textarea))",
|
|
65
66
|
invalid: ":has([aria-invalid=\"true\"])",
|
|
66
67
|
"placeholder-shown": ":has(:placeholder-shown)",
|
|
67
|
-
autofill: ":has(:autofill, :-webkit-autofill)"
|
|
68
|
+
autofill: ":has(:autofill, :-webkit-autofill)",
|
|
69
|
+
selected: "[aria-selected=\"true\"]"
|
|
68
70
|
};
|
|
69
71
|
const ATOMIC_DOCS_CLASSES = {
|
|
70
72
|
hover: "hover",
|
|
@@ -78,7 +80,8 @@ const ATOMIC_DOCS_CLASSES = {
|
|
|
78
80
|
readonly: "input-readonly",
|
|
79
81
|
invalid: "has-input-invalid",
|
|
80
82
|
"placeholder-shown": "has-input-placeholder-shown",
|
|
81
|
-
autofill: "has-input-autofill"
|
|
83
|
+
autofill: "has-input-autofill",
|
|
84
|
+
selected: "aria-selected"
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Returns the CSS pseudo-selector string for a state key.
|
|
@@ -147,7 +147,7 @@ const Input = (0, react.forwardRef)(function Input({ id, label, type = "text", s
|
|
|
147
147
|
inputSizeInputWrapperDynamic: size,
|
|
148
148
|
inputVariantInputWrapper: "default",
|
|
149
149
|
inputVariantValueInputWrapper: !value ? "empty" : "filled"
|
|
150
|
-
}), "min-w-[200px]", inputWrapperClassName),
|
|
150
|
+
}), "min-w-[200px]", "uds-ring-shadow", "uds-ring-within", inputWrapperClassName),
|
|
151
151
|
input: require_styles_styler.getStyles({
|
|
152
152
|
inputSizeInput: size,
|
|
153
153
|
inputVariantInput: "default",
|
|
@@ -144,7 +144,7 @@ const Input = forwardRef(function Input({ id, label, type = "text", size = "md",
|
|
|
144
144
|
inputSizeInputWrapperDynamic: size,
|
|
145
145
|
inputVariantInputWrapper: "default",
|
|
146
146
|
inputVariantValueInputWrapper: !value ? "empty" : "filled"
|
|
147
|
-
}), "min-w-[200px]", inputWrapperClassName),
|
|
147
|
+
}), "min-w-[200px]", "uds-ring-shadow", "uds-ring-within", inputWrapperClassName),
|
|
148
148
|
input: getStyles({
|
|
149
149
|
inputSizeInput: size,
|
|
150
150
|
inputVariantInput: "default",
|
|
@@ -66,6 +66,7 @@ const MenuItem = (0, react.forwardRef)(function MenuItem({ active, hideOnClick,
|
|
|
66
66
|
},
|
|
67
67
|
text: {
|
|
68
68
|
className: require_styles_styler.cx(require_styles_styler.getStyles({
|
|
69
|
+
menuitemSizeText: "default",
|
|
69
70
|
menuitemItemVariantText: "default",
|
|
70
71
|
menuitemItemVariantActiveText: active ? "on" : "off"
|
|
71
72
|
}), slotProps?.text?.className),
|
|
@@ -64,6 +64,7 @@ const MenuItem = forwardRef(function MenuItem({ active, hideOnClick, slotProps,
|
|
|
64
64
|
},
|
|
65
65
|
text: {
|
|
66
66
|
className: cx(getStyles({
|
|
67
|
+
menuitemSizeText: "default",
|
|
67
68
|
menuitemItemVariantText: "default",
|
|
68
69
|
menuitemItemVariantActiveText: active ? "on" : "off"
|
|
69
70
|
}), slotProps?.text?.className),
|
|
@@ -87,6 +87,6 @@ interface MenuItemCheckboxProps extends Omit<PressableProps, 'asChild'>, HtmlBut
|
|
|
87
87
|
*
|
|
88
88
|
* @related [Menu](https://uds.build/docs/components/menu), [Menu.Item](https://uds.build/docs/components/menu-item)
|
|
89
89
|
**/
|
|
90
|
-
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "
|
|
90
|
+
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "hideEndIcon" | "rootProps"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
91
91
|
//#endregion
|
|
92
92
|
export { MenuItemCheckbox, type MenuItemCheckboxProps };
|
|
@@ -88,6 +88,6 @@ interface MenuItemCheckboxProps extends Omit<PressableProps, 'asChild'>, HtmlBut
|
|
|
88
88
|
*
|
|
89
89
|
* @related [Menu](https://uds.build/docs/components/menu), [Menu.Item](https://uds.build/docs/components/menu-item)
|
|
90
90
|
**/
|
|
91
|
-
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "
|
|
91
|
+
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "hideEndIcon" | "rootProps"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
92
92
|
//#endregion
|
|
93
93
|
export { MenuItemCheckbox, type MenuItemCheckboxProps };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
7
|
+
const require_components_Box = require("../../Box.cjs");
|
|
8
|
+
const require_components_VStack = require("../../VStack.cjs");
|
|
9
|
+
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
|
|
10
|
+
const require_components_client_Select_selectContext = require("./selectContext.cjs");
|
|
11
|
+
const require_components_client_Select_selectFieldStyles = require("./selectFieldStyles.cjs");
|
|
12
|
+
const require_components_client_Select_SelectHelpText = require("./SelectHelpText.cjs");
|
|
13
|
+
const require_components_client_Select_SelectTrigger = require("./SelectTrigger.cjs");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
17
|
+
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
18
|
+
let _ariakit_react = require("@ariakit/react");
|
|
19
|
+
//#region src/components/client/Select/Select.tsx
|
|
20
|
+
const SelectRoot = (0, react.forwardRef)(function SelectRoot({ children, label, helpText, helperTextIcon, placeholder, name, size = "md", disabled, required, hasError, readOnly, width = "full", reduceMotion: forceReduceMotion, startIcon, endIcon, className, style, slotProps }, ref) {
|
|
21
|
+
const value = (0, _ariakit_react.useStoreState)((0, _ariakit_react.useSelectContext)(), "value");
|
|
22
|
+
const hasValue = value != null && value !== "";
|
|
23
|
+
const hasHelpText = Boolean(helpText || helperTextIcon);
|
|
24
|
+
const uid = `uds-select-${(0, react.useId)()}`;
|
|
25
|
+
const helpTextId = hasHelpText ? `${uid}-help-text` : void 0;
|
|
26
|
+
const triggerWrapperRef = (0, react.useRef)(null);
|
|
27
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
28
|
+
size,
|
|
29
|
+
disabled,
|
|
30
|
+
readOnly,
|
|
31
|
+
required,
|
|
32
|
+
hasError,
|
|
33
|
+
width,
|
|
34
|
+
reduceMotion: forceReduceMotion,
|
|
35
|
+
uid,
|
|
36
|
+
helpTextId,
|
|
37
|
+
triggerWrapperRef
|
|
38
|
+
}), [
|
|
39
|
+
size,
|
|
40
|
+
disabled,
|
|
41
|
+
readOnly,
|
|
42
|
+
required,
|
|
43
|
+
hasError,
|
|
44
|
+
width,
|
|
45
|
+
forceReduceMotion,
|
|
46
|
+
uid,
|
|
47
|
+
helpTextId
|
|
48
|
+
]);
|
|
49
|
+
const { className: rootSlotClassName, ...rootSlotProps } = slotProps?.root ?? {};
|
|
50
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_selectContext.SelectFieldContext.Provider, {
|
|
51
|
+
value: contextValue,
|
|
52
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_VStack.VStack, {
|
|
53
|
+
width,
|
|
54
|
+
className: require_styles_styler.cx(require_components_client_Select_selectFieldStyles.getSelectRootClassName({
|
|
55
|
+
size,
|
|
56
|
+
hasValue,
|
|
57
|
+
disabled,
|
|
58
|
+
className
|
|
59
|
+
}), rootSlotClassName),
|
|
60
|
+
style,
|
|
61
|
+
...rootSlotProps,
|
|
62
|
+
children: [
|
|
63
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
64
|
+
spacingBottom: "2",
|
|
65
|
+
columnGap: "0.5",
|
|
66
|
+
alignItems: "flex-end",
|
|
67
|
+
className: require_components_client_Select_selectFieldStyles.getSelectLabelClassName(size, hasValue),
|
|
68
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
69
|
+
htmlFor: uid,
|
|
70
|
+
...slotProps?.label,
|
|
71
|
+
children: (0, lodash_isFunction_js.default)(label) ? label() : label
|
|
72
|
+
}), required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
73
|
+
className: require_components_client_Select_selectFieldStyles.getSelectLabelRequiredClassName(hasValue),
|
|
74
|
+
children: "*"
|
|
75
|
+
})]
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_SelectTrigger.SelectTrigger, {
|
|
78
|
+
ref,
|
|
79
|
+
placeholder,
|
|
80
|
+
name,
|
|
81
|
+
startIcon,
|
|
82
|
+
endIcon,
|
|
83
|
+
disabled,
|
|
84
|
+
slotProps: slotProps?.trigger
|
|
85
|
+
}),
|
|
86
|
+
hasHelpText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_SelectHelpText.SelectHelpText, {
|
|
87
|
+
helpText,
|
|
88
|
+
helperTextIcon,
|
|
89
|
+
slotProps: {
|
|
90
|
+
helperText: slotProps?.helperText,
|
|
91
|
+
helperTextIcon: slotProps?.helperTextIcon
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
children
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
SelectRoot.displayName = "SelectRoot";
|
|
100
|
+
/**
|
|
101
|
+
* **⚙️ A composable Select component**
|
|
102
|
+
*
|
|
103
|
+
* @componentType Client component
|
|
104
|
+
*
|
|
105
|
+
* @description
|
|
106
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
107
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* 'use client';
|
|
112
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
113
|
+
*
|
|
114
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
115
|
+
* <SelectContent>
|
|
116
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
117
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
118
|
+
* </SelectContent>
|
|
119
|
+
* </Select>
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
const Select = (0, react.forwardRef)(function Select({ children, label, helpText, helperTextIcon, placeholder, name, size, disabled, required, hasError, readOnly, width, reduceMotion, startIcon, endIcon, className, style, slotProps, defaultValue = "", value, setValue: setValueProp, onChange, open: openProp, defaultOpen, setOpen: setOpenProp, ...providerProps }, ref) {
|
|
123
|
+
const setValue = setValueProp ?? onChange;
|
|
124
|
+
const isOpenControlled = openProp !== void 0;
|
|
125
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultOpen ?? false);
|
|
126
|
+
const open = isOpenControlled ? openProp : uncontrolledOpen;
|
|
127
|
+
const handleSetOpen = (0, react.useCallback)((nextOpen) => {
|
|
128
|
+
if (readOnly && isOpenControlled) return;
|
|
129
|
+
if (nextOpen && (readOnly || disabled)) return;
|
|
130
|
+
if (!isOpenControlled) setUncontrolledOpen(nextOpen);
|
|
131
|
+
setOpenProp?.(nextOpen);
|
|
132
|
+
}, [
|
|
133
|
+
disabled,
|
|
134
|
+
isOpenControlled,
|
|
135
|
+
readOnly,
|
|
136
|
+
setOpenProp
|
|
137
|
+
]);
|
|
138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
139
|
+
reducedMotion: "user",
|
|
140
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.SelectProvider, {
|
|
141
|
+
...value !== void 0 ? {
|
|
142
|
+
...providerProps,
|
|
143
|
+
value,
|
|
144
|
+
setValue,
|
|
145
|
+
open,
|
|
146
|
+
setOpen: handleSetOpen
|
|
147
|
+
} : {
|
|
148
|
+
...providerProps,
|
|
149
|
+
defaultValue,
|
|
150
|
+
open,
|
|
151
|
+
setOpen: handleSetOpen
|
|
152
|
+
},
|
|
153
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectRoot, {
|
|
154
|
+
ref,
|
|
155
|
+
label,
|
|
156
|
+
helpText,
|
|
157
|
+
helperTextIcon,
|
|
158
|
+
placeholder,
|
|
159
|
+
name,
|
|
160
|
+
size,
|
|
161
|
+
disabled,
|
|
162
|
+
required,
|
|
163
|
+
hasError,
|
|
164
|
+
readOnly,
|
|
165
|
+
width,
|
|
166
|
+
reduceMotion,
|
|
167
|
+
startIcon,
|
|
168
|
+
endIcon,
|
|
169
|
+
className,
|
|
170
|
+
style,
|
|
171
|
+
slotProps,
|
|
172
|
+
children
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
Select.displayName = "Select";
|
|
178
|
+
//#endregion
|
|
179
|
+
exports.Select = Select;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalSelectProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
|
|
4
|
+
import { SelectTriggerProps } from "./SelectTrigger.cjs";
|
|
5
|
+
import * as _$react from "react";
|
|
6
|
+
import { SelectProviderProps } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Select/Select.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface SelectProps extends Pick<UniversalSelectProps, 'label' | 'disabled' | 'required' | 'helpText' | 'helperTextIcon' | 'hasError' | 'size' | 'startIcon' | 'endIcon' | 'reduceMotion' | 'readOnly' | 'width'>, Omit<SelectProviderProps, 'children' | 'setValue'> {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/** Placeholder text shown when no value is selected. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Native form field name. Renders a hidden `<select>` for form submission. */
|
|
17
|
+
name?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
/** Called when the selected value changes. Alias for Ariakit `setValue`. */
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
setValue?: SelectProviderProps['setValue'];
|
|
23
|
+
slotProps?: {
|
|
24
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
25
|
+
label?: Partial<React.LabelHTMLAttributes<HTMLLabelElement> & DataAttributes>;
|
|
26
|
+
trigger?: SelectTriggerProps['slotProps'];
|
|
27
|
+
helperText?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
28
|
+
helperTextIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* **⚙️ A composable Select component**
|
|
33
|
+
*
|
|
34
|
+
* @componentType Client component
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
38
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* 'use client';
|
|
43
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
44
|
+
*
|
|
45
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
46
|
+
* <SelectContent>
|
|
47
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
48
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
49
|
+
* </SelectContent>
|
|
50
|
+
* </Select>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare const Select: _$react.ForwardRefExoticComponent<SelectProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Select, type SelectProps };
|