@krosoft/react 0.0.71 → 0.0.73

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 (40) hide show
  1. package/dist/KpiCards-Bjsd4bSz.js +40 -0
  2. package/dist/{SearchInput-LIey3bo9.js → SearchInput-Bu4wb0gI.js} +10 -9
  3. package/dist/ThemeSelector-DMgBLEYm.js +49 -0
  4. package/dist/Topbar-CFALRIJn.js +168 -0
  5. package/dist/{badge-Cj2EQgcL.js → badge-C4pCH7IL.js} +1 -1
  6. package/dist/components/core/cards/KpiCards.d.ts.map +1 -1
  7. package/dist/components/core/cards/index.js +1 -1
  8. package/dist/components/core/index.d.ts +1 -0
  9. package/dist/components/core/index.d.ts.map +1 -1
  10. package/dist/components/core/index.js +10 -8
  11. package/dist/components/core/inputs/index.js +1 -1
  12. package/dist/components/core/navbar/index.js +1 -1
  13. package/dist/components/core/theme/ThemeSelector.d.ts +8 -0
  14. package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -0
  15. package/dist/components/core/theme/index.d.ts +3 -0
  16. package/dist/components/core/theme/index.d.ts.map +1 -0
  17. package/dist/components/core/theme/index.js +4 -0
  18. package/dist/components/index.js +41 -30
  19. package/dist/components/ui/index.d.ts +1 -0
  20. package/dist/components/ui/index.d.ts.map +1 -1
  21. package/dist/components/ui/index.js +27 -18
  22. package/dist/components/ui/select.d.ts +14 -0
  23. package/dist/components/ui/select.d.ts.map +1 -0
  24. package/dist/hooks/index.d.ts +2 -0
  25. package/dist/hooks/index.d.ts.map +1 -1
  26. package/dist/hooks/index.js +16 -112
  27. package/dist/hooks/ui/useTheme.d.ts +20 -0
  28. package/dist/hooks/ui/useTheme.d.ts.map +1 -0
  29. package/dist/index-BQOmHRsD.js +1662 -0
  30. package/dist/select-CdiR6cO0.js +2020 -0
  31. package/dist/tailwind/index.d.ts +1 -1
  32. package/dist/tailwind/index.d.ts.map +1 -1
  33. package/dist/tailwind/index.js +3 -1
  34. package/dist/{toast-B6CC_ory.js → toast-BypnW71k.js} +1 -1
  35. package/dist/tooltip-Dep8OR3c.js +779 -0
  36. package/dist/useTheme-D__o7mLN.js +122 -0
  37. package/package.json +10 -2
  38. package/dist/KpiCards-D4Cy8CLT.js +0 -38
  39. package/dist/Topbar-CtXJ337W.js +0 -2314
  40. package/dist/index-BNCR478R.js +0 -272
