@x-plat/design-system 0.5.42 → 0.5.44

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.
@@ -0,0 +1,248 @@
1
+ # @x-plat/design-system — AI 에이전트 셋업 프롬프트
2
+
3
+ ## 사용법
4
+
5
+ 이 문서 **전체를 복사** 해서 Figma Make / Claude / Cursor 등 AI 코딩 에이전트의 컨텍스트(시스템 프롬프트 / 첫 메시지)에 **붙여넣어** 사용한다. 새 프로젝트 시작 시 1회만 셋업하면 된다.
6
+
7
+ - 최신본 URL: `https://unpkg.com/@x-plat/design-system/guidelines/AGENT_PROMPT.md`
8
+ - 라이브러리 버전 업데이트 후에는 위 URL 에서 다시 받아 갱신 권장.
9
+
10
+ ---
11
+
12
+ ## 에이전트가 따라야 할 지침
13
+
14
+ 프로젝트는 `@x-plat/design-system` 의 컴포넌트·레이아웃·토큰만으로 구성한다. 아래 규칙을 절대 어기지 않는다.
15
+
16
+ ---
17
+
18
+ ## 절대 규칙
19
+
20
+ 1. 컴포넌트에 `color` / `className` / `style` prop **없음**. 색상·스타일은 내부 semantic 토큰으로 고정됨.
21
+ 2. 컴포넌트는 `width: 100%` 로 부모를 채우므로 **반드시 GridItem 또는 wrapper 로 감싸서 너비를 제어**.
22
+ 3. **CSS 로 DS 컴포넌트를 오버라이드하지 않는다**.
23
+ 4. 색상·간격·타이포는 **semantic 토큰만** 사용. primitive / brand 직접 참조 금지.
24
+
25
+ ---
26
+
27
+ ## Import
28
+
29
+ ```tsx
30
+ // 스타일 (앱 진입점에서 1회)
31
+ import "@x-plat/design-system/style.css";
32
+
33
+ // 컴포넌트
34
+ import { Button, Modal, ToastProvider, useToast, ... } from "@x-plat/design-system/components";
35
+
36
+ // 레이아웃
37
+ import { Layout, Header, SideBar, FullGrid, FullScreen, GapGrid, GridItem } from "@x-plat/design-system/layout";
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 앱 최상단 레이아웃 (필수 구조)
43
+
44
+ 컴포넌트가 이 구조에 맞게 설계되어 있어 **반드시 이 골격을 따른다**.
45
+
46
+ ### 중첩 순서
47
+
48
+ ```
49
+ ToastProvider ← 가장 바깥 (useToast 컨텍스트 범위 확보)
50
+ └─ Layout ← 전체 레이아웃 래퍼
51
+ ├─ header (prop) ← <Header /> 인스턴스를 prop 으로
52
+ ├─ sideBar (prop) ← <SideBar /> 인스턴스를 prop 으로
53
+ └─ children ← 메인 콘텐츠 (라우터 / 페이지)
54
+ ```
55
+
56
+ ### 코드 골격
57
+
58
+ ```tsx
59
+ import { ToastProvider } from "@x-plat/design-system/components";
60
+ import { Layout, Header, SideBar } from "@x-plat/design-system/layout";
61
+
62
+ function App() {
63
+ return (
64
+ <ToastProvider position="top-right">
65
+ <Layout
66
+ header={
67
+ <Header
68
+ logo={<img src="/logo.svg" />}
69
+ centerContent={<NavTabs />}
70
+ rightContent={<UserMenu />}
71
+ />
72
+ }
73
+ sideBar={
74
+ <SideBar>
75
+ {/* 메뉴 children */}
76
+ </SideBar>
77
+ }
78
+ >
79
+ {/* 페이지 콘텐츠 — children */}
80
+ <Router />
81
+ </Layout>
82
+ </ToastProvider>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ### Layout 컴포넌트 API
88
+
89
+ | Prop | 타입 | 설명 |
90
+ |---|---|---|
91
+ | `header` | `React.ReactElement<typeof Header>` (optional) | 상단 영역. `<Header/>` 인스턴스 |
92
+ | `sideBar` | `React.ReactElement` (optional) | 좌측 사이드. `<SideBar/>` 인스턴스 |
93
+ | `children` | `React.ReactNode` | 메인 콘텐츠 영역 |
94
+
95
+ ### Header 컴포넌트 API
96
+
97
+ | Prop | 타입 |
98
+ |---|---|
99
+ | `logo` | `React.ReactNode` (좌측) |
100
+ | `centerContent` | `React.ReactElement` (가운데) |
101
+ | `rightContent` | `React.ReactElement` (우측) |
102
+
103
+ ❌ `<Header title="..." />` 같은 형태 **없음** — 위 3개 prop 만 받는다.
104
+
105
+ ### SideBar 컴포넌트 API
106
+
107
+ | Prop | 타입 |
108
+ |---|---|
109
+ | `children` | 메뉴 항목들 |
110
+ | `className` | (optional) wrapper className |
111
+
112
+ 내부에 `useState` 로 open/close 토글 상태 보유. 자식이 `useContext(SideBarContext)` 로 `isSidebarOpen`, `handleSwitchSideBar` 접근 가능.
113
+
114
+ ---
115
+
116
+ ## Grid 시스템
117
+
118
+ 페이지 콘텐츠는 Grid 위에서 배치한다.
119
+
120
+ ```tsx
121
+ import { FullGrid, FullScreen, GapGrid, GridItem } from "@x-plat/design-system/layout";
122
+ ```
123
+
124
+ ### 컴포넌트
125
+
126
+ | 컴포넌트 | 용도 |
127
+ |---|---|
128
+ | `FullGrid` | 12 컬럼 반응형 그리드 컨테이너 |
129
+ | `FullScreen` | 전체 화면 그리드 |
130
+ | `GapGrid` | gap 만 적용하는 그리드 |
131
+ | `GridItem` | 그리드 아이템 (컬럼 span 지정) |
132
+
133
+ ### 브레이크포인트 (laptop / tablet / mobile)
134
+
135
+ | 브레이크포인트 | min-width | 최대 컬럼 수 |
136
+ |---|---|---|
137
+ | `default` (laptop) | 1024px | 12 |
138
+ | `tablet` | 768px | 8 |
139
+ | `mobile` | 0px | 4 |
140
+
141
+ ### GridItem 사용
142
+
143
+ ```tsx
144
+ <FullGrid gap={16}>
145
+ <GridItem column={{ default: 6, tablet: 4, mobile: 4 }}>
146
+ <Button type="primary">버튼</Button>
147
+ </GridItem>
148
+ <GridItem column={{ default: 6, tablet: 4, mobile: 4 }}>
149
+ <Input />
150
+ </GridItem>
151
+ </FullGrid>
152
+ ```
153
+
154
+ - `default`: laptop 이상에서 (1-12)
155
+ - `tablet`: tablet 폭에서 (1-8)
156
+ - `mobile`: mobile 폭에서 (1-4)
157
+ - 상위만 지정해도 하위 자동 적용 (예: `{ default: 6 }` → 모든 브레이크 6 칸)
158
+
159
+ ---
160
+
161
+ ## 컴포넌트 사용 패턴
162
+
163
+ ### ✅ 올바른 사용
164
+
165
+ ```tsx
166
+ <FullGrid>
167
+ <GridItem column={{ default: 6 }}>
168
+ <Button type="primary">저장</Button>
169
+ </GridItem>
170
+ </FullGrid>
171
+ ```
172
+
173
+ 또는 단순 wrapper:
174
+
175
+ ```tsx
176
+ <div style={{ width: 240 }}>
177
+ <Button type="primary">저장</Button>
178
+ </div>
179
+ ```
180
+
181
+ ### ❌ 금지
182
+
183
+ ```tsx
184
+ <Button color="blue" style={{ width: 200 }} className="my-btn">저장</Button>
185
+ ```
186
+
187
+ 이유: 컴포넌트가 `color/style/className` 을 받지 않고, 너비는 wrapper 에서 제어.
188
+
189
+ ---
190
+
191
+ ## 토큰 사용 (semantic 만)
192
+
193
+ ### 색상
194
+
195
+ CSS 변수 `--semantic-{category}-{role}` 사용.
196
+
197
+ | 카테고리 | 키 |
198
+ |---|---|
199
+ | `text` | strong / subtle / muted / brand / disabled / inverse / success / error / warning / info / link / sunday / saturday |
200
+ | `surface` | neutral.{default/subtle/strong/overlay/disabled} / brand.{subtle/default/strong} / success/error/warning/info.{subtle/default/strong} |
201
+ | `border` | default / subtle / strong / disabled / brand / success / error / warning / info |
202
+ | `icon` | strong / subtle / inverse / brand / success / error / warning / info / disabled |
203
+ | `emphasis` | brand / success / error / warning / info |
204
+ | `interaction` | overlay-10 / overlay-25 / focus-ring |
205
+ | `categorical` | 1-8 × {bg / area / fill / text} |
206
+
207
+ 예: `color: var(--semantic-text-strong)`, `background: var(--semantic-surface-brand-default)`
208
+
209
+ ### 스페이싱
210
+
211
+ | 카테고리 | 키 |
212
+ |---|---|
213
+ | `space` | none / 1 ~ 16 |
214
+ | `control-height` | xs / sm / md / lg |
215
+ | `radius` | none / sm / md / lg / xl / full |
216
+ | `stroke` | none / xs / sm / md / lg / xl / 2xl |
217
+
218
+ 예: `padding: var(--spacing-space-4)`, `border-radius: var(--spacing-radius-md)`
219
+
220
+ ### 타이포그래피 (Text Style 적용 권장)
221
+
222
+ 23 개 semantic 스타일: `display-1-b/sb`, `display-2-b/sb`, `title-1/2-sb/m`, `heading-1/2-sb/m`, `body-1/2-sb/m/r`, `label-1/2-sb/m`, `caption-1/2-sb/r`
223
+
224
+ ---
225
+
226
+ ## 컴포넌트 카탈로그
227
+
228
+ | 카테고리 | 컴포넌트 |
229
+ |---|---|
230
+ | 입력 | `Button`, `Input`, `PasswordInput`, `TextArea`, `Select`, `CheckBox`, `Radio`, `Switch`, `DatePicker`, `Calendar` |
231
+ | 표시 | `Table`, `Card`, `Tag`, `Chip`, `Avatar`, `Badge`, `Skeleton`, `Spinner`, `Divider`, `EmptyState`, `Progress` |
232
+ | 오버레이 | `Modal`, `Drawer`, `PopOver`, `Tooltip`, `Alert`, `Toast` (`ToastProvider` 필요) |
233
+ | 네비 | `Tab`, `CardTab`, `Breadcrumb`, `Pagination`, `Steps`, `Dropdown` |
234
+ | 미디어 | `Video`, `FileUpload`, `ImageSelector`, `Swiper` |
235
+ | 기타 | `Accordion`, `Chart`, `HtmlTypeWriter` |
236
+
237
+ ---
238
+
239
+ ## 추가 참조 (필요 시 fetch)
240
+
241
+ unpkg 로 항상 최신 가이드 접근 가능:
242
+
243
+ - 전체 가이드라인: `https://unpkg.com/@x-plat/design-system/guidelines/Guidelines.md`
244
+ - 설치/설정: `https://unpkg.com/@x-plat/design-system/guidelines/setup.md`
245
+ - 색상 토큰: `https://unpkg.com/@x-plat/design-system/guidelines/foundations/color.md`
246
+ - 컴포넌트별 가이드: `https://unpkg.com/@x-plat/design-system/guidelines/components/{name}.md`
247
+ - Layout 상세: `https://unpkg.com/@x-plat/design-system/guidelines/composition/layout.md`
248
+ - Grid 상세: `https://unpkg.com/@x-plat/design-system/guidelines/composition/grid.md`
@@ -4,6 +4,14 @@ React 기반 디자인 시스템 라이브러리이다. Figma Make Kit과 1:1
4
4
 
5
5
  ---
6
6
 
7
+ ## AI 에이전트로 작업할 때 (Figma Make / Claude / Cursor)
8
+
9
+ 새 프로젝트를 AI 에이전트로 시작할 때는 [AGENT_PROMPT.md](./AGENT_PROMPT.md) 전체를 복사해서 에이전트의 시스템 프롬프트 / 첫 메시지에 붙여넣는다. 에이전트가 본 가이드라인 규칙을 따르도록 만든다.
10
+
11
+ - 최신본: `https://unpkg.com/@x-plat/design-system/guidelines/AGENT_PROMPT.md`
12
+
13
+ ---
14
+
7
15
  ## 핵심 규칙
8
16
 
9
17
  1. **컴포넌트에 `color`, `className`, `style` prop이 없다.** 색상과 스타일은 내부 semantic 토큰으로 고정한다.
@@ -1,30 +1,101 @@
1
1
  # Layout / Header / SideBar
2
2
 
3
- ## 페이지 레이아웃 구조
3
+ 페이지 전체 골격을 잡는 컴포넌트.
4
4
 
5
5
  ```tsx
6
6
  import { Layout, Header, SideBar } from "@x-plat/design-system/layout";
7
7
  ```
8
8
 
9
- Layout은 Header와 SideBar를 포함하는 페이지 전체 구조를 제공한다.
9
+ ---
10
+
11
+ ## API 요약
12
+
13
+ ### Layout
14
+
15
+ | Prop | 타입 | 설명 |
16
+ |---|---|---|
17
+ | `header` | `React.ReactElement<typeof Header>` (optional) | 상단 헤더 영역. `<Header/>` 인스턴스 |
18
+ | `sideBar` | `React.ReactElement` (optional) | 좌측 사이드바 영역. `<SideBar/>` 인스턴스 |
19
+ | `children` | `React.ReactNode` | 메인 콘텐츠 영역 |
20
+
21
+ > 주의: `Layout.Content` 같은 서브 컴포넌트는 **없다**. 메인 콘텐츠는 그냥 `children` 으로 직접 전달.
22
+
23
+ ### Header
24
+
25
+ | Prop | 타입 |
26
+ |---|---|
27
+ | `logo` | `React.ReactNode` — 좌측 영역 |
28
+ | `centerContent` | `React.ReactElement` — 가운데 영역 |
29
+ | `rightContent` | `React.ReactElement` — 우측 영역 |
30
+
31
+ > `title` prop 은 없다. 텍스트가 필요하면 `logo` 또는 `centerContent` 안에 직접 배치.
32
+
33
+ ### SideBar
34
+
35
+ | Prop | 타입 |
36
+ |---|---|
37
+ | `children` | 메뉴 항목들 |
38
+ | `className` | (optional) wrapper className |
39
+
40
+ 자체적으로 open/close 토글 상태를 관리. 자식이 `SideBarContext` 로 `isSidebarOpen`, `handleSwitchSideBar` 에 접근 가능.
10
41
 
11
42
  ---
12
43
 
13
- ## 예시
44
+ ## 기본 골격
14
45
 
15
46
  ```tsx
16
- <Layout>
17
- <Header title="대시보드" />
18
- <SideBar>
19
- <SideBar.Item>메뉴 1</SideBar.Item>
20
- <SideBar.Item>메뉴 2</SideBar.Item>
21
- </SideBar>
22
- <Layout.Content>
23
- <FullGrid>
24
- <GridItem column={12}>
25
- <p>페이지 내용</p>
26
- </GridItem>
27
- </FullGrid>
28
- </Layout.Content>
47
+ import { ToastProvider } from "@x-plat/design-system/components";
48
+ import { Layout, Header, SideBar } from "@x-plat/design-system/layout";
49
+
50
+ function App() {
51
+ return (
52
+ <ToastProvider position="top-right">
53
+ <Layout
54
+ header={
55
+ <Header
56
+ logo={<img src="/logo.svg" alt="logo" />}
57
+ centerContent={<NavTabs />}
58
+ rightContent={<UserMenu />}
59
+ />
60
+ }
61
+ sideBar={
62
+ <SideBar>
63
+ <Menu />
64
+ </SideBar>
65
+ }
66
+ >
67
+ {/* 페이지 콘텐츠 (라우터 등) */}
68
+ <Router />
69
+ </Layout>
70
+ </ToastProvider>
71
+ );
72
+ }
73
+ ```
74
+
75
+ 권장 중첩 순서: `ToastProvider > Layout > (header / sideBar / children)`.
76
+
77
+ 자세한 ToastProvider 배치 이유는 [../setup.md](../setup.md#toastprovider-설정) 참고.
78
+
79
+ ---
80
+
81
+ ## 페이지 콘텐츠 구성
82
+
83
+ `Layout` 의 `children` 안에서는 Grid 시스템으로 배치한다.
84
+
85
+ ```tsx
86
+ <Layout header={...} sideBar={...}>
87
+ <FullGrid gap={16}>
88
+ <GridItem column={{ default: 12 }}>
89
+ <h1>대시보드</h1>
90
+ </GridItem>
91
+ <GridItem column={{ default: 8, tablet: 8, mobile: 4 }}>
92
+ <Card>본문</Card>
93
+ </GridItem>
94
+ <GridItem column={{ default: 4, tablet: 8, mobile: 4 }}>
95
+ <Card>사이드</Card>
96
+ </GridItem>
97
+ </FullGrid>
29
98
  </Layout>
30
99
  ```
100
+
101
+ Grid 상세는 [./grid.md](./grid.md) 참고.
@@ -25,18 +25,27 @@ import { Layout, Header, SideBar } from "@x-plat/design-system/layout";
25
25
  import { FullGrid, GridItem } from "@x-plat/design-system/layout";
26
26
  ```
27
27
 
28
+ > 페이지 최상단에 Layout/Header/SideBar/Layout.Content 를 배치하는 구조와 예시는 [composition/layout.md](./composition/layout.md) 참고.
29
+
28
30
  ## ToastProvider 설정
29
31
 
30
- 앱 최상위에 ToastProvider를 배치한다.
32
+ 앱 최상위에 ToastProvider를 배치한다. **Layout 보다 바깥** 에 두어야 Header / SideBar / Layout.Content 안 어디서든 `useToast()` 훅을 호출할 수 있다.
31
33
 
32
34
  ```tsx
33
35
  import { ToastProvider } from "@x-plat/design-system/components";
36
+ import { Layout, Header, SideBar } from "@x-plat/design-system/layout";
34
37
 
35
38
  function App() {
36
39
  return (
37
40
  <ToastProvider position="top-right">
38
- <MyApp />
41
+ <Layout>
42
+ <Header title="..." />
43
+ <SideBar>...</SideBar>
44
+ <Layout.Content>{/* 라우터 */}</Layout.Content>
45
+ </Layout>
39
46
  </ToastProvider>
40
47
  );
41
48
  }
42
49
  ```
50
+
51
+ 권장 중첩 순서: `ToastProvider > Layout > (Header / SideBar / Layout.Content)`. ToastProvider 는 `createPortal` 로 `document.body` 에 렌더하므로 시각적 z-index 는 관계없지만, `useToast()` 의 컨텍스트 범위를 확보하려면 Layout 을 감싸야 한다.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-plat/design-system",
3
- "version": "0.5.42",
3
+ "version": "0.5.44",
4
4
  "description": "XPLAT UI Design System",
5
5
  "author": "XPLAT WOONG",
6
6
  "main": "dist/index.cjs",