@finhay-pro/leaf-design-system 0.1.6 → 0.1.8

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 (122) hide show
  1. package/README.md +352 -163
  2. package/dist/button.css +12 -15
  3. package/dist/calendar.css +325 -0
  4. package/dist/cdn/leaf-0.1.8.min.css +2 -0
  5. package/dist/cdn/leaf-0.1.8.min.js +2 -0
  6. package/dist/checkbox.css +132 -0
  7. package/dist/classes.css +2256 -1513
  8. package/dist/color.css +27 -32
  9. package/dist/components/Calendar/Calendar.d.ts +49 -0
  10. package/dist/components/Calendar/Calendar.d.ts.map +1 -0
  11. package/dist/components/Calendar/Calendar.js +167 -0
  12. package/dist/components/Calendar/Calendar.js.map +1 -0
  13. package/dist/components/Calendar/index.d.ts +2 -0
  14. package/dist/components/Calendar/index.d.ts.map +1 -0
  15. package/dist/components/Calendar/index.js +2 -0
  16. package/dist/components/Calendar/index.js.map +1 -0
  17. package/dist/components/Checkbox/Checkbox.d.ts +25 -0
  18. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
  19. package/dist/components/Checkbox/Checkbox.js +40 -0
  20. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  21. package/dist/components/Checkbox/index.d.ts +2 -0
  22. package/dist/components/Checkbox/index.d.ts.map +1 -0
  23. package/dist/components/Checkbox/index.js +2 -0
  24. package/dist/components/Checkbox/index.js.map +1 -0
  25. package/dist/components/Dropdown/Dropdown.d.ts +62 -0
  26. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -0
  27. package/dist/components/Dropdown/Dropdown.js +197 -0
  28. package/dist/components/Dropdown/Dropdown.js.map +1 -0
  29. package/dist/components/Dropdown/LanguageDropdown.d.ts +15 -0
  30. package/dist/components/Dropdown/LanguageDropdown.d.ts.map +1 -0
  31. package/dist/components/Dropdown/LanguageDropdown.js +18 -0
  32. package/dist/components/Dropdown/LanguageDropdown.js.map +1 -0
  33. package/dist/components/Dropdown/index.d.ts +4 -0
  34. package/dist/components/Dropdown/index.d.ts.map +1 -0
  35. package/dist/components/Dropdown/index.js +5 -0
  36. package/dist/components/Dropdown/index.js.map +1 -0
  37. package/dist/components/Input/Input.d.ts +57 -0
  38. package/dist/components/Input/Input.d.ts.map +1 -0
  39. package/dist/components/Input/Input.js +78 -0
  40. package/dist/components/Input/Input.js.map +1 -0
  41. package/dist/components/Input/InputDate.d.ts +56 -0
  42. package/dist/components/Input/InputDate.d.ts.map +1 -0
  43. package/dist/components/Input/InputDate.js +119 -0
  44. package/dist/components/Input/InputDate.js.map +1 -0
  45. package/dist/components/Input/InputOtp.d.ts +33 -0
  46. package/dist/components/Input/InputOtp.d.ts.map +1 -0
  47. package/dist/components/Input/InputOtp.js +96 -0
  48. package/dist/components/Input/InputOtp.js.map +1 -0
  49. package/dist/components/Input/InputStepper.d.ts +42 -0
  50. package/dist/components/Input/InputStepper.d.ts.map +1 -0
  51. package/dist/components/Input/InputStepper.js +86 -0
  52. package/dist/components/Input/InputStepper.js.map +1 -0
  53. package/dist/components/Input/index.d.ts +5 -0
  54. package/dist/components/Input/index.d.ts.map +1 -0
  55. package/dist/components/Input/index.js +5 -0
  56. package/dist/components/Input/index.js.map +1 -0
  57. package/dist/components/Radio/Radio.d.ts +39 -0
  58. package/dist/components/Radio/Radio.d.ts.map +1 -0
  59. package/dist/components/Radio/Radio.js +50 -0
  60. package/dist/components/Radio/Radio.js.map +1 -0
  61. package/dist/components/Radio/index.d.ts +2 -0
  62. package/dist/components/Radio/index.d.ts.map +1 -0
  63. package/dist/components/Radio/index.js +2 -0
  64. package/dist/components/Radio/index.js.map +1 -0
  65. package/dist/components/Toast/Toast.d.ts +66 -0
  66. package/dist/components/Toast/Toast.d.ts.map +1 -0
  67. package/dist/components/Toast/Toast.js +77 -0
  68. package/dist/components/Toast/Toast.js.map +1 -0
  69. package/dist/components/Toast/index.d.ts +2 -0
  70. package/dist/components/Toast/index.d.ts.map +1 -0
  71. package/dist/components/Toast/index.js +2 -0
  72. package/dist/components/Toast/index.js.map +1 -0
  73. package/dist/core/calendar.d.ts +36 -0
  74. package/dist/core/calendar.d.ts.map +1 -0
  75. package/dist/core/calendar.js +65 -0
  76. package/dist/core/calendar.js.map +1 -0
  77. package/dist/core/dropdown.d.ts +66 -0
  78. package/dist/core/dropdown.d.ts.map +1 -0
  79. package/dist/core/dropdown.js +131 -0
  80. package/dist/core/dropdown.js.map +1 -0
  81. package/dist/core/language.d.ts +25 -0
  82. package/dist/core/language.d.ts.map +1 -0
  83. package/dist/core/language.js +17 -0
  84. package/dist/core/language.js.map +1 -0
  85. package/dist/core/otp.d.ts +30 -0
  86. package/dist/core/otp.d.ts.map +1 -0
  87. package/dist/core/otp.js +65 -0
  88. package/dist/core/otp.js.map +1 -0
  89. package/dist/core/stepper.d.ts +39 -0
  90. package/dist/core/stepper.d.ts.map +1 -0
  91. package/dist/core/stepper.js +109 -0
  92. package/dist/core/stepper.js.map +1 -0
  93. package/dist/core/toast.d.ts +67 -0
  94. package/dist/core/toast.d.ts.map +1 -0
  95. package/dist/core/toast.js +102 -0
  96. package/dist/core/toast.js.map +1 -0
  97. package/dist/dialog.css +15 -9
  98. package/dist/dropdown.css +303 -0
  99. package/dist/index.d.ts +6 -0
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +6 -0
  102. package/dist/index.js.map +1 -1
  103. package/dist/input-date.css +49 -0
  104. package/dist/input-otp.css +76 -0
  105. package/dist/input-stepper.css +179 -0
  106. package/dist/input.css +218 -0
  107. package/dist/logo.css +2 -2
  108. package/dist/radio.css +124 -0
  109. package/dist/slider.css +16 -14
  110. package/dist/spinner.css +3 -3
  111. package/dist/styles.css +2255 -1545
  112. package/dist/tabs.css +5 -4
  113. package/dist/toast.css +234 -0
  114. package/dist/toggle.css +4 -3
  115. package/dist/tokens.css +0 -33
  116. package/dist/tooltip.css +13 -12
  117. package/dist/typography.css +1 -3
  118. package/package.json +10 -3
  119. package/dist/border.css +0 -45
  120. package/dist/cdn/leaf-0.1.6.min.css +0 -2
  121. package/dist/cdn/leaf-0.1.6.min.js +0 -2
  122. package/dist/spacing.css +0 -839
