maz-ui 4.0.1 → 4.1.0

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.
Files changed (49) hide show
  1. package/dist/assets/MazBadge.CmPr9rE1.css +1 -0
  2. package/dist/assets/MazBtn.BGG5GQYk.css +1 -0
  3. package/dist/assets/MazDatePicker.C_X4aMTR.css +1 -0
  4. package/dist/assets/MazInput.Z8jTDWYg.css +1 -0
  5. package/dist/assets/MazPopover.BimNK6Cy.css +1 -0
  6. package/dist/assets/MazSelect.CWQ12sG1.css +1 -0
  7. package/dist/chunks/{MazDatePicker.B1B6gUrC.js → MazDatePicker.BkBbJH6f.js} +15 -11
  8. package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.DULnKQ2W.js → MazDropdown.vue_vue_type_style_index_0_lang.CgXVL7hr.js} +20 -18
  9. package/dist/chunks/{MazPickerCalendar.BSBQciuG.js → MazPickerCalendar.8YBwJDcX.js} +1 -1
  10. package/dist/chunks/{MazPickerCalendarMonth.CFJHTFp5.js → MazPickerCalendarMonth.KrWcUnl1.js} +1 -1
  11. package/dist/chunks/{MazPickerCalendarSwitcher.DC21FpTy.js → MazPickerCalendarSwitcher.DBgPZB2r.js} +1 -1
  12. package/dist/chunks/{MazPickerContainer.CRPzAbRt.js → MazPickerContainer.DmvGYSZC.js} +1 -1
  13. package/dist/chunks/{MazPickerHeader.D7Tbm-yH.js → MazPickerHeader.BF3xmBsl.js} +1 -1
  14. package/dist/chunks/{MazPickerMonthSwitcher.DzHOKbe4.js → MazPickerMonthSwitcher.lK0mMr_M.js} +1 -1
  15. package/dist/chunks/{MazPickerTime.EZK1foEx.js → MazPickerTime.jtmY7chR.js} +1 -1
  16. package/dist/chunks/{MazPickerYearSwitcher.BcT8GENl.js → MazPickerYearSwitcher.D3uV7QqF.js} +1 -1
  17. package/dist/components/MazBadge.js +2 -2
  18. package/dist/components/MazBtn.js +6 -4
  19. package/dist/components/MazDatePicker.js +1 -1
  20. package/dist/components/MazDatePicker.vue.d.ts +12 -8
  21. package/dist/components/MazDropdown.js +1 -1
  22. package/dist/components/MazDropdown.vue.d.ts +8 -5
  23. package/dist/components/MazInput.js +10 -3
  24. package/dist/components/MazPopover.js +24 -26
  25. package/dist/components/MazPopover.vue.d.ts +6 -3
  26. package/dist/components/MazSelect.js +54 -43
  27. package/dist/components/MazSelect.vue.d.ts +16 -2
  28. package/dist/components/index.js +2 -2
  29. package/dist/composables/index.d.ts +1 -0
  30. package/dist/composables/index.js +2 -0
  31. package/dist/composables/useMutationObserver.d.ts +13 -0
  32. package/dist/composables/useMutationObserver.js +37 -0
  33. package/dist/composables/useWindowSize.js +2 -2
  34. package/dist/css/main.css +1 -1
  35. package/dist/plugins/maz-ui.js +101 -88
  36. package/dist/resolvers/MazModulesResolver.js +2 -1
  37. package/dist/types/components/MazDatePicker.vue.d.ts +12 -8
  38. package/dist/types/components/MazDropdown.vue.d.ts +8 -5
  39. package/dist/types/components/MazPopover.vue.d.ts +6 -3
  40. package/dist/types/components/MazSelect.vue.d.ts +16 -2
  41. package/dist/types/composables/index.d.ts +1 -0
  42. package/dist/types/composables/useMutationObserver.d.ts +13 -0
  43. package/package.json +4 -5
  44. package/dist/assets/MazBadge.DRnB26zf.css +0 -1
  45. package/dist/assets/MazBtn.T0AUA2N1.css +0 -1
  46. package/dist/assets/MazDatePicker.G6V7jjin.css +0 -1
  47. package/dist/assets/MazInput.BvuxfP9k.css +0 -1
  48. package/dist/assets/MazPopover.DIE65uVT.css +0 -1
  49. package/dist/assets/MazSelect.DIwjMD31.css +0 -1
@@ -158,8 +158,11 @@ export interface MazDropdownProps extends Omit<MazPopoverProps, 'modelValue'> {
158
158
  */
159
159
  transition?: MazPopoverProps['transition'];
160
160
  }
161
+ declare const __VLS_defaults: {
162
+ modelValue: boolean;
163
+ };
161
164
  type __VLS_PublicProps = {
162
- modelValue?: boolean;
165
+ modelValue?: typeof __VLS_defaults['modelValue'];
163
166
  } & __VLS_Props;
