@maz-ui/mcp 4.9.3 → 5.0.0-beta.1

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.
Files changed (116) hide show
  1. package/dist/mcp.mjs +1 -1
  2. package/docs/generated-docs/maz-alert.doc.md +1 -1
  3. package/docs/generated-docs/maz-avatar.doc.md +1 -1
  4. package/docs/generated-docs/maz-badge.doc.md +8 -8
  5. package/docs/generated-docs/maz-btn.doc.md +26 -26
  6. package/docs/generated-docs/maz-card.doc.md +19 -19
  7. package/docs/generated-docs/maz-chart.doc.md +8 -8
  8. package/docs/generated-docs/maz-container.doc.md +20 -20
  9. package/docs/generated-docs/maz-drawer.doc.md +8 -8
  10. package/docs/generated-docs/maz-dropdown.doc.md +1 -1
  11. package/docs/generated-docs/maz-dropzone.doc.md +2 -2
  12. package/docs/generated-docs/maz-gallery.doc.md +15 -15
  13. package/docs/generated-docs/maz-icon.doc.md +11 -14
  14. package/docs/generated-docs/maz-input.doc.md +38 -38
  15. package/docs/generated-docs/maz-lazy-img.doc.md +18 -0
  16. package/docs/generated-docs/maz-link.doc.md +9 -9
  17. package/docs/generated-docs/maz-pagination.doc.md +9 -9
  18. package/docs/generated-docs/maz-popover.doc.md +5 -1
  19. package/docs/generated-docs/maz-radio-buttons.doc.md +17 -17
  20. package/docs/generated-docs/maz-select.doc.md +2 -2
  21. package/docs/generated-docs/maz-skeleton.doc.md +10 -10
  22. package/docs/generated-docs/maz-table.doc.md +37 -37
  23. package/docs/generated-docs/maz-textarea.doc.md +1 -1
  24. package/docs/generated-docs/maz-timeline.doc.md +1 -1
  25. package/docs/src/blog/v4.md +7 -7
  26. package/docs/src/blog/v5.md +186 -0
  27. package/docs/src/components/maz-accordion.md +1 -1
  28. package/docs/src/components/maz-alert.md +15 -15
  29. package/docs/src/components/maz-animated-counter.md +4 -4
  30. package/docs/src/components/maz-avatar.md +2 -2
  31. package/docs/src/components/maz-backdrop.md +7 -7
  32. package/docs/src/components/maz-badge.md +16 -34
  33. package/docs/src/components/maz-bottom-sheet.md +74 -74
  34. package/docs/src/components/maz-btn-group.md +17 -17
  35. package/docs/src/components/maz-btn.md +129 -96
  36. package/docs/src/components/maz-card-spotlight.md +5 -5
  37. package/docs/src/components/maz-card.md +20 -20
  38. package/docs/src/components/maz-carousel.md +14 -14
  39. package/docs/src/components/maz-chart.md +23 -4
  40. package/docs/src/components/maz-checkbox.md +3 -3
  41. package/docs/src/components/maz-checklist.md +19 -19
  42. package/docs/src/components/maz-circular-progress-bar.md +4 -4
  43. package/docs/src/components/maz-container.md +52 -37
  44. package/docs/src/components/maz-date-picker.md +7 -7
  45. package/docs/src/components/maz-dialog-confirm.md +2 -2
  46. package/docs/src/components/maz-drawer.md +14 -14
  47. package/docs/src/components/maz-dropdown.md +27 -12
  48. package/docs/src/components/maz-dropzone.md +6 -6
  49. package/docs/src/components/maz-expand-animation.md +2 -2
  50. package/docs/src/components/maz-fullscreen-loader.md +2 -2
  51. package/docs/src/components/maz-gallery.md +1 -1
  52. package/docs/src/components/maz-icon.md +113 -60
  53. package/docs/src/components/maz-input-code.md +1 -1
  54. package/docs/src/components/maz-input-phone-number.md +89 -88
  55. package/docs/src/components/maz-input-tags.md +2 -2
  56. package/docs/src/components/maz-input.md +42 -12
  57. package/docs/src/components/maz-link.md +28 -12
  58. package/docs/src/components/maz-pagination.md +2 -2
  59. package/docs/src/components/maz-popover.md +236 -236
  60. package/docs/src/components/maz-pull-to-refresh.md +2 -2
  61. package/docs/src/components/maz-radio-buttons.md +11 -11
  62. package/docs/src/components/maz-radio.md +3 -3
  63. package/docs/src/components/maz-read-more.md +7 -7
  64. package/docs/src/components/maz-select-country.md +26 -26
  65. package/docs/src/components/maz-select.md +1 -1
  66. package/docs/src/components/maz-skeleton.md +25 -25
  67. package/docs/src/components/maz-spinner.md +2 -2
  68. package/docs/src/components/maz-stepper.md +5 -5
  69. package/docs/src/components/maz-switch.md +1 -1
  70. package/docs/src/components/maz-table.md +10 -10
  71. package/docs/src/components/maz-tabs.md +17 -17
  72. package/docs/src/components/maz-textarea.md +8 -8
  73. package/docs/src/components/maz-ticker.md +37 -37
  74. package/docs/src/components/maz-timeline.md +9 -9
  75. package/docs/src/composables/use-dialog.md +1 -1
  76. package/docs/src/composables/use-display-names.md +2 -2
  77. package/docs/src/composables/use-form-validator.md +35 -35
  78. package/docs/src/composables/use-idle-timeout.md +3 -3
  79. package/docs/src/composables/use-reading-time.md +5 -5
  80. package/docs/src/composables/use-string-matching.md +4 -4
  81. package/docs/src/composables/use-swipe.md +3 -3
  82. package/docs/src/composables/use-timer.md +3 -3
  83. package/docs/src/composables/use-toast.md +1 -1
  84. package/docs/src/composables/use-user-visibility.md +1 -1
  85. package/docs/src/composables/use-wait.md +2 -2
  86. package/docs/src/directives/click-outside.md +17 -17
  87. package/docs/src/directives/lazy-img.md +5 -5
  88. package/docs/src/directives/tooltip.md +15 -15
  89. package/docs/src/directives/zoom-img.md +1 -1
  90. package/docs/src/ecosystem/eslint-config.md +187 -0
  91. package/docs/src/ecosystem/stylelint-config.md +302 -0
  92. package/docs/src/guide/browser-support.md +81 -0
  93. package/docs/src/guide/getting-started.md +23 -16
  94. package/docs/src/guide/icon-set.md +11 -11
  95. package/docs/src/guide/icons.md +32 -5
  96. package/docs/src/guide/maz-ui-provider.md +6 -6
  97. package/docs/src/guide/migration-v4.md +3 -3
  98. package/docs/src/guide/migration-v5.md +662 -0
  99. package/docs/src/guide/nuxt.md +27 -44
  100. package/docs/src/guide/resolvers.md +2 -2
  101. package/docs/src/guide/tailwind.md +154 -0
  102. package/docs/src/guide/themes.md +258 -485
  103. package/docs/src/guide/vue.md +8 -5
  104. package/docs/src/helpers/capitalize.md +4 -4
  105. package/docs/src/helpers/country-code-to-unicode-flag.md +37 -37
  106. package/docs/src/helpers/currency.md +4 -4
  107. package/docs/src/helpers/date.md +4 -4
  108. package/docs/src/helpers/get-country-flag-url.md +9 -9
  109. package/docs/src/helpers/number.md +5 -5
  110. package/docs/src/index.md +296 -266
  111. package/docs/src/made-with-maz-ui.md +5 -5
  112. package/docs/src/plugins/aos.md +6 -6
  113. package/docs/src/plugins/dialog.md +4 -4
  114. package/docs/src/plugins/toast.md +3 -3
  115. package/docs/src/plugins/wait.md +1 -1
  116. package/package.json +5 -5
