@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,439 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazSelect - with "multiple" options
|
|
3
|
+
description: MazSelect is a standalone component that replaces the standard html input select with a beautiful design system. There are many options like multiple values, search text field, custom templates options, colors, sizes, disabled, loading, error, warning, valid states, error messages, and icons.
|
|
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
|
+
## Basic usage
|
|
15
|
+
|
|
16
|
+
<ComponentDemo expanded>
|
|
17
|
+
<MazSelect
|
|
18
|
+
label="Select color"
|
|
19
|
+
v-model="selectedValue"
|
|
20
|
+
:options="['primary', 'secondary', 'info', 'success', 'destructive', 'warning', 'white', 'black', 'red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink', 'brown', 'gray']"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<br />
|
|
24
|
+
<br />
|
|
25
|
+
|
|
26
|
+
selectedValue: {{ selectedValue }}
|
|
27
|
+
|
|
28
|
+
<template #code>
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { MazSelect } from 'maz-ui/components'
|
|
33
|
+
import { ref } from 'vue'
|
|
34
|
+
|
|
35
|
+
const selectedValue = ref()
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<MazSelect
|
|
40
|
+
v-model="selectedValue"
|
|
41
|
+
label="Select color"
|
|
42
|
+
:color="color"
|
|
43
|
+
:options="['primary', 'secondary', 'info', 'success', 'destructive', 'warning']"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
selectedValue: {{ selectedValue }}
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
</template>
|
|
51
|
+
</ComponentDemo>
|
|
52
|
+
|
|
53
|
+
## Multiple
|
|
54
|
+
|
|
55
|
+
<ComponentDemo>
|
|
56
|
+
<MazSelect
|
|
57
|
+
v-model="selectedValues"
|
|
58
|
+
:options="colors"
|
|
59
|
+
label="Choose options"
|
|
60
|
+
multiple
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
|
|
66
|
+
selectedValues: {{ selectedValues }}
|
|
67
|
+
|
|
68
|
+
<template #code>
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<MazSelect v-model="selectedValues" :options="colors" label="Choose options" multiple />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
</ComponentDemo>
|
|
77
|
+
|
|
78
|
+
## Search
|
|
79
|
+
|
|
80
|
+
Use `search` property to add a search input in the options list
|
|
81
|
+
|
|
82
|
+
::: tip
|
|
83
|
+
You can use your own template to replace the empty icon when no results are found
|
|
84
|
+
|
|
85
|
+
::: details View code
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<MazSelect>
|
|
89
|
+
<template #no-results>
|
|
90
|
+
<div class="p-4 text-center">No result</div>
|
|
91
|
+
</template>
|
|
92
|
+
</MazSelect>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
:::
|
|
96
|
+
|
|
97
|
+
::: info
|
|
98
|
+
You can adjust the search results by using `search-threshold` where 1 is a perfect match and 0 is a match with any character
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<MazSelect :search-threshold="0.75" :options="[...]" />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
:::
|
|
105
|
+
|
|
106
|
+
<ComponentDemo>
|
|
107
|
+
<MazSelect label="Select color" v-model="selectedValue" :options="colors" search />
|
|
108
|
+
|
|
109
|
+
<template #code>
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<MazSelect v-model="selectedValue" label="Select color" :options="colors" search />
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
</template>
|
|
116
|
+
</ComponentDemo>
|
|
117
|
+
|
|
118
|
+
### Custom search function
|
|
119
|
+
|
|
120
|
+
You can provide your own search function to customize the search behavior
|
|
121
|
+
|
|
122
|
+
<ComponentDemo>
|
|
123
|
+
<MazSelect
|
|
124
|
+
placeholder="Select color"
|
|
125
|
+
v-model="selectedValue"
|
|
126
|
+
:options="colors"
|
|
127
|
+
search
|
|
128
|
+
:search-function="customSearchFunction"
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
<template #code>
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<script lang="ts" setup>
|
|
135
|
+
import { MazSelect } from 'maz-ui/components'
|
|
136
|
+
|
|
137
|
+
const selectedValue = ref()
|
|
138
|
+
|
|
139
|
+
function customSearchFunction(query: string, options: typeof colors) {
|
|
140
|
+
return options.filter(
|
|
141
|
+
option => option.label.toLowerCase().includes(query.toLowerCase())
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<MazSelect
|
|
148
|
+
v-model="selectedValue"
|
|
149
|
+
placeholder="Select color"
|
|
150
|
+
:options="colors"
|
|
151
|
+
search
|
|
152
|
+
:search-function="customSearchFunction"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
</template>
|
|
158
|
+
</ComponentDemo>
|
|
159
|
+
|
|
160
|
+
## Opt Group
|
|
161
|
+
|
|
162
|
+
Group your options like a native optgroup
|
|
163
|
+
|
|
164
|
+
<ComponentDemo>
|
|
165
|
+
<MazSelect
|
|
166
|
+
v-model="optGroupValue"
|
|
167
|
+
label="Select options"
|
|
168
|
+
:options="optGroup"
|
|
169
|
+
multiple
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<template #code>
|
|
173
|
+
|
|
174
|
+
```vue
|
|
175
|
+
<script setup lang="ts">
|
|
176
|
+
import { ref } from 'vue'
|
|
177
|
+
const selectedValue = ref()
|
|
178
|
+
const optGroup = [
|
|
179
|
+
{ label: 'Basic colors', options: ['primary', 'secondary', 'destructive'] },
|
|
180
|
+
{ label: 'Custom colors', options: [{ label: 'third', value: 'third' }] },
|
|
181
|
+
]
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<template>
|
|
185
|
+
<MazSelect
|
|
186
|
+
v-model="optGroupValue"
|
|
187
|
+
label="Select option"
|
|
188
|
+
:options="optGroup"
|
|
189
|
+
multiple
|
|
190
|
+
/>
|
|
191
|
+
</template>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</template>
|
|
195
|
+
</ComponentDemo>
|
|
196
|
+
|
|
197
|
+
## Disabled
|
|
198
|
+
|
|
199
|
+
<ComponentDemo>
|
|
200
|
+
<MazSelect
|
|
201
|
+
label="Select color"
|
|
202
|
+
v-model="selectedValue"
|
|
203
|
+
:options="colors"
|
|
204
|
+
disabled
|
|
205
|
+
/>
|
|
206
|
+
|
|
207
|
+
<template #code>
|
|
208
|
+
|
|
209
|
+
```html
|
|
210
|
+
<MazSelect
|
|
211
|
+
label="Select color"
|
|
212
|
+
v-model="selectedValue"
|
|
213
|
+
:options="colors"
|
|
214
|
+
disabled
|
|
215
|
+
/>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
</template>
|
|
219
|
+
</ComponentDemo>
|
|
220
|
+
|
|
221
|
+
## Size
|
|
222
|
+
|
|
223
|
+
<ComponentDemo>
|
|
224
|
+
<div class="maz-flex maz-flex-col maz-gap-2">
|
|
225
|
+
<MazSelect
|
|
226
|
+
v-for="size in sizes"
|
|
227
|
+
:key="size"
|
|
228
|
+
label="Select color"
|
|
229
|
+
v-model="selectedValue"
|
|
230
|
+
:options="colors"
|
|
231
|
+
:size="size"
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<template #code>
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<template>
|
|
239
|
+
<MazSelect
|
|
240
|
+
v-for="size in sizes"
|
|
241
|
+
:key="size"
|
|
242
|
+
label="Select color"
|
|
243
|
+
v-model="selectedValue"
|
|
244
|
+
:options="colors"
|
|
245
|
+
:size="size"
|
|
246
|
+
/>
|
|
247
|
+
</template>
|
|
248
|
+
|
|
249
|
+
<script lang="ts" setup>
|
|
250
|
+
import { ref } from 'vue'
|
|
251
|
+
import { MazSelect, type MazSize } from 'maz-ui/components'
|
|
252
|
+
|
|
253
|
+
const selectedValue = ref()
|
|
254
|
+
|
|
255
|
+
const sizes: MazSize[] = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
256
|
+
</script>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
</template>
|
|
260
|
+
</ComponentDemo>
|
|
261
|
+
|
|
262
|
+
## Custom template options
|
|
263
|
+
|
|
264
|
+
Customize the options list with your own template
|
|
265
|
+
|
|
266
|
+
<ComponentDemo>
|
|
267
|
+
<MazSelect
|
|
268
|
+
label="Select color"
|
|
269
|
+
v-model="selectedUser"
|
|
270
|
+
:options="customTemplateOptions"
|
|
271
|
+
v-slot="{ option, isSelected }"
|
|
272
|
+
search
|
|
273
|
+
>
|
|
274
|
+
<div class="flex items-center" style="width: 100%; gap: 1rem">
|
|
275
|
+
<MazAvatar size="0.8rem" :src="option.picture" />
|
|
276
|
+
<strong>
|
|
277
|
+
{{ option.label }}
|
|
278
|
+
</strong>
|
|
279
|
+
</div>
|
|
280
|
+
</MazSelect>
|
|
281
|
+
|
|
282
|
+
<template #code>
|
|
283
|
+
|
|
284
|
+
```vue{6}
|
|
285
|
+
<template>
|
|
286
|
+
<MazSelect
|
|
287
|
+
label="Select color"
|
|
288
|
+
v-model="selectedUser"
|
|
289
|
+
:options="customTemplateOptions"
|
|
290
|
+
v-slot="{ option, isSelected }"
|
|
291
|
+
search
|
|
292
|
+
>
|
|
293
|
+
<div class="flex items-center" style="width: 100%; gap: 1rem">
|
|
294
|
+
<MazAvatar size="0.8rem" :src="option.picture" />
|
|
295
|
+
<strong>
|
|
296
|
+
{{ option.label }}
|
|
297
|
+
</strong>
|
|
298
|
+
</div>
|
|
299
|
+
</MazSelect>
|
|
300
|
+
</template>
|
|
301
|
+
|
|
302
|
+
<script lang="ts" setup>
|
|
303
|
+
import { ref } from 'vue'
|
|
304
|
+
import { MazSelect, MazAvatar } from 'maz-ui/components'
|
|
305
|
+
|
|
306
|
+
const selectedUser = ref()
|
|
307
|
+
|
|
308
|
+
const customTemplateOptions = [
|
|
309
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=JamesSmile', label: 'James Smile', value: 1 },
|
|
310
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=BradSmile', label: 'Brad Smile', value: 2 },
|
|
311
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=CedricSmile', label: 'Cedric Smile', value: 3 },
|
|
312
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=HarrySmile', label: 'Harry Smile', value: 4 },
|
|
313
|
+
]
|
|
314
|
+
</script>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
</template>
|
|
318
|
+
</ComponentDemo>
|
|
319
|
+
|
|
320
|
+
## Custom options model
|
|
321
|
+
|
|
322
|
+
By default, the options should be an array of `{ value: any, label: string }`
|
|
323
|
+
|
|
324
|
+
If you want custom keys of these options, you can use:
|
|
325
|
+
|
|
326
|
+
- `option-value-key` to override the key of the value in your option
|
|
327
|
+
- `option-label-key` to override the key of the label to show in the option list
|
|
328
|
+
- `option-input-value-key` to override the key of the value to show in the input
|
|
329
|
+
|
|
330
|
+
### Example
|
|
331
|
+
|
|
332
|
+
<br />
|
|
333
|
+
|
|
334
|
+
<ComponentDemo>
|
|
335
|
+
<MazSelect
|
|
336
|
+
v-model="selectedValueCustom"
|
|
337
|
+
:options="customOptions"
|
|
338
|
+
:color="selectedValueCustom"
|
|
339
|
+
option-value-key="valueOption"
|
|
340
|
+
option-label-key="labelOption"
|
|
341
|
+
option-input-value-key="inputLabel"
|
|
342
|
+
search
|
|
343
|
+
/>
|
|
344
|
+
|
|
345
|
+
<template #code>
|
|
346
|
+
|
|
347
|
+
```vue
|
|
348
|
+
<script lang="ts" setup>
|
|
349
|
+
import { ref } from 'vue'
|
|
350
|
+
const selectedValueCustom = ref('destructive')
|
|
351
|
+
|
|
352
|
+
const customOptions = [
|
|
353
|
+
{ valueOption: 'primary', labelOption: 'primary label', inputLabel: 'primary input', },
|
|
354
|
+
{ valueOption: 'secondary', labelOption: 'secondary label', inputLabel: 'secondary input', },
|
|
355
|
+
{ valueOption: 'info', labelOption: 'info label', inputLabel: 'info input', },
|
|
356
|
+
{ valueOption: 'success', labelOption: 'success label', inputLabel: 'success input', },
|
|
357
|
+
{ valueOption: 'warning', labelOption: 'warning label', inputLabel: 'warning input', },
|
|
358
|
+
{ valueOption: 'destructive', labelOption: 'destructive label', inputLabel: 'destructive input', },
|
|
359
|
+
{ valueOption: 'white', labelOption: 'white label', inputLabel: 'white input', },
|
|
360
|
+
{ valueOption: 'black', labelOption: 'black label', inputLabel: 'black input', },
|
|
361
|
+
]
|
|
362
|
+
</script>
|
|
363
|
+
|
|
364
|
+
<template>
|
|
365
|
+
<MazSelect
|
|
366
|
+
v-model="selectedValueCustom"
|
|
367
|
+
:options="options"
|
|
368
|
+
:color="selectedValueCustom"
|
|
369
|
+
option-value-key="valueOption"
|
|
370
|
+
option-label-key="labelOption"
|
|
371
|
+
option-input-value-key="inputLabel"
|
|
372
|
+
search
|
|
373
|
+
/>
|
|
374
|
+
</template>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
</template>
|
|
378
|
+
</ComponentDemo>
|
|
379
|
+
|
|
380
|
+
<script setup lang="ts">
|
|
381
|
+
import { ref } from 'vue'
|
|
382
|
+
|
|
383
|
+
const optGroupValue = ref()
|
|
384
|
+
const selectedValue = ref()
|
|
385
|
+
const selectedValueCustom = ref('destructive')
|
|
386
|
+
const selectedUser = ref()
|
|
387
|
+
const selectedValues = ref()
|
|
388
|
+
|
|
389
|
+
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
390
|
+
|
|
391
|
+
const colors = [
|
|
392
|
+
{ label: 'primary', value: 'primary' },
|
|
393
|
+
{ label: 'secondary', value: 'secondary' },
|
|
394
|
+
{ label: 'info', value: 'info' },
|
|
395
|
+
{ label: 'success', value: 'success' },
|
|
396
|
+
{ label: 'warning', value: 'warning' },
|
|
397
|
+
{ label: 'destructive', value: 'destructive' },
|
|
398
|
+
{ label: 'white', value: 'white' },
|
|
399
|
+
{ label: 'black', value: 'black' },
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
const optGroup = [
|
|
403
|
+
{ label: 'Basic colors', options: ['primary', 'secondary', 'destructive'] },
|
|
404
|
+
{ label: 'Custom colors', options: [{ label: 'third', value: 'third' }] },
|
|
405
|
+
]
|
|
406
|
+
|
|
407
|
+
const customTemplateOptions = [
|
|
408
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=JamesSmile', label: 'James Smile', value: 1 },
|
|
409
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=BradSmile', label: 'Brad Smile', value: 2 },
|
|
410
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=CedricSmile', label: 'Cedric Smile', value: 3 },
|
|
411
|
+
{ picture: 'https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&seed=HarrySmile', label: 'Harry Smile', value: 4 },
|
|
412
|
+
]
|
|
413
|
+
|
|
414
|
+
const customOptions = [
|
|
415
|
+
{ valueOption: 'primary', labelOption: 'primary label', inputLabel: 'primary input', },
|
|
416
|
+
{ valueOption: 'secondary', labelOption: 'secondary label', inputLabel: 'secondary input', },
|
|
417
|
+
{ valueOption: 'info', labelOption: 'info label', inputLabel: 'info input', },
|
|
418
|
+
{ valueOption: 'success', labelOption: 'success label', inputLabel: 'success input', },
|
|
419
|
+
{ valueOption: 'warning', labelOption: 'warning label', inputLabel: 'warning input', },
|
|
420
|
+
{ valueOption: 'destructive', labelOption: 'destructive label', inputLabel: 'destructive input', },
|
|
421
|
+
{ valueOption: 'white', labelOption: 'white label', inputLabel: 'white input', },
|
|
422
|
+
{ valueOption: 'black', labelOption: 'black label', inputLabel: 'black input', },
|
|
423
|
+
]
|
|
424
|
+
|
|
425
|
+
const alwaysShowMembersBets = ref()
|
|
426
|
+
|
|
427
|
+
function customSearchFunction(query: string, options: typeof colors) {
|
|
428
|
+
return options.filter((option) => option.label.toLowerCase().includes(query.toLowerCase()))
|
|
429
|
+
}
|
|
430
|
+
</script>
|
|
431
|
+
|
|
432
|
+
### Types
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
type ModelValueSimple = string | number | null | undefined | boolean
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
<!--@include: ./../.vitepress/mixins/maz-input-props.md-->
|
|
439
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-select.doc.md-->
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazSlider
|
|
3
|
+
description: MazSlider is a standalone component that replaces the standard html input range with a beautiful design system. Many options like multiple cursors and values, colors, sizes and logarithmic/exponential values are available
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
<!--@include: ./../.vitepress/mixins/getting-started.md-->
|
|
11
|
+
|
|
12
|
+
## Basic usage
|
|
13
|
+
|
|
14
|
+
<MazSlider v-model="sliderValue" class="vp-raw" />
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { MazSlider } from 'maz-ui/components'
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
const sliderValue = ref(50)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<MazSlider v-model="sliderValue" />
|
|
25
|
+
</template>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Options
|
|
29
|
+
|
|
30
|
+
### Step
|
|
31
|
+
|
|
32
|
+
<MazSlider v-model="sliderValue" :step="10" class="vp-raw" />
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<MazSlider v-model="sliderValue" :step="10" class="vp-raw" />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Multiple sliders & labels
|
|
39
|
+
|
|
40
|
+
<MazSlider v-model="multipleSilders" :labels="multipleSildersLabels" />
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<script lang="ts" setup>
|
|
44
|
+
import { MazSlider } from 'maz-ui/components'
|
|
45
|
+
import { ref } from 'vue'
|
|
46
|
+
const multipleSilders = ref([25, 50, 75])
|
|
47
|
+
const multipleSildersLabels = ['Small', 'Middle', 'Big']
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<MazSlider v-model="multipleSilders" :labels="multipleSildersLabels" />
|
|
52
|
+
</template>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Sizes & colors
|
|
56
|
+
|
|
57
|
+
<MazSlider
|
|
58
|
+
v-model="multipleSilders"
|
|
59
|
+
:labels="multipleSildersLabels"
|
|
60
|
+
color="secondary"
|
|
61
|
+
size="1.5rem"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<MazSlider
|
|
65
|
+
v-model="multipleSilders"
|
|
66
|
+
:labels="multipleSildersLabels"
|
|
67
|
+
color="destructive"
|
|
68
|
+
size="1.2rem"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<MazSlider
|
|
72
|
+
v-model="multipleSilders"
|
|
73
|
+
:labels="multipleSildersLabels"
|
|
74
|
+
color="success"
|
|
75
|
+
size="12px"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<MazSlider
|
|
79
|
+
v-model="multipleSilders"
|
|
80
|
+
:labels="multipleSildersLabels"
|
|
81
|
+
color="info"
|
|
82
|
+
size="10px"
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script lang="ts" setup>
|
|
87
|
+
import { MazSlider } from 'maz-ui/components'
|
|
88
|
+
import { ref } from 'vue'
|
|
89
|
+
const multipleSilders = ref([25, 50, 75])
|
|
90
|
+
const multipleSildersLabels = ['Small', 'Middle', 'Big']
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<MazSlider
|
|
95
|
+
v-model="multipleSilders"
|
|
96
|
+
:labels="multipleSildersLabels"
|
|
97
|
+
color="secondary"
|
|
98
|
+
size="1.5rem"
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<MazSlider
|
|
102
|
+
v-model="multipleSilders"
|
|
103
|
+
:labels="multipleSildersLabels"
|
|
104
|
+
color="destructive"
|
|
105
|
+
size="1.2rem"
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<MazSlider
|
|
109
|
+
v-model="multipleSilders"
|
|
110
|
+
:labels="multipleSildersLabels"
|
|
111
|
+
color="success"
|
|
112
|
+
size="12px"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<MazSlider
|
|
116
|
+
v-model="multipleSilders"
|
|
117
|
+
:labels="multipleSildersLabels"
|
|
118
|
+
color="info"
|
|
119
|
+
size="10px"
|
|
120
|
+
/>
|
|
121
|
+
</template>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Logarithmic/exponential
|
|
125
|
+
|
|
126
|
+
<MazSlider
|
|
127
|
+
v-model="logSilders"
|
|
128
|
+
:labels="logSildersLabels"
|
|
129
|
+
:min="50"
|
|
130
|
+
:max="50000"
|
|
131
|
+
logs
|
|
132
|
+
/>
|
|
133
|
+
|
|
134
|
+
```vue
|
|
135
|
+
<script lang="ts" setup>
|
|
136
|
+
import { MazSlider } from 'maz-ui/components'
|
|
137
|
+
import { ref } from 'vue'
|
|
138
|
+
const logSilders = ref([50, 10000, 30000, 45000])
|
|
139
|
+
const logSildersLabels: ['Micro', 'Small', 'Middle', 'Big']
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<template>
|
|
143
|
+
<MazSlider
|
|
144
|
+
v-model="logSilders"
|
|
145
|
+
:labels="logSildersLabels"
|
|
146
|
+
:min="50"
|
|
147
|
+
:max="50000"
|
|
148
|
+
logs
|
|
149
|
+
/>
|
|
150
|
+
</template>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## no-divider & no-zoom-animation
|
|
154
|
+
|
|
155
|
+
> Each sections between cursors has the same color
|
|
156
|
+
|
|
157
|
+
> Component don't have animation on cursor
|
|
158
|
+
|
|
159
|
+
<MazSlider
|
|
160
|
+
v-model="multipleSilders"
|
|
161
|
+
no-divider
|
|
162
|
+
no-cursor-anim
|
|
163
|
+
/>
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<script lang="ts" setup>
|
|
167
|
+
import { MazSlider } from 'maz-ui/components'
|
|
168
|
+
import { ref } from 'vue'
|
|
169
|
+
const multipleSilders = ref([25, 50, 75])
|
|
170
|
+
</script>
|
|
171
|
+
|
|
172
|
+
<template>
|
|
173
|
+
<MazSlider
|
|
174
|
+
v-model="multipleSilders"
|
|
175
|
+
no-divider
|
|
176
|
+
no-cursor-anim
|
|
177
|
+
/>
|
|
178
|
+
</template>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
<script lang="ts" setup>
|
|
182
|
+
import { ref } from 'vue'
|
|
183
|
+
const sliderValue = ref(50)
|
|
184
|
+
const multipleSilders = ref([25, 50, 75])
|
|
185
|
+
const multipleSildersLabels = ['Small', 'Middle', 'Big']
|
|
186
|
+
|
|
187
|
+
const logSilders = ref([50, 10000, 30000, 45000])
|
|
188
|
+
const logSildersLabels = ['Micro', 'Small', 'Middle', 'Big']
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-slider.doc.md-->
|