@krosoft/react 0.0.181 → 0.0.183

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 (45) hide show
  1. package/dist/{AppActions-DEkRxBia.js → AppActions-DtdwQdm-.js} +1 -1
  2. package/dist/{AppSubTitle-ChCtQ7Sv.js → AppSubTitle-Co9HDBO4.js} +1 -1
  3. package/dist/AppVerticalTabs-B3_nbdLm.js +99 -0
  4. package/dist/{ConfirmationDialog-9CKgZoNY.js → ConfirmationDialog-3rO4sYM8.js} +36 -36
  5. package/dist/{DataTable-ny08K506.js → DataTable-Ckbr166c.js} +1 -1
  6. package/dist/{GenericForm-B39toMkE.js → GenericForm-ClzOIaJc.js} +4 -4
  7. package/dist/{ImageInput-BoYUZx9H.js → ImageInput-BPV_4oDI.js} +1 -1
  8. package/dist/{KpiCardsLayout-mQ7AcbqA.js → KpiCardsLayout-D67cLG3R.js} +3 -3
  9. package/dist/{MetricCard-CvQFjIOb.js → MetricCard-BAa26w6e.js} +1 -1
  10. package/dist/{MultiSelect-CqcbwKYV.js → MultiSelect-ovXnKCuU.js} +1 -1
  11. package/dist/SearchInput-B08-Mcsx.js +250 -0
  12. package/dist/{SkeletonCards-BvJYF_LK.js → SkeletonCards-D0V2nuDg.js} +1 -1
  13. package/dist/{TableFilter-CWDy_RHA.js → TableFilter-Z0T30AzZ.js} +3 -3
  14. package/dist/components/core/cards/index.js +2 -2
  15. package/dist/components/core/dialogs/index.js +2 -2
  16. package/dist/components/core/filters/index.js +1 -1
  17. package/dist/components/core/forms/index.js +1 -1
  18. package/dist/components/core/index.js +14 -14
  19. package/dist/components/core/inputs/SearchableSelect.d.ts +16 -2
  20. package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
  21. package/dist/components/core/inputs/index.d.ts +1 -0
  22. package/dist/components/core/inputs/index.d.ts.map +1 -1
  23. package/dist/components/core/inputs/index.js +3 -3
  24. package/dist/components/core/layouts/index.js +3 -3
  25. package/dist/components/core/table/index.js +1 -1
  26. package/dist/components/core/tabs/AppTabs.d.ts.map +1 -1
  27. package/dist/components/core/tabs/index.js +1 -1
  28. package/dist/components/index.js +15 -15
  29. package/dist/components/ui/index.js +2 -2
  30. package/dist/components/ui/tabs.d.ts.map +1 -1
  31. package/dist/hooks/index.js +9 -7
  32. package/dist/hooks/ui/index.d.ts +1 -0
  33. package/dist/hooks/ui/index.d.ts.map +1 -1
  34. package/dist/hooks/ui/index.js +11 -9
  35. package/dist/hooks/ui/useScrollFade.d.ts +11 -0
  36. package/dist/hooks/ui/useScrollFade.d.ts.map +1 -0
  37. package/dist/tailwind/index.d.ts +10 -10
  38. package/dist/tailwind/index.d.ts.map +1 -1
  39. package/dist/tailwind/index.js +7 -3
  40. package/dist/{toaster-B6XKMRwI.js → toaster-BaFcYXKg.js} +1 -1
  41. package/dist/{toggle-group-D6c-gM1D.js → toggle-group-D2Li0iBJ.js} +583 -565
  42. package/dist/useScrollFade-BA4KqJYp.js +23 -0
  43. package/package.json +1 -1
  44. package/dist/AppVerticalTabs-D8fURUUN.js +0 -94
  45. package/dist/SearchInput-ClZbbRWg.js +0 -254
@@ -1,5 +1,5 @@
1
1
  import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
- import { ay as u, aM as t, aA as c, aH as g, aC as d } from "./toggle-group-D6c-gM1D.js";
2
+ import { ay as u, aM as t, aA as c, aH as g, aC as d } from "./toggle-group-D2Li0iBJ.js";
3
3
  import "./alert-B9F1N9Qk.js";
4
4
  import "@radix-ui/react-aspect-ratio";
5
5
  import { B as p } from "./tooltip-DVeqVwqV.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { useTranslation as l } from "react-i18next";
