@atlaskit/primitives 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/constellation/grid/code.mdx +7 -0
- package/constellation/grid/examples.mdx +38 -0
- package/dist/cjs/components/flex.js +7 -3
- package/dist/cjs/components/grid.js +127 -0
- package/dist/cjs/components/inline.js +16 -48
- package/dist/cjs/components/stack.js +19 -39
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/xcss/xcss.js +1 -1
- package/dist/es2019/components/flex.js +6 -3
- package/dist/es2019/components/grid.js +118 -0
- package/dist/es2019/components/inline.js +15 -49
- package/dist/es2019/components/stack.js +18 -40
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/responsive/build-media-query-css.js +0 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/xcss/xcss.js +1 -1
- package/dist/esm/components/flex.js +7 -3
- package/dist/esm/components/grid.js +119 -0
- package/dist/esm/components/inline.js +16 -49
- package/dist/esm/components/stack.js +19 -40
- package/dist/esm/index.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/xcss/xcss.js +1 -1
- package/dist/types/components/flex.d.ts +17 -8
- package/dist/types/components/grid.d.ts +154 -0
- package/dist/types/components/inline.d.ts +50 -12
- package/dist/types/components/stack.d.ts +38 -8
- package/dist/types/index.d.ts +2 -1
- package/dist/types/xcss/xcss.d.ts +11 -14
- package/dist/types-ts4.5/components/flex.d.ts +17 -8
- package/dist/types-ts4.5/components/grid.d.ts +154 -0
- package/dist/types-ts4.5/components/inline.d.ts +50 -12
- package/dist/types-ts4.5/components/stack.d.ts +38 -8
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/xcss/xcss.d.ts +11 -14
- package/package.json +21 -14
- package/report.api.md +270 -59
- package/tmp/api-report-tmp.d.ts +122 -37
|
@@ -2,56 +2,17 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const alignItemsMap = {
|
|
8
|
-
center: css({
|
|
9
|
-
alignItems: 'center'
|
|
10
|
-
}),
|
|
11
|
-
baseline: css({
|
|
12
|
-
alignItems: 'baseline'
|
|
13
|
-
}),
|
|
14
|
-
start: css({
|
|
15
|
-
alignItems: 'flex-start'
|
|
16
|
-
}),
|
|
17
|
-
end: css({
|
|
18
|
-
alignItems: 'flex-end'
|
|
19
|
-
}),
|
|
20
|
-
stretch: css({
|
|
21
|
-
alignItems: 'stretch'
|
|
22
|
-
})
|
|
23
|
-
};
|
|
24
|
-
const justifyContentMap = {
|
|
25
|
-
start: css({
|
|
26
|
-
justifyContent: 'flex-start'
|
|
27
|
-
}),
|
|
28
|
-
center: css({
|
|
29
|
-
justifyContent: 'center'
|
|
30
|
-
}),
|
|
31
|
-
end: css({
|
|
32
|
-
justifyContent: 'flex-end'
|
|
33
|
-
}),
|
|
34
|
-
'space-between': css({
|
|
35
|
-
justifyContent: 'space-between'
|
|
36
|
-
})
|
|
37
|
-
};
|
|
5
|
+
import { xcss } from '../xcss/xcss';
|
|
6
|
+
import Flex from './flex';
|
|
38
7
|
const flexGrowMap = {
|
|
39
|
-
hug:
|
|
8
|
+
hug: xcss({
|
|
40
9
|
flexGrow: 0
|
|
41
10
|
}),
|
|
42
|
-
fill:
|
|
11
|
+
fill: xcss({
|
|
43
12
|
width: '100%',
|
|
44
13
|
flexGrow: 1
|
|
45
14
|
})
|
|
46
15
|
};
|
|
47
|
-
const flexWrapStyles = css({
|
|
48
|
-
flexWrap: 'wrap'
|
|
49
|
-
});
|
|
50
|
-
const baseStyles = css({
|
|
51
|
-
display: 'flex',
|
|
52
|
-
boxSizing: 'border-box',
|
|
53
|
-
flexDirection: 'row'
|
|
54
|
-
});
|
|
55
16
|
const separatorStyles = css({
|
|
56
17
|
color: "var(--ds-text-subtle, #42526E)",
|
|
57
18
|
marginBlock: "var(--ds-space-0, 0px)",
|
|
@@ -94,7 +55,6 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
94
55
|
testId,
|
|
95
56
|
children: rawChildren
|
|
96
57
|
}, ref) => {
|
|
97
|
-
const Component = as || 'div';
|
|
98
58
|
const separatorComponent = typeof separator === 'string' ? jsx(Separator, null, separator) : separator;
|
|
99
59
|
const children = separatorComponent ? Children.toArray(rawChildren).filter(Boolean).map((child, index) => {
|
|
100
60
|
return jsx(Fragment, {
|
|
@@ -102,12 +62,18 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
102
62
|
}, separator && index > 0 ? separatorComponent : null, child);
|
|
103
63
|
}) : rawChildren;
|
|
104
64
|
const justifyContent = spread || alignInline;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
65
|
+
return jsx(Flex, {
|
|
66
|
+
as: as,
|
|
67
|
+
alignItems: alignItems,
|
|
68
|
+
justifyContent: justifyContent,
|
|
69
|
+
direction: "row",
|
|
70
|
+
gap: space,
|
|
71
|
+
rowGap: rowSpace,
|
|
72
|
+
wrap: shouldWrap ? 'wrap' : undefined,
|
|
73
|
+
xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
|
|
108
74
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
109
|
-
|
|
110
|
-
|
|
75
|
+
xcss,
|
|
76
|
+
testId: testId,
|
|
111
77
|
ref: ref
|
|
112
78
|
}, children);
|
|
113
79
|
}));
|
|
@@ -1,52 +1,23 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef, memo } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
-
};
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { xcss } from '../xcss/xcss';
|
|
6
|
+
import Flex from './flex';
|
|
31
7
|
const flexGrowMap = {
|
|
32
|
-
hug:
|
|
8
|
+
hug: xcss({
|
|
33
9
|
flexGrow: 0
|
|
34
10
|
}),
|
|
35
|
-
fill:
|
|
11
|
+
fill: xcss({
|
|
36
12
|
width: '100%',
|
|
37
13
|
flexGrow: 1
|
|
38
14
|
})
|
|
39
15
|
};
|
|
40
|
-
const baseStyles = css({
|
|
41
|
-
display: 'flex',
|
|
42
|
-
boxSizing: 'border-box',
|
|
43
|
-
flexDirection: 'column'
|
|
44
|
-
});
|
|
45
16
|
|
|
46
17
|
/**
|
|
47
18
|
* __Stack__
|
|
48
19
|
*
|
|
49
|
-
* Stack is a primitive component based on flexbox that manages the
|
|
20
|
+
* Stack is a primitive component based on flexbox that manages the block layout of direct children.
|
|
50
21
|
*
|
|
51
22
|
* @example
|
|
52
23
|
* ```tsx
|
|
@@ -65,13 +36,20 @@ const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
65
36
|
grow,
|
|
66
37
|
space,
|
|
67
38
|
children,
|
|
68
|
-
testId
|
|
39
|
+
testId,
|
|
40
|
+
xcss
|
|
69
41
|
}, ref) => {
|
|
70
|
-
const Component = as || 'div';
|
|
71
42
|
const justifyContent = spread || alignBlock;
|
|
72
|
-
return jsx(
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
return jsx(Flex, {
|
|
44
|
+
as: as,
|
|
45
|
+
gap: space,
|
|
46
|
+
direction: "column",
|
|
47
|
+
alignItems: alignItems,
|
|
48
|
+
justifyContent: justifyContent,
|
|
49
|
+
xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
|
|
50
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
51
|
+
xcss,
|
|
52
|
+
testId: testId,
|
|
75
53
|
ref: ref
|
|
76
54
|
}, children);
|
|
77
55
|
}));
|
package/dist/es2019/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { default as Inline } from './components/inline';
|
|
|
4
4
|
export { xcss } from './xcss/xcss';
|
|
5
5
|
export { default as Stack } from './components/stack';
|
|
6
6
|
export { default as Flex } from './components/flex';
|
|
7
|
-
export {
|
|
7
|
+
export { default as Grid } from './components/grid';
|
|
8
|
+
export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
|
|
@@ -30,7 +30,6 @@ export const UNSAFE_buildAboveMediaQueryCSS = input => {
|
|
|
30
30
|
return UNSAFE_BREAKPOINTS_ORDERED_LIST.reduce((acc, breakpoint) => ({
|
|
31
31
|
...acc,
|
|
32
32
|
[breakpoint]: css({
|
|
33
|
-
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
34
33
|
[media.above[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
35
34
|
})
|
|
36
35
|
}), {});
|
package/dist/es2019/version.json
CHANGED
package/dist/es2019/xcss/xcss.js
CHANGED
|
@@ -142,7 +142,7 @@ export const parseXcss = args => {
|
|
|
142
142
|
|
|
143
143
|
// unused private functions only so we can extract the return type from a generic function
|
|
144
144
|
const boxWrapper = style => xcss(style);
|
|
145
|
-
const
|
|
145
|
+
const spaceWrapper = style => xcss(style);
|
|
146
146
|
/**
|
|
147
147
|
* ### xcss
|
|
148
148
|
*
|
|
@@ -55,6 +55,9 @@ var alignItemsMap = {
|
|
|
55
55
|
}),
|
|
56
56
|
end: css({
|
|
57
57
|
alignItems: 'end'
|
|
58
|
+
}),
|
|
59
|
+
stretch: css({
|
|
60
|
+
alignItems: 'stretch'
|
|
58
61
|
})
|
|
59
62
|
};
|
|
60
63
|
var baseStyles = css({
|
|
@@ -83,20 +86,21 @@ var baseStyles = css({
|
|
|
83
86
|
* ```
|
|
84
87
|
*/
|
|
85
88
|
var Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
86
|
-
var as = _ref.as,
|
|
89
|
+
var _ref$as = _ref.as,
|
|
90
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
87
91
|
alignItems = _ref.alignItems,
|
|
88
92
|
justifyContent = _ref.justifyContent,
|
|
89
93
|
gap = _ref.gap,
|
|
94
|
+
columnGap = _ref.columnGap,
|
|
90
95
|
rowGap = _ref.rowGap,
|
|
91
96
|
children = _ref.children,
|
|
92
97
|
testId = _ref.testId,
|
|
93
98
|
direction = _ref.direction,
|
|
94
99
|
wrap = _ref.wrap,
|
|
95
100
|
xcss = _ref.xcss;
|
|
96
|
-
var Component = as || 'div';
|
|
97
101
|
var xcssClassName = xcss && parseXcss(xcss);
|
|
98
102
|
return jsx(Component, {
|
|
99
|
-
css: [baseStyles, gap && spaceStylesMap.gap[gap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
103
|
+
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
100
104
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
101
105
|
xcssClassName && xcssClassName],
|
|
102
106
|
"data-testid": testId,
|
|
@@ -0,0 +1,119 @@
|
|
|
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 '../xcss/style-maps.partial';
|
|
6
|
+
import { parseXcss } from '../xcss/xcss';
|
|
7
|
+
var justifyContentMap = {
|
|
8
|
+
start: css({
|
|
9
|
+
justifyContent: 'start'
|
|
10
|
+
}),
|
|
11
|
+
center: css({
|
|
12
|
+
justifyContent: 'center'
|
|
13
|
+
}),
|
|
14
|
+
end: css({
|
|
15
|
+
justifyContent: 'end'
|
|
16
|
+
}),
|
|
17
|
+
'space-between': css({
|
|
18
|
+
justifyContent: 'space-between'
|
|
19
|
+
}),
|
|
20
|
+
'space-around': css({
|
|
21
|
+
justifyContent: 'space-around'
|
|
22
|
+
}),
|
|
23
|
+
'space-evenly': css({
|
|
24
|
+
justifyContent: 'space-evenly'
|
|
25
|
+
}),
|
|
26
|
+
stretch: css({
|
|
27
|
+
justifyContent: 'stretch'
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
var alignItemsMap = {
|
|
31
|
+
start: css({
|
|
32
|
+
alignItems: 'start'
|
|
33
|
+
}),
|
|
34
|
+
center: css({
|
|
35
|
+
alignItems: 'center'
|
|
36
|
+
}),
|
|
37
|
+
baseline: css({
|
|
38
|
+
alignItems: 'baseline'
|
|
39
|
+
}),
|
|
40
|
+
end: css({
|
|
41
|
+
alignItems: 'end'
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
var baseStyles = css({
|
|
45
|
+
display: 'grid',
|
|
46
|
+
boxSizing: 'border-box'
|
|
47
|
+
});
|
|
48
|
+
var gridAutoFlowMap = {
|
|
49
|
+
row: css({
|
|
50
|
+
gridAutoFlow: 'row'
|
|
51
|
+
}),
|
|
52
|
+
column: css({
|
|
53
|
+
gridAutoFlow: 'column'
|
|
54
|
+
}),
|
|
55
|
+
dense: css({
|
|
56
|
+
gridAutoFlow: 'dense'
|
|
57
|
+
}),
|
|
58
|
+
'row dense': css({
|
|
59
|
+
gridAutoFlow: 'row dense'
|
|
60
|
+
}),
|
|
61
|
+
'column dense': css({
|
|
62
|
+
gridAutoFlow: 'column dense'
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* __Grid__
|
|
68
|
+
*
|
|
69
|
+
* `Grid` is a primitive component that implements the CSS Grid API.
|
|
70
|
+
*
|
|
71
|
+
* - [Examples](https://atlassian.design/components/primitives/grid/examples)
|
|
72
|
+
* - [Code](https://atlassian.design/components/primitives/grid/code)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import { Grid, Box } from '@atlaskit/primitives'
|
|
77
|
+
*
|
|
78
|
+
* const Component = () => (
|
|
79
|
+
* <Grid gap="space.100" gridColumns="1fr 1fr">
|
|
80
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
81
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
82
|
+
* </Grid>
|
|
83
|
+
* )
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
var Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
87
|
+
var as = _ref.as,
|
|
88
|
+
alignItems = _ref.alignItems,
|
|
89
|
+
justifyContent = _ref.justifyContent,
|
|
90
|
+
gap = _ref.gap,
|
|
91
|
+
columnGap = _ref.columnGap,
|
|
92
|
+
rowGap = _ref.rowGap,
|
|
93
|
+
children = _ref.children,
|
|
94
|
+
testId = _ref.testId,
|
|
95
|
+
autoFlow = _ref.autoFlow,
|
|
96
|
+
gridTemplateAreas = _ref.templateAreas,
|
|
97
|
+
gridTemplateRows = _ref.templateRows,
|
|
98
|
+
gridTemplateColumns = _ref.templateColumns,
|
|
99
|
+
xcss = _ref.xcss;
|
|
100
|
+
var Component = as || 'div';
|
|
101
|
+
var xcssClassName = xcss && parseXcss(xcss);
|
|
102
|
+
var style = gridTemplateAreas || gridTemplateColumns || gridTemplateRows ? Object.assign({}, {
|
|
103
|
+
gridTemplateAreas: gridTemplateAreas ? gridTemplateAreas.map(function (str) {
|
|
104
|
+
return "\"".concat(str, "\"");
|
|
105
|
+
}).join('\n') : undefined,
|
|
106
|
+
gridTemplateColumns: gridTemplateColumns,
|
|
107
|
+
gridTemplateRows: gridTemplateRows
|
|
108
|
+
}) : undefined;
|
|
109
|
+
return jsx(Component, {
|
|
110
|
+
style: style,
|
|
111
|
+
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
112
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
113
|
+
xcssClassName && xcssClassName],
|
|
114
|
+
"data-testid": testId,
|
|
115
|
+
ref: ref
|
|
116
|
+
}, children);
|
|
117
|
+
}));
|
|
118
|
+
Grid.displayName = 'Grid';
|
|
119
|
+
export default Grid;
|
|
@@ -1,57 +1,19 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
4
5
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
var alignItemsMap = {
|
|
8
|
-
center: css({
|
|
9
|
-
alignItems: 'center'
|
|
10
|
-
}),
|
|
11
|
-
baseline: css({
|
|
12
|
-
alignItems: 'baseline'
|
|
13
|
-
}),
|
|
14
|
-
start: css({
|
|
15
|
-
alignItems: 'flex-start'
|
|
16
|
-
}),
|
|
17
|
-
end: css({
|
|
18
|
-
alignItems: 'flex-end'
|
|
19
|
-
}),
|
|
20
|
-
stretch: css({
|
|
21
|
-
alignItems: 'stretch'
|
|
22
|
-
})
|
|
23
|
-
};
|
|
24
|
-
var justifyContentMap = {
|
|
25
|
-
start: css({
|
|
26
|
-
justifyContent: 'flex-start'
|
|
27
|
-
}),
|
|
28
|
-
center: css({
|
|
29
|
-
justifyContent: 'center'
|
|
30
|
-
}),
|
|
31
|
-
end: css({
|
|
32
|
-
justifyContent: 'flex-end'
|
|
33
|
-
}),
|
|
34
|
-
'space-between': css({
|
|
35
|
-
justifyContent: 'space-between'
|
|
36
|
-
})
|
|
37
|
-
};
|
|
6
|
+
import { xcss } from '../xcss/xcss';
|
|
7
|
+
import Flex from './flex';
|
|
38
8
|
var flexGrowMap = {
|
|
39
|
-
hug:
|
|
9
|
+
hug: xcss({
|
|
40
10
|
flexGrow: 0
|
|
41
11
|
}),
|
|
42
|
-
fill:
|
|
12
|
+
fill: xcss({
|
|
43
13
|
width: '100%',
|
|
44
14
|
flexGrow: 1
|
|
45
15
|
})
|
|
46
16
|
};
|
|
47
|
-
var flexWrapStyles = css({
|
|
48
|
-
flexWrap: 'wrap'
|
|
49
|
-
});
|
|
50
|
-
var baseStyles = css({
|
|
51
|
-
display: 'flex',
|
|
52
|
-
boxSizing: 'border-box',
|
|
53
|
-
flexDirection: 'row'
|
|
54
|
-
});
|
|
55
17
|
var separatorStyles = css({
|
|
56
18
|
color: "var(--ds-text-subtle, #42526E)",
|
|
57
19
|
marginBlock: "var(--ds-space-0, 0px)",
|
|
@@ -96,7 +58,6 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
96
58
|
xcss = _ref2.xcss,
|
|
97
59
|
testId = _ref2.testId,
|
|
98
60
|
rawChildren = _ref2.children;
|
|
99
|
-
var Component = as || 'div';
|
|
100
61
|
var separatorComponent = typeof separator === 'string' ? jsx(Separator, null, separator) : separator;
|
|
101
62
|
var children = separatorComponent ? Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
|
|
102
63
|
return jsx(Fragment, {
|
|
@@ -104,12 +65,18 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
104
65
|
}, separator && index > 0 ? separatorComponent : null, child);
|
|
105
66
|
}) : rawChildren;
|
|
106
67
|
var justifyContent = spread || alignInline;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
68
|
+
return jsx(Flex, {
|
|
69
|
+
as: as,
|
|
70
|
+
alignItems: alignItems,
|
|
71
|
+
justifyContent: justifyContent,
|
|
72
|
+
direction: "row",
|
|
73
|
+
gap: space,
|
|
74
|
+
rowGap: rowSpace,
|
|
75
|
+
wrap: shouldWrap ? 'wrap' : undefined,
|
|
76
|
+
xcss: grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
110
77
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
111
|
-
|
|
112
|
-
|
|
78
|
+
xcss,
|
|
79
|
+
testId: testId,
|
|
113
80
|
ref: ref
|
|
114
81
|
}, children);
|
|
115
82
|
}));
|
|
@@ -1,52 +1,24 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { forwardRef, memo } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
-
var alignItemsMap = {
|
|
21
|
-
start: css({
|
|
22
|
-
alignItems: 'start'
|
|
23
|
-
}),
|
|
24
|
-
center: css({
|
|
25
|
-
alignItems: 'center'
|
|
26
|
-
}),
|
|
27
|
-
end: css({
|
|
28
|
-
alignItems: 'end'
|
|
29
|
-
})
|
|
30
|
-
};
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
|
+
import { xcss } from '../xcss/xcss';
|
|
7
|
+
import Flex from './flex';
|
|
31
8
|
var flexGrowMap = {
|
|
32
|
-
hug:
|
|
9
|
+
hug: xcss({
|
|
33
10
|
flexGrow: 0
|
|
34
11
|
}),
|
|
35
|
-
fill:
|
|
12
|
+
fill: xcss({
|
|
36
13
|
width: '100%',
|
|
37
14
|
flexGrow: 1
|
|
38
15
|
})
|
|
39
16
|
};
|
|
40
|
-
var baseStyles = css({
|
|
41
|
-
display: 'flex',
|
|
42
|
-
boxSizing: 'border-box',
|
|
43
|
-
flexDirection: 'column'
|
|
44
|
-
});
|
|
45
17
|
|
|
46
18
|
/**
|
|
47
19
|
* __Stack__
|
|
48
20
|
*
|
|
49
|
-
* Stack is a primitive component based on flexbox that manages the
|
|
21
|
+
* Stack is a primitive component based on flexbox that manages the block layout of direct children.
|
|
50
22
|
*
|
|
51
23
|
* @example
|
|
52
24
|
* ```tsx
|
|
@@ -65,12 +37,19 @@ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
65
37
|
grow = _ref.grow,
|
|
66
38
|
space = _ref.space,
|
|
67
39
|
children = _ref.children,
|
|
68
|
-
testId = _ref.testId
|
|
69
|
-
|
|
40
|
+
testId = _ref.testId,
|
|
41
|
+
xcss = _ref.xcss;
|
|
70
42
|
var justifyContent = spread || alignBlock;
|
|
71
|
-
return jsx(
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
return jsx(Flex, {
|
|
44
|
+
as: as,
|
|
45
|
+
gap: space,
|
|
46
|
+
direction: "column",
|
|
47
|
+
alignItems: alignItems,
|
|
48
|
+
justifyContent: justifyContent,
|
|
49
|
+
xcss: grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
50
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
51
|
+
xcss,
|
|
52
|
+
testId: testId,
|
|
74
53
|
ref: ref
|
|
75
54
|
}, children);
|
|
76
55
|
}));
|
package/dist/esm/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { default as Inline } from './components/inline';
|
|
|
4
4
|
export { xcss } from './xcss/xcss';
|
|
5
5
|
export { default as Stack } from './components/stack';
|
|
6
6
|
export { default as Flex } from './components/flex';
|
|
7
|
-
export {
|
|
7
|
+
export { default as Grid } from './components/grid';
|
|
8
|
+
export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
|
package/dist/esm/version.json
CHANGED
package/dist/esm/xcss/xcss.js
CHANGED
|
@@ -152,7 +152,7 @@ export var parseXcss = function parseXcss(args) {
|
|
|
152
152
|
var boxWrapper = function boxWrapper(style) {
|
|
153
153
|
return xcss(style);
|
|
154
154
|
};
|
|
155
|
-
var
|
|
155
|
+
var spaceWrapper = function spaceWrapper(style) {
|
|
156
156
|
return xcss(style);
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
@@ -6,7 +6,7 @@ export type FlexProps<T extends ElementType = 'div'> = {
|
|
|
6
6
|
/**
|
|
7
7
|
* The DOM element to render as the Flex. Defaults to `div`.
|
|
8
8
|
*/
|
|
9
|
-
as?: 'div' | 'span' | 'ul' | 'ol';
|
|
9
|
+
as?: 'div' | 'span' | 'ul' | 'ol' | 'li';
|
|
10
10
|
/**
|
|
11
11
|
* Used to align children along the main axis.
|
|
12
12
|
*/
|
|
@@ -15,6 +15,10 @@ export type FlexProps<T extends ElementType = 'div'> = {
|
|
|
15
15
|
* Used to align children along the cross axis.
|
|
16
16
|
*/
|
|
17
17
|
alignItems?: AlignItems;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the space between each child.
|
|
20
|
+
*/
|
|
21
|
+
columnGap?: Space;
|
|
18
22
|
/**
|
|
19
23
|
* Represents the space between each child.
|
|
20
24
|
*/
|
|
@@ -32,7 +36,7 @@ export type FlexProps<T extends ElementType = 'div'> = {
|
|
|
32
36
|
*/
|
|
33
37
|
wrap?: Wrap;
|
|
34
38
|
/**
|
|
35
|
-
* Elements to be rendered inside the
|
|
39
|
+
* Elements to be rendered inside the Flex.
|
|
36
40
|
*/
|
|
37
41
|
children: ReactNode;
|
|
38
42
|
/**
|
|
@@ -66,6 +70,7 @@ declare const alignItemsMap: {
|
|
|
66
70
|
readonly center: import("@emotion/react").SerializedStyles;
|
|
67
71
|
readonly baseline: import("@emotion/react").SerializedStyles;
|
|
68
72
|
readonly end: import("@emotion/react").SerializedStyles;
|
|
73
|
+
readonly stretch: import("@emotion/react").SerializedStyles;
|
|
69
74
|
};
|
|
70
75
|
/**
|
|
71
76
|
* __Flex__
|
|
@@ -91,15 +96,19 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
91
96
|
/**
|
|
92
97
|
* The DOM element to render as the Flex. Defaults to `div`.
|
|
93
98
|
*/
|
|
94
|
-
as?: "div" | "ol" | "span" | "ul" | undefined;
|
|
99
|
+
as?: "div" | "li" | "ol" | "span" | "ul" | undefined;
|
|
95
100
|
/**
|
|
96
101
|
* Used to align children along the main axis.
|
|
97
102
|
*/
|
|
98
|
-
justifyContent?: "
|
|
103
|
+
justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "center" | "end" | "start" | undefined;
|
|
99
104
|
/**
|
|
100
105
|
* Used to align children along the cross axis.
|
|
101
106
|
*/
|
|
102
|
-
alignItems?: "
|
|
107
|
+
alignItems?: "stretch" | "center" | "end" | "start" | "baseline" | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Represents the space between each child.
|
|
110
|
+
*/
|
|
111
|
+
columnGap?: "space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000" | undefined;
|
|
103
112
|
/**
|
|
104
113
|
* Represents the space between each child.
|
|
105
114
|
*/
|
|
@@ -115,14 +124,14 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
115
124
|
/**
|
|
116
125
|
* Represents the flex wrap property of CSS flexbox.
|
|
117
126
|
*/
|
|
118
|
-
wrap?: "
|
|
127
|
+
wrap?: "nowrap" | "wrap" | undefined;
|
|
119
128
|
/**
|
|
120
|
-
* Elements to be rendered inside the
|
|
129
|
+
* Elements to be rendered inside the Flex.
|
|
121
130
|
*/
|
|
122
131
|
children: ReactNode;
|
|
123
132
|
/**
|
|
124
133
|
* Forwarded ref element
|
|
125
134
|
*/
|
|
126
135
|
ref?: any;
|
|
127
|
-
} & BasePrimitiveProps, "gap" | "rowGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "wrap"> & import("react").RefAttributes<any>>>;
|
|
136
|
+
} & BasePrimitiveProps, "gap" | "rowGap" | "columnGap" | "alignItems" | "direction" | "justifyContent" | "as" | "children" | keyof BasePrimitiveProps | "wrap"> & import("react").RefAttributes<any>>>;
|
|
128
137
|
export default Flex;
|