@krosoft/react 0.0.102 → 0.0.104

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 (52) hide show
  1. package/dist/{AppSubTitle-DBxJVB46.js → AppSubTitle-Cr3zbmee.js} +1 -1
  2. package/dist/{AppTitle-DDQoaHBb.js → AppTitle-eazxzYGa.js} +1 -1
  3. package/dist/{AppVerticalTabs-CYx0jMXp.js → AppVerticalTabs-ujb4jtNi.js} +2 -2
  4. package/dist/ConfirmationDialog-B41OAAmc.js +257 -0
  5. package/dist/{DataTable-CtzBzpP-.js → DataTable-jrFyuw67.js} +1 -1
  6. package/dist/GenericForm-D3Gxh9kf.js +11365 -0
  7. package/dist/{ImageInput-DVMsk_kn.js → ImageInput-BcGHoduc.js} +1 -1
  8. package/dist/{MetricCard-CFwSSiQY.js → MetricCard-CXDB0msa.js} +1 -1
  9. package/dist/MultiSelect-Bc0Re1XN.js +137 -0
  10. package/dist/SearchInput-DFrIqONH.js +586 -0
  11. package/dist/{TableFilter-DGFQNbZ_.js → TableFilter-CK8NyawM.js} +27 -26
  12. package/dist/components/core/cards/index.js +1 -1
  13. package/dist/components/core/dialogs/FormDialog.d.ts +6 -18
  14. package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
  15. package/dist/components/core/dialogs/index.d.ts +1 -1
  16. package/dist/components/core/dialogs/index.d.ts.map +1 -1
  17. package/dist/components/core/dialogs/index.js +2 -2
  18. package/dist/components/core/filters/index.js +1 -1
  19. package/dist/components/core/forms/GenericForm.d.ts +57 -0
  20. package/dist/components/core/forms/GenericForm.d.ts.map +1 -0
  21. package/dist/components/core/forms/index.d.ts +2 -0
  22. package/dist/components/core/forms/index.d.ts.map +1 -0
  23. package/dist/components/core/forms/index.js +4 -0
  24. package/dist/components/core/index.d.ts +1 -0
  25. package/dist/components/core/index.d.ts.map +1 -1
  26. package/dist/components/core/index.js +48 -45
  27. package/dist/components/core/inputs/MultiSelect.d.ts +2 -1
  28. package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
  29. package/dist/components/core/inputs/index.js +8 -7
  30. package/dist/components/core/layouts/index.js +2 -2
  31. package/dist/components/core/table/index.js +1 -1
  32. package/dist/components/core/tabs/index.js +1 -1
  33. package/dist/components/index.js +100 -97
  34. package/dist/components/ui/index.js +2 -2
  35. package/dist/{toaster-BTQcWjuV.js → toaster-CtADevTu.js} +1 -1
  36. package/dist/{toggle-group-6CH5BRLO.js → toggle-group-Cnfwf4uy.js} +8376 -7317
  37. package/dist/types/forms/FieldType.d.ts +2 -0
  38. package/dist/types/forms/FieldType.d.ts.map +1 -0
  39. package/dist/types/forms/FormField.d.ts +40 -0
  40. package/dist/types/forms/FormField.d.ts.map +1 -0
  41. package/dist/types/forms/FormSchema.d.ts +6 -0
  42. package/dist/types/forms/FormSchema.d.ts.map +1 -0
  43. package/dist/types/forms/FormSection.d.ts +12 -0
  44. package/dist/types/forms/FormSection.d.ts.map +1 -0
  45. package/dist/types/forms/index.d.ts +5 -0
  46. package/dist/types/forms/index.d.ts.map +1 -0
  47. package/dist/types/forms/index.js +1 -0
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/package.json +8 -6
  51. package/dist/ConfirmationDialog-bBFPpP2z.js +0 -322
  52. package/dist/SearchInput-CsZcpaxL.js +0 -710
