@yahoo/uds 2.10.2 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/cli/bin/uds-darwin-arm64-baseline +0 -0
  2. package/cli/bin/uds-linux-arm64 +0 -0
  3. package/cli/bin/uds-linux-x64-baseline +0 -0
  4. package/cli/cli.ts +1 -1
  5. package/cli/codemods/addCommentAboveComponents.ts +1 -1
  6. package/cli/codemods/flattenButtonVariant.ts +143 -0
  7. package/cli/codemods/utils/index.ts +1 -1
  8. package/cli/commands/codemod/flattenButtonVariant.ts +16 -0
  9. package/cli/tailwindcss.d.ts +2 -0
  10. package/cli/tsconfig.json +30 -8
  11. package/cli/utils/configWorker.ts +1 -1
  12. package/cli/utils/purgeCSS.ts +3 -3
  13. package/cli/utils/sortKeys.ts +5 -0
  14. package/dist/{Text-UCDorZDD.d.cts → Text-DC5H-ljU.d.cts} +29 -68
  15. package/dist/{Text-UCDorZDD.d.ts → Text-DC5H-ljU.d.ts} +29 -68
  16. package/dist/VStack-dsjTgotn.d.ts +145 -0
  17. package/dist/VStack-lZcVQtuR.d.cts +145 -0
  18. package/dist/analytics/server.js +1 -1
  19. package/dist/chunk-3R4CMTF2.js +2 -0
  20. package/dist/chunk-COT7GQ26.js +2 -0
  21. package/dist/chunk-DIZ6AEFQ.cjs +3 -0
  22. package/dist/chunk-GWUSJOIP.js +2 -0
  23. package/dist/chunk-GXWRHF26.cjs +1 -0
  24. package/dist/chunk-H35WDIEH.cjs +1 -0
  25. package/dist/chunk-IGRY2O2E.js +2 -0
  26. package/dist/chunk-IQXT3UML.cjs +2 -0
  27. package/dist/chunk-PLVCO2Q2.cjs +1 -0
  28. package/dist/chunk-RCTE4OK2.cjs +1 -0
  29. package/dist/chunk-ROCVTVD4.js +2 -0
  30. package/dist/chunk-SWTZ62RF.js +3 -0
  31. package/dist/chunk-TYCIDVTR.js +2 -0
  32. package/dist/chunk-UWAIMWW7.cjs +1 -0
  33. package/dist/client/index.cjs +2 -2
  34. package/dist/client/index.d.cts +913 -21
  35. package/dist/client/index.d.ts +913 -21
  36. package/dist/client/index.js +3 -3
  37. package/dist/experimental/client/index.cjs +2 -2
  38. package/dist/experimental/client/index.d.cts +14 -49
  39. package/dist/experimental/client/index.d.ts +14 -49
  40. package/dist/experimental/client/index.js +2 -2
  41. package/dist/experimental/index.cjs +2 -2
  42. package/dist/experimental/index.d.cts +4 -55
  43. package/dist/experimental/index.d.ts +4 -55
  44. package/dist/experimental/index.js +1 -1
  45. package/dist/fixtures.cjs +1544 -54
  46. package/dist/fixtures.d.cts +33 -14
  47. package/dist/fixtures.d.ts +33 -14
  48. package/dist/fixtures.js +1517 -48
  49. package/dist/flags.cjs +1 -1
  50. package/dist/flags.js +1 -1
  51. package/dist/index-B1ZHRmSN.d.ts +202 -0
  52. package/dist/index-By9VJ9yq.d.cts +202 -0
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.cts +245 -128
  55. package/dist/index.d.ts +245 -128
  56. package/dist/index.js +1 -1
  57. package/dist/metafile-cjs.json +1 -1
  58. package/dist/metafile-esm.json +1 -1
  59. package/dist/tailwind/plugin.cjs +1 -2
  60. package/dist/tailwind/plugin.d.cts +14 -5
  61. package/dist/tailwind/plugin.d.ts +14 -5
  62. package/dist/tailwind/plugin.js +2 -2
  63. package/dist/tailwind/purger.cjs +2 -2
  64. package/dist/tailwind/purger.js +3 -3
  65. package/dist/tailwind/tsMorph.cjs +1 -1
  66. package/dist/tailwind/tsMorph.js +1 -1
  67. package/dist/tailwind/utils.cjs +1 -1
  68. package/dist/tailwind/utils.d.cts +80 -28
  69. package/dist/tailwind/utils.d.ts +80 -28
  70. package/dist/tailwind/utils.js +1 -1
  71. package/dist/tokens/automation/configs.cjs +1 -0
  72. package/dist/tokens/automation/configs.d.cts +110 -0
  73. package/dist/tokens/automation/configs.d.ts +110 -0
  74. package/dist/tokens/automation/configs.js +1 -0
  75. package/dist/tokens/automation/properties.cjs +1 -0
  76. package/dist/tokens/automation/properties.d.cts +7 -0
  77. package/dist/tokens/automation/properties.d.ts +7 -0
  78. package/dist/tokens/automation/properties.js +1 -0
  79. package/dist/tokens/index.cjs +1 -1
  80. package/dist/tokens/index.d.cts +9355 -15
  81. package/dist/tokens/index.d.ts +9355 -15
  82. package/dist/tokens/index.js +1 -1
  83. package/dist/tokens/parseTokens.cjs +1 -1
  84. package/dist/tokens/parseTokens.d.cts +7 -23
  85. package/dist/tokens/parseTokens.d.ts +7 -23
  86. package/dist/tokens/parseTokens.js +1 -1
  87. package/dist/types-oxQ-ciqn.d.cts +10237 -0
  88. package/dist/types-oxQ-ciqn.d.ts +10237 -0
  89. package/package.json +17 -4
  90. package/dist/chunk-3G7IRLGN.js +0 -2
  91. package/dist/chunk-5WBROFT5.cjs +0 -1
  92. package/dist/chunk-6453EQCC.cjs +0 -1
  93. package/dist/chunk-7QHJ6LHA.js +0 -1
  94. package/dist/chunk-EYFQOFYW.cjs +0 -1
  95. package/dist/chunk-FWF2C6TL.cjs +0 -1
  96. package/dist/chunk-FYVGDNGL.js +0 -2
  97. package/dist/chunk-GIJ2FHY5.cjs +0 -1
  98. package/dist/chunk-GL5JI7EX.cjs +0 -2
  99. package/dist/chunk-MOUM7BAW.js +0 -2
  100. package/dist/chunk-PE2P7J44.js +0 -2
  101. package/dist/chunk-RXSJCGB3.cjs +0 -1
  102. package/dist/chunk-SUASN3GG.js +0 -2
  103. package/dist/chunk-U2K4DT7E.js +0 -3
  104. package/dist/chunk-VPR62GYQ.js +0 -2
  105. package/dist/chunk-WJ55DEUW.cjs +0 -2
  106. package/dist/chunk-X6F5UEQ5.js +0 -2
  107. package/dist/chunk-XZCEFUNX.cjs +0 -2
  108. package/dist/types-DPT0rst4.d.cts +0 -991
  109. package/dist/types-DPT0rst4.d.ts +0 -991
  110. /package/dist/{motionFeatures-PRT45UQH.js → motionFeatures-25DAPVNO.js} +0 -0
  111. /package/dist/{motionFeatures-HQUM526D.cjs → motionFeatures-II2BNXF5.cjs} +0 -0
