@studio-west/component-sw 0.0.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.
- package/README.md +5 -0
- package/dist/SwButton-CQh1Mtze.js +30 -0
- package/dist/SwCollapse-CjL9dpO-.js +24 -0
- package/dist/SwDropdown-CngCMKee.js +85 -0
- package/dist/SwDropdownItem-C3_wJ1DL.js +32 -0
- package/dist/SwFormItem-CgahR93o.js +25 -0
- package/dist/SwInput-DpflrHQm.js +120 -0
- package/dist/SwMessage-BGIOC-zp.js +53 -0
- package/dist/SwSection-CaY8OFmf.js +34 -0
- package/dist/SwSkeleton-DWILNFfF.js +28 -0
- package/dist/SwSkeletonItem-CU7LvihY.js +29 -0
- package/dist/SwSwitch-375THfdW.js +41 -0
- package/dist/SwTabs-BBUJ5wnR.js +31 -0
- package/dist/SwTabsPane-BUUmFjh7.js +25 -0
- package/dist/component-sw.css +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +9 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Vue 3 + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { computed as n, createElementBlock as o, openBlock as a, normalizeClass as u, renderSlot as p } from "vue";
|
|
2
|
+
const i = {
|
|
3
|
+
__name: "SwButton",
|
|
4
|
+
props: {
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
size: { type: String, default: "" },
|
|
7
|
+
// large, small
|
|
8
|
+
type: { type: String, default: "" },
|
|
9
|
+
// primary, success, info, warning, danger,
|
|
10
|
+
round: { type: Boolean, default: !1 },
|
|
11
|
+
text: { type: Boolean, default: !1 },
|
|
12
|
+
link: { type: Boolean, default: !1 }
|
|
13
|
+
},
|
|
14
|
+
setup(s) {
|
|
15
|
+
const e = s, l = n(
|
|
16
|
+
() => {
|
|
17
|
+
let t = ["sw-button"];
|
|
18
|
+
return e.size.length > 0 && t.push("sw-" + e.size), e.type.length > 0 && t.push("sw-" + e.type), e.round && t.push("sw-round"), e.text && t.push("sw-text"), e.link && t.push("sw-link"), e.class.length > 0 && t.push(e.class), t;
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
return (t, r) => (a(), o("button", {
|
|
22
|
+
class: u(l.value)
|
|
23
|
+
}, [
|
|
24
|
+
p(t.$slots, "default")
|
|
25
|
+
], 2));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
i as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { onMounted as a, computed as r, ref as n, createElementBlock as p, openBlock as c, normalizeStyle as u, normalizeClass as i, renderSlot as f } from "vue";
|
|
2
|
+
const v = {
|
|
3
|
+
__name: "SwCollapse",
|
|
4
|
+
props: {
|
|
5
|
+
visual: { type: Boolean, default: !0 }
|
|
6
|
+
},
|
|
7
|
+
setup(t) {
|
|
8
|
+
a(() => {
|
|
9
|
+
o.value = "0px";
|
|
10
|
+
});
|
|
11
|
+
const e = n("0px"), l = t, o = r(() => l.visual ? `${e.value.scrollHeight}px` : "0px");
|
|
12
|
+
return (s, m) => (c(), p("div", {
|
|
13
|
+
class: i(["sw-collapse", { open: l.visual }]),
|
|
14
|
+
style: u({ height: o.value }),
|
|
15
|
+
ref_key: "collapse",
|
|
16
|
+
ref: e
|
|
17
|
+
}, [
|
|
18
|
+
f(s.$slots, "default")
|
|
19
|
+
], 6));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
v as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ref as c, computed as E, onMounted as R, onUnmounted as L, createElementBlock as g, openBlock as r, normalizeClass as v, renderSlot as y, createBlock as W, Teleport as $, createCommentVNode as C, normalizeStyle as B, nextTick as T } from "vue";
|
|
2
|
+
const O = {
|
|
3
|
+
__name: "SwDropdown",
|
|
4
|
+
props: {
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
size: { type: String, default: "" },
|
|
7
|
+
type: { type: String, default: "" },
|
|
8
|
+
trigger: { type: String, default: "click" },
|
|
9
|
+
placement: { type: String, default: "bottom-left" },
|
|
10
|
+
maxWidth: { type: Number, default: 0 }
|
|
11
|
+
},
|
|
12
|
+
setup(k) {
|
|
13
|
+
const n = k, l = c(!1), s = c(null), a = c(null), u = c({}), b = E(
|
|
14
|
+
() => {
|
|
15
|
+
let e = ["sw-dropdown"];
|
|
16
|
+
return n.size.length > 0 && e.push("sw-" + n.size), n.type.length > 0 && e.push("sw-" + n.type), e;
|
|
17
|
+
}
|
|
18
|
+
), d = async () => {
|
|
19
|
+
if (await T(), !a.value) return;
|
|
20
|
+
const e = s.value.getBoundingClientRect(), i = window.pageYOffset || document.documentElement.scrollTop, w = window.pageXOffset || document.documentElement.scrollLeft, p = a.value.offsetHeight, h = a.value.offsetWidth;
|
|
21
|
+
let t = e.left + e.width / 2 + w, o = e.bottom - e.height / 2 + i;
|
|
22
|
+
const [x, z] = n.placement.split("-", 2);
|
|
23
|
+
switch (console.log(n.placement), x) {
|
|
24
|
+
case "bottom":
|
|
25
|
+
o = o + e.height / 2 + 8;
|
|
26
|
+
break;
|
|
27
|
+
case "top":
|
|
28
|
+
o = o - e.height / 2 - 8 - p;
|
|
29
|
+
break;
|
|
30
|
+
case "left":
|
|
31
|
+
t = t - h - e.width / 2 - 10, o = o - p / 2;
|
|
32
|
+
break;
|
|
33
|
+
case "right":
|
|
34
|
+
t = t + e.width / 2 + 8, o = o - p / 2;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
switch (z) {
|
|
38
|
+
case "left":
|
|
39
|
+
t = t - h + e.width / 2;
|
|
40
|
+
break;
|
|
41
|
+
case "right":
|
|
42
|
+
t = t - e.width / 2;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
t < 0 && (t = 0), o < 0 && (o = 0), u.value = {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
top: `${o}px`,
|
|
48
|
+
left: `${t}px`,
|
|
49
|
+
maxWidth: n.maxWidth === 0 ? "" : `${n.maxWidth}px`
|
|
50
|
+
};
|
|
51
|
+
}, S = async () => {
|
|
52
|
+
l.value = !l.value, l.value && await d();
|
|
53
|
+
}, f = () => {
|
|
54
|
+
l.value && d();
|
|
55
|
+
}, m = (e) => {
|
|
56
|
+
s.value && !s.value.contains(e.target) && (l.value = !1);
|
|
57
|
+
};
|
|
58
|
+
return R(() => {
|
|
59
|
+
document.addEventListener("click", m), window.addEventListener("resize", f);
|
|
60
|
+
}), L(() => {
|
|
61
|
+
document.removeEventListener("click", m), window.removeEventListener("resize", f);
|
|
62
|
+
}), (e, i) => (r(), g("div", {
|
|
63
|
+
class: v(b.value),
|
|
64
|
+
onClick: i[0] || (i[0] = (w) => S()),
|
|
65
|
+
ref_key: "dropdownRef",
|
|
66
|
+
ref: s
|
|
67
|
+
}, [
|
|
68
|
+
y(e.$slots, "default"),
|
|
69
|
+
(r(), W($, { to: "body" }, [
|
|
70
|
+
l.value ? (r(), g("ul", {
|
|
71
|
+
key: 0,
|
|
72
|
+
ref_key: "popupRef",
|
|
73
|
+
ref: a,
|
|
74
|
+
class: v(["sw-dropdown-popup", n.class]),
|
|
75
|
+
style: B(u.value)
|
|
76
|
+
}, [
|
|
77
|
+
y(e.$slots, "dropdown")
|
|
78
|
+
], 6)) : C("", !0)
|
|
79
|
+
]))
|
|
80
|
+
], 2));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
O as default
|
|
85
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { computed as l, resolveComponent as c, createElementBlock as r, openBlock as a, normalizeClass as i, createVNode as p, renderSlot as u } from "vue";
|
|
2
|
+
const m = {
|
|
3
|
+
__name: "SwDropdownItem",
|
|
4
|
+
props: {
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
size: { type: String, default: "" },
|
|
7
|
+
// large, small
|
|
8
|
+
type: { type: String, default: "" },
|
|
9
|
+
// primary, success, info, warning, danger,
|
|
10
|
+
iconBefore: { type: String, default: "" }
|
|
11
|
+
},
|
|
12
|
+
setup(s) {
|
|
13
|
+
const e = s, n = l(
|
|
14
|
+
() => {
|
|
15
|
+
let t = ["sw-dropdown-item"];
|
|
16
|
+
return e.size.length > 0 && t.push("sw-" + e.size), e.type.length > 0 && t.push("sw-" + e.type), e.class.length > 0 && t.push(e.class), t;
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
return (t, f) => {
|
|
20
|
+
const o = c("svg-icon");
|
|
21
|
+
return a(), r("li", {
|
|
22
|
+
class: i(n.value)
|
|
23
|
+
}, [
|
|
24
|
+
p(o, { "icon-class": s.iconBefore }, null, 8, ["icon-class"]),
|
|
25
|
+
u(t.$slots, "default")
|
|
26
|
+
], 2);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
m as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { computed as r, createElementBlock as o, openBlock as a, normalizeClass as n, renderSlot as p } from "vue";
|
|
2
|
+
const m = {
|
|
3
|
+
__name: "SwFormItem",
|
|
4
|
+
props: {
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
type: { type: String, default: "" }
|
|
7
|
+
// start, end, around
|
|
8
|
+
},
|
|
9
|
+
setup(s) {
|
|
10
|
+
const t = s, l = r(
|
|
11
|
+
() => {
|
|
12
|
+
let e = ["sw-form-item"];
|
|
13
|
+
return t.type.length > 0 && e.push("sw-" + t.type), t.class.length > 0 && e.push(t.class), e;
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
return (e, c) => (a(), o("div", {
|
|
17
|
+
class: n(l.value)
|
|
18
|
+
}, [
|
|
19
|
+
p(e.$slots, "default")
|
|
20
|
+
], 2));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
m as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createElementBlock as i, openBlock as a, mergeProps as d, createElementVNode as c, mergeModels as p, useModel as _, ref as b, computed as C, normalizeClass as V, createBlock as m, renderSlot as y, createCommentVNode as z, withDirectives as E, createTextVNode as N, toDisplayString as $, vModelDynamic as q } from "vue";
|
|
2
|
+
function w(l) {
|
|
3
|
+
return /^(https?:|mailto:|tel:)/.test(l);
|
|
4
|
+
}
|
|
5
|
+
const B = (l, r) => {
|
|
6
|
+
const t = l.__vccOpts || l;
|
|
7
|
+
for (const [e, s] of r)
|
|
8
|
+
t[e] = s;
|
|
9
|
+
return t;
|
|
10
|
+
}, M = {
|
|
11
|
+
name: "SvgIcon",
|
|
12
|
+
props: {
|
|
13
|
+
prefix: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "icon"
|
|
16
|
+
},
|
|
17
|
+
iconClass: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: !0
|
|
20
|
+
},
|
|
21
|
+
className: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
isExt() {
|
|
28
|
+
return w(this.iconClass);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, D = ["href"];
|
|
32
|
+
function I(l, r, t, e, s, u) {
|
|
33
|
+
return u.isExt ? (a(), i("div", d({
|
|
34
|
+
key: 0,
|
|
35
|
+
style: "mask: url(" + t.iconClass + ") no-repeat 50% 50%;",
|
|
36
|
+
class: "svg-external-icon svg-icon"
|
|
37
|
+
}, l.$attrs), null, 16)) : (a(), i("svg", d({
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "svg-icon " + t.className,
|
|
40
|
+
"aria-hidden": "true"
|
|
41
|
+
}, l.$attrs), [
|
|
42
|
+
c("use", {
|
|
43
|
+
href: "#" + t.prefix + "-" + t.iconClass
|
|
44
|
+
}, null, 8, D)
|
|
45
|
+
], 16));
|
|
46
|
+
}
|
|
47
|
+
const g = /* @__PURE__ */ B(M, [["render", I]]), A = ["for"], F = ["placeholder", "type", "id", "name"], P = {
|
|
48
|
+
__name: "SwInput",
|
|
49
|
+
props: /* @__PURE__ */ p({
|
|
50
|
+
before: { type: String, default: "" },
|
|
51
|
+
after: { type: String, default: "" },
|
|
52
|
+
placeholder: { type: String, default: "" },
|
|
53
|
+
label: { type: String, default: "" },
|
|
54
|
+
name: { type: String, required: !0 },
|
|
55
|
+
class: { type: String, default: "" },
|
|
56
|
+
size: { type: String, default: "" },
|
|
57
|
+
type: { type: String, default: "text" }
|
|
58
|
+
}, {
|
|
59
|
+
modelValue: {},
|
|
60
|
+
modelModifiers: {}
|
|
61
|
+
}),
|
|
62
|
+
emits: /* @__PURE__ */ p(["suffix"], ["update:modelValue"]),
|
|
63
|
+
setup(l, { emit: r }) {
|
|
64
|
+
var f;
|
|
65
|
+
const t = _(l, "modelValue"), e = l, s = b(null), u = r, v = () => {
|
|
66
|
+
s.value !== null && (s.value.style.top = "-.6em");
|
|
67
|
+
}, h = () => {
|
|
68
|
+
var n;
|
|
69
|
+
((n = t.value) == null ? void 0 : n.length) == 0 && s.value !== null && s.value.removeAttribute("style");
|
|
70
|
+
};
|
|
71
|
+
((f = t.value) == null ? void 0 : f.length) > 0 && s.value !== null && (s.value.style.top = "-.6em");
|
|
72
|
+
const S = () => {
|
|
73
|
+
u("suffix");
|
|
74
|
+
}, k = C(
|
|
75
|
+
() => {
|
|
76
|
+
let n = ["sw-input"];
|
|
77
|
+
return e.size.length > 0 && n.push("sw-" + e.size), e.class.length > 0 && n.push(e.class), n;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
return (n, o) => (a(), i("div", {
|
|
81
|
+
class: V(k.value)
|
|
82
|
+
}, [
|
|
83
|
+
e.before.length > 0 ? (a(), m(g, {
|
|
84
|
+
key: 0,
|
|
85
|
+
"icon-class": e.before
|
|
86
|
+
}, null, 8, ["icon-class"])) : y(n.$slots, "prefix", { key: 1 }),
|
|
87
|
+
e.label.length > 0 ? (a(), i("label", {
|
|
88
|
+
key: 2,
|
|
89
|
+
for: e.name,
|
|
90
|
+
ref_key: "lab",
|
|
91
|
+
ref: s
|
|
92
|
+
}, [
|
|
93
|
+
N($(e.label), 1),
|
|
94
|
+
o[1] || (o[1] = c("span", { title: "Это поле обязательно для заполнения." }, "*", -1))
|
|
95
|
+
], 8, A)) : z("", !0),
|
|
96
|
+
E(c("input", {
|
|
97
|
+
"onUpdate:modelValue": o[0] || (o[0] = (x) => t.value = x),
|
|
98
|
+
required: "required",
|
|
99
|
+
placeholder: e.placeholder,
|
|
100
|
+
type: e.type,
|
|
101
|
+
id: e.name,
|
|
102
|
+
name: e.name,
|
|
103
|
+
size: "60",
|
|
104
|
+
onFocus: v,
|
|
105
|
+
onBlur: h,
|
|
106
|
+
maxlength: "128"
|
|
107
|
+
}, null, 40, F), [
|
|
108
|
+
[q, t.value]
|
|
109
|
+
]),
|
|
110
|
+
e.after.length > 0 ? (a(), m(g, {
|
|
111
|
+
key: 3,
|
|
112
|
+
"icon-class": e.after,
|
|
113
|
+
onClick: S
|
|
114
|
+
}, null, 8, ["icon-class"])) : y(n.$slots, "suffix", { key: 4 })
|
|
115
|
+
], 2));
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
P as default
|
|
120
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mergeModels as c, useModel as p, ref as g, resolveComponent as y, createElementBlock as r, createCommentVNode as a, openBlock as m, normalizeClass as k, renderSlot as s, createElementVNode as v, createTextVNode as i, createVNode as d, toDisplayString as V, withCtx as S } from "vue";
|
|
2
|
+
import _ from "./SwButton-CQh1Mtze.js";
|
|
3
|
+
const C = { key: 0 }, w = {
|
|
4
|
+
__name: "SwMessage",
|
|
5
|
+
props: /* @__PURE__ */ c({
|
|
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(l) {
|
|
15
|
+
const n = p(l, "modelValue"), e = l, f = g(null);
|
|
16
|
+
return (o, t) => {
|
|
17
|
+
const u = y("svg-icon");
|
|
18
|
+
return n.value ? (m(), r("div", {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: k(["sw-message", e.class]),
|
|
21
|
+
ref_key: "messageRef",
|
|
22
|
+
ref: f
|
|
23
|
+
}, [
|
|
24
|
+
e.name.length > 0 ? (m(), r("header", C, [
|
|
25
|
+
s(o.$slots, "header", {}, () => [
|
|
26
|
+
i(V(e.name) + " ", 1),
|
|
27
|
+
d(_, {
|
|
28
|
+
link: "",
|
|
29
|
+
type: "primary",
|
|
30
|
+
onClick: t[0] || (t[0] = ($) => n.value = !1)
|
|
31
|
+
}, {
|
|
32
|
+
default: S(() => [
|
|
33
|
+
d(u, {
|
|
34
|
+
"icon-class": e.iconAfter
|
|
35
|
+
}, null, 8, ["icon-class"])
|
|
36
|
+
]),
|
|
37
|
+
_: 1
|
|
38
|
+
})
|
|
39
|
+
])
|
|
40
|
+
])) : a("", !0),
|
|
41
|
+
s(o.$slots, "default", {}, () => [
|
|
42
|
+
t[1] || (t[1] = i("111222"))
|
|
43
|
+
]),
|
|
44
|
+
v("footer", null, [
|
|
45
|
+
s(o.$slots, "footer")
|
|
46
|
+
])
|
|
47
|
+
], 2)) : a("", !0);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
w as default
|
|
53
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { resolveComponent as r, createElementBlock as a, openBlock as c, normalizeClass as i, createElementVNode as n, renderSlot as o, createTextVNode as p, createVNode as d, toDisplayString as f } from "vue";
|
|
2
|
+
const S = {
|
|
3
|
+
__name: "SwSection",
|
|
4
|
+
props: {
|
|
5
|
+
name: { type: String, default: "" },
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
iconAfter: { type: String, default: "" }
|
|
8
|
+
},
|
|
9
|
+
setup(s) {
|
|
10
|
+
const e = s;
|
|
11
|
+
return (t, m) => {
|
|
12
|
+
const l = r("svg-icon");
|
|
13
|
+
return c(), a("section", {
|
|
14
|
+
class: i(e.class)
|
|
15
|
+
}, [
|
|
16
|
+
n("header", null, [
|
|
17
|
+
o(t.$slots, "header", {}, () => [
|
|
18
|
+
p(f(e.name) + " ", 1),
|
|
19
|
+
d(l, {
|
|
20
|
+
"icon-class": e.iconAfter
|
|
21
|
+
}, null, 8, ["icon-class"])
|
|
22
|
+
])
|
|
23
|
+
]),
|
|
24
|
+
o(t.$slots, "default"),
|
|
25
|
+
n("footer", null, [
|
|
26
|
+
o(t.$slots, "footer")
|
|
27
|
+
])
|
|
28
|
+
], 2);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
S as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { renderSlot as l, createElementBlock as a, createTextVNode as r, openBlock as n, normalizeClass as i, createVNode as m } from "vue";
|
|
2
|
+
import p from "./SwSkeletonItem-CU7LvihY.js";
|
|
3
|
+
const u = {
|
|
4
|
+
__name: "SwSkeleton",
|
|
5
|
+
props: {
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
visual: { type: Boolean, default: !1 }
|
|
8
|
+
},
|
|
9
|
+
setup(o) {
|
|
10
|
+
const e = o;
|
|
11
|
+
return (s, t) => e.visual ? l(s.$slots, "default", { key: 0 }, () => [
|
|
12
|
+
t[0] || (t[0] = r("1"))
|
|
13
|
+
]) : (n(), a("div", {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: i(["sw-skeleton", e.class])
|
|
16
|
+
}, [
|
|
17
|
+
l(s.$slots, "skeleton", {}, () => [
|
|
18
|
+
m(p, {
|
|
19
|
+
animate: "",
|
|
20
|
+
size: "small"
|
|
21
|
+
})
|
|
22
|
+
])
|
|
23
|
+
], 2));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
u as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { computed as s, createElementBlock as a, openBlock as n, normalizeStyle as r, normalizeClass as c, createCommentVNode as u } from "vue";
|
|
2
|
+
const m = { key: 0 }, f = {
|
|
3
|
+
__name: "SwSkeletonItem",
|
|
4
|
+
props: {
|
|
5
|
+
width: { type: String, default: "100" },
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
animate: { type: Boolean, default: !1 },
|
|
8
|
+
size: { type: String, default: "" }
|
|
9
|
+
},
|
|
10
|
+
setup(l) {
|
|
11
|
+
const e = l, i = s(
|
|
12
|
+
() => {
|
|
13
|
+
let t = ["sw-skeleton-item"];
|
|
14
|
+
return e.size.length > 0 && t.push("sw-" + e.size), e.animate && t.push("sw-animate"), e.class.length > 0 && t.push(e.class), t;
|
|
15
|
+
}
|
|
16
|
+
), o = s(() => ({
|
|
17
|
+
width: e.width + "%"
|
|
18
|
+
}));
|
|
19
|
+
return (t, p) => (n(), a("div", {
|
|
20
|
+
class: c(i.value),
|
|
21
|
+
style: r(o.value)
|
|
22
|
+
}, [
|
|
23
|
+
e.animate ? (n(), a("div", m)) : u("", !0)
|
|
24
|
+
], 6));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
f as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mergeModels as n, useModel as i, createElementBlock as r, openBlock as c, normalizeClass as u, withDirectives as f, createElementVNode as o, renderSlot as m, vModelCheckbox as p } from "vue";
|
|
2
|
+
const b = ["name", "id"], S = ["for", "data-onlabel", "data-offlabel"], w = {
|
|
3
|
+
__name: "SwSwitch",
|
|
4
|
+
props: /* @__PURE__ */ n({
|
|
5
|
+
id: { type: String, default: "checkbox" },
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
name: { type: String, default: "" },
|
|
8
|
+
on: { type: String, default: "" },
|
|
9
|
+
off: { type: String, default: "" }
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: {},
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(l) {
|
|
16
|
+
const t = i(l, "modelValue"), e = l;
|
|
17
|
+
return (s, a) => (c(), r("div", {
|
|
18
|
+
class: u(["sw-switch", e.class])
|
|
19
|
+
}, [
|
|
20
|
+
f(o("input", {
|
|
21
|
+
type: "checkbox",
|
|
22
|
+
name: e.name,
|
|
23
|
+
class: "sw-control",
|
|
24
|
+
id: e.id,
|
|
25
|
+
"onUpdate:modelValue": a[0] || (a[0] = (d) => t.value = d)
|
|
26
|
+
}, null, 8, b), [
|
|
27
|
+
[p, t.value]
|
|
28
|
+
]),
|
|
29
|
+
o("label", {
|
|
30
|
+
for: e.id,
|
|
31
|
+
class: "sw-label",
|
|
32
|
+
"data-onlabel": e.on,
|
|
33
|
+
"data-offlabel": e.off
|
|
34
|
+
}, null, 8, S),
|
|
35
|
+
m(s.$slots, "default")
|
|
36
|
+
], 2));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
w as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { mergeModels as c, ref as i, useModel as p, useSlots as f, provide as u, createElementBlock as s, openBlock as o, normalizeClass as m, createElementVNode as v, renderSlot as _, Fragment as b, renderList as S, toDisplayString as k } from "vue";
|
|
2
|
+
const g = ["onClick"], C = {
|
|
3
|
+
__name: "SwTabs",
|
|
4
|
+
props: /* @__PURE__ */ c({
|
|
5
|
+
name: { type: String },
|
|
6
|
+
class: { type: String, default: "" }
|
|
7
|
+
}, {
|
|
8
|
+
modelValue: {},
|
|
9
|
+
modelModifiers: {}
|
|
10
|
+
}),
|
|
11
|
+
emits: /* @__PURE__ */ c(["tab-click"], ["update:modelValue"]),
|
|
12
|
+
setup(r, { emit: y }) {
|
|
13
|
+
i(0);
|
|
14
|
+
const e = i([]), d = r, t = p(r, "modelValue");
|
|
15
|
+
return e.value = f().default().filter((l) => l.type.__name === "SwTabsPane"), u("activeTab", t), u("tabs", e), (l, V) => (o(), s("div", {
|
|
16
|
+
class: m("sw-tabs " + d.class)
|
|
17
|
+
}, [
|
|
18
|
+
v("header", null, [
|
|
19
|
+
(o(!0), s(b, null, S(e.value, (n, a) => (o(), s("span", {
|
|
20
|
+
key: a,
|
|
21
|
+
class: m([{ active: t.value === a }]),
|
|
22
|
+
onClick: (h) => t.value = a
|
|
23
|
+
}, k(n.props.label || n.props.title), 11, g))), 128))
|
|
24
|
+
]),
|
|
25
|
+
_(l.$slots, "default")
|
|
26
|
+
], 2));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
C as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { inject as n, computed as i, createElementBlock as l, createCommentVNode as u, openBlock as p, renderSlot as d } from "vue";
|
|
2
|
+
const m = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "tab-content"
|
|
5
|
+
}, _ = {
|
|
6
|
+
__name: "SwTabsPane",
|
|
7
|
+
props: {
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: !0
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup(o) {
|
|
14
|
+
const s = o, a = n("activeTab"), c = n("tabs"), r = i(() => {
|
|
15
|
+
const e = c.value.findIndex((t) => t.props.title === s.title);
|
|
16
|
+
return a.value === e;
|
|
17
|
+
});
|
|
18
|
+
return (e, t) => r.value ? (p(), l("div", m, [
|
|
19
|
+
d(e.$slots, "default")
|
|
20
|
+
])) : u("", !0);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
_ as default
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--sw-color-default: #DFDFDF;--sw-color-primary: #3EAF4E;--sw-color-success: #FFE603;--sw-color-info: #C0C0C0;--sw-color-warning: #FF7A00;--sw-color-danger: #CC2D4A;--sw-text-color-primary: #333333;--sw-text-color-secondary: #4C4C4C;--sw-text-color-third: #818181;--sw-text-color-revers: white;--sw-bg-color: #f4f4f4;--sw-bg-color-page: white;--sw-bg-color-second: #FAFAFA;--sw-border-color: #D6D6D6;--sw-border-color-input: #CECECE;--sw-font-size: 1rem;--sw-font-size-small: .875rem;--sw-font-size-large: 1.125rem;--sw-font-size-big: 2.8rem;--sw-border-radius: .625rem;--sw-border-round: 3.625rem;--sw-component-size-base: 3rem;--sw-component-size-small: 1.625rem;--sw-component-size-large: 3.5rem;font-family:Montserrat,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color:var(--sw-text-color-primary);background-color:var(--sw-bg-color);font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme: dark){:root{--sw-color-default: #4E4E4E;--sw-color-primary: #38A151;--sw-color-success: #FFE603;--sw-color-info: #808185;--sw-color-warning: #FF7A00;--sw-color-danger: #CC2D4A;--sw-text-color-primary: white;--sw-text-color-secondary: #FAFAFA;--sw-text-color-third: #FAFAFA;--sw-text-color-revers: white;--sw-bg-color: #182127;--sw-bg-color-page: #323741;--sw-bg-color-second: #232832;--sw-border-color: #4E4E4E;--sw-border-color-input: #5C5E63;--sw-shadow: 0 100px 80px rgba(0, 0, 0, .03), 0 41.7776px 33.4221px rgba(0, 0, 0, .0215656), 0 22.3363px 17.869px rgba(0, 0, 0, .0178832), 0 12.5216px 10.0172px rgba(0, 0, 0, .015), 0 6.6501px 5.32008px rgba(0, 0, 0, .0121168), 0 2.76726px 2.21381px rgba(0, 0, 0, .00843437)}}.sw-tabs{-webkit-user-select:none;user-select:none}.sw-tabs>header{display:flex;border-bottom:2px solid var(--sw-color-info);color:var(--sw-color-info);-webkit-user-select:none;user-select:none;font-size:var(--sw-font-size-small);font-weight:400;margin-bottom:1.25rem;transition:all .6s ease-out}.sw-tabs>header span{position:relative;top:2px;border-radius:0;padding:5px;cursor:pointer;border:none;background:none;outline:none}.sw-tabs>header span.active{border-bottom:2px solid var(--sw-color-primary);color:var(--sw-color-primary);font-weight:700}.sw-tabs>header span:hover:not(.active){color:var(--sw-border-color)}.sw-input{display:flex;align-items:center;position:relative;gap:0 1.75rem;padding:0 1.2em;border:1px solid var(--sw-border-color-input);border-radius:var(--sw-border-radius)}.sw-input input{line-height:var(--sw-component-size-base);border:none;width:100%;font-size:var(--sw-font-size-large);background:none;outline:none}.sw-input .svg-icon{font-size:20px;color:var(--sw-text-color-third)}.sw-input>svg+label{left:4rem}.sw-input.sw-small input{line-height:var(--sw-component-size-small)}.sw-input.sw-large input{line-height:var(--sw-component-size-large)}.sw-button{border-radius:1rem;border:1px solid var(--sw-color-default);padding:0 1.2em;min-height:var(--sw-component-size-base);font-size:var(--sw-font-size);font-weight:500;cursor:pointer;transition:border-color .25s;background-color:var(--sw-color-default);color:var(--sw-text-color-revers)}.sw-form-item{display:flex;justify-content:space-between;font-size:var(--sw-font-size-small);color:var(--sw-text-color-secondary);gap:1rem}.sw-form-item.sw-start{justify-content:flex-start}.sw-form-item.sw-end{justify-content:flex-end}.sw-form-item.sw-around{justify-content:space-around}.sw-dropdown{position:relative;display:inline-block}.sw-dropdown-popup{z-index:3;padding:8px;min-width:200px;margin:0;background-color:var(--sw-bg-color-second);border:1px solid var(--sw-border-color);border-radius:4px;box-shadow:0 2px 8px #0000001a}.sw-dropdown-item{display:block}.sw-dropdown-item svg{margin-right:.5rem}.sw-dropdown-item:hover{color:var(--sw-color-primary)}.sw-collapse{transition:all .3s ease-out;overflow:hidden;box-sizing:border-box;margin:0}.sw-switch{display:inline-flex;align-items:center;box-sizing:border-box;-webkit-user-select:none;user-select:none}.sw-switch>input{display:none}.sw-switch>input:checked+label{background-color:var(--sw-color-primary)}.sw-switch>input:checked+label:before{color:var(--sw-text-color-revers);content:attr(data-onlabel);left:.5rem;right:auto}.sw-switch>input:checked+label:after{background:#f7f7f7;left:2.125rem}.sw-switch>label{background-color:var(--sw-color-info);border-radius:1rem;cursor:pointer;flex:0 0 4rem;height:1.75rem;margin:.5rem;position:relative;transition:all .3s;width:4rem}.sw-switch>label:before{color:var(--sw-text-color-revers);content:attr(data-offlabel);display:block;font-size:1rem;position:absolute;right:.5rem;transition:all .3s}.sw-switch>label:after{background:var(--sw-text-color-revers);border:1px solid var(--sw-color-info);border-radius:50%;content:"";height:2rem;left:-.125rem;position:absolute;top:-.125rem;transition:all .3s;width:2rem}.sw-skeleton{display:flex;gap:.5rem;flex-wrap:wrap;align-items:flex-end}.sw-skeleton-item{min-height:var(--sw-component-size-base);width:100%;background:var(--sw-bg-color-second);border-radius:var(--sw-border-radius);border:1px solid var(--sw-bg-color);box-sizing:border-box;overflow:hidden;position:relative}.sw-skeleton-item>div{height:100%;width:10px;background:var(--sw-border-color-input);display:inline-block;animation:sw-skeleton 3s linear infinite normal;position:absolute;transform:skew(-20deg);box-shadow:0 0 20px 20px var(--sw-border-color-input)}.sw-message{position:fixed;z-index:3;background-color:var(--sw-bg-color-page);border:1px solid var(--sw-border-color);border-radius:var(--sw-border-radius);padding:1.875rem;box-sizing:border-box;top:50%;left:50%;transform:translateY(-50%),translate(-50%);max-width:28.75rem}.sw-message>header{display:flex;justify-content:space-between}.sw-round{border-radius:var(--sw-border-round)}.sw-small{min-height:var(--sw-component-size-small)}.sw-large{min-height:var(--sw-component-size-large)}.sw-primary{background-color:var(--sw-color-primary);border-color:var(--sw-color-primary)}.sw-success{background-color:var(--sw-color-success);border-color:var(--sw-color-success)}.sw-info{background-color:var(--sw-color-info);border-color:var(--sw-color-info)}.sw-warning{background-color:var(--sw-color-warning);border-color:var(--sw-color-warning)}.sw-danger{background-color:var(--sw-color-danger);border-color:var(--sw-color-danger)}.sw-text{color:var(--sw-color-default);background:none}.sw-text.sw-primary{color:var(--sw-color-primary)}.sw-text.sw-success{color:var(--sw-color-success)}.sw-text.sw-info{color:var(--sw-color-info)}.sw-text.sw-warning{color:var(--sw-color-warning)}.sw-text.sw-danger{color:var(--sw-color-danger)}.sw-link{background:none;border:none;padding:0;color:var(--sw-text-color-secondary);min-height:1em}.sw-link:hover.sw-primary{color:var(--sw-color-primary)}.sw-link:hover.sw-success{color:var(--sw-color-success)}.sw-link:hover.sw-info{color:var(--sw-color-info)}.sw-link:hover.sw-warning{color:var(--sw-color-warning)}.sw-link:hover.sw-danger{color:var(--sw-color-danger)}@keyframes sw-skeleton{0%{left:-50px}to{left:calc(50px + 100%)}}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("vue")):typeof define=="function"&&define.amd?define(["vue"],u):(e=typeof globalThis<"u"?globalThis:e||self,e["component-sw"]=u(e.vue))})(this,function(e){"use strict";const u=Object.assign({"./components/SwButton.vue":()=>Promise.resolve().then(()=>$),"./components/SwCollapse.vue":()=>Promise.resolve().then(()=>z),"./components/SwDropdown.vue":()=>Promise.resolve().then(()=>C),"./components/SwDropdownItem.vue":()=>Promise.resolve().then(()=>E),"./components/SwFormItem.vue":()=>Promise.resolve().then(()=>V),"./components/SwInput.vue":()=>Promise.resolve().then(()=>I),"./components/SwMessage.vue":()=>Promise.resolve().then(()=>R),"./components/SwSection.vue":()=>Promise.resolve().then(()=>A),"./components/SwSkeleton.vue":()=>Promise.resolve().then(()=>W),"./components/SwSkeletonItem.vue":()=>Promise.resolve().then(()=>q),"./components/SwSwitch.vue":()=>Promise.resolve().then(()=>U),"./components/SwTabs.vue":()=>Promise.resolve().then(()=>Y),"./components/SwTabsPane.vue":()=>Promise.resolve().then(()=>J)}),h={};for(const n in u){const t=n.split("/").pop().replace(".vue","");h[t]=e.defineAsyncComponent(u[n])}const w={__name:"SwButton",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},round:{type:Boolean,default:!1},text:{type:Boolean,default:!1},link:{type:Boolean,default:!1}},setup(n){const t=n,l=e.computed(()=>{let o=["sw-button"];return t.size.length>0&&o.push("sw-"+t.size),t.type.length>0&&o.push("sw-"+t.type),t.round&&o.push("sw-round"),t.text&&o.push("sw-text"),t.link&&o.push("sw-link"),t.class.length>0&&o.push(t.class),o});return(o,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(l.value)},[e.renderSlot(o.$slots,"default")],2))}},$=Object.freeze(Object.defineProperty({__proto__:null,default:w},Symbol.toStringTag,{value:"Module"})),z=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwCollapse",props:{visual:{type:Boolean,default:!0}},setup(n){e.onMounted(()=>{o.value="0px"});const t=e.ref("0px"),l=n,o=e.computed(()=>l.visual?`${t.value.scrollHeight}px`:"0px");return(s,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-collapse",{open:l.visual}]),style:e.normalizeStyle({height:o.value}),ref_key:"collapse",ref:t},[e.renderSlot(s.$slots,"default")],6))}}},Symbol.toStringTag,{value:"Module"})),C=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdown",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0}},setup(n){const t=n,l=e.ref(!1),o=e.ref(null),s=e.ref(null),r=e.ref({}),p=e.computed(()=>{let a=["sw-dropdown"];return t.size.length>0&&a.push("sw-"+t.size),t.type.length>0&&a.push("sw-"+t.type),a}),m=async()=>{if(await e.nextTick(),!s.value)return;const a=o.value.getBoundingClientRect(),d=window.pageYOffset||document.documentElement.scrollTop,y=window.pageXOffset||document.documentElement.scrollLeft,g=s.value.offsetHeight,B=s.value.offsetWidth;let c=a.left+a.width/2+y,i=a.bottom-a.height/2+d;const[K,Q]=t.placement.split("-",2);switch(console.log(t.placement),K){case"bottom":i=i+a.height/2+8;break;case"top":i=i-a.height/2-8-g;break;case"left":c=c-B-a.width/2-10,i=i-g/2;break;case"right":c=c+a.width/2+8,i=i-g/2;break}switch(Q){case"left":c=c-B+a.width/2;break;case"right":c=c-a.width/2;break}c<0&&(c=0),i<0&&(i=0),r.value={position:"absolute",top:`${i}px`,left:`${c}px`,maxWidth:t.maxWidth===0?"":`${t.maxWidth}px`}},f=async()=>{l.value=!l.value,l.value&&await m()},_=()=>{l.value&&m()},S=a=>{o.value&&!o.value.contains(a.target)&&(l.value=!1)};return e.onMounted(()=>{document.addEventListener("click",S),window.addEventListener("resize",_)}),e.onUnmounted(()=>{document.removeEventListener("click",S),window.removeEventListener("resize",_)}),(a,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(p.value),onClick:d[0]||(d[0]=y=>f()),ref_key:"dropdownRef",ref:o},[e.renderSlot(a.$slots,"default"),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:s,class:e.normalizeClass(["sw-dropdown-popup",t.class]),style:e.normalizeStyle(r.value)},[e.renderSlot(a.$slots,"dropdown")],6)):e.createCommentVNode("",!0)]))],2))}}},Symbol.toStringTag,{value:"Module"})),E=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(n){const t=n,l=e.computed(()=>{let o=["sw-dropdown-item"];return t.size.length>0&&o.push("sw-"+t.size),t.type.length>0&&o.push("sw-"+t.type),t.class.length>0&&o.push(t.class),o});return(o,s)=>{const r=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(l.value)},[e.createVNode(r,{"icon-class":n.iconBefore},null,8,["icon-class"]),e.renderSlot(o.$slots,"default")],2)}}}},Symbol.toStringTag,{value:"Module"})),V=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwFormItem",props:{class:{type:String,default:""},type:{type:String,default:""}},setup(n){const t=n,l=e.computed(()=>{let o=["sw-form-item"];return t.type.length>0&&o.push("sw-"+t.type),t.class.length>0&&o.push(t.class),o});return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},[e.renderSlot(o.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"}));function P(n){return/^(https?:|mailto:|tel:)/.test(n)}const M=(n,t)=>{const l=n.__vccOpts||n;for(const[o,s]of t)l[o]=s;return l},T={name:"SvgIcon",props:{prefix:{type:String,default:"icon"},iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{isExt(){return P(this.iconClass)}}},x=["href"];function O(n,t,l,o,s,r){return r.isExt?(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:0,style:"mask: url("+l.iconClass+") no-repeat 50% 50%;",class:"svg-external-icon svg-icon"},n.$attrs),null,16)):(e.openBlock(),e.createElementBlock("svg",e.mergeProps({key:1,class:"svg-icon "+l.className,"aria-hidden":"true"},n.$attrs),[e.createElementVNode("use",{href:"#"+l.prefix+"-"+l.iconClass},null,8,x)],16))}const k=M(T,[["render",O]]),j=["for"],N=["placeholder","type","id","name"],I=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwInput",props:e.mergeModels({before:{type:String,default:""},after:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:""},name:{type:String,required:!0},class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:"text"}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["suffix"],["update:modelValue"]),setup(n,{emit:t}){var S;const l=e.useModel(n,"modelValue"),o=n,s=e.ref(null),r=t,p=()=>{s.value!==null&&(s.value.style.top="-.6em")},m=()=>{var a;((a=l.value)==null?void 0:a.length)==0&&s.value!==null&&s.value.removeAttribute("style")};((S=l.value)==null?void 0:S.length)>0&&s.value!==null&&(s.value.style.top="-.6em");const f=()=>{r("suffix")},_=e.computed(()=>{let a=["sw-input"];return o.size.length>0&&a.push("sw-"+o.size),o.class.length>0&&a.push(o.class),a});return(a,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(_.value)},[o.before.length>0?(e.openBlock(),e.createBlock(k,{key:0,"icon-class":o.before},null,8,["icon-class"])):e.renderSlot(a.$slots,"prefix",{key:1}),o.label.length>0?(e.openBlock(),e.createElementBlock("label",{key:2,for:o.name,ref_key:"lab",ref:s},[e.createTextVNode(e.toDisplayString(o.label),1),d[1]||(d[1]=e.createElementVNode("span",{title:"Это поле обязательно для заполнения."},"*",-1))],8,j)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=y=>l.value=y),required:"required",placeholder:o.placeholder,type:o.type,id:o.name,name:o.name,size:"60",onFocus:p,onBlur:m,maxlength:"128"},null,40,N),[[e.vModelDynamic,l.value]]),o.after.length>0?(e.openBlock(),e.createBlock(k,{key:3,"icon-class":o.after,onClick:f},null,8,["icon-class"])):e.renderSlot(a.$slots,"suffix",{key:4})],2))}}},Symbol.toStringTag,{value:"Module"})),D={key:0},R=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwMessage",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=e.useModel(n,"modelValue"),l=n,o=e.ref(null);return(s,r)=>{const p=e.resolveComponent("svg-icon");return t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["sw-message",l.class]),ref_key:"messageRef",ref:o},[l.name.length>0?(e.openBlock(),e.createElementBlock("header",D,[e.renderSlot(s.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createVNode(w,{link:"",type:"primary",onClick:r[0]||(r[0]=m=>t.value=!1)},{default:e.withCtx(()=>[e.createVNode(p,{"icon-class":l.iconAfter},null,8,["icon-class"])]),_:1})])])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",{},()=>[r[1]||(r[1]=e.createTextVNode("111222"))]),e.createElementVNode("footer",null,[e.renderSlot(s.$slots,"footer")])],2)):e.createCommentVNode("",!0)}}}},Symbol.toStringTag,{value:"Module"})),A=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSection",props:{name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},setup(n){const t=n;return(l,o)=>{const s=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(t.class)},[e.createElementVNode("header",null,[e.renderSlot(l.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(t.name)+" ",1),e.createVNode(s,{"icon-class":t.iconAfter},null,8,["icon-class"])])]),e.renderSlot(l.$slots,"default"),e.createElementVNode("footer",null,[e.renderSlot(l.$slots,"footer")])],2)}}}},Symbol.toStringTag,{value:"Module"})),L={key:0},b={__name:"SwSkeletonItem",props:{width:{type:String,default:"100"},class:{type:String,default:""},animate:{type:Boolean,default:!1},size:{type:String,default:""}},setup(n){const t=n,l=e.computed(()=>{let s=["sw-skeleton-item"];return t.size.length>0&&s.push("sw-"+t.size),t.animate&&s.push("sw-animate"),t.class.length>0&&s.push(t.class),s}),o=e.computed(()=>({width:t.width+"%"}));return(s,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value),style:e.normalizeStyle(o.value)},[t.animate?(e.openBlock(),e.createElementBlock("div",L)):e.createCommentVNode("",!0)],6))}},q=Object.freeze(Object.defineProperty({__proto__:null,default:b},Symbol.toStringTag,{value:"Module"})),W=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSkeleton",props:{class:{type:String,default:""},visual:{type:Boolean,default:!1}},setup(n){const t=n;return(l,o)=>t.visual?e.renderSlot(l.$slots,"default",{key:0},()=>[o[0]||(o[0]=e.createTextVNode("1"))]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["sw-skeleton",t.class])},[e.renderSlot(l.$slots,"skeleton",{},()=>[e.createVNode(b,{animate:"",size:"small"})])],2))}}},Symbol.toStringTag,{value:"Module"})),F=["name","id"],H=["for","data-onlabel","data-offlabel"],U=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSwitch",props:e.mergeModels({id:{type:String,default:"checkbox"},class:{type:String,default:""},name:{type:String,default:""},on:{type:String,default:""},off:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=e.useModel(n,"modelValue"),l=n;return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-switch",l.class])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",name:l.name,class:"sw-control",id:l.id,"onUpdate:modelValue":s[0]||(s[0]=r=>t.value=r)},null,8,F),[[e.vModelCheckbox,t.value]]),e.createElementVNode("label",{for:l.id,class:"sw-label","data-onlabel":l.on,"data-offlabel":l.off},null,8,H),e.renderSlot(o.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),X=["onClick"],Y=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabs",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(n,{emit:t}){e.ref(0);const l=e.ref([]),o=n,s=e.useModel(n,"modelValue");return l.value=e.useSlots().default().filter(r=>r.type.__name==="SwTabsPane"),e.provide("activeTab",s),e.provide("tabs",l),(r,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+o.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(m,f)=>(e.openBlock(),e.createElementBlock("span",{key:f,class:e.normalizeClass([{active:s.value===f}]),onClick:_=>s.value=f},e.toDisplayString(m.props.label||m.props.title),11,X))),128))]),e.renderSlot(r.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),G={key:0,class:"tab-content"},J=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPane",props:{title:{type:String,required:!0}},setup(n){const t=n,l=e.inject("activeTab"),o=e.inject("tabs"),s=e.computed(()=>{const r=o.value.findIndex(p=>p.props.title===t.title);return l.value===r});return(r,p)=>s.value?(e.openBlock(),e.createElementBlock("div",G,[e.renderSlot(r.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"}));return h});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineAsyncComponent as n } from "vue";
|
|
2
|
+
const e = /* @__PURE__ */ Object.assign({ "./components/SwButton.vue": () => import("./SwButton-CQh1Mtze.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CjL9dpO-.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-CngCMKee.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-C3_wJ1DL.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CgahR93o.js"), "./components/SwInput.vue": () => import("./SwInput-DpflrHQm.js"), "./components/SwMessage.vue": () => import("./SwMessage-BGIOC-zp.js"), "./components/SwSection.vue": () => import("./SwSection-CaY8OFmf.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-DWILNFfF.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-375THfdW.js"), "./components/SwTabs.vue": () => import("./SwTabs-BBUJ5wnR.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-BUUmFjh7.js") }), p = {};
|
|
3
|
+
for (const o in e) {
|
|
4
|
+
const t = o.split("/").pop().replace(".vue", "");
|
|
5
|
+
p[t] = n(e[o]);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
p as default
|
|
9
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@studio-west/component-sw",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Vue components of Component SW collection.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"icon",
|
|
8
|
+
"svg",
|
|
9
|
+
"vue",
|
|
10
|
+
"component-sw"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"require": "./dist/index.cjs",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./dist/main.css": "./dist/main.css",
|
|
23
|
+
"./*": "./*"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "vite",
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"preview": "vite preview"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"vue": "^3.5.13"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
35
|
+
"sass": "^1.86.0",
|
|
36
|
+
"sass-embedded": "^1.83.0",
|
|
37
|
+
"vite": "^6.2.0"
|
|
38
|
+
},
|
|
39
|
+
"author": "Alexander Efimov",
|
|
40
|
+
"license": "MIT"
|
|
41
|
+
}
|