mhz-ui 1.0.5 → 1.0.7

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
- ._inputBlock_1boy2_1{position:relative;display:flex;width:100%;border-radius:16px}._inputBlock_1boy2_1[data-mode=select]{cursor:pointer}._inputBlock_1boy2_1[data-mode=select]:hover ._input_1boy2_1{border:1px solid var(--color-gray-dark-extra)}._input_1boy2_1{width:100%;height:40px;padding:0 16px;font-size:1rem;border:1px solid var(--color-gray);border-radius:16px;outline:none}._input_1boy2_1:hover{border:1px solid var(--color-gray-dark-extra)}._input_1boy2_1:focus{border:1px solid var(--color-primary)}._input_1boy2_1:disabled{color:var(--color-gray-dark-extra);background:var(--color-gray-light-extra);border-color:var(--color-transparent)}._input_1boy2_1::placeholder{color:var(--color-gray-dark-extra)}._input_1boy2_1[data-mode=select]{pointer-events:none}._input_1boy2_1[data-append-icon=true]{padding-right:40px}._icon_1boy2_44{position:absolute;top:calc(50% - 8px);right:16px}
1
+ ._inputBlock_h3kt9_1{position:relative;display:flex;width:100%;border-radius:16px}._inputBlock_h3kt9_1[data-mode=select]{cursor:pointer}._inputBlock_h3kt9_1[data-mode=select]:hover ._input_h3kt9_1{border:1px solid var(--color-gray-dark-extra)}._input_h3kt9_1{width:100%;height:40px;padding:0 16px;font-size:1rem;border:1px solid var(--color-gray);border-radius:16px;outline:none}._input_h3kt9_1:hover{border:1px solid var(--color-gray-dark-extra)}._input_h3kt9_1:focus{border:1px solid var(--color-primary)}._input_h3kt9_1:disabled{color:var(--color-gray-dark-extra);background:var(--color-gray-light-extra);border-color:var(--color-transparent)}._input_h3kt9_1::placeholder{color:var(--color-gray-dark-extra)}._input_h3kt9_1[data-mode=select]{pointer-events:none}._input_h3kt9_1[data-append-icon=true]{padding-right:40px}._input_h3kt9_1[data-center=true]{text-align:center}._icon_h3kt9_47{position:absolute;top:calc(50% - 8px);right:16px}
@@ -8,7 +8,7 @@ declare const _default: import("vue").DefineComponent<{
8
8
  default: string;
9
9
  };
10
10
  mode: {
11
- type: import("vue").PropType<"default" | "select" | "multiselect">;
11
+ type: import("vue").PropType<"default" | "select">;
12
12
  default: string;
13
13
  };
