A familiar and performant compile time CSS-in-JS library for React.
APACHE-2.0 License
Bot releases are visible (Hide)
Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
52ea5aba: Fix xcss being incompatible with codebases that use Emotion and Compiled:
processXcss
option to @compiled/babel-plugin
. If processXcss
is set to false, xcss
usages will be ignored, and will not be processed as Compiled. (Note that xcss
is currently implemented in Atlassian Design System using Emotion.) Defaults to true
.css
usages in a file will no longer be processed as Compiled if xcss
is used in the same file, so long as there is not a @compiled/react
import specified in that file.Published by atlas-dst-bot 11 months ago
2d1a5e76: Add two more configuration options to the no-css-prop-without-css-function
rule:
ignoreIfImported
accepts an array of library names. If specified, rule execution will be skipped for all files that import any of the specified libraries (e.g. @emotion/react
). By default, this is an empty array.excludeReactComponents
is a boolean that determines whether this rule should skip all React components (as opposed to plain HTML elements). False by default.Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
@compiled/babel-plugin-strip-runtime
: Fix css
function calls not being extracted when using classic JSX pragma syntax and @babel/preset-react
is turned on. Now, when the classic JSX pragma syntax is used for Compiled and @babel/preset-react
is turned on (assuming @babel/preset-react
runs before @compiled/babel-plugin-strip-runtime
), the JSX pragma and the jsx
import will be completely removed in the output.
@compiled/eslint-plugin
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsx@compiled/utils
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsxPublished by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
@compiled/babel-plugin-strip-runtime
: Fix css
function calls not being extracted when using classic JSX pragma syntax and @babel/preset-react
is turned on. Now, when the classic JSX pragma syntax is used for Compiled and @babel/preset-react
is turned on (assuming @babel/preset-react
runs before @compiled/babel-plugin-strip-runtime
), the JSX pragma and the jsx
import will be completely removed in the output.
@compiled/eslint-plugin
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsx@compiled/utils
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsxPublished by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
Published by atlas-dst-bot 11 months ago
@compiled/babel-plugin-strip-runtime
: Fix css
function calls not being extracted when using classic JSX pragma syntax and @babel/preset-react
is turned on. Now, when the classic JSX pragma syntax is used for Compiled and @babel/preset-react
is turned on (assuming @babel/preset-react
runs before @compiled/babel-plugin-strip-runtime
), the JSX pragma and the jsx
import will be completely removed in the output.
@compiled/eslint-plugin
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsx@compiled/utils
: Change regex in jsx-pragma
rule to match @babel/plugin-transform-react-jsxPublished by atlas-dst-bot 12 months ago
Published by atlas-dst-bot 12 months ago
be019f11: Add detectConflictWithOtherLibraries and onlyRunIfImportingCompiled config options to jsx-pragma ESLint rule. Both are set to true by default, hence the breaking change.
detectConflictWithOtherLibraries
raises a linting error if css
or jsx
is imported from @emotion/react
(or @emotion/core
) in the same file
as a Compiled import. Set to true by default.
onlyRunIfImportingCompiled
sets this rule to only suggest adding the JSX pragma if the css
or cssMap
functions are imported from @compiled/react
, as opposed to whenever the css
attribute is detected at all. Set to false by default.
Published by atlas-dst-bot 12 months ago
be019f11: Add detectConflictWithOtherLibraries and onlyRunIfImportingCompiled config options to jsx-pragma ESLint rule. Both are set to true by default, hence the breaking change.
detectConflictWithOtherLibraries
raises a linting error if css
or jsx
is imported from @emotion/react
(or @emotion/core
) in the same file
as a Compiled import. Set to true by default.
onlyRunIfImportingCompiled
sets this rule to only suggest adding the JSX pragma if the css
or cssMap
functions are imported from @compiled/react
, as opposed to whenever the css
attribute is detected at all. Set to false by default.
Published by atlas-dst-bot 12 months ago
be019f11: Add detectConflictWithOtherLibraries and onlyRunIfImportingCompiled config options to jsx-pragma ESLint rule. Both are set to true by default, hence the breaking change.
detectConflictWithOtherLibraries
raises a linting error if css
or jsx
is imported from @emotion/react
(or @emotion/core
) in the same file
as a Compiled import. Set to true by default.
onlyRunIfImportingCompiled
sets this rule to only suggest adding the JSX pragma if the css
or cssMap
functions are imported from @compiled/react
, as opposed to whenever the css
attribute is detected at all. Set to false by default.
Published by atlas-dst-bot 12 months ago
4caa6784: The xcss prop is now available.
Declare styles your component takes with all other styles marked as violations
by the TypeScript compiler. There are two primary use cases for xcss prop:
Interverting style declarations is interesting for platform teams as
it means products only pay for styles they use as they're now the ones who declare
the styles!
The XCSSProp
type has generics which must be defined — of which should be what you
explicitly want to maintain as API. Use XCSSAllProperties
and XCSSAllPseudos
types
to enable all properties and pseudos.
import { type XCSSProp } from '@compiled/react';
interface MyComponentProps {
// Color is accepted, all other properties / pseudos are considered violations.
xcss?: XCSSProp<'color', never>;
// Only backgrond color and hover pseudo is accepted.
xcss?: XCSSProp<'backgroundColor', '&:hover'>;
// All properties are accepted, all pseudos are considered violations.
xcss?: XCSSProp<XCSSAllProperties, never>;
// All properties are accepted, only the hover pseudo is accepted.
xcss?: XCSSProp<XCSSAllProperties, '&:hover'>;
}
function MyComponent({ xcss }: MyComponentProps) {
return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />;
}
The xcss prop works with static inline objects and the cssMap API.
// Declared as an inline object
<Component xcss={{ color: 'var(--ds-text)' }} />;
// Declared with the cssMap API
const styles = cssMap({ text: { color: 'var(--ds-text)' } });
<Component xcss={styles.text} />;
To concatenate and conditonally apply styles use the cssMap
and cx
functions.
dccb71e0: Adds third generic for XCSSProp type for declaring what properties and pseudos should be required.
Published by atlas-dst-bot 12 months ago
no-suppress-xcss
.className
prop on host elements an output of xcss prop.local-cx-xcss
.no-js-xcss
.Published by atlas-dst-bot 12 months ago
4caa6784: The xcss prop is now available.
Declare styles your component takes with all other styles marked as violations
by the TypeScript compiler. There are two primary use cases for xcss prop:
Interverting style declarations is interesting for platform teams as
it means products only pay for styles they use as they're now the ones who declare
the styles!
The XCSSProp
type has generics which must be defined — of which should be what you
explicitly want to maintain as API. Use XCSSAllProperties
and XCSSAllPseudos
types
to enable all properties and pseudos.
import { type XCSSProp } from '@compiled/react';
interface MyComponentProps {
// Color is accepted, all other properties / pseudos are considered violations.
xcss?: XCSSProp<'color', never>;
// Only backgrond color and hover pseudo is accepted.
xcss?: XCSSProp<'backgroundColor', '&:hover'>;
// All properties are accepted, all pseudos are considered violations.
xcss?: XCSSProp<XCSSAllProperties, never>;
// All properties are accepted, only the hover pseudo is accepted.
xcss?: XCSSProp<XCSSAllProperties, '&:hover'>;
}
function MyComponent({ xcss }: MyComponentProps) {
return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />;
}
The xcss prop works with static inline objects and the cssMap API.
// Declared as an inline object
<Component xcss={{ color: 'var(--ds-text)' }} />;
// Declared with the cssMap API
const styles = cssMap({ text: { color: 'var(--ds-text)' } });
<Component xcss={styles.text} />;
To concatenate and conditonally apply styles use the cssMap
and cx
functions.
dccb71e0: Adds third generic for XCSSProp type for declaring what properties and pseudos should be required.