@upbound/monarch-blocks 0.13.1 → 0.13.3
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/chat-interface.js +60 -59
- package/dist/chat-interface.js.map +1 -1
- package/dist/data-table.d.ts +4 -3
- package/dist/data-table.js +429 -383
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-BgEn71l5.d.ts → empty-view-DQt8-Ho8.d.ts} +9 -2
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +242 -185
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +633 -603
- package/dist/index.js.map +1 -1
- package/dist/relative-time.d.ts +1 -1
- package/dist/relative-time.js +6 -11
- package/dist/relative-time.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2171,7 +2171,8 @@ function SectionNavSub(_a) {
|
|
|
2171
2171
|
|
|
2172
2172
|
// src/relative-time.tsx
|
|
2173
2173
|
import * as React3 from "react";
|
|
2174
|
-
import {
|
|
2174
|
+
import { Tooltip as Tooltip2, TooltipContent, TooltipTrigger } from "@upbound/monarch-core";
|
|
2175
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2175
2176
|
function formatRelativeDefault(date, locale) {
|
|
2176
2177
|
const now = /* @__PURE__ */ new Date();
|
|
2177
2178
|
const diffMs = now.getTime() - date.getTime();
|
|
@@ -2276,16 +2277,10 @@ function RelativeTime(_a) {
|
|
|
2276
2277
|
const id = schedule();
|
|
2277
2278
|
return () => window.clearInterval(id);
|
|
2278
2279
|
}, [d, variant, locale]);
|
|
2279
|
-
return /* @__PURE__ */
|
|
2280
|
-
"time",
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
title: title != null ? title : absoluteTitle(d, locale),
|
|
2284
|
-
className: cn("tabular-nums", className)
|
|
2285
|
-
}, props), {
|
|
2286
|
-
children: label
|
|
2287
|
-
})
|
|
2288
|
-
);
|
|
2280
|
+
return /* @__PURE__ */ jsxs3(Tooltip2, { children: [
|
|
2281
|
+
/* @__PURE__ */ jsx4(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx4("time", __spreadProps(__spreadValues({ dateTime: d.toISOString(), className: cn("tabular-nums", className) }, props), { children: label })) }),
|
|
2282
|
+
/* @__PURE__ */ jsx4(TooltipContent, { children: title != null ? title : absoluteTitle(d, locale) })
|
|
2283
|
+
] });
|
|
2289
2284
|
}
|
|
2290
2285
|
function formatAmPm(date, options, locale) {
|
|
2291
2286
|
const parts = new Intl.DateTimeFormat(locale, options).formatToParts(date);
|
|
@@ -2412,8 +2407,8 @@ function ElapsedTime(_a) {
|
|
|
2412
2407
|
|
|
2413
2408
|
// src/chat-interface.tsx
|
|
2414
2409
|
import { Marker, MarkerContent, MarkerIcon } from "@upbound/monarch-core";
|
|
2415
|
-
import { Tooltip as
|
|
2416
|
-
import { jsx as jsx5, jsxs as
|
|
2410
|
+
import { Tooltip as Tooltip3, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@upbound/monarch-core";
|
|
2411
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2417
2412
|
function formatRelativeTime(iso) {
|
|
2418
2413
|
const diffMs = Date.now() - new Date(iso).getTime();
|
|
2419
2414
|
const s = Math.round(diffMs / 1e3);
|
|
@@ -2444,7 +2439,7 @@ function formatExactTime(iso) {
|
|
|
2444
2439
|
function ChatSessionList({ sessions, activeSessionId, onSelectSession, className }) {
|
|
2445
2440
|
return /* @__PURE__ */ jsx5("div", { className: cn("bg-background flex h-full flex-col", className), children: /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx5(ItemGroup, { className: "gap-1 p-2", children: sessions.map((session) => {
|
|
2446
2441
|
const isActive = session.id === activeSessionId;
|
|
2447
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ jsxs4(
|
|
2448
2443
|
Item,
|
|
2449
2444
|
{
|
|
2450
2445
|
role: "button",
|
|
@@ -2462,11 +2457,11 @@ function ChatSessionList({ sessions, activeSessionId, onSelectSession, className
|
|
|
2462
2457
|
"group/session-item hover:bg-muted/50 data-[active=true]:bg-accent data-[active=true]:text-accent-foreground cursor-pointer flex-nowrap"
|
|
2463
2458
|
),
|
|
2464
2459
|
children: [
|
|
2465
|
-
/* @__PURE__ */
|
|
2460
|
+
/* @__PURE__ */ jsxs4(ItemContent, { className: "min-w-0", children: [
|
|
2466
2461
|
/* @__PURE__ */ jsx5(ItemTitle, { className: "truncate", children: session.title }),
|
|
2467
|
-
/* @__PURE__ */
|
|
2462
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2468
2463
|
session.surface && /* @__PURE__ */ jsx5(Badge2, { variant: "outline", className: "text-[10px]", children: session.surface }),
|
|
2469
|
-
session.messageCount != null && /* @__PURE__ */
|
|
2464
|
+
session.messageCount != null && /* @__PURE__ */ jsxs4("span", { className: "text-muted-foreground text-[10px]", children: [
|
|
2470
2465
|
session.messageCount,
|
|
2471
2466
|
" msgs"
|
|
2472
2467
|
] }),
|
|
@@ -2480,7 +2475,7 @@ function ChatSessionList({ sessions, activeSessionId, onSelectSession, className
|
|
|
2480
2475
|
)
|
|
2481
2476
|
] })
|
|
2482
2477
|
] }),
|
|
2483
|
-
/* @__PURE__ */ jsx5(ItemActions, { className: "opacity-0 group-hover/session-item:opacity-100 has-data-[state=open]:opacity-100 motion-safe:transition-opacity", children: /* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ jsx5(ItemActions, { className: "opacity-0 group-hover/session-item:opacity-100 has-data-[state=open]:opacity-100 motion-safe:transition-opacity", children: /* @__PURE__ */ jsxs4(DropdownMenu, { children: [
|
|
2484
2479
|
/* @__PURE__ */ jsx5(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx5(
|
|
2485
2480
|
Button2,
|
|
2486
2481
|
{
|
|
@@ -2491,7 +2486,7 @@ function ChatSessionList({ sessions, activeSessionId, onSelectSession, className
|
|
|
2491
2486
|
children: /* @__PURE__ */ jsx5(Icon2, { name: "ellipsis" })
|
|
2492
2487
|
}
|
|
2493
2488
|
) }),
|
|
2494
|
-
/* @__PURE__ */
|
|
2489
|
+
/* @__PURE__ */ jsxs4(DropdownMenuContent, { align: "end", children: [
|
|
2495
2490
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Pin" }),
|
|
2496
2491
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Rename" }),
|
|
2497
2492
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Share" }),
|
|
@@ -2512,7 +2507,7 @@ function ChatMessageBubble({
|
|
|
2512
2507
|
assistantName = "Upbound AI"
|
|
2513
2508
|
}) {
|
|
2514
2509
|
const isUser = message.role === "user";
|
|
2515
|
-
const messageFooter = /* @__PURE__ */
|
|
2510
|
+
const messageFooter = /* @__PURE__ */ jsxs4(
|
|
2516
2511
|
"div",
|
|
2517
2512
|
{
|
|
2518
2513
|
className: cn(
|
|
@@ -2520,8 +2515,8 @@ function ChatMessageBubble({
|
|
|
2520
2515
|
isUser && "justify-end"
|
|
2521
2516
|
),
|
|
2522
2517
|
children: [
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */ jsx5(
|
|
2518
|
+
/* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
2519
|
+
/* @__PURE__ */ jsx5(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx5(
|
|
2525
2520
|
Button2,
|
|
2526
2521
|
{
|
|
2527
2522
|
variant: "ghost",
|
|
@@ -2531,35 +2526,35 @@ function ChatMessageBubble({
|
|
|
2531
2526
|
children: /* @__PURE__ */ jsx5(Icon2, { name: "copy" })
|
|
2532
2527
|
}
|
|
2533
2528
|
) }),
|
|
2534
|
-
/* @__PURE__ */ jsx5(
|
|
2529
|
+
/* @__PURE__ */ jsx5(TooltipContent2, { children: "Copy" })
|
|
2535
2530
|
] }),
|
|
2536
|
-
message.timestamp && /* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */ jsx5(
|
|
2538
|
-
/* @__PURE__ */ jsx5(
|
|
2531
|
+
message.timestamp && /* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
2532
|
+
/* @__PURE__ */ jsx5(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx5("span", { className: "text-caption text-muted-foreground", children: formatRelativeTime(message.timestamp) }) }),
|
|
2533
|
+
/* @__PURE__ */ jsx5(TooltipContent2, { children: formatExactTime(message.timestamp) })
|
|
2539
2534
|
] })
|
|
2540
2535
|
]
|
|
2541
2536
|
}
|
|
2542
2537
|
);
|
|
2543
2538
|
if (isUser) {
|
|
2544
|
-
return /* @__PURE__ */ jsx5(Message, { align: "end", className: "group/chat-message", children: /* @__PURE__ */
|
|
2539
|
+
return /* @__PURE__ */ jsx5(Message, { align: "end", className: "group/chat-message", children: /* @__PURE__ */ jsxs4(MessageContent, { className: "max-w-2xl", children: [
|
|
2545
2540
|
/* @__PURE__ */ jsx5(Bubble, { variant: "default", align: "end", children: /* @__PURE__ */ jsx5(BubbleContent, { className: "whitespace-pre-wrap", children: message.content }) }),
|
|
2546
2541
|
messageFooter
|
|
2547
2542
|
] }) });
|
|
2548
2543
|
}
|
|
2549
|
-
return /* @__PURE__ */ jsx5(Message, { align: "start", className: "group/chat-message", children: /* @__PURE__ */
|
|
2550
|
-
/* @__PURE__ */
|
|
2544
|
+
return /* @__PURE__ */ jsx5(Message, { align: "start", className: "group/chat-message", children: /* @__PURE__ */ jsxs4(MessageContent, { className: "max-w-2xl", children: [
|
|
2545
|
+
/* @__PURE__ */ jsxs4("div", { className: "text-body text-foreground mb-2 flex items-center gap-1.5 font-semibold", children: [
|
|
2551
2546
|
/* @__PURE__ */ jsx5(Icon2, { name: "sparkles", size: "default", className: "text-primary" }),
|
|
2552
2547
|
assistantName
|
|
2553
2548
|
] }),
|
|
2554
|
-
message.toolCalls && message.toolCalls.length > 0 && /* @__PURE__ */ jsx5("div", { className: "mb-3 space-y-1.5", children: message.toolCalls.map((tc, i) => /* @__PURE__ */
|
|
2549
|
+
message.toolCalls && message.toolCalls.length > 0 && /* @__PURE__ */ jsx5("div", { className: "mb-3 space-y-1.5", children: message.toolCalls.map((tc, i) => /* @__PURE__ */ jsxs4("div", { className: "bg-muted/50 text-body-sm flex items-start gap-2 rounded border px-3 py-2", children: [
|
|
2555
2550
|
/* @__PURE__ */ jsx5(Icon2, { name: "wrench", size: "sm", className: "text-muted-foreground mt-0.5 shrink-0" }),
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2551
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2552
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2558
2553
|
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: tc.name }),
|
|
2559
2554
|
tc.isNew && /* @__PURE__ */ jsx5(Badge2, { variant: "secondary", className: "text-[10px]", children: "New API" })
|
|
2560
2555
|
] }),
|
|
2561
2556
|
tc.description && /* @__PURE__ */ jsx5("div", { className: "text-muted-foreground mt-0.5 font-mono text-[10px]", children: tc.description }),
|
|
2562
|
-
tc.apiUsed && /* @__PURE__ */
|
|
2557
|
+
tc.apiUsed && /* @__PURE__ */ jsxs4("div", { className: "text-muted-foreground mt-0.5", children: [
|
|
2563
2558
|
"via ",
|
|
2564
2559
|
tc.apiUsed
|
|
2565
2560
|
] })
|
|
@@ -2589,7 +2584,7 @@ function ChatInput({
|
|
|
2589
2584
|
onSend == null ? void 0 : onSend(value.trim());
|
|
2590
2585
|
setValue("");
|
|
2591
2586
|
}
|
|
2592
|
-
return /* @__PURE__ */ jsx5("div", { className: cn("shrink-0 p-3", className), children: /* @__PURE__ */
|
|
2587
|
+
return /* @__PURE__ */ jsx5("div", { className: cn("shrink-0 p-3", className), children: /* @__PURE__ */ jsxs4(InputGroup2, { className: "has-[[data-slot=input-group-control]:focus-visible]:border-input! has-[[data-slot=input-group-control]:focus-visible]:ring-0!", children: [
|
|
2593
2588
|
/* @__PURE__ */ jsx5(
|
|
2594
2589
|
InputGroupTextarea,
|
|
2595
2590
|
{
|
|
@@ -2606,24 +2601,24 @@ function ChatInput({
|
|
|
2606
2601
|
rows: 1
|
|
2607
2602
|
}
|
|
2608
2603
|
),
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
routines !== void 0 && /* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */ jsx5(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs4(InputGroupAddon2, { align: "block-end", children: [
|
|
2605
|
+
routines !== void 0 && /* @__PURE__ */ jsxs4(DropdownMenu, { children: [
|
|
2606
|
+
/* @__PURE__ */ jsx5(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button2, { variant: "ghost", size: "sm", children: [
|
|
2612
2607
|
/* @__PURE__ */ jsx5(Icon2, { name: "wand-magic-sparkles", "data-icon": "inline-start" }),
|
|
2613
2608
|
"Workflows",
|
|
2614
2609
|
/* @__PURE__ */ jsx5(Icon2, { name: "chevron-down", "data-icon": "inline-end" })
|
|
2615
2610
|
] }) }),
|
|
2616
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ jsxs4(DropdownMenuContent, { align: "start", children: [
|
|
2617
2612
|
/* @__PURE__ */ jsx5("div", { className: "max-h-64 overflow-y-auto", children: routines.length === 0 ? /* @__PURE__ */ jsx5(DropdownMenuItem, { disabled: true, children: "No workflows yet" }) : routines.map((w) => /* @__PURE__ */ jsx5(DropdownMenuItem, { onSelect: () => onSelectRoutine == null ? void 0 : onSelectRoutine(w.id), children: w.name }, w.id)) }),
|
|
2618
2613
|
/* @__PURE__ */ jsx5(DropdownMenuSeparator, {}),
|
|
2619
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsxs4(DropdownMenuItem, { onSelect: onManageRoutines, children: [
|
|
2620
2615
|
/* @__PURE__ */ jsx5(Icon2, { name: "gear" }),
|
|
2621
2616
|
"Manage workflows"
|
|
2622
2617
|
] })
|
|
2623
2618
|
] })
|
|
2624
2619
|
] }),
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */ jsx5(
|
|
2620
|
+
/* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
2621
|
+
/* @__PURE__ */ jsx5(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx5(
|
|
2627
2622
|
Button2,
|
|
2628
2623
|
{
|
|
2629
2624
|
variant: "ghost",
|
|
@@ -2638,15 +2633,15 @@ function ChatInput({
|
|
|
2638
2633
|
children: /* @__PURE__ */ jsx5(Icon2, { name: "expand" })
|
|
2639
2634
|
}
|
|
2640
2635
|
) }),
|
|
2641
|
-
/* @__PURE__ */ jsx5(
|
|
2636
|
+
/* @__PURE__ */ jsx5(TooltipContent2, { children: usePageAsContext ? "Using page as context" : "Use page as context" })
|
|
2642
2637
|
] }),
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */ jsx5(
|
|
2645
|
-
/* @__PURE__ */ jsx5(
|
|
2638
|
+
/* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
2639
|
+
/* @__PURE__ */ jsx5(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx5(Button2, { variant: "ghost", size: "icon-sm", onClick: onAttach, "aria-label": "Attach image, file, or video", children: /* @__PURE__ */ jsx5(Icon2, { name: "paperclip" }) }) }),
|
|
2640
|
+
/* @__PURE__ */ jsx5(TooltipContent2, { children: "Attach image, file, or video" })
|
|
2646
2641
|
] }),
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */ jsx5(
|
|
2649
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
2643
|
+
/* @__PURE__ */ jsx5(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx5(Button2, { variant: "outline", size: "icon-sm", onClick: handleSend, "aria-label": "Send message", children: /* @__PURE__ */ jsx5(Icon2, { name: "arrow-up" }) }) }),
|
|
2644
|
+
/* @__PURE__ */ jsxs4(TooltipContent2, { children: [
|
|
2650
2645
|
"Send message",
|
|
2651
2646
|
/* @__PURE__ */ jsx5(Kbd, { children: "\u23CE" })
|
|
2652
2647
|
] })
|
|
@@ -2678,16 +2673,16 @@ function ChatThread({
|
|
|
2678
2673
|
// `bg-muted/30` lives on the root so messages area and input area share
|
|
2679
2674
|
// the same backdrop — the input then floats on the muted bg instead of
|
|
2680
2675
|
// sitting in its own white-bordered footer container.
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
(title || headerActions) && /* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ jsxs4("div", { className: cn("bg-muted/30 flex h-full flex-col", className), children: [
|
|
2677
|
+
(title || headerActions) && /* @__PURE__ */ jsxs4("div", { className: "bg-background flex shrink-0 items-center justify-between border-b px-6 py-3", children: [
|
|
2678
|
+
/* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
|
|
2684
2679
|
title && /* @__PURE__ */ jsx5("div", { className: "text-h4 truncate", children: title }),
|
|
2685
2680
|
subtitle && /* @__PURE__ */ jsx5("div", { className: "text-body-sm text-muted-foreground truncate", children: subtitle })
|
|
2686
2681
|
] }),
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
-
title && /* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
2683
|
+
title && /* @__PURE__ */ jsxs4(DropdownMenu, { children: [
|
|
2689
2684
|
/* @__PURE__ */ jsx5(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx5(Button2, { variant: "ghost", size: "icon-sm", "aria-label": "Session actions", children: /* @__PURE__ */ jsx5(Icon2, { name: "ellipsis" }) }) }),
|
|
2690
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsxs4(DropdownMenuContent, { align: "end", children: [
|
|
2691
2686
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Pin" }),
|
|
2692
2687
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Rename" }),
|
|
2693
2688
|
/* @__PURE__ */ jsx5(DropdownMenuItem, { children: "Share" }),
|
|
@@ -2699,16 +2694,16 @@ function ChatThread({
|
|
|
2699
2694
|
headerActions
|
|
2700
2695
|
] })
|
|
2701
2696
|
] }),
|
|
2702
|
-
/* @__PURE__ */ jsx5(MessageScrollerProvider, { autoScroll: true, defaultScrollPosition: "end", children: /* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */ jsx5(MessageScrollerViewport, { children: /* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ jsx5(MessageScrollerProvider, { autoScroll: true, defaultScrollPosition: "end", children: /* @__PURE__ */ jsxs4(MessageScroller, { className: "min-h-0 flex-1", children: [
|
|
2698
|
+
/* @__PURE__ */ jsx5(MessageScrollerViewport, { children: /* @__PURE__ */ jsxs4(MessageScrollerContent, { className: "gap-4 px-6 py-4", children: [
|
|
2704
2699
|
callout,
|
|
2705
2700
|
messages.length === 0 && suggestions && suggestions.length > 0 ? (
|
|
2706
2701
|
// Starting state — shown when no messages yet AND suggestions
|
|
2707
2702
|
// are provided. Disappears the moment the user sends anything
|
|
2708
2703
|
// (either via the input or by clicking a suggestion card).
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-4 pt-2", children: [
|
|
2705
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1", children: [
|
|
2706
|
+
/* @__PURE__ */ jsxs4("div", { className: "text-h4", children: [
|
|
2712
2707
|
"\u{1F44B} Hi, I'm ",
|
|
2713
2708
|
assistantName != null ? assistantName : "your AI assistant"
|
|
2714
2709
|
] }),
|
|
@@ -2726,11 +2721,11 @@ function ChatThread({
|
|
|
2726
2721
|
)) })
|
|
2727
2722
|
] })
|
|
2728
2723
|
) : null,
|
|
2729
|
-
messages.map((msg) => /* @__PURE__ */
|
|
2724
|
+
messages.map((msg) => /* @__PURE__ */ jsxs4(React4.Fragment, { children: [
|
|
2730
2725
|
/* @__PURE__ */ jsx5(MessageScrollerItem, { messageId: msg.id, scrollAnchor: msg.role === "user", children: /* @__PURE__ */ jsx5(ChatMessageBubble, { message: msg, userName, assistantName }) }),
|
|
2731
|
-
msg.role === "user" && msg.pageContext && /* @__PURE__ */ jsx5(MessageScrollerItem, { messageId: `${msg.id}-ctx`, children: /* @__PURE__ */
|
|
2726
|
+
msg.role === "user" && msg.pageContext && /* @__PURE__ */ jsx5(MessageScrollerItem, { messageId: `${msg.id}-ctx`, children: /* @__PURE__ */ jsxs4(Marker, { children: [
|
|
2732
2727
|
/* @__PURE__ */ jsx5(MarkerIcon, { children: /* @__PURE__ */ jsx5(Icon2, { name: "expand" }) }),
|
|
2733
|
-
/* @__PURE__ */
|
|
2728
|
+
/* @__PURE__ */ jsxs4(MarkerContent, { children: [
|
|
2734
2729
|
"Sent with page context: ",
|
|
2735
2730
|
msg.pageContext
|
|
2736
2731
|
] })
|
|
@@ -2757,8 +2752,8 @@ function ChatThread({
|
|
|
2757
2752
|
);
|
|
2758
2753
|
}
|
|
2759
2754
|
function ChatNavRail({ onNewSession, onOpenRoutines, onOpenConnectors, onOpenCustomize }) {
|
|
2760
|
-
return /* @__PURE__ */ jsx5(SectionNav, { className: "border-b p-3", children: /* @__PURE__ */
|
|
2761
|
-
/* @__PURE__ */
|
|
2755
|
+
return /* @__PURE__ */ jsx5(SectionNav, { className: "border-b p-3", children: /* @__PURE__ */ jsxs4(SectionNavList, { children: [
|
|
2756
|
+
/* @__PURE__ */ jsxs4(
|
|
2762
2757
|
SectionNavItem,
|
|
2763
2758
|
{
|
|
2764
2759
|
href: "#",
|
|
@@ -2772,7 +2767,7 @@ function ChatNavRail({ onNewSession, onOpenRoutines, onOpenConnectors, onOpenCus
|
|
|
2772
2767
|
]
|
|
2773
2768
|
}
|
|
2774
2769
|
),
|
|
2775
|
-
/* @__PURE__ */
|
|
2770
|
+
/* @__PURE__ */ jsxs4(
|
|
2776
2771
|
SectionNavItem,
|
|
2777
2772
|
{
|
|
2778
2773
|
href: "#",
|
|
@@ -2786,7 +2781,7 @@ function ChatNavRail({ onNewSession, onOpenRoutines, onOpenConnectors, onOpenCus
|
|
|
2786
2781
|
]
|
|
2787
2782
|
}
|
|
2788
2783
|
),
|
|
2789
|
-
/* @__PURE__ */
|
|
2784
|
+
/* @__PURE__ */ jsxs4(
|
|
2790
2785
|
SectionNavItem,
|
|
2791
2786
|
{
|
|
2792
2787
|
href: "#",
|
|
@@ -2800,7 +2795,7 @@ function ChatNavRail({ onNewSession, onOpenRoutines, onOpenConnectors, onOpenCus
|
|
|
2800
2795
|
]
|
|
2801
2796
|
}
|
|
2802
2797
|
),
|
|
2803
|
-
/* @__PURE__ */
|
|
2798
|
+
/* @__PURE__ */ jsxs4(
|
|
2804
2799
|
SectionNavItem,
|
|
2805
2800
|
{
|
|
2806
2801
|
href: "#",
|
|
@@ -2836,8 +2831,8 @@ function ChatInterface(_a) {
|
|
|
2836
2831
|
"onOpenCustomize",
|
|
2837
2832
|
"className"
|
|
2838
2833
|
]);
|
|
2839
|
-
return /* @__PURE__ */
|
|
2840
|
-
/* @__PURE__ */
|
|
2834
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("flex h-full", className), children: [
|
|
2835
|
+
/* @__PURE__ */ jsxs4("div", { className: "bg-background flex w-72 shrink-0 flex-col border-r", children: [
|
|
2841
2836
|
/* @__PURE__ */ jsx5(
|
|
2842
2837
|
ChatNavRail,
|
|
2843
2838
|
{
|
|
@@ -2875,9 +2870,9 @@ import {
|
|
|
2875
2870
|
InputGroupButton,
|
|
2876
2871
|
InputGroupInput as InputGroupInput2,
|
|
2877
2872
|
InputGroupText as InputGroupText2,
|
|
2878
|
-
Tooltip as
|
|
2879
|
-
TooltipContent as
|
|
2880
|
-
TooltipTrigger as
|
|
2873
|
+
Tooltip as Tooltip4,
|
|
2874
|
+
TooltipContent as TooltipContent3,
|
|
2875
|
+
TooltipTrigger as TooltipTrigger3
|
|
2881
2876
|
} from "@upbound/monarch-core";
|
|
2882
2877
|
|
|
2883
2878
|
// src/lib/find-text.ts
|
|
@@ -2957,7 +2952,7 @@ async function highlightCode(code, lang) {
|
|
|
2957
2952
|
}
|
|
2958
2953
|
|
|
2959
2954
|
// src/code-block.tsx
|
|
2960
|
-
import { jsx as jsx6, jsxs as
|
|
2955
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2961
2956
|
function CodeBlock(_a) {
|
|
2962
2957
|
var _b = _a, {
|
|
2963
2958
|
className,
|
|
@@ -3123,8 +3118,8 @@ function CodeBlockBody(_a) {
|
|
|
3123
3118
|
window.addEventListener("keydown", onKeyDown, { capture: true });
|
|
3124
3119
|
return () => window.removeEventListener("keydown", onKeyDown, { capture: true });
|
|
3125
3120
|
}, [searchOpen, closeSearch]);
|
|
3126
|
-
const searchButton = searchable && /* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */ jsx6(
|
|
3121
|
+
const searchButton = searchable && /* @__PURE__ */ jsxs5(Tooltip4, { children: [
|
|
3122
|
+
/* @__PURE__ */ jsx6(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
3128
3123
|
"button",
|
|
3129
3124
|
{
|
|
3130
3125
|
ref: searchButtonRef,
|
|
@@ -3137,12 +3132,12 @@ function CodeBlockBody(_a) {
|
|
|
3137
3132
|
children: /* @__PURE__ */ jsx6(Icon3, { name: "magnifying-glass", size: "sm" })
|
|
3138
3133
|
}
|
|
3139
3134
|
) }),
|
|
3140
|
-
/* @__PURE__ */ jsx6(
|
|
3135
|
+
/* @__PURE__ */ jsx6(TooltipContent3, { children: "Search" })
|
|
3141
3136
|
] });
|
|
3142
|
-
return /* @__PURE__ */
|
|
3143
|
-
searchable && searchOpen && /* @__PURE__ */
|
|
3137
|
+
return /* @__PURE__ */ jsxs5(CardContent, __spreadProps(__spreadValues({ "data-line-numbers": lineNumbers || void 0, className: cn("relative p-0!", className) }, props), { children: [
|
|
3138
|
+
searchable && searchOpen && /* @__PURE__ */ jsxs5("div", { "data-slot": "code-block-search", className: "p-2", children: [
|
|
3144
3139
|
/* @__PURE__ */ jsx6("style", { children: search.highlightCss }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ jsxs5(InputGroup3, { children: [
|
|
3146
3141
|
/* @__PURE__ */ jsx6(InputGroupAddon3, { children: /* @__PURE__ */ jsx6(Icon3, { name: "magnifying-glass" }) }),
|
|
3147
3142
|
/* @__PURE__ */ jsx6(
|
|
3148
3143
|
InputGroupInput2,
|
|
@@ -3165,7 +3160,7 @@ function CodeBlockBody(_a) {
|
|
|
3165
3160
|
}
|
|
3166
3161
|
})
|
|
3167
3162
|
),
|
|
3168
|
-
/* @__PURE__ */
|
|
3163
|
+
/* @__PURE__ */ jsxs5(InputGroupAddon3, { align: "inline-end", children: [
|
|
3169
3164
|
/* @__PURE__ */ jsx6(InputGroupText2, { "aria-live": "polite", className: "text-caption tabular-nums", children: query ? search.count ? `${search.current + 1} of ${search.count}` : "No results" : null }),
|
|
3170
3165
|
/* @__PURE__ */ jsx6(
|
|
3171
3166
|
InputGroupButton,
|
|
@@ -3191,8 +3186,8 @@ function CodeBlockBody(_a) {
|
|
|
3191
3186
|
] })
|
|
3192
3187
|
] })
|
|
3193
3188
|
] }),
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
(searchButton || copyButton || downloadButton) && /* @__PURE__ */
|
|
3189
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
3190
|
+
(searchButton || copyButton || downloadButton) && /* @__PURE__ */ jsxs5("div", { className: "absolute top-2 right-2 z-10 flex items-center gap-1 opacity-0 transition-opacity group-focus-within/code-block:opacity-100 group-hover/code-block:opacity-100", children: [
|
|
3196
3191
|
searchButton,
|
|
3197
3192
|
copyButton,
|
|
3198
3193
|
downloadButton
|
|
@@ -3212,7 +3207,7 @@ function CodeBlockBody(_a) {
|
|
|
3212
3207
|
html && SHIKI_DARK_THEME,
|
|
3213
3208
|
lineNumbers && LINE_NUMBER_GUTTER
|
|
3214
3209
|
),
|
|
3215
|
-
children: html ? /* @__PURE__ */ jsx6("div", { dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx6("pre", { children: /* @__PURE__ */ jsx6("code", { className: lineNumbers ? void 0 : "whitespace-pre", children: lineNumbers ? content.split("\n").map((line, i) => /* @__PURE__ */
|
|
3210
|
+
children: html ? /* @__PURE__ */ jsx6("div", { dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx6("pre", { children: /* @__PURE__ */ jsx6("code", { className: lineNumbers ? void 0 : "whitespace-pre", children: lineNumbers ? content.split("\n").map((line, i) => /* @__PURE__ */ jsxs5("span", { className: "line", children: [
|
|
3216
3211
|
line,
|
|
3217
3212
|
"\n"
|
|
3218
3213
|
] }, i)) : content }) })
|
|
@@ -3249,8 +3244,8 @@ function CodeBlockCopyButton(_a) {
|
|
|
3249
3244
|
setCopied(true);
|
|
3250
3245
|
setTimeout(() => setCopied(false), 2e3);
|
|
3251
3246
|
};
|
|
3252
|
-
return /* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */ jsx6(
|
|
3247
|
+
return /* @__PURE__ */ jsxs5(Tooltip4, { children: [
|
|
3248
|
+
/* @__PURE__ */ jsx6(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
3254
3249
|
"button",
|
|
3255
3250
|
__spreadProps(__spreadValues({
|
|
3256
3251
|
"data-slot": "code-block-copy-button",
|
|
@@ -3261,7 +3256,7 @@ function CodeBlockCopyButton(_a) {
|
|
|
3261
3256
|
children: copied ? /* @__PURE__ */ jsx6(Icon3, { name: "check", size: "sm", className: "text-green-500" }) : /* @__PURE__ */ jsx6(Icon3, { name: "copy", size: "sm" })
|
|
3262
3257
|
})
|
|
3263
3258
|
) }),
|
|
3264
|
-
/* @__PURE__ */ jsx6(
|
|
3259
|
+
/* @__PURE__ */ jsx6(TooltipContent3, { children: copied ? "Copied" : "Copy" })
|
|
3265
3260
|
] });
|
|
3266
3261
|
}
|
|
3267
3262
|
function CodeBlockDownloadButton(_a) {
|
|
@@ -3290,8 +3285,8 @@ function CodeBlockDownloadButton(_a) {
|
|
|
3290
3285
|
setDownloaded(true);
|
|
3291
3286
|
setTimeout(() => setDownloaded(false), 2e3);
|
|
3292
3287
|
};
|
|
3293
|
-
return /* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */ jsx6(
|
|
3288
|
+
return /* @__PURE__ */ jsxs5(Tooltip4, { children: [
|
|
3289
|
+
/* @__PURE__ */ jsx6(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
3295
3290
|
"button",
|
|
3296
3291
|
__spreadProps(__spreadValues({
|
|
3297
3292
|
"data-slot": "code-block-download-button",
|
|
@@ -3302,7 +3297,7 @@ function CodeBlockDownloadButton(_a) {
|
|
|
3302
3297
|
children: downloaded ? /* @__PURE__ */ jsx6(Icon3, { name: "check", size: "sm", className: "text-green-500" }) : /* @__PURE__ */ jsx6(Icon3, { name: "download", size: "sm" })
|
|
3303
3298
|
})
|
|
3304
3299
|
) }),
|
|
3305
|
-
/* @__PURE__ */ jsx6(
|
|
3300
|
+
/* @__PURE__ */ jsx6(TooltipContent3, { children: downloaded ? "Downloaded" : "Download" })
|
|
3306
3301
|
] });
|
|
3307
3302
|
}
|
|
3308
3303
|
|
|
@@ -3315,7 +3310,7 @@ import {
|
|
|
3315
3310
|
ContextMenuSubContent,
|
|
3316
3311
|
ContextMenuSubTrigger
|
|
3317
3312
|
} from "@upbound/monarch-core";
|
|
3318
|
-
import { Fragment as Fragment4, jsx as jsx7, jsxs as
|
|
3313
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3319
3314
|
function CellContextualFilter({
|
|
3320
3315
|
filter,
|
|
3321
3316
|
globalSearch,
|
|
@@ -3337,7 +3332,7 @@ function CellContextualFilter({
|
|
|
3337
3332
|
var _a, _b;
|
|
3338
3333
|
const actionDisabled = typeof action.disabled === "function" ? action.disabled(cell) : (_a = action.disabled) != null ? _a : false;
|
|
3339
3334
|
if ((_b = action.items) == null ? void 0 : _b.length) {
|
|
3340
|
-
return /* @__PURE__ */
|
|
3335
|
+
return /* @__PURE__ */ jsxs6(ContextMenuSub, { children: [
|
|
3341
3336
|
/* @__PURE__ */ jsx7(
|
|
3342
3337
|
ContextMenuSubTrigger,
|
|
3343
3338
|
{
|
|
@@ -3374,7 +3369,7 @@ function CellContextualFilter({
|
|
|
3374
3369
|
action.id
|
|
3375
3370
|
);
|
|
3376
3371
|
}
|
|
3377
|
-
return /* @__PURE__ */
|
|
3372
|
+
return /* @__PURE__ */ jsxs6(ContextMenuContent, { children: [
|
|
3378
3373
|
/* @__PURE__ */ jsx7(
|
|
3379
3374
|
ContextMenuItem,
|
|
3380
3375
|
{
|
|
@@ -3384,7 +3379,7 @@ function CellContextualFilter({
|
|
|
3384
3379
|
children: "Filter by this value"
|
|
3385
3380
|
}
|
|
3386
3381
|
),
|
|
3387
|
-
contextualMenuActions.length > 0 && /* @__PURE__ */
|
|
3382
|
+
contextualMenuActions.length > 0 && /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
3388
3383
|
/* @__PURE__ */ jsx7(ContextMenuSeparator, {}),
|
|
3389
3384
|
contextualMenuActions.map(renderAction)
|
|
3390
3385
|
] })
|
|
@@ -3404,6 +3399,12 @@ import {
|
|
|
3404
3399
|
} from "@upbound/monarch-core";
|
|
3405
3400
|
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
3406
3401
|
|
|
3402
|
+
// src/lib/data-table/filter-types.ts
|
|
3403
|
+
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
3404
|
+
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
3405
|
+
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
3406
|
+
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
3407
|
+
|
|
3407
3408
|
// src/lib/data-table/utils.ts
|
|
3408
3409
|
var TO_EACH_SIDE = 2;
|
|
3409
3410
|
function normalizeColumnOrdering(columnOrdering, allColumnIds) {
|
|
@@ -3460,17 +3461,38 @@ function getPaginationInfo(pageIndex, totalRows, pageSize) {
|
|
|
3460
3461
|
itemEnd: Math.min(currentPage * pageSize, totalRows)
|
|
3461
3462
|
};
|
|
3462
3463
|
}
|
|
3464
|
+
var filterColumnByCheckedValues = Object.assign(
|
|
3465
|
+
(row, columnId, checkedValues) => {
|
|
3466
|
+
if (!(checkedValues == null ? void 0 : checkedValues.length)) return true;
|
|
3467
|
+
const value = row.getValue(columnId);
|
|
3468
|
+
const values = Array.isArray(value) ? value : [value];
|
|
3469
|
+
return values.some((item) => item != null && checkedValues.includes(String(item)));
|
|
3470
|
+
},
|
|
3471
|
+
{ autoRemove: (checkedValues) => !Array.isArray(checkedValues) || checkedValues.length === 0 }
|
|
3472
|
+
);
|
|
3473
|
+
function withDefaultFilterFns(columns) {
|
|
3474
|
+
return columns.map((column) => {
|
|
3475
|
+
var _a;
|
|
3476
|
+
let next = column;
|
|
3477
|
+
if ("columns" in column && column.columns) {
|
|
3478
|
+
next = __spreadProps(__spreadValues({}, next), { columns: withDefaultFilterFns(column.columns) });
|
|
3479
|
+
}
|
|
3480
|
+
const filter = (_a = column.meta) == null ? void 0 : _a.filter;
|
|
3481
|
+
if (filter && isCheckboxColumnFilter(filter) && column.filterFn === void 0) {
|
|
3482
|
+
next = __spreadProps(__spreadValues({}, next), { filterFn: filterColumnByCheckedValues });
|
|
3483
|
+
}
|
|
3484
|
+
return next;
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3463
3487
|
function isFilterOnlyColumn(column) {
|
|
3464
3488
|
var _a;
|
|
3465
3489
|
return ((_a = column.columnDef.meta) == null ? void 0 : _a.filterOnly) === true;
|
|
3466
3490
|
}
|
|
3467
3491
|
function hasFilterableColumns(columns) {
|
|
3468
|
-
return columns.some(
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
}
|
|
3473
|
-
);
|
|
3492
|
+
return columns.some((column) => {
|
|
3493
|
+
var _a;
|
|
3494
|
+
return column.getCanFilter() && !!((_a = column.columnDef.meta) == null ? void 0 : _a.filter);
|
|
3495
|
+
});
|
|
3474
3496
|
}
|
|
3475
3497
|
function getTableState({
|
|
3476
3498
|
error,
|
|
@@ -3483,7 +3505,7 @@ function getTableState({
|
|
|
3483
3505
|
}
|
|
3484
3506
|
|
|
3485
3507
|
// src/data-table/column-options.tsx
|
|
3486
|
-
import { Fragment as Fragment5, jsx as jsx8, jsxs as
|
|
3508
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3487
3509
|
function getColumnPinning(column) {
|
|
3488
3510
|
var _a;
|
|
3489
3511
|
if (!column) return false;
|
|
@@ -3524,7 +3546,7 @@ function ColumnOptionsItem({
|
|
|
3524
3546
|
isDraggedOver && "before:bg-primary before:absolute before:inset-x-0 before:top-0 before:h-0.5"
|
|
3525
3547
|
)
|
|
3526
3548
|
};
|
|
3527
|
-
const itemContent = /* @__PURE__ */
|
|
3549
|
+
const itemContent = /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
3528
3550
|
isDraggable && /* @__PURE__ */ jsx8(Icon4, { name: "grip-vertical", size: "sm", className: "text-muted-foreground cursor-move" }),
|
|
3529
3551
|
/* @__PURE__ */ jsx8("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: headerContent })
|
|
3530
3552
|
] });
|
|
@@ -3648,13 +3670,13 @@ function ColumnOptions({
|
|
|
3648
3670
|
const startPinned = orderedColumns(startPinnedColumns);
|
|
3649
3671
|
const unpinned = orderedColumns(unpinnedColumns);
|
|
3650
3672
|
const endPinned = orderedColumns(endPinnedColumns);
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */ jsx8(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */
|
|
3673
|
+
return /* @__PURE__ */ jsxs7(DropdownMenu2, { children: [
|
|
3674
|
+
/* @__PURE__ */ jsx8(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs7(Button3, { variant: "outline", className: "shrink-0", children: [
|
|
3653
3675
|
/* @__PURE__ */ jsx8(Icon4, { name: "table-columns", "data-icon": "inline-start" }),
|
|
3654
3676
|
"Columns",
|
|
3655
3677
|
/* @__PURE__ */ jsx8(Icon4, { name: "chevron-down", "data-icon": "inline-end" })
|
|
3656
3678
|
] }) }),
|
|
3657
|
-
/* @__PURE__ */ jsx8(DropdownMenuContent2, { className: "w-58 p-0", children: /* @__PURE__ */
|
|
3679
|
+
/* @__PURE__ */ jsx8(DropdownMenuContent2, { className: "w-58 p-0", children: /* @__PURE__ */ jsxs7("div", { className: "p-1", children: [
|
|
3658
3680
|
[...startPinned, ...unpinned].map((column) => /* @__PURE__ */ jsx8(
|
|
3659
3681
|
ColumnOptionsItem,
|
|
3660
3682
|
{
|
|
@@ -3706,14 +3728,14 @@ import { Button as Button4 } from "@upbound/monarch-core";
|
|
|
3706
3728
|
import { DropdownMenu as DropdownMenu3, DropdownMenuContent as DropdownMenuContent3, DropdownMenuItem as DropdownMenuItem3, DropdownMenuTrigger as DropdownMenuTrigger3 } from "@upbound/monarch-core";
|
|
3707
3729
|
import { Icon as Icon5 } from "@upbound/monarch-core";
|
|
3708
3730
|
import { Link } from "@upbound/monarch-core";
|
|
3709
|
-
import { Tooltip as
|
|
3710
|
-
import { jsx as jsx9, jsxs as
|
|
3731
|
+
import { Tooltip as Tooltip5, TooltipContent as TooltipContent4, TooltipTrigger as TooltipTrigger4 } from "@upbound/monarch-core";
|
|
3732
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3711
3733
|
function RowActions({
|
|
3712
3734
|
align = "end",
|
|
3713
3735
|
children,
|
|
3714
3736
|
contentClassName
|
|
3715
3737
|
}) {
|
|
3716
|
-
return /* @__PURE__ */
|
|
3738
|
+
return /* @__PURE__ */ jsxs8(DropdownMenu3, { children: [
|
|
3717
3739
|
/* @__PURE__ */ jsx9(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
3718
3740
|
Button4,
|
|
3719
3741
|
{
|
|
@@ -3745,9 +3767,9 @@ function RowActionItem({
|
|
|
3745
3767
|
}) {
|
|
3746
3768
|
const item = /* @__PURE__ */ jsx9(DropdownMenuItem3, { variant, disabled, className, onClick, children });
|
|
3747
3769
|
if (!tooltip) return item;
|
|
3748
|
-
return /* @__PURE__ */
|
|
3749
|
-
/* @__PURE__ */ jsx9(
|
|
3750
|
-
/* @__PURE__ */ jsx9(
|
|
3770
|
+
return /* @__PURE__ */ jsxs8(Tooltip5, { children: [
|
|
3771
|
+
/* @__PURE__ */ jsx9(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx9("span", { className: "block", children: item }) }),
|
|
3772
|
+
/* @__PURE__ */ jsx9(TooltipContent4, { children: tooltip })
|
|
3751
3773
|
] });
|
|
3752
3774
|
}
|
|
3753
3775
|
function getActionsColumnDefinition({
|
|
@@ -3805,8 +3827,8 @@ function DataTableValueCell({ content, title, className, href, onClick }) {
|
|
|
3805
3827
|
return /* @__PURE__ */ jsx9("p", { className: baseClassName, children: /* @__PURE__ */ jsx9(Link, { href, title, onClick, children: content }) });
|
|
3806
3828
|
}
|
|
3807
3829
|
if (title) {
|
|
3808
|
-
return /* @__PURE__ */
|
|
3809
|
-
/* @__PURE__ */ jsx9(
|
|
3830
|
+
return /* @__PURE__ */ jsxs8(Tooltip5, { children: [
|
|
3831
|
+
/* @__PURE__ */ jsx9(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx9(
|
|
3810
3832
|
"button",
|
|
3811
3833
|
{
|
|
3812
3834
|
type: "button",
|
|
@@ -3818,7 +3840,7 @@ function DataTableValueCell({ content, title, className, href, onClick }) {
|
|
|
3818
3840
|
children: content
|
|
3819
3841
|
}
|
|
3820
3842
|
) }),
|
|
3821
|
-
/* @__PURE__ */ jsx9(
|
|
3843
|
+
/* @__PURE__ */ jsx9(TooltipContent4, { side: "bottom", children: title })
|
|
3822
3844
|
] });
|
|
3823
3845
|
}
|
|
3824
3846
|
return /* @__PURE__ */ jsx9("p", { className: baseClassName, children: content ? /* @__PURE__ */ jsx9("span", { children: content }) : /* @__PURE__ */ jsx9("span", { children: "\u2014" }) });
|
|
@@ -3829,12 +3851,10 @@ function TimestampCell({ timestamp }) {
|
|
|
3829
3851
|
}
|
|
3830
3852
|
|
|
3831
3853
|
// src/data-table/data-table.tsx
|
|
3832
|
-
import * as
|
|
3854
|
+
import * as React12 from "react";
|
|
3833
3855
|
import {
|
|
3834
3856
|
useTable
|
|
3835
3857
|
} from "@tanstack/react-table";
|
|
3836
|
-
import { Icon as Icon11 } from "@upbound/monarch-core";
|
|
3837
|
-
import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupButton as InputGroupButton2, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
|
|
3838
3858
|
|
|
3839
3859
|
// src/lib/data-table/features.ts
|
|
3840
3860
|
import {
|
|
@@ -4492,13 +4512,67 @@ function useFilterVisibility(filterVisibility) {
|
|
|
4492
4512
|
return { showFilterToggle, filterRowVisible, setFilterRowVisible };
|
|
4493
4513
|
}
|
|
4494
4514
|
|
|
4515
|
+
// src/data-table/data-table-search.tsx
|
|
4516
|
+
import * as React8 from "react";
|
|
4517
|
+
import { Icon as Icon6 } from "@upbound/monarch-core";
|
|
4518
|
+
import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupButton as InputGroupButton2, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
|
|
4519
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4520
|
+
function DataTableSearch({
|
|
4521
|
+
value,
|
|
4522
|
+
onValueChange,
|
|
4523
|
+
placeholder = "Search\u2026",
|
|
4524
|
+
className,
|
|
4525
|
+
disabled = false
|
|
4526
|
+
}) {
|
|
4527
|
+
const id = `table-search-${React8.useId()}`;
|
|
4528
|
+
const inputRef = React8.useRef(null);
|
|
4529
|
+
const [draft, setDraft] = React8.useState(value);
|
|
4530
|
+
const [isPending, startTransition] = React8.useTransition();
|
|
4531
|
+
if (!isPending && draft !== value) {
|
|
4532
|
+
setDraft(value);
|
|
4533
|
+
}
|
|
4534
|
+
const commit = (next) => {
|
|
4535
|
+
setDraft(next);
|
|
4536
|
+
startTransition(() => onValueChange(next));
|
|
4537
|
+
};
|
|
4538
|
+
return /* @__PURE__ */ jsxs9(InputGroup4, { className: cn("w-70", className), children: [
|
|
4539
|
+
/* @__PURE__ */ jsx10(InputGroupAddon4, { align: "inline-start", children: /* @__PURE__ */ jsx10(Icon6, { name: "magnifying-glass" }) }),
|
|
4540
|
+
/* @__PURE__ */ jsx10(
|
|
4541
|
+
InputGroupInput3,
|
|
4542
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
4543
|
+
id,
|
|
4544
|
+
className: SEARCH_INPUT_CLASS,
|
|
4545
|
+
"aria-label": "Search",
|
|
4546
|
+
placeholder,
|
|
4547
|
+
disabled,
|
|
4548
|
+
ref: inputRef,
|
|
4549
|
+
value: draft,
|
|
4550
|
+
onChange: (e) => commit(e.target.value)
|
|
4551
|
+
})
|
|
4552
|
+
),
|
|
4553
|
+
!!draft && !disabled && /* @__PURE__ */ jsx10(InputGroupAddon4, { align: "inline-end", children: /* @__PURE__ */ jsx10(
|
|
4554
|
+
InputGroupButton2,
|
|
4555
|
+
{
|
|
4556
|
+
size: "icon-xs",
|
|
4557
|
+
"aria-label": "Clear search",
|
|
4558
|
+
onClick: () => {
|
|
4559
|
+
var _a;
|
|
4560
|
+
commit("");
|
|
4561
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
4562
|
+
},
|
|
4563
|
+
children: /* @__PURE__ */ jsx10(Icon6, { name: "xmark" })
|
|
4564
|
+
}
|
|
4565
|
+
) })
|
|
4566
|
+
] });
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4495
4569
|
// src/data-table/empty-view.tsx
|
|
4496
4570
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
4497
4571
|
import { Button as Button5 } from "@upbound/monarch-core";
|
|
4498
4572
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
4499
|
-
import { Icon as
|
|
4573
|
+
import { Icon as Icon7 } from "@upbound/monarch-core";
|
|
4500
4574
|
import { IconTile } from "@upbound/monarch-core";
|
|
4501
|
-
import { jsx as
|
|
4575
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4502
4576
|
var defaultErrorConfig = {
|
|
4503
4577
|
icon: "circle-exclamation",
|
|
4504
4578
|
header: "Something went wrong",
|
|
@@ -4529,37 +4603,37 @@ function DataTableEmptyView({
|
|
|
4529
4603
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
4530
4604
|
const config = tableState === "error" ? mergeConfig(defaultErrorConfig, emptyView == null ? void 0 : emptyView.error) : tableState === "empty" ? isFilteredEmpty ? mergeConfig(defaultNoFilterFoundConfig, emptyView == null ? void 0 : emptyView.filter) : mergeConfig(defaultEmptyConfig, emptyView == null ? void 0 : emptyView.empty) : null;
|
|
4531
4605
|
const wrapperClassName = tableState === "error" ? (_c = (_a = emptyView == null ? void 0 : emptyView.error) == null ? void 0 : _a.wrapperClassName) != null ? _c : (_b = emptyView == null ? void 0 : emptyView.empty) == null ? void 0 : _b.wrapperClassName : config == null ? void 0 : config.wrapperClassName;
|
|
4532
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
4533
|
-
/* @__PURE__ */
|
|
4606
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs10(Button5, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
4607
|
+
/* @__PURE__ */ jsx11(Icon7, { name: "xmark" }),
|
|
4534
4608
|
"Clear filters"
|
|
4535
4609
|
] }) : null;
|
|
4536
|
-
return /* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4538
|
-
config.icon && /* @__PURE__ */
|
|
4539
|
-
config.header && /* @__PURE__ */
|
|
4540
|
-
config.subheader && /* @__PURE__ */
|
|
4610
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs10(Empty, { className: cn("border border-dashed", config.className), children: [
|
|
4611
|
+
/* @__PURE__ */ jsxs10(EmptyHeader, { children: [
|
|
4612
|
+
config.icon && /* @__PURE__ */ jsx11(EmptyMedia, { children: /* @__PURE__ */ jsx11(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx11(Icon7, { name: config.icon }) }) }),
|
|
4613
|
+
config.header && /* @__PURE__ */ jsx11(EmptyTitle, { children: config.header }),
|
|
4614
|
+
config.subheader && /* @__PURE__ */ jsx11(EmptyDescription, { children: config.subheader })
|
|
4541
4615
|
] }),
|
|
4542
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
4543
|
-
config.details && /* @__PURE__ */
|
|
4616
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs10(EmptyContent, { children: [
|
|
4617
|
+
config.details && /* @__PURE__ */ jsx11(Alert, { children: /* @__PURE__ */ jsx11(AlertDescription, { children: config.details }) }),
|
|
4544
4618
|
(_d = config.action) != null ? _d : defaultAction
|
|
4545
4619
|
] })
|
|
4546
4620
|
] }) });
|
|
4547
4621
|
}
|
|
4548
4622
|
|
|
4549
4623
|
// src/data-table/filter-toggle.tsx
|
|
4550
|
-
import { Badge as Badge3, Button as Button6, Icon as
|
|
4551
|
-
import { jsx as
|
|
4624
|
+
import { Badge as Badge3, Button as Button6, Icon as Icon8 } from "@upbound/monarch-core";
|
|
4625
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4552
4626
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
4553
|
-
return /* @__PURE__ */
|
|
4554
|
-
/* @__PURE__ */
|
|
4627
|
+
return /* @__PURE__ */ jsxs11(Button6, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
4628
|
+
/* @__PURE__ */ jsx12(Icon8, { name: "filter", "data-icon": "inline-start" }),
|
|
4555
4629
|
pressed ? "Hide filters" : "Show filters",
|
|
4556
|
-
!!count && /* @__PURE__ */
|
|
4630
|
+
!!count && /* @__PURE__ */ jsx12(Badge3, { variant: "secondary", className: "tabular-nums", children: count })
|
|
4557
4631
|
] });
|
|
4558
4632
|
}
|
|
4559
4633
|
|
|
4560
4634
|
// src/data-table/pagination.tsx
|
|
4561
4635
|
import { Button as Button7 } from "@upbound/monarch-core";
|
|
4562
|
-
import { Icon as
|
|
4636
|
+
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
4563
4637
|
import { Label as Label2 } from "@upbound/monarch-core";
|
|
4564
4638
|
import {
|
|
4565
4639
|
Pagination,
|
|
@@ -4569,8 +4643,8 @@ import {
|
|
|
4569
4643
|
PaginationLink
|
|
4570
4644
|
} from "@upbound/monarch-core";
|
|
4571
4645
|
import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
|
|
4572
|
-
import { Tooltip as
|
|
4573
|
-
import { jsx as
|
|
4646
|
+
import { Tooltip as Tooltip6, TooltipContent as TooltipContent5, TooltipTrigger as TooltipTrigger5 } from "@upbound/monarch-core";
|
|
4647
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4574
4648
|
var DEFAULT_PAGINATION_CONFIG = {
|
|
4575
4649
|
summary: true,
|
|
4576
4650
|
arrows: true,
|
|
@@ -4609,36 +4683,36 @@ function DataTablePagination({
|
|
|
4609
4683
|
const currentPage = pageIndex + 1;
|
|
4610
4684
|
const mounted = useMounted();
|
|
4611
4685
|
const locale = mounted ? void 0 : "en-US";
|
|
4612
|
-
return /* @__PURE__ */
|
|
4613
|
-
resolved.summary ? /* @__PURE__ */
|
|
4686
|
+
return /* @__PURE__ */ jsxs12("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
|
|
4687
|
+
resolved.summary ? /* @__PURE__ */ jsxs12("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
|
|
4614
4688
|
"Showing ",
|
|
4615
|
-
/* @__PURE__ */
|
|
4689
|
+
/* @__PURE__ */ jsx13("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
|
|
4616
4690
|
" to",
|
|
4617
4691
|
" ",
|
|
4618
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsx13("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
|
|
4619
4693
|
" of",
|
|
4620
4694
|
" ",
|
|
4621
|
-
/* @__PURE__ */
|
|
4695
|
+
/* @__PURE__ */ jsxs12("span", { className: "text-foreground font-medium", children: [
|
|
4622
4696
|
rowCount.toLocaleString(locale),
|
|
4623
4697
|
!isRowCountExact && "+"
|
|
4624
4698
|
] }),
|
|
4625
4699
|
" ",
|
|
4626
4700
|
"results",
|
|
4627
|
-
!isRowCountExact && /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4629
|
-
/* @__PURE__ */
|
|
4701
|
+
!isRowCountExact && /* @__PURE__ */ jsxs12(Tooltip6, { children: [
|
|
4702
|
+
/* @__PURE__ */ jsx13(TooltipTrigger5, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx13(Icon9, { name: "circle-info", size: "sm" }) }),
|
|
4703
|
+
/* @__PURE__ */ jsx13(TooltipContent5, { children: "Add filters or refine your search to reduce the result set." })
|
|
4630
4704
|
] })
|
|
4631
|
-
] }) : /* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
resolved.pageSizeSelector && /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4705
|
+
] }) : /* @__PURE__ */ jsx13("div", {}),
|
|
4706
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-4", children: [
|
|
4707
|
+
resolved.pageSizeSelector && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
4708
|
+
/* @__PURE__ */ jsx13(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
|
|
4709
|
+
/* @__PURE__ */ jsxs12(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
4710
|
+
/* @__PURE__ */ jsx13(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx13(SelectValue2, {}) }),
|
|
4711
|
+
/* @__PURE__ */ jsx13(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx13(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx13(SelectItem2, { value: String(option), children: option }, option)) }) })
|
|
4638
4712
|
] })
|
|
4639
4713
|
] }),
|
|
4640
|
-
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */
|
|
4641
|
-
resolved.arrows && /* @__PURE__ */
|
|
4714
|
+
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx13(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs12(PaginationContent, { children: [
|
|
4715
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4642
4716
|
Button7,
|
|
4643
4717
|
{
|
|
4644
4718
|
variant: "outline",
|
|
@@ -4646,10 +4720,10 @@ function DataTablePagination({
|
|
|
4646
4720
|
"aria-label": "Go to first page",
|
|
4647
4721
|
disabled: currentPage <= 1,
|
|
4648
4722
|
onClick: () => onPageChange(1),
|
|
4649
|
-
children: /* @__PURE__ */
|
|
4723
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevrons-left", className: "cn-rtl-flip" })
|
|
4650
4724
|
}
|
|
4651
4725
|
) }),
|
|
4652
|
-
resolved.arrows && /* @__PURE__ */
|
|
4726
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4653
4727
|
Button7,
|
|
4654
4728
|
{
|
|
4655
4729
|
variant: "outline",
|
|
@@ -4657,11 +4731,11 @@ function DataTablePagination({
|
|
|
4657
4731
|
"aria-label": "Go to previous page",
|
|
4658
4732
|
disabled: currentPage <= 1,
|
|
4659
4733
|
onClick: () => onPageChange(currentPage - 1),
|
|
4660
|
-
children: /* @__PURE__ */
|
|
4734
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevron-left", className: "cn-rtl-flip" })
|
|
4661
4735
|
}
|
|
4662
4736
|
) }),
|
|
4663
4737
|
resolved.numbers && visiblePages.map(
|
|
4664
|
-
(page, index) => page === void 0 ? /* @__PURE__ */
|
|
4738
|
+
(page, index) => page === void 0 ? /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4665
4739
|
PaginationLink,
|
|
4666
4740
|
{
|
|
4667
4741
|
href: "#",
|
|
@@ -4675,7 +4749,7 @@ function DataTablePagination({
|
|
|
4675
4749
|
}
|
|
4676
4750
|
) }, page)
|
|
4677
4751
|
),
|
|
4678
|
-
resolved.arrows && /* @__PURE__ */
|
|
4752
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4679
4753
|
Button7,
|
|
4680
4754
|
{
|
|
4681
4755
|
variant: "outline",
|
|
@@ -4683,10 +4757,10 @@ function DataTablePagination({
|
|
|
4683
4757
|
"aria-label": "Go to next page",
|
|
4684
4758
|
disabled: currentPage >= pageCount,
|
|
4685
4759
|
onClick: () => onPageChange(currentPage + 1),
|
|
4686
|
-
children: /* @__PURE__ */
|
|
4760
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevron-right", className: "cn-rtl-flip" })
|
|
4687
4761
|
}
|
|
4688
4762
|
) }),
|
|
4689
|
-
resolved.arrows && /* @__PURE__ */
|
|
4763
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4690
4764
|
Button7,
|
|
4691
4765
|
{
|
|
4692
4766
|
variant: "outline",
|
|
@@ -4694,7 +4768,7 @@ function DataTablePagination({
|
|
|
4694
4768
|
"aria-label": "Go to last page",
|
|
4695
4769
|
disabled: currentPage >= pageCount,
|
|
4696
4770
|
onClick: () => onPageChange(pageCount),
|
|
4697
|
-
children: /* @__PURE__ */
|
|
4771
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevrons-right", className: "cn-rtl-flip" })
|
|
4698
4772
|
}
|
|
4699
4773
|
) })
|
|
4700
4774
|
] }) })
|
|
@@ -4703,7 +4777,7 @@ function DataTablePagination({
|
|
|
4703
4777
|
}
|
|
4704
4778
|
|
|
4705
4779
|
// src/data-table/table-primitives.tsx
|
|
4706
|
-
import * as
|
|
4780
|
+
import * as React9 from "react";
|
|
4707
4781
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
4708
4782
|
import { ContextMenu, ContextMenuTrigger } from "@upbound/monarch-core";
|
|
4709
4783
|
import {
|
|
@@ -4713,7 +4787,7 @@ import {
|
|
|
4713
4787
|
DropdownMenuSeparator as DropdownMenuSeparator2,
|
|
4714
4788
|
DropdownMenuTrigger as DropdownMenuTrigger4
|
|
4715
4789
|
} from "@upbound/monarch-core";
|
|
4716
|
-
import { Icon as
|
|
4790
|
+
import { Icon as Icon10 } from "@upbound/monarch-core";
|
|
4717
4791
|
import { Skeleton } from "@upbound/monarch-core";
|
|
4718
4792
|
import {
|
|
4719
4793
|
Table as BaseTable,
|
|
@@ -4723,8 +4797,8 @@ import {
|
|
|
4723
4797
|
TableHeader as BaseTableHeader,
|
|
4724
4798
|
TableRow as BaseTableRow
|
|
4725
4799
|
} from "@upbound/monarch-core";
|
|
4726
|
-
import { Tooltip as
|
|
4727
|
-
import { Fragment as Fragment7, jsx as
|
|
4800
|
+
import { Tooltip as Tooltip7, TooltipContent as TooltipContent6, TooltipTrigger as TooltipTrigger6 } from "@upbound/monarch-core";
|
|
4801
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4728
4802
|
var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
|
|
4729
4803
|
var TABLE_HEAD_CLASSES = "text-body-sm text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
4730
4804
|
var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
@@ -4738,7 +4812,7 @@ function DataTableRoot({
|
|
|
4738
4812
|
children
|
|
4739
4813
|
}) {
|
|
4740
4814
|
if (layout === "grid") {
|
|
4741
|
-
return /* @__PURE__ */
|
|
4815
|
+
return /* @__PURE__ */ jsx14(
|
|
4742
4816
|
"div",
|
|
4743
4817
|
{
|
|
4744
4818
|
ref: gridRootRef,
|
|
@@ -4749,7 +4823,7 @@ function DataTableRoot({
|
|
|
4749
4823
|
}
|
|
4750
4824
|
);
|
|
4751
4825
|
}
|
|
4752
|
-
return /* @__PURE__ */
|
|
4826
|
+
return /* @__PURE__ */ jsx14(BaseTable, { className, style, children });
|
|
4753
4827
|
}
|
|
4754
4828
|
function getColumnPinningProps(column, surface = "body") {
|
|
4755
4829
|
const isPinned = column.getIsPinned();
|
|
@@ -4772,8 +4846,8 @@ function getColumnPinningProps(column, surface = "body") {
|
|
|
4772
4846
|
}
|
|
4773
4847
|
function DataTableSortIcon({ sortOrder }) {
|
|
4774
4848
|
if (!sortOrder) return null;
|
|
4775
|
-
return /* @__PURE__ */
|
|
4776
|
-
|
|
4849
|
+
return /* @__PURE__ */ jsx14(
|
|
4850
|
+
Icon10,
|
|
4777
4851
|
{
|
|
4778
4852
|
size: "xs",
|
|
4779
4853
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
@@ -4792,57 +4866,57 @@ function ColumnActionsMenuItems({
|
|
|
4792
4866
|
const canResize = header.column.getCanResize();
|
|
4793
4867
|
const canHide = header.column.getCanHide();
|
|
4794
4868
|
const canPin = !isGrid && header.column.getCanPin();
|
|
4795
|
-
return /* @__PURE__ */
|
|
4796
|
-
canSort && /* @__PURE__ */
|
|
4797
|
-
/* @__PURE__ */
|
|
4869
|
+
return /* @__PURE__ */ jsxs13(DropdownMenuContent4, { align: "start", className: "w-45", children: [
|
|
4870
|
+
canSort && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
4871
|
+
/* @__PURE__ */ jsxs13(
|
|
4798
4872
|
DropdownMenuItem4,
|
|
4799
4873
|
{
|
|
4800
4874
|
disabled: header.column.getIsSorted() === "asc",
|
|
4801
4875
|
onClick: () => header.column.toggleSorting(false),
|
|
4802
4876
|
children: [
|
|
4803
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrow-up" }),
|
|
4804
4878
|
"Sort ascending"
|
|
4805
4879
|
]
|
|
4806
4880
|
}
|
|
4807
4881
|
),
|
|
4808
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsxs13(
|
|
4809
4883
|
DropdownMenuItem4,
|
|
4810
4884
|
{
|
|
4811
4885
|
disabled: header.column.getIsSorted() === "desc",
|
|
4812
4886
|
onClick: () => header.column.toggleSorting(true),
|
|
4813
4887
|
children: [
|
|
4814
|
-
/* @__PURE__ */
|
|
4888
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrow-down" }),
|
|
4815
4889
|
"Sort descending"
|
|
4816
4890
|
]
|
|
4817
4891
|
}
|
|
4818
4892
|
),
|
|
4819
|
-
!!header.column.getIsSorted() && /* @__PURE__ */
|
|
4820
|
-
/* @__PURE__ */
|
|
4893
|
+
!!header.column.getIsSorted() && /* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => header.column.clearSorting(), children: [
|
|
4894
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "xmark" }),
|
|
4821
4895
|
"Remove sorting"
|
|
4822
4896
|
] })
|
|
4823
4897
|
] }),
|
|
4824
|
-
canResize && /* @__PURE__ */
|
|
4825
|
-
canSort && /* @__PURE__ */
|
|
4826
|
-
!isGrid && /* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
4898
|
+
canResize && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
4899
|
+
canSort && /* @__PURE__ */ jsx14(DropdownMenuSeparator2, {}),
|
|
4900
|
+
!isGrid && /* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => onAutosizeColumn(header.column.id), children: [
|
|
4901
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrows-left-right" }),
|
|
4828
4902
|
"Autosize column"
|
|
4829
4903
|
] }),
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => onAutosizeAll(), children: [
|
|
4905
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "table-columns" }),
|
|
4832
4906
|
isGrid ? "Reset all columns" : "Autosize all columns"
|
|
4833
4907
|
] })
|
|
4834
4908
|
] }),
|
|
4835
|
-
(canHide || canPin) && /* @__PURE__ */
|
|
4836
|
-
(canSort || canResize) && /* @__PURE__ */
|
|
4837
|
-
canHide && /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4909
|
+
(canHide || canPin) && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
4910
|
+
(canSort || canResize) && /* @__PURE__ */ jsx14(DropdownMenuSeparator2, {}),
|
|
4911
|
+
canHide && /* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => header.column.toggleVisibility(), children: [
|
|
4912
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "eye-slash" }),
|
|
4839
4913
|
"Hide column"
|
|
4840
4914
|
] }),
|
|
4841
|
-
canPin && (header.column.getIsPinned() ? /* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4915
|
+
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => header.column.pin(false), children: [
|
|
4916
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "thumbtack" }),
|
|
4843
4917
|
"Unpin column"
|
|
4844
|
-
] }) : /* @__PURE__ */
|
|
4845
|
-
/* @__PURE__ */
|
|
4918
|
+
] }) : /* @__PURE__ */ jsxs13(DropdownMenuItem4, { onClick: () => header.column.pin("start"), children: [
|
|
4919
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "thumbtack" }),
|
|
4846
4920
|
"Pin column"
|
|
4847
4921
|
] }))
|
|
4848
4922
|
] })
|
|
@@ -4862,7 +4936,7 @@ function HeaderCellContent({
|
|
|
4862
4936
|
const resizeHandler = header.getResizeHandler();
|
|
4863
4937
|
const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
|
|
4864
4938
|
const sorted = header.column.getIsSorted();
|
|
4865
|
-
const labelButton = /* @__PURE__ */
|
|
4939
|
+
const labelButton = /* @__PURE__ */ jsxs13(
|
|
4866
4940
|
"button",
|
|
4867
4941
|
{
|
|
4868
4942
|
type: "button",
|
|
@@ -4873,10 +4947,10 @@ function HeaderCellContent({
|
|
|
4873
4947
|
shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
4874
4948
|
),
|
|
4875
4949
|
children: [
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
shouldShowActionsMenu && /* @__PURE__ */
|
|
4879
|
-
|
|
4950
|
+
/* @__PURE__ */ jsx14(DataTableSortIcon, { sortOrder: sorted }),
|
|
4951
|
+
/* @__PURE__ */ jsx14("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
|
|
4952
|
+
shouldShowActionsMenu && /* @__PURE__ */ jsx14(
|
|
4953
|
+
Icon10,
|
|
4880
4954
|
{
|
|
4881
4955
|
size: "sm",
|
|
4882
4956
|
name: "ellipsis",
|
|
@@ -4886,9 +4960,9 @@ function HeaderCellContent({
|
|
|
4886
4960
|
]
|
|
4887
4961
|
}
|
|
4888
4962
|
);
|
|
4889
|
-
const label = shouldShowActionsMenu ? /* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4891
|
-
/* @__PURE__ */
|
|
4963
|
+
const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs13(DropdownMenu4, { children: [
|
|
4964
|
+
/* @__PURE__ */ jsx14(DropdownMenuTrigger4, { asChild: true, children: labelButton }),
|
|
4965
|
+
/* @__PURE__ */ jsx14(
|
|
4892
4966
|
ColumnActionsMenuItems,
|
|
4893
4967
|
{
|
|
4894
4968
|
header,
|
|
@@ -4898,12 +4972,12 @@ function HeaderCellContent({
|
|
|
4898
4972
|
}
|
|
4899
4973
|
)
|
|
4900
4974
|
] }) : labelButton;
|
|
4901
|
-
return /* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__PURE__ */
|
|
4975
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
4976
|
+
/* @__PURE__ */ jsx14("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: /* @__PURE__ */ jsx14("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs13(Tooltip7, { children: [
|
|
4977
|
+
/* @__PURE__ */ jsx14(TooltipTrigger6, { asChild: true, children: label }),
|
|
4978
|
+
/* @__PURE__ */ jsx14(TooltipContent6, { children: headerTitle })
|
|
4905
4979
|
] }) : label) }) }),
|
|
4906
|
-
canResize && /* @__PURE__ */
|
|
4980
|
+
canResize && /* @__PURE__ */ jsx14(
|
|
4907
4981
|
"button",
|
|
4908
4982
|
{
|
|
4909
4983
|
type: "button",
|
|
@@ -4947,7 +5021,7 @@ function DataTableHeader({
|
|
|
4947
5021
|
const stickyTopPx = stickyHeader ? stickyHeaderOffset + headerGroupIndex * stickyHeaderRowHeight : void 0;
|
|
4948
5022
|
const isPinned = !isGrid && header.column.getIsPinned();
|
|
4949
5023
|
const pinning = isGrid ? { className: "", style: {} } : getColumnPinningProps(header.column, "header");
|
|
4950
|
-
const content = /* @__PURE__ */
|
|
5024
|
+
const content = /* @__PURE__ */ jsx14(
|
|
4951
5025
|
HeaderCellContent,
|
|
4952
5026
|
{
|
|
4953
5027
|
header,
|
|
@@ -4968,7 +5042,7 @@ function DataTableHeader({
|
|
|
4968
5042
|
isPinned && "z-30"
|
|
4969
5043
|
);
|
|
4970
5044
|
if (isGrid) {
|
|
4971
|
-
return /* @__PURE__ */
|
|
5045
|
+
return /* @__PURE__ */ jsx14(
|
|
4972
5046
|
"div",
|
|
4973
5047
|
{
|
|
4974
5048
|
role: "columnheader",
|
|
@@ -4981,7 +5055,7 @@ function DataTableHeader({
|
|
|
4981
5055
|
header.id
|
|
4982
5056
|
);
|
|
4983
5057
|
}
|
|
4984
|
-
return /* @__PURE__ */
|
|
5058
|
+
return /* @__PURE__ */ jsx14(
|
|
4985
5059
|
BaseTableHead,
|
|
4986
5060
|
{
|
|
4987
5061
|
className: cn(cellClassName, "whitespace-normal"),
|
|
@@ -4996,19 +5070,19 @@ function DataTableHeader({
|
|
|
4996
5070
|
});
|
|
4997
5071
|
};
|
|
4998
5072
|
if (isGrid) {
|
|
4999
|
-
return /* @__PURE__ */
|
|
5073
|
+
return /* @__PURE__ */ jsx14(
|
|
5000
5074
|
"div",
|
|
5001
5075
|
{
|
|
5002
5076
|
role: "rowgroup",
|
|
5003
5077
|
className: cn("col-span-full grid grid-cols-subgrid", HEADER_SURFACE_BG, !!stickyHeader && "sticky z-20"),
|
|
5004
5078
|
style: stickyHeader ? { top: stickyHeaderOffset } : void 0,
|
|
5005
|
-
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */
|
|
5079
|
+
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx14("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
|
|
5006
5080
|
}
|
|
5007
5081
|
);
|
|
5008
5082
|
}
|
|
5009
|
-
return /* @__PURE__ */
|
|
5083
|
+
return /* @__PURE__ */ jsx14(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx14(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
|
|
5010
5084
|
}
|
|
5011
|
-
var DataTableRow =
|
|
5085
|
+
var DataTableRow = React9.forwardRef(
|
|
5012
5086
|
(_a, ref) => {
|
|
5013
5087
|
var _b = _a, { hoverable, disabled, className, layout = "auto" } = _b, props = __objRest(_b, ["hoverable", "disabled", "className", "layout"]);
|
|
5014
5088
|
const classes = cn(
|
|
@@ -5018,7 +5092,7 @@ var DataTableRow = React8.forwardRef(
|
|
|
5018
5092
|
className
|
|
5019
5093
|
);
|
|
5020
5094
|
if (layout === "grid") {
|
|
5021
|
-
return /* @__PURE__ */
|
|
5095
|
+
return /* @__PURE__ */ jsx14(
|
|
5022
5096
|
"div",
|
|
5023
5097
|
__spreadValues({
|
|
5024
5098
|
ref,
|
|
@@ -5027,7 +5101,7 @@ var DataTableRow = React8.forwardRef(
|
|
|
5027
5101
|
}, props)
|
|
5028
5102
|
);
|
|
5029
5103
|
}
|
|
5030
|
-
return /* @__PURE__ */
|
|
5104
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, __spreadValues({ ref, className: classes }, props));
|
|
5031
5105
|
}
|
|
5032
5106
|
);
|
|
5033
5107
|
DataTableRow.displayName = "DataTableRow";
|
|
@@ -5058,7 +5132,7 @@ function DataTableCell({
|
|
|
5058
5132
|
isPinned && "z-10",
|
|
5059
5133
|
className
|
|
5060
5134
|
);
|
|
5061
|
-
const cellElement = isGrid ? /* @__PURE__ */
|
|
5135
|
+
const cellElement = isGrid ? /* @__PURE__ */ jsx14(
|
|
5062
5136
|
"div",
|
|
5063
5137
|
{
|
|
5064
5138
|
role: "cell",
|
|
@@ -5066,7 +5140,7 @@ function DataTableCell({
|
|
|
5066
5140
|
style: { minWidth: cell.column.columnDef.minSize },
|
|
5067
5141
|
children: content
|
|
5068
5142
|
}
|
|
5069
|
-
) : /* @__PURE__ */
|
|
5143
|
+
) : /* @__PURE__ */ jsx14(
|
|
5070
5144
|
BaseTableCell,
|
|
5071
5145
|
{
|
|
5072
5146
|
className: cellClassName,
|
|
@@ -5078,9 +5152,9 @@ function DataTableCell({
|
|
|
5078
5152
|
}
|
|
5079
5153
|
);
|
|
5080
5154
|
if (!shouldShowContextualMenu || !onContextCell) return cellElement;
|
|
5081
|
-
return /* @__PURE__ */
|
|
5082
|
-
/* @__PURE__ */
|
|
5083
|
-
/* @__PURE__ */
|
|
5155
|
+
return /* @__PURE__ */ jsxs13(ContextMenu, { children: [
|
|
5156
|
+
/* @__PURE__ */ jsx14(ContextMenuTrigger, { asChild: true, children: cellElement }),
|
|
5157
|
+
/* @__PURE__ */ jsx14(
|
|
5084
5158
|
CellContextualFilter,
|
|
5085
5159
|
{
|
|
5086
5160
|
filter: contextualFilter,
|
|
@@ -5099,7 +5173,7 @@ function DataTableGroupRow({
|
|
|
5099
5173
|
layout = "auto"
|
|
5100
5174
|
}) {
|
|
5101
5175
|
if (layout === "grid") {
|
|
5102
|
-
return /* @__PURE__ */
|
|
5176
|
+
return /* @__PURE__ */ jsx14("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx14(
|
|
5103
5177
|
"div",
|
|
5104
5178
|
{
|
|
5105
5179
|
role: "cell",
|
|
@@ -5109,7 +5183,7 @@ function DataTableGroupRow({
|
|
|
5109
5183
|
}
|
|
5110
5184
|
) });
|
|
5111
5185
|
}
|
|
5112
|
-
return /* @__PURE__ */
|
|
5186
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx14(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
|
|
5113
5187
|
}
|
|
5114
5188
|
function DataTableSkeletonBody({
|
|
5115
5189
|
rowCount = 10,
|
|
@@ -5118,32 +5192,32 @@ function DataTableSkeletonBody({
|
|
|
5118
5192
|
layout = "auto"
|
|
5119
5193
|
}) {
|
|
5120
5194
|
const isGrid = layout === "grid";
|
|
5121
|
-
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */
|
|
5195
|
+
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx14(DataTableRow, { layout, children: columns.map(
|
|
5122
5196
|
(col) => {
|
|
5123
5197
|
var _a, _b;
|
|
5124
|
-
return isGrid ? /* @__PURE__ */
|
|
5198
|
+
return isGrid ? /* @__PURE__ */ jsx14(
|
|
5125
5199
|
"div",
|
|
5126
5200
|
{
|
|
5127
5201
|
role: "cell",
|
|
5128
5202
|
className: cn(TABLE_CELL_CLASSES, "flex items-center overflow-hidden"),
|
|
5129
5203
|
style: { minWidth: col.minSize },
|
|
5130
|
-
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */
|
|
5204
|
+
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx14(Skeleton, { className: "h-4 w-full" })
|
|
5131
5205
|
},
|
|
5132
5206
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
5133
|
-
) : /* @__PURE__ */
|
|
5207
|
+
) : /* @__PURE__ */ jsx14(
|
|
5134
5208
|
BaseTableCell,
|
|
5135
5209
|
{
|
|
5136
5210
|
style: { width: col.size, minWidth: col.minSize, maxWidth: col.maxSize },
|
|
5137
|
-
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */
|
|
5211
|
+
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx14(Skeleton, { className: "h-4 w-full" })
|
|
5138
5212
|
},
|
|
5139
5213
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
5140
5214
|
);
|
|
5141
5215
|
}
|
|
5142
5216
|
) }, `skeleton-row-${rowIndex}`));
|
|
5143
5217
|
if (isGrid) {
|
|
5144
|
-
return /* @__PURE__ */
|
|
5218
|
+
return /* @__PURE__ */ jsx14("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
|
|
5145
5219
|
}
|
|
5146
|
-
return /* @__PURE__ */
|
|
5220
|
+
return /* @__PURE__ */ jsx14(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
|
|
5147
5221
|
}
|
|
5148
5222
|
function DataTableExpandedRow({
|
|
5149
5223
|
colSpan,
|
|
@@ -5153,9 +5227,9 @@ function DataTableExpandedRow({
|
|
|
5153
5227
|
}) {
|
|
5154
5228
|
if (!show) return null;
|
|
5155
5229
|
if (layout === "grid") {
|
|
5156
|
-
return /* @__PURE__ */
|
|
5230
|
+
return /* @__PURE__ */ jsx14("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx14("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
5157
5231
|
}
|
|
5158
|
-
return /* @__PURE__ */
|
|
5232
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx14(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
5159
5233
|
}
|
|
5160
5234
|
function DataTableBody({
|
|
5161
5235
|
tableRows,
|
|
@@ -5181,7 +5255,7 @@ function DataTableBody({
|
|
|
5181
5255
|
minSize: c.columnDef.minSize,
|
|
5182
5256
|
maxSize: c.columnDef.maxSize
|
|
5183
5257
|
}));
|
|
5184
|
-
return /* @__PURE__ */
|
|
5258
|
+
return /* @__PURE__ */ jsx14(
|
|
5185
5259
|
DataTableSkeletonBody,
|
|
5186
5260
|
{
|
|
5187
5261
|
columns: skeletonColumns,
|
|
@@ -5195,18 +5269,18 @@ function DataTableBody({
|
|
|
5195
5269
|
var _a, _b, _c, _d, _e;
|
|
5196
5270
|
if ((_a = row.getIsGrouped) == null ? void 0 : _a.call(row)) {
|
|
5197
5271
|
const groupLabel = (_c = row.groupingValue) != null ? _c : row.groupingColumnId ? (_b = row.getGroupingValue) == null ? void 0 : _b.call(row, row.groupingColumnId) : void 0;
|
|
5198
|
-
return /* @__PURE__ */
|
|
5272
|
+
return /* @__PURE__ */ jsx14(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
|
|
5199
5273
|
}
|
|
5200
5274
|
const isExpanded = !!(((_d = row.getCanExpand) == null ? void 0 : _d.call(row)) && ((_e = row.getIsExpanded) == null ? void 0 : _e.call(row)));
|
|
5201
5275
|
const expandedRow = renderExpandedRow && isExpanded ? renderExpandedRow(row.original) : null;
|
|
5202
|
-
return /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5276
|
+
return /* @__PURE__ */ jsxs13(React9.Fragment, { children: [
|
|
5277
|
+
/* @__PURE__ */ jsx14(
|
|
5204
5278
|
DataTableRow,
|
|
5205
5279
|
__spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original, row) : {}), {
|
|
5206
5280
|
"data-expanded": isExpanded || void 0,
|
|
5207
5281
|
"data-depth": row.depth || void 0,
|
|
5208
5282
|
layout,
|
|
5209
|
-
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */
|
|
5283
|
+
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx14(
|
|
5210
5284
|
DataTableCell,
|
|
5211
5285
|
{
|
|
5212
5286
|
cell,
|
|
@@ -5220,21 +5294,21 @@ function DataTableBody({
|
|
|
5220
5294
|
))
|
|
5221
5295
|
})
|
|
5222
5296
|
),
|
|
5223
|
-
/* @__PURE__ */
|
|
5297
|
+
/* @__PURE__ */ jsx14(DataTableExpandedRow, { colSpan, show: expandedRow != null, layout, children: expandedRow })
|
|
5224
5298
|
] }, row.id);
|
|
5225
5299
|
});
|
|
5226
5300
|
if (isGrid) {
|
|
5227
|
-
return /* @__PURE__ */
|
|
5301
|
+
return /* @__PURE__ */ jsx14("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
|
|
5228
5302
|
}
|
|
5229
|
-
return /* @__PURE__ */
|
|
5303
|
+
return /* @__PURE__ */ jsx14(BaseTableBody, { children: rows });
|
|
5230
5304
|
}
|
|
5231
5305
|
|
|
5232
5306
|
// src/data-table/view-filter.tsx
|
|
5233
|
-
import * as
|
|
5307
|
+
import * as React11 from "react";
|
|
5234
5308
|
|
|
5235
5309
|
// src/filter-bar/filter-bar.tsx
|
|
5236
|
-
import * as
|
|
5237
|
-
import { Icon as
|
|
5310
|
+
import * as React10 from "react";
|
|
5311
|
+
import { Icon as Icon11 } from "@upbound/monarch-core";
|
|
5238
5312
|
import { Badge as Badge4 } from "@upbound/monarch-core";
|
|
5239
5313
|
import { Button as Button8 } from "@upbound/monarch-core";
|
|
5240
5314
|
import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
|
|
@@ -5264,7 +5338,7 @@ import {
|
|
|
5264
5338
|
import { Input as Input2 } from "@upbound/monarch-core";
|
|
5265
5339
|
import { Label as Label3 } from "@upbound/monarch-core";
|
|
5266
5340
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
|
|
5267
|
-
import { Fragment as Fragment8, jsx as
|
|
5341
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5268
5342
|
function asCheckboxValue(value) {
|
|
5269
5343
|
return Array.isArray(value) ? value : [];
|
|
5270
5344
|
}
|
|
@@ -5333,13 +5407,13 @@ function FilterBar(_a) {
|
|
|
5333
5407
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
5334
5408
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
5335
5409
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
5336
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
5410
|
+
const [pendingOpenKey, setPendingOpenKey] = React10.useState(null);
|
|
5337
5411
|
function handleAddFilter(key) {
|
|
5338
5412
|
onAddFilter(key);
|
|
5339
5413
|
setPendingOpenKey(key);
|
|
5340
5414
|
}
|
|
5341
|
-
const containerRef =
|
|
5342
|
-
return /* @__PURE__ */
|
|
5415
|
+
const containerRef = React10.useRef(null);
|
|
5416
|
+
return /* @__PURE__ */ jsxs14(
|
|
5343
5417
|
"div",
|
|
5344
5418
|
__spreadProps(__spreadValues({
|
|
5345
5419
|
"data-slot": "filter-bar",
|
|
@@ -5348,7 +5422,7 @@ function FilterBar(_a) {
|
|
|
5348
5422
|
ref: composeRefs(containerRef, ref)
|
|
5349
5423
|
}, props), {
|
|
5350
5424
|
children: [
|
|
5351
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
5425
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs14(
|
|
5352
5426
|
Combobox2,
|
|
5353
5427
|
{
|
|
5354
5428
|
items: availableFilters,
|
|
@@ -5359,14 +5433,14 @@ function FilterBar(_a) {
|
|
|
5359
5433
|
if (filter) handleAddFilter(filter.key);
|
|
5360
5434
|
},
|
|
5361
5435
|
children: [
|
|
5362
|
-
/* @__PURE__ */
|
|
5363
|
-
/* @__PURE__ */
|
|
5436
|
+
/* @__PURE__ */ jsxs14(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx15(Button8, { variant: "outline" }), children: [
|
|
5437
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "plus", "data-icon": "inline-start" }),
|
|
5364
5438
|
"Add filter"
|
|
5365
5439
|
] }),
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5440
|
+
/* @__PURE__ */ jsxs14(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
|
|
5441
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
5442
|
+
/* @__PURE__ */ jsx15(ComboboxEmpty2, { children: "No filters found." }),
|
|
5443
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx15(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
|
|
5370
5444
|
] })
|
|
5371
5445
|
]
|
|
5372
5446
|
}
|
|
@@ -5374,7 +5448,7 @@ function FilterBar(_a) {
|
|
|
5374
5448
|
activeFilters.map((active) => {
|
|
5375
5449
|
const definition = filters.find((f) => f.key === active.key);
|
|
5376
5450
|
if (!definition) return null;
|
|
5377
|
-
return /* @__PURE__ */
|
|
5451
|
+
return /* @__PURE__ */ jsx15(
|
|
5378
5452
|
FilterChip,
|
|
5379
5453
|
{
|
|
5380
5454
|
definition,
|
|
@@ -5397,7 +5471,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5397
5471
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
5398
5472
|
switch (type) {
|
|
5399
5473
|
case "checkbox":
|
|
5400
|
-
return /* @__PURE__ */
|
|
5474
|
+
return /* @__PURE__ */ jsx15(
|
|
5401
5475
|
CheckboxFilterChip,
|
|
5402
5476
|
{
|
|
5403
5477
|
definition,
|
|
@@ -5409,7 +5483,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5409
5483
|
}
|
|
5410
5484
|
);
|
|
5411
5485
|
case "radio":
|
|
5412
|
-
return /* @__PURE__ */
|
|
5486
|
+
return /* @__PURE__ */ jsx15(
|
|
5413
5487
|
RadioFilterChip,
|
|
5414
5488
|
{
|
|
5415
5489
|
definition,
|
|
@@ -5421,7 +5495,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5421
5495
|
}
|
|
5422
5496
|
);
|
|
5423
5497
|
case "text":
|
|
5424
|
-
return /* @__PURE__ */
|
|
5498
|
+
return /* @__PURE__ */ jsx15(
|
|
5425
5499
|
TextFilterChip,
|
|
5426
5500
|
{
|
|
5427
5501
|
definition,
|
|
@@ -5432,7 +5506,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5432
5506
|
}
|
|
5433
5507
|
);
|
|
5434
5508
|
case "multiText":
|
|
5435
|
-
return /* @__PURE__ */
|
|
5509
|
+
return /* @__PURE__ */ jsx15(
|
|
5436
5510
|
MultiTextFilterChip,
|
|
5437
5511
|
{
|
|
5438
5512
|
definition,
|
|
@@ -5443,7 +5517,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5443
5517
|
}
|
|
5444
5518
|
);
|
|
5445
5519
|
case "date":
|
|
5446
|
-
return /* @__PURE__ */
|
|
5520
|
+
return /* @__PURE__ */ jsx15(
|
|
5447
5521
|
DateFilterChip,
|
|
5448
5522
|
{
|
|
5449
5523
|
definition,
|
|
@@ -5456,7 +5530,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5456
5530
|
}
|
|
5457
5531
|
}
|
|
5458
5532
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
5459
|
-
return /* @__PURE__ */
|
|
5533
|
+
return /* @__PURE__ */ jsx15(Button8, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx15(Icon11, { name: "xmark" }) });
|
|
5460
5534
|
}
|
|
5461
5535
|
function CheckboxFilterChip({
|
|
5462
5536
|
definition,
|
|
@@ -5475,9 +5549,9 @@ function CheckboxFilterChip({
|
|
|
5475
5549
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
5476
5550
|
onChangeValue(next);
|
|
5477
5551
|
}
|
|
5478
|
-
return /* @__PURE__ */
|
|
5479
|
-
/* @__PURE__ */
|
|
5480
|
-
searchable ? /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsxs14(ButtonGroup2, { children: [
|
|
5553
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5554
|
+
searchable ? /* @__PURE__ */ jsxs14(
|
|
5481
5555
|
Combobox2,
|
|
5482
5556
|
{
|
|
5483
5557
|
items: options,
|
|
@@ -5487,34 +5561,34 @@ function CheckboxFilterChip({
|
|
|
5487
5561
|
value: options.filter((o) => values.includes(o.value)),
|
|
5488
5562
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
5489
5563
|
children: [
|
|
5490
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsx15(
|
|
5491
5565
|
ComboboxTrigger2,
|
|
5492
5566
|
{
|
|
5493
|
-
render: /* @__PURE__ */
|
|
5494
|
-
children: /* @__PURE__ */
|
|
5567
|
+
render: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
5568
|
+
children: /* @__PURE__ */ jsx15("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
5495
5569
|
}
|
|
5496
5570
|
),
|
|
5497
|
-
/* @__PURE__ */
|
|
5571
|
+
/* @__PURE__ */ jsxs14(
|
|
5498
5572
|
ComboboxContent2,
|
|
5499
5573
|
{
|
|
5500
5574
|
container,
|
|
5501
5575
|
className: "min-w-64",
|
|
5502
5576
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
5503
5577
|
children: [
|
|
5504
|
-
/* @__PURE__ */
|
|
5505
|
-
values.length > 0 && /* @__PURE__ */
|
|
5506
|
-
/* @__PURE__ */
|
|
5507
|
-
/* @__PURE__ */
|
|
5508
|
-
/* @__PURE__ */
|
|
5578
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
5579
|
+
values.length > 0 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5580
|
+
/* @__PURE__ */ jsxs14(ComboboxSelectedChips2, { children: [
|
|
5581
|
+
/* @__PURE__ */ jsx15(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx15(Fragment8, { children: selected.map((item) => /* @__PURE__ */ jsx15(ComboboxChip2, { children: item.label }, item.value)) }) }),
|
|
5582
|
+
/* @__PURE__ */ jsx15(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
|
|
5509
5583
|
] }),
|
|
5510
|
-
/* @__PURE__ */
|
|
5584
|
+
/* @__PURE__ */ jsx15(ComboboxSeparator2, {})
|
|
5511
5585
|
] }),
|
|
5512
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsxs14(ComboboxEmpty2, { children: [
|
|
5513
5587
|
"No ",
|
|
5514
5588
|
label.toLowerCase(),
|
|
5515
5589
|
" found."
|
|
5516
5590
|
] }),
|
|
5517
|
-
/* @__PURE__ */
|
|
5591
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs14(ComboboxItem2, { value: item, children: [
|
|
5518
5592
|
item.icon,
|
|
5519
5593
|
item.label
|
|
5520
5594
|
] }, item.value) })
|
|
@@ -5523,12 +5597,12 @@ function CheckboxFilterChip({
|
|
|
5523
5597
|
)
|
|
5524
5598
|
]
|
|
5525
5599
|
}
|
|
5526
|
-
) : /* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5600
|
+
) : /* @__PURE__ */ jsxs14(DropdownMenu5, { defaultOpen: autoOpen, children: [
|
|
5601
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs14(Button8, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
5602
|
+
/* @__PURE__ */ jsx15("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
5603
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
5530
5604
|
] }) }),
|
|
5531
|
-
/* @__PURE__ */
|
|
5605
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent5, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs14(
|
|
5532
5606
|
DropdownMenuCheckboxItem2,
|
|
5533
5607
|
{
|
|
5534
5608
|
checked: values.includes(opt.value),
|
|
@@ -5541,7 +5615,7 @@ function CheckboxFilterChip({
|
|
|
5541
5615
|
opt.value
|
|
5542
5616
|
)) })
|
|
5543
5617
|
] }),
|
|
5544
|
-
/* @__PURE__ */
|
|
5618
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5545
5619
|
] });
|
|
5546
5620
|
}
|
|
5547
5621
|
function RadioFilterChip({
|
|
@@ -5558,9 +5632,9 @@ function RadioFilterChip({
|
|
|
5558
5632
|
const selectedValue = asRadioValue(value);
|
|
5559
5633
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
5560
5634
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
5561
|
-
return /* @__PURE__ */
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
searchable ? /* @__PURE__ */
|
|
5635
|
+
return /* @__PURE__ */ jsxs14(ButtonGroup2, { children: [
|
|
5636
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5637
|
+
searchable ? /* @__PURE__ */ jsxs14(
|
|
5564
5638
|
Combobox2,
|
|
5565
5639
|
{
|
|
5566
5640
|
items: options,
|
|
@@ -5572,27 +5646,27 @@ function RadioFilterChip({
|
|
|
5572
5646
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
5573
5647
|
},
|
|
5574
5648
|
children: [
|
|
5575
|
-
/* @__PURE__ */
|
|
5649
|
+
/* @__PURE__ */ jsx15(
|
|
5576
5650
|
ComboboxTrigger2,
|
|
5577
5651
|
{
|
|
5578
|
-
render: /* @__PURE__ */
|
|
5579
|
-
children: /* @__PURE__ */
|
|
5652
|
+
render: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
5653
|
+
children: /* @__PURE__ */ jsx15("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
5580
5654
|
}
|
|
5581
5655
|
),
|
|
5582
|
-
/* @__PURE__ */
|
|
5656
|
+
/* @__PURE__ */ jsxs14(
|
|
5583
5657
|
ComboboxContent2,
|
|
5584
5658
|
{
|
|
5585
5659
|
container,
|
|
5586
5660
|
className: "min-w-64",
|
|
5587
5661
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
5588
5662
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5663
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
5664
|
+
/* @__PURE__ */ jsxs14(ComboboxEmpty2, { children: [
|
|
5591
5665
|
"No ",
|
|
5592
5666
|
label.toLowerCase(),
|
|
5593
5667
|
" found."
|
|
5594
5668
|
] }),
|
|
5595
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs14(ComboboxItem2, { value: item, children: [
|
|
5596
5670
|
item.icon,
|
|
5597
5671
|
item.label
|
|
5598
5672
|
] }, item.value) })
|
|
@@ -5601,17 +5675,17 @@ function RadioFilterChip({
|
|
|
5601
5675
|
)
|
|
5602
5676
|
]
|
|
5603
5677
|
}
|
|
5604
|
-
) : /* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5606
|
-
/* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5678
|
+
) : /* @__PURE__ */ jsxs14(DropdownMenu5, { defaultOpen: autoOpen, children: [
|
|
5679
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs14(Button8, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
5680
|
+
/* @__PURE__ */ jsx15("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
5681
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
5608
5682
|
] }) }),
|
|
5609
|
-
/* @__PURE__ */
|
|
5683
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent5, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx15(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs14(DropdownMenuRadioItem, { value: opt.value, children: [
|
|
5610
5684
|
opt.icon,
|
|
5611
5685
|
opt.label
|
|
5612
5686
|
] }, opt.value)) }) })
|
|
5613
5687
|
] }),
|
|
5614
|
-
/* @__PURE__ */
|
|
5688
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5615
5689
|
] });
|
|
5616
5690
|
}
|
|
5617
5691
|
function TextFilterChip({
|
|
@@ -5623,12 +5697,12 @@ function TextFilterChip({
|
|
|
5623
5697
|
}) {
|
|
5624
5698
|
const { label, placeholder } = definition;
|
|
5625
5699
|
const text = asTextValue(value);
|
|
5626
|
-
const [open, setOpen] =
|
|
5627
|
-
return /* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5629
|
-
/* @__PURE__ */
|
|
5630
|
-
/* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5700
|
+
const [open, setOpen] = React10.useState(!!autoOpen);
|
|
5701
|
+
return /* @__PURE__ */ jsxs14(ButtonGroup2, { children: [
|
|
5702
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5703
|
+
/* @__PURE__ */ jsxs14(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5704
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
5705
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx15(
|
|
5632
5706
|
Input2,
|
|
5633
5707
|
{
|
|
5634
5708
|
autoFocus: true,
|
|
@@ -5641,7 +5715,7 @@ function TextFilterChip({
|
|
|
5641
5715
|
}
|
|
5642
5716
|
) })
|
|
5643
5717
|
] }),
|
|
5644
|
-
/* @__PURE__ */
|
|
5718
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5645
5719
|
] });
|
|
5646
5720
|
}
|
|
5647
5721
|
function MultiTextFilterChip({
|
|
@@ -5653,7 +5727,7 @@ function MultiTextFilterChip({
|
|
|
5653
5727
|
}) {
|
|
5654
5728
|
const { label, placeholder } = definition;
|
|
5655
5729
|
const tokens = asMultiTextValue(value);
|
|
5656
|
-
const [draft, setDraft] =
|
|
5730
|
+
const [draft, setDraft] = React10.useState("");
|
|
5657
5731
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
5658
5732
|
function addToken() {
|
|
5659
5733
|
const token = draft.trim();
|
|
@@ -5667,25 +5741,25 @@ function MultiTextFilterChip({
|
|
|
5667
5741
|
function removeToken(token) {
|
|
5668
5742
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
5669
5743
|
}
|
|
5670
|
-
return /* @__PURE__ */
|
|
5671
|
-
/* @__PURE__ */
|
|
5672
|
-
/* @__PURE__ */
|
|
5673
|
-
/* @__PURE__ */
|
|
5674
|
-
/* @__PURE__ */
|
|
5675
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
5744
|
+
return /* @__PURE__ */ jsxs14(ButtonGroup2, { children: [
|
|
5745
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5746
|
+
/* @__PURE__ */ jsxs14(Popover2, { defaultOpen: autoOpen, children: [
|
|
5747
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
5748
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
5749
|
+
tokens.length > 0 && /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs14(Badge4, { variant: "secondary", className: "gap-1", children: [
|
|
5676
5750
|
token,
|
|
5677
|
-
/* @__PURE__ */
|
|
5751
|
+
/* @__PURE__ */ jsx15(
|
|
5678
5752
|
"button",
|
|
5679
5753
|
{
|
|
5680
5754
|
type: "button",
|
|
5681
5755
|
"aria-label": `Remove ${token}`,
|
|
5682
5756
|
onClick: () => removeToken(token),
|
|
5683
5757
|
className: "cursor-pointer",
|
|
5684
|
-
children: /* @__PURE__ */
|
|
5758
|
+
children: /* @__PURE__ */ jsx15(Icon11, { name: "xmark", size: "xs" })
|
|
5685
5759
|
}
|
|
5686
5760
|
)
|
|
5687
5761
|
] }, token)) }),
|
|
5688
|
-
/* @__PURE__ */
|
|
5762
|
+
/* @__PURE__ */ jsx15(
|
|
5689
5763
|
Input2,
|
|
5690
5764
|
{
|
|
5691
5765
|
autoFocus: true,
|
|
@@ -5704,7 +5778,7 @@ function MultiTextFilterChip({
|
|
|
5704
5778
|
)
|
|
5705
5779
|
] }) })
|
|
5706
5780
|
] }),
|
|
5707
|
-
/* @__PURE__ */
|
|
5781
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5708
5782
|
] });
|
|
5709
5783
|
}
|
|
5710
5784
|
function DateFilterChip({
|
|
@@ -5734,12 +5808,12 @@ function DateFilterChip({
|
|
|
5734
5808
|
if (!endDate) return;
|
|
5735
5809
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
5736
5810
|
}
|
|
5737
|
-
return /* @__PURE__ */
|
|
5738
|
-
/* @__PURE__ */
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
/* @__PURE__ */
|
|
5741
|
-
/* @__PURE__ */
|
|
5742
|
-
/* @__PURE__ */
|
|
5811
|
+
return /* @__PURE__ */ jsxs14(ButtonGroup2, { children: [
|
|
5812
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5813
|
+
/* @__PURE__ */ jsxs14(Popover2, { defaultOpen: autoOpen, children: [
|
|
5814
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
5815
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
5816
|
+
/* @__PURE__ */ jsx15(
|
|
5743
5817
|
Calendar2,
|
|
5744
5818
|
{
|
|
5745
5819
|
mode: "range",
|
|
@@ -5747,9 +5821,9 @@ function DateFilterChip({
|
|
|
5747
5821
|
onSelect: pickRange
|
|
5748
5822
|
}
|
|
5749
5823
|
),
|
|
5750
|
-
showTimeInputs && /* @__PURE__ */
|
|
5751
|
-
/* @__PURE__ */
|
|
5752
|
-
/* @__PURE__ */
|
|
5824
|
+
showTimeInputs && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
5825
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex w-full items-center gap-2", children: [
|
|
5826
|
+
/* @__PURE__ */ jsx15(
|
|
5753
5827
|
Label3,
|
|
5754
5828
|
{
|
|
5755
5829
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -5757,7 +5831,7 @@ function DateFilterChip({
|
|
|
5757
5831
|
children: "Start"
|
|
5758
5832
|
}
|
|
5759
5833
|
),
|
|
5760
|
-
/* @__PURE__ */
|
|
5834
|
+
/* @__PURE__ */ jsx15(
|
|
5761
5835
|
Input2,
|
|
5762
5836
|
{
|
|
5763
5837
|
id: `${definition.key}-start-time`,
|
|
@@ -5769,8 +5843,8 @@ function DateFilterChip({
|
|
|
5769
5843
|
}
|
|
5770
5844
|
)
|
|
5771
5845
|
] }),
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5846
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex w-full items-center gap-2", children: [
|
|
5847
|
+
/* @__PURE__ */ jsx15(
|
|
5774
5848
|
Label3,
|
|
5775
5849
|
{
|
|
5776
5850
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -5778,7 +5852,7 @@ function DateFilterChip({
|
|
|
5778
5852
|
children: "End"
|
|
5779
5853
|
}
|
|
5780
5854
|
),
|
|
5781
|
-
/* @__PURE__ */
|
|
5855
|
+
/* @__PURE__ */ jsx15(
|
|
5782
5856
|
Input2,
|
|
5783
5857
|
{
|
|
5784
5858
|
id: `${definition.key}-end-time`,
|
|
@@ -5793,18 +5867,12 @@ function DateFilterChip({
|
|
|
5793
5867
|
] })
|
|
5794
5868
|
] }) })
|
|
5795
5869
|
] }),
|
|
5796
|
-
/* @__PURE__ */
|
|
5870
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5797
5871
|
] });
|
|
5798
5872
|
}
|
|
5799
5873
|
|
|
5800
|
-
// src/lib/data-table/filter-types.ts
|
|
5801
|
-
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
5802
|
-
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
5803
|
-
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
5804
|
-
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
5805
|
-
|
|
5806
5874
|
// src/data-table/view-filter.tsx
|
|
5807
|
-
import { jsx as
|
|
5875
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5808
5876
|
function toFilterOption(opt) {
|
|
5809
5877
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
5810
5878
|
}
|
|
@@ -5847,15 +5915,15 @@ function ViewFilter({
|
|
|
5847
5915
|
onColumnFiltersChange,
|
|
5848
5916
|
className
|
|
5849
5917
|
}) {
|
|
5850
|
-
const filterableColumns =
|
|
5851
|
-
() => columns.filter((column) =>
|
|
5918
|
+
const filterableColumns = React11.useMemo(
|
|
5919
|
+
() => columns.filter((column) => column.getCanFilter()).flatMap((column) => {
|
|
5852
5920
|
var _a;
|
|
5853
5921
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
5854
5922
|
return filter ? [{ key: column.id, filter }] : [];
|
|
5855
5923
|
}),
|
|
5856
5924
|
[columns]
|
|
5857
5925
|
);
|
|
5858
|
-
const filterDefinitions =
|
|
5926
|
+
const filterDefinitions = React11.useMemo(
|
|
5859
5927
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
5860
5928
|
if (a.order == null && b.order == null) return 0;
|
|
5861
5929
|
if (a.order == null) return 1;
|
|
@@ -5864,15 +5932,15 @@ function ViewFilter({
|
|
|
5864
5932
|
}),
|
|
5865
5933
|
[filterableColumns]
|
|
5866
5934
|
);
|
|
5867
|
-
const emptyValueByKey =
|
|
5935
|
+
const emptyValueByKey = React11.useMemo(
|
|
5868
5936
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
5869
5937
|
[filterableColumns]
|
|
5870
5938
|
);
|
|
5871
|
-
const activeFilters =
|
|
5939
|
+
const activeFilters = React11.useMemo(
|
|
5872
5940
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
5873
5941
|
[columnFilters]
|
|
5874
5942
|
);
|
|
5875
|
-
return /* @__PURE__ */
|
|
5943
|
+
return /* @__PURE__ */ jsx16(
|
|
5876
5944
|
FilterBar,
|
|
5877
5945
|
{
|
|
5878
5946
|
className,
|
|
@@ -5886,10 +5954,10 @@ function ViewFilter({
|
|
|
5886
5954
|
}
|
|
5887
5955
|
|
|
5888
5956
|
// src/section-header.tsx
|
|
5889
|
-
import { jsx as
|
|
5957
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
5890
5958
|
function SectionHeader(_a) {
|
|
5891
5959
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
5892
|
-
return /* @__PURE__ */
|
|
5960
|
+
return /* @__PURE__ */ jsx17(
|
|
5893
5961
|
"div",
|
|
5894
5962
|
__spreadProps(__spreadValues({
|
|
5895
5963
|
"data-slot": "section-header",
|
|
@@ -5901,19 +5969,19 @@ function SectionHeader(_a) {
|
|
|
5901
5969
|
}
|
|
5902
5970
|
function SectionHeaderContent(_a) {
|
|
5903
5971
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5904
|
-
return /* @__PURE__ */
|
|
5972
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
5905
5973
|
}
|
|
5906
5974
|
function SectionHeaderTitle(_a) {
|
|
5907
5975
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5908
|
-
return /* @__PURE__ */
|
|
5976
|
+
return /* @__PURE__ */ jsx17("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
5909
5977
|
}
|
|
5910
5978
|
function SectionHeaderDescription(_a) {
|
|
5911
5979
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5912
|
-
return /* @__PURE__ */
|
|
5980
|
+
return /* @__PURE__ */ jsx17("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
5913
5981
|
}
|
|
5914
5982
|
function SectionHeaderMeta(_a) {
|
|
5915
5983
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5916
|
-
return /* @__PURE__ */
|
|
5984
|
+
return /* @__PURE__ */ jsx17(
|
|
5917
5985
|
"div",
|
|
5918
5986
|
__spreadValues({
|
|
5919
5987
|
"data-slot": "section-header-meta",
|
|
@@ -5927,15 +5995,15 @@ function SectionHeaderMeta(_a) {
|
|
|
5927
5995
|
}
|
|
5928
5996
|
function SectionHeaderActions(_a) {
|
|
5929
5997
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5930
|
-
return /* @__PURE__ */
|
|
5998
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-actions", className: cn("flex items-center gap-2", className) }, props));
|
|
5931
5999
|
}
|
|
5932
6000
|
function SectionHeaderTabs(_a) {
|
|
5933
6001
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5934
|
-
return /* @__PURE__ */
|
|
6002
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-tabs", className: cn("border-b", className) }, props));
|
|
5935
6003
|
}
|
|
5936
6004
|
|
|
5937
6005
|
// src/data-table/data-table.tsx
|
|
5938
|
-
import { Fragment as Fragment9, jsx as
|
|
6006
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5939
6007
|
var DEFAULT_PAGE_SIZE = 20;
|
|
5940
6008
|
var noop = () => {
|
|
5941
6009
|
};
|
|
@@ -5993,23 +6061,21 @@ function DataTable({
|
|
|
5993
6061
|
celFilterConfig,
|
|
5994
6062
|
filterVisibility
|
|
5995
6063
|
}) {
|
|
5996
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6064
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5997
6065
|
const isGrid = layout === "grid";
|
|
5998
|
-
const
|
|
5999
|
-
const
|
|
6000
|
-
const
|
|
6001
|
-
const [
|
|
6002
|
-
const [
|
|
6003
|
-
const [
|
|
6004
|
-
const [
|
|
6005
|
-
const [innerColumnPinning, setInnerColumnPinning] = React11.useState({ start: [], end: [] });
|
|
6006
|
-
const [innerPagination, setInnerPagination] = React11.useState({
|
|
6066
|
+
const tableBodyScrollRef = React12.useRef(null);
|
|
6067
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React12.useState("");
|
|
6068
|
+
const [innerColumnOrdering, setInnerColumnOrdering] = React12.useState([]);
|
|
6069
|
+
const [innerColumnFilters, setInnerColumnFilters] = React12.useState([]);
|
|
6070
|
+
const [innerSorting, setInnerSorting] = React12.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
|
|
6071
|
+
const [innerColumnPinning, setInnerColumnPinning] = React12.useState({ start: [], end: [] });
|
|
6072
|
+
const [innerPagination, setInnerPagination] = React12.useState({
|
|
6007
6073
|
pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
|
|
6008
6074
|
pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
|
|
6009
6075
|
});
|
|
6010
|
-
const [innerGrouping, setInnerGrouping] =
|
|
6011
|
-
const [innerColumnVisibility, setInnerColumnVisibility] =
|
|
6012
|
-
const [innerExpanded, setInnerExpanded] =
|
|
6076
|
+
const [innerGrouping, setInnerGrouping] = React12.useState([]);
|
|
6077
|
+
const [innerColumnVisibility, setInnerColumnVisibility] = React12.useState({});
|
|
6078
|
+
const [innerExpanded, setInnerExpanded] = React12.useState({});
|
|
6013
6079
|
const {
|
|
6014
6080
|
columnSizing,
|
|
6015
6081
|
handleColumnSizingChange,
|
|
@@ -6026,6 +6092,9 @@ function DataTable({
|
|
|
6026
6092
|
filterRowVisible,
|
|
6027
6093
|
setFilterRowVisible
|
|
6028
6094
|
} = useFilterVisibility(filterVisibility);
|
|
6095
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
6096
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
6097
|
+
}
|
|
6029
6098
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
6030
6099
|
const applyGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
6031
6100
|
const columnFilters = parentColumnFilters || innerColumnFilters;
|
|
@@ -6033,25 +6102,25 @@ function DataTable({
|
|
|
6033
6102
|
const pagination = parentPagination || innerPagination;
|
|
6034
6103
|
const setPagination = parentSetPagination != null ? parentSetPagination : setInnerPagination;
|
|
6035
6104
|
const shouldDisablePagination = paginationConfig === false;
|
|
6036
|
-
const resetPageIndexOnFilterChange =
|
|
6105
|
+
const resetPageIndexOnFilterChange = React12.useCallback(() => {
|
|
6037
6106
|
if (!serverSidePagination || pagination.pageIndex === 0) return;
|
|
6038
6107
|
setPagination((prev) => __spreadProps(__spreadValues({}, prev), { pageIndex: 0 }));
|
|
6039
6108
|
}, [serverSidePagination, pagination.pageIndex, setPagination]);
|
|
6040
|
-
const setGlobalFilter =
|
|
6109
|
+
const setGlobalFilter = React12.useCallback(
|
|
6041
6110
|
(value) => {
|
|
6042
6111
|
applyGlobalFilter(value);
|
|
6043
6112
|
resetPageIndexOnFilterChange();
|
|
6044
6113
|
},
|
|
6045
6114
|
[applyGlobalFilter, resetPageIndexOnFilterChange]
|
|
6046
6115
|
);
|
|
6047
|
-
const setColumnFilters =
|
|
6116
|
+
const setColumnFilters = React12.useCallback(
|
|
6048
6117
|
(value) => {
|
|
6049
6118
|
applyColumnFilters(value);
|
|
6050
6119
|
resetPageIndexOnFilterChange();
|
|
6051
6120
|
},
|
|
6052
6121
|
[applyColumnFilters, resetPageIndexOnFilterChange]
|
|
6053
6122
|
);
|
|
6054
|
-
|
|
6123
|
+
React12.useLayoutEffect(() => {
|
|
6055
6124
|
var _a2;
|
|
6056
6125
|
if (shouldDisablePagination) return;
|
|
6057
6126
|
(_a2 = tableBodyScrollRef.current) == null ? void 0 : _a2.scrollTo({ top: 0 });
|
|
@@ -6075,7 +6144,9 @@ function DataTable({
|
|
|
6075
6144
|
const hasExternalSearch = parentGlobalFilter !== void 0;
|
|
6076
6145
|
const hasExternalFilters = parentColumnFilters !== void 0;
|
|
6077
6146
|
const shouldDisableFiltersModels = !!disableFilters && !!disableSearch && !hasExternalSearch && !hasExternalFilters;
|
|
6147
|
+
const columns = React12.useMemo(() => withDefaultFilterFns(config.columns), [config.columns]);
|
|
6078
6148
|
const table = useTable(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, config), {
|
|
6149
|
+
columns,
|
|
6079
6150
|
features: dataTableFeatures,
|
|
6080
6151
|
// Row models are registered statically in `dataTableFeatures`, so a disabled stage is switched
|
|
6081
6152
|
// off with its `manual*` option (the stage then passes rows through untouched).
|
|
@@ -6133,7 +6204,7 @@ function DataTable({
|
|
|
6133
6204
|
const orderedVisibleColumns = table.getVisibleLeafColumns().filter((col) => !isFilterOnlyColumn(col));
|
|
6134
6205
|
const hasFilters = !!celFilterConfig || hasFilterableColumns(flatColumns);
|
|
6135
6206
|
const showFilterToggle = filterToggleRequested && !disableFilters && hasFilters;
|
|
6136
|
-
const [gridMeasuredMins, setGridMeasuredMins] =
|
|
6207
|
+
const [gridMeasuredMins, setGridMeasuredMins] = React12.useState({});
|
|
6137
6208
|
const { gridTemplateColumns, gridRootRef, handleAutosizeAll, handleAutosizeColumn, handleResetColumnSize } = useGridLayout({
|
|
6138
6209
|
layout,
|
|
6139
6210
|
table,
|
|
@@ -6147,7 +6218,7 @@ function DataTable({
|
|
|
6147
6218
|
rawHandleAutosizeColumn,
|
|
6148
6219
|
rawHandleResetColumnSize
|
|
6149
6220
|
});
|
|
6150
|
-
const handleContextCell =
|
|
6221
|
+
const handleContextCell = React12.useCallback(
|
|
6151
6222
|
(filter, cell) => {
|
|
6152
6223
|
var _a2, _b2;
|
|
6153
6224
|
if (celFilterConfig == null ? void 0 : celFilterConfig.onContextualFilter) {
|
|
@@ -6164,13 +6235,13 @@ function DataTable({
|
|
|
6164
6235
|
},
|
|
6165
6236
|
[celFilterConfig, onContextCell, setColumnFilters, table]
|
|
6166
6237
|
);
|
|
6167
|
-
const handleContextSearch =
|
|
6238
|
+
const handleContextSearch = React12.useCallback(
|
|
6168
6239
|
(searchTerm) => {
|
|
6169
6240
|
setGlobalFilter(searchTerm);
|
|
6170
6241
|
},
|
|
6171
6242
|
[setGlobalFilter]
|
|
6172
6243
|
);
|
|
6173
|
-
const totalTableWidth =
|
|
6244
|
+
const totalTableWidth = React12.useMemo(() => {
|
|
6174
6245
|
if (isGrid) return 0;
|
|
6175
6246
|
const firstGroup = headerGroups[0];
|
|
6176
6247
|
if (!firstGroup) return 0;
|
|
@@ -6194,12 +6265,7 @@ function DataTable({
|
|
|
6194
6265
|
}
|
|
6195
6266
|
setGlobalFilter("");
|
|
6196
6267
|
};
|
|
6197
|
-
|
|
6198
|
-
if (parentGlobalFilter !== void 0) {
|
|
6199
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
6200
|
-
}
|
|
6201
|
-
}, [parentGlobalFilter]);
|
|
6202
|
-
React11.useEffect(() => {
|
|
6268
|
+
React12.useEffect(() => {
|
|
6203
6269
|
if (disableColumnReordering) return;
|
|
6204
6270
|
const allColumnIds = flatColumns.map((col) => col.id);
|
|
6205
6271
|
const normalizedColumnOrdering = normalizeColumnOrdering(columnOrdering, allColumnIds);
|
|
@@ -6208,38 +6274,18 @@ function DataTable({
|
|
|
6208
6274
|
}
|
|
6209
6275
|
}, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
|
|
6210
6276
|
const showViewHeader = !!title || !!Actions;
|
|
6211
|
-
const showClearSearchButton = globalFilter && !shouldDisable;
|
|
6212
6277
|
const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
|
|
6213
|
-
const toolbarSearch = !disableSearch && /* @__PURE__ */
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
value: globalFilter,
|
|
6225
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
6226
|
-
})
|
|
6227
|
-
),
|
|
6228
|
-
!!showClearSearchButton && /* @__PURE__ */ jsx17(InputGroupAddon4, { align: "inline-end", children: /* @__PURE__ */ jsx17(
|
|
6229
|
-
InputGroupButton2,
|
|
6230
|
-
{
|
|
6231
|
-
size: "icon-xs",
|
|
6232
|
-
"aria-label": "Clear search",
|
|
6233
|
-
onClick: () => {
|
|
6234
|
-
var _a2;
|
|
6235
|
-
setGlobalFilter("");
|
|
6236
|
-
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
6237
|
-
},
|
|
6238
|
-
children: /* @__PURE__ */ jsx17(Icon11, { name: "xmark" })
|
|
6239
|
-
}
|
|
6240
|
-
) })
|
|
6241
|
-
] });
|
|
6242
|
-
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx17(
|
|
6278
|
+
const toolbarSearch = !disableSearch && /* @__PURE__ */ jsx18(
|
|
6279
|
+
DataTableSearch,
|
|
6280
|
+
{
|
|
6281
|
+
value: globalFilter,
|
|
6282
|
+
onValueChange: setGlobalFilter,
|
|
6283
|
+
placeholder: search == null ? void 0 : search.placeholder,
|
|
6284
|
+
className: search == null ? void 0 : search.className,
|
|
6285
|
+
disabled: shouldDisable
|
|
6286
|
+
}
|
|
6287
|
+
);
|
|
6288
|
+
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx18(
|
|
6243
6289
|
ColumnOptions,
|
|
6244
6290
|
{
|
|
6245
6291
|
columns: flatColumns,
|
|
@@ -6248,7 +6294,7 @@ function DataTable({
|
|
|
6248
6294
|
disableColumnOrdering: disableColumnReordering
|
|
6249
6295
|
}
|
|
6250
6296
|
);
|
|
6251
|
-
return /* @__PURE__ */
|
|
6297
|
+
return /* @__PURE__ */ jsxs15(
|
|
6252
6298
|
"div",
|
|
6253
6299
|
{
|
|
6254
6300
|
id: `table-${id}`,
|
|
@@ -6259,19 +6305,19 @@ function DataTable({
|
|
|
6259
6305
|
className
|
|
6260
6306
|
),
|
|
6261
6307
|
children: [
|
|
6262
|
-
showViewHeader && /* @__PURE__ */
|
|
6263
|
-
!!title && /* @__PURE__ */
|
|
6264
|
-
!!description && /* @__PURE__ */
|
|
6308
|
+
showViewHeader && /* @__PURE__ */ jsx18(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs15(SectionHeaderContent, { children: [
|
|
6309
|
+
!!title && /* @__PURE__ */ jsx18(SectionHeaderTitle, { children: title }),
|
|
6310
|
+
!!description && /* @__PURE__ */ jsx18(SectionHeaderDescription, { children: description })
|
|
6265
6311
|
] }) }),
|
|
6266
|
-
/* @__PURE__ */
|
|
6312
|
+
/* @__PURE__ */ jsxs15("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
6267
6313
|
toolbarSearch,
|
|
6268
|
-
/* @__PURE__ */
|
|
6269
|
-
showFilterToggle && /* @__PURE__ */
|
|
6270
|
-
!!Actions && /* @__PURE__ */
|
|
6314
|
+
/* @__PURE__ */ jsxs15("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
6315
|
+
showFilterToggle && /* @__PURE__ */ jsx18(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
|
|
6316
|
+
!!Actions && /* @__PURE__ */ jsx18(Actions, { state: tableState }),
|
|
6271
6317
|
toolbarColumns
|
|
6272
6318
|
] })
|
|
6273
6319
|
] }),
|
|
6274
|
-
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */
|
|
6320
|
+
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */ jsx18("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx18("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx18(
|
|
6275
6321
|
CelFilterBar,
|
|
6276
6322
|
{
|
|
6277
6323
|
schema: celFilterConfig.schema,
|
|
@@ -6281,7 +6327,7 @@ function DataTable({
|
|
|
6281
6327
|
onRestrictedOptionSelect: celFilterConfig.onRestrictedOptionSelect,
|
|
6282
6328
|
showClearButton: celFilterConfig.showClearButton
|
|
6283
6329
|
}
|
|
6284
|
-
) }) : /* @__PURE__ */
|
|
6330
|
+
) }) : /* @__PURE__ */ jsx18(
|
|
6285
6331
|
ViewFilter,
|
|
6286
6332
|
{
|
|
6287
6333
|
columns: flatColumns,
|
|
@@ -6290,8 +6336,8 @@ function DataTable({
|
|
|
6290
6336
|
className: "data-[visible-filters=true]:mb-4"
|
|
6291
6337
|
}
|
|
6292
6338
|
) }),
|
|
6293
|
-
shouldRenderTableContent ? /* @__PURE__ */
|
|
6294
|
-
/* @__PURE__ */
|
|
6339
|
+
shouldRenderTableContent ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6340
|
+
/* @__PURE__ */ jsx18("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx18(
|
|
6295
6341
|
"div",
|
|
6296
6342
|
{
|
|
6297
6343
|
ref: tableBodyScrollRef,
|
|
@@ -6300,7 +6346,7 @@ function DataTable({
|
|
|
6300
6346
|
"min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
|
|
6301
6347
|
!!stickyHeader && !fitContent && STICKY_HEADER_MAX_HEIGHT_CLASS
|
|
6302
6348
|
),
|
|
6303
|
-
children: /* @__PURE__ */
|
|
6349
|
+
children: /* @__PURE__ */ jsxs15(
|
|
6304
6350
|
DataTableRoot,
|
|
6305
6351
|
{
|
|
6306
6352
|
layout,
|
|
@@ -6308,7 +6354,7 @@ function DataTable({
|
|
|
6308
6354
|
gridRootRef,
|
|
6309
6355
|
style: isGrid ? { width: "100%" } : totalTableWidth > 0 ? { width: `max(100%, ${totalTableWidth}px)`, minWidth: "100%" } : { width: "100%" },
|
|
6310
6356
|
children: [
|
|
6311
|
-
/* @__PURE__ */
|
|
6357
|
+
/* @__PURE__ */ jsx18(
|
|
6312
6358
|
DataTableHeader,
|
|
6313
6359
|
{
|
|
6314
6360
|
headerGroups,
|
|
@@ -6319,7 +6365,7 @@ function DataTable({
|
|
|
6319
6365
|
layout
|
|
6320
6366
|
}
|
|
6321
6367
|
),
|
|
6322
|
-
/* @__PURE__ */
|
|
6368
|
+
/* @__PURE__ */ jsx18(
|
|
6323
6369
|
DataTableBody,
|
|
6324
6370
|
{
|
|
6325
6371
|
tableRows,
|
|
@@ -6341,11 +6387,11 @@ function DataTable({
|
|
|
6341
6387
|
)
|
|
6342
6388
|
}
|
|
6343
6389
|
) }),
|
|
6344
|
-
!shouldDisablePagination && !!pagination && /* @__PURE__ */
|
|
6390
|
+
!shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx18(
|
|
6345
6391
|
DataTablePagination,
|
|
6346
6392
|
{
|
|
6347
6393
|
rowCount,
|
|
6348
|
-
rowCountRelation: (
|
|
6394
|
+
rowCountRelation: (_g = config.rowCountRelation) != null ? _g : "eq",
|
|
6349
6395
|
paginationConfig,
|
|
6350
6396
|
pageSize: pagination.pageSize,
|
|
6351
6397
|
pageIndex: pagination.pageIndex,
|
|
@@ -6353,7 +6399,7 @@ function DataTable({
|
|
|
6353
6399
|
onPageSizeChange: (nextPageSize) => setPagination((prev) => __spreadProps(__spreadValues({}, prev || pagination), { pageIndex: 0, pageSize: nextPageSize }))
|
|
6354
6400
|
}
|
|
6355
6401
|
)
|
|
6356
|
-
] }) : /* @__PURE__ */
|
|
6402
|
+
] }) : /* @__PURE__ */ jsx18(
|
|
6357
6403
|
DataTableEmptyView,
|
|
6358
6404
|
{
|
|
6359
6405
|
emptyView,
|
|
@@ -6373,19 +6419,19 @@ import {
|
|
|
6373
6419
|
} from "@tanstack/react-table";
|
|
6374
6420
|
|
|
6375
6421
|
// src/floating-widget.tsx
|
|
6376
|
-
import * as
|
|
6422
|
+
import * as React13 from "react";
|
|
6377
6423
|
import { Button as Button9 } from "@upbound/monarch-core";
|
|
6378
6424
|
import { DropdownMenu as DropdownMenu6, DropdownMenuContent as DropdownMenuContent6, DropdownMenuTrigger as DropdownMenuTrigger6 } from "@upbound/monarch-core";
|
|
6379
6425
|
import { Icon as Icon12 } from "@upbound/monarch-core";
|
|
6380
6426
|
import { Kbd as Kbd2 } from "@upbound/monarch-core";
|
|
6381
|
-
import { Tooltip as
|
|
6382
|
-
import { jsx as
|
|
6383
|
-
var FloatingWidgetContext =
|
|
6427
|
+
import { Tooltip as Tooltip8, TooltipContent as TooltipContent7, TooltipTrigger as TooltipTrigger7 } from "@upbound/monarch-core";
|
|
6428
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6429
|
+
var FloatingWidgetContext = React13.createContext(null);
|
|
6384
6430
|
function FloatingWidgetProvider({ children }) {
|
|
6385
|
-
const [isOpen, setIsOpen] =
|
|
6386
|
-
const [isCollapsed, setIsCollapsed] =
|
|
6387
|
-
const [isExpanded, setIsExpanded] =
|
|
6388
|
-
const value =
|
|
6431
|
+
const [isOpen, setIsOpen] = React13.useState(false);
|
|
6432
|
+
const [isCollapsed, setIsCollapsed] = React13.useState(false);
|
|
6433
|
+
const [isExpanded, setIsExpanded] = React13.useState(false);
|
|
6434
|
+
const value = React13.useMemo(
|
|
6389
6435
|
() => ({
|
|
6390
6436
|
isOpen,
|
|
6391
6437
|
isCollapsed,
|
|
@@ -6417,10 +6463,10 @@ function FloatingWidgetProvider({ children }) {
|
|
|
6417
6463
|
}),
|
|
6418
6464
|
[isOpen, isCollapsed, isExpanded]
|
|
6419
6465
|
);
|
|
6420
|
-
return /* @__PURE__ */
|
|
6466
|
+
return /* @__PURE__ */ jsx19(FloatingWidgetContext.Provider, { value, children });
|
|
6421
6467
|
}
|
|
6422
6468
|
function useFloatingWidget() {
|
|
6423
|
-
const ctx =
|
|
6469
|
+
const ctx = React13.useContext(FloatingWidgetContext);
|
|
6424
6470
|
if (!ctx) {
|
|
6425
6471
|
throw new Error("useFloatingWidget must be used inside <FloatingWidgetProvider>.");
|
|
6426
6472
|
}
|
|
@@ -6428,14 +6474,14 @@ function useFloatingWidget() {
|
|
|
6428
6474
|
}
|
|
6429
6475
|
function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, className }) {
|
|
6430
6476
|
const { isOpen, isCollapsed, isExpanded, close, collapse, restore, toggleExpand } = useFloatingWidget();
|
|
6431
|
-
const [dragWidth, setDragWidth] =
|
|
6432
|
-
const [isDragging, setIsDragging] =
|
|
6433
|
-
|
|
6477
|
+
const [dragWidth, setDragWidth] = React13.useState(null);
|
|
6478
|
+
const [isDragging, setIsDragging] = React13.useState(false);
|
|
6479
|
+
React13.useEffect(() => {
|
|
6434
6480
|
setDragWidth(null);
|
|
6435
6481
|
}, [isExpanded]);
|
|
6436
6482
|
const MIN_WIDTH = 420;
|
|
6437
|
-
const widgetRef =
|
|
6438
|
-
const handleResizeMouseDown =
|
|
6483
|
+
const widgetRef = React13.useRef(null);
|
|
6484
|
+
const handleResizeMouseDown = React13.useCallback((e) => {
|
|
6439
6485
|
var _a, _b;
|
|
6440
6486
|
e.preventDefault();
|
|
6441
6487
|
setIsDragging(true);
|
|
@@ -6455,7 +6501,7 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6455
6501
|
window.addEventListener("mousemove", onMove);
|
|
6456
6502
|
window.addEventListener("mouseup", onUp);
|
|
6457
6503
|
}, []);
|
|
6458
|
-
|
|
6504
|
+
React13.useEffect(() => {
|
|
6459
6505
|
if (!isOpen) return;
|
|
6460
6506
|
function handleKeydown(e) {
|
|
6461
6507
|
if (e.key === "Escape") {
|
|
@@ -6467,7 +6513,7 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6467
6513
|
}, [isOpen, close]);
|
|
6468
6514
|
if (!isOpen) return null;
|
|
6469
6515
|
const dragStyle = dragWidth != null && !isCollapsed ? { width: `${dragWidth}px`, minWidth: `${MIN_WIDTH}px` } : void 0;
|
|
6470
|
-
return /* @__PURE__ */
|
|
6516
|
+
return /* @__PURE__ */ jsxs16(
|
|
6471
6517
|
"div",
|
|
6472
6518
|
{
|
|
6473
6519
|
ref: widgetRef,
|
|
@@ -6491,8 +6537,8 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6491
6537
|
className
|
|
6492
6538
|
),
|
|
6493
6539
|
children: [
|
|
6494
|
-
!isCollapsed && /* @__PURE__ */
|
|
6495
|
-
/* @__PURE__ */
|
|
6540
|
+
!isCollapsed && /* @__PURE__ */ jsxs16(Tooltip8, { children: [
|
|
6541
|
+
/* @__PURE__ */ jsx19(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
6496
6542
|
"div",
|
|
6497
6543
|
{
|
|
6498
6544
|
role: "separator",
|
|
@@ -6500,56 +6546,56 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6500
6546
|
"aria-label": "Resize widget",
|
|
6501
6547
|
onMouseDown: handleResizeMouseDown,
|
|
6502
6548
|
className: "group absolute inset-y-0 left-0 z-20 hidden w-3 cursor-col-resize touch-none items-center justify-center bg-transparent select-none sm:flex",
|
|
6503
|
-
children: /* @__PURE__ */
|
|
6549
|
+
children: /* @__PURE__ */ jsx19("div", { className: "bg-border h-12 w-1 shrink-0 rounded-lg opacity-0 transition-opacity duration-150 group-hover:opacity-100" })
|
|
6504
6550
|
}
|
|
6505
6551
|
) }),
|
|
6506
|
-
/* @__PURE__ */
|
|
6552
|
+
/* @__PURE__ */ jsx19(TooltipContent7, { side: "left", children: "Resize" })
|
|
6507
6553
|
] }),
|
|
6508
|
-
/* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6511
|
-
subtitle && /* @__PURE__ */
|
|
6554
|
+
/* @__PURE__ */ jsxs16("header", { className: "flex min-h-12 shrink-0 items-center gap-1 border-b px-3 py-2", children: [
|
|
6555
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-1 flex-col justify-center", children: [
|
|
6556
|
+
/* @__PURE__ */ jsx19("span", { className: "text-body truncate font-medium", children: title }),
|
|
6557
|
+
subtitle && /* @__PURE__ */ jsx19("span", { className: "text-body-sm text-muted-foreground truncate", children: subtitle })
|
|
6512
6558
|
] }),
|
|
6513
|
-
menuItems && !isCollapsed && /* @__PURE__ */
|
|
6514
|
-
/* @__PURE__ */
|
|
6515
|
-
/* @__PURE__ */
|
|
6516
|
-
/* @__PURE__ */
|
|
6559
|
+
menuItems && !isCollapsed && /* @__PURE__ */ jsxs16(Tooltip8, { children: [
|
|
6560
|
+
/* @__PURE__ */ jsxs16(DropdownMenu6, { children: [
|
|
6561
|
+
/* @__PURE__ */ jsx19(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx19(DropdownMenuTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", "aria-label": "More options", children: /* @__PURE__ */ jsx19(Icon12, { name: "ellipsis-vertical" }) }) }) }),
|
|
6562
|
+
/* @__PURE__ */ jsx19(DropdownMenuContent6, { align: "end", children: menuItems })
|
|
6517
6563
|
] }),
|
|
6518
|
-
/* @__PURE__ */
|
|
6564
|
+
/* @__PURE__ */ jsx19(TooltipContent7, { children: "More options" })
|
|
6519
6565
|
] }),
|
|
6520
|
-
!isCollapsed && /* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6566
|
+
!isCollapsed && /* @__PURE__ */ jsxs16(Tooltip8, { children: [
|
|
6567
|
+
/* @__PURE__ */ jsx19(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
6522
6568
|
Button9,
|
|
6523
6569
|
{
|
|
6524
6570
|
variant: "ghost",
|
|
6525
6571
|
size: "icon-sm",
|
|
6526
6572
|
onClick: toggleExpand,
|
|
6527
6573
|
"aria-label": isExpanded ? "Shrink widget" : "Expand widget",
|
|
6528
|
-
children: /* @__PURE__ */
|
|
6574
|
+
children: /* @__PURE__ */ jsx19(Icon12, { name: isExpanded ? "shrink" : "arrow-up-right-and-arrow-down-left-from-center" })
|
|
6529
6575
|
}
|
|
6530
6576
|
) }),
|
|
6531
|
-
/* @__PURE__ */
|
|
6577
|
+
/* @__PURE__ */ jsx19(TooltipContent7, { children: isExpanded ? "Shrink widget" : "Expand widget" })
|
|
6532
6578
|
] }),
|
|
6533
|
-
/* @__PURE__ */
|
|
6534
|
-
/* @__PURE__ */
|
|
6535
|
-
/* @__PURE__ */
|
|
6579
|
+
/* @__PURE__ */ jsxs16(Tooltip8, { children: [
|
|
6580
|
+
/* @__PURE__ */ jsx19(TooltipTrigger7, { asChild: true, children: isCollapsed ? /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: restore, "aria-label": "Restore widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "window-maximize" }) }) : /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: collapse, "aria-label": "Minimize widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "minus" }) }) }),
|
|
6581
|
+
/* @__PURE__ */ jsx19(TooltipContent7, { children: isCollapsed ? "Restore widget" : "Minimize widget" })
|
|
6536
6582
|
] }),
|
|
6537
|
-
/* @__PURE__ */
|
|
6538
|
-
/* @__PURE__ */
|
|
6539
|
-
/* @__PURE__ */
|
|
6583
|
+
/* @__PURE__ */ jsxs16(Tooltip8, { children: [
|
|
6584
|
+
/* @__PURE__ */ jsx19(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: close, "aria-label": "Close widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "xmark" }) }) }),
|
|
6585
|
+
/* @__PURE__ */ jsxs16(TooltipContent7, { children: [
|
|
6540
6586
|
"Close widget",
|
|
6541
|
-
/* @__PURE__ */
|
|
6587
|
+
/* @__PURE__ */ jsx19(Kbd2, { children: "Esc" })
|
|
6542
6588
|
] })
|
|
6543
6589
|
] })
|
|
6544
6590
|
] }),
|
|
6545
|
-
!isCollapsed && /* @__PURE__ */
|
|
6591
|
+
!isCollapsed && /* @__PURE__ */ jsx19("div", { className: "flex min-h-0 flex-1 flex-col", children })
|
|
6546
6592
|
]
|
|
6547
6593
|
}
|
|
6548
6594
|
);
|
|
6549
6595
|
}
|
|
6550
6596
|
|
|
6551
6597
|
// src/graph/graph-actions-provider.tsx
|
|
6552
|
-
import * as
|
|
6598
|
+
import * as React15 from "react";
|
|
6553
6599
|
|
|
6554
6600
|
// src/graph/hooks/useGraphActionsContext.ts
|
|
6555
6601
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
@@ -6563,12 +6609,12 @@ var useGraphActionsContext = () => {
|
|
|
6563
6609
|
};
|
|
6564
6610
|
|
|
6565
6611
|
// src/graph/hooks/useGraphActions.ts
|
|
6566
|
-
import { useCallback as useCallback10, useState as
|
|
6612
|
+
import { useCallback as useCallback10, useState as useState13 } from "react";
|
|
6567
6613
|
|
|
6568
6614
|
// src/graph/graph-node.tsx
|
|
6569
|
-
import * as
|
|
6615
|
+
import * as React14 from "react";
|
|
6570
6616
|
import { getIncomers, getOutgoers, Handle, Position as Position2 } from "reactflow";
|
|
6571
|
-
import { Badge as Badge5, Card as Card2, Icon as Icon13, Spinner, Tooltip as
|
|
6617
|
+
import { Badge as Badge5, Card as Card2, Icon as Icon13, Spinner, Tooltip as Tooltip9, TooltipContent as TooltipContent8, TooltipTrigger as TooltipTrigger8 } from "@upbound/monarch-core";
|
|
6572
6618
|
|
|
6573
6619
|
// src/graph/consts.ts
|
|
6574
6620
|
var GRAPH_NODE_WIDTH = 260;
|
|
@@ -6579,7 +6625,7 @@ var GRAPH_RANK_SEP = 54;
|
|
|
6579
6625
|
|
|
6580
6626
|
// src/graph/graph-edge.tsx
|
|
6581
6627
|
import { getSmoothStepPath, getStraightPath, Position } from "reactflow";
|
|
6582
|
-
import { jsx as
|
|
6628
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6583
6629
|
var GraphEdge = ({
|
|
6584
6630
|
id,
|
|
6585
6631
|
sourceX,
|
|
@@ -6605,14 +6651,14 @@ var GraphEdge = ({
|
|
|
6605
6651
|
borderRadius: 8,
|
|
6606
6652
|
offset: 0
|
|
6607
6653
|
});
|
|
6608
|
-
return /* @__PURE__ */
|
|
6609
|
-
/* @__PURE__ */
|
|
6610
|
-
/* @__PURE__ */
|
|
6654
|
+
return /* @__PURE__ */ jsxs17("g", { id, className: "react-flow__edge-path", children: [
|
|
6655
|
+
/* @__PURE__ */ jsx20("path", { d: straightEdgePath, className: "stroke-border fill-transparent stroke-2" }),
|
|
6656
|
+
/* @__PURE__ */ jsx20("path", { d: edgePath, className: "stroke-border fill-transparent stroke-2" })
|
|
6611
6657
|
] });
|
|
6612
6658
|
};
|
|
6613
6659
|
|
|
6614
6660
|
// src/graph/graph-node.tsx
|
|
6615
|
-
import { Fragment as Fragment10, jsx as
|
|
6661
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6616
6662
|
function isDefaultNode(node) {
|
|
6617
6663
|
return node.type !== "loading";
|
|
6618
6664
|
}
|
|
@@ -6622,29 +6668,29 @@ function GraphNode(_a) {
|
|
|
6622
6668
|
const { nodes: originalNodes, edges: originalEdges } = useGraphActionsContext();
|
|
6623
6669
|
const nodes = originalNodes;
|
|
6624
6670
|
const edges = originalEdges;
|
|
6625
|
-
const handleClick =
|
|
6671
|
+
const handleClick = React14.useCallback(() => {
|
|
6626
6672
|
var _a3;
|
|
6627
6673
|
(_a3 = data == null ? void 0 : data.onClick) == null ? void 0 : _a3.call(data, id, data);
|
|
6628
6674
|
}, [data, id]);
|
|
6629
6675
|
const compact = (_a2 = data == null ? void 0 : data.compact) != null ? _a2 : false;
|
|
6630
6676
|
const state = (_b2 = data == null ? void 0 : data.state) != null ? _b2 : "default";
|
|
6631
|
-
const compactBadges =
|
|
6677
|
+
const compactBadges = React14.useMemo(() => {
|
|
6632
6678
|
const badges = data.badges.compact || [];
|
|
6633
6679
|
if (state === "paused") {
|
|
6634
6680
|
return [
|
|
6635
|
-
{ children: /* @__PURE__ */
|
|
6681
|
+
{ children: /* @__PURE__ */ jsx21(Icon13, { name: "pause", size: "xs" }), variant: "secondary", tooltipContent: "Resource is paused" },
|
|
6636
6682
|
...badges
|
|
6637
6683
|
];
|
|
6638
6684
|
}
|
|
6639
6685
|
return badges;
|
|
6640
6686
|
}, [data.badges.compact, state]);
|
|
6641
|
-
const defaultBadges =
|
|
6687
|
+
const defaultBadges = React14.useMemo(() => {
|
|
6642
6688
|
const badges = data.badges.default || [];
|
|
6643
6689
|
if (state === "paused") {
|
|
6644
6690
|
return [
|
|
6645
6691
|
{
|
|
6646
|
-
children: /* @__PURE__ */
|
|
6647
|
-
/* @__PURE__ */
|
|
6692
|
+
children: /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
6693
|
+
/* @__PURE__ */ jsx21(Icon13, { name: "pause", size: "xs", className: "mr-1" }),
|
|
6648
6694
|
" Paused"
|
|
6649
6695
|
] }),
|
|
6650
6696
|
variant: "secondary",
|
|
@@ -6655,7 +6701,7 @@ function GraphNode(_a) {
|
|
|
6655
6701
|
}
|
|
6656
6702
|
return badges;
|
|
6657
6703
|
}, [data.badges.default, state]);
|
|
6658
|
-
const currentNode =
|
|
6704
|
+
const currentNode = React14.useMemo(
|
|
6659
6705
|
() => ({
|
|
6660
6706
|
id,
|
|
6661
6707
|
position: { x: 0, y: 0 },
|
|
@@ -6665,15 +6711,15 @@ function GraphNode(_a) {
|
|
|
6665
6711
|
}),
|
|
6666
6712
|
[id, data, props.type]
|
|
6667
6713
|
);
|
|
6668
|
-
const _hasIncomingEdge =
|
|
6714
|
+
const _hasIncomingEdge = React14.useMemo(() => {
|
|
6669
6715
|
return getIncomers(currentNode, nodes, edges).length > 0;
|
|
6670
6716
|
}, [currentNode, nodes, edges]);
|
|
6671
|
-
const hasOutgoingEdge =
|
|
6717
|
+
const hasOutgoingEdge = React14.useMemo(() => {
|
|
6672
6718
|
return getOutgoers(currentNode, nodes, edges).length > 0;
|
|
6673
6719
|
}, [currentNode, nodes, edges]);
|
|
6674
6720
|
const targetX = GRAPH_NODE_WIDTH / 2 - 4;
|
|
6675
6721
|
const sourceX = 4;
|
|
6676
|
-
return /* @__PURE__ */
|
|
6722
|
+
return /* @__PURE__ */ jsxs18(
|
|
6677
6723
|
Card2,
|
|
6678
6724
|
{
|
|
6679
6725
|
className: cn(
|
|
@@ -6684,7 +6730,7 @@ function GraphNode(_a) {
|
|
|
6684
6730
|
),
|
|
6685
6731
|
style: { height: compact ? GRAPH_NODE_COLLAPSED_HEIGHT : GRAPH_NODE_HEIGHT, width: GRAPH_NODE_WIDTH },
|
|
6686
6732
|
children: [
|
|
6687
|
-
/* @__PURE__ */
|
|
6733
|
+
/* @__PURE__ */ jsx21(
|
|
6688
6734
|
Handle,
|
|
6689
6735
|
{
|
|
6690
6736
|
type: "target",
|
|
@@ -6696,13 +6742,13 @@ function GraphNode(_a) {
|
|
|
6696
6742
|
isConnectable: false
|
|
6697
6743
|
}
|
|
6698
6744
|
),
|
|
6699
|
-
/* @__PURE__ */
|
|
6700
|
-
/* @__PURE__ */
|
|
6701
|
-
!!compact && /* @__PURE__ */
|
|
6702
|
-
compactBadges.length > 0 && /* @__PURE__ */
|
|
6745
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex w-full flex-1 cursor-pointer flex-col", onClick: handleClick, children: [
|
|
6746
|
+
/* @__PURE__ */ jsxs18("div", { className: cn("flex w-full justify-between gap-1 px-2.5", compact && "flex-row-reverse items-start"), children: [
|
|
6747
|
+
!!compact && /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
6748
|
+
compactBadges.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: compactBadges.map((_c, index) => {
|
|
6703
6749
|
var _d = _c, { tooltipContent, variant } = _d, badge = __objRest(_d, ["tooltipContent", "variant"]);
|
|
6704
|
-
return /* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
6750
|
+
return /* @__PURE__ */ jsxs18(Tooltip9, { children: [
|
|
6751
|
+
/* @__PURE__ */ jsx21(TooltipTrigger8, { children: /* @__PURE__ */ jsx21(
|
|
6706
6752
|
Badge5,
|
|
6707
6753
|
__spreadProps(__spreadValues({
|
|
6708
6754
|
variant
|
|
@@ -6711,17 +6757,17 @@ function GraphNode(_a) {
|
|
|
6711
6757
|
children: badge.children
|
|
6712
6758
|
})
|
|
6713
6759
|
) }),
|
|
6714
|
-
tooltipContent && /* @__PURE__ */
|
|
6760
|
+
tooltipContent && /* @__PURE__ */ jsx21(TooltipContent8, { children: tooltipContent })
|
|
6715
6761
|
] }, index);
|
|
6716
6762
|
}) }),
|
|
6717
|
-
state === "progressing" && /* @__PURE__ */
|
|
6763
|
+
state === "progressing" && /* @__PURE__ */ jsx21("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: /* @__PURE__ */ jsx21("div", { className: "flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx21(Spinner, { size: "sm" }) }) })
|
|
6718
6764
|
] }),
|
|
6719
|
-
/* @__PURE__ */
|
|
6720
|
-
/* @__PURE__ */
|
|
6721
|
-
/* @__PURE__ */
|
|
6722
|
-
!compact && /* @__PURE__ */
|
|
6765
|
+
/* @__PURE__ */ jsxs18("div", { className: "mr-auto grow-0 overflow-hidden", children: [
|
|
6766
|
+
/* @__PURE__ */ jsx21("h5", { className: "text-body-sm/tight truncate font-bold", children: data.title }),
|
|
6767
|
+
/* @__PURE__ */ jsx21("p", { className: "text-body-sm truncate leading-none", children: data.subtitle }),
|
|
6768
|
+
!compact && /* @__PURE__ */ jsx21("p", { className: "text-body-sm text-muted-foreground mt-1 truncate", children: data.name })
|
|
6723
6769
|
] }),
|
|
6724
|
-
/* @__PURE__ */
|
|
6770
|
+
/* @__PURE__ */ jsx21(
|
|
6725
6771
|
"span",
|
|
6726
6772
|
{
|
|
6727
6773
|
className: cn(
|
|
@@ -6733,18 +6779,18 @@ function GraphNode(_a) {
|
|
|
6733
6779
|
}
|
|
6734
6780
|
)
|
|
6735
6781
|
] }),
|
|
6736
|
-
!compact && /* @__PURE__ */
|
|
6737
|
-
/* @__PURE__ */
|
|
6782
|
+
!compact && /* @__PURE__ */ jsx21(Fragment10, { children: (defaultBadges.length > 0 || state === "progressing") && /* @__PURE__ */ jsxs18("div", { className: "mt-auto flex h-8 items-center border-t px-2.5", children: [
|
|
6783
|
+
/* @__PURE__ */ jsx21("div", { className: "flex gap-1.5 overflow-hidden overflow-x-auto", children: defaultBadges.map((_e, index) => {
|
|
6738
6784
|
var _f = _e, { tooltipContent, variant } = _f, badge = __objRest(_f, ["tooltipContent", "variant"]);
|
|
6739
|
-
return /* @__PURE__ */
|
|
6740
|
-
/* @__PURE__ */
|
|
6741
|
-
tooltipContent && /* @__PURE__ */
|
|
6785
|
+
return /* @__PURE__ */ jsxs18(Tooltip9, { children: [
|
|
6786
|
+
/* @__PURE__ */ jsx21(TooltipTrigger8, { children: /* @__PURE__ */ jsx21(Badge5, __spreadProps(__spreadValues({ variant }, badge), { className: "cursor-default! py-px! whitespace-nowrap", children: badge.children })) }),
|
|
6787
|
+
tooltipContent && /* @__PURE__ */ jsx21(TooltipContent8, { children: tooltipContent })
|
|
6742
6788
|
] }, index);
|
|
6743
6789
|
}) }),
|
|
6744
|
-
state === "progressing" && /* @__PURE__ */
|
|
6790
|
+
state === "progressing" && /* @__PURE__ */ jsx21("div", { className: "ml-auto flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx21(Spinner, { size: "sm" }) })
|
|
6745
6791
|
] }) })
|
|
6746
6792
|
] }),
|
|
6747
|
-
!!hasOutgoingEdge && /* @__PURE__ */
|
|
6793
|
+
!!hasOutgoingEdge && /* @__PURE__ */ jsxs18(
|
|
6748
6794
|
"div",
|
|
6749
6795
|
{
|
|
6750
6796
|
className: "absolute top-0 right-0 h-full w-auto translate-x-full",
|
|
@@ -6752,7 +6798,7 @@ function GraphNode(_a) {
|
|
|
6752
6798
|
width: GRAPH_RANK_SEP
|
|
6753
6799
|
},
|
|
6754
6800
|
children: [
|
|
6755
|
-
/* @__PURE__ */
|
|
6801
|
+
/* @__PURE__ */ jsx21("svg", { height: 20, width: GRAPH_NODE_SEP, className: "absolute top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx21(
|
|
6756
6802
|
GraphEdge,
|
|
6757
6803
|
{
|
|
6758
6804
|
id: `${id}-expadable`,
|
|
@@ -6767,8 +6813,8 @@ function GraphNode(_a) {
|
|
|
6767
6813
|
stopOpacity: 0
|
|
6768
6814
|
}
|
|
6769
6815
|
) }),
|
|
6770
|
-
/* @__PURE__ */
|
|
6771
|
-
/* @__PURE__ */
|
|
6816
|
+
/* @__PURE__ */ jsxs18(Tooltip9, { children: [
|
|
6817
|
+
/* @__PURE__ */ jsx21(TooltipTrigger8, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
6772
6818
|
"button",
|
|
6773
6819
|
{
|
|
6774
6820
|
type: "button",
|
|
@@ -6779,15 +6825,15 @@ function GraphNode(_a) {
|
|
|
6779
6825
|
e.stopPropagation();
|
|
6780
6826
|
(_a3 = data.onExpandToggle) == null ? void 0 : _a3.call(data, id);
|
|
6781
6827
|
},
|
|
6782
|
-
children: /* @__PURE__ */
|
|
6828
|
+
children: /* @__PURE__ */ jsx21(Icon13, { name: data.expanded ? "minus" : "plus", size: "xs" })
|
|
6783
6829
|
}
|
|
6784
6830
|
) }),
|
|
6785
|
-
/* @__PURE__ */
|
|
6831
|
+
/* @__PURE__ */ jsx21(TooltipContent8, { children: data.expanded ? "Collapse" : "Expand" })
|
|
6786
6832
|
] })
|
|
6787
6833
|
]
|
|
6788
6834
|
}
|
|
6789
6835
|
),
|
|
6790
|
-
/* @__PURE__ */
|
|
6836
|
+
/* @__PURE__ */ jsx21(
|
|
6791
6837
|
Handle,
|
|
6792
6838
|
{
|
|
6793
6839
|
type: "source",
|
|
@@ -6805,7 +6851,7 @@ function GraphNode(_a) {
|
|
|
6805
6851
|
}
|
|
6806
6852
|
function GraphNodeSkeleton(_props) {
|
|
6807
6853
|
const compact = false;
|
|
6808
|
-
return /* @__PURE__ */
|
|
6854
|
+
return /* @__PURE__ */ jsxs18(
|
|
6809
6855
|
Card2,
|
|
6810
6856
|
{
|
|
6811
6857
|
className: cn(
|
|
@@ -6813,7 +6859,7 @@ function GraphNodeSkeleton(_props) {
|
|
|
6813
6859
|
compact && `h-[47px]!`
|
|
6814
6860
|
),
|
|
6815
6861
|
children: [
|
|
6816
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsx21(
|
|
6817
6863
|
Handle,
|
|
6818
6864
|
{
|
|
6819
6865
|
type: "target",
|
|
@@ -6825,19 +6871,19 @@ function GraphNodeSkeleton(_props) {
|
|
|
6825
6871
|
isConnectable: false
|
|
6826
6872
|
}
|
|
6827
6873
|
),
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__PURE__ */
|
|
6830
|
-
/* @__PURE__ */
|
|
6831
|
-
/* @__PURE__ */
|
|
6832
|
-
!compact && /* @__PURE__ */
|
|
6874
|
+
/* @__PURE__ */ jsxs18("div", { className: cn("flex w-full gap-1 px-2.5", compact && "flex-row-reverse"), children: [
|
|
6875
|
+
/* @__PURE__ */ jsxs18("div", { className: cn("grow-0 overflow-hidden", compact && "mr-auto"), children: [
|
|
6876
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted mb-1 h-3 w-16 animate-pulse rounded-sm" }),
|
|
6877
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-3 w-40 animate-pulse rounded-sm" }),
|
|
6878
|
+
!compact && /* @__PURE__ */ jsx21("div", { className: "bg-muted mt-2 h-3 w-48 animate-pulse rounded-sm" })
|
|
6833
6879
|
] }),
|
|
6834
|
-
/* @__PURE__ */
|
|
6880
|
+
/* @__PURE__ */ jsx21("div", { className: cn("bg-muted size-[26px] shrink-0 animate-pulse rounded-md", !compact && "ml-auto") })
|
|
6835
6881
|
] }),
|
|
6836
|
-
!compact && /* @__PURE__ */
|
|
6837
|
-
/* @__PURE__ */
|
|
6838
|
-
/* @__PURE__ */
|
|
6882
|
+
!compact && /* @__PURE__ */ jsx21("div", { className: "mt-auto flex h-8 items-center border-t px-2.5", children: /* @__PURE__ */ jsxs18("div", { className: "flex gap-1.5 overflow-hidden overflow-x-auto", children: [
|
|
6883
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-4 w-12 animate-pulse rounded-sm" }),
|
|
6884
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-4 w-12 animate-pulse rounded-sm" })
|
|
6839
6885
|
] }) }),
|
|
6840
|
-
/* @__PURE__ */
|
|
6886
|
+
/* @__PURE__ */ jsx21(
|
|
6841
6887
|
Handle,
|
|
6842
6888
|
{
|
|
6843
6889
|
type: "source",
|
|
@@ -6856,8 +6902,8 @@ function GraphNodeSkeleton(_props) {
|
|
|
6856
6902
|
|
|
6857
6903
|
// src/graph/hooks/useGraphActions.ts
|
|
6858
6904
|
var useGraphActions = (initialNodes = [], initialEdges = []) => {
|
|
6859
|
-
const [nodes, setNodes] =
|
|
6860
|
-
const [edges, setEdges] =
|
|
6905
|
+
const [nodes, setNodes] = useState13(initialNodes);
|
|
6906
|
+
const [edges, setEdges] = useState13(initialEdges);
|
|
6861
6907
|
const addNodes = useCallback10((newNodes) => {
|
|
6862
6908
|
setNodes((prevNodes) => {
|
|
6863
6909
|
const existingIds = new Set(prevNodes.map((node) => node.id));
|
|
@@ -6918,11 +6964,11 @@ var useGraphActions = (initialNodes = [], initialEdges = []) => {
|
|
|
6918
6964
|
};
|
|
6919
6965
|
|
|
6920
6966
|
// src/graph/graph-actions-provider.tsx
|
|
6921
|
-
import { jsx as
|
|
6922
|
-
var GraphActionsProvider =
|
|
6967
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
6968
|
+
var GraphActionsProvider = React15.forwardRef(
|
|
6923
6969
|
({ initialNodes = [], initialEdges = [], children }, ref) => {
|
|
6924
6970
|
const graphActions = useGraphActions(initialNodes, initialEdges);
|
|
6925
|
-
|
|
6971
|
+
React15.useImperativeHandle(
|
|
6926
6972
|
ref,
|
|
6927
6973
|
() => ({
|
|
6928
6974
|
addNodes: graphActions.addNodes,
|
|
@@ -6935,18 +6981,18 @@ var GraphActionsProvider = React14.forwardRef(
|
|
|
6935
6981
|
}),
|
|
6936
6982
|
[graphActions]
|
|
6937
6983
|
);
|
|
6938
|
-
return /* @__PURE__ */
|
|
6984
|
+
return /* @__PURE__ */ jsx22(GraphActionsContext.Provider, { value: graphActions, children });
|
|
6939
6985
|
}
|
|
6940
6986
|
);
|
|
6941
6987
|
GraphActionsProvider.displayName = "GraphActionsProvider";
|
|
6942
6988
|
|
|
6943
6989
|
// src/graph/graph.tsx
|
|
6944
|
-
import * as
|
|
6990
|
+
import * as React18 from "react";
|
|
6945
6991
|
import { useTable as useTable2 } from "@tanstack/react-table";
|
|
6946
|
-
import { Icon as Icon14
|
|
6992
|
+
import { Icon as Icon14 } from "@upbound/monarch-core";
|
|
6947
6993
|
|
|
6948
6994
|
// src/graph/graph-view.tsx
|
|
6949
|
-
import * as
|
|
6995
|
+
import * as React17 from "react";
|
|
6950
6996
|
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider } from "reactflow";
|
|
6951
6997
|
|
|
6952
6998
|
// src/graph/hooks/useAutoLayout.ts
|
|
@@ -7154,7 +7200,7 @@ var useNodeVisibility = (nodes, edges) => {
|
|
|
7154
7200
|
};
|
|
7155
7201
|
|
|
7156
7202
|
// src/graph/hooks/useViewportFocus.ts
|
|
7157
|
-
import * as
|
|
7203
|
+
import * as React16 from "react";
|
|
7158
7204
|
import { useReactFlow, useStore } from "reactflow";
|
|
7159
7205
|
function getViewportFocusCenter(node) {
|
|
7160
7206
|
var _a;
|
|
@@ -7169,7 +7215,7 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
7169
7215
|
const { setCenter } = useReactFlow();
|
|
7170
7216
|
const viewportReady = useStore((state) => state.width > 0 && state.height > 0);
|
|
7171
7217
|
const node = viewportFocusNodeId ? nodeMap.get(viewportFocusNodeId) : void 0;
|
|
7172
|
-
|
|
7218
|
+
React16.useEffect(() => {
|
|
7173
7219
|
if (!node || !viewportReady) {
|
|
7174
7220
|
return;
|
|
7175
7221
|
}
|
|
@@ -7179,24 +7225,24 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
7179
7225
|
}
|
|
7180
7226
|
|
|
7181
7227
|
// src/graph/graph-view.tsx
|
|
7182
|
-
import { jsx as
|
|
7228
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7183
7229
|
var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeTypes, children, viewportFocusNodeId }) => {
|
|
7184
7230
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
7185
|
-
const nodeTypes =
|
|
7231
|
+
const nodeTypes = React17.useMemo(
|
|
7186
7232
|
() => __spreadValues({
|
|
7187
7233
|
default: GraphNode,
|
|
7188
7234
|
loading: GraphNodeSkeleton
|
|
7189
7235
|
}, parentNodeTypes),
|
|
7190
7236
|
[parentNodeTypes]
|
|
7191
7237
|
);
|
|
7192
|
-
const edgeTypes =
|
|
7238
|
+
const edgeTypes = React17.useMemo(
|
|
7193
7239
|
() => __spreadValues({
|
|
7194
7240
|
default: GraphEdge
|
|
7195
7241
|
}, parentEdgeTypes),
|
|
7196
7242
|
[parentEdgeTypes]
|
|
7197
7243
|
);
|
|
7198
7244
|
const { nodes: visibleNodes, edges: visibleEdges } = useNodeVisibility(nodes, edges);
|
|
7199
|
-
const nodesWithExpansion =
|
|
7245
|
+
const nodesWithExpansion = React17.useMemo(() => {
|
|
7200
7246
|
return visibleNodes.map((node) => {
|
|
7201
7247
|
if (isDefaultNode(node) && !node.data.onExpandToggle) {
|
|
7202
7248
|
return __spreadProps(__spreadValues({}, node), {
|
|
@@ -7216,7 +7262,7 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
7216
7262
|
viewportFocusNodeId
|
|
7217
7263
|
});
|
|
7218
7264
|
useViewportFocus(nodeMap, viewportFocusNodeId);
|
|
7219
|
-
return /* @__PURE__ */
|
|
7265
|
+
return /* @__PURE__ */ jsxs19(
|
|
7220
7266
|
ReactFlow,
|
|
7221
7267
|
{
|
|
7222
7268
|
nodeTypes,
|
|
@@ -7235,21 +7281,21 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
7235
7281
|
panOnScroll: true,
|
|
7236
7282
|
selectionOnDrag: true,
|
|
7237
7283
|
children: [
|
|
7238
|
-
/* @__PURE__ */
|
|
7239
|
-
/* @__PURE__ */
|
|
7240
|
-
/* @__PURE__ */
|
|
7284
|
+
/* @__PURE__ */ jsx23(Background, { className: "bg-muted text-muted" }),
|
|
7285
|
+
/* @__PURE__ */ jsx23(Controls, { showInteractive: false }),
|
|
7286
|
+
/* @__PURE__ */ jsx23(MiniMap, { zoomable: true, pannable: true }),
|
|
7241
7287
|
children
|
|
7242
7288
|
]
|
|
7243
7289
|
}
|
|
7244
7290
|
);
|
|
7245
7291
|
};
|
|
7246
|
-
var GraphView =
|
|
7247
|
-
return /* @__PURE__ */
|
|
7292
|
+
var GraphView = React17.forwardRef(({ defaultNodes = [], defaultEdges = [], nodeTypes, edgeTypes, children, viewportFocusNodeId }, ref) => {
|
|
7293
|
+
return /* @__PURE__ */ jsx23(ReactFlowProvider, { children: /* @__PURE__ */ jsx23(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx23(GraphViewInternal, { nodeTypes, edgeTypes, viewportFocusNodeId, children }) }) });
|
|
7248
7294
|
});
|
|
7249
7295
|
GraphView.displayName = "GraphView";
|
|
7250
7296
|
|
|
7251
7297
|
// src/graph/graph.tsx
|
|
7252
|
-
import { jsx as
|
|
7298
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7253
7299
|
var defaultGraphErrorConfig = {
|
|
7254
7300
|
icon: "triangle-exclamation",
|
|
7255
7301
|
header: "An error occurred",
|
|
@@ -7285,23 +7331,21 @@ function Graph({
|
|
|
7285
7331
|
children
|
|
7286
7332
|
}) {
|
|
7287
7333
|
var _a, _b, _c;
|
|
7288
|
-
const graphRef =
|
|
7289
|
-
const
|
|
7290
|
-
const [
|
|
7291
|
-
|
|
7334
|
+
const graphRef = React18.useRef(null);
|
|
7335
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React18.useState("");
|
|
7336
|
+
const [innerColumnFilters, setInnerColumnFilters] = React18.useState([]);
|
|
7337
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
7338
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
7339
|
+
}
|
|
7292
7340
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
7293
7341
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
7294
|
-
React17.useEffect(() => {
|
|
7295
|
-
if (parentGlobalFilter !== void 0) {
|
|
7296
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
7297
|
-
}
|
|
7298
|
-
}, [parentGlobalFilter]);
|
|
7299
7342
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
7300
7343
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
7344
|
+
const columns = React18.useMemo(() => withDefaultFilterFns(columnDefinitions), [columnDefinitions]);
|
|
7301
7345
|
const table = useTable2({
|
|
7302
7346
|
features: dataTableFeatures,
|
|
7303
7347
|
data: config.data,
|
|
7304
|
-
columns
|
|
7348
|
+
columns,
|
|
7305
7349
|
state: { columnFilters, globalFilter },
|
|
7306
7350
|
onColumnFiltersChange: setColumnFilters,
|
|
7307
7351
|
onGlobalFilterChange: setGlobalFilter,
|
|
@@ -7309,7 +7353,7 @@ function Graph({
|
|
|
7309
7353
|
});
|
|
7310
7354
|
const flatColumns = table.getAllFlatColumns();
|
|
7311
7355
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
7312
|
-
const filteredData =
|
|
7356
|
+
const filteredData = React18.useMemo(() => filteredRows.map((row) => row.original), [filteredRows]);
|
|
7313
7357
|
const filterCount = columnFilters.map(
|
|
7314
7358
|
({ id: columnFilterId, value }) => {
|
|
7315
7359
|
var _a2, _b2;
|
|
@@ -7323,10 +7367,10 @@ function Graph({
|
|
|
7323
7367
|
setColumnFilters([]);
|
|
7324
7368
|
setGlobalFilter("");
|
|
7325
7369
|
};
|
|
7326
|
-
const memoizedNodeTypes =
|
|
7327
|
-
const memoizedEdgeTypes =
|
|
7328
|
-
const memoizedConfig =
|
|
7329
|
-
|
|
7370
|
+
const memoizedNodeTypes = React18.useMemo(() => config.nodeTypes, [config.nodeTypes]);
|
|
7371
|
+
const memoizedEdgeTypes = React18.useMemo(() => config.edgeTypes, [config.edgeTypes]);
|
|
7372
|
+
const memoizedConfig = React18.useMemo(() => config, [config]);
|
|
7373
|
+
React18.useEffect(() => {
|
|
7330
7374
|
if (!graphRef.current) {
|
|
7331
7375
|
return;
|
|
7332
7376
|
}
|
|
@@ -7346,27 +7390,13 @@ function Graph({
|
|
|
7346
7390
|
empty: (_b = emptyView == null ? void 0 : emptyView.empty) != null ? _b : defaultGraphEmptyConfig,
|
|
7347
7391
|
filter: (_c = emptyView == null ? void 0 : emptyView.filter) != null ? _c : defaultGraphNoFilterFoundConfig
|
|
7348
7392
|
};
|
|
7349
|
-
return /* @__PURE__ */
|
|
7350
|
-
!!title && /* @__PURE__ */
|
|
7351
|
-
showToolbar && /* @__PURE__ */
|
|
7352
|
-
!disableSearch && /* @__PURE__ */
|
|
7353
|
-
|
|
7354
|
-
/* @__PURE__ */ jsx23(
|
|
7355
|
-
InputGroupInput4,
|
|
7356
|
-
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
7357
|
-
id: searchInputId,
|
|
7358
|
-
className: SEARCH_INPUT_CLASS,
|
|
7359
|
-
"aria-label": "Search",
|
|
7360
|
-
placeholder: "Search\u2026",
|
|
7361
|
-
disabled: shouldDisable,
|
|
7362
|
-
value: globalFilter,
|
|
7363
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
7364
|
-
})
|
|
7365
|
-
)
|
|
7366
|
-
] }),
|
|
7367
|
-
!!Actions && /* @__PURE__ */ jsx23("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx23(Actions, { state: graphState }) })
|
|
7393
|
+
return /* @__PURE__ */ jsxs20("div", { id: `graph-${id}`, className: cn("flex size-full flex-1 flex-col", className), children: [
|
|
7394
|
+
!!title && /* @__PURE__ */ jsx24(SectionHeader, { className: "mb-4", children: /* @__PURE__ */ jsx24(SectionHeaderContent, { children: /* @__PURE__ */ jsx24(SectionHeaderTitle, { children: title }) }) }),
|
|
7395
|
+
showToolbar && /* @__PURE__ */ jsxs20("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
7396
|
+
!disableSearch && /* @__PURE__ */ jsx24(DataTableSearch, { value: globalFilter, onValueChange: setGlobalFilter, disabled: shouldDisable }),
|
|
7397
|
+
!!Actions && /* @__PURE__ */ jsx24("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx24(Actions, { state: graphState }) })
|
|
7368
7398
|
] }),
|
|
7369
|
-
showFilters && /* @__PURE__ */
|
|
7399
|
+
showFilters && /* @__PURE__ */ jsx24(
|
|
7370
7400
|
ViewFilter,
|
|
7371
7401
|
{
|
|
7372
7402
|
columns: flatColumns,
|
|
@@ -7375,9 +7405,9 @@ function Graph({
|
|
|
7375
7405
|
className: "mb-4"
|
|
7376
7406
|
}
|
|
7377
7407
|
),
|
|
7378
|
-
shouldRenderGraphContent ? /* @__PURE__ */
|
|
7379
|
-
graphState === "loading" && /* @__PURE__ */
|
|
7380
|
-
/* @__PURE__ */
|
|
7408
|
+
shouldRenderGraphContent ? /* @__PURE__ */ jsxs20("div", { className: "relative size-full flex-1", children: [
|
|
7409
|
+
graphState === "loading" && /* @__PURE__ */ jsx24(Icon14, { name: "circle-notch", className: "absolute top-4 left-4 z-10 animate-spin" }),
|
|
7410
|
+
/* @__PURE__ */ jsx24(
|
|
7381
7411
|
GraphView,
|
|
7382
7412
|
{
|
|
7383
7413
|
viewportFocusNodeId,
|
|
@@ -7387,7 +7417,7 @@ function Graph({
|
|
|
7387
7417
|
children
|
|
7388
7418
|
}
|
|
7389
7419
|
)
|
|
7390
|
-
] }) : /* @__PURE__ */
|
|
7420
|
+
] }) : /* @__PURE__ */ jsx24(
|
|
7391
7421
|
DataTableEmptyView,
|
|
7392
7422
|
{
|
|
7393
7423
|
emptyView: resolvedEmptyView,
|
|
@@ -7400,11 +7430,11 @@ function Graph({
|
|
|
7400
7430
|
}
|
|
7401
7431
|
|
|
7402
7432
|
// src/graph/hooks/useGetViewportNodeIds.ts
|
|
7403
|
-
import { useEffect as useEffect10, useMemo as useMemo14, useRef as
|
|
7433
|
+
import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef11, useState as useState15 } from "react";
|
|
7404
7434
|
import { useStore as useStore2, useViewport } from "reactflow";
|
|
7405
7435
|
var useGetDebouncedViewport = (debounceDelay = 1e3) => {
|
|
7406
|
-
const timerRef =
|
|
7407
|
-
const [debouncedValues, setDebouncedValues] =
|
|
7436
|
+
const timerRef = useRef11(null);
|
|
7437
|
+
const [debouncedValues, setDebouncedValues] = useState15({ x: 0, y: 0, zoom: 1, width: 0, height: 0, nodes: [] });
|
|
7408
7438
|
const { x, y, zoom } = useViewport();
|
|
7409
7439
|
const { width, height, nodes } = useStore2((state) => ({
|
|
7410
7440
|
width: state.width,
|
|
@@ -7464,30 +7494,30 @@ var getGraphDescendants = (node, nodes, edges) => {
|
|
|
7464
7494
|
};
|
|
7465
7495
|
|
|
7466
7496
|
// src/page-header.tsx
|
|
7467
|
-
import { jsx as
|
|
7497
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
7468
7498
|
function PageHeader(_a) {
|
|
7469
7499
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
7470
|
-
return /* @__PURE__ */
|
|
7500
|
+
return /* @__PURE__ */ jsx25("div", __spreadProps(__spreadValues({ "data-slot": "page-header", className: cn("flex w-full items-start justify-between gap-4", className) }, props), { children }));
|
|
7471
7501
|
}
|
|
7472
7502
|
function PageHeaderAvatar(_a) {
|
|
7473
7503
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7474
|
-
return /* @__PURE__ */
|
|
7504
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-avatar", className: cn("shrink-0 self-center", className) }, props));
|
|
7475
7505
|
}
|
|
7476
7506
|
function PageHeaderContent(_a) {
|
|
7477
7507
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7478
|
-
return /* @__PURE__ */
|
|
7508
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-content", className: cn("flex flex-1 flex-col gap-1", className) }, props));
|
|
7479
7509
|
}
|
|
7480
7510
|
function PageHeaderTitle(_a) {
|
|
7481
7511
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7482
|
-
return /* @__PURE__ */
|
|
7512
|
+
return /* @__PURE__ */ jsx25("h1", __spreadValues({ "data-slot": "page-header-title", className: cn("text-h1 text-foreground", className) }, props));
|
|
7483
7513
|
}
|
|
7484
7514
|
function PageHeaderDescription(_a) {
|
|
7485
7515
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7486
|
-
return /* @__PURE__ */
|
|
7516
|
+
return /* @__PURE__ */ jsx25("p", __spreadValues({ "data-slot": "page-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
7487
7517
|
}
|
|
7488
7518
|
function PageHeaderMeta(_a) {
|
|
7489
7519
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7490
|
-
return /* @__PURE__ */
|
|
7520
|
+
return /* @__PURE__ */ jsx25(
|
|
7491
7521
|
"div",
|
|
7492
7522
|
__spreadValues({
|
|
7493
7523
|
"data-slot": "page-header-meta",
|
|
@@ -7501,27 +7531,27 @@ function PageHeaderMeta(_a) {
|
|
|
7501
7531
|
}
|
|
7502
7532
|
function PageHeaderActions(_a) {
|
|
7503
7533
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7504
|
-
return /* @__PURE__ */
|
|
7534
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-actions", className: cn("flex items-center gap-2", className) }, props));
|
|
7505
7535
|
}
|
|
7506
7536
|
function PageHeaderTabs(_a) {
|
|
7507
7537
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7508
|
-
return /* @__PURE__ */
|
|
7538
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-tabs", className: cn("border-b", className) }, props));
|
|
7509
7539
|
}
|
|
7510
7540
|
|
|
7511
7541
|
// src/timeline.tsx
|
|
7512
7542
|
import { Icon as Icon15 } from "@upbound/monarch-core";
|
|
7513
7543
|
import { Item as Item2, ItemGroup as ItemGroup2 } from "@upbound/monarch-core";
|
|
7514
|
-
import { jsx as
|
|
7544
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7515
7545
|
function Timeline(_a) {
|
|
7516
7546
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7517
|
-
return /* @__PURE__ */
|
|
7547
|
+
return /* @__PURE__ */ jsx26(ItemGroup2, __spreadValues({ "data-slot": "timeline", className: cn(className) }, props));
|
|
7518
7548
|
}
|
|
7519
7549
|
function TimelineItem(_a) {
|
|
7520
7550
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
7521
|
-
return /* @__PURE__ */
|
|
7522
|
-
/* @__PURE__ */
|
|
7523
|
-
/* @__PURE__ */
|
|
7524
|
-
/* @__PURE__ */
|
|
7551
|
+
return /* @__PURE__ */ jsxs21(Item2, __spreadProps(__spreadValues({ "data-slot": "timeline-item", className: cn("group/timeline-item gap-3 py-4", className) }, props), { children: [
|
|
7552
|
+
/* @__PURE__ */ jsxs21("div", { className: "relative flex flex-col items-center self-stretch", children: [
|
|
7553
|
+
/* @__PURE__ */ jsx26(Icon15, { name: "circle-dot", size: "sm", className: "text-primary shrink-0" }),
|
|
7554
|
+
/* @__PURE__ */ jsx26(
|
|
7525
7555
|
"span",
|
|
7526
7556
|
{
|
|
7527
7557
|
"aria-hidden": "true",
|