@finhay-pro/leaf-design-system 0.1.1 → 0.1.2

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 (120) hide show
  1. package/README.md +106 -65
  2. package/dist/button.css +1 -0
  3. package/dist/cdn/leaf-0.1.2.min.css +2 -0
  4. package/dist/cdn/leaf-0.1.2.min.js +2 -0
  5. package/dist/classes.css +840 -3
  6. package/dist/components/Dialog/Dialog.d.ts +35 -0
  7. package/dist/components/Dialog/Dialog.d.ts.map +1 -0
  8. package/dist/components/Dialog/Dialog.js +63 -0
  9. package/dist/components/Dialog/Dialog.js.map +1 -0
  10. package/dist/components/Dialog/index.d.ts +2 -0
  11. package/dist/components/Dialog/index.d.ts.map +1 -0
  12. package/dist/components/Dialog/index.js +2 -0
  13. package/dist/components/Dialog/index.js.map +1 -0
  14. package/dist/components/Loading/Loading.d.ts +24 -0
  15. package/dist/components/Loading/Loading.d.ts.map +1 -0
  16. package/dist/components/Loading/Loading.js +28 -0
  17. package/dist/components/Loading/Loading.js.map +1 -0
  18. package/dist/components/Loading/index.d.ts +2 -0
  19. package/dist/components/Loading/index.d.ts.map +1 -0
  20. package/dist/components/Loading/index.js +2 -0
  21. package/dist/components/Loading/index.js.map +1 -0
  22. package/dist/components/Logo/Logo.d.ts +29 -0
  23. package/dist/components/Logo/Logo.d.ts.map +1 -0
  24. package/dist/components/Logo/Logo.js +39 -0
  25. package/dist/components/Logo/Logo.js.map +1 -0
  26. package/dist/components/Logo/assets.d.ts +11 -0
  27. package/dist/components/Logo/assets.d.ts.map +1 -0
  28. package/dist/components/Logo/assets.js +35 -0
  29. package/dist/components/Logo/assets.js.map +1 -0
  30. package/dist/components/Logo/index.d.ts +2 -0
  31. package/dist/components/Logo/index.d.ts.map +1 -0
  32. package/dist/components/Logo/index.js +2 -0
  33. package/dist/components/Logo/index.js.map +1 -0
  34. package/dist/components/Skeleton/Skeleton.d.ts +16 -0
  35. package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
  36. package/dist/components/Skeleton/Skeleton.js +18 -0
  37. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  38. package/dist/components/Skeleton/index.d.ts +2 -0
  39. package/dist/components/Skeleton/index.d.ts.map +1 -0
  40. package/dist/components/Skeleton/index.js +2 -0
  41. package/dist/components/Skeleton/index.js.map +1 -0
  42. package/dist/components/Slider/Slider.d.ts +52 -0
  43. package/dist/components/Slider/Slider.d.ts.map +1 -0
  44. package/dist/components/Slider/Slider.js +173 -0
  45. package/dist/components/Slider/Slider.js.map +1 -0
  46. package/dist/components/Slider/index.d.ts +2 -0
  47. package/dist/components/Slider/index.d.ts.map +1 -0
  48. package/dist/components/Slider/index.js +2 -0
  49. package/dist/components/Slider/index.js.map +1 -0
  50. package/dist/components/Tabs/Tabs.d.ts +7 -1
  51. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  52. package/dist/components/Tabs/Tabs.js +50 -11
  53. package/dist/components/Tabs/Tabs.js.map +1 -1
  54. package/dist/components/Toggle/Toggle.d.ts +22 -0
  55. package/dist/components/Toggle/Toggle.d.ts.map +1 -0
  56. package/dist/components/Toggle/Toggle.js +29 -0
  57. package/dist/components/Toggle/Toggle.js.map +1 -0
  58. package/dist/components/Toggle/index.d.ts +2 -0
  59. package/dist/components/Toggle/index.d.ts.map +1 -0
  60. package/dist/components/Toggle/index.js +2 -0
  61. package/dist/components/Toggle/index.js.map +1 -0
  62. package/dist/components/Tooltip/Tooltip.d.ts +51 -0
  63. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
  64. package/dist/components/Tooltip/Tooltip.js +71 -0
  65. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  66. package/dist/components/Tooltip/index.d.ts +2 -0
  67. package/dist/components/Tooltip/index.d.ts.map +1 -0
  68. package/dist/components/Tooltip/index.js +2 -0
  69. package/dist/components/Tooltip/index.js.map +1 -0
  70. package/dist/core/dialog.d.ts +21 -0
  71. package/dist/core/dialog.d.ts.map +1 -0
  72. package/dist/core/dialog.js +89 -0
  73. package/dist/core/dialog.js.map +1 -0
  74. package/dist/core/focus.d.ts +8 -0
  75. package/dist/core/focus.d.ts.map +1 -0
  76. package/dist/core/focus.js +18 -0
  77. package/dist/core/focus.js.map +1 -0
  78. package/dist/core/slider.d.ts +35 -0
  79. package/dist/core/slider.d.ts.map +1 -0
  80. package/dist/core/slider.js +81 -0
  81. package/dist/core/slider.js.map +1 -0
  82. package/dist/core/tabs.d.ts +9 -0
  83. package/dist/core/tabs.d.ts.map +1 -0
  84. package/dist/core/tabs.js +30 -0
  85. package/dist/core/tabs.js.map +1 -0
  86. package/dist/core/tooltip.d.ts +21 -0
  87. package/dist/core/tooltip.d.ts.map +1 -0
  88. package/dist/core/tooltip.js +103 -0
  89. package/dist/core/tooltip.js.map +1 -0
  90. package/dist/dialog.css +153 -0
  91. package/dist/index.d.ts +8 -1
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +8 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist/loading.css +114 -0
  96. package/dist/logo-assets.css +80 -0
  97. package/dist/logo.css +46 -0
  98. package/dist/skeleton.css +48 -0
  99. package/dist/slider.css +204 -0
  100. package/dist/styles.css +850 -7
  101. package/dist/tabs.css +1 -0
  102. package/dist/toggle.css +106 -0
  103. package/dist/tokens.css +10 -4
  104. package/dist/tooltip.css +150 -0
  105. package/dist/typography.css +24 -3
  106. package/dist/utils/toCssSize.d.ts +4 -0
  107. package/dist/utils/toCssSize.d.ts.map +1 -0
  108. package/dist/utils/toCssSize.js +7 -0
  109. package/dist/utils/toCssSize.js.map +1 -0
  110. package/dist/utils/useControllableState.d.ts +10 -0
  111. package/dist/utils/useControllableState.d.ts.map +1 -0
  112. package/dist/utils/useControllableState.js +17 -0
  113. package/dist/utils/useControllableState.js.map +1 -0
  114. package/dist/utils/useMounted.d.ts +3 -0
  115. package/dist/utils/useMounted.d.ts.map +1 -0
  116. package/dist/utils/useMounted.js +11 -0
  117. package/dist/utils/useMounted.js.map +1 -0
  118. package/package.json +13 -2
  119. package/dist/cdn/leaf-0.1.1.min.css +0 -2
  120. package/dist/cdn/leaf-0.1.1.min.js +0 -2
