mhz-ui 1.0.4 → 1.0.5

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.
@@ -1,19 +1,19 @@
1
1
  import "./UiPagination.css";
2
- import { defineComponent as b, openBlock as r, createElementBlock as m, normalizeClass as e, createElementVNode as n, toDisplayString as d } from "vue";
3
- import { _ as g } from "../_plugin-vue_export-helper-dad06003.js";
4
- const y = ["disabled"], $ = ["disabled"], f = ["disabled"], c = ["disabled"], v = /* @__PURE__ */ b({
2
+ import { defineComponent as u, openBlock as b, createElementBlock as r, normalizeClass as e, createElementVNode as n, toDisplayString as i } from "vue";
3
+ import { _ as m } from "../_plugin-vue_export-helper-dad06003.js";
4
+ const g = ["disabled"], y = ["disabled"], $ = ["disabled"], f = ["disabled"], c = /* @__PURE__ */ u({
5
5
  __name: "UiPagination",
6
6
  props: {
7
7
  page: {},
8
8
  total: {}
9
9
  },
10
10
  emits: ["update"],
11
- setup(p, { emit: u }) {
12
- const a = p, i = document.querySelector("main");
11
+ setup(d, { emit: p }) {
12
+ const a = d;
13
13
  function s(t) {
14
- u("update", t), i && i.scrollTo({ top: 0, left: 0, behavior: "smooth" });
14
+ p("update", t), document.querySelector("main")?.scrollTo(0, 0);
15
15
  }
16
- return (t, o) => (r(), m("div", {
16
+ return (t, o) => (b(), r("div", {
17
17
  class: e(t.$style.pagination)
18
18
  }, [
19
19
  n("button", {
@@ -21,37 +21,37 @@ const y = ["disabled"], $ = ["disabled"], f = ["disabled"], c = ["disabled"], v
21
21
  disabled: t.page === 1,
22
22
  class: e(t.$style.button),
23
23
  type: "button"
24
- }, "<<", 10, y),
24
+ }, "<<", 10, g),
25
25
  n("button", {
26
26
  onClick: o[1] || (o[1] = (l) => s(a.page - 1)),
27
27
  disabled: t.page === 1,
28
28
  class: e(t.$style.button),
29
29
  type: "button"
30
- }, " < ", 10, $),
30
+ }, " < ", 10, y),
31
31
  n("div", {
32
32
  class: e(t.$style.text)
33
- }, d(t.page) + " of " + d(t.total), 3),
33
+ }, i(t.page) + " of " + i(t.total), 3),
34
34
  n("button", {
35
35
  onClick: o[2] || (o[2] = (l) => s(a.page + 1)),
36
36
  disabled: t.page === t.total,
37
37
  class: e(t.$style.button),
38
38
  type: "button"
39
- }, " > ", 10, f),
39
+ }, " > ", 10, $),
40
40
  n("button", {
41
41
  onClick: o[3] || (o[3] = (l) => s(a.total)),
42
42
  disabled: t.page === t.total,
43
43
  class: e(t.$style.button),
44
44
  type: "button"
45
- }, " >> ", 10, c)
45
+ }, " >> ", 10, f)
46
46
  ], 2));
47
47
  }
48
- }), k = "_pagination_3h5xm_1", C = "_button_3h5xm_9", _ = "_text_3h5xm_30", h = {
48
+ }), k = "_pagination_3h5xm_1", v = "_button_3h5xm_9", C = "_text_3h5xm_30", _ = {
49
49
  pagination: k,
50
- button: C,
51
- text: _
50
+ button: v,
51
+ text: C
52
52
  }, U = {
53
- $style: h
54
- }, M = /* @__PURE__ */ g(v, [["__cssModules", U]]);
53
+ $style: _
54
+ }, M = /* @__PURE__ */ m(c, [["__cssModules", U]]);
55
55
  export {
56
56
  M as default
57
57
  };
@@ -1,114 +1,120 @@
1
1
  import "./UiSelect.css";
2
- import { getCurrentScope as N, onScopeDispose as R, unref as b, watch as T, openBlock as h, createElementBlock as y, createElementVNode as B, defineComponent as D, ref as w, computed as K, normalizeClass as E, createVNode as S, createCommentVNode as L, Fragment as W, renderList as q, withKeys as $, toDisplayString as z } from "vue";
3
- import j from "../UiInput/UiInput.js";
2
+ import { getCurrentScope as N, onScopeDispose as R, unref as O, watch as T, openBlock as h, createElementBlock as y, createElementVNode as B, defineComponent as D, ref as w, computed as K, normalizeClass as E, createVNode as S, createCommentVNode as A, Fragment as W, renderList as q, withKeys as $, toDisplayString as z } from "vue";
3
+ import L from "../UiInput/UiInput.js";
4
4
  import { _ as H } from "../_plugin-vue_export-helper-dad06003.js";
