@atlaskit/ds-explorations 0.1.5 → 1.0.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 (98) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/box/package.json +15 -0
  3. package/dist/cjs/components/box.partial.js +182 -205
  4. package/dist/cjs/components/inline.partial.js +28 -34
  5. package/dist/cjs/components/interaction-surface.partial.js +32 -1
  6. package/dist/cjs/components/stack.partial.js +28 -36
  7. package/dist/cjs/components/text.partial.js +114 -85
  8. package/dist/cjs/index.js +1 -9
  9. package/dist/cjs/internal/color-map.js +6 -5
  10. package/dist/cjs/internal/spacing-scale.js +17 -0
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/components/box.partial.js +181 -189
  13. package/dist/es2019/components/inline.partial.js +27 -28
  14. package/dist/es2019/components/interaction-surface.partial.js +32 -1
  15. package/dist/es2019/components/stack.partial.js +27 -28
  16. package/dist/es2019/components/text.partial.js +71 -35
  17. package/dist/es2019/index.js +1 -2
  18. package/dist/es2019/internal/color-map.js +4 -3
  19. package/dist/es2019/internal/spacing-scale.js +9 -0
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/components/box.partial.js +181 -201
  22. package/dist/esm/components/inline.partial.js +27 -33
  23. package/dist/esm/components/interaction-surface.partial.js +32 -1
  24. package/dist/esm/components/stack.partial.js +27 -33
  25. package/dist/esm/components/text.partial.js +76 -46
  26. package/dist/esm/index.js +1 -2
  27. package/dist/esm/internal/color-map.js +4 -3
  28. package/dist/esm/internal/spacing-scale.js +9 -0
  29. package/dist/esm/version.json +1 -1
  30. package/dist/types/components/box.partial.d.ts +109 -21
  31. package/dist/types/components/inline.partial.d.ts +25 -3
  32. package/dist/types/components/interaction-surface.partial.d.ts +3 -0
  33. package/dist/types/components/stack.partial.d.ts +24 -2
  34. package/dist/types/components/text.partial.d.ts +5 -3
  35. package/dist/types/index.d.ts +0 -1
  36. package/dist/types/internal/color-map.d.ts +11 -9
  37. package/dist/types/internal/spacing-scale.d.ts +9 -0
  38. package/dist/types-ts4.0/components/box.partial.d.ts +109 -27
  39. package/dist/types-ts4.0/components/inline.partial.d.ts +25 -3
  40. package/dist/types-ts4.0/components/interaction-surface.partial.d.ts +3 -0
  41. package/dist/types-ts4.0/components/stack.partial.d.ts +24 -2
  42. package/dist/types-ts4.0/components/text.partial.d.ts +5 -6
  43. package/dist/types-ts4.0/index.d.ts +0 -1
  44. package/dist/types-ts4.0/internal/color-map.d.ts +11 -9
  45. package/dist/types-ts4.0/internal/spacing-scale.d.ts +22 -0
  46. package/examples/00-basic.tsx +4 -4
  47. package/examples/01-box.tsx +29 -46
  48. package/examples/02-text-advanced.tsx +38 -0
  49. package/examples/02-text.tsx +72 -62
  50. package/examples/03-stack.tsx +36 -75
  51. package/examples/04-inline.tsx +34 -76
  52. package/examples/05-badge.tsx +2 -2
  53. package/examples/06-section-message.tsx +7 -7
  54. package/examples/07-comment.tsx +4 -6
  55. package/examples/08-lozenge.tsx +9 -5
  56. package/examples/99-interactions.tsx +20 -20
  57. package/examples/config.jsonc +11 -0
  58. package/package.json +5 -2
  59. package/report.api.md +187 -48
  60. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +52 -64
  61. package/scripts/codegen-styles.tsx +34 -6
  62. package/scripts/color-codegen-template.tsx +10 -15
  63. package/scripts/color-map-template.tsx +1 -1
  64. package/scripts/spacing-codegen-template.tsx +42 -12
  65. package/scripts/spacing-scale-template.tsx +40 -0
  66. package/scripts/utils.tsx +1 -3
  67. package/src/components/__tests__/unit/box.test.tsx +8 -11
  68. package/src/components/__tests__/unit/inline.test.tsx +3 -3
  69. package/src/components/__tests__/unit/interaction-suface.test.tsx +1 -1
  70. package/src/components/__tests__/unit/stack.test.tsx +2 -2
  71. package/src/components/__tests__/unit/text.test.tsx +23 -0
  72. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +2 -2
  73. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +2 -2
  74. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +2 -2
  75. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-color-should-match-snapshot-1-snap.png +2 -2
  76. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-color-should-match-snapshot-1-snap.png +2 -2
  77. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +2 -2
  78. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +2 -2
  79. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +2 -2
  80. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +2 -2
  81. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-line-heights-should-match-snapshot-1-snap.png +2 -2
  82. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +2 -2
  83. package/src/components/box.partial.tsx +293 -160
  84. package/src/components/inline.partial.tsx +44 -17
  85. package/src/components/interaction-surface.partial.tsx +2 -1
  86. package/src/components/stack.partial.tsx +43 -16
  87. package/src/components/text.partial.tsx +76 -41
  88. package/src/index.tsx +0 -1
  89. package/src/internal/color-map.tsx +4 -3
  90. package/src/internal/spacing-scale.tsx +22 -0
  91. package/text/package.json +15 -0
  92. package/tmp/api-report-tmp.d.ts +176 -43
  93. package/dist/cjs/constants.js +0 -21
  94. package/dist/es2019/constants.js +0 -14
  95. package/dist/esm/constants.js +0 -14
  96. package/dist/types/constants.d.ts +0 -15
  97. package/dist/types-ts4.0/constants.d.ts +0 -15
  98. package/src/constants.tsx +0 -16
