@pixpilot/shadcn 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,7 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/ui/dialog.d.ts
|
|
6
6
|
declare function Dialog({
|
|
7
|
+
modal,
|
|
7
8
|
...props
|
|
8
9
|
}: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime60.JSX.Element;
|
|
9
10
|
declare function DialogTrigger({
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
|
-
import "react";
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { XIcon } from "lucide-react";
|
|
5
5
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
6
|
|
|
7
7
|
//#region src/components/ui/dialog.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const dialogOverlayBaseClass = "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";
|
|
9
|
+
const DialogContainerContext = React.createContext(null);
|
|
10
|
+
const DialogContentPrimitive = DialogPrimitive.Content;
|
|
11
|
+
function Dialog({ modal,...props }) {
|
|
12
|
+
const [hasContainer, setHasContainer] = React.useState(false);
|
|
13
|
+
const contextValue = React.useMemo(() => ({
|
|
14
|
+
hasContainer,
|
|
15
|
+
modal,
|
|
16
|
+
setHasContainer
|
|
17
|
+
}), [hasContainer, modal]);
|
|
18
|
+
return /* @__PURE__ */ jsx(DialogContainerContext.Provider, {
|
|
19
|
+
value: contextValue,
|
|
20
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
21
|
+
"data-slot": "dialog",
|
|
22
|
+
modal: hasContainer ? false : modal,
|
|
23
|
+
...props
|
|
24
|
+
})
|
|
12
25
|
});
|
|
13
26
|
}
|
|
14
27
|
function DialogTrigger({ ...props }) {
|
|
@@ -32,16 +45,27 @@ function DialogClose({ ...props }) {
|
|
|
32
45
|
function DialogOverlay({ className,...props }) {
|
|
33
46
|
return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
34
47
|
"data-slot": "dialog-overlay",
|
|
35
|
-
className: cn(
|
|
48
|
+
className: cn(dialogOverlayBaseClass, className),
|
|
36
49
|
...props
|
|
37
50
|
});
|
|
38
51
|
}
|
|
39
52
|
function DialogContent({ className, children, showCloseButton = true, disableOutsideClick = false, container, onPointerDownOutside,...props }) {
|
|
53
|
+
const dialogContainer = React.use(DialogContainerContext);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (!dialogContainer) return;
|
|
56
|
+
dialogContainer.setHasContainer(Boolean(container));
|
|
57
|
+
}, [container, dialogContainer]);
|
|
40
58
|
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
41
59
|
container: container ?? void 0,
|
|
42
60
|
"data-slot": "dialog-portal",
|
|
43
|
-
children: [
|
|
61
|
+
children: [container ? /* @__PURE__ */ jsx("div", {
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
"data-slot": "dialog-overlay",
|
|
64
|
+
"data-state": "open",
|
|
65
|
+
className: cn(dialogOverlayBaseClass, "absolute")
|
|
66
|
+
}) : /* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogContentPrimitive, {
|
|
44
67
|
"data-slot": "dialog-content",
|
|
68
|
+
disableOutsidePointerEvents: container ? false : void 0,
|
|
45
69
|
onPointerDownOutside: (event) => {
|
|
46
70
|
onPointerDownOutside?.(event);
|
|
47
71
|
if (disableOutsideClick) {
|
package/package.json
CHANGED