gladvn 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/micro/combobox.d.ts.map +1 -1
- package/dist/dev/showcase/overview.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/src/components/micro/combobox.tsx +6 -0
- package/src/components/micro/input-group.tsx +3 -3
- package/src/dev/showcase/overview.tsx +73 -82
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gladvn",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DO NOT 'npm install'. Use 'npx gladvn init' instead! A highly composable React component library built with Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"radix-ui"
|
|
13
13
|
],
|
|
14
14
|
"license": "MIT",
|
|
15
|
+
"homepage": "https://gladvn.vercel.app",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/duongacy/gladcn"
|
|
19
|
+
},
|
|
15
20
|
"main": "./dist/index.cjs",
|
|
16
21
|
"module": "./dist/index.js",
|
|
17
22
|
"types": "./dist/index.d.ts",
|
|
@@ -78,6 +78,12 @@ function ComboboxInput({ className, ...props }: ComboboxPrimitive.Input.Props) {
|
|
|
78
78
|
data-slot="combobox-input"
|
|
79
79
|
className={cn(
|
|
80
80
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
81
|
+
// Clear standalone styles when inside InputGroup
|
|
82
|
+
"group-data-[slot=input-group]/input-group:border-0",
|
|
83
|
+
"group-data-[slot=input-group]/input-group:shadow-none",
|
|
84
|
+
"group-data-[slot=input-group]/input-group:h-auto",
|
|
85
|
+
"group-data-[slot=input-group]/input-group:rounded-none",
|
|
86
|
+
"group-data-[slot=input-group]/input-group:focus-visible:ring-0",
|
|
81
87
|
className,
|
|
82
88
|
)}
|
|
83
89
|
{...props}
|
|
@@ -224,9 +224,9 @@ const InputGroupInput = React.forwardRef<
|
|
|
224
224
|
data-slot="input-group-control"
|
|
225
225
|
className={cn(
|
|
226
226
|
"min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
|
|
227
|
-
"group-data-[size=sm]/input-group:
|
|
228
|
-
"group-data-[size=md]/input-group:
|
|
229
|
-
"group-data-[size=lg]/input-group:
|
|
227
|
+
"group-data-[size=sm]/input-group:px-2 group-data-[size=sm]/input-group:py-0.5 group-data-[size=sm]/input-group:text-xs",
|
|
228
|
+
"group-data-[size=md]/input-group:px-2.5 group-data-[size=md]/input-group:py-1 group-data-[size=md]/input-group:text-sm",
|
|
229
|
+
"group-data-[size=lg]/input-group:px-3 group-data-[size=lg]/input-group:py-1.5 group-data-[size=lg]/input-group:text-sm",
|
|
230
230
|
className,
|
|
231
231
|
)}
|
|
232
232
|
{...props}
|
|
@@ -129,10 +129,10 @@ export default function OverviewSection() {
|
|
|
129
129
|
style={{ animationDelay: "100ms", animationFillMode: "both" }}
|
|
130
130
|
>
|
|
131
131
|
<span className="block text-foreground drop-shadow-sm">
|
|
132
|
-
|
|
132
|
+
Tinh tế. Đẳng cấp.
|
|
133
133
|
</span>
|
|
134
134
|
<span className="block mt-2 bg-gradient-to-r leading-[1.2] from-primary via-info to-primary bg-[length:200%_auto] bg-clip-text text-transparent animate-[spin_8s_linear_infinite] [animation-name:gradient] [animation-duration:8s] [animation-timing-function:linear] [animation-iteration-count:infinite]">
|
|
135
|
-
|
|
135
|
+
Sạch sẽ.
|
|
136
136
|
</span>
|
|
137
137
|
</h1>
|
|
138
138
|
|
|
@@ -140,11 +140,11 @@ export default function OverviewSection() {
|
|
|
140
140
|
className="max-w-2xl text-lg md:text-xl text-muted-foreground leading-relaxed mb-10 animate-fade-up"
|
|
141
141
|
style={{ animationDelay: "200ms", animationFillMode: "both" }}
|
|
142
142
|
>
|
|
143
|
-
|
|
144
|
-
gladvn
|
|
143
|
+
Đa số component library bắt bạn phải phụ thuộc vào họ mãi mãi.
|
|
144
|
+
gladvn copy thẳng source code vào dự án của bạn —{" "}
|
|
145
145
|
<strong className="text-foreground">
|
|
146
|
-
không
|
|
147
|
-
|
|
146
|
+
không node_modules ẩn, không breaking change bất ngờ, không
|
|
147
|
+
vendor lock-in.
|
|
148
148
|
</strong>
|
|
149
149
|
</p>
|
|
150
150
|
</div>
|
|
@@ -302,15 +302,14 @@ export default function OverviewSection() {
|
|
|
302
302
|
<section className="container max-w-6xl mx-auto space-y-12 px-4">
|
|
303
303
|
<div className="text-center max-w-2xl mx-auto space-y-4">
|
|
304
304
|
<h2 className="text-3xl md:text-4xl font-extrabold tracking-tight">
|
|
305
|
-
|
|
305
|
+
Rõ ràng từ đầu. Dùng lâu không sợ vỡ.
|
|
306
306
|
</h2>
|
|
307
307
|
<p className="text-muted-foreground text-lg">
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
<strong className="text-foreground">
|
|
312
|
-
{" "}
|
|
313
|
-
hưởng.
|
|
308
|
+
Nhiều dự án bắt đầu gãy ở năm thứ hai — ai cũng muốn sửa nhưng
|
|
309
|
+
không ai dám sửa vì không biết cái gì sẽ hỏng theo. gladvn chia code
|
|
310
|
+
thành{" "}
|
|
311
|
+
<strong className="text-foreground">các tầng rõ ràng</strong>
|
|
312
|
+
{", "}nên bạn luôn biết mình đang sửa ở đâu và ảnh hưởng đến đâu.
|
|
314
313
|
</p>
|
|
315
314
|
</div>
|
|
316
315
|
|
|
@@ -325,19 +324,19 @@ export default function OverviewSection() {
|
|
|
325
324
|
<SparklesIcon className="size-4" /> Điểm khác biệt lớn nhất
|
|
326
325
|
</div>
|
|
327
326
|
<h3 className="text-3xl md:text-5xl font-extrabold tracking-tight">
|
|
328
|
-
|
|
327
|
+
Code là của bạn, 100%
|
|
329
328
|
</h3>
|
|
330
329
|
<p className="text-muted-foreground text-lg leading-relaxed max-w-2xl">
|
|
331
|
-
Chạy một lệnh
|
|
332
|
-
|
|
330
|
+
Chạy một lệnh — toàn bộ components, hooks, styles, contexts
|
|
331
|
+
được copy thẳng vào thư mục{" "}
|
|
333
332
|
<code className="text-sm bg-primary/20 text-primary px-1.5 py-0.5 rounded">
|
|
334
333
|
src/
|
|
335
334
|
</code>{" "}
|
|
336
|
-
của
|
|
335
|
+
của bạn.{" "}
|
|
337
336
|
<strong className="text-foreground">
|
|
338
|
-
Không
|
|
337
|
+
Không qua node_modules, không bị khóa vào bất kỳ ai
|
|
339
338
|
</strong>{" "}
|
|
340
|
-
— bạn đọc được, sửa được, xoá được từng dòng
|
|
339
|
+
— bạn đọc được, sửa được, xoá được từng dòng.
|
|
341
340
|
</p>
|
|
342
341
|
|
|
343
342
|
<div className="flex items-center gap-4 pt-2">
|
|
@@ -423,13 +422,13 @@ export default function OverviewSection() {
|
|
|
423
422
|
Sửa Macro — an toàn nhất
|
|
424
423
|
</h4>
|
|
425
424
|
<p className="text-sm text-muted-foreground leading-relaxed">
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
Bắt đầu ở đây. Mỗi Macro là một preset độc lập — thêm footer
|
|
426
|
+
cho DatePicker, bỏ nút đóng của Dialog, chỉnh placeholder
|
|
427
|
+
Combobox.{" "}
|
|
429
428
|
<strong className="text-foreground">
|
|
430
|
-
|
|
429
|
+
Sửa cái nào chỉ ảnh hưởng cái đó
|
|
431
430
|
</strong>
|
|
432
|
-
, không lan
|
|
431
|
+
, không lan sang đâu cả.
|
|
433
432
|
</p>
|
|
434
433
|
</div>
|
|
435
434
|
|
|
@@ -442,15 +441,15 @@ export default function OverviewSection() {
|
|
|
442
441
|
src/components/micro/
|
|
443
442
|
</div>
|
|
444
443
|
<h4 className="font-bold text-foreground text-base">
|
|
445
|
-
Sửa Micro —
|
|
444
|
+
Sửa Micro — cẩn thận hơn
|
|
446
445
|
</h4>
|
|
447
446
|
<p className="text-sm text-muted-foreground leading-relaxed">
|
|
448
|
-
Micro là nền
|
|
449
|
-
|
|
447
|
+
Micro là nền — mọi Macro đều xây trên nó. Sửa variant của
|
|
448
|
+
Button hay animation của Tooltip thì{" "}
|
|
450
449
|
<strong className="text-foreground">
|
|
451
|
-
|
|
452
|
-
</strong>
|
|
453
|
-
|
|
450
|
+
tất cả nơi dùng component đó đều thay đổi theo
|
|
451
|
+
</strong>
|
|
452
|
+
. Chỉ sửa khi bạn rõ mình đang làm gì.
|
|
454
453
|
</p>
|
|
455
454
|
</div>
|
|
456
455
|
|
|
@@ -463,16 +462,15 @@ export default function OverviewSection() {
|
|
|
463
462
|
src/index.css
|
|
464
463
|
</div>
|
|
465
464
|
<h4 className="font-bold text-foreground text-base">
|
|
466
|
-
Sửa CSS —
|
|
465
|
+
Sửa CSS — ảnh hưởng toàn bộ
|
|
467
466
|
</h4>
|
|
468
467
|
<p className="text-sm text-muted-foreground leading-relaxed">
|
|
469
|
-
CSS token
|
|
470
|
-
|
|
468
|
+
CSS token quyết định màu, font, border-radius cho tất cả.
|
|
469
|
+
Đổi một token ở đây thì{" "}
|
|
471
470
|
<strong className="text-foreground">
|
|
472
|
-
|
|
471
|
+
toàn bộ giao diện cập nhật ngay
|
|
473
472
|
</strong>
|
|
474
|
-
|
|
475
|
-
đổi design language, không phải để vá từng chỗ.
|
|
473
|
+
. Dùng khi muốn rebrand, không phải để vá lỗi lẻ tẻ.
|
|
476
474
|
</p>
|
|
477
475
|
</div>
|
|
478
476
|
|
|
@@ -488,15 +486,13 @@ export default function OverviewSection() {
|
|
|
488
486
|
</div>
|
|
489
487
|
<div className="relative z-10 space-y-4 mb-10">
|
|
490
488
|
<h3 className="text-2xl md:text-4xl font-extrabold tracking-tight">
|
|
491
|
-
Micro &
|
|
489
|
+
Micro & Macro
|
|
492
490
|
</h3>
|
|
493
491
|
<p className="text-muted-foreground max-w-lg text-lg leading-relaxed">
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
<strong className="text-foreground">
|
|
497
|
-
Micro
|
|
498
|
-
Mọi logic lắp ráp giao diện đều phải uỷ quyền (Delegate) hoàn
|
|
499
|
-
toàn cho Macro.
|
|
492
|
+
Micro là component thuần — chỉ lo style, không ép layout.
|
|
493
|
+
Macro là preset — lắp ghép Micro thành giao diện hoàn chỉnh.
|
|
494
|
+
<strong className="text-foreground block mt-2">
|
|
495
|
+
Micro không bao giờ tự quyết layout. Việc đó thuộc về Macro.
|
|
500
496
|
</strong>
|
|
501
497
|
</p>
|
|
502
498
|
</div>
|
|
@@ -560,12 +556,11 @@ export default function OverviewSection() {
|
|
|
560
556
|
Style Encapsulation
|
|
561
557
|
</h3>
|
|
562
558
|
<p className="text-muted-foreground text-base leading-relaxed">
|
|
563
|
-
Mỗi component là một hộp
|
|
564
|
-
|
|
565
|
-
<code>data-slot</code> —
|
|
566
|
-
trong API.{" "}
|
|
559
|
+
Mỗi component là một hộp kín về style. Muốn tuỳ chỉnh từ ngoài
|
|
560
|
+
thì dùng{" "}
|
|
561
|
+
<code>data-slot</code> — đã có sẵn contract rõ ràng.{" "}
|
|
567
562
|
<strong className="text-foreground">
|
|
568
|
-
Refactor
|
|
563
|
+
Refactor bên trong thoải mái mà không phá code bên ngoài.
|
|
569
564
|
</strong>
|
|
570
565
|
</p>
|
|
571
566
|
</div>
|
|
@@ -588,11 +583,11 @@ export default function OverviewSection() {
|
|
|
588
583
|
</div>
|
|
589
584
|
<div className="relative z-10 space-y-4">
|
|
590
585
|
<h3 className="text-2xl md:text-4xl font-extrabold tracking-tight">
|
|
591
|
-
|
|
586
|
+
Variant × Color
|
|
592
587
|
</h3>
|
|
593
588
|
<p className="text-muted-foreground text-lg leading-relaxed max-w-lg">
|
|
594
|
-
|
|
595
|
-
|
|
589
|
+
Variant (solid, outline, ghost...) và Color (primary, destructive...)
|
|
590
|
+
là hai trục hoàn toàn độc lập. Kết hợp tự do mà không bị bùng nổ
|
|
596
591
|
class.
|
|
597
592
|
</p>
|
|
598
593
|
</div>
|
|
@@ -629,10 +624,10 @@ export default function OverviewSection() {
|
|
|
629
624
|
Zero-prop Defaults
|
|
630
625
|
</h3>
|
|
631
626
|
<p className="text-muted-foreground text-lg leading-relaxed max-w-lg">
|
|
632
|
-
|
|
633
|
-
|
|
627
|
+
Quẳng component vào mà không truyền prop nào — nó vẫn chạy đẹp,
|
|
628
|
+
vẫn đúng behavior.{" "}
|
|
634
629
|
<strong className="text-foreground">
|
|
635
|
-
|
|
630
|
+
Không phải tra docs mỗi lần dùng.
|
|
636
631
|
</strong>
|
|
637
632
|
</p>
|
|
638
633
|
</div>
|
|
@@ -661,14 +656,13 @@ export default function OverviewSection() {
|
|
|
661
656
|
</div>
|
|
662
657
|
<div className="relative z-10 space-y-4">
|
|
663
658
|
<h3 className="text-2xl font-extrabold tracking-tight">
|
|
664
|
-
Headless
|
|
659
|
+
Headless + Style
|
|
665
660
|
</h3>
|
|
666
661
|
<p className="text-muted-foreground text-base leading-relaxed">
|
|
667
|
-
Keyboard
|
|
668
|
-
|
|
669
|
-
và thêm visual style, không tự implement logic tương tác.{" "}
|
|
662
|
+
Keyboard, focus, ARIA — Base UI lo hết. Micro component chỉ
|
|
663
|
+
thêm lớp style lên trên, không tự viết logic tương tác.{" "}
|
|
670
664
|
<strong className="text-foreground">
|
|
671
|
-
Behavior đúng
|
|
665
|
+
Behavior đúng sẵn, không cần test lại.
|
|
672
666
|
</strong>
|
|
673
667
|
</p>
|
|
674
668
|
</div>
|
|
@@ -693,14 +687,13 @@ export default function OverviewSection() {
|
|
|
693
687
|
</div>
|
|
694
688
|
<div className="relative z-10 space-y-4">
|
|
695
689
|
<h3 className="text-2xl md:text-4xl font-extrabold tracking-tight">
|
|
696
|
-
CSS Token
|
|
690
|
+
CSS Token
|
|
697
691
|
</h3>
|
|
698
692
|
<p className="text-muted-foreground text-lg leading-relaxed max-w-lg">
|
|
699
|
-
Không component nào
|
|
700
|
-
|
|
701
|
-
từ hệ thống token.{" "}
|
|
693
|
+
Không component nào hardcode màu hay spacing. Tất cả đều
|
|
694
|
+
tham chiếu từ hệ thống token chung.{" "}
|
|
702
695
|
<strong className="text-foreground">
|
|
703
|
-
|
|
696
|
+
Đổi một token — cả app cập nhật.
|
|
704
697
|
</strong>
|
|
705
698
|
</p>
|
|
706
699
|
</div>
|
|
@@ -727,11 +720,12 @@ export default function OverviewSection() {
|
|
|
727
720
|
</div>
|
|
728
721
|
<div className="relative z-10 space-y-4">
|
|
729
722
|
<h3 className="text-2xl font-extrabold tracking-tight">
|
|
730
|
-
|
|
723
|
+
Polymorphism
|
|
731
724
|
</h3>
|
|
732
725
|
<p className="text-muted-foreground text-base leading-relaxed">
|
|
733
|
-
Dùng
|
|
734
|
-
|
|
726
|
+
Dùng <code>render</code> prop để đổi thẻ HTML root —
|
|
727
|
+
ví dụ biến Button thành Link. Không cần prop <code>as</code>
|
|
728
|
+
{" "}hay tạo wrapper lồng nhau.
|
|
735
729
|
</p>
|
|
736
730
|
</div>
|
|
737
731
|
<div className="relative z-10 mt-auto pt-6 space-y-3">
|
|
@@ -759,15 +753,14 @@ export default function OverviewSection() {
|
|
|
759
753
|
</div>
|
|
760
754
|
<div className="relative z-10 space-y-4">
|
|
761
755
|
<h3 className="text-2xl font-extrabold tracking-tight">
|
|
762
|
-
|
|
756
|
+
Stateless Primitive
|
|
763
757
|
</h3>
|
|
764
758
|
<p className="text-muted-foreground text-base leading-relaxed">
|
|
765
|
-
Micro component không
|
|
766
|
-
<code>useState</code> hay <code>useEffect</code>.
|
|
767
|
-
|
|
768
|
-
preset.{" "}
|
|
759
|
+
Micro component không chứa{" "}
|
|
760
|
+
<code>useState</code> hay <code>useEffect</code>. State nằm ở
|
|
761
|
+
Headless UI hoặc Macro.{" "}
|
|
769
762
|
<strong className="text-foreground">
|
|
770
|
-
|
|
763
|
+
Component càng đơn giản, càng ít bug.
|
|
771
764
|
</strong>
|
|
772
765
|
</p>
|
|
773
766
|
</div>
|
|
@@ -792,14 +785,13 @@ export default function OverviewSection() {
|
|
|
792
785
|
</div>
|
|
793
786
|
<div className="relative z-10 space-y-4">
|
|
794
787
|
<h3 className="text-2xl font-extrabold tracking-tight">
|
|
795
|
-
Accessibility
|
|
788
|
+
Accessibility
|
|
796
789
|
</h3>
|
|
797
790
|
<p className="text-muted-foreground text-base leading-relaxed">
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
<code>aria-hidden</code> để đảm bảo WCAG AAA/AA.{" "}
|
|
791
|
+
Semantic HTML, <code>aria-describedby</code> cho form,
|
|
792
|
+
icon trang trí tự ẩn khỏi screen reader.{" "}
|
|
801
793
|
<strong className="text-foreground">
|
|
802
|
-
|
|
794
|
+
Chuẩn WCAG — không cần nghĩ thêm.
|
|
803
795
|
</strong>
|
|
804
796
|
</p>
|
|
805
797
|
</div>
|
|
@@ -1106,15 +1098,14 @@ export default function OverviewSection() {
|
|
|
1106
1098
|
<div className="absolute inset-0 bg-[radial-gradient(ellipse_60%_60%_at_50%_0%,rgba(var(--primary-rgb),0.15),transparent)] pointer-events-none" />
|
|
1107
1099
|
<div className="relative z-10 space-y-6 max-w-2xl mx-auto">
|
|
1108
1100
|
<h2 className="text-3xl md:text-5xl font-extrabold tracking-tight">
|
|
1109
|
-
|
|
1101
|
+
Thử ngay?
|
|
1110
1102
|
</h2>
|
|
1111
1103
|
<p className="text-muted-foreground text-lg leading-relaxed">
|
|
1112
|
-
|
|
1104
|
+
30 giây — toàn bộ code nằm trong{" "}
|
|
1113
1105
|
<code className="text-sm bg-primary/20 text-primary px-1.5 py-0.5 rounded">
|
|
1114
1106
|
src/
|
|
1115
1107
|
</code>{" "}
|
|
1116
|
-
của bạn
|
|
1117
|
-
tài liệu.
|
|
1108
|
+
của bạn. Không config, không đọc docs.
|
|
1118
1109
|
</p>
|
|
1119
1110
|
<div className="flex flex-col sm:flex-row items-center justify-center gap-4 pt-2">
|
|
1120
1111
|
<button
|