@maz-ui/mcp 4.0.0-beta.26

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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +264 -0
  3. package/bin/maz-ui-mcp.mjs +7 -0
  4. package/dist/mcp.d.mts +13 -0
  5. package/dist/mcp.d.ts +13 -0
  6. package/dist/mcp.mjs +586 -0
  7. package/docs/generated-docs/maz-accordion.doc.md +21 -0
  8. package/docs/generated-docs/maz-animated-counter.doc.md +17 -0
  9. package/docs/generated-docs/maz-animated-element.doc.md +14 -0
  10. package/docs/generated-docs/maz-animated-text.doc.md +14 -0
  11. package/docs/generated-docs/maz-avatar.doc.md +44 -0
  12. package/docs/generated-docs/maz-backdrop.doc.md +61 -0
  13. package/docs/generated-docs/maz-badge.doc.md +16 -0
  14. package/docs/generated-docs/maz-bottom-sheet.doc.md +21 -0
  15. package/docs/generated-docs/maz-btn.doc.md +30 -0
  16. package/docs/generated-docs/maz-card-spotlight.doc.md +16 -0
  17. package/docs/generated-docs/maz-card.doc.md +39 -0
  18. package/docs/generated-docs/maz-carousel.doc.md +16 -0
  19. package/docs/generated-docs/maz-chart.doc.md +10 -0
  20. package/docs/generated-docs/maz-checkbox.doc.md +34 -0
  21. package/docs/generated-docs/maz-checklist.doc.md +30 -0
  22. package/docs/generated-docs/maz-circular-progress-bar.doc.md +27 -0
  23. package/docs/generated-docs/maz-date-picker.doc.md +52 -0
  24. package/docs/generated-docs/maz-dialog-confirm.doc.md +24 -0
  25. package/docs/generated-docs/maz-dialog.doc.md +22 -0
  26. package/docs/generated-docs/maz-drawer.doc.md +26 -0
  27. package/docs/generated-docs/maz-dropdown.doc.md +42 -0
  28. package/docs/generated-docs/maz-dropzone.doc.md +82 -0
  29. package/docs/generated-docs/maz-expand-animation.doc.md +12 -0
  30. package/docs/generated-docs/maz-fullscreen-loader.doc.md +13 -0
  31. package/docs/generated-docs/maz-gallery.doc.md +17 -0
  32. package/docs/generated-docs/maz-icon.doc.md +18 -0
  33. package/docs/generated-docs/maz-input-code.doc.md +25 -0
  34. package/docs/generated-docs/maz-input-number.doc.md +31 -0
  35. package/docs/generated-docs/maz-input-phone-number.doc.md +56 -0
  36. package/docs/generated-docs/maz-input-price.doc.md +26 -0
  37. package/docs/generated-docs/maz-input-tags.doc.md +24 -0
  38. package/docs/generated-docs/maz-input.doc.md +54 -0
  39. package/docs/generated-docs/maz-lazy-img.doc.md +31 -0
  40. package/docs/generated-docs/maz-link.doc.md +31 -0
  41. package/docs/generated-docs/maz-loading-bar.doc.md +6 -0
  42. package/docs/generated-docs/maz-pagination.doc.md +22 -0
  43. package/docs/generated-docs/maz-popover.doc.md +70 -0
  44. package/docs/generated-docs/maz-pull-to-refresh.doc.md +31 -0
  45. package/docs/generated-docs/maz-radio-buttons.doc.md +33 -0
  46. package/docs/generated-docs/maz-radio.doc.md +33 -0
  47. package/docs/generated-docs/maz-reading-progress-bar.doc.md +18 -0
  48. package/docs/generated-docs/maz-select-country.doc.md +44 -0
  49. package/docs/generated-docs/maz-select.doc.md +65 -0
  50. package/docs/generated-docs/maz-slider.doc.md +20 -0
  51. package/docs/generated-docs/maz-spinner.doc.md +6 -0
  52. package/docs/generated-docs/maz-stepper.doc.md +29 -0
  53. package/docs/generated-docs/maz-switch.doc.md +31 -0
  54. package/docs/generated-docs/maz-table-cell.doc.md +5 -0
  55. package/docs/generated-docs/maz-table-row.doc.md +11 -0
  56. package/docs/generated-docs/maz-table-title.doc.md +5 -0
  57. package/docs/generated-docs/maz-table.doc.md +66 -0
  58. package/docs/generated-docs/maz-tabs-bar.doc.md +18 -0
  59. package/docs/generated-docs/maz-tabs-content-item.doc.md +11 -0
  60. package/docs/generated-docs/maz-tabs-content.doc.md +5 -0
  61. package/docs/generated-docs/maz-tabs.doc.md +17 -0
  62. package/docs/generated-docs/maz-textarea.doc.md +41 -0
  63. package/docs/src/components/index.md +8 -0
  64. package/docs/src/components/maz-accordion.md +80 -0
  65. package/docs/src/components/maz-animated-counter.md +124 -0
  66. package/docs/src/components/maz-animated-element.md +36 -0
  67. package/docs/src/components/maz-animated-text.md +36 -0
  68. package/docs/src/components/maz-avatar.md +179 -0
  69. package/docs/src/components/maz-backdrop.md +16 -0
  70. package/docs/src/components/maz-badge.md +222 -0
  71. package/docs/src/components/maz-bottom-sheet.md +398 -0
  72. package/docs/src/components/maz-btn.md +526 -0
  73. package/docs/src/components/maz-card-spotlight.md +163 -0
  74. package/docs/src/components/maz-card.md +447 -0
  75. package/docs/src/components/maz-carousel.md +127 -0
  76. package/docs/src/components/maz-chart.md +346 -0
  77. package/docs/src/components/maz-checkbox.md +168 -0
  78. package/docs/src/components/maz-checklist.md +414 -0
  79. package/docs/src/components/maz-circular-progress-bar.md +147 -0
  80. package/docs/src/components/maz-date-picker.md +1078 -0
  81. package/docs/src/components/maz-dialog-confirm.md +240 -0
  82. package/docs/src/components/maz-dialog.md +208 -0
  83. package/docs/src/components/maz-drawer.md +177 -0
  84. package/docs/src/components/maz-dropdown.md +650 -0
  85. package/docs/src/components/maz-dropzone.md +442 -0
  86. package/docs/src/components/maz-expand-animation.md +99 -0
  87. package/docs/src/components/maz-fullscreen-loader.md +58 -0
  88. package/docs/src/components/maz-gallery.md +85 -0
  89. package/docs/src/components/maz-icon.md +85 -0
  90. package/docs/src/components/maz-input-code.md +61 -0
  91. package/docs/src/components/maz-input-number.md +81 -0
  92. package/docs/src/components/maz-input-phone-number.md +867 -0
  93. package/docs/src/components/maz-input-price.md +58 -0
  94. package/docs/src/components/maz-input-tags.md +114 -0
  95. package/docs/src/components/maz-input.md +453 -0
  96. package/docs/src/components/maz-lazy-img.md +24 -0
  97. package/docs/src/components/maz-link.md +156 -0
  98. package/docs/src/components/maz-loading-bar.md +26 -0
  99. package/docs/src/components/maz-pagination.md +81 -0
  100. package/docs/src/components/maz-popover.md +1414 -0
  101. package/docs/src/components/maz-pull-to-refresh.md +49 -0
  102. package/docs/src/components/maz-radio-buttons.md +456 -0
  103. package/docs/src/components/maz-radio.md +141 -0
  104. package/docs/src/components/maz-reading-progress-bar.md +74 -0
  105. package/docs/src/components/maz-select-country.md +636 -0
  106. package/docs/src/components/maz-select.md +439 -0
  107. package/docs/src/components/maz-slider.md +191 -0
  108. package/docs/src/components/maz-spinner.md +93 -0
  109. package/docs/src/components/maz-stepper.md +418 -0
  110. package/docs/src/components/maz-switch.md +92 -0
  111. package/docs/src/components/maz-table.md +571 -0
  112. package/docs/src/components/maz-tabs.md +231 -0
  113. package/docs/src/components/maz-textarea.md +218 -0
  114. package/docs/src/composables/use-aos.md +34 -0
  115. package/docs/src/composables/use-breakpoints.md +35 -0
  116. package/docs/src/composables/use-dialog.md +88 -0
  117. package/docs/src/composables/use-display-names.md +174 -0
  118. package/docs/src/composables/use-form-validator.md +1149 -0
  119. package/docs/src/composables/use-idle-timeout.md +256 -0
  120. package/docs/src/composables/use-reading-time.md +168 -0
  121. package/docs/src/composables/use-string-matching.md +63 -0
  122. package/docs/src/composables/use-swipe.md +223 -0
  123. package/docs/src/composables/use-timer.md +130 -0
  124. package/docs/src/composables/use-toast.md +71 -0
  125. package/docs/src/composables/use-user-visibility.md +169 -0
  126. package/docs/src/composables/use-wait.md +62 -0
  127. package/docs/src/composables/use-window-size.md +18 -0
  128. package/docs/src/demo/DemoAuthPage.vue +178 -0
  129. package/docs/src/demo/DemoDashboardPage.vue +298 -0
  130. package/docs/src/demo/DemoProductPage.vue +135 -0
  131. package/docs/src/directives/click-outside.md +275 -0
  132. package/docs/src/directives/fullscreen-img.md +101 -0
  133. package/docs/src/directives/lazy-img.md +184 -0
  134. package/docs/src/directives/tooltip.md +458 -0
  135. package/docs/src/directives/zoom-img.md +127 -0
  136. package/docs/src/guide/cli.md +144 -0
  137. package/docs/src/guide/getting-started.md +284 -0
  138. package/docs/src/guide/icon-set.md +60 -0
  139. package/docs/src/guide/icons.md +481 -0
  140. package/docs/src/guide/mcp.md +210 -0
  141. package/docs/src/guide/migration-v4.md +898 -0
  142. package/docs/src/guide/nuxt.md +411 -0
  143. package/docs/src/guide/resolvers.md +697 -0
  144. package/docs/src/guide/themes.md +789 -0
  145. package/docs/src/guide/translations.md +1173 -0
  146. package/docs/src/guide/vue.md +243 -0
  147. package/docs/src/helpers/camel-case.md +14 -0
  148. package/docs/src/helpers/capitalize.md +51 -0
  149. package/docs/src/helpers/check-availability.md +14 -0
  150. package/docs/src/helpers/country-code-to-unicode-flag.md +213 -0
  151. package/docs/src/helpers/currency.md +67 -0
  152. package/docs/src/helpers/date.md +67 -0
  153. package/docs/src/helpers/debounce-callback.md +14 -0
  154. package/docs/src/helpers/debounce-id.md +14 -0
  155. package/docs/src/helpers/debounce.md +14 -0
  156. package/docs/src/helpers/get-country-flag-url.md +156 -0
  157. package/docs/src/helpers/is-client.md +14 -0
  158. package/docs/src/helpers/is-equal.md +14 -0
  159. package/docs/src/helpers/is-standalone-mode.md +14 -0
  160. package/docs/src/helpers/kebab-case.md +14 -0
  161. package/docs/src/helpers/normalize-string.md +14 -0
  162. package/docs/src/helpers/number.md +65 -0
  163. package/docs/src/helpers/pascal-case.md +14 -0
  164. package/docs/src/helpers/script-loader.md +14 -0
  165. package/docs/src/helpers/sleep.md +14 -0
  166. package/docs/src/helpers/snake-case.md +14 -0
  167. package/docs/src/helpers/throttle-id.md +14 -0
  168. package/docs/src/helpers/throttle.md +14 -0
  169. package/docs/src/index.md +555 -0
  170. package/docs/src/made-with-maz-ui.md +58 -0
  171. package/docs/src/plugins/aos.md +347 -0
  172. package/docs/src/plugins/dialog.md +411 -0
  173. package/docs/src/plugins/toast.md +349 -0
  174. package/docs/src/plugins/wait.md +109 -0
  175. package/package.json +84 -0
