@pdf-viewer/react 1.14.0-beta.0 → 1.14.0-beta.2

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-c133fcc0.js +3543 -0
  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 +21 -21
  35. package/dist/components/layout/toolbar/ToolbarDefault.js +27 -27
  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 +29 -0
  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 +4 -4
  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 +430 -200
  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/floating-ui.react-dom-d22a10b4.js +1474 -0
  84. package/dist/index-3bf64864.js +1886 -0
  85. package/dist/main.js +22 -20
  86. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  87. package/dist/types/main.d.ts +2 -1
  88. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  89. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  90. package/dist/types/utils/types.d.ts +14 -3
  91. package/dist/utils/hooks/useFileDownload.js +3 -3
  92. package/dist/utils/hooks/useLicense.js +1 -1
  93. package/dist/utils/hooks/usePaginate.js +3 -3
  94. package/dist/utils/hooks/usePresentPage.js +3 -3
  95. package/dist/utils/hooks/usePrint.js +3 -3
  96. package/dist/utils/hooks/useScrollToPage.js +3 -3
  97. package/dist/utils/hooks/useSearch.js +3 -3
  98. package/dist/utils/hooks/useThumbnail.js +3 -3
  99. package/dist/utils/hooks/useVirtualReactWindow.js +3 -3
  100. package/package.json +1 -1
  101. package/dist/ToolbarLayout.module-37d1f575.js +0 -3539
  102. package/dist/index-808ea7bf.js +0 -1685
  103. package/dist/index-a48ec088.js +0 -1672
