laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
141 lines (140 loc) • 3.78 kB
JavaScript
"use client";
import { jsx as a, jsxs as n } from "react/jsx-runtime";
import { Root as c, Trigger as g, Content as f, Close as l, Title as u, Description as m, Portal as p, Overlay as x } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
import { cn as o } from "../../lib/utils.js";
import D from "../../node_modules/lucide-react/dist/esm/icons/x.js";
function C({
...t
}) {
return /* @__PURE__ */ a(c, { "data-slot": "dialog", ...t });
}
function k({
...t
}) {
return /* @__PURE__ */ a(g, { "data-slot": "dialog-trigger", ...t });
}
function v({
...t
}) {
return /* @__PURE__ */ a(p, { "data-slot": "dialog-portal", ...t });
}
function T({
...t
}) {
return /* @__PURE__ */ a(l, { "data-slot": "dialog-close", ...t });
}
function b({
className: t,
...e
}) {
return /* @__PURE__ */ a(
x,
{
"data-slot": "dialog-overlay",
className: o(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
t
),
...e
}
);
}
function j({
className: t,
children: e,
size: r = "default",
...i
}) {
const d = {
sm: "sm:max-w-sm",
default: "sm:max-w-lg",
lg: "sm:max-w-2xl",
xl: "sm:max-w-3xl"
}[r];
return /* @__PURE__ */ n(v, { "data-slot": "dialog-portal", children: [
/* @__PURE__ */ a(b, {}),
/* @__PURE__ */ n(
f,
{
"data-slot": "dialog-content",
onPointerDownOutside: (s) => {
s.target?.closest("[data-command-portal]") && s.preventDefault();
},
className: o(
"bg-d-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-d-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",
d,
t
),
...i,
children: [
e,
/* @__PURE__ */ n(l, { className: "ring-offset-d-background focus:ring-d-ring data-[state=open]:bg-d-accent data-[state=open]:text-d-secondary-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
/* @__PURE__ */ a(D, {}),
/* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
] })
]
}
)
] });
}
function O({ className: t, ...e }) {
return /* @__PURE__ */ a(
"div",
{
"data-slot": "dialog-header",
className: o("flex flex-col gap-2 text-center sm:text-left", t),
...e
}
);
}
function P({ className: t, ...e }) {
return /* @__PURE__ */ a(
"div",
{
"data-slot": "dialog-footer",
className: o(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
t
),
...e
}
);
}
function _({
className: t,
...e
}) {
return /* @__PURE__ */ a(
u,
{
"data-slot": "dialog-title",
className: o("text-lg leading-none font-semibold", t),
...e
}
);
}
function F({
className: t,
...e
}) {
return /* @__PURE__ */ a(
m,
{
"data-slot": "dialog-description",
className: o("text-d-secondary-foreground text-sm", t),
...e
}
);
}
export {
C as Dialog,
T as DialogClose,
j as DialogContent,
F as DialogDescription,
P as DialogFooter,
O as DialogHeader,
b as DialogOverlay,
v as DialogPortal,
_ as DialogTitle,
k as DialogTrigger
};