@compiled/react 0.16.8 → 0.16.9
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.
|
@@ -41,6 +41,7 @@ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string
|
|
|
41
41
|
*/
|
|
42
42
|
css?: CssFunction<void> | CssFunction<void>[];
|
|
43
43
|
} : {} : {};
|
|
44
|
+
type ReactJSXElementType = string | React.JSXElementConstructor<any>;
|
|
44
45
|
type ReactJSXElement = JSX.Element;
|
|
45
46
|
type ReactJSXElementClass = JSX.ElementClass;
|
|
46
47
|
type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
|
|
@@ -50,6 +51,7 @@ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
|
|
|
50
51
|
type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
|
|
51
52
|
type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
|
|
52
53
|
export declare namespace CompiledJSX {
|
|
54
|
+
type ElementType = ReactJSXElementType;
|
|
53
55
|
type Element = ReactJSXElement;
|
|
54
56
|
type ElementClass = ReactJSXElementClass;
|
|
55
57
|
type ElementAttributesProperty = ReactJSXElementAttributesProperty;
|
|
@@ -41,6 +41,7 @@ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string
|
|
|
41
41
|
*/
|
|
42
42
|
css?: CssFunction<void> | CssFunction<void>[];
|
|
43
43
|
} : {} : {};
|
|
44
|
+
type ReactJSXElementType = string | React.JSXElementConstructor<any>;
|
|
44
45
|
type ReactJSXElement = JSX.Element;
|
|
45
46
|
type ReactJSXElementClass = JSX.ElementClass;
|
|
46
47
|
type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
|
|
@@ -50,6 +51,7 @@ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
|
|
|
50
51
|
type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
|
|
51
52
|
type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
|
|
52
53
|
export declare namespace CompiledJSX {
|
|
54
|
+
type ElementType = ReactJSXElementType;
|
|
53
55
|
type Element = ReactJSXElement;
|
|
54
56
|
type ElementClass = ReactJSXElementClass;
|
|
55
57
|
type ElementAttributesProperty = ReactJSXElementAttributesProperty;
|
|
@@ -41,6 +41,7 @@ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps ? string
|
|
|
41
41
|
*/
|
|
42
42
|
css?: CssFunction<void> | CssFunction<void>[];
|
|
43
43
|
} : {} : {};
|
|
44
|
+
type ReactJSXElementType = string | React.JSXElementConstructor<any>;
|
|
44
45
|
type ReactJSXElement = JSX.Element;
|
|
45
46
|
type ReactJSXElementClass = JSX.ElementClass;
|
|
46
47
|
type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
|
|
@@ -50,6 +51,7 @@ type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes;
|
|
|
50
51
|
type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
|
|
51
52
|
type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
|
|
52
53
|
export declare namespace CompiledJSX {
|
|
54
|
+
type ElementType = ReactJSXElementType;
|
|
53
55
|
type Element = ReactJSXElement;
|
|
54
56
|
type ElementClass = ReactJSXElementClass;
|
|
55
57
|
type ElementAttributesProperty = ReactJSXElementAttributesProperty;
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsxImportSource @compiled/react */
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import { css } from '@compiled/react';
|
|
4
|
+
import { css as strictCSS } from '@fixture/strict-api-test';
|
|
5
|
+
import { render } from '@testing-library/react';
|
|
6
|
+
|
|
7
|
+
describe('strict api used with top level api', () => {
|
|
8
|
+
it('should mix styles together deterministically', () => {
|
|
9
|
+
const styles = strictCSS({
|
|
10
|
+
color: 'var(--ds-text)',
|
|
11
|
+
});
|
|
12
|
+
const otherStyles = css({
|
|
13
|
+
backgroundColor: 'red',
|
|
14
|
+
color: 'blue',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const { getByTestId } = render(<div css={[styles, otherStyles]} data-testid="div" />);
|
|
18
|
+
|
|
19
|
+
expect(getByTestId('div')).not.toHaveCompiledCss('color', 'var(--ds-text)');
|
|
20
|
+
expect(getByTestId('div')).toHaveCompiledCss('color', 'blue');
|
|
21
|
+
expect(getByTestId('div')).toHaveCompiledCss('backgroundColor', 'red');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -49,6 +49,9 @@ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps
|
|
|
49
49
|
{};
|
|
50
50
|
|
|
51
51
|
// Unpack all here to avoid infinite self-referencing when defining our own JSX namespace
|
|
52
|
+
// Based on the code from @types/react@18.2.8 / @emotion-js
|
|
53
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13
|
|
54
|
+
type ReactJSXElementType = string | React.JSXElementConstructor<any>;
|
|
52
55
|
type ReactJSXElement = JSX.Element;
|
|
53
56
|
type ReactJSXElementClass = JSX.ElementClass;
|
|
54
57
|
type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty;
|
|
@@ -59,6 +62,7 @@ type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>;
|
|
|
59
62
|
type ReactJSXIntrinsicElements = JSX.IntrinsicElements;
|
|
60
63
|
|
|
61
64
|
export namespace CompiledJSX {
|
|
65
|
+
export type ElementType = ReactJSXElementType;
|
|
62
66
|
export type Element = ReactJSXElement;
|
|
63
67
|
export type ElementClass = ReactJSXElementClass;
|
|
64
68
|
export type ElementAttributesProperty = ReactJSXElementAttributesProperty;
|