@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.cjs
CHANGED
|
@@ -1665,19 +1665,7 @@ var Progress = React23__namespace.forwardRef(({ className, value, ...props }, re
|
|
|
1665
1665
|
}
|
|
1666
1666
|
));
|
|
1667
1667
|
Progress.displayName = ProgressPrimitive__namespace.Root.displayName;
|
|
1668
|
-
var ResizablePanelGroup = ({
|
|
1669
|
-
className,
|
|
1670
|
-
...props
|
|
1671
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1672
|
-
reactResizablePanels.Group,
|
|
1673
|
-
{
|
|
1674
|
-
className: cn(
|
|
1675
|
-
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
|
|
1676
|
-
className
|
|
1677
|
-
),
|
|
1678
|
-
...props
|
|
1679
|
-
}
|
|
1680
|
-
);
|
|
1668
|
+
var ResizablePanelGroup = (props) => /* @__PURE__ */ jsxRuntime.jsx(reactResizablePanels.Group, { ...props });
|
|
1681
1669
|
var ResizablePanel = reactResizablePanels.Panel;
|
|
1682
1670
|
var ResizableHandle = ({
|
|
1683
1671
|
withHandle,
|
|
@@ -1687,16 +1675,18 @@ var ResizableHandle = ({
|
|
|
1687
1675
|
reactResizablePanels.Separator,
|
|
1688
1676
|
{
|
|
1689
1677
|
className: cn(
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
"
|
|
1693
|
-
"
|
|
1694
|
-
"
|
|
1695
|
-
"
|
|
1678
|
+
// A themed gap between panels. The separator has no intrinsic size, so give
|
|
1679
|
+
// it an explicit one on the main axis or it collapses to 0.
|
|
1680
|
+
"relative flex items-center justify-center bg-background transition-colors",
|
|
1681
|
+
"aria-[orientation=vertical]:w-1 aria-[orientation=vertical]:cursor-col-resize",
|
|
1682
|
+
"aria-[orientation=horizontal]:h-1 aria-[orientation=horizontal]:cursor-row-resize",
|
|
1683
|
+
"data-[separator=hover]:bg-accent data-[separator=active]:bg-accent",
|
|
1684
|
+
"[&[aria-orientation=horizontal]>div]:rotate-90",
|
|
1696
1685
|
className
|
|
1697
1686
|
),
|
|
1698
1687
|
...props,
|
|
1699
|
-
children: withHandle &&
|
|
1688
|
+
children: withHandle && // A subtle pill grip centered in the gutter; rotate handles orientation.
|
|
1689
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "z-10 h-6 w-[3px] rounded-full bg-muted-foreground/40" })
|
|
1700
1690
|
}
|
|
1701
1691
|
);
|
|
1702
1692
|
var ScrollArea = React23__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2665,87 +2655,125 @@ function ButtonWithTooltip(props) {
|
|
|
2665
2655
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: props.tooltip })
|
|
2666
2656
|
] }) });
|
|
2667
2657
|
}
|
|
2668
|
-
|
|
2669
|
-
constructor(props) {
|
|
2670
|
-
super(props);
|
|
2671
|
-
this.state = { hasError: false };
|
|
2672
|
-
}
|
|
2673
|
-
static getDerivedStateFromError(_) {
|
|
2674
|
-
return { hasError: true };
|
|
2675
|
-
}
|
|
2676
|
-
componentDidCatch(error, errorInfo) {
|
|
2677
|
-
console.error("ErrorBoundary caught an error", error, errorInfo);
|
|
2678
|
-
}
|
|
2679
|
-
render() {
|
|
2680
|
-
if (this.state.hasError) {
|
|
2681
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center h-full w-full text-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center", children: [
|
|
2682
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Frown, { className: "mr-1 h-4" }),
|
|
2683
|
-
"Oops ! something went wrong."
|
|
2684
|
-
] }) });
|
|
2685
|
-
}
|
|
2686
|
-
return this.props.children;
|
|
2687
|
-
}
|
|
2688
|
-
};
|
|
2689
|
-
var MenuItem = ({
|
|
2690
|
-
label,
|
|
2691
|
-
icon: Icon,
|
|
2692
|
-
shortcut,
|
|
2658
|
+
function ChatSession({
|
|
2693
2659
|
children,
|
|
2660
|
+
footer,
|
|
2661
|
+
emptyState,
|
|
2662
|
+
autoScrollKey,
|
|
2663
|
+
followThreshold = 80,
|
|
2694
2664
|
className,
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
const
|
|
2700
|
-
const
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2665
|
+
bodyClassName
|
|
2666
|
+
}) {
|
|
2667
|
+
const rootRef = React23__namespace.useRef(null);
|
|
2668
|
+
const contentRef = React23__namespace.useRef(null);
|
|
2669
|
+
const pinnedRef = React23__namespace.useRef(true);
|
|
2670
|
+
const getViewport = React23__namespace.useCallback(
|
|
2671
|
+
() => rootRef.current?.querySelector(
|
|
2672
|
+
"[data-radix-scroll-area-viewport]"
|
|
2673
|
+
) ?? null,
|
|
2674
|
+
[]
|
|
2675
|
+
);
|
|
2676
|
+
const scrollToBottom = React23__namespace.useCallback(() => {
|
|
2677
|
+
const viewport = getViewport();
|
|
2678
|
+
if (viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
2679
|
+
}, [getViewport]);
|
|
2680
|
+
React23__namespace.useEffect(() => {
|
|
2681
|
+
const viewport = getViewport();
|
|
2682
|
+
if (!viewport) return;
|
|
2683
|
+
const handleScroll = () => {
|
|
2684
|
+
const distance = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;
|
|
2685
|
+
pinnedRef.current = distance <= followThreshold;
|
|
2686
|
+
};
|
|
2687
|
+
viewport.addEventListener("scroll", handleScroll, { passive: true });
|
|
2688
|
+
return () => viewport.removeEventListener("scroll", handleScroll);
|
|
2689
|
+
}, [getViewport, followThreshold]);
|
|
2690
|
+
React23__namespace.useEffect(() => {
|
|
2691
|
+
const content = contentRef.current;
|
|
2692
|
+
if (!content || typeof ResizeObserver === "undefined") return;
|
|
2693
|
+
const observer = new ResizeObserver(() => {
|
|
2694
|
+
if (pinnedRef.current) scrollToBottom();
|
|
2695
|
+
});
|
|
2696
|
+
observer.observe(content);
|
|
2697
|
+
return () => observer.disconnect();
|
|
2698
|
+
}, [scrollToBottom]);
|
|
2699
|
+
React23__namespace.useEffect(() => {
|
|
2700
|
+
pinnedRef.current = true;
|
|
2701
|
+
scrollToBottom();
|
|
2702
|
+
}, [autoScrollKey, scrollToBottom]);
|
|
2703
|
+
const isEmpty = React23__namespace.Children.count(children) === 0;
|
|
2704
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col h-full min-h-0", className), children: [
|
|
2705
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { ref: rootRef, className: "flex-1 min-h-0", children: isEmpty && emptyState ? emptyState : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2706
|
+
"div",
|
|
2705
2707
|
{
|
|
2706
|
-
|
|
2707
|
-
className: cn(
|
|
2708
|
-
|
|
2709
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
2710
|
-
"focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none",
|
|
2711
|
-
className,
|
|
2712
|
-
level === 0 ? "font-medium" : "font-normal"
|
|
2713
|
-
// "group-hover/item:bg-accent/50"
|
|
2714
|
-
),
|
|
2715
|
-
role: hasChildren ? "menuitem" : void 0,
|
|
2716
|
-
"aria-haspopup": hasChildren ? "true" : void 0,
|
|
2717
|
-
"aria-expanded": hasChildren ? "true" : void 0,
|
|
2718
|
-
children: [
|
|
2719
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
2720
|
-
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
|
|
2721
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
2722
|
-
] }),
|
|
2723
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
2724
|
-
shortcut && /* @__PURE__ */ jsxRuntime.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 }),
|
|
2725
|
-
hasChildren && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
2726
|
-
] })
|
|
2727
|
-
]
|
|
2708
|
+
ref: contentRef,
|
|
2709
|
+
className: cn("flex flex-col gap-4 p-3", bodyClassName),
|
|
2710
|
+
children
|
|
2728
2711
|
}
|
|
2729
|
-
),
|
|
2730
|
-
|
|
2731
|
-
|
|
2712
|
+
) }),
|
|
2713
|
+
footer
|
|
2714
|
+
] });
|
|
2715
|
+
}
|
|
2716
|
+
function RunningDots() {
|
|
2717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-0.5", "aria-label": "Running", children: [
|
|
2718
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
|
|
2719
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
|
|
2720
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1 h-1 rounded-full bg-current animate-bounce" })
|
|
2721
|
+
] });
|
|
2722
|
+
}
|
|
2723
|
+
function ChatSessionMessage({
|
|
2724
|
+
role,
|
|
2725
|
+
children,
|
|
2726
|
+
status = "idle",
|
|
2727
|
+
icon,
|
|
2728
|
+
meta,
|
|
2729
|
+
actions,
|
|
2730
|
+
footer,
|
|
2731
|
+
className
|
|
2732
|
+
}) {
|
|
2733
|
+
if (role === "user") {
|
|
2734
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex justify-end", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2735
|
+
"div",
|
|
2732
2736
|
{
|
|
2733
2737
|
className: cn(
|
|
2734
|
-
"
|
|
2735
|
-
"
|
|
2736
|
-
"group-hover/item:visible group-hover/item:opacity-100 group-hover/item:translate-x-0",
|
|
2737
|
-
"transition-all duration-150 ease-in-out",
|
|
2738
|
-
level === 0 ? "left-full top-0" : "left-full top-0"
|
|
2738
|
+
"max-w-[85%] rounded-2xl rounded-br-sm bg-secondary px-3 py-2 text-secondary-foreground whitespace-pre-wrap break-words",
|
|
2739
|
+
icon && "flex items-center gap-1.5"
|
|
2739
2740
|
),
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
children: children.map((item) => /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ...item, level: level + 1 }, item.id))
|
|
2741
|
+
children: [
|
|
2742
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 opacity-70", children: icon }),
|
|
2743
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words", children }) : children
|
|
2744
|
+
]
|
|
2745
2745
|
}
|
|
2746
|
-
)
|
|
2746
|
+
) });
|
|
2747
|
+
}
|
|
2748
|
+
if (status === "running") {
|
|
2749
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 text-muted-foreground", className), children: [
|
|
2750
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: icon }),
|
|
2751
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children }),
|
|
2752
|
+
/* @__PURE__ */ jsxRuntime.jsx(RunningDots, {})
|
|
2753
|
+
] });
|
|
2754
|
+
}
|
|
2755
|
+
if (status === "stopped") {
|
|
2756
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-muted-foreground italic", className), children });
|
|
2757
|
+
}
|
|
2758
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
2759
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
2760
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: icon }),
|
|
2761
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2762
|
+
"div",
|
|
2763
|
+
{
|
|
2764
|
+
className: cn(
|
|
2765
|
+
"min-w-0 flex-1 whitespace-pre-wrap break-words",
|
|
2766
|
+
status === "error" ? "text-destructive" : "text-foreground"
|
|
2767
|
+
),
|
|
2768
|
+
children
|
|
2769
|
+
}
|
|
2770
|
+
)
|
|
2771
|
+
] }),
|
|
2772
|
+
actions,
|
|
2773
|
+
meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: meta }),
|
|
2774
|
+
footer
|
|
2747
2775
|
] });
|
|
2748
|
-
}
|
|
2776
|
+
}
|
|
2749
2777
|
var NavItems = ({
|
|
2750
2778
|
items,
|
|
2751
2779
|
orientation = "horizontal",
|
|
@@ -2757,14 +2785,15 @@ var NavItems = ({
|
|
|
2757
2785
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.map((item) => {
|
|
2758
2786
|
const isActive = activeItem === item.name;
|
|
2759
2787
|
const padding = item.label ? "px-3 py-1.5" : "px-2 py-2";
|
|
2788
|
+
const isInteractive = Boolean(item.href || item.onClick);
|
|
2760
2789
|
const itemClass = `inline-flex border-0 items-center justify-center gap-2
|
|
2761
|
-
whitespace-nowrap rounded-md
|
|
2790
|
+
whitespace-nowrap rounded-md transition-colors
|
|
2762
2791
|
ring-1 ring-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
2763
2792
|
${padding}
|
|
2764
|
-
hover:bg-primary/10 hover:text-primary hover:ring-primary/25
|
|
2793
|
+
${isInteractive ? "cursor-pointer hover:bg-primary/10 hover:text-primary hover:ring-primary/25" : ""}
|
|
2765
2794
|
${isActive ? `bg-primary/15 text-primary ring-primary/25 ${item.activeClass || ""}` : ""}
|
|
2766
2795
|
${item.className || ""}`;
|
|
2767
|
-
const icon = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2796
|
+
const icon = item.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2768
2797
|
item.icon,
|
|
2769
2798
|
{
|
|
2770
2799
|
strokeWidth: item.iconStroke || 2,
|
|
@@ -2867,6 +2896,189 @@ var NavHorizontal = ({
|
|
|
2867
2896
|
}
|
|
2868
2897
|
);
|
|
2869
2898
|
};
|
|
2899
|
+
function ChatSessionMessageOptions({
|
|
2900
|
+
actions,
|
|
2901
|
+
className
|
|
2902
|
+
}) {
|
|
2903
|
+
const start = actions.filter((a) => (a.align ?? "start") === "start");
|
|
2904
|
+
const end = actions.filter((a) => a.align === "end");
|
|
2905
|
+
const renderAction = (action, i) => /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
2906
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2907
|
+
Button,
|
|
2908
|
+
{
|
|
2909
|
+
variant: "ghost",
|
|
2910
|
+
size: "icon",
|
|
2911
|
+
className: cn(
|
|
2912
|
+
"h-6 w-7 text-muted-foreground",
|
|
2913
|
+
action.active && (action.activeClassName ?? "text-foreground"),
|
|
2914
|
+
action.className
|
|
2915
|
+
),
|
|
2916
|
+
onClick: action.onClick,
|
|
2917
|
+
disabled: action.disabled,
|
|
2918
|
+
"aria-label": action.label,
|
|
2919
|
+
children: action.icon
|
|
2920
|
+
}
|
|
2921
|
+
) }),
|
|
2922
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: action.label })
|
|
2923
|
+
] }, `${action.label}-${i}`);
|
|
2924
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2925
|
+
NavHorizontal,
|
|
2926
|
+
{
|
|
2927
|
+
className: cn("text-muted-foreground", className),
|
|
2928
|
+
left: start.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: start.map(renderAction) }) : void 0,
|
|
2929
|
+
right: end.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: end.map(renderAction) }) : void 0
|
|
2930
|
+
}
|
|
2931
|
+
) });
|
|
2932
|
+
}
|
|
2933
|
+
function ChatSessionComposer({
|
|
2934
|
+
value,
|
|
2935
|
+
onChange,
|
|
2936
|
+
onSend,
|
|
2937
|
+
onStop,
|
|
2938
|
+
isRunning = false,
|
|
2939
|
+
disabled = false,
|
|
2940
|
+
placeholder = "Ask anything\u2026",
|
|
2941
|
+
toolbarStart,
|
|
2942
|
+
toolbarEnd,
|
|
2943
|
+
attachments,
|
|
2944
|
+
sendIcon,
|
|
2945
|
+
stopIcon,
|
|
2946
|
+
sendDisabled,
|
|
2947
|
+
className,
|
|
2948
|
+
textareaClassName
|
|
2949
|
+
}) {
|
|
2950
|
+
const handleKeyDown = (e) => {
|
|
2951
|
+
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
2952
|
+
e.preventDefault();
|
|
2953
|
+
if (!isRunning && !disabled) onSend();
|
|
2954
|
+
}
|
|
2955
|
+
};
|
|
2956
|
+
const isSendDisabled = sendDisabled ?? (disabled || value.trim().length === 0);
|
|
2957
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-3", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border bg-card shadow-sm overflow-hidden focus-within:border-ring transition-colors", children: [
|
|
2958
|
+
attachments && /* @__PURE__ */ jsxRuntime.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 }),
|
|
2959
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2960
|
+
"textarea",
|
|
2961
|
+
{
|
|
2962
|
+
value,
|
|
2963
|
+
onChange: (e) => onChange(e.target.value),
|
|
2964
|
+
onKeyDown: handleKeyDown,
|
|
2965
|
+
disabled,
|
|
2966
|
+
placeholder,
|
|
2967
|
+
className: cn(
|
|
2968
|
+
"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",
|
|
2969
|
+
textareaClassName
|
|
2970
|
+
)
|
|
2971
|
+
}
|
|
2972
|
+
),
|
|
2973
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 py-1.5 border-t border-border flex items-center gap-1.5", children: [
|
|
2974
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 flex items-center gap-1.5", children: toolbarStart }),
|
|
2975
|
+
toolbarEnd,
|
|
2976
|
+
isRunning ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2977
|
+
Button,
|
|
2978
|
+
{
|
|
2979
|
+
size: "icon",
|
|
2980
|
+
className: "h-7 w-7 shrink-0 rounded-full",
|
|
2981
|
+
onClick: onStop,
|
|
2982
|
+
title: "Stop",
|
|
2983
|
+
"aria-label": "Stop",
|
|
2984
|
+
children: stopIcon
|
|
2985
|
+
}
|
|
2986
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2987
|
+
Button,
|
|
2988
|
+
{
|
|
2989
|
+
size: "icon",
|
|
2990
|
+
className: "h-7 w-7 shrink-0 rounded-full",
|
|
2991
|
+
onClick: onSend,
|
|
2992
|
+
disabled: isSendDisabled,
|
|
2993
|
+
title: "Send",
|
|
2994
|
+
"aria-label": "Send",
|
|
2995
|
+
children: sendIcon
|
|
2996
|
+
}
|
|
2997
|
+
)
|
|
2998
|
+
] })
|
|
2999
|
+
] }) });
|
|
3000
|
+
}
|
|
3001
|
+
var ErrorBoundary = class extends React23.Component {
|
|
3002
|
+
constructor(props) {
|
|
3003
|
+
super(props);
|
|
3004
|
+
this.state = { hasError: false };
|
|
3005
|
+
}
|
|
3006
|
+
static getDerivedStateFromError(_) {
|
|
3007
|
+
return { hasError: true };
|
|
3008
|
+
}
|
|
3009
|
+
componentDidCatch(error, errorInfo) {
|
|
3010
|
+
console.error("ErrorBoundary caught an error", error, errorInfo);
|
|
3011
|
+
}
|
|
3012
|
+
render() {
|
|
3013
|
+
if (this.state.hasError) {
|
|
3014
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center h-full w-full text-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center", children: [
|
|
3015
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Frown, { className: "mr-1 h-4" }),
|
|
3016
|
+
"Oops ! something went wrong."
|
|
3017
|
+
] }) });
|
|
3018
|
+
}
|
|
3019
|
+
return this.props.children;
|
|
3020
|
+
}
|
|
3021
|
+
};
|
|
3022
|
+
var MenuItem = ({
|
|
3023
|
+
label,
|
|
3024
|
+
icon: Icon,
|
|
3025
|
+
shortcut,
|
|
3026
|
+
children,
|
|
3027
|
+
className,
|
|
3028
|
+
level = 0,
|
|
3029
|
+
href,
|
|
3030
|
+
onClick
|
|
3031
|
+
}) => {
|
|
3032
|
+
const hasChildren = children && children.length > 0;
|
|
3033
|
+
const ButtonOrLink = href ? "a" : "button";
|
|
3034
|
+
const clickTrigger = href ? { href } : { onClick };
|
|
3035
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "relative group/item", children: [
|
|
3036
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3037
|
+
ButtonOrLink,
|
|
3038
|
+
{
|
|
3039
|
+
...clickTrigger,
|
|
3040
|
+
className: cn(
|
|
3041
|
+
"flex w-full items-center justify-between px-4 py-2 ",
|
|
3042
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
3043
|
+
"focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none",
|
|
3044
|
+
className,
|
|
3045
|
+
level === 0 ? "font-medium" : "font-normal"
|
|
3046
|
+
// "group-hover/item:bg-accent/50"
|
|
3047
|
+
),
|
|
3048
|
+
role: hasChildren ? "menuitem" : void 0,
|
|
3049
|
+
"aria-haspopup": hasChildren ? "true" : void 0,
|
|
3050
|
+
"aria-expanded": hasChildren ? "true" : void 0,
|
|
3051
|
+
children: [
|
|
3052
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
3053
|
+
Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4" }),
|
|
3054
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
3055
|
+
] }),
|
|
3056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
3057
|
+
shortcut && /* @__PURE__ */ jsxRuntime.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 }),
|
|
3058
|
+
hasChildren && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
3059
|
+
] })
|
|
3060
|
+
]
|
|
3061
|
+
}
|
|
3062
|
+
),
|
|
3063
|
+
hasChildren && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3064
|
+
"ul",
|
|
3065
|
+
{
|
|
3066
|
+
className: cn(
|
|
3067
|
+
"absolute min-w-[240px] border p-1 bg-card text-card-foreground shadow-md",
|
|
3068
|
+
"invisible opacity-0 translate-x-2",
|
|
3069
|
+
"group-hover/item:visible group-hover/item:opacity-100 group-hover/item:translate-x-0",
|
|
3070
|
+
"transition-all duration-150 ease-in-out",
|
|
3071
|
+
level === 0 ? "left-full top-0" : "left-full top-0"
|
|
3072
|
+
),
|
|
3073
|
+
style: {
|
|
3074
|
+
zIndex: 50 + level
|
|
3075
|
+
},
|
|
3076
|
+
role: "menu",
|
|
3077
|
+
children: children.map((item) => /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ...item, level: level + 1 }, item.id))
|
|
3078
|
+
}
|
|
3079
|
+
)
|
|
3080
|
+
] });
|
|
3081
|
+
};
|
|
2870
3082
|
var NavVerticalItems = ({ items }) => /* @__PURE__ */ jsxRuntime.jsx(NavItems, { items, orientation: "vertical" });
|
|
2871
3083
|
var NavVertical = ({
|
|
2872
3084
|
className = "",
|
|
@@ -3088,7 +3300,7 @@ function TabbedPanel({
|
|
|
3088
3300
|
}
|
|
3089
3301
|
onTabChange?.(value);
|
|
3090
3302
|
};
|
|
3091
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { value: currentTab, onValueChange: handleTabChange, className:
|
|
3303
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { value: currentTab, onValueChange: handleTabChange, className: "h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: cn("h-full border rounded-none", className), children: [
|
|
3092
3304
|
/* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: `flex flex-row items-center justify-between py-0 border-b h-[30px] px-0 space-y-0 ${headerClassName || ""}`, children: [
|
|
3093
3305
|
/* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "h-full bg-transparent p-0 gap-0 rounded-none", children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3094
3306
|
TabsTrigger,
|
|
@@ -3771,6 +3983,10 @@ exports.CarouselContent = CarouselContent;
|
|
|
3771
3983
|
exports.CarouselItem = CarouselItem;
|
|
3772
3984
|
exports.CarouselNext = CarouselNext;
|
|
3773
3985
|
exports.CarouselPrevious = CarouselPrevious;
|
|
3986
|
+
exports.ChatSession = ChatSession;
|
|
3987
|
+
exports.ChatSessionComposer = ChatSessionComposer;
|
|
3988
|
+
exports.ChatSessionMessage = ChatSessionMessage;
|
|
3989
|
+
exports.ChatSessionMessageOptions = ChatSessionMessageOptions;
|
|
3774
3990
|
exports.Command = Command;
|
|
3775
3991
|
exports.CommandDialog = CommandDialog;
|
|
3776
3992
|
exports.CommandEmpty = CommandEmpty;
|