@atlaskit/tokens 1.4.1 → 1.4.3

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 (172) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/artifacts/themes/atlassian-dark-iteration.js +2 -2
  3. package/dist/cjs/get-token-value.js +1 -1
  4. package/dist/cjs/get-token.js +1 -1
  5. package/dist/cjs/tokens/atlassian-dark-iteration/color/accent.js +12 -12
  6. package/dist/cjs/tokens/atlassian-dark-iteration/color/background.js +8 -32
  7. package/dist/cjs/tokens/atlassian-dark-iteration/color/icon.js +0 -4
  8. package/dist/cjs/tokens/atlassian-dark-iteration/color/text.js +0 -14
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/artifacts/themes/atlassian-dark-iteration.js +7 -17
  11. package/dist/es2019/get-token-value.js +1 -1
  12. package/dist/es2019/get-token.js +1 -1
  13. package/dist/es2019/tokens/atlassian-dark-iteration/color/accent.js +12 -12
  14. package/dist/es2019/tokens/atlassian-dark-iteration/color/background.js +8 -32
  15. package/dist/es2019/tokens/atlassian-dark-iteration/color/icon.js +0 -4
  16. package/dist/es2019/tokens/atlassian-dark-iteration/color/text.js +0 -14
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/artifacts/themes/atlassian-dark-iteration.js +2 -2
  19. package/dist/esm/get-token-value.js +1 -1
  20. package/dist/esm/get-token.js +1 -1
  21. package/dist/esm/tokens/atlassian-dark-iteration/color/accent.js +12 -12
  22. package/dist/esm/tokens/atlassian-dark-iteration/color/background.js +8 -32
  23. package/dist/esm/tokens/atlassian-dark-iteration/color/icon.js +0 -4
  24. package/dist/esm/tokens/atlassian-dark-iteration/color/text.js +0 -14
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/artifacts/themes/atlassian-dark-iteration.d.ts +2 -2
  27. package/dist/types-ts4.5/artifacts/generated-pairs.d.ts +15 -0
  28. package/dist/types-ts4.5/artifacts/palettes-raw/legacy-palette.d.ts +41 -0
  29. package/dist/types-ts4.5/artifacts/palettes-raw/palette.d.ts +41 -0
  30. package/dist/types-ts4.5/artifacts/palettes-raw/shape-palette.d.ts +22 -0
  31. package/dist/types-ts4.5/artifacts/palettes-raw/spacing-scale.d.ts +41 -0
  32. package/dist/types-ts4.5/artifacts/palettes-raw/typography-palette.d.ts +22 -0
  33. package/dist/types-ts4.5/artifacts/replacement-mapping.d.ts +26 -0
  34. package/dist/types-ts4.5/artifacts/theme-import-map.d.ts +16 -0
  35. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-iteration.d.ts +7 -0
  36. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-new-input-border.d.ts +7 -0
  37. package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +7 -0
  38. package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-dark.d.ts +7 -0
  39. package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-light.d.ts +7 -0
  40. package/dist/types-ts4.5/artifacts/themes/atlassian-light-new-input-border.d.ts +7 -0
  41. package/dist/types-ts4.5/artifacts/themes/atlassian-light.d.ts +7 -0
  42. package/dist/types-ts4.5/artifacts/themes/atlassian-shape.d.ts +7 -0
  43. package/dist/types-ts4.5/artifacts/themes/atlassian-spacing.d.ts +7 -0
  44. package/dist/types-ts4.5/artifacts/themes/atlassian-typography.d.ts +7 -0
  45. package/dist/types-ts4.5/artifacts/token-default-values.d.ts +341 -0
  46. package/dist/types-ts4.5/artifacts/token-names.d.ts +669 -0
  47. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +113 -0
  48. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +113 -0
  49. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-light.d.ts +89 -0
  50. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light.d.ts +89 -0
  51. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-shape.d.ts +29 -0
  52. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-spacing.d.ts +59 -0
  53. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-typography.d.ts +29 -0
  54. package/dist/types-ts4.5/artifacts/types-internal.d.ts +6 -0
  55. package/dist/types-ts4.5/artifacts/types.d.ts +6 -0
  56. package/dist/types-ts4.5/artifacts/typescript/atlassian-dark-token-names.d.ts +784 -0
  57. package/dist/types-ts4.5/artifacts/typescript/atlassian-dark-types-internal.d.ts +6 -0
  58. package/dist/types-ts4.5/artifacts/typescript/atlassian-dark-types.d.ts +6 -0
  59. package/dist/types-ts4.5/artifacts/typescript/atlassian-light-token-names.d.ts +784 -0
  60. package/dist/types-ts4.5/artifacts/typescript/atlassian-light-types-internal.d.ts +6 -0
  61. package/dist/types-ts4.5/artifacts/typescript/atlassian-light-types.d.ts +6 -0
  62. package/dist/types-ts4.5/babel-plugin/index.d.ts +1 -0
  63. package/dist/types-ts4.5/babel-plugin/plugin.d.ts +14 -0
  64. package/dist/types-ts4.5/constants.d.ts +6 -0
  65. package/dist/types-ts4.5/entry-points/babel-plugin.d.ts +1 -0
  66. package/dist/types-ts4.5/entry-points/palettes-raw.d.ts +1 -0
  67. package/dist/types-ts4.5/entry-points/rename-mapping.d.ts +1 -0
  68. package/dist/types-ts4.5/entry-points/token-ids.d.ts +1 -0
  69. package/dist/types-ts4.5/entry-points/token-names.d.ts +2 -0
  70. package/dist/types-ts4.5/entry-points/token-order.d.ts +1 -0
  71. package/dist/types-ts4.5/entry-points/tokens-raw.d.ts +5 -0
  72. package/dist/types-ts4.5/get-global-theme.d.ts +2 -0
  73. package/dist/types-ts4.5/get-token-value.d.ts +25 -0
  74. package/dist/types-ts4.5/get-token.d.ts +26 -0
  75. package/dist/types-ts4.5/index.d.ts +13 -0
  76. package/dist/types-ts4.5/palettes/legacy-palette.d.ts +10 -0
  77. package/dist/types-ts4.5/palettes/palette.d.ts +5 -0
  78. package/dist/types-ts4.5/palettes/shape-palette.d.ts +67 -0
  79. package/dist/types-ts4.5/palettes/spacing-scale.d.ts +95 -0
  80. package/dist/types-ts4.5/palettes/typography-palette.d.ts +14 -0
  81. package/dist/types-ts4.5/set-global-theme.d.ts +74 -0
  82. package/dist/types-ts4.5/theme-config.d.ts +110 -0
  83. package/dist/types-ts4.5/theme-mutation-observer.d.ts +22 -0
  84. package/dist/types-ts4.5/tokens/atlassian-dark/color/accent.d.ts +4 -0
  85. package/dist/types-ts4.5/tokens/atlassian-dark/color/background.d.ts +4 -0
  86. package/dist/types-ts4.5/tokens/atlassian-dark/color/border.d.ts +4 -0
  87. package/dist/types-ts4.5/tokens/atlassian-dark/color/chart.d.ts +4 -0
  88. package/dist/types-ts4.5/tokens/atlassian-dark/color/icon.d.ts +4 -0
  89. package/dist/types-ts4.5/tokens/atlassian-dark/color/interaction.d.ts +4 -0
  90. package/dist/types-ts4.5/tokens/atlassian-dark/color/skeleton.d.ts +4 -0
  91. package/dist/types-ts4.5/tokens/atlassian-dark/color/text.d.ts +4 -0
  92. package/dist/types-ts4.5/tokens/atlassian-dark/elevation/shadow.d.ts +4 -0
  93. package/dist/types-ts4.5/tokens/atlassian-dark/elevation/surface.d.ts +4 -0
  94. package/dist/types-ts4.5/tokens/atlassian-dark/opacity/opacity.d.ts +3 -0
  95. package/dist/types-ts4.5/tokens/atlassian-dark/utility/utility.d.ts +5 -0
  96. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/color/accent.d.ts +4 -0
  97. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/color/background.d.ts +4 -0
  98. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/color/chart.d.ts +4 -0
  99. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/color/icon.d.ts +4 -0
  100. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/color/text.d.ts +4 -0
  101. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/elevation/shadow.d.ts +4 -0
  102. package/dist/types-ts4.5/tokens/atlassian-dark-iteration/elevation/surface.d.ts +4 -0
  103. package/dist/types-ts4.5/tokens/atlassian-dark-new-input-border/color/border.d.ts +4 -0
  104. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/accent.d.ts +4 -0
  105. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/background.d.ts +4 -0
  106. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/border.d.ts +4 -0
  107. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/chart.d.ts +4 -0
  108. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/icon.d.ts +4 -0
  109. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/interaction.d.ts +4 -0
  110. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/skeleton.d.ts +4 -0
  111. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/color/text.d.ts +4 -0
  112. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/elevation/shadow.d.ts +4 -0
  113. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/elevation/surface.d.ts +4 -0
  114. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/opacity/opacity.d.ts +3 -0
  115. package/dist/types-ts4.5/tokens/atlassian-legacy-dark/utility/utility.d.ts +5 -0
  116. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/accent.d.ts +4 -0
  117. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/background.d.ts +4 -0
  118. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/border.d.ts +4 -0
  119. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/chart.d.ts +4 -0
  120. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/icon.d.ts +4 -0
  121. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/interaction.d.ts +4 -0
  122. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/skeleton.d.ts +4 -0
  123. package/dist/types-ts4.5/tokens/atlassian-legacy-light/color/text.d.ts +4 -0
  124. package/dist/types-ts4.5/tokens/atlassian-legacy-light/elevation/shadow.d.ts +4 -0
  125. package/dist/types-ts4.5/tokens/atlassian-legacy-light/elevation/surface.d.ts +4 -0
  126. package/dist/types-ts4.5/tokens/atlassian-legacy-light/opacity/opacity.d.ts +3 -0
  127. package/dist/types-ts4.5/tokens/atlassian-legacy-light/utility/utility.d.ts +5 -0
  128. package/dist/types-ts4.5/tokens/atlassian-light/color/accent.d.ts +4 -0
  129. package/dist/types-ts4.5/tokens/atlassian-light/color/background.d.ts +4 -0
  130. package/dist/types-ts4.5/tokens/atlassian-light/color/border.d.ts +4 -0
  131. package/dist/types-ts4.5/tokens/atlassian-light/color/chart.d.ts +4 -0
  132. package/dist/types-ts4.5/tokens/atlassian-light/color/icon.d.ts +4 -0
  133. package/dist/types-ts4.5/tokens/atlassian-light/color/interaction.d.ts +4 -0
  134. package/dist/types-ts4.5/tokens/atlassian-light/color/skeleton.d.ts +4 -0
  135. package/dist/types-ts4.5/tokens/atlassian-light/color/text.d.ts +4 -0
  136. package/dist/types-ts4.5/tokens/atlassian-light/elevation/shadow.d.ts +4 -0
  137. package/dist/types-ts4.5/tokens/atlassian-light/elevation/surface.d.ts +4 -0
  138. package/dist/types-ts4.5/tokens/atlassian-light/opacity/opacity.d.ts +3 -0
  139. package/dist/types-ts4.5/tokens/atlassian-light/utility/utility.d.ts +5 -0
  140. package/dist/types-ts4.5/tokens/atlassian-light-new-input-border/color/border.d.ts +4 -0
  141. package/dist/types-ts4.5/tokens/atlassian-shape/shape.d.ts +7 -0
  142. package/dist/types-ts4.5/tokens/atlassian-spacing/spacing.d.ts +10 -0
  143. package/dist/types-ts4.5/tokens/atlassian-typography/font-family.d.ts +4 -0
  144. package/dist/types-ts4.5/tokens/atlassian-typography/font-size.d.ts +4 -0
  145. package/dist/types-ts4.5/tokens/atlassian-typography/font-weight.d.ts +4 -0
  146. package/dist/types-ts4.5/tokens/atlassian-typography/line-height.d.ts +4 -0
  147. package/dist/types-ts4.5/tokens/default/color/accent.d.ts +4 -0
  148. package/dist/types-ts4.5/tokens/default/color/background.d.ts +4 -0
  149. package/dist/types-ts4.5/tokens/default/color/border.d.ts +4 -0
  150. package/dist/types-ts4.5/tokens/default/color/chart.d.ts +4 -0
  151. package/dist/types-ts4.5/tokens/default/color/icon.d.ts +4 -0
  152. package/dist/types-ts4.5/tokens/default/color/interaction.d.ts +4 -0
  153. package/dist/types-ts4.5/tokens/default/color/skeleton.d.ts +4 -0
  154. package/dist/types-ts4.5/tokens/default/color/text.d.ts +4 -0
  155. package/dist/types-ts4.5/tokens/default/elevation/shadow.d.ts +4 -0
  156. package/dist/types-ts4.5/tokens/default/elevation/surface.d.ts +4 -0
  157. package/dist/types-ts4.5/tokens/default/opacity/opacity.d.ts +3 -0
  158. package/dist/types-ts4.5/tokens/default/shape/shape.d.ts +3 -0
  159. package/dist/types-ts4.5/tokens/default/spacing/spacing.d.ts +8 -0
  160. package/dist/types-ts4.5/tokens/default/typography/font-family.d.ts +4 -0
  161. package/dist/types-ts4.5/tokens/default/typography/font-size.d.ts +4 -0
  162. package/dist/types-ts4.5/tokens/default/typography/font-weight.d.ts +4 -0
  163. package/dist/types-ts4.5/tokens/default/typography/line-height.d.ts +4 -0
  164. package/dist/types-ts4.5/tokens/default/utility/utility.d.ts +5 -0
  165. package/dist/types-ts4.5/types.d.ts +829 -0
  166. package/dist/types-ts4.5/use-theme-observer.d.ts +15 -0
  167. package/dist/types-ts4.5/utils/color-detection.d.ts +13 -0
  168. package/dist/types-ts4.5/utils/theme-loading.d.ts +3 -0
  169. package/dist/types-ts4.5/utils/theme-state-transformer.d.ts +26 -0
  170. package/dist/types-ts4.5/utils/token-ids.d.ts +41 -0
  171. package/dist/types-ts4.5/utils/token-order.d.ts +7 -0
  172. package/package.json +2 -2
