daleui 0.0.2 → 0.0.5
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/README.md +43 -0
- package/dist/check-DEVerfH5.js +72 -0
- package/dist/components/Box/Box.d.ts +34 -0
- package/dist/components/Box/Box.js +34 -0
- package/dist/components/Button/Button.d.ts +37 -0
- package/dist/components/Button/Button.js +367 -0
- package/dist/components/Card/Card.d.ts +68 -0
- package/dist/components/Card/Card.js +132 -0
- package/dist/components/Checkbox/Checkbox.d.ts +34 -0
- package/dist/components/Checkbox/Checkbox.js +657 -0
- package/dist/components/Flex/Flex.d.ts +361 -0
- package/dist/components/Flex/Flex.js +65 -0
- package/dist/components/HStack/HStack.d.ts +23 -0
- package/dist/components/HStack/HStack.js +35 -0
- package/dist/components/Heading/Heading.d.ts +33 -0
- package/dist/components/Heading/Heading.js +67 -0
- package/dist/components/Icon/Icon.d.ts +20 -0
- package/dist/components/Icon/Icon.js +325 -0
- package/dist/components/Label/Label.d.ts +35 -0
- package/dist/components/Label/Label.js +74 -0
- package/dist/components/Link/Link.d.ts +33 -0
- package/dist/components/Link/Link.js +176 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +17 -0
- package/dist/components/PasswordInput/PasswordInput.js +151 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +82 -0
- package/dist/components/RadioGroup/RadioGroup.js +713 -0
- package/dist/components/Select/Select.d.ts +39 -0
- package/dist/components/Select/Select.js +222 -0
- package/dist/components/Tag/Tag.d.ts +26 -0
- package/dist/components/Tag/Tag.js +189 -0
- package/dist/components/Text/Text.d.ts +22 -0
- package/dist/components/Text/Text.js +115 -0
- package/dist/components/TextInput/TextInput.d.ts +21 -0
- package/dist/components/TextInput/TextInput.js +106 -0
- package/dist/components/VStack/VStack.d.ts +23 -0
- package/dist/components/VStack/VStack.js +35 -0
- package/dist/css-QiVVeZaw.js +212 -0
- package/dist/cva-BrKodHDH.js +57 -0
- package/dist/cx-DN21T1EH.js +9 -0
- package/dist/hstack-cCrHxysi.js +43 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +37 -0
- package/dist/tokens/colors.d.ts +4 -0
- package/dist/tokens/iconography.d.ts +45 -0
- package/dist/tokens/spacing.d.ts +42 -0
- package/dist/tokens/typography.d.ts +312 -0
- package/dist/use-locale-context-DYXE7B4r.js +775 -0
- package/package.json +62 -39
- package/styled-system/css/conditions.mjs +36 -0
- package/styled-system/css/css.d.ts +22 -0
- package/styled-system/css/css.mjs +45 -0
- package/styled-system/css/cva.d.ts +6 -0
- package/styled-system/css/cva.mjs +87 -0
- package/styled-system/css/cx.d.ts +5 -0
- package/styled-system/css/cx.mjs +15 -0
- package/styled-system/css/index.d.ts +5 -0
- package/styled-system/css/index.mjs +4 -0
- package/styled-system/css/sva.d.ts +4 -0
- package/styled-system/css/sva.mjs +46 -0
- package/styled-system/helpers.mjs +316 -0
- package/styled-system/patterns/aspect-ratio.d.ts +20 -0
- package/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/styled-system/patterns/bleed.d.ts +21 -0
- package/styled-system/patterns/bleed.mjs +24 -0
- package/styled-system/patterns/box.d.ts +20 -0
- package/styled-system/patterns/box.mjs +15 -0
- package/styled-system/patterns/center.d.ts +20 -0
- package/styled-system/patterns/center.mjs +21 -0
- package/styled-system/patterns/circle.d.ts +20 -0
- package/styled-system/patterns/circle.mjs +25 -0
- package/styled-system/patterns/container.d.ts +20 -0
- package/styled-system/patterns/container.mjs +21 -0
- package/styled-system/patterns/cq.d.ts +21 -0
- package/styled-system/patterns/cq.mjs +21 -0
- package/styled-system/patterns/divider.d.ts +22 -0
- package/styled-system/patterns/divider.mjs +25 -0
- package/styled-system/patterns/flex.d.ts +26 -0
- package/styled-system/patterns/flex.mjs +26 -0
- package/styled-system/patterns/float.d.ts +23 -0
- package/styled-system/patterns/float.mjs +52 -0
- package/styled-system/patterns/grid-item.d.ts +25 -0
- package/styled-system/patterns/grid-item.mjs +25 -0
- package/styled-system/patterns/grid.d.ts +24 -0
- package/styled-system/patterns/grid.mjs +27 -0
- package/styled-system/patterns/hstack.d.ts +21 -0
- package/styled-system/patterns/hstack.mjs +24 -0
- package/styled-system/patterns/index.d.ts +21 -0
- package/styled-system/patterns/index.mjs +20 -0
- package/styled-system/patterns/link-overlay.d.ts +20 -0
- package/styled-system/patterns/link-overlay.mjs +24 -0
- package/styled-system/patterns/spacer.d.ts +20 -0
- package/styled-system/patterns/spacer.mjs +21 -0
- package/styled-system/patterns/square.d.ts +20 -0
- package/styled-system/patterns/square.mjs +24 -0
- package/styled-system/patterns/stack.d.ts +23 -0
- package/styled-system/patterns/stack.mjs +24 -0
- package/styled-system/patterns/visually-hidden.d.ts +20 -0
- package/styled-system/patterns/visually-hidden.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +21 -0
- package/styled-system/patterns/vstack.mjs +24 -0
- package/styled-system/patterns/wrap.d.ts +24 -0
- package/styled-system/patterns/wrap.mjs +25 -0
- package/styled-system/tokens/index.d.ts +9 -0
- package/styled-system/tokens/index.mjs +3176 -0
- package/styled-system/tokens/tokens.d.ts +63 -0
- package/styled-system/types/composition.d.ts +224 -0
- package/styled-system/types/conditions.d.ts +310 -0
- package/styled-system/types/csstype.d.ts +21298 -0
- package/styled-system/types/global.d.ts +20 -0
- package/styled-system/types/index.d.ts +7 -0
- package/styled-system/types/parts.d.ts +8 -0
- package/styled-system/types/pattern.d.ts +78 -0
- package/styled-system/types/prop-type.d.ts +265 -0
- package/styled-system/types/recipe.d.ts +181 -0
- package/styled-system/types/selectors.d.ts +59 -0
- package/styled-system/types/static-css.d.ts +56 -0
- package/styled-system/types/style-props.d.ts +7504 -0
- package/styled-system/types/system-types.d.ts +269 -0
- package/.github/CODEOWNERS +0 -1
- package/.github/FUNDING.yml +0 -1
- package/.github/workflows/automation.yml +0 -13
- package/.github/workflows/chromatic.yml +0 -19
- package/.github/workflows/deployment.yml +0 -32
- package/.github/workflows/integration.yml +0 -15
- package/.github/workflows/storybook-tests.yml +0 -17
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -29
- package/.storybook/test-runner.ts +0 -33
- package/bun.lock +0 -2099
- package/chromatic.config.json +0 -5
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/panda.config.ts +0 -61
- package/postcss.config.cjs +0 -5
- package/public/logo.svg +0 -9
- package/src/App.tsx +0 -67
- package/src/assets/Discord.svg +0 -1
- package/src/assets/GitHub.svg +0 -1
- package/src/assets/LinkedIn.svg +0 -1
- package/src/assets/Medium.svg +0 -1
- package/src/assets/YouTube.svg +0 -1
- package/src/components/Button/Button.stories.tsx +0 -115
- package/src/components/Button/Button.test.tsx +0 -108
- package/src/components/Button/Button.tsx +0 -245
- package/src/components/Button/index.tsx +0 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -129
- package/src/components/Checkbox/Checkbox.test.tsx +0 -169
- package/src/components/Checkbox/Checkbox.tsx +0 -190
- package/src/components/Heading/Heading.stories.tsx +0 -72
- package/src/components/Heading/Heading.test.tsx +0 -55
- package/src/components/Heading/Heading.tsx +0 -73
- package/src/components/Heading/index.tsx +0 -1
- package/src/components/Icon/Icon.stories.tsx +0 -106
- package/src/components/Icon/Icon.test.tsx +0 -44
- package/src/components/Icon/Icon.tsx +0 -116
- package/src/components/Icon/index.tsx +0 -1
- package/src/components/Text/Text.stories.tsx +0 -65
- package/src/components/Text/Text.test.tsx +0 -54
- package/src/components/Text/Text.tsx +0 -93
- package/src/components/Text/index.tsx +0 -1
- package/src/index.css +0 -2
- package/src/main.tsx +0 -10
- package/src/setupTests.tsx +0 -5
- package/src/styles/globalCss.ts +0 -43
- package/src/tokens/colors.mdx +0 -100
- package/src/tokens/colors.ts +0 -288
- package/src/tokens/iconography.mdx +0 -15
- package/src/tokens/iconography.tsx +0 -54
- package/src/tokens/typography.mdx +0 -38
- package/src/tokens/typography.ts +0 -132
- package/src/vite-env.d.ts +0 -2
- package/tsconfig.app.json +0 -25
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -22
- package/vite.config.ts +0 -16
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { vstack } from "../../../styled-system/patterns";
|
|
3
|
-
import { Heading } from "../Heading/Heading";
|
|
4
|
-
import { Text } from "../Text/Text";
|
|
5
|
-
import { Icon } from "./Icon";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: Icon,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
name: "user",
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof Icon>;
|
|
16
|
-
|
|
17
|
-
export const Basic: StoryObj<typeof Icon> = {
|
|
18
|
-
args: {
|
|
19
|
-
tone: "accent",
|
|
20
|
-
muted: true,
|
|
21
|
-
size: "xl",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Sizes: StoryObj<typeof Icon> = {
|
|
26
|
-
render: (args) => {
|
|
27
|
-
return (
|
|
28
|
-
<div className={vstack({ gap: "6" })}>
|
|
29
|
-
<Icon {...args} size="xs" />
|
|
30
|
-
<Icon {...args} size="sm" />
|
|
31
|
-
<Icon {...args} size="md" />
|
|
32
|
-
<Icon {...args} size="lg" />
|
|
33
|
-
<Icon {...args} size="xl" />
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
argTypes: {
|
|
38
|
-
size: {
|
|
39
|
-
control: false,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
args: {
|
|
43
|
-
tone: "accent",
|
|
44
|
-
muted: true,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Tones: StoryObj<typeof Icon> = {
|
|
49
|
-
render: (args) => {
|
|
50
|
-
return (
|
|
51
|
-
<div className={vstack({ gap: "6" })}>
|
|
52
|
-
<Icon {...args} tone="neutral" />
|
|
53
|
-
<Icon {...args} tone="accent" />
|
|
54
|
-
<Icon {...args} tone="danger" />
|
|
55
|
-
<Icon {...args} tone="warning" />
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
argTypes: {
|
|
60
|
-
tone: {
|
|
61
|
-
control: false,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
args: {
|
|
65
|
-
muted: true,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const Contrasts: StoryObj<typeof Icon> = {
|
|
70
|
-
render: (args) => {
|
|
71
|
-
return (
|
|
72
|
-
<div className={vstack({ gap: "6" })}>
|
|
73
|
-
<Text {...args} muted>
|
|
74
|
-
낮은 <Icon name="moon" /> 명암비
|
|
75
|
-
</Text>
|
|
76
|
-
<Text {...args}>
|
|
77
|
-
높은 <Icon name="sun" /> 명암비
|
|
78
|
-
</Text>
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
},
|
|
82
|
-
argTypes: {
|
|
83
|
-
name: {
|
|
84
|
-
control: false,
|
|
85
|
-
},
|
|
86
|
-
muted: {
|
|
87
|
-
control: false,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const WithHeading: StoryObj<typeof Icon> = {
|
|
93
|
-
render: (args) => {
|
|
94
|
-
return (
|
|
95
|
-
<Heading level={2}>
|
|
96
|
-
<Icon {...args} name="user" />
|
|
97
|
-
프로필
|
|
98
|
-
</Heading>
|
|
99
|
-
);
|
|
100
|
-
},
|
|
101
|
-
argTypes: {
|
|
102
|
-
name: {
|
|
103
|
-
control: false,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { composeStories } from "@storybook/react";
|
|
2
|
-
import { render } from "@testing-library/react";
|
|
3
|
-
import { expect, test } from "vitest";
|
|
4
|
-
import * as stories from "./Icon.stories";
|
|
5
|
-
|
|
6
|
-
const { Basic } = composeStories(stories);
|
|
7
|
-
|
|
8
|
-
test("renders an svg element", () => {
|
|
9
|
-
const { container } = render(<Basic />);
|
|
10
|
-
|
|
11
|
-
expect(container.querySelector("svg")).toBeInTheDocument();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test.each([
|
|
15
|
-
["xs", "w_1em h_1em"],
|
|
16
|
-
["sm", "w_1.25em h_1.25em"],
|
|
17
|
-
["md", "w_1.5em h_1.5em"],
|
|
18
|
-
["lg", "w_1.875em h_1.875em"],
|
|
19
|
-
["xl", "w_2.25em h_2.25em"],
|
|
20
|
-
] as const)('applies the correct class for size="%s"', (size, className) => {
|
|
21
|
-
const { container } = render(<Basic size={size} />);
|
|
22
|
-
|
|
23
|
-
expect(container.querySelector("svg")).toHaveClass(className);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test.each([
|
|
27
|
-
["neutral", "c_text"],
|
|
28
|
-
["accent", "c_text.accent"],
|
|
29
|
-
["danger", "c_text.danger"],
|
|
30
|
-
["warning", "c_text.warning"],
|
|
31
|
-
] as const)('applies the correct class for tone="%s"', (tone, className) => {
|
|
32
|
-
const { container } = render(<Basic tone={tone} muted={false} />);
|
|
33
|
-
|
|
34
|
-
expect(container.querySelector("svg")).toHaveClass(className);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test.each([
|
|
38
|
-
[false, "c_text"],
|
|
39
|
-
[true, "c_text.muted"],
|
|
40
|
-
] as const)("applies the correct class for muted={%s}", (muted, className) => {
|
|
41
|
-
const { container } = render(<Basic tone="neutral" muted={muted} />);
|
|
42
|
-
|
|
43
|
-
expect(container.querySelector("svg")).toHaveClass(className);
|
|
44
|
-
});
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { css, cva } from "../../../styled-system/css";
|
|
2
|
-
import type { Tone } from "../../tokens/colors";
|
|
3
|
-
import { type IconName, icons } from "../../tokens/iconography";
|
|
4
|
-
export interface IconProps {
|
|
5
|
-
/** 이름 */
|
|
6
|
-
name: IconName;
|
|
7
|
-
/** 색조 */
|
|
8
|
-
tone?: Tone;
|
|
9
|
-
/** 크기 */
|
|
10
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
11
|
-
/** 명암비 낮출지 */
|
|
12
|
-
muted?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* - `name` 속성으로 어떤 모양의 아이콘을 사용할지 지정할 수 있습니다.
|
|
17
|
-
* - 아이콘의 기본 크기는 부모 요소에서 설정한 글자 크기의 1.5배이며, `size` 속성을 통해서 크기를 변경할 수 있습니다.
|
|
18
|
-
* - 아이콘의 기본 색상은 부모 요소에서 설정한 글자 색상과 동일하며, `tone` 속성과 `muted` 속성을 통해서 색상을 변경할 수 있습니다.
|
|
19
|
-
*/
|
|
20
|
-
export const Icon = ({
|
|
21
|
-
name,
|
|
22
|
-
size,
|
|
23
|
-
tone,
|
|
24
|
-
muted = false,
|
|
25
|
-
...rest
|
|
26
|
-
}: IconProps) => {
|
|
27
|
-
const Tag = icons[name];
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Tag
|
|
31
|
-
className={css(
|
|
32
|
-
sizeStyles.raw({ size }),
|
|
33
|
-
colorStyles.raw({ tone, muted }),
|
|
34
|
-
css.raw({
|
|
35
|
-
display: "inline-block",
|
|
36
|
-
})
|
|
37
|
-
)}
|
|
38
|
-
{...rest}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const sizeStyles = cva({
|
|
44
|
-
variants: {
|
|
45
|
-
size: {
|
|
46
|
-
xs: {
|
|
47
|
-
width: "1em",
|
|
48
|
-
height: "1em",
|
|
49
|
-
},
|
|
50
|
-
sm: {
|
|
51
|
-
width: "1.25em",
|
|
52
|
-
height: "1.25em",
|
|
53
|
-
},
|
|
54
|
-
md: {
|
|
55
|
-
width: "1.5em",
|
|
56
|
-
height: "1.5em",
|
|
57
|
-
},
|
|
58
|
-
lg: {
|
|
59
|
-
width: "1.875em",
|
|
60
|
-
height: "1.875em",
|
|
61
|
-
},
|
|
62
|
-
xl: {
|
|
63
|
-
width: "2.25em",
|
|
64
|
-
height: "2.25em",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
defaultVariants: {
|
|
69
|
-
size: "md",
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const colorStyles = cva({
|
|
74
|
-
compoundVariants: [
|
|
75
|
-
{
|
|
76
|
-
muted: false,
|
|
77
|
-
tone: "neutral",
|
|
78
|
-
css: { color: "text" },
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
muted: false,
|
|
82
|
-
tone: "accent",
|
|
83
|
-
css: { color: "text.accent" },
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
muted: false,
|
|
87
|
-
tone: "danger",
|
|
88
|
-
css: { color: "text.danger" },
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
muted: false,
|
|
92
|
-
tone: "warning",
|
|
93
|
-
css: { color: "text.warning" },
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
muted: true,
|
|
97
|
-
tone: "neutral",
|
|
98
|
-
css: { color: "text.muted" },
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
muted: true,
|
|
102
|
-
tone: "accent",
|
|
103
|
-
css: { color: "text.muted.accent" },
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
muted: true,
|
|
107
|
-
tone: "danger",
|
|
108
|
-
css: { color: "text.muted.danger" },
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
muted: true,
|
|
112
|
-
tone: "warning",
|
|
113
|
-
css: { color: "text.muted.warning" },
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Icon as Text } from "./Icon";
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { vstack } from "../../../styled-system/patterns";
|
|
3
|
-
import { Text } from "./Text";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: Text,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
args: {
|
|
11
|
-
children: "본문",
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof Text>;
|
|
14
|
-
|
|
15
|
-
export const Basic: StoryObj<typeof Text> = {};
|
|
16
|
-
|
|
17
|
-
export const Tones: StoryObj<typeof Text> = {
|
|
18
|
-
render: (args) => {
|
|
19
|
-
return (
|
|
20
|
-
<div className={vstack({ gap: "6" })}>
|
|
21
|
-
<Text {...args} tone="neutral">
|
|
22
|
-
중립 색조
|
|
23
|
-
</Text>
|
|
24
|
-
<Text {...args} tone="accent">
|
|
25
|
-
강조 색조
|
|
26
|
-
</Text>
|
|
27
|
-
<Text {...args} tone="danger">
|
|
28
|
-
위험 색조
|
|
29
|
-
</Text>
|
|
30
|
-
<Text {...args} tone="warning">
|
|
31
|
-
경고 색조
|
|
32
|
-
</Text>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
argTypes: {
|
|
37
|
-
children: {
|
|
38
|
-
control: false,
|
|
39
|
-
},
|
|
40
|
-
tone: {
|
|
41
|
-
control: false,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Contrasts: StoryObj<typeof Text> = {
|
|
47
|
-
render: (args) => {
|
|
48
|
-
return (
|
|
49
|
-
<div className={vstack({ gap: "6" })}>
|
|
50
|
-
<Text {...args} muted>
|
|
51
|
-
낮은 명암비
|
|
52
|
-
</Text>
|
|
53
|
-
<Text {...args}>높은 명암비</Text>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
argTypes: {
|
|
58
|
-
children: {
|
|
59
|
-
control: false,
|
|
60
|
-
},
|
|
61
|
-
muted: {
|
|
62
|
-
control: false,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { faker } from "@faker-js/faker";
|
|
2
|
-
import { composeStories } from "@storybook/react";
|
|
3
|
-
import { render, screen } from "@testing-library/react";
|
|
4
|
-
import { expect, test } from "vitest";
|
|
5
|
-
import { fontSizes, fontWeights } from "../../tokens/typography";
|
|
6
|
-
import * as stories from "./Text.stories";
|
|
7
|
-
|
|
8
|
-
const { Basic, Tones, Contrasts } = composeStories(stories);
|
|
9
|
-
|
|
10
|
-
test("renders the heading with the correct text content", () => {
|
|
11
|
-
render(<Basic>테스트</Basic>);
|
|
12
|
-
|
|
13
|
-
expect(screen.getByText("테스트"));
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test("applies the correct font weight class based on the weight prop", () => {
|
|
17
|
-
const weight = faker.helpers.arrayElement(
|
|
18
|
-
Object.keys(fontWeights)
|
|
19
|
-
) as keyof typeof fontWeights;
|
|
20
|
-
|
|
21
|
-
render(<Basic weight={weight} />);
|
|
22
|
-
|
|
23
|
-
expect(screen.getByText("본문")).toHaveClass(`fw_${weight}`);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test("applies the correct font size class based on the size prop", () => {
|
|
27
|
-
const size = faker.helpers.arrayElement(
|
|
28
|
-
Object.keys(fontSizes)
|
|
29
|
-
) as keyof typeof fontSizes;
|
|
30
|
-
|
|
31
|
-
render(<Basic size={size} />);
|
|
32
|
-
|
|
33
|
-
expect(screen.getByText("본문")).toHaveClass(`fs_${size}`);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("applies the correct color based on the tone", () => {
|
|
37
|
-
render(<Tones />);
|
|
38
|
-
|
|
39
|
-
expect(screen.getByText("중립 색조")).toHaveClass("c_text");
|
|
40
|
-
|
|
41
|
-
expect(screen.getByText("강조 색조")).toHaveClass("c_text.accent");
|
|
42
|
-
|
|
43
|
-
expect(screen.getByText("위험 색조")).toHaveClass("c_text.danger");
|
|
44
|
-
|
|
45
|
-
expect(screen.getByText("경고 색조")).toHaveClass("c_text.warning");
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("applies the correct color for low and high contrast", () => {
|
|
49
|
-
render(<Contrasts />);
|
|
50
|
-
|
|
51
|
-
expect(screen.getByText("낮은 명암비")).toHaveClass("c_text.muted");
|
|
52
|
-
|
|
53
|
-
expect(screen.getByText("높은 명암비")).toHaveClass("c_text");
|
|
54
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ReactNode, HTMLAttributes } from "react";
|
|
2
|
-
import { css, cva } from "../../../styled-system/css";
|
|
3
|
-
import type { Tone } from "../../tokens/colors";
|
|
4
|
-
import type { FontSize, FontWeight } from "../../tokens/typography";
|
|
5
|
-
|
|
6
|
-
export interface TextProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
-
/** 텍스트 */
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
/** HTML 태그 */
|
|
10
|
-
as?: "span" | "div" | "p" | "strong" | "em" | "small";
|
|
11
|
-
/** 색조 */
|
|
12
|
-
tone?: Tone;
|
|
13
|
-
/** 크기 */
|
|
14
|
-
size?: FontSize;
|
|
15
|
-
/** 굵기 */
|
|
16
|
-
weight?: FontWeight;
|
|
17
|
-
/** 명암비 낮출지 */
|
|
18
|
-
muted?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* - `as` 속성으로 어떤 HTML 태그를 사용할지 지정할 수 있습니다.
|
|
23
|
-
* - `muted` 속성을 주시면 글자색이 옅어집니다. 명암비가 낮아지므로 접근성 측면에서 주의해서 사용하세요.
|
|
24
|
-
*/
|
|
25
|
-
export const Text = ({
|
|
26
|
-
children,
|
|
27
|
-
as: Tag = "span",
|
|
28
|
-
tone = "neutral",
|
|
29
|
-
size,
|
|
30
|
-
weight,
|
|
31
|
-
muted = false,
|
|
32
|
-
...rest
|
|
33
|
-
}: TextProps) => {
|
|
34
|
-
return (
|
|
35
|
-
<Tag
|
|
36
|
-
className={css(
|
|
37
|
-
styles.raw({ tone, muted }),
|
|
38
|
-
css.raw({
|
|
39
|
-
fontSize: size,
|
|
40
|
-
fontWeight: weight,
|
|
41
|
-
})
|
|
42
|
-
)}
|
|
43
|
-
{...rest}
|
|
44
|
-
>
|
|
45
|
-
{children}
|
|
46
|
-
</Tag>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const styles = cva({
|
|
51
|
-
compoundVariants: [
|
|
52
|
-
{
|
|
53
|
-
muted: false,
|
|
54
|
-
tone: "neutral",
|
|
55
|
-
css: { color: "text" },
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
muted: false,
|
|
59
|
-
tone: "accent",
|
|
60
|
-
css: { color: "text.accent" },
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
muted: false,
|
|
64
|
-
tone: "danger",
|
|
65
|
-
css: { color: "text.danger" },
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
muted: false,
|
|
69
|
-
tone: "warning",
|
|
70
|
-
css: { color: "text.warning" },
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
muted: true,
|
|
74
|
-
tone: "neutral",
|
|
75
|
-
css: { color: "text.muted" },
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
muted: true,
|
|
79
|
-
tone: "accent",
|
|
80
|
-
css: { color: "text.muted.accent" },
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
muted: true,
|
|
84
|
-
tone: "danger",
|
|
85
|
-
css: { color: "text.muted.danger" },
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
muted: true,
|
|
89
|
-
tone: "warning",
|
|
90
|
-
css: { color: "text.muted.warning" },
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Text } from "./Text";
|
package/src/index.css
DELETED
package/src/main.tsx
DELETED
package/src/setupTests.tsx
DELETED
package/src/styles/globalCss.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineGlobalStyles } from "@pandacss/dev";
|
|
2
|
-
|
|
3
|
-
export const globalCss = defineGlobalStyles({
|
|
4
|
-
":root": {
|
|
5
|
-
"--global-font-body": "var(--fonts-sans)",
|
|
6
|
-
backgroundColor: "var(--colors-base)",
|
|
7
|
-
},
|
|
8
|
-
h1: {
|
|
9
|
-
fontSize: "var(--font-sizes-4xl)", // 2.25rem
|
|
10
|
-
lineHeight: "var(--line-heights-loose)", // 2
|
|
11
|
-
fontWeight: "var(--font-weights-bold)", // 700
|
|
12
|
-
},
|
|
13
|
-
h2: {
|
|
14
|
-
fontSize: "var(--font-sizes-3xl)", // 1.875rem
|
|
15
|
-
lineHeight: "var(--line-heights-loose)", // 2
|
|
16
|
-
fontWeight: "var(--font-weights-bold)", // 500
|
|
17
|
-
},
|
|
18
|
-
h3: {
|
|
19
|
-
fontSize: "var(--font-sizes-2xl)", // 1.5rem
|
|
20
|
-
lineHeight: "var(--line-heights-relaxed)", // 1.625
|
|
21
|
-
fontWeight: "var(--font-weights-medium)", // 500
|
|
22
|
-
},
|
|
23
|
-
h4: {
|
|
24
|
-
fontSize: "var(--font-sizes-xl)", // 1.25rem
|
|
25
|
-
lineHeight: "var(--line-heights-relaxed)", // 1.625
|
|
26
|
-
fontWeight: "var(--font-weights-medium)", // 500
|
|
27
|
-
},
|
|
28
|
-
h5: {
|
|
29
|
-
fontSize: "var(--font-sizes-lg)", // 1.125rem
|
|
30
|
-
lineHeight: "var(--line-heights-relaxed)", // 1.625
|
|
31
|
-
fontWeight: "var(--font-weights-medium)", // 500
|
|
32
|
-
},
|
|
33
|
-
h6: {
|
|
34
|
-
fontSize: "var(--font-sizes-md)", // 1rem
|
|
35
|
-
lineHeight: "var(--line-heights-relaxed)", // 1.625
|
|
36
|
-
fontWeight: "var(--font-weights-medium)", // 500
|
|
37
|
-
},
|
|
38
|
-
p: {
|
|
39
|
-
fontSize: "var(--font-sizes-md)", // 1rem
|
|
40
|
-
lineHeight: "var(--line-heights-relaxed)", // 1.625
|
|
41
|
-
fontWeight: "var(--font-weights-normal)", // 400
|
|
42
|
-
},
|
|
43
|
-
});
|
package/src/tokens/colors.mdx
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Meta, ColorPalette, ColorItem } from "@storybook/blocks";
|
|
2
|
-
import { colors, semanticColors } from "./colors.ts";
|
|
3
|
-
|
|
4
|
-
# Colors
|
|
5
|
-
|
|
6
|
-
달레 UI의 근간이 되는 색상 팔레트입니다.
|
|
7
|
-
|
|
8
|
-
<ColorPalette>
|
|
9
|
-
<ColorItem
|
|
10
|
-
title="초록"
|
|
11
|
-
subtitle="colors.teal"
|
|
12
|
-
colors={Object.fromEntries(
|
|
13
|
-
Object.entries(colors.teal).map(([name, { value }]) => [name, value])
|
|
14
|
-
)}
|
|
15
|
-
/>
|
|
16
|
-
<ColorItem
|
|
17
|
-
title="초록 (dark)"
|
|
18
|
-
subtitle="colors.tealDark"
|
|
19
|
-
colors={Object.fromEntries(
|
|
20
|
-
Object.entries(colors.tealDark).map(([name, { value }]) => [name, value])
|
|
21
|
-
)}
|
|
22
|
-
/>
|
|
23
|
-
<ColorItem
|
|
24
|
-
title="보라"
|
|
25
|
-
subtitle="colors.violet"
|
|
26
|
-
colors={Object.fromEntries(
|
|
27
|
-
Object.entries(colors.violet).map(([name, { value }]) => [name, value])
|
|
28
|
-
)}
|
|
29
|
-
/>
|
|
30
|
-
<ColorItem
|
|
31
|
-
title="보라 (dark)"
|
|
32
|
-
subtitle="colors.violetDark"
|
|
33
|
-
colors={Object.fromEntries(
|
|
34
|
-
Object.entries(colors.violetDark).map(([name, { value }]) => [
|
|
35
|
-
name,
|
|
36
|
-
value,
|
|
37
|
-
])
|
|
38
|
-
)}
|
|
39
|
-
/>
|
|
40
|
-
<ColorItem
|
|
41
|
-
title="빨강"
|
|
42
|
-
subtitle="colors.red"
|
|
43
|
-
colors={Object.fromEntries(
|
|
44
|
-
Object.entries(colors.red).map(([name, { value }]) => [name, value])
|
|
45
|
-
)}
|
|
46
|
-
/>
|
|
47
|
-
<ColorItem
|
|
48
|
-
title="빨강 (dark)"
|
|
49
|
-
subtitle="colors.redDark"
|
|
50
|
-
colors={Object.fromEntries(
|
|
51
|
-
Object.entries(colors.redDark).map(([name, { value }]) => [name, value])
|
|
52
|
-
)}
|
|
53
|
-
/>
|
|
54
|
-
<ColorItem
|
|
55
|
-
title="노랑"
|
|
56
|
-
subtitle="colors.yellow"
|
|
57
|
-
colors={Object.fromEntries(
|
|
58
|
-
Object.entries(colors.yellow).map(([name, { value }]) => [name, value])
|
|
59
|
-
)}
|
|
60
|
-
/>
|
|
61
|
-
<ColorItem
|
|
62
|
-
title="노랑 (dark)"
|
|
63
|
-
subtitle="colors.yellowDark"
|
|
64
|
-
colors={Object.fromEntries(
|
|
65
|
-
Object.entries(colors.yellowDark).map(([name, { value }]) => [
|
|
66
|
-
name,
|
|
67
|
-
value,
|
|
68
|
-
])
|
|
69
|
-
)}
|
|
70
|
-
/>
|
|
71
|
-
<ColorItem
|
|
72
|
-
title="회색"
|
|
73
|
-
subtitle="colors.gray"
|
|
74
|
-
colors={Object.fromEntries(
|
|
75
|
-
Object.entries(colors.gray).map(([name, { value }]) => [name, value])
|
|
76
|
-
)}
|
|
77
|
-
/>
|
|
78
|
-
<ColorItem
|
|
79
|
-
title="회색 (dark)"
|
|
80
|
-
subtitle="colors.grayDark"
|
|
81
|
-
colors={Object.fromEntries(
|
|
82
|
-
Object.entries(colors.grayDark).map(([name, { value }]) => [name, value])
|
|
83
|
-
)}
|
|
84
|
-
/>
|
|
85
|
-
</ColorPalette>
|
|
86
|
-
|
|
87
|
-
용도에 따라서 각 색상은 12가지 스케일로 분리됩니다.
|
|
88
|
-
|
|
89
|
-
- Scale 1: 페이지 배경
|
|
90
|
-
- Scale 2: 예비
|
|
91
|
-
- Scale 3: 컴포넌트 배경
|
|
92
|
-
- Scale 4: 컴포넌트 배경 (hover)
|
|
93
|
-
- Scale 5: 컴포넌트 배경 (active)
|
|
94
|
-
- Scale 6: 예비
|
|
95
|
-
- Scale 7: 경계
|
|
96
|
-
- Scale 8: 경계 (hover)
|
|
97
|
-
- Scale 9: 솔리드 배경
|
|
98
|
-
- Scale 10: 솔리드 배경 (hover)
|
|
99
|
-
- Scale 11: 글자 (low contrast)
|
|
100
|
-
- Scale 12: 글자 (high contrast)
|