@krosoft/react 0.0.182 → 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 (42) 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-BPXA2g3g.js → ConfirmationDialog-3rO4sYM8.js} +2 -2
  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/{toaster-B6XKMRwI.js → toaster-BaFcYXKg.js} +1 -1
  38. package/dist/{toggle-group-D6c-gM1D.js → toggle-group-D2Li0iBJ.js} +583 -565
  39. package/dist/useScrollFade-BA4KqJYp.js +23 -0
  40. package/package.json +1 -1
  41. package/dist/AppVerticalTabs-D8fURUUN.js +0 -94
  42. 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";
@@ -14,7 +14,7 @@ import "next-themes";
14
14
  import "sonner";
15
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
20
  const { t: i } = O(), { title: b, description: d, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
@@ -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,
@@ -1,5 +1,5 @@
1
- import { A as i, C as s, F as g } from "../../../ConfirmationDialog-BPXA2g3g.js";
2
- import { D as r, a as D, b as e, c as t, d as n, e as p, f, g as m, h as C, i as F, P } from "../../../toggle-group-D6c-gM1D.js";
1
+ import { A as i, C as s, F as g } from "../../../ConfirmationDialog-3rO4sYM8.js";
2
+ import { D as r, a as D, b as e, c as t, d as n, e as p, f, g as m, h as C, i as F, P } from "../../../toggle-group-D2Li0iBJ.js";
3
3
  export {
4
4
  i as AppDialog,
5
5
  s as ConfirmationDialog,
@@ -1,4 +1,4 @@
1
- import { A as l, a as i, F as r, S as s, T as t } from "../../../TableFilter-CWDy_RHA.js";
1
+ import { A as l, a as i, F as r, S as s, T as t } from "../../../TableFilter-Z0T30AzZ.js";
2
2
  export {
3
3
  l as ActiveFilters,
4
4
  i as AdvancedFilters,
@@ -1,4 +1,4 @@
1
- import { G as o } from "../../../GenericForm-B39toMkE.js";
1
+ import { G as o } from "../../../GenericForm-ClzOIaJc.js";
2
2
  export {
3
3
  o as GenericForm
4
4
  };
@@ -1,22 +1,22 @@
1
- import { D as r, M as o } from "../../MetricCard-CvQFjIOb.js";
2
- import { K as t, a as i, S as l, b as p } from "../../SkeletonCards-BvJYF_LK.js";
3
- import { A as m, C as d, F as g } from "../../ConfirmationDialog-BPXA2g3g.js";
4
- import { D as A, a as D, b as T, c as n, d as c, e as x, f as S, g as C, h as F, i as P, P as h } from "../../toggle-group-D6c-gM1D.js";
5
- import { A as k, a as H, F as I, S as K, T as v } from "../../TableFilter-CWDy_RHA.js";
6
- import { G as M } from "../../GenericForm-B39toMkE.js";
7
- import { I as L } from "../../ImageInput-BoYUZx9H.js";
8
- import { D as G, a as N, S as O, b as R } from "../../SearchInput-ClZbbRWg.js";
9
- import { M as j } from "../../MultiSelect-CqcbwKYV.js";
10
- import { A as w } from "../../AppActions-DEkRxBia.js";
11
- import { A as J, K as Q } from "../../KpiCardsLayout-mQ7AcbqA.js";
12
- import { A as W } from "../../AppSubTitle-ChCtQ7Sv.js";
1
+ import { D as r, M as o } from "../../MetricCard-BAa26w6e.js";
2
+ import { K as t, a as i, S as l, b as p } from "../../SkeletonCards-D0V2nuDg.js";
3
+ import { A as m, C as d, F as g } from "../../ConfirmationDialog-3rO4sYM8.js";
4
+ import { D as A, a as D, b as T, c as n, d as c, e as x, f as S, g as C, h as F, i as P, P as h } from "../../toggle-group-D2Li0iBJ.js";
5
+ import { A as k, a as H, F as I, S as K, T as v } from "../../TableFilter-Z0T30AzZ.js";
6
+ import { G as M } from "../../GenericForm-ClzOIaJc.js";
7
+ import { I as L } from "../../ImageInput-BPV_4oDI.js";
8
+ import { D as G, a as N, S as O, b as R } from "../../SearchInput-B08-Mcsx.js";
9
+ import { M as j } from "../../MultiSelect-ovXnKCuU.js";
10
+ import { A as w } from "../../AppActions-DtdwQdm-.js";
11
+ import { A as J, K as Q } from "../../KpiCardsLayout-D67cLG3R.js";
12
+ import { A as W } from "../../AppSubTitle-Co9HDBO4.js";
13
13
  import { A as Y } from "../../AppTitle-D15YXeMx.js";
14
14
  import { S as _, a as $, b as aa, T as ea } from "../../Topbar-CFmKB_S2.js";
15
15
  import { E as oa } from "../../ErrorAlert-SrIcU1mM.js";
16
16
  import { E as ta } from "../../ErrorState-CmaxuJyW.js";
17
17
  import { L as la } from "../../LoadingState-BN0YaPSs.js";
18
- import { D as ba, T as ma, a as da, b as ga, c as fa, d as Aa, e as Da } from "../../DataTable-ny08K506.js";
19
- import { A as na, a as ca, b as xa, c as Sa } from "../../AppVerticalTabs-D8fURUUN.js";
18
+ import { D as ba, T as ma, a as da, b as ga, c as fa, d as Aa, e as Da } from "../../DataTable-Ckbr166c.js";
19
+ import { A as na, a as ca, b as xa, c as Sa } from "../../AppVerticalTabs-B3_nbdLm.js";
20
20
  import { T as Fa } from "../../ThemeSelector-BFC37dSl.js";
21
21
  export {
22
22
  k as ActiveFilters,
@@ -1,14 +1,28 @@
1
1
  import React from "react";
2
2
  import type { SelectOption } from "@krosoft/core/types";
3
+ export interface SearchableSelectOption extends SelectOption {
4
+ /** Texte secondaire affiché en gris à côté du libellé (ex. le groupe d'un tenant). Inclus dans la recherche. */
5
+ description?: string;
6
+ }
3
7
  interface SearchableSelectProps {
4
- options?: SelectOption[];
8
+ options?: SearchableSelectOption[];
5
9
  value: string | undefined;
6
10
  onChange: (value: string) => void;
7
11
  onClear?: () => void;
12
+ /** Fourni : propose de créer une option quand la saisie ne correspond à aucun libellé existant. */
13
+ onCreate?: (label: string) => void;
8
14
  placeholder?: string;
9
15
  searchPlaceholder?: string;
16
+ emptyLabel?: string;
17
+ createLabel?: (search: string) => string;
10
18
  disabled?: boolean;
19
+ /**
20
+ * Panneau rendu en modal (défaut, comme le `Select`). À laisser tel quel dans une boîte de
21
+ * dialogue : sans ça, le `Dialog` neutralise les clics sur le panneau porté dans le portail.
22
+ */
23
+ modal?: boolean;
24
+ className?: string;
11
25
  }
12
- export declare const SearchableSelect: ({ options, value, onChange, onClear, placeholder, searchPlaceholder, disabled, }: SearchableSelectProps) => React.ReactElement;
26
+ export declare const SearchableSelect: ({ options, value, onChange, onClear, onCreate, placeholder, searchPlaceholder, emptyLabel, createLabel, disabled, modal, className, }: SearchableSelectProps) => React.ReactElement;
13
27
  export {};
14
28
  //# sourceMappingURL=SearchableSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchableSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/SearchableSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,GAAI,kFAQ9B,qBAAqB,KAAG,KAAK,CAAC,YAwIhC,CAAC"}
1
+ {"version":3,"file":"SearchableSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/SearchableSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAejD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACnC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,GAAI,uIAa9B,qBAAqB,KAAG,KAAK,CAAC,YAgHhC,CAAC"}
@@ -4,4 +4,5 @@ export { DatePicker } from "./DatePicker";
4
4
  export { DateRangePicker } from "./DateRangePicker";
5
5
  export { MultiSelect } from "./MultiSelect";
6
6
  export { SearchableSelect } from "./SearchableSelect";
7
+ export type { SearchableSelectOption } from "./SearchableSelect";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { I as r } from "../../../ImageInput-BoYUZx9H.js";
2
- import { D as c, a as o, S as s, b as p } from "../../../SearchInput-ClZbbRWg.js";
3
- import { M as l } from "../../../MultiSelect-CqcbwKYV.js";
1
+ import { I as r } from "../../../ImageInput-BPV_4oDI.js";
2
+ import { D as c, a as o, S as s, b as p } from "../../../SearchInput-B08-Mcsx.js";
3
+ import { M as l } from "../../../MultiSelect-ovXnKCuU.js";
4
4
  export {
5
5
  c as DatePicker,
6
6
  o as DateRangePicker,
@@ -1,6 +1,6 @@
1
- import { A as r } from "../../../AppActions-DEkRxBia.js";
2
- import { A as e, K as A } from "../../../KpiCardsLayout-mQ7AcbqA.js";
3
- import { A as s } from "../../../AppSubTitle-ChCtQ7Sv.js";
1
+ import { A as r } from "../../../AppActions-DtdwQdm-.js";
2
+ import { A as e, K as A } from "../../../KpiCardsLayout-D67cLG3R.js";
3
+ import { A as s } from "../../../AppSubTitle-Co9HDBO4.js";
4
4
  import { A as i } from "../../../AppTitle-D15YXeMx.js";
5
5
  export {
6
6
  r as AppActions,