@finhay-pro/leaf-design-system 0.2.2 → 0.2.3

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 (133) hide show
  1. package/README.md +217 -205
  2. package/dist/cdn/leaf-0.2.3.min.css +8 -0
  3. package/dist/cdn/leaf-0.2.3.min.js +204 -0
  4. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  5. package/dist/components/Carousel/Carousel.js +3 -1
  6. package/dist/components/Carousel/Carousel.js.map +1 -1
  7. package/dist/components/Empty/Empty.d.ts.map +1 -1
  8. package/dist/components/Empty/Empty.js.map +1 -1
  9. package/dist/components/Form/adapters.d.ts.map +1 -1
  10. package/dist/components/Form/adapters.js +1 -1
  11. package/dist/components/Form/adapters.js.map +1 -1
  12. package/dist/components/QrCode/QrCode.d.ts.map +1 -1
  13. package/dist/components/QrCode/QrCode.js.map +1 -1
  14. package/dist/components/Table/Table.d.ts +59 -0
  15. package/dist/components/Table/Table.d.ts.map +1 -0
  16. package/dist/components/Table/Table.js +274 -0
  17. package/dist/components/Table/Table.js.map +1 -0
  18. package/dist/components/Table/TableHeader.d.ts +19 -0
  19. package/dist/components/Table/TableHeader.d.ts.map +1 -0
  20. package/dist/components/Table/TableHeader.js +16 -0
  21. package/dist/components/Table/TableHeader.js.map +1 -0
  22. package/dist/components/Table/TableRow.d.ts +27 -0
  23. package/dist/components/Table/TableRow.d.ts.map +1 -0
  24. package/dist/components/Table/TableRow.js +30 -0
  25. package/dist/components/Table/TableRow.js.map +1 -0
  26. package/dist/components/Table/dom.d.ts +9 -0
  27. package/dist/components/Table/dom.d.ts.map +1 -0
  28. package/dist/components/Table/dom.js +17 -0
  29. package/dist/components/Table/dom.js.map +1 -0
  30. package/dist/components/Table/index.d.ts +2 -0
  31. package/dist/components/Table/index.d.ts.map +1 -0
  32. package/dist/components/Table/index.js +2 -0
  33. package/dist/components/Table/index.js.map +1 -0
  34. package/dist/core/carousel.d.ts.map +1 -1
  35. package/dist/core/carousel.js +4 -3
  36. package/dist/core/carousel.js.map +1 -1
  37. package/dist/core/icons.d.ts +2 -0
  38. package/dist/core/icons.d.ts.map +1 -1
  39. package/dist/core/icons.js +2 -0
  40. package/dist/core/icons.js.map +1 -1
  41. package/dist/core/qr-code.d.ts.map +1 -1
  42. package/dist/core/qr-code.js.map +1 -1
  43. package/dist/core/table/attrs.d.ts +65 -0
  44. package/dist/core/table/attrs.d.ts.map +1 -0
  45. package/dist/core/table/attrs.js +202 -0
  46. package/dist/core/table/attrs.js.map +1 -0
  47. package/dist/core/table/columns.d.ts +156 -0
  48. package/dist/core/table/columns.d.ts.map +1 -0
  49. package/dist/core/table/columns.js +147 -0
  50. package/dist/core/table/columns.js.map +1 -0
  51. package/dist/core/table/flash.d.ts +26 -0
  52. package/dist/core/table/flash.d.ts.map +1 -0
  53. package/dist/core/table/flash.js +84 -0
  54. package/dist/core/table/flash.js.map +1 -0
  55. package/dist/core/table/index.d.ts +10 -0
  56. package/dist/core/table/index.d.ts.map +1 -0
  57. package/dist/core/table/index.js +10 -0
  58. package/dist/core/table/index.js.map +1 -0
  59. package/dist/core/table/measure.d.ts +23 -0
  60. package/dist/core/table/measure.d.ts.map +1 -0
  61. package/dist/core/table/measure.js +54 -0
  62. package/dist/core/table/measure.js.map +1 -0
  63. package/dist/core/table/resize.d.ts +13 -0
  64. package/dist/core/table/resize.d.ts.map +1 -0
  65. package/dist/core/table/resize.js +34 -0
  66. package/dist/core/table/resize.js.map +1 -0
  67. package/dist/core/table/sort.d.ts +23 -0
  68. package/dist/core/table/sort.d.ts.map +1 -0
  69. package/dist/core/table/sort.js +71 -0
  70. package/dist/core/table/sort.js.map +1 -0
  71. package/dist/core/table/span.d.ts +31 -0
  72. package/dist/core/table/span.d.ts.map +1 -0
  73. package/dist/core/table/span.js +84 -0
  74. package/dist/core/table/span.js.map +1 -0
  75. package/dist/core/table/virtual.d.ts +29 -0
  76. package/dist/core/table/virtual.d.ts.map +1 -0
  77. package/dist/core/table/virtual.js +24 -0
  78. package/dist/core/table/virtual.js.map +1 -0
  79. package/dist/engine/assets.json +1 -0
  80. package/dist/engine/chunk-X2H56OKG.js +4854 -0
  81. package/dist/engine/cli.js +8 -0
  82. package/dist/engine/postcss.d.ts +3 -0
  83. package/dist/engine/postcss.js +7 -0
  84. package/dist/engine/vite.d.ts +3 -0
  85. package/dist/engine/vite.js +7 -0
  86. package/dist/index.d.ts +1 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +1 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/{styles.css → leaf.css} +436 -10
  91. package/dist/skill/leaf-design-system-0.2.3.zip +0 -0
  92. package/dist/utils/colorClass.d.ts +2 -0
  93. package/dist/utils/colorClass.d.ts.map +1 -1
  94. package/dist/utils/colorClass.js +14 -0
  95. package/dist/utils/colorClass.js.map +1 -1
  96. package/package.json +18 -40
  97. package/dist/button.css +0 -221
  98. package/dist/calendar.css +0 -337
  99. package/dist/carousel.css +0 -144
  100. package/dist/cdn/leaf-0.2.2.min.css +0 -2
  101. package/dist/cdn/leaf-0.2.2.min.js +0 -165
  102. package/dist/checkbox.css +0 -132
  103. package/dist/classes.css +0 -5031
  104. package/dist/color.css +0 -260
  105. package/dist/date.css +0 -19
  106. package/dist/dialog.css +0 -176
  107. package/dist/dropdown.css +0 -420
  108. package/dist/empty.css +0 -74
  109. package/dist/file-viewer.css +0 -502
  110. package/dist/focus.css +0 -18
  111. package/dist/form.css +0 -64
  112. package/dist/input-date.css +0 -49
  113. package/dist/input-otp.css +0 -76
  114. package/dist/input-stepper.css +0 -179
  115. package/dist/input.css +0 -218
  116. package/dist/logo-assets.css +0 -81
  117. package/dist/logo.css +0 -52
  118. package/dist/multiselect.css +0 -147
  119. package/dist/number.css +0 -53
  120. package/dist/qr-code.css +0 -21
  121. package/dist/radio.css +0 -124
  122. package/dist/skeleton.css +0 -57
  123. package/dist/skill/leaf-design-system-0.2.2.zip +0 -0
  124. package/dist/slider.css +0 -303
  125. package/dist/spinner.css +0 -125
  126. package/dist/tabs.css +0 -260
  127. package/dist/textarea.css +0 -28
  128. package/dist/toast.css +0 -236
  129. package/dist/toggle.css +0 -116
  130. package/dist/tokens.css +0 -264
  131. package/dist/tooltip.css +0 -213
  132. package/dist/typography.css +0 -150
  133. package/dist/upload.css +0 -317