5
- function Q(r) {
6
- return N() ? (R(r), !0) : !1;
5
+ function Q(o) {
6
+ return N() ? (R(o), !0) : !1;
7
7
  }
8
- function P(r) {
9
- return typeof r == "function" ? r() : b(r);
8
+ function P(o) {
9
+ return typeof o == "function" ? o() : O(o);
10
10
  }
11
- const M = typeof window < "u" && typeof document < "u", A = () => {
12
- }, x = /* @__PURE__ */ G();
13
- function G() {
14
- return M && window?.navigator?.userAgent && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
11
+ const M = typeof window < "u" && typeof document < "u", x = Object.prototype.toString, G = (o) => x.call(o) === "[object Object]", j = () => {
12
+ }, J = /* @__PURE__ */ X();
13
+ function X() {
14
+ var o;
15
+ return M && ((o = window?.navigator) == null ? void 0 : o.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
15
16
  }
16
- function C(r) {
17
- const l = P(r);
18
- return l?.$el ?? l;
17
+ function C(o) {
18
+ var s;
19
+ const t = P(o);
20
+ return (s = t?.$el) != null ? s : t;
19
21
  }
20
22
  const U = M ? window : void 0;
21
- function I(...r) {
22
- let l, t, o, f;
23
- if (typeof r[0] == "string" || Array.isArray(r[0]) ? ([t, o, f] = r, l = U) : [l, t, o, f] = r, !l)
24
- return A;
25
- Array.isArray(t) || (t = [t]), Array.isArray(o) || (o = [o]);
26
- const u = [], c = () => {
27
- u.forEach((i) => i()), u.length = 0;
28
- }, a = (i, d, e, n) => (i.addEventListener(d, e, n), () => i.removeEventListener(d, e, n)), _ = T(
29
- () => [C(l), P(f)],
30
- ([i, d]) => {
31
- c(), i && u.push(
32
- ...t.flatMap((e) => o.map((n) => a(i, e, n, d)))
23
+ function b(...o) {
24
+ let s, t, r, m;
25
+ if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([t, r, m] = o, s = U) : [s, t, r, m] = o, !s)
26
+ return j;
27
+ Array.isArray(t) || (t = [t]), Array.isArray(r) || (r = [r]);
28
+ const c = [], d = () => {
29
+ c.forEach((i) => i()), c.length = 0;
30
+ }, p = (i, a, e, n) => (i.addEventListener(a, e, n), () => i.removeEventListener(a, e, n)), _ = T(
31
+ () => [C(s), P(m)],
32
+ ([i, a]) => {
33
+ if (d(), !i)
34
+ return;
35
+ const e = G(a) ? { ...a } : a;
36
+ c.push(
37
+ ...t.flatMap((n) => r.map((u) => p(i, n, u, e)))
33
38
  );
34
39
  },
35
40
  { immediate: !0, flush: "post" }
36
41
  ), k = () => {
37
- _(), c();
42
+ _(), d();
38
43
  };
39
44
  return Q(k), k;
40
45
  }
41
46
  let F = !1;
42
- function J(r, l, t = {}) {
43
- const { window: o = U, ignore: f = [], capture: u = !0, detectIframe: c = !1 } = t;
44
- if (!o)
47
+ function Y(o, s, t = {}) {
48
+ const { window: r = U, ignore: m = [], capture: c = !0, detectIframe: d = !1 } = t;
49
+ if (!r)
45
50
  return;
46
- x && !F && (F = !0, Array.from(o.document.body.children).forEach((e) => e.addEventListener("click", A)), o.document.documentElement.addEventListener("click", A));
47
- let a = !0;
48
- const _ = (e) => f.some((n) => {
51
+ J && !F && (F = !0, Array.from(r.document.body.children).forEach((e) => e.addEventListener("click", j)), r.document.documentElement.addEventListener("click", j));
52
+ let p = !0;
53
+ const _ = (e) => m.some((n) => {
49
54
  if (typeof n == "string")
50
- return Array.from(o.document.querySelectorAll(n)).some((m) => m === e.target || e.composedPath().includes(m));
55
+ return Array.from(r.document.querySelectorAll(n)).some((u) => u === e.target || e.composedPath().includes(u));
51
56
  {
52
- const m = C(n);
53
- return m && (e.target === m || e.composedPath().includes(m));
57
+ const u = C(n);
58
+ return u && (e.target === u || e.composedPath().includes(u));
54
59
  }
55
60
  }), i = [
56
- I(o, "click", (e) => {
57
- const n = C(r);
61
+ b(r, "click", (e) => {
62
+ const n = C(o);
58
63
  if (!(!n || n === e.target || e.composedPath().includes(n))) {
59
- if (e.detail === 0 && (a = !_(e)), !a) {
60
- a = !0;
64
+ if (e.detail === 0 && (p = !_(e)), !p) {
65
+ p = !0;
61
66
  return;
62
67
  }
63
- l(e);
68
+ s(e);
64
69
  }
65
- }, { passive: !0, capture: u }),
66
- I(o, "pointerdown", (e) => {
67
- const n = C(r);
68
- n && (a = !e.composedPath().includes(n) && !_(e));
70
+ }, { passive: !0, capture: c }),
71
+ b(r, "pointerdown", (e) => {
72
+ const n = C(o);
73
+ n && (p = !e.composedPath().includes(n) && !_(e));
69
74
  }, { passive: !0 }),
70
- c && I(o, "blur", (e) => {
75
+ d && b(r, "blur", (e) => {
71
76
  setTimeout(() => {
72
- const n = C(r);
73
- o.document.activeElement?.tagName === "IFRAME" && !n?.contains(o.document.activeElement) && l(e);
77
+ var n;
78
+ const u = C(o);
79
+ ((n = r.document.activeElement) == null ? void 0 : n.tagName) === "IFRAME" && !u?.contains(r.document.activeElement) && s(e);
74
80
  }, 0);
75
81
  })
76
82
  ].filter(Boolean);
77
83
  return () => i.forEach((e) => e());
78
84
  }
79
- const X = {
85
+ const Z = {
80
86
  xmlns: "http://www.w3.org/2000/svg",
81
87
  width: "15",
82
88
  height: "8",
83
89
  fill: "none"
84
- }, Y = /* @__PURE__ */ B("path", {
90
+ }, ee = /* @__PURE__ */ B("path", {
85
91
  stroke: "currentColor",
86
92
  "stroke-linecap": "round",
87
93
  "stroke-linejoin": "round",
88
94
  d: "m.5 1 7.17 6 6.83-6"
89
- }, null, -1), Z = [
90
- Y
95
+ }, null, -1), te = [
96
+ ee
91
97
  ];
92
- function ee(r, l) {
93
- return h(), y("svg", X, Z);
98
+ function oe(o, s) {
99
+ return h(), y("svg", Z, te);
94
100
  }
95
- const te = { render: ee }, oe = {
101
+ const ne = { render: oe }, re = {
96
102
  xmlns: "http://www.w3.org/2000/svg",
97
103
  width: "15",
98
104
  height: "8",
99
105
  fill: "none"
100
- }, ne = /* @__PURE__ */ B("path", {
106
+ }, le = /* @__PURE__ */ B("path", {
101
107
  stroke: "currentColor",
102
108
  "stroke-linecap": "round",
103
109
  "stroke-linejoin": "round",
104
110
  d: "m.5 7 7.17-6 6.83 6"
105
- }, null, -1), re = [
106
- ne
111
+ }, null, -1), se = [
112
+ le
107
113
  ];
108
- function se(r, l) {
109
- return h(), y("svg", oe, re);
114
+ function ie(o, s) {
115
+ return h(), y("svg", re, se);
110
116
  }
111
- const le = { render: se }, ie = ["onClick", "onKeydown", "onMouseenter", "data-current"], ue = /* @__PURE__ */ D({
117
+ const ue = { render: ie }, ce = ["onClick", "onKeydown", "onMouseenter", "data-current"], ae = /* @__PURE__ */ D({
112
118
  __name: "UiSelect",
113
119
  props: {
114
120
  modelValue: {},
@@ -116,74 +122,74 @@ const le = { render: se }, ie = ["onClick", "onKeydown", "onMouseenter", "data-c
116
122
  isFilter: { type: Boolean }
117
123
  },
118
124
  emits: ["update:modelValue", "reachedBottom"],
119
- setup(r, { emit: l }) {
120
- const t = r, o = w(""), f = K(() => {
125
+ setup(o, { emit: s }) {
126
+ const t = o, r = w(""), m = K(() => {
121
127
  if (!t.options)
122
128
  return [];
123
- let s = t.options;
124
- return typeof t.options[0] != "object" && (s = t.options.map((p) => ({ _id: p, title: p }))), t.isFilter ? s.filter((p) => p.title.toLowerCase().includes(o.value.toLowerCase())) : s;
125
- }), u = w(!1), c = w(), a = w(), _ = w([]);
126
- function k(s) {
127
- l("update:modelValue", s);
129
+ let l = t.options;
130
+ return typeof t.options[0] != "object" && (l = t.options.map((f) => ({ _id: f, title: f }))), t.isFilter ? l.filter((f) => f.title.toLowerCase().includes(r.value.toLowerCase())) : l;
131
+ }), c = w(!1), d = w(), p = w(), _ = w([]);
132
+ function k(l) {
133
+ s("update:modelValue", l);
128
134
  }
129
- function i(s) {
130
- s < 0 || s === f.value.length || t.isFilter || _.value[s]?.focus();
135
+ function i(l) {
136
+ l < 0 || l === m.value.length || t.isFilter || _.value[l]?.focus();
131
137
  }
132
- function d() {
133
- c.value?.removeEventListener("scroll", m, !0), o.value = "", u.value = !1;
138
+ function a() {
139
+ d.value?.removeEventListener("scroll", u, !0), r.value = "", c.value = !1;
134
140
  }
135
141
  function e() {
136
- u.value = !0, t.isFilter || setTimeout(() => {
137
- c.value?.scrollTo(0, 0), i(0), c.value?.addEventListener("scroll", m, !0);
142
+ c.value = !0, t.isFilter || setTimeout(() => {
143
+ d.value?.scrollTo(0, 0), i(0), d.value?.addEventListener("scroll", u, !0);
138
144
  }, 100);
139
145
  }
140
- function n(s) {
141
- l("update:modelValue", typeof t.modelValue == "object" ? s : s._id), d();
146
+ function n(l) {
147
+ s("update:modelValue", typeof t.modelValue == "object" ? l : l._id), a();
142
148
  }
143
- function m() {
144
- if (!c.value || !a.value)
149
+ function u() {
150
+ if (!d.value || !p.value)
145
151
  return;
146
- c.value.getBoundingClientRect().y - a.value.getBoundingClientRect().y - a.value.scrollHeight + c.value.getBoundingClientRect().height > -100 && l("reachedBottom");
152
+ d.value.getBoundingClientRect().y - p.value.getBoundingClientRect().y - p.value.scrollHeight + d.value.getBoundingClientRect().height > -100 && s("reachedBottom");
147
153
  }
148
- const O = w();
149
- return J(O, () => {
150
- d();
151
- }), (s, p) => (h(), y("div", {
152
- class: E(s.$style.container),
154
+ const I = w();
155
+ return Y(I, () => {
156
+ a();
157
+ }), (l, f) => (h(), y("div", {
158
+ class: E(l.$style.container),
153
159
  ref_key: "containerElement",
154
- ref: O
160
+ ref: I
155
161
  }, [
156
- S(j, {
162
+ S(L, {
157
163
  modelValue: typeof t.modelValue == "object" ? t.modelValue.title : t.modelValue,
158
164
  onUpdate: k,
159
- onToggle: p[0] || (p[0] = (v) => u.value ? d() : e()),
165
+ onToggle: f[0] || (f[0] = (v) => c.value ? a() : e()),
160
166
  mode: "select",
161
167
  placeholder: "Choose variant",
162
- appendIcon: u.value ? b(le) : b(te)
168
+ appendIcon: c.value ? O(ue) : O(ne)
163
169
  }, null, 8, ["modelValue", "appendIcon"]),
164
- t.isFilter && u.value ? (h(), y("div", {
170
+ t.isFilter && c.value ? (h(), y("div", {
165
171
  key: 0,
166
- class: E(s.$style.filter)
172
+ class: E(l.$style.filter)
167
173
  }, [
168
- S(j, {
169
- modelValue: o.value,
170
- "onUpdate:modelValue": p[1] || (p[1] = (v) => o.value = v),
174
+ S(L, {
175
+ modelValue: r.value,
176
+ "onUpdate:modelValue": f[1] || (f[1] = (v) => r.value = v),
171
177
  placeholder: "Filter Variants",
172
178
  isFocus: ""
173
179
  }, null, 8, ["modelValue"])
174
- ], 2)) : L("", !0),
175
- u.value ? (h(), y("div", {
180
+ ], 2)) : A("", !0),
181
+ c.value ? (h(), y("div", {
176
182
  key: 1,
177
- class: E(s.$style.options),
183
+ class: E(l.$style.options),
178
184
  ref_key: "optionsElement",
179
- ref: c
185
+ ref: d
180
186
  }, [
181
- f.value.length ? (h(), y("div", {
187
+ m.value.length ? (h(), y("div", {
182
188
  key: 0,
183
189
  ref_key: "optionsInnerElement",
184
- ref: a
190
+ ref: p
185
191
  }, [
186
- (h(!0), y(W, null, q(f.value, (v, V) => (h(), y("div", {
192
+ (h(!0), y(W, null, q(m.value, (v, V) => (h(), y("div", {
187
193
  key: `${v}-${V}`,
188
194
  onClick: (g) => n(v),
189
195
  onKeydown: [
@@ -191,33 +197,33 @@ const le = { render: se }, ie = ["onClick", "onKeydown", "onMouseenter", "data-c
191
197
  $((g) => n(v), ["space"]),
192
198
  $((g) => i(V - 1), ["up"]),
193
199
  $((g) => i(V + 1), ["down"]),
194
- p[2] || (p[2] = $((g) => u.value ? d() : e(), ["esc"]))
200
+ f[2] || (f[2] = $((g) => c.value ? a() : e(), ["esc"]))
195
201
  ],
196
202
  onMouseenter: (g) => i(V),
197
- class: E(s.$style.option),
203
+ class: E(l.$style.option),
198
204
  tabindex: "0",
199
205
  ref_for: !0,
200
206
  ref_key: "optionElement",
201
207
  ref: _,
202
208
  "data-current": t.modelValue === v._id
203
- }, z(v.title), 43, ie))), 128))
209
+ }, z(v.title), 43, ce))), 128))
204
210
  ], 512)) : (h(), y("div", {
205
211
  key: 1,
206
- onClick: d,
207
- class: E(s.$style.option),
212
+ onClick: a,
213
+ class: E(l.$style.option),
208
214
  tabindex: "0"
209
215
  }, "No results", 2))
210
- ], 2)) : L("", !0)
216
+ ], 2)) : A("", !0)
211
217
  ], 2));
212
218
  }
213
- }), ce = "_container_1bjom_1", ae = "_filter_1bjom_5", de = "_options_1bjom_9", pe = "_option_1bjom_9", fe = {
214
- container: ce,
215
- filter: ae,
216
- options: de,
217
- option: pe
218
- }, me = {
219
- $style: fe
220
- }, _e = /* @__PURE__ */ H(ue, [["__cssModules", me]]);
219
+ }), de = "_container_1bjom_1", pe = "_filter_1bjom_5", fe = "_options_1bjom_9", me = "_option_1bjom_9", ve = {
220
+ container: de,
221
+ filter: pe,
222
+ options: fe,
223
+ option: me
224
+ }, he = {
225
+ $style: ve
226
+ }, we = /* @__PURE__ */ H(ae, [["__cssModules", he]]);
221
227
  export {
222
- _e as default
228
+ we as default
223
229
  };
package/dist/base.scss CHANGED
@@ -74,4 +74,5 @@ img {
74
74
  display: flex;
75
75
  max-width: 100%;
76
76
  height: auto;
77
+ pointer-events: none;
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mhz-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "mhz-ui",
5
5
  "author": "dergunov.com",
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@
26
26
  "@tiptap/pm": "2.1.7",
27
27
  "@tiptap/starter-kit": "2.1.7",
28
28
  "@tiptap/vue-3": "2.1.7",
29
- "@vueuse/core": "10.4.0",
30
- "@vueuse/integrations": "10.4.0",
29
+ "@vueuse/core": "10.4.1",
30
+ "@vueuse/integrations": "10.4.1",
31
31
  "vue": "3.3.4",
32
32
  "vue-router": "4.2.4"
33
33
  },
@@ -40,7 +40,7 @@
40
40
  "@storybook/preview-api": "7.3.2",
41
41
  "@storybook/vue3": "7.3.2",
42
42
  "@storybook/vue3-vite": "7.3.2",
43
- "@types/node": "20.5.6",
43
+ "@types/node": "20.5.7",
44
44
  "@typescript-eslint/eslint-plugin": "6.4.1",
45
45
  "@typescript-eslint/parser": "6.4.1",
46
46
  "@vitejs/plugin-vue": "4.3.3",