@atlaskit/tokens 11.1.1 → 11.2.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 (49) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/codemods/hypermod.config.tsx +3 -0
  3. package/codemods/remove-fallbacks/transform.tsx +24 -0
  4. package/dist/cjs/artifacts/palettes-raw/motion-palette.js +414 -63
  5. package/dist/cjs/artifacts/replacement-mapping.js +51 -3
  6. package/dist/cjs/artifacts/themes/atlassian-motion.js +2 -2
  7. package/dist/cjs/artifacts/token-default-values.js +25 -9
  8. package/dist/cjs/artifacts/token-names.js +19 -3
  9. package/dist/cjs/artifacts/tokens-raw/atlassian-motion.js +527 -47
  10. package/dist/cjs/entry-points/token-metadata.codegen.js +2342 -470
  11. package/dist/cjs/utils/token-usage-guidelines.js +117 -0
  12. package/dist/es2019/artifacts/palettes-raw/motion-palette.js +414 -63
  13. package/dist/es2019/artifacts/replacement-mapping.js +51 -3
  14. package/dist/es2019/artifacts/themes/atlassian-motion.js +119 -15
  15. package/dist/es2019/artifacts/token-default-values.js +25 -9
  16. package/dist/es2019/artifacts/token-names.js +19 -3
  17. package/dist/es2019/artifacts/tokens-raw/atlassian-motion.js +527 -47
  18. package/dist/es2019/entry-points/token-metadata.codegen.js +2342 -470
  19. package/dist/es2019/utils/token-usage-guidelines.js +109 -0
  20. package/dist/esm/artifacts/palettes-raw/motion-palette.js +414 -63
  21. package/dist/esm/artifacts/replacement-mapping.js +51 -3
  22. package/dist/esm/artifacts/themes/atlassian-motion.js +2 -2
  23. package/dist/esm/artifacts/token-default-values.js +25 -9
  24. package/dist/esm/artifacts/token-names.js +19 -3
  25. package/dist/esm/artifacts/tokens-raw/atlassian-motion.js +527 -47
  26. package/dist/esm/entry-points/token-metadata.codegen.js +2342 -470
  27. package/dist/esm/utils/token-usage-guidelines.js +111 -0
  28. package/dist/types/artifacts/palettes-raw/motion-palette.d.ts +5 -3
  29. package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
  30. package/dist/types/artifacts/themes/atlassian-motion.d.ts +2 -2
  31. package/dist/types/artifacts/token-default-values.d.ts +25 -9
  32. package/dist/types/artifacts/token-names.d.ts +37 -5
  33. package/dist/types/artifacts/tokens-raw/atlassian-motion.d.ts +5 -3
  34. package/dist/types/entry-points/css-type-schema.codegen.d.ts +2 -2
  35. package/dist/types/entry-points/token-metadata.codegen.d.ts +6 -2
  36. package/dist/types/types.d.ts +31 -2
  37. package/dist/types/utils/token-usage-guidelines.d.ts +8 -0
  38. package/dist/types-ts4.5/artifacts/palettes-raw/motion-palette.d.ts +5 -3
  39. package/dist/types-ts4.5/artifacts/replacement-mapping.d.ts +1 -1
  40. package/dist/types-ts4.5/artifacts/themes/atlassian-motion.d.ts +2 -2
  41. package/dist/types-ts4.5/artifacts/token-default-values.d.ts +25 -9
  42. package/dist/types-ts4.5/artifacts/token-names.d.ts +37 -5
  43. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-motion.d.ts +5 -3
  44. package/dist/types-ts4.5/entry-points/css-type-schema.codegen.d.ts +2 -2
  45. package/dist/types-ts4.5/entry-points/token-metadata.codegen.d.ts +6 -2
  46. package/dist/types-ts4.5/types.d.ts +31 -2
  47. package/dist/types-ts4.5/utils/token-usage-guidelines.d.ts +8 -0
  48. package/package.json +9 -8
  49. package/tokens.docs.tsx +52 -0
