@yenio-pld/blocks 1.1.0-rc.1 → 1.2.0-rc.1
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/dist/index.cjs +1048 -392
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +299 -119
- package/dist/index.d.ts +299 -119
- package/dist/index.js +1035 -395
- package/dist/index.js.map +1 -1
- package/dist/ui/table.js +1 -1
- package/dist/ui/table.js.map +1 -1
- package/package.json +1 -1
- package/src/theme.css +2 -2
package/dist/index.cjs
CHANGED
|
@@ -7,12 +7,18 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var lucideReact = require('lucide-react');
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var tailwindMerge = require('tailwind-merge');
|
|
10
|
-
var
|
|
11
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
12
|
-
var alertDialog_js = require('./ui/alert-dialog.js');
|
|
10
|
+
var avatar_js = require('./ui/avatar.js');
|
|
13
11
|
var button_js = require('./ui/button.js');
|
|
14
12
|
var dropdownMenu_js = require('./ui/dropdown-menu.js');
|
|
13
|
+
var empty_js = require('./ui/empty.js');
|
|
15
14
|
var nextThemes = require('next-themes');
|
|
15
|
+
var separator_js = require('./ui/separator.js');
|
|
16
|
+
var sidebar_js = require('./ui/sidebar.js');
|
|
17
|
+
var table_js = require('./ui/table.js');
|
|
18
|
+
var tooltip_js = require('./ui/tooltip.js');
|
|
19
|
+
var card_js = require('./ui/card.js');
|
|
20
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
21
|
+
var alertDialog_js = require('./ui/alert-dialog.js');
|
|
16
22
|
var slider_js = require('./ui/slider.js');
|
|
17
23
|
var toggle_js = require('./ui/toggle.js');
|
|
18
24
|
var dialog_js = require('./ui/dialog.js');
|
|
@@ -25,11 +31,19 @@ function useLanguageContext() {
|
|
|
25
31
|
}
|
|
26
32
|
function PageTitle({
|
|
27
33
|
title,
|
|
28
|
-
description
|
|
34
|
+
description,
|
|
35
|
+
eyebrow,
|
|
36
|
+
back,
|
|
37
|
+
actions
|
|
29
38
|
}) {
|
|
30
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-
|
|
31
|
-
/* @__PURE__ */ jsxRuntime.
|
|
32
|
-
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4", children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
41
|
+
back ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm", children: back }) : null,
|
|
42
|
+
eyebrow ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: eyebrow }) : null,
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: title }),
|
|
44
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
|
|
45
|
+
] }),
|
|
46
|
+
actions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-wrap gap-2 *:flex-1 sm:w-auto sm:shrink-0 sm:flex-nowrap sm:*:flex-none", children: actions }) : null
|
|
33
47
|
] });
|
|
34
48
|
}
|
|
35
49
|
function Field({
|
|
@@ -56,6 +70,87 @@ function TableSkeleton({
|
|
|
56
70
|
}) {
|
|
57
71
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-busy": "true", className: "flex flex-col gap-2", children: Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2", children: Array.from({ length: columns }, (_2, column) => /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 flex-1" }, column)) }, row)) });
|
|
58
72
|
}
|
|
73
|
+
|
|
74
|
+
// src/lib/avatar.ts
|
|
75
|
+
var EMPTY_COLORS = {
|
|
76
|
+
backgroundColor: "#9ca3af",
|
|
77
|
+
color: "#111111"
|
|
78
|
+
};
|
|
79
|
+
var AVATAR_PALETTE = [
|
|
80
|
+
"#4f6d8c",
|
|
81
|
+
// slate blue
|
|
82
|
+
"#3d7a6a",
|
|
83
|
+
// teal
|
|
84
|
+
"#6b5b8a",
|
|
85
|
+
// muted purple
|
|
86
|
+
"#8a5a4a",
|
|
87
|
+
// warm brown
|
|
88
|
+
"#4a7a8a",
|
|
89
|
+
// steel cyan
|
|
90
|
+
"#7a6b4a",
|
|
91
|
+
// olive
|
|
92
|
+
"#5a6b8a",
|
|
93
|
+
// periwinkle
|
|
94
|
+
"#8a4a5a",
|
|
95
|
+
// rose
|
|
96
|
+
"#4a8a6b",
|
|
97
|
+
// green
|
|
98
|
+
"#6b4a7a",
|
|
99
|
+
// plum
|
|
100
|
+
"#8a6b4a",
|
|
101
|
+
// amber brown
|
|
102
|
+
"#4a5a8a",
|
|
103
|
+
// indigo
|
|
104
|
+
"#7a4a6b",
|
|
105
|
+
// mauve
|
|
106
|
+
"#5a8a4a",
|
|
107
|
+
// leaf
|
|
108
|
+
"#8a5a7a",
|
|
109
|
+
// dusty pink
|
|
110
|
+
"#3d6b7a"
|
|
111
|
+
// deep teal
|
|
112
|
+
];
|
|
113
|
+
function hashString(input) {
|
|
114
|
+
let hash = 2166136261;
|
|
115
|
+
for (let i = 0; i < input.length; i++) {
|
|
116
|
+
hash ^= input.charCodeAt(i);
|
|
117
|
+
hash = Math.imul(hash, 16777619);
|
|
118
|
+
}
|
|
119
|
+
return hash >>> 0;
|
|
120
|
+
}
|
|
121
|
+
function srgbToLinear(channel) {
|
|
122
|
+
const c = channel / 255;
|
|
123
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
124
|
+
}
|
|
125
|
+
function relativeLuminance(hex) {
|
|
126
|
+
const normalized = hex.replace("#", "");
|
|
127
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
128
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
129
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
130
|
+
return 0.2126 * srgbToLinear(r) + 0.7152 * srgbToLinear(g) + 0.0722 * srgbToLinear(b);
|
|
131
|
+
}
|
|
132
|
+
function contrastingTextColor(backgroundHex) {
|
|
133
|
+
return relativeLuminance(backgroundHex) > 0.179 ? "#111111" : "#ffffff";
|
|
134
|
+
}
|
|
135
|
+
function getInitials(name, max = 2) {
|
|
136
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
137
|
+
if (parts.length === 0) return "?";
|
|
138
|
+
return parts.slice(0, Math.max(1, max)).map((part) => part.charAt(0)).join("").toUpperCase();
|
|
139
|
+
}
|
|
140
|
+
function getAvatarColors(name) {
|
|
141
|
+
const normalized = name.trim().toLowerCase();
|
|
142
|
+
if (!normalized) {
|
|
143
|
+
return { ...EMPTY_COLORS };
|
|
144
|
+
}
|
|
145
|
+
const backgroundColor = AVATAR_PALETTE[hashString(normalized) % AVATAR_PALETTE.length];
|
|
146
|
+
return {
|
|
147
|
+
backgroundColor,
|
|
148
|
+
color: contrastingTextColor(backgroundColor)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function avatarFallbackStyle(name) {
|
|
152
|
+
return getAvatarColors(name);
|
|
153
|
+
}
|
|
59
154
|
function cn(...inputs) {
|
|
60
155
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
61
156
|
}
|
|
@@ -146,11 +241,837 @@ function EmptyState({
|
|
|
146
241
|
),
|
|
147
242
|
description ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyDescription, { className: "mt-0", children: description }) : null
|
|
148
243
|
] }),
|
|
149
|
-
action ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyContent, { className: "gap-0", children: action }) : null
|
|
244
|
+
action ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyContent, { className: "gap-0", children: action }) : null
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
var defaultLanguages = [
|
|
250
|
+
{ key: "es-MX", label: "ES", nativeName: "Espa\xF1ol (M\xE9xico)" },
|
|
251
|
+
{ key: "en", label: "EN", nativeName: "English" }
|
|
252
|
+
];
|
|
253
|
+
var sizeClasses = {
|
|
254
|
+
sm: { button: "size-8", icon: "size-4" },
|
|
255
|
+
md: { button: "size-8", icon: "size-4" },
|
|
256
|
+
lg: { button: "size-9", icon: "size-4" }
|
|
257
|
+
};
|
|
258
|
+
var shapeClasses = {
|
|
259
|
+
rounded: "rounded-md",
|
|
260
|
+
squared: "rounded-sm",
|
|
261
|
+
pill: "rounded-full"
|
|
262
|
+
};
|
|
263
|
+
var iconTriggerClassName = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
264
|
+
function LanguageSwitcher({
|
|
265
|
+
languages: propLanguages,
|
|
266
|
+
currentLanguage: propCurrentLanguage,
|
|
267
|
+
onLanguageChange: propOnLanguageChange,
|
|
268
|
+
labels = {},
|
|
269
|
+
className,
|
|
270
|
+
size = "sm",
|
|
271
|
+
shape = "rounded",
|
|
272
|
+
align = "end",
|
|
273
|
+
side = "bottom"
|
|
274
|
+
}) {
|
|
275
|
+
const context = useLanguageContext();
|
|
276
|
+
const contextLanguages = context?.languages?.map((lang) => ({
|
|
277
|
+
key: lang.code,
|
|
278
|
+
label: lang.code.toUpperCase(),
|
|
279
|
+
nativeName: lang.name
|
|
280
|
+
}));
|
|
281
|
+
const languages = propLanguages ?? contextLanguages ?? defaultLanguages;
|
|
282
|
+
const currentLanguage = propCurrentLanguage ?? context?.language ?? "en";
|
|
283
|
+
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
284
|
+
const sizes = sizeClasses[size];
|
|
285
|
+
const shapeClass = shapeClasses[shape];
|
|
286
|
+
const accessibleName = labels.language ?? "Language";
|
|
287
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
290
|
+
{
|
|
291
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
+
button_js.Button,
|
|
293
|
+
{
|
|
294
|
+
variant: "outline",
|
|
295
|
+
size: "icon",
|
|
296
|
+
"aria-label": accessibleName,
|
|
297
|
+
className: cn(
|
|
298
|
+
sizes.button,
|
|
299
|
+
shapeClass,
|
|
300
|
+
iconTriggerClassName,
|
|
301
|
+
className
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Languages, { className: sizes.icon })
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
+
dropdownMenu_js.DropdownMenuContent,
|
|
310
|
+
{
|
|
311
|
+
side,
|
|
312
|
+
align,
|
|
313
|
+
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
314
|
+
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
315
|
+
className: cn(dropdownMenu_js.miniMenuContentClassName, "min-w-0 w-auto"),
|
|
316
|
+
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
+
dropdownMenu_js.DropdownMenuItem,
|
|
318
|
+
{
|
|
319
|
+
onClick: () => onLanguageChange?.(key),
|
|
320
|
+
className: cn(
|
|
321
|
+
"justify-center text-xs font-semibold cursor-pointer px-3",
|
|
322
|
+
currentLanguage === key && "bg-accent text-accent-foreground"
|
|
323
|
+
),
|
|
324
|
+
children: nativeName
|
|
325
|
+
},
|
|
326
|
+
key
|
|
327
|
+
))
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
var defaultLabels = {
|
|
333
|
+
theme: "Theme",
|
|
334
|
+
system: "System",
|
|
335
|
+
light: "Light",
|
|
336
|
+
dark: "Dark"
|
|
337
|
+
};
|
|
338
|
+
var sizeClasses2 = {
|
|
339
|
+
sm: { button: "size-8", icon: "size-4" },
|
|
340
|
+
md: { button: "size-8", icon: "size-4" },
|
|
341
|
+
lg: { button: "size-9", icon: "size-4" }
|
|
342
|
+
};
|
|
343
|
+
var shapeClasses2 = {
|
|
344
|
+
rounded: "rounded-md",
|
|
345
|
+
pill: "rounded-full"
|
|
346
|
+
};
|
|
347
|
+
var iconTriggerClassName2 = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
348
|
+
var themeIcons = {
|
|
349
|
+
system: lucideReact.Monitor,
|
|
350
|
+
light: lucideReact.Sun,
|
|
351
|
+
dark: lucideReact.Moon
|
|
352
|
+
};
|
|
353
|
+
var themes = [
|
|
354
|
+
{ key: "system", icon: themeIcons.system },
|
|
355
|
+
{ key: "light", icon: themeIcons.light },
|
|
356
|
+
{ key: "dark", icon: themeIcons.dark }
|
|
357
|
+
];
|
|
358
|
+
function storedTheme(value) {
|
|
359
|
+
if (value === "system" || value === "light" || value === "dark") return value;
|
|
360
|
+
return void 0;
|
|
361
|
+
}
|
|
362
|
+
function ThemeSwitcher({
|
|
363
|
+
className,
|
|
364
|
+
size = "sm",
|
|
365
|
+
shape = "rounded",
|
|
366
|
+
align = "end",
|
|
367
|
+
side = "bottom",
|
|
368
|
+
labels: userLabels
|
|
369
|
+
}) {
|
|
370
|
+
const { theme, setTheme } = nextThemes.useTheme();
|
|
371
|
+
const [mounted, setMounted] = react.useState(false);
|
|
372
|
+
const sizes = sizeClasses2[size];
|
|
373
|
+
const shapeClass = shapeClasses2[shape];
|
|
374
|
+
const labels = { ...defaultLabels, ...userLabels };
|
|
375
|
+
const handleThemeClick = react.useCallback(
|
|
376
|
+
(themeKey) => {
|
|
377
|
+
setTheme(themeKey);
|
|
378
|
+
},
|
|
379
|
+
[setTheme]
|
|
380
|
+
);
|
|
381
|
+
react.useEffect(() => {
|
|
382
|
+
setMounted(true);
|
|
383
|
+
}, []);
|
|
384
|
+
if (!mounted) {
|
|
385
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
+
"div",
|
|
387
|
+
{
|
|
388
|
+
"aria-hidden": true,
|
|
389
|
+
className: cn(
|
|
390
|
+
sizes.button,
|
|
391
|
+
shapeClass,
|
|
392
|
+
iconTriggerClassName2,
|
|
393
|
+
className
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
const currentTheme = storedTheme(theme);
|
|
399
|
+
const TriggerIcon = currentTheme ? themeIcons[currentTheme] : lucideReact.Monitor;
|
|
400
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
401
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
403
|
+
{
|
|
404
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
405
|
+
button_js.Button,
|
|
406
|
+
{
|
|
407
|
+
"data-testid": "theme-switcher",
|
|
408
|
+
variant: "outline",
|
|
409
|
+
size: "icon",
|
|
410
|
+
"aria-label": labels.theme,
|
|
411
|
+
className: cn(
|
|
412
|
+
sizes.button,
|
|
413
|
+
shapeClass,
|
|
414
|
+
iconTriggerClassName2,
|
|
415
|
+
className
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { className: sizes.icon })
|
|
420
|
+
}
|
|
421
|
+
),
|
|
422
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
dropdownMenu_js.DropdownMenuContent,
|
|
424
|
+
{
|
|
425
|
+
side,
|
|
426
|
+
align,
|
|
427
|
+
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
428
|
+
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
429
|
+
className: dropdownMenu_js.miniMenuContentClassName,
|
|
430
|
+
children: themes.map(({ key, icon: Icon }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
431
|
+
dropdownMenu_js.DropdownMenuItem,
|
|
432
|
+
{
|
|
433
|
+
onClick: () => handleThemeClick(key),
|
|
434
|
+
className: cn(
|
|
435
|
+
"gap-2 cursor-pointer",
|
|
436
|
+
currentTheme === key && "bg-accent text-accent-foreground [&_svg]:text-accent-foreground"
|
|
437
|
+
),
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels[key] })
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
key
|
|
444
|
+
))
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
] });
|
|
448
|
+
}
|
|
449
|
+
var DATA_TABLE_ROW_CLASS = "h-14";
|
|
450
|
+
function renderShellLink({
|
|
451
|
+
href,
|
|
452
|
+
className,
|
|
453
|
+
children,
|
|
454
|
+
...rest
|
|
455
|
+
}) {
|
|
456
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className, ...rest, children });
|
|
457
|
+
}
|
|
458
|
+
function DismissMobileSidebar({ pathname }) {
|
|
459
|
+
const { setOpenMobile } = sidebar_js.useSidebar();
|
|
460
|
+
const previous = react.useRef(pathname);
|
|
461
|
+
react.useEffect(() => {
|
|
462
|
+
if (previous.current === pathname) return;
|
|
463
|
+
previous.current = pathname;
|
|
464
|
+
setOpenMobile(false);
|
|
465
|
+
}, [pathname, setOpenMobile]);
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
function AppNav({
|
|
469
|
+
nav,
|
|
470
|
+
navLabel,
|
|
471
|
+
renderLink
|
|
472
|
+
}) {
|
|
473
|
+
const { setOpenMobile } = sidebar_js.useSidebar();
|
|
474
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navLabel, children: nav.map((group) => /* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.SidebarGroup, { children: [
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarGroupLabel, { children: group.label }),
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenu, { children: group.items.map((item) => {
|
|
477
|
+
const Icon = item.icon;
|
|
478
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
479
|
+
sidebar_js.SidebarMenuButton,
|
|
480
|
+
{
|
|
481
|
+
isActive: item.active === true,
|
|
482
|
+
tooltip: item.label,
|
|
483
|
+
render: renderLink({
|
|
484
|
+
href: item.href,
|
|
485
|
+
onClick: () => setOpenMobile(false),
|
|
486
|
+
"aria-current": item.active ? "page" : void 0,
|
|
487
|
+
// Children live on the link. The button's render element
|
|
488
|
+
// wins the merge, so a childless anchor would wipe the label.
|
|
489
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": "true" }),
|
|
491
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
492
|
+
] })
|
|
493
|
+
})
|
|
494
|
+
}
|
|
495
|
+
) }, `${group.label}:${item.href}`);
|
|
496
|
+
}) }) })
|
|
497
|
+
] }, group.label)) });
|
|
498
|
+
}
|
|
499
|
+
function AppShell({
|
|
500
|
+
brand,
|
|
501
|
+
nav,
|
|
502
|
+
navLabel = "Main",
|
|
503
|
+
sidebarFooter,
|
|
504
|
+
headerEnd,
|
|
505
|
+
defaultOpen = true,
|
|
506
|
+
pathname,
|
|
507
|
+
renderLink = renderShellLink,
|
|
508
|
+
children,
|
|
509
|
+
className
|
|
510
|
+
}) {
|
|
511
|
+
return /* @__PURE__ */ jsxRuntime.jsx(tooltip_js.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
512
|
+
sidebar_js.SidebarProvider,
|
|
513
|
+
{
|
|
514
|
+
defaultOpen,
|
|
515
|
+
className: cn("h-svh overflow-hidden", className),
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(DismissMobileSidebar, { pathname }),
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.Sidebar, { collapsible: "icon", children: [
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarHeader, { className: "flex h-14 shrink-0 flex-row items-center border-b border-sidebar-border p-2", children: brand }),
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarContent, { children: /* @__PURE__ */ jsxRuntime.jsx(AppNav, { nav, navLabel, renderLink }) }),
|
|
521
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarFooter, { children: sidebarFooter }),
|
|
522
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarRail, {})
|
|
523
|
+
] }),
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.SidebarInset, { className: "h-svh min-h-0 overflow-hidden", children: [
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur", children: [
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarTrigger, { className: "-ml-1" }),
|
|
527
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
528
|
+
separator_js.Separator,
|
|
529
|
+
{
|
|
530
|
+
orientation: "vertical",
|
|
531
|
+
className: "mr-1 data-[orientation=vertical]:h-4"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex min-w-0 items-center gap-2", children: headerEnd })
|
|
535
|
+
] }),
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
537
|
+
] })
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
) });
|
|
541
|
+
}
|
|
542
|
+
function PageContainer({
|
|
543
|
+
children,
|
|
544
|
+
className
|
|
545
|
+
}) {
|
|
546
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
547
|
+
"div",
|
|
548
|
+
{
|
|
549
|
+
className: cn(
|
|
550
|
+
"mx-auto flex w-full max-w-7xl flex-col gap-6 p-4 md:p-6",
|
|
551
|
+
className
|
|
552
|
+
),
|
|
553
|
+
children
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
function NavTabs({
|
|
558
|
+
tabs,
|
|
559
|
+
label = "Sections",
|
|
560
|
+
renderLink = renderShellLink,
|
|
561
|
+
className
|
|
562
|
+
}) {
|
|
563
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
564
|
+
"nav",
|
|
565
|
+
{
|
|
566
|
+
"aria-label": label,
|
|
567
|
+
className: cn("flex items-stretch gap-1 border-b", className),
|
|
568
|
+
children: tabs.map((tab) => {
|
|
569
|
+
const active = tab.active === true;
|
|
570
|
+
const link = renderLink({
|
|
571
|
+
href: tab.href,
|
|
572
|
+
className: cn(
|
|
573
|
+
"-mb-px border-b-2 px-3 py-2 text-sm font-medium whitespace-nowrap transition-colors",
|
|
574
|
+
active ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
575
|
+
),
|
|
576
|
+
"aria-current": active ? "page" : void 0,
|
|
577
|
+
children: tab.label
|
|
578
|
+
});
|
|
579
|
+
return react.cloneElement(link, { key: tab.href });
|
|
580
|
+
})
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
var accountMenuDefaults = {
|
|
585
|
+
menu: "Account menu",
|
|
586
|
+
signOut: "Sign out",
|
|
587
|
+
theme: "Theme",
|
|
588
|
+
language: "Language",
|
|
589
|
+
system: "System",
|
|
590
|
+
light: "Light",
|
|
591
|
+
dark: "Dark"
|
|
592
|
+
};
|
|
593
|
+
function AccountMenu({
|
|
594
|
+
name,
|
|
595
|
+
email,
|
|
596
|
+
organization,
|
|
597
|
+
imageSrc,
|
|
598
|
+
imageAlt = "",
|
|
599
|
+
labels: userLabels,
|
|
600
|
+
languages,
|
|
601
|
+
currentLanguage,
|
|
602
|
+
onLanguageChange,
|
|
603
|
+
onSignOut
|
|
604
|
+
}) {
|
|
605
|
+
const labels = { ...accountMenuDefaults, ...userLabels };
|
|
606
|
+
const { isMobile } = sidebar_js.useSidebar();
|
|
607
|
+
const side = isMobile ? "bottom" : "right";
|
|
608
|
+
const themeLabels = {
|
|
609
|
+
theme: labels.theme,
|
|
610
|
+
system: labels.system,
|
|
611
|
+
light: labels.light,
|
|
612
|
+
dark: labels.dark
|
|
613
|
+
};
|
|
614
|
+
const languageLabels = { language: labels.language };
|
|
615
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
616
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
617
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
618
|
+
{
|
|
619
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
620
|
+
sidebar_js.SidebarMenuButton,
|
|
621
|
+
{
|
|
622
|
+
size: "lg",
|
|
623
|
+
"aria-label": labels.menu,
|
|
624
|
+
className: "data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground"
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsxRuntime.jsxs(avatar_js.Avatar, { className: "size-8", children: [
|
|
629
|
+
imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
630
|
+
avatar_js.AvatarImage,
|
|
631
|
+
{
|
|
632
|
+
src: imageSrc,
|
|
633
|
+
alt: imageAlt,
|
|
634
|
+
width: 32,
|
|
635
|
+
height: 32,
|
|
636
|
+
keepMounted: true
|
|
637
|
+
}
|
|
638
|
+
) : null,
|
|
639
|
+
/* @__PURE__ */ jsxRuntime.jsx(avatar_js.AvatarFallback, { style: avatarFallbackStyle(name), children: getInitials(name) })
|
|
640
|
+
] }),
|
|
641
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "grid min-w-0 flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
|
|
643
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: email }),
|
|
644
|
+
organization ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: organization }) : null
|
|
645
|
+
] }),
|
|
646
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
),
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
651
|
+
dropdownMenu_js.DropdownMenuContent,
|
|
652
|
+
{
|
|
653
|
+
side,
|
|
654
|
+
align: "end",
|
|
655
|
+
className: "w-56 min-w-56",
|
|
656
|
+
children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenuLabel, { className: "font-normal", children: [
|
|
658
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: name }),
|
|
659
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: email }),
|
|
660
|
+
organization ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: organization }) : null
|
|
661
|
+
] }),
|
|
662
|
+
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuSeparator, {}),
|
|
663
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1 px-1.5 py-1", children: [
|
|
664
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, { labels: themeLabels, side, align: "end" }),
|
|
665
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
LanguageSwitcher,
|
|
667
|
+
{
|
|
668
|
+
labels: languageLabels,
|
|
669
|
+
languages,
|
|
670
|
+
currentLanguage,
|
|
671
|
+
onLanguageChange,
|
|
672
|
+
side,
|
|
673
|
+
align: "end"
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] }),
|
|
677
|
+
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuSeparator, {}),
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenuItem, { onClick: onSignOut, children: [
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, {}),
|
|
680
|
+
labels.signOut
|
|
681
|
+
] })
|
|
682
|
+
]
|
|
683
|
+
}
|
|
684
|
+
)
|
|
685
|
+
] }) }) });
|
|
686
|
+
}
|
|
687
|
+
function dataTableMode(loading, count) {
|
|
688
|
+
if (loading) return "loading";
|
|
689
|
+
if (count === 0) return "empty";
|
|
690
|
+
return "rows";
|
|
691
|
+
}
|
|
692
|
+
function DataTableBody({
|
|
693
|
+
mode,
|
|
694
|
+
columns,
|
|
695
|
+
rows,
|
|
696
|
+
rowKey,
|
|
697
|
+
emptyTitle,
|
|
698
|
+
emptyDescription,
|
|
699
|
+
skeletonRows
|
|
700
|
+
}) {
|
|
701
|
+
switch (mode) {
|
|
702
|
+
case "loading":
|
|
703
|
+
return Array.from({ length: skeletonRows }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(table_js.TableRow, { className: DATA_TABLE_ROW_CLASS, children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
704
|
+
table_js.TableCell,
|
|
705
|
+
{
|
|
706
|
+
className: cn("h-14", column.className),
|
|
707
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-full max-w-32" })
|
|
708
|
+
},
|
|
709
|
+
column.key
|
|
710
|
+
)) }, `skeleton-${index}`));
|
|
711
|
+
case "empty":
|
|
712
|
+
return /* @__PURE__ */ jsxRuntime.jsx(table_js.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(table_js.TableCell, { colSpan: Math.max(columns.length, 1), className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
713
|
+
EmptyState,
|
|
714
|
+
{
|
|
715
|
+
variant: "compact",
|
|
716
|
+
title: emptyTitle,
|
|
717
|
+
description: emptyDescription
|
|
718
|
+
}
|
|
719
|
+
) }) });
|
|
720
|
+
case "rows":
|
|
721
|
+
return rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(table_js.TableRow, { className: DATA_TABLE_ROW_CLASS, children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
722
|
+
table_js.TableCell,
|
|
723
|
+
{
|
|
724
|
+
className: cn("h-14", column.className),
|
|
725
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate", children: column.cell(row) })
|
|
726
|
+
},
|
|
727
|
+
column.key
|
|
728
|
+
)) }, rowKey(row)));
|
|
729
|
+
default: {
|
|
730
|
+
const exhaustive = mode;
|
|
731
|
+
throw new Error(`Unhandled table body: ${String(exhaustive)}`);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function DataTable({
|
|
736
|
+
columns,
|
|
737
|
+
rows,
|
|
738
|
+
rowKey,
|
|
739
|
+
toolbar,
|
|
740
|
+
emptyTitle,
|
|
741
|
+
emptyDescription,
|
|
742
|
+
loading = false,
|
|
743
|
+
skeletonRows = 5,
|
|
744
|
+
loadMore,
|
|
745
|
+
label,
|
|
746
|
+
className
|
|
747
|
+
}) {
|
|
748
|
+
const mode = dataTableMode(loading, rows.length);
|
|
749
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-4", className), children: [
|
|
750
|
+
toolbar ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: toolbar }) : null,
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ jsxRuntime.jsxs(table_js.Table, { "aria-label": label, "aria-busy": loading || void 0, children: [
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(table_js.TableHeader, { className: "bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsx(table_js.TableRow, { className: "bg-muted/50 hover:bg-muted/50", children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(table_js.TableHead, { className: column.className, children: column.header }, column.key)) }) }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx(table_js.TableBody, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
754
|
+
DataTableBody,
|
|
755
|
+
{
|
|
756
|
+
mode,
|
|
757
|
+
columns,
|
|
758
|
+
rows,
|
|
759
|
+
rowKey,
|
|
760
|
+
emptyTitle,
|
|
761
|
+
emptyDescription,
|
|
762
|
+
skeletonRows
|
|
763
|
+
}
|
|
764
|
+
) })
|
|
765
|
+
] }) }),
|
|
766
|
+
loadMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-8 justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
767
|
+
button_js.Button,
|
|
768
|
+
{
|
|
769
|
+
type: "button",
|
|
770
|
+
variant: "outline",
|
|
771
|
+
className: "min-w-36",
|
|
772
|
+
disabled: loadMore.pending === true,
|
|
773
|
+
"aria-busy": loadMore.pending || void 0,
|
|
774
|
+
onClick: loadMore.onLoadMore,
|
|
775
|
+
children: loadMore.label
|
|
776
|
+
}
|
|
777
|
+
) }) : null
|
|
778
|
+
] });
|
|
779
|
+
}
|
|
780
|
+
var MIN_VISIBLE_MS = 200;
|
|
781
|
+
var SAFETY_MS = 1e4;
|
|
782
|
+
var ROUTE_LOADING_SELECTOR = "[data-route-loading]";
|
|
783
|
+
var NAV_PROGRESS_CSS = `
|
|
784
|
+
@keyframes nav-progress-indeterminate {
|
|
785
|
+
0% { transform: translateX(-100%); }
|
|
786
|
+
100% { transform: translateX(400%); }
|
|
787
|
+
}
|
|
788
|
+
.nav-progress-indeterminate {
|
|
789
|
+
width: 33%;
|
|
790
|
+
height: 100%;
|
|
791
|
+
animation: nav-progress-indeterminate 1.1s ease-in-out infinite;
|
|
792
|
+
}
|
|
793
|
+
@media (prefers-reduced-motion: reduce) {
|
|
794
|
+
.nav-progress-indeterminate {
|
|
795
|
+
animation: none;
|
|
796
|
+
width: 100%;
|
|
797
|
+
transform: none;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
`;
|
|
801
|
+
var startListeners = /* @__PURE__ */ new Set();
|
|
802
|
+
var navigationSuppressed = false;
|
|
803
|
+
var suppressTimer = 0;
|
|
804
|
+
function normalizeSearch(search) {
|
|
805
|
+
const params = new URLSearchParams(search);
|
|
806
|
+
const entries = [...params.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
807
|
+
const sorted = new URLSearchParams();
|
|
808
|
+
for (const [key, value] of entries) {
|
|
809
|
+
sorted.append(key, value);
|
|
810
|
+
}
|
|
811
|
+
return sorted.toString();
|
|
812
|
+
}
|
|
813
|
+
function routeKey(pathname, search) {
|
|
814
|
+
return `${pathname}?${normalizeSearch(search)}`;
|
|
815
|
+
}
|
|
816
|
+
function routeKeyFromHref(href) {
|
|
817
|
+
try {
|
|
818
|
+
const url = new URL(href, window.location.origin);
|
|
819
|
+
return routeKey(url.pathname, url.search.replace(/^\?/, ""));
|
|
820
|
+
} catch {
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function isShown(element) {
|
|
825
|
+
if (!(element instanceof HTMLElement)) return false;
|
|
826
|
+
if (element.hidden) return false;
|
|
827
|
+
const display = element.style.display || getComputedStyle(element).display;
|
|
828
|
+
if (display === "none") return false;
|
|
829
|
+
const visibility = element.style.visibility || getComputedStyle(element).visibility;
|
|
830
|
+
if (visibility === "hidden") return false;
|
|
831
|
+
if (display === "contents") {
|
|
832
|
+
return Array.from(element.children).some((child) => isShown(child));
|
|
833
|
+
}
|
|
834
|
+
return true;
|
|
835
|
+
}
|
|
836
|
+
function routeLoadingIsActive() {
|
|
837
|
+
for (const node of document.querySelectorAll(ROUTE_LOADING_SELECTOR)) {
|
|
838
|
+
if (isShown(node)) return true;
|
|
839
|
+
}
|
|
840
|
+
return false;
|
|
841
|
+
}
|
|
842
|
+
function suppressNavigationProgress() {
|
|
843
|
+
navigationSuppressed = true;
|
|
844
|
+
window.clearTimeout(suppressTimer);
|
|
845
|
+
suppressTimer = window.setTimeout(() => {
|
|
846
|
+
navigationSuppressed = false;
|
|
847
|
+
}, 0);
|
|
848
|
+
}
|
|
849
|
+
function signalNavigationStart(href) {
|
|
850
|
+
if (navigationSuppressed) return;
|
|
851
|
+
for (const listener of startListeners) {
|
|
852
|
+
listener(href);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function isInternalNavigationClick(event) {
|
|
856
|
+
if (event.button !== 0) return false;
|
|
857
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
const target = event.target;
|
|
861
|
+
if (!(target instanceof Element)) return false;
|
|
862
|
+
const anchor = target.closest("a");
|
|
863
|
+
if (!(anchor instanceof HTMLAnchorElement)) return false;
|
|
864
|
+
if (anchor.target && anchor.target !== "_self") return false;
|
|
865
|
+
if (anchor.hasAttribute("download")) return false;
|
|
866
|
+
const raw = anchor.getAttribute("href");
|
|
867
|
+
if (!raw || raw.startsWith("#") || raw.startsWith("mailto:") || raw.startsWith("tel:")) {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
let url;
|
|
871
|
+
try {
|
|
872
|
+
url = new URL(anchor.href, window.location.href);
|
|
873
|
+
} catch {
|
|
874
|
+
return false;
|
|
875
|
+
}
|
|
876
|
+
if (url.origin !== window.location.origin) return false;
|
|
877
|
+
if (url.pathname === window.location.pathname && url.search === window.location.search) {
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
function NavigationProgress({
|
|
883
|
+
pathname,
|
|
884
|
+
search = "",
|
|
885
|
+
ariaLabel = "Loading",
|
|
886
|
+
forceVisible = false
|
|
887
|
+
}) {
|
|
888
|
+
const [visible, setVisible] = react.useState(forceVisible);
|
|
889
|
+
const [runId, setRunId] = react.useState(0);
|
|
890
|
+
const startedAt = react.useRef(0);
|
|
891
|
+
const startedRoute = react.useRef(null);
|
|
892
|
+
const committedRoute = react.useRef(null);
|
|
893
|
+
react.useEffect(() => {
|
|
894
|
+
committedRoute.current = routeKey(pathname, search);
|
|
895
|
+
}, [pathname, search]);
|
|
896
|
+
react.useEffect(() => {
|
|
897
|
+
if (forceVisible) return;
|
|
898
|
+
function begin(route) {
|
|
899
|
+
if (navigationSuppressed) return;
|
|
900
|
+
startedAt.current = Date.now();
|
|
901
|
+
startedRoute.current = route;
|
|
902
|
+
setRunId((id) => id + 1);
|
|
903
|
+
setVisible(true);
|
|
904
|
+
}
|
|
905
|
+
function onClick(event) {
|
|
906
|
+
if (!isInternalNavigationClick(event)) return;
|
|
907
|
+
begin(committedRoute.current ?? routeKey(pathname, search));
|
|
908
|
+
}
|
|
909
|
+
function onPopState() {
|
|
910
|
+
const landed = routeKey(
|
|
911
|
+
window.location.pathname,
|
|
912
|
+
window.location.search.replace(/^\?/, "")
|
|
913
|
+
);
|
|
914
|
+
if (landed === (committedRoute.current ?? "")) return;
|
|
915
|
+
begin(committedRoute.current ?? "");
|
|
916
|
+
}
|
|
917
|
+
function onStart(href) {
|
|
918
|
+
if (href) {
|
|
919
|
+
const target = routeKeyFromHref(href);
|
|
920
|
+
if (target !== null && target === committedRoute.current) return;
|
|
921
|
+
}
|
|
922
|
+
begin(committedRoute.current ?? routeKey(pathname, search));
|
|
923
|
+
}
|
|
924
|
+
startListeners.add(onStart);
|
|
925
|
+
document.addEventListener("click", onClick, true);
|
|
926
|
+
window.addEventListener("popstate", onPopState);
|
|
927
|
+
return () => {
|
|
928
|
+
startListeners.delete(onStart);
|
|
929
|
+
document.removeEventListener("click", onClick, true);
|
|
930
|
+
window.removeEventListener("popstate", onPopState);
|
|
931
|
+
};
|
|
932
|
+
}, [forceVisible, pathname, search]);
|
|
933
|
+
react.useEffect(() => {
|
|
934
|
+
if (forceVisible || !visible) return;
|
|
935
|
+
const safety = window.setTimeout(() => setVisible(false), SAFETY_MS);
|
|
936
|
+
return () => window.clearTimeout(safety);
|
|
937
|
+
}, [forceVisible, runId, visible]);
|
|
938
|
+
react.useEffect(() => {
|
|
939
|
+
if (forceVisible || !visible) return;
|
|
940
|
+
const started = startedRoute.current;
|
|
941
|
+
if (!started) return;
|
|
942
|
+
let hideTimer = 0;
|
|
943
|
+
let stopped = false;
|
|
944
|
+
let sawLoading = false;
|
|
945
|
+
function hide() {
|
|
946
|
+
if (stopped) return;
|
|
947
|
+
if (routeLoadingIsActive()) {
|
|
948
|
+
sawLoading = true;
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
const routeChanged = routeKey(pathname, search) !== started;
|
|
952
|
+
if (!routeChanged && !sawLoading) return;
|
|
953
|
+
stopped = true;
|
|
954
|
+
const wait = Math.max(
|
|
955
|
+
0,
|
|
956
|
+
MIN_VISIBLE_MS - (Date.now() - startedAt.current)
|
|
957
|
+
);
|
|
958
|
+
hideTimer = window.setTimeout(() => setVisible(false), wait);
|
|
959
|
+
}
|
|
960
|
+
hide();
|
|
961
|
+
const observer = new MutationObserver(hide);
|
|
962
|
+
observer.observe(document.body, {
|
|
963
|
+
childList: true,
|
|
964
|
+
subtree: true,
|
|
965
|
+
attributes: true,
|
|
966
|
+
attributeFilter: ["style", "hidden", "class"]
|
|
967
|
+
});
|
|
968
|
+
return () => {
|
|
969
|
+
stopped = true;
|
|
970
|
+
window.clearTimeout(hideTimer);
|
|
971
|
+
observer.disconnect();
|
|
972
|
+
};
|
|
973
|
+
}, [forceVisible, pathname, search, visible]);
|
|
974
|
+
if (!visible) return null;
|
|
975
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: NAV_PROGRESS_CSS } }),
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
978
|
+
"div",
|
|
979
|
+
{
|
|
980
|
+
role: "progressbar",
|
|
981
|
+
"aria-label": ariaLabel,
|
|
982
|
+
className: "pointer-events-none fixed inset-x-0 top-0 z-[60] h-0.5 overflow-hidden bg-primary/20",
|
|
983
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nav-progress-indeterminate bg-primary" })
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
] });
|
|
987
|
+
}
|
|
988
|
+
function RouteLoading({ children }) {
|
|
989
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-route-loading": "", className: "contents", children });
|
|
990
|
+
}
|
|
991
|
+
function PageTitleSkeleton({
|
|
992
|
+
label,
|
|
993
|
+
action = false
|
|
994
|
+
}) {
|
|
995
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
role: "status",
|
|
999
|
+
"aria-label": label,
|
|
1000
|
+
className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",
|
|
1001
|
+
children: [
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-48" }),
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-72 max-w-full" })
|
|
1005
|
+
] }),
|
|
1006
|
+
action ? /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-9 w-full sm:w-36" }) : null
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
function DataTableSkeletonBody({ rows }) {
|
|
1012
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
1013
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-9 w-full max-w-sm" }),
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden rounded-lg border", children: [
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-10 w-full rounded-none" }),
|
|
1016
|
+
Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
skeleton_js.Skeleton,
|
|
1018
|
+
{
|
|
1019
|
+
className: cn(DATA_TABLE_ROW_CLASS, "w-full rounded-none")
|
|
1020
|
+
},
|
|
1021
|
+
index
|
|
1022
|
+
))
|
|
1023
|
+
] })
|
|
1024
|
+
] });
|
|
1025
|
+
}
|
|
1026
|
+
function DataTableSkeleton({
|
|
1027
|
+
label,
|
|
1028
|
+
rows = 5
|
|
1029
|
+
}) {
|
|
1030
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableSkeletonBody, { rows }) });
|
|
1031
|
+
}
|
|
1032
|
+
function DetailPageSkeleton({ label }) {
|
|
1033
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
role: "status",
|
|
1037
|
+
"aria-label": label,
|
|
1038
|
+
className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]",
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
|
|
1041
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-64 max-w-full" }),
|
|
1042
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-80 max-w-full" }),
|
|
1043
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-40 w-full" })
|
|
1044
|
+
] }),
|
|
1045
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-48 w-full lg:w-[320px]" })
|
|
150
1046
|
]
|
|
151
1047
|
}
|
|
152
1048
|
);
|
|
153
1049
|
}
|
|
1050
|
+
function FormCardSkeleton({
|
|
1051
|
+
label,
|
|
1052
|
+
fields = 4
|
|
1053
|
+
}) {
|
|
1054
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(card_js.Card, { role: "status", "aria-label": label, children: [
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsx(card_js.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-6 w-40" }) }),
|
|
1056
|
+
/* @__PURE__ */ jsxRuntime.jsx(card_js.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2", children: Array.from({ length: fields }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1057
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-24" }),
|
|
1058
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-9 w-full" })
|
|
1059
|
+
] }, index)) }) })
|
|
1060
|
+
] });
|
|
1061
|
+
}
|
|
1062
|
+
function DashboardSkeleton({ label }) {
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "status", "aria-label": label, className: "flex flex-col gap-6", children: [
|
|
1064
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-48" }),
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-64 max-w-full" })
|
|
1067
|
+
] }),
|
|
1068
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-3", children: Array.from({ length: 3 }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(card_js.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(card_js.CardContent, { className: "flex flex-col gap-2", children: [
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-24" }),
|
|
1070
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-16" })
|
|
1071
|
+
] }) }, index)) }),
|
|
1072
|
+
/* @__PURE__ */ jsxRuntime.jsx(DataTableSkeletonBody, { rows: 3 })
|
|
1073
|
+
] });
|
|
1074
|
+
}
|
|
154
1075
|
function Empty2({ className, ...props }) {
|
|
155
1076
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
1077
|
"div",
|
|
@@ -664,321 +1585,121 @@ function EditableSection({
|
|
|
664
1585
|
}),
|
|
665
1586
|
dialog
|
|
666
1587
|
] });
|
|
667
|
-
}
|
|
668
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "editable-section", className: cn("space-y-4", className), children: [
|
|
669
|
-
actions,
|
|
670
|
-
content,
|
|
671
|
-
statusNode,
|
|
672
|
-
dialog
|
|
673
|
-
] });
|
|
674
|
-
}
|
|
675
|
-
function DataList({ className, ...props }) {
|
|
676
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
677
|
-
"dl",
|
|
678
|
-
{
|
|
679
|
-
"data-slot": "data-list",
|
|
680
|
-
className: cn("grid gap-4 sm:grid-cols-2", className),
|
|
681
|
-
...props
|
|
682
|
-
}
|
|
683
|
-
);
|
|
684
|
-
}
|
|
685
|
-
function DataListItem({
|
|
686
|
-
label,
|
|
687
|
-
children,
|
|
688
|
-
empty = "\u2014",
|
|
689
|
-
className,
|
|
690
|
-
labelClassName,
|
|
691
|
-
valueClassName
|
|
692
|
-
}) {
|
|
693
|
-
const isEmpty = children == null || children === false || typeof children === "string" && children.trim().length === 0;
|
|
694
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
695
|
-
"div",
|
|
696
|
-
{
|
|
697
|
-
"data-slot": "data-list-item",
|
|
698
|
-
className: cn("flex flex-col gap-1.5", className),
|
|
699
|
-
children: [
|
|
700
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
701
|
-
"dt",
|
|
702
|
-
{
|
|
703
|
-
className: cn(
|
|
704
|
-
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
705
|
-
labelClassName
|
|
706
|
-
),
|
|
707
|
-
children: label
|
|
708
|
-
}
|
|
709
|
-
),
|
|
710
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
711
|
-
"dd",
|
|
712
|
-
{
|
|
713
|
-
className: cn(
|
|
714
|
-
"text-sm wrap-break-word",
|
|
715
|
-
isEmpty && "text-muted-foreground",
|
|
716
|
-
valueClassName
|
|
717
|
-
),
|
|
718
|
-
children: isEmpty ? empty : children
|
|
719
|
-
}
|
|
720
|
-
)
|
|
721
|
-
]
|
|
722
|
-
}
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
function FieldMessage({
|
|
726
|
-
id,
|
|
727
|
-
children,
|
|
728
|
-
className,
|
|
729
|
-
...props
|
|
730
|
-
}) {
|
|
731
|
-
const hasMessage = children != null && children !== false && !(typeof children === "string" && children.trim().length === 0);
|
|
732
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
733
|
-
"p",
|
|
734
|
-
{
|
|
735
|
-
id,
|
|
736
|
-
role: hasMessage ? "alert" : void 0,
|
|
737
|
-
"data-slot": "field-message",
|
|
738
|
-
className: cn("min-h-5 text-xs text-destructive", className),
|
|
739
|
-
...props,
|
|
740
|
-
children: hasMessage ? children : "\xA0"
|
|
741
|
-
}
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
function isBrokenImage(img) {
|
|
745
|
-
return img.complete && img.naturalWidth === 0;
|
|
746
|
-
}
|
|
747
|
-
function SafeImage({
|
|
748
|
-
src,
|
|
749
|
-
fallback,
|
|
750
|
-
alt = "",
|
|
751
|
-
onError,
|
|
752
|
-
...imgProps
|
|
753
|
-
}) {
|
|
754
|
-
const [failed, setFailed] = react.useState(false);
|
|
755
|
-
const imgRef = react.useRef(null);
|
|
756
|
-
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
757
|
-
react.useLayoutEffect(() => {
|
|
758
|
-
setFailed(false);
|
|
759
|
-
}, [resolvedSrc]);
|
|
760
|
-
react.useLayoutEffect(() => {
|
|
761
|
-
const img = imgRef.current;
|
|
762
|
-
if (img && isBrokenImage(img)) {
|
|
763
|
-
setFailed(true);
|
|
764
|
-
}
|
|
765
|
-
}, [resolvedSrc, failed]);
|
|
766
|
-
if (!resolvedSrc || failed) {
|
|
767
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
768
|
-
}
|
|
769
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
770
|
-
"img",
|
|
771
|
-
{
|
|
772
|
-
...imgProps,
|
|
773
|
-
ref: imgRef,
|
|
774
|
-
src: resolvedSrc,
|
|
775
|
-
alt,
|
|
776
|
-
onError: (event) => {
|
|
777
|
-
setFailed(true);
|
|
778
|
-
onError?.(event);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
);
|
|
782
|
-
}
|
|
783
|
-
var defaultLabels = {
|
|
784
|
-
theme: "Theme",
|
|
785
|
-
system: "System",
|
|
786
|
-
light: "Light",
|
|
787
|
-
dark: "Dark"
|
|
788
|
-
};
|
|
789
|
-
var sizeClasses = {
|
|
790
|
-
sm: { button: "size-8", icon: "size-4" },
|
|
791
|
-
md: { button: "size-8", icon: "size-4" },
|
|
792
|
-
lg: { button: "size-9", icon: "size-4" }
|
|
793
|
-
};
|
|
794
|
-
var shapeClasses = {
|
|
795
|
-
rounded: "rounded-md",
|
|
796
|
-
pill: "rounded-full"
|
|
797
|
-
};
|
|
798
|
-
var iconTriggerClassName = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
799
|
-
var themeIcons = {
|
|
800
|
-
system: lucideReact.Monitor,
|
|
801
|
-
light: lucideReact.Sun,
|
|
802
|
-
dark: lucideReact.Moon
|
|
803
|
-
};
|
|
804
|
-
var themes = [
|
|
805
|
-
{ key: "system", icon: themeIcons.system },
|
|
806
|
-
{ key: "light", icon: themeIcons.light },
|
|
807
|
-
{ key: "dark", icon: themeIcons.dark }
|
|
808
|
-
];
|
|
809
|
-
function storedTheme(value) {
|
|
810
|
-
if (value === "system" || value === "light" || value === "dark") return value;
|
|
811
|
-
return void 0;
|
|
812
|
-
}
|
|
813
|
-
function ThemeSwitcher({
|
|
814
|
-
className,
|
|
815
|
-
size = "sm",
|
|
816
|
-
shape = "rounded",
|
|
817
|
-
align = "end",
|
|
818
|
-
side = "bottom",
|
|
819
|
-
labels: userLabels
|
|
820
|
-
}) {
|
|
821
|
-
const { theme, setTheme } = nextThemes.useTheme();
|
|
822
|
-
const [mounted, setMounted] = react.useState(false);
|
|
823
|
-
const sizes = sizeClasses[size];
|
|
824
|
-
const shapeClass = shapeClasses[shape];
|
|
825
|
-
const labels = { ...defaultLabels, ...userLabels };
|
|
826
|
-
const handleThemeClick = react.useCallback(
|
|
827
|
-
(themeKey) => {
|
|
828
|
-
setTheme(themeKey);
|
|
829
|
-
},
|
|
830
|
-
[setTheme]
|
|
831
|
-
);
|
|
832
|
-
react.useEffect(() => {
|
|
833
|
-
setMounted(true);
|
|
834
|
-
}, []);
|
|
835
|
-
if (!mounted) {
|
|
836
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
837
|
-
"div",
|
|
838
|
-
{
|
|
839
|
-
"aria-hidden": true,
|
|
840
|
-
className: cn(
|
|
841
|
-
sizes.button,
|
|
842
|
-
shapeClass,
|
|
843
|
-
iconTriggerClassName,
|
|
844
|
-
className
|
|
845
|
-
)
|
|
846
|
-
}
|
|
847
|
-
);
|
|
848
|
-
}
|
|
849
|
-
const currentTheme = storedTheme(theme);
|
|
850
|
-
const TriggerIcon = currentTheme ? themeIcons[currentTheme] : lucideReact.Monitor;
|
|
851
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
852
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
853
|
-
dropdownMenu_js.DropdownMenuTrigger,
|
|
854
|
-
{
|
|
855
|
-
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
856
|
-
button_js.Button,
|
|
857
|
-
{
|
|
858
|
-
"data-testid": "theme-switcher",
|
|
859
|
-
variant: "outline",
|
|
860
|
-
size: "icon",
|
|
861
|
-
"aria-label": labels.theme,
|
|
862
|
-
className: cn(
|
|
863
|
-
sizes.button,
|
|
864
|
-
shapeClass,
|
|
865
|
-
iconTriggerClassName,
|
|
866
|
-
className
|
|
867
|
-
)
|
|
868
|
-
}
|
|
869
|
-
),
|
|
870
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { className: sizes.icon })
|
|
871
|
-
}
|
|
872
|
-
),
|
|
873
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
874
|
-
dropdownMenu_js.DropdownMenuContent,
|
|
875
|
-
{
|
|
876
|
-
side,
|
|
877
|
-
align,
|
|
878
|
-
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
879
|
-
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
880
|
-
className: dropdownMenu_js.miniMenuContentClassName,
|
|
881
|
-
children: themes.map(({ key, icon: Icon }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
882
|
-
dropdownMenu_js.DropdownMenuItem,
|
|
883
|
-
{
|
|
884
|
-
onClick: () => handleThemeClick(key),
|
|
885
|
-
className: cn(
|
|
886
|
-
"gap-2 cursor-pointer",
|
|
887
|
-
currentTheme === key && "bg-accent text-accent-foreground [&_svg]:text-accent-foreground"
|
|
888
|
-
),
|
|
889
|
-
children: [
|
|
890
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels[key] })
|
|
892
|
-
]
|
|
893
|
-
},
|
|
894
|
-
key
|
|
895
|
-
))
|
|
896
|
-
}
|
|
897
|
-
)
|
|
1588
|
+
}
|
|
1589
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "editable-section", className: cn("space-y-4", className), children: [
|
|
1590
|
+
actions,
|
|
1591
|
+
content,
|
|
1592
|
+
statusNode,
|
|
1593
|
+
dialog
|
|
898
1594
|
] });
|
|
899
1595
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
var iconTriggerClassName2 = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
915
|
-
function LanguageSwitcher({
|
|
916
|
-
languages: propLanguages,
|
|
917
|
-
currentLanguage: propCurrentLanguage,
|
|
918
|
-
onLanguageChange: propOnLanguageChange,
|
|
919
|
-
labels = {},
|
|
1596
|
+
function DataList({ className, ...props }) {
|
|
1597
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1598
|
+
"dl",
|
|
1599
|
+
{
|
|
1600
|
+
"data-slot": "data-list",
|
|
1601
|
+
className: cn("grid gap-4 sm:grid-cols-2", className),
|
|
1602
|
+
...props
|
|
1603
|
+
}
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
function DataListItem({
|
|
1607
|
+
label,
|
|
1608
|
+
children,
|
|
1609
|
+
empty = "\u2014",
|
|
920
1610
|
className,
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
align = "end",
|
|
924
|
-
side = "bottom"
|
|
1611
|
+
labelClassName,
|
|
1612
|
+
valueClassName
|
|
925
1613
|
}) {
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
const sizes = sizeClasses2[size];
|
|
936
|
-
const shapeClass = shapeClasses2[shape];
|
|
937
|
-
const accessibleName = labels.language ?? "Language";
|
|
938
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
-
dropdownMenu_js.DropdownMenuTrigger,
|
|
941
|
-
{
|
|
942
|
-
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
|
-
button_js.Button,
|
|
1614
|
+
const isEmpty = children == null || children === false || typeof children === "string" && children.trim().length === 0;
|
|
1615
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1616
|
+
"div",
|
|
1617
|
+
{
|
|
1618
|
+
"data-slot": "data-list-item",
|
|
1619
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
1620
|
+
children: [
|
|
1621
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1622
|
+
"dt",
|
|
944
1623
|
{
|
|
945
|
-
variant: "outline",
|
|
946
|
-
size: "icon",
|
|
947
|
-
"aria-label": accessibleName,
|
|
948
1624
|
className: cn(
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
)
|
|
1625
|
+
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
1626
|
+
labelClassName
|
|
1627
|
+
),
|
|
1628
|
+
children: label
|
|
954
1629
|
}
|
|
955
1630
|
),
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
),
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
960
|
-
dropdownMenu_js.DropdownMenuContent,
|
|
961
|
-
{
|
|
962
|
-
side,
|
|
963
|
-
align,
|
|
964
|
-
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
965
|
-
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
966
|
-
className: cn(dropdownMenu_js.miniMenuContentClassName, "min-w-0 w-auto"),
|
|
967
|
-
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
968
|
-
dropdownMenu_js.DropdownMenuItem,
|
|
1631
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1632
|
+
"dd",
|
|
969
1633
|
{
|
|
970
|
-
onClick: () => onLanguageChange?.(key),
|
|
971
1634
|
className: cn(
|
|
972
|
-
"
|
|
973
|
-
|
|
1635
|
+
"text-sm wrap-break-word",
|
|
1636
|
+
isEmpty && "text-muted-foreground",
|
|
1637
|
+
valueClassName
|
|
974
1638
|
),
|
|
975
|
-
children:
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
|
|
1639
|
+
children: isEmpty ? empty : children
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
]
|
|
1643
|
+
}
|
|
1644
|
+
);
|
|
1645
|
+
}
|
|
1646
|
+
function FieldMessage({
|
|
1647
|
+
id,
|
|
1648
|
+
children,
|
|
1649
|
+
className,
|
|
1650
|
+
...props
|
|
1651
|
+
}) {
|
|
1652
|
+
const hasMessage = children != null && children !== false && !(typeof children === "string" && children.trim().length === 0);
|
|
1653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1654
|
+
"p",
|
|
1655
|
+
{
|
|
1656
|
+
id,
|
|
1657
|
+
role: hasMessage ? "alert" : void 0,
|
|
1658
|
+
"data-slot": "field-message",
|
|
1659
|
+
className: cn("min-h-5 text-xs text-destructive", className),
|
|
1660
|
+
...props,
|
|
1661
|
+
children: hasMessage ? children : "\xA0"
|
|
1662
|
+
}
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1665
|
+
function isBrokenImage(img) {
|
|
1666
|
+
return img.complete && img.naturalWidth === 0;
|
|
1667
|
+
}
|
|
1668
|
+
function SafeImage({
|
|
1669
|
+
src,
|
|
1670
|
+
fallback,
|
|
1671
|
+
alt = "",
|
|
1672
|
+
onError,
|
|
1673
|
+
...imgProps
|
|
1674
|
+
}) {
|
|
1675
|
+
const [failed, setFailed] = react.useState(false);
|
|
1676
|
+
const imgRef = react.useRef(null);
|
|
1677
|
+
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
1678
|
+
react.useLayoutEffect(() => {
|
|
1679
|
+
setFailed(false);
|
|
1680
|
+
}, [resolvedSrc]);
|
|
1681
|
+
react.useLayoutEffect(() => {
|
|
1682
|
+
const img = imgRef.current;
|
|
1683
|
+
if (img && isBrokenImage(img)) {
|
|
1684
|
+
setFailed(true);
|
|
1685
|
+
}
|
|
1686
|
+
}, [resolvedSrc, failed]);
|
|
1687
|
+
if (!resolvedSrc || failed) {
|
|
1688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
1689
|
+
}
|
|
1690
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1691
|
+
"img",
|
|
1692
|
+
{
|
|
1693
|
+
...imgProps,
|
|
1694
|
+
ref: imgRef,
|
|
1695
|
+
src: resolvedSrc,
|
|
1696
|
+
alt,
|
|
1697
|
+
onError: (event) => {
|
|
1698
|
+
setFailed(true);
|
|
1699
|
+
onError?.(event);
|
|
979
1700
|
}
|
|
980
|
-
|
|
981
|
-
|
|
1701
|
+
}
|
|
1702
|
+
);
|
|
982
1703
|
}
|
|
983
1704
|
var DEFAULT_LABELS = {
|
|
984
1705
|
uploadAria: "Upload image",
|
|
@@ -2349,87 +3070,6 @@ function useMediaQuery2(query) {
|
|
|
2349
3070
|
}, [query]);
|
|
2350
3071
|
return matches;
|
|
2351
3072
|
}
|
|
2352
|
-
|
|
2353
|
-
// src/lib/avatar.ts
|
|
2354
|
-
var EMPTY_COLORS = {
|
|
2355
|
-
backgroundColor: "#9ca3af",
|
|
2356
|
-
color: "#111111"
|
|
2357
|
-
};
|
|
2358
|
-
var AVATAR_PALETTE = [
|
|
2359
|
-
"#4f6d8c",
|
|
2360
|
-
// slate blue
|
|
2361
|
-
"#3d7a6a",
|
|
2362
|
-
// teal
|
|
2363
|
-
"#6b5b8a",
|
|
2364
|
-
// muted purple
|
|
2365
|
-
"#8a5a4a",
|
|
2366
|
-
// warm brown
|
|
2367
|
-
"#4a7a8a",
|
|
2368
|
-
// steel cyan
|
|
2369
|
-
"#7a6b4a",
|
|
2370
|
-
// olive
|
|
2371
|
-
"#5a6b8a",
|
|
2372
|
-
// periwinkle
|
|
2373
|
-
"#8a4a5a",
|
|
2374
|
-
// rose
|
|
2375
|
-
"#4a8a6b",
|
|
2376
|
-
// green
|
|
2377
|
-
"#6b4a7a",
|
|
2378
|
-
// plum
|
|
2379
|
-
"#8a6b4a",
|
|
2380
|
-
// amber brown
|
|
2381
|
-
"#4a5a8a",
|
|
2382
|
-
// indigo
|
|
2383
|
-
"#7a4a6b",
|
|
2384
|
-
// mauve
|
|
2385
|
-
"#5a8a4a",
|
|
2386
|
-
// leaf
|
|
2387
|
-
"#8a5a7a",
|
|
2388
|
-
// dusty pink
|
|
2389
|
-
"#3d6b7a"
|
|
2390
|
-
// deep teal
|
|
2391
|
-
];
|
|
2392
|
-
function hashString(input) {
|
|
2393
|
-
let hash = 2166136261;
|
|
2394
|
-
for (let i = 0; i < input.length; i++) {
|
|
2395
|
-
hash ^= input.charCodeAt(i);
|
|
2396
|
-
hash = Math.imul(hash, 16777619);
|
|
2397
|
-
}
|
|
2398
|
-
return hash >>> 0;
|
|
2399
|
-
}
|
|
2400
|
-
function srgbToLinear(channel) {
|
|
2401
|
-
const c = channel / 255;
|
|
2402
|
-
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
2403
|
-
}
|
|
2404
|
-
function relativeLuminance(hex) {
|
|
2405
|
-
const normalized = hex.replace("#", "");
|
|
2406
|
-
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
2407
|
-
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
2408
|
-
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
2409
|
-
return 0.2126 * srgbToLinear(r) + 0.7152 * srgbToLinear(g) + 0.0722 * srgbToLinear(b);
|
|
2410
|
-
}
|
|
2411
|
-
function contrastingTextColor(backgroundHex) {
|
|
2412
|
-
return relativeLuminance(backgroundHex) > 0.179 ? "#111111" : "#ffffff";
|
|
2413
|
-
}
|
|
2414
|
-
function getInitials(name, max = 2) {
|
|
2415
|
-
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
2416
|
-
if (parts.length === 0) return "?";
|
|
2417
|
-
return parts.slice(0, Math.max(1, max)).map((part) => part.charAt(0)).join("").toUpperCase();
|
|
2418
|
-
}
|
|
2419
|
-
function getAvatarColors(name) {
|
|
2420
|
-
const normalized = name.trim().toLowerCase();
|
|
2421
|
-
if (!normalized) {
|
|
2422
|
-
return { ...EMPTY_COLORS };
|
|
2423
|
-
}
|
|
2424
|
-
const backgroundColor = AVATAR_PALETTE[hashString(normalized) % AVATAR_PALETTE.length];
|
|
2425
|
-
return {
|
|
2426
|
-
backgroundColor,
|
|
2427
|
-
color: contrastingTextColor(backgroundColor)
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
function avatarFallbackStyle(name) {
|
|
2431
|
-
return getAvatarColors(name);
|
|
2432
|
-
}
|
|
2433
3073
|
function StatHighlightCard({
|
|
2434
3074
|
label,
|
|
2435
3075
|
value,
|
|
@@ -3470,6 +4110,8 @@ function MatchReview({
|
|
|
3470
4110
|
);
|
|
3471
4111
|
}
|
|
3472
4112
|
|
|
4113
|
+
exports.AccountMenu = AccountMenu;
|
|
4114
|
+
exports.AppShell = AppShell;
|
|
3473
4115
|
exports.AuditTimeline = AuditTimeline;
|
|
3474
4116
|
exports.AvatarEditor = AvatarEditor;
|
|
3475
4117
|
exports.AvatarEditorDialog = AvatarEditorDialog;
|
|
@@ -3479,6 +4121,7 @@ exports.COOKIE_CONSENT_VALUES = COOKIE_CONSENT_VALUES;
|
|
|
3479
4121
|
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
3480
4122
|
exports.CookieConsentBanner = CookieConsentBanner;
|
|
3481
4123
|
exports.CostBreakdownCard = CostBreakdownCard;
|
|
4124
|
+
exports.DATA_TABLE_ROW_CLASS = DATA_TABLE_ROW_CLASS;
|
|
3482
4125
|
exports.DEFAULT_AUDIT_TIMELINE_LABELS = DEFAULT_AUDIT_TIMELINE_LABELS;
|
|
3483
4126
|
exports.DEFAULT_COOKIE_CONSENT_BANNER_LABELS = DEFAULT_COOKIE_CONSENT_BANNER_LABELS;
|
|
3484
4127
|
exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
|
|
@@ -3491,8 +4134,12 @@ exports.DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS = DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS;
|
|
|
3491
4134
|
exports.DEFAULT_MATCH_REVIEW_LABELS = DEFAULT_MATCH_REVIEW_LABELS;
|
|
3492
4135
|
exports.DEFAULT_NOTIFICATION_BELL_LABELS = DEFAULT_NOTIFICATION_BELL_LABELS;
|
|
3493
4136
|
exports.DEFAULT_RISK_BADGE_LABELS = DEFAULT_RISK_BADGE_LABELS;
|
|
4137
|
+
exports.DashboardSkeleton = DashboardSkeleton;
|
|
3494
4138
|
exports.DataList = DataList;
|
|
3495
4139
|
exports.DataListItem = DataListItem;
|
|
4140
|
+
exports.DataTable = DataTable;
|
|
4141
|
+
exports.DataTableSkeleton = DataTableSkeleton;
|
|
4142
|
+
exports.DetailPageSkeleton = DetailPageSkeleton;
|
|
3496
4143
|
exports.DimensionBreakdownTable = DimensionBreakdownTable;
|
|
3497
4144
|
exports.EditableSection = EditableSection;
|
|
3498
4145
|
exports.Empty = Empty2;
|
|
@@ -3509,6 +4156,7 @@ exports.FieldMessage = FieldMessage;
|
|
|
3509
4156
|
exports.FileDropzone = FileDropzone;
|
|
3510
4157
|
exports.FileUploadMenu = FileUploadMenu;
|
|
3511
4158
|
exports.FileUploadTray = FileUploadTray;
|
|
4159
|
+
exports.FormCardSkeleton = FormCardSkeleton;
|
|
3512
4160
|
exports.LanguageContext = LanguageContext;
|
|
3513
4161
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
3514
4162
|
exports.LegalAcceptCheckbox = LegalAcceptCheckbox;
|
|
@@ -3520,9 +4168,14 @@ exports.MatchReview = MatchReview;
|
|
|
3520
4168
|
exports.MetricChartCard = MetricChartCard;
|
|
3521
4169
|
exports.MetricEmptyState = MetricEmptyState;
|
|
3522
4170
|
exports.MetricSkeleton = MetricSkeleton;
|
|
4171
|
+
exports.NavTabs = NavTabs;
|
|
4172
|
+
exports.NavigationProgress = NavigationProgress;
|
|
3523
4173
|
exports.NotificationBell = NotificationBell;
|
|
4174
|
+
exports.PageContainer = PageContainer;
|
|
3524
4175
|
exports.PageTitle = PageTitle;
|
|
4176
|
+
exports.PageTitleSkeleton = PageTitleSkeleton;
|
|
3525
4177
|
exports.RiskBadge = RiskBadge;
|
|
4178
|
+
exports.RouteLoading = RouteLoading;
|
|
3526
4179
|
exports.SafeImage = SafeImage;
|
|
3527
4180
|
exports.SparklineStat = SparklineStat;
|
|
3528
4181
|
exports.StatHighlightCard = StatHighlightCard;
|
|
@@ -3549,8 +4202,11 @@ exports.parseCookieConsent = parseCookieConsent;
|
|
|
3549
4202
|
exports.partRanges = partRanges;
|
|
3550
4203
|
exports.progressFromBytes = progressFromBytes;
|
|
3551
4204
|
exports.readCookieConsent = readCookieConsent;
|
|
4205
|
+
exports.renderShellLink = renderShellLink;
|
|
3552
4206
|
exports.serializeCookieConsent = serializeCookieConsent;
|
|
4207
|
+
exports.signalNavigationStart = signalNavigationStart;
|
|
3553
4208
|
exports.sourceUrlIsHttps = sourceUrlIsHttps;
|
|
4209
|
+
exports.suppressNavigationProgress = suppressNavigationProgress;
|
|
3554
4210
|
exports.useEditableSection = useEditableSection;
|
|
3555
4211
|
exports.useLanguageContext = useLanguageContext;
|
|
3556
4212
|
exports.useMediaQuery = useMediaQuery2;
|