@atlaskit/tokens 0.9.1 → 0.9.4

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 (70) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/babel-plugin/package.json +3 -0
  3. package/css/atlassian-dark.css +7 -4
  4. package/css/atlassian-light.css +7 -4
  5. package/dist/cjs/artifacts/palettes-raw.js +1987 -0
  6. package/dist/cjs/artifacts/rename-mapping.js +8 -4
  7. package/dist/cjs/artifacts/token-default-values.js +8 -5
  8. package/dist/cjs/artifacts/token-names.js +6 -2
  9. package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +384 -6
  10. package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +384 -6
  11. package/dist/cjs/entry-points/palettes-raw.js +15 -0
  12. package/dist/cjs/entry-points/token-ids.js +1 -1
  13. package/dist/cjs/get-token.js +1 -1
  14. package/dist/cjs/tokens/atlassian-dark/color/background.js +2 -2
  15. package/dist/cjs/tokens/atlassian-light/color/background.js +2 -2
  16. package/dist/cjs/tokens/default/deprecated/deprecated.js +187 -0
  17. package/dist/cjs/tokens/palette.js +232 -116
  18. package/dist/cjs/utils/color-detection.js +129 -0
  19. package/dist/cjs/{token-ids.js → utils/token-ids.js} +1 -1
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/artifacts/palettes-raw.js +1979 -0
  22. package/dist/es2019/artifacts/rename-mapping.js +8 -5
  23. package/dist/es2019/artifacts/token-default-values.js +8 -6
  24. package/dist/es2019/artifacts/token-names.js +5 -2
  25. package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +383 -6
  26. package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +383 -6
  27. package/dist/es2019/entry-points/palettes-raw.js +1 -0
  28. package/dist/es2019/entry-points/token-ids.js +1 -1
  29. package/dist/es2019/get-token.js +1 -1
  30. package/dist/es2019/tokens/atlassian-dark/color/background.js +2 -2
  31. package/dist/es2019/tokens/atlassian-light/color/background.js +2 -2
  32. package/dist/es2019/tokens/default/deprecated/deprecated.js +187 -0
  33. package/dist/es2019/tokens/palette.js +232 -116
  34. package/dist/es2019/utils/color-detection.js +101 -0
  35. package/dist/es2019/{token-ids.js → utils/token-ids.js} +1 -1
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/artifacts/palettes-raw.js +1979 -0
  38. package/dist/esm/artifacts/rename-mapping.js +8 -5
  39. package/dist/esm/artifacts/token-default-values.js +8 -6
  40. package/dist/esm/artifacts/token-names.js +5 -2
  41. package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +383 -6
  42. package/dist/esm/artifacts/tokens-raw/atlassian-light.js +383 -6
  43. package/dist/esm/entry-points/palettes-raw.js +1 -0
  44. package/dist/esm/entry-points/token-ids.js +1 -1
  45. package/dist/esm/get-token.js +1 -1
  46. package/dist/esm/tokens/atlassian-dark/color/background.js +2 -2
  47. package/dist/esm/tokens/atlassian-light/color/background.js +2 -2
  48. package/dist/esm/tokens/default/deprecated/deprecated.js +187 -0
  49. package/dist/esm/tokens/palette.js +232 -116
  50. package/dist/esm/utils/color-detection.js +104 -0
  51. package/dist/esm/{token-ids.js → utils/token-ids.js} +1 -1
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/artifacts/palettes-raw.d.ts +24 -0
  54. package/dist/types/artifacts/rename-mapping.d.ts +8 -3
  55. package/dist/types/artifacts/token-default-values.d.ts +8 -3
  56. package/dist/types/artifacts/token-names.d.ts +5 -0
  57. package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +48 -0
  58. package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +48 -0
  59. package/dist/types/artifacts/types-internal.d.ts +3 -1
  60. package/dist/types/artifacts/types.d.ts +3 -1
  61. package/dist/types/entry-points/palettes-raw.d.ts +1 -0
  62. package/dist/types/entry-points/token-ids.d.ts +1 -1
  63. package/dist/types/types.d.ts +22 -7
  64. package/dist/types/utils/color-detection.d.ts +38 -0
  65. package/dist/types/{token-ids.d.ts → utils/token-ids.d.ts} +0 -0
  66. package/package.json +18 -5
  67. package/palettes-raw/package.json +10 -0
  68. package/rename-mapping/package.json +3 -0
  69. package/token-ids/package.json +3 -0
  70. package/token-names/package.json +3 -0
