@krak-stack/registry 0.1.9 → 0.1.11
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 +145 -19
- package/dist/components/ui/data-table.js +1522 -1252
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/components/ui/sidebar-layout.d.ts +1 -0
- package/dist/components/ui/sidebar-layout.js +6 -1
- 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/package.json +14 -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,490 +786,30 @@ 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
|
-
...overrides
|
|
581
|
-
});
|
|
582
|
-
var optionEquals = (item, selected) => item.value === selected.value;
|
|
583
|
-
var VirtualizedComboboxList = ({
|
|
584
|
-
emptyLabel,
|
|
585
|
-
groupSelections,
|
|
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,
|
|
841
|
-
children: [
|
|
842
|
-
/* @__PURE__ */ jsxs("div", {
|
|
843
|
-
className: "relative",
|
|
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
|
-
]
|
|
850
|
-
}),
|
|
851
|
-
/* @__PURE__ */ jsx5(VirtualizedComboboxContent, {
|
|
852
|
-
...props,
|
|
853
|
-
groupSelections: true,
|
|
854
|
-
itemIndexRef,
|
|
855
|
-
selectedValues: new Set(props.value.map(({ value }) => value)),
|
|
856
|
-
virtualizerRef
|
|
857
|
-
})
|
|
858
|
-
]
|
|
859
|
-
});
|
|
860
|
-
};
|
|
861
|
-
function VirtualizedCombobox(props) {
|
|
862
|
-
return props.multiple ? /* @__PURE__ */ jsx5(VirtualizedComboboxMultiple, {
|
|
863
|
-
...props
|
|
864
|
-
}) : /* @__PURE__ */ jsx5(VirtualizedComboboxSingle, {
|
|
865
|
-
...props
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// ../../src/components/ui/dropdown-menu.tsx
|
|
870
|
-
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
871
|
-
import { ChevronRightIcon, CheckIcon } from "lucide-react";
|
|
872
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
873
|
-
function DropdownMenu({ ...props }) {
|
|
874
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Root, {
|
|
875
|
-
"data-slot": "dropdown-menu",
|
|
876
|
-
...props
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
880
|
-
return /* @__PURE__ */ jsx6(MenuPrimitive.Trigger, {
|
|
881
|
-
"data-slot": "dropdown-menu-trigger",
|
|
882
|
-
...props
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
function DropdownMenuContent({
|
|
886
|
-
align = "start",
|
|
887
|
-
alignOffset = 0,
|
|
888
|
-
side = "bottom",
|
|
889
|
-
sideOffset = 4,
|
|
890
|
-
className,
|
|
891
|
-
...props
|
|
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({
|
|
799
|
+
var loadingLabel = () => getLocale().startsWith("fr") ? labels.fr.loading : labels.en.loading;
|
|
800
|
+
function Loading({
|
|
1015
801
|
className,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
...props
|
|
802
|
+
label,
|
|
803
|
+
variant = "inline"
|
|
1019
804
|
}) {
|
|
1020
|
-
return /* @__PURE__ */ jsxs2(
|
|
1021
|
-
"
|
|
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,
|
|
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),
|
|
1025
807
|
children: [
|
|
1026
|
-
/* @__PURE__ */ jsx6(
|
|
1027
|
-
className: "
|
|
1028
|
-
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
1029
|
-
children: /* @__PURE__ */ jsx6(MenuPrimitive.RadioItemIndicator, {
|
|
1030
|
-
children: /* @__PURE__ */ jsx6(CheckIcon, {})
|
|
1031
|
-
})
|
|
808
|
+
/* @__PURE__ */ jsx6(Loader2, {
|
|
809
|
+
className: "size-4 animate-spin"
|
|
1032
810
|
}),
|
|
1033
|
-
|
|
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
|
|
811
|
+
label ?? loadingLabel()
|
|
812
|
+
]
|
|
1045
813
|
});
|
|
1046
814
|
}
|
|
1047
815
|
|
|
@@ -1067,7 +835,7 @@ function Label({ className, ...props }) {
|
|
|
1067
835
|
|
|
1068
836
|
// ../../src/components/ui/select.tsx
|
|
1069
837
|
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
1070
|
-
import { ChevronDownIcon, CheckIcon as
|
|
838
|
+
import { ChevronDownIcon, CheckIcon as CheckIcon3, ChevronUpIcon } from "lucide-react";
|
|
1071
839
|
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1072
840
|
"use client";
|
|
1073
841
|
var Select = SelectPrimitive.Root;
|
|
@@ -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
|
|
|
@@ -1630,212 +1766,139 @@ var Query = Schema.Struct({
|
|
|
1630
1766
|
identifier: "Query",
|
|
1631
1767
|
title: "Query",
|
|
1632
1768
|
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()
|
|
1825
|
-
]
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
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,10 @@ 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",
|
|
1968
|
+
selected: "Selected"
|
|
1879
1969
|
},
|
|
1880
1970
|
fr: {
|
|
1881
1971
|
...paginationMessages("fr"),
|
|
@@ -1899,7 +1989,10 @@ var messages3 = {
|
|
|
1899
1989
|
sortBy: "Trier par",
|
|
1900
1990
|
reorder: "Glisser pour réordonner",
|
|
1901
1991
|
resizeColumn: (column) => `Redimensionner la colonne ${column}`,
|
|
1902
|
-
listOthers: (count) => count === 1 ? "et 1 autre" : `et ${count} autres
|
|
1992
|
+
listOthers: (count) => count === 1 ? "et 1 autre" : `et ${count} autres`,
|
|
1993
|
+
selectAllRows: "Sélectionner toutes les lignes de cette page",
|
|
1994
|
+
selectRow: "Sélectionner la ligne",
|
|
1995
|
+
selected: "Sélectionnés"
|
|
1903
1996
|
}
|
|
1904
1997
|
};
|
|
1905
1998
|
var dataTableMessages = (overrides) => ({
|
|
@@ -1935,6 +2028,11 @@ var getDefaultGrouping = (grouping) => {
|
|
|
1935
2028
|
var getGroupTargetDropId = (key) => `group-target:${key}`;
|
|
1936
2029
|
var getRowDragId = (rowId) => `row:${rowId}`;
|
|
1937
2030
|
var getSortableRowId = (rowId) => `sortable-row:${rowId}`;
|
|
2031
|
+
var getGroupLabels = (section) => {
|
|
2032
|
+
const rows = section.rows.map((row) => row.original);
|
|
2033
|
+
const label = section.field.getGroupLabel?.(section.groupId, rows) ?? section.groupId;
|
|
2034
|
+
return section.field.renderGroupLabel?.(section.groupId, rows) ?? label;
|
|
2035
|
+
};
|
|
1938
2036
|
var DataTableRowActions = ({
|
|
1939
2037
|
actions,
|
|
1940
2038
|
contentClassName,
|
|
@@ -1948,30 +2046,30 @@ var DataTableRowActions = ({
|
|
|
1948
2046
|
}
|
|
1949
2047
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
1950
2048
|
children: [
|
|
1951
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
1952
2050
|
onClick: (event) => event.stopPropagation(),
|
|
1953
2051
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
1954
|
-
className: "size-
|
|
2052
|
+
className: "size-8 focus-visible:ring-inset [&_svg:not([class*='size-'])]:size-4",
|
|
1955
2053
|
variant: "ghost",
|
|
1956
2054
|
size: "icon",
|
|
1957
2055
|
children: [
|
|
1958
|
-
/* @__PURE__ */
|
|
2056
|
+
/* @__PURE__ */ jsx17("span", {
|
|
1959
2057
|
className: "sr-only",
|
|
1960
2058
|
children: resolvedTitle
|
|
1961
2059
|
}),
|
|
1962
|
-
/* @__PURE__ */
|
|
2060
|
+
/* @__PURE__ */ jsx17(MoreHorizontal, {})
|
|
1963
2061
|
]
|
|
1964
2062
|
})
|
|
1965
2063
|
}),
|
|
1966
|
-
/* @__PURE__ */
|
|
2064
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
1967
2065
|
align: "end",
|
|
1968
2066
|
className: cn("w-max", contentClassName),
|
|
1969
2067
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
1970
2068
|
children: [
|
|
1971
|
-
/* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
1972
2070
|
children: resolvedTitle
|
|
1973
2071
|
}),
|
|
1974
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
1975
2073
|
visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
1976
2074
|
className: "whitespace-nowrap",
|
|
1977
2075
|
onClick: (event) => {
|
|
@@ -1990,6 +2088,59 @@ var DataTableRowActions = ({
|
|
|
1990
2088
|
]
|
|
1991
2089
|
});
|
|
1992
2090
|
};
|
|
2091
|
+
var DataTableBulkActions = ({
|
|
2092
|
+
actions,
|
|
2093
|
+
label,
|
|
2094
|
+
selectedLabel: selectedLabel2,
|
|
2095
|
+
rows
|
|
2096
|
+
}) => {
|
|
2097
|
+
const visibleActions = actions.filter((action) => !action.visible || action.visible(rows));
|
|
2098
|
+
if (visibleActions.length === 0)
|
|
2099
|
+
return null;
|
|
2100
|
+
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2101
|
+
children: [
|
|
2102
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2103
|
+
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2104
|
+
className: "h-9",
|
|
2105
|
+
size: "sm",
|
|
2106
|
+
variant: "default",
|
|
2107
|
+
children: [
|
|
2108
|
+
selectedLabel2,
|
|
2109
|
+
/* @__PURE__ */ jsx17(Badge, {
|
|
2110
|
+
className: "bg-primary-foreground/15 text-primary-foreground min-w-5 justify-center rounded-full border-0 px-1.5 tabular-nums",
|
|
2111
|
+
variant: "secondary",
|
|
2112
|
+
children: rows.length
|
|
2113
|
+
}),
|
|
2114
|
+
/* @__PURE__ */ jsx17(ChevronRight2, {
|
|
2115
|
+
className: "rotate-90"
|
|
2116
|
+
})
|
|
2117
|
+
]
|
|
2118
|
+
})
|
|
2119
|
+
}),
|
|
2120
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2121
|
+
align: "start",
|
|
2122
|
+
className: "w-max max-w-56",
|
|
2123
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2124
|
+
children: [
|
|
2125
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2126
|
+
children: label
|
|
2127
|
+
}),
|
|
2128
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2129
|
+
visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2130
|
+
className: "whitespace-nowrap",
|
|
2131
|
+
onClick: () => action.onClick(rows),
|
|
2132
|
+
...action.variant ? { variant: action.variant } : {},
|
|
2133
|
+
children: [
|
|
2134
|
+
action.icon,
|
|
2135
|
+
action.name
|
|
2136
|
+
]
|
|
2137
|
+
}, action.id ?? action.name))
|
|
2138
|
+
]
|
|
2139
|
+
})
|
|
2140
|
+
})
|
|
2141
|
+
]
|
|
2142
|
+
});
|
|
2143
|
+
};
|
|
1993
2144
|
var buildGroupedSections = (rows, fields, depth = 0, parentKey = "") => {
|
|
1994
2145
|
if (fields.length === 0) {
|
|
1995
2146
|
return [];
|
|
@@ -2027,10 +2178,8 @@ var GroupHeaderRow = ({
|
|
|
2027
2178
|
onToggle,
|
|
2028
2179
|
section
|
|
2029
2180
|
}) => {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
return /* @__PURE__ */ jsx16(TableRow, {
|
|
2033
|
-
children: /* @__PURE__ */ jsx16(TableCell, {
|
|
2181
|
+
return /* @__PURE__ */ jsx17(TableRow, {
|
|
2182
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2034
2183
|
className: "relative p-0",
|
|
2035
2184
|
colSpan,
|
|
2036
2185
|
onClick: onToggle,
|
|
@@ -2040,21 +2189,21 @@ var GroupHeaderRow = ({
|
|
|
2040
2189
|
paddingLeft: `calc(0.5rem + ${section.depth * GROUP_INDENT_PX}px)`
|
|
2041
2190
|
},
|
|
2042
2191
|
children: [
|
|
2043
|
-
collapsed ? /* @__PURE__ */
|
|
2192
|
+
collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
|
|
2044
2193
|
className: "size-4"
|
|
2045
|
-
}) : /* @__PURE__ */
|
|
2194
|
+
}) : /* @__PURE__ */ jsx17(ChevronDown, {
|
|
2046
2195
|
className: "size-4"
|
|
2047
2196
|
}),
|
|
2048
|
-
/* @__PURE__ */
|
|
2197
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2049
2198
|
className: "min-w-0 flex-1 text-left",
|
|
2050
|
-
children:
|
|
2199
|
+
children: getGroupLabels(section)
|
|
2051
2200
|
}),
|
|
2052
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx17(Badge, {
|
|
2053
2202
|
variant: "secondary",
|
|
2054
2203
|
className: "ml-auto",
|
|
2055
2204
|
children: section.rows.length
|
|
2056
2205
|
}),
|
|
2057
|
-
/* @__PURE__ */
|
|
2206
|
+
/* @__PURE__ */ jsx17(DataTableGroupActions, {
|
|
2058
2207
|
actions: section.field.actions,
|
|
2059
2208
|
groupId: section.groupId,
|
|
2060
2209
|
title: section.field.actionsTitle
|
|
@@ -2077,7 +2226,7 @@ var GroupTableSection = ({
|
|
|
2077
2226
|
groupId: section.groupId
|
|
2078
2227
|
}
|
|
2079
2228
|
});
|
|
2080
|
-
return /* @__PURE__ */
|
|
2229
|
+
return /* @__PURE__ */ jsx17(TableBody, {
|
|
2081
2230
|
className: cn("relative px-2", isOver && "ring-primary ring-1 ring-inset"),
|
|
2082
2231
|
ref: setNodeRef,
|
|
2083
2232
|
children
|
|
@@ -2097,8 +2246,6 @@ var GroupHeaderCard = ({
|
|
|
2097
2246
|
groupId: section.groupId
|
|
2098
2247
|
}
|
|
2099
2248
|
});
|
|
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
2249
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2103
2250
|
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
2251
|
ref: setNodeRef,
|
|
@@ -2108,23 +2255,23 @@ var GroupHeaderCard = ({
|
|
|
2108
2255
|
onClick: onToggle,
|
|
2109
2256
|
type: "button",
|
|
2110
2257
|
children: [
|
|
2111
|
-
collapsed ? /* @__PURE__ */
|
|
2258
|
+
collapsed ? /* @__PURE__ */ jsx17(ChevronRight2, {
|
|
2112
2259
|
className: "size-4"
|
|
2113
|
-
}) : /* @__PURE__ */
|
|
2260
|
+
}) : /* @__PURE__ */ jsx17(ChevronDown, {
|
|
2114
2261
|
className: "size-4"
|
|
2115
2262
|
}),
|
|
2116
|
-
/* @__PURE__ */
|
|
2263
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2117
2264
|
className: "min-w-0 flex-1",
|
|
2118
|
-
children:
|
|
2265
|
+
children: getGroupLabels(section)
|
|
2119
2266
|
}),
|
|
2120
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ jsx17(Badge, {
|
|
2121
2268
|
variant: "secondary",
|
|
2122
2269
|
className: "ml-auto",
|
|
2123
2270
|
children: section.rows.length
|
|
2124
2271
|
})
|
|
2125
2272
|
]
|
|
2126
2273
|
}),
|
|
2127
|
-
/* @__PURE__ */
|
|
2274
|
+
/* @__PURE__ */ jsx17(DataTableGroupActions, {
|
|
2128
2275
|
actions: section.field.actions,
|
|
2129
2276
|
groupId: section.groupId,
|
|
2130
2277
|
title: section.field.actionsTitle
|
|
@@ -2142,30 +2289,30 @@ var DataTableGroupActions = ({
|
|
|
2142
2289
|
return null;
|
|
2143
2290
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2144
2291
|
children: [
|
|
2145
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2146
2293
|
onClick: (event) => event.stopPropagation(),
|
|
2147
2294
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2148
2295
|
className: "size-7 shadow-md [&_svg:not([class*='size-'])]:size-3.5",
|
|
2149
2296
|
size: "icon",
|
|
2150
2297
|
variant: "ghost",
|
|
2151
2298
|
children: [
|
|
2152
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2153
2300
|
className: "sr-only",
|
|
2154
2301
|
children: title
|
|
2155
2302
|
}),
|
|
2156
|
-
/* @__PURE__ */
|
|
2303
|
+
/* @__PURE__ */ jsx17(MoreHorizontal, {})
|
|
2157
2304
|
]
|
|
2158
2305
|
})
|
|
2159
2306
|
}),
|
|
2160
|
-
/* @__PURE__ */
|
|
2307
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2161
2308
|
align: "end",
|
|
2162
2309
|
className: "w-max",
|
|
2163
2310
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2164
2311
|
children: [
|
|
2165
|
-
/* @__PURE__ */
|
|
2312
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2166
2313
|
children: title
|
|
2167
2314
|
}),
|
|
2168
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2169
2316
|
visibleActions.map((action) => /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2170
2317
|
className: "whitespace-nowrap",
|
|
2171
2318
|
onClick: (event) => {
|
|
@@ -2193,7 +2340,10 @@ var DataTableRow = ({
|
|
|
2193
2340
|
onRowClick,
|
|
2194
2341
|
row,
|
|
2195
2342
|
rowActions,
|
|
2196
|
-
rowActionsLabel
|
|
2343
|
+
rowActionsLabel,
|
|
2344
|
+
selectRowLabel,
|
|
2345
|
+
selectable,
|
|
2346
|
+
table
|
|
2197
2347
|
}) => {
|
|
2198
2348
|
const sortable = useSortable({
|
|
2199
2349
|
id: getSortableRowId(row.id),
|
|
@@ -2209,7 +2359,7 @@ var DataTableRow = ({
|
|
|
2209
2359
|
disabled: !canDrag || canReorder,
|
|
2210
2360
|
data: {
|
|
2211
2361
|
type: "row",
|
|
2212
|
-
|
|
2362
|
+
rowId: row.id,
|
|
2213
2363
|
label: dragLabel
|
|
2214
2364
|
}
|
|
2215
2365
|
});
|
|
@@ -2222,7 +2372,7 @@ var DataTableRow = ({
|
|
|
2222
2372
|
const rowAttributes = canReorder ? onRowClick ? { role: "button", tabIndex: 0 } : {} : onRowClick ? { ...attributes, role: "button", tabIndex: 0 } : attributes;
|
|
2223
2373
|
const visibleCells = row.getVisibleCells();
|
|
2224
2374
|
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"),
|
|
2375
|
+
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
2376
|
"data-state": row.getIsSelected() && "selected",
|
|
2227
2377
|
onClick: () => {
|
|
2228
2378
|
if (onRowClick) {
|
|
@@ -2244,9 +2394,23 @@ var DataTableRow = ({
|
|
|
2244
2394
|
...rowAttributes,
|
|
2245
2395
|
...!canReorder ? listeners : {},
|
|
2246
2396
|
children: [
|
|
2247
|
-
|
|
2397
|
+
selectable ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2398
|
+
className: "w-10 min-w-10 cursor-default pr-0",
|
|
2399
|
+
onClick: (event) => event.stopPropagation(),
|
|
2400
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2401
|
+
"aria-label": selectRowLabel,
|
|
2402
|
+
checked: row.getIsSelected(),
|
|
2403
|
+
disabled: !row.getCanSelect(),
|
|
2404
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2405
|
+
nativeEvent: eventDetails.event,
|
|
2406
|
+
target: { checked }
|
|
2407
|
+
}),
|
|
2408
|
+
onClick: (event) => event.stopPropagation()
|
|
2409
|
+
})
|
|
2410
|
+
}) : null,
|
|
2411
|
+
canReorder ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2248
2412
|
className: "w-10 min-w-10 pr-0",
|
|
2249
|
-
children: /* @__PURE__ */
|
|
2413
|
+
children: /* @__PURE__ */ jsx17(Button, {
|
|
2250
2414
|
"aria-label": reorderHandleLabel,
|
|
2251
2415
|
className: "size-8 cursor-grab active:cursor-grabbing",
|
|
2252
2416
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -2255,28 +2419,31 @@ var DataTableRow = ({
|
|
|
2255
2419
|
variant: "ghost",
|
|
2256
2420
|
...attributes,
|
|
2257
2421
|
...listeners,
|
|
2258
|
-
children: /* @__PURE__ */
|
|
2422
|
+
children: /* @__PURE__ */ jsx17(GripVertical, {})
|
|
2259
2423
|
})
|
|
2260
2424
|
}) : null,
|
|
2261
2425
|
visibleCells.map((cell, index) => {
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2426
|
+
return /* @__PURE__ */ jsx17(table.AppCell, {
|
|
2427
|
+
cell,
|
|
2428
|
+
children: (appCell) => /* @__PURE__ */ jsx17(TableCell, {
|
|
2429
|
+
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"),
|
|
2430
|
+
style: index === 0 && firstCellIndent ? {
|
|
2431
|
+
paddingLeft: firstCellIndent,
|
|
2432
|
+
width: cell.column.getSize()
|
|
2433
|
+
} : { width: cell.column.getSize() },
|
|
2434
|
+
children: /* @__PURE__ */ jsx17("div", {
|
|
2435
|
+
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"),
|
|
2436
|
+
children: /* @__PURE__ */ jsx17(appCell.FlexRender, {})
|
|
2437
|
+
})
|
|
2272
2438
|
})
|
|
2273
2439
|
}, cell.id);
|
|
2274
2440
|
}),
|
|
2275
|
-
rowActions ? /* @__PURE__ */
|
|
2276
|
-
className: "sticky right-0 z-20 w-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2441
|
+
rowActions ? /* @__PURE__ */ jsx17(TableCell, {
|
|
2442
|
+
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))]",
|
|
2443
|
+
onClick: (event) => event.stopPropagation(),
|
|
2444
|
+
children: /* @__PURE__ */ jsx17("div", {
|
|
2445
|
+
className: "flex h-16 items-center justify-center",
|
|
2446
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2280
2447
|
actions: rowActions,
|
|
2281
2448
|
row: row.original,
|
|
2282
2449
|
title: rowActionsLabel
|
|
@@ -2294,6 +2461,8 @@ var DataTableGalleryCard = ({
|
|
|
2294
2461
|
row,
|
|
2295
2462
|
rowActions,
|
|
2296
2463
|
rowActionsLabel,
|
|
2464
|
+
selectRowLabel,
|
|
2465
|
+
selectable,
|
|
2297
2466
|
table
|
|
2298
2467
|
}) => {
|
|
2299
2468
|
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
|
@@ -2301,7 +2470,7 @@ var DataTableGalleryCard = ({
|
|
|
2301
2470
|
disabled: !canDrag,
|
|
2302
2471
|
data: {
|
|
2303
2472
|
type: "row",
|
|
2304
|
-
|
|
2473
|
+
rowId: row.id,
|
|
2305
2474
|
label: dragLabel
|
|
2306
2475
|
}
|
|
2307
2476
|
});
|
|
@@ -2323,17 +2492,30 @@ var DataTableGalleryCard = ({
|
|
|
2323
2492
|
...attributes,
|
|
2324
2493
|
...listeners,
|
|
2325
2494
|
children: [
|
|
2326
|
-
|
|
2495
|
+
selectable ? /* @__PURE__ */ jsx17("div", {
|
|
2496
|
+
className: "absolute top-4 left-4 z-10",
|
|
2497
|
+
onClick: (event) => event.stopPropagation(),
|
|
2498
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2499
|
+
"aria-label": selectRowLabel,
|
|
2500
|
+
checked: row.getIsSelected(),
|
|
2501
|
+
disabled: !row.getCanSelect(),
|
|
2502
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2503
|
+
nativeEvent: eventDetails.event,
|
|
2504
|
+
target: { checked }
|
|
2505
|
+
})
|
|
2506
|
+
})
|
|
2507
|
+
}) : null,
|
|
2508
|
+
rowActions ? /* @__PURE__ */ jsx17("div", {
|
|
2327
2509
|
className: "absolute top-4 right-4 z-10",
|
|
2328
2510
|
onClick: (event) => event.stopPropagation(),
|
|
2329
|
-
children: /* @__PURE__ */
|
|
2511
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2330
2512
|
actions: rowActions,
|
|
2331
2513
|
row: row.original,
|
|
2332
2514
|
title: rowActionsLabel
|
|
2333
2515
|
})
|
|
2334
2516
|
}) : null,
|
|
2335
2517
|
/* @__PURE__ */ jsxs8(CardHeader, {
|
|
2336
|
-
className: cn(rowActions && "pr-14"),
|
|
2518
|
+
className: cn(rowActions && "pr-14", selectable && "pl-12"),
|
|
2337
2519
|
children: [
|
|
2338
2520
|
tagCell && tagLabel ? /* @__PURE__ */ jsxs8(Badge, {
|
|
2339
2521
|
variant: "secondary",
|
|
@@ -2343,11 +2525,11 @@ var DataTableGalleryCard = ({
|
|
|
2343
2525
|
tagLabel
|
|
2344
2526
|
]
|
|
2345
2527
|
}) : null,
|
|
2346
|
-
nameCell ? /* @__PURE__ */
|
|
2528
|
+
nameCell ? /* @__PURE__ */ jsx17(CardTitle, {
|
|
2347
2529
|
className: "min-w-0 text-base",
|
|
2348
2530
|
children: flexRender(nameCell.column.columnDef.cell, nameCell.getContext())
|
|
2349
2531
|
}) : null,
|
|
2350
|
-
descriptionCell ? /* @__PURE__ */
|
|
2532
|
+
descriptionCell ? /* @__PURE__ */ jsx17(CardDescription, {
|
|
2351
2533
|
className: "line-clamp-2 min-w-0",
|
|
2352
2534
|
children: flexRender(descriptionCell.column.columnDef.cell, descriptionCell.getContext())
|
|
2353
2535
|
}) : null
|
|
@@ -2358,7 +2540,7 @@ var DataTableGalleryCard = ({
|
|
|
2358
2540
|
}
|
|
2359
2541
|
const contentCells = row.getVisibleCells();
|
|
2360
2542
|
return /* @__PURE__ */ jsxs8(Card, {
|
|
2361
|
-
className: cn("gap-3 transition-colors", onRowClick && "cursor-pointer hover:bg-accent/20", isDragging && "opacity-50"),
|
|
2543
|
+
className: cn("relative gap-3 transition-colors", onRowClick && "cursor-pointer hover:bg-accent/20", isDragging && "opacity-50"),
|
|
2362
2544
|
"data-state": row.getIsSelected() && "selected",
|
|
2363
2545
|
onClick: () => {
|
|
2364
2546
|
if (onRowClick) {
|
|
@@ -2369,11 +2551,24 @@ var DataTableGalleryCard = ({
|
|
|
2369
2551
|
...attributes,
|
|
2370
2552
|
...listeners,
|
|
2371
2553
|
children: [
|
|
2554
|
+
selectable ? /* @__PURE__ */ jsx17("div", {
|
|
2555
|
+
className: "absolute top-4 left-4 z-10",
|
|
2556
|
+
onClick: (event) => event.stopPropagation(),
|
|
2557
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
2558
|
+
"aria-label": selectRowLabel,
|
|
2559
|
+
checked: row.getIsSelected(),
|
|
2560
|
+
disabled: !row.getCanSelect(),
|
|
2561
|
+
onCheckedChange: (checked, eventDetails) => row.getToggleSelectedHandler()({
|
|
2562
|
+
nativeEvent: eventDetails.event,
|
|
2563
|
+
target: { checked }
|
|
2564
|
+
})
|
|
2565
|
+
})
|
|
2566
|
+
}) : null,
|
|
2372
2567
|
/* @__PURE__ */ jsxs8(CardHeader, {
|
|
2373
2568
|
children: [
|
|
2374
|
-
rowActions ? /* @__PURE__ */
|
|
2569
|
+
rowActions ? /* @__PURE__ */ jsx17(CardAction, {
|
|
2375
2570
|
onClick: (event) => event.stopPropagation(),
|
|
2376
|
-
children: /* @__PURE__ */
|
|
2571
|
+
children: /* @__PURE__ */ jsx17(DataTableRowActions, {
|
|
2377
2572
|
actions: rowActions,
|
|
2378
2573
|
row: row.original,
|
|
2379
2574
|
title: rowActionsLabel
|
|
@@ -2382,11 +2577,11 @@ var DataTableGalleryCard = ({
|
|
|
2382
2577
|
contentCells.length > 0 && /* @__PURE__ */ jsxs8("div", {
|
|
2383
2578
|
className: "grid min-w-0 gap-3",
|
|
2384
2579
|
children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2580
|
+
/* @__PURE__ */ jsx17(CardDescription, {
|
|
2386
2581
|
className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
|
|
2387
2582
|
children: getColumnDisplayName(table, contentCells[0].column.id)
|
|
2388
2583
|
}),
|
|
2389
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx17(CardTitle, {
|
|
2390
2585
|
className: "text-base",
|
|
2391
2586
|
children: flexRender(contentCells[0].column.columnDef.cell, contentCells[0].getContext())
|
|
2392
2587
|
})
|
|
@@ -2394,16 +2589,16 @@ var DataTableGalleryCard = ({
|
|
|
2394
2589
|
})
|
|
2395
2590
|
]
|
|
2396
2591
|
}),
|
|
2397
|
-
contentCells.length > 1 && /* @__PURE__ */
|
|
2592
|
+
contentCells.length > 1 && /* @__PURE__ */ jsx17(CardContent, {
|
|
2398
2593
|
className: "grid gap-3",
|
|
2399
2594
|
children: contentCells.slice(1).map((cell) => /* @__PURE__ */ jsxs8("div", {
|
|
2400
2595
|
className: "grid gap-1",
|
|
2401
2596
|
children: [
|
|
2402
|
-
/* @__PURE__ */
|
|
2597
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2403
2598
|
className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
|
|
2404
2599
|
children: getColumnDisplayName(table, cell.column.id)
|
|
2405
2600
|
}),
|
|
2406
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2407
2602
|
className: "min-w-0 text-sm",
|
|
2408
2603
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2409
2604
|
})
|
|
@@ -2418,15 +2613,15 @@ var extractTextFromElement = (element) => {
|
|
|
2418
2613
|
return element;
|
|
2419
2614
|
if (typeof element === "number")
|
|
2420
2615
|
return String(element);
|
|
2421
|
-
if (!element
|
|
2422
|
-
return null;
|
|
2423
|
-
const props = element.props;
|
|
2424
|
-
if (!props)
|
|
2616
|
+
if (!isValidElement(element)) {
|
|
2425
2617
|
return null;
|
|
2618
|
+
}
|
|
2619
|
+
const { props } = element;
|
|
2426
2620
|
if (typeof props.title === "string")
|
|
2427
2621
|
return props.title;
|
|
2428
2622
|
return extractTextFromElement(props.children);
|
|
2429
2623
|
};
|
|
2624
|
+
var getColumnLabels = (table) => new Map(table.getFlatHeaders().map((header) => [header.column.id, getHeaderName(header)]));
|
|
2430
2625
|
var getHeaderName = (header) => {
|
|
2431
2626
|
const columnDef = header.column.columnDef;
|
|
2432
2627
|
if (typeof columnDef.header === "function") {
|
|
@@ -2443,15 +2638,6 @@ var getColumnDisplayName = (table, columnId) => {
|
|
|
2443
2638
|
const header = table.getFlatHeaders().find((currentHeader) => currentHeader.column.id === columnId);
|
|
2444
2639
|
return header ? getHeaderName(header) : columnId;
|
|
2445
2640
|
};
|
|
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
2641
|
var withFileExtension = (fileName, extension) => {
|
|
2456
2642
|
const normalizedExtension = extension.startsWith(".") ? extension : `.${extension}`;
|
|
2457
2643
|
return fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, normalizedExtension) : `${fileName}${normalizedExtension}`;
|
|
@@ -2507,6 +2693,199 @@ var exportTableToJson = (table, rows, fileName = "data.json") => {
|
|
|
2507
2693
|
const data = rows.map((row) => Object.fromEntries(exportableColumns.map((column) => [column.id, row.getValue(column.id)])));
|
|
2508
2694
|
downloadJson(data, fileName);
|
|
2509
2695
|
};
|
|
2696
|
+
var DataTableToolbar = ({
|
|
2697
|
+
activeGrouping,
|
|
2698
|
+
bulkActions,
|
|
2699
|
+
exportBaseName,
|
|
2700
|
+
exportRows,
|
|
2701
|
+
grouping,
|
|
2702
|
+
labels: labels2,
|
|
2703
|
+
onRefresh,
|
|
2704
|
+
onToggleGrouping,
|
|
2705
|
+
onViewChange,
|
|
2706
|
+
selectedRows,
|
|
2707
|
+
showColumnVisibility,
|
|
2708
|
+
showExport,
|
|
2709
|
+
showGallery,
|
|
2710
|
+
showSearch,
|
|
2711
|
+
showSorting,
|
|
2712
|
+
table,
|
|
2713
|
+
view
|
|
2714
|
+
}) => {
|
|
2715
|
+
const [refreshSpinCount, setRefreshSpinCount] = useState(0);
|
|
2716
|
+
const [searchInput, setSearchInput] = useState(table.state.globalFilter);
|
|
2717
|
+
const hasToolbar = Boolean(showSearch || grouping?.fields.length || showSorting || showGallery || showColumnVisibility || onRefresh || showExport || selectedRows.length > 0 && bulkActions?.items.length);
|
|
2718
|
+
useEffect2(() => {
|
|
2719
|
+
setSearchInput(table.state.globalFilter);
|
|
2720
|
+
}, [table.state.globalFilter]);
|
|
2721
|
+
if (!hasToolbar)
|
|
2722
|
+
return null;
|
|
2723
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
2724
|
+
className: "flex flex-col gap-3 pb-4",
|
|
2725
|
+
children: /* @__PURE__ */ jsxs8("div", {
|
|
2726
|
+
className: "flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",
|
|
2727
|
+
children: [
|
|
2728
|
+
showSearch ? /* @__PURE__ */ jsxs8("div", {
|
|
2729
|
+
className: "relative w-full min-w-0 flex-1 sm:min-w-sm",
|
|
2730
|
+
children: [
|
|
2731
|
+
/* @__PURE__ */ jsx17(Search, {
|
|
2732
|
+
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
2733
|
+
}),
|
|
2734
|
+
/* @__PURE__ */ jsx17(Input, {
|
|
2735
|
+
className: "px-9",
|
|
2736
|
+
onChange: (event) => {
|
|
2737
|
+
setSearchInput(event.target.value);
|
|
2738
|
+
table.setGlobalFilter(event.target.value);
|
|
2739
|
+
},
|
|
2740
|
+
placeholder: labels2.filter,
|
|
2741
|
+
value: searchInput
|
|
2742
|
+
}),
|
|
2743
|
+
searchInput ? /* @__PURE__ */ jsx17(Button, {
|
|
2744
|
+
"aria-label": labels2.filter,
|
|
2745
|
+
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-1 size-7 -translate-y-1/2 active:!-translate-y-1/2",
|
|
2746
|
+
onClick: () => {
|
|
2747
|
+
setSearchInput("");
|
|
2748
|
+
table.setGlobalFilter("");
|
|
2749
|
+
},
|
|
2750
|
+
size: "icon",
|
|
2751
|
+
type: "button",
|
|
2752
|
+
variant: "ghost",
|
|
2753
|
+
children: /* @__PURE__ */ jsx17(X2, {
|
|
2754
|
+
className: "size-4"
|
|
2755
|
+
})
|
|
2756
|
+
}) : null
|
|
2757
|
+
]
|
|
2758
|
+
}) : /* @__PURE__ */ jsx17("div", {}),
|
|
2759
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
2760
|
+
className: "-m-1 flex items-center gap-2 overflow-x-auto p-1",
|
|
2761
|
+
children: [
|
|
2762
|
+
bulkActions && selectedRows.length > 0 ? /* @__PURE__ */ jsx17(DataTableBulkActions, {
|
|
2763
|
+
actions: bulkActions.items,
|
|
2764
|
+
label: bulkActions.label ?? labels2.actions,
|
|
2765
|
+
rows: selectedRows,
|
|
2766
|
+
selectedLabel: labels2.selected
|
|
2767
|
+
}) : null,
|
|
2768
|
+
grouping?.fields.length ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2769
|
+
children: [
|
|
2770
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2771
|
+
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2772
|
+
"aria-label": labels2.groupBy,
|
|
2773
|
+
className: "h-9",
|
|
2774
|
+
size: "sm",
|
|
2775
|
+
variant: "outline",
|
|
2776
|
+
children: [
|
|
2777
|
+
/* @__PURE__ */ jsx17(Rows3, {}),
|
|
2778
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2779
|
+
className: "hidden sm:inline",
|
|
2780
|
+
children: labels2.groupBy
|
|
2781
|
+
})
|
|
2782
|
+
]
|
|
2783
|
+
})
|
|
2784
|
+
}),
|
|
2785
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2786
|
+
align: "end",
|
|
2787
|
+
className: "w-[200px]",
|
|
2788
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2789
|
+
children: [
|
|
2790
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2791
|
+
children: labels2.groupBy
|
|
2792
|
+
}),
|
|
2793
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2794
|
+
grouping.fields.map((field) => /* @__PURE__ */ jsx17(DropdownMenuCheckboxItem, {
|
|
2795
|
+
checked: activeGrouping.includes(field.id),
|
|
2796
|
+
onCheckedChange: (value) => onToggleGrouping(field.id, !!value),
|
|
2797
|
+
children: field.label
|
|
2798
|
+
}, field.id))
|
|
2799
|
+
]
|
|
2800
|
+
})
|
|
2801
|
+
})
|
|
2802
|
+
]
|
|
2803
|
+
}) : null,
|
|
2804
|
+
showSorting ? /* @__PURE__ */ jsx17(DataTableSortDropdown, {
|
|
2805
|
+
messages: labels2,
|
|
2806
|
+
table
|
|
2807
|
+
}) : null,
|
|
2808
|
+
showGallery ? /* @__PURE__ */ jsx17(DataTableDisplayModeSwitch, {
|
|
2809
|
+
messages: labels2,
|
|
2810
|
+
onChange: onViewChange,
|
|
2811
|
+
value: view
|
|
2812
|
+
}) : null,
|
|
2813
|
+
showColumnVisibility ? /* @__PURE__ */ jsx17(DataTableViewOptions, {
|
|
2814
|
+
messages: labels2,
|
|
2815
|
+
table
|
|
2816
|
+
}) : null,
|
|
2817
|
+
onRefresh ? /* @__PURE__ */ jsxs8(Button, {
|
|
2818
|
+
"aria-label": labels2.refresh,
|
|
2819
|
+
className: "h-9",
|
|
2820
|
+
onClick: () => {
|
|
2821
|
+
setRefreshSpinCount((count) => count + 1);
|
|
2822
|
+
onRefresh();
|
|
2823
|
+
},
|
|
2824
|
+
size: "sm",
|
|
2825
|
+
type: "button",
|
|
2826
|
+
variant: "outline",
|
|
2827
|
+
children: [
|
|
2828
|
+
/* @__PURE__ */ jsx17(RefreshCw, {
|
|
2829
|
+
className: cn(refreshSpinCount > 0 && "animate-[spin_500ms_ease-in-out_1]")
|
|
2830
|
+
}, refreshSpinCount),
|
|
2831
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2832
|
+
className: "hidden sm:inline",
|
|
2833
|
+
children: labels2.refresh
|
|
2834
|
+
})
|
|
2835
|
+
]
|
|
2836
|
+
}) : null,
|
|
2837
|
+
showExport ? /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
2838
|
+
children: [
|
|
2839
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
2840
|
+
render: /* @__PURE__ */ jsxs8(Button, {
|
|
2841
|
+
"aria-label": labels2.export,
|
|
2842
|
+
className: "h-9",
|
|
2843
|
+
disabled: exportRows.length === 0,
|
|
2844
|
+
size: "sm",
|
|
2845
|
+
variant: "outline",
|
|
2846
|
+
children: [
|
|
2847
|
+
/* @__PURE__ */ jsx17(Download, {}),
|
|
2848
|
+
/* @__PURE__ */ jsx17("span", {
|
|
2849
|
+
className: "hidden sm:inline",
|
|
2850
|
+
children: labels2.export
|
|
2851
|
+
})
|
|
2852
|
+
]
|
|
2853
|
+
})
|
|
2854
|
+
}),
|
|
2855
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
2856
|
+
align: "end",
|
|
2857
|
+
className: "w-[180px]",
|
|
2858
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
2859
|
+
children: [
|
|
2860
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
2861
|
+
children: labels2.export
|
|
2862
|
+
}),
|
|
2863
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2864
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2865
|
+
onClick: () => exportTableToCsv(table, exportRows, exportBaseName),
|
|
2866
|
+
children: [
|
|
2867
|
+
/* @__PURE__ */ jsx17(FileText, {}),
|
|
2868
|
+
labels2.exportCsv
|
|
2869
|
+
]
|
|
2870
|
+
}),
|
|
2871
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
2872
|
+
onClick: () => exportTableToJson(table, exportRows, exportBaseName),
|
|
2873
|
+
children: [
|
|
2874
|
+
/* @__PURE__ */ jsx17(FileJson, {}),
|
|
2875
|
+
labels2.exportJson
|
|
2876
|
+
]
|
|
2877
|
+
})
|
|
2878
|
+
]
|
|
2879
|
+
})
|
|
2880
|
+
})
|
|
2881
|
+
]
|
|
2882
|
+
}) : null
|
|
2883
|
+
]
|
|
2884
|
+
})
|
|
2885
|
+
]
|
|
2886
|
+
})
|
|
2887
|
+
});
|
|
2888
|
+
};
|
|
2510
2889
|
function DataTable({
|
|
2511
2890
|
columns,
|
|
2512
2891
|
data,
|
|
@@ -2548,17 +2927,20 @@ function DataTable({
|
|
|
2548
2927
|
const pageSizes = paginationFeature ? paginationFeature.pageSizes : undefined;
|
|
2549
2928
|
const showSearch = features?.search ?? true;
|
|
2550
2929
|
const showExport = exportFeature !== false;
|
|
2551
|
-
const
|
|
2552
|
-
const showColumnVisibility =
|
|
2553
|
-
const defaultColumnVisibility = typeof
|
|
2930
|
+
const columnVisibilityFeature2 = features?.columnVisibility ?? true;
|
|
2931
|
+
const showColumnVisibility = columnVisibilityFeature2 !== false;
|
|
2932
|
+
const defaultColumnVisibility = typeof columnVisibilityFeature2 === "object" ? columnVisibilityFeature2.default : undefined;
|
|
2554
2933
|
const showGallery = !!galleryConfig;
|
|
2555
2934
|
const showSorting = features?.sorting ?? true;
|
|
2935
|
+
const selectionFeature = features?.selection === false ? undefined : features?.selection;
|
|
2936
|
+
const selectable = !!selectionFeature;
|
|
2937
|
+
const bulkActions = selectionFeature?.bulkActions === false ? undefined : selectionFeature?.bulkActions;
|
|
2556
2938
|
const isServerMode = paginationFeature !== false && paginationFeature.mode === "server";
|
|
2557
2939
|
const serverRowCount = isServerMode ? paginationFeature.rowCount : undefined;
|
|
2558
2940
|
const location = useRouterState({
|
|
2559
2941
|
select: (state2) => state2.location
|
|
2560
2942
|
});
|
|
2561
|
-
const search = location.search;
|
|
2943
|
+
const search = Option2.getOrUndefined(decodeTableSearch(location.search));
|
|
2562
2944
|
const pathname = location.pathname;
|
|
2563
2945
|
const resolvedRouteFrom = routeFrom ?? from;
|
|
2564
2946
|
const [storagePath] = useState(() => resolvedRouteFrom ?? pathname);
|
|
@@ -2615,12 +2997,9 @@ function DataTable({
|
|
|
2615
2997
|
const [storedView, setStoredView] = useAtom(viewAtom);
|
|
2616
2998
|
const currentView = showGallery ? storedView : "table";
|
|
2617
2999
|
const isGalleryView = currentView === "gallery";
|
|
2618
|
-
const hasToolbar = Boolean(showSearch || grouping?.fields.length || showSorting || showGallery || showColumnVisibility || onRefresh || showExport);
|
|
2619
3000
|
const [rowSelection, setRowSelection] = useState({});
|
|
2620
3001
|
const [collapsedGroups, setCollapsedGroups] = useState({});
|
|
2621
3002
|
const [activeDragLabel, setActiveDragLabel] = useState(null);
|
|
2622
|
-
const [refreshSpinCount, setRefreshSpinCount] = useState(0);
|
|
2623
|
-
const [searchInput, setSearchInput] = useState(globalFilter);
|
|
2624
3003
|
const availableGroupFieldIds = grouping?.fields.map((field) => field.id) ?? [];
|
|
2625
3004
|
const activeGrouping = urlGrouping?.filter((groupId) => availableGroupFieldIds.includes(groupId)) ?? getDefaultGrouping(grouping);
|
|
2626
3005
|
const sensors = useSensors(useSensor(PointerSensor, {
|
|
@@ -2630,7 +3009,7 @@ function DataTable({
|
|
|
2630
3009
|
}));
|
|
2631
3010
|
const updateTableSearch = (updater, options) => {
|
|
2632
3011
|
if (controlledSearch || onSearchChange || searchState === "local") {
|
|
2633
|
-
const nextSearch = updater(controlledSearch ?? localSearch
|
|
3012
|
+
const nextSearch = Schema2.decodeUnknownSync(TableSearchSchema)(updater(controlledSearch ?? localSearch));
|
|
2634
3013
|
if (onSearchChange) {
|
|
2635
3014
|
onSearchChange(nextSearch);
|
|
2636
3015
|
} else {
|
|
@@ -2642,24 +3021,20 @@ function DataTable({
|
|
|
2642
3021
|
to: ".",
|
|
2643
3022
|
replace: options?.replace ?? false,
|
|
2644
3023
|
resetScroll: false,
|
|
2645
|
-
search: (current) => updater(current
|
|
3024
|
+
search: (current) => validateTableSearchUpdate(updater(current))
|
|
2646
3025
|
});
|
|
2647
3026
|
};
|
|
2648
|
-
const table =
|
|
3027
|
+
const table = useDataTable({
|
|
3028
|
+
key: tableStorageId,
|
|
2649
3029
|
data,
|
|
2650
3030
|
columns,
|
|
2651
|
-
defaultColumn: {
|
|
2652
|
-
minSize: 128,
|
|
2653
|
-
size: 224,
|
|
2654
|
-
maxSize: 640
|
|
2655
|
-
},
|
|
2656
|
-
columnResizeMode: "onChange",
|
|
2657
|
-
enableColumnResizing: true,
|
|
2658
3031
|
onColumnSizingChange: (updater) => {
|
|
2659
3032
|
const nextColumnSizing = typeof updater === "function" ? updater(columnSizing) : updater;
|
|
2660
3033
|
setColumnSizing(nextColumnSizing);
|
|
2661
3034
|
},
|
|
2662
|
-
...reordering ? { getRowId: reordering.getRowId } : {},
|
|
3035
|
+
...selectionFeature ? { getRowId: selectionFeature.getRowId } : reordering ? { getRowId: reordering.getRowId } : {},
|
|
3036
|
+
enableRowSelection: selectionFeature?.isRowSelectable ? (row) => selectionFeature.isRowSelectable?.(row.original) ?? true : selectable,
|
|
3037
|
+
enableMultiRowSelection: selectable,
|
|
2663
3038
|
onPaginationChange: (updater) => {
|
|
2664
3039
|
const newPagination = typeof updater === "function" ? updater(pagination) : updater;
|
|
2665
3040
|
if (pagination.pageIndex === newPagination.pageIndex && pagination.pageSize === newPagination.pageSize) {
|
|
@@ -2686,7 +3061,6 @@ function DataTable({
|
|
|
2686
3061
|
page: 0
|
|
2687
3062
|
}));
|
|
2688
3063
|
},
|
|
2689
|
-
getCoreRowModel: getCoreRowModel(),
|
|
2690
3064
|
onGlobalFilterChange: (updater) => {
|
|
2691
3065
|
const newGlobalFilter = typeof updater === "function" ? updater(globalFilter) : updater;
|
|
2692
3066
|
if (globalFilter === newGlobalFilter) {
|
|
@@ -2699,16 +3073,20 @@ function DataTable({
|
|
|
2699
3073
|
}), { replace: true });
|
|
2700
3074
|
},
|
|
2701
3075
|
...isServerMode ? { manualSorting: true } : {},
|
|
2702
|
-
...!isServerMode ? { getSortedRowModel: getSortedRowModel() } : {},
|
|
2703
3076
|
...isServerMode ? { manualFiltering: true } : {},
|
|
2704
|
-
|
|
2705
|
-
...paginationFeature !== false && paginationFeature.mode === "server" ? { manualPagination: true, rowCount: paginationFeature.rowCount } : paginationFeature === false ? {} : { getPaginationRowModel: getPaginationRowModel() },
|
|
3077
|
+
...paginationFeature !== false && paginationFeature.mode === "server" ? { manualPagination: true, rowCount: paginationFeature.rowCount } : paginationFeature === false ? { manualPagination: true } : {},
|
|
2706
3078
|
autoResetPageIndex: false,
|
|
2707
3079
|
onColumnVisibilityChange: (updater) => {
|
|
2708
3080
|
const nextColumnVisibility = typeof updater === "function" ? updater(columnVisibility) : updater;
|
|
2709
3081
|
setColumnVisibility(nextColumnVisibility);
|
|
2710
3082
|
},
|
|
2711
|
-
onRowSelectionChange:
|
|
3083
|
+
onRowSelectionChange: (updater) => {
|
|
3084
|
+
setRowSelection((current) => {
|
|
3085
|
+
const next = typeof updater === "function" ? updater(current) : updater;
|
|
3086
|
+
selectionFeature?.onSelectionChange?.(data.filter((row) => next[selectionFeature.getRowId(row)]));
|
|
3087
|
+
return next;
|
|
3088
|
+
});
|
|
3089
|
+
},
|
|
2712
3090
|
state: {
|
|
2713
3091
|
sorting,
|
|
2714
3092
|
pagination,
|
|
@@ -2718,20 +3096,17 @@ function DataTable({
|
|
|
2718
3096
|
rowSelection
|
|
2719
3097
|
}
|
|
2720
3098
|
});
|
|
2721
|
-
useEffect2(() => {
|
|
2722
|
-
setSearchInput(globalFilter);
|
|
2723
|
-
}, [globalFilter]);
|
|
2724
3099
|
const activeGroupingFields = useMemo(() => activeGrouping.map((groupId) => grouping?.fields.find((field) => field.id === groupId)).filter((field) => !!field), [activeGrouping, grouping]);
|
|
2725
3100
|
const hasActiveGrouping = activeGroupingFields.length > 0;
|
|
2726
|
-
const filteredRows = table.
|
|
3101
|
+
const filteredRows = table.getPrePaginatedRowModel().rows;
|
|
3102
|
+
const selectedRows = selectionFeature ? data.filter((row) => rowSelection[selectionFeature.getRowId(row)]) : [];
|
|
2727
3103
|
const exportRows = exportFeature && exportFeature.scope === "filteredRows" ? filteredRows : table.getRowModel().rows;
|
|
2728
3104
|
const bodyRows = hasActiveGrouping ? filteredRows : table.getRowModel().rows;
|
|
2729
3105
|
const sortableRowIds = bodyRows.map((row) => getSortableRowId(row.id));
|
|
2730
3106
|
const groupedSections = useMemo(() => buildGroupedSections(bodyRows, activeGroupingFields), [activeGroupingFields, bodyRows]);
|
|
2731
3107
|
const canReorderRows = Boolean(reordering) && !hasActiveGrouping;
|
|
2732
|
-
const colSpan = Math.max(table.getVisibleLeafColumns().length, 1) + (rowActions ? 1 : 0) + (canReorderRows ? 1 : 0);
|
|
3108
|
+
const colSpan = Math.max(table.getVisibleLeafColumns().length, 1) + (rowActions ? 1 : 0) + (selectable ? 1 : 0) + (canReorderRows ? 1 : 0);
|
|
2733
3109
|
const canDragRows = activeGroupingFields.some((field) => !!field.onMoveToGroup);
|
|
2734
|
-
const hasExportableRows = exportRows.length > 0;
|
|
2735
3110
|
const addGroupingField = (fieldId) => {
|
|
2736
3111
|
if (activeGrouping.includes(fieldId))
|
|
2737
3112
|
return;
|
|
@@ -2765,24 +3140,24 @@ function DataTable({
|
|
|
2765
3140
|
}
|
|
2766
3141
|
setStoredView(nextView);
|
|
2767
3142
|
};
|
|
2768
|
-
const renderLoadingState = () => /* @__PURE__ */
|
|
3143
|
+
const renderLoadingState = () => /* @__PURE__ */ jsx17(Loading, {
|
|
2769
3144
|
label: labels2.loading
|
|
2770
3145
|
});
|
|
2771
3146
|
const renderEmptyContent = () => state?.error ?? (isLoading ? renderLoadingState() : emptyContent);
|
|
2772
|
-
const renderTableEmptyState = () => /* @__PURE__ */
|
|
2773
|
-
children: /* @__PURE__ */
|
|
3147
|
+
const renderTableEmptyState = () => /* @__PURE__ */ jsx17(TableRow, {
|
|
3148
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2774
3149
|
className: "h-24 text-center",
|
|
2775
3150
|
colSpan,
|
|
2776
3151
|
children: renderEmptyContent()
|
|
2777
3152
|
})
|
|
2778
3153
|
});
|
|
2779
|
-
const renderGalleryEmptyState = (message) => /* @__PURE__ */
|
|
3154
|
+
const renderGalleryEmptyState = (message) => /* @__PURE__ */ jsx17("div", {
|
|
2780
3155
|
className: "text-muted-foreground rounded-xl border border-dashed px-4 py-10 text-center text-sm",
|
|
2781
3156
|
children: message ?? renderEmptyContent()
|
|
2782
3157
|
});
|
|
2783
|
-
const renderGalleryRows = (rows, canDrag) => /* @__PURE__ */
|
|
3158
|
+
const renderGalleryRows = (rows, canDrag) => /* @__PURE__ */ jsx17("div", {
|
|
2784
3159
|
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
2785
|
-
children: rows.map((row) => /* @__PURE__ */
|
|
3160
|
+
children: rows.map((row) => /* @__PURE__ */ jsx17(DataTableGalleryCard, {
|
|
2786
3161
|
canDrag,
|
|
2787
3162
|
dragLabel: grouping?.getRowLabel?.(row.original),
|
|
2788
3163
|
gallery: galleryConfig,
|
|
@@ -2790,6 +3165,8 @@ function DataTable({
|
|
|
2790
3165
|
row,
|
|
2791
3166
|
rowActions,
|
|
2792
3167
|
rowActionsLabel,
|
|
3168
|
+
selectRowLabel: labels2.selectRow,
|
|
3169
|
+
selectable,
|
|
2793
3170
|
table
|
|
2794
3171
|
}, row.id))
|
|
2795
3172
|
});
|
|
@@ -2799,13 +3176,13 @@ function DataTable({
|
|
|
2799
3176
|
const sectionBody = /* @__PURE__ */ jsxs8(GroupTableSection, {
|
|
2800
3177
|
section,
|
|
2801
3178
|
children: [
|
|
2802
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ jsx17(GroupHeaderRow, {
|
|
2803
3180
|
collapsed: isCollapsed,
|
|
2804
3181
|
colSpan,
|
|
2805
3182
|
onToggle: () => toggleGroup(section.key),
|
|
2806
3183
|
section
|
|
2807
3184
|
}),
|
|
2808
|
-
!isCollapsed && !hasChildren && (section.rows.length > 0 ? section.rows.map((row) => /* @__PURE__ */
|
|
3185
|
+
!isCollapsed && !hasChildren && (section.rows.length > 0 ? section.rows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
2809
3186
|
canDrag: canDragRows,
|
|
2810
3187
|
canReorder: false,
|
|
2811
3188
|
dragLabel: grouping?.getRowLabel?.(row.original),
|
|
@@ -2813,9 +3190,12 @@ function DataTable({
|
|
|
2813
3190
|
onRowClick,
|
|
2814
3191
|
row,
|
|
2815
3192
|
rowActions,
|
|
2816
|
-
rowActionsLabel
|
|
2817
|
-
|
|
2818
|
-
|
|
3193
|
+
rowActionsLabel,
|
|
3194
|
+
selectRowLabel: labels2.selectRow,
|
|
3195
|
+
selectable,
|
|
3196
|
+
table
|
|
3197
|
+
}, row.id)) : /* @__PURE__ */ jsx17(TableRow, {
|
|
3198
|
+
children: /* @__PURE__ */ jsx17(TableCell, {
|
|
2819
3199
|
className: "text-muted-foreground h-16",
|
|
2820
3200
|
colSpan,
|
|
2821
3201
|
style: {
|
|
@@ -2834,7 +3214,7 @@ function DataTable({
|
|
|
2834
3214
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2835
3215
|
className: "space-y-3",
|
|
2836
3216
|
children: [
|
|
2837
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsx17(GroupHeaderCard, {
|
|
2838
3218
|
collapsed: isCollapsed,
|
|
2839
3219
|
onToggle: () => toggleGroup(section.key),
|
|
2840
3220
|
section
|
|
@@ -2843,272 +3223,146 @@ function DataTable({
|
|
|
2843
3223
|
]
|
|
2844
3224
|
}, section.key);
|
|
2845
3225
|
});
|
|
3226
|
+
const handleDragEnd = ({ active, over }) => {
|
|
3227
|
+
setActiveDragLabel(null);
|
|
3228
|
+
if (!over)
|
|
3229
|
+
return;
|
|
3230
|
+
const reorderData = decodeRowReorderDragData(active.data.current);
|
|
3231
|
+
if (Option2.isSome(reorderData) && reordering && canReorderRows) {
|
|
3232
|
+
const sourceRowId = String(active.id).replace(/^sortable-row:/, "");
|
|
3233
|
+
const targetRowId = String(over.id).replace(/^sortable-row:/, "");
|
|
3234
|
+
const currentIndex = bodyRows.findIndex((row2) => row2.id === sourceRowId);
|
|
3235
|
+
const nextIndex = bodyRows.findIndex((row2) => row2.id === targetRowId);
|
|
3236
|
+
if (currentIndex !== -1 && nextIndex !== -1 && currentIndex !== nextIndex) {
|
|
3237
|
+
reordering.onReorder(arrayMove(bodyRows.map((row2) => row2.original), currentIndex, nextIndex));
|
|
3238
|
+
}
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
const rowData = decodeRowDragData(active.data.current);
|
|
3242
|
+
const groupData = decodeGroupDropData(over.data.current);
|
|
3243
|
+
if (Option2.isNone(rowData) || Option2.isNone(groupData))
|
|
3244
|
+
return;
|
|
3245
|
+
const row = bodyRows.find(({ id }) => id === rowData.value.rowId)?.original;
|
|
3246
|
+
const field = grouping?.fields.find((currentField) => currentField.id === groupData.value.fieldId);
|
|
3247
|
+
const nextGroupId = groupData.value.groupId;
|
|
3248
|
+
if (row && field?.onMoveToGroup && field.getGroupId(row) !== nextGroupId) {
|
|
3249
|
+
field.onMoveToGroup(row, nextGroupId);
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
const handleDragStart = ({ active }) => {
|
|
3253
|
+
const rowData = decodeRowDragData(active.data.current);
|
|
3254
|
+
setActiveDragLabel(Option2.isSome(rowData) ? rowData.value.label ?? null : null);
|
|
3255
|
+
};
|
|
2846
3256
|
return /* @__PURE__ */ jsxs8("div", {
|
|
2847
3257
|
className: "w-full max-w-full min-w-0 rounded-md",
|
|
2848
3258
|
children: [
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
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, {
|
|
3259
|
+
/* @__PURE__ */ jsx17(DataTableToolbar, {
|
|
3260
|
+
activeGrouping,
|
|
3261
|
+
bulkActions,
|
|
3262
|
+
exportBaseName,
|
|
3263
|
+
exportRows,
|
|
3264
|
+
grouping,
|
|
3265
|
+
labels: labels2,
|
|
3266
|
+
onRefresh,
|
|
3267
|
+
onToggleGrouping: toggleGroupingField,
|
|
3268
|
+
onViewChange: setView,
|
|
3269
|
+
selectedRows,
|
|
3270
|
+
showColumnVisibility,
|
|
3271
|
+
showExport,
|
|
3272
|
+
showGallery,
|
|
3273
|
+
showSearch,
|
|
3274
|
+
showSorting,
|
|
3275
|
+
table,
|
|
3276
|
+
view: currentView
|
|
3277
|
+
}),
|
|
3278
|
+
/* @__PURE__ */ jsx17(DndContext, {
|
|
3009
3279
|
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
|
-
},
|
|
3280
|
+
onDragEnd: handleDragEnd,
|
|
3281
|
+
onDragStart: handleDragStart,
|
|
3055
3282
|
sensors,
|
|
3056
|
-
children: /* @__PURE__ */ jsxs8(
|
|
3057
|
-
value: currentView,
|
|
3283
|
+
children: /* @__PURE__ */ jsxs8(table.AppTable, {
|
|
3058
3284
|
children: [
|
|
3059
|
-
isGalleryView ? hasActiveGrouping ? groupedSections.length > 0 ? /* @__PURE__ */
|
|
3285
|
+
isGalleryView ? hasActiveGrouping ? groupedSections.length > 0 ? /* @__PURE__ */ jsx17("div", {
|
|
3060
3286
|
className: "space-y-4",
|
|
3061
3287
|
children: renderGroupedGallerySections(groupedSections)
|
|
3062
3288
|
}) : renderGalleryEmptyState() : bodyRows.length > 0 ? renderGalleryRows(bodyRows, false) : renderGalleryEmptyState() : /* @__PURE__ */ jsxs8(ScrollArea, {
|
|
3063
3289
|
className: "-m-1 max-w-full min-w-0",
|
|
3064
3290
|
children: [
|
|
3065
|
-
/* @__PURE__ */
|
|
3291
|
+
/* @__PURE__ */ jsx17("div", {
|
|
3066
3292
|
className: "max-w-full min-w-0 p-1",
|
|
3067
3293
|
children: /* @__PURE__ */ jsxs8(Table, {
|
|
3068
3294
|
className: "table-fixed",
|
|
3069
3295
|
style: {
|
|
3070
|
-
width: `max(100%, ${table.getTotalSize() + (canReorderRows ? 40 : 0)}px)`
|
|
3296
|
+
width: `max(100%, ${table.getTotalSize() + (canReorderRows ? 40 : 0) + (selectable ? 40 : 0) + (rowActions ? 40 : 0)}px)`
|
|
3071
3297
|
},
|
|
3072
3298
|
children: [
|
|
3073
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsx17(TableHeader, {
|
|
3074
3300
|
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs8(TableRow, {
|
|
3075
3301
|
className: "p-4",
|
|
3076
3302
|
children: [
|
|
3077
|
-
|
|
3303
|
+
selectable ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3304
|
+
className: "w-10 min-w-10 pr-0",
|
|
3305
|
+
children: /* @__PURE__ */ jsx17(Checkbox, {
|
|
3306
|
+
"aria-label": labels2.selectAllRows,
|
|
3307
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
3308
|
+
indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected(),
|
|
3309
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked)
|
|
3310
|
+
})
|
|
3311
|
+
}) : null,
|
|
3312
|
+
canReorderRows ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3078
3313
|
className: "w-10 min-w-10 p-0"
|
|
3079
3314
|
}) : null,
|
|
3080
|
-
headerGroup.headers.map((header) => {
|
|
3081
|
-
|
|
3315
|
+
headerGroup.headers.map((header) => /* @__PURE__ */ jsx17(table.AppHeader, {
|
|
3316
|
+
header,
|
|
3317
|
+
children: (appHeader) => /* @__PURE__ */ jsxs8(TableHead, {
|
|
3082
3318
|
className: "relative h-12 min-w-32 p-0",
|
|
3083
3319
|
style: { width: header.getSize() },
|
|
3084
3320
|
children: [
|
|
3085
|
-
|
|
3086
|
-
header.column.getCanResize() ? /* @__PURE__ */
|
|
3321
|
+
header.isPlaceholder ? null : /* @__PURE__ */ jsx17(appHeader.FlexRender, {}),
|
|
3322
|
+
header.column.getCanResize() ? /* @__PURE__ */ jsx17("button", {
|
|
3087
3323
|
"aria-label": labels2.resizeColumn(getHeaderName(header)),
|
|
3324
|
+
"aria-orientation": "vertical",
|
|
3325
|
+
"aria-valuemax": header.column.columnDef.maxSize ?? DEFAULT_COLUMN_MAX_SIZE,
|
|
3326
|
+
"aria-valuemin": header.column.columnDef.minSize ?? DEFAULT_COLUMN_MIN_SIZE,
|
|
3327
|
+
"aria-valuenow": header.column.getSize(),
|
|
3088
3328
|
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"),
|
|
3329
|
+
onKeyDown: (event) => {
|
|
3330
|
+
const minSize = header.column.columnDef.minSize ?? DEFAULT_COLUMN_MIN_SIZE;
|
|
3331
|
+
const maxSize = header.column.columnDef.maxSize ?? DEFAULT_COLUMN_MAX_SIZE;
|
|
3332
|
+
const currentSize = header.column.getSize();
|
|
3333
|
+
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;
|
|
3334
|
+
if (nextSize === undefined)
|
|
3335
|
+
return;
|
|
3336
|
+
event.preventDefault();
|
|
3337
|
+
table.setColumnSizing((current) => ({
|
|
3338
|
+
...current,
|
|
3339
|
+
[header.column.id]: Math.min(maxSize, Math.max(minSize, nextSize))
|
|
3340
|
+
}));
|
|
3341
|
+
},
|
|
3342
|
+
role: "separator",
|
|
3089
3343
|
type: "button",
|
|
3090
3344
|
onDoubleClick: () => header.column.resetSize(),
|
|
3091
3345
|
onMouseDown: header.getResizeHandler(),
|
|
3092
3346
|
onTouchStart: header.getResizeHandler()
|
|
3093
3347
|
}) : null
|
|
3094
3348
|
]
|
|
3095
|
-
}
|
|
3096
|
-
}),
|
|
3097
|
-
rowActions ? /* @__PURE__ */
|
|
3098
|
-
className: "
|
|
3349
|
+
})
|
|
3350
|
+
}, header.id)),
|
|
3351
|
+
rowActions ? /* @__PURE__ */ jsx17(TableHead, {
|
|
3352
|
+
className: "w-10 min-w-10 p-0"
|
|
3099
3353
|
}) : null
|
|
3100
3354
|
]
|
|
3101
3355
|
}, headerGroup.id))
|
|
3102
3356
|
}),
|
|
3103
|
-
hasActiveGrouping ? groupedSections.length > 0 ? renderGroupedTableSections(groupedSections) : /* @__PURE__ */
|
|
3357
|
+
hasActiveGrouping ? groupedSections.length > 0 ? renderGroupedTableSections(groupedSections) : /* @__PURE__ */ jsx17(TableBody, {
|
|
3104
3358
|
className: "px-2",
|
|
3105
3359
|
children: renderTableEmptyState()
|
|
3106
|
-
}) : /* @__PURE__ */
|
|
3360
|
+
}) : /* @__PURE__ */ jsx17(TableBody, {
|
|
3107
3361
|
className: "px-2",
|
|
3108
|
-
children: bodyRows.length > 0 ? canReorderRows ? /* @__PURE__ */
|
|
3362
|
+
children: bodyRows.length > 0 ? canReorderRows ? /* @__PURE__ */ jsx17(SortableContext, {
|
|
3109
3363
|
items: sortableRowIds,
|
|
3110
3364
|
strategy: verticalListSortingStrategy,
|
|
3111
|
-
children: bodyRows.map((row) => /* @__PURE__ */
|
|
3365
|
+
children: bodyRows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
3112
3366
|
canDrag: false,
|
|
3113
3367
|
canReorder: true,
|
|
3114
3368
|
dragLabel: reordering?.getRowLabel?.(row.original),
|
|
@@ -3116,28 +3370,34 @@ function DataTable({
|
|
|
3116
3370
|
reorderHandleLabel: reordering?.handleLabel ?? labels2.reorder,
|
|
3117
3371
|
row,
|
|
3118
3372
|
rowActions,
|
|
3119
|
-
rowActionsLabel
|
|
3373
|
+
rowActionsLabel,
|
|
3374
|
+
selectRowLabel: labels2.selectRow,
|
|
3375
|
+
selectable,
|
|
3376
|
+
table
|
|
3120
3377
|
}, row.id))
|
|
3121
|
-
}) : bodyRows.map((row) => /* @__PURE__ */
|
|
3378
|
+
}) : bodyRows.map((row) => /* @__PURE__ */ jsx17(DataTableRow, {
|
|
3122
3379
|
canDrag: false,
|
|
3123
3380
|
canReorder: false,
|
|
3124
3381
|
onRowClick,
|
|
3125
3382
|
row,
|
|
3126
3383
|
rowActions,
|
|
3127
|
-
rowActionsLabel
|
|
3384
|
+
rowActionsLabel,
|
|
3385
|
+
selectRowLabel: labels2.selectRow,
|
|
3386
|
+
selectable,
|
|
3387
|
+
table
|
|
3128
3388
|
}, row.id)) : renderTableEmptyState()
|
|
3129
3389
|
})
|
|
3130
3390
|
]
|
|
3131
3391
|
})
|
|
3132
3392
|
}),
|
|
3133
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx17(ScrollBar, {
|
|
3134
3394
|
orientation: "horizontal"
|
|
3135
3395
|
})
|
|
3136
3396
|
]
|
|
3137
3397
|
}),
|
|
3138
|
-
/* @__PURE__ */
|
|
3398
|
+
/* @__PURE__ */ jsx17(DragOverlay, {
|
|
3139
3399
|
modifiers: [snapDragOverlayVerticalCenterToCursor],
|
|
3140
|
-
children: activeDragLabel ? /* @__PURE__ */
|
|
3400
|
+
children: activeDragLabel ? /* @__PURE__ */ jsx17("div", {
|
|
3141
3401
|
className: "bg-background rounded-md border px-3 py-2 text-sm shadow-sm",
|
|
3142
3402
|
children: activeDragLabel
|
|
3143
3403
|
}) : null
|
|
@@ -3145,9 +3405,9 @@ function DataTable({
|
|
|
3145
3405
|
]
|
|
3146
3406
|
})
|
|
3147
3407
|
}),
|
|
3148
|
-
showPagination && !hasActiveGrouping && /* @__PURE__ */
|
|
3408
|
+
showPagination && !hasActiveGrouping && /* @__PURE__ */ jsx17("div", {
|
|
3149
3409
|
className: "p-2",
|
|
3150
|
-
children: /* @__PURE__ */
|
|
3410
|
+
children: /* @__PURE__ */ jsx17(DataTablePagination, {
|
|
3151
3411
|
messages: labels2,
|
|
3152
3412
|
pageSizes,
|
|
3153
3413
|
rowCount: serverRowCount,
|
|
@@ -3164,39 +3424,43 @@ function DataTableDisplayModeSwitch({
|
|
|
3164
3424
|
}) {
|
|
3165
3425
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3166
3426
|
children: [
|
|
3167
|
-
/* @__PURE__ */
|
|
3427
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3168
3428
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3169
3429
|
"aria-label": messages4.view,
|
|
3170
3430
|
className: "h-9",
|
|
3171
3431
|
size: "sm",
|
|
3172
3432
|
variant: "outline",
|
|
3173
3433
|
children: [
|
|
3174
|
-
value === "gallery" ? /* @__PURE__ */
|
|
3175
|
-
/* @__PURE__ */
|
|
3434
|
+
value === "gallery" ? /* @__PURE__ */ jsx17(LayoutGrid, {}) : /* @__PURE__ */ jsx17(Rows3, {}),
|
|
3435
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3176
3436
|
className: "hidden sm:inline",
|
|
3177
3437
|
children: messages4.view
|
|
3178
3438
|
})
|
|
3179
3439
|
]
|
|
3180
3440
|
})
|
|
3181
3441
|
}),
|
|
3182
|
-
/* @__PURE__ */
|
|
3442
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3183
3443
|
align: "end",
|
|
3184
3444
|
className: "w-[160px]",
|
|
3185
3445
|
children: /* @__PURE__ */ jsxs8(DropdownMenuRadioGroup, {
|
|
3186
3446
|
value,
|
|
3187
|
-
onValueChange: (
|
|
3447
|
+
onValueChange: (nextValue) => {
|
|
3448
|
+
const view = decodeDataTableView(nextValue);
|
|
3449
|
+
if (Option2.isSome(view))
|
|
3450
|
+
onChange(view.value);
|
|
3451
|
+
},
|
|
3188
3452
|
children: [
|
|
3189
3453
|
/* @__PURE__ */ jsxs8(DropdownMenuRadioItem, {
|
|
3190
3454
|
value: "table",
|
|
3191
3455
|
children: [
|
|
3192
|
-
/* @__PURE__ */
|
|
3456
|
+
/* @__PURE__ */ jsx17(Rows3, {}),
|
|
3193
3457
|
messages4.tableView
|
|
3194
3458
|
]
|
|
3195
3459
|
}),
|
|
3196
3460
|
/* @__PURE__ */ jsxs8(DropdownMenuRadioItem, {
|
|
3197
3461
|
value: "gallery",
|
|
3198
3462
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3463
|
+
/* @__PURE__ */ jsx17(LayoutGrid, {}),
|
|
3200
3464
|
messages4.galleryView
|
|
3201
3465
|
]
|
|
3202
3466
|
})
|
|
@@ -3210,39 +3474,39 @@ function DataTableSortDropdown({
|
|
|
3210
3474
|
messages: messages4,
|
|
3211
3475
|
table
|
|
3212
3476
|
}) {
|
|
3213
|
-
const sorting = table.
|
|
3477
|
+
const sorting = table.state.sorting;
|
|
3214
3478
|
const sortableColumns = table.getAllColumns().filter((column) => column.getCanSort());
|
|
3215
|
-
const columnLabels =
|
|
3479
|
+
const columnLabels = getColumnLabels(table);
|
|
3216
3480
|
if (sortableColumns.length === 0) {
|
|
3217
3481
|
return null;
|
|
3218
3482
|
}
|
|
3219
3483
|
const activeSortColumn = sorting.length > 0 ? sorting[0] : null;
|
|
3220
3484
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3221
3485
|
children: [
|
|
3222
|
-
/* @__PURE__ */
|
|
3486
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3223
3487
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3224
3488
|
"aria-label": messages4.sortBy,
|
|
3225
3489
|
className: "h-9",
|
|
3226
3490
|
size: "sm",
|
|
3227
3491
|
variant: "outline",
|
|
3228
3492
|
children: [
|
|
3229
|
-
activeSortColumn ? activeSortColumn.desc ? /* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3493
|
+
activeSortColumn ? activeSortColumn.desc ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {}) : /* @__PURE__ */ jsx17(ChevronsUpDown2, {}),
|
|
3494
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3231
3495
|
className: "hidden sm:inline",
|
|
3232
3496
|
children: messages4.sortBy
|
|
3233
3497
|
})
|
|
3234
3498
|
]
|
|
3235
3499
|
})
|
|
3236
3500
|
}),
|
|
3237
|
-
/* @__PURE__ */
|
|
3501
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3238
3502
|
align: "end",
|
|
3239
3503
|
className: "w-[200px]",
|
|
3240
3504
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3241
3505
|
children: [
|
|
3242
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
3243
3507
|
children: messages4.sortBy
|
|
3244
3508
|
}),
|
|
3245
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3246
3510
|
sortableColumns.map((column) => {
|
|
3247
3511
|
const sortState = sorting.find((s) => s.id === column.id);
|
|
3248
3512
|
const label = columnLabels.get(column.id) ?? column.id;
|
|
@@ -3251,9 +3515,9 @@ function DataTableSortDropdown({
|
|
|
3251
3515
|
/* @__PURE__ */ jsxs8(DropdownMenuSubTrigger, {
|
|
3252
3516
|
inset: !!sortState,
|
|
3253
3517
|
children: [
|
|
3254
|
-
sortState ? /* @__PURE__ */
|
|
3518
|
+
sortState ? /* @__PURE__ */ jsx17("span", {
|
|
3255
3519
|
className: "pointer-events-none absolute left-3 flex size-4 items-center justify-center",
|
|
3256
|
-
children: sortState.desc ? /* @__PURE__ */
|
|
3520
|
+
children: sortState.desc ? /* @__PURE__ */ jsx17(ArrowDown, {}) : /* @__PURE__ */ jsx17(ArrowUp, {})
|
|
3257
3521
|
}) : null,
|
|
3258
3522
|
label
|
|
3259
3523
|
]
|
|
@@ -3263,21 +3527,21 @@ function DataTableSortDropdown({
|
|
|
3263
3527
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3264
3528
|
onClick: () => column.toggleSorting(false),
|
|
3265
3529
|
children: [
|
|
3266
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__PURE__ */ jsx17(ArrowUp, {}),
|
|
3267
3531
|
messages4.sortAsc
|
|
3268
3532
|
]
|
|
3269
3533
|
}),
|
|
3270
3534
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3271
3535
|
onClick: () => column.toggleSorting(true),
|
|
3272
3536
|
children: [
|
|
3273
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ jsx17(ArrowDown, {}),
|
|
3274
3538
|
messages4.sortDesc
|
|
3275
3539
|
]
|
|
3276
3540
|
}),
|
|
3277
3541
|
sortState && /* @__PURE__ */ jsxs8(Fragment, {
|
|
3278
3542
|
children: [
|
|
3279
|
-
/* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3544
|
+
/* @__PURE__ */ jsx17(DropdownMenuItem, {
|
|
3281
3545
|
onClick: () => column.clearSorting(),
|
|
3282
3546
|
children: messages4.sortClear
|
|
3283
3547
|
})
|
|
@@ -3298,38 +3562,38 @@ function DataTableViewOptions({
|
|
|
3298
3562
|
messages: messages4,
|
|
3299
3563
|
table
|
|
3300
3564
|
}) {
|
|
3301
|
-
const columnLabels =
|
|
3565
|
+
const columnLabels = getColumnLabels(table);
|
|
3302
3566
|
const columns = table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide());
|
|
3303
3567
|
if (columns.length === 0) {
|
|
3304
3568
|
return null;
|
|
3305
3569
|
}
|
|
3306
3570
|
return /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3307
3571
|
children: [
|
|
3308
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3309
3573
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3310
3574
|
"aria-label": messages4.columns,
|
|
3311
3575
|
className: "h-9",
|
|
3312
3576
|
size: "sm",
|
|
3313
3577
|
variant: "outline",
|
|
3314
3578
|
children: [
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx17(Settings2, {}),
|
|
3580
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3317
3581
|
className: "hidden sm:inline",
|
|
3318
3582
|
children: messages4.columns
|
|
3319
3583
|
})
|
|
3320
3584
|
]
|
|
3321
3585
|
})
|
|
3322
3586
|
}),
|
|
3323
|
-
/* @__PURE__ */
|
|
3587
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3324
3588
|
align: "end",
|
|
3325
3589
|
className: "w-[180px]",
|
|
3326
3590
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3327
3591
|
children: [
|
|
3328
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, {
|
|
3329
3593
|
children: messages4.columns
|
|
3330
3594
|
}),
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
columns.map((column) => /* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3596
|
+
columns.map((column) => /* @__PURE__ */ jsx17(DropdownMenuCheckboxItem, {
|
|
3333
3597
|
checked: column.getIsVisible(),
|
|
3334
3598
|
className: "capitalize",
|
|
3335
3599
|
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
@@ -3351,7 +3615,7 @@ function DataTablePagination({
|
|
|
3351
3615
|
const selectedRows = table.getFilteredSelectedRowModel().rows.length;
|
|
3352
3616
|
const filteredRows = table.getFilteredRowModel().rows.length;
|
|
3353
3617
|
const totalRows = rowCount ?? filteredRows;
|
|
3354
|
-
return /* @__PURE__ */
|
|
3618
|
+
return /* @__PURE__ */ jsx17(Pagination, {
|
|
3355
3619
|
messages: {
|
|
3356
3620
|
pageSize: labels2.pageSize,
|
|
3357
3621
|
results: labels2.results,
|
|
@@ -3364,9 +3628,9 @@ function DataTablePagination({
|
|
|
3364
3628
|
},
|
|
3365
3629
|
onPageChange: (page) => table.setPageIndex(page),
|
|
3366
3630
|
onPageSizeChange: (pageSize) => table.setPageSize(pageSize),
|
|
3367
|
-
page: table.
|
|
3631
|
+
page: table.state.pagination.pageIndex,
|
|
3368
3632
|
pageCount: table.getPageCount(),
|
|
3369
|
-
pageSize: table.
|
|
3633
|
+
pageSize: table.state.pagination.pageSize,
|
|
3370
3634
|
pageSizes,
|
|
3371
3635
|
selectedRows,
|
|
3372
3636
|
totalRows
|
|
@@ -3386,7 +3650,7 @@ function DataTableRelationshipCell({
|
|
|
3386
3650
|
useEffect2(() => {
|
|
3387
3651
|
setSelectedOptions([...value]);
|
|
3388
3652
|
}, [value]);
|
|
3389
|
-
return /* @__PURE__ */
|
|
3653
|
+
return /* @__PURE__ */ jsx17(VirtualizedCombobox, {
|
|
3390
3654
|
ariaLabel: manageLabel,
|
|
3391
3655
|
emptyLabel,
|
|
3392
3656
|
items: orderedOptions,
|
|
@@ -3412,13 +3676,13 @@ function DataTableRelationshipCell({
|
|
|
3412
3676
|
type: "button",
|
|
3413
3677
|
variant: "ghost",
|
|
3414
3678
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
3679
|
+
/* @__PURE__ */ jsx17(DataTableListSummary, {
|
|
3416
3680
|
emptyLabel,
|
|
3417
3681
|
expandable: false,
|
|
3418
3682
|
items: selectedOptions,
|
|
3419
3683
|
variant: selectedOptions.some(({ icon }) => icon) ? "icon" : "text"
|
|
3420
3684
|
}),
|
|
3421
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ jsx17(ChevronDown, {
|
|
3422
3686
|
className: "text-muted-foreground size-4 shrink-0"
|
|
3423
3687
|
})
|
|
3424
3688
|
]
|
|
@@ -3441,20 +3705,20 @@ function DataTableListSummary({
|
|
|
3441
3705
|
const visibleLabels = visibleItems.map(({ label }) => label).join(", ");
|
|
3442
3706
|
const remaining = Math.max(totalCount - visibleItems.length, 0);
|
|
3443
3707
|
const remainingLabel = overflowLabel?.(remaining) ?? labels2.listOthers(remaining);
|
|
3444
|
-
const expandedItems = /* @__PURE__ */
|
|
3708
|
+
const expandedItems = /* @__PURE__ */ jsx17(PopoverContent, {
|
|
3445
3709
|
align: "start",
|
|
3446
3710
|
className: "max-h-72 w-72 overflow-y-auto p-2",
|
|
3447
3711
|
onClick: (event) => event.stopPropagation(),
|
|
3448
|
-
children: /* @__PURE__ */
|
|
3712
|
+
children: /* @__PURE__ */ jsx17("ul", {
|
|
3449
3713
|
className: "grid gap-1",
|
|
3450
3714
|
children: normalizedItems.map((item, index) => /* @__PURE__ */ jsxs8("li", {
|
|
3451
3715
|
className: "flex items-center gap-2 rounded-sm px-2 py-1.5 break-words",
|
|
3452
3716
|
children: [
|
|
3453
|
-
item.icon ? /* @__PURE__ */
|
|
3717
|
+
item.icon ? /* @__PURE__ */ jsx17("span", {
|
|
3454
3718
|
className: "bg-muted flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-full text-[9px] font-semibold",
|
|
3455
3719
|
children: item.icon
|
|
3456
3720
|
}) : null,
|
|
3457
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3458
3722
|
className: "min-w-0",
|
|
3459
3723
|
children: item.label
|
|
3460
3724
|
})
|
|
@@ -3463,34 +3727,34 @@ function DataTableListSummary({
|
|
|
3463
3727
|
})
|
|
3464
3728
|
});
|
|
3465
3729
|
if (normalizedItems.length === 0) {
|
|
3466
|
-
return /* @__PURE__ */
|
|
3730
|
+
return /* @__PURE__ */ jsx17("span", {
|
|
3467
3731
|
className: "text-muted-foreground text-sm",
|
|
3468
3732
|
children: emptyLabel
|
|
3469
3733
|
});
|
|
3470
3734
|
}
|
|
3471
3735
|
if (variant === "icon") {
|
|
3472
|
-
return /* @__PURE__ */
|
|
3736
|
+
return /* @__PURE__ */ jsx17(TooltipProvider, {
|
|
3473
3737
|
children: /* @__PURE__ */ jsxs8("span", {
|
|
3474
3738
|
className: "flex min-w-0 items-center pl-2",
|
|
3475
3739
|
children: [
|
|
3476
3740
|
visibleItems.map((item, index) => /* @__PURE__ */ jsxs8(Tooltip, {
|
|
3477
3741
|
children: [
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
render: /* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx17(TooltipTrigger, {
|
|
3743
|
+
render: /* @__PURE__ */ jsx17("span", {
|
|
3480
3744
|
"aria-label": item.label,
|
|
3481
3745
|
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
3746
|
style: { marginLeft: index ? -8 : 0 },
|
|
3483
3747
|
children: item.icon ?? item.label.slice(0, 2).toUpperCase()
|
|
3484
3748
|
})
|
|
3485
3749
|
}),
|
|
3486
|
-
/* @__PURE__ */
|
|
3750
|
+
/* @__PURE__ */ jsx17(TooltipContent, {
|
|
3487
3751
|
children: item.label
|
|
3488
3752
|
})
|
|
3489
3753
|
]
|
|
3490
3754
|
}, item.value ?? item.label)),
|
|
3491
3755
|
remaining ? expandable ? /* @__PURE__ */ jsxs8(Popover, {
|
|
3492
3756
|
children: [
|
|
3493
|
-
/* @__PURE__ */
|
|
3757
|
+
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
3494
3758
|
render: /* @__PURE__ */ jsxs8("button", {
|
|
3495
3759
|
"aria-label": labels2.listOthers(remaining),
|
|
3496
3760
|
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 +3784,16 @@ function DataTableListSummary({
|
|
|
3520
3784
|
className: "block min-w-0 text-sm whitespace-normal",
|
|
3521
3785
|
"data-slot": "list-summary",
|
|
3522
3786
|
children: [
|
|
3523
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3524
3788
|
children: visibleLabels
|
|
3525
3789
|
}),
|
|
3526
3790
|
" ",
|
|
3527
|
-
/* @__PURE__ */
|
|
3791
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3528
3792
|
className: "inline-block whitespace-nowrap",
|
|
3529
3793
|
children: expandable ? /* @__PURE__ */ jsxs8(Popover, {
|
|
3530
3794
|
children: [
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
render: /* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
3796
|
+
render: /* @__PURE__ */ jsx17("button", {
|
|
3533
3797
|
className: "text-muted-foreground hover:text-foreground underline decoration-dotted underline-offset-2",
|
|
3534
3798
|
onClick: (event) => event.stopPropagation(),
|
|
3535
3799
|
onPointerDown: (event) => event.stopPropagation(),
|
|
@@ -3542,7 +3806,7 @@ function DataTableListSummary({
|
|
|
3542
3806
|
}) : remainingLabel
|
|
3543
3807
|
})
|
|
3544
3808
|
]
|
|
3545
|
-
}) : /* @__PURE__ */
|
|
3809
|
+
}) : /* @__PURE__ */ jsx17("span", {
|
|
3546
3810
|
className: "block min-w-0 text-sm",
|
|
3547
3811
|
"data-slot": "list-summary",
|
|
3548
3812
|
children: visibleLabels
|
|
@@ -3557,37 +3821,38 @@ function DataTableColumnHeader({
|
|
|
3557
3821
|
const labels2 = dataTableMessages(messages4);
|
|
3558
3822
|
const sortDirection = column.getIsSorted();
|
|
3559
3823
|
if (!column.getCanSort()) {
|
|
3560
|
-
return /* @__PURE__ */
|
|
3824
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
3561
3825
|
className: cn("flex h-12 items-center truncate px-2 text-sm", className),
|
|
3562
3826
|
children: title
|
|
3563
3827
|
});
|
|
3564
3828
|
}
|
|
3565
|
-
return /* @__PURE__ */
|
|
3829
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
3566
3830
|
className: cn("flex h-12 items-center", className),
|
|
3567
3831
|
children: /* @__PURE__ */ jsxs8(DropdownMenu, {
|
|
3568
3832
|
children: [
|
|
3569
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, {
|
|
3570
3834
|
render: /* @__PURE__ */ jsxs8(Button, {
|
|
3571
3835
|
variant: "ghost",
|
|
3572
3836
|
size: "sm",
|
|
3573
|
-
className: "data-[state=open]:bg-accent h-
|
|
3837
|
+
className: "data-[state=open]:bg-accent h-8 max-w-full justify-start px-2",
|
|
3574
3838
|
children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsx17("span", {
|
|
3576
3840
|
className: "min-w-0 truncate text-sm",
|
|
3577
3841
|
children: title
|
|
3578
3842
|
}),
|
|
3579
|
-
sortDirection === "desc" ? /* @__PURE__ */
|
|
3843
|
+
sortDirection === "desc" ? /* @__PURE__ */ jsx17(ArrowDown, {}) : sortDirection === "asc" ? /* @__PURE__ */ jsx17(ArrowUp, {}) : /* @__PURE__ */ jsx17(ChevronsUpDown2, {})
|
|
3580
3844
|
]
|
|
3581
3845
|
})
|
|
3582
3846
|
}),
|
|
3583
|
-
/* @__PURE__ */
|
|
3847
|
+
/* @__PURE__ */ jsx17(DropdownMenuContent, {
|
|
3584
3848
|
align: "start",
|
|
3849
|
+
className: "max-w-56",
|
|
3585
3850
|
children: /* @__PURE__ */ jsxs8(DropdownMenuGroup, {
|
|
3586
3851
|
children: [
|
|
3587
3852
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3588
3853
|
onClick: () => column.toggleSorting(false),
|
|
3589
3854
|
children: [
|
|
3590
|
-
/* @__PURE__ */
|
|
3855
|
+
/* @__PURE__ */ jsx17(ArrowUp, {
|
|
3591
3856
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3592
3857
|
}),
|
|
3593
3858
|
labels2.sortAsc
|
|
@@ -3596,7 +3861,7 @@ function DataTableColumnHeader({
|
|
|
3596
3861
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3597
3862
|
onClick: () => column.toggleSorting(true),
|
|
3598
3863
|
children: [
|
|
3599
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx17(ArrowDown, {
|
|
3600
3865
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3601
3866
|
}),
|
|
3602
3867
|
labels2.sortDesc
|
|
@@ -3605,17 +3870,17 @@ function DataTableColumnHeader({
|
|
|
3605
3870
|
sortDirection ? /* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3606
3871
|
onClick: () => column.clearSorting(),
|
|
3607
3872
|
children: [
|
|
3608
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx17(X2, {
|
|
3609
3874
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3610
3875
|
}),
|
|
3611
3876
|
labels2.sortClear
|
|
3612
3877
|
]
|
|
3613
3878
|
}) : null,
|
|
3614
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
3615
3880
|
/* @__PURE__ */ jsxs8(DropdownMenuItem, {
|
|
3616
3881
|
onClick: () => column.toggleVisibility(false),
|
|
3617
3882
|
children: [
|
|
3618
|
-
/* @__PURE__ */
|
|
3883
|
+
/* @__PURE__ */ jsx17(EyeOff, {
|
|
3619
3884
|
className: "text-muted-foreground/70 h-3.5 w-3.5"
|
|
3620
3885
|
}),
|
|
3621
3886
|
labels2.sortHide
|
|
@@ -3629,10 +3894,15 @@ function DataTableColumnHeader({
|
|
|
3629
3894
|
});
|
|
3630
3895
|
}
|
|
3631
3896
|
export {
|
|
3897
|
+
useDataTableHeaderContext,
|
|
3898
|
+
useDataTableContext,
|
|
3899
|
+
useDataTableCellContext,
|
|
3900
|
+
useDataTable,
|
|
3632
3901
|
getHeaderNames,
|
|
3633
3902
|
downloadJson,
|
|
3634
3903
|
downloadCsv,
|
|
3635
3904
|
dataTableMessages,
|
|
3905
|
+
createDataTableColumnHelper,
|
|
3636
3906
|
TableSearchSchemaStandard,
|
|
3637
3907
|
TableSearchSchema,
|
|
3638
3908
|
DataTableRowActions,
|