@atlaskit/tokens 1.25.2 → 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 +6 -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 -1
  187. package/report.api.md +38 -5
  188. package/tmp/api-report-tmp.d.ts +19 -12
@@ -1,5 +1,6 @@
1
1
  export var THEME_DATA_ATTRIBUTE = 'data-theme';
2
2
  export var COLOR_MODE_ATTRIBUTE = 'data-color-mode';
3
+ export var CONTRAST_MODE_ATTRIBUTE = 'data-contrast-mode';
3
4
  export var CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
4
5
  export var DEFAULT_THEME = 'light';
5
6
  export var CSS_PREFIX = 'ds';
@@ -27,6 +27,8 @@ var enableGlobalTheme = function enableGlobalTheme() {
27
27
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
28
28
  _ref$colorMode = _ref.colorMode,
29
29
  colorMode = _ref$colorMode === void 0 ? themeStateDefaults['colorMode'] : _ref$colorMode,
30
+ _ref$contrastMode = _ref.contrastMode,
31
+ contrastMode = _ref$contrastMode === void 0 ? themeStateDefaults['contrastMode'] : _ref$contrastMode,
30
32
  _ref$dark = _ref.dark,
31
33
  dark = _ref$dark === void 0 ? themeStateDefaults['dark'] : _ref$dark,
32
34
  _ref$light = _ref.light,
@@ -42,6 +44,7 @@ var enableGlobalTheme = function enableGlobalTheme() {
42
44
  var themeLoader = arguments.length > 1 ? arguments[1] : undefined;
43
45
  var themeState = {
44
46
  colorMode: colorMode,
47
+ contrastMode: contrastMode,
45
48
  dark: dark,
46
49
  light: light,
47
50
  shape: 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,7 +10,12 @@ 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
- var getSSRAutoScript = function getSSRAutoScript(colorMode) {
13
- return colorMode === 'auto' ? "(\n () => {\n try {\n const mql = window.matchMedia('".concat(darkModeMediaQuery, "');\n const colorMode = mql.matches ? 'dark' : 'light';\n document.documentElement.setAttribute('").concat(COLOR_MODE_ATTRIBUTE, "', colorMode);\n } catch (e) {}\n }\n)()") : undefined;
13
+ var getSSRAutoScript = function getSSRAutoScript(colorMode, contrastMode) {
14
+ if (colorMode !== 'auto' && contrastMode !== 'auto') {
15
+ return undefined;
16
+ }
17
+ var setColorMode = colorMode === 'auto' ? "\n try {\n const darkModeMql = window.matchMedia('".concat(darkModeMediaQuery, "');\n const colorMode = darkModeMql.matches ? 'dark' : 'light';\n document.documentElement.setAttribute('").concat(COLOR_MODE_ATTRIBUTE, "', colorMode);\n } catch (e) {}") : '';
18
+ var setContrastMode = getBooleanFF('platform.design-system-team.increased-contrast-themes') && contrastMode === 'auto' ? "\n try {\n const contrastModeMql = window.matchMedia('".concat(moreContrastMediaQuery, "');\n const contrastMode = contrastModeMql.matches ? 'more' : 'no-preference';\n document.documentElement.setAttribute('").concat(CONTRAST_MODE_ATTRIBUTE, "', contrastMode);\n } catch (e) {}") : '';
19
+ return "(() => {".concat(setColorMode).concat(setContrastMode, "})()");
14
20
  };
15
21
  export default getSSRAutoScript;
@@ -1,10 +1,14 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { COLOR_MODE_ATTRIBUTE, CONTRAST_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
3
6
  import { themeStateDefaults } from './theme-config';
4
7
  import { themeObjectToString } from './theme-state-transformer';
5
8
  import { isValidBrandHex } from './utils/color-utils';
6
9
  import { hash } from './utils/hash';
7
10
  var defaultColorMode = 'light';
11
+ var defaultContrastMode = 'no-preference';
8
12
 
9
13
  /**
10
14
  * Server-side rendering utility. Generates the valid HTML attributes for a given theme.
@@ -29,6 +33,8 @@ var getThemeHtmlAttrs = function getThemeHtmlAttrs() {
29
33
  dark = _ref$dark === void 0 ? themeStateDefaults['dark'] : _ref$dark,
30
34
  _ref$light = _ref.light,
31
35
  light = _ref$light === void 0 ? themeStateDefaults['light'] : _ref$light,
36
+ _ref$contrastMode = _ref.contrastMode,
37
+ contrastMode = _ref$contrastMode === void 0 ? themeStateDefaults['contrastMode'] : _ref$contrastMode,
32
38
  _ref$shape = _ref.shape,
33
39
  shape = _ref$shape === void 0 ? themeStateDefaults['shape'] : _ref$shape,
34
40
  _ref$spacing = _ref.spacing,
@@ -45,6 +51,9 @@ var getThemeHtmlAttrs = function getThemeHtmlAttrs() {
45
51
  typography: typography
46
52
  });
47
53
  var result = (_result = {}, _defineProperty(_result, THEME_DATA_ATTRIBUTE, themeAttribute), _defineProperty(_result, COLOR_MODE_ATTRIBUTE, colorMode === 'auto' ? defaultColorMode : colorMode), _result);
54
+ if (getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
55
+ result = _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, CONTRAST_MODE_ATTRIBUTE, contrastMode === 'auto' ? defaultContrastMode : contrastMode));
56
+ }
48
57
  if (UNSAFE_themeOptions && isValidBrandHex(UNSAFE_themeOptions.brandColor)) {
49
58
  var optionString = JSON.stringify(UNSAFE_themeOptions);
50
59
  var uniqueId = hash(optionString);
@@ -1,6 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { themeIdsWithOverrides, themeStateDefaults } from './theme-config';
5
6
  import { isValidBrandHex } from './utils/color-utils';
6
7
  import { getThemeOverridePreferences, getThemePreferences } from './utils/get-theme-preferences';
@@ -30,9 +31,17 @@ var getThemeStyles = /*#__PURE__*/function () {
30
31
  themeOverridePreferences = [];
31
32
  if (preferences === 'all') {
32
33
  themePreferences = themeIdsWithOverrides;
34
+
35
+ // CLEANUP: Remove
36
+ if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
37
+ themePreferences = themePreferences.filter(function (n) {
38
+ return n !== 'light-increased-contrast' && n !== 'dark-increased-contrast';
39
+ });
40
+ }
33
41
  } else {
34
42
  themeState = {
35
43
  colorMode: (preferences === null || preferences === void 0 ? void 0 : preferences.colorMode) || themeStateDefaults['colorMode'],
44
+ contrastMode: (preferences === null || preferences === void 0 ? void 0 : preferences.contrastMode) || themeStateDefaults['contrastMode'],
36
45
  dark: (preferences === null || preferences === void 0 ? void 0 : preferences.dark) || themeStateDefaults['dark'],
37
46
  light: (preferences === null || preferences === void 0 ? void 0 : preferences.light) || themeStateDefaults['light'],
38
47
  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
  var name = "@atlaskit/tokens";
4
- var version = "1.25.2";
4
+ var 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
  var name = "@atlaskit/tokens";
5
- var version = "1.25.2";
5
+ var 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.
@@ -3,6 +3,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
3
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import { themeStateDefaults } from './theme-config';
7
8
  import { isValidBrandHex } from './utils/color-utils';
8
9
  import configurePage from './utils/configure-page';
@@ -15,6 +16,7 @@ import { loadAndAppendThemeCss } from './utils/theme-loading';
15
16
  *
16
17
  * @param {Object<string, string>} themeState The themes and color mode that should be applied.
17
18
  * @param {string} themeState.colorMode Determines which color theme is applied. If set to `auto`, the theme applied will be determined by the OS setting.
19
+ * @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.
18
20
  * @param {string} themeState.dark The color theme to be applied when the color mode resolves to 'dark'.
19
21
  * @param {string} themeState.light The color theme to be applied when the color mode resolves to 'light'.
20
22
  * @param {string} themeState.shape The shape theme to be applied.
@@ -35,6 +37,8 @@ var setGlobalTheme = /*#__PURE__*/function () {
35
37
  var _ref2,
36
38
  _ref2$colorMode,
37
39
  colorMode,
40
+ _ref2$contrastMode,
41
+ contrastMode,
38
42
  _ref2$dark,
39
43
  dark,
40
44
  _ref2$light,
@@ -63,10 +67,21 @@ var setGlobalTheme = /*#__PURE__*/function () {
63
67
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
64
68
  while (1) switch (_context3.prev = _context3.next) {
65
69
  case 0:
66
- _ref2 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref2$colorMode = _ref2.colorMode, colorMode = _ref2$colorMode === void 0 ? themeStateDefaults['colorMode'] : _ref2$colorMode, _ref2$dark = _ref2.dark, dark = _ref2$dark === void 0 ? themeStateDefaults['dark'] : _ref2$dark, _ref2$light = _ref2.light, light = _ref2$light === void 0 ? themeStateDefaults['light'] : _ref2$light, _ref2$shape = _ref2.shape, shape = _ref2$shape === void 0 ? themeStateDefaults['shape'] : _ref2$shape, _ref2$spacing = _ref2.spacing, spacing = _ref2$spacing === void 0 ? themeStateDefaults['spacing'] : _ref2$spacing, _ref2$typography = _ref2.typography, typography = _ref2$typography === void 0 ? themeStateDefaults['typography'] : _ref2$typography, _ref2$UNSAFE_themeOpt = _ref2.UNSAFE_themeOptions, UNSAFE_themeOptions = _ref2$UNSAFE_themeOpt === void 0 ? themeStateDefaults['UNSAFE_themeOptions'] : _ref2$UNSAFE_themeOpt;
70
+ _ref2 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref2$colorMode = _ref2.colorMode, colorMode = _ref2$colorMode === void 0 ? themeStateDefaults['colorMode'] : _ref2$colorMode, _ref2$contrastMode = _ref2.contrastMode, contrastMode = _ref2$contrastMode === void 0 ? themeStateDefaults['contrastMode'] : _ref2$contrastMode, _ref2$dark = _ref2.dark, dark = _ref2$dark === void 0 ? themeStateDefaults['dark'] : _ref2$dark, _ref2$light = _ref2.light, light = _ref2$light === void 0 ? themeStateDefaults['light'] : _ref2$light, _ref2$shape = _ref2.shape, shape = _ref2$shape === void 0 ? themeStateDefaults['shape'] : _ref2$shape, _ref2$spacing = _ref2.spacing, spacing = _ref2$spacing === void 0 ? themeStateDefaults['spacing'] : _ref2$spacing, _ref2$typography = _ref2.typography, typography = _ref2$typography === void 0 ? themeStateDefaults['typography'] : _ref2$typography, _ref2$UNSAFE_themeOpt = _ref2.UNSAFE_themeOptions, UNSAFE_themeOptions = _ref2$UNSAFE_themeOpt === void 0 ? themeStateDefaults['UNSAFE_themeOptions'] : _ref2$UNSAFE_themeOpt;
67
71
  themeLoader = _args3.length > 1 ? _args3[1] : undefined;
72
+ // CLEANUP: Remove. This blocks application of increased contrast themes
73
+ // without the feature flag enabled.
74
+ if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
75
+ if (light === 'light-increased-contrast') {
76
+ light = 'light';
77
+ }
78
+ if (dark === 'dark-increased-contrast') {
79
+ dark = 'dark';
80
+ }
81
+ }
68
82
  themeState = {
69
83
  colorMode: colorMode,
84
+ contrastMode: contrastMode,
70
85
  dark: dark,
71
86
  light: light,
72
87
  shape: shape,
@@ -125,44 +140,44 @@ var setGlobalTheme = /*#__PURE__*/function () {
125
140
  }))());
126
141
  }
127
142
  }
128
- _context3.next = 9;
143
+ _context3.next = 10;
129
144
  return Promise.all(loadingTasks);
130
- case 9:
145
+ case 10:
131
146
  // Load override themes after standard themes
132
147
  themeOverridePreferences = getThemeOverridePreferences(themeState);
133
148
  _iterator = _createForOfIteratorHelper(themeOverridePreferences);
134
- _context3.prev = 11;
149
+ _context3.prev = 12;
135
150
  _iterator.s();
136
- case 13:
151
+ case 14:
137
152
  if ((_step = _iterator.n()).done) {
138
- _context3.next = 19;
153
+ _context3.next = 20;
139
154
  break;
140
155
  }
141
156
  themeId = _step.value;
142
- _context3.next = 17;
157
+ _context3.next = 18;
143
158
  return loadingStrategy(themeId);
144
- case 17:
145
- _context3.next = 13;
159
+ case 18:
160
+ _context3.next = 14;
146
161
  break;
147
- case 19:
148
- _context3.next = 24;
162
+ case 20:
163
+ _context3.next = 25;
149
164
  break;
150
- case 21:
151
- _context3.prev = 21;
152
- _context3.t0 = _context3["catch"](11);
165
+ case 22:
166
+ _context3.prev = 22;
167
+ _context3.t0 = _context3["catch"](12);
153
168
  _iterator.e(_context3.t0);
154
- case 24:
155
- _context3.prev = 24;
169
+ case 25:
170
+ _context3.prev = 25;
156
171
  _iterator.f();
157
- return _context3.finish(24);
158
- case 27:
172
+ return _context3.finish(25);
173
+ case 28:
159
174
  autoUnbind = configurePage(themeState);
160
175
  return _context3.abrupt("return", autoUnbind);
161
- case 29:
176
+ case 30:
162
177
  case "end":
163
178
  return _context3.stop();
164
179
  }
165
- }, _callee3, null, [[11, 21, 24, 27]]);
180
+ }, _callee3, null, [[12, 22, 25, 28]]);
166
181
  }));
167
182
  return function setGlobalTheme() {
168
183
  return _ref.apply(this, arguments);
@@ -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 var themeColorModes = ['light', 'dark', 'auto'];
31
+ /**
32
+ * Contrast preferences: The system contrast preference
33
+ */
34
+ export var 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 var themeIds = ['light', 'dark', 'legacy-light', 'legacy-dark', 'spacing', 'typography', 'shape', 'typography-adg3', 'typography-minor3'];
41
+ export var 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 @@ var 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 @@ var 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 @@ var themeConfig = {
195
221
  */
196
222
  export var 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
+ var 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
+ var 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;