@finhay-pro/leaf-design-system 0.1.5 → 0.1.7

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.
Files changed (55) hide show
  1. package/README.md +197 -73
  2. package/dist/border.css +155 -17
  3. package/dist/button.css +11 -10
  4. package/dist/cdn/leaf-0.1.7.min.css +2 -0
  5. package/dist/cdn/leaf-0.1.7.min.js +2 -0
  6. package/dist/classes.css +1915 -238
  7. package/dist/color.css +28 -32
  8. package/dist/components/Button/Button.d.ts.map +1 -1
  9. package/dist/components/Button/Button.js +3 -3
  10. package/dist/components/Button/Button.js.map +1 -1
  11. package/dist/components/Dialog/Dialog.d.ts +10 -2
  12. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  13. package/dist/components/Dialog/Dialog.js +3 -2
  14. package/dist/components/Dialog/Dialog.js.map +1 -1
  15. package/dist/components/Logo/Logo.d.ts.map +1 -1
  16. package/dist/components/Logo/Logo.js +2 -2
  17. package/dist/components/Logo/Logo.js.map +1 -1
  18. package/dist/components/Skeleton/Skeleton.js +1 -1
  19. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  20. package/dist/components/Slider/Slider.js +2 -2
  21. package/dist/components/Slider/Slider.js.map +1 -1
  22. package/dist/components/Spinner/Spinner.d.ts.map +1 -1
  23. package/dist/components/Spinner/Spinner.js +2 -2
  24. package/dist/components/Spinner/Spinner.js.map +1 -1
  25. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  26. package/dist/components/Tabs/Tabs.js +3 -3
  27. package/dist/components/Tabs/Tabs.js.map +1 -1
  28. package/dist/components/Toggle/Toggle.d.ts.map +1 -1
  29. package/dist/components/Toggle/Toggle.js +1 -1
  30. package/dist/components/Toggle/Toggle.js.map +1 -1
  31. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  32. package/dist/components/Tooltip/Tooltip.js +2 -2
  33. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  34. package/dist/dialog.css +19 -38
  35. package/dist/flex.css +229 -0
  36. package/dist/grid.css +533 -0
  37. package/dist/logo-assets.css +1 -0
  38. package/dist/logo.css +7 -6
  39. package/dist/overflow.css +72 -0
  40. package/dist/position.css +140 -0
  41. package/dist/sizing.css +377 -0
  42. package/dist/skeleton.css +1 -4
  43. package/dist/slider.css +8 -30
  44. package/dist/spacing.css +72 -4
  45. package/dist/spinner.css +4 -16
  46. package/dist/styles.css +1926 -246
  47. package/dist/tabs.css +9 -12
  48. package/dist/text-layout.css +219 -0
  49. package/dist/toggle.css +6 -8
  50. package/dist/tokens.css +12 -8
  51. package/dist/tooltip.css +4 -15
  52. package/dist/typography.css +2 -3
  53. package/package.json +7 -1
  54. package/dist/cdn/leaf-0.1.5.min.css +0 -2
  55. package/dist/cdn/leaf-0.1.5.min.js +0 -2
package/README.md CHANGED
@@ -27,7 +27,13 @@ chọn phần class cần dùng.
27
27
  | `@finhay-pro/leaf-design-system/typography.css` | Chỉ class typography. |
28
28
  | `@finhay-pro/leaf-design-system/color.css` | Chỉ class color. |
29
29
  | `@finhay-pro/leaf-design-system/spacing.css` | Chỉ class spacing (`p-*` / `m-*` / `gap-*`). |
30
- | `@finhay-pro/leaf-design-system/border.css` | Chỉ class border radius (`radius-*`). |
30
+ | `@finhay-pro/leaf-design-system/border.css` | Class border width (`border-s` / `-m` / `-l` / `-xl`) + radius (`radius-*`). |
31
+ | `@finhay-pro/leaf-design-system/flex.css` | Flex + căn chỉnh (`flex`, `justify-*`, `items-*`…). |
32
+ | `@finhay-pro/leaf-design-system/grid.css` | Grid (`grid-cols-*`, `col-span-*`, `place-*`…). |
33
+ | `@finhay-pro/leaf-design-system/sizing.css` | Width/height keyword + phân số (`w-full`, `h-1/2`…). |
34
+ | `@finhay-pro/leaf-design-system/overflow.css` | `overflow` / `overflow-x` / `overflow-y`. |
35
+ | `@finhay-pro/leaf-design-system/position.css` | Position, inset cơ bản, z-index scale. |
36
+ | `@finhay-pro/leaf-design-system/text-layout.css` | Căn chữ, truncate, line-clamp, whitespace… (không lẫn `text-*` màu). |
31
37
  | `@finhay-pro/leaf-design-system/button.css` | Style của component `Button`. |
32
38
  | `@finhay-pro/leaf-design-system/tabs.css` | Style của component `Tabs`. |
33
39
  | `@finhay-pro/leaf-design-system/dialog.css` | Style của component `Dialog`. |
