@pdf-viewer/react 1.8.0-rc.2 → 1.9.0-beta.1
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/{Popover-1faa77f6.js → Popover-48c8394c.js} +2 -2
- package/dist/RPLayout-3042ec91.js +3349 -0
- package/dist/assets/{RPDefaultLayout.css → RPLayout.css} +1 -1
- package/dist/{component-1da194e8.js → component-2aa6e53b.js} +1 -1
- package/dist/components/RPConfig.js +691 -673
- package/dist/components/RPController.js +9 -9
- package/dist/components/RPPages.js +14 -2
- package/dist/components/icons/ChevronDownIcon.js +23 -0
- package/dist/components/layout/LayoutContainer.js +14 -2
- package/dist/components/layout/RPDefaultLayout.js +3 -2
- package/dist/components/layout/RPLayout.js +50 -0
- 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/DarkModeTool.js +16 -19
- package/dist/components/layout/toolbar/DocumentDialog.js +14 -2
- 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 +13 -5
- package/dist/components/layout/toolbar/OtherTool.js +3 -4
- 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 +6 -3
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +47 -0
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +17 -0
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +17 -0
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +25 -0
- package/dist/components/layout/toolbar/tools/InputPageTool.js +45 -0
- package/dist/components/layout/toolbar/tools/NextPageTool.js +61 -0
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +21 -0
- package/dist/components/layout/toolbar/tools/PrintTool.js +17 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +17 -0
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +23 -0
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +28 -0
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +92 -0
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +28 -0
- package/dist/components/page/AnnotationLayer.js +14 -2
- package/dist/components/page/CanvasLayer.js +14 -2
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +13 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +14 -2
- package/dist/components/page/TextLayer.js +14 -2
- package/dist/components/ui/Checkbox.js +228 -116
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/Popover.js +1 -1
- package/dist/components/ui/RPTooltip.js +207 -207
- package/dist/contexts/ElementPageContext.js +46 -57
- package/dist/contexts/PaginationContext.js +3 -3
- package/dist/contexts/PrintContext.js +2 -2
- package/dist/contexts/SearchContext.js +2 -2
- package/dist/contexts/ThumbnailsContext.js +2 -2
- package/dist/{floating-ui.react-dom-15b9b819.js → floating-ui.react-dom-4b1e2e46.js} +394 -380
- package/dist/index-6e0e48fa.js +332 -0
- package/dist/{index-7279fb4e.js → index-951f0f1f.js} +464 -456
- package/dist/index-e3a67935.js +150 -0
- package/dist/main.js +70 -44
- package/dist/types/components/icons/ChevronDownIcon.d.ts +2 -0
- package/dist/types/components/layout/RPDefaultLayout.d.ts +2 -2
- package/dist/types/components/layout/RPLayout.d.ts +2 -0
- package/dist/types/components/layout/toolbar/SearchTool.d.ts +2 -1
- package/dist/types/components/layout/toolbar/ToolbarCustom.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FileDownloadTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FileUploadTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FullScreenTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/InputPageTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/tools/NextPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PreviousPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PrintTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ThemeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ThumbnailTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomInTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomLevelTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/ZoomOutTool.d.ts +3 -0
- package/dist/types/main.d.ts +15 -1
- package/dist/types/utils/constants.d.ts +2 -0
- package/dist/types/utils/types.d.ts +28 -2
- package/dist/utils/constants.js +5 -3
- package/dist/utils/hooks/useFileDownload.js +14 -2
- package/dist/utils/hooks/useLicense.js +24 -26
- package/dist/utils/hooks/usePageRotateContext.js +14 -17
- package/dist/utils/hooks/usePaginate.js +14 -2
- package/dist/utils/hooks/usePresentPage.js +14 -2
- package/dist/utils/hooks/usePrint.js +14 -2
- package/dist/utils/hooks/useScrollToPage.js +14 -2
- package/dist/utils/hooks/useSearch.js +14 -2
- package/dist/utils/hooks/useThumbnail.js +14 -2
- package/dist/utils/hooks/useVirtualReactWindow.js +14 -2
- package/package.json +1 -1
- package/dist/RPDefaultLayout-2cca5d34.js +0 -3263
- package/dist/index-1cb41342.js +0 -307
- package/dist/index-aa2d3884.js +0 -140
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
1
|
+
import { jsx as d, jsxs as Y } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { P as
|
|
5
|
-
import { u as Ue, D as
|
|
6
|
-
import { u as
|
|
7
|
-
import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e,
|
|
8
|
-
const { children: t, width:
|
|
3
|
+
import { forwardRef as Fe } from "react";
|
|
4
|
+
import { P as N, c as ae, u as k, d as We, g as re, e as Be, a as E, b as Ge, h as Xe } from "../../index-6e0e48fa.js";
|
|
5
|
+
import { u as Ve, a as Ue, D as ze } from "../../index-e3a67935.js";
|
|
6
|
+
import { u as qe, a as Ze, o as Ke, s as Je, f as Qe, b as et, c as tt, h as ot, l as rt } from "../../floating-ui.react-dom-4b1e2e46.js";
|
|
7
|
+
import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, o) => {
|
|
8
|
+
const { children: t, width: r = 10, height: n = 5, ...s } = e;
|
|
9
9
|
return /* @__PURE__ */ d(
|
|
10
|
-
|
|
10
|
+
N.svg,
|
|
11
11
|
{
|
|
12
12
|
...s,
|
|
13
|
-
ref:
|
|
14
|
-
width:
|
|
13
|
+
ref: o,
|
|
14
|
+
width: r,
|
|
15
15
|
height: n,
|
|
16
16
|
viewBox: "0 0 30 10",
|
|
17
17
|
preserveAspectRatio: "none",
|
|
@@ -21,25 +21,25 @@ import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, r) =
|
|
|
21
21
|
});
|
|
22
22
|
se.displayName = nt;
|
|
23
23
|
var at = se, B = "Popper", [ie, le] = ae(B), [st, ce] = ie(B), de = (e) => {
|
|
24
|
-
const { __scopePopper:
|
|
25
|
-
return /* @__PURE__ */ d(st, { scope:
|
|
24
|
+
const { __scopePopper: o, children: t } = e, [r, n] = a.useState(null);
|
|
25
|
+
return /* @__PURE__ */ d(st, { scope: o, anchor: r, onAnchorChange: n, children: t });
|
|
26
26
|
};
|
|
27
27
|
de.displayName = B;
|
|
28
28
|
var pe = "PopperAnchor", ue = a.forwardRef(
|
|
29
|
-
(e,
|
|
30
|
-
const { __scopePopper: t, virtualRef:
|
|
29
|
+
(e, o) => {
|
|
30
|
+
const { __scopePopper: t, virtualRef: r, ...n } = e, s = ce(pe, t), i = a.useRef(null), h = k(o, i);
|
|
31
31
|
return a.useEffect(() => {
|
|
32
|
-
s.onAnchorChange((
|
|
33
|
-
}),
|
|
32
|
+
s.onAnchorChange((r == null ? void 0 : r.current) || i.current);
|
|
33
|
+
}), r ? null : /* @__PURE__ */ d(N.div, { ...n, ref: h });
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
36
|
ue.displayName = pe;
|
|
37
37
|
var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
|
|
38
|
-
(e,
|
|
38
|
+
(e, o) => {
|
|
39
39
|
var Z, K, J, Q, ee, te;
|
|
40
40
|
const {
|
|
41
41
|
__scopePopper: t,
|
|
42
|
-
side:
|
|
42
|
+
side: r = "bottom",
|
|
43
43
|
sideOffset: n = 0,
|
|
44
44
|
align: s = "center",
|
|
45
45
|
alignOffset: i = 0,
|
|
@@ -48,16 +48,16 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
|
|
|
48
48
|
collisionBoundary: p = [],
|
|
49
49
|
collisionPadding: c = 0,
|
|
50
50
|
sticky: f = "partial",
|
|
51
|
-
hideWhenDetached:
|
|
51
|
+
hideWhenDetached: g = !1,
|
|
52
52
|
updatePositionStrategy: u = "optimized",
|
|
53
53
|
onPlaced: v,
|
|
54
|
-
...
|
|
55
|
-
} = e,
|
|
54
|
+
...y
|
|
55
|
+
} = e, m = ce(G, t), [w, x] = a.useState(null), T = k(o, (_) => x(_)), [C, b] = a.useState(null), P = We(C), S = (P == null ? void 0 : P.width) ?? 0, V = (P == null ? void 0 : P.height) ?? 0, Ee = r + (s !== "center" ? "-" + s : ""), Re = typeof c == "number" ? c : { top: 0, right: 0, bottom: 0, left: 0, ...c }, U = Array.isArray(p) ? p : [p], _e = U.length > 0, D = {
|
|
56
56
|
padding: Re,
|
|
57
57
|
boundary: U.filter(dt),
|
|
58
58
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
59
59
|
altBoundary: _e
|
|
60
|
-
}, { refs: Oe, floatingStyles:
|
|
60
|
+
}, { refs: Oe, floatingStyles: z, placement: Ne, isPositioned: H, middlewareData: A } = qe({
|
|
61
61
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
62
62
|
strategy: "fixed",
|
|
63
63
|
placement: Ee,
|
|
@@ -65,46 +65,46 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
|
|
|
65
65
|
animationFrame: u === "always"
|
|
66
66
|
}),
|
|
67
67
|
elements: {
|
|
68
|
-
reference:
|
|
68
|
+
reference: m.anchor
|
|
69
69
|
},
|
|
70
70
|
middleware: [
|
|
71
71
|
Ke({ mainAxis: n + V, alignmentAxis: i }),
|
|
72
72
|
l && Je({
|
|
73
73
|
mainAxis: !0,
|
|
74
74
|
crossAxis: !1,
|
|
75
|
-
limiter: f === "partial" ?
|
|
76
|
-
...
|
|
75
|
+
limiter: f === "partial" ? rt() : void 0,
|
|
76
|
+
...D
|
|
77
77
|
}),
|
|
78
|
-
l && Qe({ ...
|
|
78
|
+
l && Qe({ ...D }),
|
|
79
79
|
et({
|
|
80
|
-
...
|
|
81
|
-
apply: ({ elements: _, rects:
|
|
82
|
-
const { width:
|
|
83
|
-
|
|
80
|
+
...D,
|
|
81
|
+
apply: ({ elements: _, rects: oe, availableWidth: Me, availableHeight: $e }) => {
|
|
82
|
+
const { width: je, height: Ye } = oe.reference, L = _.floating.style;
|
|
83
|
+
L.setProperty("--radix-popper-available-width", `${Me}px`), L.setProperty("--radix-popper-available-height", `${$e}px`), L.setProperty("--radix-popper-anchor-width", `${je}px`), L.setProperty("--radix-popper-anchor-height", `${Ye}px`);
|
|
84
84
|
}
|
|
85
85
|
}),
|
|
86
86
|
C && tt({ element: C, padding: h }),
|
|
87
|
-
pt({ arrowWidth:
|
|
88
|
-
|
|
87
|
+
pt({ arrowWidth: S, arrowHeight: V }),
|
|
88
|
+
g && ot({ strategy: "referenceHidden", ...D })
|
|
89
89
|
]
|
|
90
|
-
}), [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
const De = (Z = A.arrow) == null ? void 0 : Z.x, He = (K = A.arrow) == null ? void 0 : K.y, Ie = ((J = A.arrow) == null ? void 0 : J.centerOffset) !== 0, [
|
|
95
|
-
return
|
|
96
|
-
w &&
|
|
90
|
+
}), [q, Se] = ge(Ne), I = Ve(v);
|
|
91
|
+
re(() => {
|
|
92
|
+
H && (I == null || I());
|
|
93
|
+
}, [H, I]);
|
|
94
|
+
const De = (Z = A.arrow) == null ? void 0 : Z.x, He = (K = A.arrow) == null ? void 0 : K.y, Ie = ((J = A.arrow) == null ? void 0 : J.centerOffset) !== 0, [Le, ke] = a.useState();
|
|
95
|
+
return re(() => {
|
|
96
|
+
w && ke(window.getComputedStyle(w).zIndex);
|
|
97
97
|
}, [w]), /* @__PURE__ */ d(
|
|
98
98
|
"div",
|
|
99
99
|
{
|
|
100
100
|
ref: Oe.setFloating,
|
|
101
101
|
"data-radix-popper-content-wrapper": "",
|
|
102
102
|
style: {
|
|
103
|
-
...
|
|
104
|
-
transform:
|
|
103
|
+
...z,
|
|
104
|
+
transform: H ? z.transform : "translate(0, -200%)",
|
|
105
105
|
// keep off the page when measuring
|
|
106
106
|
minWidth: "max-content",
|
|
107
|
-
zIndex:
|
|
107
|
+
zIndex: Le,
|
|
108
108
|
"--radix-popper-transform-origin": [
|
|
109
109
|
(Q = A.transformOrigin) == null ? void 0 : Q.x,
|
|
110
110
|
(ee = A.transformOrigin) == null ? void 0 : ee.y
|
|
@@ -122,23 +122,23 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
|
|
|
122
122
|
it,
|
|
123
123
|
{
|
|
124
124
|
scope: t,
|
|
125
|
-
placedSide:
|
|
125
|
+
placedSide: q,
|
|
126
126
|
onArrowChange: b,
|
|
127
127
|
arrowX: De,
|
|
128
128
|
arrowY: He,
|
|
129
129
|
shouldHideArrow: Ie,
|
|
130
130
|
children: /* @__PURE__ */ d(
|
|
131
|
-
|
|
131
|
+
N.div,
|
|
132
132
|
{
|
|
133
|
-
"data-side":
|
|
133
|
+
"data-side": q,
|
|
134
134
|
"data-align": Se,
|
|
135
|
-
...
|
|
135
|
+
...y,
|
|
136
136
|
ref: T,
|
|
137
137
|
style: {
|
|
138
|
-
...
|
|
138
|
+
...y.style,
|
|
139
139
|
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
140
140
|
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
141
|
-
animation:
|
|
141
|
+
animation: H ? void 0 : "none"
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
)
|
|
@@ -154,8 +154,8 @@ var he = "PopperArrow", ct = {
|
|
|
154
154
|
right: "left",
|
|
155
155
|
bottom: "top",
|
|
156
156
|
left: "right"
|
|
157
|
-
}, ve = a.forwardRef(function(
|
|
158
|
-
const { __scopePopper:
|
|
157
|
+
}, ve = a.forwardRef(function(o, t) {
|
|
158
|
+
const { __scopePopper: r, ...n } = o, s = lt(he, r), i = ct[s.placedSide];
|
|
159
159
|
return (
|
|
160
160
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
161
161
|
// doesn't report size as we'd expect on SVG elements.
|
|
@@ -206,117 +206,117 @@ function dt(e) {
|
|
|
206
206
|
var pt = (e) => ({
|
|
207
207
|
name: "transformOrigin",
|
|
208
208
|
options: e,
|
|
209
|
-
fn(
|
|
210
|
-
var
|
|
211
|
-
const { placement: t, rects:
|
|
212
|
-
let v = "",
|
|
213
|
-
return p === "bottom" ? (v = i ? f : `${
|
|
209
|
+
fn(o) {
|
|
210
|
+
var m, w, x;
|
|
211
|
+
const { placement: t, rects: r, middlewareData: n } = o, i = ((m = n.arrow) == null ? void 0 : m.centerOffset) !== 0, h = i ? 0 : e.arrowWidth, l = i ? 0 : e.arrowHeight, [p, c] = ge(t), f = { start: "0%", center: "50%", end: "100%" }[c], g = (((w = n.arrow) == null ? void 0 : w.x) ?? 0) + h / 2, u = (((x = n.arrow) == null ? void 0 : x.y) ?? 0) + l / 2;
|
|
212
|
+
let v = "", y = "";
|
|
213
|
+
return p === "bottom" ? (v = i ? f : `${g}px`, y = `${-l}px`) : p === "top" ? (v = i ? f : `${g}px`, y = `${r.floating.height + l}px`) : p === "right" ? (v = `${-l}px`, y = i ? f : `${u}px`) : p === "left" && (v = `${r.floating.width + l}px`, y = i ? f : `${u}px`), { data: { x: v, y } };
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
function ge(e) {
|
|
217
|
-
const [
|
|
218
|
-
return [
|
|
217
|
+
const [o, t = "center"] = e.split("-");
|
|
218
|
+
return [o, t];
|
|
219
219
|
}
|
|
220
|
-
var ut = de, ft = ue, ht = fe, vt = ve, gt =
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
var ut = de, ft = ue, ht = fe, vt = ve, gt = Object.freeze({
|
|
221
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
222
|
+
position: "absolute",
|
|
223
|
+
border: 0,
|
|
224
|
+
width: 1,
|
|
225
|
+
height: 1,
|
|
226
|
+
padding: 0,
|
|
227
|
+
margin: -1,
|
|
228
|
+
overflow: "hidden",
|
|
229
|
+
clip: "rect(0, 0, 0, 0)",
|
|
230
|
+
whiteSpace: "nowrap",
|
|
231
|
+
wordWrap: "normal"
|
|
232
|
+
}), yt = "VisuallyHidden", ye = a.forwardRef(
|
|
233
|
+
(e, o) => /* @__PURE__ */ d(
|
|
234
|
+
N.span,
|
|
223
235
|
{
|
|
224
236
|
...e,
|
|
225
|
-
ref:
|
|
226
|
-
style: {
|
|
227
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
228
|
-
position: "absolute",
|
|
229
|
-
border: 0,
|
|
230
|
-
width: 1,
|
|
231
|
-
height: 1,
|
|
232
|
-
padding: 0,
|
|
233
|
-
margin: -1,
|
|
234
|
-
overflow: "hidden",
|
|
235
|
-
clip: "rect(0, 0, 0, 0)",
|
|
236
|
-
whiteSpace: "nowrap",
|
|
237
|
-
wordWrap: "normal",
|
|
238
|
-
...e.style
|
|
239
|
-
}
|
|
237
|
+
ref: o,
|
|
238
|
+
style: { ...gt, ...e.style }
|
|
240
239
|
}
|
|
241
240
|
)
|
|
242
241
|
);
|
|
243
|
-
|
|
244
|
-
var mt =
|
|
242
|
+
ye.displayName = yt;
|
|
243
|
+
var mt = ye, [M, Bt] = ae("Tooltip", [
|
|
245
244
|
le
|
|
246
|
-
]),
|
|
245
|
+
]), $ = le(), me = "TooltipProvider", wt = 700, F = "tooltip.open", [xt, X] = M(me), we = (e) => {
|
|
247
246
|
const {
|
|
248
|
-
__scopeTooltip:
|
|
249
|
-
delayDuration: t =
|
|
250
|
-
skipDelayDuration:
|
|
247
|
+
__scopeTooltip: o,
|
|
248
|
+
delayDuration: t = wt,
|
|
249
|
+
skipDelayDuration: r = 300,
|
|
251
250
|
disableHoverableContent: n = !1,
|
|
252
251
|
children: s
|
|
253
|
-
} = e,
|
|
252
|
+
} = e, i = a.useRef(!0), h = a.useRef(!1), l = a.useRef(0);
|
|
254
253
|
return a.useEffect(() => {
|
|
255
|
-
const
|
|
256
|
-
return () => window.clearTimeout(
|
|
254
|
+
const p = l.current;
|
|
255
|
+
return () => window.clearTimeout(p);
|
|
257
256
|
}, []), /* @__PURE__ */ d(
|
|
258
|
-
|
|
257
|
+
xt,
|
|
259
258
|
{
|
|
260
|
-
scope:
|
|
261
|
-
|
|
259
|
+
scope: o,
|
|
260
|
+
isOpenDelayedRef: i,
|
|
262
261
|
delayDuration: t,
|
|
263
262
|
onOpen: a.useCallback(() => {
|
|
264
|
-
window.clearTimeout(
|
|
263
|
+
window.clearTimeout(l.current), i.current = !1;
|
|
265
264
|
}, []),
|
|
266
265
|
onClose: a.useCallback(() => {
|
|
267
|
-
window.clearTimeout(
|
|
268
|
-
() =>
|
|
269
|
-
|
|
266
|
+
window.clearTimeout(l.current), l.current = window.setTimeout(
|
|
267
|
+
() => i.current = !0,
|
|
268
|
+
r
|
|
270
269
|
);
|
|
271
|
-
}, [
|
|
272
|
-
isPointerInTransitRef:
|
|
273
|
-
onPointerInTransitChange: a.useCallback((
|
|
274
|
-
|
|
270
|
+
}, [r]),
|
|
271
|
+
isPointerInTransitRef: h,
|
|
272
|
+
onPointerInTransitChange: a.useCallback((p) => {
|
|
273
|
+
h.current = p;
|
|
275
274
|
}, []),
|
|
276
275
|
disableHoverableContent: n,
|
|
277
276
|
children: s
|
|
278
277
|
}
|
|
279
278
|
);
|
|
280
279
|
};
|
|
281
|
-
we.displayName =
|
|
282
|
-
var
|
|
280
|
+
we.displayName = me;
|
|
281
|
+
var O = "Tooltip", [Ct, j] = M(O), xe = (e) => {
|
|
283
282
|
const {
|
|
284
|
-
__scopeTooltip:
|
|
283
|
+
__scopeTooltip: o,
|
|
285
284
|
children: t,
|
|
286
|
-
open:
|
|
287
|
-
defaultOpen: n
|
|
285
|
+
open: r,
|
|
286
|
+
defaultOpen: n,
|
|
288
287
|
onOpenChange: s,
|
|
289
288
|
disableHoverableContent: i,
|
|
290
289
|
delayDuration: h
|
|
291
|
-
} = e, l = X(
|
|
292
|
-
prop:
|
|
293
|
-
defaultProp: n,
|
|
294
|
-
onChange: (
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
290
|
+
} = e, l = X(O, e.__scopeTooltip), p = $(o), [c, f] = a.useState(null), g = Ue(), u = a.useRef(0), v = i ?? l.disableHoverableContent, y = h ?? l.delayDuration, m = a.useRef(!1), [w, x] = Be({
|
|
291
|
+
prop: r,
|
|
292
|
+
defaultProp: n ?? !1,
|
|
293
|
+
onChange: (S) => {
|
|
294
|
+
S ? (l.onOpen(), document.dispatchEvent(new CustomEvent(F))) : l.onClose(), s == null || s(S);
|
|
295
|
+
},
|
|
296
|
+
caller: O
|
|
297
|
+
}), T = a.useMemo(() => w ? m.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
|
|
298
|
+
window.clearTimeout(u.current), u.current = 0, m.current = !1, x(!0);
|
|
299
299
|
}, [x]), b = a.useCallback(() => {
|
|
300
300
|
window.clearTimeout(u.current), u.current = 0, x(!1);
|
|
301
301
|
}, [x]), P = a.useCallback(() => {
|
|
302
302
|
window.clearTimeout(u.current), u.current = window.setTimeout(() => {
|
|
303
|
-
|
|
304
|
-
},
|
|
305
|
-
}, [
|
|
303
|
+
m.current = !0, x(!0), u.current = 0;
|
|
304
|
+
}, y);
|
|
305
|
+
}, [y, x]);
|
|
306
306
|
return a.useEffect(() => () => {
|
|
307
307
|
u.current && (window.clearTimeout(u.current), u.current = 0);
|
|
308
308
|
}, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
|
|
309
|
-
|
|
309
|
+
Ct,
|
|
310
310
|
{
|
|
311
|
-
scope:
|
|
312
|
-
contentId:
|
|
311
|
+
scope: o,
|
|
312
|
+
contentId: g,
|
|
313
313
|
open: w,
|
|
314
314
|
stateAttribute: T,
|
|
315
315
|
trigger: c,
|
|
316
316
|
onTriggerChange: f,
|
|
317
317
|
onTriggerEnter: a.useCallback(() => {
|
|
318
|
-
l.
|
|
319
|
-
}, [l.
|
|
318
|
+
l.isOpenDelayedRef.current ? P() : C();
|
|
319
|
+
}, [l.isOpenDelayedRef, P, C]),
|
|
320
320
|
onTriggerLeave: a.useCallback(() => {
|
|
321
321
|
v ? b() : (window.clearTimeout(u.current), u.current = 0);
|
|
322
322
|
}, [b, v]),
|
|
@@ -327,25 +327,25 @@ var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
|
|
|
327
327
|
}
|
|
328
328
|
) });
|
|
329
329
|
};
|
|
330
|
-
xe.displayName =
|
|
331
|
-
var
|
|
332
|
-
(e,
|
|
333
|
-
const { __scopeTooltip: t, ...
|
|
330
|
+
xe.displayName = O;
|
|
331
|
+
var W = "TooltipTrigger", Ce = a.forwardRef(
|
|
332
|
+
(e, o) => {
|
|
333
|
+
const { __scopeTooltip: t, ...r } = e, n = j(W, t), s = X(W, t), i = $(t), h = a.useRef(null), l = k(o, h, n.onTriggerChange), p = a.useRef(!1), c = a.useRef(!1), f = a.useCallback(() => p.current = !1, []);
|
|
334
334
|
return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(ft, { asChild: !0, ...i, children: /* @__PURE__ */ d(
|
|
335
|
-
|
|
335
|
+
N.button,
|
|
336
336
|
{
|
|
337
337
|
"aria-describedby": n.open ? n.contentId : void 0,
|
|
338
338
|
"data-state": n.stateAttribute,
|
|
339
|
-
...
|
|
339
|
+
...r,
|
|
340
340
|
ref: l,
|
|
341
|
-
onPointerMove: E(e.onPointerMove, (
|
|
342
|
-
|
|
341
|
+
onPointerMove: E(e.onPointerMove, (g) => {
|
|
342
|
+
g.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
|
|
343
343
|
}),
|
|
344
344
|
onPointerLeave: E(e.onPointerLeave, () => {
|
|
345
345
|
n.onTriggerLeave(), c.current = !1;
|
|
346
346
|
}),
|
|
347
347
|
onPointerDown: E(e.onPointerDown, () => {
|
|
348
|
-
p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
|
|
348
|
+
n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
|
|
349
349
|
}),
|
|
350
350
|
onFocus: E(e.onFocus, () => {
|
|
351
351
|
p.current || n.onOpen();
|
|
@@ -356,60 +356,60 @@ var Y = "TooltipTrigger", Ce = a.forwardRef(
|
|
|
356
356
|
) });
|
|
357
357
|
}
|
|
358
358
|
);
|
|
359
|
-
Ce.displayName =
|
|
360
|
-
var
|
|
359
|
+
Ce.displayName = W;
|
|
360
|
+
var Pt = "TooltipPortal", [Gt, Tt] = M(Pt, {
|
|
361
361
|
forceMount: void 0
|
|
362
362
|
}), R = "TooltipContent", Pe = a.forwardRef(
|
|
363
|
-
(e,
|
|
364
|
-
const t =
|
|
365
|
-
return /* @__PURE__ */ d(
|
|
363
|
+
(e, o) => {
|
|
364
|
+
const t = Tt(R, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...s } = e, i = j(R, e.__scopeTooltip);
|
|
365
|
+
return /* @__PURE__ */ d(Ge, { present: r || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ d(Te, { side: n, ...s, ref: o }) : /* @__PURE__ */ d(bt, { side: n, ...s, ref: o }) });
|
|
366
366
|
}
|
|
367
|
-
),
|
|
368
|
-
const t =
|
|
367
|
+
), bt = a.forwardRef((e, o) => {
|
|
368
|
+
const t = j(R, e.__scopeTooltip), r = X(R, e.__scopeTooltip), n = a.useRef(null), s = k(o, n), [i, h] = a.useState(null), { trigger: l, onClose: p } = t, c = n.current, { onPointerInTransitChange: f } = r, g = a.useCallback(() => {
|
|
369
369
|
h(null), f(!1);
|
|
370
370
|
}, [f]), u = a.useCallback(
|
|
371
|
-
(v,
|
|
372
|
-
const
|
|
371
|
+
(v, y) => {
|
|
372
|
+
const m = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = _t(w, m.getBoundingClientRect()), T = Ot(w, x), C = Nt(y.getBoundingClientRect()), b = Dt([...T, ...C]);
|
|
373
373
|
h(b), f(!0);
|
|
374
374
|
},
|
|
375
375
|
[f]
|
|
376
376
|
);
|
|
377
|
-
return a.useEffect(() => () =>
|
|
377
|
+
return a.useEffect(() => () => g(), [g]), a.useEffect(() => {
|
|
378
378
|
if (l && c) {
|
|
379
|
-
const v = (
|
|
380
|
-
return l.addEventListener("pointerleave", v), c.addEventListener("pointerleave",
|
|
381
|
-
l.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave",
|
|
379
|
+
const v = (m) => u(m, c), y = (m) => u(m, l);
|
|
380
|
+
return l.addEventListener("pointerleave", v), c.addEventListener("pointerleave", y), () => {
|
|
381
|
+
l.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave", y);
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
}, [l, c, u,
|
|
384
|
+
}, [l, c, u, g]), a.useEffect(() => {
|
|
385
385
|
if (i) {
|
|
386
|
-
const v = (
|
|
387
|
-
const
|
|
388
|
-
x ?
|
|
386
|
+
const v = (y) => {
|
|
387
|
+
const m = y.target, w = { x: y.clientX, y: y.clientY }, x = (l == null ? void 0 : l.contains(m)) || (c == null ? void 0 : c.contains(m)), T = !St(w, i);
|
|
388
|
+
x ? g() : T && (g(), p());
|
|
389
389
|
};
|
|
390
390
|
return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
|
|
391
391
|
}
|
|
392
|
-
}, [l, c, i, p,
|
|
393
|
-
}), [
|
|
394
|
-
(e,
|
|
392
|
+
}, [l, c, i, p, g]), /* @__PURE__ */ d(Te, { ...e, ref: s });
|
|
393
|
+
}), [At, Et] = M(O, { isInside: !1 }), Rt = Xe("TooltipContent"), Te = a.forwardRef(
|
|
394
|
+
(e, o) => {
|
|
395
395
|
const {
|
|
396
396
|
__scopeTooltip: t,
|
|
397
|
-
children:
|
|
397
|
+
children: r,
|
|
398
398
|
"aria-label": n,
|
|
399
399
|
onEscapeKeyDown: s,
|
|
400
400
|
onPointerDownOutside: i,
|
|
401
401
|
...h
|
|
402
|
-
} = e, l =
|
|
403
|
-
return a.useEffect(() => (document.addEventListener(
|
|
402
|
+
} = e, l = j(R, t), p = $(t), { onClose: c } = l;
|
|
403
|
+
return a.useEffect(() => (document.addEventListener(F, c), () => document.removeEventListener(F, c)), [c]), a.useEffect(() => {
|
|
404
404
|
if (l.trigger) {
|
|
405
|
-
const f = (
|
|
406
|
-
const u =
|
|
405
|
+
const f = (g) => {
|
|
406
|
+
const u = g.target;
|
|
407
407
|
u != null && u.contains(l.trigger) && c();
|
|
408
408
|
};
|
|
409
409
|
return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
|
|
410
410
|
}
|
|
411
411
|
}, [l.trigger, c]), /* @__PURE__ */ d(
|
|
412
|
-
|
|
412
|
+
ze,
|
|
413
413
|
{
|
|
414
414
|
asChild: !0,
|
|
415
415
|
disableOutsidePointerEvents: !1,
|
|
@@ -417,13 +417,13 @@ var Ct = "TooltipPortal", [Yt, Pt] = L(Ct, {
|
|
|
417
417
|
onPointerDownOutside: i,
|
|
418
418
|
onFocusOutside: (f) => f.preventDefault(),
|
|
419
419
|
onDismiss: c,
|
|
420
|
-
children: /* @__PURE__ */
|
|
420
|
+
children: /* @__PURE__ */ Y(
|
|
421
421
|
ht,
|
|
422
422
|
{
|
|
423
423
|
"data-state": l.stateAttribute,
|
|
424
424
|
...p,
|
|
425
425
|
...h,
|
|
426
|
-
ref:
|
|
426
|
+
ref: o,
|
|
427
427
|
style: {
|
|
428
428
|
...h.style,
|
|
429
429
|
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
@@ -433,8 +433,8 @@ var Ct = "TooltipPortal", [Yt, Pt] = L(Ct, {
|
|
|
433
433
|
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
434
434
|
},
|
|
435
435
|
children: [
|
|
436
|
-
/* @__PURE__ */ d(
|
|
437
|
-
/* @__PURE__ */ d(
|
|
436
|
+
/* @__PURE__ */ d(Rt, { children: r }),
|
|
437
|
+
/* @__PURE__ */ d(At, { scope: t, isInside: !0, children: /* @__PURE__ */ d(mt, { id: l.contentId, role: "tooltip", children: n || r }) })
|
|
438
438
|
]
|
|
439
439
|
}
|
|
440
440
|
)
|
|
@@ -444,101 +444,101 @@ var Ct = "TooltipPortal", [Yt, Pt] = L(Ct, {
|
|
|
444
444
|
);
|
|
445
445
|
Pe.displayName = R;
|
|
446
446
|
var be = "TooltipArrow", Ae = a.forwardRef(
|
|
447
|
-
(e,
|
|
448
|
-
const { __scopeTooltip: t, ...
|
|
449
|
-
return
|
|
447
|
+
(e, o) => {
|
|
448
|
+
const { __scopeTooltip: t, ...r } = e, n = $(t);
|
|
449
|
+
return Et(
|
|
450
450
|
be,
|
|
451
451
|
t
|
|
452
|
-
).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...
|
|
452
|
+
).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...r, ref: o });
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
455
|
Ae.displayName = be;
|
|
456
|
-
function
|
|
457
|
-
const t = Math.abs(
|
|
458
|
-
switch (Math.min(t,
|
|
456
|
+
function _t(e, o) {
|
|
457
|
+
const t = Math.abs(o.top - e.y), r = Math.abs(o.bottom - e.y), n = Math.abs(o.right - e.x), s = Math.abs(o.left - e.x);
|
|
458
|
+
switch (Math.min(t, r, n, s)) {
|
|
459
459
|
case s:
|
|
460
460
|
return "left";
|
|
461
461
|
case n:
|
|
462
462
|
return "right";
|
|
463
463
|
case t:
|
|
464
464
|
return "top";
|
|
465
|
-
case
|
|
465
|
+
case r:
|
|
466
466
|
return "bottom";
|
|
467
467
|
default:
|
|
468
468
|
throw new Error("unreachable");
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const
|
|
473
|
-
switch (
|
|
471
|
+
function Ot(e, o, t = 5) {
|
|
472
|
+
const r = [];
|
|
473
|
+
switch (o) {
|
|
474
474
|
case "top":
|
|
475
|
-
|
|
475
|
+
r.push(
|
|
476
476
|
{ x: e.x - t, y: e.y + t },
|
|
477
477
|
{ x: e.x + t, y: e.y + t }
|
|
478
478
|
);
|
|
479
479
|
break;
|
|
480
480
|
case "bottom":
|
|
481
|
-
|
|
481
|
+
r.push(
|
|
482
482
|
{ x: e.x - t, y: e.y - t },
|
|
483
483
|
{ x: e.x + t, y: e.y - t }
|
|
484
484
|
);
|
|
485
485
|
break;
|
|
486
486
|
case "left":
|
|
487
|
-
|
|
487
|
+
r.push(
|
|
488
488
|
{ x: e.x + t, y: e.y - t },
|
|
489
489
|
{ x: e.x + t, y: e.y + t }
|
|
490
490
|
);
|
|
491
491
|
break;
|
|
492
492
|
case "right":
|
|
493
|
-
|
|
493
|
+
r.push(
|
|
494
494
|
{ x: e.x - t, y: e.y - t },
|
|
495
495
|
{ x: e.x - t, y: e.y + t }
|
|
496
496
|
);
|
|
497
497
|
break;
|
|
498
498
|
}
|
|
499
|
-
return
|
|
499
|
+
return r;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
const { top:
|
|
501
|
+
function Nt(e) {
|
|
502
|
+
const { top: o, right: t, bottom: r, left: n } = e;
|
|
503
503
|
return [
|
|
504
|
-
{ x: n, y:
|
|
505
|
-
{ x: t, y: r },
|
|
504
|
+
{ x: n, y: o },
|
|
506
505
|
{ x: t, y: o },
|
|
507
|
-
{ x:
|
|
506
|
+
{ x: t, y: r },
|
|
507
|
+
{ x: n, y: r }
|
|
508
508
|
];
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
const { x: t, y:
|
|
510
|
+
function St(e, o) {
|
|
511
|
+
const { x: t, y: r } = e;
|
|
512
512
|
let n = !1;
|
|
513
|
-
for (let s = 0, i =
|
|
514
|
-
const h =
|
|
515
|
-
|
|
513
|
+
for (let s = 0, i = o.length - 1; s < o.length; i = s++) {
|
|
514
|
+
const h = o[s], l = o[i], p = h.x, c = h.y, f = l.x, g = l.y;
|
|
515
|
+
c > r != g > r && t < (f - p) * (r - c) / (g - c) + p && (n = !n);
|
|
516
516
|
}
|
|
517
517
|
return n;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
const
|
|
521
|
-
return
|
|
519
|
+
function Dt(e) {
|
|
520
|
+
const o = e.slice();
|
|
521
|
+
return o.sort((t, r) => t.x < r.x ? -1 : t.x > r.x ? 1 : t.y < r.y ? -1 : t.y > r.y ? 1 : 0), Ht(o);
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function Ht(e) {
|
|
524
524
|
if (e.length <= 1)
|
|
525
525
|
return e.slice();
|
|
526
|
-
const
|
|
527
|
-
for (let
|
|
528
|
-
const n = e[
|
|
529
|
-
for (;
|
|
530
|
-
const s =
|
|
526
|
+
const o = [];
|
|
527
|
+
for (let r = 0; r < e.length; r++) {
|
|
528
|
+
const n = e[r];
|
|
529
|
+
for (; o.length >= 2; ) {
|
|
530
|
+
const s = o[o.length - 1], i = o[o.length - 2];
|
|
531
531
|
if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
|
|
532
|
-
|
|
532
|
+
o.pop();
|
|
533
533
|
else
|
|
534
534
|
break;
|
|
535
535
|
}
|
|
536
|
-
|
|
536
|
+
o.push(n);
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
o.pop();
|
|
539
539
|
const t = [];
|
|
540
|
-
for (let
|
|
541
|
-
const n = e[
|
|
540
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
541
|
+
const n = e[r];
|
|
542
542
|
for (; t.length >= 2; ) {
|
|
543
543
|
const s = t[t.length - 1], i = t[t.length - 2];
|
|
544
544
|
if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
|
|
@@ -548,22 +548,22 @@ function St(e) {
|
|
|
548
548
|
}
|
|
549
549
|
t.push(n);
|
|
550
550
|
}
|
|
551
|
-
return t.pop(),
|
|
551
|
+
return t.pop(), o.length === 1 && t.length === 1 && o[0].x === t[0].x && o[0].y === t[0].y ? o : o.concat(t);
|
|
552
552
|
}
|
|
553
|
-
const
|
|
554
|
-
tooltipContent:
|
|
555
|
-
tooltipArrow:
|
|
556
|
-
fadeIn:
|
|
557
|
-
},
|
|
558
|
-
({ children: e, content:
|
|
559
|
-
/* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style:
|
|
560
|
-
/* @__PURE__ */
|
|
553
|
+
const It = "_tooltipContent_12gjy_1", Lt = "_tooltipArrow_12gjy_8", kt = "_fadeIn_12gjy_1", ne = {
|
|
554
|
+
tooltipContent: It,
|
|
555
|
+
tooltipArrow: Lt,
|
|
556
|
+
fadeIn: kt
|
|
557
|
+
}, Mt = Fe(
|
|
558
|
+
({ children: e, content: o, className: t, style: r }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ Y(xe, { delayDuration: 1e3, children: [
|
|
559
|
+
/* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: r, children: e }) }),
|
|
560
|
+
/* @__PURE__ */ Y(Pe, { className: ne.tooltipContent, sideOffset: 5, children: [
|
|
561
561
|
/* @__PURE__ */ d(Ae, { className: ne.tooltipArrow }),
|
|
562
|
-
/* @__PURE__ */ d("span", { children:
|
|
562
|
+
/* @__PURE__ */ d("span", { children: o })
|
|
563
563
|
] })
|
|
564
564
|
] }) })
|
|
565
565
|
);
|
|
566
|
-
|
|
566
|
+
Mt.displayName = "RPTooltip";
|
|
567
567
|
export {
|
|
568
|
-
|
|
568
|
+
Mt as default
|
|
569
569
|
};
|