@finhay-pro/leaf-design-system 0.1.6 → 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.
- package/README.md +175 -81
- package/dist/border.css +154 -17
- package/dist/button.css +2 -12
- package/dist/cdn/leaf-0.1.7.min.css +2 -0
- package/dist/cdn/leaf-0.1.7.min.js +2 -0
- package/dist/classes.css +1898 -268
- package/dist/color.css +27 -32
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Logo/Logo.d.ts.map +1 -1
- package/dist/components/Logo/Logo.js +2 -2
- package/dist/components/Logo/Logo.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Slider/Slider.js +2 -2
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +3 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/dialog.css +4 -36
- package/dist/flex.css +229 -0
- package/dist/grid.css +533 -0
- package/dist/logo.css +2 -7
- package/dist/overflow.css +72 -0
- package/dist/position.css +140 -0
- package/dist/sizing.css +377 -0
- package/dist/skeleton.css +0 -4
- package/dist/slider.css +3 -31
- package/dist/spacing.css +71 -4
- package/dist/spinner.css +2 -16
- package/dist/styles.css +1909 -276
- package/dist/tabs.css +2 -13
- package/dist/text-layout.css +219 -0
- package/dist/toggle.css +1 -9
- package/dist/tokens.css +11 -8
- package/dist/tooltip.css +2 -15
- package/dist/typography.css +1 -3
- package/package.json +7 -1
- package/dist/cdn/leaf-0.1.6.min.css +0 -2
- package/dist/cdn/leaf-0.1.6.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` |
|
|
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
|
-
|
|
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
|
|
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ữ, `
|
|
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` / `
|
|
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 | `
|
|
143
|
-
| Border color | `border-primary` … `border-quinary` (màu của thang base), `border-highlight`
|
|
144
|
-
| System (đủ 3 bộ) | `text-*`, `
|
|
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="
|
|
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,60 +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
|
-
|
|
193
|
-
|
|
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
|
-
|
|
|
196
|
-
|
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
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="
|
|
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
|
-
|
|
214
|
-
border
|
|
215
|
-
(`body { font-family: var(--font-sans) }`, CSS reset…)
|
|
216
|
-
- **Typography nằm trong `@layer components`**, nên
|
|
217
|
-
|
|
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.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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)]!`.
|
|
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)`).
|
|
236
275
|
- **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 /
|
|
238
|
-
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.
|
|
239
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ỹ
|
|
240
|
-
nếu load kèm CSS framework khác (Bootstrap cũng định nghĩa `.display-1`–`.display-6`).
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
`
|
|
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.
|
|
244
283
|
- Typography token hiện chỉ có **bộ Desktop**. Chưa có responsive type set, nên các style Display
|
|
245
284
|
cần app tự xử lý ở breakpoint nhỏ.
|
|
246
285
|
|
|
@@ -278,17 +317,17 @@ vào bản CDN, không vào bản npm.
|
|
|
278
317
|
|
|
279
318
|
## Components
|
|
280
319
|
|
|
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`
|
|
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` |
|
|
292
331
|
|
|
293
332
|
```css
|
|
294
333
|
/* Ngoài tokens.css + typography.css, mỗi component cần CSS riêng của nó */
|
|
@@ -344,8 +383,8 @@ dùng được toàn bộ class typography, color và mọi component (CSS). Scr
|
|
|
344
383
|
Tabs · Toggle · Dialog · Slider · Tooltip (`data-leaf-*`).
|
|
345
384
|
|
|
346
385
|
```html
|
|
347
|
-
<link rel="stylesheet" href="https://<cdn>/leaf-0.1.
|
|
348
|
-
<script src="https://<cdn>/leaf-0.1.
|
|
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>
|
|
349
388
|
```
|
|
350
389
|
|
|
351
390
|
| File | Nội dung |
|
|
@@ -370,8 +409,18 @@ Không cần JS. Thiếu attribute nào thì lấy mặc định giống prop Re
|
|
|
370
409
|
| `data-loading` | `true` — `Leaf.button.setLoading` / `run` gắn | — |
|
|
371
410
|
|
|
372
411
|
```html
|
|
373
|
-
<button
|
|
374
|
-
|
|
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>
|
|
375
424
|
```
|
|
376
425
|
|
|
377
426
|
Loading (cần `leaf.js`): `Leaf.button.run(el, promise)` bật loading tới khi promise settle,
|
|
@@ -446,24 +495,68 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
|
|
|
446
495
|
1. Bump `version` trong `packages/react/package.json`, ghi thay đổi vào [Changelog](#changelog).
|
|
447
496
|
2. `pnpm --filter @finhay-pro/leaf-design-system build` → `dist/cdn/leaf-<version>.min.css` + `.min.js`.
|
|
448
497
|
3. Đổi version trong `examples/static.html`, mở bằng `file://` để kiểm tra nhanh.
|
|
449
|
-
4.
|
|
450
|
-
|
|
451
|
-
5.
|
|
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).
|
|
452
502
|
|
|
453
503
|
## Changelog
|
|
454
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
|
+
|
|
455
548
|
### 0.1.6
|
|
456
549
|
|
|
457
550
|
- Dialog: thêm prop `height` (CSS `--leaf-dialog-height`) — chiều cao cố định cho content động /
|
|
458
551
|
nhiều step để panel không giật, body cuộn bên trong; `maxHeight` vẫn là trần viewport.
|
|
459
552
|
|
|
460
|
-
**Sửa lỗi** — hành vi không còn phụ thuộc
|
|
553
|
+
**Sửa lỗi** — hành vi không còn phụ thuộc CSS reset:
|
|
461
554
|
|
|
462
|
-
- Button (vanilla): leading icon không ẩn khi `Leaf.button.setLoading` ở trang không có
|
|
555
|
+
- Button (vanilla): leading icon không ẩn khi `Leaf.button.setLoading` ở trang không có CSS reset
|
|
463
556
|
(`.leaf-button__icon { display }` thắng `[hidden]`). Thêm `[hidden] { display: none }` cho
|
|
464
557
|
root của Button · Tabs · Toggle · Slider · Spinner · Logo · Tooltip trigger.
|
|
465
558
|
- Mọi stylesheet trong `dist` mở đầu bằng `@layer theme, base, components, utilities;`: trước đây
|
|
466
|
-
app
|
|
559
|
+
app import `color.css` trước CSS component thì `text-*` không override được
|
|
467
560
|
component (vd. `leaf-spinner text-highlight`).
|
|
468
561
|
- `.leaf-button` / `.leaf-tab` thêm `appearance: none` như Toggle / Dialog.
|
|
469
562
|
- Dialog: typography + màu của title (heading-3 · `--text-primary`) chuyển vào `dialog.css`;
|
|
@@ -479,7 +572,7 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
|
|
|
479
572
|
### 0.1.4
|
|
480
573
|
|
|
481
574
|
- System color: thêm secondary (`--system-*-secondary` → primitive `*/800`) và class
|
|
482
|
-
`text|base|border-*-secondary` (vd. `
|
|
575
|
+
`text|base|border-*-secondary` (vd. `bg-red-secondary`). Giữ nguyên giá trị ở dark và light.
|
|
483
576
|
|
|
484
577
|
### 0.1.3
|
|
485
578
|
|
|
@@ -532,8 +625,9 @@ Chỉ CSS. Skeleton: `--leaf-skeleton-width` / `height` / `radius`. Spinner: `da
|
|
|
532
625
|
|
|
533
626
|
- Button: width/height prop; size MD/SM khớp Figma gap/padding; token
|
|
534
627
|
`--button-disabled-base|content` (alias `--button-*-disable`).
|
|
535
|
-
- Spacing: token `--spacing-*` (0…7xl) + class `p-*` / `m-*` / `gap-*` (Figma 34:1034).
|
|
536
|
-
- Border: token `--
|
|
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-*`.
|
|
537
631
|
- Dual-support HTML tĩnh: vanilla `Leaf.toggle` / `dialog` / `slider` / `tooltip` (`data-leaf-*`);
|
|
538
632
|
Logo CSS data-URI theo `data-brand` / `data-mode` / `data-side`; docs `htmlSection` +
|
|
539
633
|
`examples/static.html` cover đủ component.
|
package/dist/border.css
CHANGED
|
@@ -4,24 +4,19 @@
|
|
|
4
4
|
/* --- src/styles/border.css --- */
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
|
-
* Border
|
|
8
|
-
* (Figma 700:4390).
|
|
7
|
+
* Border classes — map 1:1 sang token trong @finhay/leaf-tokens.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
* 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.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
@layer utilities {
|
|
18
|
-
|
|
19
|
-
border-radius: var(--radius-0);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.radius-xs {
|
|
23
|
-
border-radius: var(--radius-xs);
|
|
24
|
-
}
|
|
19
|
+
/* Radius */
|
|
25
20
|
|
|
26
21
|
.radius-s {
|
|
27
22
|
border-radius: var(--radius-s);
|
|
@@ -35,11 +30,153 @@
|
|
|
35
30
|
border-radius: var(--radius-l);
|
|
36
31
|
}
|
|
37
32
|
|
|
38
|
-
.radius-
|
|
39
|
-
border-radius: var(--radius-
|
|
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;
|
|
40
176
|
}
|
|
41
177
|
|
|
42
|
-
.
|
|
43
|
-
border-
|
|
178
|
+
.border-block-xl {
|
|
179
|
+
border-block-width: var(--border-width-xl);
|
|
180
|
+
border-block-style: solid;
|
|
44
181
|
}
|
|
45
182
|
}
|
package/dist/button.css
CHANGED
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
--leaf-button-bg: var(--button-base-primary);
|
|
37
37
|
--leaf-button-fg: var(--button-content-primary);
|
|
38
38
|
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
39
|
box-sizing: border-box;
|
|
43
40
|
width: var(--leaf-button-width, auto);
|
|
44
41
|
height: var(--leaf-button-height);
|
|
@@ -50,8 +47,6 @@
|
|
|
50
47
|
border-radius: 1000px;
|
|
51
48
|
background-color: var(--leaf-button-bg);
|
|
52
49
|
color: var(--leaf-button-fg);
|
|
53
|
-
text-align: center;
|
|
54
|
-
white-space: nowrap;
|
|
55
50
|
font: inherit;
|
|
56
51
|
font-family: var(--font-sans);
|
|
57
52
|
font-size: var(--leaf-button-font-size);
|
|
@@ -59,15 +54,10 @@
|
|
|
59
54
|
font-weight: var(--leaf-button-font-weight);
|
|
60
55
|
letter-spacing: var(--leaf-button-letter-spacing);
|
|
61
56
|
text-decoration: none;
|
|
62
|
-
vertical-align: middle;
|
|
63
57
|
appearance: none;
|
|
64
58
|
}
|
|
65
59
|
|
|
66
60
|
.leaf-button__icon {
|
|
67
|
-
display: inline-flex;
|
|
68
|
-
flex-shrink: 0;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
61
|
width: var(--leaf-button-icon-size);
|
|
72
62
|
height: var(--leaf-button-icon-size);
|
|
73
63
|
font-size: var(--leaf-button-icon-size);
|
|
@@ -81,8 +71,8 @@
|
|
|
81
71
|
}
|
|
82
72
|
|
|
83
73
|
/*
|
|
84
|
-
* `
|
|
85
|
-
*
|
|
74
|
+
* Layout (`inline-flex`…) lấy từ class Leaf trên markup. `[hidden]` vẫn cần rule riêng
|
|
75
|
+
* vì class layout cũng set display (selector `[hidden]` specificity cao hơn nên thắng).
|
|
86
76
|
*/
|
|
87
77
|
.leaf-button[hidden],
|
|
88
78
|
.leaf-button__icon[hidden] {
|