@react-pdf-kit/viewer 2.11.0-beta.0 → 2.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 (75) hide show
  1. package/dist/{Checkbox-Bh8e2edn.js → Checkbox-AYfRYvHf.js} +1 -1
  2. package/dist/{DropDown-ry_t2shD.js → DropDown-CUgzYJ-P.js} +1 -1
  3. package/dist/{MenuItem-CcoN4Mgf.js → MenuItem-VfaeTICb.js} +1 -1
  4. package/dist/{MenuSeparator-BoY354ZB.js → MenuSeparator-ByVssRkp.js} +1 -1
  5. package/dist/RPTooltip-DMM4skl8.js +413 -0
  6. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  7. package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
  8. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  9. package/dist/components/layout/toolbar/FileDownloadTool.js +2 -2
  10. package/dist/components/layout/toolbar/FileUploadTool.js +2 -2
  11. package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
  12. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  13. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  14. package/dist/components/layout/toolbar/MostPageTool.js +4 -4
  15. package/dist/components/layout/toolbar/OtherTool.js +4 -4
  16. package/dist/components/layout/toolbar/Paginate.js +1 -1
  17. package/dist/components/layout/toolbar/PrintTool.js +2 -2
  18. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  19. package/dist/components/layout/toolbar/RPMoreOptions.js +4 -4
  20. package/dist/components/layout/toolbar/RotateTool.js +4 -4
  21. package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
  22. package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
  23. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  24. package/dist/components/layout/toolbar/SearchTool.js +3 -3
  25. package/dist/components/layout/toolbar/SelectionModeTool.js +4 -4
  26. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  27. package/dist/components/layout/toolbar/ViewModeTool.js +4 -4
  28. package/dist/components/layout/toolbar/ZoomTool.js +5 -5
  29. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
  30. package/dist/components/layout/toolbar/tools/DualPageTool.js +1 -1
  31. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
  32. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  38. package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +1 -1
  41. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
  44. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
  45. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +1 -1
  46. package/dist/components/layout/toolbar/tools/SinglePageTool.js +1 -1
  47. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
  48. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  49. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +1 -1
  50. package/dist/components/layout/toolbar/tools/ZoomInTool.js +1 -1
  51. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +5 -5
  52. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +1 -1
  53. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
  54. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
  55. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
  56. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
  57. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +4 -4
  58. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
  59. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
  60. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
  61. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +4 -4
  62. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +4 -4
  63. package/dist/components/ui/Checkbox.js +1 -1
  64. package/dist/components/ui/DropDown.js +1 -1
  65. package/dist/components/ui/RPTooltip.js +1 -1
  66. package/dist/dist-B96fEANu.js +947 -0
  67. package/dist/dist-D77PxjjS.js +1286 -0
  68. package/dist/{main-D1Xu_2Lx.js → main-GaulAopG.js} +1 -1
  69. package/dist/main.js +2 -2
  70. package/dist/utils/hooks/useLicense.js +1 -1
  71. package/package.json +1 -1
  72. package/dist/RPTooltip-BIK-lUgv.js +0 -600
  73. package/dist/dist-B_q_rhvX.js +0 -1134
  74. package/dist/floating-ui.react-dom-Cf7rQKLH.js +0 -1096
  75. /package/dist/{dist-PVJbq3xy.js → dist-DNiYOEuQ.js} +0 -0
@@ -2,7 +2,7 @@ import { useViewModeContext as e } from "./contexts/ViewModeContext.js";
2
2
  import { r as t } from "./PaginationContext-DIzsZhFd.js";
3
3
  import { useLocalizationContext as n } from "./contexts/LocalizationContext.js";
4
4
  import { t as r } from "./Button-Dk2wKVbw.js";
5
- import { t as i } from "./RPTooltip-BIK-lUgv.js";
5
+ import { t as i } from "./RPTooltip-DMM4skl8.js";
6
6
  import { DualPageWithCoverIcon as a } from "./components/icons/DualPageWithCoverIcon.js";
7
7
  import { GoToDownIcon as o } from "./components/icons/GoToDownIcon.js";
