@atlaskit/primitives 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/constellation/inline/code.mdx +9 -1
  3. package/constellation/inline/examples.mdx +2 -2
  4. package/constellation/overview/examples.mdx +2 -4
  5. package/constellation/stack/code.mdx +4 -2
  6. package/constellation/stack/examples.mdx +1 -1
  7. package/dist/cjs/components/internal/extract-react-types/inline-props.js +7 -0
  8. package/dist/cjs/components/internal/extract-react-types/stack-props.js +7 -0
  9. package/dist/cjs/internal/style-maps.partial.js +1 -1
  10. package/dist/cjs/internal/xcss.js +1 -1
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/components/internal/extract-react-types/inline-props.js +1 -0
  13. package/dist/es2019/components/internal/extract-react-types/stack-props.js +1 -0
  14. package/dist/es2019/internal/style-maps.partial.js +1 -1
  15. package/dist/es2019/internal/xcss.js +1 -1
  16. package/dist/es2019/version.json +1 -1
  17. package/dist/esm/components/internal/extract-react-types/inline-props.js +1 -0
  18. package/dist/esm/components/internal/extract-react-types/stack-props.js +1 -0
  19. package/dist/esm/internal/style-maps.partial.js +1 -1
  20. package/dist/esm/internal/xcss.js +1 -1
  21. package/dist/esm/version.json +1 -1
  22. package/dist/types/components/inline.d.ts +2 -2
  23. package/dist/types/components/internal/extract-react-types/inline-props.d.ts +2 -0
  24. package/dist/types/components/internal/extract-react-types/stack-props.d.ts +2 -0
  25. package/dist/types/components/stack.d.ts +2 -2
  26. package/dist/types/internal/style-maps.partial.d.ts +10 -10
  27. package/dist/types/internal/xcss.d.ts +5 -1
  28. package/extract-react-types/stack-props.tsx +3 -0
  29. package/package.json +2 -10
  30. package/report.api.md +155 -60
  31. package/scripts/spacing-codegen-template.tsx +19 -20
  32. package/tmp/api-report-tmp.d.ts +17 -48
  33. package/constellation/inline/usage.mdx +0 -7
  34. package/constellation/stack/usage.mdx +0 -7
  35. /package/extract-react-types/{inline.tsx → inline-props.tsx} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 0.8.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0969a35c1b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0969a35c1b0) - Allow type hinting for nested styles inside pseudo-selectors.
8
+
9
+ ## 0.8.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`7127e85932a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7127e85932a) - Update codegen to explicitly list spacing prop values as string unions for compatibility with extract-react-types.
14
+
3
15
  ## 0.8.3
4
16
 
5
17
  ### Patch Changes
@@ -1,3 +1,11 @@
1
+ ---
2
+ title: Inline
3
+ description: Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
4
+ order: 1
5
+ ---
6
+
7
+ import InlineProps from '!!extract-react-types-loader!../../src/components/internal/extract-react-types/inline-props'
8
+
1
9
  ## Props
2
10
 
3
- *Coming soon*
11
+ <PropsTable heading="" props={InlineProps} />
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Inline
3
- description: Inline is an abstraction to lay-out a group of elements horizontally.
3
+ description: Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
4
4
  order: 0
5
5
  ---
6
6
 
@@ -67,7 +67,7 @@ For logically related elements it's possible to specify a `separator` value.
67
67
 
68
68
  ## Width control
69
69
 
70
- By default an `Inline` will have its width influenced by the context where it appears.
70
+ By default an `Inline` will have its width influenced by the context where it appears.
71
71
 
72
72
  To control that the `grow` prop can be used with the values:
73
73
 
@@ -1,9 +1,7 @@
1
1
  ---
2
2
  title: Overview
3
- description: Overview of primitives..
3
+ description: Coming soon.
4
4
  order: 0
5
5
  ---
6
6
 
7
- ## Default
8
-
9
- This is placeholder text.
7
+ *Coming soon.*
@@ -1,9 +1,11 @@
1
1
  ---
2
2
  title: Stack