164
167
  declare function __VLS_template(): {
165
168
  attrs: Partial<{}>;
@@ -182,14 +185,14 @@ declare function __VLS_template(): {
182
185
  items: MazDropdownMenuItem[];
183
186
  open: () => void;
184
187
  close: () => void;
185
- isOpen: true;
188
+ isOpen: boolean;
186
189
  toggle: () => void;
187
190
  }): any;
188
191
  menuitem?(_: {
189
192
  item: MazDropdownMenuItem;
190
193
  open: () => void;
191
194
  close: () => void;
192
- isOpen: true;
195
+ isOpen: boolean;
193
196
  toggle: () => void;
194
197
  }): any;
195
198
  'menuitem-label'?(_: {
@@ -206,7 +209,7 @@ declare function __VLS_template(): {
206
209
  };
207
210
  open: () => void;
208
211
  close: () => void;
209
- isOpen: true;
212
+ isOpen: boolean;
210
213
  toggle: () => void;
211
214
  }): any;
212
215
  'menuitem-label'?(_: {
@@ -223,7 +226,7 @@ declare function __VLS_template(): {
223
226
  };
224
227
  open: () => void;
225
228
  close: () => void;
226
- isOpen: true;
229
+ isOpen: boolean;
227
230
  toggle: () => void;
228
231
  }): any;
229
232
  };
@@ -3,7 +3,7 @@ import { MazEyeSlash, MazEye } from "@maz-ui/icons";
3
3
  import { i } from "../chunks/debounce.DhXdop6X.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.BvuxfP9k.css';const _hoisted_1 = ["for"], _hoisted_2 = {
6
+ import '../assets/MazInput.Z8jTDWYg.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", "name", "autocomplete", "disabled", "readonly", "required"], _hoisted_4 = {
@@ -165,7 +165,14 @@ import '../assets/MazInput.BvuxfP9k.css';const _hoisted_1 = ["for"], _hoisted_2
165
165
  ], !0) : createCommentVNode("", !0)
166
166
  ])) : createCommentVNode("", !0),
167
167
  createElementVNode("div", {
168
- class: normalizeClass(["m-input-wrapper-input", [`--${_ctx.size}`, { "--top-label": !!_ctx.topLabel }]])
168
+ class: normalizeClass(["m-input-wrapper-input", [
169
+ `--${_ctx.size}`,
170
+ {
171
+ "--top-label": !!_ctx.topLabel,
172
+ "--has-left-icon": hasLeftPart(),
173
+ "--has-right-icon": hasRightPart()
174
+ }
175
+ ]])
169
176
  }, [
170
177
  withDirectives(createElementVNode("input", mergeProps({ id: unref(instanceId) }, _ctx.$attrs, {
171
178
  ref_key: "input",
@@ -243,7 +250,7 @@ import '../assets/MazInput.BvuxfP9k.css';const _hoisted_1 = ["for"], _hoisted_2
243
250
  }, toDisplayString(_ctx.assistiveText), 3)) : createCommentVNode("", !0)
244
251
  ], 6));
245
252
  }
246
- }), MazInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3ab08265"]]);
253
+ }), MazInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-575efdcd"]]);
247
254
  export {
248
255
  MazInput as default
249
256
  };
@@ -5,7 +5,7 @@ import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
5
5
  import { d as directive } from "../chunks/vClickOutside.CJBKY5no.js";
6
6
  import { g as getColor } from "../chunks/types.D0Bp_UhS.js";
7
7
  import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
8
- import '../assets/MazPopover.DIE65uVT.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
+ import '../assets/MazPopover.BimNK6Cy.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({
9
9
  name: "MazPopover",
10
10
  inheritAttrs: !1,
11
11
  __name: "MazPopover",
@@ -39,7 +39,7 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
39
39
  block: { type: Boolean, default: !1 },
40
40
  positionReference: {}
41
41
  }, {
42
- modelValue: { type: Boolean, required: !1, default: !1 },
42
+ modelValue: { default: !1 },
43
43
  modelModifiers: {}
44
44
  }),
45
45
  emits: /* @__PURE__ */ mergeModels(["update:model-value", "open", "close", "after-close-animation", "toggle"], ["update:modelValue"]),
@@ -47,7 +47,7 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
47
47
  const emits = __emit, triggerId = useInstanceUniqId({
48
48
  componentName: "MazPopover",
49
49
  providedId: __props.id
50
- }), attrs = useAttrs(), triggerElement = useTemplateRef("trigger"), panelElement = useTemplateRef("panel"), middleware = computed(() => {
50
+ }), attrs = useAttrs(), triggerRef = useTemplateRef("trigger"), panelRef = useTemplateRef("panel"), middleware = computed(() => {
51
51
  const middleware2 = [
52
52
  offset(__props.offset),
53
53
  hide(),
@@ -58,26 +58,24 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
58
58
  })) : middleware2.push(flip({
59
59
  fallbackPlacements: __props.fallbackPosition ? [__props.fallbackPosition] : void 0
60
60
  })), middleware2;
