@agentiffai/design 0.1.9 → 0.1.11

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.
@@ -1,5 +1,6 @@
1
- export { A as Action, c as ActionVariant, d as Actions, a as ActionsLayout, b as ActionsProps, f as AgentState, e as AgentStateProps, q as AssistantMessage, m as AssistantMessageProps, i as Button, B as ButtonProps, g as ButtonSize, h as ButtonVariant, r as FileAttachment, n as FileAttachmentProps, j as Footer, F as FooterProps, k as Header, H as HeaderProps, l as Input, I as InputProps, M as Message, s as Messages, t as MessagesList, u as MessagesListContainer, v as MessagesListContent, o as MessagesListProps, p as MessagesProps, x as Response, R as ResponseProps, y as StreamErrorMessage, S as StreamErrorMessageProps, E as StreamStatusIndicator, D as StreamStatusIndicatorProps, C as StreamingText, z as StreamingTextProps, J as Suggestions, G as SuggestionsProps, w as UserMessage, U as UserMessageProps, K as Window, W as WindowProps } from '../Window-CF5y1_Og.cjs';
1
+ export { A as Action, c as ActionVariant, d as Actions, a as ActionsLayout, b as ActionsProps, f as AgentState, e as AgentStateProps, q as AssistantMessage, m as AssistantMessageProps, i as Button, B as ButtonProps, g as ButtonSize, h as ButtonVariant, r as FileAttachment, n as FileAttachmentProps, j as Footer, F as FooterProps, k as Header, H as HeaderProps, l as Input, I as InputProps, M as Message, s as Messages, t as MessagesList, u as MessagesListContainer, v as MessagesListContent, o as MessagesListProps, p as MessagesProps, x as Response, R as ResponseProps, y as StreamErrorMessage, S as StreamErrorMessageProps, E as StreamStatusIndicator, D as StreamStatusIndicatorProps, C as StreamingText, z as StreamingTextProps, J as Suggestions, G as SuggestionsProps, w as UserMessage, U as UserMessageProps, K as Window, W as WindowProps } from '../Window-BcTRumpc.cjs';
2
2
  import { RenderMessageProps, AssistantMessageProps, InputProps, UserMessageProps } from '@copilotkit/react-ui';
3
+ import * as React from 'react';
3
4
  import React__default, { ReactNode } from 'react';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import '@react-aria/button';
@@ -25,19 +26,7 @@ import 'styled-components/dist/types';
25
26
  */
26
27
  declare const ActionExecutionAdapter: React__default.FC<RenderMessageProps>;
27
28
 
28
- /**
29
- * Adapter component that bridges custom AssistantMessage with CopilotKit's expected interface
30
- *
31
- * This adapter:
32
- * 1. Converts CopilotKit's AssistantMessageProps to our custom component props
33
- * 2. Handles loading states by showing AssistantThinking component
34
- * 3. Extracts message content and renders with our styled component
35
- */
36
-
37
- /**
38
- * Adapter that converts CopilotKit's AssistantMessageProps to our custom component
39
- */
40
- declare const AssistantMessageAdapter: React__default.FC<AssistantMessageProps>;
29
+ declare const AssistantMessageAdapter: React.NamedExoticComponent<AssistantMessageProps>;
41
30
 
42
31
  /**
43
32
  * Adapter component that bridges custom Input with CopilotKit's expected interface
@@ -53,19 +42,7 @@ declare const AssistantMessageAdapter: React__default.FC<AssistantMessageProps>;
53
42
  */
54
43
  declare const InputAdapter: React__default.FC<InputProps>;
55
44
 
56
- /**
57
- * Adapter component that bridges custom UserMessage with CopilotKit's expected interface
58
- *
59
- * This adapter:
60
- * 1. Converts CopilotKit's UserMessageProps to our custom component props
61
- * 2. Extracts message content from CopilotKit's message object
62
- * 3. Handles image messages appropriately
63
- */
64
-
65
- /**
66
- * Adapter that converts CopilotKit's UserMessageProps to our custom component
67
- */
68
- declare const UserMessageAdapter: React__default.FC<UserMessageProps>;
45
+ declare const UserMessageAdapter: React.NamedExoticComponent<UserMessageProps>;
69
46
 