@@ -41,11 +47,9 @@ chọn phần class cần dùng.
41
47
  | `@finhay-pro/leaf-design-system/classes.css` | Tất cả class + component, không token. |
42
48
  | `@finhay-pro/leaf-design-system/styles.css` | Token + tất cả class + component. Một dòng là đủ. |
43
49
 
44
- Trong app dùng Tailwind v4, import bằng CSS, **sau** `@import "tailwindcss"`:
50
+ Import bằng CSS:
45
51
 
46
52
  ```css
47
- @import "tailwindcss";
48
-
49
53
  /* 1. Token — luôn đứng đầu */
50
54
  @import "@finhay-pro/leaf-design-system/tokens.css";
51
55
 
@@ -54,6 +58,12 @@ Trong app dùng Tailwind v4, import bằng CSS, **sau** `@import "tailwindcss"`:
54
58
  @import "@finhay-pro/leaf-design-system/color.css";
55
59
  @import "@finhay-pro/leaf-design-system/spacing.css";
56
60
  @import "@finhay-pro/leaf-design-system/border.css";
61
+ @import "@finhay-pro/leaf-design-system/flex.css";
62
+ @import "@finhay-pro/leaf-design-system/grid.css";
63
+ @import "@finhay-pro/leaf-design-system/sizing.css";
64
+ @import "@finhay-pro/leaf-design-system/overflow.css";
65
+ @import "@finhay-pro/leaf-design-system/position.css";
66
+ @import "@finhay-pro/leaf-design-system/text-layout.css";
57
67
 
58
68
  /* 3. Component nào dùng thì import cái đó */
59
69
  @import "@finhay-pro/leaf-design-system/button.css";
@@ -70,7 +80,7 @@ Trong app dùng Tailwind v4, import bằng CSS, **sau** `@import "tailwindcss"`:
70
80
  Muốn gọn thì một dòng `@import "@finhay-pro/leaf-design-system/styles.css";` thay cho cả khối trên.
71
81
 
72
82
  Component đọc thẳng token chứ không dùng class color, nên `tokens.css` + `typography.css` + CSS của
73
- component là đủ để component hiển thị đúng. App đang giữ bộ màu riêng (vd. `@theme` của Tailwind)
83
+ component là đủ để component hiển thị đúng. App đang giữ bộ màu riêng
74
84
  có thể bỏ `color.css` để không bị class màu của Leaf đè lên.
75
85
 
76
86
  ## Typography class
@@ -129,22 +139,22 @@ Trong React / Next.js, class đi thẳng vào `className` của bất kỳ eleme
129
139
 
130
140
  ## Color class
131
141
 
132
- Tiền tố nói thuộc tính, phần sau nói vai trò của token: `text-*` cho màu chữ, `base-*` cho màu nền,
142
+ Tiền tố nói thuộc tính, phần sau nói vai trò của token: `text-*` cho màu chữ, `bg-*` cho màu nền,
133
143
  `border-*` cho màu viền. Ba bộ dùng chung một hậu tố nên nhớ một bộ là suy ra được cả ba —
134
- `text-red` / `base-red` / `border-red`, `text-primary` / `base-primary` / `border-primary`. Nhóm
144
+ `text-red` / `bg-red` / `border-red`, `text-primary` / `bg-primary` / `border-primary`. Nhóm
135
145
  system bỏ chữ `system` trong tên class (token vẫn là `--system-red`), còn `border-*` lấy màu từ
136
146
  thang base vì viền luôn là màu bề mặt. Class chỉ trỏ vào token nên tự đổi theo theme, không cần
137
147
  viết thêm gì cho light mode.
138
148
 
139
- | Nhóm | Class |
140
- | ---------------- | --------------------------------------------------------------------------------------- |
141
- | Text color | `text-primary`, `text-secondary`, `text-tertiary`, `text-quaternary`, `text-highlight` |
142
- | Background | `base-primary` … `base-quinary`, `base-highlight` |
143
- | Border color | `border-primary` … `border-quinary` (màu của thang base), `border-highlight` |
144
- | System (đủ 3 bộ) | `text-*`, `base-*`, `border-*` với `red`, `green`, `yellow`, `orange`, `blue`, `purple` (+ `-secondary`) |
149
+ | Nhóm | Class |
150
+ | ---------------- | ------------------------------------------------------------------------------------------------------ |
151
+ | Text color | `text-primary`, `text-secondary`, `text-tertiary`, `text-quaternary`, `text-highlight` |
152
+ | Background | `bg-primary` … `bg-quinary`, `bg-highlight` |
153
+ | Border color | `border-primary` … `border-quinary` (màu của thang base), `border-highlight` |
154
+ | System (đủ 3 bộ) | `text-*`, `bg-*`, `border-*` với `red`, `green`, `yellow`, `orange`, `blue`, `purple` (+ `-secondary`) |
145
155
 
146
156
  ```html
147
- <div class="base-secondary border-quaternary p-l radius-m border">
157
+ <div class="bg-secondary border-quaternary p-l border-s">
148
158
  <h3 class="heading-3 text-primary">Tích luỹ</h3>
