cherry-styled-components 0.1.11 → 0.1.13

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 (73) hide show
  1. package/README.md +2 -0
  2. package/dist/box.js +17 -0
  3. package/{src/lib/button.tsx → dist/button.js} +45 -98
  4. package/dist/col.js +25 -0
  5. package/dist/container.js +36 -0
  6. package/dist/flex.js +40 -0
  7. package/dist/grid.js +39 -0
  8. package/dist/icon.js +26 -0
  9. package/dist/index.js +89 -0
  10. package/{src/lib/input.tsx → dist/input.js} +95 -151
  11. package/dist/lib/button.d.ts +2 -3
  12. package/dist/lib/col.d.ts +0 -2
  13. package/dist/lib/container.d.ts +0 -2
  14. package/dist/lib/flex.d.ts +1 -3
  15. package/dist/lib/grid.d.ts +0 -2
  16. package/dist/lib/icon.d.ts +2 -1
  17. package/dist/lib/input.d.ts +0 -3
  18. package/dist/lib/range.d.ts +0 -2
  19. package/dist/lib/select.d.ts +0 -2
  20. package/dist/lib/styled-components/theme-provider.d.ts +1 -1
  21. package/dist/lib/textarea.d.ts +0 -2
  22. package/dist/lib/toggle.d.ts +0 -2
  23. package/dist/lib/utils/mixins.d.ts +2 -2
  24. package/dist/lib/utils/theme.d.ts +1 -2
  25. package/dist/lib/utils/typography.d.ts +3 -2
  26. package/dist/max-width.js +35 -0
  27. package/{src/lib/range.tsx → dist/range.js} +44 -71
  28. package/dist/select.js +108 -0
  29. package/dist/space.js +37 -0
  30. package/dist/styled-components/registry.js +25 -0
  31. package/dist/styled-components/theme-provider.js +35 -0
  32. package/dist/textarea.js +86 -0
  33. package/{src/lib/toggle.tsx → dist/toggle.js} +41 -67
  34. package/{src/lib/utils/global.tsx → dist/utils/global.js} +4 -5
  35. package/dist/utils/icons.js +86 -0
  36. package/{src/lib/utils/mixins.tsx → dist/utils/mixins.js} +23 -51
  37. package/dist/utils/theme.js +156 -0
  38. package/dist/utils/typography.js +51 -0
  39. package/package.json +28 -10
  40. package/.claude/settings.local.json +0 -21
  41. package/.eslintrc.cjs +0 -18
  42. package/.prettierignore +0 -5
  43. package/.prettierrc +0 -11
  44. package/.supermaven/config.json +0 -6
  45. package/CLAUDE.md +0 -70
  46. package/dist/cherry.js +0 -22802
  47. package/dist/cherry.umd.cjs +0 -1424
  48. package/index.html +0 -13
  49. package/pnpm-workspace.yaml +0 -3
  50. package/src/App.tsx +0 -311
  51. package/src/lib/box.tsx +0 -26
  52. package/src/lib/col.tsx +0 -48
  53. package/src/lib/container.tsx +0 -69
  54. package/src/lib/flex.tsx +0 -99
  55. package/src/lib/grid.tsx +0 -76
  56. package/src/lib/icon.tsx +0 -19
  57. package/src/lib/index.ts +0 -16
  58. package/src/lib/max-width.tsx +0 -53
  59. package/src/lib/select.tsx +0 -136
  60. package/src/lib/space.tsx +0 -55
  61. package/src/lib/styled-components/index.ts +0 -2
  62. package/src/lib/styled-components/registry.tsx +0 -29
  63. package/src/lib/styled-components/theme-provider.tsx +0 -50
  64. package/src/lib/textarea.tsx +0 -118
  65. package/src/lib/utils/icons.tsx +0 -84
  66. package/src/lib/utils/index.ts +0 -5
  67. package/src/lib/utils/theme.ts +0 -297
  68. package/src/lib/utils/typography.tsx +0 -204
  69. package/src/main.tsx +0 -19
  70. package/src/toggle-theme.tsx +0 -25
  71. package/src/vite-env.d.ts +0 -8
  72. package/tsconfig.json +0 -24
  73. package/vite.config.js +0 -24
