@krak-stack/registry 0.1.8 → 0.1.10
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.
- package/README.md +2 -0
- package/dist/components/ui/data-table.d.ts +130 -19
- package/dist/components/ui/data-table.js +1515 -1312
- package/dist/components/ui/sidebar-layout.d.ts +1 -0
- package/dist/components/ui/sidebar-layout.js +6 -1
- package/dist/components/ui/tabs.d.ts +10 -0
- package/dist/lib/docs-ai.d.ts +6 -0
- package/dist/lib/docs-ai.js +3 -0
- package/dist/lib/docs-core.d.ts +52 -0
- package/dist/lib/docs-core.js +46 -4
- package/dist/services/file-extraction/index.d.ts +70 -0
- package/dist/services/file-extraction/index.js +119 -0
- package/dist/services/file-extraction/schema.d.ts +13 -0
- package/dist/services/file-extraction/schema.js +14 -0
- package/dist/services/notification/client/index.d.ts +1 -0
- package/dist/services/notification/client/index.js +1123 -0
- package/dist/services/notification/client/notification-menu.d.ts +82 -0
- package/dist/services/notification/public.d.ts +2 -0
- package/dist/services/notification/public.js +1194 -0
- package/package.json +22 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// ../../src/components/ui/
|
|
2
|
-
import {
|
|
1
|
+
// ../../src/components/ui/badge.tsx
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
4
|
import { cva } from "class-variance-authority";
|
|
4
5
|
|
|
5
6
|
// ../../src/lib/utils.ts
|
|
@@ -9,9 +10,46 @@ function cn(...inputs) {
|
|
|
9
10
|
return twMerge(clsx(inputs));
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
// ../../src/components/ui/badge.tsx
|
|
14
|
+
var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
18
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
19
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
20
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
21
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
function Badge({
|
|
30
|
+
className,
|
|
31
|
+
variant = "default",
|
|
32
|
+
render,
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return useRender({
|
|
36
|
+
defaultTagName: "span",
|
|
37
|
+
props: mergeProps({
|
|
38
|
+
className: cn(badgeVariants({ variant }), className)
|
|
39
|
+
}, props),
|
|
40
|
+
render,
|
|
41
|
+
state: {
|
|
42
|
+
slot: "badge",
|
|
43
|
+
variant
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
12
48
|
// ../../src/components/ui/button.tsx
|
|
49
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
50
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
13
51
|
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
var buttonVariants =
|
|
52
|
+
var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
15
53
|
variants: {
|
|
16
54
|
variant: {
|
|
17
55
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -50,160 +88,350 @@ function Button({
|
|
|
50
88
|
});
|
|
51
89
|
}
|
|
52
90
|
|
|
53
|
-
// ../../src/components/ui/
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import { Check, ChevronsUpDown, X } from "lucide-react";
|
|
57
|
-
import {
|
|
58
|
-
useCallback,
|
|
59
|
-
useEffect,
|
|
60
|
-
useImperativeHandle,
|
|
61
|
-
useRef
|
|
62
|
-
} from "react";
|
|
63
|
-
|
|
64
|
-
// ../../src/components/ui/input-group.tsx
|
|
65
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
66
|
-
|
|
67
|
-
// ../../src/components/ui/input.tsx
|
|
68
|
-
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
91
|
+
// ../../src/components/ui/checkbox.tsx
|
|
92
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
93
|
+
import { CheckIcon } from "lucide-react";
|
|
69
94
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"data-slot": "
|
|
74
|
-
className: cn("
|
|
75
|
-
...props
|
|
95
|
+
"use client";
|
|
96
|
+
function Checkbox({ className, ...props }) {
|
|
97
|
+
return /* @__PURE__ */ jsx2(CheckboxPrimitive.Root, {
|
|
98
|
+
"data-slot": "checkbox",
|
|
99
|
+
className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
|
|
100
|
+
...props,
|
|
101
|
+
children: /* @__PURE__ */ jsx2(CheckboxPrimitive.Indicator, {
|
|
102
|
+
"data-slot": "checkbox-indicator",
|
|
103
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
104
|
+
children: /* @__PURE__ */ jsx2(CheckIcon, {})
|
|
105
|
+
})
|
|
76
106
|
});
|
|
77
107
|
}
|
|
78
108
|
|
|
79
|
-
// ../../src/components/ui/
|
|
109
|
+
// ../../src/components/ui/card.tsx
|
|
80
110
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
111
|
+
function Card({
|
|
112
|
+
className,
|
|
113
|
+
size = "default",
|
|
114
|
+
...props
|
|
115
|
+
}) {
|
|
116
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
117
|
+
"data-slot": "card",
|
|
118
|
+
"data-size": size,
|
|
119
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function CardHeader({ className, ...props }) {
|
|
124
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
125
|
+
"data-slot": "card-header",
|
|
126
|
+
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className),
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function CardTitle({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
132
|
+
"data-slot": "card-title",
|
|
133
|
+
className: cn("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className),
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function CardDescription({ className, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
139
|
+
"data-slot": "card-description",
|
|
140
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
141
|
+
...props
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function CardAction({ className, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
146
|
+
"data-slot": "card-action",
|
|
147
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
148
|
+
...props
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function CardContent({ className, ...props }) {
|
|
152
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
153
|
+
"data-slot": "card-content",
|
|
154
|
+
className: cn("px-(--card-spacing)", className),
|
|
155
|
+
...props
|
|
156
|
+
});
|
|
157
|
+
}
|
|
81
158
|
|
|
82
|
-
// ../../src/components/ui/
|
|
83
|
-
import {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
159
|
+
// ../../src/components/ui/dropdown-menu.tsx
|
|
160
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
161
|
+
import { ChevronRightIcon, CheckIcon as CheckIcon2 } from "lucide-react";
|
|
162
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
163
|
+
function DropdownMenu({ ...props }) {
|
|
164
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Root, {
|
|
165
|
+
"data-slot": "dropdown-menu",
|
|
89
166
|
...props
|
|
90
167
|
});
|
|
91
168
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var inputGroupButtonVariants = cva2("flex items-center gap-2 text-sm shadow-none", {
|
|
104
|
-
variants: {
|
|
105
|
-
size: {
|
|
106
|
-
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
107
|
-
sm: "",
|
|
108
|
-
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
109
|
-
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
defaultVariants: { size: "xs" }
|
|
113
|
-
});
|
|
114
|
-
function InputGroupInput({
|
|
169
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
170
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Trigger, {
|
|
171
|
+
"data-slot": "dropdown-menu-trigger",
|
|
172
|
+
...props
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function DropdownMenuContent({
|
|
176
|
+
align = "start",
|
|
177
|
+
alignOffset = 0,
|
|
178
|
+
side = "bottom",
|
|
179
|
+
sideOffset = 4,
|
|
115
180
|
className,
|
|
116
181
|
...props
|
|
117
182
|
}) {
|
|
118
|
-
return /* @__PURE__ */ jsx4(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
183
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Portal, {
|
|
184
|
+
children: /* @__PURE__ */ jsx4(MenuPrimitive.Positioner, {
|
|
185
|
+
className: "isolate z-50 outline-none",
|
|
186
|
+
align,
|
|
187
|
+
alignOffset,
|
|
188
|
+
side,
|
|
189
|
+
sideOffset,
|
|
190
|
+
children: /* @__PURE__ */ jsx4(MenuPrimitive.Popup, {
|
|
191
|
+
"data-slot": "dropdown-menu-content",
|
|
192
|
+
className: cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
193
|
+
...props
|
|
194
|
+
})
|
|
195
|
+
})
|
|
122
196
|
});
|
|
123
197
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var cookieName = "locale";
|
|
130
|
-
var cookieMaxAge = 34560000;
|
|
131
|
-
var cookieDomain = "";
|
|
132
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
133
|
-
var strategy = [
|
|
134
|
-
"url",
|
|
135
|
-
"cookie",
|
|
136
|
-
"preferredLanguage",
|
|
137
|
-
"baseLocale"
|
|
138
|
-
];
|
|
139
|
-
var routeStrategies = [
|
|
140
|
-
{
|
|
141
|
-
match: "/api/:path(.*)?",
|
|
142
|
-
exclude: true
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
match: "/sitemap.xml",
|
|
146
|
-
exclude: true
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
match: "/llms.txt",
|
|
150
|
-
exclude: true
|
|
151
|
-
}
|
|
152
|
-
];
|
|
153
|
-
var urlPatterns = [
|
|
154
|
-
{
|
|
155
|
-
pattern: "/:path(.*)?",
|
|
156
|
-
localized: [
|
|
157
|
-
[
|
|
158
|
-
"en",
|
|
159
|
-
"/en/:path(.*)?"
|
|
160
|
-
],
|
|
161
|
-
[
|
|
162
|
-
"fr",
|
|
163
|
-
"/fr/:path(.*)?"
|
|
164
|
-
]
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
];
|
|
168
|
-
var cachedRouteStrategyUrl;
|
|
169
|
-
var cachedRouteStrategy;
|
|
170
|
-
function findMatchingRouteStrategy(url) {
|
|
171
|
-
if (routeStrategies.length === 0) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
175
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
176
|
-
return cachedRouteStrategy;
|
|
177
|
-
}
|
|
178
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
179
|
-
let match;
|
|
180
|
-
for (const routeStrategy of routeStrategies) {
|
|
181
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
182
|
-
if (pattern.exec(urlObject.href)) {
|
|
183
|
-
match = routeStrategy;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
cachedRouteStrategyUrl = urlString;
|
|
188
|
-
cachedRouteStrategy = match;
|
|
189
|
-
return match;
|
|
198
|
+
function DropdownMenuGroup({ ...props }) {
|
|
199
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Group, {
|
|
200
|
+
"data-slot": "dropdown-menu-group",
|
|
201
|
+
...props
|
|
202
|
+
});
|
|
190
203
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return
|
|
204
|
+
function DropdownMenuLabel({
|
|
205
|
+
className,
|
|
206
|
+
inset,
|
|
207
|
+
...props
|
|
208
|
+
}) {
|
|
209
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.GroupLabel, {
|
|
210
|
+
"data-slot": "dropdown-menu-label",
|
|
211
|
+
"data-inset": inset,
|
|
212
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className),
|
|
213
|
+
...props
|
|
214
|
+
});
|
|
197
215
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
216
|
+
function DropdownMenuItem({
|
|
217
|
+
className,
|
|
218
|
+
inset,
|
|
219
|
+
variant = "default",
|
|
220
|
+
...props
|
|
221
|
+
}) {
|
|
222
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Item, {
|
|
223
|
+
"data-slot": "dropdown-menu-item",
|
|
224
|
+
"data-inset": inset,
|
|
225
|
+
"data-variant": variant,
|
|
226
|
+
className: cn("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
227
|
+
...props
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function DropdownMenuSub({ ...props }) {
|
|
231
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.SubmenuRoot, {
|
|
232
|
+
"data-slot": "dropdown-menu-sub",
|
|
233
|
+
...props
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function DropdownMenuSubTrigger({
|
|
237
|
+
className,
|
|
238
|
+
inset,
|
|
239
|
+
children,
|
|
240
|
+
...props
|
|
241
|
+
}) {
|
|
242
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.SubmenuTrigger, {
|
|
243
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
244
|
+
"data-inset": inset,
|
|
245
|
+
className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
246
|
+
...props,
|
|
247
|
+
children: [
|
|
248
|
+
children,
|
|
249
|
+
/* @__PURE__ */ jsx4(ChevronRightIcon, {
|
|
250
|
+
className: "ml-auto"
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function DropdownMenuSubContent({
|
|
256
|
+
align = "start",
|
|
257
|
+
alignOffset = -3,
|
|
258
|
+
side = "right",
|
|
259
|
+
sideOffset = 0,
|
|
260
|
+
className,
|
|
261
|
+
...props
|
|
262
|
+
}) {
|
|
263
|
+
return /* @__PURE__ */ jsx4(DropdownMenuContent, {
|
|
264
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
265
|
+
className: cn("w-auto min-w-[96px] rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
266
|
+
align,
|
|
267
|
+
alignOffset,
|
|
268
|
+
side,
|
|
269
|
+
sideOffset,
|
|
270
|
+
...props
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function DropdownMenuCheckboxItem({
|
|
274
|
+
className,
|
|
275
|
+
children,
|
|
276
|
+
checked,
|
|
277
|
+
inset,
|
|
278
|
+
...props
|
|
279
|
+
}) {
|
|
280
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.CheckboxItem, {
|
|
281
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
282
|
+
"data-inset": inset,
|
|
283
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
284
|
+
checked,
|
|
285
|
+
...props,
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ jsx4("span", {
|
|
288
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
289
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
290
|
+
children: /* @__PURE__ */ jsx4(MenuPrimitive.CheckboxItemIndicator, {
|
|
291
|
+
children: /* @__PURE__ */ jsx4(CheckIcon2, {})
|
|
292
|
+
})
|
|
293
|
+
}),
|
|
294
|
+
children
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
299
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.RadioGroup, {
|
|
300
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
301
|
+
...props
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function DropdownMenuRadioItem({
|
|
305
|
+
className,
|
|
306
|
+
children,
|
|
307
|
+
inset,
|
|
308
|
+
...props
|
|
309
|
+
}) {
|
|
310
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.RadioItem, {
|
|
311
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
312
|
+
"data-inset": inset,
|
|
313
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
314
|
+
...props,
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ jsx4("span", {
|
|
317
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
318
|
+
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
319
|
+
children: /* @__PURE__ */ jsx4(MenuPrimitive.RadioItemIndicator, {
|
|
320
|
+
children: /* @__PURE__ */ jsx4(CheckIcon2, {})
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
children
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function DropdownMenuSeparator({
|
|
328
|
+
className,
|
|
329
|
+
...props
|
|
330
|
+
}) {
|
|
331
|
+
return /* @__PURE__ */ jsx4(MenuPrimitive.Separator, {
|
|
332
|
+
"data-slot": "dropdown-menu-separator",
|
|
333
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
334
|
+
...props
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ../../src/components/ui/input.tsx
|
|
339
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
340
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
341
|
+
function Input({ className, type, ...props }) {
|
|
342
|
+
return /* @__PURE__ */ jsx5(InputPrimitive, {
|
|
343
|
+
type,
|
|
344
|
+
"data-slot": "input",
|
|
345
|
+
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
346
|
+
...props
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ../../src/components/ui/loading.tsx
|
|
351
|
+
import { Loader2 } from "lucide-react";
|
|
352
|
+
|
|
353
|
+
// ../../src/paraglide/runtime.js
|
|
354
|
+
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
355
|
+
var baseLocale = "en";
|
|
356
|
+
var locales = ["en", "fr"];
|
|
357
|
+
var cookieName = "locale";
|
|
358
|
+
var cookieMaxAge = 34560000;
|
|
359
|
+
var cookieDomain = "";
|
|
360
|
+
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
361
|
+
var strategy = [
|
|
362
|
+
"url",
|
|
363
|
+
"cookie",
|
|
364
|
+
"preferredLanguage",
|
|
365
|
+
"baseLocale"
|
|
366
|
+
];
|
|
367
|
+
var routeStrategies = [
|
|
368
|
+
{
|
|
369
|
+
match: "/api/:path(.*)?",
|
|
370
|
+
exclude: true
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
match: "/sitemap.xml",
|
|
374
|
+
exclude: true
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
match: "/llms.txt",
|
|
378
|
+
exclude: true
|
|
379
|
+
}
|
|
380
|
+
];
|
|
381
|
+
var urlPatterns = [
|
|
382
|
+
{
|
|
383
|
+
pattern: "/:path(.*)?",
|
|
384
|
+
localized: [
|
|
385
|
+
[
|
|
386
|
+
"en",
|
|
387
|
+
"/en/:path(.*)?"
|
|
388
|
+
],
|
|
389
|
+
[
|
|
390
|
+
"fr",
|
|
391
|
+
"/fr/:path(.*)?"
|
|
392
|
+
]
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
];
|
|
396
|
+
var cachedRouteStrategyUrl;
|
|
397
|
+
var cachedRouteStrategy;
|
|
398
|
+
function findMatchingRouteStrategy(url) {
|
|
399
|
+
if (routeStrategies.length === 0) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const urlString = typeof url === "string" ? url : url.href;
|
|
403
|
+
if (cachedRouteStrategyUrl === urlString) {
|
|
404
|
+
return cachedRouteStrategy;
|
|
405
|
+
}
|
|
406
|
+
const urlObject = new URL(urlString, "http://dummy.com");
|
|
407
|
+
let match;
|
|
408
|
+
for (const routeStrategy of routeStrategies) {
|
|
409
|
+
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
410
|
+
if (pattern.exec(urlObject.href)) {
|
|
411
|
+
match = routeStrategy;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
cachedRouteStrategyUrl = urlString;
|
|
416
|
+
cachedRouteStrategy = match;
|
|
417
|
+
return match;
|
|
418
|
+
}
|
|
419
|
+
function getStrategyForUrl(url) {
|
|
420
|
+
const routeStrategy = findMatchingRouteStrategy(url);
|
|
421
|
+
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
422
|
+
return routeStrategy.strategy;
|
|
423
|
+
}
|
|
424
|
+
return strategy;
|
|
425
|
+
}
|
|
426
|
+
var serverAsyncLocalStorage = undefined;
|
|
427
|
+
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
428
|
+
var experimentalStaticLocale = undefined;
|
|
429
|
+
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
430
|
+
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
431
|
+
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
432
|
+
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
433
|
+
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
434
|
+
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
207
435
|
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
208
436
|
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
209
437
|
var _locale;
|
|
@@ -558,530 +786,70 @@ function isCustomStrategy(strategy2) {
|
|
|
558
786
|
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
559
787
|
}
|
|
560
788
|
|
|
561
|
-
// ../../src/components/ui/
|
|
562
|
-
import { jsx as
|
|
563
|
-
|
|
564
|
-
var messages = {
|
|
789
|
+
// ../../src/components/ui/loading.tsx
|
|
790
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
791
|
+
var labels = {
|
|
565
792
|
en: {
|
|
566
|
-
|
|
567
|
-
search: "Search...",
|
|
568
|
-
selected: (count) => `${count} selected`,
|
|
569
|
-
selectMore: "Select more"
|
|
793
|
+
loading: "Loading..."
|
|
570
794
|
},
|
|
571
795
|
fr: {
|
|
572
|
-
|
|
573
|
-
search: "Rechercher...",
|
|
574
|
-
selected: (count) => `${count} sélectionnés`,
|
|
575
|
-
selectMore: "Sélectionner davantage"
|
|
796
|
+
loading: "Chargement..."
|
|
576
797
|
}
|
|
577
798
|
};
|
|
578
|
-
var
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
itemIndexRef,
|
|
587
|
-
messages: messageOverrides,
|
|
588
|
-
renderItem,
|
|
589
|
-
selectedValues,
|
|
590
|
-
virtualizerRef
|
|
591
|
-
}) => {
|
|
592
|
-
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
593
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
594
|
-
const itemEntries = filteredItems.map((item, index) => ({
|
|
595
|
-
kind: "item",
|
|
596
|
-
item,
|
|
597
|
-
index
|
|
598
|
-
}));
|
|
599
|
-
const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
|
|
600
|
-
const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
|
|
601
|
-
const entries = groupSelections ? [
|
|
602
|
-
...selectedEntries.length > 0 ? [
|
|
603
|
-
{
|
|
604
|
-
kind: "group",
|
|
605
|
-
key: "selected",
|
|
606
|
-
label: labels.selected(selectedValues.size)
|
|
607
|
-
},
|
|
608
|
-
...selectedEntries
|
|
609
|
-
] : [],
|
|
610
|
-
{
|
|
611
|
-
kind: "group",
|
|
612
|
-
key: "available",
|
|
613
|
-
label: labels.selectMore
|
|
614
|
-
},
|
|
615
|
-
...availableEntries
|
|
616
|
-
] : itemEntries;
|
|
617
|
-
const scrollRef = useRef(null);
|
|
618
|
-
const virtualizer = useVirtualizer({
|
|
619
|
-
count: entries.length,
|
|
620
|
-
getScrollElement: () => scrollRef.current,
|
|
621
|
-
getItemKey: (index) => {
|
|
622
|
-
const entry = entries[index];
|
|
623
|
-
return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
|
|
624
|
-
},
|
|
625
|
-
estimateSize: () => 36,
|
|
626
|
-
overscan: 8
|
|
627
|
-
});
|
|
628
|
-
useEffect(() => {
|
|
629
|
-
itemIndexRef.current = new Map(entries.flatMap((entry, index) => entry.kind === "item" ? [[entry.index, index]] : []));
|
|
630
|
-
});
|
|
631
|
-
useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
|
|
632
|
-
const handleScrollElementRef = useCallback((element) => {
|
|
633
|
-
scrollRef.current = element;
|
|
634
|
-
if (element)
|
|
635
|
-
virtualizer.measure();
|
|
636
|
-
}, [virtualizer]);
|
|
637
|
-
if (filteredItems.length === 0) {
|
|
638
|
-
return /* @__PURE__ */ jsx5("div", {
|
|
639
|
-
className: "text-muted-foreground py-6 text-center text-sm",
|
|
640
|
-
children: emptyLabel
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
return /* @__PURE__ */ jsx5(ComboboxPrimitive.List, {
|
|
644
|
-
className: "scroll-py-1 overflow-auto overscroll-contain p-1",
|
|
645
|
-
ref: handleScrollElementRef,
|
|
646
|
-
style: {
|
|
647
|
-
height: Math.min(virtualizer.getTotalSize() + 8, 288),
|
|
648
|
-
maxHeight: "var(--available-height)"
|
|
649
|
-
},
|
|
650
|
-
children: /* @__PURE__ */ jsx5("div", {
|
|
651
|
-
className: "relative w-full",
|
|
652
|
-
role: "presentation",
|
|
653
|
-
style: { height: virtualizer.getTotalSize() },
|
|
654
|
-
children: virtualizer.getVirtualItems().map((virtualItem) => {
|
|
655
|
-
const entry = entries[virtualItem.index];
|
|
656
|
-
if (!entry)
|
|
657
|
-
return null;
|
|
658
|
-
const style = {
|
|
659
|
-
height: virtualItem.size,
|
|
660
|
-
transform: `translateY(${virtualItem.start}px)`
|
|
661
|
-
};
|
|
662
|
-
if (entry.kind === "group") {
|
|
663
|
-
return /* @__PURE__ */ jsx5(ComboboxPrimitive.Group, {
|
|
664
|
-
className: "contents",
|
|
665
|
-
children: /* @__PURE__ */ jsx5(ComboboxPrimitive.GroupLabel, {
|
|
666
|
-
className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
|
|
667
|
-
"data-index": virtualItem.index,
|
|
668
|
-
ref: virtualizer.measureElement,
|
|
669
|
-
style,
|
|
670
|
-
children: entry.label
|
|
671
|
-
})
|
|
672
|
-
}, entry.key);
|
|
673
|
-
}
|
|
674
|
-
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Item, {
|
|
675
|
-
"aria-posinset": entry.index + 1,
|
|
676
|
-
"aria-setsize": filteredItems.length,
|
|
677
|
-
className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground absolute top-0 left-0 flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
678
|
-
"data-index": virtualItem.index,
|
|
679
|
-
index: entry.index,
|
|
680
|
-
ref: virtualizer.measureElement,
|
|
681
|
-
style,
|
|
682
|
-
value: entry.item,
|
|
683
|
-
children: [
|
|
684
|
-
renderItem?.(entry.item) ?? /* @__PURE__ */ jsx5("span", {
|
|
685
|
-
className: "min-w-0 truncate",
|
|
686
|
-
children: entry.item.label
|
|
687
|
-
}),
|
|
688
|
-
/* @__PURE__ */ jsx5(ComboboxPrimitive.ItemIndicator, {
|
|
689
|
-
className: "absolute right-2 flex size-4 items-center justify-center",
|
|
690
|
-
children: /* @__PURE__ */ jsx5(Check, {})
|
|
691
|
-
})
|
|
692
|
-
]
|
|
693
|
-
}, entry.item.value);
|
|
694
|
-
})
|
|
695
|
-
})
|
|
696
|
-
});
|
|
697
|
-
};
|
|
698
|
-
var VirtualizedComboboxContent = ({
|
|
699
|
-
contentClassName,
|
|
700
|
-
emptyLabel,
|
|
701
|
-
groupSelections,
|
|
702
|
-
itemIndexRef,
|
|
703
|
-
messages: messageOverrides,
|
|
704
|
-
renderItem,
|
|
705
|
-
selectedValues,
|
|
706
|
-
virtualizerRef
|
|
707
|
-
}) => {
|
|
708
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
709
|
-
return /* @__PURE__ */ jsx5(ComboboxPrimitive.Portal, {
|
|
710
|
-
children: /* @__PURE__ */ jsx5(ComboboxPrimitive.Positioner, {
|
|
711
|
-
align: "start",
|
|
712
|
-
className: "isolate z-50",
|
|
713
|
-
side: "bottom",
|
|
714
|
-
sideOffset: 6,
|
|
715
|
-
children: /* @__PURE__ */ jsxs(ComboboxPrimitive.Popup, {
|
|
716
|
-
className: cn("relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-in-95", contentClassName),
|
|
717
|
-
children: [
|
|
718
|
-
/* @__PURE__ */ jsx5("div", {
|
|
719
|
-
className: "min-w-0 p-1 pb-0",
|
|
720
|
-
children: /* @__PURE__ */ jsx5(InputGroup, {
|
|
721
|
-
className: "border-input/30 bg-input/30 h-8 w-full min-w-0 shadow-none",
|
|
722
|
-
children: /* @__PURE__ */ jsx5(ComboboxPrimitive.Input, {
|
|
723
|
-
placeholder: labels.search,
|
|
724
|
-
render: /* @__PURE__ */ jsx5(InputGroupInput, {})
|
|
725
|
-
})
|
|
726
|
-
})
|
|
727
|
-
}),
|
|
728
|
-
/* @__PURE__ */ jsx5(VirtualizedComboboxList, {
|
|
729
|
-
emptyLabel,
|
|
730
|
-
groupSelections,
|
|
731
|
-
itemIndexRef,
|
|
732
|
-
messages: messageOverrides,
|
|
733
|
-
renderItem,
|
|
734
|
-
selectedValues,
|
|
735
|
-
virtualizerRef
|
|
736
|
-
})
|
|
737
|
-
]
|
|
738
|
-
})
|
|
739
|
-
})
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
var defaultTrigger = (ariaLabel, ariaInvalid, disabled, label, triggerId) => /* @__PURE__ */ jsxs(Button, {
|
|
743
|
-
"aria-label": ariaLabel,
|
|
744
|
-
"aria-invalid": ariaInvalid,
|
|
745
|
-
className: "w-full max-w-full min-w-0 justify-between overflow-hidden",
|
|
746
|
-
disabled,
|
|
747
|
-
id: triggerId,
|
|
748
|
-
type: "button",
|
|
749
|
-
variant: "outline",
|
|
750
|
-
children: [
|
|
751
|
-
/* @__PURE__ */ jsx5("span", {
|
|
752
|
-
className: "min-w-0 flex-1 truncate pr-7 text-left",
|
|
753
|
-
children: label
|
|
754
|
-
}),
|
|
755
|
-
/* @__PURE__ */ jsx5(ChevronsUpDown, {
|
|
756
|
-
className: "text-muted-foreground shrink-0 opacity-70"
|
|
757
|
-
})
|
|
758
|
-
]
|
|
759
|
-
});
|
|
760
|
-
var defaultClear = (label) => /* @__PURE__ */ jsx5(ComboboxPrimitive.Clear, {
|
|
761
|
-
"aria-label": label,
|
|
762
|
-
className: "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute top-1/2 right-7 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-sm outline-none focus-visible:border focus-visible:ring-3",
|
|
763
|
-
type: "button",
|
|
764
|
-
children: /* @__PURE__ */ jsx5(X, {
|
|
765
|
-
className: "size-3.5"
|
|
766
|
-
})
|
|
767
|
-
});
|
|
768
|
-
var selectedLabel = (value, placeholder) => {
|
|
769
|
-
if (Array.isArray(value)) {
|
|
770
|
-
return value.length > 0 ? value.map(({ label }) => label).join(", ") : placeholder;
|
|
771
|
-
}
|
|
772
|
-
return value && "label" in value ? value.label : placeholder;
|
|
773
|
-
};
|
|
774
|
-
var useComboboxVirtualizerRef = (providedRef) => {
|
|
775
|
-
const localRef = useRef(null);
|
|
776
|
-
return providedRef ?? localRef;
|
|
777
|
-
};
|
|
778
|
-
var VirtualizedComboboxSingle = (props) => {
|
|
779
|
-
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
780
|
-
const itemIndexRef = useRef(new Map);
|
|
781
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
782
|
-
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
783
|
-
disabled: props.disabled,
|
|
784
|
-
inputValue: props.searchValue,
|
|
785
|
-
items: [...props.items],
|
|
786
|
-
itemToStringLabel: (item) => item.label,
|
|
787
|
-
isItemEqualToValue: optionEquals,
|
|
788
|
-
onInputValueChange: (value) => props.onSearchValueChange?.(value),
|
|
789
|
-
onItemHighlighted: (_, { index, reason }) => {
|
|
790
|
-
if (reason === "keyboard" && index >= 0) {
|
|
791
|
-
virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
onOpenChange: (open) => props.onOpenChange?.(open),
|
|
795
|
-
onValueChange: (value) => props.onValueChange(value),
|
|
796
|
-
open: props.open,
|
|
797
|
-
value: props.value,
|
|
798
|
-
virtualized: true,
|
|
799
|
-
children: [
|
|
800
|
-
/* @__PURE__ */ jsxs("div", {
|
|
801
|
-
className: "relative",
|
|
802
|
-
children: [
|
|
803
|
-
/* @__PURE__ */ jsx5(ComboboxPrimitive.Trigger, {
|
|
804
|
-
render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
|
|
805
|
-
}),
|
|
806
|
-
props.trigger ? null : defaultClear(labels.clear)
|
|
807
|
-
]
|
|
808
|
-
}),
|
|
809
|
-
/* @__PURE__ */ jsx5(VirtualizedComboboxContent, {
|
|
810
|
-
...props,
|
|
811
|
-
groupSelections: false,
|
|
812
|
-
itemIndexRef,
|
|
813
|
-
selectedValues: new Set(props.value ? [props.value.value] : []),
|
|
814
|
-
virtualizerRef
|
|
815
|
-
})
|
|
816
|
-
]
|
|
817
|
-
});
|
|
818
|
-
};
|
|
819
|
-
var VirtualizedComboboxMultiple = (props) => {
|
|
820
|
-
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
821
|
-
const itemIndexRef = useRef(new Map);
|
|
822
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
823
|
-
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
824
|
-
disabled: props.disabled,
|
|
825
|
-
inputValue: props.searchValue,
|
|
826
|
-
items: [...props.items],
|
|
827
|
-
itemToStringLabel: (item) => item.label,
|
|
828
|
-
isItemEqualToValue: optionEquals,
|
|
829
|
-
multiple: true,
|
|
830
|
-
onInputValueChange: (value) => props.onSearchValueChange?.(value),
|
|
831
|
-
onItemHighlighted: (_, { index, reason }) => {
|
|
832
|
-
if (reason === "keyboard" && index >= 0) {
|
|
833
|
-
virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
onOpenChange: (open) => props.onOpenChange?.(open),
|
|
837
|
-
onValueChange: (value) => props.onValueChange(value),
|
|
838
|
-
open: props.open,
|
|
839
|
-
value: [...props.value],
|
|
840
|
-
virtualized: true,
|
|
799
|
+
var loadingLabel = () => getLocale().startsWith("fr") ? labels.fr.loading : labels.en.loading;
|
|
800
|
+
function Loading({
|
|
801
|
+
className,
|
|
802
|
+
label,
|
|
803
|
+
variant = "inline"
|
|
804
|
+
}) {
|
|
805
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
806
|
+
className: cn("text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && "min-h-[50svh] w-full", className),
|
|
841
807
|
children: [
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
className: "
|
|
844
|
-
children: [
|
|
845
|
-
/* @__PURE__ */ jsx5(ComboboxPrimitive.Trigger, {
|
|
846
|
-
render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
|
|
847
|
-
}),
|
|
848
|
-
props.trigger ? null : defaultClear(labels.clear)
|
|
849
|
-
]
|
|
808
|
+
/* @__PURE__ */ jsx6(Loader2, {
|
|
809
|
+
className: "size-4 animate-spin"
|
|
850
810
|
}),
|
|
851
|
-
|
|
852
|
-
...props,
|
|
853
|
-
groupSelections: true,
|
|
854
|
-
itemIndexRef,
|
|
855
|
-
selectedValues: new Set(props.value.map(({ value }) => value)),
|
|
856
|
-
virtualizerRef
|
|
857
|
-
})
|
|
811
|
+
label ?? loadingLabel()
|
|
858
812
|
]
|
|
859
813
|
});
|
|
860
|
-
};
|
|
861
|
-
function VirtualizedCombobox(props) {
|
|
862
|
-
return props.multiple ? /* @__PURE__ */ jsx5(VirtualizedComboboxMultiple, {
|
|
863
|
-
...props
|
|
864
|
-
}) : /* @__PURE__ */ jsx5(VirtualizedComboboxSingle, {
|
|
865
|
-
...props
|
|
866
|
-
});
|
|
867
814
|
}
|
|
868
815
|
|
|
869
|
-
// ../../src/components/ui/
|
|
870
|
-
import {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
816
|
+
// ../../src/components/ui/pagination.tsx
|
|
817
|
+
import {
|
|
818
|
+
ChevronLeft,
|
|
819
|
+
ChevronRight,
|
|
820
|
+
ChevronsLeft,
|
|
821
|
+
ChevronsRight
|
|
822
|
+
} from "lucide-react";
|
|
823
|
+
import { useId } from "react";
|
|
824
|
+
|
|
825
|
+
// ../../src/components/ui/label.tsx
|
|
826
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
827
|
+
"use client";
|
|
828
|
+
function Label({ className, ...props }) {
|
|
829
|
+
return /* @__PURE__ */ jsx7("label", {
|
|
830
|
+
"data-slot": "label",
|
|
831
|
+
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
876
832
|
...props
|
|
877
833
|
});
|
|
878
834
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
835
|
+
|
|
836
|
+
// ../../src/components/ui/select.tsx
|
|
837
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
838
|
+
import { ChevronDownIcon, CheckIcon as CheckIcon3, ChevronUpIcon } from "lucide-react";
|
|
839
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
840
|
+
"use client";
|
|
841
|
+
var Select = SelectPrimitive.Root;
|
|
842
|
+
function SelectValue({ className, ...props }) {
|
|
843
|
+
return /* @__PURE__ */ jsx8(SelectPrimitive.Value, {
|
|
844
|
+
"data-slot": "select-value",
|
|
845
|
+
className: cn("flex flex-1 text-left", className),
|
|
882
846
|
...props
|
|
883
847
|
});
|
|
884
848
|
}
|
|
885
|
-
function
|
|
886
|
-
align = "start",
|
|
887
|
-
alignOffset = 0,
|
|
888
|
-
side = "bottom",
|
|
889
|
-
sideOffset = 4,
|
|
849
|
+
function SelectTrigger({
|
|
890
850
|
className,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Portal, {
|
|
894
|
-
children: /* @__PURE__ */ jsx6(MenuPrimitive.Positioner, {
|
|
895
|
-
className: "isolate z-50 outline-none",
|
|
896
|
-
align,
|
|
897
|
-
alignOffset,
|
|
898
|
-
side,
|
|
899
|
-
sideOffset,
|
|
900
|
-
children: /* @__PURE__ */ jsx6(MenuPrimitive.Popup, {
|
|
901
|
-
"data-slot": "dropdown-menu-content",
|
|
902
|
-
className: cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
903
|
-
...props
|
|
904
|
-
})
|
|
905
|
-
})
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
function DropdownMenuGroup({ ...props }) {
|
|
909
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Group, {
|
|
910
|
-
"data-slot": "dropdown-menu-group",
|
|
911
|
-
...props
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
function DropdownMenuLabel({
|
|
915
|
-
className,
|
|
916
|
-
inset,
|
|
917
|
-
...props
|
|
918
|
-
}) {
|
|
919
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.GroupLabel, {
|
|
920
|
-
"data-slot": "dropdown-menu-label",
|
|
921
|
-
"data-inset": inset,
|
|
922
|
-
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className),
|
|
923
|
-
...props
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
function DropdownMenuItem({
|
|
927
|
-
className,
|
|
928
|
-
inset,
|
|
929
|
-
variant = "default",
|
|
930
|
-
...props
|
|
931
|
-
}) {
|
|
932
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Item, {
|
|
933
|
-
"data-slot": "dropdown-menu-item",
|
|
934
|
-
"data-inset": inset,
|
|
935
|
-
"data-variant": variant,
|
|
936
|
-
className: cn("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
937
|
-
...props
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
function DropdownMenuSub({ ...props }) {
|
|
941
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.SubmenuRoot, {
|
|
942
|
-
"data-slot": "dropdown-menu-sub",
|
|
943
|
-
...props
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
function DropdownMenuSubTrigger({
|
|
947
|
-
className,
|
|
948
|
-
inset,
|
|
949
|
-
children,
|
|
950
|
-
...props
|
|
951
|
-
}) {
|
|
952
|
-
return /* @__PURE__ */ jsxs2(MenuPrimitive.SubmenuTrigger, {
|
|
953
|
-
"data-slot": "dropdown-menu-sub-trigger",
|
|
954
|
-
"data-inset": inset,
|
|
955
|
-
className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
956
|
-
...props,
|
|
957
|
-
children: [
|
|
958
|
-
children,
|
|
959
|
-
/* @__PURE__ */ jsx6(ChevronRightIcon, {
|
|
960
|
-
className: "ml-auto"
|
|
961
|
-
})
|
|
962
|
-
]
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
function DropdownMenuSubContent({
|
|
966
|
-
align = "start",
|
|
967
|
-
alignOffset = -3,
|
|
968
|
-
side = "right",
|
|
969
|
-
sideOffset = 0,
|
|
970
|
-
className,
|
|
971
|
-
...props
|
|
972
|
-
}) {
|
|
973
|
-
return /* @__PURE__ */ jsx6(DropdownMenuContent, {
|
|
974
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
975
|
-
className: cn("w-auto min-w-[96px] rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
976
|
-
align,
|
|
977
|
-
alignOffset,
|
|
978
|
-
side,
|
|
979
|
-
sideOffset,
|
|
980
|
-
...props
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
function DropdownMenuCheckboxItem({
|
|
984
|
-
className,
|
|
985
|
-
children,
|
|
986
|
-
checked,
|
|
987
|
-
inset,
|
|
988
|
-
...props
|
|
989
|
-
}) {
|
|
990
|
-
return /* @__PURE__ */ jsxs2(MenuPrimitive.CheckboxItem, {
|
|
991
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
992
|
-
"data-inset": inset,
|
|
993
|
-
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
994
|
-
checked,
|
|
995
|
-
...props,
|
|
996
|
-
children: [
|
|
997
|
-
/* @__PURE__ */ jsx6("span", {
|
|
998
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
999
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
1000
|
-
children: /* @__PURE__ */ jsx6(MenuPrimitive.CheckboxItemIndicator, {
|
|
1001
|
-
children: /* @__PURE__ */ jsx6(CheckIcon, {})
|
|
1002
|
-
})
|
|
1003
|
-
}),
|
|
1004
|
-
children
|
|
1005
|
-
]
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
function DropdownMenuRadioGroup({ ...props }) {
|
|
1009
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.RadioGroup, {
|
|
1010
|
-
"data-slot": "dropdown-menu-radio-group",
|
|
1011
|
-
...props
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
function DropdownMenuRadioItem({
|
|
1015
|
-
className,
|
|
1016
|
-
children,
|
|
1017
|
-
inset,
|
|
1018
|
-
...props
|
|
1019
|
-
}) {
|
|
1020
|
-
return /* @__PURE__ */ jsxs2(MenuPrimitive.RadioItem, {
|
|
1021
|
-
"data-slot": "dropdown-menu-radio-item",
|
|
1022
|
-
"data-inset": inset,
|
|
1023
|
-
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1024
|
-
...props,
|
|
1025
|
-
children: [
|
|
1026
|
-
/* @__PURE__ */ jsx6("span", {
|
|
1027
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
1028
|
-
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
1029
|
-
children: /* @__PURE__ */ jsx6(MenuPrimitive.RadioItemIndicator, {
|
|
1030
|
-
children: /* @__PURE__ */ jsx6(CheckIcon, {})
|
|
1031
|
-
})
|
|
1032
|
-
}),
|
|
1033
|
-
children
|
|
1034
|
-
]
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function DropdownMenuSeparator({
|
|
1038
|
-
className,
|
|
1039
|
-
...props
|
|
1040
|
-
}) {
|
|
1041
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Separator, {
|
|
1042
|
-
"data-slot": "dropdown-menu-separator",
|
|
1043
|
-
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
1044
|
-
...props
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
// ../../src/components/ui/pagination.tsx
|
|
1049
|
-
import {
|
|
1050
|
-
ChevronLeft,
|
|
1051
|
-
ChevronRight,
|
|
1052
|
-
ChevronsLeft,
|
|
1053
|
-
ChevronsRight
|
|
1054
|
-
} from "lucide-react";
|
|
1055
|
-
import { useId } from "react";
|
|
1056
|
-
|
|
1057
|
-
// ../../src/components/ui/label.tsx
|
|
1058
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1059
|
-
"use client";
|
|
1060
|
-
function Label({ className, ...props }) {
|
|
1061
|
-
return /* @__PURE__ */ jsx7("label", {
|
|
1062
|
-
"data-slot": "label",
|
|
1063
|
-
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
1064
|
-
...props
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
// ../../src/components/ui/select.tsx
|
|
1069
|
-
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
1070
|
-
import { ChevronDownIcon, CheckIcon as CheckIcon2, ChevronUpIcon } from "lucide-react";
|
|
1071
|
-
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1072
|
-
"use client";
|
|
1073
|
-
var Select = SelectPrimitive.Root;
|
|
1074
|
-
function SelectValue({ className, ...props }) {
|
|
1075
|
-
return /* @__PURE__ */ jsx8(SelectPrimitive.Value, {
|
|
1076
|
-
"data-slot": "select-value",
|
|
1077
|
-
className: cn("flex flex-1 text-left", className),
|
|
1078
|
-
...props
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
function SelectTrigger({
|
|
1082
|
-
className,
|
|
1083
|
-
size = "default",
|
|
1084
|
-
children,
|
|
851
|
+
size = "default",
|
|
852
|
+
children,
|
|
1085
853
|
...props
|
|
1086
854
|
}) {
|
|
1087
855
|
return /* @__PURE__ */ jsxs3(SelectPrimitive.Trigger, {
|
|
@@ -1151,7 +919,7 @@ function SelectItem({
|
|
|
1151
919
|
render: /* @__PURE__ */ jsx8("span", {
|
|
1152
920
|
className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
|
|
1153
921
|
}),
|
|
1154
|
-
children: /* @__PURE__ */ jsx8(
|
|
922
|
+
children: /* @__PURE__ */ jsx8(CheckIcon3, {
|
|
1155
923
|
className: "pointer-events-none"
|
|
1156
924
|
})
|
|
1157
925
|
})
|
|
@@ -1183,7 +951,7 @@ function SelectScrollDownButton({
|
|
|
1183
951
|
|
|
1184
952
|
// ../../src/components/ui/pagination.tsx
|
|
1185
953
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1186
|
-
var
|
|
954
|
+
var messages = {
|
|
1187
955
|
en: {
|
|
1188
956
|
pageSize: "Page size",
|
|
1189
957
|
results: (count) => `${count} results`,
|
|
@@ -1206,7 +974,7 @@ var messages2 = {
|
|
|
1206
974
|
}
|
|
1207
975
|
};
|
|
1208
976
|
var paginationMessages = (locale = getLocale(), overrides) => ({
|
|
1209
|
-
...locale.startsWith("fr") ?
|
|
977
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
1210
978
|
...overrides
|
|
1211
979
|
});
|
|
1212
980
|
function Pagination({
|
|
@@ -1222,7 +990,7 @@ function Pagination({
|
|
|
1222
990
|
showResults = true,
|
|
1223
991
|
totalRows
|
|
1224
992
|
}) {
|
|
1225
|
-
const
|
|
993
|
+
const labels2 = paginationMessages(getLocale(), messageOverrides);
|
|
1226
994
|
const pageSizeId = useId();
|
|
1227
995
|
const canGoBack = page > 0;
|
|
1228
996
|
const canGoForward = page + 1 < pageCount;
|
|
@@ -1233,10 +1001,10 @@ function Pagination({
|
|
|
1233
1001
|
className: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
|
|
1234
1002
|
children: [
|
|
1235
1003
|
/* @__PURE__ */ jsx9("span", {
|
|
1236
|
-
children:
|
|
1004
|
+
children: labels2.results(totalRows)
|
|
1237
1005
|
}),
|
|
1238
1006
|
selectedRows > 0 ? /* @__PURE__ */ jsx9("span", {
|
|
1239
|
-
children:
|
|
1007
|
+
children: labels2.selectedOf(selectedRows, totalRows)
|
|
1240
1008
|
}) : null
|
|
1241
1009
|
]
|
|
1242
1010
|
}) : null,
|
|
@@ -1249,7 +1017,7 @@ function Pagination({
|
|
|
1249
1017
|
/* @__PURE__ */ jsx9(Label, {
|
|
1250
1018
|
htmlFor: pageSizeId,
|
|
1251
1019
|
className: cn("hidden text-sm sm:block", compact && "block"),
|
|
1252
|
-
children:
|
|
1020
|
+
children: labels2.pageSize
|
|
1253
1021
|
}),
|
|
1254
1022
|
/* @__PURE__ */ jsxs4(Select, {
|
|
1255
1023
|
items: pageSizes.map((size) => ({
|
|
@@ -1282,7 +1050,7 @@ function Pagination({
|
|
|
1282
1050
|
children: [
|
|
1283
1051
|
/* @__PURE__ */ jsx9("div", {
|
|
1284
1052
|
className: "flex items-center justify-center text-sm font-medium sm:block",
|
|
1285
|
-
children:
|
|
1053
|
+
children: labels2.pageOf(page + 1, pageCount)
|
|
1286
1054
|
}),
|
|
1287
1055
|
/* @__PURE__ */ jsxs4("div", {
|
|
1288
1056
|
className: "flex items-center gap-1",
|
|
@@ -1295,7 +1063,7 @@ function Pagination({
|
|
|
1295
1063
|
children: [
|
|
1296
1064
|
/* @__PURE__ */ jsx9("span", {
|
|
1297
1065
|
className: "sr-only",
|
|
1298
|
-
children:
|
|
1066
|
+
children: labels2.goToFirstPage
|
|
1299
1067
|
}),
|
|
1300
1068
|
/* @__PURE__ */ jsx9(ChevronsLeft, {})
|
|
1301
1069
|
]
|
|
@@ -1308,7 +1076,7 @@ function Pagination({
|
|
|
1308
1076
|
children: [
|
|
1309
1077
|
/* @__PURE__ */ jsx9("span", {
|
|
1310
1078
|
className: "sr-only",
|
|
1311
|
-
children:
|
|
1079
|
+
children: labels2.goToPreviousPage
|
|
1312
1080
|
}),
|
|
1313
1081
|
/* @__PURE__ */ jsx9(ChevronLeft, {})
|
|
1314
1082
|
]
|
|
@@ -1321,7 +1089,7 @@ function Pagination({
|
|
|
1321
1089
|
children: [
|
|
1322
1090
|
/* @__PURE__ */ jsx9("span", {
|
|
1323
1091
|
className: "sr-only",
|
|
1324
|
-
children:
|
|
1092
|
+
children: labels2.goToNextPage
|
|
1325
1093
|
}),
|
|
1326
1094
|
/* @__PURE__ */ jsx9(ChevronRight, {})
|
|
1327
1095
|
]
|
|
@@ -1334,7 +1102,7 @@ function Pagination({
|
|
|
1334
1102
|
children: [
|
|
1335
1103
|
/* @__PURE__ */ jsx9("span", {
|
|
1336
1104
|
className: "sr-only",
|
|
1337
|
-
children:
|
|
1105
|
+
children: labels2.goToLastPage
|
|
1338
1106
|
}),
|
|
1339
1107
|
/* @__PURE__ */ jsx9(ChevronsRight, {})
|
|
1340
1108
|
]
|
|
@@ -1525,13 +1293,381 @@ function TooltipContent({
|
|
|
1525
1293
|
className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
1526
1294
|
...props,
|
|
1527
1295
|
children: [
|
|
1528
|
-
children,
|
|
1529
|
-
/* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, {
|
|
1530
|
-
className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
|
|
1531
|
-
})
|
|
1296
|
+
children,
|
|
1297
|
+
/* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, {
|
|
1298
|
+
className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
|
|
1299
|
+
})
|
|
1300
|
+
]
|
|
1301
|
+
})
|
|
1302
|
+
})
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// ../../src/components/ui/virtualized-combobox.tsx
|
|
1307
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
1308
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
1309
|
+
import { Check, ChevronsUpDown, X } from "lucide-react";
|
|
1310
|
+
import {
|
|
1311
|
+
useCallback,
|
|
1312
|
+
useEffect,
|
|
1313
|
+
useImperativeHandle,
|
|
1314
|
+
useRef
|
|
1315
|
+
} from "react";
|
|
1316
|
+
|
|
1317
|
+
// ../../src/components/ui/input-group.tsx
|
|
1318
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
1319
|
+
|
|
1320
|
+
// ../../src/components/ui/textarea.tsx
|
|
1321
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1322
|
+
|
|
1323
|
+
// ../../src/components/ui/input-group.tsx
|
|
1324
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1325
|
+
function InputGroup({ className, ...props }) {
|
|
1326
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
1327
|
+
"data-slot": "input-group",
|
|
1328
|
+
role: "group",
|
|
1329
|
+
className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
|
|
1330
|
+
...props
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
var inputGroupAddonVariants = cva3("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
1334
|
+
variants: {
|
|
1335
|
+
align: {
|
|
1336
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
1337
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
1338
|
+
"block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
1339
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
defaultVariants: { align: "inline-start" }
|
|
1343
|
+
});
|
|
1344
|
+
var inputGroupButtonVariants = cva3("flex items-center gap-2 text-sm shadow-none", {
|
|
1345
|
+
variants: {
|
|
1346
|
+
size: {
|
|
1347
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
1348
|
+
sm: "",
|
|
1349
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
1350
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
defaultVariants: { size: "xs" }
|
|
1354
|
+
});
|
|
1355
|
+
function InputGroupInput({
|
|
1356
|
+
className,
|
|
1357
|
+
...props
|
|
1358
|
+
}) {
|
|
1359
|
+
return /* @__PURE__ */ jsx15(Input, {
|
|
1360
|
+
"data-slot": "input-group-control",
|
|
1361
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
|
|
1362
|
+
...props
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// ../../src/components/ui/virtualized-combobox.tsx
|
|
1367
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1368
|
+
"use client";
|
|
1369
|
+
var messages2 = {
|
|
1370
|
+
en: {
|
|
1371
|
+
clear: "Clear selection",
|
|
1372
|
+
search: "Search...",
|
|
1373
|
+
selected: (count) => `${count} selected`,
|
|
1374
|
+
selectMore: "Select more"
|
|
1375
|
+
},
|
|
1376
|
+
fr: {
|
|
1377
|
+
clear: "Effacer la sélection",
|
|
1378
|
+
search: "Rechercher...",
|
|
1379
|
+
selected: (count) => `${count} sélectionnés`,
|
|
1380
|
+
selectMore: "Sélectionner davantage"
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
var virtualizedComboboxMessages = (overrides) => ({
|
|
1384
|
+
...getLocale().startsWith("fr") ? messages2.fr : messages2.en,
|
|
1385
|
+
...overrides
|
|
1386
|
+
});
|
|
1387
|
+
var optionEquals = (item, selected) => item.value === selected.value;
|
|
1388
|
+
var VirtualizedComboboxList = ({
|
|
1389
|
+
emptyLabel,
|
|
1390
|
+
groupSelections,
|
|
1391
|
+
itemIndexRef,
|
|
1392
|
+
messages: messageOverrides,
|
|
1393
|
+
renderItem,
|
|
1394
|
+
selectedValues,
|
|
1395
|
+
virtualizerRef
|
|
1396
|
+
}) => {
|
|
1397
|
+
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
1398
|
+
const labels2 = virtualizedComboboxMessages(messageOverrides);
|
|
1399
|
+
const itemEntries = filteredItems.map((item, index) => ({
|
|
1400
|
+
kind: "item",
|
|
1401
|
+
item,
|
|
1402
|
+
index
|
|
1403
|
+
}));
|
|
1404
|
+
const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
|
|
1405
|
+
const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
|
|
1406
|
+
const entries = groupSelections ? [
|
|
1407
|
+
...selectedEntries.length > 0 ? [
|
|
1408
|
+
{
|
|
1409
|
+
kind: "group",
|
|
1410
|
+
key: "selected",
|
|
1411
|
+
label: labels2.selected(selectedValues.size)
|
|
1412
|
+
},
|
|
1413
|
+
...selectedEntries
|
|
1414
|
+
] : [],
|
|
1415
|
+
{
|
|
1416
|
+
kind: "group",
|
|
1417
|
+
key: "available",
|
|
1418
|
+
label: labels2.selectMore
|
|
1419
|
+
},
|
|
1420
|
+
...availableEntries
|
|
1421
|
+
] : itemEntries;
|
|
1422
|
+
const scrollRef = useRef(null);
|
|
1423
|
+
const virtualizer = useVirtualizer({
|
|
1424
|
+
count: entries.length,
|
|
1425
|
+
getScrollElement: () => scrollRef.current,
|
|
1426
|
+
getItemKey: (index) => {
|
|
1427
|
+
const entry = entries[index];
|
|
1428
|
+
return entry?.kind === "group" ? `group-${entry.key}` : entry?.item.value ?? index;
|
|
1429
|
+
},
|
|
1430
|
+
estimateSize: () => 36,
|
|
1431
|
+
overscan: 8
|
|
1432
|
+
});
|
|
1433
|
+
useEffect(() => {
|
|
1434
|
+
itemIndexRef.current = new Map(entries.flatMap((entry, index) => entry.kind === "item" ? [[entry.index, index]] : []));
|
|
1435
|
+
});
|
|
1436
|
+
useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
|
|
1437
|
+
const handleScrollElementRef = useCallback((element) => {
|
|
1438
|
+
scrollRef.current = element;
|
|
1439
|
+
if (element)
|
|
1440
|
+
virtualizer.measure();
|
|
1441
|
+
}, [virtualizer]);
|
|
1442
|
+
if (filteredItems.length === 0) {
|
|
1443
|
+
return /* @__PURE__ */ jsx16("div", {
|
|
1444
|
+
className: "text-muted-foreground py-6 text-center text-sm",
|
|
1445
|
+
children: emptyLabel
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return /* @__PURE__ */ jsx16(ComboboxPrimitive.List, {
|
|
1449
|
+
className: "scroll-py-1 overflow-auto overscroll-contain p-1",
|
|
1450
|
+
ref: handleScrollElementRef,
|
|
1451
|
+
style: {
|
|
1452
|
+
height: Math.min(virtualizer.getTotalSize() + 8, 288),
|
|
1453
|
+
maxHeight: "var(--available-height)"
|
|
1454
|
+
},
|
|
1455
|
+
children: /* @__PURE__ */ jsx16("div", {
|
|
1456
|
+
className: "relative w-full",
|
|
1457
|
+
role: "presentation",
|
|
1458
|
+
style: { height: virtualizer.getTotalSize() },
|
|
1459
|
+
children: virtualizer.getVirtualItems().map((virtualItem) => {
|
|
1460
|
+
const entry = entries[virtualItem.index];
|
|
1461
|
+
if (!entry)
|
|
1462
|
+
return null;
|
|
1463
|
+
const style = {
|
|
1464
|
+
height: virtualItem.size,
|
|
1465
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
1466
|
+
};
|
|
1467
|
+
if (entry.kind === "group") {
|
|
1468
|
+
return /* @__PURE__ */ jsx16(ComboboxPrimitive.Group, {
|
|
1469
|
+
className: "contents",
|
|
1470
|
+
children: /* @__PURE__ */ jsx16(ComboboxPrimitive.GroupLabel, {
|
|
1471
|
+
className: "text-muted-foreground absolute top-0 left-0 w-full px-2 pt-3 pb-1 text-xs",
|
|
1472
|
+
"data-index": virtualItem.index,
|
|
1473
|
+
ref: virtualizer.measureElement,
|
|
1474
|
+
style,
|
|
1475
|
+
children: entry.label
|
|
1476
|
+
})
|
|
1477
|
+
}, entry.key);
|
|
1478
|
+
}
|
|
1479
|
+
return /* @__PURE__ */ jsxs7(ComboboxPrimitive.Item, {
|
|
1480
|
+
"aria-posinset": entry.index + 1,
|
|
1481
|
+
"aria-setsize": filteredItems.length,
|
|
1482
|
+
className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground absolute top-0 left-0 flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
1483
|
+
"data-index": virtualItem.index,
|
|
1484
|
+
index: entry.index,
|
|
1485
|
+
ref: virtualizer.measureElement,
|
|
1486
|
+
style,
|
|
1487
|
+
value: entry.item,
|
|
1488
|
+
children: [
|
|
1489
|
+
renderItem?.(entry.item) ?? /* @__PURE__ */ jsx16("span", {
|
|
1490
|
+
className: "min-w-0 truncate",
|
|
1491
|
+
children: entry.item.label
|
|
1492
|
+
}),
|
|
1493
|
+
/* @__PURE__ */ jsx16(ComboboxPrimitive.ItemIndicator, {
|
|
1494
|
+
className: "absolute right-2 flex size-4 items-center justify-center",
|
|
1495
|
+
children: /* @__PURE__ */ jsx16(Check, {})
|
|
1496
|
+
})
|
|
1497
|
+
]
|
|
1498
|
+
}, entry.item.value);
|
|
1499
|
+
})
|
|
1500
|
+
})
|
|
1501
|
+
});
|
|
1502
|
+
};
|
|
1503
|
+
var VirtualizedComboboxContent = ({
|
|
1504
|
+
contentClassName,
|
|
1505
|
+
emptyLabel,
|
|
1506
|
+
groupSelections,
|
|
1507
|
+
itemIndexRef,
|
|
1508
|
+
messages: messageOverrides,
|
|
1509
|
+
renderItem,
|
|
1510
|
+
selectedValues,
|
|
1511
|
+
virtualizerRef
|
|
1512
|
+
}) => {
|
|
1513
|
+
const labels2 = virtualizedComboboxMessages(messageOverrides);
|
|
1514
|
+
return /* @__PURE__ */ jsx16(ComboboxPrimitive.Portal, {
|
|
1515
|
+
children: /* @__PURE__ */ jsx16(ComboboxPrimitive.Positioner, {
|
|
1516
|
+
align: "start",
|
|
1517
|
+
className: "isolate z-50",
|
|
1518
|
+
side: "bottom",
|
|
1519
|
+
sideOffset: 6,
|
|
1520
|
+
children: /* @__PURE__ */ jsxs7(ComboboxPrimitive.Popup, {
|
|
1521
|
+
className: cn("relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-in-95", contentClassName),
|
|
1522
|
+
children: [
|
|
1523
|
+
/* @__PURE__ */ jsx16("div", {
|
|
1524
|
+
className: "min-w-0 p-1 pb-0",
|
|
1525
|
+
children: /* @__PURE__ */ jsx16(InputGroup, {
|
|
1526
|
+
className: "border-input/30 bg-input/30 h-8 w-full min-w-0 shadow-none",
|
|
1527
|
+
children: /* @__PURE__ */ jsx16(ComboboxPrimitive.Input, {
|
|
1528
|
+
placeholder: labels2.search,
|
|
1529
|
+
render: /* @__PURE__ */ jsx16(InputGroupInput, {})
|
|
1530
|
+
})
|
|
1531
|
+
})
|
|
1532
|
+
}),
|
|
1533
|
+
/* @__PURE__ */ jsx16(VirtualizedComboboxList, {
|
|
1534
|
+
emptyLabel,
|
|
1535
|
+
groupSelections,
|
|
1536
|
+
itemIndexRef,
|
|
1537
|
+
messages: messageOverrides,
|
|
1538
|
+
renderItem,
|
|
1539
|
+
selectedValues,
|
|
1540
|
+
virtualizerRef
|
|
1541
|
+
})
|
|
1542
|
+
]
|
|
1543
|
+
})
|
|
1544
|
+
})
|
|
1545
|
+
});
|
|
1546
|
+
};
|
|
1547
|
+
var defaultTrigger = (ariaLabel, ariaInvalid, disabled, label, triggerId) => /* @__PURE__ */ jsxs7(Button, {
|
|
1548
|
+
"aria-label": ariaLabel,
|
|
1549
|
+
"aria-invalid": ariaInvalid,
|
|
1550
|
+
className: "w-full max-w-full min-w-0 justify-between overflow-hidden",
|
|
1551
|
+
disabled,
|
|
1552
|
+
id: triggerId,
|
|
1553
|
+
type: "button",
|
|
1554
|
+
variant: "outline",
|
|
1555
|
+
children: [
|
|
1556
|
+
/* @__PURE__ */ jsx16("span", {
|
|
1557
|
+
className: "min-w-0 flex-1 truncate pr-7 text-left",
|
|
1558
|
+
children: label
|
|
1559
|
+
}),
|
|
1560
|
+
/* @__PURE__ */ jsx16(ChevronsUpDown, {
|
|
1561
|
+
className: "text-muted-foreground shrink-0 opacity-70"
|
|
1562
|
+
})
|
|
1563
|
+
]
|
|
1564
|
+
});
|
|
1565
|
+
var defaultClear = (label) => /* @__PURE__ */ jsx16(ComboboxPrimitive.Clear, {
|
|
1566
|
+
"aria-label": label,
|
|
1567
|
+
className: "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute top-1/2 right-7 z-10 flex size-6 -translate-y-1/2 items-center justify-center rounded-sm outline-none focus-visible:border focus-visible:ring-3",
|
|
1568
|
+
type: "button",
|
|
1569
|
+
children: /* @__PURE__ */ jsx16(X, {
|
|
1570
|
+
className: "size-3.5"
|
|
1571
|
+
})
|
|
1572
|
+
});
|
|
1573
|
+
var selectedLabel = (value, placeholder) => {
|
|
1574
|
+
if (Array.isArray(value)) {
|
|
1575
|
+
return value.length > 0 ? value.map(({ label }) => label).join(", ") : placeholder;
|
|
1576
|
+
}
|
|
1577
|
+
return value && "label" in value ? value.label : placeholder;
|
|
1578
|
+
};
|
|
1579
|
+
var useComboboxVirtualizerRef = (providedRef) => {
|
|
1580
|
+
const localRef = useRef(null);
|
|
1581
|
+
return providedRef ?? localRef;
|
|
1582
|
+
};
|
|
1583
|
+
var VirtualizedComboboxSingle = (props) => {
|
|
1584
|
+
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1585
|
+
const itemIndexRef = useRef(new Map);
|
|
1586
|
+
const labels2 = virtualizedComboboxMessages(props.messages);
|
|
1587
|
+
return /* @__PURE__ */ jsxs7(ComboboxPrimitive.Root, {
|
|
1588
|
+
disabled: props.disabled,
|
|
1589
|
+
inputValue: props.searchValue,
|
|
1590
|
+
items: [...props.items],
|
|
1591
|
+
itemToStringLabel: (item) => item.label,
|
|
1592
|
+
isItemEqualToValue: optionEquals,
|
|
1593
|
+
onInputValueChange: (value) => props.onSearchValueChange?.(value),
|
|
1594
|
+
onItemHighlighted: (_, { index, reason }) => {
|
|
1595
|
+
if (reason === "keyboard" && index >= 0) {
|
|
1596
|
+
virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
onOpenChange: (open) => props.onOpenChange?.(open),
|
|
1600
|
+
onValueChange: (value) => props.onValueChange(value),
|
|
1601
|
+
open: props.open,
|
|
1602
|
+
value: props.value,
|
|
1603
|
+
virtualized: true,
|
|
1604
|
+
children: [
|
|
1605
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1606
|
+
className: "relative",
|
|
1607
|
+
children: [
|
|
1608
|
+
/* @__PURE__ */ jsx16(ComboboxPrimitive.Trigger, {
|
|
1609
|
+
render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
|
|
1610
|
+
}),
|
|
1611
|
+
props.trigger ? null : defaultClear(labels2.clear)
|
|
1612
|
+
]
|
|
1613
|
+
}),
|
|
1614
|
+
/* @__PURE__ */ jsx16(VirtualizedComboboxContent, {
|
|
1615
|
+
...props,
|
|
1616
|
+
groupSelections: false,
|
|
1617
|
+
itemIndexRef,
|
|
1618
|
+
selectedValues: new Set(props.value ? [props.value.value] : []),
|
|
1619
|
+
virtualizerRef
|
|
1620
|
+
})
|
|
1621
|
+
]
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
var VirtualizedComboboxMultiple = (props) => {
|
|
1625
|
+
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1626
|
+
const itemIndexRef = useRef(new Map);
|
|
1627
|
+
const labels2 = virtualizedComboboxMessages(props.messages);
|
|
1628
|
+
return /* @__PURE__ */ jsxs7(ComboboxPrimitive.Root, {
|
|
1629
|
+
disabled: props.disabled,
|
|
1630
|
+
inputValue: props.searchValue,
|
|
1631
|
+
items: [...props.items],
|
|
1632
|
+
itemToStringLabel: (item) => item.label,
|
|
1633
|
+
isItemEqualToValue: optionEquals,
|
|
1634
|
+
multiple: true,
|
|
1635
|
+
onInputValueChange: (value) => props.onSearchValueChange?.(value),
|
|
1636
|
+
onItemHighlighted: (_, { index, reason }) => {
|
|
1637
|
+
if (reason === "keyboard" && index >= 0) {
|
|
1638
|
+
virtualizerRef.current?.scrollToIndex(itemIndexRef.current.get(index) ?? index, { align: "auto" });
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
onOpenChange: (open) => props.onOpenChange?.(open),
|
|
1642
|
+
onValueChange: (value) => props.onValueChange(value),
|
|
1643
|
+
open: props.open,
|
|
1644
|
+
value: [...props.value],
|
|
1645
|
+
virtualized: true,
|
|
1646
|
+
children: [
|
|
1647
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1648
|
+
className: "relative",
|
|
1649
|
+
children: [
|
|
1650
|
+
/* @__PURE__ */ jsx16(ComboboxPrimitive.Trigger, {
|
|
1651
|
+
render: props.trigger ?? defaultTrigger(props.ariaLabel, props.ariaInvalid, props.disabled, selectedLabel(props.value, props.placeholder), props.triggerId)
|
|
1652
|
+
}),
|
|
1653
|
+
props.trigger ? null : defaultClear(labels2.clear)
|
|
1532
1654
|
]
|
|
1655
|
+
}),
|
|
1656
|
+
/* @__PURE__ */ jsx16(VirtualizedComboboxContent, {
|
|
1657
|
+
...props,
|
|
1658
|
+
groupSelections: true,
|
|
1659
|
+
itemIndexRef,
|
|
1660
|
+
selectedValues: new Set(props.value.map(({ value }) => value)),
|
|
1661
|
+
virtualizerRef
|
|
1533
1662
|
})
|
|
1534
|
-
|
|
1663
|
+
]
|
|
1664
|
+
});
|
|
1665
|
+
};
|
|
1666
|
+
function VirtualizedCombobox(props) {
|
|
1667
|
+
return props.multiple ? /* @__PURE__ */ jsx16(VirtualizedComboboxMultiple, {
|
|
1668
|
+
...props
|
|
1669
|
+
}) : /* @__PURE__ */ jsx16(VirtualizedComboboxSingle, {
|
|
1670
|
+
...props
|
|
1535
1671
|
});
|
|
1536
1672
|
}
|
|
1537
1673
|
|
|
@@ -1599,243 +1735,170 @@ var SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortP
|
|
|
1599
1735
|
sortParams.push(sortParam);
|
|
1600
1736
|
}
|
|
1601
1737
|
return Effect.succeed(sortParams);
|
|
1602
|
-
},
|
|
1603
|
-
encode: (sort) => Effect.succeed(sort.map((part) => Schema.encodeSync(SortParamFromString)(part)).join(","))
|
|
1604
|
-
})), Schema.annotate({
|
|
1605
|
-
identifier: "SortParamsFromString",
|
|
1606
|
-
title: "Sort Parameters From String",
|
|
1607
|
-
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
1608
|
-
examples: [
|
|
1609
|
-
[
|
|
1610
|
-
{ id: "name", direction: "desc" },
|
|
1611
|
-
{ id: "age", direction: "asc" }
|
|
1612
|
-
]
|
|
1613
|
-
]
|
|
1614
|
-
}));
|
|
1615
|
-
var SortParamSearch = SortParamsFromString.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
|
|
1616
|
-
decode: (sort) => Schema.encodeSync(SortParamsFromString)(sort),
|
|
1617
|
-
encode: (sort) => Schema.decodeUnknownSync(SortParamsFromString)(sort)
|
|
1618
|
-
})), Schema.annotate({
|
|
1619
|
-
identifier: "SortParamSearch",
|
|
1620
|
-
title: "Sort Search Parameter",
|
|
1621
|
-
description: 'Search parameter sort value normalized to the compact "-field,otherField" URL format.',
|
|
1622
|
-
examples: ["-name,age"]
|
|
1623
|
-
}));
|
|
1624
|
-
var Query = Schema.Struct({
|
|
1625
|
-
page: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
1626
|
-
pageSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),
|
|
1627
|
-
globalFilter: Schema.optional(Schema.String),
|
|
1628
|
-
sort: Schema.optional(SortParamSearch)
|
|
1629
|
-
}).annotate({
|
|
1630
|
-
identifier: "Query",
|
|
1631
|
-
title: "Query",
|
|
1632
|
-
description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
|
|
1633
|
-
examples: [
|
|
1634
|
-
{
|
|
1635
|
-
page: 0,
|
|
1636
|
-
pageSize: 10,
|
|
1637
|
-
globalFilter: "housing",
|
|
1638
|
-
sort: "-publicName,createdAt"
|
|
1639
|
-
}
|
|
1640
|
-
]
|
|
1641
|
-
});
|
|
1642
|
-
var PaginationMeta = Schema.Struct({
|
|
1643
|
-
page: Schema.Int,
|
|
1644
|
-
pageSize: Schema.Int,
|
|
1645
|
-
total: Schema.Int,
|
|
1646
|
-
pageCount: Schema.Int
|
|
1647
|
-
}).pipe(Schema.annotate({
|
|
1648
|
-
identifier: "PaginationMeta",
|
|
1649
|
-
title: "Pagination Metadata",
|
|
1650
|
-
description: "Pagination metadata returned with a paginated list response.",
|
|
1651
|
-
examples: [{ page: 0, pageSize: 10, total: 125, pageCount: 13 }]
|
|
1652
|
-
}));
|
|
1653
|
-
|
|
1654
|
-
// ../../src/components/ui/data-table.tsx
|
|
1655
|
-
import {
|
|
1656
|
-
DndContext,
|
|
1657
|
-
DragOverlay,
|
|
1658
|
-
PointerSensor,
|
|
1659
|
-
useDraggable,
|
|
1660
|
-
useDroppable,
|
|
1661
|
-
useSensor,
|
|
1662
|
-
useSensors
|
|
1663
|
-
} from "@dnd-kit/core";
|
|
1664
|
-
import {
|
|
1665
|
-
SortableContext,
|
|
1666
|
-
useSortable,
|
|
1667
|
-
verticalListSortingStrategy
|
|
1668
|
-
} from "@dnd-kit/sortable";
|
|
1669
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
1670
|
-
import {
|
|
1671
|
-
useNavigate,
|
|
1672
|
-
useRouterState
|
|
1673
|
-
} from "@tanstack/react-router";
|
|
1674
|
-
import { useAtom } from "@effect/atom-react";
|
|
1675
|
-
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
1676
|
-
import {
|
|
1677
|
-
flexRender,
|
|
1678
|
-
getCoreRowModel,
|
|
1679
|
-
getFilteredRowModel,
|
|
1680
|
-
getPaginationRowModel,
|
|
1681
|
-
getSortedRowModel,
|
|
1682
|
-
useReactTable
|
|
1683
|
-
} from "@tanstack/react-table";
|
|
1684
|
-
import {
|
|
1685
|
-
ArrowDown,
|
|
1686
|
-
ArrowUp,
|
|
1687
|
-
ChevronDown,
|
|
1688
|
-
ChevronRight as ChevronRight2,
|
|
1689
|
-
ChevronsUpDown as ChevronsUpDown2,
|
|
1690
|
-
Download,
|
|
1691
|
-
EyeOff,
|
|
1692
|
-
FileJson,
|
|
1693
|
-
FileText,
|
|
1694
|
-
GripVertical,
|
|
1695
|
-
LayoutGrid,
|
|
1696
|
-
MoreHorizontal,
|
|
1697
|
-
RefreshCw,
|
|
1698
|
-
Rows3,
|
|
1699
|
-
Search,
|
|
1700
|
-
Settings2,
|
|
1701
|
-
X as X2
|
|
1702
|
-
} from "lucide-react";
|
|
1703
|
-
import {
|
|
1704
|
-
useEffect as useEffect2,
|
|
1705
|
-
useMemo,
|
|
1706
|
-
useState,
|
|
1707
|
-
createContext
|
|
1708
|
-
} from "react";
|
|
1709
|
-
import { Effect as Effect2, Layer, Schema as Schema2 } from "effect";
|
|
1710
|
-
import { KeyValueStore } from "effect/unstable/persistence";
|
|
1711
|
-
import { Atom } from "effect/unstable/reactivity";
|
|
1712
|
-
|
|
1713
|
-
// ../../src/components/ui/badge.tsx
|
|
1714
|
-
import { mergeProps } from "@base-ui/react/merge-props";
|
|
1715
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
1716
|
-
import { cva as cva3 } from "class-variance-authority";
|
|
1717
|
-
var badgeVariants = cva3("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
1718
|
-
variants: {
|
|
1719
|
-
variant: {
|
|
1720
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
1721
|
-
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
1722
|
-
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
1723
|
-
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
1724
|
-
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
1725
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
1726
|
-
}
|
|
1727
|
-
},
|
|
1728
|
-
defaultVariants: {
|
|
1729
|
-
variant: "default"
|
|
1730
|
-
}
|
|
1731
|
-
});
|
|
1732
|
-
function Badge({
|
|
1733
|
-
className,
|
|
1734
|
-
variant = "default",
|
|
1735
|
-
render,
|
|
1736
|
-
...props
|
|
1737
|
-
}) {
|
|
1738
|
-
return useRender({
|
|
1739
|
-
defaultTagName: "span",
|
|
1740
|
-
props: mergeProps({
|
|
1741
|
-
className: cn(badgeVariants({ variant }), className)
|
|
1742
|
-
}, props),
|
|
1743
|
-
render,
|
|
1744
|
-
state: {
|
|
1745
|
-
slot: "badge",
|
|
1746
|
-
variant
|
|
1747
|
-
}
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
// ../../src/components/ui/card.tsx
|
|
1752
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1753
|
-
function Card({
|
|
1754
|
-
className,
|
|
1755
|
-
size = "default",
|
|
1756
|
-
...props
|
|
1757
|
-
}) {
|
|
1758
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1759
|
-
"data-slot": "card",
|
|
1760
|
-
"data-size": size,
|
|
1761
|
-
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
1762
|
-
...props
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
function CardHeader({ className, ...props }) {
|
|
1766
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1767
|
-
"data-slot": "card-header",
|
|
1768
|
-
className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className),
|
|
1769
|
-
...props
|
|
1770
|
-
});
|
|
1771
|
-
}
|
|
1772
|
-
function CardTitle({ className, ...props }) {
|
|
1773
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1774
|
-
"data-slot": "card-title",
|
|
1775
|
-
className: cn("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className),
|
|
1776
|
-
...props
|
|
1777
|
-
});
|
|
1778
|
-
}
|
|
1779
|
-
function CardDescription({ className, ...props }) {
|
|
1780
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1781
|
-
"data-slot": "card-description",
|
|
1782
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
1783
|
-
...props
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
function CardAction({ className, ...props }) {
|
|
1787
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1788
|
-
"data-slot": "card-action",
|
|
1789
|
-
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
1790
|
-
...props
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
function CardContent({ className, ...props }) {
|
|
1794
|
-
return /* @__PURE__ */ jsx14("div", {
|
|
1795
|
-
"data-slot": "card-content",
|
|
1796
|
-
className: cn("px-(--card-spacing)", className),
|
|
1797
|
-
...props
|
|
1798
|
-
});
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
// ../../src/components/ui/loading.tsx
|
|
1802
|
-
import { Loader2 } from "lucide-react";
|
|
1803
|
-
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1804
|
-
var labels = {
|
|
1805
|
-
en: {
|
|
1806
|
-
loading: "Loading..."
|
|
1807
|
-
},
|
|
1808
|
-
fr: {
|
|
1809
|
-
loading: "Chargement..."
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
var loadingLabel = () => getLocale().startsWith("fr") ? labels.fr.loading : labels.en.loading;
|
|
1813
|
-
function Loading({
|
|
1814
|
-
className,
|
|
1815
|
-
label,
|
|
1816
|
-
variant = "inline"
|
|
1817
|
-
}) {
|
|
1818
|
-
return /* @__PURE__ */ jsxs7("div", {
|
|
1819
|
-
className: cn("text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && "min-h-[50svh] w-full", className),
|
|
1820
|
-
children: [
|
|
1821
|
-
/* @__PURE__ */ jsx15(Loader2, {
|
|
1822
|
-
className: "size-4 animate-spin"
|
|
1823
|
-
}),
|
|
1824
|
-
label ?? loadingLabel()
|
|
1738
|
+
},
|
|
1739
|
+
encode: (sort) => Effect.succeed(sort.map((part) => Schema.encodeSync(SortParamFromString)(part)).join(","))
|
|
1740
|
+
})), Schema.annotate({
|
|
1741
|
+
identifier: "SortParamsFromString",
|
|
1742
|
+
title: "Sort Parameters From String",
|
|
1743
|
+
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
1744
|
+
examples: [
|
|
1745
|
+
[
|
|
1746
|
+
{ id: "name", direction: "desc" },
|
|
1747
|
+
{ id: "age", direction: "asc" }
|
|
1825
1748
|
]
|
|
1826
|
-
|
|
1827
|
-
}
|
|
1749
|
+
]
|
|
1750
|
+
}));
|
|
1751
|
+
var SortParamSearch = SortParamsFromString.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
|
|
1752
|
+
decode: (sort) => Schema.encodeSync(SortParamsFromString)(sort),
|
|
1753
|
+
encode: (sort) => Schema.decodeUnknownSync(SortParamsFromString)(sort)
|
|
1754
|
+
})), Schema.annotate({
|
|
1755
|
+
identifier: "SortParamSearch",
|
|
1756
|
+
title: "Sort Search Parameter",
|
|
1757
|
+
description: 'Search parameter sort value normalized to the compact "-field,otherField" URL format.',
|
|
1758
|
+
examples: ["-name,age"]
|
|
1759
|
+
}));
|
|
1760
|
+
var Query = Schema.Struct({
|
|
1761
|
+
page: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
1762
|
+
pageSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),
|
|
1763
|
+
globalFilter: Schema.optional(Schema.String),
|
|
1764
|
+
sort: Schema.optional(SortParamSearch)
|
|
1765
|
+
}).annotate({
|
|
1766
|
+
identifier: "Query",
|
|
1767
|
+
title: "Query",
|
|
1768
|
+
description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
|
|
1769
|
+
examples: [
|
|
1770
|
+
{
|
|
1771
|
+
page: 0,
|
|
1772
|
+
pageSize: 10,
|
|
1773
|
+
globalFilter: "housing",
|
|
1774
|
+
sort: "-publicName,createdAt"
|
|
1775
|
+
}
|
|
1776
|
+
]
|
|
1777
|
+
});
|
|
1778
|
+
var PaginationMeta = Schema.Struct({
|
|
1779
|
+
page: Schema.Int,
|
|
1780
|
+
pageSize: Schema.Int,
|
|
1781
|
+
total: Schema.Int,
|
|
1782
|
+
pageCount: Schema.Int
|
|
1783
|
+
}).pipe(Schema.annotate({
|
|
1784
|
+
identifier: "PaginationMeta",
|
|
1785
|
+
title: "Pagination Metadata",
|
|
1786
|
+
description: "Pagination metadata returned with a paginated list response.",
|
|
1787
|
+
examples: [{ page: 0, pageSize: 10, total: 125, pageCount: 13 }]
|
|
1788
|
+
}));
|
|
1828
1789
|
|
|
1829
1790
|
// ../../src/components/ui/data-table.tsx
|
|
1830
|
-
import {
|
|
1831
|
-
|
|
1791
|
+
import { useAtom } from "@effect/atom-react";
|
|
1792
|
+
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
1793
|
+
import {
|
|
1794
|
+
DndContext,
|
|
1795
|
+
DragOverlay,
|
|
1796
|
+
PointerSensor,
|
|
1797
|
+
useDraggable,
|
|
1798
|
+
useDroppable,
|
|
1799
|
+
useSensor,
|
|
1800
|
+
useSensors
|
|
1801
|
+
} from "@dnd-kit/core";
|
|
1802
|
+
import {
|
|
1803
|
+
arrayMove,
|
|
1804
|
+
SortableContext,
|
|
1805
|
+
useSortable,
|
|
1806
|
+
verticalListSortingStrategy
|
|
1807
|
+
} from "@dnd-kit/sortable";
|
|
1808
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
1809
|
+
import { Effect as Effect2, Layer, Option as Option2, Schema as Schema2 } from "effect";
|
|
1810
|
+
import { KeyValueStore } from "effect/unstable/persistence";
|
|
1811
|
+
import { Atom } from "effect/unstable/reactivity";
|
|
1812
|
+
import {
|
|
1813
|
+
ArrowDown,
|
|
1814
|
+
ArrowUp,
|
|
1815
|
+
ChevronDown,
|
|
1816
|
+
ChevronRight as ChevronRight2,
|
|
1817
|
+
ChevronsUpDown as ChevronsUpDown2,
|
|
1818
|
+
Download,
|
|
1819
|
+
EyeOff,
|
|
1820
|
+
FileJson,
|
|
1821
|
+
FileText,
|
|
1822
|
+
GripVertical,
|
|
1823
|
+
LayoutGrid,
|
|
1824
|
+
MoreHorizontal,
|
|
1825
|
+
RefreshCw,
|
|
1826
|
+
Rows3,
|
|
1827
|
+
Search,
|
|
1828
|
+
Settings2,
|
|
1829
|
+
X as X2
|
|
1830
|
+
} from "lucide-react";
|
|
1831
|
+
import {
|
|
1832
|
+
isValidElement,
|
|
1833
|
+
useEffect as useEffect2,
|
|
1834
|
+
useMemo,
|
|
1835
|
+
useState
|
|
1836
|
+
} from "react";
|
|
1837
|
+
import {
|
|
1838
|
+
useNavigate,
|
|
1839
|
+
useRouterState
|
|
1840
|
+
} from "@tanstack/react-router";
|
|
1841
|
+
import {
|
|
1842
|
+
columnFilteringFeature,
|
|
1843
|
+
columnResizingFeature,
|
|
1844
|
+
columnSizingFeature,
|
|
1845
|
+
columnVisibilityFeature,
|
|
1846
|
+
createFilteredRowModel,
|
|
1847
|
+
createPaginatedRowModel,
|
|
1848
|
+
createSortedRowModel,
|
|
1849
|
+
createTableHook,
|
|
1850
|
+
globalFilteringFeature,
|
|
1851
|
+
rowPaginationFeature,
|
|
1852
|
+
rowSelectionFeature,
|
|
1853
|
+
rowSortingFeature,
|
|
1854
|
+
tableFeatures,
|
|
1855
|
+
flexRender
|
|
1856
|
+
} from "@tanstack/react-table";
|
|
1857
|
+
import { jsx as jsx17, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
|
|
1858
|
+
var DEFAULT_COLUMN_MIN_SIZE = 128;
|
|
1859
|
+
var DEFAULT_COLUMN_SIZE = 224;
|
|
1860
|
+
var DEFAULT_COLUMN_MAX_SIZE = 640;
|
|
1861
|
+
var COLUMN_RESIZE_STEP = 8;
|
|
1862
|
+
var dataTableFeatures = tableFeatures({
|
|
1863
|
+
columnFilteringFeature,
|
|
1864
|
+
columnResizingFeature,
|
|
1865
|
+
columnSizingFeature,
|
|
1866
|
+
columnVisibilityFeature,
|
|
1867
|
+
globalFilteringFeature,
|
|
1868
|
+
rowPaginationFeature,
|
|
1869
|
+
rowSelectionFeature,
|
|
1870
|
+
rowSortingFeature,
|
|
1871
|
+
filteredRowModel: createFilteredRowModel(),
|
|
1872
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
1873
|
+
sortedRowModel: createSortedRowModel(),
|
|
1874
|
+
columnMeta: {}
|
|
1875
|
+
});
|
|
1876
|
+
var {
|
|
1877
|
+
createAppColumnHelper: createDataTableColumnHelper,
|
|
1878
|
+
useAppTable: useDataTable,
|
|
1879
|
+
useCellContext: useDataTableCellContext,
|
|
1880
|
+
useHeaderContext: useDataTableHeaderContext,
|
|
1881
|
+
useTableContext: useDataTableContext
|
|
1882
|
+
} = createTableHook({
|
|
1883
|
+
features: dataTableFeatures,
|
|
1884
|
+
defaultColumn: {
|
|
1885
|
+
minSize: DEFAULT_COLUMN_MIN_SIZE,
|
|
1886
|
+
size: DEFAULT_COLUMN_SIZE,
|
|
1887
|
+
maxSize: DEFAULT_COLUMN_MAX_SIZE
|
|
1888
|
+
},
|
|
1889
|
+
columnResizeMode: "onChange",
|
|
1890
|
+
enableColumnResizing: true,
|
|
1891
|
+
tableComponents: {},
|
|
1892
|
+
cellComponents: {},
|
|
1893
|
+
headerComponents: {}
|
|
1894
|
+
});
|
|
1832
1895
|
var TableSearchSchema = Schema2.Struct({
|
|
1833
1896
|
page: Schema2.optional(Query.fields.page),
|
|
1834
1897
|
pageSize: Schema2.optional(Query.fields.pageSize),
|
|
1835
1898
|
globalFilter: Query.fields.globalFilter,
|
|
1836
1899
|
sort: Query.fields.sort,
|
|
1837
1900
|
grouping: Schema2.optional(Schema2.Array(Schema2.String))
|
|
1838
|
-
});
|
|
1901
|
+
}).annotate({ identifier: "TableSearch" });
|
|
1839
1902
|
var TableSearchSchemaStandard = Schema2.toStandardSchemaV1(TableSearchSchema);
|
|
1840
1903
|
var compactDataTableStorage = Layer.effect(KeyValueStore.KeyValueStore, Effect2.map(KeyValueStore.KeyValueStore, (store) => KeyValueStore.make({
|
|
1841
1904
|
clear: store.clear,
|
|
@@ -1849,9 +1912,33 @@ var dataTableStorageRuntime = Atom.runtime(compactDataTableStorage);
|
|
|
1849
1912
|
var DataTableViewSchema = Schema2.Union([
|
|
1850
1913
|
Schema2.Literal("table"),
|
|
1851
1914
|
Schema2.Literal("gallery")
|
|
1852
|
-
]);
|
|
1853
|
-
var ColumnVisibilitySchema = Schema2.Record(Schema2.String, Schema2.Boolean);
|
|
1854
|
-
var ColumnSizingSchema = Schema2.Record(Schema2.String, Schema2.Number)
|
|
1915
|
+
]).annotate({ identifier: "DataTableView" });
|
|
1916
|
+
var ColumnVisibilitySchema = Schema2.Record(Schema2.String, Schema2.Boolean).annotate({ identifier: "DataTableColumnVisibility" });
|
|
1917
|
+
var ColumnSizingSchema = Schema2.Record(Schema2.String, Schema2.Number).annotate({
|
|
1918
|
+
identifier: "DataTableColumnSizing"
|
|
1919
|
+
});
|
|
1920
|
+
var RowDragDataSchema = Schema2.Struct({
|
|
1921
|
+
type: Schema2.Literal("row"),
|
|
1922
|
+
label: Schema2.optional(Schema2.String),
|
|
1923
|
+
rowId: Schema2.String
|
|
1924
|
+
}).annotate({ identifier: "DataTableRowDragData" });
|
|
1925
|
+
var RowReorderDragDataSchema = Schema2.Struct({
|
|
1926
|
+
type: Schema2.Literal("row-reorder")
|
|
1927
|
+
}).annotate({ identifier: "DataTableRowReorderDragData" });
|
|
1928
|
+
var GroupDropDataSchema = Schema2.Struct({
|
|
1929
|
+
type: Schema2.Literal("group-target"),
|
|
1930
|
+
fieldId: Schema2.String,
|
|
1931
|
+
groupId: Schema2.String
|
|
1932
|
+
}).annotate({ identifier: "DataTableGroupDropData" });
|
|
1933
|
+
var decodeTableSearch = Schema2.decodeUnknownOption(TableSearchSchema);
|
|
1934
|
+
var decodeDataTableView = Schema2.decodeUnknownOption(DataTableViewSchema);
|
|
1935
|
+
var decodeRowDragData = Schema2.decodeUnknownOption(RowDragDataSchema);
|
|
1936
|
+
var decodeRowReorderDragData = Schema2.decodeUnknownOption(RowReorderDragDataSchema);
|
|
1937
|
+
var decodeGroupDropData = Schema2.decodeUnknownOption(GroupDropDataSchema);
|
|
1938
|
+
var validateTableSearchUpdate = (search) => ({
|
|
1939
|
+
...search,
|
|
1940
|
+
...Schema2.decodeUnknownSync(TableSearchSchema)(search)
|
|
1941
|
+
});
|
|
1855
1942
|
var messages3 = {
|
|
1856
1943
|
en: {
|
|
1857
1944
|
...paginationMessages("en"),
|
|
@@ -1875,7 +1962,9 @@ var messages3 = {
|
|
|
1875
1962
|
sortBy: "Sort by",
|
|
1876
1963
|
reorder: "Drag to reorder",
|
|
1877
1964
|
resizeColumn: (column) => `Resize ${column} column`,
|
|
1878
|
-
listOthers: (count) => count === 1 ? "and 1 other" : `and ${count} others
|
|
1965
|
+
listOthers: (count) => count === 1 ? "and 1 other" : `and ${count} others`,
|
|
1966
|
+
selectAllRows: "Select all rows on this page",
|
|
1967
|
+
selectRow: "Select row"
|
|
1879
1968
|
},
|
|
1880
1969
|
fr: {
|
|
1881
1970
|
...paginationMessages("fr"),
|
|
@@ -1899,7 +1988,9 @@ var messages3 = {
|
|
|
1899
1988
|
sortBy: "Trier par",
|
|
1900
1989
|
reorder: "Glisser pour réordonner",
|
|
1901
1990
|
resizeColumn: (column) => `Redimensionner la colonne ${column}`,
|
|
1902
|
-
listOthers: (count) => count === 1 ? "et 1 autre" : `et ${count} autres
|
|
1991
|
+
listOthers: (count) => count === 1 ? "et 1 autre" : `et ${count} autres`,
|
|
1992
|
+
selectAllRows: "Sélectionner toutes les lignes de cette page",
|
|
1993
|
+
selectRow: "Sélectionner la ligne"
|
|
1903
1994
|
}
|
|
1904
1995
|
};
|
|
1905
1996
|
var dataTableMessages = (overrides) => ({
|
|
@@ -1935,6 +2026,11 @@ var getDefaultGrouping = (grouping) => {
|
|
|
1935
2026
|
var getGroupTargetDropId = (key) => `group-target:${key}`;
|
|
1936
2027
|
var getRowDragId = (rowId) => `row:${rowId}`;
|
|
1937
2028
|
var getSortableRowId = (rowId) => `sortable-row:${rowId}`;
|
|
2029
|
+
var getGroupLabels = (section) => {
|
|
2030
|
+
const rows = section.rows.map((row) => row.original);
|
|
2031
|
+
const label = section.field.getGroupLabel?.(section.groupId, rows) ?? section.groupId;
|
|
2032
|
+
return section.field.renderGroupLabel?.(section.groupId, rows) ?? label;
|
|
2033
|
+
};
|
|
1938
2034
|
var DataTableRowActions = ({
|
|
1939
2035
|
actions,
|
|
1940
2036
|
contentClassName,
|
|
@@ -1948,30 +2044,30 @@ var DataTableRowActions = ({
|
|
|
1948
2044
|
}
|
|
1949
2045
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
1950
2046
|
children: [
|
|
1951
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
1952
2048
|
onClick: (event) => event.stopPropagation(),
|
|
1953
2049
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
1954
|
-
className: "size-
|
|
2050
|
+
className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
|
|
1955
2051
|
variant: "ghost",
|
|
1956
2052
|
size: "icon",
|
|
1957
2053
|
children: [
|
|
1958
|
-
/* @__PURE__ */
|
|
2054
|
+
/* @__PURE__ */ jsx17("span", {
|
|
1959
2055
|
className: "sr-only",
|
|
1960
2056
|
children: resolvedTitle
|
|
1961
2057
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ jsx17(MoreHorizontal, {})
|
|
1963
2059
|
]
|
|
1964
2060
|
})
|
|
1965
2061
|
}),
|
|
1966
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
1967
2063
|
align: "end",
|
|
1968
2064
|
className: cn("w-max", contentClassName),
|
|
1969
2065
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
1970
2066
|
children: [
|
|
1971
|
-
/* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
1972
2068
|
children: resolvedTitle
|
|
1973
2069
|
}),
|
|
1974
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
1975
2071
|
visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
1976
2072
|
className: "whitespace-nowrap",
|
|
1977
2073
|
onClick: (event) => {
|
|
@@ -2027,10 +2123,8 @@ var GroupHeaderRow = ({
|
|
|
2027
2123
|
onToggle,
|
|
2028
2124
|
section
|
|
2029
2125
|
}) => {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
return /* @__PURE__ */ jsx16(TableRow, {
|
|
2033
|
-
children: /* @__PURE__ */ jsx16(TableCell, {
|
|
2126
|
+
return /* @__PURE__ */ jsx17(TableRow, {
|
|
2127
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2034
2128
|
className: "relative p-0",
|
|
2035
2129
|
colSpan,
|
|
2036
2130
|
onClick: onToggle,
|
|
@@ -2040,21 +2134,21 @@ var GroupHeaderRow = ({
|
|
|
2040
2134
|
paddingLeft: `calc(0.5rem + ${section.depth * GROUP_INDENT_PX}px)`
|
|
2041
2135
|
},
|
|
2042
2136
|
children: [
|
|
2043
|
-
collapsed ? /* @__PURE__ */
|
|
2137
|
+
collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
|
|
2044
2138
|
className: "size-4"
|
|
2045
|
-
}) : /* @__PURE__ */
|
|
2139
|
+
}) : /* @__PURE__ */ jsx17(ChevronDown, {
|
|
2046
2140
|
className: "size-4"
|
|
2047
2141
|
}),
|
|
2048
|
-
/* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2049
2143
|
className: "min-w-0 flex-1 text-left",
|
|
2050
|
-
children:
|
|
2144
|
+
children: getGroupLabels(section)
|
|
2051
2145
|
}),
|
|
2052
|
-
/* @__PURE__ */
|
|
2146
|
+
/* @__PURE__ */ jsx17(Badge, {
|
|
2053
2147
|
variant: "secondary",
|
|
2054
2148
|
className: "ml-auto",
|
|
2055
2149
|
children: section.rows.length
|
|
2056
2150
|
}),
|
|
2057
|
-
/* @__PURE__ */
|
|
2151
|
+
/* @__PURE__ */ jsx17(DataTableGroupActions, {
|
|
2058
2152
|
actions: section.field.actions,
|
|
2059
2153
|
groupId: section.groupId,
|
|
2060
2154
|
title: section.field.actionsTitle
|
|
@@ -2077,7 +2171,7 @@ var GroupTableSection = ({
|
|
|
2077
2171
|
groupId: section.groupId
|
|
2078
2172
|
}
|
|
2079
2173
|
});
|
|
2080
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ jsx17(TableBody, {
|
|
2081
2175
|
className: cn("relative px-2", isOver && "ring-primary ring-1 ring-inset"),
|
|
2082
2176
|
ref: setNodeRef,
|
|
2083
2177
|
children
|
|
@@ -2097,8 +2191,6 @@ var GroupHeaderCard = ({
|
|
|
2097
2191
|
groupId: section.groupId
|
|
2098
2192
|
}
|
|
2099
2193
|
});
|
|
2100
|
-
const label = section.field.getGroupLabel?.(section.groupId, section.rows.map((row) => row.original)) ?? section.groupId;
|
|
2101
|
-
const renderedLabel = section.field.renderGroupLabel?.(section.groupId, section.rows.map((row) => row.original)) ?? label;
|
|
2102
2194
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2103
2195
|
className: cn("flex w-full items-center gap-3 rounded-lg border px-3 py-2 text-left font-medium transition-colors", isOver && "outline outline-primary"),
|
|
2104
2196
|
ref: setNodeRef,
|
|
@@ -2108,23 +2200,23 @@ var GroupHeaderCard = ({
|
|
|
2108
2200
|
onClick: onToggle,
|
|
2109
2201
|
type: "button",
|
|
2110
2202
|
children: [
|
|
2111
|
-
collapsed ? /* @__PURE__ */
|
|
2203
|
+
collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
|
|
2112
2204
|
className: "size-4"
|
|
2113
|
-
}) : /* @__PURE__ */
|
|
2205
|
+
}) : /* @__PURE__ */ jsx17(ChevronDown, {
|
|
2114
2206
|
className: "size-4"
|
|
2115
2207
|
}),
|
|
2116
|
-
/* @__PURE__ */
|
|
2208
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2117
2209
|
className: "min-w-0 flex-1",
|
|
2118
|
-
children:
|
|
2210
|
+
children: getGroupLabels(section)
|
|
2119
2211
|
}),
|
|
2120
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsx17(Badge, {
|
|
2121
2213
|
variant: "secondary",
|
|
2122
2214
|
className: "ml-auto",
|
|
2123
2215
|
children: section.rows.length
|
|
2124
2216
|
})
|
|
2125
2217
|
]
|
|
2126
2218
|
}),
|
|
2127
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsx17(DataTableGroupActions, {
|
|
2128
2220
|
actions: section.field.actions,
|
|
2129
2221
|
groupId: section.groupId,
|
|
2130
2222
|
title: section.field.actionsTitle
|
|
@@ -2142,30 +2234,30 @@ var DataTableGroupActions = ({
|
|
|
2142
2234
|
return null;
|
|
2143
2235
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2144
2236
|
children: [
|
|
2145
|
-
/* @__PURE__ */
|
|
2237
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2146
2238
|
onClick: (event) => event.stopPropagation(),
|
|
2147
2239
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2148
2240
|
className: "size-7 shadow-md [&_svg:not([class*='size-'])]:size-3.5",
|
|
2149
2241
|
size: "icon",
|
|
2150
2242
|
variant: "ghost",
|
|
2151
2243
|
children: [
|
|
2152
|
-
/* @__PURE__ */
|
|
2244
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2153
2245
|
className: "sr-only",
|
|
2154
2246
|
children: title
|
|
2155
2247
|
}),
|
|
2156
|
-
/* @__PURE__ */
|
|
2248
|
+
/* @__PURE__ */ jsx17(MoreHorizontal, {})
|
|
2157
2249
|
]
|
|
2158
2250
|
})
|
|
2159
2251
|
}),
|
|
2160
|
-
/* @__PURE__ */
|
|
2252
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2161
2253
|
align: "end",
|
|
2162
2254
|
className: "w-max",
|
|
2163
2255
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2164
2256
|
children: [
|
|
2165
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2166
2258
|
children: title
|
|
2167
2259
|
}),
|
|
2168
|
-
/* @__PURE__ */
|
|
2260
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2169
2261
|
visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2170
2262
|
className: "whitespace-nowrap",
|
|
2171
2263
|
onClick: (event) => {
|
|
@@ -2193,7 +2285,10 @@ var DataTableRow = ({
|
|
|
2193
2285
|
onRowClick,
|
|
2194
2286
|
row,
|
|
2195
2287
|
rowActions,
|
|
2196
|
-
rowActionsLabel
|
|
2288
|
+
rowActionsLabel,
|
|
2289
|
+
selectRowLabel,
|
|
2290
|
+
selectable,
|
|
2291
|
+
table
|
|
2197
2292
|
}) => {
|
|
2198
2293
|
const sortable = useSortable({
|
|
2199
2294
|
id: getSortableRowId(row.id),
|
|
@@ -2209,7 +2304,7 @@ var DataTableRow = ({
|
|
|
2209
2304
|
disabled: !canDrag || canReorder,
|
|
2210
2305
|
data: {
|
|
2211
2306
|
type: "row",
|
|
2212
|
-
|
|
2307
|
+
rowId: row.id,
|
|
2213
2308
|
label: dragLabel
|
|
2214
2309
|
}
|
|
2215
2310
|
});
|
|
@@ -2222,7 +2317,7 @@ var DataTableRow = ({
|
|
|
2222
2317
|
const rowAttributes = canReorder ? onRowClick ? { role: "button", tabIndex: 0 } : {} : onRowClick ? { ...attributes, role: "button", tabIndex: 0 } : attributes;
|
|
2223
2318
|
const visibleCells = row.getVisibleCells();
|
|
2224
2319
|
return /* @__PURE__ */ jsxs8(TableRow, {
|
|
2225
|
-
className: cn("h-16 focus-visible:outline-ring focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid", onRowClick && "cursor-pointer", isDragging && "opacity-50"),
|
|
2320
|
+
className: cn("group/row h-16 focus-visible:outline-ring focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid", onRowClick && "cursor-pointer", isDragging && "opacity-50"),
|
|
2226
2321
|
"data-state": row.getIsSelected() && "selected",
|
|
2227
2322
|
onClick: () => {
|
|
2228
2323
|
if (onRowClick) {
|
|
@@ -2244,9 +2339,23 @@ var DataTableRow = ({
|
|
|
2244
2339
|
...rowAttributes,
|
|
2245
2340
|
...!canReorder ? listeners : {},
|
|
2246
2341
|
children: [
|
|
2247
|
-
|
|
2342
|
+
selectable ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2343
|
+
className: "w-10 min-w-10 cursor-default pr-0",
|
|
2344
|
+
onClick: (event) => event.stopPropagation(),
|
|
2345
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2346
|
+
"aria-label": selectRowLabel,
|
|
2347
|
+
checked: row.getIsSelected(),
|
|
2348
|
+
disabled: !row.getCanSelect(),
|
|
2349
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2350
|
+
nativeEvent: eventDetails.event,
|
|
2351
|
+
target: { checked }
|
|
2352
|
+
}),
|
|
2353
|
+
onClick: (event) => event.stopPropagation()
|
|
2354
|
+
})
|
|
2355
|
+
}) : null,
|
|
2356
|
+
canReorder ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2248
2357
|
className: "w-10 min-w-10 pr-0",
|
|
2249
|
-
children: /* @__PURE__ */
|
|
2358
|
+
children: /* @__PURE__ */ jsx17(Button, {
|
|
2250
2359
|
"aria-label": reorderHandleLabel,
|
|
2251
2360
|
className: "size-8 cursor-grab active:cursor-grabbing",
|
|
2252
2361
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -2255,28 +2364,31 @@ var DataTableRow = ({
|
|
|
2255
2364
|
variant: "ghost",
|
|
2256
2365
|
...attributes,
|
|
2257
2366
|
...listeners,
|
|
2258
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ jsx17(GripVertical, {})
|
|
2259
2368
|
})
|
|
2260
2369
|
}) : null,
|
|
2261
2370
|
visibleCells.map((cell, index) => {
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2371
|
+
return /* @__PURE__ */ jsx17(table.AppCell, {
|
|
2372
|
+
cell,
|
|
2373
|
+
children: (appCell) => /* @__PURE__ */ jsx17(TableCell, {
|
|
2374
|
+
className: cn("align-center min-w-32 overflow-hidden [&:has([data-slot=relationship-cell])]:relative [&:has([data-slot=relationship-cell])]:p-0 [&:has([data-slot=relationship-cell])>div]:absolute [&:has([data-slot=relationship-cell])>div]:inset-0", cell.column.columnDef.meta?.truncate ? "whitespace-nowrap" : "whitespace-normal"),
|
|
2375
|
+
style: index === 0 && firstCellIndent ? {
|
|
2376
|
+
paddingLeft: firstCellIndent,
|
|
2377
|
+
width: cell.column.getSize()
|
|
2378
|
+
} : { width: cell.column.getSize() },
|
|
2379
|
+
children: /* @__PURE__ */ jsx17("div", {
|
|
2380
|
+
className: cn("w-full max-w-full min-w-0 overflow-hidden break-words [&:has([data-slot=list-summary])]:line-clamp-none", cell.column.columnDef.meta?.truncate ? "truncate" : "line-clamp-3"),
|
|
2381
|
+
children: /* @__PURE__ */ jsx17(appCell.FlexRender, {})
|
|
2382
|
+
})
|
|
2272
2383
|
})
|
|
2273
2384
|
}, cell.id);
|
|
2274
2385
|
}),
|
|
2275
|
-
rowActions ? /* @__PURE__ */
|
|
2276
|
-
className: "sticky right-0 z-20 w-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2386
|
+
rowActions ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2387
|
+
className: "bg-background group-data-[state=selected]/row:bg-muted sticky right-0 z-20 w-10 min-w-10 cursor-default p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
2388
|
+
onClick: (event) => event.stopPropagation(),
|
|
2389
|
+
children: /* @__PURE__ */ jsx17("div", {
|
|
2390
|
+
className: "flex h-16 items-center justify-center",
|
|
2391
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2280
2392
|
actions: rowActions,
|
|
2281
2393
|
row: row.original,
|
|
2282
2394
|
title: rowActionsLabel
|
|
@@ -2294,6 +2406,8 @@ var DataTableGalleryCard = ({
|
|
|
2294
2406
|
row,
|
|
2295
2407
|
rowActions,
|
|
2296
2408
|
rowActionsLabel,
|
|
2409
|
+
selectRowLabel,
|
|
2410
|
+
selectable,
|
|
2297
2411
|
table
|
|
2298
2412
|
}) => {
|
|
2299
2413
|
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
@@ -2301,7 +2415,7 @@ var DataTableGalleryCard = ({
|
|
|
2301
2415
|
disabled: !canDrag,
|
|
2302
2416
|
data: {
|
|
2303
2417
|
type: "row",
|
|
2304
|
-
|
|
2418
|
+
rowId: row.id,
|
|
2305
2419
|
label: dragLabel
|
|
2306
2420
|
}
|
|
2307
2421
|
});
|
|
@@ -2323,17 +2437,30 @@ var DataTableGalleryCard = ({
|
|
|
2323
2437
|
...attributes,
|
|
2324
2438
|
...listeners,
|
|
2325
2439
|
children: [
|
|
2326
|
-
|
|
2440
|
+
selectable ? /* @__PURE__ */ jsx17("div", {
|
|
2441
|
+
className: "absolute top-4 left-4 z-10",
|
|
2442
|
+
onClick: (event) => event.stopPropagation(),
|
|
2443
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2444
|
+
"aria-label": selectRowLabel,
|
|
2445
|
+
checked: row.getIsSelected(),
|
|
2446
|
+
disabled: !row.getCanSelect(),
|
|
2447
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2448
|
+
nativeEvent: eventDetails.event,
|
|
2449
|
+
target: { checked }
|
|
2450
|
+
})
|
|
2451
|
+
})
|
|
2452
|
+
}) : null,
|
|
2453
|
+
rowActions ? /* @__PURE__ */ jsx17("div", {
|
|
2327
2454
|
className: "absolute top-4 right-4 z-10",
|
|
2328
2455
|
onClick: (event) => event.stopPropagation(),
|
|
2329
|
-
children: /* @__PURE__ */
|
|
2456
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2330
2457
|
actions: rowActions,
|
|
2331
2458
|
row: row.original,
|
|
2332
2459
|
title: rowActionsLabel
|
|
2333
2460
|
})
|
|
2334
2461
|
}) : null,
|
|
2335
2462
|
/* @__PURE__ */ jsxs8(CardHeader, {
|
|
2336
|
-
className: cn(rowActions && "pr-14"),
|
|
2463
|
+
className: cn(rowActions && "pr-14", selectable && "pl-12"),
|
|
2337
2464
|
children: [
|
|
2338
2465
|
tagCell && tagLabel ? /* @__PURE__ */ jsxs8(Badge, {
|
|
2339
2466
|
variant: "secondary",
|
|
@@ -2343,11 +2470,11 @@ var DataTableGalleryCard = ({
|
|
|
2343
2470
|
tagLabel
|
|
2344
2471
|
]
|
|
2345
2472
|
}) : null,
|
|
2346
|
-
nameCell ? /* @__PURE__ */
|
|
2473
|
+
nameCell ? /* @__PURE__ */ jsx17(CardTitle, {
|
|
2347
2474
|
className: "min-w-0 text-base",
|
|
2348
2475
|
children: flexRender(nameCell.column.columnDef.cell, nameCell.getContext())
|
|
2349
2476
|
}) : null,
|
|
2350
|
-
descriptionCell ? /* @__PURE__ */
|
|
2477
|
+
descriptionCell ? /* @__PURE__ */ jsx17(CardDescription, {
|
|
2351
2478
|
className: "line-clamp-2 min-w-0",
|
|
2352
2479
|
children: flexRender(descriptionCell.column.columnDef.cell, descriptionCell.getContext())
|
|
2353
2480
|
}) : null
|
|
@@ -2358,7 +2485,7 @@ var DataTableGalleryCard = ({
|
|
|
2358
2485
|
}
|
|
2359
2486
|
const contentCells = row.getVisibleCells();
|
|
2360
2487
|
return /* @__PURE__ */ jsxs8(Card, {
|
|
2361
|
-
className: cn("gap-3 transition-colors", onRowClick && "cursor-pointer hover:bg-accent/20", isDragging && "opacity-50"),
|
|
2488
|
+
className: cn("relative gap-3 transition-colors", onRowClick && "cursor-pointer hover:bg-accent/20", isDragging && "opacity-50"),
|
|
2362
2489
|
"data-state": row.getIsSelected() && "selected",
|
|
2363
2490
|
onClick: () => {
|
|
2364
2491
|
if (onRowClick) {
|
|
@@ -2369,11 +2496,24 @@ var DataTableGalleryCard = ({
|
|
|
2369
2496
|
...attributes,
|
|
2370
2497
|
...listeners,
|
|
2371
2498
|
children: [
|
|
2499
|
+
selectable ? /* @__PURE__ */ jsx17("div", {
|
|
2500
|
+
className: "absolute top-4 left-4 z-10",
|
|
2501
|
+
onClick: (event) => event.stopPropagation(),
|
|
2502
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2503
|
+
"aria-label": selectRowLabel,
|
|
2504
|
+
checked: row.getIsSelected(),
|
|
2505
|
+
disabled: !row.getCanSelect(),
|
|
2506
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2507
|
+
nativeEvent: eventDetails.event,
|
|
2508
|
+
target: { checked }
|
|
2509
|
+
})
|
|
2510
|
+
})
|
|
2511
|
+
}) : null,
|
|
2372
2512
|
/* @__PURE__ */ jsxs8(CardHeader, {
|
|
2373
2513
|
children: [
|
|
2374
|
-
rowActions ? /* @__PURE__ */
|
|
2514
|
+
rowActions ? /* @__PURE__ */ jsx17(CardAction, {
|
|
2375
2515
|
onClick: (event) => event.stopPropagation(),
|
|
2376
|
-
children: /* @__PURE__ */
|
|
2516
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2377
2517
|
actions: rowActions,
|
|
2378
2518
|
row: row.original,
|
|
2379
2519
|
title: rowActionsLabel
|
|
@@ -2382,11 +2522,11 @@ var DataTableGalleryCard = ({
|
|
|
2382
2522
|
contentCells.length > 0 && /* @__PURE__ */ jsxs8("div", {
|
|
2383
2523
|
className: "grid min-w-0 gap-3",
|
|
2384
2524
|
children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsx17(CardDescription, {
|
|
2386
2526
|
className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
|
|
2387
2527
|
children: getColumnDisplayName(table, contentCells[0].column.id)
|
|
2388
2528
|
}),
|
|
2389
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsx17(CardTitle, {
|
|
2390
2530
|
className: "text-base",
|
|
2391
2531
|
children: flexRender(contentCells[0].column.columnDef.cell, contentCells[0].getContext())
|
|
2392
2532
|
})
|
|
@@ -2394,16 +2534,16 @@ var DataTableGalleryCard = ({
|
|
|
2394
2534
|
})
|
|
2395
2535
|
]
|
|
2396
2536
|
}),
|
|
2397
|
-
contentCells.length > 1 && /* @__PURE__ */
|
|
2537
|
+
contentCells.length > 1 && /* @__PURE__ */ jsx17(CardContent, {
|
|
2398
2538
|
className: "grid gap-3",
|
|
2399
2539
|
children: contentCells.slice(1).map((cell) => /* @__PURE__ */ jsxs8("div", {
|
|
2400
2540
|
className: "grid gap-1",
|
|
2401
2541
|
children: [
|
|
2402
|
-
/* @__PURE__ */
|
|
2542
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2403
2543
|
className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
|
|
2404
2544
|
children: getColumnDisplayName(table, cell.column.id)
|
|
2405
2545
|
}),
|
|
2406
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2407
2547
|
className: "min-w-0 text-sm",
|
|
2408
2548
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2409
2549
|
})
|
|
@@ -2418,15 +2558,15 @@ var extractTextFromElement = (element) => {
|
|
|
2418
2558
|
return element;
|
|
2419
2559
|
if (typeof element === "number")
|
|
2420
2560
|
return String(element);
|
|
2421
|
-
if (!element
|
|
2422
|
-
return null;
|
|
2423
|
-
const props = element.props;
|
|
2424
|
-
if (!props)
|
|
2561
|
+
if (!isValidElement(element)) {
|
|
2425
2562
|
return null;
|
|
2563
|
+
}
|
|
2564
|
+
const { props } = element;
|
|
2426
2565
|
if (typeof props.title === "string")
|
|
2427
2566
|
return props.title;
|
|
2428
2567
|
return extractTextFromElement(props.children);
|
|
2429
2568
|
};
|
|
2569
|
+
var getColumnLabels = (table) => new Map(table.getFlatHeaders().map((header) => [header.column.id, getHeaderName(header)]));
|
|
2430
2570
|
var getHeaderName = (header) => {
|
|
2431
2571
|
const columnDef = header.column.columnDef;
|
|
2432
2572
|
if (typeof columnDef.header === "function") {
|
|
@@ -2443,15 +2583,6 @@ var getColumnDisplayName = (table, columnId) => {
|
|
|
2443
2583
|
const header = table.getFlatHeaders().find((currentHeader) => currentHeader.column.id === columnId);
|
|
2444
2584
|
return header ? getHeaderName(header) : columnId;
|
|
2445
2585
|
};
|
|
2446
|
-
var renderHeader = (header) => {
|
|
2447
|
-
if (header.isPlaceholder)
|
|
2448
|
-
return null;
|
|
2449
|
-
const content = flexRender(header.column.columnDef.header, header.getContext());
|
|
2450
|
-
return typeof content === "string" || typeof content === "number" ? /* @__PURE__ */ jsx16("div", {
|
|
2451
|
-
className: "flex h-12 items-center px-2 text-sm",
|
|
2452
|
-
children: content
|
|
2453
|
-
}) : content;
|
|
2454
|
-
};
|
|
2455
2586
|
var withFileExtension = (fileName, extension) => {
|
|
2456
2587
|
const normalizedExtension = extension.startsWith(".") ? extension : `.${extension}`;
|
|
2457
2588
|
return fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, normalizedExtension) : `${fileName}${normalizedExtension}`;
|
|
@@ -2507,6 +2638,191 @@ var exportTableToJson = (table, rows, fileName = "data.json") => {
|
|
|
2507
2638
|
const data = rows.map((row) => Object.fromEntries(exportableColumns.map((column) => [column.id, row.getValue(column.id)])));
|
|
2508
2639
|
downloadJson(data, fileName);
|
|
2509
2640
|
};
|
|
2641
|
+
var DataTableToolbar = ({
|
|
2642
|
+
activeGrouping,
|
|
2643
|
+
exportBaseName,
|
|
2644
|
+
exportRows,
|
|
2645
|
+
grouping,
|
|
2646
|
+
labels: labels2,
|
|
2647
|
+
onRefresh,
|
|
2648
|
+
onToggleGrouping,
|
|
2649
|
+
onViewChange,
|
|
2650
|
+
showColumnVisibility,
|
|
2651
|
+
showExport,
|
|
2652
|
+
showGallery,
|
|
2653
|
+
showSearch,
|
|
2654
|
+
showSorting,
|
|
2655
|
+
table,
|
|
2656
|
+
view
|
|
2657
|
+
}) => {
|
|
2658
|
+
const [refreshSpinCount, setRefreshSpinCount] = useState(0);
|
|
2659
|
+
const [searchInput, setSearchInput] = useState(table.state.globalFilter);
|
|
2660
|
+
const hasToolbar = Boolean(showSearch || grouping?.fields.length || showSorting || showGallery || showColumnVisibility || onRefresh || showExport);
|
|
2661
|
+
useEffect2(() => {
|
|
2662
|
+
setSearchInput(table.state.globalFilter);
|
|
2663
|
+
}, [table.state.globalFilter]);
|
|
2664
|
+
if (!hasToolbar)
|
|
2665
|
+
return null;
|
|
2666
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
2667
|
+
className: "flex flex-col gap-3 pb-4",
|
|
2668
|
+
children: /* @__PURE__ */ jsxs8("div", {
|
|
2669
|
+
className: "flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",
|
|
2670
|
+
children: [
|
|
2671
|
+
showSearch ? /* @__PURE__ */ jsxs8("div", {
|
|
2672
|
+
className: "relative w-full min-w-0 flex-1 sm:min-w-sm",
|
|
2673
|
+
children: [
|
|
2674
|
+
/* @__PURE__ */ jsx17(Search, {
|
|
2675
|
+
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
2676
|
+
}),
|
|
2677
|
+
/* @__PURE__ */ jsx17(Input, {
|
|
2678
|
+
className: "px-9",
|
|
2679
|
+
onChange: (event) => {
|
|
2680
|
+
setSearchInput(event.target.value);
|
|
2681
|
+
table.setGlobalFilter(event.target.value);
|
|
2682
|
+
},
|
|
2683
|
+
placeholder: labels2.filter,
|
|
2684
|
+
value: searchInput
|
|
2685
|
+
}),
|
|
2686
|
+
searchInput ? /* @__PURE__ */ jsx17(Button, {
|
|
2687
|
+
"aria-label": labels2.filter,
|
|
2688
|
+
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-1 size-7 -translate-y-1/2 active:!-translate-y-1/2",
|
|
2689
|
+
onClick: () => {
|
|
2690
|
+
setSearchInput("");
|
|
2691
|
+
table.setGlobalFilter("");
|
|
2692
|
+
},
|
|
2693
|
+
size: "icon",
|
|
2694
|
+
type: "button",
|
|
2695
|
+
variant: "ghost",
|
|
2696
|
+
children: /* @__PURE__ */ jsx17(X2, {
|
|
2697
|
+
className: "size-4"
|
|
2698
|
+
})
|
|
2699
|
+
}) : null
|
|
2700
|
+
]
|
|
2701
|
+
}) : /* @__PURE__ */ jsx17("div", {}),
|
|
2702
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
2703
|
+
className: "-m-1 flex items-center gap-2 overflow-x-auto p-1",
|
|
2704
|
+
children: [
|
|
2705
|
+
grouping?.fields.length ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2706
|
+
children: [
|
|
2707
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2708
|
+
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2709
|
+
"aria-label": labels2.groupBy,
|
|
2710
|
+
className: "h-9",
|
|
2711
|
+
size: "sm",
|
|
2712
|
+
variant: "outline",
|
|
2713
|
+
children: [
|
|
2714
|
+
/* @__PURE__ */ jsx17(Rows3, {}),
|
|
2715
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2716
|
+
className: "hidden sm:inline",
|
|
2717
|
+
children: labels2.groupBy
|
|
2718
|
+
})
|
|
2719
|
+
]
|
|
2720
|
+
})
|
|
2721
|
+
}),
|
|
2722
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2723
|
+
align: "end",
|
|
2724
|
+
className: "w-[200px]",
|
|
2725
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2726
|
+
children: [
|
|
2727
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2728
|
+
children: labels2.groupBy
|
|
2729
|
+
}),
|
|
2730
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2731
|
+
grouping.fields.map((field) => /* @__PURE__ */ jsx17(DropdownMenuCheckboxItem, {
|
|
2732
|
+
checked: activeGrouping.includes(field.id),
|
|
2733
|
+
onCheckedChange: (value) => onToggleGrouping(field.id, !!value),
|
|
2734
|
+
children: field.label
|
|
2735
|
+
}, field.id))
|
|
2736
|
+
]
|
|
2737
|
+
})
|
|
2738
|
+
})
|
|
2739
|
+
]
|
|
2740
|
+
}) : null,
|
|
2741
|
+
showSorting ? /* @__PURE__ */ jsx17(DataTableSortDropdown, {
|
|
2742
|
+
messages: labels2,
|
|
2743
|
+
table
|
|
2744
|
+
}) : null,
|
|
2745
|
+
showGallery ? /* @__PURE__ */ jsx17(DataTableDisplayModeSwitch, {
|
|
2746
|
+
messages: labels2,
|
|
2747
|
+
onChange: onViewChange,
|
|
2748
|
+
value: view
|
|
2749
|
+
}) : null,
|
|
2750
|
+
showColumnVisibility ? /* @__PURE__ */ jsx17(DataTableViewOptions, {
|
|
2751
|
+
messages: labels2,
|
|
2752
|
+
table
|
|
2753
|
+
}) : null,
|
|
2754
|
+
onRefresh ? /* @__PURE__ */ jsxs8(Button, {
|
|
2755
|
+
"aria-label": labels2.refresh,
|
|
2756
|
+
className: "h-9",
|
|
2757
|
+
onClick: () => {
|
|
2758
|
+
setRefreshSpinCount((count) => count + 1);
|
|
2759
|
+
onRefresh();
|
|
2760
|
+
},
|
|
2761
|
+
size: "sm",
|
|
2762
|
+
type: "button",
|
|
2763
|
+
variant: "outline",
|
|
2764
|
+
children: [
|
|
2765
|
+
/* @__PURE__ */ jsx17(RefreshCw, {
|
|
2766
|
+
className: cn(refreshSpinCount > 0 && "animate-[spin_500ms_ease-in-out_1]")
|
|
2767
|
+
}, refreshSpinCount),
|
|
2768
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2769
|
+
className: "hidden sm:inline",
|
|
2770
|
+
children: labels2.refresh
|
|
2771
|
+
})
|
|
2772
|
+
]
|
|
2773
|
+
}) : null,
|
|
2774
|
+
showExport ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2775
|
+
children: [
|
|
2776
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2777
|
+
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2778
|
+
"aria-label": labels2.export,
|
|
2779
|
+
className: "h-9",
|
|
2780
|
+
disabled: exportRows.length === 0,
|
|
2781
|
+
size: "sm",
|
|
2782
|
+
variant: "outline",
|
|
2783
|
+
children: [
|
|
2784
|
+
/* @__PURE__ */ jsx17(Download, {}),
|
|
2785
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2786
|
+
className: "hidden sm:inline",
|
|
2787
|
+
children: labels2.export
|
|
2788
|
+
})
|
|
2789
|
+
]
|
|
2790
|
+
})
|
|
2791
|
+
}),
|
|
2792
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2793
|
+
align: "end",
|
|
2794
|
+
className: "w-[180px]",
|
|
2795
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2796
|
+
children: [
|
|
2797
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2798
|
+
children: labels2.export
|
|
2799
|
+
}),
|
|
2800
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2801
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2802
|
+
onClick: () => exportTableToCsv(table, exportRows, exportBaseName),
|
|
2803
|
+
children: [
|
|
2804
|
+
/* @__PURE__ */ jsx17(FileText, {}),
|
|
2805
|
+
labels2.exportCsv
|
|
2806
|
+
]
|
|
2807
|
+
}),
|
|
2808
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2809
|
+
onClick: () => exportTableToJson(table, exportRows, exportBaseName),
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ jsx17(FileJson, {}),
|
|
2812
|
+
labels2.exportJson
|
|
2813
|
+
]
|
|
2814
|
+
})
|
|
2815
|
+
]
|
|
2816
|
+
})
|
|
2817
|
+
})
|
|
2818
|
+
]
|
|
2819
|
+
}) : null
|
|
2820
|
+
]
|
|
2821
|
+
})
|
|
2822
|
+
]
|
|
2823
|
+
})
|
|
2824
|
+
});
|
|
2825
|
+
};
|
|
2510
2826
|
function DataTable({
|
|
2511
2827
|
columns,
|
|
2512
2828
|
data,
|
|
@@ -2548,17 +2864,19 @@ function DataTable({
|
|
|
2548
2864
|
const pageSizes = paginationFeature ? paginationFeature.pageSizes : undefined;
|
|
2549
2865
|
const showSearch = features?.search ?? true;
|
|
2550
2866
|
const showExport = exportFeature !== false;
|
|
2551
|
-
const
|
|
2552
|
-
const showColumnVisibility =
|
|
2553
|
-
const defaultColumnVisibility = typeof
|
|
2867
|
+
const columnVisibilityFeature2 = features?.columnVisibility ?? true;
|
|
2868
|
+
const showColumnVisibility = columnVisibilityFeature2 !== false;
|
|
2869
|
+
const defaultColumnVisibility = typeof columnVisibilityFeature2 === "object" ? columnVisibilityFeature2.default : undefined;
|
|
2554
2870
|
const showGallery = !!galleryConfig;
|
|
2555
2871
|
const showSorting = features?.sorting ?? true;
|
|
2872
|
+
const selectionFeature = features?.selection === false ? undefined : features?.selection;
|
|
2873
|
+
const selectable = !!selectionFeature;
|
|
2556
2874
|
const isServerMode = paginationFeature !== false && paginationFeature.mode === "server";
|
|
2557
2875
|
const serverRowCount = isServerMode ? paginationFeature.rowCount : undefined;
|
|
2558
2876
|
const location = useRouterState({
|
|
2559
2877
|
select: (state2) => state2.location
|
|
2560
2878
|
});
|
|
2561
|
-
const search = location.search;
|
|
2879
|
+
const search = Option2.getOrUndefined(decodeTableSearch(location.search));
|
|
2562
2880
|
const pathname = location.pathname;
|
|
2563
2881
|
const resolvedRouteFrom = routeFrom ?? from;
|
|
2564
2882
|
const [storagePath] = useState(() => resolvedRouteFrom ?? pathname);
|
|
@@ -2615,12 +2933,9 @@ function DataTable({
|
|
|
2615
2933
|
const [storedView, setStoredView] = useAtom(viewAtom);
|
|
2616
2934
|
const currentView = showGallery ? storedView : "table";
|
|
2617
2935
|
const isGalleryView = currentView === "gallery";
|
|
2618
|
-
const hasToolbar = Boolean(showSearch || grouping?.fields.length || showSorting || showGallery || showColumnVisibility || onRefresh || showExport);
|
|
2619
2936
|
const [rowSelection, setRowSelection] = useState({});
|
|
2620
2937
|
const [collapsedGroups, setCollapsedGroups] = useState({});
|
|
2621
2938
|
const [activeDragLabel, setActiveDragLabel] = useState(null);
|
|
2622
|
-
const [refreshSpinCount, setRefreshSpinCount] = useState(0);
|
|
2623
|
-
const [searchInput, setSearchInput] = useState(globalFilter);
|
|
2624
2939
|
const availableGroupFieldIds = grouping?.fields.map((field) => field.id) ?? [];
|
|
2625
2940
|
const activeGrouping = urlGrouping?.filter((groupId) => availableGroupFieldIds.includes(groupId)) ?? getDefaultGrouping(grouping);
|
|
2626
2941
|
const sensors = useSensors(useSensor(PointerSensor, {
|
|
@@ -2630,7 +2945,7 @@ function DataTable({
|
|
|
2630
2945
|
}));
|
|
2631
2946
|
const updateTableSearch = (updater, options) => {
|
|
2632
2947
|
if (controlledSearch || onSearchChange || searchState === "local") {
|
|
2633
|
-
const nextSearch = updater(controlledSearch ?? localSearch
|
|
2948
|
+
const nextSearch = Schema2.decodeUnknownSync(TableSearchSchema)(updater(controlledSearch ?? localSearch));
|
|
2634
2949
|
if (onSearchChange) {
|
|
2635
2950
|
onSearchChange(nextSearch);
|
|
2636
2951
|
} else {
|
|
@@ -2642,24 +2957,20 @@ function DataTable({
|
|
|
2642
2957
|
to: ".",
|
|
2643
2958
|
replace: options?.replace ?? false,
|
|
2644
2959
|
resetScroll: false,
|
|
2645
|
-
search: (current) => updater(current
|
|
2960
|
+
search: (current) => validateTableSearchUpdate(updater(current))
|
|
2646
2961
|
});
|
|
2647
2962
|
};
|
|
2648
|
-
const table =
|
|
2963
|
+
const table = useDataTable({
|
|
2964
|
+
key: tableStorageId,
|
|
2649
2965
|
data,
|
|
2650
2966
|
columns,
|
|
2651
|
-
defaultColumn: {
|
|
2652
|
-
minSize: 128,
|
|
2653
|
-
size: 224,
|
|
2654
|
-
maxSize: 640
|
|
2655
|
-
},
|
|
2656
|
-
columnResizeMode: "onChange",
|
|
2657
|
-
enableColumnResizing: true,
|
|
2658
2967
|
onColumnSizingChange: (updater) => {
|
|
2659
2968
|
const nextColumnSizing = typeof updater === "function" ? updater(columnSizing) : updater;
|
|
2660
2969
|
setColumnSizing(nextColumnSizing);
|
|
2661
2970
|
},
|
|
2662
|
-
...reordering ? { getRowId: reordering.getRowId } : {},
|
|
2971
|
+
...selectionFeature ? { getRowId: selectionFeature.getRowId } : reordering ? { getRowId: reordering.getRowId } : {},
|
|
2972
|
+
enableRowSelection: selectionFeature?.isRowSelectable ? (row) => selectionFeature.isRowSelectable?.(row.original) ?? true : selectable,
|
|
2973
|
+
enableMultiRowSelection: selectable,
|
|
2663
2974
|
onPaginationChange: (updater) => {
|
|
2664
2975
|
const newPagination = typeof updater === "function" ? updater(pagination) : updater;
|
|
2665
2976
|
if (pagination.pageIndex === newPagination.pageIndex && pagination.pageSize === newPagination.pageSize) {
|
|
@@ -2686,7 +2997,6 @@ function DataTable({
|
|
|
2686
2997
|
page: 0
|
|
2687
2998
|
}));
|
|
2688
2999
|
},
|
|
2689
|
-
getCoreRowModel: getCoreRowModel(),
|
|
2690
3000
|
onGlobalFilterChange: (updater) => {
|
|
2691
3001
|
const newGlobalFilter = typeof updater === "function" ? updater(globalFilter) : updater;
|
|
2692
3002
|
if (globalFilter === newGlobalFilter) {
|
|
@@ -2699,16 +3009,20 @@ function DataTable({
|
|
|
2699
3009
|
}), { replace: true });
|
|
2700
3010
|
},
|
|
2701
3011
|
...isServerMode ? { manualSorting: true } : {},
|
|
2702
|
-
...!isServerMode ? { getSortedRowModel: getSortedRowModel() } : {},
|
|
2703
3012
|
...isServerMode ? { manualFiltering: true } : {},
|
|
2704
|
-
|
|
2705
|
-
...paginationFeature !== false && paginationFeature.mode === "server" ? { manualPagination: true, rowCount: paginationFeature.rowCount } : paginationFeature === false ? {} : { getPaginationRowModel: getPaginationRowModel() },
|
|
3013
|
+
...paginationFeature !== false && paginationFeature.mode === "server" ? { manualPagination: true, rowCount: paginationFeature.rowCount } : paginationFeature === false ? { manualPagination: true } : {},
|
|
2706
3014
|
autoResetPageIndex: false,
|
|
2707
3015
|
onColumnVisibilityChange: (updater) => {
|
|
2708
3016
|
const nextColumnVisibility = typeof updater === "function" ? updater(columnVisibility) : updater;
|
|
2709
3017
|
setColumnVisibility(nextColumnVisibility);
|
|
2710
3018
|
},
|
|
2711
|
-
onRowSelectionChange:
|
|
3019
|
+
onRowSelectionChange: (updater) => {
|
|
3020
|
+
setRowSelection((current) => {
|
|
3021
|
+
const next = typeof updater === "function" ? updater(current) : updater;
|
|
3022
|
+
selectionFeature?.onSelectionChange?.(data.filter((row) => next[selectionFeature.getRowId(row)]));
|
|
3023
|
+
return next;
|
|
3024
|
+
});
|
|
3025
|
+
},
|
|
2712
3026
|
state: {
|
|
2713
3027
|
sorting,
|
|
2714
3028
|
pagination,
|
|
@@ -2718,20 +3032,16 @@ function DataTable({
|
|
|
2718
3032
|
rowSelection
|
|
2719
3033
|
}
|
|
2720
3034
|
});
|
|
2721
|
-
useEffect2(() => {
|
|
2722
|
-
setSearchInput(globalFilter);
|
|
2723
|
-
}, [globalFilter]);
|
|
2724
3035
|
const activeGroupingFields = useMemo(() => activeGrouping.map((groupId) => grouping?.fields.find((field) => field.id === groupId)).filter((field) => !!field), [activeGrouping, grouping]);
|
|
2725
3036
|
const hasActiveGrouping = activeGroupingFields.length > 0;
|
|
2726
|
-
const filteredRows = table.
|
|
3037
|
+
const filteredRows = table.getPrePaginatedRowModel().rows;
|
|
2727
3038
|
const exportRows = exportFeature && exportFeature.scope === "filteredRows" ? filteredRows : table.getRowModel().rows;
|
|
2728
3039
|
const bodyRows = hasActiveGrouping ? filteredRows : table.getRowModel().rows;
|
|
2729
3040
|
const sortableRowIds = bodyRows.map((row) => getSortableRowId(row.id));
|
|
2730
3041
|
const groupedSections = useMemo(() => buildGroupedSections(bodyRows, activeGroupingFields), [activeGroupingFields, bodyRows]);
|
|
2731
3042
|
const canReorderRows = Boolean(reordering) && !hasActiveGrouping;
|
|
2732
|
-
const colSpan = Math.max(table.getVisibleLeafColumns().length, 1) + (rowActions ? 1 : 0) + (canReorderRows ? 1 : 0);
|
|
3043
|
+
const colSpan = Math.max(table.getVisibleLeafColumns().length, 1) + (rowActions ? 1 : 0) + (selectable ? 1 : 0) + (canReorderRows ? 1 : 0);
|
|
2733
3044
|
const canDragRows = activeGroupingFields.some((field) => !!field.onMoveToGroup);
|
|
2734
|
-
const hasExportableRows = exportRows.length > 0;
|
|
2735
3045
|
const addGroupingField = (fieldId) => {
|
|
2736
3046
|
if (activeGrouping.includes(fieldId))
|
|
2737
3047
|
return;
|
|
@@ -2765,24 +3075,24 @@ function DataTable({
|
|
|
2765
3075
|
}
|
|
2766
3076
|
setStoredView(nextView);
|
|
2767
3077
|
};
|
|
2768
|
-
const renderLoadingState = () => /* @__PURE__ */
|
|
3078
|
+
const renderLoadingState = () => /* @__PURE__ */ jsx17(Loading, {
|
|
2769
3079
|
label: labels2.loading
|
|
2770
3080
|
});
|
|
2771
3081
|
const renderEmptyContent = () => state?.error ?? (isLoading ? renderLoadingState() : emptyContent);
|
|
2772
|
-
const renderTableEmptyState = () => /* @__PURE__ */
|
|
2773
|
-
children: /* @__PURE__ */
|
|
3082
|
+
const renderTableEmptyState = () => /* @__PURE__ */ jsx17(TableRow, {
|
|
3083
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2774
3084
|
className: "h-24 text-center",
|
|
2775
3085
|
colSpan,
|
|
2776
3086
|
children: renderEmptyContent()
|
|
2777
3087
|
})
|
|
2778
3088
|
});
|
|
2779
|
-
const renderGalleryEmptyState = (message) => /* @__PURE__ */
|
|
3089
|
+
const renderGalleryEmptyState = (message) => /* @__PURE__ */ jsx17("div", {
|
|
2780
3090
|
className: "text-muted-foreground rounded-xl border border-dashed px-4 py-10 text-center text-sm",
|
|
2781
3091
|
children: message ?? renderEmptyContent()
|
|
2782
3092
|
});
|
|
2783
|
-
const renderGalleryRows = (rows, canDrag) => /* @__PURE__ */
|
|
3093
|
+
const renderGalleryRows = (rows, canDrag) => /* @__PURE__ */ jsx17("div", {
|
|
2784
3094
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2785
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
3095
|
+
children: rows.map((row) => /* @__PURE__ */ jsx17(DataTableGalleryCard, {
|
|
2786
3096
|
canDrag,
|
|
2787
3097
|
dragLabel: grouping?.getRowLabel?.(row.original),
|
|
2788
3098
|
gallery: galleryConfig,
|
|
@@ -2790,6 +3100,8 @@ function DataTable({
|
|
|
2790
3100
|
row,
|
|
2791
3101
|
rowActions,
|
|
2792
3102
|
rowActionsLabel,
|
|
3103
|
+
selectRowLabel: labels2.selectRow,
|
|
3104
|
+
selectable,
|
|
2793
3105
|
table
|
|
2794
3106
|
}, row.id))
|
|
2795
3107
|
});
|
|
@@ -2799,13 +3111,13 @@ function DataTable({
|
|
|
2799
3111
|
const sectionBody = /* @__PURE__ */ jsxs8(GroupTableSection, {
|
|
2800
3112
|
section,
|
|
2801
3113
|
children: [
|
|
2802
|
-
/* @__PURE__ */
|
|
3114
|
+
/* @__PURE__ */ jsx17(GroupHeaderRow, {
|
|
2803
3115
|
collapsed: isCollapsed,
|
|
2804
3116
|
colSpan,
|
|
2805
3117
|
onToggle: () => toggleGroup(section.key),
|
|
2806
3118
|
section
|
|
2807
3119
|
}),
|
|
2808
|
-
!isCollapsed && !hasChildren && (section.rows.length > 0 ? section.rows.map((row) => /* @__PURE__ */
|
|
3120
|
+
!isCollapsed && !hasChildren && (section.rows.length > 0 ? section.rows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
2809
3121
|
canDrag: canDragRows,
|
|
2810
3122
|
canReorder: false,
|
|
2811
3123
|
dragLabel: grouping?.getRowLabel?.(row.original),
|
|
@@ -2813,9 +3125,12 @@ function DataTable({
|
|
|
2813
3125
|
onRowClick,
|
|
2814
3126
|
row,
|
|
2815
3127
|
rowActions,
|
|
2816
|
-
rowActionsLabel
|
|
2817
|
-
|
|
2818
|
-
|
|
3128
|
+
rowActionsLabel,
|
|
3129
|
+
selectRowLabel: labels2.selectRow,
|
|
3130
|
+
selectable,
|
|
3131
|
+
table
|
|
3132
|
+
}, row.id)) : /* @__PURE__ */ jsx17(TableRow, {
|
|
3133
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2819
3134
|
className: "text-muted-foreground h-16",
|
|
2820
3135
|
colSpan,
|
|
2821
3136
|
style: {
|
|
@@ -2834,7 +3149,7 @@ function DataTable({
|
|
|
2834
3149
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2835
3150
|
className: "space-y-3",
|
|
2836
3151
|
children: [
|
|
2837
|
-
/* @__PURE__ */
|
|
3152
|
+
/* @__PURE__ */ jsx17(GroupHeaderCard, {
|
|
2838
3153
|
collapsed: isCollapsed,
|
|
2839
3154
|
onToggle: () => toggleGroup(section.key),
|
|
2840
3155
|
section
|
|
@@ -2843,272 +3158,144 @@ function DataTable({
|
|
|
2843
3158
|
]
|
|
2844
3159
|
}, section.key);
|
|
2845
3160
|
});
|
|
3161
|
+
const handleDragEnd = ({ active, over }) => {
|
|
3162
|
+
setActiveDragLabel(null);
|
|
3163
|
+
if (!over)
|
|
3164
|
+
return;
|
|
3165
|
+
const reorderData = decodeRowReorderDragData(active.data.current);
|
|
3166
|
+
if (Option2.isSome(reorderData) && reordering && canReorderRows) {
|
|
3167
|
+
const sourceRowId = String(active.id).replace(/^sortable-row:/, "");
|
|
3168
|
+
const targetRowId = String(over.id).replace(/^sortable-row:/, "");
|
|
3169
|
+
const currentIndex = bodyRows.findIndex((row2) => row2.id === sourceRowId);
|
|
3170
|
+
const nextIndex = bodyRows.findIndex((row2) => row2.id === targetRowId);
|
|
3171
|
+
if (currentIndex !== -1 && nextIndex !== -1 && currentIndex !== nextIndex) {
|
|
3172
|
+
reordering.onReorder(arrayMove(bodyRows.map((row2) => row2.original), currentIndex, nextIndex));
|
|
3173
|
+
}
|
|
3174
|
+
return;
|
|
3175
|
+
}
|
|
3176
|
+
const rowData = decodeRowDragData(active.data.current);
|
|
3177
|
+
const groupData = decodeGroupDropData(over.data.current);
|
|
3178
|
+
if (Option2.isNone(rowData) || Option2.isNone(groupData))
|
|
3179
|
+
return;
|
|
3180
|
+
const row = bodyRows.find(({ id }) => id === rowData.value.rowId)?.original;
|
|
3181
|
+
const field = grouping?.fields.find((currentField) => currentField.id === groupData.value.fieldId);
|
|
3182
|
+
const nextGroupId = groupData.value.groupId;
|
|
3183
|
+
if (row && field?.onMoveToGroup && field.getGroupId(row) !== nextGroupId) {
|
|
3184
|
+
field.onMoveToGroup(row, nextGroupId);
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
const handleDragStart = ({ active }) => {
|
|
3188
|
+
const rowData = decodeRowDragData(active.data.current);
|
|
3189
|
+
setActiveDragLabel(Option2.isSome(rowData) ? rowData.value.label ?? null : null);
|
|
3190
|
+
};
|
|
2846
3191
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2847
3192
|
className: "w-full max-w-full min-w-0 rounded-md",
|
|
2848
3193
|
children: [
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
value: searchInput
|
|
2868
|
-
}),
|
|
2869
|
-
searchInput ? /* @__PURE__ */ jsx16(Button, {
|
|
2870
|
-
"aria-label": labels2.filter,
|
|
2871
|
-
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-1 size-7 -translate-y-1/2 active:!-translate-y-1/2",
|
|
2872
|
-
onClick: () => {
|
|
2873
|
-
setSearchInput("");
|
|
2874
|
-
table.setGlobalFilter("");
|
|
2875
|
-
},
|
|
2876
|
-
size: "icon",
|
|
2877
|
-
type: "button",
|
|
2878
|
-
variant: "ghost",
|
|
2879
|
-
children: /* @__PURE__ */ jsx16(X2, {
|
|
2880
|
-
className: "size-4"
|
|
2881
|
-
})
|
|
2882
|
-
}) : null
|
|
2883
|
-
]
|
|
2884
|
-
}) : /* @__PURE__ */ jsx16("div", {}),
|
|
2885
|
-
/* @__PURE__ */ jsxs8("div", {
|
|
2886
|
-
className: "-m-1 flex items-center gap-2 overflow-x-auto p-1",
|
|
2887
|
-
children: [
|
|
2888
|
-
grouping?.fields.length ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2889
|
-
children: [
|
|
2890
|
-
/* @__PURE__ */ jsx16(DropdownMenuTrigger, {
|
|
2891
|
-
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2892
|
-
"aria-label": labels2.groupBy,
|
|
2893
|
-
className: "h-9",
|
|
2894
|
-
size: "sm",
|
|
2895
|
-
variant: "outline",
|
|
2896
|
-
children: [
|
|
2897
|
-
/* @__PURE__ */ jsx16(Rows3, {}),
|
|
2898
|
-
/* @__PURE__ */ jsx16("span", {
|
|
2899
|
-
className: "hidden sm:inline",
|
|
2900
|
-
children: labels2.groupBy
|
|
2901
|
-
})
|
|
2902
|
-
]
|
|
2903
|
-
})
|
|
2904
|
-
}),
|
|
2905
|
-
/* @__PURE__ */ jsx16(DropdownMenuContent, {
|
|
2906
|
-
align: "end",
|
|
2907
|
-
className: "w-[200px]",
|
|
2908
|
-
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2909
|
-
children: [
|
|
2910
|
-
/* @__PURE__ */ jsx16(DropdownMenuLabel, {
|
|
2911
|
-
children: labels2.groupBy
|
|
2912
|
-
}),
|
|
2913
|
-
/* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
|
|
2914
|
-
grouping.fields.map((field) => /* @__PURE__ */ jsx16(DropdownMenuCheckboxItem, {
|
|
2915
|
-
checked: activeGrouping.includes(field.id),
|
|
2916
|
-
onCheckedChange: (value) => toggleGroupingField(field.id, !!value),
|
|
2917
|
-
children: field.label
|
|
2918
|
-
}, field.id))
|
|
2919
|
-
]
|
|
2920
|
-
})
|
|
2921
|
-
})
|
|
2922
|
-
]
|
|
2923
|
-
}) : null,
|
|
2924
|
-
showSorting ? /* @__PURE__ */ jsx16(DataTableSortDropdown, {
|
|
2925
|
-
messages: labels2,
|
|
2926
|
-
table
|
|
2927
|
-
}) : null,
|
|
2928
|
-
showGallery ? /* @__PURE__ */ jsx16(DataTableDisplayModeSwitch, {
|
|
2929
|
-
messages: labels2,
|
|
2930
|
-
onChange: setView,
|
|
2931
|
-
value: currentView
|
|
2932
|
-
}) : null,
|
|
2933
|
-
showColumnVisibility ? /* @__PURE__ */ jsx16(DataTableViewOptions, {
|
|
2934
|
-
messages: labels2,
|
|
2935
|
-
table
|
|
2936
|
-
}) : null,
|
|
2937
|
-
onRefresh ? /* @__PURE__ */ jsxs8(Button, {
|
|
2938
|
-
"aria-label": labels2.refresh,
|
|
2939
|
-
className: "h-9",
|
|
2940
|
-
onClick: () => {
|
|
2941
|
-
setRefreshSpinCount((count) => count + 1);
|
|
2942
|
-
onRefresh();
|
|
2943
|
-
},
|
|
2944
|
-
size: "sm",
|
|
2945
|
-
type: "button",
|
|
2946
|
-
variant: "outline",
|
|
2947
|
-
children: [
|
|
2948
|
-
/* @__PURE__ */ jsx16(RefreshCw, {
|
|
2949
|
-
className: cn(refreshSpinCount > 0 && "animate-[spin_500ms_ease-in-out_1]")
|
|
2950
|
-
}, refreshSpinCount),
|
|
2951
|
-
/* @__PURE__ */ jsx16("span", {
|
|
2952
|
-
className: "hidden sm:inline",
|
|
2953
|
-
children: labels2.refresh
|
|
2954
|
-
})
|
|
2955
|
-
]
|
|
2956
|
-
}) : null,
|
|
2957
|
-
showExport ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2958
|
-
children: [
|
|
2959
|
-
/* @__PURE__ */ jsx16(DropdownMenuTrigger, {
|
|
2960
|
-
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2961
|
-
"aria-label": labels2.export,
|
|
2962
|
-
className: "h-9",
|
|
2963
|
-
disabled: !hasExportableRows,
|
|
2964
|
-
size: "sm",
|
|
2965
|
-
variant: "outline",
|
|
2966
|
-
children: [
|
|
2967
|
-
/* @__PURE__ */ jsx16(Download, {}),
|
|
2968
|
-
/* @__PURE__ */ jsx16("span", {
|
|
2969
|
-
className: "hidden sm:inline",
|
|
2970
|
-
children: labels2.export
|
|
2971
|
-
})
|
|
2972
|
-
]
|
|
2973
|
-
})
|
|
2974
|
-
}),
|
|
2975
|
-
/* @__PURE__ */ jsx16(DropdownMenuContent, {
|
|
2976
|
-
align: "end",
|
|
2977
|
-
className: "w-[180px]",
|
|
2978
|
-
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2979
|
-
children: [
|
|
2980
|
-
/* @__PURE__ */ jsx16(DropdownMenuLabel, {
|
|
2981
|
-
children: labels2.export
|
|
2982
|
-
}),
|
|
2983
|
-
/* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
|
|
2984
|
-
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2985
|
-
onClick: () => exportTableToCsv(table, exportRows, exportBaseName),
|
|
2986
|
-
children: [
|
|
2987
|
-
/* @__PURE__ */ jsx16(FileText, {}),
|
|
2988
|
-
labels2.exportCsv
|
|
2989
|
-
]
|
|
2990
|
-
}),
|
|
2991
|
-
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2992
|
-
onClick: () => exportTableToJson(table, exportRows, exportBaseName),
|
|
2993
|
-
children: [
|
|
2994
|
-
/* @__PURE__ */ jsx16(FileJson, {}),
|
|
2995
|
-
labels2.exportJson
|
|
2996
|
-
]
|
|
2997
|
-
})
|
|
2998
|
-
]
|
|
2999
|
-
})
|
|
3000
|
-
})
|
|
3001
|
-
]
|
|
3002
|
-
}) : null
|
|
3003
|
-
]
|
|
3004
|
-
})
|
|
3005
|
-
]
|
|
3006
|
-
})
|
|
3007
|
-
}) : null,
|
|
3008
|
-
/* @__PURE__ */ jsx16(DndContext, {
|
|
3194
|
+
/* @__PURE__ */ jsx17(DataTableToolbar, {
|
|
3195
|
+
activeGrouping,
|
|
3196
|
+
exportBaseName,
|
|
3197
|
+
exportRows,
|
|
3198
|
+
grouping,
|
|
3199
|
+
labels: labels2,
|
|
3200
|
+
onRefresh,
|
|
3201
|
+
onToggleGrouping: toggleGroupingField,
|
|
3202
|
+
onViewChange: setView,
|
|
3203
|
+
showColumnVisibility,
|
|
3204
|
+
showExport,
|
|
3205
|
+
showGallery,
|
|
3206
|
+
showSearch,
|
|
3207
|
+
showSorting,
|
|
3208
|
+
table,
|
|
3209
|
+
view: currentView
|
|
3210
|
+
}),
|
|
3211
|
+
/* @__PURE__ */ jsx17(DndContext, {
|
|
3009
3212
|
onDragCancel: () => setActiveDragLabel(null),
|
|
3010
|
-
onDragEnd:
|
|
3011
|
-
|
|
3012
|
-
if (!over) {
|
|
3013
|
-
return;
|
|
3014
|
-
}
|
|
3015
|
-
const dragType = active.data.current?.type;
|
|
3016
|
-
if (dragType === "row-reorder" && reordering && canReorderRows) {
|
|
3017
|
-
const sourceRowId = String(active.id).replace(/^sortable-row:/, "");
|
|
3018
|
-
const targetRowId = String(over.id).replace(/^sortable-row:/, "");
|
|
3019
|
-
if (sourceRowId === targetRowId) {
|
|
3020
|
-
return;
|
|
3021
|
-
}
|
|
3022
|
-
const currentIndex = bodyRows.findIndex((row2) => row2.id === sourceRowId);
|
|
3023
|
-
const nextIndex = bodyRows.findIndex((row2) => row2.id === targetRowId);
|
|
3024
|
-
if (currentIndex === -1 || nextIndex === -1) {
|
|
3025
|
-
return;
|
|
3026
|
-
}
|
|
3027
|
-
const rows = bodyRows.map((row2) => row2.original);
|
|
3028
|
-
const [rowToMove] = rows.splice(currentIndex, 1);
|
|
3029
|
-
if (!rowToMove)
|
|
3030
|
-
return;
|
|
3031
|
-
rows.splice(nextIndex, 0, rowToMove);
|
|
3032
|
-
reordering.onReorder(rows);
|
|
3033
|
-
return;
|
|
3034
|
-
}
|
|
3035
|
-
if (dragType !== "row" || over.data.current?.type !== "group-target") {
|
|
3036
|
-
return;
|
|
3037
|
-
}
|
|
3038
|
-
const row = active.data.current?.row;
|
|
3039
|
-
const field = grouping?.fields.find((currentField) => currentField.id === over.data.current?.fieldId);
|
|
3040
|
-
const nextGroupId = String(over.data.current?.groupId ?? "");
|
|
3041
|
-
if (!row || !field?.onMoveToGroup) {
|
|
3042
|
-
return;
|
|
3043
|
-
}
|
|
3044
|
-
const currentGroupId = field.getGroupId(row);
|
|
3045
|
-
if (currentGroupId === nextGroupId) {
|
|
3046
|
-
return;
|
|
3047
|
-
}
|
|
3048
|
-
field.onMoveToGroup(row, nextGroupId);
|
|
3049
|
-
},
|
|
3050
|
-
onDragStart: ({ active }) => {
|
|
3051
|
-
const label = active.data.current?.label;
|
|
3052
|
-
const dragType = active.data.current?.type;
|
|
3053
|
-
setActiveDragLabel(dragType === "row" && typeof label === "string" ? label : null);
|
|
3054
|
-
},
|
|
3213
|
+
onDragEnd: handleDragEnd,
|
|
3214
|
+
onDragStart: handleDragStart,
|
|
3055
3215
|
sensors,
|
|
3056
|
-
children: /* @__PURE__ */ jsxs8(
|
|
3057
|
-
value: currentView,
|
|
3216
|
+
children: /* @__PURE__ */ jsxs8(table.AppTable, {
|
|
3058
3217
|
children: [
|
|
3059
|
-
isGalleryView ? hasActiveGrouping ? groupedSections.length > 0 ? /* @__PURE__ */
|
|
3218
|
+
isGalleryView ? hasActiveGrouping ? groupedSections.length > 0 ? /* @__PURE__ */ jsx17("div", {
|
|
3060
3219
|
className: "space-y-4",
|
|
3061
3220
|
children: renderGroupedGallerySections(groupedSections)
|
|
3062
3221
|
}) : renderGalleryEmptyState() : bodyRows.length > 0 ? renderGalleryRows(bodyRows, false) : renderGalleryEmptyState() : /* @__PURE__ */ jsxs8(ScrollArea, {
|
|
3063
3222
|
className: "-m-1 max-w-full min-w-0",
|
|
3064
3223
|
children: [
|
|
3065
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsx17("div", {
|
|
3066
3225
|
className: "max-w-full min-w-0 p-1",
|
|
3067
3226
|
children: /* @__PURE__ */ jsxs8(Table, {
|
|
3068
3227
|
className: "table-fixed",
|
|
3069
3228
|
style: {
|
|
3070
|
-
width: `max(100%, ${table.getTotalSize() + (canReorderRows ? 40 : 0)}px)`
|
|
3229
|
+
width: `max(100%, ${table.getTotalSize() + (canReorderRows ? 40 : 0) + (selectable ? 40 : 0) + (rowActions ? 40 : 0)}px)`
|
|
3071
3230
|
},
|
|
3072
3231
|
children: [
|
|
3073
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsx17(TableHeader, {
|
|
3074
3233
|
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs8(TableRow, {
|
|
3075
3234
|
className: "p-4",
|
|
3076
3235
|
children: [
|
|
3077
|
-
|
|
3236
|
+
selectable ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3237
|
+
className: "w-10 min-w-10 pr-0",
|
|
3238
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
3239
|
+
"aria-label": labels2.selectAllRows,
|
|
3240
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
3241
|
+
indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected(),
|
|
3242
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked)
|
|
3243
|
+
})
|
|
3244
|
+
}) : null,
|
|
3245
|
+
canReorderRows ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3078
3246
|
className: "w-10 min-w-10 p-0"
|
|
3079
3247
|
}) : null,
|
|
3080
|
-
headerGroup.headers.map((header) => {
|
|
3081
|
-
|
|
3248
|
+
headerGroup.headers.map((header) => /* @__PURE__ */ jsx17(table.AppHeader, {
|
|
3249
|
+
header,
|
|
3250
|
+
children: (appHeader) => /* @__PURE__ */ jsxs8(TableHead, {
|
|
3082
3251
|
className: "relative h-12 min-w-32 p-0",
|
|
3083
3252
|
style: { width: header.getSize() },
|
|
3084
3253
|
children: [
|
|
3085
|
-
|
|
3086
|
-
header.column.getCanResize() ? /* @__PURE__ */
|
|
3254
|
+
header.isPlaceholder ? null : /* @__PURE__ */ jsx17(appHeader.FlexRender, {}),
|
|
3255
|
+
header.column.getCanResize() ? /* @__PURE__ */ jsx17("button", {
|
|
3087
3256
|
"aria-label": labels2.resizeColumn(getHeaderName(header)),
|
|
3257
|
+
"aria-orientation": "vertical",
|
|
3258
|
+
"aria-valuemax": header.column.columnDef.maxSize ?? DEFAULT_COLUMN_MAX_SIZE,
|
|
3259
|
+
"aria-valuemin": header.column.columnDef.minSize ?? DEFAULT_COLUMN_MIN_SIZE,
|
|
3260
|
+
"aria-valuenow": header.column.getSize(),
|
|
3088
3261
|
className: cn("hover:bg-primary/60 absolute inset-y-0 right-0 z-10 w-1 cursor-col-resize touch-none bg-transparent p-0 select-none", header.column.getIsResizing() && "bg-primary"),
|
|
3262
|
+
onKeyDown: (event) => {
|
|
3263
|
+
const minSize = header.column.columnDef.minSize ?? DEFAULT_COLUMN_MIN_SIZE;
|
|
3264
|
+
const maxSize = header.column.columnDef.maxSize ?? DEFAULT_COLUMN_MAX_SIZE;
|
|
3265
|
+
const currentSize = header.column.getSize();
|
|
3266
|
+
const nextSize = event.key === "ArrowLeft" ? currentSize - COLUMN_RESIZE_STEP : event.key === "ArrowRight" ? currentSize + COLUMN_RESIZE_STEP : event.key === "Home" ? minSize : event.key === "End" ? maxSize : undefined;
|
|
3267
|
+
if (nextSize === undefined)
|
|
3268
|
+
return;
|
|
3269
|
+
event.preventDefault();
|
|
3270
|
+
table.setColumnSizing((current) => ({
|
|
3271
|
+
...current,
|
|
3272
|
+
[header.column.id]: Math.min(maxSize, Math.max(minSize, nextSize))
|
|
3273
|
+
}));
|
|
3274
|
+
},
|
|
3275
|
+
role: "separator",
|
|
3089
3276
|
type: "button",
|
|
3090
3277
|
onDoubleClick: () => header.column.resetSize(),
|
|
3091
3278
|
onMouseDown: header.getResizeHandler(),
|
|
3092
3279
|
onTouchStart: header.getResizeHandler()
|
|
3093
3280
|
}) : null
|
|
3094
3281
|
]
|
|
3095
|
-
}
|
|
3096
|
-
}),
|
|
3097
|
-
rowActions ? /* @__PURE__ */
|
|
3098
|
-
className: "
|
|
3282
|
+
})
|
|
3283
|
+
}, header.id)),
|
|
3284
|
+
rowActions ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3285
|
+
className: "w-10 min-w-10 p-0"
|
|
3099
3286
|
}) : null
|
|
3100
3287
|
]
|
|
3101
3288
|
}, headerGroup.id))
|
|
3102
3289
|
}),
|
|
3103
|
-
hasActiveGrouping ? groupedSections.length > 0 ? renderGroupedTableSections(groupedSections) : /* @__PURE__ */
|
|
3290
|
+
hasActiveGrouping ? groupedSections.length > 0 ? renderGroupedTableSections(groupedSections) : /* @__PURE__ */ jsx17(TableBody, {
|
|
3104
3291
|
className: "px-2",
|
|
3105
3292
|
children: renderTableEmptyState()
|
|
3106
|
-
}) : /* @__PURE__ */
|
|
3293
|
+
}) : /* @__PURE__ */ jsx17(TableBody, {
|
|
3107
3294
|
className: "px-2",
|
|
3108
|
-
children: bodyRows.length > 0 ? canReorderRows ? /* @__PURE__ */
|
|
3295
|
+
children: bodyRows.length > 0 ? canReorderRows ? /* @__PURE__ */ jsx17(SortableContext, {
|
|
3109
3296
|
items: sortableRowIds,
|
|
3110
3297
|
strategy: verticalListSortingStrategy,
|
|
3111
|
-
children: bodyRows.map((row) => /* @__PURE__ */
|
|
3298
|
+
children: bodyRows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
3112
3299
|
canDrag: false,
|
|
3113
3300
|
canReorder: true,
|
|
3114
3301
|
dragLabel: reordering?.getRowLabel?.(row.original),
|
|
@@ -3116,28 +3303,34 @@ function DataTable({
|
|
|
3116
3303
|
reorderHandleLabel: reordering?.handleLabel ?? labels2.reorder,
|
|
3117
3304
|
row,
|
|
3118
3305
|
rowActions,
|
|
3119
|
-
rowActionsLabel
|
|
3306
|
+
rowActionsLabel,
|
|
3307
|
+
selectRowLabel: labels2.selectRow,
|
|
3308
|
+
selectable,
|
|
3309
|
+
table
|
|
3120
3310
|
}, row.id))
|
|
3121
|
-
}) : bodyRows.map((row) => /* @__PURE__ */
|
|
3311
|
+
}) : bodyRows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
3122
3312
|
canDrag: false,
|
|
3123
3313
|
canReorder: false,
|
|
3124
3314
|
onRowClick,
|
|
3125
3315
|
row,
|
|
3126
3316
|
rowActions,
|
|
3127
|
-
rowActionsLabel
|
|
3317
|
+
rowActionsLabel,
|
|
3318
|
+
selectRowLabel: labels2.selectRow,
|
|
3319
|
+
selectable,
|
|
3320
|
+
table
|
|
3128
3321
|
}, row.id)) : renderTableEmptyState()
|
|
3129
3322
|
})
|
|
3130
3323
|
]
|
|
3131
3324
|
})
|
|
3132
3325
|
}),
|
|
3133
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsx17(ScrollBar, {
|
|
3134
3327
|
orientation: "horizontal"
|
|
3135
3328
|
})
|
|
3136
3329
|
]
|
|
3137
3330
|
}),
|
|
3138
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ jsx17(DragOverlay, {
|
|
3139
3332
|
modifiers: [snapDragOverlayVerticalCenterToCursor],
|
|
3140
|
-
children: activeDragLabel ? /* @__PURE__ */
|
|
3333
|
+
children: activeDragLabel ? /* @__PURE__ */ jsx17("div", {
|
|
3141
3334
|
className: "bg-background rounded-md border px-3 py-2 text-sm shadow-sm",
|
|
3142
3335
|
children: activeDragLabel
|
|
3143
3336
|
}) : null
|
|
@@ -3145,9 +3338,9 @@ function DataTable({
|
|
|
3145
3338
|
]
|
|
3146
3339
|
})
|
|
3147
3340
|
}),
|
|
3148
|
-
showPagination && !hasActiveGrouping && /* @__PURE__ */
|
|
3341
|
+
showPagination && !hasActiveGrouping && /* @__PURE__ */ jsx17("div", {
|
|
3149
3342
|
className: "p-2",
|
|
3150
|
-
children: /* @__PURE__ */
|
|
3343
|
+
children: /* @__PURE__ */ jsx17(DataTablePagination, {
|
|
3151
3344
|
messages: labels2,
|
|
3152
3345
|
pageSizes,
|
|
3153
3346
|
rowCount: serverRowCount,
|
|
@@ -3164,39 +3357,43 @@ function DataTableDisplayModeSwitch({
|
|
|
3164
3357
|
}) {
|
|
3165
3358
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3166
3359
|
children: [
|
|
3167
|
-
/* @__PURE__ */
|
|
3360
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3168
3361
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3169
3362
|
"aria-label": messages4.view,
|
|
3170
3363
|
className: "h-9",
|
|
3171
3364
|
size: "sm",
|
|
3172
3365
|
variant: "outline",
|
|
3173
3366
|
children: [
|
|
3174
|
-
value === "gallery" ? /* @__PURE__ */
|
|
3175
|
-
/* @__PURE__ */
|
|
3367
|
+
value === "gallery" ? /* @__PURE__ */ jsx17(LayoutGrid, {}) : /* @__PURE__ */ jsx17(Rows3, {}),
|
|
3368
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3176
3369
|
className: "hidden sm:inline",
|
|
3177
3370
|
children: messages4.view
|
|
3178
3371
|
})
|
|
3179
3372
|
]
|
|
3180
3373
|
})
|
|
3181
3374
|
}),
|
|
3182
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3183
3376
|
align: "end",
|
|
3184
3377
|
className: "w-[160px]",
|
|
3185
3378
|
children: /* @__PURE__ */ jsxs8(DropdownMenuRadioGroup, {
|
|
3186
3379
|
value,
|
|
3187
|
-
onValueChange: (
|
|
3380
|
+
onValueChange: (nextValue) => {
|
|
3381
|
+
const view = decodeDataTableView(nextValue);
|
|
3382
|
+
if (Option2.isSome(view))
|
|
3383
|
+
onChange(view.value);
|
|
3384
|
+
},
|
|
3188
3385
|
children: [
|
|
3189
3386
|
/* @__PURE__ */ jsxs8(DropdownMenuRadioItem, {
|
|
3190
3387
|
value: "table",
|
|
3191
3388
|
children: [
|
|
3192
|
-
/* @__PURE__ */
|
|
3389
|
+
/* @__PURE__ */ jsx17(Rows3, {}),
|
|
3193
3390
|
messages4.tableView
|
|
3194
3391
|
]
|
|
3195
3392
|
}),
|
|
3196
3393
|
/* @__PURE__ */ jsxs8(DropdownMenuRadioItem, {
|
|
3197
3394
|
value: "gallery",
|
|
3198
3395
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3396
|
+
/* @__PURE__ */ jsx17(LayoutGrid, {}),
|
|
3200
3397
|
messages4.galleryView
|
|
3201
3398
|
]
|
|
3202
3399
|
})
|
|
@@ -3210,39 +3407,39 @@ function DataTableSortDropdown({
|
|
|
3210
3407
|
messages: messages4,
|
|
3211
3408
|
table
|
|
3212
3409
|
}) {
|
|
3213
|
-
const sorting = table.
|
|
3410
|
+
const sorting = table.state.sorting;
|
|
3214
3411
|
const sortableColumns = table.getAllColumns().filter((column) => column.getCanSort());
|
|
3215
|
-
const columnLabels =
|
|
3412
|
+
const columnLabels = getColumnLabels(table);
|
|
3216
3413
|
if (sortableColumns.length === 0) {
|
|
3217
3414
|
return null;
|
|
3218
3415
|
}
|
|
3219
3416
|
const activeSortColumn = sorting.length > 0 ? sorting[0] : null;
|
|
3220
3417
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3221
3418
|
children: [
|
|
3222
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3223
3420
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3224
3421
|
"aria-label": messages4.sortBy,
|
|
3225
3422
|
className: "h-9",
|
|
3226
3423
|
size: "sm",
|
|
3227
3424
|
variant: "outline",
|
|
3228
3425
|
children: [
|
|
3229
|
-
activeSortColumn ? activeSortColumn.desc ? /* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3426
|
+
activeSortColumn ? activeSortColumn.desc ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {}) : /* @__PURE__ */ jsx17(ChevronsUpDown2, {}),
|
|
3427
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3231
3428
|
className: "hidden sm:inline",
|
|
3232
3429
|
children: messages4.sortBy
|
|
3233
3430
|
})
|
|
3234
3431
|
]
|
|
3235
3432
|
})
|
|
3236
3433
|
}),
|
|
3237
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3238
3435
|
align: "end",
|
|
3239
3436
|
className: "w-[200px]",
|
|
3240
3437
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3241
3438
|
children: [
|
|
3242
|
-
/* @__PURE__ */
|
|
3439
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
3243
3440
|
children: messages4.sortBy
|
|
3244
3441
|
}),
|
|
3245
|
-
/* @__PURE__ */
|
|
3442
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3246
3443
|
sortableColumns.map((column) => {
|
|
3247
3444
|
const sortState = sorting.find((s) => s.id === column.id);
|
|
3248
3445
|
const label = columnLabels.get(column.id) ?? column.id;
|
|
@@ -3251,9 +3448,9 @@ function DataTableSortDropdown({
|
|
|
3251
3448
|
/* @__PURE__ */ jsxs8(DropdownMenuSubTrigger, {
|
|
3252
3449
|
inset: !!sortState,
|
|
3253
3450
|
children: [
|
|
3254
|
-
sortState ? /* @__PURE__ */
|
|
3451
|
+
sortState ? /* @__PURE__ */ jsx17("span", {
|
|
3255
3452
|
className: "pointer-events-none absolute left-3 flex size-4 items-center justify-center",
|
|
3256
|
-
children: sortState.desc ? /* @__PURE__ */
|
|
3453
|
+
children: sortState.desc ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {})
|
|
3257
3454
|
}) : null,
|
|
3258
3455
|
label
|
|
3259
3456
|
]
|
|
@@ -3263,21 +3460,21 @@ function DataTableSortDropdown({
|
|
|
3263
3460
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3264
3461
|
onClick: () => column.toggleSorting(false),
|
|
3265
3462
|
children: [
|
|
3266
|
-
/* @__PURE__ */
|
|
3463
|
+
/* @__PURE__ */ jsx17(ArrowUp, {}),
|
|
3267
3464
|
messages4.sortAsc
|
|
3268
3465
|
]
|
|
3269
3466
|
}),
|
|
3270
3467
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3271
3468
|
onClick: () => column.toggleSorting(true),
|
|
3272
3469
|
children: [
|
|
3273
|
-
/* @__PURE__ */
|
|
3470
|
+
/* @__PURE__ */ jsx17(ArrowDown, {}),
|
|
3274
3471
|
messages4.sortDesc
|
|
3275
3472
|
]
|
|
3276
3473
|
}),
|
|
3277
3474
|
sortState && /* @__PURE__ */ jsxs8(Fragment, {
|
|
3278
3475
|
children: [
|
|
3279
|
-
/* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3477
|
+
/* @__PURE__ */ jsx17(DropdownMenuItem, {
|
|
3281
3478
|
onClick: () => column.clearSorting(),
|
|
3282
3479
|
children: messages4.sortClear
|
|
3283
3480
|
})
|
|
@@ -3298,38 +3495,38 @@ function DataTableViewOptions({
|
|
|
3298
3495
|
messages: messages4,
|
|
3299
3496
|
table
|
|
3300
3497
|
}) {
|
|
3301
|
-
const columnLabels =
|
|
3498
|
+
const columnLabels = getColumnLabels(table);
|
|
3302
3499
|
const columns = table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide());
|
|
3303
3500
|
if (columns.length === 0) {
|
|
3304
3501
|
return null;
|
|
3305
3502
|
}
|
|
3306
3503
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3307
3504
|
children: [
|
|
3308
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3309
3506
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3310
3507
|
"aria-label": messages4.columns,
|
|
3311
3508
|
className: "h-9",
|
|
3312
3509
|
size: "sm",
|
|
3313
3510
|
variant: "outline",
|
|
3314
3511
|
children: [
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsx17(Settings2, {}),
|
|
3513
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3317
3514
|
className: "hidden sm:inline",
|
|
3318
3515
|
children: messages4.columns
|
|
3319
3516
|
})
|
|
3320
3517
|
]
|
|
3321
3518
|
})
|
|
3322
3519
|
}),
|
|
3323
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3324
3521
|
align: "end",
|
|
3325
3522
|
className: "w-[180px]",
|
|
3326
3523
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3327
3524
|
children: [
|
|
3328
|
-
/* @__PURE__ */
|
|
3525
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
3329
3526
|
children: messages4.columns
|
|
3330
3527
|
}),
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
columns.map((column) => /* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3529
|
+
columns.map((column) => /* @__PURE__ */ jsx17(DropdownMenuCheckboxItem, {
|
|
3333
3530
|
checked: column.getIsVisible(),
|
|
3334
3531
|
className: "capitalize",
|
|
3335
3532
|
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
@@ -3351,7 +3548,7 @@ function DataTablePagination({
|
|
|
3351
3548
|
const selectedRows = table.getFilteredSelectedRowModel().rows.length;
|
|
3352
3549
|
const filteredRows = table.getFilteredRowModel().rows.length;
|
|
3353
3550
|
const totalRows = rowCount ?? filteredRows;
|
|
3354
|
-
return /* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ jsx17(Pagination, {
|
|
3355
3552
|
messages: {
|
|
3356
3553
|
pageSize: labels2.pageSize,
|
|
3357
3554
|
results: labels2.results,
|
|
@@ -3364,9 +3561,9 @@ function DataTablePagination({
|
|
|
3364
3561
|
},
|
|
3365
3562
|
onPageChange: (page) => table.setPageIndex(page),
|
|
3366
3563
|
onPageSizeChange: (pageSize) => table.setPageSize(pageSize),
|
|
3367
|
-
page: table.
|
|
3564
|
+
page: table.state.pagination.pageIndex,
|
|
3368
3565
|
pageCount: table.getPageCount(),
|
|
3369
|
-
pageSize: table.
|
|
3566
|
+
pageSize: table.state.pagination.pageSize,
|
|
3370
3567
|
pageSizes,
|
|
3371
3568
|
selectedRows,
|
|
3372
3569
|
totalRows
|
|
@@ -3386,7 +3583,7 @@ function DataTableRelationshipCell({
|
|
|
3386
3583
|
useEffect2(() => {
|
|
3387
3584
|
setSelectedOptions([...value]);
|
|
3388
3585
|
}, [value]);
|
|
3389
|
-
return /* @__PURE__ */
|
|
3586
|
+
return /* @__PURE__ */ jsx17(VirtualizedCombobox, {
|
|
3390
3587
|
ariaLabel: manageLabel,
|
|
3391
3588
|
emptyLabel,
|
|
3392
3589
|
items: orderedOptions,
|
|
@@ -3412,13 +3609,13 @@ function DataTableRelationshipCell({
|
|
|
3412
3609
|
type: "button",
|
|
3413
3610
|
variant: "ghost",
|
|
3414
3611
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ jsx17(DataTableListSummary, {
|
|
3416
3613
|
emptyLabel,
|
|
3417
3614
|
expandable: false,
|
|
3418
3615
|
items: selectedOptions,
|
|
3419
3616
|
variant: selectedOptions.some(({ icon }) => icon) ? "icon" : "text"
|
|
3420
3617
|
}),
|
|
3421
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsx17(ChevronDown, {
|
|
3422
3619
|
className: "text-muted-foreground size-4 shrink-0"
|
|
3423
3620
|
})
|
|
3424
3621
|
]
|
|
@@ -3441,20 +3638,20 @@ function DataTableListSummary({
|
|
|
3441
3638
|
const visibleLabels = visibleItems.map(({ label }) => label).join(", ");
|
|
3442
3639
|
const remaining = Math.max(totalCount - visibleItems.length, 0);
|
|
3443
3640
|
const remainingLabel = overflowLabel?.(remaining) ?? labels2.listOthers(remaining);
|
|
3444
|
-
const expandedItems = /* @__PURE__ */
|
|
3641
|
+
const expandedItems = /* @__PURE__ */ jsx17(PopoverContent, {
|
|
3445
3642
|
align: "start",
|
|
3446
3643
|
className: "max-h-72 w-72 overflow-y-auto p-2",
|
|
3447
3644
|
onClick: (event) => event.stopPropagation(),
|
|
3448
|
-
children: /* @__PURE__ */
|
|
3645
|
+
children: /* @__PURE__ */ jsx17("ul", {
|
|
3449
3646
|
className: "grid gap-1",
|
|
3450
3647
|
children: normalizedItems.map((item, index) => /* @__PURE__ */ jsxs8("li", {
|
|
3451
3648
|
className: "flex items-center gap-2 rounded-sm px-2 py-1.5 break-words",
|
|
3452
3649
|
children: [
|
|
3453
|
-
item.icon ? /* @__PURE__ */
|
|
3650
|
+
item.icon ? /* @__PURE__ */ jsx17("span", {
|
|
3454
3651
|
className: "bg-muted flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-semibold",
|
|
3455
3652
|
children: item.icon
|
|
3456
3653
|
}) : null,
|
|
3457
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3458
3655
|
className: "min-w-0",
|
|
3459
3656
|
children: item.label
|
|
3460
3657
|
})
|
|
@@ -3463,34 +3660,34 @@ function DataTableListSummary({
|
|
|
3463
3660
|
})
|
|
3464
3661
|
});
|
|
3465
3662
|
if (normalizedItems.length === 0) {
|
|
3466
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsx17("span", {
|
|
3467
3664
|
className: "text-muted-foreground text-sm",
|
|
3468
3665
|
children: emptyLabel
|
|
3469
3666
|
});
|
|
3470
3667
|
}
|
|
3471
3668
|
if (variant === "icon") {
|
|
3472
|
-
return /* @__PURE__ */
|
|
3669
|
+
return /* @__PURE__ */ jsx17(TooltipProvider, {
|
|
3473
3670
|
children: /* @__PURE__ */ jsxs8("span", {
|
|
3474
3671
|
className: "flex min-w-0 items-center pl-2",
|
|
3475
3672
|
children: [
|
|
3476
3673
|
visibleItems.map((item, index) => /* @__PURE__ */ jsxs8(Tooltip, {
|
|
3477
3674
|
children: [
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
render: /* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx17(TooltipTrigger, {
|
|
3676
|
+
render: /* @__PURE__ */ jsx17("span", {
|
|
3480
3677
|
"aria-label": item.label,
|
|
3481
3678
|
className: "bg-muted border-background relative flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full border-2 text-[10px] font-semibold",
|
|
3482
3679
|
style: { marginLeft: index ? -8 : 0 },
|
|
3483
3680
|
children: item.icon ?? item.label.slice(0, 2).toUpperCase()
|
|
3484
3681
|
})
|
|
3485
3682
|
}),
|
|
3486
|
-
/* @__PURE__ */
|
|
3683
|
+
/* @__PURE__ */ jsx17(TooltipContent, {
|
|
3487
3684
|
children: item.label
|
|
3488
3685
|
})
|
|
3489
3686
|
]
|
|
3490
3687
|
}, item.value ?? item.label)),
|
|
3491
3688
|
remaining ? expandable ? /* @__PURE__ */ jsxs8(Popover, {
|
|
3492
3689
|
children: [
|
|
3493
|
-
/* @__PURE__ */
|
|
3690
|
+
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
3494
3691
|
render: /* @__PURE__ */ jsxs8("button", {
|
|
3495
3692
|
"aria-label": labels2.listOthers(remaining),
|
|
3496
3693
|
className: "bg-muted border-background relative -ml-2 flex size-8 shrink-0 items-center justify-center rounded-full border-2 text-[10px] font-semibold tabular-nums",
|
|
@@ -3520,16 +3717,16 @@ function DataTableListSummary({
|
|
|
3520
3717
|
className: "block min-w-0 text-sm whitespace-normal",
|
|
3521
3718
|
"data-slot": "list-summary",
|
|
3522
3719
|
children: [
|
|
3523
|
-
/* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3524
3721
|
children: visibleLabels
|
|
3525
3722
|
}),
|
|
3526
3723
|
" ",
|
|
3527
|
-
/* @__PURE__ */
|
|
3724
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3528
3725
|
className: "inline-block whitespace-nowrap",
|
|
3529
3726
|
children: expandable ? /* @__PURE__ */ jsxs8(Popover, {
|
|
3530
3727
|
children: [
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
render: /* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
3729
|
+
render: /* @__PURE__ */ jsx17("button", {
|
|
3533
3730
|
className: "text-muted-foreground hover:text-foreground underline decoration-dotted underline-offset-2",
|
|
3534
3731
|
onClick: (event) => event.stopPropagation(),
|
|
3535
3732
|
onPointerDown: (event) => event.stopPropagation(),
|
|
@@ -3542,7 +3739,7 @@ function DataTableListSummary({
|
|
|
3542
3739
|
}) : remainingLabel
|
|
3543
3740
|
})
|
|
3544
3741
|
]
|
|
3545
|
-
}) : /* @__PURE__ */
|
|
3742
|
+
}) : /* @__PURE__ */ jsx17("span", {
|
|
3546
3743
|
className: "block min-w-0 text-sm",
|
|
3547
3744
|
"data-slot": "list-summary",
|
|
3548
3745
|
children: visibleLabels
|
|
@@ -3557,37 +3754,38 @@ function DataTableColumnHeader({
|
|
|
3557
3754
|
const labels2 = dataTableMessages(messages4);
|
|
3558
3755
|
const sortDirection = column.getIsSorted();
|
|
3559
3756
|
if (!column.getCanSort()) {
|
|
3560
|
-
return /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
3561
3758
|
className: cn("flex h-12 items-center truncate px-2 text-sm", className),
|
|
3562
3759
|
children: title
|
|
3563
3760
|
});
|
|
3564
3761
|
}
|
|
3565
|
-
return /* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
3566
3763
|
className: cn("flex h-12 items-center", className),
|
|
3567
3764
|
children: /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3568
3765
|
children: [
|
|
3569
|
-
/* @__PURE__ */
|
|
3766
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3570
3767
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3571
3768
|
variant: "ghost",
|
|
3572
3769
|
size: "sm",
|
|
3573
|
-
className: "data-[state=open]:bg-accent h-
|
|
3770
|
+
className: "data-[state=open]:bg-accent h-8 max-w-full justify-start px-2",
|
|
3574
3771
|
children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3576
3773
|
className: "min-w-0 truncate text-sm",
|
|
3577
3774
|
children: title
|
|
3578
3775
|
}),
|
|
3579
|
-
sortDirection === "desc" ? /* @__PURE__ */
|
|
3776
|
+
sortDirection === "desc" ? /* @__PURE__ */ jsx17(ArrowDown, {}) : sortDirection === "asc" ? /* @__PURE__ */ jsx17(ArrowUp, {}) : /* @__PURE__ */ jsx17(ChevronsUpDown2, {})
|
|
3580
3777
|
]
|
|
3581
3778
|
})
|
|
3582
3779
|
}),
|
|
3583
|
-
/* @__PURE__ */
|
|
3780
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3584
3781
|
align: "start",
|
|
3782
|
+
className: "max-w-56",
|
|
3585
3783
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3586
3784
|
children: [
|
|
3587
3785
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3588
3786
|
onClick: () => column.toggleSorting(false),
|
|
3589
3787
|
children: [
|
|
3590
|
-
/* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ jsx17(ArrowUp, {
|
|
3591
3789
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3592
3790
|
}),
|
|
3593
3791
|
labels2.sortAsc
|
|
@@ -3596,7 +3794,7 @@ function DataTableColumnHeader({
|
|
|
3596
3794
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3597
3795
|
onClick: () => column.toggleSorting(true),
|
|
3598
3796
|
children: [
|
|
3599
|
-
/* @__PURE__ */
|
|
3797
|
+
/* @__PURE__ */ jsx17(ArrowDown, {
|
|
3600
3798
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3601
3799
|
}),
|
|
3602
3800
|
labels2.sortDesc
|
|
@@ -3605,17 +3803,17 @@ function DataTableColumnHeader({
|
|
|
3605
3803
|
sortDirection ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3606
3804
|
onClick: () => column.clearSorting(),
|
|
3607
3805
|
children: [
|
|
3608
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ jsx17(X2, {
|
|
3609
3807
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3610
3808
|
}),
|
|
3611
3809
|
labels2.sortClear
|
|
3612
3810
|
]
|
|
3613
3811
|
}) : null,
|
|
3614
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3615
3813
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3616
3814
|
onClick: () => column.toggleVisibility(false),
|
|
3617
3815
|
children: [
|
|
3618
|
-
/* @__PURE__ */
|
|
3816
|
+
/* @__PURE__ */ jsx17(EyeOff, {
|
|
3619
3817
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3620
3818
|
}),
|
|
3621
3819
|
labels2.sortHide
|
|
@@ -3629,10 +3827,15 @@ function DataTableColumnHeader({
|
|
|
3629
3827
|
});
|
|
3630
3828
|
}
|
|
3631
3829
|
export {
|
|
3830
|
+
useDataTableHeaderContext,
|
|
3831
|
+
useDataTableContext,
|
|
3832
|
+
useDataTableCellContext,
|
|
3833
|
+
useDataTable,
|
|
3632
3834
|
getHeaderNames,
|
|
3633
3835
|
downloadJson,
|
|
3634
3836
|
downloadCsv,
|
|
3635
3837
|
dataTableMessages,
|
|
3838
|
+
createDataTableColumnHelper,
|
|
3636
3839
|
TableSearchSchemaStandard,
|
|
3637
3840
|
TableSearchSchema,
|
|
3638
3841
|
DataTableRowActions,
|