@react-pdf-kit/viewer 2.0.0-beta.0 → 2.0.0-beta.10
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-54a77a7a.js +701 -0
- package/dist/MostPageTool.module-13578ad6.js +6 -0
- package/dist/OtherTool.module-a4be5f1f.js +6 -0
- package/dist/Paginate.module-206a7d7d.js +8 -0
- package/dist/PaginationContext-9217cab4.js +201 -0
- package/dist/{LayoutWrapper-a871c161.js → RPLayout.module-967bf4bc.js} +3 -9
- package/dist/RPToolbar.module-27d7fe77.js +10 -0
- package/dist/{RotateTool.module-03987eba.js → RotateTool.module-67946714.js} +1 -1
- package/dist/SearchTool.module-99f60dc7.js +16 -0
- package/dist/ToolbarLayout.module-1fee0a18.js +11 -0
- package/dist/{ZoomTool.module-6c5eabbb.js → ZoomTool.module-7082af8c.js} +1 -1
- package/dist/assets/style.css +1 -0
- package/dist/assets/style.js +75 -0
- package/dist/components/RPConfig.js +14 -1489
- package/dist/components/RPController.js +109 -66
- package/dist/components/RPDropFileZone.js +26 -12
- package/dist/components/RPPages.js +991 -58
- package/dist/components/RPProvider.js +107 -19
- package/dist/components/RPTheme.js +6 -5
- package/dist/components/icons/DualPageIcon.js +6 -6
- package/dist/components/icons/LoaderIcon.js +1 -1
- package/dist/components/icons/SinglePageIcon.js +6 -6
- package/dist/components/layout/Container.js +1 -1
- package/dist/components/layout/LayoutContainer.js +32 -57
- package/dist/components/layout/LayoutWrapper.js +9 -4
- package/dist/components/layout/RPDefaultLayout.js +214 -14
- package/dist/components/layout/RPLayout.js +143 -41
- package/dist/components/layout/WrapperLayout.js +22 -9
- package/dist/components/layout/sidebar/RPSidebar.js +110 -13
- package/dist/components/layout/sidebar/RPSplitter.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +129 -52
- package/dist/components/layout/sidebar/Thumbnails.js +75 -6
- package/dist/components/layout/toolbar/DarkModeTool.js +24 -13
- package/dist/components/layout/toolbar/DocumentDialog.js +311 -56
- package/dist/components/layout/toolbar/DocumentProperties.js +21 -8
- package/dist/components/layout/toolbar/FileDownloadTool.js +48 -13
- package/dist/components/layout/toolbar/FileUploadTool.js +34 -10
- package/dist/components/layout/toolbar/FullScreenTool.js +43 -28
- package/dist/components/layout/toolbar/MenuItem.js +15 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +11 -4
- package/dist/components/layout/toolbar/MostPageTool.js +72 -51
- package/dist/components/layout/toolbar/OtherTool.js +188 -22
- package/dist/components/layout/toolbar/Paginate.js +136 -17
- package/dist/components/layout/toolbar/PrintTool.js +70 -13
- package/dist/components/layout/toolbar/PropertyItem.js +1 -1
- package/dist/components/layout/toolbar/RPMenuItem.js +23 -13
- package/dist/components/layout/toolbar/RPMoreOptions.js +119 -47
- package/dist/components/layout/toolbar/RPToolbar.js +148 -8
- package/dist/components/layout/toolbar/RPToolbarEnd.js +118 -7
- package/dist/components/layout/toolbar/RotateTool.js +42 -18
- package/dist/components/layout/toolbar/ScrollModeTool.js +33 -21
- package/dist/components/layout/toolbar/SearchCloseButton.js +30 -7
- package/dist/components/layout/toolbar/SearchResultNavigator.js +87 -8
- package/dist/components/layout/toolbar/SearchTool.js +236 -54
- package/dist/components/layout/toolbar/SelectionModeTool.js +22 -10
- package/dist/components/layout/toolbar/ThumbnailTool.js +32 -10
- package/dist/components/layout/toolbar/ToolbarCustom.js +52 -55
- package/dist/components/layout/toolbar/ToolbarDefault.js +144 -58
- package/dist/components/layout/toolbar/ToolbarLayout.js +149 -6
- package/dist/components/layout/toolbar/ViewModeTool.js +31 -19
- package/dist/components/layout/toolbar/ZoomTool.js +104 -84
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +38 -12
- package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +31 -9
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +29 -8
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +25 -13
- package/dist/components/layout/toolbar/tools/InputPageTool.js +66 -26
- package/dist/components/layout/toolbar/tools/NextPageTool.js +36 -47
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +51 -11
- package/dist/components/layout/toolbar/tools/PrintTool.js +29 -7
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +31 -8
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +34 -11
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +17 -6
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +35 -13
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +49 -20
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +27 -0
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +57 -23
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +47 -18
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +122 -45
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +37 -11
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +18 -5
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +36 -11
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +25 -50
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +24 -9
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +47 -54
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +32 -7
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +36 -12
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +26 -14
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +27 -15
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +30 -18
- package/dist/components/page/AnnotationLayer.js +130 -54
- package/dist/components/page/CanvasLayer.js +62 -49
- package/dist/components/page/CustomElement.js +49 -18
- package/dist/components/page/DualPage.js +97 -4
- package/dist/components/page/RPPage.js +134 -51
- package/dist/components/page/SinglePage.js +87 -4
- package/dist/components/page/TextHighlightLayer.js +195 -57
- package/dist/components/page/TextLayer.js +193 -52
- package/dist/components/ui/Button.js +9 -8
- package/dist/components/ui/Checkbox.js +27 -25
- package/dist/components/ui/DropDown.js +21 -14
- package/dist/components/ui/Input.js +10 -9
- package/dist/components/ui/LoadingIndicator.js +45 -5
- package/dist/components/ui/PasswordModal.js +18 -15
- package/dist/components/ui/RPTooltip.js +98 -95
- package/dist/contexts/DimensionPagesContext.js +35 -17
- package/dist/contexts/DropFileZoneContext.js +32 -22
- package/dist/contexts/ElementPageContext.js +114 -51
- package/dist/contexts/EventCallbackContext.js +30 -0
- package/dist/contexts/FileInputContext.js +32 -22
- package/dist/contexts/FullScreenContext.js +17 -10
- package/dist/contexts/GlobalCurrentPage.js +13 -10
- package/dist/contexts/HighlightContext.js +24 -11
- package/dist/contexts/LicenseContext.js +1 -0
- package/dist/contexts/LoaderContext.js +10 -9
- package/dist/contexts/LocalizationContext.js +25 -29
- package/dist/contexts/PagesRotateContext.js +36 -18
- package/dist/contexts/PaginationContext.js +32 -4
- package/dist/contexts/PrintContext.js +76 -6
- package/dist/contexts/RPDocumentContext.js +48 -30
- package/dist/contexts/RenderQueueProvider.js +70 -8
- package/dist/contexts/RotationContext.js +25 -15
- package/dist/contexts/ScrollModeContext.js +7 -6
- package/dist/contexts/SearchContext.js +94 -6
- package/dist/contexts/SelectionModeContext.js +5 -4
- package/dist/contexts/ThumbnailsContext.js +41 -6
- package/dist/contexts/ViewModeContext.js +10 -9
- package/dist/contexts/ZoomContext.js +48 -38
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-4baea9b5.js +1198 -0
- package/dist/index-655864a7.js +27 -0
- package/dist/{index-35c7f4a2.js → index-c0faa594.js} +63 -86
- package/dist/index-e3ee9457.js +150 -0
- package/dist/libInjectCss.js +9 -0
- package/dist/main.js +269 -84
- package/dist/types/assets/style.d.ts +1 -0
- package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
- package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
- package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomLevelDisplay.d.ts +7 -0
- package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
- package/dist/types/libInjectCss.d.ts +1 -0
- package/dist/types/main.d.ts +6 -6
- package/dist/types/utils/annotations.d.ts +3 -3
- package/dist/types/utils/approximateFragtion.d.ts +9 -0
- package/dist/types/utils/getElementPositionInPage.d.ts +5 -0
- package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
- package/dist/types/utils/hooks/usePrint.d.ts +3 -2
- package/dist/types/utils/hooks/useSearch.d.ts +1 -2
- package/dist/types/utils/injectPrintCSS.d.ts +1 -0
- package/dist/types/utils/link_service.d.ts +11 -1
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +38 -5
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/annotations.js +125 -149
- package/dist/utils/approximateFragtion.js +22 -0
- package/dist/utils/getElementPositionInPage.js +84 -0
- package/dist/utils/getWordPositionInPage.js +5 -5
- package/dist/utils/getZoomLevel.js +9 -8
- package/dist/utils/highlight.js +72 -72
- package/dist/utils/hooks/useCopyText.js +36 -0
- package/dist/utils/hooks/useDarkModeProps.js +3 -2
- package/dist/utils/hooks/useFileDownload.js +29 -54
- package/dist/utils/hooks/useHighlight.js +34 -33
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +44 -36
- package/dist/utils/hooks/useLoadWorker.js +11 -8
- package/dist/utils/hooks/useLocalization.js +13 -13
- package/dist/utils/hooks/usePageRotateContext.js +33 -17
- package/dist/utils/hooks/usePaginate.js +26 -49
- package/dist/utils/hooks/usePinch.js +62 -41
- package/dist/utils/hooks/usePresentPage.js +80 -50
- package/dist/utils/hooks/usePrint.js +181 -55
- package/dist/utils/hooks/useRotate.js +21 -7
- package/dist/utils/hooks/useScrollToPage.js +26 -51
- package/dist/utils/hooks/useSearch.js +141 -55
- package/dist/utils/hooks/useThumbnail.js +55 -55
- package/dist/utils/hooks/useVirtualReactWindow.js +70 -52
- package/dist/utils/hooks/useWatermark.js +18 -15
- package/dist/utils/injectPrintCSS.js +22 -0
- package/dist/utils/link_service.js +49 -9
- package/dist/utils/renderPage.js +13 -10
- package/dist/utils/zoom.js +6 -0
- package/package.json +6 -8
- package/dist/SearchCloseButton-cbf182aa.js +0 -33
- package/dist/ToolbarLayout.module-c588d36b.js +0 -3411
- package/dist/assets/Button.css +0 -1
- package/dist/assets/Checkbox.css +0 -1
- package/dist/assets/Container.css +0 -1
- package/dist/assets/DropDown.css +0 -1
- package/dist/assets/Input.css +0 -1
- package/dist/assets/LayoutWrapper.css +0 -1
- package/dist/assets/LoaderIcon.css +0 -1
- package/dist/assets/MenuItem.css +0 -1
- package/dist/assets/MenuSeparator.css +0 -1
- package/dist/assets/PasswordModal.css +0 -1
- package/dist/assets/PropertyItem.css +0 -1
- package/dist/assets/RPDropFileZone.css +0 -1
- package/dist/assets/RPSplitter.css +0 -1
- package/dist/assets/RPTooltip.css +0 -1
- package/dist/assets/RotateTool.css +0 -1
- package/dist/assets/SearchCloseButton.css +0 -1
- package/dist/assets/ToolbarLayout.css +0 -1
- package/dist/assets/WrapperLayout.css +0 -1
- package/dist/assets/ZoomTool.css +0 -1
- package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
- package/dist/index-f563c6f0.js +0 -1889
|
@@ -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
|
-
|
|
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,
|
|
327
305
|
J as h,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
x as u
|
|
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
|
+
};
|