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