8
8
  import { t as s } from "./MostPageTool.module-GV9bDwAM.js";
package/dist/main.js CHANGED
@@ -21,7 +21,7 @@ import { useFileDownload as w } from "./utils/hooks/useFileDownload.js";
21
21
  import { RPTheme as T } from "./components/RPTheme.js";
22
22
  import { RPConfig as E } from "./components/RPConfig.js";
23
23
  import { t as D } from "./Button-Dk2wKVbw.js";
24
- import { t as O } from "./RPTooltip-BIK-lUgv.js";
24
+ import { t as O } from "./RPTooltip-DMM4skl8.js";
25
25
  import { SearchTool as k } from "./components/layout/toolbar/SearchTool.js";
26
26
  import { RPDefaultLayout as A } from "./components/layout/RPDefaultLayout.js";
27
27
  import { RPVerticalBar as j } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
@@ -46,7 +46,7 @@ import { RotateCounterclockwiseTool as Y } from "./components/layout/toolbar/too
46
46
  import { SelectionModeSwitcherTool as X } from "./components/layout/toolbar/tools/SelectionModeSwitcherTool.js";
47
47
  import { SinglePageTool as Z } from "./components/layout/toolbar/tools/SinglePageTool.js";
48
48
  import { DualPageTool as Q } from "./components/layout/toolbar/tools/DualPageTool.js";
49
- import { n as $, r as ee, t as te } from "./main-D1Xu_2Lx.js";
49
+ import { n as $, r as ee, t as te } from "./main-GaulAopG.js";
50
50
  import { PageScrollingTool as ne } from "./components/layout/toolbar/tools/PageScrollingTool.js";
51
51
  import { VerticalScrollingTool as re } from "./components/layout/toolbar/tools/VerticalScrollingTool.js";
52
52
  import { HorizontalScrollingTool as ie } from "./components/layout/toolbar/tools/HorizontalScrollingTool.js";
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
3
3
  import { appConsole as n } from "../appConsole.js";
4
4
  import { useCallback as r, useEffect as i, useState as a } from "react";
5
5
  //#region lib/utils/hooks/useLicense.ts
