shared-design-system 1.3.0 → 1.5.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 CHANGED
@@ -1,258 +1,258 @@
1
- # Shared Design System
2
-
3
- Bộ thư viện thành phần giao diện dùng chung (Common Components) dành cho kiến trúc Microfrontend Portal.
4
-
5
- > **v1.4.0** — Toàn bộ 21 component đã được migrate sang **TypeScript** với strict prop interfaces và full IntelliSense support.
6
-
7
- ## 🚀 Cài đặt
8
-
9
- Thư viện này được quản lý như một package nội bộ trong monorepo. Các MFE có thể sử dụng bằng cách import trực tiếp:
10
-
11
- ```typescript
12
- // Import component + type
13
- import { Button, type ButtonProps } from '@tonght3/shared-design-system';
14
- import { Card, Badge, tokens } from '@tonght3/shared-design-system';
15
- ```
16
-
17
- ## 🎨 Design Tokens
18
-
19
- Thư viện sử dụng hệ thống Design Tokens tập trung tại `src/tokens.ts`. Bạn nên sử dụng các token này thay vì mã màu hardcode để đảm bảo tính nhất quán.
20
-
21
- ```typescript
22
- import { tokens, type DesignTokens } from '@tonght3/shared-design-system';
23
-
24
- const myStyle = {
25
- color: tokens.color.primary,
26
- padding: tokens.spacing['4'],
27
- borderRadius: tokens.radius.md
28
- };
29
- ```
30
-
31
- ## 🧱 Các thành phần chính
32
-
33
- ### 1. Button
34
- Thành phần nút bấm đa năng với các biến thể: `primary`, `secondary`, `danger`, `ghost`.
35
-
36
- ```jsx
37
- <Button variant="primary" onClick={handleClick}>Xác nhận</Button>
38
- <Button variant="ghost" size="sm">Hủy</Button>
39
- ```
40
-
41
- ### 2. Badge
42
- Dùng để hiển thị trạng thái hoặc nhãn dán. Các variant: `success`, `warning`, `danger`, `info`, `slate`.
43
-
44
- ```jsx
45
- <Badge variant="success">Hoàn thành</Badge>
46
- <Badge variant="warning">Chờ duyệt</Badge>
47
- ```
48
-
49
- ### 3. Form Components
50
- Bộ công cụ nhập liệu đồng bộ: `Input`, `Textarea`, `Select`, `Checkbox`.
51
-
52
- ```jsx
53
- <Input label="Họ và tên" placeholder="Nhập tên..." required />
54
- <Select label="Phòng ban">
55
- <option value="IT">Công nghệ thông tin</option>
56
- <option value="HR">Nhân sự</option>
57
- </Select>
58
- ```
59
-
60
- ### 4. Card
61
- Thành phần container dùng để nhóm nội dung. Hỗ trợ `title`, `subtitle` và `footer`.
62
-
63
- ```jsx
64
- <Card title="Thông tin cá nhân" subtitle="Chi tiết hồ sơ nhân viên">
65
- <Text>Thông tin bên trong card...</Text>
66
- </Card>
67
- ```
68
-
69
- ### 5. Typography
70
- Enforce font types và hierarchy: `Heading`, `Text`, `SectionHeader`.
71
-
72
- ```jsx
73
- <Heading level={2}>Tiêu đề lớn</Heading>
74
- <Text size="sm" color="muted">Ghi chú nhỏ</Text>
75
- <SectionHeader title="Thông tin nghiệp vụ" />
76
- ```
77
-
78
- ### 6. ReadOnlyField
79
- Sử dụng trong các màn hình chi tiết để hiển thị dữ liệu ở chế độ chỉ đọc một cách chuyên nghiệp.
80
-
81
- ```jsx
82
- <ReadOnlyField label="Mã yêu cầu" value="RQ-2024-001" />
83
- ```
84
-
85
- ### 7. LoadingSpinner
86
- Animation quay đều sử dụng màu thương hiệu để biểu thị trạng thái đang tải.
87
-
88
- ```jsx
89
- <LoadingSpinner size="md" />
90
- ```
91
-
92
- ---
93
-
94
- ## 🌟 Thành phần nâng cao (Phase 2 - Cảm hứng từ MUI)
95
-
96
- ### 8. Avatar
97
- Hiển thị ảnh đại diện hoặc chữ cái đầu. Hỗ trợ nhiều kích thước (`xs` đến `xl`) và hình dạng (`circle`, `rounded`, `square`).
98
-
99
- ```jsx
100
- <Avatar src="/path/to/img.jpg" size="lg" />
101
- <Avatar variant="rounded">JD</Avatar>
102
- ```
103
-
104
- ### 9. Switch
105
- Nút gạt bật/tắt hiện đại thay thế cho Checkbox.
106
-
107
- ```jsx
108
- <Switch checked={isActive} onChange={toggle} label="Kích hoạt tính năng" />
109
- ```
110
-
111
- ### 10. Tabs & Tab
112
- Hệ thống chuyển đổi nội dung dạng tab. Hỗ trợ variant `standard` và `pills`.
113
-
114
- ```jsx
115
- <Tabs value={tabIndex} onChange={setTabIndex}>
116
- <Tab value={0} label="Tổng quan" icon={<HomeIcon />} />
117
- <Tab value={1} label="Lịch sử" />
118
- </Tabs>
119
- ```
120
-
121
- ### 11. Breadcrumbs
122
- Định vị vị trí trong cấu trúc trang.
123
-
124
- ```jsx
125
- <Breadcrumbs items={[
126
- { label: 'Trang chủ', onClick: goHome },
127
- { label: 'Cài đặt', onClick: goSettings },
128
- { label: 'Thông tin cá nhân' }
129
- ]} />
130
- ```
131
-
132
- ### 12. Skeleton
133
- Hiệu ứng placeholder khi đang tải dữ liệu.
134
-
135
- ```jsx
136
- <Skeleton variant="circle" width="40px" height="40px" />
137
- <Skeleton variant="rectangular" height="200px" />
138
- <Skeleton variant="text" width="60%" />
139
- ```
140
-
141
- ### 13. Tooltip
142
- Hiển thị chú thích khi di chuột. Hỗ trợ 4 hướng: `top`, `bottom`, `left`, `right`.
143
-
144
- ```jsx
145
- <Tooltip title="Xóa bản ghi này" position="top">
146
- <Button variant="danger">Xóa</Button>
147
- </Tooltip>
148
- ```
149
-
150
- ### 14. Divider
151
- Đường kẻ phân tách nội dung.
152
-
153
- ```jsx
154
- <Divider orientation="horizontal" margin="lg" />
155
- ```
156
-
157
- ---
158
-
159
- ## 🚀 Tính năng mở rộng (Phase 3 - Robust System)
160
-
161
- ### 15. Stack
162
- Công cụ quản lý bố cục và khoảng cách tự động.
163
-
164
- ```jsx
165
- <Stack direction="row" spacing="md" align="center">
166
- <Button>Lưu</Button>
167
- <Button variant="ghost">Hủy</Button>
168
- </Stack>
169
- ```
170
-
171
- ### 16. Alert
172
- Thanh thông báo theo mức độ nghiêm trọng: `success`, `info`, `warning`, `error`.
173
-
174
- ```jsx
175
- <Alert severity="success" title="Thành công">Dữ liệu đã được lưu.</Alert>
176
- <Alert severity="error">Có lỗi xảy ra, vui lòng thử lại.</Alert>
177
- ```
178
-
179
- ### 17. Tag/Chip
180
- Nhãn dán cho dữ liệu, hỗ trợ nút đóng (close).
181
-
182
- ```jsx
183
- <Tag color="primary" variant="solid">Mới</Tag>
184
- <Tag color="danger" onClose={handleDelete}>Hết hạn</Tag>
185
- ```
186
-
187
- ### 18. Progress
188
- Thanh tiến trình dạng đường thẳng (Linear Progress).
189
-
190
- ```jsx
191
- <Progress value={75} showLabel color="success" />
192
- ```
193
-
194
- ### 19. Steps
195
- Thanh điều hướng quy trình (Workflow). Hỗ trợ chiều dọc và chiều ngang.
196
-
197
- ```jsx
198
- <Steps
199
- current={1}
200
- items={[
201
- { title: 'Khởi tạo', description: 'User gửi yêu cầu' },
202
- { title: 'Phê duyệt', description: 'Đang chờ quản lý' },
203
- { title: 'Hoàn tất' }
204
- ]}
205
- />
206
- ```
207
-
208
- ### 20. Table (Styled)
209
- Bộ thành phần xây dựng bảng dữ liệu chuyên nghiệp.
210
-
211
- ```jsx
212
- <TableContainer>
213
- <THead>
214
- <TR>
215
- <TH>Họ Tên</TH>
216
- <TH>Trạng Thái</TH>
217
- </TR>
218
- </THead>
219
- <TBody>
220
- <TR>
221
- <TD>Nguyễn Văn A</TD>
222
- <TD><Badge variant="success">Active</Badge></TD>
223
- </TR>
224
- </TBody>
225
- </TableContainer>
226
- ```
227
-
228
- ### 21. Radio & RadioGroup
229
- Lựa chọn duy nhất trong danh sách.
230
-
231
- ```jsx
232
- <RadioGroup direction="row">
233
- <Radio name="gender" value="male" label="Nam" checked />
234
- <Radio name="gender" value="female" label="Nữ" />
235
- </RadioGroup>
236
- ```
237
-
238
- ## 🛠 Nguyên tắc phát triển
239
-
240
- 1. **Tokens First**: Luôn kiểm tra `src/tokens.ts` trước khi thêm giá trị mới.
241
- 2. **Stateless**: Giữ component đơn giản nhất có thể, chỉ xử lý UI và nhận data qua props.
242
- 3. **Prefixing**: Khi kết hợp với Tailwind trong từng MFE, hãy sử dụng prefix tương ứng của MFE đó để tránh xung đột style với Portal.
243
- 4. **Type-safe**: Mỗi component có Props interface riêng. Luôn import type khi chỉ cần dùng cho annotation.
244
-
245
- ## 📦 Build & Publish
246
-
247
- ```bash
248
- # Type-check
249
- npm run typecheck
250
-
251
- # Build ra dist/ (tự động chạy khi publish)
252
- npm run build
253
-
254
- # Publish (tự động chạy typecheck + build trước)
255
- npm publish
256
- ```
257
-
258
- > **Lưu ý:** File `dist/` được generate tự động, không commit vào git.
1
+ # Shared Design System
2
+
3
+ Bộ thư viện thành phần giao diện dùng chung (Common Components) dành cho kiến trúc Microfrontend Portal.
4
+
5
+ > **v1.4.0** — Toàn bộ 21 component đã được migrate sang **TypeScript** với strict prop interfaces và full IntelliSense support.
6
+
7
+ ## 🚀 Cài đặt
8
+
9
+ Thư viện này được quản lý như một package nội bộ trong monorepo. Các MFE có thể sử dụng bằng cách import trực tiếp:
10
+
11
+ ```typescript
12
+ // Import component + type
13
+ import { Button, type ButtonProps } from 'shared-design-system';
14
+ import { Card, Badge, tokens } from 'shared-design-system';
15
+ ```
16
+
17
+ ## 🎨 Design Tokens
18
+
19
+ Thư viện sử dụng hệ thống Design Tokens tập trung tại `src/tokens.ts`. Bạn nên sử dụng các token này thay vì mã màu hardcode để đảm bảo tính nhất quán.
20
+
21
+ ```typescript
22
+ import { tokens, type DesignTokens } from 'shared-design-system';
23
+
24
+ const myStyle = {
25
+ color: tokens.color.primary,
26
+ padding: tokens.spacing['4'],
27
+ borderRadius: tokens.radius.md
28
+ };
29
+ ```
30
+
31
+ ## 🧱 Các thành phần chính
32
+
33
+ ### 1. Button
34
+ Thành phần nút bấm đa năng với các biến thể: `primary`, `secondary`, `danger`, `ghost`.
35
+
36
+ ```jsx
37
+ <Button variant="primary" onClick={handleClick}>Xác nhận</Button>
38
+ <Button variant="ghost" size="sm">Hủy</Button>
39
+ ```
40
+
41
+ ### 2. Badge
42
+ Dùng để hiển thị trạng thái hoặc nhãn dán. Các variant: `success`, `warning`, `danger`, `info`, `slate`.
43
+
44
+ ```jsx
45
+ <Badge variant="success">Hoàn thành</Badge>
46
+ <Badge variant="warning">Chờ duyệt</Badge>
47
+ ```
48
+
49
+ ### 3. Form Components
50
+ Bộ công cụ nhập liệu đồng bộ: `Input`, `Textarea`, `Select`, `Checkbox`.
51
+
52
+ ```jsx
53
+ <Input label="Họ và tên" placeholder="Nhập tên..." required />
54
+ <Select label="Phòng ban">
55
+ <option value="IT">Công nghệ thông tin</option>
56
+ <option value="HR">Nhân sự</option>
57
+ </Select>
58
+ ```
59
+
60
+ ### 4. Card
61
+ Thành phần container dùng để nhóm nội dung. Hỗ trợ `title`, `subtitle` và `footer`.
62
+
63
+ ```jsx
64
+ <Card title="Thông tin cá nhân" subtitle="Chi tiết hồ sơ nhân viên">
65
+ <Text>Thông tin bên trong card...</Text>
66
+ </Card>
67
+ ```
68
+
69
+ ### 5. Typography
70
+ Enforce font types và hierarchy: `Heading`, `Text`, `SectionHeader`.
71
+
72
+ ```jsx
73
+ <Heading level={2}>Tiêu đề lớn</Heading>
74
+ <Text size="sm" color="muted">Ghi chú nhỏ</Text>
75
+ <SectionHeader title="Thông tin nghiệp vụ" />
76
+ ```
77
+
78
+ ### 6. ReadOnlyField
79
+ Sử dụng trong các màn hình chi tiết để hiển thị dữ liệu ở chế độ chỉ đọc một cách chuyên nghiệp.
80
+
81
+ ```jsx
82
+ <ReadOnlyField label="Mã yêu cầu" value="RQ-2024-001" />
83
+ ```
84
+
85
+ ### 7. LoadingSpinner
86
+ Animation quay đều sử dụng màu thương hiệu để biểu thị trạng thái đang tải.
87
+
88
+ ```jsx
89
+ <LoadingSpinner size="md" />
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 🌟 Thành phần nâng cao (Phase 2 - Cảm hứng từ MUI)
95
+
96
+ ### 8. Avatar
97
+ Hiển thị ảnh đại diện hoặc chữ cái đầu. Hỗ trợ nhiều kích thước (`xs` đến `xl`) và hình dạng (`circle`, `rounded`, `square`).
98
+
99
+ ```jsx
100
+ <Avatar src="/path/to/img.jpg" size="lg" />
101
+ <Avatar variant="rounded">JD</Avatar>
102
+ ```
103
+
104
+ ### 9. Switch
105
+ Nút gạt bật/tắt hiện đại thay thế cho Checkbox.
106
+
107
+ ```jsx
108
+ <Switch checked={isActive} onChange={toggle} label="Kích hoạt tính năng" />
109
+ ```
110
+
111
+ ### 10. Tabs & Tab
112
+ Hệ thống chuyển đổi nội dung dạng tab. Hỗ trợ variant `standard` và `pills`.
113
+
114
+ ```jsx
115
+ <Tabs value={tabIndex} onChange={setTabIndex}>
116
+ <Tab value={0} label="Tổng quan" icon={<HomeIcon />} />
117
+ <Tab value={1} label="Lịch sử" />
118
+ </Tabs>
119
+ ```
120
+
121
+ ### 11. Breadcrumbs
122
+ Định vị vị trí trong cấu trúc trang.
123
+
124
+ ```jsx
125
+ <Breadcrumbs items={[
126
+ { label: 'Trang chủ', onClick: goHome },
127
+ { label: 'Cài đặt', onClick: goSettings },
128
+ { label: 'Thông tin cá nhân' }
129
+ ]} />
130
+ ```
131
+
132
+ ### 12. Skeleton
133
+ Hiệu ứng placeholder khi đang tải dữ liệu.
134
+
135
+ ```jsx
136
+ <Skeleton variant="circle" width="40px" height="40px" />
137
+ <Skeleton variant="rectangular" height="200px" />
138
+ <Skeleton variant="text" width="60%" />
139
+ ```
140
+
141
+ ### 13. Tooltip
142
+ Hiển thị chú thích khi di chuột. Hỗ trợ 4 hướng: `top`, `bottom`, `left`, `right`.
143
+
144
+ ```jsx
145
+ <Tooltip title="Xóa bản ghi này" position="top">
146
+ <Button variant="danger">Xóa</Button>
147
+ </Tooltip>
148
+ ```
149
+
150
+ ### 14. Divider
151
+ Đường kẻ phân tách nội dung.
152
+
153
+ ```jsx
154
+ <Divider orientation="horizontal" margin="lg" />
155
+ ```
156
+
157
+ ---
158
+
159
+ ## 🚀 Tính năng mở rộng (Phase 3 - Robust System)
160
+
161
+ ### 15. Stack
162
+ Công cụ quản lý bố cục và khoảng cách tự động.
163
+
164
+ ```jsx
165
+ <Stack direction="row" spacing="md" align="center">
166
+ <Button>Lưu</Button>
167
+ <Button variant="ghost">Hủy</Button>
168
+ </Stack>
169
+ ```
170
+
171
+ ### 16. Alert
172
+ Thanh thông báo theo mức độ nghiêm trọng: `success`, `info`, `warning`, `error`.
173
+
174
+ ```jsx
175
+ <Alert severity="success" title="Thành công">Dữ liệu đã được lưu.</Alert>
176
+ <Alert severity="error">Có lỗi xảy ra, vui lòng thử lại.</Alert>
177
+ ```
178
+
179
+ ### 17. Tag/Chip
180
+ Nhãn dán cho dữ liệu, hỗ trợ nút đóng (close).
181
+
182
+ ```jsx
183
+ <Tag color="primary" variant="solid">Mới</Tag>
184
+ <Tag color="danger" onClose={handleDelete}>Hết hạn</Tag>
185
+ ```
186
+
187
+ ### 18. Progress
188
+ Thanh tiến trình dạng đường thẳng (Linear Progress).
189
+
190
+ ```jsx
191
+ <Progress value={75} showLabel color="success" />
192
+ ```
193
+
194
+ ### 19. Steps
195
+ Thanh điều hướng quy trình (Workflow). Hỗ trợ chiều dọc và chiều ngang.
196
+
197
+ ```jsx
198
+ <Steps
199
+ current={1}
200
+ items={[
201
+ { title: 'Khởi tạo', description: 'User gửi yêu cầu' },
202
+ { title: 'Phê duyệt', description: 'Đang chờ quản lý' },
203
+ { title: 'Hoàn tất' }
204
+ ]}
205
+ />
206
+ ```
207
+
208
+ ### 20. Table (Styled)
209
+ Bộ thành phần xây dựng bảng dữ liệu chuyên nghiệp.
210
+
211
+ ```jsx
212
+ <TableContainer>
213
+ <THead>
214
+ <TR>
215
+ <TH>Họ Tên</TH>
216
+ <TH>Trạng Thái</TH>
217
+ </TR>
218
+ </THead>
219
+ <TBody>
220
+ <TR>
221
+ <TD>Nguyễn Văn A</TD>
222
+ <TD><Badge variant="success">Active</Badge></TD>
223
+ </TR>
224
+ </TBody>
225
+ </TableContainer>
226
+ ```
227
+
228
+ ### 21. Radio & RadioGroup
229
+ Lựa chọn duy nhất trong danh sách.
230
+
231
+ ```jsx
232
+ <RadioGroup direction="row">
233
+ <Radio name="gender" value="male" label="Nam" checked />
234
+ <Radio name="gender" value="female" label="Nữ" />
235
+ </RadioGroup>
236
+ ```
237
+
238
+ ## 🛠 Nguyên tắc phát triển
239
+
240
+ 1. **Tokens First**: Luôn kiểm tra `src/tokens.ts` trước khi thêm giá trị mới.
241
+ 2. **Stateless**: Giữ component đơn giản nhất có thể, chỉ xử lý UI và nhận data qua props.
242
+ 3. **Prefixing**: Khi kết hợp với Tailwind trong từng MFE, hãy sử dụng prefix tương ứng của MFE đó để tránh xung đột style với Portal.
243
+ 4. **Type-safe**: Mỗi component có Props interface riêng. Luôn import type khi chỉ cần dùng cho annotation.
244
+
245
+ ## 📦 Build & Publish
246
+
247
+ ```bash
248
+ # Type-check
249
+ npm run typecheck
250
+
251
+ # Build ra dist/ (tự động chạy khi publish)
252
+ npm run build
253
+
254
+ # Publish (tự động chạy typecheck + build trước)
255
+ npm publish
256
+ ```
257
+
258
+ > **Lưu ý:** File `dist/` được generate tự động, không commit vào git.
@@ -0,0 +1,71 @@
1
+ export declare const colors: {
2
+ brandRed: string;
3
+ brandYellow: string;
4
+ brandGrey: string;
5
+ yellow5: string;
6
+ yellow4: string;
7
+ yellow3: string;
8
+ yellow2: string;
9
+ yellow1: string;
10
+ yellow0: string;
11
+ neutral5: string;
12
+ neutral4: string;
13
+ neutral3: string;
14
+ neutral2: string;
15
+ neutral1: string;
16
+ neutral0: string;
17
+ black: string;
18
+ white: string;
19
+ purple5: string;
20
+ purple4: string;
21
+ purple3: string;
22
+ purple2: string;
23
+ purple1: string;
24
+ orange5: string;
25
+ orange4: string;
26
+ orange3: string;
27
+ orange2: string;
28
+ orange1: string;
29
+ orange0: string;
30
+ green5: string;
31
+ green4: string;
32
+ green3: string;
33
+ green2: string;
34
+ green1: string;
35
+ green0: string;
36
+ blue5: string;
37
+ blue4: string;
38
+ blue3: string;
39
+ blue2: string;
40
+ blue1: string;
41
+ red5: string;
42
+ red4: string;
43
+ red3: string;
44
+ red2: string;
45
+ red1: string;
46
+ paper: string;
47
+ primaryMain: string;
48
+ primaryDark: string;
49
+ secondaryMain: string;
50
+ secondaryDark: string;
51
+ successMain: string;
52
+ successDark: string;
53
+ errorMain: string;
54
+ errorDark: string;
55
+ orangeMain: string;
56
+ orangeDark: string;
57
+ warningMain: string;
58
+ warningDark: string;
59
+ infoMain: string;
60
+ infoDark: string;
61
+ grey50: string;
62
+ grey100: string;
63
+ grey200: string;
64
+ grey300: string;
65
+ grey500: string;
66
+ grey600: string;
67
+ grey700: string;
68
+ grey900: string;
69
+ grey400: string;
70
+ grey800: string;
71
+ };
package/dist/colors.js ADDED
@@ -0,0 +1,72 @@
1
+ export const colors = {
2
+ brandRed: '#BE1128',
3
+ brandYellow: '#FFC20E',
4
+ brandGrey: '#464646',
5
+ yellow5: '#F7A30A',
6
+ yellow4: '#F7B512',
7
+ yellow3: '#FCC954',
8
+ yellow2: '#FFDF80',
9
+ yellow1: '#FFECB3',
10
+ yellow0: '#FFF9E5',
11
+ neutral5: '#212B36',
12
+ neutral4: '#454F5B',
13
+ neutral3: '#B6BEC8',
14
+ neutral2: '#D3D8DE',
15
+ neutral1: '#EAEEF2',
16
+ neutral0: '#F8F9FA',
17
+ black: '#000000',
18
+ white: '#ffffff',
19
+ purple5: '#6B1C3A',
20
+ purple4: '#A60066',
21
+ purple3: '#D10373',
22
+ purple2: '#FF99D8',
23
+ purple1: '#FFE5F5',
24
+ orange5: '#D4470F',
25
+ orange4: '#F56600',
26
+ orange3: '#FF993B',
27
+ orange2: '#FFB580',
28
+ orange1: '#FFD2B3',
29
+ orange0: '#FFF0E5',
30
+ green5: '#337321',
31
+ green4: '#4FA800',
32
+ green3: '#7DBA00',
33
+ green2: '#ABD653',
34
+ green1: '#D5E5B4',
35
+ green0: '#F2FAE2',
36
+ blue5: '#006FD6',
37
+ blue4: '#1890FF',
38
+ blue3: '#80C2FF',
39
+ blue2: '#C2E1FF',
40
+ blue1: '#E5F3FF',
41
+ red5: '#AD2624',
42
+ red4: '#D12421',
43
+ red3: '#EB2629',
44
+ red2: '#FCA5A6',
45
+ red1: '#FDE8E8',
46
+ paper: '#ffffff',
47
+ primaryMain: '#ffc20e',
48
+ primaryDark: '#f7a30a',
49
+ secondaryMain: '#eaeef2',
50
+ secondaryDark: '#d3d8de',
51
+ successMain: '#4fa800',
52
+ successDark: '#337321',
53
+ errorMain: '#d12421',
54
+ errorDark: '#ad2624',
55
+ orangeMain: '#ffab91',
56
+ orangeDark: '#d84315',
57
+ warningMain: '#f56600',
58
+ warningDark: '#d4470f',
59
+ infoMain: '#1890ff',
60
+ infoDark: '#006fd6',
61
+ grey50: '#fafafa',
62
+ grey100: '#f5f5f5',
63
+ grey200: '#f8f9fa',
64
+ grey300: '#eaeef2',
65
+ grey500: '#d3d8de',
66
+ grey600: '#b6bec8',
67
+ grey700: '#454f5b',
68
+ grey900: '#212b36',
69
+ grey400: '#bdbdbd',
70
+ grey800: '#7B7B7B'
71
+ };
72
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IAEpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAElB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IAEnB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAEhB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EA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',
44
44
  justifyContent: 'flex-end',
45
45
  gap: tokens.spacing[3]
46
- }, children: [_jsx(Button, { variant: "ghost", onClick: onCancel, children: cancelText }), _jsx(Button, { variant: variant, onClick: onConfirm, children: confirmText })] })] }), _jsx("style", { children: `
47
- @keyframes ds-fade-in {
48
- from { opacity: 0; transform: scale(0.95); }
49
- to { opacity: 1; transform: scale(1); }
50
- }
46
+ }, children: [_jsx(Button, { variant: "ghost", onClick: onCancel, children: cancelText }), _jsx(Button, { variant: variant, onClick: onConfirm, children: confirmText })] })] }), _jsx("style", { children: `
47
+ @keyframes ds-fade-in {
48
+ from { opacity: 0; transform: scale(0.95); }
49
+ to { opacity: 1; transform: scale(1); }
50
+ }
51
51
  ` })] }));