@@ -1,13 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
1
  /** @jsx jsx */
8
2
  import { Children, forwardRef, Fragment } from 'react';
9
3
  import { css, jsx } from '@emotion/react';
10
- import { SPACING_SCALE } from '../constants';
11
4
  import Text from './text.partial';
12
5
  var flexAlignItemsMap = {
13
6
  center: css({
@@ -75,7 +68,7 @@ var Inline = /*#__PURE__*/forwardRef(function (_ref, ref) {
75
68
  testId = _ref.testId;
76
69
  var dividerComponent = typeof divider === 'string' ? jsx(Text, null, divider) : divider;
77
70
  return jsx("div", {
78
- style: _objectSpread({}, UNSAFE_style),
71
+ style: UNSAFE_style,
79
72
  css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
80
73
  "data-testid": testId,
81
74
  ref: ref
@@ -87,48 +80,49 @@ Inline.displayName = 'Inline';
87
80
  export default Inline;
88
81
  /**
89
82
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
90
- * @codegen <<SignedSource::7a985afa5e15ffd4f6f9c0db0e99ceb6>>
83
+ * @codegen <<SignedSource::cff5655983f2243060cade5b107d7762>>
91
84
  * @codegenId spacing
92
85
  * @codegenCommand yarn codegen-styles
93
86
  * @codegenParams ["columnGap"]
87
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
94
88
  */
95
89
 
96
90
  var columnGapMap = {
97
- 'sp-0': css({
98
- columnGap: SPACING_SCALE['sp-0']
91
+ 'scale.0': css({
92
+ columnGap: "var(--ds-scale-0, 0px)"
99
93
  }),
100
- 'sp-25': css({
101
- columnGap: SPACING_SCALE['sp-25']
94
+ 'scale.025': css({
95
+ columnGap: "var(--ds-scale-025, 2px)"
102
96
  }),
103
- 'sp-50': css({
104
- columnGap: SPACING_SCALE['sp-50']
97
+ 'scale.050': css({
98
+ columnGap: "var(--ds-scale-050, 4px)"
105
99
  }),
106
- 'sp-75': css({
107
- columnGap: SPACING_SCALE['sp-75']
100
+ 'scale.075': css({
101
+ columnGap: "var(--ds-scale-075, 6px)"
108
102
  }),
109
- 'sp-100': css({
110
- columnGap: SPACING_SCALE['sp-100']
103
+ 'scale.100': css({
104
+ columnGap: "var(--ds-scale-100, 8px)"
111
105
  }),
112
- 'sp-150': css({
113
- columnGap: SPACING_SCALE['sp-150']
106
+ 'scale.150': css({
107
+ columnGap: "var(--ds-scale-150, 12px)"
114
108
  }),
115
- 'sp-200': css({
116
- columnGap: SPACING_SCALE['sp-200']
109
+ 'scale.200': css({
110
+ columnGap: "var(--ds-scale-200, 16px)"
117
111
  }),
118
- 'sp-300': css({
119
- columnGap: SPACING_SCALE['sp-300']
112
+ 'scale.250': css({
113
+ columnGap: "var(--ds-scale-250, 20px)"
120
114
  }),
121
- 'sp-400': css({
122
- columnGap: SPACING_SCALE['sp-400']
115
+ 'scale.300': css({
116
+ columnGap: "var(--ds-scale-300, 24px)"
123
117
  }),
124
- 'sp-500': css({
125
- columnGap: SPACING_SCALE['sp-500']
118
+ 'scale.400': css({
119
+ columnGap: "var(--ds-scale-400, 32px)"
126
120
  }),
127
- 'sp-600': css({
128
- columnGap: SPACING_SCALE['sp-600']
121
+ 'scale.500': css({
122
+ columnGap: "var(--ds-scale-500, 40px)"
129
123
  }),
130
- 'sp-800': css({
131
- columnGap: SPACING_SCALE['sp-800']
124
+ 'scale.600': css({
125
+ columnGap: "var(--ds-scale-600, 48px)"
132
126
  })
133
127
  };
134
128
  /**
@@ -48,10 +48,11 @@ var InteractionSurface = function InteractionSurface(_ref) {
48
48
  export default InteractionSurface;
49
49
  /**
50
50
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
51
- * @codegen <<SignedSource::45000716488a9f41306a232c1f4c9f8d>>
51
+ * @codegen <<SignedSource::1bad97ad2c03ae813521797686ac780d>>
52
52
  * @codegenId interactions
53
53
  * @codegenCommand yarn codegen-styles
54
54
  * @codegenParams ["background"]
55
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
55
56
  */
56
57
 
57
58
  var backgroundActiveColorMap = {
@@ -144,6 +145,21 @@ var backgroundActiveColorMap = {
144
145
  ':active': {
145
146
  backgroundColor: "var(--ds-background-information-bold-pressed, #09326C)"
146
147
  }
148
+ }),
149
+ 'elevation.surface': css({
150
+ ':active': {
151
+ backgroundColor: "var(--ds-surface-pressed, #DCDFE4)"
152
+ }
153
+ }),
154
+ 'elevation.surface.raised': css({
155
+ ':active': {
156
+ backgroundColor: "var(--ds-surface-raised-pressed, #DCDFE4)"
157
+ }
158
+ }),
159
+ 'elevation.surface.overlay': css({
160
+ ':active': {
161
+ backgroundColor: "var(--ds-surface-overlay-pressed, #DCDFE4)"
162
+ }
147
163
  })
148
164
  };
149
165
  var backgroundHoverColorMap = {
@@ -236,6 +252,21 @@ var backgroundHoverColorMap = {
236
252
  ':hover': {
237
253
  backgroundColor: "var(--ds-background-information-bold-hovered, #0055CC)"
238
254
  }
255
+ }),
256
+ 'elevation.surface': css({
257
+ ':hover': {
258
+ backgroundColor: "var(--ds-surface-hovered, #F1F2F4)"
259
+ }
260
+ }),
261
+ 'elevation.surface.raised': css({
262
+ ':hover': {
263
+ backgroundColor: "var(--ds-surface-raised-hovered, #F1F2F4)"
264
+ }
265
+ }),
266
+ 'elevation.surface.overlay': css({
267
+ ':hover': {
268
+ backgroundColor: "var(--ds-surface-overlay-hovered, #F1F2F4)"
269
+ }
239
270
  })
240
271
  };
241
272
  /**
@@ -1,13 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
1
  /** @jsx jsx */
8
2
  import { forwardRef } from 'react';
9
3
  import { css, jsx } from '@emotion/react';
10
- import { SPACING_SCALE } from '../constants';
11
4
  var flexAlignItemsMap = {
12
5
  center: css({
13
6
  alignItems: 'center'
@@ -72,7 +65,7 @@ var Stack = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
65
  UNSAFE_style = _ref.UNSAFE_style,
73
66
  testId = _ref.testId;
74
67
  return jsx("div", {
75
- style: _objectSpread({}, UNSAFE_style),
68
+ style: UNSAFE_style,
76
69
  css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
77
70
  "data-testid": testId,
78
71
  ref: ref
@@ -82,48 +75,49 @@ Stack.displayName = 'Stack';
82
75
  export default Stack;
83
76
  /**
84
77
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
85
- * @codegen <<SignedSource::13c9344cdb18845e176c0ca78b2972d3>>
78
+ * @codegen <<SignedSource::c486b14097494305925c3c989823d602>>
86
79
  * @codegenId spacing
87
80
  * @codegenCommand yarn codegen-styles
88
81
  * @codegenParams ["rowGap"]
82
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
89
83
  */
90
84
 
91
85
  var rowGapMap = {
92
- 'sp-0': css({
93
- rowGap: SPACING_SCALE['sp-0']
86
+ 'scale.0': css({
87
+ rowGap: "var(--ds-scale-0, 0px)"
94
88
  }),
95
- 'sp-25': css({
96
- rowGap: SPACING_SCALE['sp-25']
89
+ 'scale.025': css({
90
+ rowGap: "var(--ds-scale-025, 2px)"
97
91
  }),
98
- 'sp-50': css({
99
- rowGap: SPACING_SCALE['sp-50']
92
+ 'scale.050': css({
93
+ rowGap: "var(--ds-scale-050, 4px)"
100
94
  }),
101
- 'sp-75': css({
102
- rowGap: SPACING_SCALE['sp-75']
95
+ 'scale.075': css({
96
+ rowGap: "var(--ds-scale-075, 6px)"
103
97
  }),
104
- 'sp-100': css({
105
- rowGap: SPACING_SCALE['sp-100']
98
+ 'scale.100': css({
99
+ rowGap: "var(--ds-scale-100, 8px)"
106
100
  }),
107
- 'sp-150': css({
108
- rowGap: SPACING_SCALE['sp-150']
101
+ 'scale.150': css({
102
+ rowGap: "var(--ds-scale-150, 12px)"
109
103
  }),
110
- 'sp-200': css({
111
- rowGap: SPACING_SCALE['sp-200']
104
+ 'scale.200': css({
105
+ rowGap: "var(--ds-scale-200, 16px)"
112
106
  }),
113
- 'sp-300': css({
114
- rowGap: SPACING_SCALE['sp-300']
107
+ 'scale.250': css({
108
+ rowGap: "var(--ds-scale-250, 20px)"
115
109
  }),
116
- 'sp-400': css({
117
- rowGap: SPACING_SCALE['sp-400']
110
+ 'scale.300': css({
111
+ rowGap: "var(--ds-scale-300, 24px)"
118
112
  }),
119
- 'sp-500': css({
120
- rowGap: SPACING_SCALE['sp-500']
113
+ 'scale.400': css({
114
+ rowGap: "var(--ds-scale-400, 32px)"
121
115
  }),
122
- 'sp-600': css({
123
- rowGap: SPACING_SCALE['sp-600']
116
+ 'scale.500': css({
117
+ rowGap: "var(--ds-scale-500, 40px)"
124
118
  }),
125
- 'sp-800': css({
126
- rowGap: SPACING_SCALE['sp-800']
119
+ 'scale.600': css({
120
+ rowGap: "var(--ds-scale-600, 48px)"
127
121
  })
128
122
  };
129
123
  /**
@@ -1,14 +1,11 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["children"];
7
3
 
8
4
  /** @jsx jsx */
5
+ import { createContext, Fragment, useContext } from 'react';
9
6
  import { css, jsx } from '@emotion/react';
10
7
  import invariant from 'tiny-invariant';
11
- import { colorMap } from '../internal/color-map';
8
+ import surfaceColorMap from '../internal/color-map';
12
9
  import { useSurface } from './surface-provider';
13
10
  var asAllowlist = ['span', 'div', 'p'];
14
11
  var fontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";
@@ -31,6 +28,9 @@ var fontWeightMap = {
31
28
  '500': css({
32
29
  fontWeight: 500
33
30
  }),
31
+ '600': css({
32
+ fontWeight: 600
33
+ }),
34
34
  '700': css({
35
35
  fontWeight: 700
36
36
  })
@@ -102,6 +102,27 @@ var truncateStyles = css({
102
102
  textOverflow: 'ellipsis',
103
103
  whiteSpace: 'nowrap'
104
104
  });
105
+ /**
106
+ * 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.
107
+ */
108
+
109
+ var useColor = function useColor(colorProp) {
110
+ var surface = useSurface();
111
+ var inverseTextColor = surfaceColorMap[surface];
112
+ /**
113
+ * Where the color of the surface is inverted we override the user choice
114
+ * as there is no valid choice that is not covered by the override.
115
+ */
116
+
117
+ var color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
118
+ return color;
119
+ };
120
+
121
+ var HasTextAncestorContext = /*#__PURE__*/createContext(false);
122
+
123
+ var useHasTextAncestor = function useHasTextAncestor() {
124
+ return useContext(HasTextAncestorContext);
125
+ };
105
126
  /**
106
127
  * __Text__
107
128
  *
@@ -112,87 +133,96 @@ var truncateStyles = css({
112
133
  * @internal
113
134
  */
114
135
 
115
- var Text = function Text(_ref) {
116
- var _ref$as = _ref.as,
117
- Component = _ref$as === void 0 ? 'span' : _ref$as,
118
- children = _ref.children,
119
- colorTuple = _ref.color,
120
- fontSize = _ref.fontSize,
121
- fontWeight = _ref.fontWeight,
122
- lineHeight = _ref.lineHeight,
123
- _ref$shouldTruncate = _ref.shouldTruncate,
124
- shouldTruncate = _ref$shouldTruncate === void 0 ? false : _ref$shouldTruncate,
125
- textAlign = _ref.textAlign,
126
- textTransform = _ref.textTransform,
127
- verticalAlign = _ref.verticalAlign,
128
- testId = _ref.testId,
129
- UNSAFE_style = _ref.UNSAFE_style;
130
- var surface = useSurface(); // @ts-ignore
131
136
 
132
- var _ref2 = colorTuple || [],
133
- _ref3 = _slicedToArray(_ref2, 2),
134
- _ref3$ = _ref3[0],
135
- color = _ref3$ === void 0 ? colorMap[surface] : _ref3$,
136
- fallback = _ref3[1];
137
+ var Text = function Text(_ref) {
138
+ var children = _ref.children,
139
+ props = _objectWithoutProperties(_ref, _excluded);
137
140
 
141
+ var _props$as = props.as,
142
+ Component = _props$as === void 0 ? 'span' : _props$as,
143
+ colorProp = props.color,
144
+ fontSize = props.fontSize,
145
+ fontWeight = props.fontWeight,
146
+ lineHeight = props.lineHeight,
147
+ _props$shouldTruncate = props.shouldTruncate,
148
+ shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
149
+ textAlign = props.textAlign,
150
+ textTransform = props.textTransform,
151
+ verticalAlign = props.verticalAlign,
152
+ testId = props.testId,
153
+ UNSAFE_style = props.UNSAFE_style;
138
154
  invariant(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
139
- return jsx(Component, {
140
- style: _objectSpread(_objectSpread({}, UNSAFE_style), fallback && {
141
- '--ds-co-fb': fallback
142
- }),
155
+ var color = useColor(colorProp);
156
+ var isWrapped = useHasTextAncestor();
157
+ /**
158
+ * If the text is already wrapped and applies no props we can just
159
+ * render the children directly as a fragment.
160
+ */
161
+
162
+ if (isWrapped && Object.keys(props).length === 0) {
163
+ return jsx(Fragment, null, children);
164
+ }
165
+
166
+ var component = jsx(Component, {
167
+ style: UNSAFE_style,
143
168
  css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign], textTransform && textTransformMap[textTransform], verticalAlign && verticalAlignMap[verticalAlign]],
144
169
  "data-testid": testId
145
170
  }, children);
171
+ return isWrapped ? // no need to re-apply context if the text is already wrapped
172
+ component : jsx(HasTextAncestorContext.Provider, {
173
+ value: true
174
+ }, component);
146
175
  };
147
176
 
148
177
  export default Text;
149
178
  /**
150
179
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
151
- * @codegen <<SignedSource::140ffff6e1310c1c37e2067e2c232b92>>
180
+ * @codegen <<SignedSource::21771f01de3c37646642de03274f0738>>
152
181
  * @codegenId colors
153
182
  * @codegenCommand yarn codegen-styles
154
183
  * @codegenParams ["text"]
184
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
155
185
  */
156
186
 
157
187
  var textColorMap = {
158
188
  'color.text': css({
159
- color: "var(--ds-text, var(--ds-co-fb))"
189
+ color: "var(--ds-text, #172B4D)"
160
190
  }),
161
191
  subtle: css({
162
- color: "var(--ds-text-subtle, var(--ds-co-fb))"
192
+ color: "var(--ds-text-subtle, #42526E)"
163
193
  }),
164
194
  subtlest: css({
165
- color: "var(--ds-text-subtlest, var(--ds-co-fb))"
195
+ color: "var(--ds-text-subtlest, #7A869A)"
166
196
  }),
167
197
  disabled: css({
168
- color: "var(--ds-text-disabled, var(--ds-co-fb))"
198
+ color: "var(--ds-text-disabled, #A5ADBA)"
169
199
  }),
170
200
  inverse: css({
171
- color: "var(--ds-text-inverse, var(--ds-co-fb))"
201
+ color: "var(--ds-text-inverse, #FFFFFF)"
172
202
  }),
173
203
  brand: css({
174
- color: "var(--ds-text-brand, var(--ds-co-fb))"
204
+ color: "var(--ds-text-brand, #0065FF)"
175
205
  }),
176
206
  selected: css({
177
- color: "var(--ds-text-selected, var(--ds-co-fb))"
207
+ color: "var(--ds-text-selected, #0052CC)"
178
208
  }),
179
209
  danger: css({
180
- color: "var(--ds-text-danger, var(--ds-co-fb))"
210
+ color: "var(--ds-text-danger, #DE350B)"
181
211
  }),
182
212
  warning: css({
183
- color: "var(--ds-text-warning, var(--ds-co-fb))"
213
+ color: "var(--ds-text-warning, #974F0C)"
184
214
  }),
185
215
  'warning.inverse': css({
186
- color: "var(--ds-text-warning-inverse, var(--ds-co-fb))"
216
+ color: "var(--ds-text-warning-inverse, #172B4D)"
187
217
  }),
188
218
  success: css({
189
- color: "var(--ds-text-success, var(--ds-co-fb))"
219
+ color: "var(--ds-text-success, #006644)"
190
220
  }),
191
221
  discovery: css({
192
- color: "var(--ds-text-discovery, var(--ds-co-fb))"
222
+ color: "var(--ds-text-discovery, #403294)"
193
223
  }),
194
224
  information: css({
195
- color: "var(--ds-text-information, var(--ds-co-fb))"
225
+ color: "var(--ds-text-information, #0052CC)"
196
226
  })
197
227
  };
198
228
  /**
package/dist/esm/index.js CHANGED
@@ -2,5 +2,4 @@ export { default as UNSAFE_Box } from './components/box.partial';
2
2
  export { default as UNSAFE_Text } from './components/text.partial';
3
3
  export { default as UNSAFE_Inline } from './components/inline.partial';
4
4
  export { default as UNSAFE_Stack } from './components/stack.partial';
5
- export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
6
- export { SPACING_SCALE as UNSAFE_SPACING_SCALE } from './constants';
5
+ export { default as UNSAFE_InteractionSurface } from './components/interaction-surface.partial';
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
3
  *
4
- * Some artifact
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::8f568e4f0837f7af4a10429e060ad059>>
6
+ * @codegen <<SignedSource::c9429c38d12f88de9f5be644bf5e704a>>
7
7
  * @codegenCommand yarn codegen-styles
8
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
8
9
  */
9
- export var colorMap = {
10
+ export default {
10
11
  'neutral.bold': 'inverse',
11
12
  'neutral.bold.hovered': 'inverse',
12
13
  'neutral.bold.pressed': 'inverse',
@@ -0,0 +1,9 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Some artifact
5
+ *
6
+ * @codegen <<SignedSource::caecb926afa82b027fba396074de5c2c>>
7
+ * @codegenCommand yarn codegen-styles
8
+ */
9
+ export var spacingScale = ['scale.0', 'scale.025', 'scale.050', 'scale.075', 'scale.100', 'scale.150', 'scale.200', 'scale.250', 'scale.300', 'scale.400', 'scale.500', 'scale.600'];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.1.5",
3
+ "version": "1.0.0",
4
4
  "sideEffects": false
5
5
  }