@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.
- package/dist/{AppActions-DEkRxBia.js → AppActions-DtdwQdm-.js} +1 -1
- package/dist/{AppSubTitle-ChCtQ7Sv.js → AppSubTitle-Co9HDBO4.js} +1 -1
- package/dist/AppVerticalTabs-B3_nbdLm.js +99 -0
- package/dist/{ConfirmationDialog-9CKgZoNY.js → ConfirmationDialog-3rO4sYM8.js} +36 -36
- package/dist/{DataTable-ny08K506.js → DataTable-Ckbr166c.js} +1 -1
- package/dist/{GenericForm-B39toMkE.js → GenericForm-ClzOIaJc.js} +4 -4
- package/dist/{ImageInput-BoYUZx9H.js → ImageInput-BPV_4oDI.js} +1 -1
- package/dist/{KpiCardsLayout-mQ7AcbqA.js → KpiCardsLayout-D67cLG3R.js} +3 -3
- package/dist/{MetricCard-CvQFjIOb.js → MetricCard-BAa26w6e.js} +1 -1
- package/dist/{MultiSelect-CqcbwKYV.js → MultiSelect-ovXnKCuU.js} +1 -1
- package/dist/SearchInput-B08-Mcsx.js +250 -0
- package/dist/{SkeletonCards-BvJYF_LK.js → SkeletonCards-D0V2nuDg.js} +1 -1
- package/dist/{TableFilter-CWDy_RHA.js → TableFilter-Z0T30AzZ.js} +3 -3
- package/dist/components/core/cards/index.js +2 -2
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +14 -14
- package/dist/components/core/inputs/SearchableSelect.d.ts +16 -2
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/index.d.ts +1 -0
- package/dist/components/core/inputs/index.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +3 -3
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/AppTabs.d.ts.map +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/index.js +15 -15
- package/dist/components/ui/index.js +2 -2
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/hooks/index.js +9 -7
- package/dist/hooks/ui/index.d.ts +1 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/index.js +11 -9
- package/dist/hooks/ui/useScrollFade.d.ts +11 -0
- package/dist/hooks/ui/useScrollFade.d.ts.map +1 -0
- package/dist/tailwind/index.d.ts +10 -10
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +7 -3
- package/dist/{toaster-B6XKMRwI.js → toaster-BaFcYXKg.js} +1 -1
- package/dist/{toggle-group-D6c-gM1D.js → toggle-group-D2Li0iBJ.js} +583 -565
- package/dist/useScrollFade-BA4KqJYp.js +23 -0
- package/package.json +1 -1
- package/dist/AppVerticalTabs-D8fURUUN.js +0 -94
- package/dist/SearchInput-ClZbbRWg.js +0 -254
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState as f, useLayoutEffect as u } from "react";
|
|
2
|
+
const l = "1.5rem";
|
|
3
|
+
function p(o) {
|
|
4
|
+
const [n, d] = f({ start: !1, end: !1 });
|
|
5
|
+
return u(() => {
|
|
6
|
+
const e = o.current;
|
|
7
|
+
if (!e) return;
|
|
8
|
+
const r = () => {
|
|
9
|
+
const i = e.scrollWidth - e.clientWidth, a = e.scrollLeft > 1, c = e.scrollLeft < i - 1;
|
|
10
|
+
d((s) => s.start === a && s.end === c ? s : { start: a, end: c });
|
|
11
|
+
};
|
|
12
|
+
r(), e.addEventListener("scroll", r, { passive: !0 });
|
|
13
|
+
const t = typeof ResizeObserver > "u" ? null : new ResizeObserver(r);
|
|
14
|
+
return t == null || t.observe(e), () => {
|
|
15
|
+
e.removeEventListener("scroll", r), t == null || t.disconnect();
|
|
16
|
+
};
|
|
17
|
+
}), !n.start && !n.end ? {} : {
|
|
18
|
+
maskImage: `linear-gradient(to right, transparent 0, #000 ${n.start ? l : "0px"}, #000 calc(100% - ${n.end ? l : "0px"}), transparent 100%)`
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as u
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { J as g, N as y, K as T, bN as b, bP as w, bQ as S, bO as C, bA as A } from "./toggle-group-D6c-gM1D.js";
|
|
3
|
-
import { A as P } from "./AppActions-DEkRxBia.js";
|
|
4
|
-
import { A as k } from "./AppTitle-D15YXeMx.js";
|
|
5
|
-
import { useTranslation as v } from "react-i18next";
|
|
6
|
-
import { useSearchParams as N } from "react-router-dom";
|
|
7
|
-
import { c as j } from "./tailwind.helper-B6yFEsav.js";
|
|
8
|
-
import { S as z, h as K, i as V, a as L, c as q } from "./select-BpjFWqAY.js";
|
|
9
|
-
import { ConstructionIcon as f } from "lucide-react";
|
|
10
|
-
function H({ titleKey: s, descriptionKey: l, actions: c = [], className: t }) {
|
|
11
|
-
return /* @__PURE__ */ n("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
12
|
-
/* @__PURE__ */ a(k, { titleKey: s, descriptionKey: l, isSubTitle: !0 }),
|
|
13
|
-
/* @__PURE__ */ a(P, { actions: c, className: t })
|
|
14
|
-
] });
|
|
15
|
-
}
|
|
16
|
-
function E({ titleKey: s, descriptionKey: l, actions: c = [], className: t, children: i, isSubTitle: u }) {
|
|
17
|
-
return /* @__PURE__ */ n(g, { children: [
|
|
18
|
-
/* @__PURE__ */ a(y, { children: /* @__PURE__ */ a(H, { titleKey: s, descriptionKey: l, actions: c, className: t }) }),
|
|
19
|
-
/* @__PURE__ */ a(T, { className: "space-y-4", children: i })
|
|
20
|
-
] });
|
|
21
|
-
}
|
|
22
|
-
function F({ tabs: s, itemId: l, item: c, fit: t }) {
|
|
23
|
-
var m, d;
|
|
24
|
-
const { t: i } = v(), [u, o] = N(), p = u.get("tab"), h = ((m = s.find((e) => e.value === p)) == null ? void 0 : m.value) ?? ((d = s[0]) == null ? void 0 : d.value);
|
|
25
|
-
return /* @__PURE__ */ n(b, { value: h, onValueChange: (e) => {
|
|
26
|
-
const r = new URLSearchParams();
|
|
27
|
-
r.set("tab", e), o(r);
|
|
28
|
-
}, children: [
|
|
29
|
-
/* @__PURE__ */ a(w, { className: j("w-full justify-start", t && "sm:w-fit"), children: s.map((e) => /* @__PURE__ */ n(S, { value: e.value, className: "gap-2", disabled: e.disabled, children: [
|
|
30
|
-
e.icon ? /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: /* @__PURE__ */ a(e.icon, { className: "size-4" }) }) : null,
|
|
31
|
-
/* @__PURE__ */ a("span", { className: "text-xs sm:text-sm", children: i(e.titleKey) ?? "" }),
|
|
32
|
-
e.count ? /* @__PURE__ */ n("span", { className: "text-gray-500 text-xs", children: [
|
|
33
|
-
"(",
|
|
34
|
-
e.count(c),
|
|
35
|
-
")"
|
|
36
|
-
] }) : null
|
|
37
|
-
] }, e.value)) }),
|
|
38
|
-
s.map((e) => /* @__PURE__ */ a(C, { value: e.value, className: "mt-4", children: e.component ? e.component(l) : null }, e.value))
|
|
39
|
-
] });
|
|
40
|
-
}
|
|
41
|
-
const G = ({ tabs: s, item: l }) => {
|
|
42
|
-
var m, d;
|
|
43
|
-
const { t: c } = v(), [t, i] = N(), u = t.get("tab"), o = ((m = s.find((e) => e.value === u)) == null ? void 0 : m.value) ?? ((d = s[0]) == null ? void 0 : d.value), p = (e) => {
|
|
44
|
-
const r = new URLSearchParams();
|
|
45
|
-
r.set("tab", e), i(r);
|
|
46
|
-
}, h = () => {
|
|
47
|
-
const e = s.find((r) => r.value === o);
|
|
48
|
-
return e ? e.component ? e.component() : x() : null;
|
|
49
|
-
}, x = () => /* @__PURE__ */ a("div", { className: "p-4 lg:p-6", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-64 text-gray-500", children: /* @__PURE__ */ n("div", { className: "text-center", children: [
|
|
50
|
-
/* @__PURE__ */ a(f, { className: "h-12 w-12 mx-auto mb-4 text-amber-500" }),
|
|
51
|
-
/* @__PURE__ */ a("p", { className: "text-lg font-medium", children: "Section en cours de développement" }),
|
|
52
|
-
/* @__PURE__ */ a("p", { className: "text-sm text-gray-400", children: "Cette fonctionnalité sera bientôt disponible" })
|
|
53
|
-
] }) }) });
|
|
54
|
-
return /* @__PURE__ */ n("div", { className: "flex flex-col md:flex-row h-full min-w-0 ", children: [
|
|
55
|
-
/* @__PURE__ */ a("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__ */ a(A, { className: "h-full", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: s.map((e, r) => /* @__PURE__ */ n(
|
|
56
|
-
"div",
|
|
57
|
-
{
|
|
58
|
-
className: `px-2 py-2 rounded-control text-sm transition-colors flex items-center gap-2 ${e.disabled ? "text-gray-400 cursor-not-allowed opacity-50" : o === e.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"}`,
|
|
59
|
-
onClick: () => !e.disabled && p(e.value),
|
|
60
|
-
children: [
|
|
61
|
-
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
62
|
-
/* @__PURE__ */ a("span", { className: "flex-1", children: c(e.titleKey) }),
|
|
63
|
-
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
64
|
-
"(",
|
|
65
|
-
e.count(l),
|
|
66
|
-
")"
|
|
67
|
-
] }),
|
|
68
|
-
!e.component && /* @__PURE__ */ a(f, { className: "size-4 text-amber-500" })
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
r
|
|
72
|
-
)) }) }) }),
|
|
73
|
-
/* @__PURE__ */ a("div", { className: "md:hidden w-full border-b pb-4 mb-4", children: /* @__PURE__ */ n(z, { value: o, onValueChange: p, children: [
|
|
74
|
-
/* @__PURE__ */ a(K, { className: "w-full", children: /* @__PURE__ */ a(V, { placeholder: "Sélectionner une section" }) }),
|
|
75
|
-
/* @__PURE__ */ a(L, { children: s.map((e, r) => /* @__PURE__ */ a(q, { value: e.value, disabled: e.disabled, children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
76
|
-
e.icon && /* @__PURE__ */ a(e.icon, { className: "size-4" }),
|
|
77
|
-
/* @__PURE__ */ a("span", { children: c(e.titleKey) }),
|
|
78
|
-
e.count && /* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
79
|
-
"(",
|
|
80
|
-
e.count(l),
|
|
81
|
-
")"
|
|
82
|
-
] }),
|
|
83
|
-
!e.component && /* @__PURE__ */ a(f, { className: "size-4 text-amber-500" })
|
|
84
|
-
] }) }, r)) })
|
|
85
|
-
] }) }),
|
|
86
|
-
/* @__PURE__ */ a("div", { className: "flex-1 md:px-4 min-w-0 overflow-auto", children: h() })
|
|
87
|
-
] });
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
E as A,
|
|
91
|
-
H as a,
|
|
92
|
-
F as b,
|
|
93
|
-
G as c
|
|
94
|
-
};
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import * as w from "react";
|
|
3
|
-
import { useState as k, useRef as C, useEffect as z, useMemo as S } from "react";
|
|
4
|
-
import { I, bv as L, bx as O, bw as j } from "./toggle-group-D6c-gM1D.js";
|
|
5
|
-
import "./alert-B9F1N9Qk.js";
|
|
6
|
-
import "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { B as g, f as A } from "./tooltip-DVeqVwqV.js";
|
|
8
|
-
import "@radix-ui/react-collapsible";
|
|
9
|
-
import { I as q } from "./sheet-B_uq6-K_.js";
|
|
10
|
-
import { CalendarIcon as D, XIcon as M, ChevronDownIcon as B, SearchIcon as E, CheckIcon as $ } from "lucide-react";
|
|
11
|
-
import "react-resizable-panels";
|
|
12
|
-
import { c as f } from "./tailwind.helper-B6yFEsav.js";
|
|
13
|
-
import "./select-BpjFWqAY.js";
|
|
14
|
-
import "next-themes";
|
|
15
|
-
import "sonner";
|
|
16
|
-
import { format as v } from "date-fns";
|
|
17
|
-
import { fr as N } from "date-fns/locale";
|
|
18
|
-
const ne = ({ date: r, onDateChange: o, placeholder: p }) => {
|
|
19
|
-
const [u, m] = k(!1), c = C(null);
|
|
20
|
-
z(() => {
|
|
21
|
-
if (!u) return;
|
|
22
|
-
const l = (n) => {
|
|
23
|
-
c.current !== null && !c.current.contains(n.target) && m(!1);
|
|
24
|
-
};
|
|
25
|
-
return document.addEventListener("mousedown", l), () => {
|
|
26
|
-
document.removeEventListener("mousedown", l);
|
|
27
|
-
};
|
|
28
|
-
}, [u]);
|
|
29
|
-
const d = () => {
|
|
30
|
-
m((l) => !l);
|
|
31
|
-
}, a = (l) => {
|
|
32
|
-
o(l), m(!1);
|
|
33
|
-
};
|
|
34
|
-
return /* @__PURE__ */ s("div", { ref: c, className: "relative w-full", children: [
|
|
35
|
-
/* @__PURE__ */ s(
|
|
36
|
-
g,
|
|
37
|
-
{
|
|
38
|
-
variant: "outline",
|
|
39
|
-
type: "button",
|
|
40
|
-
onClick: d,
|
|
41
|
-
className: f(
|
|
42
|
-
"w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
43
|
-
u && "ring-2 ring-ring ring-offset-2",
|
|
44
|
-
r === void 0 && "text-muted-foreground"
|
|
45
|
-
),
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ t(D, { className: "mr-2 size-4 shrink-0" }),
|
|
48
|
-
r !== void 0 ? v(r, "dd/MM/yyyy", { locale: N }) : /* @__PURE__ */ t("span", { children: p })
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
u ? /* @__PURE__ */ t("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__ */ t(I, { mode: "single", selected: r, onSelect: a }) }) : null
|
|
53
|
-
] });
|
|
54
|
-
}, se = ({ value: r, onChange: o, placeholder: p = "Selectionner une periode", className: u }) => {
|
|
55
|
-
const [m, c] = w.useState(!1), [d, a] = w.useState(r);
|
|
56
|
-
w.useEffect(() => {
|
|
57
|
-
m && a(r);
|
|
58
|
-
}, [m, r]);
|
|
59
|
-
const l = (i) => {
|
|
60
|
-
i.stopPropagation(), o(void 0), c(!1);
|
|
61
|
-
}, n = () => {
|
|
62
|
-
o(d), c(!1);
|
|
63
|
-
}, b = () => {
|
|
64
|
-
a(r), c(!1);
|
|
65
|
-
}, y = () => {
|
|
66
|
-
a(void 0);
|
|
67
|
-
}, x = (i) => i != null && i.from ? !i.to || i.from.getTime() === i.to.getTime() ? v(i.from, "dd MMM yyyy", { locale: N }) : `${v(i.from, "dd MMM yyyy", { locale: N })} - ${v(i.to, "dd MMM yyyy", { locale: N })}` : p;
|
|
68
|
-
return /* @__PURE__ */ t("div", { className: f("grid gap-2", u), children: /* @__PURE__ */ s(L, { open: m, onOpenChange: c, children: [
|
|
69
|
-
/* @__PURE__ */ t(O, { asChild: !0, children: /* @__PURE__ */ s(g, { id: "date", variant: "outline", className: f("w-[300px] justify-start text-left font-normal", !(r != null && r.from) && "text-muted-foreground"), children: [
|
|
70
|
-
/* @__PURE__ */ t(D, { className: "mr-2 size-4" }),
|
|
71
|
-
x(r),
|
|
72
|
-
(r == null ? void 0 : r.from) && /* @__PURE__ */ t(
|
|
73
|
-
g,
|
|
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: l,
|
|
81
|
-
children: /* @__PURE__ */ t(M, { className: "size-4" })
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
] }) }),
|
|
85
|
-
/* @__PURE__ */ s(j, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
|
|
86
|
-
/* @__PURE__ */ t(
|
|
87
|
-
I,
|
|
88
|
-
{
|
|
89
|
-
mode: "range",
|
|
90
|
-
defaultMonth: d == null ? void 0 : d.from,
|
|
91
|
-
selected: d,
|
|
92
|
-
onSelect: a,
|
|
93
|
-
numberOfMonths: 2,
|
|
94
|
-
weekStartsOn: 1,
|
|
95
|
-
className: "pointer-events-auto p-3"
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
|
|
99
|
-
/* @__PURE__ */ t(g, { variant: "ghost", size: "sm", onClick: y, children: "Effacer" }),
|
|
100
|
-
/* @__PURE__ */ s("div", { className: "flex gap-2", children: [
|
|
101
|
-
/* @__PURE__ */ t(g, { variant: "ghost", size: "sm", onClick: b, children: "Annuler" }),
|
|
102
|
-
/* @__PURE__ */ t(g, { size: "sm", onClick: n, children: "Appliquer" })
|
|
103
|
-
] })
|
|
104
|
-
] })
|
|
105
|
-
] })
|
|
106
|
-
] }) });
|
|
107
|
-
}, le = ({
|
|
108
|
-
options: r = [],
|
|
109
|
-
value: o,
|
|
110
|
-
onChange: p,
|
|
111
|
-
onClear: u,
|
|
112
|
-
placeholder: m = "Sélectionner...",
|
|
113
|
-
searchPlaceholder: c = "Rechercher...",
|
|
114
|
-
disabled: d = !1
|
|
115
|
-
}) => {
|
|
116
|
-
const [a, l] = k(""), [n, b] = k(!1), y = C(null), x = C(null), i = S(() => a === "" ? r : r.filter((e) => e.label.toLowerCase().includes(a.toLowerCase())), [r, a]), h = S(() => {
|
|
117
|
-
if (!(o === void 0 || o === ""))
|
|
118
|
-
return r.find((e) => e.value === o);
|
|
119
|
-
}, [r, o]), P = o === void 0 || o === "" ? void 0 : (h == null ? void 0 : h.label) ?? o;
|
|
120
|
-
z(() => {
|
|
121
|
-
n && requestAnimationFrame(() => {
|
|
122
|
-
var e;
|
|
123
|
-
(e = x.current) == null || e.focus();
|
|
124
|
-
});
|
|
125
|
-
}, [n]), z(() => {
|
|
126
|
-
if (!n) return;
|
|
127
|
-
const e = (T) => {
|
|
128
|
-
y.current !== null && !y.current.contains(T.target) && (b(!1), l(""));
|
|
129
|
-
};
|
|
130
|
-
return document.addEventListener("mousedown", e), () => {
|
|
131
|
-
document.removeEventListener("mousedown", e);
|
|
132
|
-
};
|
|
133
|
-
}, [n]);
|
|
134
|
-
const R = (e) => {
|
|
135
|
-
p(e), b(!1), l("");
|
|
136
|
-
};
|
|
137
|
-
return /* @__PURE__ */ s("div", { ref: y, className: "relative w-full", children: [
|
|
138
|
-
/* @__PURE__ */ s(
|
|
139
|
-
"button",
|
|
140
|
-
{
|
|
141
|
-
type: "button",
|
|
142
|
-
onClick: () => {
|
|
143
|
-
d || b((e) => (e && l(""), !e));
|
|
144
|
-
},
|
|
145
|
-
disabled: d,
|
|
146
|
-
className: f(
|
|
147
|
-
A,
|
|
148
|
-
"w-full",
|
|
149
|
-
n && "ring-2 ring-ring ring-offset-2",
|
|
150
|
-
(o === void 0 || o === "") && "text-muted-foreground"
|
|
151
|
-
),
|
|
152
|
-
children: [
|
|
153
|
-
/* @__PURE__ */ s("span", { className: "flex items-center gap-2 truncate", children: [
|
|
154
|
-
(h == null ? void 0 : h.color) && /* @__PURE__ */ t("span", { className: "size-2.5 shrink-0 rounded-full", style: { backgroundColor: h.color } }),
|
|
155
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: P ?? m })
|
|
156
|
-
] }),
|
|
157
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
158
|
-
u && o !== void 0 && o !== "" && !d && /* @__PURE__ */ t(
|
|
159
|
-
"span",
|
|
160
|
-
{
|
|
161
|
-
role: "button",
|
|
162
|
-
tabIndex: -1,
|
|
163
|
-
onClick: (e) => {
|
|
164
|
-
e.stopPropagation();
|
|
165
|
-
},
|
|
166
|
-
onPointerDown: (e) => {
|
|
167
|
-
e.preventDefault(), e.stopPropagation(), u();
|
|
168
|
-
},
|
|
169
|
-
className: "text-muted-foreground hover:text-foreground",
|
|
170
|
-
children: /* @__PURE__ */ t(M, { className: "size-4" })
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
/* @__PURE__ */ t(B, { className: f("size-4 opacity-50 shrink-0 transition-transform", n && "rotate-180") })
|
|
174
|
-
] })
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
n ? /* @__PURE__ */ s("div", { className: "absolute left-0 right-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: [
|
|
179
|
-
/* @__PURE__ */ t("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
180
|
-
/* @__PURE__ */ t(E, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
181
|
-
/* @__PURE__ */ t(
|
|
182
|
-
"input",
|
|
183
|
-
{
|
|
184
|
-
ref: x,
|
|
185
|
-
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
186
|
-
placeholder: c,
|
|
187
|
-
value: a,
|
|
188
|
-
onChange: (e) => {
|
|
189
|
-
l(e.target.value);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
)
|
|
193
|
-
] }) }),
|
|
194
|
-
/* @__PURE__ */ s("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", children: [
|
|
195
|
-
i.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
196
|
-
i.map((e) => /* @__PURE__ */ s(
|
|
197
|
-
"button",
|
|
198
|
-
{
|
|
199
|
-
type: "button",
|
|
200
|
-
onClick: () => {
|
|
201
|
-
R(e.value);
|
|
202
|
-
},
|
|
203
|
-
className: f(
|
|
204
|
-
"flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors text-left w-full",
|
|
205
|
-
o === e.value && "bg-muted font-medium"
|
|
206
|
-
),
|
|
207
|
-
children: [
|
|
208
|
-
/* @__PURE__ */ t($, { className: f("size-3.5 shrink-0", o === e.value ? "opacity-100" : "opacity-0") }),
|
|
209
|
-
e.color && /* @__PURE__ */ t("span", { className: "size-2.5 shrink-0 rounded-full", style: { backgroundColor: e.color } }),
|
|
210
|
-
e.label
|
|
211
|
-
]
|
|
212
|
-
},
|
|
213
|
-
e.value
|
|
214
|
-
))
|
|
215
|
-
] })
|
|
216
|
-
] }) : null
|
|
217
|
-
] });
|
|
218
|
-
}, ae = ({
|
|
219
|
-
searchQuery: r,
|
|
220
|
-
search: o,
|
|
221
|
-
placeholder: p = "Rechercher...",
|
|
222
|
-
onSearch: u,
|
|
223
|
-
onSubmit: m,
|
|
224
|
-
onClear: c,
|
|
225
|
-
className: d
|
|
226
|
-
}) => {
|
|
227
|
-
const a = r ?? o ?? "", l = () => {
|
|
228
|
-
u(""), c !== void 0 && c();
|
|
229
|
-
};
|
|
230
|
-
return /* @__PURE__ */ s("div", { className: f("relative h-fit w-full md:w-64", d), children: [
|
|
231
|
-
/* @__PURE__ */ t(E, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
|
|
232
|
-
/* @__PURE__ */ t(
|
|
233
|
-
q,
|
|
234
|
-
{
|
|
235
|
-
placeholder: p,
|
|
236
|
-
value: a,
|
|
237
|
-
onChange: (n) => {
|
|
238
|
-
u(n.target.value);
|
|
239
|
-
},
|
|
240
|
-
className: "pl-8",
|
|
241
|
-
onKeyDown: (n) => {
|
|
242
|
-
n.key === "Enter" && m !== void 0 && (n.preventDefault(), m());
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
a !== "" ? /* @__PURE__ */ t("button", { onClick: l, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ t(M, { className: "size-4" }) }) : null
|
|
247
|
-
] });
|
|
248
|
-
};
|
|
249
|
-
export {
|
|
250
|
-
ne as D,
|
|
251
|
-
ae as S,
|
|
252
|
-
se as a,
|
|
253
|
-
le as b
|
|
254
|
-
};
|