@@ -0,0 +1,779 @@
1
+ import { jsx as v, jsxs as Ve } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { a as qe, u as O, d as Ze, e as A, f as V, g as Ke, h as Je, o as Qe, s as et, l as tt, i as nt, j as rt, k as ot, m as st, n as it, p as U, q as de, r as at, t as ct, v as lt } from "./index-BQOmHRsD.js";
4
+ import * as dt from "react-dom";
5
+ import { c as ut } from "./index-gWiv5-6R.js";
6
+ var pt = [
7
+ "a",
8
+ "button",
9
+ "div",
10
+ "form",
11
+ "h2",
12
+ "h3",
13
+ "img",
14
+ "input",
15
+ "label",
16
+ "li",
17
+ "nav",
18
+ "ol",
19
+ "p",
20
+ "select",
21
+ "span",
22
+ "svg",
23
+ "ul"
24
+ ], N = pt.reduce((e, t) => {
25
+ const n = qe(`Primitive.${t}`), r = s.forwardRef((o, i) => {
26
+ const { asChild: l, ...u } = o, a = l ? n : t;
27
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ v(a, { ...u, ref: i });
28
+ });
29
+ return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
30
+ }, {});
31
+ function ft(e, t) {
32
+ e && dt.flushSync(() => e.dispatchEvent(t));
33
+ }
34
+ var ht = "DismissableLayer", z = "dismissableLayer.update", vt = "dismissableLayer.pointerDownOutside", mt = "dismissableLayer.focusOutside", ce, ue = s.createContext({
35
+ layers: /* @__PURE__ */ new Set(),
36
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
37
+ branches: /* @__PURE__ */ new Set()
38
+ }), pe = s.forwardRef(
39
+ (e, t) => {
40
+ const {
41
+ disableOutsidePointerEvents: n = !1,
42
+ onEscapeKeyDown: r,
43
+ onPointerDownOutside: o,
44
+ onFocusOutside: i,
45
+ onInteractOutside: l,
46
+ onDismiss: u,
47
+ ...a
48
+ } = e, c = s.useContext(ue), [d, h] = s.useState(null), f = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = s.useState({}), m = O(t, (g) => h(g)), y = Array.from(c.layers), [w] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), P = y.indexOf(w), E = d ? y.indexOf(d) : -1, b = c.layersWithOutsidePointerEventsDisabled.size > 0, C = E >= P, T = wt((g) => {
49
+ const R = g.target, I = [...c.branches].some((L) => L.contains(R));
50
+ !C || I || (o == null || o(g), l == null || l(g), g.defaultPrevented || u == null || u());
51
+ }, f), x = Et((g) => {
52
+ const R = g.target;
53
+ [...c.branches].some((L) => L.contains(R)) || (i == null || i(g), l == null || l(g), g.defaultPrevented || u == null || u());
54
+ }, f);
55
+ return Ze((g) => {
56
+ E === c.layers.size - 1 && (r == null || r(g), !g.defaultPrevented && u && (g.preventDefault(), u()));
57
+ }, f), s.useEffect(() => {
58
+ if (d)
59
+ return n && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (ce = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(d)), c.layers.add(d), le(), () => {
60
+ n && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = ce);
61
+ };
62
+ }, [d, f, n, c]), s.useEffect(() => () => {
63
+ d && (c.layers.delete(d), c.layersWithOutsidePointerEventsDisabled.delete(d), le());
64
+ }, [d, c]), s.useEffect(() => {
65
+ const g = () => p({});
66
+ return document.addEventListener(z, g), () => document.removeEventListener(z, g);
67
+ }, []), /* @__PURE__ */ v(
68
+ N.div,
69
+ {
70
+ ...a,
71
+ ref: m,
72
+ style: {
73
+ pointerEvents: b ? C ? "auto" : "none" : void 0,
74
+ ...e.style
75
+ },
76
+ onFocusCapture: A(e.onFocusCapture, x.onFocusCapture),
77
+ onBlurCapture: A(e.onBlurCapture, x.onBlurCapture),
78
+ onPointerDownCapture: A(
79
+ e.onPointerDownCapture,
80
+ T.onPointerDownCapture
81
+ )
82
+ }
83
+ );
84
+ }
85
+ );
86
+ pe.displayName = ht;
87
+ var yt = "DismissableLayerBranch", gt = s.forwardRef((e, t) => {
88
+ const n = s.useContext(ue), r = s.useRef(null), o = O(t, r);
89
+ return s.useEffect(() => {
90
+ const i = r.current;
91
+ if (i)
92
+ return n.branches.add(i), () => {
93
+ n.branches.delete(i);
94
+ };
95
+ }, [n.branches]), /* @__PURE__ */ v(N.div, { ...e, ref: o });
96
+ });
97
+ gt.displayName = yt;
98
+ function wt(e, t = globalThis == null ? void 0 : globalThis.document) {
99
+ const n = V(e), r = s.useRef(!1), o = s.useRef(() => {
100
+ });
101
+ return s.useEffect(() => {
102
+ const i = (u) => {
103
+ if (u.target && !r.current) {
104
+ let a = function() {
105
+ fe(
106
+ vt,
107
+ n,
108
+ c,
109
+ { discrete: !0 }
110
+ );
111
+ };
112
+ const c = { originalEvent: u };
113
+ u.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = a, t.addEventListener("click", o.current, { once: !0 })) : a();
114
+ } else
115
+ t.removeEventListener("click", o.current);
116
+ r.current = !1;
117
+ }, l = window.setTimeout(() => {
118
+ t.addEventListener("pointerdown", i);
119
+ }, 0);
120
+ return () => {
121
+ window.clearTimeout(l), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
122
+ };
123
+ }, [t, n]), {
124
+ // ensures we check React component tree (not just DOM tree)
125
+ onPointerDownCapture: () => r.current = !0
126
+ };
127
+ }
128
+ function Et(e, t = globalThis == null ? void 0 : globalThis.document) {
129
+ const n = V(e), r = s.useRef(!1);
130
+ return s.useEffect(() => {
131
+ const o = (i) => {
132
+ i.target && !r.current && fe(mt, n, { originalEvent: i }, {
133
+ discrete: !1
134
+ });
135
+ };
136
+ return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
137
+ }, [t, n]), {
138
+ onFocusCapture: () => r.current = !0,
139
+ onBlurCapture: () => r.current = !1
140
+ };
141
+ }
142
+ function le() {
143
+ const e = new CustomEvent(z);
144
+ document.dispatchEvent(e);
145
+ }
146
+ function fe(e, t, n, { discrete: r }) {
147
+ const o = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
148
+ t && o.addEventListener(e, t, { once: !0 }), r ? ft(o, i) : o.dispatchEvent(i);
149
+ }
150
+ var Pt = "Arrow", he = s.forwardRef((e, t) => {
151
+ const { children: n, width: r = 10, height: o = 5, ...i } = e;
152
+ return /* @__PURE__ */ v(
153
+ N.svg,
154
+ {
155
+ ...i,
156
+ ref: t,
157
+ width: r,
158
+ height: o,
159
+ viewBox: "0 0 30 10",
160
+ preserveAspectRatio: "none",
161
+ children: e.asChild ? n : /* @__PURE__ */ v("polygon", { points: "0,0 30,0 15,10" })
162
+ }
163
+ );
164
+ });
165
+ he.displayName = Pt;
166
+ var Ct = he, q = "Popper", [ve, me] = de(q), [xt, ye] = ve(q), ge = (e) => {
167
+ const { __scopePopper: t, children: n } = e, [r, o] = s.useState(null);
168
+ return /* @__PURE__ */ v(xt, { scope: t, anchor: r, onAnchorChange: o, children: n });
169
+ };
170
+ ge.displayName = q;
171
+ var we = "PopperAnchor", Ee = s.forwardRef(
172
+ (e, t) => {
173
+ const { __scopePopper: n, virtualRef: r, ...o } = e, i = ye(we, n), l = s.useRef(null), u = O(t, l), a = s.useRef(null);
174
+ return s.useEffect(() => {
175
+ const c = a.current;
176
+ a.current = (r == null ? void 0 : r.current) || l.current, c !== a.current && i.onAnchorChange(a.current);
177
+ }), r ? null : /* @__PURE__ */ v(N.div, { ...o, ref: u });
178
+ }
179
+ );
180
+ Ee.displayName = we;
181
+ var Z = "PopperContent", [bt, Tt] = ve(Z), Pe = s.forwardRef(
182
+ (e, t) => {
183
+ var te, ne, re, oe, se, ie;
184
+ const {
185
+ __scopePopper: n,
186
+ side: r = "bottom",
187
+ sideOffset: o = 0,
188
+ align: i = "center",
189
+ alignOffset: l = 0,
190
+ arrowPadding: u = 0,
191
+ avoidCollisions: a = !0,
192
+ collisionBoundary: c = [],
193
+ collisionPadding: d = 0,
194
+ sticky: h = "partial",
195
+ hideWhenDetached: f = !1,
196
+ updatePositionStrategy: p = "optimized",
197
+ onPlaced: m,
198
+ ...y
199
+ } = e, w = ye(Z, n), [P, E] = s.useState(null), b = O(t, (_) => E(_)), [C, T] = s.useState(null), x = Ke(C), g = (x == null ? void 0 : x.width) ?? 0, R = (x == null ? void 0 : x.height) ?? 0, I = r + (i !== "center" ? "-" + i : ""), L = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, J = Array.isArray(c) ? c : [c], Ie = J.length > 0, k = {
200
+ padding: L,
201
+ boundary: J.filter(Rt),
202
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
203
+ altBoundary: Ie
204
+ }, { refs: ke, floatingStyles: Q, placement: He, isPositioned: H, middlewareData: D } = Je({
205
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
206
+ strategy: "fixed",
207
+ placement: I,
208
+ whileElementsMounted: (..._) => it(..._, {
209
+ animationFrame: p === "always"
210
+ }),
211
+ elements: {
212
+ reference: w.anchor
213
+ },
214
+ middleware: [
215
+ Qe({ mainAxis: o + R, alignmentAxis: l }),
216
+ a && et({
217
+ mainAxis: !0,
218
+ crossAxis: !1,
219
+ limiter: h === "partial" ? tt() : void 0,
220
+ ...k
221
+ }),
222
+ a && nt({ ...k }),
223
+ rt({
224
+ ...k,
225
+ apply: ({ elements: _, rects: ae, availableWidth: Ye, availableHeight: ze }) => {
226
+ const { width: Ge, height: Xe } = ae.reference, W = _.floating.style;
227
+ W.setProperty("--radix-popper-available-width", `${Ye}px`), W.setProperty("--radix-popper-available-height", `${ze}px`), W.setProperty("--radix-popper-anchor-width", `${Ge}px`), W.setProperty("--radix-popper-anchor-height", `${Xe}px`);
228
+ }
229
+ }),
230
+ C && ot({ element: C, padding: u }),
231
+ Ot({ arrowWidth: g, arrowHeight: R }),
232
+ f && st({ strategy: "referenceHidden", ...k })
233
+ ]
234
+ }), [ee, Fe] = be(He), F = V(m);
235
+ U(() => {
236
+ H && (F == null || F());
237
+ }, [H, F]);
238
+ const We = (te = D.arrow) == null ? void 0 : te.x, $e = (ne = D.arrow) == null ? void 0 : ne.y, Ue = ((re = D.arrow) == null ? void 0 : re.centerOffset) !== 0, [Be, je] = s.useState();
239
+ return U(() => {
240
+ P && je(window.getComputedStyle(P).zIndex);
241
+ }, [P]), /* @__PURE__ */ v(
242
+ "div",
243
+ {
244
+ ref: ke.setFloating,
245
+ "data-radix-popper-content-wrapper": "",
246
+ style: {
247
+ ...Q,
248
+ transform: H ? Q.transform : "translate(0, -200%)",
249
+ // keep off the page when measuring
250
+ minWidth: "max-content",
251
+ zIndex: Be,
252
+ "--radix-popper-transform-origin": [
253
+ (oe = D.transformOrigin) == null ? void 0 : oe.x,
254
+ (se = D.transformOrigin) == null ? void 0 : se.y
255
+ ].join(" "),
256
+ // hide the content if using the hide middleware and should be hidden
257
+ // set visibility to hidden and disable pointer events so the UI behaves
258
+ // as if the PopperContent isn't there at all
259
+ ...((ie = D.hide) == null ? void 0 : ie.referenceHidden) && {
260
+ visibility: "hidden",
261
+ pointerEvents: "none"
262
+ }
263
+ },
264
+ dir: e.dir,
265
+ children: /* @__PURE__ */ v(
266
+ bt,
267
+ {
268
+ scope: n,
269
+ placedSide: ee,
270
+ onArrowChange: T,
271
+ arrowX: We,
272
+ arrowY: $e,
273
+ shouldHideArrow: Ue,
274
+ children: /* @__PURE__ */ v(
275
+ N.div,
276
+ {
277
+ "data-side": ee,
278
+ "data-align": Fe,
279
+ ...y,
280
+ ref: b,
281
+ style: {
282
+ ...y.style,
283
+ // if the PopperContent hasn't been placed yet (not all measurements done)
284
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
285
+ animation: H ? void 0 : "none"
286
+ }
287
+ }
288
+ )
289
+ }
290
+ )
291
+ }
292
+ );
293
+ }
294
+ );
295
+ Pe.displayName = Z;
296
+ var Ce = "PopperArrow", At = {
297
+ top: "bottom",
298
+ right: "left",
299
+ bottom: "top",
300
+ left: "right"
301
+ }, xe = s.forwardRef(function(t, n) {
302
+ const { __scopePopper: r, ...o } = t, i = Tt(Ce, r), l = At[i.placedSide];
303
+ return (
304
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
305
+ // doesn't report size as we'd expect on SVG elements.
306
+ // it reports their bounding box which is effectively the largest path inside the SVG.
307
+ /* @__PURE__ */ v(
308
+ "span",
309
+ {
310
+ ref: i.onArrowChange,
311
+ style: {
312
+ position: "absolute",
313
+ left: i.arrowX,
314
+ top: i.arrowY,
315
+ [l]: 0,
316
+ transformOrigin: {
317
+ top: "",
318
+ right: "0 0",
319
+ bottom: "center 0",
320
+ left: "100% 0"
321
+ }[i.placedSide],
322
+ transform: {
323
+ top: "translateY(100%)",
324
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
325
+ bottom: "rotate(180deg)",
326
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
327
+ }[i.placedSide],
328
+ visibility: i.shouldHideArrow ? "hidden" : void 0
329
+ },
330
+ children: /* @__PURE__ */ v(
331
+ Ct,
332
+ {
333
+ ...o,
334
+ ref: n,
335
+ style: {
336
+ ...o.style,
337
+ // ensures the element can be measured correctly (mostly for if SVG)
338
+ display: "block"
339
+ }
340
+ }
341
+ )
342
+ }
343
+ )
344
+ );
345
+ });
346
+ xe.displayName = Ce;
347
+ function Rt(e) {
348
+ return e !== null;
349
+ }
350
+ var Ot = (e) => ({
351
+ name: "transformOrigin",
352
+ options: e,
353
+ fn(t) {
354
+ var w, P, E;
355
+ const { placement: n, rects: r, middlewareData: o } = t, l = ((w = o.arrow) == null ? void 0 : w.centerOffset) !== 0, u = l ? 0 : e.arrowWidth, a = l ? 0 : e.arrowHeight, [c, d] = be(n), h = { start: "0%", center: "50%", end: "100%" }[d], f = (((P = o.arrow) == null ? void 0 : P.x) ?? 0) + u / 2, p = (((E = o.arrow) == null ? void 0 : E.y) ?? 0) + a / 2;
356
+ let m = "", y = "";
357
+ return c === "bottom" ? (m = l ? h : `${f}px`, y = `${-a}px`) : c === "top" ? (m = l ? h : `${f}px`, y = `${r.floating.height + a}px`) : c === "right" ? (m = `${-a}px`, y = l ? h : `${p}px`) : c === "left" && (m = `${r.floating.width + a}px`, y = l ? h : `${p}px`), { data: { x: m, y } };
358
+ }
359
+ });
360
+ function be(e) {
361
+ const [t, n = "center"] = e.split("-");
362
+ return [t, n];
363
+ }
364
+ var Nt = ge, Dt = Ee, St = Pe, Lt = xe;
365
+ function _t(e, t) {
366
+ return s.useReducer((n, r) => t[n][r] ?? n, e);
367
+ }
368
+ var Te = (e) => {
369
+ const { present: t, children: n } = e, r = Mt(t), o = typeof n == "function" ? n({ present: r.isPresent }) : s.Children.only(n), i = O(r.ref, It(o));
370
+ return typeof n == "function" || r.isPresent ? s.cloneElement(o, { ref: i }) : null;
371
+ };
372
+ Te.displayName = "Presence";
373
+ function Mt(e) {
374
+ const [t, n] = s.useState(), r = s.useRef(null), o = s.useRef(e), i = s.useRef("none"), l = e ? "mounted" : "unmounted", [u, a] = _t(l, {
375
+ mounted: {
376
+ UNMOUNT: "unmounted",
377
+ ANIMATION_OUT: "unmountSuspended"
378
+ },
379
+ unmountSuspended: {
380
+ MOUNT: "mounted",
381
+ ANIMATION_END: "unmounted"
382
+ },
383
+ unmounted: {
384
+ MOUNT: "mounted"
385
+ }
386
+ });
387
+ return s.useEffect(() => {
388
+ const c = $(r.current);
389
+ i.current = u === "mounted" ? c : "none";
390
+ }, [u]), U(() => {
391
+ const c = r.current, d = o.current;
392
+ if (d !== e) {
393
+ const f = i.current, p = $(c);
394
+ e ? a("MOUNT") : p === "none" || (c == null ? void 0 : c.display) === "none" ? a("UNMOUNT") : a(d && f !== p ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
395
+ }
396
+ }, [e, a]), U(() => {
397
+ if (t) {
398
+ let c;
399
+ const d = t.ownerDocument.defaultView ?? window, h = (p) => {
400
+ const y = $(r.current).includes(CSS.escape(p.animationName));
401
+ if (p.target === t && y && (a("ANIMATION_END"), !o.current)) {
402
+ const w = t.style.animationFillMode;
403
+ t.style.animationFillMode = "forwards", c = d.setTimeout(() => {
404
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = w);
405
+ });
406
+ }
407
+ }, f = (p) => {
408
+ p.target === t && (i.current = $(r.current));
409
+ };
410
+ return t.addEventListener("animationstart", f), t.addEventListener("animationcancel", h), t.addEventListener("animationend", h), () => {
411
+ d.clearTimeout(c), t.removeEventListener("animationstart", f), t.removeEventListener("animationcancel", h), t.removeEventListener("animationend", h);
412
+ };
413
+ } else
414
+ a("ANIMATION_END");
415
+ }, [t, a]), {
416
+ isPresent: ["mounted", "unmountSuspended"].includes(u),
417
+ ref: s.useCallback((c) => {
418
+ r.current = c ? getComputedStyle(c) : null, n(c);
419
+ }, [])
420
+ };
421
+ }
422
+ function $(e) {
423
+ return (e == null ? void 0 : e.animationName) || "none";
424
+ }
425
+ function It(e) {
426
+ var r, o;
427
+ let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
428
+ return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
429
+ }
430
+ var kt = Object.freeze({
431
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
432
+ position: "absolute",
433
+ border: 0,
434
+ width: 1,
435
+ height: 1,
436
+ padding: 0,
437
+ margin: -1,
438
+ overflow: "hidden",
439
+ clip: "rect(0, 0, 0, 0)",
440
+ whiteSpace: "nowrap",
441
+ wordWrap: "normal"
442
+ }), Ht = "VisuallyHidden", Ae = s.forwardRef(
443
+ (e, t) => /* @__PURE__ */ v(
444
+ N.span,
445
+ {
446
+ ...e,
447
+ ref: t,
448
+ style: { ...kt, ...e.style }
449
+ }
450
+ )
451
+ );
452
+ Ae.displayName = Ht;
453
+ var Ft = Ae, [B] = de("Tooltip", [
454
+ me
455
+ ]), j = me(), Re = "TooltipProvider", Wt = 700, G = "tooltip.open", [$t, K] = B(Re), Oe = (e) => {
456
+ const {
457
+ __scopeTooltip: t,
458
+ delayDuration: n = Wt,
459
+ skipDelayDuration: r = 300,
460
+ disableHoverableContent: o = !1,
461
+ children: i
462
+ } = e, l = s.useRef(!0), u = s.useRef(!1), a = s.useRef(0);
463
+ return s.useEffect(() => {
464
+ const c = a.current;
465
+ return () => window.clearTimeout(c);
466
+ }, []), /* @__PURE__ */ v(
467
+ $t,
468
+ {
469
+ scope: t,
470
+ isOpenDelayedRef: l,
471
+ delayDuration: n,
472
+ onOpen: s.useCallback(() => {
473
+ window.clearTimeout(a.current), l.current = !1;
474
+ }, []),
475
+ onClose: s.useCallback(() => {
476
+ window.clearTimeout(a.current), a.current = window.setTimeout(
477
+ () => l.current = !0,
478
+ r
479
+ );
480
+ }, [r]),
481
+ isPointerInTransitRef: u,
482
+ onPointerInTransitChange: s.useCallback((c) => {
483
+ u.current = c;
484
+ }, []),
485
+ disableHoverableContent: o,
486
+ children: i
487
+ }
488
+ );
489
+ };
490
+ Oe.displayName = Re;
491
+ var M = "Tooltip", [Ut, Y] = B(M), Ne = (e) => {
492
+ const {
493
+ __scopeTooltip: t,
494
+ children: n,
495
+ open: r,
496
+ defaultOpen: o,
497
+ onOpenChange: i,
498
+ disableHoverableContent: l,
499
+ delayDuration: u
500
+ } = e, a = K(M, e.__scopeTooltip), c = j(t), [d, h] = s.useState(null), f = ct(), p = s.useRef(0), m = l ?? a.disableHoverableContent, y = u ?? a.delayDuration, w = s.useRef(!1), [P, E] = lt({
501
+ prop: r,
502
+ defaultProp: o ?? !1,
503
+ onChange: (g) => {
504
+ g ? (a.onOpen(), document.dispatchEvent(new CustomEvent(G))) : a.onClose(), i == null || i(g);
505
+ },
506
+ caller: M
507
+ }), b = s.useMemo(() => P ? w.current ? "delayed-open" : "instant-open" : "closed", [P]), C = s.useCallback(() => {
508
+ window.clearTimeout(p.current), p.current = 0, w.current = !1, E(!0);
509
+ }, [E]), T = s.useCallback(() => {
510
+ window.clearTimeout(p.current), p.current = 0, E(!1);
511
+ }, [E]), x = s.useCallback(() => {
512
+ window.clearTimeout(p.current), p.current = window.setTimeout(() => {
513
+ w.current = !0, E(!0), p.current = 0;
514
+ }, y);
515
+ }, [y, E]);
516
+ return s.useEffect(() => () => {
517
+ p.current && (window.clearTimeout(p.current), p.current = 0);
518
+ }, []), /* @__PURE__ */ v(Nt, { ...c, children: /* @__PURE__ */ v(
519
+ Ut,
520
+ {
521
+ scope: t,
522
+ contentId: f,
523
+ open: P,
524
+ stateAttribute: b,
525
+ trigger: d,
526
+ onTriggerChange: h,
527
+ onTriggerEnter: s.useCallback(() => {
528
+ a.isOpenDelayedRef.current ? x() : C();
529
+ }, [a.isOpenDelayedRef, x, C]),
530
+ onTriggerLeave: s.useCallback(() => {
531
+ m ? T() : (window.clearTimeout(p.current), p.current = 0);
532
+ }, [T, m]),
533
+ onOpen: C,
534
+ onClose: T,
535
+ disableHoverableContent: m,
536
+ children: n
537
+ }
538
+ ) });
539
+ };
540
+ Ne.displayName = M;
541
+ var X = "TooltipTrigger", De = s.forwardRef(
542
+ (e, t) => {
543
+ const { __scopeTooltip: n, ...r } = e, o = Y(X, n), i = K(X, n), l = j(n), u = s.useRef(null), a = O(t, u, o.onTriggerChange), c = s.useRef(!1), d = s.useRef(!1), h = s.useCallback(() => c.current = !1, []);
544
+ return s.useEffect(() => () => document.removeEventListener("pointerup", h), [h]), /* @__PURE__ */ v(Dt, { asChild: !0, ...l, children: /* @__PURE__ */ v(
545
+ N.button,
546
+ {
547
+ "aria-describedby": o.open ? o.contentId : void 0,
548
+ "data-state": o.stateAttribute,
549
+ ...r,
550
+ ref: a,
551
+ onPointerMove: A(e.onPointerMove, (f) => {
552
+ f.pointerType !== "touch" && !d.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), d.current = !0);
553
+ }),
554
+ onPointerLeave: A(e.onPointerLeave, () => {
555
+ o.onTriggerLeave(), d.current = !1;
556
+ }),
557
+ onPointerDown: A(e.onPointerDown, () => {
558
+ o.open && o.onClose(), c.current = !0, document.addEventListener("pointerup", h, { once: !0 });
559
+ }),
560
+ onFocus: A(e.onFocus, () => {
561
+ c.current || o.onOpen();
562
+ }),
563
+ onBlur: A(e.onBlur, o.onClose),
564
+ onClick: A(e.onClick, o.onClose)
565
+ }
566
+ ) });
567
+ }
568
+ );
569
+ De.displayName = X;
570
+ var Bt = "TooltipPortal", [ln, jt] = B(Bt, {
571
+ forceMount: void 0
572
+ }), S = "TooltipContent", Se = s.forwardRef(
573
+ (e, t) => {
574
+ const n = jt(S, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...i } = e, l = Y(S, e.__scopeTooltip);
575
+ return /* @__PURE__ */ v(Te, { present: r || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ v(Le, { side: o, ...i, ref: t }) : /* @__PURE__ */ v(Yt, { side: o, ...i, ref: t }) });
576
+ }
577
+ ), Yt = s.forwardRef((e, t) => {
578
+ const n = Y(S, e.__scopeTooltip), r = K(S, e.__scopeTooltip), o = s.useRef(null), i = O(t, o), [l, u] = s.useState(null), { trigger: a, onClose: c } = n, d = o.current, { onPointerInTransitChange: h } = r, f = s.useCallback(() => {
579
+ u(null), h(!1);
580
+ }, [h]), p = s.useCallback(
581
+ (m, y) => {
582
+ const w = m.currentTarget, P = { x: m.clientX, y: m.clientY }, E = qt(P, w.getBoundingClientRect()), b = Zt(P, E), C = Kt(y.getBoundingClientRect()), T = Qt([...b, ...C]);
583
+ u(T), h(!0);
584
+ },
585
+ [h]
586
+ );
587
+ return s.useEffect(() => () => f(), [f]), s.useEffect(() => {
588
+ if (a && d) {
589
+ const m = (w) => p(w, d), y = (w) => p(w, a);
590
+ return a.addEventListener("pointerleave", m), d.addEventListener("pointerleave", y), () => {
591
+ a.removeEventListener("pointerleave", m), d.removeEventListener("pointerleave", y);
592
+ };
593
+ }
594
+ }, [a, d, p, f]), s.useEffect(() => {
595
+ if (l) {
596
+ const m = (y) => {
597
+ const w = y.target, P = { x: y.clientX, y: y.clientY }, E = (a == null ? void 0 : a.contains(w)) || (d == null ? void 0 : d.contains(w)), b = !Jt(P, l);
598
+ E ? f() : b && (f(), c());
599
+ };
600
+ return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
601
+ }
602
+ }, [a, d, l, c, f]), /* @__PURE__ */ v(Le, { ...e, ref: i });
603
+ }), [zt, Gt] = B(M, { isInside: !1 }), Xt = at("TooltipContent"), Le = s.forwardRef(
604
+ (e, t) => {
605
+ const {
606
+ __scopeTooltip: n,
607
+ children: r,
608
+ "aria-label": o,
609
+ onEscapeKeyDown: i,
610
+ onPointerDownOutside: l,
611
+ ...u
612
+ } = e, a = Y(S, n), c = j(n), { onClose: d } = a;
613
+ return s.useEffect(() => (document.addEventListener(G, d), () => document.removeEventListener(G, d)), [d]), s.useEffect(() => {
614
+ if (a.trigger) {
615
+ const h = (f) => {
616
+ const p = f.target;
617
+ p != null && p.contains(a.trigger) && d();
618
+ };
619
+ return window.addEventListener("scroll", h, { capture: !0 }), () => window.removeEventListener("scroll", h, { capture: !0 });
620
+ }
621
+ }, [a.trigger, d]), /* @__PURE__ */ v(
622
+ pe,
623
+ {
624
+ asChild: !0,
625
+ disableOutsidePointerEvents: !1,
626
+ onEscapeKeyDown: i,
627
+ onPointerDownOutside: l,
628
+ onFocusOutside: (h) => h.preventDefault(),
629
+ onDismiss: d,
630
+ children: /* @__PURE__ */ Ve(
631
+ St,
632
+ {
633
+ "data-state": a.stateAttribute,
634
+ ...c,
635
+ ...u,
636
+ ref: t,
637
+ style: {
638
+ ...u.style,
639
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
640
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
641
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
642
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
643
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
644
+ },
645
+ children: [
646
+ /* @__PURE__ */ v(Xt, { children: r }),
647
+ /* @__PURE__ */ v(zt, { scope: n, isInside: !0, children: /* @__PURE__ */ v(Ft, { id: a.contentId, role: "tooltip", children: o || r }) })
648
+ ]
649
+ }
650
+ )
651
+ }
652
+ );
653
+ }
654
+ );
655
+ Se.displayName = S;
656
+ var _e = "TooltipArrow", Vt = s.forwardRef(
657
+ (e, t) => {
658
+ const { __scopeTooltip: n, ...r } = e, o = j(n);
659
+ return Gt(
660
+ _e,
661
+ n
662
+ ).isInside ? null : /* @__PURE__ */ v(Lt, { ...o, ...r, ref: t });
663
+ }
664
+ );
665
+ Vt.displayName = _e;
666
+ function qt(e, t) {
667
+ const n = Math.abs(t.top - e.y), r = Math.abs(t.bottom - e.y), o = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
668
+ switch (Math.min(n, r, o, i)) {
669
+ case i:
670
+ return "left";
671
+ case o:
672
+ return "right";
673
+ case n:
674
+ return "top";
675
+ case r:
676
+ return "bottom";
677
+ default:
678
+ throw new Error("unreachable");
679
+ }
680
+ }
681
+ function Zt(e, t, n = 5) {
682
+ const r = [];
683
+ switch (t) {
684
+ case "top":
685
+ r.push(
686
+ { x: e.x - n, y: e.y + n },
687
+ { x: e.x + n, y: e.y + n }
688
+ );
689
+ break;
690
+ case "bottom":
691
+ r.push(
692
+ { x: e.x - n, y: e.y - n },
693
+ { x: e.x + n, y: e.y - n }
694
+ );
695
+ break;
696
+ case "left":
697
+ r.push(
698
+ { x: e.x + n, y: e.y - n },
699
+ { x: e.x + n, y: e.y + n }
700
+ );
701
+ break;
702
+ case "right":
703
+ r.push(
704
+ { x: e.x - n, y: e.y - n },
705
+ { x: e.x - n, y: e.y + n }
706
+ );
707
+ break;
708
+ }
709
+ return r;
710
+ }
711
+ function Kt(e) {
712
+ const { top: t, right: n, bottom: r, left: o } = e;
713
+ return [
714
+ { x: o, y: t },
715
+ { x: n, y: t },
716
+ { x: n, y: r },
717
+ { x: o, y: r }
718
+ ];
719
+ }
720
+ function Jt(e, t) {
721
+ const { x: n, y: r } = e;
722
+ let o = !1;
723
+ for (let i = 0, l = t.length - 1; i < t.length; l = i++) {
724
+ const u = t[i], a = t[l], c = u.x, d = u.y, h = a.x, f = a.y;
725
+ d > r != f > r && n < (h - c) * (r - d) / (f - d) + c && (o = !o);
726
+ }
727
+ return o;
728
+ }
729
+ function Qt(e) {
730
+ const t = e.slice();
731
+ return t.sort((n, r) => n.x < r.x ? -1 : n.x > r.x ? 1 : n.y < r.y ? -1 : n.y > r.y ? 1 : 0), en(t);
732
+ }
733
+ function en(e) {
734
+ if (e.length <= 1) return e.slice();
735
+ const t = [];
736
+ for (let r = 0; r < e.length; r++) {
737
+ const o = e[r];
738
+ for (; t.length >= 2; ) {
739
+ const i = t[t.length - 1], l = t[t.length - 2];
740
+ if ((i.x - l.x) * (o.y - l.y) >= (i.y - l.y) * (o.x - l.x)) t.pop();
741
+ else break;
742
+ }
743
+ t.push(o);
744
+ }
745
+ t.pop();
746
+ const n = [];
747
+ for (let r = e.length - 1; r >= 0; r--) {
748
+ const o = e[r];
749
+ for (; n.length >= 2; ) {
750
+ const i = n[n.length - 1], l = n[n.length - 2];
751
+ if ((i.x - l.x) * (o.y - l.y) >= (i.y - l.y) * (o.x - l.x)) n.pop();
752
+ else break;
753
+ }
754
+ n.push(o);
755
+ }
756
+ return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
757
+ }
758
+ var tn = Oe, nn = Ne, rn = De, Me = Se;
759
+ const dn = tn, un = nn, pn = rn, on = s.forwardRef(
760
+ ({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ v(
761
+ Me,
762
+ {
763
+ ref: r,
764
+ sideOffset: t,
765
+ className: ut(
766
+ "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
767
+ e
768
+ ),
769
+ ...n
770
+ }
771
+ )
772
+ );
773
+ on.displayName = Me.displayName;
774
+ export {
775
+ dn as T,
776
+ un as a,
777
+ pn as b,
778
+ on as c
779
+ };