UNPKG

ayongui

Version:
64 lines (63 loc) 1.81 kB
import { j as r } from "../../../react/jsx-runtime.mjs"; import o, { useState as E } from "react"; import t from "./index.module.less.mjs"; import "../icon/index.module.less.mjs"; import "../icon/components/loading-frame/loading.module.less.mjs"; import w from "../icon/components/tick-solid/index.mjs"; import i from "../icon/components/wrong-solid/index.mjs"; import l from "../icon/components/lament-solid/index.mjs"; import y from "../conditional-render/conditional-render.mjs"; import a from "../mount-dom/index.mjs"; const n = ({ onAyongClose: e, icon: m, message: f, showClose: p = !1, type: c, style: $, duration: g = 2 }) => { const [d, u] = E(!0), N = () => { u(!1), e(); }, s = t[c], x = { info: o.createElement(l, { className: `${t.tag} ${s}` }), success: o.createElement(w, { className: `${t.tag} ${s}` }), warning: o.createElement(l, { className: `${t.tag} ${s}` }), error: o.createElement(i, { className: `${t.tag} ${s}` }) }; return /* @__PURE__ */ r.jsx(y, { mode: "show", show: d, children: /* @__PURE__ */ r.jsxs( "div", { style: { ...$, zIndex: 1e3, animationDuration: g + "s" }, className: `${t.ayongMessage} ${s}`, onAnimationEnd: e, children: [ m ? o.createElement(m.type, { className: `${t.tag} ${s}` }) : x[c], f, p && /* @__PURE__ */ r.jsx( i, { className: ` ${t.close} ${s}`, onClick: N } ) ] } ) }); }, z = { info: (e) => { a({ element: n, ...e, type: "info" }); }, success: (e) => { a({ element: n, ...e, type: "success" }); }, warning: (e) => { a({ element: n, ...e, type: "warning" }); }, error: (e) => { a({ element: n, ...e, type: "error" }); } }; export { z as default };