@agentiffai/design 1.4.1 → 1.4.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/{Window-Dm_I5m8i.d.cts → Window-DTASLUB2.d.cts} +20 -2
- package/dist/{Window-Dm_I5m8i.d.ts → Window-DTASLUB2.d.ts} +20 -2
- package/dist/copilotkit/index.cjs +499 -464
- package/dist/copilotkit/index.cjs.map +1 -1
- package/dist/copilotkit/index.d.cts +98 -8
- package/dist/copilotkit/index.d.ts +98 -8
- package/dist/copilotkit/index.js +492 -455
- package/dist/copilotkit/index.js.map +1 -1
- package/dist/index.cjs +11 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/copilotkit/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useButton } from '@react-aria/button';
|
|
2
|
-
import React, { memo, useRef, useEffect, useMemo, useState, useCallback } from 'react';
|
|
2
|
+
import React, { memo, createContext, useRef, useEffect, useMemo, useState, useContext, useCallback } from 'react';
|
|
3
3
|
import styled9, { css, keyframes, createGlobalStyle } from 'styled-components';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import {
|
|
6
|
-
import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
|
|
7
|
-
export { useChatContext } from '@copilotkit/react-ui';
|
|
5
|
+
import { CopilotSidebar } from '@copilotkit/react-core/v2';
|
|
8
6
|
import { useTextField } from '@react-aria/textfield';
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
11
14
|
|
|
12
15
|
// src/theme/tokens.ts
|
|
13
16
|
var tokens = {
|
|
@@ -1414,6 +1417,22 @@ var AssistantMessageBase = ({
|
|
|
1414
1417
|
};
|
|
1415
1418
|
var AssistantMessage = memo(AssistantMessageBase);
|
|
1416
1419
|
AssistantMessage.displayName = "AssistantMessage";
|
|
1420
|
+
var _useAgent;
|
|
1421
|
+
try {
|
|
1422
|
+
_useAgent = __require("@copilotkit/react-core/v2").useAgent;
|
|
1423
|
+
} catch {
|
|
1424
|
+
}
|
|
1425
|
+
function useVisibleMessages() {
|
|
1426
|
+
if (_useAgent) {
|
|
1427
|
+
try {
|
|
1428
|
+
const { agent } = _useAgent({ agentId: "default" });
|
|
1429
|
+
return agent.messages ?? [];
|
|
1430
|
+
} catch {
|
|
1431
|
+
return [];
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return [];
|
|
1435
|
+
}
|
|
1417
1436
|
var REGISTRY_KEY = "__agentiffai_tool_call_registry__";
|
|
1418
1437
|
var TOOL_CALL_TTL_MS = 5 * 60 * 1e3;
|
|
1419
1438
|
function getRegistryMap() {
|
|
@@ -1688,7 +1707,7 @@ function createAssistantMessageAdapterWithErrorReporting(onReportIssue, Thinking
|
|
|
1688
1707
|
isGenerating
|
|
1689
1708
|
}) => {
|
|
1690
1709
|
const lastGenerativeUIRef = useRef(null);
|
|
1691
|
-
const
|
|
1710
|
+
const visibleMessages = useVisibleMessages();
|
|
1692
1711
|
const rawContent = Array.isArray(message?.content) ? message.content.join("") : message?.content || "";
|
|
1693
1712
|
const content = stripToolCallMarkers(rawContent);
|
|
1694
1713
|
const toolCallNames = useMemo(() => {
|
|
@@ -2322,6 +2341,24 @@ var UserMessageAdapterBase = ({ message, ImageRenderer }) => {
|
|
|
2322
2341
|
};
|
|
2323
2342
|
var UserMessageAdapter = memo(UserMessageAdapterBase);
|
|
2324
2343
|
UserMessageAdapter.displayName = "UserMessageAdapter";
|
|
2344
|
+
var ChatContext = createContext(void 0);
|
|
2345
|
+
function useChatContext() {
|
|
2346
|
+
const ctx = useContext(ChatContext);
|
|
2347
|
+
if (ctx) return ctx;
|
|
2348
|
+
try {
|
|
2349
|
+
const v1 = __require("@copilotkit/react-ui");
|
|
2350
|
+
if (v1?.useChatContext) {
|
|
2351
|
+
return v1.useChatContext();
|
|
2352
|
+
}
|
|
2353
|
+
} catch {
|
|
2354
|
+
}
|
|
2355
|
+
return {
|
|
2356
|
+
open: false,
|
|
2357
|
+
setOpen: () => {
|
|
2358
|
+
console.warn("[useChatContext shim] setOpen called but no ChatContext provider found");
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2325
2362
|
var pulse3 = keyframes`
|
|
2326
2363
|
0%, 100% {
|
|
2327
2364
|
opacity: 1;
|
|
@@ -2680,35 +2717,6 @@ var Header = ({
|
|
|
2680
2717
|
] });
|
|
2681
2718
|
};
|
|
2682
2719
|
Header.displayName = "Header";
|
|
2683
|
-
var MessagesContainer = styled9.div`
|
|
2684
|
-
display: flex;
|
|
2685
|
-
flex-direction: column;
|
|
2686
|
-
flex: 1;
|
|
2687
|
-
overflow: hidden;
|
|
2688
|
-
/* Gradient background - brand aligned */
|
|
2689
|
-
background: linear-gradient(
|
|
2690
|
-
to right bottom,
|
|
2691
|
-
${tokens.colors.background.dark},
|
|
2692
|
-
${tokens.colors.background.darker},
|
|
2693
|
-
${tokens.colors.background.darkest}
|
|
2694
|
-
);
|
|
2695
|
-
/* Minimal horizontal padding to maximize message width */
|
|
2696
|
-
padding: ${tokens.spacing.sm} ${tokens.spacing.xs};
|
|
2697
|
-
gap: ${tokens.spacing.sm};
|
|
2698
|
-
box-sizing: border-box;
|
|
2699
|
-
|
|
2700
|
-
/* Ensure proper scrolling behavior for child components */
|
|
2701
|
-
position: relative;
|
|
2702
|
-
min-height: 0;
|
|
2703
|
-
`;
|
|
2704
|
-
var Messages = ({
|
|
2705
|
-
children,
|
|
2706
|
-
className,
|
|
2707
|
-
ariaLabel = "Messages"
|
|
2708
|
-
}) => {
|
|
2709
|
-
return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
|
|
2710
|
-
};
|
|
2711
|
-
Messages.displayName = "Messages";
|
|
2712
2720
|
var WindowContainer = styled9.div`
|
|
2713
2721
|
display: flex;
|
|
2714
2722
|
flex-direction: column;
|
|
@@ -2803,64 +2811,197 @@ var Window = ({
|
|
|
2803
2811
|
};
|
|
2804
2812
|
Window.displayName = "Window";
|
|
2805
2813
|
var GlobalSidebarStyles = createGlobalStyle`
|
|
2806
|
-
/* Override CopilotKit's
|
|
2814
|
+
/* Override CopilotKit's content wrapper to respect safe areas in landscape */
|
|
2815
|
+
@media (orientation: landscape) {
|
|
2816
|
+
.copilotKitSidebarContentWrapper {
|
|
2817
|
+
right: var(--safe-area-right, 0px) !important;
|
|
2818
|
+
left: var(--safe-area-left, 0px) !important;
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
/* Override CopilotKit's default positioning - keep sidebar container in place */
|
|
2823
|
+
/* z-index must be higher than NavHorizontal (sticky: 1020) for button to show above nav */
|
|
2807
2824
|
.copilotKitSidebar {
|
|
2808
2825
|
position: fixed !important;
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2826
|
+
top: calc(var(--safe-area-top, 0px) + 8px) !important;
|
|
2827
|
+
right: calc(var(--safe-area-right, 0px) + 8px) !important;
|
|
2828
|
+
bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
|
|
2829
|
+
left: calc(var(--safe-area-left, 0px) + 8px) !important;
|
|
2830
|
+
width: auto !important;
|
|
2831
|
+
height: auto !important;
|
|
2832
|
+
pointer-events: none !important;
|
|
2833
|
+
z-index: ${tokens.zIndex.fixed} !important;
|
|
2812
2834
|
}
|
|
2813
2835
|
|
|
2814
|
-
/*
|
|
2836
|
+
/* Keep sidebar container always visible (the window inside will animate) */
|
|
2815
2837
|
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {
|
|
2816
|
-
|
|
2838
|
+
pointer-events: auto !important;
|
|
2817
2839
|
}
|
|
2818
2840
|
|
|
2819
|
-
/* Mobile-first:
|
|
2820
|
-
|
|
2841
|
+
/* Mobile-first: Glassmorphism sidebar with rounded corners */
|
|
2842
|
+
/* Target the actual dialog element that gets rendered */
|
|
2843
|
+
.copilotKitSidebar [role="dialog"] {
|
|
2844
|
+
/* Override CopilotKit defaults for mobile */
|
|
2821
2845
|
position: fixed !important;
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2846
|
+
/* TOP: Account for status bar safe area (Android notch/status bar) */
|
|
2847
|
+
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
2848
|
+
/* RIGHT: Account for landscape notch on right side */
|
|
2849
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
2850
|
+
/* BOTTOM: Account for horizontal navbar (52px) + safe area for Android nav buttons */
|
|
2851
|
+
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
2852
|
+
/* LEFT: Account for landscape notch on left side */
|
|
2853
|
+
left: calc(${tokens.spacing.sm} + var(--safe-area-left, 0px)) !important;
|
|
2854
|
+
/* Let left + right define width, top + bottom define height — no explicit values needed */
|
|
2855
|
+
width: auto !important;
|
|
2856
|
+
height: auto !important;
|
|
2857
|
+
max-width: none !important;
|
|
2858
|
+
max-height: none !important;
|
|
2830
2859
|
margin: 0 !important;
|
|
2831
|
-
border-radius:
|
|
2832
|
-
|
|
2860
|
+
border-radius: ${tokens.borderRadius.xl} !important;
|
|
2861
|
+
|
|
2862
|
+
/* Glassmorphism effect */
|
|
2863
|
+
background: ${tokens.colors.surface.glass} !important;
|
|
2864
|
+
box-shadow: ${tokens.shadows.lg} !important;
|
|
2865
|
+
backdrop-filter: blur(11.1px) !important;
|
|
2866
|
+
-webkit-backdrop-filter: blur(11.1px) !important;
|
|
2867
|
+
border: 1px solid ${tokens.colors.surface.glassBorder} !important;
|
|
2868
|
+
|
|
2869
|
+
/* Smooth slide transition */
|
|
2870
|
+
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
2871
|
+
z-index: ${tokens.zIndex.modal} !important;
|
|
2872
|
+
}
|
|
2833
2873
|
|
|
2874
|
+
/* Hidden by default */
|
|
2875
|
+
.copilotKitSidebarContentWrapper:not(.sidebarExpanded) .copilotKitSidebar [role="dialog"] {
|
|
2834
2876
|
transform: translateX(100%) !important;
|
|
2835
2877
|
visibility: hidden !important;
|
|
2836
2878
|
pointer-events: none !important;
|
|
2837
2879
|
opacity: 0 !important;
|
|
2838
|
-
display: none !important;
|
|
2839
|
-
|
|
2840
|
-
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
2841
2880
|
}
|
|
2842
2881
|
|
|
2843
|
-
/*
|
|
2844
|
-
.
|
|
2845
|
-
display: flex !important;
|
|
2882
|
+
/* Visible when expanded */
|
|
2883
|
+
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar [role="dialog"] {
|
|
2846
2884
|
transform: translateX(0) !important;
|
|
2847
2885
|
visibility: visible !important;
|
|
2848
2886
|
pointer-events: auto !important;
|
|
2849
2887
|
opacity: 1 !important;
|
|
2850
2888
|
}
|
|
2851
2889
|
|
|
2852
|
-
/* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */
|
|
2853
|
-
@media (min-width:
|
|
2854
|
-
.copilotKitSidebar
|
|
2890
|
+
/* Desktop: Sidebar panel on the right with glassmorphism (640px = CopilotKit's breakpoint) */
|
|
2891
|
+
@media (min-width: ${tokens.breakpoints.mobile}px) {
|
|
2892
|
+
.copilotKitSidebar [role="dialog"] {
|
|
2855
2893
|
inset: auto !important;
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2894
|
+
/* TOP: Account for status bar safe area */
|
|
2895
|
+
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
2896
|
+
/* RIGHT: Account for landscape notch on right side */
|
|
2897
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
2898
|
+
/* BOTTOM: Account for horizontal navbar (52px) + safe area */
|
|
2899
|
+
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
2859
2900
|
left: auto !important;
|
|
2860
2901
|
width: 28rem !important;
|
|
2861
|
-
height
|
|
2902
|
+
/* Let top + bottom define height — no explicit value needed */
|
|
2903
|
+
height: auto !important;
|
|
2862
2904
|
max-width: 28rem !important;
|
|
2863
|
-
max-height:
|
|
2905
|
+
max-height: none !important;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
/* Mobile landscape: sidebar on right side, allow background interaction */
|
|
2910
|
+
@media (orientation: landscape) and (max-height: 500px) {
|
|
2911
|
+
/* Account for vertical nav (60px) in landscape */
|
|
2912
|
+
.copilotKitSidebarContentWrapper {
|
|
2913
|
+
left: 60px !important;
|
|
2914
|
+
width: calc(100% - 60px) !important;
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
/* Sidebar container covers right portion — full height, no gaps */
|
|
2918
|
+
.copilotKitSidebar {
|
|
2919
|
+
top: 0 !important;
|
|
2920
|
+
bottom: 0 !important;
|
|
2921
|
+
right: 0 !important;
|
|
2922
|
+
left: 50vw !important;
|
|
2923
|
+
width: auto !important;
|
|
2924
|
+
height: 100vh !important;
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
/* Offset the expanded sidebar wrapper to leave space for main content */
|
|
2928
|
+
.copilotKitSidebarContentWrapper.sidebarExpanded {
|
|
2929
|
+
margin-right: 30vw !important;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
.copilotKitSidebar [role="dialog"] {
|
|
2933
|
+
width: min(50vw, 22rem) !important;
|
|
2934
|
+
max-width: min(50vw, 22rem) !important;
|
|
2935
|
+
left: auto !important;
|
|
2936
|
+
/* Flush with right edge — safe area handled via internal padding */
|
|
2937
|
+
right: 0 !important;
|
|
2938
|
+
/* Fill ALL vertical space — overlay the bottom nav for maximum chat area */
|
|
2939
|
+
/* Keep top safe area so dialog doesn't go behind status bar (battery/wifi) */
|
|
2940
|
+
top: var(--safe-area-top, 0px) !important;
|
|
2941
|
+
bottom: 0 !important;
|
|
2942
|
+
/* Let top/bottom define height */
|
|
2943
|
+
height: auto !important;
|
|
2944
|
+
max-height: none !important;
|
|
2945
|
+
margin: 0 !important;
|
|
2946
|
+
/* Only round the left edges since right is flush with viewport */
|
|
2947
|
+
border-radius: 0 !important;
|
|
2948
|
+
border-top-left-radius: ${tokens.borderRadius.xl} !important;
|
|
2949
|
+
border-bottom-left-radius: ${tokens.borderRadius.xl} !important;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
/* Compact header in landscape - hide title text but keep close button */
|
|
2953
|
+
/* Safe area top padding applied here so content avoids status bar */
|
|
2954
|
+
.copilotKitSidebar [role="dialog"] header,
|
|
2955
|
+
.copilotKitSidebar [role="dialog"] [data-testid="chat-header"],
|
|
2956
|
+
.copilotKitSidebar [role="dialog"] > div:first-child {
|
|
2957
|
+
padding: 0.25rem 0.5rem 0.25rem !important;
|
|
2958
|
+
min-height: auto !important;
|
|
2959
|
+
height: auto !important;
|
|
2960
|
+
padding-right: calc(1.5rem + var(--safe-area-right, 0px)) !important;
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
/* Hide the title text but keep close button visible */
|
|
2964
|
+
.copilotKitSidebar [role="dialog"] header h1,
|
|
2965
|
+
.copilotKitSidebar [role="dialog"] header h2,
|
|
2966
|
+
.copilotKitSidebar [role="dialog"] header span:not(:last-child),
|
|
2967
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > span,
|
|
2968
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > h1,
|
|
2969
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > h2 {
|
|
2970
|
+
display: none !important;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
/* Reduce vertical padding inside chat — right safe area for notch */
|
|
2974
|
+
.copilotKitMessages {
|
|
2975
|
+
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
.copilotKitMessage {
|
|
2979
|
+
padding: ${tokens.spacing.xs} 0 !important;
|
|
2980
|
+
margin: ${tokens.spacing.xs} 0 !important;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
/* Reduce gap between messages */
|
|
2984
|
+
.copilotKitMessages > div {
|
|
2985
|
+
gap: 0.25rem !important;
|
|
2986
|
+
padding-bottom: 0;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
/* Compact input area — safe area padding for bottom gesture bar and right notch */
|
|
2990
|
+
.copilotKitInput {
|
|
2991
|
+
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) calc(${tokens.spacing.xs} + var(--safe-area-bottom, 0px)) ${tokens.spacing.sm} !important;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/* Compact suggested prompts in landscape */
|
|
2995
|
+
div[role="list"][aria-label*="Suggested"] {
|
|
2996
|
+
margin: 0 !important;
|
|
2997
|
+
padding: 1px !important;
|
|
2998
|
+
min-height: auto !important;
|
|
2999
|
+
max-height: 32px !important;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
/* Suggestions container — safe area padding for bottom and right */
|
|
3003
|
+
.copilotKitSidebar [role="dialog"] > div:last-child {
|
|
3004
|
+
padding: 1px calc(1px + var(--safe-area-right, 0px)) calc(1px + var(--safe-area-bottom, 0px)) 1px !important;
|
|
2864
3005
|
}
|
|
2865
3006
|
}
|
|
2866
3007
|
|
|
@@ -2880,106 +3021,131 @@ var GlobalSidebarStyles = createGlobalStyle`
|
|
|
2880
3021
|
}
|
|
2881
3022
|
}
|
|
2882
3023
|
|
|
2883
|
-
/*
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
3024
|
+
/* Position chat button with safe area on landscape (right side for Android controls) */
|
|
3025
|
+
@media (orientation: landscape) {
|
|
3026
|
+
.copilotKitSidebarContentWrapper {
|
|
3027
|
+
button[aria-label="Open chat"],
|
|
3028
|
+
button[aria-label="Close chat"] {
|
|
3029
|
+
bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
|
|
3030
|
+
right: calc(var(--safe-area-right, 0px) + 8px) !important;
|
|
3031
|
+
z-index: 2000 !important;
|
|
3032
|
+
}
|
|
2890
3033
|
}
|
|
3034
|
+
}
|
|
2891
3035
|
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
}
|
|
3036
|
+
/* Fix messages container background */
|
|
3037
|
+
.copilotKitMessages {
|
|
3038
|
+
background-color: transparent !important;
|
|
3039
|
+
}
|
|
2897
3040
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
}
|
|
3041
|
+
/* Performance optimization for messages - no animations to reduce jitter during streaming */
|
|
3042
|
+
.copilotKitMessage {
|
|
3043
|
+
/* contain: content isolates layout/paint to this element */
|
|
3044
|
+
contain: content;
|
|
3045
|
+
}
|
|
2904
3046
|
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3047
|
+
/* Override CopilotKit suggestions to be single-row with horizontal scroll */
|
|
3048
|
+
div[role="list"][aria-label*="Suggested"] {
|
|
3049
|
+
display: flex !important;
|
|
3050
|
+
flex-wrap: nowrap !important; /* Force single row */
|
|
3051
|
+
gap: ${tokens.spacing.sm} !important;
|
|
3052
|
+
padding: ${tokens.spacing.xs} 0 !important;
|
|
3053
|
+
|
|
3054
|
+
/* Horizontal scrolling */
|
|
3055
|
+
overflow-x: auto !important;
|
|
3056
|
+
overflow-y: hidden !important;
|
|
3057
|
+
|
|
3058
|
+
/* Smooth scrolling */
|
|
3059
|
+
-webkit-overflow-scrolling: touch;
|
|
3060
|
+
scroll-behavior: smooth;
|
|
3061
|
+
|
|
3062
|
+
/* Fixed height for one suggestion */
|
|
3063
|
+
max-height: 40px !important;
|
|
3064
|
+
min-height: 40px !important;
|
|
3065
|
+
align-items: center !important;
|
|
3066
|
+
|
|
3067
|
+
/* Hide scrollbar */
|
|
3068
|
+
scrollbar-width: none !important;
|
|
3069
|
+
-ms-overflow-style: none !important;
|
|
3070
|
+
|
|
3071
|
+
&::-webkit-scrollbar {
|
|
3072
|
+
display: none !important;
|
|
2910
3073
|
}
|
|
2911
3074
|
}
|
|
3075
|
+
|
|
3076
|
+
/* Ensure suggestion buttons don't wrap or shrink */
|
|
3077
|
+
div[role="list"][aria-label*="Suggested"] button {
|
|
3078
|
+
flex-shrink: 0 !important;
|
|
3079
|
+
white-space: nowrap !important;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
/* Remove teal/cyan outline from all inputs */
|
|
3083
|
+
.copilotKitSidebar input,
|
|
3084
|
+
.copilotKitSidebar input:focus,
|
|
3085
|
+
.copilotKitSidebar input:focus-visible,
|
|
3086
|
+
.copilotKitSidebar textarea,
|
|
3087
|
+
.copilotKitSidebar textarea:focus,
|
|
3088
|
+
.copilotKitSidebar textarea:focus-visible {
|
|
3089
|
+
outline: none !important;
|
|
3090
|
+
outline-color: transparent !important;
|
|
3091
|
+
box-shadow: none !important;
|
|
3092
|
+
}
|
|
2912
3093
|
`;
|
|
2913
3094
|
var StyledChatButton = styled9.button`
|
|
2914
3095
|
position: fixed;
|
|
2915
|
-
bottom:
|
|
2916
|
-
right:
|
|
3096
|
+
bottom: calc(${tokens.spacing.sm} + var(--safe-area-bottom, 0px));
|
|
3097
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px));
|
|
2917
3098
|
width: 36px;
|
|
2918
3099
|
height: 36px;
|
|
2919
|
-
border-radius:
|
|
3100
|
+
border-radius: ${tokens.borderRadius.full};
|
|
2920
3101
|
border: none;
|
|
2921
3102
|
background: linear-gradient(135deg, ${tokens.colors.primary} 0%, ${tokens.colors.accent} 100%);
|
|
2922
|
-
box-shadow:
|
|
3103
|
+
box-shadow: ${({ $disabled }) => $disabled ? "none" : tokens.shadows.glow.primary};
|
|
2923
3104
|
display: flex;
|
|
2924
3105
|
align-items: center;
|
|
2925
3106
|
justify-content: center;
|
|
2926
|
-
cursor: pointer;
|
|
2927
|
-
|
|
2928
|
-
|
|
3107
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
|
|
3108
|
+
opacity: ${({ $disabled }) => $disabled ? 0.5 : 1};
|
|
3109
|
+
filter: ${({ $disabled }) => $disabled ? "grayscale(0.6)" : "none"};
|
|
3110
|
+
z-index: ${tokens.zIndex.fixed};
|
|
3111
|
+
transition: all ${tokens.transitions.fast};
|
|
2929
3112
|
|
|
2930
|
-
&:hover {
|
|
3113
|
+
&:hover:not([aria-disabled='true']) {
|
|
2931
3114
|
transform: scale(1.05);
|
|
2932
|
-
box-shadow:
|
|
3115
|
+
box-shadow: ${tokens.shadows.glow.accent};
|
|
2933
3116
|
}
|
|
2934
3117
|
|
|
2935
|
-
&:active {
|
|
3118
|
+
&:active:not([aria-disabled='true']) {
|
|
2936
3119
|
transform: scale(0.95);
|
|
2937
3120
|
}
|
|
2938
3121
|
|
|
2939
3122
|
svg {
|
|
2940
3123
|
width: 20px;
|
|
2941
3124
|
height: 20px;
|
|
2942
|
-
fill:
|
|
3125
|
+
fill: ${tokens.colors.text.primary};
|
|
2943
3126
|
}
|
|
2944
3127
|
`;
|
|
2945
|
-
var
|
|
2946
|
-
children
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
clickOutsideToClose = true,
|
|
2952
|
-
hitEscapeToClose = true,
|
|
2953
|
-
shortcut = "/",
|
|
2954
|
-
onSetOpen,
|
|
2955
|
-
className
|
|
2956
|
-
}) => {
|
|
2957
|
-
const HeaderAdapter = (_props) => {
|
|
3128
|
+
var WindowAdapter = (props) => {
|
|
3129
|
+
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
3130
|
+
};
|
|
3131
|
+
WindowAdapter.displayName = "WindowAdapter";
|
|
3132
|
+
function createHeaderAdapter(onSetOpen) {
|
|
3133
|
+
const HeaderAdapterWithClose = (_props) => {
|
|
2958
3134
|
const { setOpen } = useChatContext();
|
|
2959
3135
|
const handleClose = () => {
|
|
2960
3136
|
setOpen(false);
|
|
2961
3137
|
onSetOpen?.(false);
|
|
2962
3138
|
};
|
|
2963
|
-
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant",
|
|
2964
|
-
};
|
|
2965
|
-
const WindowAdapter2 = (props) => {
|
|
2966
|
-
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
2967
|
-
};
|
|
2968
|
-
const MessagesAdapter = (props) => {
|
|
2969
|
-
return /* @__PURE__ */ jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsx(
|
|
2970
|
-
props.RenderMessage,
|
|
2971
|
-
{
|
|
2972
|
-
message,
|
|
2973
|
-
inProgress: props.inProgress,
|
|
2974
|
-
index,
|
|
2975
|
-
isCurrentMessage: index === props.messages.length - 1
|
|
2976
|
-
},
|
|
2977
|
-
message.id || `message-${index}`
|
|
2978
|
-
)) });
|
|
3139
|
+
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", onClose: handleClose });
|
|
2979
3140
|
};
|
|
3141
|
+
HeaderAdapterWithClose.displayName = "HeaderAdapterWithClose";
|
|
3142
|
+
return HeaderAdapterWithClose;
|
|
3143
|
+
}
|
|
3144
|
+
function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
2980
3145
|
const CustomButton = (_props) => {
|
|
2981
3146
|
const { open, setOpen } = useChatContext();
|
|
2982
3147
|
const handleClick = () => {
|
|
3148
|
+
if (disabled) return;
|
|
2983
3149
|
const newOpenState = !open;
|
|
2984
3150
|
setOpen(newOpenState);
|
|
2985
3151
|
onSetOpen?.(newOpenState);
|
|
@@ -2988,8 +3154,11 @@ var CustomCopilotSidebar = ({
|
|
|
2988
3154
|
StyledChatButton,
|
|
2989
3155
|
{
|
|
2990
3156
|
onClick: handleClick,
|
|
2991
|
-
"aria-label": open ? "Close chat" : "Open chat",
|
|
3157
|
+
"aria-label": disabled ? disabledReason : open ? "Close chat" : "Open chat",
|
|
3158
|
+
"aria-disabled": disabled,
|
|
3159
|
+
title: disabled ? disabledReason : void 0,
|
|
2992
3160
|
type: "button",
|
|
3161
|
+
$disabled: disabled,
|
|
2993
3162
|
children: /* @__PURE__ */ jsxs(
|
|
2994
3163
|
"svg",
|
|
2995
3164
|
{
|
|
@@ -2999,7 +3168,7 @@ var CustomCopilotSidebar = ({
|
|
|
2999
3168
|
fill: "currentColor",
|
|
3000
3169
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3001
3170
|
role: "img",
|
|
3002
|
-
"aria-
|
|
3171
|
+
"aria-hidden": "true",
|
|
3003
3172
|
children: [
|
|
3004
3173
|
/* @__PURE__ */ jsx("title", { children: "Chat" }),
|
|
3005
3174
|
/* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" })
|
|
@@ -3009,229 +3178,151 @@ var CustomCopilotSidebar = ({
|
|
|
3009
3178
|
}
|
|
3010
3179
|
);
|
|
3011
3180
|
};
|
|
3012
|
-
|
|
3181
|
+
CustomButton.displayName = "CustomButton";
|
|
3182
|
+
return CustomButton;
|
|
3183
|
+
}
|
|
3184
|
+
function CustomCopilotSidebar({
|
|
3185
|
+
children,
|
|
3186
|
+
defaultOpen = false,
|
|
3187
|
+
onSetOpen,
|
|
3188
|
+
instructions,
|
|
3189
|
+
className,
|
|
3190
|
+
disabled = false,
|
|
3191
|
+
disabledReason = "Start a free trial to enable AI chat",
|
|
3192
|
+
onError,
|
|
3193
|
+
renderError,
|
|
3194
|
+
ThinkingIndicator,
|
|
3195
|
+
ToolCallsComponent,
|
|
3196
|
+
onReportIssue
|
|
3197
|
+
}) {
|
|
3198
|
+
const HeaderAdapterWithClose = useMemo(() => createHeaderAdapter(onSetOpen), [onSetOpen]);
|
|
3199
|
+
const CustomButton = useMemo(
|
|
3200
|
+
() => createButtonAdapter(disabled, disabledReason, onSetOpen),
|
|
3201
|
+
[disabled, disabledReason, onSetOpen]
|
|
3202
|
+
);
|
|
3203
|
+
const AssistantMessageAdapterMemo = useMemo(
|
|
3204
|
+
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(
|
|
3205
|
+
onReportIssue,
|
|
3206
|
+
ThinkingIndicator) : ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator) : AssistantMessageAdapter,
|
|
3207
|
+
[ThinkingIndicator, ToolCallsComponent, onReportIssue]
|
|
3208
|
+
);
|
|
3209
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "copilot-sidebar", children: [
|
|
3013
3210
|
/* @__PURE__ */ jsx(GlobalSidebarStyles, {}),
|
|
3014
3211
|
/* @__PURE__ */ jsx(
|
|
3015
3212
|
CopilotSidebar,
|
|
3016
3213
|
{
|
|
3017
|
-
AssistantMessage:
|
|
3214
|
+
AssistantMessage: AssistantMessageAdapterMemo,
|
|
3018
3215
|
UserMessage: UserMessageAdapter,
|
|
3019
3216
|
Input: InputAdapter,
|
|
3020
|
-
Header:
|
|
3021
|
-
Window:
|
|
3022
|
-
Messages: MessagesAdapter,
|
|
3217
|
+
Header: HeaderAdapterWithClose,
|
|
3218
|
+
Window: WindowAdapter,
|
|
3023
3219
|
Button: CustomButton,
|
|
3024
3220
|
instructions,
|
|
3025
3221
|
labels: {
|
|
3026
3222
|
title: "AI Assistant",
|
|
3027
|
-
initial: "Hi! How can I help you today?"
|
|
3028
|
-
...labels
|
|
3223
|
+
initial: "Hi! How can I help you today?"
|
|
3029
3224
|
},
|
|
3030
|
-
icons,
|
|
3031
3225
|
defaultOpen,
|
|
3032
|
-
clickOutsideToClose,
|
|
3033
|
-
hitEscapeToClose,
|
|
3034
|
-
shortcut,
|
|
3226
|
+
clickOutsideToClose: true,
|
|
3227
|
+
hitEscapeToClose: true,
|
|
3035
3228
|
onSetOpen,
|
|
3229
|
+
onError,
|
|
3230
|
+
renderError,
|
|
3036
3231
|
className,
|
|
3037
3232
|
children
|
|
3038
3233
|
}
|
|
3039
3234
|
)
|
|
3040
3235
|
] });
|
|
3041
|
-
}
|
|
3236
|
+
}
|
|
3042
3237
|
CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
|
|
3043
|
-
var
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3238
|
+
var MessagesContainer = styled9.div`
|
|
3239
|
+
display: flex;
|
|
3240
|
+
flex-direction: column;
|
|
3241
|
+
flex: 1;
|
|
3242
|
+
overflow: hidden;
|
|
3243
|
+
/* Gradient background - brand aligned */
|
|
3244
|
+
background: linear-gradient(
|
|
3245
|
+
to right bottom,
|
|
3246
|
+
${tokens.colors.background.dark},
|
|
3247
|
+
${tokens.colors.background.darker},
|
|
3248
|
+
${tokens.colors.background.darkest}
|
|
3249
|
+
);
|
|
3250
|
+
/* Minimal horizontal padding to maximize message width */
|
|
3251
|
+
padding: ${tokens.spacing.sm} ${tokens.spacing.xs};
|
|
3252
|
+
gap: ${tokens.spacing.sm};
|
|
3253
|
+
box-sizing: border-box;
|
|
3051
3254
|
|
|
3052
|
-
/*
|
|
3053
|
-
|
|
3255
|
+
/* Ensure proper scrolling behavior for child components */
|
|
3256
|
+
position: relative;
|
|
3257
|
+
min-height: 0;
|
|
3258
|
+
`;
|
|
3259
|
+
var Messages = ({
|
|
3260
|
+
children,
|
|
3261
|
+
className,
|
|
3262
|
+
ariaLabel = "Messages"
|
|
3263
|
+
}) => {
|
|
3264
|
+
return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
|
|
3265
|
+
};
|
|
3266
|
+
Messages.displayName = "Messages";
|
|
3267
|
+
var GlobalSidebarStyles2 = createGlobalStyle`
|
|
3268
|
+
/* Override CopilotKit's default positioning - start off-screen */
|
|
3054
3269
|
.copilotKitSidebar {
|
|
3055
3270
|
position: fixed !important;
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
left: calc(var(--safe-area-left, 0px) + 8px) !important;
|
|
3060
|
-
width: auto !important;
|
|
3061
|
-
height: auto !important;
|
|
3062
|
-
pointer-events: none !important;
|
|
3063
|
-
z-index: ${tokens.zIndex.fixed} !important;
|
|
3271
|
+
right: -100vw !important;
|
|
3272
|
+
bottom: 0 !important;
|
|
3273
|
+
transition: right 0.3s ease !important;
|
|
3064
3274
|
}
|
|
3065
3275
|
|
|
3066
|
-
/*
|
|
3276
|
+
/* Move sidebar container into view when expanded */
|
|
3067
3277
|
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {
|
|
3068
|
-
|
|
3278
|
+
right: 0 !important;
|
|
3069
3279
|
}
|
|
3070
3280
|
|
|
3071
|
-
/* Mobile-first:
|
|
3072
|
-
|
|
3073
|
-
.copilotKitSidebar [role="dialog"] {
|
|
3074
|
-
/* Override CopilotKit defaults for mobile */
|
|
3281
|
+
/* Mobile-first: Full viewport sidebar */
|
|
3282
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
3075
3283
|
position: fixed !important;
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
max-width: none !important;
|
|
3088
|
-
max-height: none !important;
|
|
3089
|
-
margin: 0 !important;
|
|
3090
|
-
border-radius: ${tokens.borderRadius.xl} !important;
|
|
3091
|
-
|
|
3092
|
-
/* Glassmorphism effect */
|
|
3093
|
-
background: ${tokens.colors.surface.glass} !important;
|
|
3094
|
-
box-shadow: ${tokens.shadows.lg} !important;
|
|
3095
|
-
backdrop-filter: blur(11.1px) !important;
|
|
3096
|
-
-webkit-backdrop-filter: blur(11.1px) !important;
|
|
3097
|
-
border: 1px solid ${tokens.colors.surface.glassBorder} !important;
|
|
3098
|
-
|
|
3099
|
-
/* Smooth slide transition */
|
|
3100
|
-
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
3101
|
-
z-index: ${tokens.zIndex.modal} !important;
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
|
-
/* Hidden by default */
|
|
3105
|
-
.copilotKitSidebarContentWrapper:not(.sidebarExpanded) .copilotKitSidebar [role="dialog"] {
|
|
3106
|
-
transform: translateX(100%) !important;
|
|
3107
|
-
visibility: hidden !important;
|
|
3108
|
-
pointer-events: none !important;
|
|
3109
|
-
opacity: 0 !important;
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
/* Visible when expanded */
|
|
3113
|
-
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar [role="dialog"] {
|
|
3114
|
-
transform: translateX(0) !important;
|
|
3115
|
-
visibility: visible !important;
|
|
3116
|
-
pointer-events: auto !important;
|
|
3117
|
-
opacity: 1 !important;
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3120
|
-
/* Desktop: Sidebar panel on the right with glassmorphism (640px = CopilotKit's breakpoint) */
|
|
3121
|
-
@media (min-width: ${tokens.breakpoints.mobile}px) {
|
|
3122
|
-
.copilotKitSidebar [role="dialog"] {
|
|
3123
|
-
inset: auto !important;
|
|
3124
|
-
/* TOP: Account for status bar safe area */
|
|
3125
|
-
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
3126
|
-
/* RIGHT: Account for landscape notch on right side */
|
|
3127
|
-
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
3128
|
-
/* BOTTOM: Account for horizontal navbar (52px) + safe area */
|
|
3129
|
-
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
3130
|
-
left: auto !important;
|
|
3131
|
-
width: 28rem !important;
|
|
3132
|
-
/* Let top + bottom define height — no explicit value needed */
|
|
3133
|
-
height: auto !important;
|
|
3134
|
-
max-width: 28rem !important;
|
|
3135
|
-
max-height: none !important;
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
/* Mobile landscape: sidebar on right side, allow background interaction */
|
|
3140
|
-
@media (orientation: landscape) and (max-height: 500px) {
|
|
3141
|
-
/* Account for vertical nav (60px) in landscape */
|
|
3142
|
-
.copilotKitSidebarContentWrapper {
|
|
3143
|
-
left: 60px !important;
|
|
3144
|
-
width: calc(100% - 60px) !important;
|
|
3145
|
-
}
|
|
3146
|
-
|
|
3147
|
-
/* Sidebar container covers right portion — full height, no gaps */
|
|
3148
|
-
.copilotKitSidebar {
|
|
3149
|
-
top: 0 !important;
|
|
3150
|
-
bottom: 0 !important;
|
|
3151
|
-
right: 0 !important;
|
|
3152
|
-
left: 50vw !important;
|
|
3153
|
-
width: auto !important;
|
|
3154
|
-
height: 100vh !important;
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
/* Offset the expanded sidebar wrapper to leave space for main content */
|
|
3158
|
-
.copilotKitSidebarContentWrapper.sidebarExpanded {
|
|
3159
|
-
margin-right: 30vw !important;
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3162
|
-
.copilotKitSidebar [role="dialog"] {
|
|
3163
|
-
width: min(50vw, 22rem) !important;
|
|
3164
|
-
max-width: min(50vw, 22rem) !important;
|
|
3165
|
-
left: auto !important;
|
|
3166
|
-
/* Flush with right edge — safe area handled via internal padding */
|
|
3167
|
-
right: 0 !important;
|
|
3168
|
-
/* Fill ALL vertical space — overlay the bottom nav for maximum chat area */
|
|
3169
|
-
/* Keep top safe area so dialog doesn't go behind status bar (battery/wifi) */
|
|
3170
|
-
top: var(--safe-area-top, 0px) !important;
|
|
3171
|
-
bottom: 0 !important;
|
|
3172
|
-
/* Let top/bottom define height */
|
|
3173
|
-
height: auto !important;
|
|
3174
|
-
max-height: none !important;
|
|
3175
|
-
margin: 0 !important;
|
|
3176
|
-
/* Only round the left edges since right is flush with viewport */
|
|
3177
|
-
border-radius: 0 !important;
|
|
3178
|
-
border-top-left-radius: ${tokens.borderRadius.xl} !important;
|
|
3179
|
-
border-bottom-left-radius: ${tokens.borderRadius.xl} !important;
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
/* Compact header in landscape - hide title text but keep close button */
|
|
3183
|
-
/* Safe area top padding applied here so content avoids status bar */
|
|
3184
|
-
.copilotKitSidebar [role="dialog"] header,
|
|
3185
|
-
.copilotKitSidebar [role="dialog"] [data-testid="chat-header"],
|
|
3186
|
-
.copilotKitSidebar [role="dialog"] > div:first-child {
|
|
3187
|
-
padding: 0.25rem 0.5rem 0.25rem !important;
|
|
3188
|
-
min-height: auto !important;
|
|
3189
|
-
height: auto !important;
|
|
3190
|
-
padding-right: calc(1.5rem + var(--safe-area-right, 0px)) !important;
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
|
-
/* Hide the title text but keep close button visible */
|
|
3194
|
-
.copilotKitSidebar [role="dialog"] header h1,
|
|
3195
|
-
.copilotKitSidebar [role="dialog"] header h2,
|
|
3196
|
-
.copilotKitSidebar [role="dialog"] header span:not(:last-child),
|
|
3197
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > span,
|
|
3198
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > h1,
|
|
3199
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > h2 {
|
|
3200
|
-
display: none !important;
|
|
3201
|
-
}
|
|
3202
|
-
|
|
3203
|
-
/* Reduce vertical padding inside chat — right safe area for notch */
|
|
3204
|
-
.copilotKitMessages {
|
|
3205
|
-
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
|
|
3206
|
-
}
|
|
3207
|
-
|
|
3208
|
-
.copilotKitMessage {
|
|
3209
|
-
padding: ${tokens.spacing.xs} 0 !important;
|
|
3210
|
-
margin: ${tokens.spacing.xs} 0 !important;
|
|
3211
|
-
}
|
|
3284
|
+
top: 0 !important;
|
|
3285
|
+
right: 0 !important;
|
|
3286
|
+
bottom: 0 !important;
|
|
3287
|
+
left: auto !important;
|
|
3288
|
+
width: 100vw !important;
|
|
3289
|
+
height: 100vh !important;
|
|
3290
|
+
max-width: 100vw !important;
|
|
3291
|
+
max-height: 100vh !important;
|
|
3292
|
+
margin: 0 !important;
|
|
3293
|
+
border-radius: 0 !important;
|
|
3294
|
+
z-index: 1001 !important;
|
|
3212
3295
|
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3296
|
+
transform: translateX(100%) !important;
|
|
3297
|
+
visibility: hidden !important;
|
|
3298
|
+
pointer-events: none !important;
|
|
3299
|
+
opacity: 0 !important;
|
|
3300
|
+
display: none !important;
|
|
3218
3301
|
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) calc(${tokens.spacing.xs} + var(--safe-area-bottom, 0px)) ${tokens.spacing.sm} !important;
|
|
3222
|
-
}
|
|
3302
|
+
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
3303
|
+
}
|
|
3223
3304
|
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3305
|
+
/* When window has .open class (CopilotKit's native class), show it */
|
|
3306
|
+
.copilotKitSidebar .copilotKitWindow.open {
|
|
3307
|
+
display: flex !important;
|
|
3308
|
+
transform: translateX(0) !important;
|
|
3309
|
+
visibility: visible !important;
|
|
3310
|
+
pointer-events: auto !important;
|
|
3311
|
+
opacity: 1 !important;
|
|
3312
|
+
}
|
|
3231
3313
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3314
|
+
/* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */
|
|
3315
|
+
@media (min-width: 640px) {
|
|
3316
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
3317
|
+
inset: auto !important;
|
|
3318
|
+
top: 0 !important;
|
|
3319
|
+
right: 0 !important;
|
|
3320
|
+
bottom: 0 !important;
|
|
3321
|
+
left: auto !important;
|
|
3322
|
+
width: 28rem !important;
|
|
3323
|
+
height: 100vh !important;
|
|
3324
|
+
max-width: 28rem !important;
|
|
3325
|
+
max-height: 100vh !important;
|
|
3235
3326
|
}
|
|
3236
3327
|
}
|
|
3237
3328
|
|
|
@@ -3251,131 +3342,106 @@ var GlobalSidebarStyles2 = createGlobalStyle`
|
|
|
3251
3342
|
}
|
|
3252
3343
|
}
|
|
3253
3344
|
|
|
3254
|
-
/*
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
z-index: 2000 !important;
|
|
3262
|
-
}
|
|
3345
|
+
/* Override CopilotKit's default message styles with our custom components */
|
|
3346
|
+
.copilotKitSidebar {
|
|
3347
|
+
/* Reset all default CopilotKit message styling */
|
|
3348
|
+
[class*="copilotKitMessage"],
|
|
3349
|
+
[class*="Message-module"] {
|
|
3350
|
+
all: unset !important;
|
|
3351
|
+
display: contents !important;
|
|
3263
3352
|
}
|
|
3264
|
-
}
|
|
3265
|
-
|
|
3266
|
-
/* Fix messages container background */
|
|
3267
|
-
.copilotKitMessages {
|
|
3268
|
-
background-color: transparent !important;
|
|
3269
|
-
}
|
|
3270
|
-
|
|
3271
|
-
/* Performance optimization for messages - no animations to reduce jitter during streaming */
|
|
3272
|
-
.copilotKitMessage {
|
|
3273
|
-
/* contain: content isolates layout/paint to this element */
|
|
3274
|
-
contain: content;
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
|
-
/* Override CopilotKit suggestions to be single-row with horizontal scroll */
|
|
3278
|
-
div[role="list"][aria-label*="Suggested"] {
|
|
3279
|
-
display: flex !important;
|
|
3280
|
-
flex-wrap: nowrap !important; /* Force single row */
|
|
3281
|
-
gap: ${tokens.spacing.sm} !important;
|
|
3282
|
-
padding: ${tokens.spacing.xs} 0 !important;
|
|
3283
|
-
|
|
3284
|
-
/* Horizontal scrolling */
|
|
3285
|
-
overflow-x: auto !important;
|
|
3286
|
-
overflow-y: hidden !important;
|
|
3287
|
-
|
|
3288
|
-
/* Smooth scrolling */
|
|
3289
|
-
-webkit-overflow-scrolling: touch;
|
|
3290
|
-
scroll-behavior: smooth;
|
|
3291
|
-
|
|
3292
|
-
/* Fixed height for one suggestion */
|
|
3293
|
-
max-height: 40px !important;
|
|
3294
|
-
min-height: 40px !important;
|
|
3295
|
-
align-items: center !important;
|
|
3296
|
-
|
|
3297
|
-
/* Hide scrollbar */
|
|
3298
|
-
scrollbar-width: none !important;
|
|
3299
|
-
-ms-overflow-style: none !important;
|
|
3300
3353
|
|
|
3301
|
-
|
|
3302
|
-
|
|
3354
|
+
/* Ensure our custom UserMessage gradient pill shows through */
|
|
3355
|
+
button[role="presentation"] {
|
|
3356
|
+
all: revert !important;
|
|
3357
|
+
display: inline-flex !important;
|
|
3303
3358
|
}
|
|
3304
|
-
}
|
|
3305
3359
|
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3360
|
+
/* Reset input styles to allow our custom ChatInput */
|
|
3361
|
+
[class*="Input-module"],
|
|
3362
|
+
[class*="copilotKitInput"] {
|
|
3363
|
+
all: unset !important;
|
|
3364
|
+
display: contents !important;
|
|
3365
|
+
}
|
|
3311
3366
|
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
.copilotKitSidebar textarea:focus-visible {
|
|
3319
|
-
outline: none !important;
|
|
3320
|
-
outline-color: transparent !important;
|
|
3321
|
-
box-shadow: none !important;
|
|
3367
|
+
/* Reset header styles */
|
|
3368
|
+
[class*="Header-module"],
|
|
3369
|
+
[class*="copilotKitHeader"] {
|
|
3370
|
+
all: unset !important;
|
|
3371
|
+
display: contents !important;
|
|
3372
|
+
}
|
|
3322
3373
|
}
|
|
3323
3374
|
`;
|
|
3324
3375
|
var StyledChatButton2 = styled9.button`
|
|
3325
3376
|
position: fixed;
|
|
3326
|
-
bottom:
|
|
3327
|
-
right:
|
|
3377
|
+
bottom: 8px;
|
|
3378
|
+
right: 8px;
|
|
3328
3379
|
width: 36px;
|
|
3329
3380
|
height: 36px;
|
|
3330
|
-
border-radius:
|
|
3381
|
+
border-radius: 18px;
|
|
3331
3382
|
border: none;
|
|
3332
3383
|
background: linear-gradient(135deg, ${tokens.colors.primary} 0%, ${tokens.colors.accent} 100%);
|
|
3333
|
-
box-shadow:
|
|
3384
|
+
box-shadow: 0 4px 12px rgba(44, 176, 171, 0.4);
|
|
3334
3385
|
display: flex;
|
|
3335
3386
|
align-items: center;
|
|
3336
3387
|
justify-content: center;
|
|
3337
|
-
cursor:
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
z-index: ${tokens.zIndex.fixed};
|
|
3341
|
-
transition: all ${tokens.transitions.fast};
|
|
3388
|
+
cursor: pointer;
|
|
3389
|
+
z-index: 1000;
|
|
3390
|
+
transition: all 0.2s ease;
|
|
3342
3391
|
|
|
3343
|
-
&:hover
|
|
3392
|
+
&:hover {
|
|
3344
3393
|
transform: scale(1.05);
|
|
3345
|
-
box-shadow:
|
|
3394
|
+
box-shadow: 0 6px 16px rgba(44, 176, 171, 0.5);
|
|
3346
3395
|
}
|
|
3347
3396
|
|
|
3348
|
-
&:active
|
|
3397
|
+
&:active {
|
|
3349
3398
|
transform: scale(0.95);
|
|
3350
3399
|
}
|
|
3351
3400
|
|
|
3352
3401
|
svg {
|
|
3353
3402
|
width: 20px;
|
|
3354
3403
|
height: 20px;
|
|
3355
|
-
fill:
|
|
3404
|
+
fill: white;
|
|
3356
3405
|
}
|
|
3357
3406
|
`;
|
|
3358
|
-
var
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3407
|
+
var CustomCopilotSidebar2 = ({
|
|
3408
|
+
children,
|
|
3409
|
+
instructions = "You are a helpful AI assistant.",
|
|
3410
|
+
labels,
|
|
3411
|
+
icons,
|
|
3412
|
+
defaultOpen = false,
|
|
3413
|
+
clickOutsideToClose = true,
|
|
3414
|
+
hitEscapeToClose = true,
|
|
3415
|
+
shortcut = "/",
|
|
3416
|
+
onSetOpen,
|
|
3417
|
+
className
|
|
3418
|
+
}) => {
|
|
3419
|
+
const HeaderAdapter = (_props) => {
|
|
3364
3420
|
const { setOpen } = useChatContext();
|
|
3365
3421
|
const handleClose = () => {
|
|
3366
3422
|
setOpen(false);
|
|
3367
3423
|
onSetOpen?.(false);
|
|
3368
3424
|
};
|
|
3369
|
-
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", onClose: handleClose });
|
|
3425
|
+
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
|
|
3426
|
+
};
|
|
3427
|
+
const WindowAdapter2 = (props) => {
|
|
3428
|
+
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
3429
|
+
};
|
|
3430
|
+
const MessagesAdapter = (props) => {
|
|
3431
|
+
return /* @__PURE__ */ jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsx(
|
|
3432
|
+
props.RenderMessage,
|
|
3433
|
+
{
|
|
3434
|
+
message,
|
|
3435
|
+
inProgress: props.inProgress,
|
|
3436
|
+
index,
|
|
3437
|
+
isCurrentMessage: index === props.messages.length - 1
|
|
3438
|
+
},
|
|
3439
|
+
message.id || `message-${index}`
|
|
3440
|
+
)) });
|
|
3370
3441
|
};
|
|
3371
|
-
HeaderAdapterWithClose.displayName = "HeaderAdapterWithClose";
|
|
3372
|
-
return HeaderAdapterWithClose;
|
|
3373
|
-
}
|
|
3374
|
-
function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
3375
3442
|
const CustomButton = (_props) => {
|
|
3376
3443
|
const { open, setOpen } = useChatContext();
|
|
3377
3444
|
const handleClick = () => {
|
|
3378
|
-
if (disabled) return;
|
|
3379
3445
|
const newOpenState = !open;
|
|
3380
3446
|
setOpen(newOpenState);
|
|
3381
3447
|
onSetOpen?.(newOpenState);
|
|
@@ -3384,11 +3450,8 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3384
3450
|
StyledChatButton2,
|
|
3385
3451
|
{
|
|
3386
3452
|
onClick: handleClick,
|
|
3387
|
-
"aria-label":
|
|
3388
|
-
"aria-disabled": disabled,
|
|
3389
|
-
title: disabled ? disabledReason : void 0,
|
|
3453
|
+
"aria-label": open ? "Close chat" : "Open chat",
|
|
3390
3454
|
type: "button",
|
|
3391
|
-
$disabled: disabled,
|
|
3392
3455
|
children: /* @__PURE__ */ jsxs(
|
|
3393
3456
|
"svg",
|
|
3394
3457
|
{
|
|
@@ -3398,7 +3461,7 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3398
3461
|
fill: "currentColor",
|
|
3399
3462
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3400
3463
|
role: "img",
|
|
3401
|
-
"aria-
|
|
3464
|
+
"aria-label": "Chat icon",
|
|
3402
3465
|
children: [
|
|
3403
3466
|
/* @__PURE__ */ jsx("title", { children: "Chat" }),
|
|
3404
3467
|
/* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" })
|
|
@@ -3408,62 +3471,36 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3408
3471
|
}
|
|
3409
3472
|
);
|
|
3410
3473
|
};
|
|
3411
|
-
|
|
3412
|
-
return CustomButton;
|
|
3413
|
-
}
|
|
3414
|
-
function CustomCopilotSidebar2({
|
|
3415
|
-
children,
|
|
3416
|
-
defaultOpen = false,
|
|
3417
|
-
onSetOpen,
|
|
3418
|
-
instructions,
|
|
3419
|
-
className,
|
|
3420
|
-
disabled = false,
|
|
3421
|
-
disabledReason = "Start a free trial to enable AI chat",
|
|
3422
|
-
onError,
|
|
3423
|
-
renderError,
|
|
3424
|
-
ThinkingIndicator,
|
|
3425
|
-
ToolCallsComponent,
|
|
3426
|
-
onReportIssue
|
|
3427
|
-
}) {
|
|
3428
|
-
const HeaderAdapterWithClose = useMemo(() => createHeaderAdapter(onSetOpen), [onSetOpen]);
|
|
3429
|
-
const CustomButton = useMemo(
|
|
3430
|
-
() => createButtonAdapter(disabled, disabledReason, onSetOpen),
|
|
3431
|
-
[disabled, disabledReason, onSetOpen]
|
|
3432
|
-
);
|
|
3433
|
-
const AssistantMessageAdapterMemo = useMemo(
|
|
3434
|
-
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(
|
|
3435
|
-
onReportIssue,
|
|
3436
|
-
ThinkingIndicator) : ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator) : AssistantMessageAdapter,
|
|
3437
|
-
[ThinkingIndicator, ToolCallsComponent, onReportIssue]
|
|
3438
|
-
);
|
|
3439
|
-
return /* @__PURE__ */ jsxs("div", { "data-testid": "copilot-sidebar", children: [
|
|
3474
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3440
3475
|
/* @__PURE__ */ jsx(GlobalSidebarStyles2, {}),
|
|
3441
3476
|
/* @__PURE__ */ jsx(
|
|
3442
3477
|
CopilotSidebar,
|
|
3443
3478
|
{
|
|
3444
|
-
AssistantMessage:
|
|
3479
|
+
AssistantMessage: AssistantMessageAdapter,
|
|
3445
3480
|
UserMessage: UserMessageAdapter,
|
|
3446
3481
|
Input: InputAdapter,
|
|
3447
|
-
Header:
|
|
3448
|
-
Window:
|
|
3482
|
+
Header: HeaderAdapter,
|
|
3483
|
+
Window: WindowAdapter2,
|
|
3484
|
+
Messages: MessagesAdapter,
|
|
3449
3485
|
Button: CustomButton,
|
|
3450
3486
|
instructions,
|
|
3451
3487
|
labels: {
|
|
3452
3488
|
title: "AI Assistant",
|
|
3453
|
-
initial: "Hi! How can I help you today?"
|
|
3489
|
+
initial: "Hi! How can I help you today?",
|
|
3490
|
+
...labels
|
|
3454
3491
|
},
|
|
3492
|
+
icons,
|
|
3455
3493
|
defaultOpen,
|
|
3456
|
-
clickOutsideToClose
|
|
3457
|
-
hitEscapeToClose
|
|
3494
|
+
clickOutsideToClose,
|
|
3495
|
+
hitEscapeToClose,
|
|
3496
|
+
shortcut,
|
|
3458
3497
|
onSetOpen,
|
|
3459
|
-
onError,
|
|
3460
|
-
renderError,
|
|
3461
3498
|
className,
|
|
3462
3499
|
children
|
|
3463
3500
|
}
|
|
3464
3501
|
)
|
|
3465
3502
|
] });
|
|
3466
|
-
}
|
|
3503
|
+
};
|
|
3467
3504
|
CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
|
|
3468
3505
|
var FooterContainer = styled9.footer`
|
|
3469
3506
|
display: flex;
|
|
@@ -4275,6 +4312,6 @@ function SuggestionChip({ suggestion, onSelect }) {
|
|
|
4275
4312
|
}
|
|
4276
4313
|
Suggestions.displayName = "Suggestions";
|
|
4277
4314
|
|
|
4278
|
-
export { ActionExecutionAdapter, Actions, AgentState, AssistantMessage, AssistantMessageAdapter, Button,
|
|
4315
|
+
export { ActionExecutionAdapter, Actions, AgentState, AssistantMessage, AssistantMessageAdapter, Button, CustomCopilotSidebar, FileAttachment, Footer, Header, Input, InputAdapter, CustomCopilotSidebar2 as IntegratedSidebar, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, StreamErrorMessage, StreamStatusIndicator, StreamingText2 as StreamingText, Suggestions, UserMessage2 as UserMessage, UserMessageAdapter, Window, clearToolCalls, registerToolCall, useChatContext };
|
|
4279
4316
|
//# sourceMappingURL=index.js.map
|
|
4280
4317
|
//# sourceMappingURL=index.js.map
|