@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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +264 -0
  3. package/bin/maz-ui-mcp.mjs +7 -0
  4. package/dist/mcp.d.mts +13 -0
  5. package/dist/mcp.d.ts +13 -0
  6. package/dist/mcp.mjs +586 -0
  7. package/docs/generated-docs/maz-accordion.doc.md +21 -0
  8. package/docs/generated-docs/maz-animated-counter.doc.md +17 -0
  9. package/docs/generated-docs/maz-animated-element.doc.md +14 -0
  10. package/docs/generated-docs/maz-animated-text.doc.md +14 -0
  11. package/docs/generated-docs/maz-avatar.doc.md +44 -0
  12. package/docs/generated-docs/maz-backdrop.doc.md +61 -0
  13. package/docs/generated-docs/maz-badge.doc.md +16 -0
  14. package/docs/generated-docs/maz-bottom-sheet.doc.md +21 -0
  15. package/docs/generated-docs/maz-btn.doc.md +30 -0
  16. package/docs/generated-docs/maz-card-spotlight.doc.md +16 -0
  17. package/docs/generated-docs/maz-card.doc.md +39 -0
  18. package/docs/generated-docs/maz-carousel.doc.md +16 -0
  19. package/docs/generated-docs/maz-chart.doc.md +10 -0
  20. package/docs/generated-docs/maz-checkbox.doc.md +34 -0
  21. package/docs/generated-docs/maz-checklist.doc.md +30 -0
  22. package/docs/generated-docs/maz-circular-progress-bar.doc.md +27 -0
  23. package/docs/generated-docs/maz-date-picker.doc.md +52 -0
  24. package/docs/generated-docs/maz-dialog-confirm.doc.md +24 -0
  25. package/docs/generated-docs/maz-dialog.doc.md +22 -0
  26. package/docs/generated-docs/maz-drawer.doc.md +26 -0
  27. package/docs/generated-docs/maz-dropdown.doc.md +42 -0
  28. package/docs/generated-docs/maz-dropzone.doc.md +82 -0
  29. package/docs/generated-docs/maz-expand-animation.doc.md +12 -0
  30. package/docs/generated-docs/maz-fullscreen-loader.doc.md +13 -0
  31. package/docs/generated-docs/maz-gallery.doc.md +17 -0
  32. package/docs/generated-docs/maz-icon.doc.md +18 -0
  33. package/docs/generated-docs/maz-input-code.doc.md +25 -0
  34. package/docs/generated-docs/maz-input-number.doc.md +31 -0
  35. package/docs/generated-docs/maz-input-phone-number.doc.md +56 -0
  36. package/docs/generated-docs/maz-input-price.doc.md +26 -0
  37. package/docs/generated-docs/maz-input-tags.doc.md +24 -0
  38. package/docs/generated-docs/maz-input.doc.md +54 -0
  39. package/docs/generated-docs/maz-lazy-img.doc.md +31 -0
  40. package/docs/generated-docs/maz-link.doc.md +31 -0
  41. package/docs/generated-docs/maz-loading-bar.doc.md +6 -0
  42. package/docs/generated-docs/maz-pagination.doc.md +22 -0
  43. package/docs/generated-docs/maz-popover.doc.md +70 -0
  44. package/docs/generated-docs/maz-pull-to-refresh.doc.md +31 -0
  45. package/docs/generated-docs/maz-radio-buttons.doc.md +33 -0
  46. package/docs/generated-docs/maz-radio.doc.md +33 -0
  47. package/docs/generated-docs/maz-reading-progress-bar.doc.md +18 -0
  48. package/docs/generated-docs/maz-select-country.doc.md +44 -0
  49. package/docs/generated-docs/maz-select.doc.md +65 -0
  50. package/docs/generated-docs/maz-slider.doc.md +20 -0
  51. package/docs/generated-docs/maz-spinner.doc.md +6 -0
  52. package/docs/generated-docs/maz-stepper.doc.md +29 -0
  53. package/docs/generated-docs/maz-switch.doc.md +31 -0
  54. package/docs/generated-docs/maz-table-cell.doc.md +5 -0
  55. package/docs/generated-docs/maz-table-row.doc.md +11 -0
  56. package/docs/generated-docs/maz-table-title.doc.md +5 -0
  57. package/docs/generated-docs/maz-table.doc.md +66 -0
  58. package/docs/generated-docs/maz-tabs-bar.doc.md +18 -0
  59. package/docs/generated-docs/maz-tabs-content-item.doc.md +11 -0
  60. package/docs/generated-docs/maz-tabs-content.doc.md +5 -0
  61. package/docs/generated-docs/maz-tabs.doc.md +17 -0
  62. package/docs/generated-docs/maz-textarea.doc.md +41 -0
  63. package/docs/src/components/index.md +8 -0
  64. package/docs/src/components/maz-accordion.md +80 -0
  65. package/docs/src/components/maz-animated-counter.md +124 -0
  66. package/docs/src/components/maz-animated-element.md +36 -0
  67. package/docs/src/components/maz-animated-text.md +36 -0
  68. package/docs/src/components/maz-avatar.md +179 -0
  69. package/docs/src/components/maz-backdrop.md +16 -0
  70. package/docs/src/components/maz-badge.md +222 -0
  71. package/docs/src/components/maz-bottom-sheet.md +398 -0
  72. package/docs/src/components/maz-btn.md +526 -0
  73. package/docs/src/components/maz-card-spotlight.md +163 -0
  74. package/docs/src/components/maz-card.md +447 -0
  75. package/docs/src/components/maz-carousel.md +127 -0
  76. package/docs/src/components/maz-chart.md +346 -0
  77. package/docs/src/components/maz-checkbox.md +168 -0
  78. package/docs/src/components/maz-checklist.md +414 -0
  79. package/docs/src/components/maz-circular-progress-bar.md +147 -0
  80. package/docs/src/components/maz-date-picker.md +1078 -0
  81. package/docs/src/components/maz-dialog-confirm.md +240 -0
  82. package/docs/src/components/maz-dialog.md +208 -0
  83. package/docs/src/components/maz-drawer.md +177 -0
  84. package/docs/src/components/maz-dropdown.md +650 -0
  85. package/docs/src/components/maz-dropzone.md +442 -0
  86. package/docs/src/components/maz-expand-animation.md +99 -0
  87. package/docs/src/components/maz-fullscreen-loader.md +58 -0
  88. package/docs/src/components/maz-gallery.md +85 -0
  89. package/docs/src/components/maz-icon.md +85 -0
  90. package/docs/src/components/maz-input-code.md +61 -0
  91. package/docs/src/components/maz-input-number.md +81 -0
  92. package/docs/src/components/maz-input-phone-number.md +867 -0
  93. package/docs/src/components/maz-input-price.md +58 -0
  94. package/docs/src/components/maz-input-tags.md +114 -0
  95. package/docs/src/components/maz-input.md +453 -0
  96. package/docs/src/components/maz-lazy-img.md +24 -0
  97. package/docs/src/components/maz-link.md +156 -0
  98. package/docs/src/components/maz-loading-bar.md +26 -0
  99. package/docs/src/components/maz-pagination.md +81 -0
  100. package/docs/src/components/maz-popover.md +1414 -0
  101. package/docs/src/components/maz-pull-to-refresh.md +49 -0
  102. package/docs/src/components/maz-radio-buttons.md +456 -0
  103. package/docs/src/components/maz-radio.md +141 -0
  104. package/docs/src/components/maz-reading-progress-bar.md +74 -0
  105. package/docs/src/components/maz-select-country.md +636 -0
  106. package/docs/src/components/maz-select.md +439 -0
  107. package/docs/src/components/maz-slider.md +191 -0
  108. package/docs/src/components/maz-spinner.md +93 -0
  109. package/docs/src/components/maz-stepper.md +418 -0
  110. package/docs/src/components/maz-switch.md +92 -0
  111. package/docs/src/components/maz-table.md +571 -0
  112. package/docs/src/components/maz-tabs.md +231 -0
  113. package/docs/src/components/maz-textarea.md +218 -0
  114. package/docs/src/composables/use-aos.md +34 -0
  115. package/docs/src/composables/use-breakpoints.md +35 -0
  116. package/docs/src/composables/use-dialog.md +88 -0
  117. package/docs/src/composables/use-display-names.md +174 -0
  118. package/docs/src/composables/use-form-validator.md +1149 -0
  119. package/docs/src/composables/use-idle-timeout.md +256 -0
  120. package/docs/src/composables/use-reading-time.md +168 -0
  121. package/docs/src/composables/use-string-matching.md +63 -0
  122. package/docs/src/composables/use-swipe.md +223 -0
  123. package/docs/src/composables/use-timer.md +130 -0
  124. package/docs/src/composables/use-toast.md +71 -0
  125. package/docs/src/composables/use-user-visibility.md +169 -0
  126. package/docs/src/composables/use-wait.md +62 -0
  127. package/docs/src/composables/use-window-size.md +18 -0
  128. package/docs/src/demo/DemoAuthPage.vue +178 -0
  129. package/docs/src/demo/DemoDashboardPage.vue +298 -0
  130. package/docs/src/demo/DemoProductPage.vue +135 -0
  131. package/docs/src/directives/click-outside.md +275 -0
  132. package/docs/src/directives/fullscreen-img.md +101 -0
  133. package/docs/src/directives/lazy-img.md +184 -0
  134. package/docs/src/directives/tooltip.md +458 -0
  135. package/docs/src/directives/zoom-img.md +127 -0
  136. package/docs/src/guide/cli.md +144 -0
  137. package/docs/src/guide/getting-started.md +284 -0
  138. package/docs/src/guide/icon-set.md +60 -0
  139. package/docs/src/guide/icons.md +481 -0
  140. package/docs/src/guide/mcp.md +210 -0
  141. package/docs/src/guide/migration-v4.md +898 -0
  142. package/docs/src/guide/nuxt.md +411 -0
  143. package/docs/src/guide/resolvers.md +697 -0
  144. package/docs/src/guide/themes.md +789 -0
  145. package/docs/src/guide/translations.md +1173 -0
  146. package/docs/src/guide/vue.md +243 -0
  147. package/docs/src/helpers/camel-case.md +14 -0
  148. package/docs/src/helpers/capitalize.md +51 -0
  149. package/docs/src/helpers/check-availability.md +14 -0
  150. package/docs/src/helpers/country-code-to-unicode-flag.md +213 -0
  151. package/docs/src/helpers/currency.md +67 -0
  152. package/docs/src/helpers/date.md +67 -0
  153. package/docs/src/helpers/debounce-callback.md +14 -0
  154. package/docs/src/helpers/debounce-id.md +14 -0
  155. package/docs/src/helpers/debounce.md +14 -0
  156. package/docs/src/helpers/get-country-flag-url.md +156 -0
  157. package/docs/src/helpers/is-client.md +14 -0
  158. package/docs/src/helpers/is-equal.md +14 -0
  159. package/docs/src/helpers/is-standalone-mode.md +14 -0
  160. package/docs/src/helpers/kebab-case.md +14 -0
  161. package/docs/src/helpers/normalize-string.md +14 -0
  162. package/docs/src/helpers/number.md +65 -0
  163. package/docs/src/helpers/pascal-case.md +14 -0
  164. package/docs/src/helpers/script-loader.md +14 -0
  165. package/docs/src/helpers/sleep.md +14 -0
  166. package/docs/src/helpers/snake-case.md +14 -0
  167. package/docs/src/helpers/throttle-id.md +14 -0
  168. package/docs/src/helpers/throttle.md +14 -0
  169. package/docs/src/index.md +555 -0
  170. package/docs/src/made-with-maz-ui.md +58 -0
  171. package/docs/src/plugins/aos.md +347 -0
  172. package/docs/src/plugins/dialog.md +411 -0
  173. package/docs/src/plugins/toast.md +349 -0
  174. package/docs/src/plugins/wait.md +109 -0
  175. package/package.json +84 -0
