bani-ui 1.0.1 → 1.0.2-alpha.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/dist/es/Button-Bwc0dTzv.js +102 -0
- package/dist/es/ButtonGroup-C4UHHgrM.js +35 -0
- package/dist/es/Icon-CseJvWyQ.js +56 -0
- package/dist/es/index.js +12 -0
- package/dist/es/utils-B5aZ4w8w.js +16 -0
- package/dist/es/vendor-BkjRo-uZ.js +1176 -0
- package/dist/index.css +1 -0
- package/dist/theme/Button.css +304 -0
- package/dist/theme/ButtonGroup.css +46 -0
- package/dist/theme/Icon.css +25 -0
- package/dist/theme/index.css +197 -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 +11 -11
- package/dist/umd/index.umd.cjs.br +0 -0
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +20 -7
- package/dist/es/Button-D_v-A_Dg.js +0 -83
- package/dist/es/ButtonGroup-BR5hccGs.js +0 -28
- package/dist/es/Icon-DoZxoH3U.js +0 -48
- package/dist/es/bani-ui.js +0 -11
- package/dist/es/theme/bani-ui.css +0 -1
- package/dist/es/utils-dO1-T2lT.js +0 -18
- package/dist/es/vendor-XKc2ad4D.js +0 -4476
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, useSlots, ref, openBlock, createBlock, resolveDynamicComponent, unref, normalizeClass, withCtx, renderSlot, createVNode, normalizeStyle, createCommentVNode } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./Icon-CseJvWyQ.js";
|
|
3
|
+
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
5
|
+
import { t as throttle } from "./vendor-BkjRo-uZ.js";
|
|
6
|
+
import { w as withInstall } from "./utils-B5aZ4w8w.js";
|
|
7
|
+
const BUTTON_GROUP_CTX_KEY = Symbol(
|
|
8
|
+
"BUTTON_GROUP_CTX_KEY"
|
|
9
|
+
);
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "BnButton"
|
|
13
|
+
},
|
|
14
|
+
__name: "Button",
|
|
15
|
+
props: {
|
|
16
|
+
tag: { default: "button" },
|
|
17
|
+
type: {},
|
|
18
|
+
size: {},
|
|
19
|
+
plain: { type: Boolean },
|
|
20
|
+
round: { type: Boolean },
|
|
21
|
+
circle: { type: Boolean },
|
|
22
|
+
disabled: { type: Boolean },
|
|
23
|
+
autofocus: { type: Boolean },
|
|
24
|
+
nativeType: { default: "button" },
|
|
25
|
+
icon: {},
|
|
26
|
+
loading: { type: Boolean },
|
|
27
|
+
loadingIcon: {},
|
|
28
|
+
useThrottle: { type: Boolean, default: true },
|
|
29
|
+
throttleDuration: { default: 500 }
|
|
30
|
+
},
|
|
31
|
+
emits: ["click"],
|
|
32
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
33
|
+
library.add(faSpinner);
|
|
34
|
+
const props = __props;
|
|
35
|
+
const ctx = inject(BUTTON_GROUP_CTX_KEY, void 0);
|
|
36
|
+
const size = computed(() => (ctx == null ? void 0 : ctx.size) ?? props.size ?? "");
|
|
37
|
+
const type = computed(() => (ctx == null ? void 0 : ctx.type) ?? props.type ?? "");
|
|
38
|
+
const disabled = computed(() => (ctx == null ? void 0 : ctx.disabled) || props.disabled || false);
|
|
39
|
+
const emits = __emit;
|
|
40
|
+
const slots = useSlots();
|
|
41
|
+
const _ref = ref();
|
|
42
|
+
const iconStyle = computed(() => ({
|
|
43
|
+
marginRight: slots.default ? "6px" : "0px"
|
|
44
|
+
}));
|
|
45
|
+
const handleBthClick = (e) => emits("click", e);
|
|
46
|
+
const handleBthClickThrottle = throttle(
|
|
47
|
+
handleBthClick,
|
|
48
|
+
props.throttleDuration,
|
|
49
|
+
{ trailing: false }
|
|
50
|
+
);
|
|
51
|
+
__expose({
|
|
52
|
+
ref: _ref,
|
|
53
|
+
disabled,
|
|
54
|
+
size,
|
|
55
|
+
type
|
|
56
|
+
});
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return openBlock(), createBlock(resolveDynamicComponent(props.tag), {
|
|
59
|
+
ref_key: "_ref",
|
|
60
|
+
ref: _ref,
|
|
61
|
+
class: normalizeClass(["er-button", {
|
|
62
|
+
[`er-button--${type.value}`]: type.value,
|
|
63
|
+
[`er-button--${size.value}`]: size.value,
|
|
64
|
+
"is-plain": __props.plain,
|
|
65
|
+
"is-round": __props.round,
|
|
66
|
+
"is-circle": __props.circle,
|
|
67
|
+
"is-disabled": disabled.value,
|
|
68
|
+
"is-loading": __props.loading
|
|
69
|
+
}]),
|
|
70
|
+
autofocus: __props.autofocus,
|
|
71
|
+
type: __props.tag === "button" ? __props.nativeType : void 0,
|
|
72
|
+
disabled: disabled.value || __props.loading,
|
|
73
|
+
onClick: _cache[0] || (_cache[0] = (e) => __props.useThrottle ? unref(handleBthClickThrottle)(e) : handleBthClick(e))
|
|
74
|
+
}, {
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
__props.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
77
|
+
createVNode(_sfc_main$1, {
|
|
78
|
+
class: "loading-icon",
|
|
79
|
+
icon: __props.loadingIcon ?? unref(faSpinner),
|
|
80
|
+
style: normalizeStyle(iconStyle.value),
|
|
81
|
+
size: "1x",
|
|
82
|
+
spin: ""
|
|
83
|
+
}, null, 8, ["icon", "style"])
|
|
84
|
+
]) : createCommentVNode("", true),
|
|
85
|
+
__props.icon && !__props.loading ? (openBlock(), createBlock(_sfc_main$1, {
|
|
86
|
+
key: 1,
|
|
87
|
+
icon: __props.icon,
|
|
88
|
+
size: "1x",
|
|
89
|
+
style: normalizeStyle(iconStyle.value)
|
|
90
|
+
}, null, 8, ["icon", "style"])) : createCommentVNode("", true),
|
|
91
|
+
renderSlot(_ctx.$slots, "default")
|
|
92
|
+
]),
|
|
93
|
+
_: 3
|
|
94
|
+
}, 8, ["autofocus", "type", "disabled", "class"]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const BnButton = withInstall(_sfc_main);
|
|
99
|
+
export {
|
|
100
|
+
BUTTON_GROUP_CTX_KEY as B,
|
|
101
|
+
BnButton as a
|
|
102
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent, provide, reactive, toRef, openBlock, createElementBlock, renderSlot } from "vue";
|
|
2
|
+
import { B as BUTTON_GROUP_CTX_KEY } from "./Button-Bwc0dTzv.js";
|
|
3
|
+
import { w as withInstall } from "./utils-B5aZ4w8w.js";
|
|
4
|
+
const _hoisted_1 = { class: "er-button-group" };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
...{
|
|
7
|
+
name: "BnButtonGroup"
|
|
8
|
+
},
|
|
9
|
+
__name: "ButtonGroup",
|
|
10
|
+
props: {
|
|
11
|
+
size: {},
|
|
12
|
+
type: {},
|
|
13
|
+
disabled: { type: Boolean }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
provide(
|
|
18
|
+
BUTTON_GROUP_CTX_KEY,
|
|
19
|
+
reactive({
|
|
20
|
+
size: toRef(props, "size"),
|
|
21
|
+
type: toRef(props, "type"),
|
|
22
|
+
disabled: toRef(props, "disabled")
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
27
|
+
renderSlot(_ctx.$slots, "default")
|
|
28
|
+
]);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const BnButtonGroup = withInstall(_sfc_main);
|
|
33
|
+
export {
|
|
34
|
+
BnButtonGroup as B
|
|
35
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, mergeProps, createVNode, unref, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
3
|
+
import { o as omit } from "./vendor-BkjRo-uZ.js";
|
|
4
|
+
import { w as withInstall } from "./utils-B5aZ4w8w.js";
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
...{
|
|
7
|
+
name: "BnIcon",
|
|
8
|
+
inheritAttrs: false
|
|
9
|
+
},
|
|
10
|
+
__name: "Icon",
|
|
11
|
+
props: {
|
|
12
|
+
border: { type: Boolean },
|
|
13
|
+
fixedWidth: { type: Boolean },
|
|
14
|
+
flip: {},
|
|
15
|
+
icon: {},
|
|
16
|
+
mask: {},
|
|
17
|
+
listItem: { type: Boolean },
|
|
18
|
+
pull: {},
|
|
19
|
+
pulse: { type: Boolean },
|
|
20
|
+
rotation: {},
|
|
21
|
+
swapOpacity: { type: Boolean },
|
|
22
|
+
size: {},
|
|
23
|
+
spin: { type: Boolean },
|
|
24
|
+
transform: {},
|
|
25
|
+
symbol: { type: [Boolean, String] },
|
|
26
|
+
title: {},
|
|
27
|
+
inverse: { type: Boolean },
|
|
28
|
+
bounce: { type: Boolean },
|
|
29
|
+
shake: { type: Boolean },
|
|
30
|
+
beat: { type: Boolean },
|
|
31
|
+
fade: { type: Boolean },
|
|
32
|
+
beatFade: { type: Boolean },
|
|
33
|
+
spinPulse: { type: Boolean },
|
|
34
|
+
spinReverse: { type: Boolean },
|
|
35
|
+
type: {},
|
|
36
|
+
color: {}
|
|
37
|
+
},
|
|
38
|
+
setup(__props) {
|
|
39
|
+
const props = __props;
|
|
40
|
+
const filterProps = computed(() => omit(props, ["type", "color"]));
|
|
41
|
+
const customStyles = computed(() => ({ color: props.color ?? void 0 }));
|
|
42
|
+
return (_ctx, _cache) => {
|
|
43
|
+
return openBlock(), createElementBlock("i", mergeProps({
|
|
44
|
+
class: ["er-icon", [`er-icon--${__props.type}`]],
|
|
45
|
+
style: customStyles.value
|
|
46
|
+
}, _ctx.$attrs), [
|
|
47
|
+
createVNode(unref(FontAwesomeIcon), normalizeProps(guardReactiveProps(filterProps.value)), null, 16)
|
|
48
|
+
], 16);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const BnIcon = withInstall(_sfc_main);
|
|
53
|
+
export {
|
|
54
|
+
BnIcon as B,
|
|
55
|
+
_sfc_main as _
|
|
56
|
+
};
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { m as makeInstaller } from "./utils-B5aZ4w8w.js";
|
|
2
|
+
import { a as BnButton } from "./Button-Bwc0dTzv.js";
|
|
3
|
+
import { B as BnButtonGroup } from "./ButtonGroup-C4UHHgrM.js";
|
|
4
|
+
import { B as BnIcon } from "./Icon-CseJvWyQ.js";
|
|
5
|
+
const components = [BnButton, BnButtonGroup, BnIcon];
|
|
6
|
+
const installer = makeInstaller(components);
|
|
7
|
+
export {
|
|
8
|
+
BnButton,
|
|
9
|
+
BnButtonGroup,
|
|
10
|
+
BnIcon,
|
|
11
|
+
installer as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { f as forEach } from "./vendor-BkjRo-uZ.js";
|
|
2
|
+
function makeInstaller(components) {
|
|
3
|
+
const install = (app) => forEach(components, (c) => app.use(c));
|
|
4
|
+
return install;
|
|
5
|
+
}
|
|
6
|
+
const withInstall = (component) => {
|
|
7
|
+
component.install = (app) => {
|
|
8
|
+
const name = component.name;
|
|
9
|
+
app.component(name, component);
|
|
10
|
+
};
|
|
11
|
+
return component;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
makeInstaller as m,
|
|
15
|
+
withInstall as w
|
|
16
|
+
};
|