@atlaskit/ds-explorations 0.1.0 → 0.1.3
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 +23 -0
- package/dist/cjs/components/box.partial.js +220 -182
- package/dist/cjs/components/inline.partial.js +28 -24
- package/dist/cjs/components/interaction-surface.partial.js +253 -0
- package/dist/cjs/components/stack.partial.js +26 -22
- package/dist/cjs/components/surface-provider.js +31 -0
- package/dist/cjs/components/text.partial.js +79 -36
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/internal/color-map.js +42 -0
- package/dist/cjs/internal/role-to-element.js +36 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/box.partial.js +91 -60
- package/dist/es2019/components/inline.partial.js +6 -2
- package/dist/es2019/components/interaction-surface.partial.js +243 -0
- package/dist/es2019/components/stack.partial.js +6 -2
- package/dist/es2019/components/surface-provider.js +20 -0
- package/dist/es2019/components/text.partial.js +48 -9
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/internal/color-map.js +34 -0
- package/dist/es2019/internal/role-to-element.js +28 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/box.partial.js +100 -62
- package/dist/esm/components/inline.partial.js +6 -2
- package/dist/esm/components/interaction-surface.partial.js +242 -0
- package/dist/esm/components/stack.partial.js +6 -2
- package/dist/esm/components/surface-provider.js +20 -0
- package/dist/esm/components/text.partial.js +49 -9
- package/dist/esm/constants.js +1 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/internal/color-map.js +34 -0
- package/dist/esm/internal/role-to-element.js +28 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.partial.d.ts +99 -78
- package/dist/types/components/inline.partial.d.ts +7 -7
- package/dist/types/components/interaction-surface.partial.d.ts +45 -0
- package/dist/types/components/stack.partial.d.ts +7 -7
- package/dist/types/components/surface-provider.d.ts +15 -0
- package/dist/types/components/text.partial.d.ts +58 -34
- package/dist/types/components/types.d.ts +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/internal/color-map.d.ts +34 -0
- package/dist/types/internal/role-to-element.d.ts +32 -0
- package/examples/02-text.tsx +34 -13
- package/examples/05-badge.tsx +1 -1
- package/examples/06-section-message.tsx +1 -1
- package/examples/07-comment.tsx +1 -1
- package/examples/08-lozenge.tsx +2 -2
- package/examples/99-interactions.tsx +175 -0
- package/package.json +8 -5
- package/report.api.md +223 -136
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +164 -3
- package/scripts/__tests__/codegen.test.tsx +5 -0
- package/scripts/codegen-styles.tsx +46 -14
- package/scripts/color-codegen-template.tsx +1 -1
- package/scripts/color-map-template.tsx +52 -0
- package/scripts/interaction-codegen.tsx +109 -0
- package/scripts/utils.tsx +5 -1
- package/src/components/__tests__/unit/box.test.tsx +31 -1
- package/src/components/__tests__/unit/interaction-suface.test.tsx +70 -0
- package/src/components/__tests__/unit/text.test.tsx +16 -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__/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-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-font-sizes-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 +112 -71
- package/src/components/inline.partial.tsx +5 -2
- package/src/components/interaction-surface.partial.tsx +237 -0
- package/src/components/stack.partial.tsx +5 -2
- package/src/components/surface-provider.tsx +25 -0
- package/src/components/text.partial.tsx +62 -26
- package/src/components/types.tsx +1 -1
- package/src/constants.tsx +1 -0
- package/src/index.tsx +4 -0
- package/src/internal/color-map.tsx +34 -0
- package/src/internal/role-to-element.tsx +34 -0
|
@@ -11,70 +11,108 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react = require("@emotion/react");
|
|
15
|
+
|
|
16
|
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
17
|
+
|
|
18
|
+
var _colorMap = require("../internal/color-map");
|
|
19
|
+
|
|
20
|
+
var _surfaceProvider = require("./surface-provider");
|
|
15
21
|
|
|
16
22
|
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; }
|
|
17
23
|
|
|
18
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; }
|
|
19
25
|
|
|
26
|
+
var asAllowlist = ['span', 'div', 'p'];
|
|
20
27
|
var fontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";
|
|
21
28
|
var fontSizeMap = {
|
|
22
|
-
'
|
|
29
|
+
'11px': (0, _react.css)({
|
|
23
30
|
fontSize: '11px'
|
|
24
31
|
}),
|
|
25
|
-
'
|
|
32
|
+
'12px': (0, _react.css)({
|
|
26
33
|
fontSize: '12px'
|
|
27
34
|
}),
|
|
28
|
-
'
|
|
35
|
+
'14px': (0, _react.css)({
|
|
29
36
|
fontSize: '14px'
|
|
30
37
|
})
|
|
31
38
|
};
|
|
32
39
|
// NOTE: can't use numbers as keys or Constellation won't build. Weird one.
|
|
33
40
|
var fontWeightMap = {
|
|
34
|
-
'400': (0,
|
|
41
|
+
'400': (0, _react.css)({
|
|
35
42
|
fontWeight: 400
|
|
36
43
|
}),
|
|
37
|
-
'500': (0,
|
|
44
|
+
'500': (0, _react.css)({
|
|
38
45
|
fontWeight: 500
|
|
46
|
+
}),
|
|
47
|
+
'700': (0, _react.css)({
|
|
48
|
+
fontWeight: 700
|
|
39
49
|
})
|
|
40
50
|
};
|
|
41
51
|
var lineHeightMap = {
|
|
42
|
-
'12px': (0,
|
|
52
|
+
'12px': (0, _react.css)({
|
|
43
53
|
lineHeight: '12px'
|
|
44
54
|
}),
|
|
45
|
-
'16px': (0,
|
|
55
|
+
'16px': (0, _react.css)({
|
|
46
56
|
lineHeight: '16px'
|
|
47
57
|
}),
|
|
48
|
-
'20px': (0,
|
|
58
|
+
'20px': (0, _react.css)({
|
|
49
59
|
lineHeight: '20px'
|
|
50
60
|
}),
|
|
51
|
-
'24px': (0,
|
|
61
|
+
'24px': (0, _react.css)({
|
|
52
62
|
lineHeight: '24px'
|
|
53
63
|
}),
|
|
54
|
-
'28px': (0,
|
|
64
|
+
'28px': (0, _react.css)({
|
|
55
65
|
lineHeight: '28px'
|
|
56
66
|
}),
|
|
57
|
-
'32px': (0,
|
|
67
|
+
'32px': (0, _react.css)({
|
|
58
68
|
lineHeight: '32px'
|
|
59
69
|
}),
|
|
60
|
-
'40px': (0,
|
|
70
|
+
'40px': (0, _react.css)({
|
|
61
71
|
lineHeight: '40px'
|
|
62
72
|
})
|
|
63
73
|
};
|
|
64
74
|
var textAlignMap = {
|
|
65
|
-
center: (0,
|
|
75
|
+
center: (0, _react.css)({
|
|
66
76
|
textAlign: 'center'
|
|
67
77
|
}),
|
|
68
|
-
end: (0,
|
|
78
|
+
end: (0, _react.css)({
|
|
69
79
|
textAlign: 'end'
|
|
70
80
|
}),
|
|
71
|
-
start: (0,
|
|
81
|
+
start: (0, _react.css)({
|
|
72
82
|
textAlign: 'start'
|
|
73
83
|
})
|
|
74
84
|
};
|
|
75
|
-
var
|
|
85
|
+
var textTransformMap = {
|
|
86
|
+
none: (0, _react.css)({
|
|
87
|
+
textTransform: 'none'
|
|
88
|
+
}),
|
|
89
|
+
lowercase: (0, _react.css)({
|
|
90
|
+
textTransform: 'lowercase'
|
|
91
|
+
}),
|
|
92
|
+
uppercase: (0, _react.css)({
|
|
93
|
+
textTransform: 'uppercase'
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
var verticalAlignMap = {
|
|
97
|
+
top: (0, _react.css)({
|
|
98
|
+
verticalAlign: 'top'
|
|
99
|
+
}),
|
|
100
|
+
middle: (0, _react.css)({
|
|
101
|
+
verticalAlign: 'middle'
|
|
102
|
+
}),
|
|
103
|
+
bottom: (0, _react.css)({
|
|
104
|
+
verticalAlign: 'bottom'
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
var baseStyles = (0, _react.css)({
|
|
108
|
+
boxSizing: 'border-box',
|
|
76
109
|
fontFamily: fontFamily
|
|
77
110
|
});
|
|
111
|
+
var truncateStyles = (0, _react.css)({
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
textOverflow: 'ellipsis',
|
|
114
|
+
whiteSpace: 'nowrap'
|
|
115
|
+
});
|
|
78
116
|
/**
|
|
79
117
|
* __Text__
|
|
80
118
|
*
|
|
@@ -93,22 +131,27 @@ var Text = function Text(_ref) {
|
|
|
93
131
|
fontSize = _ref.fontSize,
|
|
94
132
|
fontWeight = _ref.fontWeight,
|
|
95
133
|
lineHeight = _ref.lineHeight,
|
|
134
|
+
_ref$shouldTruncate = _ref.shouldTruncate,
|
|
135
|
+
shouldTruncate = _ref$shouldTruncate === void 0 ? false : _ref$shouldTruncate,
|
|
96
136
|
textAlign = _ref.textAlign,
|
|
97
|
-
|
|
137
|
+
textTransform = _ref.textTransform,
|
|
138
|
+
verticalAlign = _ref.verticalAlign,
|
|
98
139
|
testId = _ref.testId,
|
|
99
140
|
UNSAFE_style = _ref.UNSAFE_style;
|
|
141
|
+
var surface = (0, _surfaceProvider.useSurface)(); // @ts-ignore
|
|
100
142
|
|
|
101
143
|
var _ref2 = colorTuple || [],
|
|
102
144
|
_ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
103
|
-
|
|
145
|
+
_ref3$ = _ref3[0],
|
|
146
|
+
color = _ref3$ === void 0 ? _colorMap.colorMap[surface] : _ref3$,
|
|
104
147
|
fallback = _ref3[1];
|
|
105
148
|
|
|
106
|
-
|
|
149
|
+
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
150
|
+
return (0, _react.jsx)(Component, {
|
|
107
151
|
style: _objectSpread(_objectSpread({}, UNSAFE_style), fallback && {
|
|
108
152
|
'--ds-co-fb': fallback
|
|
109
153
|
}),
|
|
110
|
-
css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], textAlign && textAlignMap[textAlign]],
|
|
111
|
-
href: href,
|
|
154
|
+
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]],
|
|
112
155
|
"data-testid": testId
|
|
113
156
|
}, children);
|
|
114
157
|
};
|
|
@@ -116,7 +159,7 @@ var Text = function Text(_ref) {
|
|
|
116
159
|
var _default = Text;
|
|
117
160
|
/**
|
|
118
161
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
119
|
-
* @codegen <<SignedSource::
|
|
162
|
+
* @codegen <<SignedSource::140ffff6e1310c1c37e2067e2c232b92>>
|
|
120
163
|
* @codegenId colors
|
|
121
164
|
* @codegenCommand yarn codegen-styles
|
|
122
165
|
* @codegenParams ["text"]
|
|
@@ -124,43 +167,43 @@ var _default = Text;
|
|
|
124
167
|
|
|
125
168
|
exports.default = _default;
|
|
126
169
|
var textColorMap = {
|
|
127
|
-
'color.text': (0,
|
|
170
|
+
'color.text': (0, _react.css)({
|
|
128
171
|
color: "var(--ds-text, var(--ds-co-fb))"
|
|
129
172
|
}),
|
|
130
|
-
subtle: (0,
|
|
173
|
+
subtle: (0, _react.css)({
|
|
131
174
|
color: "var(--ds-text-subtle, var(--ds-co-fb))"
|
|
132
175
|
}),
|
|
133
|
-
subtlest: (0,
|
|
176
|
+
subtlest: (0, _react.css)({
|
|
134
177
|
color: "var(--ds-text-subtlest, var(--ds-co-fb))"
|
|
135
178
|
}),
|
|
136
|
-
disabled: (0,
|
|
179
|
+
disabled: (0, _react.css)({
|
|
137
180
|
color: "var(--ds-text-disabled, var(--ds-co-fb))"
|
|
138
181
|
}),
|
|
139
|
-
inverse: (0,
|
|
182
|
+
inverse: (0, _react.css)({
|
|
140
183
|
color: "var(--ds-text-inverse, var(--ds-co-fb))"
|
|
141
184
|
}),
|
|
142
|
-
brand: (0,
|
|
185
|
+
brand: (0, _react.css)({
|
|
143
186
|
color: "var(--ds-text-brand, var(--ds-co-fb))"
|
|
144
187
|
}),
|
|
145
|
-
selected: (0,
|
|
188
|
+
selected: (0, _react.css)({
|
|
146
189
|
color: "var(--ds-text-selected, var(--ds-co-fb))"
|
|
147
190
|
}),
|
|
148
|
-
danger: (0,
|
|
191
|
+
danger: (0, _react.css)({
|
|
149
192
|
color: "var(--ds-text-danger, var(--ds-co-fb))"
|
|
150
193
|
}),
|
|
151
|
-
warning: (0,
|
|
194
|
+
warning: (0, _react.css)({
|
|
152
195
|
color: "var(--ds-text-warning, var(--ds-co-fb))"
|
|
153
196
|
}),
|
|
154
|
-
'warning.inverse': (0,
|
|
197
|
+
'warning.inverse': (0, _react.css)({
|
|
155
198
|
color: "var(--ds-text-warning-inverse, var(--ds-co-fb))"
|
|
156
199
|
}),
|
|
157
|
-
success: (0,
|
|
200
|
+
success: (0, _react.css)({
|
|
158
201
|
color: "var(--ds-text-success, var(--ds-co-fb))"
|
|
159
202
|
}),
|
|
160
|
-
discovery: (0,
|
|
203
|
+
discovery: (0, _react.css)({
|
|
161
204
|
color: "var(--ds-text-discovery, var(--ds-co-fb))"
|
|
162
205
|
}),
|
|
163
|
-
information: (0,
|
|
206
|
+
information: (0, _react.css)({
|
|
164
207
|
color: "var(--ds-text-information, var(--ds-co-fb))"
|
|
165
208
|
})
|
|
166
209
|
};
|
package/dist/cjs/constants.js
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -17,6 +17,18 @@ Object.defineProperty(exports, "UNSAFE_Inline", {
|
|
|
17
17
|
return _inline.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
Object.defineProperty(exports, "UNSAFE_InteractionSurface", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _interactionSurface.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "UNSAFE_SPACING_SCALE", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _constants.SPACING_SCALE;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
20
32
|
Object.defineProperty(exports, "UNSAFE_Stack", {
|
|
21
33
|
enumerable: true,
|
|
22
34
|
get: function get() {
|
|
@@ -36,4 +48,8 @@ var _text = _interopRequireDefault(require("./components/text.partial"));
|
|
|
36
48
|
|
|
37
49
|
var _inline = _interopRequireDefault(require("./components/inline.partial"));
|
|
38
50
|
|
|
39
|
-
var _stack = _interopRequireDefault(require("./components/stack.partial"));
|
|
51
|
+
var _stack = _interopRequireDefault(require("./components/stack.partial"));
|
|
52
|
+
|
|
53
|
+
var _interactionSurface = _interopRequireDefault(require("./components/interaction-surface.partial"));
|
|
54
|
+
|
|
55
|
+
var _constants = require("./constants");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colorMap = 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::8f568e4f0837f7af4a10429e060ad059>>
|
|
14
|
+
* @codegenCommand yarn codegen-styles
|
|
15
|
+
*/
|
|
16
|
+
var colorMap = {
|
|
17
|
+
'neutral.bold': 'inverse',
|
|
18
|
+
'neutral.bold.hovered': 'inverse',
|
|
19
|
+
'neutral.bold.pressed': 'inverse',
|
|
20
|
+
'brand.bold': 'inverse',
|
|
21
|
+
'brand.bold.hovered': 'inverse',
|
|
22
|
+
'brand.bold.pressed': 'inverse',
|
|
23
|
+
'selected.bold': 'inverse',
|
|
24
|
+
'selected.bold.hovered': 'inverse',
|
|
25
|
+
'selected.bold.pressed': 'inverse',
|
|
26
|
+
'danger.bold': 'inverse',
|
|
27
|
+
'danger.bold.hovered': 'inverse',
|
|
28
|
+
'danger.bold.pressed': 'inverse',
|
|
29
|
+
'warning.bold': 'warning.inverse',
|
|
30
|
+
'warning.bold.hovered': 'warning.inverse',
|
|
31
|
+
'warning.bold.pressed': 'warning.inverse',
|
|
32
|
+
'success.bold': 'inverse',
|
|
33
|
+
'success.bold.hovered': 'inverse',
|
|
34
|
+
'success.bold.pressed': 'inverse',
|
|
35
|
+
'discovery.bold': 'inverse',
|
|
36
|
+
'discovery.bold.hovered': 'inverse',
|
|
37
|
+
'discovery.bold.pressed': 'inverse',
|
|
38
|
+
'information.bold': 'inverse',
|
|
39
|
+
'information.bold.hovered': 'inverse',
|
|
40
|
+
'information.bold.pressed': 'inverse'
|
|
41
|
+
};
|
|
42
|
+
exports.colorMap = colorMap;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Adapted straight from react-mui, with a small change.
|
|
10
|
+
* @see https://www.unpkg.com/browse/react-gui@0.2.1/src/modules/getAccessibilityElementWithSideEffect.js
|
|
11
|
+
*/
|
|
12
|
+
var roleToElementType = {
|
|
13
|
+
article: 'article',
|
|
14
|
+
banner: 'header',
|
|
15
|
+
blockquote: 'blockquote',
|
|
16
|
+
button: 'button',
|
|
17
|
+
code: 'code',
|
|
18
|
+
complementary: 'aside',
|
|
19
|
+
contentinfo: 'footer',
|
|
20
|
+
deletion: 'del',
|
|
21
|
+
emphasis: 'em',
|
|
22
|
+
figure: 'figure',
|
|
23
|
+
insertion: 'ins',
|
|
24
|
+
form: 'form',
|
|
25
|
+
link: 'a',
|
|
26
|
+
list: 'ul',
|
|
27
|
+
listitem: 'li',
|
|
28
|
+
main: 'main',
|
|
29
|
+
navigation: 'nav',
|
|
30
|
+
region: 'section',
|
|
31
|
+
strong: 'strong',
|
|
32
|
+
presentation: 'div',
|
|
33
|
+
group: 'fieldset'
|
|
34
|
+
};
|
|
35
|
+
var _default = roleToElementType;
|
|
36
|
+
exports.default = _default;
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,8 +2,67 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
-
import { css, jsx } from '@emotion/
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { SPACING_SCALE } from '../constants';
|
|
7
|
+
import { SurfaceContext } from './surface-provider';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* __Box__
|
|
11
|
+
*
|
|
12
|
+
* Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
|
|
13
|
+
* Renders a `div` by default.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
const Box = /*#__PURE__*/forwardRef(({
|
|
18
|
+
children,
|
|
19
|
+
as: Component = 'div',
|
|
20
|
+
className,
|
|
21
|
+
display = 'flex',
|
|
22
|
+
flexDirection,
|
|
23
|
+
alignItems,
|
|
24
|
+
justifyContent,
|
|
25
|
+
backgroundColor: backgroundColorTuple,
|
|
26
|
+
borderColor: borderColorTuple,
|
|
27
|
+
borderStyle,
|
|
28
|
+
borderWidth,
|
|
29
|
+
borderRadius,
|
|
30
|
+
padding,
|
|
31
|
+
paddingBlock,
|
|
32
|
+
paddingInline,
|
|
33
|
+
position = 'relative',
|
|
34
|
+
height,
|
|
35
|
+
width,
|
|
36
|
+
UNSAFE_style,
|
|
37
|
+
testId,
|
|
38
|
+
...htmlAttributes
|
|
39
|
+
}, ref) => {
|
|
40
|
+
const [backgroundColor, backgroundColorFallback] = backgroundColorTuple || [];
|
|
41
|
+
const [borderColor, borderColorFallback] = borderColorTuple || [];
|
|
42
|
+
const node = jsx(Component, _extends({
|
|
43
|
+
style: { ...UNSAFE_style,
|
|
44
|
+
...(backgroundColorFallback && {
|
|
45
|
+
'--ds-bg-fb': backgroundColorFallback
|
|
46
|
+
}),
|
|
47
|
+
...(borderColorFallback && {
|
|
48
|
+
'--ds-bo-fb': borderColorFallback
|
|
49
|
+
})
|
|
50
|
+
} // @ts-ignore
|
|
51
|
+
,
|
|
52
|
+
ref: ref // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
53
|
+
|
|
54
|
+
}, htmlAttributes, {
|
|
55
|
+
className: className,
|
|
56
|
+
css: [baseStyles, display && displayMap[display], padding && paddingMap[padding], position && positionMap[position], paddingBlock && paddingBlockMap[paddingBlock], paddingInline && paddingInlineMap[paddingInline], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], backgroundColor && backgroundColorMap[backgroundColor], borderColor && borderColorMap[borderColor], borderStyle && borderStyleMap[borderStyle], borderWidth && borderWidthMap[borderWidth], borderRadius && borderRadiusMap[borderRadius], flexDirection && flexDirectionMap[flexDirection], width && widthMap[width], height && heightMap[height]],
|
|
57
|
+
"data-testid": testId
|
|
58
|
+
}), children);
|
|
59
|
+
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
60
|
+
value: backgroundColor
|
|
61
|
+
}, node) : node;
|
|
62
|
+
});
|
|
63
|
+
Box.displayName = 'Box';
|
|
64
|
+
export default Box; // <<< STYLES GO HERE >>>
|
|
65
|
+
|
|
7
66
|
const borderStyleMap = {
|
|
8
67
|
none: css({
|
|
9
68
|
borderStyle: 'none'
|
|
@@ -91,67 +150,24 @@ const displayMap = {
|
|
|
91
150
|
})
|
|
92
151
|
};
|
|
93
152
|
const baseStyles = css({
|
|
94
|
-
boxSizing: 'border-box'
|
|
153
|
+
boxSizing: 'border-box',
|
|
154
|
+
appearance: 'none',
|
|
155
|
+
border: 'none'
|
|
95
156
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
as: Component = 'div',
|
|
108
|
-
display = 'flex',
|
|
109
|
-
flexDirection,
|
|
110
|
-
alignItems,
|
|
111
|
-
justifyContent,
|
|
112
|
-
backgroundColor: backgroundColorTuple,
|
|
113
|
-
borderColor: borderColorTuple,
|
|
114
|
-
borderStyle,
|
|
115
|
-
borderWidth,
|
|
116
|
-
borderRadius,
|
|
117
|
-
padding,
|
|
118
|
-
paddingBlock,
|
|
119
|
-
paddingInline,
|
|
120
|
-
height,
|
|
121
|
-
width,
|
|
122
|
-
UNSAFE_style,
|
|
123
|
-
testId,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Pull this out to prevent accidentaly spread
|
|
127
|
-
*/
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
// @eslint-disbale-next-line no-unused-vars
|
|
130
|
-
className: dontUseThisProperty,
|
|
131
|
-
...htmlAttributes
|
|
132
|
-
}, ref) => {
|
|
133
|
-
const [backgroundColor, backgroundColorFallback] = backgroundColorTuple || [];
|
|
134
|
-
const [borderColor, borderColorFallback] = borderColorTuple || [];
|
|
135
|
-
return jsx(Component, _extends({
|
|
136
|
-
style: { ...UNSAFE_style,
|
|
137
|
-
...(backgroundColorFallback && {
|
|
138
|
-
'--ds-bg-fb': backgroundColorFallback
|
|
139
|
-
}),
|
|
140
|
-
...(borderColorFallback && {
|
|
141
|
-
'--ds-bo-fb': borderColorFallback
|
|
142
|
-
})
|
|
143
|
-
},
|
|
144
|
-
ref: ref // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
145
|
-
|
|
146
|
-
}, htmlAttributes, {
|
|
147
|
-
css: [baseStyles, display && displayMap[display], padding && paddingMap[padding], paddingBlock && paddingBlockMap[paddingBlock], paddingInline && paddingInlineMap[paddingInline], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent], backgroundColor && backgroundColorMap[backgroundColor], borderColor && borderColorMap[borderColor], borderStyle && borderStyleMap[borderStyle], borderWidth && borderWidthMap[borderWidth], borderRadius && borderRadiusMap[borderRadius], flexDirection && flexDirectionMap[flexDirection], width && widthMap[width], height && heightMap[height]],
|
|
148
|
-
"data-testid": testId
|
|
149
|
-
}), children);
|
|
150
|
-
});
|
|
151
|
-
export default Box;
|
|
157
|
+
const positionMap = {
|
|
158
|
+
absolute: css({
|
|
159
|
+
position: 'absolute'
|
|
160
|
+
}),
|
|
161
|
+
relative: css({
|
|
162
|
+
position: 'relative'
|
|
163
|
+
}),
|
|
164
|
+
static: css({
|
|
165
|
+
position: 'static'
|
|
166
|
+
})
|
|
167
|
+
};
|
|
152
168
|
/**
|
|
153
169
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
154
|
-
* @codegen <<SignedSource::
|
|
170
|
+
* @codegen <<SignedSource::57b4c7c177fdfae3f7cd4f00287fd30e>>
|
|
155
171
|
* @codegenId spacing
|
|
156
172
|
* @codegenCommand yarn codegen-styles
|
|
157
173
|
* @codegenParams ["padding", "paddingBlock", "paddingInline", "width", "height"]
|
|
@@ -173,6 +189,9 @@ const paddingMap = {
|
|
|
173
189
|
'sp-100': css({
|
|
174
190
|
padding: SPACING_SCALE['sp-100']
|
|
175
191
|
}),
|
|
192
|
+
'sp-150': css({
|
|
193
|
+
padding: SPACING_SCALE['sp-150']
|
|
194
|
+
}),
|
|
176
195
|
'sp-200': css({
|
|
177
196
|
padding: SPACING_SCALE['sp-200']
|
|
178
197
|
}),
|
|
@@ -208,6 +227,9 @@ const paddingBlockMap = {
|
|
|
208
227
|
'sp-100': css({
|
|
209
228
|
paddingBlock: SPACING_SCALE['sp-100']
|
|
210
229
|
}),
|
|
230
|
+
'sp-150': css({
|
|
231
|
+
paddingBlock: SPACING_SCALE['sp-150']
|
|
232
|
+
}),
|
|
211
233
|
'sp-200': css({
|
|
212
234
|
paddingBlock: SPACING_SCALE['sp-200']
|
|
213
235
|
}),
|
|
@@ -243,6 +265,9 @@ const paddingInlineMap = {
|
|
|
243
265
|
'sp-100': css({
|
|
244
266
|
paddingInline: SPACING_SCALE['sp-100']
|
|
245
267
|
}),
|
|
268
|
+
'sp-150': css({
|
|
269
|
+
paddingInline: SPACING_SCALE['sp-150']
|
|
270
|
+
}),
|
|
246
271
|
'sp-200': css({
|
|
247
272
|
paddingInline: SPACING_SCALE['sp-200']
|
|
248
273
|
}),
|
|
@@ -278,6 +303,9 @@ const widthMap = {
|
|
|
278
303
|
'sp-100': css({
|
|
279
304
|
width: SPACING_SCALE['sp-100']
|
|
280
305
|
}),
|
|
306
|
+
'sp-150': css({
|
|
307
|
+
width: SPACING_SCALE['sp-150']
|
|
308
|
+
}),
|
|
281
309
|
'sp-200': css({
|
|
282
310
|
width: SPACING_SCALE['sp-200']
|
|
283
311
|
}),
|
|
@@ -313,6 +341,9 @@ const heightMap = {
|
|
|
313
341
|
'sp-100': css({
|
|
314
342
|
height: SPACING_SCALE['sp-100']
|
|
315
343
|
}),
|
|
344
|
+
'sp-150': css({
|
|
345
|
+
height: SPACING_SCALE['sp-150']
|
|
346
|
+
}),
|
|
316
347
|
'sp-200': css({
|
|
317
348
|
height: SPACING_SCALE['sp-200']
|
|
318
349
|
}),
|
|
@@ -338,7 +369,7 @@ const heightMap = {
|
|
|
338
369
|
|
|
339
370
|
/**
|
|
340
371
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
341
|
-
* @codegen <<SignedSource::
|
|
372
|
+
* @codegen <<SignedSource::ebb55786a54803214357d0eef0cac448>>
|
|
342
373
|
* @codegenId colors
|
|
343
374
|
* @codegenCommand yarn codegen-styles
|
|
344
375
|
* @codegenParams ["border", "background"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Children, forwardRef, Fragment } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { SPACING_SCALE } from '../constants';
|
|
5
5
|
import Text from './text.partial';
|
|
6
6
|
const flexAlignItemsMap = {
|
|
@@ -58,10 +58,11 @@ const Inline = /*#__PURE__*/forwardRef(({
|
|
|
58
58
|
return jsx(Fragment, null, divider && index > 0 ? dividerComponent : null, child);
|
|
59
59
|
}));
|
|
60
60
|
});
|
|
61
|
+
Inline.displayName = 'Inline';
|
|
61
62
|
export default Inline;
|
|
62
63
|
/**
|
|
63
64
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
64
|
-
* @codegen <<SignedSource::
|
|
65
|
+
* @codegen <<SignedSource::36d00b5586593733c7f84e9a10ddb7fd>>
|
|
65
66
|
* @codegenId spacing
|
|
66
67
|
* @codegenCommand yarn codegen-styles
|
|
67
68
|
* @codegenParams ["gap"]
|
|
@@ -83,6 +84,9 @@ const gapMap = {
|
|
|
83
84
|
'sp-100': css({
|
|
84
85
|
gap: SPACING_SCALE['sp-100']
|
|
85
86
|
}),
|
|
87
|
+
'sp-150': css({
|
|
88
|
+
gap: SPACING_SCALE['sp-150']
|
|
89
|
+
}),
|
|
86
90
|
'sp-200': css({
|
|
87
91
|
gap: SPACING_SCALE['sp-200']
|
|
88
92
|
}),
|