@studio-west/component-sw 0.13.18 → 1.0.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.
@@ -0,0 +1,81 @@
1
+ import { createElementBlock as e, createElementVNode as t, defineComponent as n, nextTick as r, normalizeClass as i, onMounted as a, onUnmounted as o, openBlock as s, ref as c, renderSlot as l, watch as u } from "vue";
2
+ //#endregion
3
+ //#region src/components/SwAffix.vue
4
+ var d = /* @__PURE__ */ n({
5
+ __name: "SwAffix",
6
+ props: {
7
+ class: { default: "" },
8
+ offset: { default: 0 },
9
+ offsetBottom: { default: 0 },
10
+ boundary: { default: "" },
11
+ boundaryEdge: { default: "bottom" }
12
+ },
13
+ setup(n) {
14
+ let d = n, f = c(null), p = c(null), m = !1, h = null, g = 0, _ = () => !d.boundary || typeof document > "u" ? null : document.querySelector(d.boundary), v = () => {
15
+ let e = d.offsetBottom;
16
+ if (d.boundary) {
17
+ let t = _();
18
+ if (!t) return null;
19
+ let n = t.getBoundingClientRect();
20
+ return (d.boundaryEdge === "top" ? n.top : n.bottom) - e;
21
+ }
22
+ let t = document.documentElement;
23
+ return t.scrollHeight - (window.pageYOffset || t.scrollTop) - e;
24
+ }, y = () => {
25
+ m = !1, h = null, g = 0;
26
+ let e = f.value, t = p.value;
27
+ e && (e.style.height = "", e.style.minHeight = "", e.style.padding = "", e.style.border = ""), t && (t.className = "sw-affix", t.style.top = "", t.style.width = "", t.style.cssText = "");
28
+ }, b = (e, t) => {
29
+ let n = t.getBoundingClientRect().height;
30
+ if (d.boundaryEdge === "top") {
31
+ let t = _();
32
+ t instanceof HTMLElement && (e.style.minHeight = t.offsetHeight + "px"), e.style.height = n + "px";
33
+ return;
34
+ }
35
+ e.style.minHeight = "", e.style.height = n + "px";
36
+ }, x = () => {
37
+ let e = f.value, t = p.value;
38
+ if (!e || !t) return;
39
+ let n = v();
40
+ if (n === null) return;
41
+ let r = e.getBoundingClientRect();
42
+ if (r.bottom < n) {
43
+ if (!m) {
44
+ b(e, t);
45
+ let n = getComputedStyle(e, ""), r = "";
46
+ for (let e = 0; e < n.length; e++) {
47
+ let t = n[e];
48
+ (t.indexOf("overflow") === 0 || t.indexOf("padding") === 0 || t.indexOf("border") === 0 || t.indexOf("box-shadow") === 0) && (r += t + ": " + n.getPropertyValue(t) + "; ");
49
+ }
50
+ t.className = "sw-affix stop", t.style.cssText = r + " box-sizing: border-box; width: " + e.offsetWidth + "px;", e.style.padding = "0", e.style.border = "0", m = !0;
51
+ }
52
+ let i = t.getBoundingClientRect(), a = r.top + i.height, o = document.documentElement.clientHeight, s = Math.round(a - n), c = Math.round(a - o), l = d.offset;
53
+ i.height > o ? (r.top < (h ?? 0) ? c + 0 > s ? i.bottom - o + 0 <= 0 ? (t.className = "sw-affix sticky", t.style.top = o - i.height - 0 + "px", g = 0 + r.top + i.height - o) : (t.className = "sw-affix stop", t.style.top = -g + "px") : (t.className = "sw-affix stop", t.style.top = -s + "px", g = s) : r.top - l < 0 ? i.top - l >= 0 ? (t.className = "sw-affix sticky", t.style.top = l + "px", g = r.top - l) : (t.className = "sw-affix stop", t.style.top = -g + "px") : (t.className = "sw-affix", t.style.top = "", g = 0), h = r.top) : r.top - l <= 0 ? r.top - l <= s ? (t.style.top = -s + "px", t.className = "sw-affix stop") : (t.style.top = l + "px", t.className = "sw-affix sticky") : (t.className = "sw-affix", t.style.top = ""), t.style.width = getComputedStyle(e, "").width;
54
+ }
55
+ }, S = () => {
56
+ typeof window > "u" || requestAnimationFrame(x);
57
+ };
58
+ return u(() => [
59
+ d.offset,
60
+ d.offsetBottom,
61
+ d.boundary,
62
+ d.boundaryEdge
63
+ ], () => {
64
+ y(), S();
65
+ }), a(async () => {
66
+ typeof window > "u" || (await r(), x(), requestAnimationFrame(x), window.addEventListener("scroll", x, !1), document.body.addEventListener("scroll", x, !1), window.addEventListener("resize", x, !1));
67
+ }), o(() => {
68
+ typeof window > "u" || (window.removeEventListener("scroll", x), document.body.removeEventListener("scroll", x), window.removeEventListener("resize", x));
69
+ }), (n, r) => (s(), e("div", {
70
+ ref_key: "wrapRef",
71
+ ref: f,
72
+ class: i(["sw-affix-wrap", d.class])
73
+ }, [t("div", {
74
+ ref_key: "affixRef",
75
+ ref: p,
76
+ class: "sw-affix"
77
+ }, [l(n.$slots, "default")], 512)], 2));
78
+ }
79
+ });
80
+ //#endregion
81
+ export { d as default };
@@ -0,0 +1,42 @@
1
+ import { t as e } from "./SwButton-yBtJyLyA.js";
2
+ import { createBlock as t, createTextVNode as n, defineComponent as r, normalizeClass as i, normalizeStyle as a, onMounted as o, onUnmounted as s, openBlock as c, ref as l, vShow as u, withCtx as d, withDirectives as f } from "vue";
3
+ //#endregion
4
+ //#region src/components/SwBackTop.vue
5
+ var p = /* @__PURE__ */ r({
6
+ __name: "SwBackTop",
7
+ props: {
8
+ class: { default: "" },
9
+ visibilityHeight: { default: 400 },
10
+ right: { default: "2rem" },
11
+ bottom: { default: "2rem" }
12
+ },
13
+ setup(r) {
14
+ let p = r, m = l(!1), h = () => typeof window > "u" ? 0 : window.scrollY || document.documentElement.scrollTop || 0, g = () => {
15
+ m.value = h() >= p.visibilityHeight;
16
+ }, _ = () => {
17
+ typeof window > "u" || window.scrollTo({
18
+ top: 0,
19
+ behavior: "smooth"
20
+ });
21
+ };
22
+ return o(() => {
23
+ typeof window > "u" || (g(), window.addEventListener("scroll", g, { passive: !0 }));
24
+ }), s(() => {
25
+ typeof window < "u" && window.removeEventListener("scroll", g);
26
+ }), (o, s) => f((c(), t(e, {
27
+ round: "",
28
+ class: i(["sw-back-top", p.class]),
29
+ style: a({
30
+ right: r.right,
31
+ bottom: r.bottom
32
+ }),
33
+ "aria-label": "Наверх",
34
+ onClick: _
35
+ }, {
36
+ default: d(() => [...s[0] ||= [n(" ↑ ", -1)]]),
37
+ _: 1
38
+ }, 8, ["class", "style"])), [[u, m.value]]);
39
+ }
40
+ });
41
+ //#endregion
42
+ export { p as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./SwSelect-DDNh3p6B.js";
1
+ import { t as e } from "./SwDadata-DqTWDCFW.js";
2
2
  import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createTextVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, renderSlot as l, resolveComponent as u, toDisplayString as d } from "vue";
