@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 CHANGED
@@ -1,52 +1,66 @@
1
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
- import i, { useRef as x, useMemo as y } from "react";
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 N } from "lucide-react";
5
- import { cn as l, composeRefs as D } from "@oneplatformdev/utils";
6
- const E = e.Root, P = e.Trigger, b = e.Portal, F = e.Close, f = i.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
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: l(
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
- a
13
+ t
13
14
  ),
14
- ...t
15
+ ...a
15
16
  }
16
17
  ));
17
- f.displayName = e.Overlay.displayName;
18
- const h = i.forwardRef(
18
+ g.displayName = e.Overlay.displayName;
19
+ const E = i.forwardRef(
19
20
  ({
20
- className: a,
21
- children: t,
21
+ className: t,
22
+ children: a,
22
23
  showCloseButton: s = !0,
23
- onOpenAutoFocus: r,
24
- preventAutoFocus: p,
25
- ...g
26
- }, d) => {
27
- const c = x(null), u = y(() => D(d, c), [d]);
28
- return console.log("localRef", c), /* @__PURE__ */ n(b, { children: [
29
- /* @__PURE__ */ o(f, {}),
30
- /* @__PURE__ */ n(
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: u,
34
- className: l(
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
- a
53
+ t
40
54
  ),
41
- onOpenAutoFocus: (m) => (p && m.preventDefault(), r == null ? void 0 : r(m)),
42
- ...g,
55
+ onOpenAutoFocus: (r) => (u && r.preventDefault(), d == null ? void 0 : d(r)),
56
+ ...y,
43
57
  children: [
44
- t,
45
- s && /* @__PURE__ */ n(
58
+ a,
59
+ s && /* @__PURE__ */ c(
46
60
  e.Close,
47
61
  {
48
62
  "aria-label": "Close",
49
- className: l(
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(N, { className: "h-4 w-4" }),
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
- h.displayName = e.Content.displayName;
73
- const v = ({
74
- className: a,
75
- ...t
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: l(
93
+ className: n(
80
94
  "flex flex-col space-y-1.5 text-center sm:text-left",
81
- a
95
+ t
82
96
  ),
83
- ...t
97
+ ...a
84
98
  }
85
99
  );
86
- v.displayName = "DialogHeader";
87
- const w = ({
88
- className: a,
89
- ...t
100
+ T.displayName = "DialogHeader";
101
+ const j = ({
102
+ className: t,
103
+ ...a
90
104
  }) => /* @__PURE__ */ o(
91
105
  "div",
92
106
  {
93
- className: l(
107
+ className: n(
94
108
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
95
- a
109
+ t
96
110
  ),
97
- ...t
111
+ ...a
98
112
  }
99
113
  );
100
- w.displayName = "DialogFooter";
101
- const C = i.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
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: l(
119
+ className: n(
106
120
  "text-lg font-semibold leading-none tracking-tight",
107
- a
121
+ t
108
122
  ),
109
- ...t
123
+ ...a
110
124
  }
111
125
  ));
112
- C.displayName = e.Title.displayName;
113
- const R = i.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
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: l("text-sm text-muted-foreground", a),
118
- ...t
131
+ className: n("text-sm text-muted-foreground", t),
132
+ ...a
119
133
  }
120
134
  ));
121
- R.displayName = e.Description.displayName;
135
+ z.displayName = e.Description.displayName;
122
136
  export {
123
- E as Dialog,
124
- F as DialogClose,
125
- h as DialogContent,
126
- R as DialogDescription,
127
- w as DialogFooter,
128
- v as DialogHeader,
129
- f as DialogOverlay,
130
- b as DialogPortal,
131
- C as DialogTitle,
132
- P as DialogTrigger
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
  };
@@ -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: (props: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
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>>;
@@ -1,28 +1,32 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import * as s from "react";
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 m } from "@oneplatformdev/utils";
5
- const c = (t) => /* @__PURE__ */ e(o.Root, { ...t, modal: !1 }), v = o.Trigger, g = o.Anchor, p = s.forwardRef(({ className: t, align: a = "center", sideOffset: r = 4, style: d, ...n }, i) => /* @__PURE__ */ e(o.Portal, { children: /* @__PURE__ */ e(
6
- o.Content,
7
- {
8
- ref: i,
9
- align: a,
10
- sideOffset: r,
11
- className: m(
12
- "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",
13
- t
14
- ),
15
- style: {
16
- pointerEvents: "auto",
17
- ...d
18
- },
19
- ...n
20
- }
21
- ) }));
22
- p.displayName = o.Content.displayName;
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
- c as Popover,
25
- g as PopoverAnchor,
26
- p as PopoverContent,
27
- v as PopoverTrigger
28
+ u as Popover,
29
+ h as PopoverAnchor,
30
+ c as PopoverContent,
31
+ P as PopoverTrigger
28
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/ui",
3
- "version": "0.0.1-beta.133",
3
+ "version": "0.0.1-beta.135",
4
4
  "description": "UI React Components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [