UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

77 lines (76 loc) 3.35 kB
"use client"; import { jsx as S, jsxs as y } from "react/jsx-runtime"; import { d as E } from "./index.D-sRdssb.js"; import { c as W } from "./index.DL9mof6u.js"; import { forwardRef as L } from "react"; import { D as M } from "./Button.Cn5yg7dG.js"; import { D as O } from "./Icon.CDLyB7Pv.js"; import '../assets/Toast.CGyKXb4V.css';const P = "ds-toast_root_1jbef_5", z = "ds-toast_root--closing_1jbef_15", A = "ds-toast_root--success_1jbef_56", R = "ds-toast_root--info_1jbef_60", $ = "ds-toast_root--warning_1jbef_64", q = "ds-toast_content_1jbef_69", F = "ds-toast_content--hide-icon_1jbef_76", G = "ds-toast_icon_1jbef_80", J = "ds-toast_message_1jbef_84", s = { root: P, rootClosing: z, rootSuccess: A, rootInfo: R, rootWarning: $, content: q, contentHideIcon: F, icon: G, message: J }, K = { success: "circle-check-colored", warning: "triangle-exclamationmark-colored", info: "circle-info-colored" }, Q = L((C, D) => { const o = E.c(44); let e, n, t, c, a, l, i, p, h; o[0] !== C ? ({ message: t, className: e, closeButtonProps: n, hideIcon: p, variant: h, onClick: c, onMouseEnter: a, onMouseLeave: l, ...i } = C, o[0] = C, o[1] = e, o[2] = n, o[3] = t, o[4] = c, o[5] = a, o[6] = l, o[7] = i, o[8] = p, o[9] = h) : (e = o[1], n = o[2], t = o[3], c = o[4], a = o[5], l = o[6], i = o[7], p = o[8], h = o[9]); const r = p === void 0 ? !1 : p, d = h === void 0 ? "info" : h; let f; o[10] !== n ? (f = n || {}, o[10] = n, o[11] = f) : f = o[11]; let m, j; o[12] !== f ? ({ label: j, ...m } = f, o[12] = f, o[13] = m, o[14] = j) : (m = o[13], j = o[14]); const x = j === void 0 ? "Close toast" : j, w = d === "success", T = d === "warning", k = d === "info"; let v; o[15] !== e || o[16] !== w || o[17] !== T || o[18] !== k ? (v = W(s.root, e, { [s.rootSuccess]: w, [s.rootWarning]: T, [s.rootInfo]: k }), o[15] = e, o[16] = w, o[17] = T, o[18] = k, o[19] = v) : v = o[19]; const B = v; let I; o[20] !== r ? (I = W(s.content, { [s.contentHideIcon]: r }), o[20] = r, o[21] = I) : I = o[21]; const H = I; let _; o[22] !== r || o[23] !== d ? (_ = !r && /* @__PURE__ */ S(O, { name: K[d], className: s.icon, "aria-hidden": "true" }), o[22] = r, o[23] = d, o[24] = _) : _ = o[24]; let u; o[25] !== t ? (u = /* @__PURE__ */ S("div", { className: s.message, children: t }), o[25] = t, o[26] = u) : u = o[26]; let g; o[27] !== x || o[28] !== c || o[29] !== m ? (g = /* @__PURE__ */ S(M, { ...m, hideLabel: !0, iconName: "cross", size: "small", variant: "ghost", onClick: c, children: x }), o[27] = x, o[28] = c, o[29] = m, o[30] = g) : g = o[30]; let b; o[31] !== H || o[32] !== _ || o[33] !== u || o[34] !== g ? (b = /* @__PURE__ */ y("div", { className: H, children: [ _, u, g ] }), o[31] = H, o[32] = _, o[33] = u, o[34] = g, o[35] = b) : b = o[35]; let N; return o[36] !== t || o[37] !== a || o[38] !== l || o[39] !== D || o[40] !== i || o[41] !== B || o[42] !== b ? (N = /* @__PURE__ */ S("aside", { className: B, ref: D, popover: "manual", "data-ds-toast": !0, onMouseEnter: a, onMouseLeave: l, "aria-label": t, ...i, children: b }), o[36] = t, o[37] = a, o[38] = l, o[39] = D, o[40] = i, o[41] = B, o[42] = b, o[43] = N) : N = o[43], N; }); Q.displayName = "DSToast"; export { Q as D, s };