@atlaskit/ds-explorations 2.0.1 → 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 (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/components/box.partial.js +34 -43
  3. package/dist/cjs/components/inline.partial.js +10 -14
  4. package/dist/cjs/components/interaction-surface.partial.js +9 -14
  5. package/dist/cjs/components/stack.partial.js +9 -11
  6. package/dist/cjs/components/surface-provider.js +1 -5
  7. package/dist/cjs/components/text.partial.js +23 -36
  8. package/dist/cjs/index.js +0 -6
  9. package/dist/cjs/internal/color-map.js +2 -3
  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 +12 -11
  14. package/dist/es2019/components/inline.partial.js +3 -4
  15. package/dist/es2019/components/interaction-surface.partial.js +7 -8
  16. package/dist/es2019/components/stack.partial.js +3 -2
  17. package/dist/es2019/components/surface-provider.js +1 -2
  18. package/dist/es2019/components/text.partial.js +10 -14
  19. package/dist/es2019/internal/color-map.js +2 -2
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/components/box.partial.js +37 -37
  22. package/dist/esm/components/inline.partial.js +10 -11
  23. package/dist/esm/components/interaction-surface.partial.js +9 -10
  24. package/dist/esm/components/stack.partial.js +9 -8
  25. package/dist/esm/components/surface-provider.js +1 -2
  26. package/dist/esm/components/text.partial.js +24 -30
  27. package/dist/esm/internal/color-map.js +2 -2
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/box.partial.d.ts +2 -2
  30. package/dist/types/components/text.partial.d.ts +2 -2
  31. package/dist/types/internal/color-map.d.ts +2 -2
  32. package/package.json +2 -2
  33. package/src/components/box.partial.tsx +2 -2
  34. package/src/components/interaction-surface.partial.tsx +2 -2
  35. package/src/components/text.partial.tsx +2 -2
  36. package/src/internal/color-map.tsx +2 -2
@@ -13,7 +13,6 @@ var baseStyles = css({
13
13
  pointerEvents: 'none'
14
14
  }
15
15
  });
16
-
17
16
  /**
18
17
  *
19
18
  * @example
@@ -28,33 +27,32 @@ var baseStyles = css({
28
27
  */
29
28
  var InteractionSurface = function InteractionSurface(_ref) {
30
29
  var appearance = _ref.appearance,
31
- children = _ref.children,
32
- testId = _ref.testId;
30
+ children = _ref.children,
31
+ testId = _ref.testId;
33
32
  var defaultSurface = useContext(SurfaceContext);
34
- var surface = appearance || defaultSurface; // This case will occur if the Box has not set a bg color and the ancestor surface
33
+ var surface = appearance || defaultSurface;
34
+
35
+ // This case will occur if the Box has not set a bg color and the ancestor surface
35
36
  // is an elevation. An alternative would be to throw an error here as it may be better
36
37
  // to ensure correct predictable behaviour based on user specification.
37
-
38
38
  if (!(surface in backgroundActiveColorMap)) {
39
39
  surface = 'neutral';
40
40
  }
41
-
42
41
  return jsx(Fragment, null, jsx("span", {
43
42
  "data-testid": testId,
44
43
  css: [baseStyles, surface && backgroundHoverColorMap[surface], surface && backgroundActiveColorMap[surface]]
45
44
  }), children);
46
45
  };
47
-
48
46
  export default InteractionSurface;
47
+
49
48
  /**
50
49
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
51
- * @codegen <<SignedSource::86378a9df36e53f14f179490e5850418>>
50
+ * @codegen <<SignedSource::4f6bde99739600abea2bbe6e62397bc4>>
52
51
  * @codegenId interactions
53
52
  * @codegenCommand yarn codegen-styles
54
53
  * @codegenParams ["background"]
55
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
54
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
56
55
  */
