maz-ui 5.0.0 → 5.1.0-beta.0
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/dist/assets/{MazDropzone.DJ8au25t.css → MazDropzone.BW2grpTi.css} +1 -1
- package/dist/chunks/{MazDrawer.DANxKYxJ.js → MazDrawer.CC8zomfx.js} +2 -2
- package/dist/chunks/{MazDropzone.POH3pmfi.js → MazDropzone.Dez5j0WP.js} +2 -2
- package/dist/components/MazDrawer.js +1 -1
- package/dist/components/MazDropzone.js +1 -1
- package/dist/components/MazDropzone.vue.d.ts +2 -2
- package/dist/components/MazInputPrice.vue.d.ts +1 -1
- package/dist/components/index.js +2 -2
- package/docs/README.md +207 -0
- package/docs/agents/agents-md.md +52 -0
- package/docs/agents/claude-rule.md +52 -0
- package/docs/components/maz-accordion.md +76 -0
- package/docs/components/maz-alert.md +241 -0
- package/docs/components/maz-animated-counter.md +87 -0
- package/docs/components/maz-animated-element.md +46 -0
- package/docs/components/maz-animated-text.md +53 -0
- package/docs/components/maz-avatar.md +193 -0
- package/docs/components/maz-backdrop.md +178 -0
- package/docs/components/maz-badge.md +167 -0
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/components/maz-btn-group.md +316 -0
- package/docs/components/maz-btn.md +423 -0
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/components/maz-card.md +321 -0
- package/docs/components/maz-carousel.md +153 -0
- package/docs/components/maz-chart.md +206 -0
- package/docs/components/maz-checkbox.md +138 -0
- package/docs/components/maz-checklist.md +251 -0
- package/docs/components/maz-circular-progress-bar.md +109 -0
- package/docs/components/maz-code-highlight.md +155 -0
- package/docs/components/maz-container.md +241 -0
- package/docs/components/maz-date-picker.md +791 -0
- package/docs/components/maz-dialog-confirm.md +215 -0
- package/docs/components/maz-dialog.md +143 -0
- package/docs/components/maz-drawer.md +106 -0
- package/docs/components/maz-dropdown.md +419 -0
- package/docs/components/maz-dropzone.md +387 -0
- package/docs/components/maz-expand-animation.md +82 -0
- package/docs/components/maz-fullscreen-loader.md +58 -0
- package/docs/components/maz-gallery.md +79 -0
- package/docs/components/maz-icon.md +203 -0
- package/docs/components/maz-input-code.md +73 -0
- package/docs/components/maz-input-number.md +79 -0
- package/docs/components/maz-input-phone-number.md +536 -0
- package/docs/components/maz-input-price.md +68 -0
- package/docs/components/maz-input-tags.md +112 -0
- package/docs/components/maz-input.md +334 -0
- package/docs/components/maz-lazy-img.md +113 -0
- package/docs/components/maz-link.md +146 -0
- package/docs/components/maz-loading-bar.md +38 -0
- package/docs/components/maz-markdown-editor.md +320 -0
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/components/maz-pull-to-refresh.md +222 -0
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/components/maz-read-more.md +209 -0
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/components/maz-select-country.md +513 -0
- package/docs/components/maz-select.md +318 -0
- package/docs/components/maz-sidebar-content.md +25 -0
- package/docs/components/maz-sidebar-footer.md +25 -0
- package/docs/components/maz-sidebar-group.md +27 -0
- package/docs/components/maz-sidebar-header.md +25 -0
- package/docs/components/maz-sidebar-menu-button.md +41 -0
- package/docs/components/maz-sidebar-menu-item.md +25 -0
- package/docs/components/maz-sidebar-menu-sub.md +32 -0
- package/docs/components/maz-sidebar-menu.md +25 -0
- package/docs/components/maz-sidebar-separator.md +21 -0
- package/docs/components/maz-sidebar-trigger.md +25 -0
- package/docs/components/maz-sidebar.md +507 -0
- package/docs/components/maz-skeleton.md +226 -0
- package/docs/components/maz-slider.md +165 -0
- package/docs/components/maz-spinner.md +84 -0
- package/docs/components/maz-stepper.md +301 -0
- package/docs/components/maz-switch.md +86 -0
- package/docs/components/maz-table-cell.md +27 -0
- package/docs/components/maz-table-row.md +28 -0
- package/docs/components/maz-table-title.md +27 -0
- package/docs/components/maz-table-virtualizer.md +31 -0
- package/docs/components/maz-table.md +426 -0
- package/docs/components/maz-tabs-bar.md +43 -0
- package/docs/components/maz-tabs-content-item.md +27 -0
- package/docs/components/maz-tabs-content.md +27 -0
- package/docs/components/maz-tabs.md +308 -0
- package/docs/components/maz-textarea.md +255 -0
- package/docs/components/maz-ticker.md +427 -0
- package/docs/components/maz-timeline.md +304 -0
- package/docs/components/maz-ui-provider.md +26 -0
- package/docs/components/maz-window-mockup.md +182 -0
- package/docs/composables/use-aos.md +41 -0
- package/docs/composables/use-breakpoints.md +42 -0
- package/docs/composables/use-dialog.md +58 -0
- package/docs/composables/use-display-names.md +130 -0
- package/docs/composables/use-drag.md +185 -0
- package/docs/composables/use-form-validator.md +1123 -0
- package/docs/composables/use-idle-timeout.md +172 -0
- package/docs/composables/use-pull-to-refresh.md +86 -0
- package/docs/composables/use-reading-time.md +132 -0
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/composables/use-swipe.md +171 -0
- package/docs/composables/use-timer.md +104 -0
- package/docs/composables/use-toast.md +50 -0
- package/docs/composables/use-user-visibility.md +127 -0
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/directives/click-outside.md +182 -0
- package/docs/directives/fullscreen-img.md +83 -0
- package/docs/directives/lazy-img.md +182 -0
- package/docs/directives/tooltip.md +298 -0
- package/docs/directives/zoom-img.md +100 -0
- package/docs/ecosystem/eslint-config.md +289 -0
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/ecosystem/icons/index.md +584 -0
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/ecosystem/node/exec-promise.md +93 -0
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/ecosystem/node/logger.md +152 -0
- package/docs/ecosystem/node/print-banner.md +101 -0
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/ecosystem/nuxt.md +551 -0
- package/docs/ecosystem/stylelint-config.md +310 -0
- package/docs/ecosystem/themes.md +966 -0
- package/docs/ecosystem/translations.md +1173 -0
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/ecosystem/utils/check-availability.md +85 -0
- package/docs/ecosystem/utils/cookie.md +86 -0
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/ecosystem/utils/currency.md +53 -0
- package/docs/ecosystem/utils/date.md +53 -0
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/ecosystem/utils/debounce-id.md +75 -0
- package/docs/ecosystem/utils/debounce.md +71 -0
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/ecosystem/utils/format-json.md +39 -0
- package/docs/ecosystem/utils/format-phone-number.md +43 -0
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/ecosystem/utils/get-error-message.md +45 -0
- package/docs/ecosystem/utils/idle-timeout.md +96 -0
- package/docs/ecosystem/utils/index.md +57 -0
- package/docs/ecosystem/utils/is-client.md +38 -0
- package/docs/ecosystem/utils/is-equal.md +44 -0
- package/docs/ecosystem/utils/is-ios.md +43 -0
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/ecosystem/utils/kebab-case.md +42 -0
- package/docs/ecosystem/utils/normalize-string.md +83 -0
- package/docs/ecosystem/utils/number.md +51 -0
- package/docs/ecosystem/utils/pascal-case.md +41 -0
- package/docs/ecosystem/utils/prevent-ios-input-zoom.md +72 -0
- package/docs/ecosystem/utils/script-loader.md +85 -0
- package/docs/ecosystem/utils/sleep.md +65 -0
- package/docs/ecosystem/utils/snake-case.md +42 -0
- package/docs/ecosystem/utils/swipe-handler.md +97 -0
- package/docs/ecosystem/utils/textarea-autogrow.md +47 -0
- package/docs/ecosystem/utils/throttle-id.md +54 -0
- package/docs/ecosystem/utils/throttle.md +63 -0
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/ecosystem/utils/types/deep-key-of.md +54 -0
- package/docs/ecosystem/utils/types/deep-partial.md +48 -0
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/ecosystem/utils/types/generic-instance-type.md +48 -0
- package/docs/ecosystem/utils/types/infer-maybe-ref.md +41 -0
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/ecosystem/utils/user-visibility.md +75 -0
- package/docs/guide/ai-agents.md +237 -0
- package/docs/guide/browser-support.md +88 -0
- package/docs/guide/getting-started.md +191 -0
- package/docs/guide/global-defaults.md +103 -0
- package/docs/guide/maz-ui-provider.md +231 -0
- package/docs/guide/migration-v5.md +871 -0
- package/docs/guide/resolvers.md +650 -0
- package/docs/guide/tailwind.md +483 -0
- package/docs/guide/vue.md +286 -0
- package/docs/manifest.json +1 -0
- package/docs/plugins/aos.md +312 -0
- package/docs/plugins/dialog.md +269 -0
- package/docs/plugins/toast.md +221 -0
- package/docs/plugins/wait.md +78 -0
- package/docs/reference/icons.md +46 -0
- package/docs/reference/tailwind-tokens.md +191 -0
- package/docs/rules.md +57 -0
- package/package.json +31 -4
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazCheckbox"
|
|
3
|
+
description: "MazCheckbox is a standalone component that replaces the standard html input checkbox. Color options are available."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-checkbox"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazCheckbox
|
|
9
|
+
|
|
10
|
+
> MazCheckbox is a standalone component that replaces the standard html input checkbox. Color options are available.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazCheckbox from 'maz-ui/components/MazCheckbox'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-checkbox
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
`v-model=""`
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import MazCheckbox from 'maz-ui/components/MazCheckbox'
|
|
26
|
+
import { ref } from 'vue'
|
|
27
|
+
|
|
28
|
+
const checked = ref(false)
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<MazCheckbox v-model="checked" :label="checked ? 'Checked' : 'Unchecked'" />
|
|
33
|
+
</template>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Colors
|
|
37
|
+
|
|
38
|
+
`v-model=""`
|
|
39
|
+
|
|
40
|
+
**Details: View code**
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<script lang="ts" setup>
|
|
44
|
+
import type { Color } from 'maz-ui/components'
|
|
45
|
+
import MazCheckbox from 'maz-ui/components/MazCheckbox'
|
|
46
|
+
import { ref } from 'vue'
|
|
47
|
+
|
|
48
|
+
const chosenColors = ref([])
|
|
49
|
+
|
|
50
|
+
const colors: Color[] = [
|
|
51
|
+
'primary',
|
|
52
|
+
'secondary',
|
|
53
|
+
'info',
|
|
54
|
+
'success',
|
|
55
|
+
'warning',
|
|
56
|
+
'destructive',
|
|
57
|
+
'contrast',
|
|
58
|
+
'accent',
|
|
59
|
+
]
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<MazCheckbox
|
|
64
|
+
v-for="color in colors"
|
|
65
|
+
:id="color"
|
|
66
|
+
:key="color"
|
|
67
|
+
v-model="chosenColors"
|
|
68
|
+
:color="color"
|
|
69
|
+
name="color"
|
|
70
|
+
:value="color"
|
|
71
|
+
>
|
|
72
|
+
{{ color }}
|
|
73
|
+
</MazCheckbox>
|
|
74
|
+
</template>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Sizing
|
|
78
|
+
|
|
79
|
+
`v-model=""`
|
|
80
|
+
|
|
81
|
+
**Details: View code**
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<script lang="ts" setup>
|
|
85
|
+
import type { MazSize } from 'maz-ui/components'
|
|
86
|
+
import MazCheckbox from 'maz-ui/components/MazCheckbox'
|
|
87
|
+
import { ref } from 'vue'
|
|
88
|
+
|
|
89
|
+
const chosenSizes = ref([])
|
|
90
|
+
|
|
91
|
+
const sizes: MazSize[] = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<MazCheckbox
|
|
96
|
+
v-for="size in sizes"
|
|
97
|
+
:key="size"
|
|
98
|
+
v-model="chosenSizes"
|
|
99
|
+
name="size"
|
|
100
|
+
:value="size"
|
|
101
|
+
:size="size"
|
|
102
|
+
>
|
|
103
|
+
{{ size }}
|
|
104
|
+
</MazCheckbox>
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Disabled
|
|
109
|
+
|
|
110
|
+
## MazCheckbox API
|
|
111
|
+
|
|
112
|
+
`import MazCheckbox from 'maz-ui/components/MazCheckbox'`
|
|
113
|
+
|
|
114
|
+
### Props
|
|
115
|
+
|
|
116
|
+
- `model-value` (`T`, `v-model`): The model value of the checkbox.
|
|
117
|
+
- `id` (`string`): The id of the checkbox.
|
|
118
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the checkbox.
|
|
119
|
+
- `value` (`MazCheckboxValue`): The value of the checkbox when selected.
|
|
120
|
+
- `name` (`string`, default: `"m-checkbox"`): The name of the checkbox.
|
|
121
|
+
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): The size of the checkbox.
|
|
122
|
+
- `label` (`string`): Text label.
|
|
123
|
+
- `disabled` (`boolean`): If the checkbox is disabled.
|
|
124
|
+
- `error` (`boolean`): Whether there is an error with the input.
|
|
125
|
+
- `success` (`boolean`): Whether the input is successful.
|
|
126
|
+
- `warning` (`boolean`): Whether there is a warning with the input.
|
|
127
|
+
- `hint` (`string`): The hint text to display below the input.
|
|
128
|
+
|
|
129
|
+
### Events
|
|
130
|
+
|
|
131
|
+
- `@update:model-value` (payload: `value: T`): Emitted when the model value change
|
|
132
|
+
- `@blur` (payload: `value: FocusEvent`): Emitted when the checkbox lost focus
|
|
133
|
+
- `@change` (payload: `value: T`): Emitted when the model value change
|
|
134
|
+
- `@focus` (payload: `value: FocusEvent`): Emitted when the checkbox is focused
|
|
135
|
+
|
|
136
|
+
### Slots
|
|
137
|
+
|
|
138
|
+
- `#default` Bindings: `value: MazCheckboxValue`.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazChecklist"
|
|
3
|
+
description: "MazChecklist is a standalone component that allows creating a checklist with integrated search functionality. It provides a flexible and customizable user interface for selecting multiple items from a list of options. The component supports real-time search, color customization, and displays messages when no results are found."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-checklist"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazChecklist
|
|
9
|
+
|
|
10
|
+
> MazChecklist is a standalone component that allows creating a checklist with integrated search functionality. It provides a flexible and customizable user interface for selecting multiple items from a list of options. The component supports real-time search, color customization, and displays messages when no results are found.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazChecklist from 'maz-ui/components/MazChecklist'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-checklist
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
**Tip:**
|
|
20
|
+
|
|
21
|
+
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
|
|
22
|
+
|
|
23
|
+
## Basic usage
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<template>
|
|
27
|
+
Selected languages: {{ languages || 'none' }}
|
|
28
|
+
|
|
29
|
+
<br />
|
|
30
|
+
|
|
31
|
+
<MazChecklist
|
|
32
|
+
v-model="languages"
|
|
33
|
+
v-model:query="query"
|
|
34
|
+
title="Select your languages"
|
|
35
|
+
:search="{
|
|
36
|
+
enabled: true,
|
|
37
|
+
placeholder: 'Search a language',
|
|
38
|
+
debounce: 300,
|
|
39
|
+
autoFocus: false,
|
|
40
|
+
size: 'sm'
|
|
41
|
+
}"
|
|
42
|
+
:items="languagesOptions"
|
|
43
|
+
class="h-80"
|
|
44
|
+
>
|
|
45
|
+
<template #item="{ item }">
|
|
46
|
+
<div class="flex w-full items-center justify-between gap-2">
|
|
47
|
+
<span class="capitalize">{{ item.label }}</span>
|
|
48
|
+
<MazBadge color="theme" outlined>
|
|
49
|
+
{{ item.value }}
|
|
50
|
+
</MazBadge>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
</MazChecklist>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script lang="ts" setup>
|
|
57
|
+
import { ref } from 'vue'
|
|
58
|
+
import MazChecklist from 'maz-ui/components/MazChecklist'
|
|
59
|
+
import { useDisplayNames } from 'maz-ui/composables/useDisplayNames'
|
|
60
|
+
|
|
61
|
+
const query = ref<string>()
|
|
62
|
+
const languages = ref<string[]>()
|
|
63
|
+
const languagesOptions = useDisplayNames('en-US').getAllDisplayNames({ type: 'language' }).value.map(({ code, name }) => ({
|
|
64
|
+
label: name,
|
|
65
|
+
value: code,
|
|
66
|
+
}))
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Custom search function
|
|
71
|
+
|
|
72
|
+
You can replace the default search function by providing a custom search function. Useful when you need to search by multiple fields, if you want to use a different search algorithm or if you want search into your database by fetching data from an API.
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<template>
|
|
76
|
+
Selected employees: {{ selectedEmployees || 'none' }}
|
|
77
|
+
|
|
78
|
+
<br />
|
|
79
|
+
|
|
80
|
+
<MazChecklist
|
|
81
|
+
v-model="selectedEmployees"
|
|
82
|
+
v-model:query="employeeQuery"
|
|
83
|
+
title="Select team members"
|
|
84
|
+
:search="{
|
|
85
|
+
placeholder: 'Search by name, email, or department...',
|
|
86
|
+
debounce: 200,
|
|
87
|
+
block: true,
|
|
88
|
+
}"
|
|
89
|
+
:items="employees"
|
|
90
|
+
:search-function="customEmployeeSearch"
|
|
91
|
+
color="success"
|
|
92
|
+
elevation
|
|
93
|
+
class="max-h-96"
|
|
94
|
+
>
|
|
95
|
+
<template #item="{ item }">
|
|
96
|
+
<div class="flex w-full items-center gap-4">
|
|
97
|
+
<div class="flex h-12 w-12 flex-none items-center justify-center rounded-full bg-linear-to-br from-primary-500 to-secondary-500 text-white font-semibold text-lg">
|
|
98
|
+
{{ item.initials }}
|
|
99
|
+
</div>
|
|
100
|
+
<div class="flex flex-1 flex-col gap-1">
|
|
101
|
+
<div class="flex items-center gap-2">
|
|
102
|
+
<span class="font-semibold text-normal">{{ item.label }}</span>
|
|
103
|
+
<MazBadge :color="item.departmentColor" size="xs">
|
|
104
|
+
{{ item.department }}
|
|
105
|
+
</MazBadge>
|
|
106
|
+
</div>
|
|
107
|
+
<span class="text-muted text-sm">{{ item.email }}</span>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="flex flex-none items-center gap-1">
|
|
110
|
+
<MazIcon icon="/star.svg" class="text-warning-500" size="1rem" />
|
|
111
|
+
<span class="text-sm font-medium">{{ item.rating }}</span>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
</MazChecklist>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<script lang="ts" setup>
|
|
119
|
+
import { ref } from 'vue'
|
|
120
|
+
import MazChecklist from 'maz-ui/components/MazChecklist'
|
|
121
|
+
|
|
122
|
+
const employeeQuery = ref<string>()
|
|
123
|
+
const selectedEmployees = ref<string[]>()
|
|
124
|
+
|
|
125
|
+
const employees = [
|
|
126
|
+
{
|
|
127
|
+
label: 'Sarah Johnson',
|
|
128
|
+
value: 'sarah.johnson',
|
|
129
|
+
email: 'sarah.johnson@company.com',
|
|
130
|
+
department: 'Engineering',
|
|
131
|
+
departmentColor: 'info',
|
|
132
|
+
initials: 'SJ',
|
|
133
|
+
rating: 4.9
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: 'Michael Chen',
|
|
137
|
+
value: 'michael.chen',
|
|
138
|
+
email: 'michael.chen@company.com',
|
|
139
|
+
department: 'Design',
|
|
140
|
+
departmentColor: 'warning',
|
|
141
|
+
initials: 'MC',
|
|
142
|
+
rating: 4.7
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
label: 'Emma Rodriguez',
|
|
146
|
+
value: 'emma.rodriguez',
|
|
147
|
+
email: 'emma.rodriguez@company.com',
|
|
148
|
+
department: 'Marketing',
|
|
149
|
+
departmentColor: 'success',
|
|
150
|
+
initials: 'ER',
|
|
151
|
+
rating: 4.8
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: 'David Kim',
|
|
155
|
+
value: 'david.kim',
|
|
156
|
+
email: 'david.kim@company.com',
|
|
157
|
+
department: 'Engineering',
|
|
158
|
+
departmentColor: 'info',
|
|
159
|
+
initials: 'DK',
|
|
160
|
+
rating: 4.6
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: 'Lisa Thompson',
|
|
164
|
+
value: 'lisa.thompson',
|
|
165
|
+
email: 'lisa.thompson@company.com',
|
|
166
|
+
department: 'Product',
|
|
167
|
+
departmentColor: 'contrast',
|
|
168
|
+
initials: 'LT',
|
|
169
|
+
rating: 4.9
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: 'John Doe',
|
|
173
|
+
value: 'john.doe',
|
|
174
|
+
email: 'john.doe@company.com',
|
|
175
|
+
department: 'Marketing',
|
|
176
|
+
departmentColor: 'success',
|
|
177
|
+
initials: 'JD',
|
|
178
|
+
rating: 4.9
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: 'Jane Smith',
|
|
182
|
+
value: 'jane.smith',
|
|
183
|
+
email: 'jane.smith@company.com',
|
|
184
|
+
department: 'Engineering',
|
|
185
|
+
departmentColor: 'info',
|
|
186
|
+
initials: 'JS',
|
|
187
|
+
rating: 4.9
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: 'Jim Beam',
|
|
191
|
+
value: 'jim.beam',
|
|
192
|
+
email: 'jim.beam@company.com',
|
|
193
|
+
department: 'Sales',
|
|
194
|
+
departmentColor: 'destructive',
|
|
195
|
+
initials: 'JB',
|
|
196
|
+
rating: 4.9
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
label: 'Jill Johnson',
|
|
200
|
+
value: 'jill.johnson',
|
|
201
|
+
email: 'jill.johnson@company.com',
|
|
202
|
+
department: 'Marketing',
|
|
203
|
+
departmentColor: 'success',
|
|
204
|
+
initials: 'JJ',
|
|
205
|
+
rating: 4.9
|
|
206
|
+
},
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
function customEmployeeSearch(query: string, items: typeof employees) {
|
|
210
|
+
const searchTerm = query.toLowerCase().trim()
|
|
211
|
+
|
|
212
|
+
if (!searchTerm) return items
|
|
213
|
+
|
|
214
|
+
return items.filter(employee =>
|
|
215
|
+
employee.label.toLowerCase().includes(searchTerm) ||
|
|
216
|
+
employee.email.toLowerCase().includes(searchTerm) ||
|
|
217
|
+
employee.department.toLowerCase().includes(searchTerm) ||
|
|
218
|
+
employee.value.toLowerCase().includes(searchTerm)
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
</script>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## MazChecklist API
|
|
225
|
+
|
|
226
|
+
`import MazChecklist from 'maz-ui/components/MazChecklist'`
|
|
227
|
+
|
|
228
|
+
### Props
|
|
229
|
+
|
|
230
|
+
- `model-value` (`T[]`, `v-model`): The model value of the checklist (selected items).
|
|
231
|
+
- `query` (`string`, `v-model:query`): The query to filter the items (model).
|
|
232
|
+
- `items` (`O[]`): The list of items to display.
|
|
233
|
+
- `title` (`string`): The title of the checklist.
|
|
234
|
+
- `elevation` (`boolean`, default: `false`): Add elevation to the card.
|
|
235
|
+
- `search` (`boolean | MazInputProps<string>`, default: `{ enabled: false, debounce: 300, autoFocus: false }`): The search input options.
|
|
236
|
+
- `search-options` (`(NormalizeStringOptions & { threshold?: number | undefined; })`): The options to normalize the search query (used by the default search function) By default, the threshold is 0.75.
|
|
237
|
+
- `search-function` (`((query: string, items: O[]) => O[] | undefined)`): Replace the default search function to provide a custom search function.
|
|
238
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the checklist (card, checkbox and search input).
|
|
239
|
+
- `translations` (`{ noResultsFound?: string | undefined; searchInput?: { placeholder?: string | undefined; } | undefined; }`, default: `Translations from`): Translations of the checklist component.
|
|
240
|
+
|
|
241
|
+
### Events
|
|
242
|
+
|
|
243
|
+
- `@update:model-value` (payload: `value?: T[] | undefined`): Emitted when the model value change
|
|
244
|
+
- `@update:query` (payload: `value?: string | undefined`): Emitted when the query change
|
|
245
|
+
|
|
246
|
+
### Slots
|
|
247
|
+
|
|
248
|
+
- `#title`: use this slot to customize the title
|
|
249
|
+
- `#no-results`: use this slot to customize the no results area
|
|
250
|
+
- `#no-results-text`: use this slot to customize the no results message
|
|
251
|
+
- `#item`: use this slot to customize the item Bindings: `selectedValues: T[]`, `item: O`.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazCircularProgressBar"
|
|
3
|
+
description: "MazCircularProgressBar is a standalone component"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-circular-progress-bar"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazCircularProgressBar
|
|
9
|
+
|
|
10
|
+
> MazCircularProgressBar is a standalone component
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazCircularProgressBar from 'maz-ui/components/MazCircularProgressBar'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-circular-progress-bar
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import MazCircularProgressBar from 'maz-ui/components/MazCircularProgressBar'
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<MazCircularProgressBar :percentage="75" suffix="%" />
|
|
28
|
+
</template>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Size
|
|
32
|
+
|
|
33
|
+
The size of the component can be changed by passing the `size` prop. The value could be a string in px, em or rem.
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<MazCircularProgressBar :percentage="75" suffix="%" size="3em" />
|
|
37
|
+
|
|
38
|
+
<MazCircularProgressBar :percentage="75" suffix="%" size="100px" />
|
|
39
|
+
|
|
40
|
+
<MazCircularProgressBar :percentage="75" suffix="%" size="10rem" />
|
|
41
|
+
|
|
42
|
+
<MazCircularProgressBar :percentage="75" suffix="%" size="15rem" />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Duration
|
|
46
|
+
|
|
47
|
+
The duration of the animation can be changed by passing the `duration` prop. The value could be a number in milliseconds.
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<MazCircularProgressBar :percentage="75" :duration="5000" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Color
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<MazCircularProgressBar :percentage="75" :duration="5000" />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Auto-color
|
|
60
|
+
|
|
61
|
+
The color of the component is automatically according to the percentage. The color will be green if the percentage is egal to 100%, orange if below 100%, and red if below 50%.
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<MazCircularProgressBar :percentage="0" auto-color size="9rem" />
|
|
65
|
+
|
|
66
|
+
<MazCircularProgressBar :percentage="25" auto-color size="9rem" />
|
|
67
|
+
|
|
68
|
+
<MazCircularProgressBar :percentage="50" auto-color size="9rem" />
|
|
69
|
+
|
|
70
|
+
<MazCircularProgressBar :percentage="100" auto-color size="9rem" />
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Slot
|
|
74
|
+
|
|
75
|
+
Replace the percentage value by a custom slot.
|
|
76
|
+
|
|
77
|
+
Obviously, the "counter animation" will not work in this case.
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<MazCircularProgressBar :percentage="75" :duration="5000" />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## MazCircularProgressBar API
|
|
84
|
+
|
|
85
|
+
`import MazCircularProgressBar from 'maz-ui/components/MazCircularProgressBar'`
|
|
86
|
+
|
|
87
|
+
### Props
|
|
88
|
+
|
|
89
|
+
- `percentage` (`number`, required): The percentage value of the progress bar.
|
|
90
|
+
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"10em"`): The size of the progress bar.
|
|
91
|
+
- `duration` (`number`, default: `1000`): Duration of the animation in milliseconds.
|
|
92
|
+
- `delay` (`number`, default: `100`): Delay before the animation starts in milliseconds.
|
|
93
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`): The color of the progress bar.
|
|
94
|
+
- `auto-color` (`boolean`, default: `false`): Auto color based on the count (destructive, warning, success).
|
|
95
|
+
- `prefix` (`string`): Suffix to display next to the number.
|
|
96
|
+
- `suffix` (`string`): Suffix to display next to the number.
|
|
97
|
+
- `stroke-linecap` (`"square" | "butt" | "round" | "inherit"`, default: `"round"`): The stroke-linecap style.
|
|
98
|
+
- `stroke-width` (`Numberish`, default: `6`): The stroke width.
|
|
99
|
+
- `stroke` (`string`): The stroke color Use this prop to override the gradient color You can use a color name or a color code.
|
|
100
|
+
- `success-percentage` (`number`, default: `100`): The percentage value of the success level - The progress circle will be filled with the success color when the percentage is greater than or equal to this value.
|
|
101
|
+
- `warning-percentage` (`number`, default: `75`): The percentage value of the warning level - The progress circle will be filled with the warning color when the percentage is greater than or equal to this value.
|
|
102
|
+
- `danger-percentage` (`number`, default: `50`): The percentage value of the danger level - The progress circle will be filled with the danger color when the percentage is greater than or equal to this value.
|
|
103
|
+
- `once` (`boolean`, default: `true`): Play the animation only once.
|
|
104
|
+
|
|
105
|
+
### Slots
|
|
106
|
+
|
|
107
|
+
- `#default`: Default slot - Replace the percaentage value
|
|
108
|
+
- `#prefix`: Prefix slot - Add a prefix next to the number (e.g: "$")
|
|
109
|
+
- `#suffix`: Suffix slot - Add a suffix next to the number (e.g: "%")
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazCodeHighlight"
|
|
3
|
+
description: "MazCodeHighlight displays source code with syntax highlighting powered by shiki. It auto-detects dark/light mode, ships with a copy-to-clipboard button, a language badge, and supports lazy loading."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-code-highlight"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazCodeHighlight
|
|
9
|
+
|
|
10
|
+
> MazCodeHighlight displays source code with syntax highlighting powered by shiki. It auto-detects dark/light mode, ships with a copy-to-clipboard button, a language badge, and supports lazy loading.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-code-highlight
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
## Installation requirement
|
|
20
|
+
|
|
21
|
+
Install [`shiki`](https://shiki.style) in your project to enable highlighting:
|
|
22
|
+
|
|
23
|
+
```bash [pnpm]
|
|
24
|
+
pnpm add shiki
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash [npm]
|
|
28
|
+
npm install shiki
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash [yarn]
|
|
32
|
+
yarn add shiki
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If `shiki` is not installed, the component falls back to a plain `<pre><code>` block.
|
|
36
|
+
|
|
37
|
+
## Basic usage
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<MazCodeHighlight code="const greeting = 'Hello, maz-ui!'" language="ts" />
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## With slot
|
|
50
|
+
|
|
51
|
+
The default slot text is used as source code when the `code` prop is not provided. This is useful for plain text blocks.
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<template>
|
|
55
|
+
<MazCodeHighlight language="bash">npm install maz-ui</MazCodeHighlight>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script lang="ts" setup>
|
|
59
|
+
import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Languages
|
|
64
|
+
|
|
65
|
+
Pass any valid [shiki language identifier](https://shiki.style/languages) to the `language` prop. The chosen language is also displayed as a small badge in the top-right corner (the badge fades out on hover when the copy button appears).
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<MazCodeHighlight language="vue" :code="vueExample" />
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script lang="ts" setup>
|
|
73
|
+
import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'
|
|
74
|
+
|
|
75
|
+
const vueExample = `<script lang="ts" setup>
|
|
76
|
+
import { ref } from 'vue'
|
|
77
|
+
const count = ref(0)
|
|
78
|
+
<\/script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<button @click="count++">Count: {{ count }}</button>
|
|
82
|
+
</template>`
|
|
83
|
+
</script>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Custom theme
|
|
87
|
+
|
|
88
|
+
Override the auto-detected theme with any [shiki built-in theme](https://shiki.style/themes).
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<template>
|
|
92
|
+
<MazCodeHighlight code="console.log('dracula theme')" language="js" theme="dracula" />
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script lang="ts" setup>
|
|
96
|
+
import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'
|
|
97
|
+
</script>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Copy to clipboard
|
|
101
|
+
|
|
102
|
+
A copy button is displayed in the top-right corner on hover (or when focused via keyboard). Clicking it writes the resolved code to the clipboard and shows a check icon for ~1.5s.
|
|
103
|
+
|
|
104
|
+
### Disable the copy button
|
|
105
|
+
|
|
106
|
+
Set `:copyable="false"` to hide the button entirely.
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<template>
|
|
110
|
+
<MazCodeHighlight code="const noCopyButton = true" language="ts" :copyable="false" />
|
|
111
|
+
</template>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Copy a different value than the displayed code
|
|
115
|
+
|
|
116
|
+
Use `copyValue` when the displayed source differs from what should be copied - for example to strip a leading `$` prompt when rendering a shell command. This is the mechanism `MazWindowMockup` uses internally to keep the terminal prompt out of the clipboard.
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<template>
|
|
120
|
+
<MazCodeHighlight
|
|
121
|
+
code="$ pnpm add maz-ui"
|
|
122
|
+
copy-value="pnpm add maz-ui"
|
|
123
|
+
language="bash"
|
|
124
|
+
/>
|
|
125
|
+
</template>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Disable rounded corners
|
|
129
|
+
|
|
130
|
+
Set `:rounded="false"` to render the highlighted block with squared corners - useful when embedding inside another container that already has its own border-radius (e.g. inside `MazWindowMockup`).
|
|
131
|
+
|
|
132
|
+
```vue
|
|
133
|
+
<template>
|
|
134
|
+
<MazCodeHighlight code="// squared corners" language="ts" :rounded="false" />
|
|
135
|
+
</template>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Custom translations
|
|
139
|
+
|
|
140
|
+
The copy button's aria-label and tooltip come from the `@maz-ui/translations` package (`codeHighlight.copyToClipboard` / `codeHighlight.copiedToClipboard`). You can override either key per-instance with the `translations` prop without touching the global locale:
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<template>
|
|
144
|
+
<MazCodeHighlight
|
|
145
|
+
code="const hello = 'world'"
|
|
146
|
+
language="ts"
|
|
147
|
+
:translations="{
|
|
148
|
+
copyToClipboard: 'Copier le code',
|
|
149
|
+
copiedToClipboard: 'Copié !',
|
|
150
|
+
}"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
|