cherry-styled-components 0.1.0-9 → 0.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/.claude/settings.local.json +7 -0
- package/.prettierrc +9 -9
- package/.supermaven/config.json +1 -0
- package/README.md +1 -1
- package/dist/App.d.ts +0 -1
- package/dist/cherry.js +4066 -2890
- package/dist/cherry.umd.cjs +916 -791
- package/dist/lib/box.d.ts +3 -3
- package/dist/lib/button.d.ts +6 -4
- package/dist/lib/col.d.ts +3 -3
- package/dist/lib/container.d.ts +3 -3
- package/dist/lib/flex.d.ts +5 -3
- package/dist/lib/grid.d.ts +3 -3
- package/dist/lib/index.d.ts +15 -15
- package/dist/lib/input.d.ts +16 -5
- package/dist/lib/max-width.d.ts +3 -2
- package/dist/lib/range.d.ts +3 -3
- package/dist/lib/select.d.ts +5 -4
- package/dist/lib/space.d.ts +2 -2
- package/dist/lib/styled-components/index.d.ts +2 -2
- package/dist/lib/styled-components/registry.d.ts +1 -1
- package/dist/lib/styled-components/theme-provider.d.ts +10 -4
- package/dist/lib/textarea.d.ts +4 -3
- package/dist/lib/toggle.d.ts +3 -3
- package/dist/lib/utils/global.d.ts +2 -2
- package/dist/lib/utils/icons.d.ts +6 -10
- package/dist/lib/utils/index.d.ts +5 -5
- package/dist/lib/utils/mixins.d.ts +11 -11
- package/dist/lib/utils/theme.d.ts +4 -0
- package/dist/lib/utils/typography.d.ts +19 -19
- package/dist/toggle-theme.d.ts +3 -0
- package/package.json +17 -15
- package/pnpm-workspace.yaml +3 -0
- package/src/App.tsx +80 -93
- package/src/lib/box.tsx +26 -21
- package/src/lib/button.tsx +162 -159
- package/src/lib/col.tsx +45 -43
- package/src/lib/container.tsx +59 -64
- package/src/lib/flex.tsx +92 -95
- package/src/lib/grid.tsx +64 -70
- package/src/lib/index.ts +15 -15
- package/src/lib/input.tsx +384 -267
- package/src/lib/max-width.tsx +50 -43
- package/src/lib/range.tsx +208 -226
- package/src/lib/select.tsx +121 -131
- package/src/lib/space.tsx +52 -54
- package/src/lib/styled-components/index.ts +2 -2
- package/src/lib/styled-components/registry.tsx +26 -26
- package/src/lib/styled-components/theme-provider.tsx +49 -21
- package/src/lib/textarea.tsx +94 -103
- package/src/lib/toggle.tsx +147 -160
- package/src/lib/utils/global.tsx +95 -79
- package/src/lib/utils/icons.tsx +84 -170
- package/src/lib/utils/index.ts +5 -5
- package/src/lib/utils/mixins.tsx +95 -108
- package/src/lib/utils/theme.ts +289 -242
- package/src/lib/utils/typography.tsx +204 -204
- package/src/main.tsx +14 -14
- package/src/toggle-theme.tsx +25 -0
- package/src/vite-env.d.ts +8 -1
package/src/lib/max-width.tsx
CHANGED
|
@@ -1,43 +1,50 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { forwardRef } 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
|
+
$m0?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const styles = ($size: number | "none") => `max-width: ${$size}px;`;
|
|
19
|
+
|
|
20
|
+
function responsiveStyles(props: any) {
|
|
21
|
+
return Object.keys(props)
|
|
22
|
+
.filter((key) => key.startsWith("$"))
|
|
23
|
+
.map((key) => {
|
|
24
|
+
const size = key.substring(1) as keyof Breakpoints<number>;
|
|
25
|
+
return props[key] && mq(size) + `{ ${styles(props[key])} }`;
|
|
26
|
+
})
|
|
27
|
+
.join("");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const StyledMaxWidth = styled.div<MaxWidthProps>`
|
|
31
|
+
display: block;
|
|
32
|
+
margin: ${({ $m0 }) => ($m0 ? "0" : "auto")};
|
|
33
|
+
|
|
34
|
+
${({ $size }) => `
|
|
35
|
+
${$size && styles($size)};
|
|
36
|
+
`}
|
|
37
|
+
${(props) => responsiveStyles(props)}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
function LocalMaxWidth({ ...props }: MaxWidthProps, ref: React.Ref<HTMLDivElement>) {
|
|
41
|
+
return (
|
|
42
|
+
<StyledMaxWidth {...props} ref={ref}>
|
|
43
|
+
{props.children}
|
|
44
|
+
</StyledMaxWidth>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const MaxWidth = forwardRef(LocalMaxWidth);
|
|
49
|
+
|
|
50
|
+
export { MaxWidth };
|
package/src/lib/range.tsx
CHANGED
|
@@ -1,226 +1,208 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
&::-webkit-slider-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
}}
|
|
211
|
-
`;
|
|
212
|
-
|
|
213
|
-
function Range({ theme = defaultTheme, ...props }: InputProps) {
|
|
214
|
-
return (
|
|
215
|
-
<StyledInputWrapper $fullWidth={props.$fullWidth} theme={theme}>
|
|
216
|
-
{props.$label && (
|
|
217
|
-
<StyledLabel htmlFor={props.id} theme={theme}>
|
|
218
|
-
{props.$label}
|
|
219
|
-
</StyledLabel>
|
|
220
|
-
)}
|
|
221
|
-
<StyledInput {...props} type="range" theme={theme} />
|
|
222
|
-
</StyledInputWrapper>
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export { Range };
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Theme, fullWidthStyles, resetButton, statusBorderStyles } from "./utils";
|
|
5
|
+
import { StyledLabel } from "./input";
|
|
6
|
+
|
|
7
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
8
|
+
className?: string;
|
|
9
|
+
$label?: string;
|
|
10
|
+
$size?: "default" | "big";
|
|
11
|
+
$error?: boolean;
|
|
12
|
+
$success?: boolean;
|
|
13
|
+
$fullWidth?: boolean;
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const StyledInputWrapper = styled.span<InputProps>`
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
flex-wrap: ${({ type }) => (type === "checkbox" || type === "radio" ? "fprnowrap" : "wrap")};
|
|
20
|
+
gap: 10px;
|
|
21
|
+
align-items: center;
|
|
22
|
+
|
|
23
|
+
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const StyledInput = styled.input<InputProps>`
|
|
27
|
+
${resetButton};
|
|
28
|
+
padding: 0;
|
|
29
|
+
height: 10px;
|
|
30
|
+
font-size: 0;
|
|
31
|
+
background: transparent;
|
|
32
|
+
min-width: 100px;
|
|
33
|
+
|
|
34
|
+
&::-webkit-slider-runnable-track {
|
|
35
|
+
width: 100%;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
38
|
+
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
39
|
+
box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
|
|
40
|
+
transition: all 0.3s ease;
|
|
41
|
+
${({ $error, $success, theme }) => {
|
|
42
|
+
return statusBorderStyles($error ? true : false, $success ? true : false, theme);
|
|
43
|
+
}}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&::-moz-range-track {
|
|
47
|
+
width: 100%;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
50
|
+
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
51
|
+
box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
|
|
52
|
+
transition: all 0.3s ease;
|
|
53
|
+
${({ $error, $success, theme }) => {
|
|
54
|
+
return statusBorderStyles($error ? true : false, $success ? true : false, theme);
|
|
55
|
+
}}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&::-webkit-slider-thumb {
|
|
59
|
+
${resetButton};
|
|
60
|
+
background: ${({ theme }) => theme.colors.primary};
|
|
61
|
+
border: 0 solid transparent;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
transition: all 0.3s ease;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&::-moz-range-thumb {
|
|
67
|
+
${resetButton};
|
|
68
|
+
background: ${({ theme }) => theme.colors.primary};
|
|
69
|
+
border: 0 solid transparent;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
transition: all 0.3s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (hover: hover) {
|
|
75
|
+
&:hover:not([disabled]) {
|
|
76
|
+
&::-webkit-slider-runnable-track {
|
|
77
|
+
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&::-moz-range-track {
|
|
81
|
+
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:focus:not([disabled]) {
|
|
87
|
+
&::-webkit-slider-runnable-track {
|
|
88
|
+
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
89
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
90
|
+
}
|
|
91
|
+
&::-webkit-slider-thumb {
|
|
92
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
93
|
+
}
|
|
94
|
+
&::-moz-range-track {
|
|
95
|
+
border: solid 2px ${({ theme }) => theme.colors.primary};
|
|
96
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
97
|
+
}
|
|
98
|
+
&::-moz-range-thumb {
|
|
99
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:active:not([disabled]) {
|
|
104
|
+
&::-webkit-slider-runnable-track {
|
|
105
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
106
|
+
}
|
|
107
|
+
&::-webkit-slider-thumb {
|
|
108
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
109
|
+
}
|
|
110
|
+
&::-moz-range-track {
|
|
111
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
112
|
+
}
|
|
113
|
+
&::-moz-range-thumb {
|
|
114
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
${({ disabled, theme }) =>
|
|
119
|
+
disabled &&
|
|
120
|
+
`
|
|
121
|
+
cursor: not-allowed;
|
|
122
|
+
|
|
123
|
+
&::-webkit-slider-runnable-track {
|
|
124
|
+
background: ${theme.colors.grayLight};
|
|
125
|
+
cursor: not-allowed;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&::-moz-range-track {
|
|
129
|
+
background: ${theme.colors.grayLight};
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&::-webkit-slider-thumb {
|
|
134
|
+
background: ${theme.colors.gray};
|
|
135
|
+
cursor: not-allowed;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&::-moz-range-thumb {
|
|
139
|
+
background: ${theme.colors.gray};
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
}
|
|
142
|
+
`}
|
|
143
|
+
|
|
144
|
+
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
145
|
+
|
|
146
|
+
${({ $size }) => {
|
|
147
|
+
if ($size === "big") {
|
|
148
|
+
return `
|
|
149
|
+
height: 32px;
|
|
150
|
+
|
|
151
|
+
&::-webkit-slider-runnable-track {
|
|
152
|
+
height: 14px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&::-moz-range-track {
|
|
156
|
+
height: 10px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&::-webkit-slider-thumb {
|
|
160
|
+
width: 32px;
|
|
161
|
+
height: 32px;
|
|
162
|
+
margin-top: -11px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&::-moz-range-thumb {
|
|
166
|
+
width: 32px;
|
|
167
|
+
height: 32px;
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
} else {
|
|
171
|
+
return `
|
|
172
|
+
height: 22px;
|
|
173
|
+
|
|
174
|
+
&::-webkit-slider-runnable-track {
|
|
175
|
+
height: 10px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&::-moz-range-track {
|
|
179
|
+
height: 6px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&::-webkit-slider-thumb {
|
|
183
|
+
width: 22px;
|
|
184
|
+
height: 22px;
|
|
185
|
+
margin-top: -8px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&::-moz-range-thumb {
|
|
189
|
+
width: 22px;
|
|
190
|
+
height: 22px;
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
}}
|
|
195
|
+
`;
|
|
196
|
+
|
|
197
|
+
function LocalRange({ ...props }: InputProps, ref: React.Ref<HTMLInputElement>) {
|
|
198
|
+
return (
|
|
199
|
+
<StyledInputWrapper $fullWidth={props.$fullWidth}>
|
|
200
|
+
{props.$label && <StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>}
|
|
201
|
+
<StyledInput {...props} type="range" ref={ref} />
|
|
202
|
+
</StyledInputWrapper>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const Range = forwardRef(LocalRange);
|
|
207
|
+
|
|
208
|
+
export { Range };
|