@pdf-viewer/react 1.15.0-beta.4 → 1.15.0-rc.1

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