package/dist/styles.css CHANGED
@@ -132,6 +132,9 @@
132
132
  --button-content-secondary: var(--brand-500);
133
133
  --button-content-destruction: var(--red-500);
134
134
  --button-content-disable: var(--neutral-500);
135
+
136
+ /* Overlay — Figma 995:6039 (Overlay/Overlay). */
137
+ --overlay: #171719cc;
135
138
  }
136
139
 
137
140
  [data-theme="light"] {
@@ -169,17 +172,20 @@
169
172
  --button-content-secondary: var(--brand-700);
170
173
  --button-content-destruction: var(--red-600);
171
174
  --button-content-disable: var(--neutral-400);
175
+
176
+ /* Overlay — cùng token Figma; phủ tối trên nền sáng. */
177
+ --overlay: #171719cc;
172
178
  }
173
179
 
174
180
  /* --- ../tokens/src/typography.css --- */
175
181
 
176
- /* Typography tokens — Desktop Figma 749:414. Inter; letter-spacing 0. */
182
+ /* Typography tokens — Desktop Figma 749:414. Inter only; weights 400 / 600 / 700. */
177
183
 
178
184
  :root {
179
185
  /*
180
- * `--font-inter` do next/font đặt trong app Next.js. Trang khác (HTML tĩnh) không có
181
- * biến này → phải có fallback, nếu không cả `--font-sans` thành invalid và rơi về font
182
- * mặc định của trình duyệt.
186
+ * `--font-inter` do next/font (hoặc @font-face) đặt trong app. HTML tĩnh /
187
+ * CDN không có biến này → fallback "Inter" rồi system stack.
188
+ * Weight chỉ dùng 400, 600, 700 — khớp Figma và bản font đã load.
183
189
  */
184
190
  --font-sans: var(--font-inter, "Inter"), ui-sans-serif, system-ui, sans-serif;
185
191
 
@@ -281,6 +287,7 @@
281
287
  text-align: center;
282
288
  white-space: nowrap;
283
289
  font: inherit;
290
+ font-family: var(--font-sans);
284
291
  font-size: var(--leaf-button-font-size);
285
292
  line-height: var(--leaf-button-line-height);
286
293
  font-weight: var(--leaf-button-font-weight);
@@ -406,6 +413,566 @@
406
413
  }
407
414
  }
408
415
 