@@ -0,0 +1,1078 @@
1
+ ---
2
+ title: MazDatePicker
3
+ description: A powerful and flexible date picker component with support for single dates, date ranges, time selection, and extensive customization options
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ <!--@include: ./../.vitepress/mixins/getting-started.md-->
11
+
12
+ <!--@include: ./../.vitepress/mixins/translated-component.md-->
13
+
14
+ ## Prerequisites
15
+
16
+ To use this component, you need to install `dayjs`:
17
+
18
+ <NpmBadge package="dayjs" />
19
+
20
+ ::: code-group
21
+
22
+ ```bash [pnpm]
23
+ pnpm add dayjs
24
+ ```
25
+
26
+ ```bash
27
+ npm install dayjs
28
+ ```
29
+
30
+ ```bash [yarn]
31
+ yarn add dayjs
32
+ ```
33
+
34
+ :::
35
+
36
+ ## Table of Contents
37
+
38
+ - [Basic Usage](#basic-usage)
39
+ - [Date Formats](#date-formats)
40
+ - [Date Selection](#date-selection)
41
+ - [Time Selection](#time-selection)
42
+ - [Range Selection](#range-selection)
43
+ - [Internationalization](#internationalization)
44
+ - [Validation & Constraints](#validation--constraints)
45
+ - [Types](#types)
46
+ - [Props](#props)
47
+ - [Events](#events)
48
+ - [Slots](#slots)
49
+
50
+ ## Basic Usage
51
+
52
+ The simplest way to use MazDatePicker:
53
+
54
+ <ComponentDemo>
55
+ <MazDatePicker
56
+ v-model="basicDate"
57
+ label="Select a date"
58
+ placeholder="Choose your date"
59
+ />
60
+
61
+ <template #code>
62
+
63
+ ```vue
64
+ <template>
65
+ <MazDatePicker
66
+ v-model="date"
67
+ label="Select a date"
68
+ placeholder="Choose your date"
69
+ />
70
+ </template>
71
+
72
+ <script setup>
73
+ import { ref } from 'vue'
74
+
75
+ const date = ref()
76
+ </script>
77
+ ```
78
+
79
+ </template>
80
+ </ComponentDemo>
81
+
82
+ ## Date Formats
83
+
84
+ Understanding date formats is crucial for using MazDatePicker effectively. The component uses two different format concepts:
85
+
86
+ ### 1. Data Format (`format` prop)
87
+
88
+ This controls how dates are stored and transmitted in your `v-model`. Default is `'YYYY-MM-DD'`.
89
+
90
+ ### 2. Display Format (`inputFormat` prop)
91
+
92
+ This controls how dates appear in the input field using `Intl.DateTimeFormatOptions`.
93
+
94
+ <ComponentDemo>
95
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-3 maz-gap-4">
96
+ <MazDatePicker
97
+ v-model="formatExample1"
98
+ label="ISO Format (YYYY-MM-DD)"
99
+ format="YYYY-MM-DD"
100
+ :input-format="{ dateStyle: 'medium' }"
101
+ />
102
+ <MazDatePicker
103
+ v-model="formatExample2"
104
+ label="US Format (MM/DD/YYYY)"
105
+ format="MM/DD/YYYY"
106
+ :input-format="{ dateStyle: 'short' }"
107
+ />
108
+ <MazDatePicker
109
+ v-model="formatExample3"
110
+ label="European Format (DD-MM-YYYY)"
111
+ format="DD-MM-YYYY"
112
+ :input-format="{ dateStyle: 'medium' }"
113
+ />
114
+ </div>
115
+
116
+ <template #code>
117
+
118
+ ```vue
119
+ <template>
120
+ <!-- ISO Format (recommended) -->
121
+ <MazDatePicker
122
+ v-model="date1"
123
+ label="ISO Format (YYYY-MM-DD)"
124
+ format="YYYY-MM-DD"
125
+ :input-format="{ dateStyle: 'medium' }"
126
+ />
127
+
128
+ <!-- US Format -->
129
+ <MazDatePicker
130
+ v-model="date2"
131
+ label="US Format (MM/DD/YYYY)"
132
+ format="MM/DD/YYYY"
133
+ :input-format="{ dateStyle: 'short' }"
134
+ />
135
+
136
+ <!-- European Format -->
137
+ <MazDatePicker
138
+ v-model="date3"
139
+ label="European Format (DD-MM-YYYY)"
140
+ format="DD-MM-YYYY"
141
+ :input-format="{ dateStyle: 'medium' }"
142
+ />
143
+ </template>
144
+
145
+ <script setup>
146
+ import { ref } from 'vue'
147
+
148
+ const date1 = ref('2024-03-15') // ISO format
149
+ const date2 = ref('03/15/2024') // US format
150
+ const date3 = ref('15-03-2024') // European format
151
+ </script>
152
+ ```
153
+
154
+ </template>
155
+ </ComponentDemo>
156
+
157
+ ### Custom Display Transformation
158
+
159
+ Use `inputDateTransformer` to completely customize how dates appear in the input:
160
+
161
+ <ComponentDemo>
162
+ <MazDatePicker
163
+ v-model="transformedDate"
164
+ label="Custom Display Format"
165
+ :input-date-transformer="({ value }) => value ? `📅 ${dayjs(value).format('dddd, MMMM Do YYYY')}` : ''"
166
+ />
167
+
168
+ <template #code>
169
+
170
+ ```vue
171
+ <template>
172
+ <MazDatePicker
173
+ v-model="date"
174
+ label="Custom Display Format"
175
+ :input-date-transformer="transformDate"
176
+ />
177
+ </template>
178
+
179
+ <script setup>
180
+ import { ref } from 'vue'
181
+ import dayjs from 'dayjs'
182
+
183
+ const date = ref()
184
+
185
+ const transformDate = ({ value }) => {
186
+ return value ? `📅 ${dayjs(value).format('dddd, MMMM Do YYYY')}` : ''
187
+ }
188
+ </script>
189
+ ```
190
+
191
+ </template>
192
+ </ComponentDemo>
193
+
194
+ ## Date Selection
195
+
196
+ ### Standard Date Picker
197
+
198
+ <br />
199
+
200
+ <ComponentDemo>
201
+ <MazDatePicker
202
+ v-model="dateSelection"
203
+ label="Select Date"
204
+ color="primary"
205
+ auto-close
206
+ />
207
+
208
+ <template #code>
209
+
210
+ ```vue
211
+ <template>
212
+ <MazDatePicker
213
+ v-model="date"
214
+ label="Select Date"
215
+ color="primary"
216
+ auto-close
217
+ />
218
+ </template>
219
+
220
+ <script setup>
221
+ import { ref } from 'vue'
222
+
223
+ const date = ref()
224
+ </script>
225
+ ```
226
+
227
+ </template>
228
+ </ComponentDemo>
229
+
230
+ ### Inline Date Picker
231
+
232
+ Perfect for dashboards or when you want the calendar always visible:
233
+
234
+ <ComponentDemo>
235
+ <MazDatePicker
236
+ v-model="inlineDate"
237
+ inline
238
+ color="secondary"
239
+ />
240
+
241
+ <template #code>
242
+
243
+ ```vue
244
+ <template>
245
+ <MazDatePicker
246
+ v-model="date"
247
+ inline
248
+ color="secondary"
249
+ />
250
+ </template>
251
+
252
+ <script setup>
253
+ import { ref } from 'vue'
254
+
255
+ const date = ref()
256
+ </script>
257
+ ```
258
+
259
+ </template>
260
+ </ComponentDemo>
261
+
262
+ ### Double Calendar
263
+
264
+ Show two months at once for better date selection:
265
+
266
+ <ComponentDemo>
267
+ <MazDatePicker
268
+ v-model="doubleDate"
269
+ label="Double Calendar"
270
+ double
271
+ color="success"
272
+ />
273
+
274
+ <template #code>
275
+
276
+ ```vue
277
+ <template>
278
+ <MazDatePicker
279
+ v-model="date"
280
+ label="Double Calendar"
281
+ double
282
+ color="success"
283
+ />
284
+ </template>
285
+
286
+ <script setup>
287
+ import { ref } from 'vue'
288
+
289
+ const date = ref()
290
+ </script>
291
+ ```
292
+
293
+ </template>
294
+ </ComponentDemo>
295
+
296
+ ## Time Selection
297
+
298
+ ### Date + Time (24h format)
299
+
300
+ <ComponentDemo>
301
+ <MazDatePicker
302
+ v-model="dateTime24"
303
+ label="Date & Time (24h)"
304
+ format="YYYY-MM-DD HH:mm"
305
+ time
306
+ color="info"
307
+ />
308
+
309
+ <template #code>
310
+
311
+ ```vue
312
+ <template>
313
+ <MazDatePicker
314
+ v-model="dateTime"
315
+ label="Date & Time (24h)"
316
+ format="YYYY-MM-DD HH:mm"
317
+ time
318
+ color="info"
319
+ />
320
+ </template>
321
+
322
+ <script setup>
323
+ import { ref } from 'vue'
324
+
325
+ const dateTime = ref()
326
+ </script>
327
+ ```
328
+
329
+ </template>
330
+ </ComponentDemo>
331
+
332
+ ### Date + Time (12h format)
333
+
334
+ <ComponentDemo>
335
+ <MazDatePicker
336
+ v-model="dateTime12"
337
+ label="Date & Time (12h)"
338
+ format="YYYY-MM-DD hh:mm a"
339
+ time
340
+ color="warning"
341
+ />
342
+
343
+ <template #code>
344
+
345
+ ```vue
346
+ <template>
347
+ <MazDatePicker
348
+ v-model="dateTime"
349
+ label="Date & Time (12h)"
350
+ format="YYYY-MM-DD hh:mm a"
351
+ time
352
+ color="warning"
353
+ />
354
+ </template>
355
+
356
+ <script setup>
357
+ import { ref } from 'vue'
358
+
359
+ const dateTime = ref()
360
+ </script>
361
+ ```
362
+
363
+ </template>
364
+ </ComponentDemo>
365
+
366
+ ### Time Only Selection
367
+
368
+ <ComponentDemo>
369
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-2 maz-gap-4">
370
+ <MazDatePicker
371
+ v-model="timeOnly24"
372
+ label="Time Only (24h)"
373
+ format="HH:mm"
374
+ only-time
375
+ color="accent"
376
+ />
377
+ <MazDatePicker
378
+ v-model="timeOnly12"
379
+ label="Time Only (12h)"
380
+ format="hh:mm a"
381
+ only-time
382
+ color="destructive"
383
+ />
384
+ </div>
385
+
386
+ <template #code>
387
+
388
+ ```vue
389
+ <template>
390
+ <!-- 24h format -->
391
+ <MazDatePicker
392
+ v-model="time24"
393
+ label="Time Only (24h)"
394
+ format="HH:mm"
395
+ only-time
396
+ color="accent"
397
+ />
398
+
399
+ <!-- 12h format -->
400
+ <MazDatePicker
401
+ v-model="time12"
402
+ label="Time Only (12h)"
403
+ format="hh:mm a"
404
+ only-time
405
+ color="destructive"
406
+ />
407
+ </template>
408
+
409
+ <script setup>
410
+ import { ref } from 'vue'
411
+
412
+ const time24 = ref('14:30')
413
+ const time12 = ref('02:30 pm')
414
+ </script>
415
+ ```
416
+
417
+ </template>
418
+ </ComponentDemo>
419
+
420
+ ### Custom Minute Intervals
421
+
422
+ <ComponentDemo>
423
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-3 maz-gap-4">
424
+ <MazDatePicker
425
+ v-model="timeInterval1"
426
+ label="5min intervals"
427
+ format="HH:mm"
428
+ :minute-interval="5"
429
+ only-time
430
+ />
431
+ <MazDatePicker
432
+ v-model="timeInterval2"
433
+ label="15min intervals"
434
+ format="HH:mm"
435
+ :minute-interval="15"
436
+ only-time
437
+ />
438
+ <MazDatePicker
439
+ v-model="timeInterval3"
440
+ label="30min intervals"
441
+ format="HH:mm"
442
+ :minute-interval="30"
443
+ only-time
444
+ />
445
+ </div>
446
+
447
+ <template #code>
448
+
449
+ ```vue
450
+ <template>
451
+ <MazDatePicker
452
+ v-model="time1"
453
+ label="5min intervals"
454
+ format="HH:mm"
455
+ :minute-interval="5"
456
+ only-time
457
+ />
458
+
459
+ <MazDatePicker
460
+ v-model="time2"
461
+ label="15min intervals"
462
+ format="HH:mm"
463
+ :minute-interval="15"
464
+ only-time
465
+ />
466
+
467
+ <MazDatePicker
468
+ v-model="time3"
469
+ label="30min intervals"
470
+ format="HH:mm"
471
+ :minute-interval="30"
472
+ only-time
473
+ />
474
+ </template>
475
+
476
+ <script setup>
477
+ import { ref } from 'vue'
478
+
479
+ const time1 = ref()
480
+ const time2 = ref()
481
+ const time3 = ref()
482
+ </script>
483
+ ```
484
+
485
+ </template>
486
+ </ComponentDemo>
487
+
488
+ ## Range Selection
489
+
490
+ For selecting date ranges, pass an object with `start` and `end` properties:
491
+
492
+ <ComponentDemo>
493
+ <MazDatePicker
494
+ v-model="dateRange"
495
+ label="Select Date Range"
496
+ range
497
+ double
498
+ auto-close
499
+ color="primary"
500
+ />
501
+
502
+ <template #code>
503
+
504
+ ```vue
505
+ <template>
506
+ <MazDatePicker
507
+ v-model="range"
508
+ label="Select Date Range"
509
+ range
510
+ double
511
+ auto-close
512
+ color="primary"
513
+ />
514
+ </template>
515
+
516
+ <script setup>
517
+ import { ref } from 'vue'
518
+
519
+ const range = ref({
520
+ start: undefined,
521
+ end: undefined
522
+ })
523
+ </script>
524
+ ```
525
+
526
+ </template>
527
+ </ComponentDemo>
528
+
529
+ ### Range with Shortcuts
530
+
531
+ Provide predefined shortcuts for common date ranges:
532
+
533
+ <ComponentDemo>
534
+ <MazDatePicker
535
+ v-model="rangeWithShortcuts"
536
+ label="Range with Shortcuts"
537
+ range
538
+ double
539
+ :shortcuts="customShortcuts"
540
+ color="secondary"
541
+ />
542
+
543
+ <template #code>
544
+
545
+ ```vue
546
+ <template>
547
+ <MazDatePicker
548
+ v-model="range"
549
+ label="Range with Shortcuts"
550
+ range
551
+ double
552
+ :shortcuts="shortcuts"
553
+ color="secondary"
554
+ />
555
+ </template>
556
+
557
+ <script setup>
558
+ import { ref } from 'vue'
559
+ import dayjs from 'dayjs'
560
+
561
+ const range = ref({
562
+ start: undefined,
563
+ end: undefined
564
+ })
565
+
566
+ const shortcuts = [
567
+ {
568
+ label: 'Today',
569
+ identifier: 'today',
570
+ value: {
571
+ start: dayjs().format('YYYY-MM-DD'),
572
+ end: dayjs().format('YYYY-MM-DD')
573
+ }
574
+ },
575
+ {
576
+ label: 'Last 7 days',
577
+ identifier: 'last7days',
578
+ value: {
579
+ start: dayjs().subtract(6, 'day').format('YYYY-MM-DD'),
580
+ end: dayjs().format('YYYY-MM-DD')
581
+ }
582
+ },
583
+ {
584
+ label: 'This month',
585
+ identifier: 'thisMonth',
586
+ value: {
587
+ start: dayjs().startOf('month').format('YYYY-MM-DD'),
588
+ end: dayjs().endOf('month').format('YYYY-MM-DD')
589
+ }
590
+ }
591
+ ]
592
+ </script>
593
+ ```
594
+
595
+ </template>
596
+ </ComponentDemo>
597
+
598
+ ### Property `shortcuts`
599
+
600
+ #### Model
601
+
602
+ ```ts
603
+ interface MazDatePickerShortcut {
604
+ identifier: string // should be uniq
605
+ label: string
606
+ value: {
607
+ start: string
608
+ end: string
609
+ }
610
+ }
611
+
612
+ type MazDatePickerShortcuts = MazDatePickerShortcut[]
613
+ ```
614
+
615
+ #### Example
616
+
617
+ ```ts
618
+ import type { MazDatePickerShortcut } from 'maz-ui/components'
619
+
620
+ const shortcuts: MazDatePickerShortcut[] = [{
621
+ label: 'Next month',
622
+ identifier: 'nextMonth',
623
+ value: {
624
+ start: dayjs().add(1, 'month').set('date', 1).format('YYYY-MM-DD'),
625
+ end: dayjs()
626
+ .add(1, 'month')
627
+ .set('date', dayjs().add(1, 'month').daysInMonth())
628
+ .format('YYYY-MM-DD'),
629
+ },
630
+ }]
631
+ ```
632
+
633
+ ::: details View default shortcuts
634
+
635
+ ```ts
636
+ const shortcuts = [
637
+ {
638
+ label: 'Last 7 days',
639
+ identifier: 'last7Days',
640
+ value: {
641
+ start: dayjs().subtract(6, 'day').format('YYYY-MM-DD'),
642
+ end: dayjs().format('YYYY-MM-DD'),
643
+ },
644
+ },
645
+ {
646
+ label: 'Last 30 days',
647
+ identifier: 'last30Days',
648
+ value: {
649
+ start: dayjs().subtract(29, 'day').format('YYYY-MM-DD'),
650
+ end: dayjs().format('YYYY-MM-DD'),
651
+ },
652
+ },
653
+ {
654
+ label: 'This week',
655
+ identifier: 'thisWeek',
656
+ value: {
657
+ start: dayjs().startOf('week').format('YYYY-MM-DD'),
658
+ end: dayjs().endOf('week').format('YYYY-MM-DD'),
659
+ },
660
+ },
661
+ {
662
+ label: 'Last week',
663
+ identifier: 'lastWeek',
664
+ value: {
665
+ start: dayjs()
666
+ .subtract(1, 'week')
667
+ .startOf('week')
668
+ .format('YYYY-MM-DD'),
669
+ end: dayjs().subtract(1, 'week').endOf('week').format('YYYY-MM-DD'),
670
+ },
671
+ },
672
+ {
673
+ label: 'This month',
674
+ identifier: 'thisMonth',
675
+ value: {
676
+ start: dayjs().set('date', 1).format('YYYY-MM-DD'),
677
+ end: dayjs()
678
+ .set('date', dayjs().daysInMonth())
679
+ .format('YYYY-MM-DD'),
680
+ },
681
+ },
682
+ {
683
+ label: 'This year',
684
+ identifier: 'thisYear',
685
+ value: {
686
+ start: dayjs().startOf('year').format('YYYY-MM-DD'),
687
+ end: dayjs().endOf('year').format('YYYY-MM-DD'),
688
+ },
689
+ },
690
+ {
691
+ label: 'Last year',
692
+ identifier: 'lastYear',
693
+ value: {
694
+ start: dayjs()
695
+ .subtract(1, 'year')
696
+ .startOf('year')
697
+ .format('YYYY-MM-DD'),
698
+ end: dayjs().subtract(1, 'year').endOf('year').format('YYYY-MM-DD'),
699
+ },
700
+ },
701
+ ]
702
+ ```
703
+
704
+ :::
705
+
706
+ ## Validation & Constraints
707
+
708
+ ### Min/Max Dates
709
+
710
+ <br />
711
+
712
+ <ComponentDemo>
713
+ <MazDatePicker
714
+ v-model="constrainedDate"
715
+ label="Limited Date Range"
716
+ :min-date="minMaxDates.min"
717
+ :max-date="minMaxDates.max"
718
+ color="info"
719
+ />
720
+ <p class="maz-text-sm maz-text-muted maz-mt-2">
721
+ Min: {{ minMaxDates.min }} | Max: {{ minMaxDates.max }}
722
+ </p>
723
+
724
+ <template #code>
725
+
726
+ ```vue
727
+ <template>
728
+ <MazDatePicker
729
+ v-model="date"
730
+ label="Limited Date Range"
731
+ :min-date="minDate"
732
+ :max-date="maxDate"
733
+ color="info"
734
+ />
735
+ </template>
736
+
737
+ <script setup>
738
+ import { ref } from 'vue'
739
+ import dayjs from 'dayjs'
740
+
741
+ const date = ref()
742
+ const minDate = dayjs().subtract(30, 'day').format('YYYY-MM-DD')
743
+ const maxDate = dayjs().add(30, 'day').format('YYYY-MM-DD')
744
+ </script>
745
+ ```
746
+
747
+ </template>
748
+ </ComponentDemo>
749
+
750
+ ### Disabled Days & Dates
751
+
752
+ <br />
753
+
754
+ <ComponentDemo>
755
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-2 maz-gap-4">
756
+ <MazDatePicker
757
+ v-model="weekendDisabled"
758
+ label="Weekends Disabled"
759
+ :min-date="dayjs().subtract(1, 'day').format('YYYY-MM-DD')"
760
+ :disabled-weekly="[0, 6]"
761
+ color="warning"
762
+ />
763
+ <MazDatePicker
764
+ v-model="specificDatesDisabled"
765
+ label="Holidays Disabled"
766
+ :disabled-dates="holidays"
767
+ color="destructive"
768
+ />
769
+ </div>
770
+
771
+ <template #code>
772
+
773
+ ```vue
774
+ <template>
775
+ <!-- Disable weekends -->
776
+ <MazDatePicker
777
+ v-model="date1"
778
+ label="Weekends Disabled"
779
+ :disabled-weekly="[0, 6]"
780
+ color="warning"
781
+ />
782
+
783
+ <!-- Disable specific dates -->
784
+ <MazDatePicker
785
+ v-model="date2"
786
+ label="Holidays Disabled"
787
+ :disabled-dates="holidays"
788
+ color="destructive"
789
+ />
790
+ </template>
791
+
792
+ <script setup>
793
+ import { ref } from 'vue'
794
+
795
+ const date1 = ref()
796
+ const date2 = ref()
797
+
798
+ // 0 = Sunday, 6 = Saturday
799
+ const weekends = [0, 6]
800
+
801
+ // Specific holiday dates
802
+ const holidays = [
803
+ dayjs().subtract(2, 'day').format('YYYY-MM-DD'),
804
+ dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
805
+ dayjs().format('YYYY-MM-DD'),
806
+ dayjs().add(1, 'day').format('YYYY-MM-DD'),
807
+ dayjs().add(2, 'day').format('YYYY-MM-DD'),
808
+ dayjs().add(3, 'day').format('YYYY-MM-DD'),
809
+ dayjs().add(4, 'day').format('YYYY-MM-DD'),
810
+ ]
811
+ </script>
812
+ ```
813
+
814
+ </template>
815
+ </ComponentDemo>
816
+
817
+ ### Disabled Hours
818
+
819
+ <br />
820
+
821
+ <ComponentDemo>
822
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-2 maz-gap-4">
823
+ <MazDatePicker
824
+ v-model="dateTime"
825
+ format="YYYY-MM-DD hh:mm a"
826
+ time
827
+ label="Disabled Hours"
828
+ :disabled-hours="disabledHours"
829
+ color="info"
830
+ />
831
+ <MazDatePicker
832
+ v-model="time"
833
+ format="HH:mm"
834
+ only-time
835
+ label="Disabled Hours"
836
+ :disabled-hours="disabledHours"
837
+ color="info"
838
+ />
839
+ </div>
840
+
841
+ <template #code>
842
+
843
+ ```vue
844
+ <template>
845
+ <MazDatePicker
846
+ v-model="dateTime"
847
+ format="YYYY-MM-DD hh:mm a"
848
+ time
849
+ label="Disabled Hours"
850
+ :disabled-hours="disabledHours"
851
+ color="info"
852
+ />
853
+
854
+ <MazDatePicker
855
+ v-model="time"
856
+ format="HH:mm"
857
+ only-time
858
+ label="Disabled Hours"
859
+ :disabled-hours="disabledHours"
860
+ color="info"
861
+ />
862
+ </template>
863
+
864
+ <script setup>
865
+ import { ref } from 'vue'
866
+
867
+ const date = ref()
868
+ const time = ref()
869
+
870
+ const disabledHours = [0, 1, 2, 11, 22, 23]
871
+ </script>
872
+ ```
873
+
874
+ </template>
875
+ </ComponentDemo>
876
+
877
+ ## Internationalization
878
+
879
+ MazDatePicker supports full internationalization. **By default, it uses the locale from the MazTranslations plugin**, but you can override it:
880
+
881
+ <ComponentDemo>
882
+ <div class="maz-grid maz-grid-cols-1 mob-l:maz-grid-cols-2 maz-gap-4">
883
+ <MazDatePicker
884
+ v-model="frenchDate"
885
+ label="French Locale"
886
+ locale="fr-FR"
887
+ :first-day-of-week="1"
888
+ color="primary"
889
+ />
890
+ <MazDatePicker
891
+ v-model="germanDate"
892
+ label="German Locale"
893
+ locale="de-DE"
894
+ :first-day-of-week="1"
895
+ color="secondary"
896
+ />
897
+ <MazDatePicker
898
+ v-model="japaneseDate"
899
+ label="Japanese Locale"
900
+ locale="ja-JP"
901
+ color="accent"
902
+ />
903
+ <MazDatePicker
904
+ v-model="arabicDate"
905
+ label="Arabic Locale"
906
+ locale="ar-SA"
907
+ :first-day-of-week="6"
908
+ color="warning"
909
+ />
910
+ </div>
911
+
912
+ <template #code>
913
+
914
+ ```vue
915
+ <template>
916
+ <!-- French -->
917
+ <MazDatePicker
918
+ v-model="frenchDate"
919
+ label="French Locale"
920
+ locale="fr-FR"
921
+ :first-day-of-week="1"
922
+ color="primary"
923
+ />
924
+
925
+ <!-- German -->
926
+ <MazDatePicker
927
+ v-model="germanDate"
928
+ label="German Locale"
929
+ locale="de-DE"
930
+ :first-day-of-week="1"
931
+ color="secondary"
932
+ />
933
+
934
+ <!-- Japanese -->
935
+ <MazDatePicker
936
+ v-model="japaneseDate"
937
+ label="Japanese Locale"
938
+ locale="ja-JP"
939
+ color="accent"
940
+ />
941
+
942
+ <!-- Arabic -->
943
+ <MazDatePicker
944
+ v-model="arabicDate"
945
+ label="Arabic Locale"
946
+ locale="ar-SA"
947
+ :first-day-of-week="6"
948
+ color="warning"
949
+ />
950
+ </template>
951
+
952
+ <script setup>
953
+ import { ref } from 'vue'
954
+
955
+ const frenchDate = ref()
956
+ const germanDate = ref()
957
+ const japaneseDate = ref()
958
+ const arabicDate = ref()
959
+ </script>
960
+ ```
961
+
962
+ </template>
963
+ </ComponentDemo>
964
+
965
+ ## Types
966
+
967
+ ```typescript
968
+ // Value types
969
+ type MazDatePickerValue = string | undefined | MazDatePickerPartialRangeValue
970
+
971
+ interface MazDatePickerRangeValue {
972
+ start: string
973
+ end: string
974
+ }
975
+
976
+ type MazDatePickerPartialRangeValue = Partial<MazDatePickerRangeValue>
977
+
978
+ // Shortcut type
979
+ interface MazDatePickerShortcut {
980
+ identifier: string
981
+ label: string
982
+ value: {
983
+ start: string
984
+ end: string
985
+ }
986
+ }
987
+ ```
988
+
989
+ <!--@include: ./../.vitepress/mixins/maz-input-props.md-->
990
+
991
+ <!--@include: ./../../.vitepress/generated-docs/maz-date-picker.doc.md-->
992
+
993
+ <script setup lang="ts">
994
+ import { ref } from 'vue'
995
+ import dayjs from 'dayjs'
996
+
997
+ // Basic examples
998
+ const basicDate = ref()
999
+ const formatExample1 = ref('2024-03-15')
1000
+ const formatExample2 = ref('03/15/2024')
1001
+ const formatExample3 = ref('15-03-2024')
1002
+ const transformedDate = ref()
1003
+ const newDateValue = ref()
1004
+ // Date selection
1005
+ const dateSelection = ref()
1006
+ const inlineDate = ref()
1007
+ const doubleDate = ref()
1008
+
1009
+ // Time selection
1010
+ const dateTime24 = ref()
1011
+ const dateTime12 = ref()
1012
+ const timeOnly24 = ref('14:30')
1013
+ const timeOnly12 = ref('02:30 pm')
1014
+ const timeInterval1 = ref()
1015
+ const timeInterval2 = ref()
1016
+ const timeInterval3 = ref()
1017
+
1018
+ // Range selection
1019
+ const dateRange = ref({ start: undefined, end: undefined })
1020
+ const rangeWithShortcuts = ref({ start: undefined, end: undefined })
1021
+
1022
+ // Internationalization
1023
+ const frenchDate = ref()
1024
+ const germanDate = ref()
1025
+ const japaneseDate = ref()
1026
+ const arabicDate = ref()
1027
+
1028
+ // Validation
1029
+ const constrainedDate = ref()
1030
+ const minMaxDates = {
1031
+ min: dayjs().format('YYYY-MM-DD'),
1032
+ max: dayjs().add(20, 'day').format('YYYY-MM-DD')
1033
+ }
1034
+ const weekendDisabled = ref()
1035
+ const specificDatesDisabled = ref()
1036
+ const holidays = [
1037
+ dayjs().subtract(2, 'day').format('YYYY-MM-DD'),
1038
+ dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
1039
+ dayjs().format('YYYY-MM-DD'),
1040
+ dayjs().add(1, 'day').format('YYYY-MM-DD'),
1041
+ dayjs().add(2, 'day').format('YYYY-MM-DD'),
1042
+ dayjs().add(3, 'day').format('YYYY-MM-DD'),
1043
+ dayjs().add(4, 'day').format('YYYY-MM-DD'),
1044
+ ]
1045
+
1046
+ // Disabled hours
1047
+ const dateTime = ref()
1048
+ const time = ref()
1049
+ const disabledHours = [0, 1, 2, 11, 22, 23]
1050
+
1051
+ // Shortcuts
1052
+ const customShortcuts = [
1053
+ {
1054
+ label: 'Today',
1055
+ identifier: 'today',
1056
+ value: {
1057
+ start: dayjs().format('YYYY-MM-DD'),
1058
+ end: dayjs().format('YYYY-MM-DD')
1059
+ }
1060
+ },
1061
+ {
1062
+ label: 'Last 7 days',
1063
+ identifier: 'last7days',
1064
+ value: {
1065
+ start: dayjs().subtract(6, 'day').format('YYYY-MM-DD'),
1066
+ end: dayjs().format('YYYY-MM-DD')
1067
+ }
1068
+ },
1069
+ {
1070
+ label: 'This month',
1071
+ identifier: 'thisMonth',
1072
+ value: {
1073
+ start: dayjs().startOf('month').format('YYYY-MM-DD'),
1074
+ end: dayjs().endOf('month').format('YYYY-MM-DD')
1075
+ }
1076
+ }
1077
+ ]
1078
+ </script>