@krosoft/react 0.0.77 → 0.0.79

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