welcome-ui
Version:
Customizable design system with react • styled-components • styled-system and ariakit.
34 lines (33 loc) • 1.23 kB
JavaScript
"use client";
import { j as o } from "./jsx-runtime-Bqq1Hxg9.mjs";
import { useMemo as l } from "react";
import "./Icon.mjs";
import { P as c, C as u, I as m, A as i, S as a, a as x } from "./index-A1En5GST.mjs";
import { forwardRef as I } from "./System.mjs";
import p, { th as d, css as j } from "@xstyled/styled-components";
const h = p.divBox(
({ variant: e }) => j`
display: inline-flex;
${d(`variantIcon.${e}`)}
flex-shrink: 0;
align-self: center;
`
), g = I(
({ icon: e, size: n = "md", variant: r, ...s }, f) => {
const t = l(() => {
if (e === null) return null;
if (e) return e;
if (r === "default") return /* @__PURE__ */ o.jsx(c, { size: n });
if (r === "success") return /* @__PURE__ */ o.jsx(u, { size: n });
if (r === "info") return /* @__PURE__ */ o.jsx(m, { size: n });
if (r === "warning") return /* @__PURE__ */ o.jsx(i, { size: n });
if (r === "danger") return /* @__PURE__ */ o.jsx(a, { size: n });
if (r === "ai") return /* @__PURE__ */ o.jsx(x, { size: n });
}, [n, e, r]);
return t ? /* @__PURE__ */ o.jsx(h, { ref: f, variant: r, ...s, children: t }) : null;
}
);
g.displayName = "VariantIcon";
export {
g as VariantIcon
};