gladvn 0.2.16 → 0.2.18
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- 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 +47 -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 +5 -4
- 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 +1 -1
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
DocsCode,
|
|
4
|
-
DocsLi,
|
|
5
|
-
DocsP,
|
|
6
|
-
DocsUl,
|
|
7
|
-
ExampleGrid,
|
|
8
|
-
ExampleSection,
|
|
9
|
-
Showcase,
|
|
10
|
-
ShowcaseDocs,
|
|
11
|
-
} from "../../dev/components/showcase";
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
12
3
|
import {
|
|
13
4
|
CheckCircle2Icon,
|
|
14
5
|
InfoIcon,
|
|
@@ -16,7 +7,6 @@ import {
|
|
|
16
7
|
XCircleIcon,
|
|
17
8
|
XIcon,
|
|
18
9
|
} from "lucide-react";
|
|
19
|
-
import { useState } from "react";
|
|
20
10
|
|
|
21
11
|
import { AlertPreset } from "../../components/macro/alert-preset";
|
|
22
12
|
import {
|
|
@@ -27,6 +17,17 @@ import {
|
|
|
27
17
|
AlertTitle,
|
|
28
18
|
} from "../../components/micro/alert";
|
|
29
19
|
import { Button } from "../../components/micro/button";
|
|
20
|
+
import { useDevContext } from "../../dev/components/dev-context";
|
|
21
|
+
import {
|
|
22
|
+
DocsCode,
|
|
23
|
+
DocsLi,
|
|
24
|
+
DocsP,
|
|
25
|
+
DocsUl,
|
|
26
|
+
ExampleGrid,
|
|
27
|
+
ExampleSection,
|
|
28
|
+
Showcase,
|
|
29
|
+
ShowcaseDocs,
|
|
30
|
+
} from "../../dev/components/showcase";
|
|
30
31
|
import { type Size } from "../../lib/types";
|
|
31
32
|
|
|
32
33
|
// ──────────────────────────────────────────────────────────
|
|
@@ -41,20 +42,21 @@ function AlertMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
41
42
|
label="Controlled vs Uncontrolled"
|
|
42
43
|
fullWidth
|
|
43
44
|
codeString={`<div className="space-y-4 px-2 py-4">
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
<DocsUl>
|
|
46
|
+
<DocsLi>
|
|
47
|
+
<b>Uncontrolled (Mặc định):</b> Nếu truyền{" "}
|
|
48
|
+
<DocsCode>dismissible=true</DocsCode>, component tự
|
|
49
|
+
quản lý state để tắt (ẩn) Alert khi click vào nút X.
|
|
50
|
+
</DocsLi>
|
|
51
|
+
<DocsLi>
|
|
52
|
+
<b>Controlled:</b> Có thể kiểm soát state đóng/mở
|
|
53
|
+
thông qua React state và truyền hàm vào{" "}
|
|
54
|
+
<DocsCode>onDismiss</DocsCode>. Tuy nhiên thông
|
|
55
|
+
thường Alert chỉ bị huỷ (unmount), nên nếu bạn kiểm
|
|
56
|
+
soát thì hãy render nó có điều kiện bên ngoài.
|
|
57
|
+
</DocsLi>
|
|
58
|
+
</DocsUl>
|
|
59
|
+
</div>`}
|
|
58
60
|
>
|
|
59
61
|
<div className="space-y-4 px-2 py-4">
|
|
60
62
|
<DocsUl>
|
|
@@ -79,12 +81,11 @@ function AlertMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
79
81
|
description="Truyền props trực tiếp thay vì lồng children."
|
|
80
82
|
fullWidth
|
|
81
83
|
codeString={`<AlertPreset
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`}
|
|
84
|
+
color="info"
|
|
85
|
+
title="Có bản cập nhật mới"
|
|
86
|
+
description="Phiên bản 2.0.4 đã sẵn sàng để tải xuống."
|
|
87
|
+
icon={<InfoIcon />}
|
|
88
|
+
/>`}
|
|
88
89
|
>
|
|
89
90
|
<AlertPreset
|
|
90
91
|
color="info"
|
|
@@ -100,13 +101,12 @@ function AlertMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
100
101
|
description="Thêm dismissible=true để hiển thị nút [X]. Thử bấm vào nút X bên dưới."
|
|
101
102
|
fullWidth
|
|
102
103
|
codeString={`<AlertPreset
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`}
|
|
104
|
+
color="warning"
|
|
105
|
+
title="Phiên bản sắp hết hạn"
|
|
106
|
+
description="Phiên đăng nhập của bạn sẽ hết hạn trong 5 phút."
|
|
107
|
+
icon={<TriangleAlertIcon />}
|
|
108
|
+
dismissible
|
|
109
|
+
/>`}
|
|
110
110
|
>
|
|
111
111
|
<AlertPreset
|
|
112
112
|
color="warning"
|
|
@@ -182,27 +182,26 @@ return (
|
|
|
182
182
|
label="Nội Dung Phức Tạp (Complex Content)"
|
|
183
183
|
description="Có thể truyền ReactNode hoặc thay thế toàn bộ bằng thẻ children."
|
|
184
184
|
codeString={`<div className="flex w-full flex-col gap-4 max-w-xl">
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</div
|
|
205
|
-
`}
|
|
185
|
+
<AlertPreset
|
|
186
|
+
color="success"
|
|
187
|
+
title="Thanh toán thành công"
|
|
188
|
+
icon={<CheckCircle2Icon />}
|
|
189
|
+
dismissible
|
|
190
|
+
action={
|
|
191
|
+
<Button
|
|
192
|
+
size="sm"
|
|
193
|
+
variant="outline"
|
|
194
|
+
className="h-7 px-2 text-xs"
|
|
195
|
+
>
|
|
196
|
+
Xem biên lai
|
|
197
|
+
</Button>
|
|
198
|
+
}
|
|
199
|
+
>
|
|
200
|
+
<p className="text-sm mt-1 text-success/90">
|
|
201
|
+
Hoá đơn #1234 của bạn đã được thanh toán hoàn tất.
|
|
202
|
+
</p>
|
|
203
|
+
</AlertPreset>
|
|
204
|
+
</div>`}
|
|
206
205
|
>
|
|
207
206
|
<div className="flex w-full flex-col gap-4 max-w-xl">
|
|
208
207
|
<AlertPreset
|
|
@@ -244,57 +243,59 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
244
243
|
description="Mỗi màu sắc truyền đạt một mức độ khẩn cấp hoặc ý nghĩa khác nhau."
|
|
245
244
|
fullWidth
|
|
246
245
|
codeString={`<Alert color="info" className="flex items-start">
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
246
|
+
<AlertIcon
|
|
247
|
+
render={<InfoIcon />}
|
|
248
|
+
className="mt-0.5 shrink-0"
|
|
249
|
+
/>
|
|
250
|
+
<div className="flex-1 space-y-0.5">
|
|
251
|
+
<AlertTitle>Có bản cập nhật mới</AlertTitle>
|
|
252
|
+
<AlertDescription>
|
|
253
|
+
Phiên bản 2.0.4 đã sẵn sàng để tải xuống. Hãy cập
|
|
254
|
+
nhật để trải nghiệm tính năng mới.
|
|
255
|
+
</AlertDescription>
|
|
256
|
+
</div>
|
|
257
|
+
</Alert>
|
|
258
|
+
|
|
259
|
+
<Alert color="success" className="flex items-start">
|
|
260
|
+
<AlertIcon
|
|
261
|
+
render={<CheckCircle2Icon />}
|
|
262
|
+
className="mt-0.5 shrink-0"
|
|
263
|
+
/>
|
|
264
|
+
<div className="flex-1 space-y-0.5">
|
|
265
|
+
<AlertTitle>Đã lưu thành công</AlertTitle>
|
|
266
|
+
<AlertDescription>
|
|
267
|
+
Các thay đổi của bạn đã được đồng bộ lên đám mây.
|
|
268
|
+
</AlertDescription>
|
|
269
|
+
</div>
|
|
270
|
+
</Alert>
|
|
271
|
+
|
|
272
|
+
<Alert color="warning" className="flex items-start">
|
|
273
|
+
<AlertIcon
|
|
274
|
+
render={<TriangleAlertIcon />}
|
|
275
|
+
className="mt-0.5 shrink-0"
|
|
276
|
+
/>
|
|
277
|
+
<div className="flex-1 space-y-0.5">
|
|
278
|
+
<AlertTitle>Phiên bản sắp hết hạn</AlertTitle>
|
|
279
|
+
<AlertDescription>
|
|
280
|
+
Phiên đăng nhập của bạn sẽ hết hạn trong 5 phút nữa.
|
|
281
|
+
Vui lòng lưu lại công việc.
|
|
282
|
+
</AlertDescription>
|
|
283
|
+
</div>
|
|
284
|
+
</Alert>
|
|
285
|
+
|
|
286
|
+
<Alert color="destructive" className="flex items-start">
|
|
287
|
+
<AlertIcon
|
|
288
|
+
render={<XCircleIcon />}
|
|
289
|
+
className="mt-0.5 shrink-0"
|
|
290
|
+
/>
|
|
291
|
+
<div className="flex-1 space-y-0.5">
|
|
292
|
+
<AlertTitle>Kết nối thất bại</AlertTitle>
|
|
293
|
+
<AlertDescription>
|
|
294
|
+
Không thể kết nối đến cơ sở dữ liệu. Vui lòng kiểm
|
|
295
|
+
tra lại đường truyền mạng.
|
|
296
|
+
</AlertDescription>
|
|
297
|
+
</div>
|
|
298
|
+
</Alert>`}
|
|
298
299
|
>
|
|
299
300
|
<Alert color="info" size={globalSize} className="flex items-start">
|
|
300
301
|
<AlertIcon render={<InfoIcon />} className="mt-0.5 shrink-0" />
|
|
@@ -357,15 +358,18 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
357
358
|
description="Hiển thị Alert với màu sắc mặc định (info)."
|
|
358
359
|
fullWidth
|
|
359
360
|
codeString={`<Alert className="flex items-start">
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
361
|
+
<AlertIcon
|
|
362
|
+
render={<InfoIcon />}
|
|
363
|
+
className="mt-0.5 shrink-0"
|
|
364
|
+
/>
|
|
365
|
+
<div className="flex-1 space-y-0.5">
|
|
366
|
+
<AlertTitle>Chú ý!</AlertTitle>
|
|
367
|
+
<AlertDescription>
|
|
368
|
+
Bạn có thể thêm các component vào dự án bằng cách sử
|
|
369
|
+
dụng CLI.
|
|
370
|
+
</AlertDescription>
|
|
371
|
+
</div>
|
|
372
|
+
</Alert>`}
|
|
369
373
|
>
|
|
370
374
|
<Alert size={globalSize} className="flex items-start">
|
|
371
375
|
<AlertIcon render={<InfoIcon />} className="mt-0.5 shrink-0" />
|
|
@@ -383,29 +387,28 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
383
387
|
label="Có Nút Hành Động (With Action)"
|
|
384
388
|
description="Alert kèm theo một nút tắt (dismiss) được đặt ở góc trên bên phải."
|
|
385
389
|
fullWidth
|
|
386
|
-
codeString={`<Alert
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
</Alert
|
|
408
|
-
`}
|
|
390
|
+
codeString={`<Alert color="info" className="flex items-start relative">
|
|
391
|
+
<AlertIcon
|
|
392
|
+
render={<InfoIcon />}
|
|
393
|
+
className="mt-0.5 shrink-0"
|
|
394
|
+
/>
|
|
395
|
+
<div className="flex-1 space-y-0.5 pr-8">
|
|
396
|
+
<AlertTitle>Tính năng mới</AlertTitle>
|
|
397
|
+
<AlertDescription>
|
|
398
|
+
Hãy khám phá trang thống kê dashboard hoàn toàn mới
|
|
399
|
+
của chúng tôi.
|
|
400
|
+
</AlertDescription>
|
|
401
|
+
</div>
|
|
402
|
+
<AlertAction className="absolute right-1 top-1">
|
|
403
|
+
<Button
|
|
404
|
+
variant="ghost"
|
|
405
|
+
size="sm"
|
|
406
|
+
className="size-6 p-0 group-data-[size=sm]/alert:size-5 group-data-[size=lg]/alert:size-7"
|
|
407
|
+
>
|
|
408
|
+
<XIcon className="size-3.5 group-data-[size=sm]/alert:size-3 group-data-[size=lg]/alert:size-4" />
|
|
409
|
+
</Button>
|
|
410
|
+
</AlertAction>
|
|
411
|
+
</Alert>`}
|
|
409
412
|
>
|
|
410
413
|
<Alert
|
|
411
414
|
color="info"
|
|
@@ -440,21 +443,24 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
440
443
|
description="Alert chỉ có nội dung mô tả, không có tiêu đề."
|
|
441
444
|
fullWidth
|
|
442
445
|
codeString={`<Alert color="info" className="flex items-start">
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
446
|
+
<AlertIcon
|
|
447
|
+
render={<InfoIcon />}
|
|
448
|
+
className="mt-0.5 shrink-0"
|
|
449
|
+
/>
|
|
450
|
+
<AlertDescription className="flex-1">
|
|
451
|
+
Bạn có thể thêm các component vào dự án bằng cách sử
|
|
452
|
+
dụng CLI.
|
|
453
|
+
</AlertDescription>
|
|
454
|
+
</Alert>
|
|
455
|
+
<Alert color="warning" className="flex items-start">
|
|
456
|
+
<AlertIcon
|
|
457
|
+
render={<TriangleAlertIcon />}
|
|
458
|
+
className="mt-0.5 shrink-0"
|
|
459
|
+
/>
|
|
460
|
+
<AlertDescription className="flex-1">
|
|
461
|
+
Bản dùng thử của bạn sẽ hết hạn trong 3 ngày nữa.
|
|
462
|
+
</AlertDescription>
|
|
463
|
+
</Alert>`}
|
|
458
464
|
>
|
|
459
465
|
<Alert color="info" size={globalSize} className="flex items-start">
|
|
460
466
|
<AlertIcon render={<InfoIcon />} className="mt-0.5 shrink-0" />
|
|
@@ -478,25 +484,22 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
478
484
|
label="Chỉ Có Chữ (Text Only)"
|
|
479
485
|
description="Alert đơn giản không có icon — layout tự nhiên."
|
|
480
486
|
fullWidth
|
|
481
|
-
codeString={`<Alert
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
</AlertDescription>
|
|
498
|
-
</Alert>
|
|
499
|
-
`}
|
|
487
|
+
codeString={`<Alert color="success" className="flex flex-col gap-0.5">
|
|
488
|
+
<AlertTitle>Thanh toán thành công</AlertTitle>
|
|
489
|
+
<AlertDescription>
|
|
490
|
+
Hoá đơn #1234 của bạn đã được thanh toán hoàn tất.
|
|
491
|
+
</AlertDescription>
|
|
492
|
+
</Alert>
|
|
493
|
+
<Alert
|
|
494
|
+
color="destructive"
|
|
495
|
+
className="flex flex-col gap-0.5"
|
|
496
|
+
>
|
|
497
|
+
<AlertTitle>Tài khoản bị khoá</AlertTitle>
|
|
498
|
+
<AlertDescription>
|
|
499
|
+
Vui lòng liên hệ với bộ phận hỗ trợ để mở khoá tài
|
|
500
|
+
khoản.
|
|
501
|
+
</AlertDescription>
|
|
502
|
+
</Alert>`}
|
|
500
503
|
>
|
|
501
504
|
<Alert
|
|
502
505
|
color="success"
|
|
@@ -526,101 +529,111 @@ function AlertMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
526
529
|
description="Các kịch bản thực tế giúp bạn quyết định nên dùng Micro hay Macro."
|
|
527
530
|
fullWidth
|
|
528
531
|
codeString={`<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
532
|
+
{/* ── Story 1: Macro wins ── */}
|
|
533
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
534
|
+
<div className="flex items-start gap-3">
|
|
535
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-green-500/10 p-1.5 text-green-600">
|
|
536
|
+
<CheckCircle2Icon
|
|
537
|
+
className="size-4"
|
|
538
|
+
aria-hidden="true"
|
|
539
|
+
/>
|
|
540
|
+
</span>
|
|
541
|
+
<div>
|
|
542
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
543
|
+
Story 1 · Dùng Macro
|
|
544
|
+
</p>
|
|
545
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
546
|
+
Thông báo chuẩn, cho phép tự đóng
|
|
547
|
+
</h3>
|
|
548
|
+
</div>
|
|
542
549
|
</div>
|
|
543
|
-
</div>
|
|
544
550
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
552
|
+
Phần lớn các cảnh báo trong ứng dụng đều đi kèm
|
|
553
|
+
Icon, Tiêu đề, Nội dung, và nút X để tự tắt
|
|
554
|
+
(Dismiss). Dùng Macro sẽ tiết kiệm cực kỳ nhiều
|
|
555
|
+
code.
|
|
556
|
+
</p>
|
|
550
557
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
<div className="rounded-lg bg-muted/50 p-3">
|
|
559
|
+
<AlertPreset
|
|
560
|
+
color="info"
|
|
561
|
+
size="sm"
|
|
562
|
+
title="Có bản cập nhật mới"
|
|
563
|
+
description="Phiên bản 2.0.4 đã sẵn sàng để tải xuống."
|
|
564
|
+
icon={<InfoIcon />}
|
|
565
|
+
dismissible
|
|
566
|
+
/>
|
|
567
|
+
</div>
|
|
561
568
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
</div>
|
|
570
|
-
|
|
571
|
-
{/* ── Story 2: Micro wins ── */}
|
|
572
|
-
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
573
|
-
<div className="flex items-start gap-3">
|
|
574
|
-
<span className="mt-0.5 shrink-0 rounded-full bg-blue-500/10 p-1.5 text-blue-600">
|
|
575
|
-
<CheckCircle2Icon className="size-4" aria-hidden="true" />
|
|
576
|
-
</span>
|
|
577
|
-
<div>
|
|
578
|
-
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
579
|
-
Story 2 · Dùng Micro
|
|
569
|
+
<div className="rounded-md border border-border border-green-500/20 bg-green-500/5 px-3 py-2">
|
|
570
|
+
<p className="text-xs font-medium text-green-700 dark:text-green-400">
|
|
571
|
+
✅ Dùng{" "}
|
|
572
|
+
<code className="font-mono">AlertPreset</code> —
|
|
573
|
+
Prop{" "}
|
|
574
|
+
<code className="font-mono">dismissible</code> tự
|
|
575
|
+
động xử lý state tắt Alert.
|
|
580
576
|
</p>
|
|
581
|
-
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
582
|
-
Giao diện Alert không theo chuẩn
|
|
583
|
-
</h3>
|
|
584
577
|
</div>
|
|
585
578
|
</div>
|
|
586
579
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
580
|
+
{/* ── Story 2: Micro wins ── */}
|
|
581
|
+
<div className="rounded-xl border border-border bg-card p-5 flex flex-col gap-4">
|
|
582
|
+
<div className="flex items-start gap-3">
|
|
583
|
+
<span className="mt-0.5 shrink-0 rounded-full bg-blue-500/10 p-1.5 text-blue-600">
|
|
584
|
+
<CheckCircle2Icon
|
|
585
|
+
className="size-4"
|
|
586
|
+
aria-hidden="true"
|
|
587
|
+
/>
|
|
588
|
+
</span>
|
|
589
|
+
<div>
|
|
590
|
+
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
|
591
|
+
Story 2 · Dùng Micro
|
|
592
|
+
</p>
|
|
593
|
+
<h3 className="mt-0.5 text-sm font-semibold text-foreground">
|
|
594
|
+
Giao diện Alert không theo chuẩn
|
|
595
|
+
</h3>
|
|
596
|
+
</div>
|
|
597
|
+
</div>
|
|
592
598
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
>
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
</AlertDescription>
|
|
603
|
-
<Button
|
|
604
|
-
variant="soft"
|
|
599
|
+
<p className="text-xs text-muted-foreground leading-relaxed">
|
|
600
|
+
Khi bạn cần tạo một Alert với layout đặc biệt, ví dụ
|
|
601
|
+
như không có icon, hoặc muốn chèn form vào giữa.
|
|
602
|
+
Macro sẽ bị hạn chế vì đã chốt sẵn layout Flexbox
|
|
603
|
+
ngang.
|
|
604
|
+
</p>
|
|
605
|
+
|
|
606
|
+
<div className="rounded-lg bg-muted/50 p-3">
|
|
607
|
+
<Alert
|
|
605
608
|
color="warning"
|
|
606
609
|
size="sm"
|
|
607
|
-
className="
|
|
610
|
+
className="flex flex-col gap-0.5"
|
|
608
611
|
>
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
612
|
+
<AlertTitle>Bản dùng thử hết hạn</AlertTitle>
|
|
613
|
+
<AlertDescription>
|
|
614
|
+
Chỉ còn 3 ngày nữa. Vui lòng thanh toán!
|
|
615
|
+
</AlertDescription>
|
|
616
|
+
<Button
|
|
617
|
+
variant="soft"
|
|
618
|
+
color="warning"
|
|
619
|
+
size="sm"
|
|
620
|
+
className="mt-2 w-fit"
|
|
621
|
+
>
|
|
622
|
+
Nâng Cấp Ngay
|
|
623
|
+
</Button>
|
|
624
|
+
</Alert>
|
|
625
|
+
</div>
|
|
613
626
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
627
|
+
<div className="rounded-md border border-border border-blue-500/20 bg-blue-500/5 px-3 py-2">
|
|
628
|
+
<p className="text-xs font-medium text-blue-700 dark:text-blue-400">
|
|
629
|
+
✅ Dùng <code className="font-mono">Alert</code>{" "}
|
|
630
|
+
(Micro) — Bạn tự viết class{" "}
|
|
631
|
+
<code className="font-mono">flex-col</code>, tự
|
|
632
|
+
chèn nội dung thoải mái.
|
|
633
|
+
</p>
|
|
634
|
+
</div>
|
|
620
635
|
</div>
|
|
621
|
-
</div
|
|
622
|
-
</div>
|
|
623
|
-
`}
|
|
636
|
+
</div>`}
|
|
624
637
|
>
|
|
625
638
|
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
626
639
|
{/* ── Story 1: Macro wins ── */}
|