cherry-styled-components 0.1.1 → 0.1.3

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 (45) hide show
  1. package/.claude/settings.local.json +1 -3
  2. package/.prettierignore +5 -0
  3. package/.prettierrc +2 -2
  4. package/.supermaven/config.json +6 -1
  5. package/CLAUDE.md +70 -0
  6. package/dist/cherry.js +20154 -2610
  7. package/dist/cherry.umd.cjs +650 -478
  8. package/dist/lib/button.d.ts +2 -1
  9. package/dist/lib/icon.d.ts +10 -0
  10. package/dist/lib/index.d.ts +1 -0
  11. package/dist/lib/input.d.ts +1 -0
  12. package/dist/lib/range.d.ts +1 -0
  13. package/dist/lib/select.d.ts +1 -0
  14. package/dist/lib/textarea.d.ts +1 -0
  15. package/dist/lib/toggle.d.ts +1 -0
  16. package/package.json +9 -8
  17. package/src/App.tsx +101 -80
  18. package/src/lib/box.tsx +26 -26
  19. package/src/lib/button.tsx +207 -162
  20. package/src/lib/col.tsx +48 -45
  21. package/src/lib/container.tsx +69 -59
  22. package/src/lib/flex.tsx +99 -92
  23. package/src/lib/grid.tsx +76 -64
  24. package/src/lib/icon.tsx +18 -0
  25. package/src/lib/index.ts +16 -15
  26. package/src/lib/input.tsx +418 -384
  27. package/src/lib/max-width.tsx +53 -50
  28. package/src/lib/range.tsx +234 -208
  29. package/src/lib/select.tsx +136 -121
  30. package/src/lib/space.tsx +55 -52
  31. package/src/lib/styled-components/index.ts +2 -2
  32. package/src/lib/styled-components/registry.tsx +29 -26
  33. package/src/lib/styled-components/theme-provider.tsx +50 -49
  34. package/src/lib/textarea.tsx +115 -94
  35. package/src/lib/toggle.tsx +158 -147
  36. package/src/lib/utils/global.tsx +95 -95
  37. package/src/lib/utils/icons.tsx +84 -84
  38. package/src/lib/utils/index.ts +5 -5
  39. package/src/lib/utils/mixins.tsx +108 -95
  40. package/src/lib/utils/theme.ts +289 -289
  41. package/src/lib/utils/typography.tsx +204 -204
  42. package/src/main.tsx +19 -14
  43. package/src/toggle-theme.tsx +25 -25
  44. package/src/vite-env.d.ts +8 -8
  45. package/vite.config.js +18 -18
