UNPKG

laif-ds

Version:

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

124 lines (123 loc) 3.7 kB
"use client"; import { jsx as l, jsxs as a } from "react/jsx-runtime"; import { cva as D } from "../../node_modules/class-variance-authority/dist/index.js"; import { Button as C } from "./button.js"; import { Dialog as b, DialogTrigger as y, DialogContent as z, DialogHeader as j, DialogClose as A, DialogFooter as B } from "./dialog.js"; import { Typo as u } from "./typo.js"; import { cn as s } from "../../lib/utils.js"; const T = D( [ "flex flex-col justify-between gap-2 w-full h-dvh max-w-[initial] p-6", "max-sm:rounded-none max-sm:px-2 max-sm:py-3 max-sm:min-w-full max-sm:min-h-full max-sm:w-full max-sm:h-full max-sm:max-w-full max-sm:max-h-full" ], { variants: { size: { sm: "min-w-5/12 min-h-5/12 w-5/12 h-5/12 max-w-5/12 max-h-5/12", default: "min-w-7/12 min-h-7/12 w-7/12 h-7/12 max-w-7/12 max-h-7/12", lg: "min-w-9/12 min-h-9/12 w-9/12 h-9/12 max-w-9/12 max-h-9/12", xl: "min-w-11/12 min-h-11/12 w-11/12 h-11/12 max-w-11/12 max-h-11/12", full: "min-w-full min-h-full w-full h-full max-w-full max-h-full rounded-none" } }, defaultVariants: { size: "default" } } ); function E({ children: o, trigger: m, title: n, description: e, footer: i, size: d = "default", open: f, defaultOpen: c, onOpenChange: r, triggerClassName: x, headerClassName: w, bodyClassName: p, footerClassName: v, disabled: t = !1, asChild: g = !1, preventClose: V, ...h }) { const N = f !== void 0; return t ? /* @__PURE__ */ l("div", { className: x, children: m }) : /* @__PURE__ */ a( b, { open: N ? f : void 0, defaultOpen: c, onOpenChange: r, children: [ m && /* @__PURE__ */ l( y, { asChild: g, className: x, disabled: t, children: m } ), /* @__PURE__ */ a( z, { ...h, className: s( T({ size: d }), h.className ), showCloseButton: !1, children: [ /* @__PURE__ */ a(j, { className: s("gap-1", w), children: [ /* @__PURE__ */ a("div", { className: "flex w-full flex-row items-start gap-2", children: [ /* @__PURE__ */ l(u, { variant: "h5", className: "flex flex-1", children: n }), /* @__PURE__ */ l(A, { asChild: !0, children: /* @__PURE__ */ l( C, { iconLeft: "X", variant: "ghost", size: "icon", className: "size-7", onClick: () => r?.(!1) } ) }) ] }), e && /* @__PURE__ */ l( u, { variant: "caption", className: "text-d-secondary-foreground flex flex-1", children: e } ) ] }), o && /* @__PURE__ */ l( "div", { className: s( "border-d-border flex min-h-0 w-full flex-1 flex-col gap-2 overflow-auto py-2", (!!n || !!e) && "border-t", !!i && "border-b", p ), children: o } ), i && /* @__PURE__ */ l(B, { className: v, children: i }) ] } ) ] } ); } export { E as AppDialog, A as AppDialogClose, E as default };