@maz-ui/mcp 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/README.md +61 -228
- package/bin/maz-ui-mcp.mjs +2 -5
- package/dist/cli.d.mts +7 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.mjs +14 -0
- package/dist/index.d.mts +340 -0
- package/dist/index.d.ts +340 -0
- package/dist/index.mjs +14 -0
- package/dist/shared/mcp.DzqVbCaL.mjs +2346 -0
- 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/{src/components → components}/maz-alert.md +31 -164
- 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/{src/components → components}/maz-badge.md +26 -67
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/{src/components → components}/maz-btn-group.md +26 -189
- package/docs/{src/components → components}/maz-btn.md +60 -245
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/{src/components → components}/maz-card.md +67 -192
- package/docs/components/maz-carousel.md +153 -0
- package/docs/{src/components → components}/maz-chart.md +17 -161
- 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/{src/components → components}/maz-code-highlight.md +15 -93
- package/docs/components/maz-container.md +241 -0
- package/docs/{src/components → components}/maz-date-picker.md +85 -454
- 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/{src/components → components}/maz-dropzone.md +80 -221
- 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/{src/components → components}/maz-icon.md +32 -83
- 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/{src/components → components}/maz-input.md +74 -221
- 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/{src/components → components}/maz-markdown-editor.md +72 -125
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/{src/components → components}/maz-pull-to-refresh.md +59 -45
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/{src/components → components}/maz-read-more.md +31 -122
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/{src/components → components}/maz-select-country.md +80 -340
- package/docs/{src/components → components}/maz-select.md +76 -206
- 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/{src/components → components}/maz-sidebar.md +117 -329
- package/docs/{src/components → components}/maz-skeleton.md +27 -156
- package/docs/{src/components → components}/maz-slider.md +33 -66
- package/docs/components/maz-spinner.md +84 -0
- package/docs/{src/components → components}/maz-stepper.md +43 -185
- 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/{src/components → components}/maz-tabs.md +89 -126
- 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/{src/components → components}/maz-window-mockup.md +38 -105
- 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/{src/composables → composables}/use-display-names.md +12 -59
- package/docs/{src/composables → composables}/use-drag.md +14 -68
- package/docs/{src/composables → composables}/use-form-validator.md +22 -696
- package/docs/{src/composables → composables}/use-idle-timeout.md +13 -97
- package/docs/{src/composables → composables}/use-pull-to-refresh.md +14 -7
- package/docs/{src/composables → composables}/use-reading-time.md +20 -56
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/{src/composables → composables}/use-swipe.md +14 -81
- package/docs/{src/composables → composables}/use-timer.md +12 -38
- package/docs/composables/use-toast.md +50 -0
- package/docs/{src/composables → composables}/use-user-visibility.md +14 -56
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/{src/directives → directives}/click-outside.md +13 -99
- package/docs/{src/directives → directives}/fullscreen-img.md +10 -28
- package/docs/{src/directives → directives}/lazy-img.md +14 -49
- package/docs/{src/directives → directives}/tooltip.md +12 -217
- package/docs/{src/directives → directives}/zoom-img.md +11 -38
- package/docs/{src/ecosystem → ecosystem}/eslint-config.md +37 -29
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/{src/ecosystem → ecosystem}/icons/index.md +22 -16
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/{src/ecosystem → ecosystem}/node/exec-promise.md +12 -6
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/{src/ecosystem → ecosystem}/node/logger.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/node/print-banner.md +12 -4
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/{src/ecosystem → ecosystem}/nuxt.md +46 -19
- package/docs/{src/ecosystem → ecosystem}/stylelint-config.md +33 -25
- package/docs/{src/ecosystem → ecosystem}/themes.md +72 -235
- package/docs/{src/ecosystem → ecosystem}/translations.md +25 -23
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/check-availability.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/cookie.md +18 -12
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/{src/ecosystem → ecosystem}/utils/currency.md +12 -26
- package/docs/{src/ecosystem → ecosystem}/utils/date.md +10 -24
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/{src/ecosystem → ecosystem}/utils/debounce-id.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/debounce.md +14 -8
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/{src/ecosystem → ecosystem}/utils/format-json.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/format-phone-number.md +12 -6
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/{src/ecosystem → ecosystem}/utils/get-error-message.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/idle-timeout.md +15 -9
- package/docs/{src/ecosystem → ecosystem}/utils/index.md +10 -13
- package/docs/{src/ecosystem → ecosystem}/utils/is-client.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/is-equal.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/is-ios.md +12 -6
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/{src/ecosystem → ecosystem}/utils/kebab-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/normalize-string.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/number.md +10 -24
- package/docs/{src/ecosystem → ecosystem}/utils/pascal-case.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/prevent-ios-input-zoom.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/script-loader.md +16 -8
- package/docs/{src/ecosystem → ecosystem}/utils/sleep.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/snake-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/swipe-handler.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/textarea-autogrow.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/utils/throttle-id.md +13 -7
- package/docs/{src/ecosystem → ecosystem}/utils/throttle.md +14 -8
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-key-of.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-partial.md +10 -4
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/generic-instance-type.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/types/infer-maybe-ref.md +10 -4
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/{src/ecosystem → ecosystem}/utils/user-visibility.md +12 -6
- package/docs/guide/ai-agents.md +237 -0
- package/docs/{src/guide → guide}/browser-support.md +22 -15
- package/docs/{src/guide → guide}/getting-started.md +34 -139
- package/docs/{src/guide → guide}/global-defaults.md +12 -11
- package/docs/{src/guide → guide}/maz-ui-provider.md +17 -16
- package/docs/{src/guide → guide}/migration-v5.md +95 -88
- package/docs/{src/guide → guide}/resolvers.md +33 -100
- package/docs/guide/tailwind.md +483 -0
- package/docs/{src/guide → guide}/vue.md +33 -39
- package/docs/manifest.json +1 -0
- package/docs/{src/plugins → plugins}/aos.md +20 -55
- package/docs/{src/plugins → plugins}/dialog.md +14 -161
- 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 +84 -22
- package/dist/mcp.d.mts +0 -153
- package/dist/mcp.d.ts +0 -153
- package/dist/mcp.mjs +0 -1511
- package/docs/generated-docs/maz-accordion.doc.md +0 -21
- package/docs/generated-docs/maz-alert.doc.md +0 -20
- package/docs/generated-docs/maz-animated-counter.doc.md +0 -17
- package/docs/generated-docs/maz-animated-element.doc.md +0 -14
- package/docs/generated-docs/maz-animated-text.doc.md +0 -17
- package/docs/generated-docs/maz-avatar.doc.md +0 -45
- package/docs/generated-docs/maz-backdrop.doc.md +0 -55
- package/docs/generated-docs/maz-badge.doc.md +0 -16
- package/docs/generated-docs/maz-bottom-sheet.doc.md +0 -24
- package/docs/generated-docs/maz-btn-group.doc.md +0 -20
- package/docs/generated-docs/maz-btn.doc.md +0 -33
- package/docs/generated-docs/maz-card-spotlight.doc.md +0 -16
- package/docs/generated-docs/maz-card.doc.md +0 -39
- package/docs/generated-docs/maz-carousel.doc.md +0 -17
- package/docs/generated-docs/maz-chart.doc.md +0 -10
- package/docs/generated-docs/maz-checkbox.doc.md +0 -33
- package/docs/generated-docs/maz-checklist.doc.md +0 -30
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +0 -27
- package/docs/generated-docs/maz-code-highlight.doc.md +0 -11
- package/docs/generated-docs/maz-container.doc.md +0 -26
- package/docs/generated-docs/maz-date-picker.doc.md +0 -56
- package/docs/generated-docs/maz-dialog-confirm.doc.md +0 -24
- package/docs/generated-docs/maz-dialog.doc.md +0 -22
- package/docs/generated-docs/maz-drawer.doc.md +0 -25
- package/docs/generated-docs/maz-dropdown.doc.md +0 -45
- package/docs/generated-docs/maz-dropzone.doc.md +0 -82
- package/docs/generated-docs/maz-expand-animation.doc.md +0 -12
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +0 -13
- package/docs/generated-docs/maz-gallery.doc.md +0 -17
- package/docs/generated-docs/maz-icon.doc.md +0 -16
- package/docs/generated-docs/maz-input-code.doc.md +0 -25
- package/docs/generated-docs/maz-input-number.doc.md +0 -33
- package/docs/generated-docs/maz-input-phone-number.doc.md +0 -62
- package/docs/generated-docs/maz-input-price.doc.md +0 -26
- package/docs/generated-docs/maz-input-tags.doc.md +0 -24
- package/docs/generated-docs/maz-input.doc.md +0 -54
- package/docs/generated-docs/maz-lazy-img.doc.md +0 -49
- package/docs/generated-docs/maz-link.doc.md +0 -31
- package/docs/generated-docs/maz-loading-bar.doc.md +0 -6
- package/docs/generated-docs/maz-markdown-editor.doc.md +0 -65
- package/docs/generated-docs/maz-pagination.doc.md +0 -21
- package/docs/generated-docs/maz-popover.doc.md +0 -79
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +0 -50
- package/docs/generated-docs/maz-radio-buttons.doc.md +0 -34
- package/docs/generated-docs/maz-radio.doc.md +0 -33
- package/docs/generated-docs/maz-read-more.doc.md +0 -18
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +0 -18
- package/docs/generated-docs/maz-select-country.doc.md +0 -45
- package/docs/generated-docs/maz-select.doc.md +0 -32
- package/docs/generated-docs/maz-sidebar-content.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-footer.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-group.doc.md +0 -11
- package/docs/generated-docs/maz-sidebar-header.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +0 -27
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +0 -16
- package/docs/generated-docs/maz-sidebar-menu.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar.doc.md +0 -36
- package/docs/generated-docs/maz-skeleton.doc.md +0 -12
- package/docs/generated-docs/maz-slider.doc.md +0 -20
- package/docs/generated-docs/maz-spinner.doc.md +0 -6
- package/docs/generated-docs/maz-stepper.doc.md +0 -30
- package/docs/generated-docs/maz-switch.doc.md +0 -31
- package/docs/generated-docs/maz-table-cell.doc.md +0 -5
- package/docs/generated-docs/maz-table-row.doc.md +0 -12
- package/docs/generated-docs/maz-table-title.doc.md +0 -5
- package/docs/generated-docs/maz-table-virtualizer.doc.md +0 -20
- package/docs/generated-docs/maz-table.doc.md +0 -72
- package/docs/generated-docs/maz-tabs-bar.doc.md +0 -29
- package/docs/generated-docs/maz-tabs-content-item.doc.md +0 -11
- package/docs/generated-docs/maz-tabs-content.doc.md +0 -5
- package/docs/generated-docs/maz-tabs.doc.md +0 -20
- package/docs/generated-docs/maz-textarea.doc.md +0 -46
- package/docs/generated-docs/maz-ticker.doc.md +0 -25
- package/docs/generated-docs/maz-timeline.doc.md +0 -32
- package/docs/generated-docs/maz-ui-provider.doc.md +0 -12
- package/docs/generated-docs/maz-window-mockup.doc.md +0 -23
- package/docs/src/blog/v4.md +0 -276
- package/docs/src/blog/v5.md +0 -184
- package/docs/src/changelog.md +0 -7
- package/docs/src/components/index.md +0 -8
- package/docs/src/components/maz-accordion.md +0 -80
- package/docs/src/components/maz-animated-counter.md +0 -124
- package/docs/src/components/maz-animated-element.md +0 -36
- package/docs/src/components/maz-animated-text.md +0 -36
- package/docs/src/components/maz-avatar.md +0 -227
- package/docs/src/components/maz-backdrop.md +0 -250
- package/docs/src/components/maz-bottom-sheet.md +0 -533
- package/docs/src/components/maz-card-spotlight.md +0 -163
- package/docs/src/components/maz-carousel.md +0 -231
- package/docs/src/components/maz-checkbox.md +0 -168
- package/docs/src/components/maz-checklist.md +0 -414
- package/docs/src/components/maz-circular-progress-bar.md +0 -145
- package/docs/src/components/maz-container.md +0 -363
- package/docs/src/components/maz-dialog-confirm.md +0 -240
- package/docs/src/components/maz-dialog.md +0 -164
- package/docs/src/components/maz-drawer.md +0 -181
- package/docs/src/components/maz-dropdown.md +0 -691
- package/docs/src/components/maz-expand-animation.md +0 -99
- package/docs/src/components/maz-fullscreen-loader.md +0 -58
- package/docs/src/components/maz-gallery.md +0 -85
- package/docs/src/components/maz-input-code.md +0 -61
- package/docs/src/components/maz-input-number.md +0 -81
- package/docs/src/components/maz-input-phone-number.md +0 -942
- package/docs/src/components/maz-input-price.md +0 -67
- package/docs/src/components/maz-input-tags.md +0 -114
- package/docs/src/components/maz-lazy-img.md +0 -88
- package/docs/src/components/maz-link.md +0 -178
- package/docs/src/components/maz-loading-bar.md +0 -26
- package/docs/src/components/maz-pagination.md +0 -79
- package/docs/src/components/maz-popover.md +0 -1416
- package/docs/src/components/maz-radio-buttons.md +0 -462
- package/docs/src/components/maz-radio.md +0 -142
- package/docs/src/components/maz-reading-progress-bar.md +0 -74
- package/docs/src/components/maz-spinner.md +0 -93
- package/docs/src/components/maz-switch.md +0 -92
- package/docs/src/components/maz-table.md +0 -732
- package/docs/src/components/maz-textarea.md +0 -400
- package/docs/src/components/maz-ticker.md +0 -692
- package/docs/src/components/maz-timeline.md +0 -478
- package/docs/src/composables/use-aos.md +0 -34
- package/docs/src/composables/use-breakpoints.md +0 -35
- package/docs/src/composables/use-dialog.md +0 -88
- package/docs/src/composables/use-string-matching.md +0 -63
- package/docs/src/composables/use-toast.md +0 -71
- package/docs/src/composables/use-wait.md +0 -62
- package/docs/src/composables/use-window-size.md +0 -18
- package/docs/src/ecosystem/icons/icon-set.md +0 -123
- package/docs/src/ecosystem/mcp.md +0 -210
- package/docs/src/ecosystem/node/index.md +0 -53
- package/docs/src/ecosystem/utils/camel-case.md +0 -31
- package/docs/src/ecosystem/utils/capitalize.md +0 -50
- package/docs/src/ecosystem/utils/country-code-to-unicode-flag.md +0 -213
- package/docs/src/ecosystem/utils/debounce-callback.md +0 -38
- package/docs/src/ecosystem/utils/fetch-locale-ip.md +0 -33
- package/docs/src/ecosystem/utils/get-browser-locale.md +0 -29
- package/docs/src/ecosystem/utils/get-country-flag-url.md +0 -156
- package/docs/src/ecosystem/utils/is-server.md +0 -31
- package/docs/src/ecosystem/utils/is-standalone-mode.md +0 -43
- package/docs/src/ecosystem/utils/truthy-filter.md +0 -31
- package/docs/src/ecosystem/utils/types/deep-required.md +0 -39
- package/docs/src/ecosystem/utils/types/flatten-object-keys.md +0 -44
- package/docs/src/ecosystem/utils/upper-first.md +0 -32
- package/docs/src/guide/cli.md +0 -144
- package/docs/src/guide/migration-v4.md +0 -925
- package/docs/src/guide/tailwind.md +0 -158
- package/docs/src/index.md +0 -603
- package/docs/src/made-with-maz-ui.md +0 -58
- package/docs/src/plugins/toast.md +0 -349
- package/docs/src/plugins/wait.md +0 -109
- package/docs/src/theme-editor.md +0 -21
|
@@ -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` (`any`): 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` (`any`): 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.
|
|
@@ -1,20 +1,25 @@
|
|
|
1
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.
|
|
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"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# MazMarkdownEditor
|
|
7
9
|
|
|
8
|
-
|
|
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.
|
|
9
11
|
|
|
10
|
-
|
|
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)
|
|
11
18
|
|
|
12
19
|
## Installation requirement
|
|
13
20
|
|
|
14
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:
|
|
15
22
|
|
|
16
|
-
::: code-group
|
|
17
|
-
|
|
18
23
|
```bash [pnpm]
|
|
19
24
|
pnpm add marked dompurify
|
|
20
25
|
```
|
|
@@ -27,19 +32,12 @@ npm install marked dompurify
|
|
|
27
32
|
yarn add marked dompurify
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
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`](#custom-renderer) prop to avoid these dependencies entirely.
|
|
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.
|
|
33
36
|
|
|
34
37
|
## Basic usage
|
|
35
38
|
|
|
36
39
|
The component exposes a `v-model` bound to the raw markdown string and two tabs: **Write** (textarea) and **Preview** (rendered, sanitized HTML).
|
|
37
40
|
|
|
38
|
-
<ComponentDemo>
|
|
39
|
-
<MazMarkdownEditor v-model="basic" placeholder="markdown goes here" />
|
|
40
|
-
|
|
41
|
-
<template #code>
|
|
42
|
-
|
|
43
41
|
```vue
|
|
44
42
|
<template>
|
|
45
43
|
<MazMarkdownEditor v-model="content" />
|
|
@@ -53,18 +51,10 @@ The component exposes a `v-model` bound to the raw markdown string and two tabs:
|
|
|
53
51
|
</script>
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
</template>
|
|
57
|
-
</ComponentDemo>
|
|
58
|
-
|
|
59
54
|
## Toolbar
|
|
60
55
|
|
|
61
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`).
|
|
62
57
|
|
|
63
|
-
<ComponentDemo>
|
|
64
|
-
<MazMarkdownEditor v-model="withToolbar" toolbar />
|
|
65
|
-
|
|
66
|
-
<template #code>
|
|
67
|
-
|
|
68
58
|
```vue
|
|
69
59
|
<template>
|
|
70
60
|
<MazMarkdownEditor v-model="content" toolbar />
|
|
@@ -78,9 +68,6 @@ The formatting toolbar is opt-in. Set `toolbar` to `true` to display the full to
|
|
|
78
68
|
</script>
|
|
79
69
|
```
|
|
80
70
|
|
|
81
|
-
</template>
|
|
82
|
-
</ComponentDemo>
|
|
83
|
-
|
|
84
71
|
### Available actions
|
|
85
72
|
|
|
86
73
|
The full toolbar exposes the following action keys:
|
|
@@ -105,11 +92,6 @@ The full toolbar exposes the following action keys:
|
|
|
105
92
|
|
|
106
93
|
Pass an **ordered array of action keys** to display only a subset (and control their order):
|
|
107
94
|
|
|
108
|
-
<ComponentDemo>
|
|
109
|
-
<MazMarkdownEditor v-model="withToolbarConfig" :toolbar="['heading', 'bold', 'italic', 'link', 'codeBlock']" />
|
|
110
|
-
|
|
111
|
-
<template #code>
|
|
112
|
-
|
|
113
95
|
```vue
|
|
114
96
|
<template>
|
|
115
97
|
<MazMarkdownEditor
|
|
@@ -119,9 +101,6 @@ Pass an **ordered array of action keys** to display only a subset (and control t
|
|
|
119
101
|
</template>
|
|
120
102
|
```
|
|
121
103
|
|
|
122
|
-
</template>
|
|
123
|
-
</ComponentDemo>
|
|
124
|
-
|
|
125
104
|
## Keyboard shortcuts
|
|
126
105
|
|
|
127
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.
|
|
@@ -148,36 +127,25 @@ Disable them with `:shortcuts="false"`:
|
|
|
148
127
|
</template>
|
|
149
128
|
```
|
|
150
129
|
|
|
151
|
-
|
|
130
|
+
**Tip:**
|
|
131
|
+
|
|
152
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.
|
|
153
|
-
:::
|
|
154
133
|
|
|
155
134
|
## List continuation
|
|
156
135
|
|
|
157
|
-
Pressing
|
|
136
|
+
Pressing Enter inside a list automatically inserts the next marker, just like a desktop markdown editor:
|
|
158
137
|
|
|
159
138
|
- Bulleted lists (`-`, `*`, `+`) repeat the marker.
|
|
160
139
|
- Numbered lists increment the index (`1.` → `2.`).
|
|
161
140
|
- Task lists insert a fresh unchecked box (`- [ ] `).
|
|
162
141
|
- Indentation is preserved.
|
|
163
142
|
|
|
164
|
-
Pressing
|
|
143
|
+
Pressing Enter again on an empty item removes the marker and exits the list. This works out of the box, no configuration required.
|
|
165
144
|
|
|
166
145
|
## Label & assistive text
|
|
167
146
|
|
|
168
147
|
Like `MazTextarea`, the editor supports a static `top-label` (or `label`), the `required` asterisk and an `assistive-text` displayed below the editor.
|
|
169
148
|
|
|
170
|
-
<ComponentDemo>
|
|
171
|
-
<MazMarkdownEditor
|
|
172
|
-
v-model="withLabel"
|
|
173
|
-
top-label="Description"
|
|
174
|
-
placeholder="Markdown goes here"
|
|
175
|
-
assistive-text="Markdown is supported"
|
|
176
|
-
required
|
|
177
|
-
/>
|
|
178
|
-
|
|
179
|
-
<template #code>
|
|
180
|
-
|
|
181
149
|
```vue
|
|
182
150
|
<template>
|
|
183
151
|
<MazMarkdownEditor
|
|
@@ -189,22 +157,10 @@ Like `MazTextarea`, the editor supports a static `top-label` (or `label`), the `
|
|
|
189
157
|
</template>
|
|
190
158
|
```
|
|
191
159
|
|
|
192
|
-
</template>
|
|
193
|
-
</ComponentDemo>
|
|
194
|
-
|
|
195
160
|
## States
|
|
196
161
|
|
|
197
162
|
Use `error`, `success`, `warning`, `disabled` and `readonly` to reflect validation states, consistent with the other form components.
|
|
198
163
|
|
|
199
|
-
<ComponentDemo>
|
|
200
|
-
<div class="maz:flex maz:flex-col maz:gap-4">
|
|
201
|
-
<MazMarkdownEditor v-model="stateError" error assistive-text="This field has an error" />
|
|
202
|
-
<MazMarkdownEditor v-model="stateSuccess" success assistive-text="Looks good!" />
|
|
203
|
-
<MazMarkdownEditor v-model="stateDisabled" disabled />
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<template #code>
|
|
207
|
-
|
|
208
164
|
```vue
|
|
209
165
|
<template>
|
|
210
166
|
<MazMarkdownEditor v-model="content" error assistive-text="This field has an error" />
|
|
@@ -213,18 +169,10 @@ Use `error`, `success`, `warning`, `disabled` and `readonly` to reflect validati
|
|
|
213
169
|
</template>
|
|
214
170
|
```
|
|
215
171
|
|
|
216
|
-
</template>
|
|
217
|
-
</ComponentDemo>
|
|
218
|
-
|
|
219
172
|
## Split mode
|
|
220
173
|
|
|
221
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.
|
|
222
175
|
|
|
223
|
-
<ComponentDemo>
|
|
224
|
-
<MazMarkdownEditor v-model="splitContent" mode="split" />
|
|
225
|
-
|
|
226
|
-
<template #code>
|
|
227
|
-
|
|
228
176
|
```vue
|
|
229
177
|
<template>
|
|
230
178
|
<MazMarkdownEditor v-model="content" mode="split" />
|
|
@@ -238,36 +186,20 @@ A third tab displays the editor and the preview side by side. Switch to it from
|
|
|
238
186
|
</script>
|
|
239
187
|
```
|
|
240
188
|
|
|
241
|
-
</template>
|
|
242
|
-
</ComponentDemo>
|
|
243
|
-
|
|
244
189
|
## Line numbers
|
|
245
190
|
|
|
246
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.
|
|
247
192
|
|
|
248
|
-
<ComponentDemo>
|
|
249
|
-
<MazMarkdownEditor v-model="lineNumbersContent" line-numbers />
|
|
250
|
-
|
|
251
|
-
<template #code>
|
|
252
|
-
|
|
253
193
|
```vue
|
|
254
194
|
<template>
|
|
255
195
|
<MazMarkdownEditor v-model="content" line-numbers />
|
|
256
196
|
</template>
|
|
257
197
|
```
|
|
258
198
|
|
|
259
|
-
|
|
260
|
-
</ComponentDemo>
|
|
261
|
-
|
|
262
|
-
## Custom renderer {#custom-renderer}
|
|
199
|
+
## Custom renderer
|
|
263
200
|
|
|
264
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.
|
|
265
202
|
|
|
266
|
-
<ComponentDemo>
|
|
267
|
-
<MazMarkdownEditor v-model="customRender" :render-function="upperCaseRenderer" />
|
|
268
|
-
|
|
269
|
-
<template #code>
|
|
270
|
-
|
|
271
203
|
```vue
|
|
272
204
|
<template>
|
|
273
205
|
<MazMarkdownEditor v-model="content" :render-function="renderer" />
|
|
@@ -285,9 +217,6 @@ Provide a `render-function` to use your own markdown engine (e.g. `markdown-it`,
|
|
|
285
217
|
</script>
|
|
286
218
|
```
|
|
287
219
|
|
|
288
|
-
</template>
|
|
289
|
-
</ComponentDemo>
|
|
290
|
-
|
|
291
220
|
## Sanitization
|
|
292
221
|
|
|
293
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.
|
|
@@ -322,15 +251,6 @@ The active tab is available through `v-model:mode` (`'write' | 'preview' | 'spli
|
|
|
322
251
|
|
|
323
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:
|
|
324
253
|
|
|
325
|
-
<ComponentDemo>
|
|
326
|
-
<MazMarkdownEditor
|
|
327
|
-
v-model="translated"
|
|
328
|
-
toolbar
|
|
329
|
-
:translations="{ write: 'Édition', preview: 'Aperçu', emptyPreview: 'Rien à afficher' }"
|
|
330
|
-
/>
|
|
331
|
-
|
|
332
|
-
<template #code>
|
|
333
|
-
|
|
334
254
|
```vue
|
|
335
255
|
<template>
|
|
336
256
|
<MazMarkdownEditor
|
|
@@ -341,33 +261,60 @@ The tab labels, the empty-preview text and the toolbar button labels come from t
|
|
|
341
261
|
</template>
|
|
342
262
|
```
|
|
343
263
|
|
|
344
|
-
|
|
345
|
-
</ComponentDemo>
|
|
346
|
-
|
|
347
|
-
For app-wide translations, set up the [maz-ui translations plugin](/translations) and the component will pick up your locale automatically.
|
|
348
|
-
|
|
349
|
-
<script lang="ts" setup>
|
|
350
|
-
import { ref } from 'vue'
|
|
351
|
-
|
|
352
|
-
const basic = ref('# Hello maz-ui\n\nThis is **markdown** with a [link](https://maz-ui.com).')
|
|
353
|
-
const withToolbar = ref('Select some text and click **Bold**.')
|
|
354
|
-
const withToolbarConfig = ref('Only a few buttons here.')
|
|
355
|
-
const splitContent = ref('# Split view\n\nType on the left, see the **preview** on the right.')
|
|
356
|
-
const lineNumbersContent = ref('Line one\nLine two\nLine three')
|
|
357
|
-
const withLabel = ref('')
|
|
358
|
-
const stateError = ref('Invalid content')
|
|
359
|
-
const stateSuccess = ref('Valid content')
|
|
360
|
-
const stateDisabled = ref('Disabled editor')
|
|
361
|
-
const customRender = ref('Rendered by a custom function')
|
|
362
|
-
const translated = ref('Localized **markdown** editor.')
|
|
363
|
-
|
|
364
|
-
function upperCaseRenderer(markdown: string) {
|
|
365
|
-
return `<p>${markdown.toUpperCase()}</p>`
|
|
366
|
-
}
|
|
367
|
-
</script>
|
|
264
|
+
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
|
|
368
265
|
|
|
369
266
|
## Accessibility
|
|
370
267
|
|
|
371
|
-
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,
|
|
372
|
-
|
|
373
|
-
|
|
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).
|