6
- var o = /* @__PURE__ */ new Date("2026-10-21T07:18:10.296Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
6
+ var o = /* @__PURE__ */ new Date("2026-10-27T06:39:15.614Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
7
7
  invalidLicense: `You are currently using without a valid license. ${c}`,
8
8
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
9
9
  expired: `Your license key has expired. ${c}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pdf-kit/viewer",
3
- "version": "2.11.0-beta.0",
3
+ "version": "2.11.0-rc.0",
4
4
  "private": false,
5
5
  "description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
6
6
  "keywords": [
@@ -1,600 +0,0 @@
1
- import { withRef as e } from "./utils/withRef.js";
2
- import { d as t, f as n, i as r, l as i, n as a, r as o, s, t as c } from "./dist-CN3GdKe9.js";
3
- import { i as l, n as u, r as d, t as f } from "./dist-CfqUKHDS.js";
4
- import { a as p, c as m, i as h, l as g, n as _, o as v, r as y, s as b, t as ee } from "./floating-ui.react-dom-Cf7rQKLH.js";
5
- import { t as x } from "./dist-PVJbq3xy.js";
6
- import * as S from "react";
7
- import { useEffect as C, useRef as w, useState as te } from "react";
8
- import { jsx as T, jsxs as E } from "react/jsx-runtime";
9
- import './assets/RPTooltip.css';//#region node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-arrow/dist/index.mjs
10
- var ne = "Arrow", D = S.forwardRef((e, t) => {
11
- let { children: n, width: i = 10, height: a = 5, ...o } = e;
12
- return /* @__PURE__ */ T(r.svg, {
13
- ...o,
14
- ref: t,
15
- width: i,
16
- height: a,
17
- viewBox: "0 0 30 10",
18
- preserveAspectRatio: "none",
19
- children: e.asChild ? n : /* @__PURE__ */ T("polygon", { points: "0,0 30,0 15,10" })
20
- });
21
- });
22
- D.displayName = ne;
23
- var O = D, k = "Popper", [A, j] = i(k), [re, ie] = A(k), M = (e) => {
24
- let { __scopePopper: t, children: n } = e, [r, i] = S.useState(null);
25
- return /* @__PURE__ */ T(re, {
26
- scope: t,
27
- anchor: r,
28
- onAnchorChange: i,
29
- children: n
30
- });
31
- };
32
- M.displayName = k;
33
- var N = "PopperAnchor", P = S.forwardRef((e, n) => {
34
- let { __scopePopper: i, virtualRef: a, ...o } = e, s = ie(N, i), c = S.useRef(null), l = t(n, c), u = S.useRef(null);
35
- return S.useEffect(() => {
36
- let e = u.current;
37
- u.current = a?.current || c.current, e !== u.current && s.onAnchorChange(u.current);
38
- }), a ? null : /* @__PURE__ */ T(r.div, {
39
- ...o,
40
- ref: l
41
- });
42
- });
43
- P.displayName = N;
44
- var F = "PopperContent", [ae, oe] = A(F), I = S.forwardRef((e, n) => {
45
- let { __scopePopper: i, side: a = "bottom", sideOffset: s = 0, align: c = "center", alignOffset: u = 0, arrowPadding: d = 0, avoidCollisions: f = !0, collisionBoundary: C = [], collisionPadding: w = 0, sticky: te = "partial", hideWhenDetached: E = !1, updatePositionStrategy: ne = "optimized", onPlaced: D, ...O } = e, k = ie(F, i), [A, j] = S.useState(null), re = t(n, (e) => j(e)), [M, N] = S.useState(null), P = x(M), oe = P?.width ?? 0, I = P?.height ?? 0, L = a + (c === "center" ? "" : "-" + c), se = typeof w == "number" ? w : {
46
- top: 0,
47
- right: 0,
48
- bottom: 0,
49
- left: 0,
50
- ...w
51
- }, R = Array.isArray(C) ? C : [C], de = R.length > 0, z = {
52
- padding: se,
53
- boundary: R.filter(ce),
54
- altBoundary: de
55
- }, { refs: fe, floatingStyles: B, placement: pe, isPositioned: V, middlewareData: H } = m({
56
- strategy: "fixed",
57
- placement: L,
58
- whileElementsMounted: (...e) => g(...e, { animationFrame: ne === "always" }),
59
- elements: { reference: k.anchor },
60
- middleware: [
61
- p({
62
- mainAxis: s + I,
63
- alignmentAxis: u
64
- }),
65
- f && v({
66
- mainAxis: !0,
67
- crossAxis: !1,
68
- limiter: te === "partial" ? h() : void 0,
69
- ...z
70
- }),
71
- f && _({ ...z }),
72
- b({
73
- ...z,
74
- apply: ({ elements: e, rects: t, availableWidth: n, availableHeight: r }) => {
75
- let { width: i, height: a } = t.reference, o = e.floating.style;
76
- o.setProperty("--radix-popper-available-width", `${n}px`), o.setProperty("--radix-popper-available-height", `${r}px`), o.setProperty("--radix-popper-anchor-width", `${i}px`), o.setProperty("--radix-popper-anchor-height", `${a}px`);
77
- }
78
- }),
79
- M && ee({
80
- element: M,
81
- padding: d
82
- }),
83
- le({
84
- arrowWidth: oe,
85
- arrowHeight: I
86
- }),
87
- E && y({
88
- strategy: "referenceHidden",
89
- ...z
90
- })
91
- ]
92
- }), [U, W] = ue(pe), me = l(D);
93
- o(() => {
94
- V && me?.();
95
- }, [V, me]);
96
- let G = H.arrow?.x, K = H.arrow?.y, he = H.arrow?.centerOffset !== 0, [q, ge] = S.useState();
97
- return o(() => {
98
- A && ge(window.getComputedStyle(A).zIndex);
99
- }, [A]), /* @__PURE__ */ T("div", {
100
- ref: fe.setFloating,
101
- "data-radix-popper-content-wrapper": "",
102
- style: {
103
- ...B,
104
- transform: V ? B.transform : "translate(0, -200%)",
105
- minWidth: "max-content",
106
- zIndex: q,
107
- "--radix-popper-transform-origin": [H.transformOrigin?.x, H.transformOrigin?.y].join(" "),
108
- ...H.hide?.referenceHidden && {
109
- visibility: "hidden",
110
- pointerEvents: "none"
111
- }
112
- },
113
- dir: e.dir,
114
- children: /* @__PURE__ */ T(ae, {
115
- scope: i,
116
- placedSide: U,
117
- onArrowChange: N,
118
- arrowX: G,
119
- arrowY: K,
120
- shouldHideArrow: he,
121
- children: /* @__PURE__ */ T(r.div, {
122
- "data-side": U,
123
- "data-align": W,
124
- ...O,
125
- ref: re,
126
- style: {
127
- ...O.style,
128
- animation: V ? void 0 : "none"
129
- }
130
- })
131
- })
132
- });
133
- });
134
- I.displayName = F;
135
- var L = "PopperArrow", se = {
136
- top: "bottom",
137
- right: "left",
138
- bottom: "top",
139
- left: "right"
140
- }, R = S.forwardRef(function(e, t) {
141
- let { __scopePopper: n, ...r } = e, i = oe(L, n), a = se[i.placedSide];
142
- return /* @__PURE__ */ T("span", {
143
- ref: i.onArrowChange,
144
- style: {
145
- position: "absolute",
146
- left: i.arrowX,
147
- top: i.arrowY,
148
- [a]: 0,
149
- transformOrigin: {
150
- top: "",
151
- right: "0 0",
152
- bottom: "center 0",
153
- left: "100% 0"
154
- }[i.placedSide],
155
- transform: {
156
- top: "translateY(100%)",
157
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
158
- bottom: "rotate(180deg)",
159
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
160
- }[i.placedSide],
161
- visibility: i.shouldHideArrow ? "hidden" : void 0
162
- },
163
- children: /* @__PURE__ */ T(O, {
164
- ...r,
165
- ref: t,
166
- style: {
167
- ...r.style,
168
- display: "block"
169
- }
170
- })
171
- });
172
- });
173
- R.displayName = L;
174
- function ce(e) {
175
- return e !== null;
176
- }
177
- var le = (e) => ({
178
- name: "transformOrigin",
179
- options: e,
180
- fn(t) {
181
- let { placement: n, rects: r, middlewareData: i } = t, a = i.arrow?.centerOffset !== 0, o = a ? 0 : e.arrowWidth, s = a ? 0 : e.arrowHeight, [c, l] = ue(n), u = {
182
- start: "0%",
183
- center: "50%",
184
- end: "100%"
185
- }[l], d = (i.arrow?.x ?? 0) + o / 2, f = (i.arrow?.y ?? 0) + s / 2, p = "", m = "";
186
- return c === "bottom" ? (p = a ? u : `${d}px`, m = `${-s}px`) : c === "top" ? (p = a ? u : `${d}px`, m = `${r.floating.height + s}px`) : c === "right" ? (p = `${-s}px`, m = a ? u : `${f}px`) : c === "left" && (p = `${r.floating.width + s}px`, m = a ? u : `${f}px`), { data: {
187
- x: p,
188
- y: m
189
- } };
190
- }
191
- });
192
- function ue(e) {
193
- let [t, n = "center"] = e.split("-");
194
- return [t, n];
195
- }
196
- var de = M, z = P, fe = I, B = R, pe = Object.freeze({
197
- position: "absolute",
198
- border: 0,
199
- width: 1,
200
- height: 1,
201
- padding: 0,
202
- margin: -1,
203
- overflow: "hidden",
204
- clip: "rect(0, 0, 0, 0)",
205
- whiteSpace: "nowrap",
206
- wordWrap: "normal"
207
- }), V = "VisuallyHidden", H = S.forwardRef((e, t) => /* @__PURE__ */ T(r.span, {
208
- ...e,
209
- ref: t,
210
- style: {
211
- ...pe,
212
- ...e.style
213
- }
214
- }));
215
- H.displayName = V;
216
- var U = H, [W, me] = i("Tooltip", [j]), G = j(), K = "TooltipProvider", he = 700, q = "tooltip.open", [ge, J] = W(K), _e = (e) => {
217
- let { __scopeTooltip: t, delayDuration: n = he, skipDelayDuration: r = 300, disableHoverableContent: i = !1, children: a } = e, o = S.useRef(!0), s = S.useRef(!1), c = S.useRef(0);
218
- return S.useEffect(() => {
219
- let e = c.current;
220
- return () => window.clearTimeout(e);
221
- }, []), /* @__PURE__ */ T(ge, {
222
- scope: t,
223
- isOpenDelayedRef: o,
224
- delayDuration: n,
225
- onOpen: S.useCallback(() => {
226
- window.clearTimeout(c.current), o.current = !1;
227
- }, []),
228
- onClose: S.useCallback(() => {
229
- window.clearTimeout(c.current), c.current = window.setTimeout(() => o.current = !0, r);
230
- }, [r]),
231
- isPointerInTransitRef: s,
232
- onPointerInTransitChange: S.useCallback((e) => {
233
- s.current = e;
234
- }, []),
235
- disableHoverableContent: i,
236
- children: a
237
- });
238
- };
239
- _e.displayName = K;
240
- var Y = "Tooltip", [ve, X] = W(Y), ye = (e) => {
241
- let { __scopeTooltip: t, children: n, open: r, defaultOpen: i, onOpenChange: a, disableHoverableContent: o, delayDuration: s } = e, l = J(Y, e.__scopeTooltip), d = G(t), [f, p] = S.useState(null), m = u(), h = S.useRef(0), g = o ?? l.disableHoverableContent, _ = s ?? l.delayDuration, v = S.useRef(!1), [y, b] = c({
242
- prop: r,
243
- defaultProp: i ?? !1,
244
- onChange: (e) => {
245
- e ? (l.onOpen(), document.dispatchEvent(new CustomEvent(q))) : l.onClose(), a?.(e);
246
- },
247
- caller: Y
248
- }), ee = S.useMemo(() => y ? v.current ? "delayed-open" : "instant-open" : "closed", [y]), x = S.useCallback(() => {
249
- window.clearTimeout(h.current), h.current = 0, v.current = !1, b(!0);
250
- }, [b]), C = S.useCallback(() => {
251
- window.clearTimeout(h.current), h.current = 0, b(!1);
252
- }, [b]), w = S.useCallback(() => {
253
- window.clearTimeout(h.current), h.current = window.setTimeout(() => {
254
- v.current = !0, b(!0), h.current = 0;
255
- }, _);
256
- }, [_, b]);
257
- return S.useEffect(() => () => {
258
- h.current &&= (window.clearTimeout(h.current), 0);
259
- }, []), /* @__PURE__ */ T(de, {
260
- ...d,
261
- children: /* @__PURE__ */ T(ve, {
262
- scope: t,
263
- contentId: m,
264
- open: y,
265
- stateAttribute: ee,
266
- trigger: f,
267
- onTriggerChange: p,
268
- onTriggerEnter: S.useCallback(() => {
269
- l.isOpenDelayedRef.current ? w() : x();
270
- }, [
271
- l.isOpenDelayedRef,
272
- w,
273
- x
274
- ]),
275
- onTriggerLeave: S.useCallback(() => {
276
- g ? C() : (window.clearTimeout(h.current), h.current = 0);
277
- }, [C, g]),
278
- onOpen: x,
279
- onClose: C,
280
- disableHoverableContent: g,
281
- children: n
282
- })
283
- });
284
- };
285
- ye.displayName = Y;
286
- var Z = "TooltipTrigger", be = S.forwardRef((e, i) => {
287
- let { __scopeTooltip: a, ...o } = e, s = X(Z, a), c = J(Z, a), l = G(a), u = t(i, S.useRef(null), s.onTriggerChange), d = S.useRef(!1), f = S.useRef(!1), p = S.useCallback(() => d.current = !1, []);
288
- return S.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ T(z, {
289
- asChild: !0,
290
- ...l,
291
- children: /* @__PURE__ */ T(r.button, {
292
- "aria-describedby": s.open ? s.contentId : void 0,
293
- "data-state": s.stateAttribute,
294
- ...o,
295
- ref: u,
296
- onPointerMove: n(e.onPointerMove, (e) => {
297
- e.pointerType !== "touch" && !f.current && !c.isPointerInTransitRef.current && (s.onTriggerEnter(), f.current = !0);
298
- }),
299
- onPointerLeave: n(e.onPointerLeave, () => {
300
- s.onTriggerLeave(), f.current = !1;
301
- }),
302
- onPointerDown: n(e.onPointerDown, () => {
303
- s.open && s.onClose(), d.current = !0, document.addEventListener("pointerup", p, { once: !0 });
304
- }),
305
- onFocus: n(e.onFocus, () => {
306
- d.current || s.onOpen();
307
- }),
308
- onBlur: n(e.onBlur, s.onClose),
309
- onClick: n(e.onClick, s.onClose)
310
- })
311
- });
312
- });
313
- be.displayName = Z;
314
- var Q = "TooltipPortal", [xe, Se] = W(Q, { forceMount: void 0 }), Ce = (e) => {
315
- let { __scopeTooltip: t, forceMount: n, children: r, container: i } = e, o = X(Q, t);
316
- return /* @__PURE__ */ T(xe, {
317
- scope: t,
318
- forceMount: n,
319
- children: /* @__PURE__ */ T(a, {
320
- present: n || o.open,
321
- children: /* @__PURE__ */ T(f, {
322
- asChild: !0,
323
- container: i,
324
- children: r
325
- })
326
- })
327
- });
328
- };
329
- Ce.displayName = Q;
330
- var $ = "TooltipContent", we = S.forwardRef((e, t) => {
331
- let n = Se($, e.__scopeTooltip), { forceMount: r = n.forceMount, side: i = "top", ...o } = e, s = X($, e.__scopeTooltip);
332
- return /* @__PURE__ */ T(a, {
333
- present: r || s.open,
334
- children: s.disableHoverableContent ? /* @__PURE__ */ T(ke, {
335
- side: i,
336
- ...o,
337
- ref: t
338
- }) : /* @__PURE__ */ T(Te, {
339
- side: i,
340
- ...o,
341
- ref: t
342
- })
343
- });
344
- }), Te = S.forwardRef((e, n) => {
345
- let r = X($, e.__scopeTooltip), i = J($, e.__scopeTooltip), a = S.useRef(null), o = t(n, a), [s, c] = S.useState(null), { trigger: l, onClose: u } = r, d = a.current, { onPointerInTransitChange: f } = i, p = S.useCallback(() => {
346
- c(null), f(!1);
347
- }, [f]), m = S.useCallback((e, t) => {
348
- let n = e.currentTarget, r = {
349
- x: e.clientX,
350
- y: e.clientY
351
- }, i = Ne(r, Me(r, n.getBoundingClientRect())), a = Pe(t.getBoundingClientRect());
352
- c(Ie([...i, ...a])), f(!0);
353
- }, [f]);
354
- return S.useEffect(() => () => p(), [p]), S.useEffect(() => {
355
- if (l && d) {
356
- let e = (e) => m(e, d), t = (e) => m(e, l);
357
- return l.addEventListener("pointerleave", e), d.addEventListener("pointerleave", t), () => {
358
- l.removeEventListener("pointerleave", e), d.removeEventListener("pointerleave", t);
359
- };
360
- }
361
- }, [
362
- l,
363
- d,
364
- m,
365
- p
366
- ]), S.useEffect(() => {
367
- if (s) {
368
- let e = (e) => {
369
- let t = e.target, n = {
370
- x: e.clientX,
371
- y: e.clientY
372
- }, r = l?.contains(t) || d?.contains(t), i = !Fe(n, s);
373
- r ? p() : i && (p(), u());
374
- };
375
- return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
376
- }
377
- }, [
378
- l,
379
- d,
380
- s,
381
- u,
382
- p
383
- ]), /* @__PURE__ */ T(ke, {
384
- ...e,
385
- ref: o
386
- });
387
- }), [Ee, De] = W(Y, { isInside: !1 }), Oe = s("TooltipContent"), ke = S.forwardRef((e, t) => {
388
- let { __scopeTooltip: n, children: r, "aria-label": i, onEscapeKeyDown: a, onPointerDownOutside: o, ...s } = e, c = X($, n), l = G(n), { onClose: u } = c;
389
- return S.useEffect(() => (document.addEventListener(q, u), () => document.removeEventListener(q, u)), [u]), S.useEffect(() => {
390
- if (c.trigger) {
391
- let e = (e) => {
392
- e.target?.contains(c.trigger) && u();
393
- };
394
- return window.addEventListener("scroll", e, { capture: !0 }), () => window.removeEventListener("scroll", e, { capture: !0 });
395
- }
396
- }, [c.trigger, u]), /* @__PURE__ */ T(d, {
397
- asChild: !0,
398
- disableOutsidePointerEvents: !1,
399
- onEscapeKeyDown: a,
400
- onPointerDownOutside: o,
401
- onFocusOutside: (e) => e.preventDefault(),
402
- onDismiss: u,
403
- children: /* @__PURE__ */ E(fe, {
404
- "data-state": c.stateAttribute,
405
- ...l,
406
- ...s,
407
- ref: t,
408
- style: {
409
- ...s.style,
410
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
411
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
412
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
413
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
414
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
415
- },
416
- children: [/* @__PURE__ */ T(Oe, { children: r }), /* @__PURE__ */ T(Ee, {
417
- scope: n,
418
- isInside: !0,
419
- children: /* @__PURE__ */ T(U, {
420
- id: c.contentId,
421
- role: "tooltip",
422
- children: i || r
423
- })
424
- })]
425
- })
426
- });
427
- });
428
- we.displayName = $;
429
- var Ae = "TooltipArrow", je = S.forwardRef((e, t) => {
430
- let { __scopeTooltip: n, ...r } = e, i = G(n);
431
- return De(Ae, n).isInside ? null : /* @__PURE__ */ T(B, {
432
- ...i,
433
- ...r,
434
- ref: t
435
- });
436
- });
437
- je.displayName = Ae;
438
- function Me(e, t) {
439
- let n = Math.abs(t.top - e.y), r = Math.abs(t.bottom - e.y), i = Math.abs(t.right - e.x), a = Math.abs(t.left - e.x);
440
- switch (Math.min(n, r, i, a)) {
441
- case a: return "left";
442
- case i: return "right";
443
- case n: return "top";
444
- case r: return "bottom";
445
- default: throw Error("unreachable");
446
- }
447
- }
448
- function Ne(e, t, n = 5) {
449
- let r = [];
450
- switch (t) {
451
- case "top":
452
- r.push({
453
- x: e.x - n,
454
- y: e.y + n
455
- }, {
456
- x: e.x + n,
457
- y: e.y + n
458
- });
459
- break;
460
- case "bottom":
461
- r.push({
462
- x: e.x - n,
463
- y: e.y - n
464
- }, {
465
- x: e.x + n,
466
- y: e.y - n
467
- });
468
- break;
469
- case "left":
470
- r.push({
471
- x: e.x + n,
472
- y: e.y - n
473
- }, {
474
- x: e.x + n,
475
- y: e.y + n
476
- });
477
- break;
478
- case "right":
479
- r.push({
480
- x: e.x - n,
481
- y: e.y - n
482
- }, {
483
- x: e.x - n,
484
- y: e.y + n
485
- });
486
- break;
487
- }
488
- return r;
489
- }
490
- function Pe(e) {
491
- let { top: t, right: n, bottom: r, left: i } = e;
492
- return [
493
- {
494
- x: i,
495
- y: t
496
- },
497
- {
498
- x: n,
499
- y: t
500
- },
501
- {
502
- x: n,
503
- y: r
504
- },
505
- {
506
- x: i,
507
- y: r
508
- }
509
- ];
510
- }
511
- function Fe(e, t) {
512
- let { x: n, y: r } = e, i = !1;
513
- for (let e = 0, a = t.length - 1; e < t.length; a = e++) {
514
- let o = t[e], s = t[a], c = o.x, l = o.y, u = s.x, d = s.y;
515
- l > r != d > r && n < (u - c) * (r - l) / (d - l) + c && (i = !i);
516
- }
517
- return i;
518
- }
519
- function Ie(e) {
520
- let t = e.slice();
521
- return t.sort((e, t) => e.x < t.x ? -1 : e.x > t.x ? 1 : e.y < t.y ? -1 : +(e.y > t.y)), Le(t);
522
- }
523
- function Le(e) {
524
- if (e.length <= 1) return e.slice();
525
- let t = [];
526
- for (let n = 0; n < e.length; n++) {
527
- let r = e[n];
528
- for (; t.length >= 2;) {
529
- let e = t[t.length - 1], n = t[t.length - 2];
530
- if ((e.x - n.x) * (r.y - n.y) >= (e.y - n.y) * (r.x - n.x)) t.pop();
531
- else break;
532
- }
533
- t.push(r);
534
- }
535
- t.pop();
536
- let n = [];
537
- for (let t = e.length - 1; t >= 0; t--) {
538
- let r = e[t];
539
- for (; n.length >= 2;) {
540
- let e = n[n.length - 1], t = n[n.length - 2];
541
- if ((e.x - t.x) * (r.y - t.y) >= (e.y - t.y) * (r.x - t.x)) n.pop();
542
- else break;
543
- }
544
- n.push(r);
545
- }
546
- return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
547
- }
548
- var Re = {
549
- tooltipContent: "_tooltipContent_12gjy_1",
550
- tooltipArrow: "_tooltipArrow_12gjy_8",
551
- fadeIn: "_fadeIn_12gjy_1"
552
- }, ze = e(({ children: e, content: t, className: n, style: r, hoverDelayDuration: i = 1e3 }, a) => {
553
- let [o, s] = te(!1), c = w(null), l = w("keyboard"), u = () => {
554
- c.current !== null && (clearTimeout(c.current), c.current = null);
555
- }, d = () => {
556
- l.current = "pointer";
557
- }, f = () => {
558
- l.current = "keyboard";
559
- }, p = () => {
560
- d(), u(), c.current = setTimeout(() => {
561
- s(!0);
562
- }, i);
563
- }, m = () => {
564
- u(), s(!1);
565
- };
566
- return C(() => () => {
567
- u();
568
- }, []), /* @__PURE__ */ T(_e, { children: /* @__PURE__ */ E(ye, {
569
- open: o,
570
- onOpenChange: (e) => {
571
- e && l.current === "pointer" || s(e);
572
- },
573
- children: [/* @__PURE__ */ T(be, {
574
- asChild: !0,
575
- children: /* @__PURE__ */ T("div", {
576
- ref: a,
577
- className: n,
578
- style: r,
579
- onMouseEnter: p,
580
- onMouseLeave: m,
581
- onPointerDown: d,
582
- onPointerEnter: d,
583
- onMouseDown: d,
584
- onKeyDownCapture: f,
585
- onFocus: () => {
586
- l.current !== "pointer" && (u(), s(!0));
587
- },
588
- onBlur: m,
589
- onTouchStart: m,
590
- children: e
591
- })
592
- }), /* @__PURE__ */ E(we, {
593
- className: Re.tooltipContent,
594
- sideOffset: 5,
595
- children: [/* @__PURE__ */ T(je, { className: Re.tooltipArrow }), /* @__PURE__ */ T("span", { children: t })]
596
- })]
597
- }) });
598
- });
599
- //#endregion
600
- export { ze as t };