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/textarea.tsx
CHANGED
|
@@ -1,103 +1,94 @@
|
|
|
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
|
-
<StyledTextarea {...props} theme={theme}>
|
|
97
|
-
{props.children}
|
|
98
|
-
</StyledTextarea>
|
|
99
|
-
</StyledInputWrapper>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export { Textarea };
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Theme, fullWidthStyles, resetButton, resetInput, statusBorderStyles } from "./utils";
|
|
5
|
+
import { StyledInputWrapper, StyledLabel } from "./input";
|
|
6
|
+
|
|
7
|
+
interface TextareaProps extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "size"> {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
$label?: string;
|
|
10
|
+
$size?: "default" | "big";
|
|
11
|
+
$error?: boolean;
|
|
12
|
+
$success?: boolean;
|
|
13
|
+
$fullWidth?: boolean;
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
rows?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const StyledTextarea = styled.textarea<TextareaProps>`
|
|
19
|
+
${resetButton};
|
|
20
|
+
${resetInput};
|
|
21
|
+
font-family: inherit;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
padding: 15px;
|
|
24
|
+
border-radius: ${({ theme }) => theme.spacing.radius.xs};
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
white-space: break-spaces;
|
|
27
|
+
hyphens: none;
|
|
28
|
+
color: ${({ theme }) => theme.colors.dark};
|
|
29
|
+
background: ${({ theme }) => theme.colors.light};
|
|
30
|
+
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
31
|
+
box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primaryLight};
|
|
32
|
+
transition: all 0.3s ease;
|
|
33
|
+
min-height: 80px;
|
|
34
|
+
|
|
35
|
+
&::placeholder {
|
|
36
|
+
color: ${({ theme }) => theme.colors.gray};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (hover: hover) {
|
|
40
|
+
&:hover:not([disabled]) {
|
|
41
|
+
border-color: ${({ theme }) => theme.colors.primary};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:focus:not([disabled]) {
|
|
46
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
47
|
+
border-color: ${({ theme }) => theme.colors.primary};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:active:not([disabled]) {
|
|
51
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
${({ $size, theme }) =>
|
|
55
|
+
$size === "big"
|
|
56
|
+
? `font-size: ${theme.fontSizes.inputBig.lg};
|
|
57
|
+
line-height: ${theme.lineHeights.text.lg};
|
|
58
|
+
`
|
|
59
|
+
: `font-size: ${theme.fontSizes.input.lg};
|
|
60
|
+
line-height: ${theme.lineHeights.text.lg};`}
|
|
61
|
+
|
|
62
|
+
${({ $error, $success, theme }) => {
|
|
63
|
+
return statusBorderStyles($error ? true : false, $success ? true : false, theme);
|
|
64
|
+
}}
|
|
65
|
+
|
|
66
|
+
${({ disabled, theme }) =>
|
|
67
|
+
disabled &&
|
|
68
|
+
`cursor: not-allowed;
|
|
69
|
+
background: ${theme.colors.grayLight};
|
|
70
|
+
border-color: ${theme.colors.gray};
|
|
71
|
+
color: ${theme.colors.gray};
|
|
72
|
+
`}
|
|
73
|
+
|
|
74
|
+
${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
function LocalTextarea({ ...props }: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {
|
|
78
|
+
return (
|
|
79
|
+
<StyledInputWrapper $fullWidth={props.$fullWidth} $label={props.$label}>
|
|
80
|
+
{props.$label && (
|
|
81
|
+
<StyledLabel htmlFor={props.id} $label={props.$label}>
|
|
82
|
+
{props.$label}
|
|
83
|
+
</StyledLabel>
|
|
84
|
+
)}
|
|
85
|
+
<StyledTextarea {...props} ref={ref}>
|
|
86
|
+
{props.children}
|
|
87
|
+
</StyledTextarea>
|
|
88
|
+
</StyledInputWrapper>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const Textarea = forwardRef(LocalTextarea);
|
|
93
|
+
|
|
94
|
+
export { Textarea };
|
package/src/lib/toggle.tsx
CHANGED
|
@@ -1,160 +1,147 @@
|
|
|
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
|
-
|
|
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
|
-
theme={theme}
|
|
149
|
-
/>
|
|
150
|
-
</StyledToggleWrapper>
|
|
151
|
-
{props.$label && (
|
|
152
|
-
<StyledLabel htmlFor={props.id} theme={theme}>
|
|
153
|
-
{props.$label}
|
|
154
|
-
</StyledLabel>
|
|
155
|
-
)}
|
|
156
|
-
</StyledInputWrapper>
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export { Toggle };
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Theme, resetButton, statusBorderStyles } from "./utils";
|
|
5
|
+
import { StyledInputWrapper, StyledLabel } from "./input";
|
|
6
|
+
|
|
7
|
+
interface ToggleProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
type?: "checkbox" | "radio";
|
|
10
|
+
$label?: string;
|
|
11
|
+
$size?: "default" | "big";
|
|
12
|
+
$error?: boolean;
|
|
13
|
+
$success?: boolean;
|
|
14
|
+
$fullWidth?: boolean;
|
|
15
|
+
theme?: Theme;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const StyledToggleWrapper = styled.span<ToggleProps>`
|
|
19
|
+
display: inline-block;
|
|
20
|
+
margin: auto 0;
|
|
21
|
+
position: relative;
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const StyledFakeToggle = styled.span<ToggleProps>`
|
|
26
|
+
display: block;
|
|
27
|
+
border: solid 2px ${({ theme }) => theme.colors.grayLight};
|
|
28
|
+
background: ${({ theme }) => theme.colors.light};
|
|
29
|
+
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
transition: all 0.3s ease;
|
|
32
|
+
box-shadow: 0 0 0 0 ${({ theme }) => theme.colors.primaryLight};
|
|
33
|
+
transform: none;
|
|
34
|
+
width: ${({ $size }) => ($size === "big" ? "56px" : "46px")};
|
|
35
|
+
height: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
|
|
36
|
+
|
|
37
|
+
${({ $error, $success, theme }) => {
|
|
38
|
+
return statusBorderStyles($error ? true : false, $success ? true : false, theme);
|
|
39
|
+
}}
|
|
40
|
+
|
|
41
|
+
&::before,
|
|
42
|
+
&::after {
|
|
43
|
+
content: "";
|
|
44
|
+
display: block;
|
|
45
|
+
position: absolute;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&::before {
|
|
49
|
+
top: 5px;
|
|
50
|
+
left: 5px;
|
|
51
|
+
width: calc(100% - 10px);
|
|
52
|
+
height: calc(100% - 10px);
|
|
53
|
+
max-width: 0;
|
|
54
|
+
border-radius: ${({ theme }) => theme.spacing.radius.xl};
|
|
55
|
+
background: ${({ theme }) => theme.colors.light};
|
|
56
|
+
transition: all 0.3s ease;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&::after {
|
|
60
|
+
left: 0;
|
|
61
|
+
top: 0;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
transition: all 0.3s ease;
|
|
64
|
+
transform: translateX(0);
|
|
65
|
+
background: ${({ theme }) => theme.colors.primary};
|
|
66
|
+
width: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
|
|
67
|
+
height: ${({ $size }) => ($size === "big" ? "32px" : "22px")};
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
const StyledToggle = styled.input<ToggleProps>`
|
|
72
|
+
${resetButton};
|
|
73
|
+
position: absolute;
|
|
74
|
+
left: 0;
|
|
75
|
+
top: 0;
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
outline: none;
|
|
79
|
+
z-index: 10;
|
|
80
|
+
|
|
81
|
+
&:checked ~ .fake-toggle {
|
|
82
|
+
&::before {
|
|
83
|
+
max-width: 46px;
|
|
84
|
+
background: ${({ theme }) => theme.colors.primaryLight};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&::after {
|
|
88
|
+
transform: translateX(25px);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (hover: hover) {
|
|
93
|
+
&:hover:not([disabled]) ~ .fake-toggle {
|
|
94
|
+
border-color: ${({ theme }) => theme.colors.primary};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:focus:not([disabled]) ~ .fake-toggle {
|
|
99
|
+
outline: none;
|
|
100
|
+
border-color: ${({ theme }) => theme.colors.primary};
|
|
101
|
+
box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:active:not([disabled]) ~ .fake-toggle {
|
|
105
|
+
box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
${({ disabled, theme }) =>
|
|
109
|
+
disabled &&
|
|
110
|
+
`cursor: not-allowed;
|
|
111
|
+
|
|
112
|
+
& ~ .fake-toggle {
|
|
113
|
+
border-color: ${theme.colors.gray};
|
|
114
|
+
|
|
115
|
+
&::before {
|
|
116
|
+
background: ${theme.colors.grayLight};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&::after {
|
|
120
|
+
background: ${theme.colors.gray};
|
|
121
|
+
}
|
|
122
|
+
}`}
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
function LocalToggle(
|
|
126
|
+
{ type = "checkbox", ...props }: ToggleProps,
|
|
127
|
+
ref: React.Ref<HTMLInputElement>,
|
|
128
|
+
) {
|
|
129
|
+
return (
|
|
130
|
+
<StyledInputWrapper $fullWidth={props.$fullWidth} $label={props.$label}>
|
|
131
|
+
<StyledToggleWrapper>
|
|
132
|
+
<StyledToggle {...props} type={type} ref={ref} />
|
|
133
|
+
<StyledFakeToggle
|
|
134
|
+
$error={props.$error}
|
|
135
|
+
$success={props.$success}
|
|
136
|
+
className="fake-toggle"
|
|
137
|
+
$size={props.$size}
|
|
138
|
+
/>
|
|
139
|
+
</StyledToggleWrapper>
|
|
140
|
+
{props.$label && <StyledLabel htmlFor={props.id}>{props.$label}</StyledLabel>}
|
|
141
|
+
</StyledInputWrapper>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const Toggle = forwardRef(LocalToggle);
|
|
146
|
+
|
|
147
|
+
export { Toggle };
|