cherry-styled-components 0.1.1 → 0.1.3
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 +1 -3
- package/.prettierignore +5 -0
- package/.prettierrc +2 -2
- package/.supermaven/config.json +6 -1
- package/CLAUDE.md +70 -0
- package/dist/cherry.js +20154 -2610
- package/dist/cherry.umd.cjs +650 -478
- package/dist/lib/button.d.ts +2 -1
- package/dist/lib/icon.d.ts +10 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/input.d.ts +1 -0
- package/dist/lib/range.d.ts +1 -0
- package/dist/lib/select.d.ts +1 -0
- package/dist/lib/textarea.d.ts +1 -0
- package/dist/lib/toggle.d.ts +1 -0
- package/package.json +9 -8
- package/src/App.tsx +101 -80
- package/src/lib/box.tsx +26 -26
- package/src/lib/button.tsx +207 -162
- package/src/lib/col.tsx +48 -45
- package/src/lib/container.tsx +69 -59
- package/src/lib/flex.tsx +99 -92
- package/src/lib/grid.tsx +76 -64
- package/src/lib/icon.tsx +18 -0
- package/src/lib/index.ts +16 -15
- package/src/lib/input.tsx +418 -384
- package/src/lib/max-width.tsx +53 -50
- package/src/lib/range.tsx +234 -208
- package/src/lib/select.tsx +136 -121
- package/src/lib/space.tsx +55 -52
- package/src/lib/styled-components/index.ts +2 -2
- package/src/lib/styled-components/registry.tsx +29 -26
- package/src/lib/styled-components/theme-provider.tsx +50 -49
- package/src/lib/textarea.tsx +115 -94
- package/src/lib/toggle.tsx +158 -147
- package/src/lib/utils/global.tsx +95 -95
- package/src/lib/utils/icons.tsx +84 -84
- package/src/lib/utils/index.ts +5 -5
- package/src/lib/utils/mixins.tsx +108 -95
- package/src/lib/utils/theme.ts +289 -289
- package/src/lib/utils/typography.tsx +204 -204
- package/src/main.tsx +19 -14
- package/src/toggle-theme.tsx +25 -25
- package/src/vite-env.d.ts +8 -8
- package/vite.config.js +18 -18
package/dist/lib/button.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
8
8
|
$fullWidth?: boolean;
|
|
9
9
|
$icon?: React.ReactNode;
|
|
10
10
|
$iconPosition?: "left" | "right";
|
|
11
|
+
$isError?: boolean;
|
|
11
12
|
theme?: Theme;
|
|
12
13
|
}
|
|
13
|
-
export declare const buttonStyles: (theme: Theme, $variant?: "primary" | "secondary" | "tertiary", $size?: "default" | "big", $outline?: boolean, $fullWidth?: boolean, disabled?: boolean) => import('styled-components').RuleSet<object>;
|
|
14
|
+
export declare const buttonStyles: (theme: Theme, $variant?: "primary" | "secondary" | "tertiary", $size?: "default" | "big", $outline?: boolean, $fullWidth?: boolean, $isError?: boolean, disabled?: boolean) => import('styled-components').RuleSet<object>;
|
|
14
15
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
16
|
export { Button };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { icons } from 'lucide-react';
|
|
2
|
+
export type IconProps = keyof typeof icons;
|
|
3
|
+
interface Props {
|
|
4
|
+
name: IconProps;
|
|
5
|
+
color?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Icon: ({ name, color, size, className }: Props) => import("react").JSX.Element;
|
|
10
|
+
export { Icon };
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/input.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IStyledComponent } from 'styled-components';
|
|
|
3
3
|
import { Theme } from './utils';
|
|
4
4
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
+
$wrapperClassName?: string;
|
|
6
7
|
$label?: string;
|
|
7
8
|
$size?: "default" | "big";
|
|
8
9
|
$error?: boolean;
|
package/dist/lib/range.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { Theme } from './utils';
|
|
3
3
|
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
4
4
|
className?: string;
|
|
5
|
+
$wrapperClassName?: string;
|
|
5
6
|
$label?: string;
|
|
6
7
|
$size?: "default" | "big";
|
|
7
8
|
$error?: boolean;
|
package/dist/lib/select.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IStyledComponent } from 'styled-components';
|
|
|
3
3
|
import { Theme } from './utils';
|
|
4
4
|
interface SelectProps extends React.InputHTMLAttributes<HTMLSelectElement> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
+
$wrapperClassName?: string;
|
|
6
7
|
$label?: string;
|
|
7
8
|
$size?: "default" | "big";
|
|
8
9
|
$error?: boolean;
|
package/dist/lib/textarea.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { Theme } from './utils';
|
|
3
3
|
interface TextareaProps extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "size"> {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
$wrapperClassName?: string;
|
|
5
6
|
$label?: string;
|
|
6
7
|
$size?: "default" | "big";
|
|
7
8
|
$error?: boolean;
|
package/dist/lib/toggle.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cherry-styled-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Cherry is a design system for the modern web. Designed in Figma, built in React using Typescript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -26,24 +26,25 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"dev": "vite dev",
|
|
28
28
|
"build": "vite build",
|
|
29
|
-
"format": "prettier --write \"
|
|
29
|
+
"format": "prettier --write \"./**/*.{js,json,ts,tsx}\""
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"react": "^19",
|
|
33
|
-
"react-dom": "^19"
|
|
32
|
+
"react": "^19.2.4",
|
|
33
|
+
"react-dom": "^19.2.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^25",
|
|
37
|
-
"@types/react": "^19",
|
|
38
|
-
"@types/react-dom": "^19",
|
|
36
|
+
"@types/node": "^25.2.1",
|
|
37
|
+
"@types/react": "^19.2.13",
|
|
38
|
+
"@types/react-dom": "^19.2.3",
|
|
39
39
|
"@vitejs/plugin-react": "^5.1.3",
|
|
40
40
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
41
41
|
"eslint-plugin-react-refresh": "^0.5.0",
|
|
42
|
+
"lucide-react": "^0.563.0",
|
|
42
43
|
"next": "^16.1.6",
|
|
43
44
|
"polished": "^4.3.1",
|
|
44
45
|
"prettier": "^3.8.1",
|
|
45
46
|
"styled-components": "^6.3.8",
|
|
46
|
-
"typescript": "^5",
|
|
47
|
+
"typescript": "^5.9.3",
|
|
47
48
|
"vite": "^7.3.1",
|
|
48
49
|
"vite-plugin-dts": "^4.5.4"
|
|
49
50
|
}
|
package/src/App.tsx
CHANGED
|
@@ -1,80 +1,101 @@
|
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
+
</MaxWidth>
|
|
96
|
+
<Space $size={100} />
|
|
97
|
+
</Container>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default App;
|
package/src/lib/box.tsx
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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 };
|
|
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 };
|