package/dist/classes.css DELETED
@@ -1,5031 +0,0 @@
1
- /* @finhay-pro/leaf-design-system — generated by scripts/build-css.mjs. Do not edit. */
2
- @layer theme, base, components, utilities;
3
-
4
- /* --- src/components/Button/button.css --- */
5
-
6
- /*
7
- * Button — Figma 246:1135.
8
- *
9
- * Variant màu qua data-priority / data-status; size qua data-size; icon-only
10
- * qua data-icon-only. Disabled dùng attribute native `:disabled` (và
11
- * `aria-disabled`) nên không cần class riêng.
12
- *
13
- * Width / height override qua --leaf-button-width / --leaf-button-height
14
- * (React gắn bằng prop; HTML tĩnh set style hoặc để mặc định theo size).
15
- *
16
- * Toàn bộ hình thức (kể cả typography của label) nằm ở đây — React chỉ gắn
17
- * attribute, nên HTML tĩnh viết cùng markup là ra cùng kết quả. Thiếu attribute
18
- * nào thì lấy mặc định giống prop của React: lg · primary · normal.
19
- */
20
-
21
- @layer components {
22
- .leaf-button {
23
- /* Mặc định: size lg — Figma Large: h 56 · px XL · py S · gap L · icon 30 */
24
- /* --leaf-button-width chỉ set khi prop width; không set → auto / icon-only = height */
25
- --leaf-button-height: 56px;
26
- --leaf-button-padding: 8px 24px;
27
- --leaf-button-icon-only-padding: 8px;
28
- --leaf-button-gap: 16px;
29
- --leaf-button-icon-size: 30px;
30
- --leaf-button-font-size: var(--body-1-size);
31
- --leaf-button-line-height: var(--body-1-line-height);
32
- --leaf-button-font-weight: var(--body-1-highlight-weight);
33
- --leaf-button-letter-spacing: 0.5px;
34
-
35
- /* Mặc định: priority primary, status normal */
36
- --leaf-button-bg: var(--button-base-primary);
37
- --leaf-button-fg: var(--button-content-primary);
38
-
39
- display: inline-flex;
40
- align-items: center;
41
- justify-content: center;
42
- box-sizing: border-box;
43
- width: var(--leaf-button-width, auto);
44
- height: var(--leaf-button-height);
45
- gap: var(--leaf-button-gap);
46
- border: none;
47
- margin: 0;
48
- padding: var(--leaf-button-padding);
49
- cursor: pointer;
50
- border-radius: 1000px;
51
- background-color: var(--leaf-button-bg);
52
- color: var(--leaf-button-fg);
53
- font: inherit;
54
- font-family: var(--font-sans);
55
- font-size: var(--leaf-button-font-size);
56
- line-height: var(--leaf-button-line-height);
57
- font-weight: var(--leaf-button-font-weight);
58
- letter-spacing: var(--leaf-button-letter-spacing);
59
- text-align: center;
60
- white-space: nowrap;
61
- vertical-align: middle;
62
- text-decoration: none;
63
- appearance: none;
64
- outline: none;
65
- }
66
-
67
- /* Chỉ báo focus bàn phím (WCAG 2.4.7) — :focus-visible nên click chuột không hiện ring. */
68
- .leaf-button:focus-visible {
69
- outline: 2px solid var(--text-highlight);
70
- outline-offset: 2px;
71
- }
72
-
73
- .leaf-button__icon {
74
- display: inline-flex;
75
- flex-shrink: 0;
76
- align-items: center;
77
- justify-content: center;
78
- width: var(--leaf-button-icon-size);
79
- height: var(--leaf-button-icon-size);
80
- font-size: var(--leaf-button-icon-size);
81
- line-height: 1;
82
- }
83
-
84
- .leaf-button__icon > svg {
85
- display: block;
86
- width: 1em;
87
- height: 1em;
88
- }
89
-
90
- /* `hidden` luôn ẩn — rule trên set display; selector `[hidden]` specificity cao hơn nên thắng. */
91
- .leaf-button[hidden],
92
- .leaf-button__icon[hidden] {
93
- display: none;
94
- }
95
-
96
- /* ── Size — Figma Medium/Small dùng padding (không ép height trong auto-layout);
97
- * vẫn set height mặc định khớp frame để icon-only / căn hàng ổn định.
98
- * Truyền height="auto" (prop) → chiều cao theo padding + nội dung. */
99
-
100
- .leaf-button[data-size="md"] {
101
- /* Medium: px L · py S · gap M · icon 24 · frame 40 */
102
- --leaf-button-height: 40px;
103
- --leaf-button-padding: 8px 16px;
104
- --leaf-button-gap: 12px;
105
- --leaf-button-icon-size: 24px;
106
- --leaf-button-font-size: var(--body-3-size);
107
- --leaf-button-line-height: var(--body-3-line-height);
108
- --leaf-button-font-weight: var(--body-3-highlight-weight);
109
- --leaf-button-letter-spacing: 0;
110
- }
111
-
112
- .leaf-button[data-size="sm"] {
113
- /* Small: px M · py XS · gap S · icon 20 · frame 28 */
114
- --leaf-button-height: 28px;
115
- --leaf-button-padding: 4px 12px;
116
- --leaf-button-icon-only-padding: 4px;
117
- --leaf-button-gap: 8px;
118
- --leaf-button-icon-size: 20px;
119
- --leaf-button-font-size: var(--body-4-size);
120
- --leaf-button-line-height: var(--body-4-line-height);
121
- --leaf-button-font-weight: var(--body-4-highlight-weight);
122
- --leaf-button-letter-spacing: 0;
123
- }
124
-
125
- /* Icon-only: khung vuông (tròn nhờ border-radius). Width custom vẫn được tôn trọng. */
126
- .leaf-button[data-icon-only="true"] {
127
- width: var(--leaf-button-width, var(--leaf-button-height));
128
- padding: var(--leaf-button-icon-only-padding);
129
- }
130
-
131
- /* Ghost text — không khung; icon-only ghost vẫn giữ hit-area theo size. */
132
- .leaf-button[data-priority="ghost"]:not([data-icon-only="true"]) {
133
- --leaf-button-height: auto;
134
- --leaf-button-padding: 0;
135
- }
136
-
137
- .leaf-button[data-priority="ghost"][data-icon-only="true"] {
138
- --leaf-button-bg: transparent;
139
- --leaf-button-padding: 0;
140
- --leaf-button-icon-only-padding: 0;
141
- }
142
-
143
- /* ── Priority × status ───────────────────────────────────────────────── */
144
-
145
- .leaf-button[data-status="destruction"] {
146
- --leaf-button-bg: var(--button-base-destruction);
147
- --leaf-button-fg: var(--button-content-primary);
148
- }
149
-
150
- .leaf-button[data-priority="secondary"] {
151
- --leaf-button-bg: var(--button-base-secondary);
152
- --leaf-button-fg: var(--button-content-secondary);
153
- }
154
-
155
- .leaf-button[data-priority="secondary"][data-status="destruction"] {
156
- --leaf-button-bg: var(--button-base-secondary-destruction);
157
- --leaf-button-fg: var(--button-content-destruction);
158
- }
159
-
160
- .leaf-button[data-priority="tertiary"] {
161
- --leaf-button-bg: var(--button-base-tertiary);
162
- --leaf-button-fg: var(--button-content-secondary);
163
- }
164
-
165
- .leaf-button[data-priority="tertiary"][data-status="destruction"] {
166
- --leaf-button-bg: var(--button-base-tertiary);
167
- --leaf-button-fg: var(--button-content-destruction);
168
- }
169
-
170
- .leaf-button[data-priority="ghost"] {
171
- --leaf-button-bg: transparent;
172
- --leaf-button-fg: var(--button-content-secondary);
173
- }
174
-
175
- .leaf-button[data-priority="ghost"][data-status="destruction"] {
176
- --leaf-button-bg: transparent;
177
- --leaf-button-fg: var(--button-content-destruction);
178
- }
179
-
180
- /*
181
- * Disabled — token --button-disabled-* (alias của --button-*-disable).
182
- * Specificity (0,3,0) và đứng cuối để thắng mọi tổ hợp priority × status.
183
- */
184
- .leaf-button:disabled:not([data-priority="ghost"]),
185
- .leaf-button[aria-disabled="true"]:not([data-priority="ghost"]) {
186
- --leaf-button-bg: var(--button-disabled-base);
187
- --leaf-button-fg: var(--button-disabled-content);
188
- }
189
-
190
- .leaf-button[data-priority="ghost"]:disabled,
191
- .leaf-button[data-priority="ghost"][aria-disabled="true"] {
192
- --leaf-button-bg: transparent;
193
- --leaf-button-fg: var(--button-disabled-content);
194
- }
195
-
196
- .leaf-button:disabled,
197
- .leaf-button[aria-disabled="true"] {
198
- cursor: not-allowed;
199
- }
200
-
201
- /*
202
- * Loading — `data-loading="true"` (React: `loading` / onClick trả Promise; HTML tĩnh:
203
- * `Leaf.button.setLoading`). Spinner thay leading icon, ăn --leaf-button-icon-size và
204
- * màu chữ. Nút gắn `aria-disabled="true"` (không dùng `:disabled` để vẫn giữ focus) nên
205
- * mang màu disabled như rule ở trên — có chủ đích: đang xử lý = tạm khoá.
206
- */
207
- .leaf-button[data-loading="true"] {
208
- cursor: progress;
209
- }
210
-
211
- .leaf-button__spinner > svg {
212
- animation: leaf-spinner-spin var(--leaf-spinner-duration, 1.2s) linear infinite;
213
- }
214
- }
215
-
216
- /* Trùng tên với spinner.css để button.css tự đủ khi import riêng. */
217
- @keyframes leaf-spinner-spin {
218
- to {
219
- transform: rotate(360deg);
220
- }
221
- }
222
-
223
- /* --- src/components/Calendar/calendar.css --- */
224
-
225
- /*
226
- * Calendar — port từ vnsc Calendar (panel chọn ngày / giờ / tháng).
227
- *
228
- * Typography và màu tĩnh (nền, màu viền) là class Leaf trên markup. File này giữ khung
229
- * (padding, radius, độ dày viền), layout, size cố định (panel 256, ô 28, ô tháng 40, select 64),
230
- * hover, trạng thái ngày / tháng (data-selected / data-today / :disabled), vị trí dropdown
231
- * (data-placement), bóng đổ, reset button. Footer là `Button` (cần button.css).
232
- */
233
-
234
- @layer components {
235
- .leaf-calendar {
236
- --leaf-calendar-width: 256px;
237
- --leaf-calendar-cell: 28px;
238
-
239
- display: flex;
240
- flex-direction: column;
241
- gap: 8px;
242
- box-sizing: border-box;
243
- width: var(--leaf-calendar-width);
244
- max-width: 100%;
245
- padding: 12px;
246
- border-width: 1px;
247
- border-style: solid;
248
- border-radius: 12px;
249
- }
250
-
251
- .leaf-calendar__header {
252
- position: relative;
253
- display: flex;
254
- align-items: center;
255
- justify-content: space-between;
256
- }
257
-
258
- .leaf-calendar[data-time-only="true"] {
259
- --leaf-calendar-width: auto;
260
- }
261
-
262
- /* Reset button của panel — không đụng footer `.leaf-button` (tự reset trong button.css). */
263
- :is(
264
- .leaf-calendar__nav,
265
- .leaf-calendar__title,
266
- .leaf-calendar__day,
267
- .leaf-calendar__option,
268
- .leaf-calendar__select
269
- ) {
270
- margin: 0;
271
- font-family: var(--font-sans);
272
- appearance: none;
273
- cursor: pointer;
274
- }
275
-
276
- .leaf-calendar__nav {
277
- display: inline-flex;
278
- align-items: center;
279
- justify-content: center;
280
- border-radius: 8px;
281
- width: var(--leaf-calendar-cell);
282
- height: var(--leaf-calendar-cell);
283
- padding: 0;
284
- border: none;
285
- background-color: var(--base-tertiary);
286
- font-size: 16px;
287
- line-height: 1;
288
- transition: background-color 0.15s ease;
289
- }
290
-
291
- .leaf-calendar__nav[data-size="sm"] {
292
- width: 24px;
293
- height: 24px;
294
- font-size: 14px;
295
- }
296
-
297
- .leaf-calendar__nav:hover {
298
- background-color: var(--base-quaternary);
299
- }
300
-
301
- .leaf-calendar__nav > svg,
302
- .leaf-calendar__caret > svg {
303
- display: block;
304
- width: 1em;
305
- height: 1em;
306
- }
307
-
308
- .leaf-calendar__title {
309
- display: inline-flex;
310
- align-items: center;
311
- gap: 4px;
312
- border-radius: 8px;
313
- padding: 2px 8px;
314
- border: none;
315
- background-color: transparent;
316
- transition: background-color 0.15s ease;
317
- }
318
-
319
- .leaf-calendar__title:hover,
320
- .leaf-calendar__title[aria-expanded="true"] {
321
- background-color: var(--base-tertiary);
322
- }
323
-
324
- .leaf-calendar__heading {
325
- display: flex;
326
- flex-direction: column;
327
- align-items: center;
328
- }
329
-
330
- .leaf-calendar__caret {
331
- display: inline-flex;
332
- font-size: 12px;
333
- color: var(--text-tertiary);
334
- }
335
-
336
- /* Bóng theo token --overlay (80% alpha) × 44% ≈ độ đậm 35% trước đây. */
337
- .leaf-calendar__months,
338
- .leaf-calendar__list {
339
- box-shadow: 0 16px 40px color-mix(in srgb, var(--overlay) 44%, transparent);
340
- }
341
-
342
- .leaf-calendar__months {
343
- position: absolute;
344
- top: 100%;
345
- right: 0;
346
- left: 0;
347
- z-index: 30;
348
- display: flex;
349
- flex-direction: column;
350
- gap: 8px;
351
- margin-top: 6px;
352
- padding: 8px;
353
- border-width: 1px;
354
- border-style: solid;
355
- border-radius: 12px;
356
- }
357
-
358
- .leaf-calendar__months-header {
359
- display: flex;
360
- align-items: center;
361
- justify-content: space-between;
362
- }
363
-
364
- .leaf-calendar__months-grid {
365
- display: grid;
366
- grid-template-columns: repeat(3, minmax(0, 1fr));
367
- gap: 4px;
368
- }
369
-
370
- /* monthOnly — lưới 12 tháng thay cho lưới ngày. */
371
- .leaf-calendar[data-month-only="true"] .leaf-calendar__months-grid {
372
- row-gap: 8px;
373
- }
374
-
375
- .leaf-calendar[data-month-only="true"] .leaf-calendar__option {
376
- height: 40px;
377
- }
378
-
379
- .leaf-calendar__weekdays,
380
- .leaf-calendar__days {
381
- display: grid;
382
- grid-template-columns: repeat(7, minmax(0, 1fr));
383
- gap: 2px;
384
- }
385
-
386
- .leaf-calendar__weekday {
387
- padding-block: 2px;
388
- text-align: center;
389
- }
390
-
391
- .leaf-calendar__num,
392
- .leaf-calendar__select,
393
- .leaf-calendar__option--time {
394
- font-variant-numeric: tabular-nums;
395
- }
396
-
397
- /* Ô ngày / tháng / giờ — màu theo state nên nằm ở đây, không gắn class màu trên markup. */
398
- .leaf-calendar__day,
399
- .leaf-calendar__option {
400
- display: inline-flex;
401
- align-items: center;
402
- justify-content: center;
403
- border-radius: 8px;
404
- height: var(--leaf-calendar-cell);
405
- padding: 0;
406
- border: 1px solid transparent;
407
- background-color: transparent;
408
- color: var(--text-primary);
409
- transition:
410
- background-color 0.15s ease,
411
- color 0.15s ease;
412
- }
413
-
414
- .leaf-calendar__option--time {
415
- flex-shrink: 0;
416
- height: 24px;
417
- }
418
-
419
- .leaf-calendar__day:not(:disabled):not([data-selected="true"]):hover,
420
- .leaf-calendar__option:not(:disabled):not([data-selected="true"]):hover {
421
- background-color: var(--base-tertiary);
422
- }
423
-
424
- .leaf-calendar__day[data-today="true"],
425
- .leaf-calendar__option[data-today="true"] {
426
- border-color: var(--text-highlight);
427
- color: var(--text-highlight);
428
- }
429
-
430
- .leaf-calendar__day[data-selected="true"],
431
- .leaf-calendar__option[data-selected="true"] {
432
- border-color: transparent;
433
- background-color: var(--text-highlight);
434
- color: var(--text-quaternary);
435
- font-weight: var(--body-5-highlight-weight);
436
- }
437
-
438
- .leaf-calendar__day:disabled,
439
- .leaf-calendar__option:disabled {
440
- border-color: transparent;
441
- background-color: transparent;
442
- color: var(--text-tertiary);
443
- opacity: 0.5;
444
- cursor: not-allowed;
445
- }
446
-
447
- .leaf-calendar__day:focus-visible,
448
- .leaf-calendar__option:focus-visible,
449
- .leaf-calendar__nav:focus-visible,
450
- .leaf-calendar__title:focus-visible,
451
- .leaf-calendar__select:focus-visible {
452
- outline: 2px solid var(--text-highlight);
453
- outline-offset: 1px;
454
- }
455
-
456
- .leaf-calendar__empty {
457
- height: var(--leaf-calendar-cell);
458
- }
459
-
460
- .leaf-calendar__divider {
461
- height: 1px;
462
- }
463
-
464
- .leaf-calendar__time {
465
- display: flex;
466
- align-items: center;
467
- justify-content: space-between;
468
- gap: 8px;
469
- }
470
-
471
- .leaf-calendar__time-group {
472
- display: flex;
473
- align-items: center;
474
- gap: 4px;
475
- }
476
-
477
- .leaf-calendar__select-wrap {
478
- position: relative;
479
- }
480
-
481
- .leaf-calendar__select {
482
- display: inline-flex;
483
- align-items: center;
484
- justify-content: space-between;
485
- padding-inline: 8px;
486
- border-radius: 8px;
487
- box-sizing: border-box;
488
- width: 64px;
489
- height: var(--leaf-calendar-cell);
490
- padding-block: 0;
491
- border: 1px solid var(--base-quaternary);
492
- background-color: var(--base-tertiary);
493
- color: var(--text-primary);
494
- }
495
-
496
- .leaf-calendar__select[aria-expanded="true"] {
497
- border-color: var(--text-highlight);
498
- }
499
-
500
- .leaf-calendar__list {
501
- position: absolute;
502
- left: 0;
503
- z-index: 20;
504
- display: flex;
505
- flex-direction: column;
506
- gap: 2px;
507
- padding: 4px;
508
- border-width: 1px;
509
- border-style: solid;
510
- border-radius: 8px;
511
- overflow-y: auto;
512
- box-sizing: border-box;
513
- width: 64px;
514
- max-height: 160px;
515
- }
516
-
517
- .leaf-calendar__list[data-placement="bottom"] {
518
- top: 100%;
519
- margin-top: 4px;
520
- }
521
-
522
- .leaf-calendar__list[data-placement="top"] {
523
- bottom: 100%;
524
- margin-bottom: 4px;
525
- }
526
-
527
- .leaf-calendar__footer {
528
- display: flex;
529
- gap: 8px;
530
- }
531
-
532
- .leaf-calendar__footer > .leaf-button {
533
- flex: 1;
534
- }
535
-
536
- .leaf-calendar[hidden],
537
- .leaf-calendar__header[hidden],
538
- .leaf-calendar__nav[hidden],
539
- .leaf-calendar__title[hidden],
540
- .leaf-calendar__heading[hidden],
541
- .leaf-calendar__caret[hidden],
542
- .leaf-calendar__months[hidden],
543
- .leaf-calendar__months-header[hidden],
544
- .leaf-calendar__months-grid[hidden],
545
- .leaf-calendar__weekdays[hidden],
546
- .leaf-calendar__days[hidden],
547
- .leaf-calendar__time[hidden],
548
- .leaf-calendar__time-group[hidden],
549
- .leaf-calendar__select[hidden],
550
- .leaf-calendar__footer[hidden],
551
- .leaf-calendar__list[hidden],
552
- .leaf-calendar__day[hidden],
553
- .leaf-calendar__option[hidden] {
554
- display: none;
555
- }
556
- }
557
-
558
- /* --- src/components/Carousel/carousel.css --- */
559
-
560
- /*
561
- * Carousel — cuộn ngang native, kéo khi free mode, snap khi free mode tắt.
562
- * Nav dùng token semantic (--base-tertiary / --text-primary) để đổi đúng light/dark.
563
- */
564
-
565
- @layer components {
566
- .leaf-carousel {
567
- --leaf-carousel-space-between: 12px;
568
- --leaf-carousel-slides-per-view: auto;
569
-
570
- position: relative;
571
- display: flex;
572
- flex-direction: column;
573
- width: 100%;
574
- box-sizing: border-box;
575
- }
576
-
577
- .leaf-carousel__viewport {
578
- overflow-x: auto;
579
- overflow-y: hidden;
580
- width: 100%;
581
- -webkit-overflow-scrolling: touch;
582
- scrollbar-width: none;
583
- }
584
-
585
- .leaf-carousel__viewport::-webkit-scrollbar {
586
- display: none;
587
- }
588
-
589
- .leaf-carousel__viewport[data-free-mode="true"] {
590
- touch-action: pan-y;
591
- cursor: grab;
592
- }
593
-
594
- .leaf-carousel__viewport[data-free-mode="true"][data-dragging="true"] {
595
- cursor: grabbing;
596
- user-select: none;
597
- -webkit-user-select: none;
598
- }
599
-
600
- .leaf-carousel__viewport[data-free-mode="false"] {
601
- scroll-snap-type: x mandatory;
602
- }
603
-
604
- .leaf-carousel__track {
605
- display: flex;
606
- flex-direction: row;
607
- align-items: stretch;
608
- gap: var(--leaf-carousel-space-between);
609
- width: max-content;
610
- min-width: 100%;
611
- box-sizing: border-box;
612
- }
613
-
614
- .leaf-carousel__slide {
615
- flex: 0 0 auto;
616
- box-sizing: border-box;
617
- scroll-snap-align: start;
618
- transform: scale(1);
619
- opacity: 1;
620
- transition:
621
- transform 180ms ease,
622
- opacity 180ms ease;
623
- }
624
-
625
- /* Kéo card: thu nhẹ + mờ nhẹ, thả tay transition về chỗ. */
626
- .leaf-carousel__viewport[data-dragging="true"] .leaf-carousel__slide {
627
- transform: scale(0.97);
628
- opacity: 0.92;
629
- }
630
-
631
- .leaf-carousel[data-slides-per-view]:not([data-slides-per-view="auto"]) .leaf-carousel__slide {
632
- flex: 0 0
633
- calc(
634
- (100% - (var(--leaf-carousel-slides-per-view) - 1) * var(--leaf-carousel-space-between)) /
635
- var(--leaf-carousel-slides-per-view)
636
- );
637
- max-width: calc(
638
- (100% - (var(--leaf-carousel-slides-per-view) - 1) * var(--leaf-carousel-space-between)) /
639
- var(--leaf-carousel-slides-per-view)
640
- );
641
- }
642
-
643
- .leaf-carousel__nav {
644
- position: absolute;
645
- top: 50%;
646
- z-index: 1;
647
- display: inline-flex;
648
- align-items: center;
649
- justify-content: center;
650
- width: 28px;
651
- height: 28px;
652
- margin: 0;
653
- padding: 0;
654
- border: none;
655
- border-radius: 999px;
656
- /* Token semantic — đổi theo data-theme light/dark (không hard-code #fff). */
657
- background-color: var(--base-tertiary);
658
- color: var(--text-primary);
659
- box-shadow: none;
660
- transform: translateY(-50%);
661
- cursor: pointer;
662
- font: inherit;
663
- appearance: none;
664
- transition:
665
- opacity 160ms ease,
666
- background-color 160ms ease,
667
- color 160ms ease;
668
- }
669
-
670
- .leaf-carousel__nav:focus-visible {
671
- outline: 2px solid var(--text-highlight);
672
- outline-offset: 2px;
673
- }
674
-
675
- .leaf-carousel__nav--prev {
676
- left: 4px;
677
- }
678
-
679
- .leaf-carousel__nav--next {
680
- right: 4px;
681
- }
682
-
683
- /* Icon nhỏ hơn ring (28px) — SVG RemixGlyph hoặc font <i class="ri-*">. */
684
- .leaf-carousel__nav svg,
685
- .leaf-carousel__nav i {
686
- width: 14px;
687
- height: 14px;
688
- font-size: 14px;
689
- line-height: 1;
690
- display: block;
691
- color: inherit;
692
- }
693
-
694
- .leaf-carousel__nav[data-nav-disabled="true"] {
695
- opacity: 0;
696
- pointer-events: none;
697
- }
698
- }
699
-
700
- /* --- src/components/Checkbox/checkbox.css --- */
701
-
702
- /*
703
- * Checkbox — Figma 891:10191.
704
- *
705
- * Selection Unchecked / Checked / Indeterminate qua `:checked` / `:indeterminate`
706
- * của input native; State Disabled qua `:disabled`. Input phủ kín box (opacity 0)
707
- * nên click / focus / FormData là của trình duyệt — HTML tĩnh chỉ cần CSS
708
- * (indeterminate là property DOM, set bằng JS: `input.indeterminate = true`).
709
- */
710
-
711
- @layer components {
712
- .leaf-checkbox {
713
- --leaf-checkbox-size: 20px;
714
-
715
- display: inline-flex;
716
- flex-direction: column;
717
- align-items: flex-start;
718
- gap: 8px;
719
- vertical-align: top;
720
- cursor: pointer;
721
- }
722
-
723
- .leaf-checkbox__row {
724
- position: relative;
725
- display: inline-flex;
726
- align-items: flex-start;
727
- gap: 8px;
728
- }
729
-
730
- .leaf-checkbox[hidden],
731
- .leaf-checkbox__row[hidden],
732
- .leaf-checkbox__box[hidden] {
733
- display: none;
734
- }
735
-
736
- .leaf-checkbox__label,
737
- .leaf-checkbox__text {
738
- color: var(--text-primary);
739
- }
740
-
741
- .leaf-checkbox__input {
742
- position: absolute;
743
- top: 0;
744
- left: 0;
745
- width: var(--leaf-checkbox-size);
746
- height: var(--leaf-checkbox-size);
747
- margin: 0;
748
- padding: 0;
749
- border: none;
750
- opacity: 0;
751
- cursor: inherit;
752
- appearance: none;
753
- -webkit-appearance: none;
754
- }
755
-
756
- .leaf-checkbox__box {
757
- display: inline-flex;
758
- flex-shrink: 0;
759
- align-items: center;
760
- justify-content: center;
761
- border-radius: 4px;
762
- box-sizing: border-box;
763
- width: var(--leaf-checkbox-size);
764
- height: var(--leaf-checkbox-size);
765
- border: 1.5px solid var(--text-secondary);
766
- background-color: transparent;
767
- color: var(--icon-on-color);
768
- transition:
769
- background-color 0.15s ease,
770
- border-color 0.15s ease;
771
- }
772
-
773
- .leaf-checkbox__icon {
774
- display: none;
775
- width: 16px;
776
- height: 16px;
777
- }
778
-
779
- /* Checked — nền highlight, check trắng. */
780
- .leaf-checkbox__input:checked + .leaf-checkbox__box {
781
- border-color: var(--text-highlight);
782
- background-color: var(--text-highlight);
783
- }
784
-
785
- .leaf-checkbox__input:checked:not(:indeterminate) + .leaf-checkbox__box .leaf-checkbox__check {
786
- display: block;
787
- }
788
-
789
- /* Indeterminate — nền primary, gạch ngang tối. */
790
- .leaf-checkbox__input:indeterminate + .leaf-checkbox__box {
791
- border-color: var(--text-primary);
792
- background-color: var(--text-primary);
793
- color: var(--text-quaternary);
794
- }
795
-
796
- .leaf-checkbox__input:indeterminate + .leaf-checkbox__box .leaf-checkbox__dash {
797
- display: block;
798
- }
799
-
800
- /* Disabled */
801
- .leaf-checkbox__input:disabled + .leaf-checkbox__box {
802
- border-color: var(--base-quaternary);
803
- }
804
-
805
- .leaf-checkbox__input:disabled:checked + .leaf-checkbox__box,
806
- .leaf-checkbox__input:disabled:indeterminate + .leaf-checkbox__box {
807
- border-color: var(--base-quaternary);
808
- background-color: var(--base-quaternary);
809
- color: var(--text-tertiary);
810
- }
811
-
812
- .leaf-checkbox:has(.leaf-checkbox__input:disabled) {
813
- cursor: not-allowed;
814
- }
815
-
816
- .leaf-checkbox:has(.leaf-checkbox__input:disabled) .leaf-checkbox__label {
817
- color: var(--text-tertiary);
818
- }
819
-
820
- .leaf-checkbox__input:disabled ~ .leaf-checkbox__text {
821
- color: var(--text-secondary);
822
- }
823
-
824
- .leaf-checkbox__input:focus-visible + .leaf-checkbox__box {
825
- outline: 2px solid var(--text-highlight);
826
- outline-offset: 2px;
827
- }
828
- }
829
-
830
- /* --- src/components/Date/date.css --- */
831
-
832
- /*
833
- * Date — thẻ span/data hiển thị ngày đã format.
834
- * Typography / màu dùng class Leaf (body-*, text-*).
835
- */
836
-
837
- @layer components {
838
- .leaf-date {
839
- display: inline;
840
- }
841
-
842
- .leaf-date[hidden] {
843
- display: none;
844
- }
845
- }
846
-
847
- /* --- src/components/Dialog/dialog.css --- */
848
-
849
- /*
850
- * Dialog — Figma 994:4149.
851
- *
852
- * Backdrop phủ toàn màn hình + blur; panel căn giữa. Header (back · title · close)
853
- * bật/tắt qua markup — React chỉ gắn/gỡ phần tử, không gắn class typography/màu
854
- * theo prop. Thiếu phần header → chỉ còn body (children).
855
- */
856
-
857
- @layer components {
858
- .leaf-dialog-backdrop {
859
- position: fixed;
860
- inset: 0;
861
- display: flex;
862
- align-items: center;
863
- justify-content: center;
864
- z-index: var(--leaf-z-dialog, 50);
865
- padding: 16px;
866
- box-sizing: border-box;
867
- /*
868
- * Overlay — Figma 995:6039: Overlay/Overlay + blur nhẹ. Chỉ khai báo bản
869
- * chuẩn: Safari 18+ hỗ trợ `backdrop-filter` không prefix, còn dòng
870
- * `-webkit-` đặt sau từng ghi đè và làm blur không chạy.
871
- */
872
- background-color: var(--overlay);
873
- backdrop-filter: blur(5px);
874
- }
875
-
876
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
877
- .leaf-dialog-backdrop[hidden],
878
- .leaf-dialog[hidden],
879
- .leaf-dialog__header[hidden],
880
- .leaf-dialog__start[hidden],
881
- .leaf-dialog__back[hidden],
882
- .leaf-dialog__close[hidden],
883
- .leaf-dialog__body[hidden] {
884
- display: none;
885
- }
886
-
887
- .leaf-dialog {
888
- --leaf-dialog-gap: 16px;
889
- --leaf-dialog-padding: 16px;
890
- --leaf-dialog-radius: 12px;
891
- --leaf-dialog-back-size: 24px;
892
- --leaf-dialog-close-size: 28px;
893
- --leaf-dialog-close-icon: 20px;
894
-
895
- display: flex;
896
- flex-direction: column;
897
- gap: var(--leaf-dialog-gap);
898
- overflow: hidden;
899
- /*
900
- * Width: luôn 100% trong trần maxWidth (responsive).
901
- * Height: cố định khi có --leaf-dialog-height (content động không giật panel);
902
- * không có → auto theo nội dung. maxHeight luôn là trần viewport.
903
- */
904
- width: 100%;
905
- max-width: var(--leaf-dialog-max-width, 100%);
906
- height: var(--leaf-dialog-height, auto);
907
- max-height: var(--leaf-dialog-max-height, 100%);
908
- margin: 0;
909
- padding: var(--leaf-dialog-padding);
910
- box-sizing: border-box;
911
- border-radius: var(--leaf-dialog-radius);
912
- background-color: var(--base-primary);
913
- color: var(--text-primary);
914
- font-family: var(--font-sans);
915
- }
916
-
917
- /* Panel nhận focus khi mở (tabindex="-1") — không phải control nên không vẽ outline. */
918
- .leaf-dialog:focus {
919
- outline: none;
920
- }
921
-
922
- .leaf-dialog__header {
923
- display: flex;
924
- flex-shrink: 0;
925
- align-items: center;
926
- justify-content: space-between;
927
- gap: var(--leaf-dialog-gap);
928
- width: 100%;
929
- min-width: 0;
930
- }
931
-
932
- /* Cụm trái: back + title */
933
- .leaf-dialog__start {
934
- display: flex;
935
- flex: auto;
936
- align-items: center;
937
- gap: var(--leaf-dialog-gap);
938
- min-width: 0;
939
- }
940
-
941
- /*
942
- * Title — heading-3 · --text-primary nằm ngay ở đây: markup không cần class typography /
943
- * màu, nên utility trùng tên của app (vd. `text-primary`) không chen vào.
944
- */
945
- .leaf-dialog__start > :where(h2, p) {
946
- min-width: 0;
947
- overflow: hidden;
948
- text-overflow: ellipsis;
949
- white-space: nowrap;
950
- margin: 0;
951
- color: var(--text-primary);
952
- font-family: var(--font-sans);
953
- font-size: var(--heading-3-size);
954
- line-height: var(--heading-3-line-height);
955
- font-weight: var(--heading-3-weight);
956
- }
957
-
958
- .leaf-dialog__back,
959
- .leaf-dialog__close {
960
- display: inline-flex;
961
- flex-shrink: 0;
962
- align-items: center;
963
- justify-content: center;
964
- margin: 0;
965
- padding: 0;
966
- border: none;
967
- cursor: pointer;
968
- color: var(--text-primary);
969
- background: transparent;
970
- font: inherit;
971
- appearance: none;
972
- box-sizing: border-box;
973
- }
974
-
975
- .leaf-dialog__back {
976
- width: var(--leaf-dialog-back-size);
977
- height: var(--leaf-dialog-back-size);
978
- }
979
-
980
- .leaf-dialog__back:hover,
981
- .leaf-dialog__close:hover {
982
- color: var(--text-highlight);
983
- }
984
-
985
- .leaf-dialog__back:focus-visible,
986
- .leaf-dialog__close:focus-visible {
987
- outline: 2px solid var(--text-highlight);
988
- outline-offset: 2px;
989
- }
990
-
991
- .leaf-dialog__icon {
992
- display: block;
993
- width: 1em;
994
- height: 1em;
995
- }
996
-
997
- .leaf-dialog__back .leaf-dialog__icon {
998
- font-size: var(--leaf-dialog-back-size);
999
- }
1000
-
1001
- .leaf-dialog__close {
1002
- width: var(--leaf-dialog-close-size);
1003
- min-height: var(--leaf-dialog-close-size);
1004
- padding: 4px 6px;
1005
- border-radius: 100px;
1006
- background-color: var(--base-secondary);
1007
- font-size: var(--leaf-dialog-close-icon);
1008
- }
1009
-
1010
- .leaf-dialog__body {
1011
- display: flex;
1012
- flex: auto;
1013
- flex-direction: column;
1014
- gap: var(--leaf-dialog-gap);
1015
- width: 100%;
1016
- min-height: 0;
1017
- overflow: auto;
1018
- }
1019
- }
1020
-
1021
- /* --- src/components/Dropdown/dropdown.css --- */
1022
-
1023
- /*
1024
- * Dropdown — chọn một giá trị từ danh sách.
1025
- *
1026
- * data-variant: list (mặc định — panel --base-secondary viền --base-tertiary, mục chọn nền
1027
- * --base-tertiary) · radio (panel --base-quaternary, chấm radio --text-highlight bên phải).
1028
- * data-trigger: field (ô full width, data-appearance filled | outlined) · text (chữ +
1029
- * chevron, rộng theo nội dung). data-size: md (Body 4) · sm (Body 5). data-align: start |
1030
- * end. Mở / đóng = `hidden` trên listbox + data-open trên gốc.
1031
- * Thiếu attribute → list · field · filled · md · start.
1032
- */
1033
-
1034
- @layer components {
1035
- .leaf-dropdown {
1036
- --leaf-dropdown-font-size: var(--body-4-size);
1037
- --leaf-dropdown-line-height: var(--body-4-line-height);
1038
- --leaf-dropdown-weight: var(--body-4-weight);
1039
- --leaf-dropdown-weight-highlight: var(--body-4-highlight-weight);
1040
- --leaf-dropdown-trigger-weight: var(--leaf-dropdown-weight-highlight);
1041
- --leaf-dropdown-option-weight: var(--leaf-dropdown-weight-highlight);
1042
- --leaf-dropdown-chevron-size: 16px;
1043
- --leaf-dropdown-offset: 4px;
1044
- --leaf-dropdown-radius: 12px;
1045
- --leaf-dropdown-radio-size: 24px;
1046
- --leaf-dropdown-radio-ring: 2px;
1047
-
1048
- position: relative;
1049
- display: flex;
1050
- width: 100%;
1051
- min-width: 0;
1052
- box-sizing: border-box;
1053
- font-family: var(--font-sans);
1054
- font-size: var(--leaf-dropdown-font-size);
1055
- line-height: var(--leaf-dropdown-line-height);
1056
- color: var(--text-primary);
1057
- }
1058
-
1059
- .leaf-dropdown[data-size="sm"] {
1060
- --leaf-dropdown-font-size: var(--body-5-size);
1061
- --leaf-dropdown-line-height: var(--body-5-line-height);
1062
- --leaf-dropdown-weight: var(--body-5-weight);
1063
- --leaf-dropdown-weight-highlight: var(--body-5-highlight-weight);
1064
- --leaf-dropdown-option-weight: var(--leaf-dropdown-weight);
1065
- --leaf-dropdown-radio-size: 18px;
1066
- --leaf-dropdown-radio-ring: 1.5px;
1067
- }
1068
-
1069
- .leaf-dropdown[data-trigger="text"] {
1070
- --leaf-dropdown-trigger-weight: var(--leaf-dropdown-weight);
1071
- --leaf-dropdown-chevron-size: 14px;
1072
- display: inline-flex;
1073
- width: max-content;
1074
- max-width: 100%;
1075
- vertical-align: middle;
1076
- }
1077
-
1078
- .leaf-dropdown[hidden],
1079
- .leaf-dropdown__trigger[hidden],
1080
- .leaf-dropdown__value[hidden],
1081
- .leaf-dropdown__leading[hidden],
1082
- .leaf-dropdown__flag[hidden],
1083
- .leaf-dropdown__chevron[hidden],
1084
- .leaf-dropdown__list[hidden],
1085
- .leaf-dropdown__option[hidden],
1086
- .leaf-dropdown__radio[hidden] {
1087
- display: none;
1088
- }
1089
-
1090
- /* ── Trigger ─────────────────────────────────────────────────────────── */
1091
-
1092
- .leaf-dropdown__trigger {
1093
- display: flex;
1094
- align-items: center;
1095
- justify-content: space-between;
1096
- gap: 8px;
1097
- width: 100%;
1098
- min-width: 0;
1099
- margin: 0;
1100
- padding: 10px 12px;
1101
- box-sizing: border-box;
1102
- border: none;
1103
- border-radius: var(--leaf-dropdown-radius);
1104
- background-color: var(--base-secondary);
1105
- color: var(--text-primary);
1106
- font: inherit;
1107
- font-weight: var(--leaf-dropdown-trigger-weight);
1108
- text-align: left;
1109
- cursor: pointer;
1110
- user-select: none;
1111
- appearance: none;
1112
- }
1113
-
1114
- .leaf-dropdown[data-appearance="outlined"] .leaf-dropdown__trigger {
1115
- padding: 8px 12px;
1116
- border: 1px solid var(--base-quaternary);
1117
- background-color: transparent;
1118
- }
1119
-
1120
- .leaf-dropdown[data-trigger="text"] .leaf-dropdown__trigger {
1121
- justify-content: flex-start;
1122
- padding: 0;
1123
- border: none;
1124
- border-radius: 4px;
1125
- background-color: transparent;
1126
- }
1127
-
1128
- .leaf-dropdown__trigger:focus-visible {
1129
- outline: 2px solid var(--text-highlight);
1130
- outline-offset: 2px;
1131
- }
1132
-
1133
- .leaf-dropdown__trigger[aria-readonly="true"] {
1134
- cursor: default;
1135
- }
1136
-
1137
- .leaf-dropdown__trigger:disabled {
1138
- cursor: not-allowed;
1139
- color: var(--text-tertiary);
1140
- }
1141
-
1142
- .leaf-dropdown__value {
1143
- flex: 1 1 auto;
1144
- min-width: 0;
1145
- overflow: hidden;
1146
- text-overflow: ellipsis;
1147
- white-space: nowrap;
1148
- }
1149
-
1150
- .leaf-dropdown[data-trigger="text"] .leaf-dropdown__value {
1151
- flex: 0 1 auto;
1152
- }
1153
-
1154
- .leaf-dropdown__value[data-placeholder] {
1155
- color: var(--text-secondary);
1156
- }
1157
-
1158
- .leaf-dropdown__trigger:disabled .leaf-dropdown__value {
1159
- color: var(--text-tertiary);
1160
- }
1161
-
1162
- .leaf-dropdown__leading {
1163
- display: inline-flex;
1164
- flex-shrink: 0;
1165
- align-items: center;
1166
- vertical-align: middle;
1167
- }
1168
-
1169
- .leaf-dropdown__flag {
1170
- display: block;
1171
- width: 20px;
1172
- height: 20px;
1173
- object-fit: contain;
1174
- }
1175
-
1176
- .leaf-dropdown__value > .leaf-dropdown__leading {
1177
- margin-right: 8px;
1178
- }
1179
-
1180
- .leaf-dropdown__chevron {
1181
- display: block;
1182
- flex-shrink: 0;
1183
- width: var(--leaf-dropdown-chevron-size);
1184
- height: var(--leaf-dropdown-chevron-size);
1185
- color: var(--text-secondary);
1186
- transition: transform 0.2s ease;
1187
- }
1188
-
1189
- .leaf-dropdown[data-open="true"] .leaf-dropdown__chevron {
1190
- transform: rotate(180deg);
1191
- }
1192
-
1193
- .leaf-dropdown__trigger:disabled .leaf-dropdown__chevron {
1194
- color: var(--text-tertiary);
1195
- }
1196
-
1197
- /* ── Panel ───────────────────────────────────────────────────────────── */
1198
-
1199
- .leaf-dropdown__list {
1200
- position: absolute;
1201
- top: calc(100% + var(--leaf-dropdown-offset));
1202
- left: 0;
1203
- z-index: var(--leaf-z-dropdown, 30);
1204
- display: flex;
1205
- flex-direction: column;
1206
- width: 100%;
1207
- max-height: var(--leaf-dropdown-max-height, none);
1208
- margin: 0;
1209
- padding: 0;
1210
- box-sizing: border-box;
1211
- overflow-y: auto;
1212
- list-style: none;
1213
- border: 1px solid var(--base-tertiary);
1214
- border-radius: var(--leaf-dropdown-radius);
1215
- background-color: var(--base-secondary);
1216
- font-weight: var(--leaf-dropdown-option-weight);
1217
- }
1218
-
1219
- .leaf-dropdown[data-trigger="text"] .leaf-dropdown__list {
1220
- width: max-content;
1221
- min-width: 100%;
1222
- }
1223
-
1224
- .leaf-dropdown[data-align="end"] .leaf-dropdown__list {
1225
- right: 0;
1226
- left: auto;
1227
- }
1228
-
1229
- .leaf-dropdown__option {
1230
- display: flex;
1231
- align-items: center;
1232
- gap: 8px;
1233
- margin: 0;
1234
- padding: 8px 12px;
1235
- color: var(--text-secondary);
1236
- cursor: pointer;
1237
- transition:
1238
- background-color 0.15s ease,
1239
- color 0.15s ease;
1240
- }
1241
-
1242
- .leaf-dropdown__option[data-active],
1243
- .leaf-dropdown__option[aria-selected="true"] {
1244
- background-color: var(--base-tertiary);
1245
- color: var(--text-primary);
1246
- }
1247
-
1248
- .leaf-dropdown__option[aria-disabled="true"] {
1249
- background-color: transparent;
1250
- color: var(--text-tertiary);
1251
- cursor: not-allowed;
1252
- }
1253
-
1254
- .leaf-dropdown__label {
1255
- flex: 1 1 auto;
1256
- min-width: 0;
1257
- overflow: hidden;
1258
- text-overflow: ellipsis;
1259
- white-space: nowrap;
1260
- }
1261
-
1262
- /* ── Variant radio ───────────────────────────────────────────────────── */
1263
-
1264
- .leaf-dropdown[data-variant="radio"] {
1265
- --leaf-dropdown-offset: 8px;
1266
- }
1267
-
1268
- .leaf-dropdown[data-variant="radio"] .leaf-dropdown__list {
1269
- gap: 16px;
1270
- padding: 16px;
1271
- border: none;
1272
- background-color: var(--base-quaternary);
1273
- font-weight: var(--leaf-dropdown-weight);
1274
- }
1275
-
1276
- .leaf-dropdown[data-variant="radio"] .leaf-dropdown__option {
1277
- justify-content: space-between;
1278
- gap: 16px;
1279
- padding: 0;
1280
- background-color: transparent;
1281
- color: var(--text-primary);
1282
- }
1283
-
1284
- .leaf-dropdown[data-variant="radio"] .leaf-dropdown__option[aria-selected="true"] {
1285
- font-weight: var(--leaf-dropdown-weight-highlight);
1286
- }
1287
-
1288
- .leaf-dropdown[data-variant="radio"] .leaf-dropdown__option[data-active] {
1289
- color: var(--text-highlight);
1290
- }
1291
-
1292
- .leaf-dropdown[data-variant="radio"] .leaf-dropdown__option[aria-disabled="true"] {
1293
- color: var(--text-tertiary);
1294
- }
1295
-
1296
- .leaf-dropdown__radio {
1297
- display: inline-flex;
1298
- flex-shrink: 0;
1299
- align-items: center;
1300
- justify-content: center;
1301
- width: var(--leaf-dropdown-radio-size);
1302
- height: var(--leaf-dropdown-radio-size);
1303
- box-sizing: border-box;
1304
- border: var(--leaf-dropdown-radio-ring) solid var(--text-highlight);
1305
- border-radius: 9999px;
1306
- opacity: 0;
1307
- }
1308
-
1309
- .leaf-dropdown__dot {
1310
- display: block;
1311
- width: 50%;
1312
- height: 50%;
1313
- border-radius: 9999px;
1314
- background-color: var(--text-highlight);
1315
- }
1316
-
1317
- .leaf-dropdown__option[aria-selected="true"] .leaf-dropdown__radio {
1318
- opacity: 1;
1319
- }
1320
-
1321
- /* ── Searchable (ô tìm trên trigger) ──────────────────────────────────── */
1322
-
1323
- .leaf-dropdown[data-searchable="true"] .leaf-dropdown__trigger {
1324
- cursor: text;
1325
- }
1326
-
1327
- .leaf-dropdown[data-searchable="true"] .leaf-dropdown__trigger[data-readonly],
1328
- .leaf-dropdown[data-searchable="true"][data-disabled="true"] .leaf-dropdown__trigger {
1329
- cursor: default;
1330
- }
1331
-
1332
- .leaf-dropdown[data-searchable="true"][data-disabled="true"] .leaf-dropdown__trigger {
1333
- cursor: not-allowed;
1334
- color: var(--text-tertiary);
1335
- }
1336
-
1337
- /* Ô nhập text (focus khớp cả khi click) → viền highlight như Input field, không outline. */
1338
- .leaf-dropdown[data-searchable="true"]:not([data-invalid="true"])
1339
- .leaf-dropdown__trigger:focus-within {
1340
- outline: none;
1341
- box-shadow: inset 0 0 0 1px var(--text-highlight);
1342
- }
1343
-
1344
- .leaf-dropdown[data-searchable="true"][data-appearance="outlined"]:not([data-invalid="true"])
1345
- .leaf-dropdown__trigger:focus-within {
1346
- border-color: var(--text-highlight);
1347
- box-shadow: none;
1348
- }
1349
-
1350
- .leaf-dropdown__search {
1351
- flex: 1 1 auto;
1352
- min-width: 0;
1353
- width: 100%;
1354
- margin: 0;
1355
- padding: 0;
1356
- border: none;
1357
- background: transparent;
1358
- color: inherit;
1359
- font: inherit;
1360
- font-weight: inherit;
1361
- outline: none;
1362
- appearance: none;
1363
- }
1364
-
1365
- .leaf-dropdown__search::placeholder {
1366
- color: var(--text-secondary);
1367
- }
1368
-
1369
- .leaf-dropdown__search:disabled {
1370
- color: var(--text-tertiary);
1371
- cursor: not-allowed;
1372
- }
1373
-
1374
- .leaf-dropdown__search:disabled::placeholder {
1375
- color: var(--text-tertiary);
1376
- }
1377
-
1378
- /* Thắng `.leaf-dropdown__option[aria-disabled="true"]` (cursor not-allowed). */
1379
- .leaf-dropdown__option.leaf-dropdown__empty {
1380
- cursor: default;
1381
- color: var(--text-tertiary);
1382
- }
1383
-
1384
- .leaf-dropdown[data-searchable="true"][data-disabled="true"] .leaf-dropdown__chevron {
1385
- color: var(--text-tertiary);
1386
- }
1387
-
1388
- /* ── Invalid (mọi trigger field, không riêng searchable) ─────────────── */
1389
-
1390
- .leaf-dropdown[data-trigger="field"][data-invalid="true"] .leaf-dropdown__trigger {
1391
- box-shadow: inset 0 0 0 1px var(--system-red);
1392
- }
1393
-
1394
- .leaf-dropdown[data-trigger="field"][data-invalid="true"][data-appearance="outlined"]
1395
- .leaf-dropdown__trigger {
1396
- border-color: var(--system-red);
1397
- box-shadow: none;
1398
- }
1399
-
1400
- /* ── Message ─────────────────────────────────────────────────────────────
1401
- * Gốc là flex hàng ngang → message phải xuống dòng. Dùng grid một cột: panel (absolute)
1402
- * đặt vào hàng 1 nên containing block là ô của trigger — panel vẫn nằm ngay dưới trigger,
1403
- * không bị message đẩy xuống. Khoảng cách 8px như Input.
1404
- */
1405
-
1406
- .leaf-dropdown[data-message="true"] {
1407
- display: grid;
1408
- grid-template-columns: minmax(0, 1fr);
1409
- row-gap: 8px;
1410
- }
1411
-
1412
- .leaf-dropdown[data-trigger="text"][data-message="true"] {
1413
- display: inline-grid;
1414
- }
1415
-
1416
- .leaf-dropdown[data-message="true"][hidden] {
1417
- display: none;
1418
- }
1419
-
1420
- /* Ghi đủ "1 / 2": với phần tử absolute, line `auto` là mép container (gồm cả message). */
1421
- .leaf-dropdown[data-message="true"] > .leaf-dropdown__trigger,
1422
- .leaf-dropdown[data-message="true"] > .leaf-dropdown__list {
1423
- grid-row: 1 / 2;
1424
- grid-column: 1 / 2;
1425
- }
1426
-
1427
- .leaf-dropdown .leaf-dropdown__message {
1428
- --leaf-input-message: var(--text-secondary);
1429
- grid-row: 2 / 3;
1430
- margin: 0;
1431
- color: var(--leaf-input-message);
1432
- }
1433
-
1434
- .leaf-dropdown[data-invalid="true"] .leaf-dropdown__message {
1435
- --leaf-input-message: var(--system-red);
1436
- }
1437
- }
1438
-
1439
- /* --- src/components/Empty/empty.css --- */
1440
-
1441
- /*
1442
- * Empty — trạng thái không có dữ liệu (illustration tuỳ chọn + description).
1443
- *
1444
- * data-size: md (mặc định) · sm — scale cả khung ảnh lẫn chữ description.
1445
- * Ảnh CDN gắn trong React; HTML tĩnh tự <img> cùng URL.
1446
- */
1447
-
1448
- @layer components {
1449
- .leaf-empty {
1450
- --leaf-empty-image-size: 100px;
1451
- --leaf-empty-description-size: var(--body-3-size);
1452
- --leaf-empty-description-line-height: var(--body-3-line-height);
1453
-
1454
- box-sizing: border-box;
1455
- display: flex;
1456
- flex-direction: column;
1457
- align-items: center;
1458
- justify-content: center;
1459
- gap: 16px;
1460
- width: 100%;
1461
- height: 100%;
1462
- margin: 0;
1463
- padding: 0;
1464
- text-align: center;
1465
- }
1466
-
1467
- .leaf-empty[data-size="sm"] {
1468
- --leaf-empty-image-size: 64px;
1469
- --leaf-empty-description-size: var(--body-4-size);
1470
- --leaf-empty-description-line-height: var(--body-4-line-height);
1471
- gap: 12px;
1472
- }
1473
-
1474
- .leaf-empty[data-size="md"],
1475
- .leaf-empty:not([data-size]) {
1476
- --leaf-empty-image-size: 100px;
1477
- --leaf-empty-description-size: var(--body-3-size);
1478
- --leaf-empty-description-line-height: var(--body-3-line-height);
1479
- }
1480
-
1481
- .leaf-empty__image {
1482
- display: flex;
1483
- flex-shrink: 0;
1484
- align-items: center;
1485
- justify-content: center;
1486
- width: var(--leaf-empty-image-size);
1487
- height: var(--leaf-empty-image-size);
1488
- overflow: hidden;
1489
- }
1490
-
1491
- .leaf-empty__image > img {
1492
- display: block;
1493
- width: 100%;
1494
- height: 100%;
1495
- max-width: 100%;
1496
- max-height: 100%;
1497
- object-fit: contain;
1498
- }
1499
-
1500
- .leaf-empty__description {
1501
- max-width: 28rem;
1502
- margin: 0;
1503
- color: var(--text-secondary);
1504
- font-size: var(--leaf-empty-description-size);
1505
- line-height: var(--leaf-empty-description-line-height);
1506
- font-weight: var(--body-3-weight);
1507
- overflow-wrap: anywhere;
1508
- }
1509
- }
1510
-
1511
- /* --- src/components/FileViewer/file-viewer.css --- */
1512
-
1513
- /*
1514
- * FileViewer — xem file (PDF native, ảnh, video / audio, text, CSV / XLSX, DOCX) không thư viện ngoài.
1515
- *
1516
- * Root `.leaf-file-viewer`: data-state (idle · loading · ready · error · unsupported · external),
1517
- * data-kind (pdf · image · …), data-fullscreen. Toàn bộ DOM bên trong do controller
1518
- * (core/file/viewer.ts) dựng — React và leaf.js cùng markup. Nút toolbar là `Button` ghost sm,
1519
- * loading là `Spinner`, sheet trống là `Empty` — cần import thêm button.css / spinner.css /
1520
- * empty.css (hoặc styles.css).
1521
- *
1522
- * Kích thước: root theo `--leaf-file-viewer-height` (mặc định 480px), width 100%.
1523
- */
1524
-
1525
- @layer components {
1526
- .leaf-file-viewer {
1527
- --leaf-file-viewer-height: 480px;
1528
- --leaf-file-viewer-radius: 12px;
1529
- --leaf-file-viewer-border: var(--base-tertiary);
1530
- --leaf-file-viewer-surface: var(--base-primary);
1531
- --leaf-file-viewer-chrome: var(--base-secondary);
1532
- --leaf-file-viewer-grid-line: var(--base-tertiary);
1533
-
1534
- position: relative;
1535
- display: flex;
1536
- flex-direction: column;
1537
- box-sizing: border-box;
1538
- width: 100%;
1539
- height: var(--leaf-file-viewer-height);
1540
- min-height: 0;
1541
- overflow: hidden;
1542
- border: 1px solid var(--leaf-file-viewer-border);
1543
- border-radius: var(--leaf-file-viewer-radius);
1544
- background-color: var(--leaf-file-viewer-surface);
1545
- color: var(--text-primary);
1546
- font-family: var(--font-sans);
1547
- }
1548
-
1549
- /* Trong Dialog: lấp đầy body. */
1550
- .leaf-dialog__body > .leaf-file-viewer {
1551
- flex: 1 1 auto;
1552
- }
1553
-
1554
- .leaf-file-viewer[data-fullscreen="true"] {
1555
- height: 100%;
1556
- border: none;
1557
- border-radius: 0;
1558
- }
1559
-
1560
- .leaf-file-viewer__toolbar {
1561
- display: flex;
1562
- flex-shrink: 0;
1563
- align-items: center;
1564
- gap: 12px;
1565
- box-sizing: border-box;
1566
- min-height: 44px;
1567
- padding: 6px 8px 6px 16px;
1568
- border-bottom: 1px solid var(--leaf-file-viewer-border);
1569
- background-color: var(--leaf-file-viewer-chrome);
1570
- }
1571
-
1572
- .leaf-file-viewer__name {
1573
- flex: 1 1 auto;
1574
- min-width: 0;
1575
- overflow: hidden;
1576
- color: var(--text-primary);
1577
- text-overflow: ellipsis;
1578
- white-space: nowrap;
1579
- }
1580
-
1581
- .leaf-file-viewer__actions {
1582
- display: flex;
1583
- flex-shrink: 0;
1584
- align-items: center;
1585
- gap: 4px;
1586
- max-width: 70%;
1587
- overflow-x: auto;
1588
- scrollbar-width: none;
1589
- }
1590
-
1591
- .leaf-file-viewer__actions::-webkit-scrollbar {
1592
- display: none;
1593
- }
1594
-
1595
- .leaf-file-viewer__zoom {
1596
- min-width: 44px;
1597
- color: var(--text-secondary);
1598
- text-align: center;
1599
- font-variant-numeric: tabular-nums;
1600
- }
1601
-
1602
- .leaf-file-viewer__body {
1603
- position: relative;
1604
- display: flex;
1605
- flex: 1 1 auto;
1606
- min-height: 0;
1607
- }
1608
-
1609
- .leaf-file-viewer__content {
1610
- --leaf-file-viewer-zoom: 1;
1611
-
1612
- position: relative;
1613
- flex: 1 1 auto;
1614
- min-width: 0;
1615
- min-height: 0;
1616
- overflow: auto;
1617
- outline: none;
1618
- }
1619
-
1620
- .leaf-file-viewer__content:focus-visible {
1621
- outline: 2px solid var(--text-highlight);
1622
- outline-offset: -2px;
1623
- }
1624
-
1625
- /* ── Trạng thái: loading · error · unsupported · external · idle ── */
1626
-
1627
- .leaf-file-viewer__state {
1628
- position: absolute;
1629
- inset: 0;
1630
- display: flex;
1631
- flex-direction: column;
1632
- align-items: center;
1633
- justify-content: center;
1634
- gap: 8px;
1635
- box-sizing: border-box;
1636
- padding: 24px;
1637
- text-align: center;
1638
- }
1639
-
1640
- .leaf-file-viewer__state-icon {
1641
- display: inline-flex;
1642
- width: 40px;
1643
- height: 40px;
1644
- margin-bottom: 4px;
1645
- color: var(--text-tertiary);
1646
- }
1647
-
1648
- .leaf-file-viewer__state[data-variant="error"] .leaf-file-viewer__state-icon {
1649
- color: var(--system-red);
1650
- }
1651
-
1652
- .leaf-file-viewer__state-icon > svg {
1653
- display: block;
1654
- width: 100%;
1655
- height: 100%;
1656
- }
1657
-
1658
- .leaf-file-viewer__message {
1659
- margin: 0;
1660
- color: var(--text-primary);
1661
- }
1662
-
1663
- .leaf-file-viewer__detail {
1664
- max-width: 100%;
1665
- margin: 0;
1666
- overflow: hidden;
1667
- color: var(--text-tertiary);
1668
- text-overflow: ellipsis;
1669
- white-space: nowrap;
1670
- }
1671
-
1672
- .leaf-file-viewer__state-actions {
1673
- display: flex;
1674
- flex-wrap: wrap;
1675
- justify-content: center;
1676
- gap: 8px;
1677
- margin-top: 8px;
1678
- }
1679
-
1680
- /* ── Ảnh ── */
1681
-
1682
- .leaf-file-viewer__stage {
1683
- display: flex;
1684
- align-items: center;
1685
- justify-content: center;
1686
- box-sizing: border-box;
1687
- width: 100%;
1688
- height: 100%;
1689
- padding: 16px;
1690
- overflow: hidden;
1691
- touch-action: none;
1692
- }
1693
-
1694
- .leaf-file-viewer__stage[data-zoomed="true"] {
1695
- cursor: grab;
1696
- }
1697
-
1698
- .leaf-file-viewer__stage[data-dragging="true"] {
1699
- cursor: grabbing;
1700
- user-select: none;
1701
- -webkit-user-select: none;
1702
- }
1703
-
1704
- .leaf-file-viewer__image {
1705
- display: block;
1706
- max-width: 100%;
1707
- max-height: 100%;
1708
- object-fit: contain;
1709
- transform-origin: center;
1710
- transition: transform 0.15s ease-out;
1711
- user-select: none;
1712
- -webkit-user-select: none;
1713
- }
1714
-
1715
- .leaf-file-viewer__stage[data-dragging="true"] .leaf-file-viewer__image {
1716
- transition: none;
1717
- }
1718
-
1719
- /* ── Video / audio / PDF ── */
1720
-
1721
- .leaf-file-viewer__media {
1722
- display: block;
1723
- width: 100%;
1724
- max-height: 100%;
1725
- background-color: var(--leaf-file-viewer-chrome);
1726
- }
1727
-
1728
- audio.leaf-file-viewer__media {
1729
- width: calc(100% - 32px);
1730
- margin: 16px;
1731
- background-color: transparent;
1732
- }
1733
-
1734
- .leaf-file-viewer__frame {
1735
- display: block;
1736
- width: 100%;
1737
- height: 100%;
1738
- border: none;
1739
- background-color: var(--leaf-file-viewer-chrome);
1740
- }
1741
-
1742
- /* ── Text ── */
1743
-
1744
- .leaf-file-viewer__text {
1745
- box-sizing: border-box;
1746
- min-height: 100%;
1747
- margin: 0;
1748
- padding: 16px;
1749
- color: var(--text-primary);
1750
- font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
1751
- font-size: calc(var(--body-4-size) * var(--leaf-file-viewer-zoom));
1752
- line-height: 1.6;
1753
- white-space: pre-wrap;
1754
- overflow-wrap: anywhere;
1755
- tab-size: 4;
1756
- }
1757
-
1758
- /* ── Bảng tính ── */
1759
-
1760
- .leaf-file-viewer__table {
1761
- --leaf-file-viewer-row-height: 28px;
1762
-
1763
- border-collapse: separate;
1764
- border-spacing: 0;
1765
- table-layout: fixed;
1766
- color: var(--text-primary);
1767
- }
1768
-
1769
- .leaf-file-viewer__table th,
1770
- .leaf-file-viewer__table td {
1771
- box-sizing: border-box;
1772
- height: var(--leaf-file-viewer-row-height);
1773
- padding: 0 8px;
1774
- overflow: hidden;
1775
- border-right: 1px solid var(--leaf-file-viewer-grid-line);
1776
- border-bottom: 1px solid var(--leaf-file-viewer-grid-line);
1777
- text-align: left;
1778
- text-overflow: ellipsis;
1779
- white-space: nowrap;
1780
- }
1781
-
1782
- .leaf-file-viewer__table thead th {
1783
- position: sticky;
1784
- top: 0;
1785
- z-index: 2;
1786
- background-color: var(--leaf-file-viewer-chrome);
1787
- color: var(--text-secondary);
1788
- font-weight: inherit;
1789
- text-align: center;
1790
- }
1791
-
1792
- .leaf-file-viewer__table tbody th {
1793
- position: sticky;
1794
- left: 0;
1795
- z-index: 1;
1796
- background-color: var(--leaf-file-viewer-chrome);
1797
- color: var(--text-secondary);
1798
- font-weight: inherit;
1799
- text-align: center;
1800
- }
1801
-
1802
- .leaf-file-viewer__table thead .leaf-file-viewer__corner {
1803
- left: 0;
1804
- z-index: 3;
1805
- }
1806
-
1807
- .leaf-file-viewer__table td[data-type="n"],
1808
- .leaf-file-viewer__table td[data-type="d"] {
1809
- text-align: right;
1810
- font-variant-numeric: tabular-nums;
1811
- }
1812
-
1813
- .leaf-file-viewer__table td[data-type="b"],
1814
- .leaf-file-viewer__table td[data-type="e"] {
1815
- text-align: center;
1816
- }
1817
-
1818
- .leaf-file-viewer__table td[data-type="e"] {
1819
- color: var(--system-red);
1820
- }
1821
-
1822
- .leaf-file-viewer__table td[rowspan],
1823
- .leaf-file-viewer__table td[colspan] {
1824
- vertical-align: middle;
1825
- }
1826
-
1827
- .leaf-file-viewer__spacer td {
1828
- padding: 0;
1829
- border: none;
1830
- }
1831
-
1832
- .leaf-file-viewer__sheets {
1833
- display: flex;
1834
- flex-shrink: 0;
1835
- gap: 2px;
1836
- padding: 0 8px;
1837
- overflow-x: auto;
1838
- border-top: 1px solid var(--leaf-file-viewer-border);
1839
- background-color: var(--leaf-file-viewer-chrome);
1840
- scrollbar-width: thin;
1841
- }
1842
-
1843
- .leaf-file-viewer__sheet {
1844
- flex-shrink: 0;
1845
- box-sizing: border-box;
1846
- height: 36px;
1847
- margin: 0;
1848
- padding: 0 14px;
1849
- border: none;
1850
- border-top: 2px solid transparent;
1851
- background: none;
1852
- color: var(--text-secondary);
1853
- font-family: inherit;
1854
- white-space: nowrap;
1855
- cursor: pointer;
1856
- }
1857
-
1858
- .leaf-file-viewer__sheet:hover {
1859
- color: var(--text-primary);
1860
- }
1861
-
1862
- .leaf-file-viewer__sheet[aria-selected="true"] {
1863
- border-top-color: var(--text-highlight);
1864
- background-color: var(--leaf-file-viewer-surface);
1865
- color: var(--text-primary);
1866
- }
1867
-
1868
- .leaf-file-viewer__sheet:focus-visible {
1869
- outline: 2px solid var(--text-highlight);
1870
- outline-offset: -2px;
1871
- }
1872
-
1873
- /* ── DOCX ── */
1874
-
1875
- .leaf-file-viewer__doc {
1876
- box-sizing: border-box;
1877
- padding: 24px 16px;
1878
- background-color: var(--leaf-file-viewer-chrome);
1879
- }
1880
-
1881
- /*
1882
- * Trang tài liệu giữ màu giấy in (nền trắng, chữ đen) ở cả light / dark — giống Word / bản in,
1883
- * màu chữ trong file (run color) được viết cho nền trắng. Override qua biến bên dưới.
1884
- */
1885
- .leaf-file-viewer__page {
1886
- --leaf-file-viewer-page-bg: #fff;
1887
- --leaf-file-viewer-page-fg: #1a1a1a;
1888
- --leaf-file-viewer-page-rule: #9a9a9a;
1889
- --leaf-file-viewer-page-link: #0b57d0;
1890
-
1891
- box-sizing: border-box;
1892
- width: 100%;
1893
- max-width: calc(794px * var(--leaf-file-viewer-zoom));
1894
- margin: 0 auto;
1895
- padding: calc(56px * var(--leaf-file-viewer-zoom)) calc(64px * var(--leaf-file-viewer-zoom));
1896
- border-radius: 4px;
1897
- /* Tài liệu Word luôn nền trắng chữ đen như bản in, kể cả dark mode. */
1898
- background-color: var(--leaf-file-viewer-page-bg);
1899
- color: var(--leaf-file-viewer-page-fg);
1900
- font-family: "Times New Roman", Times, serif;
1901
- font-size: calc(16px * var(--leaf-file-viewer-zoom));
1902
- line-height: 1.45;
1903
- overflow-wrap: anywhere;
1904
- box-shadow: 0 1px 4px rgb(0 0 0 / 0.12);
1905
- }
1906
-
1907
- .leaf-file-viewer__page + .leaf-file-viewer__page {
1908
- margin-top: 16px;
1909
- }
1910
-
1911
- .leaf-file-viewer__page p,
1912
- .leaf-file-viewer__page h1,
1913
- .leaf-file-viewer__page h2,
1914
- .leaf-file-viewer__page h3,
1915
- .leaf-file-viewer__page h4,
1916
- .leaf-file-viewer__page h5,
1917
- .leaf-file-viewer__page h6 {
1918
- margin: 0 0 0.6em;
1919
- }
1920
-
1921
- .leaf-file-viewer__page h1 {
1922
- font-size: 1.75em;
1923
- }
1924
-
1925
- .leaf-file-viewer__page h2 {
1926
- font-size: 1.4em;
1927
- }
1928
-
1929
- .leaf-file-viewer__page h3 {
1930
- font-size: 1.2em;
1931
- }
1932
-
1933
- .leaf-file-viewer__page table {
1934
- width: 100%;
1935
- margin: 0 0 0.8em;
1936
- border-collapse: collapse;
1937
- }
1938
-
1939
- .leaf-file-viewer__page td {
1940
- padding: 0.3em 0.5em;
1941
- border: 1px solid var(--leaf-file-viewer-page-rule);
1942
- vertical-align: top;
1943
- }
1944
-
1945
- .leaf-file-viewer__page td > p:last-child {
1946
- margin-bottom: 0;
1947
- }
1948
-
1949
- .leaf-file-viewer__page img {
1950
- max-width: 100%;
1951
- height: auto;
1952
- }
1953
-
1954
- .leaf-file-viewer__page a {
1955
- color: var(--leaf-file-viewer-page-link);
1956
- }
1957
-
1958
- .leaf-file-viewer__marker {
1959
- display: inline-block;
1960
- box-sizing: border-box;
1961
- padding-right: 0.35em;
1962
- text-indent: 0;
1963
- }
1964
-
1965
- /* `[hidden]` luôn ẩn — rule gốc set display. */
1966
- .leaf-file-viewer[hidden],
1967
- .leaf-file-viewer__toolbar[hidden],
1968
- .leaf-file-viewer__content[hidden],
1969
- .leaf-file-viewer__state[hidden],
1970
- .leaf-file-viewer__sheets[hidden] {
1971
- display: none;
1972
- }
1973
-
1974
- @media (max-width: 640px) {
1975
- .leaf-file-viewer__toolbar {
1976
- padding-left: 12px;
1977
- }
1978
-
1979
- .leaf-file-viewer__zoom {
1980
- display: none;
1981
- }
1982
-
1983
- .leaf-file-viewer__page {
1984
- padding: calc(24px * var(--leaf-file-viewer-zoom))
1985
- calc(20px * var(--leaf-file-viewer-zoom));
1986
- }
1987
- }
1988
-
1989
- /* FileViewerDialog có `footer`: viewer co giãn, hàng nút căn phải bên dưới. */
1990
- .leaf-file-viewer-dialog {
1991
- display: flex;
1992
- flex-direction: column;
1993
- gap: 16px;
1994
- height: 100%;
1995
- min-height: 0;
1996
- }
1997
-
1998
- .leaf-file-viewer-dialog > .leaf-file-viewer {
1999
- flex: 1 1 0;
2000
- min-height: 0;
2001
- }
2002
-
2003
- .leaf-file-viewer-dialog__footer {
2004
- display: flex;
2005
- flex-wrap: wrap;
2006
- justify-content: flex-end;
2007
- gap: 8px;
2008
- }
2009
- }
2010
-
2011
- /* --- src/components/Form/form.css --- */
2012
-
2013
- /*
2014
- * Form layout helpers — spacing cố định (Leaf không còn --spacing-*);
2015
- * gap khớp thang Figma spacing md (16px).
2016
- */
2017
-
2018
- @layer components {
2019
- .leaf-form {
2020
- display: flex;
2021
- flex-direction: column;
2022
- gap: 16px;
2023
- box-sizing: border-box;
2024
- width: 100%;
2025
- }
2026
-
2027
- .leaf-form--grid-2 {
2028
- display: grid;
2029
- grid-template-columns: repeat(2, minmax(0, 1fr));
2030
- gap: 16px;
2031
- align-items: start;
2032
- }
2033
-
2034
- .leaf-form--inline {
2035
- display: flex;
2036
- flex-direction: row;
2037
- flex-wrap: wrap;
2038
- gap: 16px;
2039
- align-items: flex-start;
2040
- }
2041
-
2042
- .leaf-form__field {
2043
- min-width: 0;
2044
- }
2045
-
2046
- .leaf-form[hidden],
2047
- .leaf-form--grid-2[hidden],
2048
- .leaf-form--inline[hidden] {
2049
- display: none;
2050
- }
2051
-
2052
- .leaf-form__field--span-2 {
2053
- grid-column: span 2;
2054
- }
2055
-
2056
- /* margin đủ 4 phía: <p> có margin mặc định của trình duyệt (lib không dựa vào CSS reset).
2057
- * Cách control 8px như message của Input. */
2058
- .leaf-form__message {
2059
- margin: 8px 0 0;
2060
- color: var(--system-red);
2061
- }
2062
-
2063
- /* Sau control dạng khung (MultiSelect…): thụt 12px cho thẳng chữ trong trigger, như Input. */
2064
- .leaf-form__field > .leaf-dropdown + .leaf-form__message {
2065
- padding-left: 12px;
2066
- }
2067
-
2068
- .leaf-form__message:not([data-invalid]) {
2069
- color: var(--text-secondary);
2070
- }
2071
- }
2072
-
2073
- /* --- src/components/Input/input-date.css --- */
2074
-
2075
- /*
2076
- * InputDate — Input trigger + popover Calendar.
2077
- *
2078
- * Popover neo theo khung trigger: dưới (data-placement="bottom", top = đáy khung qua
2079
- * --leaf-input-date-offset do React đo) hoặc lật lên trên (data-placement="top"). data-align
2080
- * căn trái / phải. data-open giữ viền + label highlight khi panel mở (invalid vẫn thắng).
2081
- * Phụ thuộc input.css + calendar.css.
2082
- */
2083
-
2084
- @layer components {
2085
- .leaf-input-date {
2086
- position: relative;
2087
- }
2088
-
2089
- .leaf-input-date__popover {
2090
- position: absolute;
2091
- z-index: var(--leaf-z-popover, 100);
2092
- }
2093
-
2094
- .leaf-input-date__popover[data-placement="bottom"] {
2095
- top: calc(var(--leaf-input-date-offset, 100%) + 8px);
2096
- }
2097
-
2098
- .leaf-input-date__popover[data-placement="top"] {
2099
- bottom: calc(100% + 8px);
2100
- }
2101
-
2102
- .leaf-input-date__popover[data-align="start"] {
2103
- left: 0;
2104
- }
2105
-
2106
- .leaf-input-date__popover[data-align="end"] {
2107
- right: 0;
2108
- }
2109
-
2110
- .leaf-input-date[data-open="true"] .leaf-input:not([data-invalid="true"]) {
2111
- --leaf-input-border: var(--text-highlight);
2112
- --leaf-input-label: var(--text-highlight);
2113
- }
2114
-
2115
- .leaf-input-date[hidden] {
2116
- display: none;
2117
- }
2118
- }
2119
-
2120
- /* --- src/components/Input/input-otp.css --- */
2121
-
2122
- /*
2123
- * InputOtp — Figma 1146:2159 (PIN code).
2124
- *
2125
- * Ô 48×56, nền base-tertiary, chữ số heading-3. Focus → viền highlight; data-invalid → viền
2126
- * đỏ mọi ô + message đỏ; data-disabled / :disabled → chữ secondary. Typography
2127
- * (heading-3, body-5) là class Leaf trên markup.
2128
- * HTML tĩnh: hành vi nhảy ô / dán nằm trong leaf.js (`data-leaf-input-otp`).
2129
- */
2130
-
2131
- @layer components {
2132
- .leaf-input-otp {
2133
- --leaf-input-otp-cell-width: 48px;
2134
- --leaf-input-otp-cell-height: 56px;
2135
- --leaf-input-otp-border: transparent;
2136
- --leaf-input-otp-message: var(--text-secondary);
2137
-
2138
- display: flex;
2139
- flex-direction: column;
2140
- gap: 8px;
2141
- }
2142
-
2143
- .leaf-input-otp__cells {
2144
- display: flex;
2145
- gap: 4px;
2146
- }
2147
-
2148
- .leaf-input-otp__cell {
2149
- box-sizing: border-box;
2150
- width: var(--leaf-input-otp-cell-width);
2151
- height: var(--leaf-input-otp-cell-height);
2152
- margin: 0;
2153
- padding: 0;
2154
- border: 1px solid var(--leaf-input-otp-border);
2155
- border-radius: 12px;
2156
- outline: none;
2157
- background-color: var(--base-tertiary);
2158
- color: var(--text-primary);
2159
- text-align: center;
2160
- caret-color: var(--text-highlight);
2161
- appearance: none;
2162
- -webkit-appearance: none;
2163
- transition: border-color 0.15s ease;
2164
- }
2165
-
2166
- .leaf-input-otp__cell:focus {
2167
- border-color: var(--text-highlight);
2168
- }
2169
-
2170
- .leaf-input-otp[data-invalid="true"] .leaf-input-otp__cell {
2171
- border-color: var(--system-red);
2172
- }
2173
-
2174
- .leaf-input-otp__cell:disabled {
2175
- color: var(--text-secondary);
2176
- cursor: not-allowed;
2177
- }
2178
-
2179
- .leaf-input-otp__message {
2180
- margin: 0;
2181
- color: var(--leaf-input-otp-message);
2182
- }
2183
-
2184
- .leaf-input-otp[data-invalid="true"] {
2185
- --leaf-input-otp-message: var(--system-red);
2186
- }
2187
-
2188
- .leaf-input-otp[hidden],
2189
- .leaf-input-otp__cells[hidden] {
2190
- display: none;
2191
- }
2192
- }
2193
-
2194
- /* --- src/components/Input/input-stepper.css --- */
2195
-
2196
- /*
2197
- * InputStepper — Figma 1146:2159 (Buy / Sell).
2198
- *
2199
- * Tone qua data-tone (buy | sell — không có → base-tertiary); state qua :focus-within,
2200
- * data-invalid, data-disabled, data-filled. Nền 280 × (py 4 · px 12), radius 12; icon −/+ 20px.
2201
- * Label body-5 (secondary → primary khi focus), giá trị body-4-highlight (placeholder
2202
- * secondary, đã nhập primary). Typography là class Leaf trên markup.
2203
- * HTML tĩnh: −/+, mũi tên, format số nằm trong leaf.js (`data-leaf-input-stepper`).
2204
- */
2205
-
2206
- @layer components {
2207
- .leaf-input-stepper {
2208
- --leaf-input-stepper-width: 280px;
2209
- --leaf-input-stepper-bg: var(--base-tertiary);
2210
- --leaf-input-stepper-focus: var(--text-highlight);
2211
- --leaf-input-stepper-border: transparent;
2212
- --leaf-input-stepper-label: var(--text-secondary);
2213
- --leaf-input-stepper-fg: var(--text-primary);
2214
- --leaf-input-stepper-icon: var(--text-primary);
2215
- --leaf-input-stepper-message: var(--text-secondary);
2216
-
2217
- display: flex;
2218
- flex-direction: column;
2219
- gap: 4px;
2220
- width: var(--leaf-input-stepper-width);
2221
- max-width: 100%;
2222
- }
2223
-
2224
- .leaf-input-stepper[data-tone="buy"] {
2225
- --leaf-input-stepper-bg: var(--system-green-secondary);
2226
- }
2227
-
2228
- .leaf-input-stepper[data-tone="sell"] {
2229
- --leaf-input-stepper-bg: var(--system-red-secondary);
2230
- --leaf-input-stepper-focus: var(--system-red);
2231
- }
2232
-
2233
- .leaf-input-stepper__shell {
2234
- display: flex;
2235
- align-items: center;
2236
- gap: 8px;
2237
- box-sizing: border-box;
2238
- padding: 4px 12px;
2239
- border: 1px solid var(--leaf-input-stepper-border);
2240
- border-radius: 12px;
2241
- background-color: var(--leaf-input-stepper-bg);
2242
- cursor: text;
2243
- transition: border-color 0.15s ease;
2244
- }
2245
-
2246
- .leaf-input-stepper__body {
2247
- display: flex;
2248
- flex: 1;
2249
- flex-direction: column;
2250
- align-items: center;
2251
- justify-content: center;
2252
- gap: 4px;
2253
- min-width: 0;
2254
- }
2255
-
2256
- .leaf-input-stepper__value {
2257
- display: inline-flex;
2258
- align-items: center;
2259
- justify-content: center;
2260
- gap: 2px;
2261
- min-width: 0;
2262
- }
2263
-
2264
- .leaf-input-stepper__label {
2265
- overflow: hidden;
2266
- text-overflow: ellipsis;
2267
- white-space: nowrap;
2268
- color: var(--leaf-input-stepper-label);
2269
- cursor: inherit;
2270
- transition: color 0.15s ease;
2271
- }
2272
-
2273
- .leaf-input-stepper__input {
2274
- box-sizing: border-box;
2275
- min-width: 0;
2276
- max-width: 100%;
2277
- margin: 0;
2278
- padding: 0;
2279
- border: none;
2280
- border-radius: 0;
2281
- outline: none;
2282
- background: transparent;
2283
- color: var(--leaf-input-stepper-fg);
2284
- text-align: center;
2285
- letter-spacing: inherit;
2286
- appearance: none;
2287
- -webkit-appearance: none;
2288
- }
2289
-
2290
- .leaf-input-stepper__input::placeholder {
2291
- color: var(--text-secondary);
2292
- opacity: 1;
2293
- }
2294
-
2295
- .leaf-input-stepper__unit {
2296
- color: var(--leaf-input-stepper-fg);
2297
- }
2298
-
2299
- .leaf-input-stepper__button {
2300
- display: inline-flex;
2301
- flex-shrink: 0;
2302
- align-items: center;
2303
- justify-content: center;
2304
- width: 20px;
2305
- height: 20px;
2306
- margin: 0;
2307
- padding: 0;
2308
- border: none;
2309
- background: transparent;
2310
- color: var(--leaf-input-stepper-icon);
2311
- font-size: 20px;
2312
- line-height: 1;
2313
- cursor: pointer;
2314
- appearance: none;
2315
- }
2316
-
2317
- .leaf-input-stepper__button > svg {
2318
- display: block;
2319
- width: 1em;
2320
- height: 1em;
2321
- }
2322
-
2323
- .leaf-input-stepper__button:disabled {
2324
- cursor: not-allowed;
2325
- }
2326
-
2327
- /* Chạm min / max (cả khối vẫn enabled) — mờ nút; disabled cả khối đã đổi màu icon. */
2328
- .leaf-input-stepper:not([data-disabled="true"]) .leaf-input-stepper__button:disabled {
2329
- opacity: 0.4;
2330
- }
2331
-
2332
- .leaf-input-stepper__message {
2333
- margin: 0;
2334
- padding-left: 4px;
2335
- color: var(--leaf-input-stepper-message);
2336
- }
2337
-
2338
- .leaf-input-stepper[hidden],
2339
- .leaf-input-stepper__shell[hidden],
2340
- .leaf-input-stepper__body[hidden],
2341
- .leaf-input-stepper__value[hidden],
2342
- .leaf-input-stepper__button[hidden] {
2343
- display: none;
2344
- }
2345
-
2346
- /* ── State ───────────────────────────────────────────────────────────── */
2347
-
2348
- .leaf-input-stepper:focus-within {
2349
- --leaf-input-stepper-border: var(--leaf-input-stepper-focus);
2350
- --leaf-input-stepper-label: var(--text-primary);
2351
- }
2352
-
2353
- .leaf-input-stepper[data-invalid="true"] {
2354
- --leaf-input-stepper-border: var(--system-red);
2355
- --leaf-input-stepper-message: var(--system-red);
2356
- }
2357
-
2358
- .leaf-input-stepper[data-disabled="true"] {
2359
- --leaf-input-stepper-border: transparent;
2360
- --leaf-input-stepper-label: var(--text-tertiary);
2361
- --leaf-input-stepper-fg: var(--text-secondary);
2362
- --leaf-input-stepper-icon: var(--text-secondary);
2363
- }
2364
-
2365
- .leaf-input-stepper[data-disabled="true"] .leaf-input-stepper__shell,
2366
- .leaf-input-stepper[data-disabled="true"] .leaf-input-stepper__input {
2367
- cursor: not-allowed;
2368
- }
2369
- }
2370
-
2371
- /* --- src/components/Input/input.css --- */
2372
-
2373
- /*
2374
- * Input — Figma 1146:2159 (String / CTA) + search / date trigger.
2375
- *
2376
- * Variant qua data-variant (field | inline) + data-shape (pill, chỉ inline); state qua
2377
- * :focus-within, data-invalid, data-disabled, data-filled trên root. Màu đổi theo state
2378
- * nên nằm ở đây (class màu Leaf ở layer utilities sẽ đè state nếu gắn lên markup).
2379
- * Typography (body-4, body-5-highlight) là class Leaf trên markup.
2380
- * Thiếu attribute → field · default · enabled.
2381
- */
2382
-
2383
- @layer components {
2384
- .leaf-input {
2385
- --leaf-input-bg: var(--base-tertiary);
2386
- --leaf-input-border: transparent;
2387
- --leaf-input-radius: 12px;
2388
- --leaf-input-min-height: 56px;
2389
- --leaf-input-padding-y: 8px;
2390
- --leaf-input-padding-x: 12px;
2391
- --leaf-input-icon-size: 20px;
2392
- --leaf-input-label: var(--text-tertiary);
2393
- --leaf-input-fg: var(--text-primary);
2394
- --leaf-input-icon: var(--text-primary);
2395
- --leaf-input-placeholder: var(--text-tertiary);
2396
- --leaf-input-message: var(--text-secondary);
2397
-
2398
- display: flex;
2399
- flex-direction: column;
2400
- gap: 8px;
2401
- min-width: 0;
2402
- }
2403
-
2404
- .leaf-input__shell {
2405
- display: flex;
2406
- align-items: center;
2407
- gap: 8px;
2408
- box-sizing: border-box;
2409
- min-height: var(--leaf-input-min-height);
2410
- padding: var(--leaf-input-padding-y) var(--leaf-input-padding-x);
2411
- border: 1px solid var(--leaf-input-border);
2412
- border-radius: var(--leaf-input-radius);
2413
- background-color: var(--leaf-input-bg);
2414
- cursor: text;
2415
- transition: border-color 0.15s ease;
2416
- }
2417
-
2418
- .leaf-input__body {
2419
- display: flex;
2420
- flex: 1;
2421
- flex-direction: column;
2422
- gap: 4px;
2423
- min-width: 0;
2424
- }
2425
-
2426
- .leaf-input__main {
2427
- display: flex;
2428
- align-items: center;
2429
- gap: 8px;
2430
- }
2431
-
2432
- .leaf-input__label {
2433
- overflow: hidden;
2434
- text-overflow: ellipsis;
2435
- white-space: nowrap;
2436
- color: var(--leaf-input-label);
2437
- cursor: inherit;
2438
- transition: color 0.15s ease;
2439
- }
2440
-
2441
- .leaf-input__control {
2442
- flex: 1;
2443
- min-width: 0;
2444
- box-sizing: border-box;
2445
- margin: 0;
2446
- padding: 0;
2447
- border: none;
2448
- border-radius: 0;
2449
- outline: none;
2450
- background: transparent;
2451
- color: var(--leaf-input-fg);
2452
- letter-spacing: inherit;
2453
- appearance: none;
2454
- -webkit-appearance: none;
2455
- }
2456
-
2457
- .leaf-input__control::placeholder,
2458
- .leaf-input__placeholder {
2459
- color: var(--leaf-input-placeholder);
2460
- opacity: 1;
2461
- }
2462
-
2463
- button.leaf-input__control {
2464
- overflow: hidden;
2465
- text-overflow: ellipsis;
2466
- white-space: nowrap;
2467
- text-align: left;
2468
- cursor: pointer;
2469
- }
2470
-
2471
- .leaf-input__control::-webkit-search-cancel-button,
2472
- .leaf-input__control::-webkit-search-decoration {
2473
- -webkit-appearance: none;
2474
- }
2475
-
2476
- .leaf-input__icon,
2477
- .leaf-input__reveal {
2478
- display: inline-flex;
2479
- flex-shrink: 0;
2480
- align-items: center;
2481
- justify-content: center;
2482
- width: var(--leaf-input-icon-size);
2483
- height: var(--leaf-input-icon-size);
2484
- font-size: var(--leaf-input-icon-size);
2485
- line-height: 1;
2486
- color: var(--leaf-input-icon);
2487
- }
2488
-
2489
- .leaf-input__icon > svg,
2490
- .leaf-input__reveal > svg {
2491
- display: block;
2492
- width: 1em;
2493
- height: 1em;
2494
- }
2495
-
2496
- .leaf-input__reveal {
2497
- margin: 0;
2498
- padding: 0;
2499
- border: none;
2500
- background: transparent;
2501
- cursor: pointer;
2502
- appearance: none;
2503
- }
2504
-
2505
- .leaf-input__reveal:focus-visible {
2506
- outline: 2px solid var(--text-highlight);
2507
- outline-offset: 2px;
2508
- border-radius: 4px;
2509
- }
2510
-
2511
- .leaf-input__action {
2512
- display: inline-flex;
2513
- flex-shrink: 0;
2514
- align-items: center;
2515
- }
2516
-
2517
- .leaf-input__message {
2518
- margin: 0;
2519
- padding-left: 12px;
2520
- color: var(--leaf-input-message);
2521
- }
2522
-
2523
- .leaf-input[hidden],
2524
- .leaf-input__shell[hidden],
2525
- .leaf-input__body[hidden],
2526
- .leaf-input__main[hidden],
2527
- .leaf-input__icon[hidden],
2528
- .leaf-input__reveal[hidden],
2529
- .leaf-input__action[hidden] {
2530
- display: none;
2531
- }
2532
-
2533
- /* ── State ───────────────────────────────────────────────────────────── */
2534
-
2535
- .leaf-input[data-filled="true"] {
2536
- --leaf-input-label: var(--text-primary);
2537
- }
2538
-
2539
- .leaf-input:focus-within {
2540
- --leaf-input-border: var(--text-highlight);
2541
- --leaf-input-label: var(--text-highlight);
2542
- }
2543
-
2544
- .leaf-input[data-invalid="true"] {
2545
- --leaf-input-border: var(--system-red);
2546
- --leaf-input-label: var(--system-red);
2547
- --leaf-input-message: var(--system-red);
2548
- }
2549
-
2550
- .leaf-input[data-disabled="true"] {
2551
- --leaf-input-border: transparent;
2552
- --leaf-input-label: var(--text-tertiary);
2553
- --leaf-input-fg: var(--text-secondary);
2554
- --leaf-input-icon: var(--text-secondary);
2555
- }
2556
-
2557
- .leaf-input[data-disabled="true"] .leaf-input__shell,
2558
- .leaf-input[data-disabled="true"] .leaf-input__control {
2559
- cursor: not-allowed;
2560
- }
2561
-
2562
- /* ── Variant inline (search) ─────────────────────────────────────────── */
2563
-
2564
- .leaf-input[data-variant="inline"] {
2565
- --leaf-input-bg: var(--base-secondary);
2566
- --leaf-input-border: var(--base-quaternary);
2567
- --leaf-input-min-height: 36px;
2568
- --leaf-input-padding-y: 6px;
2569
- --leaf-input-icon-size: 16px;
2570
- --leaf-input-placeholder: var(--text-secondary);
2571
- }
2572
-
2573
- .leaf-input[data-variant="inline"]:focus-within {
2574
- --leaf-input-border: var(--text-highlight);
2575
- }
2576
-
2577
- .leaf-input[data-variant="inline"][data-invalid="true"] {
2578
- --leaf-input-border: var(--system-red);
2579
- }
2580
-
2581
- .leaf-input[data-variant="inline"][data-shape="pill"] {
2582
- --leaf-input-bg: transparent;
2583
- --leaf-input-radius: 9999px;
2584
- }
2585
- }
2586
-
2587
- /* --- src/components/Logo/logo.css --- */
2588
-
2589
- /*
2590
- * Logo — Figma 924:1074.
2591
- *
2592
- * React: chọn SVG trong assets.ts, render <img class="leaf-logo__img">.
2593
- * HTML tĩnh: span.leaf-logo:empty + data-brand / data-mode / data-side — rule
2594
- * background-image nằm ở logo-assets.css (generated bởi scripts/embed-logo-assets.mjs,
2595
- * không gộp vào classes.css / styles.css; bản CDN đã gộp sẵn).
2596
- * Size (chiều cao) qua --leaf-logo-size.
2597
- */
2598
-
2599
- @layer components {
2600
- .leaf-logo {
2601
- display: inline-flex;
2602
- flex-shrink: 0;
2603
- align-items: center;
2604
- justify-content: center;
2605
- vertical-align: middle;
2606
- margin: 0;
2607
- padding: 0;
2608
- border: none;
2609
- background: transparent;
2610
- background-repeat: no-repeat;
2611
- background-position: center;
2612
- background-size: contain;
2613
- line-height: 0;
2614
- box-sizing: border-box;
2615
- }
2616
-
2617
- /* HTML tĩnh — không có <img>, asset lấy từ data-* */
2618
- .leaf-logo:empty {
2619
- display: inline-block;
2620
- height: var(--leaf-logo-size, 40px);
2621
- width: calc(var(--leaf-logo-size, 40px) * var(--leaf-logo-aspect, 1));
2622
- }
2623
-
2624
- .leaf-logo__img {
2625
- display: block;
2626
- height: var(--leaf-logo-size, 40px);
2627
- width: auto;
2628
- max-width: 100%;
2629
- }
2630
-
2631
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
2632
- .leaf-logo[hidden] {
2633
- display: none;
2634
- }
2635
- }
2636
-
2637
- /* --- src/components/MultiSelect/multiselect.css --- */
2638
-
2639
- /*
2640
- * MultiSelect — chip trên trigger + filter trong panel.
2641
- * Panel / option dùng class `leaf-dropdown*` từ dropdown.css. Rule đè class của Dropdown scope
2642
- * dưới `.leaf-multiselect` để thắng bằng specificity, không phụ thuộc thứ tự import file CSS.
2643
- */
2644
-
2645
- @layer components {
2646
- .leaf-multiselect__chips[hidden],
2647
- .leaf-multiselect__chip[hidden],
2648
- .leaf-multiselect__chip-remove[hidden],
2649
- .leaf-multiselect__chip-icon[hidden],
2650
- .leaf-multiselect__options[hidden],
2651
- .leaf-multiselect .leaf-multiselect__panel[hidden] {
2652
- display: none;
2653
- }
2654
-
2655
- .leaf-multiselect .leaf-dropdown__trigger[aria-disabled="true"] {
2656
- cursor: not-allowed;
2657
- color: var(--text-tertiary);
2658
- }
2659
-
2660
- .leaf-multiselect .leaf-dropdown__trigger[aria-disabled="true"] .leaf-dropdown__value,
2661
- .leaf-multiselect .leaf-dropdown__trigger[aria-disabled="true"] .leaf-dropdown__chevron {
2662
- color: var(--text-tertiary);
2663
- }
2664
-
2665
- .leaf-multiselect .leaf-dropdown__trigger[aria-disabled="true"] .leaf-multiselect__chip {
2666
- color: var(--text-tertiary);
2667
- }
2668
-
2669
- .leaf-multiselect .leaf-dropdown__value.leaf-multiselect__value {
2670
- overflow: visible;
2671
- text-overflow: unset;
2672
- white-space: normal;
2673
- }
2674
-
2675
- .leaf-multiselect__chips {
2676
- display: flex;
2677
- flex-wrap: wrap;
2678
- gap: 6px;
2679
- align-items: center;
2680
- min-width: 0;
2681
- /* Chip cao line-height + 2×2px padding: bù để trigger một hàng chip cao bằng lúc trống. */
2682
- margin-block: -2px;
2683
- }
2684
-
2685
- .leaf-multiselect__chip {
2686
- display: inline-flex;
2687
- align-items: center;
2688
- gap: 4px;
2689
- max-width: 100%;
2690
- padding: 2px 6px 2px 8px;
2691
- box-sizing: border-box;
2692
- border-radius: 8px;
2693
- background-color: var(--base-tertiary);
2694
- color: var(--text-primary);
2695
- font-weight: var(--leaf-dropdown-weight);
2696
- }
2697
-
2698
- .leaf-multiselect__chip-label {
2699
- min-width: 0;
2700
- overflow: hidden;
2701
- text-overflow: ellipsis;
2702
- white-space: nowrap;
2703
- }
2704
-
2705
- .leaf-multiselect__chip-remove {
2706
- display: inline-flex;
2707
- flex-shrink: 0;
2708
- align-items: center;
2709
- justify-content: center;
2710
- margin: 0;
2711
- padding: 0;
2712
- border: none;
2713
- border-radius: 4px;
2714
- background: transparent;
2715
- color: var(--text-secondary);
2716
- cursor: pointer;
2717
- }
2718
-
2719
- .leaf-multiselect__chip-remove:hover {
2720
- color: var(--text-primary);
2721
- }
2722
-
2723
- .leaf-multiselect__chip-icon {
2724
- display: block;
2725
- width: 14px;
2726
- height: 14px;
2727
- }
2728
-
2729
- .leaf-multiselect .leaf-multiselect__panel {
2730
- /* list là div bọc filter + ul — giữ cuộn trên toàn panel */
2731
- overflow: hidden;
2732
- display: flex;
2733
- flex-direction: column;
2734
- padding: 0;
2735
- }
2736
-
2737
- .leaf-multiselect__filter {
2738
- flex-shrink: 0;
2739
- padding: 8px 12px;
2740
- border-bottom: 1px solid var(--base-tertiary);
2741
- }
2742
-
2743
- .leaf-multiselect__filter-input {
2744
- width: 100%;
2745
- margin: 0;
2746
- padding: 6px 8px;
2747
- box-sizing: border-box;
2748
- border: 1px solid var(--base-quaternary);
2749
- border-radius: 8px;
2750
- background-color: var(--base-primary);
2751
- color: var(--text-primary);
2752
- font: inherit;
2753
- font-weight: var(--leaf-dropdown-weight);
2754
- outline: none;
2755
- }
2756
-
2757
- .leaf-multiselect__filter-input::placeholder {
2758
- color: var(--text-secondary);
2759
- }
2760
-
2761
- .leaf-multiselect__filter-input:focus {
2762
- border-color: var(--text-highlight);
2763
- }
2764
-
2765
- .leaf-multiselect__options {
2766
- display: flex;
2767
- flex-direction: column;
2768
- flex: 1 1 auto;
2769
- min-height: 0;
2770
- margin: 0;
2771
- padding: 0;
2772
- overflow-y: auto;
2773
- list-style: none;
2774
- }
2775
-
2776
- .leaf-multiselect .leaf-dropdown__option.leaf-multiselect__empty {
2777
- cursor: default;
2778
- color: var(--text-tertiary);
2779
- }
2780
- }
2781
-
2782
- /* --- src/components/Number/number.css --- */
2783
-
2784
- /*
2785
- * Number — thẻ span/data hiển thị số.
2786
- *
2787
- * Typography / màu chữ steady dùng class Leaf có sẵn (body-*, text-*).
2788
- * Flash realtime: data-flash + data-color → nền color-mix 70% token Leaf + chữ --text-primary.
2789
- */
2790
-
2791
- @layer components {
2792
- .leaf-number {
2793
- display: inline;
2794
- }
2795
-
2796
- .leaf-number[data-flash] {
2797
- color: var(--text-primary);
2798
- }
2799
-
2800
- .leaf-number[data-flash][data-color="highlight"] {
2801
- background-color: color-mix(in srgb, var(--text-highlight) 70%, transparent);
2802
- }
2803
-
2804
- .leaf-number[data-flash][data-color="blue"] {
2805
- background-color: color-mix(in srgb, var(--system-blue) 70%, transparent);
2806
- }
2807
-
2808
- .leaf-number[data-flash][data-color="green"] {
2809
- background-color: color-mix(in srgb, var(--system-green) 70%, transparent);
2810
- }
2811
-
2812
- .leaf-number[data-flash][data-color="yellow"] {
2813
- background-color: color-mix(in srgb, var(--system-yellow) 70%, transparent);
2814
- }
2815
-
2816
- .leaf-number[data-flash][data-color="orange"] {
2817
- background-color: color-mix(in srgb, var(--system-orange) 70%, transparent);
2818
- }
2819
-
2820
- .leaf-number[data-flash][data-color="red"] {
2821
- background-color: color-mix(in srgb, var(--system-red) 70%, transparent);
2822
- }
2823
-
2824
- .leaf-number[data-flash][data-color="purple"] {
2825
- background-color: color-mix(in srgb, var(--system-purple) 70%, transparent);
2826
- }
2827
-
2828
- .leaf-number[hidden] {
2829
- display: none;
2830
- }
2831
- }
2832
-
2833
- /* --- src/components/QrCode/qr-code.css --- */
2834
-
2835
- .leaf-qr-code {
2836
- display: inline-flex;
2837
- width: var(--leaf-qr-size, 192px);
2838
- height: var(--leaf-qr-size, 192px);
2839
- line-height: 0;
2840
- }
2841
-
2842
- .leaf-qr-code svg {
2843
- display: block;
2844
- width: 100%;
2845
- height: 100%;
2846
- }
2847
-
2848
- .leaf-qr-code__module {
2849
- fill: currentColor;
2850
- }
2851
-
2852
- /* --- src/components/Radio/radio.css --- */
2853
-
2854
- /*
2855
- * Radio — Figma 1146:2081.
2856
- *
2857
- * Size S/M/L (18 · 24 · 30) qua data-size; Selected qua `:checked` của input
2858
- * native; Disable qua `:disabled`. Input phủ kín vùng control (opacity 0) nên
2859
- * click / focus / FormData đều là của trình duyệt — HTML tĩnh không cần JS.
2860
- * Thiếu attribute → md · unchecked · enabled.
2861
- */
2862
-
2863
- @layer components {
2864
- .leaf-radio {
2865
- --leaf-radio-size: 24px;
2866
- --leaf-radio-ring: 1.5px;
2867
- --leaf-radio-color: var(--text-primary);
2868
-
2869
- position: relative;
2870
- display: inline-flex;
2871
- align-items: center;
2872
- gap: 8px;
2873
- vertical-align: middle;
2874
- cursor: pointer;
2875
- }
2876
-
2877
- .leaf-radio[data-size="sm"] {
2878
- --leaf-radio-size: 18px;
2879
- }
2880
-
2881
- .leaf-radio[data-size="lg"] {
2882
- --leaf-radio-size: 30px;
2883
- }
2884
-
2885
- .leaf-radio[hidden],
2886
- .leaf-radio__control[hidden] {
2887
- display: none;
2888
- }
2889
-
2890
- .leaf-radio__input {
2891
- position: absolute;
2892
- top: 0;
2893
- left: 0;
2894
- width: var(--leaf-radio-size);
2895
- height: var(--leaf-radio-size);
2896
- margin: 0;
2897
- padding: 0;
2898
- border: none;
2899
- opacity: 0;
2900
- cursor: inherit;
2901
- appearance: none;
2902
- -webkit-appearance: none;
2903
- }
2904
-
2905
- .leaf-radio__control {
2906
- display: inline-flex;
2907
- flex-shrink: 0;
2908
- align-items: center;
2909
- justify-content: center;
2910
- border-radius: 9999px;
2911
- box-sizing: border-box;
2912
- width: var(--leaf-radio-size);
2913
- height: var(--leaf-radio-size);
2914
- border: var(--leaf-radio-ring) solid var(--leaf-radio-color);
2915
- transition: border-color 0.15s ease;
2916
- }
2917
-
2918
- .leaf-radio__dot {
2919
- border-radius: 9999px;
2920
- width: 50%;
2921
- height: 50%;
2922
- background-color: var(--leaf-radio-color);
2923
- transform: scale(0);
2924
- transition: transform 0.15s ease;
2925
- }
2926
-
2927
- .leaf-radio__label {
2928
- color: var(--text-primary);
2929
- }
2930
-
2931
- /* Selected */
2932
- .leaf-radio__input:checked + .leaf-radio__control {
2933
- --leaf-radio-color: var(--text-highlight);
2934
- }
2935
-
2936
- .leaf-radio__input:checked + .leaf-radio__control .leaf-radio__dot {
2937
- transform: scale(1);
2938
- }
2939
-
2940
- /* Disable — ring / dot xám, label tertiary. */
2941
- .leaf-radio__input:disabled + .leaf-radio__control {
2942
- --leaf-radio-color: var(--base-quaternary);
2943
- }
2944
-
2945
- .leaf-radio__input:disabled ~ .leaf-radio__label {
2946
- color: var(--text-tertiary);
2947
- }
2948
-
2949
- .leaf-radio:has(.leaf-radio__input:disabled) {
2950
- cursor: not-allowed;
2951
- }
2952
-
2953
- .leaf-radio__input:focus-visible + .leaf-radio__control {
2954
- outline: 2px solid var(--text-highlight);
2955
- outline-offset: 2px;
2956
- }
2957
-
2958
- .leaf-radio-group {
2959
- display: flex;
2960
- flex-direction: column;
2961
- gap: 12px;
2962
- }
2963
-
2964
- .leaf-radio-group[data-orientation="horizontal"] {
2965
- flex-direction: row;
2966
- flex-wrap: wrap;
2967
- }
2968
-
2969
- .leaf-radio-group[hidden] {
2970
- display: none;
2971
- }
2972
- }
2973
-
2974
- /* --- src/components/Skeleton/skeleton.css --- */
2975
-
2976
- /*
2977
- * Skeleton — placeholder shimmer.
2978
- *
2979
- * Nền `--base-tertiary` (dark: #28292B). Kích thước / radius qua custom property
2980
- * từ React (hoặc style inline khi HTML tĩnh). Thiếu biến → full width/height,
2981
- * radius 12px.
2982
- */
2983
-
2984
- @layer components {
2985
- .leaf-skeleton {
2986
- --leaf-skeleton-width: 100%;
2987
- --leaf-skeleton-height: 100%;
2988
- --leaf-skeleton-radius: 12px;
2989
-
2990
- position: relative;
2991
- overflow: hidden;
2992
- box-sizing: border-box;
2993
- width: var(--leaf-skeleton-width);
2994
- height: var(--leaf-skeleton-height);
2995
- border-radius: var(--leaf-skeleton-radius);
2996
- background-color: var(--base-tertiary);
2997
- }
2998
-
2999
- .leaf-skeleton__shimmer {
3000
- position: absolute;
3001
- inset: 0;
3002
- background: linear-gradient(
3003
- to right,
3004
- transparent,
3005
- color-mix(in srgb, var(--base-quinary) 10%, transparent),
3006
- transparent
3007
- );
3008
- animation: leaf-skeleton-shimmer 2s infinite ease-in-out;
3009
- }
3010
-
3011
- /* Giảm chuyển động: bỏ shimmer, giữ nền placeholder tĩnh. */
3012
- @media (prefers-reduced-motion: reduce) {
3013
- .leaf-skeleton__shimmer {
3014
- display: none;
3015
- animation: none;
3016
- }
3017
- }
3018
- }
3019
-
3020
- @keyframes leaf-skeleton-shimmer {
3021
- 0% {
3022
- transform: translateX(-100%);
3023
- }
3024
- 100% {
3025
- transform: translateX(100%);
3026
- }
3027
- }
3028
-
3029
- /* --- src/components/Slider/slider.css --- */
3030
-
3031
- /*
3032
- * Slider — Figma 730:12646.
3033
- *
3034
- * Giá trị liên tục trên rail (kéo / click chính xác tới từng step — như
3035
- * TradeQuickSlider). Mốc chia đều đặt tuyệt đối theo `left: <%>`; thumb đặt ở
3036
- * `--leaf-slider-fill`. Ở min thumb = `--text-primary`; khi > min =
3037
- * `--leaf-slider-active` (mặc định `--text-highlight`). Prop / attribute `data-color`
3038
- * nhận hậu tố class `text-*` Leaf và map sang token tương ứng.
3039
- *
3040
- * Rail, mốc và thumb cùng nằm trong vùng lùi vào `--leaf-slider-inset` ở hai đầu
3041
- * (nửa thumb) — nhờ vậy `left: X%` của cả ba khớp nhau và thumb không tràn ra ngoài.
3042
- */
3043
-
3044
- @layer components {
3045
- .leaf-slider {
3046
- --leaf-slider-active: var(--text-highlight);
3047
- --leaf-slider-fill: 0%;
3048
- --leaf-slider-mark: 6px;
3049
- --leaf-slider-mark-active: 10px;
3050
- --leaf-slider-rail-height: 2px;
3051
- --leaf-slider-inset: calc(var(--leaf-slider-mark-active) / 2);
3052
- --leaf-slider-control-height: max(
3053
- var(--leaf-slider-mark-active),
3054
- var(--leaf-slider-mark),
3055
- 20px
3056
- );
3057
-
3058
- display: flex;
3059
- flex-direction: column;
3060
- gap: 8px;
3061
- width: 100%;
3062
- box-sizing: border-box;
3063
- font-family: var(--font-sans);
3064
- font-size: var(--body-5-size);
3065
- line-height: var(--body-5-line-height);
3066
- font-weight: var(--body-5-weight);
3067
- color: var(--text-primary);
3068
- user-select: none;
3069
- -webkit-user-select: none;
3070
- }
3071
-
3072
- /* data-color = hậu tố text-* Leaf → --leaf-slider-active */
3073
- .leaf-slider[data-color="highlight"] {
3074
- --leaf-slider-active: var(--text-highlight);
3075
- }
3076
- .leaf-slider[data-color="primary"] {
3077
- --leaf-slider-active: var(--text-primary);
3078
- }
3079
- .leaf-slider[data-color="secondary"] {
3080
- --leaf-slider-active: var(--text-secondary);
3081
- }
3082
- .leaf-slider[data-color="tertiary"] {
3083
- --leaf-slider-active: var(--text-tertiary);
3084
- }
3085
- .leaf-slider[data-color="quaternary"] {
3086
- --leaf-slider-active: var(--text-quaternary);
3087
- }
3088
- .leaf-slider[data-color="blue"] {
3089
- --leaf-slider-active: var(--system-blue);
3090
- }
3091
- .leaf-slider[data-color="green"] {
3092
- --leaf-slider-active: var(--system-green);
3093
- }
3094
- .leaf-slider[data-color="yellow"] {
3095
- --leaf-slider-active: var(--system-yellow);
3096
- }
3097
- .leaf-slider[data-color="orange"] {
3098
- --leaf-slider-active: var(--system-orange);
3099
- }
3100
- .leaf-slider[data-color="red"] {
3101
- --leaf-slider-active: var(--system-red);
3102
- }
3103
- .leaf-slider[data-color="purple"] {
3104
- --leaf-slider-active: var(--system-purple);
3105
- }
3106
- .leaf-slider[data-color="blue-secondary"] {
3107
- --leaf-slider-active: var(--system-blue-secondary);
3108
- }
3109
- .leaf-slider[data-color="green-secondary"] {
3110
- --leaf-slider-active: var(--system-green-secondary);
3111
- }
3112
- .leaf-slider[data-color="yellow-secondary"] {
3113
- --leaf-slider-active: var(--system-yellow-secondary);
3114
- }
3115
- .leaf-slider[data-color="orange-secondary"] {
3116
- --leaf-slider-active: var(--system-orange-secondary);
3117
- }
3118
- .leaf-slider[data-color="red-secondary"] {
3119
- --leaf-slider-active: var(--system-red-secondary);
3120
- }
3121
- .leaf-slider[data-color="purple-secondary"] {
3122
- --leaf-slider-active: var(--system-purple-secondary);
3123
- }
3124
-
3125
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
3126
- .leaf-slider[hidden],
3127
- .leaf-slider__header[hidden],
3128
- .leaf-slider__body[hidden],
3129
- .leaf-slider__control[hidden] {
3130
- display: none;
3131
- }
3132
-
3133
- .leaf-slider__header {
3134
- display: flex;
3135
- align-items: flex-start;
3136
- justify-content: space-between;
3137
- gap: 8px;
3138
- width: 100%;
3139
- white-space: nowrap;
3140
- color: var(--text-primary);
3141
- user-select: text;
3142
- -webkit-user-select: text;
3143
- }
3144
-
3145
- .leaf-slider__title {
3146
- min-width: 0;
3147
- }
3148
-
3149
- .leaf-slider__unit {
3150
- min-width: 0;
3151
- text-align: right;
3152
- }
3153
-
3154
- /* Figma gap XS (4) giữa track và Value labels. */
3155
- .leaf-slider__body {
3156
- display: flex;
3157
- flex-direction: column;
3158
- gap: 4px;
3159
- width: 100%;
3160
- }
3161
-
3162
- .leaf-slider__control {
3163
- position: relative;
3164
- display: flex;
3165
- align-items: center;
3166
- width: 100%;
3167
- height: var(--leaf-slider-control-height);
3168
- outline: none;
3169
- cursor: pointer;
3170
- /* Chỉ khoá gesture trên track — header / labels vẫn cho cuộn trang. */
3171
- touch-action: none;
3172
- }
3173
-
3174
- .leaf-slider__control:focus-visible {
3175
- outline: 2px solid var(--leaf-slider-active);
3176
- outline-offset: 4px;
3177
- border-radius: 4px;
3178
- }
3179
-
3180
- .leaf-slider[data-dragging="true"] .leaf-slider__control {
3181
- cursor: grabbing;
3182
- }
3183
-
3184
- .leaf-slider__rail {
3185
- position: absolute;
3186
- left: var(--leaf-slider-inset);
3187
- right: var(--leaf-slider-inset);
3188
- top: 50%;
3189
- height: var(--leaf-slider-rail-height);
3190
- transform: translateY(-50%);
3191
- border-radius: 100px;
3192
- background-color: var(--text-tertiary);
3193
- pointer-events: none;
3194
- }
3195
-
3196
- .leaf-slider__fill {
3197
- display: block;
3198
- height: 100%;
3199
- width: var(--leaf-slider-fill);
3200
- border-radius: inherit;
3201
- background-color: var(--text-primary);
3202
- }
3203
-
3204
- /* Khung toạ độ cho mốc + thumb — trùng với rail, cao 0, nằm giữa control. */
3205
- .leaf-slider__marks {
3206
- position: absolute;
3207
- z-index: 1;
3208
- left: var(--leaf-slider-inset);
3209
- right: var(--leaf-slider-inset);
3210
- top: 50%;
3211
- height: 0;
3212
- pointer-events: none;
3213
- }
3214
-
3215
- .leaf-slider__mark {
3216
- position: absolute;
3217
- top: 0;
3218
- left: 0;
3219
- display: block;
3220
- box-sizing: border-box;
3221
- width: var(--leaf-slider-mark);
3222
- height: var(--leaf-slider-mark);
3223
- margin: 0;
3224
- padding: 0;
3225
- border: none;
3226
- border-radius: 50%;
3227
- background-color: var(--text-tertiary);
3228
- cursor: pointer;
3229
- appearance: none;
3230
- -webkit-appearance: none;
3231
- pointer-events: auto;
3232
- transform: translate(-50%, -50%);
3233
- transition: background-color 0.15s ease;
3234
- }
3235
-
3236
- .leaf-slider__mark[data-state="passed"] {
3237
- background-color: var(--text-primary);
3238
- }
3239
-
3240
- /* Mốc trùng giá trị nằm dưới thumb — cùng màu để không lộ viền. */
3241
- .leaf-slider__mark[data-state="active"] {
3242
- background-color: var(--text-primary);
3243
- }
3244
-
3245
- .leaf-slider:not([data-at-min="true"]) .leaf-slider__mark[data-state="active"] {
3246
- background-color: var(--leaf-slider-active);
3247
- }
3248
-
3249
- .leaf-slider__thumb {
3250
- position: absolute;
3251
- top: 0;
3252
- left: var(--leaf-slider-fill);
3253
- display: block;
3254
- box-sizing: border-box;
3255
- width: var(--leaf-slider-mark-active);
3256
- height: var(--leaf-slider-mark-active);
3257
- border-radius: 50%;
3258
- /* Figma Default (min): thumb trắng; Active (> min): highlight. */
3259
- background-color: var(--text-primary);
3260
- transform: translate(-50%, -50%);
3261
- pointer-events: none;
3262
- transition: background-color 0.15s ease;
3263
- }
3264
-
3265
- .leaf-slider:not([data-at-min="true"]) .leaf-slider__thumb {
3266
- background-color: var(--leaf-slider-active);
3267
- }
3268
-
3269
- /* Label căn đúng dưới mốc: cùng vùng lùi với rail; nhãn hai đầu kéo ra sát mép. */
3270
- .leaf-slider__labels {
3271
- position: relative;
3272
- margin-inline: var(--leaf-slider-inset);
3273
- min-height: var(--body-5-line-height);
3274
- user-select: text;
3275
- -webkit-user-select: text;
3276
- }
3277
-
3278
- .leaf-slider__label {
3279
- position: absolute;
3280
- top: 0;
3281
- max-width: 40%;
3282
- margin: 0;
3283
- padding: 0;
3284
- border: none;
3285
- background: none;
3286
- font: inherit;
3287
- color: var(--text-secondary);
3288
- white-space: nowrap;
3289
- transform: translateX(-50%);
3290
- text-align: center;
3291
- cursor: pointer;
3292
- appearance: none;
3293
- -webkit-appearance: none;
3294
- }
3295
-
3296
- .leaf-slider__label[data-edge="start"] {
3297
- transform: translateX(calc(-1 * var(--leaf-slider-inset)));
3298
- text-align: left;
3299
- }
3300
-
3301
- .leaf-slider__label[data-edge="end"] {
3302
- transform: translateX(calc(-100% + var(--leaf-slider-inset)));
3303
- text-align: right;
3304
- }
3305
-
3306
- .leaf-slider__label[data-active="true"] {
3307
- color: var(--text-primary);
3308
- }
3309
-
3310
- .leaf-slider__label:disabled {
3311
- cursor: not-allowed;
3312
- }
3313
-
3314
- .leaf-slider[data-disabled="true"] {
3315
- opacity: 0.5;
3316
- pointer-events: none;
3317
- }
3318
-
3319
- .leaf-slider[data-disabled="true"] .leaf-slider__control {
3320
- touch-action: auto;
3321
- }
3322
-
3323
- .leaf-slider[data-disabled="true"] .leaf-slider__control,
3324
- .leaf-slider[data-disabled="true"] .leaf-slider__mark,
3325
- .leaf-slider[data-disabled="true"] .leaf-slider__label {
3326
- cursor: not-allowed;
3327
- }
3328
- }
3329
-
3330
- /* --- src/components/Spinner/spinner.css --- */
3331
-
3332
- /*
3333
- * Spinner — SVG loader-line (Figma Button), viewBox 0 0 21 21.
3334
- *
3335
- * Variant animation qua data-animation; size qua data-size; overlay fullscreen
3336
- * qua .leaf-spinner-overlay. Màu mặc định trắng (dark) / đen (light) qua --base-quinary —
3337
- * không dùng highlight; React đổi màu qua prop `color` (class `text-*`). Thiếu attribute → md · spin.
3338
- */
3339
-
3340
- @layer components {
3341
- .leaf-spinner {
3342
- --leaf-spinner-size: 24px;
3343
- --leaf-spinner-duration: 1.2s;
3344
-
3345
- display: inline-flex;
3346
- flex-shrink: 0;
3347
- align-items: center;
3348
- justify-content: center;
3349
- vertical-align: middle;
3350
- width: var(--leaf-spinner-size);
3351
- height: var(--leaf-spinner-size);
3352
- color: var(--base-quinary);
3353
- line-height: 0;
3354
- }
3355
-
3356
- .leaf-spinner__icon {
3357
- display: block;
3358
- width: 100%;
3359
- height: 100%;
3360
- }
3361
-
3362
- /* Fullscreen overlay — pattern Spinner (portal + nền mờ). */
3363
- .leaf-spinner-overlay {
3364
- position: fixed;
3365
- inset: 0;
3366
- display: flex;
3367
- align-items: center;
3368
- justify-content: center;
3369
- z-index: var(--leaf-z-spinner-overlay, 100);
3370
- box-sizing: border-box;
3371
- background-color: var(--overlay);
3372
- color: var(--base-quinary);
3373
- }
3374
-
3375
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
3376
- .leaf-spinner[hidden],
3377
- .leaf-spinner-overlay[hidden] {
3378
- display: none;
3379
- }
3380
-
3381
- /* ── Size ────────────────────────────────────────────────────────────── */
3382
-
3383
- .leaf-spinner[data-size="lg"] {
3384
- --leaf-spinner-size: 30px;
3385
- }
3386
-
3387
- .leaf-spinner[data-size="sm"] {
3388
- --leaf-spinner-size: 20px;
3389
- }
3390
-
3391
- /* ── Animations ──────────────────────────────────────────────────────── */
3392
-
3393
- /* spin — xoay cả icon (mặc định). */
3394
- .leaf-spinner[data-animation="spin"] .leaf-spinner__icon,
3395
- .leaf-spinner:not([data-animation]) .leaf-spinner__icon {
3396
- animation: leaf-spinner-spin var(--leaf-spinner-duration) linear infinite;
3397
- }
3398
-
3399
- /*
3400
- * fade — xoay + mask conic để tạo hiệu ứng đuôi mờ (kiểu iOS trên 1 path).
3401
- */
3402
- .leaf-spinner[data-animation="fade"] .leaf-spinner__icon {
3403
- animation: leaf-spinner-spin var(--leaf-spinner-duration) linear infinite;
3404
- mask-image: conic-gradient(from 0deg, transparent 0%, #000 70%, #000 100%);
3405
- -webkit-mask-image: conic-gradient(from 0deg, transparent 0%, #000 70%, #000 100%);
3406
- }
3407
-
3408
- /* pulse — scale nhịp. */
3409
- .leaf-spinner[data-animation="pulse"] .leaf-spinner__icon {
3410
- animation: leaf-spinner-pulse 1s ease-in-out infinite;
3411
- }
3412
-
3413
- /* breathe — mờ/đậm cả icon. */
3414
- .leaf-spinner[data-animation="breathe"] .leaf-spinner__icon {
3415
- animation: leaf-spinner-breathe 1.2s ease-in-out infinite;
3416
- }
3417
-
3418
- /* Giảm chuyển động: vẫn còn tín hiệu "đang tải" nhưng chậm hẳn lại. */
3419
- @media (prefers-reduced-motion: reduce) {
3420
- .leaf-spinner[data-animation] .leaf-spinner__icon,
3421
- .leaf-spinner:not([data-animation]) .leaf-spinner__icon {
3422
- animation-duration: 3s;
3423
- }
3424
- }
3425
- }
3426
-
3427
- @keyframes leaf-spinner-spin {
3428
- to {
3429
- transform: rotate(360deg);
3430
- }
3431
- }
3432
-
3433
- @keyframes leaf-spinner-pulse {
3434
- 0%,
3435
- 100% {
3436
- transform: scale(0.85);
3437
- }
3438
- 50% {
3439
- transform: scale(1);
3440
- }
3441
- }
3442
-
3443
- @keyframes leaf-spinner-breathe {
3444
- 0%,
3445
- 100% {
3446
- opacity: 0.35;
3447
- }
3448
- 50% {
3449
- opacity: 1;
3450
- }
3451
- }
3452
-
3453
- /* --- src/components/Tabs/tabs.css --- */
3454
-
3455
- /*
3456
- * Tabs — Figma 712:6996 (Tabs Items).
3457
- *
3458
- * `variant` map type trong Figma: subcontent | title | functional | buy | sell.
3459
- * Size: xl | lg | md | sm (tuỳ variant — Title chỉ S, Functional chỉ M, Buy/Sell chỉ L).
3460
- * Subcontent XL/LG selected = --base-quinary; MD/SM selected = --base-tertiary.
3461
- *
3462
- * Variant / size đặt trên tablist (`.leaf-tabs[data-variant][data-size]`), từng
3463
- * `.leaf-tab` chỉ cần `aria-selected`. Toàn bộ hình thức (kể cả typography của
3464
- * label) nằm ở đây — React và `leaf.js` chỉ gắn attribute, nên HTML tĩnh viết
3465
- * cùng markup là ra cùng kết quả.
3466
- *
3467
- * Mặc định khi thiếu attribute: variant subcontent, size xl. Chỉ Subcontent đổi
3468
- * theo size; các variant khác có một size duy nhất nên không đọc `data-size`.
3469
- */
3470
-
3471
- @layer components {
3472
- .leaf-tabs {
3473
- /* Kích thước của Subcontent — mặc định xl, đổi theo data-size bên dưới. */
3474
- --leaf-tab-padding: 12px 16px;
3475
- --leaf-tab-gap: 8px;
3476
- --leaf-tab-font-size: var(--body-3-size);
3477
- --leaf-tab-line-height: var(--body-3-line-height);
3478
- --leaf-tab-font-weight: var(--body-3-highlight-weight);
3479
-
3480
- display: flex;
3481
- flex-wrap: wrap;
3482
- align-items: center;
3483
- gap: 12px;
3484
- }
3485
-
3486
- .leaf-tabs[data-size="lg"] {
3487
- --leaf-tab-padding: 8px 16px;
3488
- --leaf-tab-gap: 8px;
3489
- --leaf-tab-font-size: var(--body-4-size);
3490
- --leaf-tab-line-height: var(--body-4-line-height);
3491
- --leaf-tab-font-weight: var(--body-4-highlight-weight);
3492
- }
3493
-
3494
- .leaf-tabs[data-size="md"] {
3495
- --leaf-tab-padding: 4px 12px;
3496
- --leaf-tab-gap: normal;
3497
- --leaf-tab-font-size: var(--body-4-size);
3498
- --leaf-tab-line-height: var(--body-4-line-height);
3499
- --leaf-tab-font-weight: var(--body-4-weight);
3500
- }
3501
-
3502
- .leaf-tabs[data-size="sm"] {
3503
- --leaf-tab-padding: 4px 12px;
3504
- --leaf-tab-gap: normal;
3505
- --leaf-tab-font-size: var(--body-5-size);
3506
- --leaf-tab-line-height: var(--body-5-line-height);
3507
- --leaf-tab-font-weight: var(--body-5-weight);
3508
- }
3509
-
3510
- .leaf-tab {
3511
- display: inline-flex;
3512
- align-items: center;
3513
- justify-content: center;
3514
- text-align: center;
3515
- white-space: nowrap;
3516
- border: none;
3517
- margin: 0;
3518
- padding: 0;
3519
- cursor: pointer;
3520
- background-color: transparent;
3521
- color: inherit;
3522
- font: inherit;
3523
- font-family: var(--font-sans);
3524
- box-sizing: border-box;
3525
- appearance: none;
3526
- outline: none;
3527
- }
3528
-
3529
- /* Chỉ báo focus bàn phím (WCAG 2.4.7) — :focus-visible nên click chuột không hiện ring. */
3530
- .leaf-tab:focus-visible {
3531
- outline: 2px solid var(--text-highlight);
3532
- outline-offset: 2px;
3533
- }
3534
-
3535
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
3536
- .leaf-tabs[hidden],
3537
- .leaf-tab[hidden],
3538
- .leaf-tab__label[hidden] {
3539
- display: none;
3540
- }
3541
-
3542
- .leaf-tab:disabled,
3543
- .leaf-tab[aria-disabled="true"] {
3544
- cursor: not-allowed;
3545
- }
3546
-
3547
- .leaf-tab__label {
3548
- display: inline-flex;
3549
- align-items: center;
3550
- justify-content: center;
3551
- line-height: inherit;
3552
- }
3553
-
3554
- /* ── Subcontent (pill) — cũng là mặc định khi không có data-variant ──── */
3555
- /* XL / LG: idle tertiary · selected quinary. MD / SM: idle trong suốt · selected tertiary. */
3556
-
3557
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]) .leaf-tab {
3558
- gap: var(--leaf-tab-gap);
3559
- padding: var(--leaf-tab-padding);
3560
- border-radius: 1000px;
3561
- background-color: var(--base-tertiary);
3562
- color: var(--text-secondary);
3563
- font-size: var(--leaf-tab-font-size);
3564
- line-height: var(--leaf-tab-line-height);
3565
- font-weight: var(--leaf-tab-font-weight);
3566
- }
3567
-
3568
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"])
3569
- .leaf-tab[aria-selected="true"] {
3570
- background-color: var(--base-quinary);
3571
- color: var(--text-quaternary);
3572
- }
3573
-
3574
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]) .leaf-tab:disabled,
3575
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"])
3576
- .leaf-tab[aria-disabled="true"] {
3577
- background-color: var(--base-tertiary);
3578
- color: var(--text-tertiary);
3579
- }
3580
-
3581
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]):is(
3582
- [data-size="md"],
3583
- [data-size="sm"]
3584
- )
3585
- .leaf-tab {
3586
- background-color: transparent;
3587
- }
3588
-
3589
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]):is(
3590
- [data-size="md"],
3591
- [data-size="sm"]
3592
- )
3593
- .leaf-tab[aria-selected="true"] {
3594
- background-color: var(--base-tertiary);
3595
- color: var(--text-primary);
3596
- }
3597
-
3598
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]):is(
3599
- [data-size="md"],
3600
- [data-size="sm"]
3601
- )
3602
- .leaf-tab:disabled,
3603
- .leaf-tabs:is(:not([data-variant]), [data-variant="subcontent"]):is(
3604
- [data-size="md"],
3605
- [data-size="sm"]
3606
- )
3607
- .leaf-tab[aria-disabled="true"] {
3608
- background-color: transparent;
3609
- color: var(--text-tertiary);
3610
- }
3611
-
3612
- /* ── Title (underline) ───────────────────────────────────────────────── */
3613
-
3614
- .leaf-tabs[data-variant="title"] .leaf-tab {
3615
- flex-direction: column;
3616
- gap: 4px;
3617
- min-width: 100px;
3618
- color: var(--text-secondary);
3619
- font-size: var(--body-4-size);
3620
- line-height: var(--body-4-line-height);
3621
- font-weight: var(--body-4-weight);
3622
- }
3623
-
3624
- .leaf-tabs[data-variant="title"] .leaf-tab[aria-selected="true"] {
3625
- color: var(--text-primary);
3626
- font-weight: var(--body-4-highlight-weight);
3627
- }
3628
-
3629
- .leaf-tabs[data-variant="title"] .leaf-tab::after {
3630
- content: "";
3631
- display: block;
3632
- width: 100%;
3633
- height: 2px;
3634
- background-color: var(--text-primary);
3635
- opacity: 0;
3636
- }
3637
-
3638
- .leaf-tabs[data-variant="title"] .leaf-tab[aria-selected="true"]::after {
3639
- opacity: 1;
3640
- }
3641
-
3642
- .leaf-tabs[data-variant="title"] .leaf-tab:disabled,
3643
- .leaf-tabs[data-variant="title"] .leaf-tab[aria-disabled="true"] {
3644
- color: var(--text-tertiary);
3645
- }
3646
-
3647
- .leaf-tabs[data-variant="title"] .leaf-tab:disabled::after,
3648
- .leaf-tabs[data-variant="title"] .leaf-tab[aria-disabled="true"]::after {
3649
- opacity: 0;
3650
- }
3651
-
3652
- /* ── Functional ──────────────────────────────────────────────────────── */
3653
-
3654
- .leaf-tabs[data-variant="functional"] .leaf-tab {
3655
- height: 24px;
3656
- min-width: 100px;
3657
- padding: 4px 24px;
3658
- border-radius: 100px;
3659
- background-color: var(--base-tertiary);
3660
- color: var(--button-disabled-content);
3661
- font-size: var(--body-5-size);
3662
- line-height: var(--body-5-line-height);
3663
- font-weight: var(--body-5-weight);
3664
- }
3665
-
3666
- .leaf-tabs[data-variant="functional"] .leaf-tab[aria-selected="true"] {
3667
- background-color: var(--button-base-primary);
3668
- color: var(--button-content-primary);
3669
- }
3670
-
3671
- .leaf-tabs[data-variant="functional"] .leaf-tab:disabled,
3672
- .leaf-tabs[data-variant="functional"] .leaf-tab[aria-disabled="true"] {
3673
- background-color: var(--base-tertiary);
3674
- color: var(--button-disabled-content);
3675
- }
3676
-
3677
- /* ── Buy / Sell ──────────────────────────────────────────────────────── */
3678
-
3679
- .leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab {
3680
- min-width: 100px;
3681
- width: auto;
3682
- padding: 6px 4px;
3683
- border-radius: 100px;
3684
- color: var(--text-primary);
3685
- font-size: var(--body-5-size);
3686
- line-height: var(--body-5-line-height);
3687
- font-weight: var(--body-5-weight);
3688
- }
3689
-
3690
- .leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab[aria-selected="true"] {
3691
- font-weight: var(--body-5-highlight-weight);
3692
- }
3693
-
3694
- .leaf-tabs[data-variant="buy"] .leaf-tab[aria-selected="true"] {
3695
- background-color: var(--button-base-secondary);
3696
- color: var(--text-highlight);
3697
- }
3698
-
3699
- .leaf-tabs[data-variant="sell"] .leaf-tab[aria-selected="true"] {
3700
- background-color: var(--button-base-secondary-destruction);
3701
- color: var(--button-base-destruction);
3702
- }
3703
-
3704
- .leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab:disabled,
3705
- .leaf-tabs:is([data-variant="buy"], [data-variant="sell"]) .leaf-tab[aria-disabled="true"] {
3706
- color: var(--text-tertiary);
3707
- background-color: transparent;
3708
- }
3709
- }
3710
-
3711
- /* --- src/components/Textarea/textarea.css --- */
3712
-
3713
- /*
3714
- * Textarea — neo Input field (cùng token / shell / state).
3715
- * Root: .leaf-input.leaf-textarea — cần import input.css trước (hoặc styles.css).
3716
- */
3717
-
3718
- @layer components {
3719
- .leaf-textarea .leaf-input__shell {
3720
- align-items: flex-start;
3721
- min-height: 96px;
3722
- cursor: text;
3723
- }
3724
-
3725
- .leaf-textarea .leaf-input__main {
3726
- align-items: stretch;
3727
- width: 100%;
3728
- }
3729
-
3730
- .leaf-textarea__control {
3731
- min-height: 64px;
3732
- resize: vertical;
3733
- field-sizing: content;
3734
- }
3735
- }
3736
-
3737
- /* --- src/components/Toast/toast.css --- */
3738
-
3739
- /*
3740
- * Toast — thông báo ngắn góc màn hình.
3741
- *
3742
- * Status qua data-status: success (viền / icon / progress --text-highlight, nền
3743
- * --system-green-secondary) · error (--system-red / --system-red-secondary) · warning
3744
- * (--system-yellow / --system-yellow-secondary). Thiếu attribute → success.
3745
- *
3746
- * Nền thang 800 ở cả hai theme → toast gắn sẵn `data-theme="dark"` để chữ giữ màu sáng.
3747
- * Thời gian tự đóng = animation của thanh progress (--leaf-toast-duration), dừng khi
3748
- * hover / focus; hết animation thì JS đóng toast. data-state="closing" chạy hiệu ứng ra.
3749
- */
3750
-
3751
- @layer components {
3752
- .leaf-toaster {
3753
- --leaf-toast-enter-x: 24px;
3754
- --leaf-toast-enter-y: 0px;
3755
-
3756
- position: fixed;
3757
- top: 16px;
3758
- right: 16px;
3759
- z-index: var(--leaf-z-toast, 120);
3760
- display: flex;
3761
- flex-direction: column;
3762
- align-items: flex-end;
3763
- gap: 8px;
3764
- max-width: calc(100vw - 32px);
3765
- margin: 0;
3766
- padding: 0;
3767
- pointer-events: none;
3768
- }
3769
-
3770
- .leaf-toaster[data-position="top-left"],
3771
- .leaf-toaster[data-position="bottom-left"] {
3772
- --leaf-toast-enter-x: -24px;
3773
- right: auto;
3774
- left: 16px;
3775
- align-items: flex-start;
3776
- }
3777
-
3778
- .leaf-toaster[data-position="top-center"],
3779
- .leaf-toaster[data-position="bottom-center"] {
3780
- --leaf-toast-enter-x: 0px;
3781
- --leaf-toast-enter-y: -12px;
3782
- right: auto;
3783
- left: 50%;
3784
- align-items: center;
3785
- transform: translateX(-50%);
3786
- }
3787
-
3788
- .leaf-toaster[data-position^="bottom"] {
3789
- top: auto;
3790
- bottom: 16px;
3791
- }
3792
-
3793
- .leaf-toaster[data-position="bottom-center"] {
3794
- --leaf-toast-enter-y: 12px;
3795
- }
3796
-
3797
- .leaf-toaster > .leaf-toast {
3798
- pointer-events: auto;
3799
- }
3800
-
3801
- .leaf-toast {
3802
- --leaf-toast-accent: var(--text-highlight);
3803
- --leaf-toast-surface: var(--system-green-secondary);
3804
-
3805
- position: relative;
3806
- display: flex;
3807
- align-items: center;
3808
- gap: 8px;
3809
- width: 320px;
3810
- max-width: 100%;
3811
- margin: 0;
3812
- padding: 12px;
3813
- box-sizing: border-box;
3814
- overflow: hidden;
3815
- border: 1px solid var(--leaf-toast-accent);
3816
- border-radius: 12px;
3817
- background-color: var(--leaf-toast-surface);
3818
- box-shadow: 0 10px 15px -3px color-mix(in srgb, var(--overlay) 30%, transparent);
3819
- color: var(--text-primary);
3820
- font-family: var(--font-sans);
3821
- animation: leaf-toast-in 300ms ease-out;
3822
- }
3823
-
3824
- .leaf-toast[data-status="error"] {
3825
- --leaf-toast-accent: var(--system-red);
3826
- --leaf-toast-surface: var(--system-red-secondary);
3827
- }
3828
-
3829
- .leaf-toast[data-status="warning"] {
3830
- --leaf-toast-accent: var(--system-yellow);
3831
- --leaf-toast-surface: var(--system-yellow-secondary);
3832
- }
3833
-
3834
- .leaf-toast[data-state="closing"] {
3835
- animation: leaf-toast-out 300ms ease-in forwards;
3836
- pointer-events: none;
3837
- }
3838
-
3839
- .leaf-toaster[hidden],
3840
- .leaf-toast[hidden],
3841
- .leaf-toast__icon[hidden],
3842
- .leaf-toast__content[hidden],
3843
- .leaf-toast__close[hidden],
3844
- .leaf-toast__glyph[hidden],
3845
- .leaf-toast__progress[hidden],
3846
- .leaf-toast__progress-bar[hidden] {
3847
- display: none;
3848
- }
3849
-
3850
- .leaf-toast__icon {
3851
- display: inline-flex;
3852
- flex-shrink: 0;
3853
- align-items: center;
3854
- justify-content: center;
3855
- color: var(--leaf-toast-accent);
3856
- }
3857
-
3858
- .leaf-toast__glyph {
3859
- display: block;
3860
- width: 16px;
3861
- height: 16px;
3862
- }
3863
-
3864
- .leaf-toast__icon > .leaf-toast__glyph {
3865
- width: 26px;
3866
- height: 26px;
3867
- }
3868
-
3869
- .leaf-toast__content {
3870
- display: flex;
3871
- flex: 1 1 auto;
3872
- flex-direction: column;
3873
- min-width: 0;
3874
- }
3875
-
3876
- .leaf-toast__title,
3877
- .leaf-toast__description {
3878
- margin: 0;
3879
- color: var(--text-primary);
3880
- overflow-wrap: anywhere;
3881
- }
3882
-
3883
- .leaf-toast__title {
3884
- font-size: var(--body-3-size);
3885
- line-height: var(--body-3-line-height);
3886
- font-weight: var(--body-3-highlight-weight);
3887
- }
3888
-
3889
- .leaf-toast__description {
3890
- font-size: var(--body-4-size);
3891
- line-height: var(--body-4-line-height);
3892
- font-weight: var(--body-4-weight);
3893
- }
3894
-
3895
- .leaf-toast__close {
3896
- display: inline-flex;
3897
- flex-shrink: 0;
3898
- align-items: center;
3899
- justify-content: center;
3900
- margin: 0;
3901
- padding: 0;
3902
- border: none;
3903
- border-radius: 4px;
3904
- background: transparent;
3905
- color: var(--text-primary);
3906
- font: inherit;
3907
- cursor: pointer;
3908
- appearance: none;
3909
- }
3910
-
3911
- .leaf-toast__close:focus-visible {
3912
- outline: 2px solid var(--leaf-toast-accent);
3913
- outline-offset: 2px;
3914
- }
3915
-
3916
- .leaf-toast__progress {
3917
- position: absolute;
3918
- bottom: 0;
3919
- left: 0;
3920
- width: 100%;
3921
- height: 4px;
3922
- background-color: color-mix(in srgb, var(--text-primary) 10%, transparent);
3923
- }
3924
-
3925
- .leaf-toast__progress-bar {
3926
- width: 100%;
3927
- height: 100%;
3928
- background-color: var(--leaf-toast-accent);
3929
- transform-origin: left center;
3930
- animation: leaf-toast-progress var(--leaf-toast-duration, 4000ms) linear forwards;
3931
- }
3932
-
3933
- .leaf-toast:is(:hover, :focus-within) .leaf-toast__progress-bar,
3934
- .leaf-toast[data-state="closing"] .leaf-toast__progress-bar {
3935
- animation-play-state: paused;
3936
- }
3937
-
3938
- @keyframes leaf-toast-in {
3939
- from {
3940
- opacity: 0;
3941
- transform: translate(var(--leaf-toast-enter-x, 24px), var(--leaf-toast-enter-y, 0px));
3942
- }
3943
- }
3944
-
3945
- @keyframes leaf-toast-out {
3946
- to {
3947
- opacity: 0;
3948
- transform: translate(var(--leaf-toast-enter-x, 24px), var(--leaf-toast-enter-y, 0px));
3949
- }
3950
- }
3951
-
3952
- @keyframes leaf-toast-progress {
3953
- from {
3954
- transform: scaleX(1);
3955
- }
3956
- to {
3957
- transform: scaleX(0);
3958
- }
3959
- }
3960
-
3961
- /* Giảm chuyển động: chỉ mờ dần, không trượt. Progress vẫn chạy vì nó là bộ đếm giờ. */
3962
- @media (prefers-reduced-motion: reduce) {
3963
- .leaf-toaster,
3964
- .leaf-toast {
3965
- --leaf-toast-enter-x: 0px;
3966
- --leaf-toast-enter-y: 0px;
3967
- }
3968
- }
3969
- }
3970
-
3971
- /* --- src/components/Toggle/toggle.css --- */
3972
-
3973
- /*
3974
- * Toggle — Figma 730:12438.
3975
- *
3976
- * Size M/S qua data-size; Status On/Off qua aria-checked; Active Off qua
3977
- * :disabled hoặc aria-disabled="true" (cả hai đều chặn click — React lẫn leaf.js).
3978
- * Thumb trượt bằng transform. Checkmark chỉ hiện ở size sm khi
3979
- * On + Active. Thiếu attribute → md · off · enabled.
3980
- */
3981
-
3982
- @layer components {
3983
- .leaf-toggle {
3984
- --leaf-toggle-width: 48px;
3985
- --leaf-toggle-height: 24px;
3986
- --leaf-toggle-padding: 3px;
3987
- --leaf-toggle-thumb: 18px;
3988
- --leaf-toggle-travel: calc(
3989
- var(--leaf-toggle-width) - var(--leaf-toggle-padding) * 2 - var(--leaf-toggle-thumb)
3990
- );
3991
-
3992
- position: relative;
3993
- display: inline-flex;
3994
- flex-shrink: 0;
3995
- align-items: center;
3996
- vertical-align: middle;
3997
- box-sizing: border-box;
3998
- width: var(--leaf-toggle-width);
3999
- height: var(--leaf-toggle-height);
4000
- margin: 0;
4001
- padding: var(--leaf-toggle-padding);
4002
- border: none;
4003
- border-radius: 12px;
4004
- background-color: var(--base-quaternary);
4005
- cursor: pointer;
4006
- appearance: none;
4007
- -webkit-appearance: none;
4008
- font: inherit;
4009
- color: inherit;
4010
- transition: background-color 0.2s ease;
4011
- }
4012
-
4013
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
4014
- .leaf-toggle[hidden],
4015
- .leaf-toggle__thumb[hidden] {
4016
- display: none;
4017
- }
4018
-
4019
- .leaf-toggle__thumb {
4020
- display: flex;
4021
- align-items: center;
4022
- justify-content: center;
4023
- width: var(--leaf-toggle-thumb);
4024
- height: var(--leaf-toggle-thumb);
4025
- border-radius: 100px;
4026
- background-color: var(--text-secondary);
4027
- transform: translateX(0);
4028
- transition:
4029
- transform 0.2s ease,
4030
- background-color 0.2s ease;
4031
- }
4032
-
4033
- .leaf-toggle__check {
4034
- display: none;
4035
- width: 90%;
4036
- height: 90%;
4037
- color: var(--system-green);
4038
- }
4039
-
4040
- /* Status On + Active — track xanh, thumb trắng, trượt phải. */
4041
- .leaf-toggle[aria-checked="true"]:not(:disabled, [aria-disabled="true"]) {
4042
- background-color: var(--system-green);
4043
- }
4044
-
4045
- .leaf-toggle[aria-checked="true"]:not(:disabled, [aria-disabled="true"]) .leaf-toggle__thumb {
4046
- background-color: var(--icon-on-color);
4047
- transform: translateX(var(--leaf-toggle-travel));
4048
- }
4049
-
4050
- /* Status On + Active Off (disabled on) — track quaternary, thumb tertiary, vẫn bên phải. */
4051
- .leaf-toggle[aria-checked="true"]:is(:disabled, [aria-disabled="true"]) .leaf-toggle__thumb {
4052
- background-color: var(--text-tertiary);
4053
- transform: translateX(var(--leaf-toggle-travel));
4054
- }
4055
-
4056
- /* Status Off + Active Off — thumb tertiary, bên trái. */
4057
- .leaf-toggle:is(:disabled, [aria-disabled="true"]):not([aria-checked="true"])
4058
- .leaf-toggle__thumb {
4059
- background-color: var(--text-tertiary);
4060
- }
4061
-
4062
- /* Size S */
4063
- .leaf-toggle[data-size="sm"] {
4064
- --leaf-toggle-width: 32px;
4065
- --leaf-toggle-height: 16px;
4066
- --leaf-toggle-thumb: 10px;
4067
- }
4068
-
4069
- /* Checkmark chỉ ở S · On · Active. */
4070
- .leaf-toggle[data-size="sm"][aria-checked="true"]:not(:disabled, [aria-disabled="true"])
4071
- .leaf-toggle__check {
4072
- display: block;
4073
- }
4074
-
4075
- .leaf-toggle:is(:disabled, [aria-disabled="true"]) {
4076
- cursor: not-allowed;
4077
- }
4078
-
4079
- .leaf-toggle:focus-visible {
4080
- outline: 2px solid var(--system-green);
4081
- outline-offset: 2px;
4082
- }
4083
- }
4084
-
4085
- /* --- src/components/Tooltip/tooltip.css --- */
4086
-
4087
- /*
4088
- * Tooltip — Figma 891:4983.
4089
- *
4090
- * Size sm/md/lg; position top/bottom/left/right; align start/center/end.
4091
- * Nền --base-quaternary; chữ --text-primary.
4092
- *
4093
- * Caret Figma: khung hit-area rộng (40×4 / 44×6 / 16×4) nhưng tam giác thật
4094
- * chỉ 8×4 (sm) hoặc 12×6 (md/lg) nằm giữa khung — không vẽ full-width.
4095
- */
4096
-
4097
- @layer components {
4098
- .leaf-tooltip {
4099
- --leaf-tooltip-pad-y: 8px;
4100
- --leaf-tooltip-pad-x: 16px;
4101
- --leaf-tooltip-radius: 8px;
4102
- --leaf-tooltip-max-width: 176px;
4103
- --leaf-tooltip-font-size: var(--body-4-size);
4104
- --leaf-tooltip-line-height: var(--body-4-line-height);
4105
- --leaf-tooltip-font-weight: var(--body-4-weight);
4106
- /* Khung caret dọc theo cạnh (top/bottom). */
4107
- --leaf-tooltip-caret-w: 44px;
4108
- --leaf-tooltip-caret-h: 6px;
4109
- /* Chiều rộng tam giác thật trong khung. */
4110
- --leaf-tooltip-caret-tip: 12px;
4111
-
4112
- display: inline-flex;
4113
- flex-direction: column;
4114
- align-items: center;
4115
- max-width: var(--leaf-tooltip-max-width);
4116
- box-sizing: border-box;
4117
- font-family: var(--font-sans);
4118
- font-size: var(--leaf-tooltip-font-size);
4119
- line-height: var(--leaf-tooltip-line-height);
4120
- font-weight: var(--leaf-tooltip-font-weight);
4121
- color: var(--text-primary);
4122
- pointer-events: none;
4123
- }
4124
-
4125
- .leaf-tooltip-trigger {
4126
- position: relative;
4127
- display: inline-flex;
4128
- max-width: 100%;
4129
- vertical-align: middle;
4130
- }
4131
-
4132
- .leaf-tooltip--portal {
4133
- position: fixed;
4134
- z-index: var(--leaf-z-tooltip, 110);
4135
- }
4136
-
4137
- /* `hidden` luôn ẩn — rule gốc set display; selector `[hidden]` specificity cao hơn nên thắng. */
4138
- .leaf-tooltip-trigger[hidden],
4139
- .leaf-tooltip[hidden],
4140
- .leaf-tooltip__caret[hidden] {
4141
- display: none;
4142
- }
4143
-
4144
- .leaf-tooltip__body {
4145
- position: relative;
4146
- z-index: 10;
4147
- max-width: 100%;
4148
- text-align: left;
4149
- box-sizing: border-box;
4150
- padding: var(--leaf-tooltip-pad-y) var(--leaf-tooltip-pad-x);
4151
- border-radius: var(--leaf-tooltip-radius);
4152
- background-color: var(--base-quaternary);
4153
- word-break: break-word;
4154
- }
4155
-
4156
- /*
4157
- * Caret = khung trong suốt + ::before là tam giác nhỏ ở giữa (đúng SVG Figma).
4158
- * Mặc định: mũi nhọn xuống (position=top — caret dưới body).
4159
- */
4160
- .leaf-tooltip__caret {
4161
- position: relative;
4162
- display: block;
4163
- flex-shrink: 0;
4164
- width: var(--leaf-tooltip-caret-w);
4165
- height: var(--leaf-tooltip-caret-h);
4166
- background-color: transparent;
4167
- }
4168
-
4169
- .leaf-tooltip__caret::before {
4170
- content: "";
4171
- position: absolute;
4172
- top: 0;
4173
- left: 50%;
4174
- width: var(--leaf-tooltip-caret-tip);
4175
- height: 100%;
4176
- background-color: var(--base-quaternary);
4177
- transform: translateX(-50%);
4178
- clip-path: polygon(0 0, 100% 0, 50% 100%);
4179
- }
4180
-
4181
- /* ── Size ────────────────────────────────────────────────────────────── */
4182
-
4183
- .leaf-tooltip[data-size="sm"] {
4184
- --leaf-tooltip-pad-y: 2px;
4185
- --leaf-tooltip-pad-x: 16px;
4186
- --leaf-tooltip-radius: 4px;
4187
- --leaf-tooltip-max-width: 208px;
4188
- --leaf-tooltip-font-size: var(--body-5-size);
4189
- --leaf-tooltip-line-height: var(--body-5-line-height);
4190
- --leaf-tooltip-font-weight: var(--body-5-weight);
4191
- --leaf-tooltip-caret-w: 40px;
4192
- --leaf-tooltip-caret-h: 4px;
4193
- --leaf-tooltip-caret-tip: 8px;
4194
- min-width: 64px;
4195
- }
4196
-
4197
- .leaf-tooltip[data-size="lg"] {
4198
- --leaf-tooltip-pad-y: 16px;
4199
- --leaf-tooltip-pad-x: 16px;
4200
- --leaf-tooltip-radius: 12px;
4201
- --leaf-tooltip-max-width: 288px;
4202
- --leaf-tooltip-font-size: var(--body-3-size);
4203
- --leaf-tooltip-line-height: var(--body-3-line-height);
4204
- --leaf-tooltip-font-weight: var(--body-3-weight);
4205
- --leaf-tooltip-caret-w: 44px;
4206
- --leaf-tooltip-caret-h: 6px;
4207
- --leaf-tooltip-caret-tip: 12px;
4208
- }
4209
-
4210
- /* Sm left/right: khung caret 16×4 (Figma), không dùng 40×4 của top/bottom. */
4211
- .leaf-tooltip[data-size="sm"][data-position="left"],
4212
- .leaf-tooltip[data-size="sm"][data-position="right"] {
4213
- --leaf-tooltip-caret-w: 16px;
4214
- }
4215
-
4216
- /* ── Position ────────────────────────────────────────────────────────── */
4217
-
4218
- /*
4219
- * Vị trí caret theo data-position (không theo thứ tự DOM): markup vẫn đặt caret
4220
- * đúng phía nên kết quả không đổi, nhưng khi bubble tự lật phía (thiếu chỗ) thì
4221
- * chỉ cần đổi data-position là caret sang phía đối diện.
4222
- */
4223
- .leaf-tooltip:is(:not([data-position]), [data-position="top"], [data-position="left"])
4224
- > .leaf-tooltip__caret {
4225
- order: 1;
4226
- }
4227
-
4228
- .leaf-tooltip:is([data-position="bottom"], [data-position="right"]) > .leaf-tooltip__caret {
4229
- order: -1;
4230
- }
4231
-
4232
- .leaf-tooltip[data-position="bottom"] {
4233
- flex-direction: column;
4234
- }
4235
-
4236
- .leaf-tooltip[data-position="bottom"] .leaf-tooltip__caret::before {
4237
- clip-path: polygon(50% 0, 0 100%, 100% 100%);
4238
- }
4239
-
4240
- .leaf-tooltip[data-position="left"] {
4241
- flex-direction: row;
4242
- align-items: center;
4243
- }
4244
-
4245
- .leaf-tooltip[data-position="left"] .leaf-tooltip__caret {
4246
- width: var(--leaf-tooltip-caret-h);
4247
- height: var(--leaf-tooltip-caret-w);
4248
- }
4249
-
4250
- .leaf-tooltip[data-position="left"] .leaf-tooltip__caret::before {
4251
- top: 50%;
4252
- left: 0;
4253
- width: 100%;
4254
- height: var(--leaf-tooltip-caret-tip);
4255
- transform: translateY(-50%);
4256
- clip-path: polygon(0 0, 100% 50%, 0 100%);
4257
- }
4258
-
4259
- .leaf-tooltip[data-position="right"] {
4260
- flex-direction: row;
4261
- align-items: center;
4262
- }
4263
-
4264
- .leaf-tooltip[data-position="right"] .leaf-tooltip__caret {
4265
- width: var(--leaf-tooltip-caret-h);
4266
- height: var(--leaf-tooltip-caret-w);
4267
- }
4268
-
4269
- .leaf-tooltip[data-position="right"] .leaf-tooltip__caret::before {
4270
- top: 50%;
4271
- left: 0;
4272
- width: 100%;
4273
- height: var(--leaf-tooltip-caret-tip);
4274
- transform: translateY(-50%);
4275
- clip-path: polygon(100% 0, 0 50%, 100% 100%);
4276
- }
4277
-
4278
- /* ── Align (caret trên Top/Bottom) ───────────────────────────────────── */
4279
-
4280
- .leaf-tooltip[data-position="top"][data-align="start"],
4281
- .leaf-tooltip[data-position="bottom"][data-align="start"] {
4282
- align-items: flex-start;
4283
- }
4284
-
4285
- .leaf-tooltip[data-position="top"][data-align="end"],
4286
- .leaf-tooltip[data-position="bottom"][data-align="end"] {
4287
- align-items: flex-end;
4288
- }
4289
-
4290
- .leaf-tooltip[data-position="top"][data-align="center"],
4291
- .leaf-tooltip[data-position="bottom"][data-align="center"] {
4292
- align-items: center;
4293
- }
4294
- }
4295
-
4296
- /* --- src/components/Upload/upload.css --- */
4297
-
4298
- /*
4299
- * Upload — dropzone trong khung; count / error nằm trong zone.
4300
- * List file (`showFileList`) optional bên dưới — icon xoá delete-bin-line.
4301
- */
4302
-
4303
- @layer components {
4304
- .leaf-upload {
4305
- --leaf-upload-bg: transparent;
4306
- --leaf-upload-border: var(--text-highlight);
4307
- --leaf-upload-fg: var(--text-primary);
4308
- --leaf-upload-muted: var(--text-secondary);
4309
- --leaf-upload-icon: var(--text-highlight);
4310
- --leaf-upload-icon-bg: color-mix(in srgb, var(--text-highlight) 18%, transparent);
4311
- --leaf-upload-radius: 12px;
4312
- --leaf-upload-min-height: 160px;
4313
-
4314
- position: relative;
4315
- display: flex;
4316
- flex-direction: column;
4317
- gap: 8px;
4318
- min-width: 0;
4319
- }
4320
-
4321
- .leaf-upload[hidden],
4322
- .leaf-upload__zone[hidden],
4323
- .leaf-upload__icon[hidden],
4324
- .leaf-upload__icon > svg[hidden],
4325
- .leaf-upload__list[hidden],
4326
- .leaf-upload__file[hidden],
4327
- .leaf-upload__remove[hidden],
4328
- .leaf-upload__remove > svg[hidden] {
4329
- display: none;
4330
- }
4331
-
4332
- .leaf-upload__label {
4333
- color: var(--text-tertiary);
4334
- }
4335
-
4336
- .leaf-upload[data-filled="true"] .leaf-upload__label {
4337
- color: var(--text-primary);
4338
- }
4339
-
4340
- .leaf-upload__zone {
4341
- display: flex;
4342
- flex-direction: column;
4343
- align-items: center;
4344
- justify-content: center;
4345
- gap: 10px;
4346
- box-sizing: border-box;
4347
- width: 100%;
4348
- min-height: var(--leaf-upload-min-height);
4349
- padding: 24px 16px;
4350
- border: 1.5px dashed var(--leaf-upload-border);
4351
- border-radius: var(--leaf-upload-radius);
4352
- background-color: var(--leaf-upload-bg);
4353
- color: var(--leaf-upload-fg);
4354
- text-align: center;
4355
- cursor: pointer;
4356
- transition:
4357
- border-color 0.15s ease,
4358
- color 0.15s ease,
4359
- box-shadow 0.15s ease;
4360
- }
4361
-
4362
- .leaf-upload:not([data-disabled="true"]):not([data-at-max="true"]) .leaf-upload__zone:hover {
4363
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-highlight) 16%, transparent);
4364
- }
4365
-
4366
- .leaf-upload__zone:focus-visible {
4367
- outline: 2px solid var(--text-highlight);
4368
- outline-offset: 2px;
4369
- }
4370
-
4371
- .leaf-upload__icon {
4372
- display: inline-flex;
4373
- align-items: center;
4374
- justify-content: center;
4375
- width: 56px;
4376
- height: 56px;
4377
- border-radius: 999px;
4378
- background-color: var(--leaf-upload-icon-bg);
4379
- font-size: 28px;
4380
- line-height: 1;
4381
- color: var(--leaf-upload-icon);
4382
- }
4383
-
4384
- .leaf-upload__icon > svg {
4385
- display: block;
4386
- width: 1em;
4387
- height: 1em;
4388
- }
4389
-
4390
- .leaf-upload__title,
4391
- .leaf-upload__formats,
4392
- .leaf-upload__count,
4393
- .leaf-upload__error {
4394
- margin: 0;
4395
- max-width: 100%;
4396
- }
4397
-
4398
- .leaf-upload__title {
4399
- color: var(--leaf-upload-fg);
4400
- }
4401
-
4402
- .leaf-upload__formats {
4403
- color: var(--leaf-upload-muted);
4404
- }
4405
-
4406
- .leaf-upload__count {
4407
- color: var(--text-highlight);
4408
- }
4409
-
4410
- .leaf-upload__error {
4411
- color: var(--system-red);
4412
- }
4413
-
4414
- /* Một file: tên + nút xoá trong khung, căn giữa; tên dài cắt "…". */
4415
- .leaf-upload__file {
4416
- display: inline-flex;
4417
- align-items: center;
4418
- gap: 4px;
4419
- max-width: 100%;
4420
- min-width: 0;
4421
- }
4422
-
4423
- .leaf-upload__file > .leaf-upload__file-name {
4424
- flex: 0 1 auto;
4425
- color: var(--leaf-upload-fg);
4426
- text-align: center;
4427
- }
4428
-
4429
- .leaf-upload__list {
4430
- display: flex;
4431
- flex-direction: column;
4432
- gap: 8px;
4433
- min-width: 0;
4434
- }
4435
-
4436
- .leaf-upload__list-label {
4437
- color: var(--text-secondary);
4438
- }
4439
-
4440
- .leaf-upload__list-items {
4441
- margin: 0;
4442
- padding: 0;
4443
- list-style: none;
4444
- border: 1px solid var(--base-quaternary);
4445
- border-radius: var(--leaf-upload-radius);
4446
- overflow: hidden;
4447
- }
4448
-
4449
- .leaf-upload__list-item {
4450
- display: flex;
4451
- align-items: center;
4452
- gap: 8px;
4453
- padding: 10px 12px;
4454
- border-bottom: 1px solid var(--base-quaternary);
4455
- background-color: transparent;
4456
- }
4457
-
4458
- .leaf-upload__list-item:last-child {
4459
- border-bottom: none;
4460
- }
4461
-
4462
- .leaf-upload__file-name {
4463
- flex: 1;
4464
- min-width: 0;
4465
- overflow: hidden;
4466
- text-overflow: ellipsis;
4467
- white-space: nowrap;
4468
- color: var(--text-primary);
4469
- text-align: left;
4470
- }
4471
-
4472
- .leaf-upload__remove,
4473
- .leaf-upload__view {
4474
- display: inline-flex;
4475
- align-items: center;
4476
- justify-content: center;
4477
- flex-shrink: 0;
4478
- width: 28px;
4479
- height: 28px;
4480
- margin: 0;
4481
- padding: 0;
4482
- border: none;
4483
- border-radius: 999px;
4484
- background: transparent;
4485
- color: var(--text-secondary);
4486
- cursor: pointer;
4487
- appearance: none;
4488
- font-size: 16px;
4489
- line-height: 1;
4490
- }
4491
-
4492
- .leaf-upload__remove > svg,
4493
- .leaf-upload__view > svg {
4494
- display: block;
4495
- width: 1em;
4496
- height: 1em;
4497
- }
4498
-
4499
- .leaf-upload__remove:hover {
4500
- color: var(--system-red);
4501
- background-color: color-mix(in srgb, var(--system-red) 12%, transparent);
4502
- }
4503
-
4504
- .leaf-upload__view:hover {
4505
- color: var(--text-highlight);
4506
- background-color: color-mix(in srgb, var(--text-highlight) 12%, transparent);
4507
- }
4508
-
4509
- .leaf-upload__remove:focus-visible,
4510
- .leaf-upload__view:focus-visible {
4511
- outline: 2px solid var(--text-highlight);
4512
- outline-offset: 2px;
4513
- }
4514
-
4515
- /* Preview: thumbnail ảnh (hoặc icon file) + dung lượng trước tên file. */
4516
- .leaf-upload__thumb {
4517
- display: inline-flex;
4518
- align-items: center;
4519
- justify-content: center;
4520
- flex-shrink: 0;
4521
- width: 32px;
4522
- height: 32px;
4523
- overflow: hidden;
4524
- border-radius: 6px;
4525
- background-color: var(--base-tertiary);
4526
- color: var(--text-secondary);
4527
- font-size: 16px;
4528
- }
4529
-
4530
- .leaf-upload__thumb > img {
4531
- display: block;
4532
- width: 100%;
4533
- height: 100%;
4534
- object-fit: cover;
4535
- }
4536
-
4537
- .leaf-upload__thumb > svg {
4538
- display: block;
4539
- width: 1em;
4540
- height: 1em;
4541
- }
4542
-
4543
- .leaf-upload__size {
4544
- flex-shrink: 0;
4545
- color: var(--text-secondary);
4546
- }
4547
-
4548
- .leaf-upload__input {
4549
- position: absolute;
4550
- width: 1px;
4551
- height: 1px;
4552
- padding: 0;
4553
- margin: -1px;
4554
- overflow: hidden;
4555
- clip: rect(0, 0, 0, 0);
4556
- white-space: nowrap;
4557
- border: 0;
4558
- }
4559
-
4560
- /* ── State ───────────────────────────────────────────────────────────── */
4561
-
4562
- .leaf-upload[data-dragging="true"] .leaf-upload__zone {
4563
- --leaf-upload-border: var(--text-highlight);
4564
- --leaf-upload-icon: var(--text-highlight);
4565
- --leaf-upload-fg: var(--text-highlight);
4566
- border-style: solid;
4567
- box-shadow: 0 0 0 4px color-mix(in srgb, var(--text-highlight) 20%, transparent);
4568
- }
4569
-
4570
- .leaf-upload[data-invalid="true"] {
4571
- --leaf-upload-border: var(--system-red);
4572
- --leaf-upload-icon: var(--system-red);
4573
- --leaf-upload-icon-bg: color-mix(in srgb, var(--system-red) 16%, transparent);
4574
- }
4575
-
4576
- .leaf-upload[data-invalid="true"] .leaf-upload__label,
4577
- .leaf-upload[data-invalid="true"] .leaf-upload__count {
4578
- color: var(--system-red);
4579
- }
4580
-
4581
- .leaf-upload[data-invalid="true"]:not([data-disabled="true"]):not([data-at-max="true"])
4582
- .leaf-upload__zone:hover {
4583
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--system-red) 16%, transparent);
4584
- }
4585
-
4586
- .leaf-upload[data-disabled="true"],
4587
- .leaf-upload[data-at-max="true"] {
4588
- --leaf-upload-border: var(--base-quaternary);
4589
- --leaf-upload-fg: var(--text-secondary);
4590
- --leaf-upload-muted: var(--text-tertiary);
4591
- --leaf-upload-icon: var(--text-tertiary);
4592
- --leaf-upload-icon-bg: var(--base-tertiary);
4593
- }
4594
-
4595
- .leaf-upload[data-disabled="true"] .leaf-upload__label,
4596
- .leaf-upload[data-at-max="true"] .leaf-upload__label {
4597
- color: var(--text-tertiary);
4598
- }
4599
-
4600
- .leaf-upload[data-disabled="true"] .leaf-upload__zone,
4601
- .leaf-upload[data-at-max="true"] .leaf-upload__zone {
4602
- cursor: not-allowed;
4603
- box-shadow: none;
4604
- }
4605
-
4606
- .leaf-upload[data-disabled="true"] .leaf-upload__remove {
4607
- display: none;
4608
- }
4609
- }
4610
-
4611
- /* --- src/styles/color.css --- */
4612
-
4613
- /*
4614
- * Color classes — map 1:1 sang semantic token trong @finhay/leaf-tokens.
4615
- *
4616
- * Quy tắc tên: **tiền tố nói thuộc tính, phần sau nói vai trò của token**.
4617
- *
4618
- * text-* → color (text-primary, text-red)
4619
- * bg-* → background-color (bg-primary, bg-red) — token vẫn là --base-*
4620
- * border-* → border-color (border-primary, border-red)
4621
- *
4622
- * Ba bộ dùng chung một hậu tố nên đọc là đoán được: `text-red` / `bg-red` /
4623
- * `border-red`, `text-primary` / `bg-primary` / `border-primary`. Nhóm system
4624
- * bỏ chữ `system` trong tên class (token vẫn là `--system-red`), còn `border-*`
4625
- * lấy màu từ thang base vì viền luôn là màu bề mặt. Secondary của system giữ
4626
- * hậu tố `-secondary` (vd. `text-red-secondary` ↔ `--system-red-secondary`).
4627
- *
4628
- * Mỗi class chỉ set đúng 1 thuộc tính (color / background-color / border-color)
4629
- * — độ dày / style viền do app khai báo (Tailwind `border`, hoặc CSS của page).
4630
- * Class tự đổi giá trị theo `[data-theme="light"]` vì nó trỏ vào var, không hard-code màu.
4631
- *
4632
- * Chỉ semantic token mới có class. Primitive (--neutral-500, --brand-300…) là
4633
- * nguồn nội bộ, không dùng thẳng trong UI.
4634
- *
4635
- * ─ Vì sao `@layer utilities` ─────────────────────────────────────────────────
4636
- *
4637
- * Màu của Leaf là token gốc, trùng tên thì phải thắng. Đặt ở layer cao nhất
4638
- * nên `.text-primary` của Leaf luôn có hiệu lực khi trùng tên.
4639
- *
4640
- * Biến thể trạng thái vẫn override được vì pseudo-class cộng thêm specificity.
4641
- */
4642
-
4643
- @layer utilities {
4644
- /* Text color — content */
4645
-
4646
- .text-highlight {
4647
- color: var(--text-highlight);
4648
- }
4649
-
4650
- .text-primary {
4651
- color: var(--text-primary);
4652
- }
4653
-
4654
- .text-secondary {
4655
- color: var(--text-secondary);
4656
- }
4657
-
4658
- .text-tertiary {
4659
- color: var(--text-tertiary);
4660
- }
4661
-
4662
- .text-quaternary {
4663
- color: var(--text-quaternary);
4664
- }
4665
-
4666
- /* Text color — system */
4667
-
4668
- .text-blue {
4669
- color: var(--system-blue);
4670
- }
4671
-
4672
- .text-green {
4673
- color: var(--system-green);
4674
- }
4675
-
4676
- .text-yellow {
4677
- color: var(--system-yellow);
4678
- }
4679
-
4680
- .text-orange {
4681
- color: var(--system-orange);
4682
- }
4683
-
4684
- .text-red {
4685
- color: var(--system-red);
4686
- }
4687
-
4688
- .text-purple {
4689
- color: var(--system-purple);
4690
- }
4691
-
4692
- .text-blue-secondary {
4693
- color: var(--system-blue-secondary);
4694
- }
4695
-
4696
- .text-green-secondary {
4697
- color: var(--system-green-secondary);
4698
- }
4699
-
4700
- .text-yellow-secondary {
4701
- color: var(--system-yellow-secondary);
4702
- }
4703
-
4704
- .text-orange-secondary {
4705
- color: var(--system-orange-secondary);
4706
- }
4707
-
4708
- .text-red-secondary {
4709
- color: var(--system-red-secondary);
4710
- }
4711
-
4712
- .text-purple-secondary {
4713
- color: var(--system-purple-secondary);
4714
- }
4715
-
4716
- /* Background — surface (--base-*) + system */
4717
-
4718
- .bg-highlight {
4719
- background-color: var(--text-highlight);
4720
- }
4721
-
4722
- .bg-primary {
4723
- background-color: var(--base-primary);
4724
- }
4725
-
4726
- .bg-secondary {
4727
- background-color: var(--base-secondary);
4728
- }
4729
-
4730
- .bg-tertiary {
4731
- background-color: var(--base-tertiary);
4732
- }
4733
-
4734
- .bg-quaternary {
4735
- background-color: var(--base-quaternary);
4736
- }
4737
-
4738
- .bg-quinary {
4739
- background-color: var(--base-quinary);
4740
- }
4741
-
4742
- /* Background — system */
4743
-
4744
- .bg-blue {
4745
- background-color: var(--system-blue);
4746
- }
4747
-
4748
- .bg-green {
4749
- background-color: var(--system-green);
4750
- }
4751
-
4752
- .bg-yellow {
4753
- background-color: var(--system-yellow);
4754
- }
4755
-
4756
- .bg-orange {
4757
- background-color: var(--system-orange);
4758
- }
4759
-
4760
- .bg-red {
4761
- background-color: var(--system-red);
4762
- }
4763
-
4764
- .bg-purple {
4765
- background-color: var(--system-purple);
4766
- }
4767
-
4768
- .bg-blue-secondary {
4769
- background-color: var(--system-blue-secondary);
4770
- }
4771
-
4772
- .bg-green-secondary {
4773
- background-color: var(--system-green-secondary);
4774
- }
4775
-
4776
- .bg-yellow-secondary {
4777
- background-color: var(--system-yellow-secondary);
4778
- }
4779
-
4780
- .bg-orange-secondary {
4781
- background-color: var(--system-orange-secondary);
4782
- }
4783
-
4784
- .bg-red-secondary {
4785
- background-color: var(--system-red-secondary);
4786
- }
4787
-
4788
- .bg-purple-secondary {
4789
- background-color: var(--system-purple-secondary);
4790
- }
4791
-
4792
- /* Border color — base */
4793
-
4794
- .border-highlight {
4795
- border-color: var(--text-highlight);
4796
- }
4797
-
4798
- .border-primary {
4799
- border-color: var(--base-primary);
4800
- }
4801
-
4802
- .border-secondary {
4803
- border-color: var(--base-secondary);
4804
- }
4805
-
4806
- .border-tertiary {
4807
- border-color: var(--base-tertiary);
4808
- }
4809
-
4810
- .border-quaternary {
4811
- border-color: var(--base-quaternary);
4812
- }
4813
-
4814
- .border-quinary {
4815
- border-color: var(--base-quinary);
4816
- }
4817
-
4818
- /* Border color — system */
4819
-
4820
- .border-blue {
4821
- border-color: var(--system-blue);
4822
- }
4823
-
4824
- .border-green {
4825
- border-color: var(--system-green);
4826
- }
4827
-
4828
- .border-yellow {
4829
- border-color: var(--system-yellow);
4830
- }
4831
-
4832
- .border-orange {
4833
- border-color: var(--system-orange);
4834
- }
4835
-
4836
- .border-red {
4837
- border-color: var(--system-red);
4838
- }
4839
-
4840
- .border-purple {
4841
- border-color: var(--system-purple);
4842
- }
4843
-
4844
- .border-blue-secondary {
4845
- border-color: var(--system-blue-secondary);
4846
- }
4847
-
4848
- .border-green-secondary {
4849
- border-color: var(--system-green-secondary);
4850
- }
4851
-
4852
- .border-yellow-secondary {
4853
- border-color: var(--system-yellow-secondary);
4854
- }
4855
-
4856
- .border-orange-secondary {
4857
- border-color: var(--system-orange-secondary);
4858
- }
4859
-
4860
- .border-red-secondary {
4861
- border-color: var(--system-red-secondary);
4862
- }
4863
-
4864
- .border-purple-secondary {
4865
- border-color: var(--system-purple-secondary);
4866
- }
4867
- }
4868
-
4869
- /* --- src/styles/focus.css --- */
4870
-
4871
- /*
4872
- * Leaf — không hiện outline khi focus bằng chuột / chạm trên control `.leaf-*`.
4873
- *
4874
- * Chỉ `:focus:not(:focus-visible)`: focus bằng bàn phím (`:focus-visible`) vẫn có ring token do
4875
- * CSS từng component vẽ (WCAG 2.4.7). Chỉ nhắm chính phần tử có class `leaf-*`, KHÔNG nhắm phần
4876
- * tử con — nút / link của app nằm trong Dialog, `.leaf-form`… giữ nguyên focus ring của app.
4877
- */
4878
-
4879
- @layer components {
4880
- :where([class^="leaf-"], [class*=" leaf-"]):focus:not(:focus-visible) {
4881
- outline: none;
4882
- }
4883
- }
4884
-
4885
- /* --- src/styles/typography.css --- */
4886
-
4887
- /*
4888
- * Typography classes — map 1:1 sang token trong @finhay/leaf-tokens.
4889
- *
4890
- * Tên class trùng đúng tên token trong Figma, không có prefix: đọc DOM là biết
4891
- * ngay style đang dùng, và không cần import gì trong JS để dùng được.
4892
- *
4893
- * Mỗi class set: font-family (Inter qua --font-sans) + size + line-height +
4894
- * weight (400 / 600 / 700 theo token). Letter spacing, margin, màu chữ không
4895
- * thuộc stylesheet này — màu dùng class text-* riêng.
4896
- *
4897
- * Toàn bộ nằm trong `@layer components` — SCSS module (ngoài layer) override được.
4898
- */
4899
-
4900
- @layer components {
4901
- :is(
4902
- .display-1,
4903
- .display-2,
4904
- .display-3,
4905
- .heading-1,
4906
- .heading-2,
4907
- .heading-3,
4908
- .body-1,
4909
- .body-1-highlight,
4910
- .body-2,
4911
- .body-2-highlight,
4912
- .body-3,
4913
- .body-3-highlight,
4914
- .body-4,
4915
- .body-4-highlight,
4916
- .body-5,
4917
- .body-5-highlight
4918
- ) {
4919
- font-family: var(--font-sans);
4920
- }
4921
-
4922
- /* Display */
4923
-
4924
- .display-1 {
4925
- font-size: var(--display-1-size);
4926
- line-height: var(--display-1-line-height);
4927
- font-weight: var(--display-1-weight);
4928
- }
4929
-
4930
- .display-2 {
4931
- font-size: var(--display-2-size);
4932
- line-height: var(--display-2-line-height);
4933
- font-weight: var(--display-2-weight);
4934
- }
4935
-
4936
- .display-3 {
4937
- font-size: var(--display-3-size);
4938
- line-height: var(--display-3-line-height);
4939
- font-weight: var(--display-3-weight);
4940
- }
4941
-
4942
- /* Heading */
4943
-
4944
- .heading-1 {
4945
- font-size: var(--heading-1-size);
4946
- line-height: var(--heading-1-line-height);
4947
- font-weight: var(--heading-1-weight);
4948
- }
4949
-
4950
- .heading-2 {
4951
- font-size: var(--heading-2-size);
4952
- line-height: var(--heading-2-line-height);
4953
- font-weight: var(--heading-2-weight);
4954
- }
4955
-
4956
- .heading-3 {
4957
- font-size: var(--heading-3-size);
4958
- line-height: var(--heading-3-line-height);
4959
- font-weight: var(--heading-3-weight);
4960
- }
4961
-
4962
- /* Body 1 */
4963
-
4964
- .body-1 {
4965
- font-size: var(--body-1-size);
4966
- line-height: var(--body-1-line-height);
4967
- font-weight: var(--body-1-weight);
4968
- }
4969
-
4970
- .body-1-highlight {
4971
- font-size: var(--body-1-size);
4972
- line-height: var(--body-1-line-height);
4973
- font-weight: var(--body-1-highlight-weight);
4974
- }
4975
-
4976
- /* Body 2 */
4977
-
4978
- .body-2 {
4979
- font-size: var(--body-2-size);
4980
- line-height: var(--body-2-line-height);
4981
- font-weight: var(--body-2-weight);
4982
- }
4983
-
4984
- .body-2-highlight {
4985
- font-size: var(--body-2-size);
4986
- line-height: var(--body-2-line-height);
4987
- font-weight: var(--body-2-highlight-weight);
4988
- }
4989
-
4990
- /* Body 3 */
4991
-
4992
- .body-3 {
4993
- font-size: var(--body-3-size);
4994
- line-height: var(--body-3-line-height);
4995
- font-weight: var(--body-3-weight);
4996
- }
4997
-
4998
- .body-3-highlight {
4999
- font-size: var(--body-3-size);
5000
- line-height: var(--body-3-line-height);
5001
- font-weight: var(--body-3-highlight-weight);
5002
- }
5003
-
5004
- /* Body 4 */
5005
-
5006
- .body-4 {
5007
- font-size: var(--body-4-size);
5008
- line-height: var(--body-4-line-height);
5009
- font-weight: var(--body-4-weight);
5010
- }
5011
-
5012
- .body-4-highlight {
5013
- font-size: var(--body-4-size);
5014
- line-height: var(--body-4-line-height);
5015
- font-weight: var(--body-4-highlight-weight);
5016
- }
5017
-
5018
- /* Body 5 */
5019
-
5020
- .body-5 {
5021
- font-size: var(--body-5-size);
5022
- line-height: var(--body-5-line-height);
5023
- font-weight: var(--body-5-weight);
5024
- }
5025
-
5026
- .body-5-highlight {
5027
- font-size: var(--body-5-size);
5028
- line-height: var(--body-5-line-height);
5029
- font-weight: var(--body-5-highlight-weight);
5030
- }
5031
- }