UNPKG

1.7 kBJavaScriptView Raw
1import { defineComponent as r, openBlock as c, createElementBlock as d, normalizeClass as u, createElementVNode as f, renderSlot as p } from "vue";
2const m = Array.isArray, b = (t) => typeof t == "string", y = (t) => t !== null && typeof t == "object";
3function a(...t) {
4 const n = [];
5 for (let o = 0; o < t.length; o++) {
6 const e = t[o];
7 if (!!e) {
8 if (b(e))
9 n.push(e);
10 else if (m(e))
11 for (let s = 0; s < e.length; s++) {
12 const l = a(e[s]);
13 l && n.push(l);
14 }
15 else if (y(e))
16 for (const s in e)
17 e[s] && n.push(s);
18 }
19 }
20 return n.join(" ");
21}
22const g = {
23 type: {
24 type: String,
25 default: "default"
26 },
27 size: {
28 type: String,
29 default: "md"
30 },
31 disabled: {
32 type: Boolean,
33 default: !1
34 },
35 loading: {
36 type: Boolean,
37 default: !1
38 }
39}, _ = r({
40 name: "WeButton",
41 props: g,
42 setup(t) {
43 return {
44 classString: a([
45 "we-button",
46 `we-button-type-${t.type}`,
47 t.disabled ? "we-button-disabled" : ""
48 ])
49 };
50 }
51}), h = (t, n) => {
52 const o = t.__vccOpts || t;
53 for (const [e, s] of n)
54 o[e] = s;
55 return o;
56}, S = ["disabled"], $ = { class: "we-button-inner" };
57function B(t, n, o, e, s, l) {
58 return c(), d("button", {
59 class: u([t.classString]),
60 disabled: t.disabled || t.loading
61 }, [
62 f("span", $, [
63 p(t.$slots, "default")
64 ])
65 ], 10, S);
66}
67const i = /* @__PURE__ */ h(_, [["render", B]]);
68i.install = function(t) {
69 return t.component(i.name, i), t;
70};
71const w = [i], j = function(t) {
72 w.forEach((n) => {
73 t.use(n);
74 });
75}, A = {
76 install: j
77};
78export {
79 i as Button,
80 A as default
81};