@pdf-viewer/react 1.16.0-beta.0 → 1.16.0-rc.0

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-f843fd79.js → ToolbarLayout.module-d91e2284.js} +18 -18
  2. package/dist/assets/style.css +1 -1
  3. package/dist/components/RPController.js +19 -19
  4. package/dist/components/RPPages.js +5 -5
  5. package/dist/components/RPProvider.js +5 -5
  6. package/dist/components/layout/LayoutContainer.js +4 -4
  7. package/dist/components/layout/RPDefaultLayout.js +4 -4
  8. package/dist/components/layout/RPLayout.js +43 -43
  9. package/dist/components/layout/sidebar/RPSidebar.js +5 -5
  10. package/dist/components/layout/sidebar/Thumbnail.js +5 -5
  11. package/dist/components/layout/sidebar/Thumbnails.js +5 -5
  12. package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
  13. package/dist/components/layout/toolbar/DocumentDialog.js +5 -5
  14. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  15. package/dist/components/layout/toolbar/FileDownloadTool.js +5 -5
  16. package/dist/components/layout/toolbar/FileUploadTool.js +3 -3
  17. package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
  18. package/dist/components/layout/toolbar/MenuItem.js +3 -3
  19. package/dist/components/layout/toolbar/MenuSeparator.js +3 -3
  20. package/dist/components/layout/toolbar/MostPageTool.js +5 -5
  21. package/dist/components/layout/toolbar/OtherTool.js +5 -5
  22. package/dist/components/layout/toolbar/Paginate.js +5 -5
  23. package/dist/components/layout/toolbar/PrintTool.js +5 -5
  24. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  25. package/dist/components/layout/toolbar/RPMoreOptions.js +5 -5
  26. package/dist/components/layout/toolbar/RPToolbar.js +5 -5
  27. package/dist/components/layout/toolbar/RPToolbarEnd.js +5 -5
  28. package/dist/components/layout/toolbar/RotateTool.js +3 -3
  29. package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
  30. package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
  31. package/dist/components/layout/toolbar/SearchResultNavigator.js +5 -5
  32. package/dist/components/layout/toolbar/SearchTool.js +5 -5
  33. package/dist/components/layout/toolbar/SelectionModeTool.js +3 -3
  34. package/dist/components/layout/toolbar/ThumbnailTool.js +5 -5
  35. package/dist/components/layout/toolbar/ToolbarCustom.js +13 -13
  36. package/dist/components/layout/toolbar/ToolbarDefault.js +5 -5
  37. package/dist/components/layout/toolbar/ToolbarLayout.js +5 -5
  38. package/dist/components/layout/toolbar/ViewModeTool.js +3 -3
  39. package/dist/components/layout/toolbar/ZoomTool.js +5 -5
  40. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +5 -5
  41. package/dist/components/layout/toolbar/tools/DualPageTool.js +5 -5
  42. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +5 -5
  43. package/dist/components/layout/toolbar/tools/FileUploadTool.js +2 -2
  44. package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
  45. package/dist/components/layout/toolbar/tools/InputPageTool.js +5 -5
  46. package/dist/components/layout/toolbar/tools/NextPageTool.js +5 -5
  47. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +5 -5
  48. package/dist/components/layout/toolbar/tools/PrintTool.js +5 -5
  49. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +2 -2
  50. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +2 -2
  51. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
  52. package/dist/components/layout/toolbar/tools/SinglePageTool.js +5 -5
  53. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
  54. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +5 -5
  55. package/dist/components/layout/toolbar/tools/ZoomInTool.js +2 -2
  56. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +5 -5
  57. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +5 -5
  58. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +2 -2
  59. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +10 -10
  60. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +5 -5
  61. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +3 -3
  62. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +5 -5
  63. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +5 -5
  64. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +3 -3
  65. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -5
  66. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +5 -5
  67. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +3 -3
  68. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
  69. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +3 -3
  70. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +3 -3
  71. package/dist/components/page/AnnotationLayer.js +5 -5
  72. package/dist/components/page/CanvasLayer.js +5 -5
  73. package/dist/components/page/DualPage.js +5 -5
  74. package/dist/components/page/RPPage.js +5 -5
  75. package/dist/components/page/SinglePage.js +5 -5
  76. package/dist/components/page/TextHighlightLayer.js +5 -5
  77. package/dist/components/page/TextLayer.js +5 -5
  78. package/dist/components/ui/Checkbox.js +1 -1
  79. package/dist/components/ui/DropDown.js +3 -3
  80. package/dist/components/ui/LoadingIndicator.js +5 -5
  81. package/dist/components/ui/RPTooltip.js +201 -415
  82. package/dist/contexts/PaginationContext.js +5 -5
  83. package/dist/contexts/PrintContext.js +5 -5
  84. package/dist/contexts/RenderQueueProvider.js +5 -5
  85. package/dist/contexts/SearchContext.js +5 -5
  86. package/dist/contexts/ThumbnailsContext.js +5 -5
  87. package/dist/index-808ea7bf.js +1685 -0
  88. package/dist/index-a48ec088.js +1672 -0
  89. package/dist/{index-35c7f4a2.js → index-c9a2990a.js} +3 -3
  90. package/dist/main.js +115 -118
  91. package/dist/types/main.d.ts +0 -3
  92. package/dist/utils/hooks/useFileDownload.js +5 -5
  93. package/dist/utils/hooks/useLicense.js +1 -1
  94. package/dist/utils/hooks/usePaginate.js +5 -5
  95. package/dist/utils/hooks/usePresentPage.js +5 -5
  96. package/dist/utils/hooks/usePrint.js +5 -5
  97. package/dist/utils/hooks/useScrollToPage.js +5 -5
  98. package/dist/utils/hooks/useSearch.js +5 -5
  99. package/dist/utils/hooks/useThumbnail.js +5 -5
  100. package/dist/utils/hooks/useVirtualReactWindow.js +5 -5
  101. package/package.json +1 -1
  102. package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
  103. package/dist/index-f563c6f0.js +0 -1889
