@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.
- package/CHANGELOG.md +22 -0
- package/box/package.json +15 -0
- package/dist/cjs/components/box.partial.js +182 -205
- package/dist/cjs/components/inline.partial.js +28 -34
- package/dist/cjs/components/interaction-surface.partial.js +32 -1
- package/dist/cjs/components/stack.partial.js +28 -36
- package/dist/cjs/components/text.partial.js +114 -85
- package/dist/cjs/index.js +1 -9
- package/dist/cjs/internal/color-map.js +6 -5
- package/dist/cjs/internal/spacing-scale.js +17 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.partial.js +181 -189
- package/dist/es2019/components/inline.partial.js +27 -28
- package/dist/es2019/components/interaction-surface.partial.js +32 -1
- package/dist/es2019/components/stack.partial.js +27 -28
- package/dist/es2019/components/text.partial.js +71 -35
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/internal/color-map.js +4 -3
- package/dist/es2019/internal/spacing-scale.js +9 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.partial.js +181 -201
- package/dist/esm/components/inline.partial.js +27 -33
- package/dist/esm/components/interaction-surface.partial.js +32 -1
- package/dist/esm/components/stack.partial.js +27 -33
- package/dist/esm/components/text.partial.js +76 -46
- package/dist/esm/index.js +1 -2
- package/dist/esm/internal/color-map.js +4 -3
- package/dist/esm/internal/spacing-scale.js +9 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.partial.d.ts +109 -21
- package/dist/types/components/inline.partial.d.ts +25 -3
- package/dist/types/components/interaction-surface.partial.d.ts +3 -0
- package/dist/types/components/stack.partial.d.ts +24 -2
- package/dist/types/components/text.partial.d.ts +5 -3
- package/dist/types/index.d.ts +0 -1
- package/dist/types/internal/color-map.d.ts +11 -9
- package/dist/types/internal/spacing-scale.d.ts +9 -0
- package/dist/types-ts4.0/components/box.partial.d.ts +109 -27
- package/dist/types-ts4.0/components/inline.partial.d.ts +25 -3
- package/dist/types-ts4.0/components/interaction-surface.partial.d.ts +3 -0
- package/dist/types-ts4.0/components/stack.partial.d.ts +24 -2
- package/dist/types-ts4.0/components/text.partial.d.ts +5 -6
- package/dist/types-ts4.0/index.d.ts +0 -1
- package/dist/types-ts4.0/internal/color-map.d.ts +11 -9
- package/dist/types-ts4.0/internal/spacing-scale.d.ts +22 -0
- package/examples/00-basic.tsx +4 -4
- package/examples/01-box.tsx +29 -46
- package/examples/02-text-advanced.tsx +38 -0
- package/examples/02-text.tsx +72 -62
- package/examples/03-stack.tsx +36 -75
- package/examples/04-inline.tsx +34 -76
- package/examples/05-badge.tsx +2 -2
- package/examples/06-section-message.tsx +7 -7
- package/examples/07-comment.tsx +4 -6
- package/examples/08-lozenge.tsx +9 -5
- package/examples/99-interactions.tsx +20 -20
- package/examples/config.jsonc +11 -0
- package/package.json +5 -2
- package/report.api.md +187 -48
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +52 -64
- package/scripts/codegen-styles.tsx +34 -6
- package/scripts/color-codegen-template.tsx +10 -15
- package/scripts/color-map-template.tsx +1 -1
- package/scripts/spacing-codegen-template.tsx +42 -12
- package/scripts/spacing-scale-template.tsx +40 -0
- package/scripts/utils.tsx +1 -3
- package/src/components/__tests__/unit/box.test.tsx +8 -11
- package/src/components/__tests__/unit/inline.test.tsx +3 -3
- package/src/components/__tests__/unit/interaction-suface.test.tsx +1 -1
- package/src/components/__tests__/unit/stack.test.tsx +2 -2
- package/src/components/__tests__/unit/text.test.tsx +23 -0
- 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
- 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
- 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
- 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
- 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
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +2 -2
- package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +2 -2
- 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
- package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +2 -2
- package/src/components/box.partial.tsx +293 -160
- package/src/components/inline.partial.tsx +44 -17
- package/src/components/interaction-surface.partial.tsx +2 -1
- package/src/components/stack.partial.tsx +43 -16
- package/src/components/text.partial.tsx +76 -41
- package/src/index.tsx +0 -1
- package/src/internal/color-map.tsx +4 -3
- package/src/internal/spacing-scale.tsx +22 -0
- package/text/package.json +15 -0
- package/tmp/api-report-tmp.d.ts +176 -43
- package/dist/cjs/constants.js +0 -21
- package/dist/es2019/constants.js +0 -14
- package/dist/esm/constants.js +0 -14
- package/dist/types/constants.d.ts +0 -15
- package/dist/types-ts4.0/constants.d.ts +0 -15
- 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:
|
|
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::
|
|
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
|
-
'
|
|
98
|
-
columnGap:
|
|
91
|
+
'scale.0': css({
|
|
92
|
+
columnGap: "var(--ds-scale-0, 0px)"
|
|
99
93
|
}),
|
|
100
|
-
'
|
|
101
|
-
columnGap:
|
|
94
|
+
'scale.025': css({
|
|
95
|
+
columnGap: "var(--ds-scale-025, 2px)"
|
|
102
96
|
}),
|
|
103
|
-
'
|
|
104
|
-
columnGap:
|
|
97
|
+
'scale.050': css({
|
|
98
|
+
columnGap: "var(--ds-scale-050, 4px)"
|
|
105
99
|
}),
|
|
106
|
-
'
|
|
107
|
-
columnGap:
|
|
100
|
+
'scale.075': css({
|
|
101
|
+
columnGap: "var(--ds-scale-075, 6px)"
|
|
108
102
|
}),
|
|
109
|
-
'
|
|
110
|
-
columnGap:
|
|
103
|
+
'scale.100': css({
|
|
104
|
+
columnGap: "var(--ds-scale-100, 8px)"
|
|
111
105
|
}),
|
|
112
|
-
'
|
|
113
|
-
columnGap:
|
|
106
|
+
'scale.150': css({
|
|
107
|
+
columnGap: "var(--ds-scale-150, 12px)"
|
|
114
108
|
}),
|
|
115
|
-
'
|
|
116
|
-
columnGap:
|
|
109
|
+
'scale.200': css({
|
|
110
|
+
columnGap: "var(--ds-scale-200, 16px)"
|
|
117
111
|
}),
|
|
118
|
-
'
|
|
119
|
-
columnGap:
|
|
112
|
+
'scale.250': css({
|
|
113
|
+
columnGap: "var(--ds-scale-250, 20px)"
|
|
120
114
|
}),
|
|
121
|
-
'
|
|
122
|
-
columnGap:
|
|
115
|
+
'scale.300': css({
|
|
116
|
+
columnGap: "var(--ds-scale-300, 24px)"
|
|
123
117
|
}),
|
|
124
|
-
'
|
|
125
|
-
columnGap:
|
|
118
|
+
'scale.400': css({
|
|
119
|
+
columnGap: "var(--ds-scale-400, 32px)"
|
|
126
120
|
}),
|
|
127
|
-
'
|
|
128
|
-
columnGap:
|
|
121
|
+
'scale.500': css({
|
|
122
|
+
columnGap: "var(--ds-scale-500, 40px)"
|
|
129
123
|
}),
|
|
130
|
-
'
|
|
131
|
-
columnGap:
|
|
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::
|
|
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:
|
|
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::
|
|
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
|
-
'
|
|
93
|
-
rowGap:
|
|
86
|
+
'scale.0': css({
|
|
87
|
+
rowGap: "var(--ds-scale-0, 0px)"
|
|
94
88
|
}),
|
|
95
|
-
'
|
|
96
|
-
rowGap:
|
|
89
|
+
'scale.025': css({
|
|
90
|
+
rowGap: "var(--ds-scale-025, 2px)"
|
|
97
91
|
}),
|
|
98
|
-
'
|
|
99
|
-
rowGap:
|
|
92
|
+
'scale.050': css({
|
|
93
|
+
rowGap: "var(--ds-scale-050, 4px)"
|
|
100
94
|
}),
|
|
101
|
-
'
|
|
102
|
-
rowGap:
|
|
95
|
+
'scale.075': css({
|
|
96
|
+
rowGap: "var(--ds-scale-075, 6px)"
|
|
103
97
|
}),
|
|
104
|
-
'
|
|
105
|
-
rowGap:
|
|
98
|
+
'scale.100': css({
|
|
99
|
+
rowGap: "var(--ds-scale-100, 8px)"
|
|
106
100
|
}),
|
|
107
|
-
'
|
|
108
|
-
rowGap:
|
|
101
|
+
'scale.150': css({
|
|
102
|
+
rowGap: "var(--ds-scale-150, 12px)"
|
|
109
103
|
}),
|
|
110
|
-
'
|
|
111
|
-
rowGap:
|
|
104
|
+
'scale.200': css({
|
|
105
|
+
rowGap: "var(--ds-scale-200, 16px)"
|
|
112
106
|
}),
|
|
113
|
-
'
|
|
114
|
-
rowGap:
|
|
107
|
+
'scale.250': css({
|
|
108
|
+
rowGap: "var(--ds-scale-250, 20px)"
|
|
115
109
|
}),
|
|
116
|
-
'
|
|
117
|
-
rowGap:
|
|
110
|
+
'scale.300': css({
|
|
111
|
+
rowGap: "var(--ds-scale-300, 24px)"
|
|
118
112
|
}),
|
|
119
|
-
'
|
|
120
|
-
rowGap:
|
|
113
|
+
'scale.400': css({
|
|
114
|
+
rowGap: "var(--ds-scale-400, 32px)"
|
|
121
115
|
}),
|
|
122
|
-
'
|
|
123
|
-
rowGap:
|
|
116
|
+
'scale.500': css({
|
|
117
|
+
rowGap: "var(--ds-scale-500, 40px)"
|
|
124
118
|
}),
|
|
125
|
-
'
|
|
126
|
-
rowGap:
|
|
119
|
+
'scale.600': css({
|
|
120
|
+
rowGap: "var(--ds-scale-600, 48px)"
|
|
127
121
|
})
|
|
128
122
|
};
|
|
129
123
|
/**
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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::
|
|
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,
|
|
189
|
+
color: "var(--ds-text, #172B4D)"
|
|
160
190
|
}),
|
|
161
191
|
subtle: css({
|
|
162
|
-
color: "var(--ds-text-subtle,
|
|
192
|
+
color: "var(--ds-text-subtle, #42526E)"
|
|
163
193
|
}),
|
|
164
194
|
subtlest: css({
|
|
165
|
-
color: "var(--ds-text-subtlest,
|
|
195
|
+
color: "var(--ds-text-subtlest, #7A869A)"
|
|
166
196
|
}),
|
|
167
197
|
disabled: css({
|
|
168
|
-
color: "var(--ds-text-disabled,
|
|
198
|
+
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
169
199
|
}),
|
|
170
200
|
inverse: css({
|
|
171
|
-
color: "var(--ds-text-inverse,
|
|
201
|
+
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
172
202
|
}),
|
|
173
203
|
brand: css({
|
|
174
|
-
color: "var(--ds-text-brand,
|
|
204
|
+
color: "var(--ds-text-brand, #0065FF)"
|
|
175
205
|
}),
|
|
176
206
|
selected: css({
|
|
177
|
-
color: "var(--ds-text-selected,
|
|
207
|
+
color: "var(--ds-text-selected, #0052CC)"
|
|
178
208
|
}),
|
|
179
209
|
danger: css({
|
|
180
|
-
color: "var(--ds-text-danger,
|
|
210
|
+
color: "var(--ds-text-danger, #DE350B)"
|
|
181
211
|
}),
|
|
182
212
|
warning: css({
|
|
183
|
-
color: "var(--ds-text-warning,
|
|
213
|
+
color: "var(--ds-text-warning, #974F0C)"
|
|
184
214
|
}),
|
|
185
215
|
'warning.inverse': css({
|
|
186
|
-
color: "var(--ds-text-warning-inverse,
|
|
216
|
+
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
187
217
|
}),
|
|
188
218
|
success: css({
|
|
189
|
-
color: "var(--ds-text-success,
|
|
219
|
+
color: "var(--ds-text-success, #006644)"
|
|
190
220
|
}),
|
|
191
221
|
discovery: css({
|
|
192
|
-
color: "var(--ds-text-discovery,
|
|
222
|
+
color: "var(--ds-text-discovery, #403294)"
|
|
193
223
|
}),
|
|
194
224
|
information: css({
|
|
195
|
-
color: "var(--ds-text-information,
|
|
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
|
-
*
|
|
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::
|
|
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
|
|
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'];
|
package/dist/esm/version.json
CHANGED