Binary file
Binary file
Binary file
package/cli/cli.ts CHANGED
@@ -58,4 +58,4 @@ async function main() {
58
58
  await command.run(props);
59
59
  }
60
60
 
61
- main();
61
+ await main();
@@ -63,7 +63,7 @@ export async function addCommentAboveComponents({
63
63
  });
64
64
 
65
65
  const updateSrc = srcLines.join('\n');
66
- console.log(updateSrc);
66
+ // console.log(updateSrc);
67
67
  sourceFile.replaceWithText(updateSrc);
68
68
  }
69
69
  });
@@ -0,0 +1,143 @@
1
+ import { Project, SyntaxKind } from 'ts-morph';
2
+
3
+ import { ButtonPalette, ButtonVariant, ButtonVariantFlat } from '~/tokens';
4
+
5
+ import { getGlobPattern, getImportsFromPackage, getProject } from './utils';
6
+
7
+ const buttonFlatValMap: Record<ButtonVariantFlat, ButtonVariantFlat> = {
8
+ primary: 'primary',
9
+ secondary: 'secondary',
10
+ tertiary: 'tertiary',
11
+ brand: 'brand',
12
+ alert: 'alert',
13
+ positive: 'positive',
14
+ warning: 'warning',
15
+ info: 'info',
16
+ 'brand-secondary': 'brand-secondary',
17
+ 'brand-tertiary': 'brand-tertiary',
18
+ 'alert-secondary': 'alert-secondary',
19
+ 'alert-tertiary': 'alert-tertiary',
20
+ 'positive-secondary': 'positive-secondary',
21
+ 'positive-tertiary': 'positive-tertiary',
22
+ 'warning-secondary': 'warning-secondary',
23
+ 'warning-tertiary': 'warning-tertiary',
24
+ 'info-secondary': 'info-secondary',
25
+ 'info-tertiary': 'info-tertiary',
26
+ };
27
+
28
+ // This is a hack to typecheck the keys of the object, ensure that all of the values are present
29
+ // NOTE: Importing fixtures still causes issues
30
+ const buttonVariantsFlat = Object.values(buttonFlatValMap);
31
+
32
+ function parseButtonVariantFlat({
33
+ palette = 'accent',
34
+ variant = 'primary',
35
+ }: {
36
+ palette?: ButtonPalette;
37
+ variant?: ButtonVariant;
38
+ }): ButtonVariantFlat {
39
+ if (palette === 'accent') {
40
+ return variant; // primary, secondary, tertiary
41
+ }
42
+
43
+ if (variant === 'primary') {
44
+ return palette; // brand, alert, positive, warning
45
+ }
46
+
47
+ return `${palette}-${variant}`; // brand-secondary, alert-tertiary, etc.
48
+ }
49
+
50
+ interface Options {
51
+ selectedDirs?: string[];
52
+ project?: Project;
53
+ }
54
+
55
+ /**
56
+ * Flatten palette and variant into a single variant prop for UDS Button and IconButton.
57
+ */
58
+ export async function flattenButtonVariant({ selectedDirs, project = getProject() }: Options) {
59
+ const glob = getGlobPattern(selectedDirs);
60
+ const sourceFiles = project.getSourceFiles(glob);
61
+
62
+ for (const sourceFile of sourceFiles) {
63
+ // Get UDS imports from '@yahoo/uds'
64
+ const importUdsComponents = getImportsFromPackage(sourceFile, '@yahoo/uds');
65
+
66
+ // Only process files that import Button or IconButton
67
+ if (!importUdsComponents.has('Button') && !importUdsComponents.has('IconButton')) {
68
+ continue;
69
+ }
70
+
71
+ // Process both JsxOpeningElement and JsxSelfClosingElement nodes.
72
+ const jsxElements = [
73
+ ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxOpeningElement),
74
+ ...sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement),
75
+ ].filter((el) => {
76
+ const tagName = el.getTagNameNode().getText();
77
+ return (tagName === 'Button' || tagName === 'IconButton') && importUdsComponents.has(tagName);
78
+ });
79
+
80
+ jsxElements.forEach((jsxEl) => {
81
+ // Get palette and variant attributes
82
+ const paletteAttr = jsxEl.getAttribute('palette');
83
+ const variantAttr = jsxEl.getAttribute('variant');
84
+
85
+ // Prepare to capture literal values.
86
+ let paletteLiteral: string | undefined;
87
+ let variantLiteral: string;
88
+
89
+ // Process palette attribute
90
+ if (paletteAttr) {
91
+ // @ts-expect-error - getInitializer() is not in the type definition
92
+ const initializer = paletteAttr.getInitializer();
93
+ if (initializer && initializer.getKind() === SyntaxKind.StringLiteral) {
94
+ paletteLiteral = initializer.getText().slice(1, -1);
95
+ }
96
+ }
97
+
98
+ // Process variant attribute
99
+ if (variantAttr) {
100
+ // @ts-expect-error - getInitializer() is not in the type definition
101
+ const initializer = variantAttr.getInitializer();
102
+ if (initializer && initializer.getKind() === SyntaxKind.StringLiteral) {
103
+ variantLiteral = initializer.getText().slice(1, -1);
104
+ } else {
105
+ variantLiteral = 'primary';
106
+ }
107
+ } else {
108
+ variantLiteral = 'primary';
109
+ }
110
+
111
+ // Remove the old palette and variant attributes.
112
+ if (paletteAttr) {
113
+ paletteAttr.remove();
114
+ }
115
+ if (variantAttr) {
116
+ variantAttr.remove();
117
+ }
118
+
119
+ if (!paletteLiteral && buttonVariantsFlat.includes(variantLiteral as ButtonVariantFlat)) {
120
+ // If the variant is already a valid flattened value, use it as is.
121
+ if (variantLiteral !== 'primary') {
122
+ // If its "primary", just remove all the props
123
+ jsxEl.addAttribute({
124
+ name: 'variant',
125
+ initializer: `"${variantLiteral}"`,
126
+ });
127
+ }
128
+ } else {
129
+ // Compute the flattened variant using the parsing function.
130
+ const flattened = parseButtonVariantFlat({
131
+ palette: paletteLiteral as ButtonPalette,
132
+ variant: variantLiteral as ButtonVariant,
133
+ });
134
+
135
+ jsxEl.addAttribute({
136
+ name: 'variant',
137
+ initializer: `"${flattened}"`,
138
+ });
139
+ }
140
+ });
141
+ }
142
+ await project.save();
143
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ------------------- GENERATED | DO NOT MODIFY THIS SECTINO ------------------
2
+ * ------------------- GENERATED | DO NOT MODIFY THIS SECTION ------------------
3
3
  * This file uses eslint-plugin-codegen to automatically watch for changes in
