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,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazLink"
|
|
3
|
+
description: "MazLink is a standalone component to create links and buttons."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-link"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazLink
|
|
9
|
+
|
|
10
|
+
> MazLink is a standalone component to create links and buttons.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazLink from 'maz-ui/components/MazLink'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-link
|
|
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 MazLink from 'maz-ui/components/MazLink'
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<MazLink href="https://maz-ui.com" target="_blank">
|
|
28
|
+
View product detail
|
|
29
|
+
</MazLink>
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Color
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<MazLink color="primary"> View product detail (primary) </MazLink>
|
|
37
|
+
<MazLink color="secondary"> View product detail (secondary) </MazLink>
|
|
38
|
+
<MazLink color="info"> View product detail (info) </MazLink>
|
|
39
|
+
<MazLink color="success"> View product detail (success) </MazLink>
|
|
40
|
+
<MazLink color="warning"> View product detail (warning) </MazLink>
|
|
41
|
+
<MazLink color="destructive"> View product detail (destructive) </MazLink>
|
|
42
|
+
<MazLink color="accent"> View product detail (accent) </MazLink>
|
|
43
|
+
<MazLink color="contrast"> View product detail (contrast) </MazLink>
|
|
44
|
+
<MazLink color="surface"> View product detail (surface) </MazLink>
|
|
45
|
+
<MazLink color="muted"> View product detail (muted) </MazLink>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## RouterLink
|
|
49
|
+
|
|
50
|
+
When you use the `to` prop, the component will be a `router-link` and will use the `router` to navigate.
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<MazLink :to="{ path: '/' }"> View product detail </MazLink>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Icons
|
|
57
|
+
|
|
58
|
+
You can add an icon on the left and right to the link text with the `start-icon` and `end-icon` props.
|
|
59
|
+
|
|
60
|
+
For more information about the icons, please check the [MazBtn](./maz-btn.md#icons) page.
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
import { MazCheck } from '@maz-ui/icons/raw/MazCheck'
|
|
65
|
+
import { MazHome } from '@maz-ui/icons/raw/MazHome'
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<MazLink start-icon="/home.svg" :end-icon="MazHome">
|
|
70
|
+
View product detail
|
|
71
|
+
</MazLink>
|
|
72
|
+
|
|
73
|
+
<MazLink start-icon="/home.svg" :end-icon="MazHome">
|
|
74
|
+
View product detail
|
|
75
|
+
</MazLink>
|
|
76
|
+
</template>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`startIcon` and `endIcon` also accept a full `MazIconProps` object - pass the same shape `<MazIcon>` accepts to override the icon size, add a `<title>` for screen readers, etc.
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<MazLink
|
|
83
|
+
href="/external"
|
|
84
|
+
:end-icon="{
|
|
85
|
+
icon: MazArrowRight,
|
|
86
|
+
size: 'lg',
|
|
87
|
+
title: 'Go to external page',
|
|
88
|
+
flipIconForRtl: true,
|
|
89
|
+
}"
|
|
90
|
+
>
|
|
91
|
+
Read more
|
|
92
|
+
</MazLink>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## External icon (true by default)
|
|
96
|
+
|
|
97
|
+
When you use the `autoExternal` prop, the component will have an external icon if the link has the target `_blank`.
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<MazLink href="https://loicmazuel.com" target="_blank" auto-external> View product detail </MazLink>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## As button
|
|
104
|
+
|
|
105
|
+
If no `to` or `href` is provided, the component will be a `button` by default. You can force the component to be a `button`, `a`, `router-link` or `nuxt-link` with the `as` prop.
|
|
106
|
+
|
|
107
|
+
```vue
|
|
108
|
+
<script lang="ts" setup>
|
|
109
|
+
import MazLink from 'maz-ui/components/MazLink'
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<MazLink as="button"> View product detail </MazLink>
|
|
114
|
+
<MazLink as="button" disabled> View product detail </MazLink>
|
|
115
|
+
</template>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## MazLink API
|
|
119
|
+
|
|
120
|
+
`import MazLink from 'maz-ui/components/MazLink'`
|
|
121
|
+
|
|
122
|
+
### Props
|
|
123
|
+
|
|
124
|
+
- `as` (`string`, default: `depends on the provided props`): The component to use for the link - if not provided, it will be `router-link` or `nuxt-link` if `to` is provided, will be `a` if `href` is provided, otherwise it will be `button`, you can force the component to be used with `as` prop. Values: `'router-link'`, `'nuxt-link'`, `'button'` (non exhaustive).
|
|
125
|
+
- `id` (`string`): The id of the link.
|
|
126
|
+
- `title` (`string`): The title of the link.
|
|
127
|
+
- `href` (`string`): The href of the link.
|
|
128
|
+
- `to` (`string | et | X`): The route location (router-link) of the link.
|
|
129
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface" | "muted" | "inherit"`, default: `"primary"`): The color of the link.
|
|
130
|
+
- `target` (`string`, default: `"_self"`): The target of the link. Values: `'_blank'`, `'_self'`, `'_parent'`, `'_top'` (non exhaustive).
|
|
131
|
+
- `download` (`string`): The download of the link.
|
|
132
|
+
- `rel` (`string`): The rel of the link.
|
|
133
|
+
- `aria-label` (`string`): The aria-label of the link.
|
|
134
|
+
- `underline` (`boolean`, default: `false`): Add an underline to the link.
|
|
135
|
+
- `underline-hover` (`boolean`, default: `true`): Add an underline only on hover.
|
|
136
|
+
- `auto-external` (`boolean`, default: `true`): Add an external icon to the link if target is '_blank'.
|
|
137
|
+
- `start-icon` (`MazIconLike`): Icon displayed on the inline-start edge (left in LTR, right in RTL). Accepts a bare value (Vue component, raw SVG string, URL or `data:` URI) or a full `MazIconProps` object for fine-grained control.
|
|
138
|
+
- `end-icon` (`MazIconLike`): Icon displayed on the inline-end edge (right in LTR, left in RTL). Accepts a bare value or a full `MazIconProps` object.
|
|
139
|
+
- `disabled` (`boolean`, default: `false`): The disabled state of the link if the component is a button.
|
|
140
|
+
|
|
141
|
+
### Slots
|
|
142
|
+
|
|
143
|
+
- `#start-icon`: The icon to display on the inline-start edge of the text (left in LTR, right in RTL)
|
|
144
|
+
- `#default`: Text of the link
|
|
145
|
+
- `#end-icon`: The icon to display on the inline-end edge of the text (right in LTR, left in RTL)
|
|
146
|
+
- `#external-icon`: Replace the default external icon
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazLoadingBar"
|
|
3
|
+
description: "MazLoadingBar is a standalone component"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-loading-bar"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazLoadingBar
|
|
9
|
+
|
|
10
|
+
> MazLoadingBar is a standalone component
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazLoadingBar from 'maz-ui/components/MazLoadingBar'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-loading-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 MazLoadingBar from 'maz-ui/components/MazLoadingBar'
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<MazLoadingBar color="secondary" />
|
|
28
|
+
</template>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## MazLoadingBar API
|
|
32
|
+
|
|
33
|
+
`import MazLoadingBar from 'maz-ui/components/MazLoadingBar'`
|
|
34
|
+
|
|
35
|
+
### Props
|
|
36
|
+
|
|
37
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the component.
|
|
38
|
+
- `height` (`string`): The height of the component.
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazMarkdownEditor"
|
|
3
|
+
description: "MazMarkdownEditor is a GitHub-style markdown editor with Write/Preview/Split tabs, a configurable formatting toolbar, optional line numbers, and a sanitized preview. It shares the same states, labels and theming as MazTextarea, is SSR-friendly, and supports custom renderers."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-markdown-editor"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazMarkdownEditor
|
|
9
|
+
|
|
10
|
+
> MazMarkdownEditor is a GitHub-style markdown editor with Write/Preview/Split tabs, a configurable formatting toolbar, optional line numbers, and a sanitized preview. It shares the same states, labels and theming as MazTextarea, is SSR-friendly, and supports custom renderers.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-markdown-editor
|
|
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
|
+
The preview relies on [`marked`](https://marked.js.org) for parsing and [`dompurify`](https://github.com/cure53/DOMPurify) for sanitization. Both are loaded lazily (only when the preview is rendered), so install them in your project:
|
|
22
|
+
|
|
23
|
+
```bash [pnpm]
|
|
24
|
+
pnpm add marked dompurify
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash [npm]
|
|
28
|
+
npm install marked dompurify
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash [yarn]
|
|
32
|
+
yarn add marked dompurify
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If they are not installed, the preview falls back to a safe, escaped plain-text block. You can also provide your own renderer with the `renderFunction` prop to avoid these dependencies entirely.
|
|
36
|
+
|
|
37
|
+
## Basic usage
|
|
38
|
+
|
|
39
|
+
The component exposes a `v-model` bound to the raw markdown string and two tabs: **Write** (textarea) and **Preview** (rendered, sanitized HTML).
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<template>
|
|
43
|
+
<MazMarkdownEditor v-model="content" />
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script lang="ts" setup>
|
|
47
|
+
import { ref } from 'vue'
|
|
48
|
+
import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'
|
|
49
|
+
|
|
50
|
+
const content = ref('# Hello maz-ui\n\nThis is **markdown** with a [link](https://maz-ui.com).')
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Toolbar
|
|
55
|
+
|
|
56
|
+
The formatting toolbar is opt-in. Set `toolbar` to `true` to display the full toolbar. Buttons act on the current textarea selection and preserve the native undo/redo history (`Cmd/Ctrl + Z`).
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<template>
|
|
60
|
+
<MazMarkdownEditor v-model="content" toolbar />
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
import { ref } from 'vue'
|
|
65
|
+
import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'
|
|
66
|
+
|
|
67
|
+
const content = ref('Select some text and click **Bold**.')
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Available actions
|
|
72
|
+
|
|
73
|
+
The full toolbar exposes the following action keys:
|
|
74
|
+
|
|
75
|
+
| Key | Result |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `heading` | Heading dropdown (`#`, `##`, `###`) |
|
|
78
|
+
| `bold` | `**bold**` |
|
|
79
|
+
| `italic` | `_italic_` |
|
|
80
|
+
| `strikethrough` | `~~strikethrough~~` |
|
|
81
|
+
| `quote` | `> quote` |
|
|
82
|
+
| `code` | `` `inline code` `` |
|
|
83
|
+
| `codeBlock` | fenced ` ``` ` code block |
|
|
84
|
+
| `link` | `[text](url)` |
|
|
85
|
+
| `image` | `` |
|
|
86
|
+
| `bulletList` | `- item` |
|
|
87
|
+
| `orderedList` | `1. item` |
|
|
88
|
+
| `checkList` | `- [ ] task` |
|
|
89
|
+
| `table` | markdown table skeleton |
|
|
90
|
+
|
|
91
|
+
### Configure the toolbar
|
|
92
|
+
|
|
93
|
+
Pass an **ordered array of action keys** to display only a subset (and control their order):
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<template>
|
|
97
|
+
<MazMarkdownEditor
|
|
98
|
+
v-model="content"
|
|
99
|
+
:toolbar="['heading', 'bold', 'italic', 'link', 'codeBlock']"
|
|
100
|
+
/>
|
|
101
|
+
</template>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Keyboard shortcuts
|
|
105
|
+
|
|
106
|
+
Classic markdown shortcuts are enabled by default and work whenever the textarea is focused. They preserve the native undo/redo history. The toolbar buttons also display their shortcut in the tooltip. Use `mod` for `Cmd` on macOS and `Ctrl` elsewhere.
|
|
107
|
+
|
|
108
|
+
| Shortcut | Action |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| `mod + B` | Bold |
|
|
111
|
+
| `mod + I` | Italic |
|
|
112
|
+
| `mod + Shift + X` | Strikethrough |
|
|
113
|
+
| `mod + K` | Link |
|
|
114
|
+
| `mod + E` | Inline code |
|
|
115
|
+
| `mod + Shift + E` | Code block |
|
|
116
|
+
| `mod + Shift + .` | Quote |
|
|
117
|
+
| `mod + Shift + 8` | Bulleted list |
|
|
118
|
+
| `mod + Shift + 7` | Numbered list |
|
|
119
|
+
| `mod + Shift + L` | Task list |
|
|
120
|
+
| `mod + Alt + 1/2/3` | Heading 1/2/3 |
|
|
121
|
+
|
|
122
|
+
Disable them with `:shortcuts="false"`:
|
|
123
|
+
|
|
124
|
+
```vue
|
|
125
|
+
<template>
|
|
126
|
+
<MazMarkdownEditor v-model="content" toolbar :shortcuts="false" />
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Tip:**
|
|
131
|
+
|
|
132
|
+
Image and table insertions have no default shortcut (to avoid clashing with browser shortcuts). Use the toolbar buttons or the `toolbar` slot helpers for those.
|
|
133
|
+
|
|
134
|
+
## List continuation
|
|
135
|
+
|
|
136
|
+
Pressing Enter inside a list automatically inserts the next marker, just like a desktop markdown editor:
|
|
137
|
+
|
|
138
|
+
- Bulleted lists (`-`, `*`, `+`) repeat the marker.
|
|
139
|
+
- Numbered lists increment the index (`1.` → `2.`).
|
|
140
|
+
- Task lists insert a fresh unchecked box (`- [ ] `).
|
|
141
|
+
- Indentation is preserved.
|
|
142
|
+
|
|
143
|
+
Pressing Enter again on an empty item removes the marker and exits the list. This works out of the box, no configuration required.
|
|
144
|
+
|
|
145
|
+
## Label & assistive text
|
|
146
|
+
|
|
147
|
+
Like `MazTextarea`, the editor supports a static `top-label` (or `label`), the `required` asterisk and an `assistive-text` displayed below the editor.
|
|
148
|
+
|
|
149
|
+
```vue
|
|
150
|
+
<template>
|
|
151
|
+
<MazMarkdownEditor
|
|
152
|
+
v-model="content"
|
|
153
|
+
top-label="Description"
|
|
154
|
+
assistive-text="Markdown is supported"
|
|
155
|
+
required
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## States
|
|
161
|
+
|
|
162
|
+
Use `error`, `success`, `warning`, `disabled` and `readonly` to reflect validation states, consistent with the other form components.
|
|
163
|
+
|
|
164
|
+
```vue
|
|
165
|
+
<template>
|
|
166
|
+
<MazMarkdownEditor v-model="content" error assistive-text="This field has an error" />
|
|
167
|
+
<MazMarkdownEditor v-model="content" success assistive-text="Looks good!" />
|
|
168
|
+
<MazMarkdownEditor v-model="content" disabled />
|
|
169
|
+
</template>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Split mode
|
|
173
|
+
|
|
174
|
+
A third tab displays the editor and the preview side by side. Switch to it from the toolbar tabs, or control it with `v-model:mode` (`'write' | 'preview' | 'split'`). On small screens the two panes stack vertically.
|
|
175
|
+
|
|
176
|
+
```vue
|
|
177
|
+
<template>
|
|
178
|
+
<MazMarkdownEditor v-model="content" mode="split" />
|
|
179
|
+
</template>
|
|
180
|
+
|
|
181
|
+
<script lang="ts" setup>
|
|
182
|
+
import { ref } from 'vue'
|
|
183
|
+
import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'
|
|
184
|
+
|
|
185
|
+
const content = ref('# Split view\n\nType on the left, see the **preview** on the right.')
|
|
186
|
+
</script>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Line numbers
|
|
190
|
+
|
|
191
|
+
Enable the `line-numbers` prop to display a gutter on the left of the editor. Numbers reflect logical lines and stay in sync with the textarea scroll.
|
|
192
|
+
|
|
193
|
+
```vue
|
|
194
|
+
<template>
|
|
195
|
+
<MazMarkdownEditor v-model="content" line-numbers />
|
|
196
|
+
</template>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Custom renderer
|
|
200
|
+
|
|
201
|
+
Provide a `render-function` to use your own markdown engine (e.g. `markdown-it`, a Nuxt Content renderer, or a server-side pipeline). It receives the raw markdown and returns an HTML string (sync or async). The result is still sanitized when `sanitize` is enabled.
|
|
202
|
+
|
|
203
|
+
```vue
|
|
204
|
+
<template>
|
|
205
|
+
<MazMarkdownEditor v-model="content" :render-function="renderer" />
|
|
206
|
+
</template>
|
|
207
|
+
|
|
208
|
+
<script lang="ts" setup>
|
|
209
|
+
import { ref } from 'vue'
|
|
210
|
+
import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'
|
|
211
|
+
|
|
212
|
+
const content = ref('Rendered by a custom function')
|
|
213
|
+
|
|
214
|
+
function renderer(markdown: string) {
|
|
215
|
+
return `<p>${markdown.toUpperCase()}</p>`
|
|
216
|
+
}
|
|
217
|
+
</script>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Sanitization
|
|
221
|
+
|
|
222
|
+
By default, the rendered HTML is sanitized with DOMPurify to prevent XSS. Disabling it (`:sanitize="false"`) renders the raw output of the renderer; only do this when the markdown source is fully trusted.
|
|
223
|
+
|
|
224
|
+
```vue
|
|
225
|
+
<template>
|
|
226
|
+
<!-- Trusted content only -->
|
|
227
|
+
<MazMarkdownEditor v-model="content" :sanitize="false" />
|
|
228
|
+
</template>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Controlled mode
|
|
232
|
+
|
|
233
|
+
The active tab is available through `v-model:mode` (`'write' | 'preview' | 'split'`).
|
|
234
|
+
|
|
235
|
+
```vue
|
|
236
|
+
<template>
|
|
237
|
+
<MazMarkdownEditor v-model="content" v-model:mode="mode" />
|
|
238
|
+
<p>Current tab: {{ mode }}</p>
|
|
239
|
+
</template>
|
|
240
|
+
|
|
241
|
+
<script lang="ts" setup>
|
|
242
|
+
import { ref } from 'vue'
|
|
243
|
+
import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'
|
|
244
|
+
|
|
245
|
+
const content = ref('')
|
|
246
|
+
const mode = ref<'write' | 'preview' | 'split'>('write')
|
|
247
|
+
</script>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Custom translations
|
|
251
|
+
|
|
252
|
+
The tab labels, the empty-preview text and the toolbar button labels come from the `@maz-ui/translations` package (`markdownEditor.*`). You can override any key per-instance with the `translations` prop without touching the global locale:
|
|
253
|
+
|
|
254
|
+
```vue
|
|
255
|
+
<template>
|
|
256
|
+
<MazMarkdownEditor
|
|
257
|
+
v-model="content"
|
|
258
|
+
toolbar
|
|
259
|
+
:translations="{ write: 'Édition', preview: 'Aperçu', emptyPreview: 'Rien à afficher' }"
|
|
260
|
+
/>
|
|
261
|
+
</template>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
|
|
265
|
+
|
|
266
|
+
## Accessibility
|
|
267
|
+
|
|
268
|
+
The write / preview / split switcher follows the [WAI-ARIA tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/): it is a `tablist` named by the `name` prop, the editor and the preview are its `tabpanel`s. Only the selected mode is in the tab sequence, ← / → (reversed in RTL), Home and End switch the mode.
|
|
269
|
+
|
|
270
|
+
## MazMarkdownEditor API
|
|
271
|
+
|
|
272
|
+
`import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'`
|
|
273
|
+
|
|
274
|
+
### Props
|
|
275
|
+
|
|
276
|
+
- `model-value` (`string`, `v-model`): The markdown value of the editor.
|
|
277
|
+
- `id` (`string`): The id of the textarea.
|
|
278
|
+
- `name` (`string`, default: `"MazMarkdownEditor"`): The name of the textarea.
|
|
279
|
+
- `label` (`string`): Static label displayed above the editor.
|
|
280
|
+
- `placeholder` (`string`): The placeholder of the textarea.
|
|
281
|
+
- `required` (`boolean`, default: `false`): If the editor is required.
|
|
282
|
+
- `disabled` (`boolean`, default: `false`): If the editor is disabled.
|
|
283
|
+
- `readonly` (`boolean`, default: `false`): If the editor is readonly.
|
|
284
|
+
- `error` (`boolean`, default: `false`): If the editor has an error.
|
|
285
|
+
- `success` (`boolean`, default: `false`): If the editor has a success.
|
|
286
|
+
- `warning` (`boolean`, default: `false`): If the editor has a warning.
|
|
287
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the editor.
|
|
288
|
+
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size radius of the component's border.
|
|
289
|
+
- `top-label` (`string`): Static label displayed above the editor. Unlike a floating label, this remains fixed.
|
|
290
|
+
- `assistive-text` (`string`): Helper text displayed below the editor to provide additional context or validation feedback.
|
|
291
|
+
- `toolbar` (`boolean | MazMarkdownEditorToolbarAction[]`, default: `false`): Show the formatting toolbar. Pass `true` for the full toolbar, or an ordered array of action keys to display only a subset (and control their order).
|
|
292
|
+
- `line-numbers` (`boolean`, default: `false`): Display line numbers in a gutter on the left of the editor.
|
|
293
|
+
- `shortcuts` (`boolean`, default: `true`): Enable keyboard shortcuts for the toolbar actions (e.g. Cmd/Ctrl+B for bold).
|
|
294
|
+
- `sanitize` (`boolean`, default: `true`): Sanitize the rendered preview HTML with DOMPurify.
|
|
295
|
+
- `render-function` (`((markdown: string) => string | Promise<string>)`): Custom markdown renderer. Receives the raw markdown and returns an HTML string (sync or async). Falls back to `marked` when omitted. The result is still sanitized when `sanitize` is enabled.
|
|
296
|
+
- `marked-options` (`Record<string, unknown>`): Options forwarded to `marked` when using the default renderer.
|
|
297
|
+
- `rows` (`number`, default: `6`): Minimum number of visible rows of the editor textarea.
|
|
298
|
+
- `translations` (`{ write?: string | undefined; preview?: string | undefined; split?: string | undefined; emptyPreview?: string | undefined; toolbar?: { heading?: string | undefined; bold?: string | undefined; italic?: string | undefined; strikethrough?: ...`): Custom translations for the component. Override any key independently.
|
|
299
|
+
- `mode` (`MazMarkdownEditorMode`, default: `"write"`, `v-model:mode`)
|
|
300
|
+
|
|
301
|
+
### Events
|
|
302
|
+
|
|
303
|
+
- `@update:model-value` (payload: `value?: string | undefined`): Emitted when the markdown value changes
|
|
304
|
+
- `@blur` (payload: `value: FocusEvent`): Emitted when the textarea is blurred
|
|
305
|
+
- `@change` (payload: `value: Event`): Emitted when the textarea value changes
|
|
306
|
+
- `@focus` (payload: `value: FocusEvent`): Emitted when the textarea is focused
|
|
307
|
+
- `@input` (payload: `value?: string | undefined`): Emitted when the markdown value changes
|
|
308
|
+
- `@update:mode` (payload: `value: MazMarkdownEditorMode`)
|
|
309
|
+
|
|
310
|
+
### Slots
|
|
311
|
+
|
|
312
|
+
- `#label`: Replace the static label above the editor
|
|
313
|
+
- `#toolbar`: Replace the toolbar content (only rendered when the toolbar is enabled and not in preview mode) Bindings: `mode: MazMarkdownEditorMode` (The current editor mode), `wrapSelection: (before: string, after?: string) => void` (Wrap the current selection with the given markers), `prefixLines: (prefix: string) => void` (Prefix every selected line with the given string), `applyHeading: (level: number) => void` (Apply a heading of the given level to the selected lines), `insertLink: () => void` (Insert a markdown link at the selection), `insertImage: () => void` (Insert a markdown image at the selection), `insertCodeBlock: () => void` (Insert a fenced code block at the selection), `insertTable: () => void` (Insert a markdown table at the selection).
|
|
314
|
+
- `#empty-preview`: Content displayed in the preview pane when there is nothing to render
|
|
315
|
+
|
|
316
|
+
### Exposed (template ref)
|
|
317
|
+
|
|
318
|
+
- `textarea`: The underlying textarea element
|
|
319
|
+
- `renderPreview`: Programmatically re-render the markdown preview
|
|
320
|
+
- `focus`: Focus the editor textarea
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazPagination"
|
|
3
|
+
description: "MazPagination is a standalone component"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-pagination"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazPagination
|
|
9
|
+
|
|
10
|
+
> MazPagination is a standalone component
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazPagination from 'maz-ui/components/MazPagination'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-pagination
|
|
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
|
+
`v-model=""`
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { MazPagination, type MazPaginationProps } from 'maz-ui/components'
|
|
30
|
+
|
|
31
|
+
import { ref } from 'vue'
|
|
32
|
+
|
|
33
|
+
const currentPage = ref(1)
|
|
34
|
+
|
|
35
|
+
const props: MazPaginationProps = {
|
|
36
|
+
totalPages: 10,
|
|
37
|
+
activeColor: 'contrast',
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<MazPagination v-bind="props" v-model="currentPage" size="md" />
|
|
43
|
+
</template>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Sizes
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<MazPagination v-bind="props" v-model="currentPage" size="xs" />
|
|
50
|
+
<MazPagination v-bind="props" v-model="currentPage" size="sm" />
|
|
51
|
+
<MazPagination v-bind="props" v-model="currentPage" size="md" />
|
|
52
|
+
<MazPagination v-bind="props" v-model="currentPage" size="lg" />
|
|
53
|
+
<MazPagination v-bind="props" v-model="currentPage" size="xl" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Colors
|
|
57
|
+
|
|
58
|
+
## MazPagination API
|
|
59
|
+
|
|
60
|
+
`import MazPagination from 'maz-ui/components/MazPagination'`
|
|
61
|
+
|
|
62
|
+
### Props
|
|
63
|
+
|
|
64
|
+
- `model-value` (`number`, default: `1`, `v-model`): The current page number.
|
|
65
|
+
- `button-props` (`Partial<MazBtnProps>`): Props apply to the MazBtn components.
|
|
66
|
+
- `active-color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface"`, default: `"surface"`): Color of the active button.
|
|
67
|
+
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the buttons.
|
|
68
|
+
- `total-pages` (`number`, required, default: `10`): Total number of pages.
|
|
69
|
+
- `page-range` (`number`, default: `1`): Number of buttons to display before and after the current page.
|
|
70
|
+
- `loading` (`boolean`, default: `false`): Enable loading state of current button.
|
|
71
|
+
|
|
72
|
+
### Events
|
|
73
|
+
|
|
74
|
+
- `@update:model-value` (payload: `value: number`)
|
|
75
|
+
|
|
76
|
+
### Slots
|
|
77
|
+
|
|
78
|
+
- `#first-page-sr`: Accessible text for screen reader of the previous page button Bindings: `page: number` (first page number).
|
|
79
|
+
- `#previous-page-sr`: Accessible text for screen reader of the first page button Bindings: `page: number` (previous page number).
|
|
80
|
+
- `#page-sr`: Accessible text for screen reader of the current page button Bindings: `page: number` (current page number).
|
|
81
|
+
- `#next-page-sr`: Accessible text for screen reader of the next page button Bindings: `page: number` (next page number).
|
|
82
|
+
- `#last-page-sr`: Accessible text for screen reader of the last page button Bindings: `page: number` (last page number).
|