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
package/src/dev/showcase/kbd.tsx
CHANGED
|
@@ -27,59 +27,47 @@ import {
|
|
|
27
27
|
DocsCode,
|
|
28
28
|
DocsP,
|
|
29
29
|
ExampleGrid,
|
|
30
|
-
|
|
30
|
+
ShowcaseExample,
|
|
31
31
|
Showcase,
|
|
32
32
|
ShowcaseDocs
|
|
33
33
|
} from "../../dev/components/showcase";
|
|
34
34
|
|
|
35
|
-
// ──────────────────────────────────────────────────────────
|
|
36
|
-
// SECTION 2: Micro Content (không export)
|
|
37
|
-
// ──────────────────────────────────────────────────────────
|
|
38
35
|
function KbdMicroShowcase() {
|
|
39
36
|
return (
|
|
40
|
-
<div className="space-y-10
|
|
41
|
-
{/* ── Kbd đơn ── */}
|
|
37
|
+
<div className="space-y-10">
|
|
42
38
|
<ExampleGrid>
|
|
43
|
-
<
|
|
44
|
-
label="Kbd — Phím đơn"
|
|
45
|
-
description="Hiển thị một phím bàn phím riêng lẻ dùng thẻ <kbd> semantic."
|
|
46
|
-
codeString={`<p className="text-sm text-muted-foreground">
|
|
39
|
+
<ShowcaseExample title="Kbd — Phím đơn" description="Hiển thị một phím bàn phím riêng lẻ dùng thẻ <kbd> semantic." code={`<p className="text-sm text-muted-foreground">
|
|
47
40
|
Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to open search.
|
|
48
|
-
</p>`}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
</p>`} preview={
|
|
42
|
+
<>
|
|
43
|
+
<p className="text-sm text-muted-foreground">
|
|
44
|
+
Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to open search.
|
|
45
|
+
</p>
|
|
46
|
+
</>
|
|
47
|
+
} />
|
|
54
48
|
|
|
55
|
-
<
|
|
56
|
-
label="KbdGroup — Tổ hợp phím"
|
|
57
|
-
description="Nhóm nhiều phím cạnh nhau với khoảng cách đều. Dùng khi biểu diễn tổ hợp phím như Ctrl+Shift+P."
|
|
58
|
-
codeString={`<p className="text-sm text-muted-foreground flex items-center gap-2">
|
|
49
|
+
<ShowcaseExample title="KbdGroup — Tổ hợp phím" description="Nhóm nhiều phím cạnh nhau với khoảng cách đều. Dùng khi biểu diễn tổ hợp phím như Ctrl+Shift+P." code={`<p className="text-sm text-muted-foreground flex items-center gap-2">
|
|
59
50
|
Open Command Palette
|
|
60
51
|
<KbdGroup>
|
|
61
52
|
<Kbd>⌘</Kbd>
|
|
62
53
|
<Kbd>⇧</Kbd>
|
|
63
54
|
<Kbd>P</Kbd>
|
|
64
55
|
</KbdGroup>
|
|
65
|
-
</p>`}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
</p>`} preview={
|
|
57
|
+
<>
|
|
58
|
+
<p className="text-sm text-muted-foreground flex items-center gap-2">
|
|
59
|
+
Open Command Palette
|
|
60
|
+
<KbdGroup>
|
|
61
|
+
<Kbd>⌘</Kbd>
|
|
62
|
+
<Kbd>⇧</Kbd>
|
|
63
|
+
<Kbd>P</Kbd>
|
|
64
|
+
</KbdGroup>
|
|
65
|
+
</p>
|
|
66
|
+
</>
|
|
67
|
+
} />
|
|
76
68
|
</ExampleGrid>
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
<ExampleSection
|
|
80
|
-
label="Ký tự & Symbols"
|
|
81
|
-
description="Kbd có thể chứa ký tự Unicode, chữ cái, số hoặc tên phím dài."
|
|
82
|
-
codeString={`<div className="flex flex-wrap items-center gap-2">
|
|
70
|
+
<ShowcaseExample title="Ký tự & Symbols" description="Kbd có thể chứa ký tự Unicode, chữ cái, số hoặc tên phím dài." code={`<div className="flex flex-wrap items-center gap-2">
|
|
83
71
|
<Kbd>Ctrl</Kbd>
|
|
84
72
|
<Kbd>Alt</Kbd>
|
|
85
73
|
<Kbd>⌘</Kbd>
|
|
@@ -90,27 +78,24 @@ function KbdMicroShowcase() {
|
|
|
90
78
|
<Kbd>Esc</Kbd>
|
|
91
79
|
<Kbd>F1</Kbd>
|
|
92
80
|
<Kbd>→</Kbd>
|
|
93
|
-
</div>`}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
81
|
+
</div>`} preview={
|
|
82
|
+
<>
|
|
83
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
84
|
+
<Kbd>Ctrl</Kbd>
|
|
85
|
+
<Kbd>Alt</Kbd>
|
|
86
|
+
<Kbd>⌘</Kbd>
|
|
87
|
+
<Kbd>⇧</Kbd>
|
|
88
|
+
<Kbd>⌫</Kbd>
|
|
89
|
+
<Kbd>↵</Kbd>
|
|
90
|
+
<Kbd>Tab</Kbd>
|
|
91
|
+
<Kbd>Esc</Kbd>
|
|
92
|
+
<Kbd>F1</Kbd>
|
|
93
|
+
<Kbd>→</Kbd>
|
|
94
|
+
</div>
|
|
95
|
+
</>
|
|
96
|
+
} />
|
|
108
97
|
|
|
109
|
-
|
|
110
|
-
<ExampleSection
|
|
111
|
-
label="Kbd trong Tooltip"
|
|
112
|
-
description="Kbd tự đổi màu khi nằm trong TooltipContent — màu nền sáng trên nền tối của tooltip, không cần thêm class."
|
|
113
|
-
codeString={`<TooltipProvider>
|
|
98
|
+
<ShowcaseExample title="Kbd trong Tooltip" description="Kbd tự đổi màu khi nằm trong TooltipContent — màu nền sáng trên nền tối của tooltip, không cần thêm class." code={`<TooltipProvider>
|
|
114
99
|
<Tooltip>
|
|
115
100
|
<TooltipTrigger
|
|
116
101
|
render={
|
|
@@ -124,52 +109,49 @@ function KbdMicroShowcase() {
|
|
|
124
109
|
<Kbd>S</Kbd>
|
|
125
110
|
</TooltipContent>
|
|
126
111
|
</Tooltip>
|
|
127
|
-
</TooltipProvider>`}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
112
|
+
</TooltipProvider>`} preview={
|
|
113
|
+
<>
|
|
114
|
+
<div className="flex items-center gap-3">
|
|
115
|
+
<TooltipProvider>
|
|
116
|
+
<Tooltip>
|
|
117
|
+
<TooltipTrigger
|
|
118
|
+
render={
|
|
119
|
+
<Button variant="outline" iconOnly>
|
|
120
|
+
<SaveIcon aria-hidden="true" />
|
|
121
|
+
</Button>
|
|
122
|
+
}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<TooltipContent>
|
|
126
|
+
Lưu tài liệu <Kbd>⌘</Kbd>
|
|
127
|
+
<Kbd>S</Kbd>
|
|
128
|
+
</TooltipContent>
|
|
129
|
+
|
|
130
|
+
</Tooltip>
|
|
131
|
+
</TooltipProvider>
|
|
147
132
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
133
|
+
<TooltipProvider>
|
|
134
|
+
<Tooltip>
|
|
135
|
+
<TooltipTrigger
|
|
136
|
+
render={
|
|
137
|
+
<Button variant="outline" iconOnly>
|
|
138
|
+
<CopyIcon aria-hidden="true" />
|
|
139
|
+
</Button>
|
|
140
|
+
}
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<TooltipContent>
|
|
144
|
+
Sao chép <Kbd>⌘</Kbd>
|
|
145
|
+
<Kbd>C</Kbd>
|
|
146
|
+
</TooltipContent>
|
|
147
|
+
|
|
148
|
+
</Tooltip>
|
|
149
|
+
</TooltipProvider>
|
|
150
|
+
</div>
|
|
151
|
+
</>
|
|
152
|
+
} />
|
|
167
153
|
|
|
168
|
-
|
|
169
|
-
<ExampleSection
|
|
170
|
-
label="Use case — Menu với Keyboard Shortcut"
|
|
171
|
-
description="Kbd dùng trong DropdownMenuItem để hiển thị phím tắt bên cạnh label — pattern phổ biến trong text editor, IDE, Figma."
|
|
172
|
-
codeString={`<DropdownMenuItem>
|
|
154
|
+
<ShowcaseExample title="Use case — Menu với Keyboard Shortcut" description="Kbd dùng trong DropdownMenuItem để hiển thị phím tắt bên cạnh label — pattern phổ biến trong text editor, IDE, Figma." code={`<DropdownMenuItem>
|
|
173
155
|
<FileIcon />
|
|
174
156
|
New File
|
|
175
157
|
<KbdGroup className="ml-auto">
|
|
@@ -185,93 +167,88 @@ function KbdMicroShowcase() {
|
|
|
185
167
|
<Kbd>⌘</Kbd>
|
|
186
168
|
<Kbd>S</Kbd>
|
|
187
169
|
</KbdGroup>
|
|
188
|
-
</DropdownMenuItem>`}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
170
|
+
</DropdownMenuItem>`} preview={
|
|
171
|
+
<>
|
|
172
|
+
<DropdownMenu>
|
|
173
|
+
<DropdownMenuTrigger
|
|
174
|
+
render={<Button variant="outline">File menu</Button>}
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
<DropdownMenuContent className="w-56">
|
|
178
|
+
<DropdownMenuItem>
|
|
179
|
+
<FilePlusIcon aria-hidden="true" />
|
|
180
|
+
New File
|
|
181
|
+
<KbdGroup className="ml-auto">
|
|
182
|
+
<Kbd>⌘</Kbd>
|
|
183
|
+
<Kbd>N</Kbd>
|
|
184
|
+
</KbdGroup>
|
|
185
|
+
</DropdownMenuItem>
|
|
186
|
+
<DropdownMenuItem>
|
|
187
|
+
<FolderOpenIcon aria-hidden="true" />
|
|
188
|
+
Open...
|
|
189
|
+
<KbdGroup className="ml-auto">
|
|
190
|
+
<Kbd>⌘</Kbd>
|
|
191
|
+
<Kbd>O</Kbd>
|
|
192
|
+
</KbdGroup>
|
|
193
|
+
</DropdownMenuItem>
|
|
194
|
+
<DropdownMenuSeparator />
|
|
195
|
+
<DropdownMenuItem>
|
|
196
|
+
<SaveIcon aria-hidden="true" />
|
|
197
|
+
Save
|
|
198
|
+
<KbdGroup className="ml-auto">
|
|
199
|
+
<Kbd>⌘</Kbd>
|
|
200
|
+
<Kbd>S</Kbd>
|
|
201
|
+
</KbdGroup>
|
|
202
|
+
</DropdownMenuItem>
|
|
203
|
+
<DropdownMenuItem>
|
|
204
|
+
<FileIcon aria-hidden="true" />
|
|
205
|
+
Save As...
|
|
206
|
+
<KbdGroup className="ml-auto">
|
|
207
|
+
<Kbd>⌘</Kbd>
|
|
208
|
+
<Kbd>⇧</Kbd>
|
|
209
|
+
<Kbd>S</Kbd>
|
|
210
|
+
</KbdGroup>
|
|
211
|
+
</DropdownMenuItem>
|
|
212
|
+
</DropdownMenuContent>
|
|
213
|
+
|
|
214
|
+
</DropdownMenu>
|
|
215
|
+
</>
|
|
216
|
+
} />
|
|
234
217
|
|
|
235
|
-
|
|
236
|
-
<ExampleSection
|
|
237
|
-
label="Gợi ý inline trong văn bản"
|
|
238
|
-
description="Kbd dùng inline trong đoạn văn bản để gợi ý phím tắt — phổ biến trong help text, onboarding, documentation."
|
|
239
|
-
codeString={`<p className="text-sm text-muted-foreground">
|
|
218
|
+
<ShowcaseExample title="Gợi ý inline trong văn bản" description="Kbd dùng inline trong đoạn văn bản để gợi ý phím tắt — phổ biến trong help text, onboarding, documentation." code={`<p className="text-sm text-muted-foreground">
|
|
240
219
|
Nhấn <Kbd>Enter</Kbd> để gửi, hoặc{" "}
|
|
241
220
|
<KbdGroup>
|
|
242
221
|
<Kbd>⇧</Kbd>
|
|
243
222
|
<Kbd>Enter</Kbd>
|
|
244
223
|
</KbdGroup>{" "}
|
|
245
224
|
để xuống dòng.
|
|
246
|
-
</p>`}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
225
|
+
</p>`} preview={
|
|
226
|
+
<>
|
|
227
|
+
<div className="space-y-3">
|
|
228
|
+
<p className="text-sm text-muted-foreground">
|
|
229
|
+
Nhấn <Kbd>Enter</Kbd> để gửi, hoặc{" "}
|
|
230
|
+
<KbdGroup>
|
|
231
|
+
<Kbd>⇧</Kbd>
|
|
232
|
+
<Kbd>Enter</Kbd>
|
|
233
|
+
</KbdGroup>{" "}
|
|
234
|
+
để xuống dòng.
|
|
235
|
+
</p>
|
|
236
|
+
<p className="text-sm text-muted-foreground">
|
|
237
|
+
Dùng <Kbd>Tab</Kbd> để chuyển trường, <Kbd>Esc</Kbd> để huỷ.
|
|
238
|
+
</p>
|
|
239
|
+
</div>
|
|
240
|
+
</>
|
|
241
|
+
} />
|
|
262
242
|
</div>
|
|
263
243
|
);
|
|
264
244
|
}
|
|
265
245
|
|
|
266
|
-
// ──────────────────────────────────────────────────────────
|
|
267
|
-
// SECTION 3: Entry point (export default)
|
|
268
|
-
// ──────────────────────────────────────────────────────────
|
|
269
246
|
export default function KbdShowcase() {
|
|
270
247
|
return (
|
|
271
248
|
<Showcase
|
|
272
249
|
title="Keyboard Shortcut"
|
|
273
250
|
description="Hiển thị phím tắt bàn phím dạng inline với thẻ HTML semantic <kbd>."
|
|
274
|
-
|
|
251
|
+
guideline={
|
|
275
252
|
<ShowcaseDocs>
|
|
276
253
|
<DocsP>
|
|
277
254
|
<DocsCode>Kbd</DocsCode> dùng thẻ HTML semantic{" "}
|
|
@@ -286,7 +263,7 @@ export default function KbdShowcase() {
|
|
|
286
263
|
</DocsP>
|
|
287
264
|
</ShowcaseDocs>
|
|
288
265
|
}
|
|
289
|
-
|
|
266
|
+
micro={{ content: <KbdMicroShowcase /> }}
|
|
290
267
|
/>
|
|
291
268
|
);
|
|
292
269
|
}
|
|
@@ -3,60 +3,48 @@ import { useDevContext } from "../../dev/components/dev-context";
|
|
|
3
3
|
import {
|
|
4
4
|
DocsCode,
|
|
5
5
|
DocsP,
|
|
6
|
-
|
|
6
|
+
ShowcaseExample,
|
|
7
7
|
Showcase,
|
|
8
8
|
ShowcaseDocs
|
|
9
9
|
} from "../../dev/components/showcase";
|
|
10
10
|
import { type Size } from "../../lib/types";
|
|
11
11
|
|
|
12
|
-
// ──────────────────────────────────────────────────────────
|
|
13
|
-
// SECTION 2: Micro Content (không export)
|
|
14
|
-
// ──────────────────────────────────────────────────────────
|
|
15
12
|
function LabelMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
16
13
|
return (
|
|
17
|
-
<div className="space-y-10
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</Label>
|
|
26
|
-
</ExampleSection>
|
|
14
|
+
<div className="space-y-10">
|
|
15
|
+
<ShowcaseExample title="Default" description="Cách sử dụng nhãn tiêu chuẩn." code={`<Label htmlFor="terms">Chấp nhận điều khoản và điều kiện</Label>`} preview={
|
|
16
|
+
<>
|
|
17
|
+
<Label htmlFor="terms" size={globalSize}>
|
|
18
|
+
Chấp nhận điều khoản và điều kiện
|
|
19
|
+
</Label>
|
|
20
|
+
</>
|
|
21
|
+
} />
|
|
27
22
|
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</div>
|
|
40
|
-
</ExampleSection>
|
|
23
|
+
<ShowcaseExample title="Disabled" description="Trạng thái bị vô hiệu hóa khi nằm trong group bị vô hiệu." code={`<div data-disabled="true" className="group">
|
|
24
|
+
<Label htmlFor="disabled">Nhãn này đã bị khóa</Label>
|
|
25
|
+
</div>`} preview={
|
|
26
|
+
<>
|
|
27
|
+
<div data-disabled="true" className="group">
|
|
28
|
+
<Label htmlFor="disabled" size={globalSize}>
|
|
29
|
+
Nhãn này đã bị khóa
|
|
30
|
+
</Label>
|
|
31
|
+
</div>
|
|
32
|
+
</>
|
|
33
|
+
} />
|
|
41
34
|
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
</ExampleSection>
|
|
35
|
+
<ShowcaseExample title="Error State" description="Hiển thị màu đỏ khi nằm trong group bị lỗi (data-invalid)." code={`<div data-invalid="true" className="group">
|
|
36
|
+
<Label htmlFor="error">Email là bắt buộc</Label>
|
|
37
|
+
</div>`} preview={
|
|
38
|
+
<>
|
|
39
|
+
<div data-invalid="true" className="group">
|
|
40
|
+
<Label htmlFor="error" size={globalSize}>
|
|
41
|
+
Email là bắt buộc
|
|
42
|
+
</Label>
|
|
43
|
+
</div>
|
|
44
|
+
</>
|
|
45
|
+
} />
|
|
55
46
|
|
|
56
|
-
<
|
|
57
|
-
label="With Peer Input"
|
|
58
|
-
description="Phản hồi trạng thái disabled của input liền kề (dùng class peer)."
|
|
59
|
-
codeString={`<div className="flex items-center gap-2">
|
|
47
|
+
<ShowcaseExample title="With Peer Input" description="Phản hồi trạng thái disabled của input liền kề (dùng class peer)." code={`<div className="flex items-center gap-2">
|
|
60
48
|
<input
|
|
61
49
|
type="checkbox"
|
|
62
50
|
disabled
|
|
@@ -64,36 +52,34 @@ function LabelMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
64
52
|
className="peer w-4 h-4"
|
|
65
53
|
/>
|
|
66
54
|
<Label htmlFor="peer-disabled">
|
|
67
|
-
|
|
55
|
+
Bị khóa bởi peer checkbox
|
|
68
56
|
</Label>
|
|
69
|
-
</div>`}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
57
|
+
</div>`} preview={
|
|
58
|
+
<>
|
|
59
|
+
<div className="flex items-center gap-2">
|
|
60
|
+
<input
|
|
61
|
+
type="checkbox"
|
|
62
|
+
disabled
|
|
63
|
+
id="peer-disabled"
|
|
64
|
+
className="peer w-4 h-4"
|
|
65
|
+
/>
|
|
66
|
+
<Label htmlFor="peer-disabled" size={globalSize}>
|
|
67
|
+
Bị khóa bởi peer checkbox
|
|
68
|
+
</Label>
|
|
69
|
+
</div>
|
|
70
|
+
</>
|
|
71
|
+
} />
|
|
83
72
|
</div>
|
|
84
73
|
);
|
|
85
74
|
}
|
|
86
75
|
|
|
87
|
-
// ──────────────────────────────────────────────────────────
|
|
88
|
-
// SECTION 3: Entry point (export default)
|
|
89
|
-
// ──────────────────────────────────────────────────────────
|
|
90
76
|
export default function LabelShowcase() {
|
|
91
77
|
const { size: globalSize } = useDevContext();
|
|
92
78
|
return (
|
|
93
79
|
<Showcase
|
|
94
80
|
title="Label"
|
|
95
81
|
description="Nhãn gắn với form control, cải thiện accessibility."
|
|
96
|
-
|
|
82
|
+
guideline={
|
|
97
83
|
<ShowcaseDocs>
|
|
98
84
|
<DocsP>
|
|
99
85
|
Label được sử dụng để gắn nhãn cho các trường nhập liệu form. Nó cải
|
|
@@ -103,11 +89,7 @@ export default function LabelShowcase() {
|
|
|
103
89
|
</DocsP>
|
|
104
90
|
</ShowcaseDocs>
|
|
105
91
|
}
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
label: "Micro (Primitive)",
|
|
109
|
-
content: <LabelMicroShowcase globalSize={globalSize} /> },
|
|
110
|
-
]}
|
|
92
|
+
micro={{ content: <LabelMicroShowcase globalSize={globalSize} /> }}
|
|
111
93
|
/>
|
|
112
94
|
);
|
|
113
95
|
}
|