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
|
@@ -8,7 +8,7 @@ import { useDevContext } from "../../dev/components/dev-context";
|
|
|
8
8
|
import {
|
|
9
9
|
DocsP,
|
|
10
10
|
ExampleGrid,
|
|
11
|
-
|
|
11
|
+
ShowcaseExample,
|
|
12
12
|
Showcase,
|
|
13
13
|
ShowcaseDocs
|
|
14
14
|
} from "../../dev/components/showcase";
|
|
@@ -26,37 +26,30 @@ function CalendarMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
26
26
|
to: new Date(2026, 5, 25) });
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<div className="space-y-10
|
|
29
|
+
<div className="space-y-10">
|
|
30
30
|
<ExampleGrid>
|
|
31
|
-
{
|
|
32
|
-
<ExampleSection
|
|
33
|
-
label="Single Date"
|
|
34
|
-
description="Chọn một ngày duy nhất."
|
|
35
|
-
codeString={`const [date, setDate] = React.useState<Date | undefined>(new Date())
|
|
31
|
+
<ShowcaseExample title="Single Date" description="Chọn một ngày duy nhất." code={`const [date, setDate] = React.useState<Date | undefined>(new Date())
|
|
36
32
|
|
|
37
33
|
<Calendar
|
|
38
34
|
mode="single"
|
|
39
35
|
selected={date}
|
|
40
36
|
onSelect={setDate}
|
|
41
37
|
className="rounded-xl border border-border shadow"
|
|
42
|
-
/>`}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
/>`} preview={
|
|
39
|
+
<>
|
|
40
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
41
|
+
<Calendar
|
|
42
|
+
size={globalSize}
|
|
43
|
+
mode="single"
|
|
44
|
+
selected={singleDate}
|
|
45
|
+
onSelect={setSingleDate}
|
|
46
|
+
className="w-full"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</>
|
|
50
|
+
} />
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
<ExampleSection
|
|
57
|
-
label="Date Range"
|
|
58
|
-
description="Chọn một phạm vi ngày."
|
|
59
|
-
codeString={`const [date, setDate] = React.useState<DateRange | undefined>({
|
|
52
|
+
<ShowcaseExample title="Date Range" description="Chọn một phạm vi ngày." code={`const [date, setDate] = React.useState<DateRange | undefined>({
|
|
60
53
|
from: new Date(2026, 5, 15),
|
|
61
54
|
to: new Date(2026, 5, 25) })
|
|
62
55
|
|
|
@@ -65,117 +58,103 @@ function CalendarMicroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
65
58
|
selected={date}
|
|
66
59
|
onSelect={setDate}
|
|
67
60
|
className="rounded-xl border border-border shadow"
|
|
68
|
-
/>`}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
/>`} preview={
|
|
62
|
+
<>
|
|
63
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
64
|
+
<Calendar
|
|
65
|
+
size={globalSize}
|
|
66
|
+
mode="range"
|
|
67
|
+
selected={dateRange}
|
|
68
|
+
onSelect={setDateRange}
|
|
69
|
+
className="w-full"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</>
|
|
73
|
+
} />
|
|
80
74
|
</ExampleGrid>
|
|
81
75
|
|
|
82
76
|
<ExampleGrid>
|
|
83
|
-
|
|
84
|
-
<ExampleSection
|
|
85
|
-
label="Multiple Dates"
|
|
86
|
-
description="Chọn nhiều ngày rời rạc (mode='multiple')."
|
|
87
|
-
codeString={`const [dates, setDates] = React.useState<Date[] | undefined>([])
|
|
77
|
+
<ShowcaseExample title="Multiple Dates" description="Chọn nhiều ngày rời rạc (mode='multiple')." code={`const [dates, setDates] = React.useState<Date[] | undefined>([])
|
|
88
78
|
|
|
89
79
|
<Calendar
|
|
90
80
|
mode="multiple"
|
|
91
81
|
selected={dates}
|
|
92
82
|
onSelect={setDates}
|
|
93
83
|
className="rounded-xl border border-border shadow"
|
|
94
|
-
/>`}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
/>`} preview={
|
|
85
|
+
<>
|
|
86
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
87
|
+
<Calendar
|
|
88
|
+
size={globalSize}
|
|
89
|
+
mode="multiple"
|
|
90
|
+
selected={multipleDates}
|
|
91
|
+
onSelect={setMultipleDates}
|
|
92
|
+
className="w-full"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</>
|
|
96
|
+
} />
|
|
106
97
|
|
|
107
|
-
|
|
108
|
-
<ExampleSection
|
|
109
|
-
label="Disabled Dates"
|
|
110
|
-
description="Vô hiệu hóa chọn ngày (VD: ngày trong quá khứ)."
|
|
111
|
-
codeString={`<Calendar
|
|
98
|
+
<ShowcaseExample title="Disabled Dates" description="Vô hiệu hóa chọn ngày (VD: ngày trong quá khứ)." code={`<Calendar
|
|
112
99
|
mode="single"
|
|
113
100
|
disabled={(date) => date < new Date()}
|
|
114
101
|
className="rounded-xl border border-border shadow"
|
|
115
|
-
/>`}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
102
|
+
/>`} preview={
|
|
103
|
+
<>
|
|
104
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
105
|
+
<Calendar
|
|
106
|
+
size={globalSize}
|
|
107
|
+
mode="single"
|
|
108
|
+
disabled={(date) => date < new Date(2026, 5, 15)}
|
|
109
|
+
defaultMonth={new Date(2026, 5, 15)}
|
|
110
|
+
className="w-full"
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
</>
|
|
114
|
+
} />
|
|
127
115
|
</ExampleGrid>
|
|
128
116
|
|
|
129
|
-
|
|
130
|
-
<ExampleSection
|
|
131
|
-
label="Two Months"
|
|
132
|
-
description="Hiển thị 2 tháng liền kề (numberOfMonths=2) thường dùng cho Date Range."
|
|
133
|
-
codeString={`<Calendar
|
|
117
|
+
<ShowcaseExample title="Two Months" description="Hiển thị 2 tháng liền kề (numberOfMonths=2) thường dùng cho Date Range." code={`<Calendar
|
|
134
118
|
mode="range"
|
|
135
119
|
selected={date}
|
|
136
120
|
onSelect={setDate}
|
|
137
121
|
numberOfMonths={2}
|
|
138
122
|
className="rounded-xl border border-border shadow"
|
|
139
|
-
/>`}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
123
|
+
/>`} preview={
|
|
124
|
+
<>
|
|
125
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3 overflow-x-auto max-w-full">
|
|
126
|
+
<Calendar
|
|
127
|
+
size={globalSize}
|
|
128
|
+
mode="range"
|
|
129
|
+
selected={dateRange}
|
|
130
|
+
onSelect={setDateRange}
|
|
131
|
+
numberOfMonths={2}
|
|
132
|
+
className="w-full"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
</>
|
|
136
|
+
} />
|
|
152
137
|
|
|
153
|
-
|
|
154
|
-
<ExampleSection
|
|
155
|
-
label="With Navigation"
|
|
156
|
-
description="Lịch với điều hướng thả xuống cho tháng/năm."
|
|
157
|
-
codeString={`<Calendar
|
|
138
|
+
<ShowcaseExample title="With Navigation" description="Lịch với điều hướng thả xuống cho tháng/năm." code={`<Calendar
|
|
158
139
|
mode="single"
|
|
159
140
|
captionLayout="dropdown"
|
|
160
141
|
className="rounded-xl border border-border shadow"
|
|
161
|
-
/>`}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
142
|
+
/>`} preview={
|
|
143
|
+
<>
|
|
144
|
+
<div className="border border-border rounded-xl inline-block bg-card p-3">
|
|
145
|
+
<Calendar
|
|
146
|
+
size={globalSize}
|
|
147
|
+
mode="single"
|
|
148
|
+
captionLayout="dropdown"
|
|
149
|
+
className="w-full"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</>
|
|
153
|
+
} />
|
|
172
154
|
</div>
|
|
173
155
|
);
|
|
174
156
|
}
|
|
175
157
|
|
|
176
|
-
// ──────────────────────────────────────────────────────────
|
|
177
|
-
// SECTION 3: Macro Showcase
|
|
178
|
-
// ──────────────────────────────────────────────────────────
|
|
179
158
|
function CalendarMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
180
159
|
const [singleDate, setSingleDate] = useState<Date | undefined>(undefined);
|
|
181
160
|
const [rangeDate, setRangeDate] = useState<DateRange | undefined>(undefined);
|
|
@@ -187,81 +166,69 @@ function CalendarMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
187
166
|
const [lgDate, setLgDate] = useState<Date | undefined>(undefined);
|
|
188
167
|
|
|
189
168
|
return (
|
|
190
|
-
<div className="space-y-10
|
|
191
|
-
{/* ── Single Date ── */}
|
|
169
|
+
<div className="space-y-10">
|
|
192
170
|
<ExampleGrid>
|
|
193
|
-
<
|
|
194
|
-
label="Single Date"
|
|
195
|
-
description="DatePicker cơ bản chọn một ngày."
|
|
196
|
-
codeString={`const [date, setDate] = React.useState<Date | undefined>()
|
|
171
|
+
<ShowcaseExample title="Single Date" description="DatePicker cơ bản chọn một ngày." code={`const [date, setDate] = React.useState<Date | undefined>()
|
|
197
172
|
|
|
198
173
|
<DatePicker className="w-64"
|
|
199
174
|
label="Date"
|
|
200
175
|
value={date}
|
|
201
176
|
onValueChange={setDate}
|
|
202
|
-
/>`}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
177
|
+
/>`} preview={
|
|
178
|
+
<>
|
|
179
|
+
<DatePicker
|
|
180
|
+
className="w-64"
|
|
181
|
+
size={globalSize}
|
|
182
|
+
label="Date"
|
|
183
|
+
value={singleDate}
|
|
184
|
+
onValueChange={setSingleDate}
|
|
185
|
+
/>
|
|
186
|
+
</>
|
|
187
|
+
} />
|
|
212
188
|
|
|
213
|
-
|
|
214
|
-
<ExampleSection
|
|
215
|
-
label="Date Range"
|
|
216
|
-
description="DatePicker chọn khoảng thời gian (range mode)."
|
|
217
|
-
codeString={`const [range, setRange] = React.useState<DateRange | undefined>()
|
|
189
|
+
<ShowcaseExample title="Date Range" description="DatePicker chọn khoảng thời gian (range mode)." code={`const [range, setRange] = React.useState<DateRange | undefined>()
|
|
218
190
|
|
|
219
191
|
<DatePicker className="w-64"
|
|
220
192
|
mode="range"
|
|
221
193
|
label="Date Range"
|
|
222
194
|
rangeValue={range}
|
|
223
195
|
onRangeChange={setRange}
|
|
224
|
-
/>`}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
196
|
+
/>`} preview={
|
|
197
|
+
<>
|
|
198
|
+
<DatePicker
|
|
199
|
+
className="w-64"
|
|
200
|
+
mode="range"
|
|
201
|
+
size={globalSize}
|
|
202
|
+
label="Date Range"
|
|
203
|
+
rangeValue={rangeDate}
|
|
204
|
+
onRangeChange={setRangeDate}
|
|
205
|
+
/>
|
|
206
|
+
</>
|
|
207
|
+
} />
|
|
235
208
|
</ExampleGrid>
|
|
236
209
|
|
|
237
|
-
{/* ── Dropdown Modes ── */}
|
|
238
210
|
<ExampleGrid>
|
|
239
|
-
<
|
|
240
|
-
label="Single Dropdown"
|
|
241
|
-
description="Sổ danh sách để chọn tháng và năm nhanh chóng thay vì click qua lại liên tục."
|
|
242
|
-
codeString={`<DatePicker
|
|
211
|
+
<ShowcaseExample title="Single Dropdown" description="Sổ danh sách để chọn tháng và năm nhanh chóng thay vì click qua lại liên tục." code={`<DatePicker
|
|
243
212
|
className="w-64"
|
|
244
213
|
label="Birthday"
|
|
245
214
|
captionLayout="dropdown"
|
|
246
215
|
startMonth={new Date(1900, 0)}
|
|
247
216
|
endMonth={new Date()}
|
|
248
|
-
/>`}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
description="Sổ danh sách cho cả 2 tháng khi chọn khoảng thời gian (cần numberOfMonths={2})."
|
|
264
|
-
codeString={`<DatePicker
|
|
217
|
+
/>`} preview={
|
|
218
|
+
<>
|
|
219
|
+
<DatePicker
|
|
220
|
+
className="w-64"
|
|
221
|
+
size={globalSize}
|
|
222
|
+
label="Birthday"
|
|
223
|
+
captionLayout="dropdown"
|
|
224
|
+
startMonth={new Date(1900, 0)}
|
|
225
|
+
endMonth={new Date()}
|
|
226
|
+
value={singleDate}
|
|
227
|
+
onValueChange={setSingleDate}
|
|
228
|
+
/>
|
|
229
|
+
</>
|
|
230
|
+
} />
|
|
231
|
+
<ShowcaseExample title="Range Dropdown" description="Sổ danh sách cho cả 2 tháng khi chọn khoảng thời gian (cần numberOfMonths={2})." code={`<DatePicker
|
|
265
232
|
className="w-fit"
|
|
266
233
|
mode="range"
|
|
267
234
|
label="Date Range with Dropdowns"
|
|
@@ -269,94 +236,83 @@ function CalendarMacroShowcase({ globalSize }: { globalSize: Size }) {
|
|
|
269
236
|
numberOfMonths={2}
|
|
270
237
|
startMonth={new Date(2020, 0)}
|
|
271
238
|
endMonth={new Date(2030, 11)}
|
|
272
|
-
/>`}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
239
|
+
/>`} preview={
|
|
240
|
+
<>
|
|
241
|
+
<DatePicker
|
|
242
|
+
className="w-fit"
|
|
243
|
+
mode="range"
|
|
244
|
+
size={globalSize}
|
|
245
|
+
label="Date Range with Dropdowns"
|
|
246
|
+
captionLayout="dropdown"
|
|
247
|
+
numberOfMonths={2}
|
|
248
|
+
startMonth={new Date(2020, 0)}
|
|
249
|
+
endMonth={new Date(2030, 11)}
|
|
250
|
+
rangeValue={rangeDate}
|
|
251
|
+
onRangeChange={setRangeDate}
|
|
252
|
+
/>
|
|
253
|
+
</>
|
|
254
|
+
} />
|
|
287
255
|
</ExampleGrid>
|
|
288
256
|
|
|
289
|
-
|
|
290
|
-
<ExampleSection
|
|
291
|
-
label="With Label & Description"
|
|
292
|
-
description="Hiển thị label và mô tả bên dưới trigger."
|
|
293
|
-
codeString={`<DatePicker
|
|
257
|
+
<ShowcaseExample title="With Label & Description" description="Hiển thị label và mô tả bên dưới trigger." code={`<DatePicker
|
|
294
258
|
className="w-64"
|
|
295
259
|
label="Start Date"
|
|
296
260
|
description="Chọn ngày bắt đầu dự án."
|
|
297
|
-
placeholder="
|
|
298
|
-
/>`}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
261
|
+
placeholder="Chọn ngày"
|
|
262
|
+
/>`} preview={
|
|
263
|
+
<>
|
|
264
|
+
<DatePicker
|
|
265
|
+
className="w-64"
|
|
266
|
+
size={globalSize}
|
|
267
|
+
label="Start Date"
|
|
268
|
+
description="Chọn ngày bắt đầu dự án."
|
|
269
|
+
placeholder="Chọn ngày"
|
|
270
|
+
value={descDate}
|
|
271
|
+
onValueChange={setDescDate}
|
|
272
|
+
/>
|
|
273
|
+
</>
|
|
274
|
+
} />
|
|
310
275
|
|
|
311
|
-
|
|
312
|
-
<ExampleSection
|
|
313
|
-
label="Error State"
|
|
314
|
-
description="Trigger hiển thị viền đỏ khi có errorMessage."
|
|
315
|
-
codeString={`<DatePicker
|
|
276
|
+
<ShowcaseExample title="Error State" description="Trigger hiển thị viền đỏ khi có errorMessage." code={`<DatePicker
|
|
316
277
|
className="w-64"
|
|
317
278
|
label="Due Date"
|
|
318
279
|
errorMessage="Due date is required."
|
|
319
|
-
/>`}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
280
|
+
/>`} preview={
|
|
281
|
+
<>
|
|
282
|
+
<DatePicker
|
|
283
|
+
className="w-64"
|
|
284
|
+
size={globalSize}
|
|
285
|
+
label="Due Date"
|
|
286
|
+
errorMessage="Due date is required."
|
|
287
|
+
value={errDate}
|
|
288
|
+
onValueChange={setErrDate}
|
|
289
|
+
/>
|
|
290
|
+
</>
|
|
291
|
+
} />
|
|
330
292
|
|
|
331
|
-
{
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
onValueChange={setDisDate}
|
|
344
|
-
/>
|
|
345
|
-
</ExampleSection>
|
|
293
|
+
<ShowcaseExample title="Disabled" description="Trigger bị vô hiệu hoá, người dùng không thể mở calendar." code={`<DatePicker className="w-64" label="Date" disabled />`} preview={
|
|
294
|
+
<>
|
|
295
|
+
<DatePicker
|
|
296
|
+
className="w-64"
|
|
297
|
+
size={globalSize}
|
|
298
|
+
label="Date"
|
|
299
|
+
disabled
|
|
300
|
+
value={disDate}
|
|
301
|
+
onValueChange={setDisDate}
|
|
302
|
+
/>
|
|
303
|
+
</>
|
|
304
|
+
} />
|
|
346
305
|
</div>
|
|
347
306
|
);
|
|
348
307
|
}
|
|
349
308
|
|
|
350
|
-
// ──────────────────────────────────────────────────────────
|
|
351
|
-
// SECTION 4: Entry point
|
|
352
|
-
// ──────────────────────────────────────────────────────────
|
|
353
309
|
export default function CalendarShowcase() {
|
|
354
310
|
const { size: globalSize } = useDevContext();
|
|
355
311
|
return (
|
|
356
312
|
<Showcase
|
|
357
313
|
title="Calendar"
|
|
358
314
|
description="Thành phần chọn ngày, khoảng thời gian hoặc nhiều ngày."
|
|
359
|
-
|
|
315
|
+
guideline={
|
|
360
316
|
<ShowcaseDocs>
|
|
361
317
|
<DocsP>
|
|
362
318
|
Dùng để hiển thị lịch và cho phép người dùng chọn một ngày, nhiều
|
|
@@ -365,14 +321,8 @@ export default function CalendarShowcase() {
|
|
|
365
321
|
</DocsP>
|
|
366
322
|
</ShowcaseDocs>
|
|
367
323
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
label: "Micro (Primitive)",
|
|
371
|
-
content: <CalendarMicroShowcase globalSize={globalSize} /> },
|
|
372
|
-
{
|
|
373
|
-
label: "Macro (DatePicker)",
|
|
374
|
-
content: <CalendarMacroShowcase globalSize={globalSize} /> },
|
|
375
|
-
]}
|
|
324
|
+
micro={{ content: <CalendarMicroShowcase globalSize={globalSize} /> }}
|
|
325
|
+
macro={{ content: <CalendarMacroShowcase globalSize={globalSize} /> }}
|
|
376
326
|
/>
|
|
377
327
|
);
|
|
378
328
|
}
|