package/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # @finhay-pro/leaf-design-system
2
2
 
3
- Design system của Finhay dưới dạng **CSS class dùng sẵn**. Mọi style đều đọc từ CSS variables trong
4
- [`@finhay/leaf-tokens`](../tokens) — không hard-code giá trị nào.
3
+ Design system của Finhay: **2 bộ token — Color và Typography** (CSS variables trong
4
+ [`@finhay/leaf-tokens`](../tokens)), **class typography / màu dùng sẵn** và **component** (React +
5
+ HTML tĩnh dùng chung markup). Màu và chữ luôn đọc từ token; spacing / radius / độ dày viền không
6
+ phải token của Leaf — component tự khai báo trong CSS của nó, app dùng Tailwind hoặc CSS của page.
5
7
 
6
- Package không export component cho typography và color: bạn viết thẳng thẻ HTML của mình và gắn
7
- class, nên dùng được ở mọi nơi (React, Next.js, Vue, HTML thuần, template của thư viện khác) mà
8
- không phải bọc thêm một lớp component hay truyền props.
8
+ Leaf **không** có class layout / spacing / responsive. Phần đó thuộc về app, theo 2 cách dùng:
9
9
 
10
- Landing page HTML tĩnh (không có bundler) dùng bản CDN: 1 thẻ `<link>` + 1 thẻ `<script>` — xem
11
- [HTML tĩnh (CDN)](#html-tĩnh-cdn).
10
+ | Loại project | Leaf cung cấp | Layout · spacing · responsive · hover |
11
+ | ------------------- | ------------------------------------------ | ------------------------------------- |
12
+ | Next.js (có bundle) | Token + class typography / màu + component | **Tailwind CSS v4** |
13
+ | Landing page tĩnh | Bản CDN (1 `<link>` + 1 `<script>`) | **CSS riêng của page** |
14
+
15
+ Xem [Dùng với Next.js + Tailwind](#dùng-với-nextjs--tailwind) và [HTML tĩnh (CDN)](#html-tĩnh-cdn).
12
16
 
13
17
  ## Cài đặt
14
18
 
@@ -21,39 +25,42 @@ pnpm add @finhay-pro/leaf-design-system
21
25
  Class chỉ đọc `var(--…)`, không tự khai báo giá trị — nên **luôn import `tokens.css` trước**, rồi
22
26
  chọn phần class cần dùng.
23
27
 
24
- | Import | Nội dung |
25
- | ------------------------------------------------ | ------------------------------------------------------------------------------- |
26
- | `@finhay-pro/leaf-design-system/tokens.css` | Chỉ token (primitive + semantic + typography + spacing + border), không class. |
27
- | `@finhay-pro/leaf-design-system/typography.css` | Chỉ class typography. |
28
- | `@finhay-pro/leaf-design-system/color.css` | Chỉ class color. |
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-*`). |
31
- | `@finhay-pro/leaf-design-system/button.css` | Style của component `Button`. |
32
- | `@finhay-pro/leaf-design-system/tabs.css` | Style của component `Tabs`. |
33
- | `@finhay-pro/leaf-design-system/dialog.css` | Style của component `Dialog`. |
34
- | `@finhay-pro/leaf-design-system/logo.css` | Style của component `Logo`. |
35
- | `@finhay-pro/leaf-design-system/logo-assets.css` | SVG data-URI cho Logo HTML tĩnh — không nằm trong `classes.css` / `styles.css`. |
36
- | `@finhay-pro/leaf-design-system/skeleton.css` | Style của component `Skeleton`. |
37
- | `@finhay-pro/leaf-design-system/spinner.css` | Style của component `Spinner`. |
38
- | `@finhay-pro/leaf-design-system/toggle.css` | Style của component `Toggle`. |
39
- | `@finhay-pro/leaf-design-system/slider.css` | Style của component `Slider`. |
40
- | `@finhay-pro/leaf-design-system/tooltip.css` | Style của component `Tooltip`. |
41
- | `@finhay-pro/leaf-design-system/classes.css` | Tất cả class + component, không token. |
42
- | `@finhay-pro/leaf-design-system/styles.css` | Token + tất cả class + component. Một dòng là đủ. |
43
-
44
- Trong app dùng Tailwind v4, import bằng CSS, **sau** `@import "tailwindcss"`:
28
+ | Import | Nội dung |
29
+ | -------------------------------------------------- | ------------------------------------------------------------------------------- |
30
+ | `@finhay-pro/leaf-design-system/tokens.css` | Chỉ token (primitive + semantic màu + typography), không class. |
31
+ | `@finhay-pro/leaf-design-system/typography.css` | Chỉ class typography. |
32
+ | `@finhay-pro/leaf-design-system/color.css` | Chỉ class color. |
33
+ | `@finhay-pro/leaf-design-system/button.css` | Style của component `Button`. |
34
+ | `@finhay-pro/leaf-design-system/tabs.css` | Style của component `Tabs`. |
35
+ | `@finhay-pro/leaf-design-system/dialog.css` | Style của component `Dialog`. |
36
+ | `@finhay-pro/leaf-design-system/logo.css` | Style của component `Logo`. |
37
+ | `@finhay-pro/leaf-design-system/logo-assets.css` | SVG data-URI cho Logo HTML tĩnh — không nằm trong `classes.css` / `styles.css`. |
38
+ | `@finhay-pro/leaf-design-system/skeleton.css` | Style của component `Skeleton`. |
39
+ | `@finhay-pro/leaf-design-system/spinner.css` | Style của component `Spinner`. |
40
+ | `@finhay-pro/leaf-design-system/toggle.css` | Style của component `Toggle`. |
41
+ | `@finhay-pro/leaf-design-system/slider.css` | Style của component `Slider`. |
42
+ | `@finhay-pro/leaf-design-system/tooltip.css` | Style của component `Tooltip`. |
43
+ | `@finhay-pro/leaf-design-system/radio.css` | Style của component `Radio` / `RadioGroup`. |
44
+ | `@finhay-pro/leaf-design-system/checkbox.css` | Style của component `Checkbox`. |
45
+ | `@finhay-pro/leaf-design-system/input.css` | Style của component `Input` (field / inline, dùng chung cho `InputDate`). |
46
+ | `@finhay-pro/leaf-design-system/input-otp.css` | Style của component `InputOtp`. |
47
+ | `@finhay-pro/leaf-design-system/input-stepper.css` | Style của component `InputStepper`. |
48
+ | `@finhay-pro/leaf-design-system/calendar.css` | Style của component `Calendar` (cần kèm `button.css` cho footer). |
49
+ | `@finhay-pro/leaf-design-system/input-date.css` | Popover của `InputDate` (cần kèm `input.css` + `calendar.css` + `button.css`). |
50
+ | `@finhay-pro/leaf-design-system/toast.css` | Style của `Toaster` / `ToastContent`. |
51
+ | `@finhay-pro/leaf-design-system/dropdown.css` | Style của component `Dropdown`. |
52
+ | `@finhay-pro/leaf-design-system/classes.css` | Tất cả class + component, không token. |
53
+ | `@finhay-pro/leaf-design-system/styles.css` | Token + tất cả class + component. Một dòng là đủ. |
54
+
55
+ Import bằng CSS:
45
56
 
46
57
  ```css
47
- @import "tailwindcss";
48
-
49
58
  /* 1. Token — luôn đứng đầu */
50
59
  @import "@finhay-pro/leaf-design-system/tokens.css";
51
60
 
52
- /* 2. Bộ class nền tảng */
61
+ /* 2. Class typography + màu */
53
62
  @import "@finhay-pro/leaf-design-system/typography.css";
54
63
  @import "@finhay-pro/leaf-design-system/color.css";
55
- @import "@finhay-pro/leaf-design-system/spacing.css";
56
- @import "@finhay-pro/leaf-design-system/border.css";
57
64
 
58
65
  /* 3. Component nào dùng thì import cái đó */
59
66
  @import "@finhay-pro/leaf-design-system/button.css";
@@ -65,13 +72,67 @@ Trong app dùng Tailwind v4, import bằng CSS, **sau** `@import "tailwindcss"`:
65
72
  @import "@finhay-pro/leaf-design-system/toggle.css";
66
73
  @import "@finhay-pro/leaf-design-system/slider.css";
67
74
  @import "@finhay-pro/leaf-design-system/tooltip.css";
75
+ @import "@finhay-pro/leaf-design-system/radio.css";
76
+ @import "@finhay-pro/leaf-design-system/checkbox.css";
77
+ @import "@finhay-pro/leaf-design-system/input.css";
78
+ @import "@finhay-pro/leaf-design-system/input-otp.css";
79
+ @import "@finhay-pro/leaf-design-system/input-stepper.css";
80
+ @import "@finhay-pro/leaf-design-system/calendar.css";
81
+ @import "@finhay-pro/leaf-design-system/input-date.css";
82
+ @import "@finhay-pro/leaf-design-system/toast.css";
83
+ @import "@finhay-pro/leaf-design-system/dropdown.css";
68
84
  ```
69
85
 
70
86
  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
87
 
72
- 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)
74
- có thể bỏ `color.css` để không bị class màu của Leaf đè lên.
88
+ CSS của component **tự đủ** về layout (display, flex, gap, padding, radius, viền…): chỉ cần
89
+ `tokens.css` + `typography.css` + CSS của component là component hiển thị đúng. Riêng `Calendar`
90
+ gắn thêm class màu (`bg-secondary`, `border-tertiary`…) nên cần cả `color.css`. App đang giữ bộ màu
91
+ riêng có thể bỏ `color.css` (trừ khi dùng `Calendar`).
92
+
93
+ ## Dùng với Next.js + Tailwind
94
+
95
+ Leaf lo token, typography, màu và component; Tailwind CSS v4 lo layout, spacing, radius, độ dày
96
+ viền, responsive và state (`hover:`, `md:`…). Cấu hình mẫu trong `globals.css` (site docs
97
+ `apps/docs` dùng đúng cấu hình này):
98
+
99
+ ```css
100
+ @layer theme, base, components, utilities;
101
+
102
+ /* Leaf trước Tailwind utilities → class Tailwind override được class màu Leaf khi cần */
103
+ @import "@finhay-pro/leaf-design-system/styles.css";
104
+ @import "tailwindcss";
105
+
106
+ /* Màu và cỡ chữ chỉ lấy từ Leaf — tắt palette và thang font-size của Tailwind */
107
+ @theme {
108
+ --color-*: initial;
109
+ --text-*: initial;
110
+ }
111
+ ```
112
+
113
+ ```tsx
114
+ import { Button } from "@finhay-pro/leaf-design-system";
115
+
116
+ <section className="bg-secondary border-quaternary flex flex-col gap-3 rounded-xl border p-4 md:p-6">
117
+ <h3 className="heading-3 text-primary">Tích luỹ</h3>
118
+ <p className="body-4 text-secondary hover:text-(color:--text-highlight)">Lợi nhuận 8.5%/năm</p>
119
+ <Button className="w-full md:w-auto">Đầu tư</Button>
120
+ </section>;
121
+ ```
122
+
123
+ - Class typography / màu Leaf giữ nguyên tên (`body-3`, `text-secondary`, `bg-secondary`,
124
+ `border-quaternary`…). Giá trị lẻ dùng token qua cú pháp biến của Tailwind:
125
+ `bg-(--base-tertiary)`, `text-(color:--text-highlight)`.
126
+ - Spacing / radius / độ dày viền dùng thang của Tailwind (base 4px). Thang px theo Figma:
127
+
128
+ | Figma | px | Tailwind |
129
+ | ----------------- | -------------------------------------------------------- | ------------------------------------------------------------------------ |
130
+ | Spacing 2XS…7XL | 2 · 4 · 8 · 12 · 16 · 24 · 36 · 48 · 60 · 84 · 120 · 240 | `0.5` `1` `2` `3` `4` `6` `9` `12` `15` `21` `30` `60` (`p-4`, `gap-3`…) |
131
+ | Radius S/M/L/Full | 4 · 8 · 12 · full | `rounded-sm` / `rounded-lg` / `rounded-xl` / `rounded-full` |
132
+ | Border S/M/L/XL | 0.5 · 1 · 1.5 · 2 | `border-[0.5px]` / `border` / `border-[1.5px]` / `border-2` |
133
+
134
+ - Override CSS của component bằng `className` Tailwind: utility (`@layer utilities`) luôn thắng CSS
135
+ component (`@layer components`), không cần `!important`.
75
136
 
76
137
  ## Typography class
77
138
 
@@ -118,8 +179,8 @@ Trong React / Next.js, class đi thẳng vào `className` của bất kỳ eleme
118
179
  ```tsx
119
180
  <h2 className="heading-2">Tài sản của bạn</h2>
120
181
 
121
- // Class typography lo cỡ chữ, color lo màu, spacing lo khoảng cách
122
- <p className="body-3 text-secondary mt-s">Lợi nhuận kỳ vọng 8.5%/năm</p>
182
+ // Class typography lo cỡ chữ, color lo màu; khoảng cách là của app (Tailwind `mt-2`)
183
+ <p className="body-3 text-secondary mt-2">Lợi nhuận kỳ vọng 8.5%/năm</p>
123
184
 
124
185
  // Gắn vào component của thư viện khác cũng chỉ là một chuỗi class
125
186
  <Link href="/tai-khoan" className="body-3-highlight">
@@ -129,22 +190,23 @@ Trong React / Next.js, class đi thẳng vào `className` của bất kỳ eleme
129
190
 
130
191
  ## Color class
131
192
 
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,
193
+ 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
194
  `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
195
+ `text-red` / `bg-red` / `border-red`, `text-primary` / `bg-primary` / `border-primary`. Nhóm
135
196
  system bỏ chữ `system` trong tên class (token vẫn là `--system-red`), còn `border-*` lấy màu từ
136
197
  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
198
  viết thêm gì cho light mode.
138
199
 
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`) |
200
+ | Nhóm | Class |
201
+ | ---------------- | ------------------------------------------------------------------------------------------------------ |
202
+ | Text color | `text-primary`, `text-secondary`, `text-tertiary`, `text-quaternary`, `text-highlight` |
203
+ | Background | `bg-primary` … `bg-quinary`, `bg-highlight` |
204
+ | Border color | `border-primary` … `border-quinary` (màu của thang base), `border-highlight` |
205
+ | System (đủ 3 bộ) | `text-*`, `bg-*`, `border-*` với `red`, `green`, `yellow`, `orange`, `blue`, `purple` (+ `-secondary`) |
145
206
 
146
207
  ```html
147
- <div class="base-secondary border-quaternary p-l radius-m border">
208
+ <!-- Viền: class màu chỉ set border-color — độ dày / padding do app (Tailwind hoặc CSS của page) -->
209
+ <div class="bg-secondary border-quaternary card">
148
210
  <h3 class="heading-3 text-primary">Tích luỹ</h3>
149
211
  <p class="body-4 text-secondary">Lợi nhuận kỳ vọng 8.5%/năm</p>
150
212
  <p class="body-4 text-red">Số dư không đủ</p>
@@ -154,93 +216,31 @@ viết thêm gì cho light mode.
154
216
  <html data-theme="light"></html>
155
217
  ```
156
218
 
157
- ## Spacing class
158
-
159
- 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`.
161
-
162
- | Prefix | Property |
163
- | -------------------------------- | -------------------------------------------- |
164
- | `p-*` `px-*` `py-*` `pt/r/b/l-*` | padding / padding-inline / block / từng cạnh |
165
- | `m-*` `mx-*` `my-*` `mt/r/b/l-*` | margin tương tự |
166
- | `gap-*` `gap-x-*` `gap-y-*` | gap / column-gap / row-gap |
167
-
168
- | Hậu tố | Token | px |
169
- | ------ | --------------- | --- |
170
- | `0` | `--spacing-0` | 0 |
171
- | `xs` | `--spacing-xs` | 4 |
172
- | `s` | `--spacing-s` | 8 |
173
- | `m` | `--spacing-m` | 12 |
174
- | `l` | `--spacing-l` | 16 |
175
- | `xl` | `--spacing-xl` | 24 |
176
- | `2xl` | `--spacing-2xl` | 36 |
177
- | `3xl` | `--spacing-3xl` | 48 |
178
- | `4xl` | `--spacing-4xl` | 60 |
179
- | `5xl` | `--spacing-5xl` | 84 |
180
- | `6xl` | `--spacing-6xl` | 120 |
181
- | `7xl` | `--spacing-7xl` | 240 |
182
-
183
- ```html
184
- <div class="gap-m p-l flex flex-col">
185
- <h3 class="heading-3">Danh mục</h3>
186
- <p class="body-4 mt-s text-secondary">Cập nhật 5 phút trước</p>
187
- </div>
188
- ```
189
-
190
- ## Border radius class
191
-
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).
194
-
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 |
204
-
205
- ```html
206
- <div class="base-secondary border-quaternary p-l radius-m border">Card</div>
207
- ```
208
-
209
219
  ## Cần biết
210
220
 
211
221
  - **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.
219
- - **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
- - **Không cần Tailwind.** Mỗi file CSS mở đầu bằng `@layer theme, base, components, utilities;`
224
- (cùng thứ tự Tailwind v4), nên app CSS thuần import file theo thứ tự nào thì class
225
- color / spacing / border vẫn đứng trên CSS component. Component không trông vào preflight:
226
- tự reset `button`, tự xử lý `[hidden]`.
227
- - **Token `--font-sans`, `--radius-xs` / `--radius-xl` / `--radius-2xl` trùng tên biến theme
228
- mặc định của Tailwind v4.** `tokens.css` đặt trên `:root` không layer nên thắng `@theme`:
229
- `rounded-xs` / `rounded-xl` / `rounded-2xl` của app thành 4 / 24 / 36px. App muốn giữ scale
230
- Tailwind thì khai báo lại các biến đó sau khi import Leaf (token `--radius-*` của Leaf đổi theo).
231
- - **Class không có biến thể `hover:` / `focus:` / opacity** — nó là CSS thuần, không phải utility do
232
- Tailwind sinh ra. Cần state thì dùng arbitrary value trỏ vào cùng token:
233
- `hover:text-[var(--text-highlight)]` (pseudo-class có specificity cao hơn nên thắng). Riêng biến
234
- thể responsive cùng specificity với class màu và được ghi ra trước, nên cần important modifier:
235
- `md:text-[var(--text-secondary)]!`.
222
+ **class color chỉ set đúng 1** (`color` / `background-color` / `border-color`). Font family,
223
+ letter spacing… nằm ngoài phạm vi — app tự setup ở tầng global
224
+ (`body { font-family: var(--font-sans) }`, CSS reset…).
225
+ - **Leaf không có class layout / spacing / radius / border width / responsive.** Next.js dùng
226
+ Tailwind, landing page dùng CSS của page. Leaf cũng **không** có token spacing / radius / độ dày
227
+ viền — chỉ có token màu và typography.
228
+ - **Typography và CSS component nằm trong `@layer components`**; **class màu nằm trong
229
+ `@layer utilities`** (đè được CSS component, vd. `leaf-spinner text-highlight`). Utility của app
230
+ (Tailwind) và CSS không layer (CSS / SCSS module của app) đều override được, không cần
231
+ `!important`.
232
+ - **Mỗi file CSS mở đầu bằng `@layer theme, base, components, utilities;`** — trùng thứ tự layer của
233
+ Tailwind v4, nên import file theo thứ tự nào thì class màu vẫn đứng trên CSS component. Component
234
+ không trông vào CSS reset: tự reset `button`, tự xử lý `[hidden]`.
235
+ - **Class không có biến thể `hover:` / `focus:` / opacity** — nó là CSS thuần. Cần state thì dùng
236
+ Tailwind (`hover:text-(color:--text-highlight)`) hoặc CSS của page với cùng token.
236
237
  - **Chỉ semantic token mới có class màu.** Primitive (`--neutral-500`, `--brand-300`…) là nguồn nội
237
- 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,
238
- không đổi theo theme.
238
+ bộ, dùng thẳng trong UI là mất khả năng đổi theme. Spacing / border-width / radius là thang kích
239
+ thước cố định, không đổi theo theme.
239
240
  - **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ỹ
240
241
  nếu load kèm CSS framework khác (Bootstrap cũng định nghĩa `.display-1`–`.display-6`). Với
241
- Tailwind thì màu / spacing token-name của Leaf luôn thắng khi trùng tên — đó là chủ đích; muốn
242
- 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
243
- `rounded-*` để không đụng bo góc mặc định của Tailwind.
242
+ Tailwind v4: tắt palette (`--color-*: initial`) để `text-*` / `bg-*` / `border-*` chỉ còn class
243
+ màu của Leaf.
244
244
  - Typography token hiện chỉ có **bộ Desktop**. Chưa có responsive type set, nên các style Display
245
245
  cần app tự xử lý ở breakpoint nhỏ.
246
246
 
@@ -265,30 +265,44 @@ khi chạy docs: xoá `apps/docs/.next/dev` rồi chạy lại `pnpm dev`.
265
265
  typography của label. Component React chỉ gắn attribute, không gắn class theo prop — nhờ vậy HTML
266
266
  tĩnh viết cùng markup là ra cùng kết quả. Attribute thiếu → CSS lấy mặc định giống prop React.
267
267
 
268
- Thêm bộ class mới: tạo `src/styles/<tên>.css` — script tự sinh `dist/<tên>.css` và gom vào
269
- `classes.css` + `styles.css`; chỉ cần thêm một dòng `"./<tên>.css"` vào `exports` của
268
+ **CSS component tự đủ**: layout (display / flex / grid / gap / padding / radius / viền…) nằm trong
269
+ `<tên>.css` của component; markup chỉ gắn class `leaf-*` (+ class typography / màu khi cần). Phần tử
270
+ nào CSS set `display` thì kèm rule `[hidden] { display: none }`.
271
+
272
+ Thêm bộ class mới (typography / màu): tạo `src/styles/<tên>.css` — script tự sinh `dist/<tên>.css`
273
+ và gom vào `classes.css` + `styles.css`; chỉ cần thêm một dòng `"./<tên>.css"` vào `exports` của
270
274
  `package.json`.
271
275
  Thêm component React (khi thật sự cần state/behavior, không phải để bọc style): tạo
272
276
  `src/components/<Tên>/` (kèm `<tên>.css` nếu cần) rồi re-export trong `src/index.ts`. CSS của
273
277
  component cũng ra `dist/<tên>.css` và được gom vào `classes.css` / `styles.css` — nhớ thêm dòng
274
278
  `"./<tên>.css"` vào `exports`. Tên file CSS phải duy nhất trong cả `src/` (script báo lỗi nếu trùng).
275
- Component có hành vi (Tabs · Toggle · Dialog · Slider · Tooltip) cần thêm bản vanilla cho HTML
279
+ Component có hành vi (Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown) cần thêm bản vanilla cho HTML
276
280
  tĩnh trong `src/vanilla/` và gắn vào `window.Leaf` qua `src/vanilla/index.ts`. `src/vanilla` chỉ
277
281
  vào bản CDN, không vào bản npm.
278
282
 
279
283
  ## Components
280
284
 
281
- | Export | Mô tả |
282
- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
283
- | `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 |
284
- | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`); phím ← → Home End |
285
- | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `height` / `maxHeight` |
286
- | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
287
- | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
288
- | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
289
- | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
290
- | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
291
- | `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` |
285
+ | Export | Mô tả |
286
+ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
287
+ | `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 |
288
+ | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`); phím ← → Home End |
289
+ | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `height` / `maxHeight` |
290
+ | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
291
+ | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
292
+ | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
293
+ | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
294
+ | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
295
+ | `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` |
296
+ | `Radio` / `RadioGroup` | Radio đơn + nhóm — `value` / `defaultValue` / `onValueChange`, `name` cho form, `disabled`, `orientation` |
297
+ | `Checkbox` | Checkbox — `checked` / `defaultChecked` / `onCheckedChange` (`checked="indeterminate"` cho trạng thái lưng chừng), `label`, `disabled`; input native nên đi thẳng vào `FormData` |
298
+ | `Input` | Input dynamic — `variant` field/inline, `shape` default/pill, slot `label` · `leadingIcon` · `trailingIcon` · `action` · `message`, `invalid`, `revealPassword`; `as="button"` làm trigger |
299
+ | `InputOtp` | Ô OTP — `length`, `mask`, dán cả mã, `onComplete`; `name` → input ẩn |
300
+ | `InputStepper` | Nhập số với −/+ — `tone` buy/sell, `step` / `min` / `max` / `precision`, `locale`, `unit`; phím ↑ ↓, chốt khi blur/Enter |
301
+ | `Calendar` | Lịch tháng (port từ vnsc) — chọn ngày / giờ (`showTime`, `timeOnly`), `minDate` / `maxDate` / `disablePast` / `disableFuture` / `disableDate`, luật giờ (`minHour` / `maxHour` / `minuteStep`…), `weekStartsOn`, `labels`; dùng độc lập được |
302
+ | `InputDate` | `Input` trigger + popover `Calendar` — `value` chốt khi bấm "Chọn" (hoặc `confirmOnSelect`), `formatDisplay`, `align`, tự lật phía; `name` → input ẩn ISO |
303
+ | `Toaster` / `toast` | Toast success / error / warning — `toast.success(title, { description, duration })`, `duration: -1` không tự đóng, dừng khi hover / focus, `toast.dismiss(id)`; `<Toaster position closeLabel theme />` đặt một lần; kèm `ToastContent` |
304
+ | `Dropdown` | Chọn một giá trị — `variant` list / radio, `trigger` field / text, `appearance` filled / outlined, `size` md / sm, `openOn` click / hover, `align`, `readOnly`, `maxHeight`; option `leading` / `disabled`; phím ↑ ↓ Home End + typeahead |
305
+ | `LanguageDropdown` | Chọn ngôn ngữ Tiếng Việt / English kèm cờ (CDN Finhay) — danh sách ở `LEAF_LANGUAGES`, `value` kiểu `LeafLanguageCode`; mặc định `size="sm"`, `openOn="hover"`, `align="end"` |
292
306
 
293
307
  ```css
294
308
  /* Ngoài tokens.css + typography.css, mỗi component cần CSS riêng của nó */
@@ -339,19 +353,51 @@ import {
339
353
 
340
354
  ## HTML tĩnh (CDN)
341
355
 
342
- Cho landing page / trang dựng tay không có bundler. Giống Bootstrap: 1 `<link>` + 1 `<script>` là
343
- dùng được toàn bộ class typography, color và mọi component (CSS). Script chỉ cần khi dùng hành vi
344
- Tabs · Toggle · Dialog · Slider · Tooltip (`data-leaf-*`).
356
+ Cho landing page / trang dựng tay không có bundler: **Leaf CDN + CSS riêng của page**. 1 `<link>` +
357
+ 1 `<script>` là dùng được toàn bộ class typography, color và mọi component (CSS). Script chỉ cần
358
+ khi dùng hành vi Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown (`data-leaf-*`).
359
+ Layout, spacing, responsive của page viết trong CSS của page, dùng token Leaf.
345
360
 
346
361
  ```html
347
- <link rel="stylesheet" href="https://<cdn>/leaf-0.1.6.min.css" />
348
- <script src="https://<cdn>/leaf-0.1.6.min.js" defer></script>
362
+ <link rel="stylesheet" href="https://<cdn>/leaf-0.1.8.min.css" />
363
+ <script src="https://<cdn>/leaf-0.1.8.min.js" defer></script>
364
+
365
+ <style>
366
+ /* CSS của page — bọc trong @layer để không đè nhầm CSS component (xem "Cần biết") */
367
+ @layer base {
368
+ body {
369
+ margin: 0;
370
+ font-family: var(--font-sans);
371
+ background: var(--base-primary);
372
+ }
373
+ }
374
+
375
+ @layer page {
376
+ .hero {
377
+ display: flex;
378
+ flex-direction: column;
379
+ gap: 16px;
380
+ padding: 48px 16px;
381
+ }
382
+
383
+ @media (min-width: 768px) {
384
+ .hero {
385
+ flex-direction: row;
386
+ }
387
+ }
388
+ }
389
+ </style>
390
+
391
+ <section class="hero">
392
+ <h1 class="display-3 text-primary">Finhay</h1>
393
+ <button class="leaf-button" data-size="md">Mở tài khoản</button>
394
+ </section>
349
395
  ```
350
396
 
351
- | File | Nội dung |
352
- | ------------------------ | -------------------------------------------------------------------------------------------- |
353
- | `leaf-<version>.min.css` | `styles.css` đã minify: token + typography + color + CSS của mọi component. |
354
- | `leaf-<version>.min.js` | Hành vi Tabs · Toggle · Dialog · Slider · Tooltip → `window.Leaf`. Trang CSS-only có thể bỏ. |
397
+ | File | Nội dung |
398
+ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
399
+ | `leaf-<version>.min.css` | `styles.css` đã minify: token + typography + color + CSS của mọi component. |
400
+ | `leaf-<version>.min.js` | Hành vi Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown → `window.Leaf`. Trang CSS-only có thể bỏ. |
355
401
 
356
402
  Link thật (do tool admin CDN trả về) nằm ở trang docs **Develop → Web**. Trang demo đủ mọi biến thể:
357
403
  [`examples/static.html`](examples/static.html) (mở bằng `file://` sau khi build).
@@ -419,6 +465,41 @@ Span rỗng `.leaf-logo` + `data-brand` / `data-mode` / `data-side` + `--leaf-lo
419
465
  SVG data-URI — không cần JS. Bản CDN đã gộp sẵn data-URI; dùng qua npm thì import thêm
420
466
  `logo-assets.css` (không nằm trong `classes.css` / `styles.css` vì component React không cần).
421
467
 
468
+ ### Radio / Checkbox / Input
469
+
470
+ Chỉ CSS — markup như tab **Code → HTML tĩnh**. Input đọc `data-variant` / `data-shape` /
471
+ `data-invalid` / `data-disabled` trên `.leaf-input`.
472
+
473
+ ### InputOtp
474
+
475
+ `data-leaf-input-otp` trên `.leaf-input-otp` (các ô `.leaf-input-otp__cell`). leaf.js lo nhảy ô,
476
+ dán, Backspace; `Leaf.inputOtp.set` / `get` · `leaf:input-otp-change` · `leaf:input-otp-complete`.
477
+ Có `input[type=hidden]` trong markup thì leaf.js ghi mã vào đó.
478
+
479
+ ### InputStepper
480
+
481
+ `data-leaf-input-stepper` trên `.leaf-input-stepper` + `data-step` / `data-precision` /
482
+ `data-locale`; min / max đọc từ `aria-valuemin` / `aria-valuemax` của input. Nút `data-action="decrement|increment"`.
483
+ `Leaf.inputStepper.set` / `get` · `leaf:input-stepper-change`.
484
+
485
+ ### Toast
486
+
487
+ `Leaf.toast.success | error | warning(title, { description, duration, id })` (hoặc
488
+ `Leaf.toast.show({ status, title, … })`) trả id; `Leaf.toast.dismiss(id?)` đóng (không truyền → đóng
489
+ hết); `Leaf.toast.configure({ position, closeLabel, label, theme })`. Vùng chứa
490
+ `.leaf-toaster[data-leaf-toaster]` có sẵn trong trang thì dùng, không thì leaf.js tự tạo. Toast viết
491
+ tay: `.leaf-toast[data-leaf-toast]` + `data-status` — nút `.leaf-toast__close` và thanh progress
492
+ chạy hết đều đóng toast. Event `leaf:toast-show` / `leaf:toast-dismiss`.
493
+
494
+ ### Dropdown
495
+
496
+ `data-leaf-dropdown` trên `.leaf-dropdown` (markup như tab **Code → HTML tĩnh**) + `data-variant` /
497
+ `data-trigger` / `data-appearance` / `data-size` / `data-align`; `data-open-on="hover"` để rê chuột
498
+ mở. Option `.leaf-dropdown__option[data-value]`, mục chọn `aria-selected="true"`, disabled
499
+ `aria-disabled="true"`. `Leaf.dropdown.open` / `close` / `select(el, value)` ·
500
+ `leaf:dropdown-change`. Có `input.leaf-dropdown__input` thì leaf.js ghi value vào đó. Panel nằm ngay
501
+ dưới trigger (không portal) — tránh đặt trong khung `overflow: hidden / auto` thấp hơn panel.
502
+
422
503
  ### Skeleton / Spinner
423
504
 
424
505
  Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `data-animation` /
@@ -434,11 +515,15 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
434
515
  - **CSS của trang phải nằm trong `@layer` nếu đụng vào element của component.** Style component
435
516
  nằm trong `@layer components`, mà CSS không layer luôn thắng CSS có layer bất kể specificity —
436
517
  reset kiểu `* { padding: 0 }` hay `button { background: none }` đặt trần sẽ xoá padding / nền
437
- của `.leaf-button`. Bọc reset trong `@layer base { … }`.
518
+ của `.leaf-button`. Bọc reset trong `@layer base { … }`, layout của page trong một layer riêng
519
+ (vd. `@layer page`, khai báo sau `utilities` nếu muốn đè cả class màu).
520
+ - **Leaf không có class layout / spacing** (`flex`, `gap-*`, `p-*`… đã bỏ từ 0.1.8). Markup component
521
+ chỉ cần class `leaf-*` (+ typography / màu); markup cũ còn class layout vẫn hiển thị y hệt — các
522
+ class đó giờ không có tác dụng.
438
523
  - **Trình duyệt tối thiểu** (CSS dùng `@layer`): Chrome / Edge 99+, Safari 15.4+, Firefox 97+.
439
524
  - Dark là mặc định; `data-theme="light"` trên `<html>` để chuyển light.
440
- - z-index của lớp phủ đọc `--leaf-z-dialog` (50) / `--leaf-z-spinner-overlay` (100) /
441
- `--leaf-z-tooltip` (110) — override trên `:root` để chèn lớp của trang vào giữa.
525
+ - z-index của lớp phủ đọc `--leaf-z-dropdown` (30) / `--leaf-z-dialog` (50) /
526
+ `--leaf-z-spinner-overlay` (100) / `--leaf-z-tooltip` (110) / `--leaf-z-toast` (120) — override trên `:root` để chèn lớp của trang vào giữa.
442
527
  - Chi tiết attribute / markup từng component: tab **Code → HTML tĩnh** trên docs.
443
528
 
444
529
  ### Phát hành bản CDN
@@ -446,24 +531,127 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
446
531
  1. Bump `version` trong `packages/react/package.json`, ghi thay đổi vào [Changelog](#changelog).
447
532
  2. `pnpm --filter @finhay-pro/leaf-design-system build` → `dist/cdn/leaf-<version>.min.css` + `.min.js`.
448
533
  3. Đổi version trong `examples/static.html`, mở bằng `file://` để kiểm tra nhanh.
449
- 4. Upload 2 file bằng tool admin CDN. **Không xoá / ghi đè** file của version cũ — landing page
450
- đang trỏ vào.
451
- 5. Cập nhật `leafCdn` trong `apps/docs/config/shared.ts` bằng 2 link tool trả về.
534
+ 4. Cập nhật `leafCdnVersion` trong `apps/docs/config/shared.ts` (cùng version). Docs sync file vào
535
+ `public/cdn/` lúc build và serve trên domain Vercel.
536
+ 5. Deploy docs (`npx vercel --prod` từ root) để link CDN mới lên production. Landing đang dùng
537
+ version cũ giữ nguyên link cũ (Finhay CDN hoặc bản Vercel trước đó nếu còn cache/host).
452
538
 
453
539
  ## Changelog
454
540
 
541
+ ### 0.1.8
542
+
543
+ **Breaking**
544
+
545
+ - Bỏ class layout / spacing / border width / radius khỏi Leaf: xoá `spacing.css`, `border.css`,
546
+ `flex.css`, `grid.css`, `sizing.css`, `overflow.css`, `position.css`, `text-layout.css` (cả
547
+ export npm lẫn trong `classes.css` / `styles.css` / CDN). Next.js dùng Tailwind (xem
548
+ [Dùng với Next.js + Tailwind](#dùng-với-nextjs--tailwind)), landing page dùng CSS của page. Trang
549
+ dựng layout bằng các class này (`flex`, `gap-m`, `p-l`, `radius-l`…) phải giữ link CDN 0.1.7 hoặc
550
+ chuyển sang CSS riêng trước khi lên 0.1.8.
551
+ - Bỏ token `--spacing-*`, `--border-width-*`, `--radius-*` (file `spacing.css` / `border.css` của
552
+ `@finhay/leaf-tokens`). Leaf chỉ còn 2 bộ token: **Color** và **Typography**. CSS component khai
553
+ báo giá trị px trực tiếp (giá trị không đổi); app đang đọc các biến này phải tự khai báo lại hoặc
554
+ chuyển sang Tailwind.
555
+
556
+ **Thay đổi**
557
+
558
+ - CSS component tự đủ trở lại: layout nằm trong `<component>.css`, markup React / leaf.js chỉ gắn
559
+ class `leaf-*` (+ typography / màu). Import riêng `tokens.css` + `typography.css` +
560
+ `<component>.css` là đủ (`Calendar` cần thêm `color.css`). Giao diện không đổi; markup HTML tĩnh
561
+ cũ (còn class layout) vẫn hiển thị y hệt.
562
+ - `Calendar`: thêm class BEM cho các khối trước đây chỉ có class layout (`__heading`,
563
+ `__months-header`, `__months-grid`, `__weekdays`, `__weekday`, `__time-group`, `__select-wrap`,
564
+ `__footer`).
565
+ - `Dialog`: truncate của title nằm trong `dialog.css` (`.leaf-dialog__start > h2 | p`) — markup
566
+ không cần class `min-w-0 truncate`.
567
+ - Docs: dùng Leaf + Tailwind v4 (bỏ SCSS module); bỏ trang Spacing, Border, Flex, Grid, Sizing,
568
+ Overflow, Position, Text.
569
+
570
+ **Mới**
571
+
572
+ - `Toaster` / `toast` / `ToastContent` — toast success · error · warning (port từ vnsc). Màu từ
573
+ token có sẵn: nền `--system-green|red|yellow-secondary`, viền / icon / progress
574
+ `--text-highlight` · `--system-red` · `--system-yellow`. Toast gắn `data-theme="dark"` mặc định
575
+ (nền thang 800 ở cả hai theme). Tự đóng sau `duration` (mặc định 4000ms, `-1` không tự đóng), dừng
576
+ khi hover / focus. CSS `toast.css`; leaf.js `Leaf.toast`.
577
+ - `Dropdown` — chọn một giá trị, gom các dropdown của vnsc: `variant="radio"` (dropdown kèm radio ở
578
+ màn thị trường) và `variant="list"` (SubAccounts, chọn lệnh) với trigger `field` filled / outlined,
579
+ size md / sm, `readOnly`, `openOn="hover"`. Bàn phím theo WAI-ARIA select-only combobox. CSS
580
+ `dropdown.css`; leaf.js `data-leaf-dropdown` / `Leaf.dropdown`.
581
+ - `LanguageDropdown` — Tiếng Việt / English kèm cờ từ CDN Finhay (`.leaf-dropdown__flag`). Danh sách
582
+ ngôn ngữ nằm ở `LEAF_LANGUAGES`; thêm ngôn ngữ mới thì bổ sung trong Leaf.
583
+ - Docs: `/components/dropdown`, `/components/toast`.
584
+ - `Radio` / `RadioGroup` (Figma 1146:2081) và `Checkbox` (Figma 891:10191) — input native, đi
585
+ thẳng vào `FormData`. CSS: `radio.css`, `checkbox.css`.
586
+ - Họ Input (Figma 1146:2159), export chung từ `components/Input`:
587
+ - `Input` — field dynamic: bật/tắt từng slot label · icon · action · message; variant
588
+ field / inline, shape pill, `revealPassword`, `as="button"` làm trigger. CSS `input.css`.
589
+ - `InputOtp` — nhảy ô, dán cả mã, `mask`, `onComplete`. CSS `input-otp.css`; leaf.js
590
+ `data-leaf-input-otp` / `Leaf.inputOtp`.
591
+ - `InputStepper` — −/+ tone buy / sell, `step` / `min` / `max` / `precision`, format theo
592
+ `locale`. CSS `input-stepper.css`; leaf.js `data-leaf-input-stepper` / `Leaf.inputStepper`.
593
+ - `InputDate` — `Input` + popover `Calendar`, chốt khi bấm "Chọn". CSS `input-date.css` (cần
594
+ kèm `input.css` + `calendar.css` + `button.css`).
595
+ - `Calendar` — port từ vnsc, chọn ngày / giờ, dùng độc lập được. CSS `calendar.css` (footer
596
+ dùng `Button` → cần `button.css`).
597
+ - Docs: `/components/radio`, `/components/checkbox`, `/components/input` (đủ 4 dạng, React + HTML
598
+ tĩnh), `/components/calendar`.
599
+
600
+ ### 0.1.7
601
+
602
+ **Breaking**
603
+
604
+ - Đổi tên class nền `base-*` → `bg-*` (`bg-primary`, `bg-red`…). Token CSS vẫn là `--base-*`
605
+ (và `--button-base-*` không đổi).
606
+ - Component React/HTML tĩnh dùng class layout Leaf trên markup (`flex`, `w-full`…); CSS
607
+ component bỏ các thuộc tính đã có class tương đương.
608
+ - Hệ quả: `dist/<component>.css` **không còn tự đủ**. App import riêng từng component phải import
609
+ thêm `spacing.css` (Tabs `gap-m`, Slider `gap-s` / `gap-xs`) và `flex.css` · `sizing.css` ·
610
+ `overflow.css` · `position.css` · `text-layout.css` — hoặc dùng `classes.css` / `styles.css`.
611
+ Đừng trông vào class do app tự sinh — class nào app không tự dùng (vd. `gap-m`, `flex-auto`)
612
+ sẽ không có.
613
+ - HTML tĩnh viết theo markup cũ (chỉ có `leaf-*`) phải thêm class layout như markup mới (tab
614
+ **Code → HTML tĩnh** trên docs / `examples/static.html`).
615
+ - Radius: thang cũ `radius-0|xs|s|m|l|xl|2xl` (map sang spacing) đổi thành `radius-s|m|l|full`
616
+ (4 · 8 · 12px · 9999px). Class `radius-0` / `radius-xs` / `radius-xl` / `radius-2xl` bị xoá.
617
+
618
+ **Mới**
619
+
620
+ - Border width: token `--border-width-*` (s 0.5 · m 1 · l 1.5 · xl 2px) và class
621
+ `border-s|m|l|xl` (+ biến thể cạnh `top` / `right` / `bottom` / `left` / `inline` / `block`) —
622
+ set width + `border-style: solid`.
623
+ - Spacing: thêm bậc `2xs` (2px) — token `--spacing-2xs` và class `-2xs` cho mọi prefix
624
+ `p` / `m` / `gap`.
625
+
626
+ - Layout class: `flex.css`, `grid.css`, `sizing.css`,
627
+ `overflow.css`, `position.css`, `text-layout.css` — nằm `@layer components`. Không có
628
+ responsive / size cố định trong Leaf (app viết trong SCSS module). Docs tách trang:
629
+ `/styles/flex` · `/styles/grid` · `/styles/sizing` · `/styles/overflow` · `/styles/position`
630
+ · `/styles/text` (mỗi trang Overview · Usage · Tokens · Code).
631
+ - 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ó.
632
+
633
+ **Sửa lỗi**
634
+
635
+ - Rule `[hidden]` (component + class layout + `line-clamp-*`) set `display: none` vì display giờ
636
+ đến từ class — thiếu rule này sẽ không ẩn được (vd. backdrop Dialog đã đóng vẫn phủ màn hình).
637
+ - leaf.js: bubble Tooltip và spinner loading của Button do JS tạo thiếu class layout
638
+ (`relative block shrink-0` trên caret, `relative z-10 max-w-full text-left` trên body,
639
+ `inline-flex …` trên spinner) → caret lệch vị trí. Nay khớp markup React; có test parity.
640
+ - Test `classes.test.tsx`: mọi class (trừ `leaf-*`) trên markup React / leaf.js phải có trong CSS
641
+ của Leaf.
642
+
455
643
  ### 0.1.6
456
644
 
457
645
  - Dialog: thêm prop `height` (CSS `--leaf-dialog-height`) — chiều cao cố định cho content động /
458
646
  nhiều step để panel không giật, body cuộn bên trong; `maxHeight` vẫn là trần viewport.
459
647
 
460
- **Sửa lỗi** — hành vi không còn phụ thuộc preflight của Tailwind:
648
+ **Sửa lỗi** — hành vi không còn phụ thuộc CSS reset:
461
649
 
462
- - Button (vanilla): leading icon không ẩn khi `Leaf.button.setLoading` ở trang không có Tailwind
650
+ - Button (vanilla): leading icon không ẩn khi `Leaf.button.setLoading` ở trang không có CSS reset
463
651
  (`.leaf-button__icon { display }` thắng `[hidden]`). Thêm `[hidden] { display: none }` cho
464
652
  root của Button · Tabs · Toggle · Slider · Spinner · Logo · Tooltip trigger.
465
653
  - Mọi stylesheet trong `dist` mở đầu bằng `@layer theme, base, components, utilities;`: trước đây
466
- app không có Tailwind mà import `color.css` trước CSS component thì `text-*` không override được
654
+ app import `color.css` trước CSS component thì `text-*` không override được
467
655
  component (vd. `leaf-spinner text-highlight`).
468
656
  - `.leaf-button` / `.leaf-tab` thêm `appearance: none` như Toggle / Dialog.
469
657
  - Dialog: typography + màu của title (heading-3 · `--text-primary`) chuyển vào `dialog.css`;
@@ -479,7 +667,7 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
479
667
  ### 0.1.4
480
668
 
481
669
  - System color: thêm secondary (`--system-*-secondary` → primitive `*/800`) và class
482
- `text|base|border-*-secondary` (vd. `base-red-secondary`). Giữ nguyên giá trị ở dark và light.
670
+ `text|base|border-*-secondary` (vd. `bg-red-secondary`). Giữ nguyên giá trị ở dark và light.
483
671
 
484
672
  ### 0.1.3
485
673
 
@@ -532,8 +720,9 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
532
720
 
533
721
  - Button: width/height prop; size MD/SM khớp Figma gap/padding; token
534
722
  `--button-disabled-base|content` (alias `--button-*-disable`).
535
- - Spacing: token `--spacing-*` (0…7xl) + class `p-*` / `m-*` / `gap-*` (Figma 34:1034).
536
- - Border: token `--radius-*` (0…2xl) + class `radius-*` (Figma 700:4390).
723
+ - Spacing: token `--spacing-*` (0…7xl, gồm `2xs`) + class `p-*` / `m-*` / `gap-*` (Figma 34:1034).
724
+ - Border: token `--border-width-*` (s…xl) + class `border-s|m|l|xl` (+ biến thể cạnh); token
725
+ `--radius-*` (s|m|l|full) + class `radius-*`.
537
726
  - Dual-support HTML tĩnh: vanilla `Leaf.toggle` / `dialog` / `slider` / `tooltip` (`data-leaf-*`);
538
727
  Logo CSS data-URI theo `data-brand` / `data-mode` / `data-side`; docs `htmlSection` +
539
728
  `examples/static.html` cover đủ component.