@edmicro/olkit 1.0.1

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 ADDED
@@ -0,0 +1,298 @@
1
+ # @edmicro/olkit - Ôn Luyện Design System UI Library
2
+
3
+ Thư viện thành phần giao diện người dùng (UI Components) chuẩn hoá 100% theo **Figma Ôn Luyện Design System** dành cho Angular (phiên bản 18+).
4
+
5
+ ---
6
+
7
+ ## 🌟 Tính năng nổi bật
8
+
9
+ - 🎯 **100% Chuẩn Figma Ôn Luyện**: Chuẩn hoá toàn bộ token màu sắc Brand Prime (`#2B4182`), Crimson Red (`#C70036`), Emerald Green (`#007A55`), Orange (`#FF5A1F`), Grayscale, Shadows, Radii.
10
+ - ⚡ **100% Standalone Components**: Import độc lập từng component trực tiếp vào Component/Page mà không cần NgModule cồng kềnh, tối ưu Tree-shaking tối đa.
11
+ - 🎨 **Không bắt buộc cài Tailwind CSS**: Tích hợp sẵn file CSS độc lập `olkit.css` đã được pre-compile toàn bộ utility classes.
12
+ - 🌓 **Hỗ trợ Dark Mode / Light Mode**: Tự động chuyển đổi hoặc quản lý theo class `.dark`.
13
+ - 📱 **Hỗ trợ đa nền tảng & thiết bị**: Tương thích responsive cho Web, Tablet, Mobile Web và Webview Hybrid App.
14
+
15
+ ---
16
+
17
+ ## 📦 1. Cài đặt
18
+ ```bash
19
+ # Cài đặt qua Bun
20
+ bun add @edmicro/olkit
21
+
22
+ # Hoặc qua NPM
23
+ npm install @edmicro/olkit
24
+
25
+ # Hoặc qua Yarn
26
+ yarn add @edmicro/olkit
27
+ ```
28
+
29
+
30
+ ---
31
+
32
+ ## 🎨 2. Cấu hình Styles
33
+
34
+ ### Trường hợp A: Dự án **KHÔNG** sử dụng Tailwind CSS
35
+ Chỉ cần thêm file `olkit.css` vào file CSS chính của dự án hoặc trong `angular.json`:
36
+
37
+ **Cách 1: Thêm vào `src/styles.css` (hoặc `styles.scss`)**
38
+ ```css
39
+ @import '@edmicro/olkit/olkit.css';
40
+ ```
41
+
42
+ **Cách 2: Thêm vào `angular.json`**
43
+ ```json
44
+ "architect": {
45
+ "build": {
46
+ "options": {
47
+ "styles": [
48
+ "node_modules/@edmicro/olkit/olkit.css",
49
+ "src/styles.css"
50
+ ]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ---
57
+
58
+ ### Trường hợp B: Dự án **ĐANG CÓ** Tailwind CSS v4
59
+ Trong file `src/styles.css`, bạn có thể import trực tiếp:
60
+ ```css
61
+ @import "tailwindcss";
62
+ @import "@edmicro/olkit/olkit.css";
63
+ ```
64
+
65
+ Hoặc nếu dự án dùng **Tailwind CSS v3**, thêm path vào `tailwind.config.js`:
66
+ ```js
67
+ module.exports = {
68
+ content: [
69
+ "./src/**/*.{html,ts}",
70
+ "./node_modules/@edmicro/olkit/**/*.{js,mjs}"
71
+ ],
72
+ theme: {
73
+ extend: {
74
+ colors: {
75
+ brand: {
76
+ 50: '#F5F8FF',
77
+ 100: '#E3EAFF',
78
+ 200: '#D2DCFA',
79
+ 300: '#A3BAFF',
80
+ 400: '#8C9ED4',
81
+ 500: '#6D7FB3',
82
+ 600: '#5168AC',
83
+ 700: '#2B4182', // Onluyen - Prime
84
+ 800: '#203165',
85
+ 900: '#152147',
86
+ 950: '#0D142B',
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 🚀 3. Hướng dẫn sử dụng Components
97
+
98
+ Do tất cả component đều là **Standalone**, bạn chỉ cần import component nào bạn thực sự sử dụng vào mảng `imports: [...]` của Angular Component.
99
+
100
+ ```typescript
101
+ import { Component } from '@angular/core';
102
+ import {
103
+ ButtonComponent,
104
+ DownloadAppButtonComponent,
105
+ AlertComponent,
106
+ AccordionComponent,
107
+ AccordionItemComponent,
108
+ ModalComponent,
109
+ TabsComponent,
110
+ TabItemComponent
111
+ } from '@edmicro/olkit';
112
+
113
+ @Component({
114
+ selector: 'app-dashboard',
115
+ standalone: true,
116
+ imports: [
117
+ ButtonComponent,
118
+ DownloadAppButtonComponent,
119
+ AlertComponent,
120
+ AccordionComponent,
121
+ AccordionItemComponent,
122
+ ModalComponent,
123
+ TabsComponent,
124
+ TabItemComponent
125
+ ],
126
+ templateUrl: './dashboard.component.html'
127
+ })
128
+ export class DashboardComponent {
129
+ isModalOpen = false;
130
+
131
+ openModal() {
132
+ this.isModalOpen = true;
133
+ }
134
+ }
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 💻 4. Code Mẫu Chi Tiết Từng Component
140
+
141
+ ### 🔘 Buttons (`<ol-button>`)
142
+ Hỗ trợ đầy đủ biến thể theo Figma Ôn Luyện: `brand` (#2B4182), `green` (#007A55), `red` (#C70036), `orange` (#FF5A1F), `ghost`, `tertiary`, `dark`, `white`.
143
+
144
+ ```html
145
+ <!-- 1. Màu sắc cơ bản -->
146
+ <ol-button color="brand" size="md">Bắt đầu ngay</ol-button>
147
+ <ol-button color="green" size="md">Nộp bài</ol-button>
148
+ <ol-button color="red" size="md">Thoát bài thi</ol-button>
149
+ <ol-button color="orange" size="md">Tạm dừng</ol-button>
150
+
151
+ <!-- 2. Kiểu Outline & Ghost -->
152
+ <ol-button color="brand" [outline]="true">Nút viền Brand</ol-button>
153
+ <ol-button color="ghost">Nút trong suốt (Ghost)</ol-button>
154
+ <ol-button color="tertiary">Nút phụ Tertiary</ol-button>
155
+
156
+ <!-- 3. Kích thước (xs, sm, md, lg, xl) -->
157
+ <ol-button size="xs">Cực nhỏ (xs)</ol-button>
158
+ <ol-button size="sm">Nhỏ (sm)</ol-button>
159
+ <ol-button size="md">Tiêu chuẩn (md)</ol-button>
160
+ <ol-button size="lg">Lớn (lg)</ol-button>
161
+ <ol-button size="xl">Rất lớn (xl)</ol-button>
162
+
163
+ <!-- 4. Kiểu bo góc (Pill / 12px / Mặc định) -->
164
+ <ol-button color="brand" [pill]="true">Bo tròn hoàn toàn (Pill)</ol-button>
165
+
166
+ <!-- 5. Trạng thái Loading & Disabled -->
167
+ <ol-button color="brand" [loading]="true" loadingText="Đang xử lý...">Đăng nhập</ol-button>
168
+ <ol-button color="brand" [disabled]="true">Vô hiệu hóa</ol-button>
169
+
170
+ <!-- 6. Button chứa Icon -->
171
+ <ol-button color="brand">
172
+ <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
173
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
174
+ </svg>
175
+ Thêm mới
176
+ </ol-button>
177
+ ```
178
+
179
+ ---
180
+
181
+ ### 📲 Nút Tải Ứng Dụng (`<ol-download-app-button>`)
182
+ Nút tải chuẩn nhận diện App Store & Google Play từ Figma Ôn Luyện (tự động thích ứng Light/Dark mode).
183
+
184
+ ```html
185
+ <!-- Tự động thích ứng theme theo hệ thống / dark class -->
186
+ <ol-download-app-button store="appstore" (clicked)="onDownloadIos()" />
187
+ <ol-download-app-button store="googleplay" (clicked)="onDownloadAndroid()" />
188
+
189
+ <!-- Ép giao diện Sáng hoặc Tối -->
190
+ <ol-download-app-button store="appstore" theme="light" />
191
+ <ol-download-app-button store="googleplay" theme="dark" />
192
+ ```
193
+
194
+ ---
195
+
196
+ ### 🔔 Alerts (`<ol-alert>`)
197
+ Thông báo phản hồi ngữ cảnh: `info`, `danger` (red), `success` (green), `warning` (orange), `dark`.
198
+
199
+ ```html
200
+ <!-- Thông báo đơn giản -->
201
+ <ol-alert color="info">Đây là thông báo thông tin hệ thống.</ol-alert>
202
+ <ol-alert color="success">Chúc mừng bạn đã hoàn thành bài thi với 100 điểm!</ol-alert>
203
+ <ol-alert color="danger">Đã có lỗi xảy ra trong quá trình lưu kết quả.</ol-alert>
204
+ <ol-alert color="warning">Thời gian làm bài còn lại dưới 5 phút.</ol-alert>
205
+
206
+ <!-- Thông báo có nút đóng (Dismissible) -->
207
+ <ol-alert color="info" [dismissible]="true" (closed)="onAlertClosed()">
208
+ Bạn có thể tắt thông báo này khi đã đọc xong.
209
+ </ol-alert>
210
+
211
+ <!-- Thông báo dạng Border Accent -->
212
+ <ol-alert color="danger" [border]="true">
213
+ Lỗi bảo mật: Phiên làm việc đã hết hạn.
214
+ </ol-alert>
215
+ ```
216
+
217
+ ---
218
+
219
+ ### 🪟 Modals (`<ol-modal>`)
220
+ Cửa sổ hộp thoại tương tác cao, có thể backdrop dismiss, ESC key, nhiều kích thước:
221
+
222
+ ```html
223
+ <ol-button color="brand" (click)="isModalOpen = true">Mở Modal</ol-button>
224
+
225
+ <ol-modal
226
+ [(isOpen)]="isModalOpen"
227
+ title="Xác nhận nộp bài thi"
228
+ size="md"
229
+ [dismissible]="true"
230
+ >
231
+ <p class="text-sm text-gray-600 dark:text-gray-300">
232
+ Bạn còn 3 câu chưa hoàn thành. Bạn có chắc chắn muốn nộp bài thi ngay bây giờ không?
233
+ </p>
234
+
235
+ <div slot="footer" class="flex justify-end gap-3">
236
+ <ol-button color="ghost" (click)="isModalOpen = false">Làm tiếp</ol-button>
237
+ <ol-button color="brand" (click)="submitExam()">Xác nhận nộp</ol-button>
238
+ </div>
239
+ </ol-modal>
240
+ ```
241
+
242
+ ---
243
+
244
+ ### 📂 Accordion (`<ol-accordion>` & `<ol-accordion-item>`)
245
+
246
+ ```html
247
+ <ol-accordion [alwaysOpen]="false">
248
+ <ol-accordion-item title="Chương 1: Khái niệm cơ bản" [isOpen]="true">
249
+ Nội dung lý thuyết và các định nghĩa cơ bản của chương 1...
250
+ </ol-accordion-item>
251
+
252
+ <ol-accordion-item title="Chương 2: Phương pháp giải bài tập">
253
+ Các dạng bài tập thường gặp và phương pháp giải chi tiết...
254
+ </ol-accordion-item>
255
+
256
+ <ol-accordion-item title="Chương 3: Đề thi thử">
257
+ Bộ 10 đề thi thử bám sát cấu trúc mới nhất...
258
+ </ol-accordion-item>
259
+ </ol-accordion>
260
+ ```
261
+
262
+ ---
263
+
264
+ ### 📑 Tabs (`<ol-tabs>` & `<ol-tab-item>`)
265
+
266
+ ```html
267
+ <ol-tabs variant="underline">
268
+ <ol-tab-item title="Tổng quan" [active]="true">
269
+ <p>Nội dung tổng quan khoá học...</p>
270
+ </ol-tab-item>
271
+
272
+ <ol-tab-item title="Danh sách bài học">
273
+ <p>Chi tiết từng bài học trong lộ trình...</p>
274
+ </ol-tab-item>
275
+
276
+ <ol-tab-item title="Đánh giá & Bình luận">
277
+ <p>Phản hồi từ học sinh và giáo viên...</p>
278
+ </ol-tab-item>
279
+ </ol-tabs>
280
+ ```
281
+
282
+ ---
283
+
284
+ ## 🛠️ 5. Cập nhật phiên bản mới
285
+
286
+ Khi có bản phát hành mới từ GitLab, bạn chỉ cần chạy lệnh cập nhật:
287
+
288
+ ```bash
289
+ # Cập nhật lại package từ repository
290
+ npm install git+https://gitlab.edmicro.io/onluyenpub/olkit-deploy.git#v1.0.1
291
+ ```
292
+
293
+ ---
294
+
295
+ ## 📄 Bản quyền & Liên hệ
296
+ - **Đơn vị phát triển**: EDMICRO - Đội ngũ Frontend Ôn Luyện V4.
297
+ - **Figma Design System**: [Ôn Luyện Design System](https://www.figma.com/design/lip4g3PkcupVurtCxXCkEz/%C3%94n-Luy%E1%BB%87n-Design-System?node-id=2542-21012)
298
+ - **GitLab Repository**: [https://gitlab.edmicro.io/onluyenpub/olkit-deploy](https://gitlab.edmicro.io/onluyenpub/olkit-deploy)