maz-ui 4.0.0-beta.4 → 4.0.0-beta.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/assets/MazAccordion.DUQCf8vy.css +1 -0
- package/dist/assets/{MazBtn.BnRxVlqS.css → MazBtn.FsG6p6NF.css} +1 -1
- package/dist/assets/MazCheckbox.CFqw9ybT.css +1 -0
- package/dist/assets/MazDatePicker.8GyrtM-j.css +1 -0
- package/dist/assets/MazInput.WPopv89k.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.D-WwUjU_.css +1 -0
- package/dist/assets/MazRadio.XGYnbTuB.css +1 -0
- package/dist/assets/MazSelect.DEBsk61Q.css +1 -0
- package/dist/assets/{MazStepper.DYMde9uq.css → MazStepper.DtWZmm-f.css} +1 -1
- package/dist/assets/MazSwitch.Bxmh2iFj.css +1 -0
- package/dist/assets/{MazTable.B1tkeUfE.css → MazTable.DMlQdImb.css} +1 -1
- package/dist/assets/{toast.kunueRvo.css → toast.CC2VQab8.css} +1 -1
- package/dist/chunks/{MazDatePicker.CT5yJhSN.js → MazDatePicker.EVP68BQf.js} +28 -30
- package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.De5b1GG8.js → MazDropdown.vue_vue_type_style_index_0_lang.DjPJ9-gt.js} +1 -1
- 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.CzPlAVdQ.js} +1 -1
- package/dist/chunks/{MazPickerCalendarMonth.hQBSVkc9.js → MazPickerCalendarMonth.gZBcslia.js} +1 -1
- package/dist/chunks/{MazPickerCalendarSwitcher.Cp2ux3E4.js → MazPickerCalendarSwitcher.CzAkb2yj.js} +1 -1
- package/dist/chunks/{MazPickerContainer.DnfB3Dqg.js → MazPickerContainer.BodulCQp.js} +1 -1
- package/dist/chunks/{MazPickerHeader.Dlz2yJ1D.js → MazPickerHeader.ns_pHhiy.js} +1 -1
- package/dist/chunks/{MazPickerMonthSwitcher.BpfCGGxQ.js → MazPickerMonthSwitcher.BuZuUauW.js} +5 -6
- package/dist/chunks/{MazPickerTime.EuWWNfid.js → MazPickerTime.DMVpW3Ha.js} +1 -1
- package/dist/chunks/{MazPickerYearSwitcher.D4aO09D3.js → MazPickerYearSwitcher.METGgjem.js} +8 -27
- package/dist/chunks/{MazSwitch.vue_vue_type_style_index_0_lang.DQE0vFhe.js → MazSwitch.vue_vue_type_style_index_0_lang.CU43Y1ky.js} +1 -1
- package/dist/chunks/{MazTable.vue_vue_type_script_setup_true_lang.bm7ng8fK.js → MazTable.vue_vue_type_script_setup_true_lang.CK2bk5tI.js} +2 -2
- package/dist/chunks/{utils.BBuYjMbK.js → dom-events.CvkK8Xn2.js} +219 -115
- package/dist/chunks/{normalizeString.CFe2M8S_.js → useStringMatching.D5UvsCUS.js} +40 -1
- package/dist/chunks/vClickOutside.C69k0jaG.js +107 -0
- package/dist/components/MazAccordion.js +2 -2
- package/dist/components/MazBtn.js +2 -3
- package/dist/components/MazCheckbox.js +10 -12
- package/dist/components/MazChecklist.js +1 -2
- package/dist/components/MazDatePicker.js +1 -1
- package/dist/components/MazDropdown.js +1 -1
- package/dist/components/MazInput.js +9 -10
- package/dist/components/MazInputPrice.js +1 -1
- package/dist/components/MazPopover.js +163 -77
- package/dist/components/MazPullToRefresh.js +7 -2
- package/dist/components/MazRadio.js +8 -16
- package/dist/components/MazReadingProgressBar.js +9 -2
- package/dist/components/MazSelect.js +22 -12
- package/dist/components/MazSelectCountry.js +7 -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 +1 -1
- package/dist/components/MazTableTitle.js +1 -1
- package/dist/components/MazTextarea.js +23 -2
- package/dist/components/index.js +4 -4
- package/dist/composables/index.js +2 -2
- package/dist/composables/useDisplayNames.js +7 -1
- package/dist/composables/useFormField.js +15 -19
- package/dist/composables/useFormValidator.js +41 -28
- package/dist/composables/useIdleTimeout.js +108 -1
- package/dist/composables/useStringMatching.js +3 -40
- package/dist/composables/useSwipe.js +77 -1
- package/dist/composables/useUserVisibility.js +47 -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/vTooltip.js +96 -59
- package/dist/index.js +1 -114
- package/dist/plugins/toast.js +8 -11
- package/dist/resolvers/MazComponentsResolver.js +7 -1
- package/dist/resolvers/MazModulesResolver.js +3 -0
- 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/MazCheckbox.vue.d.ts +0 -6
- package/dist/types/components/MazDatePicker.vue.d.ts +4 -12
- package/dist/types/components/MazInputNumber.vue.d.ts +1 -1
- package/dist/types/components/MazPopover.vue.d.ts +7 -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 +1 -1
- package/dist/types/composables/index.d.ts +1 -1
- package/dist/types/composables/useDisplayNames.d.ts +3 -3
- package/dist/types/composables/useFormField.d.ts +3 -41
- package/dist/types/composables/useFormValidator/dom-events.d.ts +19 -0
- package/dist/types/composables/useFormValidator/state-management.d.ts +54 -0
- package/dist/types/composables/useFormValidator/types.d.ts +9 -20
- package/dist/types/composables/useFormValidator/validation.d.ts +43 -0
- package/dist/types/composables/useFormValidator.d.ts +16 -10
- package/dist/types/directives/vTooltip.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/tailwindcss/tailwind.config.d.ts +5 -0
- package/dist/types/tailwindcss/variables/design-tokens.d.ts +3 -0
- package/package.json +8 -9
- package/dist/assets/MazAccordion.esK3rR4p.css +0 -1
- package/dist/assets/MazCheckbox.BFo5eYS6.css +0 -1
- package/dist/assets/MazDatePicker.V5JwKPrQ.css +0 -1
- package/dist/assets/MazInput.DW2KOJHY.css +0 -1
- package/dist/assets/MazPickerMonthSwitcher.168v7Hs1.css +0 -1
- package/dist/assets/MazPopover.COR-tym7.css +0 -1
- package/dist/assets/MazRadio.DKMFWwy_.css +0 -1
- package/dist/assets/MazSelect.DZZpDg8z.css +0 -1
- package/dist/assets/MazSwitch.Z1ZMm7tx.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/types/composables/useFormValidator/utils.d.ts +0 -116
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, defineAsyncComponent, useAttrs, computed, createBlock, openBlock, resolveDynamicComponent, normalizeStyle, normalizeClass, withCtx, renderSlot, createElementBlock, createCommentVNode, unref, createTextVNode, toDisplayString, createVNode } from "vue";
|
|
2
2
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
3
|
-
import '../assets/MazBtn.
|
|
3
|
+
import '../assets/MazBtn.FsG6p6NF.css';const _hoisted_1 = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "m-btn-loader-container"
|
|
6
6
|
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -38,7 +38,6 @@ import '../assets/MazBtn.BnRxVlqS.css';const _hoisted_1 = {
|
|
|
38
38
|
"--block": _ctx.block,
|
|
39
39
|
"--fab": _ctx.fab,
|
|
40
40
|
"--loading": _ctx.loading,
|
|
41
|
-
"--disabled": isDisabled.value,
|
|
42
41
|
"--no-padding": !_ctx.padding
|
|
43
42
|
}
|
|
44
43
|
]]),
|
|
@@ -86,7 +85,7 @@ import '../assets/MazBtn.BnRxVlqS.css';const _hoisted_1 = {
|
|
|
86
85
|
_: 3
|
|
87
86
|
}, 8, ["disabled", "class", "style", "type"]));
|
|
88
87
|
}
|
|
89
|
-
}), MazBtn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
88
|
+
}), MazBtn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3c658595"]]);
|
|
90
89
|
export {
|
|
91
90
|
MazBtn as default
|
|
92
91
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, createCommentVNode, mergeProps, createVNode, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { MazCheck } from "@maz-ui/icons";
|
|
3
3
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
4
4
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
5
|
-
import '../assets/MazCheckbox.
|
|
5
|
+
import '../assets/MazCheckbox.CFqw9ybT.css';const _hoisted_1 = ["for", "aria-checked"], _hoisted_2 = ["id", "checked", "disabled", "name"], _hoisted_3 = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "m-checkbox__text"
|
|
8
8
|
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -22,15 +22,14 @@ import '../assets/MazCheckbox.BFo5eYS6.css';const _hoisted_1 = ["for", "tabindex
|
|
|
22
22
|
error: { type: Boolean },
|
|
23
23
|
success: { type: Boolean },
|
|
24
24
|
warning: { type: Boolean },
|
|
25
|
-
hint: {}
|
|
26
|
-
tabindex: { default: 0 }
|
|
25
|
+
hint: {}
|
|
27
26
|
},
|
|
28
27
|
emits: ["update:model-value", "change", "blur", "focus"],
|
|
29
28
|
setup(__props, { emit: __emit }) {
|
|
30
29
|
const props = __props, emits = __emit, instanceId = useInstanceUniqId({
|
|
31
30
|
componentName: "MazCheckbox",
|
|
32
31
|
providedId: props.id
|
|
33
|
-
}), isChecked = computed(() => typeof props.value != "boolean" && Array.isArray(props.modelValue) ? props.modelValue.includes(props.value) : typeof props.modelValue == "boolean" ? props.modelValue : !1), checkboxSize = computed(() => {
|
|
32
|
+
}), inputRef = ref(), isFocused = ref(!1), isChecked = computed(() => typeof props.value != "boolean" && Array.isArray(props.modelValue) ? props.modelValue.includes(props.value) : typeof props.modelValue == "boolean" ? props.modelValue : !1), checkboxSize = computed(() => {
|
|
34
33
|
switch (props.size) {
|
|
35
34
|
case "xl":
|
|
36
35
|
return "2rem";
|
|
@@ -60,7 +59,7 @@ import '../assets/MazCheckbox.BFo5eYS6.css';const _hoisted_1 = ["for", "tabindex
|
|
|
60
59
|
default:
|
|
61
60
|
return "maz-text-lg";
|
|
62
61
|
}
|
|
63
|
-
}), checkIconColor = computed(() => props.color === "contrast" ? "hsl(var(--maz-background))" : `hsl(var(--maz-${props.color}-foreground))`), checkboxSelectedColor = computed(() => props.color === "contrast" ? "hsl(var(--maz-contrast))" : `hsl(var(--maz-${props.color}))`), checkboxBoxShadow = computed(() => props.error ? "hsl(var(--maz-destructive))" : props.warning ? "hsl(var(--maz-warning))" : props.success ? "hsl(var(--maz-success))" : ["transparent", "contrast"].includes(props.color) ? "hsl(var(--maz-muted))" : `hsl(var(--maz-${props.color}) / 60%)`);
|
|
62
|
+
}), checkIconColor = computed(() => props.color === "contrast" ? "hsl(var(--maz-background))" : `hsl(var(--maz-${props.color}-foreground))`), checkboxSelectedColor = computed(() => props.color === "contrast" ? "hsl(var(--maz-contrast))" : `hsl(var(--maz-${props.color}))`), checkboxBoxShadow = computed(() => props.error && !isFocused.value ? "hsl(var(--maz-destructive))" : props.warning && !isFocused.value ? "hsl(var(--maz-warning))" : props.success && !isFocused.value ? "hsl(var(--maz-success))" : ["transparent", "contrast"].includes(props.color) ? "hsl(var(--maz-muted))" : `hsl(var(--maz-${props.color}) / 60%)`);
|
|
64
63
|
function keyboardHandler(event) {
|
|
65
64
|
["Space"].includes(event.code) && (event.preventDefault(), emitValue(props.value ?? !props.modelValue));
|
|
66
65
|
}
|
|
@@ -71,20 +70,19 @@ import '../assets/MazCheckbox.BFo5eYS6.css';const _hoisted_1 = ["for", "tabindex
|
|
|
71
70
|
const newValue = getNewValue(value);
|
|
72
71
|
emits("update:model-value", newValue), emits("change", newValue);
|
|
73
72
|
}
|
|
74
|
-
const inputRef = ref();
|
|
75
73
|
function onBlur(event) {
|
|
76
|
-
inputRef.value?.dispatchEvent(new Event("blur")), emits("blur", event);
|
|
74
|
+
isFocused.value = !1, inputRef.value?.dispatchEvent(new Event("blur")), emits("blur", event);
|
|
77
75
|
}
|
|
78
76
|
function onFocus(event) {
|
|
79
|
-
inputRef.value?.dispatchEvent(new Event("focus")), emits("focus", event);
|
|
77
|
+
isFocused.value = !0, inputRef.value?.dispatchEvent(new Event("focus")), emits("focus", event);
|
|
80
78
|
}
|
|
81
79
|
return (_ctx, _cache) => (openBlock(), createElementBlock("label", {
|
|
82
80
|
for: unref(instanceId),
|
|
83
|
-
class: normalizeClass(["m-checkbox m-reset-css", [{ "--
|
|
84
|
-
tabindex: _ctx.tabindex,
|
|
81
|
+
class: normalizeClass(["m-checkbox m-reset-css", [{ "--error": _ctx.error, "--warning": _ctx.warning, "--success": _ctx.success }, props.class]]),
|
|
85
82
|
style: normalizeStyle([_ctx.style, { "--checkbox-selected-color": checkboxSelectedColor.value, "--checkbox-box-shadow-color": checkboxBoxShadow.value }]),
|
|
86
83
|
role: "checkbox",
|
|
87
84
|
"aria-checked": isChecked.value,
|
|
85
|
+
tabindex: "0",
|
|
88
86
|
onKeydown: keyboardHandler,
|
|
89
87
|
onBlur,
|
|
90
88
|
onFocus
|
|
@@ -124,7 +122,7 @@ import '../assets/MazCheckbox.BFo5eYS6.css';const _hoisted_1 = ["for", "tabindex
|
|
|
124
122
|
])) : createCommentVNode("", !0)
|
|
125
123
|
], 46, _hoisted_1));
|
|
126
124
|
}
|
|
127
|
-
}), MazCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
125
|
+
}), MazCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c457082d"]]);
|
|
128
126
|
export {
|
|
129
127
|
MazCheckbox as default
|
|
130
128
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineComponent, defineAsyncComponent, ref, watch, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, createCommentVNode, createBlock, renderSlot, createTextVNode, toDisplayString, mergeProps, withCtx, Fragment, renderList } from "vue";
|
|
2
2
|
import { MazMagnifyingGlass, MazNoSymbol } from "@maz-ui/icons";
|
|
3
3
|
import { u as useTranslations } from "../chunks/useTranslations.BXuww4ux.js";
|
|
4
|
-
import { n as normalizeString } from "../chunks/
|
|
4
|
+
import { n as normalizeString, u as useStringMatching } from "../chunks/useStringMatching.D5UvsCUS.js";
|
|
5
5
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
6
|
-
import { useStringMatching } from "../composables/useStringMatching.js";
|
|
7
6
|
import MazCardSpotlight from "./MazCardSpotlight.js";
|
|
8
7
|
import MazCheckbox from "./MazCheckbox.js";
|
|
9
8
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
@@ -3,7 +3,7 @@ import { MazEyeSlash, MazEye } from "@maz-ui/icons";
|
|
|
3
3
|
import { d as debounce } from "../chunks/debounce.Brzkn9pm.js";
|
|
4
4
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
5
5
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
6
|
-
import '../assets/MazInput.
|
|
6
|
+
import '../assets/MazInput.WPopv89k.css';const _hoisted_1 = ["for"], _hoisted_2 = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "m-input-wrapper-left"
|
|
9
9
|
}, _hoisted_3 = ["id", "placeholder", "aria-label", "type", "inputmode", "disabled", "readonly", "required"], _hoisted_4 = {
|
|
@@ -55,11 +55,11 @@ import '../assets/MazInput.DW2KOJHY.css';const _hoisted_1 = ["for"], _hoisted_2
|
|
|
55
55
|
});
|
|
56
56
|
const isPasswordType = computed(() => props.type === "password"), inputType = computed(() => hasPasswordVisible.value ? "text" : props.type), borderStyle = computed(() => {
|
|
57
57
|
if (props.border) {
|
|
58
|
-
if (props.error)
|
|
58
|
+
if (props.error && !isFocused.value)
|
|
59
59
|
return "maz-border-destructive";
|
|
60
|
-
if (props.success)
|
|
60
|
+
if (props.success && !isFocused.value)
|
|
61
61
|
return "maz-border-success";
|
|
62
|
-
if (props.warning)
|
|
62
|
+
if (props.warning && !isFocused.value)
|
|
63
63
|
return "maz-border-warning";
|
|
64
64
|
if (isFocused.value || props.borderActive) {
|
|
65
65
|
if (props.color === "destructive")
|
|
@@ -116,11 +116,11 @@ import '../assets/MazInput.DW2KOJHY.css';const _hoisted_1 = ["for"], _hoisted_2
|
|
|
116
116
|
}
|
|
117
117
|
const stateColor = computed(() => {
|
|
118
118
|
if (props.error)
|
|
119
|
-
return "maz-text-destructive-600";
|
|
119
|
+
return "!maz-text-destructive-600";
|
|
120
120
|
if (props.success)
|
|
121
|
-
return "maz-text-success-600";
|
|
121
|
+
return "!maz-text-success-600";
|
|
122
122
|
if (props.warning)
|
|
123
|
-
return "maz-text-warning-600";
|
|
123
|
+
return "!maz-text-warning-600";
|
|
124
124
|
});
|
|
125
125
|
return (_ctx, _cache) => (openBlock(), createElementBlock("div", {
|
|
126
126
|
class: normalizeClass(["m-input m-reset-css", [
|
|
@@ -128,7 +128,6 @@ import '../assets/MazInput.DW2KOJHY.css';const _hoisted_1 = ["for"], _hoisted_2
|
|
|
128
128
|
"--is-focused": isFocused.value || _ctx.borderActive,
|
|
129
129
|
"--should-up": shouldUp.value,
|
|
130
130
|
"--has-label": hasLabel.value,
|
|
131
|
-
"--is-disabled": _ctx.disabled,
|
|
132
131
|
"--is-readonly": _ctx.readonly,
|
|
133
132
|
"--has-z-2": _ctx.error || _ctx.warning || _ctx.success,
|
|
134
133
|
"--has-state": _ctx.error || _ctx.warning || _ctx.success,
|
|
@@ -149,7 +148,7 @@ import '../assets/MazInput.DW2KOJHY.css';const _hoisted_1 = ["for"], _hoisted_2
|
|
|
149
148
|
_ctx.inputClasses,
|
|
150
149
|
borderStyle.value,
|
|
151
150
|
`--rounded-${_ctx.roundedSize}`,
|
|
152
|
-
{ "--block": _ctx.block }
|
|
151
|
+
{ "--block": _ctx.block, "--border": _ctx.border }
|
|
153
152
|
]])
|
|
154
153
|
}, [
|
|
155
154
|
hasLeftPart() ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
@@ -238,7 +237,7 @@ import '../assets/MazInput.DW2KOJHY.css';const _hoisted_1 = ["for"], _hoisted_2
|
|
|
238
237
|
}, toDisplayString(_ctx.assistiveText), 3)) : createCommentVNode("", !0)
|
|
239
238
|
], 6));
|
|
240
239
|
}
|
|
241
|
-
}), MazInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
240
|
+
}), MazInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bed6e27d"]]);
|
|
242
241
|
export {
|
|
243
242
|
MazInput as default
|
|
244
243
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useAttrs, useTemplateRef, useModel, ref, computed, nextTick, watch, onMounted, onUnmounted, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, createBlock, mergeProps, renderSlot, Teleport, createVNode, Transition, withCtx, withDirectives, createCommentVNode } from "vue";
|
|
1
|
+
import { defineComponent, mergeModels, useAttrs, useTemplateRef, useModel, ref, computed, nextTick, watch, onMounted, onBeforeUnmount, onUnmounted, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, createBlock, mergeProps, renderSlot, Teleport, createVNode, Transition, withCtx, withDirectives, createCommentVNode } from "vue";
|
|
2
2
|
import { i as isClient } from "../chunks/isClient.WI4oSt66.js";
|
|
3
|
-
import { t as throttle } from "../chunks/throttle.DN8ARw0a.js";
|
|
4
3
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
5
|
-
import {
|
|
4
|
+
import { d as directive } from "../chunks/vClickOutside.C69k0jaG.js";
|
|
6
5
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
7
|
-
import '../assets/MazPopover.
|
|
6
|
+
import '../assets/MazPopover.D-WwUjU_.css';const _hoisted_1 = ["id", "aria-expanded", "aria-haspopup", "aria-describedby", "aria-labelledby"], _hoisted_2 = ["id", "role", "aria-label", "aria-labelledby", "aria-describedby", "aria-modal", "tabindex", "aria-live"], _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
7
|
name: "MazPopover",
|
|
9
8
|
inheritAttrs: !1,
|
|
10
9
|
__name: "MazPopover",
|
|
@@ -36,7 +35,7 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
36
35
|
trapFocus: { type: Boolean, default: !0 },
|
|
37
36
|
keepOpenOnHover: { type: Boolean, default: !1 },
|
|
38
37
|
block: { type: Boolean, default: !1 },
|
|
39
|
-
|
|
38
|
+
positionReference: {}
|
|
40
39
|
}, {
|
|
41
40
|
modelValue: { type: Boolean, required: !1, default: !1 },
|
|
42
41
|
modelModifiers: {}
|
|
@@ -46,7 +45,17 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
46
45
|
const emits = __emit, triggerId = useInstanceUniqId({
|
|
47
46
|
componentName: "MazPopover",
|
|
48
47
|
providedId: __props.id
|
|
49
|
-
}), attrs = useAttrs(), triggerElement = useTemplateRef("trigger"), panelElement = useTemplateRef("panel")
|
|
48
|
+
}), attrs = useAttrs(), triggerElement = useTemplateRef("trigger"), panelElement = useTemplateRef("panel");
|
|
49
|
+
function getPositionReference() {
|
|
50
|
+
if (!__props.positionReference)
|
|
51
|
+
return triggerElement.value;
|
|
52
|
+
if (typeof __props.positionReference == "string") {
|
|
53
|
+
const withinTrigger = triggerElement.value?.querySelector(__props.positionReference);
|
|
54
|
+
return withinTrigger || document.querySelector(__props.positionReference);
|
|
55
|
+
}
|
|
56
|
+
return __props.positionReference;
|
|
57
|
+
}
|
|
58
|
+
const isOpen = useModel(__props, "modelValue"), computedPosition = ref(__props.position === "auto" ? "bottom" : __props.position);
|
|
50
59
|
let openTimeout = null, closeTimeout = null, initialFocusElement = null, ignoreNextClickOutside = !1;
|
|
51
60
|
const panelId = computed(() => `${triggerId.value}-panel`), panelStyles = ref(), rootStyles = computed(() => attrs.style), isTouchDevice = computed(() => isClient() ? "ontouchstart" in window || navigator.maxTouchPoints > 0 : !1), effectiveTrigger = computed(() => __props.trigger === "adaptive" ? isTouchDevice.value ? "click" : "hover" : __props.trigger), triggerEvents = computed(() => {
|
|
52
61
|
if (__props.disabled || effectiveTrigger.value === "manual")
|
|
@@ -68,33 +77,72 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
68
77
|
`--position-${computedPosition.value}`,
|
|
69
78
|
`--${__props.color}`
|
|
70
79
|
]);
|
|
71
|
-
let resizeObserver = null, mutationObserver = null,
|
|
80
|
+
let resizeObserver = null, mutationObserver = null, isPositioning = !1, positioningFrame = null;
|
|
81
|
+
function calculateAndApplyPosition(options = {}) {
|
|
82
|
+
if (!triggerElement.value || !panelElement.value || isPositioning)
|
|
83
|
+
return null;
|
|
84
|
+
const { applyStyles = !0, forAnimation = !1 } = options;
|
|
85
|
+
applyStyles && (isPositioning = !0, positioningFrame && cancelAnimationFrame(positioningFrame));
|
|
86
|
+
const doCalculation = () => {
|
|
87
|
+
if (!triggerElement.value || !panelElement.value)
|
|
88
|
+
return applyStyles && (isPositioning = !1), null;
|
|
89
|
+
try {
|
|
90
|
+
const viewport = { width: window.innerWidth, height: window.innerHeight }, positionRef = getPositionReference();
|
|
91
|
+
if (!positionRef)
|
|
92
|
+
return applyStyles && (isPositioning = !1), null;
|
|
93
|
+
const triggerRect = positionRef.getBoundingClientRect();
|
|
94
|
+
let wasHidden = !1;
|
|
95
|
+
forAnimation && (wasHidden = panelElement.value.style.visibility === "hidden", panelElement.value.style.visibility = "hidden", panelElement.value.style.display = "block");
|
|
96
|
+
let newPosition;
|
|
97
|
+
if (__props.position === "auto" ? newPosition = getBestPosition(triggerRect, viewport) : newPosition = __props.position, computedPosition.value = newPosition, applyStyles) {
|
|
98
|
+
const panelRect = panelElement.value.getBoundingClientRect(), styles = calculatePosition(newPosition, triggerRect, panelRect);
|
|
99
|
+
panelStyles.value = styles;
|
|
100
|
+
}
|
|
101
|
+
return forAnimation && !applyStyles && (wasHidden ? panelElement.value.style.visibility = "hidden" : panelElement.value.style.display = ""), newPosition;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
return console.warn("[MazPopover] Error calculating position:", error), null;
|
|
104
|
+
} finally {
|
|
105
|
+
applyStyles && (isPositioning = !1, positioningFrame = null);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
return applyStyles ? (positioningFrame = requestAnimationFrame(doCalculation), null) : doCalculation();
|
|
109
|
+
}
|
|
72
110
|
function updatePosition() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
__props.position === "auto"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
111
|
+
calculateAndApplyPosition({ applyStyles: !0 });
|
|
112
|
+
}
|
|
113
|
+
function schedulePositionUpdate() {
|
|
114
|
+
isOpen.value && !isPositioning && updatePosition();
|
|
115
|
+
}
|
|
116
|
+
function preparePositionForAnimation() {
|
|
117
|
+
if (__props.position === "auto" && triggerElement.value) {
|
|
118
|
+
const positionRef = getPositionReference();
|
|
119
|
+
if (positionRef) {
|
|
120
|
+
const triggerRect = positionRef.getBoundingClientRect(), viewport = { width: window.innerWidth, height: window.innerHeight }, newPosition = getBestPosition(triggerRect, viewport);
|
|
121
|
+
computedPosition.value = newPosition;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return calculateAndApplyPosition({ applyStyles: !1, forAnimation: !0 });
|
|
87
125
|
}
|
|
88
|
-
const trottledUpdatePosition = throttle(() => {
|
|
89
|
-
isOpen.value && !isUpdatingPosition && nextTick(updatePosition);
|
|
90
|
-
}, 16);
|
|
91
126
|
function setupObservers() {
|
|
92
|
-
panelElement.value
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
127
|
+
if (!panelElement.value || !triggerElement.value)
|
|
128
|
+
return;
|
|
129
|
+
const positionRef = getPositionReference();
|
|
130
|
+
positionRef && (window.ResizeObserver && (resizeObserver = new ResizeObserver((entries) => {
|
|
131
|
+
for (const entry of entries)
|
|
132
|
+
if (entry.target === panelElement.value || entry.target === triggerElement.value || entry.target === positionRef) {
|
|
133
|
+
schedulePositionUpdate();
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}), resizeObserver.observe(panelElement.value), resizeObserver.observe(triggerElement.value), positionRef !== triggerElement.value && resizeObserver.observe(positionRef), resizeObserver.observe(document.documentElement)), mutationObserver = new MutationObserver((mutations) => {
|
|
137
|
+
if (isPositioning)
|
|
96
138
|
return;
|
|
97
|
-
|
|
139
|
+
let shouldUpdate = !1;
|
|
140
|
+
for (const mutation of mutations)
|
|
141
|
+
if (!(mutation.target === panelElement.value && mutation.type === "attributes" && mutation.attributeName === "style") && (mutation.type === "childList" || mutation.type === "attributes" && mutation.attributeName === "class")) {
|
|
142
|
+
shouldUpdate = !0;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
shouldUpdate && schedulePositionUpdate();
|
|
98
146
|
}), mutationObserver.observe(panelElement.value, {
|
|
99
147
|
childList: !0,
|
|
100
148
|
subtree: !0,
|
|
@@ -103,10 +151,10 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
103
151
|
}));
|
|
104
152
|
}
|
|
105
153
|
function cleanupObservers() {
|
|
106
|
-
resizeObserver && (resizeObserver.disconnect(), resizeObserver = null), mutationObserver && (mutationObserver.disconnect(), mutationObserver = null);
|
|
154
|
+
positioningFrame && (cancelAnimationFrame(positioningFrame), positioningFrame = null), resizeObserver && (resizeObserver.disconnect(), resizeObserver = null), mutationObserver && (mutationObserver.disconnect(), mutationObserver = null);
|
|
107
155
|
}
|
|
108
156
|
function open() {
|
|
109
|
-
__props.disabled || (clearCloseTimeout(), ignoreNextClickOutside = !0, __props.delay > 0 ? openTimeout = setTimeout(() => {
|
|
157
|
+
__props.disabled || (clearCloseTimeout(), effectiveTrigger.value === "click" && (ignoreNextClickOutside = !0), __props.delay > 0 ? openTimeout = setTimeout(() => {
|
|
110
158
|
setOpen(!0);
|
|
111
159
|
}, __props.delay) : setOpen(!0));
|
|
112
160
|
}
|
|
@@ -121,11 +169,15 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
121
169
|
isOpen.value ? close() : open();
|
|
122
170
|
}
|
|
123
171
|
function setOpen(value) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
updatePosition(), setupObservers();
|
|
127
|
-
}
|
|
128
|
-
})) : (
|
|
172
|
+
value ? (emits("open"), nextTick(() => {
|
|
173
|
+
triggerElement.value && panelElement.value && preparePositionForAnimation(), (() => {
|
|
174
|
+
isOpen.value = value, emits("toggle", value), updatePosition(), setupObservers(), setupFocusTrap();
|
|
175
|
+
})();
|
|
176
|
+
})) : (isOpen.value = value, emits("toggle", value), emits("close"), panelStyles.value = {
|
|
177
|
+
position: "fixed",
|
|
178
|
+
visibility: "hidden",
|
|
179
|
+
pointerEvents: "none"
|
|
180
|
+
}, ignoreNextClickOutside = !1, cleanupObservers(), __props.trapFocus && restoreFocus());
|
|
129
181
|
}
|
|
130
182
|
function clearOpenTimeout() {
|
|
131
183
|
openTimeout && (clearTimeout(openTimeout), openTimeout = null);
|
|
@@ -133,39 +185,15 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
133
185
|
function clearCloseTimeout() {
|
|
134
186
|
closeTimeout && (clearTimeout(closeTimeout), closeTimeout = null);
|
|
135
187
|
}
|
|
136
|
-
function getIsVisible(coords, panelRect, viewport, scrollTop, scrollLeft) {
|
|
137
|
-
return coords.left >= scrollLeft && coords.left + panelRect.width <= scrollLeft + viewport.width && coords.top >= scrollTop && coords.top + panelRect.height <= scrollTop + viewport.height;
|
|
138
|
-
}
|
|
139
|
-
function isPositionVisible(position, triggerRect, panelRect, viewport, scrollTop, scrollLeft) {
|
|
140
|
-
const coords = calculatePosition(position, triggerRect, panelRect, scrollTop, scrollLeft);
|
|
141
|
-
return getIsVisible(coords, panelRect, viewport, scrollTop, scrollLeft);
|
|
142
|
-
}
|
|
143
|
-
function getValidPositions(positions, triggerRect, panelRect, viewport, scrollTop, scrollLeft) {
|
|
144
|
-
const spaces = {
|
|
145
|
-
bottom: viewport.height + scrollTop - triggerRect.bottom,
|
|
146
|
-
top: triggerRect.top - scrollTop,
|
|
147
|
-
right: viewport.width + scrollLeft - triggerRect.right,
|
|
148
|
-
left: triggerRect.left - scrollLeft
|
|
149
|
-
};
|
|
150
|
-
return positions.reduce((acc, pos) => {
|
|
151
|
-
if (isPositionVisible(pos, triggerRect, panelRect, viewport, scrollTop, scrollLeft)) {
|
|
152
|
-
let positionBonus = 0;
|
|
153
|
-
pos === "bottom" ? positionBonus = 1e3 : pos === "top" ? positionBonus = 800 : pos === "right" ? positionBonus = 600 : pos === "left" && (positionBonus = 400);
|
|
154
|
-
const score = spaces[pos] + positionBonus;
|
|
155
|
-
acc.push({ position: pos, score });
|
|
156
|
-
}
|
|
157
|
-
return acc;
|
|
158
|
-
}, []);
|
|
159
|
-
}
|
|
160
188
|
function getBestPosition(triggerRect, viewport) {
|
|
161
189
|
if (!panelElement.value)
|
|
162
190
|
return "bottom";
|
|
163
|
-
const panelRect = panelElement.value.getBoundingClientRect()
|
|
164
|
-
if (__props.preferPosition && isPositionVisible(__props.preferPosition, triggerRect, panelRect, viewport
|
|
191
|
+
const panelRect = panelElement.value.getBoundingClientRect();
|
|
192
|
+
if (__props.preferPosition && isPositionVisible(__props.preferPosition, triggerRect, panelRect, viewport))
|
|
165
193
|
return __props.preferPosition;
|
|
166
194
|
if (__props.preferPosition && __props.fallbackPosition)
|
|
167
195
|
return __props.fallbackPosition;
|
|
168
|
-
const positions = ["bottom", "top", "right", "left"], validPositions = getValidPositions(positions, triggerRect, panelRect, viewport
|
|
196
|
+
const positions = ["bottom", "top", "right", "left"], validPositions = getValidPositions(positions, triggerRect, panelRect, viewport);
|
|
169
197
|
if (validPositions.length === 0) {
|
|
170
198
|
const spaces = {
|
|
171
199
|
top: triggerRect.top,
|
|
@@ -177,31 +205,87 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
177
205
|
}
|
|
178
206
|
return validPositions.sort((a, b) => b.score - a.score)[0].position;
|
|
179
207
|
}
|
|
180
|
-
function calculatePosition(position, triggerRect,
|
|
181
|
-
|
|
208
|
+
function calculatePosition(position, triggerRect, _panelRect) {
|
|
209
|
+
const viewport = { width: window.innerWidth, height: window.innerHeight }, styles = {
|
|
210
|
+
position: "fixed",
|
|
211
|
+
visibility: "visible",
|
|
212
|
+
transformOrigin: getTransformOrigin(position)
|
|
213
|
+
};
|
|
182
214
|
switch (position) {
|
|
183
215
|
case "top":
|
|
184
216
|
case "top-start":
|
|
185
217
|
case "top-end":
|
|
186
|
-
|
|
218
|
+
styles.bottom = `${viewport.height - triggerRect.top + __props.offset}px`, position === "top-start" ? styles.left = `${triggerRect.left}px` : position === "top-end" ? styles.right = `${viewport.width - triggerRect.right}px` : styles.left = `${triggerRect.left + triggerRect.width / 2 - _panelRect.width / 2}px`;
|
|
187
219
|
break;
|
|
188
220
|
case "bottom":
|
|
189
221
|
case "bottom-start":
|
|
190
222
|
case "bottom-end":
|
|
191
|
-
top = triggerRect.bottom +
|
|
223
|
+
styles.top = `${triggerRect.bottom + __props.offset}px`, position === "bottom-start" ? styles.left = `${triggerRect.left}px` : position === "bottom-end" ? styles.right = `${viewport.width - triggerRect.right}px` : styles.left = `${triggerRect.left + triggerRect.width / 2 - _panelRect.width / 2}px`;
|
|
192
224
|
break;
|
|
193
225
|
case "left":
|
|
194
226
|
case "left-start":
|
|
195
227
|
case "left-end":
|
|
196
|
-
|
|
228
|
+
styles.right = `${viewport.width - triggerRect.left + __props.offset}px`, position === "left-start" ? styles.top = `${triggerRect.top}px` : position === "left-end" ? styles.bottom = `${viewport.height - triggerRect.bottom}px` : styles.top = `${triggerRect.top + triggerRect.height / 2 - _panelRect.height / 2}px`;
|
|
197
229
|
break;
|
|
198
230
|
case "right":
|
|
199
231
|
case "right-start":
|
|
200
232
|
case "right-end":
|
|
201
|
-
left = triggerRect.right +
|
|
233
|
+
styles.left = `${triggerRect.right + __props.offset}px`, position === "right-start" ? styles.top = `${triggerRect.top}px` : position === "right-end" ? styles.bottom = `${viewport.height - triggerRect.bottom}px` : styles.top = `${triggerRect.top + triggerRect.height / 2 - _panelRect.height / 2}px`;
|
|
202
234
|
break;
|
|
203
235
|
}
|
|
204
|
-
return
|
|
236
|
+
return styles;
|
|
237
|
+
}
|
|
238
|
+
function getTransformOrigin(position) {
|
|
239
|
+
switch (position) {
|
|
240
|
+
case "top":
|
|
241
|
+
return "center bottom";
|
|
242
|
+
case "top-start":
|
|
243
|
+
return "left bottom";
|
|
244
|
+
case "top-end":
|
|
245
|
+
return "right bottom";
|
|
246
|
+
case "bottom":
|
|
247
|
+
return "center top";
|
|
248
|
+
case "bottom-start":
|
|
249
|
+
return "left top";
|
|
250
|
+
case "bottom-end":
|
|
251
|
+
return "right top";
|
|
252
|
+
case "left":
|
|
253
|
+
return "right center";
|
|
254
|
+
case "left-start":
|
|
255
|
+
return "right top";
|
|
256
|
+
case "left-end":
|
|
257
|
+
return "right bottom";
|
|
258
|
+
case "right":
|
|
259
|
+
return "left center";
|
|
260
|
+
case "right-start":
|
|
261
|
+
return "left top";
|
|
262
|
+
case "right-end":
|
|
263
|
+
return "left bottom";
|
|
264
|
+
default:
|
|
265
|
+
return "center";
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function isPositionVisible(position, triggerRect, panelRect, viewport) {
|
|
269
|
+
const styles = calculatePosition(position, triggerRect, panelRect);
|
|
270
|
+
let top = 0, left = 0;
|
|
271
|
+
return styles.top ? top = Number.parseInt(styles.top) : styles.bottom && (top = viewport.height - Number.parseInt(styles.bottom) - panelRect.height), styles.left ? left = Number.parseInt(styles.left) : styles.right && (left = viewport.width - Number.parseInt(styles.right) - panelRect.width), styles.transform?.includes("translateX(-50%)") && (left -= panelRect.width / 2), styles.transform?.includes("translateY(-50%)") && (top -= panelRect.height / 2), left >= 0 && left + panelRect.width <= viewport.width && top >= 0 && top + panelRect.height <= viewport.height;
|
|
272
|
+
}
|
|
273
|
+
function getValidPositions(positions, triggerRect, panelRect, viewport) {
|
|
274
|
+
const spaces = {
|
|
275
|
+
bottom: viewport.height - triggerRect.bottom,
|
|
276
|
+
top: triggerRect.top,
|
|
277
|
+
right: viewport.width - triggerRect.right,
|
|
278
|
+
left: triggerRect.left
|
|
279
|
+
};
|
|
280
|
+
return positions.reduce((acc, pos) => {
|
|
281
|
+
if (isPositionVisible(pos, triggerRect, panelRect, viewport)) {
|
|
282
|
+
let positionBonus = 0;
|
|
283
|
+
pos === "bottom" ? positionBonus = 1e3 : pos === "top" ? positionBonus = 800 : pos === "right" ? positionBonus = 600 : pos === "left" && (positionBonus = 400);
|
|
284
|
+
const score = spaces[pos] + positionBonus;
|
|
285
|
+
acc.push({ position: pos, score });
|
|
286
|
+
}
|
|
287
|
+
return acc;
|
|
288
|
+
}, []);
|
|
205
289
|
}
|
|
206
290
|
function setupFocusTrap() {
|
|
207
291
|
__props.role === "tooltip" || __props.role === "menu" || effectiveTrigger.value === "hover" || !__props.trapFocus || (initialFocusElement = document.activeElement, nextTick(() => {
|
|
@@ -243,17 +327,19 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
243
327
|
}
|
|
244
328
|
}
|
|
245
329
|
}
|
|
246
|
-
function
|
|
247
|
-
isOpen.value &&
|
|
330
|
+
function onScrollThrottled() {
|
|
331
|
+
isOpen.value && schedulePositionUpdate();
|
|
248
332
|
}
|
|
249
333
|
return watch(isOpen, (value, oldValue) => {
|
|
250
334
|
!isClient() || value === oldValue || (value ? open() : oldValue && !value && close());
|
|
251
|
-
}, { immediate: !0 }), watch(() => __props.position, () => {
|
|
252
|
-
isOpen.value && nextTick(updatePosition);
|
|
335
|
+
}, { immediate: !0 }), watch(() => __props.position, (newPosition) => {
|
|
336
|
+
newPosition !== "auto" && (computedPosition.value = newPosition), isOpen.value && nextTick(updatePosition);
|
|
253
337
|
}), onMounted(() => {
|
|
254
|
-
document.addEventListener("keydown", onKeydown), window.addEventListener("scroll",
|
|
338
|
+
document.addEventListener("keydown", onKeydown), window.addEventListener("scroll", onScrollThrottled, { passive: !0, capture: !0 }), window.addEventListener("resize", onScrollThrottled, { passive: !0 });
|
|
339
|
+
}), onBeforeUnmount(() => {
|
|
340
|
+
cleanupObservers(), clearOpenTimeout(), clearCloseTimeout();
|
|
255
341
|
}), onUnmounted(() => {
|
|
256
|
-
document.removeEventListener("keydown", onKeydown), window.removeEventListener("scroll",
|
|
342
|
+
document.removeEventListener("keydown", onKeydown), window.removeEventListener("scroll", onScrollThrottled, !0), window.removeEventListener("resize", onScrollThrottled);
|
|
257
343
|
}), __expose({
|
|
258
344
|
/**
|
|
259
345
|
* Open the popover
|
|
@@ -352,7 +438,7 @@ import '../assets/MazPopover.COR-tym7.css';const _hoisted_1 = ["id", "aria-expan
|
|
|
352
438
|
], 8, ["to", "disabled"]))
|
|
353
439
|
], 6));
|
|
354
440
|
}
|
|
355
|
-
}), MazPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
441
|
+
}), MazPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2e23bfe3"]]);
|
|
356
442
|
export {
|
|
357
443
|
MazPopover as default
|
|
358
444
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { defineComponent, defineAsyncComponent, computed, ref, watch, onUnmounted, createElementBlock, openBlock, normalizeClass, createCommentVNode, renderSlot, normalizeStyle, createElementVNode, createVNode, unref } from "vue";
|
|
2
2
|
import { i as isClient } from "../chunks/isClient.WI4oSt66.js";
|
|
3
|
-
import { i as isStandaloneMode } from "../chunks/isStandaloneMode.BpUpOTbA.js";
|
|
4
3
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
5
|
-
import '../assets/MazPullToRefresh.DABqbGtK.css';
|
|
4
|
+
import '../assets/MazPullToRefresh.DABqbGtK.css';function isStandaloneMode() {
|
|
5
|
+
if (!isClient())
|
|
6
|
+
return !1;
|
|
7
|
+
const nav = navigator, isStandalone = window.matchMedia("(display-mode: standalone)").matches;
|
|
8
|
+
return nav.standalone || isStandalone;
|
|
9
|
+
}
|
|
10
|
+
const _hoisted_1 = {
|
|
6
11
|
key: 0,
|
|
7
12
|
class: "header-text"
|
|
8
13
|
}, _hoisted_2 = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, mergeProps, renderSlot, createCommentVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
|
|
3
3
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
|
|
4
|
-
import '../assets/MazRadio.
|
|
4
|
+
import '../assets/MazRadio.XGYnbTuB.css';const _hoisted_1 = ["for", "aria-checked"], _hoisted_2 = ["id", "value", "disabled", "name", "checked"], _hoisted_3 = { class: "m-radio__text" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
__name: "MazRadio",
|
|
6
6
|
props: {
|
|
7
7
|
style: { default: void 0 },
|
|
@@ -24,7 +24,7 @@ import '../assets/MazRadio.DKMFWwy_.css';const _hoisted_1 = ["for", "aria-checke
|
|
|
24
24
|
const props = __props, emits = __emit, instanceId = useInstanceUniqId({
|
|
25
25
|
componentName: "MazRadio",
|
|
26
26
|
providedId: props.id
|
|
27
|
-
}), isSelected = computed(() => props.modelValue === props.value), radioSize = computed(() => {
|
|
27
|
+
}), inputRef = ref(), isFocused = ref(!1), isSelected = computed(() => props.modelValue === props.value), radioSize = computed(() => {
|
|
28
28
|
switch (props.size) {
|
|
29
29
|
case "xl":
|
|
30
30
|
return "2.25rem";
|
|
@@ -39,30 +39,22 @@ import '../assets/MazRadio.DKMFWwy_.css';const _hoisted_1 = ["for", "aria-checke
|
|
|
39
39
|
default:
|
|
40
40
|
return "1.625rem";
|
|
41
41
|
}
|
|
42
|
-
}), radioSelectedColor = computed(() => `hsl(var(--maz-${props.color}))`), radioBoxShadow = computed(() => {
|
|
43
|
-
if (props.error)
|
|
44
|
-
return "hsl(var(--maz-destructive))";
|
|
45
|
-
if (props.warning)
|
|
46
|
-
return "hsl(var(--maz-warning))";
|
|
47
|
-
if (props.success)
|
|
48
|
-
return "hsl(var(--maz-success))";
|
|
49
|
-
});
|
|
42
|
+
}), radioSelectedColor = computed(() => `hsl(var(--maz-${props.color}))`), radioBoxShadow = computed(() => props.error && !isFocused.value ? "hsl(var(--maz-destructive))" : props.warning && !isFocused.value ? "hsl(var(--maz-warning))" : props.success && !isFocused.value ? "hsl(var(--maz-success))" : ["transparent", "contrast"].includes(props.color) ? "hsl(var(--maz-muted))" : `hsl(var(--maz-${props.color}) / 60%)`);
|
|
50
43
|
function keyboardHandler(event) {
|
|
51
44
|
["Space"].includes(event.code) && (event.preventDefault(), emitValue());
|
|
52
45
|
}
|
|
53
46
|
function emitValue() {
|
|
54
47
|
emits("update:model-value", props.value), emits("change", props.value);
|
|
55
48
|
}
|
|
56
|
-
const inputRef = ref();
|
|
57
49
|
function onBlur(event) {
|
|
58
|
-
inputRef.value?.dispatchEvent(new Event("blur")), emits("blur", event);
|
|
50
|
+
isFocused.value = !1, inputRef.value?.dispatchEvent(new Event("blur")), emits("blur", event);
|
|
59
51
|
}
|
|
60
52
|
function onFocus(event) {
|
|
61
|
-
inputRef.value?.dispatchEvent(new Event("focus")), emits("focus", event);
|
|
53
|
+
isFocused.value = !0, inputRef.value?.dispatchEvent(new Event("focus")), emits("focus", event);
|
|
62
54
|
}
|
|
63
55
|
return (_ctx, _cache) => (openBlock(), createElementBlock("label", {
|
|
64
56
|
for: unref(instanceId),
|
|
65
|
-
class: normalizeClass(["m-radio m-reset-css", [{ "--
|
|
57
|
+
class: normalizeClass(["m-radio m-reset-css", [{ "--selected": isSelected.value, "--error": _ctx.error, "--warning": _ctx.warning, "--success": _ctx.success }, props.class]]),
|
|
66
58
|
tabindex: "0",
|
|
67
59
|
role: "radio",
|
|
68
60
|
style: normalizeStyle([_ctx.style, { "--radio-size": radioSize.value, "--radio-selected-color": radioSelectedColor.value, "--radio-box-shadow": radioBoxShadow.value }]),
|
|
@@ -105,7 +97,7 @@ import '../assets/MazRadio.DKMFWwy_.css';const _hoisted_1 = ["for", "aria-checke
|
|
|
105
97
|
])
|
|
106
98
|
], 46, _hoisted_1));
|
|
107
99
|
}
|
|
108
|
-
}), MazRadio = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
100
|
+
}), MazRadio = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bd84ba83"]]);
|
|
109
101
|
export {
|
|
110
102
|
MazRadio as default
|
|
111
103
|
};
|