@atlaskit/css 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/codemods/{primitives-emotion-to-compiled/0.5.2-primitives-emotion-to-compiled.tsx → 0.5.2-primitives-emotion-to-compiled/index.tsx} +139 -85
- package/codemods/{primitives-emotion-to-compiled → 0.5.2-primitives-emotion-to-compiled}/style-maps.partial.tsx +7 -6
- package/constellation/index/examples.mdx +236 -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 +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/css
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#160054](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160054)
|
|
8
|
+
[`a85c8b06aad62`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a85c8b06aad62) -
|
|
9
|
+
Updates to the 0.5.2-primitives-emotion-to-compiled codemod to group imports from
|
|
10
|
+
@atlaskit/primitives.
|
|
11
|
+
|
|
12
|
+
## 0.6.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#154669](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154669)
|
|
17
|
+
[`20db78434becd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/20db78434becd) -
|
|
18
|
+
Bump to the latest version of @compiled/\*
|
|
19
|
+
- [#154669](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154669)
|
|
20
|
+
[`20db78434becd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/20db78434becd) -
|
|
21
|
+
Adds the `jsx` export to allow `@atlaskit/css` to be used for the JSX Pragma within the Compiled
|
|
22
|
+
ecosystem.
|
|
23
|
+
|
|
3
24
|
## 0.5.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -56,28 +56,33 @@ export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API,
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
addJsxPragma(j, base);
|
|
60
|
-
|
|
61
59
|
replaceXcssWithCssMap(j, base, xcssSpecifier);
|
|
62
60
|
|
|
63
61
|
updateImports(j, base);
|
|
64
62
|
|
|
63
|
+
addJsxPragma(j, base);
|
|
64
|
+
|
|
65
65
|
return base.toSource();
|
|
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
|
) {
|
|
@@ -213,96 +221,142 @@ function ensureSelectorAmpersand(j: core.JSCodeshift, objectExpression: core.Obj
|
|
|
213
221
|
}
|
|
214
222
|
|
|
215
223
|
function updateImports(j: core.JSCodeshift, source: ReturnType<typeof j>) {
|
|
216
|
-
// remove xcss import
|
|
224
|
+
// remove xcss import and collect primitives to import
|
|
225
|
+
const primitivesToImport = new Set<string>();
|
|
217
226
|
source
|
|
218
227
|
.find(j.ImportDeclaration)
|
|
219
|
-
.filter((path: ASTPath<ImportDeclaration>) =>
|
|
228
|
+
.filter((path: ASTPath<ImportDeclaration>) => {
|
|
229
|
+
const importSource = path.node.source.value as string;
|
|
230
|
+
return (
|
|
231
|
+
importSource === '@atlaskit/primitives' || importSource.startsWith('@atlaskit/primitives/')
|
|
232
|
+
);
|
|
233
|
+
})
|
|
220
234
|
.forEach((path) => {
|
|
221
235
|
if (path.node.specifiers) {
|
|
222
|
-
path.node.specifiers
|
|
223
|
-
(specifier
|
|
224
|
-
|
|
236
|
+
path.node.specifiers.forEach((specifier) => {
|
|
237
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported) {
|
|
238
|
+
const importedName = specifier.imported.name;
|
|
239
|
+
if (importedName !== 'xcss') {
|
|
240
|
+
primitivesToImport.add(importedName);
|
|
241
|
+
}
|
|
242
|
+
} else if (specifier.type === 'ImportDefaultSpecifier') {
|
|
243
|
+
// handle deep imports like `import Anchor from '@atlaskit/primitives/anchor'`
|
|
244
|
+
if (specifier.local) {
|
|
245
|
+
primitivesToImport.add(specifier.local.name);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
225
249
|
}
|
|
250
|
+
// remove the import declaration
|
|
251
|
+
j(path).remove();
|
|
226
252
|
});
|
|
227
253
|
|
|
228
|
-
const
|
|
254
|
+
const importsNeeded = {
|
|
255
|
+
cssMap: false,
|
|
256
|
+
jsx: false,
|
|
257
|
+
token: false,
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// check existing imports
|
|
261
|
+
source.find(j.ImportDeclaration).forEach((path) => {
|
|
262
|
+
const importSource = path.node.source.value as string;
|
|
263
|
+
switch (importSource) {
|
|
264
|
+
case '@atlaskit/css':
|
|
265
|
+
path.node.specifiers?.forEach((specifier) => {
|
|
266
|
+
if (specifier.local?.name === 'cssMap') {
|
|
267
|
+
importsNeeded.cssMap = true;
|
|
268
|
+
}
|
|
269
|
+
if (specifier.local?.name === 'jsx') {
|
|
270
|
+
importsNeeded.jsx = true;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
break;
|
|
274
|
+
case '@atlaskit/tokens':
|
|
275
|
+
importsNeeded.token = true;
|
|
276
|
+
break;
|
|
277
|
+
case '@emotion/react':
|
|
278
|
+
// remove the jsx import from @emotion/react
|
|
279
|
+
path.node.specifiers = path.node.specifiers?.filter(
|
|
280
|
+
(specifier) => !(j.ImportSpecifier.check(specifier) && specifier.imported.name === 'jsx'),
|
|
281
|
+
);
|
|
282
|
+
if (path.node.specifiers?.length === 0) {
|
|
283
|
+
j(path).remove();
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case 'react':
|
|
287
|
+
// remove default import React from 'react' if not needed
|
|
288
|
+
path.node.specifiers = path.node.specifiers?.filter(
|
|
289
|
+
(specifier) =>
|
|
290
|
+
!(specifier.type === 'ImportDefaultSpecifier' && specifier.local?.name === 'React'),
|
|
291
|
+
);
|
|
292
|
+
if (path.node.specifiers?.length === 0) {
|
|
293
|
+
j(path).remove();
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
const newImports: ImportDeclaration[] = [];
|
|
229
300
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
301
|
+
// add grouped import for primitives
|
|
302
|
+
// e.g. import { Anchor, Box } from '@atlaskit/primitives/compiled';
|
|
303
|
+
if (primitivesToImport.size > 0) {
|
|
304
|
+
const primitivesImport = j.importDeclaration(
|
|
305
|
+
Array.from(primitivesToImport)
|
|
306
|
+
.sort()
|
|
307
|
+
.map((name) => j.importSpecifier(j.identifier(name))),
|
|
308
|
+
j.literal('@atlaskit/primitives/compiled'),
|
|
237
309
|
);
|
|
238
|
-
|
|
310
|
+
newImports.push(primitivesImport);
|
|
239
311
|
}
|
|
240
312
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
[j.importSpecifier(j.identifier('token'))],
|
|
247
|
-
j.literal('@atlaskit/tokens'),
|
|
248
|
-
);
|
|
249
|
-
source.get().node.program.body.unshift(tokenImport);
|
|
250
|
-
}
|
|
313
|
+
// add cssMap and jsx import if needed
|
|
314
|
+
if (!importsNeeded.cssMap || !importsNeeded.jsx) {
|
|
315
|
+
const existingCssImports = source
|
|
316
|
+
.find(j.ImportDeclaration)
|
|
317
|
+
.filter((path) => path.node.source.value === '@atlaskit/css');
|
|
251
318
|
|
|
252
|
-
|
|
253
|
-
// e.g. import { Box } from '@atlaskit/primitives' -> import { Box } from '@atlaskit/primitives/compiled'
|
|
254
|
-
source
|
|
255
|
-
.find(j.ImportDeclaration)
|
|
256
|
-
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === '@atlaskit/primitives')
|
|
257
|
-
.forEach((path) => {
|
|
258
|
-
path.node.source.value = '@atlaskit/primitives/compiled';
|
|
259
|
-
});
|
|
319
|
+
const newSpecifiers: core.ImportSpecifier[] = [];
|
|
260
320
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === '@emotion/react')
|
|
268
|
-
.find(j.ImportSpecifier)
|
|
269
|
-
.filter((path) => path.node.imported.name === 'jsx');
|
|
321
|
+
if (!importsNeeded.cssMap) {
|
|
322
|
+
newSpecifiers.push(j.importSpecifier(j.identifier('cssMap')));
|
|
323
|
+
}
|
|
324
|
+
if (!importsNeeded.jsx) {
|
|
325
|
+
newSpecifiers.push(j.importSpecifier(j.identifier('jsx')));
|
|
326
|
+
}
|
|
270
327
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
);
|
|
328
|
+
if (existingCssImports.size() > 0) {
|
|
329
|
+
// existing import from '@atlaskit/css'
|
|
330
|
+
const existingCssImport = existingCssImports.at(0).get();
|
|
275
331
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
332
|
+
if (existingCssImport && existingCssImport.node.specifiers) {
|
|
333
|
+
existingCssImport.node.specifiers.push(...newSpecifiers);
|
|
334
|
+
}
|
|
279
335
|
} else {
|
|
280
|
-
|
|
281
|
-
|
|
336
|
+
const cssMapImport = j.importDeclaration(newSpecifiers, j.literal('@atlaskit/css'));
|
|
337
|
+
newImports.push(cssMapImport);
|
|
282
338
|
}
|
|
283
339
|
}
|
|
284
340
|
|
|
285
|
-
//
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
b.source.value === null
|
|
294
|
-
) {
|
|
295
|
-
return 0;
|
|
296
|
-
}
|
|
341
|
+
// add token import
|
|
342
|
+
if (!importsNeeded.token) {
|
|
343
|
+
const tokenImport = j.importDeclaration(
|
|
344
|
+
[j.importSpecifier(j.identifier('token'))],
|
|
345
|
+
j.literal('@atlaskit/tokens'),
|
|
346
|
+
);
|
|
347
|
+
newImports.push(tokenImport);
|
|
348
|
+
}
|
|
297
349
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
.
|
|
304
|
-
|
|
305
|
-
|
|
350
|
+
// add new imports after any existing comments
|
|
351
|
+
const rootNode = source.get().node;
|
|
352
|
+
const firstNonCommentIndex = rootNode.program.body.findIndex(
|
|
353
|
+
(node: core.Node) =>
|
|
354
|
+
node.type !== 'ImportDeclaration' &&
|
|
355
|
+
node.type !== 'CommentBlock' &&
|
|
356
|
+
node.type !== 'CommentLine',
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
rootNode.program.body.splice(firstNonCommentIndex, 0, ...newImports);
|
|
306
360
|
}
|
|
307
361
|
|
|
308
362
|
// look for xcss import
|
|
@@ -846,14 +846,15 @@ export type Fill = keyof typeof fillMap;
|
|
|
846
846
|
|
|
847
847
|
/**
|
|
848
848
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
849
|
-
* @codegen <<SignedSource::
|
|
849
|
+
* @codegen <<SignedSource::042cbfe8041c09e3817ae74154994f32>>
|
|
850
850
|
* @codegenId misc
|
|
851
851
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
852
852
|
* @codegenParams ["layer"]
|
|
853
853
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
854
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
854
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
855
855
|
*/
|
|
856
856
|
export const layerMap = {
|
|
857
|
+
'1': 1,
|
|
857
858
|
card: 100,
|
|
858
859
|
navigation: 200,
|
|
859
860
|
dialog: 300,
|
|
@@ -906,12 +907,12 @@ export type BorderRadius = keyof typeof borderRadiusMap;
|
|
|
906
907
|
|
|
907
908
|
/**
|
|
908
909
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
909
|
-
* @codegen <<SignedSource::
|
|
910
|
+
* @codegen <<SignedSource::96d9a841cb440c2bd770d0af5c670f10>>
|
|
910
911
|
* @codegenId typography
|
|
911
912
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
912
913
|
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "ui"]
|
|
913
914
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
914
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
915
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
915
916
|
*/
|
|
916
917
|
export const fontMap = {
|
|
917
918
|
'font.body': token(
|
|
@@ -1006,11 +1007,11 @@ export type FontFamily = keyof typeof fontFamilyMap;
|
|
|
1006
1007
|
|
|
1007
1008
|
/**
|
|
1008
1009
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
1009
|
-
* @codegen <<SignedSource::
|
|
1010
|
+
* @codegen <<SignedSource::ae96213e36b930556f9ad18382088ff8>>
|
|
1010
1011
|
* @codegenId text
|
|
1011
1012
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
1012
1013
|
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/dimensions.tsx <<SignedSource::cc9b3f12104c6ede803da6a42daac0b0>>
|
|
1013
|
-
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::
|
|
1014
|
+
* @codegenDependency ../../../primitives/scripts/codegen-file-templates/layer.tsx <<SignedSource::92793ca02dbfdad66e53ffbe9f0baa0a>>
|
|
1014
1015
|
*/
|
|
1015
1016
|
export const textSizeMap = {
|
|
1016
1017
|
medium: token(
|
|
@@ -0,0 +1,236 @@
|
|
|
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 configuration, refer to our
|
|
25
|
+
[Get started](/get-started/develop#set-up-your-bundling-environment) guide.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
For the most part, `@atlaskit/css` should behave like `@compiled/react` or other CSS-in-JS
|
|
30
|
+
libraries' `css()` syntaxes, however we promote `cssMap` as a way to create maps of styles as that's
|
|
31
|
+
the common use-case at Atlassian.
|
|
32
|
+
|
|
33
|
+
Please note that `@atlaskit/css` is a strictly bounded variant to help promote and align the usage
|
|
34
|
+
of Design System tokens and properties, so you you cannot use arbitrary values such as
|
|
35
|
+
`color: 'rgba(123, 45, 67)', padding: 8`, and typically we only allow our
|
|
36
|
+
[tokenized values](/components/tokens/all-tokens), but a few other property restrictions or
|
|
37
|
+
limitations exist, such as `zIndex` only having a few allowed literal numeric values.
|
|
38
|
+
|
|
39
|
+
### cssMap
|
|
40
|
+
|
|
41
|
+
`cssMap` is the default function we suggest to use, it can be reused across native elements through
|
|
42
|
+
`props.css` and React components through `props.xcss` and is flexible to style maps that are known
|
|
43
|
+
ahead-of-time.
|
|
44
|
+
|
|
45
|
+
These can be reused across multiple components, even across native and non-native.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { cssMap } from '@atlaskit/css';
|
|
49
|
+
const styles = cssMap({
|
|
50
|
+
root: { display: 'inline-block' },
|
|
51
|
+
primary: {
|
|
52
|
+
backgroundColor: token('color.background.brand.bold'),
|
|
53
|
+
color: token('color.text.inverse'),
|
|
54
|
+
},
|
|
55
|
+
discovery: {
|
|
56
|
+
backgroundColor: token('color.background.discovery.bold'),
|
|
57
|
+
color: token('color.text.inverse'),
|
|
58
|
+
},
|
|
59
|
+
success: {
|
|
60
|
+
backgroundColor: token('color.background.success.bold'),
|
|
61
|
+
color: token('color.text.inverse'),
|
|
62
|
+
},
|
|
63
|
+
disabled: { opacity: 0.7, cursor: 'not-allowed' },
|
|
64
|
+
});
|
|
65
|
+
export default ({
|
|
66
|
+
appearance = 'primary',
|
|
67
|
+
isDisabled,
|
|
68
|
+
}: {
|
|
69
|
+
appearance?: 'primary' | 'discovery' | 'success';
|
|
70
|
+
isDisabled?: boolean;
|
|
71
|
+
}) => <div css={(styles.root, styles[appearance], isDisabled && styles.disabled)} />;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### cx
|
|
75
|
+
|
|
76
|
+
The `cx` function is required when combining styles inside of an `xcss` prop, but can be used
|
|
77
|
+
anywhere. This is only required because `xcss={[styles.root, styles.bordered]}` results in incorrect
|
|
78
|
+
typing while with a function it is preserved.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<div css={[styles.root, styles.bordered]} />
|
|
82
|
+
<div css={cx(styles.root, styles.bordered)} />
|
|
83
|
+
<Box xcss={cx(styles.root, styles.bordered)} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Typical example
|
|
87
|
+
|
|
88
|
+
You must have a JSX pragma in scope in order to use this, depending on your setup this may be
|
|
89
|
+
automatic, require `React` imported, or require `jsx` imported.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
/**
|
|
93
|
+
* @jsxRuntime classic
|
|
94
|
+
* @jsx jsx
|
|
95
|
+
*/
|
|
96
|
+
import { cssMap, cx, jsx } from '@atlaskit/css';
|
|
97
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
98
|
+
import { token } from '@atlaskit/tokens';
|
|
99
|
+
|
|
100
|
+
const styles = cssMap({
|
|
101
|
+
root: {
|
|
102
|
+
padding: token('space.100'),
|
|
103
|
+
color: token('color.text'),
|
|
104
|
+
backgroundColor: token('elevation.surface'),
|
|
105
|
+
},
|
|
106
|
+
compact: { padding: token('space.50') },
|
|
107
|
+
transparent: { backgroundColor: 'transparent' },
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export default ({
|
|
111
|
+
spacing = 'default',
|
|
112
|
+
noBackground,
|
|
113
|
+
}: {
|
|
114
|
+
spacing: 'compact' | 'default';
|
|
115
|
+
noBackground?: boolean;
|
|
116
|
+
}) => {
|
|
117
|
+
return (
|
|
118
|
+
<Box
|
|
119
|
+
xcss={cx(
|
|
120
|
+
styles.root,
|
|
121
|
+
spacing === 'compact' && styles.compact,
|
|
122
|
+
noBackground && styles.transparent,
|
|
123
|
+
)}
|
|
124
|
+
>
|
|
125
|
+
<p css={[styles.compact, styles.transparent]}>Hello world!</p>
|
|
126
|
+
</Box>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Building a reusable component with pass-through styles
|
|
132
|
+
|
|
133
|
+
With the introduction of `@atlaskit/css` (and the underlying `createStrictAPI` from Compiled), we're
|
|
134
|
+
now able to define a strictly bounded API for our components. This may be an API pattern that you
|
|
135
|
+
want to copy as well.
|
|
136
|
+
|
|
137
|
+
For example, if you want to create your own component that allows you to extend and pass-through
|
|
138
|
+
styles, you can do so:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
/**
|
|
142
|
+
* @jsxRuntime classic
|
|
143
|
+
* @jsx jsx
|
|
144
|
+
*/
|
|
145
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
146
|
+
import { token } from '@atlaskit/tokens';
|
|
147
|
+
|
|
148
|
+
const styles = cssMap({
|
|
149
|
+
button: { padding: token('space.100'), borderRadius: token('border.radius.100') },
|
|
150
|
+
dense: { padding: token('space.050'), borderRadius: token('border.radius.050') },
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export function Card({
|
|
154
|
+
children,
|
|
155
|
+
xcss,
|
|
156
|
+
dense,
|
|
157
|
+
}: {
|
|
158
|
+
children: React.ReactNode;
|
|
159
|
+
dense?: boolean;
|
|
160
|
+
/** Only `padding`, `borderRadius`, `backgroundColor`, and `color` properties and `hover` and `focus` pseudos are allowed */
|
|
161
|
+
xcss?: StrictXCSSProp<
|
|
162
|
+
'padding' | 'borderRadius' | 'backgroundColor' | 'color',
|
|
163
|
+
'&:hover' | '&:focus'
|
|
164
|
+
>;
|
|
165
|
+
}) {
|
|
166
|
+
return (
|
|
167
|
+
<div css={cx(styles.button, isDense && styles.dense)} className={xcss}>
|
|
168
|
+
{children}
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
I'm then allowed to build a component that uses this `Card` component and overrides these properties
|
|
175
|
+
as I see fit:
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
/**
|
|
179
|
+
* @jsxRuntime classic
|
|
180
|
+
* @jsx jsx
|
|
181
|
+
*/
|
|
182
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
183
|
+
import { token } from '@atlaskit/tokens';
|
|
184
|
+
import { Card } from './Card';
|
|
185
|
+
|
|
186
|
+
const styles = cssMap({
|
|
187
|
+
root: { padding: token('space.200'), borderRadius: token('border.radius.200') },
|
|
188
|
+
inverse: {
|
|
189
|
+
backgroundColor: token('color.background.discovery'),
|
|
190
|
+
color: token('color.text.inverse'),
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export const LargeCard = ({
|
|
195
|
+
children,
|
|
196
|
+
isInverse,
|
|
197
|
+
}: {
|
|
198
|
+
children: React.ReactNode;
|
|
199
|
+
isInverse?: boolean;
|
|
200
|
+
}) => {
|
|
201
|
+
return <Card xcss={cx(styles.root, isInverse && styles.inverse)}>{children}</Card>;
|
|
202
|
+
};
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
However, if you're extending a component that uses `props.xcss` under the hood, for example a
|
|
206
|
+
Primitive, the first `Card` component would look a bit different, brief example:
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
/**
|
|
210
|
+
* @jsxRuntime classic
|
|
211
|
+
* @jsx jsx
|
|
212
|
+
*/
|
|
213
|
+
import { cssMap, cx, jsx, type StrictXCSSProp } from '@atlaskit/css';
|
|
214
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
215
|
+
import { token } from '@atlaskit/tokens';
|
|
216
|
+
|
|
217
|
+
const styles = cssMap({
|
|
218
|
+
button: { padding: token('space.100'), borderRadius: token('border.radius.100') },
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
export function Card({
|
|
222
|
+
children,
|
|
223
|
+
xcss,
|
|
224
|
+
}: {
|
|
225
|
+
children: React.ReactNode;
|
|
226
|
+
xcss?: StrictXCSSProp<'padding' | 'borderRadius'>;
|
|
227
|
+
}) {
|
|
228
|
+
return <Box xcss={cx(styles.button, xcss)}>{children}</Box>;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Configuration required
|
|
233
|
+
|
|
234
|
+
In order to use any Atlassian Design System packages that distribute Compiled CSS-in-JS, you
|
|
235
|
+
**must** configure your project, please refer to our
|
|
236
|
+
[Get started](/get-started/develop#set-up-your-bundling-environment) guide.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
6
|
+
|
|
7
|
+
## Migration to `@atlaskit/css`
|
|
8
|
+
|
|
9
|
+
<SectionMessage title="Migration from Emotion to Compiled" appearance="discovery">
|
|
10
|
+
<p>
|
|
11
|
+
The Atlassian Design System is under the process of migrating from Emotion to Compiled for our
|
|
12
|
+
CSS-in-JS. Further details to come.
|
|
13
|
+
</p>
|
|
14
|
+
</SectionMessage>
|
|
15
|
+
|
|
16
|
+
We have a codemod available to support this migration, but there are some breaking changes between
|
|
17
|
+
Emotion and Compiled, such as dynamic styles or imports. Please use the
|
|
18
|
+
[UI Styling Standard ESLint Plugin](/components/eslint-plugin-ui-styling-standard/) to guide you.
|
|
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.2 */
|
|
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.2 */
|
|
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.2 */
|
|
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.1",
|
|
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": "beta"
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -34,9 +38,9 @@
|
|
|
34
38
|
".": "./src/index.tsx"
|
|
35
39
|
},
|
|
36
40
|
"dependencies": {
|
|
37
|
-
"@atlaskit/tokens": "^2.
|
|
41
|
+
"@atlaskit/tokens": "^2.2.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
|
}
|