@pdf-viewer/react 1.9.0-beta.5 → 1.9.0-beta.7
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/SearchCloseButton-cbf182aa.js +33 -0
- package/dist/ToolbarLayout.module-201969d2.js +3453 -0
- package/dist/assets/ToolbarLayout.css +1 -1
- package/dist/components/RPController.js +36 -36
- package/dist/components/RPDropFileZone.js +23 -21
- package/dist/components/RPPages.js +17 -18
- package/dist/components/RPProvider.js +14 -15
- package/dist/components/layout/Container.js +11 -10
- package/dist/components/layout/LayoutContainer.js +15 -16
- package/dist/components/layout/RPDefaultLayout.js +14 -76
- package/dist/components/layout/RPLayout.js +22 -22
- package/dist/components/layout/WrapperLayout.js +8 -7
- package/dist/components/layout/sidebar/RPSidebar.js +12 -51
- package/dist/components/layout/sidebar/RPSplitter.js +9 -7
- package/dist/components/layout/sidebar/Thumbnail.js +48 -2
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +24 -305
- package/dist/components/layout/toolbar/FileDownloadTool.js +13 -23
- package/dist/components/layout/toolbar/MenuItem.js +7 -6
- package/dist/components/layout/toolbar/MenuSeparator.js +5 -4
- package/dist/components/layout/toolbar/MostPageTool.js +25 -50
- package/dist/components/layout/toolbar/OtherTool.js +22 -115
- package/dist/components/layout/toolbar/Paginate.js +17 -99
- package/dist/components/layout/toolbar/PrintTool.js +13 -43
- package/dist/components/layout/toolbar/PropertyItem.js +8 -5
- package/dist/components/layout/toolbar/RPToolbar.js +7 -28
- package/dist/components/layout/toolbar/RPToolbarEnd.js +7 -22
- package/dist/components/layout/toolbar/RotateTool.js +21 -20
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchCloseButton.js +7 -19
- package/dist/components/layout/toolbar/SearchResultNavigator.js +8 -42
- package/dist/components/layout/toolbar/SearchTool.js +30 -197
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ThumbnailTool.js +4 -4
- package/dist/components/layout/toolbar/ToolbarCustom.js +22 -24
- package/dist/components/layout/toolbar/ToolbarDefault.js +20 -25
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +28 -140
- 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 +17 -18
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +11 -11
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +20 -26
- package/dist/components/page/AnnotationLayer.js +16 -17
- package/dist/components/page/CanvasLayer.js +16 -18
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +16 -17
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +16 -17
- package/dist/components/page/TextLayer.js +16 -17
- package/dist/components/ui/Checkbox.js +51 -49
- package/dist/components/ui/DropDown.js +19 -13
- package/dist/components/ui/LoadingIndicator.js +5 -22
- package/dist/components/ui/RPTooltip.js +192 -405
- package/dist/contexts/ElementPageContext.js +37 -37
- package/dist/contexts/FileInputContext.js +18 -20
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +2 -2
- package/dist/contexts/RenderQueueProvider.js +10 -0
- package/dist/contexts/SearchContext.js +3 -3
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/index-18b0454c.js +1657 -0
- package/dist/{index-8547fbc6.js → index-5908484b.js} +9 -9
- package/dist/index-f4a9ae4d.js +1664 -0
- package/dist/main.js +48 -50
- package/dist/types/components/layout/RPDefaultLayout.d.ts +1 -2
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +0 -1
- package/dist/types/components/layout/toolbar/RPToolbar.d.ts +3 -2
- package/dist/types/contexts/RenderQueueProvider.d.ts +16 -0
- package/dist/types/utils/Queue.d.ts +18 -0
- package/dist/types/utils/renderPage.d.ts +1 -6
- package/dist/types/utils/types.d.ts +5 -0
- package/dist/utils/Queue.js +47 -0
- package/dist/utils/hooks/useFileDownload.js +16 -17
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePageRotateContext.js +14 -14
- package/dist/utils/hooks/usePaginate.js +16 -17
- package/dist/utils/hooks/usePresentPage.js +16 -17
- package/dist/utils/hooks/usePrint.js +16 -17
- package/dist/utils/hooks/useScrollToPage.js +16 -17
- package/dist/utils/hooks/useSearch.js +16 -17
- package/dist/utils/hooks/useThumbnail.js +16 -18
- package/dist/utils/hooks/useVirtualReactWindow.js +16 -17
- package/package.json +1 -1
- package/dist/Checkbox.module-3edaacbb.js +0 -7
- package/dist/Combination-da8647d4.js +0 -693
- package/dist/Container.module-f8b5c306.js +0 -6
- package/dist/DropDown.module-a78567cb.js +0 -11
- package/dist/MenuItem.module-bc11d0d3.js +0 -6
- package/dist/MenuSeparator.module-89b2ff7f.js +0 -6
- package/dist/PropertyItem.module-db0150cc.js +0 -8
- package/dist/RPSplitter.module-13d612c4.js +0 -7
- package/dist/RPTheme.module-bd9038da.js +0 -8
- package/dist/RotateTool.module-03987eba.js +0 -6
- package/dist/SearchTool.module-016f3a8d.js +0 -16
- package/dist/ToolbarLayout.module-60c3d6e8.js +0 -2434
- package/dist/WrapperLayout.module-147bc943.js +0 -6
- package/dist/floating-ui.react-dom-f3f380e0.js +0 -1447
- package/dist/index-473557b1.js +0 -1191
- /package/dist/assets/{RPTheme.css → RPDropFileZone.css} +0 -0
- /package/dist/assets/{SearchTool.css → SearchCloseButton.css} +0 -0
|
@@ -1,227 +1,14 @@
|
|
|
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
|
-
|
|
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, D = {
|
|
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: S, 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
|
-
...D
|
|
76
|
-
}),
|
|
77
|
-
l && Ze({ ...D }),
|
|
78
|
-
Ke({
|
|
79
|
-
...D,
|
|
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", ...D })
|
|
88
|
-
]
|
|
89
|
-
}), [z, De] = ge(Ne), H = Ye(v);
|
|
90
|
-
oe(() => {
|
|
91
|
-
S && (H == null || H());
|
|
92
|
-
}, [S, H]);
|
|
93
|
-
const Se = (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: S ? 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: Se,
|
|
127
|
-
arrowY: He,
|
|
128
|
-
shouldHideArrow: Ie,
|
|
129
|
-
children: /* @__PURE__ */ d(
|
|
130
|
-
O.div,
|
|
131
|
-
{
|
|
132
|
-
"data-side": z,
|
|
133
|
-
"data-align": De,
|
|
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: S ? 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,
|
|
1
|
+
import { jsx as d, jsxs as O } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { P as S, c as z, a as J, u as j, b as g, d as Q, S as Z } from "../../index-5908484b.js";
|
|
4
|
+
import { c as G, u as $, R as ee, A as te, D as oe, C as re, a as ne } from "../../index-18b0454c.js";
|
|
5
|
+
import { withRef as se } from "../../utils/withRef.js";
|
|
6
|
+
import '../../assets/RPTooltip.css';var ae = "VisuallyHidden", F = s.forwardRef(
|
|
7
|
+
(e, o) => /* @__PURE__ */ d(
|
|
8
|
+
S.span,
|
|
222
9
|
{
|
|
223
10
|
...e,
|
|
224
|
-
ref:
|
|
11
|
+
ref: o,
|
|
225
12
|
style: {
|
|
226
13
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
227
14
|
position: "absolute",
|
|
@@ -239,192 +26,192 @@ var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", ye = a.forwardRef
|
|
|
239
26
|
}
|
|
240
27
|
)
|
|
241
28
|
);
|
|
242
|
-
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
]),
|
|
29
|
+
F.displayName = ae;
|
|
30
|
+
var ie = F, [R, De] = z("Tooltip", [
|
|
31
|
+
G
|
|
32
|
+
]), _ = G(), V = "TooltipProvider", le = 700, L = "tooltip.open", [ce, I] = R(V), B = (e) => {
|
|
246
33
|
const {
|
|
247
|
-
__scopeTooltip:
|
|
248
|
-
delayDuration: t =
|
|
249
|
-
skipDelayDuration:
|
|
34
|
+
__scopeTooltip: o,
|
|
35
|
+
delayDuration: t = le,
|
|
36
|
+
skipDelayDuration: r = 300,
|
|
250
37
|
disableHoverableContent: n = !1,
|
|
251
|
-
children:
|
|
252
|
-
} = e, [
|
|
253
|
-
return
|
|
254
|
-
const
|
|
255
|
-
return () => window.clearTimeout(
|
|
38
|
+
children: i
|
|
39
|
+
} = e, [c, v] = s.useState(!0), a = s.useRef(!1), p = s.useRef(0);
|
|
40
|
+
return s.useEffect(() => {
|
|
41
|
+
const l = p.current;
|
|
42
|
+
return () => window.clearTimeout(l);
|
|
256
43
|
}, []), /* @__PURE__ */ d(
|
|
257
|
-
|
|
44
|
+
ce,
|
|
258
45
|
{
|
|
259
|
-
scope:
|
|
260
|
-
isOpenDelayed:
|
|
46
|
+
scope: o,
|
|
47
|
+
isOpenDelayed: c,
|
|
261
48
|
delayDuration: t,
|
|
262
|
-
onOpen:
|
|
263
|
-
window.clearTimeout(p.current),
|
|
49
|
+
onOpen: s.useCallback(() => {
|
|
50
|
+
window.clearTimeout(p.current), v(!1);
|
|
264
51
|
}, []),
|
|
265
|
-
onClose:
|
|
52
|
+
onClose: s.useCallback(() => {
|
|
266
53
|
window.clearTimeout(p.current), p.current = window.setTimeout(
|
|
267
|
-
() =>
|
|
268
|
-
|
|
54
|
+
() => v(!0),
|
|
55
|
+
r
|
|
269
56
|
);
|
|
270
|
-
}, [
|
|
271
|
-
isPointerInTransitRef:
|
|
272
|
-
onPointerInTransitChange:
|
|
273
|
-
|
|
57
|
+
}, [r]),
|
|
58
|
+
isPointerInTransitRef: a,
|
|
59
|
+
onPointerInTransitChange: s.useCallback((l) => {
|
|
60
|
+
a.current = l;
|
|
274
61
|
}, []),
|
|
275
62
|
disableHoverableContent: n,
|
|
276
|
-
children:
|
|
63
|
+
children: i
|
|
277
64
|
}
|
|
278
65
|
);
|
|
279
66
|
};
|
|
280
|
-
|
|
281
|
-
var
|
|
67
|
+
B.displayName = V;
|
|
68
|
+
var A = "Tooltip", [ue, D] = R(A), U = (e) => {
|
|
282
69
|
const {
|
|
283
|
-
__scopeTooltip:
|
|
70
|
+
__scopeTooltip: o,
|
|
284
71
|
children: t,
|
|
285
|
-
open:
|
|
72
|
+
open: r,
|
|
286
73
|
defaultOpen: n = !1,
|
|
287
|
-
onOpenChange:
|
|
288
|
-
disableHoverableContent:
|
|
289
|
-
delayDuration:
|
|
290
|
-
} = e,
|
|
291
|
-
prop:
|
|
74
|
+
onOpenChange: i,
|
|
75
|
+
disableHoverableContent: c,
|
|
76
|
+
delayDuration: v
|
|
77
|
+
} = e, a = I(A, e.__scopeTooltip), p = _(o), [l, f] = s.useState(null), y = $(), u = s.useRef(0), h = c ?? a.disableHoverableContent, C = v ?? a.delayDuration, T = s.useRef(!1), [x = !1, m] = J({
|
|
78
|
+
prop: r,
|
|
292
79
|
defaultProp: n,
|
|
293
80
|
onChange: (N) => {
|
|
294
|
-
N ? (
|
|
81
|
+
N ? (a.onOpen(), document.dispatchEvent(new CustomEvent(L))) : a.onClose(), i == null || i(N);
|
|
295
82
|
}
|
|
296
|
-
}),
|
|
297
|
-
window.clearTimeout(u.current), u.current = 0,
|
|
298
|
-
}, [
|
|
299
|
-
window.clearTimeout(u.current), u.current = 0,
|
|
300
|
-
}, [
|
|
83
|
+
}), b = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), E = s.useCallback(() => {
|
|
84
|
+
window.clearTimeout(u.current), u.current = 0, T.current = !1, m(!0);
|
|
85
|
+
}, [m]), P = s.useCallback(() => {
|
|
86
|
+
window.clearTimeout(u.current), u.current = 0, m(!1);
|
|
87
|
+
}, [m]), M = s.useCallback(() => {
|
|
301
88
|
window.clearTimeout(u.current), u.current = window.setTimeout(() => {
|
|
302
|
-
|
|
303
|
-
},
|
|
304
|
-
}, [
|
|
305
|
-
return
|
|
89
|
+
T.current = !0, m(!0), u.current = 0;
|
|
90
|
+
}, C);
|
|
91
|
+
}, [C, m]);
|
|
92
|
+
return s.useEffect(() => () => {
|
|
306
93
|
u.current && (window.clearTimeout(u.current), u.current = 0);
|
|
307
|
-
}, []), /* @__PURE__ */ d(
|
|
308
|
-
|
|
94
|
+
}, []), /* @__PURE__ */ d(ee, { ...p, children: /* @__PURE__ */ d(
|
|
95
|
+
ue,
|
|
309
96
|
{
|
|
310
|
-
scope:
|
|
97
|
+
scope: o,
|
|
311
98
|
contentId: y,
|
|
312
|
-
open:
|
|
313
|
-
stateAttribute:
|
|
314
|
-
trigger:
|
|
99
|
+
open: x,
|
|
100
|
+
stateAttribute: b,
|
|
101
|
+
trigger: l,
|
|
315
102
|
onTriggerChange: f,
|
|
316
|
-
onTriggerEnter:
|
|
317
|
-
|
|
318
|
-
}, [
|
|
319
|
-
onTriggerLeave:
|
|
320
|
-
|
|
321
|
-
}, [
|
|
322
|
-
onOpen:
|
|
323
|
-
onClose:
|
|
324
|
-
disableHoverableContent:
|
|
103
|
+
onTriggerEnter: s.useCallback(() => {
|
|
104
|
+
a.isOpenDelayed ? M() : E();
|
|
105
|
+
}, [a.isOpenDelayed, M, E]),
|
|
106
|
+
onTriggerLeave: s.useCallback(() => {
|
|
107
|
+
h ? P() : (window.clearTimeout(u.current), u.current = 0);
|
|
108
|
+
}, [P, h]),
|
|
109
|
+
onOpen: E,
|
|
110
|
+
onClose: P,
|
|
111
|
+
disableHoverableContent: h,
|
|
325
112
|
children: t
|
|
326
113
|
}
|
|
327
114
|
) });
|
|
328
115
|
};
|
|
329
|
-
|
|
330
|
-
var
|
|
331
|
-
(e,
|
|
332
|
-
const { __scopeTooltip: t, ...
|
|
333
|
-
return
|
|
334
|
-
|
|
116
|
+
U.displayName = A;
|
|
117
|
+
var k = "TooltipTrigger", Y = s.forwardRef(
|
|
118
|
+
(e, o) => {
|
|
119
|
+
const { __scopeTooltip: t, ...r } = e, n = D(k, t), i = I(k, t), c = _(t), v = s.useRef(null), a = j(o, v, n.onTriggerChange), p = s.useRef(!1), l = s.useRef(!1), f = s.useCallback(() => p.current = !1, []);
|
|
120
|
+
return s.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(te, { asChild: !0, ...c, children: /* @__PURE__ */ d(
|
|
121
|
+
S.button,
|
|
335
122
|
{
|
|
336
123
|
"aria-describedby": n.open ? n.contentId : void 0,
|
|
337
124
|
"data-state": n.stateAttribute,
|
|
338
|
-
...
|
|
339
|
-
ref:
|
|
340
|
-
onPointerMove:
|
|
341
|
-
y.pointerType !== "touch" && !
|
|
125
|
+
...r,
|
|
126
|
+
ref: a,
|
|
127
|
+
onPointerMove: g(e.onPointerMove, (y) => {
|
|
128
|
+
y.pointerType !== "touch" && !l.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), l.current = !0);
|
|
342
129
|
}),
|
|
343
|
-
onPointerLeave:
|
|
344
|
-
n.onTriggerLeave(),
|
|
130
|
+
onPointerLeave: g(e.onPointerLeave, () => {
|
|
131
|
+
n.onTriggerLeave(), l.current = !1;
|
|
345
132
|
}),
|
|
346
|
-
onPointerDown:
|
|
133
|
+
onPointerDown: g(e.onPointerDown, () => {
|
|
347
134
|
p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
|
|
348
135
|
}),
|
|
349
|
-
onFocus:
|
|
136
|
+
onFocus: g(e.onFocus, () => {
|
|
350
137
|
p.current || n.onOpen();
|
|
351
138
|
}),
|
|
352
|
-
onBlur:
|
|
353
|
-
onClick:
|
|
139
|
+
onBlur: g(e.onBlur, n.onClose),
|
|
140
|
+
onClick: g(e.onClick, n.onClose)
|
|
354
141
|
}
|
|
355
142
|
) });
|
|
356
143
|
}
|
|
357
144
|
);
|
|
358
|
-
|
|
359
|
-
var
|
|
145
|
+
Y.displayName = k;
|
|
146
|
+
var de = "TooltipPortal", [Oe, pe] = R(de, {
|
|
360
147
|
forceMount: void 0
|
|
361
|
-
}),
|
|
362
|
-
(e,
|
|
363
|
-
const t =
|
|
364
|
-
return /* @__PURE__ */ d(
|
|
148
|
+
}), w = "TooltipContent", q = s.forwardRef(
|
|
149
|
+
(e, o) => {
|
|
150
|
+
const t = pe(w, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...i } = e, c = D(w, e.__scopeTooltip);
|
|
151
|
+
return /* @__PURE__ */ d(Q, { present: r || c.open, children: c.disableHoverableContent ? /* @__PURE__ */ d(W, { side: n, ...i, ref: o }) : /* @__PURE__ */ d(fe, { side: n, ...i, ref: o }) });
|
|
365
152
|
}
|
|
366
|
-
),
|
|
367
|
-
const t =
|
|
368
|
-
|
|
369
|
-
}, [f]), u =
|
|
370
|
-
(
|
|
371
|
-
const
|
|
372
|
-
|
|
153
|
+
), fe = s.forwardRef((e, o) => {
|
|
154
|
+
const t = D(w, e.__scopeTooltip), r = I(w, e.__scopeTooltip), n = s.useRef(null), i = j(o, n), [c, v] = s.useState(null), { trigger: a, onClose: p } = t, l = n.current, { onPointerInTransitChange: f } = r, y = s.useCallback(() => {
|
|
155
|
+
v(null), f(!1);
|
|
156
|
+
}, [f]), u = s.useCallback(
|
|
157
|
+
(h, C) => {
|
|
158
|
+
const T = h.currentTarget, x = { x: h.clientX, y: h.clientY }, m = ye(x, T.getBoundingClientRect()), b = Te(x, m), E = Ce(C.getBoundingClientRect()), P = xe([...b, ...E]);
|
|
159
|
+
v(P), f(!0);
|
|
373
160
|
},
|
|
374
161
|
[f]
|
|
375
162
|
);
|
|
376
|
-
return
|
|
377
|
-
if (
|
|
378
|
-
const
|
|
379
|
-
return
|
|
380
|
-
|
|
163
|
+
return s.useEffect(() => () => y(), [y]), s.useEffect(() => {
|
|
164
|
+
if (a && l) {
|
|
165
|
+
const h = (T) => u(T, l), C = (T) => u(T, a);
|
|
166
|
+
return a.addEventListener("pointerleave", h), l.addEventListener("pointerleave", C), () => {
|
|
167
|
+
a.removeEventListener("pointerleave", h), l.removeEventListener("pointerleave", C);
|
|
381
168
|
};
|
|
382
169
|
}
|
|
383
|
-
}, [
|
|
384
|
-
if (
|
|
385
|
-
const
|
|
386
|
-
const
|
|
387
|
-
|
|
170
|
+
}, [a, l, u, y]), s.useEffect(() => {
|
|
171
|
+
if (c) {
|
|
172
|
+
const h = (C) => {
|
|
173
|
+
const T = C.target, x = { x: C.clientX, y: C.clientY }, m = (a == null ? void 0 : a.contains(T)) || (l == null ? void 0 : l.contains(T)), b = !me(x, c);
|
|
174
|
+
m ? y() : b && (y(), p());
|
|
388
175
|
};
|
|
389
|
-
return document.addEventListener("pointermove",
|
|
176
|
+
return document.addEventListener("pointermove", h), () => document.removeEventListener("pointermove", h);
|
|
390
177
|
}
|
|
391
|
-
}, [l, c,
|
|
392
|
-
}), [
|
|
393
|
-
(e,
|
|
178
|
+
}, [a, l, c, p, y]), /* @__PURE__ */ d(W, { ...e, ref: i });
|
|
179
|
+
}), [ve, he] = R(A, { isInside: !1 }), W = s.forwardRef(
|
|
180
|
+
(e, o) => {
|
|
394
181
|
const {
|
|
395
182
|
__scopeTooltip: t,
|
|
396
|
-
children:
|
|
183
|
+
children: r,
|
|
397
184
|
"aria-label": n,
|
|
398
|
-
onEscapeKeyDown:
|
|
399
|
-
onPointerDownOutside:
|
|
400
|
-
...
|
|
401
|
-
} = e,
|
|
402
|
-
return
|
|
403
|
-
if (
|
|
185
|
+
onEscapeKeyDown: i,
|
|
186
|
+
onPointerDownOutside: c,
|
|
187
|
+
...v
|
|
188
|
+
} = e, a = D(w, t), p = _(t), { onClose: l } = a;
|
|
189
|
+
return s.useEffect(() => (document.addEventListener(L, l), () => document.removeEventListener(L, l)), [l]), s.useEffect(() => {
|
|
190
|
+
if (a.trigger) {
|
|
404
191
|
const f = (y) => {
|
|
405
192
|
const u = y.target;
|
|
406
|
-
u != null && u.contains(
|
|
193
|
+
u != null && u.contains(a.trigger) && l();
|
|
407
194
|
};
|
|
408
195
|
return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
|
|
409
196
|
}
|
|
410
|
-
}, [
|
|
411
|
-
|
|
197
|
+
}, [a.trigger, l]), /* @__PURE__ */ d(
|
|
198
|
+
oe,
|
|
412
199
|
{
|
|
413
200
|
asChild: !0,
|
|
414
201
|
disableOutsidePointerEvents: !1,
|
|
415
|
-
onEscapeKeyDown:
|
|
416
|
-
onPointerDownOutside:
|
|
202
|
+
onEscapeKeyDown: i,
|
|
203
|
+
onPointerDownOutside: c,
|
|
417
204
|
onFocusOutside: (f) => f.preventDefault(),
|
|
418
|
-
onDismiss:
|
|
419
|
-
children: /* @__PURE__ */
|
|
420
|
-
|
|
205
|
+
onDismiss: l,
|
|
206
|
+
children: /* @__PURE__ */ O(
|
|
207
|
+
re,
|
|
421
208
|
{
|
|
422
|
-
"data-state":
|
|
209
|
+
"data-state": a.stateAttribute,
|
|
423
210
|
...p,
|
|
424
|
-
...
|
|
425
|
-
ref:
|
|
211
|
+
...v,
|
|
212
|
+
ref: o,
|
|
426
213
|
style: {
|
|
427
|
-
...
|
|
214
|
+
...v.style,
|
|
428
215
|
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
429
216
|
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
430
217
|
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
@@ -432,8 +219,8 @@ var Ct = "TooltipPortal", [jt, Pt] = L(Ct, {
|
|
|
432
219
|
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
433
220
|
},
|
|
434
221
|
children: [
|
|
435
|
-
/* @__PURE__ */ d(
|
|
436
|
-
/* @__PURE__ */ d(
|
|
222
|
+
/* @__PURE__ */ d(Z, { children: r }),
|
|
223
|
+
/* @__PURE__ */ d(ve, { scope: t, isInside: !0, children: /* @__PURE__ */ d(ie, { id: a.contentId, role: "tooltip", children: n || r }) })
|
|
437
224
|
]
|
|
438
225
|
}
|
|
439
226
|
)
|
|
@@ -441,127 +228,127 @@ var Ct = "TooltipPortal", [jt, Pt] = L(Ct, {
|
|
|
441
228
|
);
|
|
442
229
|
}
|
|
443
230
|
);
|
|
444
|
-
|
|
445
|
-
var
|
|
446
|
-
(e,
|
|
447
|
-
const { __scopeTooltip: t, ...
|
|
448
|
-
return
|
|
449
|
-
|
|
231
|
+
q.displayName = w;
|
|
232
|
+
var X = "TooltipArrow", K = s.forwardRef(
|
|
233
|
+
(e, o) => {
|
|
234
|
+
const { __scopeTooltip: t, ...r } = e, n = _(t);
|
|
235
|
+
return he(
|
|
236
|
+
X,
|
|
450
237
|
t
|
|
451
|
-
).isInside ? null : /* @__PURE__ */ d(
|
|
238
|
+
).isInside ? null : /* @__PURE__ */ d(ne, { ...n, ...r, ref: o });
|
|
452
239
|
}
|
|
453
240
|
);
|
|
454
|
-
|
|
455
|
-
function
|
|
456
|
-
const t = Math.abs(
|
|
457
|
-
switch (Math.min(t,
|
|
458
|
-
case
|
|
241
|
+
K.displayName = X;
|
|
242
|
+
function ye(e, o) {
|
|
243
|
+
const t = Math.abs(o.top - e.y), r = Math.abs(o.bottom - e.y), n = Math.abs(o.right - e.x), i = Math.abs(o.left - e.x);
|
|
244
|
+
switch (Math.min(t, r, n, i)) {
|
|
245
|
+
case i:
|
|
459
246
|
return "left";
|
|
460
247
|
case n:
|
|
461
248
|
return "right";
|
|
462
249
|
case t:
|
|
463
250
|
return "top";
|
|
464
|
-
case
|
|
251
|
+
case r:
|
|
465
252
|
return "bottom";
|
|
466
253
|
default:
|
|
467
254
|
throw new Error("unreachable");
|
|
468
255
|
}
|
|
469
256
|
}
|
|
470
|
-
function
|
|
471
|
-
const
|
|
472
|
-
switch (
|
|
257
|
+
function Te(e, o, t = 5) {
|
|
258
|
+
const r = [];
|
|
259
|
+
switch (o) {
|
|
473
260
|
case "top":
|
|
474
|
-
|
|
261
|
+
r.push(
|
|
475
262
|
{ x: e.x - t, y: e.y + t },
|
|
476
263
|
{ x: e.x + t, y: e.y + t }
|
|
477
264
|
);
|
|
478
265
|
break;
|
|
479
266
|
case "bottom":
|
|
480
|
-
|
|
267
|
+
r.push(
|
|
481
268
|
{ x: e.x - t, y: e.y - t },
|
|
482
269
|
{ x: e.x + t, y: e.y - t }
|
|
483
270
|
);
|
|
484
271
|
break;
|
|
485
272
|
case "left":
|
|
486
|
-
|
|
273
|
+
r.push(
|
|
487
274
|
{ x: e.x + t, y: e.y - t },
|
|
488
275
|
{ x: e.x + t, y: e.y + t }
|
|
489
276
|
);
|
|
490
277
|
break;
|
|
491
278
|
case "right":
|
|
492
|
-
|
|
279
|
+
r.push(
|
|
493
280
|
{ x: e.x - t, y: e.y - t },
|
|
494
281
|
{ x: e.x - t, y: e.y + t }
|
|
495
282
|
);
|
|
496
283
|
break;
|
|
497
284
|
}
|
|
498
|
-
return
|
|
285
|
+
return r;
|
|
499
286
|
}
|
|
500
|
-
function
|
|
501
|
-
const { top:
|
|
287
|
+
function Ce(e) {
|
|
288
|
+
const { top: o, right: t, bottom: r, left: n } = e;
|
|
502
289
|
return [
|
|
503
|
-
{ x: n, y:
|
|
504
|
-
{ x: t, y: r },
|
|
290
|
+
{ x: n, y: o },
|
|
505
291
|
{ x: t, y: o },
|
|
506
|
-
{ x:
|
|
292
|
+
{ x: t, y: r },
|
|
293
|
+
{ x: n, y: r }
|
|
507
294
|
];
|
|
508
295
|
}
|
|
509
|
-
function
|
|
510
|
-
const { x: t, y:
|
|
296
|
+
function me(e, o) {
|
|
297
|
+
const { x: t, y: r } = e;
|
|
511
298
|
let n = !1;
|
|
512
|
-
for (let
|
|
513
|
-
const
|
|
514
|
-
|
|
299
|
+
for (let i = 0, c = o.length - 1; i < o.length; c = i++) {
|
|
300
|
+
const v = o[i].x, a = o[i].y, p = o[c].x, l = o[c].y;
|
|
301
|
+
a > r != l > r && t < (p - v) * (r - a) / (l - a) + v && (n = !n);
|
|
515
302
|
}
|
|
516
303
|
return n;
|
|
517
304
|
}
|
|
518
|
-
function
|
|
519
|
-
const
|
|
520
|
-
return
|
|
305
|
+
function xe(e) {
|
|
306
|
+
const o = e.slice();
|
|
307
|
+
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), ge(o);
|
|
521
308
|
}
|
|
522
|
-
function
|
|
309
|
+
function ge(e) {
|
|
523
310
|
if (e.length <= 1)
|
|
524
311
|
return e.slice();
|
|
525
|
-
const
|
|
526
|
-
for (let
|
|
527
|
-
const n = e[
|
|
528
|
-
for (;
|
|
529
|
-
const
|
|
530
|
-
if ((
|
|
531
|
-
|
|
312
|
+
const o = [];
|
|
313
|
+
for (let r = 0; r < e.length; r++) {
|
|
314
|
+
const n = e[r];
|
|
315
|
+
for (; o.length >= 2; ) {
|
|
316
|
+
const i = o[o.length - 1], c = o[o.length - 2];
|
|
317
|
+
if ((i.x - c.x) * (n.y - c.y) >= (i.y - c.y) * (n.x - c.x))
|
|
318
|
+
o.pop();
|
|
532
319
|
else
|
|
533
320
|
break;
|
|
534
321
|
}
|
|
535
|
-
|
|
322
|
+
o.push(n);
|
|
536
323
|
}
|
|
537
|
-
|
|
324
|
+
o.pop();
|
|
538
325
|
const t = [];
|
|
539
|
-
for (let
|
|
540
|
-
const n = e[
|
|
326
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
327
|
+
const n = e[r];
|
|
541
328
|
for (; t.length >= 2; ) {
|
|
542
|
-
const
|
|
543
|
-
if ((
|
|
329
|
+
const i = t[t.length - 1], c = t[t.length - 2];
|
|
330
|
+
if ((i.x - c.x) * (n.y - c.y) >= (i.y - c.y) * (n.x - c.x))
|
|
544
331
|
t.pop();
|
|
545
332
|
else
|
|
546
333
|
break;
|
|
547
334
|
}
|
|
548
335
|
t.push(n);
|
|
549
336
|
}
|
|
550
|
-
return t.pop(),
|
|
337
|
+
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);
|
|
551
338
|
}
|
|
552
|
-
const
|
|
553
|
-
tooltipContent:
|
|
554
|
-
tooltipArrow:
|
|
555
|
-
fadeIn:
|
|
556
|
-
},
|
|
557
|
-
({ children: e, content:
|
|
558
|
-
/* @__PURE__ */ d(
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */ d(
|
|
561
|
-
/* @__PURE__ */ d("span", { children:
|
|
339
|
+
const we = "_tooltipContent_12gjy_1", be = "_tooltipArrow_12gjy_8", Ee = "_fadeIn_12gjy_1", H = {
|
|
340
|
+
tooltipContent: we,
|
|
341
|
+
tooltipArrow: be,
|
|
342
|
+
fadeIn: Ee
|
|
343
|
+
}, Le = se(
|
|
344
|
+
({ children: e, content: o, className: t, style: r }, n) => /* @__PURE__ */ d(B, { children: /* @__PURE__ */ O(U, { delayDuration: 1e3, children: [
|
|
345
|
+
/* @__PURE__ */ d(Y, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: r, children: e }) }),
|
|
346
|
+
/* @__PURE__ */ O(q, { className: H.tooltipContent, sideOffset: 5, children: [
|
|
347
|
+
/* @__PURE__ */ d(K, { className: H.tooltipArrow }),
|
|
348
|
+
/* @__PURE__ */ d("span", { children: o })
|
|
562
349
|
] })
|
|
563
350
|
] }) })
|
|
564
351
|
);
|
|
565
352
|
export {
|
|
566
|
-
|
|
353
|
+
Le as default
|
|
567
354
|
};
|