laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
128 lines (127 loc) • 3.54 kB
JavaScript
"use client";
import { jsx as e, jsxs as s } from "react/jsx-runtime";
import { Root as r, Trigger as d, Content as c, Close as g, Title as f, Description as u, Portal as m, Overlay as p } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
import { cn as o } from "../../lib/utils.js";
import x from "../../node_modules/lucide-react/dist/esm/icons/x.js";
function w({
...t
}) {
return /* @__PURE__ */ e(r, { "data-slot": "dialog", ...t });
}
function z({
...t
}) {
return /* @__PURE__ */ e(d, { "data-slot": "dialog-trigger", ...t });
}
function v({
...t
}) {
return /* @__PURE__ */ e(m, { "data-slot": "dialog-portal", ...t });
}
function D({
className: t,
...a
}) {
return /* @__PURE__ */ e(
p,
{
"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
),
...a
}
);
}
function k({
className: t,
children: a,
...l
}) {
return /* @__PURE__ */ s(v, { "data-slot": "dialog-portal", children: [
/* @__PURE__ */ e(D, {}),
/* @__PURE__ */ s(
c,
{
"data-slot": "dialog-content",
onPointerDownOutside: (i) => {
const n = i.target;
n != null && n.closest("[data-command-portal]") && i.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 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 sm:max-w-lg",
t
),
...l,
children: [
a,
/* @__PURE__ */ s(g, { 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__ */ e(x, {}),
/* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
] })
]
}
)
] });
}
function C({ className: t, ...a }) {
return /* @__PURE__ */ e(
"div",
{
"data-slot": "dialog-header",
className: o("flex flex-col gap-2 text-center sm:text-left", t),
...a
}
);
}
function T({ className: t, ...a }) {
return /* @__PURE__ */ e(
"div",
{
"data-slot": "dialog-footer",
className: o(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
t
),
...a
}
);
}
function j({
className: t,
...a
}) {
return /* @__PURE__ */ e(
f,
{
"data-slot": "dialog-title",
className: o("text-lg leading-none font-semibold", t),
...a
}
);
}
function O({
className: t,
...a
}) {
return /* @__PURE__ */ e(
u,
{
"data-slot": "dialog-description",
className: o("text-d-secondary-foreground text-sm", t),
...a
}
);
}
export {
w as Dialog,
k as DialogContent,
O as DialogDescription,
T as DialogFooter,
C as DialogHeader,
D as DialogOverlay,
v as DialogPortal,
j as DialogTitle,
z as DialogTrigger
};