@pdf-viewer/react 1.6.1-rc.0 → 1.6.1-rc.2
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/dist/{RPDefaultLayout-a6150b35.js → RPDefaultLayout-8ce0fad7.js} +23 -24
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +13 -14
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +331 -689
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ZoomContext.js +15 -15
- package/dist/index-1cb41342.js +307 -0
- package/dist/index-7279fb4e.js +1557 -0
- package/dist/index-aa2d3884.js +140 -0
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +1 -1
- package/dist/index-2e540713.js +0 -23
- package/dist/index-353ec0a6.js +0 -172
- package/dist/index-5ff5dbd0.js +0 -1675
- package/dist/index-71898eb9.js +0 -139
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { u as p, a as R, P as w, c as h, d as _, b as U } from "./index-1cb41342.js";
|
|
3
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
4
|
+
function z(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
5
|
+
const s = p(t);
|
|
6
|
+
i.useEffect(() => {
|
|
7
|
+
const n = (r) => {
|
|
8
|
+
r.key === "Escape" && s(r);
|
|
9
|
+
};
|
|
10
|
+
return e.addEventListener("keydown", n, { capture: !0 }), () => e.removeEventListener("keydown", n, { capture: !0 });
|
|
11
|
+
}, [s, e]);
|
|
12
|
+
}
|
|
13
|
+
var H = "DismissableLayer", b = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", K = "dismissableLayer.focusOutside", O, S = i.createContext({
|
|
14
|
+
layers: /* @__PURE__ */ new Set(),
|
|
15
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
16
|
+
branches: /* @__PURE__ */ new Set()
|
|
17
|
+
}), j = i.forwardRef(
|
|
18
|
+
(t, e) => {
|
|
19
|
+
const {
|
|
20
|
+
disableOutsidePointerEvents: s = !1,
|
|
21
|
+
onEscapeKeyDown: n,
|
|
22
|
+
onPointerDownOutside: r,
|
|
23
|
+
onFocusOutside: o,
|
|
24
|
+
onInteractOutside: l,
|
|
25
|
+
onDismiss: d,
|
|
26
|
+
...v
|
|
27
|
+
} = t, u = i.useContext(S), [c, B] = i.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = i.useState({}), I = R(e, (a) => B(a)), m = Array.from(u.layers), [W] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), k = m.indexOf(W), P = c ? m.indexOf(c) : -1, A = u.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= k, N = $((a) => {
|
|
28
|
+
const E = a.target, C = [...u.branches].some((y) => y.contains(E));
|
|
29
|
+
!D || C || (r == null || r(a), l == null || l(a), a.defaultPrevented || d == null || d());
|
|
30
|
+
}, f), L = q((a) => {
|
|
31
|
+
const E = a.target;
|
|
32
|
+
[...u.branches].some((y) => y.contains(E)) || (o == null || o(a), l == null || l(a), a.defaultPrevented || d == null || d());
|
|
33
|
+
}, f);
|
|
34
|
+
return z((a) => {
|
|
35
|
+
P === u.layers.size - 1 && (n == null || n(a), !a.defaultPrevented && d && (a.preventDefault(), d()));
|
|
36
|
+
}, f), i.useEffect(() => {
|
|
37
|
+
if (c)
|
|
38
|
+
return s && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (O = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), g(), () => {
|
|
39
|
+
s && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = O);
|
|
40
|
+
};
|
|
41
|
+
}, [c, f, s, u]), i.useEffect(() => () => {
|
|
42
|
+
c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), g());
|
|
43
|
+
}, [c, u]), i.useEffect(() => {
|
|
44
|
+
const a = () => F({});
|
|
45
|
+
return document.addEventListener(b, a), () => document.removeEventListener(b, a);
|
|
46
|
+
}, []), /* @__PURE__ */ T(
|
|
47
|
+
w.div,
|
|
48
|
+
{
|
|
49
|
+
...v,
|
|
50
|
+
ref: I,
|
|
51
|
+
style: {
|
|
52
|
+
pointerEvents: A ? D ? "auto" : "none" : void 0,
|
|
53
|
+
...t.style
|
|
54
|
+
},
|
|
55
|
+
onFocusCapture: h(t.onFocusCapture, L.onFocusCapture),
|
|
56
|
+
onBlurCapture: h(t.onBlurCapture, L.onBlurCapture),
|
|
57
|
+
onPointerDownCapture: h(
|
|
58
|
+
t.onPointerDownCapture,
|
|
59
|
+
N.onPointerDownCapture
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
j.displayName = H;
|
|
66
|
+
var X = "DismissableLayerBranch", Y = i.forwardRef((t, e) => {
|
|
67
|
+
const s = i.useContext(S), n = i.useRef(null), r = R(e, n);
|
|
68
|
+
return i.useEffect(() => {
|
|
69
|
+
const o = n.current;
|
|
70
|
+
if (o)
|
|
71
|
+
return s.branches.add(o), () => {
|
|
72
|
+
s.branches.delete(o);
|
|
73
|
+
};
|
|
74
|
+
}, [s.branches]), /* @__PURE__ */ T(w.div, { ...t, ref: r });
|
|
75
|
+
});
|
|
76
|
+
Y.displayName = X;
|
|
77
|
+
function $(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
78
|
+
const s = p(t), n = i.useRef(!1), r = i.useRef(() => {
|
|
79
|
+
});
|
|
80
|
+
return i.useEffect(() => {
|
|
81
|
+
const o = (d) => {
|
|
82
|
+
if (d.target && !n.current) {
|
|
83
|
+
let v = function() {
|
|
84
|
+
x(
|
|
85
|
+
M,
|
|
86
|
+
s,
|
|
87
|
+
u,
|
|
88
|
+
{ discrete: !0 }
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
const u = { originalEvent: d };
|
|
92
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", r.current), r.current = v, e.addEventListener("click", r.current, { once: !0 })) : v();
|
|
93
|
+
} else
|
|
94
|
+
e.removeEventListener("click", r.current);
|
|
95
|
+
n.current = !1;
|
|
96
|
+
}, l = window.setTimeout(() => {
|
|
97
|
+
e.addEventListener("pointerdown", o);
|
|
98
|
+
}, 0);
|
|
99
|
+
return () => {
|
|
100
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", o), e.removeEventListener("click", r.current);
|
|
101
|
+
};
|
|
102
|
+
}, [e, s]), {
|
|
103
|
+
// ensures we check React component tree (not just DOM tree)
|
|
104
|
+
onPointerDownCapture: () => n.current = !0
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function q(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
108
|
+
const s = p(t), n = i.useRef(!1);
|
|
109
|
+
return i.useEffect(() => {
|
|
110
|
+
const r = (o) => {
|
|
111
|
+
o.target && !n.current && x(K, s, { originalEvent: o }, {
|
|
112
|
+
discrete: !1
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return e.addEventListener("focusin", r), () => e.removeEventListener("focusin", r);
|
|
116
|
+
}, [e, s]), {
|
|
117
|
+
onFocusCapture: () => n.current = !0,
|
|
118
|
+
onBlurCapture: () => n.current = !1
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function g() {
|
|
122
|
+
const t = new CustomEvent(b);
|
|
123
|
+
document.dispatchEvent(t);
|
|
124
|
+
}
|
|
125
|
+
function x(t, e, s, { discrete: n }) {
|
|
126
|
+
const r = s.originalEvent.target, o = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: s });
|
|
127
|
+
e && r.addEventListener(t, e, { once: !0 }), n ? _(r, o) : r.dispatchEvent(o);
|
|
128
|
+
}
|
|
129
|
+
var G = i["useId".toString()] || (() => {
|
|
130
|
+
}), J = 0;
|
|
131
|
+
function Z(t) {
|
|
132
|
+
const [e, s] = i.useState(G());
|
|
133
|
+
return U(() => {
|
|
134
|
+
t || s((n) => n ?? String(J++));
|
|
135
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
j as D,
|
|
139
|
+
Z as u
|
|
140
|
+
};
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RPProvider as t } from "./components/RPProvider.js";
|
|
2
|
-
import { b as x, R as n, c as s, u as m, d as p, e as f } from "./RPDefaultLayout-
|
|
2
|
+
import { b as x, R as n, c as s, u as m, d as p, e as f } from "./RPDefaultLayout-8ce0fad7.js";
|
|
3
3
|
import { RPConfig as a } from "./components/RPConfig.js";
|
|
4
4
|
import { RPController as l } from "./components/RPController.js";
|
|
5
5
|
import { RPTheme as P } from "./components/RPTheme.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
4
|
import "../../contexts/DocumentPasswordContext.js";
|
|
5
|
-
import { c as E } from "../../RPDefaultLayout-
|
|
5
|
+
import { c as E } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as g, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as c } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2025-05-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2025-05-29T03:28:29.008Z"), l = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${l}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${l}`,
|
|
6
6
|
expired: `Your license key has expired. ${l}`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../types.js";
|
|
3
|
-
import { g as G } from "../../RPDefaultLayout-
|
|
3
|
+
import { g as G } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../contexts/RPDocumentContext.js";
|
|
6
6
|
import "../../contexts/DocumentPasswordContext.js";
|
|
@@ -5,7 +5,7 @@ import "../calculatePage.js";
|
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "../../contexts/RPDocumentContext.js";
|
|
7
7
|
import "../../contexts/DocumentPasswordContext.js";
|
|
8
|
-
import { v as G } from "../../RPDefaultLayout-
|
|
8
|
+
import { v as G } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
9
9
|
import "../../contexts/DarkModeContext.js";
|
|
10
10
|
import "../../contexts/RotationContext.js";
|
|
11
11
|
import "../../contexts/LayerContext.js";
|
|
@@ -2,7 +2,7 @@ import "react";
|
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../contexts/RPDocumentContext.js";
|
|
4
4
|
import "../../contexts/DocumentPasswordContext.js";
|
|
5
|
-
import { i as F } from "../../RPDefaultLayout-
|
|
5
|
+
import { i as F } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
6
6
|
import "../../contexts/DarkModeContext.js";
|
|
7
7
|
import "../../contexts/RotationContext.js";
|
|
8
8
|
import "../../contexts/LayerContext.js";
|
|
@@ -3,7 +3,7 @@ import "../../contexts/ScrollModeContext.js";
|
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "../../contexts/RPDocumentContext.js";
|
|
5
5
|
import "../../contexts/DocumentPasswordContext.js";
|
|
6
|
-
import { f as F } from "../../RPDefaultLayout-
|
|
6
|
+
import { f as F } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
7
7
|
import "../../contexts/DarkModeContext.js";
|
|
8
8
|
import "../types.js";
|
|
9
9
|
import "../../contexts/RotationContext.js";
|
|
@@ -7,7 +7,7 @@ import "../../contexts/RPDocumentContext.js";
|
|
|
7
7
|
import "../../contexts/ZoomContext.js";
|
|
8
8
|
import "react/jsx-runtime";
|
|
9
9
|
import "../../contexts/DocumentPasswordContext.js";
|
|
10
|
-
import { n as I } from "../../RPDefaultLayout-
|
|
10
|
+
import { n as I } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
11
11
|
import "../../contexts/DarkModeContext.js";
|
|
12
12
|
import "../../contexts/RotationContext.js";
|
|
13
13
|
import "../../contexts/LayerContext.js";
|
|
@@ -3,7 +3,7 @@ import "../renderPage.js";
|
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "../../contexts/RPDocumentContext.js";
|
|
5
5
|
import "../../contexts/DocumentPasswordContext.js";
|
|
6
|
-
import { k as G } from "../../RPDefaultLayout-
|
|
6
|
+
import { k as G } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
7
7
|
import "../../contexts/DarkModeContext.js";
|
|
8
8
|
import "../../contexts/RotationContext.js";
|
|
9
9
|
import "../../contexts/LayerContext.js";
|
|
@@ -4,7 +4,7 @@ import "../../contexts/ScrollModeContext.js";
|
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../contexts/RPDocumentContext.js";
|
|
6
6
|
import "../../contexts/DocumentPasswordContext.js";
|
|
7
|
-
import { s as D } from "../../RPDefaultLayout-
|
|
7
|
+
import { s as D } from "../../RPDefaultLayout-8ce0fad7.js";
|
|
8
8
|
import "../../contexts/DarkModeContext.js";
|
|
9
9
|
import "../../contexts/RotationContext.js";
|
|
10
10
|
import "../../contexts/LayerContext.js";
|
package/package.json
CHANGED
package/dist/index-2e540713.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as o from "react";
|
|
2
|
-
import { u as n, a as r } from "./index-71898eb9.js";
|
|
3
|
-
function i(a, e = globalThis == null ? void 0 : globalThis.document) {
|
|
4
|
-
const t = n(a);
|
|
5
|
-
o.useEffect(() => {
|
|
6
|
-
const s = (u) => {
|
|
7
|
-
u.key === "Escape" && t(u);
|
|
8
|
-
};
|
|
9
|
-
return e.addEventListener("keydown", s, { capture: !0 }), () => e.removeEventListener("keydown", s, { capture: !0 });
|
|
10
|
-
}, [t, e]);
|
|
11
|
-
}
|
|
12
|
-
var c = o["useId".toString()] || (() => {
|
|
13
|
-
}), f = 0;
|
|
14
|
-
function p(a) {
|
|
15
|
-
const [e, t] = o.useState(c());
|
|
16
|
-
return r(() => {
|
|
17
|
-
a || t((s) => s ?? String(f++));
|
|
18
|
-
}, [a]), a || (e ? `radix-${e}` : "");
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
p as a,
|
|
22
|
-
i as u
|
|
23
|
-
};
|
package/dist/index-353ec0a6.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import * as s from "react";
|
|
2
|
-
import * as C from "react-dom";
|
|
3
|
-
import { jsx as h, Fragment as M } from "react/jsx-runtime";
|
|
4
|
-
import { a as g } from "./index-71898eb9.js";
|
|
5
|
-
function x(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
6
|
-
return function(r) {
|
|
7
|
-
if (e == null || e(r), t === !1 || !r.defaultPrevented)
|
|
8
|
-
return n == null ? void 0 : n(r);
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function A(e, n) {
|
|
12
|
-
if (typeof e == "function")
|
|
13
|
-
return e(n);
|
|
14
|
-
e != null && (e.current = n);
|
|
15
|
-
}
|
|
16
|
-
function R(...e) {
|
|
17
|
-
return (n) => {
|
|
18
|
-
let t = !1;
|
|
19
|
-
const i = e.map((r) => {
|
|
20
|
-
const o = A(r, n);
|
|
21
|
-
return !t && typeof o == "function" && (t = !0), o;
|
|
22
|
-
});
|
|
23
|
-
if (t)
|
|
24
|
-
return () => {
|
|
25
|
-
for (let r = 0; r < i.length; r++) {
|
|
26
|
-
const o = i[r];
|
|
27
|
-
typeof o == "function" ? o() : A(e[r], null);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function S(...e) {
|
|
33
|
-
return s.useCallback(R(...e), e);
|
|
34
|
-
}
|
|
35
|
-
var O = s.forwardRef((e, n) => {
|
|
36
|
-
const { children: t, ...i } = e, r = s.Children.toArray(t), o = r.find(T);
|
|
37
|
-
if (o) {
|
|
38
|
-
const c = o.props.children, l = r.map((u) => u === o ? s.Children.count(c) > 1 ? s.Children.only(null) : s.isValidElement(c) ? c.props.children : null : u);
|
|
39
|
-
return /* @__PURE__ */ h(y, { ...i, ref: n, children: s.isValidElement(c) ? s.cloneElement(c, void 0, l) : null });
|
|
40
|
-
}
|
|
41
|
-
return /* @__PURE__ */ h(y, { ...i, ref: n, children: t });
|
|
42
|
-
});
|
|
43
|
-
O.displayName = "Slot";
|
|
44
|
-
var y = s.forwardRef((e, n) => {
|
|
45
|
-
const { children: t, ...i } = e;
|
|
46
|
-
if (s.isValidElement(t)) {
|
|
47
|
-
const r = D(t), o = b(i, t.props);
|
|
48
|
-
return t.type !== s.Fragment && (o.ref = n ? R(n, r) : r), s.cloneElement(t, o);
|
|
49
|
-
}
|
|
50
|
-
return s.Children.count(t) > 1 ? s.Children.only(null) : null;
|
|
51
|
-
});
|
|
52
|
-
y.displayName = "SlotClone";
|
|
53
|
-
var E = ({ children: e }) => /* @__PURE__ */ h(M, { children: e });
|
|
54
|
-
function T(e) {
|
|
55
|
-
return s.isValidElement(e) && e.type === E;
|
|
56
|
-
}
|
|
57
|
-
function b(e, n) {
|
|
58
|
-
const t = { ...n };
|
|
59
|
-
for (const i in n) {
|
|
60
|
-
const r = e[i], o = n[i];
|
|
61
|
-
/^on[A-Z]/.test(i) ? r && o ? t[i] = (...l) => {
|
|
62
|
-
o(...l), r(...l);
|
|
63
|
-
} : r && (t[i] = r) : i === "style" ? t[i] = { ...r, ...o } : i === "className" && (t[i] = [r, o].filter(Boolean).join(" "));
|
|
64
|
-
}
|
|
65
|
-
return { ...e, ...t };
|
|
66
|
-
}
|
|
67
|
-
function D(e) {
|
|
68
|
-
var i, r;
|
|
69
|
-
let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
|
|
70
|
-
return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
71
|
-
}
|
|
72
|
-
var I = [
|
|
73
|
-
"a",
|
|
74
|
-
"button",
|
|
75
|
-
"div",
|
|
76
|
-
"form",
|
|
77
|
-
"h2",
|
|
78
|
-
"h3",
|
|
79
|
-
"img",
|
|
80
|
-
"input",
|
|
81
|
-
"label",
|
|
82
|
-
"li",
|
|
83
|
-
"nav",
|
|
84
|
-
"ol",
|
|
85
|
-
"p",
|
|
86
|
-
"span",
|
|
87
|
-
"svg",
|
|
88
|
-
"ul"
|
|
89
|
-
], _ = I.reduce((e, n) => {
|
|
90
|
-
const t = s.forwardRef((i, r) => {
|
|
91
|
-
const { asChild: o, ...c } = i, l = o ? O : n;
|
|
92
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(l, { ...c, ref: r });
|
|
93
|
-
});
|
|
94
|
-
return t.displayName = `Primitive.${n}`, { ...e, [n]: t };
|
|
95
|
-
}, {});
|
|
96
|
-
function k(e, n) {
|
|
97
|
-
e && C.flushSync(() => e.dispatchEvent(n));
|
|
98
|
-
}
|
|
99
|
-
function U(e, n) {
|
|
100
|
-
return s.useReducer((t, i) => n[t][i] ?? t, e);
|
|
101
|
-
}
|
|
102
|
-
var W = (e) => {
|
|
103
|
-
const { present: n, children: t } = e, i = F(n), r = typeof t == "function" ? t({ present: i.isPresent }) : s.Children.only(t), o = S(i.ref, L(r));
|
|
104
|
-
return typeof t == "function" || i.isPresent ? s.cloneElement(r, { ref: o }) : null;
|
|
105
|
-
};
|
|
106
|
-
W.displayName = "Presence";
|
|
107
|
-
function F(e) {
|
|
108
|
-
const [n, t] = s.useState(), i = s.useRef({}), r = s.useRef(e), o = s.useRef("none"), c = e ? "mounted" : "unmounted", [l, u] = U(c, {
|
|
109
|
-
mounted: {
|
|
110
|
-
UNMOUNT: "unmounted",
|
|
111
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
112
|
-
},
|
|
113
|
-
unmountSuspended: {
|
|
114
|
-
MOUNT: "mounted",
|
|
115
|
-
ANIMATION_END: "unmounted"
|
|
116
|
-
},
|
|
117
|
-
unmounted: {
|
|
118
|
-
MOUNT: "mounted"
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return s.useEffect(() => {
|
|
122
|
-
const a = N(i.current);
|
|
123
|
-
o.current = l === "mounted" ? a : "none";
|
|
124
|
-
}, [l]), g(() => {
|
|
125
|
-
const a = i.current, m = r.current;
|
|
126
|
-
if (m !== e) {
|
|
127
|
-
const p = o.current, f = N(a);
|
|
128
|
-
e ? u("MOUNT") : f === "none" || (a == null ? void 0 : a.display) === "none" ? u("UNMOUNT") : u(m && p !== f ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
|
|
129
|
-
}
|
|
130
|
-
}, [e, u]), g(() => {
|
|
131
|
-
if (n) {
|
|
132
|
-
let a;
|
|
133
|
-
const m = n.ownerDocument.defaultView ?? window, d = (f) => {
|
|
134
|
-
const v = N(i.current).includes(f.animationName);
|
|
135
|
-
if (f.target === n && v && (u("ANIMATION_END"), !r.current)) {
|
|
136
|
-
const w = n.style.animationFillMode;
|
|
137
|
-
n.style.animationFillMode = "forwards", a = m.setTimeout(() => {
|
|
138
|
-
n.style.animationFillMode === "forwards" && (n.style.animationFillMode = w);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}, p = (f) => {
|
|
142
|
-
f.target === n && (o.current = N(i.current));
|
|
143
|
-
};
|
|
144
|
-
return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
|
|
145
|
-
m.clearTimeout(a), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
|
|
146
|
-
};
|
|
147
|
-
} else
|
|
148
|
-
u("ANIMATION_END");
|
|
149
|
-
}, [n, u]), {
|
|
150
|
-
isPresent: ["mounted", "unmountSuspended"].includes(l),
|
|
151
|
-
ref: s.useCallback((a) => {
|
|
152
|
-
a && (i.current = getComputedStyle(a)), t(a);
|
|
153
|
-
}, [])
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function N(e) {
|
|
157
|
-
return (e == null ? void 0 : e.animationName) || "none";
|
|
158
|
-
}
|
|
159
|
-
function L(e) {
|
|
160
|
-
var i, r;
|
|
161
|
-
let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
|
|
162
|
-
return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
163
|
-
}
|
|
164
|
-
export {
|
|
165
|
-
_ as P,
|
|
166
|
-
O as S,
|
|
167
|
-
W as a,
|
|
168
|
-
R as b,
|
|
169
|
-
x as c,
|
|
170
|
-
k as d,
|
|
171
|
-
S as u
|
|
172
|
-
};
|