maz-ui 4.0.0-beta.26 → 4.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/MazInputPhoneNumber.DQKElfIM.css +1 -0
- package/dist/assets/{MazSelectCountry.D3fSImar.css → MazSelectCountry.EW8fKXFX.css} +1 -1
- package/dist/assets/{PhoneInput.BJiKqOF6.css → PhoneInput.DCWA_-gC.css} +1 -1
- package/dist/chunks/{MazInputPhoneNumber.Ch-PCGiv.js → MazInputPhoneNumber.BVHi0OiN.js} +18 -10
- package/dist/chunks/{PhoneInput.BzL1_XS5.js → PhoneInput.D9vRIgS6.js} +19 -26
- package/dist/components/MazInputPhoneNumber.js +1 -1
- package/dist/components/MazSelectCountry.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/composables/useInstanceUniqId.js +3 -2
- package/dist/types/components/MazInputPhoneNumber/PhoneInput.vue.d.ts +1 -1
- package/dist/types/components/MazInputPhoneNumber/useLibphonenumber.d.ts +1 -1
- package/dist/types/components/MazInputPhoneNumber/useMazInputPhoneNumber.d.ts +2 -0
- package/dist/types/components/MazInputPhoneNumber.vue.d.ts +7 -8
- package/package.json +9 -9
- package/dist/assets/MazInputPhoneNumber.CrXS7DOY.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.m-input-phone-number[data-v-1180c2f2]{vertical-align:top;align-items:center;display:inline-flex;position:relative}.m-input-phone-number.--block[data-v-1180c2f2]{width:100%}.m-input-phone-number.--col[data-v-1180c2f2]{flex-direction:column}.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-1180c2f2],.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-1180c2f2] .m-select-country__select{min-width:100%}.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-1180c2f2] .m-select-country__select .m-input-wrapper{border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--maz-radius)}.m-input-phone-number.--row[data-v-1180c2f2]{flex-direction:row}.m-input-phone-number.--row .m-input-phone-number__country-select[data-v-1180c2f2] .m-select-country__select .m-input-wrapper{border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.m-input-phone-number.--responsive[data-v-1180c2f2]{flex-direction:column}@media (min-width:576px){.m-input-phone-number.--responsive[data-v-1180c2f2]{flex-direction:row}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2]{min-width:100%}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2]{min-width:inherit}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2] .m-select-country__select{min-width:100%}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2] .m-select-country__select{min-width:inherit}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2] .m-input-wrapper{border-bottom-right-radius:0;border-bottom-left-radius:0}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-1180c2f2] .m-input-wrapper{border-bottom-right-radius:var(--maz-radius);border-bottom-left-radius:var(--maz-radius);border-top-right-radius:0;border-bottom-right-radius:0}}.m-input-phone-number__country-list-code[data-v-1180c2f2]{text-align:center;--maz-tw-text-opacity:1;min-width:2rem;color:hsl(var(--maz-muted)/var(--maz-tw-text-opacity,1))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.m-select-country[data-v-
|
|
1
|
+
.m-select-country[data-v-48f9a413]{display:inline-flex;position:relative}.m-select-country__country-flag[data-v-48f9a413]{z-index:4;cursor:pointer;border:none;outline:none;justify-content:center;align-items:center;margin:0;padding:0;display:flex;position:absolute;top:1.25rem;left:.813rem}.m-select-country__country-flag.--should-have-bottom-flag[data-v-48f9a413]{bottom:2px}.m-select-country__select[data-v-48f9a413] .m-input-label{padding:0!important}.m-select-country__select__item[data-v-48f9a413]{text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:.5rem;width:100%;font-size:.875rem;line-height:1.25rem;display:flex;overflow:hidden}.m-select-country__select__item__flag-container[data-v-48f9a413]{justify-content:center;align-items:center;display:flex}.m-select-country__select__item__list-flag[data-v-48f9a413]{--maz-tw-bg-opacity:1;background-color:hsl(var(--maz-primary-500)/var(--maz-tw-bg-opacity,1));width:1.25rem;height:1.25rem;color:hsl(var(--maz-primary-foreground)/.8);border-radius:9999px;justify-content:center;align-items:center;font-size:.75rem;line-height:1;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.m-phone-input[data-v-
|
|
1
|
+
.m-phone-input[data-v-6446d93b]{flex:1;min-width:13rem}.m-phone-input.--error[data-v-6446d93b],.m-phone-input.--focused[data-v-6446d93b]{z-index:1}.m-input-phone-number[data-v-6446d93b]{display:none}.m-input-phone-number.--responsive .m-phone-input[data-v-6446d93b]{margin-top:calc(var(--maz-border-width)*-1);flex:none}@media (min-width:425px){.m-input-phone-number.--responsive .m-phone-input[data-v-6446d93b]{margin-left:calc(var(--maz-border-width)*-1);flex:auto;margin-top:0}}.m-input-phone-number.--responsive .m-phone-input.--border-radius[data-v-6446d93b] .m-input-wrapper{border-top-left-radius:0;border-top-right-radius:0}@media (min-width:425px){.m-input-phone-number.--responsive .m-phone-input.--border-radius[data-v-6446d93b] .m-input-wrapper{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--maz-radius)}}.m-input-phone-number.--row .m-phone-input[data-v-6446d93b]{margin-left:calc(var(--maz-border-width)*-1);flex:auto}.m-input-phone-number.--row .m-phone-input.--border-radius[data-v-6446d93b] .m-input-wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.m-input-phone-number.--col .m-phone-input[data-v-6446d93b]{margin-top:calc(var(--maz-border-width)*-1);flex:none;margin-left:0}.m-input-phone-number.--col .m-phone-input.--border-radius[data-v-6446d93b] .m-input-wrapper{border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--maz-radius)}
|
|
@@ -3,7 +3,7 @@ import { u as useTranslations } from "./useTranslations.D5aoYwD7.js";
|
|
|
3
3
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
4
4
|
import { getCountryCallingCode, getCountries, isSupportedCountry, getExampleNumber, parsePhoneNumberFromString, AsYouType } from "libphonenumber-js";
|
|
5
5
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper.B--vMWp3.js";
|
|
6
|
-
import '../assets/MazInputPhoneNumber.
|
|
6
|
+
import '../assets/MazInputPhoneNumber.DQKElfIM.css';const examples = ref();
|
|
7
7
|
function isCountryAvailable(locale) {
|
|
8
8
|
try {
|
|
9
9
|
const response = isSupportedCountry(locale);
|
|
@@ -57,9 +57,9 @@ function getPhoneNumberExample(countryCode) {
|
|
|
57
57
|
}
|
|
58
58
|
function getAsYouTypeFormat(countryCode, phoneNumber) {
|
|
59
59
|
try {
|
|
60
|
-
return !phoneNumber || !countryCode ?
|
|
60
|
+
return !phoneNumber || !countryCode || typeof countryCode != "string" || countryCode.length !== 2 ? phoneNumber : new AsYouType(countryCode).input(phoneNumber);
|
|
61
61
|
} catch (error) {
|
|
62
|
-
|
|
62
|
+
return console.error(`[MazInputPhoneNumber](getAsYouTypeFormat) Error with countryCode: "${countryCode}", phoneNumber: "${phoneNumber}"`, error), phoneNumber;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function isSameCountryCallingCode(countryCode, countryCode2) {
|
|
@@ -149,11 +149,18 @@ async function fetchCountryCode() {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
function sanitizePhoneNumber(input) {
|
|
153
|
+
if (!input)
|
|
154
|
+
return "";
|
|
155
|
+
const regex = new RegExp(/[^\d ()+-]/g);
|
|
156
|
+
return input.replaceAll(regex, "").trim();
|
|
157
|
+
}
|
|
152
158
|
function useMazInputPhoneNumber() {
|
|
153
159
|
return {
|
|
154
160
|
fetchCountryCode,
|
|
155
161
|
getBrowserLocale,
|
|
156
|
-
getCountryList
|
|
162
|
+
getCountryList,
|
|
163
|
+
sanitizePhoneNumber
|
|
157
164
|
};
|
|
158
165
|
}
|
|
159
166
|
const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-list-code" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -185,7 +192,7 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
185
192
|
hideCountrySelect: { type: Boolean, default: !1 },
|
|
186
193
|
showCodeInList: { type: Boolean, default: !1 },
|
|
187
194
|
customCountriesList: { default: void 0 },
|
|
188
|
-
autoFormat: { type: Boolean, default:
|
|
195
|
+
autoFormat: { type: [String, Boolean], default: "blur" },
|
|
189
196
|
countryLocale: { default: void 0 },
|
|
190
197
|
validationError: { type: Boolean, default: !0 },
|
|
191
198
|
validationSuccess: { type: Boolean, default: !0 },
|
|
@@ -209,7 +216,7 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
209
216
|
},
|
|
210
217
|
emits: ["update:model-value", "country-code", "update:country-code", "data"],
|
|
211
218
|
setup(__props, { emit: __emit }) {
|
|
212
|
-
const props = __props, emits = __emit, MazSelectCountry = defineAsyncComponent(() => import("../components/MazSelectCountry.js")), PhoneInput = defineAsyncComponent(() => import("./PhoneInput.
|
|
219
|
+
const props = __props, emits = __emit, MazSelectCountry = defineAsyncComponent(() => import("../components/MazSelectCountry.js")), PhoneInput = defineAsyncComponent(() => import("./PhoneInput.D9vRIgS6.js")), { fetchCountryCode: fetchCountryCode2, getBrowserLocale: getBrowserLocale2, getCountryList: getCountryList2 } = useMazInputPhoneNumber(), { isCountryAvailable: isCountryAvailable2, getPhoneNumberResults: getPhoneNumberResults2 } = useLibphonenumber(), instanceId = useInstanceUniqId({
|
|
213
220
|
componentName: "MazInputPhoneNumber",
|
|
214
221
|
providedId: props.id
|
|
215
222
|
}), phoneNumber = ref(), selectedCountry = ref(), { t } = useTranslations(), messages = computed(() => ({
|
|
@@ -222,7 +229,7 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
222
229
|
placeholder: props.translations?.phoneInput?.placeholder || t("inputPhoneNumber.phoneInput.placeholder"),
|
|
223
230
|
example: props.translations?.phoneInput?.example
|
|
224
231
|
}
|
|
225
|
-
})), isPhoneNumberInternalUpdate = ref(!1), isCountryInternalUpdate = ref(!1),
|
|
232
|
+
})), isPhoneNumberInternalUpdate = ref(!1), isCountryInternalUpdate = ref(!1), results = ref({
|
|
226
233
|
isValid: !1,
|
|
227
234
|
countryCode: props.countryCode,
|
|
228
235
|
phoneNumber: props.modelValue
|
|
@@ -273,7 +280,7 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
273
280
|
updateTheResults({ phone: newPhoneNumber }), results.value.parsedCountryCode && results.value.parsedCountryCode !== selectedCountry.value && onCountryChanged({
|
|
274
281
|
countryCode: results.value.parsedCountryCode,
|
|
275
282
|
updateResults: !1
|
|
276
|
-
}), results.value.isValid &&
|
|
283
|
+
}), results.value.isValid && (props.autoFormat === "blur" || props.autoFormat === "typing") ? phoneNumber.value = results.value.formatNational?.trim().replace(new RegExp(/\D/g), "") : phoneNumber.value = newPhoneNumber, isPhoneNumberInternalUpdate.value = !0, results.value.e164 ? emits("update:model-value", results.value.e164) : emits("update:model-value", results.value.phoneNumber), setTimeout(() => {
|
|
277
284
|
isPhoneNumberInternalUpdate.value = !1;
|
|
278
285
|
}, 0);
|
|
279
286
|
}
|
|
@@ -381,7 +388,7 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
381
388
|
}, { ..._ctx.$attrs, ..._ctx.phoneInputAttributes }, {
|
|
382
389
|
color: _ctx.color,
|
|
383
390
|
size: _ctx.size,
|
|
384
|
-
"auto-format":
|
|
391
|
+
"auto-format": _ctx.autoFormat,
|
|
385
392
|
example: _ctx.example,
|
|
386
393
|
block: "",
|
|
387
394
|
disabled: _ctx.disabled,
|
|
@@ -396,8 +403,9 @@ const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-
|
|
|
396
403
|
}), null, 16, ["id", "model-value", "color", "size", "auto-format", "example", "disabled", "name", "has-radius", "success", "error", "locales", "label", "placeholder"])
|
|
397
404
|
], 14, _hoisted_1));
|
|
398
405
|
}
|
|
399
|
-
}), MazInputPhoneNumber = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
406
|
+
}), MazInputPhoneNumber = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1180c2f2"]]);
|
|
400
407
|
export {
|
|
401
408
|
MazInputPhoneNumber as M,
|
|
409
|
+
useMazInputPhoneNumber as a,
|
|
402
410
|
useLibphonenumber as u
|
|
403
411
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, ref, computed, onMounted,
|
|
1
|
+
import { defineComponent, mergeModels, useModel, ref, computed, onMounted, useTemplateRef, createBlock, openBlock, mergeProps, unref } from "vue";
|
|
2
2
|
import { u as useTranslations } from "./useTranslations.D5aoYwD7.js";
|
|
3
3
|
import { useInjectStrict } from "../composables/useInjectStrict.js";
|
|
4
4
|
import MazInput from "../components/MazInput.js";
|
|
5
|
-
import { u as useLibphonenumber } from "./MazInputPhoneNumber.
|
|
5
|
+
import { u as useLibphonenumber, a as useMazInputPhoneNumber } from "./MazInputPhoneNumber.BVHi0OiN.js";
|
|
6
6
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper.B--vMWp3.js";
|
|
7
|
-
import '../assets/PhoneInput.
|
|
7
|
+
import '../assets/PhoneInput.DCWA_-gC.css';const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
8
|
__name: "PhoneInput",
|
|
9
9
|
props: /* @__PURE__ */ mergeModels({
|
|
10
10
|
style: {},
|
|
@@ -40,26 +40,22 @@ import '../assets/PhoneInput.BJiKqOF6.css';const _sfc_main = /* @__PURE__ */ def
|
|
|
40
40
|
locales: {},
|
|
41
41
|
example: { type: Boolean },
|
|
42
42
|
hasRadius: { type: Boolean },
|
|
43
|
-
autoFormat: { type: Boolean }
|
|
43
|
+
autoFormat: { type: [String, Boolean] }
|
|
44
44
|
}, {
|
|
45
45
|
modelValue: {},
|
|
46
46
|
modelModifiers: {}
|
|
47
47
|
}),
|
|
48
48
|
emits: ["update:modelValue"],
|
|
49
49
|
setup(__props, { expose: __expose }) {
|
|
50
|
-
const { getPhoneNumberExample, getAsYouTypeFormat, loadExamples } = useLibphonenumber(), { results, selectedCountry } = useInjectStrict("mazInputPhoneNumberData"), modelValue = useModel(__props, "modelValue")
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const rawDigits = extractRawDigits(value);
|
|
60
|
-
rawValue.value = rawDigits, modelValue.value = rawDigits;
|
|
61
|
-
}
|
|
62
|
-
const { t } = useTranslations();
|
|
50
|
+
const { getPhoneNumberExample, getAsYouTypeFormat, loadExamples } = useLibphonenumber(), { sanitizePhoneNumber } = useMazInputPhoneNumber(), { results, selectedCountry } = useInjectStrict("mazInputPhoneNumberData"), modelValue = useModel(__props, "modelValue"), inputFocused = ref(!1), asYouTypeFormatted = computed(() => {
|
|
51
|
+
const phoneNumberToFormat = results.value.isValid ? results.value.formatNational : modelValue.value;
|
|
52
|
+
return getAsYouTypeFormat(selectedCountry.value, phoneNumberToFormat) || phoneNumberToFormat;
|
|
53
|
+
}), displayedPhoneNumber = computed({
|
|
54
|
+
get: () => !inputFocused.value && __props.autoFormat === "blur" || __props.autoFormat === "typing" ? asYouTypeFormatted.value : modelValue.value,
|
|
55
|
+
set: (value) => {
|
|
56
|
+
modelValue.value = sanitizePhoneNumber(value);
|
|
57
|
+
}
|
|
58
|
+
}), { t } = useTranslations();
|
|
63
59
|
function getCountryPhoneNumberExample(selectedCountry2) {
|
|
64
60
|
const example = getPhoneNumberExample(selectedCountry2);
|
|
65
61
|
if (example)
|
|
@@ -78,9 +74,6 @@ import '../assets/PhoneInput.BJiKqOF6.css';const _sfc_main = /* @__PURE__ */ def
|
|
|
78
74
|
}), inputProps = computed(() => __props.placeholder ? { placeholder: inputLabelOrPlaceholder.value } : { label: inputLabelOrPlaceholder.value });
|
|
79
75
|
onMounted(() => {
|
|
80
76
|
__props.example && loadExamples();
|
|
81
|
-
}), watch(() => modelValue.value, (newValue) => {
|
|
82
|
-
const newRawValue = extractRawDigits(newValue);
|
|
83
|
-
newRawValue !== rawValue.value && (rawValue.value = newRawValue);
|
|
84
77
|
});
|
|
85
78
|
const inputRef = useTemplateRef("input");
|
|
86
79
|
return __expose({
|
|
@@ -93,7 +86,8 @@ import '../assets/PhoneInput.BJiKqOF6.css';const _sfc_main = /* @__PURE__ */ def
|
|
|
93
86
|
}
|
|
94
87
|
}), (_ctx, _cache) => (openBlock(), createBlock(MazInput, mergeProps({ id: _ctx.id }, { ..._ctx.$attrs, ...inputProps.value }, {
|
|
95
88
|
ref: "input",
|
|
96
|
-
|
|
89
|
+
modelValue: displayedPhoneNumber.value,
|
|
90
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayedPhoneNumber.value = $event),
|
|
97
91
|
disabled: _ctx.disabled,
|
|
98
92
|
color: _ctx.color,
|
|
99
93
|
error: _ctx.error,
|
|
@@ -110,12 +104,11 @@ import '../assets/PhoneInput.BJiKqOF6.css';const _sfc_main = /* @__PURE__ */ def
|
|
|
110
104
|
"--focused": inputFocused.value
|
|
111
105
|
}
|
|
112
106
|
]],
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}), null, 16, ["id", "model-value", "disabled", "color", "error", "size", "success", "name", "inputmode", "autocomplete", "class"]));
|
|
107
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => inputFocused.value = !0),
|
|
108
|
+
onBlur: _cache[2] || (_cache[2] = ($event) => inputFocused.value = !1)
|
|
109
|
+
}), null, 16, ["id", "modelValue", "disabled", "color", "error", "size", "success", "name", "inputmode", "autocomplete", "class"]));
|
|
117
110
|
}
|
|
118
|
-
}), PhoneInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
111
|
+
}), PhoneInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6446d93b"]]);
|
|
119
112
|
export {
|
|
120
113
|
PhoneInput as default
|
|
121
114
|
};
|
|
@@ -5,7 +5,7 @@ import { useDisplayNames } from "../composables/useDisplayNames.js";
|
|
|
5
5
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
6
6
|
import MazSelect from "./MazSelect.js";
|
|
7
7
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
8
|
-
import '../assets/MazSelectCountry.
|
|
8
|
+
import '../assets/MazSelectCountry.EW8fKXFX.css';function getBrowserLocale() {
|
|
9
9
|
try {
|
|
10
10
|
return isServer() ? void 0 : globalThis.navigator.language;
|
|
11
11
|
} catch (error) {
|
|
@@ -126,7 +126,7 @@ const _hoisted_1 = {
|
|
|
126
126
|
required: _ctx.required,
|
|
127
127
|
"search-function": _ctx.searchFunction,
|
|
128
128
|
"format-input-value": _ctx.formatInputValue,
|
|
129
|
-
|
|
129
|
+
translations: messages.value,
|
|
130
130
|
"search-threshold": _ctx.searchThreshold,
|
|
131
131
|
options: countriesOptions.value,
|
|
132
132
|
hint: _ctx.hint,
|
|
@@ -191,10 +191,10 @@ const _hoisted_1 = {
|
|
|
191
191
|
], 2)
|
|
192
192
|
]),
|
|
193
193
|
_: 3
|
|
194
|
-
}, 16, ["id", "model-value", "option-value-key", "option-label-key", "option-input-value-key", "max-list-width", "min-list-width", "disabled", "color", "placeholder", "label", "size", "list-position", "error", "warning", "success", "search", "block", "autocomplete", "item-height", "max-list-height", "min-list-height", "required", "search-function", "format-input-value", "
|
|
194
|
+
}, 16, ["id", "model-value", "option-value-key", "option-label-key", "option-input-value-key", "max-list-width", "min-list-width", "disabled", "color", "placeholder", "label", "size", "list-position", "error", "warning", "success", "search", "block", "autocomplete", "item-height", "max-list-height", "min-list-height", "required", "search-function", "format-input-value", "translations", "search-threshold", "options", "hint", "open"])
|
|
195
195
|
], 6));
|
|
196
196
|
}
|
|
197
|
-
}), MazSelectCountry = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
197
|
+
}), MazSelectCountry = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-48f9a413"]]);
|
|
198
198
|
export {
|
|
199
199
|
MazSelectCountry as default
|
|
200
200
|
};
|
package/dist/components/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { default as default23 } from "./MazIcon.js";
|
|
|
27
27
|
import { default as default24 } from "./MazInput.js";
|
|
28
28
|
import { default as default25 } from "./MazInputCode.js";
|
|
29
29
|
import { _ as _4 } from "../chunks/MazInputNumber.vue_vue_type_style_index_0_lang.B6DYpHfi.js";
|
|
30
|
-
import { M as M2 } from "../chunks/MazInputPhoneNumber.
|
|
30
|
+
import { M as M2 } from "../chunks/MazInputPhoneNumber.BVHi0OiN.js";
|
|
31
31
|
import { _ as _5 } from "../chunks/MazInputPrice.vue_vue_type_script_setup_true_lang.BA6TDX-T.js";
|
|
32
32
|
import { default as default26 } from "./MazInputTags.js";
|
|
33
33
|
import { default as default27 } from "./MazLazyImg.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useId, computed } from "vue";
|
|
2
2
|
function useInstanceUniqId({
|
|
3
3
|
componentName,
|
|
4
4
|
providedId
|
|
5
5
|
}) {
|
|
6
|
-
|
|
6
|
+
const generatedId = useId();
|
|
7
|
+
return computed(() => providedId || `${componentName}-${generatedId.replace(/:/g, "")}`);
|
|
7
8
|
}
|
|
8
9
|
export {
|
|
9
10
|
useInstanceUniqId
|
|
@@ -8,7 +8,7 @@ declare function getPhoneNumberResults({ phoneNumber, countryCode, checkCountryC
|
|
|
8
8
|
}): MazInputPhoneNumberData;
|
|
9
9
|
declare function getPhoneNumberExamplesFile(): Promise<Examples>;
|
|
10
10
|
declare function getPhoneNumberExample(countryCode?: CountryCode | undefined | null): string | undefined;
|
|
11
|
-
declare function getAsYouTypeFormat(countryCode?: CountryCode | undefined | null, phoneNumber?: string | undefined | null): string | undefined;
|
|
11
|
+
declare function getAsYouTypeFormat(countryCode?: CountryCode | undefined | null, phoneNumber?: string | undefined | null): string | undefined | null;
|
|
12
12
|
declare function isSameCountryCallingCode(countryCode: CountryCode, countryCode2: CountryCode): boolean;
|
|
13
13
|
declare function loadExamples(): Promise<void>;
|
|
14
14
|
export declare function useLibphonenumber(): {
|
|
@@ -16,9 +16,11 @@ declare function fetchCountryCode(): Promise<{
|
|
|
16
16
|
data: undefined;
|
|
17
17
|
error: Error;
|
|
18
18
|
}>;
|
|
19
|
+
declare function sanitizePhoneNumber(input?: string | undefined | null): string;
|
|
19
20
|
export declare function useMazInputPhoneNumber(): {
|
|
20
21
|
fetchCountryCode: typeof fetchCountryCode;
|
|
21
22
|
getBrowserLocale: typeof getBrowserLocale;
|
|
22
23
|
getCountryList: typeof getCountryList;
|
|
24
|
+
sanitizePhoneNumber: typeof sanitizePhoneNumber;
|
|
23
25
|
};
|
|
24
26
|
export {};
|
|
@@ -171,12 +171,11 @@ export interface MazInputPhoneNumberProps {
|
|
|
171
171
|
customCountriesList?: Record<CountryCode, string>;
|
|
172
172
|
/**
|
|
173
173
|
* Disabled auto-format when phone is valid
|
|
174
|
-
* @default
|
|
174
|
+
* @default 'blur'
|
|
175
175
|
*/
|
|
176
|
-
autoFormat?:
|
|
176
|
+
autoFormat?: 'blur' | 'typing' | 'disabled' | false;
|
|
177
177
|
/**
|
|
178
178
|
* Locale of country list
|
|
179
|
-
* @type {string}
|
|
180
179
|
* @example "fr-FR"
|
|
181
180
|
*/
|
|
182
181
|
countryLocale?: string;
|
|
@@ -298,7 +297,7 @@ declare function __VLS_template(): {
|
|
|
298
297
|
};
|
|
299
298
|
example: boolean;
|
|
300
299
|
hasRadius: boolean;
|
|
301
|
-
autoFormat:
|
|
300
|
+
autoFormat: "blur" | "typing" | "disabled" | false;
|
|
302
301
|
}> & Readonly<{
|
|
303
302
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
304
303
|
}>, {
|
|
@@ -324,7 +323,7 @@ declare function __VLS_template(): {
|
|
|
324
323
|
};
|
|
325
324
|
example: boolean;
|
|
326
325
|
hasRadius: boolean;
|
|
327
|
-
autoFormat:
|
|
326
|
+
autoFormat: "blur" | "typing" | "disabled" | false;
|
|
328
327
|
}> & Readonly<{
|
|
329
328
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
330
329
|
}>, {
|
|
@@ -356,7 +355,7 @@ declare const __VLS_component: import('vue').DefineComponent<MazInputPhoneNumber
|
|
|
356
355
|
searchThreshold: number;
|
|
357
356
|
hideFlags: boolean;
|
|
358
357
|
showCodeInList: boolean;
|
|
359
|
-
autoFormat:
|
|
358
|
+
autoFormat: "blur" | "typing" | "disabled" | false;
|
|
360
359
|
hideCountrySelect: boolean;
|
|
361
360
|
customCountriesList: Record<CountryCode, string>;
|
|
362
361
|
countryLocale: string;
|
|
@@ -380,7 +379,7 @@ declare const __VLS_component: import('vue').DefineComponent<MazInputPhoneNumber
|
|
|
380
379
|
};
|
|
381
380
|
example: boolean;
|
|
382
381
|
hasRadius: boolean;
|
|
383
|
-
autoFormat:
|
|
382
|
+
autoFormat: "blur" | "typing" | "disabled" | false;
|
|
384
383
|
}> & Readonly<{
|
|
385
384
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
386
385
|
}>, {
|
|
@@ -406,7 +405,7 @@ declare const __VLS_component: import('vue').DefineComponent<MazInputPhoneNumber
|
|
|
406
405
|
};
|
|
407
406
|
example: boolean;
|
|
408
407
|
hasRadius: boolean;
|
|
409
|
-
autoFormat:
|
|
408
|
+
autoFormat: "blur" | "typing" | "disabled" | false;
|
|
410
409
|
}> & Readonly<{
|
|
411
410
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
412
411
|
}>, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maz-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.27",
|
|
5
5
|
"description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"typecheck": "vue-tsc --noEmit --skipLibCheck"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
|
-
"nuxt": "
|
|
165
|
+
"nuxt": ">=3.4.0 <5.0.0",
|
|
166
166
|
"unplugin-auto-import": ">=19.0.0 <20.0.0",
|
|
167
167
|
"unplugin-vue-components": ">=28.0.0 <29.0.0",
|
|
168
168
|
"vue": "^3.5.0",
|
|
@@ -184,11 +184,11 @@
|
|
|
184
184
|
},
|
|
185
185
|
"dependencies": {
|
|
186
186
|
"@floating-ui/vue": "^1.1.8",
|
|
187
|
-
"@maz-ui/cli": "4.0.0-beta.
|
|
188
|
-
"@maz-ui/icons": "4.0.0-beta.
|
|
189
|
-
"@maz-ui/themes": "4.0.0-beta.
|
|
190
|
-
"@maz-ui/translations": "4.0.0-beta.
|
|
191
|
-
"@maz-ui/utils": "4.0.0-beta.
|
|
187
|
+
"@maz-ui/cli": "4.0.0-beta.27",
|
|
188
|
+
"@maz-ui/icons": "4.0.0-beta.27",
|
|
189
|
+
"@maz-ui/themes": "4.0.0-beta.27",
|
|
190
|
+
"@maz-ui/translations": "4.0.0-beta.27",
|
|
191
|
+
"@maz-ui/utils": "4.0.0-beta.27",
|
|
192
192
|
"chart.js": "^4.5.0",
|
|
193
193
|
"dayjs": "^1.11.13",
|
|
194
194
|
"libphonenumber-js": "^1.12.10",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
},
|
|
198
198
|
"devDependencies": {
|
|
199
199
|
"@maz-ui/eslint-config": "4.0.0-beta.25",
|
|
200
|
-
"@maz-ui/node": "4.0.0-beta.
|
|
200
|
+
"@maz-ui/node": "4.0.0-beta.27",
|
|
201
201
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
202
202
|
"@vitest/coverage-v8": "^3.2.4",
|
|
203
203
|
"@vue/compiler-sfc": "^3.5.18",
|
|
@@ -238,5 +238,5 @@
|
|
|
238
238
|
"*.{js,ts,vue,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix",
|
|
239
239
|
"*.{vue,css,scss,postcss,pcss}": "stylelint --fix --allow-empty-input"
|
|
240
240
|
},
|
|
241
|
-
"gitHead": "
|
|
241
|
+
"gitHead": "fc5b5e42f115cc8b7fe4d6436defb078e3f36662"
|
|
242
242
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.m-input-phone-number[data-v-941c0e2b]{vertical-align:top;align-items:center;display:inline-flex;position:relative}.m-input-phone-number.--block[data-v-941c0e2b]{width:100%}.m-input-phone-number.--col[data-v-941c0e2b]{flex-direction:column}.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-941c0e2b],.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-941c0e2b] .m-select-country__select{min-width:100%}.m-input-phone-number.--col .m-input-phone-number__country-select[data-v-941c0e2b] .m-select-country__select .m-input-wrapper{border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--maz-radius)}.m-input-phone-number.--row[data-v-941c0e2b]{flex-direction:row}.m-input-phone-number.--row .m-input-phone-number__country-select[data-v-941c0e2b] .m-select-country__select .m-input-wrapper{border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.m-input-phone-number.--responsive[data-v-941c0e2b]{flex-direction:column}@media (min-width:576px){.m-input-phone-number.--responsive[data-v-941c0e2b]{flex-direction:row}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b]{min-width:100%}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b]{min-width:inherit}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b] .m-select-country__select{min-width:100%}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b] .m-select-country__select{min-width:inherit}}.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b] .m-input-wrapper{border-bottom-right-radius:0;border-bottom-left-radius:0}@media (min-width:576px){.m-input-phone-number.--responsive .m-input-phone-number__country-select[data-v-941c0e2b] .m-input-wrapper{border-bottom-right-radius:var(--maz-radius);border-bottom-left-radius:var(--maz-radius);border-top-right-radius:0;border-bottom-right-radius:0}}.m-input-phone-number__country-list-code[data-v-941c0e2b]{text-align:center;--maz-tw-text-opacity:1;min-width:2rem;color:hsl(var(--maz-muted)/var(--maz-tw-text-opacity,1))}
|