@@ -16,11 +16,11 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
16
16
  ## Basic usage
17
17
 
18
18
  <ComponentDemo expanded>
19
- <div class="maz-flex maz-flex-col maz-gap-2 maz-flex-center">
19
+ <div class="maz:flex maz:flex-col maz:gap-2 maz:flex-center">
20
20
  <MazBtn @click="isOpenedTop = !isOpenedTop">
21
21
  Open top drawer
22
22
  </MazBtn>
23
- <div class="maz-flex maz-flex-wrap maz-gap-2">
23
+ <div class="maz:flex maz:flex-wrap maz:gap-2">
24
24
  <MazBtn @click="isOpenedLeft = !isOpenedLeft">
25
25
  Open left drawer
26
26
  </MazBtn>
@@ -46,7 +46,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
46
46
  <template #default="{ close }">
47
47
  <div style="padding: 16px">
48
48
  <p>Content</p>
49
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
49
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
50
50
  <MazBtn color="destructive" @click="close"> Close </MazBtn>
51
51
  </div>
52
52
  </div>
@@ -58,31 +58,31 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
58
58
  <template #default="{ close }">
59
59
  <div style="padding: 16px">
60
60
  <p>Content</p>
61
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
61
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
62
62
  <MazBtn color="destructive" @click="close"> Close </MazBtn>
