@moyeorak/design-system 0.1.0
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 +200 -0
- package/dist/index.d.ts +19990 -0
- package/dist/index.js +46 -0
- package/dist/index.mjs +3066 -0
- package/dist/style.css +1 -0
- package/package.json +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# @moyeorak/design-system
|
|
2
|
+
|
|
3
|
+
moyeorak 프로젝트를 위한 React 컴포넌트 디자인 시스템.
|
|
4
|
+
|
|
5
|
+
## 기술 스택
|
|
6
|
+
|
|
7
|
+
| 역할 | 기술 |
|
|
8
|
+
|------|------|
|
|
9
|
+
| 프레임워크 | React 19 + TypeScript |
|
|
10
|
+
| 스타일링 | Panda CSS |
|
|
11
|
+
| 헤드리스 UI | Radix UI |
|
|
12
|
+
| 문서화 | Storybook 8 |
|
|
13
|
+
| 빌드 | Vite 6 |
|
|
14
|
+
| 패키지 매니저 | Bun |
|
|
15
|
+
|
|
16
|
+
## 시작하기
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 스크립트
|
|
23
|
+
|
|
24
|
+
| 명령어 | 설명 |
|
|
25
|
+
|--------|------|
|
|
26
|
+
| `bun run build` | 라이브러리 빌드 (`panda codegen` 포함) |
|
|
27
|
+
| `bun run dev` | watch 모드로 빌드 |
|
|
28
|
+
| `bun run storybook` | Storybook 개발 서버 실행 (포트 6006) |
|
|
29
|
+
| `bun run build-storybook` | Storybook 정적 빌드 |
|
|
30
|
+
| `bun run prepare` | Panda CSS 코드 생성 |
|
|
31
|
+
| `bun run typecheck` | TypeScript 타입 검사 |
|
|
32
|
+
| `bun run test` | 테스트 실행 |
|
|
33
|
+
| `bun run test:watch` | watch 모드로 테스트 실행 |
|
|
34
|
+
|
|
35
|
+
## 프로젝트 구조
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
moyeorakui/
|
|
39
|
+
├── src/
|
|
40
|
+
│ ├── components/ # 컴포넌트 (앞으로 추가될 위치)
|
|
41
|
+
│ ├── lib/
|
|
42
|
+
│ │ └── utils.ts # cx 유틸리티 (styled-system/css에서 re-export)
|
|
43
|
+
│ ├── styles.css # Panda CSS 레이어 선언
|
|
44
|
+
│ ├── env.d.ts # CSS 파일 타입 선언
|
|
45
|
+
│ ├── styles.css.d.ts # styles.css companion 타입
|
|
46
|
+
│ └── index.ts # 라이브러리 진입점
|
|
47
|
+
├── styled-system/ # Panda CSS codegen 결과물 (gitignore, bun install 시 자동 생성)
|
|
48
|
+
├── panda.config.ts # 디자인 토큰 및 테마 설정
|
|
49
|
+
├── vite.config.ts # 라이브러리 빌드 설정
|
|
50
|
+
└── .storybook/ # Storybook 설정
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 디자인 토큰
|
|
54
|
+
|
|
55
|
+
토큰은 `panda.config.ts` 한 곳에서 관리하며 두 레이어로 구성돼요.
|
|
56
|
+
|
|
57
|
+
### Atomic 토큰 (원시값)
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
colors.neutral.{0,50,100-900} 중립 색상 팔레트
|
|
61
|
+
colors.neutralOpacity.{100-900} 투명도 기반 중립 색상 (rgba)
|
|
62
|
+
colors.blue.{100-900} 브랜드 블루 팔레트
|
|
63
|
+
colors.red #f0405c
|
|
64
|
+
colors.green #00cf95
|
|
65
|
+
|
|
66
|
+
fontSizes.{xs|sm|md|lg|xl|2xl}
|
|
67
|
+
fontWeights.{regular|medium|semibold|bold}
|
|
68
|
+
letterSpacings.{tight|tighter}
|
|
69
|
+
radii.{2xs|xs|sm|md|lg|xl|full}
|
|
70
|
+
shadows.{subtle|default|strong|stronger}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Semantic 토큰 (의미 기반)
|
|
74
|
+
|
|
75
|
+
토큰 경로는 `요소.의도.강조단계` 구조를 따르며, 상태가 있는 경우 `강조단계-상태` 형식으로 표기해요.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
fg.neutral.{faintest|subtlest|subtler|subtle|default|strong|default-disabled}
|
|
79
|
+
fg.inverted.{default}
|
|
80
|
+
fg.brand.{subtlest|default}
|
|
81
|
+
fg.positive.{default}
|
|
82
|
+
fg.negative.{default}
|
|
83
|
+
|
|
84
|
+
stroke.neutral.{subtler|subtle|default|strong}
|
|
85
|
+
stroke.brand.{subtle|default}
|
|
86
|
+
stroke.negative.{default}
|
|
87
|
+
|
|
88
|
+
fill.neutral.{default|strong|stronger|strongest}
|
|
89
|
+
fill.inverted.{default|default-pressed|default-disabled}
|
|
90
|
+
fill.brand.{subtlest|subtler|subtle|subtle-pressed|default|default-pressed}
|
|
91
|
+
|
|
92
|
+
bg.neutral.{default|strong}
|
|
93
|
+
bg.dim.{default}
|
|
94
|
+
|
|
95
|
+
shadow.{subtle|default|strong|stronger}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 텍스트 스타일
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
head1 28px semibold
|
|
102
|
+
head2 24px bold
|
|
103
|
+
head3 24px semibold
|
|
104
|
+
title1 20px semibold
|
|
105
|
+
title2 20px regular
|
|
106
|
+
title3 16px semibold
|
|
107
|
+
body{1-2} 16px medium / regular
|
|
108
|
+
body{3-5} 14px semibold / medium / regular
|
|
109
|
+
caption{1-3} 12px semibold / medium / regular
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 컴포넌트 작성 가이드
|
|
113
|
+
|
|
114
|
+
Radix UI 프리미티브 위에 Panda CSS `cva`로 스타일을 입히는 패턴을 따라요.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
// src/components/Button/Button.tsx
|
|
118
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
119
|
+
import { cva, type VariantProps } from "../../../styled-system/css"
|
|
120
|
+
import { cx } from "../../lib/utils"
|
|
121
|
+
|
|
122
|
+
const buttonStyles = cva({
|
|
123
|
+
base: {
|
|
124
|
+
display: "inline-flex",
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
borderRadius: "md",
|
|
128
|
+
fontWeight: "semibold",
|
|
129
|
+
_disabled: { opacity: 0.5, pointerEvents: "none" },
|
|
130
|
+
},
|
|
131
|
+
variants: {
|
|
132
|
+
variant: {
|
|
133
|
+
primary: { bg: "fill.brand.default", color: "white" },
|
|
134
|
+
secondary: { bg: "fill.neutral.default", color: "fg.neutral.default" },
|
|
135
|
+
},
|
|
136
|
+
size: {
|
|
137
|
+
sm: { h: "32px", px: "12px", textStyle: "body3" },
|
|
138
|
+
md: { h: "40px", px: "16px", textStyle: "body2" },
|
|
139
|
+
lg: { h: "48px", px: "24px", textStyle: "body1" },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
defaultVariants: { variant: "primary", size: "md" },
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
export interface ButtonProps
|
|
146
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
147
|
+
VariantProps<typeof buttonStyles> {
|
|
148
|
+
asChild?: boolean
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function Button({ variant, size, asChild = false, className, ...props }: ButtonProps) {
|
|
152
|
+
const Comp = asChild ? Slot : "button"
|
|
153
|
+
return <Comp className={cx(buttonStyles({ variant, size }), className)} {...props} />
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 파일 구조 컨벤션
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
src/components/ComponentName/
|
|
161
|
+
├── index.ts # named export
|
|
162
|
+
├── ComponentName.tsx # 구현
|
|
163
|
+
└── ComponentName.stories.tsx # Storybook 스토리
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 다크 모드
|
|
167
|
+
|
|
168
|
+
현재 semantic 토큰에 `_dark` 값이 정의되지 않아 다크 모드를 지원하지 않아요. 추후 각 semantic 토큰에 `_dark` 값을 추가하면 `.dark` 클래스 기반으로 동작해요.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
// 다크 모드 추가 시 panda.config.ts 토큰 형태
|
|
172
|
+
fg: {
|
|
173
|
+
neutral: {
|
|
174
|
+
default: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.100}" } },
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 라이브러리 사용 (소비자)
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm install @moyeorak/design-system
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
// CSS import 필수
|
|
187
|
+
import "@moyeorak/design-system/dist/style.css"
|
|
188
|
+
|
|
189
|
+
import { Button } from "@moyeorak/design-system"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Panda CSS 코드 생성
|
|
193
|
+
|
|
194
|
+
`panda.config.ts`를 수정하면 반드시 codegen을 다시 실행해야 해요.
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
bun run prepare
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`styled-system/` 디렉토리는 gitignore 처리돼 있어요. `bun install` 시 `prepare` 스크립트로 자동 생성돼요.
|