@react-pdf-kit/viewer 2.0.1-rc.4 → 2.0.1-rc.6

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