70
47
  /**
71
48
  * Complete CopilotSidebar Integration Example
@@ -1,5 +1,6 @@
1
- export { A as Action, c as ActionVariant, d as Actions, a as ActionsLayout, b as ActionsProps, f as AgentState, e as AgentStateProps, q as AssistantMessage, m as AssistantMessageProps, i as Button, B as ButtonProps, g as ButtonSize, h as ButtonVariant, r as FileAttachment, n as FileAttachmentProps, j as Footer, F as FooterProps, k as Header, H as HeaderProps, l as Input, I as InputProps, M as Message, s as Messages, t as MessagesList, u as MessagesListContainer, v as MessagesListContent, o as MessagesListProps, p as MessagesProps, x as Response, R as ResponseProps, y as StreamErrorMessage, S as StreamErrorMessageProps, E as StreamStatusIndicator, D as StreamStatusIndicatorProps, C as StreamingText, z as StreamingTextProps, J as Suggestions, G as SuggestionsProps, w as UserMessage, U as UserMessageProps, K as Window, W as WindowProps } from '../Window-CF5y1_Og.js';
1
+ export { A as Action, c as ActionVariant, d as Actions, a as ActionsLayout, b as ActionsProps, f as AgentState, e as AgentStateProps, q as AssistantMessage, m as AssistantMessageProps, i as Button, B as ButtonProps, g as ButtonSize, h as ButtonVariant, r as FileAttachment, n as FileAttachmentProps, j as Footer, F as FooterProps, k as Header, H as HeaderProps, l as Input, I as InputProps, M as Message, s as Messages, t as MessagesList, u as MessagesListContainer, v as MessagesListContent, o as MessagesListProps, p as MessagesProps, x as Response, R as ResponseProps, y as StreamErrorMessage, S as StreamErrorMessageProps, E as StreamStatusIndicator, D as StreamStatusIndicatorProps, C as StreamingText, z as StreamingTextProps, J as Suggestions, G as SuggestionsProps, w as UserMessage, U as UserMessageProps, K as Window, W as WindowProps } from '../Window-BcTRumpc.js';
2
2
  import { RenderMessageProps, AssistantMessageProps, InputProps, UserMessageProps } from '@copilotkit/react-ui';
3
+ import * as React from 'react';
3
4
  import React__default, { ReactNode } from 'react';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import '@react-aria/button';
@@ -25,19 +26,7 @@ import 'styled-components/dist/types';
25
26
  */
26
27
  declare const ActionExecutionAdapter: React__default.FC<RenderMessageProps>;
27
28
 
28
- /**
29
- * Adapter component that bridges custom AssistantMessage with CopilotKit's expected interface
30
- *
31
- * This adapter:
32
- * 1. Converts CopilotKit's AssistantMessageProps to our custom component props
33
- * 2. Handles loading states by showing AssistantThinking component
34
- * 3. Extracts message content and renders with our styled component
35
- */
36
-
37
- /**
38
- * Adapter that converts CopilotKit's AssistantMessageProps to our custom component
39
- */
40
- declare const AssistantMessageAdapter: React__default.FC<AssistantMessageProps>;
29
+ declare const AssistantMessageAdapter: React.NamedExoticComponent<AssistantMessageProps>;
41
30
 
42
31
  /**
43
32
  * Adapter component that bridges custom Input with CopilotKit's expected interface
@@ -53,19 +42,7 @@ declare const AssistantMessageAdapter: React__default.FC<AssistantMessageProps>;
53
42
  */
54
43
  declare const InputAdapter: React__default.FC<InputProps>;
55
44
 
