@atlaskit/ds-explorations 2.0.0 → 2.0.2

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/components/box.partial.js +62 -71
  3. package/dist/cjs/components/inline.partial.js +12 -16
  4. package/dist/cjs/components/interaction-surface.partial.js +35 -40
  5. package/dist/cjs/components/stack.partial.js +11 -13
  6. package/dist/cjs/components/surface-provider.js +1 -5
  7. package/dist/cjs/components/text.partial.js +34 -47
  8. package/dist/cjs/index.js +0 -6
  9. package/dist/cjs/internal/color-map.js +5 -6
  10. package/dist/cjs/internal/role-to-element.js +0 -1
  11. package/dist/cjs/internal/spacing-scale.js +0 -1
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/components/box.partial.js +40 -39
  14. package/dist/es2019/components/inline.partial.js +5 -6
  15. package/dist/es2019/components/interaction-surface.partial.js +33 -34
  16. package/dist/es2019/components/stack.partial.js +5 -4
  17. package/dist/es2019/components/surface-provider.js +1 -2
  18. package/dist/es2019/components/text.partial.js +21 -25
  19. package/dist/es2019/internal/color-map.js +5 -5
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/components/box.partial.js +65 -65
  22. package/dist/esm/components/inline.partial.js +12 -13
  23. package/dist/esm/components/interaction-surface.partial.js +35 -36
  24. package/dist/esm/components/stack.partial.js +11 -10
  25. package/dist/esm/components/surface-provider.js +1 -2
  26. package/dist/esm/components/text.partial.js +35 -41
  27. package/dist/esm/internal/color-map.js +5 -5
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/box.partial.d.ts +14 -14
  30. package/dist/types/components/inline.partial.d.ts +2 -2
  31. package/dist/types/components/interaction-surface.partial.d.ts +3 -3
  32. package/dist/types/components/stack.partial.d.ts +2 -2
  33. package/dist/types/components/surface-provider.d.ts +2 -2
  34. package/dist/types/components/text.partial.d.ts +7 -7
  35. package/dist/types/internal/color-map.d.ts +5 -5
  36. package/package.json +2 -2
  37. package/report.api.md +16 -16
  38. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +49 -49
  39. package/src/components/box.partial.tsx +33 -33
  40. package/src/components/inline.partial.tsx +2 -2
  41. package/src/components/interaction-surface.partial.tsx +22 -22
  42. package/src/components/stack.partial.tsx +2 -2
  43. package/src/components/text.partial.tsx +13 -13
  44. package/src/internal/color-map.tsx +5 -5
  45. package/tmp/api-report-tmp.d.ts +16 -16
@@ -13,7 +13,6 @@ const baseStyles = css({
13
13
  pointerEvents: 'none'
14
14
  }
15
15
  });
16
-
17
16
  /**
18
17
  *
19
18
  * @example
@@ -32,39 +31,38 @@ const InteractionSurface = ({
32
31
  testId
33
32
  }) => {
34
33
  const defaultSurface = useContext(SurfaceContext);
35
- let surface = appearance || defaultSurface; // This case will occur if the Box has not set a bg color and the ancestor surface
34
+ let surface = appearance || defaultSurface;
35
+
36
+ // This case will occur if the Box has not set a bg color and the ancestor surface
36
37
  // is an elevation. An alternative would be to throw an error here as it may be better
37
38
  // to ensure correct predictable behaviour based on user specification.
38
-
39
39
  if (!(surface in backgroundActiveColorMap)) {
40
40
  surface = 'neutral';
41
41
  }
42
-
43
42
  return jsx(Fragment, null, jsx("span", {
44
43
  "data-testid": testId,
45
44
  css: [baseStyles, surface && backgroundHoverColorMap[surface], surface && backgroundActiveColorMap[surface]]
46
45
  }), children);
47
46
  };
48
-
49
47
  export default InteractionSurface;
48
+
50
49
  /**
51
50
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
52
- * @codegen <<SignedSource::46f9477bc75d77a16327328d1b49c35f>>
51
+ * @codegen <<SignedSource::4f6bde99739600abea2bbe6e62397bc4>>
53
52
  * @codegenId interactions
54
53
  * @codegenCommand yarn codegen-styles
55
54
  * @codegenParams ["background"]
56
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::db7a1282630a6e5b9424b807614086af>>
55
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
57
56
  */