149
159
  <p class="body-4 text-secondary">Lợi nhuận kỳ vọng 8.5%/năm</p>
150
160
  <p class="body-4 text-red">Số dư không đủ</p>
@@ -157,7 +167,7 @@ viết thêm gì cho light mode.
157
167
  ## Spacing class
158
168
 
159
169
  Token `--spacing-*` (Figma Application) áp dụng cho **margin · padding · gap**. Tiền tố = thuộc
160
- tính, hậu tố = bậc: `0` · `xs` · `s` · `m` · `l` · `xl` · `2xl` … `7xl`.
170
+ tính, hậu tố = bậc: `0` · `2xs` · `xs` · `s` · `m` · `l` · `xl` · `2xl` … `7xl`.
161
171
 
162
172
  | Prefix | Property |
163
173
  | -------------------------------- | -------------------------------------------- |
@@ -168,6 +178,7 @@ tính, hậu tố = bậc: `0` · `xs` · `s` · `m` · `l` · `xl` · `2xl` …
168
178
  | Hậu tố | Token | px |
169
179
  | ------ | --------------- | --- |
170
180
  | `0` | `--spacing-0` | 0 |
181
+ | `2xs` | `--spacing-2xs` | 2 |
171
182
  | `xs` | `--spacing-xs` | 4 |
172
183
  | `s` | `--spacing-s` | 8 |
173
184
  | `m` | `--spacing-m` | 12 |
@@ -187,52 +198,88 @@ tính, hậu tố = bậc: `0` · `xs` · `s` · `m` · `l` · `xl` · `2xl` …
187
198
  </div>
188
199
  ```
189
200
 
190
- ## Border radius class
201
+ ## Border width & radius class
202
+
203
+ Token `--border-width-*` — độ dày viền 0.5 · 1 · 1.5 · 2 px. Class `border-s|m|l|xl` (và biến thể
204
+ cạnh) set width + `border-style: solid` để một class là thấy viền. Token `--radius-*` — bo góc
205
+ 4 · 8 · 12 · full; class `radius-s|m|l|full`. Màu viền vẫn dùng `border-primary`… (hậu tố vai trò).
206
+
207
+ | Prefix | Property |
208
+ | --------------------------------------------------------------------------------- | ----------------------------------- |
209
+ | `border-s` / `border-m` / `border-l` / `border-xl` | border-width + border-style: solid |
210
+ | `border-top-s` / `border-right-s` / `border-bottom-s` / `border-left-s` (…m/l/xl) | width + style từng cạnh |
211
+ | `border-inline-s` / `border-block-s` (…m/l/xl) | border-inline / block width + style |
212
+ | `radius-s` / `radius-m` / `radius-l` / `radius-full` | border-radius |
213
+
214
+ | Hậu tố | Token | px |
215
+ | ------ | ------------------- | --- |
216
+ | `s` | `--border-width-s` | 0.5 |
217
+ | `m` | `--border-width-m` | 1 |
218
+ | `l` | `--border-width-l` | 1.5 |
219
+ | `xl` | `--border-width-xl` | 2 |
220
+
221
+ | Hậu tố | Token | Value |
222
+ | ------ | --------------- | ----- |
223
+ | `s` | `--radius-s` | 4px |
224
+ | `m` | `--radius-m` | 8px |
225
+ | `l` | `--radius-l` | 12px |
226
+ | `full` | `--radius-full` | full |
227
+
228
+ ```html
229
+ <div class="bg-secondary border-quaternary radius-l p-l border-s">Card</div>
230
+ ```
231
+
232
+ ## Layout class
191
233
 
192
- Token `--radius-*` (Figma Border Application) — subset của spacing tới `2xl`. Class `radius-*`
193
- chỉ set `border-radius` (không đụng `rounded-*` của Tailwind hay `border-*` màu viền).
234
+ Nằm trong `@layer components` để utility (layer cao hơn) thắng; SCSS module (ngoài layer)
235
+ luôn đè được. Leaf **không** có class responsive — media query viết trong SCSS module
236
+ của component/page. Size cố định (`w-80`…) cũng để app tự viết.
194
237
 
195
- | Class | Token | px |
196
- | ------------ | -------------- | --- |
197
- | `radius-0` | `--radius-0` | 0 |
198
- | `radius-xs` | `--radius-xs` | 4 |
199
- | `radius-s` | `--radius-s` | 8 |
200
- | `radius-m` | `--radius-m` | 12 |
201
- | `radius-l` | `--radius-l` | 16 |
202
- | `radius-xl` | `--radius-xl` | 24 |
203
- | `radius-2xl` | `--radius-2xl` | 36 |
238
+ | Import | Nội dung chính |
239
+ | ----------------- | -------------------------------------------------------------------------- |
240
+ | `flex.css` | `flex`, hướng, wrap, grow/shrink/basis, `justify-*` / `items-*` / `self-*` |
241
+ | `grid.css` | `grid`, `grid-cols-*`, `col-span-*`, flow, place/justify-items/self |
242
+ | `sizing.css` | `w-*` / `h-*` keyword + phân số, `size-*`, min/max |
243
+ | `overflow.css` | `overflow` / `overflow-x` / `overflow-y` |
244
+ | `position.css` | position, inset, z-index scale |
245
+ | `text-layout.css` | căn chữ, truncate, line-clamp, whitespace, transform, decoration |
204
246
 
205
247
  ```html
