@react-pdf-kit/viewer 2.0.0-beta.9 → 2.0.0-rc.0
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/Combination-136ff99c.js +698 -0
- package/dist/MostPageTool.module-13578ad6.js +6 -0
- package/dist/OtherTool.module-a4be5f1f.js +6 -0
- package/dist/Paginate.module-4eef00aa.js +8 -0
- package/dist/PaginationContext-9217cab4.js +201 -0
- package/dist/RPLayout.module-b4b23e29.js +14 -0
- package/dist/RPSplitter-f6acf13b.js +71 -0
- package/dist/RPToolbar.module-27d7fe77.js +10 -0
- package/dist/SearchTool.module-99f60dc7.js +16 -0
- package/dist/ToolbarLayout.module-6e339802.js +12 -0
- package/dist/ZoomTool.module-7082af8c.js +12 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +32 -30
- package/dist/components/RPController.js +81 -152
- package/dist/components/RPDropFileZone.js +1 -1
- package/dist/components/RPPages.js +1028 -122
- package/dist/components/RPProvider.js +57 -113
- package/dist/components/icons/DualPageWithCoverIcon.js +22 -0
- package/dist/components/layout/LayoutContainer.js +31 -136
- package/dist/components/layout/LayoutWrapper.js +8 -4
- package/dist/components/layout/RPDefaultLayout.js +184 -86
- package/dist/components/layout/RPLayout.js +123 -105
- package/dist/components/layout/SkipLink.js +29 -0
- package/dist/components/layout/WrapperLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +79 -112
- package/dist/components/layout/sidebar/RPSplitter.js +6 -59
- package/dist/components/layout/sidebar/Thumbnail.js +130 -125
- package/dist/components/layout/sidebar/Thumbnails.js +56 -119
- package/dist/components/layout/toolbar/DarkModeTool.js +7 -5
- package/dist/components/layout/toolbar/DocumentDialog.js +305 -131
- package/dist/components/layout/toolbar/DocumentProperties.js +13 -10
- package/dist/components/layout/toolbar/FileDownloadTool.js +34 -124
- package/dist/components/layout/toolbar/FileUploadTool.js +9 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +17 -14
- package/dist/components/layout/toolbar/MenuItem.js +11 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
- package/dist/components/layout/toolbar/MostPageTool.js +66 -125
- package/dist/components/layout/toolbar/OtherTool.js +171 -112
- package/dist/components/layout/toolbar/Paginate.js +121 -116
- package/dist/components/layout/toolbar/PrintTool.js +55 -123
- package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
- package/dist/components/layout/toolbar/RPMoreOptions.js +102 -154
- package/dist/components/layout/toolbar/RPToolbar.js +90 -79
- package/dist/components/layout/toolbar/RPToolbarEnd.js +69 -88
- package/dist/components/layout/toolbar/RotateTool.js +13 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +42 -39
- package/dist/components/layout/toolbar/SearchCloseButton.js +24 -10
- package/dist/components/layout/toolbar/SearchResultNavigator.js +74 -105
- package/dist/components/layout/toolbar/SearchTool.js +245 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +9 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +15 -122
- package/dist/components/layout/toolbar/ToolbarCustom.js +75 -143
- package/dist/components/layout/toolbar/ToolbarDefault.js +135 -122
- package/dist/components/layout/toolbar/ToolbarLayout.js +86 -81
- package/dist/components/layout/toolbar/ViewModeTool.js +47 -35
- package/dist/components/layout/toolbar/ZoomTool.js +129 -119
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +18 -122
- package/dist/components/layout/toolbar/tools/DualPageTool.js +11 -129
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +202 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +14 -123
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -8
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +197 -0
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +21 -18
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/InputPageTool.js +52 -136
- package/dist/components/layout/toolbar/tools/LastPageTool.js +197 -0
- package/dist/components/layout/toolbar/tools/NextPageTool.js +39 -129
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +28 -118
- package/dist/components/layout/toolbar/tools/PrintTool.js +14 -123
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +18 -9
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +15 -13
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +24 -14
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +11 -129
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +16 -6
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +23 -131
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +21 -18
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +23 -136
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +80 -141
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +18 -15
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +98 -105
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -123
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +17 -14
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +29 -127
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +31 -130
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +28 -17
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +63 -134
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +33 -131
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +41 -24
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +58 -37
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +44 -25
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +56 -30
- package/dist/components/page/AnnotationLayer.js +130 -125
- package/dist/components/page/CanvasLayer.js +57 -126
- package/dist/components/page/CustomElement.js +1 -1
- package/dist/components/page/DualPage.js +69 -110
- package/dist/components/page/DualPageWithCover.js +131 -0
- package/dist/components/page/RPPage.js +126 -123
- package/dist/components/page/SinglePage.js +59 -110
- package/dist/components/page/TextHighlightLayer.js +187 -129
- package/dist/components/page/TextLayer.js +186 -125
- package/dist/components/ui/Button.js +14 -12
- package/dist/components/ui/Checkbox.js +78 -70
- package/dist/components/ui/DropDown.js +11 -8
- package/dist/components/ui/Input.js +12 -11
- package/dist/components/ui/LoadingIndicator.js +34 -127
- package/dist/components/ui/PasswordModal.js +44 -30
- package/dist/components/ui/RPTooltip.js +121 -135
- package/dist/contexts/DimensionPagesContext.js +1 -1
- package/dist/contexts/DropFileZoneContext.js +1 -1
- package/dist/contexts/ElementPageContext.js +1 -1
- package/dist/contexts/EventCallbackContext.js +12 -8
- package/dist/contexts/FileInputContext.js +1 -1
- package/dist/contexts/HighlightContext.js +1 -1
- package/dist/contexts/LocalizationContext.js +1 -1
- package/dist/contexts/PagesRotateContext.js +1 -1
- package/dist/contexts/PaginationContext.js +15 -118
- package/dist/contexts/PrintContext.js +67 -131
- package/dist/contexts/RPDocumentContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +48 -118
- package/dist/contexts/RotationContext.js +1 -1
- package/dist/contexts/ScrollModeContext.js +1 -1
- package/dist/contexts/SearchContext.js +66 -112
- package/dist/contexts/SelectionModeContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +32 -131
- package/dist/contexts/ViewModeContext.js +19 -15
- package/dist/contexts/ZoomContext.js +1 -1
- package/dist/de_DE-a553b162.js +489 -0
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-61f59539.js +1198 -0
- package/dist/index-655864a7.js +27 -0
- package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
- package/dist/index-e3ee9457.js +150 -0
- package/dist/main.js +193 -130
- package/dist/types/components/icons/DualPageWithCoverIcon.d.ts +2 -0
- package/dist/types/components/layout/LayoutContainer.d.ts +1 -5
- package/dist/types/components/layout/LayoutWrapper.d.ts +1 -5
- package/dist/types/components/layout/SkipLink.d.ts +7 -0
- package/dist/types/components/layout/sidebar/Thumbnails.d.ts +1 -3
- package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -3
- package/dist/types/components/layout/toolbar/tools/DualPageWithCoverTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FirstPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/HorizontalScrollingTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/LastPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PageScrollingTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/VerticalScrollingTool.d.ts +3 -0
- package/dist/types/components/page/DualPageWithCover.d.ts +5 -0
- package/dist/types/components/page/RPPage.d.ts +1 -3
- package/dist/types/components/ui/Button.d.ts +1 -3
- package/dist/types/components/ui/Checkbox.d.ts +1 -0
- package/dist/types/components/ui/Input.d.ts +1 -3
- package/dist/types/components/ui/RPTooltip.d.ts +1 -3
- package/dist/types/locales/de_DE.json.d.ts +83 -0
- package/dist/types/locales/en_US.json.d.ts +2 -0
- package/dist/types/locales/it_IT.json.d.ts +2 -0
- package/dist/types/locales/pt_PT.json.d.ts +2 -0
- package/dist/types/locales/th_TH.json.d.ts +2 -0
- package/dist/types/locales/zh_CN.json.d.ts +2 -0
- package/dist/types/main.d.ts +8 -2
- package/dist/types/utils/annotations.d.ts +10 -1
- package/dist/types/utils/calculatePage.d.ts +3 -3
- package/dist/types/utils/hooks/usePresentPage.d.ts +2 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +7 -0
- package/dist/types/utils/types.d.ts +34 -3
- package/dist/types/utils/withRef.d.ts +5 -4
- package/dist/utils/annotations.js +145 -150
- package/dist/utils/calculatePage.js +17 -11
- package/dist/utils/getZoomLevel.js +9 -9
- package/dist/utils/highlight.js +139 -139
- package/dist/utils/hooks/useFileDownload.js +23 -130
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +1 -1
- package/dist/utils/hooks/useLocalization.js +12 -11
- package/dist/utils/hooks/usePageRotateContext.js +1 -1
- package/dist/utils/hooks/usePaginate.js +23 -126
- package/dist/utils/hooks/usePinch.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +79 -129
- package/dist/utils/hooks/usePrint.js +175 -130
- package/dist/utils/hooks/useRotate.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +18 -121
- package/dist/utils/hooks/useSearch.js +149 -127
- package/dist/utils/hooks/useTextSelection.js +76 -0
- package/dist/utils/hooks/useThumbnail.js +50 -131
- package/dist/utils/hooks/useVirtualReactWindow.js +84 -128
- package/dist/utils/types.js +14 -13
- package/dist/utils/withRef.js +5 -5
- package/package.json +5 -4
- package/dist/LayoutWrapper-6224491f.js +0 -19
- package/dist/SearchCloseButton-08d57275.js +0 -33
- package/dist/ToolbarLayout.module-8d56d12b.js +0 -3560
- package/dist/floating-ui.react-dom-d22a10b4.js +0 -1474
- package/dist/index-3bf64864.js +0 -1886
- package/dist/th_TH-d627cd51.js +0 -398
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as h from "react";
|
|
2
|
+
import { u as z } from "./index-c0faa594.js";
|
|
3
|
+
function n(r) {
|
|
4
|
+
const [d, e] = h.useState(void 0);
|
|
5
|
+
return z(() => {
|
|
6
|
+
if (r) {
|
|
7
|
+
e({ width: r.offsetWidth, height: r.offsetHeight });
|
|
8
|
+
const f = new ResizeObserver((i) => {
|
|
9
|
+
if (!Array.isArray(i) || !i.length)
|
|
10
|
+
return;
|
|
11
|
+
const b = i[0];
|
|
12
|
+
let o, t;
|
|
13
|
+
if ("borderBoxSize" in b) {
|
|
14
|
+
const s = b.borderBoxSize, u = Array.isArray(s) ? s[0] : s;
|
|
15
|
+
o = u.inlineSize, t = u.blockSize;
|
|
16
|
+
} else
|
|
17
|
+
o = r.offsetWidth, t = r.offsetHeight;
|
|
18
|
+
e({ width: o, height: t });
|
|
19
|
+
});
|
|
20
|
+
return f.observe(r, { box: "border-box" }), () => f.unobserve(r);
|
|
21
|
+
} else
|
|
22
|
+
e(void 0);
|
|
23
|
+
}, [r]), d;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
n as u
|
|
27
|
+
};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import * as s from "react";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
4
|
-
function
|
|
2
|
+
import { jsx as S, Fragment as R } from "react/jsx-runtime";
|
|
3
|
+
import * as b from "react-dom";
|
|
4
|
+
function B(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
5
5
|
return function(r) {
|
|
6
6
|
if (e == null || e(r), n === !1 || !r.defaultPrevented)
|
|
7
7
|
return t == null ? void 0 : t(r);
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function g(e, t) {
|
|
11
11
|
if (typeof e == "function")
|
|
12
12
|
return e(t);
|
|
13
13
|
e != null && (e.current = t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function w(...e) {
|
|
16
16
|
return (t) => {
|
|
17
17
|
let n = !1;
|
|
18
18
|
const o = e.map((r) => {
|
|
19
|
-
const i =
|
|
19
|
+
const i = g(r, t);
|
|
20
20
|
return !n && typeof i == "function" && (n = !0), i;
|
|
21
21
|
});
|
|
22
22
|
if (n)
|
|
23
23
|
return () => {
|
|
24
24
|
for (let r = 0; r < o.length; r++) {
|
|
25
25
|
const i = o[r];
|
|
26
|
-
typeof i == "function" ? i() :
|
|
26
|
+
typeof i == "function" ? i() : g(e[r], null);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return s.useCallback(
|
|
31
|
+
function A(...e) {
|
|
32
|
+
return s.useCallback(w(...e), e);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function Z(e, t) {
|
|
35
35
|
const n = s.createContext(t), o = (i) => {
|
|
36
36
|
const { children: u, ...c } = i, a = s.useMemo(() => c, Object.values(c));
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ S(n.Provider, { value: a, children: u });
|
|
38
38
|
};
|
|
39
39
|
o.displayName = e + "Provider";
|
|
40
40
|
function r(i) {
|
|
@@ -47,22 +47,22 @@ function B(e, t) {
|
|
|
47
47
|
}
|
|
48
48
|
return [o, r];
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function q(e, t = []) {
|
|
51
51
|
let n = [];
|
|
52
52
|
function o(i, u) {
|
|
53
53
|
const c = s.createContext(u), a = n.length;
|
|
54
54
|
n = [...n, u];
|
|
55
55
|
const l = (f) => {
|
|
56
|
-
var
|
|
57
|
-
const { scope: m, children: p, ...
|
|
58
|
-
return /* @__PURE__ */
|
|
56
|
+
var P;
|
|
57
|
+
const { scope: m, children: p, ...v } = f, N = ((P = m == null ? void 0 : m[e]) == null ? void 0 : P[a]) || c, y = s.useMemo(() => v, Object.values(v));
|
|
58
|
+
return /* @__PURE__ */ S(N.Provider, { value: y, children: p });
|
|
59
59
|
};
|
|
60
60
|
l.displayName = i + "Provider";
|
|
61
61
|
function d(f, m) {
|
|
62
|
-
var
|
|
63
|
-
const p = ((
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
62
|
+
var N;
|
|
63
|
+
const p = ((N = m == null ? void 0 : m[e]) == null ? void 0 : N[a]) || c, v = s.useContext(p);
|
|
64
|
+
if (v)
|
|
65
|
+
return v;
|
|
66
66
|
if (u !== void 0)
|
|
67
67
|
return u;
|
|
68
68
|
throw new Error(`\`${f}\` must be used within \`${i}\``);
|
|
@@ -79,9 +79,9 @@ function Z(e, t = []) {
|
|
|
79
79
|
);
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
-
return r.scopeName = e, [o,
|
|
82
|
+
return r.scopeName = e, [o, O(r, ...t)];
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function O(...e) {
|
|
85
85
|
const t = e[0];
|
|
86
86
|
if (e.length === 1)
|
|
87
87
|
return t;
|
|
@@ -101,14 +101,14 @@ function R(...e) {
|
|
|
101
101
|
return n.scopeName = t.scopeName, n;
|
|
102
102
|
}
|
|
103
103
|
// @__NO_SIDE_EFFECTS__
|
|
104
|
-
function
|
|
104
|
+
function x(e) {
|
|
105
105
|
const t = /* @__PURE__ */ M(e), n = s.forwardRef((o, r) => {
|
|
106
106
|
const { children: i, ...u } = o, c = s.Children.toArray(i), a = c.find(I);
|
|
107
107
|
if (a) {
|
|
108
108
|
const l = a.props.children, d = c.map((f) => f === a ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : f);
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ S(t, { ...u, ref: r, children: s.isValidElement(l) ? s.cloneElement(l, void 0, d) : null });
|
|
110
110
|
}
|
|
111
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ S(t, { ...u, ref: r, children: i });
|
|
112
112
|
});
|
|
113
113
|
return n.displayName = `${e}.Slot`, n;
|
|
114
114
|
}
|
|
@@ -118,20 +118,20 @@ function M(e) {
|
|
|
118
118
|
const { children: r, ...i } = n;
|
|
119
119
|
if (s.isValidElement(r)) {
|
|
120
120
|
const u = _(r), c = T(i, r.props);
|
|
121
|
-
return r.type !== s.Fragment && (c.ref = o ?
|
|
121
|
+
return r.type !== s.Fragment && (c.ref = o ? w(o, u) : u), s.cloneElement(r, c);
|
|
122
122
|
}
|
|
123
123
|
return s.Children.count(r) > 1 ? s.Children.only(null) : null;
|
|
124
124
|
});
|
|
125
125
|
return t.displayName = `${e}.SlotClone`, t;
|
|
126
126
|
}
|
|
127
|
-
var
|
|
127
|
+
var E = Symbol("radix.slottable");
|
|
128
128
|
// @__NO_SIDE_EFFECTS__
|
|
129
|
-
function
|
|
130
|
-
const t = ({ children: n }) => /* @__PURE__ */
|
|
131
|
-
return t.displayName = `${e}.Slottable`, t.__radixId =
|
|
129
|
+
function z(e) {
|
|
130
|
+
const t = ({ children: n }) => /* @__PURE__ */ S(R, { children: n });
|
|
131
|
+
return t.displayName = `${e}.Slottable`, t.__radixId = E, t;
|
|
132
132
|
}
|
|
133
133
|
function I(e) {
|
|
134
|
-
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId ===
|
|
134
|
+
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === E;
|
|
135
135
|
}
|
|
136
136
|
function T(e, t) {
|
|
137
137
|
const n = { ...t };
|
|
@@ -168,44 +168,22 @@ var $ = [
|
|
|
168
168
|
"svg",
|
|
169
169
|
"ul"
|
|
170
170
|
], G = $.reduce((e, t) => {
|
|
171
|
-
const n = /* @__PURE__ */
|
|
171
|
+
const n = /* @__PURE__ */ x(`Primitive.${t}`), o = s.forwardRef((r, i) => {
|
|
172
172
|
const { asChild: u, ...c } = r, a = u ? n : t;
|
|
173
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
173
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ S(a, { ...c, ref: i });
|
|
174
174
|
});
|
|
175
175
|
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
176
176
|
}, {});
|
|
177
177
|
function J(e, t) {
|
|
178
|
-
e &&
|
|
178
|
+
e && b.flushSync(() => e.dispatchEvent(t));
|
|
179
179
|
}
|
|
180
|
-
var
|
|
180
|
+
var C = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
181
181
|
};
|
|
182
|
-
function K(e) {
|
|
183
|
-
const [t, n] = s.useState(void 0);
|
|
184
|
-
return N(() => {
|
|
185
|
-
if (e) {
|
|
186
|
-
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
187
|
-
const o = new ResizeObserver((r) => {
|
|
188
|
-
if (!Array.isArray(r) || !r.length)
|
|
189
|
-
return;
|
|
190
|
-
const i = r[0];
|
|
191
|
-
let u, c;
|
|
192
|
-
if ("borderBoxSize" in i) {
|
|
193
|
-
const a = i.borderBoxSize, l = Array.isArray(a) ? a[0] : a;
|
|
194
|
-
u = l.inlineSize, c = l.blockSize;
|
|
195
|
-
} else
|
|
196
|
-
u = e.offsetWidth, c = e.offsetHeight;
|
|
197
|
-
n({ width: u, height: c });
|
|
198
|
-
});
|
|
199
|
-
return o.observe(e, { box: "border-box" }), () => o.unobserve(e);
|
|
200
|
-
} else
|
|
201
|
-
n(void 0);
|
|
202
|
-
}, [e]), t;
|
|
203
|
-
}
|
|
204
182
|
function D(e, t) {
|
|
205
183
|
return s.useReducer((n, o) => t[n][o] ?? n, e);
|
|
206
184
|
}
|
|
207
185
|
var U = (e) => {
|
|
208
|
-
const { present: t, children: n } = e, o = W(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i =
|
|
186
|
+
const { present: t, children: n } = e, o = W(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), i = A(o.ref, L(r));
|
|
209
187
|
return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: i }) : null;
|
|
210
188
|
};
|
|
211
189
|
U.displayName = "Presence";
|
|
@@ -224,27 +202,27 @@ function W(e) {
|
|
|
224
202
|
}
|
|
225
203
|
});
|
|
226
204
|
return s.useEffect(() => {
|
|
227
|
-
const l =
|
|
205
|
+
const l = h(o.current);
|
|
228
206
|
i.current = c === "mounted" ? l : "none";
|
|
229
|
-
}, [c]),
|
|
207
|
+
}, [c]), C(() => {
|
|
230
208
|
const l = o.current, d = r.current;
|
|
231
209
|
if (d !== e) {
|
|
232
|
-
const m = i.current, p =
|
|
210
|
+
const m = i.current, p = h(l);
|
|
233
211
|
e ? a("MOUNT") : p === "none" || (l == null ? void 0 : l.display) === "none" ? a("UNMOUNT") : a(d && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
|
|
234
212
|
}
|
|
235
|
-
}, [e, a]),
|
|
213
|
+
}, [e, a]), C(() => {
|
|
236
214
|
if (t) {
|
|
237
215
|
let l;
|
|
238
216
|
const d = t.ownerDocument.defaultView ?? window, f = (p) => {
|
|
239
|
-
const
|
|
240
|
-
if (p.target === t &&
|
|
241
|
-
const
|
|
217
|
+
const N = h(o.current).includes(CSS.escape(p.animationName));
|
|
218
|
+
if (p.target === t && N && (a("ANIMATION_END"), !r.current)) {
|
|
219
|
+
const y = t.style.animationFillMode;
|
|
242
220
|
t.style.animationFillMode = "forwards", l = d.setTimeout(() => {
|
|
243
|
-
t.style.animationFillMode === "forwards" && (t.style.animationFillMode =
|
|
221
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = y);
|
|
244
222
|
});
|
|
245
223
|
}
|
|
246
224
|
}, m = (p) => {
|
|
247
|
-
p.target === t && (i.current =
|
|
225
|
+
p.target === t && (i.current = h(o.current));
|
|
248
226
|
};
|
|
249
227
|
return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
|
|
250
228
|
d.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
|
|
@@ -258,23 +236,23 @@ function W(e) {
|
|
|
258
236
|
}, [])
|
|
259
237
|
};
|
|
260
238
|
}
|
|
261
|
-
function
|
|
239
|
+
function h(e) {
|
|
262
240
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
263
241
|
}
|
|
264
|
-
function
|
|
242
|
+
function L(e) {
|
|
265
243
|
var o, r;
|
|
266
244
|
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
267
245
|
return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
268
246
|
}
|
|
269
|
-
var
|
|
270
|
-
function
|
|
247
|
+
var j = s[" useInsertionEffect ".trim().toString()] || C;
|
|
248
|
+
function K({
|
|
271
249
|
prop: e,
|
|
272
250
|
defaultProp: t,
|
|
273
251
|
onChange: n = () => {
|
|
274
252
|
},
|
|
275
253
|
caller: o
|
|
276
254
|
}) {
|
|
277
|
-
const [r, i, u] =
|
|
255
|
+
const [r, i, u] = F({
|
|
278
256
|
defaultProp: t,
|
|
279
257
|
onChange: n
|
|
280
258
|
}), c = e !== void 0, a = c ? e : r;
|
|
@@ -291,7 +269,7 @@ function Q({
|
|
|
291
269
|
(d) => {
|
|
292
270
|
var f;
|
|
293
271
|
if (c) {
|
|
294
|
-
const m =
|
|
272
|
+
const m = V(d) ? d(e) : d;
|
|
295
273
|
m !== e && ((f = u.current) == null || f.call(u, m));
|
|
296
274
|
} else
|
|
297
275
|
i(d);
|
|
@@ -300,33 +278,32 @@ function Q({
|
|
|
300
278
|
);
|
|
301
279
|
return [a, l];
|
|
302
280
|
}
|
|
303
|
-
function
|
|
281
|
+
function F({
|
|
304
282
|
defaultProp: e,
|
|
305
283
|
onChange: t
|
|
306
284
|
}) {
|
|
307
285
|
const [n, o] = s.useState(e), r = s.useRef(n), i = s.useRef(t);
|
|
308
|
-
return
|
|
286
|
+
return j(() => {
|
|
309
287
|
i.current = t;
|
|
310
288
|
}, [t]), s.useEffect(() => {
|
|
311
289
|
var u;
|
|
312
290
|
r.current !== n && ((u = i.current) == null || u.call(i, n), r.current = n);
|
|
313
291
|
}, [n, r]), [n, o, i];
|
|
314
292
|
}
|
|
315
|
-
function
|
|
293
|
+
function V(e) {
|
|
316
294
|
return typeof e == "function";
|
|
317
295
|
}
|
|
318
296
|
export {
|
|
319
297
|
G as P,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
x as u
|
|
298
|
+
A as a,
|
|
299
|
+
B as b,
|
|
300
|
+
q as c,
|
|
301
|
+
U as d,
|
|
302
|
+
Z as e,
|
|
303
|
+
K as f,
|
|
304
|
+
x as g,
|
|
305
|
+
J as h,
|
|
306
|
+
z as i,
|
|
307
|
+
w as j,
|
|
308
|
+
C as u
|
|
332
309
|
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { a as R, P as w, b as y, h as _, u as U } from "./index-c0faa594.js";
|
|
3
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
4
|
+
function b(t) {
|
|
5
|
+
const e = r.useRef(t);
|
|
6
|
+
return r.useEffect(() => {
|
|
7
|
+
e.current = t;
|
|
8
|
+
}), r.useMemo(() => (...n) => {
|
|
9
|
+
var s;
|
|
10
|
+
return (s = e.current) == null ? void 0 : s.call(e, ...n);
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
13
|
+
function z(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
14
|
+
const n = b(t);
|
|
15
|
+
r.useEffect(() => {
|
|
16
|
+
const s = (i) => {
|
|
17
|
+
i.key === "Escape" && n(i);
|
|
18
|
+
};
|
|
19
|
+
return e.addEventListener("keydown", s, { capture: !0 }), () => e.removeEventListener("keydown", s, { capture: !0 });
|
|
20
|
+
}, [n, e]);
|
|
21
|
+
}
|
|
22
|
+
var H = "DismissableLayer", p = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", K = "dismissableLayer.focusOutside", O, S = r.createContext({
|
|
23
|
+
layers: /* @__PURE__ */ new Set(),
|
|
24
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
25
|
+
branches: /* @__PURE__ */ new Set()
|
|
26
|
+
}), j = r.forwardRef(
|
|
27
|
+
(t, e) => {
|
|
28
|
+
const {
|
|
29
|
+
disableOutsidePointerEvents: n = !1,
|
|
30
|
+
onEscapeKeyDown: s,
|
|
31
|
+
onPointerDownOutside: i,
|
|
32
|
+
onFocusOutside: a,
|
|
33
|
+
onInteractOutside: l,
|
|
34
|
+
onDismiss: d,
|
|
35
|
+
...E
|
|
36
|
+
} = t, u = r.useContext(S), [c, B] = r.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = r.useState({}), I = R(e, (o) => B(o)), m = Array.from(u.layers), [W] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), A = m.indexOf(W), P = c ? m.indexOf(c) : -1, N = u.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= A, k = $((o) => {
|
|
37
|
+
const v = o.target, C = [...u.branches].some((h) => h.contains(v));
|
|
38
|
+
!D || C || (i == null || i(o), l == null || l(o), o.defaultPrevented || d == null || d());
|
|
39
|
+
}, f), L = q((o) => {
|
|
40
|
+
const v = o.target;
|
|
41
|
+
[...u.branches].some((h) => h.contains(v)) || (a == null || a(o), l == null || l(o), o.defaultPrevented || d == null || d());
|
|
42
|
+
}, f);
|
|
43
|
+
return z((o) => {
|
|
44
|
+
P === u.layers.size - 1 && (s == null || s(o), !o.defaultPrevented && d && (o.preventDefault(), d()));
|
|
45
|
+
}, f), r.useEffect(() => {
|
|
46
|
+
if (c)
|
|
47
|
+
return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (O = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), g(), () => {
|
|
48
|
+
n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = O);
|
|
49
|
+
};
|
|
50
|
+
}, [c, f, n, u]), r.useEffect(() => () => {
|
|
51
|
+
c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), g());
|
|
52
|
+
}, [c, u]), r.useEffect(() => {
|
|
53
|
+
const o = () => F({});
|
|
54
|
+
return document.addEventListener(p, o), () => document.removeEventListener(p, o);
|
|
55
|
+
}, []), /* @__PURE__ */ T(
|
|
56
|
+
w.div,
|
|
57
|
+
{
|
|
58
|
+
...E,
|
|
59
|
+
ref: I,
|
|
60
|
+
style: {
|
|
61
|
+
pointerEvents: N ? D ? "auto" : "none" : void 0,
|
|
62
|
+
...t.style
|
|
63
|
+
},
|
|
64
|
+
onFocusCapture: y(t.onFocusCapture, L.onFocusCapture),
|
|
65
|
+
onBlurCapture: y(t.onBlurCapture, L.onBlurCapture),
|
|
66
|
+
onPointerDownCapture: y(
|
|
67
|
+
t.onPointerDownCapture,
|
|
68
|
+
k.onPointerDownCapture
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
j.displayName = H;
|
|
75
|
+
var X = "DismissableLayerBranch", Y = r.forwardRef((t, e) => {
|
|
76
|
+
const n = r.useContext(S), s = r.useRef(null), i = R(e, s);
|
|
77
|
+
return r.useEffect(() => {
|
|
78
|
+
const a = s.current;
|
|
79
|
+
if (a)
|
|
80
|
+
return n.branches.add(a), () => {
|
|
81
|
+
n.branches.delete(a);
|
|
82
|
+
};
|
|
83
|
+
}, [n.branches]), /* @__PURE__ */ T(w.div, { ...t, ref: i });
|
|
84
|
+
});
|
|
85
|
+
Y.displayName = X;
|
|
86
|
+
function $(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
87
|
+
const n = b(t), s = r.useRef(!1), i = r.useRef(() => {
|
|
88
|
+
});
|
|
89
|
+
return r.useEffect(() => {
|
|
90
|
+
const a = (d) => {
|
|
91
|
+
if (d.target && !s.current) {
|
|
92
|
+
let E = function() {
|
|
93
|
+
x(
|
|
94
|
+
M,
|
|
95
|
+
n,
|
|
96
|
+
u,
|
|
97
|
+
{ discrete: !0 }
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
const u = { originalEvent: d };
|
|
101
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
|
|
102
|
+
} else
|
|
103
|
+
e.removeEventListener("click", i.current);
|
|
104
|
+
s.current = !1;
|
|
105
|
+
}, l = window.setTimeout(() => {
|
|
106
|
+
e.addEventListener("pointerdown", a);
|
|
107
|
+
}, 0);
|
|
108
|
+
return () => {
|
|
109
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", i.current);
|
|
110
|
+
};
|
|
111
|
+
}, [e, n]), {
|
|
112
|
+
// ensures we check React component tree (not just DOM tree)
|
|
113
|
+
onPointerDownCapture: () => s.current = !0
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function q(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
117
|
+
const n = b(t), s = r.useRef(!1);
|
|
118
|
+
return r.useEffect(() => {
|
|
119
|
+
const i = (a) => {
|
|
120
|
+
a.target && !s.current && x(K, n, { originalEvent: a }, {
|
|
121
|
+
discrete: !1
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
|
|
125
|
+
}, [e, n]), {
|
|
126
|
+
onFocusCapture: () => s.current = !0,
|
|
127
|
+
onBlurCapture: () => s.current = !1
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function g() {
|
|
131
|
+
const t = new CustomEvent(p);
|
|
132
|
+
document.dispatchEvent(t);
|
|
133
|
+
}
|
|
134
|
+
function x(t, e, n, { discrete: s }) {
|
|
135
|
+
const i = n.originalEvent.target, a = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
|
|
136
|
+
e && i.addEventListener(t, e, { once: !0 }), s ? _(i, a) : i.dispatchEvent(a);
|
|
137
|
+
}
|
|
138
|
+
var G = r[" useId ".trim().toString()] || (() => {
|
|
139
|
+
}), J = 0;
|
|
140
|
+
function Z(t) {
|
|
141
|
+
const [e, n] = r.useState(G());
|
|
142
|
+
return U(() => {
|
|
143
|
+
t || n((s) => s ?? String(J++));
|
|
144
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
j as D,
|
|
148
|
+
b as a,
|
|
149
|
+
Z as u
|
|
150
|
+
};
|