@krosoft/react 0.0.85 → 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 (49) hide show
  1. package/dist/AppSubTitle-DaFa30Qp.js +13 -0
  2. package/dist/{AppTitle-CJZdhpRm.js → AppTitle-COtcNGNr.js} +4 -4
  3. package/dist/AppVerticalTabs-aeKDheVe.js +829 -0
  4. package/dist/{FormDialog-CwxZPmv4.js → FormDialog-B3u7bHU_.js} +18 -18
  5. package/dist/{MetricCard-5kWhYPKJ.js → MetricCard-L5ETuqBs.js} +3 -3
  6. package/dist/{SearchInput-Dpy2amwO.js → SearchInput-BxnaShYy.js} +3 -3
  7. package/dist/{TableFilter-w9BHeObX.js → TableFilter-RzydxKBF.js} +6 -5
  8. package/dist/{TableSettings-DNkdLgCN.js → TableSettings-Bwysm3KH.js} +15 -15
  9. package/dist/{ThemeSelector-BCU1tFyR.js → ThemeSelector-mZBbr2qt.js} +3 -3
  10. package/dist/{Topbar-DifQ00kV.js → Topbar-DzFClMWt.js} +6 -5
  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.d.ts +1 -0
  15. package/dist/components/core/filters/index.d.ts.map +1 -1
  16. package/dist/components/core/filters/index.js +5 -4
  17. package/dist/components/core/index.d.ts +4 -4
  18. package/dist/components/core/index.d.ts.map +1 -1
  19. package/dist/components/core/index.js +55 -46
  20. package/dist/components/core/inputs/index.js +1 -1
  21. package/dist/components/core/layouts/AppSubTitle.d.ts +8 -0
  22. package/dist/components/core/layouts/AppSubTitle.d.ts.map +1 -0
  23. package/dist/components/core/layouts/index.d.ts +1 -0
  24. package/dist/components/core/layouts/index.d.ts.map +1 -1
  25. package/dist/components/core/layouts/index.js +5 -3
  26. package/dist/components/core/navbar/index.d.ts +2 -0
  27. package/dist/components/core/navbar/index.d.ts.map +1 -1
  28. package/dist/components/core/navbar/index.js +4 -3
  29. package/dist/components/core/table/index.js +1 -1
  30. package/dist/components/core/tabs/index.d.ts +5 -0
  31. package/dist/components/core/tabs/index.d.ts.map +1 -0
  32. package/dist/components/core/tabs/index.js +7 -0
  33. package/dist/components/core/theme/index.js +1 -1
  34. package/dist/components/index.js +109 -100
  35. package/dist/components/ui/index.js +4 -4
  36. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  37. package/dist/dropdown-menu-BDcm9kW8.js +1086 -0
  38. package/dist/index-DUnCfjrC.js +2176 -0
  39. package/dist/popover-PsZp711z.js +4533 -0
  40. package/dist/select-C6w0ck7-.js +1737 -0
  41. package/dist/tooltip-CtjaR1qq.js +337 -0
  42. package/dist/types/UseDataTableResult.d.ts +1 -1
  43. package/dist/types/UseDataTableResult.d.ts.map +1 -1
  44. package/package.json +6 -5
  45. package/dist/dropdown-menu-Q_WkonPk.js +0 -1685
  46. package/dist/floating-ui.react-dom-BIcsGc3t.js +0 -1681
  47. package/dist/popover-BMvYmQOM.js +0 -5897
  48. package/dist/select-CtU681LB.js +0 -2070
  49. package/dist/tooltip-DzQngJZK.js +0 -828