63
63
  </div>
64
64
  </div>
65
65
  </template>
66
66
  </MazDrawer>
67
67
 
68
- <MazDrawer variant="left" v-model="isOpenedLeft">
68
+ <MazDrawer variant="start" v-model="isOpenedLeft">
69
69
  <template #title> Drawer left </template>
70
70
  <template #default="{ close }">
71
71
  <div style="padding: 16px">
72
72
  <p>Content</p>
73
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
73
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
74
74
  <MazBtn color="destructive" @click="close"> Close </MazBtn>
75
75
  </div>
76
76
  </div>
77
77
  </template>
78
78
  </MazDrawer>
79
79
 
80
- <MazDrawer variant="right" v-model="isOpenedRight">
80
+ <MazDrawer variant="end" v-model="isOpenedRight">
81
81
  <template #title> Drawer right </template>
82
82
  <template #default="{ close }">
83
83
  <div style="padding: 16px">
84
84
  <p>Content</p>
85
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
85
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
86
86
  <MazBtn color="destructive" @click="close"> Close </MazBtn>
87
87
  </div>
88
88
  </div>
@@ -102,7 +102,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
102
102
  <p>
103
103
  Content
104
104
  </p>
105
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
105
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
106
106
  <MazBtn color="destructive" @click="close">
107
107
  Close
108
108
  </MazBtn>
@@ -120,7 +120,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
120
120
  <p>
121
121
  Content
122
122
  </p>
123
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
123
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
124
124
  <MazBtn color="destructive" @click="close">
125
125
  Close
126
126
  </MazBtn>
@@ -129,7 +129,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
129
129
  </template>
130
130
  </MazDrawer>
131
131
 
132
- <MazDrawer variant="left" v-model="isOpenedLeft">
132
+ <MazDrawer variant="start" v-model="isOpenedLeft">
133
133
  <template #title>
134
134
  Drawer left
135
135
  </template>
@@ -138,7 +138,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
138
138
  <p>
139
139
  Content
140
140
  </p>
141
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
141
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
142
142
  <MazBtn color="destructive" @click="close">
143
143
  Close
144
144
  </MazBtn>
@@ -147,7 +147,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
147
147
  </template>
148
148
  </MazDrawer>
149
149
 
150
- <MazDrawer variant="right" v-model="isOpenedRight">
150
+ <MazDrawer variant="end" v-model="isOpenedRight">
151
151
  <template #title>
152
152
  Drawer right
153
153
  </template>
@@ -156,7 +156,7 @@ This component uses `<Teleport to="body">` with [MazBackdrop](./maz-backdrop.md)
156
156
  <p>
157
157
  Content
158
158
  </p>
159
- <div class="maz-flex maz-flex-wrap maz-gap-2 maz-mt-4">
159
+ <div class="maz:flex maz:flex-wrap maz:gap-2 maz:mt-4">
160
160
  <MazBtn color="destructive" @click="close">
161
161
  Close
162
162
  </MazBtn>
@@ -194,6 +194,21 @@ You can provide an icon to replace the default chevron icon and disable the anim
194
194
  </template>
