@atlaskit/primitives 0.3.0 → 0.3.2
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 +12 -0
- package/dist/cjs/components/inline.partial.js +48 -3
- package/dist/cjs/components/internal/base-box.partial.js +42 -42
- package/dist/cjs/constants.js +0 -13
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +48 -3
- package/dist/es2019/components/internal/base-box.partial.js +9 -15
- package/dist/es2019/constants.js +1 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +48 -3
- package/dist/esm/components/internal/base-box.partial.js +43 -43
- package/dist/esm/constants.js +1 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/components/inline.partial.d.ts +24 -2
- package/dist/types/components/internal/base-box.partial.d.ts +11 -10
- package/dist/types/components/internal/types.d.ts +5 -3
- package/dist/types/constants.d.ts +0 -2
- package/dist/types/helpers/responsive/types.d.ts +2 -2
- package/package.json +1 -2
- package/report.api.md +37 -20
- package/scripts/spacing-codegen-template.tsx +8 -12
- package/tmp/api-report-tmp.d.ts +37 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e7b64da97a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7b64da97a1) - Add `rowSpace` prop to override the `space` prop's spacing between rows.
|
|
8
|
+
|
|
9
|
+
## 0.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`114d6a73f72`](https://bitbucket.org/atlassian/atlassian-frontend/commits/114d6a73f72) - Cleanup the experimental responsive box utilizing our responsive helpers.
|
|
14
|
+
|
|
3
15
|
## 0.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -50,10 +50,10 @@ var flexWrapStyles = (0, _react2.css)({
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
53
|
-
* @codegen <<SignedSource::
|
|
53
|
+
* @codegen <<SignedSource::44cacef18982a4b0e43102900c42bdcf>>
|
|
54
54
|
* @codegenId spacing
|
|
55
55
|
* @codegenCommand yarn codegen-styles
|
|
56
|
-
* @codegenParams ["space"]
|
|
56
|
+
* @codegenParams ["space", "rowSpace"]
|
|
57
57
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
58
58
|
*/
|
|
59
59
|
var spaceMap = {
|
|
@@ -100,6 +100,50 @@ var spaceMap = {
|
|
|
100
100
|
gap: "var(--ds-space-1000, 80px)"
|
|
101
101
|
})
|
|
102
102
|
};
|
|
103
|
+
var rowSpaceMap = {
|
|
104
|
+
'0': (0, _react2.css)({
|
|
105
|
+
rowGap: "var(--ds-space-0, 0px)"
|
|
106
|
+
}),
|
|
107
|
+
'025': (0, _react2.css)({
|
|
108
|
+
rowGap: "var(--ds-space-025, 2px)"
|
|
109
|
+
}),
|
|
110
|
+
'050': (0, _react2.css)({
|
|
111
|
+
rowGap: "var(--ds-space-050, 4px)"
|
|
112
|
+
}),
|
|
113
|
+
'075': (0, _react2.css)({
|
|
114
|
+
rowGap: "var(--ds-space-075, 6px)"
|
|
115
|
+
}),
|
|
116
|
+
'100': (0, _react2.css)({
|
|
117
|
+
rowGap: "var(--ds-space-100, 8px)"
|
|
118
|
+
}),
|
|
119
|
+
'150': (0, _react2.css)({
|
|
120
|
+
rowGap: "var(--ds-space-150, 12px)"
|
|
121
|
+
}),
|
|
122
|
+
'200': (0, _react2.css)({
|
|
123
|
+
rowGap: "var(--ds-space-200, 16px)"
|
|
124
|
+
}),
|
|
125
|
+
'250': (0, _react2.css)({
|
|
126
|
+
rowGap: "var(--ds-space-250, 20px)"
|
|
127
|
+
}),
|
|
128
|
+
'300': (0, _react2.css)({
|
|
129
|
+
rowGap: "var(--ds-space-300, 24px)"
|
|
130
|
+
}),
|
|
131
|
+
'400': (0, _react2.css)({
|
|
132
|
+
rowGap: "var(--ds-space-400, 32px)"
|
|
133
|
+
}),
|
|
134
|
+
'500': (0, _react2.css)({
|
|
135
|
+
rowGap: "var(--ds-space-500, 40px)"
|
|
136
|
+
}),
|
|
137
|
+
'600': (0, _react2.css)({
|
|
138
|
+
rowGap: "var(--ds-space-600, 48px)"
|
|
139
|
+
}),
|
|
140
|
+
'800': (0, _react2.css)({
|
|
141
|
+
rowGap: "var(--ds-space-800, 64px)"
|
|
142
|
+
}),
|
|
143
|
+
'1000': (0, _react2.css)({
|
|
144
|
+
rowGap: "var(--ds-space-1000, 80px)"
|
|
145
|
+
})
|
|
146
|
+
};
|
|
103
147
|
/**
|
|
104
148
|
* @codegenEnd
|
|
105
149
|
*/
|
|
@@ -146,6 +190,7 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
146
190
|
spread = _ref2.spread,
|
|
147
191
|
grow = _ref2.grow,
|
|
148
192
|
space = _ref2.space,
|
|
193
|
+
rowSpace = _ref2.rowSpace,
|
|
149
194
|
separator = _ref2.separator,
|
|
150
195
|
testId = _ref2.testId,
|
|
151
196
|
rawChildren = _ref2.children;
|
|
@@ -157,7 +202,7 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
157
202
|
}) : rawChildren;
|
|
158
203
|
var justifyContent = spread || alignInline;
|
|
159
204
|
return (0, _react2.jsx)("div", {
|
|
160
|
-
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles],
|
|
205
|
+
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && rowSpaceMap[rowSpace]],
|
|
161
206
|
"data-testid": testId,
|
|
162
207
|
ref: ref
|
|
163
208
|
}, children);
|
|
@@ -12,18 +12,18 @@ var _react = require("react");
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
14
14
|
var _constants = require("../../constants");
|
|
15
|
+
var _responsive = require("../../helpers/responsive");
|
|
15
16
|
var _types = require("./types");
|
|
16
17
|
var _utils = require("./utils");
|
|
17
18
|
var _excluded = ["as", "className", "children", "color", "backgroundColor", "shadow", "borderStyle", "borderWidth", "borderRadius", "borderColor", "layer", "flex", "flexGrow", "flexShrink", "alignSelf", "overflow", "overflowInline", "overflowBlock", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "height", "width", "display", "position", "UNSAFE_style", "testId"];
|
|
18
19
|
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; }
|
|
20
21
|
var responsiveRules = _types.BOX_RESPONSIVE_PROPS.reduce(function (mapping, cssProperty) {
|
|
21
|
-
return Object.assign(mapping, (0, _defineProperty2.default)({}, cssProperty,
|
|
22
|
-
var config = _constants.BREAKPOINTS_CONFIG[breakpoint];
|
|
23
|
-
return Object.assign(configs, (0, _defineProperty2.default)({}, breakpoint, (0, _react2.css)((0, _defineProperty2.default)({}, "@media (min-width: ".concat(config.min, "px)"), (0, _defineProperty2.default)({}, cssProperty, "var(--ds-box-responsive-".concat(cssProperty, "-").concat(breakpoint, ")"))))));
|
|
24
|
-
}, {
|
|
22
|
+
return Object.assign(mapping, (0, _defineProperty2.default)({}, cssProperty, _objectSpread({
|
|
25
23
|
static: (0, _react2.css)((0, _defineProperty2.default)({}, cssProperty, "var(--ds-box-static-".concat(cssProperty, ")")))
|
|
26
|
-
}))
|
|
24
|
+
}, (0, _responsive.UNSAFE_buildAboveMediaQueryCSS)(function (breakpoint) {
|
|
25
|
+
return (0, _defineProperty2.default)({}, cssProperty, "var(--ds-box-responsive-".concat(cssProperty, "-").concat(breakpoint, ")"));
|
|
26
|
+
}))));
|
|
27
27
|
}, {});
|
|
28
28
|
var getResponsiveVars = function getResponsiveVars(propertyName, propertyValue, mapping) {
|
|
29
29
|
if ((0, _utils.isResponsiveStyleProp)(propertyValue)) {
|
|
@@ -37,8 +37,8 @@ var getResponsiveVars = function getResponsiveVars(propertyName, propertyValue,
|
|
|
37
37
|
var getResponsiveStyles = function getResponsiveStyles(propertyName, propertyValue) {
|
|
38
38
|
(0, _tinyInvariant.default)(typeof responsiveRules[propertyName] !== 'undefined', "Responsive rules for \"".concat(propertyName, "\" have not been statically defined."));
|
|
39
39
|
if ((0, _utils.isResponsiveStyleProp)(propertyValue)) {
|
|
40
|
-
return Object.keys(propertyValue).map(function (
|
|
41
|
-
return responsiveRules[propertyName][
|
|
40
|
+
return Object.keys(propertyValue).map(function (breakpoint) {
|
|
41
|
+
return responsiveRules[propertyName][breakpoint];
|
|
42
42
|
});
|
|
43
43
|
} else if ((0, _utils.isStaticStyleProp)(propertyValue)) {
|
|
44
44
|
return responsiveRules[propertyName].static;
|
|
@@ -55,41 +55,41 @@ var getResponsiveStyles = function getResponsiveStyles(propertyName, propertyVal
|
|
|
55
55
|
*
|
|
56
56
|
* @internal
|
|
57
57
|
*/
|
|
58
|
-
var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
59
|
-
var as =
|
|
60
|
-
className =
|
|
61
|
-
children =
|
|
62
|
-
color =
|
|
63
|
-
backgroundColor =
|
|
64
|
-
shadow =
|
|
65
|
-
borderStyle =
|
|
66
|
-
borderWidth =
|
|
67
|
-
borderRadius =
|
|
68
|
-
borderColor =
|
|
69
|
-
layer =
|
|
70
|
-
flex =
|
|
71
|
-
flexGrow =
|
|
72
|
-
flexShrink =
|
|
73
|
-
alignSelf =
|
|
74
|
-
overflow =
|
|
75
|
-
overflowInline =
|
|
76
|
-
overflowBlock =
|
|
77
|
-
padding =
|
|
78
|
-
paddingBlock =
|
|
79
|
-
paddingBlockStart =
|
|
80
|
-
paddingBlockEnd =
|
|
81
|
-
paddingInline =
|
|
82
|
-
paddingInlineStart =
|
|
83
|
-
paddingInlineEnd =
|
|
84
|
-
height =
|
|
85
|
-
width =
|
|
86
|
-
|
|
87
|
-
display =
|
|
88
|
-
|
|
89
|
-
position =
|
|
90
|
-
UNSAFE_style =
|
|
91
|
-
testId =
|
|
92
|
-
htmlAttributes = (0, _objectWithoutProperties2.default)(
|
|
58
|
+
var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
59
|
+
var as = _ref3.as,
|
|
60
|
+
className = _ref3.className,
|
|
61
|
+
children = _ref3.children,
|
|
62
|
+
color = _ref3.color,
|
|
63
|
+
backgroundColor = _ref3.backgroundColor,
|
|
64
|
+
shadow = _ref3.shadow,
|
|
65
|
+
borderStyle = _ref3.borderStyle,
|
|
66
|
+
borderWidth = _ref3.borderWidth,
|
|
67
|
+
borderRadius = _ref3.borderRadius,
|
|
68
|
+
borderColor = _ref3.borderColor,
|
|
69
|
+
layer = _ref3.layer,
|
|
70
|
+
flex = _ref3.flex,
|
|
71
|
+
flexGrow = _ref3.flexGrow,
|
|
72
|
+
flexShrink = _ref3.flexShrink,
|
|
73
|
+
alignSelf = _ref3.alignSelf,
|
|
74
|
+
overflow = _ref3.overflow,
|
|
75
|
+
overflowInline = _ref3.overflowInline,
|
|
76
|
+
overflowBlock = _ref3.overflowBlock,
|
|
77
|
+
padding = _ref3.padding,
|
|
78
|
+
paddingBlock = _ref3.paddingBlock,
|
|
79
|
+
paddingBlockStart = _ref3.paddingBlockStart,
|
|
80
|
+
paddingBlockEnd = _ref3.paddingBlockEnd,
|
|
81
|
+
paddingInline = _ref3.paddingInline,
|
|
82
|
+
paddingInlineStart = _ref3.paddingInlineStart,
|
|
83
|
+
paddingInlineEnd = _ref3.paddingInlineEnd,
|
|
84
|
+
height = _ref3.height,
|
|
85
|
+
width = _ref3.width,
|
|
86
|
+
_ref3$display = _ref3.display,
|
|
87
|
+
display = _ref3$display === void 0 ? displayMap.block : _ref3$display,
|
|
88
|
+
_ref3$position = _ref3.position,
|
|
89
|
+
position = _ref3$position === void 0 ? 'static' : _ref3$position,
|
|
90
|
+
UNSAFE_style = _ref3.UNSAFE_style,
|
|
91
|
+
testId = _ref3.testId,
|
|
92
|
+
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
93
93
|
var Component = as || 'div';
|
|
94
94
|
var inlineStyles = Object.assign({}, UNSAFE_style, getResponsiveVars('borderWidth', borderWidth, borderWidthMap), getResponsiveVars('display', display, displayMap), getResponsiveVars('padding', padding, paddingMap), getResponsiveVars('paddingBlock', paddingBlock, paddingMap), getResponsiveVars('paddingBlockStart', paddingBlockStart, paddingMap), getResponsiveVars('paddingBlockEnd', paddingBlockEnd, paddingMap), getResponsiveVars('paddingInline', paddingInline, paddingMap), getResponsiveVars('paddingInlineStart', paddingInlineStart, paddingMap), getResponsiveVars('paddingInlineEnd', paddingInlineEnd, paddingMap));
|
|
95
95
|
var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,20 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "BREAKPOINTS_CONFIG", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _dsExplorations.UNSAFE_BREAKPOINTS_CONFIG;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "BREAKPOINTS_LIST", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _dsExplorations.UNSAFE_BREAKPOINTS_LIST;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
6
|
exports.LAYERS = void 0;
|
|
19
|
-
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
20
7
|
var LAYERS = {
|
|
21
8
|
card: 100,
|
|
22
9
|
navigation: 200,
|
package/dist/cjs/version.json
CHANGED
|
@@ -43,10 +43,10 @@ const flexWrapStyles = css({
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
46
|
-
* @codegen <<SignedSource::
|
|
46
|
+
* @codegen <<SignedSource::44cacef18982a4b0e43102900c42bdcf>>
|
|
47
47
|
* @codegenId spacing
|
|
48
48
|
* @codegenCommand yarn codegen-styles
|
|
49
|
-
* @codegenParams ["space"]
|
|
49
|
+
* @codegenParams ["space", "rowSpace"]
|
|
50
50
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
51
51
|
*/
|
|
52
52
|
const spaceMap = {
|
|
@@ -93,6 +93,50 @@ const spaceMap = {
|
|
|
93
93
|
gap: "var(--ds-space-1000, 80px)"
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
|
+
const rowSpaceMap = {
|
|
97
|
+
'0': css({
|
|
98
|
+
rowGap: "var(--ds-space-0, 0px)"
|
|
99
|
+
}),
|
|
100
|
+
'025': css({
|
|
101
|
+
rowGap: "var(--ds-space-025, 2px)"
|
|
102
|
+
}),
|
|
103
|
+
'050': css({
|
|
104
|
+
rowGap: "var(--ds-space-050, 4px)"
|
|
105
|
+
}),
|
|
106
|
+
'075': css({
|
|
107
|
+
rowGap: "var(--ds-space-075, 6px)"
|
|
108
|
+
}),
|
|
109
|
+
'100': css({
|
|
110
|
+
rowGap: "var(--ds-space-100, 8px)"
|
|
111
|
+
}),
|
|
112
|
+
'150': css({
|
|
113
|
+
rowGap: "var(--ds-space-150, 12px)"
|
|
114
|
+
}),
|
|
115
|
+
'200': css({
|
|
116
|
+
rowGap: "var(--ds-space-200, 16px)"
|
|
117
|
+
}),
|
|
118
|
+
'250': css({
|
|
119
|
+
rowGap: "var(--ds-space-250, 20px)"
|
|
120
|
+
}),
|
|
121
|
+
'300': css({
|
|
122
|
+
rowGap: "var(--ds-space-300, 24px)"
|
|
123
|
+
}),
|
|
124
|
+
'400': css({
|
|
125
|
+
rowGap: "var(--ds-space-400, 32px)"
|
|
126
|
+
}),
|
|
127
|
+
'500': css({
|
|
128
|
+
rowGap: "var(--ds-space-500, 40px)"
|
|
129
|
+
}),
|
|
130
|
+
'600': css({
|
|
131
|
+
rowGap: "var(--ds-space-600, 48px)"
|
|
132
|
+
}),
|
|
133
|
+
'800': css({
|
|
134
|
+
rowGap: "var(--ds-space-800, 64px)"
|
|
135
|
+
}),
|
|
136
|
+
'1000': css({
|
|
137
|
+
rowGap: "var(--ds-space-1000, 80px)"
|
|
138
|
+
})
|
|
139
|
+
};
|
|
96
140
|
/**
|
|
97
141
|
* @codegenEnd
|
|
98
142
|
*/
|
|
@@ -137,6 +181,7 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
137
181
|
spread,
|
|
138
182
|
grow,
|
|
139
183
|
space,
|
|
184
|
+
rowSpace,
|
|
140
185
|
separator,
|
|
141
186
|
testId,
|
|
142
187
|
children: rawChildren
|
|
@@ -149,7 +194,7 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
149
194
|
}) : rawChildren;
|
|
150
195
|
const justifyContent = spread || alignInline;
|
|
151
196
|
return jsx("div", {
|
|
152
|
-
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles],
|
|
197
|
+
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && rowSpaceMap[rowSpace]],
|
|
153
198
|
"data-testid": testId,
|
|
154
199
|
ref: ref
|
|
155
200
|
}, children);
|
|
@@ -3,26 +3,20 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import invariant from 'tiny-invariant';
|
|
6
|
-
import {
|
|
6
|
+
import { LAYERS } from '../../constants';
|
|
7
|
+
import { UNSAFE_buildAboveMediaQueryCSS } from '../../helpers/responsive';
|
|
7
8
|
import { BOX_RESPONSIVE_PROPS } from './types';
|
|
8
9
|
import { isResponsiveStyleProp, isStaticStyleProp } from './utils';
|
|
9
10
|
const responsiveRules = BOX_RESPONSIVE_PROPS.reduce((mapping, cssProperty) => {
|
|
10
11
|
return Object.assign(mapping, {
|
|
11
|
-
[cssProperty]:
|
|
12
|
-
const config = BREAKPOINTS_CONFIG[breakpoint];
|
|
13
|
-
return Object.assign(configs, {
|
|
14
|
-
[breakpoint]: css({
|
|
15
|
-
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
16
|
-
[`@media (min-width: ${config.min}px)`]: {
|
|
17
|
-
[cssProperty]: `var(--ds-box-responsive-${cssProperty}-${breakpoint})`
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
});
|
|
21
|
-
}, {
|
|
12
|
+
[cssProperty]: {
|
|
22
13
|
static: css({
|
|
23
14
|
[cssProperty]: `var(--ds-box-static-${cssProperty})`
|
|
24
|
-
})
|
|
25
|
-
|
|
15
|
+
}),
|
|
16
|
+
...UNSAFE_buildAboveMediaQueryCSS(breakpoint => ({
|
|
17
|
+
[cssProperty]: `var(--ds-box-responsive-${cssProperty}-${breakpoint})`
|
|
18
|
+
}))
|
|
19
|
+
}
|
|
26
20
|
});
|
|
27
21
|
}, {});
|
|
28
22
|
const getResponsiveVars = (propertyName, propertyValue, mapping) => {
|
|
@@ -40,7 +34,7 @@ const getResponsiveVars = (propertyName, propertyValue, mapping) => {
|
|
|
40
34
|
const getResponsiveStyles = (propertyName, propertyValue) => {
|
|
41
35
|
invariant(typeof responsiveRules[propertyName] !== 'undefined', `Responsive rules for "${propertyName}" have not been statically defined.`);
|
|
42
36
|
if (isResponsiveStyleProp(propertyValue)) {
|
|
43
|
-
return Object.keys(propertyValue).map(
|
|
37
|
+
return Object.keys(propertyValue).map(breakpoint => responsiveRules[propertyName][breakpoint]);
|
|
44
38
|
} else if (isStaticStyleProp(propertyValue)) {
|
|
45
39
|
return responsiveRules[propertyName].static;
|
|
46
40
|
}
|
package/dist/es2019/constants.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UNSAFE_Breakpoint as Breakpoint, UNSAFE_BreakpointConfig as BreakpointConfig, UNSAFE_BREAKPOINTS_CONFIG as BREAKPOINTS_CONFIG, UNSAFE_BREAKPOINTS_LIST as BREAKPOINTS_LIST } from '@atlaskit/ds-explorations';
|
|
2
1
|
export const LAYERS = {
|
|
3
2
|
card: 100,
|
|
4
3
|
navigation: 200,
|
|
@@ -9,5 +8,4 @@ export const LAYERS = {
|
|
|
9
8
|
flag: 600,
|
|
10
9
|
spotlight: 700,
|
|
11
10
|
tooltip: 800
|
|
12
|
-
};
|
|
13
|
-
export { BREAKPOINTS_CONFIG, BREAKPOINTS_LIST };
|
|
11
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -43,10 +43,10 @@ var flexWrapStyles = css({
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
46
|
-
* @codegen <<SignedSource::
|
|
46
|
+
* @codegen <<SignedSource::44cacef18982a4b0e43102900c42bdcf>>
|
|
47
47
|
* @codegenId spacing
|
|
48
48
|
* @codegenCommand yarn codegen-styles
|
|
49
|
-
* @codegenParams ["space"]
|
|
49
|
+
* @codegenParams ["space", "rowSpace"]
|
|
50
50
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
51
51
|
*/
|
|
52
52
|
var spaceMap = {
|
|
@@ -93,6 +93,50 @@ var spaceMap = {
|
|
|
93
93
|
gap: "var(--ds-space-1000, 80px)"
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
|
+
var rowSpaceMap = {
|
|
97
|
+
'0': css({
|
|
98
|
+
rowGap: "var(--ds-space-0, 0px)"
|
|
99
|
+
}),
|
|
100
|
+
'025': css({
|
|
101
|
+
rowGap: "var(--ds-space-025, 2px)"
|
|
102
|
+
}),
|
|
103
|
+
'050': css({
|
|
104
|
+
rowGap: "var(--ds-space-050, 4px)"
|
|
105
|
+
}),
|
|
106
|
+
'075': css({
|
|
107
|
+
rowGap: "var(--ds-space-075, 6px)"
|
|
108
|
+
}),
|
|
109
|
+
'100': css({
|
|
110
|
+
rowGap: "var(--ds-space-100, 8px)"
|
|
111
|
+
}),
|
|
112
|
+
'150': css({
|
|
113
|
+
rowGap: "var(--ds-space-150, 12px)"
|
|
114
|
+
}),
|
|
115
|
+
'200': css({
|
|
116
|
+
rowGap: "var(--ds-space-200, 16px)"
|
|
117
|
+
}),
|
|
118
|
+
'250': css({
|
|
119
|
+
rowGap: "var(--ds-space-250, 20px)"
|
|
120
|
+
}),
|
|
121
|
+
'300': css({
|
|
122
|
+
rowGap: "var(--ds-space-300, 24px)"
|
|
123
|
+
}),
|
|
124
|
+
'400': css({
|
|
125
|
+
rowGap: "var(--ds-space-400, 32px)"
|
|
126
|
+
}),
|
|
127
|
+
'500': css({
|
|
128
|
+
rowGap: "var(--ds-space-500, 40px)"
|
|
129
|
+
}),
|
|
130
|
+
'600': css({
|
|
131
|
+
rowGap: "var(--ds-space-600, 48px)"
|
|
132
|
+
}),
|
|
133
|
+
'800': css({
|
|
134
|
+
rowGap: "var(--ds-space-800, 64px)"
|
|
135
|
+
}),
|
|
136
|
+
'1000': css({
|
|
137
|
+
rowGap: "var(--ds-space-1000, 80px)"
|
|
138
|
+
})
|
|
139
|
+
};
|
|
96
140
|
/**
|
|
97
141
|
* @codegenEnd
|
|
98
142
|
*/
|
|
@@ -139,6 +183,7 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
139
183
|
spread = _ref2.spread,
|
|
140
184
|
grow = _ref2.grow,
|
|
141
185
|
space = _ref2.space,
|
|
186
|
+
rowSpace = _ref2.rowSpace,
|
|
142
187
|
separator = _ref2.separator,
|
|
143
188
|
testId = _ref2.testId,
|
|
144
189
|
rawChildren = _ref2.children;
|
|
@@ -150,7 +195,7 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
150
195
|
}) : rawChildren;
|
|
151
196
|
var justifyContent = spread || alignInline;
|
|
152
197
|
return jsx("div", {
|
|
153
|
-
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles],
|
|
198
|
+
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && rowSpaceMap[rowSpace]],
|
|
154
199
|
"data-testid": testId,
|
|
155
200
|
ref: ref
|
|
156
201
|
}, children);
|
|
@@ -8,16 +8,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import invariant from 'tiny-invariant';
|
|
11
|
-
import {
|
|
11
|
+
import { LAYERS } from '../../constants';
|
|
12
|
+
import { UNSAFE_buildAboveMediaQueryCSS } from '../../helpers/responsive';
|
|
12
13
|
import { BOX_RESPONSIVE_PROPS } from './types';
|
|
13
14
|
import { isResponsiveStyleProp, isStaticStyleProp } from './utils';
|
|
14
15
|
var responsiveRules = BOX_RESPONSIVE_PROPS.reduce(function (mapping, cssProperty) {
|
|
15
|
-
return Object.assign(mapping, _defineProperty({}, cssProperty,
|
|
16
|
-
var config = BREAKPOINTS_CONFIG[breakpoint];
|
|
17
|
-
return Object.assign(configs, _defineProperty({}, breakpoint, css(_defineProperty({}, "@media (min-width: ".concat(config.min, "px)"), _defineProperty({}, cssProperty, "var(--ds-box-responsive-".concat(cssProperty, "-").concat(breakpoint, ")"))))));
|
|
18
|
-
}, {
|
|
16
|
+
return Object.assign(mapping, _defineProperty({}, cssProperty, _objectSpread({
|
|
19
17
|
static: css(_defineProperty({}, cssProperty, "var(--ds-box-static-".concat(cssProperty, ")")))
|
|
20
|
-
})
|
|
18
|
+
}, UNSAFE_buildAboveMediaQueryCSS(function (breakpoint) {
|
|
19
|
+
return _defineProperty({}, cssProperty, "var(--ds-box-responsive-".concat(cssProperty, "-").concat(breakpoint, ")"));
|
|
20
|
+
}))));
|
|
21
21
|
}, {});
|
|
22
22
|
var getResponsiveVars = function getResponsiveVars(propertyName, propertyValue, mapping) {
|
|
23
23
|
if (isResponsiveStyleProp(propertyValue)) {
|
|
@@ -31,8 +31,8 @@ var getResponsiveVars = function getResponsiveVars(propertyName, propertyValue,
|
|
|
31
31
|
var getResponsiveStyles = function getResponsiveStyles(propertyName, propertyValue) {
|
|
32
32
|
invariant(typeof responsiveRules[propertyName] !== 'undefined', "Responsive rules for \"".concat(propertyName, "\" have not been statically defined."));
|
|
33
33
|
if (isResponsiveStyleProp(propertyValue)) {
|
|
34
|
-
return Object.keys(propertyValue).map(function (
|
|
35
|
-
return responsiveRules[propertyName][
|
|
34
|
+
return Object.keys(propertyValue).map(function (breakpoint) {
|
|
35
|
+
return responsiveRules[propertyName][breakpoint];
|
|
36
36
|
});
|
|
37
37
|
} else if (isStaticStyleProp(propertyValue)) {
|
|
38
38
|
return responsiveRules[propertyName].static;
|
|
@@ -49,41 +49,41 @@ var getResponsiveStyles = function getResponsiveStyles(propertyName, propertyVal
|
|
|
49
49
|
*
|
|
50
50
|
* @internal
|
|
51
51
|
*/
|
|
52
|
-
export var BaseBox = /*#__PURE__*/forwardRef(function (
|
|
53
|
-
var as =
|
|
54
|
-
className =
|
|
55
|
-
children =
|
|
56
|
-
color =
|
|
57
|
-
backgroundColor =
|
|
58
|
-
shadow =
|
|
59
|
-
borderStyle =
|
|
60
|
-
borderWidth =
|
|
61
|
-
borderRadius =
|
|
62
|
-
borderColor =
|
|
63
|
-
layer =
|
|
64
|
-
flex =
|
|
65
|
-
flexGrow =
|
|
66
|
-
flexShrink =
|
|
67
|
-
alignSelf =
|
|
68
|
-
overflow =
|
|
69
|
-
overflowInline =
|
|
70
|
-
overflowBlock =
|
|
71
|
-
padding =
|
|
72
|
-
paddingBlock =
|
|
73
|
-
paddingBlockStart =
|
|
74
|
-
paddingBlockEnd =
|
|
75
|
-
paddingInline =
|
|
76
|
-
paddingInlineStart =
|
|
77
|
-
paddingInlineEnd =
|
|
78
|
-
height =
|
|
79
|
-
width =
|
|
80
|
-
|
|
81
|
-
display =
|
|
82
|
-
|
|
83
|
-
position =
|
|
84
|
-
UNSAFE_style =
|
|
85
|
-
testId =
|
|
86
|
-
htmlAttributes = _objectWithoutProperties(
|
|
52
|
+
export var BaseBox = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
53
|
+
var as = _ref3.as,
|
|
54
|
+
className = _ref3.className,
|
|
55
|
+
children = _ref3.children,
|
|
56
|
+
color = _ref3.color,
|
|
57
|
+
backgroundColor = _ref3.backgroundColor,
|
|
58
|
+
shadow = _ref3.shadow,
|
|
59
|
+
borderStyle = _ref3.borderStyle,
|
|
60
|
+
borderWidth = _ref3.borderWidth,
|
|
61
|
+
borderRadius = _ref3.borderRadius,
|
|
62
|
+
borderColor = _ref3.borderColor,
|
|
63
|
+
layer = _ref3.layer,
|
|
64
|
+
flex = _ref3.flex,
|
|
65
|
+
flexGrow = _ref3.flexGrow,
|
|
66
|
+
flexShrink = _ref3.flexShrink,
|
|
67
|
+
alignSelf = _ref3.alignSelf,
|
|
68
|
+
overflow = _ref3.overflow,
|
|
69
|
+
overflowInline = _ref3.overflowInline,
|
|
70
|
+
overflowBlock = _ref3.overflowBlock,
|
|
71
|
+
padding = _ref3.padding,
|
|
72
|
+
paddingBlock = _ref3.paddingBlock,
|
|
73
|
+
paddingBlockStart = _ref3.paddingBlockStart,
|
|
74
|
+
paddingBlockEnd = _ref3.paddingBlockEnd,
|
|
75
|
+
paddingInline = _ref3.paddingInline,
|
|
76
|
+
paddingInlineStart = _ref3.paddingInlineStart,
|
|
77
|
+
paddingInlineEnd = _ref3.paddingInlineEnd,
|
|
78
|
+
height = _ref3.height,
|
|
79
|
+
width = _ref3.width,
|
|
80
|
+
_ref3$display = _ref3.display,
|
|
81
|
+
display = _ref3$display === void 0 ? displayMap.block : _ref3$display,
|
|
82
|
+
_ref3$position = _ref3.position,
|
|
83
|
+
position = _ref3$position === void 0 ? 'static' : _ref3$position,
|
|
84
|
+
UNSAFE_style = _ref3.UNSAFE_style,
|
|
85
|
+
testId = _ref3.testId,
|
|
86
|
+
htmlAttributes = _objectWithoutProperties(_ref3, _excluded);
|
|
87
87
|
var Component = as || 'div';
|
|
88
88
|
var inlineStyles = Object.assign({}, UNSAFE_style, getResponsiveVars('borderWidth', borderWidth, borderWidthMap), getResponsiveVars('display', display, displayMap), getResponsiveVars('padding', padding, paddingMap), getResponsiveVars('paddingBlock', paddingBlock, paddingMap), getResponsiveVars('paddingBlockStart', paddingBlockStart, paddingMap), getResponsiveVars('paddingBlockEnd', paddingBlockEnd, paddingMap), getResponsiveVars('paddingInline', paddingInline, paddingMap), getResponsiveVars('paddingInlineStart', paddingInlineStart, paddingMap), getResponsiveVars('paddingInlineEnd', paddingInlineEnd, paddingMap));
|
|
89
89
|
var node = jsx(Component, _extends({
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UNSAFE_Breakpoint as Breakpoint, UNSAFE_BreakpointConfig as BreakpointConfig, UNSAFE_BREAKPOINTS_CONFIG as BREAKPOINTS_CONFIG, UNSAFE_BREAKPOINTS_LIST as BREAKPOINTS_LIST } from '@atlaskit/ds-explorations';
|
|
2
1
|
export var LAYERS = {
|
|
3
2
|
card: 100,
|
|
4
3
|
navigation: 200,
|
|
@@ -9,5 +8,4 @@ export var LAYERS = {
|
|
|
9
8
|
flag: 600,
|
|
10
9
|
spotlight: 700,
|
|
11
10
|
tooltip: 800
|
|
12
|
-
};
|
|
13
|
-
export { BREAKPOINTS_CONFIG, BREAKPOINTS_LIST };
|
|
11
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -25,6 +25,11 @@ export interface InlineProps {
|
|
|
25
25
|
* Represents the space between each child.
|
|
26
26
|
*/
|
|
27
27
|
space?: Space;
|
|
28
|
+
/**
|
|
29
|
+
* Represents the space between rows when content wraps.
|
|
30
|
+
* Used to override the `space` value in between rows.
|
|
31
|
+
*/
|
|
32
|
+
rowSpace?: RowSpace;
|
|
28
33
|
/**
|
|
29
34
|
* Renders a separator string between each child.
|
|
30
35
|
*/
|
|
@@ -44,10 +49,10 @@ export declare type Spread = 'space-between';
|
|
|
44
49
|
export declare type Grow = 'hug' | 'fill';
|
|
45
50
|
/**
|
|
46
51
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
47
|
-
* @codegen <<SignedSource::
|
|
52
|
+
* @codegen <<SignedSource::44cacef18982a4b0e43102900c42bdcf>>
|
|
48
53
|
* @codegenId spacing
|
|
49
54
|
* @codegenCommand yarn codegen-styles
|
|
50
|
-
* @codegenParams ["space"]
|
|
55
|
+
* @codegenParams ["space", "rowSpace"]
|
|
51
56
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
52
57
|
*/
|
|
53
58
|
declare const spaceMap: {
|
|
@@ -67,6 +72,23 @@ declare const spaceMap: {
|
|
|
67
72
|
readonly '1000': import("@emotion/react").SerializedStyles;
|
|
68
73
|
};
|
|
69
74
|
export declare type Space = keyof typeof spaceMap;
|
|
75
|
+
declare const rowSpaceMap: {
|
|
76
|
+
readonly '0': import("@emotion/react").SerializedStyles;
|
|
77
|
+
readonly '025': import("@emotion/react").SerializedStyles;
|
|
78
|
+
readonly '050': import("@emotion/react").SerializedStyles;
|
|
79
|
+
readonly '075': import("@emotion/react").SerializedStyles;
|
|
80
|
+
readonly '100': import("@emotion/react").SerializedStyles;
|
|
81
|
+
readonly '150': import("@emotion/react").SerializedStyles;
|
|
82
|
+
readonly '200': import("@emotion/react").SerializedStyles;
|
|
83
|
+
readonly '250': import("@emotion/react").SerializedStyles;
|
|
84
|
+
readonly '300': import("@emotion/react").SerializedStyles;
|
|
85
|
+
readonly '400': import("@emotion/react").SerializedStyles;
|
|
86
|
+
readonly '500': import("@emotion/react").SerializedStyles;
|
|
87
|
+
readonly '600': import("@emotion/react").SerializedStyles;
|
|
88
|
+
readonly '800': import("@emotion/react").SerializedStyles;
|
|
89
|
+
readonly '1000': import("@emotion/react").SerializedStyles;
|
|
90
|
+
};
|
|
91
|
+
export declare type RowSpace = keyof typeof rowSpaceMap;
|
|
70
92
|
/**
|
|
71
93
|
* __Inline__
|
|
72
94
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Layer } from '../../constants';
|
|
4
|
+
import { ResponsiveObject } from '../../helpers/responsive';
|
|
4
5
|
import type { BasePrimitiveProps } from '../types';
|
|
5
6
|
export declare type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className' | 'style'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
|
|
6
7
|
declare type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
@@ -43,7 +44,7 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
43
44
|
/**
|
|
44
45
|
* Defines border width.
|
|
45
46
|
*/
|
|
46
|
-
borderWidth?: BorderWidth |
|
|
47
|
+
borderWidth?: BorderWidth | ResponsiveObject<BorderWidth>;
|
|
47
48
|
/**
|
|
48
49
|
* Token representing border color with a fallback.
|
|
49
50
|
*/
|
|
@@ -94,37 +95,37 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
94
95
|
* @see paddingBlock
|
|
95
96
|
* @see paddingInline
|
|
96
97
|
*/
|
|
97
|
-
padding?: Padding |
|
|
98
|
+
padding?: Padding | ResponsiveObject<Padding>;
|
|
98
99
|
/**
|
|
99
100
|
* Tokens representing CSS shorthand `paddingBlock`.
|
|
100
101
|
*
|
|
101
102
|
* @see paddingBlockStart
|
|
102
103
|
* @see paddingBlockEnd
|
|
103
104
|
*/
|
|
104
|
-
paddingBlock?: PaddingBlock |
|
|
105
|
+
paddingBlock?: PaddingBlock | ResponsiveObject<PaddingBlock>;
|
|
105
106
|
/**
|
|
106
107
|
* Tokens representing CSS `paddingBlockStart`.
|
|
107
108
|
*/
|
|
108
|
-
paddingBlockStart?: PaddingBlockStart |
|
|
109
|
+
paddingBlockStart?: PaddingBlockStart | ResponsiveObject<PaddingBlockStart>;
|
|
109
110
|
/**
|
|
110
111
|
* Tokens representing CSS `paddingBlockEnd`.
|
|
111
112
|
*/
|
|
112
|
-
paddingBlockEnd?: PaddingBlockEnd |
|
|
113
|
+
paddingBlockEnd?: PaddingBlockEnd | ResponsiveObject<PaddingBlockEnd>;
|
|
113
114
|
/**
|
|
114
115
|
* Tokens representing CSS shorthand `paddingInline`.
|
|
115
116
|
*
|
|
116
117
|
* @see paddingInlineStart
|
|
117
118
|
* @see paddingInlineEnd
|
|
118
119
|
*/
|
|
119
|
-
paddingInline?: PaddingInline |
|
|
120
|
+
paddingInline?: PaddingInline | ResponsiveObject<PaddingInline>;
|
|
120
121
|
/**
|
|
121
122
|
* Tokens representing CSS `paddingInlineStart`.
|
|
122
123
|
*/
|
|
123
|
-
paddingInlineStart?: PaddingInlineStart |
|
|
124
|
+
paddingInlineStart?: PaddingInlineStart | ResponsiveObject<PaddingInlineStart>;
|
|
124
125
|
/**
|
|
125
126
|
* Tokens representing CSS `paddingInlineEnd`.
|
|
126
127
|
*/
|
|
127
|
-
paddingInlineEnd?: PaddingInlineEnd |
|
|
128
|
+
paddingInlineEnd?: PaddingInlineEnd | ResponsiveObject<PaddingInlineEnd>;
|
|
128
129
|
/**
|
|
129
130
|
* Token representing width.
|
|
130
131
|
* @experimental The existing tokens will be replaced to better reflect dimensions.
|
|
@@ -138,7 +139,7 @@ declare type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
138
139
|
/**
|
|
139
140
|
* Defines display type and layout. Defaults to `block`.
|
|
140
141
|
*/
|
|
141
|
-
display?: Display |
|
|
142
|
+
display?: Display | ResponsiveObject<Display>;
|
|
142
143
|
/**
|
|
143
144
|
* CSS position property.
|
|
144
145
|
*/
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/react';
|
|
2
|
-
import {
|
|
2
|
+
import { ResponsiveCSSObject, ResponsiveObject } from '../../helpers/responsive';
|
|
3
3
|
export declare const BOX_RESPONSIVE_PROPS: readonly ["borderWidth", "display", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd"];
|
|
4
4
|
export declare type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
|
|
5
|
-
export declare type
|
|
6
|
-
|
|
5
|
+
export declare type StaticResponsiveCSSObject = ResponsiveCSSObject & {
|
|
6
|
+
static: SerializedStyles;
|
|
7
|
+
};
|
|
8
|
+
export declare type GenericPropertyValue = string | ResponsiveObject<string> | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UNSAFE_Breakpoint as Breakpoint, UNSAFE_BreakpointConfig as BreakpointConfig, UNSAFE_BREAKPOINTS_CONFIG as BREAKPOINTS_CONFIG, UNSAFE_BREAKPOINTS_LIST as BREAKPOINTS_LIST } from '@atlaskit/ds-explorations';
|
|
2
1
|
export declare const LAYERS: {
|
|
3
2
|
readonly card: 100;
|
|
4
3
|
readonly navigation: 200;
|
|
@@ -11,4 +10,3 @@ export declare const LAYERS: {
|
|
|
11
10
|
readonly tooltip: 800;
|
|
12
11
|
};
|
|
13
12
|
export declare type Layer = keyof typeof LAYERS;
|
|
14
|
-
export { BREAKPOINTS_CONFIG, BREAKPOINTS_LIST, type Breakpoint, type BreakpointConfig, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SerializedStyles } from '@emotion/react';
|
|
2
2
|
import { token } from '@atlaskit/tokens';
|
|
3
3
|
/**
|
|
4
4
|
* The breakpoints we have for responsiveness.
|
|
@@ -23,7 +23,7 @@ export declare type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
|
23
23
|
* return <div css={setMarginBreakpoints.map(breakpoint => marginMediaQueries[breakpoint])} />
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export declare type ResponsiveCSSObject = ResponsiveObject<
|
|
26
|
+
export declare type ResponsiveCSSObject = ResponsiveObject<SerializedStyles>;
|
|
27
27
|
/**
|
|
28
28
|
* Our internal breakpoint config used to build media queries and define attributes for certain components.
|
|
29
29
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"./responsive": "./src/helpers/responsive/index.tsx"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@atlaskit/ds-explorations": "*",
|
|
42
41
|
"@atlaskit/tokens": "^1.2.0",
|
|
43
42
|
"@babel/runtime": "^7.0.0",
|
|
44
43
|
"@emotion/react": "^11.7.1",
|
package/report.api.md
CHANGED
|
@@ -26,7 +26,6 @@ import { ReactElement } from 'react';
|
|
|
26
26
|
import { ReactNode } from 'react';
|
|
27
27
|
import { RefAttributes } from 'react';
|
|
28
28
|
import { SerializedStyles } from '@emotion/react';
|
|
29
|
-
import { UNSAFE_Breakpoint } from '@atlaskit/ds-explorations';
|
|
30
29
|
|
|
31
30
|
// @public (undocumented)
|
|
32
31
|
type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
|
|
@@ -138,7 +137,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
138
137
|
backgroundColor?: BackgroundColor;
|
|
139
138
|
shadow?: Shadow;
|
|
140
139
|
borderStyle?: BorderStyle;
|
|
141
|
-
borderWidth?: BorderWidth |
|
|
140
|
+
borderWidth?: BorderWidth | ResponsiveObject<BorderWidth>;
|
|
142
141
|
borderColor?: BorderColor;
|
|
143
142
|
borderRadius?: BorderRadius;
|
|
144
143
|
layer?: Layer;
|
|
@@ -149,28 +148,18 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
149
148
|
overflow?: Overflow;
|
|
150
149
|
overflowInline?: OverflowInline;
|
|
151
150
|
overflowBlock?: OverflowBlock;
|
|
152
|
-
padding?: Padding |
|
|
153
|
-
paddingBlock?:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
| PaddingBlockStart
|
|
158
|
-
| Partial<Record<UNSAFE_Breakpoint, PaddingBlockStart>>;
|
|
159
|
-
paddingBlockEnd?:
|
|
160
|
-
| PaddingBlockEnd
|
|
161
|
-
| Partial<Record<UNSAFE_Breakpoint, PaddingBlockEnd>>;
|
|
162
|
-
paddingInline?:
|
|
163
|
-
| PaddingInline
|
|
164
|
-
| Partial<Record<UNSAFE_Breakpoint, PaddingInline>>;
|
|
151
|
+
padding?: Padding | ResponsiveObject<Padding>;
|
|
152
|
+
paddingBlock?: PaddingBlock | ResponsiveObject<PaddingBlock>;
|
|
153
|
+
paddingBlockStart?: PaddingBlockStart | ResponsiveObject<PaddingBlockStart>;
|
|
154
|
+
paddingBlockEnd?: PaddingBlockEnd | ResponsiveObject<PaddingBlockEnd>;
|
|
155
|
+
paddingInline?: PaddingInline | ResponsiveObject<PaddingInline>;
|
|
165
156
|
paddingInlineStart?:
|
|
166
157
|
| PaddingInlineStart
|
|
167
|
-
|
|
|
168
|
-
paddingInlineEnd?:
|
|
169
|
-
| PaddingInlineEnd
|
|
170
|
-
| Partial<Record<UNSAFE_Breakpoint, PaddingInlineEnd>>;
|
|
158
|
+
| ResponsiveObject<PaddingInlineStart>;
|
|
159
|
+
paddingInlineEnd?: PaddingInlineEnd | ResponsiveObject<PaddingInlineEnd>;
|
|
171
160
|
width?: Width;
|
|
172
161
|
height?: Height;
|
|
173
|
-
display?: Display |
|
|
162
|
+
display?: Display | ResponsiveObject<Display>;
|
|
174
163
|
position?: Position;
|
|
175
164
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
176
165
|
};
|
|
@@ -275,6 +264,9 @@ export type BoxProps<T extends ElementType = 'div'> = Omit<
|
|
|
275
264
|
// @public (undocumented)
|
|
276
265
|
type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
|
|
277
266
|
|
|
267
|
+
// @public
|
|
268
|
+
type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
|
|
269
|
+
|
|
278
270
|
// @public
|
|
279
271
|
type CustomStyles = Pick<
|
|
280
272
|
CSSProperties,
|
|
@@ -373,6 +365,7 @@ export interface InlineProps {
|
|
|
373
365
|
alignInline?: AlignInline;
|
|
374
366
|
children: ReactNode;
|
|
375
367
|
grow?: Grow;
|
|
368
|
+
rowSpace?: RowSpace;
|
|
376
369
|
separator?: string;
|
|
377
370
|
shouldWrap?: boolean;
|
|
378
371
|
space?: Space;
|
|
@@ -487,6 +480,30 @@ type PublicBoxPropsBase = {
|
|
|
487
480
|
customStyles?: CustomStyles;
|
|
488
481
|
};
|
|
489
482
|
|
|
483
|
+
// @public
|
|
484
|
+
type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
485
|
+
|
|
486
|
+
// @public (undocumented)
|
|
487
|
+
type RowSpace = keyof typeof rowSpaceMap;
|
|
488
|
+
|
|
489
|
+
// @public (undocumented)
|
|
490
|
+
const rowSpaceMap: {
|
|
491
|
+
readonly '0': SerializedStyles;
|
|
492
|
+
readonly '025': SerializedStyles;
|
|
493
|
+
readonly '050': SerializedStyles;
|
|
494
|
+
readonly '075': SerializedStyles;
|
|
495
|
+
readonly '100': SerializedStyles;
|
|
496
|
+
readonly '150': SerializedStyles;
|
|
497
|
+
readonly '200': SerializedStyles;
|
|
498
|
+
readonly '250': SerializedStyles;
|
|
499
|
+
readonly '300': SerializedStyles;
|
|
500
|
+
readonly '400': SerializedStyles;
|
|
501
|
+
readonly '500': SerializedStyles;
|
|
502
|
+
readonly '600': SerializedStyles;
|
|
503
|
+
readonly '800': SerializedStyles;
|
|
504
|
+
readonly '1000': SerializedStyles;
|
|
505
|
+
};
|
|
506
|
+
|
|
490
507
|
// @public (undocumented)
|
|
491
508
|
type Shadow = keyof typeof shadowMap;
|
|
492
509
|
|
|
@@ -10,6 +10,7 @@ const spacingProperties: Record<
|
|
|
10
10
|
{
|
|
11
11
|
cssProperties: readonly string[];
|
|
12
12
|
responsiveOutput?: boolean;
|
|
13
|
+
propNameFormatter?: (propName: string) => string;
|
|
13
14
|
}
|
|
14
15
|
> = {
|
|
15
16
|
padding: {
|
|
@@ -24,17 +25,13 @@ const spacingProperties: Record<
|
|
|
24
25
|
],
|
|
25
26
|
responsiveOutput: true,
|
|
26
27
|
},
|
|
27
|
-
gap: {
|
|
28
|
-
cssProperties: ['gap'],
|
|
29
|
-
},
|
|
30
28
|
space: {
|
|
31
29
|
cssProperties: ['gap'],
|
|
30
|
+
propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
cssProperties: ['columnGap'],
|
|
35
|
-
},
|
|
36
|
-
rowGap: {
|
|
32
|
+
rowSpace: {
|
|
37
33
|
cssProperties: ['rowGap'],
|
|
34
|
+
propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
|
|
38
35
|
},
|
|
39
36
|
} as const;
|
|
40
37
|
|
|
@@ -55,7 +52,7 @@ export const createSpacingStylesFromTemplate = (
|
|
|
55
52
|
throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
const { cssProperties, responsiveOutput } =
|
|
55
|
+
const { cssProperties, responsiveOutput, propNameFormatter } =
|
|
59
56
|
spacingProperties[spacingProperty]!;
|
|
60
57
|
|
|
61
58
|
return (
|
|
@@ -65,10 +62,9 @@ const ${spacingProperty}Map = {
|
|
|
65
62
|
${activeTokens
|
|
66
63
|
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
|
|
67
64
|
.map(token => {
|
|
68
|
-
const propName =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
: token.name;
|
|
65
|
+
const propName = propNameFormatter
|
|
66
|
+
? propNameFormatter(token.name)
|
|
67
|
+
: token.name;
|
|
72
68
|
|
|
73
69
|
// a responsive output simply prints out a mapping of tokens
|
|
74
70
|
if (responsiveOutput) {
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { ReactElement } from 'react';
|
|
|
15
15
|
import { ReactNode } from 'react';
|
|
16
16
|
import { RefAttributes } from 'react';
|
|
17
17
|
import { SerializedStyles } from '@emotion/react';
|
|
18
|
-
import { UNSAFE_Breakpoint } from '@atlaskit/ds-explorations';
|
|
19
18
|
|
|
20
19
|
// @public (undocumented)
|
|
21
20
|
type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
|
|
@@ -122,7 +121,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
122
121
|
backgroundColor?: BackgroundColor;
|
|
123
122
|
shadow?: Shadow;
|
|
124
123
|
borderStyle?: BorderStyle;
|
|
125
|
-
borderWidth?: BorderWidth |
|
|
124
|
+
borderWidth?: BorderWidth | ResponsiveObject<BorderWidth>;
|
|
126
125
|
borderColor?: BorderColor;
|
|
127
126
|
borderRadius?: BorderRadius;
|
|
128
127
|
layer?: Layer;
|
|
@@ -133,16 +132,16 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
|
133
132
|
overflow?: Overflow;
|
|
134
133
|
overflowInline?: OverflowInline;
|
|
135
134
|
overflowBlock?: OverflowBlock;
|
|
136
|
-
padding?: Padding |
|
|
137
|
-
paddingBlock?: PaddingBlock |
|
|
138
|
-
paddingBlockStart?: PaddingBlockStart |
|
|
139
|
-
paddingBlockEnd?: PaddingBlockEnd |
|
|
140
|
-
paddingInline?: PaddingInline |
|
|
141
|
-
paddingInlineStart?: PaddingInlineStart |
|
|
142
|
-
paddingInlineEnd?: PaddingInlineEnd |
|
|
135
|
+
padding?: Padding | ResponsiveObject<Padding>;
|
|
136
|
+
paddingBlock?: PaddingBlock | ResponsiveObject<PaddingBlock>;
|
|
137
|
+
paddingBlockStart?: PaddingBlockStart | ResponsiveObject<PaddingBlockStart>;
|
|
138
|
+
paddingBlockEnd?: PaddingBlockEnd | ResponsiveObject<PaddingBlockEnd>;
|
|
139
|
+
paddingInline?: PaddingInline | ResponsiveObject<PaddingInline>;
|
|
140
|
+
paddingInlineStart?: PaddingInlineStart | ResponsiveObject<PaddingInlineStart>;
|
|
141
|
+
paddingInlineEnd?: PaddingInlineEnd | ResponsiveObject<PaddingInlineEnd>;
|
|
143
142
|
width?: Width;
|
|
144
143
|
height?: Height;
|
|
145
|
-
display?: Display |
|
|
144
|
+
display?: Display | ResponsiveObject<Display>;
|
|
146
145
|
position?: Position;
|
|
147
146
|
ref?: ComponentPropsWithRef<T>['ref'];
|
|
148
147
|
};
|
|
@@ -228,6 +227,9 @@ export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'UNS
|
|
|
228
227
|
// @public (undocumented)
|
|
229
228
|
type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
|
|
230
229
|
|
|
230
|
+
// @public
|
|
231
|
+
type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
|
|
232
|
+
|
|
231
233
|
// @public
|
|
232
234
|
type CustomStyles = Pick<CSSProperties, 'flex' | 'flexBasis' | 'float' | 'height' | 'insetBlockStart' | 'insetInlineEnd' | 'insetInlineStart' | 'margin' | 'marginBlock' | 'marginBlockEnd' | 'marginBlockStart' | 'marginInline' | 'marginInlineEnd' | 'marginInlineStart' | 'maxHeight' | 'maxWidth' | 'minHeight' | 'minWidth' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'paddingTop' | 'width'>;
|
|
233
235
|
|
|
@@ -299,6 +301,7 @@ export interface InlineProps {
|
|
|
299
301
|
alignInline?: AlignInline;
|
|
300
302
|
children: ReactNode;
|
|
301
303
|
grow?: Grow;
|
|
304
|
+
rowSpace?: RowSpace;
|
|
302
305
|
separator?: string;
|
|
303
306
|
shouldWrap?: boolean;
|
|
304
307
|
space?: Space;
|
|
@@ -413,6 +416,30 @@ type PublicBoxPropsBase = {
|
|
|
413
416
|
customStyles?: CustomStyles;
|
|
414
417
|
};
|
|
415
418
|
|
|
419
|
+
// @public
|
|
420
|
+
type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
421
|
+
|
|
422
|
+
// @public (undocumented)
|
|
423
|
+
type RowSpace = keyof typeof rowSpaceMap;
|
|
424
|
+
|
|
425
|
+
// @public (undocumented)
|
|
426
|
+
const rowSpaceMap: {
|
|
427
|
+
readonly '0': SerializedStyles;
|
|
428
|
+
readonly '025': SerializedStyles;
|
|
429
|
+
readonly '050': SerializedStyles;
|
|
430
|
+
readonly '075': SerializedStyles;
|
|
431
|
+
readonly '100': SerializedStyles;
|
|
432
|
+
readonly '150': SerializedStyles;
|
|
433
|
+
readonly '200': SerializedStyles;
|
|
434
|
+
readonly '250': SerializedStyles;
|
|
435
|
+
readonly '300': SerializedStyles;
|
|
436
|
+
readonly '400': SerializedStyles;
|
|
437
|
+
readonly '500': SerializedStyles;
|
|
438
|
+
readonly '600': SerializedStyles;
|
|
439
|
+
readonly '800': SerializedStyles;
|
|
440
|
+
readonly '1000': SerializedStyles;
|
|
441
|
+
};
|
|
442
|
+
|
|
416
443
|
// @public (undocumented)
|
|
417
444
|
type Shadow = keyof typeof shadowMap;
|
|
418
445
|
|