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