@maz-ui/mcp 5.0.0-beta.5 → 5.0.0-beta.51
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-phone-number.doc.md +43 -42
- 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 +39 -20
- 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-select-country.doc.md +27 -26
- 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-virtualizer.doc.md +20 -0
- package/docs/generated-docs/maz-table.doc.md +43 -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-checklist.md +10 -10
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-date-picker.md +55 -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 +16 -5
- package/docs/src/components/maz-input-phone-number.md +30 -0
- 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 +176 -17
- package/docs/src/components/maz-select-country.md +138 -1
- package/docs/src/components/maz-sidebar.md +719 -0
- package/docs/src/components/maz-table.md +156 -1
- 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 +297 -16
- package/docs/src/composables/use-pull-to-refresh.md +79 -0
- 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 +102 -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 +102 -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 +211 -15
- package/docs/src/guide/resolvers.md +8 -8
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/vue.md +4 -4
- package/docs/src/index.md +13 -13
- package/docs/src/plugins/aos.md +1 -1
- package/package.json +11 -10
- 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
|
@@ -19,6 +19,8 @@ description: MazTable is designed to be a reusable data table with advanced feat
|
|
|
19
19
|
4. Row Selection (prop `select-value="key"`): There is a dedicated column for selection with a checkbox for each row. Users can individually or collectively select/deselect rows.
|
|
20
20
|
5. Customizable Page Size: Users can choose the number of items to display per page using a dropdown list.
|
|
21
21
|
6. Loading Indicator (prop `loading`): A loading indicator (MazLoadingBar) is displayed when data is being loaded.
|
|
22
|
+
7. Animated rows (props `animated-rows` + `row-key`): rows slide to their new position when the order changes (FLIP animation). Respects `prefers-reduced-motion`.
|
|
23
|
+
8. Virtualization (prop `virtualized`): render only the rows visible in the viewport (plus an overscan) so the table stays fast with thousands of rows.
|
|
22
24
|
|
|
23
25
|
## Available models
|
|
24
26
|
|
|
@@ -155,7 +157,7 @@ v-model:page-size="{{pageSize ?? 'undefined'}}"
|
|
|
155
157
|
</template>
|
|
156
158
|
<template #cell-name="{ row, value }">
|
|
157
159
|
<div class="maz:flex maz:items-center maz:gap-2">
|
|
158
|
-
<MazAvatar :src="row.logoUrl" size="
|
|
160
|
+
<MazAvatar :src="row.logoUrl" size="mini"></MazAvatar>
|
|
159
161
|
<span>{{value}}</span>
|
|
160
162
|
</div>
|
|
161
163
|
</template>
|
|
@@ -369,6 +371,140 @@ v-model:page-size="{{pageSize ?? 'undefined'}}"
|
|
|
369
371
|
|
|
370
372
|
</ComponentDemo>
|
|
371
373
|
|
|
374
|
+
## Animated rows
|
|
375
|
+
|
|
376
|
+
Enable `animated-rows` to make rows slide to their new position when the order changes (FLIP animation) - perfect for live leaderboards or sortable lists. Provide a stable `row-key` (a field uniquely identifying each row) so every row keeps its identity across reorders. The animation is automatically disabled when the user prefers reduced motion.
|
|
377
|
+
|
|
378
|
+
<ComponentDemo>
|
|
379
|
+
<MazBtn class="vp-raw" size="sm" @click="shuffleRows">Shuffle</MazBtn>
|
|
380
|
+
<br />
|
|
381
|
+
<br />
|
|
382
|
+
<MazTable
|
|
383
|
+
class="vp-raw"
|
|
384
|
+
size="sm"
|
|
385
|
+
animated-rows
|
|
386
|
+
row-key="id"
|
|
387
|
+
:headers="[
|
|
388
|
+
{ label: '#', key: 'id', align: 'center', width: '3rem' },
|
|
389
|
+
{ label: 'Name', key: 'name' },
|
|
390
|
+
{ label: 'Score', key: 'score', align: 'center' },
|
|
391
|
+
]"
|
|
392
|
+
:rows="players"
|
|
393
|
+
/>
|
|
394
|
+
|
|
395
|
+
<template #code>
|
|
396
|
+
|
|
397
|
+
```vue
|
|
398
|
+
<template>
|
|
399
|
+
<MazBtn @click="shuffleRows">
|
|
400
|
+
Shuffle
|
|
401
|
+
</MazBtn>
|
|
402
|
+
<MazTable
|
|
403
|
+
animated-rows
|
|
404
|
+
row-key="id"
|
|
405
|
+
:headers="[
|
|
406
|
+
{ label: '#', key: 'id', align: 'center', width: '3rem' },
|
|
407
|
+
{ label: 'Name', key: 'name' },
|
|
408
|
+
{ label: 'Score', key: 'score', align: 'center' },
|
|
409
|
+
]"
|
|
410
|
+
:rows="players"
|
|
411
|
+
/>
|
|
412
|
+
</template>
|
|
413
|
+
|
|
414
|
+
<script lang="ts" setup>
|
|
415
|
+
import { MazTable } from 'maz-ui/components'
|
|
416
|
+
import { ref } from 'vue'
|
|
417
|
+
|
|
418
|
+
const players = ref([
|
|
419
|
+
{ id: 1, name: 'John', score: 12 },
|
|
420
|
+
{ id: 2, name: 'Jane', score: 24 },
|
|
421
|
+
{ id: 3, name: 'Alice', score: 8 },
|
|
422
|
+
{ id: 4, name: 'Bob', score: 31 },
|
|
423
|
+
])
|
|
424
|
+
|
|
425
|
+
function shuffleRows() {
|
|
426
|
+
players.value = [...players.value].sort(() => Math.random() - 0.5)
|
|
427
|
+
}
|
|
428
|
+
</script>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
</template>
|
|
432
|
+
|
|
433
|
+
</ComponentDemo>
|
|
434
|
+
|
|
435
|
+
## Virtualization
|
|
436
|
+
|
|
437
|
+
Enable `virtualized` to render only the rows inside the viewport (plus an overscan) instead of every row. This keeps the table fast and the DOM light even with tens of thousands of rows. It works in `rows` mode (data-driven), and `@tanstack/vue-virtual` is loaded on demand - pages that never virtualize a table never ship it.
|
|
438
|
+
|
|
439
|
+
The example below renders **10 000 rows** but only keeps ~20 `<tr>` in the DOM at any time.
|
|
440
|
+
|
|
441
|
+
<ComponentDemo>
|
|
442
|
+
<MazTable
|
|
443
|
+
class="vp-raw"
|
|
444
|
+
size="sm"
|
|
445
|
+
virtualized
|
|
446
|
+
max-height="300px"
|
|
447
|
+
:estimated-row-height="38"
|
|
448
|
+
:headers="[
|
|
449
|
+
{ label: '#', key: 'id', width: '5rem' },
|
|
450
|
+
{ label: 'Name', key: 'name', width: '12rem' },
|
|
451
|
+
{ label: 'Email', key: 'email' },
|
|
452
|
+
{ label: 'Score', key: 'score', align: 'center', width: '6rem' },
|
|
453
|
+
]"
|
|
454
|
+
:rows="virtualizedRows"
|
|
455
|
+
/>
|
|
456
|
+
|
|
457
|
+
<template #code>
|
|
458
|
+
|
|
459
|
+
```vue
|
|
460
|
+
<template>
|
|
461
|
+
<MazTable
|
|
462
|
+
virtualized
|
|
463
|
+
max-height="400px"
|
|
464
|
+
:estimated-row-height="38"
|
|
465
|
+
:headers="[
|
|
466
|
+
{ label: '#', key: 'id', width: '5rem' },
|
|
467
|
+
{ label: 'Name', key: 'name', width: '12rem' },
|
|
468
|
+
{ label: 'Email', key: 'email' },
|
|
469
|
+
{ label: 'Score', key: 'score', align: 'center', width: '6rem' },
|
|
470
|
+
]"
|
|
471
|
+
:rows="rows"
|
|
472
|
+
/>
|
|
473
|
+
</template>
|
|
474
|
+
|
|
475
|
+
<script lang="ts" setup>
|
|
476
|
+
import { MazTable } from 'maz-ui/components'
|
|
477
|
+
|
|
478
|
+
// 10 000 rows - only the visible window is rendered to the DOM
|
|
479
|
+
const rows = Array.from({ length: 10_000 }, (_, i) => ({
|
|
480
|
+
id: i + 1,
|
|
481
|
+
name: `User ${i + 1}`,
|
|
482
|
+
email: `user${i + 1}@maz-ui.com`,
|
|
483
|
+
score: Math.round(Math.random() * 100),
|
|
484
|
+
}))
|
|
485
|
+
</script>
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
</template>
|
|
489
|
+
|
|
490
|
+
</ComponentDemo>
|
|
491
|
+
|
|
492
|
+
### Options
|
|
493
|
+
|
|
494
|
+
| Prop | Default | Description |
|
|
495
|
+
| --- | --- | --- |
|
|
496
|
+
| `virtualized` | `false` | Turns virtualization on. |
|
|
497
|
+
| `max-height` | - | **Required.** Bounds the scroll viewport (any CSS length, e.g. `'400px'`, `'70vh'`). Scrolling is enabled automatically and the header stays sticky. |
|
|
498
|
+
| `estimated-row-height` | `44` | Fixed row height (in px) used to place rows and size the spacers. Set it to your real row height; virtualized rows should be uniform (single line). |
|
|
499
|
+
| `overscan` | `10` | Rows rendered outside the viewport on each side. |
|
|
500
|
+
|
|
501
|
+
### Good to know
|
|
502
|
+
|
|
503
|
+
* **Set a `width` (or `minWidth`) on your headers.** Virtualization forces `table-layout: fixed` so columns stay aligned across the rendered window; without widths the browser distributes them equally.
|
|
504
|
+
* **Accessibility:** the table exposes `aria-rowcount` and each rendered row an `aria-rowindex`, so screen readers still announce "row X of N".
|
|
505
|
+
* **Ignored** (with a dev warning) when `animated-rows` is enabled or when you provide a custom default slot - those paths render every row.
|
|
506
|
+
* **Rendered client-side:** the virtualized body is empty during SSR and fills in on hydration.
|
|
507
|
+
|
|
372
508
|
## Loading
|
|
373
509
|
|
|
374
510
|
Enable the loading state with the prop `loading`
|
|
@@ -516,6 +652,24 @@ Available sizes: `'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'`
|
|
|
516
652
|
const searchQuery = ref<string>()
|
|
517
653
|
const pageSize = ref<number>(10)
|
|
518
654
|
const page = ref<number>(1)
|
|
655
|
+
|
|
656
|
+
const players = ref([
|
|
657
|
+
{ id: 1, name: 'John', score: 12 },
|
|
658
|
+
{ id: 2, name: 'Jane', score: 24 },
|
|
659
|
+
{ id: 3, name: 'Alice', score: 8 },
|
|
660
|
+
{ id: 4, name: 'Bob', score: 31 },
|
|
661
|
+
])
|
|
662
|
+
|
|
663
|
+
function shuffleRows() {
|
|
664
|
+
players.value = [...players.value].sort(() => Math.random() - 0.5)
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const virtualizedRows = Array.from({ length: 10_000 }, (_, i) => ({
|
|
668
|
+
id: i + 1,
|
|
669
|
+
name: `User ${i + 1}`,
|
|
670
|
+
email: `user${i + 1}@maz-ui.com`,
|
|
671
|
+
score: Math.round(Math.random() * 100),
|
|
672
|
+
}))
|
|
519
673
|
</script>
|
|
520
674
|
|
|
521
675
|
## Types
|
|
@@ -545,6 +699,7 @@ export interface MazTableHeadersEnriched {
|
|
|
545
699
|
srOnly?: boolean
|
|
546
700
|
width?: string
|
|
547
701
|
maxWidth?: string
|
|
702
|
+
minWidth?: string
|
|
548
703
|
classes?: ThHTMLAttributes['class']
|
|
549
704
|
scope?: ThHTMLAttributes['scope']
|
|
550
705
|
align?: ThHTMLAttributes['align']
|
|
@@ -182,17 +182,124 @@ You can choose the name of this query parameter with the props `query-param` `@d
|
|
|
182
182
|
]
|
|
183
183
|
|
|
184
184
|
const tabs2: MazTabsBarItem[] = ['First Tab', 'Second Tab', 'Third Tab', 'Fourth Tab', 'Fifth Tab', 'Sixth Tab', 'Seventh Tab', 'Eighth Tab', 'Ninth Tab', 'Tenth Tab']
|
|
185
|
+
|
|
186
|
+
const standaloneModel = ref('weekly')
|
|
187
|
+
|
|
188
|
+
const standaloneItems = [
|
|
189
|
+
{ label: 'Daily', value: 'daily' },
|
|
190
|
+
{ label: 'Weekly', value: 'weekly' },
|
|
191
|
+
{ label: 'Monthly', value: 'monthly' },
|
|
192
|
+
]
|
|
185
193
|
</script>
|
|
186
194
|
|
|
195
|
+
## Size and rounded size
|
|
196
|
+
|
|
197
|
+
Each tab is rendered with a [`MazBtn`](./maz-btn.md), so you can control its `size` (`MazSize`) and `rounded-size` (`MazRoundedSize`, applied to the bar, the indicator and each tab).
|
|
198
|
+
|
|
199
|
+
These props can be set on `MazTabsBar` directly, or on `MazTabs` which forwards them to its `MazTabsBar`. They are also globalizable through the [global defaults](./../guide/global-defaults.md) (`MazTabsBar` or `global` entry).
|
|
200
|
+
|
|
201
|
+
<MazTabs size="sm" rounded-size="lg">
|
|
202
|
+
<MazTabsBar :items="tabs2" />
|
|
203
|
+
</MazTabs>
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<template>
|
|
207
|
+
<!-- size & rounded-size forwarded from MazTabs to MazTabsBar -->
|
|
208
|
+
<MazTabs size="sm" rounded-size="lg">
|
|
209
|
+
<MazTabsBar :items="tabs" />
|
|
210
|
+
<!-- ... -->
|
|
211
|
+
</MazTabs>
|
|
212
|
+
|
|
213
|
+
<!-- or directly on MazTabsBar -->
|
|
214
|
+
<MazTabsBar :items="tabs" size="lg" rounded-size="full" />
|
|
215
|
+
</template>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Each item can also override the `size` and `rounded-size` (and accepts every other [`MazBtn`](./maz-btn.md) prop, except `active`, `block`, `type`, `loading` and `fab`).
|
|
219
|
+
|
|
220
|
+
## Active color
|
|
221
|
+
|
|
222
|
+
The active tab is highlighted by the indicator. Use the `color` prop (`MazColor`) on `MazTabsBar` (or on `MazTabs`, which forwards it) to color it. When omitted, the default neutral indicator is used.
|
|
223
|
+
|
|
224
|
+
<MazTabs>
|
|
225
|
+
<MazTabsBar :items="tabs2" color="primary" />
|
|
226
|
+
</MazTabs>
|
|
227
|
+
|
|
228
|
+
```vue
|
|
229
|
+
<template>
|
|
230
|
+
<MazTabsBar :items="tabs" color="primary" />
|
|
231
|
+
</template>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Standalone usage
|
|
235
|
+
|
|
236
|
+
`MazTabsBar` can be used on its own, without `MazTabs`, as an independent switcher with its own `v-model`.
|
|
237
|
+
|
|
238
|
+
::: tip Nested inside a `MazTabs`
|
|
239
|
+
If your page is already wrapped by a `MazTabs`, a nested `MazTabsBar` would otherwise be linked to that parent (clicking a tab would change the page). Add the `standalone` prop to make it fully independent (it then ignores the parent's selection, size, rounded-size and color):
|
|
240
|
+
|
|
241
|
+
```vue
|
|
242
|
+
<MazTabsBar v-model="selected" :items="items" standalone />
|
|
243
|
+
```
|
|
244
|
+
:::
|
|
245
|
+
|
|
246
|
+
The model returns the `1`-based index of the selected tab, unless the items provide a `value` (`string | number`), in which case that value is returned. The model type is inferred from the items passed: declare the items `as const` (or with literal `value`s) to get a strict union type for the model and the `@update:model-value` event.
|
|
247
|
+
|
|
248
|
+
<MazTabsBar v-model="standaloneModel" :items="standaloneItems" color="secondary" rounded-size="full" />
|
|
249
|
+
|
|
250
|
+
<br />
|
|
251
|
+
|
|
252
|
+
<p>Selected value: <strong>{{ standaloneModel }}</strong></p>
|
|
253
|
+
|
|
254
|
+
```vue
|
|
255
|
+
<script lang="ts" setup>
|
|
256
|
+
import { MazTabsBar, type MazTabsBarItem } from 'maz-ui/components'
|
|
257
|
+
import { ref } from 'vue'
|
|
258
|
+
|
|
259
|
+
const selected = ref('weekly')
|
|
260
|
+
|
|
261
|
+
const items = [
|
|
262
|
+
{ label: 'Daily', value: 'daily' },
|
|
263
|
+
{ label: 'Weekly', value: 'weekly' },
|
|
264
|
+
{ label: 'Monthly', value: 'monthly' },
|
|
265
|
+
] as const satisfies readonly MazTabsBarItem[]
|
|
266
|
+
</script>
|
|
267
|
+
|
|
268
|
+
<template>
|
|
269
|
+
<MazTabsBar v-model="selected" :items="items" color="secondary" rounded-size="full" />
|
|
270
|
+
<!-- selected & @update:model-value === 'daily' | 'weekly' | 'monthly' -->
|
|
271
|
+
</template>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
When no `value` is set on the items, the model is a number (the `1`-based index):
|
|
275
|
+
|
|
276
|
+
```vue
|
|
277
|
+
<script lang="ts" setup>
|
|
278
|
+
const selected = ref(1)
|
|
279
|
+
const items = ['First', 'Second', 'Third']
|
|
280
|
+
</script>
|
|
281
|
+
|
|
282
|
+
<template>
|
|
283
|
+
<MazTabsBar v-model="selected" :items="items" />
|
|
284
|
+
<!-- selected === 1 | 2 | 3 -->
|
|
285
|
+
</template>
|
|
286
|
+
```
|
|
287
|
+
|
|
187
288
|
## Types
|
|
188
289
|
|
|
189
290
|
```ts
|
|
190
|
-
type MazTabsBarItem
|
|
191
|
-
|
|
291
|
+
type MazTabsBarItem<Value extends string | number = string | number>
|
|
292
|
+
// Inherits all MazBtn props except 'active' | 'block' | 'type' | 'loading' | 'fab'
|
|
293
|
+
= | (Omit<MazBtnProps, 'active' | 'block' | 'type' | 'loading' | 'fab'> & {
|
|
192
294
|
/**
|
|
193
295
|
* Label of the tab
|
|
194
296
|
*/
|
|
195
297
|
label: string
|
|
298
|
+
/**
|
|
299
|
+
* Value returned by the model when the tab is selected (standalone usage).
|
|
300
|
+
* When omitted, the model returns the 1-based index of the tab.
|
|
301
|
+
*/
|
|
302
|
+
value?: Value
|
|
196
303
|
/**
|
|
197
304
|
* Will disable the tab
|
|
198
305
|
* @default false
|
|
@@ -208,7 +315,7 @@ type MazTabsBarItem
|
|
|
208
315
|
*/
|
|
209
316
|
content: string | number | boolean
|
|
210
317
|
}
|
|
211
|
-
}
|
|
318
|
+
})
|
|
212
319
|
| string
|
|
213
320
|
```
|
|
214
321
|
|
|
@@ -303,6 +303,64 @@ By default, the textarea automatically expands as the user types. You can disabl
|
|
|
303
303
|
</template>
|
|
304
304
|
</ComponentDemo>
|
|
305
305
|
|
|
306
|
+
## Minimum rows (compact / input-like)
|
|
307
|
+
|
|
308
|
+
Use the `min-rows` prop to control the initial (minimum) height of the textarea. It defaults to `3` lines. Set it to `1` to make the textarea start at the height of a regular input while keeping the autogrow behavior: it grows line by line as the user types.
|
|
309
|
+
|
|
310
|
+
<ComponentDemo>
|
|
311
|
+
<MazTextarea
|
|
312
|
+
v-model="value"
|
|
313
|
+
name="comment"
|
|
314
|
+
:min-rows="1"
|
|
315
|
+
rounded-size="xl"
|
|
316
|
+
placeholder="Send your message"
|
|
317
|
+
/>
|
|
318
|
+
|
|
319
|
+
<template #code>
|
|
320
|
+
|
|
321
|
+
```vue
|
|
322
|
+
<template>
|
|
323
|
+
<MazTextarea
|
|
324
|
+
v-model="value"
|
|
325
|
+
name="comment"
|
|
326
|
+
:min-rows="1"
|
|
327
|
+
rounded-size="xl"
|
|
328
|
+
placeholder="Send your message"
|
|
329
|
+
/>
|
|
330
|
+
</template>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
</template>
|
|
334
|
+
</ComponentDemo>
|
|
335
|
+
|
|
336
|
+
## Sizes
|
|
337
|
+
|
|
338
|
+
The `size` prop controls the padding (height) and text size of the textarea, mirroring the `MazInput` sizes (`mini`, `xs`, `sm`, `md`, `lg`, `xl`). Combined with `:min-rows="1"`, a given size matches the height of a `MazInput` of the same size, while keeping the autogrow behavior.
|
|
339
|
+
|
|
340
|
+
<ComponentDemo>
|
|
341
|
+
<div class="maz:flex maz:flex-col maz:gap-4">
|
|
342
|
+
<MazTextarea v-model="value" name="comment" size="xs" :min-rows="1" placeholder="Size xs" />
|
|
343
|
+
<MazTextarea v-model="value" name="comment" size="sm" :min-rows="1" placeholder="Size sm" />
|
|
344
|
+
<MazTextarea v-model="value" name="comment" size="md" :min-rows="1" placeholder="Size md" />
|
|
345
|
+
<MazTextarea v-model="value" name="comment" size="lg" :min-rows="1" placeholder="Size lg" />
|
|
346
|
+
<MazTextarea v-model="value" name="comment" size="xl" :min-rows="1" placeholder="Size xl" />
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<template #code>
|
|
350
|
+
|
|
351
|
+
```vue
|
|
352
|
+
<template>
|
|
353
|
+
<MazTextarea v-model="value" name="comment" size="xs" :min-rows="1" placeholder="Size xs" />
|
|
354
|
+
<MazTextarea v-model="value" name="comment" size="sm" :min-rows="1" placeholder="Size sm" />
|
|
355
|
+
<MazTextarea v-model="value" name="comment" size="md" :min-rows="1" placeholder="Size md" />
|
|
356
|
+
<MazTextarea v-model="value" name="comment" size="lg" :min-rows="1" placeholder="Size lg" />
|
|
357
|
+
<MazTextarea v-model="value" name="comment" size="xl" :min-rows="1" placeholder="Size xl" />
|
|
358
|
+
</template>
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
</template>
|
|
362
|
+
</ComponentDemo>
|
|
363
|
+
|
|
306
364
|
## Disabled
|
|
307
365
|
|
|
308
366
|
<ComponentDemo>
|
|
@@ -9,6 +9,21 @@ description: MazTimeline is a step/progress timeline component for Vue 3 with su
|
|
|
9
9
|
|
|
10
10
|
<!--@include: ./../../.vitepress/mixins/getting-started.md-->
|
|
11
11
|
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Control the current step:
|
|
15
|
+
|
|
16
|
+
<MazRadioButtons
|
|
17
|
+
:model-value="currentStep"
|
|
18
|
+
size="sm"
|
|
19
|
+
:options="[
|
|
20
|
+
{ label: 'None', value: -1 },
|
|
21
|
+
...steps.map((step, index) => ({ label: index, value: index })),
|
|
22
|
+
{ label: 'All Completed', value: 99 },
|
|
23
|
+
]"
|
|
24
|
+
@update:model-value="currentStep = $event"
|
|
25
|
+
/>
|
|
26
|
+
|
|
12
27
|
## Basic usage
|
|
13
28
|
|
|
14
29
|
<ComponentDemo>
|
|
@@ -292,6 +307,40 @@ Customize the indicator border radius with the `rounded-size` prop.
|
|
|
292
307
|
</template>
|
|
293
308
|
</ComponentDemo>
|
|
294
309
|
|
|
310
|
+
## Custom Icons
|
|
311
|
+
|
|
312
|
+
<ComponentDemo>
|
|
313
|
+
<MazTimeline :model-value="0" :steps="iconsSteps" direction="horizontal" size="lg" />
|
|
314
|
+
|
|
315
|
+
<template #code>
|
|
316
|
+
|
|
317
|
+
```vue
|
|
318
|
+
<template>
|
|
319
|
+
<MazTimeline
|
|
320
|
+
v-model="currentStep"
|
|
321
|
+
:steps="steps"
|
|
322
|
+
size="lg"
|
|
323
|
+
/>
|
|
324
|
+
</template>
|
|
325
|
+
|
|
326
|
+
<script lang="ts" setup>
|
|
327
|
+
import { MazCommandLine } from '@maz-ui/icons/MazCommandLine'
|
|
328
|
+
import { MazClipboardDocumentList } from '@maz-ui/icons/MazClipboardDocumentList'
|
|
329
|
+
import { MazClipboardDocumentCheck } from '@maz-ui/icons/MazClipboardDocumentCheck'
|
|
330
|
+
import { MazComputerDesktop } from '@maz-ui/icons/MazComputerDesktop'
|
|
331
|
+
|
|
332
|
+
const iconsSteps = [
|
|
333
|
+
{ title: 'PO', subtitle: 'Writing PRD', icon: MazClipboardDocumentList },
|
|
334
|
+
{ title: 'Dev', subtitle: 'Building Code', icon: MazCommandLine },
|
|
335
|
+
{ title: 'Tech Lead', subtitle: 'Review Code', icon: MazComputerDesktop },
|
|
336
|
+
{ title: 'QA', subtitle: 'Testing', icon: MazClipboardDocumentCheck },
|
|
337
|
+
]
|
|
338
|
+
</script>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
</template>
|
|
342
|
+
</ComponentDemo>
|
|
343
|
+
|
|
295
344
|
## Custom slots
|
|
296
345
|
|
|
297
346
|
MazTimeline provides scoped slots for full customization.
|
|
@@ -378,6 +427,10 @@ MazTimeline provides scoped slots for full customization.
|
|
|
378
427
|
|
|
379
428
|
<script lang="ts" setup>
|
|
380
429
|
import { ref } from 'vue'
|
|
430
|
+
import { MazComputerDesktop } from '@maz-ui/icons/MazComputerDesktop'
|
|
431
|
+
import { MazCommandLine } from '@maz-ui/icons/MazCommandLine'
|
|
432
|
+
import { MazClipboardDocumentList } from '@maz-ui/icons/MazClipboardDocumentList'
|
|
433
|
+
import { MazClipboardDocumentCheck } from '@maz-ui/icons/MazClipboardDocumentCheck'
|
|
381
434
|
|
|
382
435
|
const currentStep = ref(1)
|
|
383
436
|
const clickableStep = ref(0)
|
|
@@ -410,6 +463,13 @@ MazTimeline provides scoped slots for full customization.
|
|
|
410
463
|
{ title: 'Complete', subtitle: 'All done!' },
|
|
411
464
|
]
|
|
412
465
|
|
|
466
|
+
const iconsSteps = [
|
|
467
|
+
{ title: 'PO', subtitle: 'Writing PRD', icon: MazClipboardDocumentList },
|
|
468
|
+
{ title: 'Dev', subtitle: 'Building Code', icon: MazCommandLine },
|
|
469
|
+
{ title: 'Tech Lead', subtitle: 'Review Code', icon: MazComputerDesktop },
|
|
470
|
+
{ title: 'QA', subtitle: 'Testing', icon: MazClipboardDocumentCheck },
|
|
471
|
+
]
|
|
472
|
+
|
|
413
473
|
const colors = ['primary', 'secondary', 'info', 'success', 'warning', 'destructive']
|
|
414
474
|
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
415
475
|
const roundedSizes = ['full', 'lg', 'md', 'sm', 'none']
|