tailwind-to-style 3.3.0 → 4.0.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.
Files changed (51) hide show
  1. package/README.md +208 -1118
  2. package/dist/animations/index.cjs +9391 -0
  3. package/dist/animations/index.d.ts +58 -0
  4. package/dist/animations/index.esm.js +9385 -0
  5. package/dist/animations/index.esm.js.map +1 -0
  6. package/dist/className/index.cjs +2241 -4181
  7. package/dist/className/index.esm.js +2241 -4181
  8. package/dist/className/index.esm.js.map +1 -1
  9. package/dist/core/tws.cjs +136 -114
  10. package/dist/core/tws.cjs.map +1 -0
  11. package/dist/core/tws.esm.js +136 -114
  12. package/dist/core/tws.esm.js.map +1 -1
  13. package/dist/core/twsx.cjs +1971 -3970
  14. package/dist/core/twsx.esm.js +1971 -3970
  15. package/dist/core/twsx.esm.js.map +1 -1
  16. package/dist/core/twsxVariants.cjs +1997 -3986
  17. package/dist/core/twsxVariants.esm.js +1997 -3986
  18. package/dist/core/twsxVariants.esm.js.map +1 -1
  19. package/dist/cx.cjs +2 -2
  20. package/dist/cx.cjs.map +1 -0
  21. package/dist/cx.esm.js +2 -2
  22. package/dist/index.cjs +5253 -9252
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.ts +4 -1
  25. package/dist/index.esm.js +5251 -9201
  26. package/dist/index.esm.js.map +1 -1
  27. package/dist/index.min.js +1 -1
  28. package/dist/index.min.js.map +1 -1
  29. package/dist/react/index.cjs +10177 -0
  30. package/dist/react/index.cjs.map +1 -0
  31. package/dist/react/index.d.ts +69 -0
  32. package/dist/react/index.esm.js +10173 -0
  33. package/dist/react/index.esm.js.map +1 -0
  34. package/dist/styled/index.cjs +9094 -0
  35. package/dist/styled/index.cjs.map +1 -0
  36. package/dist/styled/index.d.ts +17 -0
  37. package/dist/styled/index.esm.js +9087 -0
  38. package/dist/styled/index.esm.js.map +1 -0
  39. package/dist/tokens/index.cjs +359 -0
  40. package/dist/tokens/index.d.ts +33 -0
  41. package/dist/tokens/index.esm.js +355 -0
  42. package/dist/tokens/index.esm.js.map +1 -0
  43. package/dist/utils/index.cjs +219 -270
  44. package/dist/utils/index.esm.js +219 -270
  45. package/dist/utils/index.esm.js.map +1 -1
  46. package/package.json +33 -24
  47. package/types/animations/index.d.ts +58 -0
  48. package/types/index.d.ts +4 -1
  49. package/types/react/index.d.ts +69 -0
  50. package/types/tokens/index.d.ts +33 -0
  51. package/types/v4.d.ts +191 -0
@@ -0,0 +1,69 @@
1
+ // Type definitions for tailwind-to-style/react
2
+
3
+ import { ComponentType, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
4
+
5
+ // ============================================================================
6
+ // styled()
7
+ // ============================================================================
8
+
9
+ type IntrinsicElement = keyof JSX.IntrinsicElements;
10
+
11
+ interface StyledConfig<V extends Record<string, Record<string, string>> = {}> {
12
+ name?: string;
13
+ base?: string;
14
+ variants?: V;
15
+ defaultVariants?: { [K in keyof V]?: keyof V[K] };
16
+ compoundVariants?: Array<{ class?: string; className?: string; [key: string]: any }>;
17
+ slots?: Record<string, string>;
18
+ }
19
+
20
+ type VariantProps<V extends Record<string, Record<string, string>>> = {
21
+ [K in keyof V]?: keyof V[K];
22
+ };
23
+
24
+ type StyledComponent<
25
+ T extends IntrinsicElement | ComponentType<any>,
26
+ V extends Record<string, Record<string, string>>
27
+ > = ForwardRefExoticComponent<
28
+ PropsWithoutRef<
29
+ (T extends IntrinsicElement ? JSX.IntrinsicElements[T] : T extends ComponentType<infer P> ? P : never) &
30
+ VariantProps<V> & { className?: string }
31
+ > &
32
+ RefAttributes<T extends IntrinsicElement ? HTMLElement : any>
33
+ > & {
34
+ variants: any;
35
+ raw: StyledConfig<V>;
36
+ };
37
+
38
+ export declare function styled<
39
+ T extends IntrinsicElement | ComponentType<any>,
40
+ V extends Record<string, Record<string, string>> = {}
41
+ >(
42
+ element: T,
43
+ config?: StyledConfig<V>
44
+ ): StyledComponent<T, V>;
45
+
46
+ // ============================================================================
47
+ // ThemeProvider & useTheme
48
+ // ============================================================================
49
+
50
+ interface ThemeProviderProps {
51
+ theme: Record<string, any>;
52
+ name?: string;
53
+ children: React.ReactNode;
54
+ }
55
+
56
+ interface ThemeContextValue {
57
+ theme: Record<string, any>;
58
+ setTheme: (newTheme: Record<string, any>) => void;
59
+ tokens: Record<string, any>;
60
+ }
61
+
62
+ export declare function ThemeProvider(props: ThemeProviderProps): JSX.Element;
63
+ export declare function useTheme(): ThemeContextValue;
64
+
65
+ // ============================================================================
66
+ // useTws
67
+ // ============================================================================
68
+
69
+ export declare function useTws(classes: string): Record<string, string>;