@@ -1,224 +1,10 @@
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";
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";
6
6
  import "react-dom";
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({
7
+ var ae = Object.freeze({
222
8
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
223
9
  position: "absolute",
224
10
  border: 0,
@@ -230,203 +16,203 @@ var ut = de, ft = ue, ht = fe, vt = ve, gt = Object.freeze({
230
16
  clip: "rect(0, 0, 0, 0)",
231
17
  whiteSpace: "nowrap",
232
18
  wordWrap: "normal"
233
- }), yt = "VisuallyHidden", ye = a.forwardRef(
234
- (e, r) => /* @__PURE__ */ d(
235
- S.span,
19
+ }), ie = "VisuallyHidden", F = s.forwardRef(
20
+ (e, o) => /* @__PURE__ */ p(
21
+ M.span,
236
22
  {
237
23
  ...e,
238
- ref: r,
239
- style: { ...gt, ...e.style }
24
+ ref: o,
25
+ style: { ...ae, ...e.style }
240
26
  }
241
27
  )
242
28
  );
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) => {
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) => {
247
33
  const {
248
- __scopeTooltip: r,
249
- delayDuration: t = wt,
250
- skipDelayDuration: o = 300,
34
+ __scopeTooltip: o,
35
+ delayDuration: t = ce,
36
+ skipDelayDuration: r = 300,
251
37
  disableHoverableContent: n = !1,
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,
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,
259
45
  {
260
- scope: r,
261
- isOpenDelayedRef: l,
46
+ scope: o,
47
+ isOpenDelayedRef: i,
262
48
  delayDuration: t,
263
- onOpen: a.useCallback(() => {
264
- window.clearTimeout(s.current), l.current = !1;
49
+ onOpen: s.useCallback(() => {
50
+ window.clearTimeout(a.current), i.current = !1;
265
51
  }, []),
266
- onClose: a.useCallback(() => {
267
- window.clearTimeout(s.current), s.current = window.setTimeout(
268
- () => l.current = !0,
269
- o
52
+ onClose: s.useCallback(() => {
53
+ window.clearTimeout(a.current), a.current = window.setTimeout(
54
+ () => i.current = !0,
55
+ r
270
56
  );
271
- }, [o]),
272
- isPointerInTransitRef: h,
273
- onPointerInTransitChange: a.useCallback((p) => {
274
- h.current = p;
57
+ }, [r]),
58
+ isPointerInTransitRef: v,
59
+ onPointerInTransitChange: s.useCallback((d) => {
60
+ v.current = d;
275
61
  }, []),
276
62
  disableHoverableContent: n,
277
- children: i
63
+ children: l
278
64
  }
279
65
  );
280
66
  };
281
- we.displayName = me;
282
- var O = "Tooltip", [Ct, j] = M(O), xe = (e) => {
67
+ Y.displayName = V;
68
+ var P = "Tooltip", [pe, D] = _(P), B = (e) => {
283
69
  const {
284
- __scopeTooltip: r,
70
+ __scopeTooltip: o,
285
71
  children: t,
286
- open: o,
72
+ open: r,
287
73
  defaultOpen: n,
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,
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,
293
79
  defaultProp: n ?? !1,
294
- onChange: (N) => {
295
- 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);
296
82
  },
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(() => {
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(() => {
303
89
  window.clearTimeout(u.current), u.current = window.setTimeout(() => {
304
- m.current = !0, x(!0), u.current = 0;
305
- }, y);
306
- }, [y, x]);
307
- return a.useEffect(() => () => {
90
+ T.current = !0, m(!0), u.current = 0;
91
+ }, C);
92
+ }, [C, m]);
93
+ return s.useEffect(() => () => {
308
94
  u.current && (window.clearTimeout(u.current), u.current = 0);
309
- }, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
310
- Ct,
95
+ }, []), /* @__PURE__ */ p(ee, { ...d, children: /* @__PURE__ */ p(
96
+ pe,
311
97
  {
312
- scope: r,
313
- contentId: g,
314
- open: w,
315
- stateAttribute: T,
98
+ scope: o,
99
+ contentId: h,
100
+ open: x,
101
+ stateAttribute: b,
316
102
  trigger: c,
317
103
  onTriggerChange: f,
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,
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,
327
113
  children: t
328
114
  }
329
115
  ) });
330
116
  };
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,
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,
337
123
  {
338
124
  "aria-describedby": n.open ? n.contentId : void 0,
339
125
  "data-state": n.stateAttribute,
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);
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);
344
130
  }),
345
- onPointerLeave: E(e.onPointerLeave, () => {
131
+ onPointerLeave: g(e.onPointerLeave, () => {
346
132
  n.onTriggerLeave(), c.current = !1;
347
133
  }),
348
- onPointerDown: E(e.onPointerDown, () => {
349
- 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 });
350
136
  }),
351
- onFocus: E(e.onFocus, () => {
352
- p.current || n.onOpen();
137
+ onFocus: g(e.onFocus, () => {
138
+ d.current || n.onOpen();
353
139
  }),
354
- onBlur: E(e.onBlur, n.onClose),
355
- onClick: E(e.onClick, n.onClose)
140
+ onBlur: g(e.onBlur, n.onClose),
141
+ onClick: g(e.onClick, n.onClose)
356
142
  }
357
143
  ) });
358
144
  }
359
145
  );
360
- Ce.displayName = W;
361
- var Pt = "TooltipPortal", [Bt, Tt] = M(Pt, {
146
+ U.displayName = k;
147
+ var de = "TooltipPortal", [Ie, fe] = _(de, {
362
148
  forceMount: void 0
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 }) });
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 }) });
367
153
  }
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);
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);
375
161
  },