195
195
  ```
196
196
 
197
+ `dropdownIcon` also accepts a full `MazIconProps` object — pass the same shape `<MazIcon>` accepts when you need to set a `<title>` for screen readers, override the size, or attach `svgAttributes`.
198
+
199
+ ```vue
200
+ <MazDropdown
201
+ :items="items"
202
+ :dropdown-icon="{
203
+ icon: MazChevronUpDown,
204
+ size: 'lg',
205
+ title: 'Open menu',
206
+ }"
207
+ >
208
+ Custom icon
209
+ </MazDropdown>
210
+ ```
211
+
197
212
  ## Custom dropdown main button without chevron icon
198
213
 
199
214
  ::: tip
@@ -205,7 +220,7 @@ You can provide an icon to replace the default chevron icon and disable the anim
205
220
  fab
206
221
  pastel
207
222
  :chevron="false"
208
- icon="bars-3"
223
+ icon="/bars-3.svg"
209
224
  size="xl"
210
225
  :items="[
211
226
  { label: 'Action', onClick: () => toast.success('CLICKED') },
@@ -221,7 +236,7 @@ You can provide an icon to replace the default chevron icon and disable the anim
221
236
  fab
222
237
  pastel
223
238
  :chevron="false"
224
- icon="bars-3"
239
+ icon="/bars-3.svg"
225
240
  size="xl"
226
241
  :items="[
227
242
  { label: 'Action', onClick: () => toast.success('CLICKED') },
@@ -242,7 +257,7 @@ You can provide a template to replace the default dropdown panel
242
257
  Customized dropdown
243
258
 
244
259
  <template #dropdown>
245
- <div class="maz-grid maz-grid-cols-3 maz-gap-2">
260
+ <div class="maz:grid maz:grid-cols-3 maz:gap-2">
246
261
  <MazBtn color="transparent"> Item </MazBtn>
247
262
  <MazBtn color="transparent"> Item </MazBtn>
248
263
  <MazBtn color="transparent"> Item </MazBtn>
@@ -266,7 +281,7 @@ You can provide a template to replace the default dropdown panel
266
281
  Customized dropdown panel
267
282
 
268
283
  <template #dropdown>
269
- <div class="maz-grid maz-grid-cols-3 maz-gap-2">
284
+ <div class="maz:grid maz:grid-cols-3 maz:gap-2">
270
285
  <MazBtn color="transparent"> Item </MazBtn>
271
286
  <MazBtn color="transparent"> Item </MazBtn>
272
287
  <MazBtn color="transparent"> Item </MazBtn>
@@ -302,7 +317,7 @@ You can provide a template to replace menuitem labels to add more elements in ea
302
317
  </template>
303
318
 
304
319
  <template #menuitem-label="{ item }">
305
- <div class="maz-flex maz-items-center maz-gap-3">
320
+ <div class="maz:flex maz:items-center maz:gap-3">
306
321
  <MazAvatar :src="item.additionnalData" size="0.8rem" />
307
322
  <span>
308
323
  {{ item.label }}
@@ -326,7 +341,7 @@ You can provide a template to replace menuitem labels to add more elements in ea
326
341
  </template>
327
342
 
328
343
  <template #menuitem-label="{ item }">
329
- <div class="maz-flex maz-items-center maz-gap-2">
344
+ <div class="maz:flex maz:items-center maz:gap-2">
330
345
  <MazAvatar :src="item.additionnalData" />
331
346
  <span>
332
347
  {{ item.label }}
@@ -346,7 +361,7 @@ You can provide an HTML element or a component to replace the default button
346
361
  Add `tabindex="-1"` attribute to your element to avoid a double focus with Tab key
347
362
  :::
348
363
 
349
- <div class="maz-flex maz-gap-4">
364
+ <div class="maz:flex maz:gap-4">
350
365
  <MazDropdown
351
366
  :items="[
352
367
  {
@@ -399,7 +414,7 @@ Add `tabindex="-1"` attribute to your element to avoid a double focus with Tab k
399
414
  ]"
400
415
  >
401
416
  <template #element="{ isOpen }">
402
- <button class="maz-border maz-border-solid maz-border-divider-400 maz-p-2 hover:maz-bg-surface-600 dark:maz-bg-surface-400" tabindex="-1">
417
+ <button class="maz:border maz:border-solid maz:border-divider-400 maz:p-2 maz:hover:bg-surface-600 maz:dark:bg-surface-400" tabindex="-1">
403
418
  HTMLButtonElement: isOpen {{ isOpen }}
404
419
  </button>
405
420
  </template>
@@ -461,7 +476,7 @@ Add `tabindex="-1"` attribute to your element to avoid a double focus with Tab k
461
476
  ]"
462
477
  >
463
478
  <template #element="{ isOpen }">
464
- <button class="maz-border maz-border-solid maz-border-divider-400 maz-p-2 hover:maz-bg-surface-400" tabindex="-1">
479
+ <button class="maz:border maz:border-solid maz:border-divider-400 maz:p-2 maz:hover:bg-surface-400" tabindex="-1">
465
480
  HTMLButtonElement: isOpen {{ isOpen }}
466
481
  </button>
467
482
  </template>
@@ -519,7 +534,7 @@ isOpen: {{ isOpen }}
519
534
 
520
535
  ## Position
521
536
 
522
- <div class="maz-flex maz-gap-3 maz-flex-wrap">
537
+ <div class="maz:flex maz:gap-3 maz:flex-wrap">
523
538
  <MazDropdown
524
539
  color="contrast"
525
540
  :items="[
@@ -637,8 +652,8 @@ type MazDropdownMenuItem = {
637
652
 
638
653
  <script lang="ts" setup>
639
654
  import { ref, onMounted } from 'vue'
640
- import { useToast } from 'maz-ui/src/composables/useToast'
641
- import { MazChevronUpDown } from '@maz-ui/icons/MazChevronUpDown'
655
+ import { useToast } from 'maz-ui/composables/useToast'
656
+ import { MazChevronUpDown } from '@maz-ui/icons/raw/MazChevronUpDown'
642
657
 
643
658
  const toast = useToast()
644
659
 
@@ -92,7 +92,7 @@ function handleError({ code, files }) {
92
92
  />
93
93
 
94
94
  <br />
95
- <div class="maz-text-center">
95
+ <div class="maz:text-center">
96
96
  <MazBtn @click="dropzone?.uploadFiles()" :loading="dropzone?.isUploading">
97
97
  Upload Files
98
98
  </MazBtn>
@@ -312,8 +312,8 @@ Customize the upload area using slots:
312
312
  <ComponentDemo>
313
313
  <MazDropzone v-model="files" @error="onError">
314
314
  <template #no-files-area="{ handleFileInputClick }">
315
- <div class="maz-flex maz-flex-col maz-items-center maz-gap-4">
316
- <MazIcon name="arrow-up-on-square" class="maz-text-4xl" />
315
+ <div class="maz:flex maz:flex-col maz:items-center maz:gap-4">
316
+ <MazIcon icon="/arrow-up-on-square.svg" class="maz:text-4xl" />
317
317
  <p>Drop your files here or click to browse</p>
318
318
  <MazBtn @click="handleFileInputClick">
319
319
  Select Files
@@ -327,8 +327,8 @@ Customize the upload area using slots:
327
327
  ```html