@@ -0,0 +1,104 @@
1
+ import { token } from '../index';
2
+ export var hexToRGBAValues = function hexToRGBAValues(hex) {
3
+ var hexColor = hex.replace('#', '');
4
+ return {
5
+ r: parseInt(hexColor.slice(0, 2), 16),
6
+ g: parseInt(hexColor.slice(2, 4), 16),
7
+ b: parseInt(hexColor.slice(4, 6), 16),
8
+ a: parseFloat((parseInt(hexColor.slice(6, 8), 16) / 255).toFixed(2))
9
+ };
10
+ };
11
+ export var hexToRGBA = function hexToRGBA(hex) {
12
+ var _hexToRGBAValues = hexToRGBAValues(hex),
13
+ r = _hexToRGBAValues.r,
14
+ g = _hexToRGBAValues.g,
15
+ b = _hexToRGBAValues.b,
16
+ a = _hexToRGBAValues.a;
17
+
18
+ return "rgb".concat(a ? 'a' : '', "(").concat(r, ",").concat(g, ",").concat(b).concat(a ? ",".concat(a) : '', ")");
19
+ };
20
+ export var getLuminance = function getLuminance(_ref) {
21
+ var r = _ref.r,
22
+ g = _ref.g,
23
+ b = _ref.b;
24
+ return (r * 299 + g * 587 + b * 114) / 1000;
25
+ };
26
+ /**
27
+ * Returns an accessible hard-coded text color based on the color contrast with
28
+ * the background.
29
+ *
30
+ * @param hex - The Hex color code of the background
31
+ * @param [opts.hardcodedSurface] - If set, a design token will be returned instead
32
+ * of a hard-coded color. This is to support more transparent backgrounds
33
+ * to allow the text to invert colors depending on the current theme's surface color.
34
+ */
35
+
36
+ export var getTextColorForBackground = function getTextColorForBackground(hex, opts) {
37
+ var _hexToRGBAValues2 = hexToRGBAValues(hex),
38
+ r = _hexToRGBAValues2.r,
39
+ g = _hexToRGBAValues2.g,
40
+ b = _hexToRGBAValues2.b,
41
+ a = _hexToRGBAValues2.a;
42
+
43
+ var lum = getLuminance({
44
+ r: r,
45
+ g: g,
46
+ b: b
47
+ });
48
+ var alphaLimit = 0.42;
49
+ var alphaConditionsPerSurface = {
50
+ light: a < alphaLimit,
51
+ dark: a > alphaLimit
52
+ };
53
+ var alphaLimitExceeded = (opts === null || opts === void 0 ? void 0 : opts.hardcodedSurface) && alphaConditionsPerSurface[opts.hardcodedSurface];
54
+
55
+ if (!(opts !== null && opts !== void 0 && opts.hardcodedSurface) && a < alphaLimit) {
56
+ // This color is transparent, so the text will mainly cast onto the surface behind.
57
+ // Needs to use tokens otherwise Dark mode would cause black text on black surface
58
+ return token('color.text', 'black');
59
+ }
60
+
61
+ return lum > 150 && !a || a && alphaLimitExceeded ? 'black' : 'white';
62
+ };
63
+ /**
64
+ * Returns a border if determined to be required based on the color contrast with
65
+ * the background.
66
+ *
67
+ * @param hex - The Hex color code of the background
68
+ */
69
+
70
+ export var getBorderForBackground = function getBorderForBackground(hex) {
71
+ var _hexToRGBAValues3 = hexToRGBAValues(hex),
72
+ r = _hexToRGBAValues3.r,
73
+ g = _hexToRGBAValues3.g,
74
+ b = _hexToRGBAValues3.b,
75
+ a = _hexToRGBAValues3.a;
76
+
77
+ var lum = getLuminance({
78
+ r: r,
79
+ g: g,
80
+ b: b
81
+ });
82
+ return lum > 240 || a < 0.2 ? "1px solid ".concat(token('color.border', '#091E4224')) : undefined;
83
+ };
84
+ /**
85
+ * Returns a box shadow formatted for CSS from a ShadowToken raw value.
86
+ *
87
+ * @param rawShadow - ShadowToken raw value
88
+ */
89
+
90
+ export var getBoxShadow = function getBoxShadow(rawShadow) {
91
+ return rawShadow.map(function (_ref2) {
92
+ var radius = _ref2.radius,
93
+ offset = _ref2.offset,
94
+ color = _ref2.color,
95
+ opacity = _ref2.opacity;
96
+
97
+ var _hexToRGBAValues4 = hexToRGBAValues(color),
98
+ r = _hexToRGBAValues4.r,
99
+ g = _hexToRGBAValues4.g,
100
+ b = _hexToRGBAValues4.b;
101
+
102
+ return "".concat(offset.x, "px ").concat(offset.y, "px ").concat(radius, "px rgba(").concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
103
+ }).join(',');
104
+ };
@@ -1,5 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { CSS_PREFIX } from './constants';
2
+ import { CSS_PREFIX } from '../constants';
3
3
  /**
4
4
  * Transforms a style dictionary token path to a CSS custom property.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "0.9.1",
3
+ "version": "0.9.4",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ]
@@ -0,0 +1,24 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::abcdccc44ca6140b822aacad9e9070cc>>
4
+ * @codegenCommand yarn build tokens
5
+ */
6
+ declare const tokens: {
7
+ value: string;
8
+ attributes: {
9
+ group: string;
10
+ category: string;
11
+ };
12
+ filePath: string;
13
+ isSource: boolean;
14
+ original: {
15
+ value: string;
16
+ attributes: {
17
+ group: string;
18
+ category: string;
19
+ };
20
+ };
21
+ name: string;
22
+ path: string[];
23
+ }[];
24
+ export default tokens;
@@ -1,14 +1,19 @@
1
1
  /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
2
4
  * This file is intended to help automate renaming of tokens.
3
5
  *
4
6
  * 1. Mark the old token's 'state' as deprecated
5
7
  * 2. Add a 'rename' attribute to the token with the value 'my.new.token'
