@atlaskit/primitives 0.3.0 → 0.3.1
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 +6 -0
- 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/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/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/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 +15 -20
- package/tmp/api-report-tmp.d.ts +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`114d6a73f72`](https://bitbucket.org/atlassian/atlassian-frontend/commits/114d6a73f72) - Cleanup the experimental responsive box utilizing our responsive helpers.
|
|
8
|
+
|
|
3
9
|
## 0.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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.1",
|
|
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,
|
|
@@ -487,6 +479,9 @@ type PublicBoxPropsBase = {
|
|
|
487
479
|
customStyles?: CustomStyles;
|
|
488
480
|
};
|
|
489
481
|
|
|
482
|
+
// @public
|
|
483
|
+
type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
484
|
+
|
|
490
485
|
// @public (undocumented)
|
|
491
486
|
type Shadow = keyof typeof shadowMap;
|
|
492
487
|
|
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
|
|
|
@@ -413,6 +415,9 @@ type PublicBoxPropsBase = {
|
|
|
413
415
|
customStyles?: CustomStyles;
|
|
414
416
|
};
|
|
415
417
|
|
|
418
|
+
// @public
|
|
419
|
+
type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
|
|
420
|
+
|
|
416
421
|
// @public (undocumented)
|
|
417
422
|
type Shadow = keyof typeof shadowMap;
|
|
418
423
|
|