@lanaco/lnc-react-ui
Version:
React component library
128 lines (127 loc) • 3.62 kB
JavaScript
import { jsx as t, jsxs as R } from "react/jsx-runtime";
import { forwardRef as S, cloneElement as E } from "react";
import { s } from "./emotion-styled.browser.esm-DfbrHHed.js";
import m from "./Icon.js";
import { c as d } from "./utils-BUdHa0nB.js";
import M from "./Modal.js";
import { u as O } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const V = s.div`
display: flex;
gap: 1rem;
align-items: center;
${(e) => e.type == "centered" && "flex-direction: column; gap: 1.25rem;"}
& .alert-icon {
font-size: 2.2rem;
color: ${(e) => d(
e.theme,
"ConfirmationForm",
e.color,
"enabled",
"icon"
)};
}
${(e) => e.type == "centered" && "padding-top: 0.5rem;"}
`, q = s.div`
display: flex;
flex-direction: ${(e) => e.type == "regular" ? "row" : "column"};
width: 100%;
flex: 1;
gap: 0.5rem;
justify-content: ${(e) => D(e.actionsAlignment)};
${(e) => e.type == "regular" && "height: 4rem; border-radius: 0 0 16px 16px; padding: 0.75rem 1.5rem 0.75rem 1.5rem;"}
${(e) => e.type == "regular" && e.actionsTrack == !1 && "padding: 0 1.5rem 1.5rem 1.5rem;"}
${(e) => e.type == "regular" && e.actionsTrack == !0 && `background-color: ${d(
e.theme,
"ConfirmationForm",
"primary",
"enabled",
"trackBg"
)};`}
${(e) => e.type == "centered" && "padding: 1rem 0 0.5rem 0;"}
`, D = (e) => e == "right" ? "end" : e == "left" ? "start" : "center", X = S((e, f) => {
const {
color: u,
statusIcon: g = !0,
title: p,
type: o = "regular",
actions: y,
actionsAlignment: h = "right",
actionsTrack: x = !1,
overlay: k = !0,
showCloseButton: $ = !0,
onClose: T = () => {
},
zIndex: C = 1e3,
size: A = "fluid",
clickOutsideToClose: b = !1,
className: N = "",
style: v = {},
overlayProps: w,
rest: j
} = e;
let i = {
theme: O(),
size: A,
zIndex: C,
className: "lnc-ui-confirmation-form " + N,
style: v
};
const P = (r) => r == "danger" ? "times-circle" : r == "warning" ? "exclamation-triangle" : r == "success" ? "check-circle" : "exclamation-circle", z = ({ statusIcon: r, color: n }) => typeof r == "boolean" && r == !0 ? /* @__PURE__ */ t(m, { className: "alert-icon", icon: P(n) }) : typeof r == "string" && r !== "" ? /* @__PURE__ */ t(m, { className: "alert-icon", icon: r }) : E(r, {
className: "alert-icon " + (r == null ? void 0 : r.className)
}), F = ({ statusIcon: r, color: n, title: l, type: c, themeProps: a }) => /* @__PURE__ */ R(V, { ...a, color: n, type: c, children: [
/* @__PURE__ */ t(z, { statusIcon: r, color: n }),
/* @__PURE__ */ t("h3", { children: l })
] }), B = ({
actions: r,
type: n,
actionsAlignment: l,
actionsTrack: c,
themeProps: a
}) => /* @__PURE__ */ t(
q,
{
type: n,
actionsAlignment: l,
actionsTrack: c,
...a,
children: r
}
);
return /* @__PURE__ */ t(
M,
{
ref: f,
...i,
header: o == "regular" ? /* @__PURE__ */ t(
F,
{
statusIcon: g,
color: u,
title: p,
type: o,
themeProps: i
}
) : null,
footer: o == "regular" ? /* @__PURE__ */ t(
B,
{
actions: y,
type: o,
actionsAlignment: h,
actionsTrack: x,
themeProps: i
}
) : null,
overlay: k,
showCloseButton: $,
onClose: T,
clickOutsideToClose: b,
overlayProps: w,
...j,
children: /* @__PURE__ */ t("div", { children: "okej" })
}
);
});
export {
X as default
};