gladvn 0.2.36 → 0.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/strip-comments.ts +79 -0
- package/src/blocks/auth-form.tsx +34 -30
- package/src/blocks/auth-recovery.tsx +9 -13
- package/src/blocks/auth-split.tsx +46 -36
- package/src/blocks/settings.tsx +84 -117
- package/src/components/macro/alert-preset.tsx +3 -1
- package/src/components/macro/carousel-preset.tsx +0 -1
- package/src/components/macro/checkbox-preset.test.tsx +2 -2
- package/src/components/macro/checkbox-preset.tsx +1 -2
- package/src/components/macro/command-preset.tsx +1 -1
- package/src/components/macro/date-picker.tsx +5 -18
- package/src/components/macro/dialog-preset.tsx +5 -3
- package/src/components/macro/input-preset.tsx +0 -1
- package/src/components/macro/select-preset.tsx +1 -1
- package/src/components/macro/switch-preset.test.tsx +1 -1
- package/src/components/micro/accordion.test.tsx +6 -12
- package/src/components/micro/alert-dialog.tsx +0 -2
- package/src/components/micro/alert.test.tsx +5 -8
- package/src/components/micro/alert.tsx +0 -2
- package/src/components/micro/badge.test.tsx +5 -7
- package/src/components/micro/badge.tsx +1 -3
- package/src/components/micro/button.test.tsx +19 -26
- package/src/components/micro/button.tsx +3 -11
- package/src/components/micro/calendar.tsx +12 -13
- package/src/components/micro/card.test.tsx +3 -5
- package/src/components/micro/carousel.tsx +0 -1
- package/src/components/micro/chart.tsx +3 -2
- package/src/components/micro/checkbox.test.tsx +9 -18
- package/src/components/micro/combobox.tsx +1 -3
- package/src/components/micro/command.tsx +23 -11
- package/src/components/micro/context-menu.tsx +0 -2
- package/src/components/micro/dialog.test.tsx +6 -14
- package/src/components/micro/dialog.tsx +0 -2
- package/src/components/micro/drawer.tsx +0 -3
- package/src/components/micro/dropdown-menu.test.tsx +8 -14
- package/src/components/micro/dropdown-menu.tsx +0 -2
- package/src/components/micro/field.tsx +3 -3
- package/src/components/micro/hover-card.tsx +0 -2
- package/src/components/micro/input-group.tsx +9 -42
- package/src/components/micro/input.test.tsx +15 -24
- package/src/components/micro/navigation-menu.tsx +0 -2
- package/src/components/micro/popover.test.tsx +5 -9
- package/src/components/micro/progress.tsx +5 -1
- package/src/components/micro/select.test.tsx +5 -18
- package/src/components/micro/select.tsx +3 -5
- package/src/components/micro/separator.tsx +1 -1
- package/src/components/micro/sheet.test.tsx +6 -14
- package/src/components/micro/sheet.tsx +0 -2
- package/src/components/micro/sidebar.tsx +5 -6
- package/src/components/micro/sonner.tsx +0 -1
- package/src/components/micro/switch.test.tsx +9 -18
- package/src/components/micro/switch.tsx +1 -1
- package/src/components/micro/tabs.test.tsx +5 -11
- package/src/components/micro/theme-provider.tsx +0 -12
- package/src/components/micro/toggle-group.tsx +1 -12
- package/src/components/micro/tooltip.test.tsx +7 -12
- package/src/dev/App.tsx +6 -6
- package/src/dev/components/BlockViewer.tsx +15 -4
- package/src/dev/components/Container.tsx +20 -0
- package/src/dev/components/GladvnLogo.tsx +3 -9
- package/src/dev/components/code-highlighter.tsx +5 -3
- package/src/dev/components/showcase.tsx +116 -168
- package/src/dev/sections/buttons.tsx +4 -9
- package/src/dev/sections/display.tsx +68 -72
- package/src/dev/sections/feedback.tsx +304 -314
- package/src/dev/sections/forms.tsx +10 -14
- package/src/dev/sections/interactive.tsx +32 -32
- package/src/dev/sections/overview.tsx +2 -10
- package/src/dev/showcase/accordion.tsx +512 -554
- package/src/dev/showcase/alert-dialog.tsx +525 -565
- package/src/dev/showcase/alert.tsx +352 -402
- package/src/dev/showcase/aspect-ratio.tsx +167 -193
- package/src/dev/showcase/avatar.tsx +231 -269
- package/src/dev/showcase/badge.tsx +92 -140
- package/src/dev/showcase/breadcrumb.tsx +113 -135
- package/src/dev/showcase/button.tsx +140 -173
- package/src/dev/showcase/calendar.tsx +187 -237
- package/src/dev/showcase/card.tsx +229 -261
- package/src/dev/showcase/carousel.tsx +288 -315
- package/src/dev/showcase/chart.tsx +44 -50
- package/src/dev/showcase/checkbox.tsx +286 -330
- package/src/dev/showcase/collapsible.tsx +143 -160
- package/src/dev/showcase/combobox.tsx +327 -369
- package/src/dev/showcase/command.tsx +106 -120
- package/src/dev/showcase/context-menu.tsx +93 -107
- package/src/dev/showcase/dialog.tsx +585 -630
- package/src/dev/showcase/drawer.tsx +176 -196
- package/src/dev/showcase/dropdown-menu.tsx +183 -201
- package/src/dev/showcase/empty.tsx +232 -274
- package/src/dev/showcase/hover-card.tsx +153 -180
- package/src/dev/showcase/input-group.tsx +221 -253
- package/src/dev/showcase/input-otp.tsx +204 -250
- package/src/dev/showcase/input.tsx +246 -325
- package/src/dev/showcase/item.tsx +134 -152
- package/src/dev/showcase/kbd.tsx +149 -172
- package/src/dev/showcase/label.tsx +50 -68
- package/src/dev/showcase/menubar.tsx +194 -213
- package/src/dev/showcase/navigation-menu.tsx +119 -133
- package/src/dev/showcase/overview-components/ArchitectureSection.tsx +126 -0
- package/src/dev/showcase/overview-components/CodeBlock.tsx +50 -0
- package/src/dev/showcase/overview-components/ColorPaletteSection.tsx +44 -0
- package/src/dev/showcase/overview-components/DashboardPreview.tsx +159 -0
- package/src/dev/showcase/overview-components/FeatureGridSection.tsx +535 -0
- package/src/dev/showcase/overview-components/FooterCTA.tsx +137 -0
- package/src/dev/showcase/overview-components/HeroSection.tsx +65 -0
- package/src/dev/showcase/overview-components/PrinciplesSection.tsx +128 -0
- package/src/dev/showcase/overview.tsx +21 -1163
- package/src/dev/showcase/pagination.tsx +144 -190
- package/src/dev/showcase/popover.tsx +181 -196
- package/src/dev/showcase/progress.tsx +141 -189
- package/src/dev/showcase/radio-group.tsx +272 -332
- package/src/dev/showcase/resizable.tsx +119 -141
- package/src/dev/showcase/scroll-area.tsx +21 -36
- package/src/dev/showcase/select.tsx +262 -322
- package/src/dev/showcase/separator.tsx +75 -73
- package/src/dev/showcase/sheet.tsx +333 -361
- package/src/dev/showcase/sidebar.tsx +53 -59
- package/src/dev/showcase/skeleton.tsx +93 -112
- package/src/dev/showcase/slider.tsx +244 -296
- package/src/dev/showcase/sonner.tsx +251 -258
- package/src/dev/showcase/spinner.tsx +46 -67
- package/src/dev/showcase/switch.tsx +298 -362
- package/src/dev/showcase/table.tsx +76 -80
- package/src/dev/showcase/tabs.tsx +302 -355
- package/src/dev/showcase/textarea.tsx +240 -293
- package/src/dev/showcase/toast.tsx +48 -54
- package/src/dev/showcase/toggle-group.tsx +104 -129
- package/src/dev/showcase/toggle.tsx +82 -102
- package/src/dev/showcase/tooltip.tsx +173 -192
- package/src/dev/showcase/why.tsx +6 -12
- package/src/hooks/use-mobile.test.ts +3 -2
- package/src/lib/utils.test.ts +5 -4
|
@@ -23,26 +23,20 @@ import {
|
|
|
23
23
|
DocsH3,
|
|
24
24
|
DocsP,
|
|
25
25
|
ExampleGrid,
|
|
26
|
-
|
|
26
|
+
ShowcaseExample,
|
|
27
27
|
Showcase,
|
|
28
28
|
ShowcaseDocs
|
|
29
29
|
} from "../../dev/components/showcase";
|
|
30
30
|
import { type Size } from "../../lib/types";
|
|
31
31
|
import { cn } from "../../lib/utils";
|
|
32
32
|
|
|
33
|
-
// ──────────────────────────────────────────────────────────
|
|
34
|
-
// Macro Showcase
|
|
35
|
-
// ──────────────────────────────────────────────────────────
|
|
36
33
|
function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
37
34
|
const [controlledOpen, setControlledOpen] = useState(false);
|
|
38
35
|
|
|
39
36
|
return (
|
|
40
37
|
<div className="space-y-10">
|
|
41
38
|
<ExampleGrid>
|
|
42
|
-
<
|
|
43
|
-
label="Basic Usage"
|
|
44
|
-
description="DialogPreset với title, description và footer đơn giản."
|
|
45
|
-
codeString={`<DialogPreset
|
|
39
|
+
<ShowcaseExample title="Basic Usage" description="DialogPreset với title, description và footer đơn giản." code={`<DialogPreset
|
|
46
40
|
title="Update Subscription"
|
|
47
41
|
description="Are you sure you want to upgrade your plan to Pro? This will charge your card immediately."
|
|
48
42
|
trigger={
|
|
@@ -50,44 +44,42 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
50
44
|
}
|
|
51
45
|
footer={
|
|
52
46
|
<>
|
|
53
|
-
<Button variant="ghost">
|
|
47
|
+
<Button variant="ghost">Huỷ</Button>
|
|
54
48
|
<Button color="primary">Confirm</Button>
|
|
55
49
|
</>
|
|
56
50
|
}
|
|
57
|
-
/>`}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
51
|
+
/>`} preview={
|
|
52
|
+
<>
|
|
53
|
+
<DialogPreset
|
|
54
|
+
size={globalSize}
|
|
55
|
+
title="Update Subscription"
|
|
56
|
+
description="Are you sure you want to upgrade your plan to Pro? This will charge your card immediately."
|
|
57
|
+
trigger={
|
|
58
|
+
<Button variant="outline" size={globalSize}>
|
|
59
|
+
Upgrade Plan
|
|
60
|
+
</Button>
|
|
61
|
+
}
|
|
62
|
+
footer={
|
|
63
|
+
<>
|
|
64
|
+
<Button variant="ghost" size={globalSize}>
|
|
65
|
+
Cancel
|
|
66
|
+
</Button>
|
|
67
|
+
<Button color="primary" size={globalSize}>
|
|
68
|
+
Confirm
|
|
69
|
+
</Button>
|
|
70
|
+
</>
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
</>
|
|
74
|
+
} />
|
|
80
75
|
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
codeString={`<DialogPreset
|
|
85
|
-
title="Edit profile"
|
|
86
|
-
description="Make changes to your profile here. Click save when you're done."
|
|
76
|
+
<ShowcaseExample title="Forms & Custom Content" description="Sử dụng children để render form hoặc nội dung phức tạp." code={`<DialogPreset
|
|
77
|
+
title="Chỉnh sửa hồ sơ"
|
|
78
|
+
description="Thay đổi thông tin hồ sơ của bạn tại đây. Bấm lưu khi hoàn tất."
|
|
87
79
|
trigger={
|
|
88
|
-
<Button variant="outline">
|
|
80
|
+
<Button variant="outline">Chỉnh sửa hồ sơ</Button>
|
|
89
81
|
}
|
|
90
|
-
footer={<Button type="submit">
|
|
82
|
+
footer={<Button type="submit">Lưu thay đổi</Button>}
|
|
91
83
|
>
|
|
92
84
|
<div className="grid gap-4 py-4">
|
|
93
85
|
<div className="grid grid-cols-4 items-center gap-4">
|
|
@@ -111,57 +103,55 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
111
103
|
/>
|
|
112
104
|
</div>
|
|
113
105
|
</div>
|
|
114
|
-
</DialogPreset>`}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
106
|
+
</DialogPreset>`} preview={
|
|
107
|
+
<>
|
|
108
|
+
<DialogPreset
|
|
109
|
+
size={globalSize}
|
|
110
|
+
title="Chỉnh sửa hồ sơ"
|
|
111
|
+
description="Thay đổi thông tin hồ sơ của bạn tại đây. Bấm lưu khi hoàn tất."
|
|
112
|
+
trigger={
|
|
113
|
+
<Button variant="outline" size={globalSize}>
|
|
114
|
+
Chỉnh sửa hồ sơ
|
|
115
|
+
</Button>
|
|
116
|
+
}
|
|
117
|
+
footer={
|
|
118
|
+
<Button type="submit" size={globalSize}>
|
|
119
|
+
Lưu thay đổi
|
|
120
|
+
</Button>
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
<div className="grid gap-4 py-4">
|
|
124
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
125
|
+
<Label htmlFor="name" className="text-right">
|
|
126
|
+
Name
|
|
127
|
+
</Label>
|
|
128
|
+
<Input
|
|
129
|
+
id="name"
|
|
130
|
+
defaultValue="Pedro Duarte"
|
|
131
|
+
className="col-span-3"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
135
|
+
<Label htmlFor="username" className="text-right">
|
|
136
|
+
Username
|
|
137
|
+
</Label>
|
|
138
|
+
<Input
|
|
139
|
+
id="username"
|
|
140
|
+
defaultValue="@peduarte"
|
|
141
|
+
className="col-span-3"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</DialogPreset>
|
|
146
|
+
</>
|
|
147
|
+
} />
|
|
155
148
|
</ExampleGrid>
|
|
156
149
|
|
|
157
150
|
<ExampleGrid>
|
|
158
|
-
<
|
|
159
|
-
label="No Close Button"
|
|
160
|
-
description="Ẩn nút X ở góc trên bằng showCloseButton={false}."
|
|
161
|
-
codeString={`<DialogPreset
|
|
151
|
+
<ShowcaseExample title="No Close Button" description="Ẩn nút X ở góc trên bằng showCloseButton={false}." code={`<DialogPreset
|
|
162
152
|
showCloseButton={false}
|
|
163
|
-
title="
|
|
164
|
-
description="
|
|
153
|
+
title="Điều khoản Dịch vụ"
|
|
154
|
+
description="Bạn phải chấp nhận điều khoản mới để tiếp tục sử dụng ứng dụng."
|
|
165
155
|
trigger={<Button variant="outline">View Terms</Button>}
|
|
166
156
|
footer={
|
|
167
157
|
<>
|
|
@@ -171,43 +161,41 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
171
161
|
}
|
|
172
162
|
>
|
|
173
163
|
<p className="text-sm text-muted-foreground">
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
Bằng cách chọn chấp nhận, bạn đồng ý với Điều khoản của
|
|
165
|
+
Dịch vụ và Chính sách bảo mật.
|
|
176
166
|
</p>
|
|
177
|
-
</DialogPreset>`}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
167
|
+
</DialogPreset>`} preview={
|
|
168
|
+
<>
|
|
169
|
+
<DialogPreset
|
|
170
|
+
size={globalSize}
|
|
171
|
+
showCloseButton={false}
|
|
172
|
+
title="Điều khoản Dịch vụ"
|
|
173
|
+
description="Bạn phải chấp nhận điều khoản mới để tiếp tục sử dụng ứng dụng."
|
|
174
|
+
trigger={
|
|
175
|
+
<Button variant="outline" size={globalSize}>
|
|
176
|
+
View Terms
|
|
177
|
+
</Button>
|
|
178
|
+
}
|
|
179
|
+
footer={
|
|
180
|
+
<>
|
|
181
|
+
<Button variant="outline" size={globalSize}>
|
|
182
|
+
Decline
|
|
183
|
+
</Button>
|
|
184
|
+
<Button size={globalSize}>Accept</Button>
|
|
185
|
+
</>
|
|
186
|
+
}
|
|
187
|
+
>
|
|
188
|
+
<p className="text-sm text-muted-foreground">
|
|
189
|
+
Bằng cách chọn chấp nhận, bạn đồng ý với Điều khoản của Service and
|
|
190
|
+
Privacy Policy.
|
|
191
|
+
</p>
|
|
192
|
+
</DialogPreset>
|
|
193
|
+
</>
|
|
194
|
+
} />
|
|
204
195
|
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
codeString={`<DialogPreset
|
|
209
|
-
title="Detailed Report"
|
|
210
|
-
description="Monthly analytics and performance overview."
|
|
196
|
+
<ShowcaseExample title="Large Content Sizing" description="Sử dụng size='lg' cho nội dung lớn hơn." code={`<DialogPreset
|
|
197
|
+
title="Báo cáo chi tiết"
|
|
198
|
+
description="Phân tích hàng tháng và tổng quan hiệu suất."
|
|
211
199
|
trigger={<Button variant="outline">View Report</Button>}
|
|
212
200
|
footer={<Button>Download PDF</Button>}
|
|
213
201
|
>
|
|
@@ -216,33 +204,31 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
216
204
|
Large Content Area
|
|
217
205
|
</span>
|
|
218
206
|
</div>
|
|
219
|
-
</DialogPreset>`}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
207
|
+
</DialogPreset>`} preview={
|
|
208
|
+
<>
|
|
209
|
+
<DialogPreset
|
|
210
|
+
size={globalSize}
|
|
211
|
+
title="Báo cáo chi tiết"
|
|
212
|
+
description="Phân tích hàng tháng và tổng quan hiệu suất."
|
|
213
|
+
trigger={
|
|
214
|
+
<Button variant="outline" size={globalSize}>
|
|
215
|
+
View Report
|
|
216
|
+
</Button>
|
|
217
|
+
}
|
|
218
|
+
footer={<Button size={globalSize}>Download PDF</Button>}
|
|
219
|
+
>
|
|
220
|
+
<div className="h-[200px] flex items-center justify-center rounded-md border border-border border-dashed bg-muted/20">
|
|
221
|
+
<span className="text-muted-foreground text-sm">
|
|
222
|
+
Large Content Area
|
|
223
|
+
</span>
|
|
224
|
+
</div>
|
|
225
|
+
</DialogPreset>
|
|
226
|
+
</>
|
|
227
|
+
} />
|
|
239
228
|
</ExampleGrid>
|
|
240
229
|
|
|
241
230
|
<ExampleGrid>
|
|
242
|
-
<
|
|
243
|
-
label="Controlled State"
|
|
244
|
-
description="Sử dụng open và onOpenChange để quản lý trạng thái đóng mở bằng React state."
|
|
245
|
-
codeString={`<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
231
|
+
<ShowcaseExample title="Controlled State" description="Sử dụng open và onOpenChange để quản lý trạng thái đóng mở bằng React state." code={`<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
246
232
|
<div className="flex gap-4 items-center">
|
|
247
233
|
<Button
|
|
248
234
|
onClick={() => setControlledOpen(true)}
|
|
@@ -273,60 +259,58 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
273
259
|
Bạn có thể đóng bằng nút bên dưới hoặc dấu X.
|
|
274
260
|
</p>
|
|
275
261
|
</DialogPreset>
|
|
276
|
-
</div>`}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
262
|
+
</div>`} preview={
|
|
263
|
+
<>
|
|
264
|
+
<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
265
|
+
<div className="flex gap-4 items-center">
|
|
266
|
+
<Button
|
|
267
|
+
onClick={() => setControlledOpen(true)}
|
|
268
|
+
variant="outline"
|
|
269
|
+
size={globalSize}
|
|
270
|
+
>
|
|
271
|
+
Open Controlled Dialog
|
|
272
|
+
</Button>
|
|
273
|
+
<span className="text-sm text-muted-foreground font-mono">
|
|
274
|
+
State: {controlledOpen ? "true" : "false"}
|
|
275
|
+
</span>
|
|
276
|
+
</div>
|
|
291
277
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
278
|
+
<DialogPreset
|
|
279
|
+
open={controlledOpen}
|
|
280
|
+
onOpenChange={setControlledOpen}
|
|
281
|
+
size={globalSize}
|
|
282
|
+
title="Controlled Dialog"
|
|
283
|
+
description="Trạng thái của dialog này được quản lý hoàn toàn bởi React state bên ngoài."
|
|
284
|
+
footer={
|
|
285
|
+
<Button
|
|
286
|
+
color="primary"
|
|
287
|
+
onClick={() => setControlledOpen(false)}
|
|
288
|
+
size={globalSize}
|
|
289
|
+
>
|
|
290
|
+
Close Manually
|
|
291
|
+
</Button>
|
|
292
|
+
}
|
|
293
|
+
>
|
|
294
|
+
<p className="text-sm text-foreground">
|
|
295
|
+
Bạn có thể đóng bằng nút bên dưới hoặc dấu X.
|
|
296
|
+
</p>
|
|
297
|
+
</DialogPreset>
|
|
298
|
+
</div>
|
|
299
|
+
</>
|
|
300
|
+
} />
|
|
314
301
|
|
|
315
|
-
<
|
|
316
|
-
label="Sticky Footer (Long Content)"
|
|
317
|
-
description="Layout in-flow giúp footer luôn dính ở dưới cùng khi có thanh cuộn."
|
|
318
|
-
codeString={`<DialogPreset
|
|
302
|
+
<ShowcaseExample title="Sticky Footer (Long Content)" description="Layout in-flow giúp footer luôn dính ở dưới cùng khi có thanh cuộn." code={`<DialogPreset
|
|
319
303
|
trigger={
|
|
320
304
|
<Button variant="outline">View Long Content</Button>
|
|
321
305
|
}
|
|
322
|
-
title="
|
|
306
|
+
title="Điều khoản & Điều kiện"
|
|
323
307
|
description="Cuộn xuống dưới cùng để có thể đồng ý với điều khoản."
|
|
324
308
|
footer={
|
|
325
309
|
<div className="flex w-full sm:justify-end gap-2">
|
|
326
310
|
<DialogClose render={<Button variant="ghost" />}>
|
|
327
311
|
Cancel
|
|
328
312
|
</DialogClose>
|
|
329
|
-
<Button>
|
|
313
|
+
<Button>Tôi đồng ý</Button>
|
|
330
314
|
</div>
|
|
331
315
|
}
|
|
332
316
|
>
|
|
@@ -344,52 +328,50 @@ function DialogMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
344
328
|
END OF CONTENT
|
|
345
329
|
</span>
|
|
346
330
|
</div>
|
|
347
|
-
</DialogPreset>`}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
331
|
+
</DialogPreset>`} preview={
|
|
332
|
+
<>
|
|
333
|
+
<DialogPreset
|
|
334
|
+
trigger={
|
|
335
|
+
<Button variant="outline" size={globalSize}>
|
|
336
|
+
View Long Content
|
|
337
|
+
</Button>
|
|
338
|
+
}
|
|
339
|
+
size={globalSize}
|
|
340
|
+
title="Điều khoản & Điều kiện"
|
|
341
|
+
description="Cuộn xuống dưới cùng để có thể đồng ý với điều khoản."
|
|
342
|
+
footer={
|
|
343
|
+
<div className="flex w-full sm:justify-end gap-2">
|
|
344
|
+
<DialogClose
|
|
345
|
+
render={<Button variant="ghost" size={globalSize} />}
|
|
346
|
+
>
|
|
347
|
+
Cancel
|
|
348
|
+
</DialogClose>
|
|
349
|
+
<Button size={globalSize}>Tôi đồng ý</Button>
|
|
350
|
+
</div>
|
|
351
|
+
}
|
|
352
|
+
>
|
|
353
|
+
<div className="flex h-[800px] flex-col items-center justify-between rounded-md border border-border border-dashed bg-muted/20 py-8">
|
|
354
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
355
|
+
START OF CONTENT
|
|
356
|
+
</span>
|
|
357
|
+
<div className="flex flex-col items-center gap-2">
|
|
358
|
+
<span className="text-4xl">👇</span>
|
|
359
|
+
<span className="text-sm text-muted-foreground">
|
|
360
|
+
Keep scrolling
|
|
361
|
+
</span>
|
|
362
|
+
</div>
|
|
363
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
364
|
+
END OF CONTENT
|
|
365
|
+
</span>
|
|
366
|
+
</div>
|
|
367
|
+
</DialogPreset>
|
|
368
|
+
</>
|
|
369
|
+
} />
|
|
385
370
|
</ExampleGrid>
|
|
386
371
|
</div>
|
|
387
372
|
);
|
|
388
373
|
}
|
|
389
374
|
|
|
390
|
-
// ──────────────────────────────────────────────────────────
|
|
391
|
-
// Micro Showcase
|
|
392
|
-
// ──────────────────────────────────────────────────────────
|
|
393
375
|
function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
394
376
|
const [controlledOpen, setControlledOpen] = useState(false);
|
|
395
377
|
const contentClass =
|
|
@@ -402,10 +384,7 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
402
384
|
return (
|
|
403
385
|
<div className="space-y-10">
|
|
404
386
|
<ExampleGrid>
|
|
405
|
-
<
|
|
406
|
-
label="Basic Usage"
|
|
407
|
-
description="Sử dụng các thành phần rời rạc để tạo dialog cơ bản."
|
|
408
|
-
codeString={`<Dialog>
|
|
387
|
+
<ShowcaseExample title="Basic Usage" description="Sử dụng các thành phần rời rạc để tạo dialog cơ bản." code={`<Dialog>
|
|
409
388
|
<DialogTrigger
|
|
410
389
|
render={
|
|
411
390
|
<Button variant="outline">Upgrade Plan</Button>
|
|
@@ -441,66 +420,64 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
441
420
|
</DialogClose>
|
|
442
421
|
</DialogContent>
|
|
443
422
|
|
|
444
|
-
</Dialog>`}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
423
|
+
</Dialog>`} preview={
|
|
424
|
+
<>
|
|
425
|
+
<Dialog>
|
|
426
|
+
<DialogTrigger
|
|
427
|
+
render={
|
|
428
|
+
<Button variant="outline" size={globalSize}>
|
|
429
|
+
Upgrade Plan
|
|
430
|
+
</Button>
|
|
431
|
+
}
|
|
432
|
+
/>
|
|
454
433
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
434
|
+
<DialogContent className={contentClass}>
|
|
435
|
+
<DialogHeader>
|
|
436
|
+
<DialogTitle>Update Subscription</DialogTitle>
|
|
437
|
+
<DialogDescription>
|
|
438
|
+
Are you sure you want to upgrade your plan to Pro? This will
|
|
439
|
+
charge your card immediately.
|
|
440
|
+
</DialogDescription>
|
|
441
|
+
</DialogHeader>
|
|
442
|
+
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
443
|
+
<DialogClose
|
|
444
|
+
render={<Button variant="ghost" size={globalSize} />}
|
|
445
|
+
>
|
|
446
|
+
Cancel
|
|
447
|
+
</DialogClose>
|
|
448
|
+
<Button color="primary" size={globalSize}>
|
|
449
|
+
Confirm
|
|
450
|
+
</Button>
|
|
451
|
+
</DialogFooter>
|
|
452
|
+
<DialogClose
|
|
453
|
+
render={
|
|
454
|
+
<Button
|
|
455
|
+
variant="ghost"
|
|
456
|
+
className="absolute top-2 right-2"
|
|
457
|
+
size="sm"
|
|
458
|
+
iconOnly
|
|
459
|
+
/>
|
|
460
|
+
}
|
|
461
|
+
>
|
|
462
|
+
<XIcon />
|
|
463
|
+
<span className="sr-only">Close</span>
|
|
464
|
+
</DialogClose>
|
|
465
|
+
</DialogContent>
|
|
466
|
+
|
|
467
|
+
</Dialog>
|
|
468
|
+
</>
|
|
469
|
+
} />
|
|
490
470
|
|
|
491
|
-
<
|
|
492
|
-
label="Forms & Custom Content"
|
|
493
|
-
description="Sử dụng form bên trong DialogContent."
|
|
494
|
-
codeString={`<Dialog>
|
|
471
|
+
<ShowcaseExample title="Forms & Custom Content" description="Sử dụng form bên trong DialogContent." code={`<Dialog>
|
|
495
472
|
<DialogTrigger
|
|
496
473
|
render={
|
|
497
|
-
<Button variant="outline">
|
|
474
|
+
<Button variant="outline">Chỉnh sửa hồ sơ</Button>
|
|
498
475
|
}
|
|
499
476
|
/>
|
|
500
477
|
|
|
501
478
|
<DialogContent className={contentClass}>
|
|
502
479
|
<DialogHeader>
|
|
503
|
-
<DialogTitle>
|
|
480
|
+
<DialogTitle>Chỉnh sửa hồ sơ</DialogTitle>
|
|
504
481
|
<DialogDescription>
|
|
505
482
|
Make changes to your profile here. Click save
|
|
506
483
|
when you're done.
|
|
@@ -532,7 +509,7 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
532
509
|
</div>
|
|
533
510
|
</div>
|
|
534
511
|
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
535
|
-
<Button type="submit">
|
|
512
|
+
<Button type="submit">Lưu thay đổi</Button>
|
|
536
513
|
</DialogFooter>
|
|
537
514
|
<DialogClose
|
|
538
515
|
render={
|
|
@@ -549,91 +526,89 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
549
526
|
</DialogClose>
|
|
550
527
|
</DialogContent>
|
|
551
528
|
|
|
552
|
-
</Dialog>`}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
529
|
+
</Dialog>`} preview={
|
|
530
|
+
<>
|
|
531
|
+
<Dialog>
|
|
532
|
+
<DialogTrigger
|
|
533
|
+
render={
|
|
534
|
+
<Button variant="outline" size={globalSize}>
|
|
535
|
+
Chỉnh sửa hồ sơ
|
|
536
|
+
</Button>
|
|
537
|
+
}
|
|
538
|
+
/>
|
|
562
539
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
540
|
+
<DialogContent className={contentClass}>
|
|
541
|
+
<DialogHeader>
|
|
542
|
+
<DialogTitle>Chỉnh sửa hồ sơ</DialogTitle>
|
|
543
|
+
<DialogDescription>
|
|
544
|
+
Make changes to your profile here. Click save when you're
|
|
545
|
+
done.
|
|
546
|
+
</DialogDescription>
|
|
547
|
+
</DialogHeader>
|
|
548
|
+
<div className="grid gap-4 py-4">
|
|
549
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
550
|
+
<Label htmlFor="name" className="text-right">
|
|
551
|
+
Name
|
|
552
|
+
</Label>
|
|
553
|
+
<Input
|
|
554
|
+
id="name"
|
|
555
|
+
defaultValue="Pedro Duarte"
|
|
556
|
+
className="col-span-3"
|
|
557
|
+
/>
|
|
558
|
+
</div>
|
|
559
|
+
<div className="grid grid-cols-4 items-center gap-4">
|
|
560
|
+
<Label htmlFor="username" className="text-right">
|
|
561
|
+
Username
|
|
562
|
+
</Label>
|
|
563
|
+
<Input
|
|
564
|
+
id="username"
|
|
565
|
+
defaultValue="@peduarte"
|
|
566
|
+
className="col-span-3"
|
|
567
|
+
/>
|
|
568
|
+
</div>
|
|
569
|
+
</div>
|
|
570
|
+
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
571
|
+
<Button type="submit" size={globalSize}>
|
|
572
|
+
Lưu thay đổi
|
|
573
|
+
</Button>
|
|
574
|
+
</DialogFooter>
|
|
575
|
+
<DialogClose
|
|
576
|
+
render={
|
|
577
|
+
<Button
|
|
578
|
+
variant="ghost"
|
|
579
|
+
className="absolute top-2 right-2"
|
|
580
|
+
size="sm"
|
|
581
|
+
iconOnly
|
|
582
|
+
/>
|
|
583
|
+
}
|
|
584
|
+
>
|
|
585
|
+
<XIcon />
|
|
586
|
+
<span className="sr-only">Close</span>
|
|
587
|
+
</DialogClose>
|
|
588
|
+
</DialogContent>
|
|
589
|
+
|
|
590
|
+
</Dialog>
|
|
591
|
+
</>
|
|
592
|
+
} />
|
|
615
593
|
</ExampleGrid>
|
|
616
594
|
|
|
617
595
|
<ExampleGrid>
|
|
618
|
-
<
|
|
619
|
-
label="No Close Button"
|
|
620
|
-
description="Không render nút XIcon thủ công."
|
|
621
|
-
codeString={`<Dialog>
|
|
596
|
+
<ShowcaseExample title="No Close Button" description="Không render nút XIcon thủ công." code={`<Dialog>
|
|
622
597
|
<DialogTrigger
|
|
623
598
|
render={<Button variant="outline">View Terms</Button>}
|
|
624
599
|
/>
|
|
625
600
|
|
|
626
601
|
<DialogContent className={contentClass}>
|
|
627
602
|
<DialogHeader>
|
|
628
|
-
<DialogTitle
|
|
603
|
+
<DialogTitle>Điều khoản Dịch vụ</DialogTitle>
|
|
629
604
|
<DialogDescription>
|
|
630
605
|
You must accept the new terms to continue using
|
|
631
606
|
the application.
|
|
632
607
|
</DialogDescription>
|
|
633
608
|
</DialogHeader>
|
|
634
609
|
<p className="text-sm text-muted-foreground">
|
|
635
|
-
|
|
636
|
-
of
|
|
610
|
+
Bằng cách chọn chấp nhận, bạn đồng ý với Điều khoản
|
|
611
|
+
of Dịch vụ và Chính sách bảo mật.
|
|
637
612
|
</p>
|
|
638
613
|
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
639
614
|
<DialogClose
|
|
@@ -645,46 +620,44 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
645
620
|
</DialogFooter>
|
|
646
621
|
</DialogContent>
|
|
647
622
|
|
|
648
|
-
</Dialog>`}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
623
|
+
</Dialog>`} preview={
|
|
624
|
+
<>
|
|
625
|
+
<Dialog>
|
|
626
|
+
<DialogTrigger
|
|
627
|
+
render={
|
|
628
|
+
<Button variant="outline" size={globalSize}>
|
|
629
|
+
View Terms
|
|
630
|
+
</Button>
|
|
631
|
+
}
|
|
632
|
+
/>
|
|
658
633
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
634
|
+
<DialogContent className={contentClass}>
|
|
635
|
+
<DialogHeader>
|
|
636
|
+
<DialogTitle>Điều khoản Dịch vụ</DialogTitle>
|
|
637
|
+
<DialogDescription>
|
|
638
|
+
You must accept the new terms to continue using the
|
|
639
|
+
application.
|
|
640
|
+
</DialogDescription>
|
|
641
|
+
</DialogHeader>
|
|
642
|
+
<p className="text-sm text-muted-foreground">
|
|
643
|
+
Bằng cách chọn chấp nhận, bạn đồng ý với Điều khoản của Service
|
|
644
|
+
and Privacy Policy.
|
|
645
|
+
</p>
|
|
646
|
+
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
647
|
+
<DialogClose
|
|
648
|
+
render={<Button variant="outline" size={globalSize} />}
|
|
649
|
+
>
|
|
650
|
+
Decline
|
|
651
|
+
</DialogClose>
|
|
652
|
+
<Button size={globalSize}>Accept</Button>
|
|
653
|
+
</DialogFooter>
|
|
654
|
+
</DialogContent>
|
|
655
|
+
|
|
656
|
+
</Dialog>
|
|
657
|
+
</>
|
|
658
|
+
} />
|
|
683
659
|
|
|
684
|
-
<
|
|
685
|
-
label="Large Content Sizing"
|
|
686
|
-
description="Sử dụng sm:max-w-lg cho nội dung lớn hơn."
|
|
687
|
-
codeString={`<Dialog>
|
|
660
|
+
<ShowcaseExample title="Large Content Sizing" description="Sử dụng sm:max-w-lg cho nội dung lớn hơn." code={`<Dialog>
|
|
688
661
|
<DialogTrigger
|
|
689
662
|
render={
|
|
690
663
|
<Button variant="outline">View Report</Button>
|
|
@@ -693,9 +666,9 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
693
666
|
|
|
694
667
|
<DialogContent className={contentClass}>
|
|
695
668
|
<DialogHeader>
|
|
696
|
-
<DialogTitle>
|
|
669
|
+
<DialogTitle>Báo cáo chi tiết</DialogTitle>
|
|
697
670
|
<DialogDescription>
|
|
698
|
-
|
|
671
|
+
Phân tích hàng tháng và tổng quan hiệu suất.
|
|
699
672
|
</DialogDescription>
|
|
700
673
|
</DialogHeader>
|
|
701
674
|
<div className="flex h-[200px] items-center justify-center rounded-md border border-border border-dashed bg-muted/20">
|
|
@@ -721,56 +694,54 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
721
694
|
</DialogClose>
|
|
722
695
|
</DialogContent>
|
|
723
696
|
|
|
724
|
-
</Dialog>`}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
697
|
+
</Dialog>`} preview={
|
|
698
|
+
<>
|
|
699
|
+
<Dialog>
|
|
700
|
+
<DialogTrigger
|
|
701
|
+
render={
|
|
702
|
+
<Button variant="outline" size={globalSize}>
|
|
703
|
+
View Report
|
|
704
|
+
</Button>
|
|
705
|
+
}
|
|
706
|
+
/>
|
|
734
707
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
708
|
+
<DialogContent className={contentClass}>
|
|
709
|
+
<DialogHeader>
|
|
710
|
+
<DialogTitle>Báo cáo chi tiết</DialogTitle>
|
|
711
|
+
<DialogDescription>
|
|
712
|
+
Phân tích hàng tháng và tổng quan hiệu suất.
|
|
713
|
+
</DialogDescription>
|
|
714
|
+
</DialogHeader>
|
|
715
|
+
<div className="flex h-[200px] items-center justify-center rounded-md border border-border border-dashed bg-muted/20">
|
|
716
|
+
<span className="text-sm text-muted-foreground">
|
|
717
|
+
Large Content Area
|
|
718
|
+
</span>
|
|
719
|
+
</div>
|
|
720
|
+
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
721
|
+
<Button size={globalSize}>Download PDF</Button>
|
|
722
|
+
</DialogFooter>
|
|
723
|
+
<DialogClose
|
|
724
|
+
render={
|
|
725
|
+
<Button
|
|
726
|
+
variant="ghost"
|
|
727
|
+
className="absolute top-2 right-2"
|
|
728
|
+
size="sm"
|
|
729
|
+
iconOnly
|
|
730
|
+
/>
|
|
731
|
+
}
|
|
732
|
+
>
|
|
733
|
+
<XIcon />
|
|
734
|
+
<span className="sr-only">Close</span>
|
|
735
|
+
</DialogClose>
|
|
736
|
+
</DialogContent>
|
|
737
|
+
|
|
738
|
+
</Dialog>
|
|
739
|
+
</>
|
|
740
|
+
} />
|
|
767
741
|
</ExampleGrid>
|
|
768
742
|
|
|
769
743
|
<ExampleGrid>
|
|
770
|
-
<
|
|
771
|
-
label="Controlled State"
|
|
772
|
-
description="Sử dụng open và onOpenChange để quản lý trạng thái đóng mở bằng React state."
|
|
773
|
-
codeString={`<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
744
|
+
<ShowcaseExample title="Controlled State" description="Sử dụng open và onOpenChange để quản lý trạng thái đóng mở bằng React state." code={`<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
774
745
|
<div className="flex gap-4 items-center">
|
|
775
746
|
<Button
|
|
776
747
|
onClick={() => setControlledOpen(true)}
|
|
@@ -823,67 +794,65 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
823
794
|
</DialogContent>
|
|
824
795
|
|
|
825
796
|
</Dialog>
|
|
826
|
-
</div>`}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
797
|
+
</div>`} preview={
|
|
798
|
+
<>
|
|
799
|
+
<div className="w-full flex flex-col gap-4 items-center justify-center">
|
|
800
|
+
<div className="flex gap-4 items-center">
|
|
801
|
+
<Button
|
|
802
|
+
onClick={() => setControlledOpen(true)}
|
|
803
|
+
variant="outline"
|
|
804
|
+
size={globalSize}
|
|
805
|
+
>
|
|
806
|
+
Open Controlled Dialog
|
|
807
|
+
</Button>
|
|
808
|
+
<span className="text-sm text-muted-foreground font-mono">
|
|
809
|
+
State: {controlledOpen ? "true" : "false"}
|
|
810
|
+
</span>
|
|
811
|
+
</div>
|
|
841
812
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
813
|
+
<Dialog open={controlledOpen} onOpenChange={setControlledOpen}>
|
|
814
|
+
|
|
815
|
+
<DialogContent className={contentClass}>
|
|
816
|
+
<DialogHeader>
|
|
817
|
+
<DialogTitle>Controlled Dialog</DialogTitle>
|
|
818
|
+
<DialogDescription>
|
|
819
|
+
Trạng thái của dialog này được quản lý hoàn toàn bởi React
|
|
820
|
+
state bên ngoài.
|
|
821
|
+
</DialogDescription>
|
|
822
|
+
</DialogHeader>
|
|
823
|
+
<p className="text-sm text-foreground">
|
|
824
|
+
Bạn có thể đóng bằng nút bên dưới hoặc dấu X.
|
|
825
|
+
</p>
|
|
826
|
+
<DialogFooter className="-mx-4 -mb-4 mt-4 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
827
|
+
<Button
|
|
828
|
+
color="primary"
|
|
829
|
+
onClick={() => setControlledOpen(false)}
|
|
830
|
+
size={globalSize}
|
|
831
|
+
>
|
|
832
|
+
Close Manually
|
|
833
|
+
</Button>
|
|
834
|
+
</DialogFooter>
|
|
835
|
+
<DialogClose
|
|
836
|
+
render={
|
|
837
|
+
<Button
|
|
838
|
+
variant="ghost"
|
|
839
|
+
className="absolute top-2 right-2"
|
|
840
|
+
size="sm"
|
|
841
|
+
iconOnly
|
|
842
|
+
/>
|
|
843
|
+
}
|
|
844
|
+
>
|
|
845
|
+
<XIcon />
|
|
846
|
+
<span className="sr-only">Close</span>
|
|
847
|
+
</DialogClose>
|
|
848
|
+
</DialogContent>
|
|
849
|
+
|
|
850
|
+
</Dialog>
|
|
851
|
+
</div>
|
|
852
|
+
</>
|
|
853
|
+
} />
|
|
882
854
|
|
|
883
|
-
<
|
|
884
|
-
label="Sticky Footer (Long Content)"
|
|
885
|
-
description="Ghi đè class của DialogContent thành flex-col để khóa scroll ở phần body."
|
|
886
|
-
codeString={`<Dialog>
|
|
855
|
+
<ShowcaseExample title="Sticky Footer (Long Content)" description="Ghi đè class của DialogContent thành flex-col để khóa scroll ở phần body." code={`<Dialog>
|
|
887
856
|
<DialogTrigger
|
|
888
857
|
render={
|
|
889
858
|
<Button variant="outline">View Long Content</Button>
|
|
@@ -897,7 +866,7 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
897
866
|
)}
|
|
898
867
|
>
|
|
899
868
|
<DialogHeader className="shrink-0 p-4 pb-0">
|
|
900
|
-
<DialogTitle
|
|
869
|
+
<DialogTitle>Điều khoản & Điều kiện</DialogTitle>
|
|
901
870
|
<DialogDescription>
|
|
902
871
|
Cuộn xuống dưới cùng để có thể đồng ý với điều
|
|
903
872
|
khoản.
|
|
@@ -923,7 +892,7 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
923
892
|
<DialogClose render={<Button variant="ghost" />}>
|
|
924
893
|
Cancel
|
|
925
894
|
</DialogClose>
|
|
926
|
-
<Button>
|
|
895
|
+
<Button>Tôi đồng ý</Button>
|
|
927
896
|
</DialogFooter>
|
|
928
897
|
<DialogClose
|
|
929
898
|
render={
|
|
@@ -940,77 +909,73 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
940
909
|
</DialogClose>
|
|
941
910
|
</DialogContent>
|
|
942
911
|
|
|
943
|
-
</Dialog>`}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
912
|
+
</Dialog>`} preview={
|
|
913
|
+
<>
|
|
914
|
+
<Dialog>
|
|
915
|
+
<DialogTrigger
|
|
916
|
+
render={
|
|
917
|
+
<Button variant="outline" size={globalSize}>
|
|
918
|
+
View Long Content
|
|
919
|
+
</Button>
|
|
920
|
+
}
|
|
921
|
+
/>
|
|
953
922
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
923
|
+
<DialogContent
|
|
924
|
+
className={cn(
|
|
925
|
+
contentClass,
|
|
926
|
+
"flex flex-col gap-0 p-0 overflow-hidden",
|
|
927
|
+
)}
|
|
928
|
+
>
|
|
929
|
+
<DialogHeader className="shrink-0 p-4 pb-0">
|
|
930
|
+
<DialogTitle>Điều khoản & Điều kiện</DialogTitle>
|
|
931
|
+
<DialogDescription>
|
|
932
|
+
Cuộn xuống dưới cùng để có thể đồng ý với điều khoản.
|
|
933
|
+
</DialogDescription>
|
|
934
|
+
</DialogHeader>
|
|
935
|
+
<div className="flex-1 min-h-0 overflow-y-auto p-4">
|
|
936
|
+
<div className="flex h-[800px] flex-col items-center justify-between rounded-md border border-border border-dashed bg-muted/20 py-8">
|
|
937
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
938
|
+
START OF CONTENT
|
|
939
|
+
</span>
|
|
940
|
+
<div className="flex flex-col items-center gap-2">
|
|
941
|
+
<span className="text-4xl">👇</span>
|
|
942
|
+
<span className="text-sm text-muted-foreground">
|
|
943
|
+
Keep scrolling
|
|
944
|
+
</span>
|
|
945
|
+
</div>
|
|
946
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
947
|
+
END OF CONTENT
|
|
948
|
+
</span>
|
|
949
|
+
</div>
|
|
950
|
+
</div>
|
|
951
|
+
<DialogFooter className="shrink-0 rounded-b-xl border-t border-t-border bg-muted/50 p-4">
|
|
952
|
+
<DialogClose
|
|
953
|
+
render={<Button variant="ghost" size={globalSize} />}
|
|
954
|
+
>
|
|
955
|
+
Cancel
|
|
956
|
+
</DialogClose>
|
|
957
|
+
<Button size={globalSize}>Tôi đồng ý</Button>
|
|
958
|
+
</DialogFooter>
|
|
959
|
+
<DialogClose
|
|
960
|
+
render={
|
|
961
|
+
<Button
|
|
962
|
+
variant="ghost"
|
|
963
|
+
className="absolute top-2 right-2"
|
|
964
|
+
size="sm"
|
|
965
|
+
iconOnly
|
|
966
|
+
/>
|
|
967
|
+
}
|
|
968
|
+
>
|
|
969
|
+
<XIcon />
|
|
970
|
+
<span className="sr-only">Close</span>
|
|
971
|
+
</DialogClose>
|
|
972
|
+
</DialogContent>
|
|
973
|
+
|
|
974
|
+
</Dialog>
|
|
975
|
+
</>
|
|
976
|
+
} />
|
|
1007
977
|
|
|
1008
|
-
|
|
1009
|
-
<ExampleSection
|
|
1010
|
-
label="🧭 Use Case Comparison"
|
|
1011
|
-
description="Các kịch bản thực tế giúp bạn quyết định nên dùng Micro hay Macro."
|
|
1012
|
-
fullWidth
|
|
1013
|
-
codeString={`<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
978
|
+
<ShowcaseExample title="🧭 So sánh Use Case" description="Các kịch bản thực tế giúp bạn quyết định nên dùng Micro hay Macro." code={`<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
1014
979
|
{/* ── Story 1: Macro wins ── */}
|
|
1015
980
|
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
1016
981
|
<div className="flex items-start gap-3">
|
|
@@ -1061,77 +1026,67 @@ function DialogMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
1061
1026
|
từng phần.
|
|
1062
1027
|
</p>
|
|
1063
1028
|
</div>
|
|
1064
|
-
</div>`}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
</div>
|
|
1029
|
+
</div>`} preview={
|
|
1030
|
+
<>
|
|
1031
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
1032
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
1033
|
+
<div className="flex items-start gap-3">
|
|
1034
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-green-500/10 p-1.5 text-green-600">
|
|
1035
|
+
<CheckCircle2Icon className="size-4" aria-hidden="true" />
|
|
1036
|
+
</span>
|
|
1037
|
+
<div>
|
|
1038
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
1039
|
+
Story 1 · Dùng Macro
|
|
1040
|
+
</p>
|
|
1041
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
1042
|
+
Cảnh báo hoặc Form cơ bản
|
|
1043
|
+
</h3>
|
|
1044
|
+
</div>
|
|
1045
|
+
</div>
|
|
1046
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
1047
|
+
Khi bạn chỉ cần một tiêu đề, mô tả và vài nút bấm ở footer (hoặc
|
|
1048
|
+
1 form ngắn), Macro giúp bạn không phải khai báo hàng loạt
|
|
1049
|
+
component con.
|
|
1050
|
+
</p>
|
|
1051
|
+
</div>
|
|
1088
1052
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1053
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
1054
|
+
<div className="flex items-start gap-3">
|
|
1055
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-blue-500/10 p-1.5 text-blue-600">
|
|
1056
|
+
<LayersIcon className="size-4" aria-hidden="true" />
|
|
1057
|
+
</span>
|
|
1058
|
+
<div>
|
|
1059
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
1060
|
+
Story 2 · Dùng Micro
|
|
1061
|
+
</p>
|
|
1062
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
1063
|
+
Layout tuỳ chỉnh phức tạp
|
|
1064
|
+
</h3>
|
|
1065
|
+
</div>
|
|
1066
|
+
</div>
|
|
1067
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
1068
|
+
Khi bạn muốn Header có hình ảnh/icon đặc biệt, bỏ qua Footer
|
|
1069
|
+
chuẩn, hoặc có layout split-pane phức tạp bên trong Dialog.
|
|
1070
|
+
Micro cho phép bạn tự do thay đổi từng phần.
|
|
1071
|
+
</p>
|
|
1072
|
+
</div>
|
|
1073
|
+
</div>
|
|
1074
|
+
</>
|
|
1075
|
+
} />
|
|
1112
1076
|
</ExampleGrid>
|
|
1113
1077
|
</div>
|
|
1114
1078
|
);
|
|
1115
1079
|
}
|
|
1116
1080
|
|
|
1117
|
-
// ──────────────────────────────────────────────────────────
|
|
1118
|
-
// Main Showcase
|
|
1119
|
-
// ──────────────────────────────────────────────────────────
|
|
1120
1081
|
export default function DialogShowcase() {
|
|
1121
1082
|
const { size: globalSize } = useDevContext();
|
|
1122
1083
|
return (
|
|
1123
1084
|
<Showcase
|
|
1124
1085
|
title="Dialog"
|
|
1125
1086
|
description="Một cửa sổ phương thức làm gián đoạn người dùng với nội dung quan trọng và mong đợi phản hồi."
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
content: <DialogMicroShowcase globalSize={globalSize} /> },
|
|
1130
|
-
{
|
|
1131
|
-
label: "Macro (Preset)",
|
|
1132
|
-
content: <DialogMacroShowcase globalSize={globalSize} /> },
|
|
1133
|
-
]}
|
|
1134
|
-
generalConcept={
|
|
1087
|
+
micro={{ content: <DialogMicroShowcase globalSize={globalSize} /> }}
|
|
1088
|
+
macro={{ content: <DialogMacroShowcase globalSize={globalSize} /> }}
|
|
1089
|
+
guideline={
|
|
1135
1090
|
<ShowcaseDocs>
|
|
1136
1091
|
<DocsH3>Cấu trúc và Định tuyến</DocsH3>
|
|
1137
1092
|
<DocsP>
|