@atlaskit/ds-explorations 1.2.1 → 1.3.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 +13 -0
- package/dist/cjs/components/box.partial.js +119 -101
- package/dist/cjs/components/inline.partial.js +28 -23
- package/dist/cjs/components/stack.partial.js +19 -13
- package/dist/cjs/internal/spacing-scale.js +3 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.partial.js +119 -101
- package/dist/es2019/components/inline.partial.js +28 -21
- package/dist/es2019/components/stack.partial.js +19 -13
- package/dist/es2019/internal/spacing-scale.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.partial.js +119 -101
- package/dist/esm/components/inline.partial.js +28 -21
- package/dist/esm/components/stack.partial.js +19 -13
- package/dist/esm/internal/spacing-scale.js +3 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.partial.d.ts +54 -32
- package/dist/types/components/inline.partial.d.ts +3 -1
- package/dist/types/components/stack.partial.d.ts +3 -1
- package/dist/types/internal/spacing-scale.d.ts +3 -3
- package/examples/04-inline.tsx +5 -11
- package/examples/99-interactions.tsx +1 -1
- package/package.json +2 -2
- package/report.api.md +30 -28
- package/scripts/codegen-styles.tsx +24 -1
- package/scripts/dimension-codegen-template.tsx +63 -0
- package/scripts/spacing-codegen-template.tsx +8 -21
- package/scripts/spacing-scale-template.tsx +6 -13
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/box.partial.tsx +106 -119
- package/src/components/inline.partial.tsx +35 -23
- package/src/components/stack.partial.tsx +19 -13
- package/src/internal/spacing-scale.tsx +4 -2
- package/tmp/api-report-tmp.d.ts +30 -28
|
@@ -46,14 +46,17 @@ declare type BoxPropsBase<T extends ElementType> = {
|
|
|
46
46
|
borderRadius?: BorderRadius;
|
|
47
47
|
/**
|
|
48
48
|
* Defines the main axis direction.
|
|
49
|
+
* @deprecated
|
|
49
50
|
*/
|
|
50
51
|
flexDirection?: FlexDirection;
|
|
51
52
|
/**
|
|
52
53
|
* Used to align children along the cross axis.
|
|
54
|
+
* @deprecated
|
|
53
55
|
*/
|
|
54
56
|
alignItems?: FlexAlignItems;
|
|
55
57
|
/**
|
|
56
58
|
* Used to align children along the main axis.
|
|
59
|
+
* @deprecated
|
|
57
60
|
*/
|
|
58
61
|
justifyContent?: FlexJustifyContent;
|
|
59
62
|
/**
|
|
@@ -77,10 +80,12 @@ declare type BoxPropsBase<T extends ElementType> = {
|
|
|
77
80
|
paddingInline?: PaddingInline;
|
|
78
81
|
/**
|
|
79
82
|
* Token representing width.
|
|
83
|
+
* @experimental The existing tokens will be replaced to better reflect dimensions.
|
|
80
84
|
*/
|
|
81
85
|
width?: Width;
|
|
82
86
|
/**
|
|
83
87
|
* Token representing height.
|
|
88
|
+
* @experimental The existing tokens will be replaced to better reflect dimensions.
|
|
84
89
|
*/
|
|
85
90
|
height?: Height;
|
|
86
91
|
/**
|
|
@@ -124,11 +129,17 @@ declare const borderRadiusMap: {
|
|
|
124
129
|
rounded: import("@emotion/react").SerializedStyles;
|
|
125
130
|
badge: import("@emotion/react").SerializedStyles;
|
|
126
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* @experimental - this is likely to be removed
|
|
134
|
+
*/
|
|
127
135
|
declare type FlexDirection = keyof typeof flexDirectionMap;
|
|
128
136
|
declare const flexDirectionMap: {
|
|
129
137
|
column: import("@emotion/react").SerializedStyles;
|
|
130
138
|
row: import("@emotion/react").SerializedStyles;
|
|
131
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* @experimental - this is likely to be removed
|
|
142
|
+
*/
|
|
132
143
|
declare type FlexAlignItems = keyof typeof flexAlignItemsMap;
|
|
133
144
|
declare const flexAlignItemsMap: {
|
|
134
145
|
center: import("@emotion/react").SerializedStyles;
|
|
@@ -136,6 +147,9 @@ declare const flexAlignItemsMap: {
|
|
|
136
147
|
flexStart: import("@emotion/react").SerializedStyles;
|
|
137
148
|
flexEnd: import("@emotion/react").SerializedStyles;
|
|
138
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* @experimental - this is likely to be removed
|
|
152
|
+
*/
|
|
139
153
|
declare type FlexJustifyContent = keyof typeof flexJustifyContentMap;
|
|
140
154
|
declare const flexJustifyContentMap: {
|
|
141
155
|
center: import("@emotion/react").SerializedStyles;
|
|
@@ -161,10 +175,42 @@ declare const overflowMap: {
|
|
|
161
175
|
};
|
|
162
176
|
/**
|
|
163
177
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
164
|
-
* @codegen <<SignedSource::
|
|
178
|
+
* @codegen <<SignedSource::327e769aaa3da9422a919a0ca9490070>>
|
|
179
|
+
* @codegenId dimensions
|
|
180
|
+
* @codegenCommand yarn codegen-styles
|
|
181
|
+
* @codegenParams ["width", "height"]
|
|
182
|
+
*/
|
|
183
|
+
declare const widthMap: {
|
|
184
|
+
'100%': import("@emotion/react").SerializedStyles;
|
|
185
|
+
'size.100': import("@emotion/react").SerializedStyles;
|
|
186
|
+
'size.1000': import("@emotion/react").SerializedStyles;
|
|
187
|
+
'size.200': import("@emotion/react").SerializedStyles;
|
|
188
|
+
'size.300': import("@emotion/react").SerializedStyles;
|
|
189
|
+
'size.400': import("@emotion/react").SerializedStyles;
|
|
190
|
+
'size.500': import("@emotion/react").SerializedStyles;
|
|
191
|
+
'size.600': import("@emotion/react").SerializedStyles;
|
|
192
|
+
};
|
|
193
|
+
export declare type Width = keyof typeof widthMap;
|
|
194
|
+
declare const heightMap: {
|
|
195
|
+
'100%': import("@emotion/react").SerializedStyles;
|
|
196
|
+
'size.100': import("@emotion/react").SerializedStyles;
|
|
197
|
+
'size.1000': import("@emotion/react").SerializedStyles;
|
|
198
|
+
'size.200': import("@emotion/react").SerializedStyles;
|
|
199
|
+
'size.300': import("@emotion/react").SerializedStyles;
|
|
200
|
+
'size.400': import("@emotion/react").SerializedStyles;
|
|
201
|
+
'size.500': import("@emotion/react").SerializedStyles;
|
|
202
|
+
'size.600': import("@emotion/react").SerializedStyles;
|
|
203
|
+
};
|
|
204
|
+
export declare type Height = keyof typeof heightMap;
|
|
205
|
+
/**
|
|
206
|
+
* @codegenEnd
|
|
207
|
+
*/
|
|
208
|
+
/**
|
|
209
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
210
|
+
* @codegen <<SignedSource::41980a62e387c13a99802814a0f33d26>>
|
|
165
211
|
* @codegenId spacing
|
|
166
212
|
* @codegenCommand yarn codegen-styles
|
|
167
|
-
* @codegenParams ["padding", "paddingBlock", "paddingInline"
|
|
213
|
+
* @codegenParams ["padding", "paddingBlock", "paddingInline"]
|
|
168
214
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
169
215
|
*/
|
|
170
216
|
declare const paddingMap: {
|
|
@@ -173,6 +219,7 @@ declare const paddingMap: {
|
|
|
173
219
|
'scale.050': import("@emotion/react").SerializedStyles;
|
|
174
220
|
'scale.075': import("@emotion/react").SerializedStyles;
|
|
175
221
|
'scale.100': import("@emotion/react").SerializedStyles;
|
|
222
|
+
'scale.1000': import("@emotion/react").SerializedStyles;
|
|
176
223
|
'scale.150': import("@emotion/react").SerializedStyles;
|
|
177
224
|
'scale.200': import("@emotion/react").SerializedStyles;
|
|
178
225
|
'scale.250': import("@emotion/react").SerializedStyles;
|
|
@@ -180,6 +227,7 @@ declare const paddingMap: {
|
|
|
180
227
|
'scale.400': import("@emotion/react").SerializedStyles;
|
|
181
228
|
'scale.500': import("@emotion/react").SerializedStyles;
|
|
182
229
|
'scale.600': import("@emotion/react").SerializedStyles;
|
|
230
|
+
'scale.800': import("@emotion/react").SerializedStyles;
|
|
183
231
|
};
|
|
184
232
|
export declare type Padding = keyof typeof paddingMap;
|
|
185
233
|
declare const paddingBlockMap: {
|
|
@@ -188,6 +236,7 @@ declare const paddingBlockMap: {
|
|
|
188
236
|
'scale.050': import("@emotion/react").SerializedStyles;
|
|
189
237
|
'scale.075': import("@emotion/react").SerializedStyles;
|
|
190
238
|
'scale.100': import("@emotion/react").SerializedStyles;
|
|
239
|
+
'scale.1000': import("@emotion/react").SerializedStyles;
|
|
191
240
|
'scale.150': import("@emotion/react").SerializedStyles;
|
|
192
241
|
'scale.200': import("@emotion/react").SerializedStyles;
|
|
193
242
|
'scale.250': import("@emotion/react").SerializedStyles;
|
|
@@ -195,6 +244,7 @@ declare const paddingBlockMap: {
|
|
|
195
244
|
'scale.400': import("@emotion/react").SerializedStyles;
|
|
196
245
|
'scale.500': import("@emotion/react").SerializedStyles;
|
|
197
246
|
'scale.600': import("@emotion/react").SerializedStyles;
|
|
247
|
+
'scale.800': import("@emotion/react").SerializedStyles;
|
|
198
248
|
};
|
|
199
249
|
export declare type PaddingBlock = keyof typeof paddingBlockMap;
|
|
200
250
|
declare const paddingInlineMap: {
|
|
@@ -203,6 +253,7 @@ declare const paddingInlineMap: {
|
|
|
203
253
|
'scale.050': import("@emotion/react").SerializedStyles;
|
|
204
254
|
'scale.075': import("@emotion/react").SerializedStyles;
|
|
205
255
|
'scale.100': import("@emotion/react").SerializedStyles;
|
|
256
|
+
'scale.1000': import("@emotion/react").SerializedStyles;
|
|
206
257
|
'scale.150': import("@emotion/react").SerializedStyles;
|
|
207
258
|
'scale.200': import("@emotion/react").SerializedStyles;
|
|
208
259
|
'scale.250': import("@emotion/react").SerializedStyles;
|
|
@@ -210,38 +261,9 @@ declare const paddingInlineMap: {
|
|
|
210
261
|
'scale.400': import("@emotion/react").SerializedStyles;
|
|
211
262
|
'scale.500': import("@emotion/react").SerializedStyles;
|
|
212
263
|
'scale.600': import("@emotion/react").SerializedStyles;
|
|
264
|
+
'scale.800': import("@emotion/react").SerializedStyles;
|
|
213
265
|
};
|
|
214
266
|
export declare type PaddingInline = keyof typeof paddingInlineMap;
|
|
215
|
-
declare const widthMap: {
|
|
216
|
-
'scale.0': import("@emotion/react").SerializedStyles;
|
|
217
|
-
'scale.025': import("@emotion/react").SerializedStyles;
|
|
218
|
-
'scale.050': import("@emotion/react").SerializedStyles;
|
|
219
|
-
'scale.075': import("@emotion/react").SerializedStyles;
|
|
220
|
-
'scale.100': import("@emotion/react").SerializedStyles;
|
|
221
|
-
'scale.150': import("@emotion/react").SerializedStyles;
|
|
222
|
-
'scale.200': import("@emotion/react").SerializedStyles;
|
|
223
|
-
'scale.250': import("@emotion/react").SerializedStyles;
|
|
224
|
-
'scale.300': import("@emotion/react").SerializedStyles;
|
|
225
|
-
'scale.400': import("@emotion/react").SerializedStyles;
|
|
226
|
-
'scale.500': import("@emotion/react").SerializedStyles;
|
|
227
|
-
'scale.600': import("@emotion/react").SerializedStyles;
|
|
228
|
-
};
|
|
229
|
-
export declare type Width = keyof typeof widthMap;
|
|
230
|
-
declare const heightMap: {
|
|
231
|
-
'scale.0': import("@emotion/react").SerializedStyles;
|
|
232
|
-
'scale.025': import("@emotion/react").SerializedStyles;
|
|
233
|
-
'scale.050': import("@emotion/react").SerializedStyles;
|
|
234
|
-
'scale.075': import("@emotion/react").SerializedStyles;
|
|
235
|
-
'scale.100': import("@emotion/react").SerializedStyles;
|
|
236
|
-
'scale.150': import("@emotion/react").SerializedStyles;
|
|
237
|
-
'scale.200': import("@emotion/react").SerializedStyles;
|
|
238
|
-
'scale.250': import("@emotion/react").SerializedStyles;
|
|
239
|
-
'scale.300': import("@emotion/react").SerializedStyles;
|
|
240
|
-
'scale.400': import("@emotion/react").SerializedStyles;
|
|
241
|
-
'scale.500': import("@emotion/react").SerializedStyles;
|
|
242
|
-
'scale.600': import("@emotion/react").SerializedStyles;
|
|
243
|
-
};
|
|
244
|
-
export declare type Height = keyof typeof heightMap;
|
|
245
267
|
/**
|
|
246
268
|
* @codegenEnd
|
|
247
269
|
*/
|
|
@@ -69,7 +69,7 @@ declare const Inline: import("react").MemoExoticComponent<import("react").Forwar
|
|
|
69
69
|
export default Inline;
|
|
70
70
|
/**
|
|
71
71
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
72
|
-
* @codegen <<SignedSource::
|
|
72
|
+
* @codegen <<SignedSource::76168a57c8f10c9f325865d2189aa0ff>>
|
|
73
73
|
* @codegenId spacing
|
|
74
74
|
* @codegenCommand yarn codegen-styles
|
|
75
75
|
* @codegenParams ["columnGap"]
|
|
@@ -81,6 +81,7 @@ declare const columnGapMap: {
|
|
|
81
81
|
'scale.050': import("@emotion/react").SerializedStyles;
|
|
82
82
|
'scale.075': import("@emotion/react").SerializedStyles;
|
|
83
83
|
'scale.100': import("@emotion/react").SerializedStyles;
|
|
84
|
+
'scale.1000': import("@emotion/react").SerializedStyles;
|
|
84
85
|
'scale.150': import("@emotion/react").SerializedStyles;
|
|
85
86
|
'scale.200': import("@emotion/react").SerializedStyles;
|
|
86
87
|
'scale.250': import("@emotion/react").SerializedStyles;
|
|
@@ -88,6 +89,7 @@ declare const columnGapMap: {
|
|
|
88
89
|
'scale.400': import("@emotion/react").SerializedStyles;
|
|
89
90
|
'scale.500': import("@emotion/react").SerializedStyles;
|
|
90
91
|
'scale.600': import("@emotion/react").SerializedStyles;
|
|
92
|
+
'scale.800': import("@emotion/react").SerializedStyles;
|
|
91
93
|
};
|
|
92
94
|
export declare type ColumnGap = keyof typeof columnGapMap;
|
|
93
95
|
/**
|
|
@@ -55,7 +55,7 @@ declare const Stack: import("react").MemoExoticComponent<import("react").Forward
|
|
|
55
55
|
export default Stack;
|
|
56
56
|
/**
|
|
57
57
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
58
|
-
* @codegen <<SignedSource::
|
|
58
|
+
* @codegen <<SignedSource::2b10240c217de584b627a7e2f56d11a0>>
|
|
59
59
|
* @codegenId spacing
|
|
60
60
|
* @codegenCommand yarn codegen-styles
|
|
61
61
|
* @codegenParams ["rowGap"]
|
|
@@ -67,6 +67,7 @@ declare const rowGapMap: {
|
|
|
67
67
|
'scale.050': import("@emotion/react").SerializedStyles;
|
|
68
68
|
'scale.075': import("@emotion/react").SerializedStyles;
|
|
69
69
|
'scale.100': import("@emotion/react").SerializedStyles;
|
|
70
|
+
'scale.1000': import("@emotion/react").SerializedStyles;
|
|
70
71
|
'scale.150': import("@emotion/react").SerializedStyles;
|
|
71
72
|
'scale.200': import("@emotion/react").SerializedStyles;
|
|
72
73
|
'scale.250': import("@emotion/react").SerializedStyles;
|
|
@@ -74,6 +75,7 @@ declare const rowGapMap: {
|
|
|
74
75
|
'scale.400': import("@emotion/react").SerializedStyles;
|
|
75
76
|
'scale.500': import("@emotion/react").SerializedStyles;
|
|
76
77
|
'scale.600': import("@emotion/react").SerializedStyles;
|
|
78
|
+
'scale.800': import("@emotion/react").SerializedStyles;
|
|
77
79
|
};
|
|
78
80
|
export declare type RowGap = keyof typeof rowGapMap;
|
|
79
81
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Internal codegen of the spacing scale values. Only used for internal examples.
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::d351e41acd06f256fb46554409694f31>>
|
|
7
7
|
* @codegenCommand yarn codegen-styles
|
|
8
8
|
*/
|
|
9
|
-
export declare const spacingScale: readonly ["scale.0", "scale.025", "scale.050", "scale.075", "scale.100", "scale.150", "scale.200", "scale.250", "scale.300", "scale.400", "scale.500", "scale.600"];
|
|
9
|
+
export declare const spacingScale: readonly ["scale.0", "scale.025", "scale.050", "scale.075", "scale.100", "scale.150", "scale.200", "scale.250", "scale.300", "scale.400", "scale.500", "scale.600", "scale.800", "scale.1000"];
|
package/examples/04-inline.tsx
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from '../src';
|
|
10
10
|
import { spacingScale } from '../src/internal/spacing-scale';
|
|
11
11
|
|
|
12
|
-
const flexAlignItems = ['center', 'baseline', 'flexStart', 'flexEnd'];
|
|
13
|
-
const flexJustifyContent = ['center', 'flexStart', 'flexEnd'];
|
|
14
|
-
const flexWrap = ['wrap'];
|
|
12
|
+
const flexAlignItems = ['center', 'baseline', 'flexStart', 'flexEnd'] as const;
|
|
13
|
+
const flexJustifyContent = ['center', 'flexStart', 'flexEnd'] as const;
|
|
14
|
+
const flexWrap = ['wrap'] as const;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Inline permutations
|
|
@@ -46,9 +46,8 @@ export default () => {
|
|
|
46
46
|
{flexAlignItems.map((alignItemsValue) => (
|
|
47
47
|
<Stack key={alignItemsValue} gap="scale.300">
|
|
48
48
|
<Heading level="h500">{alignItemsValue}</Heading>
|
|
49
|
-
|
|
50
49
|
<Box backgroundColor="neutral" UNSAFE_style={{ height: '100px' }}>
|
|
51
|
-
<Inline gap="scale.200" alignItems={alignItemsValue
|
|
50
|
+
<Inline gap="scale.200" alignItems={alignItemsValue}>
|
|
52
51
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
53
52
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
54
53
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
@@ -57,7 +56,6 @@ export default () => {
|
|
|
57
56
|
</Stack>
|
|
58
57
|
))}
|
|
59
58
|
</Inline>
|
|
60
|
-
|
|
61
59
|
<Heading level="h600">justifyContent</Heading>
|
|
62
60
|
<Inline gap="scale.400">
|
|
63
61
|
{flexJustifyContent.map((justifyContentValue) => (
|
|
@@ -69,10 +67,7 @@ export default () => {
|
|
|
69
67
|
backgroundColor="neutral"
|
|
70
68
|
UNSAFE_style={{ width: '140px' }}
|
|
71
69
|
>
|
|
72
|
-
<Inline
|
|
73
|
-
gap="scale.200"
|
|
74
|
-
justifyContent={justifyContentValue as any}
|
|
75
|
-
>
|
|
70
|
+
<Inline gap="scale.200" justifyContent={justifyContentValue}>
|
|
76
71
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
77
72
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
78
73
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
@@ -88,7 +83,6 @@ export default () => {
|
|
|
88
83
|
{flexWrap.map((flexWrapValue) => (
|
|
89
84
|
<Stack key={flexWrapValue} gap="scale.300">
|
|
90
85
|
<Heading level="h500">{flexWrapValue}</Heading>
|
|
91
|
-
|
|
92
86
|
<Box backgroundColor="neutral" UNSAFE_style={{ width: '50px' }}>
|
|
93
87
|
<Inline gap="scale.200" flexWrap={flexWrapValue as any}>
|
|
94
88
|
<Box padding="scale.100" backgroundColor="success.bold" />
|
|
@@ -35,7 +35,7 @@ const fieldsetStyles = css({
|
|
|
35
35
|
|
|
36
36
|
export default () => {
|
|
37
37
|
return (
|
|
38
|
-
<Box width="
|
|
38
|
+
<Box width="size.500" padding="scale.100" testId="all">
|
|
39
39
|
<Stack gap="scale.200">
|
|
40
40
|
<Heading level="h400">Current ADS Buttons</Heading>
|
|
41
41
|
<Inline gap="scale.200">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ds-explorations",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "An experimental package for exploration and validation of spacing / typography foundations.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"atlassian": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
16
16
|
"scripts": {
|
|
17
|
-
"ak-postbuild": "cd ../../../ && yarn build @af/codegen && cd packages/design-system/ds-explorations && yarn codegen-styles",
|
|
17
|
+
"ak-postbuild": "cd ../../../ && yarn build @af/codegen && yarn build @atlaskit/tokens && cd packages/design-system/ds-explorations && yarn codegen-styles",
|
|
18
18
|
"codegen-styles": "ts-node --project ../../../tsconfig.node.json ./scripts/codegen-styles",
|
|
19
19
|
"prepare": "yarn ak-postbuild"
|
|
20
20
|
},
|
package/report.api.md
CHANGED
|
@@ -191,6 +191,7 @@ const columnGapMap: {
|
|
|
191
191
|
'scale.050': SerializedStyles;
|
|
192
192
|
'scale.075': SerializedStyles;
|
|
193
193
|
'scale.100': SerializedStyles;
|
|
194
|
+
'scale.1000': SerializedStyles;
|
|
194
195
|
'scale.150': SerializedStyles;
|
|
195
196
|
'scale.200': SerializedStyles;
|
|
196
197
|
'scale.250': SerializedStyles;
|
|
@@ -198,6 +199,7 @@ const columnGapMap: {
|
|
|
198
199
|
'scale.400': SerializedStyles;
|
|
199
200
|
'scale.500': SerializedStyles;
|
|
200
201
|
'scale.600': SerializedStyles;
|
|
202
|
+
'scale.800': SerializedStyles;
|
|
201
203
|
};
|
|
202
204
|
|
|
203
205
|
// @public (undocumented)
|
|
@@ -211,7 +213,7 @@ const displayMap: {
|
|
|
211
213
|
inlineFlex: SerializedStyles;
|
|
212
214
|
};
|
|
213
215
|
|
|
214
|
-
// @public
|
|
216
|
+
// @public
|
|
215
217
|
type FlexAlignItems = keyof typeof flexAlignItemsMap;
|
|
216
218
|
|
|
217
219
|
// @public (undocumented)
|
|
@@ -248,7 +250,7 @@ const flexAlignItemsMap_3: {
|
|
|
248
250
|
end: SerializedStyles;
|
|
249
251
|
};
|
|
250
252
|
|
|
251
|
-
// @public
|
|
253
|
+
// @public
|
|
252
254
|
type FlexDirection = keyof typeof flexDirectionMap;
|
|
253
255
|
|
|
254
256
|
// @public (undocumented)
|
|
@@ -257,7 +259,7 @@ const flexDirectionMap: {
|
|
|
257
259
|
row: SerializedStyles;
|
|
258
260
|
};
|
|
259
261
|
|
|
260
|
-
// @public
|
|
262
|
+
// @public
|
|
261
263
|
type FlexJustifyContent = keyof typeof flexJustifyContentMap;
|
|
262
264
|
|
|
263
265
|
// @public (undocumented)
|
|
@@ -333,18 +335,14 @@ type Height = keyof typeof heightMap;
|
|
|
333
335
|
|
|
334
336
|
// @public (undocumented)
|
|
335
337
|
const heightMap: {
|
|
336
|
-
'
|
|
337
|
-
'
|
|
338
|
-
'
|
|
339
|
-
'
|
|
340
|
-
'
|
|
341
|
-
'
|
|
342
|
-
'
|
|
343
|
-
'
|
|
344
|
-
'scale.300': SerializedStyles;
|
|
345
|
-
'scale.400': SerializedStyles;
|
|
346
|
-
'scale.500': SerializedStyles;
|
|
347
|
-
'scale.600': SerializedStyles;
|
|
338
|
+
'100%': SerializedStyles;
|
|
339
|
+
'size.100': SerializedStyles;
|
|
340
|
+
'size.1000': SerializedStyles;
|
|
341
|
+
'size.200': SerializedStyles;
|
|
342
|
+
'size.300': SerializedStyles;
|
|
343
|
+
'size.400': SerializedStyles;
|
|
344
|
+
'size.500': SerializedStyles;
|
|
345
|
+
'size.600': SerializedStyles;
|
|
348
346
|
};
|
|
349
347
|
|
|
350
348
|
// @public (undocumented)
|
|
@@ -403,6 +401,7 @@ const paddingBlockMap: {
|
|
|
403
401
|
'scale.050': SerializedStyles;
|
|
404
402
|
'scale.075': SerializedStyles;
|
|
405
403
|
'scale.100': SerializedStyles;
|
|
404
|
+
'scale.1000': SerializedStyles;
|
|
406
405
|
'scale.150': SerializedStyles;
|
|
407
406
|
'scale.200': SerializedStyles;
|
|
408
407
|
'scale.250': SerializedStyles;
|
|
@@ -410,6 +409,7 @@ const paddingBlockMap: {
|
|
|
410
409
|
'scale.400': SerializedStyles;
|
|
411
410
|
'scale.500': SerializedStyles;
|
|
412
411
|
'scale.600': SerializedStyles;
|
|
412
|
+
'scale.800': SerializedStyles;
|
|
413
413
|
};
|
|
414
414
|
|
|
415
415
|
// @public (undocumented)
|
|
@@ -422,6 +422,7 @@ const paddingInlineMap: {
|
|
|
422
422
|
'scale.050': SerializedStyles;
|
|
423
423
|
'scale.075': SerializedStyles;
|
|
424
424
|
'scale.100': SerializedStyles;
|
|
425
|
+
'scale.1000': SerializedStyles;
|
|
425
426
|
'scale.150': SerializedStyles;
|
|
426
427
|
'scale.200': SerializedStyles;
|
|
427
428
|
'scale.250': SerializedStyles;
|
|
@@ -429,6 +430,7 @@ const paddingInlineMap: {
|
|
|
429
430
|
'scale.400': SerializedStyles;
|
|
430
431
|
'scale.500': SerializedStyles;
|
|
431
432
|
'scale.600': SerializedStyles;
|
|
433
|
+
'scale.800': SerializedStyles;
|
|
432
434
|
};
|
|
433
435
|
|
|
434
436
|
// @public
|
|
@@ -438,6 +440,7 @@ const paddingMap: {
|
|
|
438
440
|
'scale.050': SerializedStyles;
|
|
439
441
|
'scale.075': SerializedStyles;
|
|
440
442
|
'scale.100': SerializedStyles;
|
|
443
|
+
'scale.1000': SerializedStyles;
|
|
441
444
|
'scale.150': SerializedStyles;
|
|
442
445
|
'scale.200': SerializedStyles;
|
|
443
446
|
'scale.250': SerializedStyles;
|
|
@@ -445,6 +448,7 @@ const paddingMap: {
|
|
|
445
448
|
'scale.400': SerializedStyles;
|
|
446
449
|
'scale.500': SerializedStyles;
|
|
447
450
|
'scale.600': SerializedStyles;
|
|
451
|
+
'scale.800': SerializedStyles;
|
|
448
452
|
};
|
|
449
453
|
|
|
450
454
|
// @public (undocumented)
|
|
@@ -470,6 +474,7 @@ const rowGapMap: {
|
|
|
470
474
|
'scale.050': SerializedStyles;
|
|
471
475
|
'scale.075': SerializedStyles;
|
|
472
476
|
'scale.100': SerializedStyles;
|
|
477
|
+
'scale.1000': SerializedStyles;
|
|
473
478
|
'scale.150': SerializedStyles;
|
|
474
479
|
'scale.200': SerializedStyles;
|
|
475
480
|
'scale.250': SerializedStyles;
|
|
@@ -477,6 +482,7 @@ const rowGapMap: {
|
|
|
477
482
|
'scale.400': SerializedStyles;
|
|
478
483
|
'scale.500': SerializedStyles;
|
|
479
484
|
'scale.600': SerializedStyles;
|
|
485
|
+
'scale.800': SerializedStyles;
|
|
480
486
|
};
|
|
481
487
|
|
|
482
488
|
// @public (undocumented)
|
|
@@ -587,20 +593,16 @@ const verticalAlignMap: {
|
|
|
587
593
|
// @public (undocumented)
|
|
588
594
|
type Width = keyof typeof widthMap;
|
|
589
595
|
|
|
590
|
-
// @public
|
|
596
|
+
// @public
|
|
591
597
|
const widthMap: {
|
|
592
|
-
'
|
|
593
|
-
'
|
|
594
|
-
'
|
|
595
|
-
'
|
|
596
|
-
'
|
|
597
|
-
'
|
|
598
|
-
'
|
|
599
|
-
'
|
|
600
|
-
'scale.300': SerializedStyles;
|
|
601
|
-
'scale.400': SerializedStyles;
|
|
602
|
-
'scale.500': SerializedStyles;
|
|
603
|
-
'scale.600': SerializedStyles;
|
|
598
|
+
'100%': SerializedStyles;
|
|
599
|
+
'size.100': SerializedStyles;
|
|
600
|
+
'size.1000': SerializedStyles;
|
|
601
|
+
'size.200': SerializedStyles;
|
|
602
|
+
'size.300': SerializedStyles;
|
|
603
|
+
'size.400': SerializedStyles;
|
|
604
|
+
'size.500': SerializedStyles;
|
|
605
|
+
'size.600': SerializedStyles;
|
|
604
606
|
};
|
|
605
607
|
|
|
606
608
|
// (No @packageDocumentation comment for this package)
|
|
@@ -6,6 +6,7 @@ import { createPartialSignedArtifact, createSignedArtifact } from '@af/codegen';
|
|
|
6
6
|
|
|
7
7
|
import { createColorStylesFromTemplate } from './color-codegen-template';
|
|
8
8
|
import { createColorMapTemplate } from './color-map-template';
|
|
9
|
+
import { createDimensionStylesFromTemplate } from './dimension-codegen-template';
|
|
9
10
|
import { createInteractionStylesFromTemplate } from './interaction-codegen';
|
|
10
11
|
import { createSpacingStylesFromTemplate } from './spacing-codegen-template';
|
|
11
12
|
import { createSpacingScaleTemplate } from './spacing-scale-template';
|
|
@@ -30,7 +31,7 @@ writeFile(
|
|
|
30
31
|
createSignedArtifact(
|
|
31
32
|
createSpacingScaleTemplate(),
|
|
32
33
|
'yarn codegen-styles',
|
|
33
|
-
'
|
|
34
|
+
'Internal codegen of the spacing scale values. Only used for internal examples.',
|
|
34
35
|
),
|
|
35
36
|
).then(() => console.log('spacing-scale.tsx written!'));
|
|
36
37
|
|
|
@@ -101,6 +102,28 @@ Promise.all(
|
|
|
101
102
|
},
|
|
102
103
|
);
|
|
103
104
|
|
|
105
|
+
return writeFile(targetPath, source).then(() =>
|
|
106
|
+
console.log(`${targetPath} written!`),
|
|
107
|
+
);
|
|
108
|
+
})
|
|
109
|
+
.then(() => {
|
|
110
|
+
const targetPath = join(
|
|
111
|
+
__dirname,
|
|
112
|
+
'../',
|
|
113
|
+
'src',
|
|
114
|
+
'components',
|
|
115
|
+
'box.partial.tsx',
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const source = createPartialSignedArtifact(
|
|
119
|
+
(options) => options.map(createDimensionStylesFromTemplate).join('\n'),
|
|
120
|
+
'yarn codegen-styles',
|
|
121
|
+
{
|
|
122
|
+
id: 'dimensions',
|
|
123
|
+
absoluteFilePath: targetPath,
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
104
127
|
return writeFile(targetPath, source).then(() =>
|
|
105
128
|
console.log(`${targetPath} written!`),
|
|
106
129
|
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import prettier from 'prettier';
|
|
2
|
+
import parserTypeScript from 'prettier/parser-typescript';
|
|
3
|
+
|
|
4
|
+
import { capitalize } from './utils';
|
|
5
|
+
|
|
6
|
+
const dimensionProperties = {
|
|
7
|
+
width: {
|
|
8
|
+
cssProperty: 'width',
|
|
9
|
+
},
|
|
10
|
+
height: {
|
|
11
|
+
cssProperty: 'height',
|
|
12
|
+
},
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
// placeholder adapted from packages/design-system/avatar/src/constants.ts
|
|
16
|
+
const dimensions = {
|
|
17
|
+
'size.100': '16px',
|
|
18
|
+
'size.200': '24px',
|
|
19
|
+
'size.300': '32px',
|
|
20
|
+
'size.400': '40px',
|
|
21
|
+
'size.500': '48px',
|
|
22
|
+
'size.600': '96px',
|
|
23
|
+
'size.1000': '192px',
|
|
24
|
+
'100%': '100%',
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
const activeTokens = Object.entries(dimensions).map(([name, value]) => ({
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
export const createDimensionStylesFromTemplate = (
|
|
33
|
+
spacingProperty: keyof typeof dimensionProperties,
|
|
34
|
+
) => {
|
|
35
|
+
if (!dimensionProperties[spacingProperty]) {
|
|
36
|
+
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { cssProperty } = dimensionProperties[spacingProperty];
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
prettier.format(
|
|
43
|
+
`
|
|
44
|
+
const ${spacingProperty}Map = {
|
|
45
|
+
${activeTokens
|
|
46
|
+
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
|
47
|
+
.map((token) => {
|
|
48
|
+
return `'${token.name}': css({ ${cssProperty}: '${token.value}' })`;
|
|
49
|
+
})
|
|
50
|
+
.join(',\n\t')}
|
|
51
|
+
};`,
|
|
52
|
+
{
|
|
53
|
+
singleQuote: true,
|
|
54
|
+
trailingComma: 'all',
|
|
55
|
+
parser: 'typescript',
|
|
56
|
+
plugins: [parserTypeScript],
|
|
57
|
+
},
|
|
58
|
+
) +
|
|
59
|
+
`\nexport type ${capitalize(
|
|
60
|
+
spacingProperty,
|
|
61
|
+
)} = keyof typeof ${spacingProperty}Map;\n`
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import prettier from 'prettier';
|
|
2
2
|
import parserTypeScript from 'prettier/parser-typescript';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import tokens from '@atlaskit/tokens/src/artifacts/tokens-raw/atlassian-spacing';
|
|
4
|
+
import tokens from '@atlaskit/tokens/spacing-raw';
|
|
6
5
|
|
|
7
6
|
import { capitalize, tokenToStyle } from './utils';
|
|
8
7
|
|
|
9
8
|
const spacingProperties = {
|
|
10
|
-
width: {
|
|
11
|
-
cssProperty: 'width',
|
|
12
|
-
},
|
|
13
|
-
height: {
|
|
14
|
-
cssProperty: 'height',
|
|
15
|
-
},
|
|
16
9
|
padding: {
|
|
17
10
|
cssProperty: 'padding',
|
|
18
11
|
},
|
|
@@ -33,21 +26,14 @@ const spacingProperties = {
|
|
|
33
26
|
},
|
|
34
27
|
} as const;
|
|
35
28
|
|
|
36
|
-
type Token = {
|
|
37
|
-
name: string;
|
|
38
|
-
fallback: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
29
|
const onlyScaleTokens = tokens.filter((token) =>
|
|
42
|
-
token.name.startsWith('
|
|
30
|
+
token.name.startsWith('space.'),
|
|
43
31
|
);
|
|
44
32
|
|
|
45
|
-
const activeTokens = onlyScaleTokens.map(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
33
|
+
const activeTokens = onlyScaleTokens.map((t) => ({
|
|
34
|
+
name: t.name,
|
|
35
|
+
fallback: t.attributes.pixelValue!,
|
|
36
|
+
}));
|
|
51
37
|
|
|
52
38
|
export const createSpacingStylesFromTemplate = (
|
|
53
39
|
spacingProperty: keyof typeof spacingProperties,
|
|
@@ -65,7 +51,8 @@ const ${spacingProperty}Map = {
|
|
|
65
51
|
${activeTokens
|
|
66
52
|
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
|
67
53
|
.map((token) => {
|
|
68
|
-
|
|
54
|
+
// TODO change this when we want to cut a major on the package
|
|
55
|
+
const propName = token.name.replace('space.', 'scale.');
|
|
69
56
|
return `'${propName}': ${tokenToStyle(
|
|
70
57
|
cssProperty,
|
|
71
58
|
token.name,
|