dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
138 lines (137 loc) • 4.34 kB
JavaScript
import { j as l } from "../../jsx-runtime-DS1N_tNq.js";
import { a as s } from "../../index-BL59b1Bz-C9bJE_xn.js";
import * as n from "react";
import { x as w, C as b, R as k, h as r, y as v, E as i, P as c, _ as x } from "../../index-C4qYhCZt-BZQduTld.js";
import { k as R } from "../../createLucideIcon-B950nf2d-9wLYOF5y.js";
import { m as d } from "../../utils-B6fNqzRf-B1_jG1K7.js";
/**
* @license lucide-react v0.511.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const C = [
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], D = R("x", C), E = w, M = b, P = k, f = n.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ s.jsx(
x,
{
ref: t,
className: d(
"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/80",
e
),
...a
}
));
f.displayName = x.displayName;
const p = n.forwardRef(({ className: e, children: a, hasCloseButton: t, ...m }, o) => /* @__PURE__ */ s.jsxs(P, { children: [
/* @__PURE__ */ s.jsx(f, {}),
/* @__PURE__ */ s.jsxs(
r,
{
ref: o,
className: d(
"bg-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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",
e
),
...m,
children: [
a,
t && /* @__PURE__ */ s.jsxs(v, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none", children: [
/* @__PURE__ */ s.jsx(D, { className: "size-4" }),
/* @__PURE__ */ s.jsx("span", { className: "sr-only", children: "Close" })
] })
]
}
)
] }));
p.displayName = r.displayName;
const u = ({
className: e,
...a
}) => /* @__PURE__ */ s.jsx(
"div",
{
className: d(
"flex flex-col space-y-1.5 text-center sm:text-left",
e
),
...a
}
);
u.displayName = "DialogHeader";
const N = ({
className: e,
...a
}) => /* @__PURE__ */ s.jsx(
"div",
{
className: d(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
e
),
...a
}
);
N.displayName = "DialogFooter";
const h = n.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ s.jsx(
i,
{
ref: t,
className: d(
"text-lg leading-none font-semibold tracking-tight",
e
),
...a
}
));
h.displayName = i.displayName;
const g = n.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ s.jsx(
c,
{
ref: t,
className: d("text-muted-foreground text-sm", e),
...a
}
));
g.displayName = c.displayName;
const H = ({
header: e,
footer: a,
trigger: t,
children: m,
size: o = "lg",
className: y,
...j
}) => /* @__PURE__ */ l.jsxs(E, { ...j, children: [
t && /* @__PURE__ */ l.jsx(M, { asChild: !0, children: t }),
/* @__PURE__ */ l.jsxs(
p,
{
className: d(
"data-[state=open]:animate-contentShowTop top-4 bottom-auto max-h-[calc(100vh-2rem)] max-w-lg translate-y-0 overflow-y-auto",
o === "xl" && "max-w-xl",
o === "2xl" && "max-w-2xl",
o === "3xl" && "max-w-3xl",
o === "4xl" && "max-w-5xl",
o === "5xl" && "max-w-5xl",
o === "6xl" && "max-w-6xl",
o === "7xl" && "max-w-7xl",
o === "full" && "max-w-[95%]",
y
),
children: [
/* @__PURE__ */ l.jsxs(u, { children: [
/* @__PURE__ */ l.jsx(h, { className: "mb-0", children: e }),
/* @__PURE__ */ l.jsx(g, { className: "hidden" })
] }),
m,
a && /* @__PURE__ */ l.jsx(N, { children: a })
]
}
)
] });
export {
H as MyModal
};