dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
136 lines (135 loc) • 4.29 kB
JavaScript
import { j as l } from "../../jsx-runtime-C5mzlN2N.js";
import { a as s } from "../../index-DqTIeHVj-CYOpXZHK.js";
import * as n from "react";
import { v as j, x as w, C as b, _ as r, P as k, h as i, E as c, R as x } from "../../index-BTN0oPfn-DaQSYHfA.js";
import { m as d } from "../../utils-D0f6bOsw-HrLsble-.js";
import { k as v } from "../../createLucideIcon-B950nf2d-WasJb88J.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 R = [
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], C = v("x", R), D = j, E = w, M = b, f = n.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ s.jsx(
x,
{
ref: t,
className: d(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
e
),
...a
}
));
f.displayName = x.displayName;
const p = n.forwardRef(({ className: e, children: a, ...t }, m) => /* @__PURE__ */ s.jsxs(M, { children: [
/* @__PURE__ */ s.jsx(f, {}),
/* @__PURE__ */ s.jsxs(
r,
{
ref: m,
className: d(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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%] sm:rounded-lg",
e
),
...t,
children: [
a,
/* @__PURE__ */ s.jsxs(k, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
/* @__PURE__ */ s.jsx(C, { className: "h-4 w-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 font-semibold leading-none 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-sm text-muted-foreground", e),
...a
}
));
g.displayName = c.displayName;
const H = ({
header: e,
footer: a,
trigger: t,
children: m,
size: o = "lg",
...y
}) => /* @__PURE__ */ l.jsxs(D, { ...y, children: [
t && /* @__PURE__ */ l.jsx(E, { asChild: !0, children: t }),
/* @__PURE__ */ l.jsxs(
p,
{
className: d(
"fixed bottom-auto w-full max-w-lg top-4 translate-y-0 max-h-[calc(100vh-2rem)] overflow-y-auto data-[state=open]:animate-contentShowTop",
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%]"
),
children: [
/* @__PURE__ */ l.jsxs(u, { children: [
/* @__PURE__ */ l.jsx(h, { children: e }),
/* @__PURE__ */ l.jsx(g, { className: "hidden" })
] }),
m,
a && /* @__PURE__ */ l.jsx(N, { children: a })
]
}
)
] });
export {
H as MyModal
};