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