@krosoft/react 0.0.124 → 0.0.126

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 (62) hide show
  1. package/dist/{AppActions-po4LjUcM.js → AppActions-BbAnhStS.js} +22 -18
  2. package/dist/{AppSubTitle-CWrsJYFJ.js → AppSubTitle-lg3d5NWc.js} +1 -1
  3. package/dist/{AppTitle-CDxWr_0y.js → AppTitle-uboDuil4.js} +1 -1
  4. package/dist/{AppVerticalTabs-CdqoObXx.js → AppVerticalTabs-CBijkDF_.js} +33 -49
  5. package/dist/ConfirmationDialog-Co5yl0yA.js +184 -0
  6. package/dist/{DataTable-CrJoeR_0.js → DataTable-DSIgTHZS.js} +174 -218
  7. package/dist/ErrorAlert-DH1onuyt.js +17 -0
  8. package/dist/GenericForm-QoeireeW.js +339 -0
  9. package/dist/ImageInput-DLTYJMwr.js +65 -0
  10. package/dist/KpiCardsLayout-C3LmSeL1.js +22 -0
  11. package/dist/{LoadingState-PhGi7HXH.js → LoadingState-BN0YaPSs.js} +3 -3
  12. package/dist/{MetricCard-C-ewNR_i.js → MetricCard-CPw-fiNS.js} +6 -6
  13. package/dist/{MultiSelect-BoisW4Kn.js → MultiSelect-CX051kfk.js} +32 -27
  14. package/dist/SearchInput-D6LmcOjp.js +249 -0
  15. package/dist/SkeletonCards-BIEnyOuZ.js +62 -0
  16. package/dist/{TableFilter-CLjQU36k.js → TableFilter-Wh_Womy4.js} +114 -123
  17. package/dist/{ThemeSelector--w3R6Ff3.js → ThemeSelector-Qv8QBlYq.js} +2 -2
  18. package/dist/{Topbar-DFu_OdSs.js → Topbar-DVww-tU8.js} +49 -59
  19. package/dist/{alert-B34E_4uH.js → alert-B78CiTYe.js} +2 -2
  20. package/dist/components/core/cards/index.js +2 -2
  21. package/dist/components/core/dialogs/index.js +2 -2
  22. package/dist/components/core/filters/index.js +1 -1
  23. package/dist/components/core/forms/index.js +1 -1
  24. package/dist/components/core/index.js +19 -19
  25. package/dist/components/core/inputs/index.js +3 -3
  26. package/dist/components/core/layouts/index.js +4 -4
  27. package/dist/components/core/navbar/index.js +1 -1
  28. package/dist/components/core/states/index.js +2 -2
  29. package/dist/components/core/table/index.js +1 -1
  30. package/dist/components/core/tabs/index.js +1 -1
  31. package/dist/components/core/theme/index.js +1 -1
  32. package/dist/components/index.js +270 -270
  33. package/dist/components/ui/index.js +213 -213
  34. package/dist/helpers/index.js +1 -1
  35. package/dist/hooks/behavior/index.js +1 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/select-MWzbMBAS.js +106 -0
  38. package/dist/tailwind.helper-B6yFEsav.js +8 -0
  39. package/dist/toaster-DTC8Duvh.js +75 -0
  40. package/dist/toggle-group-CSdAiS44.js +1694 -0
  41. package/dist/tooltip-BWyFpIxo.js +56 -0
  42. package/dist/useConfirmDeleteDialog-CiBQmRxg.js +65 -0
  43. package/package.json +4 -4
  44. package/dist/ConfirmationDialog-CkMyyh_3.js +0 -221
  45. package/dist/ErrorAlert-C6BbHHRZ.js +0 -33
  46. package/dist/GenericForm-CmwqEXiQ.js +0 -11410
  47. package/dist/ImageInput-C8HcxE8t.js +0 -82
  48. package/dist/KpiCardsLayout-CETMpB7A.js +0 -15
  49. package/dist/SearchInput-DJ_F3emq.js +0 -586
  50. package/dist/SkeletonCards-C5lXTSrB.js +0 -57
  51. package/dist/badge-CfWlt79h.js +0 -26
  52. package/dist/createLucideIcon-MP_wDWjs.js +0 -116
  53. package/dist/ellipsis-vertical-kB5yFb-i.js +0 -15
  54. package/dist/grip-vertical-DGywJXzS.js +0 -18
  55. package/dist/index-Be16PP7H.js +0 -34
  56. package/dist/loader-circle-CKy7u7JW.js +0 -11
  57. package/dist/select-DlQvLtI3.js +0 -1763
  58. package/dist/tailwind.helper-gWiv5-6R.js +0 -2278
  59. package/dist/toaster-CKoOjjKr.js +0 -134
  60. package/dist/toggle-group-wIgXZYDq.js +0 -29086
  61. package/dist/tooltip-YhBPXbcJ.js +0 -2477
  62. package/dist/useConfirmDeleteDialog-BOb3XFpz.js +0 -75
