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/App.tsx
CHANGED
|
@@ -1,93 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
<Button $variant="tertiary" $outline $fullWidth>
|
|
82
|
-
Button
|
|
83
|
-
</Button>
|
|
84
|
-
</Flex>
|
|
85
|
-
</Col>
|
|
86
|
-
</Grid>
|
|
87
|
-
</MaxWidth>
|
|
88
|
-
<Space $size={100} />
|
|
89
|
-
</>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default App;
|
|
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
|
+
<Grid $xsCols={1} $lgCols={3} $gap={20}>
|
|
26
|
+
<Col $xsSpan={1} $lgSpan={2}>
|
|
27
|
+
<Grid $xsCols={1} $lgCols={2} $gap={20}>
|
|
28
|
+
<Input placeholder="Placeholder" $fullWidth $label="Input" id="input-1" />
|
|
29
|
+
<Select $fullWidth $label="Select" id="select-1">
|
|
30
|
+
<option>Select</option>
|
|
31
|
+
</Select>
|
|
32
|
+
<Col $lgSpan={2}>
|
|
33
|
+
<Flex $xsGap={10} $lgGap={20} $wrap="nowrap" $justifyContent="space-between">
|
|
34
|
+
<Input type="checkbox" id="checkbox-1" />
|
|
35
|
+
<Input type="checkbox" id="checkbox-2" defaultChecked />
|
|
36
|
+
<Input type="radio" id="radio-2" name="demo-radio" />
|
|
37
|
+
<Input type="radio" id="radio-3" name="demo-radio" defaultChecked />
|
|
38
|
+
<Range />
|
|
39
|
+
<Toggle />
|
|
40
|
+
<Toggle defaultChecked />
|
|
41
|
+
</Flex>
|
|
42
|
+
</Col>
|
|
43
|
+
</Grid>
|
|
44
|
+
</Col>
|
|
45
|
+
<Textarea $label="Textarea" $fullWidth defaultValue="Textarea" id="textarea-1" />
|
|
46
|
+
</Grid>
|
|
47
|
+
<Space $size={20} />
|
|
48
|
+
<Grid $xsCols={1} $lgCols={2} $gap={20}>
|
|
49
|
+
<Col>
|
|
50
|
+
<Flex $wrap="nowrap" $gap={20}>
|
|
51
|
+
<Button $fullWidth>Button</Button>
|
|
52
|
+
<Button $variant="secondary" $fullWidth>
|
|
53
|
+
Button
|
|
54
|
+
</Button>
|
|
55
|
+
<Button $variant="tertiary" $fullWidth>
|
|
56
|
+
Button
|
|
57
|
+
</Button>
|
|
58
|
+
</Flex>
|
|
59
|
+
</Col>
|
|
60
|
+
<Col>
|
|
61
|
+
<Flex $wrap="nowrap" $gap={20}>
|
|
62
|
+
<Button $outline $fullWidth>
|
|
63
|
+
Button
|
|
64
|
+
</Button>
|
|
65
|
+
<Button $variant="secondary" $outline $fullWidth>
|
|
66
|
+
Button
|
|
67
|
+
</Button>
|
|
68
|
+
<Button $variant="tertiary" $outline $fullWidth>
|
|
69
|
+
Button
|
|
70
|
+
</Button>
|
|
71
|
+
</Flex>
|
|
72
|
+
</Col>
|
|
73
|
+
</Grid>
|
|
74
|
+
</MaxWidth>
|
|
75
|
+
<Space $size={100} />
|
|
76
|
+
</Container>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default App;
|
package/src/lib/box.tsx
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { Container, ContainerProps } from "./container";
|
|
5
|
-
import { theme as defaultTheme } from "./utils";
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
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/button.tsx
CHANGED
|
@@ -1,159 +1,162 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import styled, { css } 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
|
-
line-height: ${theme.lineHeights.button.lg};`}
|
|
130
|
-
|
|
131
|
-
${disabled &&
|
|
132
|
-
|
|
133
|
-
cursor: not-allowed;
|
|
134
|
-
background: ${theme.colors.grayLight};
|
|
135
|
-
|
|
136
|
-
color: ${theme.colors.gray};
|
|
137
|
-
`}
|
|
138
|
-
|
|
139
|
-
${$fullWidth && `width: 100%;`}
|
|
140
|
-
`;
|
|
141
|
-
|
|
142
|
-
const StyledButton = styled.button<ButtonProps>`
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { Theme, formElementHeightStyles, resetButton } from "./utils";
|
|
5
|
+
|
|
6
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
$variant?: "primary" | "secondary" | "tertiary";
|
|
9
|
+
$size?: "default" | "big";
|
|
10
|
+
$outline?: boolean;
|
|
11
|
+
$fullWidth?: boolean;
|
|
12
|
+
$icon?: React.ReactNode;
|
|
13
|
+
$iconPosition?: "left" | "right";
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const buttonStyles = (
|
|
18
|
+
theme: Theme,
|
|
19
|
+
$variant?: "primary" | "secondary" | "tertiary",
|
|
20
|
+
$size?: "default" | "big",
|
|
21
|
+
$outline?: boolean,
|
|
22
|
+
$fullWidth?: boolean,
|
|
23
|
+
disabled?: boolean,
|
|
24
|
+
) => css`
|
|
25
|
+
${resetButton};
|
|
26
|
+
font-family: inherit;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
padding: 15px 30px;
|
|
29
|
+
border-radius: 100px;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
hyphens: auto;
|
|
33
|
+
color: ${theme.isDark ? theme.colors.dark : theme.colors.light};
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
transition: all 0.3s ease;
|
|
36
|
+
text-align: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
|
|
41
|
+
& .icon,
|
|
42
|
+
& .lucide {
|
|
43
|
+
margin: auto 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
${!disabled &&
|
|
47
|
+
$variant === "primary" &&
|
|
48
|
+
css`
|
|
49
|
+
color: ${$outline ? theme.colors.primary : theme.colors.light};
|
|
50
|
+
background: ${$outline ? "transparent" : theme.colors.primary};
|
|
51
|
+
border: solid 2px ${theme.colors.primary};
|
|
52
|
+
box-shadow: 0 0 0 0px ${theme.colors.primary};
|
|
53
|
+
|
|
54
|
+
@media (hover: hover) {
|
|
55
|
+
&:hover {
|
|
56
|
+
background: ${$outline ? "transparent" : theme.colors.primaryDark};
|
|
57
|
+
border-color: ${theme.colors.primaryDark};
|
|
58
|
+
${$outline && `color: ${theme.colors.primaryDark}`};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:focus {
|
|
63
|
+
box-shadow: 0 0 0 4px ${theme.colors.primaryLight};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:active {
|
|
67
|
+
box-shadow: 0 0 0 2px ${theme.colors.primaryLight};
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
70
|
+
|
|
71
|
+
${!disabled &&
|
|
72
|
+
$variant === "secondary" &&
|
|
73
|
+
css`
|
|
74
|
+
color: ${$outline ? theme.colors.secondary : theme.colors.light};
|
|
75
|
+
background: ${$outline ? "transparent" : theme.colors.secondary};
|
|
76
|
+
border: solid 2px ${theme.colors.secondary};
|
|
77
|
+
box-shadow: 0 0 0 0px ${theme.colors.secondary};
|
|
78
|
+
|
|
79
|
+
@media (hover: hover) {
|
|
80
|
+
&:hover {
|
|
81
|
+
background: ${$outline ? "transparent" : theme.colors.secondaryDark};
|
|
82
|
+
border-color: ${theme.colors.secondaryDark};
|
|
83
|
+
${$outline && `color: ${theme.colors.secondaryDark}`};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:focus {
|
|
88
|
+
box-shadow: 0 0 0 4px ${theme.colors.secondaryLight};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:active {
|
|
92
|
+
box-shadow: 0 0 0 2px ${theme.colors.secondaryLight};
|
|
93
|
+
}
|
|
94
|
+
`}
|
|
95
|
+
|
|
96
|
+
${!disabled &&
|
|
97
|
+
$variant === "tertiary" &&
|
|
98
|
+
css`
|
|
99
|
+
color: ${$outline ? theme.colors.tertiary : theme.colors.light};
|
|
100
|
+
background: ${$outline ? "transparent" : theme.colors.tertiary};
|
|
101
|
+
border: solid 2px ${theme.colors.tertiary};
|
|
102
|
+
box-shadow: 0 0 0 0px ${theme.colors.tertiary};
|
|
103
|
+
|
|
104
|
+
@media (hover: hover) {
|
|
105
|
+
&:hover {
|
|
106
|
+
background: ${$outline ? "transparent" : theme.colors.tertiaryDark};
|
|
107
|
+
border-color: ${theme.colors.tertiaryDark};
|
|
108
|
+
${$outline && `color: ${theme.colors.tertiaryDark}`};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:focus {
|
|
113
|
+
box-shadow: 0 0 0 4px ${theme.colors.tertiaryLight};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:active {
|
|
117
|
+
box-shadow: 0 0 0 2px ${theme.colors.tertiaryLight};
|
|
118
|
+
}
|
|
119
|
+
`}
|
|
120
|
+
|
|
121
|
+
${formElementHeightStyles($size)}
|
|
122
|
+
|
|
123
|
+
${$size === "big"
|
|
124
|
+
? `font-size: ${theme.fontSizes.buttonBig.lg};
|
|
125
|
+
line-height: ${theme.lineHeights.buttonBig.lg};
|
|
126
|
+
padding: 18px 30px;
|
|
127
|
+
`
|
|
128
|
+
: `font-size: ${theme.fontSizes.button.lg};
|
|
129
|
+
line-height: ${theme.lineHeights.button.lg};`}
|
|
130
|
+
|
|
131
|
+
${disabled &&
|
|
132
|
+
`
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
background: ${theme.colors.grayLight};
|
|
135
|
+
border: solid 2px ${theme.colors.grayLight};
|
|
136
|
+
color: ${theme.colors.gray};
|
|
137
|
+
`}
|
|
138
|
+
|
|
139
|
+
${$fullWidth && `width: 100%;`}
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
const StyledButton = styled.button<ButtonProps>`
|
|
143
|
+
${({ theme, $variant, $size, $outline, $fullWidth, disabled }) =>
|
|
144
|
+
buttonStyles(theme, $variant, $size, $outline, $fullWidth, disabled)}
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
function LocalButton(
|
|
148
|
+
{ $variant = "primary", ...props }: ButtonProps,
|
|
149
|
+
ref: React.Ref<HTMLButtonElement>,
|
|
150
|
+
) {
|
|
151
|
+
return (
|
|
152
|
+
<StyledButton $variant={$variant} {...props} ref={ref}>
|
|
153
|
+
{props.$iconPosition !== "right" && props.$icon && props.$icon}
|
|
154
|
+
{props.children}
|
|
155
|
+
{props.$iconPosition === "right" && props.$icon && props.$icon}
|
|
156
|
+
</StyledButton>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const Button = forwardRef(LocalButton);
|
|
161
|
+
|
|
162
|
+
export { Button };
|
package/src/lib/col.tsx
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const StyledCol = styled.div<ColProps>`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
grid-column: span ${$span};
|
|
24
|
-
`}
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
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 { 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({ theme = defaultTheme, ...props }: ColProps, ref: React.Ref<HTMLDivElement>) {
|
|
36
|
+
return (
|
|
37
|
+
<StyledCol {...props} theme={theme} ref={ref}>
|
|
38
|
+
{props.children}
|
|
39
|
+
</StyledCol>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const Col = forwardRef(LocalCol);
|
|
44
|
+
|
|
45
|
+
export { Col };
|