3
- import { A as m } from "./AppActions-DEkRxBia.js";
3
+ import { A as m } from "./AppActions-DtdwQdm-.js";
4
4
  function f({ titleKey: s, actions: t, className: o }) {
5
5
  const { t: r } = l();
6
6
  return /* @__PURE__ */ i("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: [
@@ -0,0 +1,99 @@
1
+ import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
+ import { J as b, N as w, K as S, bN as T, bP as C, bQ as A, bO as P, bA as k } from "./toggle-group-D2Li0iBJ.js";
3
+ import { A as j } from "./AppActions-DtdwQdm-.js";
4
+ import { A as z } from "./AppTitle-D15YXeMx.js";
5
+ import { useRef as V, useEffect as K } from "react";
6
+ import { useTranslation as g } from "react-i18next";
7
+ import { useSearchParams as y } from "react-router-dom";
8
+ import { c as R } from "./tailwind.helper-B6yFEsav.js";
9
+ import { S as q, h as I, i as L, a as H, c as U } from "./select-BpjFWqAY.js";
10
+ import { ConstructionIcon as v } from "lucide-react";
11
+ function D({ titleKey: n, descriptionKey: l, actions: t = [], className: c }) {
12
+ return /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
13
+ /* @__PURE__ */ s(z, { titleKey: n, descriptionKey: l, isSubTitle: !0 }),
14
+ /* @__PURE__ */ s(j, { actions: t, className: c })
15
+ ] });
16
+ }
17
+ function X({ titleKey: n, descriptionKey: l, actions: t = [], className: c, children: o, isSubTitle: p }) {
18
+ return /* @__PURE__ */ r(b, { children: [
19
+ /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(D, { titleKey: n, descriptionKey: l, actions: t, className: c }) }),
20
+ /* @__PURE__ */ s(S, { className: "space-y-4", children: o })
21
+ ] });
22
+ }
23
+ function Y({ tabs: n, itemId: l, item: t, fit: c }) {
24
+ var d, a;
25
+ const { t: o } = g(), [p, i] = y(), h = p.get("tab"), f = ((d = n.find((e) => e.value === h)) == null ? void 0 : d.value) ?? ((a = n[0]) == null ? void 0 : a.value), x = (e) => {
26
+ const u = new URLSearchParams();
27
+ u.set("tab", e), i(u);
28
+ }, m = V(null);
29
+ return K(() => {
30
+ var u, N;
31
+ const e = (u = m.current) == null ? void 0 : u.querySelector('[data-state="active"]');
32
+ (N = e == null ? void 0 : e.scrollIntoView) == null || N.call(e, { behavior: "smooth", block: "nearest", inline: "nearest" });
33
+ }, [f]), /* @__PURE__ */ r(T, { value: f, onValueChange: x, children: [
34
+ /* @__PURE__ */ s(C, { ref: m, className: R("w-full justify-start", c && "sm:w-fit"), children: n.map((e) => /* @__PURE__ */ r(A, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
35
+ e.icon ? /* @__PURE__ */ s("span", { className: "hidden sm:inline", children: /* @__PURE__ */ s(e.icon, { className: "size-4" }) }) : null,
36
+ /* @__PURE__ */ s("span", { className: "text-xs sm:text-sm", children: o(e.titleKey) ?? "" }),
37
+ e.count ? /* @__PURE__ */ r("span", { className: "text-gray-500 text-xs", children: [
38
+ "(",
39
+ e.count(t),
40
+ ")"
41
+ ] }) : null
42
+ ] }, e.value)) }),
43
+ n.map((e) => /* @__PURE__ */ s(P, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
44
+ ] });
45
+ }
46
+ const Z = ({ tabs: n, item: l }) => {
47
+ var m, d;
48
+ const { t } = g(), [c, o] = y(), p = c.get("tab"), i = ((m = n.find((a) => a.value === p)) == null ? void 0 : m.value) ?? ((d = n[0]) == null ? void 0 : d.value), h = (a) => {
49
+ const e = new URLSearchParams();
50
+ e.set("tab", a), o(e);
51
+ }, f = () => {
52
+ const a = n.find((e) => e.value === i);
53
+ return a ? a.component ? a.component() : x() : null;
54
+ }, x = () => /* @__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__ */ r("div", { className: "text-center", children: [
55
+ /* @__PURE__ */ s(v, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
56
+ /* @__PURE__ */ s("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
57
+ /* @__PURE__ */ s("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
58
+ ] }) }) });
59
+ return /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
60
+ /* @__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(k, { className: "h-full", children: /* @__PURE__ */ s("div", { className: "space-y-1", children: n.map((a, e) => /* @__PURE__ */ r(
61
+ "div",
62
+ {
63
+ className: `px-2 py-2 rounded-control text-sm transition-colors flex items-center gap-2 ${a.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : i === a.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"}`,
64
+ onClick: () => !a.disabled && h(a.value),
65
+ children: [
66
+ a.icon && /* @__PURE__ */ s(a.icon, { className: "size-4" }),
67
+ /* @__PURE__ */ s("span", { className: "flex-1", children: t(a.titleKey) }),
68
+ a.count && /* @__PURE__ */ r("span", { className: "text-xs text-gray-500", children: [
69
+ "(",
70
+ a.count(l),
71
+ ")"
72
+ ] }),
73
+ !a.component && /* @__PURE__ */ s(v, { className: "size-4 text-amber-500" })
74
+ ]
75
+ },
76
+ e
77
+ )) }) }) }),
78
+ /* @__PURE__ */ s("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ r(q, { value: i, onValueChange: h, children: [
79
+ /* @__PURE__ */ s(I, { className: "w-full", children: /* @__PURE__ */ s(L, { placeholder: "Sélectionner une section" }) }),
80
+ /* @__PURE__ */ s(H, { children: n.map((a, e) => /* @__PURE__ */ s(U, { value: a.value, disabled: a.disabled, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
81
+ a.icon && /* @__PURE__ */ s(a.icon, { className: "size-4" }),
82
+ /* @__PURE__ */ s("span", { children: t(a.titleKey) }),
83
+ a.count && /* @__PURE__ */ r("span", { className: "text-xs text-gray-500", children: [
84
+ "(",
85
+ a.count(l),
86
+ ")"
87
+ ] }),
88
+ !a.component && /* @__PURE__ */ s(v, { className: "size-4 text-amber-500" })
89
+ ] }) }, e)) })
90
+ ] }) }),
91
+ /* @__PURE__ */ s("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: f() })
92
+ ] });
93
+ };
94
+ export {
95
+ X as A,
96
+ D as a,
97
+ Y as b,
98
+ Z as c
99
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as r, Fragment as M } from "react/jsx-runtime";
2
- import { D as q, b as B, P as R, e as W, h as X, c as $, m as J, p as Q, s as F, t as U, q as j, r as V, o as Y } from "./toggle-group-D6c-gM1D.js";
2
+ import { D as q, b as B, P as R, e as W, h as X, c as $, m as J, p as Q, s as F, t as U, q as j, r as V, o as Y } from "./toggle-group-D2Li0iBJ.js";
3
3
  import { A as Z, a as _ } from "./alert-B9F1N9Qk.js";