@@ -1,95 +1,95 @@
1
- "use client";
2
- import { createGlobalStyle } from "styled-components";
3
- import { Theme } from "./theme";
4
-
5
- const GlobalStyles = (theme: Theme) => createGlobalStyle`
6
- html,
7
- body {
8
- margin: 0;
9
- padding: 0;
10
- min-height: 100%;
11
- scroll-behavior: smooth;
12
- background-color: ${theme.colors.light};
13
- }
14
-
15
- body {
16
- font-family: "Inter", sans-serif;
17
- -moz-osx-font-smoothing: grayscale;
18
- -webkit-text-size-adjust: 100%;
19
- -webkit-font-smoothing: antialiased;
20
- }
21
-
22
- * {
23
- box-sizing: border-box;
24
- min-width: 0;
25
- }
26
-
27
- pre,
28
- code,
29
- kbd,
30
- samp {
31
- font-family: monospace, monospace;
32
- }
33
-
34
- pre,
35
- code,
36
- kbd,
37
- samp,
38
- blockquote,
39
- p,
40
- a,
41
- h1,
42
- h2,
43
- h3,
44
- h4,
45
- h5,
46
- h6,
47
- ul li,
48
- ol li {
49
- margin: 0;
50
- padding: 0;
51
- color: ${theme.colors.dark};
52
- }
53
-
54
- a {
55
- color: ${theme.isDark ? theme.colors.dark : theme.colors.primary};
56
- }
57
-
58
- ol,
59
- ul {
60
- list-style: none;
61
- margin: 0;
62
- padding: 0;
63
- }
64
-
65
- figure {
66
- margin: 0;
67
- }
68
-
69
- fieldset {
70
- appearance: none;
71
- border: none;
72
- }
73
-
74
- button,
75
- input,
76
- a,
77
- img,
78
- svg,
79
- svg * {
80
- transition: all 0.3s ease;
81
- }
82
-
83
- strong,
84
- b {
85
- font-weight: 700;
86
- }
87
-
88
- hr {
89
- margin: 20px 0;
90
- border: none;
91
- border-bottom: 1px solid ${theme.colors.grayLight};
92
- }
93
- `;
94
-
95
- export { GlobalStyles };
1
+ "use client";
2
+ import { createGlobalStyle } from "styled-components";
3
+ import { Theme } from "./theme";
4
+
5
+ const GlobalStyles = (theme: Theme) => createGlobalStyle`
6
+ html,
7
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ min-height: 100%;
11
+ scroll-behavior: smooth;
12
+ background-color: ${theme.colors.light};
13
+ }
14
+
15
+ body {
16
+ font-family: "Inter", sans-serif;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ -webkit-text-size-adjust: 100%;
19
+ -webkit-font-smoothing: antialiased;
20
+ }
21
+
22
+ * {
23
+ box-sizing: border-box;
24
+ min-width: 0;
25
+ }
26
+
27
+ pre,
28
+ code,
29
+ kbd,
30
+ samp {
31
+ font-family: monospace, monospace;
32
+ }
33
+
34
+ pre,
35
+ code,
36
+ kbd,
37
+ samp,
38
+ blockquote,
39
+ p,
40
+ a,
41
+ h1,
42
+ h2,
43
+ h3,
44
+ h4,
45
+ h5,
46
+ h6,
47
+ ul li,
48
+ ol li {
49
+ margin: 0;
50
+ padding: 0;
51
+ color: ${theme.colors.dark};
52
+ }
53
+
54
+ a {
55
+ color: ${theme.isDark ? theme.colors.dark : theme.colors.primary};
56
+ }
57
+
58
+ ol,
59
+ ul {
60
+ list-style: none;
61
+ margin: 0;
62
+ padding: 0;
63
+ }
64
+
65
+ figure {
66
+ margin: 0;
67
+ }
68
+
69
+ fieldset {
70
+ appearance: none;
71
+ border: none;
72
+ }
73
+
74
+ button,
75
+ input,
76
+ a,
77
+ img,
78
+ svg,
79
+ svg * {
80
+ transition: all 0.3s ease;
81
+ }
82
+
83
+ strong,
84
+ b {
85
+ font-weight: 700;
86
+ }
87
+
88
+ hr {
89
+ margin: 20px 0;
90
+ border: none;
91
+ border-bottom: 1px solid ${theme.colors.grayLight};
92
+ }
93
+ `;
94
+
95
+ export { GlobalStyles };
@@ -1,84 +1,84 @@
1
- "use client";
2
- import React from "react";
3
- import { useTheme } from "styled-components";
4
- import { Theme } from "./theme";
5
-
6
- interface IconProps extends React.SVGProps<SVGSVGElement> {
7
- theme?: Theme;
8
- }
9
-
10
- function IconCheck({ ...props }: IconProps) {
11
- const theme: Theme = useTheme() as Theme;
12
- return (
13
- <svg
14
- width="12"
15
- height="10"
16
- viewBox="0 0 12 10"
17
- fill="none"
18
- xmlns="http://www.w3.org/2000/svg"
19
- {...props}
20
- >
21
- <path
22
- d="M10 2L4.4 8L2 5.75"
23
- stroke={theme.colors.primary}
24
- strokeWidth="3"
25
- strokeLinecap="round"
26
- strokeLinejoin="round"
27
- />
28
- </svg>
29
- );
30
- }
31
-
32
- function IconArrow({ ...props }: IconProps) {
33
- const theme: Theme = useTheme() as Theme;
34
- return (
35
- <svg
36
- width="16"
37
- height="10"
38
- viewBox="0 0 16 10"
39
- fill="none"
40
- xmlns="http://www.w3.org/2000/svg"
41
- {...props}
42
- >
43
- <path
44
- d="M2 2L8 8L14 2"
45
- stroke={theme.colors.primary}
46
- strokeWidth="3"
47
- strokeLinecap="round"
48
- strokeLinejoin="round"
49
- />
50
- </svg>
51
- );
52
- }
53
-
54
- function IconCalendar({ ...props }: IconProps) {
55
- const theme: Theme = useTheme() as Theme;
56
-
57
- return (
58
- <svg
59
- xmlns="http://www.w3.org/2000/svg"
60
- width="24"
61
- height="24"
62
- viewBox="0 0 24 24"
63
- fill="none"
64
- stroke={theme.colors.primary}
65
- strokeWidth="2"
66
- strokeLinecap="round"
67
- strokeLinejoin="round"
68
- {...props}
69
- >
70
- <path d="M8 2v4" />
71
- <path d="M16 2v4" />
72
- <rect width="18" height="18" x="3" y="4" rx="2" />
73
- <path d="M3 10h18" />
74
- <path d="M8 14h.01" />
75
- <path d="M12 14h.01" />
76
- <path d="M16 14h.01" />
77
- <path d="M8 18h.01" />
78
- <path d="M12 18h.01" />
79
- <path d="M16 18h.01" />
80
- </svg>
81
- );
82
- }
83
-
84
- export { IconCheck, IconArrow, IconCalendar };
1
+ "use client";
2
+ import React from "react";
3
+ import { useTheme } from "styled-components";
4
+ import { Theme } from "./theme";
5
+
6
+ interface IconProps extends React.SVGProps<SVGSVGElement> {
7
+ theme?: Theme;
8
+ }
9
+
10
+ function IconCheck({ ...props }: IconProps) {
11
+ const theme: Theme = useTheme() as Theme;
12
+ return (
13
+ <svg
14
+ width="12"
15
+ height="10"
16
+ viewBox="0 0 12 10"
17
+ fill="none"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ {...props}
20
+ >
21
+ <path
22
+ d="M10 2L4.4 8L2 5.75"
23
+ stroke={theme.colors.primary}
24
+ strokeWidth="3"
25
+ strokeLinecap="round"
26
+ strokeLinejoin="round"
27
+ />
28
+ </svg>
29
+ );
30
+ }
31
+
32
+ function IconArrow({ ...props }: IconProps) {
33
+ const theme: Theme = useTheme() as Theme;
34
+ return (
35
+ <svg
36
+ width="16"
37
+ height="10"
38
+ viewBox="0 0 16 10"
39
+ fill="none"
40
+ xmlns="http://www.w3.org/2000/svg"
41
+ {...props}
42
+ >
43
+ <path
44
+ d="M2 2L8 8L14 2"
45
+ stroke={theme.colors.primary}
46
+ strokeWidth="3"
47
+ strokeLinecap="round"
48
+ strokeLinejoin="round"
49
+ />
50
+ </svg>
51
+ );
52
+ }
53
+
54
+ function IconCalendar({ ...props }: IconProps) {
55
+ const theme: Theme = useTheme() as Theme;
56
+
57
+ return (
58
+ <svg
59
+ xmlns="http://www.w3.org/2000/svg"
60
+ width="24"
61
+ height="24"
62
+ viewBox="0 0 24 24"
63
+ fill="none"
64
+ stroke={theme.colors.primary}
65
+ strokeWidth="2"
66
+ strokeLinecap="round"
67
+ strokeLinejoin="round"
68
+ {...props}
69
+ >
70
+ <path d="M8 2v4" />
71
+ <path d="M16 2v4" />
72
+ <rect width="18" height="18" x="3" y="4" rx="2" />
73
+ <path d="M3 10h18" />
74
+ <path d="M8 14h.01" />
75
+ <path d="M12 14h.01" />
76
+ <path d="M16 14h.01" />
77
+ <path d="M8 18h.01" />
78
+ <path d="M12 18h.01" />
79
+ <path d="M16 18h.01" />
80
+ </svg>
81
+ );
82
+ }
83
+
84
+ export { IconCheck, IconArrow, IconCalendar };
@@ -1,5 +1,5 @@
1
- export * from "./global";
2
- export * from "./icons";
3
- export * from "./mixins";
4
- export * from "./theme";
5
- export * from "./typography";
1
+ export * from "./global";
2
+ export * from "./icons";
3
+ export * from "./mixins";
4
+ export * from "./theme";
5
+ export * from "./typography";
@@ -1,95 +1,108 @@
1
- "use client";
2
- import { css } from "styled-components";
3
- import { Breakpoints, Theme, mq } from "./theme";
4
-
5
- export const resetButton = css`
6
- box-sizing: border-box;
7
- appearance: none;
8
- border: none;
9
- background: none;
10
- padding: 0;
11
- margin: 0;
12
- cursor: pointer;
13
- outline: none;
14
- `;
15
-
16
- export const resetInput = css`
17
- cursor: text;
18
- min-width: 100px;
19
- `;
20
-
21
- export const fullWidthStyles = (fullWidth: boolean) => {
22
- if (fullWidth) {
23
- return css`
24
- width: 100%;
25
- `;
26
- }
27
- };
28
-
29
- export const statusBorderStyles = ($error: boolean, $success: boolean, theme: Theme) => {
30
- if ($error) {
31
- return css`
32
- border-color: ${theme?.colors.error};
33
- `;
34
- }
35
-
36
- if ($success) {
37
- return css`
38
- border-color: ${theme?.colors.success};
39
- `;
40
- }
41
- };
42
-
43
- export const formElementHeightStyles = ($size?: "default" | "big") => {
44
- if ($size === "big") {
45
- return css`
46
- height: 60px;
47
- `;
48
- }
49
-
50
- return css`
51
- height: 50px;
52
- `;
53
- };
54
-
55
- export const generateGapStyles = (size: keyof Breakpoints<number>, gap: number | "none") => css`
56
- ${mq(size)} {
57
- gap: ${gap === "none" ? "0" : `${gap}px`};
58
- }
59
- `;
60
-
61
- export const generateColsStyles = (size: keyof Breakpoints<number>, cols: number) => css`
62
- ${mq(size)} {
63
- grid-template-columns: repeat(${cols || 3}, minmax(0, 1fr));
64
- }
65
- `;
66
-
67
- export const generateColSpanStyles = (size: keyof Breakpoints<number>, span: number) => css`
68
- ${mq(size)} {
69
- grid-column: span ${span};
70
- }
71
- `;
72
-
73
- export const generatePaddingStyles = (
74
- size: keyof Breakpoints<number>,
75
- padding: number | "none",
76
- ) => css`
77
- ${mq(size)} {
78
- padding: ${padding === "none" ? "0" : `${padding}px`};
79
- }
80
- `;
81
-
82
- export const generateJustifyContentStyles = (
83
- size: keyof Breakpoints<number>,
84
- justifyContent?:
85
- | "center"
86
- | "flex-start"
87
- | "flex-end"
88
- | "space-between"
89
- | "space-around"
90
- | "space-evenly",
91
- ) => css`
92
- ${mq(size)} {
93
- justify-content: ${justifyContent && `${justifyContent}`};
94
- }
95
- `;
1
+ "use client";
2
+ import { css } from "styled-components";
3
+ import { Breakpoints, Theme, mq } from "./theme";
4
+
5
+ export const resetButton = css`
6
+ box-sizing: border-box;
7
+ appearance: none;
8
+ border: none;
9
+ background: none;
10
+ padding: 0;
11
+ margin: 0;
12
+ cursor: pointer;
13
+ outline: none;
14
+ `;
15
+
16
+ export const resetInput = css`
17
+ cursor: text;
18
+ min-width: 100px;
19
+ `;
20
+
21
+ export const fullWidthStyles = (fullWidth: boolean) => {
22
+ if (fullWidth) {
23
+ return css`
24
+ width: 100%;
25
+ `;
26
+ }
27
+ };
28
+
29
+ export const statusBorderStyles = (
30
+ $error: boolean,
31
+ $success: boolean,
32
+ theme: Theme,
33
+ ) => {
34
+ if ($error) {
35
+ return css`
36
+ border-color: ${theme?.colors.error};
37
+ `;
38
+ }
39
+
40
+ if ($success) {
41
+ return css`
42
+ border-color: ${theme?.colors.success};
43
+ `;
44
+ }
45
+ };
46
+
47
+ export const formElementHeightStyles = ($size?: "default" | "big") => {
48
+ if ($size === "big") {
49
+ return css`
50
+ height: 60px;
51
+ `;
52
+ }
53
+
54
+ return css`
55
+ height: 50px;
56
+ `;
57
+ };
58
+
59
+ export const generateGapStyles = (
60
+ size: keyof Breakpoints<number>,
61
+ gap: number | "none",
62
+ ) => css`
63
+ ${mq(size)} {
64
+ gap: ${gap === "none" ? "0" : `${gap}px`};
65
+ }
66
+ `;
67
+
68
+ export const generateColsStyles = (
69
+ size: keyof Breakpoints<number>,
70
+ cols: number,
71
+ ) => css`
72
+ ${mq(size)} {
73
+ grid-template-columns: repeat(${cols || 3}, minmax(0, 1fr));
74
+ }
75
+ `;
76
+
77
+ export const generateColSpanStyles = (
78
+ size: keyof Breakpoints<number>,
79
+ span: number,
80
+ ) => css`
81
+ ${mq(size)} {
82
+ grid-column: span ${span};
83
+ }
84
+ `;
85
+
86
+ export const generatePaddingStyles = (
87
+ size: keyof Breakpoints<number>,
88
+ padding: number | "none",
89
+ ) => css`
90
+ ${mq(size)} {
91
+ padding: ${padding === "none" ? "0" : `${padding}px`};
92
+ }
93
+ `;
94
+
95
+ export const generateJustifyContentStyles = (
96
+ size: keyof Breakpoints<number>,
97
+ justifyContent?:
98
+ | "center"
99
+ | "flex-start"
100
+ | "flex-end"
101
+ | "space-between"
102
+ | "space-around"
103
+ | "space-evenly",
104
+ ) => css`
105
+ ${mq(size)} {
106
+ justify-content: ${justifyContent && `${justifyContent}`};
107
+ }
108
+ `;