package/index.html DELETED
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,3 +0,0 @@
1
- ignoredBuiltDependencies:
2
- - esbuild
3
- - sharp
package/src/App.tsx DELETED
@@ -1,311 +0,0 @@
1
- import {
2
- Container,
3
- Button,
4
- Col,
5
- Flex,
6
- Grid,
7
- Input,
8
- MaxWidth,
9
- Range,
10
- Select,
11
- Space,
12
- Textarea,
13
- Toggle,
14
- } from "./lib";
15
- import { ToggleTheme } from "./toggle-theme";
16
-
17
- function App() {
18
- return (
19
- <Container>
20
- <Space $size={100} />
21
- <MaxWidth $xs={845}>
22
- <ToggleTheme />
23
- <hr />
24
- <Input $fullWidth $label="Input" id="data-1" type="date" />
25
- <Space $size={20} />
26
- <Grid $xsCols={1} $lgCols={3} $gap={20}>
27
- <Col $xsSpan={1} $lgSpan={2}>
28
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
29
- <Input
30
- placeholder="Placeholder"
31
- $fullWidth
32
- $label="Input"
33
- id="input-1"
34
- />
35
- <Select $fullWidth $label="Select" id="select-1">
36
- <option>Select</option>
37
- </Select>
38
- <Col $lgSpan={2}>
39
- <Flex
40
- $xsGap={10}
41
- $lgGap={20}
42
- $wrap="nowrap"
43
- $justifyContent="space-between"
44
- >
45
- <Input type="checkbox" id="checkbox-1" />
46
- <Input type="checkbox" id="checkbox-2" defaultChecked />
47
- <Input type="radio" id="radio-2" name="demo-radio" />
48
- <Input
49
- type="radio"
50
- id="radio-3"
51
- name="demo-radio"
52
- defaultChecked
53
- />
54
- <Range />
55
- <Toggle />
56
- <Toggle defaultChecked />
57
- </Flex>
58
- </Col>
59
- </Grid>
60
- </Col>
61
- <Textarea
62
- $label="Textarea"
63
- $fullWidth
64
- defaultValue="Textarea"
65
- id="textarea-1"
66
- />
67
- </Grid>
68
- <Space $size={20} />
69
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
70
- <Col>
71
- <Flex $wrap="nowrap" $gap={20}>
72
- <Button $fullWidth>Button</Button>
73
- <Button $variant="secondary" $fullWidth>
74
- Button
75
- </Button>
76
- <Button $variant="tertiary" $fullWidth>
77
- Button
78
- </Button>
79
- </Flex>
80
- </Col>
81
- <Col>
82
- <Flex $wrap="nowrap" $gap={20}>
83
- <Button $outline $fullWidth>
84
- Button
85
- </Button>
86
- <Button $variant="secondary" $outline $fullWidth>
87
- Button
88
- </Button>
89
- <Button $variant="tertiary" $outline $fullWidth>
90
- Button
91
- </Button>
92
- </Flex>
93
- </Col>
94
- </Grid>
95
-
96
- <Space $size={40} />
97
- <hr />
98
- <Space $size={20} />
99
-
100
- {/* Big Size */}
101
- <h2>Big</h2>
102
- <Space $size={10} />
103
- <Input
104
- $size="big"
105
- $fullWidth
106
- $label="Input Big"
107
- id="date-big"
108
- type="date"
109
- />
110
- <Space $size={20} />
111
- <Grid $xsCols={1} $lgCols={3} $gap={20}>
112
- <Col $xsSpan={1} $lgSpan={2}>
113
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
114
- <Input
115
- $size="big"
116
- placeholder="Placeholder"
117
- $fullWidth
118
- $label="Input Big"
119
- id="input-big"
120
- />
121
- <Select
122
- $size="big"
123
- $fullWidth
124
- $label="Select Big"
125
- id="select-big"
126
- >
127
- <option>Select</option>
128
- </Select>
129
- <Col $lgSpan={2}>
130
- <Flex
131
- $xsGap={10}
132
- $lgGap={20}
133
- $wrap="nowrap"
134
- $justifyContent="space-between"
135
- >
136
- <Input $size="big" type="checkbox" id="checkbox-big-1" />
137
- <Input
138
- $size="big"
139
- type="checkbox"
140
- id="checkbox-big-2"
141
- defaultChecked
142
- />
143
- <Input
144
- $size="big"
145
- type="radio"
146
- id="radio-big-1"
147
- name="demo-radio-big"
148
- />
149
- <Input
150
- $size="big"
151
- type="radio"
152
- id="radio-big-2"
153
- name="demo-radio-big"
154
- defaultChecked
155
- />
156
- <Range $size="big" />
157
- <Toggle $size="big" />
158
- <Toggle $size="big" defaultChecked />
159
- </Flex>
160
- </Col>
161
- </Grid>
162
- </Col>
163
- <Textarea
164
- $size="big"
165
- $label="Textarea Big"
166
- $fullWidth
167
- defaultValue="Textarea"
168
- id="textarea-big"
169
- />
170
- </Grid>
171
- <Space $size={20} />
172
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
173
- <Col>
174
- <Flex $wrap="nowrap" $gap={20}>
175
- <Button $size="big" $fullWidth>
176
- Button
177
- </Button>
178
- <Button $size="big" $variant="secondary" $fullWidth>
179
- Button
180
- </Button>
181
- <Button $size="big" $variant="tertiary" $fullWidth>
182
- Button
183
- </Button>
184
- </Flex>
185
- </Col>
186
- <Col>
187
- <Flex $wrap="nowrap" $gap={20}>
188
- <Button $size="big" $outline $fullWidth>
189
- Button
190
- </Button>
191
- <Button $size="big" $variant="secondary" $outline $fullWidth>
192
- Button
193
- </Button>
194
- <Button $size="big" $variant="tertiary" $outline $fullWidth>
195
- Button
196
- </Button>
197
- </Flex>
198
- </Col>
199
- </Grid>
200
-
201
- <Space $size={40} />
202
- <hr />
203
- <Space $size={20} />
204
-
205
- {/* Small Size */}
206
- <h2>Small</h2>
207
- <Space $size={10} />
208
- <Input
209
- $size="small"
210
- $fullWidth
211
- $label="Input Small"
212
- id="date-small"
213
- type="date"
214
- />
215
- <Space $size={20} />
216
- <Grid $xsCols={1} $lgCols={3} $gap={20}>
217
- <Col $xsSpan={1} $lgSpan={2}>
218
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
219
- <Input
220
- $size="small"
221
- placeholder="Placeholder"
222
- $fullWidth
223
- $label="Input Small"
224
- id="input-small"
225
- />
226
- <Select
227
- $size="small"
228
- $fullWidth
229
- $label="Select Small"
230
- id="select-small"
231
- >
232
- <option>Select</option>
233
- </Select>
234
- <Col $lgSpan={2}>
235
- <Flex
236
- $xsGap={10}
237
- $lgGap={20}
238
- $wrap="nowrap"
239
- $justifyContent="space-between"
240
- >
241
- <Input $size="small" type="checkbox" id="checkbox-small-1" />
242
- <Input
243
- $size="small"
244
- type="checkbox"
245
- id="checkbox-small-2"
246
- defaultChecked
247
- />
248
- <Input
249
- $size="small"
250
- type="radio"
251
- id="radio-small-1"
252
- name="demo-radio-small"
253
- />
254
- <Input
255
- $size="small"
256
- type="radio"
257
- id="radio-small-2"
258
- name="demo-radio-small"
259
- defaultChecked
260
- />
261
- <Range $size="small" />
262
- <Toggle $size="small" />
263
- <Toggle $size="small" defaultChecked />
264
- </Flex>
265
- </Col>
266
- </Grid>
267
- </Col>
268
- <Textarea
269
- $size="small"
270
- $label="Textarea Small"
271
- $fullWidth
272
- defaultValue="Textarea"
273
- id="textarea-small"
274
- />
275
- </Grid>
276
- <Space $size={20} />
277
- <Grid $xsCols={1} $lgCols={2} $gap={20}>
278
- <Col>
279
- <Flex $wrap="nowrap" $gap={20}>
280
- <Button $size="small" $fullWidth>
281
- Button
282
- </Button>
283
- <Button $size="small" $variant="secondary" $fullWidth>
284
- Button
285
- </Button>
286
- <Button $size="small" $variant="tertiary" $fullWidth>
287
- Button
288
- </Button>
289
- </Flex>
290
- </Col>
291
- <Col>
292
- <Flex $wrap="nowrap" $gap={20}>
293
- <Button $size="small" $outline $fullWidth>
294
- Button
295
- </Button>
296
- <Button $size="small" $variant="secondary" $outline $fullWidth>
297
- Button
298
- </Button>
299
- <Button $size="small" $variant="tertiary" $outline $fullWidth>
300
- Button
301
- </Button>
302
- </Flex>
303
- </Col>
304
- </Grid>
305
- </MaxWidth>
306
- <Space $size={100} />
307
- </Container>
308
- );
309
- }
310
-
311
- export default App;
package/src/lib/box.tsx DELETED
@@ -1,26 +0,0 @@
1
- "use client";
2
- import React, { forwardRef } from "react";
3
- import styled from "styled-components";
4
- import { Container, ContainerProps } from "./container";
5
- import { theme as defaultTheme } from "./utils";
6
-
7
- const StyledBox = styled(Container)<ContainerProps>`
8
- background: ${({ theme }) => theme.colors.light};
9
- border-radius: ${({ theme }) => theme.spacing.radius.lg};
10
- border: solid 1px ${({ theme }) => theme.colors.grayLight};
11
- `;
12
-
13
- function LocalBox(
14
- { theme = defaultTheme, ...props }: ContainerProps,
15
- ref: React.Ref<HTMLDivElement>,
16
- ) {
17
- return (
18
- <StyledBox {...props} theme={theme} ref={ref}>
19
- {props.children}
20
- </StyledBox>
21
- );
22
- }
23
-
24
- const Box = forwardRef(LocalBox);
25
-
26
- export { Box };
package/src/lib/col.tsx DELETED
@@ -1,48 +0,0 @@
1
- "use client";
2
- import React, { forwardRef } from "react";
3
- import styled from "styled-components";
4
- import { theme as defaultTheme, Theme, generateColSpanStyles } from "./utils";
5
-
6
- interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
7
- children?: React.ReactNode;
8
- $span?: number;
9
- $xsSpan?: number;
10
- $smSpan?: number;
11
- $mdSpan?: number;
12
- $lgSpan?: number;
13
- $xlSpan?: number;
14
- $xxlSpan?: number;
15
- $xxxlSpan?: number;
16
- theme?: Theme;
17
- }
18
-
19
- const StyledCol = styled.div<ColProps>`
20
- ${({ $span }) =>
21
- $span &&
22
- `
23
- grid-column: span ${$span};
24
- `}
25
-
26
- ${({ $xsSpan }) => $xsSpan && generateColSpanStyles("xs", $xsSpan)}
27
- ${({ $smSpan }) => $smSpan && generateColSpanStyles("sm", $smSpan)}
28
- ${({ $mdSpan }) => $mdSpan && generateColSpanStyles("md", $mdSpan)}
29
- ${({ $lgSpan }) => $lgSpan && generateColSpanStyles("lg", $lgSpan)}
30
- ${({ $xlSpan }) => $xlSpan && generateColSpanStyles("xl", $xlSpan)}
31
- ${({ $xxlSpan }) => $xxlSpan && generateColSpanStyles("xxl", $xxlSpan)}
32
- ${({ $xxxlSpan }) => $xxxlSpan && generateColSpanStyles("xxxl", $xxxlSpan)}
33
- `;
34
-
35
- function LocalCol(
36
- { theme = defaultTheme, ...props }: ColProps,
37
- ref: React.Ref<HTMLDivElement>,
38
- ) {
39
- return (
40
- <StyledCol {...props} theme={theme} ref={ref}>
41
- {props.children}
42
- </StyledCol>
43
- );
44
- }
45
-
46
- const Col = forwardRef(LocalCol);
47
-
48
- export { Col };
@@ -1,69 +0,0 @@
1
- "use client";
2
- import React, { forwardRef } from "react";
3
- import styled from "styled-components";
4
- import {
5
- theme as defaultTheme,
6
- Theme,
7
- mq,
8
- generatePaddingStyles,
9
- } from "./utils";
10
-
11
- export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
12
- className?: string;
13
- children?: React.ReactNode;
14
- $fluid?: boolean;
15
- $textAlign?: "right" | "left" | "center";
16
- $padding?: number | "none";
17
- $xsPadding?: number | "none";
18
- $smPadding?: number | "none";
19
- $mdPadding?: number | "none";
20
- $lgPadding?: number | "none";
21
- $xlPadding?: number | "none";
22
- $xxlPadding?: number | "none";
23
- $xxxlPadding?: number | "none";
24
- theme?: Theme;
25
- }
26
-
27
- const StyledContainer = styled.div<ContainerProps>`
28
- margin: auto;
29
- width: 100%;
30
- max-width: ${({ theme, $fluid }) =>
31
- $fluid ? `100%` : theme.spacing.maxWidth.xs};
32
- ${({ $textAlign }) => $textAlign && `text-align: ${$textAlign}`};
33
- padding: ${({ $padding, theme }) =>
34
- ($padding && `${$padding}px`) || theme.spacing.padding.xs};
35
-
36
- ${mq("lg")} {
37
- padding: ${({ $padding, theme }) =>
38
- ($padding && `${$padding}px`) || theme.spacing.padding.lg};
39
- }
40
-
41
- ${mq("xxxl")} {
42
- max-width: ${({ theme, $fluid }) =>
43
- $fluid ? `100%` : theme.spacing.maxWidth.xxxl};
44
- }
45
-
46
- ${({ $xsPadding }) => $xsPadding && generatePaddingStyles("xs", $xsPadding)}
47
- ${({ $smPadding }) => $smPadding && generatePaddingStyles("sm", $smPadding)}
48
- ${({ $mdPadding }) => $mdPadding && generatePaddingStyles("md", $mdPadding)}
49
- ${({ $lgPadding }) => $lgPadding && generatePaddingStyles("lg", $lgPadding)}
50
- ${({ $xlPadding }) => $xlPadding && generatePaddingStyles("xl", $xlPadding)}
51
- ${({ $xxlPadding }) => $xxlPadding && generatePaddingStyles("xxl", $xxlPadding)}
52
- ${({ $xxxlPadding }) =>
53
- $xxxlPadding && generatePaddingStyles("xxxl", $xxxlPadding)}
54
- `;
55
-
56
- function LocalContainer(
57
- { theme = defaultTheme, ...props }: ContainerProps,
58
- ref: React.Ref<HTMLDivElement>,
59
- ) {
60
- return (
61
- <StyledContainer {...props} theme={theme} ref={ref}>
62
- {props.children}
63
- </StyledContainer>
64
- );
65
- }
66
-
67
- const Container = forwardRef(LocalContainer);
68
-
69
- export { Container };
package/src/lib/flex.tsx DELETED
@@ -1,99 +0,0 @@
1
- "use client";
2
- import React, { forwardRef } from "react";
3
- import styled from "styled-components";
4
- import {
5
- theme as defaultTheme,
6
- Theme,
7
- mq,
8
- generateGapStyles,
9
- generateJustifyContentStyles,
10
- fullWidthStyles,
11
- } from "./utils";
12
-
13
- type JustifyContentType =
14
- | "center"
15
- | "flex-start"
16
- | "flex-end"
17
- | "space-between"
18
- | "space-around"
19
- | "space-evenly";
20
-
21
- type GapType = number | "none";
22
-
23
- interface FlexProps extends React.AllHTMLAttributes<FlexProps> {
24
- children?: React.ReactNode;
25
- $justifyContent?: JustifyContentType;
26
- $xsJustifyContent?: JustifyContentType;
27
- $smJustifyContent?: JustifyContentType;
28
- $mdJustifyContent?: JustifyContentType;
29
- $lgJustifyContent?: JustifyContentType;
30
- $xlJustifyContent?: JustifyContentType;
31
- $xxlJustifyContent?: JustifyContentType;
32
- $xxxlJustifyContent?: JustifyContentType;
33
- $wrap?: "wrap" | "nowrap" | "wrap-reverse";
34
- $gap?: GapType;
35
- $xsGap?: GapType;
36
- $smGap?: GapType;
37
- $mdGap?: GapType;
38
- $lgGap?: GapType;
39
- $xlGap?: GapType;
40
- $xxlGap?: GapType;
41
- $xxxlGap?: GapType;
42
- $direction?: "row" | "column" | "row-reverse" | "column-reverse";
43
- $fullWidth?: boolean;
44
- theme?: Theme;
45
- }
46
-
47
- const StyledFlex = styled.div<FlexProps>`
48
- display: flex;
49
- justify-content: ${({ $justifyContent }) => $justifyContent || "flex-start"};
50
- flex-wrap: ${({ $wrap }) => $wrap || "wrap"};
51
- gap: ${({ $gap, theme }) =>
52
- ($gap && `${$gap}px`) || theme.spacing.gridGap.xs};
53
- flex-direction: ${({ $direction }) => $direction || "row"};
54
-
55
- ${mq("lg")} {
56
- gap: ${({ $gap, theme }) =>
57
- ($gap && `${$gap}px`) || theme.spacing.gridGap.lg};
58
- }
59
-
60
- ${({ $xsGap }) => $xsGap && generateGapStyles("xs", $xsGap)}
61
- ${({ $xsJustifyContent }) =>
62
- $xsJustifyContent && generateJustifyContentStyles("xs", $xsJustifyContent)}
63
- ${({ $smGap }) => $smGap && generateGapStyles("sm", $smGap)}
64
- ${({ $smJustifyContent }) =>
65
- $smJustifyContent && generateJustifyContentStyles("sm", $smJustifyContent)}
66
- ${({ $mdGap }) => $mdGap && generateGapStyles("md", $mdGap)}
67
- ${({ $mdJustifyContent }) =>
68
- $mdJustifyContent && generateJustifyContentStyles("md", $mdJustifyContent)}
69
- ${({ $lgGap }) => $lgGap && generateGapStyles("lg", $lgGap)}
70
- ${({ $lgJustifyContent }) =>
71
- $lgJustifyContent && generateJustifyContentStyles("lg", $lgJustifyContent)}
72
- ${({ $xlGap }) => $xlGap && generateGapStyles("xl", $xlGap)}
73
- ${({ $xlJustifyContent }) =>
74
- $xlJustifyContent && generateJustifyContentStyles("xl", $xlJustifyContent)}
75
- ${({ $xxlGap }) => $xxlGap && generateGapStyles("xxl", $xxlGap)}
76
- ${({ $xxlJustifyContent }) =>
77
- $xxlJustifyContent &&
78
- generateJustifyContentStyles("xxl", $xxlJustifyContent)}
79
- ${({ $xxxlGap }) => $xxxlGap && generateGapStyles("xxxl", $xxxlGap)}
80
- ${({ $xxxlJustifyContent }) =>
81
- $xxxlJustifyContent &&
82
- generateJustifyContentStyles("xxxl", $xxxlJustifyContent)}
83
- ${({ $fullWidth }) => fullWidthStyles($fullWidth ? true : false)}
84
- `;
85
-
86
- function LocalFlex(
87
- { theme = defaultTheme, ...props }: FlexProps,
88
- ref: React.Ref<HTMLDivElement>,
89
- ) {
90
- return (
91
- <StyledFlex {...props} theme={theme} ref={ref}>
92
- {props.children}
93
- </StyledFlex>
94
- );
95
- }
96
-
97
- const Flex = forwardRef(LocalFlex);
98
-
99
- export { Flex };
package/src/lib/grid.tsx DELETED
@@ -1,76 +0,0 @@
1
- "use client";
2
- import React, { forwardRef } from "react";
3
- import styled from "styled-components";
4
- import {
5
- theme as defaultTheme,
6
- Theme,
7
- mq,
8
- generateColsStyles,
9
- generateGapStyles,
10
- } from "./utils";
11
-
12
- interface GridProps extends React.HTMLAttributes<HTMLDivElement> {
13
- children?: React.ReactNode;
14
- $gap?: number | "none";
15
- $xsGap?: number | "none";
16
- $smGap?: number | "none";
17
- $mdGap?: number | "none";
18
- $lgGap?: number | "none";
19
- $xlGap?: number | "none";
20
- $xxlGap?: number | "none";
21
- $xxxlGap?: number | "none";
22
- $cols?: number;
23
- $xsCols?: number;
24
- $smCols?: number;
25
- $mdCols?: number;
26
- $lgCols?: number;
27
- $xlCols?: number;
28
- $xxlCols?: number;
29
- $xxxlCols?: number;
30
- theme?: Theme;
31
- }
32
-
33
- const StyledGrid = styled.div<GridProps>`
34
- width: 100%;
35
- display: grid;
36
- grid-template-columns: ${({ $cols }) =>
37
- `repeat(${$cols || 3}, minmax(0, 1fr))`};
38
- gap: ${({ $gap, theme }) =>
39
- ($gap && `${$gap}px`) || theme.spacing.gridGap.xs};
40
-
41
- ${mq("lg")} {
42
- gap: ${({ $gap, theme }) =>
43
- ($gap && `${$gap}px`) || theme.spacing.gridGap.lg};
44
- }
45
-
46
- ${({ $xsGap }) => $xsGap && generateGapStyles("xs", $xsGap)}
47
- ${({ $smGap }) => $smGap && generateGapStyles("sm", $smGap)}
48
- ${({ $mdGap }) => $mdGap && generateGapStyles("md", $mdGap)}
49
- ${({ $lgGap }) => $lgGap && generateGapStyles("lg", $lgGap)}
50
- ${({ $xlGap }) => $xlGap && generateGapStyles("xl", $xlGap)}
51
- ${({ $xxlGap }) => $xxlGap && generateGapStyles("xxl", $xxlGap)}
52
- ${({ $xxxlGap }) => $xxxlGap && generateGapStyles("xxxl", $xxxlGap)}
53
-
54
- ${({ $xsCols }) => $xsCols && generateColsStyles("xs", $xsCols)}
55
- ${({ $smCols }) => $smCols && generateColsStyles("sm", $smCols)}
56
- ${({ $mdCols }) => $mdCols && generateColsStyles("md", $mdCols)}
57
- ${({ $lgCols }) => $lgCols && generateColsStyles("lg", $lgCols)}
58
- ${({ $xlCols }) => $xlCols && generateColsStyles("xl", $xlCols)}
59
- ${({ $xxlCols }) => $xxlCols && generateColsStyles("xxl", $xxlCols)}
60
- ${({ $xxxlCols }) => $xxxlCols && generateColsStyles("xxxl", $xxxlCols)}
61
- `;
62
-
63
- function LocalGrid(
64
- { theme = defaultTheme, ...props }: GridProps,
65
- ref: React.Ref<HTMLDivElement>,
66
- ) {
67
- return (
68
- <StyledGrid {...props} theme={theme} ref={ref}>
69
- {props.children}
70
- </StyledGrid>
71
- );
72
- }
73
-
74
- const Grid = forwardRef(LocalGrid);
75
-
76
- export { Grid };
package/src/lib/icon.tsx DELETED
@@ -1,19 +0,0 @@
1
- import { icons } from "lucide-react";
2
-
3
- export type IconProps = keyof typeof icons;
4
-
5
- interface Props {
6
- name: IconProps;
7
- color?: string;
8
- size?: number;
9
- className?: string;
10
- }
11
-
12
- const Icon = ({ name, color, size, className }: Props) => {
13
- const LucideIcon = icons[name];
14
- if (!LucideIcon) return null;
15
-
16
- return <LucideIcon color={color} size={size} className={className} />;
17
- };
18
-
19
- export { Icon };
package/src/lib/index.ts DELETED
@@ -1,16 +0,0 @@
1
- export * from "./styled-components";
2
- export * from "./utils";
3
- export * from "./box";
4
- export * from "./button";
5
- export * from "./col";
6
- export * from "./container";
7
- export * from "./flex";
8
- export * from "./grid";
9
- export * from "./icon";
10
- export * from "./input";
11
- export * from "./max-width";
12
- export * from "./range";
13
- export * from "./select";
14
- export * from "./space";
15
- export * from "./textarea";
16
- export * from "./toggle";