@studio-west/component-sw 0.9.0 → 0.9.1

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,147 +0,0 @@
1
- import { mergeModels as C, ref as v, useModel as b, watchEffect as L, onMounted as N, resolveComponent as R, createElementBlock as z, openBlock as M, createElementVNode as i, createVNode as a, withCtx as d, renderSlot as m, createTextVNode as f, toDisplayString as k, normalizeClass as h } from "vue";
2
- import B from "./SwDropdown-DQGTnnKw.js";
3
- import w from "./SwButton-85-tKHA7.js";
4
- const G = ["src"], q = {
5
- __name: "SwGide",
6
- props: /* @__PURE__ */ C({
7
- steps: { type: Array, default: () => [] },
8
- iconClose: { type: String, default: "" },
9
- maxWidth: { type: Number, default: 250 }
10
- }, {
11
- modelValue: { type: Number, default: 0 },
12
- modelModifiers: {}
13
- }),
14
- emits: /* @__PURE__ */ C(["close"], ["update:modelValue"]),
15
- setup(g, { emit: S }) {
16
- const n = v(null), y = v(!0), u = v(null), l = b(g, "modelValue"), T = S, s = g, x = () => T("close"), E = (t) => {
17
- const e = l.value + t;
18
- e < 0 ? l.value = 0 : e >= s.steps.length ? x() : l.value = e;
19
- };
20
- let p = !1;
21
- const V = (t) => {
22
- const e = t.getBoundingClientRect(), o = window.innerHeight;
23
- e.top < 5 ? (p = !0, document.documentElement.scrollTop += e.top - 5) : e.bottom > o - 5 && (p = !0, document.documentElement.scrollTop += e.bottom - o + 5);
24
- }, c = () => {
25
- if (!u.value || !n.value) return;
26
- const t = u.value.getBoundingClientRect(), e = window.pageYOffset || document.documentElement.scrollTop, o = window.pageXOffset || document.documentElement.scrollLeft;
27
- n.value.style.gridTemplateRows = `${t.top + e - 5}px ${t.height + 10}px 1fr`, n.value.style.gridTemplateColumns = `${t.left + o - 5}px ${t.width + 10}px 1fr`, n.value.style.height = document.documentElement.scrollHeight + "px";
28
- };
29
- return L((t) => {
30
- var $;
31
- if (!n.value) return;
32
- const e = ($ = s.steps[l.value]) == null ? void 0 : $.tag;
33
- if (!e || !e.trim()) {
34
- n.value.style.gridTemplateRows = "40% 0 1fr", n.value.style.gridTemplateColumns = "1fr 0 1fr", n.value.style.height = document.documentElement.scrollHeight + "px";
35
- return;
36
- }
37
- if (u.value = document.querySelector(e), !u.value) {
38
- console.warn(`[SwGuide] Элемент не найден: ${e}`);
39
- return;
40
- }
41
- V(u.value);
42
- const o = () => {
43
- if (p) {
44
- p = !1;
45
- return;
46
- }
47
- c();
48
- };
49
- c();
50
- const r = new ResizeObserver(c);
51
- r.observe(u.value), window.addEventListener("resize", o), window.addEventListener("scroll", o, { passive: !0 }), t(() => {
52
- r.disconnect(), window.removeEventListener("resize", o), window.removeEventListener("scroll", o);
53
- });
54
- }), N(() => window.onload = () => {
55
- var t;
56
- return u.value = document.querySelector((t = s.steps[l.value]) == null ? void 0 : t.tag);
57
- }), (t, e) => {
58
- const o = R("svg-icon");
59
- return M(), z("div", {
60
- class: "sw-gide",
61
- ref_key: "swGide",
62
- ref: n
63
- }, [
64
- e[6] || (e[6] = i("div", { class: "overlay0" }, null, -1)),
65
- e[7] || (e[7] = i("div", { class: "overlay1" }, null, -1)),
66
- a(B, {
67
- class: "gide",
68
- trigger: "none",
69
- placement: s.steps[l.value].placement,
70
- modelValue: y.value,
71
- "onUpdate:modelValue": e[2] || (e[2] = (r) => y.value = r),
72
- maxWidth: s.maxWidth
73
- }, {
74
- dropdown: d(() => [
75
- i("header", null, [
76
- m(t.$slots, "header", {}, () => [
77
- f(k(s.steps[l.value].header) + " ", 1),
78
- a(w, {
79
- type: "primary",
80
- link: "",
81
- onClick: x
82
- }, {
83
- default: d(() => [
84
- a(o, {
85
- "icon-class": s.iconClose
86
- }, null, 8, ["icon-class"])
87
- ]),
88
- _: 1
89
- })
90
- ])
91
- ]),
92
- m(t.$slots, "default", {}, () => {
93
- var r;
94
- return [
95
- i("div", null, k(s.steps[l.value].text), 1),
96
- i("img", {
97
- class: h(/left/.test((r = s.steps[l.value]) == null ? void 0 : r.placement) ? "reflect" : null),
98
- src: s.steps[l.value].img
99
- }, null, 10, G)
100
- ];
101
- }),
102
- i("footer", null, [
103
- m(t.$slots, "footer", {}, () => [
104
- a(w, {
105
- type: l.value === 0 ? "info" : "warning",
106
- text: "",
107
- link: "",
108
- onClick: e[0] || (e[0] = (r) => E(-1))
109
- }, {
110
- default: d(() => [
111
- m(t.$slots, "arrow", {}, () => [
112
- e[3] || (e[3] = f("‹"))
113
- ])
114
- ]),
115
- _: 3
116
- }, 8, ["type"]),
117
- a(w, {
118
- type: "success",
119
- onClick: e[1] || (e[1] = (r) => E(1)),
120
- text: "",
121
- link: "",
122
- class: "sw-revers"
123
- }, {
124
- default: d(() => [
125
- m(t.$slots, "arrow", {}, () => [
126
- e[4] || (e[4] = f("‹"))
127
- ])
128
- ]),
129
- _: 3
130
- })
131
- ])
132
- ])
133
- ]),
134
- default: d(() => [
135
- e[5] || (e[5] = i("div", { class: "hole" }, null, -1))
136
- ]),
137
- _: 3
138
- }, 8, ["placement", "modelValue", "maxWidth"]),
139
- e[8] || (e[8] = i("div", { class: "overlay2" }, null, -1)),
140
- e[9] || (e[9] = i("div", { class: "overlay3" }, null, -1))
141
- ], 512);
142
- };
143
- }
144
- };
145
- export {
146
- q as default
147
- };
@@ -1,58 +0,0 @@
1
- import { mergeModels as p, useModel as v, ref as g, useSlots as k, watch as w, nextTick as _, onUnmounted as y, resolveComponent as h, createElementBlock as c, openBlock as d, normalizeClass as S, createCommentVNode as V, renderSlot as l, createElementVNode as C, unref as E, createTextVNode as $, createVNode as m, toDisplayString as M, withCtx as N } from "vue";
2
- import L from "./SwButton-85-tKHA7.js";
3
- const x = ["open"], A = { key: 0 }, z = {
4
- __name: "SwMessage",
5
- props: /* @__PURE__ */ p({
6
- name: { type: String, default: "" },
7
- class: { type: String, default: "" },
8
- iconAfter: { type: String, default: "" }
9
- }, {
10
- modelValue: {},
11
- modelModifiers: {}
12
- }),
13
- emits: ["update:modelValue"],
14
- setup(a) {
15
- const t = v(a, "modelValue"), o = a, n = g(null), u = k(), s = (e) => {
16
- n.value && !n.value.contains(e.target) && (t.value = !1);
17
- };
18
- return w(() => t.value, async (e) => {
19
- e ? (await _(), window.addEventListener("click", s, !0)) : window.removeEventListener("click", s);
20
- }), y(() => {
21
- window.removeEventListener("click", s);
22
- }), (e, r) => {
23
- var i;
24
- const f = h("svg-icon");
25
- return d(), c("dialog", {
26
- open: t.value,
27
- class: S(["sw-message", o.class]),
28
- ref_key: "messageRef",
29
- ref: n
30
- }, [
31
- o.name.length > 0 || (i = E(u)) != null && i.header ? (d(), c("header", A, [
32
- l(e.$slots, "header", {}, () => [
33
- $(M(o.name) + " ", 1),
34
- m(L, {
35
- link: "",
36
- type: "primary",
37
- onClick: r[0] || (r[0] = (B) => t.value = !1)
38
- }, {
39
- default: N(() => [
40
- m(f, {
41
- "icon-class": o.iconAfter
42
- }, null, 8, ["icon-class"])
43
- ]),
44
- _: 1
45
- })
46
- ])
47
- ])) : V("", !0),
48
- l(e.$slots, "default"),
49
- C("footer", null, [
50
- l(e.$slots, "footer")
51
- ])
52
- ], 10, x);
53
- };
54
- }
55
- };
56
- export {
57
- z as default
58
- };
@@ -1,17 +0,0 @@
1
- import { ref as o, createElementBlock as r, openBlock as p } from "vue";
2
- const s = {
3
- __name: "SwPopover",
4
- setup(t) {
5
- const e = o(null);
6
- return (c, n) => (p(), r("div", {
7
- id: "my-Popover",
8
- class: "sw-popover",
9
- popover: "",
10
- ref_key: "Popover",
11
- ref: e
12
- }, null, 512));
13
- }
14
- };
15
- export {
16
- s as default
17
- };
@@ -1,181 +0,0 @@
1
- import { createElementBlock as d, openBlock as p, mergeProps as v, createElementVNode as b, ref as x, onMounted as D, onUnmounted as A, computed as C, createBlock as f, Transition as I, withCtx as $, createCommentVNode as E, normalizeClass as M, renderSlot as m, createTextVNode as N, toDisplayString as F, createApp as P, h as j, defineAsyncComponent as z } from "vue";
2
- function O(e) {
3
- return /^(https?:|mailto:|tel:)/.test(e);
4
- }
5
- function L(e, n) {
6
- if (arguments.length === 0 || !e)
7
- return null;
8
- const t = n || "{Y}-{m}-{d} {G}:{i}:{s}";
9
- let o;
10
- typeof e == "object" ? o = e : (typeof e == "string" && (/^[0-9]+$/.test(e) ? e = parseInt(e) : e = e.replace(new RegExp(/-/gm), "/")), typeof e == "number" && e.toString().length === 10 && (e = e * 1e3), o = new Date(e));
11
- const s = "ru-RU", r = {
12
- Y: o.getFullYear(),
13
- m: (o.getMonth() + 1).toString().padStart(2, "0"),
14
- d: o.getDate(),
15
- dd: o.getDate().toString().padStart(2, "0"),
16
- G: o.getHours(),
17
- H: o.getHours().toString().padStart(2, "0"),
18
- i: o.getMinutes().toString().padStart(2, "0"),
19
- s: o.getSeconds().toString().padStart(2, "0"),
20
- D: new Intl.DateTimeFormat(s, { weekday: "short" }).format(o),
21
- F: new Intl.DateTimeFormat(s, { month: "long" }).format(o),
22
- M: new Intl.DateTimeFormat(s, { month: "short" }).format(o)
23
- };
24
- return t.replace(/{(dd|[YmdGHisDFM])+}/g, (i, c) => r[c]);
25
- }
26
- const B = (e, n) => {
27
- const t = e.__vccOpts || e;
28
- for (const [o, s] of n)
29
- t[o] = s;
30
- return t;
31
- }, G = {
32
- name: "SvgIcon",
33
- props: {
34
- prefix: {
35
- type: String,
36
- default: "icon"
37
- },
38
- iconClass: {
39
- type: String,
40
- required: !0
41
- },
42
- className: {
43
- type: String,
44
- default: ""
45
- }
46
- },
47
- computed: {
48
- isExt() {
49
- return O(this.iconClass);
50
- }
51
- }
52
- }, H = ["href"];
53
- function Y(e, n, t, o, s, r) {
54
- return r.isExt ? (p(), d("div", v({
55
- key: 0,
56
- style: "mask: url(" + t.iconClass + ") no-repeat 50% 50%;",
57
- class: "svg-external-icon svg-icon"
58
- }, e.$attrs), null, 16)) : (p(), d("svg", v({
59
- key: 1,
60
- class: "svg-icon icon-" + (t.className || t.iconClass),
61
- "aria-hidden": "true"
62
- }, e.$attrs), [
63
- b("use", {
64
- href: "#" + t.prefix + "-" + t.iconClass
65
- }, null, 8, H)
66
- ], 16));
67
- }
68
- const w = /* @__PURE__ */ B(G, [["render", Y]]), _ = {
69
- __name: "SwAlert",
70
- props: {
71
- message: { type: String, default: "Default message" },
72
- before: { type: String, default: "" },
73
- class: { type: String, default: "" },
74
- after: { type: String, default: "" },
75
- size: { type: String, default: "" },
76
- duration: { type: Number, default: 6e3 },
77
- type: { type: String, default: "info", validator: (e) => ["success", "warning", "error", "info"].includes(e) }
78
- },
79
- emits: ["closed"],
80
- setup(e, { emit: n }) {
81
- const t = e, o = n, s = x(!1);
82
- let r = null;
83
- const i = () => {
84
- s.value = !0, S();
85
- }, c = () => {
86
- s.value = !1, o("closed");
87
- }, a = () => {
88
- r && (clearTimeout(r), r = null);
89
- }, k = () => {
90
- S();
91
- }, S = () => {
92
- r = setTimeout(c, t.duration);
93
- };
94
- D(() => {
95
- i();
96
- }), A(() => {
97
- r && clearTimeout(r);
98
- });
99
- const T = C(() => {
100
- const l = ["sw-alert"];
101
- return t.size.length > 0 && l.push(`sw-${t.size}`), t.type.length > 0 && l.push(`sw-${t.type}`), t.class.length > 0 && l.push(t.class), l;
102
- });
103
- return (l, V) => (p(), f(I, { name: "fade" }, {
104
- default: $(() => [
105
- s.value ? (p(), d("div", {
106
- key: 0,
107
- class: M(T.value),
108
- onMouseenter: a,
109
- onMouseleave: k
110
- }, [
111
- t.before.length > 0 ? (p(), f(w, {
112
- key: 0,
113
- "icon-class": t.before
114
- }, null, 8, ["icon-class"])) : m(l.$slots, "prefix", { key: 1 }),
115
- m(l.$slots, "default", {}, () => [
116
- N(F(t.message), 1)
117
- ]),
118
- t.after.length > 0 ? (p(), f(w, {
119
- key: 2,
120
- "icon-class": t.after,
121
- onClick: c
122
- }, null, 8, ["icon-class"])) : m(l.$slots, "suffix", { key: 3 }),
123
- b("footer", null, [
124
- m(l.$slots, "footer")
125
- ])
126
- ], 34)) : E("", !0)
127
- ]),
128
- _: 3
129
- }));
130
- }
131
- }, U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
132
- __proto__: null,
133
- default: _
134
- }, Symbol.toStringTag, { value: "Module" }));
135
- let u = document.querySelector("div.sw-alert-wrapper");
136
- function y(e = {}) {
137
- u || (u = document.createElement("div"), u.className = "sw-alert-wrapper", document.body.appendChild(u));
138
- const {
139
- prefix: n,
140
- suffix: t,
141
- footer: o,
142
- ...s
143
- } = e, r = (a) => a == null ? null : typeof a == "function" ? a : typeof a == "string" ? () => [a] : Array.isArray(a) ? () => a : () => [a], i = P({
144
- setup() {
145
- return () => j(
146
- _,
147
- {
148
- ...s,
149
- onClose: () => {
150
- u.removeChild(i._container), i.unmount();
151
- }
152
- },
153
- {
154
- ...n != null && { prefix: r(n) },
155
- ...t != null && { suffix: r(t) },
156
- ...o != null && { footer: r(o) }
157
- }
158
- );
159
- }
160
- }), c = i.mount(document.createElement("div"));
161
- u.appendChild(c.$el);
162
- }
163
- const h = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => U), "./components/SwButton.vue": () => import("./SwButton-85-tKHA7.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CuN3EbT6.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-CTItdbBt.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-DQGTnnKw.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-BfNgJeEd.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CaA4jsoa.js"), "./components/SwGide.vue": () => import("./SwGide-UeJonHcR.js"), "./components/SwInput.vue": () => import("./SwInput-DP-7d70M.js"), "./components/SwMessage.vue": () => import("./SwMessage-DKatZOJ6.js"), "./components/SwPopover.vue": () => import("./SwPopover-Cx6oUK0x.js"), "./components/SwSection.vue": () => import("./SwSection-D8ooQ21I.js"), "./components/SwSelect.vue": () => import("./SwSelect-C2RKinez.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-B7ysp8L9.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-6rl1IT4p.js"), "./components/SwTable.vue": () => import("./SwTable-BLrFhlyO.js"), "./components/SwTableColumn.vue": () => import("./SwTableColumn-BLF5bPuJ.js"), "./components/SwTabs.vue": () => import("./SwTabs-DkSI4oAh.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-Dwtj8g7T.js") }), g = {};
164
- for (const e in h) {
165
- const n = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (t, o) => o.toUpperCase());
166
- g[n] = z(() => h[e]());
167
- }
168
- const R = {
169
- install(e) {
170
- Object.keys(g).forEach((n) => {
171
- e.component(n, g[n]);
172
- }), e.config.globalProperties.$Alert = y, e.provide("Alert", y);
173
- }
174
- };
175
- export {
176
- y as A,
177
- R as L,
178
- w as S,
179
- g as c,
180
- L as p
181
- };