14
14
  appendIcon: {
@@ -18,6 +18,9 @@ declare const _default: import("vue").DefineComponent<{
18
18
  isFocus: {
19
19
  type: import("vue").PropType<boolean>;
20
20
  };
21
+ isCenter: {
22
+ type: import("vue").PropType<boolean>;
23
+ };
21
24
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "toggle")[], "update:modelValue" | "toggle", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
25
  isDisabled: {
23
26
  type: import("vue").PropType<boolean>;
@@ -27,7 +30,7 @@ declare const _default: import("vue").DefineComponent<{
27
30
  default: string;
28
31
  };
29
32
  mode: {
30
- type: import("vue").PropType<"default" | "select" | "multiselect">;
33
+ type: import("vue").PropType<"default" | "select">;
31
34
  default: string;
32
35
  };
33
36
  appendIcon: {
@@ -37,12 +40,15 @@ declare const _default: import("vue").DefineComponent<{
37
40
  isFocus: {
38
41
  type: import("vue").PropType<boolean>;
39
42
  };
43
+ isCenter: {
44
+ type: import("vue").PropType<boolean>;
45
+ };
40
46
  }>> & {
41
47
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
42
48
  onToggle?: ((...args: any[]) => any) | undefined;
43
49
  }, {
44
50
  modelValue: string | number | boolean | null;
45
- mode: "default" | "select" | "multiselect";
51
+ mode: "default" | "select";
46
52
  appendIcon: FunctionalComponent<{}, {}, any>;
47
53
  }, {}>;
48
54
  export default _default;
@@ -1,56 +1,58 @@
1
1
  import "./UiInput.css";
2
- import { defineComponent as p, ref as c, onMounted as m, nextTick as r, openBlock as s, createElementBlock as f, withKeys as y, normalizeClass as d, createElementVNode as _, mergeProps as b, createBlock as k, resolveDynamicComponent as B, createCommentVNode as g } from "vue";
2
+ import { defineComponent as u, ref as c, onMounted as r, nextTick as m, openBlock as s, createElementBlock as f, withKeys as y, normalizeClass as d, createElementVNode as _, mergeProps as k, createBlock as B, resolveDynamicComponent as b, createCommentVNode as g } from "vue";
3
3
  import { _ as v } from "../_plugin-vue_export-helper-dad06003.js";
4
- const I = ["data-mode", "tabindex"], $ = ["value", "disabled", "data-mode", "data-append-icon", "tabindex"], V = /* @__PURE__ */ p({
4
+ const I = ["data-mode", "tabindex"], C = ["value", "disabled", "data-mode", "data-center", "data-append-icon", "tabindex"], $ = /* @__PURE__ */ u({
5
5
  __name: "UiInput",
6
6
  props: {
7
7
  modelValue: { type: [String, Number, Boolean, null], default: "" },
8
8
  isDisabled: { type: Boolean },
9
9
  mode: { default: "default" },
10
10
  appendIcon: { type: [Function, Object], default: void 0 },
11
- isFocus: { type: Boolean }
11
+ isFocus: { type: Boolean },
12
+ isCenter: { type: Boolean }
12
13
  },
13
14
  emits: ["update:modelValue", "toggle"],
14
- setup(i, { emit: n }) {
15
+ setup(i, { emit: o }) {
15
16
  const e = i;
16
- function u(o) {
17
- n("update:modelValue", o.value);
17
+ function p(t) {
18
+ o("update:modelValue", t.value);
18
19
  }
19
20
  const l = c();
20
- return m(async () => {
21
- e.isFocus && (await r(), l.value?.focus());
22
- }), (o, t) => (s(), f("div", {
23
- onClick: t[1] || (t[1] = (a) => n("toggle")),
24
- onKeydown: t[2] || (t[2] = y((a) => n("toggle"), ["space"])),
25
- class: d(o.$style.inputBlock),
21
+ return r(async () => {
22
+ e.isFocus && (await m(), l.value?.focus());
23
+ }), (t, n) => (s(), f("div", {
24
+ onClick: n[1] || (n[1] = (a) => o("toggle")),
25
+ onKeydown: n[2] || (n[2] = y((a) => o("toggle"), ["space"])),
26
+ class: d(t.$style.inputBlock),
26
27
  "data-mode": e.mode,
27
28
  tabindex: e.mode === "default" ? "-1" : "0"
28
29
  }, [
29
- _("input", b({
30
+ _("input", k({
30
31
  value: e.modelValue,
31
- onInput: t[0] || (t[0] = (a) => u(a.target)),
32
+ onInput: n[0] || (n[0] = (a) => p(a.target)),
32
33
  disabled: e.isDisabled,
33
- class: o.$style.input
34
- }, o.$attrs, {
34
+ class: t.$style.input
35
+ }, t.$attrs, {
35
36
  ref_key: "input",
36
37
  ref: l,
37
38
  "data-mode": e.mode,
39
+ "data-center": e.isCenter,
38
40
  "data-append-icon": !!e.appendIcon,
39
41
  tabindex: e.mode === "default" ? "0" : "-1"
40
- }), null, 16, $),
41
- e.appendIcon ? (s(), k(B(e.appendIcon), {
42
+ }), null, 16, C),
43
+ e.appendIcon ? (s(), B(b(e.appendIcon), {
42
44
  key: 0,
43
- class: d(o.$style.icon)
45
+ class: d(t.$style.icon)
44
46
  }, null, 8, ["class"])) : g("", !0)
45
47
  ], 42, I));
46
48
  }
47
- }), C = "_inputBlock_1boy2_1", x = "_input_1boy2_1", w = "_icon_1boy2_44", D = {
48
- inputBlock: C,
49
+ }), V = "_inputBlock_h3kt9_1", x = "_input_h3kt9_1", w = "_icon_h3kt9_47", D = {
50
+ inputBlock: V,
49
51
  input: x,
50
52
  icon: w
51
53
  }, F = {
52
54
  $style: D
53
- }, E = /* @__PURE__ */ v(V, [["__cssModules", F]]);
55
+ }, h = /* @__PURE__ */ v($, [["__cssModules", F]]);
54
56
  export {
55
- E as default
57
+ h as default
56
58
  };
@@ -0,0 +1 @@
1
+ ._container_rimgb_1{position:relative;width:320px}._results_rimgb_6{position:absolute;z-index:2;display:flex;flex-direction:column;gap:8px;width:100%;max-height:320px;padding:16px;margin-top:8px;overflow-y:auto;background-color:var(--color-white);border-radius:16px;box-shadow:0 0 16px -8px var(--color-black-transparent)}._resultsInner_rimgb_22{display:flex;flex-direction:column;gap:4px}._type_rimgb_28{font-weight:700;text-transform:capitalize}._link_rimgb_33{display:flex;gap:4px;text-decoration:none}
@@ -0,0 +1,56 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: {
3
+ type: import("vue").PropType<string>;
4
+ required: true;
5
+ };
6
+ searchScheme: {
7
+ type: import("vue").PropType<{
8
+ type: string;
9
+ labels: string[];
10
+ url: string;
11
+ }[]>;
12
+ required: true;
13
+ };
14
+ results: {
15
+ type: import("vue").PropType<{
16
+ [key: string]: {
17
+ _id?: string | undefined;
18
+ }[] | {
19
+ [key: string]: string;
20
+ }[];
21
+ }>;
22
+ };
23
+ isSuccess: {
24
+ type: import("vue").PropType<boolean>;
25
+ required: true;
26
+ };
27
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
+ modelValue: {
29
+ type: import("vue").PropType<string>;
30
+ required: true;
31
+ };
32
+ searchScheme: {
33
+ type: import("vue").PropType<{
34
+ type: string;
35
+ labels: string[];
36
+ url: string;
37
+ }[]>;
38
+ required: true;
39
+ };
40
+ results: {
41
+ type: import("vue").PropType<{
42
+ [key: string]: {
43
+ _id?: string | undefined;
44
+ }[] | {
45
+ [key: string]: string;
46
+ }[];
47
+ }>;
48
+ };
49
+ isSuccess: {
50
+ type: import("vue").PropType<boolean>;
51
+ required: true;
52
+ };
53
+ }>> & {
54
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
55
+ }, {}, {}>;
56
+ export default _default;
@@ -0,0 +1,138 @@
1
+ import "./UiSearch.css";
2
+ import { openBlock as n, createElementBlock as l, createElementVNode as E, defineComponent as I, ref as S, computed as C, normalizeClass as g, createVNode as $, unref as N, withKeys as B, Fragment as i, createTextVNode as v, createCommentVNode as h, renderList as V, toDisplayString as b, createBlock as O, resolveDynamicComponent as T, withCtx as U } from "vue";
3
+ import { RouterLink as Z } from "vue-router";
4
+ import { o as L } from "../index-e9b7d99f.js";
5
+ import R from "../UiInput/UiInput.js";
6
+ import { _ as D } from "../_plugin-vue_export-helper-dad06003.js";
7
+ const F = {
8
+ trailing: !0
9
+ };
10
+ function K(d, u = 25, e = {}) {
11
+ if (e = { ...F, ...e }, !Number.isFinite(u))
12
+ throw new TypeError("Expected `wait` to be a finite number");
13
+ let a, c, _ = [], s, m;
14
+ const p = (r, y) => (s = M(d, r, y), s.finally(() => {
15
+ if (s = null, e.trailing && m && !c) {
16
+ const t = p(r, m);
17
+ return m = null, t;
18
+ }
19
+ }), s);
20
+ return function(...r) {
21
+ return s ? (e.trailing && (m = r), s) : new Promise((y) => {
22
+ const t = !c && e.leading;
23
+ clearTimeout(c), c = setTimeout(() => {
24
+ c = null;
25
+ const f = e.leading ? a : p(this, r);
26
+ for (const o of _)
27
+ o(f);
28
+ _ = [];
29
+ }, u), t ? (a = p(this, r), y(a)) : _.push(y);
30
+ });
31
+ };
32
+ }
33
+ async function M(d, u, e) {
34
+ return await d.apply(u, e);
35
+ }
36
+ const P = {
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ width: "16",
39
+ height: "16",
40
+ fill: "none"
41
+ }, A = /* @__PURE__ */ E("path", {
42
+ fill: "#dfdfdf",
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), j = [
45
+ A
46
+ ];
47
+ function x(d, u) {
48
+ return n(), l("svg", P, j);
49
+ }
50
+ const z = { render: x }, Y = /* @__PURE__ */ I({
51
+ __name: "UiSearch",
52
+ props: {
53
+ modelValue: {},
54
+ searchScheme: {},
55
+ results: {},
56
+ isSuccess: { type: Boolean }
57
+ },
58
+ emits: ["update:modelValue"],
59
+ setup(d, { emit: u }) {
60
+ const e = d, a = S(!1), c = K(async (t) => {
61
+ u("update:modelValue", t);
62
+ }, 300);
63
+ async function _(t) {
64
+ await c(t);
65
+ }
66
+ function s() {
67
+ a.value = !1;
68
+ }
69
+ function m() {
70
+ s(), u("update:modelValue", "");
71
+ }
72
+ const p = C(() => e.results ? Object.values(e.results).reduce((t, f) => t + f.length, 0) : !1), r = S();
73
+ L(r, () => {
74
+ s();
75
+ });
76
+ const y = C(() => window.IS_STORYBOOK ? "a" : Z);
77
+ return (t, f) => (n(), l("div", {
78
+ class: g(t.$style.container),
79
+ ref_key: "containerElement",
80
+ ref: r
81
+ }, [
82
+ $(R, {
83
+ modelValue: e.modelValue,
84
+ "onUpdate:modelValue": _,
85
+ appendIcon: N(z),
86
+ placeholder: "Search",
87
+ onClick: f[0] || (f[0] = (o) => a.value = !0),
88
+ onKeyup: B(s, ["esc"])
89
+ }, null, 8, ["modelValue", "appendIcon", "onKeyup"]),
90
+ a.value && e.modelValue.length ? (n(), l("div", {
91
+ key: 0,
92
+ class: g(t.$style.results)
93
+ }, [
94
+ e.modelValue.length < 3 ? (n(), l(i, { key: 0 }, [
95
+ v("Please enter 3 or more symbols")
96
+ ], 64)) : h("", !0),
97
+ e.modelValue.length > 2 && !e.isSuccess ? (n(), l(i, { key: 1 }, [
98
+ v("Loading...")
99
+ ], 64)) : h("", !0),
100
+ e.modelValue.length > 2 && !p.value && e.isSuccess ? (n(), l(i, { key: 2 }, [
101
+ v("No results")
102
+ ], 64)) : h("", !0),
103
+ e.modelValue.length > 2 && p.value ? (n(!0), l(i, { key: 3 }, V(e.searchScheme, (o) => (n(), l("div", {
104
+ key: o.type,
105
+ class: g(t.$style.resultsInner)
106
+ }, [
107
+ t.results?.[o.type]?.length ? (n(), l(i, { key: 0 }, [
108
+ E("div", {
109
+ class: g(t.$style.type)
110
+ }, b(o.type) + ":", 3),
111
+ (n(!0), l(i, null, V(t.results[o.type], (k) => (n(), O(T(y.value), {
112
+ key: k._id,
113
+ to: `${o.url}/${k._id}`,
114
+ onClick: m,
115
+ class: g(t.$style.link)
116
+ }, {
117
+ default: U(() => [
118
+ (n(!0), l(i, null, V(o.labels, (w) => (n(), l("span", { key: w }, b(k[w]), 1))), 128))
119
+ ]),
120
+ _: 2
121
+ }, 1032, ["to", "class"]))), 128))
122
+ ], 64)) : h("", !0)
123
+ ], 2))), 128)) : h("", !0)
124
+ ], 2)) : h("", !0)
125
+ ], 2));
126
+ }
127
+ }), q = "_container_rimgb_1", G = "_results_rimgb_6", H = "_resultsInner_rimgb_22", J = "_type_rimgb_28", Q = "_link_rimgb_33", W = {
128
+ container: q,
129
+ results: G,
130
+ resultsInner: H,
131
+ type: J,
132
+ link: Q
133
+ }, X = {
134
+ $style: W
135
+ }, re = /* @__PURE__ */ D(Y, [["__cssModules", X]]);
136
+ export {
137
+ re as default
138
+ };
@@ -1,120 +1,41 @@
1
1
  import "./UiSelect.css";
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
- import { _ as H } from "../_plugin-vue_export-helper-dad06003.js";
5
- function Q(o) {
6
- return N() ? (R(o), !0) : !1;
7
- }
8
- function P(o) {
9
- return typeof o == "function" ? o() : O(o);
10
- }
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);
16
- }
17
- function C(o) {
18
- var s;
19
- const t = P(o);
20
- return (s = t?.$el) != null ? s : t;
21
- }
22
- const U = M ? window : void 0;
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)))
38
- );
39
- },
40
- { immediate: !0, flush: "post" }
41
- ), k = () => {
42
- _(), d();
43
- };
44
- return Q(k), k;
45
- }
46
- let F = !1;
47
- function Y(o, s, t = {}) {
48
- const { window: r = U, ignore: m = [], capture: c = !0, detectIframe: d = !1 } = t;
49
- if (!r)
50
- return;
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) => {
54
- if (typeof n == "string")
55
- return Array.from(r.document.querySelectorAll(n)).some((u) => u === e.target || e.composedPath().includes(u));
56
- {
57
- const u = C(n);
58
- return u && (e.target === u || e.composedPath().includes(u));
59
- }
60
- }), i = [
61
- b(r, "click", (e) => {
62
- const n = C(o);
63
- if (!(!n || n === e.target || e.composedPath().includes(n))) {
64
- if (e.detail === 0 && (p = !_(e)), !p) {
65
- p = !0;
66
- return;
67
- }
68
- s(e);
69
- }
70
- }, { passive: !0, capture: c }),
71
- b(r, "pointerdown", (e) => {
72
- const n = C(o);
73
- n && (p = !e.composedPath().includes(n) && !_(e));
74
- }, { passive: !0 }),
75
- d && b(r, "blur", (e) => {
76
- setTimeout(() => {
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);
80
- }, 0);
81
- })
82
- ].filter(Boolean);
83
- return () => i.forEach((e) => e());
84
- }
85
- const Z = {
2
+ import { openBlock as l, createElementBlock as s, createElementVNode as B, defineComponent as O, ref as a, computed as U, normalizeClass as p, createVNode as E, unref as b, createCommentVNode as j, Fragment as L, renderList as S, withKeys as m, toDisplayString as M } from "vue";
3
+ import { o as N } from "../index-e9b7d99f.js";
4
+ import F from "../UiInput/UiInput.js";
5
+ import { _ as K } from "../_plugin-vue_export-helper-dad06003.js";
6
+ const R = {
86
7
  xmlns: "http://www.w3.org/2000/svg",
87
8
  width: "15",
88
9
  height: "8",
89
10
  fill: "none"
90
- }, ee = /* @__PURE__ */ B("path", {
11
+ }, T = /* @__PURE__ */ B("path", {
91
12
  stroke: "currentColor",
92
13
  "stroke-linecap": "round",
93
14
  "stroke-linejoin": "round",
94
15
  d: "m.5 1 7.17 6 6.83-6"
95
- }, null, -1), te = [
96
- ee
16
+ }, null, -1), P = [
17
+ T
97
18
  ];
98
- function oe(o, s) {
99
- return h(), y("svg", Z, te);
19
+ function z(y, c) {
20
+ return l(), s("svg", R, P);
100
21
  }
101
- const ne = { render: oe }, re = {
22
+ const D = { render: z }, H = {
102
23
  xmlns: "http://www.w3.org/2000/svg",
103
24
  width: "15",
104
25
  height: "8",
105
26
  fill: "none"
106
- }, le = /* @__PURE__ */ B("path", {
27
+ }, Q = /* @__PURE__ */ B("path", {
107
28
  stroke: "currentColor",
108
29
  "stroke-linecap": "round",
109
30
  "stroke-linejoin": "round",
110
31
  d: "m.5 7 7.17-6 6.83 6"
111
- }, null, -1), se = [
112
- le
32
+ }, null, -1), q = [
33
+ Q
113
34
  ];
114
- function ie(o, s) {
115
- return h(), y("svg", re, se);
35
+ function x(y, c) {
36
+ return l(), s("svg", H, q);
116
37
  }
117
- const ue = { render: ie }, ce = ["onClick", "onKeydown", "onMouseenter", "data-current"], ae = /* @__PURE__ */ D({
38
+ const A = { render: x }, G = ["onClick", "onKeydown", "onMouseenter", "data-current"], J = /* @__PURE__ */ O({
118
39
  __name: "UiSelect",
119
40
  props: {
120
41
  modelValue: {},
@@ -122,108 +43,108 @@ const ue = { render: ie }, ce = ["onClick", "onKeydown", "onMouseenter", "data-c
122
43
  isFilter: { type: Boolean }
123
44
  },
124
45
  emits: ["update:modelValue", "reachedBottom"],
125
- setup(o, { emit: s }) {
126
- const t = o, r = w(""), m = K(() => {
46
+ setup(y, { emit: c }) {
47
+ const t = y, f = a(""), g = U(() => {
127
48
  if (!t.options)
128
49
  return [];
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);
50
+ let e = t.options;
51
+ return typeof t.options[0] != "object" && (e = t.options.map((o) => ({ _id: o, title: o }))), t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(f.value.toLowerCase())) : e;
52
+ }), r = a(!1), i = a(), v = a(), $ = a([]);
53
+ function I(e) {
54
+ c("update:modelValue", e);
134
55
  }
135
- function i(l) {
136
- l < 0 || l === m.value.length || t.isFilter || _.value[l]?.focus();
56
+ function _(e) {
57
+ e < 0 || e === g.value.length || t.isFilter || $.value[e]?.focus();
137
58
  }
138
- function a() {
139
- d.value?.removeEventListener("scroll", u, !0), r.value = "", c.value = !1;
59
+ function d() {
60
+ i.value?.removeEventListener("scroll", V, !0), f.value = "", r.value = !1;
140
61
  }
141
- function e() {
142
- c.value = !0, t.isFilter || setTimeout(() => {
143
- d.value?.scrollTo(0, 0), i(0), d.value?.addEventListener("scroll", u, !0);
62
+ function w() {
63
+ r.value = !0, t.isFilter || setTimeout(() => {
64
+ i.value?.scrollTo(0, 0), _(0), i.value?.addEventListener("scroll", V, !0);
144
65
  }, 100);
145
66
  }
146
- function n(l) {
147
- s("update:modelValue", typeof t.modelValue == "object" ? l : l._id), a();
67
+ function k(e) {
68
+ c("update:modelValue", typeof t.modelValue == "object" ? e : e._id), d();
148
69
  }
149
- function u() {
150
- if (!d.value || !p.value)
70
+ function V() {
71
+ if (!i.value || !v.value)
151
72
  return;
152
- d.value.getBoundingClientRect().y - p.value.getBoundingClientRect().y - p.value.scrollHeight + d.value.getBoundingClientRect().height > -100 && s("reachedBottom");
73
+ i.value.getBoundingClientRect().y - v.value.getBoundingClientRect().y - v.value.scrollHeight + i.value.getBoundingClientRect().height > -100 && c("reachedBottom");
153
74
  }
154
- const I = w();
155
- return Y(I, () => {
156
- a();
157
- }), (l, f) => (h(), y("div", {
158
- class: E(l.$style.container),
75
+ const C = a();
76
+ return N(C, () => {
77
+ d();
78
+ }), (e, o) => (l(), s("div", {
79
+ class: p(e.$style.container),
159
80
  ref_key: "containerElement",
160
- ref: I
81
+ ref: C
161
82
  }, [
162
- S(L, {
83
+ E(F, {
163
84
  modelValue: typeof t.modelValue == "object" ? t.modelValue.title : t.modelValue,
164
- onUpdate: k,
165
- onToggle: f[0] || (f[0] = (v) => c.value ? a() : e()),
85
+ onUpdate: I,
86
+ onToggle: o[0] || (o[0] = (n) => r.value ? d() : w()),
166
87
  mode: "select",
167
88
  placeholder: "Choose variant",
168
- appendIcon: c.value ? O(ue) : O(ne)
89
+ appendIcon: r.value ? b(A) : b(D)
169
90
  }, null, 8, ["modelValue", "appendIcon"]),
170
- t.isFilter && c.value ? (h(), y("div", {
91
+ t.isFilter && r.value ? (l(), s("div", {
171
92
  key: 0,
172
- class: E(l.$style.filter)
93
+ class: p(e.$style.filter)
173
94
  }, [
174
- S(L, {
175
- modelValue: r.value,
176
- "onUpdate:modelValue": f[1] || (f[1] = (v) => r.value = v),
95
+ E(F, {
96
+ modelValue: f.value,
97
+ "onUpdate:modelValue": o[1] || (o[1] = (n) => f.value = n),
177
98
  placeholder: "Filter Variants",
178
99
  isFocus: ""
179
100
  }, null, 8, ["modelValue"])
180
- ], 2)) : A("", !0),
181
- c.value ? (h(), y("div", {
101
+ ], 2)) : j("", !0),
102
+ r.value ? (l(), s("div", {
182
103
  key: 1,
183
- class: E(l.$style.options),
104
+ class: p(e.$style.options),
184
105
  ref_key: "optionsElement",
185
- ref: d
106
+ ref: i
186
107
  }, [
187
- m.value.length ? (h(), y("div", {
108
+ g.value.length ? (l(), s("div", {
188
109
  key: 0,
189
110
  ref_key: "optionsInnerElement",
190
- ref: p
111
+ ref: v
191
112
  }, [
192
- (h(!0), y(W, null, q(m.value, (v, V) => (h(), y("div", {
193
- key: `${v}-${V}`,
194
- onClick: (g) => n(v),
113
+ (l(!0), s(L, null, S(g.value, (n, h) => (l(), s("div", {
114
+ key: `${n}-${h}`,
115
+ onClick: (u) => k(n),
195
116
  onKeydown: [
196
- $((g) => n(v), ["enter"]),
197
- $((g) => n(v), ["space"]),
198
- $((g) => i(V - 1), ["up"]),
199
- $((g) => i(V + 1), ["down"]),
200
- f[2] || (f[2] = $((g) => c.value ? a() : e(), ["esc"]))
117
+ m((u) => k(n), ["enter"]),
118
+ m((u) => k(n), ["space"]),
119
+ m((u) => _(h - 1), ["up"]),
120
+ m((u) => _(h + 1), ["down"]),
121
+ o[2] || (o[2] = m((u) => r.value ? d() : w(), ["esc"]))
201
122
  ],
202
- onMouseenter: (g) => i(V),
203
- class: E(l.$style.option),
123
+ onMouseenter: (u) => _(h),
124
+ class: p(e.$style.option),
204
125
  tabindex: "0",
205
126
  ref_for: !0,
206
127
  ref_key: "optionElement",
207
- ref: _,
208
- "data-current": t.modelValue === v._id
209
- }, z(v.title), 43, ce))), 128))
210
- ], 512)) : (h(), y("div", {
128
+ ref: $,
129
+ "data-current": t.modelValue === n._id
130
+ }, M(n.title), 43, G))), 128))
131
+ ], 512)) : (l(), s("div", {
211
132
  key: 1,
212
- onClick: a,
213
- class: E(l.$style.option),
133
+ onClick: d,
134
+ class: p(e.$style.option),
214
135
  tabindex: "0"
215
136
  }, "No results", 2))
216
- ], 2)) : A("", !0)
137
+ ], 2)) : j("", !0)
217
138
  ], 2));
218
139
  }
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]]);
140
+ }), W = "_container_1bjom_1", X = "_filter_1bjom_5", Y = "_options_1bjom_9", Z = "_option_1bjom_9", ee = {
141
+ container: W,
142
+ filter: X,
143
+ options: Y,
144
+ option: Z
145
+ }, te = {
146
+ $style: ee
147
+ }, re = /* @__PURE__ */ K(J, [["__cssModules", te]]);
227
148
  export {
228
- we as default
149
+ re as default
229
150
  };
@@ -0,0 +1,84 @@
1
+ import { getCurrentScope as S, onScopeDispose as O, unref as b, watch as I } from "vue";
2
+ function L(t) {
3
+ return S() ? (O(t), !0) : !1;
4
+ }
5
+ function E(t) {
6
+ return typeof t == "function" ? t() : b(t);
7
+ }
8
+ const g = typeof window < "u" && typeof document < "u", k = Object.prototype.toString, P = (t) => k.call(t) === "[object Object]", w = () => {
9
+ }, j = /* @__PURE__ */ C();
10
+ function C() {
11
+ var t;
12
+ return g && ((t = window?.navigator) == null ? void 0 : t.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
13
+ }
14
+ function f(t) {
15
+ var s;
16
+ const r = E(t);
17
+ return (s = r?.$el) != null ? s : r;
18
+ }
19
+ const A = g ? window : void 0;
20
+ function h(...t) {
21
+ let s, r, o, a;
22
+ if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([r, o, a] = t, s = A) : [s, r, o, a] = t, !s)
23
+ return w;
24
+ Array.isArray(r) || (r = [r]), Array.isArray(o) || (o = [o]);
25
+ const d = [], p = () => {
26
+ d.forEach((c) => c()), d.length = 0;
27
+ }, l = (c, u, e, n) => (c.addEventListener(u, e, n), () => c.removeEventListener(u, e, n)), m = I(
28
+ () => [f(s), E(a)],
29
+ ([c, u]) => {
30
+ if (p(), !c)
31
+ return;
32
+ const e = P(u) ? { ...u } : u;
33
+ d.push(
34
+ ...r.flatMap((n) => o.map((i) => l(c, n, i, e)))
35
+ );
36
+ },
37
+ { immediate: !0, flush: "post" }
38
+ ), y = () => {
39
+ m(), p();
40
+ };
41
+ return L(y), y;
42
+ }
43
+ let v = !1;
44
+ function W(t, s, r = {}) {
45
+ const { window: o = A, ignore: a = [], capture: d = !0, detectIframe: p = !1 } = r;
46
+ if (!o)
47
+ return;
48
+ j && !v && (v = !0, Array.from(o.document.body.children).forEach((e) => e.addEventListener("click", w)), o.document.documentElement.addEventListener("click", w));
49
+ let l = !0;
50
+ const m = (e) => a.some((n) => {
51
+ if (typeof n == "string")
52
+ return Array.from(o.document.querySelectorAll(n)).some((i) => i === e.target || e.composedPath().includes(i));
53
+ {
54
+ const i = f(n);
55
+ return i && (e.target === i || e.composedPath().includes(i));
56
+ }
57
+ }), c = [
58
+ h(o, "click", (e) => {
59
+ const n = f(t);
60
+ if (!(!n || n === e.target || e.composedPath().includes(n))) {
61
+ if (e.detail === 0 && (l = !m(e)), !l) {
62
+ l = !0;
63
+ return;
64
+ }
65
+ s(e);
66
+ }
67
+ }, { passive: !0, capture: d }),
68
+ h(o, "pointerdown", (e) => {
69
+ const n = f(t);
70
+ n && (l = !e.composedPath().includes(n) && !m(e));
71
+ }, { passive: !0 }),
72
+ p && h(o, "blur", (e) => {
73
+ setTimeout(() => {
74
+ var n;
75
+ const i = f(t);
76
+ ((n = o.document.activeElement) == null ? void 0 : n.tagName) === "IFRAME" && !i?.contains(o.document.activeElement) && s(e);
77
+ }, 0);
78
+ })
79
+ ].filter(Boolean);
80
+ return () => c.forEach((e) => e());
81
+ }
82
+ export {
83
+ W as o
84
+ };
package/dist/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export { default as UiPagination } from './UiPagination/UiPagination';
9
9
  export { default as UiCheckbox } from './UiCheckbox/UiCheckbox';
10
10
  export { default as UiModal } from './UiModal/UiModal';
11
11
  export { default as UiBreadcrumbs } from './UiBreadcrumbs/UiBreadcrumbs';
12
+ export { default as UiSearch } from './UiSearch/UiSearch';
12
13
  export { default as toast } from './toast/toast';
package/dist/index.ts CHANGED
@@ -9,4 +9,5 @@ export { default as UiPagination } from './UiPagination/UiPagination.js';
9
9
  export { default as UiCheckbox } from './UiCheckbox/UiCheckbox.js';
10
10
  export { default as UiModal } from './UiModal/UiModal.js';
11
11
  export { default as UiBreadcrumbs } from './UiBreadcrumbs/UiBreadcrumbs.js';
12
+ export { default as UiSearch } from './UiSearch/UiSearch.js';
12
13
  export { default as toast } from './toast/toast';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mhz-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "mhz-ui",
5
5
  "author": "dergunov.com",
6
6
  "license": "MIT",
@@ -28,22 +28,23 @@
28
28
  "@tiptap/vue-3": "2.1.7",
29
29
  "@vueuse/core": "10.4.1",
30
30
  "@vueuse/integrations": "10.4.1",
31
+ "perfect-debounce": "1.0.0",
31
32
  "vue": "3.3.4",
32
33
  "vue-router": "4.2.4"
33
34
  },
34
35
  "devDependencies": {
35
- "@storybook/addon-essentials": "7.3.2",
36
- "@storybook/addon-interactions": "7.3.2",
37
- "@storybook/addon-links": "7.3.2",
38
- "@storybook/blocks": "7.3.2",
39
- "@storybook/core-events": "7.3.2",
40
- "@storybook/preview-api": "7.3.2",
41
- "@storybook/vue3": "7.3.2",
42
- "@storybook/vue3-vite": "7.3.2",
36
+ "@storybook/addon-essentials": "7.4.0",
37
+ "@storybook/addon-interactions": "7.4.0",
38
+ "@storybook/addon-links": "7.4.0",
39
+ "@storybook/blocks": "7.4.0",
40
+ "@storybook/core-events": "7.4.0",
41
+ "@storybook/preview-api": "7.4.0",
42
+ "@storybook/vue3": "7.4.0",
43
+ "@storybook/vue3-vite": "7.4.0",
43
44
  "@types/node": "20.5.7",
44
- "@typescript-eslint/eslint-plugin": "6.4.1",
45
- "@typescript-eslint/parser": "6.4.1",
46
- "@vitejs/plugin-vue": "4.3.3",
45
+ "@typescript-eslint/eslint-plugin": "6.5.0",
46
+ "@typescript-eslint/parser": "6.5.0",
47
+ "@vitejs/plugin-vue": "4.3.4",
47
48
  "eslint": "8.48.0",
48
49
  "eslint-config-prettier": "9.0.0",
49
50
  "eslint-import-resolver-typescript": "3.6.0",
@@ -52,11 +53,11 @@
52
53
  "eslint-plugin-vue": "9.17.0",
53
54
  "postcss-html": "1.5.0",
54
55
  "postcss-scss": "4.0.7",
55
- "prettier": "3.0.2",
56
+ "prettier": "3.0.3",
56
57
  "react": "18.2.0",
57
58
  "react-dom": "18.2.0",
58
59
  "sass": "1.66.1",
59
- "storybook": "7.3.2",
60
+ "storybook": "7.4.0",
60
61
  "stylelint": "15.10.3",
61
62
  "stylelint-config-recess-order": "4.3.0",
62
63
  "stylelint-config-recommended-scss": "12.0.0",
@@ -64,10 +65,10 @@
64
65
  "stylelint-prettier": "4.0.2",
65
66
  "typescript": "5.2.2",
66
67
  "vite": "4.4.9",
67
- "vite-plugin-dts": "3.5.2",
68
+ "vite-plugin-dts": "3.5.3",
68
69
  "vite-plugin-static-copy": "0.17.0",
69
70
  "vite-svg-loader": "4.0.0",
70
- "vue-linters-config": "0.1.6",
71
+ "vue-linters-config": "0.1.9",
71
72
  "vue-tsc": "1.8.8"
72
73
  },
73
74
  "peerDependencies": {