@krosoft/react 0.0.180 → 0.0.181

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.
@@ -14,7 +14,7 @@ import "next-themes";
14
14
  import "sonner";
15
15
  import { useState as w, useEffect as ee } from "react";
16
16
  import { useTranslation as O } from "react-i18next";
17
- import { G as le } from "./GenericForm-COQEdT9e.js";
17
+ import { G as le } from "./GenericForm-B39toMkE.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: m, icon: f, maxWidth: g = "sm:max-w-xl", actions: n } = l;
@@ -1,7 +1,7 @@
1
1
  import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
2
  import { I as J } from "./ImageInput-BoYUZx9H.js";
3
3
  import { A as V } from "./AppSubTitle-ChCtQ7Sv.js";
4
- import { M as Q } from "./MultiSelect-DF7-91OW.js";
4
+ import { M as Q } from "./MultiSelect-CqcbwKYV.js";
5
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";
6
6
  import "./alert-B9F1N9Qk.js";
7
7
  import "@radix-ui/react-aspect-ratio";
@@ -1,73 +1,78 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import { useState as k, useRef as w, useMemo as N, useEffect as y } from "react";
3
- import { $ as C } from "./toggle-group-D6c-gM1D.js";
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";
4
4
  import "./alert-B9F1N9Qk.js";
5
5
  import "@radix-ui/react-aspect-ratio";
6
- import { f as L } from "./tooltip-DVeqVwqV.js";
6
+ import { f as M } from "./tooltip-DVeqVwqV.js";
7
7
  import "@radix-ui/react-collapsible";
8
8
  import "./sheet-B_uq6-K_.js";
9
- import { XIcon as R, ChevronDownIcon as j, SearchIcon as D } from "lucide-react";
9
+ import { XIcon as O, ChevronDownIcon as P, SearchIcon as S } from "lucide-react";
10
10
  import "react-resizable-panels";
11
- import { c as z } from "./tailwind.helper-B6yFEsav.js";
11
+ import { c as I } from "./tailwind.helper-B6yFEsav.js";
12
12
  import "./select-BpjFWqAY.js";
13
13
  import "next-themes";
14
14
  import "sonner";
