@atlaskit/tokens 1.25.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/artifacts/theme-import-map.js +13 -1
  3. package/dist/cjs/artifacts/themes/atlassian-dark-increased-contrast.js +12 -0
  4. package/dist/cjs/artifacts/themes/atlassian-light-increased-contrast.js +12 -0
  5. package/dist/cjs/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +8687 -0
  6. package/dist/cjs/artifacts/tokens-raw/atlassian-light-increased-contrast.js +8653 -0
  7. package/dist/cjs/constants.js +2 -1
  8. package/dist/cjs/enable-global-theme.js +3 -0
  9. package/dist/cjs/get-ssr-auto-script.js +8 -2
  10. package/dist/cjs/get-theme-html-attrs.js +9 -0
  11. package/dist/cjs/get-theme-styles.js +9 -0
  12. package/dist/cjs/get-token-value.js +1 -1
  13. package/dist/cjs/get-token.js +1 -1
  14. package/dist/cjs/set-global-theme.js +35 -20
  15. package/dist/cjs/theme-config.js +29 -2
  16. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/accent.js +271 -0
  17. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/background.js +104 -0
  18. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/border.js +46 -0
  19. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/chart.js +309 -0
  20. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/icon.js +45 -0
  21. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/interaction.js +22 -0
  22. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/skeleton.js +21 -0
  23. package/dist/cjs/tokens/atlassian-dark-increased-contrast/color/text.js +56 -0
  24. package/dist/cjs/tokens/atlassian-dark-increased-contrast/elevation/shadow.js +66 -0
  25. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/accent.js +423 -0
  26. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/background.js +145 -0
  27. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/border.js +50 -0
  28. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/chart.js +418 -0
  29. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/icon.js +49 -0
  30. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/interaction.js +22 -0
  31. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/skeleton.js +21 -0
  32. package/dist/cjs/tokens/atlassian-light-increased-contrast/color/text.js +56 -0
  33. package/dist/cjs/tokens/atlassian-light-increased-contrast/elevation/shadow.js +62 -0
  34. package/dist/cjs/tokens/atlassian-light-increased-contrast/elevation/surface.js +18 -0
  35. package/dist/cjs/utils/configure-page.js +16 -1
  36. package/dist/cjs/utils/contrast-mode-listeners.js +65 -0
  37. package/dist/cjs/utils/get-increased-contrast-theme.js +20 -0
  38. package/dist/cjs/utils/get-theme-preferences.js +23 -1
  39. package/dist/cjs/utils/theme-loading.js +3 -2
  40. package/dist/es2019/artifacts/theme-import-map.js +5 -1
  41. package/dist/es2019/artifacts/themes/atlassian-dark-increased-contrast.js +401 -0
  42. package/dist/es2019/artifacts/themes/atlassian-light-increased-contrast.js +401 -0
  43. package/dist/es2019/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +8681 -0
  44. package/dist/es2019/artifacts/tokens-raw/atlassian-light-increased-contrast.js +8647 -0
  45. package/dist/es2019/constants.js +1 -0
  46. package/dist/es2019/enable-global-theme.js +2 -0
  47. package/dist/es2019/get-ssr-auto-script.js +17 -11
  48. package/dist/es2019/get-theme-html-attrs.js +12 -2
  49. package/dist/es2019/get-theme-styles.js +7 -0
  50. package/dist/es2019/get-token-value.js +1 -1
  51. package/dist/es2019/get-token.js +1 -1
  52. package/dist/es2019/set-global-theme.js +14 -0
  53. package/dist/es2019/theme-config.js +28 -1
  54. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/accent.js +265 -0
  55. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/background.js +98 -0
  56. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/border.js +40 -0
  57. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/chart.js +303 -0
  58. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/icon.js +39 -0
  59. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/interaction.js +16 -0
  60. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/skeleton.js +15 -0
  61. package/dist/es2019/tokens/atlassian-dark-increased-contrast/color/text.js +50 -0
  62. package/dist/es2019/tokens/atlassian-dark-increased-contrast/elevation/shadow.js +60 -0
  63. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/accent.js +417 -0
  64. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/background.js +139 -0
  65. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/border.js +44 -0
  66. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/chart.js +412 -0
  67. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/icon.js +43 -0
  68. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/interaction.js +16 -0
  69. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/skeleton.js +15 -0
  70. package/dist/es2019/tokens/atlassian-light-increased-contrast/color/text.js +50 -0
  71. package/dist/es2019/tokens/atlassian-light-increased-contrast/elevation/shadow.js +56 -0
  72. package/dist/es2019/tokens/atlassian-light-increased-contrast/elevation/surface.js +12 -0
  73. package/dist/es2019/utils/configure-page.js +18 -1
  74. package/dist/es2019/utils/contrast-mode-listeners.js +48 -0
  75. package/dist/es2019/utils/get-increased-contrast-theme.js +13 -0
  76. package/dist/es2019/utils/get-theme-preferences.js +23 -1
  77. package/dist/es2019/utils/theme-loading.js +2 -1
  78. package/dist/esm/artifacts/theme-import-map.js +9 -1
  79. package/dist/esm/artifacts/themes/atlassian-dark-increased-contrast.js +6 -0
  80. package/dist/esm/artifacts/themes/atlassian-light-increased-contrast.js +6 -0
  81. package/dist/esm/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +8681 -0
  82. package/dist/esm/artifacts/tokens-raw/atlassian-light-increased-contrast.js +8647 -0
  83. package/dist/esm/constants.js +1 -0
  84. package/dist/esm/enable-global-theme.js +3 -0
  85. package/dist/esm/get-ssr-auto-script.js +10 -4
  86. package/dist/esm/get-theme-html-attrs.js +10 -1
  87. package/dist/esm/get-theme-styles.js +9 -0
  88. package/dist/esm/get-token-value.js +1 -1
  89. package/dist/esm/get-token.js +1 -1
  90. package/dist/esm/set-global-theme.js +35 -20
  91. package/dist/esm/theme-config.js +28 -1
  92. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/accent.js +265 -0
  93. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/background.js +98 -0
  94. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/border.js +40 -0
  95. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/chart.js +303 -0
  96. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/icon.js +39 -0
  97. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/interaction.js +16 -0
  98. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/skeleton.js +15 -0
  99. package/dist/esm/tokens/atlassian-dark-increased-contrast/color/text.js +50 -0
  100. package/dist/esm/tokens/atlassian-dark-increased-contrast/elevation/shadow.js +60 -0
  101. package/dist/esm/tokens/atlassian-light-increased-contrast/color/accent.js +417 -0
  102. package/dist/esm/tokens/atlassian-light-increased-contrast/color/background.js +139 -0
  103. package/dist/esm/tokens/atlassian-light-increased-contrast/color/border.js +44 -0
  104. package/dist/esm/tokens/atlassian-light-increased-contrast/color/chart.js +412 -0
  105. package/dist/esm/tokens/atlassian-light-increased-contrast/color/icon.js +43 -0
  106. package/dist/esm/tokens/atlassian-light-increased-contrast/color/interaction.js +16 -0
  107. package/dist/esm/tokens/atlassian-light-increased-contrast/color/skeleton.js +15 -0
  108. package/dist/esm/tokens/atlassian-light-increased-contrast/color/text.js +50 -0
  109. package/dist/esm/tokens/atlassian-light-increased-contrast/elevation/shadow.js +56 -0
  110. package/dist/esm/tokens/atlassian-light-increased-contrast/elevation/surface.js +12 -0
  111. package/dist/esm/utils/configure-page.js +16 -1
  112. package/dist/esm/utils/contrast-mode-listeners.js +58 -0
  113. package/dist/esm/utils/get-increased-contrast-theme.js +14 -0
  114. package/dist/esm/utils/get-theme-preferences.js +23 -1
  115. package/dist/esm/utils/theme-loading.js +2 -1
  116. package/dist/types/artifacts/theme-import-map.d.ts +1 -1
  117. package/dist/types/artifacts/themes/atlassian-dark-increased-contrast.d.ts +7 -0
  118. package/dist/types/artifacts/themes/atlassian-light-increased-contrast.d.ts +7 -0
  119. package/dist/types/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +133 -0
  120. package/dist/types/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +113 -0
  121. package/dist/types/constants.d.ts +1 -0
  122. package/dist/types/enable-global-theme.d.ts +1 -1
  123. package/dist/types/get-ssr-auto-script.d.ts +1 -1
  124. package/dist/types/get-theme-html-attrs.d.ts +1 -1
  125. package/dist/types/set-global-theme.d.ts +2 -1
  126. package/dist/types/theme-config.d.ts +29 -6
  127. package/dist/types/tokens/atlassian-dark-increased-contrast/color/accent.d.ts +4 -0
  128. package/dist/types/tokens/atlassian-dark-increased-contrast/color/background.d.ts +4 -0
  129. package/dist/types/tokens/atlassian-dark-increased-contrast/color/border.d.ts +4 -0
  130. package/dist/types/tokens/atlassian-dark-increased-contrast/color/chart.d.ts +4 -0
  131. package/dist/types/tokens/atlassian-dark-increased-contrast/color/icon.d.ts +4 -0
  132. package/dist/types/tokens/atlassian-dark-increased-contrast/color/interaction.d.ts +4 -0
  133. package/dist/types/tokens/atlassian-dark-increased-contrast/color/skeleton.d.ts +4 -0
  134. package/dist/types/tokens/atlassian-dark-increased-contrast/color/text.d.ts +4 -0
  135. package/dist/types/tokens/atlassian-dark-increased-contrast/elevation/shadow.d.ts +4 -0
  136. package/dist/types/tokens/atlassian-light-increased-contrast/color/accent.d.ts +4 -0
  137. package/dist/types/tokens/atlassian-light-increased-contrast/color/background.d.ts +4 -0
  138. package/dist/types/tokens/atlassian-light-increased-contrast/color/border.d.ts +4 -0
  139. package/dist/types/tokens/atlassian-light-increased-contrast/color/chart.d.ts +4 -0
  140. package/dist/types/tokens/atlassian-light-increased-contrast/color/icon.d.ts +4 -0
  141. package/dist/types/tokens/atlassian-light-increased-contrast/color/interaction.d.ts +4 -0
  142. package/dist/types/tokens/atlassian-light-increased-contrast/color/skeleton.d.ts +4 -0
  143. package/dist/types/tokens/atlassian-light-increased-contrast/color/text.d.ts +4 -0
  144. package/dist/types/tokens/atlassian-light-increased-contrast/elevation/shadow.d.ts +4 -0
  145. package/dist/types/tokens/atlassian-light-increased-contrast/elevation/surface.d.ts +4 -0
  146. package/dist/types/utils/configure-page.d.ts +1 -1
  147. package/dist/types/utils/contrast-mode-listeners.d.ts +13 -0
  148. package/dist/types/utils/get-increased-contrast-theme.d.ts +5 -0
  149. package/dist/types/utils/theme-loading.d.ts +1 -0
  150. package/dist/types-ts4.5/artifacts/theme-import-map.d.ts +1 -1
  151. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-increased-contrast.d.ts +7 -0
  152. package/dist/types-ts4.5/artifacts/themes/atlassian-light-increased-contrast.d.ts +7 -0
  153. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +133 -0
  154. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +113 -0
  155. package/dist/types-ts4.5/constants.d.ts +1 -0
  156. package/dist/types-ts4.5/enable-global-theme.d.ts +1 -1
  157. package/dist/types-ts4.5/get-ssr-auto-script.d.ts +1 -1
  158. package/dist/types-ts4.5/get-theme-html-attrs.d.ts +1 -1
  159. package/dist/types-ts4.5/set-global-theme.d.ts +2 -1
  160. package/dist/types-ts4.5/theme-config.d.ts +35 -4
  161. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/accent.d.ts +4 -0
  162. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/background.d.ts +4 -0
  163. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/border.d.ts +4 -0
  164. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/chart.d.ts +4 -0
  165. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/icon.d.ts +4 -0
  166. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/interaction.d.ts +4 -0
  167. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/skeleton.d.ts +4 -0
  168. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/color/text.d.ts +4 -0
  169. package/dist/types-ts4.5/tokens/atlassian-dark-increased-contrast/elevation/shadow.d.ts +4 -0
  170. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/accent.d.ts +4 -0
  171. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/background.d.ts +4 -0
  172. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/border.d.ts +4 -0
  173. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/chart.d.ts +4 -0
  174. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/icon.d.ts +4 -0
  175. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/interaction.d.ts +4 -0
  176. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/skeleton.d.ts +4 -0
  177. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/color/text.d.ts +4 -0
  178. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/elevation/shadow.d.ts +4 -0
  179. package/dist/types-ts4.5/tokens/atlassian-light-increased-contrast/elevation/surface.d.ts +4 -0
  180. package/dist/types-ts4.5/utils/configure-page.d.ts +1 -1
  181. package/dist/types-ts4.5/utils/contrast-mode-listeners.d.ts +13 -0
  182. package/dist/types-ts4.5/utils/get-increased-contrast-theme.d.ts +5 -0
  183. package/dist/types-ts4.5/utils/theme-loading.d.ts +1 -0
  184. package/figma/atlassian-dark-increased-contrast.json +3542 -0
  185. package/figma/atlassian-light-increased-contrast.json +3523 -0
  186. package/package.json +4 -2
  187. package/report.api.md +38 -6
  188. package/tmp/api-report-tmp.d.ts +19 -12