56
- /**
57
- * Adapter component that bridges custom UserMessage with CopilotKit's expected interface
58
- *
59
- * This adapter:
60
- * 1. Converts CopilotKit's UserMessageProps to our custom component props
61
- * 2. Extracts message content from CopilotKit's message object
62
- * 3. Handles image messages appropriately
63
- */
64
-
65
- /**
66
- * Adapter that converts CopilotKit's UserMessageProps to our custom component
67
- */
68
- declare const UserMessageAdapter: React__default.FC<UserMessageProps>;
45
+ declare const UserMessageAdapter: React.NamedExoticComponent<UserMessageProps>;
69
46
 
70
47
  /**
71
48
  * Complete CopilotSidebar Integration Example
@@ -1,7 +1,7 @@
1
1
  import { useButton } from '@react-aria/button';
2
- import { useRef, useState, useEffect } from 'react';
2
+ import { memo, useState, useRef, useEffect } from 'react';
3
3
  import styled4, { css, keyframes, createGlobalStyle } from 'styled-components';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { useTextField } from '@react-aria/textfield';
6
6
  import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
7
7
 
@@ -836,7 +836,7 @@ var Cursor = styled4.span`
836
836
  }
837
837
  }
838
838
  `;
839
- var StreamingText2 = ({
839
+ var StreamingTextBase = ({
840
840
  content,
841
841
  isStreaming = false,
842
842
  typingSpeed: _typingSpeed = 50,
@@ -846,25 +846,27 @@ var StreamingText2 = ({
846
846
  onStreamComplete,
847
847
  className
848
848
  }) => {
849
- const [displayedText, setDisplayedText] = useState("");
849
+ const [displayedText, setDisplayedText] = useState(content);
850
+ const wasStreamingRef = useRef(isStreaming);
851
+ const completionCalledRef = useRef(false);
850
852
  useEffect(() => {
851
- if (isStreaming) {
852
- setDisplayedText(content);
853
- return;
853
+ setDisplayedText(content);
854
+ if (wasStreamingRef.current && !isStreaming && !completionCalledRef.current) {
855
+ completionCalledRef.current = true;
856
+ onStreamComplete?.();
854
857
  }
855
- if (!isStreaming && displayedText !== content) {
856
- setDisplayedText(content);
857
- if (onStreamComplete) {
858
- onStreamComplete();
859
- }
858
+ if (isStreaming) {
859
+ completionCalledRef.current = false;
860
860
  }
861
- }, [content, isStreaming, onStreamComplete, displayedText]);
861
+ wasStreamingRef.current = isStreaming;
862
+ }, [content, isStreaming, onStreamComplete]);
862
863
  const showCursor = isStreaming && cursor;
863
864
  return /* @__PURE__ */ jsxs(Container3, { variant, className, children: [
864
865
  displayedText,
865
866
  showCursor && /* @__PURE__ */ jsx(Cursor, {})
866
867
  ] });
867
868
  };
869
+ var StreamingText2 = memo(StreamingTextBase);
868
870
  StreamingText2.displayName = "StreamingText";
869
871
  var MessageContainer = styled4.div`
870
872
  display: flex;
@@ -1152,7 +1154,7 @@ var StreamingIndicator = styled4.span`
1152
1154
  }
1153
1155
  }
1154
1156
  `;
1155
- var AssistantMessage = ({
1157
+ var AssistantMessageBase = ({
1156
1158
  content = "",
1157
1159
  avatarUrl,
1158
1160
  avatarInitials: _avatarInitials = "AI",
@@ -1199,7 +1201,9 @@ var AssistantMessage = ({
1199
1201
  /* @__PURE__ */ jsx(ContentContainer, { children: renderContent() })
1200
1202
  ] });
1201
1203
  };
1202
- var AssistantMessageAdapter = ({
1204
+ var AssistantMessage = memo(AssistantMessageBase);
1205
+ AssistantMessage.displayName = "AssistantMessage";
1206
+ var AssistantMessageAdapterBase = ({
1203
1207
  message,
1204
1208
  isLoading,
1205
1209
  isGenerating
@@ -1229,6 +1233,7 @@ var AssistantMessageAdapter = ({
1229
1233
  }
1230
1234
  );
1231
1235
  };
1236
+ var AssistantMessageAdapter = memo(AssistantMessageAdapterBase);
1232
1237
  AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
1233
1238
  var ChatInputContainer = styled4.div`
