@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,2216 +0,0 @@
1
- import { jsxs as A, jsx as a } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import ue, { useState as re, useRef as he, useMemo as Pe, useCallback as $e } from "react";
4
- import { B as ge, d as Ie, h as xe, u as j, i as $n, f as P, j as ae, g as Un, k as Gn, o as zn, s as Kn, l as Bn, m as Wn, n as Vn, p as jn, q as Hn, r as Yn, a as we, v as Ke, e as ut, w as lt } from "./floating-ui.react-dom-BPCyLQfI.js";
5
- import { a as Xn, b as dt, C as ft } from "./checkbox-BI6Lm_p-.js";
6
- import * as qn from "react-dom";
7
- import Zn from "react-dom";
8
- import { b as pt, a as Jn, R as Qn, h as er, C as tr } from "./Combination-CzdDhqdB.js";
9
- import { c as se } from "./index-gWiv5-6R.js";
10
- import { c as le } from "./createLucideIcon-CRdjzt2A.js";
11
- import { L as nr } from "./loader-circle-BhJXKs31.js";
12
- /**
13
- * @license lucide-react v1.16.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */
18
- const rr = [
19
- ["path", { d: "M12 5v14", key: "s699le" }],
20
- ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
21
- ], or = le("arrow-down", rr);
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 ar = [
29
- ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
30
- ["path", { d: "M17 20V4", key: "1ejh1v" }],
31
- ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
32
- ["path", { d: "M7 4v16", key: "1glfcx" }]
33
- ], sr = le("arrow-up-down", ar);
34
- /**
35
- * @license lucide-react v1.16.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */
40
- const ir = [
41
- ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
42
- ["path", { d: "M12 19V5", key: "x0mq9r" }]
43
- ], cr = le("arrow-up", ir);
44
- /**
45
- * @license lucide-react v1.16.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */
50
- const ur = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], lr = le("circle", ur);
51
- /**
52
- * @license lucide-react v1.16.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */
57
- const dr = [
58
- ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
59
- ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
60
- ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
61
- ], fr = le("ellipsis-vertical", dr);
62
- /**
63
- * @license lucide-react v1.16.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */
68
- const pr = [
69
- ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
70
- ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
71
- ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
72
- ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
73
- ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
74
- ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
75
- ], mr = le("grip-vertical", pr);
76
- /**
77
- * @license lucide-react v1.16.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */
82
- const hr = [
83
- [
84
- "path",
85
- {
86
- d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
87
- key: "1i5ecw"
88
- }
89
- ],
90
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
91
- ], gr = le("settings", hr);
92
- function vr({ data: e, columns: t, getRowId: n, defaultPageSize: r, actions: o, bulkActions: s, columnVisibility: l = !0 }) {
93
- var ve;
94
- const [c, p] = re(((ve = t.find((b) => b.sortable === !0)) == null ? void 0 : ve.key) ?? null), [u, d] = re("asc"), [f, m] = re([]), [w, C] = re(new Set(t.filter((b) => b.defaultVisible !== !1).map((b) => b.key))), [h, y] = re(t.map((b) => b.key)), [v, M] = re(t.reduce((b, R) => ({ ...b, [R.key]: R.minWidth ?? 100 }), {})), [g, N] = re(1), [_, I] = re(r), S = he(null), E = he(null), L = he(0), k = he(0), $ = he(null), Y = he(null), W = o !== void 0 && o.length > 0, J = s !== void 0 && s.length > 0, X = Pe(() => h.map((b) => t.find((R) => R.key === b)).filter((b) => b !== void 0), [h, t]), U = Pe(() => X.filter((b) => w.has(b.key)), [X, w]), ee = U.length + (J ? 1 : 0) + (W || l ? 1 : 0), F = Math.max(1, Math.ceil(e.length / _)), x = g > F ? F : g, D = e.length === 0 ? 0 : (x - 1) * _, T = Math.min(D + _, e.length), V = (b) => {
95
- const R = t.find((O) => O.key === b);
96
- (R == null ? void 0 : R.sortable) === !0 && (c === b ? d(u === "asc" ? "desc" : "asc") : (p(b), d("asc")), N(1));
97
- }, q = $e((b) => {
98
- const R = E.current;
99
- if (R === null) return;
100
- const O = b.clientX - L.current, H = Math.max(80, k.current + O);
101
- M((G) => ({
102
- ...G,
103
- [R]: H
104
- }));
105
- }, []), ne = $e(
106
- function b() {
107
- E.current = null, document.removeEventListener("mousemove", q), document.removeEventListener("mouseup", b);
108
- },
109
- [q]
110
- ), pe = $e(
111
- (b, R) => {
112
- b.preventDefault(), b.stopPropagation(), E.current = R, L.current = b.clientX, k.current = v[R], document.addEventListener("mousemove", q), document.addEventListener("mouseup", ne);
113
- },
114
- [v, q, ne]
115
- ), te = (b, R) => {
116
- $.current = R, b.dataTransfer.effectAllowed = "move", b.dataTransfer.setData("text/html", R);
117
- }, Q = (b, R) => {
118
- b.preventDefault(), b.dataTransfer.dropEffect = "move", Y.current = R;
119
- }, ie = (b, R) => {
120
- if (b.preventDefault(), $.current === null || $.current === R) return;
121
- const O = [...h], H = O.indexOf($.current), G = O.indexOf(R);
122
- O.splice(H, 1), O.splice(G, 0, $.current), y(O), $.current = null, Y.current = null;
123
- }, z = Pe(() => [...e].sort((b, R) => {
124
- if (c === null) return 0;
125
- const O = t.find((Re) => Re.key === c), H = (O == null ? void 0 : O.getSortValue) !== void 0 ? O.getSortValue(b) : b[c], G = (O == null ? void 0 : O.getSortValue) !== void 0 ? O.getSortValue(R) : R[c];
126
- if (typeof H == "string" && typeof G == "string") {
127
- const Re = H.localeCompare(G);
128
- return u === "asc" ? Re : -Re;
129
- }
130
- return H === G ? 0 : H == null ? 1 : G == null ? -1 : H < G ? u === "asc" ? -1 : 1 : H > G ? u === "asc" ? 1 : -1 : 0;
131
- }), [e, c, u, t]), ce = Pe(() => z.slice(D, T), [z, D, T]);
132
- return {
133
- sortColumn: c,
134
- sortDirection: u,
135
- selectedRows: f,
136
- setSelectedRows: m,
137
- visibleColumns: w,
138
- columnWidths: v,
139
- currentPage: g,
140
- setCurrentPage: N,
141
- pageSize: _,
142
- setPageSize: I,
143
- totalPages: F,
144
- safeCurrentPage: x,
145
- startIndex: D,
146
- endIndex: T,
147
- tableRef: S,
148
- hasActions: W,
149
- hasBulkActions: J,
150
- orderedColumns: X,
151
- visibleColumnsArray: U,
152
- colSpanCount: ee,
153
- paginatedData: ce,
154
- handleSort: V,
155
- handleMouseDown: pe,
156
- handleDragStart: te,
157
- handleDragOver: Q,
158
- handleDrop: ie,
159
- toggleColumnVisibility: (b) => {
160
- const R = new Set(w);
161
- R.has(b) ? R.delete(b) : R.add(b), C(R);
162
- },
163
- toggleRowSelection: (b) => {
164
- f.includes(b) ? m(f.filter((R) => R !== b)) : m([...f, b]);
165
- },
166
- toggleSelectAll: () => {
167
- f.length === e.length ? m([]) : m(e.map((b) => n(b)));
168
- }
169
- };
170
- }
171
- const mt = [5, 10, 30, 50, 100], yr = mt[1];
172
- function wr({
173
- totalItems: e,
174
- startIndex: t,
175
- endIndex: n,
176
- pageSize: r,
177
- setPageSize: o,
178
- currentPage: s,
179
- setCurrentPage: l,
180
- pageSizeOptions: c,
181
- totalPages: p
182
- }) {
183
- return /* @__PURE__ */ A("div", { className: "px-4 py-2 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between bg-card dark:bg-gray-950 flex-wrap gap-2", children: [
184
- /* @__PURE__ */ A("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
185
- e === 0 ? "0" : `${String(t + 1)} - ${String(n)}`,
186
- " sur ",
187
- e
188
- ] }),
189
- /* @__PURE__ */ A("div", { className: "flex items-center gap-4", children: [
190
- /* @__PURE__ */ A("div", { className: "flex items-center gap-2", children: [
191
- /* @__PURE__ */ a("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Lignes par page :" }),
192
- /* @__PURE__ */ a(
193
- "select",
194
- {
195
- value: r,
196
- onChange: (u) => {
197
- o(Number(u.target.value)), l(1);
198
- },
199
- className: "border border-gray-300 dark:border-gray-700 dark:bg-gray-900 rounded px-2 py-1 text-sm text-foreground",
200
- children: c.map((u) => /* @__PURE__ */ a("option", { value: u, children: u }, u))
201
- }
202
- )
203
- ] }),
204
- /* @__PURE__ */ A("div", { className: "flex items-center gap-2", children: [
205
- /* @__PURE__ */ a(
206
- ge,
207
- {
208
- variant: "outline",
209
- size: "sm",
210
- className: "h-8 w-8 p-0",
211
- onClick: () => {
212
- l((u) => Math.max(1, u - 1));
213
- },
214
- disabled: s === 1,
215
- children: /* @__PURE__ */ a(Xn, { className: "size-4" })
216
- }
217
- ),
218
- /* @__PURE__ */ A("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
219
- "Page ",
220
- s,
221
- " sur ",
222
- p
223
- ] }),
224
- /* @__PURE__ */ a(
225
- ge,
226
- {
227
- variant: "outline",
228
- size: "sm",
229
- className: "h-8 w-8 p-0",
230
- onClick: () => {
231
- l((u) => Math.min(p, u + 1));
232
- },
233
- disabled: s === p,
234
- children: /* @__PURE__ */ a(dt, { className: "size-4" })
235
- }
236
- )
237
- ] })
238
- ] })
239
- ] });
240
- }
241
- function br({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
242
- return /* @__PURE__ */ A("div", { className: "bg-muted/60 dark:bg-gray-900/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-lg", children: [
243
- /* @__PURE__ */ A("div", { className: "flex items-center gap-4", children: [
244
- /* @__PURE__ */ A("span", { className: "text-sm font-medium text-primary ml-1", children: [
245
- e.length,
246
- " sélectionné(s)"
247
- ] }),
248
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: n.map((r, o) => {
249
- const s = r.icon;
250
- return /* @__PURE__ */ A(
251
- ge,
252
- {
253
- variant: "outline",
254
- size: "sm",
255
- onClick: () => {
256
- r.onClick(e, () => {
257
- t([]);
258
- });
259
- },
260
- className: `h-7 bg-background shadow-sm text-xs px-2.5 ${r.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
261
- children: [
262
- s !== void 0 && /* @__PURE__ */ a("span", { className: "mr-1.5 flex items-center justify-center", children: /* @__PURE__ */ a(s, { className: "h-3.5 w-3.5" }) }),
263
- r.label
264
- ]
265
- },
266
- o
267
- );
268
- }) })
269
- ] }),
270
- /* @__PURE__ */ a(
271
- ge,
272
- {
273
- variant: "ghost",
274
- size: "sm",
275
- onClick: () => {
276
- t([]);
277
- },
278
- className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
279
- children: "Désélectionner"
280
- }
281
- )
282
- ] });
283
- }
284
- var Cr = [
285
- "a",
286
- "button",
287
- "div",
288
- "form",
289
- "h2",
290
- "h3",
291
- "img",
292
- "input",
293
- "label",
294
- "li",
295
- "nav",
296
- "ol",
297
- "p",
298
- "select",
299
- "span",
300
- "svg",
301
- "ul"
302
- ], K = Cr.reduce((e, t) => {
303
- const n = Ie(`Primitive.${t}`), r = i.forwardRef((o, s) => {
304
- const { asChild: l, ...c } = o, p = l ? n : t;
305
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ a(p, { ...c, ref: s });
306
- });
307
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
308
- }, {});
309
- function ht(e, t) {
310
- e && qn.flushSync(() => e.dispatchEvent(t));
311
- }
312
- function gt(e) {
313
- const t = e + "CollectionProvider", [n, r] = xe(t), [o, s] = n(
314
- t,
315
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
316
- ), l = (h) => {
317
- const { scope: y, children: v } = h, M = ue.useRef(null), g = ue.useRef(/* @__PURE__ */ new Map()).current;
318
- return /* @__PURE__ */ a(o, { scope: y, itemMap: g, collectionRef: M, children: v });
319
- };
320
- l.displayName = t;
321
- const c = e + "CollectionSlot", p = Ie(c), u = ue.forwardRef(
322
- (h, y) => {
323
- const { scope: v, children: M } = h, g = s(c, v), N = j(y, g.collectionRef);
324
- return /* @__PURE__ */ a(p, { ref: N, children: M });
325
- }
326
- );
327
- u.displayName = c;
328
- const d = e + "CollectionItemSlot", f = "data-radix-collection-item", m = Ie(d), w = ue.forwardRef(
329
- (h, y) => {
330
- const { scope: v, children: M, ...g } = h, N = ue.useRef(null), _ = j(y, N), I = s(d, v);
331
- return ue.useEffect(() => (I.itemMap.set(N, { ref: N, ...g }), () => void I.itemMap.delete(N))), /* @__PURE__ */ a(m, { [f]: "", ref: _, children: M });
332
- }
333
- );
334
- w.displayName = d;
335
- function C(h) {
336
- const y = s(e + "CollectionConsumer", h);
337
- return ue.useCallback(() => {
338
- const M = y.collectionRef.current;
339
- if (!M) return [];
340
- const g = Array.from(M.querySelectorAll(`[${f}]`));
341
- return Array.from(y.itemMap.values()).sort(
342
- (I, S) => g.indexOf(I.ref.current) - g.indexOf(S.ref.current)
343
- );
344
- }, [y.collectionRef, y.itemMap]);
345
- }
346
- return [
347
- { Provider: l, Slot: u, ItemSlot: w },
348
- C,
349
- r
350
- ];
351
- }
352
- var xr = "DismissableLayer", Be = "dismissableLayer.update", Mr = "dismissableLayer.pointerDownOutside", Nr = "dismissableLayer.focusOutside", nt, vt = i.createContext({
353
- layers: /* @__PURE__ */ new Set(),
354
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
355
- branches: /* @__PURE__ */ new Set()
356
- }), yt = i.forwardRef(
357
- (e, t) => {
358
- const {
359
- disableOutsidePointerEvents: n = !1,
360
- onEscapeKeyDown: r,
361
- onPointerDownOutside: o,
362
- onFocusOutside: s,
363
- onInteractOutside: l,
364
- onDismiss: c,
365
- ...p
366
- } = e, u = i.useContext(vt), [d, f] = i.useState(null), m = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, w] = i.useState({}), C = j(t, (S) => f(S)), h = Array.from(u.layers), [y] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), v = h.indexOf(y), M = d ? h.indexOf(d) : -1, g = u.layersWithOutsidePointerEventsDisabled.size > 0, N = M >= v, _ = Rr((S) => {
367
- const E = S.target, L = [...u.branches].some((k) => k.contains(E));
368
- !N || L || (o == null || o(S), l == null || l(S), S.defaultPrevented || c == null || c());
369
- }, m), I = Pr((S) => {
370
- const E = S.target;
371
- [...u.branches].some((k) => k.contains(E)) || (s == null || s(S), l == null || l(S), S.defaultPrevented || c == null || c());
372
- }, m);
373
- return $n((S) => {
374
- M === u.layers.size - 1 && (r == null || r(S), !S.defaultPrevented && c && (S.preventDefault(), c()));
375
- }, m), i.useEffect(() => {
376
- if (d)
377
- return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (nt = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(d)), u.layers.add(d), rt(), () => {
378
- n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = nt);
379
- };
380
- }, [d, m, n, u]), i.useEffect(() => () => {
381
- d && (u.layers.delete(d), u.layersWithOutsidePointerEventsDisabled.delete(d), rt());
382
- }, [d, u]), i.useEffect(() => {
383
- const S = () => w({});
384
- return document.addEventListener(Be, S), () => document.removeEventListener(Be, S);
385
- }, []), /* @__PURE__ */ a(
386
- K.div,
387
- {
388
- ...p,
389
- ref: C,
390
- style: {
391
- pointerEvents: g ? N ? "auto" : "none" : void 0,
392
- ...e.style
393
- },
394
- onFocusCapture: P(e.onFocusCapture, I.onFocusCapture),
395
- onBlurCapture: P(e.onBlurCapture, I.onBlurCapture),
396
- onPointerDownCapture: P(
397
- e.onPointerDownCapture,
398
- _.onPointerDownCapture
399
- )
400
- }
401
- );
402
- }
403
- );
404
- yt.displayName = xr;
405
- var Er = "DismissableLayerBranch", Sr = i.forwardRef((e, t) => {
406
- const n = i.useContext(vt), r = i.useRef(null), o = j(t, r);
407
- return i.useEffect(() => {
408
- const s = r.current;
409
- if (s)
410
- return n.branches.add(s), () => {
411
- n.branches.delete(s);
412
- };
413
- }, [n.branches]), /* @__PURE__ */ a(K.div, { ...e, ref: o });
414
- });
415
- Sr.displayName = Er;
416
- function Rr(e, t = globalThis == null ? void 0 : globalThis.document) {
417
- const n = ae(e), r = i.useRef(!1), o = i.useRef(() => {
418
- });
419
- return i.useEffect(() => {
420
- const s = (c) => {
421
- if (c.target && !r.current) {
422
- let p = function() {
423
- wt(
424
- Mr,
425
- n,
426
- u,
427
- { discrete: !0 }
428
- );
429
- };
430
- const u = { originalEvent: c };
431
- c.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = p, t.addEventListener("click", o.current, { once: !0 })) : p();
432
- } else
433
- t.removeEventListener("click", o.current);
434
- r.current = !1;
435
- }, l = window.setTimeout(() => {
436
- t.addEventListener("pointerdown", s);
437
- }, 0);
438
- return () => {
439
- window.clearTimeout(l), t.removeEventListener("pointerdown", s), t.removeEventListener("click", o.current);
440
- };
441
- }, [t, n]), {
442
- // ensures we check React component tree (not just DOM tree)
443
- onPointerDownCapture: () => r.current = !0
444
- };
445
- }
446
- function Pr(e, t = globalThis == null ? void 0 : globalThis.document) {
447
- const n = ae(e), r = i.useRef(!1);
448
- return i.useEffect(() => {
449
- const o = (s) => {
450
- s.target && !r.current && wt(Nr, n, { originalEvent: s }, {
451
- discrete: !1
452
- });
453
- };
454
- return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
455
- }, [t, n]), {
456
- onFocusCapture: () => r.current = !0,
457
- onBlurCapture: () => r.current = !1
458
- };
459
- }
460
- function rt() {
461
- const e = new CustomEvent(Be);
462
- document.dispatchEvent(e);
463
- }
464
- function wt(e, t, n, { discrete: r }) {
465
- const o = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
466
- t && o.addEventListener(e, t, { once: !0 }), r ? ht(o, s) : o.dispatchEvent(s);
467
- }
468
- var Ue = "focusScope.autoFocusOnMount", Ge = "focusScope.autoFocusOnUnmount", ot = { bubbles: !1, cancelable: !0 }, _r = "FocusScope", bt = i.forwardRef((e, t) => {
469
- const {
470
- loop: n = !1,
471
- trapped: r = !1,
472
- onMountAutoFocus: o,
473
- onUnmountAutoFocus: s,
474
- ...l
475
- } = e, [c, p] = i.useState(null), u = ae(o), d = ae(s), f = i.useRef(null), m = j(t, (h) => p(h)), w = i.useRef({
476
- paused: !1,
477
- pause() {
478
- this.paused = !0;
479
- },
480
- resume() {
481
- this.paused = !1;
482
- }
483
- }).current;
484
- i.useEffect(() => {
485
- if (r) {
486
- let h = function(g) {
487
- if (w.paused || !c) return;
488
- const N = g.target;
489
- c.contains(N) ? f.current = N : oe(f.current, { select: !0 });
490
- }, y = function(g) {
491
- if (w.paused || !c) return;
492
- const N = g.relatedTarget;
493
- N !== null && (c.contains(N) || oe(f.current, { select: !0 }));
494
- }, v = function(g) {
495
- if (document.activeElement === document.body)
496
- for (const _ of g)
497
- _.removedNodes.length > 0 && oe(c);
498
- };
499
- document.addEventListener("focusin", h), document.addEventListener("focusout", y);
500
- const M = new MutationObserver(v);
501
- return c && M.observe(c, { childList: !0, subtree: !0 }), () => {
502
- document.removeEventListener("focusin", h), document.removeEventListener("focusout", y), M.disconnect();
503
- };
504
- }
505
- }, [r, c, w.paused]), i.useEffect(() => {
506
- if (c) {
507
- st.add(w);
508
- const h = document.activeElement;
509
- if (!c.contains(h)) {
510
- const v = new CustomEvent(Ue, ot);
511
- c.addEventListener(Ue, u), c.dispatchEvent(v), v.defaultPrevented || (Ir(kr(Ct(c)), { select: !0 }), document.activeElement === h && oe(c));
512
- }
513
- return () => {
514
- c.removeEventListener(Ue, u), setTimeout(() => {
515
- const v = new CustomEvent(Ge, ot);
516
- c.addEventListener(Ge, d), c.dispatchEvent(v), v.defaultPrevented || oe(h ?? document.body, { select: !0 }), c.removeEventListener(Ge, d), st.remove(w);
517
- }, 0);
518
- };
519
- }
520
- }, [c, u, d, w]);
521
- const C = i.useCallback(
522
- (h) => {
523
- if (!n && !r || w.paused) return;
524
- const y = h.key === "Tab" && !h.altKey && !h.ctrlKey && !h.metaKey, v = document.activeElement;
525
- if (y && v) {
526
- const M = h.currentTarget, [g, N] = Ar(M);
527
- g && N ? !h.shiftKey && v === N ? (h.preventDefault(), n && oe(g, { select: !0 })) : h.shiftKey && v === g && (h.preventDefault(), n && oe(N, { select: !0 })) : v === M && h.preventDefault();
528
- }
529
- },
530
- [n, r, w.paused]
531
- );
532
- return /* @__PURE__ */ a(K.div, { tabIndex: -1, ...l, ref: m, onKeyDown: C });
533
- });
534
- bt.displayName = _r;
535
- function Ir(e, { select: t = !1 } = {}) {
536
- const n = document.activeElement;
537
- for (const r of e)
538
- if (oe(r, { select: t }), document.activeElement !== n) return;
539
- }
540
- function Ar(e) {
541
- const t = Ct(e), n = at(t, e), r = at(t.reverse(), e);
542
- return [n, r];
543
- }
544
- function Ct(e) {
545
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
546
- acceptNode: (r) => {
547
- const o = r.tagName === "INPUT" && r.type === "hidden";
548
- return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
549
- }
550
- });
551
- for (; n.nextNode(); ) t.push(n.currentNode);
552
- return t;
553
- }
554
- function at(e, t) {
555
- for (const n of e)
556
- if (!Dr(n, { upTo: t })) return n;
557
- }
558
- function Dr(e, { upTo: t }) {
559
- if (getComputedStyle(e).visibility === "hidden") return !0;
560
- for (; e; ) {
561
- if (t !== void 0 && e === t) return !1;
562
- if (getComputedStyle(e).display === "none") return !0;
563
- e = e.parentElement;
564
- }
565
- return !1;
566
- }
567
- function Tr(e) {
568
- return e instanceof HTMLInputElement && "select" in e;
569
- }
570
- function oe(e, { select: t = !1 } = {}) {
571
- if (e && e.focus) {
572
- const n = document.activeElement;
573
- e.focus({ preventScroll: !0 }), e !== n && Tr(e) && t && e.select();
574
- }
575
- }
576
- var st = Or();
577
- function Or() {
578
- let e = [];
579
- return {
580
- add(t) {
581
- const n = e[0];
582
- t !== n && (n == null || n.pause()), e = it(e, t), e.unshift(t);
583
- },
584
- remove(t) {
585
- var n;
586
- e = it(e, t), (n = e[0]) == null || n.resume();
587
- }
588
- };
589
- }
590
- function it(e, t) {
591
- const n = [...e], r = n.indexOf(t);
592
- return r !== -1 && n.splice(r, 1), n;
593
- }
594
- function kr(e) {
595
- return e.filter((t) => t.tagName !== "A");
596
- }
597
- var Fr = "Arrow", xt = i.forwardRef((e, t) => {
598
- const { children: n, width: r = 10, height: o = 5, ...s } = e;
599
- return /* @__PURE__ */ a(
600
- K.svg,
601
- {
602
- ...s,
603
- ref: t,
604
- width: r,
605
- height: o,
606
- viewBox: "0 0 30 10",
607
- preserveAspectRatio: "none",
608
- children: e.asChild ? n : /* @__PURE__ */ a("polygon", { points: "0,0 30,0 15,10" })
609
- }
610
- );
611
- });
612
- xt.displayName = Fr;
613
- var Lr = xt, je = "Popper", [Mt, Nt] = xe(je), [$r, Et] = Mt(je), St = (e) => {
614
- const { __scopePopper: t, children: n } = e, [r, o] = i.useState(null);
615
- return /* @__PURE__ */ a($r, { scope: t, anchor: r, onAnchorChange: o, children: n });
616
- };
617
- St.displayName = je;
618
- var Rt = "PopperAnchor", Pt = i.forwardRef(
619
- (e, t) => {
620
- const { __scopePopper: n, virtualRef: r, ...o } = e, s = Et(Rt, n), l = i.useRef(null), c = j(t, l), p = i.useRef(null);
621
- return i.useEffect(() => {
622
- const u = p.current;
623
- p.current = (r == null ? void 0 : r.current) || l.current, u !== p.current && s.onAnchorChange(p.current);
624
- }), r ? null : /* @__PURE__ */ a(K.div, { ...o, ref: c });
625
- }
626
- );
627
- Pt.displayName = Rt;
628
- var He = "PopperContent", [Ur, Gr] = Mt(He), _t = i.forwardRef(
629
- (e, t) => {
630
- var Q, ie, z, ce, Fe, Le;
631
- const {
632
- __scopePopper: n,
633
- side: r = "bottom",
634
- sideOffset: o = 0,
635
- align: s = "center",
636
- alignOffset: l = 0,
637
- arrowPadding: c = 0,
638
- avoidCollisions: p = !0,
639
- collisionBoundary: u = [],
640
- collisionPadding: d = 0,
641
- sticky: f = "partial",
642
- hideWhenDetached: m = !1,
643
- updatePositionStrategy: w = "optimized",
644
- onPlaced: C,
645
- ...h
646
- } = e, y = Et(He, n), [v, M] = i.useState(null), g = j(t, (me) => M(me)), [N, _] = i.useState(null), I = Un(N), S = (I == null ? void 0 : I.width) ?? 0, E = (I == null ? void 0 : I.height) ?? 0, L = r + (s !== "center" ? "-" + s : ""), k = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, $ = Array.isArray(u) ? u : [u], Y = $.length > 0, W = {
647
- padding: k,
648
- boundary: $.filter(Kr),
649
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
650
- altBoundary: Y
651
- }, { refs: J, floatingStyles: X, placement: U, isPositioned: ee, middlewareData: F } = Gn({
652
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
653
- strategy: "fixed",
654
- placement: L,
655
- whileElementsMounted: (...me) => Yn(...me, {
656
- animationFrame: w === "always"
657
- }),
658
- elements: {
659
- reference: y.anchor
660
- },
661
- middleware: [
662
- zn({ mainAxis: o + E, alignmentAxis: l }),
663
- p && Kn({
664
- mainAxis: !0,
665
- crossAxis: !1,
666
- limiter: f === "partial" ? Bn() : void 0,
667
- ...W
668
- }),
669
- p && Wn({ ...W }),
670
- Vn({
671
- ...W,
672
- apply: ({ elements: me, rects: ve, availableWidth: b, availableHeight: R }) => {
673
- const { width: O, height: H } = ve.reference, G = me.floating.style;
674
- G.setProperty("--radix-popper-available-width", `${b}px`), G.setProperty("--radix-popper-available-height", `${R}px`), G.setProperty("--radix-popper-anchor-width", `${O}px`), G.setProperty("--radix-popper-anchor-height", `${H}px`);
675
- }
676
- }),
677
- N && jn({ element: N, padding: c }),
678
- Br({ arrowWidth: S, arrowHeight: E }),
679
- m && Hn({ strategy: "referenceHidden", ...W })
680
- ]
681
- }), [x, D] = Dt(U), T = ae(C);
682
- we(() => {
683
- ee && (T == null || T());
684
- }, [ee, T]);
685
- const V = (Q = F.arrow) == null ? void 0 : Q.x, q = (ie = F.arrow) == null ? void 0 : ie.y, ne = ((z = F.arrow) == null ? void 0 : z.centerOffset) !== 0, [pe, te] = i.useState();
686
- return we(() => {
687
- v && te(window.getComputedStyle(v).zIndex);
688
- }, [v]), /* @__PURE__ */ a(
689
- "div",
690
- {
691
- ref: J.setFloating,
692
- "data-radix-popper-content-wrapper": "",
693
- style: {
694
- ...X,
695
- transform: ee ? X.transform : "translate(0, -200%)",
696
- // keep off the page when measuring
697
- minWidth: "max-content",
698
- zIndex: pe,
699
- "--radix-popper-transform-origin": [
700
- (ce = F.transformOrigin) == null ? void 0 : ce.x,
701
- (Fe = F.transformOrigin) == null ? void 0 : Fe.y
702
- ].join(" "),
703
- // hide the content if using the hide middleware and should be hidden
704
- // set visibility to hidden and disable pointer events so the UI behaves
705
- // as if the PopperContent isn't there at all
706
- ...((Le = F.hide) == null ? void 0 : Le.referenceHidden) && {
707
- visibility: "hidden",
708
- pointerEvents: "none"
709
- }
710
- },
711
- dir: e.dir,
712
- children: /* @__PURE__ */ a(
713
- Ur,
714
- {
715
- scope: n,
716
- placedSide: x,
717
- onArrowChange: _,
718
- arrowX: V,
719
- arrowY: q,
720
- shouldHideArrow: ne,
721
- children: /* @__PURE__ */ a(
722
- K.div,
723
- {
724
- "data-side": x,
725
- "data-align": D,
726
- ...h,
727
- ref: g,
728
- style: {
729
- ...h.style,
730
- // if the PopperContent hasn't been placed yet (not all measurements done)
731
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
732
- animation: ee ? void 0 : "none"
733
- }
734
- }
735
- )
736
- }
737
- )
738
- }
739
- );
740
- }
741
- );
742
- _t.displayName = He;
743
- var It = "PopperArrow", zr = {
744
- top: "bottom",
745
- right: "left",
746
- bottom: "top",
747
- left: "right"
748
- }, At = i.forwardRef(function(t, n) {
749
- const { __scopePopper: r, ...o } = t, s = Gr(It, r), l = zr[s.placedSide];
750
- return (
751
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
752
- // doesn't report size as we'd expect on SVG elements.
753
- // it reports their bounding box which is effectively the largest path inside the SVG.
754
- /* @__PURE__ */ a(
755
- "span",
756
- {
757
- ref: s.onArrowChange,
758
- style: {
759
- position: "absolute",
760
- left: s.arrowX,
761
- top: s.arrowY,
762
- [l]: 0,
763
- transformOrigin: {
764
- top: "",
765
- right: "0 0",
766
- bottom: "center 0",
767
- left: "100% 0"
768
- }[s.placedSide],
769
- transform: {
770
- top: "translateY(100%)",
771
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
772
- bottom: "rotate(180deg)",
773
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
774
- }[s.placedSide],
775
- visibility: s.shouldHideArrow ? "hidden" : void 0
776
- },
777
- children: /* @__PURE__ */ a(
778
- Lr,
779
- {
780
- ...o,
781
- ref: n,
782
- style: {
783
- ...o.style,
784
- // ensures the element can be measured correctly (mostly for if SVG)
785
- display: "block"
786
- }
787
- }
788
- )
789
- }
790
- )
791
- );
792
- });
793
- At.displayName = It;
794
- function Kr(e) {
795
- return e !== null;
796
- }
797
- var Br = (e) => ({
798
- name: "transformOrigin",
799
- options: e,
800
- fn(t) {
801
- var y, v, M;
802
- const { placement: n, rects: r, middlewareData: o } = t, l = ((y = o.arrow) == null ? void 0 : y.centerOffset) !== 0, c = l ? 0 : e.arrowWidth, p = l ? 0 : e.arrowHeight, [u, d] = Dt(n), f = { start: "0%", center: "50%", end: "100%" }[d], m = (((v = o.arrow) == null ? void 0 : v.x) ?? 0) + c / 2, w = (((M = o.arrow) == null ? void 0 : M.y) ?? 0) + p / 2;
803
- let C = "", h = "";
804
- return u === "bottom" ? (C = l ? f : `${m}px`, h = `${-p}px`) : u === "top" ? (C = l ? f : `${m}px`, h = `${r.floating.height + p}px`) : u === "right" ? (C = `${-p}px`, h = l ? f : `${w}px`) : u === "left" && (C = `${r.floating.width + p}px`, h = l ? f : `${w}px`), { data: { x: C, y: h } };
805
- }
806
- });
807
- function Dt(e) {
808
- const [t, n = "center"] = e.split("-");
809
- return [t, n];
810
- }
811
- var Wr = St, Vr = Pt, jr = _t, Hr = At, Yr = "Portal", Tt = i.forwardRef((e, t) => {
812
- var c;
813
- const { container: n, ...r } = e, [o, s] = i.useState(!1);
814
- we(() => s(!0), []);
815
- const l = n || o && ((c = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : c.body);
816
- return l ? Zn.createPortal(/* @__PURE__ */ a(K.div, { ...r, ref: t }), l) : null;
817
- });
818
- Tt.displayName = Yr;
819
- function Xr(e, t) {
820
- return i.useReducer((n, r) => t[n][r] ?? n, e);
821
- }
822
- var Me = (e) => {
823
- const { present: t, children: n } = e, r = qr(t), o = typeof n == "function" ? n({ present: r.isPresent }) : i.Children.only(n), s = j(r.ref, Zr(o));
824
- return typeof n == "function" || r.isPresent ? i.cloneElement(o, { ref: s }) : null;
825
- };
826
- Me.displayName = "Presence";
827
- function qr(e) {
828
- const [t, n] = i.useState(), r = i.useRef(null), o = i.useRef(e), s = i.useRef("none"), l = e ? "mounted" : "unmounted", [c, p] = Xr(l, {
829
- mounted: {
830
- UNMOUNT: "unmounted",
831
- ANIMATION_OUT: "unmountSuspended"
832
- },
833
- unmountSuspended: {
834
- MOUNT: "mounted",
835
- ANIMATION_END: "unmounted"
836
- },
837
- unmounted: {
838
- MOUNT: "mounted"
839
- }
840
- });
841
- return i.useEffect(() => {
842
- const u = _e(r.current);
843
- s.current = c === "mounted" ? u : "none";
844
- }, [c]), we(() => {
845
- const u = r.current, d = o.current;
846
- if (d !== e) {
847
- const m = s.current, w = _e(u);
848
- e ? p("MOUNT") : w === "none" || (u == null ? void 0 : u.display) === "none" ? p("UNMOUNT") : p(d && m !== w ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
849
- }
850
- }, [e, p]), we(() => {
851
- if (t) {
852
- let u;
853
- const d = t.ownerDocument.defaultView ?? window, f = (w) => {
854
- const h = _e(r.current).includes(CSS.escape(w.animationName));
855
- if (w.target === t && h && (p("ANIMATION_END"), !o.current)) {
856
- const y = t.style.animationFillMode;
857
- t.style.animationFillMode = "forwards", u = d.setTimeout(() => {
858
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = y);
859
- });
860
- }
861
- }, m = (w) => {
862
- w.target === t && (s.current = _e(r.current));
863
- };
864
- return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
865
- d.clearTimeout(u), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
866
- };
867
- } else
868
- p("ANIMATION_END");
869
- }, [t, p]), {
870
- isPresent: ["mounted", "unmountSuspended"].includes(c),
871
- ref: i.useCallback((u) => {
872
- r.current = u ? getComputedStyle(u) : null, n(u);
873
- }, [])
874
- };
875
- }
876
- function _e(e) {
877
- return (e == null ? void 0 : e.animationName) || "none";
878
- }
879
- function Zr(e) {
880
- var r, o;
881
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
882
- 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);
883
- }
884
- var ze = "rovingFocusGroup.onEntryFocus", Jr = { bubbles: !1, cancelable: !0 }, Ne = "RovingFocusGroup", [We, Ot, Qr] = gt(Ne), [eo, kt] = xe(
885
- Ne,
886
- [Qr]
887
- ), [to, no] = eo(Ne), Ft = i.forwardRef(
888
- (e, t) => /* @__PURE__ */ a(We.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(We.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(ro, { ...e, ref: t }) }) })
889
- );
890
- Ft.displayName = Ne;
891
- var ro = i.forwardRef((e, t) => {
892
- const {
893
- __scopeRovingFocusGroup: n,
894
- orientation: r,
895
- loop: o = !1,
896
- dir: s,
897
- currentTabStopId: l,
898
- defaultCurrentTabStopId: c,
899
- onCurrentTabStopIdChange: p,
900
- onEntryFocus: u,
901
- preventScrollOnEntryFocus: d = !1,
902
- ...f
903
- } = e, m = i.useRef(null), w = j(t, m), C = pt(s), [h, y] = ut({
904
- prop: l,
905
- defaultProp: c ?? null,
906
- onChange: p,
907
- caller: Ne
908
- }), [v, M] = i.useState(!1), g = ae(u), N = Ot(n), _ = i.useRef(!1), [I, S] = i.useState(0);
909
- return i.useEffect(() => {
910
- const E = m.current;
911
- if (E)
912
- return E.addEventListener(ze, g), () => E.removeEventListener(ze, g);
913
- }, [g]), /* @__PURE__ */ a(
914
- to,
915
- {
916
- scope: n,
917
- orientation: r,
918
- dir: C,
919
- loop: o,
920
- currentTabStopId: h,
921
- onItemFocus: i.useCallback(
922
- (E) => y(E),
923
- [y]
924
- ),
925
- onItemShiftTab: i.useCallback(() => M(!0), []),
926
- onFocusableItemAdd: i.useCallback(
927
- () => S((E) => E + 1),
928
- []
929
- ),
930
- onFocusableItemRemove: i.useCallback(
931
- () => S((E) => E - 1),
932
- []
933
- ),
934
- children: /* @__PURE__ */ a(
935
- K.div,
936
- {
937
- tabIndex: v || I === 0 ? -1 : 0,
938
- "data-orientation": r,
939
- ...f,
940
- ref: w,
941
- style: { outline: "none", ...e.style },
942
- onMouseDown: P(e.onMouseDown, () => {
943
- _.current = !0;
944
- }),
945
- onFocus: P(e.onFocus, (E) => {
946
- const L = !_.current;
947
- if (E.target === E.currentTarget && L && !v) {
948
- const k = new CustomEvent(ze, Jr);
949
- if (E.currentTarget.dispatchEvent(k), !k.defaultPrevented) {
950
- const $ = N().filter((U) => U.focusable), Y = $.find((U) => U.active), W = $.find((U) => U.id === h), X = [Y, W, ...$].filter(
951
- Boolean
952
- ).map((U) => U.ref.current);
953
- Ut(X, d);
954
- }
955
- }
956
- _.current = !1;
957
- }),
958
- onBlur: P(e.onBlur, () => M(!1))
959
- }
960
- )
961
- }
962
- );
963
- }), Lt = "RovingFocusGroupItem", $t = i.forwardRef(
964
- (e, t) => {
965
- const {
966
- __scopeRovingFocusGroup: n,
967
- focusable: r = !0,
968
- active: o = !1,
969
- tabStopId: s,
970
- children: l,
971
- ...c
972
- } = e, p = Ke(), u = s || p, d = no(Lt, n), f = d.currentTabStopId === u, m = Ot(n), { onFocusableItemAdd: w, onFocusableItemRemove: C, currentTabStopId: h } = d;
973
- return i.useEffect(() => {
974
- if (r)
975
- return w(), () => C();
976
- }, [r, w, C]), /* @__PURE__ */ a(
977
- We.ItemSlot,
978
- {
979
- scope: n,
980
- id: u,
981
- focusable: r,
982
- active: o,
983
- children: /* @__PURE__ */ a(
984
- K.span,
985
- {
986
- tabIndex: f ? 0 : -1,
987
- "data-orientation": d.orientation,
988
- ...c,
989
- ref: t,
990
- onMouseDown: P(e.onMouseDown, (y) => {
991
- r ? d.onItemFocus(u) : y.preventDefault();
992
- }),
993
- onFocus: P(e.onFocus, () => d.onItemFocus(u)),
994
- onKeyDown: P(e.onKeyDown, (y) => {
995
- if (y.key === "Tab" && y.shiftKey) {
996
- d.onItemShiftTab();
997
- return;
998
- }
999
- if (y.target !== y.currentTarget) return;
1000
- const v = so(y, d.orientation, d.dir);
1001
- if (v !== void 0) {
1002
- if (y.metaKey || y.ctrlKey || y.altKey || y.shiftKey) return;
1003
- y.preventDefault();
1004
- let g = m().filter((N) => N.focusable).map((N) => N.ref.current);
1005
- if (v === "last") g.reverse();
1006
- else if (v === "prev" || v === "next") {
1007
- v === "prev" && g.reverse();
1008
- const N = g.indexOf(y.currentTarget);
1009
- g = d.loop ? io(g, N + 1) : g.slice(N + 1);
1010
- }
1011
- setTimeout(() => Ut(g));
1012
- }
1013
- }),
1014
- children: typeof l == "function" ? l({ isCurrentTabStop: f, hasTabStop: h != null }) : l
1015
- }
1016
- )
1017
- }
1018
- );
1019
- }
1020
- );
1021
- $t.displayName = Lt;
1022
- var oo = {
1023
- ArrowLeft: "prev",
1024
- ArrowUp: "prev",
1025
- ArrowRight: "next",
1026
- ArrowDown: "next",
1027
- PageUp: "first",
1028
- Home: "first",
1029
- PageDown: "last",
1030
- End: "last"
1031
- };
1032
- function ao(e, t) {
1033
- return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
1034
- }
1035
- function so(e, t, n) {
1036
- const r = ao(e.key, n);
1037
- if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
1038
- return oo[r];
1039
- }
1040
- function Ut(e, t = !1) {
1041
- const n = document.activeElement;
1042
- for (const r of e)
1043
- if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return;
1044
- }
1045
- function io(e, t) {
1046
- return e.map((n, r) => e[(t + r) % e.length]);
1047
- }
1048
- var co = Ft, uo = $t, Ve = ["Enter", " "], lo = ["ArrowDown", "PageUp", "Home"], Gt = ["ArrowUp", "PageDown", "End"], fo = [...lo, ...Gt], po = {
1049
- ltr: [...Ve, "ArrowRight"],
1050
- rtl: [...Ve, "ArrowLeft"]
1051
- }, mo = {
1052
- ltr: ["ArrowLeft"],
1053
- rtl: ["ArrowRight"]
1054
- }, Ee = "Menu", [be, ho, go] = gt(Ee), [de, zt] = xe(Ee, [
1055
- go,
1056
- Nt,
1057
- kt
1058
- ]), Te = Nt(), Kt = kt(), [vo, fe] = de(Ee), [yo, Se] = de(Ee), Bt = (e) => {
1059
- const { __scopeMenu: t, open: n = !1, children: r, dir: o, onOpenChange: s, modal: l = !0 } = e, c = Te(t), [p, u] = i.useState(null), d = i.useRef(!1), f = ae(s), m = pt(o);
1060
- return i.useEffect(() => {
1061
- const w = () => {
1062
- d.current = !0, document.addEventListener("pointerdown", C, { capture: !0, once: !0 }), document.addEventListener("pointermove", C, { capture: !0, once: !0 });
1063
- }, C = () => d.current = !1;
1064
- return document.addEventListener("keydown", w, { capture: !0 }), () => {
1065
- document.removeEventListener("keydown", w, { capture: !0 }), document.removeEventListener("pointerdown", C, { capture: !0 }), document.removeEventListener("pointermove", C, { capture: !0 });
1066
- };
1067
- }, []), /* @__PURE__ */ a(Wr, { ...c, children: /* @__PURE__ */ a(
1068
- vo,
1069
- {
1070
- scope: t,
1071
- open: n,
1072
- onOpenChange: f,
1073
- content: p,
1074
- onContentChange: u,
1075
- children: /* @__PURE__ */ a(
1076
- yo,
1077
- {
1078
- scope: t,
1079
- onClose: i.useCallback(() => f(!1), [f]),
1080
- isUsingKeyboardRef: d,
1081
- dir: m,
1082
- modal: l,
1083
- children: r
1084
- }
1085
- )
1086
- }
1087
- ) });
1088
- };
1089
- Bt.displayName = Ee;
1090
- var wo = "MenuAnchor", Ye = i.forwardRef(
1091
- (e, t) => {
1092
- const { __scopeMenu: n, ...r } = e, o = Te(n);
1093
- return /* @__PURE__ */ a(Vr, { ...o, ...r, ref: t });
1094
- }
1095
- );
1096
- Ye.displayName = wo;
1097
- var Xe = "MenuPortal", [bo, Wt] = de(Xe, {
1098
- forceMount: void 0
1099
- }), Vt = (e) => {
1100
- const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, s = fe(Xe, t);
1101
- return /* @__PURE__ */ a(bo, { scope: t, forceMount: n, children: /* @__PURE__ */ a(Me, { present: n || s.open, children: /* @__PURE__ */ a(Tt, { asChild: !0, container: o, children: r }) }) });
1102
- };
1103
- Vt.displayName = Xe;
1104
- var Z = "MenuContent", [Co, qe] = de(Z), jt = i.forwardRef(
1105
- (e, t) => {
1106
- const n = Wt(Z, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fe(Z, e.__scopeMenu), l = Se(Z, e.__scopeMenu);
1107
- return /* @__PURE__ */ a(be.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(Me, { present: r || s.open, children: /* @__PURE__ */ a(be.Slot, { scope: e.__scopeMenu, children: l.modal ? /* @__PURE__ */ a(xo, { ...o, ref: t }) : /* @__PURE__ */ a(Mo, { ...o, ref: t }) }) }) });
1108
- }
1109
- ), xo = i.forwardRef(
1110
- (e, t) => {
1111
- const n = fe(Z, e.__scopeMenu), r = i.useRef(null), o = j(t, r);
1112
- return i.useEffect(() => {
1113
- const s = r.current;
1114
- if (s) return er(s);
1115
- }, []), /* @__PURE__ */ a(
1116
- Ze,
1117
- {
1118
- ...e,
1119
- ref: o,
1120
- trapFocus: n.open,
1121
- disableOutsidePointerEvents: n.open,
1122
- disableOutsideScroll: !0,
1123
- onFocusOutside: P(
1124
- e.onFocusOutside,
1125
- (s) => s.preventDefault(),
1126
- { checkForDefaultPrevented: !1 }
1127
- ),
1128
- onDismiss: () => n.onOpenChange(!1)
1129
- }
1130
- );
1131
- }
1132
- ), Mo = i.forwardRef((e, t) => {
1133
- const n = fe(Z, e.__scopeMenu);
1134
- return /* @__PURE__ */ a(
1135
- Ze,
1136
- {
1137
- ...e,
1138
- ref: t,
1139
- trapFocus: !1,
1140
- disableOutsidePointerEvents: !1,
1141
- disableOutsideScroll: !1,
1142
- onDismiss: () => n.onOpenChange(!1)
1143
- }
1144
- );
1145
- }), No = Ie("MenuContent.ScrollLock"), Ze = i.forwardRef(
1146
- (e, t) => {
1147
- const {
1148
- __scopeMenu: n,
1149
- loop: r = !1,
1150
- trapFocus: o,
1151
- onOpenAutoFocus: s,
1152
- onCloseAutoFocus: l,
1153
- disableOutsidePointerEvents: c,
1154
- onEntryFocus: p,
1155
- onEscapeKeyDown: u,
1156
- onPointerDownOutside: d,
1157
- onFocusOutside: f,
1158
- onInteractOutside: m,
1159
- onDismiss: w,
1160
- disableOutsideScroll: C,
1161
- ...h
1162
- } = e, y = fe(Z, n), v = Se(Z, n), M = Te(n), g = Kt(n), N = ho(n), [_, I] = i.useState(null), S = i.useRef(null), E = j(t, S, y.onContentChange), L = i.useRef(0), k = i.useRef(""), $ = i.useRef(0), Y = i.useRef(null), W = i.useRef("right"), J = i.useRef(0), X = C ? Qn : i.Fragment, U = C ? { as: No, allowPinchZoom: !0 } : void 0, ee = (x) => {
1163
- var Q, ie;
1164
- const D = k.current + x, T = N().filter((z) => !z.disabled), V = document.activeElement, q = (Q = T.find((z) => z.ref.current === V)) == null ? void 0 : Q.textValue, ne = T.map((z) => z.textValue), pe = Fo(ne, D, q), te = (ie = T.find((z) => z.textValue === pe)) == null ? void 0 : ie.ref.current;
1165
- (function z(ce) {
1166
- k.current = ce, window.clearTimeout(L.current), ce !== "" && (L.current = window.setTimeout(() => z(""), 1e3));
1167
- })(D), te && setTimeout(() => te.focus());
1168
- };
1169
- i.useEffect(() => () => window.clearTimeout(L.current), []), Jn();
1170
- const F = i.useCallback((x) => {
1171
- var T, V;
1172
- return W.current === ((T = Y.current) == null ? void 0 : T.side) && $o(x, (V = Y.current) == null ? void 0 : V.area);
1173
- }, []);
1174
- return /* @__PURE__ */ a(
1175
- Co,
1176
- {
1177
- scope: n,
1178
- searchRef: k,
1179
- onItemEnter: i.useCallback(
1180
- (x) => {
1181
- F(x) && x.preventDefault();
1182
- },
1183
- [F]
1184
- ),
1185
- onItemLeave: i.useCallback(
1186
- (x) => {
1187
- var D;
1188
- F(x) || ((D = S.current) == null || D.focus(), I(null));
1189
- },
1190
- [F]
1191
- ),
1192
- onTriggerLeave: i.useCallback(
1193
- (x) => {
1194
- F(x) && x.preventDefault();
1195
- },
1196
- [F]
1197
- ),
1198
- pointerGraceTimerRef: $,
1199
- onPointerGraceIntentChange: i.useCallback((x) => {
1200
- Y.current = x;
1201
- }, []),
1202
- children: /* @__PURE__ */ a(X, { ...U, children: /* @__PURE__ */ a(
1203
- bt,
1204
- {
1205
- asChild: !0,
1206
- trapped: o,
1207
- onMountAutoFocus: P(s, (x) => {
1208
- var D;
1209
- x.preventDefault(), (D = S.current) == null || D.focus({ preventScroll: !0 });
1210
- }),
1211
- onUnmountAutoFocus: l,
1212
- children: /* @__PURE__ */ a(
1213
- yt,
1214
- {
1215
- asChild: !0,
1216
- disableOutsidePointerEvents: c,
1217
- onEscapeKeyDown: u,
1218
- onPointerDownOutside: d,
1219
- onFocusOutside: f,
1220
- onInteractOutside: m,
1221
- onDismiss: w,
1222
- children: /* @__PURE__ */ a(
1223
- co,
1224
- {
1225
- asChild: !0,
1226
- ...g,
1227
- dir: v.dir,
1228
- orientation: "vertical",
1229
- loop: r,
1230
- currentTabStopId: _,
1231
- onCurrentTabStopIdChange: I,
1232
- onEntryFocus: P(p, (x) => {
1233
- v.isUsingKeyboardRef.current || x.preventDefault();
1234
- }),
1235
- preventScrollOnEntryFocus: !0,
1236
- children: /* @__PURE__ */ a(
1237
- jr,
1238
- {
1239
- role: "menu",
1240
- "aria-orientation": "vertical",
1241
- "data-state": un(y.open),
1242
- "data-radix-menu-content": "",
1243
- dir: v.dir,
1244
- ...M,
1245
- ...h,
1246
- ref: E,
1247
- style: { outline: "none", ...h.style },
1248
- onKeyDown: P(h.onKeyDown, (x) => {
1249
- const T = x.target.closest("[data-radix-menu-content]") === x.currentTarget, V = x.ctrlKey || x.altKey || x.metaKey, q = x.key.length === 1;
1250
- T && (x.key === "Tab" && x.preventDefault(), !V && q && ee(x.key));
1251
- const ne = S.current;
1252
- if (x.target !== ne || !fo.includes(x.key)) return;
1253
- x.preventDefault();
1254
- const te = N().filter((Q) => !Q.disabled).map((Q) => Q.ref.current);
1255
- Gt.includes(x.key) && te.reverse(), Oo(te);
1256
- }),
1257
- onBlur: P(e.onBlur, (x) => {
1258
- x.currentTarget.contains(x.target) || (window.clearTimeout(L.current), k.current = "");
1259
- }),
1260
- onPointerMove: P(
1261
- e.onPointerMove,
1262
- Ce((x) => {
1263
- const D = x.target, T = J.current !== x.clientX;
1264
- if (x.currentTarget.contains(D) && T) {
1265
- const V = x.clientX > J.current ? "right" : "left";
1266
- W.current = V, J.current = x.clientX;
1267
- }
1268
- })
1269
- )
1270
- }
1271
- )
1272
- }
1273
- )
1274
- }
1275
- )
1276
- }
1277
- ) })
1278
- }
1279
- );
1280
- }
1281
- );
1282
- jt.displayName = Z;
1283
- var Eo = "MenuGroup", Je = i.forwardRef(
1284
- (e, t) => {
1285
- const { __scopeMenu: n, ...r } = e;
1286
- return /* @__PURE__ */ a(K.div, { role: "group", ...r, ref: t });
1287
- }
1288
- );
1289
- Je.displayName = Eo;
1290
- var So = "MenuLabel", Ht = i.forwardRef(
1291
- (e, t) => {
1292
- const { __scopeMenu: n, ...r } = e;
1293
- return /* @__PURE__ */ a(K.div, { ...r, ref: t });
1294
- }
1295
- );
1296
- Ht.displayName = So;
1297
- var Ae = "MenuItem", ct = "menu.itemSelect", Oe = i.forwardRef(
1298
- (e, t) => {
1299
- const { disabled: n = !1, onSelect: r, ...o } = e, s = i.useRef(null), l = Se(Ae, e.__scopeMenu), c = qe(Ae, e.__scopeMenu), p = j(t, s), u = i.useRef(!1), d = () => {
1300
- const f = s.current;
1301
- if (!n && f) {
1302
- const m = new CustomEvent(ct, { bubbles: !0, cancelable: !0 });
1303
- f.addEventListener(ct, (w) => r == null ? void 0 : r(w), { once: !0 }), ht(f, m), m.defaultPrevented ? u.current = !1 : l.onClose();
1304
- }
1305
- };
1306
- return /* @__PURE__ */ a(
1307
- Yt,
1308
- {
1309
- ...o,
1310
- ref: p,
1311
- disabled: n,
1312
- onClick: P(e.onClick, d),
1313
- onPointerDown: (f) => {
1314
- var m;
1315
- (m = e.onPointerDown) == null || m.call(e, f), u.current = !0;
1316
- },
1317
- onPointerUp: P(e.onPointerUp, (f) => {
1318
- var m;
1319
- u.current || (m = f.currentTarget) == null || m.click();
1320
- }),
1321
- onKeyDown: P(e.onKeyDown, (f) => {
1322
- const m = c.searchRef.current !== "";
1323
- n || m && f.key === " " || Ve.includes(f.key) && (f.currentTarget.click(), f.preventDefault());
1324
- })
1325
- }
1326
- );
1327
- }
1328
- );
1329
- Oe.displayName = Ae;
1330
- var Yt = i.forwardRef(
1331
- (e, t) => {
1332
- const { __scopeMenu: n, disabled: r = !1, textValue: o, ...s } = e, l = qe(Ae, n), c = Kt(n), p = i.useRef(null), u = j(t, p), [d, f] = i.useState(!1), [m, w] = i.useState("");
1333
- return i.useEffect(() => {
1334
- const C = p.current;
1335
- C && w((C.textContent ?? "").trim());
1336
- }, [s.children]), /* @__PURE__ */ a(
1337
- be.ItemSlot,
1338
- {
1339
- scope: n,
1340
- disabled: r,
1341
- textValue: o ?? m,
1342
- children: /* @__PURE__ */ a(uo, { asChild: !0, ...c, focusable: !r, children: /* @__PURE__ */ a(
1343
- K.div,
1344
- {
1345
- role: "menuitem",
1346
- "data-highlighted": d ? "" : void 0,
1347
- "aria-disabled": r || void 0,
1348
- "data-disabled": r ? "" : void 0,
1349
- ...s,
1350
- ref: u,
1351
- onPointerMove: P(
1352
- e.onPointerMove,
1353
- Ce((C) => {
1354
- r ? l.onItemLeave(C) : (l.onItemEnter(C), C.defaultPrevented || C.currentTarget.focus({ preventScroll: !0 }));
1355
- })
1356
- ),
1357
- onPointerLeave: P(
1358
- e.onPointerLeave,
1359
- Ce((C) => l.onItemLeave(C))
1360
- ),
1361
- onFocus: P(e.onFocus, () => f(!0)),
1362
- onBlur: P(e.onBlur, () => f(!1))
1363
- }
1364
- ) })
1365
- }
1366
- );
1367
- }
1368
- ), Ro = "MenuCheckboxItem", Xt = i.forwardRef(
1369
- (e, t) => {
1370
- const { checked: n = !1, onCheckedChange: r, ...o } = e;
1371
- return /* @__PURE__ */ a(en, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ a(
1372
- Oe,
1373
- {
1374
- role: "menuitemcheckbox",
1375
- "aria-checked": De(n) ? "mixed" : n,
1376
- ...o,
1377
- ref: t,
1378
- "data-state": et(n),
1379
- onSelect: P(
1380
- o.onSelect,
1381
- () => r == null ? void 0 : r(De(n) ? !0 : !n),
1382
- { checkForDefaultPrevented: !1 }
1383
- )
1384
- }
1385
- ) });
1386
- }
1387
- );
1388
- Xt.displayName = Ro;
1389
- var qt = "MenuRadioGroup", [Po, _o] = de(
1390
- qt,
1391
- { value: void 0, onValueChange: () => {
1392
- } }
1393
- ), Zt = i.forwardRef(
1394
- (e, t) => {
1395
- const { value: n, onValueChange: r, ...o } = e, s = ae(r);
1396
- return /* @__PURE__ */ a(Po, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ a(Je, { ...o, ref: t }) });
1397
- }
1398
- );
1399
- Zt.displayName = qt;
1400
- var Jt = "MenuRadioItem", Qt = i.forwardRef(
1401
- (e, t) => {
1402
- const { value: n, ...r } = e, o = _o(Jt, e.__scopeMenu), s = n === o.value;
1403
- return /* @__PURE__ */ a(en, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ a(
1404
- Oe,
1405
- {
1406
- role: "menuitemradio",
1407
- "aria-checked": s,
1408
- ...r,
1409
- ref: t,
1410
- "data-state": et(s),
1411
- onSelect: P(
1412
- r.onSelect,
1413
- () => {
1414
- var l;
1415
- return (l = o.onValueChange) == null ? void 0 : l.call(o, n);
1416
- },
1417
- { checkForDefaultPrevented: !1 }
1418
- )
1419
- }
1420
- ) });
1421
- }
1422
- );
1423
- Qt.displayName = Jt;
1424
- var Qe = "MenuItemIndicator", [en, Io] = de(
1425
- Qe,
1426
- { checked: !1 }
1427
- ), tn = i.forwardRef(
1428
- (e, t) => {
1429
- const { __scopeMenu: n, forceMount: r, ...o } = e, s = Io(Qe, n);
1430
- return /* @__PURE__ */ a(
1431
- Me,
1432
- {
1433
- present: r || De(s.checked) || s.checked === !0,
1434
- children: /* @__PURE__ */ a(
1435
- K.span,
1436
- {
1437
- ...o,
1438
- ref: t,
1439
- "data-state": et(s.checked)
1440
- }
1441
- )
1442
- }
1443
- );
1444
- }
1445
- );
1446
- tn.displayName = Qe;
1447
- var Ao = "MenuSeparator", nn = i.forwardRef(
1448
- (e, t) => {
1449
- const { __scopeMenu: n, ...r } = e;
1450
- return /* @__PURE__ */ a(
1451
- K.div,
1452
- {
1453
- role: "separator",
1454
- "aria-orientation": "horizontal",
1455
- ...r,
1456
- ref: t
1457
- }
1458
- );
1459
- }
1460
- );
1461
- nn.displayName = Ao;
1462
- var Do = "MenuArrow", rn = i.forwardRef(
1463
- (e, t) => {
1464
- const { __scopeMenu: n, ...r } = e, o = Te(n);
1465
- return /* @__PURE__ */ a(Hr, { ...o, ...r, ref: t });
1466
- }
1467
- );
1468
- rn.displayName = Do;
1469
- var To = "MenuSub", [$a, on] = de(To), ye = "MenuSubTrigger", an = i.forwardRef(
1470
- (e, t) => {
1471
- const n = fe(ye, e.__scopeMenu), r = Se(ye, e.__scopeMenu), o = on(ye, e.__scopeMenu), s = qe(ye, e.__scopeMenu), l = i.useRef(null), { pointerGraceTimerRef: c, onPointerGraceIntentChange: p } = s, u = { __scopeMenu: e.__scopeMenu }, d = i.useCallback(() => {
1472
- l.current && window.clearTimeout(l.current), l.current = null;
1473
- }, []);
1474
- return i.useEffect(() => d, [d]), i.useEffect(() => {
1475
- const f = c.current;
1476
- return () => {
1477
- window.clearTimeout(f), p(null);
1478
- };
1479
- }, [c, p]), /* @__PURE__ */ a(Ye, { asChild: !0, ...u, children: /* @__PURE__ */ a(
1480
- Yt,
1481
- {
1482
- id: o.triggerId,
1483
- "aria-haspopup": "menu",
1484
- "aria-expanded": n.open,
1485
- "aria-controls": o.contentId,
1486
- "data-state": un(n.open),
1487
- ...e,
1488
- ref: lt(t, o.onTriggerChange),
1489
- onClick: (f) => {
1490
- var m;
1491
- (m = e.onClick) == null || m.call(e, f), !(e.disabled || f.defaultPrevented) && (f.currentTarget.focus(), n.open || n.onOpenChange(!0));
1492
- },
1493
- onPointerMove: P(
1494
- e.onPointerMove,
1495
- Ce((f) => {
1496
- s.onItemEnter(f), !f.defaultPrevented && !e.disabled && !n.open && !l.current && (s.onPointerGraceIntentChange(null), l.current = window.setTimeout(() => {
1497
- n.onOpenChange(!0), d();
1498
- }, 100));
1499
- })
1500
- ),
1501
- onPointerLeave: P(
1502
- e.onPointerLeave,
1503
- Ce((f) => {
1504
- var w, C;
1505
- d();
1506
- const m = (w = n.content) == null ? void 0 : w.getBoundingClientRect();
1507
- if (m) {
1508
- const h = (C = n.content) == null ? void 0 : C.dataset.side, y = h === "right", v = y ? -5 : 5, M = m[y ? "left" : "right"], g = m[y ? "right" : "left"];
1509
- s.onPointerGraceIntentChange({
1510
- area: [
1511
- // Apply a bleed on clientX to ensure that our exit point is
1512
- // consistently within polygon bounds
1513
- { x: f.clientX + v, y: f.clientY },
1514
- { x: M, y: m.top },
1515
- { x: g, y: m.top },
1516
- { x: g, y: m.bottom },
1517
- { x: M, y: m.bottom }
1518
- ],
1519
- side: h
1520
- }), window.clearTimeout(c.current), c.current = window.setTimeout(
1521
- () => s.onPointerGraceIntentChange(null),
1522
- 300
1523
- );
1524
- } else {
1525
- if (s.onTriggerLeave(f), f.defaultPrevented) return;
1526
- s.onPointerGraceIntentChange(null);
1527
- }
1528
- })
1529
- ),
1530
- onKeyDown: P(e.onKeyDown, (f) => {
1531
- var w;
1532
- const m = s.searchRef.current !== "";
1533
- e.disabled || m && f.key === " " || po[r.dir].includes(f.key) && (n.onOpenChange(!0), (w = n.content) == null || w.focus(), f.preventDefault());
1534
- })
1535
- }
1536
- ) });
1537
- }
1538
- );
1539
- an.displayName = ye;
1540
- var sn = "MenuSubContent", cn = i.forwardRef(
1541
- (e, t) => {
1542
- const n = Wt(Z, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = fe(Z, e.__scopeMenu), l = Se(Z, e.__scopeMenu), c = on(sn, e.__scopeMenu), p = i.useRef(null), u = j(t, p);
1543
- return /* @__PURE__ */ a(be.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(Me, { present: r || s.open, children: /* @__PURE__ */ a(be.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(
1544
- Ze,
1545
- {
1546
- id: c.contentId,
1547
- "aria-labelledby": c.triggerId,
1548
- ...o,
1549
- ref: u,
1550
- align: "start",
1551
- side: l.dir === "rtl" ? "left" : "right",
1552
- disableOutsidePointerEvents: !1,
1553
- disableOutsideScroll: !1,
1554
- trapFocus: !1,
1555
- onOpenAutoFocus: (d) => {
1556
- var f;
1557
- l.isUsingKeyboardRef.current && ((f = p.current) == null || f.focus()), d.preventDefault();
1558
- },
1559
- onCloseAutoFocus: (d) => d.preventDefault(),
1560
- onFocusOutside: P(e.onFocusOutside, (d) => {
1561
- d.target !== c.trigger && s.onOpenChange(!1);
1562
- }),
1563
- onEscapeKeyDown: P(e.onEscapeKeyDown, (d) => {
1564
- l.onClose(), d.preventDefault();
1565
- }),
1566
- onKeyDown: P(e.onKeyDown, (d) => {
1567
- var w;
1568
- const f = d.currentTarget.contains(d.target), m = mo[l.dir].includes(d.key);
1569
- f && m && (s.onOpenChange(!1), (w = c.trigger) == null || w.focus(), d.preventDefault());
1570
- })
1571
- }
1572
- ) }) }) });
1573
- }
1574
- );
1575
- cn.displayName = sn;
1576
- function un(e) {
1577
- return e ? "open" : "closed";
1578
- }
1579
- function De(e) {
1580
- return e === "indeterminate";
1581
- }
1582
- function et(e) {
1583
- return De(e) ? "indeterminate" : e ? "checked" : "unchecked";
1584
- }
1585
- function Oo(e) {
1586
- const t = document.activeElement;
1587
- for (const n of e)
1588
- if (n === t || (n.focus(), document.activeElement !== t)) return;
1589
- }
1590
- function ko(e, t) {
1591
- return e.map((n, r) => e[(t + r) % e.length]);
1592
- }
1593
- function Fo(e, t, n) {
1594
- const o = t.length > 1 && Array.from(t).every((u) => u === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
1595
- let l = ko(e, Math.max(s, 0));
1596
- o.length === 1 && (l = l.filter((u) => u !== n));
1597
- const p = l.find(
1598
- (u) => u.toLowerCase().startsWith(o.toLowerCase())
1599
- );
1600
- return p !== n ? p : void 0;
1601
- }
1602
- function Lo(e, t) {
1603
- const { x: n, y: r } = e;
1604
- let o = !1;
1605
- for (let s = 0, l = t.length - 1; s < t.length; l = s++) {
1606
- const c = t[s], p = t[l], u = c.x, d = c.y, f = p.x, m = p.y;
1607
- d > r != m > r && n < (f - u) * (r - d) / (m - d) + u && (o = !o);
1608
- }
1609
- return o;
1610
- }
1611
- function $o(e, t) {
1612
- if (!t) return !1;
1613
- const n = { x: e.clientX, y: e.clientY };
1614
- return Lo(n, t);
1615
- }
1616
- function Ce(e) {
1617
- return (t) => t.pointerType === "mouse" ? e(t) : void 0;
1618
- }
1619
- var Uo = Bt, Go = Ye, zo = Vt, Ko = jt, Bo = Je, Wo = Ht, Vo = Oe, jo = Xt, Ho = Zt, Yo = Qt, Xo = tn, qo = nn, Zo = rn, Jo = an, Qo = cn, ke = "DropdownMenu", [ea] = xe(
1620
- ke,
1621
- [zt]
1622
- ), B = zt(), [ta, ln] = ea(ke), dn = (e) => {
1623
- const {
1624
- __scopeDropdownMenu: t,
1625
- children: n,
1626
- dir: r,
1627
- open: o,
1628
- defaultOpen: s,
1629
- onOpenChange: l,
1630
- modal: c = !0
1631
- } = e, p = B(t), u = i.useRef(null), [d, f] = ut({
1632
- prop: o,
1633
- defaultProp: s ?? !1,
1634
- onChange: l,
1635
- caller: ke
1636
- });
1637
- return /* @__PURE__ */ a(
1638
- ta,
1639
- {
1640
- scope: t,
1641
- triggerId: Ke(),
1642
- triggerRef: u,
1643
- contentId: Ke(),
1644
- open: d,
1645
- onOpenChange: f,
1646
- onOpenToggle: i.useCallback(() => f((m) => !m), [f]),
1647
- modal: c,
1648
- children: /* @__PURE__ */ a(Uo, { ...p, open: d, onOpenChange: f, dir: r, modal: c, children: n })
1649
- }
1650
- );
1651
- };
1652
- dn.displayName = ke;
1653
- var fn = "DropdownMenuTrigger", pn = i.forwardRef(
1654
- (e, t) => {
1655
- const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = ln(fn, n), l = B(n);
1656
- return /* @__PURE__ */ a(Go, { asChild: !0, ...l, children: /* @__PURE__ */ a(
1657
- K.button,
1658
- {
1659
- type: "button",
1660
- id: s.triggerId,
1661
- "aria-haspopup": "menu",
1662
- "aria-expanded": s.open,
1663
- "aria-controls": s.open ? s.contentId : void 0,
1664
- "data-state": s.open ? "open" : "closed",
1665
- "data-disabled": r ? "" : void 0,
1666
- disabled: r,
1667
- ...o,
1668
- ref: lt(t, s.triggerRef),
1669
- onPointerDown: P(e.onPointerDown, (c) => {
1670
- !r && c.button === 0 && c.ctrlKey === !1 && (s.onOpenToggle(), s.open || c.preventDefault());
1671
- }),
1672
- onKeyDown: P(e.onKeyDown, (c) => {
1673
- r || (["Enter", " "].includes(c.key) && s.onOpenToggle(), c.key === "ArrowDown" && s.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(c.key) && c.preventDefault());
1674
- })
1675
- }
1676
- ) });
1677
- }
1678
- );
1679
- pn.displayName = fn;
1680
- var na = "DropdownMenuPortal", mn = (e) => {
1681
- const { __scopeDropdownMenu: t, ...n } = e, r = B(t);
1682
- return /* @__PURE__ */ a(zo, { ...r, ...n });
1683
- };
1684
- mn.displayName = na;
1685
- var hn = "DropdownMenuContent", gn = i.forwardRef(
1686
- (e, t) => {
1687
- const { __scopeDropdownMenu: n, ...r } = e, o = ln(hn, n), s = B(n), l = i.useRef(!1);
1688
- return /* @__PURE__ */ a(
1689
- Ko,
1690
- {
1691
- id: o.contentId,
1692
- "aria-labelledby": o.triggerId,
1693
- ...s,
1694
- ...r,
1695
- ref: t,
1696
- onCloseAutoFocus: P(e.onCloseAutoFocus, (c) => {
1697
- var p;
1698
- l.current || (p = o.triggerRef.current) == null || p.focus(), l.current = !1, c.preventDefault();
1699
- }),
1700
- onInteractOutside: P(e.onInteractOutside, (c) => {
1701
- const p = c.detail.originalEvent, u = p.button === 0 && p.ctrlKey === !0, d = p.button === 2 || u;
1702
- (!o.modal || d) && (l.current = !0);
1703
- }),
1704
- style: {
1705
- ...e.style,
1706
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1707
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1708
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1709
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1710
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1711
- }
1712
- }
1713
- );
1714
- }
1715
- );
1716
- gn.displayName = hn;
1717
- var ra = "DropdownMenuGroup", oa = i.forwardRef(
1718
- (e, t) => {
1719
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1720
- return /* @__PURE__ */ a(Bo, { ...o, ...r, ref: t });
1721
- }
1722
- );
1723
- oa.displayName = ra;
1724
- var aa = "DropdownMenuLabel", vn = i.forwardRef(
1725
- (e, t) => {
1726
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1727
- return /* @__PURE__ */ a(Wo, { ...o, ...r, ref: t });
1728
- }
1729
- );
1730
- vn.displayName = aa;
1731
- var sa = "DropdownMenuItem", yn = i.forwardRef(
1732
- (e, t) => {
1733
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1734
- return /* @__PURE__ */ a(Vo, { ...o, ...r, ref: t });
1735
- }
1736
- );
1737
- yn.displayName = sa;
1738
- var ia = "DropdownMenuCheckboxItem", wn = i.forwardRef((e, t) => {
1739
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1740
- return /* @__PURE__ */ a(jo, { ...o, ...r, ref: t });
1741
- });
1742
- wn.displayName = ia;
1743
- var ca = "DropdownMenuRadioGroup", ua = i.forwardRef((e, t) => {
1744
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1745
- return /* @__PURE__ */ a(Ho, { ...o, ...r, ref: t });
1746
- });
1747
- ua.displayName = ca;
1748
- var la = "DropdownMenuRadioItem", bn = i.forwardRef((e, t) => {
1749
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1750
- return /* @__PURE__ */ a(Yo, { ...o, ...r, ref: t });
1751
- });
1752
- bn.displayName = la;
1753
- var da = "DropdownMenuItemIndicator", Cn = i.forwardRef((e, t) => {
1754
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1755
- return /* @__PURE__ */ a(Xo, { ...o, ...r, ref: t });
1756
- });
1757
- Cn.displayName = da;
1758
- var fa = "DropdownMenuSeparator", xn = i.forwardRef((e, t) => {
1759
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1760
- return /* @__PURE__ */ a(qo, { ...o, ...r, ref: t });
1761
- });
1762
- xn.displayName = fa;
1763
- var pa = "DropdownMenuArrow", ma = i.forwardRef(
1764
- (e, t) => {
1765
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1766
- return /* @__PURE__ */ a(Zo, { ...o, ...r, ref: t });
1767
- }
1768
- );
1769
- ma.displayName = pa;
1770
- var ha = "DropdownMenuSubTrigger", Mn = i.forwardRef((e, t) => {
1771
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1772
- return /* @__PURE__ */ a(Jo, { ...o, ...r, ref: t });
1773
- });
1774
- Mn.displayName = ha;
1775
- var ga = "DropdownMenuSubContent", Nn = i.forwardRef((e, t) => {
1776
- const { __scopeDropdownMenu: n, ...r } = e, o = B(n);
1777
- return /* @__PURE__ */ a(
1778
- Qo,
1779
- {
1780
- ...o,
1781
- ...r,
1782
- ref: t,
1783
- style: {
1784
- ...e.style,
1785
- "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1786
- "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1787
- "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1788
- "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1789
- "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1790
- }
1791
- }
1792
- );
1793
- });
1794
- Nn.displayName = ga;
1795
- var va = dn, ya = pn, wa = mn, En = gn, Sn = vn, Rn = yn, Pn = wn, _n = bn, In = Cn, An = xn, Dn = Mn, Tn = Nn;
1796
- const On = va, kn = ya, ba = i.forwardRef(({ className: e, inset: t, children: n, ...r }, o) => /* @__PURE__ */ A(
1797
- Dn,
1798
- {
1799
- ref: o,
1800
- className: se(
1801
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",
1802
- t === !0 && "pl-8",
1803
- e
1804
- ),
1805
- ...r,
1806
- children: [
1807
- n,
1808
- /* @__PURE__ */ a(dt, { className: "ml-auto size-4" })
1809
- ]
1810
- }
1811
- ));
1812
- ba.displayName = Dn.displayName;
1813
- const Ca = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(
1814
- Tn,
1815
- {
1816
- ref: n,
1817
- className: se(
1818
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
1819
- e
1820
- ),
1821
- ...t
1822
- }
1823
- ));
1824
- Ca.displayName = Tn.displayName;
1825
- const tt = i.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ a(wa, { children: /* @__PURE__ */ a(
1826
- En,
1827
- {
1828
- ref: r,
1829
- sideOffset: t,
1830
- className: se(
1831
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
1832
- e
1833
- ),
1834
- ...n
1835
- }
1836
- ) }));
1837
- tt.displayName = En.displayName;
1838
- const Fn = i.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ a(
1839
- Rn,
1840
- {
1841
- ref: r,
1842
- className: se(
1843
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",
1844
- t === !0 && "pl-8",
1845
- e
1846
- ),
1847
- ...n
1848
- }
1849
- ));
1850
- Fn.displayName = Rn.displayName;
1851
- const Ln = i.forwardRef(({ className: e, children: t, checked: n, ...r }, o) => /* @__PURE__ */ A(
1852
- Pn,
1853
- {
1854
- ref: o,
1855
- className: se(
1856
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",
1857
- e
1858
- ),
1859
- checked: n,
1860
- ...r,
1861
- children: [
1862
- /* @__PURE__ */ a("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a(In, { children: /* @__PURE__ */ a(tr, { className: "size-4" }) }) }),
1863
- t
1864
- ]
1865
- }
1866
- ));
1867
- Ln.displayName = Pn.displayName;
1868
- const xa = i.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ A(
1869
- _n,
1870
- {
1871
- ref: r,
1872
- className: se(
1873
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",
1874
- e
1875
- ),
1876
- ...n,
1877
- children: [
1878
- /* @__PURE__ */ a("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a(In, { children: /* @__PURE__ */ a(lr, { className: "h-2 w-2 fill-current" }) }) }),
1879
- t
1880
- ]
1881
- }
1882
- ));
1883
- xa.displayName = _n.displayName;
1884
- const Ma = i.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */ a(Sn, { ref: r, className: se("px-2 py-1.5 text-sm font-semibold", t === !0 && "pl-8", e), ...n }));
1885
- Ma.displayName = Sn.displayName;
1886
- const Na = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(An, { ref: n, className: se("-mx-1 my-1 h-px bg-muted", e), ...t }));
1887
- Na.displayName = An.displayName;
1888
- function Ea({ columns: e, visibleColumns: t, toggleColumnVisibility: n }) {
1889
- return /* @__PURE__ */ A(On, { children: [
1890
- /* @__PURE__ */ a(kn, { asChild: !0, children: /* @__PURE__ */ a(ge, { variant: "outline", size: "sm", className: "size-8 p-0 bg-white hover:bg-gray-100 dark:bg-gray-900 shadow-sm border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ a(gr, { className: "size-4 text-gray-600 dark:text-gray-300" }) }) }),
1891
- /* @__PURE__ */ a(tt, { align: "end", className: "w-56", children: e.map((r) => /* @__PURE__ */ a(
1892
- Ln,
1893
- {
1894
- checked: t.has(r.key),
1895
- onCheckedChange: () => {
1896
- n(r.key);
1897
- },
1898
- children: r.label
1899
- },
1900
- r.key
1901
- )) })
1902
- ] });
1903
- }
1904
- function Sa({
1905
- hasBulkActions: e,
1906
- selectedRows: t,
1907
- totalItems: n,
1908
- toggleSelectAll: r,
1909
- visibleColumnsArray: o,
1910
- draggableColumns: s,
1911
- resizableColumns: l,
1912
- columnWidths: c,
1913
- sortColumn: p,
1914
- sortDirection: u,
1915
- handleSort: d,
1916
- handleDragStart: f,
1917
- handleDragOver: m,
1918
- handleDrop: w,
1919
- handleMouseDown: C,
1920
- hasActions: h,
1921
- settingsNode: y
1922
- }) {
1923
- const v = (g) => g.sortable !== !0 ? null : p === g.key ? u === "asc" ? /* @__PURE__ */ a(cr, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ a(or, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ a(sr, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }), M = (g, N) => {
1924
- const _ = N !== !1, I = g.sortable === !0, S = p === g.key;
1925
- return /* @__PURE__ */ A(
1926
- "th",
1927
- {
1928
- className: [
1929
- "px-2 py-2 text-left text-sm font-medium text-gray-900 dark:text-gray-100 relative group border-r border-gray-200 dark:border-gray-800",
1930
- I ? "cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 select-none" : "",
1931
- S ? "bg-gray-100/80 dark:bg-gray-800/80" : ""
1932
- ].filter(Boolean).join(" "),
1933
- style: { width: c[g.key] },
1934
- draggable: _,
1935
- onClick: () => {
1936
- d(g.key);
1937
- },
1938
- onDragStart: (E) => {
1939
- _ ? f(E, g.key) : E.preventDefault();
1940
- },
1941
- onDragOver: (E) => {
1942
- m(E, g.key);
1943
- },
1944
- onDrop: (E) => {
1945
- w(E, g.key);
1946
- },
1947
- children: [
1948
- /* @__PURE__ */ A("div", { className: "flex items-center justify-between pr-2", children: [
1949
- /* @__PURE__ */ A("div", { className: "flex items-center gap-1", children: [
1950
- _ ? /* @__PURE__ */ a(mr, { className: "size-4 text-gray-400 cursor-grab dark:text-gray-300 shrink-0" }) : null,
1951
- /* @__PURE__ */ a("span", { className: "truncate", children: g.label })
1952
- ] }),
1953
- /* @__PURE__ */ a("div", { className: "ml-1 shrink-0", children: v(g) })
1954
- ] }),
1955
- l ? /* @__PURE__ */ a(
1956
- "div",
1957
- {
1958
- className: "absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500 opacity-0 group-hover:opacity-50 transition-opacity",
1959
- onMouseDown: (E) => {
1960
- C(E, g.key);
1961
- }
1962
- }
1963
- ) : null
1964
- ]
1965
- },
1966
- g.key
1967
- );
1968
- };
1969
- return /* @__PURE__ */ a("thead", { className: "bg-muted/50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ A("tr", { children: [
1970
- e ? /* @__PURE__ */ a("th", { className: "px-4 py-2 w-12 flex-shrink-0 text-left", children: /* @__PURE__ */ a(
1971
- ft,
1972
- {
1973
- checked: t.length === n && n > 0 ? !0 : t.length > 0 ? "indeterminate" : !1,
1974
- onCheckedChange: r
1975
- }
1976
- ) }) : null,
1977
- o.map((g) => M(g, s)),
1978
- h || y !== void 0 ? /* @__PURE__ */ a("th", { className: "w-12 px-2 py-2 text-center align-middle", children: y }) : null
1979
- ] }) });
1980
- }
1981
- function Ra({ actions: e, row: t }) {
1982
- return /* @__PURE__ */ A(On, { children: [
1983
- /* @__PURE__ */ a(kn, { asChild: !0, children: /* @__PURE__ */ a(ge, { variant: "ghost", size: "icon", className: "h-8 w-8 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ a(fr, { className: "size-4" }) }) }),
1984
- /* @__PURE__ */ a(
1985
- tt,
1986
- {
1987
- align: "end",
1988
- onClick: (n) => {
1989
- n.stopPropagation();
1990
- },
1991
- children: e.map((n, r) => {
1992
- const o = n.icon;
1993
- return /* @__PURE__ */ A(
1994
- Fn,
1995
- {
1996
- onClick: () => {
1997
- n.onClick(t);
1998
- },
1999
- className: n.className,
2000
- children: [
2001
- o !== void 0 && /* @__PURE__ */ a("span", { className: "mr-2 size-4 flex items-center justify-center", children: /* @__PURE__ */ a(o, { className: "size-4" }) }),
2002
- n.label
2003
- ]
2004
- },
2005
- r
2006
- );
2007
- })
2008
- }
2009
- )
2010
- ] });
2011
- }
2012
- function Pa({
2013
- isLoading: e,
2014
- colSpanCount: t,
2015
- noDataMessage: n,
2016
- paginatedData: r,
2017
- getRowId: o,
2018
- onRowClick: s,
2019
- hasBulkActions: l,
2020
- selectedRows: c,
2021
- toggleRowSelection: p,
2022
- visibleColumnsArray: u,
2023
- columnWidths: d,
2024
- hasActions: f,
2025
- actions: m,
2026
- columns: w
2027
- }) {
2028
- const C = (h, y) => {
2029
- const v = w.find((g) => g.key === y);
2030
- if ((v == null ? void 0 : v.renderCell) !== void 0)
2031
- return v.renderCell(h);
2032
- const M = h[y];
2033
- return /* @__PURE__ */ a("span", { className: "text-sm truncate", children: M != null ? String(M) : "-" });
2034
- };
2035
- return e ? /* @__PURE__ */ a("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: t, className: "py-8 text-center", children: /* @__PURE__ */ A("div", { className: "flex flex-col items-center justify-center gap-2 text-muted-foreground", children: [
2036
- /* @__PURE__ */ a(nr, { className: "h-6 w-6 animate-spin text-primary" }),
2037
- /* @__PURE__ */ a("span", { className: "text-sm", children: "Chargement..." })
2038
- ] }) }) }) }) : r.length === 0 ? /* @__PURE__ */ a("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: t, className: "py-8 text-center text-sm text-muted-foreground", children: n }) }) }) : /* @__PURE__ */ a("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-800", children: r.map((h) => {
2039
- const y = o(h);
2040
- return /* @__PURE__ */ A(
2041
- "tr",
2042
- {
2043
- className: `group hover:bg-muted/50 dark:hover:bg-gray-900/50 transition-colors ${s !== void 0 ? "cursor-pointer" : ""}`,
2044
- onClick: () => s == null ? void 0 : s(h),
2045
- children: [
2046
- l ? /* @__PURE__ */ a(
2047
- "td",
2048
- {
2049
- className: "px-4 py-2 w-12",
2050
- onClick: (v) => {
2051
- v.stopPropagation();
2052
- },
2053
- children: /* @__PURE__ */ a(
2054
- ft,
2055
- {
2056
- checked: c.includes(y),
2057
- onCheckedChange: () => {
2058
- p(y);
2059
- }
2060
- }
2061
- )
2062
- }
2063
- ) : null,
2064
- u.map((v, M) => {
2065
- const g = M === u.length - 1;
2066
- return /* @__PURE__ */ a(
2067
- "td",
2068
- {
2069
- className: `px-2 py-2 border-r border-gray-100 dark:border-gray-800 relative ${g ? "border-r-0" : ""}`,
2070
- style: { width: d[v.key] },
2071
- children: /* @__PURE__ */ a("div", { className: "w-full h-full", children: C(h, v.key) })
2072
- },
2073
- v.key
2074
- );
2075
- }),
2076
- f && m !== void 0 && m.length > 0 ? /* @__PURE__ */ a(
2077
- "td",
2078
- {
2079
- className: "px-2 py-2 w-12 text-end",
2080
- onClick: (v) => {
2081
- v.stopPropagation();
2082
- },
2083
- children: /* @__PURE__ */ a(Ra, { actions: m, row: h })
2084
- }
2085
- ) : null
2086
- ]
2087
- },
2088
- y
2089
- );
2090
- }) });
2091
- }
2092
- function Ua({
2093
- data: e,
2094
- columns: t,
2095
- getRowId: n,
2096
- onRowClick: r,
2097
- actions: o,
2098
- bulkActions: s,
2099
- draggableColumns: l = !0,
2100
- resizableColumns: c = !0,
2101
- columnVisibility: p = !0,
2102
- isLoading: u = !1,
2103
- noDataMessage: d = "Aucun résultat",
2104
- defaultPageSize: f = yr,
2105
- pageSizeOptions: m = mt
2106
- }) {
2107
- const {
2108
- sortColumn: w,
2109
- sortDirection: C,
2110
- selectedRows: h,
2111
- setSelectedRows: y,
2112
- visibleColumns: v,
2113
- columnWidths: M,
2114
- safeCurrentPage: g,
2115
- totalPages: N,
2116
- startIndex: _,
2117
- endIndex: I,
2118
- tableRef: S,
2119
- hasActions: E,
2120
- hasBulkActions: L,
2121
- visibleColumnsArray: k,
2122
- colSpanCount: $,
2123
- paginatedData: Y,
2124
- handleSort: W,
2125
- handleMouseDown: J,
2126
- handleDragStart: X,
2127
- handleDragOver: U,
2128
- handleDrop: ee,
2129
- toggleColumnVisibility: F,
2130
- toggleRowSelection: x,
2131
- toggleSelectAll: D,
2132
- pageSize: T,
2133
- setPageSize: V,
2134
- setCurrentPage: q
2135
- } = vr({
2136
- data: e,
2137
- columns: t,
2138
- getRowId: n,
2139
- defaultPageSize: f,
2140
- actions: o,
2141
- bulkActions: s,
2142
- columnVisibility: p
2143
- });
2144
- return /* @__PURE__ */ A("div", { className: "space-y-4", children: [
2145
- h.length > 0 && s !== void 0 && s.length > 0 && /* @__PURE__ */ a(br, { selectedRows: h, setSelectedRows: y, bulkActions: s }),
2146
- /* @__PURE__ */ A("div", { className: "w-full bg-card dark:bg-gray-950 rounded-md border border-gray-200 dark:border-gray-800 overflow-hidden", children: [
2147
- /* @__PURE__ */ a("div", { className: "overflow-x-auto", children: /* @__PURE__ */ A("table", { ref: S, className: "w-full", children: [
2148
- /* @__PURE__ */ a(
2149
- Sa,
2150
- {
2151
- hasBulkActions: L,
2152
- selectedRows: h,
2153
- totalItems: e.length,
2154
- toggleSelectAll: D,
2155
- visibleColumnsArray: k,
2156
- draggableColumns: l,
2157
- resizableColumns: c,
2158
- columnWidths: M,
2159
- sortColumn: w,
2160
- sortDirection: C,
2161
- handleSort: W,
2162
- handleDragStart: X,
2163
- handleDragOver: U,
2164
- handleDrop: ee,
2165
- handleMouseDown: J,
2166
- hasActions: E,
2167
- settingsNode: p ? /* @__PURE__ */ a(Ea, { columns: t, visibleColumns: v, toggleColumnVisibility: F }) : void 0
2168
- }
2169
- ),
2170
- /* @__PURE__ */ a(
2171
- Pa,
2172
- {
2173
- isLoading: u,
2174
- colSpanCount: $,
2175
- noDataMessage: d,
2176
- paginatedData: Y,
2177
- getRowId: n,
2178
- onRowClick: r,
2179
- hasBulkActions: L,
2180
- selectedRows: h,
2181
- toggleRowSelection: x,
2182
- visibleColumnsArray: k,
2183
- columnWidths: M,
2184
- hasActions: E,
2185
- actions: o,
2186
- columns: t
2187
- }
2188
- )
2189
- ] }) }),
2190
- /* @__PURE__ */ a(
2191
- wr,
2192
- {
2193
- totalItems: e.length,
2194
- startIndex: _,
2195
- endIndex: I,
2196
- pageSize: T,
2197
- setPageSize: V,
2198
- currentPage: g,
2199
- setCurrentPage: q,
2200
- pageSizeOptions: m,
2201
- totalPages: N
2202
- }
2203
- )
2204
- ] })
2205
- ] });
2206
- }
2207
- export {
2208
- Ua as D,
2209
- Ra as T,
2210
- Pa as a,
2211
- br as b,
2212
- Sa as c,
2213
- wr as d,
2214
- Ea as e,
2215
- vr as u
2216
- };