mhz-ui 1.2.52 → 1.2.53

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 +1 @@
1
- ._backdrop_q8qi7_1{position:fixed;inset:0;z-index:998;display:flex;align-items:center;justify-content:center;background-color:var(--color-gray-transparent)}._dialog_q8qi7_11{z-index:999;padding:0;outline:none;background-color:var(--color-white);border:none;border-radius:16px}._dialog_q8qi7_11 *{outline:none}._modal_q8qi7_23{display:flex;flex-direction:column;gap:12px;width:var(--b2e7c0fe);max-width:100%;height:auto;padding:24px;box-shadow:0 0 16px 0 var(--color-gray-transparent)}._modal_q8qi7_23[data-scrollable=true]{max-height:64dvh;overflow-y:auto}._header_q8qi7_38{display:flex;justify-content:flex-end}._buttons_q8qi7_43{display:flex;gap:16px}.dark ._modal_q8qi7_23{background-color:var(--color-black);box-shadow:0 0 16px 0 var(--color-black-transparent)}.dark ._slot_q8qi7_52{color:var(--color-white)}
1
+ ._backdrop_jn54y_1{position:fixed;inset:0;z-index:998;display:flex;align-items:center;justify-content:center;background-color:var(--color-gray-transparent)}._dialog_jn54y_11{z-index:999;padding:0;outline:none;background-color:var(--color-white);border:none;border-radius:16px}._modal_jn54y_20{display:flex;flex-direction:column;gap:12px;width:var(--v1c45205f);max-width:100%;height:auto;padding:24px;outline:none;box-shadow:0 0 16px 0 var(--color-gray-transparent)}._modal_jn54y_20[data-scrollable=true]{max-height:64dvh;overflow-y:auto}._header_jn54y_36{display:flex;justify-content:flex-end}._buttons_jn54y_41{display:flex;gap:16px}.dark ._modal_jn54y_20{background-color:var(--color-black);box-shadow:0 0 16px 0 var(--color-black-transparent)}.dark ._slot_jn54y_50{color:var(--color-white)}
@@ -1,10 +1,10 @@
1
1
  import "./UiModal.css";
2
- import { defineComponent as v, useCssVars as V, computed as $, ref as w, onMounted as B, watch as S, createBlock as E, openBlock as n, Teleport as N, createElementBlock as c, createCommentVNode as u, normalizeClass as l, createElementVNode as a, mergeProps as U, withModifiers as m, createVNode as i, renderSlot as T, withCtx as f, createTextVNode as p, toDisplayString as _, unref as y, nextTick as A } from "vue";
2
+ import { defineComponent as V, useCssVars as $, computed as w, ref as B, onMounted as S, watch as j, createBlock as E, openBlock as n, Teleport as N, createElementBlock as c, createCommentVNode as u, normalizeClass as l, createElementVNode as a, mergeProps as U, withModifiers as m, createVNode as d, renderSlot as T, withCtx as f, createTextVNode as p, toDisplayString as _, unref as y, nextTick as A } from "vue";
3
3
  import g from "../UiButton/UiButton.js";
4
4
  import D from "../UiClose/UiClose.js";
5
- import { M as b } from "../index-DajWja1y.js";
5
+ import { M as h } from "../index-DajWja1y.js";
6
6
  import { _ as R } from "../_plugin-vue_export-helper-CHgC5LLL.js";
