UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

72 lines (71 loc) 3.23 kB
"use client"; import { jsx as a } from "react/jsx-runtime"; import { useTheme as u } from "../../node_modules/next-themes/dist/index.js"; import { Toaster as n } from "../../node_modules/sonner/dist/index.js"; import { toast as w } from "../../node_modules/sonner/dist/index.js"; import { Icon as o } from "./icon.js"; import { Spinner as l } from "./spinner.js"; import { cn as e } from "../../lib/utils.js"; const x = ({ toastOptions: r, icons: t, theme: c, ...s }) => { const { theme: d = "system" } = u(); return /* @__PURE__ */ a( n, { theme: c ?? d, className: e("group/toaster", s.className), toastOptions: { ...r, classNames: { closeButton: e( "!bg-d-background !text-d-foreground !border-d-border", r?.classNames?.closeButton ), toast: e( "group/toast !bg-d-background/85 backdrop-blur-md !text-d-foreground !border-d-border !shadow-lg", r?.classNames?.toast ), description: e( "!text-d-muted-foreground group-data-[rich-colors=true]/toast:group-data-[type=error]/toast:!text-d-destructive-foreground group-data-[rich-colors=true]/toast:group-data-[type=warning]/toast:!text-d-warning-foreground group-data-[rich-colors=true]/toast:group-data-[type=info]/toast:!text-d-muted-foreground group-data-[rich-colors=true]/toast:group-data-[type=success]/toast:!text-d-success-foreground", r?.classNames?.description ), actionButton: e( "bg-d-primary text-d-primary-foreground", r?.classNames?.actionButton ), cancelButton: e( "bg-d-secondary text-d-secondary-foreground", r?.classNames?.cancelButton ), error: e( "data-[rich-colors=true]:!bg-d-destructive/85 data-[rich-colors=true]:!text-d-destructive-foreground data-[rich-colors=true]:!border-d-destructive data-[rich-colors=false]:!text-d-destructive", r?.classNames?.error ), warning: e( "data-[rich-colors=true]:!bg-d-warning-background/85 data-[rich-colors=true]:!text-d-warning-foreground data-[rich-colors=true]:!border-d-warning data-[rich-colors=false]:!text-d-warning", r?.classNames?.warning ), success: e( "data-[rich-colors=true]:!bg-d-success-background/85 data-[rich-colors=true]:!text-d-success-foreground data-[rich-colors=true]:!border-d-success data-[rich-colors=false]:!text-d-success", r?.classNames?.success ), loader: e("", r?.classNames?.loader), icon: e("!size-5 !mx-0", r?.classNames?.icon), ...r?.classNames } }, icons: { success: /* @__PURE__ */ a(o, { name: "Check", className: "size-5" }), info: /* @__PURE__ */ a(o, { name: "Info", className: "size-5" }), warning: /* @__PURE__ */ a(o, { name: "TriangleAlert", className: "size-5" }), error: /* @__PURE__ */ a(o, { name: "OctagonAlert", className: "size-5" }), loading: /* @__PURE__ */ a(l, { className: "size-5" }), ...t }, ...s } ); }; export { x as Toaster, w as toast };