@atlaskit/primitives 7.0.0 → 7.0.2

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 (76) hide show
  1. package/.eslintrc.js +1 -1
  2. package/CHANGELOG.md +19 -1
  3. package/LICENSE.md +6 -8
  4. package/constellation/anchor/code.mdx +3 -3
  5. package/constellation/anchor/examples.mdx +33 -39
  6. package/constellation/anchor/usage.mdx +60 -30
  7. package/constellation/bleed/code.mdx +3 -3
  8. package/constellation/bleed/examples.mdx +17 -13
  9. package/constellation/box/code.mdx +3 -3
  10. package/constellation/box/examples.mdx +25 -19
  11. package/constellation/box/usage.mdx +15 -5
  12. package/constellation/flex/code.mdx +3 -3
  13. package/constellation/flex/examples.mdx +12 -11
  14. package/constellation/grid/code.mdx +3 -3
  15. package/constellation/grid/examples.mdx +15 -10
  16. package/constellation/inline/code.mdx +3 -3
  17. package/constellation/inline/examples.mdx +32 -38
  18. package/constellation/inline/usage.mdx +15 -6
  19. package/constellation/overview/index.mdx +29 -27
  20. package/constellation/pressable/code.mdx +5 -4
  21. package/constellation/pressable/examples.mdx +41 -55
  22. package/constellation/pressable/usage.mdx +59 -36
  23. package/constellation/responsive/01-show/code.mdx +3 -3
  24. package/constellation/responsive/01-show/examples.mdx +9 -13
  25. package/constellation/responsive/02-hide/code.mdx +3 -3
  26. package/constellation/responsive/02-hide/examples.mdx +9 -13
  27. package/constellation/responsive/03-breakpoints/examples.mdx +3 -3
  28. package/constellation/responsive/examples.mdx +10 -10
  29. package/constellation/responsive/usage.mdx +23 -15
  30. package/constellation/stack/code.mdx +3 -3
  31. package/constellation/stack/examples.mdx +26 -20
  32. package/constellation/stack/usage.mdx +13 -5
  33. package/constellation/text/code.mdx +3 -3
  34. package/constellation/text/examples.mdx +29 -15
  35. package/constellation/text/usage.mdx +6 -3
  36. package/constellation/xcss/examples.mdx +7 -5
  37. package/constellation/xcss/migration.mdx +32 -25
  38. package/constellation/xcss/usage.mdx +72 -60
  39. package/dist/cjs/components/anchor.js +4 -4
  40. package/dist/cjs/components/pressable.js +1 -1
  41. package/dist/cjs/xcss/style-maps.partial.js +13 -13
  42. package/dist/es2019/components/anchor.js +4 -4
  43. package/dist/es2019/components/pressable.js +1 -1
  44. package/dist/es2019/xcss/style-maps.partial.js +13 -13
  45. package/dist/esm/components/anchor.js +4 -4
  46. package/dist/esm/components/pressable.js +1 -1
  47. package/dist/esm/xcss/style-maps.partial.js +13 -13
  48. package/dist/types/components/anchor.d.ts +4 -4
  49. package/dist/types/responsive/index.d.ts +2 -2
  50. package/dist/types/xcss/style-maps.partial.d.ts +13 -13
  51. package/dist/types-ts4.5/components/anchor.d.ts +4 -4
  52. package/dist/types-ts4.5/responsive/index.d.ts +2 -2
  53. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +13 -13
  54. package/extract-react-types/anchor-props.tsx +108 -116
  55. package/extract-react-types/bleed-props.tsx +17 -22
  56. package/extract-react-types/box-props.tsx +67 -70
  57. package/extract-react-types/flex-props.tsx +61 -61
  58. package/extract-react-types/grid-props.tsx +92 -92
  59. package/extract-react-types/hide-props.tsx +35 -35
  60. package/extract-react-types/inline-props.tsx +68 -68
  61. package/extract-react-types/pressable-props.tsx +101 -107
  62. package/extract-react-types/show-props.tsx +35 -35
  63. package/extract-react-types/stack-props.tsx +55 -55
  64. package/package.json +2 -2
  65. package/report.api.md +940 -965
  66. package/scripts/border-codegen-template.tsx +40 -47
  67. package/scripts/codegen-file-templates/dimensions.tsx +8 -8
  68. package/scripts/codegen-file-templates/layer.tsx +9 -9
  69. package/scripts/codegen-styles.tsx +97 -103
  70. package/scripts/color-codegen-template.tsx +61 -73
  71. package/scripts/elevation-codegen-template.tsx +50 -62
  72. package/scripts/inverse-color-map-template.tsx +26 -31
  73. package/scripts/misc-codegen-template.tsx +4 -9
  74. package/scripts/spacing-codegen-template.tsx +25 -31
  75. package/scripts/typography-codegen-template.tsx +59 -65
  76. package/scripts/utils.tsx +36 -43
