@pdf-viewer/react 1.9.0-beta.3 → 1.9.0-beta.4

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