3
- description: A stack is...
3
+ description: Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
4
4
  order: 1
5
5
  ---
6
6
 
7
+ import StackProps from '!!extract-react-types-loader!../../src/components/internal/extract-react-types/stack-props'
8
+
7
9
  ## Props
8
10
 
9
- *Coming soon*
11
+ <PropsTable heading="" props={StackProps} />
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Stack
3
- description: Stack is an abstraction to lay-out a group of elements vertically.
3
+ description: Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
4
4
  order: 0
5
5
  ---
6
6
 
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Inline;
7
+ function Inline(_) {}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Inline;
7
+ function Inline(_) {}
@@ -32,7 +32,7 @@ exports.dimensionMap = dimensionMap;
32
32
 
33
33
  /**
34
34
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
35
- * @codegen <<SignedSource::b8ac4fd29ba83e2ab1c2713c35915067>>
35
+ * @codegen <<SignedSource::06b49ea9175072486628ad5a39dd0c4b>>
36
36
  * @codegenId spacing
37
37
  * @codegenCommand yarn codegen-styles
38
38
  * @codegenParams ["padding", "space"]
@@ -45,7 +45,7 @@ var transformStyles = function transformStyles(styleObj) {
45
45
  return styleObj;
46
46
  }
47
47
 
48
- // If styles are defined as an CSSObject[], recursively call on each element until we reach CSSObject
48
+ // If styles are defined as a CSSObject[], recursively call on each element until we reach CSSObject
49
49
  if (Array.isArray(styleObj)) {
50
50
  return styleObj.map(transformStyles);
51
51
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export default function Inline(_) {}
@@ -0,0 +1 @@
1
+ export default function Inline(_) {}
@@ -22,7 +22,7 @@ export const dimensionMap = {
22
22
  */
23
23
  /**
24
24
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
25
- * @codegen <<SignedSource::b8ac4fd29ba83e2ab1c2713c35915067>>
25
+ * @codegen <<SignedSource::06b49ea9175072486628ad5a39dd0c4b>>
26
26
  * @codegenId spacing
27
27
  * @codegenCommand yarn codegen-styles
28
28
  * @codegenParams ["padding", "space"]
@@ -32,7 +32,7 @@ const transformStyles = styleObj => {
32
32
  return styleObj;
33
33
  }
34
34
 
35
- // If styles are defined as an CSSObject[], recursively call on each element until we reach CSSObject
35
+ // If styles are defined as a CSSObject[], recursively call on each element until we reach CSSObject
36
36
  if (Array.isArray(styleObj)) {
37
37
  return styleObj.map(transformStyles);
38
38
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export default function Inline(_) {}
@@ -0,0 +1 @@
1
+ export default function Inline(_) {}
@@ -23,7 +23,7 @@ export var dimensionMap = {
23
23
  */
24
24
  /**
25
25
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
26
- * @codegen <<SignedSource::b8ac4fd29ba83e2ab1c2713c35915067>>
26
+ * @codegen <<SignedSource::06b49ea9175072486628ad5a39dd0c4b>>
27
27
  * @codegenId spacing
28
28
  * @codegenCommand yarn codegen-styles
29
29
  * @codegenParams ["padding", "space"]
@@ -36,7 +36,7 @@ var transformStyles = function transformStyles(styleObj) {
36
36
  return styleObj;
37
37
  }
38
38
 
39
- // If styles are defined as an CSSObject[], recursively call on each element until we reach CSSObject
39
+ // If styles are defined as a CSSObject[], recursively call on each element until we reach CSSObject
40
40
  if (Array.isArray(styleObj)) {
41
41
  return styleObj.map(transformStyles);
42
42
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
2
+ import { ElementType, ReactNode } from 'react';
3
3
  import { type Gap, type RowGap } from '../internal/style-maps.partial';
4
4
  export interface InlineProps<T extends ElementType = 'div'> {
5
5
  /**
@@ -50,7 +50,7 @@ export interface InlineProps<T extends ElementType = 'div'> {
50
50
  /**
51
51
  * Forwarded ref element
52
52
  */
