classname-variants 1.1.0 → 1.1.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/example.tsx +10 -4
- package/lib/react.d.ts +2 -6
- package/package.json +1 -1
- package/src/react.ts +2 -2
package/example.tsx
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import { styled } from "./src/react";
|
|
4
4
|
|
|
5
|
-
function CustomComponent(
|
|
6
|
-
|
|
5
|
+
function CustomComponent({
|
|
6
|
+
title,
|
|
7
|
+
...props
|
|
8
|
+
}: {
|
|
9
|
+
className?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}) {
|
|
12
|
+
return <div {...props}>{title}</div>;
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
const Card = styled(CustomComponent, {
|
|
@@ -48,7 +54,7 @@ function App() {
|
|
|
48
54
|
<Button color="accent" disabled>
|
|
49
55
|
Disabled
|
|
50
56
|
</Button>
|
|
51
|
-
<Card />
|
|
57
|
+
<Card title="Hello" />
|
|
52
58
|
</div>
|
|
53
59
|
);
|
|
54
60
|
}
|
package/lib/react.d.ts
CHANGED
|
@@ -13,10 +13,6 @@ declare type VariantProps<C extends VariantsConfig<V>, V extends Variants = C["v
|
|
|
13
13
|
export declare function variantProps<C extends VariantsConfig<V>, V extends Variants = C["variants"]>(config: Simplify<C>): <P extends VariantProps<C, C["variants"]>>(props: P) => {
|
|
14
14
|
className: string;
|
|
15
15
|
} & Omit<P, keyof C["variants"]>;
|
|
16
|
-
declare type StyledComponent<T extends ElementType<
|
|
17
|
-
|
|
18
|
-
}>, C extends VariantsConfig<V>, V extends Variants = C["variants"]> = ForwardRefExoticComponent<PropsWithoutRef<ComponentProps<T> & VariantOptions<C>> & React.RefAttributes<T>>;
|
|
19
|
-
export declare function styled<T extends ElementType<{
|
|
20
|
-
className: string;
|
|
21
|
-
}>, C extends VariantsConfig<V>, V extends Variants = C["variants"]>(type: T, config: Simplify<C>): StyledComponent<T, C>;
|
|
16
|
+
declare type StyledComponent<T extends ElementType, C extends VariantsConfig<V>, V extends Variants = C["variants"]> = ForwardRefExoticComponent<PropsWithoutRef<ComponentProps<T> & VariantOptions<C>> & React.RefAttributes<T>>;
|
|
17
|
+
export declare function styled<T extends ElementType, C extends VariantsConfig<V>, V extends Variants = C["variants"]>(type: T, config: Simplify<C>): StyledComponent<T, C>;
|
|
22
18
|
export {};
|
package/package.json
CHANGED
package/src/react.ts
CHANGED
|
@@ -53,7 +53,7 @@ export function variantProps<
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
type StyledComponent<
|
|
56
|
-
T extends ElementType
|
|
56
|
+
T extends ElementType,
|
|
57
57
|
C extends VariantsConfig<V>,
|
|
58
58
|
V extends Variants = C["variants"]
|
|
59
59
|
> = ForwardRefExoticComponent<
|
|
@@ -62,7 +62,7 @@ type StyledComponent<
|
|
|
62
62
|
>;
|
|
63
63
|
|
|
64
64
|
export function styled<
|
|
65
|
-
T extends ElementType
|
|
65
|
+
T extends ElementType,
|
|
66
66
|
C extends VariantsConfig<V>,
|
|
67
67
|
V extends Variants = C["variants"]
|
|
68
68
|
>(type: T, config: Simplify<C>): StyledComponent<T, C> {
|