@maz-ui/mcp 5.0.0-beta.4 → 5.0.0-beta.41
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 +1 -1
- package/dist/mcp.d.mts +22 -9
- package/dist/mcp.d.ts +22 -9
- package/dist/mcp.mjs +160 -83
- package/docs/generated-docs/maz-avatar.doc.md +30 -30
- package/docs/generated-docs/maz-bottom-sheet.doc.md +16 -13
- package/docs/generated-docs/maz-btn.doc.md +21 -19
- package/docs/generated-docs/maz-checkbox.doc.md +16 -17
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +1 -1
- package/docs/generated-docs/maz-code-highlight.doc.md +11 -0
- package/docs/generated-docs/maz-container.doc.md +1 -0
- package/docs/generated-docs/maz-date-picker.doc.md +41 -41
- package/docs/generated-docs/maz-drawer.doc.md +7 -8
- package/docs/generated-docs/maz-dropdown.doc.md +3 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +4 -4
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +5 -5
- package/docs/generated-docs/maz-gallery.doc.md +15 -15
- package/docs/generated-docs/maz-input-code.doc.md +16 -16
- package/docs/generated-docs/maz-input-price.doc.md +14 -14
- package/docs/generated-docs/maz-input-tags.doc.md +16 -16
- package/docs/generated-docs/maz-input.doc.md +33 -33
- package/docs/generated-docs/maz-lazy-img.doc.md +14 -14
- package/docs/generated-docs/maz-loading-bar.doc.md +4 -4
- package/docs/generated-docs/maz-markdown-editor.doc.md +65 -0
- package/docs/generated-docs/maz-popover.doc.md +1 -1
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +10 -10
- package/docs/generated-docs/maz-radio-buttons.doc.md +17 -17
- package/docs/generated-docs/maz-radio.doc.md +16 -16
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +4 -4
- package/docs/generated-docs/maz-sidebar-content.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-footer.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-group.doc.md +11 -0
- package/docs/generated-docs/maz-sidebar-header.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +27 -0
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +16 -0
- package/docs/generated-docs/maz-sidebar-menu.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar.doc.md +36 -0
- package/docs/generated-docs/maz-slider.doc.md +1 -1
- package/docs/generated-docs/maz-spinner.doc.md +4 -4
- package/docs/generated-docs/maz-switch.doc.md +14 -14
- package/docs/generated-docs/maz-table.doc.md +39 -37
- package/docs/generated-docs/maz-tabs-bar.doc.md +20 -9
- package/docs/generated-docs/maz-tabs.doc.md +6 -3
- package/docs/generated-docs/maz-textarea.doc.md +27 -25
- package/docs/generated-docs/maz-ticker.doc.md +1 -1
- package/docs/generated-docs/maz-timeline.doc.md +4 -4
- package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
- package/docs/src/blog/v4.md +1 -1
- package/docs/src/blog/v5.md +5 -7
- package/docs/src/components/maz-avatar.md +52 -4
- package/docs/src/components/maz-bottom-sheet.md +300 -169
- package/docs/src/components/maz-btn.md +1 -1
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-date-picker.md +1 -1
- package/docs/src/components/maz-dialog.md +46 -0
- package/docs/src/components/maz-dropdown.md +32 -16
- package/docs/src/components/maz-icon.md +2 -2
- package/docs/src/components/maz-lazy-img.md +64 -0
- package/docs/src/components/maz-markdown-editor.md +369 -0
- package/docs/src/components/maz-pull-to-refresh.md +1 -1
- package/docs/src/components/maz-sidebar.md +719 -0
- package/docs/src/components/maz-table.md +74 -0
- package/docs/src/components/maz-tabs.md +110 -3
- package/docs/src/components/maz-textarea.md +58 -0
- package/docs/src/components/maz-timeline.md +60 -0
- package/docs/src/components/maz-window-mockup.md +249 -0
- package/docs/src/composables/use-drag.md +239 -0
- package/docs/src/composables/use-form-validator.md +50 -11
- package/docs/src/composables/use-swipe.md +26 -11
- package/docs/src/directives/click-outside.md +8 -15
- package/docs/src/directives/fullscreen-img.md +1 -1
- package/docs/src/directives/lazy-img.md +44 -11
- package/docs/src/directives/tooltip.md +24 -1
- package/docs/src/directives/zoom-img.md +1 -1
- package/docs/src/ecosystem/eslint-config.md +95 -1
- package/docs/src/{guide/icons.md → ecosystem/icons/index.md} +1 -1
- package/docs/src/ecosystem/node/exec-promise.md +87 -0
- package/docs/src/ecosystem/node/index.md +53 -0
- package/docs/src/ecosystem/node/logger.md +146 -0
- package/docs/src/ecosystem/node/print-banner.md +93 -0
- package/docs/src/{guide → ecosystem}/nuxt.md +81 -47
- package/docs/src/{guide → ecosystem}/themes.md +152 -71
- package/docs/src/{guide → ecosystem}/translations.md +1 -1
- package/docs/src/ecosystem/utils/camel-case.md +31 -0
- package/docs/src/{helpers → ecosystem/utils}/capitalize.md +2 -3
- package/docs/src/ecosystem/utils/check-availability.md +79 -0
- package/docs/src/ecosystem/utils/cookie.md +80 -0
- package/docs/src/ecosystem/utils/debounce-callback.md +38 -0
- package/docs/src/ecosystem/utils/debounce-id.md +69 -0
- package/docs/src/ecosystem/utils/debounce.md +65 -0
- package/docs/src/ecosystem/utils/fetch-locale-ip.md +33 -0
- package/docs/src/ecosystem/utils/format-json.md +33 -0
- package/docs/src/ecosystem/utils/format-phone-number.md +37 -0
- package/docs/src/ecosystem/utils/get-browser-locale.md +29 -0
- package/docs/src/ecosystem/utils/get-error-message.md +39 -0
- package/docs/src/ecosystem/utils/idle-timeout.md +90 -0
- package/docs/src/ecosystem/utils/index.md +60 -0
- package/docs/src/ecosystem/utils/is-client.md +32 -0
- package/docs/src/ecosystem/utils/is-equal.md +38 -0
- package/docs/src/ecosystem/utils/is-server.md +31 -0
- package/docs/src/ecosystem/utils/is-standalone-mode.md +43 -0
- package/docs/src/ecosystem/utils/kebab-case.md +36 -0
- package/docs/src/ecosystem/utils/normalize-string.md +77 -0
- package/docs/src/ecosystem/utils/pascal-case.md +35 -0
- package/docs/src/ecosystem/utils/script-loader.md +77 -0
- package/docs/src/ecosystem/utils/sleep.md +59 -0
- package/docs/src/ecosystem/utils/snake-case.md +36 -0
- package/docs/src/ecosystem/utils/swipe-handler.md +91 -0
- package/docs/src/ecosystem/utils/textarea-autogrow.md +41 -0
- package/docs/src/ecosystem/utils/throttle-id.md +48 -0
- package/docs/src/ecosystem/utils/throttle.md +57 -0
- package/docs/src/ecosystem/utils/truthy-filter.md +31 -0
- package/docs/src/ecosystem/utils/types/deep-key-of.md +48 -0
- package/docs/src/ecosystem/utils/types/deep-partial.md +42 -0
- package/docs/src/ecosystem/utils/types/deep-required.md +39 -0
- package/docs/src/ecosystem/utils/types/flatten-object-keys.md +44 -0
- package/docs/src/ecosystem/utils/types/generic-instance-type.md +42 -0
- package/docs/src/ecosystem/utils/types/infer-maybe-ref.md +35 -0
- package/docs/src/ecosystem/utils/upper-first.md +32 -0
- package/docs/src/ecosystem/utils/user-visibility.md +69 -0
- package/docs/src/guide/getting-started.md +15 -13
- package/docs/src/guide/global-defaults.md +101 -0
- package/docs/src/guide/maz-ui-provider.md +6 -3
- package/docs/src/guide/migration-v4.md +13 -9
- package/docs/src/guide/migration-v5.md +112 -13
- package/docs/src/guide/resolvers.md +7 -7
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/vue.md +4 -4
- package/docs/src/index.md +12 -12
- package/docs/src/plugins/aos.md +1 -1
- package/package.json +8 -7
- package/docs/src/helpers/camel-case.md +0 -14
- package/docs/src/helpers/check-availability.md +0 -14
- package/docs/src/helpers/debounce-callback.md +0 -14
- package/docs/src/helpers/debounce-id.md +0 -14
- package/docs/src/helpers/debounce.md +0 -14
- package/docs/src/helpers/is-client.md +0 -14
- package/docs/src/helpers/is-equal.md +0 -14
- package/docs/src/helpers/is-standalone-mode.md +0 -14
- package/docs/src/helpers/kebab-case.md +0 -14
- package/docs/src/helpers/normalize-string.md +0 -14
- package/docs/src/helpers/pascal-case.md +0 -14
- package/docs/src/helpers/script-loader.md +0 -14
- package/docs/src/helpers/sleep.md +0 -14
- package/docs/src/helpers/snake-case.md +0 -14
- package/docs/src/helpers/throttle-id.md +0 -14
- package/docs/src/helpers/throttle.md +0 -14
- /package/docs/src/{guide → ecosystem/icons}/icon-set.md +0 -0
- /package/docs/src/{guide → ecosystem}/mcp.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/country-code-to-unicode-flag.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/currency.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/date.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/get-country-flag-url.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/number.md +0 -0
package/docs/src/blog/v5.md
CHANGED
|
@@ -90,22 +90,20 @@ npx @maz-ui/upgrade ./ --dry-run
|
|
|
90
90
|
npx @maz-ui/upgrade ./
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
It
|
|
94
|
-
|
|
95
|
-
It respects your `.gitignore`, walks `.vue`/`.css`/`.ts`/`.tsx`/`.cts`/`.mts`/`.js`/`.jsx`/`.cjs`/`.mjs` and `package.json`, and skips the usual build dirs.
|
|
93
|
+
It handles the mechanical part of the migration (CSS subpath imports, prop renames, CSS var renames, Nuxt config keys, custom preset color keys, and `package.json` version bumps)
|
|
96
94
|
|
|
97
95
|
### `@maz-ui/mcp` — for everything else
|
|
98
96
|
|
|
99
97
|
A few changes need a human eye: `MazIcon` API (needs your original asset paths), `MazBadge` numeric size mapping, `foundation.radius` → `scales.rounded.md` reshape, and `MazChart` `update-mode` default.
|
|
100
98
|
|
|
101
|
-
The [`@maz-ui/mcp`](/
|
|
99
|
+
The [`@maz-ui/mcp`](/ecosystem/mcp) server exposes the migration guide and every other Maz-UI doc to your AI assistant. Connect it once, then walk the guide section by section against your codebase — there's a [step-by-step flow](/guide/migration-v5#migrate-with-the-maz-ui-mcp-server) ready to copy-paste.
|
|
102
100
|
|
|
103
101
|
```bash
|
|
104
102
|
# Claude Code
|
|
105
103
|
claude mcp add maz-ui npx @maz-ui/mcp --scope project
|
|
106
104
|
```
|
|
107
105
|
|
|
108
|
-
Cursor, Windsurf, VS Code Copilot, Cline and Claude Desktop are all in the [MCP guide](/
|
|
106
|
+
Cursor, Windsurf, VS Code Copilot, Cline and Claude Desktop are all in the [MCP guide](/ecosystem/mcp).
|
|
109
107
|
|
|
110
108
|
### The full guide
|
|
111
109
|
|
|
@@ -157,11 +155,11 @@ export default defineNuxtConfig({
|
|
|
157
155
|
## Essential Links
|
|
158
156
|
|
|
159
157
|
- **[v5 Migration Guide](/guide/migration-v5)** — every breaking change, the upgrade CLI, the MCP flow
|
|
160
|
-
- **[Theming](/
|
|
158
|
+
- **[Theming](/ecosystem/themes)** — preset authoring, `scales` and `components` blocks, runtime switching
|
|
161
159
|
- **[Browser Support](/guide/browser-support)** — minimum versions and the features they enable
|
|
162
160
|
- **[Tailwind integration](/guide/tailwind)** — for consumers who ship their own Tailwind setup
|
|
163
161
|
- **[`@maz-ui/upgrade` README](https://github.com/LouisMazel/maz-ui/tree/master/packages/upgrade)** — full transform list and CLI reference
|
|
164
|
-
- **[Model Context Protocol (MCP)](/
|
|
162
|
+
- **[Model Context Protocol (MCP)](/ecosystem/mcp)** — connect AI assistants to the Maz-UI docs
|
|
165
163
|
- **[GitHub Repository](https://github.com/LouisMazel/maz-ui)** — source code & issues
|
|
166
164
|
- **[Changelog](https://github.com/LouisMazel/maz-ui/blob/master/CHANGELOG.md)** — detailed release notes
|
|
167
165
|
|
|
@@ -15,7 +15,7 @@ This component uses [vLazyImg](./../directives/lazy-img.md) directive
|
|
|
15
15
|
|
|
16
16
|
## Basic usage
|
|
17
17
|
|
|
18
|
-
<MazAvatar
|
|
18
|
+
<MazAvatar src="https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&scale=80" />
|
|
19
19
|
|
|
20
20
|
```vue
|
|
21
21
|
<script lang="ts" setup>
|
|
@@ -87,7 +87,6 @@ function clicked() { console.log('clicked') }
|
|
|
87
87
|
target="_blank"
|
|
88
88
|
rounded-size="none"
|
|
89
89
|
clickable
|
|
90
|
-
no-size
|
|
91
90
|
>
|
|
92
91
|
<template #icon>
|
|
93
92
|
<MazIcon icon="/eye.svg" />
|
|
@@ -108,12 +107,43 @@ function clicked() { console.log('clicked') }
|
|
|
108
107
|
</template>
|
|
109
108
|
```
|
|
110
109
|
|
|
110
|
+
## Initials from caption
|
|
111
|
+
|
|
112
|
+
When no `src` is provided, `MazAvatar` displays initials generated from the `caption`. The `letter-count` prop (default `2`) controls how many letters are displayed:
|
|
113
|
+
|
|
114
|
+
- **Single word**: the first `letter-count` characters of the word are used.
|
|
115
|
+
- **Multiple words**: the first letter of each of the first `letter-count` words is used.
|
|
116
|
+
|
|
117
|
+
Initials are always uppercased.
|
|
118
|
+
|
|
119
|
+
<div class="flex gap-05 items-center flex-wrap">
|
|
120
|
+
<MazAvatar caption="admin" size="3rem" />
|
|
121
|
+
<MazAvatar caption="admin" :letter-count="3" size="3rem" />
|
|
122
|
+
<MazAvatar caption="Louis Mazel" size="3rem" />
|
|
123
|
+
<MazAvatar caption="Jean Claude Dus" :letter-count="3" size="3rem" />
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
```vue
|
|
127
|
+
<template>
|
|
128
|
+
<!-- "AD" -->
|
|
129
|
+
<MazAvatar caption="admin" />
|
|
130
|
+
<!-- "ADM" -->
|
|
131
|
+
<MazAvatar caption="admin" :letter-count="3" />
|
|
132
|
+
<!-- "LM" -->
|
|
133
|
+
<MazAvatar caption="Louis Mazel" />
|
|
134
|
+
<!-- "JCD" -->
|
|
135
|
+
<MazAvatar caption="Jean Claude Dus" :letter-count="3" />
|
|
136
|
+
</template>
|
|
137
|
+
```
|
|
138
|
+
|
|
111
139
|
## On Error
|
|
112
140
|
|
|
113
|
-
|
|
141
|
+
When no `src` (and no `caption`) is provided, or when the image fails to load, `MazAvatar` displays the default `no-image` placeholder.
|
|
142
|
+
|
|
143
|
+
<MazAvatar @error="error" src="https://broken-link-image-src.example" />
|
|
114
144
|
|
|
115
145
|
```html
|
|
116
|
-
<MazAvatar @error="error" />
|
|
146
|
+
<MazAvatar @error="error" src="https://broken-link-image-src.example" />
|
|
117
147
|
```
|
|
118
148
|
|
|
119
149
|
## Fallback image loaded on error
|
|
@@ -171,6 +201,24 @@ These modes are native use an `HTMLImageElement` with the `loading` attribute. (
|
|
|
171
201
|
<MazAvatar loading="eager" src="https://api.dicebear.com/7.x/big-smile/svg?backgroundColor=1d90ff&scale=80&seed=123" />
|
|
172
202
|
```
|
|
173
203
|
|
|
204
|
+
## Image height full
|
|
205
|
+
|
|
206
|
+
By default the image fills the avatar **width** (`width: 100%`). Enable `image-height-full` to make the image fill the **height** instead: it keeps its aspect ratio, fills 100% of the height and overflows/crops horizontally. This is ideal for wide images or SVGs (like flags) that must cover the whole avatar.
|
|
207
|
+
|
|
208
|
+
<div class="flex gap-05 items-center flex-wrap">
|
|
209
|
+
<MazAvatar class="vp-raw" size="4rem" src="https://placedog.net/300/200?id=7" />
|
|
210
|
+
<MazAvatar class="vp-raw" size="4rem" image-height-full src="https://placedog.net/300/200?id=7" />
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
```vue
|
|
214
|
+
<template>
|
|
215
|
+
<!-- default: width 100% -->
|
|
216
|
+
<MazAvatar src="https://placedog.net/300/200" />
|
|
217
|
+
<!-- height 100%, cropped on the sides -->
|
|
218
|
+
<MazAvatar image-height-full src="https://placedog.net/300/200" />
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
174
222
|
<script lang="ts" setup>
|
|
175
223
|
const clicked = () => { console.log('clicked') }
|
|
176
224
|
const error = (el) => { console.error('error', el) }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MazBottomSheet
|
|
3
|
-
description: MazBottomSheet is a standalone component like a simple dialog but at the bottom of screen. Useful for mobile UX.
|
|
3
|
+
description: MazBottomSheet is a standalone component like a simple dialog but anchored at the bottom of the screen. Full-width on mobile and constrained/centered on desktop, with a header (icon, title, close button), a footer and many replaceable slots. Useful for mobile UX.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# {{ $frontmatter.title }}
|
|
@@ -10,14 +10,250 @@ description: MazBottomSheet is a standalone component like a simple dialog but a
|
|
|
10
10
|
<!--@include: ./../../.vitepress/mixins/getting-started.md-->
|
|
11
11
|
|
|
12
12
|
::: tip
|
|
13
|
-
This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md), so you can implement this component anywhere and it inherits all its props
|
|
13
|
+
This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md), so you can implement this component anywhere and it inherits all its props (`persistent`, `closeOnEscape`, etc.)
|
|
14
14
|
:::
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
The sheet has a header (with the `title` and a close button) and an optional `footer` slot. It opens full-width on mobile and is constrained/centered on desktop (see [Max width](#max-width)).
|
|
19
|
+
|
|
20
|
+
<ComponentDemo expanded>
|
|
21
|
+
<MazBtn @click="basicOpened = true">Open Bottom Sheet</MazBtn>
|
|
22
|
+
|
|
23
|
+
<MazBottomSheet v-model="basicOpened" title="Bottom Sheet Title">
|
|
24
|
+
<p>Your content goes here.</p>
|
|
25
|
+
<template #footer="{ close }">
|
|
26
|
+
<MazBtn color="transparent" @click="close">Cancel</MazBtn>
|
|
27
|
+
<MazBtn @click="close">Confirm</MazBtn>
|
|
28
|
+
</template>
|
|
29
|
+
</MazBottomSheet>
|
|
30
|
+
|
|
31
|
+
<template #code>
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<script setup>
|
|
35
|
+
import MazBottomSheet from 'maz-ui/components/MazBottomSheet'
|
|
36
|
+
import { ref } from 'vue'
|
|
37
|
+
|
|
38
|
+
const basicOpened = ref(false)
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<MazBtn @click="basicOpened = true">
|
|
43
|
+
Open Bottom Sheet
|
|
44
|
+
</MazBtn>
|
|
45
|
+
|
|
46
|
+
<MazBottomSheet v-model="basicOpened" title="Bottom Sheet Title">
|
|
47
|
+
<p>Your content goes here.</p>
|
|
48
|
+
|
|
49
|
+
<template #footer="{ close }">
|
|
50
|
+
<MazBtn color="transparent" @click="close">
|
|
51
|
+
Cancel
|
|
52
|
+
</MazBtn>
|
|
53
|
+
<MazBtn @click="close">
|
|
54
|
+
Confirm
|
|
55
|
+
</MazBtn>
|
|
56
|
+
</template>
|
|
57
|
+
</MazBottomSheet>
|
|
58
|
+
</template>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</template>
|
|
62
|
+
</ComponentDemo>
|
|
63
|
+
|
|
64
|
+
## Swipe to close (iOS-like)
|
|
65
|
+
|
|
66
|
+
By default a drag handle (grab bar) is shown at the top of the sheet, and you can **close the sheet by dragging that handle down** - the sheet follows your pointer and either dismisses (past the threshold) or snaps back. This works with both touch and mouse.
|
|
67
|
+
|
|
68
|
+
Disable it with `:swipe-to-close="false"` (the handle is then hidden too), or replace the handle with the `#handle` slot. A `persistent` sheet never dismisses on swipe: it snaps back instead.
|
|
69
|
+
|
|
70
|
+
<ComponentDemo>
|
|
71
|
+
<MazBtn @click="swipeOpened = true">Open swipeable sheet</MazBtn>
|
|
72
|
+
|
|
73
|
+
<MazBottomSheet v-model="swipeOpened" title="Drag me down">
|
|
74
|
+
<p>Grab the bar at the top and drag down to close, or release before the threshold to snap back.</p>
|
|
75
|
+
</MazBottomSheet>
|
|
76
|
+
|
|
77
|
+
<template #code>
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<!-- enabled by default -->
|
|
81
|
+
<MazBottomSheet v-model="swipeOpened" title="Drag me down">
|
|
82
|
+
<p>Grab the bar at the top and drag down to close.</p>
|
|
83
|
+
</MazBottomSheet>
|
|
84
|
+
|
|
85
|
+
<!-- disable the handle and the gesture -->
|
|
86
|
+
<MazBottomSheet v-model="swipeOpened" :swipe-to-close="false" title="No swipe" />
|
|
87
|
+
|
|
88
|
+
<!-- custom handle -->
|
|
89
|
+
<MazBottomSheet v-model="swipeOpened" title="Custom handle">
|
|
90
|
+
<template #handle>
|
|
91
|
+
<span class="maz:h-1.5 maz:w-12 maz:rounded-full maz:bg-primary" />
|
|
92
|
+
</template>
|
|
93
|
+
</MazBottomSheet>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
</template>
|
|
97
|
+
</ComponentDemo>
|
|
98
|
+
|
|
99
|
+
## Header with an icon
|
|
100
|
+
|
|
101
|
+
Pass an `icon` (an icon value or a full `MazIconProps` object) to display it on the left of the title.
|
|
102
|
+
|
|
103
|
+
<ComponentDemo>
|
|
104
|
+
<MazBtn @click="iconOpened = true">Open with icon</MazBtn>
|
|
105
|
+
|
|
106
|
+
<MazBottomSheet v-model="iconOpened" title="Notifications" icon="/bell.svg">
|
|
107
|
+
<p>You have 3 new notifications.</p>
|
|
108
|
+
<template #footer="{ close }">
|
|
109
|
+
<MazBtn @click="close">Mark all as read</MazBtn>
|
|
110
|
+
</template>
|
|
111
|
+
</MazBottomSheet>
|
|
112
|
+
|
|
113
|
+
<template #code>
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<MazBottomSheet v-model="iconOpened" title="Notifications" icon="/bell.svg">
|
|
117
|
+
<p>You have 3 new notifications.</p>
|
|
118
|
+
|
|
119
|
+
<template #footer="{ close }">
|
|
120
|
+
<MazBtn @click="close">Mark all as read</MazBtn>
|
|
121
|
+
</template>
|
|
122
|
+
</MazBottomSheet>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
</template>
|
|
126
|
+
</ComponentDemo>
|
|
127
|
+
|
|
128
|
+
## Replaceable slots
|
|
129
|
+
|
|
130
|
+
Everything in the header is replaceable: use `#icon` and `#title` to customize parts of the default header, or `#header` to replace the whole header (you get the `close` function as a binding).
|
|
131
|
+
|
|
132
|
+
<ComponentDemo>
|
|
133
|
+
<MazBtn @click="slotsOpened = true">Open custom header</MazBtn>
|
|
134
|
+
|
|
135
|
+
<MazBottomSheet v-model="slotsOpened">
|
|
136
|
+
<template #icon>
|
|
137
|
+
<MazAvatar src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100" size="sm" />
|
|
138
|
+
</template>
|
|
139
|
+
<template #title>
|
|
140
|
+
<span class="maz:text-primary">Custom title</span>
|
|
141
|
+
</template>
|
|
142
|
+
<p>The icon and the title slots are fully replaceable.</p>
|
|
143
|
+
</MazBottomSheet>
|
|
144
|
+
|
|
145
|
+
<template #code>
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<MazBottomSheet v-model="slotsOpened">
|
|
149
|
+
<template #icon>
|
|
150
|
+
<MazAvatar src="/avatar.jpg" size="sm" />
|
|
151
|
+
</template>
|
|
152
|
+
|
|
153
|
+
<template #title>
|
|
154
|
+
<span class="maz:text-primary">Custom title</span>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<p>The icon and the title slots are fully replaceable.</p>
|
|
158
|
+
</MazBottomSheet>
|
|
159
|
+
|
|
160
|
+
<!-- or replace the whole header -->
|
|
161
|
+
<MazBottomSheet v-model="slotsOpened">
|
|
162
|
+
<template #header="{ close }">
|
|
163
|
+
<div class="maz:flex maz:items-center maz:justify-between maz:p-4">
|
|
164
|
+
<strong>My header</strong>
|
|
165
|
+
<MazBtn size="sm" color="transparent" @click="close">Close</MazBtn>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
168
|
+
</MazBottomSheet>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
</template>
|
|
172
|
+
</ComponentDemo>
|
|
173
|
+
|
|
174
|
+
## Max width
|
|
175
|
+
|
|
176
|
+
On mobile the sheet is always **full-width**. From the tablet breakpoint and up, it is **constrained** to `max-width` and centered horizontally. The default `max-width` is `35rem`; pass the `max-width` prop (a [`MazSizeUnit`](#props)) to override it.
|
|
177
|
+
|
|
178
|
+
<ComponentDemo>
|
|
179
|
+
<MazBtn @click="wideOpened = true">Open wide sheet</MazBtn>
|
|
180
|
+
|
|
181
|
+
<MazBottomSheet v-model="wideOpened" title="Wide sheet" max-width="60rem">
|
|
182
|
+
<p>This sheet is constrained to 60rem on desktop and full-width on mobile.</p>
|
|
183
|
+
</MazBottomSheet>
|
|
184
|
+
|
|
185
|
+
<template #code>
|
|
186
|
+
|
|
187
|
+
```html
|
|
188
|
+
<MazBottomSheet v-model="wideOpened" title="Wide sheet" max-width="60rem">
|
|
189
|
+
<p>This sheet is constrained to 60rem on desktop and full-width on mobile.</p>
|
|
190
|
+
</MazBottomSheet>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
</template>
|
|
194
|
+
</ComponentDemo>
|
|
195
|
+
|
|
196
|
+
## Without header
|
|
197
|
+
|
|
198
|
+
Hide the whole header with `hide-header`, or only the close button with `hide-close-button`.
|
|
199
|
+
|
|
200
|
+
<ComponentDemo>
|
|
201
|
+
<MazBtn @click="noHeaderOpened = true">Open without header</MazBtn>
|
|
202
|
+
|
|
203
|
+
<MazBottomSheet v-model="noHeaderOpened" hide-header>
|
|
204
|
+
<div class="maz:flex maz:flex-col maz:gap-3 maz:text-center">
|
|
205
|
+
<p>No header here, you control the whole layout.</p>
|
|
206
|
+
<MazBtn @click="noHeaderOpened = false">Got it</MazBtn>
|
|
207
|
+
</div>
|
|
208
|
+
</MazBottomSheet>
|
|
209
|
+
|
|
210
|
+
<template #code>
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<MazBottomSheet v-model="noHeaderOpened" hide-header>
|
|
214
|
+
<div class="maz:flex maz:flex-col maz:gap-3 maz:text-center">
|
|
215
|
+
<p>No header here, you control the whole layout.</p>
|
|
216
|
+
<MazBtn @click="noHeaderOpened = false">Got it</MazBtn>
|
|
217
|
+
</div>
|
|
218
|
+
</MazBottomSheet>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
</template>
|
|
222
|
+
</ComponentDemo>
|
|
223
|
+
|
|
224
|
+
## Persistent
|
|
225
|
+
|
|
226
|
+
A `persistent` sheet cannot be closed by clicking outside or pressing escape, and the close button is removed. Provide your own action to close it.
|
|
227
|
+
|
|
228
|
+
<ComponentDemo>
|
|
229
|
+
<MazBtn @click="persistentOpened = true">Open persistent sheet</MazBtn>
|
|
230
|
+
|
|
231
|
+
<MazBottomSheet v-model="persistentOpened" title="Action required" icon="/exclamation-triangle.svg" persistent>
|
|
232
|
+
<p>You must confirm before closing this sheet.</p>
|
|
233
|
+
<template #footer>
|
|
234
|
+
<MazBtn @click="persistentOpened = false">I understand</MazBtn>
|
|
235
|
+
</template>
|
|
236
|
+
</MazBottomSheet>
|
|
237
|
+
|
|
238
|
+
<template #code>
|
|
239
|
+
|
|
240
|
+
```html
|
|
241
|
+
<MazBottomSheet v-model="persistentOpened" title="Action required" persistent>
|
|
242
|
+
<p>You must confirm before closing this sheet.</p>
|
|
243
|
+
|
|
244
|
+
<template #footer>
|
|
245
|
+
<MazBtn @click="persistentOpened = false">I understand</MazBtn>
|
|
246
|
+
</template>
|
|
247
|
+
</MazBottomSheet>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
</template>
|
|
251
|
+
</ComponentDemo>
|
|
252
|
+
|
|
253
|
+
## Full example
|
|
17
254
|
|
|
18
255
|
<ComponentDemo expanded>
|
|
19
256
|
<div class="maz:flex maz:flex-col maz:gap-4">
|
|
20
|
-
<!-- Product Selection Demo -->
|
|
21
257
|
<MazCard>
|
|
22
258
|
<template #title>
|
|
23
259
|
<div class="maz:flex maz:items-center maz:gap-3">
|
|
@@ -60,9 +296,8 @@ This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop
|
|
|
60
296
|
</div>
|
|
61
297
|
</MazCard>
|
|
62
298
|
</div>
|
|
63
|
-
<MazBottomSheet v-model="isProductOpen" title="Customize Your Shoes">
|
|
299
|
+
<MazBottomSheet v-model="isProductOpen" title="Customize Your Shoes" icon="/cog.svg" :padding="false">
|
|
64
300
|
<div class="maz:space-y-6 maz:p-6">
|
|
65
|
-
<!-- Size Selection -->
|
|
66
301
|
<div>
|
|
67
302
|
<h4 class="maz:text-lg maz:font-semibold maz:mb-3">Select Size</h4>
|
|
68
303
|
<div class="maz:grid maz:grid-cols-4 maz:gap-2">
|
|
@@ -103,19 +338,17 @@ This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop
|
|
|
103
338
|
:max="10"
|
|
104
339
|
/>
|
|
105
340
|
</div>
|
|
106
|
-
<div class="maz:flex maz:gap-3 maz:pt-4">
|
|
107
|
-
<MazBtn color="primary" class="maz:flex-1" @click="addToCart">
|
|
108
|
-
<MazIcon icon="/shopping-cart.svg" class="maz:me-2" />
|
|
109
|
-
Add to Cart (${{ (129.99 * quantity).toFixed(2) }})
|
|
110
|
-
</MazBtn>
|
|
111
|
-
<MazBtn color="secondary" @click="isProductOpen = false">
|
|
112
|
-
Cancel
|
|
113
|
-
</MazBtn>
|
|
114
|
-
</div>
|
|
115
341
|
</div>
|
|
342
|
+
<template #footer="{ close }">
|
|
343
|
+
<MazBtn color="transparent" @click="close">Cancel</MazBtn>
|
|
344
|
+
<MazBtn color="primary" @click="addToCart">
|
|
345
|
+
<MazIcon icon="/shopping-cart.svg" class="maz:me-2" />
|
|
346
|
+
Add to Cart (${{ (129.99 * quantity).toFixed(2) }})
|
|
347
|
+
</MazBtn>
|
|
348
|
+
</template>
|
|
116
349
|
</MazBottomSheet>
|
|
117
350
|
|
|
118
|
-
<MazBottomSheet v-model="isUserOpen" title="Profile Settings">
|
|
351
|
+
<MazBottomSheet v-model="isUserOpen" title="Profile Settings" icon="/user.svg" max-width="48rem" :padding="false">
|
|
119
352
|
<div class="maz:space-y-6 maz:p-6">
|
|
120
353
|
<div class="maz:flex maz:items-center maz:gap-4 maz:p-4 maz:bg-secondary/10 maz:rounded-lg">
|
|
121
354
|
<MazAvatar src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100" size="xl" />
|
|
@@ -160,173 +393,63 @@ This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop
|
|
|
160
393
|
<MazSwitch v-model="userForm.darkMode" />
|
|
161
394
|
</div>
|
|
162
395
|
</div>
|
|
163
|
-
<div class="maz:flex maz:gap-3 maz:pt-4">
|
|
164
|
-
<MazBtn color="primary" class="maz:flex-1" @click="saveSettings">
|
|
165
|
-
<MazIcon icon="/check.svg" class="maz:me-2" />
|
|
166
|
-
Save Changes
|
|
167
|
-
</MazBtn>
|
|
168
|
-
<MazBtn color="secondary" @click="isUserOpen = false">
|
|
169
|
-
Cancel
|
|
170
|
-
</MazBtn>
|
|
171
|
-
</div>
|
|
172
396
|
</div>
|
|
397
|
+
<template #footer="{ close }">
|
|
398
|
+
<MazBtn color="transparent" @click="close">Cancel</MazBtn>
|
|
399
|
+
<MazBtn color="primary" @click="saveSettings">
|
|
400
|
+
<MazIcon icon="/check.svg" class="maz:me-2" />
|
|
401
|
+
Save Changes
|
|
402
|
+
</MazBtn>
|
|
403
|
+
</template>
|
|
173
404
|
</MazBottomSheet>
|
|
174
405
|
|
|
175
406
|
<template #code>
|
|
176
407
|
|
|
177
408
|
```vue
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
<MazCard>
|
|
182
|
-
<template #title>
|
|
183
|
-
<div class="maz:flex maz:items-center maz:gap-3">
|
|
184
|
-
<MazAvatar src="https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=100" size="lg" />
|
|
185
|
-
<div>
|
|
186
|
-
<h3 class="maz:text-lg maz:font-semibold">
|
|
187
|
-
Nike Air Max
|
|
188
|
-
</h3>
|
|
189
|
-
<p class="maz:text-sm maz:text-muted">
|
|
190
|
-
Premium Running Shoes
|
|
191
|
-
</p>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
</template>
|
|
195
|
-
|
|
196
|
-
<div class="maz:space-y-4">
|
|
197
|
-
<div class="maz:flex maz:items-center maz:justify-between">
|
|
198
|
-
<span class="maz:font-medium">Price:</span>
|
|
199
|
-
<span class="maz:text-xl maz:font-bold maz:text-primary">$129.99</span>
|
|
200
|
-
</div>
|
|
201
|
-
|
|
202
|
-
<div class="maz:flex maz:gap-2">
|
|
203
|
-
<MazBtn color="primary" @click="openProductOptions">
|
|
204
|
-
Customize Options
|
|
205
|
-
</MazBtn>
|
|
206
|
-
<MazBtn color="secondary" @click="openUserSettings">
|
|
207
|
-
Profile Settings
|
|
208
|
-
</MazBtn>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
</MazCard>
|
|
212
|
-
</div>
|
|
409
|
+
<script setup>
|
|
410
|
+
import MazBottomSheet from 'maz-ui/components/MazBottomSheet'
|
|
411
|
+
import { reactive, ref } from 'vue'
|
|
213
412
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<!-- Size Selection -->
|
|
218
|
-
<div>
|
|
219
|
-
<h4 class="maz:mb-3 maz:text-lg maz:font-semibold">
|
|
220
|
-
Select Size
|
|
221
|
-
</h4>
|
|
222
|
-
<div class="maz:grid maz:grid-cols-4 maz:gap-2">
|
|
223
|
-
<MazBtn
|
|
224
|
-
v-for="size in sizes"
|
|
225
|
-
:key="size"
|
|
226
|
-
:color="selectedOptions.size === size ? 'primary' : 'secondary'"
|
|
227
|
-
size="sm"
|
|
228
|
-
@click="selectedOptions.size = size"
|
|
229
|
-
>
|
|
230
|
-
{{ size }}
|
|
231
|
-
</MazBtn>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
413
|
+
const isProductOpen = ref(false)
|
|
414
|
+
const quantity = ref(1)
|
|
415
|
+
const selectedOptions = reactive({ size: '', color: '' })
|
|
234
416
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
</h4>
|
|
240
|
-
<div class="maz:grid maz:grid-cols-3 maz:gap-3">
|
|
241
|
-
<div
|
|
242
|
-
v-for="color in colors"
|
|
243
|
-
:key="color.name"
|
|
244
|
-
class="maz:flex maz:cursor-pointer maz:flex-col maz:items-center maz:rounded-lg maz:border-2 maz:p-3"
|
|
245
|
-
:class="selectedOptions.color === color.name ? 'maz:border-primary' : 'maz:border-divider'"
|
|
246
|
-
@click="selectedOptions.color = color.name"
|
|
247
|
-
>
|
|
248
|
-
<div
|
|
249
|
-
class="maz:mb-2 maz:size-8 maz:rounded-full"
|
|
250
|
-
:style="{ backgroundColor: color.value }"
|
|
251
|
-
/>
|
|
252
|
-
<span class="maz:text-sm">{{ color.name }}</span>
|
|
253
|
-
</div>
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
417
|
+
function openProductOptions() {
|
|
418
|
+
isProductOpen.value = true
|
|
419
|
+
}
|
|
420
|
+
</script>
|
|
256
421
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
:min="1"
|
|
262
|
-
:max="10"
|
|
263
|
-
/>
|
|
264
|
-
|
|
265
|
-
<!-- Actions -->
|
|
266
|
-
<div class="maz:flex maz:gap-3 maz:pt-4">
|
|
267
|
-
<MazBtn color="primary" class="maz:flex-1" @click="addToCart">
|
|
268
|
-
Add to Cart (${{ (129.99 * quantity).toFixed(2) }})
|
|
269
|
-
</MazBtn>
|
|
270
|
-
<MazBtn color="secondary" @click="isProductOpen = false">
|
|
271
|
-
Cancel
|
|
272
|
-
</MazBtn>
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
</MazBottomSheet>
|
|
422
|
+
<template>
|
|
423
|
+
<MazBtn color="primary" @click="openProductOptions">
|
|
424
|
+
Customize Options
|
|
425
|
+
</MazBtn>
|
|
276
426
|
|
|
277
|
-
<MazBottomSheet v-model="
|
|
427
|
+
<MazBottomSheet v-model="isProductOpen" title="Customize Your Shoes" icon="/cog.svg" :padding="false">
|
|
278
428
|
<div class="maz:space-y-6 maz:p-6">
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
placeholder="Enter your name"
|
|
292
|
-
/>
|
|
293
|
-
<MazInput
|
|
294
|
-
v-model="userForm.email"
|
|
295
|
-
label="Email"
|
|
296
|
-
type="email"
|
|
297
|
-
placeholder="Enter your email"
|
|
298
|
-
/>
|
|
299
|
-
<MazSelect
|
|
300
|
-
v-model="userForm.country"
|
|
301
|
-
label="Country"
|
|
302
|
-
:options="countries"
|
|
303
|
-
placeholder="Select your country"
|
|
304
|
-
/>
|
|
305
|
-
<div class="maz:flex maz:items-center maz:justify-between maz:p-4 maz:border maz:border-divider maz:rounded-lg">
|
|
306
|
-
<div>
|
|
307
|
-
<p class="maz:font-medium">Email Notifications</p>
|
|
308
|
-
<p class="maz:text-sm maz:text-muted">Receive updates about your orders</p>
|
|
309
|
-
</div>
|
|
310
|
-
<MazSwitch v-model="userForm.notifications" />
|
|
311
|
-
</div>
|
|
312
|
-
<div class="maz:flex maz:items-center maz:justify-between maz:p-4 maz:border maz:border-divider maz:rounded-lg">
|
|
313
|
-
<div>
|
|
314
|
-
<p class="maz:font-medium">Dark Mode</p>
|
|
315
|
-
<p class="maz:text-sm maz:text-muted">Switch to dark theme</p>
|
|
316
|
-
</div>
|
|
317
|
-
<MazSwitch v-model="userForm.darkMode" />
|
|
318
|
-
</div>
|
|
319
|
-
</div>
|
|
320
|
-
<div class="maz:flex maz:gap-3 maz:pt-4">
|
|
321
|
-
<MazBtn color="primary" class="maz:flex-1" @click="saveSettings">
|
|
322
|
-
<MazIcon icon="/check.svg" class="maz:me-2" />
|
|
323
|
-
Save Changes
|
|
324
|
-
</MazBtn>
|
|
325
|
-
<MazBtn color="secondary" @click="isUserOpen = false">
|
|
326
|
-
Cancel
|
|
429
|
+
<h4 class="maz:mb-3 maz:text-lg maz:font-semibold">
|
|
430
|
+
Select Size
|
|
431
|
+
</h4>
|
|
432
|
+
<div class="maz:grid maz:grid-cols-4 maz:gap-2">
|
|
433
|
+
<MazBtn
|
|
434
|
+
v-for="size in sizes"
|
|
435
|
+
:key="size"
|
|
436
|
+
:color="selectedOptions.size === size ? 'primary' : 'secondary'"
|
|
437
|
+
size="sm"
|
|
438
|
+
@click="selectedOptions.size = size"
|
|
439
|
+
>
|
|
440
|
+
{{ size }}
|
|
327
441
|
</MazBtn>
|
|
328
442
|
</div>
|
|
329
443
|
</div>
|
|
444
|
+
|
|
445
|
+
<template #footer="{ close }">
|
|
446
|
+
<MazBtn color="transparent" @click="close">
|
|
447
|
+
Cancel
|
|
448
|
+
</MazBtn>
|
|
449
|
+
<MazBtn color="primary" @click="addToCart">
|
|
450
|
+
Add to Cart (${{ (129.99 * quantity).toFixed(2) }})
|
|
451
|
+
</MazBtn>
|
|
452
|
+
</template>
|
|
330
453
|
</MazBottomSheet>
|
|
331
454
|
</template>
|
|
332
455
|
```
|
|
@@ -339,6 +462,14 @@ This component uses the `<Teleport to="body">` with [MazBackdrop](./maz-backdrop
|
|
|
339
462
|
<script setup>
|
|
340
463
|
import { ref, reactive } from 'vue'
|
|
341
464
|
|
|
465
|
+
const basicOpened = ref(false)
|
|
466
|
+
const swipeOpened = ref(false)
|
|
467
|
+
const iconOpened = ref(false)
|
|
468
|
+
const slotsOpened = ref(false)
|
|
469
|
+
const wideOpened = ref(false)
|
|
470
|
+
const noHeaderOpened = ref(false)
|
|
471
|
+
const persistentOpened = ref(false)
|
|
472
|
+
|
|
342
473
|
const isProductOpen = ref(false)
|
|
343
474
|
const isUserOpen = ref(false)
|
|
344
475
|
const quantity = ref(1)
|