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
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { Breakpoints, mq } from "./utils";
|
|
5
|
-
|
|
6
|
-
interface MaxWidthProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
$size?: number;
|
|
8
|
-
$xs?: number;
|
|
9
|
-
$sm?: number;
|
|
10
|
-
$md?: number;
|
|
11
|
-
$lg?: number;
|
|
12
|
-
$xl?: number;
|
|
13
|
-
$xxl?: number;
|
|
14
|
-
$xxxl?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const styles = ($size: number | "none") => `max-width: ${$size}px;`;
|
|
18
|
-
|
|
19
|
-
function responsiveStyles(props: any) {
|
|
20
|
-
return Object.keys(props)
|
|
21
|
-
.filter((key) => key.startsWith("$"))
|
|
22
|
-
.map((key) => {
|
|
23
|
-
const size = key.substring(1) as keyof Breakpoints<number>;
|
|
24
|
-
return props[key] && mq(size) + `{ ${styles(props[key])} }`;
|
|
25
|
-
})
|
|
26
|
-
.join("");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const StyledMaxWidth = styled.div<MaxWidthProps>`
|
|
30
|
-
display: block;
|
|
31
|
-
margin: auto;
|
|
32
|
-
|
|
33
|
-
${({ $size }) => `
|
|
34
|
-
${$size && styles($size)};
|
|
35
|
-
`}
|
|
36
|
-
${(props) => responsiveStyles(props)}
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
function MaxWidth({ ...props }: MaxWidthProps) {
|
|
40
|
-
return <StyledMaxWidth {...props}>{props.children}</StyledMaxWidth>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { MaxWidth };
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
Theme,
|
|
6
|
-
fullWidthStyles,
|
|
7
|
-
resetButton,
|
|
8
|
-
statusBorderStyles,
|
|
9
|
-
} from "./utils";
|
|
10
|
-
import { StyledLabel } from "./input";
|
|
11
|
-
|
|
12
|
-
interface InputProps
|
|
13
|
-
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
14
|
-
className?: string;
|
|
15
|
-
$label?: string;
|
|
16
|
-
$size?: "default" | "big";
|
|
17
|
-
$error?: boolean;
|
|
18
|
-
$success?: boolean;
|
|
19
|
-
$fullWidth?: boolean;
|
|
20
|
-
theme?: Theme;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const StyledInputWrapper = styled.span<InputProps>`
|
|
24
|
-
display: inline-flex;
|
|
25
|
-
flex-wrap: ${({ type }) =>
|
|
26
|
-
type === "checkbox" || type === "radio" ? "fprnowrap" : "wrap"};
|
|
27
|
-
gap: 10px;
|
|
28
|
-
align-items: center;
|
|
29
|
-
|
|
30
|
-
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const StyledInput = styled.input<InputProps>`
|
|
34
|
-
${resetButton};
|
|
35
|
-
padding: 0;
|
|
36
|
-
height: 10px;
|
|
37
|
-
font-size: 0;
|
|
38
|
-
background: transparent;
|
|
39
|
-
min-width: 100px;
|
|
40
|
-
|
|
41
|
-
&::-webkit-slider-runnable-track {
|
|
42
|
-
width: 100%;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
45
|
-
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
46
|
-
box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
|
|
47
|
-
transition: all 0.3s ease;
|
|
48
|
-
${({ $error, $success, theme }) => {
|
|
49
|
-
return statusBorderStyles(
|
|
50
|
-
$error ? true : false,
|
|
51
|
-
$success ? true : false,
|
|
52
|
-
theme,
|
|
53
|
-
);
|
|
54
|
-
}}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&::-moz-range-track {
|
|
58
|
-
width: 100%;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
61
|
-
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
62
|
-
box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
|
|
63
|
-
transition: all 0.3s ease;
|
|
64
|
-
${({ $error, $success, theme }) => {
|
|
65
|
-
return statusBorderStyles(
|
|
66
|
-
$error ? true : false,
|
|
67
|
-
$success ? true : false,
|
|
68
|
-
theme,
|
|
69
|
-
);
|
|
70
|
-
}}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&::-webkit-slider-thumb {
|
|
74
|
-
${resetButton};
|
|
75
|
-
background: ${({ theme }) => theme.colors.primary};
|
|
76
|
-
border: 0 solid transparent;
|
|
77
|
-
border-radius: 50%;
|
|
78
|
-
transition: all 0.3s ease;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&::-moz-range-thumb {
|
|
82
|
-
${resetButton};
|
|
83
|
-
background: ${({ theme }) => theme.colors.primary};
|
|
84
|
-
border: 0 solid transparent;
|
|
85
|
-
border-radius: 50%;
|
|
86
|
-
transition: all 0.3s ease;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@media (hover: hover) {
|
|
90
|
-
&:hover:not([disabled]) {
|
|
91
|
-
&::-webkit-slider-runnable-track {
|
|
92
|
-
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&::-moz-range-track {
|
|
96
|
-
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&:focus:not([disabled]) {
|
|
102
|
-
&::-webkit-slider-runnable-track {
|
|
103
|
-
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
104
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
105
|
-
}
|
|
106
|
-
&::-webkit-slider-thumb {
|
|
107
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
108
|
-
}
|
|
109
|
-
&::-moz-range-track {
|
|
110
|
-
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
111
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
112
|
-
}
|
|
113
|
-
&::-moz-range-thumb {
|
|
114
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&:active:not([disabled]) {
|
|
119
|
-
&::-webkit-slider-runnable-track {
|
|
120
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
121
|
-
}
|
|
122
|
-
&::-webkit-slider-thumb {
|
|
123
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
124
|
-
}
|
|
125
|
-
&::-moz-range-track {
|
|
126
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
127
|
-
}
|
|
128
|
-
&::-moz-range-thumb {
|
|
129
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
${({ disabled, theme }) =>
|
|
134
|
-
disabled &&
|
|
135
|
-
`
|
|
136
|
-
cursor: not-allowed;
|
|
137
|
-
|
|
138
|
-
&::-webkit-slider-runnable-track {
|
|
139
|
-
background: ${theme.colors.grayLight};
|
|
140
|
-
cursor: not-allowed;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
&::-moz-range-track {
|
|
144
|
-
background: ${theme.colors.grayLight};
|
|
145
|
-
cursor: not-allowed;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
&::-webkit-slider-thumb {
|
|
149
|
-
background: ${theme.colors.gray};
|
|
150
|
-
cursor: not-allowed;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
&::-moz-range-thumb {
|
|
154
|
-
background: ${theme.colors.gray};
|
|
155
|
-
cursor: not-allowed;
|
|
156
|
-
}
|
|
157
|
-
`}
|
|
158
|
-
|
|
159
|
-
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
160
|
-
|
|
161
|
-
${({ $size }) => {
|
|
162
|
-
if ($size === "big") {
|
|
163
|
-
return `
|
|
164
|
-
height: 32px;
|
|
165
|
-
|
|
166
|
-
&::-webkit-slider-runnable-track {
|
|
167
|
-
height: 14px;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
&::-moz-range-track {
|
|
171
|
-
height: 10px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
&::-webkit-slider-thumb {
|
|
175
|
-
width: 32px;
|
|
176
|
-
height: 32px;
|
|
177
|
-
margin-top: -11px;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&::-moz-range-thumb {
|
|
181
|
-
width: 32px;
|
|
182
|
-
height: 32px;
|
|
183
|
-
}
|
|
184
|
-
`;
|
|
185
|
-
} else {
|
|
186
|
-
return `
|
|
187
|
-
height: 22px;
|
|
188
|
-
|
|
189
|
-
&::-webkit-slider-runnable-track {
|
|
190
|
-
height: 10px;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
&::-moz-range-track {
|
|
194
|
-
height: 6px;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&::-webkit-slider-thumb {
|
|
198
|
-
width: 22px;
|
|
199
|
-
height: 22px;
|
|
200
|
-
margin-top: -8px;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&::-moz-range-thumb {
|
|
204
|
-
width: 22px;
|
|
205
|
-
height: 22px;
|
|
206
|
-
}
|
|
207
|
-
`;
|
|
208
|
-
}
|
|
209
|
-
}}
|
|
210
|
-
`;
|
|
211
|
-
|
|
212
|
-
function Range({ ...props }: InputProps) {
|
|
213
|
-
return (
|
|
214
|
-
<StyledInputWrapper $fullWidth={props.$fullWidth}>
|
|
215
|
-
{props.$label && (
|
|
216
|
-
<StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>
|
|
217
|
-
)}
|
|
218
|
-
<StyledInput {...props} type="range" />
|
|
219
|
-
</StyledInputWrapper>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export { Range };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
Theme,
|
|
6
|
-
IconArrow,
|
|
7
|
-
formElementHeightStyles,
|
|
8
|
-
fullWidthStyles,
|
|
9
|
-
resetButton,
|
|
10
|
-
resetInput,
|
|
11
|
-
statusBorderStyles,
|
|
12
|
-
} from "./utils";
|
|
13
|
-
import { StyledInputWrapper, StyledLabel } from "./input";
|
|
14
|
-
|
|
15
|
-
interface SelectProps extends React.InputHTMLAttributes<HTMLSelectElement> {
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
$label?: string;
|
|
18
|
-
$size?: "default" | "big";
|
|
19
|
-
$error?: boolean;
|
|
20
|
-
$success?: boolean;
|
|
21
|
-
$fullWidth?: boolean;
|
|
22
|
-
theme?: Theme;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const StyledSelect = styled.select<SelectProps>`
|
|
26
|
-
${resetButton};
|
|
27
|
-
${resetInput};
|
|
28
|
-
font-family: inherit;
|
|
29
|
-
display: inline-block;
|
|
30
|
-
padding: 15px;
|
|
31
|
-
border-radius: ${({ theme }) => theme.spacing.radius.xs};
|
|
32
|
-
font-weight: 400;
|
|
33
|
-
white-space: nowrap;
|
|
34
|
-
hyphens: auto;
|
|
35
|
-
color: ${({ theme }) => theme.colors.dark};
|
|
36
|
-
background: ${({ theme }) => theme.colors.light};
|
|
37
|
-
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
38
|
-
box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primaryLight};
|
|
39
|
-
transition: all 0.3s ease;
|
|
40
|
-
|
|
41
|
-
&::placeholder {
|
|
42
|
-
color: ${({ theme }) => theme.colors.gray};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media (hover: hover) {
|
|
46
|
-
&:hover:not([disabled]) {
|
|
47
|
-
border-color: ${({ theme }) => theme.colors.primary};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&:focus:not([disabled]) {
|
|
52
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
53
|
-
border-color: ${({ theme }) => theme.colors.primary};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:active:not([disabled]) {
|
|
57
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
${({ $size }) => formElementHeightStyles($size)}
|
|
61
|
-
|
|
62
|
-
${({ $size, theme }) =>
|
|
63
|
-
$size === "big"
|
|
64
|
-
? `font-size: ${theme.fontSizes.inputBig.lg};
|
|
65
|
-
line-height: ${theme.lineHeights.inputBig.lg};
|
|
66
|
-
`
|
|
67
|
-
: `font-size: ${theme.fontSizes.input.lg};
|
|
68
|
-
line-height: ${theme.lineHeights.input.lg};`}
|
|
69
|
-
|
|
70
|
-
${({ $error, $success, theme }) => {
|
|
71
|
-
return statusBorderStyles(
|
|
72
|
-
$error ? true : false,
|
|
73
|
-
$success ? true : false,
|
|
74
|
-
theme,
|
|
75
|
-
);
|
|
76
|
-
}}
|
|
77
|
-
|
|
78
|
-
${({ disabled, theme }) =>
|
|
79
|
-
disabled &&
|
|
80
|
-
`cursor: not-allowed;
|
|
81
|
-
background: ${theme.colors.grayLight};
|
|
82
|
-
border-color: ${theme.colors.gray};
|
|
83
|
-
color: ${theme.colors.gray};
|
|
84
|
-
`}
|
|
85
|
-
|
|
86
|
-
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
export const StyledIconWrapper = styled.span<SelectProps>`
|
|
90
|
-
position: relative;
|
|
91
|
-
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
92
|
-
|
|
93
|
-
& svg {
|
|
94
|
-
position: absolute;
|
|
95
|
-
top: 50%;
|
|
96
|
-
right: 15px;
|
|
97
|
-
transform: translateY(-50%) rotate(0);
|
|
98
|
-
transition: all 0.3s ease;
|
|
99
|
-
pointer-events: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
& select:active:not([disabled]) ~ svg,
|
|
103
|
-
& select:focus:not([disabled]) ~ svg {
|
|
104
|
-
transform: translateY(-50%) rotate(180deg);
|
|
105
|
-
}
|
|
106
|
-
`;
|
|
107
|
-
|
|
108
|
-
function Select({ ...props }: SelectProps) {
|
|
109
|
-
return (
|
|
110
|
-
<StyledInputWrapper $fullWidth={props.$fullWidth}>
|
|
111
|
-
{props.$label && (
|
|
112
|
-
<StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>
|
|
113
|
-
)}
|
|
114
|
-
<StyledIconWrapper $fullWidth={props.$fullWidth}>
|
|
115
|
-
<StyledSelect {...props}>{props.children}</StyledSelect>
|
|
116
|
-
<IconArrow />
|
|
117
|
-
</StyledIconWrapper>
|
|
118
|
-
</StyledInputWrapper>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export { Select };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { Breakpoints, mq } from "./utils";
|
|
5
|
-
|
|
6
|
-
interface SpaceProps {
|
|
7
|
-
$size?: number | "none";
|
|
8
|
-
$xs?: number | "none";
|
|
9
|
-
$sm?: number | "none";
|
|
10
|
-
$md?: number | "none";
|
|
11
|
-
$lg?: number | "none";
|
|
12
|
-
$xl?: number | "none";
|
|
13
|
-
$xxl?: number | "none";
|
|
14
|
-
$xxxl?: number | "none";
|
|
15
|
-
$horizontal?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const styles = ($size: number | "none", $horizontal: boolean) =>
|
|
19
|
-
$horizontal
|
|
20
|
-
? `display: inline-block;
|
|
21
|
-
max-height: 0;
|
|
22
|
-
min-width: ${$size}px;
|
|
23
|
-
max-width: ${$size}px;`
|
|
24
|
-
: `display: block;
|
|
25
|
-
min-height: ${$size}px;
|
|
26
|
-
max-height: ${$size}px;`;
|
|
27
|
-
|
|
28
|
-
function responsiveStyles(props: any) {
|
|
29
|
-
return Object.keys(props)
|
|
30
|
-
.filter((key) => key.startsWith("$"))
|
|
31
|
-
.map((key) => {
|
|
32
|
-
const size = key.substring(1) as keyof Breakpoints<number>;
|
|
33
|
-
return (
|
|
34
|
-
props[key] &&
|
|
35
|
-
mq(size) +
|
|
36
|
-
`{ ${styles(props[key], props.$horizontal || false)} }`
|
|
37
|
-
);
|
|
38
|
-
})
|
|
39
|
-
.join("");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const StyledSpace = styled.span<SpaceProps>`
|
|
43
|
-
${({ $horizontal, $size }) => `
|
|
44
|
-
${$size && $size !== "none" && styles($size, $horizontal || false)};
|
|
45
|
-
${$size === "none" && `display: none;`};
|
|
46
|
-
`}
|
|
47
|
-
${(props) => responsiveStyles(props)}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
function Space({ ...props }: SpaceProps) {
|
|
51
|
-
return <StyledSpace {...props} />;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { Space };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useState } from "react";
|
|
3
|
-
import { useServerInsertedHTML } from "next/navigation";
|
|
4
|
-
import { ServerStyleSheet, StyleSheetManager } from "styled-components";
|
|
5
|
-
|
|
6
|
-
function StyledComponentsRegistry({ children }: { children: React.ReactNode }) {
|
|
7
|
-
// Only create stylesheet once with lazy initial state
|
|
8
|
-
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
|
|
9
|
-
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet());
|
|
10
|
-
|
|
11
|
-
useServerInsertedHTML(() => {
|
|
12
|
-
const styles = styledComponentsStyleSheet.getStyleElement();
|
|
13
|
-
styledComponentsStyleSheet.instance.clearTag();
|
|
14
|
-
return <>{styles}</>;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
if (typeof window !== "undefined") return <>{children}</>;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
|
|
21
|
-
{children}
|
|
22
|
-
</StyleSheetManager>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { StyledComponentsRegistry };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ThemeProvider as StyledThemeProvider } from "styled-components";
|
|
4
|
-
import { theme as defaultTheme, GlobalStyles } from "../utils";
|
|
5
|
-
|
|
6
|
-
function CherryThemeProvider({
|
|
7
|
-
children,
|
|
8
|
-
theme,
|
|
9
|
-
}: {
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
theme?: any;
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<StyledThemeProvider theme={theme || defaultTheme}>
|
|
15
|
-
<GlobalStyles />
|
|
16
|
-
{children}
|
|
17
|
-
</StyledThemeProvider>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { CherryThemeProvider };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
Theme,
|
|
6
|
-
fullWidthStyles,
|
|
7
|
-
resetButton,
|
|
8
|
-
resetInput,
|
|
9
|
-
statusBorderStyles,
|
|
10
|
-
} from "./utils";
|
|
11
|
-
import { StyledInputWrapper, StyledLabel } from "./input";
|
|
12
|
-
|
|
13
|
-
interface TextareaProps
|
|
14
|
-
extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "size"> {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
$label?: string;
|
|
17
|
-
$size?: "default" | "big";
|
|
18
|
-
$error?: boolean;
|
|
19
|
-
$success?: boolean;
|
|
20
|
-
$fullWidth?: boolean;
|
|
21
|
-
theme?: Theme;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const StyledTextarea = styled.textarea<TextareaProps>`
|
|
25
|
-
${resetButton};
|
|
26
|
-
${resetInput};
|
|
27
|
-
font-family: inherit;
|
|
28
|
-
display: inline-block;
|
|
29
|
-
padding: 15px;
|
|
30
|
-
border-radius: ${({ theme }) => theme.spacing.radius.xs};
|
|
31
|
-
font-weight: 400;
|
|
32
|
-
white-space: nowrap;
|
|
33
|
-
hyphens: auto;
|
|
34
|
-
color: ${({ theme }) => theme.colors.dark};
|
|
35
|
-
background: ${({ theme }) => theme.colors.light};
|
|
36
|
-
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
37
|
-
box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primaryLight};
|
|
38
|
-
transition: all 0.3s ease;
|
|
39
|
-
min-height: 80px;
|
|
40
|
-
|
|
41
|
-
&::placeholder {
|
|
42
|
-
color: ${({ theme }) => theme.colors.gray};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media (hover: hover) {
|
|
46
|
-
&:hover:not([disabled]) {
|
|
47
|
-
border-color: ${({ theme }) => theme.colors.primary};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&:focus:not([disabled]) {
|
|
52
|
-
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
53
|
-
border-color: ${({ theme }) => theme.colors.primary};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:active:not([disabled]) {
|
|
57
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
${({ $size, theme }) =>
|
|
61
|
-
$size === "big"
|
|
62
|
-
? `font-size: ${theme.fontSizes.inputBig.lg};
|
|
63
|
-
line-height: ${theme.lineHeights.text.lg};
|
|
64
|
-
`
|
|
65
|
-
: `font-size: ${theme.fontSizes.input.lg};
|
|
66
|
-
line-height: ${theme.lineHeights.text.lg};`}
|
|
67
|
-
|
|
68
|
-
${({ $error, $success, theme }) => {
|
|
69
|
-
return statusBorderStyles(
|
|
70
|
-
$error ? true : false,
|
|
71
|
-
$success ? true : false,
|
|
72
|
-
theme,
|
|
73
|
-
);
|
|
74
|
-
}}
|
|
75
|
-
|
|
76
|
-
${({ disabled, theme }) =>
|
|
77
|
-
disabled &&
|
|
78
|
-
`cursor: not-allowed;
|
|
79
|
-
background: ${theme.colors.grayLight};
|
|
80
|
-
border-color: ${theme.colors.gray};
|
|
81
|
-
color: ${theme.colors.gray};
|
|
82
|
-
`}
|
|
83
|
-
|
|
84
|
-
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
85
|
-
`;
|
|
86
|
-
|
|
87
|
-
function Textarea({ ...props }: TextareaProps) {
|
|
88
|
-
return (
|
|
89
|
-
<StyledInputWrapper $fullWidth={props.$fullWidth}>
|
|
90
|
-
{props.$label && (
|
|
91
|
-
<StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>
|
|
92
|
-
)}
|
|
93
|
-
<StyledTextarea {...props}>{props.children}</StyledTextarea>
|
|
94
|
-
</StyledInputWrapper>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { Textarea };
|