@atlaskit/tokens 1.55.0 → 1.56.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 (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/artifacts/generated-pairs.js +2 -2
  3. package/dist/cjs/artifacts/palettes-raw/palette-brand-refresh.js +2257 -0
  4. package/dist/cjs/artifacts/theme-import-map.js +13 -1
  5. package/dist/cjs/artifacts/themes/atlassian-dark-brand-refresh.js +12 -0
  6. package/dist/cjs/artifacts/themes/atlassian-light-brand-refresh.js +12 -0
  7. package/dist/cjs/artifacts/token-default-values.js +2 -1
  8. package/dist/cjs/artifacts/token-names.js +2 -1
  9. package/dist/cjs/artifacts/tokens-raw/atlassian-dark-brand-refresh.js +8727 -0
  10. package/dist/cjs/artifacts/tokens-raw/atlassian-light-brand-refresh.js +8689 -0
  11. package/dist/cjs/get-theme-styles.js +4 -1
  12. package/dist/cjs/get-token-value.js +8 -2
  13. package/dist/cjs/get-token.js +8 -2
  14. package/dist/cjs/set-global-theme.js +1 -1
  15. package/dist/cjs/theme-config.js +19 -1
  16. package/dist/cjs/utils/get-theme-preferences.js +2 -2
  17. package/dist/cjs/utils/theme-loading.js +7 -3
  18. package/dist/es2019/artifacts/generated-pairs.js +2 -2
  19. package/dist/es2019/artifacts/palettes-raw/palette-brand-refresh.js +2251 -0
  20. package/dist/es2019/artifacts/theme-import-map.js +6 -2
  21. package/dist/es2019/artifacts/themes/atlassian-dark-brand-refresh.js +401 -0
  22. package/dist/es2019/artifacts/themes/atlassian-light-brand-refresh.js +401 -0
  23. package/dist/es2019/artifacts/token-default-values.js +2 -1
  24. package/dist/es2019/artifacts/token-names.js +2 -1
  25. package/dist/es2019/artifacts/tokens-raw/atlassian-dark-brand-refresh.js +8721 -0
  26. package/dist/es2019/artifacts/tokens-raw/atlassian-light-brand-refresh.js +8683 -0
  27. package/dist/es2019/get-theme-styles.js +3 -2
  28. package/dist/es2019/get-token-value.js +8 -2
  29. package/dist/es2019/get-token.js +8 -2
  30. package/dist/es2019/set-global-theme.js +2 -2
  31. package/dist/es2019/theme-config.js +19 -1
  32. package/dist/es2019/utils/get-theme-preferences.js +3 -3
  33. package/dist/es2019/utils/theme-loading.js +4 -0
  34. package/dist/esm/artifacts/generated-pairs.js +2 -2
  35. package/dist/esm/artifacts/palettes-raw/palette-brand-refresh.js +2251 -0
  36. package/dist/esm/artifacts/theme-import-map.js +9 -1
  37. package/dist/esm/artifacts/themes/atlassian-dark-brand-refresh.js +6 -0
  38. package/dist/esm/artifacts/themes/atlassian-light-brand-refresh.js +6 -0
  39. package/dist/esm/artifacts/token-default-values.js +2 -1
  40. package/dist/esm/artifacts/token-names.js +2 -1
  41. package/dist/esm/artifacts/tokens-raw/atlassian-dark-brand-refresh.js +8721 -0
  42. package/dist/esm/artifacts/tokens-raw/atlassian-light-brand-refresh.js +8683 -0
  43. package/dist/esm/get-theme-styles.js +5 -2
  44. package/dist/esm/get-token-value.js +8 -2
  45. package/dist/esm/get-token.js +8 -2
  46. package/dist/esm/set-global-theme.js +2 -2
  47. package/dist/esm/theme-config.js +19 -1
  48. package/dist/esm/utils/get-theme-preferences.js +3 -3
  49. package/dist/esm/utils/theme-loading.js +7 -3
  50. package/dist/types/artifacts/generated-pairs.d.ts +1 -1
  51. package/dist/types/artifacts/palettes-raw/palette-brand-refresh.d.ts +41 -0
  52. package/dist/types/artifacts/theme-import-map.d.ts +1 -1
  53. package/dist/types/artifacts/themes/atlassian-dark-brand-refresh.d.ts +7 -0
  54. package/dist/types/artifacts/themes/atlassian-light-brand-refresh.d.ts +7 -0
  55. package/dist/types/artifacts/token-default-values.d.ts +2 -1
  56. package/dist/types/artifacts/token-names.d.ts +3 -1
  57. package/dist/types/artifacts/tokens-raw/atlassian-dark-brand-refresh.d.ts +109 -0
  58. package/dist/types/artifacts/tokens-raw/atlassian-light-brand-refresh.d.ts +89 -0
  59. package/dist/types/artifacts/types-internal.d.ts +2 -2
  60. package/dist/types/artifacts/types.d.ts +2 -2
  61. package/dist/types/entry-points/css-type-schema.codegen.d.ts +2 -2
  62. package/dist/types/theme-config.d.ts +6 -6
  63. package/dist/types/types.d.ts +22 -1
  64. package/dist/types-ts4.5/artifacts/generated-pairs.d.ts +1 -1
  65. package/dist/types-ts4.5/artifacts/palettes-raw/palette-brand-refresh.d.ts +41 -0
  66. package/dist/types-ts4.5/artifacts/theme-import-map.d.ts +1 -1
  67. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-brand-refresh.d.ts +7 -0
  68. package/dist/types-ts4.5/artifacts/themes/atlassian-light-brand-refresh.d.ts +7 -0
  69. package/dist/types-ts4.5/artifacts/token-default-values.d.ts +2 -1
  70. package/dist/types-ts4.5/artifacts/token-names.d.ts +3 -1
  71. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-brand-refresh.d.ts +109 -0
  72. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light-brand-refresh.d.ts +89 -0
  73. package/dist/types-ts4.5/artifacts/types-internal.d.ts +2 -2
  74. package/dist/types-ts4.5/artifacts/types.d.ts +2 -2
  75. package/dist/types-ts4.5/entry-points/css-type-schema.codegen.d.ts +2 -2
  76. package/dist/types-ts4.5/theme-config.d.ts +8 -4
  77. package/dist/types-ts4.5/types.d.ts +22 -1
  78. package/figma/atlassian-dark-brand-refresh.json +3558 -0
  79. package/figma/atlassian-light-brand-refresh.json +3537 -0
  80. package/package.json +5 -1
@@ -1,4 +1,4 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { themeIdsWithOverrides, themeStateDefaults } from './theme-config';
3
3
  import { isValidBrandHex } from './utils/color-utils';
4
4
  import { getThemeOverridePreferences, getThemePreferences } from './utils/get-theme-preferences';
@@ -26,9 +26,10 @@ const getThemeStyles = async preferences => {
26
26
  themePreferences = themeIdsWithOverrides;
27
27
 
28
28
  // CLEANUP: Remove
29
- if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
29
+ if (!fg('platform.design-system-team.increased-contrast-themes')) {
30
30
  themePreferences = themePreferences.filter(n => n !== 'light-increased-contrast' && n !== 'dark-increased-contrast');
31
31
  }
32
+ themePreferences = themePreferences.filter(n => n !== 'light-brand-refresh' && n !== 'dark-brand-refresh');
32
33
  } else {
33
34
  const themeState = {
34
35
  colorMode: (preferences === null || preferences === void 0 ? void 0 : preferences.colorMode) || themeStateDefaults['colorMode'],
@@ -1,4 +1,5 @@
1
1
  import warnOnce from '@atlaskit/ds-lib/warn-once';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import tokens from './artifacts/token-names';
3
4
  /**
4
5
  * Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
@@ -24,8 +25,13 @@ import tokens from './artifacts/token-names';
24
25
  function getTokenValue(tokenId, fallback = '') {
25
26
  let token = tokens[tokenId];
26
27
  let tokenValue = fallback;
27
- if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !token) {
28
- warnOnce(`Unknown token id at path: ${tokenId} in @atlaskit/tokens`);
28
+ if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {
29
+ if (!token) {
30
+ warnOnce(`Unknown token id at path: ${tokenId} in @atlaskit/tokens`);
31
+ }
32
+ if (token === '--ds-icon-subtlest' && !fg('platform-component-visual-refresh')) {
33
+ warnOnce(`Token "color.icon.subtlest" is only available when feature flag "platform-component-visual-refresh" is on, don't use it if the flag can't be turned on on this page`);
34
+ }
29
35
  }
30
36
  if (typeof window === 'undefined') {
31
37
  return tokenValue;
@@ -1,4 +1,5 @@
1
1
  import warnOnce from '@atlaskit/ds-lib/warn-once';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import tokens from './artifacts/token-names';
3
4
  import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
4
5
  /**
@@ -25,8 +26,13 @@ import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
25
26
  */
26
27
  function token(path, fallback) {
27
28
  let token = tokens[path];
28
- if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !token) {
29
- warnOnce(`Unknown token id at path: ${path} in @atlaskit/tokens`);
29
+ if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {
30
+ if (!token) {
31
+ warnOnce(`Unknown token id at path: ${path} in @atlaskit/tokens`);
32
+ }
33
+ if (token === '--ds-icon-subtlest' && !fg('platform-component-visual-refresh')) {
34
+ warnOnce(`Token "color.icon.subtlest" is only available when feature flag "platform-component-visual-refresh" is on, don't use it if the flag can't be turned on on this page`);
35
+ }
30
36
  }
31
37
 
32
38
  // if the token is not found - replacing it with variable name without any value, to avoid it being undefined which would result in invalid css
@@ -1,4 +1,4 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import { themeStateDefaults } from './theme-config';
3
3
  import { isValidBrandHex } from './utils/color-utils';
4
4
  import configurePage from './utils/configure-page';
@@ -39,7 +39,7 @@ const setGlobalTheme = async ({
39
39
  } = {}, themeLoader) => {
40
40
  // CLEANUP: Remove. This blocks application of increased contrast themes
41
41
  // without the feature flag enabled.
42
- if (!getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
42
+ if (!fg('platform.design-system-team.increased-contrast-themes')) {
43
43
  if (light === 'light-increased-contrast') {
44
44
  light = 'light';
45
45
  }
@@ -38,7 +38,7 @@ export const themeContrastModes = ['more', 'no-preference', 'auto'];
38
38
  *
39
39
  * These ids must be kebab case
40
40
  */
41
- export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'legacy-light', 'legacy-dark', 'spacing', 'shape', 'typography-adg3', 'typography-minor3'];
41
+ export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'light-brand-refresh', 'dark', 'dark-future', 'dark-increased-contrast', 'dark-brand-refresh', 'legacy-light', 'legacy-dark', 'spacing', 'shape', 'typography-adg3', 'typography-minor3'];
42
42
  /**
43
43
  * Theme override ids: the equivalent of themeIds for theme overrides.
44
44
  * Theme overrides are temporary and there may not be any defined at times.
@@ -173,6 +173,24 @@ const themeConfig = {
173
173
  attributes: {
174
174
  type: 'typography'
175
175
  }
176
+ },
177
+ 'atlassian-light-brand-refresh': {
178
+ id: 'light-brand-refresh',
179
+ displayName: 'Light theme (Brand refresh)',
180
+ palette: 'brandRefreshPalette',
181
+ attributes: {
182
+ type: 'color',
183
+ mode: 'light'
184
+ }
185
+ },
186
+ 'atlassian-dark-brand-refresh': {
187
+ id: 'dark-brand-refresh',
188
+ displayName: 'Dark theme (Brand refresh)',
189
+ palette: 'brandRefreshPalette',
190
+ attributes: {
191
+ type: 'color',
192
+ mode: 'dark'
193
+ }
176
194
  }
177
195
  };
178
196
 
@@ -1,4 +1,4 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import getIncreasedContrastTheme from './get-increased-contrast-theme';
3
3
  export const getThemePreferences = themeState => {
4
4
  const {
@@ -13,7 +13,7 @@ export const getThemePreferences = themeState => {
13
13
  const autoColorModeThemes = [light, dark];
14
14
  const themePreferences = [];
15
15
  if (colorMode === 'auto') {
16
- if (contrastMode !== 'no-preference' && getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
16
+ if (contrastMode !== 'no-preference' && fg('platform.design-system-team.increased-contrast-themes')) {
17
17
  autoColorModeThemes.forEach(normalTheme => {
18
18
  const increasedContrastTheme = getIncreasedContrastTheme(normalTheme);
19
19
  if (increasedContrastTheme) {
@@ -24,7 +24,7 @@ export const getThemePreferences = themeState => {
24
24
  themePreferences.push(...autoColorModeThemes);
25
25
  } else {
26
26
  themePreferences.push(themeState[colorMode]);
27
- if (contrastMode !== 'no-preference' && getBooleanFF('platform.design-system-team.increased-contrast-themes')) {
27
+ if (contrastMode !== 'no-preference' && fg('platform.design-system-team.increased-contrast-themes')) {
28
28
  const increasedContrastTheme = getIncreasedContrastTheme(themeState[colorMode]);
29
29
  if (increasedContrastTheme) {
30
30
  themePreferences.push(increasedContrastTheme);
@@ -1,3 +1,4 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import themeImportMap from '../artifacts/theme-import-map';
2
3
  import { CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from '../constants';
3
4
  export const loadAndAppendThemeCss = async themeId => {
@@ -17,6 +18,9 @@ export const loadAndAppendThemeCss = async themeId => {
17
18
  document.head.appendChild(style);
18
19
  };
19
20
  export const loadThemeCss = async themeId => {
21
+ if ((themeId === 'light' || themeId === 'dark') && fg('platform-component-visual-refresh')) {
22
+ themeId += '-brand-refresh';
23
+ }
20
24
  const {
21
25
  default: themeCss
22
26
  } = await themeImportMap[themeId]();