@atlaskit/css 0.7.2 → 0.7.4
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 +14 -0
- package/constellation/index/overview.mdx +31 -86
- package/dist/cjs/index.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/css
|
|
2
2
|
|
|
3
|
+
## 0.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#103999](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103999)
|
|
8
|
+
[`9f62ecec4d422`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f62ecec4d422) -
|
|
9
|
+
Update dependencies.
|
|
10
|
+
|
|
11
|
+
## 0.7.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 0.7.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -3,6 +3,8 @@ order: 0
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
import SectionMessage from '@atlaskit/section-message';
|
|
6
|
+
import CssMapExample from '../../examples/constellation/css-map';
|
|
7
|
+
import UnboundedExample from '../../examples/constellation/unbounded';
|
|
6
8
|
|
|
7
9
|
<SectionMessage title="Migration from Emotion to Compiled" appearance="discovery">
|
|
8
10
|
<p>
|
|
@@ -40,38 +42,18 @@ set of numeric values.
|
|
|
40
42
|
### cssMap
|
|
41
43
|
|
|
42
44
|
We recommend using `cssMap` to create style maps. These maps can be applied and reused on both
|
|
43
|
-
native elements and React components using `props.css` and `props.xcss
|
|
45
|
+
native elements and React components using `props.css` and `props.xcss` respectively.
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
color: token('color.text.inverse'),
|
|
56
|
-
},
|
|
57
|
-
discovery: {
|
|
58
|
-
backgroundColor: token('color.background.discovery.bold'),
|
|
59
|
-
color: token('color.text.inverse'),
|
|
60
|
-
},
|
|
61
|
-
success: {
|
|
62
|
-
backgroundColor: token('color.background.success.bold'),
|
|
63
|
-
color: token('color.text.inverse'),
|
|
64
|
-
},
|
|
65
|
-
disabled: { opacity: 0.7, cursor: 'not-allowed' },
|
|
66
|
-
});
|
|
67
|
-
export default ({
|
|
68
|
-
appearance = 'primary',
|
|
69
|
-
isDisabled,
|
|
70
|
-
}: {
|
|
71
|
-
appearance?: 'primary' | 'discovery' | 'success';
|
|
72
|
-
isDisabled?: boolean;
|
|
73
|
-
}) => <div css={(styles.root, styles[appearance], isDisabled && styles.disabled)} />;
|
|
74
|
-
```
|
|
47
|
+
Make sure to define the styles before using them in your components, i.e. at the top of the file.
|
|
48
|
+
|
|
49
|
+
<Example Component={CssMapExample} packageName="@atlaskit/css" />
|
|
50
|
+
|
|
51
|
+
### Primitives
|
|
52
|
+
|
|
53
|
+
When using `@atlaskit/css`, it's important to note that it's not compatible with the Emotion variant
|
|
54
|
+
of Primitives. Instead, use the Compiled variant of Primitives, available at
|
|
55
|
+
`@atlaskit/primitives/compiled`. The Compiled variant is a drop-in replacement that provides the
|
|
56
|
+
same components and APIs you're familiar with.
|
|
75
57
|
|
|
76
58
|
### cx
|
|
77
59
|
|
|
@@ -102,28 +84,14 @@ const styles = cssMap({
|
|
|
102
84
|
root: {
|
|
103
85
|
padding: token('space.100'),
|
|
104
86
|
color: token('color.text'),
|
|
105
|
-
backgroundColor: token('elevation.surface'),
|
|
106
87
|
},
|
|
107
|
-
compact: { padding: token('space.
|
|
108
|
-
transparent: { backgroundColor: 'transparent' },
|
|
88
|
+
compact: { padding: token('space.050') },
|
|
109
89
|
});
|
|
110
90
|
|
|
111
|
-
export default ({
|
|
112
|
-
spacing = 'default',
|
|
113
|
-
noBackground,
|
|
114
|
-
}: {
|
|
115
|
-
spacing: 'compact' | 'default';
|
|
116
|
-
noBackground?: boolean;
|
|
117
|
-
}) => {
|
|
91
|
+
export default ({ spacing = 'default' }: { spacing: 'compact' | 'default' }) => {
|
|
118
92
|
return (
|
|
119
|
-
<Box
|
|
120
|
-
|
|
121
|
-
styles.root,
|
|
122
|
-
spacing === 'compact' && styles.compact,
|
|
123
|
-
noBackground && styles.transparent,
|
|
124
|
-
)}
|
|
125
|
-
>
|
|
126
|
-
<p css={[styles.compact, styles.transparent]}>Hello world!</p>
|
|
93
|
+
<Box xcss={cx(styles.root, spacing === 'compact' && styles.compact)}>
|
|
94
|
+
<p css={[styles.compact]}>Hello world!</p>
|
|
127
95
|
</Box>
|
|
128
96
|
);
|
|
129
97
|
};
|
|
@@ -144,7 +112,7 @@ you can do so:
|
|
|
144
112
|
* @jsxRuntime classic
|
|
145
113
|
* @jsx jsx
|
|
146
114
|
*/
|
|
147
|
-
import { cssMap,
|
|
115
|
+
import { cssMap, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
148
116
|
import { token } from '@atlaskit/tokens';
|
|
149
117
|
|
|
150
118
|
const styles = cssMap({
|
|
@@ -165,7 +133,7 @@ export function Card({
|
|
|
165
133
|
>;
|
|
166
134
|
}) {
|
|
167
135
|
return (
|
|
168
|
-
<div css={
|
|
136
|
+
<div css={[styles.button, isDense && styles.dense]} className={xcss}>
|
|
169
137
|
{children}
|
|
170
138
|
</div>
|
|
171
139
|
);
|
|
@@ -210,22 +178,29 @@ Primitive, the first `Card` component would look a bit different, brief example:
|
|
|
210
178
|
* @jsxRuntime classic
|
|
211
179
|
* @jsx jsx
|
|
212
180
|
*/
|
|
213
|
-
import { cssMap,
|
|
214
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
181
|
+
import { cssMap, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
215
182
|
import { token } from '@atlaskit/tokens';
|
|
216
183
|
|
|
217
184
|
const styles = cssMap({
|
|
218
185
|
button: { padding: token('space.100'), borderRadius: token('border.radius.100') },
|
|
186
|
+
dense: { padding: token('space.050'), borderRadius: token('border.radius.050') },
|
|
219
187
|
});
|
|
220
188
|
|
|
221
189
|
export function Card({
|
|
222
190
|
children,
|
|
223
191
|
xcss,
|
|
192
|
+
isDense,
|
|
224
193
|
}: {
|
|
225
194
|
children: React.ReactNode;
|
|
226
|
-
|
|
195
|
+
isDense?: boolean;
|
|
196
|
+
xcss?: StrictXCSSProp<'padding' | 'borderRadius', never>;
|
|
227
197
|
}) {
|
|
228
|
-
return
|
|
198
|
+
return (
|
|
199
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- required with `xcss`
|
|
200
|
+
<div css={[styles.button, isDense && styles.dense]} className={xcss}>
|
|
201
|
+
{children}
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
229
204
|
}
|
|
230
205
|
```
|
|
231
206
|
|
|
@@ -237,37 +212,7 @@ Note that this won't work on primitive components. While it's best to stick to t
|
|
|
237
212
|
guidelines, this option can be useful for handling specific edge cases. Please note this isn't
|
|
238
213
|
recommended for general use.
|
|
239
214
|
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* @jsxRuntime classic
|
|
243
|
-
* @jsx jsx
|
|
244
|
-
*/
|
|
245
|
-
import { cssMap } from '@compiled/react';
|
|
246
|
-
|
|
247
|
-
import { jsx } from '@atlaskit/css';
|
|
248
|
-
import { token } from '@atlaskit/tokens';
|
|
249
|
-
|
|
250
|
-
const unboundedStyles = cssMap({
|
|
251
|
-
container: {
|
|
252
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
253
|
-
'&:first-child': {
|
|
254
|
-
paddingBlockEnd: token('space.150'),
|
|
255
|
-
},
|
|
256
|
-
'@media (min-width: 48rem)': {
|
|
257
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
258
|
-
'&:first-child': {
|
|
259
|
-
paddingBlockStart: token('space.400'),
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
const Container = ({ children, testId }: ContainerProps) => (
|
|
266
|
-
<div css={unboundedStyles.container} data-testid={testId}>
|
|
267
|
-
{children}
|
|
268
|
-
</div>
|
|
269
|
-
);
|
|
270
|
-
```
|
|
215
|
+
<Example Component={UnboundedExample} packageName="@atlaskit/css" />
|
|
271
216
|
|
|
272
217
|
## Configuration required
|
|
273
218
|
|
package/dist/cjs/index.js
CHANGED
package/dist/es2019/index.js
CHANGED
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/css",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Style components backed by Atlassian Design System design tokens powered by Compiled CSS-in-JS.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"./test-utils": "./src/test-utils/index.tsx"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@atlaskit/tokens": "^
|
|
51
|
+
"@atlaskit/tokens": "^3.1.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@compiled/jest": "^0.10.5",
|
|
54
54
|
"@compiled/react": "^0.18.1"
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
"@types/jscodeshift": "^0.11.0",
|
|
68
68
|
"jscodeshift": "^0.13.0",
|
|
69
69
|
"react-dom": "^16.8.0",
|
|
70
|
-
"typescript": "~5.4.2"
|
|
71
|
-
"wait-for-expect": "^1.2.0"
|
|
70
|
+
"typescript": "~5.4.2"
|
|
72
71
|
},
|
|
73
72
|
"techstack": {
|
|
74
73
|
"@atlassian/frontend": {
|