@pdf-viewer/react 1.8.1-rc.0 → 1.8.1-rc.1

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