gladvn 0.2.17 → 0.2.19
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/bin/cli.js +9 -6
- package/dist/components/macro/accordion-preset.d.ts.map +1 -1
- package/dist/components/macro/alert-dialog-preset.d.ts.map +1 -1
- package/dist/components/macro/alert-preset.d.ts.map +1 -1
- package/dist/components/macro/avatar-preset.d.ts.map +1 -1
- package/dist/components/macro/breadcrumb-preset.d.ts.map +1 -1
- package/dist/components/macro/card-preset.d.ts.map +1 -1
- package/dist/components/macro/carousel-preset.d.ts.map +1 -1
- package/dist/components/macro/checkbox-preset.d.ts.map +1 -1
- package/dist/components/macro/combobox-preset.d.ts.map +1 -1
- package/dist/components/macro/command-preset.d.ts +1 -1
- package/dist/components/macro/command-preset.d.ts.map +1 -1
- package/dist/components/macro/date-picker.d.ts.map +1 -1
- package/dist/components/macro/dialog-preset.d.ts.map +1 -1
- package/dist/components/macro/empty-preset.d.ts.map +1 -1
- package/dist/components/macro/field-preset.d.ts.map +1 -1
- package/dist/components/macro/input-otp-preset.d.ts +6 -0
- package/dist/components/macro/input-otp-preset.d.ts.map +1 -1
- package/dist/components/macro/input-preset.d.ts +1 -1
- package/dist/components/macro/input-preset.d.ts.map +1 -1
- package/dist/components/macro/pagination-preset.d.ts.map +1 -1
- package/dist/components/macro/progress-preset.d.ts.map +1 -1
- package/dist/components/macro/radio-group-preset.d.ts.map +1 -1
- package/dist/components/macro/select-preset.d.ts.map +1 -1
- package/dist/components/macro/slider-preset.d.ts.map +1 -1
- package/dist/components/macro/switch-preset.d.ts.map +1 -1
- package/dist/components/macro/tabs-preset.d.ts +1 -1
- package/dist/components/macro/tabs-preset.d.ts.map +1 -1
- package/dist/components/macro/textarea-preset.d.ts +1 -1
- package/dist/components/macro/textarea-preset.d.ts.map +1 -1
- package/dist/components/micro/accordion.d.ts +7 -0
- package/dist/components/micro/accordion.d.ts.map +1 -1
- package/dist/components/micro/alert-dialog.d.ts.map +1 -1
- package/dist/components/micro/alert.d.ts +7 -0
- package/dist/components/micro/alert.d.ts.map +1 -1
- package/dist/components/micro/aspect-ratio.d.ts +7 -0
- package/dist/components/micro/aspect-ratio.d.ts.map +1 -1
- package/dist/components/micro/avatar.d.ts.map +1 -1
- package/dist/components/micro/badge.d.ts +8 -1
- package/dist/components/micro/badge.d.ts.map +1 -1
- package/dist/components/micro/breadcrumb.d.ts +7 -0
- package/dist/components/micro/breadcrumb.d.ts.map +1 -1
- package/dist/components/micro/button.d.ts +8 -1
- package/dist/components/micro/button.d.ts.map +1 -1
- package/dist/components/micro/calendar.d.ts +2 -2
- package/dist/components/micro/calendar.d.ts.map +1 -1
- package/dist/components/micro/carousel.d.ts.map +1 -1
- package/dist/components/micro/chart.d.ts.map +1 -1
- package/dist/components/micro/checkbox.d.ts.map +1 -1
- package/dist/components/micro/collapsible.d.ts.map +1 -1
- package/dist/components/micro/combobox.d.ts.map +1 -1
- package/dist/components/micro/command.d.ts.map +1 -1
- package/dist/components/micro/context-menu.d.ts.map +1 -1
- package/dist/components/micro/dialog.d.ts.map +1 -1
- package/dist/components/micro/drawer.d.ts.map +1 -1
- package/dist/components/micro/dropdown-menu.d.ts.map +1 -1
- package/dist/components/micro/empty.d.ts +7 -0
- package/dist/components/micro/empty.d.ts.map +1 -1
- package/dist/components/micro/field.d.ts.map +1 -1
- package/dist/components/micro/hover-card.d.ts +1 -1
- package/dist/components/micro/hover-card.d.ts.map +1 -1
- package/dist/components/micro/input-group.d.ts.map +1 -1
- package/dist/components/micro/input-otp.d.ts.map +1 -1
- package/dist/components/micro/input.d.ts +7 -0
- package/dist/components/micro/input.d.ts.map +1 -1
- package/dist/components/micro/item.d.ts.map +1 -1
- package/dist/components/micro/label.d.ts.map +1 -1
- package/dist/components/micro/menubar.d.ts.map +1 -1
- package/dist/components/micro/navigation-menu.d.ts +8 -1
- package/dist/components/micro/navigation-menu.d.ts.map +1 -1
- package/dist/components/micro/pagination.d.ts.map +1 -1
- package/dist/components/micro/popover.d.ts.map +1 -1
- package/dist/components/micro/progress.d.ts.map +1 -1
- package/dist/components/micro/radio-group.d.ts.map +1 -1
- package/dist/components/micro/select.d.ts +1 -1
- package/dist/components/micro/select.d.ts.map +1 -1
- package/dist/components/micro/sheet.d.ts.map +1 -1
- package/dist/components/micro/sidebar.d.ts.map +1 -1
- package/dist/components/micro/skeleton.d.ts +7 -0
- package/dist/components/micro/skeleton.d.ts.map +1 -1
- package/dist/components/micro/slider.d.ts +7 -0
- package/dist/components/micro/slider.d.ts.map +1 -1
- package/dist/components/micro/sonner.d.ts.map +1 -1
- package/dist/components/micro/spinner.d.ts.map +1 -1
- package/dist/components/micro/switch.d.ts.map +1 -1
- package/dist/components/micro/table.d.ts.map +1 -1
- package/dist/components/micro/tabs.d.ts +1 -1
- package/dist/components/micro/tabs.d.ts.map +1 -1
- package/dist/components/micro/textarea.d.ts +7 -0
- package/dist/components/micro/textarea.d.ts.map +1 -1
- package/dist/components/micro/toggle-group.d.ts.map +1 -1
- package/dist/components/micro/toggle.d.ts.map +1 -1
- package/dist/components/micro/tooltip.d.ts +1 -1
- package/dist/components/micro/tooltip.d.ts.map +1 -1
- package/dist/dev/App.d.ts.map +1 -1
- package/dist/dev/components/code-highlighter.d.ts.map +1 -1
- package/dist/dev/components/dev-context.d.ts.map +1 -1
- package/dist/dev/components/showcase.d.ts +1 -1
- package/dist/dev/components/showcase.d.ts.map +1 -1
- package/dist/dev/data.d.ts.map +1 -1
- package/dist/dev/main.d.ts.map +1 -1
- package/dist/dev/sections/buttons.d.ts.map +1 -1
- package/dist/dev/sections/feedback.d.ts.map +1 -1
- package/dist/dev/sections/overview.d.ts.map +1 -1
- package/dist/dev/showcase/accordion.d.ts.map +1 -1
- package/dist/dev/showcase/alert-dialog.d.ts.map +1 -1
- package/dist/dev/showcase/alert.d.ts.map +1 -1
- package/dist/dev/showcase/aspect-ratio.d.ts.map +1 -1
- package/dist/dev/showcase/avatar.d.ts.map +1 -1
- package/dist/dev/showcase/breadcrumb.d.ts.map +1 -1
- package/dist/dev/showcase/button.d.ts.map +1 -1
- package/dist/dev/showcase/calendar.d.ts.map +1 -1
- package/dist/dev/showcase/card.d.ts.map +1 -1
- package/dist/dev/showcase/carousel.d.ts.map +1 -1
- package/dist/dev/showcase/chart.d.ts.map +1 -1
- package/dist/dev/showcase/checkbox.d.ts.map +1 -1
- package/dist/dev/showcase/collapsible.d.ts.map +1 -1
- package/dist/dev/showcase/combobox.d.ts.map +1 -1
- package/dist/dev/showcase/command.d.ts.map +1 -1
- package/dist/dev/showcase/context-menu.d.ts.map +1 -1
- package/dist/dev/showcase/dialog.d.ts.map +1 -1
- package/dist/dev/showcase/drawer.d.ts.map +1 -1
- package/dist/dev/showcase/dropdown-menu.d.ts.map +1 -1
- package/dist/dev/showcase/empty.d.ts.map +1 -1
- package/dist/dev/showcase/hover-card.d.ts.map +1 -1
- package/dist/dev/showcase/input-group.d.ts.map +1 -1
- package/dist/dev/showcase/input-otp.d.ts.map +1 -1
- package/dist/dev/showcase/input.d.ts.map +1 -1
- package/dist/dev/showcase/item.d.ts.map +1 -1
- package/dist/dev/showcase/kbd.d.ts.map +1 -1
- package/dist/dev/showcase/label.d.ts.map +1 -1
- package/dist/dev/showcase/menubar.d.ts.map +1 -1
- package/dist/dev/showcase/navigation-menu.d.ts.map +1 -1
- package/dist/dev/showcase/overview.d.ts.map +1 -1
- package/dist/dev/showcase/pagination.d.ts.map +1 -1
- package/dist/dev/showcase/popover.d.ts.map +1 -1
- package/dist/dev/showcase/progress.d.ts.map +1 -1
- package/dist/dev/showcase/radio-group.d.ts.map +1 -1
- package/dist/dev/showcase/resizable.d.ts.map +1 -1
- package/dist/dev/showcase/scroll-area.d.ts.map +1 -1
- package/dist/dev/showcase/select.d.ts.map +1 -1
- package/dist/dev/showcase/separator.d.ts.map +1 -1
- package/dist/dev/showcase/sheet.d.ts.map +1 -1
- package/dist/dev/showcase/sidebar.d.ts.map +1 -1
- package/dist/dev/showcase/skeleton.d.ts.map +1 -1
- package/dist/dev/showcase/slider.d.ts.map +1 -1
- package/dist/dev/showcase/sonner.d.ts.map +1 -1
- package/dist/dev/showcase/spinner.d.ts.map +1 -1
- package/dist/dev/showcase/switch.d.ts.map +1 -1
- package/dist/dev/showcase/table.d.ts.map +1 -1
- package/dist/dev/showcase/tabs.d.ts.map +1 -1
- package/dist/dev/showcase/textarea.d.ts.map +1 -1
- package/dist/dev/showcase/theme-provider.d.ts.map +1 -1
- package/dist/dev/showcase/toast.d.ts.map +1 -1
- package/dist/dev/showcase/toggle-group.d.ts.map +1 -1
- package/dist/dev/showcase/toggle.d.ts.map +1 -1
- package/dist/dev/showcase/tooltip.d.ts.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +3 -1
- package/scripts/format-codestrings.ts +87 -0
- package/scripts/organize-imports.ts +21 -0
- package/scripts/regex-format.cjs +67 -0
- package/scripts/tmp.tsx +25 -0
- package/src/components/macro/accordion-preset.test.tsx +1 -0
- package/src/components/macro/accordion-preset.tsx +2 -1
- package/src/components/macro/alert-dialog-preset.tsx +44 -43
- package/src/components/macro/alert-preset.tsx +7 -3
- package/src/components/macro/avatar-preset.tsx +2 -1
- package/src/components/macro/breadcrumb-preset.tsx +2 -1
- package/src/components/macro/card-preset.tsx +2 -1
- package/src/components/macro/carousel-preset.tsx +5 -2
- package/src/components/macro/checkbox-preset.test.tsx +1 -0
- package/src/components/macro/checkbox-preset.tsx +6 -2
- package/src/components/macro/combobox-preset.tsx +6 -3
- package/src/components/macro/command-preset.tsx +7 -3
- package/src/components/macro/date-picker.tsx +77 -59
- package/src/components/macro/dialog-preset.tsx +42 -38
- package/src/components/macro/empty-preset.tsx +2 -1
- package/src/components/macro/field-preset.test.tsx +1 -0
- package/src/components/macro/field-preset.tsx +2 -1
- package/src/components/macro/input-otp-preset.tsx +6 -2
- package/src/components/macro/input-preset.test.tsx +1 -0
- package/src/components/macro/input-preset.tsx +4 -2
- package/src/components/macro/pagination-preset.tsx +3 -1
- package/src/components/macro/progress-preset.test.tsx +1 -0
- package/src/components/macro/progress-preset.tsx +2 -1
- package/src/components/macro/radio-group-preset.tsx +4 -1
- package/src/components/macro/select-preset.tsx +35 -30
- package/src/components/macro/slider-preset.test.tsx +1 -0
- package/src/components/macro/slider-preset.tsx +4 -1
- package/src/components/macro/switch-preset.test.tsx +1 -0
- package/src/components/macro/switch-preset.tsx +4 -1
- package/src/components/macro/tabs-preset.test.tsx +1 -0
- package/src/components/macro/tabs-preset.tsx +4 -2
- package/src/components/macro/textarea-preset.test.tsx +1 -0
- package/src/components/macro/textarea-preset.tsx +4 -1
- package/src/components/micro/accordion.tsx +3 -2
- package/src/components/micro/alert-dialog.tsx +2 -1
- package/src/components/micro/alert.tsx +3 -2
- package/src/components/micro/aspect-ratio.tsx +2 -1
- package/src/components/micro/avatar.tsx +2 -1
- package/src/components/micro/badge.tsx +3 -3
- package/src/components/micro/breadcrumb.tsx +3 -2
- package/src/components/micro/button.test.tsx +1 -0
- package/src/components/micro/button.tsx +3 -3
- package/src/components/micro/calendar.tsx +10 -9
- package/src/components/micro/carousel.tsx +3 -2
- package/src/components/micro/chart.tsx +1 -0
- package/src/components/micro/checkbox.tsx +2 -2
- package/src/components/micro/collapsible.tsx +4 -2
- package/src/components/micro/combobox.tsx +41 -29
- package/src/components/micro/command.tsx +23 -16
- package/src/components/micro/context-menu.tsx +3 -2
- package/src/components/micro/dialog.tsx +2 -1
- package/src/components/micro/drawer.tsx +2 -1
- package/src/components/micro/dropdown-menu.tsx +3 -2
- package/src/components/micro/empty.tsx +2 -1
- package/src/components/micro/field.tsx +4 -3
- package/src/components/micro/hover-card.tsx +20 -19
- package/src/components/micro/input-group.tsx +2 -1
- package/src/components/micro/input-otp.tsx +3 -2
- package/src/components/micro/input.tsx +3 -2
- package/src/components/micro/item.tsx +1 -0
- package/src/components/micro/label.tsx +2 -1
- package/src/components/micro/menubar.tsx +2 -1
- package/src/components/micro/navigation-menu.tsx +18 -17
- package/src/components/micro/pagination.tsx +2 -1
- package/src/components/micro/popover.tsx +2 -1
- package/src/components/micro/progress.tsx +2 -1
- package/src/components/micro/radio-group.tsx +3 -3
- package/src/components/micro/select.tsx +5 -4
- package/src/components/micro/sheet.tsx +2 -1
- package/src/components/micro/sidebar.tsx +4 -1
- package/src/components/micro/skeleton.tsx +2 -1
- package/src/components/micro/slider.tsx +4 -1
- package/src/components/micro/sonner.tsx +2 -1
- package/src/components/micro/spinner.tsx +1 -2
- package/src/components/micro/switch.tsx +2 -2
- package/src/components/micro/table.tsx +2 -1
- package/src/components/micro/tabs.tsx +4 -3
- package/src/components/micro/textarea.tsx +2 -1
- package/src/components/micro/toggle-group.tsx +1 -0
- package/src/components/micro/toggle.tsx +1 -3
- package/src/components/micro/tooltip.tsx +9 -3
- package/src/dev/App.tsx +66 -41
- package/src/dev/components/code-highlighter.tsx +2 -1
- package/src/dev/components/dev-context.tsx +1 -0
- package/src/dev/components/showcase.tsx +13 -14
- package/src/dev/data.ts +206 -52
- package/src/dev/main.tsx +4 -4
- package/src/dev/sections/buttons.tsx +14 -12
- package/src/dev/sections/feedback.tsx +7 -2
- package/src/dev/sections/forms.tsx +11 -11
- package/src/dev/sections/overview.tsx +2 -1
- package/src/dev/showcase/accordion.tsx +399 -314
- package/src/dev/showcase/alert-dialog.tsx +387 -384
- package/src/dev/showcase/alert.tsx +271 -258
- package/src/dev/showcase/aspect-ratio.tsx +102 -105
- package/src/dev/showcase/avatar.tsx +216 -145
- package/src/dev/showcase/badge.tsx +78 -50
- package/src/dev/showcase/breadcrumb.tsx +88 -85
- package/src/dev/showcase/button.tsx +72 -96
- package/src/dev/showcase/calendar.tsx +41 -39
- package/src/dev/showcase/card.tsx +170 -148
- package/src/dev/showcase/carousel.tsx +239 -77
- package/src/dev/showcase/chart.tsx +5 -4
- package/src/dev/showcase/checkbox.tsx +206 -140
- package/src/dev/showcase/collapsible.tsx +108 -84
- package/src/dev/showcase/combobox.tsx +272 -199
- package/src/dev/showcase/command.tsx +31 -28
- package/src/dev/showcase/context-menu.tsx +94 -77
- package/src/dev/showcase/dialog.tsx +445 -424
- package/src/dev/showcase/drawer.tsx +142 -135
- package/src/dev/showcase/dropdown-menu.tsx +165 -161
- package/src/dev/showcase/empty.tsx +173 -158
- package/src/dev/showcase/hover-card.tsx +92 -52
- package/src/dev/showcase/input-group.tsx +193 -160
- package/src/dev/showcase/input-otp.tsx +109 -99
- package/src/dev/showcase/input.tsx +78 -42
- package/src/dev/showcase/item.tsx +101 -98
- package/src/dev/showcase/kbd.tsx +78 -62
- package/src/dev/showcase/label.tsx +16 -23
- package/src/dev/showcase/menubar.tsx +274 -251
- package/src/dev/showcase/navigation-menu.tsx +175 -170
- package/src/dev/showcase/overview.tsx +164 -148
- package/src/dev/showcase/pagination.tsx +101 -69
- package/src/dev/showcase/popover.tsx +113 -86
- package/src/dev/showcase/progress.tsx +99 -69
- package/src/dev/showcase/radio-group.tsx +217 -134
- package/src/dev/showcase/resizable.tsx +65 -55
- package/src/dev/showcase/scroll-area.tsx +32 -22
- package/src/dev/showcase/select.tsx +192 -136
- package/src/dev/showcase/separator.tsx +28 -24
- package/src/dev/showcase/sheet.tsx +182 -134
- package/src/dev/showcase/sidebar.tsx +9 -5
- package/src/dev/showcase/skeleton.tsx +54 -59
- package/src/dev/showcase/slider.tsx +158 -129
- package/src/dev/showcase/sonner.tsx +3 -5
- package/src/dev/showcase/spinner.tsx +22 -18
- package/src/dev/showcase/switch.tsx +207 -110
- package/src/dev/showcase/table.tsx +44 -32
- package/src/dev/showcase/tabs.tsx +272 -267
- package/src/dev/showcase/textarea.tsx +162 -116
- package/src/dev/showcase/theme-provider.tsx +596 -534
- package/src/dev/showcase/toast.tsx +37 -38
- package/src/dev/showcase/toggle-group.tsx +87 -39
- package/src/dev/showcase/toggle.tsx +36 -27
- package/src/dev/showcase/tooltip.tsx +154 -119
- package/src/lib/utils.test.ts +1 -0
- package/src/lib/utils.ts +1 -1
- package/src/styles/gladvn.css +0 -1
|
@@ -86,16 +86,22 @@ function ScrollAreaMicroShowcase() {
|
|
|
86
86
|
label="Cuộn dọc (Vertical)"
|
|
87
87
|
description="Danh sách các mục có thể cuộn từ trên xuống dưới."
|
|
88
88
|
codeString={`<ScrollArea className="h-72 w-full max-w-sm rounded-xl border border-border bg-card">
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</
|
|
89
|
+
<div className="p-4">
|
|
90
|
+
<h4 className="mb-4 text-sm font-medium leading-none">
|
|
91
|
+
Cài đặt hệ thống
|
|
92
|
+
</h4>
|
|
93
|
+
<div className="text-sm py-3 border-b border-b-border hover:bg-muted/50 cursor-pointer">
|
|
94
|
+
Tùy chọn 1
|
|
95
|
+
</div>
|
|
96
|
+
<div className="text-sm py-3 border-b border-b-border hover:bg-muted/50 cursor-pointer">
|
|
97
|
+
Tùy chọn 2
|
|
98
|
+
</div>
|
|
99
|
+
<div className="text-sm py-3 border-b border-b-border hover:bg-muted/50 cursor-pointer">
|
|
100
|
+
Tùy chọn 3
|
|
101
|
+
</div>
|
|
102
|
+
{/* ... */}
|
|
103
|
+
</div>
|
|
104
|
+
</ScrollArea>`}
|
|
99
105
|
>
|
|
100
106
|
<ScrollArea className="h-72 w-full max-w-sm rounded-xl border border-border bg-card">
|
|
101
107
|
<VerticalList />
|
|
@@ -106,19 +112,23 @@ function ScrollAreaMicroShowcase() {
|
|
|
106
112
|
label="Cuộn ngang (Horizontal)"
|
|
107
113
|
description="Trình bày danh sách phần tử nằm ngang (thường dùng cho ảnh, card)."
|
|
108
114
|
codeString={`<ScrollArea className="w-full max-w-sm whitespace-nowrap rounded-xl border border-border bg-card p-4">
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<
|
|
115
|
+
<div className="flex w-max space-x-4">
|
|
116
|
+
<div className="w-[150px] shrink-0">
|
|
117
|
+
<div className="aspect-[3/4] rounded-md bg-muted" />
|
|
118
|
+
<p className="text-sm font-medium mt-2">
|
|
119
|
+
Tác phẩm 1
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="w-[150px] shrink-0">
|
|
123
|
+
<div className="aspect-[3/4] rounded-md bg-muted" />
|
|
124
|
+
<p className="text-sm font-medium mt-2">
|
|
125
|
+
Tác phẩm 2
|
|
126
|
+
</p>
|
|
127
|
+
</div>
|
|
128
|
+
{/* ... */}
|
|
117
129
|
</div>
|
|
118
|
-
|
|
119
|
-
</
|
|
120
|
-
<ScrollBar orientation="horizontal" />
|
|
121
|
-
</ScrollArea>`}
|
|
130
|
+
<ScrollBar orientation="horizontal" />
|
|
131
|
+
</ScrollArea>`}
|
|
122
132
|
>
|
|
123
133
|
<ScrollArea className="w-full max-w-sm whitespace-nowrap rounded-xl border border-border bg-card">
|
|
124
134
|
<HorizontalList />
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import { useDevContext } from "../../dev/components/dev-context";
|
|
2
1
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
-
import { useState } from "react";
|
|
4
2
|
import { Controller, useForm } from "react-hook-form";
|
|
5
3
|
import * as z from "zod";
|
|
6
4
|
|
|
7
|
-
import {
|
|
8
|
-
DocsCode,
|
|
9
|
-
DocsH3,
|
|
10
|
-
DocsP,
|
|
11
|
-
ExampleGrid,
|
|
12
|
-
ExampleSection,
|
|
13
|
-
Showcase,
|
|
14
|
-
ShowcaseDocs,
|
|
15
|
-
} from "../../dev/components/showcase";
|
|
16
|
-
import { type Size } from "../../lib/types";
|
|
17
|
-
|
|
18
5
|
import { SelectPreset } from "../../components/macro/select-preset";
|
|
19
6
|
import { Button } from "../../components/micro/button";
|
|
20
7
|
import {
|
|
@@ -30,13 +17,24 @@ import {
|
|
|
30
17
|
SelectGroup,
|
|
31
18
|
SelectItem,
|
|
32
19
|
SelectLabel,
|
|
20
|
+
SelectPortal,
|
|
33
21
|
SelectScrollDownButton,
|
|
34
22
|
SelectScrollUpButton,
|
|
35
23
|
SelectSeparator,
|
|
36
24
|
SelectTrigger,
|
|
37
25
|
SelectValue,
|
|
38
|
-
SelectPortal,
|
|
39
26
|
} from "../../components/micro/select";
|
|
27
|
+
import { useDevContext } from "../../dev/components/dev-context";
|
|
28
|
+
import {
|
|
29
|
+
DocsCode,
|
|
30
|
+
DocsH3,
|
|
31
|
+
DocsP,
|
|
32
|
+
ExampleGrid,
|
|
33
|
+
ExampleSection,
|
|
34
|
+
Showcase,
|
|
35
|
+
ShowcaseDocs,
|
|
36
|
+
} from "../../dev/components/showcase";
|
|
37
|
+
import { type Size } from "../../lib/types";
|
|
40
38
|
|
|
41
39
|
// ──────────────────────────────────────────────────────────
|
|
42
40
|
// RHF Form Demo (Macro)
|
|
@@ -127,7 +125,8 @@ function SelectMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
127
125
|
<ExampleSection
|
|
128
126
|
label="Tiêu chuẩn"
|
|
129
127
|
description="Trình thả xuống cơ bản với mảng options."
|
|
130
|
-
codeString={`<SelectPreset
|
|
128
|
+
codeString={`<SelectPreset
|
|
129
|
+
className="w-full"
|
|
131
130
|
label="Trái cây yêu thích"
|
|
132
131
|
description="Chọn một loại trái cây bạn thích nhất."
|
|
133
132
|
placeholder="Chọn trái cây..."
|
|
@@ -136,8 +135,7 @@ function SelectMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
136
135
|
{ value: "banana", label: "Chuối (Banana)" },
|
|
137
136
|
{ value: "cherry", label: "Anh đào (Cherry)" },
|
|
138
137
|
]}
|
|
139
|
-
|
|
140
|
-
`}
|
|
138
|
+
/>`}
|
|
141
139
|
>
|
|
142
140
|
<SelectPreset
|
|
143
141
|
className="w-full"
|
|
@@ -157,14 +155,16 @@ function SelectMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
157
155
|
label="Trạng thái Lỗi (Error)"
|
|
158
156
|
description="Báo lỗi khi form submit mà user chưa chọn."
|
|
159
157
|
codeString={`<div className="w-full flex flex-col gap-6">
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
158
|
+
<SelectPreset
|
|
159
|
+
label="Framework (Lỗi)"
|
|
160
|
+
placeholder="Chọn một framework..."
|
|
161
|
+
options={[
|
|
162
|
+
{ value: "react", label: "React" },
|
|
163
|
+
{ value: "vue", label: "Vue" },
|
|
164
|
+
]}
|
|
165
|
+
errorMessage="Vui lòng chọn một framework để tiếp tục."
|
|
166
|
+
/>
|
|
167
|
+
</div>`}
|
|
168
168
|
>
|
|
169
169
|
<div className="w-full flex flex-col gap-6">
|
|
170
170
|
<SelectPreset
|
|
@@ -185,7 +185,8 @@ function SelectMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
185
185
|
<ExampleSection
|
|
186
186
|
label="Khóa / Bất hoạt (Disabled)"
|
|
187
187
|
description="Người dùng không thể mở danh sách."
|
|
188
|
-
codeString={`<SelectPreset
|
|
188
|
+
codeString={`<SelectPreset
|
|
189
|
+
className="w-full"
|
|
189
190
|
label="Gói tài khoản"
|
|
190
191
|
description="Bạn không thể thay đổi gói cước khi chưa thanh toán nợ."
|
|
191
192
|
placeholder="Chọn gói..."
|
|
@@ -195,8 +196,7 @@ function SelectMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
195
196
|
{ value: "pro", label: "Chuyên nghiệp (Pro)" },
|
|
196
197
|
]}
|
|
197
198
|
disabled
|
|
198
|
-
|
|
199
|
-
`}
|
|
199
|
+
/>`}
|
|
200
200
|
>
|
|
201
201
|
<SelectPreset
|
|
202
202
|
className="w-full"
|
|
@@ -274,26 +274,33 @@ function SelectMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
274
274
|
label="Cơ bản (Primitive)"
|
|
275
275
|
description="Ghép nối thủ công bằng cách bọc Field."
|
|
276
276
|
codeString={`<Field className="w-full">
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
277
|
+
<FieldLabel>Framework</FieldLabel>
|
|
278
|
+
<FieldContent>
|
|
279
|
+
<Select
|
|
280
|
+
items={{
|
|
281
|
+
next: "Next.js",
|
|
282
|
+
vite: "Vite",
|
|
283
|
+
remix: "Remix",
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
<SelectTrigger>
|
|
287
|
+
<SelectValue placeholder="Chọn framework..." />
|
|
288
|
+
</SelectTrigger>
|
|
289
|
+
<SelectPortal>
|
|
290
|
+
<SelectContent>
|
|
291
|
+
<SelectScrollUpButton />
|
|
292
|
+
<SelectItem value="next">Next.js</SelectItem>
|
|
293
|
+
<SelectItem value="vite">Vite</SelectItem>
|
|
294
|
+
<SelectItem value="remix">Remix</SelectItem>
|
|
295
|
+
<SelectScrollDownButton />
|
|
296
|
+
</SelectContent>
|
|
297
|
+
</SelectPortal>
|
|
298
|
+
</Select>
|
|
299
|
+
</FieldContent>
|
|
300
|
+
<FieldDescription>
|
|
301
|
+
Chọn công nghệ bạn muốn sử dụng.
|
|
302
|
+
</FieldDescription>
|
|
303
|
+
</Field>`}
|
|
297
304
|
>
|
|
298
305
|
<Field size={globalSize} className="w-full">
|
|
299
306
|
<FieldLabel>Framework</FieldLabel>
|
|
@@ -324,36 +331,43 @@ function SelectMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
324
331
|
label="Phân nhóm (Grouped)"
|
|
325
332
|
description="Sử dụng SelectGroup, SelectLabel và SelectSeparator."
|
|
326
333
|
codeString={`<Field className="w-full">
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
334
|
+
<FieldLabel>Trái cây</FieldLabel>
|
|
335
|
+
<FieldContent>
|
|
336
|
+
<Select
|
|
337
|
+
items={{
|
|
338
|
+
orange: "Orange",
|
|
339
|
+
lemon: "Lemon",
|
|
340
|
+
strawberry: "Strawberry",
|
|
341
|
+
blueberry: "Blueberry",
|
|
342
|
+
}}
|
|
343
|
+
>
|
|
344
|
+
<SelectTrigger>
|
|
345
|
+
<SelectValue placeholder="Chọn loại quả..." />
|
|
346
|
+
</SelectTrigger>
|
|
347
|
+
<SelectPortal>
|
|
348
|
+
<SelectContent>
|
|
349
|
+
<SelectGroup>
|
|
350
|
+
<SelectLabel>
|
|
351
|
+
Họ cam chanh (Citrus)
|
|
352
|
+
</SelectLabel>
|
|
353
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
354
|
+
<SelectItem value="lemon">Lemon</SelectItem>
|
|
355
|
+
</SelectGroup>
|
|
356
|
+
<SelectSeparator />
|
|
357
|
+
<SelectGroup>
|
|
358
|
+
<SelectLabel>Họ dâu (Berry)</SelectLabel>
|
|
359
|
+
<SelectItem value="strawberry">
|
|
360
|
+
Strawberry
|
|
361
|
+
</SelectItem>
|
|
362
|
+
<SelectItem value="blueberry">
|
|
363
|
+
Blueberry
|
|
364
|
+
</SelectItem>
|
|
365
|
+
</SelectGroup>
|
|
366
|
+
</SelectContent>
|
|
367
|
+
</SelectPortal>
|
|
368
|
+
</Select>
|
|
369
|
+
</FieldContent>
|
|
370
|
+
</Field>`}
|
|
357
371
|
>
|
|
358
372
|
<Field size={globalSize} className="w-full">
|
|
359
373
|
<FieldLabel>Trái cây</FieldLabel>
|
|
@@ -395,20 +409,21 @@ function SelectMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
395
409
|
label="Trạng thái Lỗi thủ công"
|
|
396
410
|
description="Tự gắn aria-invalid vào Select."
|
|
397
411
|
codeString={`<Field data-invalid={true} className="w-full">
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
</
|
|
411
|
-
|
|
412
|
+
<FieldLabel>Dự án</FieldLabel>
|
|
413
|
+
<FieldContent>
|
|
414
|
+
<Select items={{ p1: "Project 1" }}>
|
|
415
|
+
<SelectTrigger aria-invalid={true}>
|
|
416
|
+
<SelectValue placeholder="Chọn dự án..." />
|
|
417
|
+
</SelectTrigger>
|
|
418
|
+
<SelectPortal>
|
|
419
|
+
<SelectContent>
|
|
420
|
+
<SelectItem value="p1">Project 1</SelectItem>
|
|
421
|
+
</SelectContent>
|
|
422
|
+
</SelectPortal>
|
|
423
|
+
</Select>
|
|
424
|
+
</FieldContent>
|
|
425
|
+
<FieldError>Vui lòng chọn một dự án hợp lệ.</FieldError>
|
|
426
|
+
</Field>`}
|
|
412
427
|
>
|
|
413
428
|
<Field size={globalSize} data-invalid={true} className="w-full">
|
|
414
429
|
<FieldLabel>Dự án</FieldLabel>
|
|
@@ -432,22 +447,25 @@ function SelectMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
432
447
|
label="Disabled thủ công"
|
|
433
448
|
description="Khóa SelectTrigger."
|
|
434
449
|
codeString={`<Field className="w-full">
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
</
|
|
450
|
-
|
|
450
|
+
<FieldLabel>Múi giờ</FieldLabel>
|
|
451
|
+
<FieldContent>
|
|
452
|
+
<Select items={{ gmt: "GMT+7" }}>
|
|
453
|
+
<SelectTrigger disabled>
|
|
454
|
+
<SelectValue placeholder="Chọn múi giờ..." />
|
|
455
|
+
</SelectTrigger>
|
|
456
|
+
<SelectPortal>
|
|
457
|
+
<SelectContent>
|
|
458
|
+
<SelectItem value="gmt">
|
|
459
|
+
GMT+7 (Indochina Time)
|
|
460
|
+
</SelectItem>
|
|
461
|
+
</SelectContent>
|
|
462
|
+
</SelectPortal>
|
|
463
|
+
</Select>
|
|
464
|
+
</FieldContent>
|
|
465
|
+
<FieldDescription>
|
|
466
|
+
Múi giờ tự động lấy theo hệ thống.
|
|
467
|
+
</FieldDescription>
|
|
468
|
+
</Field>`}
|
|
451
469
|
>
|
|
452
470
|
<Field size={globalSize} className="w-full">
|
|
453
471
|
<FieldLabel>Múi giờ</FieldLabel>
|
|
@@ -475,39 +493,77 @@ function SelectMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
475
493
|
description="So sánh nhanh khi nào dùng Micro và Macro."
|
|
476
494
|
fullWidth
|
|
477
495
|
codeString={`<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
496
|
+
{/* Story 1: Macro wins */}
|
|
497
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
498
|
+
<div className="flex items-start gap-3">
|
|
499
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-green-500/10 p-1.5 text-green-600">
|
|
500
|
+
<svg
|
|
501
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
502
|
+
className="size-4"
|
|
503
|
+
viewBox="0 0 24 24"
|
|
504
|
+
fill="none"
|
|
505
|
+
stroke="currentColor"
|
|
506
|
+
strokeWidth="2"
|
|
507
|
+
strokeLinecap="round"
|
|
508
|
+
strokeLinejoin="round"
|
|
509
|
+
aria-hidden="true"
|
|
510
|
+
>
|
|
511
|
+
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
|
|
512
|
+
</svg>
|
|
513
|
+
</span>
|
|
514
|
+
<div>
|
|
515
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
516
|
+
Story 1 · Dùng Macro
|
|
517
|
+
</p>
|
|
518
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
519
|
+
Form nhập Quốc tịch
|
|
520
|
+
</h3>
|
|
521
|
+
</div>
|
|
487
522
|
</div>
|
|
523
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
524
|
+
Bạn có 195 quốc gia để chọn, tất cả đều chỉ là chữ.
|
|
525
|
+
Thay vì viết 195 thẻ <DocsCode>SelectItem</DocsCode>
|
|
526
|
+
, bạn vứt mảng JSON 195 phần tử đó vào thuộc tính{" "}
|
|
527
|
+
<DocsCode>options</DocsCode> của Macro.
|
|
528
|
+
</p>
|
|
488
529
|
</div>
|
|
489
|
-
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
490
|
-
Bạn có 195 quốc gia để chọn, tất cả đều chỉ là chữ. Thay vì viết 195 thẻ <DocsCode>SelectItem</DocsCode>, bạn vứt mảng JSON 195 phần tử đó vào thuộc tính <DocsCode>options</DocsCode> của Macro.
|
|
491
|
-
</p>
|
|
492
|
-
</div>
|
|
493
530
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
531
|
+
{/* Story 2: Micro wins */}
|
|
532
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
533
|
+
<div className="flex items-start gap-3">
|
|
534
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-blue-500/10 p-1.5 text-blue-600">
|
|
535
|
+
<svg
|
|
536
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
537
|
+
className="size-4"
|
|
538
|
+
viewBox="0 0 24 24"
|
|
539
|
+
fill="none"
|
|
540
|
+
stroke="currentColor"
|
|
541
|
+
strokeWidth="2"
|
|
542
|
+
strokeLinecap="round"
|
|
543
|
+
strokeLinejoin="round"
|
|
544
|
+
aria-hidden="true"
|
|
545
|
+
>
|
|
546
|
+
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" />
|
|
547
|
+
</svg>
|
|
548
|
+
</span>
|
|
549
|
+
<div>
|
|
550
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
551
|
+
Story 2 · Dùng Micro
|
|
552
|
+
</p>
|
|
553
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
554
|
+
Menu Chọn Tài khoản
|
|
555
|
+
</h3>
|
|
556
|
+
</div>
|
|
503
557
|
</div>
|
|
558
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
559
|
+
Bạn muốn trong danh sách thả xuống, mỗi dòng không
|
|
560
|
+
chỉ là Tên, mà còn có cả Avatar (ảnh tròn) và Email
|
|
561
|
+
(chữ mờ ở dưới). Bạn bắt buộc phải dùng Micro để tự
|
|
562
|
+
thiết kế nội dung bên trong{" "}
|
|
563
|
+
<DocsCode>SelectItem</DocsCode>.
|
|
564
|
+
</p>
|
|
504
565
|
</div>
|
|
505
|
-
|
|
506
|
-
Bạn muốn trong danh sách thả xuống, mỗi dòng không chỉ là Tên, mà còn có cả Avatar (ảnh tròn) và Email (chữ mờ ở dưới). Bạn bắt buộc phải dùng Micro để tự thiết kế nội dung bên trong <DocsCode>SelectItem</DocsCode>.
|
|
507
|
-
</p>
|
|
508
|
-
</div>
|
|
509
|
-
</div>
|
|
510
|
-
`}
|
|
566
|
+
</div>`}
|
|
511
567
|
>
|
|
512
568
|
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
513
569
|
{/* Story 1: Macro wins */}
|
|
@@ -19,20 +19,19 @@ function SeparatorMicroShowcase() {
|
|
|
19
19
|
description="Sử dụng để phân tách các khối nội dung từ trên xuống dưới."
|
|
20
20
|
fullWidth
|
|
21
21
|
codeString={`<div className="w-full max-w-sm rounded-lg border border-border bg-card p-6">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div
|
|
35
|
-
`}
|
|
22
|
+
<div className="space-y-1">
|
|
23
|
+
<h4 className="text-sm font-medium leading-none">
|
|
24
|
+
Gladvn UI
|
|
25
|
+
</h4>
|
|
26
|
+
<p className="text-sm text-muted-foreground">
|
|
27
|
+
Bộ UI Component mã nguồn mở.
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
<Separator className="my-4" />
|
|
31
|
+
<div className="text-sm text-muted-foreground">
|
|
32
|
+
Cập nhật lần cuối: Hôm nay
|
|
33
|
+
</div>
|
|
34
|
+
</div>`}
|
|
36
35
|
>
|
|
37
36
|
<div className="w-full max-w-sm rounded-lg border border-border bg-card p-6">
|
|
38
37
|
<div className="space-y-1">
|
|
@@ -52,13 +51,18 @@ function SeparatorMicroShowcase() {
|
|
|
52
51
|
label="Dọc (Vertical)"
|
|
53
52
|
description="Sử dụng để phân tách các mục nằm ngang (như menu, thanh công cụ)."
|
|
54
53
|
codeString={`<div className="flex h-5 items-center space-x-4 text-sm">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
<div className="font-medium hover:underline cursor-pointer">
|
|
55
|
+
Blog
|
|
56
|
+
</div>
|
|
57
|
+
<Separator orientation="vertical" />
|
|
58
|
+
<div className="font-medium hover:underline cursor-pointer">
|
|
59
|
+
Tài liệu
|
|
60
|
+
</div>
|
|
61
|
+
<Separator orientation="vertical" />
|
|
62
|
+
<div className="font-medium hover:underline cursor-pointer">
|
|
63
|
+
Mã nguồn
|
|
64
|
+
</div>
|
|
65
|
+
</div>`}
|
|
62
66
|
>
|
|
63
67
|
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
64
68
|
<div className="font-medium hover:underline cursor-pointer">Blog</div>
|
|
@@ -76,10 +80,10 @@ function SeparatorMicroShowcase() {
|
|
|
76
80
|
label="Decorative vs Semantic"
|
|
77
81
|
description='Semantic (mặc định) được screen reader đọc. Truyền aria-hidden="true" khi Separator chỉ mang tính trang trí thuần.'
|
|
78
82
|
codeString={`{/* Semantic — screen reader đọc được */}
|
|
79
|
-
<Separator />
|
|
83
|
+
<Separator />
|
|
80
84
|
|
|
81
|
-
{/* Decorative — chỉ là đường kẻ trực quan */}
|
|
82
|
-
<Separator aria-hidden="true" />`}
|
|
85
|
+
{/* Decorative — chỉ là đường kẻ trực quan */}
|
|
86
|
+
<Separator aria-hidden="true" />`}
|
|
83
87
|
>
|
|
84
88
|
<div className="flex flex-col gap-6 w-full max-w-sm">
|
|
85
89
|
<div>
|