@@ -0,0 +1,15 @@
1
+ import { ActiveThemeState } from './set-global-theme';
2
+ /**
3
+ * A React hook which returns the current themes and color-mode set on `<html>`.
4
+ *
5
+ * @example
6
+ * ```
7
+ * const { colorMode, dark, light, spacing, typography } = useThemeObserver();
8
+ *
9
+ * // Performing side effects when it changes
10
+ * useEffect(() => {
11
+ * console.log(`The color mode has changed to ${theme.colorMode}`);
12
+ * }, [theme.colorMode]);
13
+ * ```
14
+ */
15
+ export declare const useThemeObserver: () => Partial<ActiveThemeState>;
@@ -0,0 +1,13 @@
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
+ /**
9
+ * Returns a box shadow formatted for CSS from a ShadowToken raw value.
10
+ *
11
+ * @param rawShadow - ShadowToken raw value
12
+ */
13
+ export declare const getBoxShadow: (rawShadow: ShadowToken<string>['value']) => string;
@@ -0,0 +1,3 @@
1
+ import { ThemeIds, ThemeOverrideIds } from '../theme-config';
2
+ export declare const loadAndAppendThemeCss: (themeId: ThemeIds | ThemeOverrideIds) => Promise<void>;
3
+ export declare const loadThemeCss: (themeId: ThemeIds | ThemeOverrideIds) => Promise<string>;
@@ -0,0 +1,26 @@
1
+ import type { ThemeState } from '../set-global-theme';
2
+ /**
3
+ * Converts a string that is formatted for the `data-theme` HTML attribute
4
+ * to an object that can be passed to `setGlobalTheme`.
5
+ *
6
+ * @param {string} themes The themes that should be applied.
7
+ *
8
+ * @example
9
+ * ```
10
+ * themeStringToObject('dark:dark light:legacy-light spacing:spacing');
11
+ * // returns { dark: 'dark', light: 'legacy-light', spacing: 'spacing' }
12
+ * ```
13
+ */
14
+ export declare const themeStringToObject: (themeState: string) => Partial<ThemeState>;
15
+ /**
16
+ * Converts a theme object to a string formatted for the `data-theme` HTML attribute.
17
+ *
18
+ * @param {object} themes The themes that should be applied.
19
+ *
20
+ * @example
21
+ * ```
22
+ * themeObjectToString({ dark: 'dark', light: 'legacy-light', spacing: 'spacing' });
23
+ * // returns 'dark:dark light:legacy-light spacing:spacing'
24
+ * ```
25
+ */
26
+ export declare const themeObjectToString: (themeState: Partial<ThemeState>) => string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Transforms a style dictionary token path to a CSS custom property.
3
+ *
4
+ * A css prefix will be prepended and all [default] key words will be omitted
5
+ * from the path
6
+ *
7
+ * @example <caption>Passing a path as an array</caption>
8
+ * // Returns ds-background-bold
9
+ * getCSSCustomProperty(['color', 'background', 'bold', '[default]'])
10
+ *
11
+ * @example <caption>Passing a path as a string</caption>
12
+ * // Returns ds-background-bold
13
+ * getCSSCustomProperty('color.background.bold.[default]')
14
+ */
15
+ export declare const getCSSCustomProperty: (path: string | string[]) => string;
16
+ /**
17
+ * Transforms a style dictionary token path to a shorthand token id
18
+ * These ids will be typically be how tokens are interacted with via typescript and css
19
+ *
20
+ * All [default] key words will be omitted from the path
21
+ *
22
+ * @example <caption>Passing a path as an array</caption>
23
+ * // Returns color.background.bold
24
+ * getTokenId(['color', 'background', 'bold', '[default]'])
25
+ *
26
+ * @example <caption>Passing a path as a string</caption>
27
+ * // Returns color.background.bold
28
+ * getTokenId('color.background.bold.[default]')
29
+ */
30
+ export declare const getTokenId: (path: string | string[]) => string;
31
+ /**
32
+ * Transforms a style dictionary token path to a fully qualified token id
33
+ * These Ids are intended to be used internal to this package by style-dictionary
34
+ *
35
+ * [default] key words will NOT be omitted from the path
36
+ *
37
+ * @example <caption>Passing a path as a string</caption>
38
+ * // Returns color.background.bold.[default]
39
+ * getFullyQualifiedTokenId(['color', 'background', 'bold', '[default]'])
40
+ */
41
+ export declare const getFullyQualifiedTokenId: (path: string[]) => string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Create specific rules for ordering tokens based on their root path and subpath.
3
+ */
4
+ export declare const tokenOrder: {
5
+ path: string;
6
+ subpaths: string[];
7
+ }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "author": "Atlassian Pty Ltd",
5
5
  "description": "Design tokens are the single source of truth to name and store design decisions.",
6
6
  "license": "Apache-2.0",
@@ -71,7 +71,7 @@
71
71
  "@atlaskit/checkbox": "^12.6.0",
72
72
  "@atlaskit/code": "^14.6.0",
73
73
  "@atlaskit/docs": "^9.1.0",
74
- "@atlaskit/dropdown-menu": "^11.8.0",
74
+ "@atlaskit/dropdown-menu": "^11.9.0",
75
75
  "@atlaskit/ds-explorations": "^2.1.0",
76
76
  "@atlaskit/dynamic-table": "^14.9.0",
77
77
  "@atlaskit/empty-state": "^7.5.0",