53
- ref?: ComponentPropsWithRef<T>['ref'];
53
+ ref?: React.ComponentPropsWithRef<T>['ref'];
54
54
  }
55
55
  export declare type AlignInline = 'start' | 'center' | 'end';
56
56
  export declare type AlignBlock = 'start' | 'center' | 'end' | 'baseline';
@@ -0,0 +1,2 @@
1
+ import type { InlineProps } from '../../inline';
2
+ export default function Inline(_: InlineProps): void;
@@ -0,0 +1,2 @@
1
+ import type { StackProps } from '../../stack';
2
+ export default function Inline(_: StackProps): void;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
2
+ import { ElementType, ReactNode } from 'react';
3
3
  import { type Gap } from '../internal/style-maps.partial';
4
4
  export interface StackProps<T extends ElementType = 'div'> {
5
5
  /**
@@ -37,7 +37,7 @@ export interface StackProps<T extends ElementType = 'div'> {
37
37
  /**
38
38
  * Forwarded ref element
39
39
  */
40
- ref?: ComponentPropsWithRef<T>['ref'];
40
+ ref?: React.ComponentPropsWithRef<T>['ref'];
41
41
  }
42
42
  export declare type AlignInline = 'start' | 'center' | 'end';
43
43
  export declare type AlignBlock = 'start' | 'center' | 'end';
@@ -28,7 +28,7 @@ export declare type MaxHeight = keyof typeof dimensionMap;
28
28
  */
29
29
  /**
30
30
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
31
- * @codegen <<SignedSource::b8ac4fd29ba83e2ab1c2713c35915067>>
31
+ * @codegen <<SignedSource::06b49ea9175072486628ad5a39dd0c4b>>
32
32
  * @codegenId spacing
33
33
  * @codegenCommand yarn codegen-styles
34
34
  * @codegenParams ["padding", "space"]
@@ -50,13 +50,13 @@ export declare const paddingMap: {
50
50
  readonly 'space.800': "var(--ds-space-800)";
51
51
  readonly 'space.1000': "var(--ds-space-1000)";
52
52
  };
53
- export declare type Padding = keyof typeof paddingMap;
54
- export declare type PaddingBlock = keyof typeof paddingMap;
55
- export declare type PaddingBlockStart = keyof typeof paddingMap;
56
- export declare type PaddingBlockEnd = keyof typeof paddingMap;
57
- export declare type PaddingInline = keyof typeof paddingMap;
58
- export declare type PaddingInlineStart = keyof typeof paddingMap;
59
- export declare type PaddingInlineEnd = keyof typeof paddingMap;
53
+ export declare type Padding = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
54
+ export declare type PaddingBlock = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
55
+ export declare type PaddingBlockStart = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
56
+ export declare type PaddingBlockEnd = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
57
+ export declare type PaddingInline = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
58
+ export declare type PaddingInlineStart = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
59
+ export declare type PaddingInlineEnd = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
60
60
  export declare const spaceMap: {
61
61
  readonly 'space.0': "var(--ds-space-0)";
62
62
  readonly 'space.025': "var(--ds-space-025)";
@@ -73,8 +73,8 @@ export declare const spaceMap: {
73
73
  readonly 'space.800': "var(--ds-space-800)";
74
74
  readonly 'space.1000': "var(--ds-space-1000)";
75
75
  };
76
- export declare type Gap = keyof typeof spaceMap;
77
- export declare type RowGap = keyof typeof spaceMap;
76
+ export declare type Gap = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
77
+ export declare type RowGap = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800' | 'space.1000';
78
78
  /**
79
79
  * @codegenEnd
80
80
  */
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { css as cssEmotion } from '@emotion/react';
3
- import { CSSPropertiesWithMultiValues, CSSPseudos, SerializedStyles } from '@emotion/serialize';
3
+ import { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
4
+ import type * as CSS from 'csstype';
4
5
  import { Box, Inline } from '../index';
5
6
  import { TokenisedProps } from './style-maps.partial';
6
7
  declare const uniqueSymbol: unique symbol;
@@ -10,6 +11,9 @@ declare const uniqueSymbol: unique symbol;
10
11
  */
11
12
  declare type ParsedXcss = ReturnType<typeof cssEmotion> | ReturnType<typeof cssEmotion>[];
12
13
  export declare const parseXcss: (args: XCSS | Array<XCSS | false | undefined>) => ParsedXcss;
14
+ declare type CSSPseudos = {
15
+ [Pseudo in CSS.Pseudos]?: SafeCSSObject;
16
+ };
13
17
  declare type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
14
18
  declare type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
15
19
  declare const boxWrapper: (style: any) => {
@@ -0,0 +1,3 @@
1
+ import type { StackProps } from '../src/components/stack';
2
+
3
+ export default function Stack(_: StackProps) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,15 +29,6 @@
29
29
  "type": "alpha"
30
30
  }
31
31
  },