4
4
  * the `src/components` directory and updates this barrel file.
5
5
  */
@@ -0,0 +1,16 @@
1
+ import { type Props, spinStart, spinStop } from 'bluebun';
2
+
3
+ import { flattenButtonVariant } from '../../codemods/flattenButtonVariant';
4
+
5
+ export default {
6
+ name: 'flattenButtonVariant',
7
+ description: `Flatten deprecated button props into single variant prop`,
8
+
9
+ run: async (props: Props & { selectedDirs?: string[] }) => {
10
+ spinStart('Running codemod...');
11
+
12
+ await flattenButtonVariant({ selectedDirs: props.selectedDirs });
13
+
14
+ spinStop('Codemod complete! Peek the diff and commit your changes!');
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ // The typecheck script is not able to find the `flattenColorPalette` function from TailwindCSS.
2
+ declare module 'tailwindcss/lib/util/flattenColorPalette';
package/cli/tsconfig.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
3
  "display": "Default",
4
- "include": ["."],
5
- "exclude": ["node_modules"],
4
+ "include": [
5
+ "."
6
+ ],
7
+ "exclude": [
8
+ "node_modules"
9
+ ],
6
10
  "compilerOptions": {
7
11
  "composite": false,
8
12
  "declaration": true,
@@ -16,16 +20,34 @@
16
20
  "preserveWatchOutput": true,
17
21
  "skipLibCheck": true,
18
22
  "strict": true,
19
- "types": ["bun-types"],
23
+ "types": [
24
+ "bun-types"
25
+ ],
20
26
  "target": "esnext",
21
- "lib": ["ESNext"],
27
+ "lib": [
28
+ "ESNext"
29
+ ],
22
30
  "module": "esnext",
23
31
  "moduleResolution": "bundler",
24
32
  "paths": {
25
- "@yahoo/uds/scripts/*": ["../scripts/*"],
26
- "@yahoo/uds/*": ["../src/*"],
27
- "@yahoo/uds/tailwind/tsMorph": ["../scripts/utils/tsMorph.ts"],
28
- "root/*": ["../../*"]
33
+ "~/*": [
34
+ "../src/*"
35
+ ],
36
+ "@yahoo/uds/scripts/*": [
37
+ "../scripts/*"
38
+ ],
39
+ // "@yahoo/uds/tokens": [
40
+ // "../src/tokens/index.ts"
41
+ // ],
42
+ "@yahoo/uds/tailwind/purger": [
43
+ "../src/tailwind/purger/index.ts"
44
+ ],
45
+ "@yahoo/uds/tailwind/tsMorph": [
46
+ "../scripts/utils/tsMorph.ts"
47
+ ],
48
+ "root/*": [
49
+ "../../*"
50
+ ]
29
51
  }
30
52
  }
31
53
  }
@@ -8,7 +8,7 @@ import { eq, gte } from 'semver';
8
8
  import { ConfigWorkerThreadMessageEvent } from './types';
9
9
 
10
10
  const PRODUCTION_PREFIX = 'https://config.uds.build';
11
- const STAGING_PREFIX = 'https://staging.uds.build';
11
+ const STAGING_PREFIX = 'https://staging.config.uds.build';
12
12
  const LOCAL_PORT = process.env.PORT || 4001;
13
13
  const LOCAL_PREFIX = `http://localhost:${LOCAL_PORT}`;
14
14
 
@@ -8,14 +8,14 @@ import {
8
8
  } from '@yahoo/uds/tailwind/purger';
9
9
  import { findReferencesAsJsxElements, getUsedPropsInReference } from '@yahoo/uds/tailwind/tsMorph';
10
10
  import {
11
- ColorModeConfig,
11
+ type ColorModeConfig,
12
12
  DARK_COLOR_MODE_CLASSNAME,
13
13
  LARGE_SCALE_MODE_CLASSNAME,
14
14
  LIGHT_COLOR_MODE_CLASSNAME,
15
15
  MEDIUM_SCALE_MODE_CLASSNAME,
16
- ScaleModeConfig,
16
+ type ScaleModeConfig,
17
17
  SMALL_SCALE_MODE_CLASSNAME,
18
- UniversalTokensConfig,
18
+ type UniversalTokensConfig,
19
19
  variants,
20
20
  XLARGE_SCALE_MODE_CLASSNAME,
21
21
  XSMALL_SCALE_MODE_CLASSNAME,
@@ -2,6 +2,11 @@ export function sortKeys<T extends Record<string, unknown>>(
2
2
  unsortedObj: T,
3
3
  ): Record<string, unknown> {
4
4
  const sortedObj: Record<string, unknown> = {}; // Add index signature to allow indexing with a string
5
+
6
+ if (!unsortedObj || typeof unsortedObj !== 'object') {
7
+ return unsortedObj;
8
+ }
9
+
5
10
  const keys = Object.keys(unsortedObj).sort();
6
11
 
7
12
  for (var index in keys) {
@@ -1,4 +1,4 @@
1
- import { ReactNode, PropsWithChildren, Ref } from 'react';
1
+ import { PropsWithChildren, ReactNode, Ref } from 'react';
2
2
  import { SvgIcon, IconSize, IconVariant } from '@yahoo/uds-icons/types';
3
3
 
4
4
  declare const alwaysPalette: {
@@ -8,22 +8,25 @@ declare const alwaysPalette: {
8
8
  current: string;
9
9
  };
10
10
 
11
- type CorePaletteAlias = 'brand' | 'accent' | 'alert' | 'positive' | 'warning';
12
- type BackgroundPaletteAlias = 'primary' | 'secondary';
13
- type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color';
14
- type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted';
11
+ type SharedPrimaryPaletteAlias = 'brand' | 'alert' | 'positive' | 'warning' | 'info';
12
+ type SharedSecondaryPaletteAlias = `${SharedPrimaryPaletteAlias}-secondary`;
13
+ type SharedPaletteAlias = SharedPrimaryPaletteAlias | SharedSecondaryPaletteAlias;
14
+ type DeprecatedAccentAlias = 'accent';
15
+ type BackgroundPaletteAlias = 'primary' | 'secondary' | DeprecatedAccentAlias | SharedPaletteAlias;
16
+ type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color' | DeprecatedAccentAlias | SharedPaletteAlias;
17
+ type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | DeprecatedAccentAlias | SharedPaletteAlias;
15
18
  type AlwaysPalette = typeof alwaysPalette;
16
19
  type AlwaysPaletteAlias = keyof AlwaysPalette;
17
- type ForegroundColor = CorePaletteAlias | ForegroundPaletteAlias | AlwaysPaletteAlias;
18
- type LineColor = CorePaletteAlias | LinePaletteAlias | AlwaysPaletteAlias;
19
- type BackgroundColor = CorePaletteAlias | BackgroundPaletteAlias | AlwaysPaletteAlias;
20
- type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'caption1' | 'caption2' | 'legal1';
20
+ type ForegroundColor = ForegroundPaletteAlias | AlwaysPaletteAlias;
21
+ type LineColor = LinePaletteAlias | AlwaysPaletteAlias;
22
+ type BackgroundColor = BackgroundPaletteAlias | AlwaysPaletteAlias;
23
+ type ShadowVariant = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
24
+ type ShadowVariantInvert = `${Exclude<ShadowVariant, 'none'>}-invert`;
25
+ type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'label3' | 'label4' | 'caption1' | 'caption2' | 'legal1';
21
26
  type FontAlias = 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono';
22
27
  type FontWeightDescriptive = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
23
28
  type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
24
29
  type TShirtSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
25
- type TShirtSizeCommon = Extract<TShirtSize, 'sm' | 'md' | 'lg'>;
26
- type AvatarSize = TShirtSizeCommon;
27
30
  type SpacingAlias = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '3.5' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '14' | '16' | '20' | '24' | '28' | '32' | '36' | '40' | '44' | '48' | '52' | '56' | '60' | '64' | '72' | '80' | '96';
28
31
  type BorderRadius = TShirtSize;
29
32
  type BorderWidth = 'none' | 'thin' | 'medium' | 'thick';
@@ -40,12 +43,6 @@ type FlexBasis = 'min-content';
40
43
  type Display = 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'table' | 'inline-table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row-group' | 'table-row' | 'flow-root' | 'grid' | 'contents';
41
44
  type Overflow = 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
42
45
  type Position = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
43
- type ImageStyleProps = {
44
- /**
45
- * Determines how the image should be resized to fit its container.
46
- */
47
- contentFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
48
- };
49
46
  interface BorderStyleProps {
50
47
  /** Add a border radius to all corners of the box. */
51
48
  borderRadius?: BorderRadius;
@@ -82,6 +79,12 @@ interface BorderStyleProps {
82
79
  /** Sets the width of the bottom border of an element. */
83
80
  borderBottomWidth?: BorderWidth;
84
81
  }
82
+ interface ShadowStyleProps {
83
+ /** Sets the variant of the shadow. */
84
+ dropShadow?: ShadowVariant;
85
+ /** Sets the variant of the inset shadow. */
86
+ insetShadow?: ShadowVariant | ShadowVariantInvert;
87
+ }
85
88
  interface LayoutStyleProps {
86
89
  /** Sets whether an element is treated as a block or inline box and the layout used for its children, such as flow layout, grid or flex. */
87
90
  display?: Display;
@@ -178,7 +181,7 @@ interface SizeStyleProps {
178
181
  /** Sets the height of an element. */
179
182
  height?: 'full' | 'fit' | 'screen';
180
183
  }
181
- interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps, SizeStyleProps {
184
+ interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps, SizeStyleProps, ShadowStyleProps {
182
185
  /**
183
186
  * When asChild is set to true, the component's child will be cloned and passed
184
187
  * the props and behavior required to make it functional.
@@ -205,54 +208,8 @@ interface UniversalIconProps {
205
208
  /** Color of the icon. */
206
209
  color?: ForegroundColor;
207
210
  }
208
- interface UniversalImageProps extends Omit<UniversalBoxProps, 'width' | 'height'>, ImageStyleProps {
209
- /** The source URL of the image. */
210
- src: string;
211
- /** Provides fallback (alternate) text to display when the image specified by the Image element is not loaded. */
212
- alt?: string;
213
- /** Width of the image in px. */
214
- width?: number;
215
- /** Height of the image in pixel. */
216
- height?: number;
217
- }
218
- interface UniversalAvatarProps extends UniversalImageProps {
219
- /** The size of the Avatar. */
220
- size?: AvatarSize;
221
- /** The shape of the Avatar. */
222
- shape?: BorderRadius;
223
- }
224
- interface UniversalTextInputProps {
225
- disabled?: boolean;
226
- required?: boolean;
227
- backgroundColor?: BackgroundColor;
228
- borderColor?: LineColor;
229
- borderWidth?: BorderWidth;
230
- borderRadius?: BorderRadius;
231
- color?: ForegroundColor;
232
- fontSize?: TextVariant;
233
- placeholderColor?: ForegroundColor;
234
- spacingVertical?: SpacingAlias;
235
- spacingHorizontal?: SpacingAlias;
236
- }
237
- type DividerVariant = 'primary' | 'secondary' | 'tertiary' | 'muted';
238
- interface UniversalDividerProps {
239
- /**
240
- * Use a pre-defined variant.
241
- * @default 'primary'
242
- */
243
- variant?: DividerVariant;
244
- /**
245
- * Set to true to scale the divider vertically.
246
- */
247
- vertical?: boolean;
248
- /** Override thickness of the divider set by the variant. */
249
- thickness?: BorderWidth;
250
- /** Override color of the divider set by the variant. */
251
- color?: LineColor;
252
- /** When there are children, where are they placed?
253
- * @default 'middle'
254
- */
255
- contentPosition?: 'start' | 'middle' | 'end';
211
+ type SVGElementProps = Omit<React.HTMLAttributes<SVGSVGElement>, 'color'>;
212
+ interface IconPropsWithSVGProps extends UniversalIconProps, SVGElementProps {
256
213
  }
257
214
 
258
215
  type DivProps = React.HTMLAttributes<HTMLDivElement>;
@@ -260,11 +217,15 @@ interface BoxProps extends UniversalBoxProps, DivProps {
260
217
  }
261
218
 
262
219
  type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
220
+ type ColorWithInherit = Exclude<UniversalTextProps['color'], undefined> | 'inherit';
221
+ type VariantWithInherit = Exclude<UniversalTextProps['variant'], undefined> | 'inherit';
263
222
  type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
264
223
  /** Ref passed to the inner container. */
265
224
  ref?: Ref<HTMLElement>;
266
225
  /** Changes the HTML tag used to render text. Uses the most appropriate semantic tag based on the text style variant. */
267
226
  as?: TagName;
268
- } & JSX.IntrinsicElements[TagName] & UniversalTextProps;
227
+ variant?: VariantWithInherit;
228
+ color?: ColorWithInherit;
229
+ } & JSX.IntrinsicElements[TagName] & Omit<UniversalTextProps, 'variant' | 'color'>;
269
230
 
270
- export type { BoxProps as B, DivProps as D, Overflow as O, SpacingStyleProps as S, TextProps as T, UniversalAvatarProps as U, UniversalStackProps as a, UniversalDividerProps as b, UniversalTextProps as c, UniversalIconProps as d, UniversalTextInputProps as e };
231
+ export type { BoxProps as B, DivProps as D, IconPropsWithSVGProps as I, Overflow as O, TextProps as T, UniversalTextProps as U, UniversalStackProps as a };
@@ -1,4 +1,4 @@
1
- import { ReactNode, PropsWithChildren, Ref } from 'react';
1
+ import { PropsWithChildren, ReactNode, Ref } from 'react';
2
2
  import { SvgIcon, IconSize, IconVariant } from '@yahoo/uds-icons/types';
3
3
 
4
4
  declare const alwaysPalette: {
@@ -8,22 +8,25 @@ declare const alwaysPalette: {
8
8
  current: string;
9
9
  };
10
10
 
11
- type CorePaletteAlias = 'brand' | 'accent' | 'alert' | 'positive' | 'warning';
12
- type BackgroundPaletteAlias = 'primary' | 'secondary';
13
- type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color';
14
- type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted';
11
+ type SharedPrimaryPaletteAlias = 'brand' | 'alert' | 'positive' | 'warning' | 'info';
12
+ type SharedSecondaryPaletteAlias = `${SharedPrimaryPaletteAlias}-secondary`;
13
+ type SharedPaletteAlias = SharedPrimaryPaletteAlias | SharedSecondaryPaletteAlias;
14
+ type DeprecatedAccentAlias = 'accent';
15
+ type BackgroundPaletteAlias = 'primary' | 'secondary' | DeprecatedAccentAlias | SharedPaletteAlias;
16
+ type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color' | DeprecatedAccentAlias | SharedPaletteAlias;
17
+ type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | DeprecatedAccentAlias | SharedPaletteAlias;
15
18
  type AlwaysPalette = typeof alwaysPalette;
16
19
  type AlwaysPaletteAlias = keyof AlwaysPalette;
17
- type ForegroundColor = CorePaletteAlias | ForegroundPaletteAlias | AlwaysPaletteAlias;
18
- type LineColor = CorePaletteAlias | LinePaletteAlias | AlwaysPaletteAlias;
19
- type BackgroundColor = CorePaletteAlias | BackgroundPaletteAlias | AlwaysPaletteAlias;
20
- type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'caption1' | 'caption2' | 'legal1';
20
+ type ForegroundColor = ForegroundPaletteAlias | AlwaysPaletteAlias;
21
+ type LineColor = LinePaletteAlias | AlwaysPaletteAlias;
22
+ type BackgroundColor = BackgroundPaletteAlias | AlwaysPaletteAlias;
23
+ type ShadowVariant = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
24
+ type ShadowVariantInvert = `${Exclude<ShadowVariant, 'none'>}-invert`;
25
+ type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'label3' | 'label4' | 'caption1' | 'caption2' | 'legal1';
21
26
  type FontAlias = 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono';
22
27
  type FontWeightDescriptive = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
23
28
  type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
24
29
  type TShirtSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
25
- type TShirtSizeCommon = Extract<TShirtSize, 'sm' | 'md' | 'lg'>;
26
- type AvatarSize = TShirtSizeCommon;
27
30
  type SpacingAlias = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '3.5' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '14' | '16' | '20' | '24' | '28' | '32' | '36' | '40' | '44' | '48' | '52' | '56' | '60' | '64' | '72' | '80' | '96';
28
31
  type BorderRadius = TShirtSize;
29
32
  type BorderWidth = 'none' | 'thin' | 'medium' | 'thick';
@@ -40,12 +43,6 @@ type FlexBasis = 'min-content';
40
43
  type Display = 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'table' | 'inline-table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row-group' | 'table-row' | 'flow-root' | 'grid' | 'contents';
41
44
  type Overflow = 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
42
45
  type Position = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
43
- type ImageStyleProps = {
44
- /**
45
- * Determines how the image should be resized to fit its container.
46
- */
47
- contentFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
48
- };
49
46
  interface BorderStyleProps {
50
47
  /** Add a border radius to all corners of the box. */
51
48
  borderRadius?: BorderRadius;
@@ -82,6 +79,12 @@ interface BorderStyleProps {
82
79
  /** Sets the width of the bottom border of an element. */
83
80
  borderBottomWidth?: BorderWidth;
84
81
  }
82
+ interface ShadowStyleProps {
83
+ /** Sets the variant of the shadow. */
84
+ dropShadow?: ShadowVariant;
85
+ /** Sets the variant of the inset shadow. */
86
+ insetShadow?: ShadowVariant | ShadowVariantInvert;
87
+ }
85
88
  interface LayoutStyleProps {
86
89
  /** Sets whether an element is treated as a block or inline box and the layout used for its children, such as flow layout, grid or flex. */
87
90
  display?: Display;
@@ -178,7 +181,7 @@ interface SizeStyleProps {
178
181
  /** Sets the height of an element. */
179
182
  height?: 'full' | 'fit' | 'screen';
180
183
  }
181
- interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps, SizeStyleProps {
184
+ interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps, SizeStyleProps, ShadowStyleProps {
182
185
  /**
183
186
  * When asChild is set to true, the component's child will be cloned and passed
184
187
  * the props and behavior required to make it functional.
@@ -205,54 +208,8 @@ interface UniversalIconProps {
205
208
  /** Color of the icon. */
206
209
  color?: ForegroundColor;
207
210
  }
208
- interface UniversalImageProps extends Omit<UniversalBoxProps, 'width' | 'height'>, ImageStyleProps {
209
- /** The source URL of the image. */
210
- src: string;
211
- /** Provides fallback (alternate) text to display when the image specified by the Image element is not loaded. */
212
- alt?: string;
213
- /** Width of the image in px. */
214
- width?: number;
215
- /** Height of the image in pixel. */
216
- height?: number;
217
- }
218
- interface UniversalAvatarProps extends UniversalImageProps {
219
- /** The size of the Avatar. */
220
- size?: AvatarSize;
221
- /** The shape of the Avatar. */
222
- shape?: BorderRadius;
223
- }
224
- interface UniversalTextInputProps {
225
- disabled?: boolean;
226
- required?: boolean;
227
- backgroundColor?: BackgroundColor;
228
- borderColor?: LineColor;
229
- borderWidth?: BorderWidth;
230
- borderRadius?: BorderRadius;
231
- color?: ForegroundColor;
232
- fontSize?: TextVariant;
233
- placeholderColor?: ForegroundColor;
234
- spacingVertical?: SpacingAlias;
235
- spacingHorizontal?: SpacingAlias;
236
- }
237
- type DividerVariant = 'primary' | 'secondary' | 'tertiary' | 'muted';
238
- interface UniversalDividerProps {
239
- /**
240
- * Use a pre-defined variant.
241
- * @default 'primary'
242
- */
243
- variant?: DividerVariant;
244
- /**
245
- * Set to true to scale the divider vertically.
246
- */
247
- vertical?: boolean;
248
- /** Override thickness of the divider set by the variant. */
249
- thickness?: BorderWidth;
250
- /** Override color of the divider set by the variant. */
251
- color?: LineColor;
252
- /** When there are children, where are they placed?
253
- * @default 'middle'
254
- */
255
- contentPosition?: 'start' | 'middle' | 'end';
211
+ type SVGElementProps = Omit<React.HTMLAttributes<SVGSVGElement>, 'color'>;
212
+ interface IconPropsWithSVGProps extends UniversalIconProps, SVGElementProps {
256
213
  }
257
214
 
258
215
  type DivProps = React.HTMLAttributes<HTMLDivElement>;
@@ -260,11 +217,15 @@ interface BoxProps extends UniversalBoxProps, DivProps {
260
217
  }
261
218
 
262
219
  type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
220
+ type ColorWithInherit = Exclude<UniversalTextProps['color'], undefined> | 'inherit';
221
+ type VariantWithInherit = Exclude<UniversalTextProps['variant'], undefined> | 'inherit';
263
222
  type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
264
223
  /** Ref passed to the inner container. */
265
224
  ref?: Ref<HTMLElement>;
266
225
  /** Changes the HTML tag used to render text. Uses the most appropriate semantic tag based on the text style variant. */
267
226
  as?: TagName;
268
- } & JSX.IntrinsicElements[TagName] & UniversalTextProps;
227
+ variant?: VariantWithInherit;
228
+ color?: ColorWithInherit;
229
+ } & JSX.IntrinsicElements[TagName] & Omit<UniversalTextProps, 'variant' | 'color'>;
269
230
 
270
- export type { BoxProps as B, DivProps as D, Overflow as O, SpacingStyleProps as S, TextProps as T, UniversalAvatarProps as U, UniversalStackProps as a, UniversalDividerProps as b, UniversalTextProps as c, UniversalIconProps as d, UniversalTextInputProps as e };
231
+ export type { BoxProps as B, DivProps as D, IconPropsWithSVGProps as I, Overflow as O, TextProps as T, UniversalTextProps as U, UniversalStackProps as a };