@oneplatformdev/ui 0.0.1-beta.134 → 0.0.1-beta.135
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.
- package/Dialog/Dialog.mjs +54 -52
- package/Popover/Popover.d.ts +1 -1
- package/Popover/Popover.mjs +6 -6
- package/package.json +1 -1
package/Dialog/Dialog.mjs
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
1
|
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import i, { useState as p, useEffect as b, useRef as D, useMemo as h } from "react";
|
|
3
3
|
import * as e from "@radix-ui/react-dialog";
|
|
4
|
-
import { XIcon as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { DialogOverlayScope as
|
|
7
|
-
const
|
|
4
|
+
import { XIcon as v } from "lucide-react";
|
|
5
|
+
import { cn as n, composeRefs as C } from "@oneplatformdev/utils";
|
|
6
|
+
import { DialogOverlayScope as w } from "./DialogOverlayScope.mjs";
|
|
7
|
+
const q = e.Root, B = e.Trigger, R = e.Portal, I = e.Close, g = i.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
|
|
8
8
|
e.Overlay,
|
|
9
9
|
{
|
|
10
10
|
ref: s,
|
|
11
|
-
className:
|
|
11
|
+
className: n(
|
|
12
12
|
"fixed inset-0 z-40 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",
|
|
13
13
|
t
|
|
14
14
|
),
|
|
15
15
|
...a
|
|
16
16
|
}
|
|
17
17
|
));
|
|
18
|
-
|
|
19
|
-
const
|
|
18
|
+
g.displayName = e.Overlay.displayName;
|
|
19
|
+
const E = i.forwardRef(
|
|
20
20
|
({
|
|
21
21
|
className: t,
|
|
22
22
|
children: a,
|
|
23
23
|
showCloseButton: s = !0,
|
|
24
24
|
onOpenAutoFocus: d,
|
|
25
25
|
preventAutoFocus: u,
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
const [
|
|
26
|
+
...y
|
|
27
|
+
}, m) => {
|
|
28
|
+
const [l] = p(() => {
|
|
29
29
|
if (typeof document > "u") return null;
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
return document.body.appendChild(
|
|
36
|
-
|
|
30
|
+
const r = document.createElement("div");
|
|
31
|
+
return r.setAttribute("data-dialog-portal", ""), r;
|
|
32
|
+
}), [x, N] = p();
|
|
33
|
+
b(() => {
|
|
34
|
+
if (l)
|
|
35
|
+
return document.body.appendChild(l), () => {
|
|
36
|
+
l.remove();
|
|
37
37
|
};
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
40
|
-
return console.log("localRef",
|
|
41
|
-
/* @__PURE__ */ o(
|
|
42
|
-
/* @__PURE__ */ o(
|
|
38
|
+
}, [l]);
|
|
39
|
+
const f = D(null);
|
|
40
|
+
return h(() => C(m, f), [m]), console.log("localRef", f), console.log("portalEl", l), console.log("container", x), l ? /* @__PURE__ */ c(R, { children: [
|
|
41
|
+
/* @__PURE__ */ o(g, {}),
|
|
42
|
+
/* @__PURE__ */ o(w, { value: l, children: /* @__PURE__ */ c(
|
|
43
43
|
e.Content,
|
|
44
44
|
{
|
|
45
|
-
ref:
|
|
46
|
-
|
|
45
|
+
ref: (r) => {
|
|
46
|
+
N(r);
|
|
47
|
+
},
|
|
48
|
+
className: n(
|
|
47
49
|
"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",
|
|
48
50
|
"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",
|
|
49
51
|
"max-w-[90%] max-h-[90%] overflow-hidden",
|
|
50
52
|
"bg-[#FCFCFC] border border-[#E8E9EB] rounded-[16px]",
|
|
51
53
|
t
|
|
52
54
|
),
|
|
53
|
-
onOpenAutoFocus: (
|
|
54
|
-
...
|
|
55
|
+
onOpenAutoFocus: (r) => (u && r.preventDefault(), d == null ? void 0 : d(r)),
|
|
56
|
+
...y,
|
|
55
57
|
children: [
|
|
56
58
|
a,
|
|
57
59
|
s && /* @__PURE__ */ c(
|
|
58
60
|
e.Close,
|
|
59
61
|
{
|
|
60
62
|
"aria-label": "Close",
|
|
61
|
-
className:
|
|
63
|
+
className: n(
|
|
62
64
|
"absolute right-4 top-4 rounded-sm ring-offset-background w-10 aspect-square",
|
|
63
65
|
"flex items-center justify-center",
|
|
64
66
|
"data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
@@ -70,7 +72,7 @@ const R = n.forwardRef(
|
|
|
70
72
|
"transition-opacity"
|
|
71
73
|
),
|
|
72
74
|
children: [
|
|
73
|
-
/* @__PURE__ */ o(
|
|
75
|
+
/* @__PURE__ */ o(v, { className: "h-4 w-4" }),
|
|
74
76
|
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
|
|
75
77
|
]
|
|
76
78
|
}
|
|
@@ -81,65 +83,65 @@ const R = n.forwardRef(
|
|
|
81
83
|
] }) : null;
|
|
82
84
|
}
|
|
83
85
|
);
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
+
E.displayName = e.Content.displayName;
|
|
87
|
+
const T = ({
|
|
86
88
|
className: t,
|
|
87
89
|
...a
|
|
88
90
|
}) => /* @__PURE__ */ o(
|
|
89
91
|
"div",
|
|
90
92
|
{
|
|
91
|
-
className:
|
|
93
|
+
className: n(
|
|
92
94
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
93
95
|
t
|
|
94
96
|
),
|
|
95
97
|
...a
|
|
96
98
|
}
|
|
97
99
|
);
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
+
T.displayName = "DialogHeader";
|
|
101
|
+
const j = ({
|
|
100
102
|
className: t,
|
|
101
103
|
...a
|
|
102
104
|
}) => /* @__PURE__ */ o(
|
|
103
105
|
"div",
|
|
104
106
|
{
|
|
105
|
-
className:
|
|
107
|
+
className: n(
|
|
106
108
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
107
109
|
t
|
|
108
110
|
),
|
|
109
111
|
...a
|
|
110
112
|
}
|
|
111
113
|
);
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
+
j.displayName = "DialogFooter";
|
|
115
|
+
const k = i.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
|
|
114
116
|
e.Title,
|
|
115
117
|
{
|
|
116
118
|
ref: s,
|
|
117
|
-
className:
|
|
119
|
+
className: n(
|
|
118
120
|
"text-lg font-semibold leading-none tracking-tight",
|
|
119
121
|
t
|
|
120
122
|
),
|
|
121
123
|
...a
|
|
122
124
|
}
|
|
123
125
|
));
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
+
k.displayName = e.Title.displayName;
|
|
127
|
+
const z = i.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
|
|
126
128
|
e.Description,
|
|
127
129
|
{
|
|
128
130
|
ref: s,
|
|
129
|
-
className:
|
|
131
|
+
className: n("text-sm text-muted-foreground", t),
|
|
130
132
|
...a
|
|
131
133
|
}
|
|
132
134
|
));
|
|
133
|
-
|
|
135
|
+
z.displayName = e.Description.displayName;
|
|
134
136
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
q as Dialog,
|
|
138
|
+
I as DialogClose,
|
|
139
|
+
E as DialogContent,
|
|
140
|
+
z as DialogDescription,
|
|
141
|
+
j as DialogFooter,
|
|
142
|
+
T as DialogHeader,
|
|
143
|
+
g as DialogOverlay,
|
|
144
|
+
R as DialogPortal,
|
|
145
|
+
k as DialogTitle,
|
|
146
|
+
B as DialogTrigger
|
|
145
147
|
};
|
package/Popover/Popover.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
-
declare const Popover:
|
|
3
|
+
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
4
|
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/Popover/Popover.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as m from "react";
|
|
3
3
|
import * as o from "@radix-ui/react-popover";
|
|
4
4
|
import { cn as p } from "@oneplatformdev/utils";
|
|
5
5
|
import { useDialogOverlayContainer as l } from "../Dialog/DialogOverlayScope.mjs";
|
|
6
|
-
const u =
|
|
6
|
+
const u = o.Root, P = o.Trigger, h = o.Anchor, c = m.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, style: n, ...i }, d) => {
|
|
7
7
|
const s = l();
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ t(o.Portal, { container: s, children: /* @__PURE__ */ t(
|
|
9
9
|
o.Content,
|
|
10
10
|
{
|
|
11
11
|
ref: d,
|
|
@@ -13,7 +13,7 @@ const u = (t) => /* @__PURE__ */ e(o.Root, { ...t, modal: !1 }), P = o.Trigger,
|
|
|
13
13
|
sideOffset: r,
|
|
14
14
|
className: p(
|
|
15
15
|
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
16
|
-
|
|
16
|
+
e
|
|
17
17
|
),
|
|
18
18
|
style: {
|
|
19
19
|
pointerEvents: "auto",
|
|
@@ -23,10 +23,10 @@ const u = (t) => /* @__PURE__ */ e(o.Root, { ...t, modal: !1 }), P = o.Trigger,
|
|
|
23
23
|
}
|
|
24
24
|
) });
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
c.displayName = o.Content.displayName;
|
|
27
27
|
export {
|
|
28
28
|
u as Popover,
|
|
29
29
|
h as PopoverAnchor,
|
|
30
|
-
|
|
30
|
+
c as PopoverContent,
|
|
31
31
|
P as PopoverTrigger
|
|
32
32
|
};
|