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