@atlaskit/primitives 17.1.1 → 18.0.1

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 (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/codemods/hypermod.config.tsx +5 -1
  3. package/constellation/anchor/usage.mdx +40 -38
  4. package/constellation/pressable/usage.mdx +23 -22
  5. package/dist/cjs/compiled/components/anchor.js +2 -4
  6. package/dist/cjs/compiled/components/box.js +1 -3
  7. package/dist/cjs/compiled/components/focusable.js +1 -3
  8. package/dist/cjs/compiled/components/pressable.js +2 -4
  9. package/dist/cjs/components/anchor.js +3 -5
  10. package/dist/cjs/components/bleed.js +1 -1
  11. package/dist/cjs/components/box.js +1 -3
  12. package/dist/cjs/components/pressable.js +1 -2
  13. package/dist/cjs/responsive/hide.js +1 -1
  14. package/dist/cjs/xcss/style-maps.partial.js +293 -292
  15. package/dist/es2019/compiled/components/anchor.js +2 -4
  16. package/dist/es2019/compiled/components/box.js +1 -3
  17. package/dist/es2019/compiled/components/focusable.js +1 -3
  18. package/dist/es2019/compiled/components/pressable.js +2 -4
  19. package/dist/es2019/components/anchor.js +3 -5
  20. package/dist/es2019/components/bleed.js +1 -1
  21. package/dist/es2019/components/box.js +1 -3
  22. package/dist/es2019/components/pressable.js +1 -2
  23. package/dist/es2019/responsive/hide.js +1 -1
  24. package/dist/es2019/xcss/style-maps.partial.js +293 -292
  25. package/dist/esm/compiled/components/anchor.js +2 -4
  26. package/dist/esm/compiled/components/box.js +1 -3
  27. package/dist/esm/compiled/components/focusable.js +1 -3
  28. package/dist/esm/compiled/components/pressable.js +2 -4
  29. package/dist/esm/components/anchor.js +3 -5
  30. package/dist/esm/components/bleed.js +1 -1
  31. package/dist/esm/components/box.js +1 -3
  32. package/dist/esm/components/pressable.js +1 -2
  33. package/dist/esm/responsive/hide.js +1 -1
  34. package/dist/esm/xcss/style-maps.partial.js +293 -292
  35. package/dist/types/compiled/components/flex.d.ts +2 -2
  36. package/dist/types/compiled/components/grid.d.ts +2 -2
  37. package/dist/types/compiled/components/inline.d.ts +2 -2
  38. package/dist/types/compiled/components/stack.d.ts +2 -2
  39. package/dist/types/compiled/index.d.ts +1 -1
  40. package/dist/types/components/flex.d.ts +19 -18
  41. package/dist/types/components/grid.d.ts +30 -29
  42. package/dist/types/components/inline.d.ts +1 -1
  43. package/dist/types/components/stack.d.ts +2 -2
  44. package/dist/types/components/text.d.ts +4 -3
  45. package/dist/types/responsive/build-media-query-css.d.ts +3 -3
  46. package/dist/types/responsive/media-helper.d.ts +17 -17
  47. package/dist/types/utils/has-text-ancestor-context.d.ts +2 -1
  48. package/dist/types/utils/surface-provider.d.ts +2 -1
  49. package/dist/types/xcss/style-maps.partial.d.ts +11 -11
  50. package/dist/types-ts4.5/compiled/components/flex.d.ts +2 -2
  51. package/dist/types-ts4.5/compiled/components/grid.d.ts +2 -2
  52. package/dist/types-ts4.5/compiled/components/inline.d.ts +2 -2
  53. package/dist/types-ts4.5/compiled/components/stack.d.ts +2 -2
  54. package/dist/types-ts4.5/compiled/index.d.ts +1 -1
  55. package/dist/types-ts4.5/components/flex.d.ts +19 -18
  56. package/dist/types-ts4.5/components/grid.d.ts +30 -29
  57. package/dist/types-ts4.5/components/inline.d.ts +1 -1
  58. package/dist/types-ts4.5/components/stack.d.ts +2 -2
  59. package/dist/types-ts4.5/components/text.d.ts +4 -3
  60. package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +3 -3
  61. package/dist/types-ts4.5/responsive/media-helper.d.ts +17 -17
  62. package/dist/types-ts4.5/utils/has-text-ancestor-context.d.ts +2 -1
  63. package/dist/types-ts4.5/utils/surface-provider.d.ts +2 -1
  64. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +11 -11
  65. package/package.json +8 -8
  66. package/scripts/codegen-styles.tsx +6 -9
  67. package/scripts/color-codegen-template.tsx +8 -9
  68. package/scripts/elevation-codegen-template.tsx +8 -9
  69. package/scripts/inverse-color-map-template.tsx +1 -1
  70. package/scripts/misc-codegen-template.tsx +3 -1
  71. package/scripts/shape-codegen-template.tsx +3 -1
  72. package/scripts/spacing-codegen-template.tsx +1 -1
  73. package/scripts/text-codegen-template.tsx +2 -2
  74. package/scripts/typography-codegen-template.tsx +7 -4
  75. package/scripts/utils.tsx +17 -10
@@ -2,7 +2,8 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import { type ElementType, type ReactNode } from 'react';
5
+ import { type ElementType, type ForwardRefExoticComponent, type MemoExoticComponent, type ReactNode, type RefAttributes } from 'react';
6
+ import { type SerializedStyles } from '@emotion/react';
6
7
  import { type Space } from '../xcss/style-maps.partial';
7
8
  import type { BasePrimitiveProps } from './types';
8
9
  export type GridProps<T extends ElementType = 'div'> = {
@@ -74,42 +75,42 @@ type JustifyItems = keyof typeof justifyItemsMap;
74
75
  type AlignItems = keyof typeof alignItemsMap;
75
76
  type AlignContent = keyof typeof alignContentMap;
76
77
  declare const justifyContentMap: {
77
- readonly start: import("@emotion/react").SerializedStyles;
78
- readonly center: import("@emotion/react").SerializedStyles;
79
- readonly end: import("@emotion/react").SerializedStyles;
80
- readonly 'space-between': import("@emotion/react").SerializedStyles;
81
- readonly 'space-around': import("@emotion/react").SerializedStyles;
82
- readonly 'space-evenly': import("@emotion/react").SerializedStyles;
83
- readonly stretch: import("@emotion/react").SerializedStyles;
78
+ readonly start: SerializedStyles;
79
+ readonly center: SerializedStyles;
80
+ readonly end: SerializedStyles;
81
+ readonly 'space-between': SerializedStyles;
82
+ readonly 'space-around': SerializedStyles;
83
+ readonly 'space-evenly': SerializedStyles;
84
+ readonly stretch: SerializedStyles;
84
85
  };
85
86
  declare const justifyItemsMap: {
86
- readonly start: import("@emotion/react").SerializedStyles;
87
- readonly center: import("@emotion/react").SerializedStyles;
88
- readonly end: import("@emotion/react").SerializedStyles;
89
- readonly stretch: import("@emotion/react").SerializedStyles;
87
+ readonly start: SerializedStyles;
88
+ readonly center: SerializedStyles;
89
+ readonly end: SerializedStyles;
90
+ readonly stretch: SerializedStyles;
90
91
  };
91
92
  declare const alignContentMap: {
92
- readonly start: import("@emotion/react").SerializedStyles;
93
- readonly center: import("@emotion/react").SerializedStyles;
94
- readonly end: import("@emotion/react").SerializedStyles;
95
- readonly 'space-between': import("@emotion/react").SerializedStyles;
96
- readonly 'space-around': import("@emotion/react").SerializedStyles;
97
- readonly 'space-evenly': import("@emotion/react").SerializedStyles;
98
- readonly stretch: import("@emotion/react").SerializedStyles;
93
+ readonly start: SerializedStyles;
94
+ readonly center: SerializedStyles;
95
+ readonly end: SerializedStyles;
96
+ readonly 'space-between': SerializedStyles;
97
+ readonly 'space-around': SerializedStyles;
98
+ readonly 'space-evenly': SerializedStyles;
99
+ readonly stretch: SerializedStyles;
99
100
  };
100
101
  declare const alignItemsMap: {
101
- readonly start: import("@emotion/react").SerializedStyles;
102
- readonly center: import("@emotion/react").SerializedStyles;
103
- readonly baseline: import("@emotion/react").SerializedStyles;
104
- readonly end: import("@emotion/react").SerializedStyles;
102
+ readonly start: SerializedStyles;
103
+ readonly center: SerializedStyles;
104
+ readonly baseline: SerializedStyles;
105
+ readonly end: SerializedStyles;
105
106
  };
106
107
  type AutoFlow = keyof typeof gridAutoFlowMap;
107
108
  declare const gridAutoFlowMap: {
108
- readonly row: import("@emotion/react").SerializedStyles;
109
- readonly column: import("@emotion/react").SerializedStyles;
110
- readonly dense: import("@emotion/react").SerializedStyles;
111
- readonly 'row dense': import("@emotion/react").SerializedStyles;
112
- readonly 'column dense': import("@emotion/react").SerializedStyles;
109
+ readonly row: SerializedStyles;
110
+ readonly column: SerializedStyles;
111
+ readonly dense: SerializedStyles;
112
+ readonly 'row dense': SerializedStyles;
113
+ readonly 'column dense': SerializedStyles;
113
114
  };
114
115
  /**
115
116
  * __Grid__
@@ -132,5 +133,5 @@ declare const gridAutoFlowMap: {
132
133
  * )
133
134
  * ```
134
135
  */
135
- declare const Grid: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<GridProps<ElementType>, "ref"> & import("react").RefAttributes<any>>>;
136
+ declare const Grid: MemoExoticComponent<ForwardRefExoticComponent<Omit<GridProps<ElementType>, 'ref'> & RefAttributes<any>>>;
136
137
  export default Grid;
@@ -70,5 +70,5 @@ export type InlineProps<T extends ElementType = 'div'> = {
70
70
  * ```
71
71
  *
72
72
  */
73
- declare const Inline: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<InlineProps<React.ElementType>, "ref"> & React.RefAttributes<any>>>;
73
+ declare const Inline: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<InlineProps<React.ElementType>, 'ref'> & React.RefAttributes<any>>>;
74
74
  export default Inline;
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import { type ElementType, type ReactNode } from 'react';
5
+ import { type ElementType, type ForwardRefExoticComponent, type MemoExoticComponent, type ReactNode, type RefAttributes } from 'react';
6
6
  import { type Space } from '../xcss/style-maps.partial';
7
7
  import type { AlignBlock, AlignInline, BasePrimitiveProps, Grow, Spread } from './types';
8
8
  export type StackProps<T extends ElementType = 'div'> = {
@@ -57,5 +57,5 @@ export type StackProps<T extends ElementType = 'div'> = {
57
57
  * ```
58
58
  *
59
59
  */
60
- declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<StackProps<ElementType>, "ref"> & import("react").RefAttributes<any>>>;
60
+ declare const Stack: MemoExoticComponent<ForwardRefExoticComponent<Omit<StackProps<ElementType>, 'ref'> & RefAttributes<any>>>;
61
61
  export default Stack;
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type ComponentPropsWithRef, type ElementType, type ReactNode } from 'react';
6
+ import { type SerializedStyles } from '@emotion/react';
6
7
  import { type TextColor, type TextSize, type TextWeight } from '../xcss/style-maps.partial';
7
8
  import type { BasePrimitiveProps } from './types';
8
9
  declare const asAllowlist: readonly [
@@ -57,9 +58,9 @@ type TextPropsBase<T extends ElementType = 'span'> = {
57
58
  export type TextProps<T extends ElementType = 'span'> = TextPropsBase<T> & Omit<BasePrimitiveProps, 'xcss'>;
58
59
  type TextAlign = keyof typeof textAlignMap;
59
60
  declare const textAlignMap: {
60
- center: import("@emotion/react").SerializedStyles;
61
- end: import("@emotion/react").SerializedStyles;
62
- start: import("@emotion/react").SerializedStyles;
61
+ center: SerializedStyles;
62
+ end: SerializedStyles;
63
+ start: SerializedStyles;
63
64
  };
64
65
  /**
65
66
  * __Text__
@@ -1,4 +1,4 @@
1
- import { type CSSObject } from '@emotion/react';
1
+ import { type CSSObject, type SerializedStyles } from '@emotion/react';
2
2
  import type { Breakpoint } from './types';
3
3
  /**
4
4
  * Build a map of breakpoints to css with media queries and nested styles.
@@ -30,7 +30,7 @@ export declare const UNSAFE_buildAboveMediaQueryCSS: (
30
30
  * The desired CSS to place inside of the media query.
31
31
  * This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
32
32
  */
33
- input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, import("@emotion/react").SerializedStyles>>>;
33
+ input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
34
34
  /**
35
35
  * Build a map of breakpoints to css with media queries and nested styles.
36
36
  *
@@ -60,4 +60,4 @@ export declare const UNSAFE_buildBelowMediaQueryCSS: (
60
60
  * The desired CSS to place inside of the media query.
61
61
  * This can either be a css object directly or functional with `breakpoint` as the arg to return a css object.
62
62
  */
63
- input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, import("@emotion/react").SerializedStyles>>>;
63
+ input: CSSObject | ((breakpoint: Breakpoint) => CSSObject)) => Required<Partial<Record<Breakpoint, SerializedStyles>>>;
@@ -38,26 +38,26 @@ export declare const media: {
38
38
  */
39
39
  export declare const UNSAFE_media: {
40
40
  above: {
41
- readonly xxs: "@media all";
42
- readonly xs: "@media (min-width: 30rem)";
43
- readonly sm: "@media (min-width: 48rem)";
44
- readonly md: "@media (min-width: 64rem)";
45
- readonly lg: "@media (min-width: 90rem)";
46
- readonly xl: "@media (min-width: 110.5rem)";
41
+ readonly xxs: '@media all';
42
+ readonly xs: '@media (min-width: 30rem)';
43
+ readonly sm: '@media (min-width: 48rem)';
44
+ readonly md: '@media (min-width: 64rem)';
45
+ readonly lg: '@media (min-width: 90rem)';
46
+ readonly xl: '@media (min-width: 110.5rem)';
47
47
  };
48
48
  only: {
49
- readonly xxs: "@media (min-width: 0rem) and (max-width: 29.99rem)";
50
- readonly xs: "@media (min-width: 30rem) and (max-width: 47.99rem)";
51
- readonly sm: "@media (min-width: 48rem) and (max-width: 63.99rem)";
52
- readonly md: "@media (min-width: 64rem) and (max-width: 89.99rem)";
53
- readonly lg: "@media (min-width: 90rem) and (max-width: 110.49rem)";
54
- readonly xl: "@media (min-width: 110.5rem)";
49
+ readonly xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)';
50
+ readonly xs: '@media (min-width: 30rem) and (max-width: 47.99rem)';
51
+ readonly sm: '@media (min-width: 48rem) and (max-width: 63.99rem)';
52
+ readonly md: '@media (min-width: 64rem) and (max-width: 89.99rem)';
53
+ readonly lg: '@media (min-width: 90rem) and (max-width: 110.49rem)';
54
+ readonly xl: '@media (min-width: 110.5rem)';
55
55
  };
56
56
  below: {
57
- readonly xs: "@media not all and (min-width: 30rem)";
58
- readonly sm: "@media not all and (min-width: 48rem)";
59
- readonly md: "@media not all and (min-width: 64rem)";
60
- readonly lg: "@media not all and (min-width: 90rem)";
61
- readonly xl: "@media not all and (min-width: 110.5rem)";
57
+ readonly xs: '@media not all and (min-width: 30rem)';
58
+ readonly sm: '@media not all and (min-width: 48rem)';
59
+ readonly md: '@media not all and (min-width: 64rem)';
60
+ readonly lg: '@media not all and (min-width: 90rem)';
61
+ readonly xl: '@media not all and (min-width: 110.5rem)';
62
62
  };
63
63
  };
@@ -1,3 +1,4 @@
1
+ import { type Provider } from 'react';
1
2
  /**
2
3
  * @internal
3
4
  */
@@ -5,4 +6,4 @@ export declare const useHasTextAncestor: () => boolean;
5
6
  /**
6
7
  * @internal
7
8
  */
8
- export declare const HasTextAncestorProvider: import("react").Provider<boolean>;
9
+ export declare const HasTextAncestorProvider: Provider<boolean>;
@@ -1,10 +1,11 @@
1
+ import { type Context } from 'react';
1
2
  import type { BackgroundColorToken } from './types';
2
3
  /**
3
4
  * __Surface context__
4
5
  *
5
6
  * A surface context provides context information on the current background (if set).
6
7
  */
7
- export declare const SurfaceContext: import("react").Context<BackgroundColorToken>;
8
+ export declare const SurfaceContext: Context<BackgroundColorToken>;
8
9
  /**
9
10
  * __useSurface__
10
11
  *
@@ -25,10 +25,10 @@ export type Dimension = keyof typeof dimensionMap;
25
25
  */
26
26
  /**
27
27
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
28
- * @codegen <<SignedSource::513f6a7e264ea3f9fe56eda322a28f64>>
28
+ * @codegen <<SignedSource::c9b68acdd57654884efd2f5087890624>>
29
29
  * @codegenId spacing
30
30
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
31
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::07b9c29f8d9f95e43d59a7b7ad4ce7a2>>
31
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::535518e7add48ef24f526d0904f70060>>
32
32
  */
33
33
  export declare const positiveSpaceMap: {
34
34
  'space.0': 'var(--ds-space-0)';
@@ -90,10 +90,10 @@ export type AllSpace = keyof typeof allSpaceMap;
90
90
  */
91
91
  /**
92
92
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
93
- * @codegen <<SignedSource::ee66de6d864a28baee9a085f01a27db6>>
93
+ * @codegen <<SignedSource::cefa2c59e15e6a3749ef38fa86c6adea>>
94
94
  * @codegenId inverse-colors
95
95
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
96
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::6ba535fc3d46f6c8a7b6384ed59ec8d6>>
96
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
97
97
  */
98
98
  export declare const inverseColorMap: {
99
99
  'color.background.neutral.bold': 'color.text.inverse';
@@ -129,11 +129,11 @@ export declare const inverseColorMap: {
129
129
  */
130
130
  /**
131
131
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
132
- * @codegen <<SignedSource::9532ccca897f438d49bda552ccfad635>>
132
+ * @codegen <<SignedSource::c673d53a0a31524e65f1c7051579eae5>>
133
133
  * @codegenId elevation
134
134
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
135
135
  * @codegenParams ["opacity", "shadow", "surface"]
136
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::6ba535fc3d46f6c8a7b6384ed59ec8d6>>
136
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
137
137
  */
138
138
  export declare const opacityMap: {
139
139
  'opacity.disabled': 'var(--ds-opacity-disabled)';
@@ -166,11 +166,11 @@ export type SurfaceColor = keyof typeof surfaceColorMap;
166
166
  */
167
167
  /**
168
168
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
169
- * @codegen <<SignedSource::5a98ba062e79517dbd51ee8599abebac>>
169
+ * @codegen <<SignedSource::fa88ed1ec5a817750b0348ca36dbb5f1>>
170
170
  * @codegenId colors
171
171
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
172
172
  * @codegenParams ["border", "background", "text", "fill"]
173
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::6ba535fc3d46f6c8a7b6384ed59ec8d6>>
173
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::38a7d4716f6999a6bdda9e4fe2bca6a1>>
174
174
  */
175
175
  export declare const borderColorMap: {
176
176
  'color.border': 'var(--ds-border)';
@@ -514,11 +514,11 @@ export type Layer = keyof typeof layerMap;
514
514
  */
515
515
  /**
516
516
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
517
- * @codegen <<SignedSource::2db762824a4c50f25f7829537dee1f49>>
517
+ * @codegen <<SignedSource::6ab2b394dd5a830d6966e333e20b1473>>
518
518
  * @codegenId border
519
519
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
520
520
  * @codegenParams ["width", "radius"]
521
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::6683952932c4ad145144ebc086a2548e>>
521
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-shape.tsx <<SignedSource::8817f4073995e5dc9c2bb766316632d6>>
522
522
  */
523
523
  export declare const borderWidthMap: {
524
524
  'border.width': 'var(--ds-border-width)';
@@ -542,7 +542,7 @@ export type BorderRadius = keyof typeof borderRadiusMap;
542
542
  */
543
543
  /**
544
544
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
545
- * @codegen <<SignedSource::f81d01fb664f365972ac87a2be86aba6>>
545
+ * @codegen <<SignedSource::64331f0b8b5e2f090a3aad153d92deb6>>
546
546
  * @codegenId typography
547
547
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
548
548
  * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "17.1.1",
3
+ "version": "18.0.1",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -133,11 +133,11 @@
133
133
  },
134
134
  "dependencies": {
135
135
  "@atlaskit/analytics-next": "^11.1.0",
136
- "@atlaskit/app-provider": "^3.3.0",
136
+ "@atlaskit/app-provider": "^4.1.0",
137
137
  "@atlaskit/css": "^0.19.0",
138
138
  "@atlaskit/ds-lib": "^5.3.0",
139
139
  "@atlaskit/interaction-context": "^3.1.0",
140
- "@atlaskit/tokens": "^10.0.0",
140
+ "@atlaskit/tokens": "^11.0.0",
141
141
  "@atlaskit/visually-hidden": "^3.0.0",
142
142
  "@babel/runtime": "^7.0.0",
143
143
  "@compiled/react": "^0.18.6",
@@ -154,21 +154,21 @@
154
154
  "@af/formatting": "workspace:^",
155
155
  "@af/integration-testing": "workspace:^",
156
156
  "@af/visual-regression": "workspace:^",
157
- "@atlaskit/avatar": "^25.7.0",
157
+ "@atlaskit/avatar": "^25.8.0",
158
158
  "@atlaskit/button": "^23.9.0",
159
159
  "@atlaskit/checkbox": "^17.3.0",
160
160
  "@atlaskit/code": "^17.4.0",
161
- "@atlaskit/docs": "^11.3.0",
161
+ "@atlaskit/docs": "^11.4.0",
162
162
  "@atlaskit/dropdown-menu": "^16.4.0",
163
163
  "@atlaskit/flag": "^17.8.0",
164
164
  "@atlaskit/form": "^15.3.0",
165
- "@atlaskit/heading": "^5.2.0",
166
- "@atlaskit/icon": "^29.4.0",
165
+ "@atlaskit/heading": "^5.3.0",
166
+ "@atlaskit/icon": "^31.0.0",
167
167
  "@atlaskit/icon-object": "^7.4.0",
168
168
  "@atlaskit/image": "^3.0.0",
169
169
  "@atlaskit/link": "^3.3.0",
170
170
  "@atlaskit/logo": "^19.10.0",
171
- "@atlaskit/lozenge": "^13.3.0",
171
+ "@atlaskit/lozenge": "^13.4.0",
172
172
  "@atlaskit/motion": "^5.3.0",
173
173
  "@atlaskit/range": "^9.3.0",
174
174
  "@atlaskit/section-message": "^8.12.0",
@@ -13,15 +13,12 @@ import { createSpacingStylesFromTemplate } from './spacing-codegen-template';
13
13
  import { createTextStylesFromTemplate } from './text-codegen-template';
14
14
  import { createTypographyStylesFromTemplate } from './typography-codegen-template';
15
15
 
16
- const colorTokensDependencyPath = require.resolve(
17
- '../../tokens/src/artifacts/tokens-raw/atlassian-light',
18
- );
19
- const spacingTokensDependencyPath = require.resolve(
20
- '../../tokens/src/artifacts/tokens-raw/atlassian-spacing',
21
- );
22
- const shapeTokensDependencyPath = require.resolve(
23
- '../../tokens/src/artifacts/tokens-raw/atlassian-shape',
24
- );
16
+ const colorTokensDependencyPath =
17
+ require.resolve('../../tokens/src/artifacts/tokens-raw/atlassian-light');
18
+ const spacingTokensDependencyPath =
19
+ require.resolve('../../tokens/src/artifacts/tokens-raw/atlassian-spacing');
20
+ const shapeTokensDependencyPath =
21
+ require.resolve('../../tokens/src/artifacts/tokens-raw/atlassian-shape');
25
22
 
26
23
  const templateFiles = readdirSync(join(__dirname, 'codegen-file-templates'), {
27
24
  withFileTypes: true,
@@ -1,5 +1,5 @@
1
1
  import format from '@af/formatting/sync';
2
- import { legacyLightTokens as legacyTokens, light as tokens } from '@atlaskit/tokens/tokens-raw';
2
+ import { light as tokens } from '@atlaskit/tokens/tokens-raw';
3
3
 
4
4
  import {
5
5
  capitalize,
@@ -48,20 +48,19 @@ const tokenStyles = {
48
48
  },
49
49
  } as const;
50
50
 
51
- const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
52
-
53
- const activeTokens = bothTokens
54
- .filter(([t]) => t.attributes.state !== 'deleted')
55
- .map((t) => t)
51
+ const activeTokens = tokens
52
+ .filter((t) => t.attributes.state !== 'deleted')
56
53
  .map(
57
- ([t, legacy]): Token => ({
54
+ (t): Token => ({
58
55
  token: t.name,
59
- fallback: legacy.value as string | ShadowDefinition,
56
+ fallback: t.value as string | ShadowDefinition,
60
57
  isDeprecated: t.attributes.state === 'deprecated',
61
58
  }),
62
59
  );
63
60
 
64
- export const createColorStylesFromTemplate = (colorProperty: keyof typeof tokenStyles) => {
61
+ export const createColorStylesFromTemplate: (colorProperty: keyof typeof tokenStyles) => string = (
62
+ colorProperty: keyof typeof tokenStyles,
63
+ ) => {
65
64
  if (!tokenStyles[colorProperty]) {
66
65
  throw new Error(`[codegen] Unknown option found "${colorProperty}"`);
67
66
  }
@@ -1,6 +1,6 @@
1
1
  import format from '@af/formatting/sync';
2
2
  import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
3
- import { legacyLightTokens as legacyTokens, light as tokens } from '@atlaskit/tokens/tokens-raw';
3
+ import { light as tokens } from '@atlaskit/tokens/tokens-raw';
4
4
 
5
5
  import {
6
6
  capitalize,
@@ -37,20 +37,19 @@ const tokenStyles = {
37
37
  },
38
38
  } as const;
39
39
 
40
- const bothTokens = tokens.map((t, i) => [t, legacyTokens[i]]);
41
-
42
- const activeTokens = bothTokens
43
- .filter(([t]) => t.attributes.state !== 'deleted')
44
- .map((t) => t)
40
+ const activeTokens = tokens
41
+ .filter((t) => t.attributes.state !== 'deleted')
45
42
  .map(
46
- ([t, legacy]): Token => ({
43
+ (t): Token => ({
47
44
  token: t.name,
48
- fallback: legacy.value as string | ShadowDefinition,
45
+ fallback: t.value as string | ShadowDefinition,
49
46
  isDeprecated: t.attributes.state === 'deprecated',
50
47
  }),
51
48
  );
52
49
 
53
- export const createElevationStylesFromTemplate = (property: keyof typeof tokenStyles) => {
50
+ export const createElevationStylesFromTemplate: (property: keyof typeof tokenStyles) => string = (
51
+ property: keyof typeof tokenStyles,
52
+ ) => {
54
53
  if (!tokenStyles[property]) {
55
54
  throw new Error(`[codegen] Unknown option found "${property}"`);
56
55
  }
@@ -22,7 +22,7 @@ const activeTokens = tokens
22
22
  // @ts-ignore
23
23
  .map((t) => ({ ...t, token: t.token.replaceAll('.[default]', '') }));
24
24
 
25
- export const createInverseColorMapTemplate = () => {
25
+ export const createInverseColorMapTemplate: () => string = () => {
26
26
  const propMap = activeTokens.map((t) => {
27
27
  // handle the default case eg color.border or color.text
28
28
  const propName = t.token;
@@ -1,7 +1,9 @@
1
1
  import { readFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
 
4
- export const createStylesFromFileTemplate = (
4
+ export const createStylesFromFileTemplate: (
5
+ property: 'border-color' | 'border-radius' | 'border-width' | 'dimensions' | 'layer',
6
+ ) => NonSharedBuffer = (
5
7
  property: 'border-color' | 'border-radius' | 'border-width' | 'dimensions' | 'layer',
6
8
  ) => {
7
9
  const path = join(__dirname, './codegen-file-templates', `${property}.tsx`);
@@ -35,7 +35,9 @@ const activeTokens = shapeTokens
35
35
  }),
36
36
  );
37
37
 
38
- export const createShapeStylesFromTemplate = (property: keyof typeof tokenStyles): string => {
38
+ export const createShapeStylesFromTemplate: (property: keyof typeof tokenStyles) => string = (
39
+ property: keyof typeof tokenStyles,
40
+ ): string => {
39
41
  if (!tokenStyles[property]) {
40
42
  throw new Error(`[codegen] Unknown option found "${property}"`);
41
43
  }
@@ -21,7 +21,7 @@ const negativeSpaceTokens = tokens
21
21
  fallback: t.value,
22
22
  }));
23
23
 
24
- export const createSpacingStylesFromTemplate = () => {
24
+ export const createSpacingStylesFromTemplate: () => string = () => {
25
25
  const output = [
26
26
  `export const positiveSpaceMap: {
27
27
  ${generateTypeDefs(positiveSpaceTokens.map((t) => t.name))}
@@ -9,7 +9,7 @@ type Token = {
9
9
  };
10
10
 
11
11
  const activeTokens: Token[] = tokens
12
- .filter((t) => t.attributes.state === 'active')
12
+ .filter((t) => t.attributes.state !== 'deleted')
13
13
  .map((t) => ({
14
14
  name: t.name,
15
15
  fallback: t.value,
@@ -62,7 +62,7 @@ const removeVerbosity = (name: string): string => {
62
62
  return name;
63
63
  };
64
64
 
65
- export const createTextStylesFromTemplate = () => {
65
+ export const createTextStylesFromTemplate: () => string = () => {
66
66
  return textProperties
67
67
  .map((textProperty) => {
68
68
  const { filterFn, objectName } = textProperty;
@@ -6,13 +6,15 @@ import { capitalize, constructTokenFunctionCall, generateTypeDefs } from './util
6
6
  type Token = {
7
7
  name: string;
8
8
  fallback: string;
9
+ isDeprecated: boolean;
9
10
  };
10
11
 
11
12
  const activeTokens: Token[] = tokens
12
- .filter((t) => t.attributes.state === 'active')
13
+ .filter((t) => t.attributes.state !== 'deleted')
13
14
  .map((t) => ({
14
15
  name: t.name,
15
16
  fallback: t.value,
17
+ isDeprecated: t.attributes.state === 'deprecated',
16
18
  }));
17
19
 
18
20
  const typographyProperties = [
@@ -40,7 +42,7 @@ const typographyProperties = [
40
42
  },
41
43
  ] as const;
42
44
 
43
- export const createTypographyStylesFromTemplate = () => {
45
+ export const createTypographyStylesFromTemplate: () => string = () => {
44
46
  return typographyProperties
45
47
  .map((typographyProperty) => {
46
48
  const { filterFn, objectName } = typographyProperty;
@@ -62,8 +64,9 @@ ${activeTokens
62
64
  .sort((a, b) => (a.name < b.name ? -1 : 1))
63
65
  .map((token) => {
64
66
  return `
65
- '${token.name}': ${constructTokenFunctionCall(token.name, token.fallback)}
66
- `.trim();
67
+ ${token.isDeprecated ? '// @deprecated' : ''}
68
+ '${token.name}': ${constructTokenFunctionCall(token.name, token.fallback)}
69
+ `.trim();
67
70
  })
68
71
  .join(',\n\t')}
69
72
  };`,
package/scripts/utils.tsx CHANGED
@@ -1,6 +1,9 @@
1
1
  import tokens from '@atlaskit/tokens/token-names';
2
2
 
3
- export const constructTokenFunctionCall = (token: string, fallback: string | ShadowDefinition) => {
3
+ export const constructTokenFunctionCall: (
4
+ token: string,
5
+ fallback: string | ShadowDefinition,
6
+ ) => string = (token: string, fallback: string | ShadowDefinition) => {
4
7
  if (Array.isArray(fallback)) {
5
8
  fallback = constructShadow(fallback);
6
9
  }
@@ -26,28 +29,32 @@ const constructShadow = (shadowObject: ShadowDefinition) => {
26
29
 
27
30
  type BooleanCallback<T> = (args: T) => boolean;
28
31
 
29
- export const compose =
32
+ export const compose: (...fns: ((...any: any[]) => any)[]) => (x: any) => any =
30
33
  (...fns: ((...any: any[]) => any)[]) =>
31
34
  (x: any) =>
32
35
  fns.reduce((res, fn) => fn(res), x);
33
- export const pick =
36
+ export const pick: <T extends any>(key: keyof T) => (obj: T) => T[keyof T] =
34
37
  <T extends any>(key: keyof T) =>
35
38
  (obj: T) =>
36
39
  obj[key];
37
- export const isAccent = (str: string) => str.includes('accent');
38
- export const isPressed = (str: string) => str.includes('pressed');
39
- export const isHovered = (str: string) => str.includes('hovered');
40
- export const not =
40
+ export const isAccent: (str: string) => boolean = (str: string) => str.includes('accent');
41
+ export const isPressed: (str: string) => boolean = (str: string) => str.includes('pressed');
42
+ export const isHovered: (str: string) => boolean = (str: string) => str.includes('hovered');
43
+ export const not: <T extends any>(cb: BooleanCallback<T>) => (val: T) => boolean =
41
44
  <T extends any>(cb: BooleanCallback<T>) =>
42
45
  (val: T) =>
43
46
  !cb(val);
44
- export const or =
47
+ export const or: <T extends any>(...fns: BooleanCallback<T>[]) => (val: T) => boolean =
45
48
  <T extends any>(...fns: BooleanCallback<T>[]) =>
46
49
  (val: T) =>
47
50
  fns.some((fn) => fn(val));
48
- export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
51
+ export const capitalize: (str: string) => string = (str: string) =>
52
+ str.charAt(0).toUpperCase() + str.slice(1);
49
53
 
50
- export const generateTypeDefs = (typedTokens: string[], tokenNames?: string[]) => {
54
+ export const generateTypeDefs: (typedTokens: string[], tokenNames?: string[]) => string = (
55
+ typedTokens: string[],
56
+ tokenNames?: string[],
57
+ ) => {
51
58
  return typedTokens
52
59
  .map((t, i) => {
53
60
  return `'${Array.isArray(tokenNames) ? tokenNames[i] : t}': 'var(${tokens[t as keyof typeof tokens]})'`;