@atlaskit/primitives 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/constellation/box/examples.mdx +16 -8
- package/constellation/box/usage.mdx +12 -12
- package/constellation/inline/examples.mdx +15 -5
- package/constellation/inline/usage.mdx +9 -12
- package/constellation/stack/examples.mdx +18 -7
- package/constellation/stack/usage.mdx +7 -10
- package/constellation/xcss/examples.mdx +3 -3
- package/constellation/xcss/migration.mdx +13 -20
- package/constellation/xcss/usage.mdx +19 -18
- package/dist/cjs/components/text.js +7 -1
- package/dist/cjs/xcss/style-maps.partial.js +38 -22
- package/dist/cjs/xcss/xcss.js +27 -0
- package/dist/es2019/components/text.js +7 -1
- package/dist/es2019/xcss/style-maps.partial.js +36 -21
- package/dist/es2019/xcss/xcss.js +29 -1
- package/dist/esm/components/text.js +7 -1
- package/dist/esm/xcss/style-maps.partial.js +36 -21
- package/dist/esm/xcss/xcss.js +29 -1
- package/dist/types/xcss/style-maps.partial.d.ts +64 -23
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +64 -23
- package/package.json +8 -29
- package/report.api.md +34 -0
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +73 -1
- package/scripts/__tests__/codegen.test.tsx +21 -4
- package/scripts/codegen-styles.tsx +13 -1
- package/scripts/color-codegen-template.tsx +0 -15
- package/scripts/elevation-codegen-template.tsx +94 -0
- package/tmp/api-report-tmp.d.ts +34 -0
|
@@ -101,10 +101,47 @@ export declare const inverseColorMap: {
|
|
|
101
101
|
*/
|
|
102
102
|
/**
|
|
103
103
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
104
|
-
* @codegen <<SignedSource::
|
|
104
|
+
* @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
|
|
105
|
+
* @codegenId elevation
|
|
106
|
+
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
107
|
+
* @codegenParams ["opacity", "shadow", "surface"]
|
|
108
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
109
|
+
*/
|
|
110
|
+
export declare const opacityMap: {
|
|
111
|
+
readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
|
|
112
|
+
readonly 'opacity.loading': "var(--ds-opacity-loading)";
|
|
113
|
+
};
|
|
114
|
+
export type Opacity = keyof typeof opacityMap;
|
|
115
|
+
export declare const shadowMap: {
|
|
116
|
+
readonly 'elevation.shadow.overflow': "var(--ds-shadow-overflow)";
|
|
117
|
+
readonly 'elevation.shadow.overflow.perimeter': "var(--ds-shadow-overflow-perimeter)";
|
|
118
|
+
readonly 'elevation.shadow.overflow.spread': "var(--ds-shadow-overflow-spread)";
|
|
119
|
+
readonly 'elevation.shadow.overlay': "var(--ds-shadow-overlay)";
|
|
120
|
+
readonly 'elevation.shadow.raised': "var(--ds-shadow-raised)";
|
|
121
|
+
};
|
|
122
|
+
export type Shadow = keyof typeof shadowMap;
|
|
123
|
+
export declare const surfaceColorMap: {
|
|
124
|
+
readonly 'elevation.surface': "var(--ds-surface)";
|
|
125
|
+
readonly 'elevation.surface.hovered': "var(--ds-surface-hovered)";
|
|
126
|
+
readonly 'elevation.surface.pressed': "var(--ds-surface-pressed)";
|
|
127
|
+
readonly 'elevation.surface.overlay': "var(--ds-surface-overlay)";
|
|
128
|
+
readonly 'elevation.surface.overlay.hovered': "var(--ds-surface-overlay-hovered)";
|
|
129
|
+
readonly 'elevation.surface.overlay.pressed': "var(--ds-surface-overlay-pressed)";
|
|
130
|
+
readonly 'elevation.surface.raised': "var(--ds-surface-raised)";
|
|
131
|
+
readonly 'elevation.surface.raised.hovered': "var(--ds-surface-raised-hovered)";
|
|
132
|
+
readonly 'elevation.surface.raised.pressed': "var(--ds-surface-raised-pressed)";
|
|
133
|
+
readonly 'elevation.surface.sunken': "var(--ds-surface-sunken)";
|
|
134
|
+
};
|
|
135
|
+
export type SurfaceColor = keyof typeof surfaceColorMap;
|
|
136
|
+
/**
|
|
137
|
+
* @codegenEnd
|
|
138
|
+
*/
|
|
139
|
+
/**
|
|
140
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
141
|
+
* @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
|
|
105
142
|
* @codegenId colors
|
|
106
143
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
107
|
-
* @codegenParams ["border", "background", "
|
|
144
|
+
* @codegenParams ["border", "background", "text", "fill"]
|
|
108
145
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
|
|
109
146
|
*/
|
|
110
147
|
export declare const borderColorMap: {
|
|
@@ -331,14 +368,6 @@ export declare const backgroundColorMap: {
|
|
|
331
368
|
readonly 'utility.elevation.surface.current': "var(--ds-elevation-surface-current)";
|
|
332
369
|
};
|
|
333
370
|
export type BackgroundColor = keyof typeof backgroundColorMap;
|
|
334
|
-
export declare const shadowMap: {
|
|
335
|
-
readonly 'elevation.shadow.overflow': "var(--ds-shadow-overflow)";
|
|
336
|
-
readonly 'elevation.shadow.overflow.perimeter': "var(--ds-shadow-overflow-perimeter)";
|
|
337
|
-
readonly 'elevation.shadow.overflow.spread': "var(--ds-shadow-overflow-spread)";
|
|
338
|
-
readonly 'elevation.shadow.overlay': "var(--ds-shadow-overlay)";
|
|
339
|
-
readonly 'elevation.shadow.raised': "var(--ds-shadow-raised)";
|
|
340
|
-
};
|
|
341
|
-
export type Shadow = keyof typeof shadowMap;
|
|
342
371
|
export declare const textColorMap: {
|
|
343
372
|
readonly 'color.text': "var(--ds-text)";
|
|
344
373
|
readonly 'color.text.accent.lime': "var(--ds-text-accent-lime)";
|
|
@@ -403,19 +432,6 @@ export declare const fillMap: {
|
|
|
403
432
|
readonly 'color.icon.subtle': "var(--ds-icon-subtle)";
|
|
404
433
|
};
|
|
405
434
|
export type Fill = keyof typeof fillMap;
|
|
406
|
-
export declare const surfaceColorMap: {
|
|
407
|
-
readonly 'elevation.surface': "var(--ds-surface)";
|
|
408
|
-
readonly 'elevation.surface.hovered': "var(--ds-surface-hovered)";
|
|
409
|
-
readonly 'elevation.surface.pressed': "var(--ds-surface-pressed)";
|
|
410
|
-
readonly 'elevation.surface.overlay': "var(--ds-surface-overlay)";
|
|
411
|
-
readonly 'elevation.surface.overlay.hovered': "var(--ds-surface-overlay-hovered)";
|
|
412
|
-
readonly 'elevation.surface.overlay.pressed': "var(--ds-surface-overlay-pressed)";
|
|
413
|
-
readonly 'elevation.surface.raised': "var(--ds-surface-raised)";
|
|
414
|
-
readonly 'elevation.surface.raised.hovered': "var(--ds-surface-raised-hovered)";
|
|
415
|
-
readonly 'elevation.surface.raised.pressed': "var(--ds-surface-raised-pressed)";
|
|
416
|
-
readonly 'elevation.surface.sunken': "var(--ds-surface-sunken)";
|
|
417
|
-
};
|
|
418
|
-
export type SurfaceColor = keyof typeof surfaceColorMap;
|
|
419
435
|
/**
|
|
420
436
|
* @codegenEnd
|
|
421
437
|
*/
|
|
@@ -537,8 +553,32 @@ export type TokenisedProps = {
|
|
|
537
553
|
backgroundColor?: BackgroundColor;
|
|
538
554
|
blockSize?: AutoComplete<Dimension>;
|
|
539
555
|
borderColor?: BorderColor;
|
|
556
|
+
borderBlockStartColor?: AutoComplete<BorderColor>;
|
|
557
|
+
borderBlockEndColor?: AutoComplete<BorderColor>;
|
|
558
|
+
borderInlineStartColor?: AutoComplete<BorderColor>;
|
|
559
|
+
borderInlineEndColor?: AutoComplete<BorderColor>;
|
|
560
|
+
borderBottomColor?: AutoComplete<BorderColor>;
|
|
561
|
+
borderLeftColor?: AutoComplete<BorderColor>;
|
|
562
|
+
borderRightColor?: AutoComplete<BorderColor>;
|
|
563
|
+
borderTopColor?: AutoComplete<BorderColor>;
|
|
540
564
|
borderRadius?: BorderRadius;
|
|
565
|
+
borderStartStartRadius?: AutoComplete<BorderRadius>;
|
|
566
|
+
borderStartEndRadius?: AutoComplete<BorderRadius>;
|
|
567
|
+
borderEndStartRadius?: AutoComplete<BorderRadius>;
|
|
568
|
+
borderEndEndRadius?: AutoComplete<BorderRadius>;
|
|
569
|
+
borderBottomLeftRadius?: AutoComplete<BorderRadius>;
|
|
570
|
+
borderBottomRightRadius?: AutoComplete<BorderRadius>;
|
|
571
|
+
borderTopLeftRadius?: AutoComplete<BorderRadius>;
|
|
572
|
+
borderTopRightRadius?: AutoComplete<BorderRadius>;
|
|
541
573
|
borderWidth?: BorderWidth;
|
|
574
|
+
borderBlockStartWidth?: AutoComplete<BorderWidth>;
|
|
575
|
+
borderBlockEndWidth?: AutoComplete<BorderWidth>;
|
|
576
|
+
borderInlineStartWidth?: AutoComplete<BorderWidth>;
|
|
577
|
+
borderInlineEndWidth?: AutoComplete<BorderWidth>;
|
|
578
|
+
borderBottomWidth?: AutoComplete<BorderWidth>;
|
|
579
|
+
borderLeftWidth?: AutoComplete<BorderWidth>;
|
|
580
|
+
borderRightWidth?: AutoComplete<BorderWidth>;
|
|
581
|
+
borderTopWidth?: AutoComplete<BorderWidth>;
|
|
542
582
|
bottom?: AutoComplete<Space>;
|
|
543
583
|
boxShadow?: Shadow;
|
|
544
584
|
color?: TextColor;
|
|
@@ -573,6 +613,7 @@ export type TokenisedProps = {
|
|
|
573
613
|
minHeight?: AutoComplete<Dimension>;
|
|
574
614
|
minInlineSize?: AutoComplete<Dimension>;
|
|
575
615
|
minWidth?: AutoComplete<Dimension>;
|
|
616
|
+
opacity?: AutoComplete<Opacity> | number;
|
|
576
617
|
outlineColor?: BorderColor;
|
|
577
618
|
outlineOffset?: Space;
|
|
578
619
|
outlineWidth?: BorderWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,37 +32,25 @@
|
|
|
32
32
|
"title": "Overview",
|
|
33
33
|
"id": "@atlaskit/primitives",
|
|
34
34
|
"folder": "overview",
|
|
35
|
-
"slug": "primitives/overview"
|
|
36
|
-
"status": {
|
|
37
|
-
"type": "beta"
|
|
38
|
-
}
|
|
35
|
+
"slug": "primitives/overview"
|
|
39
36
|
},
|
|
40
37
|
{
|
|
41
38
|
"title": "Box",
|
|
42
39
|
"folder": "box",
|
|
43
40
|
"slug": "primitives/box",
|
|
44
|
-
"id": "@atlaskit/primitives/box"
|
|
45
|
-
"status": {
|
|
46
|
-
"type": "beta"
|
|
47
|
-
}
|
|
41
|
+
"id": "@atlaskit/primitives/box"
|
|
48
42
|
},
|
|
49
43
|
{
|
|
50
44
|
"title": "Inline",
|
|
51
45
|
"folder": "inline",
|
|
52
46
|
"slug": "primitives/inline",
|
|
53
|
-
"id": "@atlaskit/primitives/inline"
|
|
54
|
-
"status": {
|
|
55
|
-
"type": "beta"
|
|
56
|
-
}
|
|
47
|
+
"id": "@atlaskit/primitives/inline"
|
|
57
48
|
},
|
|
58
49
|
{
|
|
59
50
|
"title": "Stack",
|
|
60
51
|
"folder": "stack",
|
|
61
52
|
"slug": "primitives/stack",
|
|
62
|
-
"id": "@atlaskit/primitives/stack"
|
|
63
|
-
"status": {
|
|
64
|
-
"type": "beta"
|
|
65
|
-
}
|
|
53
|
+
"id": "@atlaskit/primitives/stack"
|
|
66
54
|
},
|
|
67
55
|
{
|
|
68
56
|
"title": "Flex",
|
|
@@ -86,28 +74,19 @@
|
|
|
86
74
|
"title": "Bleed",
|
|
87
75
|
"folder": "bleed",
|
|
88
76
|
"slug": "primitives/bleed",
|
|
89
|
-
"id": "@atlaskit/primitives/bleed"
|
|
90
|
-
"status": {
|
|
91
|
-
"type": "beta"
|
|
92
|
-
}
|
|
77
|
+
"id": "@atlaskit/primitives/bleed"
|
|
93
78
|
},
|
|
94
79
|
{
|
|
95
80
|
"title": "xcss",
|
|
96
81
|
"folder": "xcss",
|
|
97
82
|
"slug": "primitives/xcss",
|
|
98
|
-
"id": "@atlaskit/primitives/xcss"
|
|
99
|
-
"status": {
|
|
100
|
-
"type": "beta"
|
|
101
|
-
}
|
|
83
|
+
"id": "@atlaskit/primitives/xcss"
|
|
102
84
|
},
|
|
103
85
|
{
|
|
104
86
|
"title": "Responsive",
|
|
105
87
|
"folder": "responsive",
|
|
106
88
|
"slug": "primitives/responsive",
|
|
107
|
-
"id": "@atlaskit/primitives/responsive"
|
|
108
|
-
"status": {
|
|
109
|
-
"type": "beta"
|
|
110
|
-
}
|
|
89
|
+
"id": "@atlaskit/primitives/responsive"
|
|
111
90
|
},
|
|
112
91
|
{
|
|
113
92
|
"title": "Text",
|
package/report.api.md
CHANGED
|
@@ -883,6 +883,15 @@ const negativeSpaceMap: {
|
|
|
883
883
|
'space.negative.400': 'var(--ds-space-negative-400)';
|
|
884
884
|
};
|
|
885
885
|
|
|
886
|
+
// @public (undocumented)
|
|
887
|
+
type Opacity = keyof typeof opacityMap;
|
|
888
|
+
|
|
889
|
+
// @public
|
|
890
|
+
const opacityMap: {
|
|
891
|
+
readonly 'opacity.disabled': 'var(--ds-opacity-disabled)';
|
|
892
|
+
readonly 'opacity.loading': 'var(--ds-opacity-loading)';
|
|
893
|
+
};
|
|
894
|
+
|
|
886
895
|
// @public (undocumented)
|
|
887
896
|
type SafeCSSObject = CSSPseudos &
|
|
888
897
|
CSSAtRules &
|
|
@@ -1130,8 +1139,32 @@ type TokenisedProps = {
|
|
|
1130
1139
|
backgroundColor?: BackgroundColor;
|
|
1131
1140
|
blockSize?: AutoComplete<Dimension>;
|
|
1132
1141
|
borderColor?: BorderColor;
|
|
1142
|
+
borderBlockStartColor?: AutoComplete<BorderColor>;
|
|
1143
|
+
borderBlockEndColor?: AutoComplete<BorderColor>;
|
|
1144
|
+
borderInlineStartColor?: AutoComplete<BorderColor>;
|
|
1145
|
+
borderInlineEndColor?: AutoComplete<BorderColor>;
|
|
1146
|
+
borderBottomColor?: AutoComplete<BorderColor>;
|
|
1147
|
+
borderLeftColor?: AutoComplete<BorderColor>;
|
|
1148
|
+
borderRightColor?: AutoComplete<BorderColor>;
|
|
1149
|
+
borderTopColor?: AutoComplete<BorderColor>;
|
|
1133
1150
|
borderRadius?: BorderRadius;
|
|
1151
|
+
borderStartStartRadius?: AutoComplete<BorderRadius>;
|
|
1152
|
+
borderStartEndRadius?: AutoComplete<BorderRadius>;
|
|
1153
|
+
borderEndStartRadius?: AutoComplete<BorderRadius>;
|
|
1154
|
+
borderEndEndRadius?: AutoComplete<BorderRadius>;
|
|
1155
|
+
borderBottomLeftRadius?: AutoComplete<BorderRadius>;
|
|
1156
|
+
borderBottomRightRadius?: AutoComplete<BorderRadius>;
|
|
1157
|
+
borderTopLeftRadius?: AutoComplete<BorderRadius>;
|
|
1158
|
+
borderTopRightRadius?: AutoComplete<BorderRadius>;
|
|
1134
1159
|
borderWidth?: BorderWidth;
|
|
1160
|
+
borderBlockStartWidth?: AutoComplete<BorderWidth>;
|
|
1161
|
+
borderBlockEndWidth?: AutoComplete<BorderWidth>;
|
|
1162
|
+
borderInlineStartWidth?: AutoComplete<BorderWidth>;
|
|
1163
|
+
borderInlineEndWidth?: AutoComplete<BorderWidth>;
|
|
1164
|
+
borderBottomWidth?: AutoComplete<BorderWidth>;
|
|
1165
|
+
borderLeftWidth?: AutoComplete<BorderWidth>;
|
|
1166
|
+
borderRightWidth?: AutoComplete<BorderWidth>;
|
|
1167
|
+
borderTopWidth?: AutoComplete<BorderWidth>;
|
|
1135
1168
|
bottom?: AutoComplete<Space>;
|
|
1136
1169
|
boxShadow?: Shadow;
|
|
1137
1170
|
color?: TextColor;
|
|
@@ -1166,6 +1199,7 @@ type TokenisedProps = {
|
|
|
1166
1199
|
minHeight?: AutoComplete<Dimension>;
|
|
1167
1200
|
minInlineSize?: AutoComplete<Dimension>;
|
|
1168
1201
|
minWidth?: AutoComplete<Dimension>;
|
|
1202
|
+
opacity?: AutoComplete<Opacity> | number;
|
|
1169
1203
|
outlineColor?: BorderColor;
|
|
1170
1204
|
outlineOffset?: Space;
|
|
1171
1205
|
outlineWidth?: BorderWidth;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`@atlaskit/primitives
|
|
3
|
+
exports[`@atlaskit/primitives background styles are generated correctly 1`] = `
|
|
4
4
|
"export const backgroundColorMap = {
|
|
5
5
|
'color.background.accent.lime.subtlest': token(
|
|
6
6
|
'color.background.accent.lime.subtlest',
|
|
@@ -771,6 +771,78 @@ export type BorderColor = keyof typeof borderColorMap;
|
|
|
771
771
|
"
|
|
772
772
|
`;
|
|
773
773
|
|
|
774
|
+
exports[`@atlaskit/primitives opacity styles are generated correctly 1`] = `
|
|
775
|
+
"export const opacityMap = {
|
|
776
|
+
'opacity.disabled': token('opacity.disabled', '0.4'),
|
|
777
|
+
'opacity.loading': token('opacity.loading', '0.2'),
|
|
778
|
+
} as const;
|
|
779
|
+
|
|
780
|
+
export type Opacity = keyof typeof opacityMap;
|
|
781
|
+
"
|
|
782
|
+
`;
|
|
783
|
+
|
|
784
|
+
exports[`@atlaskit/primitives shadow styles are generated correctly 1`] = `
|
|
785
|
+
"export const shadowMap = {
|
|
786
|
+
'elevation.shadow.overflow': token(
|
|
787
|
+
'elevation.shadow.overflow',
|
|
788
|
+
'0px 0px 8px #091e423f, 0px 0px 1px #091e424f',
|
|
789
|
+
),
|
|
790
|
+
'elevation.shadow.overflow.perimeter': token(
|
|
791
|
+
'elevation.shadow.overflow.perimeter',
|
|
792
|
+
'#091e421f',
|
|
793
|
+
),
|
|
794
|
+
'elevation.shadow.overflow.spread': token(
|
|
795
|
+
'elevation.shadow.overflow.spread',
|
|
796
|
+
'#091e4229',
|
|
797
|
+
),
|
|
798
|
+
'elevation.shadow.overlay': token(
|
|
799
|
+
'elevation.shadow.overlay',
|
|
800
|
+
'0px 8px 12px #091e423f, 0px 0px 1px #091e424f',
|
|
801
|
+
),
|
|
802
|
+
'elevation.shadow.raised': token(
|
|
803
|
+
'elevation.shadow.raised',
|
|
804
|
+
'0px 1px 1px #091e423f, 0px 0px 1px #091e4221',
|
|
805
|
+
),
|
|
806
|
+
} as const;
|
|
807
|
+
|
|
808
|
+
export type Shadow = keyof typeof shadowMap;
|
|
809
|
+
"
|
|
810
|
+
`;
|
|
811
|
+
|
|
812
|
+
exports[`@atlaskit/primitives spacing styles are generated correctly 1`] = `
|
|
813
|
+
"export const spaceMap = {
|
|
814
|
+
'space.0': token('space.0', '0px'),
|
|
815
|
+
'space.025': token('space.025', '2px'),
|
|
816
|
+
'space.050': token('space.050', '4px'),
|
|
817
|
+
'space.075': token('space.075', '6px'),
|
|
818
|
+
'space.100': token('space.100', '8px'),
|
|
819
|
+
'space.150': token('space.150', '12px'),
|
|
820
|
+
'space.200': token('space.200', '16px'),
|
|
821
|
+
'space.250': token('space.250', '20px'),
|
|
822
|
+
'space.300': token('space.300', '24px'),
|
|
823
|
+
'space.400': token('space.400', '32px'),
|
|
824
|
+
'space.500': token('space.500', '40px'),
|
|
825
|
+
'space.600': token('space.600', '48px'),
|
|
826
|
+
'space.800': token('space.800', '64px'),
|
|
827
|
+
'space.1000': token('space.1000', '80px'),
|
|
828
|
+
};
|
|
829
|
+
export type Space = keyof typeof spaceMap;
|
|
830
|
+
|
|
831
|
+
export const negativeSpaceMap = {
|
|
832
|
+
'space.negative.025': token('space.negative.025', '-2px'),
|
|
833
|
+
'space.negative.050': token('space.negative.050', '-4px'),
|
|
834
|
+
'space.negative.075': token('space.negative.075', '-6px'),
|
|
835
|
+
'space.negative.100': token('space.negative.100', '-8px'),
|
|
836
|
+
'space.negative.150': token('space.negative.150', '-12px'),
|
|
837
|
+
'space.negative.200': token('space.negative.200', '-16px'),
|
|
838
|
+
'space.negative.250': token('space.negative.250', '-20px'),
|
|
839
|
+
'space.negative.300': token('space.negative.300', '-24px'),
|
|
840
|
+
'space.negative.400': token('space.negative.400', '-32px'),
|
|
841
|
+
};
|
|
842
|
+
export type NegativeSpace = keyof typeof negativeSpaceMap;
|
|
843
|
+
"
|
|
844
|
+
`;
|
|
845
|
+
|
|
774
846
|
exports[`@atlaskit/primitives surface styles are generated correctly 1`] = `
|
|
775
847
|
"export const surfaceColorMap = {
|
|
776
848
|
'elevation.surface': token('elevation.surface', '#FFFFFF'),
|
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
import { createColorStylesFromTemplate } from '../color-codegen-template';
|
|
2
|
+
import { createElevationStylesFromTemplate } from '../elevation-codegen-template';
|
|
3
|
+
import { createSpacingStylesFromTemplate } from '../spacing-codegen-template';
|
|
4
|
+
|
|
2
5
|
describe('@atlaskit/primitives', () => {
|
|
6
|
+
// colour stuff
|
|
3
7
|
test('text styles are generated correctly', () => {
|
|
4
8
|
expect(createColorStylesFromTemplate('text')).toMatchSnapshot();
|
|
5
9
|
});
|
|
6
|
-
|
|
7
|
-
test('bg styles are generated correctly', () => {
|
|
10
|
+
test('background styles are generated correctly', () => {
|
|
8
11
|
expect(createColorStylesFromTemplate('background')).toMatchSnapshot();
|
|
9
12
|
});
|
|
10
|
-
|
|
11
13
|
test('border styles are generated correctly', () => {
|
|
12
14
|
expect(createColorStylesFromTemplate('border')).toMatchSnapshot();
|
|
13
15
|
});
|
|
14
16
|
|
|
17
|
+
// elevation stuff
|
|
18
|
+
test('opacity styles are generated correctly', () => {
|
|
19
|
+
expect(createElevationStylesFromTemplate('opacity')).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
test('shadow styles are generated correctly', () => {
|
|
22
|
+
expect(createElevationStylesFromTemplate('shadow')).toMatchSnapshot();
|
|
23
|
+
});
|
|
15
24
|
test('surface styles are generated correctly', () => {
|
|
16
|
-
expect(
|
|
25
|
+
expect(createElevationStylesFromTemplate('surface')).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// spacing
|
|
29
|
+
test('spacing styles are generated correctly', () => {
|
|
30
|
+
expect(createSpacingStylesFromTemplate()).toMatchSnapshot();
|
|
17
31
|
});
|
|
18
32
|
|
|
19
33
|
test('incorrect config throws', () => {
|
|
20
34
|
expect(() =>
|
|
21
35
|
createColorStylesFromTemplate('fizzbuzz' as any),
|
|
22
36
|
).toThrowError();
|
|
37
|
+
expect(() =>
|
|
38
|
+
createElevationStylesFromTemplate('fizzbuzz' as any),
|
|
39
|
+
).toThrowError();
|
|
23
40
|
});
|
|
24
41
|
});
|
|
@@ -6,6 +6,7 @@ import { createPartialSignedArtifact } from '@atlassian/codegen';
|
|
|
6
6
|
|
|
7
7
|
import { createBorderStylesFromTemplate } from './border-codegen-template';
|
|
8
8
|
import { createColorStylesFromTemplate } from './color-codegen-template';
|
|
9
|
+
import { createElevationStylesFromTemplate } from './elevation-codegen-template';
|
|
9
10
|
import { createInverseColorMapTemplate } from './inverse-color-map-template';
|
|
10
11
|
import { createStylesFromFileTemplate } from './misc-codegen-template';
|
|
11
12
|
import { createSpacingStylesFromTemplate } from './spacing-codegen-template';
|
|
@@ -58,7 +59,7 @@ const sourceFns = [
|
|
|
58
59
|
dependencies: [spacingTokensDependencyPath],
|
|
59
60
|
},
|
|
60
61
|
),
|
|
61
|
-
// text color, background-color, border-color
|
|
62
|
+
// text color, background-color, border-color
|
|
62
63
|
() =>
|
|
63
64
|
createPartialSignedArtifact(
|
|
64
65
|
options => options.map(createColorStylesFromTemplate).join('\n'),
|
|
@@ -80,6 +81,17 @@ const sourceFns = [
|
|
|
80
81
|
dependencies: [colorTokensDependencyPath],
|
|
81
82
|
},
|
|
82
83
|
),
|
|
84
|
+
// elevation (opacity, shadow, surface)
|
|
85
|
+
() =>
|
|
86
|
+
createPartialSignedArtifact(
|
|
87
|
+
options => options.map(createElevationStylesFromTemplate).join('\n'),
|
|
88
|
+
'yarn workspace @atlaskit/primitives codegen-styles',
|
|
89
|
+
{
|
|
90
|
+
id: 'elevation',
|
|
91
|
+
absoluteFilePath: targetPath,
|
|
92
|
+
dependencies: [colorTokensDependencyPath],
|
|
93
|
+
},
|
|
94
|
+
),
|
|
83
95
|
// border-width, border-radius
|
|
84
96
|
() =>
|
|
85
97
|
createPartialSignedArtifact(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import prettier from 'prettier';
|
|
2
2
|
import parserTypeScript from 'prettier/parser-typescript';
|
|
3
3
|
|
|
4
|
-
import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
|
|
5
4
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
6
5
|
import legacyTokens from '@atlaskit/tokens/src/artifacts/tokens-raw/atlassian-legacy-light';
|
|
7
6
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
@@ -46,13 +45,6 @@ const tokenStyles = {
|
|
|
46
45
|
filterFn: <T extends Token>(t: T) =>
|
|
47
46
|
t.token.startsWith(tokenStyles.border.prefix),
|
|
48
47
|
},
|
|
49
|
-
shadow: {
|
|
50
|
-
objectName: 'shadow',
|
|
51
|
-
prefix: 'elevation.shadow.',
|
|
52
|
-
cssProperty: 'boxShadow',
|
|
53
|
-
filterFn: <T extends Token>(t: T) =>
|
|
54
|
-
t.token.startsWith(tokenStyles.shadow.prefix),
|
|
55
|
-
},
|
|
56
48
|
fill: {
|
|
57
49
|
objectName: 'fill',
|
|
58
50
|
prefix: 'color.icon.',
|
|
@@ -60,13 +52,6 @@ const tokenStyles = {
|
|
|
60
52
|
filterFn: <T extends Token>(t: T) =>
|
|
61
53
|
t.token.startsWith(tokenStyles.fill.prefix),
|
|
62
54
|
},
|
|
63
|
-
surface: {
|
|
64
|
-
objectName: 'surfaceColor',
|
|
65
|
-
prefix: 'elevation.surface.',
|
|
66
|
-
cssProperty: CURRENT_SURFACE_CSS_VAR,
|
|
67
|
-
filterFn: <T extends Token>(t: T) =>
|
|
68
|
-
t.token.startsWith(tokenStyles.surface.prefix),
|
|
69
|
-
},
|
|
70
55
|
} as const;
|
|
71
56
|
|
|
72
57
|
const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import prettier from 'prettier';
|
|
2
|
+
import parserTypeScript from 'prettier/parser-typescript';
|
|
3
|
+
|
|
4
|
+
import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
|
|
5
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
6
|
+
import legacyTokens from '@atlaskit/tokens/src/artifacts/tokens-raw/atlassian-legacy-light';
|
|
7
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
8
|
+
import tokens from '@atlaskit/tokens/src/artifacts/tokens-raw/atlassian-light';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
capitalize,
|
|
12
|
+
constructTokenFunctionCall,
|
|
13
|
+
ShadowDefinition,
|
|
14
|
+
} from './utils';
|
|
15
|
+
|
|
16
|
+
type Token = {
|
|
17
|
+
token: string;
|
|
18
|
+
fallback: string | ShadowDefinition;
|
|
19
|
+
isDeprecated: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// NB: Fallback CSS variables can be deleted when tokens are no longer behind a feature flag
|
|
23
|
+
const tokenStyles = {
|
|
24
|
+
opacity: {
|
|
25
|
+
objectName: 'opacity',
|
|
26
|
+
prefix: 'opacity.',
|
|
27
|
+
cssProperty: 'opacity',
|
|
28
|
+
filterFn: <T extends Token>(t: T) =>
|
|
29
|
+
t.token.startsWith(tokenStyles.opacity.prefix),
|
|
30
|
+
},
|
|
31
|
+
shadow: {
|
|
32
|
+
objectName: 'shadow',
|
|
33
|
+
prefix: 'elevation.shadow.',
|
|
34
|
+
cssProperty: 'boxShadow',
|
|
35
|
+
filterFn: <T extends Token>(t: T) =>
|
|
36
|
+
t.token.startsWith(tokenStyles.shadow.prefix),
|
|
37
|
+
},
|
|
38
|
+
surface: {
|
|
39
|
+
objectName: 'surfaceColor',
|
|
40
|
+
prefix: 'elevation.surface.',
|
|
41
|
+
cssProperty: CURRENT_SURFACE_CSS_VAR,
|
|
42
|
+
filterFn: <T extends Token>(t: T) =>
|
|
43
|
+
t.token.startsWith(tokenStyles.surface.prefix),
|
|
44
|
+
},
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
|
|
48
|
+
|
|
49
|
+
const activeTokens = bothTokens
|
|
50
|
+
.filter(([t]) => t.attributes.state !== 'deleted')
|
|
51
|
+
.map(t => t)
|
|
52
|
+
.map(
|
|
53
|
+
([t, legacy]): Token => ({
|
|
54
|
+
token: t.name,
|
|
55
|
+
fallback: legacy.value as string | ShadowDefinition,
|
|
56
|
+
isDeprecated: t.attributes.state === 'deprecated',
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const createElevationStylesFromTemplate = (
|
|
61
|
+
property: keyof typeof tokenStyles,
|
|
62
|
+
) => {
|
|
63
|
+
if (!tokenStyles[property]) {
|
|
64
|
+
throw new Error(`[codegen] Unknown option found "${property}"`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const { filterFn, objectName } = tokenStyles[property];
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
prettier.format(
|
|
71
|
+
`
|
|
72
|
+
export const ${objectName}Map = {
|
|
73
|
+
${activeTokens
|
|
74
|
+
.filter(filterFn)
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
.map(t => ({ ...t, token: t.token.replaceAll('.[default]', '') }))
|
|
77
|
+
.map(t => {
|
|
78
|
+
return `
|
|
79
|
+
${t.isDeprecated ? '// @deprecated' : ''}
|
|
80
|
+
'${t.token}': ${constructTokenFunctionCall(t.token, t.fallback)}
|
|
81
|
+
`.trim();
|
|
82
|
+
})
|
|
83
|
+
.join(',\n\t')}
|
|
84
|
+
} as const;`,
|
|
85
|
+
{
|
|
86
|
+
singleQuote: true,
|
|
87
|
+
parser: 'typescript',
|
|
88
|
+
trailingComma: 'all',
|
|
89
|
+
plugins: [parserTypeScript],
|
|
90
|
+
},
|
|
91
|
+
) +
|
|
92
|
+
`\nexport type ${capitalize(objectName)} = keyof typeof ${objectName}Map;\n`
|
|
93
|
+
);
|
|
94
|
+
};
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -634,6 +634,15 @@ const negativeSpaceMap: {
|
|
|
634
634
|
'space.negative.400': "var(--ds-space-negative-400)";
|
|
635
635
|
};
|
|
636
636
|
|
|
637
|
+
// @public (undocumented)
|
|
638
|
+
type Opacity = keyof typeof opacityMap;
|
|
639
|
+
|
|
640
|
+
// @public
|
|
641
|
+
const opacityMap: {
|
|
642
|
+
readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
|
|
643
|
+
readonly 'opacity.loading': "var(--ds-opacity-loading)";
|
|
644
|
+
};
|
|
645
|
+
|
|
637
646
|
// @public (undocumented)
|
|
638
647
|
type SafeCSSObject = CSSPseudos & CSSAtRules & TokenisedProps & CSSMediaQueries & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
|
|
639
648
|
|
|
@@ -784,8 +793,32 @@ type TokenisedProps = {
|
|
|
784
793
|
backgroundColor?: BackgroundColor;
|
|
785
794
|
blockSize?: AutoComplete<Dimension>;
|
|
786
795
|
borderColor?: BorderColor;
|
|
796
|
+
borderBlockStartColor?: AutoComplete<BorderColor>;
|
|
797
|
+
borderBlockEndColor?: AutoComplete<BorderColor>;
|
|
798
|
+
borderInlineStartColor?: AutoComplete<BorderColor>;
|
|
799
|
+
borderInlineEndColor?: AutoComplete<BorderColor>;
|
|
800
|
+
borderBottomColor?: AutoComplete<BorderColor>;
|
|
801
|
+
borderLeftColor?: AutoComplete<BorderColor>;
|
|
802
|
+
borderRightColor?: AutoComplete<BorderColor>;
|
|
803
|
+
borderTopColor?: AutoComplete<BorderColor>;
|
|
787
804
|
borderRadius?: BorderRadius;
|
|
805
|
+
borderStartStartRadius?: AutoComplete<BorderRadius>;
|
|
806
|
+
borderStartEndRadius?: AutoComplete<BorderRadius>;
|
|
807
|
+
borderEndStartRadius?: AutoComplete<BorderRadius>;
|
|
808
|
+
borderEndEndRadius?: AutoComplete<BorderRadius>;
|
|
809
|
+
borderBottomLeftRadius?: AutoComplete<BorderRadius>;
|
|
810
|
+
borderBottomRightRadius?: AutoComplete<BorderRadius>;
|
|
811
|
+
borderTopLeftRadius?: AutoComplete<BorderRadius>;
|
|
812
|
+
borderTopRightRadius?: AutoComplete<BorderRadius>;
|
|
788
813
|
borderWidth?: BorderWidth;
|
|
814
|
+
borderBlockStartWidth?: AutoComplete<BorderWidth>;
|
|
815
|
+
borderBlockEndWidth?: AutoComplete<BorderWidth>;
|
|
816
|
+
borderInlineStartWidth?: AutoComplete<BorderWidth>;
|
|
817
|
+
borderInlineEndWidth?: AutoComplete<BorderWidth>;
|
|
818
|
+
borderBottomWidth?: AutoComplete<BorderWidth>;
|
|
819
|
+
borderLeftWidth?: AutoComplete<BorderWidth>;
|
|
820
|
+
borderRightWidth?: AutoComplete<BorderWidth>;
|
|
821
|
+
borderTopWidth?: AutoComplete<BorderWidth>;
|
|
789
822
|
bottom?: AutoComplete<Space>;
|
|
790
823
|
boxShadow?: Shadow;
|
|
791
824
|
color?: TextColor;
|
|
@@ -820,6 +853,7 @@ type TokenisedProps = {
|
|
|
820
853
|
minHeight?: AutoComplete<Dimension>;
|
|
821
854
|
minInlineSize?: AutoComplete<Dimension>;
|
|
822
855
|
minWidth?: AutoComplete<Dimension>;
|
|
856
|
+
opacity?: AutoComplete<Opacity> | number;
|
|
823
857
|
outlineColor?: BorderColor;
|
|
824
858
|
outlineOffset?: Space;
|
|
825
859
|
outlineWidth?: BorderWidth;
|