416
+ /* --- src/components/Dialog/dialog.css --- */
417
+
418
+ /*
419
+ * Dialog — Figma 994:4149.
420
+ *
421
+ * Backdrop phủ toàn màn hình + blur; panel căn giữa. Header (back · title · close)
422
+ * bật/tắt qua markup — React chỉ gắn/gỡ phần tử, không gắn class typography/màu
423
+ * theo prop. Thiếu phần header → chỉ còn body (children).
424
+ */
425
+
426
+ @layer components {
427
+ .leaf-dialog-backdrop {
428
+ position: fixed;
429
+ inset: 0;
430
+ z-index: 50;
431
+ display: flex;
432
+ align-items: center;
433
+ justify-content: center;
434
+ padding: 16px;
435
+ box-sizing: border-box;
436
+ /* Overlay — Figma 995:6039: Overlay/Overlay + BACKGROUND_BLUR radius 20. */
437
+ background-color: var(--overlay);
438
+ backdrop-filter: blur(20px);
439
+ -webkit-backdrop-filter: blur(20px);
440
+ }
441
+
442
+ /* `display` ở trên thắng `[hidden]` của trình duyệt — khai báo lại để HTML tĩnh ẩn được. */
443
+ .leaf-dialog-backdrop[hidden] {
444
+ display: none;
445
+ }
446
+
447
+ .leaf-dialog {
448
+ --leaf-dialog-gap: 16px;
449
+ --leaf-dialog-padding: 16px;
450
+ --leaf-dialog-radius: 12px;
451
+ --leaf-dialog-back-size: 24px;
452
+ --leaf-dialog-close-size: 28px;
453
+ --leaf-dialog-close-icon: 20px;
454
+
455
+ display: flex;
456
+ flex-direction: column;
457
+ gap: var(--leaf-dialog-gap);
458
+ width: var(--leaf-dialog-width, 100%);
459
+ height: var(--leaf-dialog-height, auto);
460
+ max-width: 100%;
461
+ max-height: 100%;
462
+ margin: 0;
463
+ padding: var(--leaf-dialog-padding);
464
+ overflow: hidden;
465
+ box-sizing: border-box;
466
+ border-radius: var(--leaf-dialog-radius);
467
+ background-color: var(--base-primary);
468
+ color: var(--text-primary);
469
+ font-family: var(--font-sans);
470
+ }
471
+
472
+ /* Panel nhận focus khi mở (tabindex="-1") — không phải control nên không vẽ outline. */
473
+ .leaf-dialog:focus {
474
+ outline: none;
475
+ }
476
+
477
+ .leaf-dialog__header {
478
+ display: flex;
479
+ flex-shrink: 0;
480
+ align-items: center;
481
+ justify-content: space-between;
482
+ gap: var(--leaf-dialog-gap);
483
+ width: 100%;
484
+ min-width: 0;
485
+ }
486
+
487
+ /* Cụm trái: back + title */
488
+ .leaf-dialog__start {
489
+ display: flex;
490
+ align-items: center;
491
+ gap: var(--leaf-dialog-gap);
492
+ min-width: 0;
493
+ flex: 1 1 auto;
494
+ }
495
+
496
+ /* Chỉ truncate layout — font/màu dùng class heading-3 text-primary trên markup. */
497
+ .leaf-dialog__start > :where(h2, p) {
498
+ margin: 0;
499
+ min-width: 0;
500
+ overflow: hidden;
501
+ text-overflow: ellipsis;
502
+ white-space: nowrap;
503
+ }
504
+
505
+ .leaf-dialog__back,
506
+ .leaf-dialog__close {
507
+ display: inline-flex;
508
+ flex-shrink: 0;
509
+ align-items: center;
510
+ justify-content: center;
511
+ margin: 0;
512
+ padding: 0;
513
+ border: none;
514
+ cursor: pointer;
515
+ color: var(--text-primary);
516
+ background: transparent;
517
+ font: inherit;
518
+ appearance: none;
519
+ box-sizing: border-box;
520
+ }
521
+
522
+ .leaf-dialog__back {
523
+ width: var(--leaf-dialog-back-size);
524
+ height: var(--leaf-dialog-back-size);
525
+ }
526
+
527
+ .leaf-dialog__back:hover,
528
+ .leaf-dialog__close:hover {
529
+ color: var(--text-highlight);
530
+ }
531
+
532
+ .leaf-dialog__back:focus-visible,
533
+ .leaf-dialog__close:focus-visible {
534
+ outline: 2px solid var(--text-highlight);
535
+ outline-offset: 2px;
536
+ }
537
+
538
+ .leaf-dialog__icon {
539
+ display: block;
540
+ width: 1em;
541
+ height: 1em;
542
+ }
543
+
544
+ .leaf-dialog__back .leaf-dialog__icon {
545
+ font-size: var(--leaf-dialog-back-size);
546
+ }
547
+
548
+ .leaf-dialog__close {
549
+ width: var(--leaf-dialog-close-size);
550
+ min-height: var(--leaf-dialog-close-size);
551
+ padding: 4px 6px;
552
+ border-radius: 100px;
553
+ background-color: var(--base-secondary);
554
+ font-size: var(--leaf-dialog-close-icon);
555
+ }
556
+
557
+ .leaf-dialog__body {
558
+ display: flex;
559
+ flex: 1 1 auto;
560
+ flex-direction: column;
561
+ gap: var(--leaf-dialog-gap);
562
+ min-height: 0;
563
+ width: 100%;
564
+ overflow: auto;
565
+ }
566
+ }
567
+
568
+ /* --- src/components/Loading/loading.css --- */
569
+
570
+ /*
571
+ * Loading — SVG loader-line (Figma Button), viewBox 0 0 21 21.
572
+ *
573
+ * Variant animation qua data-animation; size qua data-size; overlay fullscreen
574
+ * qua .leaf-loading-overlay. Màu = currentColor. Thiếu attribute → md · spin.
575
+ */
576
+
577
+ @layer components {
578
+ .leaf-loading {
579
+ --leaf-loading-size: 24px;
580
+ --leaf-loading-duration: 1.2s;
581
+
582
+ display: inline-flex;
583
+ flex-shrink: 0;
584
+ align-items: center;
585
+ justify-content: center;
586
+ width: var(--leaf-loading-size);
587
+ height: var(--leaf-loading-size);
588
+ color: inherit;
589
+ vertical-align: middle;
590
+ line-height: 0;
591
+ }
592
+
593
+ .leaf-loading__icon {
594
+ display: block;
595
+ width: 100%;
596
+ height: 100%;
597
+ }
598
+
599
+ /* Fullscreen overlay — pattern Spinner (portal + nền mờ). */
600
+ .leaf-loading-overlay {
601
+ position: fixed;
602
+ inset: 0;
603
+ z-index: 100;
604
+ display: flex;
605
+ align-items: center;
606
+ justify-content: center;
607
+ box-sizing: border-box;
608
+ background-color: var(--overlay);
609
+ color: var(--text-highlight);
610
+ }
611
+
612
+ /* `display` ở trên thắng `[hidden]` của trình duyệt — khai báo lại để HTML tĩnh ẩn được. */
613
+ .leaf-loading-overlay[hidden] {
614
+ display: none;
615
+ }
616
+
617
+ /* ── Size ────────────────────────────────────────────────────────────── */
618
+
619
+ .leaf-loading[data-size="lg"] {
620
+ --leaf-loading-size: 30px;
621
+ }
622
+
623
+ .leaf-loading[data-size="sm"] {
624
+ --leaf-loading-size: 20px;
625
+ }
626
+
627
+ /* ── Animations ──────────────────────────────────────────────────────── */
628
+
629
+ /* spin — xoay cả icon (mặc định). */
630
+ .leaf-loading[data-animation="spin"] .leaf-loading__icon,
631
+ .leaf-loading:not([data-animation]) .leaf-loading__icon {
632
+ animation: leaf-loading-spin var(--leaf-loading-duration) linear infinite;
633
+ }
634
+
635
+ /*
636
+ * fade — xoay + mask conic để tạo hiệu ứng đuôi mờ (kiểu iOS trên 1 path).
637
+ */
638
+ .leaf-loading[data-animation="fade"] .leaf-loading__icon {
639
+ animation: leaf-loading-spin var(--leaf-loading-duration) linear infinite;
640
+ mask-image: conic-gradient(from 0deg, transparent 0%, #000 70%, #000 100%);
641
+ -webkit-mask-image: conic-gradient(from 0deg, transparent 0%, #000 70%, #000 100%);
642
+ }
643
+
644
+ /* pulse — scale nhịp. */
645
+ .leaf-loading[data-animation="pulse"] .leaf-loading__icon {
646
+ animation: leaf-loading-pulse 1s ease-in-out infinite;
647
+ }
648
+
649
+ /* breathe — mờ/đậm cả icon. */
650
+ .leaf-loading[data-animation="breathe"] .leaf-loading__icon {
651
+ animation: leaf-loading-breathe 1.2s ease-in-out infinite;
652
+ }
653
+ }
654
+
655
+ @keyframes leaf-loading-spin {
656
+ to {
657
+ transform: rotate(360deg);
658
+ }
659
+ }
660
+
661
+ @keyframes leaf-loading-pulse {
662
+ 0%,
663
+ 100% {
664
+ transform: scale(0.85);
665
+ }
666
+ 50% {
667
+ transform: scale(1);
668
+ }
669
+ }
670
+
671
+ @keyframes leaf-loading-breathe {
672
+ 0%,
673
+ 100% {
674
+ opacity: 0.35;
675
+ }
676
+ 50% {
677
+ opacity: 1;
678
+ }
679
+ }
680
+
681
+ /* --- src/components/Logo/logo.css --- */
682
+
683
+ /*
684
+ * Logo — Figma 924:1074.
685
+ *
686
+ * React: chọn SVG trong assets.ts, render <img class="leaf-logo__img">.
687
+ * HTML tĩnh: span.leaf-logo:empty + data-brand / data-mode / data-side — rule
688
+ * background-image nằm ở logo-assets.css (generated bởi scripts/embed-logo-assets.mjs,
689
+ * không gộp vào classes.css / styles.css; bản CDN đã gộp sẵn).
690
+ * Size (chiều cao) qua --leaf-logo-size.
691
+ */
692
+
693
+ @layer components {
694
+ .leaf-logo {
695
+ display: inline-flex;
696
+ flex-shrink: 0;
697
+ align-items: center;
698
+ justify-content: center;
699
+ margin: 0;
700
+ padding: 0;
701
+ border: none;
702
+ background: transparent;
703
+ background-repeat: no-repeat;
704
+ background-position: center;
705
+ background-size: contain;
706
+ line-height: 0;
707
+ vertical-align: middle;
708
+ box-sizing: border-box;
709
+ }
710
+
711
+ /* HTML tĩnh — không có <img>, asset lấy từ data-* */
712
+ .leaf-logo:empty {
713
+ display: inline-block;
714
+ height: var(--leaf-logo-size, 40px);
715
+ width: calc(var(--leaf-logo-size, 40px) * var(--leaf-logo-aspect, 1));
716
+ }
717
+
718
+ .leaf-logo__img {
719
+ display: block;
720
+ height: var(--leaf-logo-size, 40px);
721
+ width: auto;
722
+ max-width: 100%;
723
+ }
724
+ }
725
+
726
+ /* --- src/components/Skeleton/skeleton.css --- */
727
+
728
+ /*
729
+ * Skeleton — placeholder shimmer.
730
+ *
731
+ * Nền `--base-tertiary` (dark: #28292B). Kích thước / radius qua custom property
732
+ * từ React (hoặc style inline khi HTML tĩnh). Thiếu biến → full width/height,
733
+ * radius 12px.
734
+ */
735
+
736
+ @layer components {
737
+ .leaf-skeleton {
738
+ --leaf-skeleton-width: 100%;
739
+ --leaf-skeleton-height: 100%;
740
+ --leaf-skeleton-radius: 12px;
741
+
742
+ position: relative;
743
+ overflow: hidden;
744
+ box-sizing: border-box;
745
+ width: var(--leaf-skeleton-width);
746
+ height: var(--leaf-skeleton-height);
747
+ border-radius: var(--leaf-skeleton-radius);
748
+ background-color: var(--base-tertiary);
749
+ }
750
+
751
+ .leaf-skeleton__shimmer {
752
+ position: absolute;
753
+ inset: 0;
754
+ background: linear-gradient(
755
+ to right,
756
+ transparent,
757
+ color-mix(in srgb, var(--base-quinary) 10%, transparent),
758
+ transparent
759
+ );
760
+ animation: leaf-skeleton-shimmer 2s infinite ease-in-out;
761
+ }
762
+ }
763
+
764
+ @keyframes leaf-skeleton-shimmer {
765
+ 0% {
766
+ transform: translateX(-100%);
767
+ }
768
+ 100% {
769
+ transform: translateX(100%);
770
+ }
771
+ }
772
+
773
+ /* --- src/components/Slider/slider.css --- */
774
+
775
+ /*
776
+ * Slider — Figma 730:12646.
777
+ *
778
+ * Giá trị liên tục trên rail (kéo / click chính xác tới từng step). Mốc chia đều
779
+ * đặt tuyệt đối theo `left: <%>`; thumb (điểm đang chọn) đặt ở `--leaf-slider-fill`,
780
+ * màu --leaf-slider-active. Kích thước qua --leaf-slider-mark / --leaf-slider-mark-active.
781
+ *
782
+ * Rail, mốc và thumb cùng nằm trong vùng lùi vào `--leaf-slider-inset` ở hai đầu
783
+ * (nửa thumb) — nhờ vậy `left: X%` của cả ba khớp nhau và thumb không tràn ra ngoài.
784
+ */
785
+
786
+ @layer components {
787
+ .leaf-slider {
788
+ --leaf-slider-active: var(--system-green);
789
+ --leaf-slider-fill: 0%;
790
+ --leaf-slider-mark: 6px;
791
+ --leaf-slider-mark-active: 10px;
792
+ --leaf-slider-rail-height: 2px;
793
+ --leaf-slider-inset: calc(var(--leaf-slider-mark-active) / 2);
794
+ --leaf-slider-control-height: max(
795
+ var(--leaf-slider-mark-active),
796
+ var(--leaf-slider-mark),
797
+ 20px
798
+ );
799
+
800
+ display: flex;
801
+ flex-direction: column;
802
+ gap: 4px;
803
+ width: 100%;
804
+ box-sizing: border-box;
805
+ font-family: var(--font-sans);
806
+ font-size: var(--body-5-size);
807
+ line-height: var(--body-5-line-height);
808
+ font-weight: var(--body-5-weight);
809
+ color: var(--text-primary);
810
+ user-select: none;
811
+ -webkit-user-select: none;
812
+ touch-action: none;
813
+ }
814
+
815
+ .leaf-slider__header {
816
+ display: flex;
817
+ align-items: flex-start;
818
+ justify-content: space-between;
819
+ gap: 8px;
820
+ width: 100%;
821
+ color: var(--text-primary);
822
+ white-space: nowrap;
823
+ user-select: text;
824
+ -webkit-user-select: text;
825
+ }
826
+
827
+ .leaf-slider__title,
828
+ .leaf-slider__unit {
829
+ min-width: 0;
830
+ }
831
+
832
+ .leaf-slider__unit {
833
+ text-align: right;
834
+ }
835
+
836
+ .leaf-slider__control {
837
+ position: relative;
838
+ display: flex;
839
+ align-items: center;
840
+ width: 100%;
841
+ height: var(--leaf-slider-control-height);
842
+ outline: none;
843
+ cursor: pointer;
844
+ }
845
+
846
+ .leaf-slider__control:focus-visible {
847
+ outline: 2px solid var(--leaf-slider-active);
848
+ outline-offset: 4px;
849
+ border-radius: 4px;
850
+ }
851
+
852
+ .leaf-slider[data-dragging="true"] .leaf-slider__control {
853
+ cursor: grabbing;
854
+ }
855
+
856
+ .leaf-slider__rail {
857
+ position: absolute;
858
+ left: var(--leaf-slider-inset);
859
+ right: var(--leaf-slider-inset);
860
+ top: 50%;
861
+ height: var(--leaf-slider-rail-height);
862
+ transform: translateY(-50%);
863
+ border-radius: 100px;
864
+ background-color: var(--text-tertiary);
865
+ pointer-events: none;
866
+ }
867
+
868
+ .leaf-slider__fill {
869
+ display: block;
870
+ height: 100%;
871
+ width: var(--leaf-slider-fill);
872
+ border-radius: inherit;
873
+ background-color: var(--text-primary);
874
+ }
875
+
876
+ /* Khung toạ độ cho mốc + thumb — trùng với rail, cao 0, nằm giữa control. */
877
+ .leaf-slider__marks {
878
+ position: absolute;
879
+ z-index: 1;
880
+ left: var(--leaf-slider-inset);
881
+ right: var(--leaf-slider-inset);
882
+ top: 50%;
883
+ height: 0;
884
+ pointer-events: none;
885
+ }
886
+
887
+ .leaf-slider__mark {
888
+ position: absolute;
889
+ top: 0;
890
+ left: 0;
891
+ display: block;
892
+ box-sizing: border-box;
893
+ width: var(--leaf-slider-mark);
894
+ height: var(--leaf-slider-mark);
895
+ margin: 0;
896
+ padding: 0;
897
+ border: none;
898
+ border-radius: 50%;
899
+ background-color: var(--text-tertiary);
900
+ cursor: pointer;
901
+ appearance: none;
902
+ -webkit-appearance: none;
903
+ pointer-events: auto;
904
+ transform: translate(-50%, -50%);
905
+ transition: background-color 0.15s ease;
906
+ }
907
+
908
+ .leaf-slider__mark[data-state="passed"] {
909
+ background-color: var(--text-primary);
910
+ }
911
+
912
+ /* Mốc trùng giá trị nằm dưới thumb — cùng màu để không lộ viền. */
913
+ .leaf-slider__mark[data-state="active"] {
914
+ background-color: var(--leaf-slider-active);
915
+ }
916
+
917
+ .leaf-slider__thumb {
918
+ position: absolute;
919
+ top: 0;
920
+ left: var(--leaf-slider-fill);
921
+ display: block;
922
+ box-sizing: border-box;
923
+ width: var(--leaf-slider-mark-active);
924
+ height: var(--leaf-slider-mark-active);
925
+ border-radius: 50%;
926
+ background-color: var(--leaf-slider-active);
927
+ transform: translate(-50%, -50%);
928
+ pointer-events: none;
929
+ }
930
+
931
+ /* 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. */
932
+ .leaf-slider__labels {
933
+ position: relative;
934
+ margin-inline: var(--leaf-slider-inset);
935
+ min-height: var(--body-5-line-height);
936
+ user-select: text;
937
+ -webkit-user-select: text;
938
+ }
939
+
940
+ .leaf-slider__label {
941
+ position: absolute;
942
+ top: 0;
943
+ max-width: 40%;
944
+ color: var(--text-secondary);
945
+ white-space: nowrap;
946
+ transform: translateX(-50%);
947
+ text-align: center;
948
+ }
949
+
950
+ .leaf-slider__label[data-edge="start"] {
951
+ transform: translateX(calc(-1 * var(--leaf-slider-inset)));
952
+ text-align: left;
953
+ }
954
+
955
+ .leaf-slider__label[data-edge="end"] {
956
+ transform: translateX(calc(-100% + var(--leaf-slider-inset)));
957
+ text-align: right;
958
+ }
959
+
960
+ .leaf-slider__label[data-active="true"] {
961
+ color: var(--text-primary);
962
+ }
963
+
964
+ .leaf-slider[data-disabled="true"] {
965
+ opacity: 0.5;
966
+ pointer-events: none;
967
+ touch-action: auto;
968
+ }
969
+
970
+ .leaf-slider[data-disabled="true"] .leaf-slider__control,
971
+ .leaf-slider[data-disabled="true"] .leaf-slider__mark {
972
+ cursor: not-allowed;
973
+ }
974
+ }
975
+
409
976
  /* --- src/components/Tabs/tabs.css --- */
410
977
 
411
978
  /*
@@ -473,6 +1040,7 @@
473
1040
  background-color: transparent;
474
1041
  color: inherit;
475
1042
  font: inherit;
1043
+ font-family: var(--font-sans);
476
1044
  text-align: center;
477
1045
  white-space: nowrap;
478
1046
  box-sizing: border-box;
@@ -594,6 +1162,260 @@
594
1162
  }
595
1163
  }
596
1164
 
1165
+ /* --- src/components/Toggle/toggle.css --- */
1166
+
1167
+ /*
1168
+ * Toggle — Figma 730:12438.
1169
+ *
1170
+ * Size M/S qua data-size; Status On/Off qua aria-checked; Active Off qua
1171
+ * :disabled. Thumb trượt bằng transform. Checkmark chỉ hiện ở size sm khi
1172
+ * On + Active. Thiếu attribute → md · off · enabled.
1173
+ */
1174
+
1175
+ @layer components {
1176
+ .leaf-toggle {
1177
+ --leaf-toggle-width: 48px;
1178
+ --leaf-toggle-height: 24px;
1179
+ --leaf-toggle-padding: 3px;
1180
+ --leaf-toggle-thumb: 18px;
1181
+ --leaf-toggle-travel: calc(
1182
+ var(--leaf-toggle-width) - var(--leaf-toggle-padding) * 2 - var(--leaf-toggle-thumb)
1183
+ );
1184
+
1185
+ position: relative;
1186
+ display: inline-flex;
1187
+ flex-shrink: 0;
1188
+ align-items: center;
1189
+ box-sizing: border-box;
1190
+ width: var(--leaf-toggle-width);
1191
+ height: var(--leaf-toggle-height);
1192
+ margin: 0;
1193
+ padding: var(--leaf-toggle-padding);
1194
+ border: none;
1195
+ border-radius: 12px;
1196
+ background-color: var(--base-quaternary);
1197
+ cursor: pointer;
1198
+ vertical-align: middle;
1199
+ appearance: none;
1200
+ -webkit-appearance: none;
1201
+ font: inherit;
1202
+ color: inherit;
1203
+ transition: background-color 0.2s ease;
1204
+ }
1205
+
1206
+ .leaf-toggle__thumb {
1207
+ display: flex;
1208
+ align-items: center;
1209
+ justify-content: center;
1210
+ width: var(--leaf-toggle-thumb);
1211
+ height: var(--leaf-toggle-thumb);
1212
+ border-radius: 100px;
1213
+ background-color: var(--text-secondary);
1214
+ transform: translateX(0);
1215
+ transition:
1216
+ transform 0.2s ease,
1217
+ background-color 0.2s ease;
1218
+ }
1219
+
1220
+ .leaf-toggle__check {
1221
+ display: none;
1222
+ width: 60%;
1223
+ height: 60%;
1224
+ color: var(--system-green);
1225
+ }
1226
+
1227
+ /* Status On + Active — track xanh, thumb trắng, trượt phải. */
1228
+ .leaf-toggle[aria-checked="true"]:not(:disabled) {
1229
+ background-color: var(--system-green);
1230
+ }
1231
+
1232
+ .leaf-toggle[aria-checked="true"]:not(:disabled) .leaf-toggle__thumb {
1233
+ background-color: var(--neutral-white);
1234
+ transform: translateX(var(--leaf-toggle-travel));
1235
+ }
1236
+
1237
+ /* Status On + Active Off (disabled on) — track quaternary, thumb tertiary, vẫn bên phải. */
1238
+ .leaf-toggle[aria-checked="true"]:disabled .leaf-toggle__thumb {
1239
+ background-color: var(--text-tertiary);
1240
+ transform: translateX(var(--leaf-toggle-travel));
1241
+ }
1242
+
1243
+ /* Status Off + Active Off — thumb tertiary, bên trái. */
1244
+ .leaf-toggle:disabled:not([aria-checked="true"]) .leaf-toggle__thumb {
1245
+ background-color: var(--text-tertiary);
1246
+ }
1247
+
1248
+ /* Size S */
1249
+ .leaf-toggle[data-size="sm"] {
1250
+ --leaf-toggle-width: 32px;
1251
+ --leaf-toggle-height: 16px;
1252
+ --leaf-toggle-thumb: 10px;
1253
+ }
1254
+
1255
+ /* Checkmark chỉ ở S · On · Active. */
1256
+ .leaf-toggle[data-size="sm"][aria-checked="true"]:not(:disabled) .leaf-toggle__check {
1257
+ display: block;
1258
+ }
1259
+
1260
+ .leaf-toggle:disabled {
1261
+ cursor: not-allowed;
1262
+ }
1263
+
1264
+ .leaf-toggle:focus-visible {
1265
+ outline: 2px solid var(--system-green);
1266
+ outline-offset: 2px;
1267
+ }
1268
+ }
1269
+
1270
+ /* --- src/components/Tooltip/tooltip.css --- */
1271
+
1272
+ /*
1273
+ * Tooltip — Figma 891:4983.
1274
+ *
1275
+ * Size sm/md/lg; position top/bottom/left/right; align start/center/end.
1276
+ * Nền --base-quaternary; chữ --text-primary. Caret CSS clip-path cùng màu nền.
1277
+ */
1278
+
1279
+ @layer components {
1280
+ .leaf-tooltip-trigger {
1281
+ position: relative;
1282
+ display: inline-flex;
1283
+ max-width: 100%;
1284
+ vertical-align: middle;
1285
+ }
1286
+
1287
+ .leaf-tooltip {
1288
+ --leaf-tooltip-pad-y: 8px;
1289
+ --leaf-tooltip-pad-x: 16px;
1290
+ --leaf-tooltip-radius: 8px;
1291
+ --leaf-tooltip-max-width: 176px;
1292
+ --leaf-tooltip-font-size: var(--body-4-size);
1293
+ --leaf-tooltip-line-height: var(--body-4-line-height);
1294
+ --leaf-tooltip-font-weight: var(--body-4-weight);
1295
+ --leaf-tooltip-caret-w: 44px;
1296
+ --leaf-tooltip-caret-h: 6px;
1297
+
1298
+ display: inline-flex;
1299
+ flex-direction: column;
1300
+ align-items: center;
1301
+ max-width: var(--leaf-tooltip-max-width);
1302
+ box-sizing: border-box;
1303
+ font-family: var(--font-sans);
1304
+ font-size: var(--leaf-tooltip-font-size);
1305
+ line-height: var(--leaf-tooltip-line-height);
1306
+ font-weight: var(--leaf-tooltip-font-weight);
1307
+ color: var(--text-primary);
1308
+ pointer-events: none;
1309
+ }
1310
+
1311
+ .leaf-tooltip--portal {
1312
+ position: fixed;
1313
+ z-index: 110;
1314
+ }
1315
+
1316
+ /* `display` của .leaf-tooltip thắng `[hidden]` của trình duyệt — bản vanilla ẩn bubble bằng hidden. */
1317
+ .leaf-tooltip[hidden] {
1318
+ display: none;
1319
+ }
1320
+
1321
+ .leaf-tooltip__body {
1322
+ position: relative;
1323
+ z-index: 1;
1324
+ box-sizing: border-box;
1325
+ max-width: 100%;
1326
+ padding: var(--leaf-tooltip-pad-y) var(--leaf-tooltip-pad-x);
1327
+ border-radius: var(--leaf-tooltip-radius);
1328
+ background-color: var(--base-quaternary);
1329
+ text-align: left;
1330
+ word-break: break-word;
1331
+ }
1332
+
1333
+ .leaf-tooltip__caret {
1334
+ flex-shrink: 0;
1335
+ width: var(--leaf-tooltip-caret-w);
1336
+ height: var(--leaf-tooltip-caret-h);
1337
+ background-color: var(--base-quaternary);
1338
+ /* Mặc định: mũi nhọn xuống (position=top). */
1339
+ clip-path: polygon(0 0, 100% 0, 50% 100%);
1340
+ }
1341
+
1342
+ /* ── Size ────────────────────────────────────────────────────────────── */
1343
+
1344
+ .leaf-tooltip[data-size="sm"] {
1345
+ --leaf-tooltip-pad-y: 2px;
1346
+ --leaf-tooltip-pad-x: 16px;
1347
+ --leaf-tooltip-radius: 4px;
1348
+ --leaf-tooltip-max-width: 208px;
1349
+ --leaf-tooltip-font-size: var(--body-5-size);
1350
+ --leaf-tooltip-line-height: var(--body-5-line-height);
1351
+ --leaf-tooltip-font-weight: var(--body-5-weight);
1352
+ --leaf-tooltip-caret-w: 40px;
1353
+ --leaf-tooltip-caret-h: 4px;
1354
+ min-width: 64px;
1355
+ }
1356
+
1357
+ .leaf-tooltip[data-size="lg"] {
1358
+ --leaf-tooltip-pad-y: 16px;
1359
+ --leaf-tooltip-pad-x: 16px;
1360
+ --leaf-tooltip-radius: 12px;
1361
+ --leaf-tooltip-max-width: 288px;
1362
+ --leaf-tooltip-font-size: var(--body-3-size);
1363
+ --leaf-tooltip-line-height: var(--body-3-line-height);
1364
+ --leaf-tooltip-font-weight: var(--body-3-weight);
1365
+ --leaf-tooltip-caret-w: 44px;
1366
+ --leaf-tooltip-caret-h: 6px;
1367
+ }
1368
+
1369
+ /* ── Position ────────────────────────────────────────────────────────── */
1370
+
1371
+ .leaf-tooltip[data-position="bottom"] {
1372
+ flex-direction: column;
1373
+ }
1374
+
1375
+ .leaf-tooltip[data-position="bottom"] .leaf-tooltip__caret {
1376
+ clip-path: polygon(50% 0, 0 100%, 100% 100%);
1377
+ }
1378
+
1379
+ .leaf-tooltip[data-position="left"] {
1380
+ flex-direction: row;
1381
+ align-items: center;
1382
+ }
1383
+
1384
+ .leaf-tooltip[data-position="left"] .leaf-tooltip__caret {
1385
+ width: var(--leaf-tooltip-caret-h);
1386
+ height: var(--leaf-tooltip-caret-w);
1387
+ clip-path: polygon(0 0, 100% 50%, 0 100%);
1388
+ }
1389
+
1390
+ .leaf-tooltip[data-position="right"] {
1391
+ flex-direction: row;
1392
+ align-items: center;
1393
+ }
1394
+
1395
+ .leaf-tooltip[data-position="right"] .leaf-tooltip__caret {
1396
+ width: var(--leaf-tooltip-caret-h);
1397
+ height: var(--leaf-tooltip-caret-w);
1398
+ clip-path: polygon(100% 0, 0 50%, 100% 100%);
1399
+ }
1400
+
1401
+ /* ── Align (caret trên Top/Bottom) ───────────────────────────────────── */
1402
+
1403
+ .leaf-tooltip[data-position="top"][data-align="start"],
1404
+ .leaf-tooltip[data-position="bottom"][data-align="start"] {
1405
+ align-items: flex-start;
1406
+ }
1407
+
1408
+ .leaf-tooltip[data-position="top"][data-align="end"],
1409
+ .leaf-tooltip[data-position="bottom"][data-align="end"] {
1410
+ align-items: flex-end;
1411
+ }
1412
+
1413
+ .leaf-tooltip[data-position="top"][data-align="center"],
1414
+ .leaf-tooltip[data-position="bottom"][data-align="center"] {
1415
+ align-items: center;
1416
+ }
1417
+ }
1418
+
597
1419
  /* --- src/styles/color.css --- */
598
1420
 
599
1421
  /*
@@ -792,9 +1614,9 @@
792
1614
  * Tên class trùng đúng tên token trong Figma, không có prefix: đọc DOM là biết
793
1615
  * ngay style đang dùng, và không cần import gì trong JS để dùng được.
794
1616
  *
795
- * Mỗi class chỉ set đúng 3 thuộc tính: font-size, line-height, font-weight.
796
- * Font family, letter spacing, margin, màu chữ… không thuộc phạm vi của
797
- * stylesheet này — app tự setup ở tầng global nếu cần.
1617
+ * Mỗi class set: font-family (Inter qua --font-sans) + size + line-height +
1618
+ * weight (400 / 600 / 700 theo token). Letter spacing, margin, màu chữ không
1619
+ * thuộc stylesheet này — màu dùng class text-* riêng.
798
1620
  *
799
1621
  * Toàn bộ nằm trong `@layer components` để utility của Tailwind (`@layer
800
1622
  * utilities`) luôn thắng: `class="heading-1 font-bold"` hay `class="body-3
@@ -802,6 +1624,27 @@
802
1624
  */
803
1625
 
804
1626
  @layer components {
1627
+ :is(
1628
+ .display-1,
1629
+ .display-2,
1630
+ .display-3,
1631
+ .heading-1,
1632
+ .heading-2,
1633
+ .heading-3,
1634
+ .body-1,
1635
+ .body-1-highlight,
1636
+ .body-2,
1637
+ .body-2-highlight,
1638
+ .body-3,
1639
+ .body-3-highlight,
1640
+ .body-4,
1641
+ .body-4-highlight,
1642
+ .body-5,
1643
+ .body-5-highlight
1644
+ ) {
1645
+ font-family: var(--font-sans);
1646
+ }
1647
+
805
1648
  /* Display */
806
1649
 
807
1650
  .display-1 {