@atlaskit/ds-explorations 0.1.4 → 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 +33 -0
- package/box/package.json +15 -0
- package/dist/cjs/components/box.partial.js +184 -201
- package/dist/cjs/components/inline.partial.js +49 -30
- package/dist/cjs/components/interaction-surface.partial.js +35 -3
- package/dist/cjs/components/stack.partial.js +49 -30
- package/dist/cjs/components/text.partial.js +116 -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 +182 -184
- package/dist/es2019/components/inline.partial.js +49 -29
- package/dist/es2019/components/interaction-surface.partial.js +35 -3
- package/dist/es2019/components/stack.partial.js +49 -29
- package/dist/es2019/components/text.partial.js +73 -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 +183 -197
- package/dist/esm/components/inline.partial.js +49 -29
- package/dist/esm/components/interaction-surface.partial.js +35 -3
- package/dist/esm/components/stack.partial.js +49 -29
- package/dist/esm/components/text.partial.js +78 -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 +114 -18
- package/dist/types/components/inline.partial.d.ts +38 -4
- package/dist/types/components/interaction-surface.partial.d.ts +7 -3
- package/dist/types/components/stack.partial.d.ts +39 -6
- package/dist/types/components/text.partial.d.ts +5 -3
- package/dist/types/components/types.d.ts +1 -0
- 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 +114 -24
- package/dist/types-ts4.0/components/inline.partial.d.ts +38 -4
- package/dist/types-ts4.0/components/interaction-surface.partial.d.ts +7 -3
- package/dist/types-ts4.0/components/stack.partial.d.ts +39 -6
- package/dist/types-ts4.0/components/text.partial.d.ts +5 -6
- package/dist/types-ts4.0/components/types.d.ts +1 -0
- 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 +48 -74
- package/examples/04-inline.tsx +46 -75
- 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 +53 -46
- package/examples/config.jsonc +11 -0
- package/package.json +5 -2
- package/report.api.md +240 -54
- 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 +48 -12
- package/scripts/spacing-scale-template.tsx +40 -0
- package/scripts/utils.tsx +1 -3
- package/src/components/__tests__/unit/box.test.tsx +18 -13
- package/src/components/__tests__/unit/inline.test.tsx +10 -10
- package/src/components/__tests__/unit/interaction-suface.test.tsx +14 -8
- package/src/components/__tests__/unit/stack.test.tsx +7 -7
- 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 +296 -159
- package/src/components/inline.partial.tsx +75 -21
- package/src/components/interaction-surface.partial.tsx +6 -4
- package/src/components/stack.partial.tsx +75 -22
- package/src/components/text.partial.tsx +78 -41
- package/src/components/types.tsx +2 -0
- 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 +583 -0
- 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
|
@@ -11,8 +11,6 @@ var _react = require("react");
|
|
|
11
11
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
|
-
var _constants = require("../constants");
|
|
15
|
-
|
|
16
14
|
var _text = _interopRequireDefault(require("./text.partial"));
|
|
17
15
|
|
|
18
16
|
/** @jsx jsx */
|
|
@@ -28,6 +26,12 @@ var flexAlignItemsMap = {
|
|
|
28
26
|
}),
|
|
29
27
|
flexEnd: (0, _react2.css)({
|
|
30
28
|
alignItems: 'flex-end'
|
|
29
|
+
}),
|
|
30
|
+
start: (0, _react2.css)({
|
|
31
|
+
alignItems: 'start'
|
|
32
|
+
}),
|
|
33
|
+
end: (0, _react2.css)({
|
|
34
|
+
alignItems: 'end'
|
|
31
35
|
})
|
|
32
36
|
};
|
|
33
37
|
var flexJustifyContentMap = {
|
|
@@ -39,6 +43,17 @@ var flexJustifyContentMap = {
|
|
|
39
43
|
}),
|
|
40
44
|
flexEnd: (0, _react2.css)({
|
|
41
45
|
justifyContent: 'flex-end'
|
|
46
|
+
}),
|
|
47
|
+
start: (0, _react2.css)({
|
|
48
|
+
justifyContent: 'start'
|
|
49
|
+
}),
|
|
50
|
+
end: (0, _react2.css)({
|
|
51
|
+
justifyContent: 'end'
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
var flexWrapMap = {
|
|
55
|
+
wrap: (0, _react2.css)({
|
|
56
|
+
flexWrap: 'wrap'
|
|
42
57
|
})
|
|
43
58
|
};
|
|
44
59
|
var baseStyles = (0, _react2.css)({
|
|
@@ -58,12 +73,15 @@ var Inline = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
58
73
|
var gap = _ref.gap,
|
|
59
74
|
alignItems = _ref.alignItems,
|
|
60
75
|
justifyContent = _ref.justifyContent,
|
|
76
|
+
flexWrap = _ref.flexWrap,
|
|
61
77
|
divider = _ref.divider,
|
|
78
|
+
UNSAFE_style = _ref.UNSAFE_style,
|
|
62
79
|
children = _ref.children,
|
|
63
80
|
testId = _ref.testId;
|
|
64
81
|
var dividerComponent = typeof divider === 'string' ? (0, _react2.jsx)(_text.default, null, divider) : divider;
|
|
65
82
|
return (0, _react2.jsx)("div", {
|
|
66
|
-
|
|
83
|
+
style: UNSAFE_style,
|
|
84
|
+
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
67
85
|
"data-testid": testId,
|
|
68
86
|
ref: ref
|
|
69
87
|
}, _react.Children.map(children, function (child, index) {
|
|
@@ -74,49 +92,50 @@ Inline.displayName = 'Inline';
|
|
|
74
92
|
var _default = Inline;
|
|
75
93
|
/**
|
|
76
94
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
77
|
-
* @codegen <<SignedSource::
|
|
95
|
+
* @codegen <<SignedSource::cff5655983f2243060cade5b107d7762>>
|
|
78
96
|
* @codegenId spacing
|
|
79
97
|
* @codegenCommand yarn codegen-styles
|
|
80
|
-
* @codegenParams ["
|
|
98
|
+
* @codegenParams ["columnGap"]
|
|
99
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
81
100
|
*/
|
|
82
101
|
|
|
83
102
|
exports.default = _default;
|
|
84
|
-
var
|
|
85
|
-
'
|
|
86
|
-
|
|
103
|
+
var columnGapMap = {
|
|
104
|
+
'scale.0': (0, _react2.css)({
|
|
105
|
+
columnGap: "var(--ds-scale-0, 0px)"
|
|
87
106
|
}),
|
|
88
|
-
'
|
|
89
|
-
|
|
107
|
+
'scale.025': (0, _react2.css)({
|
|
108
|
+
columnGap: "var(--ds-scale-025, 2px)"
|
|
90
109
|
}),
|
|
91
|
-
'
|
|
92
|
-
|
|
110
|
+
'scale.050': (0, _react2.css)({
|
|
111
|
+
columnGap: "var(--ds-scale-050, 4px)"
|
|
93
112
|
}),
|
|
94
|
-
'
|
|
95
|
-
|
|
113
|
+
'scale.075': (0, _react2.css)({
|
|
114
|
+
columnGap: "var(--ds-scale-075, 6px)"
|
|
96
115
|
}),
|
|
97
|
-
'
|
|
98
|
-
|
|
116
|
+
'scale.100': (0, _react2.css)({
|
|
117
|
+
columnGap: "var(--ds-scale-100, 8px)"
|
|
99
118
|
}),
|
|
100
|
-
'
|
|
101
|
-
|
|
119
|
+
'scale.150': (0, _react2.css)({
|
|
120
|
+
columnGap: "var(--ds-scale-150, 12px)"
|
|
102
121
|
}),
|
|
103
|
-
'
|
|
104
|
-
|
|
122
|
+
'scale.200': (0, _react2.css)({
|
|
123
|
+
columnGap: "var(--ds-scale-200, 16px)"
|
|
105
124
|
}),
|
|
106
|
-
'
|
|
107
|
-
|
|
125
|
+
'scale.250': (0, _react2.css)({
|
|
126
|
+
columnGap: "var(--ds-scale-250, 20px)"
|
|
108
127
|
}),
|
|
109
|
-
'
|
|
110
|
-
|
|
128
|
+
'scale.300': (0, _react2.css)({
|
|
129
|
+
columnGap: "var(--ds-scale-300, 24px)"
|
|
111
130
|
}),
|
|
112
|
-
'
|
|
113
|
-
|
|
131
|
+
'scale.400': (0, _react2.css)({
|
|
132
|
+
columnGap: "var(--ds-scale-400, 32px)"
|
|
114
133
|
}),
|
|
115
|
-
'
|
|
116
|
-
|
|
134
|
+
'scale.500': (0, _react2.css)({
|
|
135
|
+
columnGap: "var(--ds-scale-500, 40px)"
|
|
117
136
|
}),
|
|
118
|
-
'
|
|
119
|
-
|
|
137
|
+
'scale.600': (0, _react2.css)({
|
|
138
|
+
columnGap: "var(--ds-scale-600, 48px)"
|
|
120
139
|
})
|
|
121
140
|
};
|
|
122
141
|
/**
|
|
@@ -30,8 +30,9 @@ var baseStyles = (0, _react2.css)({
|
|
|
30
30
|
* ```js
|
|
31
31
|
* // a minimal icon button
|
|
32
32
|
* <Box as="button">
|
|
33
|
-
* <InteractionSurface
|
|
34
|
-
*
|
|
33
|
+
* <InteractionSurface>
|
|
34
|
+
* <WarningIcon label="icon button" />
|
|
35
|
+
* </InteractionSurface>
|
|
35
36
|
* </Box>
|
|
36
37
|
* ```
|
|
37
38
|
*/
|
|
@@ -57,10 +58,11 @@ var InteractionSurface = function InteractionSurface(_ref) {
|
|
|
57
58
|
var _default = InteractionSurface;
|
|
58
59
|
/**
|
|
59
60
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
60
|
-
* @codegen <<SignedSource::
|
|
61
|
+
* @codegen <<SignedSource::1bad97ad2c03ae813521797686ac780d>>
|
|
61
62
|
* @codegenId interactions
|
|
62
63
|
* @codegenCommand yarn codegen-styles
|
|
63
64
|
* @codegenParams ["background"]
|
|
65
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
64
66
|
*/
|
|
65
67
|
|
|
66
68
|
exports.default = _default;
|
|
@@ -154,6 +156,21 @@ var backgroundActiveColorMap = {
|
|
|
154
156
|
':active': {
|
|
155
157
|
backgroundColor: "var(--ds-background-information-bold-pressed, #09326C)"
|
|
156
158
|
}
|
|
159
|
+
}),
|
|
160
|
+
'elevation.surface': (0, _react2.css)({
|
|
161
|
+
':active': {
|
|
162
|
+
backgroundColor: "var(--ds-surface-pressed, #DCDFE4)"
|
|
163
|
+
}
|
|
164
|
+
}),
|
|
165
|
+
'elevation.surface.raised': (0, _react2.css)({
|
|
166
|
+
':active': {
|
|
167
|
+
backgroundColor: "var(--ds-surface-raised-pressed, #DCDFE4)"
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
'elevation.surface.overlay': (0, _react2.css)({
|
|
171
|
+
':active': {
|
|
172
|
+
backgroundColor: "var(--ds-surface-overlay-pressed, #DCDFE4)"
|
|
173
|
+
}
|
|
157
174
|
})
|
|
158
175
|
};
|
|
159
176
|
var backgroundHoverColorMap = {
|
|
@@ -246,6 +263,21 @@ var backgroundHoverColorMap = {
|
|
|
246
263
|
':hover': {
|
|
247
264
|
backgroundColor: "var(--ds-background-information-bold-hovered, #0055CC)"
|
|
248
265
|
}
|
|
266
|
+
}),
|
|
267
|
+
'elevation.surface': (0, _react2.css)({
|
|
268
|
+
':hover': {
|
|
269
|
+
backgroundColor: "var(--ds-surface-hovered, #F1F2F4)"
|
|
270
|
+
}
|
|
271
|
+
}),
|
|
272
|
+
'elevation.surface.raised': (0, _react2.css)({
|
|
273
|
+
':hover': {
|
|
274
|
+
backgroundColor: "var(--ds-surface-raised-hovered, #F1F2F4)"
|
|
275
|
+
}
|
|
276
|
+
}),
|
|
277
|
+
'elevation.surface.overlay': (0, _react2.css)({
|
|
278
|
+
':hover': {
|
|
279
|
+
backgroundColor: "var(--ds-surface-overlay-hovered, #F1F2F4)"
|
|
280
|
+
}
|
|
249
281
|
})
|
|
250
282
|
};
|
|
251
283
|
/**
|
|
@@ -9,8 +9,6 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
|
|
12
|
-
var _constants = require("../constants");
|
|
13
|
-
|
|
14
12
|
/** @jsx jsx */
|
|
15
13
|
var flexAlignItemsMap = {
|
|
16
14
|
center: (0, _react2.css)({
|
|
@@ -24,6 +22,12 @@ var flexAlignItemsMap = {
|
|
|
24
22
|
}),
|
|
25
23
|
flexEnd: (0, _react2.css)({
|
|
26
24
|
alignItems: 'flex-end'
|
|
25
|
+
}),
|
|
26
|
+
start: (0, _react2.css)({
|
|
27
|
+
alignItems: 'start'
|
|
28
|
+
}),
|
|
29
|
+
end: (0, _react2.css)({
|
|
30
|
+
alignItems: 'end'
|
|
27
31
|
})
|
|
28
32
|
};
|
|
29
33
|
var flexJustifyContentMap = {
|
|
@@ -35,6 +39,17 @@ var flexJustifyContentMap = {
|
|
|
35
39
|
}),
|
|
36
40
|
flexEnd: (0, _react2.css)({
|
|
37
41
|
justifyContent: 'flex-end'
|
|
42
|
+
}),
|
|
43
|
+
start: (0, _react2.css)({
|
|
44
|
+
justifyContent: 'start'
|
|
45
|
+
}),
|
|
46
|
+
end: (0, _react2.css)({
|
|
47
|
+
justifyContent: 'end'
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
var flexWrapMap = {
|
|
51
|
+
wrap: (0, _react2.css)({
|
|
52
|
+
flexWrap: 'wrap'
|
|
38
53
|
})
|
|
39
54
|
};
|
|
40
55
|
var baseStyles = (0, _react2.css)({
|
|
@@ -54,10 +69,13 @@ var Stack = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
54
69
|
var gap = _ref.gap,
|
|
55
70
|
alignItems = _ref.alignItems,
|
|
56
71
|
justifyContent = _ref.justifyContent,
|
|
72
|
+
flexWrap = _ref.flexWrap,
|
|
57
73
|
children = _ref.children,
|
|
74
|
+
UNSAFE_style = _ref.UNSAFE_style,
|
|
58
75
|
testId = _ref.testId;
|
|
59
76
|
return (0, _react2.jsx)("div", {
|
|
60
|
-
|
|
77
|
+
style: UNSAFE_style,
|
|
78
|
+
css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
61
79
|
"data-testid": testId,
|
|
62
80
|
ref: ref
|
|
63
81
|
}, children);
|
|
@@ -66,49 +84,50 @@ Stack.displayName = 'Stack';
|
|
|
66
84
|
var _default = Stack;
|
|
67
85
|
/**
|
|
68
86
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
69
|
-
* @codegen <<SignedSource::
|
|
87
|
+
* @codegen <<SignedSource::c486b14097494305925c3c989823d602>>
|
|
70
88
|
* @codegenId spacing
|
|
71
89
|
* @codegenCommand yarn codegen-styles
|
|
72
|
-
* @codegenParams ["
|
|
90
|
+
* @codegenParams ["rowGap"]
|
|
91
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
73
92
|
*/
|
|
74
93
|
|
|
75
94
|
exports.default = _default;
|
|
76
|
-
var
|
|
77
|
-
'
|
|
78
|
-
|
|
95
|
+
var rowGapMap = {
|
|
96
|
+
'scale.0': (0, _react2.css)({
|
|
97
|
+
rowGap: "var(--ds-scale-0, 0px)"
|
|
79
98
|
}),
|
|
80
|
-
'
|
|
81
|
-
|
|
99
|
+
'scale.025': (0, _react2.css)({
|
|
100
|
+
rowGap: "var(--ds-scale-025, 2px)"
|
|
82
101
|
}),
|
|
83
|
-
'
|
|
84
|
-
|
|
102
|
+
'scale.050': (0, _react2.css)({
|
|
103
|
+
rowGap: "var(--ds-scale-050, 4px)"
|
|
85
104
|
}),
|
|
86
|
-
'
|
|
87
|
-
|
|
105
|
+
'scale.075': (0, _react2.css)({
|
|
106
|
+
rowGap: "var(--ds-scale-075, 6px)"
|
|
88
107
|
}),
|
|
89
|
-
'
|
|
90
|
-
|
|
108
|
+
'scale.100': (0, _react2.css)({
|
|
109
|
+
rowGap: "var(--ds-scale-100, 8px)"
|
|
91
110
|
}),
|
|
92
|
-
'
|
|
93
|
-
|
|
111
|
+
'scale.150': (0, _react2.css)({
|
|
112
|
+
rowGap: "var(--ds-scale-150, 12px)"
|
|
94
113
|
}),
|
|
95
|
-
'
|
|
96
|
-
|
|
114
|
+
'scale.200': (0, _react2.css)({
|
|
115
|
+
rowGap: "var(--ds-scale-200, 16px)"
|
|
97
116
|
}),
|
|
98
|
-
'
|
|
99
|
-
|
|
117
|
+
'scale.250': (0, _react2.css)({
|
|
118
|
+
rowGap: "var(--ds-scale-250, 20px)"
|
|
100
119
|
}),
|
|
101
|
-
'
|
|
102
|
-
|
|
120
|
+
'scale.300': (0, _react2.css)({
|
|
121
|
+
rowGap: "var(--ds-scale-300, 24px)"
|
|
103
122
|
}),
|
|
104
|
-
'
|
|
105
|
-
|
|
123
|
+
'scale.400': (0, _react2.css)({
|
|
124
|
+
rowGap: "var(--ds-scale-400, 32px)"
|
|
106
125
|
}),
|
|
107
|
-
'
|
|
108
|
-
|
|
126
|
+
'scale.500': (0, _react2.css)({
|
|
127
|
+
rowGap: "var(--ds-scale-500, 40px)"
|
|
109
128
|
}),
|
|
110
|
-
'
|
|
111
|
-
|
|
129
|
+
'scale.600': (0, _react2.css)({
|
|
130
|
+
rowGap: "var(--ds-scale-600, 48px)"
|
|
112
131
|
})
|
|
113
132
|
};
|
|
114
133
|
/**
|
|
@@ -7,112 +7,135 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react = require("react");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react2 = require("@emotion/react");
|
|
15
15
|
|
|
16
16
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
17
17
|
|
|
18
|
-
var _colorMap = require("../internal/color-map");
|
|
18
|
+
var _colorMap = _interopRequireDefault(require("../internal/color-map"));
|
|
19
19
|
|
|
20
20
|
var _surfaceProvider = require("./surface-provider");
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
25
|
-
|
|
22
|
+
var _excluded = ["children"];
|
|
26
23
|
var asAllowlist = ['span', 'div', 'p'];
|
|
27
24
|
var fontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";
|
|
28
25
|
var fontSizeMap = {
|
|
29
|
-
'11px': (0,
|
|
26
|
+
'11px': (0, _react2.css)({
|
|
30
27
|
fontSize: '11px'
|
|
31
28
|
}),
|
|
32
|
-
'12px': (0,
|
|
29
|
+
'12px': (0, _react2.css)({
|
|
33
30
|
fontSize: '12px'
|
|
34
31
|
}),
|
|
35
|
-
'14px': (0,
|
|
32
|
+
'14px': (0, _react2.css)({
|
|
36
33
|
fontSize: '14px'
|
|
37
34
|
})
|
|
38
35
|
};
|
|
39
36
|
// NOTE: can't use numbers as keys or Constellation won't build. Weird one.
|
|
40
37
|
var fontWeightMap = {
|
|
41
|
-
'400': (0,
|
|
38
|
+
'400': (0, _react2.css)({
|
|
42
39
|
fontWeight: 400
|
|
43
40
|
}),
|
|
44
|
-
'500': (0,
|
|
41
|
+
'500': (0, _react2.css)({
|
|
45
42
|
fontWeight: 500
|
|
46
43
|
}),
|
|
47
|
-
'
|
|
44
|
+
'600': (0, _react2.css)({
|
|
45
|
+
fontWeight: 600
|
|
46
|
+
}),
|
|
47
|
+
'700': (0, _react2.css)({
|
|
48
48
|
fontWeight: 700
|
|
49
49
|
})
|
|
50
50
|
};
|
|
51
51
|
var lineHeightMap = {
|
|
52
|
-
'12px': (0,
|
|
52
|
+
'12px': (0, _react2.css)({
|
|
53
53
|
lineHeight: '12px'
|
|
54
54
|
}),
|
|
55
|
-
'16px': (0,
|
|
55
|
+
'16px': (0, _react2.css)({
|
|
56
56
|
lineHeight: '16px'
|
|
57
57
|
}),
|
|
58
|
-
'20px': (0,
|
|
58
|
+
'20px': (0, _react2.css)({
|
|
59
59
|
lineHeight: '20px'
|
|
60
60
|
}),
|
|
61
|
-
'24px': (0,
|
|
61
|
+
'24px': (0, _react2.css)({
|
|
62
62
|
lineHeight: '24px'
|
|
63
63
|
}),
|
|
64
|
-
'28px': (0,
|
|
64
|
+
'28px': (0, _react2.css)({
|
|
65
65
|
lineHeight: '28px'
|
|
66
66
|
}),
|
|
67
|
-
'32px': (0,
|
|
67
|
+
'32px': (0, _react2.css)({
|
|
68
68
|
lineHeight: '32px'
|
|
69
69
|
}),
|
|
70
|
-
'40px': (0,
|
|
70
|
+
'40px': (0, _react2.css)({
|
|
71
71
|
lineHeight: '40px'
|
|
72
72
|
})
|
|
73
73
|
};
|
|
74
74
|
var textAlignMap = {
|
|
75
|
-
center: (0,
|
|
75
|
+
center: (0, _react2.css)({
|
|
76
76
|
textAlign: 'center'
|
|
77
77
|
}),
|
|
78
|
-
end: (0,
|
|
78
|
+
end: (0, _react2.css)({
|
|
79
79
|
textAlign: 'end'
|
|
80
80
|
}),
|
|
81
|
-
start: (0,
|
|
81
|
+
start: (0, _react2.css)({
|
|
82
82
|
textAlign: 'start'
|
|
83
83
|
})
|
|
84
84
|
};
|
|
85
85
|
var textTransformMap = {
|
|
86
|
-
none: (0,
|
|
86
|
+
none: (0, _react2.css)({
|
|
87
87
|
textTransform: 'none'
|
|
88
88
|
}),
|
|
89
|
-
lowercase: (0,
|
|
89
|
+
lowercase: (0, _react2.css)({
|
|
90
90
|
textTransform: 'lowercase'
|
|
91
91
|
}),
|
|
92
|
-
uppercase: (0,
|
|
92
|
+
uppercase: (0, _react2.css)({
|
|
93
93
|
textTransform: 'uppercase'
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
96
|
var verticalAlignMap = {
|
|
97
|
-
top: (0,
|
|
97
|
+
top: (0, _react2.css)({
|
|
98
98
|
verticalAlign: 'top'
|
|
99
99
|
}),
|
|
100
|
-
middle: (0,
|
|
100
|
+
middle: (0, _react2.css)({
|
|
101
101
|
verticalAlign: 'middle'
|
|
102
102
|
}),
|
|
103
|
-
bottom: (0,
|
|
103
|
+
bottom: (0, _react2.css)({
|
|
104
104
|
verticalAlign: 'bottom'
|
|
105
105
|
})
|
|
106
106
|
};
|
|
107
|
-
var baseStyles = (0,
|
|
107
|
+
var baseStyles = (0, _react2.css)({
|
|
108
108
|
boxSizing: 'border-box',
|
|
109
|
+
margin: '0px',
|
|
110
|
+
padding: '0px',
|
|
109
111
|
fontFamily: fontFamily
|
|
110
112
|
});
|
|
111
|
-
var truncateStyles = (0,
|
|
113
|
+
var truncateStyles = (0, _react2.css)({
|
|
112
114
|
overflow: 'hidden',
|
|
113
115
|
textOverflow: 'ellipsis',
|
|
114
116
|
whiteSpace: 'nowrap'
|
|
115
117
|
});
|
|
118
|
+
/**
|
|
119
|
+
* 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.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
var useColor = function useColor(colorProp) {
|
|
123
|
+
var surface = (0, _surfaceProvider.useSurface)();
|
|
124
|
+
var inverseTextColor = _colorMap.default[surface];
|
|
125
|
+
/**
|
|
126
|
+
* Where the color of the surface is inverted we override the user choice
|
|
127
|
+
* as there is no valid choice that is not covered by the override.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
var color = inverseTextColor !== null && inverseTextColor !== void 0 ? inverseTextColor : colorProp;
|
|
131
|
+
return color;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
var HasTextAncestorContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
135
|
+
|
|
136
|
+
var useHasTextAncestor = function useHasTextAncestor() {
|
|
137
|
+
return (0, _react.useContext)(HasTextAncestorContext);
|
|
138
|
+
};
|
|
116
139
|
/**
|
|
117
140
|
* __Text__
|
|
118
141
|
*
|
|
@@ -123,88 +146,96 @@ var truncateStyles = (0, _react.css)({
|
|
|
123
146
|
* @internal
|
|
124
147
|
*/
|
|
125
148
|
|
|
126
|
-
var Text = function Text(_ref) {
|
|
127
|
-
var _ref$as = _ref.as,
|
|
128
|
-
Component = _ref$as === void 0 ? 'span' : _ref$as,
|
|
129
|
-
children = _ref.children,
|
|
130
|
-
colorTuple = _ref.color,
|
|
131
|
-
fontSize = _ref.fontSize,
|
|
132
|
-
fontWeight = _ref.fontWeight,
|
|
133
|
-
lineHeight = _ref.lineHeight,
|
|
134
|
-
_ref$shouldTruncate = _ref.shouldTruncate,
|
|
135
|
-
shouldTruncate = _ref$shouldTruncate === void 0 ? false : _ref$shouldTruncate,
|
|
136
|
-
textAlign = _ref.textAlign,
|
|
137
|
-
textTransform = _ref.textTransform,
|
|
138
|
-
verticalAlign = _ref.verticalAlign,
|
|
139
|
-
testId = _ref.testId,
|
|
140
|
-
UNSAFE_style = _ref.UNSAFE_style;
|
|
141
|
-
var surface = (0, _surfaceProvider.useSurface)(); // @ts-ignore
|
|
142
|
-
|
|
143
|
-
var _ref2 = colorTuple || [],
|
|
144
|
-
_ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
145
|
-
_ref3$ = _ref3[0],
|
|
146
|
-
color = _ref3$ === void 0 ? _colorMap.colorMap[surface] : _ref3$,
|
|
147
|
-
fallback = _ref3[1];
|
|
148
149
|
|
|
150
|
+
var Text = function Text(_ref) {
|
|
151
|
+
var children = _ref.children,
|
|
152
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
153
|
+
var _props$as = props.as,
|
|
154
|
+
Component = _props$as === void 0 ? 'span' : _props$as,
|
|
155
|
+
colorProp = props.color,
|
|
156
|
+
fontSize = props.fontSize,
|
|
157
|
+
fontWeight = props.fontWeight,
|
|
158
|
+
lineHeight = props.lineHeight,
|
|
159
|
+
_props$shouldTruncate = props.shouldTruncate,
|
|
160
|
+
shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
|
|
161
|
+
textAlign = props.textAlign,
|
|
162
|
+
textTransform = props.textTransform,
|
|
163
|
+
verticalAlign = props.verticalAlign,
|
|
164
|
+
testId = props.testId,
|
|
165
|
+
UNSAFE_style = props.UNSAFE_style;
|
|
149
166
|
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
167
|
+
var color = useColor(colorProp);
|
|
168
|
+
var isWrapped = useHasTextAncestor();
|
|
169
|
+
/**
|
|
170
|
+
* If the text is already wrapped and applies no props we can just
|
|
171
|
+
* render the children directly as a fragment.
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
if (isWrapped && Object.keys(props).length === 0) {
|
|
175
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var component = (0, _react2.jsx)(Component, {
|
|
179
|
+
style: UNSAFE_style,
|
|
154
180
|
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]],
|
|
155
181
|
"data-testid": testId
|
|
156
182
|
}, children);
|
|
183
|
+
return isWrapped ? // no need to re-apply context if the text is already wrapped
|
|
184
|
+
component : (0, _react2.jsx)(HasTextAncestorContext.Provider, {
|
|
185
|
+
value: true
|
|
186
|
+
}, component);
|
|
157
187
|
};
|
|
158
188
|
|
|
159
189
|
var _default = Text;
|
|
160
190
|
/**
|
|
161
191
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
162
|
-
* @codegen <<SignedSource::
|
|
192
|
+
* @codegen <<SignedSource::21771f01de3c37646642de03274f0738>>
|
|
163
193
|
* @codegenId colors
|
|
164
194
|
* @codegenCommand yarn codegen-styles
|
|
165
195
|
* @codegenParams ["text"]
|
|
196
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::0c1fe9904b2ff2465a532b97ab76491e>>
|
|
166
197
|
*/
|
|
167
198
|
|
|
168
199
|
exports.default = _default;
|
|
169
200
|
var textColorMap = {
|
|
170
|
-
'color.text': (0,
|
|
171
|
-
color: "var(--ds-text,
|
|
201
|
+
'color.text': (0, _react2.css)({
|
|
202
|
+
color: "var(--ds-text, #172B4D)"
|
|
172
203
|
}),
|
|
173
|
-
subtle: (0,
|
|
174
|
-
color: "var(--ds-text-subtle,
|
|
204
|
+
subtle: (0, _react2.css)({
|
|
205
|
+
color: "var(--ds-text-subtle, #42526E)"
|
|
175
206
|
}),
|
|
176
|
-
subtlest: (0,
|
|
177
|
-
color: "var(--ds-text-subtlest,
|
|
207
|
+
subtlest: (0, _react2.css)({
|
|
208
|
+
color: "var(--ds-text-subtlest, #7A869A)"
|
|
178
209
|
}),
|
|
179
|
-
disabled: (0,
|
|
180
|
-
color: "var(--ds-text-disabled,
|
|
210
|
+
disabled: (0, _react2.css)({
|
|
211
|
+
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
181
212
|
}),
|
|
182
|
-
inverse: (0,
|
|
183
|
-
color: "var(--ds-text-inverse,
|
|
213
|
+
inverse: (0, _react2.css)({
|
|
214
|
+
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
184
215
|
}),
|
|
185
|
-
brand: (0,
|
|
186
|
-
color: "var(--ds-text-brand,
|
|
216
|
+
brand: (0, _react2.css)({
|
|
217
|
+
color: "var(--ds-text-brand, #0065FF)"
|
|
187
218
|
}),
|
|
188
|
-
selected: (0,
|
|
189
|
-
color: "var(--ds-text-selected,
|
|
219
|
+
selected: (0, _react2.css)({
|
|
220
|
+
color: "var(--ds-text-selected, #0052CC)"
|
|
190
221
|
}),
|
|
191
|
-
danger: (0,
|
|
192
|
-
color: "var(--ds-text-danger,
|
|
222
|
+
danger: (0, _react2.css)({
|
|
223
|
+
color: "var(--ds-text-danger, #DE350B)"
|
|
193
224
|
}),
|
|
194
|
-
warning: (0,
|
|
195
|
-
color: "var(--ds-text-warning,
|
|
225
|
+
warning: (0, _react2.css)({
|
|
226
|
+
color: "var(--ds-text-warning, #974F0C)"
|
|
196
227
|
}),
|
|
197
|
-
'warning.inverse': (0,
|
|
198
|
-
color: "var(--ds-text-warning-inverse,
|
|
228
|
+
'warning.inverse': (0, _react2.css)({
|
|
229
|
+
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
199
230
|
}),
|
|
200
|
-
success: (0,
|
|
201
|
-
color: "var(--ds-text-success,
|
|
231
|
+
success: (0, _react2.css)({
|
|
232
|
+
color: "var(--ds-text-success, #006644)"
|
|
202
233
|
}),
|
|
203
|
-
discovery: (0,
|
|
204
|
-
color: "var(--ds-text-discovery,
|
|
234
|
+
discovery: (0, _react2.css)({
|
|
235
|
+
color: "var(--ds-text-discovery, #403294)"
|
|
205
236
|
}),
|
|
206
|
-
information: (0,
|
|
207
|
-
color: "var(--ds-text-information,
|
|
237
|
+
information: (0, _react2.css)({
|
|
238
|
+
color: "var(--ds-text-information, #0052CC)"
|
|
208
239
|
})
|
|
209
240
|
};
|
|
210
241
|
/**
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,12 +23,6 @@ Object.defineProperty(exports, "UNSAFE_InteractionSurface", {
|
|
|
23
23
|
return _interactionSurface.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "UNSAFE_SPACING_SCALE", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function get() {
|
|
29
|
-
return _constants.SPACING_SCALE;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
26
|
Object.defineProperty(exports, "UNSAFE_Stack", {
|
|
33
27
|
enumerable: true,
|
|
34
28
|
get: function get() {
|
|
@@ -50,6 +44,4 @@ var _inline = _interopRequireDefault(require("./components/inline.partial"));
|
|
|
50
44
|
|
|
51
45
|
var _stack = _interopRequireDefault(require("./components/stack.partial"));
|
|
52
46
|
|
|
53
|
-
var _interactionSurface = _interopRequireDefault(require("./components/interaction-surface.partial"));
|
|
54
|
-
|
|
55
|
-
var _constants = require("./constants");
|
|
47
|
+
var _interactionSurface = _interopRequireDefault(require("./components/interaction-surface.partial"));
|