3
3
  //#region src/components/SwButton.vue?vue&type=script&setup=true&lang.ts
4
4
  var f = /*@__PURE__*/ o({
@@ -1982,13 +1982,13 @@ $.Axios = Q, $.CanceledError = Y, $.CancelToken = rr, $.isCancel = qt, $.VERSION
1982
1982
  return Promise.all(e);
1983
1983
  }, $.spread = ir, $.isAxiosError = ar, $.mergeConfig = X, $.AxiosHeaders = U, $.formToJSON = (e) => Wt(V.isHTMLForm(e) ? new FormData(e) : e), $.getAdapter = Xn.getAdapter, $.HttpStatusCode = or, $.default = $;
1984
1984
  //#endregion
1985
- //#region src/components/SwSelect.vue?vue&type=script&setup=true&lang.ts
1986
- var cr = { class: "sw-select-popup" }, lr = [
1985
+ //#region src/components/SwDadata.vue?vue&type=script&setup=true&lang.ts
1986
+ var cr = { class: "sw-dadata-popup" }, lr = [
1987
1987
  "aria-selected",
1988
1988
  "onClick",
1989
1989
  "onMouseenter"
1990
1990
  ], ur = /* @__PURE__ */ i({
1991
- __name: "SwSelect",
1991
+ __name: "SwDadata",
1992
1992
  props: /*@__PURE__*/ a({
1993
1993
  class: { default: "" },
1994
1994
  size: { default: "large" },
@@ -2034,7 +2034,7 @@ var cr = { class: "sw-select-popup" }, lr = [
2034
2034
  return (i, o) => {
2035
2035
  let l = d("sw-input");
2036
2036
  return c(), t("div", {
2037
- class: s(["sw-select", S.class]),
2037
+ class: s(["sw-dadata", S.class]),
2038
2038
  onKeydown: T
2039
2039
  }, [r(l, {
2040
2040
  name: "address",
@@ -2050,7 +2050,7 @@ var cr = { class: "sw-select-popup" }, lr = [
2050
2050
  ]), g(n("div", cr, [n("ul", {
2051
2051
  ref_key: "listRef",
2052
2052
  ref: b,
2053
- class: "sw-select-list",
2053
+ class: "sw-dadata-list",
2054
2054
  role: "listbox"
2055
2055
  }, [(c(!0), t(e, null, u(v.value, (e, n) => (c(), t("li", {
2056
2056
  key: n,
@@ -1,4 +1,4 @@
1
- import { a as e, o as t } from "./utils-qzwUfWRX.js";
1
+ import { a as e, o as t } from "./utils-B970mUhr.js";
2
2
  import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, renderSlot as f, toDisplayString as p, unref as m, withModifiers as h } from "vue";
3
3
  //#region src/components/SwDatePicker.vue
4
4
  var ee = { class: "sw-data-picker" }, g = {
@@ -0,0 +1,86 @@
1
+ import { n as e } from "./SwIcon-Bjw7BuaO.js";
2
+ import { t } from "./SwButton-yBtJyLyA.js";
3
+ import { Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onUnmounted as g, openBlock as _, ref as v, renderSlot as y, toDisplayString as b, unref as x, useModel as S, useSlots as C, watch as w, withCtx as T, withModifiers as E } from "vue";
4
+ //#region src/components/SwDrawer.vue?vue&type=script&setup=true&lang.ts
5
+ var D = { key: 0 }, O = { class: "sw-drawer-body" }, k = { key: 1 }, A = 250, j = /* @__PURE__ */ d({
6
+ __name: "SwDrawer",
7
+ props: /*@__PURE__*/ f({
8
+ class: { default: "" },
9
+ title: { default: "" },
10
+ placement: { default: "right" },
11
+ size: { default: "30%" },
12
+ after: { default: "" },
13
+ iconAfter: { default: "" },
14
+ modal: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ closeOnClickModal: {
19
+ type: Boolean,
20
+ default: !0
21
+ }
22
+ }, {
23
+ modelValue: {
24
+ type: Boolean,
25
+ default: !1
26
+ },
27
+ modelModifiers: {}
28
+ }),
29
+ emits: /*@__PURE__*/ f(["close"], ["update:modelValue"]),
30
+ setup(d, { emit: f }) {
31
+ let j = S(d, "modelValue"), M = d, N = f, P = C(), F = v(""), I = i(() => M.after || M.iconAfter), L = () => {
32
+ typeof document > "u" || (F.value = document.body.style.overflow, document.body.style.overflow = "hidden");
33
+ }, R = () => {
34
+ typeof document > "u" || (document.body.style.overflow = F.value);
35
+ }, z = () => {
36
+ j.value = !1, N("close");
37
+ }, B = () => {
38
+ M.closeOnClickModal && z();
39
+ }, V = (e) => {
40
+ e.key === "Escape" && j.value && z();
41
+ };
42
+ w(() => j.value, (e) => {
43
+ typeof window > "u" || (e ? (L(), p(() => window.addEventListener("keydown", V))) : window.removeEventListener("keydown", V));
44
+ });
45
+ let H = () => {
46
+ R();
47
+ };
48
+ return g(() => {
49
+ R(), typeof window < "u" && window.removeEventListener("keydown", V);
50
+ }), (i, f) => (_(), a(n, { to: "body" }, [u(r, {
51
+ name: "sw-drawer",
52
+ appear: "",
53
+ duration: {
54
+ enter: A,
55
+ leave: A
56
+ },
57
+ onAfterLeave: H
58
+ }, {
59
+ default: T(() => [j.value ? (_(), s("div", {
60
+ key: 0,
61
+ class: m(["sw-drawer-mask", [M.class, { "is-modal": d.modal }]]),
62
+ onClick: E(B, ["self"])
63
+ }, [c("aside", {
64
+ class: m(["sw-drawer", [`is-${d.placement}`]]),
65
+ style: h({ width: d.size }),
66
+ role: "dialog",
67
+ "aria-modal": "true"
68
+ }, [
69
+ d.title || x(P).header || I.value ? (_(), s("header", D, [y(i.$slots, "header", {}, () => [l(b(d.title), 1)]), I.value ? (_(), a(t, {
70
+ key: 0,
71
+ link: "",
72
+ type: "primary",
73
+ onClick: z
74
+ }, {
75
+ default: T(() => [u(e, { "icon-class": I.value }, null, 8, ["icon-class"])]),
76
+ _: 1
77
+ })) : o("", !0)])) : o("", !0),
78
+ c("div", O, [y(i.$slots, "default")]),
79
+ x(P).footer ? (_(), s("footer", k, [y(i.$slots, "footer")])) : o("", !0)
80
+ ], 6)], 2)) : o("", !0)]),
81
+ _: 3
82
+ }, 8, ["duration"])]));
83
+ }
84
+ });
85
+ //#endregion
86
+ export { j as default };
@@ -1,4 +1,4 @@
1
- import { n as e } from "./SwIcon-B-HHyuxu.js";
1
+ import { n as e } from "./SwIcon-Bjw7BuaO.js";
2
2
  import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, normalizeClass as o, openBlock as s, renderSlot as c } from "vue";
3
3
  //#region src/components/SwDropdownItem.vue
4
4
  var l = {
@@ -1,5 +1,5 @@
1
- import { n as e } from "./SwIcon-B-HHyuxu.js";
2
- import { t } from "./SwButton-DpOGpsBS.js";
1
+ import { n as e } from "./SwIcon-Bjw7BuaO.js";
2
+ import { t } from "./SwButton-yBtJyLyA.js";
3
3
  import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onUnmounted as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useModel as ee, watch as te, withCtx as b, withModifiers as ne } from "vue";
4
4
  //#region src/utils/mediaCrop.ts
5
5
  function re(e, t, n, r) {
@@ -1,11 +1,11 @@
1
- import { i as e } from "./utils-qzwUfWRX.js";
2
- import { n as t } from "./SwIcon-B-HHyuxu.js";
3
- import { t as n } from "./SwButton-DpOGpsBS.js";
1
+ import { i as e } from "./utils-B970mUhr.js";
2
+ import { n as t } from "./SwIcon-Bjw7BuaO.js";
3
+ import { t as n } from "./SwButton-yBtJyLyA.js";
4
4
  import r from "./SwDropdown-DpedC6Bn.js";
5
5
  import { computed as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, mergeModels as l, normalizeClass as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, watchEffect as _, withCtx as v } from "vue";
6
- //#region src/components/SwGide.vue
6
+ //#region src/components/SwGuide.vue
7
7
  var y = ["src"], b = {
8
- __name: "SwGide",
8
+ __name: "SwGuide",
9
9
  props: /*@__PURE__*/ l({
10
10
  steps: {
11
11
  type: Array,
@@ -72,14 +72,14 @@ var y = ["src"], b = {
72
72
  r.disconnect(), window.removeEventListener("resize", n), window.removeEventListener("scroll", n);
73
73
  });
74
74
  }), d(() => window.onload = () => C.value = document.querySelector(E.steps[w.value]?.tag)), (e, i) => (f(), a("div", {
75
- class: "sw-gide",
76
- ref_key: "swGide",
75
+ class: "sw-guide",
76
+ ref_key: "swGuide",
77
77
  ref: x
78
78
  }, [
79
79
  i[6] ||= o("div", { class: "overlay0" }, null, -1),
80
80
  i[7] ||= o("div", { class: "overlay1" }, null, -1),
81
81
  c(r, {
82
- class: "gide",
82
+ class: "guide",
83
83
  trigger: "none",
84
84
  placement: E.steps[w.value].placement,
85
85
  modelValue: S.value,
@@ -1,5 +1,5 @@
1
- import { r as e } from "./utils-qzwUfWRX.js";
2
- import { t } from "./SwSelect-DDNh3p6B.js";
1
+ import { r as e } from "./utils-B970mUhr.js";
2
+ import { t } from "./SwDadata-DqTWDCFW.js";
3
3
  import { computed as n, createElementBlock as r, createElementVNode as i, mergeProps as a, openBlock as o, unref as s } from "vue";
4
4
  //#region src/components/SwIcon.vue
5
5
  var c = /* @__PURE__ */ t({ default: () => u }), l = ["href"], u = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
@@ -1,5 +1,5 @@
1
- import { n as e } from "./utils-qzwUfWRX.js";
2
- import { n as t } from "./SwIcon-B-HHyuxu.js";
1
+ import { n as e } from "./utils-B970mUhr.js";
2
+ import { n as t } from "./SwIcon-Bjw7BuaO.js";
3
3
  import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createTextVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, nextTick as u, normalizeClass as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, vModelDynamic as _, vModelText as v, watch as y, withDirectives as b, withModifiers as x } from "vue";
4
4
  //#region src/components/SwInput.vue?vue&type=script&setup=true&lang.ts
5
5
  var S = ["for"], C = {
@@ -1,5 +1,5 @@
1
- import { n as e } from "./SwIcon-B-HHyuxu.js";
2
- import { t } from "./SwButton-DpOGpsBS.js";
1
+ import { n as e } from "./SwIcon-Bjw7BuaO.js";
2
+ import { t } from "./SwButton-yBtJyLyA.js";
3
3
  import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, mergeModels as c, nextTick as l, normalizeClass as u, onUnmounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useModel as _, useSlots as v, watch as y, withCtx as b } from "vue";
4
4
  //#region src/components/SwMessage.vue
5
5
  var x = { key: 0 }, S = {
@@ -0,0 +1,139 @@
1
+ import { t as e } from "./SwTag-snjqhsXj.js";
2
+ import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, onMounted as f, onUnmounted as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, useModel as v, vShow as y, watch as b, withDirectives as x } from "vue";
3
+ //#region src/components/SwSelect.vue?vue&type=script&setup=true&lang.ts
4
+ var S = ["aria-expanded"], C = { class: "sw-select-values" }, w = {
5
+ key: 1,
6
+ class: "sw-select-label"
7
+ }, T = {
8
+ key: 2,
9
+ class: "sw-select-placeholder"
10
+ }, E = { class: "sw-select-popup" }, D = ["aria-multiselectable"], O = [
11
+ "aria-selected",
12
+ "onClick",
13
+ "onMouseenter"
14
+ ], k = {
15
+ key: 0,
16
+ class: "sw-select-check"
17
+ }, A = /* @__PURE__ */ c({
18
+ __name: "SwSelect",
19
+ props: /*@__PURE__*/ l({
20
+ class: { default: "" },
21
+ size: { default: "large" },
22
+ placeholder: { default: "" },
23
+ options: { default: () => [] },
24
+ multiple: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ clearable: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: !1
35
+ }
36
+ }, {
37
+ modelValue: {},
38
+ modelModifiers: {}
39
+ }),
40
+ emits: ["update:modelValue"],
41
+ setup(c) {
42
+ let l = v(c, "modelValue"), A = c, j = h(!1), M = h(-1), N = h(null), P = h(null), F = n(() => A.multiple ? Array.isArray(l.value) ? l.value : [] : l.value === void 0 || l.value === null || l.value === "" ? [] : [l.value]), I = n(() => A.options.filter((e) => F.value.includes(e.value))), L = n(() => A.multiple ? "" : A.options.find((e) => e.value === l.value)?.label ?? ""), R = n(() => F.value.length > 0), z = () => {
43
+ A.disabled || (j.value = !j.value, j.value && (M.value = -1));
44
+ }, B = () => {
45
+ j.value = !1, M.value = -1;
46
+ }, V = (e) => F.value.includes(e), H = (e) => {
47
+ if (!e.disabled) if (A.multiple) {
48
+ let t = Array.isArray(l.value) ? [...l.value] : [], n = t.indexOf(e.value);
49
+ n >= 0 ? t.splice(n, 1) : t.push(e.value), l.value = t;
50
+ } else l.value = e.value, B();
51
+ }, U = (e) => {
52
+ !A.multiple || !Array.isArray(l.value) || (l.value = l.value.filter((t) => t !== e));
53
+ }, W = (e) => {
54
+ e.stopPropagation(), l.value = A.multiple ? [] : void 0, B();
55
+ }, G = () => A.options.map((e, t) => t).filter((e) => !A.options[e].disabled), K = (e) => {
56
+ let t = G();
57
+ if (!t.length) return;
58
+ let n = t.indexOf(M.value), r = n < 0 ? e > 0 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length];
59
+ M.value = r, J();
60
+ }, q = (e) => {
61
+ if (A.disabled) return;
62
+ if (!j.value) {
63
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), j.value = !0);
64
+ return;
65
+ }
66
+ let t = G();
67
+ t.length && (e.key === "ArrowDown" ? (e.preventDefault(), K(1)) : e.key === "ArrowUp" ? (e.preventDefault(), K(-1)) : e.key === "Home" ? (e.preventDefault(), M.value = t[0], J()) : e.key === "End" ? (e.preventDefault(), M.value = t[t.length - 1], J()) : e.key === "Enter" || e.key === " " ? (e.preventDefault(), M.value >= 0 && H(A.options[M.value])) : e.key === "Escape" && (e.preventDefault(), B()));
68
+ }, J = () => {
69
+ u(() => {
70
+ (P.value?.querySelector(".is-active"))?.scrollIntoView({ block: "nearest" });
71
+ });
72
+ }, Y = (e) => {
73
+ !j.value || !N.value || N.value.contains(e.target) || B();
74
+ };
75
+ return f(() => {
76
+ typeof document < "u" && document.addEventListener("click", Y, !0);
77
+ }), p(() => {
78
+ typeof document < "u" && document.removeEventListener("click", Y, !0);
79
+ }), b(() => A.multiple, (e) => {
80
+ e && !Array.isArray(l.value) && (l.value = l.value == null ? [] : [l.value]), !e && Array.isArray(l.value) && (l.value = l.value[0]);
81
+ }, { immediate: !0 }), (n, l) => (m(), a("div", {
82
+ ref_key: "rootRef",
83
+ ref: N,
84
+ class: d(["sw-select", [
85
+ A.class,
86
+ A.size,
87
+ {
88
+ "is-open": j.value,
89
+ "is-disabled": c.disabled
90
+ }
91
+ ]]),
92
+ tabindex: "0",
93
+ role: "combobox",
94
+ "aria-expanded": j.value,
95
+ onKeydown: q
96
+ }, [o("div", {
97
+ class: "sw-select-trigger",
98
+ onClick: z
99
+ }, [
100
+ o("div", C, [c.multiple && I.value.length ? (m(!0), a(t, { key: 0 }, g(I.value, (t) => (m(), r(e, {
101
+ key: String(t.value),
102
+ size: "small",
103
+ closable: "",
104
+ label: t.label,
105
+ onClose: (e) => U(t.value)
106
+ }, null, 8, ["label", "onClose"]))), 128)) : L.value ? (m(), a("span", w, _(L.value), 1)) : (m(), a("span", T, _(c.placeholder), 1))]),
107
+ c.clearable && R.value && !c.disabled ? (m(), a("button", {
108
+ key: 0,
109
+ type: "button",
110
+ class: "sw-select-clear",
111
+ "aria-label": "Очистить",
112
+ onClick: W
113
+ }, " × ")) : i("", !0),
114
+ l[0] ||= o("span", {
115
+ class: "sw-select-arrow",
116
+ "aria-hidden": "true"
117
+ }, "▾", -1)
118
+ ]), x(o("div", E, [o("ul", {
119
+ ref_key: "listRef",
120
+ ref: P,
121
+ class: "sw-select-list",
122
+ role: "listbox",
123
+ "aria-multiselectable": c.multiple
124
+ }, [(m(!0), a(t, null, g(c.options, (e, t) => (m(), a("li", {
125
+ key: t,
126
+ role: "option",
127
+ class: d({
128
+ "is-active": t === M.value,
129
+ "is-selected": V(e.value),
130
+ "is-disabled": e.disabled
131
+ }),
132
+ "aria-selected": V(e.value),
133
+ onClick: (t) => H(e),
134
+ onMouseenter: (e) => M.value = t
135
+ }, [c.multiple ? (m(), a("span", k, _(V(e.value) ? "✓" : ""), 1)) : i("", !0), s(" " + _(e.label), 1)], 42, O))), 128))], 8, D)], 512), [[y, j.value]])], 42, S));
136
+ }
137
+ });
138
+ //#endregion
139
+ export { A as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./utils-qzwUfWRX.js";
1
+ import { t as e } from "./utils-B970mUhr.js";
2
2
  import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, mergeModels as o, normalizeClass as s, normalizeStyle as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, useModel as g, withModifiers as _ } from "vue";
3
3
  //#region src/components/SwSlider.vue
4
4
  var v = [
@@ -38,6 +38,10 @@ var v = [
38
38
  showValue: {
39
39
  type: Boolean,
40
40
  default: !1
41
+ },
42
+ trackColor: {
43
+ type: Array,
44
+ default: () => []
41
45
  }
42
46
  }, {
43
47
  modelValue: {
@@ -97,14 +101,16 @@ var v = [
97
101
  let e = P.value[0] || 0, t = P.value[P.value.length - 1] || 0, n = Math.min(e, t);
98
102
  return {
99
103
  height: `${Math.max(e, t) - n}%`,
100
- top: `${n}%`,
104
+ bottom: `${n}%`,
105
+ top: "auto",
101
106
  left: "0",
102
107
  width: "100%"
103
108
  };
104
109
  }
105
110
  return {
106
111
  height: `${P.value[0] || 0}%`,
107
- top: "0",
112
+ bottom: "0",
113
+ top: "auto",
108
114
  left: "0",
109
115
  width: "100%"
110
116
  };
@@ -124,65 +130,100 @@ var v = [
124
130
  top: "0",
125
131
  height: "100%"
126
132
  };
127
- }), I = n(() => P.value.map((e, t) => b.vertical ? {
128
- top: `${e}%`,
133
+ }), I = n(() => {
134
+ let e = b.trackColor;
135
+ if (!e?.length) return [];
136
+ let t = e[e.length - 1], n = P.value, r = [];
137
+ if (j.value) for (let e = 0; e < n.length - 1; e++) r.push({
138
+ start: n[e],
139
+ end: n[e + 1]
140
+ });
141
+ else n.length && r.push({
142
+ start: 0,
143
+ end: n[0]
144
+ });
145
+ return r.map(({ start: n, end: r }, i) => {
146
+ let a = e[i] ?? t;
147
+ return b.vertical ? {
148
+ bottom: `${n}%`,
149
+ height: `${r - n}%`,
150
+ top: "auto",
151
+ left: "0",
152
+ width: "100%",
153
+ background: a
154
+ } : {
155
+ left: `${n}%`,
156
+ width: `${r - n}%`,
157
+ top: "0",
158
+ height: "100%",
159
+ background: a
160
+ };
161
+ });
162
+ }), L = n(() => P.value.map((e, t) => b.vertical ? {
163
+ top: `${100 - e}%`,
164
+ bottom: "auto",
129
165
  zIndex: M.value.length - t
130
166
  } : {
131
167
  left: `${e}%`,
132
168
  zIndex: M.value.length - t
133
- }));
134
- function L(e) {
169
+ })), R = (e, t, n) => b.vertical ? 1 - (t - n.top) / n.height : (e - n.left) / n.width;
170
+ function z(e) {
135
171
  let t = Math.round((e - b.min) / b.step), n = b.min + t * b.step;
136
172
  return Math.max(b.min, Math.min(b.max, n));
137
173
  }
138
- function R(e) {
174
+ function B(e) {
139
175
  if (j.value || C.value) return;
140
176
  let t = x.value;
141
177
  if (!t) return;
142
- let n = t.getBoundingClientRect(), r = b.vertical ? (e.clientY - n.top) / n.height : (e.clientX - n.left) / n.width, i = Math.max(0, Math.min(1, r)), a = b.max - b.min;
143
- N([L(b.min + i * a)]);
178
+ let n = t.getBoundingClientRect(), r = Math.max(0, Math.min(1, R(e.clientX, e.clientY, n))), i = b.max - b.min;
179
+ N([z(b.min + r * i)]);
144
180
  }
145
- function z(e, t) {
181
+ function V(e, t) {
146
182
  let n = x.value || e.target?.closest?.(".sw-slider");
147
- n && (T = n.getBoundingClientRect(), w.value = t, C.value = !0, D(t), H(e.clientX ?? e.touches?.[0]?.clientX, e.clientY ?? e.touches?.[0]?.clientY));
183
+ n && (T = n.getBoundingClientRect(), w.value = t, C.value = !0, D(t), W(e.clientX ?? e.touches?.[0]?.clientX, e.clientY ?? e.touches?.[0]?.clientY));
148
184
  }
149
- function B(e) {
150
- C.value && (e.preventDefault?.(), H(e.clientX ?? e.touches?.[0]?.clientX, e.clientY ?? e.touches?.[0]?.clientY));
185
+ function H(e) {
186
+ C.value && (e.preventDefault?.(), W(e.clientX ?? e.touches?.[0]?.clientX, e.clientY ?? e.touches?.[0]?.clientY));
151
187
  }
152
- function V() {
188
+ function U() {
153
189
  C.value && (C.value = !1, w.value = null, T = null);
154
190
  }
155
- function H(e, t) {
191
+ function W(e, t) {
156
192
  if (!T || w.value === null) return;
157
- let n = b.vertical ? (t - T.top) / T.height : (e - T.left) / T.width, r = Math.max(0, Math.min(1, n)), i = b.max - b.min, a = L(b.min + r * i), o = [...M.value];
158
- o[w.value] = a, N(o);
193
+ let n = Math.max(0, Math.min(1, R(e, t, T))), r = b.max - b.min, i = z(b.min + n * r), a = [...M.value];
194
+ a[w.value] = i, N(a);
159
195
  }
160
196
  return l(() => {
161
- window.addEventListener("mousemove", B, { passive: !1 }), window.addEventListener("mouseup", V), window.addEventListener("touchmove", B, { passive: !1 }), window.addEventListener("touchend", V), S.value = Array(M.value.length).fill(!1);
197
+ window.addEventListener("mousemove", H, { passive: !1 }), window.addEventListener("mouseup", U), window.addEventListener("touchmove", H, { passive: !1 }), window.addEventListener("touchend", U), S.value = Array(M.value.length).fill(!1);
162
198
  }), u(() => {
163
- window.removeEventListener("mousemove", B), window.removeEventListener("mouseup", V), window.removeEventListener("touchmove", B), window.removeEventListener("touchend", V);
199
+ window.removeEventListener("mousemove", H), window.removeEventListener("mouseup", U), window.removeEventListener("touchmove", H), window.removeEventListener("touchend", U);
164
200
  }), (e, n) => (d(), i("div", {
165
201
  class: s(E.value),
166
202
  ref_key: "rootRef",
167
203
  ref: x
168
204
  }, [a("div", {
169
205
  class: "track",
170
- onClick: R,
171
- onMousedown: n[0] ||= _((e) => z(e, 0), ["prevent"]),
172
- onTouchstart: n[1] ||= _((e) => z(e.touches[0], 0), ["prevent"])
173
- }, [a("div", {
206
+ onClick: B,
207
+ onMousedown: n[0] ||= _((e) => V(e, 0), ["prevent"]),
208
+ onTouchstart: n[1] ||= _((e) => V(e.touches[0], 0), ["prevent"])
209
+ }, [I.value.length ? (d(!0), i(t, { key: 0 }, p(I.value, (e, t) => (d(), i("div", {
210
+ key: t,
211
+ class: "fill",
212
+ style: c(e)
213
+ }, null, 4))), 128)) : (d(), i("div", {
214
+ key: 1,
174
215
  class: "fill",
175
216
  style: c(F.value)
176
- }, null, 4)], 32), (d(!0), i(t, null, p(M.value, (t, n) => (d(), i("div", {
217
+ }, null, 4))], 32), (d(!0), i(t, null, p(M.value, (t, n) => (d(), i("div", {
177
218
  class: "thumb",
178
219
  key: n,
179
- style: c(I.value[n]),
220
+ style: c(L.value[n]),
180
221
  onMouseenter: (e) => D(n),
181
222
  onMouseleave: (e) => O(n),
182
223
  onFocus: (e) => D(n),
183
224
  onBlur: (e) => O(n),
184
- onMousedown: _((e) => z(e, n), ["prevent"]),
185
- onTouchstart: _((e) => z(e.touches[0], n), ["prevent"])
225
+ onMousedown: _((e) => V(e, n), ["prevent"]),
226
+ onTouchstart: _((e) => V(e.touches[0], n), ["prevent"])
186
227
  }, [m(e.$slots, "default", {
187
228
  index: n,
188
229
  value: t