lotus-ui-plus
Version:
Lotus UI Plus - Vue3 Component Library
244 lines (243 loc) • 6.94 kB
JavaScript
import "./style.css";
import { defineComponent as c, createVNode as b, createTextVNode as k, ref as _, computed as g, createElementBlock as y, openBlock as h, createElementVNode as d, normalizeClass as v, mergeProps as x } from "vue";
const B = /* @__PURE__ */ c({
name: "LotusButton",
props: {
type: {
type: String,
default: "default"
},
size: {
type: String,
default: "default"
},
disabled: {
type: Boolean,
default: !1
},
loading: {
type: Boolean,
default: !1
}
},
emits: ["click"],
setup(e, {
emit: t,
slots: n
}) {
const a = (o) => {
e.disabled || e.loading || t("click", o);
};
return () => {
var o;
return b("button", {
class: ["lotus-button", `lotus-button--${e.type}`, `lotus-button--${e.size}`, {
"is-disabled": e.disabled,
"is-loading": e.loading
}],
disabled: e.disabled || e.loading,
onClick: a
}, [e.loading && b("span", {
class: "lotus-button__loading"
}, [k("⏳")]), (o = n.default) == null ? void 0 : o.call(n)]);
};
}
}), I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: B
}, Symbol.toStringTag, { value: "Module" })), T = ["type", "value", "placeholder", "disabled", "readonly", "maxlength"], O = /* @__PURE__ */ c({
name: "LotusInput",
__name: "index",
props: {
modelValue: {},
type: { default: "text" },
placeholder: {},
disabled: { type: Boolean, default: !1 },
readonly: { type: Boolean, default: !1 },
maxlength: {},
autoScrollIntoView: { type: Boolean, default: !0 },
scrollIntoViewDuration: { default: 200 }
},
emits: ["update:modelValue", "change", "focus", "blur"],
setup(e, { emit: t }) {
const n = e, a = t, o = _(), s = g(() => [
"lotus-input-wrapper",
{
"lotus-input-disabled": n.disabled
}
]), r = (l) => {
const u = l.target;
a("update:modelValue", u.value);
}, i = (l) => {
const u = l.target;
a("change", u.value);
}, f = (l) => {
n.autoScrollIntoView && setTimeout(() => {
o.value && o.value.scrollIntoView({
behavior: "smooth",
block: "center"
});
}, 200), a("focus", l);
}, m = (l) => {
a("blur", l);
};
return (l, u) => (h(), y("div", {
ref_key: "containerRef",
ref: o,
class: "lotus-input-container"
}, [
d("div", {
class: v(s.value)
}, [
d("input", x({
class: "lotus-input",
type: e.type,
value: e.modelValue,
placeholder: e.placeholder,
disabled: e.disabled,
readonly: e.readonly,
maxlength: e.maxlength,
onInput: r,
onChange: i,
onFocus: f,
onBlur: m
}, l.$attrs), null, 16, T)
], 2)
], 512));
}
}), j = (e, t) => {
const n = e.__vccOpts || e;
for (const [a, o] of t)
n[a] = o;
return n;
}, V = /* @__PURE__ */ j(O, [["__scopeId", "data-v-61904576"]]), w = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: V
}, Symbol.toStringTag, { value: "Module" })), C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: V
}, Symbol.toStringTag, { value: "Module" })), z = /* @__PURE__ */ c({
name: "LotusLock",
props: {
onTap: {
type: Function,
default: () => Promise.resolve()
},
delay: {
type: Number,
default: 1e3
}
},
setup(e, t) {
const n = _(!1);
return () => {
var a, o;
return b("div", {
class: ["inline-block", t.attrs.class],
onClick: async () => {
var s;
if (!n.value) {
n.value = !0;
try {
await ((s = e.onTap) == null ? void 0 : s.call(e, {
...e
}, {
...t.attrs
}));
} finally {
setTimeout(() => {
n.value = !1;
}, e.delay);
}
}
}
}, [(o = (a = t.slots).default) == null ? void 0 : o.call(a)]);
};
}
}), P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: z
}, Symbol.toStringTag, { value: "Module" })), $ = ["value", "placeholder", "disabled", "readonly", "maxlength"], L = /* @__PURE__ */ c({
name: "LotusTextArea",
__name: "index",
props: {
modelValue: {},
placeholder: {},
disabled: { type: Boolean, default: !1 },
readonly: { type: Boolean, default: !1 },
maxlength: {},
autoScrollIntoView: { type: Boolean, default: !0 },
scrollIntoViewDuration: { default: 200 }
},
emits: ["update:modelValue", "change", "focus", "blur"],
setup(e, { emit: t }) {
const n = e, a = t, o = _(), s = g(() => [
"lotus-input-wrapper",
{
"lotus-input-disabled": n.disabled
}
]), r = (l) => {
const u = l.target;
a("update:modelValue", u.value);
}, i = (l) => {
const u = l.target;
a("change", u.value);
}, f = (l) => {
n.autoScrollIntoView && setTimeout(() => {
o.value && o.value.scrollIntoView({
behavior: "smooth",
block: "center"
});
}, 200), a("focus", l);
}, m = (l) => {
a("blur", l);
};
return (l, u) => (h(), y("div", {
ref_key: "containerRef",
ref: o,
class: "lotus-input-container"
}, [
d("div", {
class: v(s.value)
}, [
d("textarea", x({
class: "lotus-input",
value: e.modelValue,
placeholder: e.placeholder,
disabled: e.disabled,
readonly: e.readonly,
maxlength: e.maxlength,
onInput: r,
onChange: i,
onFocus: f,
onBlur: m
}, l.$attrs), null, 16, $)
], 2)
], 512));
}
}), M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: L
}, Symbol.toStringTag, { value: "Module" })), F = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: L
}, Symbol.toStringTag, { value: "Module" })), p = /* @__PURE__ */ Object.assign({ "./components/LotusButton/index.tsx": I, "./components/LotusInput/index.ts": C, "./components/LotusInput/index.vue": w, "./components/LotusLock/index.tsx": P, "./components/LotusTextArea/index.ts": F, "./components/LotusTextArea/index.vue": M }), S = [];
for (const e in p) {
const t = p[e].default;
t && t.name && S.push(t);
}
const A = (e) => {
S.forEach((t) => {
t.name && e.component(t.name, t);
});
}, R = {
install: A
};
export {
B as LotusButton,
V as LotusInput,
z as LotusLock,
L as LotusTextArea,
R as default,
A as install
};