@pdf-viewer/react 1.9.0-beta.1 → 1.9.0-beta.3
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-48c8394c.js → Popover-1faa77f6.js} +2 -2
- package/dist/RPLayout-897cb09d.js +3393 -0
- package/dist/assets/RPLayout.css +1 -1
- package/dist/{component-2aa6e53b.js → component-1da194e8.js} +1 -1
- package/dist/components/RPConfig.js +673 -691
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPDropFileZone.js +27 -26
- package/dist/components/RPPages.js +9 -3
- package/dist/components/layout/LayoutContainer.js +9 -3
- package/dist/components/layout/RPDefaultLayout.js +1 -1
- package/dist/components/layout/RPLayout.js +9 -4
- package/dist/components/layout/WrapperLayout.js +8 -7
- package/dist/components/layout/sidebar/RPSidebar.js +3 -2
- 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 +20 -18
- package/dist/components/layout/toolbar/DocumentDialog.js +7 -4
- package/dist/components/layout/toolbar/DocumentProperties.js +19 -17
- package/dist/components/layout/toolbar/FileDownloadTool.js +4 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +21 -19
- package/dist/components/layout/toolbar/FullScreenTool.js +45 -36
- 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 +10 -4
- package/dist/components/layout/toolbar/OtherTool.js +4 -3
- package/dist/components/layout/toolbar/Paginate.js +4 -2
- package/dist/components/layout/toolbar/PrintTool.js +4 -2
- package/dist/components/layout/toolbar/RPToolbar.js +3 -2
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +27 -25
- package/dist/components/layout/toolbar/ScrollModeTool.js +43 -41
- package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +10 -4
- package/dist/components/layout/toolbar/SelectionModeTool.js +32 -30
- package/dist/components/layout/toolbar/ThumbnailTool.js +17 -0
- package/dist/components/layout/toolbar/ToolbarCustom.js +9 -3
- package/dist/components/layout/toolbar/ViewModeTool.js +33 -24
- package/dist/components/layout/toolbar/ZoomTool.js +5 -3
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +9 -13
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -14
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -17
- package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +10 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PrintTool.js +8 -12
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +55 -56
- package/dist/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.js +16 -0
- package/dist/components/layout/toolbar/tools/defaults/TopbarDefaultTools.js +59 -0
- package/dist/components/page/AnnotationLayer.js +9 -3
- package/dist/components/page/CanvasLayer.js +9 -3
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +9 -3
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextHighlightLayer.js +9 -3
- package/dist/components/page/TextLayer.js +9 -3
- package/dist/components/ui/Checkbox.js +116 -228
- 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/DropFileZoneContext.js +28 -29
- package/dist/contexts/ElementPageContext.js +54 -43
- package/dist/contexts/IconToolContext.js +13 -0
- package/dist/contexts/PaginationContext.js +3 -3
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ToolComponentContext.js +52 -0
- package/dist/contexts/ToolbarComponentContext.js +6 -3
- package/dist/{floating-ui.react-dom-4b1e2e46.js → floating-ui.react-dom-15b9b819.js} +380 -394
- package/dist/index-1cb41342.js +307 -0
- package/dist/{index-951f0f1f.js → index-7279fb4e.js} +456 -464
- package/dist/index-aa2d3884.js +140 -0
- package/dist/main.js +23 -19
- package/dist/types/components/layout/toolbar/ThumbnailTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/tools/defaults/LeftSidebarDefaultTools.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/defaults/TopbarDefaultTools.d.ts +3 -0
- package/dist/types/contexts/IconToolContext.d.ts +9 -0
- package/dist/types/contexts/ToolComponentContext.d.ts +12 -0
- package/dist/types/main.d.ts +3 -1
- package/dist/types/utils/types.d.ts +63 -43
- package/dist/utils/hooks/useFileDownload.js +9 -3
- package/dist/utils/hooks/useLicense.js +26 -24
- package/dist/utils/hooks/usePageRotateContext.js +19 -20
- package/dist/utils/hooks/usePaginate.js +9 -3
- package/dist/utils/hooks/usePresentPage.js +9 -3
- package/dist/utils/hooks/usePrint.js +9 -3
- package/dist/utils/hooks/useScrollToPage.js +9 -3
- package/dist/utils/hooks/useSearch.js +9 -3
- package/dist/utils/hooks/useThumbnail.js +9 -3
- package/dist/utils/hooks/useVirtualReactWindow.js +9 -3
- package/dist/utils/types.js +6 -6
- package/package.json +1 -1
- package/dist/RPLayout-3042ec91.js +0 -3349
- package/dist/index-6e0e48fa.js +0 -332
- package/dist/index-e3a67935.js +0 -150
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
1
|
+
import { jsx as d, jsxs as j } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { P as
|
|
5
|
-
import { u 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 We } from "react";
|
|
4
|
+
import { P as O, e as ae, a as k, h as Ye, u as Be, b as oe, f as Ge, c as E, g as Xe, S as Ve } from "../../index-1cb41342.js";
|
|
5
|
+
import { u as Ue, D as qe } from "../../index-aa2d3884.js";
|
|
6
|
+
import { u as ze, a as Ze, o as Ke, s as Je, f as Qe, b as et, c as tt, h as rt, l as ot } from "../../floating-ui.react-dom-15b9b819.js";
|
|
7
|
+
import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, r) => {
|
|
8
|
+
const { children: t, width: o = 10, height: n = 5, ...s } = e;
|
|
9
9
|
return /* @__PURE__ */ d(
|
|
10
|
-
|
|
10
|
+
O.svg,
|
|
11
11
|
{
|
|
12
12
|
...s,
|
|
13
|
-
ref:
|
|
14
|
-
width:
|
|
13
|
+
ref: r,
|
|
14
|
+
width: o,
|
|
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, o) =
|
|
|
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: r, children: t } = e, [o, n] = a.useState(null);
|
|
25
|
+
return /* @__PURE__ */ d(st, { scope: r, anchor: o, 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, r) => {
|
|
30
|
+
const { __scopePopper: t, virtualRef: o, ...n } = e, s = ce(pe, t), i = a.useRef(null), h = k(r, i);
|
|
31
31
|
return a.useEffect(() => {
|
|
32
|
-
s.onAnchorChange((
|
|
33
|
-
}),
|
|
32
|
+
s.onAnchorChange((o == null ? void 0 : o.current) || i.current);
|
|
33
|
+
}), o ? null : /* @__PURE__ */ d(O.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, r) => {
|
|
39
39
|
var Z, K, J, Q, ee, te;
|
|
40
40
|
const {
|
|
41
41
|
__scopePopper: t,
|
|
42
|
-
side:
|
|
42
|
+
side: o = "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: m = !1,
|
|
52
52
|
updatePositionStrategy: u = "optimized",
|
|
53
53
|
onPlaced: v,
|
|
54
|
-
...
|
|
55
|
-
} = e,
|
|
54
|
+
...g
|
|
55
|
+
} = e, y = ce(G, t), [w, x] = a.useState(null), T = k(r, (_) => x(_)), [C, b] = a.useState(null), P = Ye(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 = {
|
|
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: q, placement: Ne, isPositioned: D, middlewareData: A } = ze({
|
|
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: y.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" ? ot() : void 0,
|
|
76
|
+
...S
|
|
77
77
|
}),
|
|
78
|
-
l && Qe({ ...
|
|
78
|
+
l && Qe({ ...S }),
|
|
79
79
|
et({
|
|
80
|
-
...
|
|
81
|
-
apply: ({ elements: _, rects:
|
|
82
|
-
const { width:
|
|
83
|
-
|
|
80
|
+
...S,
|
|
81
|
+
apply: ({ elements: _, rects: re, availableWidth: Me, availableHeight: $e }) => {
|
|
82
|
+
const { width: Fe, height: je } = re.reference, I = _.floating.style;
|
|
83
|
+
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`);
|
|
84
84
|
}
|
|
85
85
|
}),
|
|
86
86
|
C && tt({ element: C, padding: h }),
|
|
87
|
-
pt({ arrowWidth:
|
|
88
|
-
|
|
87
|
+
pt({ arrowWidth: N, arrowHeight: V }),
|
|
88
|
+
m && rt({ strategy: "referenceHidden", ...S })
|
|
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
|
+
}), [z, Se] = ge(Ne), H = Be(v);
|
|
91
|
+
oe(() => {
|
|
92
|
+
D && (H == null || H());
|
|
93
|
+
}, [D, H]);
|
|
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, [ke, Le] = a.useState();
|
|
95
|
+
return oe(() => {
|
|
96
|
+
w && Le(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
|
+
...q,
|
|
104
|
+
transform: D ? q.transform : "translate(0, -200%)",
|
|
105
105
|
// keep off the page when measuring
|
|
106
106
|
minWidth: "max-content",
|
|
107
|
-
zIndex:
|
|
107
|
+
zIndex: ke,
|
|
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: z,
|
|
126
126
|
onArrowChange: b,
|
|
127
127
|
arrowX: De,
|
|
128
128
|
arrowY: He,
|
|
129
129
|
shouldHideArrow: Ie,
|
|
130
130
|
children: /* @__PURE__ */ d(
|
|
131
|
-
|
|
131
|
+
O.div,
|
|
132
132
|
{
|
|
133
|
-
"data-side":
|
|
133
|
+
"data-side": z,
|
|
134
134
|
"data-align": Se,
|
|
135
|
-
...
|
|
135
|
+
...g,
|
|
136
136
|
ref: T,
|
|
137
137
|
style: {
|
|
138
|
-
...
|
|
138
|
+
...g.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: D ? 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(r, t) {
|
|
158
|
+
const { __scopePopper: o, ...n } = r, s = lt(he, o), 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(r) {
|
|
210
|
+
var y, w, x;
|
|
211
|
+
const { placement: t, rects: o, middlewareData: n } = r, i = ((y = n.arrow) == null ? void 0 : y.centerOffset) !== 0, h = i ? 0 : e.arrowWidth, l = i ? 0 : e.arrowHeight, [p, c] = ge(t), f = { start: "0%", center: "50%", end: "100%" }[c], m = (((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 = "", g = "";
|
|
213
|
+
return p === "bottom" ? (v = i ? f : `${m}px`, g = `${-l}px`) : p === "top" ? (v = i ? f : `${m}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 } };
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
function ge(e) {
|
|
217
|
-
const [
|
|
218
|
-
return [
|
|
217
|
+
const [r, t = "center"] = e.split("-");
|
|
218
|
+
return [r, t];
|
|
219
219
|
}
|
|
220
|
-
var ut = de, ft = ue, ht = fe, vt = ve, gt =
|
|
221
|
-
|
|
222
|
-
|
|
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,
|
|
220
|
+
var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", me = a.forwardRef(
|
|
221
|
+
(e, r) => /* @__PURE__ */ d(
|
|
222
|
+
O.span,
|
|
235
223
|
{
|
|
236
224
|
...e,
|
|
237
|
-
ref:
|
|
238
|
-
style: {
|
|
225
|
+
ref: r,
|
|
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
|
+
}
|
|
239
240
|
}
|
|
240
241
|
)
|
|
241
242
|
);
|
|
242
|
-
|
|
243
|
-
var mt =
|
|
243
|
+
me.displayName = gt;
|
|
244
|
+
var mt = me, [L, Wt] = ae("Tooltip", [
|
|
244
245
|
le
|
|
245
|
-
]),
|
|
246
|
+
]), M = le(), ye = "TooltipProvider", yt = 700, W = "tooltip.open", [wt, X] = L(ye), we = (e) => {
|
|
246
247
|
const {
|
|
247
|
-
__scopeTooltip:
|
|
248
|
-
delayDuration: t =
|
|
249
|
-
skipDelayDuration:
|
|
248
|
+
__scopeTooltip: r,
|
|
249
|
+
delayDuration: t = yt,
|
|
250
|
+
skipDelayDuration: o = 300,
|
|
250
251
|
disableHoverableContent: n = !1,
|
|
251
252
|
children: s
|
|
252
|
-
} = e, i = a.
|
|
253
|
+
} = e, [i, h] = a.useState(!0), l = a.useRef(!1), p = a.useRef(0);
|
|
253
254
|
return a.useEffect(() => {
|
|
254
|
-
const
|
|
255
|
-
return () => window.clearTimeout(
|
|
255
|
+
const c = p.current;
|
|
256
|
+
return () => window.clearTimeout(c);
|
|
256
257
|
}, []), /* @__PURE__ */ d(
|
|
257
|
-
|
|
258
|
+
wt,
|
|
258
259
|
{
|
|
259
|
-
scope:
|
|
260
|
-
|
|
260
|
+
scope: r,
|
|
261
|
+
isOpenDelayed: i,
|
|
261
262
|
delayDuration: t,
|
|
262
263
|
onOpen: a.useCallback(() => {
|
|
263
|
-
window.clearTimeout(
|
|
264
|
+
window.clearTimeout(p.current), h(!1);
|
|
264
265
|
}, []),
|
|
265
266
|
onClose: a.useCallback(() => {
|
|
266
|
-
window.clearTimeout(
|
|
267
|
-
() =>
|
|
268
|
-
|
|
267
|
+
window.clearTimeout(p.current), p.current = window.setTimeout(
|
|
268
|
+
() => h(!0),
|
|
269
|
+
o
|
|
269
270
|
);
|
|
270
|
-
}, [
|
|
271
|
-
isPointerInTransitRef:
|
|
272
|
-
onPointerInTransitChange: a.useCallback((
|
|
273
|
-
|
|
271
|
+
}, [o]),
|
|
272
|
+
isPointerInTransitRef: l,
|
|
273
|
+
onPointerInTransitChange: a.useCallback((c) => {
|
|
274
|
+
l.current = c;
|
|
274
275
|
}, []),
|
|
275
276
|
disableHoverableContent: n,
|
|
276
277
|
children: s
|
|
277
278
|
}
|
|
278
279
|
);
|
|
279
280
|
};
|
|
280
|
-
we.displayName =
|
|
281
|
-
var
|
|
281
|
+
we.displayName = ye;
|
|
282
|
+
var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
|
|
282
283
|
const {
|
|
283
|
-
__scopeTooltip:
|
|
284
|
+
__scopeTooltip: r,
|
|
284
285
|
children: t,
|
|
285
|
-
open:
|
|
286
|
-
defaultOpen: n,
|
|
286
|
+
open: o,
|
|
287
|
+
defaultOpen: n = !1,
|
|
287
288
|
onOpenChange: s,
|
|
288
289
|
disableHoverableContent: i,
|
|
289
290
|
delayDuration: h
|
|
290
|
-
} = e, l = X(
|
|
291
|
-
prop:
|
|
292
|
-
defaultProp: n
|
|
293
|
-
onChange: (
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
window.clearTimeout(u.current), u.current = 0, m.current = !1, x(!0);
|
|
291
|
+
} = e, l = X($, e.__scopeTooltip), p = M(r), [c, f] = a.useState(null), m = Ue(), u = a.useRef(0), v = i ?? l.disableHoverableContent, g = h ?? l.delayDuration, y = a.useRef(!1), [w = !1, x] = Ge({
|
|
292
|
+
prop: o,
|
|
293
|
+
defaultProp: n,
|
|
294
|
+
onChange: (N) => {
|
|
295
|
+
N ? (l.onOpen(), document.dispatchEvent(new CustomEvent(W))) : l.onClose(), s == null || s(N);
|
|
296
|
+
}
|
|
297
|
+
}), T = a.useMemo(() => w ? y.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
|
|
298
|
+
window.clearTimeout(u.current), u.current = 0, y.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
|
+
y.current = !0, x(!0), u.current = 0;
|
|
304
|
+
}, g);
|
|
305
|
+
}, [g, 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
|
+
xt,
|
|
310
310
|
{
|
|
311
|
-
scope:
|
|
312
|
-
contentId:
|
|
311
|
+
scope: r,
|
|
312
|
+
contentId: m,
|
|
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.isOpenDelayed ? P() : C();
|
|
319
|
+
}, [l.isOpenDelayed, 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 O = "Tooltip", [Ct, j] = M(O), xe = (e) => {
|
|
|
327
327
|
}
|
|
328
328
|
) });
|
|
329
329
|
};
|
|
330
|
-
xe.displayName =
|
|
331
|
-
var
|
|
332
|
-
(e,
|
|
333
|
-
const { __scopeTooltip: t, ...
|
|
330
|
+
xe.displayName = $;
|
|
331
|
+
var Y = "TooltipTrigger", Ce = a.forwardRef(
|
|
332
|
+
(e, r) => {
|
|
333
|
+
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, []);
|
|
334
334
|
return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(ft, { asChild: !0, ...i, children: /* @__PURE__ */ d(
|
|
335
|
-
|
|
335
|
+
O.button,
|
|
336
336
|
{
|
|
337
337
|
"aria-describedby": n.open ? n.contentId : void 0,
|
|
338
338
|
"data-state": n.stateAttribute,
|
|
339
|
-
...
|
|
339
|
+
...o,
|
|
340
340
|
ref: l,
|
|
341
|
-
onPointerMove: E(e.onPointerMove, (
|
|
342
|
-
|
|
341
|
+
onPointerMove: E(e.onPointerMove, (m) => {
|
|
342
|
+
m.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
|
-
|
|
348
|
+
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 W = "TooltipTrigger", Ce = a.forwardRef(
|
|
|
356
356
|
) });
|
|
357
357
|
}
|
|
358
358
|
);
|
|
359
|
-
Ce.displayName =
|
|
360
|
-
var
|
|
359
|
+
Ce.displayName = Y;
|
|
360
|
+
var Ct = "TooltipPortal", [Yt, Pt] = L(Ct, {
|
|
361
361
|
forceMount: void 0
|
|
362
362
|
}), R = "TooltipContent", Pe = a.forwardRef(
|
|
363
|
-
(e,
|
|
364
|
-
const t =
|
|
365
|
-
return /* @__PURE__ */ d(
|
|
363
|
+
(e, r) => {
|
|
364
|
+
const t = Pt(R, e.__scopeTooltip), { forceMount: o = t.forceMount, side: n = "top", ...s } = e, i = F(R, e.__scopeTooltip);
|
|
365
|
+
return /* @__PURE__ */ d(Xe, { present: o || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ d(Te, { side: n, ...s, ref: r }) : /* @__PURE__ */ d(Tt, { side: n, ...s, ref: r }) });
|
|
366
366
|
}
|
|
367
|
-
),
|
|
368
|
-
const t =
|
|
367
|
+
), Tt = a.forwardRef((e, r) => {
|
|
368
|
+
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, m = a.useCallback(() => {
|
|
369
369
|
h(null), f(!1);
|
|
370
370
|
}, [f]), u = a.useCallback(
|
|
371
|
-
(v,
|
|
372
|
-
const
|
|
371
|
+
(v, g) => {
|
|
372
|
+
const y = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = Et(w, y.getBoundingClientRect()), T = Rt(w, x), C = _t(g.getBoundingClientRect()), b = Nt([...T, ...C]);
|
|
373
373
|
h(b), f(!0);
|
|
374
374
|
},
|
|
375
375
|
[f]
|
|
376
376
|
);
|
|
377
|
-
return a.useEffect(() => () =>
|
|
377
|
+
return a.useEffect(() => () => m(), [m]), 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 = (y) => u(y, c), g = (y) => u(y, l);
|
|
380
|
+
return l.addEventListener("pointerleave", v), c.addEventListener("pointerleave", g), () => {
|
|
381
|
+
l.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave", g);
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
}, [l, c, u,
|
|
384
|
+
}, [l, c, u, m]), a.useEffect(() => {
|
|
385
385
|
if (i) {
|
|
386
|
-
const v = (
|
|
387
|
-
const
|
|
388
|
-
x ?
|
|
386
|
+
const v = (g) => {
|
|
387
|
+
const y = g.target, w = { x: g.clientX, y: g.clientY }, x = (l == null ? void 0 : l.contains(y)) || (c == null ? void 0 : c.contains(y)), T = !Ot(w, i);
|
|
388
|
+
x ? m() : T && (m(), 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, m]), /* @__PURE__ */ d(Te, { ...e, ref: s });
|
|
393
|
+
}), [bt, At] = L($, { isInside: !1 }), Te = a.forwardRef(
|
|
394
|
+
(e, r) => {
|
|
395
395
|
const {
|
|
396
396
|
__scopeTooltip: t,
|
|
397
|
-
children:
|
|
397
|
+
children: o,
|
|
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 = F(R, t), p = M(t), { onClose: c } = l;
|
|
403
|
+
return a.useEffect(() => (document.addEventListener(W, c), () => document.removeEventListener(W, c)), [c]), a.useEffect(() => {
|
|
404
404
|
if (l.trigger) {
|
|
405
|
-
const f = (
|
|
406
|
-
const u =
|
|
405
|
+
const f = (m) => {
|
|
406
|
+
const u = m.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
|
+
qe,
|
|
413
413
|
{
|
|
414
414
|
asChild: !0,
|
|
415
415
|
disableOutsidePointerEvents: !1,
|
|
@@ -417,13 +417,13 @@ var Pt = "TooltipPortal", [Gt, Tt] = M(Pt, {
|
|
|
417
417
|
onPointerDownOutside: i,
|
|
418
418
|
onFocusOutside: (f) => f.preventDefault(),
|
|
419
419
|
onDismiss: c,
|
|
420
|
-
children: /* @__PURE__ */
|
|
420
|
+
children: /* @__PURE__ */ j(
|
|
421
421
|
ht,
|
|
422
422
|
{
|
|
423
423
|
"data-state": l.stateAttribute,
|
|
424
424
|
...p,
|
|
425
425
|
...h,
|
|
426
|
-
ref:
|
|
426
|
+
ref: r,
|
|
427
427
|
style: {
|
|
428
428
|
...h.style,
|
|
429
429
|
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
@@ -433,8 +433,8 @@ var Pt = "TooltipPortal", [Gt, Tt] = M(Pt, {
|
|
|
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(Ve, { children: o }),
|
|
437
|
+
/* @__PURE__ */ d(bt, { scope: t, isInside: !0, children: /* @__PURE__ */ d(mt, { id: l.contentId, role: "tooltip", children: n || o }) })
|
|
438
438
|
]
|
|
439
439
|
}
|
|
440
440
|
)
|
|
@@ -444,101 +444,101 @@ var Pt = "TooltipPortal", [Gt, Tt] = M(Pt, {
|
|
|
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, r) => {
|
|
448
|
+
const { __scopeTooltip: t, ...o } = e, n = M(t);
|
|
449
|
+
return At(
|
|
450
450
|
be,
|
|
451
451
|
t
|
|
452
|
-
).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...
|
|
452
|
+
).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...o, ref: r });
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
455
|
Ae.displayName = be;
|
|
456
|
-
function
|
|
457
|
-
const t = Math.abs(
|
|
458
|
-
switch (Math.min(t,
|
|
456
|
+
function Et(e, r) {
|
|
457
|
+
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);
|
|
458
|
+
switch (Math.min(t, o, 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 o:
|
|
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 Rt(e, r, t = 5) {
|
|
472
|
+
const o = [];
|
|
473
|
+
switch (r) {
|
|
474
474
|
case "top":
|
|
475
|
-
|
|
475
|
+
o.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
|
+
o.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
|
+
o.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
|
+
o.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 o;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
const { top:
|
|
501
|
+
function _t(e) {
|
|
502
|
+
const { top: r, right: t, bottom: o, left: n } = e;
|
|
503
503
|
return [
|
|
504
|
-
{ x: n, y:
|
|
505
|
-
{ x: t, y: o },
|
|
504
|
+
{ x: n, y: r },
|
|
506
505
|
{ x: t, y: r },
|
|
507
|
-
{ x:
|
|
506
|
+
{ x: t, y: o },
|
|
507
|
+
{ x: n, y: o }
|
|
508
508
|
];
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
const { x: t, y:
|
|
510
|
+
function Ot(e, r) {
|
|
511
|
+
const { x: t, y: o } = e;
|
|
512
512
|
let n = !1;
|
|
513
|
-
for (let s = 0, i =
|
|
514
|
-
const h =
|
|
515
|
-
|
|
513
|
+
for (let s = 0, i = r.length - 1; s < r.length; i = s++) {
|
|
514
|
+
const h = r[s].x, l = r[s].y, p = r[i].x, c = r[i].y;
|
|
515
|
+
l > o != c > o && t < (p - h) * (o - l) / (c - l) + h && (n = !n);
|
|
516
516
|
}
|
|
517
517
|
return n;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
const
|
|
521
|
-
return
|
|
519
|
+
function Nt(e) {
|
|
520
|
+
const r = e.slice();
|
|
521
|
+
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);
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function St(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 r = [];
|
|
527
|
+
for (let o = 0; o < e.length; o++) {
|
|
528
|
+
const n = e[o];
|
|
529
|
+
for (; r.length >= 2; ) {
|
|
530
|
+
const s = r[r.length - 1], i = r[r.length - 2];
|
|
531
531
|
if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
|
|
532
|
-
|
|
532
|
+
r.pop();
|
|
533
533
|
else
|
|
534
534
|
break;
|
|
535
535
|
}
|
|
536
|
-
|
|
536
|
+
r.push(n);
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
r.pop();
|
|
539
539
|
const t = [];
|
|
540
|
-
for (let
|
|
541
|
-
const n = e[
|
|
540
|
+
for (let o = e.length - 1; o >= 0; o--) {
|
|
541
|
+
const n = e[o];
|
|
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 Ht(e) {
|
|
|
548
548
|
}
|
|
549
549
|
t.push(n);
|
|
550
550
|
}
|
|
551
|
-
return t.pop(),
|
|
551
|
+
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);
|
|
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 Dt = "_tooltipContent_12gjy_1", Ht = "_tooltipArrow_12gjy_8", It = "_fadeIn_12gjy_1", ne = {
|
|
554
|
+
tooltipContent: Dt,
|
|
555
|
+
tooltipArrow: Ht,
|
|
556
|
+
fadeIn: It
|
|
557
|
+
}, kt = We(
|
|
558
|
+
({ children: e, content: r, className: t, style: o }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ j(xe, { delayDuration: 1e3, children: [
|
|
559
|
+
/* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: o, children: e }) }),
|
|
560
|
+
/* @__PURE__ */ j(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: r })
|
|
563
563
|
] })
|
|
564
564
|
] }) })
|
|
565
565
|
);
|
|
566
|
-
|
|
566
|
+
kt.displayName = "RPTooltip";
|
|
567
567
|
export {
|
|
568
|
-
|
|
568
|
+
kt as default
|
|
569
569
|
};
|