@oneplatformdev/ui 0.0.1-beta.136 → 0.0.1-beta.138
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 +72 -74
- package/Dialog/DialogOverlayScope.d.ts +2 -2
- package/Dialog/DialogOverlayScope.mjs +8 -8
- package/Dialog/index.mjs +5 -5
- package/Popover/Popover.mjs +15 -14
- package/index.mjs +2 -2
- package/package.json +1 -1
package/Dialog/Dialog.mjs
CHANGED
|
@@ -1,60 +1,50 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import i, { useState as
|
|
1
|
+
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import i, { useState as y, useRef as N } from "react";
|
|
3
3
|
import * as e from "@radix-ui/react-dialog";
|
|
4
|
-
import { XIcon as
|
|
5
|
-
import { cn as r, composeRefs as
|
|
6
|
-
import { DialogOverlayScope as
|
|
7
|
-
const
|
|
4
|
+
import { XIcon as D } from "lucide-react";
|
|
5
|
+
import { cn as r, composeRefs as b } from "@oneplatformdev/utils";
|
|
6
|
+
import { DialogOverlayScope as h } from "./DialogOverlayScope.mjs";
|
|
7
|
+
const F = e.Root, H = e.Trigger, v = e.Portal, _ = e.Close, c = i.forwardRef(({ className: a, ...t }, l) => /* @__PURE__ */ o(
|
|
8
8
|
e.Overlay,
|
|
9
9
|
{
|
|
10
|
-
ref:
|
|
10
|
+
ref: l,
|
|
11
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
|
+
a
|
|
14
14
|
),
|
|
15
|
-
...
|
|
15
|
+
...t
|
|
16
16
|
}
|
|
17
17
|
));
|
|
18
|
-
|
|
19
|
-
const
|
|
18
|
+
c.displayName = e.Overlay.displayName;
|
|
19
|
+
const w = i.forwardRef(
|
|
20
20
|
({
|
|
21
|
-
className:
|
|
22
|
-
children:
|
|
23
|
-
showCloseButton:
|
|
24
|
-
onOpenAutoFocus:
|
|
25
|
-
preventAutoFocus:
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
};
|
|
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(
|
|
21
|
+
className: a,
|
|
22
|
+
children: t,
|
|
23
|
+
showCloseButton: l = !0,
|
|
24
|
+
onOpenAutoFocus: n,
|
|
25
|
+
preventAutoFocus: f,
|
|
26
|
+
...m
|
|
27
|
+
}, p) => {
|
|
28
|
+
const [g, u] = y(null), x = N(null);
|
|
29
|
+
return /* @__PURE__ */ d(v, { children: [
|
|
30
|
+
/* @__PURE__ */ o(h, { value: g, children: /* @__PURE__ */ d(
|
|
43
31
|
e.Content,
|
|
44
32
|
{
|
|
45
|
-
ref: (
|
|
33
|
+
ref: (s) => {
|
|
34
|
+
s && b(p, x)(s);
|
|
35
|
+
},
|
|
46
36
|
className: r(
|
|
47
37
|
"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
38
|
"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
39
|
"max-w-[90%] max-h-[90%] overflow-hidden",
|
|
50
40
|
"bg-[#FCFCFC] border border-[#E8E9EB] rounded-[16px]",
|
|
51
|
-
|
|
41
|
+
a
|
|
52
42
|
),
|
|
53
|
-
onOpenAutoFocus: (
|
|
54
|
-
...
|
|
43
|
+
onOpenAutoFocus: (s) => (f && s.preventDefault(), n == null ? void 0 : n(s)),
|
|
44
|
+
...m,
|
|
55
45
|
children: [
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
t,
|
|
47
|
+
l && /* @__PURE__ */ d(
|
|
58
48
|
e.Close,
|
|
59
49
|
{
|
|
60
50
|
"aria-label": "Close",
|
|
@@ -70,76 +60,84 @@ const T = i.forwardRef(
|
|
|
70
60
|
"transition-opacity"
|
|
71
61
|
),
|
|
72
62
|
children: [
|
|
73
|
-
/* @__PURE__ */ o(
|
|
63
|
+
/* @__PURE__ */ o(D, { className: "h-4 w-4" }),
|
|
74
64
|
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
|
|
75
65
|
]
|
|
76
66
|
}
|
|
77
67
|
)
|
|
78
68
|
]
|
|
79
69
|
}
|
|
70
|
+
) }),
|
|
71
|
+
/* @__PURE__ */ o(c, { children: /* @__PURE__ */ o(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
ref: (s) => {
|
|
75
|
+
s && u(s);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
80
78
|
) })
|
|
81
|
-
] })
|
|
79
|
+
] });
|
|
82
80
|
}
|
|
83
81
|
);
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
className:
|
|
87
|
-
...
|
|
82
|
+
w.displayName = e.Content.displayName;
|
|
83
|
+
const C = ({
|
|
84
|
+
className: a,
|
|
85
|
+
...t
|
|
88
86
|
}) => /* @__PURE__ */ o(
|
|
89
87
|
"div",
|
|
90
88
|
{
|
|
91
89
|
className: r(
|
|
92
90
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
93
|
-
|
|
91
|
+
a
|
|
94
92
|
),
|
|
95
|
-
...
|
|
93
|
+
...t
|
|
96
94
|
}
|
|
97
95
|
);
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
className:
|
|
101
|
-
...
|
|
96
|
+
C.displayName = "DialogHeader";
|
|
97
|
+
const R = ({
|
|
98
|
+
className: a,
|
|
99
|
+
...t
|
|
102
100
|
}) => /* @__PURE__ */ o(
|
|
103
101
|
"div",
|
|
104
102
|
{
|
|
105
103
|
className: r(
|
|
106
104
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
107
|
-
|
|
105
|
+
a
|
|
108
106
|
),
|
|
109
|
-
...
|
|
107
|
+
...t
|
|
110
108
|
}
|
|
111
109
|
);
|
|
112
|
-
|
|
113
|
-
const
|
|
110
|
+
R.displayName = "DialogFooter";
|
|
111
|
+
const T = i.forwardRef(({ className: a, ...t }, l) => /* @__PURE__ */ o(
|
|
114
112
|
e.Title,
|
|
115
113
|
{
|
|
116
|
-
ref:
|
|
114
|
+
ref: l,
|
|
117
115
|
className: r(
|
|
118
116
|
"text-lg font-semibold leading-none tracking-tight",
|
|
119
|
-
|
|
117
|
+
a
|
|
120
118
|
),
|
|
121
|
-
...
|
|
119
|
+
...t
|
|
122
120
|
}
|
|
123
121
|
));
|
|
124
|
-
|
|
125
|
-
const
|
|
122
|
+
T.displayName = e.Title.displayName;
|
|
123
|
+
const j = i.forwardRef(({ className: a, ...t }, l) => /* @__PURE__ */ o(
|
|
126
124
|
e.Description,
|
|
127
125
|
{
|
|
128
|
-
ref:
|
|
129
|
-
className: r("text-sm text-muted-foreground",
|
|
130
|
-
...
|
|
126
|
+
ref: l,
|
|
127
|
+
className: r("text-sm text-muted-foreground", a),
|
|
128
|
+
...t
|
|
131
129
|
}
|
|
132
130
|
));
|
|
133
|
-
|
|
131
|
+
j.displayName = e.Description.displayName;
|
|
134
132
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
133
|
+
F as Dialog,
|
|
134
|
+
_ as DialogClose,
|
|
135
|
+
w as DialogContent,
|
|
136
|
+
j as DialogDescription,
|
|
137
|
+
R as DialogFooter,
|
|
138
|
+
C as DialogHeader,
|
|
139
|
+
c as DialogOverlay,
|
|
140
|
+
v as DialogPortal,
|
|
141
|
+
T as DialogTitle,
|
|
142
|
+
H as DialogTrigger
|
|
145
143
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const DialogOverlayContainerContext: import('react').Context<HTMLElement | null>;
|
|
4
4
|
export declare const useDialogOverlayContainer: () => HTMLElement | null;
|
|
5
5
|
interface IDialogOverlayScopeProps extends PropsWithChildren {
|
|
6
6
|
value: HTMLElement | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const o =
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as n, useContext as a } from "react";
|
|
3
|
+
const o = n(
|
|
4
|
+
null
|
|
5
|
+
), s = () => a(o), c = ({ value: e, children: t }) => /* @__PURE__ */ r(o.Provider, { value: e, children: t });
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
o as DialogOverlayContainerContext,
|
|
8
|
+
c as DialogOverlayScope,
|
|
9
|
+
s as useDialogOverlayContainer
|
|
10
10
|
};
|
package/Dialog/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Dialog as l, DialogClose as
|
|
2
|
-
import {
|
|
1
|
+
import { Dialog as l, DialogClose as e, DialogContent as i, DialogDescription as r, DialogFooter as g, DialogHeader as D, DialogOverlay as t, DialogPortal as n, DialogTitle as C, DialogTrigger as p } from "./Dialog.mjs";
|
|
2
|
+
import { DialogOverlayContainerContext as y, DialogOverlayScope as O, useDialogOverlayContainer as s } from "./DialogOverlayScope.mjs";
|
|
3
3
|
export {
|
|
4
4
|
l as Dialog,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
e as DialogClose,
|
|
6
|
+
i as DialogContent,
|
|
7
7
|
r as DialogDescription,
|
|
8
8
|
g as DialogFooter,
|
|
9
9
|
D as DialogHeader,
|
|
10
10
|
t as DialogOverlay,
|
|
11
|
-
y as
|
|
11
|
+
y as DialogOverlayContainerContext,
|
|
12
12
|
O as DialogOverlayScope,
|
|
13
13
|
n as DialogPortal,
|
|
14
14
|
C as DialogTitle,
|
package/Popover/Popover.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as p from "react";
|
|
3
3
|
import * as o from "@radix-ui/react-popover";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useDialogOverlayContainer as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */ t(o.Portal, { container:
|
|
4
|
+
import { cn as l } from "@oneplatformdev/utils";
|
|
5
|
+
import { useDialogOverlayContainer as c } from "../Dialog/DialogOverlayScope.mjs";
|
|
6
|
+
const P = o.Root, h = o.Trigger, b = o.Anchor, f = p.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, style: n, avoidCollisions: i = !0, ...d }, s) => {
|
|
7
|
+
const m = c();
|
|
8
|
+
return /* @__PURE__ */ t(o.Portal, { container: m, children: /* @__PURE__ */ t(
|
|
9
9
|
o.Content,
|
|
10
10
|
{
|
|
11
|
-
ref:
|
|
11
|
+
ref: s,
|
|
12
12
|
align: a,
|
|
13
13
|
sideOffset: r,
|
|
14
|
-
className:
|
|
14
|
+
className: l(
|
|
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
|
),
|
|
@@ -19,14 +19,15 @@ const u = o.Root, P = o.Trigger, h = o.Anchor, c = m.forwardRef(({ className: e,
|
|
|
19
19
|
pointerEvents: "auto",
|
|
20
20
|
...n
|
|
21
21
|
},
|
|
22
|
-
...
|
|
22
|
+
...d,
|
|
23
|
+
avoidCollisions: i
|
|
23
24
|
}
|
|
24
25
|
) });
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
+
f.displayName = o.Content.displayName;
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
P as Popover,
|
|
30
|
+
b as PopoverAnchor,
|
|
31
|
+
f as PopoverContent,
|
|
32
|
+
h as PopoverTrigger
|
|
32
33
|
};
|
package/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import { Command as Ho, CommandDialog as yo, CommandEmpty as No, CommandGroup as
|
|
|
25
25
|
import { DataTable as jo } from "./DataTable/DataTable.mjs";
|
|
26
26
|
import { DatePicker as Jo } from "./DatePicker/DatePicker.mjs";
|
|
27
27
|
import { Dialog as Qo, DialogClose as Wo, DialogContent as Xo, DialogDescription as Zo, DialogFooter as $o, DialogHeader as or, DialogOverlay as rr, DialogPortal as er, DialogTitle as tr, DialogTrigger as ar } from "./Dialog/Dialog.mjs";
|
|
28
|
-
import {
|
|
28
|
+
import { DialogOverlayContainerContext as ir, DialogOverlayScope as pr, useDialogOverlayContainer as lr } from "./Dialog/DialogOverlayScope.mjs";
|
|
29
29
|
import { Drawer as ur, DrawerClose as dr, DrawerContent as gr, DrawerDescription as br, DrawerFooter as xr, DrawerHeader as fr, DrawerOverlay as Sr, DrawerPortal as sr, DrawerTitle as Cr, DrawerTrigger as Tr } from "./Drawer/Drawer.mjs";
|
|
30
30
|
import { DropdownMenu as cr, DropdownMenuCheckboxItem as Mr, DropdownMenuContent as Pr, DropdownMenuGroup as Ir, DropdownMenuItem as Ar, DropdownMenuLabel as vr, DropdownMenuPortal as wr, DropdownMenuRadioGroup as hr, DropdownMenuRadioItem as Fr, DropdownMenuSeparator as Lr, DropdownMenuShortcut as Rr, DropdownMenuSub as Br, DropdownMenuSubContent as Gr, DropdownMenuSubTrigger as kr, DropdownMenuTrigger as Hr } from "./DropdownMenu/DropdownMenu.mjs";
|
|
31
31
|
import { Form as Nr, FormControl as Or, FormDescription as Vr, FormField as Er, FormItem as zr, FormLabel as _r, FormMessage as Ur, useFormField as Yr } from "./Form/Form.mjs";
|
|
@@ -166,7 +166,7 @@ export {
|
|
|
166
166
|
$o as DialogFooter,
|
|
167
167
|
or as DialogHeader,
|
|
168
168
|
rr as DialogOverlay,
|
|
169
|
-
ir as
|
|
169
|
+
ir as DialogOverlayContainerContext,
|
|
170
170
|
pr as DialogOverlayScope,
|
|
171
171
|
er as DialogPortal,
|
|
172
172
|
tr as DialogTitle,
|