328
328
  <MazDropzone v-model="files" @error="onError">
329
329
  <template #no-files-area="{ handleFileInputClick }">
330
- <div class="maz-flex maz-flex-col maz-items-center maz-gap-4">
331
- <MazIcon name="arrow-up-on-square" class="maz-text-4xl" />
330
+ <div class="maz:flex maz:flex-col maz:items-center maz:gap-4">
331
+ <MazIcon icon="/arrow-up-on-square.svg" class="maz:text-4xl" />
332
332
  <p>Drop your files here or click to browse</p>
333
333
  <MazBtn @click="handleFileInputClick"> Select Files </MazBtn>
334
334
  </div>
@@ -455,7 +455,7 @@ Customize the upload request using `uploadUrl`, `requestOptions` and `transformB
455
455
 
456
456
  <script setup lang="ts">
457
457
  import { ref } from 'vue'
458
- import { useToast } from 'maz-ui/src/composables/useToast'
458
+ import { useToast } from 'maz-ui/composables/useToast'
459
459
 
460
460
  const files = ref<File[]>([])
461
461
  const dropzone = ref<InstanceType<typeof MazDropzone>>()
@@ -17,7 +17,7 @@ description: MazExpandAnimation is a standalone component that allows you to ani
17
17
  <br />
18
18
 
19
19
  <MazExpandAnimation v-model="visible">
20
- <div class="maz-pt-4">
20
+ <div class="maz:pt-4">
21
21
  Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
22
22
  Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
23
23
  </div>
@@ -59,7 +59,7 @@ const visible = ref(false)
59
59
  <br />
60
60
 
61
61
  <MazExpandAnimation v-model="visible2" duration="1000ms" timing-function="linear">
62
- <div class="maz-pt-4">
62
+ <div class="maz:pt-4">
63
63
  Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
64
64
  Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
65
65
  </div>
@@ -12,10 +12,10 @@ description: MazFullscreenLoader is a standalone component
12
12
  ## Basic usage
13
13
 
14
14
  <MazFullscreenLoader v-if="showLoader" @click="showLoader = false">
15
- <p class="maz-text-lg maz-text-surface">
15
+ <p class="maz:text-lg maz:text-surface">
16
16
  Loading...
17
17
  </p>
18
- <p class="maz-text-lg maz-text-surface">
18
+ <p class="maz:text-lg maz:text-surface">
19
19
  (click to hide loader)
20
20
  </p>
21
21
  </MazFullscreenLoader>
@@ -42,7 +42,7 @@ const images: MazGalleryImage[] = [
42
42
 
43
43
  <MazGallery
44
44
  :images="images2"
45
- class="maz-h-48 mob-l:maz-h-60 tab-s:maz-h-80"
45
+ class="maz:h-48 maz:mob-l:h-60 maz:tab-s:h-80"
46
46
  :height="false"
47
47
  />
48
48
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: MazIcon
3
- description: MazIcon is a standalone component to load your svg files
3
+ description: A flexible icon component that accepts Vue components, raw SVG strings, URLs and data URIs.
4
4
  ---
5
5
 
6
6
  # {{ $frontmatter.title }}
@@ -8,27 +8,35 @@ description: MazIcon is a standalone component to load your svg files
8
8
  {{ $frontmatter.description }}
9
9
 
10
10
  ::: tip
11
- Download icons pack [here](#get-icons-pack)
11
+ Download the bundled [icons pack](#all-bundled-icons) or use [`@maz-ui/icons`](../guide/icons.md) for the full set.
12
12
  :::
13
13
 
14
- ## How to use?
14
+ ## How it works
15
15
 
16
- **2 ways to use this component:**
16
+ Pass an `icon` prop in any of the supported formats — the component detects what it received and renders accordingly:
17
17
 
18
- - Use a component (like `MazStar` exported from `@maz-ui/icons`) with `icon` prop
19
- - Use a name (like `academic-cap`) with `name` prop or `src` prop (e.g: `src="/path/icon.svg"`)
18
+ | Input | Example | Use it for |
19
+ | --- | --- | --- |
20
+ | **Vue component** | `import { MazStar } from '@maz-ui/icons/static/MazStar'` | Always-rendered icons that you also want available as a standalone component (`<MazStar />`). |
21
+ | **Raw SVG string** | `import { MazStar } from '@maz-ui/icons/raw/MazStar'` | Always-rendered icons — the lightest format, no Vue component overhead. |
22
+ | **URL or `data:` URI** | `'/icons/star.svg'`, `'data:image/svg+xml,…'` | SVGs hosted in your `public/` folder or external CDN. Fetched and cached on demand. |
20
23
 
21
- ## Example
22
-
23
- - Basically, this component will render your SVG from your project.
24
- - The component will fetch the SVG from the `public` folder and parse it to render it.
25
- - Place your SVG files in a public folder (default `/icons`, use `path` prop to change it)
24
+ ```vue
25
+ <script setup>
26
+ import MazIcon from 'maz-ui/components/MazIcon'
27
+ import { MazStar } from '@maz-ui/icons/raw/MazStar'
28
+ </script>
26
29
 
