@pdf-viewer/react 1.9.0-beta.1 → 1.9.0-beta.2

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