bani-ui 1.0.2-alpha.4 → 1.0.2-alpha.6
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/dist/es/{Button-CVCKNr_z.js → Button-eQN4Iutg.js} +3 -3
- package/dist/es/ButtonGroup-BequUrIT.js +29 -0
- package/dist/es/{Icon-CrwMq7oY.js → Icon-CL9G-J0o.js} +9 -8
- package/dist/es/Message-BZ2T08zu.js +166 -0
- package/dist/es/hooks-CkxWXunh.js +40 -0
- package/dist/es/index.js +11 -8
- package/dist/es/utils-CKyHXHob.js +35 -0
- package/dist/es/vendor-CZxuzErw.js +1500 -0
- package/dist/index.css +1 -1
- package/dist/theme/Message.css +1 -0
- package/dist/types/components/Message/index.d.ts +1 -0
- package/dist/types/components/Message/methods.d.ts +26 -0
- package/dist/types/components/Message/types.d.ts +40 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/useEventListener.d.ts +2 -0
- package/dist/types/hooks/useId.d.ts +3 -0
- package/dist/types/hooks/useOffset.d.ts +12 -0
- package/dist/types/hooks/useZIndex.d.ts +5 -0
- package/dist/types/utils/RenderVnode.d.ts +11 -0
- package/dist/types/utils/iconMap.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/install.d.ts +1 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.br +0 -0
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +16 -14
- package/dist/umd/index.umd.cjs.br +0 -0
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +3 -3
- package/dist/es/ButtonGroup-DaudVIbY.js +0 -28
- package/dist/es/utils-CWTCZ0kD.js +0 -12
- package/dist/es/vendor-vd2Uvf7X.js +0 -840
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as $, inject as N, computed as l, useSlots as O, ref as U, openBlock as m, createBlock as y, resolveDynamicComponent as w, unref as B, normalizeClass as D, withCtx as I, renderSlot as g, createVNode as R, normalizeStyle as b, createCommentVNode as v } from "vue";
|
|
2
|
-
import { _ as h } from "./Icon-
|
|
2
|
+
import { _ as h } from "./Icon-CL9G-J0o.js";
|
|
3
3
|
import { faSpinner as p } from "@fortawesome/free-solid-svg-icons";
|
|
4
4
|
import { library as E } from "@fortawesome/fontawesome-svg-core";
|
|
5
|
-
import { t as G } from "./vendor-
|
|
6
|
-
import { w as K } from "./utils-
|
|
5
|
+
import { t as G } from "./vendor-CZxuzErw.js";
|
|
6
|
+
import { w as K } from "./utils-CKyHXHob.js";
|
|
7
7
|
const P = Symbol(
|
|
8
8
|
"BUTTON_GROUP_CTX_KEY"
|
|
9
9
|
), V = /* @__PURE__ */ $({
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineComponent as n, provide as s, reactive as p, toRef as t, openBlock as i, createElementBlock as a, renderSlot as l } from "vue";
|
|
2
|
+
import { B as c } from "./Button-eQN4Iutg.js";
|
|
3
|
+
import { w as d } from "./utils-CKyHXHob.js";
|
|
4
|
+
import "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
const m = { class: "er-button-group" }, u = /* @__PURE__ */ n({
|
|
6
|
+
name: "BnButtonGroup",
|
|
7
|
+
__name: "ButtonGroup",
|
|
8
|
+
props: {
|
|
9
|
+
size: {},
|
|
10
|
+
type: {},
|
|
11
|
+
disabled: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
setup(o) {
|
|
14
|
+
const e = o;
|
|
15
|
+
return s(
|
|
16
|
+
c,
|
|
17
|
+
p({
|
|
18
|
+
size: t(e, "size"),
|
|
19
|
+
type: t(e, "type"),
|
|
20
|
+
disabled: t(e, "disabled")
|
|
21
|
+
})
|
|
22
|
+
), (r, B) => (i(), a("div", m, [
|
|
23
|
+
l(r.$slots, "default")
|
|
24
|
+
]));
|
|
25
|
+
}
|
|
26
|
+
}), G = d(u);
|
|
27
|
+
export {
|
|
28
|
+
G as B
|
|
29
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as l, computed as t, openBlock as p, createElementBlock as s, mergeProps as i, createVNode as c, unref as m, normalizeProps as y, guardReactiveProps as B } from "vue";
|
|
2
2
|
import { FontAwesomeIcon as u } from "@fortawesome/vue-fontawesome";
|
|
3
|
-
import { o as f } from "./vendor-
|
|
4
|
-
import { w as d } from "./utils-
|
|
5
|
-
|
|
3
|
+
import { o as f } from "./vendor-CZxuzErw.js";
|
|
4
|
+
import { w as d } from "./utils-CKyHXHob.js";
|
|
5
|
+
import "@fortawesome/free-solid-svg-icons";
|
|
6
|
+
const v = /* @__PURE__ */ l({
|
|
6
7
|
name: "BnIcon",
|
|
7
8
|
inheritAttrs: !1,
|
|
8
9
|
__name: "Icon",
|
|
@@ -35,15 +36,15 @@ const v = /* @__PURE__ */ r({
|
|
|
35
36
|
},
|
|
36
37
|
setup(e) {
|
|
37
38
|
const o = e, n = t(() => f(o, ["type", "color"])), a = t(() => ({ color: o.color ?? void 0 }));
|
|
38
|
-
return (
|
|
39
|
+
return (r, I) => (p(), s("i", i({
|
|
39
40
|
class: ["er-icon", [`er-icon--${e.type}`]],
|
|
40
41
|
style: a.value
|
|
41
|
-
},
|
|
42
|
+
}, r.$attrs), [
|
|
42
43
|
c(m(u), y(B(n.value)), null, 16)
|
|
43
44
|
], 16));
|
|
44
45
|
}
|
|
45
|
-
}),
|
|
46
|
+
}), _ = d(v);
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
+
_ as B,
|
|
48
49
|
v as _
|
|
49
50
|
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { defineComponent as R, ref as g, computed as x, onMounted as $, watch as D, openBlock as v, createBlock as w, Transition as S, withCtx as T, withDirectives as V, createElementVNode as B, normalizeStyle as L, normalizeClass as A, createVNode as C, renderSlot as Z, unref as F, createCommentVNode as I, createElementBlock as H, withModifiers as j, vShow as q, shallowReactive as G, isVNode as J, h as K, render as N } from "vue";
|
|
2
|
+
import { b as P, u as Q, c as U, a as W } from "./hooks-CkxWXunh.js";
|
|
3
|
+
import { t as X, R as Y, a as _ } from "./utils-CKyHXHob.js";
|
|
4
|
+
import { _ as k } from "./Icon-CL9G-J0o.js";
|
|
5
|
+
import { b as ee, d as te, a as z, c as se, f as M, g as ne, s as oe } from "./vendor-CZxuzErw.js";
|
|
6
|
+
import "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
const ae = [
|
|
8
|
+
"info",
|
|
9
|
+
"success",
|
|
10
|
+
"warning",
|
|
11
|
+
"danger",
|
|
12
|
+
"error"
|
|
13
|
+
], re = { class: "er-message__content" }, ie = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "er-message__close"
|
|
16
|
+
}, ce = /* @__PURE__ */ R({
|
|
17
|
+
name: "BnMessage",
|
|
18
|
+
__name: "Message",
|
|
19
|
+
props: {
|
|
20
|
+
id: {},
|
|
21
|
+
message: {},
|
|
22
|
+
duration: { default: 3e3 },
|
|
23
|
+
showClose: { type: Boolean },
|
|
24
|
+
center: { type: Boolean },
|
|
25
|
+
type: { default: "info" },
|
|
26
|
+
offset: { default: 10 },
|
|
27
|
+
zIndex: {},
|
|
28
|
+
transitionName: { default: "fade-up" },
|
|
29
|
+
onDestory: {}
|
|
30
|
+
},
|
|
31
|
+
setup(e, { expose: t }) {
|
|
32
|
+
const s = e, n = g(!1), i = g(), c = x(() => X.get(s.type) ?? "circle-info"), o = g(0), { topOffset: p, bottomOffset: d } = P({
|
|
33
|
+
getLastBottomOffset: ee(ue, s),
|
|
34
|
+
offset: s.offset,
|
|
35
|
+
boxHeight: o
|
|
36
|
+
}), f = x(() => ({
|
|
37
|
+
top: p.value + "px",
|
|
38
|
+
zIndex: s.zIndex
|
|
39
|
+
}));
|
|
40
|
+
let h;
|
|
41
|
+
function y() {
|
|
42
|
+
s.duration !== 0 && (h = te(u, s.duration));
|
|
43
|
+
}
|
|
44
|
+
function E() {
|
|
45
|
+
clearTimeout(h);
|
|
46
|
+
}
|
|
47
|
+
function u() {
|
|
48
|
+
n.value = !1;
|
|
49
|
+
}
|
|
50
|
+
return $(() => {
|
|
51
|
+
n.value = !0, y();
|
|
52
|
+
}), D(n, (l) => {
|
|
53
|
+
l || (o.value = -s.offset);
|
|
54
|
+
}), Q(document, "keydown", (l) => {
|
|
55
|
+
const { code: a } = l;
|
|
56
|
+
a === "Escape" && u();
|
|
57
|
+
}), t({
|
|
58
|
+
bottomOffset: d,
|
|
59
|
+
close: u
|
|
60
|
+
}), (l, a) => (v(), w(S, {
|
|
61
|
+
name: e.transitionName,
|
|
62
|
+
onEnter: a[0] || (a[0] = (O) => o.value = i.value.getBoundingClientRect().height),
|
|
63
|
+
onAfterLeave: a[1] || (a[1] = (O) => !n.value && e.onDestory())
|
|
64
|
+
}, {
|
|
65
|
+
default: T(() => [
|
|
66
|
+
V(B("div", {
|
|
67
|
+
ref_key: "messageRef",
|
|
68
|
+
ref: i,
|
|
69
|
+
class: A(["er-message", {
|
|
70
|
+
[`er-message--${e.type}`]: e.type,
|
|
71
|
+
"is-close": e.showClose,
|
|
72
|
+
"text-center": e.center
|
|
73
|
+
}]),
|
|
74
|
+
style: L(f.value),
|
|
75
|
+
role: "alert",
|
|
76
|
+
onMouseenter: E,
|
|
77
|
+
onMouseleave: y
|
|
78
|
+
}, [
|
|
79
|
+
C(k, {
|
|
80
|
+
class: "er-message__icon",
|
|
81
|
+
icon: c.value
|
|
82
|
+
}, null, 8, ["icon"]),
|
|
83
|
+
B("div", re, [
|
|
84
|
+
Z(l.$slots, "default", {}, () => [
|
|
85
|
+
e.message ? (v(), w(F(Y), {
|
|
86
|
+
key: 0,
|
|
87
|
+
vNode: e.message
|
|
88
|
+
}, null, 8, ["vNode"])) : I("", !0)
|
|
89
|
+
])
|
|
90
|
+
]),
|
|
91
|
+
e.showClose ? (v(), H("div", ie, [
|
|
92
|
+
C(k, {
|
|
93
|
+
icon: "xmark",
|
|
94
|
+
onClick: j(u, ["stop"])
|
|
95
|
+
})
|
|
96
|
+
])) : I("", !0)
|
|
97
|
+
], 38), [
|
|
98
|
+
[q, n.value]
|
|
99
|
+
])
|
|
100
|
+
]),
|
|
101
|
+
_: 3
|
|
102
|
+
}, 8, ["name"]));
|
|
103
|
+
}
|
|
104
|
+
}), r = G([]), { nextZIndex: le } = U(), de = {
|
|
105
|
+
type: "info",
|
|
106
|
+
duration: 3e3,
|
|
107
|
+
offset: 10,
|
|
108
|
+
transitionName: "fade-up"
|
|
109
|
+
};
|
|
110
|
+
function b(e) {
|
|
111
|
+
const t = !e || J(e) || se(e) ? {
|
|
112
|
+
message: e
|
|
113
|
+
} : e;
|
|
114
|
+
return { ...de, ...t };
|
|
115
|
+
}
|
|
116
|
+
function fe(e) {
|
|
117
|
+
const t = W().value, s = document.createElement("div"), n = () => {
|
|
118
|
+
const f = M(r, { id: t });
|
|
119
|
+
f !== -1 && (r.splice(f, 1), N(null, s));
|
|
120
|
+
}, i = {
|
|
121
|
+
...e,
|
|
122
|
+
id: t,
|
|
123
|
+
zIndex: le(),
|
|
124
|
+
onDestory: n
|
|
125
|
+
}, c = K(ce, i);
|
|
126
|
+
N(c, s), document.body.appendChild(s.firstElementChild);
|
|
127
|
+
const o = c.component, d = {
|
|
128
|
+
props: i,
|
|
129
|
+
id: t,
|
|
130
|
+
vm: o,
|
|
131
|
+
vnode: c,
|
|
132
|
+
handler: {
|
|
133
|
+
close: () => o.exposed.close()
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return r.push(d), d;
|
|
137
|
+
}
|
|
138
|
+
const m = function(e = {}) {
|
|
139
|
+
const t = b(e);
|
|
140
|
+
return fe(t).handler;
|
|
141
|
+
};
|
|
142
|
+
function ue() {
|
|
143
|
+
const e = M(r, { id: this.id });
|
|
144
|
+
return e <= 0 ? 0 : ne(r, [e - 1, "vm", "exposed", "bottomOffset", "value"]);
|
|
145
|
+
}
|
|
146
|
+
function me(e) {
|
|
147
|
+
z(r, (t) => {
|
|
148
|
+
if (e) {
|
|
149
|
+
t.props.type === e && t.handler.close();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
t.handler.close();
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
z(
|
|
156
|
+
ae,
|
|
157
|
+
(e) => oe(m, e, (t) => {
|
|
158
|
+
const s = b(t);
|
|
159
|
+
return m({ ...s, type: e });
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
m.closeAll = me;
|
|
163
|
+
const we = _(m, "$message");
|
|
164
|
+
export {
|
|
165
|
+
we as B
|
|
166
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isRef as c, watch as d, onMounted as x, onBeforeUnmount as m, unref as a, computed as s, ref as r } from "vue";
|
|
2
|
+
function I(e, n, t) {
|
|
3
|
+
c(e) ? d(e, (o, u) => {
|
|
4
|
+
u == null || u.removeEventListener(n, t), o == null || o.addEventListener(n, t);
|
|
5
|
+
}) : x(() => e == null ? void 0 : e.addEventListener(n, t)), m(() => {
|
|
6
|
+
var o;
|
|
7
|
+
return (o = a(e)) == null ? void 0 : o.removeEventListener(n, t);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function L(e) {
|
|
11
|
+
const n = s(() => e.getLastBottomOffset()), t = s(() => e.offset + n.value), o = s(() => t.value + e.boxHeight.value);
|
|
12
|
+
return {
|
|
13
|
+
topOffset: t,
|
|
14
|
+
bottomOffset: o
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const f = r(0);
|
|
18
|
+
function E(e = 2e3) {
|
|
19
|
+
const n = r(e), t = s(() => f.value + n.value);
|
|
20
|
+
return {
|
|
21
|
+
initialValue: n,
|
|
22
|
+
currentZindex: t,
|
|
23
|
+
nextZIndex: () => (f.value++, t.value)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const i = {
|
|
27
|
+
prefix: Math.floor(Math.random() * 1e4),
|
|
28
|
+
current: 0
|
|
29
|
+
};
|
|
30
|
+
function O(e = "er") {
|
|
31
|
+
return s(
|
|
32
|
+
() => `${e}-id-${i.prefix}-${i.current++}`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
O as a,
|
|
37
|
+
L as b,
|
|
38
|
+
E as c,
|
|
39
|
+
I as u
|
|
40
|
+
};
|
package/dist/es/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { m as o } from "./utils-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { B as r } from "./
|
|
5
|
-
|
|
1
|
+
import { m as o } from "./utils-CKyHXHob.js";
|
|
2
|
+
import "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { a as t } from "./Button-eQN4Iutg.js";
|
|
4
|
+
import { B as r } from "./ButtonGroup-BequUrIT.js";
|
|
5
|
+
import { B as m } from "./Message-BZ2T08zu.js";
|
|
6
|
+
import { B as n } from "./Icon-CL9G-J0o.js";
|
|
7
|
+
const s = [t, r, n, m], l = o(s);
|
|
6
8
|
export {
|
|
7
9
|
t as BnButton,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
r as BnButtonGroup,
|
|
11
|
+
n as BnIcon,
|
|
12
|
+
m as BnMessage,
|
|
13
|
+
l as default
|
|
11
14
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { a as o, i } from "./vendor-CZxuzErw.js";
|
|
2
|
+
import { faCircleInfo as s, faCheckCircle as l, faCircleExclamation as c, faCircleXmark as r } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { defineComponent as u } from "vue";
|
|
4
|
+
function p(e) {
|
|
5
|
+
return (n) => o(e, (a) => n.use(a));
|
|
6
|
+
}
|
|
7
|
+
const C = (e) => (e.install = (t) => {
|
|
8
|
+
const n = e.name;
|
|
9
|
+
t.component(n, e);
|
|
10
|
+
}, e), g = (e, t) => (e.install = (n) => {
|
|
11
|
+
n.config.globalProperties[t] = e;
|
|
12
|
+
}, e), w = /* @__PURE__ */ new Map([
|
|
13
|
+
["info", s],
|
|
14
|
+
["success", l],
|
|
15
|
+
["warning", c],
|
|
16
|
+
["danger", r],
|
|
17
|
+
["error", r]
|
|
18
|
+
]), I = u({
|
|
19
|
+
props: {
|
|
20
|
+
vNode: {
|
|
21
|
+
type: [String, Object, Function],
|
|
22
|
+
required: !0
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
setup(e) {
|
|
26
|
+
return () => i(e.vNode) ? e.vNode() : e.vNode;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
I as R,
|
|
31
|
+
g as a,
|
|
32
|
+
p as m,
|
|
33
|
+
w as t,
|
|
34
|
+
C as w
|
|
35
|
+
};
|