206
- <div class="base-secondary border-quaternary p-l radius-m border">Card</div>
248
+ <div class="gap-m p-l flex items-center justify-between">
249
+ <h3 class="heading-3">Danh mục</h3>
250
+ <span class="body-4 text-secondary truncate">Tên rất dài…</span>
251
+ </div>
252
+
253
+ <div class="gap-m grid grid-cols-3">
254
+ <div class="col-span-2">Chính</div>
255
+ <div>Phụ</div>
256
+ </div>
207
257
  ```
208
258
 
209
259
  ## Cần biết
210
260
 
211
261
  - **Class typography chỉ set đúng 3 thuộc tính** (`font-size`, `line-height`, `font-weight`);
212
- **class color chỉ set đúng 1** (`color` / `background-color` / `border-color`); **spacing /
213
- radius chỉ set đúng 1** (margin/padding/gap hoặc `border-radius`). Font family, letter spacing,
214
- border width… nằm ngoài phạm vi — app tự setup ở tầng global
215
- (`body { font-family: var(--font-sans) }`, CSS reset…) hoặc thêm bằng Tailwind.
216
- - **Typography nằm trong `@layer components`**, nên utility của Tailwind v4 (`@layer utilities`)
217
- luôn thắng: `class="heading-1 font-bold"` hay `class="body-3 text-2xl"` override được bình
218
- thường, không cần important modifier.
262
+ **class color chỉ set đúng 1** (`color` / `background-color` / `border-color`); **spacing chỉ
263
+ set đúng 1** (margin/padding/gap); **border width** set width + `border-style: solid`;
264
+ **radius** set `border-radius`. Font family, letter spacing… nằm ngoài phạm vi — app tự setup
265
+ ở tầng global (`body { font-family: var(--font-sans) }`, CSS reset…).
266
+ - **Typography và layout nằm trong `@layer components`**, nên SCSS module (ngoài layer) override
267
+ được bình thường, không cần `!important`.
219
268
  - **Color / spacing / border nằm trong `@layer utilities`** — token gốc nên trùng tên thì phải
220
- thắng. Class đứng cùng layer với utility của Tailwind và được import sau, nên nếu app tự khai
221
- báo cùng tên trong `@theme` thì class Leaf vẫn có hiệu lực. Điều kiện:
222
- `@import "@finhay-pro/leaf-design-system/…"` phải nằm **sau** `@import "tailwindcss"`.
223
- - **Class không có biến thể `hover:` / `focus:` / opacity** — nó là CSS thuần, không phải utility do
224
- Tailwind sinh ra. Cần state thì dùng arbitrary value trỏ vào cùng token:
225
- `hover:text-[var(--text-highlight)]` (pseudo-class có specificity cao hơn nên thắng). Riêng biến
226
- thể responsive cùng specificity với class màu và được ghi ra trước, nên cần important modifier:
227
- `md:text-[var(--text-secondary)]!`.
269
+ thắng.
270
+ - **Mỗi file CSS mở đầu bằng `@layer theme, base, components, utilities;`**, nên import file theo
271
+ thứ tự nào thì class color / spacing / border vẫn đứng trên CSS component. Component không
272
+ trông vào CSS reset: tự reset `button`, tự xử lý `[hidden]`.
273
+ - **Class không có biến thể `hover:` / `focus:` / opacity** — nó là CSS thuần. Cần state thì viết
274
+ trong SCSS module, dùng cùng token (`var(--text-highlight)`).
228
275
  - **Chỉ semantic token mới có class màu.** Primitive (`--neutral-500`, `--brand-300`…) là nguồn nội
229
- bộ, dùng thẳng trong UI là mất khả năng đổi theme. Spacing / radius là thang kích thước cố định,
230
- không đổi theo theme.
276
+ bộ, dùng thẳng trong UI là mất khả năng đổi theme. Spacing / border-width là thang kích thước cố
277
+ định, không đổi theo theme.
231
278
  - **Tên class không có prefix.** Đây là những tên khá phổ thông, nên app dùng Leaf cần cân nhắc kỹ
232
- nếu load kèm CSS framework khác (Bootstrap cũng định nghĩa `.display-1`–`.display-6`). Với
233
- Tailwind thì màu / spacing token-name của Leaf luôn thắng khi trùng tên — đó là chủ đích; muốn
234
- dùng scale riêng của app thì đặt tên khác hoặc gọi qua arbitrary value. `radius-*` cố ý khác
235
- `rounded-*` để không đụng bo góc mặc định của Tailwind.
279
+ nếu load kèm CSS framework khác (Bootstrap cũng định nghĩa `.display-1`–`.display-6`). Màu /
280
+ spacing token-name của Leaf luôn thắng khi trùng tên — đó là chủ đích; muốn dùng scale riêng
281
+ của app thì đặt tên khác. Width dùng hậu tố kích thước (`border-s`) còn màu dùng hậu tố vai trò
282
+ (`border-primary`) — cùng tiền tố `border-` nhưng không trùng class.
236
283
  - Typography token hiện chỉ có **bộ Desktop**. Chưa có responsive type set, nên các style Display
237
284
  cần app tự xử lý ở breakpoint nhỏ.
238
285
 
@@ -270,17 +317,17 @@ vào bản CDN, không vào bản npm.
270
317
 
271
318
  ## Components
272
319
 
273
- | Export | Mô tả |
274
- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275
- | `Button` | Khung icon · label · icon — bật/tắt từng phần; `width` / `height`; `onClick` trả Promise → tự loading (spinner thay leading icon, khoá click), `loading` controlled |
276
- | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`); phím ← → Home End |
277
- | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `maxHeight` |
278
- | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
279
- | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
280
- | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
281
- | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
282
- | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
283
- | `Tooltip` | Hover/focus/Escape — `size`, `position`, `align`, `onOpenChange`; `trigger="click"`, `openDelay` / `closeDelay`, tự lật phía khi thiếu chỗ, `theme`; kèm `TooltipContent` |
320
+ | Export | Mô tả |
321
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
322
+ | `Button` | Khung icon · label · icon — bật/tắt từng phần; `width` / `height`; `onClick` trả Promise → tự loading (spinner thay leading icon, khoá click), `loading` controlled |
323
+ | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`); phím ← → Home End |
324
+ | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `height` / `maxHeight` |
325
+ | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
326
+ | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
327
+ | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
328
+ | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
329
+ | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
330
+ | `Tooltip` | Hover/focus/Escape — `size`, `position`, `align`, `onOpenChange`; `trigger="click"`, `openDelay` / `closeDelay`, tự lật phía khi thiếu chỗ, `theme`; kèm `TooltipContent` |
284
331
 
285
332
  ```css