61
- }), floatingPosition = computed(() => __props.position === "auto" ? __props.preferPosition : __props.position), transitionName = computed(() => ["scale-pop", "scale-fade"].includes(__props.transition) ? `maz-${__props.transition}` : __props.transition), reference = computed(() => getPositionReference() || triggerElement.value), { floatingStyles, placement, update, middlewareData } = useFloating(
61
+ }), floatingPosition = computed(() => __props.position === "auto" ? __props.preferPosition : __props.position), transitionName = computed(() => ["scale-pop", "scale-fade"].includes(__props.transition) ? `maz-${__props.transition}` : __props.transition), positionRef = computed(() => {
62
+ if (!__props.positionReference)
63
+ return triggerRef.value;
64
+ if (typeof __props.positionReference == "string") {
65
+ const withinTrigger = triggerRef.value?.querySelector(__props.positionReference);
66
+ return withinTrigger || (e() ? document.querySelector(__props.positionReference) : null);
67
+ }
68
+ return __props.positionReference;
69
+ }), reference = computed(() => positionRef.value || triggerRef.value), { floatingStyles, placement, update, middlewareData } = useFloating(
62
70
  reference,
63
- panelElement,
71
+ panelRef,
64
72
  {
65
73
  placement: floatingPosition,
66
74
  middleware,
67
75
  transform: !1,
68
76
  whileElementsMounted: autoUpdate
69
77
  }
70
- ), computedPosition = computed(() => placement.value ?? floatingPosition.value);
71
- function getPositionReference() {
72
- if (!__props.positionReference)
73
- return triggerElement.value;
74
- if (typeof __props.positionReference == "string") {
75
- const withinTrigger = triggerElement.value?.querySelector(__props.positionReference);
76
- return withinTrigger || (e() ? document.querySelector(__props.positionReference) : null);
77
- }
78
- return __props.positionReference;
79
- }
80
- const isOpen = useModel(__props, "modelValue");
78
+ ), computedPosition = computed(() => placement.value ?? floatingPosition.value), isOpen = useModel(__props, "modelValue");
81
79
  let openTimeout = null, closeTimeout = null, initialFocusElement = null, ignoreNextClickOutside = !1;
