@atlaskit/primitives 0.2.1 → 0.3.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 +12 -0
- package/dist/cjs/components/inline.partial.js +46 -22
- package/dist/cjs/components/internal/base-box.partial.js +99 -78
- package/dist/cjs/components/internal/types.js +8 -0
- package/dist/cjs/components/internal/utils.js +16 -0
- package/dist/cjs/components/stack.partial.js +46 -22
- package/dist/cjs/constants.js +13 -0
- package/dist/cjs/helpers/responsive/build-media-query-css.js +88 -0
- package/dist/cjs/helpers/responsive/constants.js +85 -0
- package/dist/cjs/helpers/responsive/index.js +38 -0
- package/dist/cjs/helpers/responsive/media-helper.js +84 -0
- package/dist/cjs/helpers/responsive/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +18 -18
- package/dist/es2019/components/internal/base-box.partial.js +75 -70
- package/dist/es2019/components/internal/types.js +1 -0
- package/dist/es2019/components/internal/utils.js +2 -0
- package/dist/es2019/components/stack.partial.js +18 -18
- package/dist/es2019/constants.js +3 -1
- package/dist/es2019/helpers/responsive/build-media-query-css.js +85 -0
- package/dist/es2019/helpers/responsive/constants.js +74 -0
- package/dist/es2019/helpers/responsive/index.js +3 -0
- package/dist/es2019/helpers/responsive/media-helper.js +78 -0
- package/dist/es2019/helpers/responsive/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +46 -21
- package/dist/esm/components/internal/base-box.partial.js +100 -79
- package/dist/esm/components/internal/types.js +1 -0
- package/dist/esm/components/internal/utils.js +7 -0
- package/dist/esm/components/stack.partial.js +46 -21
- package/dist/esm/constants.js +3 -1
- package/dist/esm/helpers/responsive/build-media-query-css.js +79 -0
- package/dist/esm/helpers/responsive/constants.js +76 -0
- package/dist/esm/helpers/responsive/index.js +3 -0
- package/dist/esm/helpers/responsive/media-helper.js +78 -0
- package/dist/esm/helpers/responsive/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.d.ts +3 -5
- package/dist/types/components/inline.partial.d.ts +16 -18
- package/dist/types/components/internal/base-box.partial.d.ts +49 -50
- package/dist/types/components/internal/types.d.ts +6 -0
- package/dist/types/components/internal/utils.d.ts +3 -0
- package/dist/types/components/stack.partial.d.ts +16 -18
- package/dist/types/components/types.d.ts +49 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/helpers/responsive/build-media-query-css.d.ts +57 -0
- package/dist/types/helpers/responsive/constants.d.ts +23 -0
- package/dist/types/helpers/responsive/index.d.ts +4 -0
- package/dist/types/helpers/responsive/media-helper.d.ts +45 -0
- package/dist/types/helpers/responsive/types.d.ts +47 -0
- package/package.json +6 -3
- package/report.api.md +111 -78
- package/responsive/package.json +15 -0
- package/scripts/spacing-codegen-template.tsx +29 -24
- package/scripts/utils.tsx +4 -1
- package/tmp/api-report-tmp.d.ts +88 -77
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7c280fead96`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7c280fead96) - Add new responsive helpers, breakpoints config, and types into `@atlaskit/primitives/responsive`. Exports are treated as `UNSAFE_` and experimental until modified as they're being worked on in parallel to our Alpha Grid.
|
|
8
|
+
|
|
9
|
+
## 0.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`bf90d854748`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf90d854748) - Internal representation of Box primitive now supports some responsive styles
|
|
14
|
+
|
|
3
15
|
## 0.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _react = require("react");
|
|
10
8
|
var _react2 = require("@emotion/react");
|
|
11
9
|
/** @jsx jsx */
|
|
@@ -52,30 +50,56 @@ var flexWrapStyles = (0, _react2.css)({
|
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
55
|
-
* @codegen <<SignedSource::
|
|
53
|
+
* @codegen <<SignedSource::41d7002b7f69aa44d0d8598e07a1afc6>>
|
|
56
54
|
* @codegenId spacing
|
|
57
55
|
* @codegenCommand yarn codegen-styles
|
|
58
56
|
* @codegenParams ["space"]
|
|
59
57
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
60
58
|
*/
|
|
61
|
-
var spaceMap =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
var spaceMap = {
|
|
60
|
+
'0': (0, _react2.css)({
|
|
61
|
+
gap: "var(--ds-space-0, 0px)"
|
|
62
|
+
}),
|
|
63
|
+
'025': (0, _react2.css)({
|
|
64
|
+
gap: "var(--ds-space-025, 2px)"
|
|
65
|
+
}),
|
|
66
|
+
'050': (0, _react2.css)({
|
|
67
|
+
gap: "var(--ds-space-050, 4px)"
|
|
68
|
+
}),
|
|
69
|
+
'075': (0, _react2.css)({
|
|
70
|
+
gap: "var(--ds-space-075, 6px)"
|
|
71
|
+
}),
|
|
72
|
+
'100': (0, _react2.css)({
|
|
73
|
+
gap: "var(--ds-space-100, 8px)"
|
|
74
|
+
}),
|
|
75
|
+
'150': (0, _react2.css)({
|
|
76
|
+
gap: "var(--ds-space-150, 12px)"
|
|
77
|
+
}),
|
|
78
|
+
'200': (0, _react2.css)({
|
|
79
|
+
gap: "var(--ds-space-200, 16px)"
|
|
80
|
+
}),
|
|
81
|
+
'250': (0, _react2.css)({
|
|
82
|
+
gap: "var(--ds-space-250, 20px)"
|
|
83
|
+
}),
|
|
84
|
+
'300': (0, _react2.css)({
|
|
85
|
+
gap: "var(--ds-space-300, 24px)"
|
|
86
|
+
}),
|
|
87
|
+
'400': (0, _react2.css)({
|
|
88
|
+
gap: "var(--ds-space-400, 32px)"
|
|
89
|
+
}),
|
|
90
|
+
'500': (0, _react2.css)({
|
|
91
|
+
gap: "var(--ds-space-500, 40px)"
|
|
92
|
+
}),
|
|
93
|
+
'600': (0, _react2.css)({
|
|
94
|
+
gap: "var(--ds-space-600, 48px)"
|
|
95
|
+
}),
|
|
96
|
+
'800': (0, _react2.css)({
|
|
97
|
+
gap: "var(--ds-space-800, 64px)"
|
|
98
|
+
}),
|
|
99
|
+
'1000': (0, _react2.css)({
|
|
100
|
+
gap: "var(--ds-space-1000, 80px)"
|
|
101
|
+
})
|
|
102
|
+
};
|
|
79
103
|
/**
|
|
80
104
|
* @codegenEnd
|
|
81
105
|
*/
|
|
@@ -133,7 +157,7 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
133
157
|
}) : rawChildren;
|
|
134
158
|
var justifyContent = spread || alignInline;
|
|
135
159
|
return (0, _react2.jsx)("div", {
|
|
136
|
-
css: [baseStyles, space && spaceMap
|
|
160
|
+
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles],
|
|
137
161
|
"data-testid": testId,
|
|
138
162
|
ref: ref
|
|
139
163
|
}, children);
|
|
@@ -5,13 +5,48 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.BaseBox = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
13
14
|
var _constants = require("../../constants");
|
|
15
|
+
var _types = require("./types");
|
|
16
|
+
var _utils = require("./utils");
|
|
14
17
|
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
|
+
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
|
+
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
|
+
var responsiveRules = _types.BOX_RESPONSIVE_PROPS.reduce(function (mapping, cssProperty) {
|
|
21
|
+
return Object.assign(mapping, (0, _defineProperty2.default)({}, cssProperty, _constants.BREAKPOINTS_LIST.reduce(function (configs, breakpoint) {
|
|
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
|
+
}, {
|
|
25
|
+
static: (0, _react2.css)((0, _defineProperty2.default)({}, cssProperty, "var(--ds-box-static-".concat(cssProperty, ")")))
|
|
26
|
+
})));
|
|
27
|
+
}, {});
|
|
28
|
+
var getResponsiveVars = function getResponsiveVars(propertyName, propertyValue, mapping) {
|
|
29
|
+
if ((0, _utils.isResponsiveStyleProp)(propertyValue)) {
|
|
30
|
+
return Object.keys(propertyValue).reduce(function (vars, breakpoint) {
|
|
31
|
+
return _objectSpread(_objectSpread({}, vars), {}, (0, _defineProperty2.default)({}, "--ds-box-responsive-".concat(propertyName, "-").concat(breakpoint), mapping[propertyValue[breakpoint]]));
|
|
32
|
+
}, {});
|
|
33
|
+
} else if ((0, _utils.isStaticStyleProp)(propertyValue)) {
|
|
34
|
+
return (0, _defineProperty2.default)({}, "--ds-box-static-".concat(propertyName), mapping[propertyValue]);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var getResponsiveStyles = function getResponsiveStyles(propertyName, propertyValue) {
|
|
38
|
+
(0, _tinyInvariant.default)(typeof responsiveRules[propertyName] !== 'undefined', "Responsive rules for \"".concat(propertyName, "\" have not been statically defined."));
|
|
39
|
+
if ((0, _utils.isResponsiveStyleProp)(propertyValue)) {
|
|
40
|
+
return Object.keys(propertyValue).map(function (responsiveProp) {
|
|
41
|
+
return responsiveRules[propertyName][responsiveProp];
|
|
42
|
+
});
|
|
43
|
+
} else if ((0, _utils.isStaticStyleProp)(propertyValue)) {
|
|
44
|
+
return responsiveRules[propertyName].static;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
49
|
+
|
|
15
50
|
/**
|
|
16
51
|
* __Box__
|
|
17
52
|
*
|
|
@@ -20,49 +55,50 @@ var _excluded = ["as", "className", "children", "color", "backgroundColor", "sha
|
|
|
20
55
|
*
|
|
21
56
|
* @internal
|
|
22
57
|
*/
|
|
23
|
-
var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
24
|
-
var as =
|
|
25
|
-
className =
|
|
26
|
-
children =
|
|
27
|
-
color =
|
|
28
|
-
backgroundColor =
|
|
29
|
-
shadow =
|
|
30
|
-
borderStyle =
|
|
31
|
-
borderWidth =
|
|
32
|
-
borderRadius =
|
|
33
|
-
borderColor =
|
|
34
|
-
layer =
|
|
35
|
-
flex =
|
|
36
|
-
flexGrow =
|
|
37
|
-
flexShrink =
|
|
38
|
-
alignSelf =
|
|
39
|
-
overflow =
|
|
40
|
-
overflowInline =
|
|
41
|
-
overflowBlock =
|
|
42
|
-
padding =
|
|
43
|
-
paddingBlock =
|
|
44
|
-
paddingBlockStart =
|
|
45
|
-
paddingBlockEnd =
|
|
46
|
-
paddingInline =
|
|
47
|
-
paddingInlineStart =
|
|
48
|
-
paddingInlineEnd =
|
|
49
|
-
height =
|
|
50
|
-
width =
|
|
51
|
-
|
|
52
|
-
display =
|
|
53
|
-
|
|
54
|
-
position =
|
|
55
|
-
UNSAFE_style =
|
|
56
|
-
testId =
|
|
57
|
-
htmlAttributes = (0, _objectWithoutProperties2.default)(
|
|
58
|
+
var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
59
|
+
var as = _ref2.as,
|
|
60
|
+
className = _ref2.className,
|
|
61
|
+
children = _ref2.children,
|
|
62
|
+
color = _ref2.color,
|
|
63
|
+
backgroundColor = _ref2.backgroundColor,
|
|
64
|
+
shadow = _ref2.shadow,
|
|
65
|
+
borderStyle = _ref2.borderStyle,
|
|
66
|
+
borderWidth = _ref2.borderWidth,
|
|
67
|
+
borderRadius = _ref2.borderRadius,
|
|
68
|
+
borderColor = _ref2.borderColor,
|
|
69
|
+
layer = _ref2.layer,
|
|
70
|
+
flex = _ref2.flex,
|
|
71
|
+
flexGrow = _ref2.flexGrow,
|
|
72
|
+
flexShrink = _ref2.flexShrink,
|
|
73
|
+
alignSelf = _ref2.alignSelf,
|
|
74
|
+
overflow = _ref2.overflow,
|
|
75
|
+
overflowInline = _ref2.overflowInline,
|
|
76
|
+
overflowBlock = _ref2.overflowBlock,
|
|
77
|
+
padding = _ref2.padding,
|
|
78
|
+
paddingBlock = _ref2.paddingBlock,
|
|
79
|
+
paddingBlockStart = _ref2.paddingBlockStart,
|
|
80
|
+
paddingBlockEnd = _ref2.paddingBlockEnd,
|
|
81
|
+
paddingInline = _ref2.paddingInline,
|
|
82
|
+
paddingInlineStart = _ref2.paddingInlineStart,
|
|
83
|
+
paddingInlineEnd = _ref2.paddingInlineEnd,
|
|
84
|
+
height = _ref2.height,
|
|
85
|
+
width = _ref2.width,
|
|
86
|
+
_ref2$display = _ref2.display,
|
|
87
|
+
display = _ref2$display === void 0 ? displayMap.block : _ref2$display,
|
|
88
|
+
_ref2$position = _ref2.position,
|
|
89
|
+
position = _ref2$position === void 0 ? 'static' : _ref2$position,
|
|
90
|
+
UNSAFE_style = _ref2.UNSAFE_style,
|
|
91
|
+
testId = _ref2.testId,
|
|
92
|
+
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
58
93
|
var Component = as || 'div';
|
|
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));
|
|
59
95
|
var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
60
|
-
style:
|
|
96
|
+
style: inlineStyles,
|
|
61
97
|
ref: ref
|
|
62
98
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
63
99
|
}, htmlAttributes, {
|
|
64
100
|
className: className,
|
|
65
|
-
css: [baseStyles, display
|
|
101
|
+
css: [baseStyles].concat([getResponsiveStyles('borderWidth', borderWidth), getResponsiveStyles('display', display), getResponsiveStyles('padding', padding), getResponsiveStyles('paddingBlock', paddingBlock), getResponsiveStyles('paddingBlockStart', paddingBlockStart), getResponsiveStyles('paddingBlockEnd', paddingBlockEnd), getResponsiveStyles('paddingInline', paddingInline), getResponsiveStyles('paddingInlineStart', paddingInlineStart), getResponsiveStyles('paddingInlineEnd', paddingInlineEnd)], [backgroundColor && backgroundColorMap[backgroundColor], borderColor && borderColorMap[borderColor], color && textColorMap[color], flex && flexMap[flex], flexGrow && flexGrowMap[flexGrow], flexShrink && flexShrinkMap[flexShrink], alignSelf && alignSelfMap[alignSelf], overflow && overflowMap[overflow], overflowInline && overflowInlineMap[overflowInline], overflowBlock && overflowBlockMap[overflowBlock], position && positionMap[position], borderStyle && borderStyleMap[borderStyle], borderRadius && borderRadiusMap[borderRadius], shadow && shadowMap[shadow], layer && layerMap[layer], overflow && overflowMap[overflow], width && widthMap[width], height && heightMap[height]]),
|
|
66
102
|
"data-testid": testId
|
|
67
103
|
}), children);
|
|
68
104
|
return node;
|
|
@@ -80,12 +116,9 @@ var borderStyleMap = {
|
|
|
80
116
|
})
|
|
81
117
|
};
|
|
82
118
|
var borderWidthMap = {
|
|
83
|
-
'size.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
'size.100': (0, _react2.css)({
|
|
87
|
-
borderWidth: "var(--ds-width-100, 2px)"
|
|
88
|
-
})
|
|
119
|
+
'size.0': "var(--ds-width-0, 0)",
|
|
120
|
+
'size.050': "var(--ds-width-050, 1px)",
|
|
121
|
+
'size.100': "var(--ds-width-100, 2px)"
|
|
89
122
|
};
|
|
90
123
|
var borderRadiusMap = {
|
|
91
124
|
'radius.100': (0, _react2.css)({
|
|
@@ -143,21 +176,11 @@ var alignSelfMap = {
|
|
|
143
176
|
})
|
|
144
177
|
};
|
|
145
178
|
var displayMap = {
|
|
146
|
-
block:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
inline:
|
|
150
|
-
|
|
151
|
-
}),
|
|
152
|
-
flex: (0, _react2.css)({
|
|
153
|
-
display: 'flex'
|
|
154
|
-
}),
|
|
155
|
-
'inline-flex': (0, _react2.css)({
|
|
156
|
-
display: 'inline-flex'
|
|
157
|
-
}),
|
|
158
|
-
'inline-block': (0, _react2.css)({
|
|
159
|
-
display: 'inline-block'
|
|
160
|
-
})
|
|
179
|
+
block: 'block',
|
|
180
|
+
inline: 'inline',
|
|
181
|
+
flex: 'flex',
|
|
182
|
+
'inline-flex': 'inline-flex',
|
|
183
|
+
'inline-block': 'inline-block'
|
|
161
184
|
};
|
|
162
185
|
var positionMap = {
|
|
163
186
|
absolute: (0, _react2.css)({
|
|
@@ -372,30 +395,28 @@ var maxHeightMap = {
|
|
|
372
395
|
|
|
373
396
|
/**
|
|
374
397
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
375
|
-
* @codegen <<SignedSource::
|
|
398
|
+
* @codegen <<SignedSource::84fd352b0e6509d380a0dcf8ad023ca2>>
|
|
376
399
|
* @codegenId spacing
|
|
377
400
|
* @codegenCommand yarn codegen-styles
|
|
378
401
|
* @codegenParams ["padding"]
|
|
379
402
|
* @codegenDependency ../../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
380
403
|
*/
|
|
381
|
-
var paddingMap =
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}];
|
|
398
|
-
}));
|
|
404
|
+
var paddingMap = {
|
|
405
|
+
'space.0': "var(--ds-space-0, 0px)",
|
|
406
|
+
'space.025': "var(--ds-space-025, 2px)",
|
|
407
|
+
'space.050': "var(--ds-space-050, 4px)",
|
|
408
|
+
'space.075': "var(--ds-space-075, 6px)",
|
|
409
|
+
'space.100': "var(--ds-space-100, 8px)",
|
|
410
|
+
'space.150': "var(--ds-space-150, 12px)",
|
|
411
|
+
'space.200': "var(--ds-space-200, 16px)",
|
|
412
|
+
'space.250': "var(--ds-space-250, 20px)",
|
|
413
|
+
'space.300': "var(--ds-space-300, 24px)",
|
|
414
|
+
'space.400': "var(--ds-space-400, 32px)",
|
|
415
|
+
'space.500': "var(--ds-space-500, 40px)",
|
|
416
|
+
'space.600': "var(--ds-space-600, 48px)",
|
|
417
|
+
'space.800': "var(--ds-space-800, 64px)",
|
|
418
|
+
'space.1000': "var(--ds-space-1000, 80px)"
|
|
419
|
+
};
|
|
399
420
|
/**
|
|
400
421
|
* @codegenEnd
|
|
401
422
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BOX_RESPONSIVE_PROPS = void 0;
|
|
7
|
+
var BOX_RESPONSIVE_PROPS = ['borderWidth', 'display', 'padding', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd'];
|
|
8
|
+
exports.BOX_RESPONSIVE_PROPS = BOX_RESPONSIVE_PROPS;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isStaticStyleProp = exports.isResponsiveStyleProp = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var isResponsiveStyleProp = function isResponsiveStyleProp(propertyValue) {
|
|
10
|
+
return (0, _typeof2.default)(propertyValue) === 'object';
|
|
11
|
+
};
|
|
12
|
+
exports.isResponsiveStyleProp = isResponsiveStyleProp;
|
|
13
|
+
var isStaticStyleProp = function isStaticStyleProp(propertyValue) {
|
|
14
|
+
return typeof propertyValue === 'string';
|
|
15
|
+
};
|
|
16
|
+
exports.isStaticStyleProp = isStaticStyleProp;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _react = require("react");
|
|
10
8
|
var _react2 = require("@emotion/react");
|
|
11
9
|
/** @jsx jsx */
|
|
@@ -46,30 +44,56 @@ var flexGrowMap = {
|
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
46
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
49
|
-
* @codegen <<SignedSource::
|
|
47
|
+
* @codegen <<SignedSource::41d7002b7f69aa44d0d8598e07a1afc6>>
|
|
50
48
|
* @codegenId spacing
|
|
51
49
|
* @codegenCommand yarn codegen-styles
|
|
52
50
|
* @codegenParams ["space"]
|
|
53
51
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
54
52
|
*/
|
|
55
|
-
var spaceMap =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
53
|
+
var spaceMap = {
|
|
54
|
+
'0': (0, _react2.css)({
|
|
55
|
+
gap: "var(--ds-space-0, 0px)"
|
|
56
|
+
}),
|
|
57
|
+
'025': (0, _react2.css)({
|
|
58
|
+
gap: "var(--ds-space-025, 2px)"
|
|
59
|
+
}),
|
|
60
|
+
'050': (0, _react2.css)({
|
|
61
|
+
gap: "var(--ds-space-050, 4px)"
|
|
62
|
+
}),
|
|
63
|
+
'075': (0, _react2.css)({
|
|
64
|
+
gap: "var(--ds-space-075, 6px)"
|
|
65
|
+
}),
|
|
66
|
+
'100': (0, _react2.css)({
|
|
67
|
+
gap: "var(--ds-space-100, 8px)"
|
|
68
|
+
}),
|
|
69
|
+
'150': (0, _react2.css)({
|
|
70
|
+
gap: "var(--ds-space-150, 12px)"
|
|
71
|
+
}),
|
|
72
|
+
'200': (0, _react2.css)({
|
|
73
|
+
gap: "var(--ds-space-200, 16px)"
|
|
74
|
+
}),
|
|
75
|
+
'250': (0, _react2.css)({
|
|
76
|
+
gap: "var(--ds-space-250, 20px)"
|
|
77
|
+
}),
|
|
78
|
+
'300': (0, _react2.css)({
|
|
79
|
+
gap: "var(--ds-space-300, 24px)"
|
|
80
|
+
}),
|
|
81
|
+
'400': (0, _react2.css)({
|
|
82
|
+
gap: "var(--ds-space-400, 32px)"
|
|
83
|
+
}),
|
|
84
|
+
'500': (0, _react2.css)({
|
|
85
|
+
gap: "var(--ds-space-500, 40px)"
|
|
86
|
+
}),
|
|
87
|
+
'600': (0, _react2.css)({
|
|
88
|
+
gap: "var(--ds-space-600, 48px)"
|
|
89
|
+
}),
|
|
90
|
+
'800': (0, _react2.css)({
|
|
91
|
+
gap: "var(--ds-space-800, 64px)"
|
|
92
|
+
}),
|
|
93
|
+
'1000': (0, _react2.css)({
|
|
94
|
+
gap: "var(--ds-space-1000, 80px)"
|
|
95
|
+
})
|
|
96
|
+
};
|
|
73
97
|
/**
|
|
74
98
|
* @codegenEnd
|
|
75
99
|
*/
|
|
@@ -104,7 +128,7 @@ var Stack = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(f
|
|
|
104
128
|
testId = _ref.testId;
|
|
105
129
|
var justifyContent = spread || alignBlock;
|
|
106
130
|
return (0, _react2.jsx)("div", {
|
|
107
|
-
css: [baseStyles, space && spaceMap
|
|
131
|
+
css: [baseStyles, space && spaceMap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
|
|
108
132
|
"data-testid": testId,
|
|
109
133
|
ref: ref
|
|
110
134
|
}, children);
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,7 +3,20 @@
|
|
|
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
|
+
});
|
|
6
18
|
exports.LAYERS = void 0;
|
|
19
|
+
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
7
20
|
var LAYERS = {
|
|
8
21
|
card: 100,
|
|
9
22
|
navigation: 200,
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.UNSAFE_buildBelowMediaQueryCSS = exports.UNSAFE_buildAboveMediaQueryCSS = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = require("@emotion/react");
|
|
11
|
+
var _constants = require("./constants");
|
|
12
|
+
var _mediaHelper = require("./media-helper");
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
/**
|
|
16
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
17
|
+
*
|
|
18
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
22
|
+
* ```ts
|
|
23
|
+
* const hideMediaQueries = buildAboveMediaQueryCSS({ display: 'none' });
|
|
24
|
+
*
|
|
25
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
26
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* xxs: css({ '@media (min-width: 0px)': { display: 'none' } }),
|
|
34
|
+
* xs: css({ '@media (min-width: …px)': { display: 'none' } }),
|
|
35
|
+
* sm: css({ '@media (min-width: …px)': { display: 'none' } }),
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
var UNSAFE_buildAboveMediaQueryCSS = function UNSAFE_buildAboveMediaQueryCSS(input) {
|
|
40
|
+
return _constants.UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce(function (acc, breakpoint) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.UNSAFE_media.above[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
42
|
+
}, {});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Build a map of breakpoints to css with media queries and nested styles.
|
|
47
|
+
*
|
|
48
|
+
* WARNING: The smallest breakpoint is not a valid key as a media query below 0px is misleading.
|
|
49
|
+
* This is separated from `buildAboveMediaQueryCSS` for that specific reason, you cannot have type safety with this variance.
|
|
50
|
+
*
|
|
51
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* A map to build optional `display:none` for consumption on a div.
|
|
55
|
+
* ```ts
|
|
56
|
+
* const hideMediaQueries = buildBelowMediaQueryCSS({ display: 'none' });
|
|
57
|
+
*
|
|
58
|
+
* const Component = ({ hideAtBreakpoints: ('xs' | 'sm')[], children: ReactNode }) => {
|
|
59
|
+
* return <div css={hideAtBreakpoints.map(b => hideMediaQueries[b])}>{children}</div>;
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* This roughly builds a map that will look roughly like this (if done manually):
|
|
64
|
+
* ```ts
|
|
65
|
+
* {
|
|
66
|
+
* xs: css({ '@media (max-width: …px)': { display: 'none' } }),
|
|
67
|
+
* sm: css({ '@media (max-width: …px)': { display: 'none' } }),
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @experimental Unsafe for usage as the API is not finalized.
|
|
72
|
+
*/
|
|
73
|
+
exports.UNSAFE_buildAboveMediaQueryCSS = UNSAFE_buildAboveMediaQueryCSS;
|
|
74
|
+
var UNSAFE_buildBelowMediaQueryCSS = function UNSAFE_buildBelowMediaQueryCSS(input) {
|
|
75
|
+
/**
|
|
76
|
+
* WARNING: it's very important that these are in the correct order.
|
|
77
|
+
* If they are not, cascading is not in the order higher/low breakpoints do not override as expected.
|
|
78
|
+
*/
|
|
79
|
+
var reversedBreakpoints = (0, _toConsumableArray2.default)(_constants.UNSAFE_BREAKPOINTS_ORDERED_LIST).reverse();
|
|
80
|
+
return reversedBreakpoints.reduce(function (acc, breakpoint) {
|
|
81
|
+
// Omit `media.below.xxs` as it's not available as that would be `<0px`…
|
|
82
|
+
if (breakpoint === _constants.SMALLEST_BREAKPOINT) {
|
|
83
|
+
return acc;
|
|
84
|
+
}
|
|
85
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, breakpoint, (0, _react.css)((0, _defineProperty2.default)({}, _mediaHelper.UNSAFE_media.below[breakpoint], typeof input === 'function' ? input(breakpoint) : input))));
|
|
86
|
+
}, {});
|
|
87
|
+
};
|
|
88
|
+
exports.UNSAFE_buildBelowMediaQueryCSS = UNSAFE_buildBelowMediaQueryCSS;
|