laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
133 lines (132 loc) • 3.78 kB
JavaScript
"use client";
import { jsx as o, jsxs as s } from "react/jsx-runtime";
import { Root as i, Content as l, Close as c, Description as f, Title as m, Trigger as u, Portal as h, Overlay as p } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
import { designTokens as n } from "../design-tokens.js";
import { cn as a } from "../../lib/utils.js";
import b from "../../node_modules/lucide-react/dist/esm/icons/x.js";
function T({ ...t }) {
return /* @__PURE__ */ o(i, { "data-slot": "sheet", ...t });
}
function k({
...t
}) {
return /* @__PURE__ */ o(u, { "data-slot": "sheet-trigger", ...t });
}
function g({
...t
}) {
return /* @__PURE__ */ o(h, { "data-slot": "sheet-portal", ...t });
}
function x({
className: t,
...e
}) {
return /* @__PURE__ */ o(
p,
{
"data-slot": "sheet-overlay",
className: a(
"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 C({
className: t,
children: e,
side: r = "right",
...d
}) {
return /* @__PURE__ */ s(g, { children: [
/* @__PURE__ */ o(x, {}),
/* @__PURE__ */ s(
l,
{
"data-slot": "sheet-content",
className: a(
"bg-d-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
r === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right border-d-border inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
r === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left border-d-border inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
r === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top border-d-border inset-x-0 top-0 h-auto border-b",
r === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom border-d-border inset-x-0 bottom-0 h-auto border-t",
t
),
...d,
children: [
e,
/* @__PURE__ */ s(
c,
{
className: a(
"ring-offset-d-background data-[state=open]:bg-d-secondary absolute top-4 right-4 opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none",
n.focusRing,
n.radius.sm
),
children: [
/* @__PURE__ */ o(b, { className: "size-4" }),
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
]
}
)
]
}
)
] });
}
function z({ className: t, ...e }) {
return /* @__PURE__ */ o(
"div",
{
"data-slot": "sheet-header",
className: a("flex flex-col gap-1.5 p-4", t),
...e
}
);
}
function j({ className: t, ...e }) {
return /* @__PURE__ */ o(
"div",
{
"data-slot": "sheet-footer",
className: a("mt-auto flex flex-col gap-2 p-4", t),
...e
}
);
}
function D({
className: t,
...e
}) {
return /* @__PURE__ */ o(
m,
{
"data-slot": "sheet-title",
className: a("text-d-foreground font-semibold", t),
...e
}
);
}
function O({
className: t,
...e
}) {
return /* @__PURE__ */ o(
f,
{
"data-slot": "sheet-description",
className: a("text-d-secondary-foreground text-sm", t),
...e
}
);
}
export {
T as Sheet,
C as SheetContent,
O as SheetDescription,
j as SheetFooter,
z as SheetHeader,
D as SheetTitle,
k as SheetTrigger
};