6
8
  * 3. Create a new token matching the token above: 'my.new.token'
7
9
  * 4. Run 'yarn build tokens' to have you changes reflected in this map
8
- * 5. eslint and other tools will now use this to automate replacing tokens
10
+ * 5. ESLint and other tools will now use this to automate replacing tokens
11
+ *
12
+ * These changes will then be picked up by our tooling which will attempt to
13
+ * migrate as many of these renames as possible.
9
14
  *
10
- * These changes will then be picked up by our tooling, which will attempt to
11
- * migrate as many of these renames as possible
15
+ * @codegen <<SignedSource::dd934162c3393bce214d694d47bbcf2a>>
16
+ * @codegenCommand yarn build tokens
12
17
  */
13
18
  import tokens from './token-names';
14
19
  declare type Token = keyof typeof tokens | string;
@@ -1,5 +1,10 @@
1
1
  /**
2
- * A map of token names to their value in the default Atlassian theme ('light')
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Token names mapped to their value in the default Atlassian theme ('light')
5
+ *
6
+ * @codegen <<SignedSource::3dd78c77e87d6557a4bade2368be7eb8>>
7
+ * @codegenCommand yarn build tokens
3
8
  */
4
9
  declare const defaultTokenValues: {
5
10
  readonly 'color.text.accent.blue': "#0055CC";
@@ -235,8 +240,8 @@ declare const defaultTokenValues: {
235
240
  readonly 'color.background.transparentNeutral.hover': "#091E420F";
236
241
  readonly 'color.background.transparentNeutral.pressed': "#091E4224";
237
242
  readonly 'color.blanket': "#091E427A";
238
- readonly 'color.blanket.selected': "#388BFFCC";
239
- readonly 'color.blanket.danger': "#EF5C48CC";
243
+ readonly 'color.blanket.selected': "#388BFF14";
244
+ readonly 'color.blanket.danger': "#EF5C4814";
240
245
  readonly 'color.interaction.hovered': "#ffffff33";
241
246
  readonly 'color.interaction.pressed': "#ffffff5c";
242
247
  readonly 'color.interaction.inverse.hovered': "#00000029";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::1ab44c57c547c6cb7bb389b286bdd50f>>
4
+ * @codegenCommand yarn build tokens
5
+ */
1
6
  declare const tokens: {
2
7
  readonly 'color.text.accent.blue': "--ds-text-accent-blue";
3
8
  readonly 'color.text.accent.blue.bolder': "--ds-text-accent-blue-bolder";
@@ -1,9 +1,16 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::9d619d23cbcf93e5c937313843744a22>>
4
+ * @codegenCommand yarn build tokens
5
+ */
1
6
  declare const tokens: ({
2
7
  attributes: {
3
8
  group: string;
4
9
  state: string;
5
10
  introduced: string;
6
11
  description: string;
12
+ deprecated?: undefined;
13
+ deleted?: undefined;
7
14
  replacement?: undefined;
8
15
  };
9
16
  value: string;
@@ -15,6 +22,8 @@ declare const tokens: ({
15
22
  state: string;
16
23
  introduced: string;
17
24
  description: string;
25
+ deprecated?: undefined;
26
+ deleted?: undefined;
18
27
  replacement?: undefined;
19
28
  };
20
29
  value: string;
@@ -26,6 +35,8 @@ declare const tokens: ({
26
35
  group: string;
27
36
  state: string;
28
37
  introduced: string;
38
+ deprecated: string;
39
+ deleted: string;
29
40
  replacement: string;
30
41
  description: string;
31
42
  };
@@ -37,6 +48,8 @@ declare const tokens: ({
37
48
  group: string;
38
49
  state: string;
39
50
  introduced: string;
51
+ deprecated: string;
52
+ deleted: string;
40
53
  replacement: string;
41
54
  description: string;
42
55
  };
@@ -49,6 +62,35 @@ declare const tokens: ({
49
62
  group: string;
50
63
  state: string;
51
64
  introduced: string;
65
+ deprecated: string;
66
+ replacement: string;
67
+ description: string;
68
+ deleted?: undefined;
69
+ };
70
+ value: string;
71
+ filePath: string;
72
+ isSource: boolean;
73
+ original: {
74
+ attributes: {
75
+ group: string;
76
+ state: string;
77
+ introduced: string;
78
+ deprecated: string;
79
+ replacement: string;
80
+ description: string;
81
+ deleted?: undefined;
82
+ };
83
+ value: string;
84
+ };
85
+ name: string;
86
+ path: string[];
87
+ } | {
88
+ attributes: {
89
+ group: string;
90
+ state: string;
91
+ introduced: string;
92
+ deprecated: string;
93
+ deleted: string;
52
94
  replacement: string;
53
95
  description: string;
54
96
  };
@@ -80,6 +122,8 @@ declare const tokens: ({
80
122
  group: string;
81
123
  state: string;
82
124
  introduced: string;
125
+ deprecated: string;
126
+ deleted: string;
83
127
  replacement: string;
84
128
  description: string;
85
129
  };
@@ -113,6 +157,8 @@ declare const tokens: ({
113
157
  state: string;
114
158
  introduced: string;
115
159
  description: string;
160
+ deprecated?: undefined;
161
+ deleted?: undefined;
116
162
  replacement?: undefined;
117
163
  };
118
164
  value: ({
@@ -144,6 +190,8 @@ declare const tokens: ({
144
190
  state: string;
145
191
  introduced: string;
146
192
  description: string;
193
+ deprecated?: undefined;
194
+ deleted?: undefined;
147
195
  replacement?: undefined;
148
196
  };
149
197
  value: ({
@@ -1,9 +1,16 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::0e47f76666554d1a967ff51c4cae1c25>>
4
+ * @codegenCommand yarn build tokens
5
+ */
1
6
  declare const tokens: ({
2
7
  attributes: {
3
8
  group: string;
4
9
  state: string;
5
10
  introduced: string;
6
11
  description: string;
12
+ deprecated?: undefined;
13
+ deleted?: undefined;
7
14
  replacement?: undefined;
8
15
  };
9
16
  value: string;
@@ -15,6 +22,8 @@ declare const tokens: ({
15
22
  state: string;
16
23
  introduced: string;
17
24
  description: string;
25
+ deprecated?: undefined;
26
+ deleted?: undefined;
18
27
  replacement?: undefined;
19
28
  };
20
29
  value: string;
@@ -26,6 +35,8 @@ declare const tokens: ({
26
35
  group: string;
27
36
  state: string;
28
37
  introduced: string;
38
+ deprecated: string;
39
+ deleted: string;
29
40
  replacement: string;
30
41
  description: string;
31
42
  };
@@ -37,6 +48,8 @@ declare const tokens: ({
37
48
  group: string;
38
49
  state: string;
39
50
  introduced: string;
51
+ deprecated: string;
52
+ deleted: string;
40
53
  replacement: string;
41
54
  description: string;
42
55
  };
@@ -49,6 +62,35 @@ declare const tokens: ({
49
62
  group: string;
50
63
  state: string;
51
64
  introduced: string;
65
+ deprecated: string;
66
+ replacement: string;
67
+ description: string;
68
+ deleted?: undefined;
69
+ };
70
+ value: string;
71
+ filePath: string;
72
+ isSource: boolean;
73
+ original: {
74
+ attributes: {
75
+ group: string;
76
+ state: string;
77
+ introduced: string;
78
+ deprecated: string;
79
+ replacement: string;
80
+ description: string;
81
+ deleted?: undefined;
82
+ };
83
+ value: string;
84
+ };
85
+ name: string;
86
+ path: string[];
87
+ } | {
88
+ attributes: {
89
+ group: string;
90
+ state: string;
91
+ introduced: string;
92
+ deprecated: string;
93
+ deleted: string;
52
94
  replacement: string;
53
95
  description: string;
54
96
  };
@@ -68,6 +110,8 @@ declare const tokens: ({
68
110
  group: string;
69
111
  state: string;
70
112
  introduced: string;
113
+ deprecated: string;
114
+ deleted: string;
71
115
  replacement: string;
72
116
  description: string;
73
117
  };
@@ -89,6 +133,8 @@ declare const tokens: ({
89
133
  state: string;
90
134
  introduced: string;
91
135
  description: string;
136
+ deprecated?: undefined;
137
+ deleted?: undefined;
92
138
  replacement?: undefined;
93
139
  };
94
140
  value: {
@@ -108,6 +154,8 @@ declare const tokens: ({
108
154
  state: string;
109
155
  introduced: string;
110
156
  description: string;
157
+ deprecated?: undefined;
158
+ deleted?: undefined;
111
159
  replacement?: undefined;
112
160
  };
113
161
  value: {
@@ -1,4 +1,6 @@
1
1
  /**
2
- * Internally types used for handling token ids
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::b41790657bd6ccb424e840279549eee6>>
4
+ * @codegenCommand yarn build tokens
3
5
  */
4
6
  export declare type InternalTokenIds = 'color.text.accent.blue.[default]' | 'color.text.accent.blue.bolder' | 'color.text.accent.red.[default]' | 'color.text.accent.red.bolder' | 'color.text.accent.orange.[default]' | 'color.text.accent.orange.bolder' | 'color.text.accent.yellow.[default]' | 'color.text.accent.yellow.bolder' | 'color.text.accent.green.[default]' | 'color.text.accent.green.bolder' | 'color.text.accent.purple.[default]' | 'color.text.accent.purple.bolder' | 'color.text.accent.teal.[default]' | 'color.text.accent.teal.bolder' | 'color.text.accent.magenta.[default]' | 'color.text.accent.magenta.bolder' | 'color.text.[default]' | 'color.text.subtle' | 'color.text.subtlest' | 'color.text.disabled' | 'color.text.inverse' | 'color.text.brand' | 'color.text.selected' | 'color.text.danger' | 'color.text.warning.[default]' | 'color.text.warning.inverse' | 'color.text.success' | 'color.text.discovery' | 'color.text.information' | 'color.icon.accent.blue' | 'color.icon.accent.red' | 'color.icon.accent.orange' | 'color.icon.accent.yellow' | 'color.icon.accent.green' | 'color.icon.accent.purple' | 'color.icon.accent.teal' | 'color.icon.accent.magenta' | 'color.icon.[default]' | 'color.icon.subtle' | 'color.icon.inverse' | 'color.icon.disabled' | 'color.icon.brand' | 'color.icon.selected' | 'color.icon.danger' | 'color.icon.warning.[default]' | 'color.icon.warning.inverse' | 'color.icon.success' | 'color.icon.discovery' | 'color.icon.information' | 'color.border.accent.blue' | 'color.border.accent.red' | 'color.border.accent.orange' | 'color.border.accent.yellow' | 'color.border.accent.green' | 'color.border.accent.purple' | 'color.border.accent.teal' | 'color.border.accent.magenta' | 'color.border.[default]' | 'color.border.inverse' | 'color.border.focused' | 'color.border.input' | 'color.border.disabled' | 'color.border.brand' | 'color.border.selected' | 'color.border.danger' | 'color.border.warning' | 'color.border.success' | 'color.border.discovery' | 'color.border.information' | 'color.background.accent.blue.subtlest' | 'color.background.accent.blue.subtler' | 'color.background.accent.blue.subtle' | 'color.background.accent.blue.bolder' | 'color.background.accent.red.subtlest' | 'color.background.accent.red.subtler' | 'color.background.accent.red.subtle' | 'color.background.accent.red.bolder' | 'color.background.accent.orange.subtlest' | 'color.background.accent.orange.subtler' | 'color.background.accent.orange.subtle' | 'color.background.accent.orange.bolder' | 'color.background.accent.yellow.subtlest' | 'color.background.accent.yellow.subtler' | 'color.background.accent.yellow.subtle' | 'color.background.accent.yellow.bolder' | 'color.background.accent.green.subtlest' | 'color.background.accent.green.subtler' | 'color.background.accent.green.subtle' | 'color.background.accent.green.bolder' | 'color.background.accent.teal.subtlest' | 'color.background.accent.teal.subtler' | 'color.background.accent.teal.subtle' | 'color.background.accent.teal.bolder' | 'color.background.accent.purple.subtlest' | 'color.background.accent.purple.subtler' | 'color.background.accent.purple.subtle' | 'color.background.accent.purple.bolder' | 'color.background.accent.magenta.subtlest' | 'color.background.accent.magenta.subtler' | 'color.background.accent.magenta.subtle' | 'color.background.accent.magenta.bolder' | 'color.background.disabled' | 'color.background.inverse.subtle.[default]' | 'color.background.inverse.subtle.hovered' | 'color.background.inverse.subtle.pressed' | 'color.background.input.[default]' | 'color.background.input.hovered' | 'color.background.input.pressed' | 'color.background.neutral.[default].[default]' | 'color.background.neutral.[default].hovered' | 'color.background.neutral.[default].pressed' | 'color.background.neutral.subtle.[default]' | 'color.background.neutral.subtle.hovered' | 'color.background.neutral.subtle.pressed' | 'color.background.neutral.bold.[default]' | 'color.background.neutral.bold.hovered' | 'color.background.neutral.bold.pressed' | 'color.background.brand.bold.[default]' | 'color.background.brand.bold.hovered' | 'color.background.brand.bold.pressed' | 'color.background.selected.[default].[default]' | 'color.background.selected.[default].hovered' | 'color.background.selected.[default].pressed' | 'color.background.selected.bold.[default]' | 'color.background.selected.bold.hovered' | 'color.background.selected.bold.pressed' | 'color.background.danger.[default].[default]' | 'color.background.danger.[default].hovered' | 'color.background.danger.[default].pressed' | 'color.background.danger.bold.[default]' | 'color.background.danger.bold.hovered' | 'color.background.danger.bold.pressed' | 'color.background.warning.[default].[default]' | 'color.background.warning.[default].hovered' | 'color.background.warning.[default].pressed' | 'color.background.warning.bold.[default]' | 'color.background.warning.bold.hovered' | 'color.background.warning.bold.pressed' | 'color.background.success.[default].[default]' | 'color.background.success.[default].hovered' | 'color.background.success.[default].pressed' | 'color.background.success.bold.[default]' | 'color.background.success.bold.hovered' | 'color.background.success.bold.pressed' | 'color.background.discovery.[default].[default]' | 'color.background.discovery.[default].hovered' | 'color.background.discovery.[default].pressed' | 'color.background.discovery.bold.[default]' | 'color.background.discovery.bold.hovered' | 'color.background.discovery.bold.pressed' | 'color.background.information.[default].[default]' | 'color.background.information.[default].hovered' | 'color.background.information.[default].pressed' | 'color.background.information.bold.[default]' | 'color.background.information.bold.hovered' | 'color.background.information.bold.pressed' | 'color.blanket.[default]' | 'color.blanket.selected' | 'color.blanket.danger' | 'color.interaction.hovered' | 'color.interaction.pressed' | 'color.interaction.inverse.hovered' | 'color.interaction.inverse.pressed' | 'color.skeleton.[default]' | 'color.skeleton.subtle' | 'color.link.[default]' | 'color.link.pressed' | 'elevation.shadow.raised' | 'elevation.shadow.overflow' | 'elevation.shadow.overlay' | 'elevation.surface.[default]' | 'elevation.surface.sunken' | 'elevation.surface.raised' | 'elevation.surface.overlay' | 'utility.UNSAFE_util.transparent' | 'utility.UNSAFE_util.MISSING_TOKEN';
@@ -1,4 +1,6 @@
1
1
  /**
2
- * Type representing the currently active tokens
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::cbc11cad85705333139fd9d6eda82f31>>
4
+ * @codegenCommand yarn build tokens
3
5
  */
4
6
  export declare type ActiveTokens = 'color.text.accent.blue' | 'color.text.accent.blue.bolder' | 'color.text.accent.red' | 'color.text.accent.red.bolder' | 'color.text.accent.orange' | 'color.text.accent.orange.bolder' | 'color.text.accent.yellow' | 'color.text.accent.yellow.bolder' | 'color.text.accent.green' | 'color.text.accent.green.bolder' | 'color.text.accent.purple' | 'color.text.accent.purple.bolder' | 'color.text.accent.teal' | 'color.text.accent.teal.bolder' | 'color.text.accent.magenta' | 'color.text.accent.magenta.bolder' | 'color.text' | 'color.text.subtle' | 'color.text.subtlest' | 'color.text.disabled' | 'color.text.inverse' | 'color.text.brand' | 'color.text.selected' | 'color.text.danger' | 'color.text.warning' | 'color.text.warning.inverse' | 'color.text.success' | 'color.text.discovery' | 'color.text.information' | 'color.icon.accent.blue' | 'color.icon.accent.red' | 'color.icon.accent.orange' | 'color.icon.accent.yellow' | 'color.icon.accent.green' | 'color.icon.accent.purple' | 'color.icon.accent.teal' | 'color.icon.accent.magenta' | 'color.icon' | 'color.icon.subtle' | 'color.icon.inverse' | 'color.icon.disabled' | 'color.icon.brand' | 'color.icon.selected' | 'color.icon.danger' | 'color.icon.warning' | 'color.icon.warning.inverse' | 'color.icon.success' | 'color.icon.discovery' | 'color.icon.information' | 'color.border.accent.blue' | 'color.border.accent.red' | 'color.border.accent.orange' | 'color.border.accent.yellow' | 'color.border.accent.green' | 'color.border.accent.purple' | 'color.border.accent.teal' | 'color.border.accent.magenta' | 'color.border' | 'color.border.inverse' | 'color.border.focused' | 'color.border.input' | 'color.border.disabled' | 'color.border.brand' | 'color.border.selected' | 'color.border.danger' | 'color.border.warning' | 'color.border.success' | 'color.border.discovery' | 'color.border.information' | 'color.background.accent.blue.subtlest' | 'color.background.accent.blue.subtler' | 'color.background.accent.blue.subtle' | 'color.background.accent.blue.bolder' | 'color.background.accent.red.subtlest' | 'color.background.accent.red.subtler' | 'color.background.accent.red.subtle' | 'color.background.accent.red.bolder' | 'color.background.accent.orange.subtlest' | 'color.background.accent.orange.subtler' | 'color.background.accent.orange.subtle' | 'color.background.accent.orange.bolder' | 'color.background.accent.yellow.subtlest' | 'color.background.accent.yellow.subtler' | 'color.background.accent.yellow.subtle' | 'color.background.accent.yellow.bolder' | 'color.background.accent.green.subtlest' | 'color.background.accent.green.subtler' | 'color.background.accent.green.subtle' | 'color.background.accent.green.bolder' | 'color.background.accent.teal.subtlest' | 'color.background.accent.teal.subtler' | 'color.background.accent.teal.subtle' | 'color.background.accent.teal.bolder' | 'color.background.accent.purple.subtlest' | 'color.background.accent.purple.subtler' | 'color.background.accent.purple.subtle' | 'color.background.accent.purple.bolder' | 'color.background.accent.magenta.subtlest' | 'color.background.accent.magenta.subtler' | 'color.background.accent.magenta.subtle' | 'color.background.accent.magenta.bolder' | 'color.background.disabled' | 'color.background.inverse.subtle' | 'color.background.inverse.subtle.hovered' | 'color.background.inverse.subtle.pressed' | 'color.background.input' | 'color.background.input.hovered' | 'color.background.input.pressed' | 'color.background.neutral' | 'color.background.neutral.hovered' | 'color.background.neutral.pressed' | 'color.background.neutral.subtle' | 'color.background.neutral.subtle.hovered' | 'color.background.neutral.subtle.pressed' | 'color.background.neutral.bold' | 'color.background.neutral.bold.hovered' | 'color.background.neutral.bold.pressed' | 'color.background.brand.bold' | 'color.background.brand.bold.hovered' | 'color.background.brand.bold.pressed' | 'color.background.selected' | 'color.background.selected.hovered' | 'color.background.selected.pressed' | 'color.background.selected.bold' | 'color.background.selected.bold.hovered' | 'color.background.selected.bold.pressed' | 'color.background.danger' | 'color.background.danger.hovered' | 'color.background.danger.pressed' | 'color.background.danger.bold' | 'color.background.danger.bold.hovered' | 'color.background.danger.bold.pressed' | 'color.background.warning' | 'color.background.warning.hovered' | 'color.background.warning.pressed' | 'color.background.warning.bold' | 'color.background.warning.bold.hovered' | 'color.background.warning.bold.pressed' | 'color.background.success' | 'color.background.success.hovered' | 'color.background.success.pressed' | 'color.background.success.bold' | 'color.background.success.bold.hovered' | 'color.background.success.bold.pressed' | 'color.background.discovery' | 'color.background.discovery.hovered' | 'color.background.discovery.pressed' | 'color.background.discovery.bold' | 'color.background.discovery.bold.hovered' | 'color.background.discovery.bold.pressed' | 'color.background.information' | 'color.background.information.hovered' | 'color.background.information.pressed' | 'color.background.information.bold' | 'color.background.information.bold.hovered' | 'color.background.information.bold.pressed' | 'color.blanket' | 'color.blanket.selected' | 'color.blanket.danger' | 'color.interaction.hovered' | 'color.interaction.pressed' | 'color.interaction.inverse.hovered' | 'color.interaction.inverse.pressed' | 'color.skeleton' | 'color.skeleton.subtle' | 'color.link' | 'color.link.pressed' | 'elevation.shadow.raised' | 'elevation.shadow.overflow' | 'elevation.shadow.overlay' | 'elevation.surface' | 'elevation.surface.sunken' | 'elevation.surface.raised' | 'elevation.surface.overlay' | 'utility.UNSAFE_util.transparent' | 'utility.UNSAFE_util.MISSING_TOKEN';
@@ -0,0 +1 @@
1
+ export { default } from '../artifacts/palettes-raw';
@@ -1 +1 @@
1
- export { getCSSCustomProperty, getTokenId, getFullyQualifiedTokenId, } from '../token-ids';
1
+ export { getCSSCustomProperty, getTokenId, getFullyQualifiedTokenId, } from '../utils/token-ids';
@@ -1,9 +1,11 @@
1
1
  import { InternalTokenIds } from './artifacts/types-internal';
2
2
  export declare type Groups = 'raw' | 'paint' | 'shadow' | 'palette';
3
- export declare type ActiveTokenStates = 'active';
4
- export declare type ReplacedTokenStates = 'deprecated' | 'deleted';
5
- export declare type TokenState = ActiveTokenStates | ReplacedTokenStates;
3
+ export declare type ActiveTokenState = 'active';
4
+ export declare type DeprecatedTokenState = 'deprecated';
5
+ export declare type DeletedTokenState = 'deleted';
6
+ export declare type TokenState = ActiveTokenState | DeprecatedTokenState | DeletedTokenState;
6
7
  export declare type Replacement = InternalTokenIds | InternalTokenIds[];
8
+ export declare type PaletteCategory = 'blue' | 'purple' | 'red' | 'magenta' | 'orange' | 'yellow' | 'green' | 'teal' | 'light neutral' | 'dark neutral';
7
9
  export interface Token<TValue, Group extends Groups> {
8
10
  value: TValue;
9
11
  attributes: {
@@ -28,16 +30,24 @@ export interface BaseToken<TValue, Group extends Groups> extends Token<TValue, G
28
30
  */
29
31
  export interface DesignToken<TValue, Group extends Groups> extends Token<TValue, Group> {
30
32
  attributes: {
33
+ state: ActiveTokenState;
31
34
  group: Group;
32
35
  description: string;
33
- state: ActiveTokenStates;
34
36
  introduced: string;
35
- replacement?: undefined;
36
37
  } | {
38
+ state: DeprecatedTokenState;
37
39
  group: Group;
38
40
  description: string;
39
- state: ReplacedTokenStates;
40
41
  introduced: string;
42
+ deprecated: string;
43
+ replacement?: Replacement;
44
+ } | {
45
+ state: DeletedTokenState;
46
+ group: Group;
47
+ description: string;
48
+ introduced: string;
49
+ deprecated: string;
50
+ deleted: string;
41
51
  replacement?: Replacement;
42
52
  };
43
53
  }
@@ -50,7 +60,12 @@ declare type DeepOmit<T extends any, K extends PropertyKey> = Omit<{
50
60
  }, K>;
51
61
  export declare type ValueSchema<Schema extends object> = DeepOmit<Schema, 'attributes'>;
52
62
  export declare type AttributeSchema<Schema extends object> = DeepOmit<Schema, 'value'>;
53
- export declare type PaletteToken = BaseToken<string, 'palette'>;
63
+ export interface PaletteToken extends BaseToken<string, 'palette'> {
64
+ attributes: {
65
+ group: 'palette';
66
+ category: PaletteCategory;
67
+ };
68
+ }
54
69
  export declare type ColorPalette = keyof PaletteColorTokenSchema['color']['palette'];
55
70
  export declare type PaintToken<Value extends string = ColorPalette> = DesignToken<Value, 'paint'>;
56
71
  export declare type ShadowToken<Value extends string = ColorPalette> = DesignToken<Array<{
@@ -0,0 +1,38 @@
1
+ import { ShadowToken } from '../types';
2
+ export declare const hexToRGBAValues: (hex: string) => {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ a: number;
7
+ };
8
+ export declare const hexToRGBA: (hex: string) => string;
9
+ export declare const getLuminance: ({ r, g, b, }: {
10
+ r: number;
11
+ b: number;
12
+ g: number;
13
+ }) => number;
14
+ /**
15
+ * Returns an accessible hard-coded text color based on the color contrast with
16
+ * the background.
17
+ *
18
+ * @param hex - The Hex color code of the background
19
+ * @param [opts.hardcodedSurface] - If set, a design token will be returned instead
20
+ * of a hard-coded color. This is to support more transparent backgrounds
21
+ * to allow the text to invert colors depending on the current theme's surface color.
22
+ */
23
+ export declare const getTextColorForBackground: (hex: string, opts?: {
24
+ hardcodedSurface?: "light" | "dark" | undefined;
25
+ } | undefined) => string;
26
+ /**
27
+ * Returns a border if determined to be required based on the color contrast with
28
+ * the background.
29
+ *
30
+ * @param hex - The Hex color code of the background
31
+ */
32
+ export declare const getBorderForBackground: (hex: string) => string | undefined;
33
+ /**
34
+ * Returns a box shadow formatted for CSS from a ShadowToken raw value.
35
+ *
36
+ * @param rawShadow - ShadowToken raw value
37
+ */
38
+ export declare const getBoxShadow: (rawShadow: ShadowToken['value']) => string;
package/package.json CHANGED
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "0.9.1",
3
+ "version": "0.9.4",
4
4
  "author": "Atlassian Pty Ltd",
5
- "description": "Tokens are a single source of truth to name and store Atlassian design decisions.",
5
+ "description": "Design tokens are the single source of truth to name and store design decisions.",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Design System Team",
12
- "releaseModel": "scheduled"
12
+ "releaseModel": "scheduled",
13
+ "website": {
14
+ "name": "Design tokens",
15
+ "category": "Libraries",
16
+ "draft": true
17
+ }
13
18
  },
14
19
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
15
20
  "main": "dist/cjs/index.js",
@@ -22,6 +27,7 @@
22
27
  "atlaskit:src": "src/index.tsx",
23
28
  "af:exports": {
24
29
  ".": "./src/index.tsx",
30
+ "./palettes-raw": "./src/entry-points/palettes-raw.tsx",
25
31
  "./token-ids": "./src/entry-points/token-ids.tsx",
26
32
  "./token-names": "./src/entry-points/token-names.tsx",
27
33
  "./rename-mapping": "./src/entry-points/rename-mapping.tsx",
@@ -29,8 +35,8 @@
29
35
  "./css": "./css"
30
36
  },
31
37
  "scripts": {
32
- "ak-postbuild": "yarn codegen-tokens && yarn check-clean-git && yarn build-chrome-extension",
33
- "check-clean-git": "git diff --exit-code -- packages/design-system/tokens/ || (echo 'tokens are is out of date, run yarn build tokens' && false)",
38
+ "ak-postbuild": "cd ../../../ && yarn build @af/codegen && cd packages/design-system/tokens && yarn codegen-tokens && yarn check-clean-git",
39
+ "check-clean-git": "git diff --exit-code -- packages/design-system/tokens/ || (echo 'tokens are out of date, run yarn build tokens' && false)",
34
40
  "codegen-tokens": "ts-node --project ../../../tsconfig.node.json ./scripts/style-dictionary/build",
35
41
  "build-chrome-extension": "yarn --cwd tokens-browser-extension build-chrome-extension"
36
42
  },
@@ -41,8 +47,13 @@
41
47
  "@babel/types": "^7.15.0"
42
48
  },
43
49
  "devDependencies": {
50
+ "@af/codegen": "*",
51
+ "@atlaskit/badge": "^15.0.11",
44
52
  "@atlaskit/button": "^16.3.0",
45
53
  "@atlaskit/code": "^14.3.0",
54
+ "@atlaskit/docs": "^9.0.10",
55
+ "@atlaskit/dropdown-menu": "^11.1.3",
56
+ "@atlaskit/empty-state": "^7.3.9",
46
57
  "@atlaskit/focus-ring": "^1.0.0",
47
58
  "@atlaskit/heading": "^0.1.8",
48
59
  "@atlaskit/icon": "^21.10.2",
@@ -53,6 +64,7 @@
53
64
  "@atlaskit/textfield": "^5.1.5",
54
65
  "@atlaskit/theme": "^12.1.2",
55
66
  "@atlaskit/toggle": "^12.4.2",
67
+ "@atlaskit/tooltip": "^17.5.7",
56
68
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
57
69
  "@babel/core": "^7.12.3",
58
70
  "@emotion/core": "^10.0.9",
@@ -77,5 +89,6 @@
77
89
  "styling": "emotion"
78
90
  }
79
91
  },
92
+ "homepage": "https://atlassian.design/components/tokens",
80
93
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
81
94
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/tokens/palettes-raw",
3
+ "main": "../dist/cjs/entry-points/palettes-raw.js",
4
+ "module": "../dist/esm/entry-points/palettes-raw.js",
5
+ "module:es2019": "../dist/es2019/entry-points/palettes-raw.js",
6
+ "sideEffects": [
7
+ "**/*.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/palettes-raw.d.ts"
10
+ }
@@ -3,5 +3,8 @@
3
3
  "main": "../dist/cjs/entry-points/rename-mapping.js",
4
4
  "module": "../dist/esm/entry-points/rename-mapping.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/rename-mapping.js",
6
+ "sideEffects": [
7
+ "**/*.css"
8
+ ],
6
9
  "types": "../dist/types/entry-points/rename-mapping.d.ts"
7
10
  }