286
333
  /* Ngoài tokens.css + typography.css, mỗi component cần CSS riêng của nó */
@@ -336,8 +383,8 @@ dùng được toàn bộ class typography, color và mọi component (CSS). Scr
336
383
  Tabs · Toggle · Dialog · Slider · Tooltip (`data-leaf-*`).
337
384
 
338
385
  ```html
339
- <link rel="stylesheet" href="https://<cdn>/leaf-0.1.5.min.css" />
340
- <script src="https://<cdn>/leaf-0.1.5.min.js" defer></script>
386
+ <link rel="stylesheet" href="https://<cdn>/leaf-0.1.7.min.css" />
387
+ <script src="https://<cdn>/leaf-0.1.7.min.js" defer></script>
341
388
  ```
342
389
 
343
390
  | File | Nội dung |
@@ -362,8 +409,18 @@ Không cần JS. Thiếu attribute nào thì lấy mặc định giống prop Re
362
409
  | `data-loading` | `true` — `Leaf.button.setLoading` / `run` gắn | — |
363
410
 
364
411
  ```html
365
- <button class="leaf-button">Tiếp tục</button>
366
- <button class="leaf-button" data-priority="secondary" data-size="md">Secondary</button>
412
+ <button
413
+ class="leaf-button inline-flex items-center justify-center text-center whitespace-nowrap align-middle"
414
+ >
415
+ Tiếp tục
416
+ </button>
417
+ <button
418
+ class="leaf-button inline-flex items-center justify-center text-center whitespace-nowrap align-middle"
419
+ data-priority="secondary"
420
+ data-size="md"
421
+ >
422
+ Secondary
423
+ </button>
367
424
  ```
368
425
 
369
426
  Loading (cần `leaf.js`): `Leaf.button.run(el, promise)` bật loading tới khi promise settle,
@@ -423,6 +480,10 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
423
480
  trước.
424
481
  - **Không kèm font và CSS reset.** Tự load Inter (Google Fonts hoặc self-host) và set
425
482
  `body { font-family: var(--font-sans) }`.
483
+ - **CSS của trang phải nằm trong `@layer` nếu đụng vào element của component.** Style component
484
+ nằm trong `@layer components`, mà CSS không layer luôn thắng CSS có layer bất kể specificity —
485
+ reset kiểu `* { padding: 0 }` hay `button { background: none }` đặt trần sẽ xoá padding / nền
486
+ của `.leaf-button`. Bọc reset trong `@layer base { … }`.
426
487
  - **Trình duyệt tối thiểu** (CSS dùng `@layer`): Chrome / Edge 99+, Safari 15.4+, Firefox 97+.
427
488
  - Dark là mặc định; `data-theme="light"` trên `<html>` để chuyển light.
428
489
  - z-index của lớp phủ đọc `--leaf-z-dialog` (50) / `--leaf-z-spinner-overlay` (100) /