15
- const K = ({
16
- options: i,
17
- selected: n,
18
- onToggle: g,
15
+ const Z = ({
16
+ options: s,
17
+ selected: t,
18
+ onToggle: x,
19
19
  onClear: d,
20
20
  onSelectAll: u,
21
- placeholder: E = "Sélectionner...",
21
+ placeholder: R = "Sélectionner...",
22
22
  searchable: m = !1,
23
- searchPlaceholder: T = "Rechercher...",
24
- disabled: f = !1
23
+ searchPlaceholder: j = "Rechercher...",
24
+ disabled: f = !1,
25
+ maxCount: h
25
26
  }) => {
26
- const [c, h] = k(""), [a, b] = k(!1), p = w(null), v = w(null), o = N(() => c === "" ? i : i.filter((e) => e.label.toLowerCase().includes(c.toLowerCase())), [i, c]), x = N(() => o.length === 0 ? !1 : o.every((e) => n.includes(e.value)), [o, n]);
27
- y(() => {
27
+ const [c, p] = L(""), [a, N] = L(!1), g = z(null), k = z(null), o = v(() => c === "" ? s : s.filter((e) => e.label.toLowerCase().includes(c.toLowerCase())), [s, c]), w = v(() => o.length === 0 ? !1 : o.every((e) => t.includes(e.value)), [o, t]), b = v(() => t.map((e) => {
28
+ var n;
29
+ return ((n = s.find((i) => i.value === e)) == null ? void 0 : n.label) ?? e;
30
+ }), [s, t]), y = h !== void 0 && h > 0 ? b.slice(0, h) : b, C = b.length - y.length;
31
+ E(() => {
28
32
  a && m && requestAnimationFrame(() => {
29
33
  var e;
30
- (e = v.current) == null || e.focus();
34
+ (e = k.current) == null || e.focus();
31
35
  });
32
- }, [a, m]), y(() => {
36
+ }, [a, m]), E(() => {
33
37
  if (!a) return;
34
- const e = (t) => {
35
- p.current !== null && !p.current.contains(t.target) && (b(!1), h(""));
38
+ const e = (n) => {
39
+ g.current !== null && !g.current.contains(n.target) && (N(!1), p(""));
36
40
  };
37
41
  return document.addEventListener("mousedown", e), () => {
38
42
  document.removeEventListener("mousedown", e);
39
43
  };
40
44
  }, [a]);
41
- const I = () => {
42
- if (x) {
43
- const e = o.map((s) => s.value), t = n.filter((s) => !e.includes(s));
44
- u !== void 0 ? u(t) : d();
45
+ const D = () => {
46
+ if (w) {
47
+ const e = o.map((i) => i.value), n = t.filter((i) => !e.includes(i));
48
+ u !== void 0 ? u(n) : d();
45
49
  } else {
46
- const e = [...n];
47
- o.forEach((t) => {
48
- e.includes(t.value) || e.push(t.value);
49
- }), u !== void 0 ? u(e) : o.forEach((t) => {
50
- n.includes(t.value) || g(t.value);
50
+ const e = [...t];
51
+ o.forEach((n) => {
52
+ e.includes(n.value) || e.push(n.value);
53
+ }), u !== void 0 ? u(e) : o.forEach((n) => {
54
+ t.includes(n.value) || x(n.value);
51
55
  });
52
56
  }
53
57
  };
54
- return /* @__PURE__ */ l("div", { ref: p, className: "relative w-full", children: [
58
+ return /* @__PURE__ */ l("div", { ref: g, className: "relative w-full", children: [
55
59
  /* @__PURE__ */ l(
56
60
  "button",
57
61
  {
58
62
  type: "button",
59
63
  disabled: f,
60
64
  onClick: () => {
61
- f || b((e) => (e && h(""), !e));
65
+ f || N((e) => (e && p(""), !e));
62
66
  },
63
- className: z(L, "w-full", a && "ring-2 ring-ring ring-offset-2", n.length === 0 && "text-muted-foreground"),
67
+ className: I(M, "w-full", a && "ring-2 ring-ring ring-offset-2", t.length === 0 && "text-muted-foreground"),
64
68
  children: [
65
- /* @__PURE__ */ r("span", { className: "truncate", children: n.length === 0 ? E : n.map((e) => {
66
- var t;
67
- return ((t = i.find((s) => s.value === e)) == null ? void 0 : t.label) ?? e;
68
- }).join(", ") }),
69
+ /* @__PURE__ */ r("span", { className: "truncate", children: t.length === 0 ? R : y.join(", ") }),
69
70
  /* @__PURE__ */ l("div", { className: "flex shrink-0 items-center gap-1", children: [
70
- n.length > 0 && !f && /* @__PURE__ */ r(
71
+ C > 0 && /* @__PURE__ */ l("span", { className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground", children: [
72
+ "+",
73
+ C
74
+ ] }),
75
+ t.length > 0 && !f && /* @__PURE__ */ r(
71
76
  "span",
72
77
  {
73
78
  role: "button",
@@ -79,43 +84,43 @@ const K = ({
79
84
  e.preventDefault(), e.stopPropagation(), d();
80
85
  },
81
86
  className: "text-muted-foreground hover:text-foreground",
82
- children: /* @__PURE__ */ r(R, { className: "size-4" })
87
+ children: /* @__PURE__ */ r(O, { className: "size-4" })
83
88
  }
84
89
  ),
85
- /* @__PURE__ */ r(j, { className: z("size-4 opacity-50 shrink-0 transition-transform", a && "rotate-180") })
90
+ /* @__PURE__ */ r(P, { className: I("size-4 opacity-50 shrink-0 transition-transform", a && "rotate-180") })
86
91
  ] })
87
92
  ]
88
93
  }
89
94
  ),
90
95
  a ? /* @__PURE__ */ l("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: [
91
96
  m ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ l("div", { className: "relative", children: [
92
- /* @__PURE__ */ r(D, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
97
+ /* @__PURE__ */ r(S, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
93
98
  /* @__PURE__ */ r(
94
99
  "input",
95
100
  {
96
- ref: v,
101
+ ref: k,
97
102
  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",
98
- placeholder: T,
103
+ placeholder: j,
99
104
  value: c,
100
105
  onChange: (e) => {
101
- h(e.target.value);
106
+ p(e.target.value);
102
107
  }
103
108
  }
104
109
  )
105
110
  ] }) }) : null,
106
111
  /* @__PURE__ */ l("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: [
107
112
  o.length > 0 && /* @__PURE__ */ l("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
108
- /* @__PURE__ */ r(C, { checked: x, onCheckedChange: I }),
113
+ /* @__PURE__ */ r(T, { checked: w, onCheckedChange: D }),
109
114
  "Tout sélectionner"
110
115
  ] }),
111
116
  o.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
112
117
  o.map((e) => /* @__PURE__ */ l("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
113
118
  /* @__PURE__ */ r(
114
- C,
119
+ T,
115
120
  {
116
- checked: n.includes(e.value),
121
+ checked: t.includes(e.value),
117
122
  onCheckedChange: () => {
118
- g(e.value);
123
+ x(e.value);
119
124
  }
120
125
  }
121
126
  ),
@@ -123,7 +128,7 @@ const K = ({
123
128
  e.label
124
129
  ] }, e.value))
125
130
  ] }),
126
- n.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
131
+ t.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
127
132
  "button",
128
133
  {
129
134
  type: "button",
@@ -136,5 +141,5 @@ const K = ({
136
141
  ] });
137
142
  };
138
143
  export {
139
- K as M
144
+ Z as M
140
145
  };
@@ -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-DF7-91OW.js";
18
+ import { M as le } from "./MultiSelect-CqcbwKYV.js";
19
19
  const L = (a, n, c = {}) => {
20
20
  if (n instanceof Date)
21
21
  return n.toLocaleDateString("fr-FR");
@@ -1,4 +1,4 @@
1
- import { A as i, C as s, F as g } from "../../../ConfirmationDialog-Ht4e-1Lg.js";
1
+ import { A as i, C as s, F as g } from "../../../ConfirmationDialog-9CKgZoNY.js";
2
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";
3
3
  export {
4
4
  i as AppDialog,
@@ -1,4 +1,4 @@
1
- import { A as l, a as i, F as r, S as s, T as t } from "../../../TableFilter-Dbo7qkgR.js";
1
+ import { A as l, a as i, F as r, S as s, T as t } from "../../../TableFilter-CWDy_RHA.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-COQEdT9e.js";
1
+ import { G as o } from "../../../GenericForm-B39toMkE.js";
2
2
  export {
3
3
  o as GenericForm
4
4
  };
@@ -1,12 +1,12 @@
1
1
  import { D as r, M as o } from "../../MetricCard-CvQFjIOb.js";
2
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-Ht4e-1Lg.js";
3
+ import { A as m, C as d, F as g } from "../../ConfirmationDialog-9CKgZoNY.js";
4
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-Dbo7qkgR.js";
6
- import { G as M } from "../../GenericForm-COQEdT9e.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
7
  import { I as L } from "../../ImageInput-BoYUZx9H.js";
8
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-DF7-91OW.js";
9
+ import { M as j } from "../../MultiSelect-CqcbwKYV.js";
10
10
  import { A as w } from "../../AppActions-DEkRxBia.js";
11
11
  import { A as J, K as Q } from "../../KpiCardsLayout-mQ7AcbqA.js";
12
12
  import { A as W } from "../../AppSubTitle-ChCtQ7Sv.js";
@@ -10,7 +10,9 @@ interface MultiSelectProps {
10
10
  searchable?: boolean;
11
11
  searchPlaceholder?: string;
12
12
  disabled?: boolean;
13
+ /** Nombre de libellés affichés dans le trigger, le reste est résumé par un compteur `+N`. */
14
+ maxCount?: number;
13
15
  }
14
- export declare const MultiSelect: ({ options, selected, onToggle, onClear, onSelectAll, placeholder, searchable, searchPlaceholder, disabled, }: MultiSelectProps) => React.ReactElement;
16
+ export declare const MultiSelect: ({ options, selected, onToggle, onClear, onSelectAll, placeholder, searchable, searchPlaceholder, disabled, maxCount, }: MultiSelectProps) => React.ReactElement;
15
17
  export {};
16
18
  //# sourceMappingURL=MultiSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,8GAUzB,gBAAgB,KAAG,KAAK,CAAC,YAiK3B,CAAC"}
1
+ {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/core/inputs/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,GAAI,wHAWzB,gBAAgB,KAAG,KAAK,CAAC,YAyK3B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { I as r } from "../../../ImageInput-BoYUZx9H.js";
2
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-DF7-91OW.js";
3
+ import { M as l } from "../../../MultiSelect-CqcbwKYV.js";
4
4
  export {
5
5
  c as DatePicker,
6
6
  o as DateRangePicker,
@@ -1,12 +1,12 @@
1
1
  import { D as o, M as r } from "../MetricCard-CvQFjIOb.js";
2
2
  import { K as t, a as n, S as i, b as l } from "../SkeletonCards-BvJYF_LK.js";
3
- import { A as p, C as u, F as g } from "../ConfirmationDialog-Ht4e-1Lg.js";
3
+ import { A as p, C as u, F as g } from "../ConfirmationDialog-9CKgZoNY.js";
4
4
  import { A as C, j as m, k as T, l as S, m as c, n as D, o as M, p as x, q as A, r as I, s as P, t as h, u as f, v as w, w as v, x as F, B as L, y as B, z as G, C as H, E as R, F as k, G as N, H as y, I as E, J as O, K as V, L as K, M as z, N as U, O as j, Q as q, R as J, S as Q, T as W, U as X, V as Y, W as Z, X as _, Y as $, Z as aa, _ as ea, $ as oa, a0 as ra, a1 as sa, a2 as ta, a3 as na, a4 as ia, a5 as la, a6 as ba, a7 as pa, a8 as ua, a9 as ga, aa as da, ab as Ca, ac as ma, ad as Ta, ae as Sa, af as ca, ag as Da, ah as Ma, ai as xa, aj as Aa, ak as Ia, al as Pa, am as ha, an as fa, D as wa, a as va, b as Fa, c as La, d as Ba, e as Ga, f as Ha, g as Ra, h as ka, i as Na, ao as ya, ap as Ea, aq as Oa, ar as Va, as as Ka, at as za, au as Ua, av as ja, aw as qa, ax as Ja, ay as Qa, az as Wa, aA as Xa, aB as Ya, aC as Za, aD as _a, aE as $a, aF as ae, aG as ee, aH as oe, aI as re, aJ as se, aK as te, aL as ne, aM as ie, aN as le, aO as be, aP as pe, aQ as ue, aR as ge, aS as de, aT as Ce, aU as me, aV as Te, aW as Se, aX as ce, aY as De, aZ as Me, a_ as xe, a$ as Ae, b0 as Ie, b1 as Pe, b2 as he, b3 as fe, b4 as we, b5 as ve, b6 as Fe, b7 as Le, b8 as Be, b9 as Ge, ba as He, bb as Re, bc as ke, bd as Ne, be as ye, bf as Ee, bg as Oe, bh as Ve, bi as Ke, bj as ze, bk as Ue, bl as je, bm as qe, bn as Je, bo as Qe, bp as We, bq as Xe, br as Ye, bs as Ze, bt as _e, bu as $e, bv as ao, bw as eo, bx as oo, P as ro, by as so, bz as to, bA as no, bB as io, bC as lo, bD as bo, bE as po, bF as uo, bG as go, bH as Co, bI as mo, bJ as To, bK as So, bL as co, bM as Do, bN as Mo, bO as xo, bP as Ao, bQ as Io, bR as Po, bS as ho, bT as fo, bU as wo, bV as vo, bW as Fo, bX as Lo, bY as Bo, bZ as Go, b_ as Ho, b$ as Ro, c0 as ko, c1 as No, c2 as yo, c3 as Eo } from "../toggle-group-D6c-gM1D.js";
5
- import { A as Vo, a as Ko, F as zo, S as Uo, T as jo } from "../TableFilter-Dbo7qkgR.js";
6
- import { G as Jo } from "../GenericForm-COQEdT9e.js";
5
+ import { A as Vo, a as Ko, F as zo, S as Uo, T as jo } from "../TableFilter-CWDy_RHA.js";
6
+ import { G as Jo } from "../GenericForm-B39toMkE.js";
7
7
  import { I as Wo } from "../ImageInput-BoYUZx9H.js";
8
8
  import { D as Yo, a as Zo, S as _o, b as $o } from "../SearchInput-ClZbbRWg.js";
9
- import { M as er } from "../MultiSelect-DF7-91OW.js";
9
+ import { M as er } from "../MultiSelect-CqcbwKYV.js";
10
10
  import { A as rr } from "../AppActions-DEkRxBia.js";
11
11
  import { A as tr, K as nr } from "../KpiCardsLayout-mQ7AcbqA.js";
12
12
  import { A as lr } from "../AppSubTitle-ChCtQ7Sv.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.180",
3
+ "version": "0.0.181",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {