@krosoft/react 0.0.86 → 0.0.88

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 +7 -6
  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,1302 +0,0 @@
1
- import { jsxs as A, jsx as f, Fragment as nt } from "react/jsx-runtime";
2
- import { C as rt, d as ot, a as it } from "./card-7XPLAra3.js";
3
- import { a as at, A as lt } from "./AppTitle-2BwwWSnl.js";
4
- import * as a from "react";
5
- import W from "react";
6
- import { a as de, q as K, u as _, r as fe, e as R, t as me, f as L, p as $ } from "./floating-ui.react-dom-BIcsGc3t.js";
7
- import "react-dom";
8
- import { u as re, l as st, S as ct, h as ut, i as dt, a as ft, c as mt } from "./select-B_OLzx1W.js";
9
- import { c as k } from "./index-gWiv5-6R.js";
10
- import { useTranslation as pe } from "react-i18next";
11
- import { useSearchParams as he } from "react-router-dom";
12
- import { c as pt } from "./createLucideIcon-CRdjzt2A.js";
13
- /**
14
- * @license lucide-react v1.16.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const ht = [
20
- ["rect", { x: "2", y: "6", width: "20", height: "8", rx: "1", key: "1estib" }],
21
- ["path", { d: "M17 14v7", key: "7m2elx" }],
22
- ["path", { d: "M7 14v7", key: "1cm7wv" }],
23
- ["path", { d: "M17 3v3", key: "1v4jwn" }],
24
- ["path", { d: "M7 3v3", key: "7o6guu" }],
25
- ["path", { d: "M10 14 2.3 6.3", key: "1023jk" }],
26
- ["path", { d: "m14 6 7.7 7.7", key: "1s8pl2" }],
27
- ["path", { d: "m8 6 8 8", key: "hl96qh" }]
28
- ], Q = pt("construction", ht);
29
- function vt({ titleKey: e, descriptionKey: t, actions: n = [], className: r }) {
30
- return /* @__PURE__ */ A("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
31
- /* @__PURE__ */ f(at, { titleKey: e, descriptionKey: t, isSubTitle: !0 }),
32
- /* @__PURE__ */ f(lt, { actions: n, className: r })
33
- ] });
34
- }
35
- function Rn({ titleKey: e, descriptionKey: t, actions: n = [], className: r, children: o, isSubTitle: l }) {
36
- return /* @__PURE__ */ A(rt, { children: [
37
- /* @__PURE__ */ f(ot, { children: /* @__PURE__ */ f(vt, { titleKey: e, descriptionKey: t, actions: n, className: r }) }),
38
- /* @__PURE__ */ f(it, { className: "space-y-4", children: o })
39
- ] });
40
- }
41
- // @__NO_SIDE_EFFECTS__
42
- function te(e) {
43
- const t = /* @__PURE__ */ bt(e), n = a.forwardRef((r, o) => {
44
- const { children: l, ...s } = r, c = a.Children.toArray(l), d = c.find(St);
45
- if (d) {
46
- const u = d.props.children, i = c.map((m) => m === d ? a.Children.count(u) > 1 ? a.Children.only(null) : a.isValidElement(u) ? u.props.children : null : m);
47
- return /* @__PURE__ */ f(t, { ...s, ref: o, children: a.isValidElement(u) ? a.cloneElement(u, void 0, i) : null });
48
- }
49
- return /* @__PURE__ */ f(t, { ...s, ref: o, children: l });
50
- });
51
- return n.displayName = `${e}.Slot`, n;
52
- }
53
- // @__NO_SIDE_EFFECTS__
54
- function bt(e) {
55
- const t = a.forwardRef((n, r) => {
56
- const { children: o, ...l } = n;
57
- if (a.isValidElement(o)) {
58
- const s = yt(o), c = wt(l, o.props);
59
- return o.type !== a.Fragment && (c.ref = r ? de(r, s) : s), a.cloneElement(o, c);
60
- }
61
- return a.Children.count(o) > 1 ? a.Children.only(null) : null;
62
- });
63
- return t.displayName = `${e}.SlotClone`, t;
64
- }
65
- var gt = Symbol("radix.slottable");
66
- function St(e) {
67
- return a.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === gt;
68
- }
69
- function wt(e, t) {
70
- const n = { ...t };
71
- for (const r in t) {
72
- const o = e[r], l = t[r];
73
- /^on[A-Z]/.test(r) ? o && l ? n[r] = (...c) => {
74
- const d = l(...c);
75
- return o(...c), d;
76
- } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...l } : r === "className" && (n[r] = [o, l].filter(Boolean).join(" "));
77
- }
78
- return { ...e, ...n };
79
- }
80
- function yt(e) {
81
- var r, o;
82
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
83
- 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);
84
- }
85
- function Ct(e) {
86
- const t = e + "CollectionProvider", [n, r] = K(t), [o, l] = n(
87
- t,
88
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
89
- ), s = (w) => {
90
- const { scope: v, children: S } = w, T = W.useRef(null), b = W.useRef(/* @__PURE__ */ new Map()).current;
91
- return /* @__PURE__ */ f(o, { scope: v, itemMap: b, collectionRef: T, children: S });
92
- };
93
- s.displayName = t;
94
- const c = e + "CollectionSlot", d = /* @__PURE__ */ te(c), u = W.forwardRef(
95
- (w, v) => {
96
- const { scope: S, children: T } = w, b = l(c, S), y = _(v, b.collectionRef);
97
- return /* @__PURE__ */ f(d, { ref: y, children: T });
98
- }
99
- );
100
- u.displayName = c;
101
- const i = e + "CollectionItemSlot", m = "data-radix-collection-item", p = /* @__PURE__ */ te(i), h = W.forwardRef(
102
- (w, v) => {
103
- const { scope: S, children: T, ...b } = w, y = W.useRef(null), I = _(v, y), P = l(i, S);
104
- return W.useEffect(() => (P.itemMap.set(y, { ref: y, ...b }), () => void P.itemMap.delete(y))), /* @__PURE__ */ f(p, { [m]: "", ref: I, children: T });
105
- }
106
- );
107
- h.displayName = i;
108
- function g(w) {
109
- const v = l(e + "CollectionConsumer", w);
110
- return W.useCallback(() => {
111
- const T = v.collectionRef.current;
112
- if (!T) return [];
113
- const b = Array.from(T.querySelectorAll(`[${m}]`));
114
- return Array.from(v.itemMap.values()).sort(
115
- (P, D) => b.indexOf(P.ref.current) - b.indexOf(D.ref.current)
116
- );
117
- }, [v.collectionRef, v.itemMap]);
118
- }
119
- return [
120
- { Provider: s, Slot: u, ItemSlot: h },
121
- g,
122
- r
123
- ];
124
- }
125
- var Nt = [
126
- "a",
127
- "button",
128
- "div",
129
- "form",
130
- "h2",
131
- "h3",
132
- "img",
133
- "input",
134
- "label",
135
- "li",
136
- "nav",
137
- "ol",
138
- "p",
139
- "select",
140
- "span",
141
- "svg",
142
- "ul"
143
- ], V = Nt.reduce((e, t) => {
144
- const n = /* @__PURE__ */ te(`Primitive.${t}`), r = a.forwardRef((o, l) => {
145
- const { asChild: s, ...c } = o, d = s ? n : t;
146
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(d, { ...c, ref: l });
147
- });
148
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
149
- }, {}), ee = "rovingFocusGroup.onEntryFocus", Tt = { bubbles: !1, cancelable: !0 }, H = "RovingFocusGroup", [ne, ve, Rt] = Ct(H), [Et, be] = K(
150
- H,
151
- [Rt]
152
- ), [At, Pt] = Et(H), ge = a.forwardRef(
153
- (e, t) => /* @__PURE__ */ f(ne.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ f(ne.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ f(xt, { ...e, ref: t }) }) })
154
- );
155
- ge.displayName = H;
156
- var xt = a.forwardRef((e, t) => {
157
- const {
158
- __scopeRovingFocusGroup: n,
159
- orientation: r,
160
- loop: o = !1,
161
- dir: l,
162
- currentTabStopId: s,
163
- defaultCurrentTabStopId: c,
164
- onCurrentTabStopIdChange: d,
165
- onEntryFocus: u,
166
- preventScrollOnEntryFocus: i = !1,
167
- ...m
168
- } = e, p = a.useRef(null), h = _(t, p), g = re(l), [w, v] = me({
169
- prop: s,
170
- defaultProp: c ?? null,
171
- onChange: d,
172
- caller: H
173
- }), [S, T] = a.useState(!1), b = L(u), y = ve(n), I = a.useRef(!1), [P, D] = a.useState(0);
174
- return a.useEffect(() => {
175
- const N = p.current;
176
- if (N)
177
- return N.addEventListener(ee, b), () => N.removeEventListener(ee, b);
178
- }, [b]), /* @__PURE__ */ f(
179
- At,
180
- {
181
- scope: n,
182
- orientation: r,
183
- dir: g,
184
- loop: o,
185
- currentTabStopId: w,
186
- onItemFocus: a.useCallback(
187
- (N) => v(N),
188
- [v]
189
- ),
190
- onItemShiftTab: a.useCallback(() => T(!0), []),
191
- onFocusableItemAdd: a.useCallback(
192
- () => D((N) => N + 1),
193
- []
194
- ),
195
- onFocusableItemRemove: a.useCallback(
196
- () => D((N) => N - 1),
197
- []
198
- ),
199
- children: /* @__PURE__ */ f(
200
- V.div,
201
- {
202
- tabIndex: S || P === 0 ? -1 : 0,
203
- "data-orientation": r,
204
- ...m,
205
- ref: h,
206
- style: { outline: "none", ...e.style },
207
- onMouseDown: R(e.onMouseDown, () => {
208
- I.current = !0;
209
- }),
210
- onFocus: R(e.onFocus, (N) => {
211
- const C = !I.current;
212
- if (N.target === N.currentTarget && C && !S) {
213
- const E = new CustomEvent(ee, Tt);
214
- if (N.currentTarget.dispatchEvent(E), !E.defaultPrevented) {
215
- const M = y().filter((F) => F.focusable), ce = M.find((F) => F.active), et = M.find((F) => F.id === w), tt = [ce, et, ...M].filter(
216
- Boolean
217
- ).map((F) => F.ref.current);
218
- ye(tt, i);
219
- }
220
- }
221
- I.current = !1;
222
- }),
223
- onBlur: R(e.onBlur, () => T(!1))
224
- }
225
- )
226
- }
227
- );
228
- }), Se = "RovingFocusGroupItem", we = a.forwardRef(
229
- (e, t) => {
230
- const {
231
- __scopeRovingFocusGroup: n,
232
- focusable: r = !0,
233
- active: o = !1,
234
- tabStopId: l,
235
- children: s,
236
- ...c
237
- } = e, d = fe(), u = l || d, i = Pt(Se, n), m = i.currentTabStopId === u, p = ve(n), { onFocusableItemAdd: h, onFocusableItemRemove: g, currentTabStopId: w } = i;
238
- return a.useEffect(() => {
239
- if (r)
240
- return h(), () => g();
241
- }, [r, h, g]), /* @__PURE__ */ f(
242
- ne.ItemSlot,
243
- {
244
- scope: n,
245
- id: u,
246
- focusable: r,
247
- active: o,
248
- children: /* @__PURE__ */ f(
249
- V.span,
250
- {
251
- tabIndex: m ? 0 : -1,
252
- "data-orientation": i.orientation,
253
- ...c,
254
- ref: t,
255
- onMouseDown: R(e.onMouseDown, (v) => {
256
- r ? i.onItemFocus(u) : v.preventDefault();
257
- }),
258
- onFocus: R(e.onFocus, () => i.onItemFocus(u)),
259
- onKeyDown: R(e.onKeyDown, (v) => {
260
- if (v.key === "Tab" && v.shiftKey) {
261
- i.onItemShiftTab();
262
- return;
263
- }
264
- if (v.target !== v.currentTarget) return;
265
- const S = Mt(v, i.orientation, i.dir);
266
- if (S !== void 0) {
267
- if (v.metaKey || v.ctrlKey || v.altKey || v.shiftKey) return;
268
- v.preventDefault();
269
- let b = p().filter((y) => y.focusable).map((y) => y.ref.current);
270
- if (S === "last") b.reverse();
271
- else if (S === "prev" || S === "next") {
272
- S === "prev" && b.reverse();
273
- const y = b.indexOf(v.currentTarget);
274
- b = i.loop ? Ot(b, y + 1) : b.slice(y + 1);
275
- }
276
- setTimeout(() => ye(b));
277
- }
278
- }),
279
- children: typeof s == "function" ? s({ isCurrentTabStop: m, hasTabStop: w != null }) : s
280
- }
281
- )
282
- }
283
- );
284
- }
285
- );
286
- we.displayName = Se;
287
- var It = {
288
- ArrowLeft: "prev",
289
- ArrowUp: "prev",
290
- ArrowRight: "next",
291
- ArrowDown: "next",
292
- PageUp: "first",
293
- Home: "first",
294
- PageDown: "last",
295
- End: "last"
296
- };
297
- function _t(e, t) {
298
- return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
299
- }
300
- function Mt(e, t, n) {
301
- const r = _t(e.key, n);
302
- if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
303
- return It[r];
304
- }
305
- function ye(e, t = !1) {
306
- const n = document.activeElement;
307
- for (const r of e)
308
- if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return;
309
- }
310
- function Ot(e, t) {
311
- return e.map((n, r) => e[(t + r) % e.length]);
312
- }
313
- var Dt = ge, Lt = we;
314
- function Ft(e, t) {
315
- return a.useReducer((n, r) => t[n][r] ?? n, e);
316
- }
317
- var Ce = (e) => {
318
- const { present: t, children: n } = e, r = Wt(t), o = typeof n == "function" ? n({ present: r.isPresent }) : a.Children.only(n), l = _(r.ref, Ut(o));
319
- return typeof n == "function" || r.isPresent ? a.cloneElement(o, { ref: l }) : null;
320
- };
321
- Ce.displayName = "Presence";
322
- function Wt(e) {
323
- const [t, n] = a.useState(), r = a.useRef(null), o = a.useRef(e), l = a.useRef("none"), s = e ? "mounted" : "unmounted", [c, d] = Ft(s, {
324
- mounted: {
325
- UNMOUNT: "unmounted",
326
- ANIMATION_OUT: "unmountSuspended"
327
- },
328
- unmountSuspended: {
329
- MOUNT: "mounted",
330
- ANIMATION_END: "unmounted"
331
- },
332
- unmounted: {
333
- MOUNT: "mounted"
334
- }
335
- });
336
- return a.useEffect(() => {
337
- const u = Y(r.current);
338
- l.current = c === "mounted" ? u : "none";
339
- }, [c]), $(() => {
340
- const u = r.current, i = o.current;
341
- if (i !== e) {
342
- const p = l.current, h = Y(u);
343
- e ? d("MOUNT") : h === "none" || (u == null ? void 0 : u.display) === "none" ? d("UNMOUNT") : d(i && p !== h ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
344
- }
345
- }, [e, d]), $(() => {
346
- if (t) {
347
- let u;
348
- const i = t.ownerDocument.defaultView ?? window, m = (h) => {
349
- const w = Y(r.current).includes(CSS.escape(h.animationName));
350
- if (h.target === t && w && (d("ANIMATION_END"), !o.current)) {
351
- const v = t.style.animationFillMode;
352
- t.style.animationFillMode = "forwards", u = i.setTimeout(() => {
353
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = v);
354
- });
355
- }
356
- }, p = (h) => {
357
- h.target === t && (l.current = Y(r.current));
358
- };
359
- return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
360
- i.clearTimeout(u), t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
361
- };
362
- } else
363
- d("ANIMATION_END");
364
- }, [t, d]), {
365
- isPresent: ["mounted", "unmountSuspended"].includes(c),
366
- ref: a.useCallback((u) => {
367
- r.current = u ? getComputedStyle(u) : null, n(u);
368
- }, [])
369
- };
370
- }
371
- function Y(e) {
372
- return (e == null ? void 0 : e.animationName) || "none";
373
- }
374
- function Ut(e) {
375
- var r, o;
376
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
377
- 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);
378
- }
379
- var q = "Tabs", [kt] = K(q, [
380
- be
381
- ]), Ne = be(), [Vt, oe] = kt(q), Te = a.forwardRef(
382
- (e, t) => {
383
- const {
384
- __scopeTabs: n,
385
- value: r,
386
- onValueChange: o,
387
- defaultValue: l,
388
- orientation: s = "horizontal",
389
- dir: c,
390
- activationMode: d = "automatic",
391
- ...u
392
- } = e, i = re(c), [m, p] = me({
393
- prop: r,
394
- onChange: o,
395
- defaultProp: l ?? "",
396
- caller: q
397
- });
398
- return /* @__PURE__ */ f(
399
- Vt,
400
- {
401
- scope: n,
402
- baseId: fe(),
403
- value: m,
404
- onValueChange: p,
405
- orientation: s,
406
- dir: i,
407
- activationMode: d,
408
- children: /* @__PURE__ */ f(
409
- V.div,
410
- {
411
- dir: i,
412
- "data-orientation": s,
413
- ...u,
414
- ref: t
415
- }
416
- )
417
- }
418
- );
419
- }
420
- );
421
- Te.displayName = q;
422
- var Re = "TabsList", Ee = a.forwardRef(
423
- (e, t) => {
424
- const { __scopeTabs: n, loop: r = !0, ...o } = e, l = oe(Re, n), s = Ne(n);
425
- return /* @__PURE__ */ f(
426
- Dt,
427
- {
428
- asChild: !0,
429
- ...s,
430
- orientation: l.orientation,
431
- dir: l.dir,
432
- loop: r,
433
- children: /* @__PURE__ */ f(
434
- V.div,
435
- {
436
- role: "tablist",
437
- "aria-orientation": l.orientation,
438
- ...o,
439
- ref: t
440
- }
441
- )
442
- }
443
- );
444
- }
445
- );
446
- Ee.displayName = Re;
447
- var Ae = "TabsTrigger", Pe = a.forwardRef(
448
- (e, t) => {
449
- const { __scopeTabs: n, value: r, disabled: o = !1, ...l } = e, s = oe(Ae, n), c = Ne(n), d = _e(s.baseId, r), u = Me(s.baseId, r), i = r === s.value;
450
- return /* @__PURE__ */ f(
451
- Lt,
452
- {
453
- asChild: !0,
454
- ...c,
455
- focusable: !o,
456
- active: i,
457
- children: /* @__PURE__ */ f(
458
- V.button,
459
- {
460
- type: "button",
461
- role: "tab",
462
- "aria-selected": i,
463
- "aria-controls": u,
464
- "data-state": i ? "active" : "inactive",
465
- "data-disabled": o ? "" : void 0,
466
- disabled: o,
467
- id: d,
468
- ...l,
469
- ref: t,
470
- onMouseDown: R(e.onMouseDown, (m) => {
471
- !o && m.button === 0 && m.ctrlKey === !1 ? s.onValueChange(r) : m.preventDefault();
472
- }),
473
- onKeyDown: R(e.onKeyDown, (m) => {
474
- [" ", "Enter"].includes(m.key) && s.onValueChange(r);
475
- }),
476
- onFocus: R(e.onFocus, () => {
477
- const m = s.activationMode !== "manual";
478
- !i && !o && m && s.onValueChange(r);
479
- })
480
- }
481
- )
482
- }
483
- );
484
- }
485
- );
486
- Pe.displayName = Ae;
487
- var xe = "TabsContent", Ie = a.forwardRef(
488
- (e, t) => {
489
- const { __scopeTabs: n, value: r, forceMount: o, children: l, ...s } = e, c = oe(xe, n), d = _e(c.baseId, r), u = Me(c.baseId, r), i = r === c.value, m = a.useRef(i);
490
- return a.useEffect(() => {
491
- const p = requestAnimationFrame(() => m.current = !1);
492
- return () => cancelAnimationFrame(p);
493
- }, []), /* @__PURE__ */ f(Ce, { present: o || i, children: ({ present: p }) => /* @__PURE__ */ f(
494
- V.div,
495
- {
496
- "data-state": i ? "active" : "inactive",
497
- "data-orientation": c.orientation,
498
- role: "tabpanel",
499
- "aria-labelledby": d,
500
- hidden: !p,
501
- id: u,
502
- tabIndex: 0,
503
- ...s,
504
- ref: t,
505
- style: {
506
- ...e.style,
507
- animationDuration: m.current ? "0s" : void 0
508
- },
509
- children: p && l
510
- }
511
- ) });
512
- }
513
- );
514
- Ie.displayName = xe;
515
- function _e(e, t) {
516
- return `${e}-trigger-${t}`;
517
- }
518
- function Me(e, t) {
519
- return `${e}-content-${t}`;
520
- }
521
- var $t = Te, Oe = Ee, De = Pe, Le = Ie;
522
- const Ht = $t, Fe = a.forwardRef(
523
- ({ className: e, ...t }, n) => /* @__PURE__ */ f(
524
- Oe,
525
- {
526
- ref: n,
527
- className: k("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", e),
528
- ...t
529
- }
530
- )
531
- );
532
- Fe.displayName = Oe.displayName;
533
- const We = a.forwardRef(
534
- ({ className: e, ...t }, n) => /* @__PURE__ */ f(
535
- De,
536
- {
537
- ref: n,
538
- className: k(
539
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
540
- e
541
- ),
542
- ...t
543
- }
544
- )
545
- );
546
- We.displayName = De.displayName;
547
- const Ue = a.forwardRef(
548
- ({ className: e, ...t }, n) => /* @__PURE__ */ f(
549
- Le,
550
- {
551
- ref: n,
552
- className: k(
553
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
554
- e
555
- ),
556
- ...t
557
- }
558
- )
559
- );
560
- Ue.displayName = Le.displayName;
561
- function En({ tabs: e, itemId: t, item: n, fit: r }) {
562
- var u;
563
- const { t: o } = pe(), [l, s] = he(), c = l.get("tab") || ((u = e[0]) == null ? void 0 : u.value);
564
- return /* @__PURE__ */ A(Ht, { value: c, onValueChange: (i) => {
565
- const m = new URLSearchParams();
566
- m.set("tab", i), s(m);
567
- }, children: [
568
- /* @__PURE__ */ f(Fe, { className: k("w-full justify-start", r && "sm:w-fit"), children: e.map((i) => /* @__PURE__ */ A(We, { value: i.value, className: "gap-2", disabled: i.disabled, children: [
569
- i.icon ? /* @__PURE__ */ f("span", { className: "hidden sm:inline", children: /* @__PURE__ */ f(i.icon, { className: "size-4" }) }) : null,
570
- /* @__PURE__ */ f("span", { className: "text-xs sm:text-sm", children: o(i.titleKey) ?? "" }),
571
- i.count ? /* @__PURE__ */ A("span", { className: "text-gray-500 text-xs", children: [
572
- "(",
573
- i.count(n),
574
- ")"
575
- ] }) : null
576
- ] }, i.value)) }),
577
- e.map((i) => /* @__PURE__ */ f(Ue, { value: i.value, className: "mt-4", children: i.component ? i.component(t) : null }, i.value))
578
- ] });
579
- }
580
- // @__NO_SIDE_EFFECTS__
581
- function zt(e) {
582
- const t = /* @__PURE__ */ Bt(e), n = a.forwardRef((r, o) => {
583
- const { children: l, ...s } = r, c = a.Children.toArray(l), d = c.find(jt);
584
- if (d) {
585
- const u = d.props.children, i = c.map((m) => m === d ? a.Children.count(u) > 1 ? a.Children.only(null) : a.isValidElement(u) ? u.props.children : null : m);
586
- return /* @__PURE__ */ f(t, { ...s, ref: o, children: a.isValidElement(u) ? a.cloneElement(u, void 0, i) : null });
587
- }
588
- return /* @__PURE__ */ f(t, { ...s, ref: o, children: l });
589
- });
590
- return n.displayName = `${e}.Slot`, n;
591
- }
592
- // @__NO_SIDE_EFFECTS__
593
- function Bt(e) {
594
- const t = a.forwardRef((n, r) => {
595
- const { children: o, ...l } = n;
596
- if (a.isValidElement(o)) {
597
- const s = Xt(o), c = Gt(l, o.props);
598
- return o.type !== a.Fragment && (c.ref = r ? de(r, s) : s), a.cloneElement(o, c);
599
- }
600
- return a.Children.count(o) > 1 ? a.Children.only(null) : null;
601
- });
602
- return t.displayName = `${e}.SlotClone`, t;
603
- }
604
- var Yt = Symbol("radix.slottable");
605
- function jt(e) {
606
- return a.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Yt;
607
- }
608
- function Gt(e, t) {
609
- const n = { ...t };
610
- for (const r in t) {
611
- const o = e[r], l = t[r];
612
- /^on[A-Z]/.test(r) ? o && l ? n[r] = (...c) => {
613
- const d = l(...c);
614
- return o(...c), d;
615
- } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...l } : r === "className" && (n[r] = [o, l].filter(Boolean).join(" "));
616
- }
617
- return { ...e, ...n };
618
- }
619
- function Xt(e) {
620
- var r, o;
621
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
622
- 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);
623
- }
624
- var Kt = [
625
- "a",
626
- "button",
627
- "div",
628
- "form",
629
- "h2",
630
- "h3",
631
- "img",
632
- "input",
633
- "label",
634
- "li",
635
- "nav",
636
- "ol",
637
- "p",
638
- "select",
639
- "span",
640
- "svg",
641
- "ul"
642
- ], z = Kt.reduce((e, t) => {
643
- const n = /* @__PURE__ */ zt(`Primitive.${t}`), r = a.forwardRef((o, l) => {
644
- const { asChild: s, ...c } = o, d = s ? n : t;
645
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(d, { ...c, ref: l });
646
- });
647
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
648
- }, {});
649
- function qt(e, t) {
650
- return a.useReducer((n, r) => t[n][r] ?? n, e);
651
- }
652
- var B = (e) => {
653
- const { present: t, children: n } = e, r = Zt(t), o = typeof n == "function" ? n({ present: r.isPresent }) : a.Children.only(n), l = _(r.ref, Jt(o));
654
- return typeof n == "function" || r.isPresent ? a.cloneElement(o, { ref: l }) : null;
655
- };
656
- B.displayName = "Presence";
657
- function Zt(e) {
658
- const [t, n] = a.useState(), r = a.useRef(null), o = a.useRef(e), l = a.useRef("none"), s = e ? "mounted" : "unmounted", [c, d] = qt(s, {
659
- mounted: {
660
- UNMOUNT: "unmounted",
661
- ANIMATION_OUT: "unmountSuspended"
662
- },
663
- unmountSuspended: {
664
- MOUNT: "mounted",
665
- ANIMATION_END: "unmounted"
666
- },
667
- unmounted: {
668
- MOUNT: "mounted"
669
- }
670
- });
671
- return a.useEffect(() => {
672
- const u = j(r.current);
673
- l.current = c === "mounted" ? u : "none";
674
- }, [c]), $(() => {
675
- const u = r.current, i = o.current;
676
- if (i !== e) {
677
- const p = l.current, h = j(u);
678
- e ? d("MOUNT") : h === "none" || (u == null ? void 0 : u.display) === "none" ? d("UNMOUNT") : d(i && p !== h ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
679
- }
680
- }, [e, d]), $(() => {
681
- if (t) {
682
- let u;
683
- const i = t.ownerDocument.defaultView ?? window, m = (h) => {
684
- const w = j(r.current).includes(CSS.escape(h.animationName));
685
- if (h.target === t && w && (d("ANIMATION_END"), !o.current)) {
686
- const v = t.style.animationFillMode;
687
- t.style.animationFillMode = "forwards", u = i.setTimeout(() => {
688
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = v);
689
- });
690
- }
691
- }, p = (h) => {
692
- h.target === t && (l.current = j(r.current));
693
- };
694
- return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
695
- i.clearTimeout(u), t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
696
- };
697
- } else
698
- d("ANIMATION_END");
699
- }, [t, d]), {
700
- isPresent: ["mounted", "unmountSuspended"].includes(c),
701
- ref: a.useCallback((u) => {
702
- r.current = u ? getComputedStyle(u) : null, n(u);
703
- }, [])
704
- };
705
- }
706
- function j(e) {
707
- return (e == null ? void 0 : e.animationName) || "none";
708
- }
709
- function Jt(e) {
710
- var r, o;
711
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
712
- 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);
713
- }
714
- function Qt(e, t) {
715
- return a.useReducer((n, r) => t[n][r] ?? n, e);
716
- }
717
- var ie = "ScrollArea", [ke] = K(ie), [en, x] = ke(ie), Ve = a.forwardRef(
718
- (e, t) => {
719
- const {
720
- __scopeScrollArea: n,
721
- type: r = "hover",
722
- dir: o,
723
- scrollHideDelay: l = 600,
724
- ...s
725
- } = e, [c, d] = a.useState(null), [u, i] = a.useState(null), [m, p] = a.useState(null), [h, g] = a.useState(null), [w, v] = a.useState(null), [S, T] = a.useState(0), [b, y] = a.useState(0), [I, P] = a.useState(!1), [D, N] = a.useState(!1), C = _(t, (M) => d(M)), E = re(o);
726
- return /* @__PURE__ */ f(
727
- en,
728
- {
729
- scope: n,
730
- type: r,
731
- dir: E,
732
- scrollHideDelay: l,
733
- scrollArea: c,
734
- viewport: u,
735
- onViewportChange: i,
736
- content: m,
737
- onContentChange: p,
738
- scrollbarX: h,
739
- onScrollbarXChange: g,
740
- scrollbarXEnabled: I,
741
- onScrollbarXEnabledChange: P,
742
- scrollbarY: w,
743
- onScrollbarYChange: v,
744
- scrollbarYEnabled: D,
745
- onScrollbarYEnabledChange: N,
746
- onCornerWidthChange: T,
747
- onCornerHeightChange: y,
748
- children: /* @__PURE__ */ f(
749
- z.div,
750
- {
751
- dir: E,
752
- ...s,
753
- ref: C,
754
- style: {
755
- position: "relative",
756
- // Pass corner sizes as CSS vars to reduce re-renders of context consumers
757
- "--radix-scroll-area-corner-width": S + "px",
758
- "--radix-scroll-area-corner-height": b + "px",
759
- ...e.style
760
- }
761
- }
762
- )
763
- }
764
- );
765
- }
766
- );
767
- Ve.displayName = ie;
768
- var $e = "ScrollAreaViewport", He = a.forwardRef(
769
- (e, t) => {
770
- const { __scopeScrollArea: n, children: r, nonce: o, ...l } = e, s = x($e, n), c = a.useRef(null), d = _(t, c, s.onViewportChange);
771
- return /* @__PURE__ */ A(nt, { children: [
772
- /* @__PURE__ */ f(
773
- "style",
774
- {
775
- dangerouslySetInnerHTML: {
776
- __html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
777
- },
778
- nonce: o
779
- }
780
- ),
781
- /* @__PURE__ */ f(
782
- z.div,
783
- {
784
- "data-radix-scroll-area-viewport": "",
785
- ...l,
786
- ref: d,
787
- style: {
788
- /**
789
- * We don't support `visible` because the intention is to have at least one scrollbar
790
- * if this component is used and `visible` will behave like `auto` in that case
791
- * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
792
- *
793
- * We don't handle `auto` because the intention is for the native implementation
794
- * to be hidden if using this component. We just want to ensure the node is scrollable
795
- * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
796
- * the browser from having to work out whether to render native scrollbars or not,
797
- * we tell it to with the intention of hiding them in CSS.
798
- */
799
- overflowX: s.scrollbarXEnabled ? "scroll" : "hidden",
800
- overflowY: s.scrollbarYEnabled ? "scroll" : "hidden",
801
- ...e.style
802
- },
803
- children: /* @__PURE__ */ f("div", { ref: s.onContentChange, style: { minWidth: "100%", display: "table" }, children: r })
804
- }
805
- )
806
- ] });
807
- }
808
- );
809
- He.displayName = $e;
810
- var O = "ScrollAreaScrollbar", ae = a.forwardRef(
811
- (e, t) => {
812
- const { forceMount: n, ...r } = e, o = x(O, e.__scopeScrollArea), { onScrollbarXEnabledChange: l, onScrollbarYEnabledChange: s } = o, c = e.orientation === "horizontal";
813
- return a.useEffect(() => (c ? l(!0) : s(!0), () => {
814
- c ? l(!1) : s(!1);
815
- }), [c, l, s]), o.type === "hover" ? /* @__PURE__ */ f(tn, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ f(nn, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ f(ze, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ f(le, { ...r, ref: t }) : null;
816
- }
817
- );
818
- ae.displayName = O;
819
- var tn = a.forwardRef((e, t) => {
820
- const { forceMount: n, ...r } = e, o = x(O, e.__scopeScrollArea), [l, s] = a.useState(!1);
821
- return a.useEffect(() => {
822
- const c = o.scrollArea;
823
- let d = 0;
824
- if (c) {
825
- const u = () => {
826
- window.clearTimeout(d), s(!0);
827
- }, i = () => {
828
- d = window.setTimeout(() => s(!1), o.scrollHideDelay);
829
- };
830
- return c.addEventListener("pointerenter", u), c.addEventListener("pointerleave", i), () => {
831
- window.clearTimeout(d), c.removeEventListener("pointerenter", u), c.removeEventListener("pointerleave", i);
832
- };
833
- }
834
- }, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ f(B, { present: n || l, children: /* @__PURE__ */ f(
835
- ze,
836
- {
837
- "data-state": l ? "visible" : "hidden",
838
- ...r,
839
- ref: t
840
- }
841
- ) });
842
- }), nn = a.forwardRef((e, t) => {
843
- const { forceMount: n, ...r } = e, o = x(O, e.__scopeScrollArea), l = e.orientation === "horizontal", s = J(() => d("SCROLL_END"), 100), [c, d] = Qt("hidden", {
844
- hidden: {
845
- SCROLL: "scrolling"
846
- },
847
- scrolling: {
848
- SCROLL_END: "idle",
849
- POINTER_ENTER: "interacting"
850
- },
851
- interacting: {
852
- SCROLL: "interacting",
853
- POINTER_LEAVE: "idle"
854
- },
855
- idle: {
856
- HIDE: "hidden",
857
- SCROLL: "scrolling",
858
- POINTER_ENTER: "interacting"
859
- }
860
- });
861
- return a.useEffect(() => {
862
- if (c === "idle") {
863
- const u = window.setTimeout(() => d("HIDE"), o.scrollHideDelay);
864
- return () => window.clearTimeout(u);
865
- }
866
- }, [c, o.scrollHideDelay, d]), a.useEffect(() => {
867
- const u = o.viewport, i = l ? "scrollLeft" : "scrollTop";
868
- if (u) {
869
- let m = u[i];
870
- const p = () => {
871
- const h = u[i];
872
- m !== h && (d("SCROLL"), s()), m = h;
873
- };
874
- return u.addEventListener("scroll", p), () => u.removeEventListener("scroll", p);
875
- }
876
- }, [o.viewport, l, d, s]), /* @__PURE__ */ f(B, { present: n || c !== "hidden", children: /* @__PURE__ */ f(
877
- le,
878
- {
879
- "data-state": c === "hidden" ? "hidden" : "visible",
880
- ...r,
881
- ref: t,
882
- onPointerEnter: R(e.onPointerEnter, () => d("POINTER_ENTER")),
883
- onPointerLeave: R(e.onPointerLeave, () => d("POINTER_LEAVE"))
884
- }
885
- ) });
886
- }), ze = a.forwardRef((e, t) => {
887
- const n = x(O, e.__scopeScrollArea), { forceMount: r, ...o } = e, [l, s] = a.useState(!1), c = e.orientation === "horizontal", d = J(() => {
888
- if (n.viewport) {
889
- const u = n.viewport.offsetWidth < n.viewport.scrollWidth, i = n.viewport.offsetHeight < n.viewport.scrollHeight;
890
- s(c ? u : i);
891
- }
892
- }, 10);
893
- return U(n.viewport, d), U(n.content, d), /* @__PURE__ */ f(B, { present: r || l, children: /* @__PURE__ */ f(
894
- le,
895
- {
896
- "data-state": l ? "visible" : "hidden",
897
- ...o,
898
- ref: t
899
- }
900
- ) });
901
- }), le = a.forwardRef((e, t) => {
902
- const { orientation: n = "vertical", ...r } = e, o = x(O, e.__scopeScrollArea), l = a.useRef(null), s = a.useRef(0), [c, d] = a.useState({
903
- content: 0,
904
- viewport: 0,
905
- scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
906
- }), u = Xe(c.viewport, c.content), i = {
907
- ...r,
908
- sizes: c,
909
- onSizesChange: d,
910
- hasThumb: u > 0 && u < 1,
911
- onThumbChange: (p) => l.current = p,
912
- onThumbPointerUp: () => s.current = 0,
913
- onThumbPointerDown: (p) => s.current = p
914
- };
915
- function m(p, h) {
916
- return cn(p, s.current, c, h);
917
- }
918
- return n === "horizontal" ? /* @__PURE__ */ f(
919
- rn,
920
- {
921
- ...i,
922
- ref: t,
923
- onThumbPositionChange: () => {
924
- if (o.viewport && l.current) {
925
- const p = o.viewport.scrollLeft, h = ue(p, c, o.dir);
926
- l.current.style.transform = `translate3d(${h}px, 0, 0)`;
927
- }
928
- },
929
- onWheelScroll: (p) => {
930
- o.viewport && (o.viewport.scrollLeft = p);
931
- },
932
- onDragScroll: (p) => {
933
- o.viewport && (o.viewport.scrollLeft = m(p, o.dir));
934
- }
935
- }
936
- ) : n === "vertical" ? /* @__PURE__ */ f(
937
- on,
938
- {
939
- ...i,
940
- ref: t,
941
- onThumbPositionChange: () => {
942
- if (o.viewport && l.current) {
943
- const p = o.viewport.scrollTop, h = ue(p, c);
944
- l.current.style.transform = `translate3d(0, ${h}px, 0)`;
945
- }
946
- },
947
- onWheelScroll: (p) => {
948
- o.viewport && (o.viewport.scrollTop = p);
949
- },
950
- onDragScroll: (p) => {
951
- o.viewport && (o.viewport.scrollTop = m(p));
952
- }
953
- }
954
- ) : null;
955
- }), rn = a.forwardRef((e, t) => {
956
- const { sizes: n, onSizesChange: r, ...o } = e, l = x(O, e.__scopeScrollArea), [s, c] = a.useState(), d = a.useRef(null), u = _(t, d, l.onScrollbarXChange);
957
- return a.useEffect(() => {
958
- d.current && c(getComputedStyle(d.current));
959
- }, [d]), /* @__PURE__ */ f(
960
- Ye,
961
- {
962
- "data-orientation": "horizontal",
963
- ...o,
964
- ref: u,
965
- sizes: n,
966
- style: {
967
- bottom: 0,
968
- left: l.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
969
- right: l.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
970
- "--radix-scroll-area-thumb-width": Z(n) + "px",
971
- ...e.style
972
- },
973
- onThumbPointerDown: (i) => e.onThumbPointerDown(i.x),
974
- onDragScroll: (i) => e.onDragScroll(i.x),
975
- onWheelScroll: (i, m) => {
976
- if (l.viewport) {
977
- const p = l.viewport.scrollLeft + i.deltaX;
978
- e.onWheelScroll(p), qe(p, m) && i.preventDefault();
979
- }
980
- },
981
- onResize: () => {
982
- d.current && l.viewport && s && r({
983
- content: l.viewport.scrollWidth,
984
- viewport: l.viewport.offsetWidth,
985
- scrollbar: {
986
- size: d.current.clientWidth,
987
- paddingStart: X(s.paddingLeft),
988
- paddingEnd: X(s.paddingRight)
989
- }
990
- });
991
- }
992
- }
993
- );
994
- }), on = a.forwardRef((e, t) => {
995
- const { sizes: n, onSizesChange: r, ...o } = e, l = x(O, e.__scopeScrollArea), [s, c] = a.useState(), d = a.useRef(null), u = _(t, d, l.onScrollbarYChange);
996
- return a.useEffect(() => {
997
- d.current && c(getComputedStyle(d.current));
998
- }, [d]), /* @__PURE__ */ f(
999
- Ye,
1000
- {
1001
- "data-orientation": "vertical",
1002
- ...o,
1003
- ref: u,
1004
- sizes: n,
1005
- style: {
1006
- top: 0,
1007
- right: l.dir === "ltr" ? 0 : void 0,
1008
- left: l.dir === "rtl" ? 0 : void 0,
1009
- bottom: "var(--radix-scroll-area-corner-height)",
1010
- "--radix-scroll-area-thumb-height": Z(n) + "px",
1011
- ...e.style
1012
- },
1013
- onThumbPointerDown: (i) => e.onThumbPointerDown(i.y),
1014
- onDragScroll: (i) => e.onDragScroll(i.y),
1015
- onWheelScroll: (i, m) => {
1016
- if (l.viewport) {
1017
- const p = l.viewport.scrollTop + i.deltaY;
1018
- e.onWheelScroll(p), qe(p, m) && i.preventDefault();
1019
- }
1020
- },
1021
- onResize: () => {
1022
- d.current && l.viewport && s && r({
1023
- content: l.viewport.scrollHeight,
1024
- viewport: l.viewport.offsetHeight,
1025
- scrollbar: {
1026
- size: d.current.clientHeight,
1027
- paddingStart: X(s.paddingTop),
1028
- paddingEnd: X(s.paddingBottom)
1029
- }
1030
- });
1031
- }
1032
- }
1033
- );
1034
- }), [an, Be] = ke(O), Ye = a.forwardRef((e, t) => {
1035
- const {
1036
- __scopeScrollArea: n,
1037
- sizes: r,
1038
- hasThumb: o,
1039
- onThumbChange: l,
1040
- onThumbPointerUp: s,
1041
- onThumbPointerDown: c,
1042
- onThumbPositionChange: d,
1043
- onDragScroll: u,
1044
- onWheelScroll: i,
1045
- onResize: m,
1046
- ...p
1047
- } = e, h = x(O, n), [g, w] = a.useState(null), v = _(t, (C) => w(C)), S = a.useRef(null), T = a.useRef(""), b = h.viewport, y = r.content - r.viewport, I = L(i), P = L(d), D = J(m, 10);
1048
- function N(C) {
1049
- if (S.current) {
1050
- const E = C.clientX - S.current.left, M = C.clientY - S.current.top;
1051
- u({ x: E, y: M });
1052
- }
1053
- }
1054
- return a.useEffect(() => {
1055
- const C = (E) => {
1056
- const M = E.target;
1057
- (g == null ? void 0 : g.contains(M)) && I(E, y);
1058
- };
1059
- return document.addEventListener("wheel", C, { passive: !1 }), () => document.removeEventListener("wheel", C, { passive: !1 });
1060
- }, [b, g, y, I]), a.useEffect(P, [r, P]), U(g, D), U(h.content, D), /* @__PURE__ */ f(
1061
- an,
1062
- {
1063
- scope: n,
1064
- scrollbar: g,
1065
- hasThumb: o,
1066
- onThumbChange: L(l),
1067
- onThumbPointerUp: L(s),
1068
- onThumbPositionChange: P,
1069
- onThumbPointerDown: L(c),
1070
- children: /* @__PURE__ */ f(
1071
- z.div,
1072
- {
1073
- ...p,
1074
- ref: v,
1075
- style: { position: "absolute", ...p.style },
1076
- onPointerDown: R(e.onPointerDown, (C) => {
1077
- C.button === 0 && (C.target.setPointerCapture(C.pointerId), S.current = g.getBoundingClientRect(), T.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", h.viewport && (h.viewport.style.scrollBehavior = "auto"), N(C));
1078
- }),
1079
- onPointerMove: R(e.onPointerMove, N),
1080
- onPointerUp: R(e.onPointerUp, (C) => {
1081
- const E = C.target;
1082
- E.hasPointerCapture(C.pointerId) && E.releasePointerCapture(C.pointerId), document.body.style.webkitUserSelect = T.current, h.viewport && (h.viewport.style.scrollBehavior = ""), S.current = null;
1083
- })
1084
- }
1085
- )
1086
- }
1087
- );
1088
- }), G = "ScrollAreaThumb", je = a.forwardRef(
1089
- (e, t) => {
1090
- const { forceMount: n, ...r } = e, o = Be(G, e.__scopeScrollArea);
1091
- return /* @__PURE__ */ f(B, { present: n || o.hasThumb, children: /* @__PURE__ */ f(ln, { ref: t, ...r }) });
1092
- }
1093
- ), ln = a.forwardRef(
1094
- (e, t) => {
1095
- const { __scopeScrollArea: n, style: r, ...o } = e, l = x(G, n), s = Be(G, n), { onThumbPositionChange: c } = s, d = _(
1096
- t,
1097
- (m) => s.onThumbChange(m)
1098
- ), u = a.useRef(void 0), i = J(() => {
1099
- u.current && (u.current(), u.current = void 0);
1100
- }, 100);
1101
- return a.useEffect(() => {
1102
- const m = l.viewport;
1103
- if (m) {
1104
- const p = () => {
1105
- if (i(), !u.current) {
1106
- const h = un(m, c);
1107
- u.current = h, c();
1108
- }
1109
- };
1110
- return c(), m.addEventListener("scroll", p), () => m.removeEventListener("scroll", p);
1111
- }
1112
- }, [l.viewport, i, c]), /* @__PURE__ */ f(
1113
- z.div,
1114
- {
1115
- "data-state": s.hasThumb ? "visible" : "hidden",
1116
- ...o,
1117
- ref: d,
1118
- style: {
1119
- width: "var(--radix-scroll-area-thumb-width)",
1120
- height: "var(--radix-scroll-area-thumb-height)",
1121
- ...r
1122
- },
1123
- onPointerDownCapture: R(e.onPointerDownCapture, (m) => {
1124
- const h = m.target.getBoundingClientRect(), g = m.clientX - h.left, w = m.clientY - h.top;
1125
- s.onThumbPointerDown({ x: g, y: w });
1126
- }),
1127
- onPointerUp: R(e.onPointerUp, s.onThumbPointerUp)
1128
- }
1129
- );
1130
- }
1131
- );
1132
- je.displayName = G;
1133
- var se = "ScrollAreaCorner", Ge = a.forwardRef(
1134
- (e, t) => {
1135
- const n = x(se, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
1136
- return n.type !== "scroll" && r ? /* @__PURE__ */ f(sn, { ...e, ref: t }) : null;
1137
- }
1138
- );
1139
- Ge.displayName = se;
1140
- var sn = a.forwardRef((e, t) => {
1141
- const { __scopeScrollArea: n, ...r } = e, o = x(se, n), [l, s] = a.useState(0), [c, d] = a.useState(0), u = !!(l && c);
1142
- return U(o.scrollbarX, () => {
1143
- var m;
1144
- const i = ((m = o.scrollbarX) == null ? void 0 : m.offsetHeight) || 0;
1145
- o.onCornerHeightChange(i), d(i);
1146
- }), U(o.scrollbarY, () => {
1147
- var m;
1148
- const i = ((m = o.scrollbarY) == null ? void 0 : m.offsetWidth) || 0;
1149
- o.onCornerWidthChange(i), s(i);
1150
- }), u ? /* @__PURE__ */ f(
1151
- z.div,
1152
- {
1153
- ...r,
1154
- ref: t,
1155
- style: {
1156
- width: l,
1157
- height: c,
1158
- position: "absolute",
1159
- right: o.dir === "ltr" ? 0 : void 0,
1160
- left: o.dir === "rtl" ? 0 : void 0,
1161
- bottom: 0,
1162
- ...e.style
1163
- }
1164
- }
1165
- ) : null;
1166
- });
1167
- function X(e) {
1168
- return e ? parseInt(e, 10) : 0;
1169
- }
1170
- function Xe(e, t) {
1171
- const n = e / t;
1172
- return isNaN(n) ? 0 : n;
1173
- }
1174
- function Z(e) {
1175
- const t = Xe(e.viewport, e.content), n = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, r = (e.scrollbar.size - n) * t;
1176
- return Math.max(r, 18);
1177
- }
1178
- function cn(e, t, n, r = "ltr") {
1179
- const o = Z(n), l = o / 2, s = t || l, c = o - s, d = n.scrollbar.paddingStart + s, u = n.scrollbar.size - n.scrollbar.paddingEnd - c, i = n.content - n.viewport, m = r === "ltr" ? [0, i] : [i * -1, 0];
1180
- return Ke([d, u], m)(e);
1181
- }
1182
- function ue(e, t, n = "ltr") {
1183
- const r = Z(t), o = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, l = t.scrollbar.size - o, s = t.content - t.viewport, c = l - r, d = n === "ltr" ? [0, s] : [s * -1, 0], u = st(e, d);
1184
- return Ke([0, s], [0, c])(u);
1185
- }
1186
- function Ke(e, t) {
1187
- return (n) => {
1188
- if (e[0] === e[1] || t[0] === t[1]) return t[0];
1189
- const r = (t[1] - t[0]) / (e[1] - e[0]);
1190
- return t[0] + r * (n - e[0]);
1191
- };
1192
- }
1193
- function qe(e, t) {
1194
- return e > 0 && e < t;
1195
- }
1196
- var un = (e, t = () => {
1197
- }) => {
1198
- let n = { left: e.scrollLeft, top: e.scrollTop }, r = 0;
1199
- return (function o() {
1200
- const l = { left: e.scrollLeft, top: e.scrollTop }, s = n.left !== l.left, c = n.top !== l.top;
1201
- (s || c) && t(), n = l, r = window.requestAnimationFrame(o);
1202
- })(), () => window.cancelAnimationFrame(r);
1203
- };
1204
- function J(e, t) {
1205
- const n = L(e), r = a.useRef(0);
1206
- return a.useEffect(() => () => window.clearTimeout(r.current), []), a.useCallback(() => {
1207
- window.clearTimeout(r.current), r.current = window.setTimeout(n, t);
1208
- }, [n, t]);
1209
- }
1210
- function U(e, t) {
1211
- const n = L(t);
1212
- $(() => {
1213
- let r = 0;
1214
- if (e) {
1215
- const o = new ResizeObserver(() => {
1216
- cancelAnimationFrame(r), r = window.requestAnimationFrame(n);
1217
- });
1218
- return o.observe(e), () => {
1219
- window.cancelAnimationFrame(r), o.unobserve(e);
1220
- };
1221
- }
1222
- }, [e, n]);
1223
- }
1224
- var Ze = Ve, dn = He, fn = Ge;
1225
- const Je = a.forwardRef(
1226
- ({ className: e, children: t, ...n }, r) => /* @__PURE__ */ A(Ze, { ref: r, className: k("relative overflow-hidden", e), ...n, children: [
1227
- /* @__PURE__ */ f(dn, { className: "h-full w-full rounded-[inherit]", children: t }),
1228
- /* @__PURE__ */ f(Qe, {}),
1229
- /* @__PURE__ */ f(fn, {})
1230
- ] })
1231
- );
1232
- Je.displayName = Ze.displayName;
1233
- const Qe = a.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r) => /* @__PURE__ */ f(
1234
- ae,
1235
- {
1236
- ref: r,
1237
- orientation: t,
1238
- className: k(
1239
- "flex touch-none select-none transition-colors",
1240
- t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1241
- t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
1242
- e
1243
- ),
1244
- ...n,
1245
- children: /* @__PURE__ */ f(je, { className: "relative flex-1 rounded-full bg-border" })
1246
- }
1247
- ));
1248
- Qe.displayName = ae.displayName;
1249
- const An = ({ tabs: e, item: t }) => {
1250
- var u;
1251
- const { t: n } = pe(), [r, o] = he(), l = r.get("tab") || ((u = e[0]) == null ? void 0 : u.value), s = (i) => {
1252
- const m = new URLSearchParams();
1253
- m.set("tab", i), o(m);
1254
- }, c = () => {
1255
- const i = e.find((m) => m.value === l);
1256
- return i ? i.component ? i.component() : d() : null;
1257
- }, d = () => /* @__PURE__ */ f("div", { className: "p-4 lg:p-6", children: /* @__PURE__ */ f("div", { className: "flex items-center justify-center h-64 text-gray-500", children: /* @__PURE__ */ A("div", { className: "text-center", children: [
1258
- /* @__PURE__ */ f(Q, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
1259
- /* @__PURE__ */ f("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
1260
- /* @__PURE__ */ f("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
1261
- ] }) }) });
1262
- return /* @__PURE__ */ A("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
1263
- /* @__PURE__ */ f("div", { className: "w-64 lg:w-80 flex-shrink-0 hidden md:block border-r border-gray-200 dark:border-gray-700 pr-4", children: /* @__PURE__ */ f(Je, { className: "h-full", children: /* @__PURE__ */ f("div", { className: "space-y-1", children: e.map((i, m) => /* @__PURE__ */ A(
1264
- "div",
1265
- {
1266
- className: `px-2 py-2 rounded-2xl text-sm transition-colors flex items-center gap-2 ${i.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : l === i.value ? "crm-color-styled font-medium cursor-pointer" : "text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 cursor-pointer"}`,
1267
- onClick: () => !i.disabled && s(i.value),
1268
- children: [
1269
- i.icon && /* @__PURE__ */ f(i.icon, { className: "size-4" }),
1270
- /* @__PURE__ */ f("span", { className: "flex-1", children: n(i.titleKey) }),
1271
- i.count && /* @__PURE__ */ A("span", { className: "text-xs text-gray-500", children: [
1272
- "(",
1273
- i.count(t),
1274
- ")"
1275
- ] }),
1276
- !i.component && /* @__PURE__ */ f(Q, { className: "size-4 text-amber-500" })
1277
- ]
1278
- },
1279
- m
1280
- )) }) }) }),
1281
- /* @__PURE__ */ f("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ A(ct, { value: l, onValueChange: s, children: [
1282
- /* @__PURE__ */ f(ut, { className: "w-full", children: /* @__PURE__ */ f(dt, { placeholder: "Sélectionner une section" }) }),
1283
- /* @__PURE__ */ f(ft, { children: e.map((i, m) => /* @__PURE__ */ f(mt, { value: i.value, disabled: i.disabled, children: /* @__PURE__ */ A("div", { className: "flex items-center gap-2", children: [
1284
- i.icon && /* @__PURE__ */ f(i.icon, { className: "size-4" }),
1285
- /* @__PURE__ */ f("span", { children: n(i.titleKey) }),
1286
- i.count && /* @__PURE__ */ A("span", { className: "text-xs text-gray-500", children: [
1287
- "(",
1288
- i.count(t),
1289
- ")"
1290
- ] }),
1291
- !i.component && /* @__PURE__ */ f(Q, { className: "size-4 text-amber-500" })
1292
- ] }) }, m)) })
1293
- ] }) }),
1294
- /* @__PURE__ */ f("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: c() })
1295
- ] });
1296
- };
1297
- export {
1298
- Rn as A,
1299
- vt as a,
1300
- En as b,
1301
- An as c
1302
- };