@@ -434,12 +495,73 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
434
495
  1. Bump `version` trong `packages/react/package.json`, ghi thay đổi vào [Changelog](#changelog).
435
496
  2. `pnpm --filter @finhay-pro/leaf-design-system build` → `dist/cdn/leaf-<version>.min.css` + `.min.js`.
436
497
  3. Đổi version trong `examples/static.html`, mở bằng `file://` để kiểm tra nhanh.
437
- 4. Upload 2 file bằng tool admin CDN. **Không xoá / ghi đè** file của version cũ — landing page
438
- đang trỏ vào.
439
- 5. Cập nhật `leafCdn` trong `apps/docs/config/shared.ts` bằng 2 link tool trả về.
498
+ 4. Cập nhật `leafCdnVersion` trong `apps/docs/config/shared.ts` (cùng version). Docs sync file vào
499
+ `public/cdn/` lúc build và serve trên domain Vercel.
500
+ 5. Deploy docs (`npx vercel --prod` từ root) để link CDN mới lên production. Landing đang dùng
501
+ version cũ giữ nguyên link cũ (Finhay CDN hoặc bản Vercel trước đó nếu còn cache/host).
440
502
 
441
503
  ## Changelog
442
504
 
505
+ ### 0.1.7
506
+
507
+ **Breaking**
508
+
509
+ - Đổi tên class nền `base-*` → `bg-*` (`bg-primary`, `bg-red`…). Token CSS vẫn là `--base-*`
510
+ (và `--button-base-*` không đổi).
511
+ - Component React/HTML tĩnh dùng class layout Leaf trên markup (`flex`, `w-full`…); CSS
512
+ component bỏ các thuộc tính đã có class tương đương.
513
+ - Hệ quả: `dist/<component>.css` **không còn tự đủ**. App import riêng từng component phải import
514
+ thêm `spacing.css` (Tabs `gap-m`, Slider `gap-s` / `gap-xs`) và `flex.css` · `sizing.css` ·
515
+ `overflow.css` · `position.css` · `text-layout.css` — hoặc dùng `classes.css` / `styles.css`.
516
+ Đừng trông vào class do app tự sinh — class nào app không tự dùng (vd. `gap-m`, `flex-auto`)
517
+ sẽ không có.
518
+ - HTML tĩnh viết theo markup cũ (chỉ có `leaf-*`) phải thêm class layout như markup mới (tab
519
+ **Code → HTML tĩnh** trên docs / `examples/static.html`).
520
+ - Radius: thang cũ `radius-0|xs|s|m|l|xl|2xl` (map sang spacing) đổi thành `radius-s|m|l|full`
521
+ (4 · 8 · 12px · 9999px). Class `radius-0` / `radius-xs` / `radius-xl` / `radius-2xl` bị xoá.
522
+
523
+ **Mới**
524
+
525
+ - Border width: token `--border-width-*` (s 0.5 · m 1 · l 1.5 · xl 2px) và class
526
+ `border-s|m|l|xl` (+ biến thể cạnh `top` / `right` / `bottom` / `left` / `inline` / `block`) —
527
+ set width + `border-style: solid`.
528
+ - Spacing: thêm bậc `2xs` (2px) — token `--spacing-2xs` và class `-2xs` cho mọi prefix
529
+ `p` / `m` / `gap`.
530
+
531
+ - Layout class: `flex.css`, `grid.css`, `sizing.css`,
532
+ `overflow.css`, `position.css`, `text-layout.css` — nằm `@layer components`. Không có
533
+ responsive / size cố định trong Leaf (app viết trong SCSS module). Docs tách trang:
534
+ `/styles/flex` · `/styles/grid` · `/styles/sizing` · `/styles/overflow` · `/styles/position`
535
+ · `/styles/text` (mỗi trang Overview · Usage · Tokens · Code).
536
+ - Display: `block` · `inline-block` · `inline` · `hidden` (trong `flex.css`). Spinner / Tooltip vốn đã dùng `block` trên markup nhưng trước đây Leaf chưa có.
537
+
538
+ **Sửa lỗi**
539
+
540
+ - Rule `[hidden]` (component + class layout + `line-clamp-*`) set `display: none` vì display giờ
541
+ đến từ class — thiếu rule này sẽ không ẩn được (vd. backdrop Dialog đã đóng vẫn phủ màn hình).
542
+ - leaf.js: bubble Tooltip và spinner loading của Button do JS tạo thiếu class layout
543
+ (`relative block shrink-0` trên caret, `relative z-10 max-w-full text-left` trên body,
544
+ `inline-flex …` trên spinner) → caret lệch vị trí. Nay khớp markup React; có test parity.
545
+ - Test `classes.test.tsx`: mọi class (trừ `leaf-*`) trên markup React / leaf.js phải có trong CSS
546
+ của Leaf.
547
+
548
+ ### 0.1.6
549
+
550
+ - Dialog: thêm prop `height` (CSS `--leaf-dialog-height`) — chiều cao cố định cho content động /
551
+ nhiều step để panel không giật, body cuộn bên trong; `maxHeight` vẫn là trần viewport.
552
+
553
+ **Sửa lỗi** — hành vi không còn phụ thuộc CSS reset:
554
+
555
+ - Button (vanilla): leading icon không ẩn khi `Leaf.button.setLoading` ở trang không có CSS reset
556
+ (`.leaf-button__icon { display }` thắng `[hidden]`). Thêm `[hidden] { display: none }` cho
557
+ root của Button · Tabs · Toggle · Slider · Spinner · Logo · Tooltip trigger.
558
+ - Mọi stylesheet trong `dist` mở đầu bằng `@layer theme, base, components, utilities;`: trước đây
559
+ app import `color.css` trước CSS component thì `text-*` không override được
560
+ component (vd. `leaf-spinner text-highlight`).
561
+ - `.leaf-button` / `.leaf-tab` thêm `appearance: none` như Toggle / Dialog.
562
+ - Dialog: typography + màu của title (heading-3 · `--text-primary`) chuyển vào `dialog.css`;
563
+ React không gắn `class="heading-3 text-primary"` nữa. Markup HTML tĩnh cũ vẫn hiển thị y hệt.
564
+
443
565
  ### 0.1.5
444
566
 
445
567
  **Sửa lỗi**
@@ -450,7 +572,7 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
450
572
  ### 0.1.4
451
573
 
452
574
  - System color: thêm secondary (`--system-*-secondary` → primitive `*/800`) và class
453
- `text|base|border-*-secondary` (vd. `base-red-secondary`). Giữ nguyên giá trị ở dark và light.
575
+ `text|base|border-*-secondary` (vd. `bg-red-secondary`). Giữ nguyên giá trị ở dark và light.
454
576
 
455
577
  ### 0.1.3
456
578
 
@@ -465,9 +587,10 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
465
587
  - Slider: label nằm ngoài thứ tự Tab (slider chỉ có một điểm dừng, nhảy mốc bằng PageUp /
466
588
  PageDown); mốc là `<span>` thay vì `<button>` — snippet HTML tĩnh đã đổi theo (markup cũ vẫn chạy).
467
589
  - Tabs: `size` chỉ nhận khi `variant="subcontent"` (TypeScript chặn tổ hợp không có trong Figma).
468
- - Dialog: `width` / `height` → `maxWidth` / `maxHeight` (CSS `--leaf-dialog-max-width` /
469
- `--leaf-dialog-max-height`). Panel luôn `width: 100%` / `height: auto` trong trần đó — mobile
470
- không bị cố định kích thước.
590
+ - Dialog: `maxWidth` / `height` / `maxHeight` (CSS `--leaf-dialog-max-width` /
591
+ `--leaf-dialog-height` / `--leaf-dialog-max-height`). Panel luôn `width: 100%` trong trần
592
+ rộng; `height` cố định khi truyền (content động không giật), không thì `auto`; `maxHeight`
593
+ luôn là trần viewport.
471
594
 
472
595
  **Sửa lỗi**
473
596
 
@@ -502,8 +625,9 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
502
625
 
503
626
  - Button: width/height prop; size MD/SM khớp Figma gap/padding; token
504
627
  `--button-disabled-base|content` (alias `--button-*-disable`).
505
- - Spacing: token `--spacing-*` (0…7xl) + class `p-*` / `m-*` / `gap-*` (Figma 34:1034).
506
- - Border: token `--radius-*` (0…2xl) + class `radius-*` (Figma 700:4390).
628
+ - Spacing: token `--spacing-*` (0…7xl, gồm `2xs`) + class `p-*` / `m-*` / `gap-*` (Figma 34:1034).
629
+ - Border: token `--border-width-*` (s…xl) + class `border-s|m|l|xl` (+ biến thể cạnh); token
630
+ `--radius-*` (s|m|l|full) + class `radius-*`.
507
631
  - Dual-support HTML tĩnh: vanilla `Leaf.toggle` / `dialog` / `slider` / `tooltip` (`data-leaf-*`);
508
632
  Logo CSS data-URI theo `data-brand` / `data-mode` / `data-side`; docs `htmlSection` +
509
633
  `examples/static.html` cover đủ component.
package/dist/border.css CHANGED
@@ -1,26 +1,22 @@
1
1
  /* @finhay-pro/leaf-design-system — generated by scripts/build-css.mjs. Do not edit. */
2
+ @layer theme, base, components, utilities;
2
3
 
3
4
  /* --- src/styles/border.css --- */
4
5
 
5
6
  /*
6
- * Border radius classes — map 1:1 sang --radius-* trong @finhay/leaf-tokens
7
- * (Figma 700:4390).
7
+ * Border classes — map 1:1 sang token trong @finhay/leaf-tokens.
8
8
  *
9
- * Tên class `radius-*` (không dùng `rounded-*`) để không đụng utility bo góc mặc
10
- * định của Tailwind (`rounded-xl`…). `border-*` đã dành cho màu viền.
9
+ * Width: `border-s|m|l|xl` (+ biến thể cạnh `border-top-s`…).
10
+ * Mỗi class set width + `border-style: solid` để một class là thấy viền
11
+ * (không trông vào CSS reset).
12
+ * Hậu tố width khác hậu tố màu (`border-primary`… chỉ set border-color).
13
+ * Không có bậc 0 — không viền thì không gắn class.
11
14
  *
12
- * Hậu tố = bậc token: 0 · xs · s · m · l · xl · 2xl.
13
- * Chỉ set border-radius — width / style / color do app tự lo.
15
+ * Radius: `radius-*` → border-radius. Hậu tố: s (4) · m (8) · l (12) · full.
14
16
  */
15
17
 
16
18
  @layer utilities {
17
- .radius-0 {
18
- border-radius: var(--radius-0);
19
- }
20
-
21
- .radius-xs {
22
- border-radius: var(--radius-xs);
23
- }
19
+ /* Radius */
24
20
 
25
21
  .radius-s {
26
22
  border-radius: var(--radius-s);
@@ -34,11 +30,153 @@
34
30
  border-radius: var(--radius-l);
35
31
  }
36
32
 
37
- .radius-xl {
38
- border-radius: var(--radius-xl);
33
+ .radius-full {
34
+ border-radius: var(--radius-full);
35
+ }
36
+
37
+ /* All sides */
38
+
39
+ .border-s {
40
+ border-width: var(--border-width-s);
41
+ border-style: solid;
42
+ }
43
+
44
+ .border-m {
45
+ border-width: var(--border-width-m);
46
+ border-style: solid;
47
+ }
48
+
49
+ .border-l {
50
+ border-width: var(--border-width-l);
51
+ border-style: solid;
52
+ }
53
+
54
+ .border-xl {
55
+ border-width: var(--border-width-xl);
56
+ border-style: solid;
57
+ }
58
+
59
+ /* Per side */
60
+
61
+ .border-top-s {
62
+ border-top-width: var(--border-width-s);
63
+ border-top-style: solid;
64
+ }
65
+
66
+ .border-top-m {
67
+ border-top-width: var(--border-width-m);
68
+ border-top-style: solid;
69
+ }
70
+
71
+ .border-top-l {
72
+ border-top-width: var(--border-width-l);
73
+ border-top-style: solid;
74
+ }
75
+
76
+ .border-top-xl {
77
+ border-top-width: var(--border-width-xl);
78
+ border-top-style: solid;
79
+ }
80
+
81
+ .border-right-s {
82
+ border-right-width: var(--border-width-s);
83
+ border-right-style: solid;
84
+ }
85
+
86
+ .border-right-m {
87
+ border-right-width: var(--border-width-m);
88
+ border-right-style: solid;
89
+ }
90
+
91
+ .border-right-l {
92
+ border-right-width: var(--border-width-l);
93
+ border-right-style: solid;
94
+ }
95
+
96
+ .border-right-xl {
97
+ border-right-width: var(--border-width-xl);
98
+ border-right-style: solid;
99
+ }
100
+
101
+ .border-bottom-s {
102
+ border-bottom-width: var(--border-width-s);
103
+ border-bottom-style: solid;
104
+ }
105
+
106
+ .border-bottom-m {
107
+ border-bottom-width: var(--border-width-m);
108
+ border-bottom-style: solid;
109
+ }
110
+
111
+ .border-bottom-l {
112
+ border-bottom-width: var(--border-width-l);
113
+ border-bottom-style: solid;
114
+ }
115
+
116
+ .border-bottom-xl {
117
+ border-bottom-width: var(--border-width-xl);
118
+ border-bottom-style: solid;
119
+ }
120
+
121
+ .border-left-s {
122
+ border-left-width: var(--border-width-s);
123
+ border-left-style: solid;
124
+ }
125
+
126
+ .border-left-m {
127
+ border-left-width: var(--border-width-m);
128
+ border-left-style: solid;
129
+ }
130
+
131
+ .border-left-l {
132
+ border-left-width: var(--border-width-l);
133
+ border-left-style: solid;
134
+ }
135
+
136
+ .border-left-xl {
137
+ border-left-width: var(--border-width-xl);
138
+ border-left-style: solid;
139
+ }
140
+
141
+ /* Logical */
142
+
143
+ .border-inline-s {
144
+ border-inline-width: var(--border-width-s);
145
+ border-inline-style: solid;
146
+ }
147
+
148
+ .border-inline-m {
149
+ border-inline-width: var(--border-width-m);
150
+ border-inline-style: solid;
151
+ }
152
+
153
+ .border-inline-l {
154
+ border-inline-width: var(--border-width-l);
155
+ border-inline-style: solid;
156
+ }
157
+
158
+ .border-inline-xl {
159
+ border-inline-width: var(--border-width-xl);
160
+ border-inline-style: solid;
161
+ }
162
+
163
+ .border-block-s {
164
+ border-block-width: var(--border-width-s);
165
+ border-block-style: solid;
166
+ }
167
+
168
+ .border-block-m {
169
+ border-block-width: var(--border-width-m);
170
+ border-block-style: solid;
171
+ }
172
+
173
+ .border-block-l {
174
+ border-block-width: var(--border-width-l);
175
+ border-block-style: solid;
39
176
  }
40
177
 
41
- .radius-2xl {
42
- border-radius: var(--radius-2xl);
178
+ .border-block-xl {
179
+ border-block-width: var(--border-width-xl);
180
+ border-block-style: solid;
43
181
  }
44
182
  }