@@ -0,0 +1,243 @@
1
+ ---
2
+ title: Install maz-ui with Vue
3
+ description: How to install easily maz-ui with Vue 3
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ## Quick Installation {#quick-installation}
11
+
12
+ ::: code-group
13
+
14
+ ```bash [pnpm]
15
+ pnpm add maz-ui @maz-ui/themes
16
+ ```
17
+
18
+ ```bash [npm]
19
+ npm install maz-ui @maz-ui/themes
20
+ ```
21
+
22
+ ```bash [yarn]
23
+ yarn add maz-ui @maz-ui/themes
24
+ ```
25
+
26
+ :::
27
+
28
+ ## Framework Integration
29
+
30
+ You must the MazUi plugin to initialize the theme and translations.
31
+
32
+ ```typescript
33
+ import { MazUi } from 'maz-ui/plugins/maz-ui'
34
+
35
+ import { mazUi } from '@maz-ui/themes/presets'
36
+ import { fr } from '@maz-ui/translations'
37
+
38
+ import { createApp } from 'vue'
39
+
40
+ // Import Maz-UI styles before your own CSS
41
+ import 'maz-ui/styles'
42
+ import './style.css'
43
+
44
+ import App from './App.vue'
45
+
46
+ const app = createApp(App)
47
+
48
+ // Install MazUi plugin to initialize the theme and translations
49
+ app.use(MazUi, {
50
+ /**
51
+ * Theme configuration (optional if you are using the default theme)
52
+ * More information in dedicated documentation
53
+ * @see https://maz-ui.com/guide/themes
54
+ */
55
+ theme: {
56
+ preset: mazUi, // 'ocean' | 'pristine' | 'obsidian'
57
+ },
58
+ /**
59
+ * Translations configuration (optional if you are using english)
60
+ * More information in dedicated documentation
61
+ * @see https://maz-ui.com/guide/translations
62
+ */
63
+ translations: {
64
+ locale: 'fr',
65
+ fallbackLocale: 'en',
66
+ messages: {
67
+ fr,
68
+ },
69
+ },
70
+ })
71
+
72
+ app.mount('#app')
73
+ ```
74
+
75
+ ## Using your first component
76
+
77
+ Let's start with a simple button to see Maz-UI in action:
78
+
79
+ ```vue
80
+ <script setup lang="ts">
81
+ import MazBtn from 'maz-ui/components/MazBtn'
82
+
83
+ function handleClick() {
84
+ console.log('Button clicked!')
85
+ }
86
+ </script>
87
+
88
+ <template>
89
+ <MazBtn color="primary" @click="handleClick">
90
+ Hello Maz-UI! 👋
91
+ </MazBtn>
92
+ </template>
93
+ ```
94
+
95
+ ## Theming
96
+
97
+ More information in the [theme documentation](/guide/themes).
98
+
99
+ ## Translations
100
+
101
+ More information in the [translations documentation](/guide/translations).
102
+
103
+ ## Plugins
104
+
105
+ More information about installation and usage in:
106
+ - [aos](./../plugins/aos.md) (animations on scroll)
107
+ - [dialog](./../plugins/dialog.md) (display modales without any implementation in template)
108
+ - [toast](./../plugins/toast.md) (display notifications)
109
+ - [wait](./../plugins/wait.md) (display loading states)
110
+
111
+ ## Directives
112
+
113
+ More information about installation and usage in:
114
+ - [tooltip](./../directives/tooltip.md) (display tooltips)
115
+ - [click-outside](./../directives/click-outside.md) (detect outside clicks)
116
+ - [lazy-img](./../directives/lazy-img.md) (lazy load images)
117
+ - [zoom-img](./../directives/zoom-img.md) (zoom images on click)
118
+ - [fullscreen-img](./../directives/fullscreen-img.md) (display images fullscreen on click with an animate effect)
119
+
120
+ ## Smart Loading with resolvers
121
+
122
+ ### Installation
123
+
124
+ ::: code-group
125
+
126
+ ```bash [pnpm]
127
+ pnpm add unplugin-vue-components unplugin-auto-import
128
+ ```
129
+
130
+ ```bash [npm]
131
+ npm install unplugin-vue-components unplugin-auto-import
132
+ ```
133
+
134
+ ```bash [yarn]
135
+ yarn add unplugin-vue-components unplugin-auto-import
136
+ ```
137
+
138
+ :::
139
+
140
+ For the ultimate developer experience, use auto-imports for components, composables, and directives.
141
+
142
+ Into your `vite.config.ts`:
143
+
144
+ ```typescript
145
+ import { defineConfig } from 'vite'
146
+ import vue from '@vitejs/plugin-vue'
147
+ import {
148
+ MazComponentsResolver,
149
+ MazDirectivesResolver,
150
+ MazModulesResolver
151
+ } from 'maz-ui/resolvers'
152
+ import AutoImport from 'unplugin-auto-import/vite'
153
+ import Components from 'unplugin-vue-components/vite'
154
+
155
+
156
+ export default defineConfig({
157
+ plugins: [
158
+ vue(),
159
+ // Auto-import components
160
+ Components({
161
+ resolvers: [
162
+ MazComponentsResolver(),
163
+ MazDirectivesResolver(),
164
+ ],
165
+ dts: true,
166
+ }),
167
+ // Auto-import composables and utilities
168
+ AutoImport({
169
+ resolvers: [MazModulesResolver()],
170
+ dts: true,
171
+ }),
172
+ ],
173
+ })
174
+ ```
175
+
176
+ Now use everything without imports:
177
+
178
+ ```vue
179
+ <script setup lang="ts">
180
+ // Auto-imported composables and utilities
181
+ const text = ref('')
182
+ const toast = useToast()
183
+
184
+ // Auto-imported utility functions
185
+ const debouncedSearch = debounce((query) => {
186
+ console.log('Searching:', query)
187
+ }, 300)
188
+
189
+ function handleClickOutside() {
190
+ toast.info('Clicked outside!')
191
+ }
192
+ </script>
193
+
194
+ <template>
195
+ <!-- Auto-imported components -->
196
+ <MazBtn>Button</MazBtn>
197
+ <MazInput v-model="text" placeholder="Type here..." />
198
+
199
+ <!-- Auto-imported directives -->
200
+ <div v-click-outside="handleClickOutside">
201
+ Click outside detector
202
+ </div>
203
+
204
+ <!-- Auto-imported tooltip directive -->
205
+ <MazBtn v-tooltip="'This is a tooltip'">
206
+ Hover me
207
+ </MazBtn>
208
+ </template>
209
+ ```
210
+
211
+ ### Available Resolvers
212
+
213
+ | Resolver | Purpose | Import |
214
+ | ----------------------- | -------------------------------------------------- | -------------------- |
215
+ | `MazComponentsResolver` | Components (MazBtn, MazInput, etc.) | `'maz-ui/resolvers'` |
216
+ | `MazDirectivesResolver` | Directives (v-click-outside, v-tooltip, etc.) | `'maz-ui/resolvers'` |
217
+ | `MazModulesResolver` | Composables & utilities (useToast, debounce, etc.) | `'maz-ui/resolvers'` |
218
+
219
+ ### Avoiding Naming Conflicts
220
+
221
+ To avoid naming conflicts, you can use the `prefix` option:
222
+
223
+ ```typescript
224
+ export default defineConfig({
225
+ plugins: [
226
+ Components({
227
+ resolvers: [
228
+ MazComponentsResolver(),
229
+ MazDirectivesResolver({ prefix: 'Maz' }), // v-maz-tooltip
230
+ ],
231
+ }),
232
+ AutoImport({
233
+ resolvers: [
234
+ MazModulesResolver({ prefix: 'Maz' }), // useMazToast, useMazTheme
235
+ ],
236
+ }),
237
+ ],
238
+ })
239
+ ```
240
+
241
+ ::: info Complete Resolver Documentation
242
+ For comprehensive resolver configuration, advanced options, real-world examples, and troubleshooting, check out our [dedicated resolver guide](/guide/resolvers).
243
+ :::
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: camelCase
3
+ description: Utility method to convert a string to camel case
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: warning
11
+
12
+ TO DO
13
+
14
+ :::
@@ -0,0 +1,51 @@
1
+ ---
2
+ title: capitalize
3
+ description: The module capitalize is a function that adds a capital letter to a string
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ <MazInput v-model="stringValue" />
11
+
12
+ <div
13
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
14
+ class="flex flex-center rounded gap-05"
15
+ >
16
+ formatted value: <strong>{{ stringFormatted }}</strong>
17
+ </div>
18
+
19
+ ```vue
20
+ <script lang="ts" setup>
21
+ import { capitalize } from 'maz-ui'
22
+ import { computed, ref } from 'vue'
23
+
24
+ const stringValue = ref('string value')
25
+
26
+ const stringFormatted = computed(() =>
27
+ capitalize(stringValue.value),
28
+ )
29
+ </script>
30
+
31
+ <template>
32
+ <MazInput v-model="stringValue" />
33
+
34
+ <div
35
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
36
+ >
37
+ {{ stringFormatted }}
38
+ </div>
39
+ </template>
40
+ ```
41
+
42
+ <script lang="ts" setup>
43
+ import { capitalize } from 'maz-ui'
44
+ import { ref, computed } from 'vue'
45
+
46
+ const stringValue = ref('string value')
47
+
48
+ const stringFormatted = computed(() =>
49
+ capitalize(stringValue.value),
50
+ )
51
+ </script>
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: checkAvailability
3
+ description: Utility method to execute a call back when the awaited data is available with timeout and check interval
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: warning
11
+
12
+ TO DO
13
+
14
+ :::
@@ -0,0 +1,213 @@
1
+ ---
2
+ title: country-code-to-unicode-flag
3
+ description: Convert country code in unicode flag
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: warning
11
+ This feature does not work with Windows but you can use this polyfill: [https://www.npmjs.com/package/country-flag-emoji-polyfill](https://www.npmjs.com/package/country-flag-emoji-polyfill)
12
+
13
+ Use can also use [get-country-flag-url](./get-country-flag-url.md) instead.
14
+ :::
15
+
16
+ ## Basic usage
17
+
18
+ <span style="font-size: 2rem;">
19
+ {{ unicodeFlag }}
20
+ </span>
21
+
22
+ ```vue
23
+ <template>
24
+ <span style="font-size: 2rem;">
25
+ {{ unicodeFlag }}
26
+ </span>
27
+ </template>
28
+
29
+ <script lang="ts" setup >
30
+ import { countryCodeToUnicodeFlag } from 'maz-ui'
31
+
32
+ const unicodeFlag = countryCodeToUnicodeFlag('FR')
33
+ </script>
34
+ ```
35
+
36
+ ## Example
37
+
38
+ <div class="maz-gap-2 maz-flex maz-flex-wrap maz-items-center">
39
+ <span class="maz-text-xs">{{ flag }}</span>
40
+ <span class="maz-text-sm">{{ flag }}</span>
41
+ <span class="maz-text-base">{{ flag }}</span>
42
+ <span class="maz-text-lg">{{ flag }}</span>
43
+ <span class="maz-text-xl">{{ flag }}</span>
44
+ <span class="maz-text-2xl">{{ flag }}</span>
45
+ <span class="maz-text-3xl">{{ flag }}</span>
46
+ <span class="maz-text-4xl">{{ flag }}</span>
47
+ <span class="maz-text-5xl">{{ flag }}</span>
48
+ <span class="maz-text-6xl">{{ flag }}</span>
49
+ <span class="maz-text-7xl">{{ flag }}</span>
50
+ </div>
51
+
52
+ <MazSelect
53
+ v-model="countryCode"
54
+ :options="countryOptions"
55
+ label="Select country"
56
+ search
57
+ search-placeholder="Search country"
58
+ @selected-option="(option) => console.log('option', option)"
59
+ >
60
+ <template #default="{ option, isSelected }">
61
+ <div
62
+ class="maz-flex maz-items-center maz-gap-3"
63
+ >
64
+ <span class="maz-text-lg">
65
+ {{ option.unicodeFlag }}
66
+ </span>
67
+ <MazBadge
68
+ pastel
69
+ size="0.7rem"
70
+ class="maz-w-9"
71
+ :class="{ 'maz-text-muted': !isSelected }"
72
+ >
73
+ {{ option.value }}
74
+ </MazBadge>
75
+ <span :class="{ 'maz-font-semibold': isSelected }">
76
+ {{ option.label }}
77
+ </span>
78
+ </div>
79
+ </template>
80
+ </MazSelect>
81
+
82
+ <script lang="ts" setup>
83
+ import { computed, ref, onMounted } from 'vue'
84
+ import { countryCodeToUnicodeFlag } from 'maz-ui'
85
+ import { getCountries } from 'libphonenumber-js'
86
+
87
+ const unicodeFlag = countryCodeToUnicodeFlag('FR')
88
+
89
+ const countryCode = ref('FR')
90
+ const flag = computed(() => countryCodeToUnicodeFlag(countryCode.value))
91
+
92
+ const countryOptions = ref(getCountriesList())
93
+
94
+ onMounted(() => {
95
+ const listOfCountries = getCountriesList(window.navigator.language)
96
+ if (listOfCountries.length > 1) {
97
+ countryOptions.value = listOfCountries
98
+ }
99
+ })
100
+
101
+ function getCountriesList(
102
+ locale?: string,
103
+ ) {
104
+ const countriesList = []
105
+ const isoList = getCountries()
106
+
107
+ for (const iso2 of isoList) {
108
+ const name = new Intl.DisplayNames([locale ?? 'en-US'], { type: 'region' }).of(iso2)
109
+
110
+ if (name) {
111
+ countriesList.push({
112
+ value: iso2,
113
+ label: name,
114
+ unicodeFlag: countryCodeToUnicodeFlag(iso2)
115
+ })
116
+ }
117
+ }
118
+
119
+ return countriesList
120
+ }
121
+ </script>
122
+
123
+ ::: details Show full code
124
+
125
+ ```vue
126
+
127
+ <template>
128
+ <div class="maz-gap-2 maz-flex maz-flex-wrap maz-items-center">
129
+ <span class="maz-text-xs">{{ flag }}</span>
130
+ <span class="maz-text-sm">{{ flag }}</span>
131
+ <span class="maz-text-base">{{ flag }}</span>
132
+ <span class="maz-text-lg">{{ flag }}</span>
133
+ <span class="maz-text-xl">{{ flag }}</span>
134
+ <span class="maz-text-2xl">{{ flag }}</span>
135
+ <span class="maz-text-3xl">{{ flag }}</span>
136
+ <span class="maz-text-4xl">{{ flag }}</span>
137
+ <span class="maz-text-5xl">{{ flag }}</span>
138
+ <span class="maz-text-6xl">{{ flag }}</span>
139
+ <span class="maz-text-7xl">{{ flag }}</span>
140
+ </div>
141
+
142
+ <MazSelect
143
+ v-model="countryCode"
144
+ :options="countryOptions"
145
+ label="Select country"
146
+ search
147
+ search-placeholder="Search country"
148
+ @selected-option="(option) => console.log('option', option)"
149
+ >
150
+ <template #default="{ option, isSelected }">
151
+ <div
152
+ class="maz-flex maz-items-center maz-gap-3"
153
+ >
154
+ <span class="maz-text-lg">
155
+ {{ option.unicodeFlag }}
156
+ </span>
157
+ <MazBadge
158
+ pastel
159
+ size="0.7rem"
160
+ class="maz-w-9"
161
+ :class="{ 'maz-text-muted': !isSelected }"
162
+ >
163
+ {{ option.value }}
164
+ </MazBadge>
165
+ <span :class="{ 'maz-font-semibold': isSelected }">
166
+ {{ option.label }}
167
+ </span>
168
+ </div>
169
+ </template>
170
+ </MazSelect>
171
+ </template>
172
+
173
+ <script lang="ts" setup>
174
+ import { computed, ref, onMounted } from 'vue'
175
+ import { countryCodeToUnicodeFlag } from 'maz-ui'
176
+ import { getCountries } from 'libphonenumber-js'
177
+
178
+ const countryCode = ref('FR')
179
+ const flag = computed(() => countryCodeToUnicodeFlag(countryCode.value))
180
+
181
+ const countryOptions = ref(getCountriesList())
182
+
183
+ onMounted(() => {
184
+ const listOfCountries = getCountriesList(window.navigator.language)
185
+ if (listOfCountries.length > 1) {
186
+ countryOptions.value = listOfCountries
187
+ }
188
+ })
189
+
190
+ function getCountriesList(
191
+ locale?: string,
192
+ ) {
193
+ const countriesList = []
194
+ const isoList = getCountries()
195
+
196
+ for (const iso2 of isoList) {
197
+ const name = new Intl.DisplayNames([locale ?? 'en-US'], { type: 'region' }).of(iso2)
198
+
199
+ if (name) {
200
+ countriesList.push({
201
+ value: iso2,
202
+ label: name,
203
+ unicodeFlag: countryCodeToUnicodeFlag(iso2)
204
+ })
205
+ }
206
+ }
207
+
208
+ return countriesList
209
+ }
210
+ </script>
211
+ ```
212
+
213
+ :::
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: formatCurrency
3
+ description: The module formatCurrency is a function that formats numbers to currency with the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers and Node.js
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: tip
11
+ This module uses the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers
12
+ :::
13
+
14
+ Enter only numbers
15
+
16
+ <MazInput v-model="numberValue" type="number" />
17
+
18
+ <div
19
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
20
+ class="flex flex-center rounded gap-05"
21
+ >
22
+ formatted value: <strong>{{ priceFormatted }}</strong>
23
+ </div>
24
+
25
+ ```vue
26
+ <script lang="ts" setup>
27
+ import { formatCurrency } from 'maz-ui'
28
+ import { computed, ref } from 'vue'
29
+
30
+ const numberValue = ref(69)
31
+
32
+ const priceFormatted = computed(() =>
33
+ formatCurrency(numberValue.value, 'fr-FR', { currency: 'EUR' }),
34
+ )
35
+ </script>
36
+
37
+ <template>
38
+ <MazInput v-model="numberValue" type="number" />
39
+
40
+ <div
41
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
42
+ >
43
+ {{ priceFormatted }}
44
+ </div>
45
+ </template>
46
+ ```
47
+
48
+ <script lang="ts" setup>
49
+ import { formatCurrency } from 'maz-ui'
50
+ import { ref, computed } from 'vue'
51
+
52
+ const numberValue = ref(69)
53
+
54
+ const priceFormatted = computed(() =>
55
+ formatCurrency(numberValue.value, 'fr-FR', { currency: 'EUR' }),
56
+ )
57
+ </script>
58
+
59
+ ## Options
60
+
61
+ > All options from [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) are availables
62
+
63
+ ```ts
64
+ export interface FilterCurrencyOptions extends Intl.NumberFormatOptions {
65
+ round?: boolean
66
+ }
67
+ ```
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: formatDate
3
+ description: The module formatDate is a function that formats dates with the native api [Intl.DateTimeFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) from browsers and Node.js
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ > This module use the native api [Intl.DateTimeFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) from browsers
11
+
12
+ <MazInput v-model="dateValue" type="date" />
13
+
14
+ <div
15
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
16
+ class="flex flex-center rounded gap-05"
17
+ >
18
+ formatted value: <strong>{{ dateFormatted }}</strong>
19
+ </div>
20
+
21
+ ```vue
22
+ <script lang="ts" setup>
23
+ import { formatDate } from 'maz-ui'
24
+ import { computed, ref } from 'vue'
25
+
26
+ const dateValue = ref('2022-02-01')
27
+
28
+ const dateFormatted = computed(() =>
29
+ dateValue.value ? formatDate(dateValue.value, 'en-US') : undefined,
30
+ )
31
+ </script>
32
+
33
+ <template>
34
+ <MazInput v-model="dateValue" type="date" />
35
+
36
+ <div
37
+ style="padding: 16px; margin-top: 16px; background-color: hsl(var(--maz-background-300));"
38
+ >
39
+ {{ dateFormatted }}
40
+ </div>
41
+ </template>
42
+ ```
43
+
44
+ ## Options
45
+
46
+ > All options from [Intl.DateTimeFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) are available
47
+
48
+ ## Default options
49
+
50
+ ```ts
51
+ const DEFAULT_OPTIONS: Intl.DateTimeFormatOptions = {
52
+ month: 'short',
53
+ day: 'numeric',
54
+ year: 'numeric',
55
+ }
56
+ ```
57
+
58
+ <script lang="ts" setup>
59
+ import { formatDate } from 'maz-ui'
60
+ import { ref, computed } from 'vue'
61
+
62
+ const dateValue = ref('2022-02-01')
63
+
64
+ const dateFormatted = computed(() =>
65
+ dateValue.value ? formatDate(dateValue.value, 'en-US') : undefined,
66
+ )
67
+ </script>
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: debounceCallback
3
+ description: Utility method to debounce a function call and execute a callback
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: warning
11
+
12
+ TO DO
13
+
14
+ :::
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: debounceId
3
+ description: Utility method to debounce a function call and execute a callback with an identifier
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ::: warning
11
+
12
+ TO DO
13
+
14
+ :::