@yenio-pld/blocks 1.2.0-rc.8 → 1.2.0-rc.9
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 +1509 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +392 -78
- package/dist/index.d.ts +392 -78
- package/dist/index.js +1404 -114
- package/dist/index.js.map +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/button.js +7 -1
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/checkbox.d.ts +16 -0
- package/dist/ui/checkbox.js +66 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dialog.js +27 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/select.js +24 -17
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sheet.js +3 -3
- package/dist/ui/sheet.js.map +1 -1
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React3 = require('react');
|
|
5
5
|
var skeleton_js = require('./ui/skeleton.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var lucideReact = require('lucide-react');
|
|
@@ -12,6 +12,7 @@ var button_js = require('./ui/button.js');
|
|
|
12
12
|
var dropdownMenu_js = require('./ui/dropdown-menu.js');
|
|
13
13
|
var empty_js = require('./ui/empty.js');
|
|
14
14
|
var separator_js = require('./ui/separator.js');
|
|
15
|
+
var collapsible_js = require('./ui/collapsible.js');
|
|
15
16
|
var sidebar_js = require('./ui/sidebar.js');
|
|
16
17
|
var table_js = require('./ui/table.js');
|
|
17
18
|
var tooltip_js = require('./ui/tooltip.js');
|
|
@@ -20,11 +21,13 @@ var classVarianceAuthority = require('class-variance-authority');
|
|
|
20
21
|
var alertDialog_js = require('./ui/alert-dialog.js');
|
|
21
22
|
var nextThemes = require('next-themes');
|
|
22
23
|
var combobox_js = require('./ui/combobox.js');
|
|
24
|
+
var drawer_js = require('./ui/drawer.js');
|
|
25
|
+
var input_js = require('./ui/input.js');
|
|
23
26
|
var slider_js = require('./ui/slider.js');
|
|
24
27
|
var toggle_js = require('./ui/toggle.js');
|
|
25
28
|
var dialog_js = require('./ui/dialog.js');
|
|
26
|
-
var drawer_js = require('./ui/drawer.js');
|
|
27
29
|
var framerMotion = require('framer-motion');
|
|
30
|
+
var badge_js = require('./ui/badge.js');
|
|
28
31
|
|
|
29
32
|
function _interopNamespace(e) {
|
|
30
33
|
if (e && e.__esModule) return e;
|
|
@@ -44,11 +47,11 @@ function _interopNamespace(e) {
|
|
|
44
47
|
return Object.freeze(n);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
var
|
|
50
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
48
51
|
|
|
49
|
-
var LanguageContext =
|
|
52
|
+
var LanguageContext = React3.createContext(null);
|
|
50
53
|
function useLanguageContext() {
|
|
51
|
-
return
|
|
54
|
+
return React3.useContext(LanguageContext);
|
|
52
55
|
}
|
|
53
56
|
function PageTitle({
|
|
54
57
|
title,
|
|
@@ -176,7 +179,7 @@ function cn(...inputs) {
|
|
|
176
179
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
177
180
|
}
|
|
178
181
|
function LoadingState({
|
|
179
|
-
label
|
|
182
|
+
label,
|
|
180
183
|
className
|
|
181
184
|
}) {
|
|
182
185
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -184,13 +187,20 @@ function LoadingState({
|
|
|
184
187
|
{
|
|
185
188
|
role: "status",
|
|
186
189
|
"aria-live": "polite",
|
|
190
|
+
"aria-busy": "true",
|
|
187
191
|
className: cn(
|
|
188
192
|
"flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground",
|
|
189
193
|
className
|
|
190
194
|
),
|
|
191
195
|
children: [
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
-
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
lucideReact.Loader2,
|
|
198
|
+
{
|
|
199
|
+
className: "size-4 animate-spin motion-reduce:animate-none",
|
|
200
|
+
"aria-hidden": "true"
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "\u2026" })
|
|
194
204
|
]
|
|
195
205
|
}
|
|
196
206
|
);
|
|
@@ -234,7 +244,7 @@ function EmptyState({
|
|
|
234
244
|
{
|
|
235
245
|
className: cn(
|
|
236
246
|
"gap-3",
|
|
237
|
-
isCompact ? "flex-none rounded-none px-4 py-
|
|
247
|
+
isCompact ? "flex-none rounded-none px-4 py-8" : "flex-none rounded-xl border border-dashed px-6 py-12",
|
|
238
248
|
className
|
|
239
249
|
),
|
|
240
250
|
children: [
|
|
@@ -260,9 +270,9 @@ function EmptyState({
|
|
|
260
270
|
children: title
|
|
261
271
|
}
|
|
262
272
|
),
|
|
263
|
-
description ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyDescription, { className: "mt-0", children: description }) : null
|
|
273
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyDescription, { className: "mt-0 max-w-sm", children: description }) : null
|
|
264
274
|
] }),
|
|
265
|
-
action ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyContent, { className: "gap-0", children: action }) : null
|
|
275
|
+
action ? /* @__PURE__ */ jsxRuntime.jsx(empty_js.EmptyContent, { className: "mt-1 gap-0", children: action }) : null
|
|
266
276
|
]
|
|
267
277
|
}
|
|
268
278
|
);
|
|
@@ -278,50 +288,106 @@ function renderShellLink({
|
|
|
278
288
|
}
|
|
279
289
|
function DismissMobileSidebar({ pathname }) {
|
|
280
290
|
const { setOpenMobile } = sidebar_js.useSidebar();
|
|
281
|
-
const previous =
|
|
282
|
-
|
|
291
|
+
const previous = React3.useRef(pathname);
|
|
292
|
+
React3.useEffect(() => {
|
|
283
293
|
if (previous.current === pathname) return;
|
|
284
294
|
previous.current = pathname;
|
|
285
295
|
setOpenMobile(false);
|
|
286
296
|
}, [pathname, setOpenMobile]);
|
|
287
297
|
return null;
|
|
288
298
|
}
|
|
299
|
+
function AppNavItems({
|
|
300
|
+
group,
|
|
301
|
+
renderLink,
|
|
302
|
+
setOpenMobile
|
|
303
|
+
}) {
|
|
304
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenu, { children: group.items.map((item) => {
|
|
305
|
+
const Icon = item.icon;
|
|
306
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
307
|
+
sidebar_js.SidebarMenuButton,
|
|
308
|
+
{
|
|
309
|
+
isActive: item.active === true,
|
|
310
|
+
tooltip: item.label,
|
|
311
|
+
render: renderLink({
|
|
312
|
+
href: item.href,
|
|
313
|
+
onClick: () => setOpenMobile(false),
|
|
314
|
+
"aria-current": item.active ? "page" : void 0,
|
|
315
|
+
// Children live on the link. The button's render element
|
|
316
|
+
// wins the merge, so a childless anchor would wipe the label.
|
|
317
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { "aria-hidden": "true" }),
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
320
|
+
] })
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
) }, `${group.label}:${item.href}`);
|
|
324
|
+
}) });
|
|
325
|
+
}
|
|
289
326
|
function AppNav({
|
|
290
327
|
nav,
|
|
291
328
|
navLabel,
|
|
292
329
|
renderLink
|
|
293
330
|
}) {
|
|
294
331
|
const { setOpenMobile } = sidebar_js.useSidebar();
|
|
295
|
-
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navLabel, children: nav.map((group) =>
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
332
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": navLabel, children: nav.map((group) => {
|
|
333
|
+
if (!group.collapsible) {
|
|
334
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.SidebarGroup, { children: [
|
|
335
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarGroupLabel, { children: group.label }),
|
|
336
|
+
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
|
+
AppNavItems,
|
|
338
|
+
{
|
|
339
|
+
group,
|
|
340
|
+
renderLink,
|
|
341
|
+
setOpenMobile
|
|
342
|
+
}
|
|
343
|
+
) })
|
|
344
|
+
] }, group.label);
|
|
345
|
+
}
|
|
346
|
+
const anyActive = group.items.some((item) => item.active === true);
|
|
347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
+
collapsible_js.Collapsible,
|
|
349
|
+
{
|
|
350
|
+
defaultOpen: group.defaultOpen ?? anyActive,
|
|
351
|
+
className: "group/collapsible",
|
|
352
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.SidebarGroup, { children: [
|
|
353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
354
|
+
sidebar_js.SidebarGroupLabel,
|
|
355
|
+
{
|
|
356
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(collapsible_js.CollapsibleTrigger, { className: "flex w-full items-center gap-1" }),
|
|
357
|
+
children: [
|
|
358
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: group.label }),
|
|
359
|
+
group.badge !== void 0 && group.badge !== "" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md bg-sidebar-accent px-1.5 text-[0.65rem] font-medium tabular-nums text-sidebar-accent-foreground", children: group.badge }) : null,
|
|
360
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
+
lucideReact.ChevronDown,
|
|
362
|
+
{
|
|
363
|
+
"aria-hidden": "true",
|
|
364
|
+
className: "size-3.5 shrink-0 transition-transform group-data-[panel-open]/collapsible:rotate-180"
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ jsxRuntime.jsx(collapsible_js.CollapsibleContent, { children: /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
371
|
+
AppNavItems,
|
|
372
|
+
{
|
|
373
|
+
group,
|
|
374
|
+
renderLink,
|
|
375
|
+
setOpenMobile
|
|
376
|
+
}
|
|
377
|
+
) }) })
|
|
378
|
+
] })
|
|
379
|
+
},
|
|
380
|
+
group.label
|
|
381
|
+
);
|
|
382
|
+
}) });
|
|
319
383
|
}
|
|
320
384
|
function AppShell({
|
|
321
385
|
brand,
|
|
322
386
|
nav,
|
|
323
387
|
navLabel = "Main",
|
|
324
388
|
sidebarFooter,
|
|
389
|
+
headerStart,
|
|
390
|
+
headerMiddle,
|
|
325
391
|
headerEnd,
|
|
326
392
|
defaultOpen = true,
|
|
327
393
|
pathname,
|
|
@@ -343,7 +409,7 @@ function AppShell({
|
|
|
343
409
|
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarRail, {})
|
|
344
410
|
] }),
|
|
345
411
|
/* @__PURE__ */ jsxRuntime.jsxs(sidebar_js.SidebarInset, { className: "h-svh min-h-0 overflow-hidden", children: [
|
|
346
|
-
/* @__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: [
|
|
412
|
+
/* @__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 supports-[backdrop-filter]:bg-background/80", children: [
|
|
347
413
|
/* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarTrigger, { className: "-ml-1" }),
|
|
348
414
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
349
415
|
separator_js.Separator,
|
|
@@ -352,7 +418,18 @@ function AppShell({
|
|
|
352
418
|
className: "mr-1 data-[orientation=vertical]:h-4"
|
|
353
419
|
}
|
|
354
420
|
),
|
|
355
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
421
|
+
headerStart ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: headerStart }) : null,
|
|
422
|
+
headerMiddle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: headerMiddle }) : null,
|
|
423
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
424
|
+
"div",
|
|
425
|
+
{
|
|
426
|
+
className: cn(
|
|
427
|
+
"flex items-center gap-2",
|
|
428
|
+
headerMiddle ? "shrink-0" : "min-w-0 flex-1"
|
|
429
|
+
),
|
|
430
|
+
children: headerEnd
|
|
431
|
+
}
|
|
432
|
+
)
|
|
356
433
|
] }),
|
|
357
434
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
358
435
|
] })
|
|
@@ -388,6 +465,10 @@ function NavTabs({
|
|
|
388
465
|
className: cn("flex items-stretch gap-1 border-b", className),
|
|
389
466
|
children: tabs.map((tab) => {
|
|
390
467
|
const active = tab.active === true;
|
|
468
|
+
const label2 = typeof tab.count === "number" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
469
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: tab.label }),
|
|
470
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium tabular-nums text-muted-foreground", children: tab.count })
|
|
471
|
+
] }) : tab.label;
|
|
391
472
|
const link = renderLink({
|
|
392
473
|
href: tab.href,
|
|
393
474
|
className: cn(
|
|
@@ -395,9 +476,9 @@ function NavTabs({
|
|
|
395
476
|
active ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
396
477
|
),
|
|
397
478
|
"aria-current": active ? "page" : void 0,
|
|
398
|
-
children:
|
|
479
|
+
children: label2
|
|
399
480
|
});
|
|
400
|
-
return
|
|
481
|
+
return React3.cloneElement(link, { key: tab.href });
|
|
401
482
|
})
|
|
402
483
|
}
|
|
403
484
|
);
|
|
@@ -581,18 +662,76 @@ function DataTable({
|
|
|
581
662
|
}
|
|
582
663
|
) })
|
|
583
664
|
] }) }),
|
|
584
|
-
loadMore ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
665
|
+
loadMore ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
LoadMoreControls,
|
|
667
|
+
{
|
|
668
|
+
label: loadMore.label,
|
|
669
|
+
pending: loadMore.pending === true,
|
|
670
|
+
onLoadMore: loadMore.onLoadMore
|
|
671
|
+
}
|
|
672
|
+
) : null
|
|
673
|
+
] });
|
|
674
|
+
}
|
|
675
|
+
function LoadMoreControls({
|
|
676
|
+
label,
|
|
677
|
+
pending,
|
|
678
|
+
onLoadMore
|
|
679
|
+
}) {
|
|
680
|
+
const sentinelRef = React3.useRef(null);
|
|
681
|
+
const pendingRef = React3.useRef(pending);
|
|
682
|
+
const onLoadMoreRef = React3.useRef(onLoadMore);
|
|
683
|
+
const armedRef = React3.useRef(true);
|
|
684
|
+
const wasPendingRef = React3.useRef(false);
|
|
685
|
+
pendingRef.current = pending;
|
|
686
|
+
onLoadMoreRef.current = onLoadMore;
|
|
687
|
+
React3.useEffect(() => {
|
|
688
|
+
const node = sentinelRef.current;
|
|
689
|
+
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
690
|
+
function maybeLoad() {
|
|
691
|
+
if (pendingRef.current || !armedRef.current) return;
|
|
692
|
+
armedRef.current = false;
|
|
693
|
+
onLoadMoreRef.current();
|
|
694
|
+
}
|
|
695
|
+
const observer = new IntersectionObserver(
|
|
696
|
+
(entries) => {
|
|
697
|
+
if (!entries.some((entry) => entry.isIntersecting)) return;
|
|
698
|
+
maybeLoad();
|
|
699
|
+
},
|
|
700
|
+
{ root: null, rootMargin: "240px 0px", threshold: 0 }
|
|
701
|
+
);
|
|
702
|
+
observer.observe(node);
|
|
703
|
+
return () => observer.disconnect();
|
|
704
|
+
}, []);
|
|
705
|
+
React3.useEffect(() => {
|
|
706
|
+
if (pending) {
|
|
707
|
+
wasPendingRef.current = true;
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
if (!wasPendingRef.current) return;
|
|
711
|
+
wasPendingRef.current = false;
|
|
712
|
+
armedRef.current = true;
|
|
713
|
+
const node = sentinelRef.current;
|
|
714
|
+
if (!node) return;
|
|
715
|
+
const rect = node.getBoundingClientRect();
|
|
716
|
+
if (rect.top < (typeof window !== "undefined" ? window.innerHeight : 0) + 240) {
|
|
717
|
+
armedRef.current = false;
|
|
718
|
+
onLoadMoreRef.current();
|
|
719
|
+
}
|
|
720
|
+
}, [pending]);
|
|
721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-8 flex-col items-center gap-3", children: [
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: sentinelRef, className: "h-px w-full", "aria-hidden": true }),
|
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
585
724
|
button_js.Button,
|
|
586
725
|
{
|
|
587
726
|
type: "button",
|
|
588
727
|
variant: "outline",
|
|
589
728
|
className: "min-w-36",
|
|
590
|
-
disabled:
|
|
591
|
-
"aria-busy":
|
|
592
|
-
onClick:
|
|
593
|
-
children:
|
|
729
|
+
disabled: pending,
|
|
730
|
+
"aria-busy": pending || void 0,
|
|
731
|
+
onClick: onLoadMore,
|
|
732
|
+
children: label
|
|
594
733
|
}
|
|
595
|
-
)
|
|
734
|
+
)
|
|
596
735
|
] });
|
|
597
736
|
}
|
|
598
737
|
var MIN_VISIBLE_MS = 200;
|
|
@@ -703,15 +842,15 @@ function NavigationProgress({
|
|
|
703
842
|
ariaLabel = "Loading",
|
|
704
843
|
forceVisible = false
|
|
705
844
|
}) {
|
|
706
|
-
const [visible, setVisible] =
|
|
707
|
-
const [runId, setRunId] =
|
|
708
|
-
const startedAt =
|
|
709
|
-
const startedRoute =
|
|
710
|
-
const committedRoute =
|
|
711
|
-
|
|
845
|
+
const [visible, setVisible] = React3.useState(forceVisible);
|
|
846
|
+
const [runId, setRunId] = React3.useState(0);
|
|
847
|
+
const startedAt = React3.useRef(0);
|
|
848
|
+
const startedRoute = React3.useRef(null);
|
|
849
|
+
const committedRoute = React3.useRef(null);
|
|
850
|
+
React3.useEffect(() => {
|
|
712
851
|
committedRoute.current = routeKey(pathname, search);
|
|
713
852
|
}, [pathname, search]);
|
|
714
|
-
|
|
853
|
+
React3.useEffect(() => {
|
|
715
854
|
if (forceVisible) return;
|
|
716
855
|
function begin(route) {
|
|
717
856
|
if (navigationSuppressed) return;
|
|
@@ -748,12 +887,12 @@ function NavigationProgress({
|
|
|
748
887
|
window.removeEventListener("popstate", onPopState);
|
|
749
888
|
};
|
|
750
889
|
}, [forceVisible, pathname, search]);
|
|
751
|
-
|
|
890
|
+
React3.useEffect(() => {
|
|
752
891
|
if (forceVisible || !visible) return;
|
|
753
892
|
const safety = window.setTimeout(() => setVisible(false), SAFETY_MS);
|
|
754
893
|
return () => window.clearTimeout(safety);
|
|
755
894
|
}, [forceVisible, runId, visible]);
|
|
756
|
-
|
|
895
|
+
React3.useEffect(() => {
|
|
757
896
|
if (forceVisible || !visible) return;
|
|
758
897
|
const started = startedRoute.current;
|
|
759
898
|
if (!started) return;
|
|
@@ -848,22 +987,30 @@ function DataTableSkeleton({
|
|
|
848
987
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableSkeletonBody, { rows }) });
|
|
849
988
|
}
|
|
850
989
|
function DetailPageSkeleton({ label }) {
|
|
851
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
852
|
-
"div",
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
children: [
|
|
858
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
|
|
859
|
-
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-64 max-w-full" }),
|
|
860
|
-
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-80 max-w-full" }),
|
|
861
|
-
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-40 w-full" })
|
|
990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "status", "aria-label": label, className: "flex flex-col gap-6", children: [
|
|
991
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
992
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
993
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
994
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-56 max-w-full" }),
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-5 w-16 rounded-full" })
|
|
862
996
|
] }),
|
|
863
|
-
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-
|
|
864
|
-
]
|
|
865
|
-
|
|
866
|
-
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-4 w-72 max-w-full" })
|
|
998
|
+
] }),
|
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
1000
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-9 w-24" }),
|
|
1001
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-9 w-28" })
|
|
1002
|
+
] })
|
|
1003
|
+
] }),
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-12 w-full" }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-12 w-full" }),
|
|
1007
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-12 w-full" })
|
|
1008
|
+
] }),
|
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]", children: [
|
|
1010
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-40 w-full" }) }),
|
|
1011
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-48 w-full lg:w-[320px]" })
|
|
1012
|
+
] })
|
|
1013
|
+
] });
|
|
867
1014
|
}
|
|
868
1015
|
function FormCardSkeleton({
|
|
869
1016
|
label,
|
|
@@ -988,6 +1135,7 @@ function ConfirmDestructiveDialog({
|
|
|
988
1135
|
description,
|
|
989
1136
|
confirmLabel = "Delete",
|
|
990
1137
|
cancelLabel = "Cancel",
|
|
1138
|
+
destructive = true,
|
|
991
1139
|
onConfirm
|
|
992
1140
|
}) {
|
|
993
1141
|
return /* @__PURE__ */ jsxRuntime.jsx(alertDialog_js.AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(alertDialog_js.AlertDialogContent, { size: "sm", children: [
|
|
@@ -1000,7 +1148,7 @@ function ConfirmDestructiveDialog({
|
|
|
1000
1148
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
1149
|
alertDialog_js.AlertDialogAction,
|
|
1002
1150
|
{
|
|
1003
|
-
variant: "destructive",
|
|
1151
|
+
variant: destructive ? "destructive" : "default",
|
|
1004
1152
|
onClick: () => {
|
|
1005
1153
|
onConfirm();
|
|
1006
1154
|
onOpenChange(false);
|
|
@@ -1173,20 +1321,20 @@ function useEditableSection({
|
|
|
1173
1321
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
1174
1322
|
...labels
|
|
1175
1323
|
};
|
|
1176
|
-
const [mode, setMode] =
|
|
1177
|
-
const [status, setStatus] =
|
|
1178
|
-
const [confirmOpen, setConfirmOpen] =
|
|
1179
|
-
const [minHeightPx, setMinHeightPx] =
|
|
1180
|
-
const contentRef =
|
|
1181
|
-
const editButtonRef =
|
|
1182
|
-
const measuredHeightRef =
|
|
1183
|
-
const shouldFocusEditRef =
|
|
1184
|
-
const shouldFocusFirstFieldRef =
|
|
1185
|
-
const editButtonId =
|
|
1186
|
-
const contentFormId =
|
|
1324
|
+
const [mode, setMode] = React3.useState("reading");
|
|
1325
|
+
const [status, setStatus] = React3.useState(null);
|
|
1326
|
+
const [confirmOpen, setConfirmOpen] = React3.useState(false);
|
|
1327
|
+
const [minHeightPx, setMinHeightPx] = React3.useState(void 0);
|
|
1328
|
+
const contentRef = React3.useRef(null);
|
|
1329
|
+
const editButtonRef = React3.useRef(null);
|
|
1330
|
+
const measuredHeightRef = React3.useRef(0);
|
|
1331
|
+
const shouldFocusEditRef = React3.useRef(false);
|
|
1332
|
+
const shouldFocusFirstFieldRef = React3.useRef(false);
|
|
1333
|
+
const editButtonId = React3.useId();
|
|
1334
|
+
const contentFormId = React3.useId();
|
|
1187
1335
|
const isEditing = mode === "editing" || mode === "saving";
|
|
1188
1336
|
const isSaving = mode === "saving";
|
|
1189
|
-
|
|
1337
|
+
React3.useEffect(() => {
|
|
1190
1338
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
1191
1339
|
shouldFocusEditRef.current = false;
|
|
1192
1340
|
editButtonRef.current?.focus();
|
|
@@ -1204,18 +1352,18 @@ function useEditableSection({
|
|
|
1204
1352
|
focusFirstField(contentRef.current);
|
|
1205
1353
|
}
|
|
1206
1354
|
}, [mode]);
|
|
1207
|
-
const exitToReading =
|
|
1355
|
+
const exitToReading = React3.useCallback(() => {
|
|
1208
1356
|
setConfirmOpen(false);
|
|
1209
1357
|
shouldFocusEditRef.current = true;
|
|
1210
1358
|
setMode("reading");
|
|
1211
1359
|
onDiscard?.();
|
|
1212
1360
|
}, [onDiscard]);
|
|
1213
|
-
const startEdit =
|
|
1361
|
+
const startEdit = React3.useCallback(() => {
|
|
1214
1362
|
setStatus(null);
|
|
1215
1363
|
shouldFocusFirstFieldRef.current = true;
|
|
1216
1364
|
setMode("editing");
|
|
1217
1365
|
}, []);
|
|
1218
|
-
const requestCancel =
|
|
1366
|
+
const requestCancel = React3.useCallback(() => {
|
|
1219
1367
|
if (isSaving) return;
|
|
1220
1368
|
if (isDirty) {
|
|
1221
1369
|
setConfirmOpen(true);
|
|
@@ -1223,7 +1371,7 @@ function useEditableSection({
|
|
|
1223
1371
|
}
|
|
1224
1372
|
exitToReading();
|
|
1225
1373
|
}, [exitToReading, isDirty, isSaving]);
|
|
1226
|
-
const handleSubmit =
|
|
1374
|
+
const handleSubmit = React3.useCallback(
|
|
1227
1375
|
(event) => {
|
|
1228
1376
|
event.preventDefault();
|
|
1229
1377
|
if (isSaving) return;
|
|
@@ -1243,7 +1391,7 @@ function useEditableSection({
|
|
|
1243
1391
|
},
|
|
1244
1392
|
[isSaving, onSave, resolvedLabels.saved]
|
|
1245
1393
|
);
|
|
1246
|
-
const handleFormKeyDown =
|
|
1394
|
+
const handleFormKeyDown = React3.useCallback(
|
|
1247
1395
|
(event) => {
|
|
1248
1396
|
if (event.key !== "Escape") return;
|
|
1249
1397
|
event.preventDefault();
|
|
@@ -1251,7 +1399,7 @@ function useEditableSection({
|
|
|
1251
1399
|
},
|
|
1252
1400
|
[requestCancel]
|
|
1253
1401
|
);
|
|
1254
|
-
|
|
1402
|
+
React3.useEffect(() => {
|
|
1255
1403
|
if (!stableHeight || !isEditing) return;
|
|
1256
1404
|
const el = contentRef.current;
|
|
1257
1405
|
if (!el) return;
|
|
@@ -1483,39 +1631,97 @@ function FieldMessage({
|
|
|
1483
1631
|
function isBrokenImage(img) {
|
|
1484
1632
|
return img.complete && img.naturalWidth === 0;
|
|
1485
1633
|
}
|
|
1634
|
+
function resolveBlurDataUrl(value) {
|
|
1635
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
1636
|
+
}
|
|
1486
1637
|
function SafeImage({
|
|
1487
1638
|
src,
|
|
1488
1639
|
fallback,
|
|
1489
1640
|
alt = "",
|
|
1490
1641
|
onError,
|
|
1642
|
+
onLoad,
|
|
1643
|
+
blurDataUrl,
|
|
1644
|
+
style,
|
|
1645
|
+
className,
|
|
1491
1646
|
...imgProps
|
|
1492
1647
|
}) {
|
|
1493
|
-
const [failed, setFailed] =
|
|
1494
|
-
const
|
|
1648
|
+
const [failed, setFailed] = React3.useState(false);
|
|
1649
|
+
const [loaded, setLoaded] = React3.useState(false);
|
|
1650
|
+
const imgRef = React3.useRef(null);
|
|
1495
1651
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
1496
|
-
|
|
1652
|
+
const resolvedBlur = resolveBlurDataUrl(blurDataUrl);
|
|
1653
|
+
React3.useLayoutEffect(() => {
|
|
1497
1654
|
setFailed(false);
|
|
1655
|
+
setLoaded(false);
|
|
1498
1656
|
}, [resolvedSrc]);
|
|
1499
|
-
|
|
1657
|
+
React3.useLayoutEffect(() => {
|
|
1500
1658
|
const img = imgRef.current;
|
|
1501
|
-
if (img
|
|
1659
|
+
if (!img) return;
|
|
1660
|
+
if (isBrokenImage(img)) {
|
|
1502
1661
|
setFailed(true);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (resolvedBlur && img.complete && img.naturalWidth > 0) {
|
|
1665
|
+
setLoaded(true);
|
|
1503
1666
|
}
|
|
1504
|
-
}, [resolvedSrc, failed]);
|
|
1667
|
+
}, [resolvedSrc, failed, resolvedBlur]);
|
|
1505
1668
|
if (!resolvedSrc || failed) {
|
|
1506
1669
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
1507
1670
|
}
|
|
1671
|
+
const onImgLoad = (event) => {
|
|
1672
|
+
if (resolvedBlur) setLoaded(true);
|
|
1673
|
+
onLoad?.(event);
|
|
1674
|
+
};
|
|
1675
|
+
const onImgError = (event) => {
|
|
1676
|
+
setFailed(true);
|
|
1677
|
+
onError?.(event);
|
|
1678
|
+
};
|
|
1679
|
+
if (resolvedBlur === null) {
|
|
1680
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1681
|
+
"img",
|
|
1682
|
+
{
|
|
1683
|
+
...imgProps,
|
|
1684
|
+
ref: imgRef,
|
|
1685
|
+
src: resolvedSrc,
|
|
1686
|
+
alt,
|
|
1687
|
+
className,
|
|
1688
|
+
style,
|
|
1689
|
+
onLoad: onImgLoad,
|
|
1690
|
+
onError: onImgError
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
const lqipStyle = loaded ? void 0 : {
|
|
1695
|
+
backgroundImage: `url(${JSON.stringify(resolvedBlur)})`,
|
|
1696
|
+
backgroundSize: "cover",
|
|
1697
|
+
backgroundPosition: "center",
|
|
1698
|
+
backgroundRepeat: "no-repeat"
|
|
1699
|
+
};
|
|
1508
1700
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1509
|
-
"
|
|
1701
|
+
"span",
|
|
1510
1702
|
{
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1703
|
+
className: cn("inline-block overflow-hidden", className),
|
|
1704
|
+
style: {
|
|
1705
|
+
lineHeight: 0,
|
|
1706
|
+
...style,
|
|
1707
|
+
...lqipStyle
|
|
1708
|
+
},
|
|
1709
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1710
|
+
"img",
|
|
1711
|
+
{
|
|
1712
|
+
...imgProps,
|
|
1713
|
+
ref: imgRef,
|
|
1714
|
+
src: resolvedSrc,
|
|
1715
|
+
alt,
|
|
1716
|
+
className: cn(
|
|
1717
|
+
"block size-full max-w-none",
|
|
1718
|
+
className,
|
|
1719
|
+
!loaded && "opacity-0"
|
|
1720
|
+
),
|
|
1721
|
+
onLoad: onImgLoad,
|
|
1722
|
+
onError: onImgError
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1519
1725
|
}
|
|
1520
1726
|
);
|
|
1521
1727
|
}
|
|
@@ -1558,17 +1764,17 @@ function ThemeSwitcher({
|
|
|
1558
1764
|
labels: userLabels
|
|
1559
1765
|
}) {
|
|
1560
1766
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
1561
|
-
const [mounted, setMounted] =
|
|
1767
|
+
const [mounted, setMounted] = React3.useState(false);
|
|
1562
1768
|
const sizes = sizeClasses[size];
|
|
1563
1769
|
const shapeClass = shapeClasses[shape];
|
|
1564
1770
|
const labels = { ...defaultLabels, ...userLabels };
|
|
1565
|
-
const handleThemeClick =
|
|
1771
|
+
const handleThemeClick = React3.useCallback(
|
|
1566
1772
|
(themeKey) => {
|
|
1567
1773
|
setTheme(themeKey);
|
|
1568
1774
|
},
|
|
1569
1775
|
[setTheme]
|
|
1570
1776
|
);
|
|
1571
|
-
|
|
1777
|
+
React3.useEffect(() => {
|
|
1572
1778
|
setMounted(true);
|
|
1573
1779
|
}, []);
|
|
1574
1780
|
if (!mounted) {
|
|
@@ -2817,8 +3023,8 @@ function CountryPicker({
|
|
|
2817
3023
|
"aria-invalid": ariaInvalid
|
|
2818
3024
|
}) {
|
|
2819
3025
|
const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
|
|
2820
|
-
const items =
|
|
2821
|
-
const selected =
|
|
3026
|
+
const items = React3__namespace.useMemo(() => countryPickerItems(locale), [locale]);
|
|
3027
|
+
const selected = React3__namespace.useMemo(() => findItem(items, value), [items, value]);
|
|
2822
3028
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2823
3029
|
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
|
|
2824
3030
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2917,6 +3123,331 @@ function CountryPicker({
|
|
|
2917
3123
|
)
|
|
2918
3124
|
] });
|
|
2919
3125
|
}
|
|
3126
|
+
function useMediaQuery(query) {
|
|
3127
|
+
const [matches, setMatches] = React3.useState(false);
|
|
3128
|
+
React3.useEffect(() => {
|
|
3129
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
3130
|
+
const mql = window.matchMedia(query);
|
|
3131
|
+
const onChange = () => setMatches(mql.matches);
|
|
3132
|
+
onChange();
|
|
3133
|
+
mql.addEventListener("change", onChange);
|
|
3134
|
+
return () => mql.removeEventListener("change", onChange);
|
|
3135
|
+
}, [query]);
|
|
3136
|
+
return matches;
|
|
3137
|
+
}
|
|
3138
|
+
var TRIGGER_CLASS = "flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-left text-base transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
|
|
3139
|
+
var SEARCH_CLASS = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 md:text-sm dark:bg-input/30";
|
|
3140
|
+
var MD_UP = "(min-width: 768px)";
|
|
3141
|
+
function LoadingRows() {
|
|
3142
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 p-2", role: "status", children: [
|
|
3143
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-full motion-reduce:animate-none" }),
|
|
3144
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { className: "h-8 w-full motion-reduce:animate-none" })
|
|
3145
|
+
] });
|
|
3146
|
+
}
|
|
3147
|
+
function OptionBody({ option }) {
|
|
3148
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
3149
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: option.label }),
|
|
3150
|
+
option.sublabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: option.sublabel }) : null
|
|
3151
|
+
] });
|
|
3152
|
+
}
|
|
3153
|
+
function SearchablePicker({
|
|
3154
|
+
value,
|
|
3155
|
+
selectedLabel,
|
|
3156
|
+
onChange,
|
|
3157
|
+
options,
|
|
3158
|
+
query,
|
|
3159
|
+
onQueryChange,
|
|
3160
|
+
loading = false,
|
|
3161
|
+
loadingMore = false,
|
|
3162
|
+
hasMore = false,
|
|
3163
|
+
onLoadMore,
|
|
3164
|
+
placeholder = "Search\u2026",
|
|
3165
|
+
emptyLabel = "No matches",
|
|
3166
|
+
loadMoreLabel = "Load more",
|
|
3167
|
+
clearLabel = "Clear",
|
|
3168
|
+
searchPlaceholder,
|
|
3169
|
+
openLabel = "Open list",
|
|
3170
|
+
disabled,
|
|
3171
|
+
allowClear,
|
|
3172
|
+
title,
|
|
3173
|
+
id,
|
|
3174
|
+
className,
|
|
3175
|
+
"aria-invalid": ariaInvalid,
|
|
3176
|
+
onOpenChange
|
|
3177
|
+
}) {
|
|
3178
|
+
const isMdUp = useMediaQuery(MD_UP);
|
|
3179
|
+
const [open, setOpen] = React3__namespace.useState(false);
|
|
3180
|
+
const searchRef = React3__namespace.useRef(null);
|
|
3181
|
+
function setOpenState(next) {
|
|
3182
|
+
setOpen(next);
|
|
3183
|
+
onOpenChange?.(next);
|
|
3184
|
+
if (!next) onQueryChange("");
|
|
3185
|
+
}
|
|
3186
|
+
const selected = React3__namespace.useMemo(() => {
|
|
3187
|
+
if (!value) return null;
|
|
3188
|
+
return options.find((option) => option.id === value) ?? {
|
|
3189
|
+
id: value,
|
|
3190
|
+
label: selectedLabel || value
|
|
3191
|
+
};
|
|
3192
|
+
}, [options, selectedLabel, value]);
|
|
3193
|
+
React3__namespace.useEffect(() => {
|
|
3194
|
+
if (!open || isMdUp) return;
|
|
3195
|
+
const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
|
|
3196
|
+
return () => window.clearTimeout(handle);
|
|
3197
|
+
}, [isMdUp, open]);
|
|
3198
|
+
function selectOption(option) {
|
|
3199
|
+
onChange(option.id, option);
|
|
3200
|
+
onQueryChange("");
|
|
3201
|
+
setOpenState(false);
|
|
3202
|
+
}
|
|
3203
|
+
function clearSelection() {
|
|
3204
|
+
onChange("");
|
|
3205
|
+
onQueryChange("");
|
|
3206
|
+
}
|
|
3207
|
+
const display = selectedLabel || selected?.label || "";
|
|
3208
|
+
const sheetTitle = title || placeholder;
|
|
3209
|
+
const searchLabel = searchPlaceholder || placeholder;
|
|
3210
|
+
const loadMoreButton = hasMore && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3211
|
+
button_js.Button,
|
|
3212
|
+
{
|
|
3213
|
+
className: "mt-1 w-full",
|
|
3214
|
+
disabled: loadingMore || disabled,
|
|
3215
|
+
size: "sm",
|
|
3216
|
+
type: "button",
|
|
3217
|
+
variant: "ghost",
|
|
3218
|
+
onClick: () => onLoadMore(),
|
|
3219
|
+
children: loadMoreLabel
|
|
3220
|
+
}
|
|
3221
|
+
) : null;
|
|
3222
|
+
if (isMdUp) {
|
|
3223
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3224
|
+
combobox_js.Combobox.Root,
|
|
3225
|
+
{
|
|
3226
|
+
items: options,
|
|
3227
|
+
value: selected,
|
|
3228
|
+
open,
|
|
3229
|
+
onOpenChange: setOpenState,
|
|
3230
|
+
inputValue: query,
|
|
3231
|
+
onInputValueChange: (next) => onQueryChange(next),
|
|
3232
|
+
onValueChange: (item) => {
|
|
3233
|
+
if (!item) {
|
|
3234
|
+
clearSelection();
|
|
3235
|
+
return;
|
|
3236
|
+
}
|
|
3237
|
+
selectOption(item);
|
|
3238
|
+
},
|
|
3239
|
+
disabled,
|
|
3240
|
+
filter: null,
|
|
3241
|
+
autoComplete: "none",
|
|
3242
|
+
itemToStringLabel: (item) => item.label,
|
|
3243
|
+
itemToStringValue: (item) => item.id,
|
|
3244
|
+
isItemEqualToValue: (item, current) => item.id === current.id,
|
|
3245
|
+
children: [
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex w-full items-center gap-1", children: [
|
|
3247
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3248
|
+
combobox_js.Combobox.Trigger,
|
|
3249
|
+
{
|
|
3250
|
+
id,
|
|
3251
|
+
"aria-invalid": ariaInvalid,
|
|
3252
|
+
"aria-label": openLabel,
|
|
3253
|
+
className: cn(TRIGGER_CLASS, allowClear && value ? "pr-1" : null),
|
|
3254
|
+
disabled,
|
|
3255
|
+
children: [
|
|
3256
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3257
|
+
"span",
|
|
3258
|
+
{
|
|
3259
|
+
className: cn(
|
|
3260
|
+
"min-w-0 flex-1 truncate",
|
|
3261
|
+
display ? "text-foreground" : "text-muted-foreground"
|
|
3262
|
+
),
|
|
3263
|
+
children: display || placeholder
|
|
3264
|
+
}
|
|
3265
|
+
),
|
|
3266
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3267
|
+
lucideReact.ChevronDownIcon,
|
|
3268
|
+
{
|
|
3269
|
+
"aria-hidden": true,
|
|
3270
|
+
className: "size-4 shrink-0 text-muted-foreground"
|
|
3271
|
+
}
|
|
3272
|
+
)
|
|
3273
|
+
]
|
|
3274
|
+
}
|
|
3275
|
+
),
|
|
3276
|
+
allowClear && value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3277
|
+
combobox_js.Combobox.Clear,
|
|
3278
|
+
{
|
|
3279
|
+
"aria-label": clearLabel,
|
|
3280
|
+
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3281
|
+
disabled,
|
|
3282
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4", "aria-hidden": true })
|
|
3283
|
+
}
|
|
3284
|
+
) : null
|
|
3285
|
+
] }),
|
|
3286
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3287
|
+
combobox_js.Combobox.Positioner,
|
|
3288
|
+
{
|
|
3289
|
+
className: "pointer-events-auto isolate z-[60] outline-none",
|
|
3290
|
+
sideOffset: 4,
|
|
3291
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3292
|
+
combobox_js.Combobox.Popup,
|
|
3293
|
+
{
|
|
3294
|
+
className: cn(
|
|
3295
|
+
"pointer-events-auto z-[60] flex w-(--anchor-width) min-w-[16rem] flex-col overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
|
|
3296
|
+
"motion-safe:data-open:animate-in motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95"
|
|
3297
|
+
),
|
|
3298
|
+
children: [
|
|
3299
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-popover p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3300
|
+
combobox_js.Combobox.Input,
|
|
3301
|
+
{
|
|
3302
|
+
"aria-label": searchLabel,
|
|
3303
|
+
className: SEARCH_CLASS,
|
|
3304
|
+
placeholder: searchLabel
|
|
3305
|
+
}
|
|
3306
|
+
) }),
|
|
3307
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingRows, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3308
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "px-3 py-3 text-sm text-muted-foreground", children: emptyLabel }),
|
|
3309
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3310
|
+
combobox_js.Combobox.List,
|
|
3311
|
+
{
|
|
3312
|
+
className: "max-h-60 overflow-y-auto p-1 outline-none",
|
|
3313
|
+
onWheel: (event) => event.stopPropagation(),
|
|
3314
|
+
children: (item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3315
|
+
combobox_js.Combobox.Item,
|
|
3316
|
+
{
|
|
3317
|
+
value: item,
|
|
3318
|
+
className: cn(
|
|
3319
|
+
"relative flex cursor-default items-center gap-2 rounded-md py-2 pr-2 pl-8 text-sm outline-none select-none",
|
|
3320
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground"
|
|
3321
|
+
),
|
|
3322
|
+
children: [
|
|
3323
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) }),
|
|
3324
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptionBody, { option: item })
|
|
3325
|
+
]
|
|
3326
|
+
},
|
|
3327
|
+
item.id
|
|
3328
|
+
)
|
|
3329
|
+
}
|
|
3330
|
+
),
|
|
3331
|
+
loadMoreButton ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border p-1", children: loadMoreButton }) : null
|
|
3332
|
+
] })
|
|
3333
|
+
]
|
|
3334
|
+
}
|
|
3335
|
+
)
|
|
3336
|
+
}
|
|
3337
|
+
) })
|
|
3338
|
+
]
|
|
3339
|
+
}
|
|
3340
|
+
) });
|
|
3341
|
+
}
|
|
3342
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative w-full", className), children: [
|
|
3343
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-1", children: [
|
|
3344
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3345
|
+
"button",
|
|
3346
|
+
{
|
|
3347
|
+
"aria-expanded": open,
|
|
3348
|
+
"aria-haspopup": "dialog",
|
|
3349
|
+
"aria-invalid": ariaInvalid,
|
|
3350
|
+
"aria-label": openLabel,
|
|
3351
|
+
className: TRIGGER_CLASS,
|
|
3352
|
+
disabled,
|
|
3353
|
+
id,
|
|
3354
|
+
type: "button",
|
|
3355
|
+
onClick: () => setOpenState(true),
|
|
3356
|
+
children: [
|
|
3357
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3358
|
+
"span",
|
|
3359
|
+
{
|
|
3360
|
+
className: cn(
|
|
3361
|
+
"min-w-0 flex-1 truncate",
|
|
3362
|
+
display ? "text-foreground" : "text-muted-foreground"
|
|
3363
|
+
),
|
|
3364
|
+
children: display || placeholder
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3368
|
+
lucideReact.ChevronDownIcon,
|
|
3369
|
+
{
|
|
3370
|
+
"aria-hidden": true,
|
|
3371
|
+
className: "size-4 shrink-0 text-muted-foreground"
|
|
3372
|
+
}
|
|
3373
|
+
)
|
|
3374
|
+
]
|
|
3375
|
+
}
|
|
3376
|
+
),
|
|
3377
|
+
allowClear && value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3378
|
+
button_js.Button,
|
|
3379
|
+
{
|
|
3380
|
+
"aria-label": clearLabel,
|
|
3381
|
+
disabled,
|
|
3382
|
+
size: "icon",
|
|
3383
|
+
type: "button",
|
|
3384
|
+
variant: "ghost",
|
|
3385
|
+
onClick: clearSelection,
|
|
3386
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4", "aria-hidden": true })
|
|
3387
|
+
}
|
|
3388
|
+
) : null
|
|
3389
|
+
] }),
|
|
3390
|
+
/* @__PURE__ */ jsxRuntime.jsx(drawer_js.Drawer, { open, onOpenChange: setOpenState, children: /* @__PURE__ */ jsxRuntime.jsxs(drawer_js.DrawerContent, { className: "max-h-[85vh]", children: [
|
|
3391
|
+
/* @__PURE__ */ jsxRuntime.jsxs(drawer_js.DrawerHeader, { className: "flex flex-row items-center justify-between gap-2 text-left md:text-left", children: [
|
|
3392
|
+
/* @__PURE__ */ jsxRuntime.jsx(drawer_js.DrawerTitle, { children: sheetTitle }),
|
|
3393
|
+
allowClear && value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3394
|
+
button_js.Button,
|
|
3395
|
+
{
|
|
3396
|
+
size: "sm",
|
|
3397
|
+
type: "button",
|
|
3398
|
+
variant: "ghost",
|
|
3399
|
+
onClick: () => {
|
|
3400
|
+
clearSelection();
|
|
3401
|
+
setOpenState(false);
|
|
3402
|
+
},
|
|
3403
|
+
children: clearLabel
|
|
3404
|
+
}
|
|
3405
|
+
) : null
|
|
3406
|
+
] }),
|
|
3407
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-background px-4 pb-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3408
|
+
input_js.Input,
|
|
3409
|
+
{
|
|
3410
|
+
ref: searchRef,
|
|
3411
|
+
"aria-label": searchLabel,
|
|
3412
|
+
disabled,
|
|
3413
|
+
placeholder: searchLabel,
|
|
3414
|
+
value: query,
|
|
3415
|
+
onChange: (event) => onQueryChange(event.target.value)
|
|
3416
|
+
}
|
|
3417
|
+
) }),
|
|
3418
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-y-auto px-2 pb-4", children: [
|
|
3419
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingRows, {}) : options.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-3 text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-col gap-1 p-1", children: options.map((option) => {
|
|
3420
|
+
const isSelected = option.id === value;
|
|
3421
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3422
|
+
"button",
|
|
3423
|
+
{
|
|
3424
|
+
"aria-selected": isSelected,
|
|
3425
|
+
className: cn(
|
|
3426
|
+
"flex w-full items-center gap-2 rounded-lg px-3 py-3 text-left text-sm outline-none transition-colors",
|
|
3427
|
+
"hover:bg-muted/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
3428
|
+
isSelected ? "bg-accent" : null
|
|
3429
|
+
),
|
|
3430
|
+
role: "option",
|
|
3431
|
+
type: "button",
|
|
3432
|
+
onClick: () => selectOption(option),
|
|
3433
|
+
children: [
|
|
3434
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptionBody, { option }),
|
|
3435
|
+
isSelected ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3436
|
+
lucideReact.CheckIcon,
|
|
3437
|
+
{
|
|
3438
|
+
"aria-hidden": true,
|
|
3439
|
+
className: "size-4 shrink-0 text-foreground"
|
|
3440
|
+
}
|
|
3441
|
+
) : null
|
|
3442
|
+
]
|
|
3443
|
+
}
|
|
3444
|
+
) }, option.id);
|
|
3445
|
+
}) }),
|
|
3446
|
+
loadMoreButton
|
|
3447
|
+
] })
|
|
3448
|
+
] }) })
|
|
3449
|
+
] });
|
|
3450
|
+
}
|
|
2920
3451
|
var INPUT_CLASS2 = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none 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:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
|
|
2921
3452
|
var DEFAULT_LABELS = {
|
|
2922
3453
|
placeholder: "Search\u2026",
|
|
@@ -2954,18 +3485,18 @@ function PaginatedCombobox({
|
|
|
2954
3485
|
"aria-invalid": ariaInvalid
|
|
2955
3486
|
}) {
|
|
2956
3487
|
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
2957
|
-
const selected =
|
|
3488
|
+
const selected = React3__namespace.useMemo(
|
|
2958
3489
|
() => resolveSelected(value, items, selectedItem),
|
|
2959
3490
|
[value, items, selectedItem]
|
|
2960
3491
|
);
|
|
2961
|
-
const listItems =
|
|
3492
|
+
const listItems = React3__namespace.useMemo(() => {
|
|
2962
3493
|
if (!selected) return items;
|
|
2963
3494
|
if (items.some((item) => item.value === selected.value)) return items;
|
|
2964
3495
|
return [selected, ...items];
|
|
2965
3496
|
}, [items, selected]);
|
|
2966
|
-
const queryRef =
|
|
2967
|
-
const debounceRef =
|
|
2968
|
-
|
|
3497
|
+
const queryRef = React3__namespace.useRef("");
|
|
3498
|
+
const debounceRef = React3__namespace.useRef(null);
|
|
3499
|
+
React3__namespace.useEffect(() => {
|
|
2969
3500
|
return () => {
|
|
2970
3501
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2971
3502
|
};
|
|
@@ -3117,20 +3648,134 @@ function PaginatedCombobox({
|
|
|
3117
3648
|
)
|
|
3118
3649
|
] });
|
|
3119
3650
|
}
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3651
|
+
|
|
3652
|
+
// src/lib/mx-tax-id.ts
|
|
3653
|
+
var RFC_MORAL = /^[A-ZÑ&]{3}\d{6}[A-Z0-9]{3}$/;
|
|
3654
|
+
var RFC_NATURAL = /^[A-ZÑ&]{4}\d{6}[A-Z0-9]{3}$/;
|
|
3655
|
+
var CURP_REGEX = /^[A-Z][AEIOUX][A-Z]{2}\d{6}[HMX][A-Z]{2}[B-DF-HJ-NP-TV-Z]{3}[0-9A-Z]\d$/;
|
|
3656
|
+
var CURP_DICT = "0123456789ABCDEFGHIJKLMN\xD1OPQRSTUVWXYZ";
|
|
3657
|
+
var NATURAL_KINDS = /* @__PURE__ */ new Set([
|
|
3658
|
+
"natural_person_mx",
|
|
3659
|
+
"natural_person_foreign"
|
|
3660
|
+
]);
|
|
3661
|
+
var LEGAL_KINDS = /* @__PURE__ */ new Set([
|
|
3662
|
+
"legal_entity_mx",
|
|
3663
|
+
"legal_entity_foreign",
|
|
3664
|
+
"trust"
|
|
3665
|
+
]);
|
|
3666
|
+
function normalizeRfc(raw) {
|
|
3667
|
+
return raw.trim().toUpperCase().replace(/ñ/g, "\xD1");
|
|
3668
|
+
}
|
|
3669
|
+
function rfcMaxLengthForPersonKind(personKind) {
|
|
3670
|
+
if (personKind && LEGAL_KINDS.has(personKind)) return 12;
|
|
3671
|
+
return 13;
|
|
3672
|
+
}
|
|
3673
|
+
function validateRfcForPersonKind(rfc, personKind) {
|
|
3674
|
+
const normalized = normalizeRfc(rfc);
|
|
3675
|
+
if (normalized.length === 0) {
|
|
3676
|
+
return { ok: false, code: "length" };
|
|
3677
|
+
}
|
|
3678
|
+
if (NATURAL_KINDS.has(personKind)) {
|
|
3679
|
+
if (normalized.length !== 13) return { ok: false, code: "length" };
|
|
3680
|
+
return RFC_NATURAL.test(normalized) ? { ok: true } : { ok: false, code: "natural" };
|
|
3681
|
+
}
|
|
3682
|
+
if (LEGAL_KINDS.has(personKind)) {
|
|
3683
|
+
if (normalized.length !== 12) return { ok: false, code: "length" };
|
|
3684
|
+
return RFC_MORAL.test(normalized) ? { ok: true } : { ok: false, code: "moral" };
|
|
3685
|
+
}
|
|
3686
|
+
if (normalized.length === 12) {
|
|
3687
|
+
return RFC_MORAL.test(normalized) ? { ok: true } : { ok: false, code: "moral" };
|
|
3688
|
+
}
|
|
3689
|
+
if (normalized.length === 13) {
|
|
3690
|
+
return RFC_NATURAL.test(normalized) ? { ok: true } : { ok: false, code: "natural" };
|
|
3691
|
+
}
|
|
3692
|
+
return { ok: false, code: "length" };
|
|
3693
|
+
}
|
|
3694
|
+
function normalizeCurpInput(raw) {
|
|
3695
|
+
return raw.trim().toUpperCase().replace(/ñ/g, "\xD1");
|
|
3696
|
+
}
|
|
3697
|
+
function curpCheckDigit(curp17) {
|
|
3698
|
+
let sum = 0;
|
|
3699
|
+
for (let i = 0; i < 17; i++) {
|
|
3700
|
+
const ch = curp17[i] ?? "";
|
|
3701
|
+
const idx = CURP_DICT.indexOf(ch);
|
|
3702
|
+
sum += (idx >= 0 ? idx : 0) * (18 - i);
|
|
3703
|
+
}
|
|
3704
|
+
return (10 - sum % 10) % 10;
|
|
3705
|
+
}
|
|
3706
|
+
function validateCurp(curp) {
|
|
3707
|
+
const normalized = normalizeCurpInput(curp);
|
|
3708
|
+
if (!CURP_REGEX.test(normalized)) {
|
|
3709
|
+
return { ok: false, code: "format" };
|
|
3710
|
+
}
|
|
3711
|
+
const expected = curpCheckDigit(normalized.slice(0, 17));
|
|
3712
|
+
if (expected !== Number(normalized[17])) {
|
|
3713
|
+
return { ok: false, code: "check_digit" };
|
|
3714
|
+
}
|
|
3715
|
+
return { ok: true };
|
|
3716
|
+
}
|
|
3717
|
+
function RfcInput({
|
|
3718
|
+
value,
|
|
3719
|
+
onValueChange,
|
|
3720
|
+
personKind,
|
|
3721
|
+
className,
|
|
3722
|
+
...props
|
|
3723
|
+
}) {
|
|
3724
|
+
const maxLength = rfcMaxLengthForPersonKind(personKind);
|
|
3725
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3726
|
+
input_js.Input,
|
|
3727
|
+
{
|
|
3728
|
+
...props,
|
|
3729
|
+
autoCapitalize: "characters",
|
|
3730
|
+
className: cn("font-mono uppercase tracking-wide", className),
|
|
3731
|
+
inputMode: "text",
|
|
3732
|
+
maxLength,
|
|
3733
|
+
spellCheck: false,
|
|
3734
|
+
type: "text",
|
|
3735
|
+
value,
|
|
3736
|
+
onChange: (event) => {
|
|
3737
|
+
onValueChange(normalizeRfc(event.target.value));
|
|
3738
|
+
}
|
|
3739
|
+
}
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
function CurpInput({
|
|
3743
|
+
value,
|
|
3744
|
+
onValueChange,
|
|
3745
|
+
className,
|
|
3746
|
+
...props
|
|
3747
|
+
}) {
|
|
3748
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3749
|
+
input_js.Input,
|
|
3750
|
+
{
|
|
3751
|
+
...props,
|
|
3752
|
+
autoCapitalize: "characters",
|
|
3753
|
+
className: cn("font-mono uppercase tracking-wide", className),
|
|
3754
|
+
inputMode: "text",
|
|
3755
|
+
maxLength: 18,
|
|
3756
|
+
spellCheck: false,
|
|
3757
|
+
type: "text",
|
|
3758
|
+
value,
|
|
3759
|
+
onChange: (event) => {
|
|
3760
|
+
onValueChange(normalizeCurpInput(event.target.value));
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
);
|
|
3764
|
+
}
|
|
3765
|
+
var DEFAULT_LABELS2 = {
|
|
3766
|
+
uploadAria: "Upload image",
|
|
3767
|
+
uploadHint: "Click to upload",
|
|
3768
|
+
uploadFormats: "PNG, JPG up to 10MB",
|
|
3769
|
+
dragging: "Dragging",
|
|
3770
|
+
zoomOut: "Zoom out",
|
|
3771
|
+
zoomIn: "Zoom in",
|
|
3772
|
+
zoomLevel: "Zoom level",
|
|
3773
|
+
rotateLeft: "Rotate left 15 degrees",
|
|
3774
|
+
rotateRight: "Rotate right 15 degrees",
|
|
3775
|
+
toggleGrid: "Toggle grid overlay",
|
|
3776
|
+
reset: "Reset all transforms",
|
|
3777
|
+
replace: "Upload new image",
|
|
3778
|
+
discard: "Discard image"
|
|
3134
3779
|
};
|
|
3135
3780
|
function AvatarEditor({
|
|
3136
3781
|
value: _value,
|
|
@@ -3145,18 +3790,18 @@ function AvatarEditor({
|
|
|
3145
3790
|
labels
|
|
3146
3791
|
}) {
|
|
3147
3792
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
3148
|
-
const canvasRef =
|
|
3149
|
-
const fileInputRef =
|
|
3150
|
-
const containerRef =
|
|
3151
|
-
const [image, setImage] =
|
|
3152
|
-
const [imageLoaded, setImageLoaded] =
|
|
3153
|
-
const [zoom, setZoom] =
|
|
3154
|
-
const [rotation, setRotation] =
|
|
3155
|
-
const [position, setPosition] =
|
|
3156
|
-
const [isDragging, setIsDragging] =
|
|
3157
|
-
const [dragStart, setDragStart] =
|
|
3158
|
-
const [showGrid, setShowGrid] =
|
|
3159
|
-
const generateOutput =
|
|
3793
|
+
const canvasRef = React3.useRef(null);
|
|
3794
|
+
const fileInputRef = React3.useRef(null);
|
|
3795
|
+
const containerRef = React3.useRef(null);
|
|
3796
|
+
const [image, setImage] = React3.useState(null);
|
|
3797
|
+
const [imageLoaded, setImageLoaded] = React3.useState(false);
|
|
3798
|
+
const [zoom, setZoom] = React3.useState(1);
|
|
3799
|
+
const [rotation, setRotation] = React3.useState(0);
|
|
3800
|
+
const [position, setPosition] = React3.useState({ x: 0, y: 0 });
|
|
3801
|
+
const [isDragging, setIsDragging] = React3.useState(false);
|
|
3802
|
+
const [dragStart, setDragStart] = React3.useState({ x: 0, y: 0 });
|
|
3803
|
+
const [showGrid, setShowGrid] = React3.useState(initialShowGrid);
|
|
3804
|
+
const generateOutput = React3.useCallback(() => {
|
|
3160
3805
|
if (!canvasRef.current || !image) return null;
|
|
3161
3806
|
const outputCanvas = document.createElement("canvas");
|
|
3162
3807
|
outputCanvas.width = outputSize;
|
|
@@ -3167,7 +3812,7 @@ function AvatarEditor({
|
|
|
3167
3812
|
const mimeType = `image/${outputFormat}`;
|
|
3168
3813
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
3169
3814
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
3170
|
-
|
|
3815
|
+
React3.useEffect(() => {
|
|
3171
3816
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
3172
3817
|
const canvas = canvasRef.current;
|
|
3173
3818
|
const ctx = canvas.getContext("2d");
|
|
@@ -3211,12 +3856,12 @@ function AvatarEditor({
|
|
|
3211
3856
|
generateOutput,
|
|
3212
3857
|
onChange
|
|
3213
3858
|
]);
|
|
3214
|
-
const resetTransforms =
|
|
3859
|
+
const resetTransforms = React3.useCallback(() => {
|
|
3215
3860
|
setZoom(1);
|
|
3216
3861
|
setRotation(0);
|
|
3217
3862
|
setPosition({ x: 0, y: 0 });
|
|
3218
3863
|
}, []);
|
|
3219
|
-
const handleFileSelect =
|
|
3864
|
+
const handleFileSelect = React3.useCallback(
|
|
3220
3865
|
(e) => {
|
|
3221
3866
|
const file = e.target.files?.[0];
|
|
3222
3867
|
if (!file) return;
|
|
@@ -3235,7 +3880,7 @@ function AvatarEditor({
|
|
|
3235
3880
|
},
|
|
3236
3881
|
[resetTransforms]
|
|
3237
3882
|
);
|
|
3238
|
-
const handleMouseDown =
|
|
3883
|
+
const handleMouseDown = React3.useCallback(
|
|
3239
3884
|
(e) => {
|
|
3240
3885
|
if (!imageLoaded) return;
|
|
3241
3886
|
setIsDragging(true);
|
|
@@ -3243,7 +3888,7 @@ function AvatarEditor({
|
|
|
3243
3888
|
},
|
|
3244
3889
|
[imageLoaded, position]
|
|
3245
3890
|
);
|
|
3246
|
-
const handleMouseMove =
|
|
3891
|
+
const handleMouseMove = React3.useCallback(
|
|
3247
3892
|
(e) => {
|
|
3248
3893
|
if (!isDragging) return;
|
|
3249
3894
|
setPosition({
|
|
@@ -3253,10 +3898,10 @@ function AvatarEditor({
|
|
|
3253
3898
|
},
|
|
3254
3899
|
[isDragging, dragStart]
|
|
3255
3900
|
);
|
|
3256
|
-
const handleMouseUp =
|
|
3901
|
+
const handleMouseUp = React3.useCallback(() => {
|
|
3257
3902
|
setIsDragging(false);
|
|
3258
3903
|
}, []);
|
|
3259
|
-
const handleTouchStart =
|
|
3904
|
+
const handleTouchStart = React3.useCallback(
|
|
3260
3905
|
(e) => {
|
|
3261
3906
|
if (!imageLoaded) return;
|
|
3262
3907
|
const touch = e.touches[0];
|
|
@@ -3268,7 +3913,7 @@ function AvatarEditor({
|
|
|
3268
3913
|
},
|
|
3269
3914
|
[imageLoaded, position]
|
|
3270
3915
|
);
|
|
3271
|
-
const handleTouchMove =
|
|
3916
|
+
const handleTouchMove = React3.useCallback(
|
|
3272
3917
|
(e) => {
|
|
3273
3918
|
if (!isDragging) return;
|
|
3274
3919
|
const touch = e.touches[0];
|
|
@@ -3279,7 +3924,7 @@ function AvatarEditor({
|
|
|
3279
3924
|
},
|
|
3280
3925
|
[isDragging, dragStart]
|
|
3281
3926
|
);
|
|
3282
|
-
const handleDiscard =
|
|
3927
|
+
const handleDiscard = React3.useCallback(() => {
|
|
3283
3928
|
setImage(null);
|
|
3284
3929
|
setImageLoaded(false);
|
|
3285
3930
|
resetTransforms();
|
|
@@ -3649,9 +4294,9 @@ function AvatarEditor({
|
|
|
3649
4294
|
}
|
|
3650
4295
|
);
|
|
3651
4296
|
}
|
|
3652
|
-
function
|
|
3653
|
-
const [matches, setMatches] =
|
|
3654
|
-
|
|
4297
|
+
function useMediaQuery2(query) {
|
|
4298
|
+
const [matches, setMatches] = React3.useState(false);
|
|
4299
|
+
React3.useEffect(() => {
|
|
3655
4300
|
const media = window.matchMedia(query);
|
|
3656
4301
|
if (media.matches !== matches) {
|
|
3657
4302
|
setMatches(media.matches);
|
|
@@ -3681,17 +4326,17 @@ function AvatarEditorDialog({
|
|
|
3681
4326
|
className,
|
|
3682
4327
|
editorLabels
|
|
3683
4328
|
}) {
|
|
3684
|
-
const [isOpen, setIsOpen] =
|
|
3685
|
-
const [editedValue, setEditedValue] =
|
|
3686
|
-
const [displaySrc, setDisplaySrc] =
|
|
3687
|
-
const [isSaving, setIsSaving] =
|
|
3688
|
-
const [feedback, setFeedback] =
|
|
3689
|
-
|
|
4329
|
+
const [isOpen, setIsOpen] = React3.useState(false);
|
|
4330
|
+
const [editedValue, setEditedValue] = React3.useState(value ?? null);
|
|
4331
|
+
const [displaySrc, setDisplaySrc] = React3.useState(value ?? null);
|
|
4332
|
+
const [isSaving, setIsSaving] = React3.useState(false);
|
|
4333
|
+
const [feedback, setFeedback] = React3.useState(null);
|
|
4334
|
+
React3.useEffect(() => {
|
|
3690
4335
|
setDisplaySrc(value ?? null);
|
|
3691
4336
|
}, [value]);
|
|
3692
|
-
const isMobile =
|
|
4337
|
+
const isMobile = useMediaQuery2("(max-width: 640px)");
|
|
3693
4338
|
const caption = (placeholder ?? "").trim();
|
|
3694
|
-
const handleOpenChange =
|
|
4339
|
+
const handleOpenChange = React3.useCallback(
|
|
3695
4340
|
(open) => {
|
|
3696
4341
|
if (open) {
|
|
3697
4342
|
setEditedValue(value ?? null);
|
|
@@ -3701,7 +4346,7 @@ function AvatarEditorDialog({
|
|
|
3701
4346
|
},
|
|
3702
4347
|
[value]
|
|
3703
4348
|
);
|
|
3704
|
-
const handleAccept =
|
|
4349
|
+
const handleAccept = React3.useCallback(async () => {
|
|
3705
4350
|
if (!editedValue) return;
|
|
3706
4351
|
setIsSaving(true);
|
|
3707
4352
|
setFeedback(null);
|
|
@@ -3960,6 +4605,7 @@ var DEFAULT_FILE_UPLOAD_LABELS = {
|
|
|
3960
4605
|
function FileDropzone({
|
|
3961
4606
|
accept,
|
|
3962
4607
|
maxSize,
|
|
4608
|
+
multiple = false,
|
|
3963
4609
|
disabled = false,
|
|
3964
4610
|
labels: labelOverrides,
|
|
3965
4611
|
onFile,
|
|
@@ -3967,10 +4613,10 @@ function FileDropzone({
|
|
|
3967
4613
|
className
|
|
3968
4614
|
}) {
|
|
3969
4615
|
const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
|
|
3970
|
-
const inputId =
|
|
3971
|
-
const inputRef =
|
|
3972
|
-
const [dragging, setDragging] =
|
|
3973
|
-
const [message, setMessage] =
|
|
4616
|
+
const inputId = React3.useId();
|
|
4617
|
+
const inputRef = React3.useRef(null);
|
|
4618
|
+
const [dragging, setDragging] = React3.useState(false);
|
|
4619
|
+
const [message, setMessage] = React3.useState(null);
|
|
3974
4620
|
function takeFile(file) {
|
|
3975
4621
|
if (!file || disabled) return;
|
|
3976
4622
|
if (!fileMatchesAccept(file, accept)) {
|
|
@@ -3986,10 +4632,15 @@ function FileDropzone({
|
|
|
3986
4632
|
setMessage(null);
|
|
3987
4633
|
onFile(file);
|
|
3988
4634
|
}
|
|
4635
|
+
function takeFiles(list) {
|
|
4636
|
+
if (!list || list.length === 0 || disabled) return;
|
|
4637
|
+
const files = multiple ? Array.from(list) : [list[0]];
|
|
4638
|
+
for (const file of files) takeFile(file);
|
|
4639
|
+
}
|
|
3989
4640
|
function onDrop(event) {
|
|
3990
4641
|
event.preventDefault();
|
|
3991
4642
|
setDragging(false);
|
|
3992
|
-
|
|
4643
|
+
takeFiles(event.dataTransfer.files);
|
|
3993
4644
|
}
|
|
3994
4645
|
function onKeyDown(event) {
|
|
3995
4646
|
if (disabled) return;
|
|
@@ -4056,11 +4707,12 @@ function FileDropzone({
|
|
|
4056
4707
|
ref: inputRef,
|
|
4057
4708
|
type: "file",
|
|
4058
4709
|
accept,
|
|
4710
|
+
multiple,
|
|
4059
4711
|
disabled,
|
|
4060
4712
|
"aria-label": labels.browse,
|
|
4061
4713
|
className: "sr-only",
|
|
4062
4714
|
onChange: (event) => {
|
|
4063
|
-
|
|
4715
|
+
takeFiles(event.target.files);
|
|
4064
4716
|
event.target.value = "";
|
|
4065
4717
|
}
|
|
4066
4718
|
}
|
|
@@ -4218,7 +4870,7 @@ function FileUploadMenu({
|
|
|
4218
4870
|
}) {
|
|
4219
4871
|
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
4220
4872
|
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
4221
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4873
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React3.useState(false);
|
|
4222
4874
|
const isControlled = open !== void 0;
|
|
4223
4875
|
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4224
4876
|
function setResolvedOpen(next) {
|
|
@@ -4474,18 +5126,6 @@ function createMultipartUploadController(options) {
|
|
|
4474
5126
|
getStatus: () => state.status
|
|
4475
5127
|
};
|
|
4476
5128
|
}
|
|
4477
|
-
function useMediaQuery2(query) {
|
|
4478
|
-
const [matches, setMatches] = React2.useState(false);
|
|
4479
|
-
React2.useEffect(() => {
|
|
4480
|
-
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
4481
|
-
const mql = window.matchMedia(query);
|
|
4482
|
-
const onChange = () => setMatches(mql.matches);
|
|
4483
|
-
onChange();
|
|
4484
|
-
mql.addEventListener("change", onChange);
|
|
4485
|
-
return () => mql.removeEventListener("change", onChange);
|
|
4486
|
-
}, [query]);
|
|
4487
|
-
return matches;
|
|
4488
|
-
}
|
|
4489
5129
|
function StatHighlightCard({
|
|
4490
5130
|
label,
|
|
4491
5131
|
value,
|
|
@@ -4565,7 +5205,7 @@ function SparklineStat({
|
|
|
4565
5205
|
points,
|
|
4566
5206
|
className
|
|
4567
5207
|
}) {
|
|
4568
|
-
const reduced =
|
|
5208
|
+
const reduced = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
4569
5209
|
const path = polyline(points);
|
|
4570
5210
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4571
5211
|
"div",
|
|
@@ -4722,7 +5362,7 @@ function MetricEmptyState({
|
|
|
4722
5362
|
);
|
|
4723
5363
|
}
|
|
4724
5364
|
function MetricSkeleton({ className, bars = 4 }) {
|
|
4725
|
-
const reduced =
|
|
5365
|
+
const reduced = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
4726
5366
|
const count = Math.max(1, bars);
|
|
4727
5367
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4728
5368
|
"div",
|
|
@@ -4841,10 +5481,10 @@ function CookieConsentBanner({
|
|
|
4841
5481
|
className
|
|
4842
5482
|
}) {
|
|
4843
5483
|
const copy = { ...DEFAULT_COOKIE_CONSENT_BANNER_LABELS, ...labels };
|
|
4844
|
-
const [consent, setConsent] =
|
|
5484
|
+
const [consent, setConsent] = React3.useState(
|
|
4845
5485
|
"pending"
|
|
4846
5486
|
);
|
|
4847
|
-
|
|
5487
|
+
React3.useEffect(() => {
|
|
4848
5488
|
if (variant === "embed" || isEmbeddedWindow()) {
|
|
4849
5489
|
setConsent("necessary");
|
|
4850
5490
|
return;
|
|
@@ -5077,6 +5717,654 @@ function LegalAcceptCheckbox({
|
|
|
5077
5717
|
) })
|
|
5078
5718
|
] });
|
|
5079
5719
|
}
|
|
5720
|
+
function StepProgress({
|
|
5721
|
+
segments,
|
|
5722
|
+
current,
|
|
5723
|
+
className,
|
|
5724
|
+
"aria-label": ariaLabel
|
|
5725
|
+
}) {
|
|
5726
|
+
const safeCurrent = Math.max(
|
|
5727
|
+
0,
|
|
5728
|
+
Math.min(current, Math.max(segments.length - 1, 0))
|
|
5729
|
+
);
|
|
5730
|
+
const active = segments[safeCurrent];
|
|
5731
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5732
|
+
"div",
|
|
5733
|
+
{
|
|
5734
|
+
"aria-label": ariaLabel,
|
|
5735
|
+
"aria-valuemax": Math.max(segments.length, 1),
|
|
5736
|
+
"aria-valuemin": 1,
|
|
5737
|
+
"aria-valuenow": safeCurrent + 1,
|
|
5738
|
+
"aria-valuetext": active?.label,
|
|
5739
|
+
className: cn("flex min-w-0 flex-col gap-1.5", className),
|
|
5740
|
+
role: "progressbar",
|
|
5741
|
+
children: [
|
|
5742
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", "aria-hidden": true, children: segments.map((segment, index) => {
|
|
5743
|
+
const done = index < safeCurrent;
|
|
5744
|
+
const isCurrent = index === safeCurrent;
|
|
5745
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5746
|
+
"span",
|
|
5747
|
+
{
|
|
5748
|
+
className: cn(
|
|
5749
|
+
"h-1 flex-1 rounded-full",
|
|
5750
|
+
done || isCurrent ? "bg-primary" : "bg-muted",
|
|
5751
|
+
isCurrent ? "opacity-100" : done ? "opacity-80" : "opacity-100"
|
|
5752
|
+
)
|
|
5753
|
+
},
|
|
5754
|
+
segment.id
|
|
5755
|
+
);
|
|
5756
|
+
}) }),
|
|
5757
|
+
active ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-center text-xs font-medium text-muted-foreground", children: active.label }) : null
|
|
5758
|
+
]
|
|
5759
|
+
}
|
|
5760
|
+
);
|
|
5761
|
+
}
|
|
5762
|
+
function OptionRow({
|
|
5763
|
+
icon,
|
|
5764
|
+
title,
|
|
5765
|
+
description,
|
|
5766
|
+
badge,
|
|
5767
|
+
badgeVariant = "secondary",
|
|
5768
|
+
showChevron = true,
|
|
5769
|
+
className,
|
|
5770
|
+
type = "button",
|
|
5771
|
+
...props
|
|
5772
|
+
}) {
|
|
5773
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5774
|
+
"button",
|
|
5775
|
+
{
|
|
5776
|
+
type,
|
|
5777
|
+
className: cn(
|
|
5778
|
+
"flex w-full items-center gap-3 rounded-xl border border-border bg-background px-4 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
5779
|
+
className
|
|
5780
|
+
),
|
|
5781
|
+
...props,
|
|
5782
|
+
children: [
|
|
5783
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-5", children: icon }) : null,
|
|
5784
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
5785
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5786
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: title }),
|
|
5787
|
+
badge ? /* @__PURE__ */ jsxRuntime.jsx(badge_js.Badge, { variant: badgeVariant, className: "font-medium", children: badge }) : null
|
|
5788
|
+
] }),
|
|
5789
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 block text-sm text-muted-foreground", children: description }) : null
|
|
5790
|
+
] }),
|
|
5791
|
+
showChevron ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5792
|
+
lucideReact.ChevronRight,
|
|
5793
|
+
{
|
|
5794
|
+
"aria-hidden": true,
|
|
5795
|
+
className: "size-4 shrink-0 text-muted-foreground"
|
|
5796
|
+
}
|
|
5797
|
+
) : null
|
|
5798
|
+
]
|
|
5799
|
+
}
|
|
5800
|
+
);
|
|
5801
|
+
}
|
|
5802
|
+
function StickyActionBar({
|
|
5803
|
+
children,
|
|
5804
|
+
secondary,
|
|
5805
|
+
className,
|
|
5806
|
+
...props
|
|
5807
|
+
}) {
|
|
5808
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5809
|
+
"div",
|
|
5810
|
+
{
|
|
5811
|
+
"data-slot": "sticky-action-bar",
|
|
5812
|
+
className: cn(
|
|
5813
|
+
"sticky bottom-0 z-30 -mx-4 mt-auto border-t border-border bg-background/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80",
|
|
5814
|
+
"pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
5815
|
+
className
|
|
5816
|
+
),
|
|
5817
|
+
...props,
|
|
5818
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex w-full max-w-xl flex-col gap-2 sm:flex-row-reverse sm:items-center sm:justify-start", children: [
|
|
5819
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center", children }),
|
|
5820
|
+
secondary ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 sm:mr-auto", children: secondary }) : null
|
|
5821
|
+
] })
|
|
5822
|
+
}
|
|
5823
|
+
);
|
|
5824
|
+
}
|
|
5825
|
+
var toneVariant = {
|
|
5826
|
+
neutral: "secondary",
|
|
5827
|
+
info: "default",
|
|
5828
|
+
success: "success",
|
|
5829
|
+
warning: "warning",
|
|
5830
|
+
danger: "destructive"
|
|
5831
|
+
};
|
|
5832
|
+
function badgeVariantFor(tone2) {
|
|
5833
|
+
switch (tone2) {
|
|
5834
|
+
case "neutral":
|
|
5835
|
+
return toneVariant.neutral;
|
|
5836
|
+
case "info":
|
|
5837
|
+
return toneVariant.info;
|
|
5838
|
+
case "success":
|
|
5839
|
+
return toneVariant.success;
|
|
5840
|
+
case "warning":
|
|
5841
|
+
return toneVariant.warning;
|
|
5842
|
+
case "danger":
|
|
5843
|
+
return toneVariant.danger;
|
|
5844
|
+
default: {
|
|
5845
|
+
const exhaustive = tone2;
|
|
5846
|
+
return exhaustive;
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
function StatusBadge({
|
|
5851
|
+
label,
|
|
5852
|
+
tone: tone2 = "neutral",
|
|
5853
|
+
className,
|
|
5854
|
+
...props
|
|
5855
|
+
}) {
|
|
5856
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5857
|
+
badge_js.Badge,
|
|
5858
|
+
{
|
|
5859
|
+
"data-slot": "status-badge",
|
|
5860
|
+
"data-tone": tone2,
|
|
5861
|
+
variant: badgeVariantFor(tone2),
|
|
5862
|
+
className: cn("font-medium", className),
|
|
5863
|
+
...props,
|
|
5864
|
+
children: label
|
|
5865
|
+
}
|
|
5866
|
+
);
|
|
5867
|
+
}
|
|
5868
|
+
function DetailHeader({
|
|
5869
|
+
title,
|
|
5870
|
+
badge,
|
|
5871
|
+
subtitle,
|
|
5872
|
+
facts,
|
|
5873
|
+
factsEmpty = "\u2014",
|
|
5874
|
+
primaryAction,
|
|
5875
|
+
secondaryActions = [],
|
|
5876
|
+
moreMenu,
|
|
5877
|
+
moreLabel = "More actions",
|
|
5878
|
+
tabs,
|
|
5879
|
+
className
|
|
5880
|
+
}) {
|
|
5881
|
+
const hasActions = Boolean(primaryAction) || secondaryActions.length > 0 || Boolean(moreMenu);
|
|
5882
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5883
|
+
"header",
|
|
5884
|
+
{
|
|
5885
|
+
"data-slot": "detail-header",
|
|
5886
|
+
className: cn("flex flex-col gap-4", className),
|
|
5887
|
+
children: [
|
|
5888
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4", children: [
|
|
5889
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
5890
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5891
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: title }),
|
|
5892
|
+
badge
|
|
5893
|
+
] }),
|
|
5894
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: subtitle }) : null
|
|
5895
|
+
] }),
|
|
5896
|
+
hasActions ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end", children: [
|
|
5897
|
+
secondaryActions,
|
|
5898
|
+
primaryAction,
|
|
5899
|
+
moreMenu ? /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
5900
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5901
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
5902
|
+
{
|
|
5903
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5904
|
+
button_js.Button,
|
|
5905
|
+
{
|
|
5906
|
+
type: "button",
|
|
5907
|
+
variant: "outline",
|
|
5908
|
+
size: "icon",
|
|
5909
|
+
"aria-label": moreLabel
|
|
5910
|
+
}
|
|
5911
|
+
),
|
|
5912
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4" })
|
|
5913
|
+
}
|
|
5914
|
+
),
|
|
5915
|
+
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuContent, { align: "end", children: moreMenu })
|
|
5916
|
+
] }) : null
|
|
5917
|
+
] }) : null
|
|
5918
|
+
] }),
|
|
5919
|
+
facts && facts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(DataList, { className: "sm:grid-cols-2 lg:grid-cols-3", children: facts.map((fact) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5920
|
+
DataListItem,
|
|
5921
|
+
{
|
|
5922
|
+
label: fact.label,
|
|
5923
|
+
empty: factsEmpty,
|
|
5924
|
+
children: fact.value
|
|
5925
|
+
},
|
|
5926
|
+
fact.label
|
|
5927
|
+
)) }) : null,
|
|
5928
|
+
tabs
|
|
5929
|
+
]
|
|
5930
|
+
}
|
|
5931
|
+
);
|
|
5932
|
+
}
|
|
5933
|
+
function FormSection({
|
|
5934
|
+
title,
|
|
5935
|
+
description,
|
|
5936
|
+
children,
|
|
5937
|
+
aside,
|
|
5938
|
+
className,
|
|
5939
|
+
...props
|
|
5940
|
+
}) {
|
|
5941
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5942
|
+
"section",
|
|
5943
|
+
{
|
|
5944
|
+
"data-slot": "form-section",
|
|
5945
|
+
className: cn(
|
|
5946
|
+
"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 sm:p-6",
|
|
5947
|
+
className
|
|
5948
|
+
),
|
|
5949
|
+
...props,
|
|
5950
|
+
children: [
|
|
5951
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
5952
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-1", children: [
|
|
5953
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-semibold tracking-tight", children: title }),
|
|
5954
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
|
|
5955
|
+
] }),
|
|
5956
|
+
aside ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: aside }) : null
|
|
5957
|
+
] }),
|
|
5958
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2", children })
|
|
5959
|
+
]
|
|
5960
|
+
}
|
|
5961
|
+
);
|
|
5962
|
+
}
|
|
5963
|
+
function useDirtyGuard(dirty) {
|
|
5964
|
+
React3.useEffect(() => {
|
|
5965
|
+
if (!dirty) return;
|
|
5966
|
+
function onBeforeUnload(event) {
|
|
5967
|
+
event.preventDefault();
|
|
5968
|
+
event.returnValue = "";
|
|
5969
|
+
}
|
|
5970
|
+
window.addEventListener("beforeunload", onBeforeUnload);
|
|
5971
|
+
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
5972
|
+
}, [dirty]);
|
|
5973
|
+
}
|
|
5974
|
+
function WizardLayout({
|
|
5975
|
+
steps,
|
|
5976
|
+
current,
|
|
5977
|
+
children,
|
|
5978
|
+
onBack,
|
|
5979
|
+
onNext,
|
|
5980
|
+
backLabel = "Back",
|
|
5981
|
+
nextLabel = "Continue",
|
|
5982
|
+
nextDisabled = false,
|
|
5983
|
+
pending = false,
|
|
5984
|
+
secondary,
|
|
5985
|
+
primary,
|
|
5986
|
+
progressLabel: progressLabel2,
|
|
5987
|
+
className
|
|
5988
|
+
}) {
|
|
5989
|
+
const showBack = current > 0 && (onBack || secondary);
|
|
5990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5991
|
+
"div",
|
|
5992
|
+
{
|
|
5993
|
+
"data-slot": "wizard-layout",
|
|
5994
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-4", className),
|
|
5995
|
+
children: [
|
|
5996
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5997
|
+
StepProgress,
|
|
5998
|
+
{
|
|
5999
|
+
segments: steps,
|
|
6000
|
+
current,
|
|
6001
|
+
"aria-label": progressLabel2
|
|
6002
|
+
}
|
|
6003
|
+
),
|
|
6004
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children }),
|
|
6005
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6006
|
+
StickyActionBar,
|
|
6007
|
+
{
|
|
6008
|
+
secondary: secondary ?? (showBack && onBack ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6009
|
+
button_js.Button,
|
|
6010
|
+
{
|
|
6011
|
+
type: "button",
|
|
6012
|
+
variant: "outline",
|
|
6013
|
+
disabled: pending,
|
|
6014
|
+
onClick: onBack,
|
|
6015
|
+
children: backLabel
|
|
6016
|
+
}
|
|
6017
|
+
) : void 0),
|
|
6018
|
+
children: primary ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6019
|
+
button_js.Button,
|
|
6020
|
+
{
|
|
6021
|
+
type: "button",
|
|
6022
|
+
disabled: nextDisabled || pending || !onNext,
|
|
6023
|
+
onClick: onNext,
|
|
6024
|
+
children: pending ? "\u2026" : nextLabel
|
|
6025
|
+
}
|
|
6026
|
+
)
|
|
6027
|
+
}
|
|
6028
|
+
)
|
|
6029
|
+
]
|
|
6030
|
+
}
|
|
6031
|
+
);
|
|
6032
|
+
}
|
|
6033
|
+
function SectionSummary({
|
|
6034
|
+
title,
|
|
6035
|
+
children,
|
|
6036
|
+
editLabel = "Edit",
|
|
6037
|
+
onEdit,
|
|
6038
|
+
className
|
|
6039
|
+
}) {
|
|
6040
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6041
|
+
"section",
|
|
6042
|
+
{
|
|
6043
|
+
"data-slot": "section-summary",
|
|
6044
|
+
className: cn(
|
|
6045
|
+
"flex flex-col gap-3 rounded-xl border border-border bg-card p-4",
|
|
6046
|
+
className
|
|
6047
|
+
),
|
|
6048
|
+
children: [
|
|
6049
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
6050
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold", children: title }),
|
|
6051
|
+
onEdit ? /* @__PURE__ */ jsxRuntime.jsx(button_js.Button, { type: "button", variant: "ghost", size: "sm", onClick: onEdit, children: editLabel }) : null
|
|
6052
|
+
] }),
|
|
6053
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children })
|
|
6054
|
+
]
|
|
6055
|
+
}
|
|
6056
|
+
);
|
|
6057
|
+
}
|
|
6058
|
+
function QueueLayout({
|
|
6059
|
+
list,
|
|
6060
|
+
review,
|
|
6061
|
+
emptyReview,
|
|
6062
|
+
selectedId,
|
|
6063
|
+
"aria-label": ariaLabel = "Review queue",
|
|
6064
|
+
className,
|
|
6065
|
+
shortcutHint
|
|
6066
|
+
}) {
|
|
6067
|
+
const hasSelection = Boolean(selectedId);
|
|
6068
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6069
|
+
"div",
|
|
6070
|
+
{
|
|
6071
|
+
"data-slot": "queue-layout",
|
|
6072
|
+
"aria-label": ariaLabel,
|
|
6073
|
+
className: cn(
|
|
6074
|
+
"grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(0,22rem)_minmax(0,1fr)] xl:grid-cols-[minmax(0,26rem)_minmax(0,1fr)]",
|
|
6075
|
+
className
|
|
6076
|
+
),
|
|
6077
|
+
children: [
|
|
6078
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6079
|
+
"aside",
|
|
6080
|
+
{
|
|
6081
|
+
"data-slot": "queue-list",
|
|
6082
|
+
className: cn("min-w-0", hasSelection ? "hidden lg:block" : "block"),
|
|
6083
|
+
children: [
|
|
6084
|
+
list,
|
|
6085
|
+
shortcutHint ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: shortcutHint }) : null
|
|
6086
|
+
]
|
|
6087
|
+
}
|
|
6088
|
+
),
|
|
6089
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6090
|
+
"section",
|
|
6091
|
+
{
|
|
6092
|
+
"data-slot": "queue-review",
|
|
6093
|
+
className: cn("min-w-0", hasSelection ? "block" : "hidden lg:block"),
|
|
6094
|
+
children: hasSelection ? review : emptyReview ?? review
|
|
6095
|
+
}
|
|
6096
|
+
)
|
|
6097
|
+
]
|
|
6098
|
+
}
|
|
6099
|
+
);
|
|
6100
|
+
}
|
|
6101
|
+
function isTypingTarget(target) {
|
|
6102
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
6103
|
+
const tag = target.tagName;
|
|
6104
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
|
|
6105
|
+
if (target.isContentEditable) return true;
|
|
6106
|
+
if (target.closest('[role="dialog"]')) return true;
|
|
6107
|
+
if (target.closest('[role="listbox"]')) return true;
|
|
6108
|
+
return false;
|
|
6109
|
+
}
|
|
6110
|
+
function useQueueKeys({
|
|
6111
|
+
enabled = true,
|
|
6112
|
+
ids,
|
|
6113
|
+
selectedId,
|
|
6114
|
+
onSelect
|
|
6115
|
+
}) {
|
|
6116
|
+
const move = React3.useCallback(
|
|
6117
|
+
(delta) => {
|
|
6118
|
+
if (ids.length === 0) return;
|
|
6119
|
+
const currentIndex = selectedId ? ids.indexOf(selectedId) : -1;
|
|
6120
|
+
let nextIndex;
|
|
6121
|
+
if (currentIndex < 0) {
|
|
6122
|
+
nextIndex = delta > 0 ? 0 : ids.length - 1;
|
|
6123
|
+
} else {
|
|
6124
|
+
nextIndex = Math.max(0, Math.min(ids.length - 1, currentIndex + delta));
|
|
6125
|
+
}
|
|
6126
|
+
const nextId = ids[nextIndex];
|
|
6127
|
+
if (nextId) onSelect(nextId);
|
|
6128
|
+
},
|
|
6129
|
+
[ids, onSelect, selectedId]
|
|
6130
|
+
);
|
|
6131
|
+
React3.useEffect(() => {
|
|
6132
|
+
if (!enabled) return;
|
|
6133
|
+
function onKeyDown(event) {
|
|
6134
|
+
if (isTypingTarget(event.target)) return;
|
|
6135
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return;
|
|
6136
|
+
switch (event.key) {
|
|
6137
|
+
case "j":
|
|
6138
|
+
case "J":
|
|
6139
|
+
event.preventDefault();
|
|
6140
|
+
move(1);
|
|
6141
|
+
break;
|
|
6142
|
+
case "k":
|
|
6143
|
+
case "K":
|
|
6144
|
+
event.preventDefault();
|
|
6145
|
+
move(-1);
|
|
6146
|
+
break;
|
|
6147
|
+
case "Escape":
|
|
6148
|
+
if (selectedId) {
|
|
6149
|
+
event.preventDefault();
|
|
6150
|
+
onSelect(null);
|
|
6151
|
+
}
|
|
6152
|
+
break;
|
|
6153
|
+
}
|
|
6154
|
+
}
|
|
6155
|
+
window.addEventListener("keydown", onKeyDown);
|
|
6156
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
6157
|
+
}, [enabled, move, onSelect, selectedId]);
|
|
6158
|
+
}
|
|
6159
|
+
function queueRowKeyDown(event, onOpen) {
|
|
6160
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
6161
|
+
if (isTypingTarget(event.target)) return;
|
|
6162
|
+
event.preventDefault();
|
|
6163
|
+
onOpen();
|
|
6164
|
+
}
|
|
6165
|
+
function SectionCard({
|
|
6166
|
+
id,
|
|
6167
|
+
title,
|
|
6168
|
+
description,
|
|
6169
|
+
badge,
|
|
6170
|
+
headerAction,
|
|
6171
|
+
footer,
|
|
6172
|
+
children,
|
|
6173
|
+
tone: tone2 = "default",
|
|
6174
|
+
className,
|
|
6175
|
+
animate = true
|
|
6176
|
+
}) {
|
|
6177
|
+
const reduceMotion = framerMotion.useReducedMotion();
|
|
6178
|
+
const skipMotion = !animate || reduceMotion;
|
|
6179
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6180
|
+
framerMotion.motion.section,
|
|
6181
|
+
{
|
|
6182
|
+
id,
|
|
6183
|
+
"data-slot": "section-card",
|
|
6184
|
+
"data-tone": tone2,
|
|
6185
|
+
className: cn(
|
|
6186
|
+
"scroll-mt-24 rounded-xl",
|
|
6187
|
+
tone2 === "danger" && "ring-1 ring-destructive/30",
|
|
6188
|
+
className
|
|
6189
|
+
),
|
|
6190
|
+
initial: skipMotion ? false : { opacity: 0, y: 8 },
|
|
6191
|
+
whileInView: skipMotion ? void 0 : { opacity: 1, y: 0 },
|
|
6192
|
+
viewport: { once: true, margin: "-40px" },
|
|
6193
|
+
transition: { duration: 0.25, ease: "easeOut" },
|
|
6194
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6195
|
+
card_js.Card,
|
|
6196
|
+
{
|
|
6197
|
+
className: cn(
|
|
6198
|
+
tone2 === "danger" && "border-destructive/40 bg-destructive/5"
|
|
6199
|
+
),
|
|
6200
|
+
children: [
|
|
6201
|
+
/* @__PURE__ */ jsxRuntime.jsxs(card_js.CardHeader, { className: "flex flex-row flex-wrap items-start justify-between gap-3 space-y-0", children: [
|
|
6202
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-1.5", children: [
|
|
6203
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6204
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6205
|
+
card_js.CardTitle,
|
|
6206
|
+
{
|
|
6207
|
+
className: cn(
|
|
6208
|
+
"text-lg",
|
|
6209
|
+
tone2 === "danger" && "text-destructive"
|
|
6210
|
+
),
|
|
6211
|
+
children: title
|
|
6212
|
+
}
|
|
6213
|
+
),
|
|
6214
|
+
badge
|
|
6215
|
+
] }),
|
|
6216
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx(card_js.CardDescription, { children: description }) : null
|
|
6217
|
+
] }),
|
|
6218
|
+
headerAction ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: headerAction }) : null
|
|
6219
|
+
] }),
|
|
6220
|
+
/* @__PURE__ */ jsxRuntime.jsx(card_js.CardContent, { children }),
|
|
6221
|
+
footer ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end border-t border-border/60 px-6 pb-6 pt-4", children: footer }) : null
|
|
6222
|
+
]
|
|
6223
|
+
}
|
|
6224
|
+
)
|
|
6225
|
+
}
|
|
6226
|
+
);
|
|
6227
|
+
}
|
|
6228
|
+
|
|
6229
|
+
// src/lib/prefers-reduced-motion.ts
|
|
6230
|
+
function prefersReducedMotion() {
|
|
6231
|
+
if (typeof window === "undefined" || !window.matchMedia) return false;
|
|
6232
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6233
|
+
}
|
|
6234
|
+
function useSectionNav(sections) {
|
|
6235
|
+
const [active, setActive] = React3.useState(sections[0]?.id ?? "");
|
|
6236
|
+
React3.useEffect(() => {
|
|
6237
|
+
const elements = sections.map((section) => document.getElementById(section.id)).filter((node) => node !== null);
|
|
6238
|
+
if (elements.length === 0) return;
|
|
6239
|
+
const observer = new IntersectionObserver(
|
|
6240
|
+
(entries) => {
|
|
6241
|
+
const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => b.intersectionRatio - a.intersectionRatio);
|
|
6242
|
+
const top = visible[0]?.target.id;
|
|
6243
|
+
if (top) setActive(top);
|
|
6244
|
+
},
|
|
6245
|
+
{ rootMargin: "-20% 0px -55% 0px", threshold: [0, 0.25, 0.5, 1] }
|
|
6246
|
+
);
|
|
6247
|
+
for (const element of elements) observer.observe(element);
|
|
6248
|
+
return () => observer.disconnect();
|
|
6249
|
+
}, [sections]);
|
|
6250
|
+
function scrollToSection(id) {
|
|
6251
|
+
document.getElementById(id)?.scrollIntoView({
|
|
6252
|
+
behavior: prefersReducedMotion() ? "auto" : "smooth",
|
|
6253
|
+
block: "start"
|
|
6254
|
+
});
|
|
6255
|
+
setActive(id);
|
|
6256
|
+
}
|
|
6257
|
+
return { active, scrollToSection };
|
|
6258
|
+
}
|
|
6259
|
+
function SectionNavList({
|
|
6260
|
+
sections,
|
|
6261
|
+
active,
|
|
6262
|
+
onSelect,
|
|
6263
|
+
ariaLabel,
|
|
6264
|
+
className,
|
|
6265
|
+
layout
|
|
6266
|
+
}) {
|
|
6267
|
+
if (layout === "mobile") {
|
|
6268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6269
|
+
"nav",
|
|
6270
|
+
{
|
|
6271
|
+
"data-slot": "section-nav",
|
|
6272
|
+
className: cn("flex gap-2 overflow-x-auto pb-1", className),
|
|
6273
|
+
"aria-label": ariaLabel,
|
|
6274
|
+
children: sections.map((section) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6275
|
+
"button",
|
|
6276
|
+
{
|
|
6277
|
+
type: "button",
|
|
6278
|
+
onClick: () => onSelect(section.id),
|
|
6279
|
+
className: cn(
|
|
6280
|
+
"shrink-0 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors",
|
|
6281
|
+
active === section.id ? "border-primary/30 bg-primary/10 text-foreground" : "border-border bg-background/60 text-muted-foreground"
|
|
6282
|
+
),
|
|
6283
|
+
"aria-current": active === section.id ? "true" : void 0,
|
|
6284
|
+
children: section.label
|
|
6285
|
+
},
|
|
6286
|
+
section.id
|
|
6287
|
+
))
|
|
6288
|
+
}
|
|
6289
|
+
);
|
|
6290
|
+
}
|
|
6291
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "data-slot": "section-nav", className, "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sticky top-20 space-y-1", children: sections.map((section) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6292
|
+
"button",
|
|
6293
|
+
{
|
|
6294
|
+
type: "button",
|
|
6295
|
+
onClick: () => onSelect(section.id),
|
|
6296
|
+
className: cn(
|
|
6297
|
+
"w-full rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors",
|
|
6298
|
+
active === section.id ? "bg-primary/10 text-foreground" : "text-muted-foreground hover:bg-muted/60 hover:text-foreground"
|
|
6299
|
+
),
|
|
6300
|
+
"aria-current": active === section.id ? "true" : void 0,
|
|
6301
|
+
children: section.label
|
|
6302
|
+
}
|
|
6303
|
+
) }, section.id)) }) });
|
|
6304
|
+
}
|
|
6305
|
+
function SectionNav({
|
|
6306
|
+
sections,
|
|
6307
|
+
ariaLabel,
|
|
6308
|
+
className
|
|
6309
|
+
}) {
|
|
6310
|
+
const { active, scrollToSection } = useSectionNav(sections);
|
|
6311
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6312
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6313
|
+
SectionNavList,
|
|
6314
|
+
{
|
|
6315
|
+
sections,
|
|
6316
|
+
active,
|
|
6317
|
+
onSelect: scrollToSection,
|
|
6318
|
+
ariaLabel,
|
|
6319
|
+
layout: "mobile",
|
|
6320
|
+
className: cn("md:hidden", className)
|
|
6321
|
+
}
|
|
6322
|
+
),
|
|
6323
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6324
|
+
SectionNavList,
|
|
6325
|
+
{
|
|
6326
|
+
sections,
|
|
6327
|
+
active,
|
|
6328
|
+
onSelect: scrollToSection,
|
|
6329
|
+
ariaLabel,
|
|
6330
|
+
layout: "desktop",
|
|
6331
|
+
className: cn("hidden md:block", className)
|
|
6332
|
+
}
|
|
6333
|
+
)
|
|
6334
|
+
] });
|
|
6335
|
+
}
|
|
6336
|
+
function SettingRow({
|
|
6337
|
+
label,
|
|
6338
|
+
description,
|
|
6339
|
+
control,
|
|
6340
|
+
className,
|
|
6341
|
+
htmlFor
|
|
6342
|
+
}) {
|
|
6343
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6344
|
+
"div",
|
|
6345
|
+
{
|
|
6346
|
+
"data-slot": "setting-row",
|
|
6347
|
+
className: cn(
|
|
6348
|
+
"flex flex-col gap-3 border-b border-border py-4 last:border-b-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6",
|
|
6349
|
+
className
|
|
6350
|
+
),
|
|
6351
|
+
children: [
|
|
6352
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-1", children: [
|
|
6353
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6354
|
+
"label",
|
|
6355
|
+
{
|
|
6356
|
+
htmlFor,
|
|
6357
|
+
className: "text-sm font-medium text-foreground",
|
|
6358
|
+
children: label
|
|
6359
|
+
}
|
|
6360
|
+
),
|
|
6361
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
|
|
6362
|
+
] }),
|
|
6363
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 sm:text-right", children: control })
|
|
6364
|
+
]
|
|
6365
|
+
}
|
|
6366
|
+
);
|
|
6367
|
+
}
|
|
5080
6368
|
function sanitizeHref(href) {
|
|
5081
6369
|
const trimmed = href.trim();
|
|
5082
6370
|
if (/^https?:\/\//i.test(trimmed) || /^mailto:/i.test(trimmed)) {
|
|
@@ -5184,10 +6472,10 @@ var DEFAULT_AUDIT_TIMELINE_LABELS = {
|
|
|
5184
6472
|
actor: "Actor",
|
|
5185
6473
|
subject: "Subject"
|
|
5186
6474
|
};
|
|
5187
|
-
function formatOccurredAt(occurredAt) {
|
|
6475
|
+
function formatOccurredAt(occurredAt, locale = "en") {
|
|
5188
6476
|
const date = new Date(occurredAt);
|
|
5189
6477
|
if (Number.isNaN(date.getTime())) return String(occurredAt);
|
|
5190
|
-
return new Intl.DateTimeFormat(
|
|
6478
|
+
return new Intl.DateTimeFormat(locale, {
|
|
5191
6479
|
dateStyle: "medium",
|
|
5192
6480
|
timeStyle: "short",
|
|
5193
6481
|
timeZone: "America/Mexico_City"
|
|
@@ -5202,9 +6490,11 @@ function AuditTimeline({
|
|
|
5202
6490
|
labels,
|
|
5203
6491
|
emptyAction,
|
|
5204
6492
|
className,
|
|
5205
|
-
|
|
6493
|
+
locale = "en",
|
|
6494
|
+
formatOccurredAt: format
|
|
5206
6495
|
}) {
|
|
5207
6496
|
const copy = { ...DEFAULT_AUDIT_TIMELINE_LABELS, ...labels };
|
|
6497
|
+
const formatTime = format ?? ((occurredAt) => formatOccurredAt(occurredAt, locale));
|
|
5208
6498
|
if (items.length === 0) {
|
|
5209
6499
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5210
6500
|
EmptyState,
|
|
@@ -5226,7 +6516,7 @@ function AuditTimeline({
|
|
|
5226
6516
|
children: [
|
|
5227
6517
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [
|
|
5228
6518
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-mono text-sm font-medium", children: item.type }),
|
|
5229
|
-
/* @__PURE__ */ jsxRuntime.jsx("time", { className: "text-xs text-muted-foreground", dateTime: iso, children:
|
|
6519
|
+
/* @__PURE__ */ jsxRuntime.jsx("time", { className: "text-xs text-muted-foreground", dateTime: iso, children: formatTime(item.occurredAt) })
|
|
5230
6520
|
] }),
|
|
5231
6521
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm", children: item.summary }),
|
|
5232
6522
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-2 text-xs text-muted-foreground", children: [
|
|
@@ -5422,8 +6712,8 @@ function MatchReview({
|
|
|
5422
6712
|
className
|
|
5423
6713
|
}) {
|
|
5424
6714
|
const copy = { ...DEFAULT_MATCH_REVIEW_LABELS, ...labels };
|
|
5425
|
-
const reasonId =
|
|
5426
|
-
const [reason, setReason] =
|
|
6715
|
+
const reasonId = React3.useId();
|
|
6716
|
+
const [reason, setReason] = React3.useState("");
|
|
5427
6717
|
const trimmed = reason.trim();
|
|
5428
6718
|
if (!hit) {
|
|
5429
6719
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5535,10 +6825,12 @@ exports.COOKIE_CONSENT_MAX_AGE = COOKIE_CONSENT_MAX_AGE;
|
|
|
5535
6825
|
exports.COOKIE_CONSENT_NAME = COOKIE_CONSENT_NAME;
|
|
5536
6826
|
exports.COOKIE_CONSENT_VALUES = COOKIE_CONSENT_VALUES;
|
|
5537
6827
|
exports.COUNTRY_OPTIONS = COUNTRY_OPTIONS;
|
|
6828
|
+
exports.CURP_REGEX = CURP_REGEX;
|
|
5538
6829
|
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
5539
6830
|
exports.CookieConsentBanner = CookieConsentBanner;
|
|
5540
6831
|
exports.CostBreakdownCard = CostBreakdownCard;
|
|
5541
6832
|
exports.CountryPicker = CountryPicker;
|
|
6833
|
+
exports.CurpInput = CurpInput;
|
|
5542
6834
|
exports.DATA_TABLE_ROW_CLASS = DATA_TABLE_ROW_CLASS;
|
|
5543
6835
|
exports.DEFAULT_AUDIT_TIMELINE_LABELS = DEFAULT_AUDIT_TIMELINE_LABELS;
|
|
5544
6836
|
exports.DEFAULT_COOKIE_CONSENT_BANNER_LABELS = DEFAULT_COOKIE_CONSENT_BANNER_LABELS;
|
|
@@ -5557,6 +6849,7 @@ exports.DataList = DataList;
|
|
|
5557
6849
|
exports.DataListItem = DataListItem;
|
|
5558
6850
|
exports.DataTable = DataTable;
|
|
5559
6851
|
exports.DataTableSkeleton = DataTableSkeleton;
|
|
6852
|
+
exports.DetailHeader = DetailHeader;
|
|
5560
6853
|
exports.DetailPageSkeleton = DetailPageSkeleton;
|
|
5561
6854
|
exports.DimensionBreakdownTable = DimensionBreakdownTable;
|
|
5562
6855
|
exports.EditableSection = EditableSection;
|
|
@@ -5575,6 +6868,7 @@ exports.FileDropzone = FileDropzone;
|
|
|
5575
6868
|
exports.FileUploadMenu = FileUploadMenu;
|
|
5576
6869
|
exports.FileUploadTray = FileUploadTray;
|
|
5577
6870
|
exports.FormCardSkeleton = FormCardSkeleton;
|
|
6871
|
+
exports.FormSection = FormSection;
|
|
5578
6872
|
exports.LanguageContext = LanguageContext;
|
|
5579
6873
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
5580
6874
|
exports.LegalAcceptCheckbox = LegalAcceptCheckbox;
|
|
@@ -5589,15 +6883,27 @@ exports.MetricSkeleton = MetricSkeleton;
|
|
|
5589
6883
|
exports.NavTabs = NavTabs;
|
|
5590
6884
|
exports.NavigationProgress = NavigationProgress;
|
|
5591
6885
|
exports.NotificationBell = NotificationBell;
|
|
6886
|
+
exports.OptionRow = OptionRow;
|
|
5592
6887
|
exports.PageContainer = PageContainer;
|
|
5593
6888
|
exports.PageTitle = PageTitle;
|
|
5594
6889
|
exports.PageTitleSkeleton = PageTitleSkeleton;
|
|
5595
6890
|
exports.PaginatedCombobox = PaginatedCombobox;
|
|
6891
|
+
exports.QueueLayout = QueueLayout;
|
|
6892
|
+
exports.RfcInput = RfcInput;
|
|
5596
6893
|
exports.RiskBadge = RiskBadge;
|
|
5597
6894
|
exports.RouteLoading = RouteLoading;
|
|
5598
6895
|
exports.SafeImage = SafeImage;
|
|
6896
|
+
exports.SearchablePicker = SearchablePicker;
|
|
6897
|
+
exports.SectionCard = SectionCard;
|
|
6898
|
+
exports.SectionNav = SectionNav;
|
|
6899
|
+
exports.SectionNavList = SectionNavList;
|
|
6900
|
+
exports.SectionSummary = SectionSummary;
|
|
6901
|
+
exports.SettingRow = SettingRow;
|
|
5599
6902
|
exports.SparklineStat = SparklineStat;
|
|
5600
6903
|
exports.StatHighlightCard = StatHighlightCard;
|
|
6904
|
+
exports.StatusBadge = StatusBadge;
|
|
6905
|
+
exports.StepProgress = StepProgress;
|
|
6906
|
+
exports.StickyActionBar = StickyActionBar;
|
|
5601
6907
|
exports.THEME_INIT_SCRIPT = THEME_INIT_SCRIPT;
|
|
5602
6908
|
exports.THEME_INIT_SCRIPT_ID = THEME_INIT_SCRIPT_ID;
|
|
5603
6909
|
exports.THEME_STORAGE_KEY = THEME_STORAGE_KEY;
|
|
@@ -5605,6 +6911,7 @@ exports.TIME_RANGE_OPTIONS = TIME_RANGE_OPTIONS;
|
|
|
5605
6911
|
exports.TableSkeleton = TableSkeleton;
|
|
5606
6912
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
5607
6913
|
exports.TimeRangePicker = TimeRangePicker;
|
|
6914
|
+
exports.WizardLayout = WizardLayout;
|
|
5608
6915
|
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
5609
6916
|
exports.cn = cn;
|
|
5610
6917
|
exports.cookieConsentAllowsReplay = cookieConsentAllowsReplay;
|
|
@@ -5612,6 +6919,7 @@ exports.cookieDomainFromHostname = cookieDomainFromHostname;
|
|
|
5612
6919
|
exports.countryLabel = countryLabel;
|
|
5613
6920
|
exports.countryPickerItems = countryPickerItems;
|
|
5614
6921
|
exports.createMultipartUploadController = createMultipartUploadController;
|
|
6922
|
+
exports.curpCheckDigit = curpCheckDigit;
|
|
5615
6923
|
exports.defaultLanguages = defaultLanguages;
|
|
5616
6924
|
exports.fileMatchesAccept = fileMatchesAccept;
|
|
5617
6925
|
exports.filterCountries = filterCountries;
|
|
@@ -5622,18 +6930,27 @@ exports.isCookieConsentValue = isCookieConsentValue;
|
|
|
5622
6930
|
exports.isEmbeddedWindow = isEmbeddedWindow;
|
|
5623
6931
|
exports.isKnownCountryCode = isKnownCountryCode;
|
|
5624
6932
|
exports.matchClaimIsUnverified = matchClaimIsUnverified;
|
|
6933
|
+
exports.normalizeCurpInput = normalizeCurpInput;
|
|
6934
|
+
exports.normalizeRfc = normalizeRfc;
|
|
5625
6935
|
exports.parseCookieConsent = parseCookieConsent;
|
|
5626
6936
|
exports.partRanges = partRanges;
|
|
5627
6937
|
exports.progressFromBytes = progressFromBytes;
|
|
6938
|
+
exports.queueRowKeyDown = queueRowKeyDown;
|
|
5628
6939
|
exports.readCookieConsent = readCookieConsent;
|
|
5629
6940
|
exports.renderShellLink = renderShellLink;
|
|
6941
|
+
exports.rfcMaxLengthForPersonKind = rfcMaxLengthForPersonKind;
|
|
5630
6942
|
exports.serializeCookieConsent = serializeCookieConsent;
|
|
5631
6943
|
exports.signalNavigationStart = signalNavigationStart;
|
|
5632
6944
|
exports.sourceUrlIsHttps = sourceUrlIsHttps;
|
|
5633
6945
|
exports.suppressNavigationProgress = suppressNavigationProgress;
|
|
6946
|
+
exports.useDirtyGuard = useDirtyGuard;
|
|
5634
6947
|
exports.useEditableSection = useEditableSection;
|
|
5635
6948
|
exports.useLanguageContext = useLanguageContext;
|
|
5636
|
-
exports.useMediaQuery =
|
|
6949
|
+
exports.useMediaQuery = useMediaQuery;
|
|
6950
|
+
exports.useQueueKeys = useQueueKeys;
|
|
6951
|
+
exports.useSectionNav = useSectionNav;
|
|
6952
|
+
exports.validateCurp = validateCurp;
|
|
6953
|
+
exports.validateRfcForPersonKind = validateRfcForPersonKind;
|
|
5637
6954
|
exports.writeCookieConsent = writeCookieConsent;
|
|
5638
6955
|
//# sourceMappingURL=index.cjs.map
|
|
5639
6956
|
//# sourceMappingURL=index.cjs.map
|