@atlaskit/primitives 0.5.0 → 0.6.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 +6 -0
- package/dist/cjs/components/inline.partial.js +23 -91
- package/dist/cjs/components/internal/base-box.partial.js +81 -99
- package/dist/cjs/components/stack.partial.js +23 -47
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +19 -63
- package/dist/es2019/components/internal/base-box.partial.js +72 -68
- package/dist/es2019/components/stack.partial.js +19 -19
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +22 -91
- package/dist/esm/components/internal/base-box.partial.js +81 -99
- package/dist/esm/components/stack.partial.js +22 -47
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.d.ts +1 -2
- package/dist/types/components/inline.partial.d.ts +23 -37
- package/dist/types/components/internal/base-box.partial.d.ts +42 -43
- package/dist/types/components/stack.partial.d.ts +21 -19
- package/dist/types/components/types.d.ts +0 -46
- package/package.json +2 -3
- package/report.api.md +91 -136
- package/scripts/spacing-codegen-template.tsx +30 -30
- package/tmp/api-report-tmp.d.ts +91 -124
- package/dist/cjs/components/internal/types.js +0 -8
- package/dist/cjs/components/internal/utils.js +0 -16
- package/dist/es2019/components/internal/types.js +0 -1
- package/dist/es2019/components/internal/utils.js +0 -2
- package/dist/esm/components/internal/types.js +0 -1
- package/dist/esm/components/internal/utils.js +0 -7
- package/dist/types/components/internal/types.d.ts +0 -8
- package/dist/types/components/internal/utils.d.ts +0 -3
|
@@ -24,7 +24,7 @@ export interface StackProps<T extends ElementType = 'div'> {
|
|
|
24
24
|
/**
|
|
25
25
|
* Represents the space between each child.
|
|
26
26
|
*/
|
|
27
|
-
space?:
|
|
27
|
+
space?: Gap;
|
|
28
28
|
/**
|
|
29
29
|
* A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
|
|
30
30
|
*/
|
|
@@ -44,29 +44,31 @@ export declare type Spread = 'space-between';
|
|
|
44
44
|
export declare type Grow = 'hug' | 'fill';
|
|
45
45
|
/**
|
|
46
46
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
47
|
-
* @codegen <<SignedSource::
|
|
47
|
+
* @codegen <<SignedSource::4eb2c996d6ce5791acad51e2b226635f>>
|
|
48
48
|
* @codegenId spacing
|
|
49
49
|
* @codegenCommand yarn codegen-styles
|
|
50
|
-
* @codegenParams ["
|
|
50
|
+
* @codegenParams ["stackSpace"]
|
|
51
51
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
52
52
|
*/
|
|
53
|
-
declare const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
declare const stackSpaceMap: {
|
|
54
|
+
[k: string]: {
|
|
55
|
+
readonly '0': import("@emotion/react").SerializedStyles;
|
|
56
|
+
readonly '025': import("@emotion/react").SerializedStyles;
|
|
57
|
+
readonly '050': import("@emotion/react").SerializedStyles;
|
|
58
|
+
readonly '075': import("@emotion/react").SerializedStyles;
|
|
59
|
+
readonly '100': import("@emotion/react").SerializedStyles;
|
|
60
|
+
readonly '150': import("@emotion/react").SerializedStyles;
|
|
61
|
+
readonly '200': import("@emotion/react").SerializedStyles;
|
|
62
|
+
readonly '250': import("@emotion/react").SerializedStyles;
|
|
63
|
+
readonly '300': import("@emotion/react").SerializedStyles;
|
|
64
|
+
readonly '400': import("@emotion/react").SerializedStyles;
|
|
65
|
+
readonly '500': import("@emotion/react").SerializedStyles;
|
|
66
|
+
readonly '600': import("@emotion/react").SerializedStyles;
|
|
67
|
+
readonly '800': import("@emotion/react").SerializedStyles;
|
|
68
|
+
readonly '1000': import("@emotion/react").SerializedStyles;
|
|
69
|
+
};
|
|
68
70
|
};
|
|
69
|
-
export declare type
|
|
71
|
+
export declare type Gap = keyof typeof stackSpaceMap.gap;
|
|
70
72
|
/**
|
|
71
73
|
* __Stack__
|
|
72
74
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { type BoxXCSS } from '../internal/xcss';
|
|
3
|
-
import type { BorderWidth, Display, Padding, PaddingBlock, PaddingBlockEnd, PaddingBlockStart, PaddingInline, PaddingInlineEnd, PaddingInlineStart } from './internal/base-box.partial';
|
|
4
3
|
export declare type BasePrimitiveProps = {
|
|
5
4
|
/**
|
|
6
5
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
@@ -12,51 +11,6 @@ export declare type BasePrimitiveProps = {
|
|
|
12
11
|
style?: CSSProperties;
|
|
13
12
|
};
|
|
14
13
|
export declare type PublicBoxPropsBase = {
|
|
15
|
-
/**
|
|
16
|
-
* Defines border width.
|
|
17
|
-
*/
|
|
18
|
-
borderWidth?: BorderWidth;
|
|
19
|
-
/**
|
|
20
|
-
* Defines display type and layout. Defaults to `block`.
|
|
21
|
-
*/
|
|
22
|
-
display?: Display;
|
|
23
|
-
/**
|
|
24
|
-
* Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
|
|
25
|
-
*
|
|
26
|
-
* @see paddingBlock
|
|
27
|
-
* @see paddingInline
|
|
28
|
-
*/
|
|
29
|
-
padding?: Padding;
|
|
30
|
-
/**
|
|
31
|
-
* Tokens representing CSS shorthand `paddingBlock`.
|
|
32
|
-
*
|
|
33
|
-
* @see paddingBlockStart
|
|
34
|
-
* @see paddingBlockEnd
|
|
35
|
-
*/
|
|
36
|
-
paddingBlock?: PaddingBlock;
|
|
37
|
-
/**
|
|
38
|
-
* Tokens representing CSS `paddingBlockStart`.
|
|
39
|
-
*/
|
|
40
|
-
paddingBlockStart?: PaddingBlockStart;
|
|
41
|
-
/**
|
|
42
|
-
* Tokens representing CSS `paddingBlockEnd`.
|
|
43
|
-
*/
|
|
44
|
-
paddingBlockEnd?: PaddingBlockEnd;
|
|
45
|
-
/**
|
|
46
|
-
* Tokens representing CSS shorthand `paddingInline`.
|
|
47
|
-
*
|
|
48
|
-
* @see paddingInlineStart
|
|
49
|
-
* @see paddingInlineEnd
|
|
50
|
-
*/
|
|
51
|
-
paddingInline?: PaddingInline;
|
|
52
|
-
/**
|
|
53
|
-
* Tokens representing CSS `paddingInlineStart`.
|
|
54
|
-
*/
|
|
55
|
-
paddingInlineStart?: PaddingInlineStart;
|
|
56
|
-
/**
|
|
57
|
-
* Tokens representing CSS `paddingInlineEnd`.
|
|
58
|
-
*/
|
|
59
|
-
paddingInlineEnd?: PaddingInlineEnd;
|
|
60
14
|
/**
|
|
61
15
|
* Safe subset of styles that can be applied as a classname.
|
|
62
16
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
"@atlaskit/tokens": "^1.2.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"@emotion/react": "^11.7.1",
|
|
44
|
-
"@emotion/serialize": "^1.1.0"
|
|
45
|
-
"tiny-invariant": "^1.2.0"
|
|
44
|
+
"@emotion/serialize": "^1.1.0"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
package/report.api.md
CHANGED
|
@@ -182,7 +182,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
182
182
|
backgroundColor?: BackgroundColor;
|
|
183
183
|
shadow?: Shadow;
|
|
184
184
|
borderStyle?: BorderStyle;
|
|
185
|
-
borderWidth?: BorderWidth
|
|
185
|
+
borderWidth?: BorderWidth;
|
|
186
186
|
borderColor?: BorderColor;
|
|
187
187
|
borderRadius?: BorderRadius;
|
|
188
188
|
layer?: Layer;
|
|
@@ -193,18 +193,16 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
193
193
|
overflow?: Overflow;
|
|
194
194
|
overflowInline?: OverflowInline;
|
|
195
195
|
overflowBlock?: OverflowBlock;
|
|
196
|
-
padding?: Padding
|
|
197
|
-
paddingBlock?: PaddingBlock
|
|
198
|
-
paddingBlockStart?: PaddingBlockStart
|
|
199
|
-
paddingBlockEnd?: PaddingBlockEnd
|
|
200
|
-
paddingInline?: PaddingInline
|
|
201
|
-
paddingInlineStart?:
|
|
202
|
-
|
|
203
|
-
| ResponsiveObject<PaddingInlineStart>;
|
|
204
|
-
paddingInlineEnd?: PaddingInlineEnd | ResponsiveObject<PaddingInlineEnd>;
|
|
196
|
+
padding?: Padding;
|
|
197
|
+
paddingBlock?: PaddingBlock;
|
|
198
|
+
paddingBlockStart?: PaddingBlockStart;
|
|
199
|
+
paddingBlockEnd?: PaddingBlockEnd;
|
|
200
|
+
paddingInline?: PaddingInline;
|
|
201
|
+
paddingInlineStart?: PaddingInlineStart;
|
|
202
|
+
paddingInlineEnd?: PaddingInlineEnd;
|
|
205
203
|
width?: Width;
|
|
206
204
|
height?: Height;
|
|
207
|
-
display?: Display
|
|
205
|
+
display?: Display;
|
|
208
206
|
position?: Position;
|
|
209
207
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
210
208
|
};
|
|
@@ -293,9 +291,9 @@ type BorderWidth_2 = keyof typeof borderWidthMap_2;
|
|
|
293
291
|
|
|
294
292
|
// @public (undocumented)
|
|
295
293
|
const borderWidthMap: {
|
|
296
|
-
readonly 'size.0':
|
|
297
|
-
readonly 'size.050':
|
|
298
|
-
readonly 'size.100':
|
|
294
|
+
readonly 'size.0': SerializedStyles;
|
|
295
|
+
readonly 'size.050': SerializedStyles;
|
|
296
|
+
readonly 'size.100': SerializedStyles;
|
|
299
297
|
};
|
|
300
298
|
|
|
301
299
|
// @public (undocumented)
|
|
@@ -308,19 +306,6 @@ const borderWidthMap_2: {
|
|
|
308
306
|
// @public
|
|
309
307
|
export const Box: BoxComponent;
|
|
310
308
|
|
|
311
|
-
// @public (undocumented)
|
|
312
|
-
const BOX_RESPONSIVE_PROPS: readonly [
|
|
313
|
-
'borderWidth',
|
|
314
|
-
'display',
|
|
315
|
-
'padding',
|
|
316
|
-
'paddingBlock',
|
|
317
|
-
'paddingBlockStart',
|
|
318
|
-
'paddingBlockEnd',
|
|
319
|
-
'paddingInline',
|
|
320
|
-
'paddingInlineStart',
|
|
321
|
-
'paddingInlineEnd',
|
|
322
|
-
];
|
|
323
|
-
|
|
324
309
|
// @public (undocumented)
|
|
325
310
|
type BoxComponent<T extends ElementType = 'div'> = (<
|
|
326
311
|
T extends ElementType = 'div',
|
|
@@ -332,13 +317,10 @@ type BoxComponent<T extends ElementType = 'div'> = (<
|
|
|
332
317
|
// @public (undocumented)
|
|
333
318
|
export type BoxProps<T extends ElementType = 'div'> = Omit<
|
|
334
319
|
BaseBoxProps<T>,
|
|
335
|
-
'className'
|
|
320
|
+
'className'
|
|
336
321
|
> &
|
|
337
322
|
PublicBoxPropsBase;
|
|
338
323
|
|
|
339
|
-
// @public (undocumented)
|
|
340
|
-
type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
|
|
341
|
-
|
|
342
324
|
// @public (undocumented)
|
|
343
325
|
type BoxStyles = SerializedStyles_2 & {
|
|
344
326
|
[boxTag]: true;
|
|
@@ -353,9 +335,6 @@ type BoxXCSS = {
|
|
|
353
335
|
readonly styles: BoxStyles;
|
|
354
336
|
};
|
|
355
337
|
|
|
356
|
-
// @public
|
|
357
|
-
type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
|
|
358
|
-
|
|
359
338
|
// @public (undocumented)
|
|
360
339
|
const dimensionMap: {
|
|
361
340
|
readonly '100%': '100%';
|
|
@@ -373,11 +352,11 @@ type Display = keyof typeof displayMap;
|
|
|
373
352
|
|
|
374
353
|
// @public (undocumented)
|
|
375
354
|
const displayMap: {
|
|
376
|
-
readonly block:
|
|
377
|
-
readonly inline:
|
|
378
|
-
readonly flex:
|
|
379
|
-
readonly 'inline-flex':
|
|
380
|
-
readonly 'inline-block':
|
|
355
|
+
readonly block: SerializedStyles;
|
|
356
|
+
readonly inline: SerializedStyles;
|
|
357
|
+
readonly flex: SerializedStyles;
|
|
358
|
+
readonly 'inline-flex': SerializedStyles;
|
|
359
|
+
readonly 'inline-block': SerializedStyles;
|
|
381
360
|
};
|
|
382
361
|
|
|
383
362
|
// @public (undocumented)
|
|
@@ -406,6 +385,12 @@ const flexShrinkMap: {
|
|
|
406
385
|
readonly '1': SerializedStyles;
|
|
407
386
|
};
|
|
408
387
|
|
|
388
|
+
// @public (undocumented)
|
|
389
|
+
type Gap = keyof typeof inlineSpaceMap.gap;
|
|
390
|
+
|
|
391
|
+
// @public (undocumented)
|
|
392
|
+
type Gap_2 = keyof typeof stackSpaceMap.gap;
|
|
393
|
+
|
|
409
394
|
// @public (undocumented)
|
|
410
395
|
type Grow = 'fill' | 'hug';
|
|
411
396
|
|
|
@@ -459,14 +444,34 @@ export interface InlineProps<T extends ElementType = 'div'> {
|
|
|
459
444
|
children: ReactNode;
|
|
460
445
|
grow?: Grow;
|
|
461
446
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
462
|
-
rowSpace?:
|
|
447
|
+
rowSpace?: RowGap;
|
|
463
448
|
separator?: string;
|
|
464
449
|
shouldWrap?: boolean;
|
|
465
|
-
space?:
|
|
450
|
+
space?: Gap;
|
|
466
451
|
spread?: Spread;
|
|
467
452
|
testId?: string;
|
|
468
453
|
}
|
|
469
454
|
|
|
455
|
+
// @public
|
|
456
|
+
const inlineSpaceMap: {
|
|
457
|
+
[k: string]: {
|
|
458
|
+
readonly '0': SerializedStyles;
|
|
459
|
+
readonly '025': SerializedStyles;
|
|
460
|
+
readonly '050': SerializedStyles;
|
|
461
|
+
readonly '075': SerializedStyles;
|
|
462
|
+
readonly '100': SerializedStyles;
|
|
463
|
+
readonly '150': SerializedStyles;
|
|
464
|
+
readonly '200': SerializedStyles;
|
|
465
|
+
readonly '250': SerializedStyles;
|
|
466
|
+
readonly '300': SerializedStyles;
|
|
467
|
+
readonly '400': SerializedStyles;
|
|
468
|
+
readonly '500': SerializedStyles;
|
|
469
|
+
readonly '600': SerializedStyles;
|
|
470
|
+
readonly '800': SerializedStyles;
|
|
471
|
+
readonly '1000': SerializedStyles;
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
|
|
470
475
|
// @public (undocumented)
|
|
471
476
|
type InlineStyles = SerializedStyles_2 & {
|
|
472
477
|
[inlineTag]: true;
|
|
@@ -531,45 +536,47 @@ const overflowMap: {
|
|
|
531
536
|
};
|
|
532
537
|
|
|
533
538
|
// @public (undocumented)
|
|
534
|
-
type Padding = keyof typeof paddingMap;
|
|
539
|
+
type Padding = keyof typeof paddingMap.padding;
|
|
535
540
|
|
|
536
541
|
// @public (undocumented)
|
|
537
542
|
type Padding_2 = keyof typeof paddingMap_2;
|
|
538
543
|
|
|
539
544
|
// @public (undocumented)
|
|
540
|
-
type PaddingBlock = keyof typeof paddingMap;
|
|
545
|
+
type PaddingBlock = keyof typeof paddingMap.paddingBlock;
|
|
541
546
|
|
|
542
547
|
// @public (undocumented)
|
|
543
|
-
type PaddingBlockEnd = keyof typeof paddingMap;
|
|
548
|
+
type PaddingBlockEnd = keyof typeof paddingMap.paddingBlockEnd;
|
|
544
549
|
|
|
545
550
|
// @public (undocumented)
|
|
546
|
-
type PaddingBlockStart = keyof typeof paddingMap;
|
|
551
|
+
type PaddingBlockStart = keyof typeof paddingMap.paddingBlockStart;
|
|
547
552
|
|
|
548
553
|
// @public (undocumented)
|
|
549
|
-
type PaddingInline = keyof typeof paddingMap;
|
|
554
|
+
type PaddingInline = keyof typeof paddingMap.paddingInline;
|
|
550
555
|
|
|
551
556
|
// @public (undocumented)
|
|
552
|
-
type PaddingInlineEnd = keyof typeof paddingMap;
|
|
557
|
+
type PaddingInlineEnd = keyof typeof paddingMap.paddingInlineEnd;
|
|
553
558
|
|
|
554
559
|
// @public (undocumented)
|
|
555
|
-
type PaddingInlineStart = keyof typeof paddingMap;
|
|
560
|
+
type PaddingInlineStart = keyof typeof paddingMap.paddingInlineStart;
|
|
556
561
|
|
|
557
562
|
// @public
|
|
558
563
|
const paddingMap: {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
564
|
+
[k: string]: {
|
|
565
|
+
readonly 'space.0': SerializedStyles;
|
|
566
|
+
readonly 'space.025': SerializedStyles;
|
|
567
|
+
readonly 'space.050': SerializedStyles;
|
|
568
|
+
readonly 'space.075': SerializedStyles;
|
|
569
|
+
readonly 'space.100': SerializedStyles;
|
|
570
|
+
readonly 'space.150': SerializedStyles;
|
|
571
|
+
readonly 'space.200': SerializedStyles;
|
|
572
|
+
readonly 'space.250': SerializedStyles;
|
|
573
|
+
readonly 'space.300': SerializedStyles;
|
|
574
|
+
readonly 'space.400': SerializedStyles;
|
|
575
|
+
readonly 'space.500': SerializedStyles;
|
|
576
|
+
readonly 'space.600': SerializedStyles;
|
|
577
|
+
readonly 'space.800': SerializedStyles;
|
|
578
|
+
readonly 'space.1000': SerializedStyles;
|
|
579
|
+
};
|
|
573
580
|
};
|
|
574
581
|
|
|
575
582
|
// @public (undocumented)
|
|
@@ -603,41 +610,11 @@ const positionMap: {
|
|
|
603
610
|
|
|
604
611
|
// @public (undocumented)
|
|
605
612
|
type PublicBoxPropsBase = {
|
|
606
|
-
borderWidth?: BorderWidth;
|
|
607
|
-
display?: Display;
|
|
608
|
-
padding?: Padding;
|
|
609
|
-
paddingBlock?: PaddingBlock;
|
|
610
|
-
paddingBlockStart?: PaddingBlockStart;
|
|
611
|
-
paddingBlockEnd?: PaddingBlockEnd;
|
|
612
|
-
paddingInline?: PaddingInline;
|
|
613
|
-
paddingInlineStart?: PaddingInlineStart;
|
|
614
|
-
paddingInlineEnd?: PaddingInlineEnd;
|
|
615
613
|
xcss?: BoxXCSS;
|
|
616
614
|
};
|
|
617
615
|
|
|
618
|
-
// @public
|
|
619
|
-
type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
620
|
-
|
|
621
616
|
// @public (undocumented)
|
|
622
|
-
type
|
|
623
|
-
|
|
624
|
-
// @public (undocumented)
|
|
625
|
-
const rowSpaceMap: {
|
|
626
|
-
readonly '0': SerializedStyles;
|
|
627
|
-
readonly '025': SerializedStyles;
|
|
628
|
-
readonly '050': SerializedStyles;
|
|
629
|
-
readonly '075': SerializedStyles;
|
|
630
|
-
readonly '100': SerializedStyles;
|
|
631
|
-
readonly '150': SerializedStyles;
|
|
632
|
-
readonly '200': SerializedStyles;
|
|
633
|
-
readonly '250': SerializedStyles;
|
|
634
|
-
readonly '300': SerializedStyles;
|
|
635
|
-
readonly '400': SerializedStyles;
|
|
636
|
-
readonly '500': SerializedStyles;
|
|
637
|
-
readonly '600': SerializedStyles;
|
|
638
|
-
readonly '800': SerializedStyles;
|
|
639
|
-
readonly '1000': SerializedStyles;
|
|
640
|
-
};
|
|
617
|
+
type RowGap = keyof typeof inlineSpaceMap.rowGap;
|
|
641
618
|
|
|
642
619
|
// @public (undocumented)
|
|
643
620
|
type SafeCSSObject = CSSPseudos &
|
|
@@ -662,48 +639,6 @@ const shadowMap: {
|
|
|
662
639
|
readonly raised: SerializedStyles;
|
|
663
640
|
};
|
|
664
641
|
|
|
665
|
-
// @public (undocumented)
|
|
666
|
-
type Space = keyof typeof spaceMap;
|
|
667
|
-
|
|
668
|
-
// @public (undocumented)
|
|
669
|
-
type Space_2 = keyof typeof spaceMap_2;
|
|
670
|
-
|
|
671
|
-
// @public
|
|
672
|
-
const spaceMap: {
|
|
673
|
-
readonly '0': SerializedStyles;
|
|
674
|
-
readonly '025': SerializedStyles;
|
|
675
|
-
readonly '050': SerializedStyles;
|
|
676
|
-
readonly '075': SerializedStyles;
|
|
677
|
-
readonly '100': SerializedStyles;
|
|
678
|
-
readonly '150': SerializedStyles;
|
|
679
|
-
readonly '200': SerializedStyles;
|
|
680
|
-
readonly '250': SerializedStyles;
|
|
681
|
-
readonly '300': SerializedStyles;
|
|
682
|
-
readonly '400': SerializedStyles;
|
|
683
|
-
readonly '500': SerializedStyles;
|
|
684
|
-
readonly '600': SerializedStyles;
|
|
685
|
-
readonly '800': SerializedStyles;
|
|
686
|
-
readonly '1000': SerializedStyles;
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
// @public
|
|
690
|
-
const spaceMap_2: {
|
|
691
|
-
readonly '0': SerializedStyles;
|
|
692
|
-
readonly '025': SerializedStyles;
|
|
693
|
-
readonly '050': SerializedStyles;
|
|
694
|
-
readonly '075': SerializedStyles;
|
|
695
|
-
readonly '100': SerializedStyles;
|
|
696
|
-
readonly '150': SerializedStyles;
|
|
697
|
-
readonly '200': SerializedStyles;
|
|
698
|
-
readonly '250': SerializedStyles;
|
|
699
|
-
readonly '300': SerializedStyles;
|
|
700
|
-
readonly '400': SerializedStyles;
|
|
701
|
-
readonly '500': SerializedStyles;
|
|
702
|
-
readonly '600': SerializedStyles;
|
|
703
|
-
readonly '800': SerializedStyles;
|
|
704
|
-
readonly '1000': SerializedStyles;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
642
|
// @public (undocumented)
|
|
708
643
|
type Spread = 'space-between';
|
|
709
644
|
|
|
@@ -736,11 +671,31 @@ export interface StackProps<T extends ElementType = 'div'> {
|
|
|
736
671
|
children: ReactNode;
|
|
737
672
|
grow?: Grow_2;
|
|
738
673
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
739
|
-
space?:
|
|
674
|
+
space?: Gap_2;
|
|
740
675
|
spread?: Spread_2;
|
|
741
676
|
testId?: string;
|
|
742
677
|
}
|
|
743
678
|
|
|
679
|
+
// @public
|
|
680
|
+
const stackSpaceMap: {
|
|
681
|
+
[k: string]: {
|
|
682
|
+
readonly '0': SerializedStyles;
|
|
683
|
+
readonly '025': SerializedStyles;
|
|
684
|
+
readonly '050': SerializedStyles;
|
|
685
|
+
readonly '075': SerializedStyles;
|
|
686
|
+
readonly '100': SerializedStyles;
|
|
687
|
+
readonly '150': SerializedStyles;
|
|
688
|
+
readonly '200': SerializedStyles;
|
|
689
|
+
readonly '250': SerializedStyles;
|
|
690
|
+
readonly '300': SerializedStyles;
|
|
691
|
+
readonly '400': SerializedStyles;
|
|
692
|
+
readonly '500': SerializedStyles;
|
|
693
|
+
readonly '600': SerializedStyles;
|
|
694
|
+
readonly '800': SerializedStyles;
|
|
695
|
+
readonly '1000': SerializedStyles;
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
|
|
744
699
|
// @public (undocumented)
|
|
745
700
|
type TextColor = keyof typeof textColorMap;
|
|
746
701
|
|
|
@@ -3,13 +3,12 @@ import parserTypeScript from 'prettier/parser-typescript';
|
|
|
3
3
|
|
|
4
4
|
import { spacing as tokens } from '@atlaskit/tokens/tokens-raw';
|
|
5
5
|
|
|
6
|
-
import { capitalize,
|
|
6
|
+
import { capitalize, tokenToStyle } from './utils';
|
|
7
7
|
|
|
8
8
|
const spacingProperties: Record<
|
|
9
9
|
string,
|
|
10
10
|
{
|
|
11
11
|
cssProperties: readonly string[];
|
|
12
|
-
responsiveOutput?: boolean;
|
|
13
12
|
propNameFormatter?: (propName: string) => string;
|
|
14
13
|
}
|
|
15
14
|
> = {
|
|
@@ -23,14 +22,13 @@ const spacingProperties: Record<
|
|
|
23
22
|
'paddingInlineStart',
|
|
24
23
|
'paddingInlineEnd',
|
|
25
24
|
],
|
|
26
|
-
responsiveOutput: true,
|
|
27
25
|
},
|
|
28
|
-
|
|
29
|
-
cssProperties: ['gap'],
|
|
26
|
+
inlineSpace: {
|
|
27
|
+
cssProperties: ['gap', 'rowGap'],
|
|
30
28
|
propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
|
|
31
29
|
},
|
|
32
|
-
|
|
33
|
-
cssProperties: ['
|
|
30
|
+
stackSpace: {
|
|
31
|
+
cssProperties: ['gap'],
|
|
34
32
|
propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
|
|
35
33
|
},
|
|
36
34
|
} as const;
|
|
@@ -52,32 +50,34 @@ export const createSpacingStylesFromTemplate = (
|
|
|
52
50
|
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
const { cssProperties,
|
|
53
|
+
const { cssProperties, propNameFormatter } =
|
|
56
54
|
spacingProperties[spacingProperty]!;
|
|
57
55
|
|
|
58
56
|
return (
|
|
59
57
|
prettier.format(
|
|
60
58
|
`
|
|
61
|
-
const ${spacingProperty}Map =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.map(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
const ${spacingProperty}Map = Object.fromEntries(
|
|
60
|
+
[
|
|
61
|
+
'${cssProperties.join("','")}',
|
|
62
|
+
].map((property: string) => [
|
|
63
|
+
property,
|
|
64
|
+
{
|
|
65
|
+
${activeTokens
|
|
66
|
+
.sort((a, b) =>
|
|
67
|
+
a.name.localeCompare(b.name, undefined, { numeric: true }),
|
|
68
|
+
)
|
|
69
|
+
.map(token => {
|
|
70
|
+
const propName = propNameFormatter
|
|
71
|
+
? propNameFormatter(token.name)
|
|
72
|
+
: token.name;
|
|
73
|
+
return `'${propName}': ${tokenToStyle(
|
|
74
|
+
'[property]' as any,
|
|
75
|
+
token.name,
|
|
76
|
+
token.fallback,
|
|
77
|
+
)}`;
|
|
78
|
+
})}
|
|
79
|
+
} as const,
|
|
80
|
+
]));`,
|
|
81
81
|
{
|
|
82
82
|
singleQuote: true,
|
|
83
83
|
trailingComma: 'all',
|
|
@@ -89,8 +89,8 @@ const ${spacingProperty}Map = {
|
|
|
89
89
|
.map(
|
|
90
90
|
cssProperty =>
|
|
91
91
|
`\nexport type ${capitalize(
|
|
92
|
-
|
|
93
|
-
)} = keyof typeof ${spacingProperty}Map;`,
|
|
92
|
+
cssProperty,
|
|
93
|
+
)} = keyof typeof ${spacingProperty}Map.${cssProperty};`,
|
|
94
94
|
)
|
|
95
95
|
.join('') +
|
|
96
96
|
'\n')
|