@primer/primitives 11.4.1-rc.8b516966 → 11.4.1-rc.d0049059

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 (72) hide show
  1. package/dist/build/formats/jsonFigma.js +8 -1
  2. package/dist/build/schemas/borderToken.d.ts +4 -4
  3. package/dist/build/schemas/dimensionToken.d.ts +2 -2
  4. package/dist/build/schemas/dimensionValue.d.ts +1 -13
  5. package/dist/build/schemas/dimensionValue.js +1 -23
  6. package/dist/build/schemas/shadowToken.d.ts +168 -168
  7. package/dist/build/schemas/typographyToken.d.ts +8 -8
  8. package/dist/build/transformers/borderToCss.js +17 -1
  9. package/dist/build/transformers/shadowToCss.js +12 -1
  10. package/dist/build/types/borderTokenValue.d.ts +3 -1
  11. package/dist/build/types/shadowTokenValue.d.ts +6 -4
  12. package/dist/css/functional/themes/dark-colorblind-high-contrast.css +28 -28
  13. package/dist/css/functional/themes/dark-colorblind.css +28 -28
  14. package/dist/css/functional/themes/dark-dimmed-high-contrast.css +28 -28
  15. package/dist/css/functional/themes/dark-dimmed.css +28 -28
  16. package/dist/css/functional/themes/dark-high-contrast.css +28 -28
  17. package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +28 -28
  18. package/dist/css/functional/themes/dark-tritanopia.css +28 -28
  19. package/dist/css/functional/themes/dark.css +28 -28
  20. package/dist/css/functional/themes/light-colorblind-high-contrast.css +28 -28
  21. package/dist/css/functional/themes/light-colorblind.css +28 -28
  22. package/dist/css/functional/themes/light-high-contrast.css +28 -28
  23. package/dist/css/functional/themes/light-tritanopia-high-contrast.css +28 -28
  24. package/dist/css/functional/themes/light-tritanopia.css +28 -28
  25. package/dist/css/functional/themes/light.css +28 -28
  26. package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +1314 -339
  27. package/dist/docs/functional/themes/dark-colorblind.json +1314 -339
  28. package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +1314 -339
  29. package/dist/docs/functional/themes/dark-dimmed.json +1314 -339
  30. package/dist/docs/functional/themes/dark-high-contrast.json +1314 -339
  31. package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +1314 -339
  32. package/dist/docs/functional/themes/dark-tritanopia.json +1314 -339
  33. package/dist/docs/functional/themes/dark.json +1314 -339
  34. package/dist/docs/functional/themes/light-colorblind-high-contrast.json +1314 -339
  35. package/dist/docs/functional/themes/light-colorblind.json +1314 -339
  36. package/dist/docs/functional/themes/light-high-contrast.json +1314 -339
  37. package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +1314 -339
  38. package/dist/docs/functional/themes/light-tritanopia.json +1314 -339
  39. package/dist/docs/functional/themes/light.json +1314 -339
  40. package/dist/internalCss/dark-colorblind-high-contrast.css +28 -28
  41. package/dist/internalCss/dark-colorblind.css +28 -28
  42. package/dist/internalCss/dark-dimmed-high-contrast.css +28 -28
  43. package/dist/internalCss/dark-dimmed.css +28 -28
  44. package/dist/internalCss/dark-high-contrast.css +28 -28
  45. package/dist/internalCss/dark-tritanopia-high-contrast.css +28 -28
  46. package/dist/internalCss/dark-tritanopia.css +28 -28
  47. package/dist/internalCss/dark.css +28 -28
  48. package/dist/internalCss/light-colorblind-high-contrast.css +28 -28
  49. package/dist/internalCss/light-colorblind.css +28 -28
  50. package/dist/internalCss/light-high-contrast.css +28 -28
  51. package/dist/internalCss/light-tritanopia-high-contrast.css +28 -28
  52. package/dist/internalCss/light-tritanopia.css +28 -28
  53. package/dist/internalCss/light.css +28 -28
  54. package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +1449 -366
  55. package/dist/styleLint/functional/themes/dark-colorblind.json +1449 -366
  56. package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +1449 -366
  57. package/dist/styleLint/functional/themes/dark-dimmed.json +1449 -366
  58. package/dist/styleLint/functional/themes/dark-high-contrast.json +1449 -366
  59. package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +1449 -366
  60. package/dist/styleLint/functional/themes/dark-tritanopia.json +1449 -366
  61. package/dist/styleLint/functional/themes/dark.json +1449 -366
  62. package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +1449 -366
  63. package/dist/styleLint/functional/themes/light-colorblind.json +1449 -366
  64. package/dist/styleLint/functional/themes/light-high-contrast.json +1449 -366
  65. package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +1449 -366
  66. package/dist/styleLint/functional/themes/light-tritanopia.json +1449 -366
  67. package/dist/styleLint/functional/themes/light.json +1449 -366
  68. package/package.json +1 -1
  69. package/src/tokens/component/avatar.json5 +72 -44
  70. package/src/tokens/component/button.json5 +1545 -1193
  71. package/src/tokens/functional/border/border.json5 +4 -1
  72. package/src/tokens/functional/shadow/shadow.json5 +640 -160
@@ -35,10 +35,17 @@ const getFigmaType = (type) => {
35
35
  throw new Error(`Invalid type: ${type}`);
36
36
  };