82
80
  const panelId = computed(() => `${triggerId.value}-panel`), rootStyles = computed(() => attrs.style), panelStyles = computed(() => ({
83
81
  ...floatingStyles.value,
@@ -121,9 +119,9 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
121
119
  isOpen.value ? close() : open();
122
120
  }
123
121
  function setOpen(value) {
124
- value ? (emits("open"), isOpen.value = value, emits("toggle", value), nextTick(() => {
122
+ isOpen.value = value, value ? (emits("open"), emits("toggle", value), nextTick(() => {
125
123
  update(), setupFocusTrap();
126
- })) : (isOpen.value = value, emits("toggle", value), emits("close"), ignoreNextClickOutside = !1, __props.trapFocus && restoreFocus());
124
+ })) : (emits("toggle", value), emits("close"), ignoreNextClickOutside = !1, __props.trapFocus && restoreFocus());
127
125
  }
128
126
  function clearOpenTimeout() {
129
127
  openTimeout && (clearTimeout(openTimeout), openTimeout = null);
@@ -163,10 +161,10 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
163
161
  }
164
162
  function setupFocusTrap() {
165
163
  __props.role === "tooltip" || effectiveTrigger.value === "hover" || !__props.trapFocus || !e() || (initialFocusElement = document.activeElement, nextTick(() => {
166
- const focusableElements = panelElement.value?.querySelectorAll(
164
+ const focusableElements = panelRef.value?.querySelectorAll(
167
165
  'a[href], button, textarea, input[type="text"], input[type="radio"], input[type="checkbox"], select, [tabindex]:not([tabindex="-1"])'
168
166
  );
169
- focusableElements && focusableElements.length > 0 ? focusableElements[0].focus({ preventScroll: !0 }) : panelElement.value?.focus({ preventScroll: !0 });
167
+ focusableElements && focusableElements.length > 0 ? focusableElements[0].focus({ preventScroll: !0 }) : panelRef.value?.focus({ preventScroll: !0 });
170
168
  }));
171
169
  }
172
170
  function restoreFocus() {
@@ -178,9 +176,9 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
178
176
  isOpen.value && (event.key === "Escape" && __props.closeOnEscape && !__props.persistent && (event.preventDefault(), close()), event.key === "Tab" && __props.trapFocus && handleTrapFocus(event));
179
177
  }
180
178
  function handleTrapFocus(event) {
181
- if (!panelElement.value || !e())
179
+ if (!panelRef.value || !e())
182
180
  return;
183
- const focusableElements = panelElement.value.querySelectorAll(
181
+ const focusableElements = panelRef.value.querySelectorAll(
184
182
  'a[href], button, textarea, input[type="text"], input[type="radio"], input[type="checkbox"], select, [tabindex]:not([tabindex="-1"])'
185
183
  );
186
184
  if (focusableElements.length === 0)
@@ -195,7 +193,7 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
195
193
  return;
196
194
  }
197
195
  if (__props.closeOnClickOutside && !__props.persistent) {
198
- if (triggerElement.value && triggerElement.value.contains(event.target))
196
+ if (triggerRef.value && triggerRef.value.contains(event.target))
199
197
  return;
200
198
  close();
201
199
  }
@@ -228,11 +226,11 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
228
226
  toggle,
229
227
  /**
230
228
  * Check if the popover is open
231
- * @type {ComputedRef<boolean>}
229
+ * @type {ModelRef<boolean>}
232
230
  * @description Reactive reference to the popover open state
233
231
  * @usage `const isPopoverOpen = mazPopoverInstance.value?.isOpen`
234
232
  */
235
- isOpen: computed(() => isOpen.value),
233
+ isOpen,
236
234
  /**
237
235
  * Update the popover position
238
236
  * @description Manually recalculate and update the popover position
@@ -314,7 +312,7 @@ import '../assets/MazPopover.DIE65uVT.css';const _hoisted_1 = ["id", "aria-expan
314
312
  ], 8, ["to"]))
315
313
  ], 64));
316
314
  }
317
- }), MazPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ecc963ec"]]);
315
+ }), MazPopover = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7399848c"]]);
318
316
  export {
319
317
  MazPopover as default
320
318
  };
@@ -170,8 +170,11 @@ export interface MazPopoverProps {
170
170
  declare function open(): void;
171
171
  declare function close(): void;
172
172
  declare function toggle(): void;
173
+ declare const __VLS_defaults: {
174
+ modelValue: boolean;
175
+ };
173
176
  type __VLS_PublicProps = {
174
- modelValue?: boolean;
177
+ modelValue?: typeof __VLS_defaults['modelValue'];
175
178
  } & __VLS_Props;
176
179
  declare function __VLS_template(): {
177
180
  attrs: Partial<{}>;
@@ -218,11 +221,11 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
218
221
  toggle: typeof toggle;
219
222
  /**
220
223
  * Check if the popover is open
221
- * @type {ComputedRef<boolean>}
224
+ * @type {ModelRef<boolean>}
222
225
  * @description Reactive reference to the popover open state
223
226
  * @usage `const isPopoverOpen = mazPopoverInstance.value?.isOpen`
224
227
  */
225
- isOpen: import('vue').ComputedRef<boolean>;
228
+ isOpen: import('vue').ModelRef<boolean, string, boolean, boolean>;
226
229
  /**
227
230
  * Update the popover position
228
231
  * @description Manually recalculate and update the popover position
@@ -1,4 +1,4 @@
1
- import { defineComponent, mergeModels, defineAsyncComponent, useTemplateRef, computed, useModel, ref, watch, createBlock, openBlock, normalizeStyle, normalizeClass, withCtx, createElementVNode, unref, createCommentVNode, renderSlot, createElementBlock, createVNode, Fragment, renderList, toDisplayString, withModifiers, mergeProps, createSlots, nextTick } from "vue";
1
+ import { defineComponent, mergeModels, defineAsyncComponent, useTemplateRef, computed, useModel, ref, watch, createBlock, openBlock, unref, normalizeStyle, normalizeClass, withCtx, createElementVNode, createCommentVNode, renderSlot, createElementBlock, createVNode, Fragment, renderList, toDisplayString, withModifiers, mergeProps, createSlots, nextTick } from "vue";
2
2
  import { MazMagnifyingGlass, MazNoSymbol, MazChevronDown } from "@maz-ui/icons";
3
3
  import { useTranslations } from "@maz-ui/translations";
4
4
  import { e as e$1 } from "../chunks/isClient.8V3qjGdO.js";
@@ -7,11 +7,16 @@ import { useInstanceUniqId } from "../composables/useInstanceUniqId.js";
7
7
  import MazInput from "./MazInput.js";
8
8
  import MazPopover from "./MazPopover.js";
9
9
  import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper.B--vMWp3.js";
10
- import '../assets/MazSelect.DIwjMD31.css';let e = null;
10
+ import '../assets/MazSelect.CWQ12sG1.css';let e = null;
11
11
  function o(t, l) {
12
12
  e && clearTimeout(e), e = setTimeout(t, l);
13
13
  }
14
- const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m-select-list__no-results" }, _hoisted_4 = { class: "m-select-list-optgroup" }, _hoisted_5 = ["tabindex", "onClick"], _sfc_main = /* @__PURE__ */ defineComponent({
14
+ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m-select-list__no-results" }, _hoisted_4 = {
15
+ key: 2,
16
+ ref: "optionListWrapper",
17
+ class: "m-select-list__scroll-wrapper",
18
+ tabindex: "-1"
19
+ }, _hoisted_5 = { class: "m-select-list-optgroup" }, _hoisted_6 = ["tabindex", "onClick"], _sfc_main = /* @__PURE__ */ defineComponent({
15
20
  inheritAttrs: !1,
16
21
  __name: "MazSelect",
17
22
  props: /* @__PURE__ */ mergeModels({
@@ -45,12 +50,12 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
45
50
  formatInputValue: {},
46
51
  transition: { default: "scale-fade" }
47
52
  }, {
48
- open: { type: Boolean, required: !1, default: !1 },
53
+ open: { default: !1 },
49
54
  openModifiers: {}
50
55
  }),
51
56
  emits: /* @__PURE__ */ mergeModels(["close", "open", "blur", "focus", "change", "input", "update:model-value", "selected-option"], ["update:open"]),
52
57
  setup(__props, { expose: __expose, emit: __emit }) {
53
- const props = __props, emits = __emit, MazCheckbox = defineAsyncComponent(() => import("./MazCheckbox.js")), popoverComponent = useTemplateRef("popoverComponent"), selectedTextColor = computed(() => `hsl(var(--maz-${props.color}))`), selectedBgColor = computed(() => `hsl(var(--maz-${props.color}-500) / 0.1)`), { t } = useTranslations(), messages = computed(() => ({
58
+ const props = __props, emits = __emit, MazCheckbox = defineAsyncComponent(() => import("./MazCheckbox.js")), popoverComponent = useTemplateRef("popover"), inputRef = useTemplateRef("input"), searchInputRef = useTemplateRef("searchInput"), optionListRef = useTemplateRef("optionListRef"), optionListWrapperRef = useTemplateRef("optionListWrapper"), selectedTextColor = computed(() => `hsl(var(--maz-${props.color}))`), selectedBgColor = computed(() => `hsl(var(--maz-${props.color}-500) / 0.1)`), { t } = useTranslations(), messages = computed(() => ({
54
59
  searchPlaceholder: props.translations?.searchPlaceholder || t("select.searchPlaceholder")
55
60
  })), isOpen = useModel(__props, "open"), instanceId = useInstanceUniqId({
56
61
  componentName: "MazSelect",
@@ -90,7 +95,7 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
90
95
  }
91
96
  const selectedOptions = computed(
92
97
  () => optionsNormalized.value?.filter(isOptionInSelection) ?? []
93
- ), mazInputComponent = useTemplateRef("mazInputComponent"), searchInputComponent = useTemplateRef("searchInputComponent"), optionListElement = ref(), optionListScrollWrapper = ref();
98
+ );
94
99
  function isNullOrUndefined(value) {
95
100
  return value == null;
96
101
  }
@@ -121,9 +126,6 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
121
126
  }) : optionsNormalized.value;
122
127
  }
123
128
  const optionList = computed(() => props.searchFunction && props.search && searchQuery.value ? getNormalizedOptions(props.searchFunction(searchQuery.value, props.options ?? []) ?? []) : getFilteredOptionWithQuery(searchQuery.value));
124
- function onCloseList() {
125
- emits("close");
126
- }
127
129
  async function onOpenList() {
128
130
  const selectedIndex = optionList.value?.findIndex(
129
131
  (option) => isSelectedOption(option)
@@ -131,13 +133,13 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
131
133
  await scrollToOptionIndex(selectedIndex), emits("open");
132
134
  }
133
135
  function focusMainInput() {
134
- mazInputComponent.value?.$el?.querySelector("input")?.focus();
136
+ inputRef.value?.$el?.querySelector("input")?.focus();
135
137
  }
136
138
  function emitInputMainInput() {
137
- mazInputComponent.value?.$el?.querySelector("input")?.dispatchEvent(new Event("input"));
139
+ inputRef.value?.$el?.querySelector("input")?.dispatchEvent(new Event("input"));
138
140
  }
139
141
  function focusSearchInputAndSetQuery(q) {
140
- searchQuery.value = q, searchInputComponent.value?.$el?.querySelector("input")?.focus();
142
+ searchQuery.value = q, searchInputRef.value?.$el?.querySelector("input")?.focus();
141
143
  }
142
144
  function searchOptionWithQuery(keyPressed) {
143
145
  keyPressed === "Backspace" && query.value && query.value.length > 0 ? query.value = query.value.slice(0, -1) : query.value += keyPressed;
@@ -160,10 +162,10 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
160
162
  async function scrollToOptionIndex(index) {
161
163
  if (await nextTick(), typeof index != "number" || index < 0)
162
164
  return;
163
- const item = optionListElement.value?.querySelector(`.m-select-list-item:nth-child(${index + 1})`);
164
- if (item && optionListScrollWrapper.value) {
165
- const wrapperRect = optionListScrollWrapper.value.getBoundingClientRect(), itemRect = item.getBoundingClientRect(), scrollTop = item.offsetTop - wrapperRect.height / 2 + itemRect.height / 2;
166
- optionListScrollWrapper.value.scrollTo?.({
165
+ const item = optionListRef.value?.querySelector(`.m-select-list-item:nth-child(${index + 1})`);
166
+ if (item && optionListWrapperRef.value) {
167
+ const wrapperRect = optionListWrapperRef.value.getBoundingClientRect(), itemRect = item.getBoundingClientRect(), scrollTop = item.offsetTop - wrapperRect.height / 2 + itemRect.height / 2;
168
+ optionListWrapperRef.value.scrollTo?.({
167
169
  top: scrollTop,
168
170
  behavior: "auto"
169
171
  }), nextTick(() => {
@@ -228,12 +230,15 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
228
230
  popoverComponent.value?.close();
229
231
  }
230
232
  }), (_ctx, _cache) => (openBlock(), createBlock(MazPopover, {
231
- ref_key: "popoverComponent",
232
- ref: popoverComponent,
233
+ id: `${unref(instanceId)}-popover`,
234
+ ref: "popover",
233
235
  modelValue: isOpen.value,
234
236
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isOpen.value = $event),
235
237
  class: normalizeClass(["m-select m-reset-css", [
236
- { "--is-open": isOpen.value, "--disabled": _ctx.disabled },
238
+ {
239
+ "--is-open": isOpen.value,
240
+ "--disabled": _ctx.disabled
241
+ },
237
242
  props.class,
238
243
  `--${_ctx.size}`
239
244
  ]]),
@@ -245,15 +250,14 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
245
250
  position: _ctx.listPosition,
246
251
  "prefer-position": "bottom-start",
247
252
  "fallback-position": "top-start",
248
- "position-reference": ".m-input-wrapper",
249
- onClose: onCloseList,
253
+ "position-reference": `#${unref(instanceId)}-popover .m-input-wrapper`,
254
+ onClose: _cache[6] || (_cache[6] = ($event) => emits("close")),
250
255
  onOpen: onOpenList
251
256
  }, {
252
- trigger: withCtx(() => [
257
+ trigger: withCtx(({ close, open: openPicker, toggle: togglePopover }) => [
253
258
  createVNode(MazInput, mergeProps({
254
259
  id: unref(instanceId),
255
- ref_key: "mazInputComponent",
256
- ref: mazInputComponent,
260
+ ref: "input",
257
261
  class: "m-select-input"
258
262
  }, _ctx.$attrs, {
259
263
  required: _ctx.required,
@@ -274,7 +278,12 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
274
278
  onKeydown: mainInputKeyboardHandler
275
279
  }), createSlots({
276
280
  "right-icon": withCtx(() => [
277
- renderSlot(_ctx.$slots, "right-icon", {}, () => [
281
+ renderSlot(_ctx.$slots, "right-icon", {
282
+ isOpen: isOpen.value,
283
+ close,
284
+ open: openPicker,
285
+ toggle: togglePopover
286
+ }, () => [
278
287
  createElementVNode("button", {
279
288
  tabindex: "-1",
280
289
  type: "button",
@@ -290,17 +299,22 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
290
299
  _ctx.$slots["left-icon"] ? {
291
300
  name: "left-icon",
292
301
  fn: withCtx(() => [
293
- renderSlot(_ctx.$slots, "left-icon", {}, void 0, !0)
302
+ renderSlot(_ctx.$slots, "left-icon", {
303
+ isOpen: isOpen.value,
304
+ close,
305
+ open: openPicker,
306
+ toggle: togglePopover
307
+ }, void 0, !0)
294
308
  ]),
295
309
  key: "0"
296
310
  } : void 0
297
311
  ]), 1040, ["id", "required", "border-active", "color", "model-value", "size", "block", "placeholder", "label", "autocomplete", "disabled"])
298
312
  ]),
299
- default: withCtx(() => [
313
+ default: withCtx(({ close, open: openPicker, toggle: togglePopover }) => [
300
314
  createElementVNode("div", {
301
315
  id: `${unref(instanceId)}-option-list`,
302
- ref_key: "optionListElement",
303
- ref: optionListElement,
316
+ ref_key: "optionListRef",
317
+ ref: optionListRef,
304
318
  class: normalizeClass(["m-select-list", `--${_ctx.size}`]),
305
319
  style: normalizeStyle([{
306
320
  maxHeight: `${_ctx.maxListHeight}px`,
@@ -313,8 +327,7 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
313
327
  }, [
314
328
  _ctx.search ? (openBlock(), createBlock(MazInput, {
315
329
  key: 0,
316
- ref_key: "searchInputComponent",
317
- ref: searchInputComponent,
330
+ ref: "searchInput",
318
331
  modelValue: searchQuery.value,
319
332
  "onUpdate:modelValue": [
320
333
  _cache[4] || (_cache[4] = ($event) => searchQuery.value = $event),
@@ -335,19 +348,13 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
335
348
  createElementVNode("span", _hoisted_3, [
336
349
  createVNode(unref(MazNoSymbol), { class: "maz-size-6 maz-text-foreground" })
337
350
  ])
338
- ], !0) : (openBlock(), createElementBlock("div", {
339
- key: 2,
340
- ref_key: "optionListScrollWrapper",
341
- ref: optionListScrollWrapper,
342
- class: "m-select-list__scroll-wrapper",
343
- tabindex: "-1"
344
- }, [
351
+ ], !0) : (openBlock(), createElementBlock("div", _hoisted_4, [
345
352
  (openBlock(!0), createElementBlock(Fragment, null, renderList(optionList.value, (option, i) => (openBlock(), createElementBlock(Fragment, { key: i }, [
346
353
  option.label && option.isOptGroup ? renderSlot(_ctx.$slots, "optgroup", {
347
354
  key: 0,
348
355
  label: option.label
349
356
  }, () => [
350
- createElementVNode("span", _hoisted_4, toDisplayString(option.label), 1)
357
+ createElementVNode("span", _hoisted_5, toDisplayString(option.label), 1)
351
358
  ], !0) : (openBlock(), createElementBlock("button", {
352
359
  key: 1,
353
360
  type: "button",
@@ -369,19 +376,23 @@ const _hoisted_1 = ["aria-label"], _hoisted_2 = ["id"], _hoisted_3 = { class: "m
369
376
  }, null, 8, ["model-value", "color"])) : createCommentVNode("", !0),
370
377
  renderSlot(_ctx.$slots, "default", {
371
378
  option,
372
- isSelected: isSelectedOption(option)
379
+ isSelected: isSelectedOption(option),
380
+ isOpen: isOpen.value,
381
+ close,
382
+ open: openPicker,
383
+ toggle: togglePopover
373
384
  }, () => [
374
385
  createElementVNode("span", null, toDisplayString(option[_ctx.optionLabelKey]), 1)
375
386
  ], !0)
376
- ], 14, _hoisted_5))
387
+ ], 14, _hoisted_6))
377
388
  ], 64))), 128))
378
389
  ], 512))
379
390
  ], 14, _hoisted_2)
380
391
  ]),
381
392
  _: 3
382
- }, 8, ["modelValue", "class", "style", "block", "transition", "position"]));
393
+ }, 8, ["id", "modelValue", "class", "style", "block", "transition", "position", "position-reference"]));
383
394
  }
384
- }), MazSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ccb6b95e"]]);
395
+ }), MazSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a101d497"]]);
385
396
  export {
386
397
  MazSelect as default
387
398
  };
@@ -157,8 +157,18 @@ declare const _default: <Value extends MazInputValue, Option extends MazSelectOp
157
157
  }>): void;
158
158
  attrs: any;
159
159
  slots: {
160
- 'left-icon'?(_: {}): any;
161
- 'right-icon'?(_: {}): any;
160
+ 'left-icon'?(_: {
161
+ isOpen: boolean;
162
+ close: () => void;
163
+ open: () => void;
164
+ toggle: () => void;
165
+ }): any;
166
+ 'right-icon'?(_: {
167
+ isOpen: boolean;
168
+ close: () => void;
169
+ open: () => void;
170
+ toggle: () => void;
171
+ }): any;
162
172
  'no-results'?(_: {}): any;
163
173
  optgroup?(_: {
164
174
  label: string | number | true;
@@ -166,6 +176,10 @@ declare const _default: <Value extends MazInputValue, Option extends MazSelectOp
166
176
  default?(_: {
167
177
  option: Option;
168
178
  isSelected: boolean;
179
+ isOpen: boolean;
180
+ close: () => void;
181
+ open: () => void;
182
+ toggle: () => void;
169
183
  }): any;
170
184
  };
171
185
  emit: (((evt: "blur", value: Event) => void) & ((evt: "change", value: Event) => void) & ((evt: "close") => void) & ((evt: "focus", value?: Event | undefined) => void) & ((evt: "input", value: Event) => void) & ((evt: "open") => void) & ((evt: "update:model-value", value: Multiple extends true ? Value[] : Value) => void) & ((evt: "selected-option", value: Option) => void)) & ((evt: "update:open", value: boolean) => void);
@@ -14,11 +14,11 @@ import { _ } from "../chunks/MazChart.vue_vue_type_script_setup_true_lang.JSYXGy
14
14
  import { default as default14 } from "./MazCheckbox.js";
15
15
  import { default as default15 } from "./MazChecklist.js";
16
16
  import { default as default16 } from "./MazCircularProgressBar.js";
17
- import { M } from "../chunks/MazDatePicker.B1B6gUrC.js";
17
+ import { M } from "../chunks/MazDatePicker.BkBbJH6f.js";
18
18
  import { default as default17 } from "./MazDialog.js";
19
19
  import { _ as _2, u } from "../chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.DuEcluOw.js";
20
20
  import { default as default18 } from "./MazDrawer.js";
21
- import { _ as _3 } from "../chunks/MazDropdown.vue_vue_type_style_index_0_lang.DULnKQ2W.js";
21
+ import { _ as _3 } from "../chunks/MazDropdown.vue_vue_type_style_index_0_lang.CgXVL7hr.js";
22
22
  import { default as default19 } from "./MazDropzone.js";
23
23
  import { default as default20 } from "./MazExpandAnimation.js";
24
24
  import { default as default21 } from "./MazFullscreenLoader.js";
@@ -11,6 +11,7 @@ export * from './useIdleTimeout';
11
11
  export * from './useInjectStrict';
12
12
  export * from './useInstanceUniqId';
13
13
  export * from './useMountComponent';
14
+ export * from './useMutationObserver';
14
15
  export * from './useReadingTime';
15
16
  export * from './useStringMatching';
16
17
  export * from './useSwipe';
@@ -10,6 +10,7 @@ import { useIdleTimeout } from "./useIdleTimeout.js";
10
10
  import { useInjectStrict } from "./useInjectStrict.js";
11
11
  import { useInstanceUniqId } from "./useInstanceUniqId.js";
12
12
  import { useMountComponent } from "./useMountComponent.js";
13
+ import { useMutationObserver } from "./useMutationObserver.js";
13
14
  import { useReadingTime } from "./useReadingTime.js";
14
15
  import { u } from "../chunks/useStringMatching.DzSigyZ7.js";
15
16
  import { useSwipe } from "./useSwipe.js";
@@ -31,6 +32,7 @@ export {
31
32
  useInjectStrict,
32
33
  useInstanceUniqId,
33
34
  useMountComponent,
35
+ useMutationObserver,
34
36
  useReadingTime,
35
37
  u as useStringMatching,
36
38
  useSwipe,
@@ -0,0 +1,13 @@
1
+ import { ComponentPublicInstance, MaybeRefOrGetter } from 'vue';
2
+ export interface UseMutationObserverOptions extends MutationObserverInit {
3
+ internalWindow?: Window | undefined;
4
+ }
5
+ /**
6
+ * Watch for changes into DOM element.
7
+ */
8
+ export declare function useMutationObserver(target: MaybeRefOrGetter<HTMLElement | SVGElement | ComponentPublicInstance | undefined | null>, callback: MutationCallback, options?: UseMutationObserverOptions): {
9
+ isSupported: import('vue').Ref<boolean, boolean>;
10
+ stop: () => void;
11
+ takeRecords: () => MutationRecord[] | undefined;
12
+ };
13
+ export type UseMutationObserverReturn = ReturnType<typeof useMutationObserver>;
@@ -0,0 +1,37 @@
1
+ import { e } from "../chunks/isClient.8V3qjGdO.js";
2
+ import { r } from "../chunks/truthyFilter.DZvXmxeK.js";
3
+ import { ref, onMounted, computed, toValue, watch } from "vue";
4
+ function useMutationObserver(target, callback, options = {}) {
5
+ const {
6
+ internalWindow = e() ? globalThis : void 0,
7
+ ...mutationOptions
8
+ } = options;
9
+ let observer;
10
+ const isSupported = ref(!1);
11
+ onMounted(() => {
12
+ isSupported.value = (internalWindow && "MutationObserver" in internalWindow) ?? !1;
13
+ });
14
+ const cleanup = () => {
15
+ observer && (observer.disconnect(), observer = void 0);
16
+ }, targets = computed(() => {
17
+ const value = toValue(target);
18
+ let element;
19
+ return value && "$el" in value ? element = value.$el : value && (element = value), new Set([element].filter(r));
20
+ }), stopWatch = watch(
21
+ targets,
22
+ (newTargets) => {
23
+ cleanup(), isSupported.value && newTargets.size && (observer = new MutationObserver(callback), newTargets.forEach((el) => observer.observe(el, mutationOptions)));
24
+ },
25
+ { immediate: !0, flush: "post" }
26
+ );
27
+ return {
28
+ isSupported,
29
+ stop: () => {
30
+ stopWatch(), cleanup();
31
+ },
32
+ takeRecords: () => observer?.takeRecords()
33
+ };
34
+ }
35
+ export {
36
+ useMutationObserver
37
+ };
@@ -11,9 +11,9 @@ function useWindowSize(options = {}) {
11
11
  internalWindow && (includeScrollbar ? (width.value = internalWindow.innerWidth, height.value = internalWindow.innerHeight) : (width.value = internalWindow.document.documentElement.clientWidth, height.value = internalWindow.document.documentElement.clientHeight));
12
12
  }
13
13
  return update(), onMounted(() => {
14
- internalWindow && window.addEventListener("resize", update, { passive: !0 });
14
+ internalWindow && internalWindow.addEventListener("resize", update, { passive: !0 });
15
15
  }), onUnmounted(() => {
16
- internalWindow && window.removeEventListener("resize", update);
16
+ internalWindow && internalWindow.removeEventListener("resize", update);
17
17
  }), { width, height };
18
18
  }
19
19
  export {