52
52
  };
53
53
  //# sourceMappingURL=ConfirmModal.js.map
@@ -12,10 +12,10 @@ export const LoadingSpinner = ({ size = 'md', color = 'primary', className = ''
12
12
  const getStrokeWidth = () => size === 'sm' ? '3' : '4';
13
13
  const getColor = () => color === 'white' ? '#FFFFFF' : tokens.color.primary;
14
14
  const dims = getDims();
15
- return (_jsx("div", { style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }, className: className, children: _jsxs("svg", { width: dims, height: dims, viewBox: "0 0 50 50", style: { animation: 'ds-spin 1s linear infinite' }, children: [_jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: getColor(), strokeWidth: getStrokeWidth(), strokeDasharray: "90, 150", strokeLinecap: "round", style: { opacity: 1 } }), _jsx("style", { children: `
16
- @keyframes ds-spin {
17
- 100% { transform: rotate(360deg); }
18
- }
15
+ return (_jsx("div", { style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }, className: className, children: _jsxs("svg", { width: dims, height: dims, viewBox: "0 0 50 50", style: { animation: 'ds-spin 1s linear infinite' }, children: [_jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: getColor(), strokeWidth: getStrokeWidth(), strokeDasharray: "90, 150", strokeLinecap: "round", style: { opacity: 1 } }), _jsx("style", { children: `
16
+ @keyframes ds-spin {
17
+ 100% { transform: rotate(360deg); }
18
+ }
19
19
  ` })] }) }));
20
20
  };
21
21
  //# sourceMappingURL=LoadingSpinner.js.map
@@ -17,12 +17,12 @@ export const Skeleton = ({ variant = 'text', width, height, className = '', styl
17
17
  overflow: 'hidden',
18
18
  animation: 'ds-pulse 1.5s ease-in-out infinite',
19
19
  ...style
20
- }, className: className, children: _jsx("style", { children: `
21
- @keyframes ds-pulse {
22
- 0% { opacity: 1; }
23
- 50% { opacity: 0.4; }
24
- 100% { opacity: 1; }
25
- }
20
+ }, className: className, children: _jsx("style", { children: `
21
+ @keyframes ds-pulse {
22
+ 0% { opacity: 1; }
23
+ 50% { opacity: 0.4; }
24
+ 100% { opacity: 1; }
25
+ }
26
26
  ` }) }));
27
27
  };
28
28
  //# sourceMappingURL=Skeleton.js.map
package/dist/index.d.ts CHANGED
@@ -44,5 +44,6 @@ export { Radio, RadioGroup } from './components/Radio';
44
44
  export type { RadioProps, RadioGroupProps } from './components/Radio';
45
45
  export { Steps } from './components/Steps';
46
46
  export type { StepsProps, StepItem, StepStatus } from './components/Steps';
47
+ export { colors } from './colors';
47
48
  export { tokens } from './tokens';
48
49
  export type { DesignTokens, ColorTokens, RadiusTokens, ShadowTokens, FontTokens, SpacingTokens, TransitionTokens } from './tokens';
package/dist/index.js CHANGED
@@ -25,5 +25,6 @@ export { TableContainer, THead, TBody, TR, TH, TD } from './components/Table';
25
25
  export { Radio, RadioGroup } from './components/Radio';
26
26
  export { Steps } from './components/Steps';
27
27
  // ─── Design Tokens ────────────────────────────────────────────────────────────
28
+ export { colors } from './colors';
28
29
  export { tokens } from './tokens';
29
30
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAA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EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,iFAAiF;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,52 +1,52 @@
1
- {
2
- "name": "shared-design-system",
3
- "version": "1.3.0",
4
- "description": "Shared Tailwind Design System & UI Tokens for all Micro Frontends",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- },
14
- "./tokens": {
15
- "import": "./dist/tokens.js",
16
- "require": "./dist/tokens.js",
17
- "types": "./dist/tokens.d.ts"
18
- },
19
- "./tailwind.preset": {
20
- "require": "./tailwind.preset.js",
21
- "import": "./tailwind.preset.js"
22
- },
23
- "./tailwind.preset.js": {
24
- "require": "./tailwind.preset.js",
25
- "import": "./tailwind.preset.js"
26
- }
27
- },
28
- "files": [
29
- "dist",
30
- "tailwind.preset.js",
31
- "README.md"
32
- ],
33
- "scripts": {
34
- "build": "tsc --project tsconfig.build.json",
35
- "typecheck": "tsc --noEmit",
36
- "prepublishOnly": "npm run typecheck && npm run build"
37
- },
38
- "publishConfig": {
39
- "access": "public"
40
- },
41
- "peerDependencies": {
42
- "react": "^18.0.0",
43
- "react-dom": "^18.0.0",
44
- "tailwindcss": "^3.0.0"
45
- },
46
- "devDependencies": {
47
- "typescript": "^5.4.0",
48
- "@types/react": "^18.2.0",
49
- "@types/react-dom": "^18.2.0",
50
- "@types/node": "^20.11.0"
51
- }
52
- }
1
+ {
2
+ "name": "shared-design-system",
3
+ "version": "1.5.0",
4
+ "description": "Shared Tailwind Design System & UI Tokens for all Micro Frontends",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./tokens": {
15
+ "import": "./dist/tokens.js",
16
+ "require": "./dist/tokens.js",
17
+ "types": "./dist/tokens.d.ts"
18
+ },
19
+ "./tailwind.preset": {
20
+ "require": "./tailwind.preset.js",
21
+ "import": "./tailwind.preset.js"
22
+ },
23
+ "./tailwind.preset.js": {
24
+ "require": "./tailwind.preset.js",
25
+ "import": "./tailwind.preset.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "tailwind.preset.js",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc --project tsconfig.build.json",
35
+ "typecheck": "tsc --noEmit",
36
+ "prepublishOnly": "npm run typecheck && npm run build"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "peerDependencies": {
42
+ "react": "^18.0.0",
43
+ "react-dom": "^18.0.0",
44
+ "tailwindcss": "^3.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "typescript": "^5.4.0",
48
+ "@types/react": "^18.2.0",
49
+ "@types/react-dom": "^18.2.0",
50
+ "@types/node": "^20.11.0"
51
+ }
52
+ }
@@ -4,11 +4,80 @@ module.exports = {
4
4
  extend: {
5
5
  colors: {
6
6
  // Ánh xạ sang biến CSS Variable (Có giá trị fallback)
7
- primary: 'var(--theme-color-primary, #0f172a)',
8
- secondary: 'var(--theme-color-secondary, #64748b)',
7
+ primary: 'var(--theme-color-primary, #ffc20e)',
8
+ secondary: 'var(--theme-color-secondary, #eaeef2)',
9
+ brandRed: '#BE1128',
10
+ brandYellow: '#FFC20E',
11
+ brandGrey: '#464646',
12
+ yellow5: '#F7A30A',
13
+ yellow4: '#F7B512',
14
+ yellow3: '#FCC954',
15
+ yellow2: '#FFDF80',
16
+ yellow1: '#FFECB3',
17
+ yellow0: '#FFF9E5',
18
+ neutral5: '#212B36',
19
+ neutral4: '#454F5B',
20
+ neutral3: '#B6BEC8',
21
+ neutral2: '#D3D8DE',
22
+ neutral1: '#EAEEF2',
23
+ neutral0: '#F8F9FA',
24
+ black: '#000000',
25
+ white: '#ffffff',
26
+ purple5: '#6B1C3A',
27
+ purple4: '#A60066',
28
+ purple3: '#D10373',
29
+ purple2: '#FF99D8',
30
+ purple1: '#FFE5F5',
31
+ orange5: '#D4470F',
32
+ orange4: '#F56600',
33
+ orange3: '#FF993B',
34
+ orange2: '#FFB580',
35
+ orange1: '#FFD2B3',
36
+ orange0: '#FFF0E5',
37
+ green5: '#337321',
38
+ green4: '#4FA800',
39
+ green3: '#7DBA00',
40
+ green2: '#ABD653',
41
+ green1: '#D5E5B4',
42
+ green0: '#F2FAE2',
43
+ blue5: '#006FD6',
44
+ blue4: '#1890FF',
45
+ blue3: '#80C2FF',
46
+ blue2: '#C2E1FF',
47
+ blue1: '#E5F3FF',
48
+ red5: '#AD2624',
49
+ red4: '#D12421',
50
+ red3: '#EB2629',
51
+ red2: '#FCA5A6',
52
+ red1: '#FDE8E8',
53
+ paper: '#ffffff',
54
+ primaryMain: '#ffc20e',
55
+ primaryDark: '#f7a30a',
56
+ secondaryMain: '#eaeef2',
57
+ secondaryDark: '#d3d8de',
58
+ successMain: '#4fa800',
59
+ successDark: '#337321',
60
+ errorMain: '#d12421',
61
+ errorDark: '#ad2624',
62
+ orangeMain: '#ffab91',
63
+ orangeDark: '#d84315',
64
+ warningMain: '#f56600',
65
+ warningDark: '#d4470f',
66
+ infoMain: '#1890ff',
67
+ infoDark: '#006fd6',
68
+ grey50: '#fafafa',
69
+ grey100: '#f5f5f5',
70
+ grey200: '#f8f9fa',
71
+ grey300: '#eaeef2',
72
+ grey500: '#d3d8de',
73
+ grey600: '#b6bec8',
74
+ grey700: '#454f5b',
75
+ grey900: '#212b36',
76
+ grey400: '#bdbdbd',
77
+ grey800: '#7B7B7B',
9
78
  brand: {
10
- 50: '#f0fdf4',
11
- 500: '#22c55e',
79
+ 50: '#FFF9E5',
80
+ 500: '#FFC20E',
12
81
  }
13
82
  },
14
83
  fontFamily: {