daleui 0.0.0 → 0.0.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/.github/dependabot.yml +21 -0
- package/.github/workflows/chromatic.yml +13 -1
- package/bun.lock +2178 -9705
- package/package.json +31 -20
- package/panda.config.ts +3 -0
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Button/Button.tsx +26 -27
- package/src/components/Checkbox/Checkbox.stories.tsx +129 -0
- package/src/components/Checkbox/Checkbox.test.tsx +169 -0
- package/src/components/Checkbox/Checkbox.tsx +190 -0
- package/src/components/Heading/Heading.stories.tsx +2 -2
- package/src/components/Icon/Icon.stories.tsx +3 -3
- package/src/components/Text/Text.stories.tsx +2 -2
- package/src/tokens/spacing.ts +65 -0
- package/bun.lockb +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import React, { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
import { css, cva } from "../../../styled-system/css";
|
|
3
|
+
import type { Tone } from "../../tokens/colors";
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import { Check } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
export interface CheckboxProps
|
|
8
|
+
extends Omit<
|
|
9
|
+
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
10
|
+
"type" | "onChange" | "checked" | "value" | "required"
|
|
11
|
+
> {
|
|
12
|
+
/** 라벨 */
|
|
13
|
+
label: React.ReactNode;
|
|
14
|
+
/** 체크박스의 값 */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** 색조 */
|
|
17
|
+
tone?: Tone;
|
|
18
|
+
/** 체크박스 비활성화 여부 */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 체크박스 선택 여부 */
|
|
21
|
+
checked?: boolean;
|
|
22
|
+
/** 필수 입력 여부 */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** 변경 이벤트 핸들러 */
|
|
25
|
+
onChange?: (checked: boolean, value?: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* - `tone` 속성으로 체크박스의 색상 강조를 지정할 수 있습니다.
|
|
30
|
+
* - `disabled` 속성을 사용하여 체크박스를 비활성화할 수 있습니다.
|
|
31
|
+
* - `value` 속성을 통해 체크박스에 값을 지정할 수 있습니다.
|
|
32
|
+
* - `required` 속성을 사용하여 필수 입력 항목으로 지정할 수 있습니다.
|
|
33
|
+
*/
|
|
34
|
+
export const Checkbox = ({
|
|
35
|
+
label,
|
|
36
|
+
value,
|
|
37
|
+
tone = "neutral",
|
|
38
|
+
disabled,
|
|
39
|
+
checked,
|
|
40
|
+
required,
|
|
41
|
+
onChange,
|
|
42
|
+
...rest
|
|
43
|
+
}: CheckboxProps) => {
|
|
44
|
+
return (
|
|
45
|
+
<label
|
|
46
|
+
className={css({
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
gap: "0.5rem",
|
|
50
|
+
cursor: "pointer",
|
|
51
|
+
color: "text",
|
|
52
|
+
})}
|
|
53
|
+
>
|
|
54
|
+
<CheckboxPrimitive.Root
|
|
55
|
+
checked={checked}
|
|
56
|
+
required={required}
|
|
57
|
+
onCheckedChange={(checked) => {
|
|
58
|
+
onChange?.(checked === true, value);
|
|
59
|
+
}}
|
|
60
|
+
disabled={disabled}
|
|
61
|
+
className={styles({ tone })}
|
|
62
|
+
{...rest}
|
|
63
|
+
>
|
|
64
|
+
<CheckboxPrimitive.Indicator
|
|
65
|
+
className={css({
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: "100%",
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
})}
|
|
72
|
+
>
|
|
73
|
+
<Check size={16} />
|
|
74
|
+
</CheckboxPrimitive.Indicator>
|
|
75
|
+
</CheckboxPrimitive.Root>
|
|
76
|
+
{label}
|
|
77
|
+
{required && <span className={css({ color: "text.danger" })}>*</span>}
|
|
78
|
+
</label>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const styles = cva({
|
|
83
|
+
base: {
|
|
84
|
+
appearance: "none",
|
|
85
|
+
margin: "0",
|
|
86
|
+
backgroundColor: "transparent",
|
|
87
|
+
border: "3px solid",
|
|
88
|
+
borderColor: "border",
|
|
89
|
+
borderRadius: "4px",
|
|
90
|
+
width: "1.5rem",
|
|
91
|
+
height: "1.5rem",
|
|
92
|
+
display: "flex",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
justifyContent: "center",
|
|
95
|
+
cursor: "pointer",
|
|
96
|
+
transition: "0.2s",
|
|
97
|
+
outline: "none",
|
|
98
|
+
"&:hover": {
|
|
99
|
+
backgroundColor: "bg.hover",
|
|
100
|
+
},
|
|
101
|
+
"&:focus": {
|
|
102
|
+
outline: "3px solid",
|
|
103
|
+
outlineOffset: "2px",
|
|
104
|
+
},
|
|
105
|
+
"&:disabled": {
|
|
106
|
+
opacity: 0.5,
|
|
107
|
+
cursor: "not-allowed",
|
|
108
|
+
"&:hover": {
|
|
109
|
+
backgroundColor: "transparent",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
variants: {
|
|
114
|
+
tone: {
|
|
115
|
+
neutral: {
|
|
116
|
+
"&[data-state='checked']": {
|
|
117
|
+
backgroundColor: "bg",
|
|
118
|
+
borderColor: "border",
|
|
119
|
+
color: "text",
|
|
120
|
+
},
|
|
121
|
+
"&:disabled[data-state='checked']": {
|
|
122
|
+
backgroundColor: "bg",
|
|
123
|
+
borderColor: "border",
|
|
124
|
+
},
|
|
125
|
+
"&:focus": {
|
|
126
|
+
outlineColor: "border",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
accent: {
|
|
130
|
+
"&[data-state='checked']": {
|
|
131
|
+
backgroundColor: "bg.accent",
|
|
132
|
+
borderColor: "border.accent",
|
|
133
|
+
color: "text.accent",
|
|
134
|
+
},
|
|
135
|
+
"&:disabled[data-state='checked']": {
|
|
136
|
+
backgroundColor: "bg.accent",
|
|
137
|
+
borderColor: "border.accent",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
danger: {
|
|
141
|
+
"&[data-state='checked']": {
|
|
142
|
+
backgroundColor: "bg.danger",
|
|
143
|
+
borderColor: "border.danger",
|
|
144
|
+
color: "text.danger",
|
|
145
|
+
},
|
|
146
|
+
"&:disabled[data-state='checked']": {
|
|
147
|
+
backgroundColor: "bg.danger",
|
|
148
|
+
borderColor: "border.danger",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
warning: {
|
|
152
|
+
"&[data-state='checked']": {
|
|
153
|
+
backgroundColor: "bg.warning",
|
|
154
|
+
borderColor: "border.warning",
|
|
155
|
+
color: "text.warning",
|
|
156
|
+
},
|
|
157
|
+
"&:disabled[data-state='checked']": {
|
|
158
|
+
backgroundColor: "bg.warning",
|
|
159
|
+
borderColor: "border.warning",
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
compoundVariants: [
|
|
165
|
+
{
|
|
166
|
+
tone: "accent",
|
|
167
|
+
css: {
|
|
168
|
+
"&:focus": {
|
|
169
|
+
outlineColor: "border.accent",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
tone: "danger",
|
|
175
|
+
css: {
|
|
176
|
+
"&:focus": {
|
|
177
|
+
outlineColor: "border.danger",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
tone: "warning",
|
|
183
|
+
css: {
|
|
184
|
+
"&:focus": {
|
|
185
|
+
outlineColor: "border.warning",
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
});
|
|
@@ -18,7 +18,7 @@ export const Basic: StoryObj<typeof Heading> = {};
|
|
|
18
18
|
export const Levels: StoryObj<typeof Heading> = {
|
|
19
19
|
render: (args) => {
|
|
20
20
|
return (
|
|
21
|
-
<div className={vstack({ gap: "
|
|
21
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
22
22
|
<Heading {...args} level={1}>
|
|
23
23
|
1 단계
|
|
24
24
|
</Heading>
|
|
@@ -53,7 +53,7 @@ export const Levels: StoryObj<typeof Heading> = {
|
|
|
53
53
|
export const Contrasts: StoryObj<typeof Heading> = {
|
|
54
54
|
render: (args) => {
|
|
55
55
|
return (
|
|
56
|
-
<div className={vstack({ gap: "
|
|
56
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
57
57
|
<Heading {...args} muted>
|
|
58
58
|
낮은 명암비
|
|
59
59
|
</Heading>
|
|
@@ -25,7 +25,7 @@ export const Basic: StoryObj<typeof Icon> = {
|
|
|
25
25
|
export const Sizes: StoryObj<typeof Icon> = {
|
|
26
26
|
render: (args) => {
|
|
27
27
|
return (
|
|
28
|
-
<div className={vstack({ gap: "
|
|
28
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
29
29
|
<Icon {...args} size="xs" />
|
|
30
30
|
<Icon {...args} size="sm" />
|
|
31
31
|
<Icon {...args} size="md" />
|
|
@@ -48,7 +48,7 @@ export const Sizes: StoryObj<typeof Icon> = {
|
|
|
48
48
|
export const Tones: StoryObj<typeof Icon> = {
|
|
49
49
|
render: (args) => {
|
|
50
50
|
return (
|
|
51
|
-
<div className={vstack({ gap: "
|
|
51
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
52
52
|
<Icon {...args} tone="neutral" />
|
|
53
53
|
<Icon {...args} tone="accent" />
|
|
54
54
|
<Icon {...args} tone="danger" />
|
|
@@ -69,7 +69,7 @@ export const Tones: StoryObj<typeof Icon> = {
|
|
|
69
69
|
export const Contrasts: StoryObj<typeof Icon> = {
|
|
70
70
|
render: (args) => {
|
|
71
71
|
return (
|
|
72
|
-
<div className={vstack({ gap: "
|
|
72
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
73
73
|
<Text {...args} muted>
|
|
74
74
|
낮은 <Icon name="moon" /> 명암비
|
|
75
75
|
</Text>
|
|
@@ -17,7 +17,7 @@ export const Basic: StoryObj<typeof Text> = {};
|
|
|
17
17
|
export const Tones: StoryObj<typeof Text> = {
|
|
18
18
|
render: (args) => {
|
|
19
19
|
return (
|
|
20
|
-
<div className={vstack({ gap: "
|
|
20
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
21
21
|
<Text {...args} tone="neutral">
|
|
22
22
|
중립 색조
|
|
23
23
|
</Text>
|
|
@@ -46,7 +46,7 @@ export const Tones: StoryObj<typeof Text> = {
|
|
|
46
46
|
export const Contrasts: StoryObj<typeof Text> = {
|
|
47
47
|
render: (args) => {
|
|
48
48
|
return (
|
|
49
|
-
<div className={vstack({ gap: "
|
|
49
|
+
<div className={vstack({ gap: "gap.md" })}>
|
|
50
50
|
<Text {...args} muted>
|
|
51
51
|
낮은 명암비
|
|
52
52
|
</Text>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Tokens, SemanticTokens } from "@pandacss/types";
|
|
2
|
+
|
|
3
|
+
export const semanticSpacing: SemanticTokens["spacing"] = {
|
|
4
|
+
px: {
|
|
5
|
+
sm: {
|
|
6
|
+
value: "{spacing.6}", // 1.5rem
|
|
7
|
+
},
|
|
8
|
+
md: {
|
|
9
|
+
value: "{spacing.8}", // 2rem
|
|
10
|
+
},
|
|
11
|
+
lg: {
|
|
12
|
+
value: "{spacing.10}", // 2.5rem
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
py: {
|
|
16
|
+
sm: {
|
|
17
|
+
value: "{spacing.2}", // 0.5rem
|
|
18
|
+
},
|
|
19
|
+
md: {
|
|
20
|
+
value: "{spacing.3}", // 0.75rem
|
|
21
|
+
},
|
|
22
|
+
lg: {
|
|
23
|
+
value: "{spacing.4}", // 1rem
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
gap: {
|
|
27
|
+
sm: {
|
|
28
|
+
value: "{spacing.4}", // 1rem
|
|
29
|
+
},
|
|
30
|
+
md: {
|
|
31
|
+
value: "{spacing.6}", // 1.5rem
|
|
32
|
+
},
|
|
33
|
+
lg: {
|
|
34
|
+
value: "{spacing.8}", // 2rem
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const spacing: Tokens["spacing"] = {
|
|
40
|
+
0: { value: "0rem" },
|
|
41
|
+
0.5: { value: "0.125rem" },
|
|
42
|
+
1: { value: "0.25rem" },
|
|
43
|
+
1.5: { value: "0.375rem" },
|
|
44
|
+
2: { value: "0.5rem" },
|
|
45
|
+
2.5: { value: "0.625rem" },
|
|
46
|
+
3: { value: "0.75rem" },
|
|
47
|
+
3.5: { value: "0.875rem" },
|
|
48
|
+
4: { value: "1rem" },
|
|
49
|
+
5: { value: "1.25rem" },
|
|
50
|
+
6: { value: "1.5rem" },
|
|
51
|
+
7: { value: "1.75rem" },
|
|
52
|
+
8: { value: "2rem" },
|
|
53
|
+
9: { value: "2.25rem" },
|
|
54
|
+
10: { value: "2.5rem" },
|
|
55
|
+
11: { value: "2.75rem" },
|
|
56
|
+
12: { value: "3rem" },
|
|
57
|
+
14: { value: "3.5rem" },
|
|
58
|
+
16: { value: "4rem" },
|
|
59
|
+
20: { value: "5rem" },
|
|
60
|
+
24: { value: "6rem" },
|
|
61
|
+
28: { value: "7rem" },
|
|
62
|
+
32: { value: "8rem" },
|
|
63
|
+
36: { value: "9rem" },
|
|
64
|
+
40: { value: "10rem" },
|
|
65
|
+
};
|
package/bun.lockb
DELETED
|
Binary file
|