@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
@@ -1,1240 +0,0 @@
1
- import { jsxs as D, jsx as u } from "react/jsx-runtime";
2
- import { i as G, j as I, k as W, l as vt, I as gt, X as Ce, C as Pt, m as Z } from "./calendar-BMReToKR.js";
3
- import "./checkbox-BI6Lm_p-.js";
4
- import { d as Ne, u as x, i as yt, f as M, j as U, h as Ae, g as bt, k as wt, o as Et, s as Ct, l as Nt, m as At, n as Ot, p as Mt, q as xt, r as Rt, a as H, e as St, v as Tt, B as j } from "./floating-ui.react-dom-BPCyLQfI.js";
5
- import "./card-7XPLAra3.js";
6
- import { c as Y } from "./index-gWiv5-6R.js";
7
- import "./select-B-hcmC3K.js";
8
- import { c as Oe } from "./createLucideIcon-CRdjzt2A.js";
9
- import * as i from "react";
10
- import * as _t from "react-dom";
11
- import Dt from "react-dom";
12
- import { h as Ft, R as Lt, a as kt } from "./Combination-CzdDhqdB.js";
13
- /**
14
- * @license lucide-react v1.16.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const It = [
20
- ["path", { d: "M8 2v4", key: "1cmpym" }],
21
- ["path", { d: "M16 2v4", key: "4m81vk" }],
22
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
23
- ["path", { d: "M3 10h18", key: "8toen8" }]
24
- ], Wt = Oe("calendar", It);
25
- /**
26
- * @license lucide-react v1.16.0 - ISC
27
- *
28
- * This source code is licensed under the ISC license.
29
- * See the LICENSE file in the root directory of this source tree.
30
- */
31
- const jt = [
32
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
33
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
34
- ], Ut = Oe("search", jt), Ht = {
35
- lessThanXSeconds: {
36
- one: "moins d’une seconde",
37
- other: "moins de {{count}} secondes"
38
- },
39
- xSeconds: {
40
- one: "1 seconde",
41
- other: "{{count}} secondes"
42
- },
43
- halfAMinute: "30 secondes",
44
- lessThanXMinutes: {
45
- one: "moins d’une minute",
46
- other: "moins de {{count}} minutes"
47
- },
48
- xMinutes: {
49
- one: "1 minute",
50
- other: "{{count}} minutes"
51
- },
52
- aboutXHours: {
53
- one: "environ 1 heure",
54
- other: "environ {{count}} heures"
55
- },
56
- xHours: {
57
- one: "1 heure",
58
- other: "{{count}} heures"
59
- },
60
- xDays: {
61
- one: "1 jour",
62
- other: "{{count}} jours"
63
- },
64
- aboutXWeeks: {
65
- one: "environ 1 semaine",
66
- other: "environ {{count}} semaines"
67
- },
68
- xWeeks: {
69
- one: "1 semaine",
70
- other: "{{count}} semaines"
71
- },
72
- aboutXMonths: {
73
- one: "environ 1 mois",
74
- other: "environ {{count}} mois"
75
- },
76
- xMonths: {
77
- one: "1 mois",
78
- other: "{{count}} mois"
79
- },
80
- aboutXYears: {
81
- one: "environ 1 an",
82
- other: "environ {{count}} ans"
83
- },
84
- xYears: {
85
- one: "1 an",
86
- other: "{{count}} ans"
87
- },
88
- overXYears: {
89
- one: "plus d’un an",
90
- other: "plus de {{count}} ans"
91
- },
92
- almostXYears: {
93
- one: "presqu’un an",
94
- other: "presque {{count}} ans"
95
- }
96
- }, $t = (e, t, n) => {
97
- let r;
98
- const o = Ht[e];
99
- return typeof o == "string" ? r = o : t === 1 ? r = o.one : r = o.other.replace("{{count}}", String(t)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "dans " + r : "il y a " + r : r;
100
- }, zt = {
101
- full: "EEEE d MMMM y",
102
- long: "d MMMM y",
103
- medium: "d MMM y",
104
- short: "dd/MM/y"
105
- }, Jt = {
106
- full: "HH:mm:ss zzzz",
107
- long: "HH:mm:ss z",
108
- medium: "HH:mm:ss",
109
- short: "HH:mm"
110
- }, Bt = {
111
- full: "{{date}} 'à' {{time}}",
112
- long: "{{date}} 'à' {{time}}",
113
- medium: "{{date}}, {{time}}",
114
- short: "{{date}}, {{time}}"
115
- }, Xt = {
116
- date: G({
117
- formats: zt,
118
- defaultWidth: "full"
119
- }),
120
- time: G({
121
- formats: Jt,
122
- defaultWidth: "full"
123
- }),
124
- dateTime: G({
125
- formats: Bt,
126
- defaultWidth: "full"
127
- })
128
- }, Kt = {
129
- lastWeek: "eeee 'dernier à' p",
130
- yesterday: "'hier à' p",
131
- today: "'aujourd’hui à' p",
132
- tomorrow: "'demain à' p'",
133
- nextWeek: "eeee 'prochain à' p",
134
- other: "P"
135
- }, Vt = (e, t, n, r) => Kt[e], Yt = {
136
- narrow: ["av. J.-C", "ap. J.-C"],
137
- abbreviated: ["av. J.-C", "ap. J.-C"],
138
- wide: ["avant Jésus-Christ", "après Jésus-Christ"]
139
- }, qt = {
140
- narrow: ["T1", "T2", "T3", "T4"],
141
- abbreviated: ["1er trim.", "2ème trim.", "3ème trim.", "4ème trim."],
142
- wide: ["1er trimestre", "2ème trimestre", "3ème trimestre", "4ème trimestre"]
143
- }, Gt = {
144
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
145
- abbreviated: [
146
- "janv.",
147
- "févr.",
148
- "mars",
149
- "avr.",
150
- "mai",
151
- "juin",
152
- "juil.",
153
- "août",
154
- "sept.",
155
- "oct.",
156
- "nov.",
157
- "déc."
158
- ],
159
- wide: [
160
- "janvier",
161
- "février",
162
- "mars",
163
- "avril",
164
- "mai",
165
- "juin",
166
- "juillet",
167
- "août",
168
- "septembre",
169
- "octobre",
170
- "novembre",
171
- "décembre"
172
- ]
173
- }, Zt = {
174
- narrow: ["D", "L", "M", "M", "J", "V", "S"],
175
- short: ["di", "lu", "ma", "me", "je", "ve", "sa"],
176
- abbreviated: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
177
- wide: [
178
- "dimanche",
179
- "lundi",
180
- "mardi",
181
- "mercredi",
182
- "jeudi",
183
- "vendredi",
184
- "samedi"
185
- ]
186
- }, Qt = {
187
- narrow: {
188
- am: "AM",
189
- pm: "PM",
190
- midnight: "minuit",
191
- noon: "midi",
192
- morning: "mat.",
193
- afternoon: "ap.m.",
194
- evening: "soir",
195
- night: "mat."
196
- },
197
- abbreviated: {
198
- am: "AM",
199
- pm: "PM",
200
- midnight: "minuit",
201
- noon: "midi",
202
- morning: "matin",
203
- afternoon: "après-midi",
204
- evening: "soir",
205
- night: "matin"
206
- },
207
- wide: {
208
- am: "AM",
209
- pm: "PM",
210
- midnight: "minuit",
211
- noon: "midi",
212
- morning: "du matin",
213
- afternoon: "de l’après-midi",
214
- evening: "du soir",
215
- night: "du matin"
216
- }
217
- }, en = (e, t) => {
218
- const n = Number(e), r = t == null ? void 0 : t.unit;
219
- if (n === 0) return "0";
220
- const o = ["year", "week", "hour", "minute", "second"];
221
- let a;
222
- return n === 1 ? a = r && o.includes(r) ? "ère" : "er" : a = "ème", n + a;
223
- }, tn = ["MMM", "MMMM"], nn = {
224
- preprocessor: (e, t) => e.getDate() === 1 || !t.some(
225
- (r) => r.isToken && tn.includes(r.value)
226
- ) ? t : t.map(
227
- (r) => r.isToken && r.value === "do" ? { isToken: !0, value: "d" } : r
228
- ),
229
- ordinalNumber: en,
230
- era: I({
231
- values: Yt,
232
- defaultWidth: "wide"
233
- }),
234
- quarter: I({
235
- values: qt,
236
- defaultWidth: "wide",
237
- argumentCallback: (e) => e - 1
238
- }),
239
- month: I({
240
- values: Gt,
241
- defaultWidth: "wide"
242
- }),
243
- day: I({
244
- values: Zt,
245
- defaultWidth: "wide"
246
- }),
247
- dayPeriod: I({
248
- values: Qt,
249
- defaultWidth: "wide"
250
- })
251
- }, rn = /^(\d+)(ième|ère|ème|er|e)?/i, on = /\d+/i, an = {
252
- narrow: /^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,
253
- abbreviated: /^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,
254
- wide: /^(avant Jésus-Christ|après Jésus-Christ)/i
255
- }, sn = {
256
- any: [/^av/i, /^ap/i]
257
- }, cn = {
258
- narrow: /^T?[1234]/i,
259
- abbreviated: /^[1234](er|ème|e)? trim\.?/i,
260
- wide: /^[1234](er|ème|e)? trimestre/i
261
- }, dn = {
262
- any: [/1/i, /2/i, /3/i, /4/i]
263
- }, un = {
264
- narrow: /^[jfmasond]/i,
265
- abbreviated: /^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,
266
- wide: /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i
267
- }, ln = {
268
- narrow: [
269
- /^j/i,
270
- /^f/i,
271
- /^m/i,
272
- /^a/i,
273
- /^m/i,
274
- /^j/i,
275
- /^j/i,
276
- /^a/i,
277
- /^s/i,
278
- /^o/i,
279
- /^n/i,
280
- /^d/i
281
- ],
282
- any: [
283
- /^ja/i,
284
- /^f/i,
285
- /^mar/i,
286
- /^av/i,
287
- /^ma/i,
288
- /^juin/i,
289
- /^juil/i,
290
- /^ao/i,
291
- /^s/i,
292
- /^o/i,
293
- /^n/i,
294
- /^d/i
295
- ]
296
- }, fn = {
297
- narrow: /^[lmjvsd]/i,
298
- short: /^(di|lu|ma|me|je|ve|sa)/i,
299
- abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,
300
- wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i
301
- }, mn = {
302
- narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
303
- any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]
304
- }, pn = {
305
- narrow: /^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,
306
- any: /^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i
307
- }, hn = {
308
- any: {
309
- am: /^a/i,
310
- pm: /^p/i,
311
- midnight: /^min/i,
312
- noon: /^mid/i,
313
- morning: /mat/i,
314
- afternoon: /ap/i,
315
- evening: /soir/i,
316
- night: /nuit/i
317
- }
318
- }, vn = {
319
- ordinalNumber: vt({
320
- matchPattern: rn,
321
- parsePattern: on,
322
- valueCallback: (e) => parseInt(e)
323
- }),
324
- era: W({
325
- matchPatterns: an,
326
- defaultMatchWidth: "wide",
327
- parsePatterns: sn,
328
- defaultParseWidth: "any"
329
- }),
330
- quarter: W({
331
- matchPatterns: cn,
332
- defaultMatchWidth: "wide",
333
- parsePatterns: dn,
334
- defaultParseWidth: "any",
335
- valueCallback: (e) => e + 1
336
- }),
337
- month: W({
338
- matchPatterns: un,
339
- defaultMatchWidth: "wide",
340
- parsePatterns: ln,
341
- defaultParseWidth: "any"
342
- }),
343
- day: W({
344
- matchPatterns: fn,
345
- defaultMatchWidth: "wide",
346
- parsePatterns: mn,
347
- defaultParseWidth: "any"
348
- }),
349
- dayPeriod: W({
350
- matchPatterns: pn,
351
- defaultMatchWidth: "any",
352
- parsePatterns: hn,
353
- defaultParseWidth: "any"
354
- })
355
- }, Q = {
356
- code: "fr",
357
- formatDistance: $t,
358
- formatLong: Xt,
359
- formatRelative: Vt,
360
- localize: nn,
361
- match: vn,
362
- options: {
363
- weekStartsOn: 1,
364
- firstWeekContainsDate: 4
365
- }
366
- }, yr = ({
367
- searchQuery: e,
368
- search: t,
369
- placeholder: n = "Rechercher...",
370
- onSearch: r,
371
- onSubmit: o,
372
- onClear: a,
373
- className: c
374
- }) => {
375
- const s = e || t || "", l = () => {
376
- r(""), a && a();
377
- };
378
- return /* @__PURE__ */ D("div", { className: Y("relative h-fit w-full md:w-64", c), children: [
379
- /* @__PURE__ */ u(Ut, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
380
- /* @__PURE__ */ u(
381
- gt,
382
- {
383
- placeholder: n,
384
- value: s,
385
- onChange: (d) => r(d.target.value),
386
- className: "pl-8",
387
- onKeyDown: (d) => {
388
- d.key === "Enter" && o && (d.preventDefault(), o());
389
- }
390
- }
391
- ),
392
- s && /* @__PURE__ */ u("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__ */ u(Ce, { className: "size-4" }) })
393
- ] });
394
- };
395
- var gn = [
396
- "a",
397
- "button",
398
- "div",
399
- "form",
400
- "h2",
401
- "h3",
402
- "img",
403
- "input",
404
- "label",
405
- "li",
406
- "nav",
407
- "ol",
408
- "p",
409
- "select",
410
- "span",
411
- "svg",
412
- "ul"
413
- ], A = gn.reduce((e, t) => {
414
- const n = Ne(`Primitive.${t}`), r = i.forwardRef((o, a) => {
415
- const { asChild: c, ...s } = o, l = c ? n : t;
416
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(l, { ...s, ref: a });
417
- });
418
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
419
- }, {});
420
- function Pn(e, t) {
421
- e && _t.flushSync(() => e.dispatchEvent(t));
422
- }
423
- var yn = "DismissableLayer", ne = "dismissableLayer.update", bn = "dismissableLayer.pointerDownOutside", wn = "dismissableLayer.focusOutside", ge, Me = i.createContext({
424
- layers: /* @__PURE__ */ new Set(),
425
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
426
- branches: /* @__PURE__ */ new Set()
427
- }), xe = i.forwardRef(
428
- (e, t) => {
429
- const {
430
- disableOutsidePointerEvents: n = !1,
431
- onEscapeKeyDown: r,
432
- onPointerDownOutside: o,
433
- onFocusOutside: a,
434
- onInteractOutside: c,
435
- onDismiss: s,
436
- ...l
437
- } = e, d = i.useContext(Me), [m, v] = i.useState(null), h = (m == null ? void 0 : m.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, f] = i.useState({}), w = x(t, (P) => v(P)), p = Array.from(d.layers), [b] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), g = p.indexOf(b), E = m ? p.indexOf(m) : -1, C = d.layersWithOutsidePointerEventsDisabled.size > 0, y = E >= g, T = Nn((P) => {
438
- const S = P.target, z = [...d.branches].some((L) => L.contains(S));
439
- !y || z || (o == null || o(P), c == null || c(P), P.defaultPrevented || s == null || s());
440
- }, h), N = An((P) => {
441
- const S = P.target;
442
- [...d.branches].some((L) => L.contains(S)) || (a == null || a(P), c == null || c(P), P.defaultPrevented || s == null || s());
443
- }, h);
444
- return yt((P) => {
445
- E === d.layers.size - 1 && (r == null || r(P), !P.defaultPrevented && s && (P.preventDefault(), s()));
446
- }, h), i.useEffect(() => {
447
- if (m)
448
- return n && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (ge = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(m)), d.layers.add(m), Pe(), () => {
449
- n && d.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = ge);
450
- };
451
- }, [m, h, n, d]), i.useEffect(() => () => {
452
- m && (d.layers.delete(m), d.layersWithOutsidePointerEventsDisabled.delete(m), Pe());
453
- }, [m, d]), i.useEffect(() => {
454
- const P = () => f({});
455
- return document.addEventListener(ne, P), () => document.removeEventListener(ne, P);
456
- }, []), /* @__PURE__ */ u(
457
- A.div,
458
- {
459
- ...l,
460
- ref: w,
461
- style: {
462
- pointerEvents: C ? y ? "auto" : "none" : void 0,
463
- ...e.style
464
- },
465
- onFocusCapture: M(e.onFocusCapture, N.onFocusCapture),
466
- onBlurCapture: M(e.onBlurCapture, N.onBlurCapture),
467
- onPointerDownCapture: M(
468
- e.onPointerDownCapture,
469
- T.onPointerDownCapture
470
- )
471
- }
472
- );
473
- }
474
- );
475
- xe.displayName = yn;
476
- var En = "DismissableLayerBranch", Cn = i.forwardRef((e, t) => {
477
- const n = i.useContext(Me), r = i.useRef(null), o = x(t, r);
478
- return i.useEffect(() => {
479
- const a = r.current;
480
- if (a)
481
- return n.branches.add(a), () => {
482
- n.branches.delete(a);
483
- };
484
- }, [n.branches]), /* @__PURE__ */ u(A.div, { ...e, ref: o });
485
- });
486
- Cn.displayName = En;
487
- function Nn(e, t = globalThis == null ? void 0 : globalThis.document) {
488
- const n = U(e), r = i.useRef(!1), o = i.useRef(() => {
489
- });
490
- return i.useEffect(() => {
491
- const a = (s) => {
492
- if (s.target && !r.current) {
493
- let l = function() {
494
- Re(
495
- bn,
496
- n,
497
- d,
498
- { discrete: !0 }
499
- );
500
- };
501
- const d = { originalEvent: s };
502
- s.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = l, t.addEventListener("click", o.current, { once: !0 })) : l();
503
- } else
504
- t.removeEventListener("click", o.current);
505
- r.current = !1;
506
- }, c = window.setTimeout(() => {
507
- t.addEventListener("pointerdown", a);
508
- }, 0);
509
- return () => {
510
- window.clearTimeout(c), t.removeEventListener("pointerdown", a), t.removeEventListener("click", o.current);
511
- };
512
- }, [t, n]), {
513
- // ensures we check React component tree (not just DOM tree)
514
- onPointerDownCapture: () => r.current = !0
515
- };
516
- }
517
- function An(e, t = globalThis == null ? void 0 : globalThis.document) {
518
- const n = U(e), r = i.useRef(!1);
519
- return i.useEffect(() => {
520
- const o = (a) => {
521
- a.target && !r.current && Re(wn, n, { originalEvent: a }, {
522
- discrete: !1
523
- });
524
- };
525
- return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
526
- }, [t, n]), {
527
- onFocusCapture: () => r.current = !0,
528
- onBlurCapture: () => r.current = !1
529
- };
530
- }
531
- function Pe() {
532
- const e = new CustomEvent(ne);
533
- document.dispatchEvent(e);
534
- }
535
- function Re(e, t, n, { discrete: r }) {
536
- const o = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
537
- t && o.addEventListener(e, t, { once: !0 }), r ? Pn(o, a) : o.dispatchEvent(a);
538
- }
539
- var ee = "focusScope.autoFocusOnMount", te = "focusScope.autoFocusOnUnmount", ye = { bubbles: !1, cancelable: !0 }, On = "FocusScope", Se = i.forwardRef((e, t) => {
540
- const {
541
- loop: n = !1,
542
- trapped: r = !1,
543
- onMountAutoFocus: o,
544
- onUnmountAutoFocus: a,
545
- ...c
546
- } = e, [s, l] = i.useState(null), d = U(o), m = U(a), v = i.useRef(null), h = x(t, (p) => l(p)), f = i.useRef({
547
- paused: !1,
548
- pause() {
549
- this.paused = !0;
550
- },
551
- resume() {
552
- this.paused = !1;
553
- }
554
- }).current;
555
- i.useEffect(() => {
556
- if (r) {
557
- let p = function(C) {
558
- if (f.paused || !s) return;
559
- const y = C.target;
560
- s.contains(y) ? v.current = y : O(v.current, { select: !0 });
561
- }, b = function(C) {
562
- if (f.paused || !s) return;
563
- const y = C.relatedTarget;
564
- y !== null && (s.contains(y) || O(v.current, { select: !0 }));
565
- }, g = function(C) {
566
- if (document.activeElement === document.body)
567
- for (const T of C)
568
- T.removedNodes.length > 0 && O(s);
569
- };
570
- document.addEventListener("focusin", p), document.addEventListener("focusout", b);
571
- const E = new MutationObserver(g);
572
- return s && E.observe(s, { childList: !0, subtree: !0 }), () => {
573
- document.removeEventListener("focusin", p), document.removeEventListener("focusout", b), E.disconnect();
574
- };
575
- }
576
- }, [r, s, f.paused]), i.useEffect(() => {
577
- if (s) {
578
- we.add(f);
579
- const p = document.activeElement;
580
- if (!s.contains(p)) {
581
- const g = new CustomEvent(ee, ye);
582
- s.addEventListener(ee, d), s.dispatchEvent(g), g.defaultPrevented || (Mn(_n(Te(s)), { select: !0 }), document.activeElement === p && O(s));
583
- }
584
- return () => {
585
- s.removeEventListener(ee, d), setTimeout(() => {
586
- const g = new CustomEvent(te, ye);
587
- s.addEventListener(te, m), s.dispatchEvent(g), g.defaultPrevented || O(p ?? document.body, { select: !0 }), s.removeEventListener(te, m), we.remove(f);
588
- }, 0);
589
- };
590
- }
591
- }, [s, d, m, f]);
592
- const w = i.useCallback(
593
- (p) => {
594
- if (!n && !r || f.paused) return;
595
- const b = p.key === "Tab" && !p.altKey && !p.ctrlKey && !p.metaKey, g = document.activeElement;
596
- if (b && g) {
597
- const E = p.currentTarget, [C, y] = xn(E);
598
- C && y ? !p.shiftKey && g === y ? (p.preventDefault(), n && O(C, { select: !0 })) : p.shiftKey && g === C && (p.preventDefault(), n && O(y, { select: !0 })) : g === E && p.preventDefault();
599
- }
600
- },
601
- [n, r, f.paused]
602
- );
603
- return /* @__PURE__ */ u(A.div, { tabIndex: -1, ...c, ref: h, onKeyDown: w });
604
- });
605
- Se.displayName = On;
606
- function Mn(e, { select: t = !1 } = {}) {
607
- const n = document.activeElement;
608
- for (const r of e)
609
- if (O(r, { select: t }), document.activeElement !== n) return;
610
- }
611
- function xn(e) {
612
- const t = Te(e), n = be(t, e), r = be(t.reverse(), e);
613
- return [n, r];
614
- }
615
- function Te(e) {
616
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
617
- acceptNode: (r) => {
618
- const o = r.tagName === "INPUT" && r.type === "hidden";
619
- return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
620
- }
621
- });
622
- for (; n.nextNode(); ) t.push(n.currentNode);
623
- return t;
624
- }
625
- function be(e, t) {
626
- for (const n of e)
627
- if (!Rn(n, { upTo: t })) return n;
628
- }
629
- function Rn(e, { upTo: t }) {
630
- if (getComputedStyle(e).visibility === "hidden") return !0;
631
- for (; e; ) {
632
- if (t !== void 0 && e === t) return !1;
633
- if (getComputedStyle(e).display === "none") return !0;
634
- e = e.parentElement;
635
- }
636
- return !1;
637
- }
638
- function Sn(e) {
639
- return e instanceof HTMLInputElement && "select" in e;
640
- }
641
- function O(e, { select: t = !1 } = {}) {
642
- if (e && e.focus) {
643
- const n = document.activeElement;
644
- e.focus({ preventScroll: !0 }), e !== n && Sn(e) && t && e.select();
645
- }
646
- }
647
- var we = Tn();
648
- function Tn() {
649
- let e = [];
650
- return {
651
- add(t) {
652
- const n = e[0];
653
- t !== n && (n == null || n.pause()), e = Ee(e, t), e.unshift(t);
654
- },
655
- remove(t) {
656
- var n;
657
- e = Ee(e, t), (n = e[0]) == null || n.resume();
658
- }
659
- };
660
- }
661
- function Ee(e, t) {
662
- const n = [...e], r = n.indexOf(t);
663
- return r !== -1 && n.splice(r, 1), n;
664
- }
665
- function _n(e) {
666
- return e.filter((t) => t.tagName !== "A");
667
- }
668
- var Dn = "Arrow", _e = i.forwardRef((e, t) => {
669
- const { children: n, width: r = 10, height: o = 5, ...a } = e;
670
- return /* @__PURE__ */ u(
671
- A.svg,
672
- {
673
- ...a,
674
- ref: t,
675
- width: r,
676
- height: o,
677
- viewBox: "0 0 30 10",
678
- preserveAspectRatio: "none",
679
- children: e.asChild ? n : /* @__PURE__ */ u("polygon", { points: "0,0 30,0 15,10" })
680
- }
681
- );
682
- });
683
- _e.displayName = Dn;
684
- var Fn = _e, re = "Popper", [De, Fe] = Ae(re), [Ln, Le] = De(re), ke = (e) => {
685
- const { __scopePopper: t, children: n } = e, [r, o] = i.useState(null);
686
- return /* @__PURE__ */ u(Ln, { scope: t, anchor: r, onAnchorChange: o, children: n });
687
- };
688
- ke.displayName = re;
689
- var Ie = "PopperAnchor", We = i.forwardRef(
690
- (e, t) => {
691
- const { __scopePopper: n, virtualRef: r, ...o } = e, a = Le(Ie, n), c = i.useRef(null), s = x(t, c), l = i.useRef(null);
692
- return i.useEffect(() => {
693
- const d = l.current;
694
- l.current = (r == null ? void 0 : r.current) || c.current, d !== l.current && a.onAnchorChange(l.current);
695
- }), r ? null : /* @__PURE__ */ u(A.div, { ...o, ref: s });
696
- }
697
- );
698
- We.displayName = Ie;
699
- var oe = "PopperContent", [kn, In] = De(oe), je = i.forwardRef(
700
- (e, t) => {
701
- var ue, le, fe, me, pe, he;
702
- const {
703
- __scopePopper: n,
704
- side: r = "bottom",
705
- sideOffset: o = 0,
706
- align: a = "center",
707
- alignOffset: c = 0,
708
- arrowPadding: s = 0,
709
- avoidCollisions: l = !0,
710
- collisionBoundary: d = [],
711
- collisionPadding: m = 0,
712
- sticky: v = "partial",
713
- hideWhenDetached: h = !1,
714
- updatePositionStrategy: f = "optimized",
715
- onPlaced: w,
716
- ...p
717
- } = e, b = Le(oe, n), [g, E] = i.useState(null), C = x(t, (k) => E(k)), [y, T] = i.useState(null), N = bt(y), P = (N == null ? void 0 : N.width) ?? 0, S = (N == null ? void 0 : N.height) ?? 0, z = r + (a !== "center" ? "-" + a : ""), L = typeof m == "number" ? m : { top: 0, right: 0, bottom: 0, left: 0, ...m }, ie = Array.isArray(d) ? d : [d], rt = ie.length > 0, J = {
718
- padding: L,
719
- boundary: ie.filter(jn),
720
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
721
- altBoundary: rt
722
- }, { refs: ot, floatingStyles: ce, placement: at, isPositioned: B, middlewareData: _ } = wt({
723
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
724
- strategy: "fixed",
725
- placement: z,
726
- whileElementsMounted: (...k) => Rt(...k, {
727
- animationFrame: f === "always"
728
- }),
729
- elements: {
730
- reference: b.anchor
731
- },
732
- middleware: [
733
- Et({ mainAxis: o + S, alignmentAxis: c }),
734
- l && Ct({
735
- mainAxis: !0,
736
- crossAxis: !1,
737
- limiter: v === "partial" ? Nt() : void 0,
738
- ...J
739
- }),
740
- l && At({ ...J }),
741
- Ot({
742
- ...J,
743
- apply: ({ elements: k, rects: ve, availableWidth: ft, availableHeight: mt }) => {
744
- const { width: pt, height: ht } = ve.reference, K = k.floating.style;
745
- K.setProperty("--radix-popper-available-width", `${ft}px`), K.setProperty("--radix-popper-available-height", `${mt}px`), K.setProperty("--radix-popper-anchor-width", `${pt}px`), K.setProperty("--radix-popper-anchor-height", `${ht}px`);
746
- }
747
- }),
748
- y && Mt({ element: y, padding: s }),
749
- Un({ arrowWidth: P, arrowHeight: S }),
750
- h && xt({ strategy: "referenceHidden", ...J })
751
- ]
752
- }), [de, st] = $e(at), X = U(w);
753
- H(() => {
754
- B && (X == null || X());
755
- }, [B, X]);
756
- const it = (ue = _.arrow) == null ? void 0 : ue.x, ct = (le = _.arrow) == null ? void 0 : le.y, dt = ((fe = _.arrow) == null ? void 0 : fe.centerOffset) !== 0, [ut, lt] = i.useState();
757
- return H(() => {
758
- g && lt(window.getComputedStyle(g).zIndex);
759
- }, [g]), /* @__PURE__ */ u(
760
- "div",
761
- {
762
- ref: ot.setFloating,
763
- "data-radix-popper-content-wrapper": "",
764
- style: {
765
- ...ce,
766
- transform: B ? ce.transform : "translate(0, -200%)",
767
- // keep off the page when measuring
768
- minWidth: "max-content",
769
- zIndex: ut,
770
- "--radix-popper-transform-origin": [
771
- (me = _.transformOrigin) == null ? void 0 : me.x,
772
- (pe = _.transformOrigin) == null ? void 0 : pe.y
773
- ].join(" "),
774
- // hide the content if using the hide middleware and should be hidden
775
- // set visibility to hidden and disable pointer events so the UI behaves
776
- // as if the PopperContent isn't there at all
777
- ...((he = _.hide) == null ? void 0 : he.referenceHidden) && {
778
- visibility: "hidden",
779
- pointerEvents: "none"
780
- }
781
- },
782
- dir: e.dir,
783
- children: /* @__PURE__ */ u(
784
- kn,
785
- {
786
- scope: n,
787
- placedSide: de,
788
- onArrowChange: T,
789
- arrowX: it,
790
- arrowY: ct,
791
- shouldHideArrow: dt,
792
- children: /* @__PURE__ */ u(
793
- A.div,
794
- {
795
- "data-side": de,
796
- "data-align": st,
797
- ...p,
798
- ref: C,
799
- style: {
800
- ...p.style,
801
- // if the PopperContent hasn't been placed yet (not all measurements done)
802
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
803
- animation: B ? void 0 : "none"
804
- }
805
- }
806
- )
807
- }
808
- )
809
- }
810
- );
811
- }
812
- );
813
- je.displayName = oe;
814
- var Ue = "PopperArrow", Wn = {
815
- top: "bottom",
816
- right: "left",
817
- bottom: "top",
818
- left: "right"
819
- }, He = i.forwardRef(function(t, n) {
820
- const { __scopePopper: r, ...o } = t, a = In(Ue, r), c = Wn[a.placedSide];
821
- return (
822
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
823
- // doesn't report size as we'd expect on SVG elements.
824
- // it reports their bounding box which is effectively the largest path inside the SVG.
825
- /* @__PURE__ */ u(
826
- "span",
827
- {
828
- ref: a.onArrowChange,
829
- style: {
830
- position: "absolute",
831
- left: a.arrowX,
832
- top: a.arrowY,
833
- [c]: 0,
834
- transformOrigin: {
835
- top: "",
836
- right: "0 0",
837
- bottom: "center 0",
838
- left: "100% 0"
839
- }[a.placedSide],
840
- transform: {
841
- top: "translateY(100%)",
842
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
843
- bottom: "rotate(180deg)",
844
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
845
- }[a.placedSide],
846
- visibility: a.shouldHideArrow ? "hidden" : void 0
847
- },
848
- children: /* @__PURE__ */ u(
849
- Fn,
850
- {
851
- ...o,
852
- ref: n,
853
- style: {
854
- ...o.style,
855
- // ensures the element can be measured correctly (mostly for if SVG)
856
- display: "block"
857
- }
858
- }
859
- )
860
- }
861
- )
862
- );
863
- });
864
- He.displayName = Ue;
865
- function jn(e) {
866
- return e !== null;
867
- }
868
- var Un = (e) => ({
869
- name: "transformOrigin",
870
- options: e,
871
- fn(t) {
872
- var b, g, E;
873
- const { placement: n, rects: r, middlewareData: o } = t, c = ((b = o.arrow) == null ? void 0 : b.centerOffset) !== 0, s = c ? 0 : e.arrowWidth, l = c ? 0 : e.arrowHeight, [d, m] = $e(n), v = { start: "0%", center: "50%", end: "100%" }[m], h = (((g = o.arrow) == null ? void 0 : g.x) ?? 0) + s / 2, f = (((E = o.arrow) == null ? void 0 : E.y) ?? 0) + l / 2;
874
- let w = "", p = "";
875
- return d === "bottom" ? (w = c ? v : `${h}px`, p = `${-l}px`) : d === "top" ? (w = c ? v : `${h}px`, p = `${r.floating.height + l}px`) : d === "right" ? (w = `${-l}px`, p = c ? v : `${f}px`) : d === "left" && (w = `${r.floating.width + l}px`, p = c ? v : `${f}px`), { data: { x: w, y: p } };
876
- }
877
- });
878
- function $e(e) {
879
- const [t, n = "center"] = e.split("-");
880
- return [t, n];
881
- }
882
- var Hn = ke, ze = We, $n = je, zn = He, Jn = "Portal", Je = i.forwardRef((e, t) => {
883
- var s;
884
- const { container: n, ...r } = e, [o, a] = i.useState(!1);
885
- H(() => a(!0), []);
886
- const c = n || o && ((s = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : s.body);
887
- return c ? Dt.createPortal(/* @__PURE__ */ u(A.div, { ...r, ref: t }), c) : null;
888
- });
889
- Je.displayName = Jn;
890
- function Bn(e, t) {
891
- return i.useReducer((n, r) => t[n][r] ?? n, e);
892
- }
893
- var ae = (e) => {
894
- const { present: t, children: n } = e, r = Xn(t), o = typeof n == "function" ? n({ present: r.isPresent }) : i.Children.only(n), a = x(r.ref, Kn(o));
895
- return typeof n == "function" || r.isPresent ? i.cloneElement(o, { ref: a }) : null;
896
- };
897
- ae.displayName = "Presence";
898
- function Xn(e) {
899
- const [t, n] = i.useState(), r = i.useRef(null), o = i.useRef(e), a = i.useRef("none"), c = e ? "mounted" : "unmounted", [s, l] = Bn(c, {
900
- mounted: {
901
- UNMOUNT: "unmounted",
902
- ANIMATION_OUT: "unmountSuspended"
903
- },
904
- unmountSuspended: {
905
- MOUNT: "mounted",
906
- ANIMATION_END: "unmounted"
907
- },
908
- unmounted: {
909
- MOUNT: "mounted"
910
- }
911
- });
912
- return i.useEffect(() => {
913
- const d = V(r.current);
914
- a.current = s === "mounted" ? d : "none";
915
- }, [s]), H(() => {
916
- const d = r.current, m = o.current;
917
- if (m !== e) {
918
- const h = a.current, f = V(d);
919
- e ? l("MOUNT") : f === "none" || (d == null ? void 0 : d.display) === "none" ? l("UNMOUNT") : l(m && h !== f ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
920
- }
921
- }, [e, l]), H(() => {
922
- if (t) {
923
- let d;
924
- const m = t.ownerDocument.defaultView ?? window, v = (f) => {
925
- const p = V(r.current).includes(CSS.escape(f.animationName));
926
- if (f.target === t && p && (l("ANIMATION_END"), !o.current)) {
927
- const b = t.style.animationFillMode;
928
- t.style.animationFillMode = "forwards", d = m.setTimeout(() => {
929
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = b);
930
- });
931
- }
932
- }, h = (f) => {
933
- f.target === t && (a.current = V(r.current));
934
- };
935
- return t.addEventListener("animationstart", h), t.addEventListener("animationcancel", v), t.addEventListener("animationend", v), () => {
936
- m.clearTimeout(d), t.removeEventListener("animationstart", h), t.removeEventListener("animationcancel", v), t.removeEventListener("animationend", v);
937
- };
938
- } else
939
- l("ANIMATION_END");
940
- }, [t, l]), {
941
- isPresent: ["mounted", "unmountSuspended"].includes(s),
942
- ref: i.useCallback((d) => {
943
- r.current = d ? getComputedStyle(d) : null, n(d);
944
- }, [])
945
- };
946
- }
947
- function V(e) {
948
- return (e == null ? void 0 : e.animationName) || "none";
949
- }
950
- function Kn(e) {
951
- var r, o;
952
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
953
- return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
954
- }
955
- var q = "Popover", [Be] = Ae(q, [
956
- Fe
957
- ]), $ = Fe(), [Vn, R] = Be(q), Xe = (e) => {
958
- const {
959
- __scopePopover: t,
960
- children: n,
961
- open: r,
962
- defaultOpen: o,
963
- onOpenChange: a,
964
- modal: c = !1
965
- } = e, s = $(t), l = i.useRef(null), [d, m] = i.useState(!1), [v, h] = St({
966
- prop: r,
967
- defaultProp: o ?? !1,
968
- onChange: a,
969
- caller: q
970
- });
971
- return /* @__PURE__ */ u(Hn, { ...s, children: /* @__PURE__ */ u(
972
- Vn,
973
- {
974
- scope: t,
975
- contentId: Tt(),
976
- triggerRef: l,
977
- open: v,
978
- onOpenChange: h,
979
- onOpenToggle: i.useCallback(() => h((f) => !f), [h]),
980
- hasCustomAnchor: d,
981
- onCustomAnchorAdd: i.useCallback(() => m(!0), []),
982
- onCustomAnchorRemove: i.useCallback(() => m(!1), []),
983
- modal: c,
984
- children: n
985
- }
986
- ) });
987
- };
988
- Xe.displayName = q;
989
- var Ke = "PopoverAnchor", Yn = i.forwardRef(
990
- (e, t) => {
991
- const { __scopePopover: n, ...r } = e, o = R(Ke, n), a = $(n), { onCustomAnchorAdd: c, onCustomAnchorRemove: s } = o;
992
- return i.useEffect(() => (c(), () => s()), [c, s]), /* @__PURE__ */ u(ze, { ...a, ...r, ref: t });
993
- }
994
- );
995
- Yn.displayName = Ke;
996
- var Ve = "PopoverTrigger", Ye = i.forwardRef(
997
- (e, t) => {
998
- const { __scopePopover: n, ...r } = e, o = R(Ve, n), a = $(n), c = x(t, o.triggerRef), s = /* @__PURE__ */ u(
999
- A.button,
1000
- {
1001
- type: "button",
1002
- "aria-haspopup": "dialog",
1003
- "aria-expanded": o.open,
1004
- "aria-controls": o.contentId,
1005
- "data-state": et(o.open),
1006
- ...r,
1007
- ref: c,
1008
- onClick: M(e.onClick, o.onOpenToggle)
1009
- }
1010
- );
1011
- return o.hasCustomAnchor ? s : /* @__PURE__ */ u(ze, { asChild: !0, ...a, children: s });
1012
- }
1013
- );
1014
- Ye.displayName = Ve;
1015
- var se = "PopoverPortal", [qn, Gn] = Be(se, {
1016
- forceMount: void 0
1017
- }), qe = (e) => {
1018
- const { __scopePopover: t, forceMount: n, children: r, container: o } = e, a = R(se, t);
1019
- return /* @__PURE__ */ u(qn, { scope: t, forceMount: n, children: /* @__PURE__ */ u(ae, { present: n || a.open, children: /* @__PURE__ */ u(Je, { asChild: !0, container: o, children: r }) }) });
1020
- };
1021
- qe.displayName = se;
1022
- var F = "PopoverContent", Ge = i.forwardRef(
1023
- (e, t) => {
1024
- const n = Gn(F, e.__scopePopover), { forceMount: r = n.forceMount, ...o } = e, a = R(F, e.__scopePopover);
1025
- return /* @__PURE__ */ u(ae, { present: r || a.open, children: a.modal ? /* @__PURE__ */ u(Qn, { ...o, ref: t }) : /* @__PURE__ */ u(er, { ...o, ref: t }) });
1026
- }
1027
- );
1028
- Ge.displayName = F;
1029
- var Zn = Ne("PopoverContent.RemoveScroll"), Qn = i.forwardRef(
1030
- (e, t) => {
1031
- const n = R(F, e.__scopePopover), r = i.useRef(null), o = x(t, r), a = i.useRef(!1);
1032
- return i.useEffect(() => {
1033
- const c = r.current;
1034
- if (c) return Ft(c);
1035
- }, []), /* @__PURE__ */ u(Lt, { as: Zn, allowPinchZoom: !0, children: /* @__PURE__ */ u(
1036
- Ze,
1037
- {
1038
- ...e,
1039
- ref: o,
1040
- trapFocus: n.open,
1041
- disableOutsidePointerEvents: !0,
1042
- onCloseAutoFocus: M(e.onCloseAutoFocus, (c) => {
1043
- var s;
1044
- c.preventDefault(), a.current || (s = n.triggerRef.current) == null || s.focus();
1045
- }),
1046
- onPointerDownOutside: M(
1047
- e.onPointerDownOutside,
1048
- (c) => {
1049
- const s = c.detail.originalEvent, l = s.button === 0 && s.ctrlKey === !0, d = s.button === 2 || l;
1050
- a.current = d;
1051
- },
1052
- { checkForDefaultPrevented: !1 }
1053
- ),
1054
- onFocusOutside: M(
1055
- e.onFocusOutside,
1056
- (c) => c.preventDefault(),
1057
- { checkForDefaultPrevented: !1 }
1058
- )
1059
- }
1060
- ) });
1061
- }
1062
- ), er = i.forwardRef(
1063
- (e, t) => {
1064
- const n = R(F, e.__scopePopover), r = i.useRef(!1), o = i.useRef(!1);
1065
- return /* @__PURE__ */ u(
1066
- Ze,
1067
- {
1068
- ...e,
1069
- ref: t,
1070
- trapFocus: !1,
1071
- disableOutsidePointerEvents: !1,
1072
- onCloseAutoFocus: (a) => {
1073
- var c, s;
1074
- (c = e.onCloseAutoFocus) == null || c.call(e, a), a.defaultPrevented || (r.current || (s = n.triggerRef.current) == null || s.focus(), a.preventDefault()), r.current = !1, o.current = !1;
1075
- },
1076
- onInteractOutside: (a) => {
1077
- var l, d;
1078
- (l = e.onInteractOutside) == null || l.call(e, a), a.defaultPrevented || (r.current = !0, a.detail.originalEvent.type === "pointerdown" && (o.current = !0));
1079
- const c = a.target;
1080
- ((d = n.triggerRef.current) == null ? void 0 : d.contains(c)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && o.current && a.preventDefault();
1081
- }
1082
- }
1083
- );
1084
- }
1085
- ), Ze = i.forwardRef(
1086
- (e, t) => {
1087
- const {
1088
- __scopePopover: n,
1089
- trapFocus: r,
1090
- onOpenAutoFocus: o,
1091
- onCloseAutoFocus: a,
1092
- disableOutsidePointerEvents: c,
1093
- onEscapeKeyDown: s,
1094
- onPointerDownOutside: l,
1095
- onFocusOutside: d,
1096
- onInteractOutside: m,
1097
- ...v
1098
- } = e, h = R(F, n), f = $(n);
1099
- return kt(), /* @__PURE__ */ u(
1100
- Se,
1101
- {
1102
- asChild: !0,
1103
- loop: !0,
1104
- trapped: r,
1105
- onMountAutoFocus: o,
1106
- onUnmountAutoFocus: a,
1107
- children: /* @__PURE__ */ u(
1108
- xe,
1109
- {
1110
- asChild: !0,
1111
- disableOutsidePointerEvents: c,
1112
- onInteractOutside: m,
1113
- onEscapeKeyDown: s,
1114
- onPointerDownOutside: l,
1115
- onFocusOutside: d,
1116
- onDismiss: () => h.onOpenChange(!1),
1117
- children: /* @__PURE__ */ u(
1118
- $n,
1119
- {
1120
- "data-state": et(h.open),
1121
- role: "dialog",
1122
- id: h.contentId,
1123
- ...f,
1124
- ...v,
1125
- ref: t,
1126
- style: {
1127
- ...v.style,
1128
- "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
1129
- "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
1130
- "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
1131
- "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
1132
- "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
1133
- }
1134
- }
1135
- )
1136
- }
1137
- )
1138
- }
1139
- );
1140
- }
1141
- ), Qe = "PopoverClose", tr = i.forwardRef(
1142
- (e, t) => {
1143
- const { __scopePopover: n, ...r } = e, o = R(Qe, n);
1144
- return /* @__PURE__ */ u(
1145
- A.button,
1146
- {
1147
- type: "button",
1148
- ...r,
1149
- ref: t,
1150
- onClick: M(e.onClick, () => o.onOpenChange(!1))
1151
- }
1152
- );
1153
- }
1154
- );
1155
- tr.displayName = Qe;
1156
- var nr = "PopoverArrow", rr = i.forwardRef(
1157
- (e, t) => {
1158
- const { __scopePopover: n, ...r } = e, o = $(n);
1159
- return /* @__PURE__ */ u(zn, { ...o, ...r, ref: t });
1160
- }
1161
- );
1162
- rr.displayName = nr;
1163
- function et(e) {
1164
- return e ? "open" : "closed";
1165
- }
1166
- var or = Xe, ar = Ye, sr = qe, tt = Ge;
1167
- const ir = or, cr = ar, nt = i.forwardRef(
1168
- ({ className: e, align: t = "center", sideOffset: n = 4, ...r }, o) => /* @__PURE__ */ u(sr, { children: /* @__PURE__ */ u(
1169
- tt,
1170
- {
1171
- ref: o,
1172
- align: t,
1173
- sideOffset: n,
1174
- className: Y(
1175
- "z-[100] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1176
- e
1177
- ),
1178
- ...r
1179
- }
1180
- ) })
1181
- );
1182
- nt.displayName = tt.displayName;
1183
- const br = ({ value: e, onChange: t, placeholder: n = "Selectionner une periode", className: r }) => {
1184
- const [o, a] = i.useState(!1), [c, s] = i.useState(e);
1185
- i.useEffect(() => {
1186
- o && s(e);
1187
- }, [o, e]);
1188
- const l = (f) => {
1189
- f.stopPropagation(), t(void 0), a(!1);
1190
- }, d = () => {
1191
- t(c), a(!1);
1192
- }, m = () => {
1193
- s(e), a(!1);
1194
- }, v = () => {
1195
- s(void 0);
1196
- }, h = (f) => f != null && f.from ? !f.to || f.from.getTime() === f.to.getTime() ? Z(f.from, "dd MMM yyyy", { locale: Q }) : `${Z(f.from, "dd MMM yyyy", { locale: Q })} - ${Z(f.to, "dd MMM yyyy", { locale: Q })}` : n;
1197
- return /* @__PURE__ */ u("div", { className: Y("grid gap-2", r), children: /* @__PURE__ */ D(ir, { open: o, onOpenChange: a, children: [
1198
- /* @__PURE__ */ u(cr, { asChild: !0, children: /* @__PURE__ */ D(j, { id: "date", variant: "outline", className: Y("w-[300px] justify-start text-left font-normal", !(e != null && e.from) && "text-muted-foreground"), children: [
1199
- /* @__PURE__ */ u(Wt, { className: "mr-2 size-4" }),
1200
- h(e),
1201
- (e == null ? void 0 : e.from) && /* @__PURE__ */ u(
1202
- j,
1203
- {
1204
- type: "button",
1205
- variant: "ghost",
1206
- size: "icon",
1207
- "aria-label": "Effacer la periode selectionnee",
1208
- className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
1209
- onClick: l,
1210
- children: /* @__PURE__ */ u(Ce, { className: "size-4" })
1211
- }
1212
- )
1213
- ] }) }),
1214
- /* @__PURE__ */ D(nt, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
1215
- /* @__PURE__ */ u(
1216
- Pt,
1217
- {
1218
- mode: "range",
1219
- defaultMonth: c == null ? void 0 : c.from,
1220
- selected: c,
1221
- onSelect: s,
1222
- numberOfMonths: 2,
1223
- weekStartsOn: 1,
1224
- className: "pointer-events-auto p-3"
1225
- }
1226
- ),
1227
- /* @__PURE__ */ D("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
1228
- /* @__PURE__ */ u(j, { variant: "ghost", size: "sm", onClick: v, children: "Effacer" }),
1229
- /* @__PURE__ */ D("div", { className: "flex gap-2", children: [
1230
- /* @__PURE__ */ u(j, { variant: "ghost", size: "sm", onClick: m, children: "Annuler" }),
1231
- /* @__PURE__ */ u(j, { size: "sm", onClick: d, children: "Appliquer" })
1232
- ] })
1233
- ] })
1234
- ] })
1235
- ] }) });
1236
- };
1237
- export {
1238
- br as D,
1239
- yr as S
1240
- };