@blocklet/ui-react
Version:
Some useful front-end web components that can be used in Blocklets.
51 lines (50 loc) • 1.21 kB
JavaScript
import { jsxs as s, jsx as m } from "react/jsx-runtime";
import { useTheme as g, alpha as n, Typography as f } from "@mui/material";
import { Icon as u } from "@iconify/react";
import { BadgeContainer as d } from "./app-badge-default.js";
const o = {
primary: (e) => e.palette.primary,
info: (e) => e.palette.info,
success: (e) => e.palette.success,
error: (e) => e.palette.error,
warning: (e) => e.palette.warning
}, h = (e, r) => {
if (o[r]) {
const t = o[r](e).main;
return n(t, 0.1);
}
return n(r, 0.1);
}, x = (e, r) => o[r] ? o[r](e).main : r;
function T({
icon: e = "",
value: r = "",
color: t = "info",
loading: p = !1,
...c
}) {
const a = g(), i = x(a, t), l = h(a, t);
return /* @__PURE__ */ s(
d,
{
loading: p,
sx: {
borderColor: n(i, 0.2),
bgcolor: l
},
...c,
children: [
/* @__PURE__ */ m(u, { icon: e || "lucide:orbit", style: { marginRight: 6 } }),
/* @__PURE__ */ s(f, { className: "app-badge-value", style: { color: i }, children: [
"v ",
r
] })
]
}
);
}
export {
T as AppBadgeVersion,
o as colorMap,
h as getBgColor,
x as getTextColor
};