@pdf-viewer/react 1.14.0-beta.3 → 1.14.0-beta.5

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