@@ -2,33 +2,28 @@ import { type ReactNode } from 'react';
2
2
 
3
3
  import { type BasePrimitiveProps } from '../src/components/types';
4
4
 
5
- type Space =
6
- | 'space.025'
7
- | 'space.050'
8
- | 'space.100'
9
- | 'space.150'
10
- | 'space.200';
5
+ type Space = 'space.025' | 'space.050' | 'space.100' | 'space.150' | 'space.200';
11
6
 
12
7
  type BleedProps = {
13
- /**
14
- * Elements to be rendered inside the Flex.
15
- */
16
- children: ReactNode;
8
+ /**
9
+ * Elements to be rendered inside the Flex.
10
+ */
11
+ children: ReactNode;
17
12
 
18
- /**
19
- * Bleed along both axes.
20
- */
21
- all?: Space;
13
+ /**
14
+ * Bleed along both axes.
15
+ */
16
+ all?: Space;
22
17
 
23
- /**
24
- * Bleed along the inline axis.
25
- */
26
- inline?: Space;
18
+ /**
19
+ * Bleed along the inline axis.
20
+ */
21
+ inline?: Space;
27
22
 
28
- /**
29
- * Bleed along the block axis.
30
- */
31
- block?: Space;
23
+ /**
24
+ * Bleed along the block axis.
25
+ */
26
+ block?: Space;
32
27
  } & BasePrimitiveProps;
33
28
 
34
29
  export default function Bleed(_: BleedProps) {}
@@ -1,92 +1,89 @@
1
1
  // TODO: Switch from ERT to ts-morph when this is completed and has reasonable adoption: https://product-fabric.atlassian.net/browse/DSP-10364