1234
1239
  display: flex;
@@ -1668,7 +1673,7 @@ var StyledUserMessage = styled4.button`
1668
1673
  }
1669
1674
  }
1670
1675
  `;
1671
- function UserMessage({
1676
+ function UserMessageBase({
1672
1677
  children,
1673
1678
  className,
1674
1679
  isPressed = false,
@@ -1699,6 +1704,7 @@ function UserMessage({
1699
1704
  }
1700
1705
  );
1701
1706
  }
1707
+ var UserMessage = memo(UserMessageBase);
1702
1708
  UserMessage.displayName = "UserMessage";
1703
1709
  var UserMessageWrapper = styled4.div`
1704
1710
  display: flex;
@@ -1720,7 +1726,7 @@ var UserMessageWrapper = styled4.div`
1720
1726
  }
1721
1727
  }
1722
1728
  `;
1723
- var UserMessageAdapter = ({
1729
+ var UserMessageAdapterBase = ({
1724
1730
  message,
1725
1731
  ImageRenderer
1726
1732
  }) => {
@@ -1730,6 +1736,7 @@ var UserMessageAdapter = ({
1730
1736
  const content = message?.content || "";
1731
1737
  return /* @__PURE__ */ jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsx(UserMessage, { children: content }) });
1732
1738
  };
1739
+ var UserMessageAdapter = memo(UserMessageAdapterBase);
1733
1740
  UserMessageAdapter.displayName = "UserMessageAdapter";
1734
1741
  var pulse2 = keyframes`
1735
1742
  0%, 100% {
@@ -2454,16 +2461,24 @@ var CustomCopilotSidebar = ({
2454
2461
  };
2455
2462
  CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
2456
2463
  var GlobalSidebarStyles2 = createGlobalStyle`
2464
+ /* Override CopilotKit's content wrapper to respect safe areas in landscape */
2465
+ @media (orientation: landscape) {
2466
+ .copilotKitSidebarContentWrapper {
2467
+ right: env(safe-area-inset-right, 0px) !important;
2468
+ left: env(safe-area-inset-left, 0px) !important;
2469
+ }
2470
+ }
2471
+
2457
2472
  /* Override CopilotKit's default positioning - keep sidebar container in place */
2458
2473
  /* z-index must be higher than NavHorizontal (sticky: 1020) for button to show above nav */
2459
2474
  .copilotKitSidebar {
2460
2475
  position: fixed !important;
2461
- top: 0 !important;
2462
- right: 0 !important;
2463
- bottom: 0 !important;
2464
- left: 0 !important;
2465
- width: 100vw !important;
2466
- height: 100vh !important;
2476
+ top: calc(var(--safe-area-top, 0px) + 8px) !important;
2477
+ right: calc(var(--safe-area-right, 0px) + 8px) !important;
2478
+ bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
2479
+ left: calc(var(--safe-area-left, 0px) + 8px) !important;
2480
+ width: auto !important;
2481
+ height: auto !important;
2467
2482
  pointer-events: none !important;
2468
2483
  z-index: ${tokens.zIndex.fixed} !important;
2469
2484
  }
@@ -2478,16 +2493,19 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2478
2493
  .copilotKitSidebar [role="dialog"] {
2479
2494
  /* Override CopilotKit defaults for mobile */
2480
2495
  position: fixed !important;
2481
- top: ${tokens.spacing.sm} !important;
2482
- right: ${tokens.spacing.sm} !important;
2483
- /* Reserve space for Android nav buttons - matches NavHorizontal approach */
2484
- bottom: max(90px, env(safe-area-inset-bottom, 90px)) !important;
2485
- left: ${tokens.spacing.sm} !important;
2486
- width: calc(100vw - ${tokens.spacing.lg}) !important;
2487
- /* Adjust height to account for bottom safe area */
2488
- height: calc(100vh - ${tokens.spacing.lg} - max(80px, env(safe-area-inset-bottom, 80px))) !important;
2489
- max-width: calc(100vw - ${tokens.spacing.lg}) !important;
2490
- max-height: calc(100vh - ${tokens.spacing.lg} - max(80px, env(safe-area-inset-bottom, 80px))) !important;
2496
+ /* TOP: Account for status bar safe area (Android notch/status bar) */
2497
+ top: calc(${tokens.spacing.sm} + env(safe-area-inset-top, 0px)) !important;
2498
+ /* RIGHT: Account for landscape notch on right side */
2499
+ right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px)) !important;
2500
+ /* BOTTOM: Account for horizontal navbar (52px) + safe area for Android nav buttons */
2501
+ bottom: calc(52px + ${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px)) !important;
2502
+ /* LEFT: Account for landscape notch on left side */
2503
+ left: calc(${tokens.spacing.sm} + env(safe-area-inset-left, 0px)) !important;
2504
+ width: calc(100vw - ${tokens.spacing.lg} - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
2505
+ /* Adjust height to account for top, bottom safe areas, and navbar */
2506
+ height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2507
+ max-width: calc(100vw - ${tokens.spacing.lg} - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
2508
+ max-height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2491
2509
  margin: 0 !important;
2492
2510
  border-radius: ${tokens.borderRadius.xl} !important;
2493
2511
 
@@ -2523,16 +2541,18 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2523
2541
  @media (min-width: ${tokens.breakpoints.mobile}px) {
2524
2542
  .copilotKitSidebar [role="dialog"] {
2525
2543
  inset: auto !important;
2526
- top: ${tokens.spacing.sm} !important;
2527
- right: ${tokens.spacing.sm} !important;
2528
- /* Reserve space for Android nav buttons on desktop too */
2529
- bottom: max(90px, env(safe-area-inset-bottom, 90px)) !important;
2544
+ /* TOP: Account for status bar safe area */
2545
+ top: calc(${tokens.spacing.sm} + env(safe-area-inset-top, 0px)) !important;
2546
+ /* RIGHT: Account for landscape notch on right side */
2547
+ right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px)) !important;
2548
+ /* BOTTOM: Account for horizontal navbar (52px) + safe area */
2549
+ bottom: calc(52px + ${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px)) !important;
2530
2550
  left: auto !important;
2531
2551
  width: 28rem !important;
2532
- /* Adjust height to account for bottom safe area */
2533
- height: calc(100vh - ${tokens.spacing.lg} - max(80px, env(safe-area-inset-bottom, 80px))) !important;
2552
+ /* Adjust height to account for top, bottom safe areas, and navbar */
2553
+ height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2534
2554
  max-width: 28rem !important;
2535
- max-height: calc(100vh - ${tokens.spacing.lg} - max(80px, env(safe-area-inset-bottom, 80px))) !important;
2555
+ max-height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2536
2556
  }
2537
2557
  }
2538
2558
 
@@ -2552,6 +2572,18 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2552
2572
  }
2553
2573
  }
2554
2574
 
2575
+ /* Position chat button with safe area on landscape (right side for Android controls) */
2576
+ @media (orientation: landscape) {
2577
+ .copilotKitSidebarContentWrapper {
2578
+ button[aria-label="Open chat"],
2579
+ button[aria-label="Close chat"] {
2580
+ bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
2581
+ right: calc(var(--safe-area-right, 0px) + 8px) !important;
2582
+ z-index: 2000 !important;
2583
+ }
2584
+ }
2585
+ }
2586
+
2555
2587
  /* Fix messages container background */
2556
2588
  .copilotKitMessages {
2557
2589
  background-color: transparent !important;
@@ -2622,8 +2654,8 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2622
2654
  `;
2623
2655
  var StyledChatButton2 = styled4.button`
2624
2656
  position: fixed;
2625
- bottom: ${tokens.spacing.sm};
2626
- right: ${tokens.spacing.sm};
2657
+ bottom: calc(${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px));
2658
+ right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px));
2627
2659
  width: 36px;
2628
2660
  height: 36px;
2629
2661
  border-radius: ${tokens.borderRadius.full};