@invana/ui 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +312 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -57
- package/dist/index.d.ts +199 -57
- package/dist/index.js +310 -98
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +45 -45
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
import * as React23 from 'react';
|
|
4
4
|
import React23__default, { Component } from 'react';
|
|
5
5
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
6
|
-
import { ChevronDown, ArrowLeft, ArrowRight, X, Search, ChevronRight, Check, Circle, PanelLeft, MoreHorizontal, ChevronLeft,
|
|
6
|
+
import { ChevronDown, ArrowLeft, ArrowRight, X, Search, ChevronRight, Check, Circle, PanelLeft, MoreHorizontal, ChevronLeft, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, Frown, Lock, Construction } from 'lucide-react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
@@ -1625,19 +1625,7 @@ var Progress = React23.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
1625
1625
|
}
|
|
1626
1626
|
));
|
|
1627
1627
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
1628
|
-
var ResizablePanelGroup = ({
|
|
1629
|
-
className,
|
|
1630
|
-
...props
|
|
1631
|
-
}) => /* @__PURE__ */ jsx(
|
|
1632
|
-
Group,
|
|
1633
|
-
{
|
|
1634
|
-
className: cn(
|
|
1635
|
-
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
|
|
1636
|
-
className
|
|
1637
|
-
),
|
|
1638
|
-
...props
|
|
1639
|
-
}
|
|
1640
|
-
);
|
|
1628
|
+
var ResizablePanelGroup = (props) => /* @__PURE__ */ jsx(Group, { ...props });
|
|
1641
1629
|
var ResizablePanel = Panel;
|
|
1642
1630
|
var ResizableHandle = ({
|
|
1643
1631
|
withHandle,
|
|
@@ -1647,16 +1635,18 @@ var ResizableHandle = ({
|
|
|
1647
1635
|
Separator$1,
|
|
1648
1636
|
{
|
|
1649
1637
|
className: cn(
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
"
|
|
1653
|
-
"
|
|
1654
|
-
"
|
|
1655
|
-
"
|
|
1638
|
+
// A themed gap between panels. The separator has no intrinsic size, so give
|
|
1639
|
+
// it an explicit one on the main axis or it collapses to 0.
|
|
1640
|
+
"relative flex items-center justify-center bg-background transition-colors",
|
|
1641
|
+
"aria-[orientation=vertical]:w-1 aria-[orientation=vertical]:cursor-col-resize",
|
|
1642
|
+
"aria-[orientation=horizontal]:h-1 aria-[orientation=horizontal]:cursor-row-resize",
|
|
1643
|
+
"data-[separator=hover]:bg-accent data-[separator=active]:bg-accent",
|
|
1644
|
+
"[&[aria-orientation=horizontal]>div]:rotate-90",
|
|
1656
1645
|
className
|
|
1657
1646
|
),
|
|
1658
1647
|
...props,
|
|
1659
|
-
children: withHandle &&
|
|
1648
|
+
children: withHandle && // A subtle pill grip centered in the gutter; rotate handles orientation.
|
|
1649
|
+
/* @__PURE__ */ jsx("div", { className: "z-10 h-6 w-[3px] rounded-full bg-muted-foreground/40" })
|
|
1660
1650
|
}
|
|
1661
1651
|
);
|
|
1662
1652
|
var ScrollArea = React23.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
@@ -2625,87 +2615,125 @@ function ButtonWithTooltip(props) {
|
|
|
2625
2615
|
/* @__PURE__ */ jsx(TooltipContent, { children: props.tooltip })
|
|
2626
2616
|
] }) });
|
|
2627
2617
|
}
|
|
2628
|
-
|
|
2629
|
-
constructor(props) {
|
|
2630
|
-
super(props);
|
|
2631
|
-
this.state = { hasError: false };
|
|
2632
|
-
}
|
|
2633
|
-
static getDerivedStateFromError(_) {
|
|
2634
|
-
return { hasError: true };
|
|
2635
|
-
}
|
|
2636
|
-
componentDidCatch(error, errorInfo) {
|
|
2637
|
-
console.error("ErrorBoundary caught an error", error, errorInfo);
|
|
2638
|
-
}
|
|
2639
|
-
render() {
|
|
2640
|
-
if (this.state.hasError) {
|
|
2641
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center h-full w-full text-sm", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center", children: [
|
|
2642
|
-
/* @__PURE__ */ jsx(Frown, { className: "mr-1 h-4" }),
|
|
2643
|
-
"Oops ! something went wrong."
|
|
2644
|
-
] }) });
|
|
2645
|
-
}
|
|
2646
|
-
return this.props.children;
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
var MenuItem = ({
|
|
2650
|
-
label,
|
|
2651
|
-
icon: Icon,
|
|
2652
|
-
shortcut,
|
|
2618
|
+
function ChatSession({
|
|
2653
2619
|
children,
|
|
2620
|
+
footer,
|
|
2621
|
+
emptyState,
|
|
2622
|
+
autoScrollKey,
|
|
2623
|
+
followThreshold = 80,
|
|
2654
2624
|
className,
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
const
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2625
|
+
bodyClassName
|
|
2626
|
+
}) {
|
|
2627
|
+
const rootRef = React23.useRef(null);
|
|
2628
|
+
const contentRef = React23.useRef(null);
|
|
2629
|
+
const pinnedRef = React23.useRef(true);
|
|
2630
|
+
const getViewport = React23.useCallback(
|
|
2631
|
+
() => rootRef.current?.querySelector(
|
|
2632
|
+
"[data-radix-scroll-area-viewport]"
|
|
2633
|
+
) ?? null,
|
|
2634
|
+
[]
|
|
2635
|
+
);
|
|
2636
|
+
const scrollToBottom = React23.useCallback(() => {
|
|
2637
|
+
const viewport = getViewport();
|
|
2638
|
+
if (viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
2639
|
+
}, [getViewport]);
|
|
2640
|
+
React23.useEffect(() => {
|
|
2641
|
+
const viewport = getViewport();
|
|
2642
|
+
if (!viewport) return;
|
|
2643
|
+
const handleScroll = () => {
|
|
2644
|
+
const distance = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;
|
|
2645
|
+
pinnedRef.current = distance <= followThreshold;
|
|
2646
|
+
};
|
|
2647
|
+
viewport.addEventListener("scroll", handleScroll, { passive: true });
|
|
2648
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2649
|
+
}, [getViewport, followThreshold]);
|
|
2650
|
+
React23.useEffect(() => {
|
|
2651
|
+
const content = contentRef.current;
|
|
2652
|
+
if (!content || typeof ResizeObserver === "undefined") return;
|
|
2653
|
+
const observer = new ResizeObserver(() => {
|
|
2654
|
+
if (pinnedRef.current) scrollToBottom();
|
|
2655
|
+
});
|
|
2656
|
+
observer.observe(content);
|
|
2657
|
+
return () => observer.disconnect();
|
|
2658
|
+
}, [scrollToBottom]);
|
|
2659
|
+
React23.useEffect(() => {
|
|
2660
|
+
pinnedRef.current = true;
|
|
2661
|
+
scrollToBottom();
|
|
2662
|
+
}, [autoScrollKey, scrollToBottom]);
|
|
2663
|
+
const isEmpty = React23.Children.count(children) === 0;
|
|
2664
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col h-full min-h-0", className), children: [
|
|
2665
|
+
/* @__PURE__ */ jsx(ScrollArea, { ref: rootRef, className: "flex-1 min-h-0", children: isEmpty && emptyState ? emptyState : /* @__PURE__ */ jsx(
|
|
2666
|
+
"div",
|
|
2665
2667
|
{
|
|
2666
|
-
|
|
2667
|
-
className: cn(
|
|
2668
|
-
|
|
2669
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
2670
|
-
"focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none",
|
|
2671
|
-
className,
|
|
2672
|
-
level === 0 ? "font-medium" : "font-normal"
|
|
2673
|
-
// "group-hover/item:bg-accent/50"
|
|
2674
|
-
),
|
|
2675
|
-
role: hasChildren ? "menuitem" : void 0,
|
|
2676
|
-
"aria-haspopup": hasChildren ? "true" : void 0,
|
|
2677
|
-
"aria-expanded": hasChildren ? "true" : void 0,
|
|
2678
|
-
children: [
|
|
2679
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
2680
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
2681
|
-
/* @__PURE__ */ jsx("span", { children: label })
|
|
2682
|
-
] }),
|
|
2683
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
2684
|
-
shortcut && /* @__PURE__ */ jsx("kbd", { className: "pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100", children: shortcut }),
|
|
2685
|
-
hasChildren && /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
2686
|
-
] })
|
|
2687
|
-
]
|
|
2668
|
+
ref: contentRef,
|
|
2669
|
+
className: cn("flex flex-col gap-4 p-3", bodyClassName),
|
|
2670
|
+
children
|
|
2688
2671
|
}
|
|
2689
|
-
),
|
|
2690
|
-
|
|
2691
|
-
|
|
2672
|
+
) }),
|
|
2673
|
+
footer
|
|
2674
|
+
] });
|
|
2675
|
+
}
|
|
2676
|
+
function RunningDots() {
|
|
2677
|
+
return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", "aria-label": "Running", children: [
|
|
2678
|
+
/* @__PURE__ */ jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
2679
|
+
/* @__PURE__ */ jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
2680
|
+
/* @__PURE__ */ jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce" })
|
|
2681
|
+
] });
|
|
2682
|
+
}
|
|
2683
|
+
function ChatSessionMessage({
|
|
2684
|
+
role,
|
|
2685
|
+
children,
|
|
2686
|
+
status = "idle",
|
|
2687
|
+
icon,
|
|
2688
|
+
meta,
|
|
2689
|
+
actions,
|
|
2690
|
+
footer,
|
|
2691
|
+
className
|
|
2692
|
+
}) {
|
|
2693
|
+
if (role === "user") {
|
|
2694
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex justify-end", className), children: /* @__PURE__ */ jsxs(
|
|
2695
|
+
"div",
|
|
2692
2696
|
{
|
|
2693
2697
|
className: cn(
|
|
2694
|
-
"
|
|
2695
|
-
"
|
|
2696
|
-
"group-hover/item:visible group-hover/item:opacity-100 group-hover/item:translate-x-0",
|
|
2697
|
-
"transition-all duration-150 ease-in-out",
|
|
2698
|
-
level === 0 ? "left-full top-0" : "left-full top-0"
|
|
2698
|
+
"max-w-[85%] rounded-2xl rounded-br-sm bg-secondary px-3 py-2 text-secondary-foreground whitespace-pre-wrap break-words",
|
|
2699
|
+
icon && "flex items-center gap-1.5"
|
|
2699
2700
|
),
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
children: children.map((item) => /* @__PURE__ */ jsx(MenuItem, { ...item, level: level + 1 }, item.id))
|
|
2701
|
+
children: [
|
|
2702
|
+
icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 opacity-70", children: icon }),
|
|
2703
|
+
icon ? /* @__PURE__ */ jsx("span", { className: "min-w-0 break-words", children }) : children
|
|
2704
|
+
]
|
|
2705
2705
|
}
|
|
2706
|
-
)
|
|
2706
|
+
) });
|
|
2707
|
+
}
|
|
2708
|
+
if (status === "running") {
|
|
2709
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 text-muted-foreground", className), children: [
|
|
2710
|
+
icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: icon }),
|
|
2711
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
2712
|
+
/* @__PURE__ */ jsx(RunningDots, {})
|
|
2713
|
+
] });
|
|
2714
|
+
}
|
|
2715
|
+
if (status === "stopped") {
|
|
2716
|
+
return /* @__PURE__ */ jsx("p", { className: cn("text-muted-foreground italic", className), children });
|
|
2717
|
+
}
|
|
2718
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
2719
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
2720
|
+
icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: icon }),
|
|
2721
|
+
/* @__PURE__ */ jsx(
|
|
2722
|
+
"div",
|
|
2723
|
+
{
|
|
2724
|
+
className: cn(
|
|
2725
|
+
"min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
2726
|
+
status === "error" ? "text-destructive" : "text-foreground"
|
|
2727
|
+
),
|
|
2728
|
+
children
|
|
2729
|
+
}
|
|
2730
|
+
)
|
|
2731
|
+
] }),
|
|
2732
|
+
actions,
|
|
2733
|
+
meta && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: meta }),
|
|
2734
|
+
footer
|
|
2707
2735
|
] });
|
|
2708
|
-
}
|
|
2736
|
+
}
|
|
2709
2737
|
var NavItems = ({
|
|
2710
2738
|
items,
|
|
2711
2739
|
orientation = "horizontal",
|
|
@@ -2717,14 +2745,15 @@ var NavItems = ({
|
|
|
2717
2745
|
return /* @__PURE__ */ jsx(Fragment, { children: items.map((item) => {
|
|
2718
2746
|
const isActive = activeItem === item.name;
|
|
2719
2747
|
const padding = item.label ? "px-3 py-1.5" : "px-2 py-2";
|
|
2748
|
+
const isInteractive = Boolean(item.href || item.onClick);
|
|
2720
2749
|
const itemClass = `inline-flex border-0 items-center justify-center gap-2
|
|
2721
|
-
whitespace-nowrap rounded-md
|
|
2750
|
+
whitespace-nowrap rounded-md transition-colors
|
|
2722
2751
|
ring-1 ring-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
2723
2752
|
${padding}
|
|
2724
|
-
hover:bg-primary/10 hover:text-primary hover:ring-primary/25
|
|
2753
|
+
${isInteractive ? "cursor-pointer hover:bg-primary/10 hover:text-primary hover:ring-primary/25" : ""}
|
|
2725
2754
|
${isActive ? `bg-primary/15 text-primary ring-primary/25 ${item.activeClass || ""}` : ""}
|
|
2726
2755
|
${item.className || ""}`;
|
|
2727
|
-
const icon = /* @__PURE__ */ jsx(
|
|
2756
|
+
const icon = item.icon && /* @__PURE__ */ jsx(
|
|
2728
2757
|
item.icon,
|
|
2729
2758
|
{
|
|
2730
2759
|
strokeWidth: item.iconStroke || 2,
|
|
@@ -2827,6 +2856,189 @@ var NavHorizontal = ({
|
|
|
2827
2856
|
}
|
|
2828
2857
|
);
|
|
2829
2858
|
};
|
|
2859
|
+
function ChatSessionMessageOptions({
|
|
2860
|
+
actions,
|
|
2861
|
+
className
|
|
2862
|
+
}) {
|
|
2863
|
+
const start = actions.filter((a) => (a.align ?? "start") === "start");
|
|
2864
|
+
const end = actions.filter((a) => a.align === "end");
|
|
2865
|
+
const renderAction = (action, i) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
2866
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2867
|
+
Button,
|
|
2868
|
+
{
|
|
2869
|
+
variant: "ghost",
|
|
2870
|
+
size: "icon",
|
|
2871
|
+
className: cn(
|
|
2872
|
+
"h-6 w-7 text-muted-foreground",
|
|
2873
|
+
action.active && (action.activeClassName ?? "text-foreground"),
|
|
2874
|
+
action.className
|
|
2875
|
+
),
|
|
2876
|
+
onClick: action.onClick,
|
|
2877
|
+
disabled: action.disabled,
|
|
2878
|
+
"aria-label": action.label,
|
|
2879
|
+
children: action.icon
|
|
2880
|
+
}
|
|
2881
|
+
) }),
|
|
2882
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: action.label })
|
|
2883
|
+
] }, `${action.label}-${i}`);
|
|
2884
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsx(
|
|
2885
|
+
NavHorizontal,
|
|
2886
|
+
{
|
|
2887
|
+
className: cn("text-muted-foreground", className),
|
|
2888
|
+
left: start.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: start.map(renderAction) }) : void 0,
|
|
2889
|
+
right: end.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: end.map(renderAction) }) : void 0
|
|
2890
|
+
}
|
|
2891
|
+
) });
|
|
2892
|
+
}
|
|
2893
|
+
function ChatSessionComposer({
|
|
2894
|
+
value,
|
|
2895
|
+
onChange,
|
|
2896
|
+
onSend,
|
|
2897
|
+
onStop,
|
|
2898
|
+
isRunning = false,
|
|
2899
|
+
disabled = false,
|
|
2900
|
+
placeholder = "Ask anything\u2026",
|
|
2901
|
+
toolbarStart,
|
|
2902
|
+
toolbarEnd,
|
|
2903
|
+
attachments,
|
|
2904
|
+
sendIcon,
|
|
2905
|
+
stopIcon,
|
|
2906
|
+
sendDisabled,
|
|
2907
|
+
className,
|
|
2908
|
+
textareaClassName
|
|
2909
|
+
}) {
|
|
2910
|
+
const handleKeyDown = (e) => {
|
|
2911
|
+
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
2912
|
+
e.preventDefault();
|
|
2913
|
+
if (!isRunning && !disabled) onSend();
|
|
2914
|
+
}
|
|
2915
|
+
};
|
|
2916
|
+
const isSendDisabled = sendDisabled ?? (disabled || value.trim().length === 0);
|
|
2917
|
+
return /* @__PURE__ */ jsx("div", { className: cn("p-3", className), children: /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-card shadow-sm overflow-hidden focus-within:border-ring transition-colors", children: [
|
|
2918
|
+
attachments && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 border-b border-border max-h-24 overflow-y-auto flex items-start gap-1 flex-wrap", children: attachments }),
|
|
2919
|
+
/* @__PURE__ */ jsx(
|
|
2920
|
+
"textarea",
|
|
2921
|
+
{
|
|
2922
|
+
value,
|
|
2923
|
+
onChange: (e) => onChange(e.target.value),
|
|
2924
|
+
onKeyDown: handleKeyDown,
|
|
2925
|
+
disabled,
|
|
2926
|
+
placeholder,
|
|
2927
|
+
className: cn(
|
|
2928
|
+
"block w-full min-h-16 h-24 max-h-64 bg-transparent p-2 text-foreground outline-none resize-y placeholder:text-muted-foreground",
|
|
2929
|
+
textareaClassName
|
|
2930
|
+
)
|
|
2931
|
+
}
|
|
2932
|
+
),
|
|
2933
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-1.5 border-t border-border flex items-center gap-1.5", children: [
|
|
2934
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0 flex items-center gap-1.5", children: toolbarStart }),
|
|
2935
|
+
toolbarEnd,
|
|
2936
|
+
isRunning ? /* @__PURE__ */ jsx(
|
|
2937
|
+
Button,
|
|
2938
|
+
{
|
|
2939
|
+
size: "icon",
|
|
2940
|
+
className: "h-7 w-7 shrink-0 rounded-full",
|
|
2941
|
+
onClick: onStop,
|
|
2942
|
+
title: "Stop",
|
|
2943
|
+
"aria-label": "Stop",
|
|
2944
|
+
children: stopIcon
|
|
2945
|
+
}
|
|
2946
|
+
) : /* @__PURE__ */ jsx(
|
|
2947
|
+
Button,
|
|
2948
|
+
{
|
|
2949
|
+
size: "icon",
|
|
2950
|
+
className: "h-7 w-7 shrink-0 rounded-full",
|
|
2951
|
+
onClick: onSend,
|
|
2952
|
+
disabled: isSendDisabled,
|
|
2953
|
+
title: "Send",
|
|
2954
|
+
"aria-label": "Send",
|
|
2955
|
+
children: sendIcon
|
|
2956
|
+
}
|
|
2957
|
+
)
|
|
2958
|
+
] })
|
|
2959
|
+
] }) });
|
|
2960
|
+
}
|
|
2961
|
+
var ErrorBoundary = class extends Component {
|
|
2962
|
+
constructor(props) {
|
|
2963
|
+
super(props);
|
|
2964
|
+
this.state = { hasError: false };
|
|
2965
|
+
}
|
|
2966
|
+
static getDerivedStateFromError(_) {
|
|
2967
|
+
return { hasError: true };
|
|
2968
|
+
}
|
|
2969
|
+
componentDidCatch(error, errorInfo) {
|
|
2970
|
+
console.error("ErrorBoundary caught an error", error, errorInfo);
|
|
2971
|
+
}
|
|
2972
|
+
render() {
|
|
2973
|
+
if (this.state.hasError) {
|
|
2974
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center h-full w-full text-sm", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center", children: [
|
|
2975
|
+
/* @__PURE__ */ jsx(Frown, { className: "mr-1 h-4" }),
|
|
2976
|
+
"Oops ! something went wrong."
|
|
2977
|
+
] }) });
|
|
2978
|
+
}
|
|
2979
|
+
return this.props.children;
|
|
2980
|
+
}
|
|
2981
|
+
};
|
|
2982
|
+
var MenuItem = ({
|
|
2983
|
+
label,
|
|
2984
|
+
icon: Icon,
|
|
2985
|
+
shortcut,
|
|
2986
|
+
children,
|
|
2987
|
+
className,
|
|
2988
|
+
level = 0,
|
|
2989
|
+
href,
|
|
2990
|
+
onClick
|
|
2991
|
+
}) => {
|
|
2992
|
+
const hasChildren = children && children.length > 0;
|
|
2993
|
+
const ButtonOrLink = href ? "a" : "button";
|
|
2994
|
+
const clickTrigger = href ? { href } : { onClick };
|
|
2995
|
+
return /* @__PURE__ */ jsxs("li", { className: "relative group/item", children: [
|
|
2996
|
+
/* @__PURE__ */ jsxs(
|
|
2997
|
+
ButtonOrLink,
|
|
2998
|
+
{
|
|
2999
|
+
...clickTrigger,
|
|
3000
|
+
className: cn(
|
|
3001
|
+
"flex w-full items-center justify-between px-4 py-2 ",
|
|
3002
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
3003
|
+
"focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none",
|
|
3004
|
+
className,
|
|
3005
|
+
level === 0 ? "font-medium" : "font-normal"
|
|
3006
|
+
// "group-hover/item:bg-accent/50"
|
|
3007
|
+
),
|
|
3008
|
+
role: hasChildren ? "menuitem" : void 0,
|
|
3009
|
+
"aria-haspopup": hasChildren ? "true" : void 0,
|
|
3010
|
+
"aria-expanded": hasChildren ? "true" : void 0,
|
|
3011
|
+
children: [
|
|
3012
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
3013
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
3014
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
3015
|
+
] }),
|
|
3016
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
3017
|
+
shortcut && /* @__PURE__ */ jsx("kbd", { className: "pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100", children: shortcut }),
|
|
3018
|
+
hasChildren && /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
3019
|
+
] })
|
|
3020
|
+
]
|
|
3021
|
+
}
|
|
3022
|
+
),
|
|
3023
|
+
hasChildren && /* @__PURE__ */ jsx(
|
|
3024
|
+
"ul",
|
|
3025
|
+
{
|
|
3026
|
+
className: cn(
|
|
3027
|
+
"absolute min-w-[240px] border p-1 bg-card text-card-foreground shadow-md",
|
|
3028
|
+
"invisible opacity-0 translate-x-2",
|
|
3029
|
+
"group-hover/item:visible group-hover/item:opacity-100 group-hover/item:translate-x-0",
|
|
3030
|
+
"transition-all duration-150 ease-in-out",
|
|
3031
|
+
level === 0 ? "left-full top-0" : "left-full top-0"
|
|
3032
|
+
),
|
|
3033
|
+
style: {
|
|
3034
|
+
zIndex: 50 + level
|
|
3035
|
+
},
|
|
3036
|
+
role: "menu",
|
|
3037
|
+
children: children.map((item) => /* @__PURE__ */ jsx(MenuItem, { ...item, level: level + 1 }, item.id))
|
|
3038
|
+
}
|
|
3039
|
+
)
|
|
3040
|
+
] });
|
|
3041
|
+
};
|
|
2830
3042
|
var NavVerticalItems = ({ items }) => /* @__PURE__ */ jsx(NavItems, { items, orientation: "vertical" });
|
|
2831
3043
|
var NavVertical = ({
|
|
2832
3044
|
className = "",
|
|
@@ -3048,7 +3260,7 @@ function TabbedPanel({
|
|
|
3048
3260
|
}
|
|
3049
3261
|
onTabChange?.(value);
|
|
3050
3262
|
};
|
|
3051
|
-
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(Tabs, { value: currentTab, onValueChange: handleTabChange, className:
|
|
3263
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(Tabs, { value: currentTab, onValueChange: handleTabChange, className: "h-full", children: /* @__PURE__ */ jsxs(Card, { className: cn("h-full border rounded-none", className), children: [
|
|
3052
3264
|
/* @__PURE__ */ jsxs(CardHeader, { className: `flex flex-row items-center justify-between py-0 border-b h-[30px] px-0 space-y-0 ${headerClassName || ""}`, children: [
|
|
3053
3265
|
/* @__PURE__ */ jsx(TabsList, { className: "h-full bg-transparent p-0 gap-0 rounded-none", children: tabs.map((tab) => /* @__PURE__ */ jsxs(
|
|
3054
3266
|
TabsTrigger,
|
|
@@ -3685,6 +3897,6 @@ var Typography = {
|
|
|
3685
3897
|
Pre: TypographyPre
|
|
3686
3898
|
};
|
|
3687
3899
|
|
|
3688
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, ButtonWithTooltip, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CardWithHeader, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorBoundary, HoverCard, HoverCardContent, HoverCardTrigger, Item3 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, MenuItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavBase, NavHorizontal, NavHorizontalItems, NavItems, NavVertical, NavVerticalItems, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NestedMenu, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelContent, Popover, PopoverContent, PopoverTrigger, Progress, ResizableHandle, ResizablePanel, ResizablePanelGroup, RichSelect, ScrollArea, ScrollBar, SearchInput, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, TabbedPanel, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tour, TreeItem, TreeView, Typography, TypographyBlockquote, TypographyH1, TypographyH2, TypographyH3, TypographyH4, TypographyH5, TypographyH6, TypographyInlineCode, TypographyLarge, TypographyLead, TypographyList, TypographyMuted, TypographyP, TypographyPre, TypographySmall, UnderDevelopment, badgeVariants, buttonGroupVariants, buttonVariants, cn, navigationMenuTriggerStyle, toggleVariants, useSidebar, useTour };
|
|
3900
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, ButtonWithTooltip, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CardWithHeader, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChatSession, ChatSessionComposer, ChatSessionMessage, ChatSessionMessageOptions, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorBoundary, HoverCard, HoverCardContent, HoverCardTrigger, Item3 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, MenuItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavBase, NavHorizontal, NavHorizontalItems, NavItems, NavVertical, NavVerticalItems, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NestedMenu, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelContent, Popover, PopoverContent, PopoverTrigger, Progress, ResizableHandle, ResizablePanel, ResizablePanelGroup, RichSelect, ScrollArea, ScrollBar, SearchInput, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, TabbedPanel, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tour, TreeItem, TreeView, Typography, TypographyBlockquote, TypographyH1, TypographyH2, TypographyH3, TypographyH4, TypographyH5, TypographyH6, TypographyInlineCode, TypographyLarge, TypographyLead, TypographyList, TypographyMuted, TypographyP, TypographyPre, TypographySmall, UnderDevelopment, badgeVariants, buttonGroupVariants, buttonVariants, cn, navigationMenuTriggerStyle, toggleVariants, useSidebar, useTour };
|
|
3689
3901
|
//# sourceMappingURL=index.js.map
|
|
3690
3902
|
//# sourceMappingURL=index.js.map
|