@@ -0,0 +1,109 @@
1
+ export const getTokenUsageGuidelines = tokenId => {
2
+ const tokenTypes = Object.keys(usageMappings);
3
+ const foundType = tokenTypes.find(type => tokenId.startsWith(type));
4
+ if (foundType && usageMappings[foundType]) {
5
+ return usageMappings[foundType];
6
+ }
7
+ return {
8
+ usage: '',
9
+ cssProperties: []
10
+ }; // Fallback if tokenId doesn't match any token type
11
+ };
12
+ const usageMappings = {
13
+ 'color.text': {
14
+ usage: 'The color for standard text. Use for primary, readable text in most user interface situations (e.g. color.text, color.text.subtle)',
15
+ cssProperties: ['color']
16
+ },
17
+ 'color.link': {
18
+ usage: 'The color for hyperlinks. Use for elements that are links to external resources or navigation (e.g. color.link)',
19
+ cssProperties: ['color']
20
+ },
21
+ 'color.icon': {
22
+ usage: 'The color for icons. Use for graphical icon elements (e.g. color.icon.brand)',
23
+ cssProperties: ['color', 'fill', 'stroke']
24
+ },
25
+ 'color.border': {
26
+ usage: 'The color for borders or outlines. Use for border and outline colors on components (e.g. color.border, color.border.focused)',
27
+ cssProperties: ['border-color', 'outline-color']
28
+ },
29
+ 'color.background': {
30
+ usage: 'The color for backgrounds. Use for areas behind content (e.g. color.background.neutral, color.background.selected)',
31
+ cssProperties: ['background-color']
32
+ },
33
+ 'color.blanket': {
34
+ usage: 'The color for overlay "blankets" such as modals/dimmers/overlays (e.g. color.blanket)',
35
+ cssProperties: ['background-color']
36
+ },
37
+ 'color.interaction': {
38
+ usage: 'Transparent interaction states for use over elements when their background color cannot change, such as images and avatars.',
39
+ cssProperties: ['background-color', 'border-color']
40
+ },
41
+ 'color.skeleton': {
42
+ usage: 'The color for skeleton/loading placeholders (e.g. color.skeleton)',
43
+ cssProperties: ['background-color']
44
+ },
45
+ 'color.chart': {
46
+ usage: 'The color for chart and data visualization elements (e.g. color.chart)',
47
+ cssProperties: ['fill', 'stroke', 'background-color', 'color']
48
+ },
49
+ 'elevation.surface': {
50
+ usage: 'The base color for app and component surfaces. Raised and overlay surfaces should be used in concert with shadows (e.g. elevation.surface.raised should be used with elevation.shadow.raised)',
51
+ cssProperties: ['background-color']
52
+ },
53
+ 'elevation.shadow': {
54
+ usage: 'Shadows for showing depth and elevation (e.g. elevation.shadow.raised, elevation.shadow.overlay). Use via the box-shadow property to indicate layer hierarchy',
55
+ cssProperties: ['box-shadow']
56
+ },
57
+ opacity: {
58
+ usage: 'Controls the transparency of an element (e.g. opacity.disabled, opacity.loading). Used for communication of loading and disabled states',
59
+ cssProperties: ['opacity']
60
+ },
61
+ utility: {
62
+ usage: 'Code-specific tokens to aid with migration or enable features such as automatic elevation detection',
63
+ cssProperties: []
64
+ },
65
+ space: {
66
+ usage: 'Spacing tokens define the distance, alignment, and layout positioning (e.g. space.100, space.200, space.050). Use for margin, padding, gap, and layout positioning such as top, left, etc',
67
+ cssProperties: ['padding', 'margin', 'gap', 'top', 'left', 'right', 'bottom', 'inset']
68
+ },
69
+ 'font.heading': {
70
+ usage: 'A composite token that applies complete font-related properties for headings (e.g. font.heading.xlarge). Includes font size, weight, line height, and family',
71
+ cssProperties: ['font']
72
+ },
73
+ 'font.body': {
74
+ usage: 'A composite token that applies all font properties for standard body text (e.g. font.body)',
75
+ cssProperties: ['font']
76
+ },
77
+ 'font.metric': {
78
+ usage: 'Font settings for displaying numbers or metrics, ensuring legibility and alignment (e.g. font.metric)',
79
+ cssProperties: ['font']
80
+ },
81
+ 'font.code': {
82
+ usage: 'Font settings for inline code and code blocks, enforcing monospace font and sizing (e.g. font.code)',
83
+ cssProperties: ['font', 'font-family', 'font-size', 'font-weight', 'line-height']
84
+ },
85
+ 'font.weight': {
86
+ usage: 'Granular control of font weight (e.g. font.weight.regular, font.weight.semibold). Use only to override the default font tokens for custom typography components beyond what’s supported by Text, MetricText and Heading',
87
+ cssProperties: ['font-weight']
88
+ },
89
+ 'font.family': {
90
+ usage: 'Granular control of font family (e.g. font.family.body). Use only when overriding the default in composites',
91
+ cssProperties: ['font-family']
92
+ },
93
+ 'font.lineHeight': {
94
+ usage: 'Granular control of font line height (e.g. font.lineHeight.100). Use only when overriding the default in composites',
95
+ cssProperties: ['line-height']
96
+ },
97
+ radius: {
98
+ usage: 'Controls the rounding of element corners, often for containers (e.g. radius.medium, radius.circle)',
99
+ cssProperties: ['border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-left-radius', 'border-bottom-right-radius']
100
+ },
101
+ 'border.width': {
102
+ usage: 'Controls the thickness of borders/dividers (e.g. border.width, border.width.selected). Use to standardize border widths throughout UI',
103
+ cssProperties: ['border-width']
104
+ }
105
+ };
106
+
107
+ /**
108
+ * Types of tokens. Using path.subpath notation.
109
+ */