@maz-ui/mcp 4.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/bin/maz-ui-mcp.mjs +7 -0
- package/dist/mcp.d.mts +13 -0
- package/dist/mcp.d.ts +13 -0
- package/dist/mcp.mjs +586 -0
- package/docs/generated-docs/maz-accordion.doc.md +21 -0
- package/docs/generated-docs/maz-animated-counter.doc.md +17 -0
- package/docs/generated-docs/maz-animated-element.doc.md +14 -0
- package/docs/generated-docs/maz-animated-text.doc.md +14 -0
- package/docs/generated-docs/maz-avatar.doc.md +44 -0
- package/docs/generated-docs/maz-backdrop.doc.md +61 -0
- package/docs/generated-docs/maz-badge.doc.md +16 -0
- package/docs/generated-docs/maz-bottom-sheet.doc.md +21 -0
- package/docs/generated-docs/maz-btn.doc.md +30 -0
- package/docs/generated-docs/maz-card-spotlight.doc.md +16 -0
- package/docs/generated-docs/maz-card.doc.md +39 -0
- package/docs/generated-docs/maz-carousel.doc.md +16 -0
- package/docs/generated-docs/maz-chart.doc.md +10 -0
- package/docs/generated-docs/maz-checkbox.doc.md +34 -0
- package/docs/generated-docs/maz-checklist.doc.md +30 -0
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +27 -0
- package/docs/generated-docs/maz-date-picker.doc.md +52 -0
- package/docs/generated-docs/maz-dialog-confirm.doc.md +24 -0
- package/docs/generated-docs/maz-dialog.doc.md +22 -0
- package/docs/generated-docs/maz-drawer.doc.md +26 -0
- package/docs/generated-docs/maz-dropdown.doc.md +42 -0
- package/docs/generated-docs/maz-dropzone.doc.md +82 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +12 -0
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +13 -0
- package/docs/generated-docs/maz-gallery.doc.md +17 -0
- package/docs/generated-docs/maz-icon.doc.md +18 -0
- package/docs/generated-docs/maz-input-code.doc.md +25 -0
- package/docs/generated-docs/maz-input-number.doc.md +31 -0
- package/docs/generated-docs/maz-input-phone-number.doc.md +56 -0
- package/docs/generated-docs/maz-input-price.doc.md +26 -0
- package/docs/generated-docs/maz-input-tags.doc.md +24 -0
- package/docs/generated-docs/maz-input.doc.md +54 -0
- package/docs/generated-docs/maz-lazy-img.doc.md +31 -0
- package/docs/generated-docs/maz-link.doc.md +31 -0
- package/docs/generated-docs/maz-loading-bar.doc.md +6 -0
- package/docs/generated-docs/maz-pagination.doc.md +22 -0
- package/docs/generated-docs/maz-popover.doc.md +70 -0
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +31 -0
- package/docs/generated-docs/maz-radio-buttons.doc.md +33 -0
- package/docs/generated-docs/maz-radio.doc.md +33 -0
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +18 -0
- package/docs/generated-docs/maz-select-country.doc.md +44 -0
- package/docs/generated-docs/maz-select.doc.md +65 -0
- package/docs/generated-docs/maz-slider.doc.md +20 -0
- package/docs/generated-docs/maz-spinner.doc.md +6 -0
- package/docs/generated-docs/maz-stepper.doc.md +29 -0
- package/docs/generated-docs/maz-switch.doc.md +31 -0
- package/docs/generated-docs/maz-table-cell.doc.md +5 -0
- package/docs/generated-docs/maz-table-row.doc.md +11 -0
- package/docs/generated-docs/maz-table-title.doc.md +5 -0
- package/docs/generated-docs/maz-table.doc.md +66 -0
- package/docs/generated-docs/maz-tabs-bar.doc.md +18 -0
- package/docs/generated-docs/maz-tabs-content-item.doc.md +11 -0
- package/docs/generated-docs/maz-tabs-content.doc.md +5 -0
- package/docs/generated-docs/maz-tabs.doc.md +17 -0
- package/docs/generated-docs/maz-textarea.doc.md +41 -0
- package/docs/src/components/index.md +8 -0
- package/docs/src/components/maz-accordion.md +80 -0
- package/docs/src/components/maz-animated-counter.md +124 -0
- package/docs/src/components/maz-animated-element.md +36 -0
- package/docs/src/components/maz-animated-text.md +36 -0
- package/docs/src/components/maz-avatar.md +179 -0
- package/docs/src/components/maz-backdrop.md +16 -0
- package/docs/src/components/maz-badge.md +222 -0
- package/docs/src/components/maz-bottom-sheet.md +398 -0
- package/docs/src/components/maz-btn.md +526 -0
- package/docs/src/components/maz-card-spotlight.md +163 -0
- package/docs/src/components/maz-card.md +447 -0
- package/docs/src/components/maz-carousel.md +127 -0
- package/docs/src/components/maz-chart.md +346 -0
- package/docs/src/components/maz-checkbox.md +168 -0
- package/docs/src/components/maz-checklist.md +414 -0
- package/docs/src/components/maz-circular-progress-bar.md +147 -0
- package/docs/src/components/maz-date-picker.md +1078 -0
- package/docs/src/components/maz-dialog-confirm.md +240 -0
- package/docs/src/components/maz-dialog.md +208 -0
- package/docs/src/components/maz-drawer.md +177 -0
- package/docs/src/components/maz-dropdown.md +650 -0
- package/docs/src/components/maz-dropzone.md +442 -0
- package/docs/src/components/maz-expand-animation.md +99 -0
- package/docs/src/components/maz-fullscreen-loader.md +58 -0
- package/docs/src/components/maz-gallery.md +85 -0
- package/docs/src/components/maz-icon.md +85 -0
- package/docs/src/components/maz-input-code.md +61 -0
- package/docs/src/components/maz-input-number.md +81 -0
- package/docs/src/components/maz-input-phone-number.md +867 -0
- package/docs/src/components/maz-input-price.md +58 -0
- package/docs/src/components/maz-input-tags.md +114 -0
- package/docs/src/components/maz-input.md +453 -0
- package/docs/src/components/maz-lazy-img.md +24 -0
- package/docs/src/components/maz-link.md +156 -0
- package/docs/src/components/maz-loading-bar.md +26 -0
- package/docs/src/components/maz-pagination.md +81 -0
- package/docs/src/components/maz-popover.md +1414 -0
- package/docs/src/components/maz-pull-to-refresh.md +49 -0
- package/docs/src/components/maz-radio-buttons.md +456 -0
- package/docs/src/components/maz-radio.md +141 -0
- package/docs/src/components/maz-reading-progress-bar.md +74 -0
- package/docs/src/components/maz-select-country.md +636 -0
- package/docs/src/components/maz-select.md +439 -0
- package/docs/src/components/maz-slider.md +191 -0
- package/docs/src/components/maz-spinner.md +93 -0
- package/docs/src/components/maz-stepper.md +418 -0
- package/docs/src/components/maz-switch.md +92 -0
- package/docs/src/components/maz-table.md +571 -0
- package/docs/src/components/maz-tabs.md +231 -0
- package/docs/src/components/maz-textarea.md +218 -0
- package/docs/src/composables/use-aos.md +34 -0
- package/docs/src/composables/use-breakpoints.md +35 -0
- package/docs/src/composables/use-dialog.md +88 -0
- package/docs/src/composables/use-display-names.md +174 -0
- package/docs/src/composables/use-form-validator.md +1149 -0
- package/docs/src/composables/use-idle-timeout.md +256 -0
- package/docs/src/composables/use-reading-time.md +168 -0
- package/docs/src/composables/use-string-matching.md +63 -0
- package/docs/src/composables/use-swipe.md +223 -0
- package/docs/src/composables/use-timer.md +130 -0
- package/docs/src/composables/use-toast.md +71 -0
- package/docs/src/composables/use-user-visibility.md +169 -0
- package/docs/src/composables/use-wait.md +62 -0
- package/docs/src/composables/use-window-size.md +18 -0
- package/docs/src/demo/DemoAuthPage.vue +178 -0
- package/docs/src/demo/DemoDashboardPage.vue +298 -0
- package/docs/src/demo/DemoProductPage.vue +135 -0
- package/docs/src/directives/click-outside.md +275 -0
- package/docs/src/directives/fullscreen-img.md +101 -0
- package/docs/src/directives/lazy-img.md +184 -0
- package/docs/src/directives/tooltip.md +458 -0
- package/docs/src/directives/zoom-img.md +127 -0
- package/docs/src/guide/cli.md +144 -0
- package/docs/src/guide/getting-started.md +284 -0
- package/docs/src/guide/icon-set.md +60 -0
- package/docs/src/guide/icons.md +481 -0
- package/docs/src/guide/mcp.md +210 -0
- package/docs/src/guide/migration-v4.md +898 -0
- package/docs/src/guide/nuxt.md +411 -0
- package/docs/src/guide/resolvers.md +697 -0
- package/docs/src/guide/themes.md +789 -0
- package/docs/src/guide/translations.md +1173 -0
- package/docs/src/guide/vue.md +243 -0
- package/docs/src/helpers/camel-case.md +14 -0
- package/docs/src/helpers/capitalize.md +51 -0
- package/docs/src/helpers/check-availability.md +14 -0
- package/docs/src/helpers/country-code-to-unicode-flag.md +213 -0
- package/docs/src/helpers/currency.md +67 -0
- package/docs/src/helpers/date.md +67 -0
- package/docs/src/helpers/debounce-callback.md +14 -0
- package/docs/src/helpers/debounce-id.md +14 -0
- package/docs/src/helpers/debounce.md +14 -0
- package/docs/src/helpers/get-country-flag-url.md +156 -0
- package/docs/src/helpers/is-client.md +14 -0
- package/docs/src/helpers/is-equal.md +14 -0
- package/docs/src/helpers/is-standalone-mode.md +14 -0
- package/docs/src/helpers/kebab-case.md +14 -0
- package/docs/src/helpers/normalize-string.md +14 -0
- package/docs/src/helpers/number.md +65 -0
- package/docs/src/helpers/pascal-case.md +14 -0
- package/docs/src/helpers/script-loader.md +14 -0
- package/docs/src/helpers/sleep.md +14 -0
- package/docs/src/helpers/snake-case.md +14 -0
- package/docs/src/helpers/throttle-id.md +14 -0
- package/docs/src/helpers/throttle.md +14 -0
- package/docs/src/index.md +555 -0
- package/docs/src/made-with-maz-ui.md +58 -0
- package/docs/src/plugins/aos.md +347 -0
- package/docs/src/plugins/dialog.md +411 -0
- package/docs/src/plugins/toast.md +349 -0
- package/docs/src/plugins/wait.md +109 -0
- package/package.json +84 -0
|
@@ -0,0 +1,1414 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazPopover
|
|
3
|
+
description: MazPopover is a versatile Vue 3 component for displaying content in overlays that bypass overflow constraints of parent elements
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
## Basic usage
|
|
11
|
+
|
|
12
|
+
<ComponentDemo>
|
|
13
|
+
<div class="maz-flex maz-gap-4 maz-flex-wrap">
|
|
14
|
+
<MazPopover trigger="click">
|
|
15
|
+
<template #trigger>
|
|
16
|
+
<MazBtn>
|
|
17
|
+
Click me
|
|
18
|
+
</MazBtn>
|
|
19
|
+
</template>
|
|
20
|
+
<div class="maz-p-4">
|
|
21
|
+
<h3 class="maz-text-lg maz-font-semibold maz-mb-2">Popover Content</h3>
|
|
22
|
+
<p class="maz-text-sm">This is the content inside the popover.</p>
|
|
23
|
+
</div>
|
|
24
|
+
</MazPopover>
|
|
25
|
+
<MazPopover trigger="hover">
|
|
26
|
+
<template #trigger>
|
|
27
|
+
<MazBtn color="secondary">
|
|
28
|
+
Hover me
|
|
29
|
+
</MazBtn>
|
|
30
|
+
</template>
|
|
31
|
+
<div class="maz-p-4">
|
|
32
|
+
<p class="maz-text-sm">This popover appears on hover!</p>
|
|
33
|
+
</div>
|
|
34
|
+
</MazPopover>
|
|
35
|
+
<MazPopover trigger="manual">
|
|
36
|
+
<template #trigger="{ toggle }">
|
|
37
|
+
<MazBtn color="accent" @click="toggle">
|
|
38
|
+
Manual trigger
|
|
39
|
+
</MazBtn>
|
|
40
|
+
</template>
|
|
41
|
+
<div class="maz-p-4">
|
|
42
|
+
<p class="maz-text-sm">This popover appears manually!</p>
|
|
43
|
+
</div>
|
|
44
|
+
</MazPopover>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<template #code>
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<template>
|
|
51
|
+
<MazPopover>
|
|
52
|
+
<template #trigger>
|
|
53
|
+
<MazBtn>
|
|
54
|
+
Click me
|
|
55
|
+
</MazBtn>
|
|
56
|
+
</template>
|
|
57
|
+
<div class="maz-p-4">
|
|
58
|
+
<h3 class="maz-mb-2 maz-text-lg maz-font-semibold">
|
|
59
|
+
Popover Content
|
|
60
|
+
</h3>
|
|
61
|
+
<p class="maz-text-sm">
|
|
62
|
+
This is the content inside the popover.
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
65
|
+
</MazPopover>
|
|
66
|
+
|
|
67
|
+
<MazPopover trigger="hover">
|
|
68
|
+
<template #trigger>
|
|
69
|
+
<MazBtn color="secondary">
|
|
70
|
+
Hover me
|
|
71
|
+
</MazBtn>
|
|
72
|
+
</template>
|
|
73
|
+
<div class="maz-p-4">
|
|
74
|
+
<p class="maz-text-sm">
|
|
75
|
+
This popover appears on hover!
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
</MazPopover>
|
|
79
|
+
</template>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
</template>
|
|
83
|
+
</ComponentDemo>
|
|
84
|
+
|
|
85
|
+
## Adaptive trigger
|
|
86
|
+
|
|
87
|
+
The `adaptive` trigger mode automatically adapts to the user's device:
|
|
88
|
+
- **Desktop**: Uses hover behavior (mouseenter/mouseleave)
|
|
89
|
+
- **Mobile/Touch devices**: Uses click behavior
|
|
90
|
+
|
|
91
|
+
This provides the best user experience across all devices without requiring manual configuration.
|
|
92
|
+
|
|
93
|
+
<ComponentDemo>
|
|
94
|
+
<div class="maz-flex maz-gap-4 maz-flex-wrap">
|
|
95
|
+
<MazPopover trigger="adaptive">
|
|
96
|
+
<template #trigger>
|
|
97
|
+
<MazBtn color="primary">
|
|
98
|
+
Adaptive Trigger
|
|
99
|
+
</MazBtn>
|
|
100
|
+
</template>
|
|
101
|
+
<div class="maz-p-4">
|
|
102
|
+
<h3 class="maz-text-lg maz-font-semibold maz-mb-2">Smart Behavior</h3>
|
|
103
|
+
<p class="maz-text-sm maz-mb-2">
|
|
104
|
+
On desktop: Hover to open, move away to close
|
|
105
|
+
</p>
|
|
106
|
+
<p class="maz-text-sm">
|
|
107
|
+
On mobile: Tap to open, tap outside to close
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
</MazPopover>
|
|
111
|
+
<MazPopover trigger="adaptive" keep-open-on-hover>
|
|
112
|
+
<template #trigger>
|
|
113
|
+
<MazBtn color="secondary">
|
|
114
|
+
Adaptive + Keep Open
|
|
115
|
+
</MazBtn>
|
|
116
|
+
</template>
|
|
117
|
+
<div class="maz-p-4">
|
|
118
|
+
<p class="maz-text-sm maz-mb-2">
|
|
119
|
+
This combines adaptive behavior with keep-open-on-hover for menus.
|
|
120
|
+
</p>
|
|
121
|
+
<button class="maz-block maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-rounded">
|
|
122
|
+
Menu Item 1
|
|
123
|
+
</button>
|
|
124
|
+
<button class="maz-block maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-rounded">
|
|
125
|
+
Menu Item 2
|
|
126
|
+
</button>
|
|
127
|
+
</div>
|
|
128
|
+
</MazPopover>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<template #code>
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<template>
|
|
135
|
+
<!-- Basic adaptive trigger -->
|
|
136
|
+
<MazPopover trigger="adaptive">
|
|
137
|
+
<template #trigger>
|
|
138
|
+
<MazBtn color="primary">
|
|
139
|
+
Adaptive Trigger
|
|
140
|
+
</MazBtn>
|
|
141
|
+
</template>
|
|
142
|
+
<div class="maz-p-4">
|
|
143
|
+
<h3 class="maz-text-lg maz-font-semibold maz-mb-2">Smart Behavior</h3>
|
|
144
|
+
<p class="maz-text-sm maz-mb-2">
|
|
145
|
+
On desktop: Hover to open, move away to close
|
|
146
|
+
</p>
|
|
147
|
+
<p class="maz-text-sm">
|
|
148
|
+
On mobile: Tap to open, tap outside to close
|
|
149
|
+
</p>
|
|
150
|
+
</div>
|
|
151
|
+
</MazPopover>
|
|
152
|
+
|
|
153
|
+
<!-- Adaptive with keep-open-on-hover for menus -->
|
|
154
|
+
<MazPopover trigger="adaptive" keep-open-on-hover>
|
|
155
|
+
<template #trigger>
|
|
156
|
+
<MazBtn color="secondary">
|
|
157
|
+
Adaptive Menu
|
|
158
|
+
</MazBtn>
|
|
159
|
+
</template>
|
|
160
|
+
<div class="maz-p-4">
|
|
161
|
+
<p class="maz-text-sm maz-mb-2">
|
|
162
|
+
Perfect for dropdown menus that work on all devices
|
|
163
|
+
</p>
|
|
164
|
+
<button class="maz-block maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-rounded">
|
|
165
|
+
Menu Item 1
|
|
166
|
+
</button>
|
|
167
|
+
<button class="maz-block maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-rounded">
|
|
168
|
+
Menu Item 2
|
|
169
|
+
</button>
|
|
170
|
+
</div>
|
|
171
|
+
</MazPopover>
|
|
172
|
+
</template>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</template>
|
|
176
|
+
</ComponentDemo>
|
|
177
|
+
|
|
178
|
+
## Positions
|
|
179
|
+
|
|
180
|
+
::: tip
|
|
181
|
+
|
|
182
|
+
The position prop is used to position the popover relative to the trigger. The chosen position will force the popover to be displayed in the chosen position.
|
|
183
|
+
|
|
184
|
+
:::
|
|
185
|
+
|
|
186
|
+
<ComponentDemo>
|
|
187
|
+
<div class="maz-grid maz-grid-cols-2 maz-gap-4 md:maz-grid-cols-4">
|
|
188
|
+
<MazPopover trigger="hover" position="top">
|
|
189
|
+
<template #trigger>
|
|
190
|
+
<MazBtn block>
|
|
191
|
+
Top
|
|
192
|
+
</MazBtn>
|
|
193
|
+
</template>
|
|
194
|
+
<div class="maz-p-3">
|
|
195
|
+
<p class="maz-text-sm">Top positioned popover</p>
|
|
196
|
+
</div>
|
|
197
|
+
</MazPopover>
|
|
198
|
+
<MazPopover trigger="hover" position="bottom">
|
|
199
|
+
<template #trigger>
|
|
200
|
+
<MazBtn block>
|
|
201
|
+
Bottom
|
|
202
|
+
</MazBtn>
|
|
203
|
+
</template>
|
|
204
|
+
<div class="maz-p-3">
|
|
205
|
+
<p class="maz-text-sm">Bottom positioned popover</p>
|
|
206
|
+
</div>
|
|
207
|
+
</MazPopover>
|
|
208
|
+
<MazPopover trigger="hover" position="left">
|
|
209
|
+
<template #trigger>
|
|
210
|
+
<MazBtn block>
|
|
211
|
+
Left
|
|
212
|
+
</MazBtn>
|
|
213
|
+
</template>
|
|
214
|
+
<div class="maz-p-3">
|
|
215
|
+
<p class="maz-text-sm">Left positioned popover</p>
|
|
216
|
+
</div>
|
|
217
|
+
</MazPopover>
|
|
218
|
+
<MazPopover trigger="hover" position="right">
|
|
219
|
+
<template #trigger>
|
|
220
|
+
<MazBtn block>
|
|
221
|
+
Right
|
|
222
|
+
</MazBtn>
|
|
223
|
+
</template>
|
|
224
|
+
<div class="maz-p-3">
|
|
225
|
+
<p class="maz-text-sm">Right positioned popover</p>
|
|
226
|
+
</div>
|
|
227
|
+
</MazPopover>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<template #code>
|
|
231
|
+
|
|
232
|
+
```vue
|
|
233
|
+
<template>
|
|
234
|
+
<MazPopover trigger="hover" position="top">
|
|
235
|
+
<template #trigger>
|
|
236
|
+
<MazBtn>Top</MazBtn>
|
|
237
|
+
</template>
|
|
238
|
+
<div class="maz-p-3">
|
|
239
|
+
<p class="maz-text-sm">
|
|
240
|
+
Top positioned popover
|
|
241
|
+
</p>
|
|
242
|
+
</div>
|
|
243
|
+
</MazPopover>
|
|
244
|
+
|
|
245
|
+
<MazPopover trigger="hover" position="bottom">
|
|
246
|
+
<template #trigger>
|
|
247
|
+
<MazBtn>Bottom</MazBtn>
|
|
248
|
+
</template>
|
|
249
|
+
<div class="maz-p-3">
|
|
250
|
+
<p class="maz-text-sm">
|
|
251
|
+
Bottom positioned popover
|
|
252
|
+
</p>
|
|
253
|
+
</div>
|
|
254
|
+
</MazPopover>
|
|
255
|
+
|
|
256
|
+
<MazPopover trigger="hover" position="left">
|
|
257
|
+
<template #trigger>
|
|
258
|
+
<MazBtn>Left</MazBtn>
|
|
259
|
+
</template>
|
|
260
|
+
<div class="maz-p-3">
|
|
261
|
+
<p class="maz-text-sm">
|
|
262
|
+
Left positioned popover
|
|
263
|
+
</p>
|
|
264
|
+
</div>
|
|
265
|
+
</MazPopover>
|
|
266
|
+
|
|
267
|
+
<MazPopover trigger="hover" position="right">
|
|
268
|
+
<template #trigger>
|
|
269
|
+
<MazBtn>Right</MazBtn>
|
|
270
|
+
</template>
|
|
271
|
+
<div class="maz-p-3">
|
|
272
|
+
<p class="maz-text-sm">
|
|
273
|
+
Right positioned popover
|
|
274
|
+
</p>
|
|
275
|
+
</div>
|
|
276
|
+
</MazPopover>
|
|
277
|
+
</template>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
</template>
|
|
281
|
+
</ComponentDemo>
|
|
282
|
+
|
|
283
|
+
## Advanced positions
|
|
284
|
+
|
|
285
|
+
<ComponentDemo>
|
|
286
|
+
<div class="maz-grid maz-grid-cols-2 maz-gap-4 md:maz-grid-cols-3">
|
|
287
|
+
<MazPopover position="top-start">
|
|
288
|
+
<template #trigger>
|
|
289
|
+
<MazBtn block size="sm">
|
|
290
|
+
Top Start
|
|
291
|
+
</MazBtn>
|
|
292
|
+
</template>
|
|
293
|
+
<div class="maz-p-3">
|
|
294
|
+
<p class="maz-text-sm">Top start aligned</p>
|
|
295
|
+
</div>
|
|
296
|
+
</MazPopover>
|
|
297
|
+
<MazPopover position="top-end">
|
|
298
|
+
<template #trigger>
|
|
299
|
+
<MazBtn block size="sm">
|
|
300
|
+
Top End
|
|
301
|
+
</MazBtn>
|
|
302
|
+
</template>
|
|
303
|
+
<div class="maz-p-3">
|
|
304
|
+
<p class="maz-text-sm">Top end aligned</p>
|
|
305
|
+
</div>
|
|
306
|
+
</MazPopover>
|
|
307
|
+
<MazPopover position="bottom-start">
|
|
308
|
+
<template #trigger>
|
|
309
|
+
<MazBtn block size="sm">
|
|
310
|
+
Bottom Start
|
|
311
|
+
</MazBtn>
|
|
312
|
+
</template>
|
|
313
|
+
<div class="maz-p-3">
|
|
314
|
+
<p class="maz-text-sm">Bottom start aligned</p>
|
|
315
|
+
</div>
|
|
316
|
+
</MazPopover>
|
|
317
|
+
<MazPopover position="bottom-end">
|
|
318
|
+
<template #trigger>
|
|
319
|
+
<MazBtn block size="sm">
|
|
320
|
+
Bottom End
|
|
321
|
+
</MazBtn>
|
|
322
|
+
</template>
|
|
323
|
+
<div class="maz-p-3">
|
|
324
|
+
<p class="maz-text-sm">Bottom end aligned</p>
|
|
325
|
+
</div>
|
|
326
|
+
</MazPopover>
|
|
327
|
+
<MazPopover position="left-start">
|
|
328
|
+
<template #trigger>
|
|
329
|
+
<MazBtn block size="sm">
|
|
330
|
+
Left Start
|
|
331
|
+
</MazBtn>
|
|
332
|
+
</template>
|
|
333
|
+
<div class="maz-p-3">
|
|
334
|
+
<p class="maz-text-sm">Left start aligned</p>
|
|
335
|
+
</div>
|
|
336
|
+
</MazPopover>
|
|
337
|
+
<MazPopover position="left-end">
|
|
338
|
+
<template #trigger>
|
|
339
|
+
<MazBtn block size="sm">
|
|
340
|
+
Left End
|
|
341
|
+
</MazBtn>
|
|
342
|
+
</template>
|
|
343
|
+
<div class="maz-p-3">
|
|
344
|
+
<p class="maz-text-sm">Left end aligned</p>
|
|
345
|
+
</div>
|
|
346
|
+
</MazPopover>
|
|
347
|
+
<MazPopover position="right-start">
|
|
348
|
+
<template #trigger>
|
|
349
|
+
<MazBtn block size="sm">
|
|
350
|
+
Right Start
|
|
351
|
+
</MazBtn>
|
|
352
|
+
</template>
|
|
353
|
+
<div class="maz-p-3">
|
|
354
|
+
<p class="maz-text-sm">Right start aligned</p>
|
|
355
|
+
</div>
|
|
356
|
+
</MazPopover>
|
|
357
|
+
<MazPopover position="right-end">
|
|
358
|
+
<template #trigger>
|
|
359
|
+
<MazBtn block size="sm">
|
|
360
|
+
Right End
|
|
361
|
+
</MazBtn>
|
|
362
|
+
</template>
|
|
363
|
+
<div class="maz-p-3">
|
|
364
|
+
<p class="maz-text-sm">Right end aligned</p>
|
|
365
|
+
</div>
|
|
366
|
+
</MazPopover>
|
|
367
|
+
<MazPopover position="auto">
|
|
368
|
+
<template #trigger>
|
|
369
|
+
<MazBtn block size="sm" color="accent">
|
|
370
|
+
Auto Position
|
|
371
|
+
</MazBtn>
|
|
372
|
+
</template>
|
|
373
|
+
<div class="maz-p-3">
|
|
374
|
+
<p class="maz-text-sm">Automatically positioned based on available space</p>
|
|
375
|
+
</div>
|
|
376
|
+
</MazPopover>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<template #code>
|
|
380
|
+
|
|
381
|
+
```vue
|
|
382
|
+
<template>
|
|
383
|
+
<MazPopover position="top-start">
|
|
384
|
+
<template #trigger>
|
|
385
|
+
<MazBtn block size="sm">
|
|
386
|
+
Top Start
|
|
387
|
+
</MazBtn>
|
|
388
|
+
</template>
|
|
389
|
+
<div class="maz-p-3">
|
|
390
|
+
<p class="maz-text-sm">Top start aligned</p>
|
|
391
|
+
</div>
|
|
392
|
+
</MazPopover>
|
|
393
|
+
<MazPopover position="top-end">
|
|
394
|
+
<template #trigger>
|
|
395
|
+
<MazBtn block size="sm">
|
|
396
|
+
Top End
|
|
397
|
+
</MazBtn>
|
|
398
|
+
</template>
|
|
399
|
+
<div class="maz-p-3">
|
|
400
|
+
<p class="maz-text-sm">Top end aligned</p>
|
|
401
|
+
</div>
|
|
402
|
+
</MazPopover>
|
|
403
|
+
<MazPopover position="bottom-start">
|
|
404
|
+
<template #trigger>
|
|
405
|
+
<MazBtn block size="sm">
|
|
406
|
+
Bottom Start
|
|
407
|
+
</MazBtn>
|
|
408
|
+
</template>
|
|
409
|
+
<div class="maz-p-3">
|
|
410
|
+
<p class="maz-text-sm">Bottom start aligned</p>
|
|
411
|
+
</div>
|
|
412
|
+
</MazPopover>
|
|
413
|
+
<MazPopover position="bottom-end">
|
|
414
|
+
<template #trigger>
|
|
415
|
+
<MazBtn block size="sm">
|
|
416
|
+
Bottom End
|
|
417
|
+
</MazBtn>
|
|
418
|
+
</template>
|
|
419
|
+
<div class="maz-p-3">
|
|
420
|
+
<p class="maz-text-sm">Bottom end aligned</p>
|
|
421
|
+
</div>
|
|
422
|
+
</MazPopover>
|
|
423
|
+
|
|
424
|
+
<MazPopover position="left-start">
|
|
425
|
+
<template #trigger>
|
|
426
|
+
<MazBtn block size="sm">
|
|
427
|
+
Left Start
|
|
428
|
+
</MazBtn>
|
|
429
|
+
</template>
|
|
430
|
+
<div class="maz-p-3">
|
|
431
|
+
<p class="maz-text-sm">Left start aligned</p>
|
|
432
|
+
</div>
|
|
433
|
+
</MazPopover>
|
|
434
|
+
<MazPopover position="left-end">
|
|
435
|
+
<template #trigger>
|
|
436
|
+
<MazBtn block size="sm">
|
|
437
|
+
Left End
|
|
438
|
+
</MazBtn>
|
|
439
|
+
</template>
|
|
440
|
+
<div class="maz-p-3">
|
|
441
|
+
<p class="maz-text-sm">Left end aligned</p>
|
|
442
|
+
</div>
|
|
443
|
+
</MazPopover>
|
|
444
|
+
|
|
445
|
+
<MazPopover position="right-start">
|
|
446
|
+
<template #trigger>
|
|
447
|
+
<MazBtn block size="sm">
|
|
448
|
+
Right Start
|
|
449
|
+
</MazBtn>
|
|
450
|
+
</template>
|
|
451
|
+
<div class="maz-p-3">
|
|
452
|
+
<p class="maz-text-sm">Right start aligned</p>
|
|
453
|
+
</div>
|
|
454
|
+
</MazPopover>
|
|
455
|
+
<MazPopover position="right-end">
|
|
456
|
+
<template #trigger>
|
|
457
|
+
<MazBtn block size="sm">
|
|
458
|
+
Right End
|
|
459
|
+
</MazBtn>
|
|
460
|
+
</template>
|
|
461
|
+
<div class="maz-p-3">
|
|
462
|
+
<p class="maz-text-sm">Right end aligned</p>
|
|
463
|
+
</div>
|
|
464
|
+
</MazPopover>
|
|
465
|
+
|
|
466
|
+
<MazPopover position="auto">
|
|
467
|
+
<template #trigger>
|
|
468
|
+
<MazBtn color="accent">
|
|
469
|
+
Auto Position
|
|
470
|
+
</MazBtn>
|
|
471
|
+
</template>
|
|
472
|
+
<div class="maz-p-3">
|
|
473
|
+
<p class="maz-text-sm">
|
|
474
|
+
Automatically positioned based on available space
|
|
475
|
+
</p>
|
|
476
|
+
</div>
|
|
477
|
+
</MazPopover>
|
|
478
|
+
</template>
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
</template>
|
|
482
|
+
</ComponentDemo>
|
|
483
|
+
|
|
484
|
+
## Prefer position and fallback position
|
|
485
|
+
|
|
486
|
+
::: tip
|
|
487
|
+
|
|
488
|
+
The prefer-position and fallback-position props are used to position the popover relative to the trigger. The prefer-position is the position that will be used if it's available, and the fallback-position is the position that will be used if the prefer-position is not available.
|
|
489
|
+
|
|
490
|
+
When you not specify a fallback position, the popover will fallback on the best position available.
|
|
491
|
+
|
|
492
|
+
:::
|
|
493
|
+
|
|
494
|
+
<ComponentDemo>
|
|
495
|
+
<div class="maz-flex maz-gap-4">
|
|
496
|
+
<MazPopover prefer-position="top-start" fallback-position="bottom-start">
|
|
497
|
+
<template #trigger>
|
|
498
|
+
<MazBtn>
|
|
499
|
+
Prefer position and fallback position
|
|
500
|
+
</MazBtn>
|
|
501
|
+
</template>
|
|
502
|
+
<div class="maz-p-4">
|
|
503
|
+
<p class="maz-text-sm">This popover will prefer the top position, but if it's not available, it will fallback to the bottom position.</p>
|
|
504
|
+
</div>
|
|
505
|
+
</MazPopover>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<template #code>
|
|
509
|
+
|
|
510
|
+
```html
|
|
511
|
+
<MazPopover prefer-position="top-start" fallback-position="bottom-start">
|
|
512
|
+
<template #trigger>
|
|
513
|
+
<MazBtn>
|
|
514
|
+
Prefer position and fallback position
|
|
515
|
+
</MazBtn>
|
|
516
|
+
</template>
|
|
517
|
+
<div class="maz-p-4">
|
|
518
|
+
<p class="maz-text-sm">This popover will prefer the top position, but if it's not available, it will fallback to the bottom position.</p>
|
|
519
|
+
</div>
|
|
520
|
+
</MazPopover>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
</template>
|
|
524
|
+
</ComponentDemo>
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
## Colors
|
|
528
|
+
|
|
529
|
+
<ComponentDemo>
|
|
530
|
+
<div class="maz-flex maz-gap-4 maz-flex-wrap">
|
|
531
|
+
<MazPopover color="background" trigger="hover">
|
|
532
|
+
<template #trigger>
|
|
533
|
+
<MazBtn color="contrast">Background</MazBtn>
|
|
534
|
+
</template>
|
|
535
|
+
<div class="maz-p-4">
|
|
536
|
+
<p class="maz-text-sm">This popover has a default color!</p>
|
|
537
|
+
</div>
|
|
538
|
+
</MazPopover>
|
|
539
|
+
<MazPopover color="primary" trigger="hover">
|
|
540
|
+
<template #trigger>
|
|
541
|
+
<MazBtn color="primary">Primary</MazBtn>
|
|
542
|
+
</template>
|
|
543
|
+
<div class="maz-p-4">
|
|
544
|
+
<p class="maz-text-sm">This popover has a primary color!</p>
|
|
545
|
+
</div>
|
|
546
|
+
</MazPopover>
|
|
547
|
+
<MazPopover color="secondary" trigger="hover">
|
|
548
|
+
<template #trigger>
|
|
549
|
+
<MazBtn color="secondary">Secondary</MazBtn>
|
|
550
|
+
</template>
|
|
551
|
+
<div class="maz-p-4">
|
|
552
|
+
<p class="maz-text-sm">This popover has a secondary color!</p>
|
|
553
|
+
</div>
|
|
554
|
+
</MazPopover>
|
|
555
|
+
<MazPopover color="accent" trigger="hover">
|
|
556
|
+
<template #trigger>
|
|
557
|
+
<MazBtn color="accent">Accent</MazBtn>
|
|
558
|
+
</template>
|
|
559
|
+
<div class="maz-p-4">
|
|
560
|
+
<p class="maz-text-sm">This popover has a accent color!</p>
|
|
561
|
+
</div>
|
|
562
|
+
</MazPopover>
|
|
563
|
+
<MazPopover color="contrast" trigger="hover">
|
|
564
|
+
<template #trigger>
|
|
565
|
+
<MazBtn color="contrast">Contrast</MazBtn>
|
|
566
|
+
</template>
|
|
567
|
+
<div class="maz-p-4">
|
|
568
|
+
<p class="maz-text-sm">This popover has a contrast color!</p>
|
|
569
|
+
</div>
|
|
570
|
+
</MazPopover>
|
|
571
|
+
<MazPopover color="success" trigger="hover">
|
|
572
|
+
<template #trigger>
|
|
573
|
+
<MazBtn color="success">Success</MazBtn>
|
|
574
|
+
</template>
|
|
575
|
+
<div class="maz-p-4">
|
|
576
|
+
<p class="maz-text-sm">This popover has a success color!</p>
|
|
577
|
+
</div>
|
|
578
|
+
</MazPopover>
|
|
579
|
+
<MazPopover color="info" trigger="hover">
|
|
580
|
+
<template #trigger>
|
|
581
|
+
<MazBtn color="info">Info</MazBtn>
|
|
582
|
+
</template>
|
|
583
|
+
<div class="maz-p-4">
|
|
584
|
+
<p class="maz-text-sm">This popover has a info color!</p>
|
|
585
|
+
</div>
|
|
586
|
+
</MazPopover>
|
|
587
|
+
<MazPopover color="destructive" trigger="hover">
|
|
588
|
+
<template #trigger>
|
|
589
|
+
<MazBtn color="destructive">Destructive</MazBtn>
|
|
590
|
+
</template>
|
|
591
|
+
<div class="maz-p-4">
|
|
592
|
+
<p class="maz-text-sm">This popover has a destructive color!</p>
|
|
593
|
+
</div>
|
|
594
|
+
</MazPopover>
|
|
595
|
+
<MazPopover color="warning" trigger="hover">
|
|
596
|
+
<template #trigger>
|
|
597
|
+
<MazBtn color="warning">Warning</MazBtn>
|
|
598
|
+
</template>
|
|
599
|
+
<div class="maz-p-4">
|
|
600
|
+
<p class="maz-text-sm">This popover has a warning color!</p>
|
|
601
|
+
</div>
|
|
602
|
+
</MazPopover>
|
|
603
|
+
</div>
|
|
604
|
+
|
|
605
|
+
<template #code>
|
|
606
|
+
|
|
607
|
+
```vue
|
|
608
|
+
<template>
|
|
609
|
+
<MazPopover color="background" trigger="hover">
|
|
610
|
+
<template #trigger>
|
|
611
|
+
<MazBtn color="contrast">Background</MazBtn>
|
|
612
|
+
</template>
|
|
613
|
+
<div class="maz-p-4">
|
|
614
|
+
<p class="maz-text-sm">This popover has a default color!</p>
|
|
615
|
+
</div>
|
|
616
|
+
</MazPopover>
|
|
617
|
+
<MazPopover color="primary" trigger="hover">
|
|
618
|
+
<template #trigger>
|
|
619
|
+
<MazBtn color="primary">Primary</MazBtn>
|
|
620
|
+
</template>
|
|
621
|
+
<div class="maz-p-4">
|
|
622
|
+
<p class="maz-text-sm">This popover has a primary color!</p>
|
|
623
|
+
</div>
|
|
624
|
+
</MazPopover>
|
|
625
|
+
<MazPopover color="secondary" trigger="hover">
|
|
626
|
+
<template #trigger>
|
|
627
|
+
<MazBtn color="secondary">Secondary</MazBtn>
|
|
628
|
+
</template>
|
|
629
|
+
<div class="maz-p-4">
|
|
630
|
+
<p class="maz-text-sm">This popover has a secondary color!</p>
|
|
631
|
+
</div>
|
|
632
|
+
</MazPopover>
|
|
633
|
+
<MazPopover color="accent" trigger="hover">
|
|
634
|
+
<template #trigger>
|
|
635
|
+
<MazBtn color="accent">Accent</MazBtn>
|
|
636
|
+
</template>
|
|
637
|
+
<div class="maz-p-4">
|
|
638
|
+
<p class="maz-text-sm">This popover has a accent color!</p>
|
|
639
|
+
</div>
|
|
640
|
+
</MazPopover>
|
|
641
|
+
<MazPopover color="contrast" trigger="hover">
|
|
642
|
+
<template #trigger>
|
|
643
|
+
<MazBtn color="contrast">Contrast</MazBtn>
|
|
644
|
+
</template>
|
|
645
|
+
<div class="maz-p-4">
|
|
646
|
+
<p class="maz-text-sm">This popover has a contrast color!</p>
|
|
647
|
+
</div>
|
|
648
|
+
</MazPopover>
|
|
649
|
+
<MazPopover color="success" trigger="hover">
|
|
650
|
+
<template #trigger>
|
|
651
|
+
<MazBtn color="success">Success</MazBtn>
|
|
652
|
+
</template>
|
|
653
|
+
<div class="maz-p-4">
|
|
654
|
+
<p class="maz-text-sm">This popover has a success color!</p>
|
|
655
|
+
</div>
|
|
656
|
+
</MazPopover>
|
|
657
|
+
<MazPopover color="info" trigger="hover">
|
|
658
|
+
<template #trigger>
|
|
659
|
+
<MazBtn color="info">Info</MazBtn>
|
|
660
|
+
</template>
|
|
661
|
+
<div class="maz-p-4">
|
|
662
|
+
<p class="maz-text-sm">This popover has a info color!</p>
|
|
663
|
+
</div>
|
|
664
|
+
</MazPopover>
|
|
665
|
+
<MazPopover color="destructive" trigger="hover">
|
|
666
|
+
<template #trigger>
|
|
667
|
+
<MazBtn color="destructive">Destructive</MazBtn>
|
|
668
|
+
</template>
|
|
669
|
+
<div class="maz-p-4">
|
|
670
|
+
<p class="maz-text-sm">This popover has a destructive color!</p>
|
|
671
|
+
</div>
|
|
672
|
+
</MazPopover>
|
|
673
|
+
<MazPopover color="warning" trigger="hover">
|
|
674
|
+
<template #trigger>
|
|
675
|
+
<MazBtn color="warning">Warning</MazBtn>
|
|
676
|
+
</template>
|
|
677
|
+
<div class="maz-p-4">
|
|
678
|
+
<p class="maz-text-sm">This popover has a warning color!</p>
|
|
679
|
+
</div>
|
|
680
|
+
</MazPopover>
|
|
681
|
+
</template>
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
</template>
|
|
685
|
+
|
|
686
|
+
</ComponentDemo>
|
|
687
|
+
|
|
688
|
+
## Tooltip role
|
|
689
|
+
|
|
690
|
+
A directive is available to more easily add a tooltip to an element, see [vTooltip](./../directives/tooltip.md) for more information.
|
|
691
|
+
|
|
692
|
+
<ComponentDemo>
|
|
693
|
+
<div class="maz-flex maz-gap-4 maz-flex-wrap maz-items-center">
|
|
694
|
+
<MazPopover role="tooltip" trigger="hover" position="top">
|
|
695
|
+
<template #trigger>
|
|
696
|
+
<MazBtn color="info">
|
|
697
|
+
Hover for tooltip
|
|
698
|
+
</MazBtn>
|
|
699
|
+
</template>
|
|
700
|
+
<div class="maz-p-2">
|
|
701
|
+
<p class="maz-text-xs">This is a tooltip with proper ARIA attributes</p>
|
|
702
|
+
</div>
|
|
703
|
+
</MazPopover>
|
|
704
|
+
<MazPopover
|
|
705
|
+
role="tooltip"
|
|
706
|
+
trigger="hover"
|
|
707
|
+
position="bottom"
|
|
708
|
+
panel-class="!maz-bg-gray-800 !maz-text-white !maz-border-gray-700"
|
|
709
|
+
>
|
|
710
|
+
<template #trigger>
|
|
711
|
+
<span class="maz-underline maz-cursor-help">
|
|
712
|
+
Hover this text
|
|
713
|
+
</span>
|
|
714
|
+
</template>
|
|
715
|
+
<div class="maz-p-2">
|
|
716
|
+
<p class="maz-text-xs">Custom styled tooltip</p>
|
|
717
|
+
</div>
|
|
718
|
+
</MazPopover>
|
|
719
|
+
<MazPopover
|
|
720
|
+
role="tooltip"
|
|
721
|
+
trigger="hover"
|
|
722
|
+
:delay="1000"
|
|
723
|
+
position="right"
|
|
724
|
+
>
|
|
725
|
+
<template #trigger>
|
|
726
|
+
<MazInformationCircle class="maz-cursor-help maz-text-info maz-text-xl" />
|
|
727
|
+
</template>
|
|
728
|
+
<div class="maz-p-2 maz-max-w-48">
|
|
729
|
+
<p class="maz-text-xs">This tooltip has a 1000ms delay before showing</p>
|
|
730
|
+
</div>
|
|
731
|
+
</MazPopover>
|
|
732
|
+
</div>
|
|
733
|
+
|
|
734
|
+
<template #code>
|
|
735
|
+
|
|
736
|
+
```vue
|
|
737
|
+
<template>
|
|
738
|
+
<MazPopover role="tooltip" trigger="hover" position="top">
|
|
739
|
+
<template #trigger>
|
|
740
|
+
<MazBtn color="info">
|
|
741
|
+
Hover for tooltip
|
|
742
|
+
</MazBtn>
|
|
743
|
+
</template>
|
|
744
|
+
<div class="maz-p-2">
|
|
745
|
+
<p class="maz-text-xs">This is a tooltip with proper ARIA attributes</p>
|
|
746
|
+
</div>
|
|
747
|
+
</MazPopover>
|
|
748
|
+
<MazPopover
|
|
749
|
+
role="tooltip"
|
|
750
|
+
trigger="hover"
|
|
751
|
+
position="bottom"
|
|
752
|
+
panel-class="!maz-bg-gray-800 !maz-text-white !maz-border-gray-700"
|
|
753
|
+
>
|
|
754
|
+
<template #trigger>
|
|
755
|
+
<span class="maz-underline maz-cursor-help">
|
|
756
|
+
Hover this text
|
|
757
|
+
</span>
|
|
758
|
+
</template>
|
|
759
|
+
<div class="maz-p-2">
|
|
760
|
+
<p class="maz-text-xs">Custom styled tooltip</p>
|
|
761
|
+
</div>
|
|
762
|
+
</MazPopover>
|
|
763
|
+
<MazPopover
|
|
764
|
+
role="tooltip"
|
|
765
|
+
trigger="hover"
|
|
766
|
+
:delay="1000"
|
|
767
|
+
position="right"
|
|
768
|
+
>
|
|
769
|
+
<template #trigger>
|
|
770
|
+
<MazInformationCircle class="maz-cursor-help maz-text-info maz-text-xl" />
|
|
771
|
+
</template>
|
|
772
|
+
<div class="maz-p-2 maz-max-w-48">
|
|
773
|
+
<p class="maz-text-xs">This tooltip has a 1000ms delay before showing</p>
|
|
774
|
+
</div>
|
|
775
|
+
</MazPopover>
|
|
776
|
+
</template>
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
</template>
|
|
780
|
+
</ComponentDemo>
|
|
781
|
+
|
|
782
|
+
## Controlled popover
|
|
783
|
+
|
|
784
|
+
<ComponentDemo>
|
|
785
|
+
<div class="maz-flex maz-gap-4 maz-flex-wrap maz-items-center">
|
|
786
|
+
<MazPopover v-model="isOpen" trigger="manual">
|
|
787
|
+
<template #trigger="{ toggle }">
|
|
788
|
+
<MazBtn @click="toggle">
|
|
789
|
+
Controlled Trigger
|
|
790
|
+
</MazBtn>
|
|
791
|
+
</template>
|
|
792
|
+
<div class="maz-p-4">
|
|
793
|
+
<h4 class="maz-font-semibold maz-mb-2">Controlled Popover</h4>
|
|
794
|
+
<p class="maz-text-sm maz-mb-3">This popover is controlled externally.</p>
|
|
795
|
+
<MazBtn @click="isOpen = false" size="sm" color="destructive">
|
|
796
|
+
Close
|
|
797
|
+
</MazBtn>
|
|
798
|
+
</div>
|
|
799
|
+
</MazPopover>
|
|
800
|
+
<MazBtn @click="isOpen = !isOpen" color="secondary">
|
|
801
|
+
{{ isOpen ? 'Close' : 'Open' }} Popover
|
|
802
|
+
</MazBtn>
|
|
803
|
+
<span class="maz-text-sm maz-text-muted">
|
|
804
|
+
Popover is {{ isOpen ? 'open' : 'closed' }}
|
|
805
|
+
</span>
|
|
806
|
+
</div>
|
|
807
|
+
|
|
808
|
+
<template #code>
|
|
809
|
+
|
|
810
|
+
```vue
|
|
811
|
+
<script setup>
|
|
812
|
+
import { ref } from 'vue'
|
|
813
|
+
|
|
814
|
+
const isOpen = ref(false)
|
|
815
|
+
</script>
|
|
816
|
+
|
|
817
|
+
<template>
|
|
818
|
+
<MazPopover v-model="isOpen" trigger="manual">
|
|
819
|
+
<template #trigger="{ toggle }">
|
|
820
|
+
<MazBtn @click="toggle">
|
|
821
|
+
Controlled Trigger
|
|
822
|
+
</MazBtn>
|
|
823
|
+
</template>
|
|
824
|
+
<div class="maz-p-4">
|
|
825
|
+
<h4 class="maz-font-semibold maz-mb-2">Controlled Popover</h4>
|
|
826
|
+
<p class="maz-text-sm maz-mb-3">This popover is controlled externally.</p>
|
|
827
|
+
<MazBtn @click="isOpen = false" size="sm" color="destructive">
|
|
828
|
+
Close
|
|
829
|
+
</MazBtn>
|
|
830
|
+
</div>
|
|
831
|
+
</MazPopover>
|
|
832
|
+
<MazBtn @click="isOpen = !isOpen" color="secondary">
|
|
833
|
+
{{ isOpen ? 'Close' : 'Open' }} Popover
|
|
834
|
+
</MazBtn>
|
|
835
|
+
<span class="maz-text-sm maz-text-muted">
|
|
836
|
+
Popover is {{ isOpen ? 'open' : 'closed' }}
|
|
837
|
+
</span>
|
|
838
|
+
|
|
839
|
+
<MazBtn color="secondary" @click="isOpen = !isOpen">
|
|
840
|
+
{{ isOpen ? 'Close' : 'Open' }} Popover
|
|
841
|
+
</MazBtn>
|
|
842
|
+
</template>
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
</template>
|
|
846
|
+
</ComponentDemo>
|
|
847
|
+
|
|
848
|
+
## Menu example
|
|
849
|
+
|
|
850
|
+
<ComponentDemo>
|
|
851
|
+
<div class="maz-flex maz-gap-4">
|
|
852
|
+
<MazPopover position="bottom-start">
|
|
853
|
+
<template #trigger>
|
|
854
|
+
<MazBtn>
|
|
855
|
+
<MazIcon name="cog-6-tooth" class="maz-mr-2" />
|
|
856
|
+
Settings
|
|
857
|
+
<MazIcon name="chevron-down" class="maz-ml-2" />
|
|
858
|
+
</MazBtn>
|
|
859
|
+
</template>
|
|
860
|
+
<div class="maz-py-1 maz-min-w-48">
|
|
861
|
+
<button
|
|
862
|
+
v-for="item in menuItems"
|
|
863
|
+
:key="item.label"
|
|
864
|
+
class="maz-w-full maz-px-4 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-flex maz-items-center maz-gap-2"
|
|
865
|
+
@click="handleMenuClick(item.action)"
|
|
866
|
+
>
|
|
867
|
+
<MazIcon :name="item.icon" class="maz-w-4 maz-h-4" />
|
|
868
|
+
{{ item.label }}
|
|
869
|
+
</button>
|
|
870
|
+
</div>
|
|
871
|
+
</MazPopover>
|
|
872
|
+
<MazPopover position="bottom-end">
|
|
873
|
+
<template #trigger>
|
|
874
|
+
<MazBtn color="transparent" fab :icon="MazEllipsisVertical" />
|
|
875
|
+
</template>
|
|
876
|
+
<div class="maz-py-1 maz-min-w-32">
|
|
877
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
878
|
+
Edit
|
|
879
|
+
</button>
|
|
880
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
881
|
+
Share
|
|
882
|
+
</button>
|
|
883
|
+
<hr class="maz-my-1 maz-border-divider">
|
|
884
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-text-destructive">
|
|
885
|
+
Delete
|
|
886
|
+
</button>
|
|
887
|
+
</div>
|
|
888
|
+
</MazPopover>
|
|
889
|
+
</div>
|
|
890
|
+
|
|
891
|
+
<template #code>
|
|
892
|
+
|
|
893
|
+
```vue
|
|
894
|
+
<script setup>
|
|
895
|
+
const menuItems = [
|
|
896
|
+
{ label: 'Profile', icon: 'user', action: 'profile' },
|
|
897
|
+
{ label: 'Settings', icon: 'cog-6-tooth', action: 'settings' },
|
|
898
|
+
{ label: 'Sign out', icon: 'arrow-right-on-rectangle', action: 'signout' }
|
|
899
|
+
]
|
|
900
|
+
|
|
901
|
+
function handleMenuClick(action) {
|
|
902
|
+
console.log('Menu action:', action)
|
|
903
|
+
}
|
|
904
|
+
</script>
|
|
905
|
+
|
|
906
|
+
<template>
|
|
907
|
+
<MazPopover position="bottom-start">
|
|
908
|
+
<template #trigger>
|
|
909
|
+
<MazBtn>
|
|
910
|
+
<MazIcon name="cog-6-tooth" class="maz-mr-2" />
|
|
911
|
+
Settings
|
|
912
|
+
<MazIcon name="chevron-down" class="maz-ml-2" />
|
|
913
|
+
</MazBtn>
|
|
914
|
+
</template>
|
|
915
|
+
<div class="maz-py-1 maz-min-w-48">
|
|
916
|
+
<button
|
|
917
|
+
v-for="item in menuItems"
|
|
918
|
+
:key="item.label"
|
|
919
|
+
class="maz-w-full maz-px-4 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-flex maz-items-center maz-gap-2"
|
|
920
|
+
@click="handleMenuClick(item.action)"
|
|
921
|
+
>
|
|
922
|
+
<MazIcon :name="item.icon" class="maz-w-4 maz-h-4" />
|
|
923
|
+
{{ item.label }}
|
|
924
|
+
</button>
|
|
925
|
+
</div>
|
|
926
|
+
</MazPopover>
|
|
927
|
+
|
|
928
|
+
<MazPopover position="bottom-end">
|
|
929
|
+
<template #trigger>
|
|
930
|
+
<MazBtn color="transparent" size="sm">
|
|
931
|
+
<MazIcon name="ellipsis-vertical" />
|
|
932
|
+
</MazBtn>
|
|
933
|
+
</template>
|
|
934
|
+
<div class="maz-py-1 maz-min-w-32">
|
|
935
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
936
|
+
Edit
|
|
937
|
+
</button>
|
|
938
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
939
|
+
Share
|
|
940
|
+
</button>
|
|
941
|
+
<hr class="maz-my-1 maz-border-divider">
|
|
942
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-text-destructive">
|
|
943
|
+
Delete
|
|
944
|
+
</button>
|
|
945
|
+
</div>
|
|
946
|
+
</MazPopover>
|
|
947
|
+
</template>
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
</template>
|
|
951
|
+
</ComponentDemo>
|
|
952
|
+
|
|
953
|
+
## Keep open on hover
|
|
954
|
+
|
|
955
|
+
> With this option, the popover will stay open when you hover over it (a timeout is used to close the popover after a certain time).
|
|
956
|
+
|
|
957
|
+
<ComponentDemo>
|
|
958
|
+
<MazPopover position="bottom-end" keep-open-on-hover trigger="hover">
|
|
959
|
+
<template #trigger>
|
|
960
|
+
<MazBtn color="secondary">
|
|
961
|
+
Keep open on hover
|
|
962
|
+
</MazBtn>
|
|
963
|
+
</template>
|
|
964
|
+
<div class="maz-py-1 maz-min-w-32">
|
|
965
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
966
|
+
Edit
|
|
967
|
+
</button>
|
|
968
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
969
|
+
Share
|
|
970
|
+
</button>
|
|
971
|
+
<hr class="maz-my-1 maz-border-divider">
|
|
972
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-text-destructive">
|
|
973
|
+
Delete
|
|
974
|
+
</button>
|
|
975
|
+
</div>
|
|
976
|
+
</MazPopover>
|
|
977
|
+
|
|
978
|
+
<template #code>
|
|
979
|
+
|
|
980
|
+
```vue
|
|
981
|
+
<template>
|
|
982
|
+
<MazPopover position="bottom-end" keep-open-on-hover trigger="hover">
|
|
983
|
+
<template #trigger>
|
|
984
|
+
<MazBtn color="secondary">
|
|
985
|
+
Keep open on hover
|
|
986
|
+
</MazBtn>
|
|
987
|
+
</template>
|
|
988
|
+
<div class="maz-py-1 maz-min-w-32">
|
|
989
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
990
|
+
Edit
|
|
991
|
+
</button>
|
|
992
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400">
|
|
993
|
+
Share
|
|
994
|
+
</button>
|
|
995
|
+
<hr class="maz-my-1 maz-border-divider">
|
|
996
|
+
<button class="maz-w-full maz-px-3 maz-py-2 maz-text-left maz-text-sm hover:maz-bg-surface-400 maz-text-destructive">
|
|
997
|
+
Delete
|
|
998
|
+
</button>
|
|
999
|
+
</div>
|
|
1000
|
+
</MazPopover>
|
|
1001
|
+
</template>
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
</template>
|
|
1005
|
+
</ComponentDemo>
|
|
1006
|
+
|
|
1007
|
+
## Form example
|
|
1008
|
+
|
|
1009
|
+
<ComponentDemo>
|
|
1010
|
+
<div class="maz-max-w-md">
|
|
1011
|
+
<MazPopover position="bottom-start" :close-on-click-outside="false" :close-on-escape="false">
|
|
1012
|
+
<template #trigger>
|
|
1013
|
+
<MazBtn block>
|
|
1014
|
+
<MazIcon name="plus" class="maz-mr-2" />
|
|
1015
|
+
Add Item
|
|
1016
|
+
</MazBtn>
|
|
1017
|
+
</template>
|
|
1018
|
+
<div class="maz-p-4 maz-w-80">
|
|
1019
|
+
<h3 class="maz-text-lg maz-font-semibold maz-mb-4">Add New Item</h3>
|
|
1020
|
+
<form @submit.prevent="handleSubmit" class="maz-space-y-4">
|
|
1021
|
+
<MazInput
|
|
1022
|
+
v-model="formData.name"
|
|
1023
|
+
label="Name"
|
|
1024
|
+
required
|
|
1025
|
+
/>
|
|
1026
|
+
<MazTextarea
|
|
1027
|
+
v-model="formData.description"
|
|
1028
|
+
label="Description"
|
|
1029
|
+
rows="3"
|
|
1030
|
+
/>
|
|
1031
|
+
<div class="maz-flex maz-gap-2">
|
|
1032
|
+
<MazBtn type="submit" color="success" size="sm">
|
|
1033
|
+
Save
|
|
1034
|
+
</MazBtn>
|
|
1035
|
+
<MazBtn type="button" color="transparent" size="sm" @click="resetForm">
|
|
1036
|
+
Reset
|
|
1037
|
+
</MazBtn>
|
|
1038
|
+
</div>
|
|
1039
|
+
</form>
|
|
1040
|
+
</div>
|
|
1041
|
+
</MazPopover>
|
|
1042
|
+
</div>
|
|
1043
|
+
|
|
1044
|
+
<template #code>
|
|
1045
|
+
|
|
1046
|
+
```vue
|
|
1047
|
+
<script setup>
|
|
1048
|
+
import { reactive } from 'vue'
|
|
1049
|
+
|
|
1050
|
+
const formData = reactive({
|
|
1051
|
+
name: '',
|
|
1052
|
+
description: ''
|
|
1053
|
+
})
|
|
1054
|
+
|
|
1055
|
+
function handleSubmit() {
|
|
1056
|
+
console.log('Form submitted:', formData)
|
|
1057
|
+
resetForm()
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
function resetForm() {
|
|
1061
|
+
formData.name = ''
|
|
1062
|
+
formData.description = ''
|
|
1063
|
+
}
|
|
1064
|
+
</script>
|
|
1065
|
+
|
|
1066
|
+
<template>
|
|
1067
|
+
<MazPopover position="bottom-start" :close-on-click-outside="false">
|
|
1068
|
+
<template #trigger>
|
|
1069
|
+
<MazBtn block>
|
|
1070
|
+
<MazIcon name="plus" class="maz-mr-2" />
|
|
1071
|
+
Add Item
|
|
1072
|
+
</MazBtn>
|
|
1073
|
+
</template>
|
|
1074
|
+
<div class="maz-w-80 maz-p-4">
|
|
1075
|
+
<h3 class="maz-mb-4 maz-text-lg maz-font-semibold">
|
|
1076
|
+
Add New Item
|
|
1077
|
+
</h3>
|
|
1078
|
+
<form class="maz-space-y-4" @submit.prevent="handleSubmit">
|
|
1079
|
+
<MazInput
|
|
1080
|
+
v-model="formData.name"
|
|
1081
|
+
label="Name"
|
|
1082
|
+
placeholder="Enter item name"
|
|
1083
|
+
required
|
|
1084
|
+
/>
|
|
1085
|
+
<MazTextarea
|
|
1086
|
+
v-model="formData.description"
|
|
1087
|
+
label="Description"
|
|
1088
|
+
placeholder="Enter description"
|
|
1089
|
+
rows="3"
|
|
1090
|
+
/>
|
|
1091
|
+
<div class="maz-flex maz-gap-2">
|
|
1092
|
+
<MazBtn type="submit" color="success" size="sm">
|
|
1093
|
+
Save
|
|
1094
|
+
</MazBtn>
|
|
1095
|
+
<MazBtn type="button" color="transparent" size="sm" @click="resetForm">
|
|
1096
|
+
Reset
|
|
1097
|
+
</MazBtn>
|
|
1098
|
+
</div>
|
|
1099
|
+
</form>
|
|
1100
|
+
</div>
|
|
1101
|
+
</MazPopover>
|
|
1102
|
+
</template>
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
</template>
|
|
1106
|
+
</ComponentDemo>
|
|
1107
|
+
|
|
1108
|
+
## Configuration options
|
|
1109
|
+
|
|
1110
|
+
<ComponentDemo>
|
|
1111
|
+
<div class="maz-grid maz-grid-cols-1 md:maz-grid-cols-2 maz-gap-4">
|
|
1112
|
+
<div>
|
|
1113
|
+
<h4 class="maz-font-semibold maz-mb-3">Persistent (no auto-close)</h4>
|
|
1114
|
+
<MazPopover persistent>
|
|
1115
|
+
<template #trigger>
|
|
1116
|
+
<MazBtn color="warning">
|
|
1117
|
+
Persistent Popover
|
|
1118
|
+
</MazBtn>
|
|
1119
|
+
</template>
|
|
1120
|
+
<template #default="{ close }">
|
|
1121
|
+
<div class="maz-p-4">
|
|
1122
|
+
<p class="maz-text-sm maz-mb-3">This popover won't close on click outside or ESC.</p>
|
|
1123
|
+
<MazBtn @click="close" size="sm" color="destructive">
|
|
1124
|
+
Close manually
|
|
1125
|
+
</MazBtn>
|
|
1126
|
+
</div>
|
|
1127
|
+
</template>
|
|
1128
|
+
</MazPopover>
|
|
1129
|
+
</div>
|
|
1130
|
+
<div>
|
|
1131
|
+
<h4 class="maz-font-semibold maz-mb-3">Custom offset</h4>
|
|
1132
|
+
<MazPopover :offset="20" position="top">
|
|
1133
|
+
<template #trigger>
|
|
1134
|
+
<MazBtn color="accent">
|
|
1135
|
+
Large Offset
|
|
1136
|
+
</MazBtn>
|
|
1137
|
+
</template>
|
|
1138
|
+
<div class="maz-p-3">
|
|
1139
|
+
<p class="maz-text-sm">20px offset from trigger</p>
|
|
1140
|
+
</div>
|
|
1141
|
+
</MazPopover>
|
|
1142
|
+
</div>
|
|
1143
|
+
<div>
|
|
1144
|
+
<h4 class="maz-font-semibold maz-mb-3">Custom styling</h4>
|
|
1145
|
+
<MazPopover
|
|
1146
|
+
panel-class="maz-bg-gradient-to-r maz-from-purple-500 maz-to-pink-500 maz-text-white maz-border-none"
|
|
1147
|
+
position="bottom"
|
|
1148
|
+
>
|
|
1149
|
+
<template #trigger>
|
|
1150
|
+
<MazBtn color="contrast">
|
|
1151
|
+
Styled Popover
|
|
1152
|
+
</MazBtn>
|
|
1153
|
+
</template>
|
|
1154
|
+
<div class="maz-p-4">
|
|
1155
|
+
<p class="maz-text-sm maz-font-semibold">Beautiful gradient background!</p>
|
|
1156
|
+
</div>
|
|
1157
|
+
</MazPopover>
|
|
1158
|
+
</div>
|
|
1159
|
+
<div>
|
|
1160
|
+
<h4 class="maz-font-semibold maz-mb-3">Disabled state</h4>
|
|
1161
|
+
<MazPopover disabled>
|
|
1162
|
+
<template #trigger>
|
|
1163
|
+
<MazBtn disabled>
|
|
1164
|
+
Disabled Popover
|
|
1165
|
+
</MazBtn>
|
|
1166
|
+
</template>
|
|
1167
|
+
<div class="maz-p-3">
|
|
1168
|
+
<p class="maz-text-sm">This won't show</p>
|
|
1169
|
+
</div>
|
|
1170
|
+
</MazPopover>
|
|
1171
|
+
</div>
|
|
1172
|
+
</div>
|
|
1173
|
+
|
|
1174
|
+
<template #code>
|
|
1175
|
+
|
|
1176
|
+
```vue
|
|
1177
|
+
<template>
|
|
1178
|
+
<!-- Persistent popover -->
|
|
1179
|
+
<MazPopover persistent>
|
|
1180
|
+
<template #trigger>
|
|
1181
|
+
<MazBtn color="warning">
|
|
1182
|
+
Persistent Popover
|
|
1183
|
+
</MazBtn>
|
|
1184
|
+
</template>
|
|
1185
|
+
<div class="maz-p-4">
|
|
1186
|
+
<p class="maz-mb-3 maz-text-sm">
|
|
1187
|
+
This popover won't close on click outside or ESC.
|
|
1188
|
+
</p>
|
|
1189
|
+
<MazBtn size="sm" color="destructive" @click="close">
|
|
1190
|
+
Close manually
|
|
1191
|
+
</MazBtn>
|
|
1192
|
+
</div>
|
|
1193
|
+
</MazPopover>
|
|
1194
|
+
|
|
1195
|
+
<!-- Custom offset -->
|
|
1196
|
+
<MazPopover :offset="20" position="top">
|
|
1197
|
+
<template #trigger>
|
|
1198
|
+
<MazBtn color="accent">
|
|
1199
|
+
Large Offset
|
|
1200
|
+
</MazBtn>
|
|
1201
|
+
</template>
|
|
1202
|
+
<div class="maz-p-3">
|
|
1203
|
+
<p class="maz-text-sm">
|
|
1204
|
+
20px offset from trigger
|
|
1205
|
+
</p>
|
|
1206
|
+
</div>
|
|
1207
|
+
</MazPopover>
|
|
1208
|
+
|
|
1209
|
+
<!-- Custom styling -->
|
|
1210
|
+
<MazPopover
|
|
1211
|
+
panel-class="maz-bg-gradient-to-r maz-from-purple-500 maz-to-pink-500 maz-text-white maz-border-none"
|
|
1212
|
+
position="bottom"
|
|
1213
|
+
>
|
|
1214
|
+
<template #trigger>
|
|
1215
|
+
<MazBtn color="contrast">
|
|
1216
|
+
Styled Popover
|
|
1217
|
+
</MazBtn>
|
|
1218
|
+
</template>
|
|
1219
|
+
<div class="maz-p-4">
|
|
1220
|
+
<p class="maz-text-sm maz-font-semibold">
|
|
1221
|
+
Beautiful gradient background!
|
|
1222
|
+
</p>
|
|
1223
|
+
</div>
|
|
1224
|
+
</MazPopover>
|
|
1225
|
+
|
|
1226
|
+
<!-- Disabled -->
|
|
1227
|
+
<MazPopover disabled>
|
|
1228
|
+
<template #trigger>
|
|
1229
|
+
<MazBtn disabled>
|
|
1230
|
+
Disabled Popover
|
|
1231
|
+
</MazBtn>
|
|
1232
|
+
</template>
|
|
1233
|
+
<div class="maz-p-3">
|
|
1234
|
+
<p class="maz-text-sm">
|
|
1235
|
+
This won't show
|
|
1236
|
+
</p>
|
|
1237
|
+
</div>
|
|
1238
|
+
</MazPopover>
|
|
1239
|
+
</template>
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
</template>
|
|
1243
|
+
</ComponentDemo>
|
|
1244
|
+
|
|
1245
|
+
## Events
|
|
1246
|
+
|
|
1247
|
+
<ComponentDemo>
|
|
1248
|
+
<div class="maz-flex maz-flex-col maz-gap-4">
|
|
1249
|
+
<MazPopover
|
|
1250
|
+
@open="onOpen"
|
|
1251
|
+
@close="onClose"
|
|
1252
|
+
@toggle="onToggle"
|
|
1253
|
+
>
|
|
1254
|
+
<template #trigger>
|
|
1255
|
+
<MazBtn>
|
|
1256
|
+
Event Example
|
|
1257
|
+
</MazBtn>
|
|
1258
|
+
</template>
|
|
1259
|
+
<div class="maz-p-4">
|
|
1260
|
+
<p class="maz-text-sm">Check the console for events!</p>
|
|
1261
|
+
</div>
|
|
1262
|
+
</MazPopover>
|
|
1263
|
+
<div class="maz-p-4 maz-bg-surface-400 maz-rounded maz-text-sm">
|
|
1264
|
+
<h4 class="maz-font-semibold maz-mb-2">Event Log:</h4>
|
|
1265
|
+
<div v-if="events.length === 0" class="maz-text-muted">
|
|
1266
|
+
No events yet. Try opening the popover above.
|
|
1267
|
+
</div>
|
|
1268
|
+
<div v-for="(event, index) in events" :key="index" class="maz-mb-1">
|
|
1269
|
+
<span class="maz-font-mono maz-text-primary">{{ event.type }}</span>
|
|
1270
|
+
<span class="maz-text-muted maz-ml-2">{{ event.time }}</span>
|
|
1271
|
+
</div>
|
|
1272
|
+
</div>
|
|
1273
|
+
</div>
|
|
1274
|
+
|
|
1275
|
+
<template #code>
|
|
1276
|
+
|
|
1277
|
+
```vue
|
|
1278
|
+
<script setup>
|
|
1279
|
+
import { ref } from 'vue'
|
|
1280
|
+
|
|
1281
|
+
const events = ref([])
|
|
1282
|
+
|
|
1283
|
+
function onOpen() {
|
|
1284
|
+
console.log('Popover opened')
|
|
1285
|
+
events.value.push({
|
|
1286
|
+
type: 'open',
|
|
1287
|
+
time: new Date().toLocaleTimeString()
|
|
1288
|
+
})
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function onClose() {
|
|
1292
|
+
console.log('Popover closed')
|
|
1293
|
+
events.value.push({
|
|
1294
|
+
type: 'close',
|
|
1295
|
+
time: new Date().toLocaleTimeString()
|
|
1296
|
+
})
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
function onToggle(isOpen) {
|
|
1300
|
+
console.log('Popover toggled:', isOpen)
|
|
1301
|
+
events.value.push({
|
|
1302
|
+
type: `toggle (${isOpen ? 'open' : 'close'})`,
|
|
1303
|
+
time: new Date().toLocaleTimeString()
|
|
1304
|
+
})
|
|
1305
|
+
}
|
|
1306
|
+
</script>
|
|
1307
|
+
|
|
1308
|
+
<template>
|
|
1309
|
+
<MazPopover
|
|
1310
|
+
@open="onOpen"
|
|
1311
|
+
@close="onClose"
|
|
1312
|
+
@toggle="onToggle"
|
|
1313
|
+
>
|
|
1314
|
+
<template #trigger>
|
|
1315
|
+
<MazBtn>
|
|
1316
|
+
Event Example
|
|
1317
|
+
</MazBtn>
|
|
1318
|
+
</template>
|
|
1319
|
+
<div class="maz-p-4">
|
|
1320
|
+
<p class="maz-text-sm">
|
|
1321
|
+
Check the console for events!
|
|
1322
|
+
</p>
|
|
1323
|
+
</div>
|
|
1324
|
+
</MazPopover>
|
|
1325
|
+
</template>
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
</template>
|
|
1329
|
+
</ComponentDemo>
|
|
1330
|
+
|
|
1331
|
+
## Position values
|
|
1332
|
+
|
|
1333
|
+
- `auto` - Automatically choose best position
|
|
1334
|
+
- `top`, `bottom`, `left`, `right` - Basic positions
|
|
1335
|
+
- `top-start`, `top-end` - Top with start/end alignment
|
|
1336
|
+
- `bottom-start`, `bottom-end` - Bottom with start/end alignment
|
|
1337
|
+
- `left-start`, `left-end` - Left with start/end alignment
|
|
1338
|
+
- `right-start`, `right-end` - Right with start/end alignment
|
|
1339
|
+
|
|
1340
|
+
## Accessibility
|
|
1341
|
+
|
|
1342
|
+
MazPopover follows WAI-ARIA guidelines:
|
|
1343
|
+
|
|
1344
|
+
- **Focus management**: Automatically manages focus when opening/closing
|
|
1345
|
+
- **Keyboard navigation**: Supports Escape key and Tab navigation
|
|
1346
|
+
- **ARIA attributes**: Proper `role`, `aria-modal`, `aria-labelledby`, etc.
|
|
1347
|
+
- **Screen reader support**: Appropriate roles for different use cases
|
|
1348
|
+
|
|
1349
|
+
### Best practices
|
|
1350
|
+
|
|
1351
|
+
- Use `role="tooltip"` for simple informational overlays
|
|
1352
|
+
- Use `role="dialog"` for interactive content
|
|
1353
|
+
- Provide meaningful `aria-labelledby` or `aria-describedby` attributes
|
|
1354
|
+
- Ensure trigger elements are focusable and have proper labels
|
|
1355
|
+
|
|
1356
|
+
<script setup>
|
|
1357
|
+
import { ref, reactive } from 'vue'
|
|
1358
|
+
import MazPopover from 'maz-ui/src/components/MazPopover.vue'
|
|
1359
|
+
import { MazInformationCircle, MazEllipsisVertical } from '@maz-ui/icons/src/index.js'
|
|
1360
|
+
|
|
1361
|
+
const isOpen = ref(false)
|
|
1362
|
+
const events = ref([])
|
|
1363
|
+
|
|
1364
|
+
const formData = reactive({
|
|
1365
|
+
name: '',
|
|
1366
|
+
description: ''
|
|
1367
|
+
})
|
|
1368
|
+
|
|
1369
|
+
const menuItems = [
|
|
1370
|
+
{ label: 'Profile', icon: 'user', action: 'profile' },
|
|
1371
|
+
{ label: 'Settings', icon: 'cog-6-tooth', action: 'settings' },
|
|
1372
|
+
{ label: 'Sign out', icon: 'arrow-right-on-rectangle', action: 'signout' }
|
|
1373
|
+
]
|
|
1374
|
+
|
|
1375
|
+
function handleMenuClick(action) {
|
|
1376
|
+
console.log('Menu action:', action)
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
function handleSubmit() {
|
|
1380
|
+
console.log('Form submitted:', formData)
|
|
1381
|
+
resetForm()
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
function resetForm() {
|
|
1385
|
+
formData.name = ''
|
|
1386
|
+
formData.description = ''
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
function onOpen() {
|
|
1390
|
+
console.log('Popover opened')
|
|
1391
|
+
events.value.push({
|
|
1392
|
+
type: 'open',
|
|
1393
|
+
time: new Date().toLocaleTimeString()
|
|
1394
|
+
})
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function onClose() {
|
|
1398
|
+
console.log('Popover closed')
|
|
1399
|
+
events.value.push({
|
|
1400
|
+
type: 'close',
|
|
1401
|
+
time: new Date().toLocaleTimeString()
|
|
1402
|
+
})
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function onToggle(isOpenValue) {
|
|
1406
|
+
console.log('Popover toggled:', isOpenValue)
|
|
1407
|
+
events.value.push({
|
|
1408
|
+
type: `toggle (${isOpenValue ? 'open' : 'close'})`,
|
|
1409
|
+
time: new Date().toLocaleTimeString()
|
|
1410
|
+
})
|
|
1411
|
+
}
|
|
1412
|
+
</script>
|
|
1413
|
+
|
|
1414
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-popover.doc.md-->
|