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