cherry-styled-components 0.1.0 → 0.1.2
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/.claude/settings.local.json +5 -0
- package/.eslintrc.cjs +18 -0
- package/.prettierignore +5 -0
- package/.prettierrc +11 -0
- package/.supermaven/config.json +6 -0
- package/README.md +33 -11
- package/dist/App.d.ts +2 -0
- package/dist/cherry.js +5258 -0
- package/dist/cherry.umd.cjs +1217 -0
- package/dist/lib/box.d.ts +4 -0
- package/dist/lib/button.d.ts +15 -0
- package/dist/lib/col.d.ts +16 -0
- package/dist/lib/container.d.ts +19 -0
- package/dist/lib/flex.d.ts +29 -0
- package/dist/lib/grid.d.ts +24 -0
- package/dist/lib/index.d.ts +15 -0
- package/dist/lib/input.d.ts +27 -0
- package/dist/lib/max-width.d.ts +14 -0
- package/dist/lib/range.d.ts +14 -0
- package/dist/lib/select.d.ts +16 -0
- package/dist/lib/space.d.ts +14 -0
- package/dist/lib/styled-components/index.d.ts +2 -0
- package/dist/lib/styled-components/registry.d.ts +5 -0
- package/dist/lib/styled-components/theme-provider.d.ts +12 -0
- package/dist/lib/textarea.d.ts +15 -0
- package/dist/lib/toggle.d.ts +15 -0
- package/dist/lib/utils/global.d.ts +3 -0
- package/dist/lib/utils/icons.d.ts +9 -0
- package/dist/lib/utils/index.d.ts +5 -0
- package/dist/lib/utils/mixins.d.ts +11 -0
- package/dist/lib/utils/theme.d.ts +231 -0
- package/dist/lib/utils/typography.d.ts +20 -0
- package/dist/main.d.ts +1 -0
- package/dist/toggle-theme.d.ts +3 -0
- package/index.html +13 -0
- package/package.json +38 -25
- package/pnpm-workspace.yaml +3 -0
- package/src/App.tsx +101 -0
- package/src/lib/box.tsx +26 -0
- package/src/lib/button.tsx +162 -0
- package/src/lib/col.tsx +48 -0
- package/src/lib/container.tsx +69 -0
- package/src/lib/flex.tsx +99 -0
- package/src/lib/grid.tsx +76 -0
- package/src/{app/components/cherry → lib}/index.ts +1 -1
- package/src/lib/input.tsx +418 -0
- package/src/lib/max-width.tsx +53 -0
- package/src/lib/range.tsx +234 -0
- package/src/lib/select.tsx +136 -0
- package/src/lib/space.tsx +55 -0
- package/src/lib/styled-components/registry.tsx +29 -0
- package/src/lib/styled-components/theme-provider.tsx +50 -0
- package/src/lib/textarea.tsx +115 -0
- package/src/lib/toggle.tsx +158 -0
- package/src/{app/components/cherry → lib}/utils/global.tsx +20 -3
- package/src/lib/utils/icons.tsx +84 -0
- package/src/lib/utils/mixins.tsx +108 -0
- package/src/lib/utils/theme.ts +289 -0
- package/src/lib/utils/typography.tsx +204 -0
- package/src/main.tsx +19 -0
- package/src/toggle-theme.tsx +25 -0
- package/src/vite-env.d.ts +8 -0
- package/tsconfig.json +24 -0
- package/vite.config.js +24 -0
- package/src/app/components/cherry/box.tsx +0 -16
- package/src/app/components/cherry/button.tsx +0 -177
- package/src/app/components/cherry/col.tsx +0 -39
- package/src/app/components/cherry/container.tsx +0 -55
- package/src/app/components/cherry/flex.tsx +0 -90
- package/src/app/components/cherry/grid.tsx +0 -60
- package/src/app/components/cherry/input.tsx +0 -254
- package/src/app/components/cherry/max-width.tsx +0 -43
- package/src/app/components/cherry/range.tsx +0 -223
- package/src/app/components/cherry/select.tsx +0 -122
- package/src/app/components/cherry/space.tsx +0 -54
- package/src/app/components/cherry/styled-components/registry.tsx +0 -26
- package/src/app/components/cherry/styled-components/theme-provider.tsx +0 -21
- package/src/app/components/cherry/textarea.tsx +0 -98
- package/src/app/components/cherry/toggle.tsx +0 -148
- package/src/app/components/cherry/utils/icons.tsx +0 -168
- package/src/app/components/cherry/utils/mixins.tsx +0 -107
- package/src/app/components/cherry/utils/theme.ts +0 -241
- package/src/app/components/cherry/utils/typography.tsx +0 -204
- /package/src/{app/components/cherry → lib}/styled-components/index.ts +0 -0
- /package/src/{app/components/cherry → lib}/utils/index.ts +0 -0
|
@@ -0,0 +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 = (
|
|
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
|
+
`;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export const breakpoints: Breakpoints = {
|
|
3
|
+
xs: 0,
|
|
4
|
+
sm: 576,
|
|
5
|
+
md: 768,
|
|
6
|
+
lg: 992,
|
|
7
|
+
xl: 1200,
|
|
8
|
+
xxl: 1440,
|
|
9
|
+
xxxl: 1920,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function mq(minWidth: keyof Breakpoints) {
|
|
13
|
+
return `@media screen and (min-width: ${breakpoints[minWidth]}px)`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const spacing: Spacing = {
|
|
17
|
+
maxWidth: { xs: "1280px", xxxl: "1440px" },
|
|
18
|
+
padding: { xs: "20px", lg: "40px" },
|
|
19
|
+
radius: { xs: "6px", lg: "12px", xl: "30px" },
|
|
20
|
+
gridGap: { xs: "20px", lg: "40px" },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const colors: Colors = {
|
|
24
|
+
primaryLight: "#91aec4",
|
|
25
|
+
primary: "#4d6f8b",
|
|
26
|
+
primaryDark: "#194569",
|
|
27
|
+
|
|
28
|
+
secondaryLight: "#a4b17b",
|
|
29
|
+
secondary: "#5c6e46",
|
|
30
|
+
secondaryDark: "#354c2b",
|
|
31
|
+
|
|
32
|
+
tertiaryLight: "#ebccb9",
|
|
33
|
+
tertiary: "#816b5a",
|
|
34
|
+
tertiaryDark: "#675445",
|
|
35
|
+
|
|
36
|
+
grayLight: "#e5e7eb",
|
|
37
|
+
gray: "#9ca3af",
|
|
38
|
+
grayDark: "#4b5563",
|
|
39
|
+
|
|
40
|
+
success: "#84cc16",
|
|
41
|
+
error: "#ef4444",
|
|
42
|
+
warning: "#eab308",
|
|
43
|
+
info: "#06b6d4",
|
|
44
|
+
|
|
45
|
+
dark: "#000000",
|
|
46
|
+
light: "#ffffff",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const colorsDark: Colors = {
|
|
50
|
+
primaryLight: "#79C5FF",
|
|
51
|
+
primary: "#6198C6",
|
|
52
|
+
primaryDark: "#339DF4",
|
|
53
|
+
|
|
54
|
+
secondaryLight: "#a4b17b",
|
|
55
|
+
secondary: "#5c6e46",
|
|
56
|
+
secondaryDark: "#354c2b",
|
|
57
|
+
|
|
58
|
+
tertiaryLight: "#ebccb9",
|
|
59
|
+
tertiary: "#816b5a",
|
|
60
|
+
tertiaryDark: "#675445",
|
|
61
|
+
|
|
62
|
+
grayLight: "#1a1a1a",
|
|
63
|
+
gray: "#454444",
|
|
64
|
+
grayDark: "#808080",
|
|
65
|
+
|
|
66
|
+
success: "#84cc16",
|
|
67
|
+
error: "#ef4444",
|
|
68
|
+
warning: "#eab308",
|
|
69
|
+
info: "#06b6d4",
|
|
70
|
+
|
|
71
|
+
dark: "#ffffff",
|
|
72
|
+
light: "#000000",
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const shadows: Shadows = {
|
|
76
|
+
xs: "0px 4px 4px 0px rgba(18, 18, 18, 0.04), 0px 1px 3px 0px rgba(39, 41, 45, 0.02)",
|
|
77
|
+
sm: "0px 4px 4px 0px rgba(18, 18, 18, 0.08), 0px 1px 3px 0px rgba(39, 41, 45, 0.04)",
|
|
78
|
+
md: "0px 8px 8px 0px rgba(18, 18, 18, 0.16), 0px 2px 3px 0px rgba(39, 41, 45, 0.06)",
|
|
79
|
+
lg: "0px 16px 24px 0px rgba(18, 18, 18, 0.20), 0px 2px 3px 0px rgba(39, 41, 45, 0.08)",
|
|
80
|
+
xl: "0px 24px 32px 0px rgba(18, 18, 18, 0.24), 0px 2px 3px 0px rgba(39, 41, 45, 0.12)",
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const shadowsDark: Shadows = {
|
|
84
|
+
xs: "0px 4px 4px 0px rgba(255, 255, 255, 0.04), 0px 1px 3px 0px rgba(255, 255, 255, 0.02)",
|
|
85
|
+
sm: "0px 4px 4px 0px rgba(255, 255, 255, 0.08), 0px 1px 3px 0px rgba(255, 255, 255, 0.04)",
|
|
86
|
+
md: "0px 8px 8px 0px rgba(255, 255, 255, 0.16), 0px 2px 3px 0px rgba(255, 255, 255, 0.06)",
|
|
87
|
+
lg: "0px 16px 24px 0px rgba(255, 255, 255, 0.20), 0px 2px 3px 0px rgba(255, 255, 255, 0.08)",
|
|
88
|
+
xl: "0px 24px 32px 0px rgba(255, 255, 255, 0.24), 0px 2px 3px 0px rgba(255, 255, 255, 0.12)",
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const fonts: Fonts = {
|
|
92
|
+
text: "Inter",
|
|
93
|
+
head: "Inter",
|
|
94
|
+
mono: "monospace",
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const fontSizes: FontSizes = {
|
|
98
|
+
hero1: { xs: "72px", lg: "128px" },
|
|
99
|
+
hero2: { xs: "60px", lg: "96px" },
|
|
100
|
+
hero3: { xs: "36px", lg: "72px" },
|
|
101
|
+
|
|
102
|
+
h1: { xs: "40px", lg: "60px" },
|
|
103
|
+
h2: { xs: "30px", lg: "36px" },
|
|
104
|
+
h3: { xs: "28px", lg: "30px" },
|
|
105
|
+
h4: { xs: "26px", lg: "24px" },
|
|
106
|
+
h5: { xs: "18px", lg: "20px" },
|
|
107
|
+
h6: { xs: "16px", lg: "18px" },
|
|
108
|
+
|
|
109
|
+
text: { xs: "14px", lg: "16px" },
|
|
110
|
+
strong: { xs: "14px", lg: "16px" },
|
|
111
|
+
small: { xs: "12px", lg: "14px" },
|
|
112
|
+
|
|
113
|
+
blockquote: { xs: "16px", lg: "18px" },
|
|
114
|
+
code: { xs: "14px", lg: "16px" },
|
|
115
|
+
|
|
116
|
+
button: { xs: "16px", lg: "16px" },
|
|
117
|
+
buttonBig: { xs: "18px", lg: "18px" },
|
|
118
|
+
|
|
119
|
+
input: { xs: "16px", lg: "16px" },
|
|
120
|
+
inputBig: { xs: "18px", lg: "18px" },
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const lineHeights: LineHeights = {
|
|
124
|
+
hero1: { xs: "1.10", lg: "1.10" },
|
|
125
|
+
hero2: { xs: "1.10", lg: "1.10" },
|
|
126
|
+
hero3: { xs: "1.20", lg: "1.10" },
|
|
127
|
+
|
|
128
|
+
h1: { xs: "1.50", lg: "1.40" },
|
|
129
|
+
h2: { xs: "1.50", lg: "1.50" },
|
|
130
|
+
h3: { xs: "1.30", lg: "1.50" },
|
|
131
|
+
h4: { xs: "1.30", lg: "1.50" },
|
|
132
|
+
h5: { xs: "1.60", lg: "1.50" },
|
|
133
|
+
h6: { xs: "1.60", lg: "1.60" },
|
|
134
|
+
|
|
135
|
+
text: { xs: "1.70", lg: "1.70" },
|
|
136
|
+
strong: { xs: "1.70", lg: "1.70" },
|
|
137
|
+
small: { xs: "1.70", lg: "1.70" },
|
|
138
|
+
|
|
139
|
+
blockquote: { xs: "1.70", lg: "1.70" },
|
|
140
|
+
code: { xs: "1.70", lg: "1.70" },
|
|
141
|
+
|
|
142
|
+
button: { xs: "1.00", lg: "1.00" },
|
|
143
|
+
buttonBig: { xs: "1.00", lg: "1.00" },
|
|
144
|
+
|
|
145
|
+
input: { xs: "1.00", lg: "1.00" },
|
|
146
|
+
inputBig: { xs: "1.00", lg: "1.00" },
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const theme: Theme = {
|
|
150
|
+
breakpoints,
|
|
151
|
+
spacing,
|
|
152
|
+
colors,
|
|
153
|
+
shadows,
|
|
154
|
+
fonts,
|
|
155
|
+
fontSizes,
|
|
156
|
+
lineHeights,
|
|
157
|
+
isDark: false,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const themeDark: Theme = {
|
|
161
|
+
breakpoints,
|
|
162
|
+
spacing,
|
|
163
|
+
colors: colorsDark,
|
|
164
|
+
shadows: shadowsDark,
|
|
165
|
+
fonts,
|
|
166
|
+
fontSizes,
|
|
167
|
+
lineHeights,
|
|
168
|
+
isDark: true,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export interface Breakpoints<TNumber = number> {
|
|
172
|
+
xs: TNumber;
|
|
173
|
+
sm: TNumber;
|
|
174
|
+
md: TNumber;
|
|
175
|
+
lg: TNumber;
|
|
176
|
+
xl: TNumber;
|
|
177
|
+
xxl: TNumber;
|
|
178
|
+
xxxl: TNumber;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface Spacing<TString = string> {
|
|
182
|
+
maxWidth: { xs: TString; xxxl: TString };
|
|
183
|
+
padding: { xs: TString; lg: TString };
|
|
184
|
+
radius: { xs: TString; lg: TString; xl: TString };
|
|
185
|
+
gridGap: { xs: TString; lg: TString };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface Colors<TString = string> {
|
|
189
|
+
primaryLight: TString;
|
|
190
|
+
primary: TString;
|
|
191
|
+
primaryDark: TString;
|
|
192
|
+
|
|
193
|
+
secondaryLight: TString;
|
|
194
|
+
secondary: TString;
|
|
195
|
+
secondaryDark: TString;
|
|
196
|
+
|
|
197
|
+
tertiaryLight: TString;
|
|
198
|
+
tertiary: TString;
|
|
199
|
+
tertiaryDark: TString;
|
|
200
|
+
|
|
201
|
+
grayLight: TString;
|
|
202
|
+
gray: TString;
|
|
203
|
+
grayDark: TString;
|
|
204
|
+
|
|
205
|
+
success: TString;
|
|
206
|
+
error: TString;
|
|
207
|
+
warning: TString;
|
|
208
|
+
info: TString;
|
|
209
|
+
|
|
210
|
+
dark: TString;
|
|
211
|
+
light: TString;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface Shadows<TString = string> {
|
|
215
|
+
xs: TString;
|
|
216
|
+
sm: TString;
|
|
217
|
+
md: TString;
|
|
218
|
+
lg: TString;
|
|
219
|
+
xl: TString;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface Fonts<TString = string> {
|
|
223
|
+
head: TString;
|
|
224
|
+
text: TString;
|
|
225
|
+
mono: TString;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface FontSizes<TString = string> {
|
|
229
|
+
hero1: { xs: TString; lg: TString };
|
|
230
|
+
hero2: { xs: TString; lg: TString };
|
|
231
|
+
hero3: { xs: TString; lg: TString };
|
|
232
|
+
|
|
233
|
+
h1: { xs: TString; lg: TString };
|
|
234
|
+
h2: { xs: TString; lg: TString };
|
|
235
|
+
h3: { xs: TString; lg: TString };
|
|
236
|
+
h4: { xs: TString; lg: TString };
|
|
237
|
+
h5: { xs: TString; lg: TString };
|
|
238
|
+
h6: { xs: TString; lg: TString };
|
|
239
|
+
|
|
240
|
+
text: { xs: TString; lg: TString };
|
|
241
|
+
strong: { xs: TString; lg: TString };
|
|
242
|
+
small: { xs: TString; lg: TString };
|
|
243
|
+
|
|
244
|
+
blockquote: { xs: TString; lg: TString };
|
|
245
|
+
code: { xs: TString; lg: TString };
|
|
246
|
+
|
|
247
|
+
button: { xs: TString; lg: TString };
|
|
248
|
+
buttonBig: { xs: TString; lg: TString };
|
|
249
|
+
|
|
250
|
+
input: { xs: TString; lg: TString };
|
|
251
|
+
inputBig: { xs: TString; lg: TString };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface LineHeights<TString = string> {
|
|
255
|
+
hero1: { xs: TString; lg: TString };
|
|
256
|
+
hero2: { xs: TString; lg: TString };
|
|
257
|
+
hero3: { xs: TString; lg: TString };
|
|
258
|
+
|
|
259
|
+
h1: { xs: TString; lg: TString };
|
|
260
|
+
h2: { xs: TString; lg: TString };
|
|
261
|
+
h3: { xs: TString; lg: TString };
|
|
262
|
+
h4: { xs: TString; lg: TString };
|
|
263
|
+
h5: { xs: TString; lg: TString };
|
|
264
|
+
h6: { xs: TString; lg: TString };
|
|
265
|
+
|
|
266
|
+
text: { xs: TString; lg: TString };
|
|
267
|
+
strong: { xs: TString; lg: TString };
|
|
268
|
+
small: { xs: TString; lg: TString };
|
|
269
|
+
|
|
270
|
+
blockquote: { xs: TString; lg: TString };
|
|
271
|
+
code: { xs: TString; lg: TString };
|
|
272
|
+
|
|
273
|
+
button: { xs: TString; lg: TString };
|
|
274
|
+
buttonBig: { xs: TString; lg: TString };
|
|
275
|
+
|
|
276
|
+
input: { xs: TString; lg: TString };
|
|
277
|
+
inputBig: { xs: TString; lg: TString };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface Theme {
|
|
281
|
+
breakpoints: Breakpoints;
|
|
282
|
+
spacing: Spacing;
|
|
283
|
+
colors: Colors;
|
|
284
|
+
shadows: Shadows;
|
|
285
|
+
fonts: Fonts;
|
|
286
|
+
fontSizes: FontSizes;
|
|
287
|
+
lineHeights: LineHeights;
|
|
288
|
+
isDark: boolean;
|
|
289
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { css } from "styled-components";
|
|
3
|
+
import { Theme, mq } from "./theme";
|
|
4
|
+
|
|
5
|
+
const styledHero1 = (theme: Theme) => css`
|
|
6
|
+
font-size: ${theme.fontSizes.hero1.xs};
|
|
7
|
+
line-height: ${theme.lineHeights.hero1.xs};
|
|
8
|
+
|
|
9
|
+
${mq("lg")} {
|
|
10
|
+
font-size: ${theme.fontSizes.hero1.lg};
|
|
11
|
+
line-height: ${theme.lineHeights.hero1.lg};
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const styledHero2 = (theme: Theme) => css`
|
|
16
|
+
font-size: ${theme.fontSizes.hero2.xs};
|
|
17
|
+
line-height: ${theme.lineHeights.hero2.xs};
|
|
18
|
+
|
|
19
|
+
${mq("lg")} {
|
|
20
|
+
font-size: ${theme.fontSizes.hero2.lg};
|
|
21
|
+
line-height: ${theme.lineHeights.hero2.lg};
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const styledHero3 = (theme: Theme) => css`
|
|
26
|
+
font-size: ${theme.fontSizes.hero3.xs};
|
|
27
|
+
line-height: ${theme.lineHeights.hero3.xs};
|
|
28
|
+
|
|
29
|
+
${mq("lg")} {
|
|
30
|
+
font-size: ${theme.fontSizes.hero3.lg};
|
|
31
|
+
line-height: ${theme.lineHeights.hero3.lg};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const styledH1 = (theme: Theme) => css`
|
|
36
|
+
font-size: ${theme.fontSizes.h1.xs};
|
|
37
|
+
line-height: ${theme.lineHeights.h1.xs};
|
|
38
|
+
|
|
39
|
+
${mq("lg")} {
|
|
40
|
+
font-size: ${theme.fontSizes.h1.lg};
|
|
41
|
+
line-height: ${theme.lineHeights.h1.lg};
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const styledH2 = (theme: Theme) => css`
|
|
46
|
+
font-size: ${theme.fontSizes.h2.xs};
|
|
47
|
+
line-height: ${theme.lineHeights.h2.xs};
|
|
48
|
+
|
|
49
|
+
${mq("lg")} {
|
|
50
|
+
font-size: ${theme.fontSizes.h2.lg};
|
|
51
|
+
line-height: ${theme.lineHeights.h2.lg};
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const styledH3 = (theme: Theme) => css`
|
|
56
|
+
font-size: ${theme.fontSizes.h3.xs};
|
|
57
|
+
line-height: ${theme.lineHeights.h3.xs};
|
|
58
|
+
|
|
59
|
+
${mq("lg")} {
|
|
60
|
+
font-size: ${theme.fontSizes.h3.lg};
|
|
61
|
+
line-height: ${theme.lineHeights.h3.lg};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
const styledH4 = (theme: Theme) => css`
|
|
66
|
+
font-size: ${theme.fontSizes.h4.xs};
|
|
67
|
+
line-height: ${theme.lineHeights.h4.xs};
|
|
68
|
+
|
|
69
|
+
${mq("lg")} {
|
|
70
|
+
font-size: ${theme.fontSizes.h4.lg};
|
|
71
|
+
line-height: ${theme.lineHeights.h4.lg};
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const styledH5 = (theme: Theme) => css`
|
|
76
|
+
font-size: ${theme.fontSizes.h5.xs};
|
|
77
|
+
line-height: ${theme.lineHeights.h5.xs};
|
|
78
|
+
|
|
79
|
+
${mq("lg")} {
|
|
80
|
+
font-size: ${theme.fontSizes.h5.lg};
|
|
81
|
+
line-height: ${theme.lineHeights.h5.lg};
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const styledH6 = (theme: Theme) => css`
|
|
86
|
+
font-size: ${theme.fontSizes.h6.xs};
|
|
87
|
+
line-height: ${theme.lineHeights.h6.xs};
|
|
88
|
+
|
|
89
|
+
${mq("lg")} {
|
|
90
|
+
font-size: ${theme.fontSizes.h6.lg};
|
|
91
|
+
line-height: ${theme.lineHeights.h6.lg};
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
const styledText = (theme: Theme) => css`
|
|
96
|
+
font-size: ${theme.fontSizes.text.xs};
|
|
97
|
+
line-height: ${theme.lineHeights.text.xs};
|
|
98
|
+
|
|
99
|
+
${mq("lg")} {
|
|
100
|
+
font-size: ${theme.fontSizes.text.lg};
|
|
101
|
+
line-height: ${theme.lineHeights.text.lg};
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
const styledStrong = (theme: Theme) => css`
|
|
106
|
+
font-size: ${theme.fontSizes.strong.xs};
|
|
107
|
+
line-height: ${theme.lineHeights.strong.xs};
|
|
108
|
+
|
|
109
|
+
${mq("lg")} {
|
|
110
|
+
font-size: ${theme.fontSizes.strong.lg};
|
|
111
|
+
line-height: ${theme.lineHeights.strong.lg};
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
const styledSmall = (theme: Theme) => css`
|
|
116
|
+
font-size: ${theme.fontSizes.small.xs};
|
|
117
|
+
line-height: ${theme.lineHeights.small.xs};
|
|
118
|
+
|
|
119
|
+
${mq("lg")} {
|
|
120
|
+
font-size: ${theme.fontSizes.small.lg};
|
|
121
|
+
line-height: ${theme.lineHeights.small.lg};
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
const styledBlockquote = (theme: Theme) => css`
|
|
126
|
+
font-size: ${theme.fontSizes.blockquote.xs};
|
|
127
|
+
line-height: ${theme.lineHeights.blockquote.xs};
|
|
128
|
+
|
|
129
|
+
${mq("lg")} {
|
|
130
|
+
font-size: ${theme.fontSizes.blockquote.lg};
|
|
131
|
+
line-height: ${theme.lineHeights.blockquote.lg};
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
const styledCode = (theme: Theme) => css`
|
|
136
|
+
font-size: ${theme.fontSizes.code.xs};
|
|
137
|
+
line-height: ${theme.lineHeights.code.xs};
|
|
138
|
+
|
|
139
|
+
${mq("lg")} {
|
|
140
|
+
font-size: ${theme.fontSizes.code.lg};
|
|
141
|
+
line-height: ${theme.lineHeights.code.lg};
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
const styledButton = (theme: Theme) => css`
|
|
146
|
+
font-size: ${theme.fontSizes.button.xs};
|
|
147
|
+
line-height: ${theme.lineHeights.button.xs};
|
|
148
|
+
|
|
149
|
+
${mq("lg")} {
|
|
150
|
+
font-size: ${theme.fontSizes.button.lg};
|
|
151
|
+
line-height: ${theme.lineHeights.button.lg};
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
const styledButtonBig = (theme: Theme) => css`
|
|
156
|
+
font-size: ${theme.fontSizes.buttonBig.xs};
|
|
157
|
+
line-height: ${theme.lineHeights.buttonBig.xs};
|
|
158
|
+
|
|
159
|
+
${mq("lg")} {
|
|
160
|
+
font-size: ${theme.fontSizes.buttonBig.lg};
|
|
161
|
+
line-height: ${theme.lineHeights.buttonBig.lg};
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
const styledInput = (theme: Theme) => css`
|
|
166
|
+
font-size: ${theme.fontSizes.input.xs};
|
|
167
|
+
line-height: ${theme.lineHeights.input.xs};
|
|
168
|
+
|
|
169
|
+
${mq("lg")} {
|
|
170
|
+
font-size: ${theme.fontSizes.input.lg};
|
|
171
|
+
line-height: ${theme.lineHeights.input.lg};
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
|
|
175
|
+
const styledInputBig = (theme: Theme) => css`
|
|
176
|
+
font-size: ${theme.fontSizes.inputBig.xs};
|
|
177
|
+
line-height: ${theme.lineHeights.inputBig.xs};
|
|
178
|
+
|
|
179
|
+
${mq("lg")} {
|
|
180
|
+
font-size: ${theme.fontSizes.inputBig.lg};
|
|
181
|
+
line-height: ${theme.lineHeights.inputBig.lg};
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
styledHero1,
|
|
187
|
+
styledHero2,
|
|
188
|
+
styledHero3,
|
|
189
|
+
styledH1,
|
|
190
|
+
styledH2,
|
|
191
|
+
styledH3,
|
|
192
|
+
styledH4,
|
|
193
|
+
styledH5,
|
|
194
|
+
styledH6,
|
|
195
|
+
styledText,
|
|
196
|
+
styledStrong,
|
|
197
|
+
styledSmall,
|
|
198
|
+
styledBlockquote,
|
|
199
|
+
styledCode,
|
|
200
|
+
styledButton,
|
|
201
|
+
styledButtonBig,
|
|
202
|
+
styledInput,
|
|
203
|
+
styledInputBig,
|
|
204
|
+
};
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import {
|
|
4
|
+
CherryThemeProvider,
|
|
5
|
+
StyledComponentsRegistry,
|
|
6
|
+
theme,
|
|
7
|
+
themeDark,
|
|
8
|
+
} from "./lib/index.js";
|
|
9
|
+
import App from "./App";
|
|
10
|
+
|
|
11
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
12
|
+
<React.StrictMode>
|
|
13
|
+
<StyledComponentsRegistry>
|
|
14
|
+
<CherryThemeProvider theme={theme} themeDark={themeDark}>
|
|
15
|
+
<App />
|
|
16
|
+
</CherryThemeProvider>
|
|
17
|
+
</StyledComponentsRegistry>
|
|
18
|
+
</React.StrictMode>,
|
|
19
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { useTheme } from "styled-components";
|
|
3
|
+
import { theme as themeLight, themeDark, ThemeContext, Toggle } from "./lib";
|
|
4
|
+
|
|
5
|
+
function ToggleTheme() {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const { setTheme } = useContext(ThemeContext);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Toggle
|
|
11
|
+
$label="Toggle Theme"
|
|
12
|
+
onChange={() => {
|
|
13
|
+
if (theme.isDark) {
|
|
14
|
+
setTheme(themeLight);
|
|
15
|
+
localStorage.theme = "light";
|
|
16
|
+
} else {
|
|
17
|
+
setTheme(themeDark);
|
|
18
|
+
localStorage.theme = "dark";
|
|
19
|
+
}
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { ToggleTheme };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["dom", "dom.iterable"],
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": false,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"emitDeclarationOnly": true,
|
|
10
|
+
"outDir": "./types",
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"module": "ES6",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "preserve",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
23
|
+
"exclude": ["node_modules"]
|
|
24
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import dts from "vite-plugin-dts";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [react(), dts()],
|
|
7
|
+
build: {
|
|
8
|
+
lib: {
|
|
9
|
+
entry: "src/lib/index.ts",
|
|
10
|
+
name: "Cherry",
|
|
11
|
+
formats: ["es", "umd"],
|
|
12
|
+
fileName: "cherry",
|
|
13
|
+
},
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
external: ["react", "react-dom"],
|
|
16
|
+
output: {
|
|
17
|
+
globals: {
|
|
18
|
+
react: "React",
|
|
19
|
+
"react-dom": "ReactDOM",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|