4
4
  import "@radix-ui/react-aspect-ratio";
5
5
  import { B as v } from "./tooltip-DVeqVwqV.js";
@@ -12,30 +12,30 @@ import "tailwind-merge";
12
12
  import "./select-BpjFWqAY.js";
13
13
  import "next-themes";
14
14
  import "sonner";
15
- import { useState as w, useEffect as ee } from "react";
15
+ import { useState as y, useEffect as ee } from "react";
16
16
  import { useTranslation as O } from "react-i18next";
17
- import { G as le } from "./GenericForm-B39toMkE.js";
17
+ import { G as le } from "./GenericForm-ClzOIaJc.js";
18
18
  import { E as ie } from "./ErrorAlert-SrIcU1mM.js";
19
19
  function re({ open: t, onOpenChange: c, config: l, isLoading: u, error: s, children: p }) {
20
- const { t: i } = O(), { title: b, description: m, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
21
- return /* @__PURE__ */ e(q, { open: t, onOpenChange: c, children: /* @__PURE__ */ r(B, { className: `${g} max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
20
+ const { t: i } = O(), { title: b, description: d, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
21
+ return /* @__PURE__ */ e(q, { open: t, onOpenChange: c, children: /* @__PURE__ */ r(B, { className: `${g} max-h-[100dvh] sm:max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden`, children: [
22
22
  u === !0 ? /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 z-10", children: /* @__PURE__ */ e(R, { indeterminate: !0, className: "h-1 rounded-none" }) }) : null,
23
- /* @__PURE__ */ r(W, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-6 rounded-t-surface shrink-0", children: [
24
- /* @__PURE__ */ r(X, { className: "text-2xl font-bold flex items-center gap-2 text-white", children: [
23
+ /* @__PURE__ */ r(W, { className: "bg-gradient-to-r from-slate-900 to-purple-700 p-4 sm:p-6 sm:rounded-t-surface shrink-0", children: [
24
+ /* @__PURE__ */ r(X, { className: "text-xl sm:text-2xl font-bold flex items-center gap-2 text-white", children: [
25
25
  f !== void 0 ? /* @__PURE__ */ e("div", { className: "p-2 bg-white/20 rounded-control", children: /* @__PURE__ */ e(f, { className: "size-4 text-white" }) }) : null,
26
26
  i(b)
27
27
  ] }),
28
- m !== void 0 && m !== "" ? /* @__PURE__ */ e($, { className: "text-indigo-100 text-base", children: i(m) }) : null
28
+ d !== void 0 && d !== "" ? /* @__PURE__ */ e($, { className: "text-indigo-100 text-base", children: i(d) }) : null
29
29
  ] }),
30
30
  s != null ? /* @__PURE__ */ e("div", { className: "px-6 ", children: /* @__PURE__ */ r(Z, { variant: "destructive", className: "max-w-full", children: [
31
31
  /* @__PURE__ */ e(L, { className: "size-4" }),
32
32
  /* @__PURE__ */ e(_, { className: "break-words overflow-wrap-anywhere max-w-full", children: s.message })
33
33
  ] }) }) : null,
34
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-6 py-4", children: p }),
35
- n !== void 0 && n.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-b-surface border-t border-gray-200 dark:border-gray-700 shrink-0 p-6 light:bg-gradient-to-r light:from-gray-50 light:to-gray-100 dark:bg-gray-950", children: /* @__PURE__ */ e("div", { className: "flex justify-end gap-3", children: n.map((a, y) => /* @__PURE__ */ r(v, { variant: a.variant ?? "default", onClick: a.onClick, disabled: a.disabled === !0 || u === !0, children: [
34
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 sm:px-6 py-4", children: p }),
35
+ n !== void 0 && n.length > 0 ? /* @__PURE__ */ e("div", { className: "sm:rounded-b-surface border-t border-gray-200 dark:border-gray-700 shrink-0 p-4 sm:p-6 light:bg-gradient-to-r light:from-gray-50 light:to-gray-100 dark:bg-gray-950", children: /* @__PURE__ */ e("div", { className: "flex justify-end gap-3", children: n.map((a, k) => /* @__PURE__ */ r(v, { variant: a.variant ?? "default", onClick: a.onClick, disabled: a.disabled === !0 || u === !0, children: [
36
36
  a.icon !== void 0 ? /* @__PURE__ */ e(a.icon, { className: "size-4" }) : null,
37
37
  i(a.label)
38
- ] }, y)) }) }) : null
38
+ ] }, k)) }) }) : null
39
39
  ] }) });
40
40
  }
41
41
  function De({
@@ -47,29 +47,29 @@ function De({
47
47
  schema: p,
48
48
  onSave: i,
49
49
  customFooter: b,
50
- defaultEditing: m = !1,
50
+ defaultEditing: d = !1,
51
51
  footerActions: f = !0,
52
52
  saveLabel: g = "Sauvegarder",
53
53
  cancelLabel: n = "Annuler",
54
54
  hideSaveIcon: a = !1,
55
- maxWidth: y = "sm:max-w-4xl",
55
+ maxWidth: k = "sm:max-w-4xl",
56
56
  isLoading: h = !1
57
57
  }) {
58
- const [N, x] = w(m), [o, A] = w(!1), [C, P] = w(null);
58
+ const [x, N] = y(d), [o, A] = y(!1), [C, P] = y(null);
59
59
  if (ee(() => {
60
- t && x(m);
61
- }, [t, m]), l == null) return null;
60
+ t && N(d);
61
+ }, [t, d]), l == null) return null;
62
62
  const z = () => {
63
- N ? i !== void 0 && C && C() : x(!0);
64
- }, k = () => {
65
- x(!1);
63
+ x ? i !== void 0 && C && C() : N(!0);
64
+ }, w = () => {
65
+ N(!1);
66
66
  }, E = () => {
67
67
  i !== void 0 && C && C();
68
- }, G = async (d) => {
68
+ }, G = async (m) => {
69
69
  if (i) {
70
70
  A(!0);
71
71
  try {
72
- await i(d), x(!1);
72
+ await i(m), N(!1);
73
73
  } catch (K) {
74
74
  console.error(K);
75
75
  } finally {
@@ -77,9 +77,9 @@ function De({
77
77
  }
78
78
  }
79
79
  }, D = [];
80
- i !== void 0 && (N ? (n !== "" && D.push({
80
+ i !== void 0 && (x ? (n !== "" && D.push({
81
81
  label: n,
82
- onClick: k,
82
+ onClick: w,
83
83
  variant: "outline",
84
84
  disabled: o || h,
85
85
  icon: S
@@ -97,39 +97,39 @@ function De({
97
97
  }));
98
98
  const H = {
99
99
  title: u(l),
100
- maxWidth: y,
100
+ maxWidth: k,
101
101
  actions: f ? D : []
102
102
  };
103
103
  return /* @__PURE__ */ e(
104
104
  re,
105
105
  {
106
106
  open: t,
107
- onOpenChange: (d) => {
108
- c(d), d || k();
107
+ onOpenChange: (m) => {
108
+ c(m), m || w();
109
109
  },
110
110
  config: H,
111
111
  isLoading: o || h,
112
- children: /* @__PURE__ */ r("div", { className: "py-4", children: [
112
+ children: /* @__PURE__ */ r("div", { children: [
113
113
  s !== void 0 ? /* @__PURE__ */ e("div", { className: "mb-4", children: s(l) }) : null,
114
114
  /* @__PURE__ */ e(
115
115
  le,
116
116
  {
117
117
  schema: p,
118
118
  initialData: l,
119
- disabled: !N,
120
- onSubmit: (d) => {
121
- G(d);
119
+ disabled: !x,
120
+ onSubmit: (m) => {
121
+ G(m);
122
122
  },
123
123
  renderActions: !1,
124
- onRegisterSubmit: (d) => {
125
- P(() => d);
124
+ onRegisterSubmit: (m) => {
125
+ P(() => m);
126
126
  },
127
127
  isLoading: o || h
128
128
  }
129
129
  ),
130
130
  b !== void 0 ? b(l) : null,
131
- i !== void 0 && !f ? /* @__PURE__ */ e("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: N ? /* @__PURE__ */ r(M, { children: [
132
- n !== "" ? /* @__PURE__ */ r(v, { onClick: k, variant: "outline", size: "sm", disabled: o || h, children: [
131
+ i !== void 0 && !f ? /* @__PURE__ */ e("div", { className: "flex justify-end gap-2 border-t pt-4 mt-6", children: x ? /* @__PURE__ */ r(M, { children: [
132
+ n !== "" ? /* @__PURE__ */ r(v, { onClick: w, variant: "outline", size: "sm", disabled: o || h, children: [
133
133
  /* @__PURE__ */ e(S, { className: "size-4 mr-2" }),
134
134
  n
135
135
  ] }) : null,
@@ -145,7 +145,7 @@ function De({
145
145
  }
146
146
  );
147
147
  }
148
- function ye({ isLoading: t, error: c, config: l, destructive: u = !1 }) {
148
+ function ke({ isLoading: t, error: c, config: l, destructive: u = !1 }) {
149
149
  const { t: s } = O();
150
150
  if (!l) return null;
151
151
  const p = (i) => {
@@ -180,6 +180,6 @@ function ye({ isLoading: t, error: c, config: l, destructive: u = !1 }) {
180
180
  }
181
181
  export {
182
182
  re as A,
183
- ye as C,
183
+ ke as C,
184
184
  De as F
185
185
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
2
  import { u as le } from "./useDataTable-CxcA5S-s.js";
3
- import { ay as B, aM as L, aA as V, aC as de, $ as O, az as ce } from "./toggle-group-D6c-gM1D.js";
3
+ import { ay as B, aM as L, aA as V, aC as de, $ as O, az as ce } from "./toggle-group-D2Li0iBJ.js";
4
4
  import "./alert-B9F1N9Qk.js";
5
5
  import "@radix-ui/react-aspect-ratio";
6
6
  import { B as y } from "./tooltip-DVeqVwqV.js";
@@ -1,8 +1,8 @@
1
1
  import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
- import { I as J } from "./ImageInput-BoYUZx9H.js";
3
- import { A as V } from "./AppSubTitle-ChCtQ7Sv.js";
4
- import { M as Q } from "./MultiSelect-CqcbwKYV.js";
5
- import { aN as W, aQ as $, aR as q, aS as D, aO as A, aT as L, J as X, N as Y, K as F, bR as ee, $ as te } from "./toggle-group-D6c-gM1D.js";
2
+ import { I as J } from "./ImageInput-BPV_4oDI.js";
3
+ import { A as V } from "./AppSubTitle-Co9HDBO4.js";
4
+ import { M as Q } from "./MultiSelect-ovXnKCuU.js";
5
+ import { aN as W, aQ as $, aR as q, aS as D, aO as A, aT as L, J as X, N as Y, K as F, bR as ee, $ as te } from "./toggle-group-D2Li0iBJ.js";
6
6
  import "./alert-B9F1N9Qk.js";
7
7
  import "@radix-ui/react-aspect-ratio";
8
8
  import { B as M } from "./tooltip-DVeqVwqV.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import "./toggle-group-D6c-gM1D.js";
2
+ import "./toggle-group-D2Li0iBJ.js";
3
3
  import "./alert-B9F1N9Qk.js";
4
4
  import "@radix-ui/react-aspect-ratio";
5
5
  import { B as x } from "./tooltip-DVeqVwqV.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import "./toggle-group-D6c-gM1D.js";
2
+ import "./toggle-group-D2Li0iBJ.js";
3
3
  import "./alert-B9F1N9Qk.js";
4
4
  import "@radix-ui/react-aspect-ratio";
5
5
  import { B as c } from "./tooltip-DVeqVwqV.js";
@@ -13,12 +13,12 @@ import "./select-BpjFWqAY.js";
13
13
  import "next-themes";
14
14
  import "sonner";
15
15
  import "react";
16
- import { A as f } from "./AppActions-DEkRxBia.js";
16
+ import { A as f } from "./AppActions-DtdwQdm-.js";
17
17
  import { A as d } from "./AppTitle-D15YXeMx.js";
18
18
  import { u } from "./useDocumentTitle-WNwdPz-I.js";
19
19
  import { useTranslation as g } from "react-i18next";
20
20
  import "@krosoft/core/helpers";
21
- import { b as h, a as x } from "./SkeletonCards-BvJYF_LK.js";
21
+ import { b as h, a as x } from "./SkeletonCards-D0V2nuDg.js";
22
22
  import { E as A } from "./ErrorState-CmaxuJyW.js";
23
23
  function M({
24
24
  icon: t,
@@ -1,5 +1,5 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { J as l, N as h, O as m, K as g } from "./toggle-group-D6c-gM1D.js";
2
+ import { J as l, N as h, O as m, K as g } from "./toggle-group-D2Li0iBJ.js";
3
3
  import { c as b } from "./tailwind.helper-B6yFEsav.js";
4
4
  import { useTranslation as p } from "react-i18next";
5
5
  const k = ({ titleKey: t, icon: s, className: n, children: a }) => {
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
2
  import { useState as L, useRef as z, useMemo as v, useEffect as E } from "react";
3
- import { $ as T } from "./toggle-group-D6c-gM1D.js";
3
+ import { $ as T } from "./toggle-group-D2Li0iBJ.js";
4
4
  import "./alert-B9F1N9Qk.js";
5
5
  import "@radix-ui/react-aspect-ratio";
6
6
  import { f as M } from "./tooltip-DVeqVwqV.js";
@@ -0,0 +1,250 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import * as S from "react";
3
+ import { useState as z, useRef as q, useEffect as G, useMemo as K } from "react";
4
+ import { I as L, bv as R, bx as j, bw as T, a0 as X, a4 as F, a6 as H, a2 as J, a3 as Q, a5 as E } from "./toggle-group-D2Li0iBJ.js";
5
+ import "./alert-B9F1N9Qk.js";
6
+ import "@radix-ui/react-aspect-ratio";
7
+ import { B as y, f as U } from "./tooltip-DVeqVwqV.js";
8
+ import "@radix-ui/react-collapsible";
9
+ import { I as W } from "./sheet-B_uq6-K_.js";
10
+ import { CalendarIcon as _, XIcon as M, ChevronDownIcon as Y, CheckIcon as Z, PlusIcon as ee, SearchIcon as te } from "lucide-react";
11
+ import "react-resizable-panels";
12
+ import { c as g } from "./tailwind.helper-B6yFEsav.js";
13
+ import "./select-BpjFWqAY.js";
14
+ import "next-themes";
15
+ import "sonner";
16
+ import { format as b } from "date-fns";
17
+ import { fr as C } from "date-fns/locale";
18
+ const Ne = ({ date: r, onDateChange: o, placeholder: h }) => {
19
+ const [c, n] = z(!1), s = q(null);
20
+ G(() => {
21
+ if (!c) return;
22
+ const i = (f) => {
23
+ s.current !== null && !s.current.contains(f.target) && n(!1);
24
+ };
25
+ return document.addEventListener("mousedown", i), () => {
26
+ document.removeEventListener("mousedown", i);
27
+ };
28
+ }, [c]);
29
+ const d = () => {
30
+ n((i) => !i);
31
+ }, m = (i) => {
32
+ o(i), n(!1);
33
+ };
34
+ return /* @__PURE__ */ a("div", { ref: s, className: "relative w-full", children: [
35
+ /* @__PURE__ */ a(
36
+ y,
37
+ {
38
+ variant: "outline",
39
+ type: "button",
40
+ onClick: d,
41
+ className: g(
42
+ "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
43
+ c && "ring-2 ring-ring ring-offset-2",
44
+ r === void 0 && "text-muted-foreground"
45
+ ),
46
+ children: [
47
+ /* @__PURE__ */ e(_, { className: "mr-2 size-4 shrink-0" }),
48
+ r !== void 0 ? b(r, "dd/MM/yyyy", { locale: C }) : /* @__PURE__ */ e("span", { children: h })
49
+ ]
50
+ }
51
+ ),
52
+ c ? /* @__PURE__ */ e("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ e(L, { mode: "single", selected: r, onSelect: m }) }) : null
53
+ ] });
54
+ }, be = ({ value: r, onChange: o, placeholder: h = "Selectionner une periode", className: c }) => {
55
+ const [n, s] = S.useState(!1), [d, m] = S.useState(r);
56
+ S.useEffect(() => {
57
+ n && m(r);
58
+ }, [n, r]);
59
+ const i = (l) => {
60
+ l.stopPropagation(), o(void 0), s(!1);
61
+ }, f = () => {
62
+ o(d), s(!1);
63
+ }, x = () => {
64
+ m(r), s(!1);
65
+ }, w = () => {
66
+ m(void 0);
67
+ }, p = (l) => l != null && l.from ? !l.to || l.from.getTime() === l.to.getTime() ? b(l.from, "dd MMM yyyy", { locale: C }) : `${b(l.from, "dd MMM yyyy", { locale: C })} - ${b(l.to, "dd MMM yyyy", { locale: C })}` : h;
68
+ return /* @__PURE__ */ e("div", { className: g("grid gap-2", c), children: /* @__PURE__ */ a(R, { open: n, onOpenChange: s, children: [
69
+ /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ a(y, { id: "date", variant: "outline", className: g("w-[300px] justify-start text-left font-normal", !(r != null && r.from) && "text-muted-foreground"), children: [
70
+ /* @__PURE__ */ e(_, { className: "mr-2 size-4" }),
71
+ p(r),
72
+ (r == null ? void 0 : r.from) && /* @__PURE__ */ e(
73
+ y,
74
+ {
75
+ type: "button",
76
+ variant: "ghost",
77
+ size: "icon",
78
+ "aria-label": "Effacer la periode selectionnee",
79
+ className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
80
+ onClick: i,
81
+ children: /* @__PURE__ */ e(M, { className: "size-4" })
82
+ }
83
+ )
84
+ ] }) }),
85
+ /* @__PURE__ */ a(T, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
86
+ /* @__PURE__ */ e(
87
+ L,
88
+ {
89
+ mode: "range",
90
+ defaultMonth: d == null ? void 0 : d.from,
91
+ selected: d,
92
+ onSelect: m,
93
+ numberOfMonths: 2,
94
+ weekStartsOn: 1,
95
+ className: "pointer-events-auto p-3"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
99
+ /* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: w, children: "Effacer" }),
100
+ /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
101
+ /* @__PURE__ */ e(y, { variant: "ghost", size: "sm", onClick: x, children: "Annuler" }),
102
+ /* @__PURE__ */ e(y, { size: "sm", onClick: f, children: "Appliquer" })
103
+ ] })
104
+ ] })
105
+ ] })
106
+ ] }) });
107
+ }, Ce = ({
108
+ options: r = [],
109
+ value: o,
110
+ onChange: h,
111
+ onClear: c,
112
+ onCreate: n,
113
+ placeholder: s = "Sélectionner...",
114
+ searchPlaceholder: d = "Rechercher...",
115
+ emptyLabel: m = "Aucun résultat",
116
+ createLabel: i = (p) => `Créer « ${p} »`,
117
+ disabled: f = !1,
118
+ modal: x = !0,
119
+ className: w
120
+ }) => {
121
+ const [p, l] = z(!1), [I, P] = z(""), v = o !== void 0 && o !== "", u = K(() => v ? r.find((t) => t.value === o) : void 0, [v, r, o]), A = v ? (u == null ? void 0 : u.label) ?? o : void 0, N = I.trim(), D = n !== void 0 && N !== "" && !r.some((t) => t.label.toLowerCase() === N.toLowerCase()), k = (t) => {
122
+ l(t), t || P("");
123
+ }, O = (t) => {
124
+ h(t), k(!1);
125
+ }, V = () => {
126
+ n == null || n(N), k(!1);
127
+ };
128
+ return /* @__PURE__ */ a(R, { open: p, onOpenChange: k, modal: x, children: [
129
+ /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ a(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ role: "combobox",
134
+ "aria-expanded": p,
135
+ disabled: f,
136
+ className: g(
137
+ U,
138
+ "w-full",
139
+ "data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2",
140
+ !v && "text-muted-foreground",
141
+ w
142
+ ),
143
+ children: [
144
+ /* @__PURE__ */ a("span", { className: "flex items-center truncate", children: [
145
+ (u == null ? void 0 : u.color) && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: u.color } }),
146
+ /* @__PURE__ */ e("span", { className: "truncate", children: A ?? s }),
147
+ (u == null ? void 0 : u.description) !== void 0 && /* @__PURE__ */ a("span", { className: "ml-1 truncate text-muted-foreground", children: [
148
+ "(",
149
+ u.description,
150
+ ")"
151
+ ] })
152
+ ] }),
153
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
154
+ c && v && !f && /* @__PURE__ */ e(
155
+ "span",
156
+ {
157
+ role: "button",
158
+ tabIndex: -1,
159
+ onClick: (t) => {
160
+ t.stopPropagation();
161
+ },
162
+ onPointerDown: (t) => {
163
+ t.preventDefault(), t.stopPropagation(), c();
164
+ },
165
+ className: "text-muted-foreground hover:text-foreground",
166
+ children: /* @__PURE__ */ e(M, { className: "size-4" })
167
+ }
168
+ ),
169
+ /* @__PURE__ */ e(Y, { className: g("size-4 shrink-0 opacity-50 transition-transform", p && "rotate-180") })
170
+ ] })
171
+ ]
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ e(T, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(
175
+ X,
176
+ {
177
+ filter: (t, $, B) => (B ?? []).join(" ").toLowerCase().includes($.trim().toLowerCase()) ? 1 : 0,
178
+ children: [
179
+ /* @__PURE__ */ e(F, { placeholder: d, value: I, onValueChange: P }),
180
+ /* @__PURE__ */ a(H, { children: [
181
+ !D && /* @__PURE__ */ e(J, { children: m }),
182
+ /* @__PURE__ */ a(Q, { children: [
183
+ r.map((t) => /* @__PURE__ */ a(
184
+ E,
185
+ {
186
+ value: t.value,
187
+ keywords: [t.label, t.description ?? ""],
188
+ onSelect: () => {
189
+ O(t.value);
190
+ },
191
+ children: [
192
+ /* @__PURE__ */ e(Z, { className: g("mr-2 size-4 shrink-0", o === t.value ? "opacity-100" : "opacity-0") }),
193
+ t.color !== void 0 && /* @__PURE__ */ e("span", { className: "mr-2 size-2.5 shrink-0 rounded-full", style: { backgroundColor: t.color } }),
194
+ /* @__PURE__ */ e("span", { className: "truncate", children: t.label }),
195
+ t.description !== void 0 && /* @__PURE__ */ a("span", { className: "ml-1 truncate text-muted-foreground", children: [
196
+ "(",
197
+ t.description,
198
+ ")"
199
+ ] })
200
+ ]
201
+ },
202
+ t.value
203
+ )),
204
+ D && /* @__PURE__ */ a(E, { forceMount: !0, value: "__create__", onSelect: V, children: [
205
+ /* @__PURE__ */ e(ee, { className: "mr-2 size-4 shrink-0" }),
206
+ /* @__PURE__ */ e("span", { className: "truncate", children: i(N) })
207
+ ] })
208
+ ] })
209
+ ] })
210
+ ]
211
+ }
212
+ ) })
213
+ ] });
214
+ }, xe = ({
215
+ searchQuery: r,
216
+ search: o,
217
+ placeholder: h = "Rechercher...",
218
+ onSearch: c,
219
+ onSubmit: n,
220
+ onClear: s,
221
+ className: d
222
+ }) => {
223
+ const m = r ?? o ?? "", i = () => {
224
+ c(""), s !== void 0 && s();
225
+ };
226
+ return /* @__PURE__ */ a("div", { className: g("relative h-fit w-full md:w-64", d), children: [
227
+ /* @__PURE__ */ e(te, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
228
+ /* @__PURE__ */ e(
229
+ W,
230
+ {
231
+ placeholder: h,
232
+ value: m,
233
+ onChange: (f) => {
234
+ c(f.target.value);
235
+ },
236
+ className: "pl-8",
237
+ onKeyDown: (f) => {
238
+ f.key === "Enter" && n !== void 0 && (f.preventDefault(), n());
239
+ }
240
+ }
241
+ ),
242
+ m !== "" ? /* @__PURE__ */ e("button", { onClick: i, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ e(M, { className: "size-4" }) }) : null
243
+ ] });
244
+ };
245
+ export {
246
+ Ne as D,
247
+ xe as S,
248
+ be as a,
249
+ Ce as b
250
+ };
@@ -2,7 +2,7 @@ import { jsxs as s, jsx as e, Fragment as o } from "react/jsx-runtime";
2
2
  import { formatNumber as g } from "@krosoft/core/helpers";
3
3
  import { useTranslation as b } from "react-i18next";
4
4
  import { c as m } from "./tailwind.helper-B6yFEsav.js";
5
- import { J as c, N as p, O as v, K as N } from "./toggle-group-D6c-gM1D.js";
5
+ import { J as c, N as p, O as v, K as N } from "./toggle-group-D2Li0iBJ.js";
6
6
  import "./alert-B9F1N9Qk.js";
7
7
  import "@radix-ui/react-aspect-ratio";
8
8
  import "./tooltip-DVeqVwqV.js";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
2
  import { useState as F, useEffect as O, useMemo as A } from "react";
3
- import { a as $, D as j, b as M, S as I } from "./SearchInput-ClZbbRWg.js";
4
- import { B as k, a$ as z, bv as B, bx as R, bw as Q, $ as C } from "./toggle-group-D6c-gM1D.js";
3
+ import { a as $, D as j, b as M, S as I } from "./SearchInput-B08-Mcsx.js";
4
+ import { B as k, a$ as z, bv as B, bx as R, bw as Q, $ as C } from "./toggle-group-D2Li0iBJ.js";
5
5
  import "./alert-B9F1N9Qk.js";
6
6
  import "@radix-ui/react-aspect-ratio";
7
7
  import { B as w, e as V } from "./tooltip-DVeqVwqV.js";
@@ -15,7 +15,7 @@ import { S as Z, h as q, i as ee, a as re, c as te } from "./select-BpjFWqAY.js"
15
15
  import "next-themes";
16
16
  import "sonner";
17
17
  import { c as T } from "./tailwind.helper-B6yFEsav.js";
18
- import { M as le } from "./MultiSelect-CqcbwKYV.js";
18
+ import { M as le } from "./MultiSelect-ovXnKCuU.js";
19
19
  const L = (a, n, c = {}) => {
20
20
  if (n instanceof Date)
21
21
  return n.toLocaleDateString("fr-FR");
@@ -1,5 +1,5 @@
1
- import { D as s, M as d } from "../../../MetricCard-CvQFjIOb.js";
2
- import { K as o, a as C, S as t, b as p } from "../../../SkeletonCards-BvJYF_LK.js";
1
+ import { D as s, M as d } from "../../../MetricCard-BAa26w6e.js";
2
+ import { K as o, a as C, S as t, b as p } from "../../../SkeletonCards-D0V2nuDg.js";
3
3
  export {
4
4
  s as DashboardCard,
5
5
  o as KpiCard,