@oneplatformdev/ui 0.0.1-beta.132 → 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 CHANGED
@@ -1,48 +1,60 @@
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 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 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 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
- 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
+ p.displayName = e.Overlay.displayName;
19
+ const R = n.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,
24
+ onOpenAutoFocus: d,
25
+ preventAutoFocus: u,
25
26
  ...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(
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: u,
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
- a
51
+ t
40
52
  ),
41
- onOpenAutoFocus: (m) => (p && m.preventDefault(), r == null ? void 0 : r(m)),
53
+ onOpenAutoFocus: (i) => (u && i.preventDefault(), d == null ? void 0 : d(i)),
42
54
  ...g,
43
55
  children: [
44
- t,
45
- s && /* @__PURE__ */ n(
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(N, { className: "h-4 w-4" }),
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
- h.displayName = e.Content.displayName;
73
- const v = ({
74
- className: a,
75
- ...t
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
- a
93
+ t
82
94
  ),
83
- ...t
95
+ ...a
84
96
  }
85
97
  );
86
- v.displayName = "DialogHeader";
87
- const w = ({
88
- className: a,
89
- ...t
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
- a
107
+ t
96
108
  ),
97
- ...t
109
+ ...a
98
110
  }
99
111
  );
100
- w.displayName = "DialogFooter";
101
- const C = i.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
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
- a
119
+ t
108
120
  ),
109
- ...t
121
+ ...a
110
122
  }
111
123
  ));
112
- C.displayName = e.Title.displayName;
113
- const R = i.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
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", a),
118
- ...t
129
+ className: l("text-sm text-muted-foreground", t),
130
+ ...a
119
131
  }
120
132
  ));
121
- R.displayName = e.Description.displayName;
133
+ k.displayName = e.Description.displayName;
122
134
  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
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
  };
@@ -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: React.FC<PopoverPrimitive.PopoverProps>;
3
+ declare const Popover: (props: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
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 t } from "react/jsx-runtime";
2
- import * as s from "react";
1
+ import { jsx as e } 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 = o.Root, v = o.Trigger, g = o.Anchor, p = s.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, style: n, ...d }, i) => /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ t(
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
- e
14
- ),
15
- style: {
16
- pointerEvents: "auto",
17
- ...n
18
- },
19
- ...d
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 = (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
- c as Popover,
25
- g as PopoverAnchor,
26
- p as PopoverContent,
27
- v as PopoverTrigger
28
+ u as Popover,
29
+ h as PopoverAnchor,
30
+ f 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.132",
3
+ "version": "0.0.1-beta.134",
4
4
  "description": "UI React Components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [