@primer/primitives 11.4.1-rc.8b516966 → 11.4.1-rc.d4178e4a
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/DESIGN_TOKENS_GUIDE.md +1 -1
- package/dist/build/formats/jsonFigma.js +8 -1
- package/dist/build/schemas/borderToken.d.ts +5 -5
- package/dist/build/schemas/colorToken.d.ts +1 -1
- package/dist/build/schemas/cubicBezierToken.d.ts +1 -1
- package/dist/build/schemas/dimensionToken.d.ts +3 -3
- package/dist/build/schemas/dimensionValue.d.ts +1 -13
- package/dist/build/schemas/dimensionValue.js +1 -23
- package/dist/build/schemas/durationToken.d.ts +1 -1
- package/dist/build/schemas/fontFamilyToken.d.ts +1 -1
- package/dist/build/schemas/fontWeightToken.d.ts +1 -1
- package/dist/build/schemas/gradientToken.d.ts +1 -1
- package/dist/build/schemas/numberToken.d.ts +1 -1
- package/dist/build/schemas/shadowToken.d.ts +169 -169
- package/dist/build/schemas/stringToken.d.ts +1 -1
- package/dist/build/schemas/stringToken.js +1 -1
- package/dist/build/schemas/tokenType.d.ts +1 -1
- package/dist/build/schemas/transitionToken.d.ts +1 -1
- package/dist/build/schemas/typographyToken.d.ts +7 -21
- package/dist/build/schemas/typographyToken.js +1 -1
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +1 -1
- package/dist/build/schemas/viewportRangeToken.d.ts +1 -1
- package/dist/build/transformers/borderToCss.js +17 -1
- package/dist/build/transformers/shadowToCss.js +12 -1
- package/dist/build/types/borderTokenValue.d.ts +3 -1
- package/dist/build/types/shadowTokenValue.d.ts +6 -4
- package/dist/css/functional/themes/dark-colorblind-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-colorblind.css +28 -28
- package/dist/css/functional/themes/dark-dimmed-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-dimmed.css +28 -28
- package/dist/css/functional/themes/dark-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +28 -28
- package/dist/css/functional/themes/dark-tritanopia.css +28 -28
- package/dist/css/functional/themes/dark.css +28 -28
- package/dist/css/functional/themes/light-colorblind-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-colorblind.css +28 -28
- package/dist/css/functional/themes/light-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-tritanopia-high-contrast.css +28 -28
- package/dist/css/functional/themes/light-tritanopia.css +28 -28
- package/dist/css/functional/themes/light.css +28 -28
- package/dist/docs/functional/size/border.json +6 -6
- package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/dark-colorblind.json +1314 -339
- package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/dark-dimmed.json +1314 -339
- package/dist/docs/functional/themes/dark-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/dark-tritanopia.json +1314 -339
- package/dist/docs/functional/themes/dark.json +1314 -339
- package/dist/docs/functional/themes/light-colorblind-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/light-colorblind.json +1314 -339
- package/dist/docs/functional/themes/light-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +1314 -339
- package/dist/docs/functional/themes/light-tritanopia.json +1314 -339
- package/dist/docs/functional/themes/light.json +1314 -339
- package/dist/internalCss/dark-colorblind-high-contrast.css +28 -28
- package/dist/internalCss/dark-colorblind.css +28 -28
- package/dist/internalCss/dark-dimmed-high-contrast.css +28 -28
- package/dist/internalCss/dark-dimmed.css +28 -28
- package/dist/internalCss/dark-high-contrast.css +28 -28
- package/dist/internalCss/dark-tritanopia-high-contrast.css +28 -28
- package/dist/internalCss/dark-tritanopia.css +28 -28
- package/dist/internalCss/dark.css +28 -28
- package/dist/internalCss/light-colorblind-high-contrast.css +28 -28
- package/dist/internalCss/light-colorblind.css +28 -28
- package/dist/internalCss/light-high-contrast.css +28 -28
- package/dist/internalCss/light-tritanopia-high-contrast.css +28 -28
- package/dist/internalCss/light-tritanopia.css +28 -28
- package/dist/internalCss/light.css +28 -28
- package/dist/styleLint/functional/size/border.json +6 -6
- package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/dark-colorblind.json +1449 -366
- package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/dark-dimmed.json +1449 -366
- package/dist/styleLint/functional/themes/dark-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/dark-tritanopia.json +1449 -366
- package/dist/styleLint/functional/themes/dark.json +1449 -366
- package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/light-colorblind.json +1449 -366
- package/dist/styleLint/functional/themes/light-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +1449 -366
- package/dist/styleLint/functional/themes/light-tritanopia.json +1449 -366
- package/dist/styleLint/functional/themes/light.json +1449 -366
- package/package.json +1 -1
- package/src/tokens/component/avatar.json5 +72 -44
- package/src/tokens/component/button.json5 +1545 -1193
- package/src/tokens/functional/border/border.json5 +4 -1
- package/src/tokens/functional/shadow/shadow.json5 +640 -160
- package/src/tokens/functional/size/border.json5 +3 -3
package/DESIGN_TOKENS_GUIDE.md
CHANGED
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
color: var(--fgColor-default);
|
|
120
120
|
border: none;
|
|
121
121
|
border-radius: var(--borderRadius-medium);
|
|
122
|
-
padding-block: var(--control-medium-paddingBlock
|
|
122
|
+
padding-block: var(--control-medium-paddingBlock);
|
|
123
123
|
padding-inline: var(--control-medium-paddingInline-normal);
|
|
124
124
|
font: var(--text-body-shorthand-medium);
|
|
125
125
|
cursor: pointer;
|
|
@@ -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:
|
|
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.
|
|
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.
|
|
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,16 +35,16 @@ export declare const borderToken: z.ZodObject<{
|
|
|
35
35
|
ridge: "ridge";
|
|
36
36
|
outset: "outset";
|
|
37
37
|
}>;
|
|
38
|
-
width: z.ZodUnion<readonly [z.
|
|
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.
|
|
45
|
+
}, z.core.$strict>, z.ZodString]>;
|
|
46
46
|
}, z.core.$strip>, z.ZodString]>;
|
|
47
|
-
$type: z.ZodLiteral<"
|
|
47
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
48
48
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
49
49
|
'org.primer.llm': z.ZodOptional<z.ZodObject<{
|
|
50
50
|
usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -4,7 +4,7 @@ export declare const colorToken: z.ZodObject<{
|
|
|
4
4
|
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
$value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
6
6
|
alpha: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
7
|
-
$type: z.ZodLiteral<"
|
|
7
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
8
8
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
9
9
|
'org.primer.figma': z.ZodOptional<z.ZodObject<{
|
|
10
10
|
collection: z.ZodOptional<z.ZodString>;
|
|
@@ -3,7 +3,7 @@ export declare const cubicBezierToken: z.ZodObject<{
|
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
4
|
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
$value: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodString]>;
|
|
6
|
-
$type: z.ZodLiteral<"
|
|
6
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
7
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
'org.primer.llm': z.ZodOptional<z.ZodObject<{
|
|
9
9
|
usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -2,15 +2,15 @@ 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.
|
|
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.
|
|
13
|
-
$type: z.ZodLiteral<"
|
|
12
|
+
}, z.core.$strict>, z.ZodString]>;
|
|
13
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
14
14
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
15
15
|
'org.primer.figma': z.ZodOptional<z.ZodObject<{
|
|
16
16
|
collection: z.ZodString;
|
|
@@ -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
|
|
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
|
|
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]);
|
|
@@ -9,7 +9,7 @@ export declare const durationToken: z.ZodObject<{
|
|
|
9
9
|
ms: "ms";
|
|
10
10
|
}>;
|
|
11
11
|
}, z.core.$strict>, z.ZodString]>;
|
|
12
|
-
$type: z.ZodLiteral<"
|
|
12
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
13
13
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
14
14
|
'org.primer.llm': z.ZodOptional<z.ZodObject<{
|
|
15
15
|
usage: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -3,7 +3,7 @@ export declare const fontFamilyToken: z.ZodObject<{
|
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
4
|
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
$value: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
6
|
-
$type: z.ZodLiteral<"
|
|
6
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
7
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
'org.primer.figma': z.ZodObject<{
|
|
9
9
|
collection: z.ZodOptional<z.ZodString>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const fontWeightToken: z.ZodObject<{
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
4
|
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
$type: z.ZodLiteral<"
|
|
5
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
6
6
|
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
7
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
'org.primer.figma': z.ZodObject<{
|
|
@@ -6,7 +6,7 @@ export declare const gradientToken: z.ZodObject<{
|
|
|
6
6
|
color: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
7
7
|
position: z.ZodNumber;
|
|
8
8
|
}, z.core.$strip>>, z.ZodString]>;
|
|
9
|
-
$type: z.ZodLiteral<"
|
|
9
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
10
10
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
11
11
|
'org.primer.gradient': z.ZodObject<{
|
|
12
12
|
angle: z.ZodOptional<z.ZodNumber>;
|
|
@@ -3,7 +3,7 @@ export declare const numberToken: z.ZodObject<{
|
|
|
3
3
|
$description: z.ZodOptional<z.ZodString>;
|
|
4
4
|
$deprecated: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
5
5
|
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
6
|
-
$type: z.ZodLiteral<"
|
|
6
|
+
$type: z.ZodLiteral<"number" | "border" | "color" | "fontFamily" | "fontWeight" | "transition" | "dimension" | "duration" | "gradient" | "shadow" | "typography" | "cubicBezier" | "custom-viewportRange" | "custom-string">;
|
|
7
7
|
$extensions: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
'org.primer.data': z.ZodOptional<z.ZodObject<{
|
|
9
9
|
fontSize: z.ZodOptional<z.ZodNumber>;
|