maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
104 lines (103 loc) • 4.38 kB
JavaScript
import { defineComponent as C, defineAsyncComponent as m, useAttrs as $, computed as o, openBlock as t, createBlock as l, resolveDynamicComponent as r, normalizeClass as a, normalizeStyle as S, withCtx as j, renderSlot as i, unref as u, createCommentVNode as d, createElementBlock as M, createVNode as E } from "vue";
import { _ as F } from "./MazCard.D4R5VJTH.mjs";
import '../assets/MazBtn.DRGAvMws.css';const O = {
key: 0,
class: "m-btn-loader-container"
}, A = /* @__PURE__ */ C({
__name: "MazBtn",
props: {
variant: { default: "button" },
size: { default: "md" },
color: { default: "primary" },
type: { default: "button" },
rounded: { type: Boolean },
roundedSize: { default: "lg" },
noRounded: { type: Boolean },
outline: { type: Boolean },
pastel: { type: Boolean },
block: { type: Boolean },
noUnderline: { type: Boolean },
loading: { type: Boolean },
disabled: { type: Boolean },
fab: { type: Boolean },
icon: { type: [String, Function, Object], default: void 0 },
leftIcon: { type: [String, Function, Object], default: void 0 },
rightIcon: { type: [String, Function, Object], default: void 0 },
noPadding: { type: Boolean },
noElevation: { type: Boolean },
justify: { default: "center" }
},
setup(y) {
const n = y, v = m(() => import("./MazSpinner.DsiBNRdi.mjs")), c = m(() => import("./MazIcon.Cq1v4J3r.mjs")), { href: b, to: z } = $(), f = o(() => b ? "a" : z ? "router-link" : "button"), g = o(() => n.pastel ? `--${n.color}-pastel` : n.outline ? `--${n.color}-outline` : `--${n.color}`), p = o(
() => (n.loading || n.disabled) && f.value === "button"
), B = o(() => p.value ? "--cursor-default" : "--cursor-pointer"), k = o(() => `--is-${n.variant}`), I = o(() => n.loading && n.variant === "button"), h = o(() => f.value === "button" ? n.type : void 0), s = o(() => n.size === "xl" ? "maz-text-3xl" : n.size === "lg" ? "maz-text-2xl" : n.size === "md" ? "maz-text-xl" : n.size === "sm" ? "maz-text-lg" : n.size === "xs" ? "maz-text-base" : n.size === "mini" ? "maz-text-sm" : "maz-text-xl");
return (e, D) => (t(), l(r(f.value), {
disabled: p.value || void 0,
class: a(["m-btn m-reset-css", [
`--${e.size}`,
!e.fab && !e.rounded && e.roundedSize && `--rounded-${e.roundedSize}`,
g.value,
B.value,
k.value,
{
"--block": e.block,
"--no-underline": e.noUnderline,
"--fab": e.fab,
"--loading": e.loading,
"--disabled": p.value,
"--rounded": e.rounded,
"--no-rounded": e.noRounded,
"--no-padding": e.noPadding,
"--no-elevation": e.noElevation
}
]]),
style: S([`--justify: ${e.justify}`]),
type: h.value
}, {
default: j(() => [
i(e.$slots, "left-icon", {}, () => [
typeof e.leftIcon == "string" ? (t(), l(u(c), {
key: 0,
name: e.leftIcon,
class: a([s.value])
}, null, 8, ["name", "class"])) : e.leftIcon ? (t(), l(r(e.leftIcon), {
key: 1,
class: a([s.value])
}, null, 8, ["class"])) : d("v-if", !0)
], !0),
i(e.$slots, "icon", {}, () => [
typeof e.icon == "string" ? (t(), l(u(c), {
key: 0,
name: e.icon,
class: a([s.value])
}, null, 8, ["name", "class"])) : e.icon ? (t(), l(r(e.icon), {
key: 1,
class: a([s.value])
}, null, 8, ["class"])) : d("v-if", !0)
], !0),
i(e.$slots, "default", {}, void 0, !0),
i(e.$slots, "right-icon", {}, () => [
typeof e.rightIcon == "string" ? (t(), l(u(c), {
key: 0,
name: e.rightIcon,
class: a([s.value])
}, null, 8, ["name", "class"])) : e.rightIcon ? (t(), l(r(e.rightIcon), {
key: 1,
class: a([s.value])
}, null, 8, ["class"])) : d("v-if", !0)
], !0),
I.value ? (t(), M("div", O, [
E(u(v), {
size: "2em",
color: e.color
}, null, 8, ["color"])
])) : d("v-if", !0)
]),
_: 3
/* FORWARDED */
}, 8, ["disabled", "class", "style", "type"]));
}
}), R = /* @__PURE__ */ F(A, [["__scopeId", "data-v-6b881156"]]);
export {
R as default
};