@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,867 @@
1
+ ---
2
+ title: MazInputPhoneNumber
3
+ description: MazInputPhoneNumber is a powerful and user-friendly component that helps users enter and validate phone numbers from any country with automatic formatting and validation
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ <!--@include: ./../.vitepress/mixins/getting-started.md-->
11
+
12
+ <!--@include: ./../.vitepress/mixins/translated-component.md-->
13
+
14
+ ## Prerequisites
15
+
16
+ To use this component, you need to install the `libphonenumber-js` dependency:
17
+
18
+ <NpmBadge package="libphonenumber-js" />
19
+
20
+ ```bash
21
+ npm install libphonenumber-js
22
+ ```
23
+
24
+ ---
25
+
26
+ ::: tip ✨ What makes this component special?
27
+ - **Smart country detection** - Automatically detects country from browser locale or IP
28
+ - **Real-time validation** - Visual feedback as you type
29
+ - **Auto-formatting** - Formats numbers according to country standards
30
+ - **Search countries** - Find countries quickly in the dropdown
31
+ - **Customizable** - Full control over appearance and behavior
32
+ - **Accessible** - Keyboard navigation and screen reader support
33
+ - **International** - Supports all countries and phone formats
34
+ :::
35
+
36
+ ## Basic Usage
37
+
38
+ The simplest way to use MazInputPhoneNumber - just add it and it works!
39
+
40
+ <ComponentDemo>
41
+ <MazInputPhoneNumber
42
+ v-model="phoneNumber"
43
+ v-model:country-code="countryCode"
44
+ @data="results = $event"
45
+ />
46
+
47
+ <div class="maz-mt-4 maz-text-sm">
48
+ <p><strong>Phone Number:</strong> {{ phoneNumber || 'Not entered yet' }}</p>
49
+ <p><strong>Country:</strong> {{ countryCode || 'Not selected' }}</p>
50
+ <p><strong>Is Valid:</strong> {{ results?.isValid ? '✅ Yes' : '❌ No' }}</p>
51
+ </div>
52
+
53
+ <template #code>
54
+
55
+ ```vue
56
+ <script setup lang="ts">
57
+ import { MazInputPhoneNumber } from 'maz-ui'
58
+ import { ref } from 'vue'
59
+
60
+ const phoneNumber = ref()
61
+ const countryCode = ref()
62
+ const results = ref()
63
+ </script>
64
+
65
+ <template>
66
+ <MazInputPhoneNumber
67
+ v-model="phoneNumber"
68
+ v-model:country-code="countryCode"
69
+ @data="results = $event"
70
+ />
71
+ </template>
72
+ ```
73
+
74
+ </template>
75
+ </ComponentDemo>
76
+
77
+ ## Country Management
78
+
79
+ Control which countries appear in the dropdown and their order.
80
+
81
+ <ComponentDemo>
82
+ <div class="maz-space-y-4">
83
+ <div>
84
+ <h4 class="maz-font-semibold maz-mb-2">Preferred Countries</h4>
85
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Show your most common countries first</p>
86
+ <MazInputPhoneNumber
87
+ v-model="phone1"
88
+ :preferred-countries="['US', 'FR', 'GB', 'DE', 'CA']"
89
+ placeholder="Common countries appear first"
90
+ />
91
+ </div>
92
+ <div>
93
+ <h4 class="maz-font-semibold maz-mb-2">Only Specific Countries</h4>
94
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Limit to certain countries only</p>
95
+ <MazInputPhoneNumber
96
+ v-model="phone2"
97
+ :only-countries="['US', 'FR', 'GB', 'DE', 'IT', 'ES']"
98
+ placeholder="Only European + North American countries"
99
+ />
100
+ </div>
101
+ <div>
102
+ <h4 class="maz-font-semibold maz-mb-2">Ignore Countries</h4>
103
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Remove unwanted countries</p>
104
+ <MazInputPhoneNumber
105
+ v-model="phone3"
106
+ :ignored-countries="['AF', 'AL', 'DZ']"
107
+ placeholder="Some countries are hidden"
108
+ />
109
+ </div>
110
+ </div>
111
+
112
+ <template #code>
113
+
114
+ ```vue
115
+ <template>
116
+ <!-- Preferred countries (moved to top, order not preserved) -->
117
+ <MazInputPhoneNumber
118
+ v-model="phoneNumber"
119
+ :preferred-countries="['US', 'FR', 'GB', 'DE', 'CA']"
120
+ placeholder="Common countries appear first"
121
+ />
122
+
123
+ <!-- Only specific countries -->
124
+ <MazInputPhoneNumber
125
+ v-model="phoneNumber"
126
+ :only-countries="['US', 'FR', 'GB', 'DE', 'IT', 'ES']"
127
+ placeholder="Only European + North American countries"
128
+ />
129
+
130
+ <!-- Ignore certain countries -->
131
+ <MazInputPhoneNumber
132
+ v-model="phoneNumber"
133
+ :ignored-countries="['AF', 'AL', 'DZ']"
134
+ placeholder="Some countries are hidden"
135
+ />
136
+ </template>
137
+ ```
138
+
139
+ </template>
140
+ </ComponentDemo>
141
+
142
+ ## Layout Orientations
143
+
144
+ Choose how the country selector and phone input are arranged.
145
+
146
+ <ComponentDemo>
147
+ <div class="maz-space-y-6">
148
+ <div>
149
+ <h4 class="maz-font-semibold maz-mb-2">Responsive (Default)</h4>
150
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Stacks on mobile, side-by-side on desktop</p>
151
+ <MazInputPhoneNumber orientation="responsive" />
152
+ </div>
153
+ <div>
154
+ <h4 class="maz-font-semibold maz-mb-2">Always Row</h4>
155
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Side-by-side on all screen sizes</p>
156
+ <MazInputPhoneNumber orientation="row" />
157
+ </div>
158
+ <div>
159
+ <h4 class="maz-font-semibold maz-mb-2">Always Column</h4>
160
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Stacked on all screen sizes</p>
161
+ <MazInputPhoneNumber orientation="col" />
162
+ </div>
163
+ </div>
164
+
165
+ <template #code>
166
+
167
+ ```vue
168
+ <template>
169
+ <!-- Responsive layout (default) -->
170
+ <MazInputPhoneNumber orientation="responsive" />
171
+
172
+ <!-- Always side-by-side -->
173
+ <MazInputPhoneNumber orientation="row" />
174
+
175
+ <!-- Always stacked -->
176
+ <MazInputPhoneNumber orientation="col" />
177
+ </template>
178
+ ```
179
+
180
+ </template>
181
+ </ComponentDemo>
182
+
183
+ ## Display Options
184
+
185
+ Customize what information is shown to users.
186
+
187
+ <ComponentDemo>
188
+ <div class="maz-space-y-6">
189
+ <div>
190
+ <h4 class="maz-font-semibold maz-mb-2">Show Country Names</h4>
191
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Display country names instead of calling codes</p>
192
+ <MazInputPhoneNumber
193
+ display-country-name
194
+ :translations="{
195
+ countrySelect: { placeholder: 'Choose country' }
196
+ }"
197
+ />
198
+ </div>
199
+ <div>
200
+ <h4 class="maz-font-semibold maz-mb-2">Show Calling Codes in List</h4>
201
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Help users see the dialing codes</p>
202
+ <MazInputPhoneNumber show-code-in-list />
203
+ </div>
204
+ <div>
205
+ <h4 class="maz-font-semibold maz-mb-2">Hide Phone Examples</h4>
206
+ <p class="maz-text-sm maz-text-muted maz-mb-2">
207
+ Remove the example phone number hints (visible when the phone input is focused)
208
+ </p>
209
+ <MazInputPhoneNumber :example="false" />
210
+ </div>
211
+ <div>
212
+ <h4 class="maz-font-semibold maz-mb-2">Hide Country Flags</h4>
213
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Text-only country selection</p>
214
+ <MazInputPhoneNumber hide-flags />
215
+ </div>
216
+ </div>
217
+
218
+ <template #code>
219
+
220
+ ```vue
221
+ <template>
222
+ <!-- Show country names instead of codes -->
223
+ <MazInputPhoneNumber
224
+ display-country-name
225
+ :translations="{ countrySelect: { placeholder: 'Choose country' } }"
226
+ />
227
+
228
+ <!-- Show calling codes in dropdown -->
229
+ <MazInputPhoneNumber show-code-in-list />
230
+
231
+ <!-- Hide phone number examples -->
232
+ <MazInputPhoneNumber :example="false" />
233
+
234
+ <!-- Hide country flags -->
235
+ <MazInputPhoneNumber hide-flags />
236
+ </template>
237
+ ```
238
+
239
+ </template>
240
+ </ComponentDemo>
241
+
242
+ ## Smart Country Detection
243
+
244
+ Let the component automatically detect the user's country.
245
+
246
+ <ComponentDemo>
247
+ <div class="maz-space-y-6">
248
+ <div>
249
+ <h4 class="maz-font-semibold maz-mb-2">Browser Locale Detection</h4>
250
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Uses browser language settings (enabled by default)</p>
251
+ <MazInputPhoneNumber :use-browser-locale="true" />
252
+ </div>
253
+ <div>
254
+ <h4 class="maz-font-semibold maz-mb-2">IP-based Detection</h4>
255
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Fetches country from user's IP address</p>
256
+ <MazInputPhoneNumber fetch-country />
257
+ </div>
258
+ <div>
259
+ <h4 class="maz-font-semibold maz-mb-2">Manual Default Country</h4>
260
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Set a specific default country</p>
261
+ <MazInputPhoneNumber
262
+ :use-browser-locale="false"
263
+ country-code="JP"
264
+ />
265
+ </div>
266
+ </div>
267
+
268
+ <template #code>
269
+
270
+ ```vue
271
+ <template>
272
+ <!-- Auto-detect from browser (default behavior) -->
273
+ <MazInputPhoneNumber :use-browser-locale="true" />
274
+
275
+ <!-- Auto-detect from IP address -->
276
+ <MazInputPhoneNumber fetch-country />
277
+
278
+ <!-- Set specific default country -->
279
+ <MazInputPhoneNumber
280
+ :use-browser-locale="false"
281
+ country-code="JP"
282
+ />
283
+ </template>
284
+ ```
285
+
286
+ </template>
287
+ </ComponentDemo>
288
+
289
+ ## Validation & Formatting
290
+
291
+ Control how phone numbers are validated and formatted.
292
+
293
+ <ComponentDemo>
294
+ <div class="maz-space-y-6">
295
+ <div>
296
+ <h4 class="maz-font-semibold maz-mb-2">Disable Auto-formatting</h4>
297
+ <p class="maz-text-sm maz-text-muted maz-mb-2">For countries with multiple valid lengths</p>
298
+ <MazInputPhoneNumber
299
+ :auto-format="false"
300
+ country-code="AI"
301
+ :translations="{
302
+ phoneInput: {
303
+ placeholder: 'Raw input, no formatting'
304
+ }
305
+ }"
306
+ />
307
+ </div>
308
+ <div>
309
+ <h4 class="maz-font-semibold maz-mb-2">Hide Validation UI</h4>
310
+ <p class="maz-text-sm maz-text-muted maz-mb-2">No visual success/error indicators</p>
311
+ <MazInputPhoneNumber
312
+ :validation-success="false"
313
+ :validation-error="false"
314
+ />
315
+ </div>
316
+ <div>
317
+ <h4 class="maz-font-semibold maz-mb-2">Force Success State</h4>
318
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Always show success styling</p>
319
+ <MazInputPhoneNumber success />
320
+ </div>
321
+ <div>
322
+ <h4 class="maz-font-semibold maz-mb-2">Force Error State</h4>
323
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Always show error styling</p>
324
+ <MazInputPhoneNumber error />
325
+ </div>
326
+ </div>
327
+
328
+ <template #code>
329
+
330
+ ```vue
331
+ <template>
332
+ <!-- Disable auto-formatting -->
333
+ <MazInputPhoneNumber :auto-format="false" />
334
+
335
+ <!-- Hide validation indicators -->
336
+ <MazInputPhoneNumber
337
+ :validation-success="false"
338
+ :validation-error="false"
339
+ />
340
+
341
+ <!-- Force success state -->
342
+ <MazInputPhoneNumber success />
343
+
344
+ <!-- Force error state -->
345
+ <MazInputPhoneNumber error />
346
+ </template>
347
+ ```
348
+
349
+ </template>
350
+ </ComponentDemo>
351
+
352
+ ## Internationalization
353
+
354
+ Make the component speak your users' language.
355
+
356
+ <ComponentDemo>
357
+ <div class="maz-space-y-6">
358
+ <div>
359
+ <h4 class="maz-font-semibold maz-mb-2">Custom Labels</h4>
360
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Translate all text in the interface</p>
361
+ <MazInputPhoneNumber
362
+ :translations="{
363
+ countrySelect: {
364
+ placeholder: 'Select your country',
365
+ error: 'Please choose a country',
366
+ searchPlaceholder: 'Search countries...'
367
+ },
368
+ phoneInput: {
369
+ placeholder: 'Enter phone number',
370
+ example: 'Format: {example}'
371
+ }
372
+ }"
373
+ />
374
+ </div>
375
+ <div>
376
+ <h4 class="maz-font-semibold maz-mb-2">Country Names in French</h4>
377
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Change the language of country names</p>
378
+ <MazInputPhoneNumber country-locale="fr-FR" />
379
+ </div>
380
+ <div>
381
+ <h4 class="maz-font-semibold maz-mb-2">Custom Country Names</h4>
382
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Override specific country names</p>
383
+ <MazInputPhoneNumber
384
+ :custom-countries-list="{
385
+ US: 'United States of America',
386
+ GB: 'United Kingdom',
387
+ FR: 'République Française'
388
+ }"
389
+ />
390
+ </div>
391
+ </div>
392
+
393
+ <template #code>
394
+
395
+ ```vue
396
+ <template>
397
+ <!-- Custom translations -->
398
+ <MazInputPhoneNumber
399
+ :translations="{
400
+ countrySelect: {
401
+ placeholder: 'Select your country',
402
+ error: 'Please choose a country',
403
+ searchPlaceholder: 'Search countries...'
404
+ },
405
+ phoneInput: {
406
+ placeholder: 'Enter phone number',
407
+ example: 'Format: {example}'
408
+ }
409
+ }"
410
+ />
411
+
412
+ <!-- French country names -->
413
+ <MazInputPhoneNumber country-locale="fr-FR" />
414
+
415
+ <!-- Custom country names -->
416
+ <MazInputPhoneNumber
417
+ :custom-countries-list="{
418
+ US: 'United States of America',
419
+ GB: 'United Kingdom',
420
+ FR: 'République Française'
421
+ }"
422
+ />
423
+ </template>
424
+ ```
425
+
426
+ </template>
427
+ </ComponentDemo>
428
+
429
+ ## Custom Flag Styling
430
+
431
+ Replace the default flag emojis with your own design.
432
+
433
+ <ComponentDemo>
434
+ <div class="maz-space-y-6">
435
+ <div>
436
+ <h4 class="maz-font-semibold maz-mb-2">Country Code Badges</h4>
437
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Show country codes instead of flags</p>
438
+ <MazInputPhoneNumber>
439
+ <template #selector-flag="{ countryCode }">
440
+ <span
441
+ id="custom-flag-element"
442
+ class="maz-bg-primary maz-text-primary-foreground maz-px-2 maz-py-1 maz-rounded maz-text-xs maz-font-semibold"
443
+ >
444
+ {{ countryCode }}
445
+ </span>
446
+ </template>
447
+ <template #country-list-flag="{ countryCode }">
448
+ <MazBadge size="sm" class="maz-mr-2 maz-min-w-[2.5rem]">
449
+ {{ countryCode }}
450
+ </MazBadge>
451
+ </template>
452
+ </MazInputPhoneNumber>
453
+ </div>
454
+ <div>
455
+ <h4 class="maz-font-semibold maz-mb-2">Custom Icons</h4>
456
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Use your own flag icons or designs</p>
457
+ <MazInputPhoneNumber>
458
+ <template #selector-flag="{ countryCode }">
459
+ <div
460
+ id="icon-flag-element"
461
+ class="maz-w-6 maz-h-6 maz-bg-gradient-to-r maz-from-blue-500 maz-to-green-500 maz-rounded-full maz-flex maz-items-center maz-justify-center maz-text-white maz-text-xs maz-font-bold"
462
+ >
463
+ {{ countryCode?.charAt(0) }}
464
+ </div>
465
+ </template>
466
+ <template #country-list-flag="{ countryCode }">
467
+ <div class="maz-w-6 maz-h-6 maz-bg-gradient-to-r maz-from-purple-500 maz-to-pink-500 maz-rounded maz-flex maz-items-center maz-justify-center maz-text-white maz-text-xs maz-font-bold maz-mr-2">
468
+ {{ countryCode?.charAt(0) }}
469
+ </div>
470
+ </template>
471
+ </MazInputPhoneNumber>
472
+ </div>
473
+ </div>
474
+
475
+ <template #code>
476
+
477
+ ```vue
478
+ <template>
479
+ <!-- Country code badges -->
480
+ <MazInputPhoneNumber>
481
+ <template #selector-flag="{ countryCode }">
482
+ <span class="country-badge">
483
+ {{ countryCode }}
484
+ </span>
485
+ </template>
486
+ <template #country-list-flag="{ countryCode }">
487
+ <MazBadge size="sm" class="maz-mr-2">
488
+ {{ countryCode }}
489
+ </MazBadge>
490
+ </template>
491
+ </MazInputPhoneNumber>
492
+
493
+ <!-- Custom icons -->
494
+ <MazInputPhoneNumber>
495
+ <template #selector-flag="{ countryCode }">
496
+ <div class="custom-flag-icon">
497
+ {{ countryCode?.charAt(0) }}
498
+ </div>
499
+ </template>
500
+ <template #country-list-flag="{ countryCode }">
501
+ <div class="custom-list-icon">
502
+ {{ countryCode?.charAt(0) }}
503
+ </div>
504
+ </template>
505
+ </MazInputPhoneNumber>
506
+ </template>
507
+
508
+ <style scoped>
509
+ .country-badge {
510
+ @apply maz-bg-primary maz-text-primary-foreground maz-px-2 maz-py-1 maz-rounded maz-text-xs maz-font-semibold;
511
+ }
512
+
513
+ .custom-flag-icon,
514
+ .custom-list-icon {
515
+ @apply maz-w-6 maz-h-6 maz-bg-gradient-to-r maz-from-blue-500 maz-to-green-500 maz-rounded-full maz-flex maz-items-center maz-justify-center maz-text-white maz-text-xs maz-font-bold;
516
+ }
517
+
518
+ .custom-list-icon {
519
+ @apply maz-mr-2;
520
+ }
521
+ </style>
522
+ ```
523
+
524
+ ::: tip SVG Flags
525
+ You can use libraries like [country-flag-icons](https://www.npmjs.com/package/country-flag-icons) to display beautiful SVG flags instead of emoji flags.
526
+ :::
527
+
528
+ </template>
529
+ </ComponentDemo>
530
+
531
+ ## Advanced Configuration
532
+
533
+ Fine-tune the component for specific use cases.
534
+
535
+ <ComponentDemo>
536
+ <div class="maz-space-y-6">
537
+ <div>
538
+ <h4 class="maz-font-semibold maz-mb-2">Phone-only Mode</h4>
539
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Hide country selector, pre-select country</p>
540
+ <MazInputPhoneNumber
541
+ hide-country-select
542
+ country-code="US"
543
+ :translations="{
544
+ phoneInput: {
545
+ placeholder: 'US Phone Number'
546
+ }
547
+ }"
548
+ />
549
+ </div>
550
+ <div>
551
+ <h4 class="maz-font-semibold maz-mb-2">Custom Search Sensitivity</h4>
552
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Adjust how strict country search is (0 = fuzzy, 1 = exact)</p>
553
+ <MazInputPhoneNumber
554
+ :search-threshold="0.3"
555
+ placeholder="Try searching 'unite' for United States"
556
+ />
557
+ </div>
558
+ <div>
559
+ <h4 class="maz-font-semibold maz-mb-2">Disable Search</h4>
560
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Remove search functionality from country list</p>
561
+ <MazInputPhoneNumber :search="false" />
562
+ </div>
563
+ <div>
564
+ <h4 class="maz-font-semibold maz-mb-2">Different Dropdown Position</h4>
565
+ <p class="maz-text-sm maz-text-muted maz-mb-2">Control where the country list appears</p>
566
+ <MazInputPhoneNumber list-position="top-start" />
567
+ </div>
568
+ </div>
569
+
570
+ <template #code>
571
+
572
+ ```vue
573
+ <template>
574
+ <!-- Phone-only mode -->
575
+ <MazInputPhoneNumber
576
+ hide-country-select
577
+ country-code="US"
578
+ :translations="{
579
+ phoneInput: {
580
+ placeholder: 'US Phone Number'
581
+ }
582
+ }"
583
+ />
584
+
585
+ <!-- Fuzzy search -->
586
+ <MazInputPhoneNumber :search-threshold="0.3" />
587
+
588
+ <!-- No search -->
589
+ <MazInputPhoneNumber :search="false" />
590
+
591
+ <!-- Different dropdown position -->
592
+ <MazInputPhoneNumber list-position="top-start" />
593
+ </template>
594
+ ```
595
+
596
+ </template>
597
+ </ComponentDemo>
598
+
599
+ ## Real-world Examples
600
+
601
+ See how to use the component in common scenarios.
602
+
603
+ <ComponentDemo>
604
+ <div class="maz-space-y-8">
605
+ <div>
606
+ <h4 class="maz-font-semibold maz-mb-2">🏢 Business Form</h4>
607
+ <p class="maz-text-sm maz-text-muted maz-mb-4">Perfect for customer registration</p>
608
+ <div class="maz-max-w-md maz-grid maz-grid-cols-1 maz-gap-4">
609
+ <MazInput label="Full Name" placeholder="John Doe" />
610
+ <MazInput label="Email" type="email" placeholder="john@example.com" />
611
+ <MazInputPhoneNumber
612
+ v-model="businessPhone"
613
+ v-model:country-code="businessCountry"
614
+ label="Business Phone"
615
+ :preferred-countries="['US', 'CA', 'GB', 'AU']"
616
+ :validation-success="businessResults?.isValid"
617
+ @data="businessResults = $event"
618
+ />
619
+ <MazBtn color="primary" block>
620
+ Create Account
621
+ </MazBtn>
622
+ </div>
623
+ </div>
624
+ <div>
625
+ <h4 class="maz-font-semibold maz-mb-2">🌍 Global Support</h4>
626
+ <p class="maz-text-sm maz-text-muted maz-mb-4">Multi-language international form</p>
627
+ <div class="maz-max-w-md">
628
+ <MazInputPhoneNumber
629
+ v-model="globalPhone"
630
+ country-locale="es-ES"
631
+ show-code-in-list
632
+ :translations="{
633
+ countrySelect: {
634
+ placeholder: 'País',
635
+ searchPlaceholder: 'Buscar país...'
636
+ },
637
+ phoneInput: {
638
+ placeholder: 'Número de teléfono'
639
+ }
640
+ }"
641
+ />
642
+ </div>
643
+ </div>
644
+ <div>
645
+ <h4 class="maz-font-semibold maz-mb-2">📱 Mobile-first Design</h4>
646
+ <p class="maz-text-sm maz-text-muted maz-mb-4">Optimized for mobile apps</p>
647
+ <div class="maz-max-w-xs">
648
+ <MazInputPhoneNumber
649
+ v-model="mobilePhone"
650
+ orientation="col"
651
+ size="lg"
652
+ fetch-country
653
+ block
654
+ />
655
+ </div>
656
+ </div>
657
+ </div>
658
+
659
+ <template #code>
660
+
661
+ ```vue
662
+ <script setup>
663
+ import { ref } from 'vue'
664
+
665
+ const businessPhone = ref()
666
+ const businessCountry = ref()
667
+ const businessResults = ref()
668
+
669
+ const globalPhone = ref()
670
+ const mobilePhone = ref()
671
+ </script>
672
+
673
+ <template>
674
+ <!-- Business form -->
675
+ <div class="form-container">
676
+ <MazInput label="Full Name" placeholder="John Doe" />
677
+ <MazInput label="Email" type="email" placeholder="john@example.com" />
678
+ <MazInputPhoneNumber
679
+ v-model="businessPhone"
680
+ v-model:country-code="businessCountry"
681
+ label="Business Phone"
682
+ :preferred-countries="['US', 'CA', 'GB', 'AU']"
683
+ @data="businessResults = $event"
684
+ />
685
+ <MazBtn color="primary" block>Create Account</MazBtn>
686
+ </div>
687
+
688
+ <!-- Global support -->
689
+ <MazInputPhoneNumber
690
+ v-model="globalPhone"
691
+ country-locale="es-ES"
692
+ show-code-in-list
693
+ :translations="{
694
+ countrySelect: {
695
+ placeholder: 'País',
696
+ searchPlaceholder: 'Buscar país...'
697
+ },
698
+ phoneInput: {
699
+ placeholder: 'Número de teléfono'
700
+ }
701
+ }"
702
+ />
703
+
704
+ <!-- Mobile-first -->
705
+ <MazInputPhoneNumber
706
+ v-model="mobilePhone"
707
+ orientation="col"
708
+ size="lg"
709
+ fetch-country
710
+ block
711
+ />
712
+ </template>
713
+ ```
714
+
715
+ </template>
716
+ </ComponentDemo>
717
+
718
+ ## Data Handling
719
+
720
+ Understanding what data the component provides.
721
+
722
+ <ComponentDemo>
723
+ <div class="maz-space-y-4">
724
+ <MazInputPhoneNumber
725
+ v-model="dataPhone"
726
+ v-model:country-code="dataCountry"
727
+ label="Enter a phone number to see data"
728
+ @data="phoneData = $event"
729
+ />
730
+ <div v-if="phoneData" class="maz-bg-surface-400 maz-p-4 maz-rounded">
731
+ <h4 class="maz-font-semibold maz-mb-3">📊 Phone Number Data</h4>
732
+ <div class="maz-grid maz-grid-cols-1 md:maz-grid-cols-2 maz-gap-4 maz-text-sm">
733
+ <div>
734
+ <strong>Valid:</strong> {{ phoneData?.isValid ? '✅' : '❌' }}
735
+ </div>
736
+ <div>
737
+ <strong>Country:</strong> {{ phoneData?.countryCode || 'None' }}
738
+ </div>
739
+ <div>
740
+ <strong>National Format:</strong> {{ phoneData?.formatNational || 'None' }}
741
+ </div>
742
+ <div>
743
+ <strong>International:</strong> {{ phoneData?.formatInternational || 'None' }}
744
+ </div>
745
+ <div>
746
+ <strong>E164 Format:</strong> {{ phoneData?.e164 || 'None' }}
747
+ </div>
748
+ <div>
749
+ <strong>Phone Type:</strong> {{ phoneData?.type || 'Unknown' }}
750
+ </div>
751
+ </div>
752
+ </div>
753
+ </div>
754
+
755
+ <template #code>
756
+
757
+ ```vue
758
+ <script setup>
759
+ import { ref } from 'vue'
760
+
761
+ const dataPhone = ref()
762
+ const dataCountry = ref()
763
+ const phoneData = ref()
764
+
765
+ // Handle the data event
766
+ function handlePhoneData(results) {
767
+ console.log('Phone validation results:', results)
768
+ // results contains:
769
+ // - isValid: boolean
770
+ // - countryCode: string
771
+ // - formatNational: string
772
+ // - formatInternational: string
773
+ // - e164: string
774
+ // - type: 'mobile' | 'fixedLine' | etc.
775
+ // - and more...
776
+ }
777
+ </script>
778
+
779
+ <template>
780
+ <MazInputPhoneNumber
781
+ v-model="dataPhone"
782
+ v-model:country-code="dataCountry"
783
+ @data="handlePhoneData"
784
+ />
785
+ </template>
786
+ ```
787
+
788
+ </template>
789
+ </ComponentDemo>
790
+
791
+ ## Troubleshooting
792
+
793
+ Common issues and solutions:
794
+
795
+ ### ⚠️ Auto-formatting Issues
796
+
797
+ For countries like Anguilla (AI) with multiple valid number lengths, disable auto-formatting:
798
+
799
+ ```vue
800
+ <MazInputPhoneNumber :auto-format="false" country-code="AI" />
801
+ ```
802
+
803
+ ### 🌐 Country Detection Not Working
804
+
805
+ Make sure to enable the right detection method:
806
+
807
+ ```vue
808
+ <!-- Browser locale (default) -->
809
+ <MazInputPhoneNumber :use-browser-locale="true" />
810
+
811
+ <!-- IP-based detection (requires internet) -->
812
+ <MazInputPhoneNumber fetch-country />
813
+
814
+ <!-- Manual fallback -->
815
+ <MazInputPhoneNumber country-code="US" />
816
+ ```
817
+
818
+ ## Types
819
+
820
+ **Results object emitted by `@data` event:**
821
+
822
+ ```ts
823
+ interface MazInputPhoneNumberData {
824
+ isValid: boolean
825
+ isPossible?: boolean
826
+ countryCode?: CountryCode
827
+ countryCallingCode?: CountryCallingCode
828
+ nationalNumber?: NationalNumber
829
+ type?: NumberType
830
+ formatInternational?: string
831
+ formatNational?: string
832
+ uri?: string
833
+ e164?: string
834
+ rfc3966?: string
835
+ possibleCountries?: CountryCode[]
836
+ phoneNumber?: string
837
+ }
838
+ ```
839
+
840
+ <!--@include: ./../.vitepress/mixins/maz-input-props.md-->
841
+ <!--@include: ./../../.vitepress/generated-docs/maz-input-phone-number.doc.md-->
842
+
843
+ <script setup lang="ts">
844
+ import { ref } from 'vue'
845
+
846
+ // Basic usage
847
+ const phoneNumber = ref()
848
+ const countryCode = ref()
849
+ const results = ref()
850
+
851
+ // Country management
852
+ const phone1 = ref()
853
+ const phone2 = ref()
854
+ const phone3 = ref()
855
+
856
+ // Real-world examples
857
+ const businessPhone = ref()
858
+ const businessCountry = ref()
859
+ const businessResults = ref()
860
+ const globalPhone = ref()
861
+ const mobilePhone = ref()
862
+
863
+ // Data handling
864
+ const dataPhone = ref()
865
+ const dataCountry = ref()
866
+ const phoneData = ref()
867
+ </script>