@@ -1,82 +0,0 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import "./toggle-group-wIgXZYDq.js";
3
- import "./alert-B34E_4uH.js";
4
- import { c as u } from "./tailwind.helper-gWiv5-6R.js";
5
- import { B as v } from "./tooltip-YhBPXbcJ.js";
6
- import { X as y } from "./select-DlQvLtI3.js";
7
- import "next-themes";
8
- import { forwardRef as N, useRef as w } from "react";
9
- import { u as j } from "./useNotifications-zbUhCvF_.js";
10
- import { c as p } from "./createLucideIcon-MP_wDWjs.js";
11
- /**
12
- * @license lucide-react v1.17.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 k = [
18
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
19
- ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
20
- ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
21
- ], I = p("image", k);
22
- /**
23
- * @license lucide-react v1.17.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 R = [
29
- ["path", { d: "M12 3v12", key: "1x0j5s" }],
30
- ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
31
- ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
32
- ], E = p("upload", R), P = N(
33
- ({ value: a, onChange: n, accept: c = "image/jpeg,image/png,image/webp", maxSizeMB: s = 2, disabled: i = !1, className: f = "", hint: l = "JPG, PNG, WEBP" }, h) => {
34
- const { showError: d } = j(), r = w(null), g = (x) => {
35
- var m;
36
- const t = (m = x.target.files) == null ? void 0 : m[0];
37
- if (!t) return;
38
- if (!c.split(",").map((b) => b.trim()).includes(t.type)) {
39
- d("Erreur", `Seuls les fichiers ${l} sont acceptés`), r.current && (r.current.value = "");
40
- return;
41
- }
42
- if (t.size > s * 1024 * 1024) {
43
- d("Erreur", `Le fichier ne doit pas dépasser ${s}MB`), r.current && (r.current.value = "");
44
- return;
45
- }
46
- n(t), r.current && (r.current.value = "");
47
- };
48
- return /* @__PURE__ */ e("div", { ref: h, className: f, children: a ? /* @__PURE__ */ o("div", { className: "relative w-32 h-32 rounded-lg overflow-hidden border-2 border-border", children: [
49
- /* @__PURE__ */ e("img", { src: a, alt: "Preview", className: "w-full h-full object-cover" }),
50
- !i && /* @__PURE__ */ e(v, { type: "button", variant: "destructive", size: "sm", className: "absolute top-1 right-1 h-6 w-6 p-0", onClick: () => {
51
- n(null);
52
- }, children: /* @__PURE__ */ e(y, { className: "h-4 w-4" }) })
53
- ] }) : i ? /* @__PURE__ */ o("div", { className: u("flex flex-col items-center justify-center w-full h-32", "border-2 border-dashed border-border rounded-lg", "bg-muted/30"), children: [
54
- /* @__PURE__ */ e(I, { className: "h-8 w-8 text-muted-foreground/50 mb-2" }),
55
- /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground/50", children: "Aucune image" })
56
- ] }) : /* @__PURE__ */ o(
57
- "label",
58
- {
59
- className: u(
60
- "flex flex-col items-center justify-center w-full h-32",
61
- "border-2 border-dashed border-border rounded-lg",
62
- "cursor-pointer hover:bg-muted/50 transition-colors"
63
- ),
64
- children: [
65
- /* @__PURE__ */ e(E, { className: "h-8 w-8 text-muted-foreground mb-2" }),
66
- /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Cliquer pour uploader" }),
67
- /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground mt-1", children: [
68
- l,
69
- " (max ",
70
- s,
71
- "MB)"
72
- ] }),
73
- /* @__PURE__ */ e("input", { ref: r, type: "file", className: "hidden", accept: c, onChange: g })
74
- ]
75
- }
76
- ) });
77
- }
78
- );
79
- P.displayName = "ImageInput";
80
- export {
81
- P as I
82
- };
@@ -1,15 +0,0 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import "./toggle-group-wIgXZYDq.js";
3
- import "react-i18next";
4
- import "@krosoft/core/helpers";
5
- import "./alert-B34E_4uH.js";
6
- import "./tooltip-YhBPXbcJ.js";
7
- import "./select-DlQvLtI3.js";
8
- import "next-themes";
9
- import "react";
10
- import { b as i, a as p } from "./SkeletonCards-C5lXTSrB.js";
11
- import { E as s } from "./ErrorState-vU8d4CwD.js";
12
- const E = ({ stats: o, isLoading: m, error: t }) => m ? /* @__PURE__ */ r(i, { count: 4 }) : t ? /* @__PURE__ */ r(s, { message: t.message }) : /* @__PURE__ */ r(p, { stats: o });
13
- export {
14
- E as K
15
- };
@@ -1,586 +0,0 @@
1
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
- import * as k from "react";
3
- import { useState as N, useRef as j, useEffect as W, useMemo as T } from "react";
4
- import { cm as C, cn as g, co as y, cp as E, cq as M, H as D, bv as H, bx as R, bw as A, ce as S, aW as F } from "./toggle-group-wIgXZYDq.js";
5
- import "./alert-B34E_4uH.js";
6
- import { c as h } from "./tailwind.helper-gWiv5-6R.js";
7
- import { B as p, C as q } from "./tooltip-YhBPXbcJ.js";
8
- import { X as z, C as X } from "./select-DlQvLtI3.js";
9
- import "next-themes";
10
- import { c as V } from "./createLucideIcon-MP_wDWjs.js";
11
- /**
12
- * @license lucide-react v1.17.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
- ], J = V("calendar", _), I = {
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
- }, Y = (e, t, i) => {
85
- let n;
86
- const o = I[e];
87
- return typeof o == "string" ? n = o : t === 1 ? n = o.one : n = o.other.replace("{{count}}", String(t)), i != null && i.addSuffix ? i.comparison && i.comparison > 0 ? "dans " + n : "il y a " + n : n;
88
- }, Q = {
89
- full: "EEEE d MMMM y",
90
- long: "d MMMM y",
91
- medium: "d MMM y",
92
- short: "dd/MM/y"
93
- }, $ = {
94
- full: "HH:mm:ss zzzz",
95
- long: "HH:mm:ss z",
96
- medium: "HH:mm:ss",
97
- short: "HH:mm"
98
- }, B = {
99
- full: "{{date}} 'à' {{time}}",
100
- long: "{{date}} 'à' {{time}}",
101
- medium: "{{date}}, {{time}}",
102
- short: "{{date}}, {{time}}"
103
- }, K = {
104
- date: C({
105
- formats: Q,
106
- defaultWidth: "full"
107
- }),
108
- time: C({
109
- formats: $,
110
- defaultWidth: "full"
111
- }),
112
- dateTime: C({
113
- formats: B,
114
- defaultWidth: "full"
115
- })
116
- }, G = {
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
- }, U = (e, t, i, n) => G[e], Z = {
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
- }, ee = {
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
- }, te = {
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
- }, ne = {
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
- }, re = {
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
- }, ae = (e, t) => {
206
- const i = Number(e), n = t == null ? void 0 : t.unit;
207
- if (i === 0) return "0";
208
- const o = ["year", "week", "hour", "minute", "second"];
209
- let s;
210
- return i === 1 ? s = n && o.includes(n) ? "ère" : "er" : s = "ème", i + s;
211
- }, ie = ["MMM", "MMMM"], oe = {
212
- preprocessor: (e, t) => e.getDate() === 1 || !t.some(
213
- (n) => n.isToken && ie.includes(n.value)
214
- ) ? t : t.map(
215
- (n) => n.isToken && n.value === "do" ? { isToken: !0, value: "d" } : n
216
- ),
217
- ordinalNumber: ae,
218
- era: g({
219
- values: Z,
220
- defaultWidth: "wide"
221
- }),
222
- quarter: g({
223
- values: ee,
224
- defaultWidth: "wide",
225
- argumentCallback: (e) => e - 1
226
- }),
227
- month: g({
228
- values: te,
229
- defaultWidth: "wide"
230
- }),
231
- day: g({
232
- values: ne,
233
- defaultWidth: "wide"
234
- }),
235
- dayPeriod: g({
236
- values: re,
237
- defaultWidth: "wide"
238
- })
239
- }, se = /^(\d+)(ième|ère|ème|er|e)?/i, de = /\d+/i, le = {
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
- }, me = {
244
- any: [/^av/i, /^ap/i]
245
- }, ce = {
246
- narrow: /^T?[1234]/i,
247
- abbreviated: /^[1234](er|ème|e)? trim\.?/i,
248
- wide: /^[1234](er|ème|e)? trimestre/i
249
- }, ue = {
250
- any: [/1/i, /2/i, /3/i, /4/i]
251
- }, fe = {
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
- }, he = {
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
- }, pe = {
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
- }, ve = {
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
- }, be = {
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
- }, ge = {
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
- }, ye = {
307
- ordinalNumber: E({
308
- matchPattern: se,
309
- parsePattern: de,
310
- valueCallback: (e) => parseInt(e)
311
- }),
312
- era: y({
313
- matchPatterns: le,
314
- defaultMatchWidth: "wide",
315
- parsePatterns: me,
316
- defaultParseWidth: "any"
317
- }),
318
- quarter: y({
319
- matchPatterns: ce,
320
- defaultMatchWidth: "wide",
321
- parsePatterns: ue,
322
- defaultParseWidth: "any",
323
- valueCallback: (e) => e + 1
324
- }),
325
- month: y({
326
- matchPatterns: fe,
327
- defaultMatchWidth: "wide",
328
- parsePatterns: he,
329
- defaultParseWidth: "any"
330
- }),
331
- day: y({
332
- matchPatterns: pe,
333
- defaultMatchWidth: "wide",
334
- parsePatterns: ve,
335
- defaultParseWidth: "any"
336
- }),
337
- dayPeriod: y({
338
- matchPatterns: be,
339
- defaultMatchWidth: "any",
340
- parsePatterns: ge,
341
- defaultParseWidth: "any"
342
- })
343
- }, x = {
344
- code: "fr",
345
- formatDistance: Y,
346
- formatLong: K,
347
- formatRelative: U,
348
- localize: oe,
349
- match: ye,
350
- options: {
351
- weekStartsOn: 1,
352
- firstWeekContainsDate: 4
353
- }
354
- }, Te = ({ date: e, onDateChange: t, placeholder: i }) => {
355
- const [n, o] = N(!1), s = j(null);
356
- W(() => {
357
- if (!n) return;
358
- const l = (d) => {
359
- s.current !== null && !s.current.contains(d.target) && o(!1);
360
- };
361
- return document.addEventListener("mousedown", l), () => {
362
- document.removeEventListener("mousedown", l);
363
- };
364
- }, [n]);
365
- const f = () => {
366
- o((l) => !l);
367
- }, c = (l) => {
368
- t(l), o(!1);
369
- };
370
- return /* @__PURE__ */ m("div", { ref: s, className: "relative w-full", children: [
371
- /* @__PURE__ */ m(
372
- p,
373
- {
374
- variant: "outline",
375
- type: "button",
376
- onClick: f,
377
- className: h(
378
- "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
379
- n && "ring-2 ring-ring ring-offset-2",
380
- e === void 0 && "text-muted-foreground"
381
- ),
382
- children: [
383
- /* @__PURE__ */ a(J, { className: "mr-2 size-4 shrink-0" }),
384
- e !== void 0 ? M(e, "dd/MM/yyyy", { locale: x }) : /* @__PURE__ */ a("span", { children: i })
385
- ]
386
- }
387
- ),
388
- n ? /* @__PURE__ */ a("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__ */ a(D, { mode: "single", selected: e, onSelect: c }) }) : null
389
- ] });
390
- }, De = ({ value: e, onChange: t, placeholder: i = "Selectionner une periode", className: n }) => {
391
- const [o, s] = k.useState(!1), [f, c] = k.useState(e);
392
- k.useEffect(() => {
393
- o && c(e);
394
- }, [o, e]);
395
- const l = (u) => {
396
- u.stopPropagation(), t(void 0), s(!1);
397
- }, d = () => {
398
- t(f), s(!1);
399
- }, v = () => {
400
- c(e), s(!1);
401
- }, b = () => {
402
- c(void 0);
403
- }, w = (u) => u != null && u.from ? !u.to || u.from.getTime() === u.to.getTime() ? M(u.from, "dd MMM yyyy", { locale: x }) : `${M(u.from, "dd MMM yyyy", { locale: x })} - ${M(u.to, "dd MMM yyyy", { locale: x })}` : i;
404
- return /* @__PURE__ */ a("div", { className: h("grid gap-2", n), children: /* @__PURE__ */ m(H, { open: o, onOpenChange: s, children: [
405
- /* @__PURE__ */ a(R, { asChild: !0, children: /* @__PURE__ */ m(p, { id: "date", variant: "outline", className: h("w-[300px] justify-start text-left font-normal", !(e != null && e.from) && "text-muted-foreground"), children: [
406
- /* @__PURE__ */ a(J, { className: "mr-2 size-4" }),
407
- w(e),
408
- (e == null ? void 0 : e.from) && /* @__PURE__ */ a(
409
- p,
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: l,
417
- children: /* @__PURE__ */ a(z, { className: "size-4" })
418
- }
419
- )
420
- ] }) }),
421
- /* @__PURE__ */ m(A, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
422
- /* @__PURE__ */ a(
423
- D,
424
- {
425
- mode: "range",
426
- defaultMonth: f == null ? void 0 : f.from,
427
- selected: f,
428
- onSelect: c,
429
- numberOfMonths: 2,
430
- weekStartsOn: 1,
431
- className: "pointer-events-auto p-3"
432
- }
433
- ),
434
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
435
- /* @__PURE__ */ a(p, { variant: "ghost", size: "sm", onClick: b, children: "Effacer" }),
436
- /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
437
- /* @__PURE__ */ a(p, { variant: "ghost", size: "sm", onClick: v, children: "Annuler" }),
438
- /* @__PURE__ */ a(p, { size: "sm", onClick: d, children: "Appliquer" })
439
- ] })
440
- ] })
441
- ] })
442
- ] }) });
443
- }, Se = ({
444
- options: e = [],
445
- value: t,
446
- onChange: i,
447
- onClear: n,
448
- placeholder: o = "Sélectionner...",
449
- searchPlaceholder: s = "Rechercher...",
450
- disabled: f = !1
451
- }) => {
452
- const [c, l] = N(""), [d, v] = N(!1), b = j(null), w = j(null), u = T(() => c === "" ? e : e.filter((r) => r.label.toLowerCase().includes(c.toLowerCase())), [e, c]), L = T(() => {
453
- var r;
454
- if (!(t === void 0 || t === ""))
455
- return ((r = e.find((P) => P.value === t)) == null ? void 0 : r.label) ?? t;
456
- }, [e, t]);
457
- W(() => {
458
- d && requestAnimationFrame(() => {
459
- var r;
460
- (r = w.current) == null || r.focus();
461
- });
462
- }, [d]), W(() => {
463
- if (!d) return;
464
- const r = (P) => {
465
- b.current !== null && !b.current.contains(P.target) && (v(!1), l(""));
466
- };
467
- return document.addEventListener("mousedown", r), () => {
468
- document.removeEventListener("mousedown", r);
469
- };
470
- }, [d]);
471
- const O = (r) => {
472
- i(r), v(!1), l("");
473
- };
474
- return /* @__PURE__ */ m("div", { ref: b, className: "relative w-full", children: [
475
- /* @__PURE__ */ m(
476
- "button",
477
- {
478
- type: "button",
479
- onClick: () => {
480
- f || v((r) => (r && l(""), !r));
481
- },
482
- disabled: f,
483
- className: h(
484
- "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",
485
- d && "ring-2 ring-ring ring-offset-2",
486
- (t === void 0 || t === "") && "text-muted-foreground"
487
- ),
488
- children: [
489
- /* @__PURE__ */ a("span", { className: "truncate", children: L ?? o }),
490
- /* @__PURE__ */ m("div", { className: "flex items-center gap-1", children: [
491
- n && t !== void 0 && t !== "" && !f && /* @__PURE__ */ a(
492
- "span",
493
- {
494
- role: "button",
495
- tabIndex: -1,
496
- onClick: (r) => {
497
- r.stopPropagation();
498
- },
499
- onPointerDown: (r) => {
500
- r.preventDefault(), r.stopPropagation(), n();
501
- },
502
- className: "text-muted-foreground hover:text-foreground",
503
- children: /* @__PURE__ */ a(z, { className: "size-4" })
504
- }
505
- ),
506
- /* @__PURE__ */ a(q, { className: h("size-4 opacity-50 shrink-0 transition-transform", d && "rotate-180") })
507
- ] })
508
- ]
509
- }
510
- ),
511
- d ? /* @__PURE__ */ m("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: [
512
- /* @__PURE__ */ a("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ m("div", { className: "relative", children: [
513
- /* @__PURE__ */ a(S, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
514
- /* @__PURE__ */ a(
515
- "input",
516
- {
517
- ref: w,
518
- 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",
519
- placeholder: s,
520
- value: c,
521
- onChange: (r) => {
522
- l(r.target.value);
523
- }
524
- }
525
- )
526
- ] }) }),
527
- /* @__PURE__ */ m("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: [
528
- u.length === 0 && /* @__PURE__ */ a("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
529
- u.map((r) => /* @__PURE__ */ m(
530
- "button",
531
- {
532
- type: "button",
533
- onClick: () => {
534
- O(r.value);
535
- },
536
- className: h(
537
- "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",
538
- t === r.value && "bg-muted font-medium"
539
- ),
540
- children: [
541
- /* @__PURE__ */ a(X, { className: h("size-3.5 shrink-0", t === r.value ? "opacity-100" : "opacity-0") }),
542
- r.label
543
- ]
544
- },
545
- r.value
546
- ))
547
- ] })
548
- ] }) : null
549
- ] });
550
- }, Je = ({
551
- searchQuery: e,
552
- search: t,
553
- placeholder: i = "Rechercher...",
554
- onSearch: n,
555
- onSubmit: o,
556
- onClear: s,
557
- className: f
558
- }) => {
559
- const c = e ?? t ?? "", l = () => {
560
- n(""), s !== void 0 && s();
561
- };
562
- return /* @__PURE__ */ m("div", { className: h("relative h-fit w-full md:w-64", f), children: [
563
- /* @__PURE__ */ a(S, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
564
- /* @__PURE__ */ a(
565
- F,
566
- {
567
- placeholder: i,
568
- value: c,
569
- onChange: (d) => {
570
- n(d.target.value);
571
- },
572
- className: "pl-8",
573
- onKeyDown: (d) => {
574
- d.key === "Enter" && o !== void 0 && (d.preventDefault(), o());
575
- }
576
- }
577
- ),
578
- c !== "" ? /* @__PURE__ */ a("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__ */ a(z, { className: "size-4" }) }) : null
579
- ] });
580
- };
581
- export {
582
- Te as D,
583
- Je as S,
584
- De as a,
585
- Se as b
586
- };