7
- const z = ["data-scrollable"], G = /* @__PURE__ */ v({
7
+ const z = ["data-scrollable"], G = /* @__PURE__ */ V({
8
8
  inheritAttrs: !1,
9
9
  __name: "UiModal",
10
10
  props: {
@@ -15,31 +15,31 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
15
15
  lang: { default: "ru" }
16
16
  },
17
17
  emits: ["update:modelValue", "confirm"],
18
- setup(h, { emit: k }) {
19
- V((e) => ({
20
- b2e7c0fe: C.value
18
+ setup(k, { emit: C }) {
19
+ $((e) => ({
20
+ v1c45205f: b.value
21
21
  }));
22
- const o = h, d = k, C = $(() => `${o.width}px`), s = w(null);
23
- function q() {
22
+ const o = k, r = C, b = w(() => `${o.width}px`), s = B(null);
23
+ function v() {
24
24
  A(() => {
25
25
  s.value?.open ? s.value.close() : s.value?.showModal();
26
26
  });
27
27
  }
28
28
  function M() {
29
- d("confirm"), t();
29
+ r("confirm"), t();
30
30
  }
31
31
  function t() {
32
- d("update:modelValue", !1);
32
+ r("update:modelValue", !1);
33
33
  }
34
- return B(() => {
35
- S(
34
+ return S(() => {
35
+ j(
36
36
  () => o.modelValue,
37
37
  () => {
38
- q();
38
+ v();
39
39
  },
40
40
  { immediate: !0 }
41
41
  );
42
- }), (e, r) => (n(), E(N, { to: "body" }, [
42
+ }), (e, i) => (n(), E(N, { to: "body" }, [
43
43
  o.modelValue ? (n(), c("div", {
44
44
  key: 0,
45
45
  class: l(e.$style.backdrop),
@@ -53,14 +53,14 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
53
53
  }, e.$attrs), [
54
54
  a("div", {
55
55
  class: l(e.$style.modal),
56
- onMousedown: r[0] || (r[0] = m(() => {
56
+ onMousedown: i[0] || (i[0] = m(() => {
57
57
  }, ["stop"])),
58
58
  "data-scrollable": o.isScrollable
59
59
  }, [
60
60
  a("div", {
61
61
  class: l(e.$style.header)
62
62
  }, [
63
- i(D, { onClick: t })
63
+ d(D, { onClick: t })
64
64
  ], 2),
65
65
  a("div", {
66
66
  class: l(e.$style.slot)
@@ -71,18 +71,18 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
71
71
  key: 0,
72
72
  class: l(e.$style.buttons)
73
73
  }, [
74
- i(g, { onClick: M }, {
74
+ d(g, { onClick: M }, {
75
75
  default: f(() => [
76
- p(_(y(b)[o.lang].confirm), 1)
76
+ p(_(y(h)[o.lang].confirm), 1)
77
77
  ]),
78
78
  _: 1
79
79
  }),
80
- i(g, {
80
+ d(g, {
81
81
  layout: "secondary",
82
82
  onClick: t
83
83
  }, {
84
84
  default: f(() => [
85
- p(_(y(b)[o.lang].cancel), 1)
85
+ p(_(y(h)[o.lang].cancel), 1)
86
86
  ]),
87
87
  _: 1
88
88
  })
@@ -92,9 +92,9 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
92
92
  ], 34)) : u("", !0)
93
93
  ]));
94
94
  }
95
- }), P = "_backdrop_q8qi7_1", j = "_dialog_q8qi7_11", x = "_modal_q8qi7_23", F = "_header_q8qi7_38", H = "_buttons_q8qi7_43", I = "_slot_q8qi7_52", J = {
95
+ }), P = "_backdrop_jn54y_1", q = "_dialog_jn54y_11", x = "_modal_jn54y_20", F = "_header_jn54y_36", H = "_buttons_jn54y_41", I = "_slot_jn54y_50", J = {
96
96
  backdrop: P,
97
- dialog: j,
97
+ dialog: q,
98
98
  modal: x,
99
99
  header: F,
100
100
  buttons: H,
@@ -1,18 +1,18 @@
1
1
  import "./UiSelect.css";
2
- import { createElementBlock as l, openBlock as s, createElementVNode as E, defineComponent as H, ref as a, computed as b, normalizeClass as d, createCommentVNode as F, createVNode as M, unref as p, Fragment as z, renderList as Q, withKeys as m, withModifiers as U, toDisplayString as R } from "vue";
3
- import { o as q } from "../index-CGEFkmQc.js";
4
- import D from "../UiInput/UiInput.js";
2
+ import { createElementBlock as l, openBlock as s, createElementVNode as B, defineComponent as W, ref as u, computed as b, normalizeClass as p, createCommentVNode as F, createVNode as M, unref as m, Fragment as X, renderList as Y, withKeys as f, withModifiers as D, toDisplayString as T } from "vue";
3
+ import { o as Z } from "../index-CGEFkmQc.js";
4
+ import N from "../UiInput/UiInput.js";
5
5
  import { M as O } from "../index-DajWja1y.js";
6
- import { _ as J } from "../_plugin-vue_export-helper-CHgC5LLL.js";
7
- const W = {
6
+ import { _ as x } from "../_plugin-vue_export-helper-CHgC5LLL.js";
7
+ const ee = {
8
8
  xmlns: "http://www.w3.org/2000/svg",
9
9
  width: "16",
10
10
  height: "16",
11
11
  fill: "none"
12
12
  };
13
- function X(h, i) {
14
- return s(), l("svg", W, [...i[0] || (i[0] = [
15
- E("path", {
13
+ function te(h, i) {
14
+ return s(), l("svg", ee, [...i[0] || (i[0] = [
15
+ B("path", {
16
16
  stroke: "#1F1F1F",
17
17
  "stroke-linecap": "round",
18
18
  "stroke-linejoin": "round",
@@ -20,15 +20,15 @@ function X(h, i) {
20
20
  }, null, -1)
21
21
  ])]);
22
22
  }
23
- const Y = { render: X }, Z = {
23
+ const oe = { render: te }, ne = {
24
24
  xmlns: "http://www.w3.org/2000/svg",
25
25
  width: "16",
26
26
  height: "16",
27
27
  fill: "none"
28
28
  };
29
- function x(h, i) {
30
- return s(), l("svg", Z, [...i[0] || (i[0] = [
31
- E("path", {
29
+ function le(h, i) {
30
+ return s(), l("svg", ne, [...i[0] || (i[0] = [
31
+ B("path", {
32
32
  stroke: "#1F1F1F",
33
33
  "stroke-linecap": "round",
34
34
  "stroke-linejoin": "round",
@@ -36,7 +36,7 @@ function x(h, i) {
36
36
  }, null, -1)
37
37
  ])]);
38
38
  }
39
- const ee = { render: x }, te = { key: 0 }, oe = ["onClick", "onKeydown", "onMouseenter", "data-current"], ne = /* @__PURE__ */ H({
39
+ const se = { render: le }, ie = { key: 0 }, re = ["onClick", "onKeydown", "onMouseenter", "data-current"], j = 232, ae = /* @__PURE__ */ W({
40
40
  __name: "UiSelect",
41
41
  props: {
42
42
  modelValue: { default: void 0 },
@@ -49,123 +49,128 @@ const ee = { render: x }, te = { key: 0 }, oe = ["onClick", "onKeydown", "onMous
49
49
  },
50
50
  emits: ["update:modelValue", "reachedBottom"],
51
51
  setup(h, { emit: i }) {
52
- const t = h, k = i, f = a(""), u = a(!1), V = a(!1), v = a(), r = a(), _ = a(), B = a([]), $ = b(() => {
52
+ const t = h, k = i, v = u(""), c = u(!1), V = u(!1), d = u(), r = u(), g = u(), E = u([]), $ = b(() => {
53
53
  const e = t.options?.[0];
54
54
  return e != null && typeof e == "object";
55
- }), S = (e) => e !== null && (typeof e == "string" || typeof e == "number"), w = b(() => {
55
+ }), I = (e) => e !== null && (typeof e == "string" || typeof e == "number"), w = b(() => {
56
56
  if (!t.options?.length) return [];
57
57
  const e = $.value ? [...t.options] : t.options.map((o) => ({ _id: String(o), title: String(o) }));
58
- return t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(f.value.toLowerCase())) : e;
59
- }), T = b(() => {
60
- if (S(t.modelValue)) return t.modelValue;
58
+ return t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(v.value.toLowerCase())) : e;
59
+ }), A = b(() => {
60
+ if (I(t.modelValue)) return t.modelValue;
61
61
  if (!t.modelValue) return "";
62
62
  const e = t.modelValue;
63
63
  return t.isLocaleField ? e.title_en ?? "" : e.title ?? "";
64
- }), N = (e, o) => `${e._id || e.title}-${o}`, j = (e) => t.isLocaleField ? e.title_en : e.title, A = (e) => S(t.modelValue) ? t.modelValue === (e._id || e.title) : t.modelValue ? t.modelValue._id === e._id : !1, g = (e) => {
65
- e < 0 || e >= w.value.length || t.isFilter || B.value[e]?.focus();
66
- }, K = () => k("update:modelValue", void 0), L = () => {
67
- u.value ? y() : G();
68
- }, P = () => {
69
- if (!v.value) return !1;
70
- const e = 232, o = v.value.getBoundingClientRect(), n = window.innerHeight - o.bottom, c = o.top;
71
- return n < e && c > n;
64
+ }), H = (e, o) => `${e._id || e.title}-${o}`, K = (e) => t.isLocaleField ? e.title_en : e.title, P = (e) => I(t.modelValue) ? t.modelValue === (e._id || e.title) : t.modelValue ? t.modelValue._id === e._id : !1, _ = (e) => {
65
+ e < 0 || e >= w.value.length || t.isFilter || E.value[e]?.focus();
66
+ }, G = () => k("update:modelValue", void 0), S = () => {
67
+ c.value ? y() : Q();
68
+ }, z = () => {
69
+ if (!d.value) return !1;
70
+ const e = d.value.closest("dialog");
71
+ if (!e) {
72
+ const R = d.value.getBoundingClientRect(), U = window.innerHeight - R.bottom, J = R.top;
73
+ return U < j && J > U;
74
+ }
75
+ const o = e.getBoundingClientRect(), n = d.value.getBoundingClientRect(), a = o.bottom - n.bottom, q = n.top - o.top;
76
+ return a < j && q > a;
72
77
  };
73
78
  function y() {
74
- r.value?.removeEventListener("scroll", I, !0), f.value = "", u.value = !1, V.value = !1;
79
+ r.value?.removeEventListener("scroll", L, !0), v.value = "", c.value = !1, V.value = !1;
75
80
  }
76
- function G() {
77
- t.isDisabled || (V.value = P(), u.value = !0, t.isFilter || setTimeout(() => {
78
- r.value?.scrollTo(0, 0), g(0), r.value?.addEventListener("scroll", I, !0);
81
+ function Q() {
82
+ t.isDisabled || (V.value = z(), c.value = !0, t.isFilter || setTimeout(() => {
83
+ r.value?.scrollTo(0, 0), _(0), r.value?.addEventListener("scroll", L, !0);
79
84
  }, 100));
80
85
  }
81
86
  function C(e) {
82
87
  const o = $.value ? e : e._id || e.title;
83
88
  k("update:modelValue", o), y();
84
89
  }
85
- function I() {
86
- if (!r.value || !_.value) return;
87
- r.value.getBoundingClientRect().y - _.value.getBoundingClientRect().y - _.value.scrollHeight + r.value.getBoundingClientRect().height > -100 && k("reachedBottom");
90
+ function L() {
91
+ if (!r.value || !g.value) return;
92
+ r.value.getBoundingClientRect().y - g.value.getBoundingClientRect().y - g.value.scrollHeight + r.value.getBoundingClientRect().height > -100 && k("reachedBottom");
88
93
  }
89
- return q(v, y), (e, o) => (s(), l("div", {
90
- class: d(e.$style.container),
94
+ return Z(d, y), (e, o) => (s(), l("div", {
95
+ class: p(e.$style.container),
91
96
  ref_key: "containerElement",
92
- ref: v
97
+ ref: d
93
98
  }, [
94
- E("div", {
95
- class: d(e.$style.input)
99
+ B("div", {
100
+ class: p(e.$style.input)
96
101
  }, [
97
- M(D, {
98
- modelValue: T.value,
102
+ M(N, {
103
+ modelValue: A.value,
99
104
  disabled: t.isDisabled,
100
- onToggle: L,
105
+ onToggle: S,
101
106
  mode: "select",
102
- placeholder: p(O)[t.lang].choose,
103
- appendIcon: u.value ? p(ee) : p(Y)
107
+ placeholder: m(O)[t.lang].choose,
108
+ appendIcon: c.value ? m(se) : m(oe)
104
109
  }, null, 8, ["modelValue", "disabled", "placeholder", "appendIcon"]),
105
- t.isFilter && u.value ? (s(), l("div", te, [
106
- M(D, {
107
- modelValue: f.value,
108
- "onUpdate:modelValue": o[0] || (o[0] = (n) => f.value = n),
110
+ t.isFilter && c.value ? (s(), l("div", ie, [
111
+ M(N, {
112
+ modelValue: v.value,
113
+ "onUpdate:modelValue": o[0] || (o[0] = (n) => v.value = n),
109
114
  disabled: t.isDisabled,
110
- placeholder: p(O)[t.lang].filter,
115
+ placeholder: m(O)[t.lang].filter,
111
116
  isFocus: ""
112
117
  }, null, 8, ["modelValue", "disabled", "placeholder"])
113
118
  ])) : F("", !0),
114
119
  t.isClearable && t.modelValue ? (s(), l("button", {
115
120
  key: 1,
116
- onClick: K,
121
+ onClick: G,
117
122
  type: "button",
118
- class: d(e.$style.clear)
123
+ class: p(e.$style.clear)
119
124
  }, " × ", 2)) : F("", !0)
120
125
  ], 2),
121
- u.value ? (s(), l("div", {
126
+ c.value ? (s(), l("div", {
122
127
  key: 0,
123
- class: d([e.$style.options, { [e.$style.optionsUp]: V.value }]),
128
+ class: p([e.$style.options, { [e.$style.optionsUp]: V.value }]),
124
129
  ref_key: "optionsElement",
125
130
  ref: r
126
131
  }, [
127
132
  w.value.length > 0 ? (s(), l("div", {
128
133
  key: 0,
129
134
  ref_key: "optionsInnerElement",
130
- ref: _
135
+ ref: g
131
136
  }, [
132
- (s(!0), l(z, null, Q(w.value, (n, c) => (s(), l("div", {
133
- key: N(n, c),
137
+ (s(!0), l(X, null, Y(w.value, (n, a) => (s(), l("div", {
138
+ key: H(n, a),
134
139
  onClick: () => C(n),
135
140
  onKeydown: [
136
- m(() => C(n), ["enter"]),
137
- m(() => C(n), ["space"]),
138
- m(U(() => g(c - 1), ["prevent"]), ["up"]),
139
- m(U(() => g(c + 1), ["prevent"]), ["down"]),
140
- m(L, ["esc"])
141
+ f(() => C(n), ["enter"]),
142
+ f(() => C(n), ["space"]),
143
+ f(D(() => _(a - 1), ["prevent"]), ["up"]),
144
+ f(D(() => _(a + 1), ["prevent"]), ["down"]),
145
+ f(S, ["esc"])
141
146
  ],
142
- onMouseenter: () => g(c),
143
- class: d(e.$style.option),
147
+ onMouseenter: () => _(a),
148
+ class: p(e.$style.option),
144
149
  tabindex: "0",
145
150
  ref_for: !0,
146
151
  ref_key: "optionElement",
147
- ref: B,
148
- "data-current": A(n)
149
- }, R(j(n)), 43, oe))), 128))
152
+ ref: E,
153
+ "data-current": P(n)
154
+ }, T(K(n)), 43, re))), 128))
150
155
  ], 512)) : (s(), l("div", {
151
156
  key: 1,
152
157
  onClick: y,
153
- class: d(e.$style.option),
158
+ class: p(e.$style.option),
154
159
  tabindex: "0"
155
- }, R(p(O)[t.lang].noResults), 3))
160
+ }, T(m(O)[t.lang].noResults), 3))
156
161
  ], 2)) : F("", !0)
157
162
  ], 2));
158
163
  }
159
- }), le = "_container_1m448_1", se = "_input_1m448_10", ie = "_clear_1m448_16", re = "_options_1m448_31", ae = "_optionsUp_1m448_44", ue = "_option_1m448_31", ce = {
160
- container: le,
161
- input: se,
162
- clear: ie,
163
- options: re,
164
- optionsUp: ae,
165
- option: ue
166
- }, de = {
167
- $style: ce
168
- }, ge = /* @__PURE__ */ J(ne, [["__cssModules", de]]);
164
+ }), ue = "_container_1m448_1", ce = "_input_1m448_10", de = "_clear_1m448_16", pe = "_options_1m448_31", me = "_optionsUp_1m448_44", fe = "_option_1m448_31", ve = {
165
+ container: ue,
166
+ input: ce,
167
+ clear: de,
168
+ options: pe,
169
+ optionsUp: me,
170
+ option: fe
171
+ }, ge = {
172
+ $style: ve
173
+ }, we = /* @__PURE__ */ x(ae, [["__cssModules", ge]]);
169
174
  export {
170
- ge as default
175
+ we as default
171
176
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mhz-ui",
3
3
  "description": "Mhz ui kit",
4
- "version": "1.2.52",
4
+ "version": "1.2.53",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",