@@ -1,5 +1,6 @@
1
1
  export const THEME_DATA_ATTRIBUTE = 'data-theme';
2
2
  export const COLOR_MODE_ATTRIBUTE = 'data-color-mode';
3
+ export const CONTRAST_MODE_ATTRIBUTE = 'data-contrast-mode';
3
4
  export const CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
4
5
  export const DEFAULT_THEME = 'light';
5
6
  export const CSS_PREFIX = 'ds';
@@ -25,6 +25,7 @@ import { getThemePreferences } from './utils/get-theme-preferences';
25
25
  */
26
26
  const enableGlobalTheme = ({
27
27
  colorMode = themeStateDefaults['colorMode'],
28
+ contrastMode = themeStateDefaults['contrastMode'],
28
29
  dark = themeStateDefaults['dark'],
29
30
  light = themeStateDefaults['light'],
30
31
  shape = themeStateDefaults['shape'],
@@ -34,6 +35,7 @@ const enableGlobalTheme = ({
34
35
  } = {}, themeLoader) => {
35
36
  const themeState = {
36
37
  colorMode,
38
+ contrastMode,
37
39
  dark,
38
40
  light,
39
41
  shape,
@@ -1,5 +1,6 @@
1
- import { COLOR_MODE_ATTRIBUTE } from './constants';
2
- import { darkModeMediaQuery } from './utils/theme-loading';
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
+ import { COLOR_MODE_ATTRIBUTE, CONTRAST_MODE_ATTRIBUTE } from './constants';
3
+ import { darkModeMediaQuery, moreContrastMediaQuery } from './utils/theme-loading';
3
4
 
4
5
  /**
5
6
  * Provides a script that, when executed before paint, sets the `data-color-mode` attribute based on the current system theme,
@@ -9,15 +10,20 @@ import { darkModeMediaQuery } from './utils/theme-loading';
9
10
  *
10
11
  * @returns {string} A string to be added to the innerHTML of a script tag in the document head
11
12
  */
12
- const getSSRAutoScript = colorMode => {
13
- return colorMode === 'auto' ? `(
14
- () => {
15
- try {
16
- const mql = window.matchMedia('${darkModeMediaQuery}');
17
- const colorMode = mql.matches ? 'dark' : 'light';
18
- document.documentElement.setAttribute('${COLOR_MODE_ATTRIBUTE}', colorMode);
19
- } catch (e) {}
13
+ const getSSRAutoScript = (colorMode, contrastMode) => {
14
+ if (colorMode !== 'auto' && contrastMode !== 'auto') {
15
+ return undefined;
20
16
  }
21
- )()` : undefined;
17
+ const setColorMode = colorMode === 'auto' ? `\n try {
18
+ const darkModeMql = window.matchMedia('${darkModeMediaQuery}');
19
+ const colorMode = darkModeMql.matches ? 'dark' : 'light';
20
+ document.documentElement.setAttribute('${COLOR_MODE_ATTRIBUTE}', colorMode);
21
+ } catch (e) {}` : '';
22
+ const setContrastMode = getBooleanFF('platform.design-system-team.increased-contrast-themes') && contrastMode === 'auto' ? `\n try {
23
+ const contrastModeMql = window.matchMedia('${moreContrastMediaQuery}');
24
+ const contrastMode = contrastModeMql.matches ? 'more' : 'no-preference';
25
+ document.documentElement.setAttribute('${CONTRAST_MODE_ATTRIBUTE}', contrastMode);
26
+ } catch (e) {}` : '';
27
+ return `(() => {${setColorMode}${setContrastMode}})()`;
22
28
  };
23
29
  export default getSSRAutoScript;
@@ -1,9 +1,11 @@
1
- import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
+ import { COLOR_MODE_ATTRIBUTE, CONTRAST_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
2
3
  import { themeStateDefaults } from './theme-config';
3
4
  import { themeObjectToString } from './theme-state-transformer';
4
5
  import { isValidBrandHex } from './utils/color-utils';
5
6
  import { hash } from './utils/hash';
6
7
  const defaultColorMode = 'light';
8
+ const defaultContrastMode = 'no-preference';
7
9
 
8
10
  /**
9
11
  * Server-side rendering utility. Generates the valid HTML attributes for a given theme.
@@ -23,6 +25,7 @@ const getThemeHtmlAttrs = ({
23
25
  colorMode = themeStateDefaults['colorMode'],
24
26
  dark = themeStateDefaults['dark'],
25
27
  light = themeStateDefaults['light'],
28
+ contrastMode = themeStateDefaults['contrastMode'],
26
29
  shape = themeStateDefaults['shape'],
27
30
  spacing = themeStateDefaults['spacing'],
28
31
  typography = themeStateDefaults['typography'],
@@ -35,10 +38,17 @@ const getThemeHtmlAttrs = ({
35
38
  spacing,
36
39
  typography
37
40
  });
38
- const result = {
41
+ let result = {
39
42
  [THEME_DATA_ATTRIBUTE]: themeAttribute,
40
43
  [COLOR_MODE_ATTRIBUTE]: colorMode === 'auto' ? defaultColorMode : colorMode
41
44
  };
45
+ if (getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
46
+ result = {
47
+ ...result,
48
+ // CLEANUP: Move this to the initial `result` assignment above
49
+ [CONTRAST_MODE_ATTRIBUTE]: contrastMode === 'auto' ? defaultContrastMode : contrastMode
50
+ };
51
+ }
42
52
  if (UNSAFE_themeOptions && isValidBrandHex(UNSAFE_themeOptions.brandColor)) {
43
53
  const optionString = JSON.stringify(UNSAFE_themeOptions);
44
54
  const uniqueId = hash(optionString);
@@ -1,3 +1,4 @@
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
2
  import { themeIdsWithOverrides, themeStateDefaults } from './theme-config';
2
3
  import { isValidBrandHex } from './utils/color-utils';
3
4
  import { getThemeOverridePreferences, getThemePreferences } from './utils/get-theme-preferences';
@@ -23,9 +24,15 @@ const getThemeStyles = async preferences => {
23
24
  let themeOverridePreferences = [];
24
25
  if (preferences === 'all') {
25
26
  themePreferences = themeIdsWithOverrides;
27
+
28
+ // CLEANUP: Remove
29
+ if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
30
+ themePreferences = themePreferences.filter(n => n !== 'light-increased-contrast' && n !== 'dark-increased-contrast');
31
+ }
26
32
  } else {
27
33
  const themeState = {
28
34
  colorMode: (preferences === null || preferences === void 0 ? void 0 : preferences.colorMode) || themeStateDefaults['colorMode'],
35
+ contrastMode: (preferences === null || preferences === void 0 ? void 0 : preferences.contrastMode) || themeStateDefaults['contrastMode'],
29
36
  dark: (preferences === null || preferences === void 0 ? void 0 : preferences.dark) || themeStateDefaults['dark'],
30
37
  light: (preferences === null || preferences === void 0 ? void 0 : preferences.light) || themeStateDefaults['light'],
31
38
  shape: (preferences === null || preferences === void 0 ? void 0 : preferences.shape) || themeStateDefaults['shape'],
@@ -1,7 +1,7 @@
1
1
  import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  const name = "@atlaskit/tokens";
4
- const version = "1.25.1";
4
+ const version = "0.0.0-development";
5
5
  /**
6
6
  * Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
7
7
  * resulting CSS Custom Property.
@@ -2,7 +2,7 @@ import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
4
4
  const name = "@atlaskit/tokens";
5
- const version = "1.25.1";
5
+ const version = "0.0.0-development";
6
6
  /**
7
7
  * Takes a dot-separated token name and an optional fallback, and returns the CSS custom property for the corresponding token.
8
8
  * This should be used to implement design decisions throughout your application.
@@ -1,3 +1,4 @@
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
2
  import { themeStateDefaults } from './theme-config';
2
3
  import { isValidBrandHex } from './utils/color-utils';
3
4
  import configurePage from './utils/configure-page';
@@ -10,6 +11,7 @@ import { loadAndAppendThemeCss } from './utils/theme-loading';
10
11
  *
11
12
  * @param {Object<string, string>} themeState The themes and color mode that should be applied.
12
13
  * @param {string} themeState.colorMode Determines which color theme is applied. If set to `auto`, the theme applied will be determined by the OS setting.
14
+ * @param {string} themeState.contrastMode The contrast mode theme to be applied. If set to `auto`, the theme applied will be determined by the OS setting.set to `auto`, the theme applied will be determined by the OS setting.
13
15
  * @param {string} themeState.dark The color theme to be applied when the color mode resolves to 'dark'.
14
16
  * @param {string} themeState.light The color theme to be applied when the color mode resolves to 'light'.
15
17
  * @param {string} themeState.shape The shape theme to be applied.
@@ -27,6 +29,7 @@ import { loadAndAppendThemeCss } from './utils/theme-loading';
27
29
  */
28
30
  const setGlobalTheme = async ({
29
31
  colorMode = themeStateDefaults['colorMode'],
32
+ contrastMode = themeStateDefaults['contrastMode'],
30
33
  dark = themeStateDefaults['dark'],
31
34
  light = themeStateDefaults['light'],
32
35
  shape = themeStateDefaults['shape'],
@@ -34,8 +37,19 @@ const setGlobalTheme = async ({
34
37
  typography = themeStateDefaults['typography'],
35
38
  UNSAFE_themeOptions = themeStateDefaults['UNSAFE_themeOptions']
36
39
  } = {}, themeLoader) => {
40
+ // CLEANUP: Remove. This blocks application of increased contrast themes
41
+ // without the feature flag enabled.
42
+ if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
43
+ if (light === 'light-increased-contrast') {
44
+ light = 'light';
45
+ }
46
+ if (dark === 'dark-increased-contrast') {
47
+ dark = 'dark';
48
+ }
49
+ }
37
50
  const themeState = {
38
51
  colorMode,
52
+ contrastMode,
39
53
  dark,
40
54
  light,
41
55
  shape,
@@ -28,13 +28,17 @@
28
28
  * The idea is there may exist many color themes, but every theme must either fit into light or dark.
29
29
  */
30
30
  export const themeColorModes = ['light', 'dark', 'auto'];
31
+ /**
32
+ * Contrast preferences: The system contrast preference
33
+ */
34
+ export const themeContrastModes = ['more', 'no-preference', 'auto'];
31
35
  /**
32
36
  * Theme ids: The value that will be mounted to the DOM as a data attr
33
37
  * For example: `data-theme="light:light dark:dark spacing:spacing"
34
38
  *
35
39
  * These ids must be kebab case
36
40
  */
37
- export const themeIds = ['light', 'dark', 'legacy-light', 'legacy-dark', 'spacing', 'typography', 'shape', 'typography-adg3', 'typography-minor3'];
41
+ export const themeIds = ['light-increased-contrast', 'light', 'dark', 'dark-increased-contrast', 'legacy-light', 'legacy-dark', 'spacing', 'typography', 'shape', 'typography-adg3', 'typography-minor3'];
38
42
  /**
39
43
  * Theme override ids: the equivalent of themeIds for theme overrides.
40
44
  * Theme overrides are temporary and there may not be any defined at times.
@@ -69,6 +73,17 @@ const themeConfig = {
69
73
  mode: 'light'
70
74
  }
71
75
  },
76
+ 'atlassian-light-increased-contrast': {
77
+ id: 'light-increased-contrast',
78
+ displayName: 'Light Theme (increased contrast)',
79
+ palette: 'defaultPalette',
80
+ attributes: {
81
+ type: 'color',
82
+ mode: 'light'
83
+ },
84
+ extends: 'light',
85
+ increasesContrastFor: 'light'
86
+ },
72
87
  'atlassian-dark': {
73
88
  id: 'dark',
74
89
  displayName: 'Dark Theme',
@@ -78,6 +93,17 @@ const themeConfig = {
78
93
  mode: 'dark'
79
94
  }
80
95
  },
96
+ 'atlassian-dark-increased-contrast': {
97
+ id: 'dark-increased-contrast',
98
+ displayName: 'Dark Theme (increased contrast)',
99
+ palette: 'defaultPalette',
100
+ attributes: {
101
+ type: 'color',
102
+ mode: 'dark'
103
+ },
104
+ extends: 'dark',
105
+ increasesContrastFor: 'dark'
106
+ },
81
107
  'atlassian-legacy-light': {
82
108
  id: 'legacy-light',
83
109
  displayName: 'Light Theme (legacy)',
@@ -195,6 +221,7 @@ const themeConfig = {
195
221
  */
196
222
  export const themeStateDefaults = {
197
223
  colorMode: 'auto',
224
+ contrastMode: 'auto',
198
225
  dark: 'dark',
199
226
  light: 'light',
200
227
  shape: undefined,
@@ -0,0 +1,265 @@
1
+ const color = {
2
+ color: {
3
+ text: {
4
+ accent: {
5
+ blue: {
6
+ '[default]': {
7
+ value: 'Blue200'
8
+ },
9
+ bolder: {
10
+ value: 'Blue100'
11
+ }
12
+ },
13
+ red: {
14
+ '[default]': {
15
+ value: 'Red200'
16
+ },
17
+ bolder: {
18
+ value: 'Red100'
19
+ }
20
+ },
21
+ orange: {
22
+ '[default]': {
23
+ value: 'Orange200'
24
+ },
25
+ bolder: {
26
+ value: 'Orange100'
27
+ }
28
+ },
29
+ yellow: {
30
+ '[default]': {
31
+ value: 'Yellow200'
32
+ },
33
+ bolder: {
34
+ value: 'Yellow100'
35
+ }
36
+ },
37
+ green: {
38
+ '[default]': {
39
+ value: 'Green200'
40
+ },
41
+ bolder: {
42
+ value: 'Green100'
43
+ }
44
+ },
45
+ purple: {
46
+ '[default]': {
47
+ value: 'Purple200'
48
+ },
49
+ bolder: {
50
+ value: 'Purple100'
51
+ }
52
+ },
53
+ teal: {
54
+ '[default]': {
55
+ value: 'Teal200'
56
+ },
57
+ bolder: {
58
+ value: 'Teal100'
59
+ }
60
+ },
61
+ magenta: {
62
+ '[default]': {
63
+ value: 'Magenta200'
64
+ },
65
+ bolder: {
66
+ value: 'Magenta100'
67
+ }
68
+ },
69
+ lime: {
70
+ '[default]': {
71
+ value: 'Lime200'
72
+ },
73
+ bolder: {
74
+ value: 'Lime100'
75
+ }
76
+ },
77
+ gray: {
78
+ '[default]': {
79
+ value: 'DarkNeutral900'
80
+ },
81
+ bolder: {
82
+ value: 'DarkNeutral1100'
83
+ }
84
+ }
85
+ }
86
+ },
87
+ icon: {
88
+ accent: {
89
+ blue: {
90
+ value: 'Blue300'
91
+ },
92
+ red: {
93
+ value: 'Red300'
94
+ },
95
+ orange: {
96
+ value: 'Orange300'
97
+ },
98
+ yellow: {
99
+ value: 'Yellow300'
100
+ },
101
+ green: {
102
+ value: 'Green300'
103
+ },
104
+ purple: {
105
+ value: 'Purple300'
106
+ },
107
+ teal: {
108
+ value: 'Teal300'
109
+ },
110
+ magenta: {
111
+ value: 'Magenta300'
112
+ },
113
+ lime: {
114
+ value: 'Lime300'
115
+ },
116
+ gray: {
117
+ value: 'DarkNeutral800'
118
+ }
119
+ }
120
+ },
121
+ border: {
122
+ accent: {
123
+ blue: {
124
+ value: 'Blue300'
125
+ },
126
+ red: {
127
+ value: 'Red300'
128
+ },
129
+ orange: {
130
+ value: 'Orange300'
131
+ },
132
+ yellow: {
133
+ value: 'Yellow300'
134
+ },
135
+ green: {
136
+ value: 'Green300'
137
+ },
138
+ purple: {
139
+ value: 'Purple300'
140
+ },
141
+ teal: {
142
+ value: 'Teal300'
143
+ },
144
+ magenta: {
145
+ value: 'Magenta300'
146
+ },
147
+ lime: {
148
+ value: 'Lime300'
149
+ },
150
+ gray: {
151
+ value: 'DarkNeutral800'
152
+ }
153
+ }
154
+ },
155
+ background: {
156
+ accent: {
157
+ red: {
158
+ bolder: {
159
+ '[default]': {
160
+ value: 'Red200'
161
+ },
162
+ hovered: {
163
+ value: 'Red100'
164
+ }
165
+ }
166
+ },
167
+ orange: {
168
+ bolder: {
169
+ '[default]': {
170
+ value: 'Orange200'
171
+ },
172
+ hovered: {
173
+ value: 'Orange100'
174
+ }
175
+ }
176
+ },
177
+ yellow: {
178
+ bolder: {
179
+ '[default]': {
180
+ value: 'Yellow200'
181
+ },
182
+ hovered: {
183
+ value: 'Yellow100'
184
+ }
185
+ }
186
+ },
187
+ green: {
188
+ bolder: {
189
+ '[default]': {
190
+ value: 'Green200'
191
+ },
192
+ hovered: {
193
+ value: 'Green100'
194
+ }
195
+ }
196
+ },
197
+ purple: {
198
+ bolder: {
199
+ '[default]': {
200
+ value: 'Purple200'
201
+ },
202
+ hovered: {
203
+ value: 'Purple100'
204
+ }
205
+ }
206
+ },
207
+ teal: {
208
+ bolder: {
209
+ '[default]': {
210
+ value: 'Teal200'
211
+ },
212
+ hovered: {
213
+ value: 'Teal100'
214
+ }
215
+ }
216
+ },
217
+ magenta: {
218
+ bolder: {
219
+ '[default]': {
220
+ value: 'Magenta200'
221
+ },
222
+ hovered: {
223
+ value: 'Magenta100'
224
+ }
225
+ }
226
+ },
227
+ lime: {
228
+ bolder: {
229
+ '[default]': {
230
+ value: 'Lime200'
231
+ },
232
+ hovered: {
233
+ value: 'Lime100'
234
+ }
235
+ }
236
+ },
237
+ gray: {
238
+ subtle: {
239
+ '[default]': {
240
+ value: 'DarkNeutral400'
241
+ },
242
+ hovered: {
243
+ value: 'DarkNeutral300'
244
+ },
245
+ pressed: {
246
+ value: 'DarkNeutral200'
247
+ }
248
+ },
249
+ bolder: {
250
+ '[default]': {
251
+ value: 'DarkNeutral800'
252
+ },
253
+ hovered: {
254
+ value: 'DarkNeutral900'
255
+ },
256
+ pressed: {
257
+ value: 'DarkNeutral1000'
258
+ }
259
+ }
260
+ }
261
+ }
262
+ }
263
+ }
264
+ };
265
+ export default color;
@@ -0,0 +1,98 @@
1
+ const color = {
2
+ color: {
3
+ background: {
4
+ brand: {
5
+ bold: {
6
+ '[default]': {
7
+ value: 'Blue200'
8
+ },
9
+ hovered: {
10
+ value: 'Blue100'
11
+ },
12
+ pressed: {
13
+ value: 'DarkNeutral1100'
14
+ }
15
+ }
16
+ },
17
+ selected: {
18
+ bold: {
19
+ '[default]': {
20
+ value: 'Blue200'
21
+ },
22
+ hovered: {
23
+ value: 'Blue100'
24
+ },
25
+ pressed: {
26
+ value: 'DarkNeutral1100'
27
+ }
28
+ }
29
+ },
30
+ danger: {
31
+ bold: {
32
+ '[default]': {
33
+ value: 'Red200'
34
+ },
35
+ hovered: {
36
+ value: 'Red100'
37
+ },
38
+ pressed: {
39
+ value: 'DarkNeutral1100'
40
+ }
41
+ }
42
+ },
43
+ warning: {
44
+ bold: {
45
+ '[default]': {
46
+ value: 'Yellow200'
47
+ },
48
+ hovered: {
49
+ value: 'Yellow100'
50
+ },
51
+ pressed: {
52
+ value: 'DarkNeutral1100'
53
+ }
54
+ }
55
+ },
56
+ success: {
57
+ bold: {
58
+ '[default]': {
59
+ value: 'Green200'
60
+ },
61
+ hovered: {
62
+ value: 'Green100'
63
+ },
64
+ pressed: {
65
+ value: 'DarkNeutral1100'
66
+ }
67
+ }
68
+ },
69
+ discovery: {
70
+ bold: {
71
+ '[default]': {
72
+ value: 'Purple200'
73
+ },
74
+ hovered: {
75
+ value: 'Purple100'
76
+ },
77
+ pressed: {
78
+ value: 'DarkNeutral1100'
79
+ }
80
+ }
81
+ },
82
+ information: {
83
+ bold: {
84
+ '[default]': {
85
+ value: 'Blue200'
86
+ },
87
+ hovered: {
88
+ value: 'Blue100'
89
+ },
90
+ pressed: {
91
+ value: 'DarkNeutral1100'
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ };
98
+ export default color;
@@ -0,0 +1,40 @@
1
+ const color = {
2
+ color: {
3
+ border: {
4
+ '[default]': {
5
+ value: 'DarkNeutral500A'
6
+ },
7
+ bold: {
8
+ value: 'DarkNeutral800'
9
+ },
10
+ input: {
11
+ value: 'DarkNeutral800'
12
+ },
13
+ disabled: {
14
+ value: 'DarkNeutral300A'
15
+ },
16
+ brand: {
17
+ value: 'Blue300'
18
+ },
19
+ selected: {
20
+ value: 'Blue300'
21
+ },
22
+ danger: {
23
+ value: 'Red400'
24
+ },
25
+ warning: {
26
+ value: 'Orange300'
27
+ },
28
+ success: {
29
+ value: 'Green300'
30
+ },
31
+ discovery: {
32
+ value: 'Purple400'
33
+ },
34
+ information: {
35
+ value: 'Blue300'
36
+ }
37
+ }
38
+ }
39
+ };
40
+ export default color;