maz-ui 4.7.5 → 4.7.6
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/chunks/MazAccordion.CKnz73h4.js +1 -0
- package/dist/chunks/MazAlert.B8hE7wet.js +1 -0
- package/dist/chunks/MazAnimatedCounter.GLLYbZAz.js +1 -0
- package/dist/chunks/MazAnimatedElement._8NY8WgC.js +1 -0
- package/dist/chunks/MazAnimatedText.BSZ8FNf-.js +1 -0
- package/dist/chunks/MazAvatar.vO5VNPi8.js +1 -0
- package/dist/chunks/MazBackdrop.Cjbwi8-V.js +1 -0
- package/dist/chunks/MazBadge.BBZJgHXm.js +1 -0
- package/dist/chunks/MazBottomSheet.WgZ6qobx.js +1 -0
- package/dist/chunks/MazBtn.Cc9C1v2l.js +1 -0
- package/dist/chunks/MazBtnGroup.3B1XcqWM.js +1 -0
- package/dist/chunks/MazCard.YYC0LaHY.js +1 -0
- package/dist/chunks/MazCardSpotlight.SpZF61hl.js +1 -0
- package/dist/chunks/MazCarousel.1NT4jcvR.js +1 -0
- package/dist/chunks/MazChart.CDZ2PBTC.js +1 -0
- package/dist/chunks/MazCheckbox.DurIbKdf.js +1 -0
- package/dist/chunks/MazChecklist.D9ezwGpQ.js +1 -0
- package/dist/chunks/MazCircularProgressBar.rATx_hD9.js +1 -0
- package/dist/chunks/MazContainer.zXcfMOs-.js +1 -0
- package/dist/chunks/MazDatePicker.KUP34cbV.js +1 -0
- package/dist/chunks/MazDialog.CtKF3Xzo.js +1 -0
- package/dist/chunks/MazDialogConfirm.CAAHeBPE.js +1 -0
- package/dist/chunks/MazDrawer.Dc_RGG8a.js +1 -0
- package/dist/chunks/MazDropdown.2DUcivzO.js +1 -0
- package/dist/chunks/MazDropzone.CiWiPcFM.js +1 -0
- package/dist/chunks/MazExpandAnimation.CMMwtuQA.js +1 -0
- package/dist/chunks/MazFullscreenLoader.BIVRcZJ8.js +1 -0
- package/dist/chunks/MazGallery.CEmGy0K9.js +1 -0
- package/dist/chunks/MazIcon.ZWAk25ZX.js +1 -0
- package/dist/chunks/MazInput.DJjWLaKg.js +1 -0
- package/dist/chunks/MazInputCode.DKnl3i-X.js +1 -0
- package/dist/chunks/MazInputNumber.B42Mn-9h.js +1 -0
- package/dist/chunks/MazInputPhoneNumber.CLivThtK.js +1 -0
- package/dist/chunks/MazInputPrice.BeL-M944.js +1 -0
- package/dist/chunks/MazInputTags.CIVT9F6Q.js +1 -0
- package/dist/chunks/MazLazyImg.-EMwandx.js +1 -0
- package/dist/chunks/MazLink.BOpxMATj.js +1 -0
- package/dist/chunks/MazLoadingBar.C86AX2Tk.js +1 -0
- package/dist/chunks/MazPagination.CNNKXBsg.js +1 -0
- package/dist/chunks/MazPickerCalendarDays.CSZZbk5Z.js +1 -0
- package/dist/chunks/MazPickerCalendarGrid.DrUHBH6-.js +1 -0
- package/dist/chunks/MazPickerContainer.BZ74M74V.js +1 -0
- package/dist/chunks/MazPopover.Co8BEopX.js +1 -0
- package/dist/chunks/MazPullToRefresh.DMtb6Oa3.js +1 -0
- package/dist/chunks/MazRadio.75ipjTw2.js +1 -0
- package/dist/chunks/MazRadioButtons.DenHCgB3.js +1 -0
- package/dist/chunks/MazReadMore.CDXacQIw.js +1 -0
- package/dist/chunks/MazReadingProgressBar.828Y0mxA.js +1 -0
- package/dist/chunks/MazSelect.yYFAbBb5.js +1 -0
- package/dist/chunks/MazSelectCountry.DvVgk2es.js +1 -0
- package/dist/chunks/MazSkeleton.BewTYJC2.js +1 -0
- package/dist/chunks/MazSlider.BS5QHWK6.js +1 -0
- package/dist/chunks/MazSpinner.D3NN2pow.js +1 -0
- package/dist/chunks/MazStepper.DTu8HG9T.js +1 -0
- package/dist/chunks/MazSwitch.Dvmj-rTW.js +1 -0
- package/dist/chunks/MazTable.DnOehvN6.js +1 -0
- package/dist/chunks/MazTableCell.xbm2NGWL.js +1 -0
- package/dist/chunks/MazTableRow.B5dJiXk1.js +1 -0
- package/dist/chunks/MazTableTitle.DNA_1mCy.js +1 -0
- package/dist/chunks/MazTabs.-0-YP3QQ.js +1 -0
- package/dist/chunks/MazTabsBar.D2JVKMS7.js +1 -0
- package/dist/chunks/MazTabsContent.C9omK25X.js +1 -0
- package/dist/chunks/MazTabsContentItem.mJEAS5R8.js +1 -0
- package/dist/chunks/MazTextarea.BliEP5G5.js +1 -0
- package/dist/chunks/MazUiProvider.BgN8V0lD.js +1 -0
- package/dist/chunks/_plugin-vue_export-helper.ChmETRGw.js +1 -0
- package/dist/chunks/dialog.DexeIC3K.js +1 -0
- package/dist/chunks/dom-events.BPrKJiCz.js +1 -0
- package/dist/chunks/resolveLinkComponent.DAc3sqGH.js +1 -0
- package/dist/chunks/toast.UQ8RRuT9.js +1 -0
- package/dist/chunks/types.DDbvTVqf.js +1 -0
- package/dist/chunks/useMazInputPhoneNumber.B_qQ0ldP.js +1 -0
- package/dist/chunks/utils.B8bfGQxN.js +1 -0
- package/dist/chunks/vFullscreenImg.CZeRh3mw.js +1 -0
- package/dist/chunks/vLazyImg.CXmd3Lp0.js +1 -0
- package/dist/chunks/vZoomImg.CaAHb98S.js +124 -0
- package/dist/components/MazAccordion.js +1 -86
- package/dist/components/MazAlert.js +1 -85
- package/dist/components/MazAnimatedCounter.js +1 -73
- package/dist/components/MazAnimatedElement.js +1 -44
- package/dist/components/MazAnimatedText.js +1 -103
- package/dist/components/MazAvatar.js +1 -125
- package/dist/components/MazBackdrop.js +1 -163
- package/dist/components/MazBadge.js +1 -29
- package/dist/components/MazBottomSheet.js +1 -55
- package/dist/components/MazBtn.js +1 -109
- package/dist/components/MazBtnGroup.js +1 -44
- package/dist/components/MazCard.js +1 -184
- package/dist/components/MazCardSpotlight.js +1 -81
- package/dist/components/MazCarousel.js +1 -104
- package/dist/components/MazChart.js +1 -4
- package/dist/components/MazCheckbox.js +1 -128
- package/dist/components/MazChecklist.js +1 -133
- package/dist/components/MazCircularProgressBar.js +1 -131
- package/dist/components/MazContainer.js +1 -71
- package/dist/components/MazDatePicker/MazPickerCalendar.js +1 -113
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarDays.js +1 -19
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarGrid.js +1 -181
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarMonth.js +1 -75
- package/dist/components/MazDatePicker/MazPickerCalendarSwitcher.js +1 -90
- package/dist/components/MazDatePicker/MazPickerContainer.js +1 -116
- package/dist/components/MazDatePicker/MazPickerHeader.js +1 -126
- package/dist/components/MazDatePicker/MazPickerMonthSwitcher.js +1 -82
- package/dist/components/MazDatePicker/MazPickerShortcuts.js +1 -55
- package/dist/components/MazDatePicker/MazPickerTime.js +1 -178
- package/dist/components/MazDatePicker/MazPickerYearSwitcher.js +1 -95
- package/dist/components/MazDatePicker.js +1 -466
- package/dist/components/MazDatePicker.vue.d.ts +2 -6
- package/dist/components/MazDialog.js +1 -115
- package/dist/components/MazDialog.vue.d.ts +2 -6
- package/dist/components/MazDialogConfirm.js +1 -6
- package/dist/components/MazDialogConfirm.vue.d.ts +2 -6
- package/dist/components/MazDrawer.js +1 -70
- package/dist/components/MazDropdown.js +1 -277
- package/dist/components/MazDropdown.vue.d.ts +2 -6
- package/dist/components/MazDropzone.js +1 -533
- package/dist/components/MazExpandAnimation.js +1 -46
- package/dist/components/MazFullscreenLoader.js +1 -38
- package/dist/components/MazGallery.js +1 -105
- package/dist/components/MazIcon.js +1 -114
- package/dist/components/MazInput.js +1 -256
- package/dist/components/MazInputCode.js +1 -152
- package/dist/components/MazInputNumber.js +1 -152
- package/dist/components/MazInputPhoneNumber/PhoneInput.js +1 -114
- package/dist/components/MazInputPhoneNumber.js +1 -253
- package/dist/components/MazInputPrice.js +1 -4
- package/dist/components/MazInputTags.js +1 -145
- package/dist/components/MazLazyImg.js +1 -62
- package/dist/components/MazLink.js +1 -80
- package/dist/components/MazLoadingBar.js +1 -24
- package/dist/components/MazPagination.js +1 -184
- package/dist/components/MazPopover.js +1 -326
- package/dist/components/MazPullToRefresh.js +1 -145
- package/dist/components/MazRadio.js +1 -103
- package/dist/components/MazRadioButtons.js +1 -135
- package/dist/components/MazReadMore.js +1 -110
- package/dist/components/MazReadingProgressBar.js +1 -68
- package/dist/components/MazSelect.js +1 -413
- package/dist/components/MazSelectCountry.js +1 -192
- package/dist/components/MazSkeleton.js +1 -50
- package/dist/components/MazSlider.js +1 -205
- package/dist/components/MazSpinner.js +1 -27
- package/dist/components/MazStepper.js +1 -170
- package/dist/components/MazSwitch.js +1 -4
- package/dist/components/MazTable.js +1 -8
- package/dist/components/MazTableCell.js +1 -18
- package/dist/components/MazTableRow.js +1 -26
- package/dist/components/MazTableTitle.js +1 -18
- package/dist/components/MazTabs.js +1 -4
- package/dist/components/MazTabsBar.js +1 -138
- package/dist/components/MazTabsContent.js +1 -4
- package/dist/components/MazTabsContentItem.js +1 -37
- package/dist/components/MazTextarea.js +1 -147
- package/dist/components/MazUiProvider.js +1 -4
- package/dist/components/index.js +1 -127
- package/dist/composables/index.js +1 -44
- package/dist/composables/useAos.js +1 -7
- package/dist/composables/useBreakpoints.js +1 -34
- package/dist/composables/useDialog.js +1 -7
- package/dist/composables/useDisplayNames.js +1 -111
- package/dist/composables/useDropzone.js +1 -66
- package/dist/composables/useFormField.js +1 -101
- package/dist/composables/useFormValidator.js +1 -163
- package/dist/composables/useFreezeValue.js +1 -8
- package/dist/composables/useIdleTimeout.js +1 -10
- package/dist/composables/useInjectStrict.js +1 -10
- package/dist/composables/useInstanceUniqId.js +1 -12
- package/dist/composables/useMountComponent.js +1 -16
- package/dist/composables/useMutationObserver.js +1 -37
- package/dist/composables/useReadingTime.js +1 -33
- package/dist/composables/useStringMatching.js +1 -42
- package/dist/composables/useSwipe.js +1 -26
- package/dist/composables/useTimer.js +1 -36
- package/dist/composables/useToast.js +1 -14
- package/dist/composables/useUserVisibility.js +1 -10
- package/dist/composables/useWait.js +1 -7
- package/dist/composables/useWindowSize.js +1 -21
- package/dist/directives/index.js +1 -19
- package/dist/directives/vClickOutside.js +1 -104
- package/dist/directives/vFullscreenImg.js +1 -10
- package/dist/directives/vLazyImg.js +1 -23
- package/dist/directives/vTooltip.js +1 -161
- package/dist/directives/vZoomImg.js +1 -286
- package/dist/index.js +1 -1
- package/dist/plugins/aos.js +1 -89
- package/dist/plugins/dialog.js +1 -61
- package/dist/plugins/index.js +1 -17
- package/dist/plugins/maz-ui.js +1 -11
- package/dist/plugins/toast.js +1 -261
- package/dist/plugins/wait.js +1 -43
- package/dist/resolvers/MazComponentsResolver.js +1 -18
- package/dist/resolvers/MazDirectivesResolver.js +1 -14
- package/dist/resolvers/MazModulesResolver.js +1 -76
- package/dist/resolvers/index.js +1 -8
- package/dist/tailwindcss/index.js +1 -20
- package/dist/tailwindcss/tailwind.config.js +1 -35
- package/dist/tailwindcss/utils/colors.js +1 -25
- package/dist/tailwindcss/variables/breakpoints.js +1 -29
- package/dist/tailwindcss/variables/colors.js +1 -33
- package/dist/tailwindcss/variables/design-tokens.js +1 -42
- package/dist/tailwindcss/variables/utilities.js +1 -20
- package/dist/tailwindcss/variables/z-indexes.js +1 -17
- package/package.json +12 -13
- package/dist/chunks/MazChart.vue_vue_type_script_setup_true_lang.DpG9UYdm.js +0 -50
- package/dist/chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.BB2rYkwY.js +0 -215
- package/dist/chunks/MazInputPrice.vue_vue_type_script_setup_true_lang.DcNkyw1C.js +0 -77
- package/dist/chunks/MazSwitch.vue_vue_type_style_index_0_lang.lYfYsI0R.js +0 -84
- package/dist/chunks/MazTable.vue_vue_type_script_setup_true_lang.ycpSYFvJ.js +0 -517
- package/dist/chunks/MazTabs.vue_vue_type_script_setup_true_lang.CiIFxs7J.js +0 -28
- package/dist/chunks/MazTabsContent.vue_vue_type_script_setup_true_lang.MO7zA8LZ.js +0 -26
- package/dist/chunks/MazUiProvider.vue_vue_type_script_setup_true_lang.DtnM1DOn.js +0 -34
- package/dist/chunks/_plugin-vue_export-helper.B--vMWp3.js +0 -9
- package/dist/chunks/dom-events.DTx6Kblx.js +0 -368
- package/dist/chunks/fullscreen-img.directive.BJieSSIt.js +0 -321
- package/dist/chunks/lazy-img.directive.GRfYbidn.js +0 -174
- package/dist/chunks/resolveLinkComponent.CKR2McYy.js +0 -8
- package/dist/chunks/types.D0Bp_UhS.js +0 -6
- package/dist/chunks/useMazInputPhoneNumber.Os-2y9bz.js +0 -157
- package/dist/chunks/utils.D89Q5cCP.js +0 -207
- /package/dist/assets/{fullscreen-img.DFp1SMPU.css → vFullscreenImg.DFp1SMPU.css} +0 -0
|
@@ -1,152 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MazMinus, MazPlus } from "@maz-ui/icons/static";
|
|
3
|
-
import { throttle } from "@maz-ui/utils/helpers/throttle";
|
|
4
|
-
import MazInput from "./MazInput.js";
|
|
5
|
-
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
6
|
-
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
7
|
-
import '../assets/MazInputNumber.B77l8NET.css';const _hoisted_1 = ["for"], _hoisted_2 = { class: "m-input-number__wrapper" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "MazInputNumber",
|
|
10
|
-
props: {
|
|
11
|
-
id: { default: () => {
|
|
12
|
-
} },
|
|
13
|
-
style: { type: [Boolean, null, String, Object, Array], default: () => {
|
|
14
|
-
} },
|
|
15
|
-
class: { type: [Boolean, null, String, Object, Array], default: () => {
|
|
16
|
-
} },
|
|
17
|
-
modelValue: { default: () => {
|
|
18
|
-
} },
|
|
19
|
-
disabled: { type: Boolean, default: !1 },
|
|
20
|
-
max: { default: () => Number.POSITIVE_INFINITY },
|
|
21
|
-
min: { default: () => Number.NEGATIVE_INFINITY },
|
|
22
|
-
step: { default: 1 },
|
|
23
|
-
size: { default: "md" },
|
|
24
|
-
hideButtons: { type: Boolean },
|
|
25
|
-
textCenter: { type: Boolean, default: !0 },
|
|
26
|
-
inputmode: { default: "numeric" },
|
|
27
|
-
block: { type: Boolean },
|
|
28
|
-
error: { type: Boolean, default: !1 },
|
|
29
|
-
hint: {},
|
|
30
|
-
success: { type: Boolean, default: !1 },
|
|
31
|
-
warning: { type: Boolean, default: !1 },
|
|
32
|
-
inputProps: {},
|
|
33
|
-
topLabel: { default: () => {
|
|
34
|
-
} }
|
|
35
|
-
},
|
|
36
|
-
emits: ["update:model-value", "focus", "blur", "click", "change"],
|
|
37
|
-
setup(__props, { emit: __emit }) {
|
|
38
|
-
const emits = __emit, instanceId = useInstanceUniqId({
|
|
39
|
-
componentName: "MazInput",
|
|
40
|
-
providedId: __props.id
|
|
41
|
-
}), MazBtn = defineAsyncComponent(() => import("./MazBtn.js")), currentValue = computed({
|
|
42
|
-
get: () => __props.modelValue,
|
|
43
|
-
set: (value) => emitValue(value)
|
|
44
|
-
});
|
|
45
|
-
function findClosestStep(number) {
|
|
46
|
-
return Math.round(number / __props.step) * __props.step;
|
|
47
|
-
}
|
|
48
|
-
function checkValue(value) {
|
|
49
|
-
if (typeof value == "number")
|
|
50
|
-
return value <= __props.min ? __props.min : value >= __props.max ? __props.max : findClosestStep(value);
|
|
51
|
-
}
|
|
52
|
-
const emitThrottled = throttle((value) => emitValue(value), 300);
|
|
53
|
-
function emitValue(newValue) {
|
|
54
|
-
newValue = checkValue(newValue), currentValue.value !== newValue && emits("update:model-value", newValue);
|
|
55
|
-
}
|
|
56
|
-
emitValue(currentValue.value);
|
|
57
|
-
const incrementDisabled = computed(() => __props.modelValue && __props.modelValue >= __props.max), decrementDisabled = computed(() => __props.modelValue && __props.modelValue <= __props.min);
|
|
58
|
-
function increment() {
|
|
59
|
-
if (!(__props.disabled || incrementDisabled.value)) {
|
|
60
|
-
if ((currentValue.value === void 0 || currentValue.value === null) && Number.isFinite(__props.min)) {
|
|
61
|
-
currentValue.value = __props.min;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
currentValue.value = (currentValue.value ?? 0) + 1 * __props.step;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function decrement() {
|
|
68
|
-
if (!(__props.disabled || decrementDisabled.value)) {
|
|
69
|
-
if ((currentValue.value === void 0 || currentValue.value === null) && Number.isFinite(__props.min)) {
|
|
70
|
-
currentValue.value = __props.min;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
currentValue.value = (currentValue.value ?? 0) - 1 * __props.step;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const stateColor = computed(() => {
|
|
77
|
-
if (__props.error)
|
|
78
|
-
return "!maz-text-destructive-600";
|
|
79
|
-
if (__props.success)
|
|
80
|
-
return "!maz-text-success-600";
|
|
81
|
-
if (__props.warning)
|
|
82
|
-
return "!maz-text-warning-600";
|
|
83
|
-
});
|
|
84
|
-
return (_ctx, _cache) => (openBlock(), createElementBlock("div", {
|
|
85
|
-
class: normalizeClass(["m-input-number m-reset-css", [`m-input-number--${__props.size}`, __props.class, { "--block": __props.block }]]),
|
|
86
|
-
style: normalizeStyle(__props.style)
|
|
87
|
-
}, [
|
|
88
|
-
__props.topLabel ? (openBlock(), createElementBlock("label", {
|
|
89
|
-
key: 0,
|
|
90
|
-
for: unref(instanceId),
|
|
91
|
-
class: normalizeClass(["m-input-number__top-label", stateColor.value])
|
|
92
|
-
}, toDisplayString(__props.topLabel), 11, _hoisted_1)) : createCommentVNode("", !0),
|
|
93
|
-
createElementVNode("div", _hoisted_2, [
|
|
94
|
-
__props.hideButtons ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(MazBtn), {
|
|
95
|
-
key: 0,
|
|
96
|
-
color: "transparent",
|
|
97
|
-
size: __props.size,
|
|
98
|
-
class: "m-input-number__button m-input-number__decrement-button",
|
|
99
|
-
disabled: decrementDisabled.value || __props.disabled,
|
|
100
|
-
onClick: decrement
|
|
101
|
-
}, {
|
|
102
|
-
default: withCtx(() => [
|
|
103
|
-
createVNode(unref(MazMinus), { class: "m-input-number__button__icon" })
|
|
104
|
-
]),
|
|
105
|
-
_: 1
|
|
106
|
-
}, 8, ["size", "disabled"])),
|
|
107
|
-
createVNode(MazInput, mergeProps({ ..._ctx.$attrs, ...__props.inputProps }, {
|
|
108
|
-
id: unref(instanceId),
|
|
109
|
-
"model-value": currentValue.value,
|
|
110
|
-
type: "number",
|
|
111
|
-
class: ["m-input-number__input", { "--no-buttons": __props.hideButtons, "--text-center": __props.textCenter }],
|
|
112
|
-
disabled: __props.disabled,
|
|
113
|
-
min: __props.min,
|
|
114
|
-
max: __props.max,
|
|
115
|
-
step: __props.step,
|
|
116
|
-
error: __props.error,
|
|
117
|
-
success: __props.success,
|
|
118
|
-
warning: __props.warning,
|
|
119
|
-
hint: __props.hint,
|
|
120
|
-
inputmode: __props.inputmode,
|
|
121
|
-
size: __props.size,
|
|
122
|
-
block: "",
|
|
123
|
-
onKeydown: [
|
|
124
|
-
withKeys(withModifiers(increment, ["prevent"]), ["up"]),
|
|
125
|
-
withKeys(withModifiers(decrement, ["prevent"]), ["down"])
|
|
126
|
-
],
|
|
127
|
-
onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("focus", $event)),
|
|
128
|
-
onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("change", $event)),
|
|
129
|
-
onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("blur", $event)),
|
|
130
|
-
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("click", $event)),
|
|
131
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(emitThrottled)($event))
|
|
132
|
-
}), null, 16, ["id", "model-value", "class", "disabled", "min", "max", "step", "error", "success", "warning", "hint", "inputmode", "size", "onKeydown"]),
|
|
133
|
-
__props.hideButtons ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(MazBtn), {
|
|
134
|
-
key: 1,
|
|
135
|
-
color: "transparent",
|
|
136
|
-
size: __props.size,
|
|
137
|
-
class: "m-input-number__button m-input-number__increment-button",
|
|
138
|
-
disabled: incrementDisabled.value || __props.disabled,
|
|
139
|
-
onClick: increment
|
|
140
|
-
}, {
|
|
141
|
-
default: withCtx(() => [
|
|
142
|
-
createVNode(unref(MazPlus), { class: "m-input-number__button__icon" })
|
|
143
|
-
]),
|
|
144
|
-
_: 1
|
|
145
|
-
}, 8, ["size", "disabled"]))
|
|
146
|
-
])
|
|
147
|
-
], 6));
|
|
148
|
-
}
|
|
149
|
-
}), MazInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-561f8e6a"]]);
|
|
150
|
-
export {
|
|
151
|
-
MazInputNumber as default
|
|
152
|
-
};
|
|
1
|
+
import"../chunks/MazInput.DJjWLaKg.js";import{t as MazInputNumber_default}from"../chunks/MazInputNumber.B42Mn-9h.js";export{MazInputNumber_default as default};
|
|
@@ -1,114 +1 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import { useTranslations } from "@maz-ui/translations/composables/useTranslations";
|
|
3
|
-
import { useInjectStrict } from "../../composables/useInjectStrict.js";
|
|
4
|
-
import MazInput from "../MazInput.js";
|
|
5
|
-
import { a as useLibphonenumber, u as useMazInputPhoneNumber } from "../../chunks/useMazInputPhoneNumber.Os-2y9bz.js";
|
|
6
|
-
import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
7
|
-
import '../../assets/PhoneInput.Cr63JIn7.css';const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
-
__name: "PhoneInput",
|
|
9
|
-
props: /* @__PURE__ */ mergeModels({
|
|
10
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
11
|
-
class: { type: [Boolean, null, String, Object, Array] },
|
|
12
|
-
placeholder: {},
|
|
13
|
-
label: {},
|
|
14
|
-
topLabel: {},
|
|
15
|
-
assistiveText: {},
|
|
16
|
-
color: {},
|
|
17
|
-
type: {},
|
|
18
|
-
required: { type: Boolean },
|
|
19
|
-
disabled: { type: Boolean },
|
|
20
|
-
readonly: { type: Boolean },
|
|
21
|
-
id: {},
|
|
22
|
-
error: { type: Boolean },
|
|
23
|
-
success: { type: Boolean },
|
|
24
|
-
warning: { type: Boolean },
|
|
25
|
-
hint: {},
|
|
26
|
-
inputClasses: {},
|
|
27
|
-
border: { type: Boolean },
|
|
28
|
-
inputmode: {},
|
|
29
|
-
size: {},
|
|
30
|
-
debounce: { type: [Boolean, Number] },
|
|
31
|
-
autoFocus: { type: Boolean },
|
|
32
|
-
borderActive: { type: Boolean },
|
|
33
|
-
leftIcon: { type: [String, Function, Object] },
|
|
34
|
-
rightIcon: { type: [String, Function, Object] },
|
|
35
|
-
roundedSize: {},
|
|
36
|
-
block: { type: Boolean },
|
|
37
|
-
name: {},
|
|
38
|
-
autocomplete: {},
|
|
39
|
-
loading: { type: Boolean },
|
|
40
|
-
locales: {},
|
|
41
|
-
example: { type: Boolean },
|
|
42
|
-
hasRadius: { type: Boolean },
|
|
43
|
-
autoFormat: { type: [String, Boolean] }
|
|
44
|
-
}, {
|
|
45
|
-
modelValue: {},
|
|
46
|
-
modelModifiers: {}
|
|
47
|
-
}),
|
|
48
|
-
emits: ["update:modelValue"],
|
|
49
|
-
setup(__props, { expose: __expose }) {
|
|
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();
|
|
59
|
-
function getCountryPhoneNumberExample(selectedCountry2) {
|
|
60
|
-
const example = getPhoneNumberExample(selectedCountry2);
|
|
61
|
-
if (example)
|
|
62
|
-
return __props.locales.example ? __props.locales.example.replace("{example}", example) : t("inputPhoneNumber.phoneInput.example", { example });
|
|
63
|
-
}
|
|
64
|
-
const inputLabelOrPlaceholder = computed(() => {
|
|
65
|
-
if (__props.label || __props.placeholder)
|
|
66
|
-
return __props.label || __props.placeholder;
|
|
67
|
-
const defaultPlaceholder = __props.locales.placeholder;
|
|
68
|
-
if (!__props.example || !inputFocused.value)
|
|
69
|
-
return defaultPlaceholder;
|
|
70
|
-
{
|
|
71
|
-
const phoneExample = getCountryPhoneNumberExample(selectedCountry.value);
|
|
72
|
-
return results.value?.isValid || !phoneExample ? defaultPlaceholder : phoneExample;
|
|
73
|
-
}
|
|
74
|
-
}), inputProps = computed(() => __props.placeholder ? { placeholder: inputLabelOrPlaceholder.value } : { label: inputLabelOrPlaceholder.value });
|
|
75
|
-
onMounted(() => {
|
|
76
|
-
__props.example && loadExamples();
|
|
77
|
-
});
|
|
78
|
-
const inputRef = useTemplateRef("input");
|
|
79
|
-
return __expose({
|
|
80
|
-
/**
|
|
81
|
-
* Focus the input
|
|
82
|
-
* @description This is used to focus the input
|
|
83
|
-
*/
|
|
84
|
-
focus: () => {
|
|
85
|
-
inputRef.value?.$el.querySelector("input")?.focus();
|
|
86
|
-
}
|
|
87
|
-
}), (_ctx, _cache) => (openBlock(), createBlock(MazInput, mergeProps({ id: __props.id }, { ..._ctx.$attrs, ...inputProps.value }, {
|
|
88
|
-
ref: "input",
|
|
89
|
-
modelValue: displayedPhoneNumber.value,
|
|
90
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayedPhoneNumber.value = $event),
|
|
91
|
-
disabled: __props.disabled,
|
|
92
|
-
color: __props.color,
|
|
93
|
-
error: __props.error,
|
|
94
|
-
size: __props.size,
|
|
95
|
-
success: __props.success,
|
|
96
|
-
block: "",
|
|
97
|
-
name: __props.name,
|
|
98
|
-
inputmode: __props.inputmode,
|
|
99
|
-
autocomplete: __props.autocomplete,
|
|
100
|
-
class: ["m-phone-input", [
|
|
101
|
-
{
|
|
102
|
-
"--border-radius": __props.hasRadius,
|
|
103
|
-
"--error": __props.error || !unref(results).isValid,
|
|
104
|
-
"--focused": inputFocused.value
|
|
105
|
-
}
|
|
106
|
-
]],
|
|
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"]));
|
|
110
|
-
}
|
|
111
|
-
}), PhoneInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3c3b2d61"]]);
|
|
112
|
-
export {
|
|
113
|
-
PhoneInput as default
|
|
114
|
-
};
|
|
1
|
+
import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{useInjectStrict}from"../../composables/useInjectStrict.js";import{t as MazInput_default}from"../../chunks/MazInput.DJjWLaKg.js";import{n as useLibphonenumber,t as useMazInputPhoneNumber}from"../../chunks/useMazInputPhoneNumber.B_qQ0ldP.js";import{computed,createBlock,defineComponent,mergeModels,mergeProps,onMounted,openBlock,ref,unref,useModel,useTemplateRef}from"vue";import{useTranslations}from"@maz-ui/translations/composables/useTranslations";import '../../assets/PhoneInput.Cr63JIn7.css';var PhoneInput_default=_plugin_vue_export_helper_default(defineComponent({__name:`PhoneInput`,props:mergeModels({style:{type:[Boolean,null,String,Object,Array]},class:{type:[Boolean,null,String,Object,Array]},placeholder:{},label:{},topLabel:{},assistiveText:{},color:{},type:{},required:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},id:{},error:{type:Boolean},success:{type:Boolean},warning:{type:Boolean},hint:{},inputClasses:{},border:{type:Boolean},inputmode:{},size:{},debounce:{type:[Boolean,Number]},autoFocus:{type:Boolean},borderActive:{type:Boolean},leftIcon:{type:[String,Function,Object]},rightIcon:{type:[String,Function,Object]},roundedSize:{},block:{type:Boolean},name:{},autocomplete:{},loading:{type:Boolean},locales:{},example:{type:Boolean},hasRadius:{type:Boolean},autoFormat:{type:[String,Boolean]}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(__props,{expose:__expose}){let{getPhoneNumberExample,getAsYouTypeFormat,loadExamples}=useLibphonenumber();let{sanitizePhoneNumber}=useMazInputPhoneNumber();let{results,selectedCountry}=useInjectStrict(`mazInputPhoneNumberData`);let modelValue=useModel(__props,`modelValue`);let inputFocused=ref(!1);let asYouTypeFormatted=computed(()=>{let phoneNumberToFormat=results.value.isValid?results.value.formatNational:modelValue.value;return getAsYouTypeFormat(selectedCountry.value,phoneNumberToFormat)||phoneNumberToFormat});let displayedPhoneNumber=computed({get:()=>!inputFocused.value&&__props.autoFormat===`blur`||__props.autoFormat===`typing`?asYouTypeFormatted.value:modelValue.value,set:value=>{modelValue.value=sanitizePhoneNumber(value)}});let{t}=useTranslations();function getCountryPhoneNumberExample(selectedCountry){let example=getPhoneNumberExample(selectedCountry);if(example)return __props.locales.example?__props.locales.example.replace(`{example}`,example):t(`inputPhoneNumber.phoneInput.example`,{example})}let inputLabelOrPlaceholder=computed(()=>{if(__props.label||__props.placeholder)return __props.label||__props.placeholder;let defaultPlaceholder=__props.locales.placeholder;if(!__props.example||!inputFocused.value)return defaultPlaceholder;{let phoneExample=getCountryPhoneNumberExample(selectedCountry.value);return results.value?.isValid||!phoneExample?defaultPlaceholder:phoneExample}});let inputProps=computed(()=>__props.placeholder?{placeholder:inputLabelOrPlaceholder.value}:{label:inputLabelOrPlaceholder.value});onMounted(()=>{__props.example&&loadExamples()});let inputRef=useTemplateRef(`input`);return __expose({focus:()=>{inputRef.value?.$el.querySelector(`input`)?.focus()}}),(_ctx,_cache)=>(openBlock(),createBlock(MazInput_default,mergeProps({id:__props.id},{..._ctx.$attrs,...inputProps.value},{ref:`input`,modelValue:displayedPhoneNumber.value,"onUpdate:modelValue":_cache[0]||=$event=>displayedPhoneNumber.value=$event,disabled:__props.disabled,color:__props.color,error:__props.error,size:__props.size,success:__props.success,block:``,name:__props.name,inputmode:__props.inputmode,autocomplete:__props.autocomplete,class:[`m-phone-input`,[{"--border-radius":__props.hasRadius,"--error":__props.error||!unref(results).isValid,"--focused":inputFocused.value}]],onFocus:_cache[1]||=$event=>inputFocused.value=!0,onBlur:_cache[2]||=$event=>inputFocused.value=!1}),null,16,[`id`,`modelValue`,`disabled`,`color`,`error`,`size`,`success`,`name`,`inputmode`,`autocomplete`,`class`]))}}),[[`__scopeId`,`data-v-3c3b2d61`]]);export{PhoneInput_default as default};
|
|
@@ -1,253 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "@maz-ui/translations/composables/useTranslations";
|
|
3
|
-
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
4
|
-
import { u as useMazInputPhoneNumber, a as useLibphonenumber } from "../chunks/useMazInputPhoneNumber.Os-2y9bz.js";
|
|
5
|
-
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
6
|
-
import '../assets/MazInputPhoneNumber.CW4VVpBq.css';const _hoisted_1 = ["id"], _hoisted_2 = { class: "m-input-phone-number__country-list-code" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
name: "MazInputPhoneNumber",
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "MazInputPhoneNumber",
|
|
10
|
-
props: {
|
|
11
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
12
|
-
class: { type: [Boolean, null, String, Object, Array] },
|
|
13
|
-
modelValue: {},
|
|
14
|
-
countryCode: {},
|
|
15
|
-
id: {},
|
|
16
|
-
placeholder: {},
|
|
17
|
-
label: {},
|
|
18
|
-
preferredCountries: {},
|
|
19
|
-
ignoredCountries: {},
|
|
20
|
-
onlyCountries: {},
|
|
21
|
-
translations: {},
|
|
22
|
-
listPosition: { default: "bottom-start" },
|
|
23
|
-
color: { default: "primary" },
|
|
24
|
-
size: { default: "md" },
|
|
25
|
-
hideFlags: { type: Boolean, default: !1 },
|
|
26
|
-
disabled: { type: Boolean, default: !1 },
|
|
27
|
-
required: { type: Boolean, default: !1 },
|
|
28
|
-
example: { type: Boolean, default: !0 },
|
|
29
|
-
search: { type: Boolean, default: !0 },
|
|
30
|
-
searchThreshold: { default: 0.75 },
|
|
31
|
-
useBrowserLocale: { type: Boolean, default: !0 },
|
|
32
|
-
fetchCountry: { type: Boolean },
|
|
33
|
-
hideCountrySelect: { type: Boolean, default: !1 },
|
|
34
|
-
showCodeInList: { type: Boolean, default: !1 },
|
|
35
|
-
customCountriesList: { default: void 0 },
|
|
36
|
-
autoFormat: { type: [String, Boolean], default: "blur" },
|
|
37
|
-
countryLocale: { default: void 0 },
|
|
38
|
-
validationError: { type: Boolean, default: !0 },
|
|
39
|
-
validationSuccess: { type: Boolean, default: !0 },
|
|
40
|
-
success: { type: Boolean },
|
|
41
|
-
error: { type: Boolean },
|
|
42
|
-
displayCountryName: { type: Boolean, default: !1 },
|
|
43
|
-
block: { type: Boolean },
|
|
44
|
-
orientation: { default: "responsive" },
|
|
45
|
-
countrySelectAttributes: { default: () => ({
|
|
46
|
-
name: "country",
|
|
47
|
-
autocomplete: "off",
|
|
48
|
-
style: {
|
|
49
|
-
width: "14rem"
|
|
50
|
-
}
|
|
51
|
-
}) },
|
|
52
|
-
phoneInputAttributes: { default: () => ({
|
|
53
|
-
name: "phone",
|
|
54
|
-
autocomplete: "tel",
|
|
55
|
-
inputmode: "tel"
|
|
56
|
-
}) }
|
|
57
|
-
},
|
|
58
|
-
emits: ["update:model-value", "country-code", "update:country-code", "data"],
|
|
59
|
-
setup(__props, { emit: __emit }) {
|
|
60
|
-
const props = __props, emits = __emit, MazSelectCountry = defineAsyncComponent(() => import("./MazSelectCountry.js")), PhoneInput = defineAsyncComponent(() => import("./MazInputPhoneNumber/PhoneInput.js")), { fetchCountryCode, getBrowserLocale, getCountryList } = useMazInputPhoneNumber(), { isCountryAvailable, getPhoneNumberResults } = useLibphonenumber(), instanceId = useInstanceUniqId({
|
|
61
|
-
componentName: "MazInputPhoneNumber",
|
|
62
|
-
providedId: props.id
|
|
63
|
-
}), phoneNumber = ref(), selectedCountry = ref(), { t } = useTranslations(), messages = computed(() => ({
|
|
64
|
-
countrySelect: {
|
|
65
|
-
error: props.translations?.countrySelect?.error || t("inputPhoneNumber.countrySelect.error"),
|
|
66
|
-
placeholder: props.translations?.countrySelect?.placeholder || t("inputPhoneNumber.countrySelect.placeholder"),
|
|
67
|
-
searchPlaceholder: props.translations?.countrySelect?.searchPlaceholder || t("inputPhoneNumber.countrySelect.searchPlaceholder")
|
|
68
|
-
},
|
|
69
|
-
phoneInput: {
|
|
70
|
-
placeholder: props.translations?.phoneInput?.placeholder || t("inputPhoneNumber.phoneInput.placeholder"),
|
|
71
|
-
example: props.translations?.phoneInput?.example
|
|
72
|
-
}
|
|
73
|
-
})), isPhoneNumberInternalUpdate = ref(!1), isCountryInternalUpdate = ref(!1), results = ref({
|
|
74
|
-
isValid: !1,
|
|
75
|
-
countryCode: props.countryCode,
|
|
76
|
-
phoneNumber: props.modelValue
|
|
77
|
-
}), PhoneInputRef = ref();
|
|
78
|
-
onBeforeMount(async () => {
|
|
79
|
-
if (props.countryCode && !selectedCountry.value && onCountryChanged({ countryCode: props.countryCode }), props.fetchCountry && !selectedCountry.value) {
|
|
80
|
-
const { data: countryCode, error } = await fetchCountryCode();
|
|
81
|
-
if (error) {
|
|
82
|
-
console.error(`[MazInputPhoneNumber](onBeforeMount) Error while fetching country code - ${error.message}`);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
onCountryChanged({ countryCode });
|
|
86
|
-
}
|
|
87
|
-
}), onMounted(() => {
|
|
88
|
-
if (!selectedCountry.value && props.useBrowserLocale) {
|
|
89
|
-
const countryCode = getBrowserLocale()?.locale;
|
|
90
|
-
countryCode && isCountryAvailable(countryCode) && onCountryChanged({ countryCode });
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
function updateTheResults({
|
|
94
|
-
phone = phoneNumber.value || props.modelValue,
|
|
95
|
-
countryCode = selectedCountry.value,
|
|
96
|
-
checkCountryCode = !1
|
|
97
|
-
}) {
|
|
98
|
-
results.value = getPhoneNumberResults({
|
|
99
|
-
phoneNumber: phone,
|
|
100
|
-
countryCode,
|
|
101
|
-
checkCountryCode
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async function selectPhoneNumberInput() {
|
|
105
|
-
await nextTick(), setTimeout(() => {
|
|
106
|
-
PhoneInputRef.value?.focus();
|
|
107
|
-
}, 100);
|
|
108
|
-
}
|
|
109
|
-
function setSelectedCountry(countryCode) {
|
|
110
|
-
if (countryCode) {
|
|
111
|
-
if (!isCountryAvailable(countryCode)) {
|
|
112
|
-
console.warn(`[MazInputPhoneNumber] Country code not available: "${countryCode}"`), selectedCountry.value = void 0;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
selectedCountry.value = countryCode;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const isLetterRegex = /\D/g;
|
|
119
|
-
function onPhoneNumberChanged({
|
|
120
|
-
newPhoneNumber
|
|
121
|
-
}) {
|
|
122
|
-
updateTheResults({ phone: newPhoneNumber }), results.value.parsedCountryCode && results.value.parsedCountryCode !== selectedCountry.value && onCountryChanged({
|
|
123
|
-
countryCode: results.value.parsedCountryCode,
|
|
124
|
-
updateResults: !1
|
|
125
|
-
}), results.value.isValid && (props.autoFormat === "blur" || props.autoFormat === "typing") ? phoneNumber.value = results.value.formatNational?.trim().replaceAll(isLetterRegex, "") : phoneNumber.value = newPhoneNumber, isPhoneNumberInternalUpdate.value = !0, results.value.e164 ? emits("update:model-value", results.value.e164) : emits("update:model-value", results.value.phoneNumber), setTimeout(() => {
|
|
126
|
-
isPhoneNumberInternalUpdate.value = !1;
|
|
127
|
-
}, 0);
|
|
128
|
-
}
|
|
129
|
-
function onCountryChanged({
|
|
130
|
-
countryCode,
|
|
131
|
-
updateResults = !0,
|
|
132
|
-
selectPhoneNumber = !1
|
|
133
|
-
}) {
|
|
134
|
-
if (!countryCode) {
|
|
135
|
-
selectedCountry.value = void 0;
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
isCountryInternalUpdate.value = !0, countryCode !== selectedCountry.value && setSelectedCountry(countryCode), updateResults && updateTheResults({
|
|
139
|
-
countryCode: selectedCountry.value,
|
|
140
|
-
checkCountryCode: !0
|
|
141
|
-
});
|
|
142
|
-
const code = selectedCountry.value;
|
|
143
|
-
emits("country-code", code), emits("update:country-code", code), selectPhoneNumber && !results.value.isValid && selectPhoneNumberInput(), setTimeout(() => {
|
|
144
|
-
isCountryInternalUpdate.value = !1;
|
|
145
|
-
}, 0);
|
|
146
|
-
}
|
|
147
|
-
const countriesList = computed(() => {
|
|
148
|
-
let list = getCountryList(props.countryLocale, props.customCountriesList);
|
|
149
|
-
return props.onlyCountries && (list = list?.filter((country) => props.onlyCountries?.includes(country.code))), props.ignoredCountries && (list = list?.filter((country) => !props.ignoredCountries?.includes(country.code))), props.preferredCountries && (list = list?.sort((a, b) => {
|
|
150
|
-
const indexA = props.preferredCountries?.indexOf(a.code) ?? -1, indexB = props.preferredCountries?.indexOf(b.code) ?? -1;
|
|
151
|
-
return indexA >= 0 && indexB >= 0 ? indexA - indexB : indexA >= 0 ? -1 : indexB >= 0 ? 1 : 0;
|
|
152
|
-
})), list ?? [];
|
|
153
|
-
});
|
|
154
|
-
return watch(
|
|
155
|
-
() => props.modelValue,
|
|
156
|
-
(value, oldValue) => {
|
|
157
|
-
!isPhoneNumberInternalUpdate.value && value !== oldValue && value !== phoneNumber.value && onPhoneNumberChanged({ newPhoneNumber: value });
|
|
158
|
-
},
|
|
159
|
-
{ immediate: !0 }
|
|
160
|
-
), watch(
|
|
161
|
-
() => props.countryCode,
|
|
162
|
-
(value, oldValue) => {
|
|
163
|
-
!isCountryInternalUpdate.value && value && value !== oldValue && value !== selectedCountry.value && onCountryChanged({ countryCode: value });
|
|
164
|
-
},
|
|
165
|
-
{ immediate: !0 }
|
|
166
|
-
), watch(
|
|
167
|
-
results,
|
|
168
|
-
(value) => emits("data", value),
|
|
169
|
-
{ immediate: !0 }
|
|
170
|
-
), provide("mazInputPhoneNumberData", {
|
|
171
|
-
selectedCountry,
|
|
172
|
-
phoneNumber,
|
|
173
|
-
results
|
|
174
|
-
}), (_ctx, _cache) => (openBlock(), createElementBlock("div", {
|
|
175
|
-
id: unref(instanceId),
|
|
176
|
-
class: normalizeClass(["m-input-phone-number m-reset-css", [props.class, { "--block": __props.block }, __props.orientation ? `--${__props.orientation}` : void 0]]),
|
|
177
|
-
style: normalizeStyle(__props.style)
|
|
178
|
-
}, [
|
|
179
|
-
__props.hideCountrySelect ? createCommentVNode("", !0) : (openBlock(), createBlock(unref(MazSelectCountry), mergeProps({
|
|
180
|
-
key: 0,
|
|
181
|
-
id: `${unref(instanceId)}-country`,
|
|
182
|
-
class: "m-input-phone-number__country-select"
|
|
183
|
-
}, __props.countrySelectAttributes, {
|
|
184
|
-
"model-value": selectedCountry.value,
|
|
185
|
-
"option-input-value-key": __props.displayCountryName ? "name" : "dialCode",
|
|
186
|
-
color: __props.color,
|
|
187
|
-
size: __props.size,
|
|
188
|
-
locale: __props.countryLocale,
|
|
189
|
-
"countries-list": __props.customCountriesList,
|
|
190
|
-
"list-position": __props.listPosition,
|
|
191
|
-
"hide-flags": __props.hideFlags,
|
|
192
|
-
search: __props.search,
|
|
193
|
-
block: __props.block,
|
|
194
|
-
error: __props.error || (__props.validationError ? !!phoneNumber.value && !selectedCountry.value : !1),
|
|
195
|
-
success: __props.success || (__props.validationSuccess ? results.value?.isValid : !1),
|
|
196
|
-
translations: messages.value.countrySelect,
|
|
197
|
-
hint: phoneNumber.value && !selectedCountry.value ? messages.value.countrySelect.error : void 0,
|
|
198
|
-
options: countriesList.value,
|
|
199
|
-
disabled: __props.disabled,
|
|
200
|
-
required: __props.required,
|
|
201
|
-
"search-threshold": __props.searchThreshold,
|
|
202
|
-
"format-input-value": __props.displayCountryName || !selectedCountry.value ? void 0 : (value) => `+${value}`,
|
|
203
|
-
"show-code-in-list": __props.showCodeInList,
|
|
204
|
-
label: messages.value.countrySelect.placeholder,
|
|
205
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => onCountryChanged({ countryCode: $event, selectPhoneNumber: !0 }))
|
|
206
|
-
}), {
|
|
207
|
-
"no-results": withCtx(() => [
|
|
208
|
-
renderSlot(_ctx.$slots, "no-results", {}, void 0, !0)
|
|
209
|
-
]),
|
|
210
|
-
"selector-flag": withCtx(({ countryCode: codeCountry }) => [
|
|
211
|
-
renderSlot(_ctx.$slots, "selector-flag", { countryCode: codeCountry }, void 0, !0)
|
|
212
|
-
]),
|
|
213
|
-
"country-list-flag": withCtx(({ isSelected, option }) => [
|
|
214
|
-
renderSlot(_ctx.$slots, "country-list-flag", {
|
|
215
|
-
countryCode: option.code,
|
|
216
|
-
option,
|
|
217
|
-
isSelected
|
|
218
|
-
}, void 0, !0)
|
|
219
|
-
]),
|
|
220
|
-
"country-list-code": withCtx(({ option }) => [
|
|
221
|
-
createElementVNode("span", _hoisted_2, " +" + toDisplayString(option.dialCode), 1)
|
|
222
|
-
]),
|
|
223
|
-
_: 3
|
|
224
|
-
}, 16, ["id", "model-value", "option-input-value-key", "color", "size", "locale", "countries-list", "list-position", "hide-flags", "search", "block", "error", "success", "translations", "hint", "options", "disabled", "required", "search-threshold", "format-input-value", "show-code-in-list", "label"])),
|
|
225
|
-
createVNode(unref(PhoneInput), mergeProps({
|
|
226
|
-
id: `${unref(instanceId)}-phone`,
|
|
227
|
-
ref_key: "PhoneInputRef",
|
|
228
|
-
ref: PhoneInputRef,
|
|
229
|
-
class: "m-input-phone-number__phone-input",
|
|
230
|
-
"model-value": phoneNumber.value
|
|
231
|
-
}, { ..._ctx.$attrs, ...__props.phoneInputAttributes }, {
|
|
232
|
-
color: __props.color,
|
|
233
|
-
size: __props.size,
|
|
234
|
-
"auto-format": __props.autoFormat,
|
|
235
|
-
example: __props.example,
|
|
236
|
-
block: "",
|
|
237
|
-
disabled: __props.disabled,
|
|
238
|
-
required: __props.required,
|
|
239
|
-
name: __props.phoneInputAttributes.name,
|
|
240
|
-
"has-radius": !__props.hideCountrySelect,
|
|
241
|
-
success: __props.success || (__props.validationSuccess ? results.value.isValid : !1),
|
|
242
|
-
error: __props.error || (__props.validationError ? !!phoneNumber.value && !results.value.isValid : !1),
|
|
243
|
-
locales: messages.value.phoneInput,
|
|
244
|
-
label: __props.label,
|
|
245
|
-
placeholder: __props.placeholder,
|
|
246
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => onPhoneNumberChanged({ newPhoneNumber: $event }))
|
|
247
|
-
}), null, 16, ["id", "model-value", "color", "size", "auto-format", "example", "disabled", "required", "name", "has-radius", "success", "error", "locales", "label", "placeholder"])
|
|
248
|
-
], 14, _hoisted_1));
|
|
249
|
-
}
|
|
250
|
-
}), MazInputPhoneNumber = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cc259039"]]);
|
|
251
|
-
export {
|
|
252
|
-
MazInputPhoneNumber as default
|
|
253
|
-
};
|
|
1
|
+
import{t as MazInputPhoneNumber_default}from"../chunks/MazInputPhoneNumber.CLivThtK.js";export{MazInputPhoneNumber_default as default};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
3
|
-
_sfc_main as default
|
|
4
|
-
};
|
|
1
|
+
import"../chunks/MazInput.DJjWLaKg.js";import{t as MazInputPrice_default}from"../chunks/MazInputPrice.BeL-M944.js";export{MazInputPrice_default as default};
|