57
-
58
56
  var backgroundActiveColorMap = {
59
57
  input: css({
60
58
  ':active': {
@@ -269,6 +267,7 @@ var backgroundHoverColorMap = {
269
267
  }
270
268
  })
271
269
  };
270
+
272
271
  /**
273
272
  * @codegenEnd
274
273
  */
@@ -48,6 +48,7 @@ var baseStyles = css({
48
48
  boxSizing: 'border-box',
49
49
  flexDirection: 'column'
50
50
  });
51
+
51
52
  /**
52
53
  * __Stack__
53
54
  *
@@ -55,15 +56,14 @@ var baseStyles = css({
55
56
  * Renders a `div` by default.
56
57
  *
57
58
  */
58
-
59
59
  var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
60
60
  var gap = _ref.gap,
61
- alignItems = _ref.alignItems,
62
- justifyContent = _ref.justifyContent,
63
- flexWrap = _ref.flexWrap,
64
- children = _ref.children,
65
- UNSAFE_style = _ref.UNSAFE_style,
66
- testId = _ref.testId;
61
+ alignItems = _ref.alignItems,
62
+ justifyContent = _ref.justifyContent,
63
+ flexWrap = _ref.flexWrap,
64
+ children = _ref.children,
65
+ UNSAFE_style = _ref.UNSAFE_style,
66
+ testId = _ref.testId;
67
67
  return jsx("div", {
68
68
  style: UNSAFE_style,
69
69
  css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
@@ -73,6 +73,7 @@ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
73
73
  }));
74
74
  Stack.displayName = 'Stack';
75
75
  export default Stack;
76
+
76
77
  /**
77
78
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
78
79
  * @codegen <<SignedSource::91d26b1ace8b38363779ae85a7ddc51b>>
@@ -81,7 +82,6 @@ export default Stack;
81
82
  * @codegenParams ["rowGap"]
82
83
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::b0b8f1a822ed84e0407ad83e6fda5a1c>>
83
84
  */
84
-
85
85
  var rowGapMap = {
86
86
  'space.0': css({
87
87
  rowGap: "var(--ds-space-0, 0px)"
@@ -126,6 +126,7 @@ var rowGapMap = {
126
126
  rowGap: "var(--ds-space-800, 64px)"
127
127
  })
128
128
  };
129
+
129
130
  /**
130
131
  * @codegenEnd
131
132
  */
@@ -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 var SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
8
+
9
9
  /**
10
10
  * __useSurface__
11
11
  *
@@ -13,7 +13,6 @@ export var SurfaceContext = /*#__PURE__*/createContext('elevation.surface');
13
13
  *
14
14
  * @see SurfaceContext
15
15
  */
16
-
17
16
  export var useSurface = function useSurface() {
18
17
  return useContext(SurfaceContext);
19
18
  };
@@ -1,6 +1,5 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  var _excluded = ["children"];
3
-
4
3
  /** @jsx jsx */
5
4
  import { createContext, Fragment, useContext } from 'react';
6
5
  import { css, jsx } from '@emotion/react';
@@ -51,27 +50,26 @@ var truncateStyles = css({
51
50
  textOverflow: 'ellipsis',
52
51
  whiteSpace: 'nowrap'
53
52
  });
53
+
54
54
  /**
55
55
  * 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.
56
56
  */
57
-
58
57
  var useColor = function useColor(colorProp) {
59
58
  var surface = useSurface();
60
59
  var inverseTextColor = surfaceColorMap[surface];
60
+
61
61
  /**
62
62
  * Where the color of the surface is inverted we override the user choice
63
63
  * as there is no valid choice that is not covered by the override.
64
64
  */
65
-
66
65
  var color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
67
66
  return color;
68
67
  };
69
-
70
68
  var HasTextAncestorContext = /*#__PURE__*/createContext(false);
71
-
72
69
  var useHasTextAncestor = function useHasTextAncestor() {
73
70
  return useContext(HasTextAncestorContext);
74
71
  };
72
+
75
73
  /**
76
74
  * __Text__
77
75
  *
@@ -81,51 +79,48 @@ var useHasTextAncestor = function useHasTextAncestor() {
81
79
  *
82
80
  * @internal
83
81
  */
84
-
85
-
86
82
  var Text = function Text(_ref) {
87
83
  var children = _ref.children,
88
- props = _objectWithoutProperties(_ref, _excluded);
89
-
84
+ props = _objectWithoutProperties(_ref, _excluded);
90
85
  var _props$as = props.as,
91
- Component = _props$as === void 0 ? 'span' : _props$as,
92
- colorProp = props.color,
93
- fontSize = props.fontSize,
94
- fontWeight = props.fontWeight,
95
- lineHeight = props.lineHeight,
96
- _props$shouldTruncate = props.shouldTruncate,
97
- shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
98
- textAlign = props.textAlign,
99
- textTransform = props.textTransform,
100
- verticalAlign = props.verticalAlign,
101
- testId = props.testId,
102
- UNSAFE_style = props.UNSAFE_style,
103
- id = props.id;
86
+ Component = _props$as === void 0 ? 'span' : _props$as,
87
+ colorProp = props.color,
88
+ fontSize = props.fontSize,
89
+ fontWeight = props.fontWeight,
90
+ lineHeight = props.lineHeight,
91
+ _props$shouldTruncate = props.shouldTruncate,
92
+ shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
93
+ textAlign = props.textAlign,
94
+ textTransform = props.textTransform,
95
+ verticalAlign = props.verticalAlign,
96
+ testId = props.testId,
97
+ UNSAFE_style = props.UNSAFE_style,
98
+ id = props.id;
104
99
  invariant(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
105
100
  var color = useColor(colorProp);
106
101
  var isWrapped = useHasTextAncestor();
102
+
107
103
  /**
108
104
  * If the text is already wrapped and applies no props we can just
109
105
  * render the children directly as a fragment.
110
106
  */
111
-
112
107
  if (isWrapped && Object.keys(props).length === 0) {
113
108
  return jsx(Fragment, null, children);
114
109
  }
115
-
116
110
  var component = jsx(Component, {
117
111
  style: UNSAFE_style,
118
112
  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]],
119
113
  "data-testid": testId,
120
114
  id: id
121
115
  }, children);
122
- return isWrapped ? // no need to re-apply context if the text is already wrapped
116
+ return isWrapped ?
117
+ // no need to re-apply context if the text is already wrapped
123
118
  component : jsx(HasTextAncestorContext.Provider, {
124
119
  value: true
125
120
  }, component);
126
121
  };