37
37
  const shadowToVariables = (name, values, token) => {
38
+ // Helper to extract numeric value from W3C dimension object
39
+ const getDimensionValue = (dim) => {
40
+ if (typeof dim === 'object' && 'value' in dim) {
41
+ return dim.value;
42
+ }
43
+ throw new Error(`Invalid shadow dimension: expected W3C object format, got ${JSON.stringify(dim)}`);
44
+ };
38
45
  // floatValue
39
46
  const floatValue = (property) => ({
40
47
  name: `${name}/${property}`,
41
- value: parseInt(values[property].replace('px', '')),
48
+ value: getDimensionValue(values[property]),
42
49
  type: 'FLOAT',
43
50
  scopes: ['EFFECT_FLOAT'],
44
51
  mode,
@@ -11,14 +11,14 @@ export declare const borderValue: z.ZodObject<{
11
11
  ridge: "ridge";
12
12
  outset: "outset";
13
13
  }>;
14
- width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
14
+ width: z.ZodUnion<readonly [z.ZodObject<{
15
15
  value: z.ZodNumber;
16
16
  unit: z.ZodEnum<{
17
17
  em: "em";
18
18
  px: "px";
19
19
  rem: "rem";
20
20
  }>;
21
- }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
21
+ }, z.core.$strict>, z.ZodString]>;
22
22
  }, z.core.$strip>;
23
23
  export declare const borderToken: z.ZodObject<{
24
24
  $description: z.ZodOptional<z.ZodString>;
@@ -35,14 +35,14 @@ export declare const borderToken: z.ZodObject<{
35
35
  ridge: "ridge";
36
36
  outset: "outset";
37
37
  }>;
38
- width: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
38
+ width: z.ZodUnion<readonly [z.ZodObject<{
39
39
  value: z.ZodNumber;
40
40
  unit: z.ZodEnum<{
41
41
  em: "em";
42
42
  px: "px";
43
43
  rem: "rem";
44
44
  }>;
45
- }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
45
+ }, z.core.$strict>, z.ZodString]>;
46
46
  }, z.core.$strip>, z.ZodString]>;
47
47
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
48
48
  $extensions: z.ZodOptional<z.ZodObject<{
@@ -2,14 +2,14 @@ import { z } from 'zod';
2
2
  export declare const dimensionToken: z.ZodObject<{
3
3
  $description: z.ZodOptional<z.ZodString>;
4
4
  $deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
5
- $value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
5
+ $value: z.ZodUnion<readonly [z.ZodObject<{
6
6
  value: z.ZodNumber;
7
7
  unit: z.ZodEnum<{
8
8
  em: "em";
9
9
  px: "px";
10
10
  rem: "rem";
11
11
  }>;
12
- }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>, z.ZodString]>;
12
+ }, z.core.$strict>, z.ZodString]>;
13
13
  $type: z.ZodLiteral<"string" | "number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange">;
14
14
  $extensions: z.ZodOptional<z.ZodObject<{
15
15
  'org.primer.figma': z.ZodOptional<z.ZodObject<{
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  * W3C DTCG dimension value format
4
4
  * @link https://www.designtokens.org/tr/drafts/format/#dimension
5
5
  */
6
- export declare const dimensionValueObject: z.ZodObject<{
6
+ export declare const dimensionValue: z.ZodObject<{
7
7
  value: z.ZodNumber;
8
8
  unit: z.ZodEnum<{
9
9
  em: "em";
@@ -11,15 +11,3 @@ export declare const dimensionValueObject: z.ZodObject<{
11
11
  rem: "rem";
12
12
  }>;
13
13
  }, z.core.$strict>;
14
- /**
15
- * Dimension value - supports both W3C DTCG object format and legacy string format
16
- * Note: Transformers only accept W3C format, but schema validates both for migration period
17
- */
18
- export declare const dimensionValue: z.ZodUnion<readonly [z.ZodObject<{
19
- value: z.ZodNumber;
20
- unit: z.ZodEnum<{
21
- em: "em";
22
- px: "px";
23
- rem: "rem";
24
- }>;
25
- }, z.core.$strict>, z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0">, z.ZodLiteral<0>]>]>;
@@ -1,33 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { schemaErrorMessage } from '../utilities/index.js';
3
2
  /**
4
3
  * W3C DTCG dimension value format
5
4
  * @link https://www.designtokens.org/tr/drafts/format/#dimension
6
5
  */
7
- export const dimensionValueObject = z
6
+ export const dimensionValue = z
8
7
  .object({
9
8
  value: z.number(),
10
9
  unit: z.enum(['px', 'rem', 'em']),
11
10
  })
12
11
  .strict();
13
- /**
14
- * Legacy dimension value format (string with unit)
15
- * @deprecated Use W3C DTCG object format instead
16
- */
17
- const dimensionValueLegacy = z.union([
18
- z.string().superRefine((dim, ctx) => {
19
- if (!/(^-?[0-9]+\.?[0-9]*(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) {
20
- ctx.addIssue({
21
- code: 'custom',
22
- message: schemaErrorMessage(`Invalid dimension: "${dim}"`, `Dimension must be a string with a unit (px, rem or em) or 0`),
23
- });
24
- }
25
- }),
26
- z.literal('0'),
27
- z.literal(0),
28
- ]);
29
- /**
30
- * Dimension value - supports both W3C DTCG object format and legacy string format
31
- * Note: Transformers only accept W3C format, but schema validates both for migration period
32
- */
33
- export const dimensionValue = z.union([dimensionValueObject, dimensionValueLegacy]);