maz-ui 4.0.0-beta.2 → 4.0.0-beta.21
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/README.md +1 -1
- package/dist/assets/MazAccordion.DUQCf8vy.css +1 -0
- package/dist/assets/{MazAnimatedCounter.CTG-PC5W.css → MazAnimatedCounter.DkZNPRLp.css} +1 -1
- package/dist/assets/MazAnimatedText.DDqCxrFX.css +1 -0
- package/dist/assets/MazBackdrop.BnhcmjbP.css +1 -0
- package/dist/assets/{MazBadge.DN8tdE8_.css → MazBadge.ChI2DaTU.css} +1 -1
- package/dist/assets/MazBtn.BFhP-9HO.css +1 -0
- package/dist/assets/MazCard.DBuQhXtl.css +1 -0
- package/dist/assets/{MazCardSpotlight.Dy-wuLQq.css → MazCardSpotlight.IbPp_y0j.css} +1 -1
- package/dist/assets/MazCheckbox.aH1IKnrR.css +1 -0
- package/dist/assets/MazChecklist.BzF5KtZ3.css +1 -0
- package/dist/assets/MazDatePicker.8GyrtM-j.css +1 -0
- package/dist/assets/MazDropzone.CXu1QtnY.css +1 -0
- package/dist/assets/MazInput.ByolKDfx.css +1 -0
- package/dist/assets/MazInputCode.FA2z4HQd.css +1 -0
- package/dist/assets/MazInputPhoneNumber.CrXS7DOY.css +1 -0
- package/dist/assets/MazInputTags.KNTpDHof.css +1 -0
- package/dist/assets/MazLazyImg.NlPRN3Nk.css +1 -0
- package/dist/assets/MazLink.CFscNMFr.css +1 -0
- package/dist/assets/MazPickerCalendarMonth.Boe_8k4x.css +1 -0
- package/dist/assets/MazPickerMonthSwitcher.CszcpCcY.css +1 -0
- package/dist/assets/{MazPickerYearSwitcher.Dl30Dwor.css → MazPickerYearSwitcher.Cn-nS-Vv.css} +1 -1
- package/dist/assets/MazPopover.rBpotMKW.css +1 -0
- package/dist/assets/MazPullToRefresh.BQ64UvzA.css +1 -0
- package/dist/assets/MazRadio.aTHM-mpx.css +1 -0
- package/dist/assets/MazRadioButtons.SGytq4d7.css +1 -0
- package/dist/assets/MazReadingProgressBar.CwBVXE3g.css +1 -0
- package/dist/assets/MazSelect.CwjnAZiu.css +1 -0
- package/dist/assets/{MazSelectCountry.D2Qudf0K.css → MazSelectCountry.t3GsKyqw.css} +1 -1
- package/dist/assets/{MazSlider.D5SgmZLH.css → MazSlider.y4qpnD0N.css} +1 -1
- package/dist/assets/MazStepper.BD2gDGAX.css +1 -0
- package/dist/assets/MazSwitch.Bxmh2iFj.css +1 -0
- package/dist/assets/{MazTable.B1tkeUfE.css → MazTable.DMlQdImb.css} +1 -1
- package/dist/assets/MazTableRow.DgBXpK9J.css +1 -0
- package/dist/assets/{MazTabsBar.B9N_jdqU.css → MazTabsBar.gcS2Fc-B.css} +1 -1
- package/dist/assets/{MazTabsContentItem.CHfy19ZF.css → MazTabsContentItem.C84SDmj0.css} +1 -1
- package/dist/assets/MazTextarea.li9dWBax.css +1 -0
- package/dist/assets/{PhoneInput.CyWO76iq.css → PhoneInput.BJiKqOF6.css} +1 -1
- package/dist/assets/{fullscreen-img.pvt6196l.css → fullscreen-img.Bkuz1GOX.css} +1 -1
- package/dist/assets/{toast.kunueRvo.css → toast.CC2VQab8.css} +1 -1
- package/dist/chunks/{MazDatePicker.CT5yJhSN.js → MazDatePicker.De3Ltb2F.js} +29 -31
- package/dist/chunks/{MazDialogPromise.vue_vue_type_script_setup_true_lang.BQvDEofz.js → MazDialogConfirm.vue_vue_type_script_setup_true_lang.Grn2kB3x.js} +78 -18
- package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.abk1IbMX.js → MazDropdown.vue_vue_type_style_index_0_lang.BES3jpuw.js} +12 -22
- package/dist/chunks/{MazInputPhoneNumber.Uwhn1Q9j.js → MazInputPhoneNumber.Ch-PCGiv.js} +14 -12
- package/dist/chunks/{MazInputPrice.vue_vue_type_script_setup_true_lang.GMKzSu7R.js → MazInputPrice.vue_vue_type_script_setup_true_lang.BA6TDX-T.js} +31 -1
- package/dist/chunks/{MazPickerCalendar.RS6ZMdDK.js → MazPickerCalendar.DKXNI8O4.js} +1 -1
- package/dist/chunks/{MazPickerCalendarMonth.hQBSVkc9.js → MazPickerCalendarMonth.DKBqgrNp.js} +5 -5
- package/dist/chunks/{MazPickerCalendarSwitcher.Cp2ux3E4.js → MazPickerCalendarSwitcher.CzIZol3Z.js} +1 -1
- package/dist/chunks/{MazPickerContainer.DnfB3Dqg.js → MazPickerContainer.Mrh-Q52I.js} +1 -1
- package/dist/chunks/{MazPickerHeader.Dlz2yJ1D.js → MazPickerHeader.Bm9vIrtB.js} +1 -1
- package/dist/chunks/{MazPickerMonthSwitcher.BpfCGGxQ.js → MazPickerMonthSwitcher.BSD2GtY6.js} +5 -6
- package/dist/chunks/{MazPickerTime.EuWWNfid.js → MazPickerTime.D0hilq5b.js} +1 -1
- package/dist/chunks/{MazPickerYearSwitcher.D4aO09D3.js → MazPickerYearSwitcher.BIUYJMvj.js} +8 -27
- package/dist/chunks/{MazSwitch.vue_vue_type_style_index_0_lang.DnCjlD6D.js → MazSwitch.vue_vue_type_style_index_0_lang.CU43Y1ky.js} +2 -2
- package/dist/chunks/{MazTable.vue_vue_type_script_setup_true_lang.bm7ng8fK.js → MazTable.vue_vue_type_script_setup_true_lang.BcTw9Tyh.js} +3 -3
- package/dist/chunks/{PhoneInput.CPjyZ8Sq.js → PhoneInput.BzL1_XS5.js} +5 -4
- package/dist/chunks/{utils.BBuYjMbK.js → dom-events.Bbe7wDQl.js} +221 -115
- package/dist/chunks/{en.BzBlrE0C.js → en.Q_4-KljL.js} +12 -0
- package/dist/chunks/{fullscreen-img.directive.CyOHexcO.js → fullscreen-img.directive.Be383en8.js} +2 -2
- package/dist/chunks/{lazy-img.directive.D5zCo3Zi.js → lazy-img.directive.BLFnGqQa.js} +1 -1
- package/dist/chunks/types.D0Bp_UhS.js +6 -0
- package/dist/chunks/{normalizeString.CFe2M8S_.js → useStringMatching.Ba1yCuA4.js} +40 -1
- package/dist/chunks/{useTranslations.BXuww4ux.js → useTranslations.D5aoYwD7.js} +1 -1
- package/dist/chunks/vClickOutside.DIOiluy0.js +107 -0
- package/dist/components/MazAccordion.js +2 -2
- package/dist/components/MazAnimatedCounter.js +3 -3
- package/dist/components/MazAnimatedText.js +2 -2
- package/dist/components/MazBackdrop.js +3 -3
- package/dist/components/MazBadge.js +5 -4
- package/dist/components/MazBtn.js +9 -7
- package/dist/components/MazCard.js +2 -2
- package/dist/components/MazCardSpotlight.js +4 -4
- package/dist/components/MazCarousel.js +1 -1
- package/dist/components/MazCheckbox.js +10 -12
- package/dist/components/MazChecklist.js +4 -5
- package/dist/components/MazDatePicker.js +1 -1
- package/dist/components/MazDialogConfirm.js +6 -0
- package/dist/components/MazDropdown.js +1 -1
- package/dist/components/MazDropzone.js +5 -5
- package/dist/components/MazGallery.js +2 -2
- package/dist/components/MazInput.js +21 -16
- package/dist/components/MazInputCode.js +2 -2
- package/dist/components/MazInputPhoneNumber.js +1 -1
- package/dist/components/MazInputPrice.js +1 -1
- package/dist/components/MazInputTags.js +2 -2
- package/dist/components/MazLazyImg.js +9 -9
- package/dist/components/MazLink.js +9 -5
- package/dist/components/MazPagination.js +1 -1
- package/dist/components/MazPopover.js +177 -89
- package/dist/components/MazPullToRefresh.js +8 -3
- package/dist/components/MazRadio.js +8 -16
- package/dist/components/MazRadioButtons.js +7 -6
- package/dist/components/MazReadingProgressBar.js +10 -3
- package/dist/components/MazSelect.js +24 -14
- package/dist/components/MazSelectCountry.js +15 -9
- package/dist/components/MazSlider.js +2 -2
- package/dist/components/MazStepper.js +2 -2
- package/dist/components/MazSwitch.js +1 -1
- package/dist/components/MazTable.js +3 -3
- package/dist/components/MazTableCell.js +1 -1
- package/dist/components/MazTableRow.js +3 -3
- package/dist/components/MazTableTitle.js +1 -1
- package/dist/components/MazTabsBar.js +6 -6
- package/dist/components/MazTabsContentItem.js +6 -7
- package/dist/components/MazTextarea.js +24 -3
- package/dist/components/index.js +8 -8
- package/dist/composables/index.js +4 -2
- package/dist/composables/useAos.js +1 -1
- package/dist/composables/useDialog.js +1 -1
- package/dist/composables/useDisplayNames.js +7 -1
- package/dist/composables/useDropzone.js +7 -7
- package/dist/composables/useFormField.js +15 -19
- package/dist/composables/useFormValidator.js +58 -29
- package/dist/composables/useIdleTimeout.js +108 -1
- package/dist/composables/useInjectStrict.js +2 -2
- package/dist/composables/useStringMatching.js +3 -40
- package/dist/composables/useSwipe.js +77 -1
- package/dist/composables/useToast.js +1 -1
- package/dist/composables/useUserVisibility.js +47 -1
- package/dist/composables/useWait.js +1 -1
- package/dist/composables/useWindowSize.js +1 -1
- package/dist/css/main.css +1 -1
- package/dist/directives/index.js +7 -7
- package/dist/directives/vClickOutside.js +4 -102
- package/dist/directives/vFullscreenImg.js +1 -1
- package/dist/directives/vLazyImg.js +2 -2
- package/dist/directives/vTooltip.js +97 -60
- package/dist/index.js +1 -114
- package/dist/plugins/dialog.js +3 -3
- package/dist/plugins/maz-ui.js +150 -143
- package/dist/plugins/toast.js +8 -11
- package/dist/resolvers/MazComponentsResolver.js +7 -1
- package/dist/resolvers/MazDirectivesResolver.js +1 -1
- package/dist/resolvers/MazModulesResolver.js +3 -1
- package/dist/tailwindcss/tailwind.config.js +5 -2
- package/dist/tailwindcss/variables/design-tokens.js +3 -0
- package/dist/types/components/MazAccordion.vue.d.ts +15 -2
- package/dist/types/components/MazBtn.vue.d.ts +1 -0
- package/dist/types/components/MazCard.vue.d.ts +1 -1
- package/dist/types/components/MazCheckbox.vue.d.ts +0 -6
- package/dist/types/components/MazChecklist.vue.d.ts +1 -1
- package/dist/types/components/MazDatePicker.vue.d.ts +15 -23
- package/dist/types/components/MazDialogConfirm/useMazDialogConfirm.d.ts +47 -0
- package/dist/types/components/{MazDialogPromise.vue.d.ts → MazDialogConfirm.vue.d.ts} +43 -10
- package/dist/types/components/MazDropdown.vue.d.ts +12 -12
- package/dist/types/components/MazInput.vue.d.ts +7 -0
- package/dist/types/components/MazInputNumber.vue.d.ts +2 -2
- package/dist/types/components/MazInputPhoneNumber/useLibphonenumber.d.ts +2 -2
- package/dist/types/components/MazInputPhoneNumber/useMazInputPhoneNumber.d.ts +6 -2
- package/dist/types/components/MazInputPhoneNumber.vue.d.ts +38 -15
- package/dist/types/components/MazInputTags.vue.d.ts +1 -1
- package/dist/types/components/MazLazyImg.vue.d.ts +8 -8
- package/dist/types/components/MazLink.vue.d.ts +11 -0
- package/dist/types/components/MazPopover.vue.d.ts +18 -15
- package/dist/types/components/MazRadioButtons.vue.d.ts +1 -1
- package/dist/types/components/MazSelect.vue.d.ts +2 -2
- package/dist/types/components/MazSelectCountry.vue.d.ts +13 -4
- package/dist/types/components/MazStepper.vue.d.ts +13 -2
- package/dist/types/components/MazTable.vue.d.ts +63 -2
- package/dist/types/components/index.d.ts +4 -4
- package/dist/types/components/types.d.ts +1 -0
- package/dist/types/composables/index.d.ts +2 -1
- package/dist/types/composables/useDisplayNames.d.ts +2 -2
- package/dist/types/composables/useDropzone.d.ts +3 -3
- package/dist/types/composables/useFormField.d.ts +16 -56
- package/dist/types/composables/useFormValidator/config.d.ts +2 -2
- package/dist/types/composables/useFormValidator/dom-events.d.ts +19 -0
- package/dist/types/composables/useFormValidator/state-management.d.ts +72 -0
- package/dist/types/composables/useFormValidator/types.d.ts +20 -32
- package/dist/types/composables/useFormValidator/validation.d.ts +37 -0
- package/dist/types/composables/useFormValidator.d.ts +16 -10
- package/dist/types/composables/useIdleTimeout.d.ts +1 -1
- package/dist/types/composables/useInjectStrict.d.ts +1 -1
- package/dist/types/composables/useSwipe.d.ts +1 -1
- package/dist/types/composables/useUserVisibility.d.ts +1 -1
- package/dist/types/directives/vClickOutside.d.ts +11 -18
- package/dist/types/directives/vFullscreenImg/fullscreen-img.directive.d.ts +3 -5
- package/dist/types/directives/vFullscreenImg.d.ts +9 -4
- package/dist/types/directives/vLazyImg/lazy-img.directive.d.ts +3 -5
- package/dist/types/directives/vLazyImg.d.ts +11 -6
- package/dist/types/directives/vTooltip.d.ts +14 -14
- package/dist/types/directives/vZoomImg/zoom-img.directive.d.ts +2 -0
- package/dist/types/directives/vZoomImg.d.ts +9 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/aos.d.ts +30 -4
- package/dist/types/plugins/dialog/DialogHandler.d.ts +2 -2
- package/dist/types/plugins/dialog.d.ts +2 -4
- package/dist/types/plugins/maz-ui.d.ts +2 -63
- package/dist/types/plugins/toast.d.ts +2 -4
- package/dist/types/plugins/wait.d.ts +2 -3
- package/dist/types/tailwindcss/tailwind.config.d.ts +5 -0
- package/dist/types/tailwindcss/variables/design-tokens.d.ts +3 -0
- package/package.json +42 -39
- package/dist/assets/MazAccordion.esK3rR4p.css +0 -1
- package/dist/assets/MazAnimatedText.BrOwWuqf.css +0 -1
- package/dist/assets/MazBackdrop.DNpnLh63.css +0 -1
- package/dist/assets/MazBtn.BnRxVlqS.css +0 -1
- package/dist/assets/MazCard.C6nDaeIC.css +0 -1
- package/dist/assets/MazCheckbox.C_qIngLy.css +0 -1
- package/dist/assets/MazChecklist.CWK_Gl-t.css +0 -1
- package/dist/assets/MazDatePicker.V5JwKPrQ.css +0 -1
- package/dist/assets/MazDropzone.DafxQwbq.css +0 -1
- package/dist/assets/MazInput.DW2KOJHY.css +0 -1
- package/dist/assets/MazInputCode.CG6EJBEk.css +0 -1
- package/dist/assets/MazInputPhoneNumber.vpA2mrZn.css +0 -1
- package/dist/assets/MazInputTags.B_s9J3sw.css +0 -1
- package/dist/assets/MazLazyImg.BNaVtpfX.css +0 -1
- package/dist/assets/MazLink.CCfbrUs0.css +0 -1
- package/dist/assets/MazPickerCalendarMonth.zkrPVHDv.css +0 -1
- package/dist/assets/MazPickerMonthSwitcher.168v7Hs1.css +0 -1
- package/dist/assets/MazPopover.Bth9NWia.css +0 -1
- package/dist/assets/MazPullToRefresh.DABqbGtK.css +0 -1
- package/dist/assets/MazRadio.DKMFWwy_.css +0 -1
- package/dist/assets/MazRadioButtons.BA4rjgK9.css +0 -1
- package/dist/assets/MazReadingProgressBar.n1Is8_Y3.css +0 -1
- package/dist/assets/MazSelect.DZZpDg8z.css +0 -1
- package/dist/assets/MazStepper.DYMde9uq.css +0 -1
- package/dist/assets/MazSwitch.Z1ZMm7tx.css +0 -1
- package/dist/assets/MazTableRow.B78Bd4Kv.css +0 -1
- package/dist/assets/MazTextarea.Dz11mUeK.css +0 -1
- package/dist/chunks/TextareaAutogrow.C22LQx0k.js +0 -25
- package/dist/chunks/debounceCallback.B69vn57Q.js +0 -7
- package/dist/chunks/formatCurrency.C8NzW9Ii.js +0 -34
- package/dist/chunks/formatDate.DZ_OzdnV.js +0 -21
- package/dist/chunks/getCountryFlagUrl.dQjriBXx.js +0 -9
- package/dist/chunks/idleTimeout.-ICpdeGV.js +0 -111
- package/dist/chunks/isServer.BokzeB-Q.js +0 -6
- package/dist/chunks/isStandaloneMode.BpUpOTbA.js +0 -10
- package/dist/chunks/pascalCase.D_nuQ66I.js +0 -11
- package/dist/chunks/swipeHandler.8emelhOL.js +0 -80
- package/dist/chunks/throttle.DN8ARw0a.js +0 -11
- package/dist/chunks/throttleId.7PhWZjcS.js +0 -62
- package/dist/chunks/userVisibility.BbQSJASv.js +0 -50
- package/dist/chunks/x-mark.CTalOvvY.js +0 -23
- package/dist/components/MazDialogPromise.js +0 -6
- package/dist/types/components/MazDialogPromise/useMazDialogPromise.d.ts +0 -54
- package/dist/types/components/MazInputPhoneNumber/types.d.ts +0 -22
- package/dist/types/composables/useFormValidator/utils.d.ts +0 -116
|
@@ -1,104 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
const eventHandlers = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
function getEventType() {
|
|
5
|
-
return isServer() ? "click" : document.ontouchstart === null ? "touchstart" : "click";
|
|
6
|
-
}
|
|
7
|
-
function isOptionsObject(value) {
|
|
8
|
-
return typeof value == "object" && value !== null && "callback" in value;
|
|
9
|
-
}
|
|
10
|
-
function getOptionsFromBinding(binding) {
|
|
11
|
-
const value = binding.value;
|
|
12
|
-
return isOptionsObject(value) ? {
|
|
13
|
-
ignore: [],
|
|
14
|
-
capture: !1,
|
|
15
|
-
once: !1,
|
|
16
|
-
stopPropagation: !1,
|
|
17
|
-
...value
|
|
18
|
-
} : {
|
|
19
|
-
callback: value,
|
|
20
|
-
ignore: [],
|
|
21
|
-
capture: !1,
|
|
22
|
-
once: !1,
|
|
23
|
-
stopPropagation: !1
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function shouldIgnoreElement(target, ignoreSelectors) {
|
|
27
|
-
return isServer() ? !1 : ignoreSelectors.some((selector) => {
|
|
28
|
-
try {
|
|
29
|
-
if (target.matches && target.matches(selector) || target.closest && target.closest(selector) !== null)
|
|
30
|
-
return !0;
|
|
31
|
-
const excludedElement = document.querySelector(selector);
|
|
32
|
-
if (excludedElement) {
|
|
33
|
-
const elementId = excludedElement.getAttribute("id");
|
|
34
|
-
if (elementId && target instanceof HTMLElement && target.getAttribute("id") === elementId || excludedElement.contains(target))
|
|
35
|
-
return !0;
|
|
36
|
-
}
|
|
37
|
-
return !1;
|
|
38
|
-
} catch {
|
|
39
|
-
return !1;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async function onMounted(el, binding) {
|
|
44
|
-
if (!isServer())
|
|
45
|
-
try {
|
|
46
|
-
onUnmounted(el);
|
|
47
|
-
const vm = binding.instance, options = getOptionsFromBinding(binding), { callback, ignore = [], capture = !1, once = !1, stopPropagation = !1 } = options, isCallbackFunction = typeof callback == "function";
|
|
48
|
-
if (!isCallbackFunction)
|
|
49
|
-
throw new Error("[maz-ui](vClickOutside) the callback should be a function");
|
|
50
|
-
await nextTick();
|
|
51
|
-
const eventHandler = (event) => {
|
|
52
|
-
stopPropagation && event.stopPropagation();
|
|
53
|
-
const target = event.target;
|
|
54
|
-
if (!target || !el)
|
|
55
|
-
return;
|
|
56
|
-
const isOutside = !el.contains(target), shouldIgnore = ignore.length > 0 && shouldIgnoreElement(target, ignore);
|
|
57
|
-
if (isOutside && !shouldIgnore && callback && isCallbackFunction)
|
|
58
|
-
return callback.call(vm, event);
|
|
59
|
-
};
|
|
60
|
-
eventHandlers.set(el, eventHandler);
|
|
61
|
-
const eventType = getEventType(), eventOptions = {
|
|
62
|
-
passive: !0,
|
|
63
|
-
capture,
|
|
64
|
-
once
|
|
65
|
-
};
|
|
66
|
-
document.addEventListener(eventType, eventHandler, eventOptions);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function onUnmounted(el) {
|
|
72
|
-
if (!isServer())
|
|
73
|
-
try {
|
|
74
|
-
const eventHandler = eventHandlers.get(el);
|
|
75
|
-
if (eventHandler) {
|
|
76
|
-
const eventType = getEventType();
|
|
77
|
-
document.removeEventListener(eventType, eventHandler, !1), eventHandlers.delete(el);
|
|
78
|
-
}
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function onUpdated(el, binding) {
|
|
84
|
-
try {
|
|
85
|
-
if (binding.value === binding.oldValue)
|
|
86
|
-
return;
|
|
87
|
-
onMounted(el, binding);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const directive = {
|
|
93
|
-
mounted: onMounted,
|
|
94
|
-
updated: onUpdated,
|
|
95
|
-
unmounted: onUnmounted
|
|
96
|
-
}, plugin = {
|
|
97
|
-
install: (app) => {
|
|
98
|
-
app.directive("click-outside", directive);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
1
|
+
import "vue";
|
|
2
|
+
import { d, p } from "../chunks/vClickOutside.DIOiluy0.js";
|
|
101
3
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
4
|
+
d as vClickOutside,
|
|
5
|
+
p as vClickOutsideInstall
|
|
104
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LazyImg, D as DEFAULT_OPTIONS } from "../chunks/lazy-img.directive.
|
|
2
|
-
import { d } from "../chunks/lazy-img.directive.
|
|
1
|
+
import { L as LazyImg, D as DEFAULT_OPTIONS } from "../chunks/lazy-img.directive.BLFnGqQa.js";
|
|
2
|
+
import { d } from "../chunks/lazy-img.directive.BLFnGqQa.js";
|
|
3
3
|
const plugin = {
|
|
4
4
|
install(app, opts = {}) {
|
|
5
5
|
const options = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from "vue";
|
|
1
|
+
import { ref, nextTick, watch, h } from "vue";
|
|
2
2
|
import MazPopover from "../components/MazPopover.js";
|
|
3
3
|
import { useMountComponent } from "../composables/useMountComponent.js";
|
|
4
4
|
const tooltipInstances = /* @__PURE__ */ new WeakMap();
|
|
@@ -7,8 +7,7 @@ class TooltipHandler {
|
|
|
7
7
|
constructor(options = {}) {
|
|
8
8
|
this.defaultProps = {
|
|
9
9
|
open: !1,
|
|
10
|
-
|
|
11
|
-
preferPosition: "top",
|
|
10
|
+
position: "top",
|
|
12
11
|
trigger: "hover",
|
|
13
12
|
role: "tooltip",
|
|
14
13
|
closeOnClickOutside: !1,
|
|
@@ -17,7 +16,7 @@ class TooltipHandler {
|
|
|
17
16
|
...options
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
getTooltipProps(binding) {
|
|
21
20
|
const baseOptions = { ...this.defaultProps };
|
|
22
21
|
return typeof binding.value == "string" ? {
|
|
23
22
|
...baseOptions,
|
|
@@ -30,79 +29,117 @@ class TooltipHandler {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
getPositionFromModifiers(binding) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (binding.modifiers["left-end"])
|
|
52
|
-
return "left-end";
|
|
53
|
-
if (binding.modifiers["right-start"])
|
|
54
|
-
return "right-start";
|
|
55
|
-
if (binding.modifiers["right-end"])
|
|
56
|
-
return "right-end";
|
|
57
|
-
if (binding.modifiers.auto)
|
|
58
|
-
return "auto";
|
|
32
|
+
const modifiers = Object.keys(binding.modifiers), validPositions = [
|
|
33
|
+
"top",
|
|
34
|
+
"bottom",
|
|
35
|
+
"left",
|
|
36
|
+
"right",
|
|
37
|
+
"top-start",
|
|
38
|
+
"top-end",
|
|
39
|
+
"bottom-start",
|
|
40
|
+
"bottom-end",
|
|
41
|
+
"left-start",
|
|
42
|
+
"left-end",
|
|
43
|
+
"right-start",
|
|
44
|
+
"right-end",
|
|
45
|
+
"auto"
|
|
46
|
+
];
|
|
47
|
+
for (const modifier of modifiers)
|
|
48
|
+
if (validPositions.includes(modifier))
|
|
49
|
+
return modifier;
|
|
59
50
|
}
|
|
60
51
|
mount(el, binding) {
|
|
61
52
|
this.unmount(el);
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
53
|
+
const tooltipProps = this.getTooltipProps(binding);
|
|
54
|
+
if (!tooltipProps.text && !tooltipProps.html) {
|
|
64
55
|
console.warn("[maz-ui](vTooltip) No text or html content provided");
|
|
65
56
|
return;
|
|
66
57
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
const isOpen = ref(!!tooltipProps.open), tooltipContainer = document.createElement("div");
|
|
59
|
+
document.body.appendChild(tooltipContainer);
|
|
60
|
+
let vNodeInstance = null;
|
|
61
|
+
const createTooltip = () => {
|
|
62
|
+
const popoverProps = {
|
|
63
|
+
...tooltipProps,
|
|
64
|
+
panelClass: [
|
|
65
|
+
"m-tooltip-panel",
|
|
66
|
+
"maz-text-sm",
|
|
67
|
+
"maz-whitespace-pre-wrap",
|
|
68
|
+
"maz-break-words",
|
|
69
|
+
"maz-p-2",
|
|
70
|
+
"maz-max-w-xs",
|
|
71
|
+
tooltipProps.panelClass
|
|
72
|
+
].filter(Boolean).join(" "),
|
|
73
|
+
modelValue: isOpen.value,
|
|
74
|
+
positionReference: el
|
|
75
|
+
// Use original element as reference
|
|
76
|
+
};
|
|
77
|
+
vNodeInstance && vNodeInstance.destroy(), vNodeInstance = useMountComponent(MazPopover, {
|
|
78
|
+
props: {
|
|
79
|
+
...popoverProps,
|
|
80
|
+
modelValue: isOpen.value,
|
|
81
|
+
"onUpdate:modelValue": (value) => {
|
|
82
|
+
isOpen.value = value;
|
|
79
83
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
},
|
|
85
|
+
children: {
|
|
86
|
+
// Use a dummy trigger since we control positioning via positionReference
|
|
87
|
+
// trigger: () => h('div', { style: 'display: none;' }),
|
|
88
|
+
default: () => tooltipProps.html ? h("div", { innerHTML: tooltipProps.html }) : tooltipProps.text || ""
|
|
89
|
+
},
|
|
90
|
+
element: tooltipContainer
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
function isTouchDevice() {
|
|
94
|
+
return "ontouchstart" in globalThis || navigator.maxTouchPoints > 0;
|
|
95
|
+
}
|
|
96
|
+
function getEffectiveTrigger() {
|
|
97
|
+
return tooltipProps.trigger === "adaptive" ? isTouchDevice() ? "click" : "hover" : tooltipProps.trigger || "hover";
|
|
98
|
+
}
|
|
99
|
+
let mouseEnterHandler = null, mouseLeaveHandler = null, clickHandler = null;
|
|
100
|
+
function setupTriggers() {
|
|
101
|
+
cleanupTriggers();
|
|
102
|
+
const effectiveTrigger = getEffectiveTrigger();
|
|
103
|
+
effectiveTrigger === "hover" ? (mouseEnterHandler = () => {
|
|
104
|
+
isOpen.value = !0;
|
|
105
|
+
}, mouseLeaveHandler = () => {
|
|
106
|
+
isOpen.value = !1;
|
|
107
|
+
}, el.addEventListener("mouseenter", mouseEnterHandler), el.addEventListener("mouseleave", mouseLeaveHandler)) : effectiveTrigger === "click" && (clickHandler = () => {
|
|
108
|
+
isOpen.value = !isOpen.value;
|
|
109
|
+
}, el.addEventListener("click", clickHandler));
|
|
110
|
+
}
|
|
111
|
+
function cleanupTriggers() {
|
|
112
|
+
mouseEnterHandler && (el.removeEventListener("mouseenter", mouseEnterHandler), mouseEnterHandler = null), mouseLeaveHandler && (el.removeEventListener("mouseleave", mouseLeaveHandler), mouseLeaveHandler = null), clickHandler && (el.removeEventListener("click", clickHandler), clickHandler = null);
|
|
113
|
+
}
|
|
114
|
+
nextTick(() => {
|
|
115
|
+
createTooltip(), setupTriggers();
|
|
116
|
+
}), watch(isOpen, () => {
|
|
117
|
+
createTooltip();
|
|
84
118
|
});
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
119
|
+
function destroy() {
|
|
120
|
+
cleanupTriggers(), vNodeInstance && (vNodeInstance.destroy(), vNodeInstance = null), tooltipContainer.parentNode && tooltipContainer.parentNode.removeChild(tooltipContainer);
|
|
121
|
+
}
|
|
122
|
+
function updateProps(newProps) {
|
|
123
|
+
const oldTrigger = tooltipProps.trigger;
|
|
124
|
+
Object.assign(tooltipProps, newProps), isOpen.value = !!newProps.open, oldTrigger !== newProps.trigger && setupTriggers(), createTooltip();
|
|
92
125
|
}
|
|
93
126
|
tooltipInstances.set(el, {
|
|
94
127
|
destroy,
|
|
95
|
-
|
|
96
|
-
|
|
128
|
+
updateProps,
|
|
129
|
+
isOpen
|
|
97
130
|
});
|
|
98
131
|
}
|
|
99
132
|
update(el, binding) {
|
|
100
133
|
const instance = tooltipInstances.get(el);
|
|
101
|
-
|
|
134
|
+
if (instance) {
|
|
135
|
+
const newProps = this.getTooltipProps(binding);
|
|
136
|
+
instance.updateProps(newProps);
|
|
137
|
+
} else
|
|
138
|
+
this.mount(el, binding);
|
|
102
139
|
}
|
|
103
140
|
unmount(el) {
|
|
104
141
|
const instance = tooltipInstances.get(el);
|
|
105
|
-
instance && (instance.
|
|
142
|
+
instance && (instance.destroy(), tooltipInstances.delete(el));
|
|
106
143
|
}
|
|
107
144
|
}
|
|
108
145
|
let globalHandler;
|
|
@@ -117,7 +154,7 @@ const directive = {
|
|
|
117
154
|
globalHandler && globalHandler.unmount(el);
|
|
118
155
|
}
|
|
119
156
|
}, plugin = {
|
|
120
|
-
install: (app, options
|
|
157
|
+
install: (app, options) => {
|
|
121
158
|
const handler = new TooltipHandler(options);
|
|
122
159
|
app.directive("tooltip", {
|
|
123
160
|
beforeMount: handler.mount.bind(handler),
|
package/dist/index.js
CHANGED
|
@@ -1,114 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { c as c2 } from "./chunks/capitalize.BF6CDS_4.js";
|
|
3
|
-
import { f } from "./chunks/formatCurrency.C8NzW9Ii.js";
|
|
4
|
-
import { f as f2 } from "./chunks/formatDate.DZ_OzdnV.js";
|
|
5
|
-
import { c as c3 } from "./chunks/checkAvailability.aTpZidex.js";
|
|
6
|
-
import { t as truthyFilter } from "./chunks/truthyFilter.C2WOKUCG.js";
|
|
7
|
-
import { d } from "./chunks/debounce.Brzkn9pm.js";
|
|
8
|
-
import { d as d2 } from "./chunks/debounceCallback.B69vn57Q.js";
|
|
9
|
-
import { d as d3, i, t } from "./chunks/throttleId.7PhWZjcS.js";
|
|
10
|
-
import { g } from "./chunks/getCountryFlagUrl.dQjriBXx.js";
|
|
11
|
-
import { I } from "./chunks/idleTimeout.-ICpdeGV.js";
|
|
12
|
-
import { i as i2 } from "./chunks/isClient.WI4oSt66.js";
|
|
13
|
-
import { i as i3 } from "./chunks/isServer.BokzeB-Q.js";
|
|
14
|
-
import { i as i4 } from "./chunks/isStandaloneMode.BpUpOTbA.js";
|
|
15
|
-
import { n } from "./chunks/normalizeString.CFe2M8S_.js";
|
|
16
|
-
import { s } from "./chunks/sleep.BLRH1qZG.js";
|
|
17
|
-
import { S } from "./chunks/swipeHandler.8emelhOL.js";
|
|
18
|
-
import { T } from "./chunks/TextareaAutogrow.C22LQx0k.js";
|
|
19
|
-
import { t as t2 } from "./chunks/throttle.DN8ARw0a.js";
|
|
20
|
-
import { U } from "./chunks/userVisibility.BbQSJASv.js";
|
|
21
|
-
const DEFAULT_OPTIONS = {
|
|
22
|
-
minimumFractionDigits: 2
|
|
23
|
-
};
|
|
24
|
-
function formatNumber(number, locale, options) {
|
|
25
|
-
const filterOptions = {
|
|
26
|
-
...DEFAULT_OPTIONS,
|
|
27
|
-
...options
|
|
28
|
-
};
|
|
29
|
-
if (number === void 0)
|
|
30
|
-
throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");
|
|
31
|
-
if (locale === void 0)
|
|
32
|
-
throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");
|
|
33
|
-
if (typeof locale != "string")
|
|
34
|
-
throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");
|
|
35
|
-
try {
|
|
36
|
-
return new Intl.NumberFormat(locale, filterOptions).format(Number(number));
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw new Error(`[maz-ui](FilterNumber) ${error}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function countryCodeToUnicodeFlag(locale) {
|
|
42
|
-
return [...locale].map((letter) => {
|
|
43
|
-
const code = letter.codePointAt(0);
|
|
44
|
-
return code ? code % 32 + 127461 : void 0;
|
|
45
|
-
}).filter(truthyFilter).map((n2) => String.fromCodePoint(n2)).join("");
|
|
46
|
-
}
|
|
47
|
-
class ScriptLoader {
|
|
48
|
-
src;
|
|
49
|
-
script;
|
|
50
|
-
once;
|
|
51
|
-
async;
|
|
52
|
-
defer;
|
|
53
|
-
identifier;
|
|
54
|
-
constructor({ src, identifier, once = !0, async = !0, defer = !0 }) {
|
|
55
|
-
if (typeof window > "u")
|
|
56
|
-
throw new TypeError("[ScriptLoader]: Is supported only on browser side");
|
|
57
|
-
if (!src)
|
|
58
|
-
throw new Error('[ScriptLoader]: You should provide the attribut "src"');
|
|
59
|
-
if (!identifier)
|
|
60
|
-
throw new Error('[ScriptLoader]: You should provide the attribut "identifier"');
|
|
61
|
-
this.src = src, this.identifier = identifier, this.once = once, this.async = async, this.defer = defer;
|
|
62
|
-
}
|
|
63
|
-
removeTag(tag) {
|
|
64
|
-
typeof tag == "string" ? document.head.querySelector(`[data-identifier="${tag}"]`)?.remove() : tag.remove();
|
|
65
|
-
}
|
|
66
|
-
load() {
|
|
67
|
-
const windowInstance = window, scriptTags = document.head.querySelectorAll(`[data-identifier="${this.identifier}"]`);
|
|
68
|
-
if (this.once && windowInstance[this.identifier] && scriptTags.length > 0)
|
|
69
|
-
return this.script = windowInstance[this.identifier], Promise.resolve(this.script);
|
|
70
|
-
if (!this.once && scriptTags.length > 0)
|
|
71
|
-
for (const tag of scriptTags)
|
|
72
|
-
this.removeTag(tag);
|
|
73
|
-
return this.injectScript();
|
|
74
|
-
}
|
|
75
|
-
injectScript() {
|
|
76
|
-
const windowInstance = window;
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
try {
|
|
79
|
-
const script = document.createElement("script");
|
|
80
|
-
script.src = this.src, script.async = this.async, script.defer = this.defer, script.dataset.identifier = this.identifier, script.addEventListener("error", (error) => reject(new Error(`[ScriptLoader](injectScript) ${error.message}`))), script.addEventListener("load", (success) => (this.script = success, windowInstance[this.identifier] = success, resolve(success))), document.head.append(script);
|
|
81
|
-
} catch (error) {
|
|
82
|
-
throw new Error(`[ScriptLoader](init) ${error}`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export {
|
|
88
|
-
I as IdleTimeout,
|
|
89
|
-
ScriptLoader,
|
|
90
|
-
S as Swipe,
|
|
91
|
-
T as TextareaAutogrow,
|
|
92
|
-
U as UserVisibility,
|
|
93
|
-
c as camelCase,
|
|
94
|
-
c2 as capitalize,
|
|
95
|
-
c3 as checkAvailability,
|
|
96
|
-
countryCodeToUnicodeFlag,
|
|
97
|
-
d as debounce,
|
|
98
|
-
d2 as debounceCallback,
|
|
99
|
-
d3 as debounceId,
|
|
100
|
-
f as formatCurrency,
|
|
101
|
-
f2 as formatDate,
|
|
102
|
-
formatNumber,
|
|
103
|
-
g as getCountryFlagUrl,
|
|
104
|
-
i2 as isClient,
|
|
105
|
-
i as isEqual,
|
|
106
|
-
i3 as isServer,
|
|
107
|
-
i4 as isStandaloneMode,
|
|
108
|
-
n as normalizeString,
|
|
109
|
-
p as pascalCase,
|
|
110
|
-
s as sleep,
|
|
111
|
-
t2 as throttle,
|
|
112
|
-
t as throttleId,
|
|
113
|
-
truthyFilter
|
|
114
|
-
};
|
|
1
|
+
export * from "@maz-ui/utils";
|
package/dist/plugins/dialog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _sfc_main, u as
|
|
1
|
+
import { _ as _sfc_main, u as useMazDialogConfirm } from "../chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.Grn2kB3x.js";
|
|
2
2
|
import { useMountComponent } from "../composables/useMountComponent.js";
|
|
3
3
|
const DEFAULT_OPTIONS = {
|
|
4
4
|
identifier: "main-dialog"
|
|
@@ -15,7 +15,7 @@ class DialogHandler {
|
|
|
15
15
|
}, { destroy, vNode } = useMountComponent(_sfc_main, {
|
|
16
16
|
props,
|
|
17
17
|
app: this.app
|
|
18
|
-
}), { showDialogAndWaitChoice } =
|
|
18
|
+
}), { showDialogAndWaitChoice } = useMazDialogConfirm();
|
|
19
19
|
function close() {
|
|
20
20
|
vNode.component?.exposed?.isActive?.value && (vNode.component?.exposed?.close(), props.onClose?.(), setTimeout(() => {
|
|
21
21
|
destroy();
|
|
@@ -23,7 +23,7 @@ class DialogHandler {
|
|
|
23
23
|
}
|
|
24
24
|
async function runDialog() {
|
|
25
25
|
try {
|
|
26
|
-
const response = await showDialogAndWaitChoice(props.identifier
|
|
26
|
+
const response = await showDialogAndWaitChoice(props.identifier);
|
|
27
27
|
props.onAccept && props.onAccept(response);
|
|
28
28
|
} catch (error) {
|
|
29
29
|
const response = error;
|