27
- ## Icon Component
30
+ <template>
31
+ <MazIcon :icon="MazStar" />
32
+ <MazIcon icon="/icons/star.svg" />
33
+ <MazIcon icon="<svg viewBox='0 0 24 24'><path d='M0 0h24v24H0z'/></svg>" />
34
+ </template>
35
+ ```
28
36
 
29
- `icon` is the icon component to render - e.g: `import { MazStar } from '@maz-ui/icons/MazStar'`
37
+ ## Examples
30
38
 
31
- Can be custom component from your stack - e.g: `import ComponentIcon from './path_to_your/ComponentIcon.vue'`
39
+ ### Raw SVG (recommended)
32
40
 
33
41
  <ComponentDemo>
34
42
 
@@ -38,7 +46,7 @@ Can be custom component from your stack - e.g: `import ComponentIcon from './pat
38
46
 
39
47
  ```vue
40
48
  <script lang="ts" setup>
41
- import { MazStar } from '@maz-ui/icons/MazStar'
49
+ import { MazStar } from '@maz-ui/icons/raw/MazStar'
42
50
  </script>
43
51
 
44
52
  <template>
@@ -49,49 +57,58 @@ Can be custom component from your stack - e.g: `import ComponentIcon from './pat
49
57
  </template>
50
58
  </ComponentDemo>
51
59
 
52
- ## Path + Name
60
+ ### URL (fetched at runtime)
53
61
 
