@lanaco/lnc-react-ui
Version:
React component library
163 lines (161 loc) • 3.12 kB
JavaScript
import { jsx as a } from "react/jsx-runtime";
import { forwardRef as O } from "react";
import { P as t } from "./index-S5Cd7WrG.js";
import { n as _ } from "./emotion-styled.browser.esm-CjCaF13H.js";
import { T as v } from "./react-toastify.esm--2awuizG.js";
import { b as e, a as C } from "./utils-DtRLzzTZ.js";
import { useTheme as $ } from "./ThemeProvider.js";
const P = _.div`
& .lnc-notification {
& > div {
background-color: ${(o) => e(
o.theme,
"Notification",
o.color,
"enabled",
"background",
"backgroundOpacity"
)};
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1),
0px 4px 6px -2px rgba(0, 0, 0, 0.05);
border: ${(o) => `1px solid ${e(
o.theme,
"Notification",
"default",
"enabled",
"border"
)}`};
border-radius: ${(o) => C(o.theme, "regular")};
}
& .Toastify__close-button {
& svg {
fill: ${(o) => e(
o.theme,
"Notification",
"default",
"enabled",
"icon"
)};
}
}
& .Toastify__toast--success {
& svg {
fill: ${(o) => e(
o.theme,
"Notification",
"success",
"enabled",
"icon"
)};
}
}
& .Toastify__toast--information {
& svg {
fill: ${(o) => e(
o.theme,
"Notification",
"information",
"enabled",
"icon"
)};
}
}
& .Toastify__toast--danger {
& svg {
fill: ${(o) => e(
o.theme,
"Notification",
"warning",
"enabled",
"icon"
)};
}
}
& .Toastify__toast--error {
& svg {
fill: ${(o) => e(
o.theme,
"Notification",
"danger",
"enabled",
"icon"
)};
}
}
}
`, w = O((o, i) => {
const {
position: s = "top-right",
autoClose: n = 5e5,
hideProgressBar: r = !0,
newestOnTop: l = !0,
closeOnClick: c = !0,
rtl: f = !1,
pauseOnFocusLoss: m = !1,
draggable: p = !1,
pauseOnHover: b = !1,
closeButton: d = !0,
className: u = "",
style: g = {},
size: h = "small",
toastContainerProps: y,
...N
} = o, { theme: x } = $(), T = {
theme: x,
className: "lnc-ui-notification " + u,
style: g,
size: h
};
return /* @__PURE__ */ a(P, { ref: i, ...T, ...N, children: /* @__PURE__ */ a(
v,
{
position: s,
autoClose: n,
hideProgressBar: r,
newestOnTop: l,
closeOnClick: c,
rtl: f,
pauseOnFocusLoss: m,
draggable: p,
pauseOnHover: b,
closeButton: d,
className: "lnc-notification",
...y
}
) });
});
w.propTypes = {
position: t.oneOf([
"top-right",
"top-center",
"top-left",
"bottom-right",
"bottom-center",
"bottom-left"
]),
/**
* Value in ms
*/
autoClose: t.number,
hideProgressBar: t.bool,
newestOnTop: t.bool,
closeOnClick: t.bool,
/**
* Right to Left
*/
rtl: t.bool,
pauseOnFocusLoss: t.bool,
draggable: t.bool,
pauseOnHover: t.bool,
closeButton: t.bool,
//----------------------------
className: t.string,
style: t.object,
/**
* Other react-toastify ToastContainer props.
*/
toastContainerProps: t.any
};
export {
w as default
};