376
162
  [f]
377
163
  );
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);
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);
383
169
  };
384
170
  }
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());
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());
390
176
  };
391
- return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
177
+ return document.addEventListener("pointermove", y), () => document.removeEventListener("pointermove", y);
392
178
  }
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) => {
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) => {
396
182
  const {
397
183
  __scopeTooltip: t,
398
- children: o,
184
+ children: r,
399
185
  "aria-label": n,
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();
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();
409
195
  };
410
196
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
411
197
  }
412
- }, [s.trigger, c]), /* @__PURE__ */ d(
413
- rt,
198
+ }, [a.trigger, c]), /* @__PURE__ */ p(
199
+ oe,
414
200
  {
415
201
  asChild: !0,
416
202
  disableOutsidePointerEvents: !1,
417
- onEscapeKeyDown: i,
418
- onPointerDownOutside: l,
203
+ onEscapeKeyDown: l,
204
+ onPointerDownOutside: i,
419
205
  onFocusOutside: (f) => f.preventDefault(),
420
206
  onDismiss: c,
421
- children: /* @__PURE__ */ Y(
422
- ht,
207
+ children: /* @__PURE__ */ L(
208
+ re,
423
209
  {
424
- "data-state": s.stateAttribute,
425
- ...p,
426
- ...h,
427
- ref: r,
210
+ "data-state": a.stateAttribute,
211
+ ...d,
212
+ ...v,
213
+ ref: o,
428
214
  style: {
429
- ...h.style,
215
+ ...v.style,
430
216
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
431
217
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
432
218
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -434,8 +220,8 @@ var Pt = "TooltipPortal", [Bt, Tt] = M(Pt, {
434
220
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
435
221
  },
436
222
  children: [
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 }) })
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 }) })
439
225
  ]