54
- - `name` is the SVG file name without extension
55
- - `path` should be the folder where your svg files are stored in your public assets. Can be gloablly provided by using `mazIconPath` - [follow this documentation](#options)
62
+ Place your SVG file in your `public/` folder, then point `icon` to its path. The component caches the fetched payload and shares it across instances.
56
63
 
57
64
  <ComponentDemo>
58
65
 
59
- <MazIcon name="academic-cap" path="/icons" />
66
+ <MazIcon icon="/academic-cap.svg" />
60
67
 
61
68
  <template #code>
62
69
 
63
- ```html
64
- <MazIcon name="academic-cap" path="/icons" />
70
+ ```vue
71
+ <MazIcon icon="/academic-cap.svg" />
65
72
  ```
66
73
 
67
74
  </template>
68
75
  </ComponentDemo>
69
76
 
70
- ## Src
71
-
72
- Provide the full src path to the icon
77
+ ### Vue component
73
78
 
74
79
  <ComponentDemo>
75
80
 
76
- <MazIcon src="/icons/academic-cap.svg" />
81
+ <MazIcon :icon="icons.MazStar" />
77
82
 
78
83
  <template #code>
79
84
 
80
- ```html
81
- <MazIcon src="/icons/academic-cap.svg" />
85
+ ```vue
86
+ <script lang="ts" setup>
87
+ import { MazStar } from '@maz-ui/icons/static/MazStar'
88
+ </script>
89
+
90
+ <template>
91
+ <MazIcon :icon="MazStar" />
92
+ </template>
82
93
  ```
83
94
 
84
95
  </template>
85
96
  </ComponentDemo>
86
97
 
87
- ## Sizing
98
+ ## Fallback
88
99
 
89
- ### Predefined sizes
100
+ When the URL fetch fails, an `error` event is emitted and `MazIcon` switches to the `fallback` prop (same shape as `icon`). If neither resolves, the bundled `MazQuestionMarkCircle` is rendered.
90
101
 
91
- Can be `xs`, `sm`, `md`, `lg`, `xl`
102
+ ```vue
103
+ <MazIcon icon="/missing.svg" :fallback="MazStar" @error="onIconError" />
104
+ ```
105
+
106
+ ## Sizing
107
+
108
+ ### Predefined sizes (`'xs' | 'sm' | 'md' | 'lg' | 'xl'`)
92
109
 
93
110
  <ComponentDemo>
94
- <div class="maz-flex maz-gap-2 maz-flex-wrap maz-items-center">
111
+ <div class="maz:flex maz:gap-2 maz:flex-wrap maz:items-center">
95
112
  <MazIcon v-for="size in ['xs', 'sm', 'md', 'lg', 'xl']" :key="size" :size="size" :icon="icons.MazStar" />
96
113
  </div>
97
114
 
@@ -99,7 +116,7 @@ Can be `xs`, `sm`, `md`, `lg`, `xl`
99
116
 
100
117
  ```vue
101
118
  <script lang="ts" setup>
102
- import { MazStar } from '@maz-ui/icons/MazStar'
119
+ import { MazStar } from '@maz-ui/icons/raw/MazStar'
103
120
  </script>
104
121
 
105
122
  <template>
@@ -110,14 +127,12 @@ Can be `xs`, `sm`, `md`, `lg`, `xl`
110
127
  </template>
111
128
  </ComponentDemo>
112
129
 
113
- ### Custom size
114
-
115
- Can be any valid CSS size - e.g: `1em`, `1rem`, `10px`, `100%`, `10vw`, `10vh`
130
+ ### Custom size (any CSS length)
116
131
 
117
- Allowed units: `px`, `em`, `rem`, `%`, `vw`, `vh`, `cm`, `mm`, `in`, `pt`, `pc`, `ex`
132
+ Allowed units: `px`, `em`, `rem`, `%`, `vw`, `vh`, `cm`, `mm`, `in`, `pt`, `pc`, `ex`.
118
133
 
119
134
  <ComponentDemo>
120
- <div class="maz-flex maz-gap-2 maz-flex-wrap maz-items-center">
135
+ <div class="maz:flex maz:gap-2 maz:flex-wrap maz:items-center">
121
136
  <MazIcon size="0.5em" :icon="icons.MazStar" />
122
137
  <MazIcon size="1em" :icon="icons.MazStar" />
123
138
  <MazIcon size="24px" :icon="icons.MazStar" />
@@ -128,49 +143,87 @@ Allowed units: `px`, `em`, `rem`, `%`, `vw`, `vh`, `cm`, `mm`, `in`, `pt`, `pc`,
128
143
  <template #code>
129
144
 
130
145
  ```vue
131
- <script lang="ts" setup>
132
- import { MazStar } from '@maz-ui/icons/MazStar'
133
- </script>
134
-
135
- <template>
136
- <MazIcon size="0.5em" :icon="icons.MazStar" />
137
- <MazIcon size="1em" :icon="icons.MazStar" />
138
- <MazIcon size="24px" :icon="icons.MazStar" />
139
- <MazIcon size="4rem" :icon="icons.MazStar" />
140
- <MazIcon size="8rem" :icon="icons.MazStar" />
141
- </template>
146
+ <MazIcon size="0.5em" :icon="MazStar" />
147
+ <MazIcon size="1em" :icon="MazStar" />
148
+ <MazIcon size="24px" :icon="MazStar" />
149
+ <MazIcon size="4rem" :icon="MazStar" />
150
+ <MazIcon size="8rem" :icon="MazStar" />
142
151
  ```
143
152
 
144
153
  </template>
145
154
  </ComponentDemo>
146
155
 
147
- ## Options
156
+ ## Accessibility
157
+
158
+ By default `MazIcon` is rendered as decorative (`aria-hidden="true"`, no `role`). Provide an `aria-label` (either on `<MazIcon>` or in `svgAttributes`) to expose it to assistive tech — `role="img"` is set automatically and `aria-hidden` is dropped.
159
+
160
+ ```vue
161
+ <MazIcon :icon="MazStar" aria-label="Favorite" />
162
+ ```
163
+
164
+ ## RTL flipping
165
+
166
+ Set `flip-icon-for-rtl` on directional icons (chevrons, arrows). The icon is mirrored horizontally when the document direction is `rtl` and rendered unchanged otherwise.
167
+
168
+ ```vue
169
+ <MazIcon :icon="MazChevronRight" flip-icon-for-rtl />
170
+ ```
171
+
172
+ ## Custom SVG attributes
173
+
174
+ Inject extra attributes onto the rendered `<svg>` (or onto the inlined raw SVG) via `svg-attributes`:
148
175
 
149
- ### Set MazIcon path globally
176
+ ```vue
177
+ <MazIcon :icon="MazStar" :svg-attributes="{ 'data-testid': 'star', fill: 'currentColor' }" />
178
+ ```
150
179
 
151
- ```typescript
180
+ ## SSR — base URL for relative URLs
181
+
182
+ When you render `MazIcon icon="/icons/star.svg"` on the server, `fetch('/icons/star.svg')` cannot resolve without a host. Provide a base URL via Vue's `provide` to fix this:
183
+
184
+ ```ts
152
185
  import { createApp } from 'vue'
186
+
153
187
  const app = createApp(App)
188
+ app.provide('mazIconPath', 'https://your-app.com')
189
+ ```
190
+
191
+ In Nuxt, set `mazUi.general.defaultMazIconPath` in `nuxt.config` and `@maz-ui/nuxt` wires the provide for you.
192
+
193
+ ## Forwarding `MazIconProps` from a consumer
154
194
 
155
- app.provide('mazIconPath', '/your/custom/path')
195
+ Most icon-aware components in maz-ui (`MazBtn`, `MazInput`, `MazLink`, `MazContainer`, `MazDropdown`) accept a flexible icon prop on their `startIcon`, `endIcon`, `icon` or `dropdownIcon` slots. You can pass either a bare value (the same shape as `MazIcon`'s `icon` prop) or a full `MazIconProps` object when you need fine-grained control:
196
+
197
+ ```html
198
+ <!-- bare value — common case -->
199
+ <MazBtn :start-icon="MazStar" />
200
+ <MazBtn start-icon="/icons/star.svg" />
201
+
202
+ <!-- full props object — override size, set a title, flip for RTL, etc. -->
203
+ <MazBtn
204
+ :start-icon="{
205
+ icon: MazStar,
206
+ size: 'xl',
207
+ title: 'Favorite',
208
+ flipIconForRtl: true,
209
+ }"
210
+ />
156
211
  ```
157
212
 
158
- ## All icons
213
+ The consuming component still derives sensible defaults (e.g. icon size from the button's `size` prop), and the values you set in the props object override those defaults.
159
214
 
160
- ### Get Icons Pack
215
+ ## All bundled icons
161
216
 
162
- This pack is the Heroicons icons set with some others from maz-ui
217
+ This pack is the Heroicons set plus a few additions specific to maz-ui.
163
218
 
164
- <MazBtn download href="/icons/_icons.zip" right-icon="arrow-down-tray">
219
+ <MazBtn download href="/icons/_icons.zip" end-icon="/arrow-down-tray.svg">
165
220
  Download pack
166
221
  </MazBtn>
167
222
 
168
- Source: [Hericons](https://heroicons.com/)
169
-
170
- You can also find icons in the [icon set page](./../guide/icon-set.md)
223
+ Source: [Heroicons](https://heroicons.com/) — see also the [icon set page](./../guide/icon-set.md).
171
224
 
172
225
  <div class="flex items-start flex-wrap gap-05">
173
- <div v-for="({ component, name }, i) in iconsList" :key="i" class="flex flex-col flex-center maz-p-2 maz-rounded maz-border">
226
+ <div v-for="({ component, name }, i) in iconsList" :key="i" class="flex flex-col flex-center maz:p-2 maz:rounded-md maz:border">
174
227
  <MazIcon :icon="component" size="lg" />
175
228
  <span style="font-size: 11px;">
176
229
  {{ name }}
@@ -29,7 +29,7 @@ const code = ref()
29
29
 
30
30
  ## Size
31
31
 
32
- <div class="maz-flex maz-flex-col maz-gap-2">
32
+ <div class="maz:flex maz:flex-col maz:gap-2">
33
33
  <MazInputCode v-model="code" size="mini" />
34
34
  <MazInputCode v-model="code" size="xs" />
35
35
  <MazInputCode v-model="code" size="sm" />