58
-
59
57
  const backgroundActiveColorMap = {
60
- 'inverse.subtle': css({
58
+ input: css({
61
59
  ':active': {
62
- backgroundColor: "var(--ds-background-inverse-subtle-pressed, #00000052)"
60
+ backgroundColor: "var(--ds-background-input-pressed, #FFFFFF)"
63
61
  }
64
62
  }),
65
- input: css({
63
+ 'inverse.subtle': css({
66
64
  ':active': {
67
- backgroundColor: "var(--ds-background-input-pressed, #FFFFFF)"
65
+ backgroundColor: "var(--ds-background-inverse-subtle-pressed, #00000052)"
68
66
  }
69
67
  }),
70
68
  neutral: css({
@@ -82,11 +80,6 @@ const backgroundActiveColorMap = {
82
80
  backgroundColor: "var(--ds-background-neutral-bold-pressed, #172B4D)"
83
81
  }
84
82
  }),
85
- 'brand.bold': css({
86
- ':active': {
87
- backgroundColor: "var(--ds-background-brand-bold-pressed, #09326C)"
88
- }
89
- }),
90
83
  selected: css({
91
84
  ':active': {
92
85
  backgroundColor: "var(--ds-background-selected-pressed, #85B8FF)"
@@ -97,6 +90,11 @@ const backgroundActiveColorMap = {
97
90
  backgroundColor: "var(--ds-background-selected-bold-pressed, #09326C)"
98
91
  }
99
92
  }),
93
+ 'brand.bold': css({
94
+ ':active': {
95
+ backgroundColor: "var(--ds-background-brand-bold-pressed, #09326C)"
96
+ }
97
+ }),
100
98
  danger: css({
101
99
  ':active': {
102
100
  backgroundColor: "var(--ds-background-danger-pressed, #FF9C8F)"
@@ -152,26 +150,26 @@ const backgroundActiveColorMap = {
152
150
  backgroundColor: "var(--ds-surface-pressed, #DCDFE4)"
153
151
  }
154
152
  }),
155
- 'elevation.surface.raised': css({
153
+ 'elevation.surface.overlay': css({
156
154
  ':active': {
157
- backgroundColor: "var(--ds-surface-raised-pressed, #DCDFE4)"
155
+ backgroundColor: "var(--ds-surface-overlay-pressed, #DCDFE4)"
158
156
  }
159
157
  }),
160
- 'elevation.surface.overlay': css({
158
+ 'elevation.surface.raised': css({
161
159
  ':active': {
162
- backgroundColor: "var(--ds-surface-overlay-pressed, #DCDFE4)"
160
+ backgroundColor: "var(--ds-surface-raised-pressed, #DCDFE4)"
163
161
  }
164
162
  })
165
163
  };
166
164
  const backgroundHoverColorMap = {
167
- 'inverse.subtle': css({
165
+ input: css({
168
166
  ':hover': {
169
- backgroundColor: "var(--ds-background-inverse-subtle-hovered, #0000003D)"
167
+ backgroundColor: "var(--ds-background-input-hovered, #F7F8F9)"
170
168
  }
171
169
  }),
172
- input: css({
170
+ 'inverse.subtle': css({
173
171
  ':hover': {
174
- backgroundColor: "var(--ds-background-input-hovered, #F7F8F9)"
172
+ backgroundColor: "var(--ds-background-inverse-subtle-hovered, #0000003D)"
175
173
  }
176
174
  }),
177
175
  neutral: css({
@@ -189,11 +187,6 @@ const backgroundHoverColorMap = {
189
187
  backgroundColor: "var(--ds-background-neutral-bold-hovered, #2C3E5D)"
190
188
  }
191
189
  }),
192
- 'brand.bold': css({
193
- ':hover': {
194
- backgroundColor: "var(--ds-background-brand-bold-hovered, #0055CC)"
195
- }
196
- }),
197
190
  selected: css({
198
191
  ':hover': {
199
192
  backgroundColor: "var(--ds-background-selected-hovered, #CCE0FF)"
@@ -204,6 +197,11 @@ const backgroundHoverColorMap = {
204
197
  backgroundColor: "var(--ds-background-selected-bold-hovered, #0055CC)"
205
198
  }
206
199
  }),
200
+ 'brand.bold': css({
201
+ ':hover': {
202
+ backgroundColor: "var(--ds-background-brand-bold-hovered, #0055CC)"
203
+ }
204
+ }),
207
205
  danger: css({
208
206
  ':hover': {
209
207
  backgroundColor: "var(--ds-background-danger-hovered, #FFD2CC)"
@@ -259,17 +257,18 @@ const backgroundHoverColorMap = {
259
257
  backgroundColor: "var(--ds-surface-hovered, #F1F2F4)"
260
258
  }
261
259
  }),
262
- 'elevation.surface.raised': css({
260
+ 'elevation.surface.overlay': css({
263
261
  ':hover': {
264
- backgroundColor: "var(--ds-surface-raised-hovered, #F1F2F4)"
262
+ backgroundColor: "var(--ds-surface-overlay-hovered, #F1F2F4)"
265
263
  }
266
264
  }),
267
- 'elevation.surface.overlay': css({
265
+ 'elevation.surface.raised': css({
268
266
  ':hover': {
269
- backgroundColor: "var(--ds-surface-overlay-hovered, #F1F2F4)"
267
+ backgroundColor: "var(--ds-surface-raised-hovered, #F1F2F4)"
270
268
  }
271
269
  })
272
270
  };
271
+
273
272
  /**
274
273
  * @codegenEnd
275
274
  */
@@ -48,6 +48,7 @@ const baseStyles = css({
48
48
  boxSizing: 'border-box',
49
49
  flexDirection: 'column'
50
50
  });
51
+
51
52
  /**
52
53
  * __Stack__
53
54
  *
@@ -55,7 +56,6 @@ const baseStyles = css({
55
56
  * Renders a `div` by default.
56
57
  *
57
58
  */
58
-
59
59
  const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
60
60
  gap,
61
61
  alignItems,
@@ -74,15 +74,15 @@ const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
74
74
  }));
75
75
  Stack.displayName = 'Stack';
76
76
  export default Stack;
77
+
77
78
  /**
78
79
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
79
- * @codegen <<SignedSource::ac9028ae231558f3eedd10f0db04a8fe>>
80
+ * @codegen <<SignedSource::91d26b1ace8b38363779ae85a7ddc51b>>
80
81
  * @codegenId spacing
81
82
  * @codegenCommand yarn codegen-styles
82
83
  * @codegenParams ["rowGap"]
83
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::a2b43f8447798dfdd9c6223bd22b78c7>>
84
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::b0b8f1a822ed84e0407ad83e6fda5a1c>>
84
85
  */
85
-
86
86
  const rowGapMap = {
87
87
  'space.0': css({
88
88
  rowGap: "var(--ds-space-0, 0px)"
@@ -127,6 +127,7 @@ const rowGapMap = {
127
127
  rowGap: "var(--ds-space-800, 64px)"
128
128
  })
129
129
  };
130
+
130
131
  /**
131
132
  * @codegenEnd
132
133
  */
@@ -1,11 +1,11 @@
1
1
  import { createContext, useContext } from 'react';
2
-
3
2
  /**
4
3
  * __Surface context__
5
4
  *
6
5
  * A surface context provides context information on the current background (if set).
7
6
  */
8
7
  export const SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
8
+
9
9
  /**
10
10
  * __useSurface__
11
11
  *
@@ -13,7 +13,6 @@ export const SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
13
13
  *
14
14
  * @see SurfaceContext
15
15
  */
16
-
17
16
  export const useSurface = () => {
18
17
  return useContext(SurfaceContext);
19
18
  };
@@ -48,25 +48,24 @@ const truncateStyles = css({
48
48
  textOverflow: 'ellipsis',
49
49
  whiteSpace: 'nowrap'
50
50
  });
51
+
51
52
  /**
52
53
  * Custom hook designed to abstract the parsing of the color props and make it clearer in the future how color is reconciled between themes and tokens.
53
54
  */
54
-
55
55
  const useColor = colorProp => {
56
56
  const surface = useSurface();
57
57
  const inverseTextColor = surfaceColorMap[surface];
58
+
58
59
  /**
59
60
  * Where the color of the surface is inverted we override the user choice
60
61
  * as there is no valid choice that is not covered by the override.
61
62
  */
62
-
63
63
  const color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
64
64
  return color;
65
65
  };
66
-
67
66
  const HasTextAncestorContext = /*#__PURE__*/createContext(false);
68
-
69
67
  const useHasTextAncestor = () => useContext(HasTextAncestorContext);
68
+
70
69
  /**
71
70
  * __Text__
72
71
  *
@@ -76,8 +75,6 @@ const useHasTextAncestor = () => useContext(HasTextAncestorContext);
76
75
  *
77
76
  * @internal
78
77
  */
79
-
80
-
81
78
  const Text = ({
82
79
  children,
83
80
  ...props
@@ -99,37 +96,36 @@ const Text = ({
99
96
  invariant(asAllowlist.includes(Component), `@atlaskit/ds-explorations: Text received an invalid "as" value of "${Component}"`);
100
97
  const color = useColor(colorProp);
101
98
  const isWrapped = useHasTextAncestor();
99
+
102
100
  /**
103
101
  * If the text is already wrapped and applies no props we can just
104
102
  * render the children directly as a fragment.
105
103
  */
106
-
107
104
  if (isWrapped && Object.keys(props).length === 0) {
108
105
  return jsx(Fragment, null, children);
109
106
  }
110
-
111
107
  const component = jsx(Component, {
112
108
  style: UNSAFE_style,
113
109
  css: [baseStyles, fontFamilyMap.sans, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign], textTransform && textTransformMap[textTransform], verticalAlign && verticalAlignMap[verticalAlign]],
114
110
  "data-testid": testId,
115
111
  id: id
116
112
  }, children);
117
- return isWrapped ? // no need to re-apply context if the text is already wrapped
113
+ return isWrapped ?
114
+ // no need to re-apply context if the text is already wrapped
118
115
  component : jsx(HasTextAncestorContext.Provider, {
119
116
  value: true
120
117
  }, component);
121
118
  };
122
-
123
119
  export default Text;
120
+
124
121
  /**
125
122
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
126
- * @codegen <<SignedSource::bd36caff8bedb3bdc89b6f2311c6160a>>
123
+ * @codegen <<SignedSource::9f746e797b8b5262d58b40dfecb39e6d>>
127
124
  * @codegenId typography
128
125
  * @codegenCommand yarn codegen-styles
129
126
  * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
130
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::39bc8db0f376f5635a25be0137792642>>
127
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::e6bf70c53b8eecdb84ae4c79966537e3>>
131
128
  */
132
-
133
129
  const fontSizeMap = {
134
130
  'size.050': css({
135
131
  fontSize: "var(--ds-font-size-050, 11px)"
@@ -198,41 +194,34 @@ const lineHeightMap = {
198
194
  lineHeight: "var(--ds-font-lineHeight-600, 40px)"
199
195
  })
200
196
  };
201
-
202
197
  /**
203
198
  * @codegenEnd
204
199
  */
205
200
 
206
201
  /**
207
202
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
208
- * @codegen <<SignedSource::d88a2527302fee634bec7ae405e9217b>>
203
+ * @codegen <<SignedSource::3780858df77f5fe0c6e0f39a4c989741>>
209
204
  * @codegenId colors
210
205
  * @codegenCommand yarn codegen-styles
211
206
  * @codegenParams ["text"]
212
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::db7a1282630a6e5b9424b807614086af>>
207
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
213
208
  */
214
209
  const textColorMap = {
215
210
  'color.text': css({
216
211
  color: "var(--ds-text, #172B4D)"
217
212
  }),
218
- subtle: css({
219
- color: "var(--ds-text-subtle, #42526E)"
220
- }),
221
- subtlest: css({
222
- color: "var(--ds-text-subtlest, #7A869A)"
223
- }),
224
213
  disabled: css({
225
214
  color: "var(--ds-text-disabled, #A5ADBA)"
226
215
  }),
227
216
  inverse: css({
228
217
  color: "var(--ds-text-inverse, #FFFFFF)"
229
218
  }),
230
- brand: css({
231
- color: "var(--ds-text-brand, #0065FF)"
232
- }),
233
219
  selected: css({
234
220
  color: "var(--ds-text-selected, #0052CC)"
235
221
  }),
222
+ brand: css({
223
+ color: "var(--ds-text-brand, #0065FF)"
224
+ }),
236
225
  danger: css({
237
226
  color: "var(--ds-text-danger, #DE350B)"
238
227
  }),
@@ -250,8 +239,15 @@ const textColorMap = {
250
239
  }),
251
240
  information: css({
252
241
  color: "var(--ds-text-information, #0052CC)"
242
+ }),
243
+ subtlest: css({
244
+ color: "var(--ds-text-subtlest, #7A869A)"
245
+ }),
246
+ subtle: css({
247
+ color: "var(--ds-text-subtle, #42526E)"
253
248
  })
254
249
  };
250
+
255
251
  /**
256
252
  * @codegenEnd
257
253
  */
@@ -3,20 +3,20 @@
3
3
  *
4
4
  * The color map is used to map a background color token to a matching text color that will meet contrast.
5
5
  *
6
- * @codegen <<SignedSource::55412dc750db330e0a2a51918237e29f>>
6
+ * @codegen <<SignedSource::d168519874a16bbb92cfbfd4747a39b4>>
7
7
  * @codegenCommand yarn codegen-styles
8
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::db7a1282630a6e5b9424b807614086af>>
8
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
9
9
  */
10
10
  export default {
11
11
  'neutral.bold': 'inverse',
12
12
  'neutral.bold.hovered': 'inverse',
13
13
  'neutral.bold.pressed': 'inverse',
14
- 'brand.bold': 'inverse',
15
- 'brand.bold.hovered': 'inverse',
16
- 'brand.bold.pressed': 'inverse',
17
14
  'selected.bold': 'inverse',
18
15
  'selected.bold.hovered': 'inverse',
19
16
  'selected.bold.pressed': 'inverse',
17
+ 'brand.bold': 'inverse',
18
+ 'brand.bold.hovered': 'inverse',
19
+ 'brand.bold.pressed': 'inverse',
20
20
  'danger.bold': 'inverse',
21
21
  'danger.bold.hovered': 'inverse',
22
22
  'danger.bold.pressed': 'inverse',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "sideEffects": false
5
5
  }