127
-
128
122
  export default Text;
123
+
129
124
  /**
130
125
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
131
126
  * @codegen <<SignedSource::9f746e797b8b5262d58b40dfecb39e6d>>
@@ -134,7 +129,6 @@ export default Text;
134
129
  * @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight"]
135
130
  * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-typography.tsx <<SignedSource::e6bf70c53b8eecdb84ae4c79966537e3>>
136
131
  */
137
-
138
132
  var fontSizeMap = {
139
133
  'size.050': css({
140
134
  fontSize: "var(--ds-font-size-050, 11px)"
@@ -203,18 +197,17 @@ var lineHeightMap = {
203
197
  lineHeight: "var(--ds-font-lineHeight-600, 40px)"
204
198
  })
205
199
  };
206
-
207
200
  /**
208
201
  * @codegenEnd
209
202
  */
210
203
 
211
204
  /**
212
205
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
213
- * @codegen <<SignedSource::ca24871d7a06dd779f21c85960ded8ba>>
206
+ * @codegen <<SignedSource::3780858df77f5fe0c6e0f39a4c989741>>
214
207
  * @codegenId colors
215
208
  * @codegenCommand yarn codegen-styles
216
209
  * @codegenParams ["text"]
217
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
210
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
218
211
  */
219
212
  var textColorMap = {
220
213
  'color.text': css({
@@ -257,6 +250,7 @@ var textColorMap = {
257
250
  color: "var(--ds-text-subtle, #42526E)"
258
251
  })
259
252
  };
253
+
260
254
  /**
261
255
  * @codegenEnd
262
256
  */
@@ -3,9 +3,9 @@
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::2ca647ee8f34f9282287118d86be4585>>
6
+ * @codegen <<SignedSource::d168519874a16bbb92cfbfd4747a39b4>>
7
7
  * @codegenCommand yarn codegen-styles
8
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
8
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
9
9
  */
10
10
  export default {
11
11
  'neutral.bold': 'inverse',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -284,11 +284,11 @@ export declare type PaddingInline = keyof typeof paddingInlineMap;
284
284
  */
285
285
  /**
286
286
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
287
- * @codegen <<SignedSource::04c05379e7c6ad157383d5f77e66911a>>
287
+ * @codegen <<SignedSource::514663609a5a48a284de40c5c4ad200b>>
288
288
  * @codegenId colors
289
289
  * @codegenCommand yarn codegen-styles
290
290
  * @codegenParams ["border", "background", "shadow"]
291
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
291
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
292
292
  */
293
293
  declare const borderColorMap: {
294
294
  readonly 'color.border': import("@emotion/react").SerializedStyles;
@@ -124,11 +124,11 @@ export declare type LineHeight = keyof typeof lineHeightMap;
124
124
  */
125
125
  /**
126
126
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
127
- * @codegen <<SignedSource::ca24871d7a06dd779f21c85960ded8ba>>
127
+ * @codegen <<SignedSource::3780858df77f5fe0c6e0f39a4c989741>>
128
128
  * @codegenId colors
129
129
  * @codegenCommand yarn codegen-styles
130
130
  * @codegenParams ["text"]
131
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
131
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
132
132
  */
133
133
  declare const textColorMap: {
134
134
  readonly 'color.text': import("@emotion/react").SerializedStyles;
@@ -29,8 +29,8 @@ declare const _default: {
29
29
  *
30
30
  * The color map is used to map a background color token to a matching text color that will meet contrast.
31
31
  *
32
- * @codegen <<SignedSource::2ca647ee8f34f9282287118d86be4585>>
32
+ * @codegen <<SignedSource::d168519874a16bbb92cfbfd4747a39b4>>
33
33
  * @codegenCommand yarn codegen-styles
34
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
34
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
35
35
  */
36
36
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "An experimental package for exploration and validation of spacing / typography foundations.",
5
5
  "license": "Apache-2.0",
6
6
  "atlassian": {
@@ -39,7 +39,7 @@
39
39
  "./inline": "./src/components/inline.partial.tsx"
40
40
  },
41
41
  "dependencies": {
42
- "@atlaskit/tokens": "^0.13.0",
42
+ "@atlaskit/tokens": "^1.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
45
45
  "tiny-invariant": "^1.2.0"
@@ -503,11 +503,11 @@ export type PaddingInline = keyof typeof paddingInlineMap;
503
503
 
504
504
  /**
505
505
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
506
- * @codegen <<SignedSource::04c05379e7c6ad157383d5f77e66911a>>
506
+ * @codegen <<SignedSource::514663609a5a48a284de40c5c4ad200b>>
507
507
  * @codegenId colors
508
508
  * @codegenCommand yarn codegen-styles
509
509
  * @codegenParams ["border", "background", "shadow"]
510
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
510
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
511
511
  */
512
512
  const borderColorMap = {
513
513
  'color.border': css({
@@ -70,11 +70,11 @@ export default InteractionSurface;
70
70
 
71
71
  /**
72
72
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
73
- * @codegen <<SignedSource::86378a9df36e53f14f179490e5850418>>
73
+ * @codegen <<SignedSource::4f6bde99739600abea2bbe6e62397bc4>>
74
74
  * @codegenId interactions
75
75
  * @codegenCommand yarn codegen-styles
76
76
  * @codegenParams ["background"]
77
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
77
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
78
78
  */
79
79
  const backgroundActiveColorMap = {
80
80
  input: css({
@@ -287,11 +287,11 @@ export type LineHeight = keyof typeof lineHeightMap;
287
287
 
288
288
  /**
289
289
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
290
- * @codegen <<SignedSource::ca24871d7a06dd779f21c85960ded8ba>>
290
+ * @codegen <<SignedSource::3780858df77f5fe0c6e0f39a4c989741>>
291
291
  * @codegenId colors
292
292
  * @codegenCommand yarn codegen-styles
293
293
  * @codegenParams ["text"]
294
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
294
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
295
295
  */
296
296
  const textColorMap = {
297
297
  'color.text': css({
@@ -3,9 +3,9 @@
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::2ca647ee8f34f9282287118d86be4585>>
6
+ * @codegen <<SignedSource::d168519874a16bbb92cfbfd4747a39b4>>
7
7
  * @codegenCommand yarn codegen-styles
8
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::e348c7cd343cf53ff944fdb7023c577a>>
8
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::10aa7e87eca39e4d6594a764e78e0698>>
9
9
  */
10
10
  export default {
11
11
  'neutral.bold': 'inverse',