@@ -0,0 +1,829 @@
1
+ import { jsxs as b, jsx as s, Fragment as ke } from "react/jsx-runtime";
2
+ import { C as Me, d as ze, a as He } from "./card-7XPLAra3.js";
3
+ import { a as We, A as Ve } from "./AppTitle-COtcNGNr.js";
4
+ import * as i from "react";
5
+ import { h as x, i as y, P as D, a as Q, f as Oe, e as Fe, u as N, l as P, o as Xe } from "./index-DUnCfjrC.js";
6
+ import { R as Ye, I as Ue, e as Z } from "./dropdown-menu-BDcm9kW8.js";
7
+ import { u as ee, m as Be, S as $e, h as je, i as Ge, a as Ke, c as qe } from "./select-C6w0ck7-.js";
8
+ import { c as E } from "./index-gWiv5-6R.js";
9
+ import { useTranslation as re } from "react-i18next";
10
+ import { useSearchParams as te } from "react-router-dom";
11
+ import { c as Je } from "./createLucideIcon-CRdjzt2A.js";
12
+ /**
13
+ * @license lucide-react v1.16.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */
18
+ const Qe = [
19
+ ["rect", { x: "2", y: "6", width: "20", height: "8", rx: "1", key: "1estib" }],
20
+ ["path", { d: "M17 14v7", key: "7m2elx" }],
21
+ ["path", { d: "M7 14v7", key: "1cm7wv" }],
22
+ ["path", { d: "M17 3v3", key: "1v4jwn" }],
23
+ ["path", { d: "M7 3v3", key: "7o6guu" }],
24
+ ["path", { d: "M10 14 2.3 6.3", key: "1023jk" }],
25
+ ["path", { d: "m14 6 7.7 7.7", key: "1s8pl2" }],
26
+ ["path", { d: "m8 6 8 8", key: "hl96qh" }]
27
+ ], B = Je("construction", Qe);
28
+ function Ze({ titleKey: e, descriptionKey: t, actions: r = [], className: l }) {
29
+ return /* @__PURE__ */ b("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
30
+ /* @__PURE__ */ s(We, { titleKey: e, descriptionKey: t, isSubTitle: !0 }),
31
+ /* @__PURE__ */ s(Ve, { actions: r, className: l })
32
+ ] });
33
+ }
34
+ function Nr({ titleKey: e, descriptionKey: t, actions: r = [], className: l, children: n, isSubTitle: a }) {
35
+ return /* @__PURE__ */ b(Me, { children: [
36
+ /* @__PURE__ */ s(ze, { children: /* @__PURE__ */ s(Ze, { titleKey: e, descriptionKey: t, actions: r, className: l }) }),
37
+ /* @__PURE__ */ s(He, { className: "space-y-4", children: n })
38
+ ] });
39
+ }
40
+ var O = "Tabs", [er] = Q(O, [
41
+ Z
42
+ ]), oe = Z(), [rr, $] = er(O), ne = i.forwardRef(
43
+ (e, t) => {
44
+ const {
45
+ __scopeTabs: r,
46
+ value: l,
47
+ onValueChange: n,
48
+ defaultValue: a,
49
+ orientation: c = "horizontal",
50
+ dir: d,
51
+ activationMode: f = "automatic",
52
+ ...h
53
+ } = e, o = ee(d), [u, m] = Oe({
54
+ prop: l,
55
+ onChange: n,
56
+ defaultProp: a ?? "",
57
+ caller: O
58
+ });
59
+ return /* @__PURE__ */ s(
60
+ rr,
61
+ {
62
+ scope: r,
63
+ baseId: Fe(),
64
+ value: u,
65
+ onValueChange: m,
66
+ orientation: c,
67
+ dir: o,
68
+ activationMode: f,
69
+ children: /* @__PURE__ */ s(
70
+ x.div,
71
+ {
72
+ dir: o,
73
+ "data-orientation": c,
74
+ ...h,
75
+ ref: t
76
+ }
77
+ )
78
+ }
79
+ );
80
+ }
81
+ );
82
+ ne.displayName = O;
83
+ var le = "TabsList", ae = i.forwardRef(
84
+ (e, t) => {
85
+ const { __scopeTabs: r, loop: l = !0, ...n } = e, a = $(le, r), c = oe(r);
86
+ return /* @__PURE__ */ s(
87
+ Ye,
88
+ {
89
+ asChild: !0,
90
+ ...c,
91
+ orientation: a.orientation,
92
+ dir: a.dir,
93
+ loop: l,
94
+ children: /* @__PURE__ */ s(
95
+ x.div,
96
+ {
97
+ role: "tablist",
98
+ "aria-orientation": a.orientation,
99
+ ...n,
100
+ ref: t
101
+ }
102
+ )
103
+ }
104
+ );
105
+ }
106
+ );
107
+ ae.displayName = le;
108
+ var se = "TabsTrigger", ce = i.forwardRef(
109
+ (e, t) => {
110
+ const { __scopeTabs: r, value: l, disabled: n = !1, ...a } = e, c = $(se, r), d = oe(r), f = ue(c.baseId, l), h = fe(c.baseId, l), o = l === c.value;
111
+ return /* @__PURE__ */ s(
112
+ Ue,
113
+ {
114
+ asChild: !0,
115
+ ...d,
116
+ focusable: !n,
117
+ active: o,
118
+ children: /* @__PURE__ */ s(
119
+ x.button,
120
+ {
121
+ type: "button",
122
+ role: "tab",
123
+ "aria-selected": o,
124
+ "aria-controls": h,
125
+ "data-state": o ? "active" : "inactive",
126
+ "data-disabled": n ? "" : void 0,
127
+ disabled: n,
128
+ id: f,
129
+ ...a,
130
+ ref: t,
131
+ onMouseDown: y(e.onMouseDown, (u) => {
132
+ !n && u.button === 0 && u.ctrlKey === !1 ? c.onValueChange(l) : u.preventDefault();
133
+ }),
134
+ onKeyDown: y(e.onKeyDown, (u) => {
135
+ [" ", "Enter"].includes(u.key) && c.onValueChange(l);
136
+ }),
137
+ onFocus: y(e.onFocus, () => {
138
+ const u = c.activationMode !== "manual";
139
+ !o && !n && u && c.onValueChange(l);
140
+ })
141
+ }
142
+ )
143
+ }
144
+ );
145
+ }
146
+ );
147
+ ce.displayName = se;
148
+ var ie = "TabsContent", de = i.forwardRef(
149
+ (e, t) => {
150
+ const { __scopeTabs: r, value: l, forceMount: n, children: a, ...c } = e, d = $(ie, r), f = ue(d.baseId, l), h = fe(d.baseId, l), o = l === d.value, u = i.useRef(o);
151
+ return i.useEffect(() => {
152
+ const m = requestAnimationFrame(() => u.current = !1);
153
+ return () => cancelAnimationFrame(m);
154
+ }, []), /* @__PURE__ */ s(D, { present: n || o, children: ({ present: m }) => /* @__PURE__ */ s(
155
+ x.div,
156
+ {
157
+ "data-state": o ? "active" : "inactive",
158
+ "data-orientation": d.orientation,
159
+ role: "tabpanel",
160
+ "aria-labelledby": f,
161
+ hidden: !m,
162
+ id: h,
163
+ tabIndex: 0,
164
+ ...c,
165
+ ref: t,
166
+ style: {
167
+ ...e.style,
168
+ animationDuration: u.current ? "0s" : void 0
169
+ },
170
+ children: m && a
171
+ }
172
+ ) });
173
+ }
174
+ );
175
+ de.displayName = ie;
176
+ function ue(e, t) {
177
+ return `${e}-trigger-${t}`;
178
+ }
179
+ function fe(e, t) {
180
+ return `${e}-content-${t}`;
181
+ }
182
+ var tr = ne, he = ae, me = ce, pe = de;
183
+ const or = tr, ve = i.forwardRef(
184
+ ({ className: e, ...t }, r) => /* @__PURE__ */ s(
185
+ he,
186
+ {
187
+ ref: r,
188
+ className: E("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", e),
189
+ ...t
190
+ }
191
+ )
192
+ );
193
+ ve.displayName = he.displayName;
194
+ const be = i.forwardRef(
195
+ ({ className: e, ...t }, r) => /* @__PURE__ */ s(
196
+ me,
197
+ {
198
+ ref: r,
199
+ className: E(
200
+ "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",
201
+ e
202
+ ),
203
+ ...t
204
+ }
205
+ )
206
+ );
207
+ be.displayName = me.displayName;
208
+ const ge = i.forwardRef(
209
+ ({ className: e, ...t }, r) => /* @__PURE__ */ s(
210
+ pe,
211
+ {
212
+ ref: r,
213
+ className: E(
214
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
215
+ e
216
+ ),
217
+ ...t
218
+ }
219
+ )
220
+ );
221
+ ge.displayName = pe.displayName;
222
+ function Er({ tabs: e, itemId: t, item: r, fit: l }) {
223
+ var h;
224
+ const { t: n } = re(), [a, c] = te(), d = a.get("tab") || ((h = e[0]) == null ? void 0 : h.value);
225
+ return /* @__PURE__ */ b(or, { value: d, onValueChange: (o) => {
226
+ const u = new URLSearchParams();
227
+ u.set("tab", o), c(u);
228
+ }, children: [
229
+ /* @__PURE__ */ s(ve, { className: E("w-full justify-start", l && "sm:w-fit"), children: e.map((o) => /* @__PURE__ */ b(be, { value: o.value, className: "gap-2", disabled: o.disabled, children: [
230
+ o.icon ? /* @__PURE__ */ s("span", { className: "hidden sm:inline", children: /* @__PURE__ */ s(o.icon, { className: "size-4" }) }) : null,
231
+ /* @__PURE__ */ s("span", { className: "text-xs sm:text-sm", children: n(o.titleKey) ?? "" }),
232
+ o.count ? /* @__PURE__ */ b("span", { className: "text-gray-500 text-xs", children: [
233
+ "(",
234
+ o.count(r),
235
+ ")"
236
+ ] }) : null
237
+ ] }, o.value)) }),
238
+ e.map((o) => /* @__PURE__ */ s(ge, { value: o.value, className: "mt-4", children: o.component ? o.component(t) : null }, o.value))
239
+ ] });
240
+ }
241
+ function nr(e, t) {
242
+ return i.useReducer((r, l) => t[r][l] ?? r, e);
243
+ }
244
+ var j = "ScrollArea", [Se] = Q(j), [lr, S] = Se(j), we = i.forwardRef(
245
+ (e, t) => {
246
+ const {
247
+ __scopeScrollArea: r,
248
+ type: l = "hover",
249
+ dir: n,
250
+ scrollHideDelay: a = 600,
251
+ ...c
252
+ } = e, [d, f] = i.useState(null), [h, o] = i.useState(null), [u, m] = i.useState(null), [p, g] = i.useState(null), [_, Y] = i.useState(null), [T, I] = i.useState(0), [U, k] = i.useState(0), [M, L] = i.useState(!1), [z, H] = i.useState(!1), v = N(t, (R) => f(R)), w = ee(n);
253
+ return /* @__PURE__ */ s(
254
+ lr,
255
+ {
256
+ scope: r,
257
+ type: l,
258
+ dir: w,
259
+ scrollHideDelay: a,
260
+ scrollArea: d,
261
+ viewport: h,
262
+ onViewportChange: o,
263
+ content: u,
264
+ onContentChange: m,
265
+ scrollbarX: p,
266
+ onScrollbarXChange: g,
267
+ scrollbarXEnabled: M,
268
+ onScrollbarXEnabledChange: L,
269
+ scrollbarY: _,
270
+ onScrollbarYChange: Y,
271
+ scrollbarYEnabled: z,
272
+ onScrollbarYEnabledChange: H,
273
+ onCornerWidthChange: I,
274
+ onCornerHeightChange: k,
275
+ children: /* @__PURE__ */ s(
276
+ x.div,
277
+ {
278
+ dir: w,
279
+ ...c,
280
+ ref: v,
281
+ style: {
282
+ position: "relative",
283
+ // Pass corner sizes as CSS vars to reduce re-renders of context consumers
284
+ "--radix-scroll-area-corner-width": T + "px",
285
+ "--radix-scroll-area-corner-height": U + "px",
286
+ ...e.style
287
+ }
288
+ }
289
+ )
290
+ }
291
+ );
292
+ }
293
+ );
294
+ we.displayName = j;
295
+ var ye = "ScrollAreaViewport", Ce = i.forwardRef(
296
+ (e, t) => {
297
+ const { __scopeScrollArea: r, children: l, nonce: n, ...a } = e, c = S(ye, r), d = i.useRef(null), f = N(t, d, c.onViewportChange);
298
+ return /* @__PURE__ */ b(ke, { children: [
299
+ /* @__PURE__ */ s(
300
+ "style",
301
+ {
302
+ dangerouslySetInnerHTML: {
303
+ __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}"
304
+ },
305
+ nonce: n
306
+ }
307
+ ),
308
+ /* @__PURE__ */ s(
309
+ x.div,
310
+ {
311
+ "data-radix-scroll-area-viewport": "",
312
+ ...a,
313
+ ref: f,
314
+ style: {
315
+ /**
316
+ * We don't support `visible` because the intention is to have at least one scrollbar
317
+ * if this component is used and `visible` will behave like `auto` in that case
318
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
319
+ *
320
+ * We don't handle `auto` because the intention is for the native implementation
321
+ * to be hidden if using this component. We just want to ensure the node is scrollable
322
+ * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
323
+ * the browser from having to work out whether to render native scrollbars or not,
324
+ * we tell it to with the intention of hiding them in CSS.
325
+ */
326
+ overflowX: c.scrollbarXEnabled ? "scroll" : "hidden",
327
+ overflowY: c.scrollbarYEnabled ? "scroll" : "hidden",
328
+ ...e.style
329
+ },
330
+ children: /* @__PURE__ */ s("div", { ref: c.onContentChange, style: { minWidth: "100%", display: "table" }, children: l })
331
+ }
332
+ )
333
+ ] });
334
+ }
335
+ );
336
+ Ce.displayName = ye;
337
+ var C = "ScrollAreaScrollbar", G = i.forwardRef(
338
+ (e, t) => {
339
+ const { forceMount: r, ...l } = e, n = S(C, e.__scopeScrollArea), { onScrollbarXEnabledChange: a, onScrollbarYEnabledChange: c } = n, d = e.orientation === "horizontal";
340
+ return i.useEffect(() => (d ? a(!0) : c(!0), () => {
341
+ d ? a(!1) : c(!1);
342
+ }), [d, a, c]), n.type === "hover" ? /* @__PURE__ */ s(ar, { ...l, ref: t, forceMount: r }) : n.type === "scroll" ? /* @__PURE__ */ s(sr, { ...l, ref: t, forceMount: r }) : n.type === "auto" ? /* @__PURE__ */ s(xe, { ...l, ref: t, forceMount: r }) : n.type === "always" ? /* @__PURE__ */ s(K, { ...l, ref: t }) : null;
343
+ }
344
+ );
345
+ G.displayName = C;
346
+ var ar = i.forwardRef((e, t) => {
347
+ const { forceMount: r, ...l } = e, n = S(C, e.__scopeScrollArea), [a, c] = i.useState(!1);
348
+ return i.useEffect(() => {
349
+ const d = n.scrollArea;
350
+ let f = 0;
351
+ if (d) {
352
+ const h = () => {
353
+ window.clearTimeout(f), c(!0);
354
+ }, o = () => {
355
+ f = window.setTimeout(() => c(!1), n.scrollHideDelay);
356
+ };
357
+ return d.addEventListener("pointerenter", h), d.addEventListener("pointerleave", o), () => {
358
+ window.clearTimeout(f), d.removeEventListener("pointerenter", h), d.removeEventListener("pointerleave", o);
359
+ };
360
+ }
361
+ }, [n.scrollArea, n.scrollHideDelay]), /* @__PURE__ */ s(D, { present: r || a, children: /* @__PURE__ */ s(
362
+ xe,
363
+ {
364
+ "data-state": a ? "visible" : "hidden",
365
+ ...l,
366
+ ref: t
367
+ }
368
+ ) });
369
+ }), sr = i.forwardRef((e, t) => {
370
+ const { forceMount: r, ...l } = e, n = S(C, e.__scopeScrollArea), a = e.orientation === "horizontal", c = X(() => f("SCROLL_END"), 100), [d, f] = nr("hidden", {
371
+ hidden: {
372
+ SCROLL: "scrolling"
373
+ },
374
+ scrolling: {
375
+ SCROLL_END: "idle",
376
+ POINTER_ENTER: "interacting"
377
+ },
378
+ interacting: {
379
+ SCROLL: "interacting",
380
+ POINTER_LEAVE: "idle"
381
+ },
382
+ idle: {
383
+ HIDE: "hidden",
384
+ SCROLL: "scrolling",
385
+ POINTER_ENTER: "interacting"
386
+ }
387
+ });
388
+ return i.useEffect(() => {
389
+ if (d === "idle") {
390
+ const h = window.setTimeout(() => f("HIDE"), n.scrollHideDelay);
391
+ return () => window.clearTimeout(h);
392
+ }
393
+ }, [d, n.scrollHideDelay, f]), i.useEffect(() => {
394
+ const h = n.viewport, o = a ? "scrollLeft" : "scrollTop";
395
+ if (h) {
396
+ let u = h[o];
397
+ const m = () => {
398
+ const p = h[o];
399
+ u !== p && (f("SCROLL"), c()), u = p;
400
+ };
401
+ return h.addEventListener("scroll", m), () => h.removeEventListener("scroll", m);
402
+ }
403
+ }, [n.viewport, a, f, c]), /* @__PURE__ */ s(D, { present: r || d !== "hidden", children: /* @__PURE__ */ s(
404
+ K,
405
+ {
406
+ "data-state": d === "hidden" ? "hidden" : "visible",
407
+ ...l,
408
+ ref: t,
409
+ onPointerEnter: y(e.onPointerEnter, () => f("POINTER_ENTER")),
410
+ onPointerLeave: y(e.onPointerLeave, () => f("POINTER_LEAVE"))
411
+ }
412
+ ) });
413
+ }), xe = i.forwardRef((e, t) => {
414
+ const r = S(C, e.__scopeScrollArea), { forceMount: l, ...n } = e, [a, c] = i.useState(!1), d = e.orientation === "horizontal", f = X(() => {
415
+ if (r.viewport) {
416
+ const h = r.viewport.offsetWidth < r.viewport.scrollWidth, o = r.viewport.offsetHeight < r.viewport.scrollHeight;
417
+ c(d ? h : o);
418
+ }
419
+ }, 10);
420
+ return A(r.viewport, f), A(r.content, f), /* @__PURE__ */ s(D, { present: l || a, children: /* @__PURE__ */ s(
421
+ K,
422
+ {
423
+ "data-state": a ? "visible" : "hidden",
424
+ ...n,
425
+ ref: t
426
+ }
427
+ ) });
428
+ }), K = i.forwardRef((e, t) => {
429
+ const { orientation: r = "vertical", ...l } = e, n = S(C, e.__scopeScrollArea), a = i.useRef(null), c = i.useRef(0), [d, f] = i.useState({
430
+ content: 0,
431
+ viewport: 0,
432
+ scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
433
+ }), h = Ne(d.viewport, d.content), o = {
434
+ ...l,
435
+ sizes: d,
436
+ onSizesChange: f,
437
+ hasThumb: h > 0 && h < 1,
438
+ onThumbChange: (m) => a.current = m,
439
+ onThumbPointerUp: () => c.current = 0,
440
+ onThumbPointerDown: (m) => c.current = m
441
+ };
442
+ function u(m, p) {
443
+ return hr(m, c.current, d, p);
444
+ }
445
+ return r === "horizontal" ? /* @__PURE__ */ s(
446
+ cr,
447
+ {
448
+ ...o,
449
+ ref: t,
450
+ onThumbPositionChange: () => {
451
+ if (n.viewport && a.current) {
452
+ const m = n.viewport.scrollLeft, p = J(m, d, n.dir);
453
+ a.current.style.transform = `translate3d(${p}px, 0, 0)`;
454
+ }
455
+ },
456
+ onWheelScroll: (m) => {
457
+ n.viewport && (n.viewport.scrollLeft = m);
458
+ },
459
+ onDragScroll: (m) => {
460
+ n.viewport && (n.viewport.scrollLeft = u(m, n.dir));
461
+ }
462
+ }
463
+ ) : r === "vertical" ? /* @__PURE__ */ s(
464
+ ir,
465
+ {
466
+ ...o,
467
+ ref: t,
468
+ onThumbPositionChange: () => {
469
+ if (n.viewport && a.current) {
470
+ const m = n.viewport.scrollTop, p = J(m, d);
471
+ a.current.style.transform = `translate3d(0, ${p}px, 0)`;
472
+ }
473
+ },
474
+ onWheelScroll: (m) => {
475
+ n.viewport && (n.viewport.scrollTop = m);
476
+ },
477
+ onDragScroll: (m) => {
478
+ n.viewport && (n.viewport.scrollTop = u(m));
479
+ }
480
+ }
481
+ ) : null;
482
+ }), cr = i.forwardRef((e, t) => {
483
+ const { sizes: r, onSizesChange: l, ...n } = e, a = S(C, e.__scopeScrollArea), [c, d] = i.useState(), f = i.useRef(null), h = N(t, f, a.onScrollbarXChange);
484
+ return i.useEffect(() => {
485
+ f.current && d(getComputedStyle(f.current));
486
+ }, [f]), /* @__PURE__ */ s(
487
+ Pe,
488
+ {
489
+ "data-orientation": "horizontal",
490
+ ...n,
491
+ ref: h,
492
+ sizes: r,
493
+ style: {
494
+ bottom: 0,
495
+ left: a.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
496
+ right: a.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
497
+ "--radix-scroll-area-thumb-width": F(r) + "px",
498
+ ...e.style
499
+ },
500
+ onThumbPointerDown: (o) => e.onThumbPointerDown(o.x),
501
+ onDragScroll: (o) => e.onDragScroll(o.x),
502
+ onWheelScroll: (o, u) => {
503
+ if (a.viewport) {
504
+ const m = a.viewport.scrollLeft + o.deltaX;
505
+ e.onWheelScroll(m), _e(m, u) && o.preventDefault();
506
+ }
507
+ },
508
+ onResize: () => {
509
+ f.current && a.viewport && c && l({
510
+ content: a.viewport.scrollWidth,
511
+ viewport: a.viewport.offsetWidth,
512
+ scrollbar: {
513
+ size: f.current.clientWidth,
514
+ paddingStart: V(c.paddingLeft),
515
+ paddingEnd: V(c.paddingRight)
516
+ }
517
+ });
518
+ }
519
+ }
520
+ );
521
+ }), ir = i.forwardRef((e, t) => {
522
+ const { sizes: r, onSizesChange: l, ...n } = e, a = S(C, e.__scopeScrollArea), [c, d] = i.useState(), f = i.useRef(null), h = N(t, f, a.onScrollbarYChange);
523
+ return i.useEffect(() => {
524
+ f.current && d(getComputedStyle(f.current));
525
+ }, [f]), /* @__PURE__ */ s(
526
+ Pe,
527
+ {
528
+ "data-orientation": "vertical",
529
+ ...n,
530
+ ref: h,
531
+ sizes: r,
532
+ style: {
533
+ top: 0,
534
+ right: a.dir === "ltr" ? 0 : void 0,
535
+ left: a.dir === "rtl" ? 0 : void 0,
536
+ bottom: "var(--radix-scroll-area-corner-height)",
537
+ "--radix-scroll-area-thumb-height": F(r) + "px",
538
+ ...e.style
539
+ },
540
+ onThumbPointerDown: (o) => e.onThumbPointerDown(o.y),
541
+ onDragScroll: (o) => e.onDragScroll(o.y),
542
+ onWheelScroll: (o, u) => {
543
+ if (a.viewport) {
544
+ const m = a.viewport.scrollTop + o.deltaY;
545
+ e.onWheelScroll(m), _e(m, u) && o.preventDefault();
546
+ }
547
+ },
548
+ onResize: () => {
549
+ f.current && a.viewport && c && l({
550
+ content: a.viewport.scrollHeight,
551
+ viewport: a.viewport.offsetHeight,
552
+ scrollbar: {
553
+ size: f.current.clientHeight,
554
+ paddingStart: V(c.paddingTop),
555
+ paddingEnd: V(c.paddingBottom)
556
+ }
557
+ });
558
+ }
559
+ }
560
+ );
561
+ }), [dr, Te] = Se(C), Pe = i.forwardRef((e, t) => {
562
+ const {
563
+ __scopeScrollArea: r,
564
+ sizes: l,
565
+ hasThumb: n,
566
+ onThumbChange: a,
567
+ onThumbPointerUp: c,
568
+ onThumbPointerDown: d,
569
+ onThumbPositionChange: f,
570
+ onDragScroll: h,
571
+ onWheelScroll: o,
572
+ onResize: u,
573
+ ...m
574
+ } = e, p = S(C, r), [g, _] = i.useState(null), Y = N(t, (v) => _(v)), T = i.useRef(null), I = i.useRef(""), U = p.viewport, k = l.content - l.viewport, M = P(o), L = P(f), z = X(u, 10);
575
+ function H(v) {
576
+ if (T.current) {
577
+ const w = v.clientX - T.current.left, R = v.clientY - T.current.top;
578
+ h({ x: w, y: R });
579
+ }
580
+ }
581
+ return i.useEffect(() => {
582
+ const v = (w) => {
583
+ const R = w.target;
584
+ (g == null ? void 0 : g.contains(R)) && M(w, k);
585
+ };
586
+ return document.addEventListener("wheel", v, { passive: !1 }), () => document.removeEventListener("wheel", v, { passive: !1 });
587
+ }, [U, g, k, M]), i.useEffect(L, [l, L]), A(g, z), A(p.content, z), /* @__PURE__ */ s(
588
+ dr,
589
+ {
590
+ scope: r,
591
+ scrollbar: g,
592
+ hasThumb: n,
593
+ onThumbChange: P(a),
594
+ onThumbPointerUp: P(c),
595
+ onThumbPositionChange: L,
596
+ onThumbPointerDown: P(d),
597
+ children: /* @__PURE__ */ s(
598
+ x.div,
599
+ {
600
+ ...m,
601
+ ref: Y,
602
+ style: { position: "absolute", ...m.style },
603
+ onPointerDown: y(e.onPointerDown, (v) => {
604
+ v.button === 0 && (v.target.setPointerCapture(v.pointerId), T.current = g.getBoundingClientRect(), I.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), H(v));
605
+ }),
606
+ onPointerMove: y(e.onPointerMove, H),
607
+ onPointerUp: y(e.onPointerUp, (v) => {
608
+ const w = v.target;
609
+ w.hasPointerCapture(v.pointerId) && w.releasePointerCapture(v.pointerId), document.body.style.webkitUserSelect = I.current, p.viewport && (p.viewport.style.scrollBehavior = ""), T.current = null;
610
+ })
611
+ }
612
+ )
613
+ }
614
+ );
615
+ }), W = "ScrollAreaThumb", Re = i.forwardRef(
616
+ (e, t) => {
617
+ const { forceMount: r, ...l } = e, n = Te(W, e.__scopeScrollArea);
618
+ return /* @__PURE__ */ s(D, { present: r || n.hasThumb, children: /* @__PURE__ */ s(ur, { ref: t, ...l }) });
619
+ }
620
+ ), ur = i.forwardRef(
621
+ (e, t) => {
622
+ const { __scopeScrollArea: r, style: l, ...n } = e, a = S(W, r), c = Te(W, r), { onThumbPositionChange: d } = c, f = N(
623
+ t,
624
+ (u) => c.onThumbChange(u)
625
+ ), h = i.useRef(void 0), o = X(() => {
626
+ h.current && (h.current(), h.current = void 0);
627
+ }, 100);
628
+ return i.useEffect(() => {
629
+ const u = a.viewport;
630
+ if (u) {
631
+ const m = () => {
632
+ if (o(), !h.current) {
633
+ const p = mr(u, d);
634
+ h.current = p, d();
635
+ }
636
+ };
637
+ return d(), u.addEventListener("scroll", m), () => u.removeEventListener("scroll", m);
638
+ }
639
+ }, [a.viewport, o, d]), /* @__PURE__ */ s(
640
+ x.div,
641
+ {
642
+ "data-state": c.hasThumb ? "visible" : "hidden",
643
+ ...n,
644
+ ref: f,
645
+ style: {
646
+ width: "var(--radix-scroll-area-thumb-width)",
647
+ height: "var(--radix-scroll-area-thumb-height)",
648
+ ...l
649
+ },
650
+ onPointerDownCapture: y(e.onPointerDownCapture, (u) => {
651
+ const p = u.target.getBoundingClientRect(), g = u.clientX - p.left, _ = u.clientY - p.top;
652
+ c.onThumbPointerDown({ x: g, y: _ });
653
+ }),
654
+ onPointerUp: y(e.onPointerUp, c.onThumbPointerUp)
655
+ }
656
+ );
657
+ }
658
+ );
659
+ Re.displayName = W;
660
+ var q = "ScrollAreaCorner", Ae = i.forwardRef(
661
+ (e, t) => {
662
+ const r = S(q, e.__scopeScrollArea), l = !!(r.scrollbarX && r.scrollbarY);
663
+ return r.type !== "scroll" && l ? /* @__PURE__ */ s(fr, { ...e, ref: t }) : null;
664
+ }
665
+ );
666
+ Ae.displayName = q;
667
+ var fr = i.forwardRef((e, t) => {
668
+ const { __scopeScrollArea: r, ...l } = e, n = S(q, r), [a, c] = i.useState(0), [d, f] = i.useState(0), h = !!(a && d);
669
+ return A(n.scrollbarX, () => {
670
+ var u;
671
+ const o = ((u = n.scrollbarX) == null ? void 0 : u.offsetHeight) || 0;
672
+ n.onCornerHeightChange(o), f(o);
673
+ }), A(n.scrollbarY, () => {
674
+ var u;
675
+ const o = ((u = n.scrollbarY) == null ? void 0 : u.offsetWidth) || 0;
676
+ n.onCornerWidthChange(o), c(o);
677
+ }), h ? /* @__PURE__ */ s(
678
+ x.div,
679
+ {
680
+ ...l,
681
+ ref: t,
682
+ style: {
683
+ width: a,
684
+ height: d,
685
+ position: "absolute",
686
+ right: n.dir === "ltr" ? 0 : void 0,
687
+ left: n.dir === "rtl" ? 0 : void 0,
688
+ bottom: 0,
689
+ ...e.style
690
+ }
691
+ }
692
+ ) : null;
693
+ });
694
+ function V(e) {
695
+ return e ? parseInt(e, 10) : 0;
696
+ }
697
+ function Ne(e, t) {
698
+ const r = e / t;
699
+ return isNaN(r) ? 0 : r;
700
+ }
701
+ function F(e) {
702
+ const t = Ne(e.viewport, e.content), r = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, l = (e.scrollbar.size - r) * t;
703
+ return Math.max(l, 18);
704
+ }
705
+ function hr(e, t, r, l = "ltr") {
706
+ const n = F(r), a = n / 2, c = t || a, d = n - c, f = r.scrollbar.paddingStart + c, h = r.scrollbar.size - r.scrollbar.paddingEnd - d, o = r.content - r.viewport, u = l === "ltr" ? [0, o] : [o * -1, 0];
707
+ return Ee([f, h], u)(e);
708
+ }
709
+ function J(e, t, r = "ltr") {
710
+ const l = F(t), n = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, a = t.scrollbar.size - n, c = t.content - t.viewport, d = a - l, f = r === "ltr" ? [0, c] : [c * -1, 0], h = Be(e, f);
711
+ return Ee([0, c], [0, d])(h);
712
+ }
713
+ function Ee(e, t) {
714
+ return (r) => {
715
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
716
+ const l = (t[1] - t[0]) / (e[1] - e[0]);
717
+ return t[0] + l * (r - e[0]);
718
+ };
719
+ }
720
+ function _e(e, t) {
721
+ return e > 0 && e < t;
722
+ }
723
+ var mr = (e, t = () => {
724
+ }) => {
725
+ let r = { left: e.scrollLeft, top: e.scrollTop }, l = 0;
726
+ return (function n() {
727
+ const a = { left: e.scrollLeft, top: e.scrollTop }, c = r.left !== a.left, d = r.top !== a.top;
728
+ (c || d) && t(), r = a, l = window.requestAnimationFrame(n);
729
+ })(), () => window.cancelAnimationFrame(l);
730
+ };
731
+ function X(e, t) {
732
+ const r = P(e), l = i.useRef(0);
733
+ return i.useEffect(() => () => window.clearTimeout(l.current), []), i.useCallback(() => {
734
+ window.clearTimeout(l.current), l.current = window.setTimeout(r, t);
735
+ }, [r, t]);
736
+ }
737
+ function A(e, t) {
738
+ const r = P(t);
739
+ Xe(() => {
740
+ let l = 0;
741
+ if (e) {
742
+ const n = new ResizeObserver(() => {
743
+ cancelAnimationFrame(l), l = window.requestAnimationFrame(r);
744
+ });
745
+ return n.observe(e), () => {
746
+ window.cancelAnimationFrame(l), n.unobserve(e);
747
+ };
748
+ }
749
+ }, [e, r]);
750
+ }
751
+ var Le = we, pr = Ce, vr = Ae;
752
+ const De = i.forwardRef(
753
+ ({ className: e, children: t, ...r }, l) => /* @__PURE__ */ b(Le, { ref: l, className: E("relative overflow-hidden", e), ...r, children: [
754
+ /* @__PURE__ */ s(pr, { className: "h-full w-full rounded-[inherit]", children: t }),
755
+ /* @__PURE__ */ s(Ie, {}),
756
+ /* @__PURE__ */ s(vr, {})
757
+ ] })
758
+ );
759
+ De.displayName = Le.displayName;
760
+ const Ie = i.forwardRef(({ className: e, orientation: t = "vertical", ...r }, l) => /* @__PURE__ */ s(
761
+ G,
762
+ {
763
+ ref: l,
764
+ orientation: t,
765
+ className: E(
766
+ "flex touch-none select-none transition-colors",
767
+ t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
768
+ t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
769
+ e
770
+ ),
771
+ ...r,
772
+ children: /* @__PURE__ */ s(Re, { className: "relative flex-1 rounded-full bg-border" })
773
+ }
774
+ ));
775
+ Ie.displayName = G.displayName;
776
+ const _r = ({ tabs: e, item: t }) => {
777
+ var h;
778
+ const { t: r } = re(), [l, n] = te(), a = l.get("tab") || ((h = e[0]) == null ? void 0 : h.value), c = (o) => {
779
+ const u = new URLSearchParams();
780
+ u.set("tab", o), n(u);
781
+ }, d = () => {
782
+ const o = e.find((u) => u.value === a);
783
+ return o ? o.component ? o.component() : f() : null;
784
+ }, f = () => /* @__PURE__ */ s("div", { className: "p-4 lg:p-6", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-center h-64 text-gray-500", children: /* @__PURE__ */ b("div", { className: "text-center", children: [
785
+ /* @__PURE__ */ s(B, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
786
+ /* @__PURE__ */ s("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
787
+ /* @__PURE__ */ s("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
788
+ ] }) }) });
789
+ return /* @__PURE__ */ b("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
790
+ /* @__PURE__ */ s("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__ */ s(De, { className: "h-full", children: /* @__PURE__ */ s("div", { className: "space-y-1", children: e.map((o, u) => /* @__PURE__ */ b(
791
+ "div",
792
+ {
793
+ className: `px-2 py-2 rounded-2xl text-sm transition-colors flex items-center gap-2 ${o.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : a === o.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"}`,
794
+ onClick: () => !o.disabled && c(o.value),
795
+ children: [
796
+ o.icon && /* @__PURE__ */ s(o.icon, { className: "size-4" }),
797
+ /* @__PURE__ */ s("span", { className: "flex-1", children: r(o.titleKey) }),
798
+ o.count && /* @__PURE__ */ b("span", { className: "text-xs text-gray-500", children: [
799
+ "(",
800
+ o.count(t),
801
+ ")"
802
+ ] }),
803
+ !o.component && /* @__PURE__ */ s(B, { className: "size-4 text-amber-500" })
804
+ ]
805
+ },
806
+ u
807
+ )) }) }) }),
808
+ /* @__PURE__ */ s("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ b($e, { value: a, onValueChange: c, children: [
809
+ /* @__PURE__ */ s(je, { className: "w-full", children: /* @__PURE__ */ s(Ge, { placeholder: "Sélectionner une section" }) }),
810
+ /* @__PURE__ */ s(Ke, { children: e.map((o, u) => /* @__PURE__ */ s(qe, { value: o.value, disabled: o.disabled, children: /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
811
+ o.icon && /* @__PURE__ */ s(o.icon, { className: "size-4" }),
812
+ /* @__PURE__ */ s("span", { children: r(o.titleKey) }),
813
+ o.count && /* @__PURE__ */ b("span", { className: "text-xs text-gray-500", children: [
814
+ "(",
815
+ o.count(t),
816
+ ")"
817
+ ] }),
818
+ !o.component && /* @__PURE__ */ s(B, { className: "size-4 text-amber-500" })
819
+ ] }) }, u)) })
820
+ ] }) }),
821
+ /* @__PURE__ */ s("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: d() })
822
+ ] });
823
+ };
824
+ export {
825
+ Nr as A,
826
+ Ze as a,
827
+ Er as b,
828
+ _r as c
829
+ };