mhz-ui 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +1,53 @@
1
1
  import "./UiSearch.css";
2
- import { openBlock as n, createElementBlock as l, createElementVNode as I, defineComponent as $, ref as S, computed as C, normalizeClass as k, createVNode as N, unref as b, withKeys as B, Fragment as d, createTextVNode as v, createCommentVNode as h, renderList as V, toDisplayString as E, createBlock as O, resolveDynamicComponent as T, withCtx as U } from "vue";
3
- import { RouterLink as Z } from "vue-router";
4
- import { o as q } from "../index-e9b7d99f.js";
5
- import L from "../UiInput/UiInput.js";
6
- import { _ as R } from "../_plugin-vue_export-helper-dad06003.js";
7
- const D = {
2
+ import { openBlock as n, createElementBlock as s, createElementVNode as O, defineComponent as R, ref as N, computed as I, normalizeClass as g, createVNode as T, withKeys as b, unref as V, Fragment as d, createTextVNode as w, toDisplayString as S, createCommentVNode as h, renderList as E, createBlock as B, resolveDynamicComponent as L, withCtx as U } from "vue";
3
+ import { RouterLink as $ } from "vue-router";
4
+ import { o as M } from "../index-e9b7d99f.js";
5
+ import D from "../UiInput/UiInput.js";
6
+ import { _ as Z } from "../_plugin-vue_export-helper-dad06003.js";
7
+ const q = {
8
8
  trailing: !0
9
9
  };
10
- function F(m, u = 25, e = {}) {
11
- if (e = { ...D, ...e }, !Number.isFinite(u))
10
+ function F(m, r = 25, e = {}) {
11
+ if (e = { ...q, ...e }, !Number.isFinite(r))
12
12
  throw new TypeError("Expected `wait` to be a finite number");
13
- let a, c, _ = [], s, p;
14
- const y = (o, f) => (s = K(m, o, f), s.finally(() => {
15
- if (s = null, e.trailing && p && !c) {
16
- const t = y(o, p);
17
- return p = null, t;
13
+ let u, c, y = [], o, a;
14
+ const f = (l, i) => (o = K(m, l, i), o.finally(() => {
15
+ if (o = null, e.trailing && a && !c) {
16
+ const _ = f(l, a);
17
+ return a = null, _;
18
18
  }
19
- }), s);
20
- return function(...o) {
21
- return s ? (e.trailing && (p = o), s) : new Promise((f) => {
22
- const t = !c && e.leading;
19
+ }), o);
20
+ return function(...l) {
21
+ return o ? (e.trailing && (a = l), o) : new Promise((i) => {
22
+ const _ = !c && e.leading;
23
23
  clearTimeout(c), c = setTimeout(() => {
24
24
  c = null;
25
- const i = e.leading ? a : y(this, o);
26
- for (const r of _)
27
- r(i);
28
- _ = [];
29
- }, u), t ? (a = y(this, o), f(a)) : _.push(f);
25
+ const t = e.leading ? u : f(this, l);
26
+ for (const k of y)
27
+ k(t);
28
+ y = [];
29
+ }, r), _ ? (u = f(this, l), i(u)) : y.push(i);
30
30
  });
31
31
  };
32
32
  }
33
- async function K(m, u, e) {
34
- return await m.apply(u, e);
33
+ async function K(m, r, e) {
34
+ return await m.apply(r, e);
35
35
  }
36
- const M = {
36
+ const P = {
37
37
  xmlns: "http://www.w3.org/2000/svg",
38
38
  width: "16",
39
39
  height: "16",
40
40
  fill: "none"
41
- }, P = /* @__PURE__ */ I("path", {
41
+ }, A = /* @__PURE__ */ O("path", {
42
42
  fill: "#dfdfdf",
43
43
  d: "M13.5 15.338a.5.5 0 1 0 .737-.676l-.736.676Zm.737-.676-1.398-1.523-.737.676 1.399 1.523.736-.676ZM13.5 7.628c0 3.394-2.695 6.129-6 6.129v1c3.875 0 7-3.201 7-7.129h-1Zm-6 6.129c-3.305 0-6-2.735-6-6.129h-1c0 3.928 3.125 7.129 7 7.129v-1Zm-6-6.129c0-3.393 2.695-6.128 6-6.128v-1C3.625.5.5 3.7.5 7.628h1Zm6-6.128c3.305 0 6 2.735 6 6.128h1C14.5 3.701 11.375.5 7.5.5v1Z"
44
- }, null, -1), A = [
45
- P
44
+ }, null, -1), Y = [
45
+ A
46
46
  ];
47
- function j(m, u) {
48
- return n(), l("svg", M, A);
47
+ function j(m, r) {
48
+ return n(), s("svg", P, Y);
49
49
  }
50
- const x = { render: j }, z = /* @__PURE__ */ $({
50
+ const x = { render: j }, z = "Please enter 3 or more symbols", G = "Loading...", H = "No results", J = 300, Q = /* @__PURE__ */ R({
51
51
  __name: "UiSearch",
52
52
  props: {
53
53
  modelValue: {},
@@ -56,66 +56,77 @@ const x = { render: j }, z = /* @__PURE__ */ $({
56
56
  isSuccess: { type: Boolean }
57
57
  },
58
58
  emits: ["update:modelValue"],
59
- setup(m, { emit: u }) {
60
- const e = m, a = S(!1), c = F(async (t) => {
61
- u("update:modelValue", t);
62
- }, 300);
63
- async function _(t) {
59
+ setup(m, { emit: r }) {
60
+ const e = m, u = N(!1), c = F(async (t) => {
61
+ r("update:modelValue", t);
62
+ }, J);
63
+ async function y(t) {
64
64
  await c(t);
65
65
  }
66
- function s() {
67
- a.value = !1;
66
+ function o() {
67
+ u.value = !0;
68
68
  }
69
- function p() {
70
- s(), u("update:modelValue", "");
69
+ function a() {
70
+ u.value = !1;
71
71
  }
72
- const y = C(() => e.results ? Object.values(e.results).reduce((t, i) => t + (i ? i.length : 0), 0) : !1), o = S();
73
- q(o, () => {
74
- s();
72
+ function f() {
73
+ a(), r("update:modelValue", "");
74
+ }
75
+ const l = I(() => e.results ? Object.values(e.results).reduce((t, k) => t + (k ? k.length : 0), 0) : !1), i = N();
76
+ M(i, () => {
77
+ a();
75
78
  });
76
- const f = C(() => window.IS_STORYBOOK ? "a" : Z);
77
- return (t, i) => (n(), l("div", {
78
- class: k(t.$style.container),
79
+ const _ = I(() => window.IS_STORYBOOK ? "a" : $);
80
+ return (t, k) => (n(), s("div", {
81
+ class: g(t.$style.container),
79
82
  ref_key: "containerElement",
80
- ref: o
83
+ ref: i
81
84
  }, [
82
- N(L, {
85
+ T(D, {
83
86
  modelValue: e.modelValue,
84
- "onUpdate:modelValue": _,
85
- appendIcon: b(x),
87
+ "onUpdate:modelValue": y,
88
+ onClick: o,
89
+ onKeyup: b(a, ["esc"]),
90
+ appendIcon: V(x),
86
91
  placeholder: "Search",
87
- onClick: i[0] || (i[0] = (r) => a.value = !0),
88
- onKeyup: B(s, ["esc"])
89
- }, null, 8, ["modelValue", "appendIcon", "onKeyup"]),
90
- a.value && e.modelValue.length ? (n(), l("div", {
92
+ "data-test": "ui-search"
93
+ }, null, 8, ["modelValue", "onKeyup", "appendIcon"]),
94
+ u.value && e.modelValue.length ? (n(), s("div", {
91
95
  key: 0,
92
- class: k(t.$style.results)
96
+ class: g(t.$style.results),
97
+ "data-test": "ui-search-results"
93
98
  }, [
94
- e.modelValue.length < 3 ? (n(), l(d, { key: 0 }, [
95
- v("Please enter 3 or more symbols")
99
+ e.modelValue.length < 3 ? (n(), s(d, { key: 0 }, [
100
+ w(S(V(z)), 1)
96
101
  ], 64)) : h("", !0),
97
- e.modelValue.length > 2 && !e.isSuccess ? (n(), l(d, { key: 1 }, [
98
- v("Loading...")
102
+ e.modelValue.length > 2 && !e.isSuccess ? (n(), s(d, { key: 1 }, [
103
+ w(S(V(G)), 1)
99
104
  ], 64)) : h("", !0),
100
- e.modelValue.length > 2 && !y.value && e.isSuccess ? (n(), l(d, { key: 2 }, [
101
- v("No results")
105
+ e.modelValue.length > 2 && !l.value && e.isSuccess ? (n(), s(d, { key: 2 }, [
106
+ w(S(V(H)), 1)
102
107
  ], 64)) : h("", !0),
103
- e.modelValue.length > 2 && y.value ? (n(!0), l(d, { key: 3 }, V(e.searchScheme, (r) => (n(), l("div", {
104
- key: r.type,
105
- class: k(t.$style.resultsInner)
108
+ e.modelValue.length > 2 && l.value && e.isSuccess ? (n(!0), s(d, { key: 3 }, E(e.searchScheme, (p) => (n(), s("div", {
109
+ key: p.type,
110
+ class: g(t.$style.resultsInner),
111
+ "data-test": "ui-search-result"
106
112
  }, [
107
- t.results?.[r.type]?.length ? (n(), l(d, { key: 0 }, [
108
- I("div", {
109
- class: k(t.$style.type)
110
- }, E(r.type) + ":", 3),
111
- (n(!0), l(d, null, V(t.results[r.type], (g) => (n(), O(T(f.value), {
112
- key: g._id,
113
- to: `${r.url}/${g._id}`,
114
- onClick: p,
115
- class: k(t.$style.link)
113
+ t.results?.[p.type]?.length ? (n(), s(d, { key: 0 }, [
114
+ O("div", {
115
+ class: g(t.$style.type),
116
+ "data-test": "ui-search-result-type"
117
+ }, S(p.type) + ":", 3),
118
+ (n(!0), s(d, null, E(t.results[p.type], (v) => (n(), B(L(_.value), {
119
+ key: v._id,
120
+ to: `${p.url}/${v._id}`,
121
+ onClick: f,
122
+ class: g(t.$style.link),
123
+ "data-test": "ui-search-result-link"
116
124
  }, {
117
125
  default: U(() => [
118
- (n(!0), l(d, null, V(r.labels, (w) => (n(), l("span", { key: w }, E(g[w]), 1))), 128))
126
+ (n(!0), s(d, null, E(p.labels, (C) => (n(), s("span", {
127
+ key: C,
128
+ "data-test": "ui-search-result-label"
129
+ }, S(v[C]), 1))), 128))
119
130
  ]),
120
131
  _: 2
121
132
  }, 1032, ["to", "class"]))), 128))
@@ -124,15 +135,15 @@ const x = { render: j }, z = /* @__PURE__ */ $({
124
135
  ], 2)) : h("", !0)
125
136
  ], 2));
126
137
  }
127
- }), Y = "_container_nqol5_1", G = "_results_nqol5_6", H = "_resultsInner_nqol5_22", J = "_type_nqol5_31", Q = "_link_nqol5_36", W = {
128
- container: Y,
129
- results: G,
130
- resultsInner: H,
131
- type: J,
132
- link: Q
133
- }, X = {
134
- $style: W
135
- }, oe = /* @__PURE__ */ R(z, [["__cssModules", X]]);
138
+ }), W = "_container_nqol5_1", X = "_results_nqol5_6", ee = "_resultsInner_nqol5_22", te = "_type_nqol5_31", ne = "_link_nqol5_36", se = {
139
+ container: W,
140
+ results: X,
141
+ resultsInner: ee,
142
+ type: te,
143
+ link: ne
144
+ }, le = {
145
+ $style: se
146
+ }, ie = /* @__PURE__ */ Z(Q, [["__cssModules", le]]);
136
147
  export {
137
- oe as default
148
+ ie as default
138
149
  };
@@ -44,17 +44,17 @@ const A = { render: x }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
44
44
  },
45
45
  emits: ["update:modelValue", "reachedBottom"],
46
46
  setup(y, { emit: m }) {
47
- const t = y, v = a(""), $ = E(() => typeof t.options?.[0] == "object"), g = E(() => {
47
+ const t = y, f = a(""), $ = E(() => typeof t.options?.[0] == "object"), g = E(() => {
48
48
  if (!t.options)
49
49
  return [];
50
50
  let e = t.options;
51
- return $.value || (e = t.options.map((o) => ({ _id: o, title: o }))), t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(v.value.toLowerCase())) : e;
52
- }), i = a(!1), r = a(), f = a(), w = a([]);
51
+ return $.value || (e = t.options.map((o) => ({ _id: o, title: o }))), t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(f.value.toLowerCase())) : e;
52
+ }), i = a(!1), r = a(), v = a(), w = a([]);
53
53
  function _(e) {
54
54
  e < 0 || e === g.value.length || t.isFilter || w.value[e]?.focus();
55
55
  }
56
56
  function c() {
57
- r.value?.removeEventListener("scroll", C, !0), v.value = "", i.value = !1;
57
+ r.value?.removeEventListener("scroll", C, !0), f.value = "", i.value = !1;
58
58
  }
59
59
  function V() {
60
60
  i.value = !0, t.isFilter || setTimeout(() => {
@@ -65,9 +65,9 @@ const A = { render: x }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
65
65
  m("update:modelValue", $.value ? e : e._id), c();
66
66
  }
67
67
  function C() {
68
- if (!r.value || !f.value)
68
+ if (!r.value || !v.value)
69
69
  return;
70
- r.value.getBoundingClientRect().y - f.value.getBoundingClientRect().y - f.value.scrollHeight + r.value.getBoundingClientRect().height > -100 && m("reachedBottom");
70
+ r.value.getBoundingClientRect().y - v.value.getBoundingClientRect().y - v.value.scrollHeight + r.value.getBoundingClientRect().height > -100 && m("reachedBottom");
71
71
  }
72
72
  const F = a();
73
73
  return U(F, () => {
@@ -82,29 +82,32 @@ const A = { render: x }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
82
82
  onToggle: o[0] || (o[0] = (n) => i.value ? c() : V()),
83
83
  mode: "select",
84
84
  placeholder: "Choose variant",
85
- appendIcon: i.value ? j(A) : j(D)
85
+ appendIcon: i.value ? j(A) : j(D),
86
+ "data-test": "ui-select-input"
86
87
  }, null, 8, ["modelValue", "appendIcon"]),
87
88
  t.isFilter && i.value ? (l(), s("div", {
88
89
  key: 0,
89
90
  class: d(e.$style.filter)
90
91
  }, [
91
92
  b(B, {
92
- modelValue: v.value,
93
- "onUpdate:modelValue": o[1] || (o[1] = (n) => v.value = n),
93
+ modelValue: f.value,
94
+ "onUpdate:modelValue": o[1] || (o[1] = (n) => f.value = n),
94
95
  placeholder: "Filter Variants",
95
- isFocus: ""
96
+ isFocus: "",
97
+ "data-test": "ui-select-input-filter"
96
98
  }, null, 8, ["modelValue"])
97
99
  ], 2)) : O("", !0),
98
100
  i.value ? (l(), s("div", {
99
101
  key: 1,
100
102
  class: d(e.$style.options),
101
103
  ref_key: "optionsElement",
102
- ref: r
104
+ ref: r,
105
+ "data-test": "ui-select-options"
103
106
  }, [
104
107
  g.value.length ? (l(), s("div", {
105
108
  key: 0,
106
109
  ref_key: "optionsInnerElement",
107
- ref: f
110
+ ref: v
108
111
  }, [
109
112
  (l(!0), s(S, null, M(g.value, (n, h) => (l(), s("div", {
110
113
  key: `${n}-${h}`,
@@ -122,14 +125,16 @@ const A = { render: x }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
122
125
  ref_for: !0,
123
126
  ref_key: "optionElement",
124
127
  ref: w,
125
- "data-current": typeof t.modelValue == "string" ? t.modelValue === n._id : t.modelValue?._id === n._id
128
+ "data-current": typeof t.modelValue == "string" ? t.modelValue === n._id : t.modelValue?._id === n._id,
129
+ "data-test": "ui-select-option"
126
130
  }, N(n.title), 43, G))), 128))
127
131
  ], 512)) : (l(), s("div", {
128
132
  key: 1,
129
133
  onClick: c,
130
134
  class: d(e.$style.option),
131
- tabindex: "0"
132
- }, "No results", 2))
135
+ tabindex: "0",
136
+ "data-test": "ui-select-no-results"
137
+ }, " No results ", 2))
133
138
  ], 2)) : O("", !0)
134
139
  ], 2));
135
140
  }
@@ -1,7 +1,7 @@
1
1
  import "./UiSlider.css";
2
- import { defineComponent as u, ref as _, openBlock as a, createElementBlock as i, normalizeClass as o, createElementVNode as n, Fragment as d, renderList as m } from "vue";
2
+ import { defineComponent as u, ref as d, openBlock as i, createElementBlock as c, normalizeClass as l, createElementVNode as a, Fragment as m, renderList as _ } from "vue";
3
3
  import { _ as h } from "../_plugin-vue_export-helper-dad06003.js";
4
- const p = ["onClick", "data-active"], $ = ["src", "alt"], b = ["src", "alt"], v = /* @__PURE__ */ u({
4
+ const p = ["onClick", "data-active"], b = ["src", "alt"], v = ["src", "alt", "data-slide"], $ = /* @__PURE__ */ u({
5
5
  __name: "UiSlider",
6
6
  props: {
7
7
  thumbs: {},
@@ -9,37 +9,40 @@ const p = ["onClick", "data-active"], $ = ["src", "alt"], b = ["src", "alt"], v
9
9
  path: {}
10
10
  },
11
11
  setup(r) {
12
- const s = r, t = _(0);
13
- return (e, B) => (a(), i("div", {
14
- class: o(e.$style.container)
12
+ const s = r, t = d(0);
13
+ return (e, B) => (i(), c("div", {
14
+ class: l(e.$style.container)
15
15
  }, [
16
- n("div", {
17
- class: o(e.$style.thumbs)
16
+ a("div", {
17
+ class: l(e.$style.thumbs)
18
18
  }, [
19
- (a(!0), i(d, null, m(s.thumbs, (l, c) => (a(), i("button", {
20
- key: l,
21
- onClick: (E) => t.value = c,
19
+ (i(!0), c(m, null, _(s.thumbs, (o, n) => (i(), c("button", {
20
+ key: o,
21
+ onClick: (E) => t.value = n,
22
22
  type: "button",
23
- class: o(e.$style.thumb),
24
- "data-active": t.value === c
23
+ class: l(e.$style.thumb),
24
+ "data-active": t.value === n,
25
+ "data-test": "ui-slider-thumb"
25
26
  }, [
26
- n("img", {
27
- src: s.path ? `${s.path}${l}` : l,
27
+ a("img", {
28
+ src: s.path ? `${s.path}${o}` : o,
28
29
  width: "64",
29
30
  height: "64",
30
- alt: `Thumb-${c}`,
31
+ alt: `thumb-${n}`,
31
32
  crossorigin: "anonymous"
32
- }, null, 8, $)
33
+ }, null, 8, b)
33
34
  ], 10, p))), 128))
34
35
  ], 2),
35
- n("div", {
36
- class: o(e.$style.slide)
36
+ a("div", {
37
+ class: l(e.$style.slide)
37
38
  }, [
38
- n("img", {
39
+ a("img", {
39
40
  src: s.path ? `${s.path}${s.slides[t.value]}` : s.slides[t.value],
40
- alt: `Slide-${t.value}`,
41
- crossorigin: "anonymous"
42
- }, null, 8, b)
41
+ alt: `slide-${t.value}`,
42
+ crossorigin: "anonymous",
43
+ "data-slide": t.value,
44
+ "data-test": "ui-slider-slide"
45
+ }, null, 8, v)
43
46
  ], 2)
44
47
  ], 2));
45
48
  }
@@ -50,7 +53,7 @@ const p = ["onClick", "data-active"], $ = ["src", "alt"], b = ["src", "alt"], v
50
53
  slide: g
51
54
  }, S = {
52
55
  $style: C
53
- }, w = /* @__PURE__ */ h(v, [["__cssModules", S]]);
56
+ }, w = /* @__PURE__ */ h($, [["__cssModules", S]]);
54
57
  export {
55
58
  w as default
56
59
  };
@@ -1,23 +1,23 @@
1
1
  import "./UiSpoiler.css";
2
- import { openBlock as r, createElementBlock as c, createElementVNode as l, defineComponent as a, normalizeClass as t, createVNode as d, unref as p, toDisplayString as _, withDirectives as u, renderSlot as m, vShow as h } from "vue";
2
+ import { openBlock as r, createElementBlock as a, createElementVNode as o, defineComponent as c, normalizeClass as e, createVNode as d, unref as p, toDisplayString as u, withDirectives as _, renderSlot as m, vShow as h } from "vue";
3
3
  import { _ as y } from "../_plugin-vue_export-helper-dad06003.js";
4
- const f = {
4
+ const b = {
5
5
  xmlns: "http://www.w3.org/2000/svg",
6
6
  width: "16",
7
7
  height: "16",
8
8
  fill: "none"
9
- }, k = /* @__PURE__ */ l("path", {
9
+ }, f = /* @__PURE__ */ o("path", {
10
10
  stroke: "currentColor",
11
11
  "stroke-linecap": "round",
12
12
  "stroke-linejoin": "round",
13
13
  d: "m1 5 7.17 6L15 5"
14
- }, null, -1), w = [
15
- k
14
+ }, null, -1), k = [
15
+ f
16
16
  ];
17
- function $(s, n) {
18
- return r(), c("svg", f, w);
17
+ function w(s, n) {
18
+ return r(), a("svg", b, k);
19
19
  }
20
- const b = { render: $ }, v = /* @__PURE__ */ a({
20
+ const $ = { render: w }, v = /* @__PURE__ */ c({
21
21
  __name: "UiSpoiler",
22
22
  props: {
23
23
  modelValue: { type: Boolean },
@@ -25,35 +25,38 @@ const b = { render: $ }, v = /* @__PURE__ */ a({
25
25
  },
26
26
  emits: ["update:modelValue"],
27
27
  setup(s, { emit: n }) {
28
- const o = s;
29
- return (e, i) => (r(), c("div", {
30
- class: t(e.$style.container)
28
+ const l = s;
29
+ return (t, i) => (r(), a("div", {
30
+ class: e(t.$style.container)
31
31
  }, [
32
- l("button", {
33
- onClick: i[0] || (i[0] = (E) => n("update:modelValue", !o.modelValue)),
34
- class: t(e.$style.titleBlock),
35
- type: "button"
32
+ o("button", {
33
+ onClick: i[0] || (i[0] = (E) => n("update:modelValue", !l.modelValue)),
34
+ class: e(t.$style.titleBlock),
35
+ type: "button",
36
+ "data-test": "ui-spoiler-button"
36
37
  }, [
37
- l("div", {
38
- class: t(e.$style.title)
38
+ o("div", {
39
+ class: e(t.$style.title)
39
40
  }, [
40
- d(p(b), {
41
- "data-expanded": o.modelValue,
42
- class: t(e.$style.icon),
41
+ d(p($), {
42
+ "data-expanded": l.modelValue,
43
+ class: e(t.$style.icon),
43
44
  width: "16",
44
45
  height: "16"
45
46
  }, null, 8, ["data-expanded", "class"]),
46
- l("span", {
47
- class: t(e.$style.titleText)
48
- }, _(o.title), 3)
47
+ o("span", {
48
+ class: e(t.$style.titleText),
49
+ "data-test": "ui-spoiler-button-title"
50
+ }, u(l.title), 3)
49
51
  ], 2)
50
52
  ], 2),
51
- u(l("div", {
52
- class: t(e.$style.spoiler)
53
+ _(o("div", {
54
+ class: e(t.$style.spoiler),
55
+ "data-test": "ui-spoiler"
53
56
  }, [
54
- m(e.$slots, "default")
57
+ m(t.$slots, "default")
55
58
  ], 2), [
56
- [h, o.modelValue]
59
+ [h, l.modelValue]
57
60
  ])
58
61
  ], 2));
59
62
  }