@@ -1,710 +0,0 @@
1
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import * as L from "react";
3
- import { useState as C, useRef as P, useEffect as j, useMemo as W } from "react";
4
- import { cm as E, cn as M, co as N, cp as F, cq as T, H as A, bv as X, bx as V, bw as _, ce as J, _ as R, aW as I } from "./toggle-group-6CH5BRLO.js";
5
- import "./alert-srKINZRG.js";
6
- import { c as v } from "./tailwind.helper-gWiv5-6R.js";
7
- import { B as w, C as H } from "./tooltip-mWS3Mix6.js";
8
- import { X as S, C as Q } from "./select-CDIMkakd.js";
9
- import "next-themes";
10
- import { c as Y } from "./index-BSI9LuBZ.js";
11
- /**
12
- * @license lucide-react v1.16.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */
17
- const $ = [
18
- ["path", { d: "M8 2v4", key: "1cmpym" }],
19
- ["path", { d: "M16 2v4", key: "4m81vk" }],
20
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
21
- ["path", { d: "M3 10h18", key: "8toen8" }]
22
- ], q = Y("calendar", $), B = {
23
- lessThanXSeconds: {
24
- one: "moins d’une seconde",
25
- other: "moins de {{count}} secondes"
26
- },
27
- xSeconds: {
28
- one: "1 seconde",
29
- other: "{{count}} secondes"
30
- },
31
- halfAMinute: "30 secondes",
32
- lessThanXMinutes: {
33
- one: "moins d’une minute",
34
- other: "moins de {{count}} minutes"
35
- },
36
- xMinutes: {
37
- one: "1 minute",
38
- other: "{{count}} minutes"
39
- },
40
- aboutXHours: {
41
- one: "environ 1 heure",
42
- other: "environ {{count}} heures"
43
- },
44
- xHours: {
45
- one: "1 heure",
46
- other: "{{count}} heures"
47
- },
48
- xDays: {
49
- one: "1 jour",
50
- other: "{{count}} jours"
51
- },
52
- aboutXWeeks: {
53
- one: "environ 1 semaine",
54
- other: "environ {{count}} semaines"
55
- },
56
- xWeeks: {
57
- one: "1 semaine",
58
- other: "{{count}} semaines"
59
- },
60
- aboutXMonths: {
61
- one: "environ 1 mois",
62
- other: "environ {{count}} mois"
63
- },
64
- xMonths: {
65
- one: "1 mois",
66
- other: "{{count}} mois"
67
- },
68
- aboutXYears: {
69
- one: "environ 1 an",
70
- other: "environ {{count}} ans"
71
- },
72
- xYears: {
73
- one: "1 an",
74
- other: "{{count}} ans"
75
- },
76
- overXYears: {
77
- one: "plus d’un an",
78
- other: "plus de {{count}} ans"
79
- },
80
- almostXYears: {
81
- one: "presqu’un an",
82
- other: "presque {{count}} ans"
83
- }
84
- }, K = (e, t, l) => {
85
- let a;
86
- const i = B[e];
87
- return typeof i == "string" ? a = i : t === 1 ? a = i.one : a = i.other.replace("{{count}}", String(t)), l != null && l.addSuffix ? l.comparison && l.comparison > 0 ? "dans " + a : "il y a " + a : a;
88
- }, G = {
89
- full: "EEEE d MMMM y",
90
- long: "d MMMM y",
91
- medium: "d MMM y",
92
- short: "dd/MM/y"
93
- }, U = {
94
- full: "HH:mm:ss zzzz",
95
- long: "HH:mm:ss z",
96
- medium: "HH:mm:ss",
97
- short: "HH:mm"
98
- }, Z = {
99
- full: "{{date}} 'à' {{time}}",
100
- long: "{{date}} 'à' {{time}}",
101
- medium: "{{date}}, {{time}}",
102
- short: "{{date}}, {{time}}"
103
- }, ee = {
104
- date: E({
105
- formats: G,
106
- defaultWidth: "full"
107
- }),
108
- time: E({
109
- formats: U,
110
- defaultWidth: "full"
111
- }),
112
- dateTime: E({
113
- formats: Z,
114
- defaultWidth: "full"
115
- })
116
- }, te = {
117
- lastWeek: "eeee 'dernier à' p",
118
- yesterday: "'hier à' p",
119
- today: "'aujourd’hui à' p",
120
- tomorrow: "'demain à' p'",
121
- nextWeek: "eeee 'prochain à' p",
122
- other: "P"
123
- }, re = (e, t, l, a) => te[e], ne = {
124
- narrow: ["av. J.-C", "ap. J.-C"],
125
- abbreviated: ["av. J.-C", "ap. J.-C"],
126
- wide: ["avant Jésus-Christ", "après Jésus-Christ"]
127
- }, ae = {
128
- narrow: ["T1", "T2", "T3", "T4"],
129
- abbreviated: ["1er trim.", "2ème trim.", "3ème trim.", "4ème trim."],
130
- wide: ["1er trimestre", "2ème trimestre", "3ème trimestre", "4ème trimestre"]
131
- }, oe = {
132
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
133
- abbreviated: [
134
- "janv.",
135
- "févr.",
136
- "mars",
137
- "avr.",
138
- "mai",
139
- "juin",
140
- "juil.",
141
- "août",
142
- "sept.",
143
- "oct.",
144
- "nov.",
145
- "déc."
146
- ],
147
- wide: [
148
- "janvier",
149
- "février",
150
- "mars",
151
- "avril",
152
- "mai",
153
- "juin",
154
- "juillet",
155
- "août",
156
- "septembre",
157
- "octobre",
158
- "novembre",
159
- "décembre"
160
- ]
161
- }, ie = {
162
- narrow: ["D", "L", "M", "M", "J", "V", "S"],
163
- short: ["di", "lu", "ma", "me", "je", "ve", "sa"],
164
- abbreviated: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
165
- wide: [
166
- "dimanche",
167
- "lundi",
168
- "mardi",
169
- "mercredi",
170
- "jeudi",
171
- "vendredi",
172
- "samedi"
173
- ]
174
- }, se = {
175
- narrow: {
176
- am: "AM",
177
- pm: "PM",
178
- midnight: "minuit",
179
- noon: "midi",
180
- morning: "mat.",
181
- afternoon: "ap.m.",
182
- evening: "soir",
183
- night: "mat."
184
- },
185
- abbreviated: {
186
- am: "AM",
187
- pm: "PM",
188
- midnight: "minuit",
189
- noon: "midi",
190
- morning: "matin",
191
- afternoon: "après-midi",
192
- evening: "soir",
193
- night: "matin"
194
- },
195
- wide: {
196
- am: "AM",
197
- pm: "PM",
198
- midnight: "minuit",
199
- noon: "midi",
200
- morning: "du matin",
201
- afternoon: "de l’après-midi",
202
- evening: "du soir",
203
- night: "du matin"
204
- }
205
- }, le = (e, t) => {
206
- const l = Number(e), a = t == null ? void 0 : t.unit;
207
- if (l === 0) return "0";
208
- const i = ["year", "week", "hour", "minute", "second"];
209
- let u;
210
- return l === 1 ? u = a && i.includes(a) ? "ère" : "er" : u = "ème", l + u;
211
- }, de = ["MMM", "MMMM"], ce = {
212
- preprocessor: (e, t) => e.getDate() === 1 || !t.some(
213
- (a) => a.isToken && de.includes(a.value)
214
- ) ? t : t.map(
215
- (a) => a.isToken && a.value === "do" ? { isToken: !0, value: "d" } : a
216
- ),
217
- ordinalNumber: le,
218
- era: M({
219
- values: ne,
220
- defaultWidth: "wide"
221
- }),
222
- quarter: M({
223
- values: ae,
224
- defaultWidth: "wide",
225
- argumentCallback: (e) => e - 1
226
- }),
227
- month: M({
228
- values: oe,
229
- defaultWidth: "wide"
230
- }),
231
- day: M({
232
- values: ie,
233
- defaultWidth: "wide"
234
- }),
235
- dayPeriod: M({
236
- values: se,
237
- defaultWidth: "wide"
238
- })
239
- }, ue = /^(\d+)(ième|ère|ème|er|e)?/i, me = /\d+/i, fe = {
240
- narrow: /^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,
241
- abbreviated: /^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,
242
- wide: /^(avant Jésus-Christ|après Jésus-Christ)/i
243
- }, he = {
244
- any: [/^av/i, /^ap/i]
245
- }, pe = {
246
- narrow: /^T?[1234]/i,
247
- abbreviated: /^[1234](er|ème|e)? trim\.?/i,
248
- wide: /^[1234](er|ème|e)? trimestre/i
249
- }, be = {
250
- any: [/1/i, /2/i, /3/i, /4/i]
251
- }, ge = {
252
- narrow: /^[jfmasond]/i,
253
- abbreviated: /^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,
254
- wide: /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i
255
- }, ve = {
256
- narrow: [
257
- /^j/i,
258
- /^f/i,
259
- /^m/i,
260
- /^a/i,
261
- /^m/i,
262
- /^j/i,
263
- /^j/i,
264
- /^a/i,
265
- /^s/i,
266
- /^o/i,
267
- /^n/i,
268
- /^d/i
269
- ],
270
- any: [
271
- /^ja/i,
272
- /^f/i,
273
- /^mar/i,
274
- /^av/i,
275
- /^ma/i,
276
- /^juin/i,
277
- /^juil/i,
278
- /^ao/i,
279
- /^s/i,
280
- /^o/i,
281
- /^n/i,
282
- /^d/i
283
- ]
284
- }, ye = {
285
- narrow: /^[lmjvsd]/i,
286
- short: /^(di|lu|ma|me|je|ve|sa)/i,
287
- abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,
288
- wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i
289
- }, xe = {
290
- narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
291
- any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]
292
- }, we = {
293
- narrow: /^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,
294
- any: /^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i
295
- }, ke = {
296
- any: {
297
- am: /^a/i,
298
- pm: /^p/i,
299
- midnight: /^min/i,
300
- noon: /^mid/i,
301
- morning: /mat/i,
302
- afternoon: /ap/i,
303
- evening: /soir/i,
304
- night: /nuit/i
305
- }
306
- }, Me = {
307
- ordinalNumber: F({
308
- matchPattern: ue,
309
- parsePattern: me,
310
- valueCallback: (e) => parseInt(e)
311
- }),
312
- era: N({
313
- matchPatterns: fe,
314
- defaultMatchWidth: "wide",
315
- parsePatterns: he,
316
- defaultParseWidth: "any"
317
- }),
318
- quarter: N({
319
- matchPatterns: pe,
320
- defaultMatchWidth: "wide",
321
- parsePatterns: be,
322
- defaultParseWidth: "any",
323
- valueCallback: (e) => e + 1
324
- }),
325
- month: N({
326
- matchPatterns: ge,
327
- defaultMatchWidth: "wide",
328
- parsePatterns: ve,
329
- defaultParseWidth: "any"
330
- }),
331
- day: N({
332
- matchPatterns: ye,
333
- defaultMatchWidth: "wide",
334
- parsePatterns: xe,
335
- defaultParseWidth: "any"
336
- }),
337
- dayPeriod: N({
338
- matchPatterns: we,
339
- defaultMatchWidth: "any",
340
- parsePatterns: ke,
341
- defaultParseWidth: "any"
342
- })
343
- }, D = {
344
- code: "fr",
345
- formatDistance: K,
346
- formatLong: ee,
347
- formatRelative: re,
348
- localize: ce,
349
- match: Me,
350
- options: {
351
- weekStartsOn: 1,
352
- firstWeekContainsDate: 4
353
- }
354
- }, Le = ({ date: e, onDateChange: t, placeholder: l }) => {
355
- const [a, i] = C(!1), u = P(null);
356
- j(() => {
357
- if (!a) return;
358
- const d = (c) => {
359
- u.current !== null && !u.current.contains(c.target) && i(!1);
360
- };
361
- return document.addEventListener("mousedown", d), () => {
362
- document.removeEventListener("mousedown", d);
363
- };
364
- }, [a]);
365
- const m = () => {
366
- i((d) => !d);
367
- }, h = (d) => {
368
- t(d), i(!1);
369
- };
370
- return /* @__PURE__ */ s("div", { ref: u, className: "relative w-full", children: [
371
- /* @__PURE__ */ s(
372
- w,
373
- {
374
- variant: "outline",
375
- type: "button",
376
- onClick: m,
377
- className: v(
378
- "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
379
- a && "ring-2 ring-ring ring-offset-2",
380
- e === void 0 && "text-muted-foreground"
381
- ),
382
- children: [
383
- /* @__PURE__ */ r(q, { className: "mr-2 size-4 shrink-0" }),
384
- e !== void 0 ? T(e, "dd/MM/yyyy", { locale: D }) : /* @__PURE__ */ r("span", { children: l })
385
- ]
386
- }
387
- ),
388
- a ? /* @__PURE__ */ r("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ r(A, { mode: "single", selected: e, onSelect: h }) }) : null
389
- ] });
390
- }, Ee = ({ value: e, onChange: t, placeholder: l = "Selectionner une periode", className: a }) => {
391
- const [i, u] = L.useState(!1), [m, h] = L.useState(e);
392
- L.useEffect(() => {
393
- i && h(e);
394
- }, [i, e]);
395
- const d = (f) => {
396
- f.stopPropagation(), t(void 0), u(!1);
397
- }, c = () => {
398
- t(m), u(!1);
399
- }, p = () => {
400
- h(e), u(!1);
401
- }, y = () => {
402
- h(void 0);
403
- }, x = (f) => f != null && f.from ? !f.to || f.from.getTime() === f.to.getTime() ? T(f.from, "dd MMM yyyy", { locale: D }) : `${T(f.from, "dd MMM yyyy", { locale: D })} - ${T(f.to, "dd MMM yyyy", { locale: D })}` : l;
404
- return /* @__PURE__ */ r("div", { className: v("grid gap-2", a), children: /* @__PURE__ */ s(X, { open: i, onOpenChange: u, children: [
405
- /* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ s(w, { id: "date", variant: "outline", className: v("w-[300px] justify-start text-left font-normal", !(e != null && e.from) && "text-muted-foreground"), children: [
406
- /* @__PURE__ */ r(q, { className: "mr-2 size-4" }),
407
- x(e),
408
- (e == null ? void 0 : e.from) && /* @__PURE__ */ r(
409
- w,
410
- {
411
- type: "button",
412
- variant: "ghost",
413
- size: "icon",
414
- "aria-label": "Effacer la periode selectionnee",
415
- className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
416
- onClick: d,
417
- children: /* @__PURE__ */ r(S, { className: "size-4" })
418
- }
419
- )
420
- ] }) }),
421
- /* @__PURE__ */ s(_, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
422
- /* @__PURE__ */ r(
423
- A,
424
- {
425
- mode: "range",
426
- defaultMonth: m == null ? void 0 : m.from,
427
- selected: m,
428
- onSelect: h,
429
- numberOfMonths: 2,
430
- weekStartsOn: 1,
431
- className: "pointer-events-auto p-3"
432
- }
433
- ),
434
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
435
- /* @__PURE__ */ r(w, { variant: "ghost", size: "sm", onClick: y, children: "Effacer" }),
436
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
437
- /* @__PURE__ */ r(w, { variant: "ghost", size: "sm", onClick: p, children: "Annuler" }),
438
- /* @__PURE__ */ r(w, { size: "sm", onClick: c, children: "Appliquer" })
439
- ] })
440
- ] })
441
- ] })
442
- ] }) });
443
- }, Je = ({
444
- options: e,
445
- selected: t,
446
- onToggle: l,
447
- onClear: a,
448
- onSelectAll: i,
449
- placeholder: u = "Sélectionner...",
450
- searchable: m = !1,
451
- searchPlaceholder: h = "Rechercher..."
452
- }) => {
453
- const [d, c] = C(""), [p, y] = C(!1), x = P(null), f = P(null), g = W(() => d === "" ? e : e.filter((n) => n.label.toLowerCase().includes(d.toLowerCase())), [e, d]), z = W(() => g.length === 0 ? !1 : g.every((n) => t.includes(n.value)), [g, t]);
454
- j(() => {
455
- p && m && requestAnimationFrame(() => {
456
- var n;
457
- (n = f.current) == null || n.focus();
458
- });
459
- }, [p, m]), j(() => {
460
- if (!p) return;
461
- const n = (b) => {
462
- x.current !== null && !x.current.contains(b.target) && (y(!1), c(""));
463
- };
464
- return document.addEventListener("mousedown", n), () => {
465
- document.removeEventListener("mousedown", n);
466
- };
467
- }, [p]);
468
- const O = () => {
469
- if (z) {
470
- const n = g.map((k) => k.value), b = t.filter((k) => !n.includes(k));
471
- i !== void 0 ? i(b) : a();
472
- } else {
473
- const n = [...t];
474
- g.forEach((b) => {
475
- n.includes(b.value) || n.push(b.value);
476
- }), i !== void 0 ? i(n) : g.forEach((b) => {
477
- t.includes(b.value) || l(b.value);
478
- });
479
- }
480
- };
481
- return /* @__PURE__ */ s("div", { ref: x, className: "relative w-full", children: [
482
- /* @__PURE__ */ s(
483
- "button",
484
- {
485
- type: "button",
486
- onClick: () => {
487
- y((n) => (n && c(""), !n));
488
- },
489
- className: v(
490
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
491
- p && "ring-2 ring-ring ring-offset-2",
492
- t.length === 0 && "text-muted-foreground"
493
- ),
494
- children: [
495
- /* @__PURE__ */ r("span", { className: "truncate", children: t.length === 0 ? u : t.map((n) => {
496
- var b;
497
- return ((b = e.find((k) => k.value === n)) == null ? void 0 : b.label) ?? n;
498
- }).join(", ") }),
499
- /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-1", children: [
500
- t.length > 0 && /* @__PURE__ */ r(
501
- "span",
502
- {
503
- role: "button",
504
- tabIndex: -1,
505
- onClick: (n) => {
506
- n.stopPropagation();
507
- },
508
- onPointerDown: (n) => {
509
- n.preventDefault(), n.stopPropagation(), a();
510
- },
511
- className: "text-muted-foreground hover:text-foreground",
512
- children: /* @__PURE__ */ r(S, { className: "size-4" })
513
- }
514
- ),
515
- /* @__PURE__ */ r(H, { className: v("size-4 opacity-50 shrink-0 transition-transform", p && "rotate-180") })
516
- ] })
517
- ]
518
- }
519
- ),
520
- p ? /* @__PURE__ */ s("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
521
- m ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ s("div", { className: "relative", children: [
522
- /* @__PURE__ */ r(J, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
523
- /* @__PURE__ */ r(
524
- "input",
525
- {
526
- ref: f,
527
- className: "w-full rounded-md 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",
528
- placeholder: h,
529
- value: d,
530
- onChange: (n) => {
531
- c(n.target.value);
532
- }
533
- }
534
- )
535
- ] }) }) : null,
536
- /* @__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: [
537
- g.length > 0 && /* @__PURE__ */ s("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
538
- /* @__PURE__ */ r(R, { checked: z, onCheckedChange: O }),
539
- "Tout sélectionner"
540
- ] }),
541
- g.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
542
- g.map((n) => /* @__PURE__ */ s("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
543
- /* @__PURE__ */ r(
544
- R,
545
- {
546
- checked: t.includes(n.value),
547
- onCheckedChange: () => {
548
- l(n.value);
549
- }
550
- }
551
- ),
552
- n.label
553
- ] }, n.value))
554
- ] }),
555
- t.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
556
- "button",
557
- {
558
- type: "button",
559
- onClick: a,
560
- className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
561
- children: "Tout désélectionner"
562
- }
563
- ) })
564
- ] }) : null
565
- ] });
566
- }, Oe = ({
567
- options: e = [],
568
- value: t,
569
- onChange: l,
570
- onClear: a,
571
- placeholder: i = "Sélectionner...",
572
- searchPlaceholder: u = "Rechercher...",
573
- disabled: m = !1
574
- }) => {
575
- const [h, d] = C(""), [c, p] = C(!1), y = P(null), x = P(null), f = W(() => h === "" ? e : e.filter((o) => o.label.toLowerCase().includes(h.toLowerCase())), [e, h]), g = W(() => {
576
- var o;
577
- if (!(t === void 0 || t === ""))
578
- return ((o = e.find((n) => n.value === t)) == null ? void 0 : o.label) ?? t;
579
- }, [e, t]);
580
- j(() => {
581
- c && requestAnimationFrame(() => {
582
- var o;
583
- (o = x.current) == null || o.focus();
584
- });
585
- }, [c]), j(() => {
586
- if (!c) return;
587
- const o = (n) => {
588
- y.current !== null && !y.current.contains(n.target) && (p(!1), d(""));
589
- };
590
- return document.addEventListener("mousedown", o), () => {
591
- document.removeEventListener("mousedown", o);
592
- };
593
- }, [c]);
594
- const z = (o) => {
595
- l(o), p(!1), d("");
596
- };
597
- return /* @__PURE__ */ s("div", { ref: y, className: "relative w-full", children: [
598
- /* @__PURE__ */ s(
599
- "button",
600
- {
601
- type: "button",
602
- onClick: () => {
603
- m || p((o) => (o && d(""), !o));
604
- },
605
- disabled: m,
606
- className: v(
607
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
608
- c && "ring-2 ring-ring ring-offset-2",
609
- (t === void 0 || t === "") && "text-muted-foreground"
610
- ),
611
- children: [
612
- /* @__PURE__ */ r("span", { className: "truncate", children: g ?? i }),
613
- /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
614
- a && t !== void 0 && t !== "" && !m && /* @__PURE__ */ r(
615
- "span",
616
- {
617
- role: "button",
618
- tabIndex: -1,
619
- onClick: (o) => {
620
- o.stopPropagation();
621
- },
622
- onPointerDown: (o) => {
623
- o.preventDefault(), o.stopPropagation(), a();
624
- },
625
- className: "text-muted-foreground hover:text-foreground",
626
- children: /* @__PURE__ */ r(S, { className: "size-4" })
627
- }
628
- ),
629
- /* @__PURE__ */ r(H, { className: v("size-4 opacity-50 shrink-0 transition-transform", c && "rotate-180") })
630
- ] })
631
- ]
632
- }
633
- ),
634
- c ? /* @__PURE__ */ s("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
635
- /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ s("div", { className: "relative", children: [
636
- /* @__PURE__ */ r(J, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
637
- /* @__PURE__ */ r(
638
- "input",
639
- {
640
- ref: x,
641
- className: "w-full rounded-md 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",
642
- placeholder: u,
643
- value: h,
644
- onChange: (o) => {
645
- d(o.target.value);
646
- }
647
- }
648
- )
649
- ] }) }),
650
- /* @__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: [
651
- f.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
652
- f.map((o) => /* @__PURE__ */ s(
653
- "button",
654
- {
655
- type: "button",
656
- onClick: () => {
657
- z(o.value);
658
- },
659
- className: v(
660
- "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",
661
- t === o.value && "bg-muted font-medium"
662
- ),
663
- children: [
664
- /* @__PURE__ */ r(Q, { className: v("size-3.5 shrink-0", t === o.value ? "opacity-100" : "opacity-0") }),
665
- o.label
666
- ]
667
- },
668
- o.value
669
- ))
670
- ] })
671
- ] }) : null
672
- ] });
673
- }, Re = ({
674
- searchQuery: e,
675
- search: t,
676
- placeholder: l = "Rechercher...",
677
- onSearch: a,
678
- onSubmit: i,
679
- onClear: u,
680
- className: m
681
- }) => {
682
- const h = e ?? t ?? "", d = () => {
683
- a(""), u !== void 0 && u();
684
- };
685
- return /* @__PURE__ */ s("div", { className: v("relative h-fit w-full md:w-64", m), children: [
686
- /* @__PURE__ */ r(J, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
687
- /* @__PURE__ */ r(
688
- I,
689
- {
690
- placeholder: l,
691
- value: h,
692
- onChange: (c) => {
693
- a(c.target.value);
694
- },
695
- className: "pl-8",
696
- onKeyDown: (c) => {
697
- c.key === "Enter" && i !== void 0 && (c.preventDefault(), i());
698
- }
699
- }
700
- ),
701
- h !== "" ? /* @__PURE__ */ r("button", { onClick: d, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ r(S, { className: "size-4" }) }) : null
702
- ] });
703
- };
704
- export {
705
- Le as D,
706
- Je as M,
707
- Re as S,
708
- Ee as a,
709
- Oe as b
710
- };