32
- {
33
- "title": "Box",
34
- "folder": "box",
35
- "slug": "primitives/box",
36
- "id": "@atlaskit/primitives/box",
37
- "status": {
38
- "type": "alpha"
39
- }
40
- },
41
32
  {
42
33
  "title": "Inline",
43
34
  "folder": "inline",
@@ -106,6 +97,7 @@
106
97
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
107
98
  "@atlassian/codegen": "^0.0.1",
108
99
  "@testing-library/react": "^12.1.5",
100
+ "csstype": "^3.1.0",
109
101
  "prettier": "^2.7.0",
110
102
  "react-dom": "^16.8.0",
111
103
  "ts-node": "^10.9.1",
package/report.api.md CHANGED
@@ -19,9 +19,9 @@
19
19
 
20
20
  import { ComponentPropsWithoutRef } from 'react';
21
21
  import { ComponentPropsWithRef } from 'react';
22
+ import type * as CSS_2 from 'csstype';
22
23
  import type { CSSProperties } from 'react';
23
24
  import { CSSPropertiesWithMultiValues } from '@emotion/serialize';
24
- import { CSSPseudos } from '@emotion/serialize';
25
25
  import { ElementType } from 'react';
26
26
  import { FC } from 'react';
27
27
  import { ForwardRefExoticComponent } from 'react';
@@ -296,6 +296,11 @@ type BoxXCSS = {
296
296
  readonly styles: BoxStyles;
297
297
  };
298
298
 
299
+ // @public (undocumented)
300
+ type CSSPseudos = {
301
+ [Pseudo in CSS_2.Pseudos]?: SafeCSSObject;
302
+ };
303
+
299
304
  // @public
300
305
  const dimensionMap: {
301
306
  readonly '100%': '100%';
@@ -347,7 +352,21 @@ const flexShrinkMap: {
347
352
  };
348
353
 
349
354
  // @public (undocumented)
350
- type Gap = keyof typeof spaceMap;
355
+ type Gap =
356
+ | 'space.0'
357
+ | 'space.025'
358
+ | 'space.050'
359
+ | 'space.075'
360
+ | 'space.100'
361
+ | 'space.1000'
362
+ | 'space.150'
363
+ | 'space.200'
364
+ | 'space.250'
365
+ | 'space.300'
366
+ | 'space.400'
367
+ | 'space.500'
368
+ | 'space.600'
369
+ | 'space.800';
351
370
 
352
371
  // @public (undocumented)
353
372
  type Grow = 'fill' | 'hug';
@@ -386,7 +405,7 @@ export interface InlineProps<T extends ElementType = 'div'> {
386
405
  as?: 'div' | 'ol' | 'span' | 'ul';
387
406
  children: ReactNode;
388
407
  grow?: Grow;
389
- ref?: ComponentPropsWithRef<T>['ref'];
408
+ ref?: React.ComponentPropsWithRef<T>['ref'];
390
409
  rowSpace?: RowGap;
391
410
  separator?: string;
392
411
  shouldWrap?: boolean;
@@ -459,43 +478,123 @@ const overflowMap: {
459
478
  };
460
479
 
461
480
  // @public (undocumented)
462
- type Padding = keyof typeof paddingMap;
463
-
464
- // @public (undocumented)
465
- type PaddingBlock = keyof typeof paddingMap;
466
-
467
- // @public (undocumented)
468
- type PaddingBlockEnd = keyof typeof paddingMap;
469
-
470
- // @public (undocumented)
471
- type PaddingBlockStart = keyof typeof paddingMap;
472
-
473
- // @public (undocumented)
474
- type PaddingInline = keyof typeof paddingMap;
475
-
476
- // @public (undocumented)
477
- type PaddingInlineEnd = keyof typeof paddingMap;
478
-
479
- // @public (undocumented)
480
- type PaddingInlineStart = keyof typeof paddingMap;
481
-
482
- // @public
483
- const paddingMap: {
484
- readonly 'space.0': 'var(--ds-space-0)';
485
- readonly 'space.025': 'var(--ds-space-025)';
486
- readonly 'space.050': 'var(--ds-space-050)';
487
- readonly 'space.075': 'var(--ds-space-075)';
488
- readonly 'space.100': 'var(--ds-space-100)';
489
- readonly 'space.150': 'var(--ds-space-150)';
490
- readonly 'space.200': 'var(--ds-space-200)';
491
- readonly 'space.250': 'var(--ds-space-250)';
492
- readonly 'space.300': 'var(--ds-space-300)';
493
- readonly 'space.400': 'var(--ds-space-400)';
494
- readonly 'space.500': 'var(--ds-space-500)';
495
- readonly 'space.600': 'var(--ds-space-600)';
496
- readonly 'space.800': 'var(--ds-space-800)';
497
- readonly 'space.1000': 'var(--ds-space-1000)';
498
- };
481
+ type Padding =
482
+ | 'space.0'
483
+ | 'space.025'
484
+ | 'space.050'
485
+ | 'space.075'
486
+ | 'space.100'
487
+ | 'space.1000'
488
+ | 'space.150'
489
+ | 'space.200'
490
+ | 'space.250'
491
+ | 'space.300'
492
+ | 'space.400'
493
+ | 'space.500'
494
+ | 'space.600'
495
+ | 'space.800';
496
+
497
+ // @public (undocumented)
498
+ type PaddingBlock =
499
+ | 'space.0'
500
+ | 'space.025'
501
+ | 'space.050'
502
+ | 'space.075'
503
+ | 'space.100'
504
+ | 'space.1000'
505
+ | 'space.150'
506
+ | 'space.200'
507
+ | 'space.250'
508
+ | 'space.300'
509
+ | 'space.400'
510
+ | 'space.500'
511
+ | 'space.600'
512
+ | 'space.800';
513
+
514
+ // @public (undocumented)
515
+ type PaddingBlockEnd =
516
+ | 'space.0'
517
+ | 'space.025'
518
+ | 'space.050'
519
+ | 'space.075'
520
+ | 'space.100'
521
+ | 'space.1000'
522
+ | 'space.150'
523
+ | 'space.200'
524
+ | 'space.250'
525
+ | 'space.300'
526
+ | 'space.400'
527
+ | 'space.500'
528
+ | 'space.600'
529
+ | 'space.800';
530
+
531
+ // @public (undocumented)
532
+ type PaddingBlockStart =
533
+ | 'space.0'
534
+ | 'space.025'
535
+ | 'space.050'
536
+ | 'space.075'
537
+ | 'space.100'
538
+ | 'space.1000'
539
+ | 'space.150'
540
+ | 'space.200'
541
+ | 'space.250'
542
+ | 'space.300'
543
+ | 'space.400'
544
+ | 'space.500'
545
+ | 'space.600'
546
+ | 'space.800';
547
+
548
+ // @public (undocumented)
549
+ type PaddingInline =
550
+ | 'space.0'
551
+ | 'space.025'
552
+ | 'space.050'
553
+ | 'space.075'
554
+ | 'space.100'
555
+ | 'space.1000'
556
+ | 'space.150'
557
+ | 'space.200'
558
+ | 'space.250'
559
+ | 'space.300'
560
+ | 'space.400'
561
+ | 'space.500'
562
+ | 'space.600'
563
+ | 'space.800';
564
+
565
+ // @public (undocumented)
566
+ type PaddingInlineEnd =
567
+ | 'space.0'
568
+ | 'space.025'
569
+ | 'space.050'
570
+ | 'space.075'
571
+ | 'space.100'
572
+ | 'space.1000'
573
+ | 'space.150'
574
+ | 'space.200'
575
+ | 'space.250'
576
+ | 'space.300'
577
+ | 'space.400'
578
+ | 'space.500'
579
+ | 'space.600'
580
+ | 'space.800';
581
+
582
+ // @public (undocumented)
583
+ type PaddingInlineStart =
584
+ | 'space.0'
585
+ | 'space.025'
586
+ | 'space.050'
587
+ | 'space.075'
588
+ | 'space.100'
589
+ | 'space.1000'
590
+ | 'space.150'
591
+ | 'space.200'
592
+ | 'space.250'
593
+ | 'space.300'
594
+ | 'space.400'
595
+ | 'space.500'
596
+ | 'space.600'
597
+ | 'space.800';
499
598
 
500
599
  // @public (undocumented)
501
600
  type Position = keyof typeof positionMap;
@@ -514,7 +613,21 @@ type PublicBoxPropsBase = {
514
613
  };
515
614
 
516
615
  // @public (undocumented)
517
- type RowGap = keyof typeof spaceMap;
616
+ type RowGap =
617
+ | 'space.0'
618
+ | 'space.025'
619
+ | 'space.050'
620
+ | 'space.075'
621
+ | 'space.100'
622
+ | 'space.1000'
623
+ | 'space.150'
624
+ | 'space.200'
625
+ | 'space.250'
626
+ | 'space.300'
627
+ | 'space.400'
628
+ | 'space.500'
629
+ | 'space.600'
630
+ | 'space.800';
518
631
 
519
632
  // @public (undocumented)
520
633
  type SafeCSSObject = CSSPseudos &
@@ -539,24 +652,6 @@ const shadowMap: {
539
652
  readonly raised: 'var(--ds-shadow-raised)';
540
653
  };
541
654
 
542
- // @public (undocumented)
543
- const spaceMap: {
544
- readonly 'space.0': 'var(--ds-space-0)';
545
- readonly 'space.025': 'var(--ds-space-025)';
546
- readonly 'space.050': 'var(--ds-space-050)';
547
- readonly 'space.075': 'var(--ds-space-075)';
548
- readonly 'space.100': 'var(--ds-space-100)';
549
- readonly 'space.150': 'var(--ds-space-150)';
550
- readonly 'space.200': 'var(--ds-space-200)';
551
- readonly 'space.250': 'var(--ds-space-250)';
552
- readonly 'space.300': 'var(--ds-space-300)';
553
- readonly 'space.400': 'var(--ds-space-400)';
554
- readonly 'space.500': 'var(--ds-space-500)';
555
- readonly 'space.600': 'var(--ds-space-600)';
556
- readonly 'space.800': 'var(--ds-space-800)';
557
- readonly 'space.1000': 'var(--ds-space-1000)';
558
- };
559
-
560
655
  // @public (undocumented)
561
656
  type Spread = 'space-between';
562
657
 
@@ -588,7 +683,7 @@ export interface StackProps<T extends ElementType = 'div'> {
588
683
  as?: 'div' | 'ol' | 'span' | 'ul';
589
684
  children: ReactNode;
590
685
  grow?: Grow_2;
591
- ref?: ComponentPropsWithRef<T>['ref'];
686
+ ref?: React.ComponentPropsWithRef<T>['ref'];
592
687
  space?: Gap;
593
688
  spread?: Spread_2;
594
689
  testId?: string;
@@ -48,9 +48,8 @@ export const createSpacingStylesFromTemplate = (
48
48
  const { cssProperties, propNameFormatter } =
49
49
  spacingProperties[spacingProperty]!;
50
50
 
51
- return (
52
- prettier.format(
53
- `
51
+ return prettier.format(
52
+ `
54
53
  export const ${spacingProperty}Map = {
55
54
  ${activeTokens
56
55
  .sort((a, b) =>
@@ -65,22 +64,22 @@ export const createSpacingStylesFromTemplate = (
65
64
  token.fallback,
66
65
  )}`;
67
66
  })}
68
- } as const;`,
69
- {
70
- singleQuote: true,
71
- trailingComma: 'all',
72
- parser: 'typescript',
73
- plugins: [parserTypeScript],
74
- },
75
- ) +
76
- (cssProperties
77
- .map(
78
- cssProperty =>
79
- `\nexport type ${capitalize(
80
- cssProperty,
81
- )} = keyof typeof ${spacingProperty}Map;`,
82
- )
83
- .join('') +
84
- '\n')
67
+ } as const;` +
68
+ (cssProperties
69
+ .map(
70
+ cssProperty =>
71
+ // TODO: Update to use `keyof` when ERT supports it: https://github.com/atlassian/extract-react-types/issues/149
72
+ `\nexport type ${capitalize(cssProperty)} = ${activeTokens
73
+ .map(token => `'${token.name}'`)
74
+ .join(' | ')}`,
75
+ )
76
+ .join('') +
77
+ '\n'),
78
+ {
79
+ singleQuote: true,
80
+ trailingComma: 'all',
81
+ parser: 'typescript',
82
+ plugins: [parserTypeScript],
83
+ },
85
84
  );
86
85
  };
@@ -8,9 +8,9 @@
8
8
 
9
9
  import { ComponentPropsWithoutRef } from 'react';
10
10
  import { ComponentPropsWithRef } from 'react';
11
+ import type * as CSS_2 from 'csstype';
11
12
  import type { CSSProperties } from 'react';
12
13
  import { CSSPropertiesWithMultiValues } from '@emotion/serialize';
13
- import { CSSPseudos } from '@emotion/serialize';
14
14
  import { ElementType } from 'react';
15
15
  import { FC } from 'react';
16
16
  import { ForwardRefExoticComponent } from 'react';
@@ -271,6 +271,11 @@ type BoxXCSS = {
271
271
  readonly styles: BoxStyles;
272
272
  };
273
273
 
274
+ // @public (undocumented)
275
+ type CSSPseudos = {
276
+ [Pseudo in CSS_2.Pseudos]?: SafeCSSObject;
277
+ };
278
+
274
279
  // @public
275
280
  const dimensionMap: {
276
281
  readonly '100%': "100%";
@@ -322,7 +327,7 @@ const flexShrinkMap: {
322
327
  };
323
328
 
324
329
  // @public (undocumented)
325
- type Gap = keyof typeof spaceMap;
330
+ type Gap = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
326
331
 
327
332
  // @public (undocumented)
328
333
  type Grow = 'fill' | 'hug';
@@ -343,7 +348,7 @@ export interface InlineProps<T extends ElementType = 'div'> {
343
348
  as?: 'div' | 'ol' | 'span' | 'ul';
344
349
  children: ReactNode;
345
350
  grow?: Grow;
346
- ref?: ComponentPropsWithRef<T>['ref'];
351
+ ref?: React.ComponentPropsWithRef<T>['ref'];
347
352
  rowSpace?: RowGap;
348
353
  separator?: string;
349
354
  shouldWrap?: boolean;
@@ -416,43 +421,25 @@ const overflowMap: {
416
421
  };
417
422
 
418
423
  // @public (undocumented)
419
- type Padding = keyof typeof paddingMap;
424
+ type Padding = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
420
425
 
421
426
  // @public (undocumented)
422
- type PaddingBlock = keyof typeof paddingMap;
427
+ type PaddingBlock = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
423
428
 
424
429
  // @public (undocumented)
425
- type PaddingBlockEnd = keyof typeof paddingMap;
430
+ type PaddingBlockEnd = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
426
431
 
427
432
  // @public (undocumented)
428
- type PaddingBlockStart = keyof typeof paddingMap;
433
+ type PaddingBlockStart = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
429
434
 
430
435
  // @public (undocumented)
431
- type PaddingInline = keyof typeof paddingMap;
436
+ type PaddingInline = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
432
437
 
433
438
  // @public (undocumented)
434
- type PaddingInlineEnd = keyof typeof paddingMap;
439
+ type PaddingInlineEnd = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
435
440
 
436
441
  // @public (undocumented)
437
- type PaddingInlineStart = keyof typeof paddingMap;
438
-
439
- // @public
440
- const paddingMap: {
441
- readonly 'space.0': "var(--ds-space-0)";
442
- readonly 'space.025': "var(--ds-space-025)";
443
- readonly 'space.050': "var(--ds-space-050)";
444
- readonly 'space.075': "var(--ds-space-075)";
445
- readonly 'space.100': "var(--ds-space-100)";
446
- readonly 'space.150': "var(--ds-space-150)";
447
- readonly 'space.200': "var(--ds-space-200)";
448
- readonly 'space.250': "var(--ds-space-250)";
449
- readonly 'space.300': "var(--ds-space-300)";
450
- readonly 'space.400': "var(--ds-space-400)";
451
- readonly 'space.500': "var(--ds-space-500)";
452
- readonly 'space.600': "var(--ds-space-600)";
453
- readonly 'space.800': "var(--ds-space-800)";
454
- readonly 'space.1000': "var(--ds-space-1000)";
455
- };
442
+ type PaddingInlineStart = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
456
443
 
457
444
  // @public (undocumented)
458
445
  type Position = keyof typeof positionMap;
@@ -471,7 +458,7 @@ type PublicBoxPropsBase = {
471
458
  };
472
459
 
473
460
  // @public (undocumented)
474
- type RowGap = keyof typeof spaceMap;
461
+ type RowGap = 'space.0' | 'space.025' | 'space.050' | 'space.075' | 'space.100' | 'space.1000' | 'space.150' | 'space.200' | 'space.250' | 'space.300' | 'space.400' | 'space.500' | 'space.600' | 'space.800';
475
462
 
476
463
  // @public (undocumented)
477
464
  type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
@@ -491,24 +478,6 @@ const shadowMap: {
491
478
  readonly raised: "var(--ds-shadow-raised)";
492
479
  };
493
480
 
494
- // @public (undocumented)
495
- const spaceMap: {
496
- readonly 'space.0': "var(--ds-space-0)";
497
- readonly 'space.025': "var(--ds-space-025)";
498
- readonly 'space.050': "var(--ds-space-050)";
499
- readonly 'space.075': "var(--ds-space-075)";
500
- readonly 'space.100': "var(--ds-space-100)";
501
- readonly 'space.150': "var(--ds-space-150)";
502
- readonly 'space.200': "var(--ds-space-200)";
503
- readonly 'space.250': "var(--ds-space-250)";
504
- readonly 'space.300': "var(--ds-space-300)";
505
- readonly 'space.400': "var(--ds-space-400)";
506
- readonly 'space.500': "var(--ds-space-500)";
507
- readonly 'space.600': "var(--ds-space-600)";
508
- readonly 'space.800': "var(--ds-space-800)";
509
- readonly 'space.1000': "var(--ds-space-1000)";
510
- };
511
-
512
481
  // @public (undocumented)
513
482
  type Spread = 'space-between';
514
483
 
@@ -525,7 +494,7 @@ export interface StackProps<T extends ElementType = 'div'> {
525
494
  as?: 'div' | 'ol' | 'span' | 'ul';
526
495
  children: ReactNode;
527
496
  grow?: Grow_2;
528
- ref?: ComponentPropsWithRef<T>['ref'];
497
+ ref?: React.ComponentPropsWithRef<T>['ref'];
529
498
  space?: Gap;
530
499
  spread?: Spread_2;
531
500
  testId?: string;
@@ -1,7 +0,0 @@
1
- ---
2
- order: 2
3
- ---
4
-
5
- ## Usage
6
-
7
- *Coming soon*
@@ -1,7 +0,0 @@
1
- ---
2
- order: 2
3
- ---
4
-
5
- ## Usage
6
-
7
- *Coming soon*