@atlaskit/css 0.5.2 → 0.6.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 +20 -0
- package/codemods/{primitives-emotion-to-compiled/next-primitives-emotion-to-compiled.tsx → 0.5.2-primitives-emotion-to-compiled/index.tsx} +91 -73
- package/constellation/index/examples.mdx +366 -0
- package/constellation/index/migration.mdx +59 -0
- package/dist/cjs/index.js +7 -1
- package/dist/es2019/index.js +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/package.json +9 -5
- /package/codemods/{primitives-emotion-to-compiled → 0.5.2-primitives-emotion-to-compiled}/style-maps.partial.tsx +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/css
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#154669](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154669)
|
|
8
|
+
[`20db78434becd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/20db78434becd) -
|
|
9
|
+
Bump to the latest version of @compiled/\*
|
|
10
|
+
- [#154669](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154669)
|
|
11
|
+
[`20db78434becd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/20db78434becd) -
|
|
12
|
+
Adds the `jsx` export to allow `@atlaskit/css` to be used for the JSX Pragma within the Compiled
|
|
13
|
+
ecosystem.
|
|
14
|
+
|
|
15
|
+
## 0.5.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#151036](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151036)
|
|
20
|
+
[`5fa98b5962048`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5fa98b5962048) -
|
|
21
|
+
Add version prefix to codemod
|
|
22
|
+
|
|
3
23
|
## 0.5.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -50,14 +50,14 @@ const styleMaps = {
|
|
|
50
50
|
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
51
51
|
const base = j(fileInfo.source);
|
|
52
52
|
|
|
53
|
+
addJsxPragma(j, base);
|
|
54
|
+
|
|
53
55
|
// replace xcss with cssMap
|
|
54
56
|
const xcssSpecifier = getImportSpecifier(j, base, 'xcss');
|
|
55
57
|
if (!xcssSpecifier) {
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
addJsxPragma(j, base);
|
|
60
|
-
|
|
61
61
|
replaceXcssWithCssMap(j, base, xcssSpecifier);
|
|
62
62
|
|
|
63
63
|
updateImports(j, base);
|
|
@@ -66,18 +66,23 @@ export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API,
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function addJsxPragma(j: core.JSCodeshift, source: ReturnType<typeof j>) {
|
|
69
|
-
const jsxPragma =
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
const existingComments = rootNode.comments || [];
|
|
73
|
-
|
|
74
|
-
const hasJsxPragma = existingComments.some(
|
|
75
|
-
(comment: core.Comment) =>
|
|
76
|
-
comment.value.includes('@jsxRuntime classic') && comment.value.includes('@jsx jsx'),
|
|
77
|
-
);
|
|
69
|
+
const jsxPragma = '*\n * @jsxRuntime classic\n * @jsx jsx\n ';
|
|
70
|
+
// extract all comments, not just root node
|
|
71
|
+
const allComments = source.find(j.Comment).nodes();
|
|
78
72
|
|
|
73
|
+
const hasJsxPragma = allComments.some((comment) => {
|
|
74
|
+
const value = comment.value;
|
|
75
|
+
return /@jsxRuntime\s+classic/.test(value) && /@jsx\s+jsx/.test(value);
|
|
76
|
+
});
|
|
79
77
|
if (!hasJsxPragma) {
|
|
80
|
-
|
|
78
|
+
// create new comment block for the jsx pragma
|
|
79
|
+
const pragmaComment = j.commentBlock(jsxPragma, true, false);
|
|
80
|
+
// insert at the top of the file
|
|
81
|
+
const rootNode = source.get().node;
|
|
82
|
+
if (!rootNode.comments) {
|
|
83
|
+
rootNode.comments = [];
|
|
84
|
+
}
|
|
85
|
+
rootNode.comments.unshift(pragmaComment);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
|
|
@@ -132,7 +137,10 @@ function replaceXcssWithCssMap(
|
|
|
132
137
|
j.callExpression(j.identifier('cssMap'), [cssMapObject]),
|
|
133
138
|
),
|
|
134
139
|
]);
|
|
135
|
-
|
|
140
|
+
|
|
141
|
+
// insert the cssMap var after all imports
|
|
142
|
+
const lastImportIndex = source.find(j.ImportDeclaration).size();
|
|
143
|
+
source.get().node.program.body.splice(lastImportIndex, 0, cssMapVariableDeclaration);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
// update the xcss prop references to use the new cssMap object
|
|
@@ -151,13 +159,13 @@ function replaceXcssWithCssMap(
|
|
|
151
159
|
if (expression.type === 'Identifier') {
|
|
152
160
|
// <Box xcss={buttonStyles} /> -> <Box xcss={styles.button} />
|
|
153
161
|
expression.name = `styles.${getCssMapKey(expression.name)}`;
|
|
154
|
-
// <Box xcss={[baseStyles, otherStyles]} /> -> <Box xcss={[styles.base, styles.otherStyles]} />
|
|
155
162
|
} else if (expression.type === 'ArrayExpression') {
|
|
163
|
+
// <Box xcss={[baseStyles, otherStyles]} /> -> <Box xcss={[styles.base, styles.otherStyles]} />
|
|
156
164
|
expression.elements.forEach((element) => {
|
|
157
165
|
if (element?.type === 'Identifier') {
|
|
158
166
|
element.name = `styles.${getCssMapKey(element.name)}`;
|
|
159
|
-
// <Box xcss={condition && styles} /> -> <Box xcss={condition && styles.root} />
|
|
160
167
|
} else if (
|
|
168
|
+
// <Box xcss={condition && styles} /> -> <Box xcss={condition && styles.root} />
|
|
161
169
|
element?.type === 'LogicalExpression' &&
|
|
162
170
|
element.right.type === 'Identifier'
|
|
163
171
|
) {
|
|
@@ -222,35 +230,80 @@ function updateImports(j: core.JSCodeshift, source: ReturnType<typeof j>) {
|
|
|
222
230
|
path.node.specifiers = path.node.specifiers.filter(
|
|
223
231
|
(specifier) => specifier.local?.name !== 'xcss',
|
|
224
232
|
);
|
|
233
|
+
if (path.node.specifiers.length === 0) {
|
|
234
|
+
// if no specifiers remain, remove the import
|
|
235
|
+
j(path).remove();
|
|
236
|
+
}
|
|
225
237
|
}
|
|
226
238
|
});
|
|
227
239
|
|
|
228
|
-
const
|
|
240
|
+
const importsNeeded = {
|
|
241
|
+
cssMap: false,
|
|
242
|
+
jsx: false,
|
|
243
|
+
token: false,
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// check existing imports
|
|
247
|
+
source.find(j.ImportDeclaration).forEach((path) => {
|
|
248
|
+
switch (path.node.source.value) {
|
|
249
|
+
case '@atlaskit/css':
|
|
250
|
+
if (path.node.specifiers) {
|
|
251
|
+
path.node.specifiers.forEach((specifier) => {
|
|
252
|
+
if (specifier.local?.name === 'cssMap') {
|
|
253
|
+
importsNeeded.cssMap = true;
|
|
254
|
+
}
|
|
255
|
+
if (specifier.local?.name === 'jsx') {
|
|
256
|
+
importsNeeded.jsx = true;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
case '@atlaskit/tokens':
|
|
262
|
+
importsNeeded.token = true;
|
|
263
|
+
break;
|
|
264
|
+
case '@emotion/react':
|
|
265
|
+
// remove the jsx import from @emotion/react
|
|
266
|
+
path.node.specifiers = path.node.specifiers?.filter(
|
|
267
|
+
(specifier) => j.ImportSpecifier.check(specifier) && specifier.imported.name !== 'jsx',
|
|
268
|
+
);
|
|
269
|
+
if (path.node.specifiers?.length === 0) {
|
|
270
|
+
j(path).remove();
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
const newImports: ImportDeclaration[] = [];
|
|
229
277
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
);
|
|
233
|
-
if (!hasCssMapImport) {
|
|
278
|
+
if (!importsNeeded.cssMap || !importsNeeded.jsx) {
|
|
279
|
+
// add cssMap and jsx together if either is missing
|
|
234
280
|
const cssMapImport = j.importDeclaration(
|
|
235
|
-
[j.importSpecifier(j.identifier('cssMap'))],
|
|
281
|
+
[j.importSpecifier(j.identifier('cssMap')), j.importSpecifier(j.identifier('jsx'))],
|
|
236
282
|
j.literal('@atlaskit/css'),
|
|
237
283
|
);
|
|
238
|
-
|
|
284
|
+
newImports.push(cssMapImport);
|
|
239
285
|
}
|
|
240
286
|
|
|
241
|
-
|
|
242
|
-
(path) => path.node.source.value === '@atlaskit/tokens',
|
|
243
|
-
);
|
|
244
|
-
if (!hasTokenImport) {
|
|
287
|
+
if (!importsNeeded.token) {
|
|
245
288
|
const tokenImport = j.importDeclaration(
|
|
246
289
|
[j.importSpecifier(j.identifier('token'))],
|
|
247
290
|
j.literal('@atlaskit/tokens'),
|
|
248
291
|
);
|
|
249
|
-
|
|
292
|
+
newImports.push(tokenImport);
|
|
250
293
|
}
|
|
251
294
|
|
|
252
|
-
//
|
|
253
|
-
|
|
295
|
+
// remove default import React from 'react' if not needed
|
|
296
|
+
source.find(j.ImportDeclaration, { source: { value: 'react' } }).forEach((path) => {
|
|
297
|
+
path.node.specifiers = path.node.specifiers?.filter(
|
|
298
|
+
(specifier) =>
|
|
299
|
+
!(specifier.type === 'ImportDefaultSpecifier' && specifier.local?.name === 'React'),
|
|
300
|
+
);
|
|
301
|
+
if (path.node.specifiers?.length === 0) {
|
|
302
|
+
j(path).remove();
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// update @atlaskit/primitives imports to @atlaskit/primitives/compiled
|
|
254
307
|
source
|
|
255
308
|
.find(j.ImportDeclaration)
|
|
256
309
|
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === '@atlaskit/primitives')
|
|
@@ -258,51 +311,16 @@ function updateImports(j: core.JSCodeshift, source: ReturnType<typeof j>) {
|
|
|
258
311
|
path.node.source.value = '@atlaskit/primitives/compiled';
|
|
259
312
|
});
|
|
260
313
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
.filter((path) => path.node.imported.name === 'jsx');
|
|
270
|
-
|
|
271
|
-
const jsxImport = j.importDeclaration(
|
|
272
|
-
[j.importSpecifier(j.identifier('jsx'))],
|
|
273
|
-
j.literal('@compiled/react'),
|
|
274
|
-
);
|
|
275
|
-
|
|
276
|
-
if (existingEmotionImport.size() > 0) {
|
|
277
|
-
// replace jsx import from `@emotion/react` with `@compiled/react`
|
|
278
|
-
existingEmotionImport.closest(j.ImportDeclaration).replaceWith(jsxImport);
|
|
279
|
-
} else {
|
|
280
|
-
// add the new import at the top of the file
|
|
281
|
-
source.get().node.program.body.unshift(jsxImport);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// sort import declarations alphabetically
|
|
286
|
-
// probably not necessary as we can rely on prettier on save
|
|
287
|
-
const allImports = source.find(j.ImportDeclaration).nodes();
|
|
288
|
-
allImports.sort((a, b) => {
|
|
289
|
-
if (
|
|
290
|
-
typeof a.source.value === 'undefined' ||
|
|
291
|
-
typeof b.source.value === 'undefined' ||
|
|
292
|
-
a.source.value === null ||
|
|
293
|
-
b.source.value === null
|
|
294
|
-
) {
|
|
295
|
-
return 0;
|
|
296
|
-
}
|
|
314
|
+
// add new imports after any existing comments to ensure they're below the jsx pragma
|
|
315
|
+
const rootNode = source.get().node;
|
|
316
|
+
const firstNonCommentIndex = rootNode.program.body.findIndex(
|
|
317
|
+
(node: core.Node) =>
|
|
318
|
+
node.type !== 'ImportDeclaration' &&
|
|
319
|
+
node.type !== 'CommentBlock' &&
|
|
320
|
+
node.type !== 'CommentLine',
|
|
321
|
+
);
|
|
297
322
|
|
|
298
|
-
|
|
299
|
-
});
|
|
300
|
-
source.get().node.program.body = [
|
|
301
|
-
...allImports,
|
|
302
|
-
...source
|
|
303
|
-
.get()
|
|
304
|
-
.node.program.body.filter((node: core.Node) => node.type !== 'ImportDeclaration'),
|
|
305
|
-
];
|
|
323
|
+
rootNode.program.body.splice(firstNonCommentIndex, 0, ...newImports);
|
|
306
324
|
}
|
|
307
325
|
|
|
308
326
|
// look for xcss import
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 0
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
6
|
+
|
|
7
|
+
<SectionMessage title="Migration from Emotion to Compiled" appearance="discovery">
|
|
8
|
+
<p>
|
|
9
|
+
The Atlassian Design System is under the process of migrating from Emotion to Compiled for our
|
|
10
|
+
CSS-in-JS. Further details to come.
|
|
11
|
+
</p>
|
|
12
|
+
</SectionMessage>
|
|
13
|
+
|
|
14
|
+
`@atlaskit/css` is the replacement for `@atlaskit/primitives.xcss`, refer to
|
|
15
|
+
[Migration](/components/css/migration) for details migrating.
|
|
16
|
+
|
|
17
|
+
This is a bounded styling library to be used both with native styles (`<div>`) and the Atlassian
|
|
18
|
+
Design System, such as our [primitive components](/components/primitives).
|
|
19
|
+
|
|
20
|
+
This is built on top of [Compiled CSS-in-JS](https://compiledcssinjs.com/) which is a much more
|
|
21
|
+
performant, static styling solution with the same syntax and a few breaking changes—the primary ones
|
|
22
|
+
being dynamic styles as well as deep imports or exports for reuse of styles may not work.
|
|
23
|
+
|
|
24
|
+
This will require major configuration, noted below.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
For the most part, `@atlaskit/css` should behave like `@compiled/react` or other CSS-in-JS
|
|
29
|
+
libraries' `css()` syntaxes, however we promote `cssMap` as a way to create maps of styles as that's
|
|
30
|
+
the common use-case at Atlassian.
|
|
31
|
+
|
|
32
|
+
Please note that `@atlaskit/css` is a strictly bounded variant to help promote and align the usage
|
|
33
|
+
of Design System tokens and properties, so you you cannot use arbitrary values such as
|
|
34
|
+
`color: 'rgba(123, 45, 67)', padding: 8`, and typically we only allow our
|
|
35
|
+
[tokenized values](/components/tokens/all-tokens), but a few other property restrictions or
|
|
36
|
+
limitations exist, such as `zIndex` only having a few allowed literal numeric values.
|
|
37
|
+
|
|
38
|
+
### cssMap
|
|
39
|
+
|
|
40
|
+
`cssMap` is the default function we suggest to use, it can be reused across native elements through
|
|
41
|
+
`props.css` and React components through `props.xcss` and is flexible to style maps that are known
|
|
42
|
+
ahead-of-time.
|
|
43
|
+
|
|
44
|
+
These can be reused across multiple components, even across native and non-native.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { cssMap } from '@atlaskit/css';
|
|
48
|
+
const styles = cssMap({
|
|
49
|
+
root: { display: 'inline-block' },
|
|
50
|
+
primary: {
|
|
51
|
+
backgroundColor: token('color.background.brand.bold'),
|
|
52
|
+
color: token('color.text.inverse'),
|
|
53
|
+
},
|
|
54
|
+
discovery: {
|
|
55
|
+
backgroundColor: token('color.background.discovery.bold'),
|
|
56
|
+
color: token('color.text.inverse'),
|
|
57
|
+
},
|
|
58
|
+
success: {
|
|
59
|
+
backgroundColor: token('color.background.success.bold'),
|
|
60
|
+
color: token('color.text.inverse'),
|
|
61
|
+
},
|
|
62
|
+
disabled: { opacity: 0.7, cursor: 'not-allowed' },
|
|
63
|
+
});
|
|
64
|
+
export default ({
|
|
65
|
+
appearance = 'primary',
|
|
66
|
+
isDisabled,
|
|
67
|
+
}: {
|
|
68
|
+
appearance?: 'primary' | 'discovery' | 'success';
|
|
69
|
+
isDisabled?: boolean;
|
|
70
|
+
}) => <div css={(styles.root, styles[appearance], isDisabled && styles.disabled)} />;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### cx
|
|
74
|
+
|
|
75
|
+
The `cx` function is required when combining styles inside of an `xcss` prop, but can be used
|
|
76
|
+
anywhere. This is only required because `xcss={[styles.root, styles.bordered]}` results in incorrect
|
|
77
|
+
typing while with a function it is preserved.
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<div css={[styles.root, styles.bordered]} />
|
|
81
|
+
<div css={cx(styles.root, styles.bordered)} />
|
|
82
|
+
<Box xcss={cx(styles.root, styles.bordered)} />
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Typical example
|
|
86
|
+
|
|
87
|
+
You must have a JSX pragma in scope in order to use this, depending on your setup this may be
|
|
88
|
+
automatic, require `React` imported, or require `jsx` imported.
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
/**
|
|
92
|
+
* @jsxRuntime classic
|
|
93
|
+
* @jsx jsx
|
|
94
|
+
*/
|
|
95
|
+
import { cssMap, cx, jsx } from '@atlaskit/css';
|
|
96
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
97
|
+
import { token } from '@atlaskit/tokens';
|
|
98
|
+
|
|
99
|
+
const styles = cssMap({
|
|
100
|
+
root: {
|
|
101
|
+
padding: token('space.100'),
|
|
102
|
+
color: token('color.text'),
|
|
103
|
+
backgroundColor: token('elevation.surface'),
|
|
104
|
+
},
|
|
105
|
+
compact: { padding: token('space.50') },
|
|
106
|
+
transparent: { backgroundColor: 'transparent' },
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export default ({
|
|
110
|
+
spacing = 'default',
|
|
111
|
+
noBackground,
|
|
112
|
+
}: {
|
|
113
|
+
spacing: 'compact' | 'default';
|
|
114
|
+
noBackground?: boolean;
|
|
115
|
+
}) => {
|
|
116
|
+
return (
|
|
117
|
+
<Box
|
|
118
|
+
xcss={cx(
|
|
119
|
+
styles.root,
|
|
120
|
+
spacing === 'compact' && styles.compact,
|
|
121
|
+
noBackground && styles.transparent,
|
|
122
|
+
)}
|
|
123
|
+
>
|
|
124
|
+
<p css={[styles.compact, styles.transparent]}>Hello world!</p>
|
|
125
|
+
</Box>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Building a reusable component with pass-through styles
|
|
131
|
+
|
|
132
|
+
With the introduction of `@atlaskit/css` (and the underlying `createStrictAPI` from Compiled), we're
|
|
133
|
+
now able to define a strictly bounded API for our components. This may be an API pattern that you
|
|
134
|
+
want to copy as well.
|
|
135
|
+
|
|
136
|
+
For example, if you want to create your own component that allows you to extend and pass-through
|
|
137
|
+
styles, you can do so:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
/**
|
|
141
|
+
* @jsxRuntime classic
|
|
142
|
+
* @jsx jsx
|
|
143
|
+
*/
|
|
144
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
145
|
+
import { token } from '@atlaskit/tokens';
|
|
146
|
+
|
|
147
|
+
const styles = cssMap({
|
|
148
|
+
button: { padding: token('space.100'), borderRadius: token('border.radius.100') },
|
|
149
|
+
dense: { padding: token('space.050'), borderRadius: token('border.radius.050') },
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
export function Card({
|
|
153
|
+
children,
|
|
154
|
+
xcss,
|
|
155
|
+
dense,
|
|
156
|
+
}: {
|
|
157
|
+
children: React.ReactNode;
|
|
158
|
+
dense?: boolean;
|
|
159
|
+
/** Only `padding`, `borderRadius`, `backgroundColor`, and `color` properties and `hover` and `focus` pseudos are allowed */
|
|
160
|
+
xcss?: StrictXCSSProp<
|
|
161
|
+
'padding' | 'borderRadius' | 'backgroundColor' | 'color',
|
|
162
|
+
'&:hover' | '&:focus'
|
|
163
|
+
>;
|
|
164
|
+
}) {
|
|
165
|
+
return (
|
|
166
|
+
<div css={cx(styles.button, isDense && styles.dense)} className={xcss}>
|
|
167
|
+
{children}
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
I'm then allowed to build a component that uses this `Card` component and overrides these properties
|
|
174
|
+
as I see fit:
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
/**
|
|
178
|
+
* @jsxRuntime classic
|
|
179
|
+
* @jsx jsx
|
|
180
|
+
*/
|
|
181
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
182
|
+
import { token } from '@atlaskit/tokens';
|
|
183
|
+
import { Card } from './Card';
|
|
184
|
+
|
|
185
|
+
const styles = cssMap({
|
|
186
|
+
root: { padding: token('space.200'), borderRadius: token('border.radius.200') },
|
|
187
|
+
inverse: {
|
|
188
|
+
backgroundColor: token('color.background.discovery'),
|
|
189
|
+
color: token('color.text.inverse'),
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
export const LargeCard = ({
|
|
194
|
+
children,
|
|
195
|
+
isInverse,
|
|
196
|
+
}: {
|
|
197
|
+
children: React.ReactNode;
|
|
198
|
+
isInverse?: boolean;
|
|
199
|
+
}) => {
|
|
200
|
+
return <Card xcss={cx(styles.root, isInverse && styles.inverse)}>{children}</Card>;
|
|
201
|
+
};
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
However, if you're extending a component that uses `props.xcss` under the hood, for example a
|
|
205
|
+
Primitive, the first `Card` component would look a bit different, brief example:
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
/**
|
|
209
|
+
* @jsxRuntime classic
|
|
210
|
+
* @jsx jsx
|
|
211
|
+
*/
|
|
212
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
213
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
214
|
+
import { token } from '@atlaskit/tokens';
|
|
215
|
+
|
|
216
|
+
const styles = cssMap({
|
|
217
|
+
button: { padding: token('space.100'), borderRadius: token('border.radius.100') },
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
export function Card({
|
|
221
|
+
children,
|
|
222
|
+
xcss,
|
|
223
|
+
}: {
|
|
224
|
+
children: React.ReactNode;
|
|
225
|
+
xcss?: StrictXCSSProp<'padding' | 'borderRadius'>;
|
|
226
|
+
}) {
|
|
227
|
+
return <Box xcss={cx(styles.button, xcss)}>{children}</Box>;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Configuration required
|
|
232
|
+
|
|
233
|
+
<SectionMessage title="More details coming soon!" appearance="warning">
|
|
234
|
+
<p>This section is under development, more details will come soon.</p>
|
|
235
|
+
</SectionMessage>
|
|
236
|
+
|
|
237
|
+
In order to use any Atlassian Design System packages that distribute Compiled CSS-in-JS, you
|
|
238
|
+
**must** configure your project via Babel as well your bundler with Webpack and/or Parcel and using
|
|
239
|
+
the latest version of these plugins:
|
|
240
|
+
|
|
241
|
+
- `@atlaskit/tokens/babel-plugin`
|
|
242
|
+
- `@compiled/babel-plugin` configured with `sortShorthand: true` (or configured through
|
|
243
|
+
`@compiled/webpack-loader` or `@compiled/parcel-config` or similar)
|
|
244
|
+
- **SUGGESTED:** You should turn on
|
|
245
|
+
[@atlaskit/eslint-plugin-ui-styling-standard](/components/eslint-plugin-ui-styling-standard) to
|
|
246
|
+
guide you
|
|
247
|
+
|
|
248
|
+
Refer to https://compiledcssinjs.com/docs/installation
|
|
249
|
+
|
|
250
|
+
### Setup your Babel plugins
|
|
251
|
+
|
|
252
|
+
Most products will use Babel across the dev lifecycle, so this is typically a baseline
|
|
253
|
+
configuration.
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
yarn install @atlaskit/tokens
|
|
257
|
+
yarn install --dev @compiled/babel-plugin
|
|
258
|
+
yarn install --dev @compiled/babel-plugin-strip-runtime # optional, for extracting styles
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Plugin order matters, your `@atlaskit/tokens/babel-plugin` must come before your
|
|
262
|
+
`@compiled/babel-plugin`, otherwise you may experience errors.
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
// babel.config.js
|
|
266
|
+
module.exports = {
|
|
267
|
+
plugins: [
|
|
268
|
+
// This will handle all `token()` calls, eg. if used in a non-Compiled CSS-in-JS library:
|
|
269
|
+
'@atlaskit/tokens/babel-plugin',
|
|
270
|
+
// ↓↓ Compiled should run last ↓↓
|
|
271
|
+
['@compiled/babel-plugin', { transformerBabelPlugins: ['@atlaskit/tokens/babel-plugin'] }],
|
|
272
|
+
// OPTIONAL: If you are distributing packages with Compiled styles, you should also include the following.
|
|
273
|
+
// Your `dest` may vary depending on how you distribute, eg. if you have multiple `cjs` and `esm` distributions
|
|
274
|
+
// those will each need a separate `dest` through Babel's environment-specific configuration.
|
|
275
|
+
[
|
|
276
|
+
'@compiled/babel-plugin-strip-runtime',
|
|
277
|
+
{
|
|
278
|
+
sortShorthand: true,
|
|
279
|
+
extractStylesToDirectory: { source: 'src', dest: 'dist' }
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
],
|
|
283
|
+
};
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
For full documentation, refer to https://compiledcssinjs.com/docs/installation#babel
|
|
287
|
+
|
|
288
|
+
### Bundling with Webpack
|
|
289
|
+
|
|
290
|
+
This configuration may vary, this is the default production-like configuration expected where the
|
|
291
|
+
primary suggestion is to use extracted styles for performance and consistency reasons. Development
|
|
292
|
+
configuration may vary.
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
yarn install @atlaskit/tokens
|
|
296
|
+
yarn install --dev @compiled/webpack-loader mini-css-extract-plugin
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
```js
|
|
300
|
+
const { CompiledExtractPlugin } = require('@compiled/webpack-loader');
|
|
301
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
302
|
+
|
|
303
|
+
module.exports = {
|
|
304
|
+
module: {
|
|
305
|
+
rules: [
|
|
306
|
+
{
|
|
307
|
+
test: /\.(js|jsx|ts|tsx)$/,
|
|
308
|
+
use: [
|
|
309
|
+
{ loader: 'babel-loader' },
|
|
310
|
+
{
|
|
311
|
+
// ↓↓ Compiled should run last ↓↓
|
|
312
|
+
loader: '@compiled/webpack-loader',
|
|
313
|
+
options: {
|
|
314
|
+
transformerBabelPlugins: ['@atlaskit/tokens/babel-plugin'],
|
|
315
|
+
extract: true,
|
|
316
|
+
inlineCss: true,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
test: /compiled-css\.css$/i,
|
|
323
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
test: /(?<!compiled-css)(?<!\.compiled)\.css$/,
|
|
327
|
+
use: ['style-loader', 'css-loader'],
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
plugins: [
|
|
332
|
+
new MiniCssExtractPlugin(),
|
|
333
|
+
new CompiledExtractPlugin({ sortShorthand: true }),
|
|
334
|
+
],
|
|
335
|
+
};
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
For full documentation, refer to https://compiledcssinjs.com/docs/installation#webpack
|
|
339
|
+
|
|
340
|
+
### Bundling with Parcel
|
|
341
|
+
|
|
342
|
+
```sh
|
|
343
|
+
yarn install @atlaskit/tokens
|
|
344
|
+
yarn install --dev @compiled/parcel-config
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Setup your `.compiledcssrc`:
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"transformerBabelPlugins": [["@atlaskit/tokens/babel-plugin"]],
|
|
352
|
+
"extract": true,
|
|
353
|
+
"inlineCss": true,
|
|
354
|
+
"sortShorthand": true
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Setup your `.parcelrc`:
|
|
359
|
+
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"extends": ["@parcel/config-default", "@compiled/parcel-config"]
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
For full documentation, refer to https://compiledcssinjs.com/docs/installation#(recommended)-parcel
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Migration to `@atlaskit/css`
|
|
6
|
+
|
|
7
|
+
`@atlaskit/css` is the replacement for `@atlaskit/primitives/xcss` which will only work with the
|
|
8
|
+
Compiled variants of packages, eg. `@atlaskit/primitives/compiled` (note that not all packages will
|
|
9
|
+
be migrated to Compiled by the end of 2024).
|
|
10
|
+
|
|
11
|
+
Typically, this migration means moving from the `const styles = xcss({ padding: 'space.100' })` API
|
|
12
|
+
to a `const styles = cssMap({ root: { padding: token('space.100') } })` API, and we have a codemod
|
|
13
|
+
to assist with a majority of this migration for you. Some things are not available in the Compiled
|
|
14
|
+
API such as dynamic styles or imports, please use the
|
|
15
|
+
[UI Styling Standard ESLint Plugin](/components/eslint-plugin-ui-styling-standard/) to guide you.
|
|
16
|
+
|
|
17
|
+
Refer to [Configuration required](/components/css/examples#configuration-required) for details on
|
|
18
|
+
how to configure your project to use `@atlaskit/css`
|
|
19
|
+
|
|
20
|
+
## Codemod
|
|
21
|
+
|
|
22
|
+
We have a codemod to assist in migrations from `xcss()` to `@atlaskit/css`.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx @atlaskit/codemod-cli --packages @atlaskit/css@0.5.2-primitives-emotion-to-compiled --parser tsx --extensions ts,tsx,js ./path/to/folder
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The codemod should migrate something like this:
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
/**
|
|
32
|
+
* @jsxRuntime classic
|
|
33
|
+
* @jsx jsx
|
|
34
|
+
*/
|
|
35
|
+
-import { Box, xcss } from '@atlaskit/primitives';
|
|
36
|
+
+import { cssMap, jsx } from '@atlaskit/css';
|
|
37
|
+
+import { Box } from '@atlaskit/primitives/compiled';
|
|
38
|
+
+import { token } from '@atlaskit/tokens';
|
|
39
|
+
|
|
40
|
+
-const styles = xcss({
|
|
41
|
+
- color: 'color.text',
|
|
42
|
+
- zIndex: 'layer',
|
|
43
|
+
- backgroundColor: 'elevation.surface.hovered',
|
|
44
|
+
+const styles = cssMap({
|
|
45
|
+
+ root: {
|
|
46
|
+
+ color: token('color.text'),
|
|
47
|
+
+ zIndex: 400,
|
|
48
|
+
+ backgroundColor: token('elevation.surface.hovered'),
|
|
49
|
+
+ },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
-export const MyComponent = () => <Box xcss={styles} />;
|
|
53
|
+
+export const MyComponent = () => <Box xcss={styles.root} />;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Please note there may be very minute differences in this migration if you do not have theming
|
|
57
|
+
enabled as `@atlaskit/primitives` and the Compiled variant of `@atlaskit/primitives/compiled` have
|
|
58
|
+
different fallback colors. They are unchanged with theming applied, this will only happen if you're
|
|
59
|
+
in an unthemed environment (which is not suggested).
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.32.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.cx = exports.cssMap = exports.css = void 0;
|
|
9
|
+
Object.defineProperty(exports, "jsx", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _react2.jsx;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
9
15
|
var React = _interopRequireWildcard(require("react"));
|
|
10
16
|
var _runtime = require("@compiled/react/runtime");
|
|
11
17
|
var _react2 = require("@compiled/react");
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.32.1 */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import { createStrictAPI } from '@compiled/react';
|
|
5
|
+
export { jsx } from '@compiled/react';
|
|
5
6
|
const {
|
|
6
7
|
XCSSProp,
|
|
7
8
|
css,
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.32.1 */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import { createStrictAPI } from '@compiled/react';
|
|
5
|
+
export { jsx } from '@compiled/react';
|
|
5
6
|
var _createStrictAPI = createStrictAPI(),
|
|
6
7
|
XCSSProp = _createStrictAPI.XCSSProp,
|
|
7
8
|
css = _createStrictAPI.css,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CSSPseudos, type StrictCSSProperties, type XCSSAllProperties, type XCSSAllPseudos } from '@compiled/react';
|
|
2
|
+
export { jsx } from '@compiled/react';
|
|
2
3
|
import { type DesignTokenStyles } from '@atlaskit/tokens/css-type-schema';
|
|
3
4
|
type MediaQuery = '(min-width: 30rem)' | '(min-width: 48rem)' | '(min-width: 64rem)' | '(min-width: 90rem)' | '(min-width: 110.5rem)' | 'not all and (min-width: 30rem)' | 'not all and (min-width: 48rem)' | 'not all and (min-width: 64rem)' | 'not all and (min-width: 90rem)' | 'not all and (min-width: 110.5rem)' | '(min-width: 0rem) and (max-width: 29.99rem)' | '(min-width: 30rem) and (max-width: 47.99rem)' | '(min-width: 48rem) and (max-width: 63.99rem)' | '(min-width: 64rem) and (max-width: 89.99rem)' | '(min-width: 90rem) and (max-width: 110.49rem)' | '(prefers-reduced-motion: reduce)' | 'screen and (forced-colors: active), screen and (-ms-high-contrast: active)';
|
|
4
5
|
declare const XCSSProp: <TAllowedProperties extends "flex" | "grid" | "fill" | "stroke" | "all" | "bottom" | "left" | "right" | "top" | "clip" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimeline" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "colorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "containerName" | "containerType" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "filter" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontPalette" | "fontSize" | "fontSizeAdjust" | "fontSmooth" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantEmoji" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "height" | "hyphenateCharacter" | "hyphenateLimitChars" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "letterSpacing" | "lineBreak" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "motionDistance" | "motionPath" | "motionRotation" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "offsetRotation" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflowAnchor" | "overflowBlock" | "overflowClipBox" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "page" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "printColorAdjust" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollBehavior" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapMarginBottom" | "scrollSnapMarginLeft" | "scrollSnapMarginRight" | "scrollSnapMarginTop" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "viewTransitionName" | "visibility" | "whiteSpace" | "widows" | "width" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex" | "zoom" | "animation" | "background" | "backgroundPosition" | "border" | "borderBlock" | "borderBlockEnd" | "borderBlockStart" | "borderBottom" | "borderColor" | "borderImage" | "borderInline" | "borderInlineEnd" | "borderInlineStart" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "caret" | "columnRule" | "columns" | "containIntrinsicSize" | "container" | "flexFlow" | "font" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate" | "inset" | "insetBlock" | "insetInline" | "lineClamp" | "listStyle" | "margin" | "marginBlock" | "marginInline" | "mask" | "maskBorder" | "motion" | "offset" | "outline" | "overflow" | "overscrollBehavior" | "padding" | "paddingBlock" | "paddingInline" | "placeContent" | "placeItems" | "placeSelf" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginInline" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingInline" | "scrollSnapMargin" | "scrollTimeline" | "textDecoration" | "textEmphasis" | "transition" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect", TAllowedPseudos extends CSSPseudos, TRequiredProperties extends {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CSSPseudos, type StrictCSSProperties, type XCSSAllProperties, type XCSSAllPseudos } from '@compiled/react';
|
|
2
|
+
export { jsx } from '@compiled/react';
|
|
2
3
|
import { type DesignTokenStyles } from '@atlaskit/tokens/css-type-schema';
|
|
3
4
|
type MediaQuery = '(min-width: 30rem)' | '(min-width: 48rem)' | '(min-width: 64rem)' | '(min-width: 90rem)' | '(min-width: 110.5rem)' | 'not all and (min-width: 30rem)' | 'not all and (min-width: 48rem)' | 'not all and (min-width: 64rem)' | 'not all and (min-width: 90rem)' | 'not all and (min-width: 110.5rem)' | '(min-width: 0rem) and (max-width: 29.99rem)' | '(min-width: 30rem) and (max-width: 47.99rem)' | '(min-width: 48rem) and (max-width: 63.99rem)' | '(min-width: 64rem) and (max-width: 89.99rem)' | '(min-width: 90rem) and (max-width: 110.49rem)' | '(prefers-reduced-motion: reduce)' | 'screen and (forced-colors: active), screen and (-ms-high-contrast: active)';
|
|
4
5
|
declare const XCSSProp: <TAllowedProperties extends "flex" | "grid" | "fill" | "stroke" | "all" | "bottom" | "left" | "right" | "top" | "clip" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimeline" | "animationTimingFunction" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "color" | "colorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "containerName" | "containerType" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "filter" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontPalette" | "fontSize" | "fontSizeAdjust" | "fontSmooth" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantEmoji" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "height" | "hyphenateCharacter" | "hyphenateLimitChars" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "letterSpacing" | "lineBreak" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "motionDistance" | "motionPath" | "motionRotation" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "offsetRotation" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflowAnchor" | "overflowBlock" | "overflowClipBox" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "page" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "printColorAdjust" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollBehavior" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapMarginBottom" | "scrollSnapMarginLeft" | "scrollSnapMarginRight" | "scrollSnapMarginTop" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "viewTransitionName" | "visibility" | "whiteSpace" | "widows" | "width" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex" | "zoom" | "animation" | "background" | "backgroundPosition" | "border" | "borderBlock" | "borderBlockEnd" | "borderBlockStart" | "borderBottom" | "borderColor" | "borderImage" | "borderInline" | "borderInlineEnd" | "borderInlineStart" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "caret" | "columnRule" | "columns" | "containIntrinsicSize" | "container" | "flexFlow" | "font" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "gridTemplate" | "inset" | "insetBlock" | "insetInline" | "lineClamp" | "listStyle" | "margin" | "marginBlock" | "marginInline" | "mask" | "maskBorder" | "motion" | "offset" | "outline" | "overflow" | "overscrollBehavior" | "padding" | "paddingBlock" | "paddingInline" | "placeContent" | "placeItems" | "placeSelf" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginInline" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingInline" | "scrollSnapMargin" | "scrollTimeline" | "textDecoration" | "textEmphasis" | "transition" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "marker" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect", TAllowedPseudos extends CSSPseudos, TRequiredProperties extends {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"runReact18": true,
|
|
13
13
|
"website": {
|
|
14
14
|
"name": "CSS",
|
|
15
|
-
"category": "
|
|
15
|
+
"category": "Libraries",
|
|
16
|
+
"ignorePropTypes": true,
|
|
17
|
+
"status": {
|
|
18
|
+
"type": "alpha"
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
"dependencies": {
|
|
37
41
|
"@atlaskit/tokens": "^2.0.0",
|
|
38
42
|
"@babel/runtime": "^7.0.0",
|
|
39
|
-
"@compiled/react": "^0.
|
|
43
|
+
"@compiled/react": "^0.18.1"
|
|
40
44
|
},
|
|
41
45
|
"peerDependencies": {
|
|
42
46
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
"devDependencies": {
|
|
45
49
|
"@af/integration-testing": "*",
|
|
46
50
|
"@af/visual-regression": "*",
|
|
47
|
-
"@atlaskit/ds-lib": "^3.
|
|
51
|
+
"@atlaskit/ds-lib": "^3.1.0",
|
|
48
52
|
"@atlaskit/ssr": "*",
|
|
49
53
|
"@atlaskit/visual-regression": "*",
|
|
50
54
|
"@emotion/react": "^11.7.1",
|
|
@@ -91,5 +95,5 @@
|
|
|
91
95
|
]
|
|
92
96
|
}
|
|
93
97
|
},
|
|
94
|
-
"homepage": "https://
|
|
98
|
+
"homepage": "https://atlassian.design/components/css"
|
|
95
99
|
}
|
|
File without changes
|