2
2
  import type { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
3
3
 
4
- import {
5
- type BasePrimitiveProps,
6
- type StyleProp,
7
- } from '../src/components/types';
4
+ import { type BasePrimitiveProps, type StyleProp } from '../src/components/types';
8
5
 
9
6
  // eslint-disable-next-line @typescript-eslint/no-namespace
10
7
  namespace Token {
11
- // BoxProps['backgroundColor'] uses keyof, which ERT does not understand
12
- export type BackgroundColor = 'BackgroundColor';
8
+ // BoxProps['backgroundColor'] uses keyof, which ERT does not understand
9
+ export type BackgroundColor = 'BackgroundColor';
13
10
  }
14
11
 
15
12
  type Space =
16
- | 'space.0'
17
- | 'space.025'
18
- | 'space.050'
19
- | 'space.075'
20
- | 'space.100'
21
- | 'space.150'
22
- | 'space.200'
23
- | 'space.250'
24
- | 'space.300'
25
- | 'space.400'
26
- | 'space.500'
27
- | 'space.600'
28
- | 'space.800'
29
- | 'space.1000';
13
+ | 'space.0'
14
+ | 'space.025'
15
+ | 'space.050'
16
+ | 'space.075'
17
+ | 'space.100'
18
+ | 'space.150'
19
+ | 'space.200'
20
+ | 'space.250'
21
+ | 'space.300'
22
+ | 'space.400'
23
+ | 'space.500'
24
+ | 'space.600'
25
+ | 'space.800'
26
+ | 'space.1000';
30
27
 
31
28
  export default function Box(
32
- _: {
33
- /**
34
- * The DOM element to render as the Box. Defaults to `div`.
35
- */
36
- as?: ElementType;
29
+ _: {
30
+ /**
31
+ * The DOM element to render as the Box. Defaults to `div`.
32
+ */
33
+ as?: ElementType;
37
34
 
38
- /**
39
- * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
40
- */
41
- padding?: Space;
35
+ /**
36
+ * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
37
+ */
38
+ padding?: Space;
42
39
 
43
- /**
44
- * Tokens representing CSS shorthand `paddingBlock`.
45
- */
46
- paddingBlock?: Space;
40
+ /**
41
+ * Tokens representing CSS shorthand `paddingBlock`.
42
+ */
43
+ paddingBlock?: Space;
47
44
 
48
- /**
49
- * Tokens representing CSS `paddingBlockStart`.
50
- */
51
- paddingBlockStart?: Space;
45
+ /**
46
+ * Tokens representing CSS `paddingBlockStart`.
47
+ */
48
+ paddingBlockStart?: Space;
52
49
 
53
- /**
54
- * Tokens representing CSS `paddingBlockEnd`.
55
- */
56
- paddingBlockEnd?: Space;
50
+ /**
51
+ * Tokens representing CSS `paddingBlockEnd`.
52
+ */
53
+ paddingBlockEnd?: Space;
57
54
 
58
- /**
59
- * Tokens representing CSS shorthand `paddingInline`.
60
- */
61
- paddingInline?: Space;
55
+ /**
56
+ * Tokens representing CSS shorthand `paddingInline`.
57
+ */
58
+ paddingInline?: Space;
62
59
 
63
- /**
64
- * Tokens representing CSS `paddingInlineStart`.
65
- */
66
- paddingInlineStart?: Space;
60
+ /**
61
+ * Tokens representing CSS `paddingInlineStart`.
62
+ */
63
+ paddingInlineStart?: Space;
67
64
 
68
- /**
69
- * Tokens representing CSS `paddingInlineEnd`.
70
- */
71
- paddingInlineEnd?: Space;
65
+ /**
66
+ * Tokens representing CSS `paddingInlineEnd`.
67
+ */
68
+ paddingInlineEnd?: Space;
72
69
 
73
- /**
74
- * A token alias for background color. See:<br>
75
- * [https://atlassian.design/components/tokens/all-tokens#color-background](https://atlassian.design/components/tokens/all-tokens#color-background)<br>
76
- * When the background color is set to a [surface token](/components/tokens/all-tokens#elevation-surface),
77
- * the [current surface](/components/tokens/code#current-surface-color) CSS variable will also be set to this value in the Box styles.
78
- */
79
- backgroundColor?: Token.BackgroundColor;
70
+ /**
71
+ * A token alias for background color. See:<br>
72
+ * [https://atlassian.design/components/tokens/all-tokens#color-background](https://atlassian.design/components/tokens/all-tokens#color-background)<br>
73
+ * When the background color is set to a [surface token](/components/tokens/all-tokens#elevation-surface),
74
+ * the [current surface](/components/tokens/code#current-surface-color) CSS variable will also be set to this value in the Box styles.
75
+ */
76
+ backgroundColor?: Token.BackgroundColor;
80
77
 
81
- /**
82
- * Elements to be rendered inside the primitive.
83
- */
84
- children?: ReactNode;
78
+ /**
79
+ * Elements to be rendered inside the primitive.
80
+ */
81
+ children?: ReactNode;
85
82
 
86
- /**
87
- * Forwarded ref element.
88
- */
89
- ref?: ComponentPropsWithRef<ElementType>['ref'];
90
- } & BasePrimitiveProps &
91
- StyleProp,
83
+ /**
84
+ * Forwarded ref element.
85
+ */
86
+ ref?: ComponentPropsWithRef<ElementType>['ref'];
87
+ } & BasePrimitiveProps &
88
+ StyleProp,
92
89
  ) {}
@@ -3,78 +3,78 @@ import { type ElementType, type ReactNode } from 'react';
3
3
  import { type BasePrimitiveProps } from '../src/components/types';
4
4
 
5
5
  type Space =
6
- | 'space.0'
7
- | 'space.025'
8
- | 'space.050'
9
- | 'space.075'
10
- | 'space.100'
11
- | 'space.150'
12
- | 'space.200'
13
- | 'space.250'
14
- | 'space.300'
15
- | 'space.400'
16
- | 'space.500'
17
- | 'space.600'
18
- | 'space.800'
19
- | 'space.1000';
6
+ | 'space.0'
7
+ | 'space.025'
8
+ | 'space.050'
9
+ | 'space.075'
10
+ | 'space.100'
11
+ | 'space.150'
12
+ | 'space.200'
13
+ | 'space.250'
14
+ | 'space.300'
15
+ | 'space.400'
16
+ | 'space.500'
17
+ | 'space.600'
18
+ | 'space.800'
19
+ | 'space.1000';
20
20
 
21
21
  type FlexProps<T extends ElementType = 'div'> = {
22
- /**
23
- * The DOM element to render as the Flex. Defaults to `div`.
24
- */
25
- as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
22
+ /**
23
+ * The DOM element to render as the Flex. Defaults to `div`.
24
+ */
25
+ as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
26
26
 
27
- /**
28
- * Used to align children along the main axis.
29
- */
30
- justifyContent?:
31
- | 'start'
32
- | 'center'
33
- | 'end'
34
- | 'space-between'
35
- | 'space-around'
36
- | 'space-evenly'
37
- | 'stretch';
27
+ /**
28
+ * Used to align children along the main axis.
29
+ */
30
+ justifyContent?:
31
+ | 'start'
32
+ | 'center'
33
+ | 'end'
34
+ | 'space-between'
35
+ | 'space-around'
36
+ | 'space-evenly'
37
+ | 'stretch';
38
38
 
39
- /**
40
- * Used to align children along the cross axis.
41
- */
42
- alignItems?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
39
+ /**
40
+ * Used to align children along the cross axis.
41
+ */
42
+ alignItems?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
43
43
 
44
- /**
45
- * Represents the space between each child.
46
- */
47
- columnGap?: Space;
44
+ /**
45
+ * Represents the space between each child.
46
+ */
47
+ columnGap?: Space;
48
48
 
49
- /**
50
- * Represents the space between each child.
51
- */
52
- gap?: Space;
49
+ /**
50
+ * Represents the space between each child.
51
+ */
52
+ gap?: Space;
53
53
 
54
- /**
55
- * Represents the space between each child.
56
- */
57
- rowGap?: Space;
54
+ /**
55
+ * Represents the space between each child.
56
+ */
57
+ rowGap?: Space;
58
58
 
59
- /**
60
- * Represents the flex direction property of CSS flexbox.
61
- */
62
- direction?: 'row' | 'column';
59
+ /**
60
+ * Represents the flex direction property of CSS flexbox.
61
+ */
62
+ direction?: 'row' | 'column';
63
63
 
64
- /**
65
- * Represents the flex wrap property of CSS flexbox.
66
- */
67
- wrap?: 'wrap' | 'nowrap';
64
+ /**
65
+ * Represents the flex wrap property of CSS flexbox.
66
+ */
67
+ wrap?: 'wrap' | 'nowrap';
68
68
 
69
- /**
70
- * Elements to be rendered inside the Flex.
71
- */
72
- children: ReactNode;
69
+ /**
70
+ * Elements to be rendered inside the Flex.
71
+ */
72
+ children: ReactNode;
73
73
 
74
- /**
75
- * Forwarded ref element
76
- */
77
- ref?: React.ComponentPropsWithRef<T>['ref'];
74
+ /**
75
+ * Forwarded ref element
76
+ */
77
+ ref?: React.ComponentPropsWithRef<T>['ref'];
78
78
  } & BasePrimitiveProps;
79
79
 
80
80
  export default function Flex(_: FlexProps) {}
@@ -3,100 +3,100 @@ import { type ElementType, type ReactNode } from 'react';
3
3
  import { type BasePrimitiveProps } from '../src/components/types';
4
4
 
5
5
  type Space =
6
- | 'space.0'
7
- | 'space.025'
8
- | 'space.050'
9
- | 'space.075'
10
- | 'space.100'
11
- | 'space.150'
12
- | 'space.200'
13
- | 'space.250'
14
- | 'space.300'
15
- | 'space.400'
16
- | 'space.500'
17
- | 'space.600'
18
- | 'space.800'
19
- | 'space.1000';
6
+ | 'space.0'
7
+ | 'space.025'
8
+ | 'space.050'
9
+ | 'space.075'
10
+ | 'space.100'
11
+ | 'space.150'
12
+ | 'space.200'
13
+ | 'space.250'
14
+ | 'space.300'
15
+ | 'space.400'
16
+ | 'space.500'
17
+ | 'space.600'
18
+ | 'space.800'
19
+ | 'space.1000';
20
20
 
21
21
  type GridProps<T extends ElementType = 'div'> = {
22
- /**
23
- * The DOM element to render as the Flex. Defaults to `div`.
24
- */
25
- as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
26
-
27
- /**
28
- * Used to align children along the main axis.
29
- */
30
- justifyContent?:
31
- | 'start'
32
- | 'center'
33
- | 'end'
34
- | 'space-between'
35
- | 'space-around'
36
- | 'space-evenly'
37
- | 'stretch';
38
-
39
- /**
40
- * Used to align children along the cross axis.
41
- */
42
- alignItems?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
43
-
44
- /**
45
- * Represents the space between each child.
46
- */
47
- columnGap?: Space;
48
-
49
- /**
50
- * Represents the space between each child.
51
- */
52
- gap?: Space;
53
-
54
- /**
55
- * Represents the space between each child.
56
- */
57
- rowGap?: Space;
58
-
59
- /**
60
- * Specifies how auto-placed items get flowed into the grid. CSS `grid-auto-flow`.
61
- */
62
- autoFlow?: string;
63
-
64
- /**
65
- * CSS `grid-template-rows`.
66
- */
67
- templateRows?: string;
68
-
69
- /**
70
- * CSS `grid-template-columns`.
71
- */
72
- templateColumns?: string;
73
-
74
- /**
75
- * CSS `grid-template-areas`.
76
- *
77
- * Each item in the passed array is a grid row.
78
- */
79
- templateAreas?: string[];
80
-
81
- /**
82
- * Represents the flex direction property of CSS flexbox.
83
- */
84
- direction?: 'row' | 'column';
85
-
86
- /**
87
- * Represents the flex wrap property of CSS flexbox.
88
- */
89
- wrap?: 'wrap' | 'nowrap';
90
-
91
- /**
92
- * Elements to be rendered inside the Flex.
93
- */
94
- children: ReactNode;
95
-
96
- /**
97
- * Forwarded ref element
98
- */
99
- ref?: React.ComponentPropsWithRef<T>['ref'];
22
+ /**
23
+ * The DOM element to render as the Flex. Defaults to `div`.
24
+ */
25
+ as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
26
+
27
+ /**
28
+ * Used to align children along the main axis.
29
+ */
30
+ justifyContent?:
31
+ | 'start'
32
+ | 'center'
33
+ | 'end'
34
+ | 'space-between'
35
+ | 'space-around'
36
+ | 'space-evenly'
37
+ | 'stretch';
38
+
39
+ /**
40
+ * Used to align children along the cross axis.
41
+ */
42
+ alignItems?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
43
+
44
+ /**
45
+ * Represents the space between each child.
46
+ */
47
+ columnGap?: Space;
48
+
49
+ /**
50
+ * Represents the space between each child.
51
+ */
52
+ gap?: Space;
53
+
54
+ /**
55
+ * Represents the space between each child.
56
+ */
57
+ rowGap?: Space;
58
+
59
+ /**
60
+ * Specifies how auto-placed items get flowed into the grid. CSS `grid-auto-flow`.
61
+ */
62
+ autoFlow?: string;
63
+
64
+ /**
65
+ * CSS `grid-template-rows`.
66
+ */
67
+ templateRows?: string;
68
+
69
+ /**
70
+ * CSS `grid-template-columns`.
71
+ */
72
+ templateColumns?: string;
73
+
74
+ /**
75
+ * CSS `grid-template-areas`.
76
+ *
77
+ * Each item in the passed array is a grid row.
78
+ */
79
+ templateAreas?: string[];
80
+
81
+ /**
82
+ * Represents the flex direction property of CSS flexbox.
83
+ */
84
+ direction?: 'row' | 'column';
85
+
86
+ /**
87
+ * Represents the flex wrap property of CSS flexbox.
88
+ */
89
+ wrap?: 'wrap' | 'nowrap';
90
+
91
+ /**
92
+ * Elements to be rendered inside the Flex.
93
+ */
94
+ children: ReactNode;
95
+
96
+ /**
97
+ * Forwarded ref element
98
+ */
99
+ ref?: React.ComponentPropsWithRef<T>['ref'];
100
100
  } & BasePrimitiveProps;
101
101
 
102
102
  export default function Grid(_: GridProps) {}
@@ -3,46 +3,46 @@ import { type ReactNode } from 'react';
3
3
  import { type Breakpoint } from '../src/responsive/types';
4
4
 
5
5
  type As =
6
- | 'article'
7
- | 'aside'
8
- | 'dialog'
9
- | 'div'
10
- | 'footer'
11
- | 'header'
12
- | 'li'
13
- | 'main'
14
- | 'nav'
15
- | 'ol'
16
- | 'section'
17
- | 'span'
18
- | 'ul';
6
+ | 'article'
7
+ | 'aside'
8
+ | 'dialog'
9
+ | 'div'
10
+ | 'footer'
11
+ | 'header'
12
+ | 'li'
13
+ | 'main'
14
+ | 'nav'
15
+ | 'ol'
16
+ | 'section'
17
+ | 'span'
18
+ | 'ul';
19
19
 
20
20
  type ResponsiveHideProps = {
21
- /**
22
- * The DOM element to render as the Box. Defaults to `div`.
23
- */
24
- as?: As;
21
+ /**
22
+ * The DOM element to render as the Box. Defaults to `div`.
23
+ */
24
+ as?: As;
25
25
 
26
- /**
27
- * Elements to be rendered inside the primitive.
28
- */
29
- children: ReactNode;
26
+ /**
27
+ * Elements to be rendered inside the primitive.
28
+ */
29
+ children: ReactNode;
30
30
 
31
- /**
32
- * Apply CSS to hide this specifically **above** this breakpoint.
33
- * The smallest breakpoint is not included as it would always be shown and this would not be performant.
34
- *
35
- * @important do not mix `above` and `below` (TypeScript should prevent this)
36
- */
37
- above?: Exclude<Breakpoint, 'xxs'>;
31
+ /**
32
+ * Apply CSS to hide this specifically **above** this breakpoint.
33
+ * The smallest breakpoint is not included as it would always be shown and this would not be performant.
34
+ *
35
+ * @important do not mix `above` and `below` (TypeScript should prevent this)
36
+ */
37
+ above?: Exclude<Breakpoint, 'xxs'>;
38
38
 
39
- /**
40
- * Apply CSS to hide this specifically **below** this breakpoint.
41
- * The smallest breakpoint is not included as it would never be shown and this would not be performant.
42
- *
43
- * @important do not mix `above` and `below` (TypeScript should prevent this)
44
- */
45
- below?: Exclude<Breakpoint, 'xxs'>;
39
+ /**
40
+ * Apply CSS to hide this specifically **below** this breakpoint.
41
+ * The smallest breakpoint is not included as it would never be shown and this would not be performant.
42
+ *
43
+ * @important do not mix `above` and `below` (TypeScript should prevent this)
44
+ */
45
+ below?: Exclude<Breakpoint, 'xxs'>;
46
46
  };
47
47
 
48
48
  export default function Hide(_: ResponsiveHideProps) {}