@atlaskit/ds-explorations 0.1.5 → 1.1.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 +28 -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 +117 -86
- 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 +74 -36
- 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 +79 -47
- 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 +9 -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 +9 -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 +73 -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 +188 -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 +32 -1
- 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 +82 -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 +177 -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
|
@@ -7,20 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
10
|
var _react = require("react");
|
|
13
11
|
|
|
14
12
|
var _react2 = require("@emotion/react");
|
|
15
13
|
|
|
16
|
-
var _constants = require("../constants");
|
|
17
|
-
|
|
18
14
|
var _text = _interopRequireDefault(require("./text.partial"));
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
16
|
+
/** @jsx jsx */
|
|
24
17
|
var flexAlignItemsMap = {
|
|
25
18
|
center: (0, _react2.css)({
|
|
26
19
|
alignItems: 'center'
|
|
@@ -87,7 +80,7 @@ var Inline = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
87
80
|
testId = _ref.testId;
|
|
88
81
|
var dividerComponent = typeof divider === 'string' ? (0, _react2.jsx)(_text.default, null, divider) : divider;
|
|
89
82
|
return (0, _react2.jsx)("div", {
|
|
90
|
-
style:
|
|
83
|
+
style: UNSAFE_style,
|
|
91
84
|
css: [baseStyles, gap && columnGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
92
85
|
"data-testid": testId,
|
|
93
86
|
ref: ref
|
|
@@ -99,49 +92,50 @@ Inline.displayName = 'Inline';
|
|
|
99
92
|
var _default = Inline;
|
|
100
93
|
/**
|
|
101
94
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
102
|
-
* @codegen <<SignedSource::
|
|
95
|
+
* @codegen <<SignedSource::2dd7c6b8450b1bbd1fb8fabf12fffa33>>
|
|
103
96
|
* @codegenId spacing
|
|
104
97
|
* @codegenCommand yarn codegen-styles
|
|
105
98
|
* @codegenParams ["columnGap"]
|
|
99
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
106
100
|
*/
|
|
107
101
|
|
|
108
102
|
exports.default = _default;
|
|
109
103
|
var columnGapMap = {
|
|
110
|
-
'
|
|
111
|
-
columnGap:
|
|
104
|
+
'scale.0': (0, _react2.css)({
|
|
105
|
+
columnGap: "var(--ds-scale-0, 0px)"
|
|
112
106
|
}),
|
|
113
|
-
'
|
|
114
|
-
columnGap:
|
|
107
|
+
'scale.025': (0, _react2.css)({
|
|
108
|
+
columnGap: "var(--ds-scale-025, 2px)"
|
|
115
109
|
}),
|
|
116
|
-
'
|
|
117
|
-
columnGap:
|
|
110
|
+
'scale.050': (0, _react2.css)({
|
|
111
|
+
columnGap: "var(--ds-scale-050, 4px)"
|
|
118
112
|
}),
|
|
119
|
-
'
|
|
120
|
-
columnGap:
|
|
113
|
+
'scale.075': (0, _react2.css)({
|
|
114
|
+
columnGap: "var(--ds-scale-075, 6px)"
|
|
121
115
|
}),
|
|
122
|
-
'
|
|
123
|
-
columnGap:
|
|
116
|
+
'scale.100': (0, _react2.css)({
|
|
117
|
+
columnGap: "var(--ds-scale-100, 8px)"
|
|
124
118
|
}),
|
|
125
|
-
'
|
|
126
|
-
columnGap:
|
|
119
|
+
'scale.150': (0, _react2.css)({
|
|
120
|
+
columnGap: "var(--ds-scale-150, 12px)"
|
|
127
121
|
}),
|
|
128
|
-
'
|
|
129
|
-
columnGap:
|
|
122
|
+
'scale.200': (0, _react2.css)({
|
|
123
|
+
columnGap: "var(--ds-scale-200, 16px)"
|
|
130
124
|
}),
|
|
131
|
-
'
|
|
132
|
-
columnGap:
|
|
125
|
+
'scale.250': (0, _react2.css)({
|
|
126
|
+
columnGap: "var(--ds-scale-250, 20px)"
|
|
133
127
|
}),
|
|
134
|
-
'
|
|
135
|
-
columnGap:
|
|
128
|
+
'scale.300': (0, _react2.css)({
|
|
129
|
+
columnGap: "var(--ds-scale-300, 24px)"
|
|
136
130
|
}),
|
|
137
|
-
'
|
|
138
|
-
columnGap:
|
|
131
|
+
'scale.400': (0, _react2.css)({
|
|
132
|
+
columnGap: "var(--ds-scale-400, 32px)"
|
|
139
133
|
}),
|
|
140
|
-
'
|
|
141
|
-
columnGap:
|
|
134
|
+
'scale.500': (0, _react2.css)({
|
|
135
|
+
columnGap: "var(--ds-scale-500, 40px)"
|
|
142
136
|
}),
|
|
143
|
-
'
|
|
144
|
-
columnGap:
|
|
137
|
+
'scale.600': (0, _react2.css)({
|
|
138
|
+
columnGap: "var(--ds-scale-600, 48px)"
|
|
145
139
|
})
|
|
146
140
|
};
|
|
147
141
|
/**
|
|
@@ -58,10 +58,11 @@ var InteractionSurface = function InteractionSurface(_ref) {
|
|
|
58
58
|
var _default = InteractionSurface;
|
|
59
59
|
/**
|
|
60
60
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
61
|
-
* @codegen <<SignedSource::
|
|
61
|
+
* @codegen <<SignedSource::5289ea44928c279ad02274850623c9d1>>
|
|
62
62
|
* @codegenId interactions
|
|
63
63
|
* @codegenCommand yarn codegen-styles
|
|
64
64
|
* @codegenParams ["background"]
|
|
65
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
65
66
|
*/
|
|
66
67
|
|
|
67
68
|
exports.default = _default;
|
|
@@ -155,6 +156,21 @@ var backgroundActiveColorMap = {
|
|
|
155
156
|
':active': {
|
|
156
157
|
backgroundColor: "var(--ds-background-information-bold-pressed, #09326C)"
|
|
157
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
|
+
}
|
|
158
174
|
})
|
|
159
175
|
};
|
|
160
176
|
var backgroundHoverColorMap = {
|
|
@@ -247,6 +263,21 @@ var backgroundHoverColorMap = {
|
|
|
247
263
|
':hover': {
|
|
248
264
|
backgroundColor: "var(--ds-background-information-bold-hovered, #0055CC)"
|
|
249
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
|
+
}
|
|
250
281
|
})
|
|
251
282
|
};
|
|
252
283
|
/**
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
8
|
var _react = require("react");
|
|
13
9
|
|
|
14
10
|
var _react2 = require("@emotion/react");
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
12
|
+
/** @jsx jsx */
|
|
22
13
|
var flexAlignItemsMap = {
|
|
23
14
|
center: (0, _react2.css)({
|
|
24
15
|
alignItems: 'center'
|
|
@@ -83,7 +74,7 @@ var Stack = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
83
74
|
UNSAFE_style = _ref.UNSAFE_style,
|
|
84
75
|
testId = _ref.testId;
|
|
85
76
|
return (0, _react2.jsx)("div", {
|
|
86
|
-
style:
|
|
77
|
+
style: UNSAFE_style,
|
|
87
78
|
css: [baseStyles, gap && rowGapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], flexWrap && flexWrapMap[flexWrap]],
|
|
88
79
|
"data-testid": testId,
|
|
89
80
|
ref: ref
|
|
@@ -93,49 +84,50 @@ Stack.displayName = 'Stack';
|
|
|
93
84
|
var _default = Stack;
|
|
94
85
|
/**
|
|
95
86
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
96
|
-
* @codegen <<SignedSource::
|
|
87
|
+
* @codegen <<SignedSource::5d82d50cdeb38664c4c45d02608e447d>>
|
|
97
88
|
* @codegenId spacing
|
|
98
89
|
* @codegenCommand yarn codegen-styles
|
|
99
90
|
* @codegenParams ["rowGap"]
|
|
91
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
100
92
|
*/
|
|
101
93
|
|
|
102
94
|
exports.default = _default;
|
|
103
95
|
var rowGapMap = {
|
|
104
|
-
'
|
|
105
|
-
rowGap:
|
|
96
|
+
'scale.0': (0, _react2.css)({
|
|
97
|
+
rowGap: "var(--ds-scale-0, 0px)"
|
|
106
98
|
}),
|
|
107
|
-
'
|
|
108
|
-
rowGap:
|
|
99
|
+
'scale.025': (0, _react2.css)({
|
|
100
|
+
rowGap: "var(--ds-scale-025, 2px)"
|
|
109
101
|
}),
|
|
110
|
-
'
|
|
111
|
-
rowGap:
|
|
102
|
+
'scale.050': (0, _react2.css)({
|
|
103
|
+
rowGap: "var(--ds-scale-050, 4px)"
|
|
112
104
|
}),
|
|
113
|
-
'
|
|
114
|
-
rowGap:
|
|
105
|
+
'scale.075': (0, _react2.css)({
|
|
106
|
+
rowGap: "var(--ds-scale-075, 6px)"
|
|
115
107
|
}),
|
|
116
|
-
'
|
|
117
|
-
rowGap:
|
|
108
|
+
'scale.100': (0, _react2.css)({
|
|
109
|
+
rowGap: "var(--ds-scale-100, 8px)"
|
|
118
110
|
}),
|
|
119
|
-
'
|
|
120
|
-
rowGap:
|
|
111
|
+
'scale.150': (0, _react2.css)({
|
|
112
|
+
rowGap: "var(--ds-scale-150, 12px)"
|
|
121
113
|
}),
|
|
122
|
-
'
|
|
123
|
-
rowGap:
|
|
114
|
+
'scale.200': (0, _react2.css)({
|
|
115
|
+
rowGap: "var(--ds-scale-200, 16px)"
|
|
124
116
|
}),
|
|
125
|
-
'
|
|
126
|
-
rowGap:
|
|
117
|
+
'scale.250': (0, _react2.css)({
|
|
118
|
+
rowGap: "var(--ds-scale-250, 20px)"
|
|
127
119
|
}),
|
|
128
|
-
'
|
|
129
|
-
rowGap:
|
|
120
|
+
'scale.300': (0, _react2.css)({
|
|
121
|
+
rowGap: "var(--ds-scale-300, 24px)"
|
|
130
122
|
}),
|
|
131
|
-
'
|
|
132
|
-
rowGap:
|
|
123
|
+
'scale.400': (0, _react2.css)({
|
|
124
|
+
rowGap: "var(--ds-scale-400, 32px)"
|
|
133
125
|
}),
|
|
134
|
-
'
|
|
135
|
-
rowGap:
|
|
126
|
+
'scale.500': (0, _react2.css)({
|
|
127
|
+
rowGap: "var(--ds-scale-500, 40px)"
|
|
136
128
|
}),
|
|
137
|
-
'
|
|
138
|
-
rowGap:
|
|
129
|
+
'scale.600': (0, _react2.css)({
|
|
130
|
+
rowGap: "var(--ds-scale-600, 48px)"
|
|
139
131
|
})
|
|
140
132
|
};
|
|
141
133
|
/**
|
|
@@ -7,114 +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
109
|
margin: '0px',
|
|
110
110
|
padding: '0px',
|
|
111
111
|
fontFamily: fontFamily
|
|
112
112
|
});
|
|
113
|
-
var truncateStyles = (0,
|
|
113
|
+
var truncateStyles = (0, _react2.css)({
|
|
114
114
|
overflow: 'hidden',
|
|
115
115
|
textOverflow: 'ellipsis',
|
|
116
116
|
whiteSpace: 'nowrap'
|
|
117
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
|
+
};
|
|
118
139
|
/**
|
|
119
140
|
* __Text__
|
|
120
141
|
*
|
|
@@ -125,88 +146,98 @@ var truncateStyles = (0, _react.css)({
|
|
|
125
146
|
* @internal
|
|
126
147
|
*/
|
|
127
148
|
|
|
128
|
-
var Text = function Text(_ref) {
|
|
129
|
-
var _ref$as = _ref.as,
|
|
130
|
-
Component = _ref$as === void 0 ? 'span' : _ref$as,
|
|
131
|
-
children = _ref.children,
|
|
132
|
-
colorTuple = _ref.color,
|
|
133
|
-
fontSize = _ref.fontSize,
|
|
134
|
-
fontWeight = _ref.fontWeight,
|
|
135
|
-
lineHeight = _ref.lineHeight,
|
|
136
|
-
_ref$shouldTruncate = _ref.shouldTruncate,
|
|
137
|
-
shouldTruncate = _ref$shouldTruncate === void 0 ? false : _ref$shouldTruncate,
|
|
138
|
-
textAlign = _ref.textAlign,
|
|
139
|
-
textTransform = _ref.textTransform,
|
|
140
|
-
verticalAlign = _ref.verticalAlign,
|
|
141
|
-
testId = _ref.testId,
|
|
142
|
-
UNSAFE_style = _ref.UNSAFE_style;
|
|
143
|
-
var surface = (0, _surfaceProvider.useSurface)(); // @ts-ignore
|
|
144
|
-
|
|
145
|
-
var _ref2 = colorTuple || [],
|
|
146
|
-
_ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
147
|
-
_ref3$ = _ref3[0],
|
|
148
|
-
color = _ref3$ === void 0 ? _colorMap.colorMap[surface] : _ref3$,
|
|
149
|
-
fallback = _ref3[1];
|
|
150
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,
|
|
166
|
+
id = props.id;
|
|
151
167
|
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
168
|
+
var color = useColor(colorProp);
|
|
169
|
+
var isWrapped = useHasTextAncestor();
|
|
170
|
+
/**
|
|
171
|
+
* If the text is already wrapped and applies no props we can just
|
|
172
|
+
* render the children directly as a fragment.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
if (isWrapped && Object.keys(props).length === 0) {
|
|
176
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
var component = (0, _react2.jsx)(Component, {
|
|
180
|
+
style: UNSAFE_style,
|
|
156
181
|
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]],
|
|
157
|
-
"data-testid": testId
|
|
182
|
+
"data-testid": testId,
|
|
183
|
+
id: id
|
|
158
184
|
}, children);
|
|
185
|
+
return isWrapped ? // no need to re-apply context if the text is already wrapped
|
|
186
|
+
component : (0, _react2.jsx)(HasTextAncestorContext.Provider, {
|
|
187
|
+
value: true
|
|
188
|
+
}, component);
|
|
159
189
|
};
|
|
160
190
|
|
|
161
191
|
var _default = Text;
|
|
162
192
|
/**
|
|
163
193
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
164
|
-
* @codegen <<SignedSource::
|
|
194
|
+
* @codegen <<SignedSource::3d4d694e49f72e72f83ec28c1feafb76>>
|
|
165
195
|
* @codegenId colors
|
|
166
196
|
* @codegenCommand yarn codegen-styles
|
|
167
197
|
* @codegenParams ["text"]
|
|
198
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
168
199
|
*/
|
|
169
200
|
|
|
170
201
|
exports.default = _default;
|
|
171
202
|
var textColorMap = {
|
|
172
|
-
'color.text': (0,
|
|
173
|
-
color: "var(--ds-text,
|
|
203
|
+
'color.text': (0, _react2.css)({
|
|
204
|
+
color: "var(--ds-text, #172B4D)"
|
|
174
205
|
}),
|
|
175
|
-
subtle: (0,
|
|
176
|
-
color: "var(--ds-text-subtle,
|
|
206
|
+
subtle: (0, _react2.css)({
|
|
207
|
+
color: "var(--ds-text-subtle, #42526E)"
|
|
177
208
|
}),
|
|
178
|
-
subtlest: (0,
|
|
179
|
-
color: "var(--ds-text-subtlest,
|
|
209
|
+
subtlest: (0, _react2.css)({
|
|
210
|
+
color: "var(--ds-text-subtlest, #7A869A)"
|
|
180
211
|
}),
|
|
181
|
-
disabled: (0,
|
|
182
|
-
color: "var(--ds-text-disabled,
|
|
212
|
+
disabled: (0, _react2.css)({
|
|
213
|
+
color: "var(--ds-text-disabled, #A5ADBA)"
|
|
183
214
|
}),
|
|
184
|
-
inverse: (0,
|
|
185
|
-
color: "var(--ds-text-inverse,
|
|
215
|
+
inverse: (0, _react2.css)({
|
|
216
|
+
color: "var(--ds-text-inverse, #FFFFFF)"
|
|
186
217
|
}),
|
|
187
|
-
brand: (0,
|
|
188
|
-
color: "var(--ds-text-brand,
|
|
218
|
+
brand: (0, _react2.css)({
|
|
219
|
+
color: "var(--ds-text-brand, #0065FF)"
|
|
189
220
|
}),
|
|
190
|
-
selected: (0,
|
|
191
|
-
color: "var(--ds-text-selected,
|
|
221
|
+
selected: (0, _react2.css)({
|
|
222
|
+
color: "var(--ds-text-selected, #0052CC)"
|
|
192
223
|
}),
|
|
193
|
-
danger: (0,
|
|
194
|
-
color: "var(--ds-text-danger,
|
|
224
|
+
danger: (0, _react2.css)({
|
|
225
|
+
color: "var(--ds-text-danger, #DE350B)"
|
|
195
226
|
}),
|
|
196
|
-
warning: (0,
|
|
197
|
-
color: "var(--ds-text-warning,
|
|
227
|
+
warning: (0, _react2.css)({
|
|
228
|
+
color: "var(--ds-text-warning, #974F0C)"
|
|
198
229
|
}),
|
|
199
|
-
'warning.inverse': (0,
|
|
200
|
-
color: "var(--ds-text-warning-inverse,
|
|
230
|
+
'warning.inverse': (0, _react2.css)({
|
|
231
|
+
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
201
232
|
}),
|
|
202
|
-
success: (0,
|
|
203
|
-
color: "var(--ds-text-success,
|
|
233
|
+
success: (0, _react2.css)({
|
|
234
|
+
color: "var(--ds-text-success, #006644)"
|
|
204
235
|
}),
|
|
205
|
-
discovery: (0,
|
|
206
|
-
color: "var(--ds-text-discovery,
|
|
236
|
+
discovery: (0, _react2.css)({
|
|
237
|
+
color: "var(--ds-text-discovery, #403294)"
|
|
207
238
|
}),
|
|
208
|
-
information: (0,
|
|
209
|
-
color: "var(--ds-text-information,
|
|
239
|
+
information: (0, _react2.css)({
|
|
240
|
+
color: "var(--ds-text-information, #0052CC)"
|
|
210
241
|
})
|
|
211
242
|
};
|
|
212
243
|
/**
|
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"));
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* The color map is used to map a background color token to a matching text color that will meet contrast.
|
|
12
12
|
*
|
|
13
|
-
* @codegen <<SignedSource::
|
|
13
|
+
* @codegen <<SignedSource::b80b2a3d75c3215df8be35a6f5bda68d>>
|
|
14
14
|
* @codegenCommand yarn codegen-styles
|
|
15
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::07ef29d58a2b23af8b098515466d7e22>>
|
|
15
16
|
*/
|
|
16
|
-
var
|
|
17
|
+
var _default = {
|
|
17
18
|
'neutral.bold': 'inverse',
|
|
18
19
|
'neutral.bold.hovered': 'inverse',
|
|
19
20
|
'neutral.bold.pressed': 'inverse',
|
|
@@ -39,4 +40,4 @@ var colorMap = {
|
|
|
39
40
|
'information.bold.hovered': 'inverse',
|
|
40
41
|
'information.bold.pressed': 'inverse'
|
|
41
42
|
};
|
|
42
|
-
exports.
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.spacingScale = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
10
|
+
*
|
|
11
|
+
* Some artifact
|
|
12
|
+
*
|
|
13
|
+
* @codegen <<SignedSource::caecb926afa82b027fba396074de5c2c>>
|
|
14
|
+
* @codegenCommand yarn codegen-styles
|
|
15
|
+
*/
|
|
16
|
+
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'];
|
|
17
|
+
exports.spacingScale = spacingScale;
|