xtreme-ui
Version:
Collection of reusable components that can be used in web projects
26 lines (25 loc) • 1.25 kB
JavaScript
"use client";
import { jsxs as x, jsx as i } from "react/jsx-runtime";
import N from "clsx";
import { Icon as B } from "gliff";
import { forwardRef as g } from "react";
import { ProgressBar as z } from "../ProgressBar/ProgressBar.js";
import './button.css';/* empty css */
import { EButtonTypes as S } from "./types.js";
const b = {
mini: { "--iconSize": "12px" },
default: { "--iconSize": "14px" },
large: { "--iconSize": "22px" }
}, h = g((a, c) => {
const { className: m, style: p = {}, label: e, type: t = "primary", size: n = "default", disabled: d = !1, loading: l = !1, icon: o, iconType: f, iconPosition: s = "left", onClick: u } = a, r = o ? /* @__PURE__ */ i(B, { className: "icon", code: o, type: f, style: b[n] }) : null, y = N("xtrButton", "shadowRipple", `${t}Type`, `${n}Size`, !e && "iconOnly", l && "loading", m);
return !e && !o ? null : /* @__PURE__ */ x("button", { ref: c, className: y, style: p, onClick: u, disabled: d, children: [
t.includes(S.link) && /* @__PURE__ */ i(z, { className: "underline", intermediate: l }),
s === "left" && r,
e && /* @__PURE__ */ i("span", { className: "label", children: e }),
s === "right" && r
] });
});
h.displayName = "Button";
export {
h as Button
};