@@ -1,10 +1,240 @@
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 { 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";
6
7
  import "react-dom";
7
- var ae = Object.freeze({
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({
8
238
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
9
239
  position: "absolute",
10
240
  border: 0,
@@ -16,203 +246,203 @@ var ae = Object.freeze({
16
246
  clip: "rect(0, 0, 0, 0)",
17
247
  whiteSpace: "nowrap",
18
248
  wordWrap: "normal"
19
- }), ie = "VisuallyHidden", F = s.forwardRef(
20
- (e, o) => /* @__PURE__ */ p(
21
- M.span,
249
+ }), Ct = "VisuallyHidden", me = a.forwardRef(
250
+ (e, r) => /* @__PURE__ */ d(
251
+ S.span,
22
252
  {
23
253
  ...e,
24
- ref: o,
25
- style: { ...ae, ...e.style }
254
+ ref: r,
255
+ style: { ...xt, ...e.style }
26
256
  }
27
257
  )
28
258
  );
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) => {
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) => {
33
263
  const {
34
- __scopeTooltip: o,
35
- delayDuration: t = ce,
36
- skipDelayDuration: r = 300,
264
+ __scopeTooltip: r,
265
+ delayDuration: t = bt,
266
+ skipDelayDuration: o = 300,
37
267
  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,
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,
45
275
  {
46
- scope: o,
47
- isOpenDelayedRef: i,
276
+ scope: r,
277
+ isOpenDelayedRef: l,
48
278
  delayDuration: t,
49
- onOpen: s.useCallback(() => {
50
- window.clearTimeout(a.current), i.current = !1;
279
+ onOpen: a.useCallback(() => {
280
+ window.clearTimeout(s.current), l.current = !1;
51
281
  }, []),
52
- onClose: s.useCallback(() => {
53
- window.clearTimeout(a.current), a.current = window.setTimeout(
54
- () => i.current = !0,
55
- r
282
+ onClose: a.useCallback(() => {
283
+ window.clearTimeout(s.current), s.current = window.setTimeout(
284
+ () => l.current = !0,
285
+ o
56
286
  );
57
- }, [r]),
58
- isPointerInTransitRef: v,
59
- onPointerInTransitChange: s.useCallback((d) => {
60
- v.current = d;
287
+ }, [o]),
288
+ isPointerInTransitRef: h,
289
+ onPointerInTransitChange: a.useCallback((p) => {
290
+ h.current = p;
61
291
  }, []),
62
292
  disableHoverableContent: n,
63
- children: l
293
+ children: i
64
294
  }
65
295
  );
66
296
  };
67
- Y.displayName = V;
68
- var P = "Tooltip", [pe, D] = _(P), B = (e) => {
297
+ we.displayName = ye;
298
+ var O = "Tooltip", [At, j] = M(O), xe = (e) => {
69
299
  const {
70
- __scopeTooltip: o,
300
+ __scopeTooltip: r,
71
301
  children: t,
72
- open: r,
302
+ open: o,
73
303
  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,
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,
79
309
  defaultProp: n ?? !1,
80
- onChange: (S) => {
81
- S ? (a.onOpen(), document.dispatchEvent(new CustomEvent(O))) : a.onClose(), l == null || l(S);
310
+ onChange: (N) => {
311
+ N ? (s.onOpen(), document.dispatchEvent(new CustomEvent(F))) : s.onClose(), i == null || i(N);
82
312
  },
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(() => {
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(() => {
89
319
  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(() => () => {
320
+ y.current = !0, x(!0), u.current = 0;
321
+ }, m);
322
+ }, [m, x]);
323
+ return a.useEffect(() => () => {
94
324
  u.current && (window.clearTimeout(u.current), u.current = 0);
95
- }, []), /* @__PURE__ */ p(ee, { ...d, children: /* @__PURE__ */ p(
96
- pe,
325
+ }, []), /* @__PURE__ */ d(gt, { ...p, children: /* @__PURE__ */ d(
326
+ At,
97
327
  {
98
- scope: o,
99
- contentId: h,
100
- open: x,
328
+ scope: r,
329
+ contentId: g,
330
+ open: w,
101
331
  stateAttribute: b,
102
332
  trigger: c,
103
333
  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,
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,
113
343
  children: t
114
344
  }
115
345
  ) });
116
346
  };
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,
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,
123
353
  {
124
354
  "aria-describedby": n.open ? n.contentId : void 0,
125
355
  "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);
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);
130
360
  }),
131
- onPointerLeave: g(e.onPointerLeave, () => {
361
+ onPointerLeave: E(e.onPointerLeave, () => {
132
362
  n.onTriggerLeave(), c.current = !1;
133
363
  }),
134
- onPointerDown: g(e.onPointerDown, () => {
135
- n.open && n.onClose(), d.current = !0, document.addEventListener("pointerup", f, { once: !0 });
364
+ onPointerDown: E(e.onPointerDown, () => {
365
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
136
366
  }),
137
- onFocus: g(e.onFocus, () => {
138
- d.current || n.onOpen();
367
+ onFocus: E(e.onFocus, () => {
368
+ p.current || n.onOpen();
139
369
  }),
140
- onBlur: g(e.onBlur, n.onClose),
141
- onClick: g(e.onClick, n.onClose)
370
+ onBlur: E(e.onBlur, n.onClose),
371
+ onClick: E(e.onClick, n.onClose)
142
372
  }
143
373
  ) });
144
374
  }
145
375
  );
146
- U.displayName = k;
147
- var de = "TooltipPortal", [Ie, fe] = _(de, {
376
+ Ce.displayName = B;
377
+ var Et = "TooltipPortal", [zt, Rt] = M(Et, {
148
378
  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 }) });
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 }) });
153
383
  }
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);
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);
161
391
  },
162
392
  [f]
163
393
  );
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);
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);
169
399
  };
170
400
  }
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());
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());
176
406
  };
177
- return document.addEventListener("pointermove", y), () => document.removeEventListener("pointermove", y);
407
+ return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
178
408
  }
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) => {
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) => {
182
412
  const {
183
413
  __scopeTooltip: t,
184
- children: r,
414
+ children: o,
185
415
  "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();
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();
195
425
  };
196
426
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
197
427
  }
198
- }, [a.trigger, c]), /* @__PURE__ */ p(
199
- oe,
428
+ }, [s.trigger, c]), /* @__PURE__ */ d(
429
+ at,
200
430
  {
201
431
  asChild: !0,
202
432
  disableOutsidePointerEvents: !1,
203
- onEscapeKeyDown: l,
204
- onPointerDownOutside: i,
433
+ onEscapeKeyDown: i,
434
+ onPointerDownOutside: l,
205
435
  onFocusOutside: (f) => f.preventDefault(),
206
436
  onDismiss: c,
207
- children: /* @__PURE__ */ L(
208
- re,
437
+ children: /* @__PURE__ */ Y(
438
+ yt,
209
439
  {
210
- "data-state": a.stateAttribute,
211
- ...d,
212
- ...v,
213
- ref: o,
440
+ "data-state": s.stateAttribute,
441
+ ...p,
442
+ ...h,
443
+ ref: r,
214
444
  style: {
215
- ...v.style,
445
+ ...h.style,
216
446
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
217
447
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
218
448
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -220,8 +450,8 @@ var de = "TooltipPortal", [Ie, fe] = _(de, {
220
450
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
221
451
  },
222
452
  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 }) })
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 }) })
225
455
  ]
