@krosoft/react 0.0.86 → 0.0.87

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