@atlaskit/primitives 0.7.1 → 0.8.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 +20 -0
- package/constellation/accessibility/examples.mdx +9 -0
- package/constellation/box/code.mdx +7 -0
- package/constellation/box/examples.mdx +7 -0
- package/constellation/inline/examples.mdx +83 -0
- package/constellation/inline/props.mdx +3 -0
- package/constellation/inline/usage.mdx +7 -0
- package/constellation/overview/examples.mdx +9 -0
- package/constellation/stack/code.mdx +9 -0
- package/constellation/stack/examples.mdx +7 -0
- package/dist/cjs/components/{inline.partial.js → inline.js} +2 -34
- package/dist/cjs/components/stack.js +86 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/internal/style-maps.partial.js +34 -6
- package/dist/cjs/internal/xcss.js +5 -9
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/{inline.partial.js → inline.js} +2 -58
- package/dist/es2019/components/stack.js +79 -0
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/internal/style-maps.partial.js +30 -5
- package/dist/es2019/internal/xcss.js +5 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{inline.partial.js → inline.js} +2 -33
- package/dist/esm/components/stack.js +78 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/internal/style-maps.partial.js +30 -5
- package/dist/esm/internal/xcss.js +5 -8
- package/dist/esm/version.json +1 -1
- package/dist/types/components/{inline.partial.d.ts → inline.d.ts} +2 -29
- package/dist/types/components/{stack.partial.d.ts → stack.d.ts} +2 -28
- package/dist/types/index.d.ts +2 -2
- package/dist/types/internal/style-maps.partial.d.ts +31 -5
- package/dist/types/internal/xcss.d.ts +1 -6
- package/extract-react-types/inline.tsx +3 -0
- package/inline/package.json +5 -5
- package/package.json +52 -7
- package/report.api.md +31 -47
- package/scripts/codegen-file-templates/flex-direction.tsx +6 -0
- package/scripts/codegen-styles.tsx +69 -70
- package/scripts/misc-codegen-template.tsx +1 -0
- package/scripts/spacing-codegen-template.tsx +1 -6
- package/stack/package.json +5 -5
- package/tmp/api-report-tmp.d.ts +31 -47
- package/dist/cjs/components/stack.partial.js +0 -118
- package/dist/es2019/components/stack.partial.js +0 -135
- package/dist/esm/components/stack.partial.js +0 -109
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`ac4c8695d3f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac4c8695d3f) - Constrain CSS values of flex-direction to account for accessibility considerations.
|
|
14
|
+
- [`4d19bdd2218`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d19bdd2218) - **Inline**:
|
|
15
|
+
|
|
16
|
+
- `space` prop now accepts values in the form `space.XXX`. For example: `space="space.100"`.
|
|
17
|
+
- `rowSpace` prop now accepts values in the form `space.XXX`. For example: `rowSpace="space.100"`.
|
|
18
|
+
|
|
19
|
+
**Stack**:
|
|
20
|
+
|
|
21
|
+
- `space` prop now accepts values in the form `space.XXX`. For example: `space="space.100"`.
|
|
22
|
+
|
|
3
23
|
## 0.7.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inline
|
|
3
|
+
description: Inline is an abstraction to lay-out a group of elements horizontally.
|
|
4
|
+
order: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import InlineBasic from '../../examples/constellation/inline/basic';
|
|
8
|
+
import InlineSpaceBasic from '../../examples/constellation/inline/space-basic';
|
|
9
|
+
import InlineSpaceWrap from '../../examples/constellation/inline/space-wrap';
|
|
10
|
+
import InlineAlignBlock from '../../examples/constellation/inline/align-block';
|
|
11
|
+
import InlineAlignInline from '../../examples/constellation/inline/align-inline';
|
|
12
|
+
import InlineSpread from '../../examples/constellation/inline/spread';
|
|
13
|
+
import InlineWrap from '../../examples/constellation/inline/wrap';
|
|
14
|
+
import InlineSeparator from '../../examples/constellation/inline/separator';
|
|
15
|
+
import InlineGrow from '../../examples/constellation/inline/grow';
|
|
16
|
+
import InlineAs from '../../examples/constellation/inline/as';
|
|
17
|
+
|
|
18
|
+
## Basic
|
|
19
|
+
|
|
20
|
+
Inline is an abstraction to efficiently lay-out a group of elements horizontally.
|
|
21
|
+
Use the given props to configure display behaviour using scalable recommendations of the Atlassian Design System.
|
|
22
|
+
|
|
23
|
+
<Example Component={InlineBasic} packageName="@atlaskit/primitives/inline" />
|
|
24
|
+
|
|
25
|
+
## Space
|
|
26
|
+
|
|
27
|
+
Spacing between items can be controlled with the `space` prop:
|
|
28
|
+
|
|
29
|
+
<Example Component={InlineSpaceBasic} packageName="@atlaskit/primitives/inline" />
|
|
30
|
+
|
|
31
|
+
When content is set to wrap the `space` prop applies equal spacing between rows as well:
|
|
32
|
+
|
|
33
|
+
<Example Component={InlineSpaceWrap} packageName="@atlaskit/primitives/inline" />
|
|
34
|
+
|
|
35
|
+
For a different space value between rows use the `rowSpace` prop, as shown in the dynamic example above.
|
|
36
|
+
|
|
37
|
+
## Alignment
|
|
38
|
+
|
|
39
|
+
To control the alignment of items you can use the `alignBlock` and `alignInline` props which, respectively, control
|
|
40
|
+
aligment in the block and inline directions.
|
|
41
|
+
|
|
42
|
+
### Block alignment
|
|
43
|
+
|
|
44
|
+
<Example Component={InlineAlignBlock} packageName="@atlaskit/primitives/inline" />
|
|
45
|
+
|
|
46
|
+
### Inline alignment
|
|
47
|
+
|
|
48
|
+
<Example Component={InlineAlignInline} packageName="@atlaskit/primitives/inline" />
|
|
49
|
+
|
|
50
|
+
## Spread
|
|
51
|
+
|
|
52
|
+
Elements can be set to stay together next to each other (default behaviour) or spread equally in the space available.
|
|
53
|
+
|
|
54
|
+
<Example Component={InlineSpread} packageName="@atlaskit/primitives/inline" />
|
|
55
|
+
|
|
56
|
+
## Wrap
|
|
57
|
+
|
|
58
|
+
When the number of items goes beyond the available space `shouldWrap` can be used to create new rows of content.
|
|
59
|
+
|
|
60
|
+
<Example Component={InlineWrap} packageName="@atlaskit/primitives/inline" />
|
|
61
|
+
|
|
62
|
+
## Separator
|
|
63
|
+
|
|
64
|
+
For logically related elements it's possible to specify an arbitrary `separator` value.
|
|
65
|
+
|
|
66
|
+
<Example Component={InlineSeparator} packageName="@atlaskit/primitives/inline" />
|
|
67
|
+
|
|
68
|
+
## Width control
|
|
69
|
+
|
|
70
|
+
By default an `Inline` will have its width influenced by the context where it appears.
|
|
71
|
+
|
|
72
|
+
To control that the `grow` prop can be used with the values:
|
|
73
|
+
|
|
74
|
+
* `hug` (default) to use space only as required by its children, or
|
|
75
|
+
* `fill` to take all space provided by the parent element.
|
|
76
|
+
|
|
77
|
+
<Example Component={InlineGrow} packageName="@atlaskit/primitives/inline" />
|
|
78
|
+
|
|
79
|
+
## Output element
|
|
80
|
+
|
|
81
|
+
It's possible to control the rendered HTML element with the `as` prop.
|
|
82
|
+
|
|
83
|
+
<Example Component={InlineAs} packageName="@atlaskit/primitives/inline" />
|
|
@@ -1,13 +1,12 @@
|
|
|
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");
|
|
9
|
+
var _styleMaps = require("../internal/style-maps.partial");
|
|
11
10
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
12
11
|
/** @jsx jsx */
|
|
13
12
|
|
|
@@ -51,37 +50,6 @@ var flexGrowMap = {
|
|
|
51
50
|
var flexWrapStyles = (0, _react2.css)({
|
|
52
51
|
flexWrap: 'wrap'
|
|
53
52
|
});
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
57
|
-
* @codegen <<SignedSource::fb7587b114753ed19425e2b07b5deb0d>>
|
|
58
|
-
* @codegenId spacing
|
|
59
|
-
* @codegenCommand yarn codegen-styles
|
|
60
|
-
* @codegenParams ["inlineSpace"]
|
|
61
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
62
|
-
*/
|
|
63
|
-
var inlineSpaceMap = Object.fromEntries(['gap', 'rowGap'].map(function (property) {
|
|
64
|
-
return [property, {
|
|
65
|
-
'0': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-0, 0px)")),
|
|
66
|
-
'025': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-025, 2px)")),
|
|
67
|
-
'050': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-050, 4px)")),
|
|
68
|
-
'075': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-075, 6px)")),
|
|
69
|
-
'100': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-100, 8px)")),
|
|
70
|
-
'150': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-150, 12px)")),
|
|
71
|
-
'200': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-200, 16px)")),
|
|
72
|
-
'250': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-250, 20px)")),
|
|
73
|
-
'300': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-300, 24px)")),
|
|
74
|
-
'400': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-400, 32px)")),
|
|
75
|
-
'500': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-500, 40px)")),
|
|
76
|
-
'600': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-600, 48px)")),
|
|
77
|
-
'800': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-800, 64px)")),
|
|
78
|
-
'1000': (0, _react2.css)((0, _defineProperty2.default)({}, property, "var(--ds-space-1000, 80px)"))
|
|
79
|
-
}];
|
|
80
|
-
}));
|
|
81
|
-
/**
|
|
82
|
-
* @codegenEnd
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
53
|
var baseStyles = (0, _react2.css)({
|
|
86
54
|
display: 'flex',
|
|
87
55
|
boxSizing: 'border-box',
|
|
@@ -138,7 +106,7 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
138
106
|
}) : rawChildren;
|
|
139
107
|
var justifyContent = spread || alignInline;
|
|
140
108
|
return (0, _react2.jsx)(Component, {
|
|
141
|
-
css: [baseStyles, space &&
|
|
109
|
+
css: [baseStyles, space && _styleMaps.spaceStylesMap.gap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && _styleMaps.spaceStylesMap.rowGap[rowSpace]],
|
|
142
110
|
"data-testid": testId,
|
|
143
111
|
ref: ref
|
|
144
112
|
}, children);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
9
|
+
var _styleMaps = require("../internal/style-maps.partial");
|
|
10
|
+
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
11
|
+
/** @jsx jsx */
|
|
12
|
+
|
|
13
|
+
var justifyContentMap = {
|
|
14
|
+
start: (0, _react2.css)({
|
|
15
|
+
justifyContent: 'start'
|
|
16
|
+
}),
|
|
17
|
+
center: (0, _react2.css)({
|
|
18
|
+
justifyContent: 'center'
|
|
19
|
+
}),
|
|
20
|
+
end: (0, _react2.css)({
|
|
21
|
+
justifyContent: 'end'
|
|
22
|
+
}),
|
|
23
|
+
'space-between': (0, _react2.css)({
|
|
24
|
+
justifyContent: 'space-between'
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
var alignItemsMap = {
|
|
28
|
+
start: (0, _react2.css)({
|
|
29
|
+
alignItems: 'start'
|
|
30
|
+
}),
|
|
31
|
+
center: (0, _react2.css)({
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
}),
|
|
34
|
+
end: (0, _react2.css)({
|
|
35
|
+
alignItems: 'end'
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
var flexGrowMap = {
|
|
39
|
+
hug: (0, _react2.css)({
|
|
40
|
+
flexGrow: 0
|
|
41
|
+
}),
|
|
42
|
+
fill: (0, _react2.css)({
|
|
43
|
+
width: '100%',
|
|
44
|
+
flexGrow: 1
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
var baseStyles = (0, _react2.css)({
|
|
48
|
+
display: 'flex',
|
|
49
|
+
boxSizing: 'border-box',
|
|
50
|
+
flexDirection: 'column'
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* __Stack__
|
|
55
|
+
*
|
|
56
|
+
* Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Stack>
|
|
61
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
62
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
63
|
+
* </Stack>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
var Stack = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
68
|
+
var as = _ref.as,
|
|
69
|
+
alignItems = _ref.alignInline,
|
|
70
|
+
alignBlock = _ref.alignBlock,
|
|
71
|
+
spread = _ref.spread,
|
|
72
|
+
grow = _ref.grow,
|
|
73
|
+
space = _ref.space,
|
|
74
|
+
children = _ref.children,
|
|
75
|
+
testId = _ref.testId;
|
|
76
|
+
var Component = as || 'div';
|
|
77
|
+
var justifyContent = spread || alignBlock;
|
|
78
|
+
return (0, _react2.jsx)(Component, {
|
|
79
|
+
css: [baseStyles, space && _styleMaps.spaceStylesMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
|
|
80
|
+
"data-testid": testId,
|
|
81
|
+
ref: ref
|
|
82
|
+
}, children);
|
|
83
|
+
}));
|
|
84
|
+
Stack.displayName = 'Stack';
|
|
85
|
+
var _default = Stack;
|
|
86
|
+
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,6 +29,6 @@ Object.defineProperty(exports, "xcss", {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
var _box = _interopRequireDefault(require("./components/box"));
|
|
32
|
-
var _inline = _interopRequireDefault(require("./components/inline
|
|
32
|
+
var _inline = _interopRequireDefault(require("./components/inline"));
|
|
33
33
|
var _xcss = require("./internal/xcss");
|
|
34
|
-
var _stack = _interopRequireDefault(require("./components/stack
|
|
34
|
+
var _stack = _interopRequireDefault(require("./components/stack"));
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textColorMap = exports.shadowMap = exports.positionMap = exports.paddingStylesMap = exports.paddingMap = exports.overflowMap = exports.overflowInlineMap = exports.overflowBlockMap = exports.layerMap = exports.flexShrinkMap = exports.flexMap = exports.flexGrowMap = exports.dimensionMap = exports.borderWidthMap = exports.borderStyleMap = exports.borderRadiusMap = exports.borderColorMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = exports.alignSelfMap = void 0;
|
|
7
|
+
exports.textColorMap = exports.spaceStylesMap = exports.spaceMap = exports.shadowMap = exports.positionMap = exports.paddingStylesMap = exports.paddingMap = exports.overflowMap = exports.overflowInlineMap = exports.overflowBlockMap = exports.layerMap = exports.flexShrinkMap = exports.flexMap = exports.flexGrowMap = exports.flexDirectionMap = exports.dimensionMap = exports.borderWidthMap = exports.borderStyleMap = exports.borderRadiusMap = exports.borderColorMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = exports.alignSelfMap = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
/**
|
|
@@ -32,10 +32,10 @@ exports.dimensionMap = dimensionMap;
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
35
|
-
* @codegen <<SignedSource::
|
|
35
|
+
* @codegen <<SignedSource::b8ac4fd29ba83e2ab1c2713c35915067>>
|
|
36
36
|
* @codegenId spacing
|
|
37
37
|
* @codegenCommand yarn codegen-styles
|
|
38
|
-
* @codegenParams ["padding"]
|
|
38
|
+
* @codegenParams ["padding", "space"]
|
|
39
39
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
40
40
|
*/
|
|
41
41
|
var paddingMap = {
|
|
@@ -55,6 +55,23 @@ var paddingMap = {
|
|
|
55
55
|
'space.1000': "var(--ds-space-1000, 80px)"
|
|
56
56
|
};
|
|
57
57
|
exports.paddingMap = paddingMap;
|
|
58
|
+
var spaceMap = {
|
|
59
|
+
'space.0': "var(--ds-space-0, 0px)",
|
|
60
|
+
'space.025': "var(--ds-space-025, 2px)",
|
|
61
|
+
'space.050': "var(--ds-space-050, 4px)",
|
|
62
|
+
'space.075': "var(--ds-space-075, 6px)",
|
|
63
|
+
'space.100': "var(--ds-space-100, 8px)",
|
|
64
|
+
'space.150': "var(--ds-space-150, 12px)",
|
|
65
|
+
'space.200': "var(--ds-space-200, 16px)",
|
|
66
|
+
'space.250': "var(--ds-space-250, 20px)",
|
|
67
|
+
'space.300': "var(--ds-space-300, 24px)",
|
|
68
|
+
'space.400': "var(--ds-space-400, 32px)",
|
|
69
|
+
'space.500': "var(--ds-space-500, 40px)",
|
|
70
|
+
'space.600': "var(--ds-space-600, 48px)",
|
|
71
|
+
'space.800': "var(--ds-space-800, 64px)",
|
|
72
|
+
'space.1000': "var(--ds-space-1000, 80px)"
|
|
73
|
+
};
|
|
74
|
+
exports.spaceMap = spaceMap;
|
|
58
75
|
/**
|
|
59
76
|
* @codegenEnd
|
|
60
77
|
*/
|
|
@@ -247,14 +264,15 @@ exports.textColorMap = textColorMap;
|
|
|
247
264
|
|
|
248
265
|
/**
|
|
249
266
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
250
|
-
* @codegen <<SignedSource::
|
|
267
|
+
* @codegen <<SignedSource::8ab54fc337c6a02f403dad852dd626a0>>
|
|
251
268
|
* @codegenId misc
|
|
252
269
|
* @codegenCommand yarn codegen-styles
|
|
253
|
-
* @codegenParams ["align-self", "border-style", "display", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
|
|
270
|
+
* @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
|
|
254
271
|
* @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
|
|
255
272
|
* @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
|
|
256
273
|
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::89d19ca3937408eb7de5d72f4476a0f9>>
|
|
257
274
|
* @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::e6e390f80609060bfd12a55a489d5f54>>
|
|
275
|
+
* @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
|
|
258
276
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
|
|
259
277
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-shrink.tsx <<SignedSource::bf6626972898bf22d2eeee2130693d47>>
|
|
260
278
|
* @codegenDependency ../../scripts/codegen-file-templates/flex.tsx <<SignedSource::ffa0189d14f1f00a16ec1e9f43a17ce9>>
|
|
@@ -275,6 +293,11 @@ var borderStyleMap = {
|
|
|
275
293
|
solid: 'solid'
|
|
276
294
|
};
|
|
277
295
|
exports.borderStyleMap = borderStyleMap;
|
|
296
|
+
var flexDirectionMap = {
|
|
297
|
+
row: 'row',
|
|
298
|
+
column: 'column'
|
|
299
|
+
};
|
|
300
|
+
exports.flexDirectionMap = flexDirectionMap;
|
|
278
301
|
var flexGrowMap = {
|
|
279
302
|
'0': 0,
|
|
280
303
|
'1': 1
|
|
@@ -354,7 +377,7 @@ var borderRadiusMap = {
|
|
|
354
377
|
* @codegenEnd
|
|
355
378
|
*/
|
|
356
379
|
exports.borderRadiusMap = borderRadiusMap;
|
|
357
|
-
var spacingProperties = ['padding', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd'];
|
|
380
|
+
var spacingProperties = ['padding', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'gap', 'rowGap'];
|
|
358
381
|
var getSerializedStylesMap = function getSerializedStylesMap(cssProperty, tokenMap) {
|
|
359
382
|
return Object.keys(tokenMap).reduce(function (emotionSpacingMap, token) {
|
|
360
383
|
emotionSpacingMap[token] = (0, _react.css)((0, _defineProperty2.default)({}, cssProperty, tokenMap[token]));
|
|
@@ -366,5 +389,10 @@ var paddingStylesMap = spacingProperties.reduce(function (styleMap, spacingPrope
|
|
|
366
389
|
return styleMap;
|
|
367
390
|
}, {});
|
|
368
391
|
exports.paddingStylesMap = paddingStylesMap;
|
|
392
|
+
var spaceStylesMap = spacingProperties.reduce(function (styleMap, spacingProperty) {
|
|
393
|
+
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty, spaceMap);
|
|
394
|
+
return styleMap;
|
|
395
|
+
}, {});
|
|
396
|
+
exports.spaceStylesMap = spaceStylesMap;
|
|
369
397
|
var backgroundColorStylesMap = getSerializedStylesMap('backgroundColor', backgroundColorMap);
|
|
370
398
|
exports.backgroundColorStylesMap = backgroundColorStylesMap;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.parseXcss = void 0;
|
|
8
8
|
exports.xcss = xcss;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -38,11 +38,8 @@ var uniqueSymbol = Symbol('Internal symbol to verify xcss function is called saf
|
|
|
38
38
|
var isSafeEnvToThrow = function isSafeEnvToThrow() {
|
|
39
39
|
return (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && (0, _typeof2.default)(process.env) === 'object' && process.env.NODE_ENV !== 'production';
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* Only exposed for testing.
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
41
|
+
var reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
|
|
42
|
+
var rePseudos = /^::?.*$/;
|
|
46
43
|
var transformStyles = function transformStyles(styleObj) {
|
|
47
44
|
if (!styleObj || (0, _typeof2.default)(styleObj) !== 'object') {
|
|
48
45
|
return styleObj;
|
|
@@ -60,14 +57,14 @@ var transformStyles = function transformStyles(styleObj) {
|
|
|
60
57
|
value = _ref2[1];
|
|
61
58
|
if (isSafeEnvToThrow()) {
|
|
62
59
|
// We don't support `.class`, `[data-testid]`, `> *`, `#some-id`
|
|
63
|
-
if (
|
|
60
|
+
if (reNestedSelectors.test(key)) {
|
|
64
61
|
throw new Error("Styles not supported for key '".concat(key, "'."));
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
// If key is a pseudo class or a pseudo element, then value should be an object.
|
|
69
66
|
// So, call transformStyles on the value
|
|
70
|
-
if (
|
|
67
|
+
if (rePseudos.test(key)) {
|
|
71
68
|
styleObj[key] = transformStyles(value);
|
|
72
69
|
return;
|
|
73
70
|
}
|
|
@@ -92,7 +89,6 @@ var transformStyles = function transformStyles(styleObj) {
|
|
|
92
89
|
});
|
|
93
90
|
return styleObj;
|
|
94
91
|
};
|
|
95
|
-
exports.transformStyles = transformStyles;
|
|
96
92
|
var baseXcss = function baseXcss(style) {
|
|
97
93
|
var transformedStyles = transformStyles(style);
|
|
98
94
|
return {
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { spaceStylesMap } from '../internal/style-maps.partial';
|
|
5
6
|
const alignItemsMap = {
|
|
6
7
|
center: css({
|
|
7
8
|
alignItems: 'center'
|
|
@@ -42,63 +43,6 @@ const flexGrowMap = {
|
|
|
42
43
|
const flexWrapStyles = css({
|
|
43
44
|
flexWrap: 'wrap'
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
48
|
-
* @codegen <<SignedSource::fb7587b114753ed19425e2b07b5deb0d>>
|
|
49
|
-
* @codegenId spacing
|
|
50
|
-
* @codegenCommand yarn codegen-styles
|
|
51
|
-
* @codegenParams ["inlineSpace"]
|
|
52
|
-
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
53
|
-
*/
|
|
54
|
-
const inlineSpaceMap = Object.fromEntries(['gap', 'rowGap'].map(property => [property, {
|
|
55
|
-
'0': css({
|
|
56
|
-
[property]: "var(--ds-space-0, 0px)"
|
|
57
|
-
}),
|
|
58
|
-
'025': css({
|
|
59
|
-
[property]: "var(--ds-space-025, 2px)"
|
|
60
|
-
}),
|
|
61
|
-
'050': css({
|
|
62
|
-
[property]: "var(--ds-space-050, 4px)"
|
|
63
|
-
}),
|
|
64
|
-
'075': css({
|
|
65
|
-
[property]: "var(--ds-space-075, 6px)"
|
|
66
|
-
}),
|
|
67
|
-
'100': css({
|
|
68
|
-
[property]: "var(--ds-space-100, 8px)"
|
|
69
|
-
}),
|
|
70
|
-
'150': css({
|
|
71
|
-
[property]: "var(--ds-space-150, 12px)"
|
|
72
|
-
}),
|
|
73
|
-
'200': css({
|
|
74
|
-
[property]: "var(--ds-space-200, 16px)"
|
|
75
|
-
}),
|
|
76
|
-
'250': css({
|
|
77
|
-
[property]: "var(--ds-space-250, 20px)"
|
|
78
|
-
}),
|
|
79
|
-
'300': css({
|
|
80
|
-
[property]: "var(--ds-space-300, 24px)"
|
|
81
|
-
}),
|
|
82
|
-
'400': css({
|
|
83
|
-
[property]: "var(--ds-space-400, 32px)"
|
|
84
|
-
}),
|
|
85
|
-
'500': css({
|
|
86
|
-
[property]: "var(--ds-space-500, 40px)"
|
|
87
|
-
}),
|
|
88
|
-
'600': css({
|
|
89
|
-
[property]: "var(--ds-space-600, 48px)"
|
|
90
|
-
}),
|
|
91
|
-
'800': css({
|
|
92
|
-
[property]: "var(--ds-space-800, 64px)"
|
|
93
|
-
}),
|
|
94
|
-
'1000': css({
|
|
95
|
-
[property]: "var(--ds-space-1000, 80px)"
|
|
96
|
-
})
|
|
97
|
-
}]));
|
|
98
|
-
/**
|
|
99
|
-
* @codegenEnd
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
46
|
const baseStyles = css({
|
|
103
47
|
display: 'flex',
|
|
104
48
|
boxSizing: 'border-box',
|
|
@@ -154,7 +98,7 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
154
98
|
}) : rawChildren;
|
|
155
99
|
const justifyContent = spread || alignInline;
|
|
156
100
|
return jsx(Component, {
|
|
157
|
-
css: [baseStyles, space &&
|
|
101
|
+
css: [baseStyles, space && spaceStylesMap.gap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles, rowSpace && spaceStylesMap.rowGap[rowSpace]],
|
|
158
102
|
"data-testid": testId,
|
|
159
103
|
ref: ref
|
|
160
104
|
}, children);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { spaceStylesMap } from '../internal/style-maps.partial';
|
|
6
|
+
const justifyContentMap = {
|
|
7
|
+
start: css({
|
|
8
|
+
justifyContent: 'start'
|
|
9
|
+
}),
|
|
10
|
+
center: css({
|
|
11
|
+
justifyContent: 'center'
|
|
12
|
+
}),
|
|
13
|
+
end: css({
|
|
14
|
+
justifyContent: 'end'
|
|
15
|
+
}),
|
|
16
|
+
'space-between': css({
|
|
17
|
+
justifyContent: 'space-between'
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
const alignItemsMap = {
|
|
21
|
+
start: css({
|
|
22
|
+
alignItems: 'start'
|
|
23
|
+
}),
|
|
24
|
+
center: css({
|
|
25
|
+
alignItems: 'center'
|
|
26
|
+
}),
|
|
27
|
+
end: css({
|
|
28
|
+
alignItems: 'end'
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
const flexGrowMap = {
|
|
32
|
+
hug: css({
|
|
33
|
+
flexGrow: 0
|
|
34
|
+
}),
|
|
35
|
+
fill: css({
|
|
36
|
+
width: '100%',
|
|
37
|
+
flexGrow: 1
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
const baseStyles = css({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
boxSizing: 'border-box',
|
|
43
|
+
flexDirection: 'column'
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* __Stack__
|
|
48
|
+
*
|
|
49
|
+
* Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Stack>
|
|
54
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
55
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
56
|
+
* </Stack>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
61
|
+
as,
|
|
62
|
+
alignInline: alignItems,
|
|
63
|
+
alignBlock,
|
|
64
|
+
spread,
|
|
65
|
+
grow,
|
|
66
|
+
space,
|
|
67
|
+
children,
|
|
68
|
+
testId
|
|
69
|
+
}, ref) => {
|
|
70
|
+
const Component = as || 'div';
|
|
71
|
+
const justifyContent = spread || alignBlock;
|
|
72
|
+
return jsx(Component, {
|
|
73
|
+
css: [baseStyles, space && spaceStylesMap.gap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
|
|
74
|
+
"data-testid": testId,
|
|
75
|
+
ref: ref
|
|
76
|
+
}, children);
|
|
77
|
+
}));
|
|
78
|
+
Stack.displayName = 'Stack';
|
|
79
|
+
export default Stack;
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Box } from './components/box';
|
|
2
|
-
export { default as Inline } from './components/inline
|
|
2
|
+
export { default as Inline } from './components/inline';
|
|
3
3
|
export { xcss } from './internal/xcss';
|
|
4
|
-
export { default as Stack } from './components/stack
|
|
4
|
+
export { default as Stack } from './components/stack';
|