@finhay-pro/leaf-design-system 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +342 -0
- package/dist/button.css +174 -0
- package/dist/cdn/leaf-0.1.1.min.css +2 -0
- package/dist/cdn/leaf-0.1.1.min.js +2 -0
- package/dist/classes.css +681 -0
- package/dist/color.css +191 -0
- package/dist/components/Button/Button.d.ts +33 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +26 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +37 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +44 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +914 -0
- package/dist/tabs.css +189 -0
- package/dist/tokens.css +234 -0
- package/dist/typography.css +130 -0
- package/dist/utils/joinClass.d.ts +3 -0
- package/dist/utils/joinClass.d.ts.map +1 -0
- package/dist/utils/joinClass.js +5 -0
- package/dist/utils/joinClass.js.map +1 -0
- package/package.json +55 -0
package/dist/classes.css
ADDED
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
/* @finhay-pro/leaf-design-system — generated by scripts/build-css.mjs. Do not edit. */
|
|
2
|
+
|
|
3
|
+
/* --- src/components/Button/button.css --- */
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Button — Figma 246:1135.
|
|
7
|
+
*
|
|
8
|
+
* Variant màu qua data-priority / data-status; size qua data-size; icon-only
|
|
9
|
+
* qua data-icon-only. Disabled dùng attribute native `:disabled` (và
|
|
10
|
+
* `aria-disabled`) nên không cần class riêng.
|
|
11
|
+
*
|
|
12
|
+
* Toàn bộ hình thức (kể cả typography của label) nằm ở đây — React chỉ gắn
|
|
13
|
+
* attribute, nên HTML tĩnh viết cùng markup là ra cùng kết quả. Thiếu attribute
|
|
14
|
+
* nào thì lấy mặc định giống prop của React: lg · primary · normal.
|
|
15
|
+
*
|
|
16
|
+
* Variant chỉ đổi custom property `--leaf-button-*`; thuộc tính thật chỉ khai
|
|
17
|
+
* báo một lần ở `.leaf-button`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@layer components {
|
|
21
|
+
.leaf-button {
|
|
22
|
+
/* Mặc định: size lg */
|
|
23
|
+
--leaf-button-height: 56px;
|
|
24
|
+
--leaf-button-padding: 8px 24px;
|
|
25
|
+
--leaf-button-icon-only-padding: 8px;
|
|
26
|
+
--leaf-button-gap: 16px;
|
|
27
|
+
--leaf-button-icon-size: 30px;
|
|
28
|
+
--leaf-button-font-size: var(--body-1-size);
|
|
29
|
+
--leaf-button-line-height: var(--body-1-line-height);
|
|
30
|
+
--leaf-button-font-weight: var(--body-1-highlight-weight);
|
|
31
|
+
|
|
32
|
+
/* Mặc định: priority primary, status normal */
|
|
33
|
+
--leaf-button-bg: var(--button-base-primary);
|
|
34
|
+
--leaf-button-fg: var(--button-content-primary);
|
|
35
|
+
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
height: var(--leaf-button-height);
|
|
40
|
+
gap: var(--leaf-button-gap);
|
|
41
|
+
border: none;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: var(--leaf-button-padding);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
border-radius: 1000px;
|
|
46
|
+
background-color: var(--leaf-button-bg);
|
|
47
|
+
color: var(--leaf-button-fg);
|
|
48
|
+
text-align: center;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
font: inherit;
|
|
51
|
+
font-size: var(--leaf-button-font-size);
|
|
52
|
+
line-height: var(--leaf-button-line-height);
|
|
53
|
+
font-weight: var(--leaf-button-font-weight);
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.leaf-button__icon {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
width: var(--leaf-button-icon-size);
|
|
65
|
+
height: var(--leaf-button-icon-size);
|
|
66
|
+
font-size: var(--leaf-button-icon-size);
|
|
67
|
+
line-height: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.leaf-button__icon > svg {
|
|
71
|
+
display: block;
|
|
72
|
+
width: 1em;
|
|
73
|
+
height: 1em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* ── Size ────────────────────────────────────────────────────────────── */
|
|
77
|
+
|
|
78
|
+
.leaf-button[data-size="md"] {
|
|
79
|
+
--leaf-button-height: 40px;
|
|
80
|
+
--leaf-button-padding: 8px 16px;
|
|
81
|
+
--leaf-button-gap: 8px;
|
|
82
|
+
--leaf-button-icon-size: 24px;
|
|
83
|
+
--leaf-button-font-size: var(--body-3-size);
|
|
84
|
+
--leaf-button-line-height: var(--body-3-line-height);
|
|
85
|
+
--leaf-button-font-weight: var(--body-3-highlight-weight);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.leaf-button[data-size="sm"] {
|
|
89
|
+
--leaf-button-height: 28px;
|
|
90
|
+
--leaf-button-padding: 4px 8px;
|
|
91
|
+
--leaf-button-icon-only-padding: 4px;
|
|
92
|
+
--leaf-button-gap: 4px;
|
|
93
|
+
--leaf-button-icon-size: 20px;
|
|
94
|
+
--leaf-button-font-size: var(--body-4-size);
|
|
95
|
+
--leaf-button-line-height: var(--body-4-line-height);
|
|
96
|
+
--leaf-button-font-weight: var(--body-4-highlight-weight);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Icon-only: khung vuông (tròn nhờ border-radius) cạnh = height. */
|
|
100
|
+
.leaf-button[data-icon-only="true"] {
|
|
101
|
+
width: var(--leaf-button-height);
|
|
102
|
+
padding: var(--leaf-button-icon-only-padding);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Ghost không có khung — bỏ height/padding cố định. Đứng sau size để thắng. */
|
|
106
|
+
.leaf-button[data-priority="ghost"] {
|
|
107
|
+
--leaf-button-height: auto;
|
|
108
|
+
--leaf-button-padding: 0;
|
|
109
|
+
--leaf-button-icon-only-padding: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.leaf-button[data-priority="ghost"][data-icon-only="true"] {
|
|
113
|
+
border-radius: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ── Priority × status ───────────────────────────────────────────────── */
|
|
117
|
+
|
|
118
|
+
/* Không có data-priority = primary. */
|
|
119
|
+
.leaf-button[data-status="destruction"] {
|
|
120
|
+
--leaf-button-bg: var(--button-base-destruction);
|
|
121
|
+
--leaf-button-fg: var(--button-content-primary);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.leaf-button[data-priority="secondary"] {
|
|
125
|
+
--leaf-button-bg: var(--button-base-secondary);
|
|
126
|
+
--leaf-button-fg: var(--button-content-secondary);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.leaf-button[data-priority="secondary"][data-status="destruction"] {
|
|
130
|
+
--leaf-button-bg: var(--button-base-secondary-destruction);
|
|
131
|
+
--leaf-button-fg: var(--button-content-destruction);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.leaf-button[data-priority="tertiary"] {
|
|
135
|
+
--leaf-button-bg: var(--button-base-tertiary);
|
|
136
|
+
--leaf-button-fg: var(--button-content-secondary);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.leaf-button[data-priority="tertiary"][data-status="destruction"] {
|
|
140
|
+
--leaf-button-bg: var(--button-base-tertiary);
|
|
141
|
+
--leaf-button-fg: var(--button-content-destruction);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.leaf-button[data-priority="ghost"] {
|
|
145
|
+
--leaf-button-bg: transparent;
|
|
146
|
+
--leaf-button-fg: var(--button-content-secondary);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.leaf-button[data-priority="ghost"][data-status="destruction"] {
|
|
150
|
+
--leaf-button-bg: transparent;
|
|
151
|
+
--leaf-button-fg: var(--button-content-destruction);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* Disabled — Primary / Ghost có trong Figma; Secondary/Tertiary dùng cùng token.
|
|
156
|
+
* Specificity (0,3,0) và đứng cuối để thắng mọi tổ hợp priority × status.
|
|
157
|
+
*/
|
|
158
|
+
.leaf-button:disabled:not([data-priority="ghost"]),
|
|
159
|
+
.leaf-button[aria-disabled="true"]:not([data-priority="ghost"]) {
|
|
160
|
+
--leaf-button-bg: var(--button-base-disable);
|
|
161
|
+
--leaf-button-fg: var(--button-content-disable);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.leaf-button[data-priority="ghost"]:disabled,
|
|
165
|
+
.leaf-button[data-priority="ghost"][aria-disabled="true"] {
|
|
166
|
+
--leaf-button-bg: transparent;
|
|
167
|
+
--leaf-button-fg: var(--button-content-disable);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.leaf-button:disabled,
|
|
171
|
+
.leaf-button[aria-disabled="true"] {
|
|
172
|
+
cursor: not-allowed;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* --- src/components/Tabs/tabs.css --- */
|
|
177
|
+
|
|
178
|
+
/*
|
|
179
|
+
* Tabs — Figma 712:6996 (Tabs Items).
|
|
180
|
+
*
|
|
181
|
+
* `variant` map type trong Figma: subcontent | title | functional | buy | sell.
|
|
182
|
+
* Size: xl | lg | md | sm (tuỳ variant — Title chỉ S, Functional chỉ M, Buy/Sell chỉ L).
|
|
183
|
+
*
|
|
184
|
+
* Variant / size đặt trên tablist (`.leaf-tabs[data-variant][data-size]`), từng
|
|
185
|
+
* `.leaf-tab` chỉ cần `aria-selected`. Toàn bộ hình thức (kể cả typography của
|
|
186
|
+
* label) nằm ở đây — React và `leaf.js` chỉ gắn attribute, nên HTML tĩnh viết
|
|
187
|
+
* cùng markup là ra cùng kết quả.
|
|
188
|
+
*
|
|
189
|
+
* Mặc định khi thiếu attribute: variant subcontent, size xl. Chỉ Subcontent đổi
|
|
190
|
+
* theo size; các variant khác có một size duy nhất nên không đọc `data-size`.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
@layer components {
|
|
194
|
+
.leaf-tabs {
|
|
195
|
+
/* Kích thước của Subcontent — mặc định xl, đổi theo data-size bên dưới. */
|
|
196
|
+
--leaf-tab-padding: 12px 16px;
|
|
197
|
+
--leaf-tab-gap: 8px;
|
|
198
|
+
--leaf-tab-font-size: var(--body-3-size);
|
|
199
|
+
--leaf-tab-line-height: var(--body-3-line-height);
|
|
200
|
+
--leaf-tab-font-weight: var(--body-3-highlight-weight);
|
|
201
|
+
|
|
202
|
+
display: flex;
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
align-items: center;
|
|
205
|
+
gap: 12px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.leaf-tabs[data-size="lg"] {
|
|
209
|
+
--leaf-tab-padding: 8px 16px;
|
|
210
|
+
--leaf-tab-gap: 8px;
|
|
211
|
+
--leaf-tab-font-size: var(--body-4-size);
|
|
212
|
+
--leaf-tab-line-height: var(--body-4-line-height);
|
|
213
|
+
--leaf-tab-font-weight: var(--body-4-highlight-weight);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.leaf-tabs[data-size="md"] {
|
|
217
|
+
--leaf-tab-padding: 4px 12px;
|
|
218
|
+
--leaf-tab-gap: normal;
|
|
219
|
+
--leaf-tab-font-size: var(--body-4-size);
|
|
220
|
+
--leaf-tab-line-height: var(--body-4-line-height);
|
|
221
|
+
--leaf-tab-font-weight: var(--body-4-weight);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.leaf-tabs[data-size="sm"] {
|
|
225
|
+
--leaf-tab-padding: 4px 12px;
|
|
226
|
+
--leaf-tab-gap: normal;
|
|
227
|
+
--leaf-tab-font-size: var(--body-5-size);
|
|
228
|
+
--leaf-tab-line-height: var(--body-5-line-height);
|
|
229
|
+
--leaf-tab-font-weight: var(--body-5-weight);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.leaf-tab {
|
|
233
|
+
display: inline-flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
border: none;
|
|
237
|
+
margin: 0;
|
|
238
|
+
padding: 0;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
background-color: transparent;
|
|
241
|
+
color: inherit;
|
|
242
|
+
font: inherit;
|
|
243
|
+
text-align: center;
|
|
244
|
+
white-space: nowrap;
|
|
245
|
+
box-sizing: border-box;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.leaf-tab:disabled,
|
|
249
|
+
.leaf-tab[aria-disabled="true"] {
|
|
250
|
+
cursor: not-allowed;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* ── Subcontent (pill) — cũng là mặc định khi không có data-variant ──── */
|
|
254
|
+
|
|
255
|
+
.leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]) .leaf-tab {
|
|
256
|
+
gap: var(--leaf-tab-gap);
|
|
257
|
+
padding: var(--leaf-tab-padding);
|
|
258
|
+
border-radius: 1000px;
|
|
259
|
+
background-color: var(--base-tertiary);
|
|
260
|
+
color: var(--text-secondary);
|
|
261
|
+
font-size: var(--leaf-tab-font-size);
|
|
262
|
+
line-height: var(--leaf-tab-line-height);
|
|
263
|
+
font-weight: var(--leaf-tab-font-weight);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"])
|
|
267
|
+
.leaf-tab[aria-selected="true"] {
|
|
268
|
+
background-color: var(--base-quinary);
|
|
269
|
+
color: var(--text-quaternary);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* ── Title (underline) ───────────────────────────────────────────────── */
|
|
273
|
+
|
|
274
|
+
.leaf-tabs[data-variant="title"] .leaf-tab {
|
|
275
|
+
flex-direction: column;
|
|
276
|
+
gap: 4px;
|
|
277
|
+
min-width: 100px;
|
|
278
|
+
color: var(--text-secondary);
|
|
279
|
+
font-size: var(--body-4-size);
|
|
280
|
+
line-height: var(--body-4-line-height);
|
|
281
|
+
font-weight: var(--body-4-weight);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.leaf-tabs[data-variant="title"] .leaf-tab[aria-selected="true"] {
|
|
285
|
+
color: var(--text-primary);
|
|
286
|
+
font-weight: var(--body-4-highlight-weight);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.leaf-tabs[data-variant="title"] .leaf-tab::after {
|
|
290
|
+
content: "";
|
|
291
|
+
display: block;
|
|
292
|
+
width: 100%;
|
|
293
|
+
height: 2px;
|
|
294
|
+
background-color: var(--text-primary);
|
|
295
|
+
opacity: 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.leaf-tabs[data-variant="title"] .leaf-tab[aria-selected="true"]::after {
|
|
299
|
+
opacity: 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* ── Functional ──────────────────────────────────────────────────────── */
|
|
303
|
+
|
|
304
|
+
.leaf-tabs[data-variant="functional"] .leaf-tab {
|
|
305
|
+
height: 24px;
|
|
306
|
+
min-width: 100px;
|
|
307
|
+
padding: 4px 24px;
|
|
308
|
+
border-radius: 100px;
|
|
309
|
+
background-color: var(--base-tertiary);
|
|
310
|
+
color: var(--button-content-disable);
|
|
311
|
+
font-size: var(--body-5-size);
|
|
312
|
+
line-height: var(--body-5-line-height);
|
|
313
|
+
font-weight: var(--body-5-weight);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.leaf-tabs[data-variant="functional"] .leaf-tab[aria-selected="true"] {
|
|
317
|
+
background-color: var(--button-base-primary);
|
|
318
|
+
color: var(--button-content-primary);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* ── Buy / Sell ──────────────────────────────────────────────────────── */
|
|
322
|
+
|
|
323
|
+
.leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab {
|
|
324
|
+
min-width: 100px;
|
|
325
|
+
width: auto;
|
|
326
|
+
gap: 4px;
|
|
327
|
+
padding: 6px 4px;
|
|
328
|
+
border-radius: 100px;
|
|
329
|
+
color: var(--text-primary);
|
|
330
|
+
font-size: var(--body-5-size);
|
|
331
|
+
line-height: var(--body-5-line-height);
|
|
332
|
+
font-weight: var(--body-5-weight);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab[aria-selected="true"] {
|
|
336
|
+
font-weight: var(--body-5-highlight-weight);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.leaf-tabs[data-variant="buy"] .leaf-tab[aria-selected="true"] {
|
|
340
|
+
background-color: var(--button-base-secondary);
|
|
341
|
+
color: var(--text-highlight);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.leaf-tabs[data-variant="sell"] .leaf-tab[aria-selected="true"] {
|
|
345
|
+
background-color: var(--button-base-secondary-destruction);
|
|
346
|
+
color: var(--button-content-destruction);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.leaf-tab__label,
|
|
350
|
+
.leaf-tab__addon {
|
|
351
|
+
display: inline-flex;
|
|
352
|
+
align-items: center;
|
|
353
|
+
justify-content: center;
|
|
354
|
+
line-height: inherit;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.leaf-tab__addon > svg {
|
|
358
|
+
display: block;
|
|
359
|
+
width: 1em;
|
|
360
|
+
height: 1em;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/* --- src/styles/color.css --- */
|
|
365
|
+
|
|
366
|
+
/*
|
|
367
|
+
* Color classes — map 1:1 sang semantic token trong @finhay/leaf-tokens.
|
|
368
|
+
*
|
|
369
|
+
* Quy tắc tên: **tiền tố nói thuộc tính, phần sau nói vai trò của token**.
|
|
370
|
+
*
|
|
371
|
+
* text-* → color (text-primary, text-red)
|
|
372
|
+
* base-* → background-color (base-primary, base-red)
|
|
373
|
+
* border-* → border-color (border-primary, border-red)
|
|
374
|
+
*
|
|
375
|
+
* Ba bộ dùng chung một hậu tố nên đọc là đoán được: `text-red` / `base-red` /
|
|
376
|
+
* `border-red`, `text-primary` / `base-primary` / `border-primary`. Nhóm system
|
|
377
|
+
* bỏ chữ `system` trong tên class (token vẫn là `--system-red`), còn `border-*`
|
|
378
|
+
* lấy màu từ thang base vì viền luôn là màu bề mặt.
|
|
379
|
+
*
|
|
380
|
+
* Mỗi class chỉ set đúng 1 thuộc tính (color / background-color / border-color)
|
|
381
|
+
* — border-width và border-style do app tự lo. Class tự đổi giá trị theo
|
|
382
|
+
* `[data-theme="light"]` vì nó trỏ vào var, không hard-code màu.
|
|
383
|
+
*
|
|
384
|
+
* Chỉ semantic token mới có class. Primitive (--neutral-500, --brand-300…) là
|
|
385
|
+
* nguồn nội bộ, không dùng thẳng trong UI.
|
|
386
|
+
*
|
|
387
|
+
* ─ Vì sao `@layer utilities` ─────────────────────────────────────────────────
|
|
388
|
+
*
|
|
389
|
+
* Màu của Leaf là token gốc, trùng tên thì phải thắng. Đặt chung layer với
|
|
390
|
+
* utility của Tailwind, và app import file này SAU `@import "tailwindcss"`, nên
|
|
391
|
+
* khi app cũng khai báo `--color-primary` / `--color-red` trong `@theme` thì
|
|
392
|
+
* `.text-primary` của Leaf (cùng specificity, đứng sau) là cái có hiệu lực.
|
|
393
|
+
*
|
|
394
|
+
* Biến thể trạng thái vẫn override được vì pseudo-class cộng thêm specificity:
|
|
395
|
+
* `hover:text-[var(--text-highlight)]`, `focus:…` thắng bình thường. Riêng biến
|
|
396
|
+
* thể responsive (`md:`, `lg:`) cùng specificity và được Tailwind ghi ra trước
|
|
397
|
+
* file này nên phải thêm important modifier: `md:text-[var(--text-secondary)]!`.
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
@layer utilities {
|
|
401
|
+
/* Text color — content */
|
|
402
|
+
|
|
403
|
+
.text-highlight {
|
|
404
|
+
color: var(--text-highlight);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.text-primary {
|
|
408
|
+
color: var(--text-primary);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.text-secondary {
|
|
412
|
+
color: var(--text-secondary);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.text-tertiary {
|
|
416
|
+
color: var(--text-tertiary);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.text-quaternary {
|
|
420
|
+
color: var(--text-quaternary);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* Text color — system */
|
|
424
|
+
|
|
425
|
+
.text-blue {
|
|
426
|
+
color: var(--system-blue);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.text-green {
|
|
430
|
+
color: var(--system-green);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.text-yellow {
|
|
434
|
+
color: var(--system-yellow);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.text-orange {
|
|
438
|
+
color: var(--system-orange);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.text-red {
|
|
442
|
+
color: var(--system-red);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.text-purple {
|
|
446
|
+
color: var(--system-purple);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* Background — base */
|
|
450
|
+
|
|
451
|
+
.base-highlight {
|
|
452
|
+
background-color: var(--text-highlight);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.base-primary {
|
|
456
|
+
background-color: var(--base-primary);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.base-secondary {
|
|
460
|
+
background-color: var(--base-secondary);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.base-tertiary {
|
|
464
|
+
background-color: var(--base-tertiary);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.base-quaternary {
|
|
468
|
+
background-color: var(--base-quaternary);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.base-quinary {
|
|
472
|
+
background-color: var(--base-quinary);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/* Background — system */
|
|
476
|
+
|
|
477
|
+
.base-blue {
|
|
478
|
+
background-color: var(--system-blue);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.base-green {
|
|
482
|
+
background-color: var(--system-green);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.base-yellow {
|
|
486
|
+
background-color: var(--system-yellow);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.base-orange {
|
|
490
|
+
background-color: var(--system-orange);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.base-red {
|
|
494
|
+
background-color: var(--system-red);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.base-purple {
|
|
498
|
+
background-color: var(--system-purple);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/* Border color — base */
|
|
502
|
+
|
|
503
|
+
.border-highlight {
|
|
504
|
+
border-color: var(--text-highlight);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.border-primary {
|
|
508
|
+
border-color: var(--base-primary);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.border-secondary {
|
|
512
|
+
border-color: var(--base-secondary);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.border-tertiary {
|
|
516
|
+
border-color: var(--base-tertiary);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.border-quaternary {
|
|
520
|
+
border-color: var(--base-quaternary);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.border-quinary {
|
|
524
|
+
border-color: var(--base-quinary);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/* Border color — system */
|
|
528
|
+
|
|
529
|
+
.border-blue {
|
|
530
|
+
border-color: var(--system-blue);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.border-green {
|
|
534
|
+
border-color: var(--system-green);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.border-yellow {
|
|
538
|
+
border-color: var(--system-yellow);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.border-orange {
|
|
542
|
+
border-color: var(--system-orange);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.border-red {
|
|
546
|
+
border-color: var(--system-red);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.border-purple {
|
|
550
|
+
border-color: var(--system-purple);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/* --- src/styles/typography.css --- */
|
|
555
|
+
|
|
556
|
+
/*
|
|
557
|
+
* Typography classes — map 1:1 sang token trong @finhay/leaf-tokens.
|
|
558
|
+
*
|
|
559
|
+
* Tên class trùng đúng tên token trong Figma, không có prefix: đọc DOM là biết
|
|
560
|
+
* ngay style đang dùng, và không cần import gì trong JS để dùng được.
|
|
561
|
+
*
|
|
562
|
+
* Mỗi class chỉ set đúng 3 thuộc tính: font-size, line-height, font-weight.
|
|
563
|
+
* Font family, letter spacing, margin, màu chữ… không thuộc phạm vi của
|
|
564
|
+
* stylesheet này — app tự setup ở tầng global nếu cần.
|
|
565
|
+
*
|
|
566
|
+
* Toàn bộ nằm trong `@layer components` để utility của Tailwind (`@layer
|
|
567
|
+
* utilities`) luôn thắng: `class="heading-1 font-bold"` hay `class="body-3
|
|
568
|
+
* text-2xl"` đều override được mà không cần important modifier.
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
@layer components {
|
|
572
|
+
/* Display */
|
|
573
|
+
|
|
574
|
+
.display-1 {
|
|
575
|
+
font-size: var(--display-1-size);
|
|
576
|
+
line-height: var(--display-1-line-height);
|
|
577
|
+
font-weight: var(--display-1-weight);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.display-2 {
|
|
581
|
+
font-size: var(--display-2-size);
|
|
582
|
+
line-height: var(--display-2-line-height);
|
|
583
|
+
font-weight: var(--display-2-weight);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.display-3 {
|
|
587
|
+
font-size: var(--display-3-size);
|
|
588
|
+
line-height: var(--display-3-line-height);
|
|
589
|
+
font-weight: var(--display-3-weight);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/* Heading */
|
|
593
|
+
|
|
594
|
+
.heading-1 {
|
|
595
|
+
font-size: var(--heading-1-size);
|
|
596
|
+
line-height: var(--heading-1-line-height);
|
|
597
|
+
font-weight: var(--heading-1-weight);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.heading-2 {
|
|
601
|
+
font-size: var(--heading-2-size);
|
|
602
|
+
line-height: var(--heading-2-line-height);
|
|
603
|
+
font-weight: var(--heading-2-weight);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.heading-3 {
|
|
607
|
+
font-size: var(--heading-3-size);
|
|
608
|
+
line-height: var(--heading-3-line-height);
|
|
609
|
+
font-weight: var(--heading-3-weight);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/* Body 1 */
|
|
613
|
+
|
|
614
|
+
.body-1 {
|
|
615
|
+
font-size: var(--body-1-size);
|
|
616
|
+
line-height: var(--body-1-line-height);
|
|
617
|
+
font-weight: var(--body-1-weight);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.body-1-highlight {
|
|
621
|
+
font-size: var(--body-1-size);
|
|
622
|
+
line-height: var(--body-1-line-height);
|
|
623
|
+
font-weight: var(--body-1-highlight-weight);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/* Body 2 */
|
|
627
|
+
|
|
628
|
+
.body-2 {
|
|
629
|
+
font-size: var(--body-2-size);
|
|
630
|
+
line-height: var(--body-2-line-height);
|
|
631
|
+
font-weight: var(--body-2-weight);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.body-2-highlight {
|
|
635
|
+
font-size: var(--body-2-size);
|
|
636
|
+
line-height: var(--body-2-line-height);
|
|
637
|
+
font-weight: var(--body-2-highlight-weight);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/* Body 3 */
|
|
641
|
+
|
|
642
|
+
.body-3 {
|
|
643
|
+
font-size: var(--body-3-size);
|
|
644
|
+
line-height: var(--body-3-line-height);
|
|
645
|
+
font-weight: var(--body-3-weight);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.body-3-highlight {
|
|
649
|
+
font-size: var(--body-3-size);
|
|
650
|
+
line-height: var(--body-3-line-height);
|
|
651
|
+
font-weight: var(--body-3-highlight-weight);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/* Body 4 */
|
|
655
|
+
|
|
656
|
+
.body-4 {
|
|
657
|
+
font-size: var(--body-4-size);
|
|
658
|
+
line-height: var(--body-4-line-height);
|
|
659
|
+
font-weight: var(--body-4-weight);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.body-4-highlight {
|
|
663
|
+
font-size: var(--body-4-size);
|
|
664
|
+
line-height: var(--body-4-line-height);
|
|
665
|
+
font-weight: var(--body-4-highlight-weight);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/* Body 5 */
|
|
669
|
+
|
|
670
|
+
.body-5 {
|
|
671
|
+
font-size: var(--body-5-size);
|
|
672
|
+
line-height: var(--body-5-line-height);
|
|
673
|
+
font-weight: var(--body-5-weight);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.body-5-highlight {
|
|
677
|
+
font-size: var(--body-5-size);
|
|
678
|
+
line-height: var(--body-5-line-height);
|
|
679
|
+
font-weight: var(--body-5-highlight-weight);
|
|
680
|
+
}
|
|
681
|
+
}
|