440
226
  }
441
227
  )
@@ -443,127 +229,127 @@ var Pt = "TooltipPortal", [Bt, Tt] = M(Pt, {
443
229
  );
444
230
  }
445
231
  );
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,
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,
452
238
  t
453
- ).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...o, ref: r });
239
+ ).isInside ? null : /* @__PURE__ */ p(ne, { ...n, ...r, ref: o });
454
240
  }
455
241
  );
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:
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:
461
247
  return "left";
462
248
  case n:
463
249
  return "right";
464
250
  case t:
465
251
  return "top";
466
- case o:
252
+ case r:
467
253
  return "bottom";
468
254
  default:
469
255
  throw new Error("unreachable");
470
256
  }
471
257
  }
472
- function Ot(e, r, t = 5) {
473
- const o = [];
474
- switch (r) {
258
+ function me(e, o, t = 5) {
259
+ const r = [];
260
+ switch (o) {
475
261
  case "top":
476
- o.push(
262
+ r.push(
477
263
  { x: e.x - t, y: e.y + t },
478
264
  { x: e.x + t, y: e.y + t }
479
265
  );
480
266
  break;
481
267
  case "bottom":
482
- o.push(
268
+ r.push(
483
269
  { x: e.x - t, y: e.y - t },
484
270
  { x: e.x + t, y: e.y - t }
485
271
  );
486
272
  break;
487
273
  case "left":
488
- o.push(
274
+ r.push(
489
275
  { x: e.x + t, y: e.y - t },
490
276
  { x: e.x + t, y: e.y + t }
491
277
  );
492
278
  break;
493
279
  case "right":
494
- o.push(
280
+ r.push(
495
281
  { x: e.x - t, y: e.y - t },
496
282
  { x: e.x - t, y: e.y + t }
497
283
  );
498
284
  break;
499
285
  }
500
- return o;
286
+ return r;
501
287
  }
502
- function St(e) {
503
- 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;
504
290
  return [
505
- { x: n, y: r },
506
- { x: t, y: r },
291
+ { x: n, y: o },
507
292
  { x: t, y: o },
508
- { x: n, y: o }
293
+ { x: t, y: r },
294
+ { x: n, y: r }
509
295
  ];
510
296
  }
511
- function Nt(e, r) {
512
- const { x: t, y: o } = e;
297
+ function ge(e, o) {
298
+ const { x: t, y: r } = e;
513
299
  let n = !1;
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);
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);
517
303
  }
518
304
  return n;
519
305
  }
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);
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);
523
309
  }
524
- function Ht(e) {
310
+ function be(e) {
525
311
  if (e.length <= 1)
526
312
  return e.slice();
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();
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();
534
320
  else
535
321
  break;
536
322
  }
537
- r.push(n);
323
+ o.push(n);
538
324
  }
539
- r.pop();
325
+ o.pop();
540
326
  const t = [];
541
- for (let o = e.length - 1; o >= 0; o--) {
542
- const n = e[o];
327
+ for (let r = e.length - 1; r >= 0; r--) {
328
+ const n = e[r];
543
329
  for (; t.length >= 2; ) {
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))
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))
546
332
  t.pop();
547
333
  else
548
334
  break;
549
335
  }
550
336
  t.push(n);
551
337
  }
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);
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);
553
339
  }
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 })
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 })
564
350
  ] })
565
351
  ] }) })
566
352
  );
567
353
  export {
568
- Gt as default
354
+ Ne as default
569
355
  };