226
456
  }
227
457
  )
@@ -229,127 +459,127 @@ var de = "TooltipPortal", [Ie, fe] = _(de, {
229
459
  );
230
460
  }
231
461
  );
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,
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,
238
468
  t
239
- ).isInside ? null : /* @__PURE__ */ p(ne, { ...n, ...r, ref: o });
469
+ ).isInside ? null : /* @__PURE__ */ d(wt, { ...n, ...o, ref: r });
240
470
  }
241
471
  );
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:
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:
247
477
  return "left";
248
478
  case n:
249
479
  return "right";
250
480
  case t:
251
481
  return "top";
252
- case r:
482
+ case o:
253
483
  return "bottom";
254
484
  default:
255
485
  throw new Error("unreachable");
256
486
  }
257
487
  }
258
- function me(e, o, t = 5) {
259
- const r = [];
260
- switch (o) {
488
+ function Ht(e, r, t = 5) {
489
+ const o = [];
490
+ switch (r) {
261
491
  case "top":
262
- r.push(
492
+ o.push(
263
493
  { x: e.x - t, y: e.y + t },
264
494
  { x: e.x + t, y: e.y + t }
265
495
  );
266
496
  break;
267
497
  case "bottom":
268
- r.push(
498
+ o.push(
269
499
  { x: e.x - t, y: e.y - t },
270
500
  { x: e.x + t, y: e.y - t }
271
501
  );
272
502
  break;
273
503
  case "left":
274
- r.push(
504
+ o.push(
275
505
  { x: e.x + t, y: e.y - t },
276
506
  { x: e.x + t, y: e.y + t }
277
507
  );
278
508
  break;
279
509
  case "right":
280
- r.push(
510
+ o.push(
281
511
  { x: e.x - t, y: e.y - t },
282
512
  { x: e.x - t, y: e.y + t }
283
513
  );
284
514
  break;
285
515
  }
286
- return r;
516
+ return o;
287
517
  }
288
- function xe(e) {
289
- const { top: o, right: t, bottom: r, left: n } = e;
518
+ function It(e) {
519
+ const { top: r, right: t, bottom: o, left: n } = e;
290
520
  return [
291
- { x: n, y: o },
292
- { x: t, y: o },
521
+ { x: n, y: r },
293
522
  { x: t, y: r },
294
- { x: n, y: r }
523
+ { x: t, y: o },
524
+ { x: n, y: o }
295
525
  ];
296
526
  }
297
- function ge(e, o) {
298
- const { x: t, y: r } = e;
527
+ function Lt(e, r) {
528
+ const { x: t, y: o } = e;
299
529
  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);
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);
303
533
  }
304
534
  return n;
305
535
  }
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);
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);
309
539
  }
310
- function be(e) {
540
+ function Mt(e) {
311
541
  if (e.length <= 1)
312
542
  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();
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();
320
550
  else
321
551
  break;
322
552
  }
323
- o.push(n);
553
+ r.push(n);
324
554
  }
325
- o.pop();
555
+ r.pop();
326
556
  const t = [];
327
- for (let r = e.length - 1; r >= 0; r--) {
328
- const n = e[r];
557
+ for (let o = e.length - 1; o >= 0; o--) {
558
+ const n = e[o];
329
559
  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))
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))
332
562
  t.pop();
333
563
  else
334
564
  break;
335
565
  }
336
566
  t.push(n);
337
567
  }
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);
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);
339
569
  }
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 })
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 })
350
580
  ] })
351
581
  ] }) })
352
582
  );
353
583
  export {
354
- Ne as default
584
+ qt as default
355
585
  };