@atlaskit/primitives 0.0.2 → 0.1.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 +7 -0
- package/dist/cjs/components/inline.partial.js +161 -7
- package/dist/cjs/components/stack.partial.js +132 -7
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.partial.js +158 -2
- package/dist/es2019/components/stack.partial.js +131 -2
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.partial.js +159 -2
- package/dist/esm/components/stack.partial.js +130 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/inline.partial.d.ts +86 -1
- package/dist/types/components/stack.partial.d.ts +77 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +3 -2
- package/report.api.md +103 -4
- package/scripts/codegen-styles.tsx +2 -2
- package/scripts/spacing-codegen-template.tsx +11 -2
- package/tmp/api-report-tmp.d.ts +99 -4
|
@@ -1,2 +1,159 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
var alignItemsMap = {
|
|
5
|
+
center: css({
|
|
6
|
+
alignItems: 'center'
|
|
7
|
+
}),
|
|
8
|
+
baseline: css({
|
|
9
|
+
alignItems: 'baseline'
|
|
10
|
+
}),
|
|
11
|
+
start: css({
|
|
12
|
+
alignItems: 'flex-start'
|
|
13
|
+
}),
|
|
14
|
+
end: css({
|
|
15
|
+
alignItems: 'flex-end'
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
var justifyContentMap = {
|
|
19
|
+
start: css({
|
|
20
|
+
justifyContent: 'flex-start'
|
|
21
|
+
}),
|
|
22
|
+
center: css({
|
|
23
|
+
justifyContent: 'center'
|
|
24
|
+
}),
|
|
25
|
+
end: css({
|
|
26
|
+
justifyContent: 'flex-end'
|
|
27
|
+
}),
|
|
28
|
+
'space-between': css({
|
|
29
|
+
justifyContent: 'space-between'
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
var flexGrowMap = {
|
|
33
|
+
hug: css({
|
|
34
|
+
flexGrow: 0
|
|
35
|
+
}),
|
|
36
|
+
fill: css({
|
|
37
|
+
flexGrow: 1
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
var flexWrapStyles = css({
|
|
41
|
+
flexWrap: 'wrap'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
46
|
+
* @codegen <<SignedSource::e0d436d3312290a98dbfd91d90dd6b9e>>
|
|
47
|
+
* @codegenId spacing
|
|
48
|
+
* @codegenCommand yarn codegen-styles
|
|
49
|
+
* @codegenParams ["space"]
|
|
50
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
51
|
+
*/
|
|
52
|
+
var spaceMap = {
|
|
53
|
+
'0': css({
|
|
54
|
+
gap: "var(--ds-space-0, 0px)"
|
|
55
|
+
}),
|
|
56
|
+
'025': css({
|
|
57
|
+
gap: "var(--ds-space-025, 2px)"
|
|
58
|
+
}),
|
|
59
|
+
'050': css({
|
|
60
|
+
gap: "var(--ds-space-050, 4px)"
|
|
61
|
+
}),
|
|
62
|
+
'075': css({
|
|
63
|
+
gap: "var(--ds-space-075, 6px)"
|
|
64
|
+
}),
|
|
65
|
+
'100': css({
|
|
66
|
+
gap: "var(--ds-space-100, 8px)"
|
|
67
|
+
}),
|
|
68
|
+
'1000': css({
|
|
69
|
+
gap: "var(--ds-space-1000, 80px)"
|
|
70
|
+
}),
|
|
71
|
+
'150': css({
|
|
72
|
+
gap: "var(--ds-space-150, 12px)"
|
|
73
|
+
}),
|
|
74
|
+
'200': css({
|
|
75
|
+
gap: "var(--ds-space-200, 16px)"
|
|
76
|
+
}),
|
|
77
|
+
'250': css({
|
|
78
|
+
gap: "var(--ds-space-250, 20px)"
|
|
79
|
+
}),
|
|
80
|
+
'300': css({
|
|
81
|
+
gap: "var(--ds-space-300, 24px)"
|
|
82
|
+
}),
|
|
83
|
+
'400': css({
|
|
84
|
+
gap: "var(--ds-space-400, 32px)"
|
|
85
|
+
}),
|
|
86
|
+
'500': css({
|
|
87
|
+
gap: "var(--ds-space-500, 40px)"
|
|
88
|
+
}),
|
|
89
|
+
'600': css({
|
|
90
|
+
gap: "var(--ds-space-600, 48px)"
|
|
91
|
+
}),
|
|
92
|
+
'800': css({
|
|
93
|
+
gap: "var(--ds-space-800, 64px)"
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @codegenEnd
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
var baseStyles = css({
|
|
101
|
+
display: 'flex',
|
|
102
|
+
boxSizing: 'border-box',
|
|
103
|
+
flexDirection: 'row'
|
|
104
|
+
});
|
|
105
|
+
var separatorStyles = css({
|
|
106
|
+
color: "var(--ds-text-subtle, #42526E)",
|
|
107
|
+
marginBlock: "var(--ds-space-0, 0px)",
|
|
108
|
+
marginInline: "-".concat("var(--ds-space-025, 2px)"),
|
|
109
|
+
pointerEvents: 'none',
|
|
110
|
+
userSelect: 'none'
|
|
111
|
+
});
|
|
112
|
+
var Separator = function Separator(_ref) {
|
|
113
|
+
var children = _ref.children;
|
|
114
|
+
return jsx("span", {
|
|
115
|
+
css: separatorStyles
|
|
116
|
+
}, children);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* __Inline__
|
|
121
|
+
*
|
|
122
|
+
* Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
|
|
123
|
+
*
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* <Inline>
|
|
128
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
129
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
130
|
+
* </Inline>
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
135
|
+
var alignInline = _ref2.alignInline,
|
|
136
|
+
alignItems = _ref2.alignBlock,
|
|
137
|
+
_ref2$shouldWrap = _ref2.shouldWrap,
|
|
138
|
+
shouldWrap = _ref2$shouldWrap === void 0 ? false : _ref2$shouldWrap,
|
|
139
|
+
spread = _ref2.spread,
|
|
140
|
+
grow = _ref2.grow,
|
|
141
|
+
space = _ref2.space,
|
|
142
|
+
separator = _ref2.separator,
|
|
143
|
+
testId = _ref2.testId,
|
|
144
|
+
rawChildren = _ref2.children;
|
|
145
|
+
var separatorComponent = typeof separator === 'string' ? jsx(Separator, null, separator) : separator;
|
|
146
|
+
var children = separatorComponent ? Children.toArray(rawChildren).filter(Boolean).map(function (child, index) {
|
|
147
|
+
return jsx(Fragment, {
|
|
148
|
+
key: index
|
|
149
|
+
}, separator && index > 0 ? separatorComponent : null, child);
|
|
150
|
+
}) : rawChildren;
|
|
151
|
+
var justifyContent = spread || alignInline;
|
|
152
|
+
return jsx("div", {
|
|
153
|
+
css: [baseStyles, space && spaceMap[space], justifyContent && justifyContentMap[justifyContent], grow && flexGrowMap[grow], alignItems && alignItemsMap[alignItems], shouldWrap && flexWrapStyles],
|
|
154
|
+
"data-testid": testId,
|
|
155
|
+
ref: ref
|
|
156
|
+
}, children);
|
|
157
|
+
}));
|
|
158
|
+
Inline.displayName = 'Inline';
|
|
159
|
+
export default Inline;
|
|
@@ -1,2 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { forwardRef, memo } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
var justifyContentMap = {
|
|
5
|
+
start: css({
|
|
6
|
+
justifyContent: 'start'
|
|
7
|
+
}),
|
|
8
|
+
center: css({
|
|
9
|
+
justifyContent: 'center'
|
|
10
|
+
}),
|
|
11
|
+
end: css({
|
|
12
|
+
justifyContent: 'end'
|
|
13
|
+
}),
|
|
14
|
+
'space-between': css({
|
|
15
|
+
justifyContent: 'space-between'
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
var alignItemsMap = {
|
|
19
|
+
start: css({
|
|
20
|
+
alignItems: 'start'
|
|
21
|
+
}),
|
|
22
|
+
center: css({
|
|
23
|
+
alignItems: 'center'
|
|
24
|
+
}),
|
|
25
|
+
end: css({
|
|
26
|
+
alignItems: 'end'
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
var flexGrowMap = {
|
|
30
|
+
hug: css({
|
|
31
|
+
flexGrow: 0
|
|
32
|
+
}),
|
|
33
|
+
fill: css({
|
|
34
|
+
flexGrow: 1
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
40
|
+
* @codegen <<SignedSource::e0d436d3312290a98dbfd91d90dd6b9e>>
|
|
41
|
+
* @codegenId spacing
|
|
42
|
+
* @codegenCommand yarn codegen-styles
|
|
43
|
+
* @codegenParams ["space"]
|
|
44
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
45
|
+
*/
|
|
46
|
+
var spaceMap = {
|
|
47
|
+
'0': css({
|
|
48
|
+
gap: "var(--ds-space-0, 0px)"
|
|
49
|
+
}),
|
|
50
|
+
'025': css({
|
|
51
|
+
gap: "var(--ds-space-025, 2px)"
|
|
52
|
+
}),
|
|
53
|
+
'050': css({
|
|
54
|
+
gap: "var(--ds-space-050, 4px)"
|
|
55
|
+
}),
|
|
56
|
+
'075': css({
|
|
57
|
+
gap: "var(--ds-space-075, 6px)"
|
|
58
|
+
}),
|
|
59
|
+
'100': css({
|
|
60
|
+
gap: "var(--ds-space-100, 8px)"
|
|
61
|
+
}),
|
|
62
|
+
'1000': css({
|
|
63
|
+
gap: "var(--ds-space-1000, 80px)"
|
|
64
|
+
}),
|
|
65
|
+
'150': css({
|
|
66
|
+
gap: "var(--ds-space-150, 12px)"
|
|
67
|
+
}),
|
|
68
|
+
'200': css({
|
|
69
|
+
gap: "var(--ds-space-200, 16px)"
|
|
70
|
+
}),
|
|
71
|
+
'250': css({
|
|
72
|
+
gap: "var(--ds-space-250, 20px)"
|
|
73
|
+
}),
|
|
74
|
+
'300': css({
|
|
75
|
+
gap: "var(--ds-space-300, 24px)"
|
|
76
|
+
}),
|
|
77
|
+
'400': css({
|
|
78
|
+
gap: "var(--ds-space-400, 32px)"
|
|
79
|
+
}),
|
|
80
|
+
'500': css({
|
|
81
|
+
gap: "var(--ds-space-500, 40px)"
|
|
82
|
+
}),
|
|
83
|
+
'600': css({
|
|
84
|
+
gap: "var(--ds-space-600, 48px)"
|
|
85
|
+
}),
|
|
86
|
+
'800': css({
|
|
87
|
+
gap: "var(--ds-space-800, 64px)"
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @codegenEnd
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
var baseStyles = css({
|
|
95
|
+
display: 'flex',
|
|
96
|
+
boxSizing: 'border-box',
|
|
97
|
+
flexDirection: 'column'
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* __Stack__
|
|
102
|
+
*
|
|
103
|
+
* Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Stack>
|
|
108
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
109
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
110
|
+
* </Stack>
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
114
|
+
var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
115
|
+
var alignItems = _ref.alignInline,
|
|
116
|
+
alignBlock = _ref.alignBlock,
|
|
117
|
+
spread = _ref.spread,
|
|
118
|
+
grow = _ref.grow,
|
|
119
|
+
space = _ref.space,
|
|
120
|
+
children = _ref.children,
|
|
121
|
+
testId = _ref.testId;
|
|
122
|
+
var justifyContent = spread || alignBlock;
|
|
123
|
+
return jsx("div", {
|
|
124
|
+
css: [baseStyles, space && spaceMap[space], alignItems && alignItemsMap[alignItems], grow && flexGrowMap[grow], justifyContent && justifyContentMap[justifyContent]],
|
|
125
|
+
"data-testid": testId,
|
|
126
|
+
ref: ref
|
|
127
|
+
}, children);
|
|
128
|
+
}));
|
|
129
|
+
Stack.displayName = 'Stack';
|
|
130
|
+
export default Stack;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Stack } from './components/stack.partial';
|
|
1
|
+
export { default as Stack } from './components/stack.partial';
|
|
2
2
|
export { Box } from './components/box';
|
|
3
|
-
export { Inline } from './components/inline.partial';
|
|
3
|
+
export { default as Inline } from './components/inline.partial';
|
package/dist/esm/version.json
CHANGED
|
@@ -1 +1,86 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface InlineProps {
|
|
4
|
+
/**
|
|
5
|
+
* Used to align children along the main axis.
|
|
6
|
+
*/
|
|
7
|
+
alignBlock?: AlignBlock;
|
|
8
|
+
/**
|
|
9
|
+
* Used to align children along the cross axis.
|
|
10
|
+
*/
|
|
11
|
+
alignInline?: AlignInline;
|
|
12
|
+
/**
|
|
13
|
+
* Used to set whether children are forced onto one line or will wrap onto multiple lines.
|
|
14
|
+
*/
|
|
15
|
+
shouldWrap?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Used to distribute the children along the main axis.
|
|
18
|
+
*/
|
|
19
|
+
spread?: Spread;
|
|
20
|
+
/**
|
|
21
|
+
* Used to set whether the content should grow to fill the available space.
|
|
22
|
+
*/
|
|
23
|
+
grow?: Grow;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the space between each child.
|
|
26
|
+
*/
|
|
27
|
+
space?: Space;
|
|
28
|
+
/**
|
|
29
|
+
* Renders a separator string between each child.
|
|
30
|
+
*/
|
|
31
|
+
separator?: string;
|
|
32
|
+
/**
|
|
33
|
+
* A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
|
|
34
|
+
*/
|
|
35
|
+
testId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Elements to be rendered inside the Stack.
|
|
38
|
+
*/
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export declare type AlignInline = 'start' | 'center' | 'end';
|
|
42
|
+
export declare type AlignBlock = 'start' | 'center' | 'end' | 'baseline';
|
|
43
|
+
export declare type Spread = 'space-between';
|
|
44
|
+
export declare type Grow = 'hug' | 'fill';
|
|
45
|
+
/**
|
|
46
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
47
|
+
* @codegen <<SignedSource::e0d436d3312290a98dbfd91d90dd6b9e>>
|
|
48
|
+
* @codegenId spacing
|
|
49
|
+
* @codegenCommand yarn codegen-styles
|
|
50
|
+
* @codegenParams ["space"]
|
|
51
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
52
|
+
*/
|
|
53
|
+
declare const spaceMap: {
|
|
54
|
+
'0': import("@emotion/react").SerializedStyles;
|
|
55
|
+
'025': import("@emotion/react").SerializedStyles;
|
|
56
|
+
'050': import("@emotion/react").SerializedStyles;
|
|
57
|
+
'075': import("@emotion/react").SerializedStyles;
|
|
58
|
+
'100': import("@emotion/react").SerializedStyles;
|
|
59
|
+
'1000': import("@emotion/react").SerializedStyles;
|
|
60
|
+
'150': import("@emotion/react").SerializedStyles;
|
|
61
|
+
'200': import("@emotion/react").SerializedStyles;
|
|
62
|
+
'250': import("@emotion/react").SerializedStyles;
|
|
63
|
+
'300': import("@emotion/react").SerializedStyles;
|
|
64
|
+
'400': import("@emotion/react").SerializedStyles;
|
|
65
|
+
'500': import("@emotion/react").SerializedStyles;
|
|
66
|
+
'600': import("@emotion/react").SerializedStyles;
|
|
67
|
+
'800': import("@emotion/react").SerializedStyles;
|
|
68
|
+
};
|
|
69
|
+
export declare type Space = keyof typeof spaceMap;
|
|
70
|
+
/**
|
|
71
|
+
* __Inline__
|
|
72
|
+
*
|
|
73
|
+
* Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
|
|
74
|
+
*
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Inline>
|
|
79
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
80
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
81
|
+
* </Inline>
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
declare const Inline: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<InlineProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
86
|
+
export default Inline;
|
|
@@ -1 +1,77 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface StackProps {
|
|
4
|
+
/**
|
|
5
|
+
* Used to align children along the main axis.
|
|
6
|
+
*/
|
|
7
|
+
alignBlock?: AlignBlock;
|
|
8
|
+
/**
|
|
9
|
+
* Used to align children along the cross axis.
|
|
10
|
+
*/
|
|
11
|
+
alignInline?: AlignInline;
|
|
12
|
+
/**
|
|
13
|
+
* Used to distribute the children along the main axis.
|
|
14
|
+
*/
|
|
15
|
+
spread?: Spread;
|
|
16
|
+
/**
|
|
17
|
+
* Used to set whether the content should grow to fill the available space.
|
|
18
|
+
*/
|
|
19
|
+
grow?: Grow;
|
|
20
|
+
/**
|
|
21
|
+
* Represents the space between each child.
|
|
22
|
+
*/
|
|
23
|
+
space?: Space;
|
|
24
|
+
/**
|
|
25
|
+
* A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.
|
|
26
|
+
*/
|
|
27
|
+
testId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Elements to be rendered inside the Stack.
|
|
30
|
+
*/
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export declare type AlignInline = 'start' | 'center' | 'end';
|
|
34
|
+
export declare type AlignBlock = 'start' | 'center' | 'end';
|
|
35
|
+
export declare type Spread = 'space-between';
|
|
36
|
+
export declare type Grow = 'hug' | 'fill';
|
|
37
|
+
/**
|
|
38
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
39
|
+
* @codegen <<SignedSource::e0d436d3312290a98dbfd91d90dd6b9e>>
|
|
40
|
+
* @codegenId spacing
|
|
41
|
+
* @codegenCommand yarn codegen-styles
|
|
42
|
+
* @codegenParams ["space"]
|
|
43
|
+
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
44
|
+
*/
|
|
45
|
+
declare const spaceMap: {
|
|
46
|
+
'0': import("@emotion/react").SerializedStyles;
|
|
47
|
+
'025': import("@emotion/react").SerializedStyles;
|
|
48
|
+
'050': import("@emotion/react").SerializedStyles;
|
|
49
|
+
'075': import("@emotion/react").SerializedStyles;
|
|
50
|
+
'100': import("@emotion/react").SerializedStyles;
|
|
51
|
+
'1000': import("@emotion/react").SerializedStyles;
|
|
52
|
+
'150': import("@emotion/react").SerializedStyles;
|
|
53
|
+
'200': import("@emotion/react").SerializedStyles;
|
|
54
|
+
'250': import("@emotion/react").SerializedStyles;
|
|
55
|
+
'300': import("@emotion/react").SerializedStyles;
|
|
56
|
+
'400': import("@emotion/react").SerializedStyles;
|
|
57
|
+
'500': import("@emotion/react").SerializedStyles;
|
|
58
|
+
'600': import("@emotion/react").SerializedStyles;
|
|
59
|
+
'800': import("@emotion/react").SerializedStyles;
|
|
60
|
+
};
|
|
61
|
+
export declare type Space = keyof typeof spaceMap;
|
|
62
|
+
/**
|
|
63
|
+
* __Stack__
|
|
64
|
+
*
|
|
65
|
+
* Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <Stack>
|
|
70
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
71
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
72
|
+
* </Stack>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
declare const Stack: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<StackProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
77
|
+
export default Stack;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Stack } from './components/stack.partial';
|
|
1
|
+
export { default as Stack } from './components/stack.partial';
|
|
2
2
|
export { Box } from './components/box';
|
|
3
|
-
export { Inline } from './components/inline.partial';
|
|
3
|
+
export { default as Inline } from './components/inline.partial';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@af/codegen": "*",
|
|
50
50
|
"@atlaskit/docs": "*",
|
|
51
51
|
"@atlaskit/ds-lib": "*",
|
|
52
|
+
"@atlaskit/heading": "*",
|
|
52
53
|
"@atlaskit/ssr": "*",
|
|
53
54
|
"@atlaskit/visual-regression": "*",
|
|
54
55
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -86,4 +87,4 @@
|
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
89
|
-
}
|
|
90
|
+
}
|
package/report.api.md
CHANGED
|
@@ -16,14 +16,113 @@
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { default as Box } from '@atlaskit/ds-explorations/box';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
20
|
+
import { MemoExoticComponent } from 'react';
|
|
21
|
+
import { ReactNode } from 'react';
|
|
22
|
+
import { RefAttributes } from 'react';
|
|
23
|
+
import { SerializedStyles } from '@emotion/react';
|
|
24
|
+
|
|
25
|
+
// @public (undocumented)
|
|
26
|
+
type AlignBlock = 'center' | 'end' | 'start';
|
|
27
|
+
|
|
28
|
+
// @public (undocumented)
|
|
29
|
+
type AlignBlock_2 = 'baseline' | 'center' | 'end' | 'start';
|
|
30
|
+
|
|
31
|
+
// @public (undocumented)
|
|
32
|
+
type AlignInline = 'center' | 'end' | 'start';
|
|
33
|
+
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
type AlignInline_2 = 'center' | 'end' | 'start';
|
|
21
36
|
|
|
22
37
|
export { Box };
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
// @public (undocumented)
|
|
40
|
+
type Grow = 'fill' | 'hug';
|
|
41
|
+
|
|
42
|
+
// @public (undocumented)
|
|
43
|
+
type Grow_2 = 'fill' | 'hug';
|
|
44
|
+
|
|
45
|
+
// @public
|
|
46
|
+
export const Inline: MemoExoticComponent<
|
|
47
|
+
ForwardRefExoticComponent<InlineProps & RefAttributes<HTMLDivElement>>
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
// @public (undocumented)
|
|
51
|
+
interface InlineProps {
|
|
52
|
+
alignBlock?: AlignBlock_2;
|
|
53
|
+
alignInline?: AlignInline_2;
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
grow?: Grow_2;
|
|
56
|
+
separator?: string;
|
|
57
|
+
shouldWrap?: boolean;
|
|
58
|
+
space?: Space_2;
|
|
59
|
+
spread?: Spread_2;
|
|
60
|
+
testId?: string;
|
|
61
|
+
}
|
|
25
62
|
|
|
26
|
-
|
|
63
|
+
// @public (undocumented)
|
|
64
|
+
type Space = keyof typeof spaceMap;
|
|
65
|
+
|
|
66
|
+
// @public (undocumented)
|
|
67
|
+
type Space_2 = keyof typeof spaceMap_2;
|
|
68
|
+
|
|
69
|
+
// @public
|
|
70
|
+
const spaceMap: {
|
|
71
|
+
'0': SerializedStyles;
|
|
72
|
+
'025': SerializedStyles;
|
|
73
|
+
'050': SerializedStyles;
|
|
74
|
+
'075': SerializedStyles;
|
|
75
|
+
'100': SerializedStyles;
|
|
76
|
+
'1000': SerializedStyles;
|
|
77
|
+
'150': SerializedStyles;
|
|
78
|
+
'200': SerializedStyles;
|
|
79
|
+
'250': SerializedStyles;
|
|
80
|
+
'300': SerializedStyles;
|
|
81
|
+
'400': SerializedStyles;
|
|
82
|
+
'500': SerializedStyles;
|
|
83
|
+
'600': SerializedStyles;
|
|
84
|
+
'800': SerializedStyles;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// @public
|
|
88
|
+
const spaceMap_2: {
|
|
89
|
+
'0': SerializedStyles;
|
|
90
|
+
'025': SerializedStyles;
|
|
91
|
+
'050': SerializedStyles;
|
|
92
|
+
'075': SerializedStyles;
|
|
93
|
+
'100': SerializedStyles;
|
|
94
|
+
'1000': SerializedStyles;
|
|
95
|
+
'150': SerializedStyles;
|
|
96
|
+
'200': SerializedStyles;
|
|
97
|
+
'250': SerializedStyles;
|
|
98
|
+
'300': SerializedStyles;
|
|
99
|
+
'400': SerializedStyles;
|
|
100
|
+
'500': SerializedStyles;
|
|
101
|
+
'600': SerializedStyles;
|
|
102
|
+
'800': SerializedStyles;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// @public (undocumented)
|
|
106
|
+
type Spread = 'space-between';
|
|
107
|
+
|
|
108
|
+
// @public (undocumented)
|
|
109
|
+
type Spread_2 = 'space-between';
|
|
110
|
+
|
|
111
|
+
// @public
|
|
112
|
+
export const Stack: MemoExoticComponent<
|
|
113
|
+
ForwardRefExoticComponent<StackProps & RefAttributes<HTMLDivElement>>
|
|
114
|
+
>;
|
|
115
|
+
|
|
116
|
+
// @public (undocumented)
|
|
117
|
+
interface StackProps {
|
|
118
|
+
alignBlock?: AlignBlock;
|
|
119
|
+
alignInline?: AlignInline;
|
|
120
|
+
children: ReactNode;
|
|
121
|
+
grow?: Grow;
|
|
122
|
+
space?: Space;
|
|
123
|
+
spread?: Spread;
|
|
124
|
+
testId?: string;
|
|
125
|
+
}
|
|
27
126
|
|
|
28
127
|
// (No @packageDocumentation comment for this package)
|
|
29
128
|
```
|
|
@@ -60,8 +60,8 @@ Promise.all(
|
|
|
60
60
|
return Promise.all(
|
|
61
61
|
[
|
|
62
62
|
{ path: ['internal', 'box.partial.tsx'] },
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
{ path: ['inline.partial.tsx'] },
|
|
64
|
+
{ path: ['stack.partial.tsx'] },
|
|
65
65
|
].map(({ path }) => {
|
|
66
66
|
const targetPath = join(__dirname, '../', 'src', 'components', ...path);
|
|
67
67
|
|
|
@@ -30,6 +30,9 @@ const spacingProperties = {
|
|
|
30
30
|
gap: {
|
|
31
31
|
cssProperty: 'gap',
|
|
32
32
|
},
|
|
33
|
+
space: {
|
|
34
|
+
cssProperty: 'gap',
|
|
35
|
+
},
|
|
33
36
|
columnGap: {
|
|
34
37
|
cssProperty: 'columnGap',
|
|
35
38
|
},
|
|
@@ -38,7 +41,10 @@ const spacingProperties = {
|
|
|
38
41
|
},
|
|
39
42
|
} as const;
|
|
40
43
|
|
|
41
|
-
const
|
|
44
|
+
const spacingTokenPrefix = 'space.';
|
|
45
|
+
const onlySpaceTokens = tokens.filter(token =>
|
|
46
|
+
token.name.startsWith(spacingTokenPrefix),
|
|
47
|
+
);
|
|
42
48
|
|
|
43
49
|
const activeTokens = onlySpaceTokens.map(t => ({
|
|
44
50
|
name: t.name,
|
|
@@ -61,7 +67,10 @@ const ${spacingProperty}Map = {
|
|
|
61
67
|
${activeTokens
|
|
62
68
|
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
|
63
69
|
.map(token => {
|
|
64
|
-
const propName =
|
|
70
|
+
const propName =
|
|
71
|
+
spacingProperty === 'space'
|
|
72
|
+
? token.name.replace(spacingTokenPrefix, '')
|
|
73
|
+
: token.name;
|
|
65
74
|
return `'${propName}': ${tokenToStyle(
|
|
66
75
|
cssProperty,
|
|
67
76
|
token.name,
|