@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.
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/bin/maz-ui-mcp.mjs +7 -0
- package/dist/mcp.d.mts +13 -0
- package/dist/mcp.d.ts +13 -0
- package/dist/mcp.mjs +586 -0
- package/docs/generated-docs/maz-accordion.doc.md +21 -0
- package/docs/generated-docs/maz-animated-counter.doc.md +17 -0
- package/docs/generated-docs/maz-animated-element.doc.md +14 -0
- package/docs/generated-docs/maz-animated-text.doc.md +14 -0
- package/docs/generated-docs/maz-avatar.doc.md +44 -0
- package/docs/generated-docs/maz-backdrop.doc.md +61 -0
- package/docs/generated-docs/maz-badge.doc.md +16 -0
- package/docs/generated-docs/maz-bottom-sheet.doc.md +21 -0
- package/docs/generated-docs/maz-btn.doc.md +30 -0
- package/docs/generated-docs/maz-card-spotlight.doc.md +16 -0
- package/docs/generated-docs/maz-card.doc.md +39 -0
- package/docs/generated-docs/maz-carousel.doc.md +16 -0
- package/docs/generated-docs/maz-chart.doc.md +10 -0
- package/docs/generated-docs/maz-checkbox.doc.md +34 -0
- package/docs/generated-docs/maz-checklist.doc.md +30 -0
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +27 -0
- package/docs/generated-docs/maz-date-picker.doc.md +52 -0
- package/docs/generated-docs/maz-dialog-confirm.doc.md +24 -0
- package/docs/generated-docs/maz-dialog.doc.md +22 -0
- package/docs/generated-docs/maz-drawer.doc.md +26 -0
- package/docs/generated-docs/maz-dropdown.doc.md +42 -0
- package/docs/generated-docs/maz-dropzone.doc.md +82 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +12 -0
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +13 -0
- package/docs/generated-docs/maz-gallery.doc.md +17 -0
- package/docs/generated-docs/maz-icon.doc.md +18 -0
- package/docs/generated-docs/maz-input-code.doc.md +25 -0
- package/docs/generated-docs/maz-input-number.doc.md +31 -0
- package/docs/generated-docs/maz-input-phone-number.doc.md +56 -0
- package/docs/generated-docs/maz-input-price.doc.md +26 -0
- package/docs/generated-docs/maz-input-tags.doc.md +24 -0
- package/docs/generated-docs/maz-input.doc.md +54 -0
- package/docs/generated-docs/maz-lazy-img.doc.md +31 -0
- package/docs/generated-docs/maz-link.doc.md +31 -0
- package/docs/generated-docs/maz-loading-bar.doc.md +6 -0
- package/docs/generated-docs/maz-pagination.doc.md +22 -0
- package/docs/generated-docs/maz-popover.doc.md +70 -0
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +31 -0
- package/docs/generated-docs/maz-radio-buttons.doc.md +33 -0
- package/docs/generated-docs/maz-radio.doc.md +33 -0
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +18 -0
- package/docs/generated-docs/maz-select-country.doc.md +44 -0
- package/docs/generated-docs/maz-select.doc.md +65 -0
- package/docs/generated-docs/maz-slider.doc.md +20 -0
- package/docs/generated-docs/maz-spinner.doc.md +6 -0
- package/docs/generated-docs/maz-stepper.doc.md +29 -0
- package/docs/generated-docs/maz-switch.doc.md +31 -0
- package/docs/generated-docs/maz-table-cell.doc.md +5 -0
- package/docs/generated-docs/maz-table-row.doc.md +11 -0
- package/docs/generated-docs/maz-table-title.doc.md +5 -0
- package/docs/generated-docs/maz-table.doc.md +66 -0
- package/docs/generated-docs/maz-tabs-bar.doc.md +18 -0
- package/docs/generated-docs/maz-tabs-content-item.doc.md +11 -0
- package/docs/generated-docs/maz-tabs-content.doc.md +5 -0
- package/docs/generated-docs/maz-tabs.doc.md +17 -0
- package/docs/generated-docs/maz-textarea.doc.md +41 -0
- package/docs/src/components/index.md +8 -0
- package/docs/src/components/maz-accordion.md +80 -0
- package/docs/src/components/maz-animated-counter.md +124 -0
- package/docs/src/components/maz-animated-element.md +36 -0
- package/docs/src/components/maz-animated-text.md +36 -0
- package/docs/src/components/maz-avatar.md +179 -0
- package/docs/src/components/maz-backdrop.md +16 -0
- package/docs/src/components/maz-badge.md +222 -0
- package/docs/src/components/maz-bottom-sheet.md +398 -0
- package/docs/src/components/maz-btn.md +526 -0
- package/docs/src/components/maz-card-spotlight.md +163 -0
- package/docs/src/components/maz-card.md +447 -0
- package/docs/src/components/maz-carousel.md +127 -0
- package/docs/src/components/maz-chart.md +346 -0
- package/docs/src/components/maz-checkbox.md +168 -0
- package/docs/src/components/maz-checklist.md +414 -0
- package/docs/src/components/maz-circular-progress-bar.md +147 -0
- package/docs/src/components/maz-date-picker.md +1078 -0
- package/docs/src/components/maz-dialog-confirm.md +240 -0
- package/docs/src/components/maz-dialog.md +208 -0
- package/docs/src/components/maz-drawer.md +177 -0
- package/docs/src/components/maz-dropdown.md +650 -0
- package/docs/src/components/maz-dropzone.md +442 -0
- package/docs/src/components/maz-expand-animation.md +99 -0
- package/docs/src/components/maz-fullscreen-loader.md +58 -0
- package/docs/src/components/maz-gallery.md +85 -0
- package/docs/src/components/maz-icon.md +85 -0
- package/docs/src/components/maz-input-code.md +61 -0
- package/docs/src/components/maz-input-number.md +81 -0
- package/docs/src/components/maz-input-phone-number.md +867 -0
- package/docs/src/components/maz-input-price.md +58 -0
- package/docs/src/components/maz-input-tags.md +114 -0
- package/docs/src/components/maz-input.md +453 -0
- package/docs/src/components/maz-lazy-img.md +24 -0
- package/docs/src/components/maz-link.md +156 -0
- package/docs/src/components/maz-loading-bar.md +26 -0
- package/docs/src/components/maz-pagination.md +81 -0
- package/docs/src/components/maz-popover.md +1414 -0
- package/docs/src/components/maz-pull-to-refresh.md +49 -0
- package/docs/src/components/maz-radio-buttons.md +456 -0
- package/docs/src/components/maz-radio.md +141 -0
- package/docs/src/components/maz-reading-progress-bar.md +74 -0
- package/docs/src/components/maz-select-country.md +636 -0
- package/docs/src/components/maz-select.md +439 -0
- package/docs/src/components/maz-slider.md +191 -0
- package/docs/src/components/maz-spinner.md +93 -0
- package/docs/src/components/maz-stepper.md +418 -0
- package/docs/src/components/maz-switch.md +92 -0
- package/docs/src/components/maz-table.md +571 -0
- package/docs/src/components/maz-tabs.md +231 -0
- package/docs/src/components/maz-textarea.md +218 -0
- package/docs/src/composables/use-aos.md +34 -0
- package/docs/src/composables/use-breakpoints.md +35 -0
- package/docs/src/composables/use-dialog.md +88 -0
- package/docs/src/composables/use-display-names.md +174 -0
- package/docs/src/composables/use-form-validator.md +1149 -0
- package/docs/src/composables/use-idle-timeout.md +256 -0
- package/docs/src/composables/use-reading-time.md +168 -0
- package/docs/src/composables/use-string-matching.md +63 -0
- package/docs/src/composables/use-swipe.md +223 -0
- package/docs/src/composables/use-timer.md +130 -0
- package/docs/src/composables/use-toast.md +71 -0
- package/docs/src/composables/use-user-visibility.md +169 -0
- package/docs/src/composables/use-wait.md +62 -0
- package/docs/src/composables/use-window-size.md +18 -0
- package/docs/src/demo/DemoAuthPage.vue +178 -0
- package/docs/src/demo/DemoDashboardPage.vue +298 -0
- package/docs/src/demo/DemoProductPage.vue +135 -0
- package/docs/src/directives/click-outside.md +275 -0
- package/docs/src/directives/fullscreen-img.md +101 -0
- package/docs/src/directives/lazy-img.md +184 -0
- package/docs/src/directives/tooltip.md +458 -0
- package/docs/src/directives/zoom-img.md +127 -0
- package/docs/src/guide/cli.md +144 -0
- package/docs/src/guide/getting-started.md +284 -0
- package/docs/src/guide/icon-set.md +60 -0
- package/docs/src/guide/icons.md +481 -0
- package/docs/src/guide/mcp.md +210 -0
- package/docs/src/guide/migration-v4.md +898 -0
- package/docs/src/guide/nuxt.md +411 -0
- package/docs/src/guide/resolvers.md +697 -0
- package/docs/src/guide/themes.md +789 -0
- package/docs/src/guide/translations.md +1173 -0
- package/docs/src/guide/vue.md +243 -0
- package/docs/src/helpers/camel-case.md +14 -0
- package/docs/src/helpers/capitalize.md +51 -0
- package/docs/src/helpers/check-availability.md +14 -0
- package/docs/src/helpers/country-code-to-unicode-flag.md +213 -0
- package/docs/src/helpers/currency.md +67 -0
- package/docs/src/helpers/date.md +67 -0
- package/docs/src/helpers/debounce-callback.md +14 -0
- package/docs/src/helpers/debounce-id.md +14 -0
- package/docs/src/helpers/debounce.md +14 -0
- package/docs/src/helpers/get-country-flag-url.md +156 -0
- package/docs/src/helpers/is-client.md +14 -0
- package/docs/src/helpers/is-equal.md +14 -0
- package/docs/src/helpers/is-standalone-mode.md +14 -0
- package/docs/src/helpers/kebab-case.md +14 -0
- package/docs/src/helpers/normalize-string.md +14 -0
- package/docs/src/helpers/number.md +65 -0
- package/docs/src/helpers/pascal-case.md +14 -0
- package/docs/src/helpers/script-loader.md +14 -0
- package/docs/src/helpers/sleep.md +14 -0
- package/docs/src/helpers/snake-case.md +14 -0
- package/docs/src/helpers/throttle-id.md +14 -0
- package/docs/src/helpers/throttle.md +14 -0
- package/docs/src/index.md +555 -0
- package/docs/src/made-with-maz-ui.md +58 -0
- package/docs/src/plugins/aos.md +347 -0
- package/docs/src/plugins/dialog.md +411 -0
- package/docs/src/plugins/toast.md +349 -0
- package/docs/src/plugins/wait.md +109 -0
- package/package.json +84 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazDropzone
|
|
3
|
+
description: MazDropzone is a powerful and flexible file upload component with drag & drop support, progress tracking, and customizable UI. Perfect for handling single or multiple file uploads in your Vue applications.
|
|
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
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- 🎯 Drag & drop support
|
|
17
|
+
- 📁 Single or multiple file uploads
|
|
18
|
+
- 🖼️ Image preview thumbnails
|
|
19
|
+
- 🚀 Auto upload support
|
|
20
|
+
- ⚡ Async file processing
|
|
21
|
+
- 🎨 Fully customizable UI
|
|
22
|
+
- 🌐 Support for various file types
|
|
23
|
+
- ⚙️ Extensive configuration options
|
|
24
|
+
- 🔒 File validation (size, type, count)
|
|
25
|
+
- 🌍 Internationalization support
|
|
26
|
+
|
|
27
|
+
## Error codes
|
|
28
|
+
|
|
29
|
+
| Error Code | Description | Trigger |
|
|
30
|
+
| ---------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
31
|
+
| `FILE_SIZE_EXCEEDED` | File size exceeds the allowed limit | When a file is larger than `maxFileSize` (in MB) |
|
|
32
|
+
| `FILE_SIZE_TOO_SMALL` | File size is below the minimum limit | When a file is smaller than `minFileSize` (in MB) |
|
|
33
|
+
| `MAX_FILES_EXCEEDED` | Maximum number of allowed files exceeded | When trying to add more files than `maxFiles` or more than 1 file if `multiple=false` |
|
|
34
|
+
| `FILE_TYPE_NOT_ALLOWED` | File type is not allowed | When the file's MIME type doesn't match the specified `dataTypes` |
|
|
35
|
+
| `FILE_DUPLICATED` | An identical file already exists | When `allowDuplicates=false` and a file with the same name, size and type already exists |
|
|
36
|
+
| `NO_FILES_TO_UPLOAD` | No files to upload | When starting upload but there are no files in the dropzone |
|
|
37
|
+
| `FILE_UPLOAD_ERROR` | Error during individual file upload | When uploading a specific file fails (`single` mode) |
|
|
38
|
+
| `FILE_UPLOAD_ERROR_MULTIPLE` | Error during batch upload | When uploading multiple files fails (`multiple` mode) |
|
|
39
|
+
| `NO_URL` | No upload URL configured | When attempting auto-upload without defining the `url` prop |
|
|
40
|
+
|
|
41
|
+
### Error handling example
|
|
42
|
+
|
|
43
|
+
::: details View code
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup>
|
|
47
|
+
function handleError({ code, files }) {
|
|
48
|
+
switch (code) {
|
|
49
|
+
case 'FILE_SIZE_EXCEEDED':
|
|
50
|
+
console.log('File too large:', files[0].name)
|
|
51
|
+
break
|
|
52
|
+
case 'FILE_TYPE_NOT_ALLOWED':
|
|
53
|
+
console.log('File type not allowed:', files[0].type)
|
|
54
|
+
break
|
|
55
|
+
case 'MAX_FILES_EXCEEDED':
|
|
56
|
+
console.log('Too many files selected')
|
|
57
|
+
break
|
|
58
|
+
// ...
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<MazDropzone
|
|
65
|
+
:max-file-size="5"
|
|
66
|
+
:max-files="3"
|
|
67
|
+
:data-types="['image/*', 'application/pdf']"
|
|
68
|
+
:allow-duplicates="false"
|
|
69
|
+
@error="handleError"
|
|
70
|
+
/>
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
:::
|
|
75
|
+
|
|
76
|
+
## Basic Usage
|
|
77
|
+
|
|
78
|
+
<ComponentDemo expanded>
|
|
79
|
+
<MazDropzone
|
|
80
|
+
ref="dropzone"
|
|
81
|
+
v-model="files"
|
|
82
|
+
:max-file-size="3"
|
|
83
|
+
:max-files="5"
|
|
84
|
+
@upload-success="onUploadSuccess"
|
|
85
|
+
@upload-error="onUploadError"
|
|
86
|
+
@error="onError"
|
|
87
|
+
url="https://httpbin.org/post"
|
|
88
|
+
:request-options="{
|
|
89
|
+
headers: { 'My-Awesome-Header': 'header value' },
|
|
90
|
+
}"
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
<br />
|
|
94
|
+
<div class="maz-text-center">
|
|
95
|
+
<MazBtn @click="dropzone?.uploadFiles()" :loading="dropzone?.isUploading">
|
|
96
|
+
Upload Files
|
|
97
|
+
</MazBtn>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<template #code>
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<script setup lang="ts">
|
|
104
|
+
import { useToast } from 'maz-ui'
|
|
105
|
+
import { ref } from 'vue'
|
|
106
|
+
|
|
107
|
+
const toast = useToast()
|
|
108
|
+
|
|
109
|
+
const files = ref<File[]>([])
|
|
110
|
+
const dropzone = ref<InstanceType<typeof MazDropzone>>()
|
|
111
|
+
|
|
112
|
+
function onUploadSuccess({ file, response }) {
|
|
113
|
+
console.log('Upload success:', file, response)
|
|
114
|
+
toast.success(`File ${file.name} uploaded successfully`)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function onUploadError({ file, code, error }) {
|
|
118
|
+
console.error('Upload failed:', file, code, error)
|
|
119
|
+
toast.error(`File ${file.name} upload failed: ${code} - ${error}`)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function onError({ files, event, code }) {
|
|
123
|
+
console.error('Error:', files, event, code)
|
|
124
|
+
toast.error(`${files?.length} files upload failed: ${code} - ${files?.map(file => file.name).join(', ')}`)
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<MazDropzone
|
|
130
|
+
v-model="files"
|
|
131
|
+
:data-types="['image/*']"
|
|
132
|
+
:max-file-size="3"
|
|
133
|
+
:max-files="5"
|
|
134
|
+
url="https://httpbin.org/post"
|
|
135
|
+
:request-options="{
|
|
136
|
+
headers: { 'My-Awesome-Header': 'header value' },
|
|
137
|
+
}"
|
|
138
|
+
@upload-success="onUploadSuccess"
|
|
139
|
+
@upload-error="onUploadError"
|
|
140
|
+
@error="onError"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<MazBtn :loading="dropzone?.isUploading" @click="dropzone?.uploadFiles()">
|
|
144
|
+
Upload Files
|
|
145
|
+
</MazBtn>
|
|
146
|
+
</template>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
</template>
|
|
150
|
+
</ComponentDemo>
|
|
151
|
+
|
|
152
|
+
## File Type Restrictions
|
|
153
|
+
|
|
154
|
+
You can restrict allowed file types using the `data-types` prop:
|
|
155
|
+
|
|
156
|
+
<ComponentDemo>
|
|
157
|
+
<MazDropzone
|
|
158
|
+
v-model="files"
|
|
159
|
+
:data-types="['image/jpeg', 'image/png']"
|
|
160
|
+
:max-file-size="5"
|
|
161
|
+
@error="onError"
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<template #code>
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<MazDropzone v-model="files" :data-types="['image/jpeg', 'image/png']" :max-file-size="5" @error="onError" />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
</template>
|
|
171
|
+
</ComponentDemo>
|
|
172
|
+
|
|
173
|
+
## Auto Upload
|
|
174
|
+
|
|
175
|
+
Enable automatic file upload using the `auto-upload` prop. Files can be uploaded individually (`single`) in separate requests or all at once (`multiple`) in a single request:
|
|
176
|
+
|
|
177
|
+
<ComponentDemo>
|
|
178
|
+
<MazDropzone
|
|
179
|
+
v-model="files"
|
|
180
|
+
auto-upload="single"
|
|
181
|
+
url="https://your-upload-endpoint.com/upload"
|
|
182
|
+
@upload-success="onUploadSuccess"
|
|
183
|
+
@upload-error="onUploadError"
|
|
184
|
+
@error="onError"
|
|
185
|
+
/>
|
|
186
|
+
|
|
187
|
+
<template #code>
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<MazDropzone
|
|
191
|
+
v-model="files"
|
|
192
|
+
auto-upload="single"
|
|
193
|
+
url="https://your-upload-endpoint.com/upload"
|
|
194
|
+
@upload-success="onUploadSuccess"
|
|
195
|
+
@upload-error="onUploadError"
|
|
196
|
+
@error="onError"
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
</template>
|
|
201
|
+
</ComponentDemo>
|
|
202
|
+
|
|
203
|
+
You can also upload all files at once using `multiple`:
|
|
204
|
+
|
|
205
|
+
::: tip
|
|
206
|
+
Multiple upload is allowed:
|
|
207
|
+
|
|
208
|
+
- when `max-files` is greater than 1
|
|
209
|
+
- when `auto-upload` is set to `multiple`
|
|
210
|
+
- when `multiple` prop is set to `true`
|
|
211
|
+
|
|
212
|
+
[Link to the source code](https://github.com/maz-ui/maz-ui/blob/main/components/MazDropzone.vue#L219)
|
|
213
|
+
:::
|
|
214
|
+
|
|
215
|
+
<ComponentDemo>
|
|
216
|
+
<MazDropzone
|
|
217
|
+
v-model="files"
|
|
218
|
+
auto-upload="multiple"
|
|
219
|
+
url="https://your-upload-endpoint.com/upload"
|
|
220
|
+
@upload-success-multiple="onUploadSuccessMultiple"
|
|
221
|
+
@upload-error-multiple="onUploadErrorMultiple"
|
|
222
|
+
@error="onError"
|
|
223
|
+
/>
|
|
224
|
+
|
|
225
|
+
<template #code>
|
|
226
|
+
|
|
227
|
+
```html
|
|
228
|
+
<template>
|
|
229
|
+
<MazDropzone
|
|
230
|
+
v-model="files"
|
|
231
|
+
auto-upload="multiple"
|
|
232
|
+
url="https://your-upload-endpoint.com/upload"
|
|
233
|
+
@upload-success-multiple="onUploadSuccessMultiple"
|
|
234
|
+
@upload-error-multiple="onUploadErrorMultiple"
|
|
235
|
+
@error="onError"
|
|
236
|
+
/>
|
|
237
|
+
</template>
|
|
238
|
+
|
|
239
|
+
<script setup lang="ts">
|
|
240
|
+
import { ref } from 'vue'
|
|
241
|
+
import { useToast } from 'maz-ui'
|
|
242
|
+
|
|
243
|
+
const files = ref<File[]>([])
|
|
244
|
+
|
|
245
|
+
const toast = useToast()
|
|
246
|
+
|
|
247
|
+
const onUploadSuccessMultiple = ({ files, response }) => {
|
|
248
|
+
console.log('Upload multiple success:', files, response)
|
|
249
|
+
toast.success(`${files.length} files uploaded successfully`)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const onUploadErrorMultiple = ({ files, code, error }) => {
|
|
253
|
+
console.error('Upload mulitple failed:', files, code, error)
|
|
254
|
+
toast.error(`${files.length} files upload failed: ${code} - ${error}`)
|
|
255
|
+
}
|
|
256
|
+
</script>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
</template>
|
|
260
|
+
</ComponentDemo>
|
|
261
|
+
|
|
262
|
+
## Custom Upload Area
|
|
263
|
+
|
|
264
|
+
Customize the upload area using slots:
|
|
265
|
+
|
|
266
|
+
<ComponentDemo>
|
|
267
|
+
<MazDropzone v-model="files" @error="onError">
|
|
268
|
+
<template #no-files-area="{ handleFileInputClick }">
|
|
269
|
+
<div class="maz-flex maz-flex-col maz-items-center maz-gap-4">
|
|
270
|
+
<MazIcon name="arrow-up-on-square" class="maz-text-4xl" />
|
|
271
|
+
<p>Drop your files here or click to browse</p>
|
|
272
|
+
<MazBtn @click="handleFileInputClick">
|
|
273
|
+
Select Files
|
|
274
|
+
</MazBtn>
|
|
275
|
+
</div>
|
|
276
|
+
</template>
|
|
277
|
+
</MazDropzone>
|
|
278
|
+
|
|
279
|
+
<template #code>
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<MazDropzone v-model="files" @error="onError">
|
|
283
|
+
<template #no-files-area="{ handleFileInputClick }">
|
|
284
|
+
<div class="maz-flex maz-flex-col maz-items-center maz-gap-4">
|
|
285
|
+
<MazIcon name="arrow-up-on-square" class="maz-text-4xl" />
|
|
286
|
+
<p>Drop your files here or click to browse</p>
|
|
287
|
+
<MazBtn @click="handleFileInputClick"> Select Files </MazBtn>
|
|
288
|
+
</div>
|
|
289
|
+
</template>
|
|
290
|
+
</MazDropzone>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
</template>
|
|
294
|
+
</ComponentDemo>
|
|
295
|
+
|
|
296
|
+
## Custom Translations
|
|
297
|
+
|
|
298
|
+
### Using `translations` prop
|
|
299
|
+
|
|
300
|
+
Customize text messages using the `translations` prop:
|
|
301
|
+
|
|
302
|
+
<ComponentDemo>
|
|
303
|
+
<MazDropzone
|
|
304
|
+
v-model="files"
|
|
305
|
+
:translations="{
|
|
306
|
+
dragAndDrop: 'Drag files here',
|
|
307
|
+
selectFile: 'Browse files',
|
|
308
|
+
fileInfos: 'Accepted files: Images up to 5MB'
|
|
309
|
+
}"
|
|
310
|
+
@error="onError"
|
|
311
|
+
/>
|
|
312
|
+
|
|
313
|
+
<template #code>
|
|
314
|
+
|
|
315
|
+
```html
|
|
316
|
+
<MazDropzone
|
|
317
|
+
v-model="files"
|
|
318
|
+
:translations="{
|
|
319
|
+
dragAndDrop: 'Drag files here',
|
|
320
|
+
selectFile: 'Browse files',
|
|
321
|
+
fileInfos: 'Accepted files: Images up to 5MB'
|
|
322
|
+
}"
|
|
323
|
+
@error="onError"
|
|
324
|
+
/>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
</template>
|
|
328
|
+
</ComponentDemo>
|
|
329
|
+
|
|
330
|
+
### Using `MazUi` plugin
|
|
331
|
+
|
|
332
|
+
You can also use the `MazUi` plugin to customize the translations:
|
|
333
|
+
|
|
334
|
+
::: details View code
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
338
|
+
|
|
339
|
+
app.use(MazUi, {
|
|
340
|
+
translations: {
|
|
341
|
+
locale: 'en',
|
|
342
|
+
messages: {
|
|
343
|
+
en: {
|
|
344
|
+
dropzone: {
|
|
345
|
+
dragAndDrop: 'Drag files here',
|
|
346
|
+
selectFile: 'Select files',
|
|
347
|
+
divider: 'or',
|
|
348
|
+
fileMaxCount: 'Maximum {count} files',
|
|
349
|
+
fileMaxSize: 'Maximum {size} MB',
|
|
350
|
+
fileTypes: 'Allowed file types: {types}',
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
:::
|
|
359
|
+
|
|
360
|
+
## Custom Upload Request
|
|
361
|
+
|
|
362
|
+
Customize the upload request using `uploadUrl`, `requestOptions` and `transformBody`:
|
|
363
|
+
|
|
364
|
+
<ComponentDemo>
|
|
365
|
+
<MazDropzone
|
|
366
|
+
v-model="files"
|
|
367
|
+
url="/api/upload"
|
|
368
|
+
:request-options="{
|
|
369
|
+
method: 'POST',
|
|
370
|
+
headers: {
|
|
371
|
+
'Authorization': 'Bearer token123'
|
|
372
|
+
},
|
|
373
|
+
}"
|
|
374
|
+
:transform-body="(formData, files) => {
|
|
375
|
+
// Add additional data to FormData
|
|
376
|
+
formData.append('userId', '123')
|
|
377
|
+
formData.append('fileCount', files.length.toString())
|
|
378
|
+
return formData
|
|
379
|
+
}"
|
|
380
|
+
@error="onError"
|
|
381
|
+
/>
|
|
382
|
+
|
|
383
|
+
<template #code>
|
|
384
|
+
|
|
385
|
+
```html
|
|
386
|
+
<MazDropzone
|
|
387
|
+
v-model="files"
|
|
388
|
+
url="/api/upload"
|
|
389
|
+
:request-options="{
|
|
390
|
+
method: 'POST',
|
|
391
|
+
headers: {
|
|
392
|
+
'Authorization': 'Bearer token123'
|
|
393
|
+
},
|
|
394
|
+
}"
|
|
395
|
+
:transform-body="(formData, files) => {
|
|
396
|
+
// Add additional data to FormData
|
|
397
|
+
formData.append('userId', '123')
|
|
398
|
+
formData.append('fileCount', files.length.toString())
|
|
399
|
+
return formData
|
|
400
|
+
}"
|
|
401
|
+
@error="onError"
|
|
402
|
+
/>
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
</template>
|
|
406
|
+
</ComponentDemo>
|
|
407
|
+
|
|
408
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-dropzone.doc.md-->
|
|
409
|
+
|
|
410
|
+
<script setup lang="ts">
|
|
411
|
+
import { ref } from 'vue'
|
|
412
|
+
import { useToast } from 'maz-ui/src/composables/useToast'
|
|
413
|
+
|
|
414
|
+
const files = ref<File[]>([])
|
|
415
|
+
const dropzone = ref<InstanceType<typeof MazDropzone>>()
|
|
416
|
+
const toast = useToast()
|
|
417
|
+
|
|
418
|
+
const onUploadSuccess = ({ file, response }) => {
|
|
419
|
+
console.log('Upload success:', file, response)
|
|
420
|
+
toast.success(`File ${file.name} uploaded successfully`)
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const onUploadError = ({ file, code, error }) => {
|
|
424
|
+
console.error('Upload failed:', file, code, error)
|
|
425
|
+
toast.error(`File ${file.name} upload failed: ${code} - ${error}`)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const onUploadSuccessMultiple = ({ files, response }) => {
|
|
429
|
+
console.log('Upload multiple success:', files, response)
|
|
430
|
+
toast.success(`${files.length} files uploaded successfully`)
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const onUploadErrorMultiple = ({ files, code, error }) => {
|
|
434
|
+
console.error('Upload multiple failed:', files, code, error)
|
|
435
|
+
toast.error(`${files.length} files upload failed: ${code} - ${error}`)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const onError = ({ files, event, code }) => {
|
|
439
|
+
console.error('Error:', files, event, code)
|
|
440
|
+
toast.error(`${files?.length} files upload failed: ${code} - ${files?.map(file => file.name).join(', ')}`)
|
|
441
|
+
}
|
|
442
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazExpandAnimation
|
|
3
|
+
description: MazExpandAnimation is a standalone component that allows you to animate the height of a block element
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
<!--@include: ./../.vitepress/mixins/getting-started.md-->
|
|
11
|
+
|
|
12
|
+
## Basic usage
|
|
13
|
+
|
|
14
|
+
<ComponentDemo>
|
|
15
|
+
<MazBtn @click="visible = !visible"> Exec animation </MazBtn>
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<MazExpandAnimation v-model="visible">
|
|
20
|
+
<div class="maz-pt-4">
|
|
21
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
22
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
23
|
+
</div>
|
|
24
|
+
</MazExpandAnimation>
|
|
25
|
+
|
|
26
|
+
<template #code>
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import { MazExpandAnimation } from 'maz-ui/components'
|
|
31
|
+
import { ref } from 'vue'
|
|
32
|
+
|
|
33
|
+
const visible = ref(false)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<MazBtn @click="visible = !visible">
|
|
38
|
+
Exec animation
|
|
39
|
+
</MazBtn>
|
|
40
|
+
|
|
41
|
+
<MazExpandAnimation v-model="visible">
|
|
42
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
43
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
44
|
+
</MazExpandAnimation>
|
|
45
|
+
</template>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
</template>
|
|
49
|
+
</ComponentDemo>
|
|
50
|
+
|
|
51
|
+
## Options
|
|
52
|
+
|
|
53
|
+
- **duration**: `String` - default: `300ms` - Duration of the animation in ms
|
|
54
|
+
- **timing-function**: `String` - default: `ease-in-out` - Timing function of the animation
|
|
55
|
+
|
|
56
|
+
<ComponentDemo>
|
|
57
|
+
<MazBtn @click="visible2 = !visible2"> Exec animation </MazBtn>
|
|
58
|
+
|
|
59
|
+
<br />
|
|
60
|
+
|
|
61
|
+
<MazExpandAnimation v-model="visible2" duration="1000ms" timing-function="linear">
|
|
62
|
+
<div class="maz-pt-4">
|
|
63
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
64
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
65
|
+
</div>
|
|
66
|
+
</MazExpandAnimation>
|
|
67
|
+
|
|
68
|
+
<template #code>
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script lang="ts" setup>
|
|
72
|
+
import { MazExpandAnimation } from 'maz-ui/components'
|
|
73
|
+
import { ref } from 'vue'
|
|
74
|
+
|
|
75
|
+
const visible = ref(false)
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<MazBtn @click="visible = !visible">
|
|
80
|
+
Exec animation
|
|
81
|
+
</MazBtn>
|
|
82
|
+
|
|
83
|
+
<MazExpandAnimation v-model="visible" duration="1000ms" timing-function="linear">
|
|
84
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
85
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
86
|
+
</MazExpandAnimation>
|
|
87
|
+
</template>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
</template>
|
|
91
|
+
</ComponentDemo>
|
|
92
|
+
|
|
93
|
+
<script setup lang="ts">
|
|
94
|
+
import { ref } from 'vue'
|
|
95
|
+
const visible = ref(false)
|
|
96
|
+
const visible2 = ref(false)
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-expand-animation.doc.md-->
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazFullscreenLoader
|
|
3
|
+
description: MazFullscreenLoader is a standalone component
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
<!--@include: ./../.vitepress/mixins/getting-started.md-->
|
|
11
|
+
|
|
12
|
+
## Basic usage
|
|
13
|
+
|
|
14
|
+
<MazFullscreenLoader v-if="showLoader" @click="showLoader = false">
|
|
15
|
+
<p class="maz-text-lg maz-text-surface">
|
|
16
|
+
Loading...
|
|
17
|
+
</p>
|
|
18
|
+
<p class="maz-text-lg maz-text-surface">
|
|
19
|
+
(click to hide loader)
|
|
20
|
+
</p>
|
|
21
|
+
</MazFullscreenLoader>
|
|
22
|
+
|
|
23
|
+
<MazBtn @click="showLoader = true">
|
|
24
|
+
Show loader
|
|
25
|
+
</MazBtn>
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { MazBtn, MazFullscreenLoader } from 'maz-ui/components'
|
|
30
|
+
|
|
31
|
+
import { ref } from 'vue'
|
|
32
|
+
|
|
33
|
+
const showLoader = ref(false)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<MazFullscreenLoader v-if="showLoader" @click="showLoader = false">
|
|
38
|
+
<p>
|
|
39
|
+
Loading...
|
|
40
|
+
</p>
|
|
41
|
+
<p>
|
|
42
|
+
(click to hide loader)
|
|
43
|
+
</p>
|
|
44
|
+
</MazFullscreenLoader>
|
|
45
|
+
|
|
46
|
+
<MazBtn @click="showLoader = true">
|
|
47
|
+
Show loader
|
|
48
|
+
</MazBtn>
|
|
49
|
+
</template>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<script lang="ts" setup>
|
|
53
|
+
import { ref } from 'vue'
|
|
54
|
+
|
|
55
|
+
const showLoader = ref(false)
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-fullscreen-loader.doc.md-->
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazGallery
|
|
3
|
+
description: MazGallery is a standalone component used to display images in a container and has many options and actions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
<!--@include: ./../.vitepress/mixins/getting-started.md-->
|
|
11
|
+
|
|
12
|
+
## Basic usage
|
|
13
|
+
|
|
14
|
+
<MazGallery
|
|
15
|
+
:images
|
|
16
|
+
:height="320"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { MazGallery, type MazGalleryImage } from 'maz-ui/components'
|
|
22
|
+
|
|
23
|
+
const images: MazGalleryImage[] = [
|
|
24
|
+
'https://loremflickr.com/640/400',
|
|
25
|
+
{ src: 'https://loremflickr.com/640/600', thumbnail: 'https://loremflickr.com/100/100', alt: 'image description' },
|
|
26
|
+
{ src: 'https://loremflickr.com/640/700', alt: 'image description' },
|
|
27
|
+
'https://loremflickr.com/640/800',
|
|
28
|
+
'https://loremflickr.com/640/1000',
|
|
29
|
+
'https://loremflickr.com/800/800'
|
|
30
|
+
]
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<MazGallery
|
|
35
|
+
:images
|
|
36
|
+
:height="320"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Set height by CSS
|
|
42
|
+
|
|
43
|
+
<MazGallery
|
|
44
|
+
:images="images2"
|
|
45
|
+
class="maz-h-48 mob-l:maz-h-60 tab-s:maz-h-80"
|
|
46
|
+
:height="false"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<MazGallery :images="images" class="h-48 md:h-60 lg:h-80" :height="false" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Types
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
type MazGalleryImage
|
|
57
|
+
= | {
|
|
58
|
+
thumbnail?: string
|
|
59
|
+
src: string
|
|
60
|
+
alt?: string
|
|
61
|
+
}
|
|
62
|
+
| string
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-gallery.doc.md-->
|
|
66
|
+
|
|
67
|
+
<script lang="ts" setup>
|
|
68
|
+
const images: MazGalleryImage[] = [
|
|
69
|
+
'https://loremflickr.com/640/400',
|
|
70
|
+
{ src: 'https://loremflickr.com/640/600', thumbnail: 'https://loremflickr.com/100/100', alt: 'image description' },
|
|
71
|
+
{ src: 'https://loremflickr.com/640/700', alt: 'image description' },
|
|
72
|
+
'https://loremflickr.com/640/800',
|
|
73
|
+
'https://loremflickr.com/640/1000',
|
|
74
|
+
'https://loremflickr.com/800/800'
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
const images2: MazGalleryImage[] = [
|
|
78
|
+
'https://loremflickr.com/500/400',
|
|
79
|
+
{ src: 'https://loremflickr.com/500/600', thumbnail: 'https://loremflickr.com/100/100', alt: 'image description' },
|
|
80
|
+
{ src: 'https://loremflickr.com/500/700', alt: 'image description' },
|
|
81
|
+
'https://loremflickr.com/500/800',
|
|
82
|
+
'https://loremflickr.com/500/1000',
|
|
83
|
+
'https://loremflickr.com/500/800'
|
|
84
|
+
]
|
|
85
|
+
</script>
|