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