maz-ui 3.22.4 → 3.23.1
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/components/MazAvatar.mjs +2 -2
- package/components/MazBackdrop.mjs +67 -107
- package/components/MazBadge.mjs +41 -50
- package/components/MazBottomSheet.mjs +2 -2
- package/components/MazBtn.mjs +2 -2
- package/components/MazCard.mjs +2 -2
- package/components/MazCarousel.mjs +2 -2
- package/components/MazChart.mjs +53 -63
- package/components/MazCheckbox.mjs +84 -128
- package/components/MazDialog.mjs +2 -2
- package/components/MazDialogPromise.mjs +3 -3
- package/components/MazDrawer.mjs +2 -2
- package/components/MazDropdown.mjs +2 -2
- package/components/MazDropzone.mjs +2 -2
- package/components/MazFullscreenLoader.mjs +14 -18
- package/components/MazGallery.mjs +352 -558
- package/components/MazIcon.mjs +76 -140
- package/components/MazInput.mjs +2 -2
- package/components/MazInputNumber.mjs +72 -99
- package/components/MazInputPrice.mjs +2 -2
- package/components/MazInputTags.mjs +2 -2
- package/components/MazLazyImg.mjs +2 -2
- package/components/MazPhoneNumberInput.mjs +2 -2
- package/components/MazPicker.mjs +2 -2
- package/components/MazRadio.mjs +65 -94
- package/components/MazRadioButtons.mjs +64 -78
- package/components/MazSelect.mjs +2 -2
- package/components/MazSlider.mjs +213 -325
- package/components/MazSpinner.mjs +25 -34
- package/components/MazStepper.mjs +2 -2
- package/components/MazSwitch.mjs +43 -60
- package/components/MazTabs.mjs +16 -25
- package/components/MazTabsBar.mjs +2 -2
- package/components/MazTabsContent.mjs +34 -43
- package/components/MazTabsContentItem.mjs +49 -63
- package/components/MazTextarea.mjs +124 -169
- package/components/MazTransitionExpand.mjs +36 -54
- package/components/assets/MazBackdrop.css +1 -1
- package/components/assets/MazBottomSheet.css +1 -1
- package/components/assets/MazDialog.css +1 -1
- package/components/assets/MazDialogPromise.css +1 -1
- package/components/assets/MazDrawer.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/chunks/MazAvatar-1636f58b.mjs +126 -0
- package/components/chunks/MazBottomSheet-c24f92f8.mjs +217 -0
- package/components/chunks/MazBtn-124f3700.mjs +153 -0
- package/components/chunks/MazBtn-1e61862b.mjs +153 -0
- package/components/chunks/MazBtn-2d1d1ba5.mjs +153 -0
- package/components/chunks/MazBtn-3d74f737.mjs +153 -0
- package/components/chunks/MazBtn-4a447126.mjs +153 -0
- package/components/chunks/MazBtn-555928ed.mjs +153 -0
- package/components/chunks/MazBtn-571454f6.mjs +153 -0
- package/components/chunks/MazBtn-5e426592.mjs +153 -0
- package/components/chunks/MazBtn-683effc1.mjs +153 -0
- package/components/chunks/MazBtn-6905cc39.mjs +153 -0
- package/components/chunks/MazBtn-6ce4cfd3.mjs +153 -0
- package/components/chunks/MazBtn-74656d5b.mjs +153 -0
- package/components/chunks/MazBtn-7706b2da.mjs +158 -0
- package/components/chunks/MazBtn-a7a913dd.mjs +153 -0
- package/components/chunks/MazBtn-fb3c7af8.mjs +153 -0
- package/components/chunks/MazCard-bcc36489.mjs +214 -0
- package/components/chunks/MazCarousel-6da75122.mjs +107 -0
- package/components/chunks/MazCheckbox-040dc2c4.mjs +117 -0
- package/components/chunks/MazCheckbox-3a2b48b4.mjs +117 -0
- package/components/chunks/MazDialog-44eda544.mjs +250 -0
- package/components/chunks/MazDialogPromise-eec5acde.mjs +419 -0
- package/components/chunks/MazDrawer-b628b37e.mjs +206 -0
- package/components/chunks/MazDropdown-6f2248b0.mjs +345 -0
- package/components/chunks/MazDropzone-8cac10a6.mjs +242 -0
- package/components/chunks/MazGallery-6b8ecedf.mjs +617 -0
- package/components/chunks/MazIcon-52a76873.mjs +101 -0
- package/components/chunks/MazIcon-95e31ff8.mjs +96 -0
- package/components/chunks/MazInput-1ed4f946.mjs +283 -0
- package/components/chunks/MazInput-8a217995.mjs +271 -0
- package/components/chunks/MazInput-c51881ea.mjs +278 -0
- package/components/chunks/MazInputPrice-cd348d46.mjs +392 -0
- package/components/chunks/MazInputTags-aa95fae7.mjs +446 -0
- package/components/chunks/MazLazyImg-0412ab38.mjs +259 -0
- package/components/chunks/MazLazyImg-47d3449a.mjs +254 -0
- package/components/chunks/MazPhoneNumberInput-e1bf46f9.mjs +1216 -0
- package/components/chunks/MazPicker-e4620d8b.mjs +1140 -0
- package/components/chunks/MazPickerCalendar-da62262c.mjs +535 -0
- package/components/chunks/MazPickerHeader-a2e041eb.mjs +186 -0
- package/components/chunks/MazPickerMonthSwitcher-5bf8bd08.mjs +97 -0
- package/components/chunks/MazPickerShortcuts-7f95430e.mjs +74 -0
- package/components/chunks/MazPickerTime-717402ae.mjs +219 -0
- package/components/chunks/MazPickerYearSwitcher-85f97b6d.mjs +106 -0
- package/components/chunks/MazSelect-6ff6bb96.mjs +652 -0
- package/components/chunks/MazSpinner-054f948c.mjs +39 -0
- package/components/chunks/MazSpinner-059ee1d2.mjs +39 -0
- package/components/chunks/MazSpinner-08ee440b.mjs +39 -0
- package/components/chunks/MazSpinner-13403729.mjs +39 -0
- package/components/chunks/MazSpinner-44011019.mjs +39 -0
- package/components/chunks/MazSpinner-452a1534.mjs +39 -0
- package/components/chunks/MazSpinner-4c02cfd2.mjs +39 -0
- package/components/chunks/MazSpinner-51aa73ca.mjs +39 -0
- package/components/chunks/MazSpinner-6d1d24d5.mjs +39 -0
- package/components/chunks/MazSpinner-6e7c4705.mjs +39 -0
- package/components/chunks/MazSpinner-7895f54f.mjs +39 -0
- package/components/chunks/MazSpinner-7eee202e.mjs +39 -0
- package/components/chunks/MazSpinner-805e14a6.mjs +39 -0
- package/components/chunks/MazSpinner-85080b43.mjs +39 -0
- package/components/chunks/MazSpinner-a13a50c9.mjs +39 -0
- package/components/chunks/MazSpinner-a6d61cee.mjs +43 -0
- package/components/chunks/MazSpinner-c67b05bb.mjs +39 -0
- package/components/chunks/MazSpinner-caa33afc.mjs +39 -0
- package/components/chunks/MazSpinner-cb8fbe9a.mjs +39 -0
- package/components/chunks/MazSpinner-d9ef329f.mjs +39 -0
- package/components/chunks/MazStepper-39f018f3.mjs +191 -0
- package/components/chunks/MazTabsBar-27965f16.mjs +132 -0
- package/components/chunks/MazTransitionExpand-55cfbecb.mjs +41 -0
- package/components/chunks/MazTransitionExpand-cd24498f.mjs +41 -0
- package/components/chunks/_plugin-vue_export-helper-dad06003.mjs +9 -0
- package/components/chunks/check-31d7ba2f.mjs +30 -0
- package/components/chunks/check-c9b483c0.mjs +30 -0
- package/components/chunks/{check-circle-7acfa4c4.mjs → check-circle-59c383ed.mjs} +10 -12
- package/components/chunks/chevron-down-2b60111a.mjs +30 -0
- package/components/chunks/chevron-left-39b4621e.mjs +30 -0
- package/components/chunks/chevron-right-949a60fa.mjs +30 -0
- package/components/chunks/debounce-19c516b6.mjs +11 -0
- package/components/chunks/examples.mobile.json-f63d22fb.mjs +4 -0
- package/components/chunks/{exclamation-circle-2e115536.mjs → exclamation-circle-e2620aab.mjs} +10 -12
- package/components/chunks/{exclamation-triangle-10eb48dc.mjs → exclamation-triangle-21bf116a.mjs} +10 -12
- package/components/chunks/{eye-fbb13657.mjs → eye-dc12ce09.mjs} +12 -15
- package/components/chunks/{eye-slash-342420ff.mjs → eye-slash-fa42a017.mjs} +10 -12
- package/components/chunks/{magnifying-glass-5dffa35e.mjs → magnifying-glass-908981c0.mjs} +10 -12
- package/components/chunks/minus-e71140e1.mjs +30 -0
- package/components/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/components/chunks/{no-photography-b0d08d6f.mjs → no-photography-be94ddda.mjs} +12 -15
- package/components/chunks/{no-symbol-975ce547.mjs → no-symbol-87477ad0.mjs} +10 -12
- package/components/chunks/{pencil-2f766dc8.mjs → pencil-4c35b4e7.mjs} +10 -12
- package/components/chunks/plus-c20544c3.mjs +30 -0
- package/components/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/components/chunks/x-mark-7761acf4.mjs +29 -0
- package/modules/chunks/MazBtn-2f302422.cjs +1 -0
- package/modules/chunks/MazBtn-760c3b29.mjs +153 -0
- package/modules/chunks/MazIcon-0bd6b78e.mjs +96 -0
- package/modules/chunks/MazIcon-599a907f.cjs +1 -0
- package/modules/chunks/MazSpinner-03bd76bd.mjs +39 -0
- package/modules/chunks/MazSpinner-6ffa8db1.cjs +1 -0
- package/modules/chunks/{arrow-top-right-on-square-32bbe5a1.mjs → arrow-top-right-on-square-15191934.mjs} +10 -12
- package/modules/chunks/arrow-top-right-on-square-8e4ea6e2.cjs +1 -0
- package/modules/chunks/chevron-left-36731110.cjs +1 -0
- package/modules/chunks/chevron-left-39b4621e.mjs +30 -0
- package/modules/chunks/index-6a90ef88.mjs +1618 -0
- package/modules/chunks/index-794680d2.cjs +124 -0
- package/modules/chunks/{link-4eb05848.mjs → link-bb14441d.mjs} +10 -12
- package/modules/chunks/link-c7791a2a.cjs +1 -0
- package/modules/chunks/no-photography-0f6fcaf4.cjs +1 -0
- package/modules/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/modules/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/modules/chunks/x-mark-a28deca5.cjs +1 -0
- package/modules/index.cjs +1 -0
- package/modules/index.mjs +42 -42
- package/nuxt/index.json +1 -1
- package/package.json +14 -4
- package/types/resolvers/index.d.ts +1 -0
- package/types/resolvers/unplugin-vue-components-resolver.d.ts +8 -0
- package/types/utils/index.d.ts +3 -0
- package/components/chunks/MazAvatar-358d78d4.mjs +0 -138
- package/components/chunks/MazBottomSheet-61090f4a.mjs +0 -267
- package/components/chunks/MazBtn-0e02f0da.mjs +0 -184
- package/components/chunks/MazBtn-1daf9063.mjs +0 -184
- package/components/chunks/MazBtn-2f4fa942.mjs +0 -184
- package/components/chunks/MazBtn-31c6b731.mjs +0 -184
- package/components/chunks/MazBtn-48382169.mjs +0 -184
- package/components/chunks/MazBtn-4e1e116e.mjs +0 -184
- package/components/chunks/MazBtn-50abc4c5.mjs +0 -184
- package/components/chunks/MazBtn-84e12b6a.mjs +0 -184
- package/components/chunks/MazBtn-b42e3575.mjs +0 -184
- package/components/chunks/MazBtn-b56a7278.mjs +0 -184
- package/components/chunks/MazBtn-bbd6e9c8.mjs +0 -184
- package/components/chunks/MazBtn-cf0c8fcb.mjs +0 -184
- package/components/chunks/MazBtn-d92908b2.mjs +0 -191
- package/components/chunks/MazBtn-f48da79c.mjs +0 -184
- package/components/chunks/MazBtn-fec4c3b7.mjs +0 -184
- package/components/chunks/MazCard-4331dca0.mjs +0 -237
- package/components/chunks/MazCarousel-7825c7c9.mjs +0 -133
- package/components/chunks/MazCheckbox-ab5ddda2.mjs +0 -153
- package/components/chunks/MazCheckbox-e0bbe6ec.mjs +0 -153
- package/components/chunks/MazDialog-83e54b8c.mjs +0 -290
- package/components/chunks/MazDialogPromise-6967e821.mjs +0 -474
- package/components/chunks/MazDrawer-d778b3d2.mjs +0 -256
- package/components/chunks/MazDropdown-6f4482d7.mjs +0 -426
- package/components/chunks/MazDropzone-d1bb62dc.mjs +0 -325
- package/components/chunks/MazGallery-b2dc4286.mjs +0 -821
- package/components/chunks/MazIcon-b779da0a.mjs +0 -159
- package/components/chunks/MazIcon-bda198b4.mjs +0 -165
- package/components/chunks/MazInput-713b00d0.mjs +0 -326
- package/components/chunks/MazInput-b9386887.mjs +0 -341
- package/components/chunks/MazInput-c33627dd.mjs +0 -334
- package/components/chunks/MazInputPrice-452297f5.mjs +0 -481
- package/components/chunks/MazInputTags-7a463b81.mjs +0 -526
- package/components/chunks/MazLazyImg-6e395356.mjs +0 -336
- package/components/chunks/MazLazyImg-e0d8b6d0.mjs +0 -329
- package/components/chunks/MazPhoneNumberInput-48fe2445.mjs +0 -1536
- package/components/chunks/MazPicker-50fc11d1.mjs +0 -1352
- package/components/chunks/MazPickerCalendar-cacb361c.mjs +0 -689
- package/components/chunks/MazPickerHeader-63d45179.mjs +0 -216
- package/components/chunks/MazPickerMonthSwitcher-913c6e2c.mjs +0 -110
- package/components/chunks/MazPickerShortcuts-c6fabfc6.mjs +0 -88
- package/components/chunks/MazPickerTime-5e4475da.mjs +0 -301
- package/components/chunks/MazPickerYearSwitcher-dd4fa89c.mjs +0 -125
- package/components/chunks/MazSelect-2e5cd411.mjs +0 -850
- package/components/chunks/MazSpinner-022d7bee.mjs +0 -46
- package/components/chunks/MazSpinner-100c99b8.mjs +0 -46
- package/components/chunks/MazSpinner-191ad23b.mjs +0 -46
- package/components/chunks/MazSpinner-3155378b.mjs +0 -46
- package/components/chunks/MazSpinner-339a9006.mjs +0 -46
- package/components/chunks/MazSpinner-53979e96.mjs +0 -46
- package/components/chunks/MazSpinner-68d2f2ac.mjs +0 -46
- package/components/chunks/MazSpinner-6b563b22.mjs +0 -46
- package/components/chunks/MazSpinner-7cdc13e7.mjs +0 -46
- package/components/chunks/MazSpinner-8859d658.mjs +0 -46
- package/components/chunks/MazSpinner-8e180605.mjs +0 -52
- package/components/chunks/MazSpinner-9950424b.mjs +0 -46
- package/components/chunks/MazSpinner-c8270a93.mjs +0 -46
- package/components/chunks/MazSpinner-cb491238.mjs +0 -46
- package/components/chunks/MazSpinner-cb6f99f3.mjs +0 -46
- package/components/chunks/MazSpinner-ce4be8f1.mjs +0 -46
- package/components/chunks/MazSpinner-e5a9f319.mjs +0 -46
- package/components/chunks/MazSpinner-e92bd359.mjs +0 -46
- package/components/chunks/MazSpinner-eea9056d.mjs +0 -46
- package/components/chunks/MazSpinner-f1e69f29.mjs +0 -46
- package/components/chunks/MazStepper-4c19dbfc.mjs +0 -255
- package/components/chunks/MazTabsBar-3c2e2d69.mjs +0 -157
- package/components/chunks/MazTransitionExpand-474b00d4.mjs +0 -57
- package/components/chunks/MazTransitionExpand-f9e5a2d6.mjs +0 -57
- package/components/chunks/_plugin-vue_export-helper-cc2b3d55.mjs +0 -10
- package/components/chunks/check-8da249b1.mjs +0 -32
- package/components/chunks/check-f2fcce10.mjs +0 -32
- package/components/chunks/chevron-down-a78b9604.mjs +0 -32
- package/components/chunks/chevron-left-3365d59b.mjs +0 -32
- package/components/chunks/chevron-right-02f9e837.mjs +0 -32
- package/components/chunks/debounce-7d66ffa9.mjs +0 -12
- package/components/chunks/examples.mobile.json-618ba782.mjs +0 -4
- package/components/chunks/minus-c9cdee90.mjs +0 -32
- package/components/chunks/no-photography-7f2be516.mjs +0 -4
- package/components/chunks/plus-b1b0a5a8.mjs +0 -32
- package/components/chunks/x-mark-3b05101b.mjs +0 -31
- package/components/chunks/x-mark-c6ff45dd.mjs +0 -32
- package/modules/chunks/MazBtn-90ffd148.mjs +0 -184
- package/modules/chunks/MazIcon-988edef7.mjs +0 -159
- package/modules/chunks/MazSpinner-a16a3d8f.mjs +0 -46
- package/modules/chunks/chevron-left-3365d59b.mjs +0 -32
- package/modules/chunks/index-b1625fc2.mjs +0 -2315
- package/modules/chunks/no-photography-7f2be516.mjs +0 -4
- package/modules/chunks/x-mark-c6ff45dd.mjs +0 -32
|
@@ -1,850 +0,0 @@
|
|
|
1
|
-
import "../assets/MazSelect.css";
|
|
2
|
-
import { computed, defineComponent, defineAsyncComponent, ref, getCurrentInstance, onMounted, useSlots, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createVNode, unref, createCommentVNode, withDirectives, mergeProps, toHandlers, vModelDynamic, createTextVNode, toDisplayString, createBlock, withModifiers, withCtx, useCssVars, onBeforeMount, watch, Transition, Fragment, renderList, nextTick } from "vue";
|
|
3
|
-
function debounce(fn, delay) {
|
|
4
|
-
let timeout2;
|
|
5
|
-
return function(...args) {
|
|
6
|
-
clearTimeout(timeout2);
|
|
7
|
-
timeout2 = setTimeout(() => {
|
|
8
|
-
fn.apply(this, args);
|
|
9
|
-
}, delay);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const useInstanceUniqId = ({
|
|
13
|
-
componentName,
|
|
14
|
-
instance,
|
|
15
|
-
providedId
|
|
16
|
-
}) => {
|
|
17
|
-
return computed(() => providedId ?? `${componentName}-${instance == null ? void 0 : instance.uid}`);
|
|
18
|
-
};
|
|
19
|
-
const _hoisted_1$1 = {
|
|
20
|
-
key: 0,
|
|
21
|
-
class: "m-input-wrapper-left"
|
|
22
|
-
};
|
|
23
|
-
const _hoisted_2$1 = { class: "m-input-wrapper-input" };
|
|
24
|
-
const _hoisted_3$1 = ["id", "type", "name", "placeholder", "aria-label", "disabled", "readonly", "required"];
|
|
25
|
-
const _hoisted_4$1 = { key: 0 };
|
|
26
|
-
const _hoisted_5$1 = {
|
|
27
|
-
key: 1,
|
|
28
|
-
class: "m-input-wrapper-right"
|
|
29
|
-
};
|
|
30
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
31
|
-
...{
|
|
32
|
-
inheritAttrs: false
|
|
33
|
-
},
|
|
34
|
-
__name: "MazInput",
|
|
35
|
-
props: {
|
|
36
|
-
style: { type: [String, Array, Object], default: void 0 },
|
|
37
|
-
class: { type: String, default: void 0 },
|
|
38
|
-
modelValue: {
|
|
39
|
-
type: [String, Number, Boolean],
|
|
40
|
-
default: void 0
|
|
41
|
-
},
|
|
42
|
-
placeholder: { type: String, default: void 0 },
|
|
43
|
-
color: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: "primary"
|
|
46
|
-
},
|
|
47
|
-
label: { type: String, default: void 0 },
|
|
48
|
-
name: { type: String, default: "input" },
|
|
49
|
-
type: {
|
|
50
|
-
type: String,
|
|
51
|
-
default: "text",
|
|
52
|
-
validator: (value) => {
|
|
53
|
-
return [
|
|
54
|
-
"text",
|
|
55
|
-
"date",
|
|
56
|
-
"number",
|
|
57
|
-
"tel",
|
|
58
|
-
"search",
|
|
59
|
-
"url",
|
|
60
|
-
"password",
|
|
61
|
-
"month",
|
|
62
|
-
"time",
|
|
63
|
-
"week",
|
|
64
|
-
"email"
|
|
65
|
-
].includes(value);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
required: { type: Boolean, default: false },
|
|
69
|
-
disabled: { type: Boolean, default: false },
|
|
70
|
-
readonly: { type: Boolean, default: false },
|
|
71
|
-
id: { type: String, default: void 0 },
|
|
72
|
-
error: { type: Boolean, default: false },
|
|
73
|
-
success: { type: Boolean, default: false },
|
|
74
|
-
warning: { type: Boolean, default: false },
|
|
75
|
-
hint: { type: String, default: void 0 },
|
|
76
|
-
inputClasses: { type: String, default: void 0 },
|
|
77
|
-
noBorder: { type: Boolean, default: false },
|
|
78
|
-
noRadius: { type: Boolean, default: false },
|
|
79
|
-
size: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: "md",
|
|
82
|
-
validator: (value) => {
|
|
83
|
-
return ["mini", "xs", "sm", "md", "lg", "xl"].includes(value);
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
debounce: { type: Boolean, default: false },
|
|
87
|
-
debounceDelay: { type: Number, default: 500 },
|
|
88
|
-
validButton: { type: Boolean, default: false },
|
|
89
|
-
validButtonLoading: { type: Boolean, default: false },
|
|
90
|
-
autoFocus: { type: Boolean, default: false },
|
|
91
|
-
borderActive: { type: Boolean, default: false },
|
|
92
|
-
leftIcon: { type: String, default: void 0 },
|
|
93
|
-
rightIcon: { type: String, default: void 0 }
|
|
94
|
-
},
|
|
95
|
-
emits: ["focus", "blur", "update:model-value", "click", "change", "update"],
|
|
96
|
-
setup(__props, { emit: __emit }) {
|
|
97
|
-
const MazBtn = defineAsyncComponent(() => import("./MazBtn-2f4fa942.mjs"));
|
|
98
|
-
const MazIcon = defineAsyncComponent(() => import("./MazIcon-bda198b4.mjs"));
|
|
99
|
-
const EyeOffIcon = defineAsyncComponent(() => import("./eye-slash-342420ff.mjs"));
|
|
100
|
-
const EyeIcon = defineAsyncComponent(() => import("./eye-fbb13657.mjs"));
|
|
101
|
-
const CheckIcon = defineAsyncComponent(() => import("./check-8da249b1.mjs"));
|
|
102
|
-
const props = __props;
|
|
103
|
-
const emits = __emit;
|
|
104
|
-
const hasPasswordVisible = ref(false);
|
|
105
|
-
const isFocused = ref(false);
|
|
106
|
-
const input = ref();
|
|
107
|
-
const instance = getCurrentInstance();
|
|
108
|
-
const instanceId = useInstanceUniqId({
|
|
109
|
-
componentName: "MazInput",
|
|
110
|
-
instance,
|
|
111
|
-
providedId: props.id
|
|
112
|
-
});
|
|
113
|
-
onMounted(() => {
|
|
114
|
-
var _a;
|
|
115
|
-
if (props.autoFocus) {
|
|
116
|
-
(_a = input.value) == null ? void 0 : _a.focus();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const inheritClasses = computed(() => props.class);
|
|
120
|
-
const isPasswordType = computed(() => props.type === "password");
|
|
121
|
-
const inputType = computed(() => hasPasswordVisible.value ? "text" : props.type);
|
|
122
|
-
const borderStyle = computed(() => {
|
|
123
|
-
if (props.noBorder)
|
|
124
|
-
return void 0;
|
|
125
|
-
if (props.error)
|
|
126
|
-
return "maz-border-danger";
|
|
127
|
-
if (props.success)
|
|
128
|
-
return "maz-border-success";
|
|
129
|
-
if (props.warning)
|
|
130
|
-
return "maz-border-warning";
|
|
131
|
-
if (isFocused.value || props.borderActive) {
|
|
132
|
-
if (props.color === "black")
|
|
133
|
-
return "maz-border-black";
|
|
134
|
-
if (props.color === "danger")
|
|
135
|
-
return "maz-border-danger";
|
|
136
|
-
if (props.color === "info")
|
|
137
|
-
return "maz-border-info";
|
|
138
|
-
if (props.color === "primary")
|
|
139
|
-
return "maz-border-primary";
|
|
140
|
-
if (props.color === "secondary")
|
|
141
|
-
return "maz-border-secondary";
|
|
142
|
-
if (props.color === "success")
|
|
143
|
-
return "maz-border-success";
|
|
144
|
-
if (props.color === "warning")
|
|
145
|
-
return "maz-border-warning";
|
|
146
|
-
if (props.color === "white")
|
|
147
|
-
return "maz-border-white";
|
|
148
|
-
}
|
|
149
|
-
return "--default-border";
|
|
150
|
-
});
|
|
151
|
-
const slots = useSlots();
|
|
152
|
-
const computedPlaceholder = computed(() => {
|
|
153
|
-
const { required, placeholder } = props;
|
|
154
|
-
if (!placeholder)
|
|
155
|
-
return void 0;
|
|
156
|
-
return required ? `${placeholder} *` : placeholder;
|
|
157
|
-
});
|
|
158
|
-
const hasValue = computed(() => props.modelValue !== void 0 && props.modelValue !== "");
|
|
159
|
-
const inputValue = computed({
|
|
160
|
-
get: () => props.modelValue,
|
|
161
|
-
set: (value) => emitValue(value)
|
|
162
|
-
});
|
|
163
|
-
const shouldUp = computed(() => {
|
|
164
|
-
return (!!props.label || !!props.hint) && (isFocused.value || !!hasValue.value || !!props.placeholder || ["date", "month", "week"].includes(props.type));
|
|
165
|
-
});
|
|
166
|
-
const hasLabel = computed(() => !!props.label || !!props.hint);
|
|
167
|
-
const hasRightPart = () => {
|
|
168
|
-
return !!slots["right-icon"] || isPasswordType.value || !!slots["valid-button"] || props.validButton || !!props.rightIcon;
|
|
169
|
-
};
|
|
170
|
-
const hasLeftPart = () => {
|
|
171
|
-
return !!slots["left-icon"] || !!props.leftIcon;
|
|
172
|
-
};
|
|
173
|
-
const focus = (event) => {
|
|
174
|
-
emits("focus", event);
|
|
175
|
-
isFocused.value = true;
|
|
176
|
-
};
|
|
177
|
-
const blur = (event) => {
|
|
178
|
-
emits("blur", event);
|
|
179
|
-
isFocused.value = false;
|
|
180
|
-
};
|
|
181
|
-
const change = (event) => emits("change", event);
|
|
182
|
-
const debounceEmitValue = debounce((value) => {
|
|
183
|
-
emits("update:model-value", value);
|
|
184
|
-
}, props.debounceDelay);
|
|
185
|
-
const emitValue = (value) => {
|
|
186
|
-
if (props.debounce)
|
|
187
|
-
return debounceEmitValue(value);
|
|
188
|
-
emits("update:model-value", value);
|
|
189
|
-
};
|
|
190
|
-
return (_ctx, _cache) => {
|
|
191
|
-
return openBlock(), createElementBlock(
|
|
192
|
-
"div",
|
|
193
|
-
{
|
|
194
|
-
class: normalizeClass(["m-input", [
|
|
195
|
-
{
|
|
196
|
-
"--is-focused": isFocused.value || __props.borderActive,
|
|
197
|
-
"--should-up": shouldUp.value,
|
|
198
|
-
"--has-label": hasLabel.value,
|
|
199
|
-
"--is-disabled": __props.disabled,
|
|
200
|
-
"--is-readonly": __props.readonly,
|
|
201
|
-
"--has-z-2": __props.error || __props.warning || __props.success,
|
|
202
|
-
"--has-state": __props.error || __props.warning || __props.success
|
|
203
|
-
},
|
|
204
|
-
inheritClasses.value,
|
|
205
|
-
`--${__props.color}`,
|
|
206
|
-
`--${__props.size}`
|
|
207
|
-
]]),
|
|
208
|
-
style: normalizeStyle(__props.style)
|
|
209
|
-
},
|
|
210
|
-
[
|
|
211
|
-
createElementVNode(
|
|
212
|
-
"div",
|
|
213
|
-
{
|
|
214
|
-
class: normalizeClass(["m-input-wrapper", [__props.inputClasses, borderStyle.value, { "maz-rounded": !__props.noRadius }]])
|
|
215
|
-
},
|
|
216
|
-
[
|
|
217
|
-
hasLeftPart() ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
218
|
-
_ctx.$slots["left-icon"] || __props.leftIcon ? renderSlot(_ctx.$slots, "left-icon", { key: 0 }, () => [
|
|
219
|
-
createVNode(unref(MazIcon), {
|
|
220
|
-
name: __props.leftIcon,
|
|
221
|
-
class: "maz-text-xl maz-text-muted"
|
|
222
|
-
}, null, 8, ["name"])
|
|
223
|
-
], true) : createCommentVNode("v-if", true)
|
|
224
|
-
])) : createCommentVNode("v-if", true),
|
|
225
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
226
|
-
withDirectives(createElementVNode("input", mergeProps({
|
|
227
|
-
id: unref(instanceId),
|
|
228
|
-
ref_key: "input",
|
|
229
|
-
ref: input,
|
|
230
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
231
|
-
type: inputType.value,
|
|
232
|
-
name: __props.name
|
|
233
|
-
}, _ctx.$attrs, {
|
|
234
|
-
placeholder: computedPlaceholder.value,
|
|
235
|
-
"aria-label": __props.label || __props.placeholder,
|
|
236
|
-
disabled: __props.disabled,
|
|
237
|
-
readonly: __props.readonly,
|
|
238
|
-
required: __props.required,
|
|
239
|
-
class: "m-input-input"
|
|
240
|
-
}, toHandlers({
|
|
241
|
-
blur,
|
|
242
|
-
focus,
|
|
243
|
-
change
|
|
244
|
-
}, true), {
|
|
245
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("click", $event))
|
|
246
|
-
}), null, 16, _hoisted_3$1), [
|
|
247
|
-
[vModelDynamic, inputValue.value]
|
|
248
|
-
]),
|
|
249
|
-
__props.label || __props.hint ? (openBlock(), createElementBlock(
|
|
250
|
-
"span",
|
|
251
|
-
{
|
|
252
|
-
key: 0,
|
|
253
|
-
ref: "label",
|
|
254
|
-
class: normalizeClass(["m-input-label", [
|
|
255
|
-
{
|
|
256
|
-
"maz-text-danger-600": __props.error,
|
|
257
|
-
"maz-text-success-600": __props.success,
|
|
258
|
-
"maz-text-warning-600": __props.warning
|
|
259
|
-
}
|
|
260
|
-
]])
|
|
261
|
-
},
|
|
262
|
-
[
|
|
263
|
-
createTextVNode(
|
|
264
|
-
toDisplayString(__props.hint || __props.label) + " ",
|
|
265
|
-
1
|
|
266
|
-
/* TEXT */
|
|
267
|
-
),
|
|
268
|
-
__props.required ? (openBlock(), createElementBlock("sup", _hoisted_4$1, "*")) : createCommentVNode("v-if", true)
|
|
269
|
-
],
|
|
270
|
-
2
|
|
271
|
-
/* CLASS */
|
|
272
|
-
)) : createCommentVNode("v-if", true)
|
|
273
|
-
]),
|
|
274
|
-
hasRightPart() ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
275
|
-
_ctx.$slots["right-icon"] || __props.rightIcon ? renderSlot(_ctx.$slots, "right-icon", { key: 0 }, () => [
|
|
276
|
-
createVNode(unref(MazIcon), {
|
|
277
|
-
name: __props.rightIcon,
|
|
278
|
-
class: "maz-text-xl maz-text-muted"
|
|
279
|
-
}, null, 8, ["name"])
|
|
280
|
-
], true) : createCommentVNode("v-if", true),
|
|
281
|
-
isPasswordType.value ? (openBlock(), createBlock(unref(MazBtn), {
|
|
282
|
-
key: 1,
|
|
283
|
-
color: "transparent",
|
|
284
|
-
tabindex: "-1",
|
|
285
|
-
size: "mini",
|
|
286
|
-
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => hasPasswordVisible.value = !hasPasswordVisible.value, ["stop"]))
|
|
287
|
-
}, {
|
|
288
|
-
default: withCtx(() => [
|
|
289
|
-
hasPasswordVisible.value ? (openBlock(), createBlock(unref(EyeOffIcon), {
|
|
290
|
-
key: 0,
|
|
291
|
-
class: "maz-text-xl maz-text-muted"
|
|
292
|
-
})) : (openBlock(), createBlock(unref(EyeIcon), {
|
|
293
|
-
key: 1,
|
|
294
|
-
class: "maz-text-xl maz-text-muted"
|
|
295
|
-
}))
|
|
296
|
-
]),
|
|
297
|
-
_: 1
|
|
298
|
-
/* STABLE */
|
|
299
|
-
})) : createCommentVNode("v-if", true),
|
|
300
|
-
_ctx.$slots["valid-button"] || __props.validButton ? renderSlot(_ctx.$slots, "valid-button", { key: 2 }, () => [
|
|
301
|
-
createVNode(unref(MazBtn), {
|
|
302
|
-
color: "transparent",
|
|
303
|
-
disabled: __props.disabled,
|
|
304
|
-
tabindex: "-1",
|
|
305
|
-
loading: __props.validButtonLoading,
|
|
306
|
-
class: "m-input-valid-button",
|
|
307
|
-
size: "mini",
|
|
308
|
-
type: "submit"
|
|
309
|
-
}, {
|
|
310
|
-
default: withCtx(() => [
|
|
311
|
-
createVNode(unref(CheckIcon), { class: "maz-text-2xl maz-text-normal" })
|
|
312
|
-
]),
|
|
313
|
-
_: 1
|
|
314
|
-
/* STABLE */
|
|
315
|
-
}, 8, ["disabled", "loading"])
|
|
316
|
-
], true) : createCommentVNode("v-if", true)
|
|
317
|
-
])) : createCommentVNode("v-if", true)
|
|
318
|
-
],
|
|
319
|
-
2
|
|
320
|
-
/* CLASS */
|
|
321
|
-
)
|
|
322
|
-
],
|
|
323
|
-
6
|
|
324
|
-
/* CLASS, STYLE */
|
|
325
|
-
);
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
const MazInput_vue_vue_type_style_index_0_scoped_32fa5093_lang = "";
|
|
330
|
-
const _export_sfc = (sfc, props) => {
|
|
331
|
-
const target = sfc.__vccOpts || sfc;
|
|
332
|
-
for (const [key, val] of props) {
|
|
333
|
-
target[key] = val;
|
|
334
|
-
}
|
|
335
|
-
return target;
|
|
336
|
-
};
|
|
337
|
-
const MazInput = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-32fa5093"]]);
|
|
338
|
-
ref("system");
|
|
339
|
-
ref("system");
|
|
340
|
-
ref();
|
|
341
|
-
ref([]);
|
|
342
|
-
let timeout = null;
|
|
343
|
-
function debounceCallback(callback, delay) {
|
|
344
|
-
if (timeout) {
|
|
345
|
-
clearTimeout(timeout);
|
|
346
|
-
}
|
|
347
|
-
timeout = setTimeout(callback, delay);
|
|
348
|
-
}
|
|
349
|
-
const _hoisted_1 = ["onClick"];
|
|
350
|
-
const _hoisted_2 = {
|
|
351
|
-
key: 0,
|
|
352
|
-
tabindex: "-1",
|
|
353
|
-
class: "m-select-list__search-wrapper"
|
|
354
|
-
};
|
|
355
|
-
const _hoisted_3 = { class: "m-select-list__no-results" };
|
|
356
|
-
const _hoisted_4 = {
|
|
357
|
-
key: 2,
|
|
358
|
-
class: "m-select-list__scroll-wrapper",
|
|
359
|
-
tabindex: "-1"
|
|
360
|
-
};
|
|
361
|
-
const _hoisted_5 = ["onClick"];
|
|
362
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
363
|
-
...{
|
|
364
|
-
inheritAttrs: false
|
|
365
|
-
},
|
|
366
|
-
__name: "MazSelect",
|
|
367
|
-
props: {
|
|
368
|
-
style: { type: [String, Array, Object], default: void 0 },
|
|
369
|
-
class: { type: String, default: void 0 },
|
|
370
|
-
modelValue: {
|
|
371
|
-
type: [Number, String, Boolean, Array],
|
|
372
|
-
default: void 0
|
|
373
|
-
},
|
|
374
|
-
id: { type: String, default: void 0 },
|
|
375
|
-
options: { type: Array, default: void 0 },
|
|
376
|
-
optionValueKey: { type: String, default: "value" },
|
|
377
|
-
optionLabelKey: { type: String, default: "label" },
|
|
378
|
-
optionInputValueKey: { type: String, default: "label" },
|
|
379
|
-
listPosition: {
|
|
380
|
-
type: String,
|
|
381
|
-
default: "bottom left",
|
|
382
|
-
validator: (value) => {
|
|
383
|
-
return ["top", "top right", "top left", "bottom", "bottom right", "bottom left"].includes(
|
|
384
|
-
value
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
required: { type: Boolean, default: false },
|
|
389
|
-
disabled: { type: Boolean, default: false },
|
|
390
|
-
open: { type: Boolean, default: false },
|
|
391
|
-
/** Choose color of the input */
|
|
392
|
-
color: {
|
|
393
|
-
type: String,
|
|
394
|
-
default: "primary"
|
|
395
|
-
},
|
|
396
|
-
/** Choose the option list item height */
|
|
397
|
-
itemHeight: { type: Number, default: 40 },
|
|
398
|
-
maxListHeight: { type: Number, default: 240 },
|
|
399
|
-
/** Add max-width value to option list */
|
|
400
|
-
maxListWidth: { type: Number, default: void 0 },
|
|
401
|
-
/** Choose size of the input */
|
|
402
|
-
size: {
|
|
403
|
-
type: String,
|
|
404
|
-
default: "md",
|
|
405
|
-
validator: (value) => {
|
|
406
|
-
return ["mini", "xs", "sm", "md", "lg", "xl"].includes(value);
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
/** Display search input in option list */
|
|
410
|
-
search: { type: Boolean, default: false },
|
|
411
|
-
/** Search input placeholder */
|
|
412
|
-
searchPlaceholder: { type: String, default: "Search in options" },
|
|
413
|
-
/** Enable feature to select multiple values */
|
|
414
|
-
multiple: { type: Boolean, default: false }
|
|
415
|
-
},
|
|
416
|
-
emits: [
|
|
417
|
-
"close",
|
|
418
|
-
"open",
|
|
419
|
-
"blur",
|
|
420
|
-
"focus",
|
|
421
|
-
"change",
|
|
422
|
-
"update:model-value",
|
|
423
|
-
/** On selected value, returns the option object */
|
|
424
|
-
"selected-option"
|
|
425
|
-
],
|
|
426
|
-
setup(__props, { emit: __emit }) {
|
|
427
|
-
useCssVars((_ctx) => ({
|
|
428
|
-
"0804a86d": keyboardSelectedBgColor.value,
|
|
429
|
-
"4502d2ec": selectedTextColor.value,
|
|
430
|
-
"381f7054": selectedBgColor.value
|
|
431
|
-
}));
|
|
432
|
-
const MazCheckbox = defineAsyncComponent(() => import("./MazCheckbox-e0bbe6ec.mjs"));
|
|
433
|
-
const SearchIcon = defineAsyncComponent(() => import("./magnifying-glass-5dffa35e.mjs"));
|
|
434
|
-
const ChevronDownIcon = defineAsyncComponent(() => import("./chevron-down-a78b9604.mjs"));
|
|
435
|
-
const NoSymbolIcon = defineAsyncComponent(() => import("./no-symbol-975ce547.mjs"));
|
|
436
|
-
const instance = getCurrentInstance();
|
|
437
|
-
const props = __props;
|
|
438
|
-
const emits = __emit;
|
|
439
|
-
const listOpened = ref(false);
|
|
440
|
-
const tmpModelValueIndex = ref();
|
|
441
|
-
const isBlackOrTransparentColor = computed(
|
|
442
|
-
() => ["black", "transparent", "white"].includes(props.color)
|
|
443
|
-
);
|
|
444
|
-
const selectedTextColor = computed(
|
|
445
|
-
() => isBlackOrTransparentColor.value ? `var(--maz-color-black)` : `var(--maz-color-${props.color}-800)`
|
|
446
|
-
);
|
|
447
|
-
const selectedBgColor = computed(
|
|
448
|
-
() => isBlackOrTransparentColor.value ? "var(--maz-color-muted)" : `var(--maz-color-${props.color}-100)`
|
|
449
|
-
);
|
|
450
|
-
const keyboardSelectedBgColor = computed(
|
|
451
|
-
() => isBlackOrTransparentColor.value ? "var(--maz-color-muted)" : `var(--maz-color-${props.color}-200)`
|
|
452
|
-
);
|
|
453
|
-
const hasListOpened = computed(() => listOpened.value || props.open);
|
|
454
|
-
const instanceId = useInstanceUniqId({
|
|
455
|
-
componentName: "MazSelect",
|
|
456
|
-
instance,
|
|
457
|
-
providedId: props.id
|
|
458
|
-
});
|
|
459
|
-
const selectedOptions = computed(
|
|
460
|
-
() => {
|
|
461
|
-
var _a;
|
|
462
|
-
return ((_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
463
|
-
return props.multiple ? Array.isArray(props.modelValue) ? props.modelValue.includes(option[props.optionValueKey]) && !isNullOrUndefined(option[props.optionValueKey]) : false : props.modelValue === option[props.optionValueKey] && !isNullOrUndefined(option[props.optionValueKey]);
|
|
464
|
-
})) ?? [];
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
onBeforeMount(() => {
|
|
468
|
-
var _a;
|
|
469
|
-
if (!((_a = props.options) == null ? void 0 : _a.length)) {
|
|
470
|
-
console.warn("[maz-ui](MazSelect) you must provide options");
|
|
471
|
-
}
|
|
472
|
-
updateTmpModelValueIndex();
|
|
473
|
-
});
|
|
474
|
-
const mazSelectElement = ref();
|
|
475
|
-
const mazInputComponent = ref();
|
|
476
|
-
const searchInputComponent = ref();
|
|
477
|
-
const optionsListElement = ref();
|
|
478
|
-
const isNullOrUndefined = (value) => {
|
|
479
|
-
return value === void 0 || value === null;
|
|
480
|
-
};
|
|
481
|
-
function isSelectedOption(option) {
|
|
482
|
-
var _a;
|
|
483
|
-
const hasOption = ((_a = selectedOptions.value) == null ? void 0 : _a.some(
|
|
484
|
-
(selectedOption) => selectedOption[props.optionValueKey] === option[props.optionValueKey]
|
|
485
|
-
)) ?? false;
|
|
486
|
-
return hasOption && !isNullOrUndefined(option[props.optionValueKey]);
|
|
487
|
-
}
|
|
488
|
-
const mazInputValue = computed(() => {
|
|
489
|
-
var _a, _b;
|
|
490
|
-
if (props.multiple && props.modelValue && Array.isArray(props.modelValue)) {
|
|
491
|
-
return props.modelValue.map(
|
|
492
|
-
(value) => {
|
|
493
|
-
var _a2, _b2;
|
|
494
|
-
return (_b2 = (_a2 = props.options) == null ? void 0 : _a2.find((option) => option[props.optionValueKey] === value)) == null ? void 0 : _b2[props.optionInputValueKey];
|
|
495
|
-
}
|
|
496
|
-
).join(", ");
|
|
497
|
-
}
|
|
498
|
-
return (_b = (_a = props.options) == null ? void 0 : _a.find((option) => option[props.optionValueKey] === props.modelValue)) == null ? void 0 : _b[props.optionInputValueKey];
|
|
499
|
-
});
|
|
500
|
-
const listTransition = computed(
|
|
501
|
-
() => props.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
502
|
-
);
|
|
503
|
-
const searchQuery = ref("");
|
|
504
|
-
const query = ref("");
|
|
505
|
-
function normalizeString(str) {
|
|
506
|
-
return str.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[^\dA-Za-z]/g, "");
|
|
507
|
-
}
|
|
508
|
-
const searchInValue = (value, query2) => {
|
|
509
|
-
return query2 && value && normalizeString(value.toString().toLocaleLowerCase().trim()).includes(
|
|
510
|
-
normalizeString(query2.toLocaleLowerCase().trim())
|
|
511
|
-
);
|
|
512
|
-
};
|
|
513
|
-
watch(
|
|
514
|
-
() => props.modelValue,
|
|
515
|
-
(value, oldValue) => {
|
|
516
|
-
}
|
|
517
|
-
);
|
|
518
|
-
function getFilteredOptionWithQuery(query2) {
|
|
519
|
-
var _a;
|
|
520
|
-
return query2 ? (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
521
|
-
const searchValue = option[props.optionLabelKey];
|
|
522
|
-
const searchValue3 = option[props.optionValueKey];
|
|
523
|
-
const searchValue2 = option[props.optionInputValueKey];
|
|
524
|
-
return searchInValue(searchValue, query2) || searchInValue(searchValue3, query2) || searchInValue(searchValue2, query2);
|
|
525
|
-
}) : props.options;
|
|
526
|
-
}
|
|
527
|
-
const optionsList = computed(() => getFilteredOptionWithQuery(searchQuery.value));
|
|
528
|
-
const closeList = async (event) => {
|
|
529
|
-
var _a;
|
|
530
|
-
if (event && ("relatedTarget" in event && ((_a = mazSelectElement.value) == null ? void 0 : _a.contains(event.relatedTarget)) || event.type === "keydown")) {
|
|
531
|
-
return event.preventDefault();
|
|
532
|
-
}
|
|
533
|
-
await nextTick();
|
|
534
|
-
listOpened.value = false;
|
|
535
|
-
tmpModelValueIndex.value = 0;
|
|
536
|
-
emits("close", event);
|
|
537
|
-
};
|
|
538
|
-
const openList = async (event) => {
|
|
539
|
-
if (props.disabled || hasListOpened.value)
|
|
540
|
-
return;
|
|
541
|
-
event == null ? void 0 : event.preventDefault();
|
|
542
|
-
listOpened.value = true;
|
|
543
|
-
await scrollToOptionIndex();
|
|
544
|
-
emits("focus", event);
|
|
545
|
-
emits("open", listOpened.value);
|
|
546
|
-
};
|
|
547
|
-
function focusMainInput() {
|
|
548
|
-
var _a, _b;
|
|
549
|
-
(_b = ((_a = mazInputComponent.value) == null ? void 0 : _a.$el).querySelector("input")) == null ? void 0 : _b.focus();
|
|
550
|
-
}
|
|
551
|
-
function toggleList(event) {
|
|
552
|
-
listOpened.value ? closeList(event) : focusMainInput();
|
|
553
|
-
}
|
|
554
|
-
function focusSearchInputAndSetQuery(q) {
|
|
555
|
-
var _a, _b;
|
|
556
|
-
searchQuery.value = q;
|
|
557
|
-
(_b = ((_a = searchInputComponent.value) == null ? void 0 : _a.$el).querySelector("input")) == null ? void 0 : _b.focus();
|
|
558
|
-
}
|
|
559
|
-
function searchOptionWithQuery(keyPressed) {
|
|
560
|
-
var _a;
|
|
561
|
-
if (keyPressed === "Backspace" && query.value.length > 0) {
|
|
562
|
-
query.value = query.value.slice(0, -1);
|
|
563
|
-
} else {
|
|
564
|
-
query.value += keyPressed;
|
|
565
|
-
}
|
|
566
|
-
const filteredOptions = getFilteredOptionWithQuery(query.value);
|
|
567
|
-
if (filteredOptions == null ? void 0 : filteredOptions.length) {
|
|
568
|
-
tmpModelValueIndex.value = (_a = optionsList.value) == null ? void 0 : _a.findIndex(
|
|
569
|
-
(option) => option[props.optionValueKey] === filteredOptions[0][props.optionValueKey]
|
|
570
|
-
);
|
|
571
|
-
if (typeof tmpModelValueIndex.value === "number" && tmpModelValueIndex.value >= 0) {
|
|
572
|
-
scrollToOptionIndex(tmpModelValueIndex.value);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
debounceCallback(() => {
|
|
576
|
-
query.value = "";
|
|
577
|
-
}, 1e3);
|
|
578
|
-
}
|
|
579
|
-
const mainInputKeyboardHandler = (event) => {
|
|
580
|
-
const keyPressed = event.key;
|
|
581
|
-
if (/^[\dA-Za-z]$/.test(keyPressed)) {
|
|
582
|
-
event.preventDefault();
|
|
583
|
-
openList(event);
|
|
584
|
-
props.search ? focusSearchInputAndSetQuery(keyPressed) : searchOptionWithQuery(keyPressed);
|
|
585
|
-
} else {
|
|
586
|
-
keyboardHandler(event);
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
const keyboardHandler = (event) => {
|
|
590
|
-
const code = event.code;
|
|
591
|
-
const isArrow = ["ArrowUp", "ArrowDown"].includes(code);
|
|
592
|
-
const shouldSelect = ["Enter", "Space"].includes(code);
|
|
593
|
-
const shouldCloseList = "Escape" === code && hasListOpened.value;
|
|
594
|
-
if (isArrow) {
|
|
595
|
-
arrowHandler(event, tmpModelValueIndex.value);
|
|
596
|
-
} else if (shouldSelect) {
|
|
597
|
-
enterHandler(event, tmpModelValueIndex.value);
|
|
598
|
-
} else if (shouldCloseList) {
|
|
599
|
-
closeList();
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
const arrowHandler = (event, currentIndex) => {
|
|
603
|
-
var _a;
|
|
604
|
-
event.preventDefault();
|
|
605
|
-
const code = event.code;
|
|
606
|
-
if (!hasListOpened.value)
|
|
607
|
-
openList(event);
|
|
608
|
-
const optionsLength = (_a = optionsList.value) == null ? void 0 : _a.length;
|
|
609
|
-
if (!optionsLength) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
if (typeof currentIndex === "number") {
|
|
613
|
-
if (currentIndex === optionsLength - 1 && code === "ArrowDown") {
|
|
614
|
-
tmpModelValueIndex.value = 0;
|
|
615
|
-
} else if (currentIndex === 0 && code === "ArrowUp") {
|
|
616
|
-
tmpModelValueIndex.value = optionsLength - 1;
|
|
617
|
-
} else {
|
|
618
|
-
tmpModelValueIndex.value = code === "ArrowDown" ? currentIndex + 1 : currentIndex - 1;
|
|
619
|
-
}
|
|
620
|
-
} else {
|
|
621
|
-
tmpModelValueIndex.value = code === "ArrowDown" ? 0 : optionsLength - 1;
|
|
622
|
-
}
|
|
623
|
-
scrollToOptionIndex(tmpModelValueIndex.value);
|
|
624
|
-
};
|
|
625
|
-
const enterHandler = (event, currentIndex) => {
|
|
626
|
-
var _a, _b, _c;
|
|
627
|
-
event.preventDefault();
|
|
628
|
-
if (!hasListOpened.value) {
|
|
629
|
-
return openList(event);
|
|
630
|
-
}
|
|
631
|
-
const newValue = currentIndex ? ((_a = optionsList.value) == null ? void 0 : _a[currentIndex]) ?? ((_b = optionsList.value) == null ? void 0 : _b[0]) : (_c = optionsList.value) == null ? void 0 : _c[0];
|
|
632
|
-
if (!isNullOrUndefined(newValue)) {
|
|
633
|
-
updateValue(newValue);
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
async function scrollToOptionIndex(index) {
|
|
637
|
-
var _a, _b;
|
|
638
|
-
await nextTick();
|
|
639
|
-
if (typeof index !== "number") {
|
|
640
|
-
updateTmpModelValueIndex();
|
|
641
|
-
}
|
|
642
|
-
const selectedIndex = index ?? tmpModelValueIndex.value;
|
|
643
|
-
if (typeof selectedIndex === "number" && selectedIndex >= 0) {
|
|
644
|
-
(_b = (_a = optionsListElement.value) == null ? void 0 : _a.querySelectorAll(".m-select-list-item")[selectedIndex]) == null ? void 0 : _b.scrollIntoView({
|
|
645
|
-
behavior: "auto",
|
|
646
|
-
block: "nearest",
|
|
647
|
-
inline: "start"
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
function updateTmpModelValueIndex(inputOption) {
|
|
652
|
-
var _a;
|
|
653
|
-
const index = (_a = optionsList.value) == null ? void 0 : _a.findIndex((option) => {
|
|
654
|
-
var _a2, _b;
|
|
655
|
-
if (props.multiple && Array.isArray(props.modelValue)) {
|
|
656
|
-
if (inputOption) {
|
|
657
|
-
return inputOption[props.optionValueKey] === option[props.optionValueKey];
|
|
658
|
-
}
|
|
659
|
-
const values = [...props.modelValue].reverse();
|
|
660
|
-
return values[0] === option[props.optionValueKey];
|
|
661
|
-
} else {
|
|
662
|
-
return ((_b = (_a2 = selectedOptions.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b[props.optionValueKey]) === option[props.optionValueKey];
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
tmpModelValueIndex.value = index && index >= 0 ? index : 0;
|
|
666
|
-
}
|
|
667
|
-
const updateValue = (inputOption, mustCloseList = true) => {
|
|
668
|
-
var _a;
|
|
669
|
-
if (mustCloseList && !props.multiple) {
|
|
670
|
-
nextTick(() => closeList());
|
|
671
|
-
}
|
|
672
|
-
searchQuery.value = "";
|
|
673
|
-
const isAlreadySelected = (_a = selectedOptions.value) == null ? void 0 : _a.some(
|
|
674
|
-
(option) => option[props.optionValueKey] === inputOption[props.optionValueKey]
|
|
675
|
-
);
|
|
676
|
-
let newValue = selectedOptions.value;
|
|
677
|
-
if (isAlreadySelected && props.multiple) {
|
|
678
|
-
newValue = newValue == null ? void 0 : newValue.filter(
|
|
679
|
-
(option) => option[props.optionValueKey] !== inputOption[props.optionValueKey]
|
|
680
|
-
);
|
|
681
|
-
} else if (props.multiple) {
|
|
682
|
-
newValue.push(inputOption);
|
|
683
|
-
} else {
|
|
684
|
-
newValue = [inputOption];
|
|
685
|
-
}
|
|
686
|
-
const selectedValues = newValue.map((option) => option[props.optionValueKey]);
|
|
687
|
-
emits("update:model-value", props.multiple ? selectedValues : selectedValues[0]);
|
|
688
|
-
emits("selected-option", inputOption);
|
|
689
|
-
updateTmpModelValueIndex(inputOption);
|
|
690
|
-
focusMainInput();
|
|
691
|
-
};
|
|
692
|
-
return (_ctx, _cache) => {
|
|
693
|
-
return openBlock(), createElementBlock(
|
|
694
|
-
"div",
|
|
695
|
-
{
|
|
696
|
-
ref_key: "mazSelectElement",
|
|
697
|
-
ref: mazSelectElement,
|
|
698
|
-
class: normalizeClass(["m-select", [{ "--is-open": hasListOpened.value, "--disabled": __props.disabled }, props.class]]),
|
|
699
|
-
style: normalizeStyle(__props.style),
|
|
700
|
-
onBlurCapture: closeList
|
|
701
|
-
},
|
|
702
|
-
[
|
|
703
|
-
createVNode(MazInput, mergeProps({
|
|
704
|
-
id: unref(instanceId),
|
|
705
|
-
ref_key: "mazInputComponent",
|
|
706
|
-
ref: mazInputComponent,
|
|
707
|
-
class: "m-select-input"
|
|
708
|
-
}, _ctx.$attrs, {
|
|
709
|
-
required: __props.required,
|
|
710
|
-
"border-active": listOpened.value,
|
|
711
|
-
color: __props.color,
|
|
712
|
-
"model-value": mazInputValue.value,
|
|
713
|
-
autocomplete: "off",
|
|
714
|
-
size: __props.size,
|
|
715
|
-
disabled: __props.disabled,
|
|
716
|
-
onFocus: withModifiers(openList, ["prevent", "stop"]),
|
|
717
|
-
onClick: withModifiers(openList, ["prevent", "stop"]),
|
|
718
|
-
onChange: _cache[0] || (_cache[0] = ($event) => emits("change", $event)),
|
|
719
|
-
onKeydown: mainInputKeyboardHandler
|
|
720
|
-
}), {
|
|
721
|
-
"right-icon": withCtx(() => [
|
|
722
|
-
createElementVNode("button", {
|
|
723
|
-
tabindex: "-1",
|
|
724
|
-
type: "button",
|
|
725
|
-
class: "m-select-input__toggle-button maz-custom",
|
|
726
|
-
onClick: withModifiers(toggleList, ["stop"])
|
|
727
|
-
}, [
|
|
728
|
-
createVNode(unref(ChevronDownIcon), { class: "m-select-chevron maz-text-xl" })
|
|
729
|
-
], 8, _hoisted_1)
|
|
730
|
-
]),
|
|
731
|
-
_: 1
|
|
732
|
-
/* STABLE */
|
|
733
|
-
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "disabled", "onFocus", "onClick"]),
|
|
734
|
-
createVNode(Transition, { name: listTransition.value }, {
|
|
735
|
-
default: withCtx(() => [
|
|
736
|
-
hasListOpened.value ? (openBlock(), createElementBlock(
|
|
737
|
-
"div",
|
|
738
|
-
{
|
|
739
|
-
key: 0,
|
|
740
|
-
ref_key: "optionsListElement",
|
|
741
|
-
ref: optionsListElement,
|
|
742
|
-
class: normalizeClass(["m-select-list", {
|
|
743
|
-
"--top": __props.listPosition.includes("top"),
|
|
744
|
-
"--left": __props.listPosition.includes("left"),
|
|
745
|
-
"--right": __props.listPosition.includes("right"),
|
|
746
|
-
"--bottom": __props.listPosition.includes("bottom")
|
|
747
|
-
}]),
|
|
748
|
-
style: normalizeStyle({
|
|
749
|
-
maxHeight: `${__props.maxListHeight}px`,
|
|
750
|
-
maxWidth: `${__props.maxListWidth}px`
|
|
751
|
-
})
|
|
752
|
-
},
|
|
753
|
-
[
|
|
754
|
-
__props.search ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
755
|
-
createVNode(MazInput, {
|
|
756
|
-
ref_key: "searchInputComponent",
|
|
757
|
-
ref: searchInputComponent,
|
|
758
|
-
modelValue: searchQuery.value,
|
|
759
|
-
"onUpdate:modelValue": [
|
|
760
|
-
_cache[1] || (_cache[1] = ($event) => searchQuery.value = $event),
|
|
761
|
-
_cache[2] || (_cache[2] = ($event) => tmpModelValueIndex.value = 0)
|
|
762
|
-
],
|
|
763
|
-
size: "sm",
|
|
764
|
-
color: __props.color,
|
|
765
|
-
placeholder: __props.searchPlaceholder,
|
|
766
|
-
name: "search",
|
|
767
|
-
autocomplete: "off",
|
|
768
|
-
tabindex: "-1",
|
|
769
|
-
class: "m-select-list__search-input",
|
|
770
|
-
onKeydown: keyboardHandler
|
|
771
|
-
}, {
|
|
772
|
-
"left-icon": withCtx(() => [
|
|
773
|
-
createVNode(unref(SearchIcon), { class: "maz-h-[1.3rem] maz-w-[1.3rem]" })
|
|
774
|
-
]),
|
|
775
|
-
_: 1
|
|
776
|
-
/* STABLE */
|
|
777
|
-
}, 8, ["modelValue", "color", "placeholder"])
|
|
778
|
-
])) : createCommentVNode("v-if", true),
|
|
779
|
-
createCommentVNode("\n @slot No results slot - Displayed when no results corresponding with seeach query\n "),
|
|
780
|
-
!optionsList.value || optionsList.value.length <= 0 ? renderSlot(_ctx.$slots, "no-results", { key: 1 }, () => [
|
|
781
|
-
createElementVNode("span", _hoisted_3, [
|
|
782
|
-
createVNode(unref(NoSymbolIcon), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
783
|
-
])
|
|
784
|
-
], true) : (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
785
|
-
(openBlock(true), createElementBlock(
|
|
786
|
-
Fragment,
|
|
787
|
-
null,
|
|
788
|
-
renderList(optionsList.value, (option, i) => {
|
|
789
|
-
return openBlock(), createElementBlock("button", {
|
|
790
|
-
key: i,
|
|
791
|
-
tabindex: "-1",
|
|
792
|
-
type: "button",
|
|
793
|
-
class: normalizeClass(["m-select-list-item maz-custom", [
|
|
794
|
-
{
|
|
795
|
-
"--is-keyboard-selected": tmpModelValueIndex.value === i,
|
|
796
|
-
"--is-selected": isSelectedOption(option),
|
|
797
|
-
"--is-none-value": isNullOrUndefined(option[__props.optionValueKey])
|
|
798
|
-
}
|
|
799
|
-
]]),
|
|
800
|
-
style: normalizeStyle({ minHeight: `${__props.itemHeight}px` }),
|
|
801
|
-
onClick: withModifiers(($event) => updateValue(option), ["prevent", "stop"])
|
|
802
|
-
}, [
|
|
803
|
-
__props.multiple ? (openBlock(), createBlock(unref(MazCheckbox), {
|
|
804
|
-
key: 0,
|
|
805
|
-
tabindex: "-1",
|
|
806
|
-
"model-value": isSelectedOption(option),
|
|
807
|
-
size: "sm",
|
|
808
|
-
color: __props.color
|
|
809
|
-
}, null, 8, ["model-value", "color"])) : createCommentVNode("v-if", true),
|
|
810
|
-
createCommentVNode("\n @slot Custom option\n @binding {Object} option\n @binding {Boolean} is-selected\n "),
|
|
811
|
-
renderSlot(_ctx.$slots, "default", {
|
|
812
|
-
option,
|
|
813
|
-
isSelected: isSelectedOption(option)
|
|
814
|
-
}, () => [
|
|
815
|
-
createElementVNode(
|
|
816
|
-
"span",
|
|
817
|
-
null,
|
|
818
|
-
toDisplayString(option[__props.optionLabelKey]),
|
|
819
|
-
1
|
|
820
|
-
/* TEXT */
|
|
821
|
-
)
|
|
822
|
-
], true)
|
|
823
|
-
], 14, _hoisted_5);
|
|
824
|
-
}),
|
|
825
|
-
128
|
|
826
|
-
/* KEYED_FRAGMENT */
|
|
827
|
-
))
|
|
828
|
-
]))
|
|
829
|
-
],
|
|
830
|
-
6
|
|
831
|
-
/* CLASS, STYLE */
|
|
832
|
-
)) : createCommentVNode("v-if", true)
|
|
833
|
-
]),
|
|
834
|
-
_: 3
|
|
835
|
-
/* FORWARDED */
|
|
836
|
-
}, 8, ["name"])
|
|
837
|
-
],
|
|
838
|
-
38
|
|
839
|
-
/* CLASS, STYLE, HYDRATE_EVENTS */
|
|
840
|
-
);
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
const MazSelect_vue_vue_type_style_index_0_scoped_c313b4a6_lang = "";
|
|
845
|
-
const MazSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c313b4a6"]]);
|
|
846
|
-
export {
|
|
847
|
-
MazSelect as M,
|
|
848
|
-
_export_sfc as _,
|
|
849
|
-
useInstanceUniqId as u
|
|
850
|
-
};
|