@hua-labs/ui 1.1.0-alpha.2 → 1.1.0-alpha.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 +187 -881
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
# @hua-labs/ui
|
|
2
2
|
|
|
3
3
|
Modern React UI component library with 70+ production-ready components.
|
|
4
|
-
70개 이상의 프로덕션
|
|
4
|
+
70개 이상의 프로덕션 레디 React UI 컴포넌트 라이브러리
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/@hua-labs/ui)
|
|
7
7
|
[](https://www.npmjs.com/package/@hua-labs/ui)
|
|
8
8
|
[](https://github.com/HUA-Labs/HUA-Labs-public/blob/main/LICENSE)
|
|
9
|
+
[](https://reactjs.org/)
|
|
9
10
|
[](https://www.typescriptlang.org/)
|
|
10
11
|
|
|
11
12
|
> **⚠️ Alpha Release**: This package is currently in alpha. APIs may change before the stable release.
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
16
|
+
[English](#english) | [한국어](#korean)
|
|
17
|
+
|
|
15
18
|
## English
|
|
16
19
|
|
|
17
20
|
### Overview
|
|
21
|
+
|
|
18
22
|
Accessible, TypeScript-native component library for React applications. Provides modular entry points for optimal bundle size and comprehensive dark mode support.
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
### Features
|
|
21
25
|
|
|
22
26
|
- 70+ production-ready components
|
|
23
27
|
- Modular entry points for bundle optimization
|
|
@@ -29,7 +33,7 @@ Accessible, TypeScript-native component library for React applications. Provides
|
|
|
29
33
|
- Zero external dependencies (except React)
|
|
30
34
|
- Tailwind CSS based styling
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
### Installation
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
npm install @hua-labs/ui
|
|
@@ -49,90 +53,7 @@ npm install react react-dom
|
|
|
49
53
|
npm install @phosphor-icons/react
|
|
50
54
|
```
|
|
51
55
|
|
|
52
|
-
###
|
|
53
|
-
|
|
54
|
-
HUA UI는 **Core**, **Form**, **Advanced** 엔트리로 나뉩니다. 필요한 컴포넌트만 선택적으로 import하여 번들 크기를 최적화할 수 있습니다.
|
|
55
|
-
|
|
56
|
-
| Entry | Path | 설명 |
|
|
57
|
-
|-------|------|------|
|
|
58
|
-
| Core | `@hua-labs/ui` | 버튼/레이아웃/데이터 표시 등 기본 컴포넌트와 유틸 (대부분의 일반적인 앱 개발 가능) |
|
|
59
|
-
| Form | `@hua-labs/ui/form` | 모든 폼 컴포넌트 (Input, Select, DatePicker, Upload, Autocomplete 등) |
|
|
60
|
-
| Navigation | `@hua-labs/ui/navigation` | 대규모 앱 구조에 필요한 네비게이션 (PageNavigation, PageTransition) |
|
|
61
|
-
| Feedback | `@hua-labs/ui/feedback` | 글로벌 상태 관리가 필요한 Toast (ToastProvider, useToast) |
|
|
62
|
-
| Advanced (all) | `@hua-labs/ui/advanced` | 대시보드 위젯 + 고급 모션 전체 |
|
|
63
|
-
| Dashboard widgets | `@hua-labs/ui/advanced/dashboard` | StatCard, TransactionsTable, TrendChart 등 데이터 위젯 |
|
|
64
|
-
| Motion/Experimental | `@hua-labs/ui/advanced/motion` | AdvancedPageTransition 등 모션/실험 기능 |
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
// Core 컴포넌트 (가장 자주 사용되는 컴포넌트들)
|
|
68
|
-
import { Button, Card, Table, Badge, Alert, Modal, Drawer } from '@hua-labs/ui';
|
|
69
|
-
|
|
70
|
-
// Form 컴포넌트만 (번들 최적화)
|
|
71
|
-
import { Input, Select, DatePicker, Form } from '@hua-labs/ui/form';
|
|
72
|
-
|
|
73
|
-
// Navigation 컴포넌트 (대규모 앱에서만 필요)
|
|
74
|
-
import { PageNavigation, PageTransition } from '@hua-labs/ui/navigation';
|
|
75
|
-
|
|
76
|
-
// Feedback 컴포넌트 (Toast - 글로벌 상태 관리)
|
|
77
|
-
import { ToastProvider, useToast } from '@hua-labs/ui/feedback';
|
|
78
|
-
import '@hua-labs/ui/styles/toast.css';
|
|
79
|
-
|
|
80
|
-
// Advanced 전체
|
|
81
|
-
import { StatCard, DashboardSidebar } from '@hua-labs/ui/advanced';
|
|
82
|
-
|
|
83
|
-
// 필요한 영역만 선택적으로
|
|
84
|
-
import { TransactionsTable } from '@hua-labs/ui/advanced/dashboard';
|
|
85
|
-
import { AdvancedPageTransition } from '@hua-labs/ui/advanced/motion';
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**참고**: 서브패키지 분리 분석 문서는 [`docs/SUBPACKAGE_ANALYSIS.md`](./docs/SUBPACKAGE_ANALYSIS.md)를 참고하세요.
|
|
89
|
-
|
|
90
|
-
## Bundle Optimization
|
|
91
|
-
|
|
92
|
-
HUA UI는 모듈 단위 번들링과 tree-shaking을 지원합니다. 필요한 컴포넌트만 선택적으로 import하여 번들 크기를 최적화할 수 있습니다.
|
|
93
|
-
|
|
94
|
-
### 번들 최적화 전략
|
|
95
|
-
|
|
96
|
-
- **Core**: 가장 자주 사용하는 80% 컴포넌트 포함 (대부분의 일반적인 앱 개발 가능)
|
|
97
|
-
- **Form / Navigation / Feedback**: 필요한 경우에만 선택적으로 import
|
|
98
|
-
- **Advanced / Dashboard / Motion**: 대규모 앱에서만 사용하는 특수 컴포넌트
|
|
99
|
-
|
|
100
|
-
### 사용 예시
|
|
101
|
-
|
|
102
|
-
#### Next.js (Turbopack)
|
|
103
|
-
|
|
104
|
-
```tsx
|
|
105
|
-
// 권장: 필요한 서브패키지만 import (tree-shaking 자동 적용)
|
|
106
|
-
import { Input, Select, DatePicker } from '@hua-labs/ui/form';
|
|
107
|
-
import { PageTransition } from '@hua-labs/ui/navigation';
|
|
108
|
-
import { ToastProvider, useToast } from '@hua-labs/ui/feedback';
|
|
109
|
-
|
|
110
|
-
// Core 전체를 불러오지 않으므로 번들 크기 최적화
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
#### Vite / Webpack
|
|
114
|
-
|
|
115
|
-
```tsx
|
|
116
|
-
// 권장: 서브패키지 사용
|
|
117
|
-
import { Input } from '@hua-labs/ui/form';
|
|
118
|
-
import { PageTransition } from '@hua-labs/ui/navigation';
|
|
119
|
-
|
|
120
|
-
// 비권장: Core에서 모든 컴포넌트 import (번들 크기 증가)
|
|
121
|
-
import { Input, PageTransition, ToastProvider } from '@hua-labs/ui';
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Tree-shaking
|
|
125
|
-
|
|
126
|
-
모든 엔트리 포인트는 ESM 형식으로 제공되며, 최신 번들러(Next.js Turbopack, Vite, Webpack 5+)에서 tree-shaking이 자동으로 적용됩니다.
|
|
127
|
-
|
|
128
|
-
**최적화 팁**:
|
|
129
|
-
- 필요한 컴포넌트만 import
|
|
130
|
-
- 서브패키지 활용 (Form, Navigation, Feedback)
|
|
131
|
-
- Advanced 컴포넌트는 실제로 사용할 때만 import
|
|
132
|
-
|
|
133
|
-
**참고**: Core에서도 모든 컴포넌트를 import할 수 있습니다 (하위 호환성). 서브패키지는 번들 크기 최적화를 위한 선택사항입니다. Next.js + Turbopack 환경에서 tree-shaking이 자동 적용됩니다.
|
|
134
|
-
|
|
135
|
-
## Quick Start
|
|
56
|
+
### Quick Start
|
|
136
57
|
|
|
137
58
|
```tsx
|
|
138
59
|
import { Button, Input, Card, ThemeProvider } from '@hua-labs/ui';
|
|
@@ -157,896 +78,281 @@ function App() {
|
|
|
157
78
|
}
|
|
158
79
|
```
|
|
159
80
|
|
|
160
|
-
###
|
|
161
|
-
|
|
162
|
-
Toast 컴포넌트의 애니메이션을 사용하려면 CSS 파일을 import해야 합니다:
|
|
163
|
-
|
|
164
|
-
```css
|
|
165
|
-
/* globals.css 또는 메인 CSS 파일에 추가 */
|
|
166
|
-
@import '@hua-labs/ui/styles/toast.css';
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
또는 JavaScript/TypeScript에서:
|
|
170
|
-
|
|
171
|
-
```tsx
|
|
172
|
-
// app/layout.tsx 또는 _app.tsx
|
|
173
|
-
import '@hua-labs/ui/styles/toast.css';
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Core Components
|
|
177
|
-
|
|
178
|
-
### Basic UI
|
|
179
|
-
|
|
180
|
-
#### Button
|
|
181
|
-
|
|
182
|
-
```tsx
|
|
183
|
-
import { Button } from '@hua-labs/ui';
|
|
184
|
-
|
|
185
|
-
<Button>Default</Button>
|
|
186
|
-
<Button variant="outline">Outline</Button>
|
|
187
|
-
<Button variant="ghost">Ghost</Button>
|
|
188
|
-
<Button variant="destructive">Destructive</Button>
|
|
189
|
-
<Button variant="gradient">Gradient</Button>
|
|
190
|
-
<Button variant="neon">Neon</Button>
|
|
191
|
-
<Button variant="glass">Glass</Button>
|
|
192
|
-
<Button size="sm">Small</Button>
|
|
193
|
-
<Button size="md">Medium</Button>
|
|
194
|
-
<Button size="lg">Large</Button>
|
|
195
|
-
<Button loading>Loading</Button>
|
|
196
|
-
<Button disabled>Disabled</Button>
|
|
197
|
-
<Button fullWidth>Full Width</Button>
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
#### Action
|
|
201
|
-
|
|
202
|
-
Advanced button component with additional effects and styles.
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
import { Action } from '@hua-labs/ui';
|
|
206
|
-
|
|
207
|
-
<Action actionType="primary">Primary Action</Action>
|
|
208
|
-
<Action actionType="secondary">Secondary Action</Action>
|
|
209
|
-
<Action actionType="magical">Magical</Action>
|
|
210
|
-
<Action actionType="cyberpunk">Cyberpunk</Action>
|
|
211
|
-
<Action feedback="ripple">Ripple Effect</Action>
|
|
212
|
-
<Action feedback="particle">Particle Effect</Action>
|
|
213
|
-
<Action particleEffect rippleEffect>Multiple Effects</Action>
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### Input
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
import { Input } from '@hua-labs/ui';
|
|
220
|
-
|
|
221
|
-
<Input placeholder="Enter text" />
|
|
222
|
-
<Input type="password" />
|
|
223
|
-
<Input disabled />
|
|
224
|
-
<Input error="Error message" />
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
#### Icon
|
|
228
|
-
|
|
229
|
-
```tsx
|
|
230
|
-
import { Icon } from '@hua-labs/ui';
|
|
231
|
-
|
|
232
|
-
<Icon name="heart" />
|
|
233
|
-
<Icon name="star" size="lg" />
|
|
234
|
-
<Icon name="user" className="text-blue-500" />
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Supports Lucide React icons and optional Phosphor Icons.
|
|
238
|
-
|
|
239
|
-
#### Avatar
|
|
240
|
-
|
|
241
|
-
```tsx
|
|
242
|
-
import { Avatar, AvatarImage, AvatarFallback } from '@hua-labs/ui';
|
|
243
|
-
|
|
244
|
-
<Avatar>
|
|
245
|
-
<AvatarImage src="/avatar.jpg" alt="User" />
|
|
246
|
-
<AvatarFallback>JD</AvatarFallback>
|
|
247
|
-
</Avatar>
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Layout Components
|
|
251
|
-
|
|
252
|
-
#### Card
|
|
253
|
-
|
|
254
|
-
```tsx
|
|
255
|
-
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@hua-labs/ui';
|
|
256
|
-
|
|
257
|
-
<Card>
|
|
258
|
-
<CardHeader>
|
|
259
|
-
<CardTitle>Card Title</CardTitle>
|
|
260
|
-
<CardDescription>Card description</CardDescription>
|
|
261
|
-
</CardHeader>
|
|
262
|
-
<CardContent>
|
|
263
|
-
Card content
|
|
264
|
-
</CardContent>
|
|
265
|
-
<CardFooter>
|
|
266
|
-
Footer content
|
|
267
|
-
</CardFooter>
|
|
268
|
-
</Card>
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
#### Panel
|
|
272
|
-
|
|
273
|
-
Advanced card component with more styling options.
|
|
274
|
-
|
|
275
|
-
```tsx
|
|
276
|
-
import { Panel } from '@hua-labs/ui';
|
|
277
|
-
|
|
278
|
-
<Panel style="elevated" padding="large">
|
|
279
|
-
Elevated panel
|
|
280
|
-
</Panel>
|
|
281
|
-
<Panel style="outline" padding="medium">
|
|
282
|
-
Outline panel
|
|
283
|
-
</Panel>
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
#### Container
|
|
287
|
-
|
|
288
|
-
```tsx
|
|
289
|
-
import { Container } from '@hua-labs/ui';
|
|
290
|
-
|
|
291
|
-
<Container size="sm">Small container</Container>
|
|
292
|
-
<Container size="md">Medium container</Container>
|
|
293
|
-
<Container size="lg">Large container</Container>
|
|
294
|
-
<Container size="xl">Extra large container</Container>
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
#### Grid
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
import { Grid } from '@hua-labs/ui';
|
|
301
|
-
|
|
302
|
-
<Grid cols={3} gap={4}>
|
|
303
|
-
<div>Item 1</div>
|
|
304
|
-
<div>Item 2</div>
|
|
305
|
-
<div>Item 3</div>
|
|
306
|
-
</Grid>
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
#### Stack
|
|
310
|
-
|
|
311
|
-
```tsx
|
|
312
|
-
import { Stack } from '@hua-labs/ui';
|
|
313
|
-
|
|
314
|
-
<Stack direction="vertical" gap={4}>
|
|
315
|
-
<div>Item 1</div>
|
|
316
|
-
<div>Item 2</div>
|
|
317
|
-
</Stack>
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### Navigation Components
|
|
321
|
-
|
|
322
|
-
#### Navigation
|
|
323
|
-
|
|
324
|
-
```tsx
|
|
325
|
-
import { Navigation, NavigationList, NavigationItem, NavigationContent } from '@hua-labs/ui';
|
|
326
|
-
|
|
327
|
-
<Navigation defaultValue="tab1">
|
|
328
|
-
<NavigationList>
|
|
329
|
-
<NavigationItem value="tab1">Tab 1</NavigationItem>
|
|
330
|
-
<NavigationItem value="tab2">Tab 2</NavigationItem>
|
|
331
|
-
</NavigationList>
|
|
332
|
-
<NavigationContent value="tab1">Tab 1 content</NavigationContent>
|
|
333
|
-
<NavigationContent value="tab2">Tab 2 content</NavigationContent>
|
|
334
|
-
</Navigation>
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
#### Tabs
|
|
338
|
-
|
|
339
|
-
```tsx
|
|
340
|
-
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@hua-labs/ui';
|
|
341
|
-
|
|
342
|
-
<Tabs defaultValue="tab1">
|
|
343
|
-
<TabsList>
|
|
344
|
-
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
345
|
-
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
346
|
-
</TabsList>
|
|
347
|
-
<TabsContent value="tab1">Tab 1 content</TabsContent>
|
|
348
|
-
<TabsContent value="tab2">Tab 2 content</TabsContent>
|
|
349
|
-
</Tabs>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
#### Breadcrumb
|
|
353
|
-
|
|
354
|
-
```tsx
|
|
355
|
-
import { Breadcrumb, BreadcrumbItem } from '@hua-labs/ui';
|
|
356
|
-
|
|
357
|
-
<Breadcrumb>
|
|
358
|
-
<BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
359
|
-
<BreadcrumbItem href="/products">Products</BreadcrumbItem>
|
|
360
|
-
<BreadcrumbItem>Current</BreadcrumbItem>
|
|
361
|
-
</Breadcrumb>
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
#### Pagination
|
|
365
|
-
|
|
366
|
-
```tsx
|
|
367
|
-
import { Pagination, PaginationWithInfo } from '@hua-labs/ui';
|
|
368
|
-
|
|
369
|
-
<Pagination
|
|
370
|
-
currentPage={1}
|
|
371
|
-
totalPages={10}
|
|
372
|
-
onPageChange={(page) => console.log(page)}
|
|
373
|
-
/>
|
|
374
|
-
|
|
375
|
-
<PaginationWithInfo
|
|
376
|
-
currentPage={1}
|
|
377
|
-
totalPages={10}
|
|
378
|
-
totalItems={100}
|
|
379
|
-
itemsPerPage={10}
|
|
380
|
-
onPageChange={(page) => console.log(page)}
|
|
381
|
-
/>
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Form Components
|
|
385
|
-
|
|
386
|
-
#### Form
|
|
387
|
-
|
|
388
|
-
```tsx
|
|
389
|
-
import { Form, FormField, FormGroup } from '@hua-labs/ui';
|
|
390
|
-
|
|
391
|
-
<Form onSubmit={handleSubmit}>
|
|
392
|
-
<FormGroup>
|
|
393
|
-
<FormField label="Name" required>
|
|
394
|
-
<Input name="name" />
|
|
395
|
-
</FormField>
|
|
396
|
-
<FormField label="Email" required>
|
|
397
|
-
<Input type="email" name="email" />
|
|
398
|
-
</FormField>
|
|
399
|
-
</FormGroup>
|
|
400
|
-
</Form>
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
#### Select
|
|
404
|
-
|
|
405
|
-
```tsx
|
|
406
|
-
import { Select, SelectOption } from '@hua-labs/ui';
|
|
407
|
-
|
|
408
|
-
<Select value={value} onValueChange={setValue}>
|
|
409
|
-
<SelectOption value="option1">Option 1</SelectOption>
|
|
410
|
-
<SelectOption value="option2">Option 2</SelectOption>
|
|
411
|
-
</Select>
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
#### Checkbox
|
|
415
|
-
|
|
416
|
-
```tsx
|
|
417
|
-
import { Checkbox } from '@hua-labs/ui';
|
|
418
|
-
|
|
419
|
-
<Checkbox checked={checked} onCheckedChange={setChecked}>
|
|
420
|
-
Accept terms
|
|
421
|
-
</Checkbox>
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
#### Radio
|
|
425
|
-
|
|
426
|
-
```tsx
|
|
427
|
-
import { Radio } from '@hua-labs/ui';
|
|
428
|
-
|
|
429
|
-
<Radio value="option1" checked={value === "option1"} onChange={handleChange}>
|
|
430
|
-
Option 1
|
|
431
|
-
</Radio>
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
#### Switch
|
|
435
|
-
|
|
436
|
-
```tsx
|
|
437
|
-
import { Switch } from '@hua-labs/ui';
|
|
438
|
-
|
|
439
|
-
<Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
#### Textarea
|
|
443
|
-
|
|
444
|
-
```tsx
|
|
445
|
-
import { Textarea } from '@hua-labs/ui';
|
|
446
|
-
|
|
447
|
-
<Textarea placeholder="Enter text" rows={4} />
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
#### Slider
|
|
451
|
-
|
|
452
|
-
```tsx
|
|
453
|
-
import { Slider } from '@hua-labs/ui';
|
|
454
|
-
|
|
455
|
-
<Slider
|
|
456
|
-
value={value}
|
|
457
|
-
onValueChange={setValue}
|
|
458
|
-
min={0}
|
|
459
|
-
max={100}
|
|
460
|
-
step={1}
|
|
461
|
-
/>
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
### Feedback Components
|
|
465
|
-
|
|
466
|
-
#### Alert
|
|
467
|
-
|
|
468
|
-
```tsx
|
|
469
|
-
import { Alert, AlertSuccess, AlertWarning, AlertError, AlertInfo } from '@hua-labs/ui';
|
|
470
|
-
|
|
471
|
-
<Alert>Default alert</Alert>
|
|
472
|
-
<AlertSuccess>Success message</AlertSuccess>
|
|
473
|
-
<AlertWarning>Warning message</AlertWarning>
|
|
474
|
-
<AlertError>Error message</AlertError>
|
|
475
|
-
<AlertInfo>Info message</AlertInfo>
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
#### Toast
|
|
479
|
-
|
|
480
|
-
```tsx
|
|
481
|
-
import { ToastProvider, useToast } from '@hua-labs/ui';
|
|
482
|
-
|
|
483
|
-
function App() {
|
|
484
|
-
return (
|
|
485
|
-
<ToastProvider>
|
|
486
|
-
<YourApp />
|
|
487
|
-
</ToastProvider>
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
function Component() {
|
|
492
|
-
const { addToast } = useToast();
|
|
493
|
-
|
|
494
|
-
const handleClick = () => {
|
|
495
|
-
addToast({
|
|
496
|
-
title: "Success",
|
|
497
|
-
description: "Operation completed",
|
|
498
|
-
variant: "success"
|
|
499
|
-
});
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
return <Button onClick={handleClick}>Show Toast</Button>;
|
|
503
|
-
}
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
#### LoadingSpinner
|
|
507
|
-
|
|
508
|
-
```tsx
|
|
509
|
-
import { LoadingSpinner } from '@hua-labs/ui';
|
|
510
|
-
|
|
511
|
-
<LoadingSpinner />
|
|
512
|
-
<LoadingSpinner size="sm" />
|
|
513
|
-
<LoadingSpinner size="lg" />
|
|
514
|
-
<LoadingSpinner color="primary" />
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
#### Tooltip
|
|
518
|
-
|
|
519
|
-
```tsx
|
|
520
|
-
import { Tooltip, TooltipLight, TooltipDark } from '@hua-labs/ui';
|
|
521
|
-
|
|
522
|
-
<Tooltip content="Tooltip text">
|
|
523
|
-
<Button>Hover me</Button>
|
|
524
|
-
</Tooltip>
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
### Overlay Components
|
|
528
|
-
|
|
529
|
-
#### Modal
|
|
81
|
+
### Entry Points
|
|
530
82
|
|
|
531
|
-
|
|
532
|
-
import { Modal } from '@hua-labs/ui';
|
|
533
|
-
|
|
534
|
-
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
535
|
-
<div className="p-6">
|
|
536
|
-
<h2>Modal Title</h2>
|
|
537
|
-
<p>Modal content</p>
|
|
538
|
-
</div>
|
|
539
|
-
</Modal>
|
|
540
|
-
```
|
|
83
|
+
HUA UI is organized into **Core**, **Form**, **Navigation**, **Feedback**, and **Advanced** entry points. Import only the components you need from specific entry points to optimize bundle size.
|
|
541
84
|
|
|
542
|
-
|
|
85
|
+
| Entry | Path | Description |
|
|
86
|
+
|-------|------|-------------|
|
|
87
|
+
| Core | `@hua-labs/ui` | Most commonly used basic components (Button, Card, Badge, Alert, Modal, Drawer, etc.) |
|
|
88
|
+
| Form | `@hua-labs/ui/form` | All form components (Input, Select, DatePicker, Upload, Autocomplete, etc.) |
|
|
89
|
+
| Navigation | `@hua-labs/ui/navigation` | Navigation components for page transitions (PageNavigation, PageTransition) |
|
|
90
|
+
| Feedback | `@hua-labs/ui/feedback` | Toast notifications for user feedback (ToastProvider, useToast) |
|
|
91
|
+
| Advanced (all) | `@hua-labs/ui/advanced` | Advanced components + experimental features |
|
|
92
|
+
| Dashboard widgets | `@hua-labs/ui/advanced/dashboard` | Dashboard-specific components (StatCard, TransactionsTable, TrendChart, etc.) |
|
|
93
|
+
| Motion/Experimental | `@hua-labs/ui/advanced/motion` | AdvancedPageTransition and experimental features |
|
|
543
94
|
|
|
544
95
|
```tsx
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
<ConfirmModal
|
|
548
|
-
isOpen={isOpen}
|
|
549
|
-
onClose={() => setIsOpen(false)}
|
|
550
|
-
onConfirm={handleConfirm}
|
|
551
|
-
title="Confirm Action"
|
|
552
|
-
description="Are you sure you want to proceed?"
|
|
553
|
-
/>
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
#### Drawer
|
|
96
|
+
// Core components (most commonly used components)
|
|
97
|
+
import { Button, Card, Table, Badge, Alert, Modal, Drawer } from '@hua-labs/ui';
|
|
557
98
|
|
|
558
|
-
|
|
559
|
-
import {
|
|
560
|
-
|
|
561
|
-
<Drawer isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
562
|
-
<DrawerHeader>Drawer Title</DrawerHeader>
|
|
563
|
-
<DrawerContent>
|
|
564
|
-
Drawer content
|
|
565
|
-
</DrawerContent>
|
|
566
|
-
<DrawerFooter>
|
|
567
|
-
Footer actions
|
|
568
|
-
</DrawerFooter>
|
|
569
|
-
</Drawer>
|
|
570
|
-
```
|
|
99
|
+
// Form components (bundle optimized)
|
|
100
|
+
import { Input, Select, DatePicker, Form } from '@hua-labs/ui/form';
|
|
571
101
|
|
|
572
|
-
|
|
102
|
+
// Navigation components (for page transitions)
|
|
103
|
+
import { PageNavigation, PageTransition } from '@hua-labs/ui/navigation';
|
|
573
104
|
|
|
574
|
-
|
|
575
|
-
import {
|
|
576
|
-
|
|
577
|
-
<BottomSheet isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
578
|
-
<div className="p-6">
|
|
579
|
-
<h2>Bottom Sheet Title</h2>
|
|
580
|
-
<p>Bottom sheet content</p>
|
|
581
|
-
</div>
|
|
582
|
-
</BottomSheet>
|
|
583
|
-
```
|
|
105
|
+
// Feedback components (Toast - user feedback)
|
|
106
|
+
import { ToastProvider, useToast } from '@hua-labs/ui/feedback';
|
|
107
|
+
import '@hua-labs/ui/styles/toast.css';
|
|
584
108
|
|
|
585
|
-
|
|
109
|
+
// Advanced components
|
|
110
|
+
import { StatCard, DashboardSidebar } from '@hua-labs/ui/advanced';
|
|
586
111
|
|
|
587
|
-
|
|
588
|
-
import {
|
|
589
|
-
|
|
590
|
-
<Popover>
|
|
591
|
-
<PopoverTrigger>
|
|
592
|
-
<Button>Open Popover</Button>
|
|
593
|
-
</PopoverTrigger>
|
|
594
|
-
<PopoverContent>
|
|
595
|
-
Popover content
|
|
596
|
-
</PopoverContent>
|
|
597
|
-
</Popover>
|
|
112
|
+
// Import from specific sub-paths
|
|
113
|
+
import { TransactionsTable } from '@hua-labs/ui/advanced/dashboard';
|
|
114
|
+
import { AdvancedPageTransition } from '@hua-labs/ui/advanced/motion';
|
|
598
115
|
```
|
|
599
116
|
|
|
600
|
-
|
|
117
|
+
**Note**: See [package structure documentation](./docs/PACKAGE_STRUCTURE.md) for detailed entry point information.
|
|
601
118
|
|
|
602
|
-
|
|
603
|
-
import { Dropdown, DropdownMenu, DropdownItem, DropdownSeparator, DropdownLabel, DropdownGroup } from '@hua-labs/ui';
|
|
604
|
-
|
|
605
|
-
<Dropdown>
|
|
606
|
-
<DropdownMenu>
|
|
607
|
-
<DropdownLabel>My Account</DropdownLabel>
|
|
608
|
-
<DropdownSeparator />
|
|
609
|
-
<DropdownGroup>
|
|
610
|
-
<DropdownItem>Profile</DropdownItem>
|
|
611
|
-
<DropdownItem>Settings</DropdownItem>
|
|
612
|
-
</DropdownGroup>
|
|
613
|
-
<DropdownSeparator />
|
|
614
|
-
<DropdownItem>Logout</DropdownItem>
|
|
615
|
-
</DropdownMenu>
|
|
616
|
-
</Dropdown>
|
|
617
|
-
```
|
|
119
|
+
### Bundle Optimization
|
|
618
120
|
|
|
619
|
-
|
|
121
|
+
HUA UI supports modular entry points and tree-shaking. Import only the components you need from specific entry points to optimize bundle size.
|
|
620
122
|
|
|
621
|
-
|
|
123
|
+
**Optimization Tips**:
|
|
124
|
+
- Import only needed components
|
|
125
|
+
- Use specific entry points (Form, Navigation, Feedback)
|
|
126
|
+
- Import Advanced components only when actually used
|
|
622
127
|
|
|
623
|
-
|
|
624
|
-
import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell, TableCaption } from '@hua-labs/ui';
|
|
625
|
-
|
|
626
|
-
<Table>
|
|
627
|
-
<TableCaption>Table caption</TableCaption>
|
|
628
|
-
<TableHeader>
|
|
629
|
-
<TableRow>
|
|
630
|
-
<TableHead>Name</TableHead>
|
|
631
|
-
<TableHead>Email</TableHead>
|
|
632
|
-
</TableRow>
|
|
633
|
-
</TableHeader>
|
|
634
|
-
<TableBody>
|
|
635
|
-
<TableRow>
|
|
636
|
-
<TableCell>John Doe</TableCell>
|
|
637
|
-
<TableCell>john@example.com</TableCell>
|
|
638
|
-
</TableRow>
|
|
639
|
-
</TableBody>
|
|
640
|
-
</Table>
|
|
641
|
-
```
|
|
128
|
+
**Note**: You can import all components from Core, but it's not recommended. Using specific entry points provides better bundle size optimization. Next.js + Turbopack supports tree-shaking automatically.
|
|
642
129
|
|
|
643
|
-
|
|
130
|
+
### CSS Import (Toast Component Usage)
|
|
644
131
|
|
|
645
|
-
|
|
646
|
-
import { Badge } from '@hua-labs/ui';
|
|
132
|
+
If you use Toast components, you need to import the CSS file:
|
|
647
133
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
<Badge variant="error">Error</Badge>
|
|
652
|
-
<Badge variant="info">Info</Badge>
|
|
134
|
+
```css
|
|
135
|
+
/* Add to globals.css or main CSS file */
|
|
136
|
+
@import '@hua-labs/ui/styles/toast.css';
|
|
653
137
|
```
|
|
654
138
|
|
|
655
|
-
|
|
139
|
+
Or in JavaScript/TypeScript:
|
|
656
140
|
|
|
657
141
|
```tsx
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
<Progress value={50} />
|
|
661
|
-
<ProgressSuccess value={75} />
|
|
662
|
-
<ProgressWarning value={50} />
|
|
663
|
-
<ProgressError value={25} />
|
|
664
|
-
<ProgressInfo value={60} />
|
|
142
|
+
// app/layout.tsx or _app.tsx
|
|
143
|
+
import '@hua-labs/ui/styles/toast.css';
|
|
665
144
|
```
|
|
666
145
|
|
|
667
|
-
|
|
146
|
+
### API Overview
|
|
668
147
|
|
|
669
|
-
|
|
670
|
-
import { Skeleton, SkeletonText, SkeletonCircle, SkeletonCard, SkeletonAvatar } from '@hua-labs/ui';
|
|
148
|
+
#### Core Components
|
|
671
149
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
150
|
+
- **Basic UI**: Button, Action, Input, Icon, Avatar
|
|
151
|
+
- **Layout**: Container, Grid, Stack, Card, Panel
|
|
152
|
+
- **Navigation**: Navigation, Breadcrumb, Pagination, PageNavigation, PageTransition
|
|
153
|
+
- **Data Display**: Table, Badge, Progress, Skeleton
|
|
154
|
+
- **Feedback**: Alert, Toast, LoadingSpinner, Tooltip
|
|
155
|
+
- **Overlay**: Modal, Drawer, Popover, Dropdown, BottomSheet
|
|
156
|
+
- **Form**: Form, Input, Select, Checkbox, Radio, Switch, Slider, Textarea, DatePicker, Upload, Autocomplete
|
|
157
|
+
- **Interactive**: Accordion, Tabs, Menu, Command
|
|
158
|
+
- **Theme**: ThemeProvider, ThemeToggle
|
|
678
159
|
|
|
679
|
-
|
|
160
|
+
#### Utilities
|
|
680
161
|
|
|
681
|
-
|
|
162
|
+
- `merge`, `mergeIf`, `mergeMap`, `cn` - Class merging utilities
|
|
163
|
+
- `formatRelativeTime` - Date formatting utility
|
|
682
164
|
|
|
683
|
-
|
|
684
|
-
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@hua-labs/ui';
|
|
685
|
-
|
|
686
|
-
<Accordion type="single" collapsible>
|
|
687
|
-
<AccordionItem value="item-1">
|
|
688
|
-
<AccordionTrigger>Item 1</AccordionTrigger>
|
|
689
|
-
<AccordionContent>Content 1</AccordionContent>
|
|
690
|
-
</AccordionItem>
|
|
691
|
-
<AccordionItem value="item-2">
|
|
692
|
-
<AccordionTrigger>Item 2</AccordionTrigger>
|
|
693
|
-
<AccordionContent>Content 2</AccordionContent>
|
|
694
|
-
</AccordionItem>
|
|
695
|
-
</Accordion>
|
|
696
|
-
```
|
|
165
|
+
### Documentation
|
|
697
166
|
|
|
698
|
-
|
|
167
|
+
- [Architecture Documentation](./docs/ARCHITECTURE.md) - Core architecture and design principles
|
|
168
|
+
- [Package Structure](./docs/PACKAGE_STRUCTURE.md) - Package structure and internal organization
|
|
169
|
+
- [Development Guide](./docs/DEVELOPMENT_GUIDE.md) - Component development guide
|
|
170
|
+
- [Icon System](./docs/ICON_SYSTEM.md) - Icon system guide
|
|
699
171
|
|
|
700
|
-
|
|
701
|
-
import { Menu, MenuItem, MenuSeparator, MenuLabel, MenuHorizontal, MenuVertical } from '@hua-labs/ui';
|
|
702
|
-
|
|
703
|
-
<Menu>
|
|
704
|
-
<MenuItem>Item 1</MenuItem>
|
|
705
|
-
<MenuItem>Item 2</MenuItem>
|
|
706
|
-
<MenuSeparator />
|
|
707
|
-
<MenuLabel>Label</MenuLabel>
|
|
708
|
-
<MenuItem>Item 3</MenuItem>
|
|
709
|
-
</Menu>
|
|
710
|
-
```
|
|
172
|
+
### Related Packages
|
|
711
173
|
|
|
712
|
-
|
|
174
|
+
- [`@hua-labs/hua-ux`](../hua-ux/README.md) - Integrated framework (UI + Motion + i18n)
|
|
175
|
+
- [`@hua-labs/motion-core`](../hua-motion-core/README.md) - Animation hooks
|
|
176
|
+
- [`@hua-labs/i18n-core`](../hua-i18n-core/README.md) - Internationalization core
|
|
713
177
|
|
|
714
|
-
|
|
715
|
-
import { Command, CommandInput, CommandList, CommandItem, CommandGroup, CommandEmpty } from '@hua-labs/ui';
|
|
716
|
-
|
|
717
|
-
<Command>
|
|
718
|
-
<CommandInput placeholder="Search..." />
|
|
719
|
-
<CommandList>
|
|
720
|
-
<CommandEmpty>No results found.</CommandEmpty>
|
|
721
|
-
<CommandGroup heading="Suggestions">
|
|
722
|
-
<CommandItem>Calendar</CommandItem>
|
|
723
|
-
<CommandItem>Search Emoji</CommandItem>
|
|
724
|
-
</CommandGroup>
|
|
725
|
-
</CommandList>
|
|
726
|
-
</Command>
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
### Scroll Components
|
|
178
|
+
### Requirements
|
|
730
179
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
180
|
+
- React >= 19.0.0
|
|
181
|
+
- React DOM >= 19.0.0
|
|
182
|
+
- Tailwind CSS (for styling)
|
|
183
|
+
- Optional: @phosphor-icons/react (for Phosphor icon support)
|
|
735
184
|
|
|
736
|
-
|
|
737
|
-
className="fixed bottom-6 right-6"
|
|
738
|
-
threshold={150}
|
|
739
|
-
/>
|
|
740
|
-
```
|
|
185
|
+
## Korean
|
|
741
186
|
|
|
742
|
-
|
|
187
|
+
### 개요
|
|
743
188
|
|
|
744
|
-
|
|
745
|
-
import { ScrollProgress } from '@hua-labs/ui';
|
|
189
|
+
접근 가능하고 TypeScript 네이티브인 React 컴포넌트 라이브러리입니다. 최적의 번들 크기를 위한 모듈식 진입점과 포괄적인 다크 모드 지원을 제공합니다.
|
|
746
190
|
|
|
747
|
-
|
|
748
|
-
```
|
|
191
|
+
### 주요 기능
|
|
749
192
|
|
|
750
|
-
|
|
193
|
+
- 70개 이상의 프로덕션 레디 컴포넌트
|
|
194
|
+
- 번들 최적화를 위한 모듈식 진입점
|
|
195
|
+
- 완전한 TypeScript 지원
|
|
196
|
+
- 다크 모드 지원
|
|
197
|
+
- 접근성 (ARIA 속성, 키보드 네비게이션)
|
|
198
|
+
- 반응형 디자인
|
|
199
|
+
- Tree-shaking 친화적
|
|
200
|
+
- React 외부 의존성 없음
|
|
201
|
+
- Tailwind CSS 기반 스타일링
|
|
751
202
|
|
|
752
|
-
|
|
753
|
-
import { ScrollIndicator } from '@hua-labs/ui';
|
|
203
|
+
### 설치
|
|
754
204
|
|
|
755
|
-
|
|
205
|
+
```bash
|
|
206
|
+
npm install @hua-labs/ui
|
|
207
|
+
# or
|
|
208
|
+
yarn add @hua-labs/ui
|
|
209
|
+
# or
|
|
210
|
+
pnpm add @hua-labs/ui
|
|
756
211
|
```
|
|
757
212
|
|
|
758
|
-
|
|
213
|
+
### Peer Dependencies
|
|
759
214
|
|
|
760
|
-
```
|
|
761
|
-
|
|
215
|
+
```bash
|
|
216
|
+
# 필수
|
|
217
|
+
npm install react react-dom
|
|
762
218
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
</ScrollArea>
|
|
219
|
+
# 선택사항 (Phosphor Icons 지원용)
|
|
220
|
+
npm install @phosphor-icons/react
|
|
766
221
|
```
|
|
767
222
|
|
|
768
|
-
###
|
|
769
|
-
|
|
770
|
-
#### ThemeProvider
|
|
223
|
+
### 빠른 시작
|
|
771
224
|
|
|
772
225
|
```tsx
|
|
773
|
-
import { ThemeProvider } from '@hua-labs/ui';
|
|
226
|
+
import { Button, Input, Card, ThemeProvider } from '@hua-labs/ui';
|
|
774
227
|
|
|
775
228
|
function App() {
|
|
776
229
|
return (
|
|
777
|
-
<ThemeProvider
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
230
|
+
<ThemeProvider>
|
|
231
|
+
<div>
|
|
232
|
+
<Button>클릭하세요</Button>
|
|
233
|
+
<Input placeholder="텍스트 입력" />
|
|
234
|
+
<Card>
|
|
235
|
+
<CardHeader>
|
|
236
|
+
<CardTitle>카드 제목</CardTitle>
|
|
237
|
+
</CardHeader>
|
|
238
|
+
<CardContent>
|
|
239
|
+
카드 내용
|
|
240
|
+
</CardContent>
|
|
241
|
+
</Card>
|
|
242
|
+
</div>
|
|
783
243
|
</ThemeProvider>
|
|
784
244
|
);
|
|
785
245
|
}
|
|
786
246
|
```
|
|
787
247
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
```tsx
|
|
791
|
-
import { ThemeToggle } from '@hua-labs/ui';
|
|
792
|
-
|
|
793
|
-
<ThemeToggle />
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
### Specialized Components
|
|
797
|
-
|
|
798
|
-
#### ChatMessage
|
|
248
|
+
### 진입점
|
|
799
249
|
|
|
800
|
-
|
|
801
|
-
import { ChatMessage } from '@hua-labs/ui';
|
|
250
|
+
HUA UI는 **Core**, **Form**, **Navigation**, **Feedback**, **Advanced** 진입점으로 구성됩니다. 번들 크기를 최적화하려면 필요한 컴포넌트만 특정 진입점에서 import하세요.
|
|
802
251
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
```tsx
|
|
813
|
-
import { EmotionAnalysis } from '@hua-labs/ui';
|
|
814
|
-
|
|
815
|
-
<EmotionAnalysis
|
|
816
|
-
emotions={['joy', 'sadness', 'anger']}
|
|
817
|
-
intensity={[0.8, 0.3, 0.2]}
|
|
818
|
-
/>
|
|
819
|
-
```
|
|
820
|
-
|
|
821
|
-
#### EmotionSelector
|
|
822
|
-
|
|
823
|
-
```tsx
|
|
824
|
-
import { EmotionSelector } from '@hua-labs/ui';
|
|
825
|
-
|
|
826
|
-
<EmotionSelector
|
|
827
|
-
value={selectedEmotion}
|
|
828
|
-
onValueChange={setSelectedEmotion}
|
|
829
|
-
/>
|
|
830
|
-
```
|
|
831
|
-
|
|
832
|
-
#### InfoCard
|
|
833
|
-
|
|
834
|
-
```tsx
|
|
835
|
-
import { InfoCard } from '@hua-labs/ui';
|
|
836
|
-
|
|
837
|
-
<InfoCard
|
|
838
|
-
title="Information"
|
|
839
|
-
description="This is an info card"
|
|
840
|
-
variant="info"
|
|
841
|
-
/>
|
|
842
|
-
```
|
|
843
|
-
|
|
844
|
-
#### FeatureCard
|
|
845
|
-
|
|
846
|
-
```tsx
|
|
847
|
-
import { FeatureCard } from '@hua-labs/ui';
|
|
848
|
-
|
|
849
|
-
<FeatureCard
|
|
850
|
-
title="Feature"
|
|
851
|
-
description="Feature description"
|
|
852
|
-
icon={<Icon name="star" />}
|
|
853
|
-
/>
|
|
854
|
-
```
|
|
855
|
-
|
|
856
|
-
### Dashboard Components
|
|
857
|
-
|
|
858
|
-
Dashboard components are available from the advanced export:
|
|
859
|
-
|
|
860
|
-
```tsx
|
|
861
|
-
import {
|
|
862
|
-
StatCard,
|
|
863
|
-
QuickActionCard,
|
|
864
|
-
DashboardGrid,
|
|
865
|
-
ActivityFeed,
|
|
866
|
-
ProfileCard,
|
|
867
|
-
MembershipBadge,
|
|
868
|
-
MiniBarChart,
|
|
869
|
-
SummaryCard,
|
|
870
|
-
NotificationCard,
|
|
871
|
-
MetricCard,
|
|
872
|
-
ProgressCard
|
|
873
|
-
} from '@hua-labs/ui';
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
Or import from the dashboard subpath:
|
|
877
|
-
|
|
878
|
-
```tsx
|
|
879
|
-
import * from '@hua-labs/ui/advanced/dashboard';
|
|
880
|
-
```
|
|
881
|
-
|
|
882
|
-
### Advanced Page Transitions
|
|
883
|
-
|
|
884
|
-
Advanced page transition components are available from the advanced export:
|
|
885
|
-
|
|
886
|
-
```tsx
|
|
887
|
-
import {
|
|
888
|
-
AdvancedPageTransition,
|
|
889
|
-
usePageTransition,
|
|
890
|
-
usePageTransitionManager
|
|
891
|
-
} from '@hua-labs/ui/advanced';
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
## Utilities
|
|
895
|
-
|
|
896
|
-
### merge
|
|
897
|
-
|
|
898
|
-
Smart class merging utility that resolves duplicate Tailwind classes.
|
|
899
|
-
|
|
900
|
-
```tsx
|
|
901
|
-
import { merge } from '@hua-labs/ui';
|
|
902
|
-
|
|
903
|
-
const className = merge("px-2 py-1", "px-4"); // "py-1 px-4"
|
|
904
|
-
const className2 = merge("text-red-500", "text-blue-500"); // "text-blue-500"
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
### mergeIf
|
|
908
|
-
|
|
909
|
-
Conditional class merging.
|
|
910
|
-
|
|
911
|
-
```tsx
|
|
912
|
-
import { mergeIf } from '@hua-labs/ui';
|
|
913
|
-
|
|
914
|
-
const className = mergeIf(isActive, "bg-blue-500", "bg-gray-200");
|
|
915
|
-
const className2 = mergeIf(isLoading, "opacity-50 cursor-not-allowed");
|
|
916
|
-
```
|
|
917
|
-
|
|
918
|
-
### mergeMap
|
|
919
|
-
|
|
920
|
-
Object-based conditional class merging.
|
|
921
|
-
|
|
922
|
-
```tsx
|
|
923
|
-
import { mergeMap } from '@hua-labs/ui';
|
|
924
|
-
|
|
925
|
-
const className = mergeMap({
|
|
926
|
-
"bg-blue-500": isPrimary,
|
|
927
|
-
"bg-gray-500": !isPrimary,
|
|
928
|
-
"text-white": true,
|
|
929
|
-
"opacity-50": isDisabled
|
|
930
|
-
});
|
|
931
|
-
```
|
|
932
|
-
|
|
933
|
-
### cn
|
|
934
|
-
|
|
935
|
-
Alias for `merge` (for compatibility with shadcn/ui).
|
|
252
|
+
| 진입점 | 경로 | 설명 |
|
|
253
|
+
|--------|------|------|
|
|
254
|
+
| Core | `@hua-labs/ui` | 가장 많이 사용되는 기본 컴포넌트 (Button, Card, Badge, Alert, Modal, Drawer 등) |
|
|
255
|
+
| Form | `@hua-labs/ui/form` | 모든 폼 컴포넌트 (Input, Select, DatePicker, Upload, Autocomplete 등) |
|
|
256
|
+
| Navigation | `@hua-labs/ui/navigation` | 페이지 전환용 네비게이션 컴포넌트 (PageNavigation, PageTransition) |
|
|
257
|
+
| Feedback | `@hua-labs/ui/feedback` | 사용자 피드백용 Toast 알림 (ToastProvider, useToast) |
|
|
258
|
+
| Advanced (전체) | `@hua-labs/ui/advanced` | 고급 컴포넌트 + 실험적 기능 |
|
|
259
|
+
| Dashboard 위젯 | `@hua-labs/ui/advanced/dashboard` | 대시보드 전용 컴포넌트 (StatCard, TransactionsTable, TrendChart 등) |
|
|
260
|
+
| Motion/실험적 | `@hua-labs/ui/advanced/motion` | AdvancedPageTransition 및 실험적 기능 |
|
|
936
261
|
|
|
937
262
|
```tsx
|
|
938
|
-
|
|
263
|
+
// Core 컴포넌트 (가장 많이 사용되는 컴포넌트)
|
|
264
|
+
import { Button, Card, Table, Badge, Alert, Modal, Drawer } from '@hua-labs/ui';
|
|
939
265
|
|
|
940
|
-
|
|
941
|
-
|
|
266
|
+
// Form 컴포넌트 (번들 최적화)
|
|
267
|
+
import { Input, Select, DatePicker, Form } from '@hua-labs/ui/form';
|
|
942
268
|
|
|
943
|
-
|
|
269
|
+
// Navigation 컴포넌트 (페이지 전환용)
|
|
270
|
+
import { PageNavigation, PageTransition } from '@hua-labs/ui/navigation';
|
|
944
271
|
|
|
945
|
-
|
|
272
|
+
// Feedback 컴포넌트 (Toast - 사용자 피드백)
|
|
273
|
+
import { ToastProvider, useToast } from '@hua-labs/ui/feedback';
|
|
274
|
+
import '@hua-labs/ui/styles/toast.css';
|
|
946
275
|
|
|
947
|
-
|
|
948
|
-
import {
|
|
276
|
+
// Advanced 컴포넌트
|
|
277
|
+
import { StatCard, DashboardSidebar } from '@hua-labs/ui/advanced';
|
|
949
278
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
formatRelativeTime(new Date(Date.now() - 3 * 86400000)) // "3일 전"
|
|
954
|
-
formatRelativeTime(new Date("2024-01-01")) // "2024. 1. 1." (7일 이상 경과)
|
|
279
|
+
// 특정 하위 경로에서 import
|
|
280
|
+
import { TransactionsTable } from '@hua-labs/ui/advanced/dashboard';
|
|
281
|
+
import { AdvancedPageTransition } from '@hua-labs/ui/advanced/motion';
|
|
955
282
|
```
|
|
956
283
|
|
|
957
|
-
|
|
284
|
+
**참고**: 자세한 진입점 정보는 [패키지 구조 문서](./docs/PACKAGE_STRUCTURE.md)를 참고하세요.
|
|
958
285
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
- Lucide React (default, included)
|
|
962
|
-
- Phosphor Icons (optional, requires `@phosphor-icons/react`)
|
|
963
|
-
|
|
964
|
-
```tsx
|
|
965
|
-
import { Icon } from '@hua-labs/ui';
|
|
286
|
+
### 번들 최적화
|
|
966
287
|
|
|
967
|
-
|
|
968
|
-
<Icon name="heart" />
|
|
969
|
-
<Icon name="star" />
|
|
288
|
+
HUA UI는 모듈식 진입점과 tree-shaking을 지원합니다. 번들 크기를 최적화하려면 필요한 컴포넌트만 특정 진입점에서 import하세요.
|
|
970
289
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
290
|
+
**최적화 팁**:
|
|
291
|
+
- 필요한 컴포넌트만 import
|
|
292
|
+
- 특정 진입점 사용 (Form, Navigation, Feedback)
|
|
293
|
+
- Advanced 컴포넌트는 실제로 사용할 때만 import
|
|
974
294
|
|
|
975
|
-
|
|
295
|
+
**참고**: Core에서 모든 컴포넌트를 import할 수 있지만 권장하지 않습니다. 특정 진입점을 사용하면 더 나은 번들 크기 최적화를 제공합니다. Next.js + Turbopack은 자동으로 tree-shaking을 지원합니다.
|
|
976
296
|
|
|
977
|
-
###
|
|
297
|
+
### CSS Import (Toast 컴포넌트 사용 시)
|
|
978
298
|
|
|
979
|
-
|
|
980
|
-
import { Button, Input, Card } from '@hua-labs/ui';
|
|
981
|
-
```
|
|
299
|
+
Toast 컴포넌트를 사용하는 경우 CSS 파일을 import해야 합니다:
|
|
982
300
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
import * from '@hua-labs/ui/advanced';
|
|
987
|
-
import * from '@hua-labs/ui/advanced/dashboard';
|
|
988
|
-
import * from '@hua-labs/ui/advanced/motion';
|
|
301
|
+
```css
|
|
302
|
+
/* globals.css 또는 메인 CSS 파일에 추가 */
|
|
303
|
+
@import '@hua-labs/ui/styles/toast.css';
|
|
989
304
|
```
|
|
990
305
|
|
|
991
|
-
|
|
306
|
+
또는 JavaScript/TypeScript에서:
|
|
992
307
|
|
|
993
308
|
```tsx
|
|
309
|
+
// app/layout.tsx 또는 _app.tsx
|
|
994
310
|
import '@hua-labs/ui/styles/toast.css';
|
|
995
311
|
```
|
|
996
312
|
|
|
997
|
-
|
|
313
|
+
### API 개요
|
|
998
314
|
|
|
999
|
-
|
|
315
|
+
#### Core 컴포넌트
|
|
1000
316
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
317
|
+
- **기본 UI**: Button, Action, Input, Icon, Avatar
|
|
318
|
+
- **레이아웃**: Container, Grid, Stack, Card, Panel
|
|
319
|
+
- **네비게이션**: Navigation, Breadcrumb, Pagination, PageNavigation, PageTransition
|
|
320
|
+
- **데이터 표시**: Table, Badge, Progress, Skeleton
|
|
321
|
+
- **피드백**: Alert, Toast, LoadingSpinner, Tooltip
|
|
322
|
+
- **오버레이**: Modal, Drawer, Popover, Dropdown, BottomSheet
|
|
323
|
+
- **폼**: Form, Input, Select, Checkbox, Radio, Switch, Slider, Textarea, DatePicker, Upload, Autocomplete
|
|
324
|
+
- **인터랙티브**: Accordion, Tabs, Menu, Command
|
|
325
|
+
- **테마**: ThemeProvider, ThemeToggle
|
|
1004
326
|
|
|
1005
|
-
|
|
327
|
+
#### 유틸리티
|
|
1006
328
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
```
|
|
329
|
+
- `merge`, `mergeIf`, `mergeMap`, `cn` - 클래스 병합 유틸리티
|
|
330
|
+
- `formatRelativeTime` - 날짜 포맷팅 유틸리티
|
|
1010
331
|
|
|
1011
|
-
###
|
|
332
|
+
### 문서
|
|
1012
333
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
### Lint
|
|
1018
|
-
|
|
1019
|
-
```bash
|
|
1020
|
-
pnpm lint
|
|
1021
|
-
```
|
|
334
|
+
- [아키텍처 문서](./docs/ARCHITECTURE.md) - 핵심 아키텍처 및 설계 원칙
|
|
335
|
+
- [패키지 구조](./docs/PACKAGE_STRUCTURE.md) - 패키지 구조 및 내부 구조
|
|
336
|
+
- [개발 가이드](./docs/DEVELOPMENT_GUIDE.md) - 컴포넌트 추가 및 개발 가이드
|
|
337
|
+
- [아이콘 시스템](./docs/ICON_SYSTEM.md) - 아이콘 시스템 가이드
|
|
1022
338
|
|
|
1023
|
-
###
|
|
339
|
+
### 관련 패키지
|
|
1024
340
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
341
|
+
- [`@hua-labs/hua-ux`](../hua-ux/README.md) - 통합 프레임워크 (UI + Motion + i18n)
|
|
342
|
+
- [`@hua-labs/motion-core`](../hua-motion-core/README.md) - 애니메이션 훅
|
|
343
|
+
- [`@hua-labs/i18n-core`](../hua-i18n-core/README.md) - 국제화 핵심
|
|
1028
344
|
|
|
1029
|
-
|
|
345
|
+
### 요구사항
|
|
1030
346
|
|
|
1031
|
-
- React >=
|
|
1032
|
-
- React DOM >=
|
|
1033
|
-
- Tailwind CSS (
|
|
1034
|
-
-
|
|
347
|
+
- React >= 19.0.0
|
|
348
|
+
- React DOM >= 19.0.0
|
|
349
|
+
- Tailwind CSS (스타일링용)
|
|
350
|
+
- 선택사항: @phosphor-icons/react (Phosphor 아이콘 지원용)
|
|
1035
351
|
|
|
1036
352
|
## License
|
|
1037
353
|
|
|
1038
354
|
MIT License
|
|
1039
355
|
|
|
1040
|
-
## 문서
|
|
1041
|
-
|
|
1042
|
-
- [아키텍처 문서](./docs/ARCHITECTURE.md) - 전체 아키텍처 및 설계 원칙
|
|
1043
|
-
- [패키지 구조](./docs/PACKAGE_STRUCTURE.md) - 디렉토리 구조 및 파일 조직
|
|
1044
|
-
- [개발 가이드](./docs/DEVELOPMENT_GUIDE.md) - 컴포넌트 추가 및 개발 가이드
|
|
1045
|
-
- [모노레포/멀티레포 호환성](./docs/MONOREPO_COMPATIBILITY.md) - 모노레포 및 멀티레포 환경 호환성
|
|
1046
|
-
- [서브패키지 분석](./docs/SUBPACKAGE_ANALYSIS.md) - 서브패키지 분리 전략
|
|
1047
|
-
- [아이콘 시스템](./docs/ICON_SYSTEM.md) - 아이콘 시스템 가이드
|
|
1048
|
-
- [개선 사항](./docs/IMPROVEMENTS_2025-12-06.md) - 개선 이력
|
|
1049
|
-
|
|
1050
356
|
## Repository
|
|
1051
357
|
|
|
1052
|
-
https://github.com/HUA-Labs/HUA-Labs-public
|
|
358
|
+
<https://github.com/HUA-Labs/HUA-Labs-public>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hua-labs/ui",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.5",
|
|
4
4
|
"description": "HUA Labs - Modern React UI Component Library - Beautiful, accessible, and customizable components for React applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"tailwind-merge": "^2.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@phosphor-icons/react": "
|
|
69
|
+
"@phosphor-icons/react": "*",
|
|
70
70
|
"@testing-library/jest-dom": "^6.8.0",
|
|
71
71
|
"@testing-library/react": "^16.3.0",
|
|
72
72
|
"@testing-library/user-event": "^14.6.1",
|
|
73
73
|
"@types/jest": "^29.0.0",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^25.0.3",
|
|
75
75
|
"@types/react": "^19.2.7",
|
|
76
76
|
"@types/react-dom": "^19.2.3",
|
|
77
77
|
"@vitejs/plugin-react": "^5.1.1",
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"vitest": "^4.0.14"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@hua-labs/motion-core": "^2.1.0-alpha.0",
|
|
91
90
|
"@phosphor-icons/react": "*",
|
|
92
|
-
"react": ">=
|
|
93
|
-
"react-dom": ">=
|
|
91
|
+
"react": ">=19.0.0",
|
|
92
|
+
"react-dom": ">=19.0.0",
|
|
93
|
+
"@hua-labs/motion-core": "2.1.0-alpha.3"
|
|
94
94
|
},
|
|
95
95
|
"keywords": [
|
|
96
96
|
"hua-labs",
|
|
@@ -116,6 +116,10 @@
|
|
|
116
116
|
"url": "https://github.com/HUA-Labs/HUA-Labs-public/issues"
|
|
117
117
|
},
|
|
118
118
|
"homepage": "https://github.com/HUA-Labs/HUA-Labs-public#readme",
|
|
119
|
+
"publishConfig": {
|
|
120
|
+
"access": "public",
|
|
121
|
+
"provenance": true
|
|
122
|
+
},
|
|
119
123
|
"scripts": {
|
|
120
124
|
"build": "pnpm exec tsup && pnpm exec tsc --emitDeclarationOnly",
|
|
121
125
|
"build:watch": "pnpm exec tsup --watch",
|